From 74b173ea0a61d30ee07232e9b3ff230ad341e70d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 4 Aug 2022 14:47:28 +0000 Subject: [PATCH 1/3] Regenerate client from commit 27b7ba8d of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 27 +++ api/v1/datadog/model_synthetics_basic_auth.go | 38 +++- .../model_synthetics_basic_auth_digest.go | 187 ++++++++++++++++++ ...model_synthetics_basic_auth_digest_type.go | 107 ++++++++++ 5 files changed, 360 insertions(+), 7 deletions(-) create mode 100644 api/v1/datadog/model_synthetics_basic_auth_digest.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_digest_type.go diff --git a/.apigentools-info b/.apigentools-info index affa9e639f0..4fb0cbd6e17 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.2", - "regenerated": "2022-08-04 14:08:04.711882", - "spec_repo_commit": "43d0c8cf" + "regenerated": "2022-08-04 14:45:29.625822", + "spec_repo_commit": "27b7ba8d" }, "v2": { "apigentools_version": "1.6.2", - "regenerated": "2022-08-04 14:08:04.725381", - "spec_repo_commit": "43d0c8cf" + "regenerated": "2022-08-04 14:45:29.640704", + "spec_repo_commit": "27b7ba8d" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 49d8263a346..7830c028eb0 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10868,7 +10868,34 @@ components: - $ref: '#/components/schemas/SyntheticsBasicAuthWeb' - $ref: '#/components/schemas/SyntheticsBasicAuthSigv4' - $ref: '#/components/schemas/SyntheticsBasicAuthNTLM' + - $ref: '#/components/schemas/SyntheticsBasicAuthDigest' type: object + SyntheticsBasicAuthDigest: + description: Object to handle digest authentication when performing the test. + properties: + password: + description: Password to use for the digest authentication. + example: PaSSw0RD! + type: string + type: + $ref: '#/components/schemas/SyntheticsBasicAuthDigestType' + username: + description: Username to use for the digest authentication. + example: my_username + type: string + required: + - password + - username + type: object + SyntheticsBasicAuthDigestType: + default: digest + description: The type of basic authentication to use when performing the test. + enum: + - digest + example: digest + type: string + x-enum-varnames: + - DIGEST SyntheticsBasicAuthNTLM: description: Object to handle `NTLM` authentication when performing the test. properties: diff --git a/api/v1/datadog/model_synthetics_basic_auth.go b/api/v1/datadog/model_synthetics_basic_auth.go index 81f266bf02f..f45be6c5a5e 100644 --- a/api/v1/datadog/model_synthetics_basic_auth.go +++ b/api/v1/datadog/model_synthetics_basic_auth.go @@ -10,9 +10,10 @@ import ( // SyntheticsBasicAuth - Object to handle basic authentication when performing the test. type SyntheticsBasicAuth struct { - SyntheticsBasicAuthWeb *SyntheticsBasicAuthWeb - SyntheticsBasicAuthSigv4 *SyntheticsBasicAuthSigv4 - SyntheticsBasicAuthNTLM *SyntheticsBasicAuthNTLM + SyntheticsBasicAuthWeb *SyntheticsBasicAuthWeb + SyntheticsBasicAuthSigv4 *SyntheticsBasicAuthSigv4 + SyntheticsBasicAuthNTLM *SyntheticsBasicAuthNTLM + SyntheticsBasicAuthDigest *SyntheticsBasicAuthDigest // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} @@ -33,6 +34,11 @@ func SyntheticsBasicAuthNTLMAsSyntheticsBasicAuth(v *SyntheticsBasicAuthNTLM) Sy return SyntheticsBasicAuth{SyntheticsBasicAuthNTLM: v} } +// SyntheticsBasicAuthDigestAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthDigest wrapped in SyntheticsBasicAuth. +func SyntheticsBasicAuthDigestAsSyntheticsBasicAuth(v *SyntheticsBasicAuthDigest) SyntheticsBasicAuth { + return SyntheticsBasicAuth{SyntheticsBasicAuthDigest: v} +} + // UnmarshalJSON turns data into one of the pointers in the struct. func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error { var err error @@ -88,11 +94,29 @@ func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error { obj.SyntheticsBasicAuthNTLM = nil } + // try to unmarshal data into SyntheticsBasicAuthDigest + err = json.Unmarshal(data, &obj.SyntheticsBasicAuthDigest) + if err == nil { + if obj.SyntheticsBasicAuthDigest != nil && obj.SyntheticsBasicAuthDigest.UnparsedObject == nil { + jsonSyntheticsBasicAuthDigest, _ := json.Marshal(obj.SyntheticsBasicAuthDigest) + if string(jsonSyntheticsBasicAuthDigest) == "{}" { // empty struct + obj.SyntheticsBasicAuthDigest = nil + } else { + match++ + } + } else { + obj.SyntheticsBasicAuthDigest = nil + } + } else { + obj.SyntheticsBasicAuthDigest = nil + } + if match != 1 { // more than 1 match // reset to nil obj.SyntheticsBasicAuthWeb = nil obj.SyntheticsBasicAuthSigv4 = nil obj.SyntheticsBasicAuthNTLM = nil + obj.SyntheticsBasicAuthDigest = nil return json.Unmarshal(data, &obj.UnparsedObject) } return nil // exactly one match @@ -112,6 +136,10 @@ func (obj SyntheticsBasicAuth) MarshalJSON() ([]byte, error) { return json.Marshal(&obj.SyntheticsBasicAuthNTLM) } + if obj.SyntheticsBasicAuthDigest != nil { + return json.Marshal(&obj.SyntheticsBasicAuthDigest) + } + if obj.UnparsedObject != nil { return json.Marshal(obj.UnparsedObject) } @@ -132,6 +160,10 @@ func (obj *SyntheticsBasicAuth) GetActualInstance() interface{} { return obj.SyntheticsBasicAuthNTLM } + if obj.SyntheticsBasicAuthDigest != nil { + return obj.SyntheticsBasicAuthDigest + } + // all schemas are nil return nil } diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest.go b/api/v1/datadog/model_synthetics_basic_auth_digest.go new file mode 100644 index 00000000000..3615ee77437 --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_digest.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthDigest Object to handle digest authentication when performing the test. +type SyntheticsBasicAuthDigest struct { + // Password to use for the digest authentication. + Password string `json:"password"` + // The type of basic authentication to use when performing the test. + Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` + // Username to use for the digest authentication. + Username string `json:"username"` + // 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{} +} + +// NewSyntheticsBasicAuthDigest instantiates a new SyntheticsBasicAuthDigest 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 NewSyntheticsBasicAuthDigest(password string, username string) *SyntheticsBasicAuthDigest { + this := SyntheticsBasicAuthDigest{} + this.Password = password + var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST + this.Type = &typeVar + this.Username = username + return &this +} + +// NewSyntheticsBasicAuthDigestWithDefaults instantiates a new SyntheticsBasicAuthDigest 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 NewSyntheticsBasicAuthDigestWithDefaults() *SyntheticsBasicAuthDigest { + this := SyntheticsBasicAuthDigest{} + var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST + this.Type = &typeVar + return &this +} + +// GetPassword returns the Password field value. +func (o *SyntheticsBasicAuthDigest) GetPassword() string { + if o == nil { + var ret string + return ret + } + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value. +func (o *SyntheticsBasicAuthDigest) SetPassword(v string) { + o.Password = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthDigest) GetType() SyntheticsBasicAuthDigestType { + if o == nil || o.Type == nil { + var ret SyntheticsBasicAuthDigestType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetTypeOk() (*SyntheticsBasicAuthDigestType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthDigest) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsBasicAuthDigestType and assigns it to the Type field. +func (o *SyntheticsBasicAuthDigest) SetType(v SyntheticsBasicAuthDigestType) { + o.Type = &v +} + +// GetUsername returns the Username field value. +func (o *SyntheticsBasicAuthDigest) GetUsername() string { + if o == nil { + var ret string + return ret + } + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value. +func (o *SyntheticsBasicAuthDigest) SetUsername(v string) { + o.Username = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBasicAuthDigest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["password"] = o.Password + if o.Type != nil { + toSerialize["type"] = o.Type + } + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Password *string `json:"password"` + Username *string `json:"username"` + }{} + all := struct { + Password string `json:"password"` + Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` + Username string `json:"username"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Password == nil { + return fmt.Errorf("Required field password missing") + } + if required.Username == nil { + return fmt.Errorf("Required field username missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Password = all.Password + o.Type = all.Type + o.Username = all.Username + return nil +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest_type.go b/api/v1/datadog/model_synthetics_basic_auth_digest_type.go new file mode 100644 index 00000000000..f054e3531ad --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_digest_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthDigestType The type of basic authentication to use when performing the test. +type SyntheticsBasicAuthDigestType string + +// List of SyntheticsBasicAuthDigestType. +const ( + SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST SyntheticsBasicAuthDigestType = "digest" +) + +var allowedSyntheticsBasicAuthDigestTypeEnumValues = []SyntheticsBasicAuthDigestType{ + SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBasicAuthDigestType) GetAllowedValues() []SyntheticsBasicAuthDigestType { + return allowedSyntheticsBasicAuthDigestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBasicAuthDigestType(value) + return nil +} + +// NewSyntheticsBasicAuthDigestTypeFromValue returns a pointer to a valid SyntheticsBasicAuthDigestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBasicAuthDigestTypeFromValue(v string) (*SyntheticsBasicAuthDigestType, error) { + ev := SyntheticsBasicAuthDigestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthDigestType: valid values are %v", v, allowedSyntheticsBasicAuthDigestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBasicAuthDigestType) IsValid() bool { + for _, existing := range allowedSyntheticsBasicAuthDigestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBasicAuthDigestType value. +func (v SyntheticsBasicAuthDigestType) Ptr() *SyntheticsBasicAuthDigestType { + return &v +} + +// NullableSyntheticsBasicAuthDigestType handles when a null is used for SyntheticsBasicAuthDigestType. +type NullableSyntheticsBasicAuthDigestType struct { + value *SyntheticsBasicAuthDigestType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBasicAuthDigestType) Get() *SyntheticsBasicAuthDigestType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBasicAuthDigestType) Set(val *SyntheticsBasicAuthDigestType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBasicAuthDigestType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBasicAuthDigestType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBasicAuthDigestType initializes the struct as if Set has been called. +func NewNullableSyntheticsBasicAuthDigestType(val *SyntheticsBasicAuthDigestType) *NullableSyntheticsBasicAuthDigestType { + return &NullableSyntheticsBasicAuthDigestType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBasicAuthDigestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} From 590076957f5e9a6c3197160341ebd0d7f0383e10 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 4 Aug 2022 14:49:55 +0000 Subject: [PATCH 2/3] pre-commit fixes --- api/common/client.go | 492 -- api/common/configuration.go | 582 -- api/common/no_zstd.go | 16 - api/common/utils.go | 437 -- api/common/zstd.go | 25 - api/v1/datadog/api_authentication.go | 136 - api/v1/datadog/api_aws_integration.go | 1412 ---- api/v1/datadog/api_aws_logs_integration.go | 1010 --- api/v1/datadog/api_azure_integration.go | 735 -- api/v1/datadog/api_dashboard_lists.go | 721 -- api/v1/datadog/api_dashboards.go | 1046 --- api/v1/datadog/api_downtimes.go | 1027 --- api/v1/datadog/api_events.go | 529 -- api/v1/datadog/api_gcp_integration.go | 588 -- api/v1/datadog/api_hosts.go | 722 -- api/v1/datadog/api_ip_ranges.go | 113 - api/v1/datadog/api_key_management.go | 1443 ---- api/v1/datadog/api_logs.go | 354 - api/v1/datadog/api_logs_indexes.go | 848 --- api/v1/datadog/api_logs_pipelines.go | 988 --- api/v1/datadog/api_metrics.go | 1152 --- api/v1/datadog/api_monitors.go | 1953 ----- api/v1/datadog/api_notebooks.go | 884 --- api/v1/datadog/api_organizations.go | 888 --- api/v1/datadog/api_pager_duty_integration.go | 574 -- api/v1/datadog/api_security_monitoring.go | 488 -- api/v1/datadog/api_service_checks.go | 175 - ...api_service_level_objective_corrections.go | 719 -- .../datadog/api_service_level_objectives.go | 1749 ----- api/v1/datadog/api_slack_integration.go | 770 -- api/v1/datadog/api_snapshots.go | 261 - api/v1/datadog/api_synthetics.go | 3883 ---------- api/v1/datadog/api_tags.go | 861 --- api/v1/datadog/api_usage_metering.go | 6764 ----------------- api/v1/datadog/api_users.go | 747 -- api/v1/datadog/api_webhooks_integration.go | 1165 --- api/v1/datadog/model_access_role.go | 113 - .../model_add_signal_to_incident_request.go | 181 - .../model_alert_graph_widget_definition.go | 358 - ...odel_alert_graph_widget_definition_type.go | 107 - .../model_alert_value_widget_definition.go | 396 - ...odel_alert_value_widget_definition_type.go | 107 - api/v1/datadog/model_api_error_response.go | 103 - api/v1/datadog/model_api_key.go | 219 - api/v1/datadog/model_api_key_list_response.go | 102 - api/v1/datadog/model_api_key_response.go | 109 - .../model_apm_stats_query_column_type.go | 236 - .../model_apm_stats_query_definition.go | 321 - .../datadog/model_apm_stats_query_row_type.go | 111 - api/v1/datadog/model_application_key.go | 180 - .../model_application_key_list_response.go | 102 - .../datadog/model_application_key_response.go | 109 - ...odel_authentication_validation_response.go | 102 - api/v1/datadog/model_aws_account.go | 512 -- .../model_aws_account_and_lambda_request.go | 136 - .../model_aws_account_create_response.go | 102 - .../model_aws_account_delete_request.go | 180 - .../model_aws_account_list_response.go | 102 - api/v1/datadog/model_aws_logs_async_error.go | 141 - .../datadog/model_aws_logs_async_response.go | 141 - api/v1/datadog/model_aws_logs_lambda.go | 102 - .../datadog/model_aws_logs_list_response.go | 180 - .../model_aws_logs_list_services_response.go | 141 - .../model_aws_logs_services_request.go | 136 - api/v1/datadog/model_aws_namespace.go | 119 - api/v1/datadog/model_aws_tag_filter.go | 149 - .../model_aws_tag_filter_create_request.go | 188 - .../model_aws_tag_filter_delete_request.go | 149 - .../model_aws_tag_filter_list_response.go | 102 - api/v1/datadog/model_azure_account.go | 376 - ...model_cancel_downtimes_by_scope_request.go | 105 - .../datadog/model_canceled_downtimes_ids.go | 102 - .../datadog/model_change_widget_definition.go | 359 - .../model_change_widget_definition_type.go | 107 - api/v1/datadog/model_change_widget_request.go | 861 --- ...model_check_can_delete_monitor_response.go | 149 - ..._check_can_delete_monitor_response_data.go | 102 - .../model_check_can_delete_slo_response.go | 148 - ...odel_check_can_delete_slo_response_data.go | 102 - .../model_check_status_widget_definition.go | 475 -- ...del_check_status_widget_definition_type.go | 107 - api/v1/datadog/model_content_encoding.go | 109 - api/v1/datadog/model_creator.go | 193 - api/v1/datadog/model_dashboard.go | 739 -- .../model_dashboard_bulk_action_data.go | 146 - .../model_dashboard_bulk_delete_request.go | 103 - .../model_dashboard_delete_response.go | 102 - api/v1/datadog/model_dashboard_layout_type.go | 109 - api/v1/datadog/model_dashboard_list.go | 392 - .../model_dashboard_list_delete_response.go | 102 - .../model_dashboard_list_list_response.go | 102 - api/v1/datadog/model_dashboard_reflow_type.go | 111 - .../datadog/model_dashboard_resource_type.go | 107 - .../model_dashboard_restore_request.go | 103 - api/v1/datadog/model_dashboard_summary.go | 102 - .../model_dashboard_summary_definition.go | 444 -- .../model_dashboard_template_variable.go | 245 - ...odel_dashboard_template_variable_preset.go | 141 - ...ashboard_template_variable_preset_value.go | 141 - api/v1/datadog/model_deleted_monitor.go | 102 - .../datadog/model_distribution_point_item.go | 155 - ...el_distribution_points_content_encoding.go | 107 - .../model_distribution_points_payload.go | 103 - .../model_distribution_points_series.go | 265 - .../datadog/model_distribution_points_type.go | 107 - .../model_distribution_widget_definition.go | 539 -- ...del_distribution_widget_definition_type.go | 107 - ...ribution_widget_histogram_request_query.go | 187 - ...tribution_widget_histogram_request_type.go | 107 - .../model_distribution_widget_request.go | 648 -- .../model_distribution_widget_x_axis.go | 231 - .../model_distribution_widget_y_axis.go | 270 - api/v1/datadog/model_downtime.go | 859 --- api/v1/datadog/model_downtime_child.go | 856 --- api/v1/datadog/model_downtime_recurrence.go | 381 - api/v1/datadog/model_event.go | 605 -- api/v1/datadog/model_event_alert_type.go | 121 - api/v1/datadog/model_event_create_request.go | 522 -- api/v1/datadog/model_event_create_response.go | 148 - api/v1/datadog/model_event_list_response.go | 141 - api/v1/datadog/model_event_priority.go | 109 - .../datadog/model_event_query_definition.go | 136 - api/v1/datadog/model_event_response.go | 148 - .../model_event_stream_widget_definition.go | 404 - ...del_event_stream_widget_definition_type.go | 107 - .../model_event_timeline_widget_definition.go | 356 - ...l_event_timeline_widget_definition_type.go | 107 - ...a_and_function_apm_dependency_stat_name.go | 119 - ...nction_apm_dependency_stats_data_source.go | 107 - ...n_apm_dependency_stats_query_definition.go | 434 -- ...ula_and_function_apm_resource_stat_name.go | 127 - ...function_apm_resource_stats_data_source.go | 107 - ...ion_apm_resource_stats_query_definition.go | 446 -- ..._formula_and_function_event_aggregation.go | 129 - ...ula_and_function_event_query_definition.go | 308 - ...function_event_query_definition_compute.go | 189 - ..._function_event_query_definition_search.go | 103 - ...rmula_and_function_event_query_group_by.go | 188 - ..._and_function_event_query_group_by_sort.go | 201 - ...formula_and_function_events_data_source.go | 121 - ...formula_and_function_metric_aggregation.go | 121 - ...formula_and_function_metric_data_source.go | 107 - ...la_and_function_metric_query_definition.go | 224 - ..._and_function_process_query_data_source.go | 109 - ...a_and_function_process_query_definition.go | 431 -- ...l_formula_and_function_query_definition.go | 251 - ...el_formula_and_function_response_format.go | 109 - .../model_free_text_widget_definition.go | 271 - .../model_free_text_widget_definition_type.go | 107 - api/v1/datadog/model_funnel_query.go | 179 - api/v1/datadog/model_funnel_request_type.go | 107 - api/v1/datadog/model_funnel_source.go | 107 - api/v1/datadog/model_funnel_step.go | 136 - .../datadog/model_funnel_widget_definition.go | 318 - .../model_funnel_widget_definition_type.go | 107 - api/v1/datadog/model_funnel_widget_request.go | 151 - api/v1/datadog/model_gcp_account.go | 572 -- .../datadog/model_geomap_widget_definition.go | 439 -- .../model_geomap_widget_definition_style.go | 136 - .../model_geomap_widget_definition_type.go | 107 - .../model_geomap_widget_definition_view.go | 103 - api/v1/datadog/model_geomap_widget_request.go | 365 - api/v1/datadog/model_graph_snapshot.go | 182 - .../datadog/model_group_widget_definition.go | 394 - .../model_group_widget_definition_type.go | 107 - .../model_heat_map_widget_definition.go | 519 -- .../model_heat_map_widget_definition_type.go | 107 - .../datadog/model_heat_map_widget_request.go | 516 -- api/v1/datadog/model_host.go | 623 -- api/v1/datadog/model_host_list_response.go | 180 - api/v1/datadog/model_host_map_request.go | 470 -- .../model_host_map_widget_definition.go | 605 -- ...del_host_map_widget_definition_requests.go | 155 - .../model_host_map_widget_definition_style.go | 219 - .../model_host_map_widget_definition_type.go | 107 - api/v1/datadog/model_host_meta.go | 655 -- .../datadog/model_host_meta_install_method.go | 180 - api/v1/datadog/model_host_metrics.go | 180 - api/v1/datadog/model_host_mute_response.go | 219 - api/v1/datadog/model_host_mute_settings.go | 180 - api/v1/datadog/model_host_tags.go | 141 - api/v1/datadog/model_host_totals.go | 141 - .../model_hourly_usage_attribution_body.go | 392 - ...model_hourly_usage_attribution_metadata.go | 109 - ...del_hourly_usage_attribution_pagination.go | 115 - ...model_hourly_usage_attribution_response.go | 148 - ...del_hourly_usage_attribution_usage_type.go | 153 - api/v1/datadog/model_http_log_error.go | 136 - api/v1/datadog/model_http_log_item.go | 265 - api/v1/datadog/model_http_method.go | 119 - .../model_i_frame_widget_definition.go | 146 - .../model_i_frame_widget_definition_type.go | 107 - api/v1/datadog/model_idp_form_data.go | 104 - api/v1/datadog/model_idp_response.go | 103 - .../datadog/model_image_widget_definition.go | 461 -- .../model_image_widget_definition_type.go | 107 - .../datadog/model_intake_payload_accepted.go | 102 - api/v1/datadog/model_ip_prefixes_agents.go | 141 - api/v1/datadog/model_ip_prefixes_api.go | 141 - api/v1/datadog/model_ip_prefixes_apm.go | 141 - api/v1/datadog/model_ip_prefixes_logs.go | 141 - api/v1/datadog/model_ip_prefixes_process.go | 141 - .../datadog/model_ip_prefixes_synthetics.go | 219 - ...p_prefixes_synthetics_private_locations.go | 141 - api/v1/datadog/model_ip_prefixes_webhooks.go | 141 - api/v1/datadog/model_ip_ranges.go | 509 -- api/v1/datadog/model_list_stream_column.go | 144 - .../datadog/model_list_stream_column_width.go | 111 - api/v1/datadog/model_list_stream_query.go | 185 - .../model_list_stream_response_format.go | 107 - api/v1/datadog/model_list_stream_source.go | 113 - .../model_list_stream_widget_definition.go | 397 - ...odel_list_stream_widget_definition_type.go | 107 - .../model_list_stream_widget_request.go | 184 - api/v1/datadog/model_log.go | 148 - api/v1/datadog/model_log_content.go | 306 - api/v1/datadog/model_log_query_definition.go | 272 - .../model_log_query_definition_group_by.go | 188 - ...odel_log_query_definition_group_by_sort.go | 183 - .../model_log_query_definition_search.go | 103 - .../model_log_stream_widget_definition.go | 615 -- ...model_log_stream_widget_definition_type.go | 107 - api/v1/datadog/model_logs_api_error.go | 180 - .../datadog/model_logs_api_error_response.go | 109 - .../model_logs_arithmetic_processor.go | 325 - .../model_logs_arithmetic_processor_type.go | 107 - .../datadog/model_logs_attribute_remapper.go | 484 -- .../model_logs_attribute_remapper_type.go | 107 - api/v1/datadog/model_logs_by_retention.go | 194 - .../model_logs_by_retention_monthly_usage.go | 146 - .../model_logs_by_retention_org_usage.go | 102 - .../datadog/model_logs_by_retention_orgs.go | 102 - .../datadog/model_logs_category_processor.go | 274 - .../model_logs_category_processor_category.go | 148 - .../model_logs_category_processor_type.go | 107 - api/v1/datadog/model_logs_date_remapper.go | 246 - .../datadog/model_logs_date_remapper_type.go | 107 - api/v1/datadog/model_logs_exclusion.go | 188 - api/v1/datadog/model_logs_exclusion_filter.go | 144 - api/v1/datadog/model_logs_filter.go | 102 - api/v1/datadog/model_logs_geo_ip_parser.go | 264 - .../datadog/model_logs_geo_ip_parser_type.go | 107 - api/v1/datadog/model_logs_grok_parser.go | 310 - .../datadog/model_logs_grok_parser_rules.go | 146 - api/v1/datadog/model_logs_grok_parser_type.go | 107 - api/v1/datadog/model_logs_index.go | 303 - .../datadog/model_logs_index_list_response.go | 102 - .../model_logs_index_update_request.go | 274 - api/v1/datadog/model_logs_indexes_order.go | 105 - api/v1/datadog/model_logs_list_request.go | 318 - .../datadog/model_logs_list_request_time.go | 185 - api/v1/datadog/model_logs_list_response.go | 181 - api/v1/datadog/model_logs_lookup_processor.go | 340 - .../model_logs_lookup_processor_type.go | 107 - api/v1/datadog/model_logs_message_remapper.go | 233 - .../model_logs_message_remapper_type.go | 107 - api/v1/datadog/model_logs_pipeline.go | 348 - .../datadog/model_logs_pipeline_processor.go | 284 - .../model_logs_pipeline_processor_type.go | 107 - api/v1/datadog/model_logs_pipelines_order.go | 104 - api/v1/datadog/model_logs_processor.go | 571 -- api/v1/datadog/model_logs_query_compute.go | 181 - .../model_logs_retention_agg_sum_usage.go | 219 - .../datadog/model_logs_retention_sum_usage.go | 219 - api/v1/datadog/model_logs_service_remapper.go | 231 - .../model_logs_service_remapper_type.go | 107 - api/v1/datadog/model_logs_sort.go | 109 - api/v1/datadog/model_logs_status_remapper.go | 245 - .../model_logs_status_remapper_type.go | 107 - .../model_logs_string_builder_processor.go | 317 - ...odel_logs_string_builder_processor_type.go | 107 - api/v1/datadog/model_logs_trace_remapper.go | 239 - .../datadog/model_logs_trace_remapper_type.go | 107 - api/v1/datadog/model_logs_url_parser.go | 319 - api/v1/datadog/model_logs_url_parser_type.go | 107 - .../datadog/model_logs_user_agent_parser.go | 307 - .../model_logs_user_agent_parser_type.go | 107 - .../datadog/model_metric_content_encoding.go | 107 - api/v1/datadog/model_metric_metadata.go | 336 - .../datadog/model_metric_search_response.go | 109 - .../model_metric_search_response_results.go | 102 - api/v1/datadog/model_metrics_list_response.go | 141 - api/v1/datadog/model_metrics_payload.go | 103 - .../datadog/model_metrics_query_metadata.go | 585 -- .../datadog/model_metrics_query_response.go | 414 - api/v1/datadog/model_metrics_query_unit.go | 308 - api/v1/datadog/model_monitor.go | 753 -- api/v1/datadog/model_monitor_device_id.go | 123 - ..._formula_and_function_event_aggregation.go | 129 - ...ula_and_function_event_query_definition.go | 308 - ...function_event_query_definition_compute.go | 189 - ..._function_event_query_definition_search.go | 103 - ...rmula_and_function_event_query_group_by.go | 188 - ..._and_function_event_query_group_by_sort.go | 201 - ...formula_and_function_events_data_source.go | 111 - ...r_formula_and_function_query_definition.go | 123 - .../model_monitor_group_search_response.go | 194 - ...el_monitor_group_search_response_counts.go | 141 - .../model_monitor_group_search_result.go | 357 - api/v1/datadog/model_monitor_options.go | 1248 --- .../model_monitor_options_aggregation.go | 180 - .../datadog/model_monitor_overall_states.go | 119 - .../model_monitor_renotify_status_type.go | 111 - .../model_monitor_search_count_item.go | 141 - .../datadog/model_monitor_search_response.go | 194 - .../model_monitor_search_response_counts.go | 219 - .../model_monitor_search_response_metadata.go | 219 - api/v1/datadog/model_monitor_search_result.go | 609 -- ...odel_monitor_search_result_notification.go | 141 - api/v1/datadog/model_monitor_state.go | 103 - api/v1/datadog/model_monitor_state_group.go | 305 - ...model_monitor_summary_widget_definition.go | 623 -- ..._monitor_summary_widget_definition_type.go | 107 - .../model_monitor_threshold_window_options.go | 165 - api/v1/datadog/model_monitor_thresholds.go | 354 - api/v1/datadog/model_monitor_type.go | 137 - .../datadog/model_monitor_update_request.go | 746 -- .../model_monthly_usage_attribution_body.go | 356 - ...odel_monthly_usage_attribution_metadata.go | 148 - ...el_monthly_usage_attribution_pagination.go | 115 - ...odel_monthly_usage_attribution_response.go | 148 - ...hly_usage_attribution_supported_metrics.go | 203 - .../model_monthly_usage_attribution_values.go | 1467 ---- .../datadog/model_note_widget_definition.go | 486 -- .../model_note_widget_definition_type.go | 107 - .../datadog/model_notebook_absolute_time.go | 184 - api/v1/datadog/model_notebook_author.go | 443 -- .../model_notebook_cell_create_request.go | 142 - ...notebook_cell_create_request_attributes.go | 284 - .../model_notebook_cell_resource_type.go | 107 - .../datadog/model_notebook_cell_response.go | 180 - ...model_notebook_cell_response_attributes.go | 284 - api/v1/datadog/model_notebook_cell_time.go | 155 - .../model_notebook_cell_update_request.go | 180 - ...notebook_cell_update_request_attributes.go | 284 - api/v1/datadog/model_notebook_create_data.go | 153 - .../model_notebook_create_data_attributes.go | 266 - .../datadog/model_notebook_create_request.go | 110 - ...l_notebook_distribution_cell_attributes.go | 255 - api/v1/datadog/model_notebook_global_time.go | 155 - api/v1/datadog/model_notebook_graph_size.go | 115 - ...model_notebook_heat_map_cell_attributes.go | 253 - ...del_notebook_log_stream_cell_attributes.go | 207 - ...model_notebook_markdown_cell_attributes.go | 110 - ...model_notebook_markdown_cell_definition.go | 146 - ..._notebook_markdown_cell_definition_type.go | 107 - api/v1/datadog/model_notebook_metadata.go | 207 - .../datadog/model_notebook_metadata_type.go | 115 - .../datadog/model_notebook_relative_time.go | 161 - .../datadog/model_notebook_resource_type.go | 107 - api/v1/datadog/model_notebook_response.go | 109 - .../datadog/model_notebook_response_data.go | 186 - ...model_notebook_response_data_attributes.go | 399 - api/v1/datadog/model_notebook_split_by.go | 136 - api/v1/datadog/model_notebook_status.go | 107 - ...del_notebook_timeseries_cell_attributes.go | 253 - .../model_notebook_toplist_cell_attributes.go | 253 - api/v1/datadog/model_notebook_update_cell.go | 156 - api/v1/datadog/model_notebook_update_data.go | 153 - .../model_notebook_update_data_attributes.go | 266 - .../datadog/model_notebook_update_request.go | 110 - api/v1/datadog/model_notebooks_response.go | 148 - .../datadog/model_notebooks_response_data.go | 186 - ...odel_notebooks_response_data_attributes.go | 411 - .../datadog/model_notebooks_response_meta.go | 109 - .../datadog/model_notebooks_response_page.go | 141 - .../datadog/model_org_downgraded_response.go | 102 - api/v1/datadog/model_organization.go | 404 - api/v1/datadog/model_organization_billing.go | 102 - .../datadog/model_organization_create_body.go | 203 - .../model_organization_create_response.go | 247 - .../model_organization_list_response.go | 102 - api/v1/datadog/model_organization_response.go | 109 - api/v1/datadog/model_organization_settings.go | 494 -- .../model_organization_settings_saml.go | 103 - ..._settings_saml_autocreate_users_domains.go | 141 - ...ation_settings_saml_idp_initiated_login.go | 103 - ..._organization_settings_saml_strict_mode.go | 103 - .../model_organization_subscription.go | 102 - api/v1/datadog/model_pager_duty_service.go | 136 - .../datadog/model_pager_duty_service_key.go | 103 - .../datadog/model_pager_duty_service_name.go | 103 - api/v1/datadog/model_pagination.go | 141 - .../datadog/model_process_query_definition.go | 220 - api/v1/datadog/model_query_sort_order.go | 109 - .../model_query_value_widget_definition.go | 566 -- ...odel_query_value_widget_definition_type.go | 107 - .../model_query_value_widget_request.go | 727 -- .../datadog/model_response_meta_attributes.go | 109 - api/v1/datadog/model_scatter_plot_request.go | 517 -- .../model_scatter_plot_widget_definition.go | 494 -- ...scatter_plot_widget_definition_requests.go | 201 - ...del_scatter_plot_widget_definition_type.go | 107 - api/v1/datadog/model_scatterplot_dimension.go | 113 - .../model_scatterplot_table_request.go | 188 - .../model_scatterplot_widget_aggregator.go | 115 - .../model_scatterplot_widget_formula.go | 183 - api/v1/datadog/model_search_slo_response.go | 201 - .../datadog/model_search_slo_response_data.go | 148 - ...del_search_slo_response_data_attributes.go | 148 - ...rch_slo_response_data_attributes_facets.go | 375 - ...ponse_data_attributes_facets_object_int.go | 141 - ...se_data_attributes_facets_object_string.go | 141 - .../model_search_slo_response_links.go | 258 - .../datadog/model_search_slo_response_meta.go | 109 - .../model_search_slo_response_meta_page.go | 375 - api/v1/datadog/model_series.go | 312 - api/v1/datadog/model_service_check.go | 288 - api/v1/datadog/model_service_check_status.go | 113 - .../datadog/model_service_level_objective.go | 619 -- .../model_service_level_objective_query.go | 138 - .../model_service_level_objective_request.go | 406 - .../model_service_map_widget_definition.go | 343 - ...odel_service_map_widget_definition_type.go | 107 - ...model_service_summary_widget_definition.go | 711 -- ..._service_summary_widget_definition_type.go | 107 - api/v1/datadog/model_signal_archive_reason.go | 113 - .../model_signal_assignee_update_request.go | 142 - .../model_signal_state_update_request.go | 236 - api/v1/datadog/model_signal_triage_state.go | 111 - .../model_slack_integration_channel.go | 148 - ...model_slack_integration_channel_display.go | 235 - api/v1/datadog/model_slo_bulk_delete_error.go | 179 - .../datadog/model_slo_bulk_delete_response.go | 153 - .../model_slo_bulk_delete_response_data.go | 144 - api/v1/datadog/model_slo_correction.go | 199 - .../datadog/model_slo_correction_category.go | 113 - .../model_slo_correction_create_data.go | 159 - .../model_slo_correction_create_request.go | 109 - ...lo_correction_create_request_attributes.go | 373 - .../model_slo_correction_list_response.go | 148 - .../datadog/model_slo_correction_response.go | 109 - ...odel_slo_correction_response_attributes.go | 582 -- ...correction_response_attributes_modifier.go | 230 - api/v1/datadog/model_slo_correction_type.go | 107 - .../model_slo_correction_update_data.go | 160 - .../model_slo_correction_update_request.go | 109 - ...lo_correction_update_request_attributes.go | 345 - api/v1/datadog/model_slo_delete_response.go | 141 - api/v1/datadog/model_slo_error_timeframe.go | 114 - api/v1/datadog/model_slo_history_metrics.go | 358 - .../model_slo_history_metrics_series.go | 216 - ...del_slo_history_metrics_series_metadata.go | 300 - ...lo_history_metrics_series_metadata_unit.go | 371 - api/v1/datadog/model_slo_history_monitor.go | 541 -- api/v1/datadog/model_slo_history_response.go | 148 - .../model_slo_history_response_data.go | 494 -- .../model_slo_history_response_error.go | 102 - ...el_slo_history_response_error_with_type.go | 136 - api/v1/datadog/model_slo_history_sli_data.go | 537 -- api/v1/datadog/model_slo_list_response.go | 188 - .../model_slo_list_response_metadata.go | 109 - .../model_slo_list_response_metadata_page.go | 141 - api/v1/datadog/model_slo_response.go | 150 - api/v1/datadog/model_slo_response_data.go | 669 -- api/v1/datadog/model_slo_threshold.go | 270 - api/v1/datadog/model_slo_timeframe.go | 113 - api/v1/datadog/model_slo_type.go | 109 - api/v1/datadog/model_slo_type_numeric.go | 111 - api/v1/datadog/model_slo_widget_definition.go | 476 -- .../model_slo_widget_definition_type.go | 107 - ...model_successful_signal_update_response.go | 102 - .../model_sunburst_widget_definition.go | 434 -- .../model_sunburst_widget_definition_type.go | 107 - .../datadog/model_sunburst_widget_legend.go | 155 - ...sunburst_widget_legend_inline_automatic.go | 189 - ...rst_widget_legend_inline_automatic_type.go | 109 - .../model_sunburst_widget_legend_table.go | 111 - ...model_sunburst_widget_legend_table_type.go | 109 - .../datadog/model_sunburst_widget_request.go | 641 -- api/v1/datadog/model_synthetics_api_step.go | 381 - .../model_synthetics_api_step_subtype.go | 107 - api/v1/datadog/model_synthetics_api_test_.go | 505 -- .../model_synthetics_api_test_config.go | 226 - .../model_synthetics_api_test_failure_code.go | 157 - .../model_synthetics_api_test_result_data.go | 444 -- ...odel_synthetics_api_test_result_failure.go | 149 - .../model_synthetics_api_test_result_full.go | 361 - ...l_synthetics_api_test_result_full_check.go | 110 - .../model_synthetics_api_test_result_short.go | 276 - ...synthetics_api_test_result_short_result.go | 149 - .../datadog/model_synthetics_api_test_type.go | 107 - api/v1/datadog/model_synthetics_assertion.go | 156 - ...synthetics_assertion_json_path_operator.go | 107 - ...l_synthetics_assertion_json_path_target.go | 237 - ...etics_assertion_json_path_target_target.go | 180 - .../model_synthetics_assertion_operator.go | 131 - .../model_synthetics_assertion_target.go | 224 - .../model_synthetics_assertion_type.go | 139 - api/v1/datadog/model_synthetics_basic_auth.go | 219 - .../model_synthetics_basic_auth_digest.go | 187 - ...model_synthetics_basic_auth_digest_type.go | 107 - .../model_synthetics_basic_auth_ntlm.go | 269 - .../model_synthetics_basic_auth_ntlm_type.go | 107 - .../model_synthetics_basic_auth_sigv4.go | 296 - .../model_synthetics_basic_auth_sigv4_type.go | 107 - .../model_synthetics_basic_auth_web.go | 187 - .../model_synthetics_basic_auth_web_type.go | 107 - .../datadog/model_synthetics_batch_details.go | 109 - .../model_synthetics_batch_details_data.go | 195 - .../datadog/model_synthetics_batch_result.go | 485 -- .../datadog/model_synthetics_browser_error.go | 216 - .../model_synthetics_browser_error_type.go | 109 - .../datadog/model_synthetics_browser_test_.go | 496 -- .../model_synthetics_browser_test_config.go | 260 - ...el_synthetics_browser_test_failure_code.go | 171 - ...del_synthetics_browser_test_result_data.go | 546 -- ..._synthetics_browser_test_result_failure.go | 149 - ...del_synthetics_browser_test_result_full.go | 361 - ...nthetics_browser_test_result_full_check.go | 110 - ...el_synthetics_browser_test_result_short.go | 276 - ...hetics_browser_test_result_short_result.go | 265 - ...el_synthetics_browser_test_rum_settings.go | 191 - .../model_synthetics_browser_test_type.go | 107 - .../model_synthetics_browser_variable.go | 262 - .../model_synthetics_browser_variable_type.go | 115 - api/v1/datadog/model_synthetics_check_type.go | 133 - .../model_synthetics_ci_batch_metadata.go | 155 - .../model_synthetics_ci_batch_metadata_ci.go | 155 - .../model_synthetics_ci_batch_metadata_git.go | 141 - ...l_synthetics_ci_batch_metadata_pipeline.go | 102 - ...l_synthetics_ci_batch_metadata_provider.go | 102 - api/v1/datadog/model_synthetics_ci_test_.go | 624 -- .../datadog/model_synthetics_ci_test_body.go | 102 - .../model_synthetics_config_variable.go | 261 - .../model_synthetics_config_variable_type.go | 109 - .../model_synthetics_core_web_vitals.go | 180 - .../model_synthetics_delete_tests_payload.go | 103 - .../model_synthetics_delete_tests_response.go | 103 - .../datadog/model_synthetics_deleted_test_.go | 147 - api/v1/datadog/model_synthetics_device.go | 249 - api/v1/datadog/model_synthetics_device_id.go | 129 - ...cs_get_api_test_latest_results_response.go | 141 - ...et_browser_test_latest_results_response.go | 141 - .../model_synthetics_global_variable.go | 379 - ...l_synthetics_global_variable_attributes.go | 102 - ...tics_global_variable_parse_test_options.go | 190 - ...global_variable_parse_test_options_type.go | 109 - ..._synthetics_global_variable_parser_type.go | 113 - .../model_synthetics_global_variable_value.go | 142 - ...nthetics_list_global_variables_response.go | 102 - .../model_synthetics_list_tests_response.go | 102 - api/v1/datadog/model_synthetics_location.go | 142 - api/v1/datadog/model_synthetics_locations.go | 102 - .../model_synthetics_parsing_options.go | 234 - .../datadog/model_synthetics_playing_tab.go | 115 - .../model_synthetics_private_location.go | 300 - ...tics_private_location_creation_response.go | 194 - ...ion_creation_response_result_encryption.go | 141 - ...el_synthetics_private_location_metadata.go | 102 - ...del_synthetics_private_location_secrets.go | 155 - ...private_location_secrets_authentication.go | 141 - ...vate_location_secrets_config_decryption.go | 102 - .../model_synthetics_ssl_certificate.go | 554 -- ...model_synthetics_ssl_certificate_issuer.go | 297 - ...odel_synthetics_ssl_certificate_subject.go | 336 - api/v1/datadog/model_synthetics_status.go | 111 - api/v1/datadog/model_synthetics_step.go | 305 - .../datadog/model_synthetics_step_detail.go | 751 -- .../model_synthetics_step_detail_warning.go | 144 - api/v1/datadog/model_synthetics_step_type.go | 155 - .../model_synthetics_test_ci_options.go | 110 - .../datadog/model_synthetics_test_config.go | 226 - .../datadog/model_synthetics_test_details.go | 617 -- .../model_synthetics_test_details_sub_type.go | 124 - .../model_synthetics_test_details_type.go | 109 - .../model_synthetics_test_execution_rule.go | 111 - .../model_synthetics_test_monitor_status.go | 114 - .../datadog/model_synthetics_test_options.go | 767 -- ...synthetics_test_options_monitor_options.go | 104 - .../model_synthetics_test_options_retry.go | 143 - .../model_synthetics_test_pause_status.go | 110 - .../model_synthetics_test_process_status.go | 115 - .../datadog/model_synthetics_test_request.go | 945 --- ...del_synthetics_test_request_certificate.go | 155 - ...ynthetics_test_request_certificate_item.go | 180 - .../model_synthetics_test_request_proxy.go | 142 - api/v1/datadog/model_synthetics_timing.go | 415 - .../datadog/model_synthetics_trigger_body.go | 103 - ...del_synthetics_trigger_ci_test_location.go | 141 - ...l_synthetics_trigger_ci_test_run_result.go | 227 - ...el_synthetics_trigger_ci_tests_response.go | 232 - .../datadog/model_synthetics_trigger_test_.go | 149 - ...hetics_update_test_pause_status_payload.go | 111 - .../model_synthetics_variable_parser.go | 150 - .../datadog/model_synthetics_warning_type.go | 107 - .../model_table_widget_cell_display_mode.go | 109 - .../datadog/model_table_widget_definition.go | 403 - .../model_table_widget_definition_type.go | 107 - .../model_table_widget_has_search_bar.go | 111 - api/v1/datadog/model_table_widget_request.go | 891 --- api/v1/datadog/model_tag_to_hosts.go | 102 - api/v1/datadog/model_target_format_type.go | 115 - api/v1/datadog/model_timeseries_background.go | 159 - .../model_timeseries_background_type.go | 109 - .../model_timeseries_widget_definition.go | 690 -- ...model_timeseries_widget_definition_type.go | 107 - ...odel_timeseries_widget_expression_alias.go | 142 - .../model_timeseries_widget_legend_column.go | 115 - .../model_timeseries_widget_legend_layout.go | 111 - .../model_timeseries_widget_request.go | 812 -- .../model_toplist_widget_definition.go | 356 - .../model_toplist_widget_definition_type.go | 107 - .../datadog/model_toplist_widget_request.go | 726 -- api/v1/datadog/model_tree_map_color_by.go | 107 - api/v1/datadog/model_tree_map_group_by.go | 111 - api/v1/datadog/model_tree_map_size_by.go | 109 - .../model_tree_map_widget_definition.go | 427 -- .../model_tree_map_widget_definition_type.go | 107 - .../datadog/model_tree_map_widget_request.go | 227 - .../datadog/model_usage_analyzed_logs_hour.go | 224 - .../model_usage_analyzed_logs_response.go | 102 - ...model_usage_attribution_aggregates_body.go | 180 - .../datadog/model_usage_attribution_body.go | 352 - .../model_usage_attribution_metadata.go | 148 - .../model_usage_attribution_pagination.go | 258 - .../model_usage_attribution_response.go | 148 - .../datadog/model_usage_attribution_sort.go | 161 - ...del_usage_attribution_supported_metrics.go | 183 - .../datadog/model_usage_attribution_values.go | 1779 ----- api/v1/datadog/model_usage_audit_logs_hour.go | 224 - .../model_usage_audit_logs_response.go | 102 - .../model_usage_billable_summary_body.go | 345 - .../model_usage_billable_summary_hour.go | 391 - .../model_usage_billable_summary_keys.go | 3697 --------- .../model_usage_billable_summary_response.go | 102 - .../datadog/model_usage_ci_visibility_hour.go | 297 - .../model_usage_ci_visibility_response.go | 102 - ..._cloud_security_posture_management_hour.go | 437 -- ...ud_security_posture_management_response.go | 102 - .../model_usage_custom_reports_attributes.go | 258 - .../model_usage_custom_reports_data.go | 199 - .../model_usage_custom_reports_meta.go | 109 - .../model_usage_custom_reports_page.go | 102 - .../model_usage_custom_reports_response.go | 148 - api/v1/datadog/model_usage_cws_hour.go | 263 - api/v1/datadog/model_usage_cws_response.go | 102 - api/v1/datadog/model_usage_dbm_hour.go | 263 - api/v1/datadog/model_usage_dbm_response.go | 102 - api/v1/datadog/model_usage_fargate_hour.go | 263 - .../datadog/model_usage_fargate_response.go | 102 - api/v1/datadog/model_usage_host_hour.go | 701 -- api/v1/datadog/model_usage_hosts_response.go | 102 - .../model_usage_incident_management_hour.go | 224 - ...odel_usage_incident_management_response.go | 102 - .../datadog/model_usage_indexed_spans_hour.go | 224 - .../model_usage_indexed_spans_response.go | 102 - .../model_usage_ingested_spans_hour.go | 224 - .../model_usage_ingested_spans_response.go | 102 - api/v1/datadog/model_usage_io_t_hour.go | 224 - api/v1/datadog/model_usage_io_t_response.go | 102 - api/v1/datadog/model_usage_lambda_hour.go | 264 - api/v1/datadog/model_usage_lambda_response.go | 103 - .../datadog/model_usage_logs_by_index_hour.go | 341 - .../model_usage_logs_by_index_response.go | 102 - .../model_usage_logs_by_retention_hour.go | 297 - .../model_usage_logs_by_retention_response.go | 102 - api/v1/datadog/model_usage_logs_hour.go | 458 -- api/v1/datadog/model_usage_logs_response.go | 102 - api/v1/datadog/model_usage_metric_category.go | 109 - .../datadog/model_usage_network_flows_hour.go | 224 - .../model_usage_network_flows_response.go | 102 - .../datadog/model_usage_network_hosts_hour.go | 224 - .../model_usage_network_hosts_response.go | 102 - .../model_usage_online_archive_hour.go | 224 - .../model_usage_online_archive_response.go | 102 - api/v1/datadog/model_usage_profiling_hour.go | 263 - .../datadog/model_usage_profiling_response.go | 102 - api/v1/datadog/model_usage_reports_type.go | 107 - .../datadog/model_usage_rum_sessions_hour.go | 426 -- .../model_usage_rum_sessions_response.go | 102 - api/v1/datadog/model_usage_rum_units_hour.go | 271 - .../datadog/model_usage_rum_units_response.go | 102 - api/v1/datadog/model_usage_sds_hour.go | 263 - api/v1/datadog/model_usage_sds_response.go | 102 - api/v1/datadog/model_usage_snmp_hour.go | 224 - api/v1/datadog/model_usage_snmp_response.go | 102 - api/v1/datadog/model_usage_sort.go | 113 - api/v1/datadog/model_usage_sort_direction.go | 109 - ...age_specified_custom_reports_attributes.go | 297 - ...del_usage_specified_custom_reports_data.go | 199 - ...del_usage_specified_custom_reports_meta.go | 109 - ...del_usage_specified_custom_reports_page.go | 102 - ...usage_specified_custom_reports_response.go | 155 - api/v1/datadog/model_usage_summary_date.go | 2564 ------- .../datadog/model_usage_summary_date_org.go | 2598 ------- .../datadog/model_usage_summary_response.go | 2930 ------- .../model_usage_synthetics_api_hour.go | 224 - .../model_usage_synthetics_api_response.go | 102 - .../model_usage_synthetics_browser_hour.go | 224 - ...model_usage_synthetics_browser_response.go | 102 - api/v1/datadog/model_usage_synthetics_hour.go | 224 - .../model_usage_synthetics_response.go | 102 - api/v1/datadog/model_usage_timeseries_hour.go | 302 - .../model_usage_timeseries_response.go | 102 - .../model_usage_top_avg_metrics_hour.go | 227 - .../model_usage_top_avg_metrics_metadata.go | 196 - .../model_usage_top_avg_metrics_pagination.go | 193 - .../model_usage_top_avg_metrics_response.go | 148 - api/v1/datadog/model_user.go | 348 - api/v1/datadog/model_user_disable_response.go | 102 - api/v1/datadog/model_user_list_response.go | 102 - api/v1/datadog/model_user_response.go | 109 - api/v1/datadog/model_webhooks_integration.go | 295 - ...el_webhooks_integration_custom_variable.go | 170 - ...ks_integration_custom_variable_response.go | 176 - ...egration_custom_variable_update_request.go | 183 - .../model_webhooks_integration_encoding.go | 109 - ...del_webhooks_integration_update_request.go | 291 - api/v1/datadog/model_widget.go | 193 - api/v1/datadog/model_widget_aggregator.go | 117 - api/v1/datadog/model_widget_axis.go | 270 - api/v1/datadog/model_widget_change_type.go | 109 - .../datadog/model_widget_color_preference.go | 109 - api/v1/datadog/model_widget_comparator.go | 113 - api/v1/datadog/model_widget_compare_to.go | 113 - .../model_widget_conditional_format.go | 419 - api/v1/datadog/model_widget_custom_link.go | 219 - api/v1/datadog/model_widget_definition.go | 1019 --- api/v1/datadog/model_widget_display_type.go | 111 - api/v1/datadog/model_widget_event.go | 145 - api/v1/datadog/model_widget_event_size.go | 109 - api/v1/datadog/model_widget_field_sort.go | 144 - api/v1/datadog/model_widget_formula.go | 274 - api/v1/datadog/model_widget_formula_limit.go | 153 - api/v1/datadog/model_widget_grouping.go | 109 - .../datadog/model_widget_horizontal_align.go | 111 - api/v1/datadog/model_widget_image_sizing.go | 122 - api/v1/datadog/model_widget_layout.go | 242 - api/v1/datadog/model_widget_layout_type.go | 107 - api/v1/datadog/model_widget_line_type.go | 111 - api/v1/datadog/model_widget_line_width.go | 111 - api/v1/datadog/model_widget_live_span.go | 135 - api/v1/datadog/model_widget_margin.go | 116 - api/v1/datadog/model_widget_marker.go | 224 - .../datadog/model_widget_message_display.go | 111 - ...l_widget_monitor_summary_display_format.go | 111 - .../model_widget_monitor_summary_sort.go | 135 - api/v1/datadog/model_widget_node_type.go | 109 - api/v1/datadog/model_widget_order_by.go | 113 - api/v1/datadog/model_widget_palette.go | 143 - api/v1/datadog/model_widget_request_style.go | 196 - ...l_widget_service_summary_display_format.go | 111 - api/v1/datadog/model_widget_size_format.go | 111 - api/v1/datadog/model_widget_sort.go | 109 - api/v1/datadog/model_widget_style.go | 102 - api/v1/datadog/model_widget_summary_type.go | 111 - api/v1/datadog/model_widget_text_align.go | 111 - api/v1/datadog/model_widget_tick_edge.go | 113 - api/v1/datadog/model_widget_time.go | 110 - api/v1/datadog/model_widget_time_windows_.go | 121 - api/v1/datadog/model_widget_vertical_align.go | 111 - api/v1/datadog/model_widget_view_mode.go | 111 - api/v1/datadog/model_widget_viz_type.go | 109 - api/v2/datadog/api_audit.go | 550 -- api/v2/datadog/api_auth_n_mappings.go | 802 -- api/v2/datadog/api_cloud_workload_security.go | 857 --- api/v2/datadog/api_dashboard_lists.go | 625 -- api/v2/datadog/api_events.go | 561 -- api/v2/datadog/api_incident_services.go | 932 --- api/v2/datadog/api_incident_teams.go | 932 --- api/v2/datadog/api_incidents.go | 1001 --- api/v2/datadog/api_key_management.go | 2351 ------ api/v2/datadog/api_logs.go | 951 --- api/v2/datadog/api_logs_archives.go | 1444 ---- api/v2/datadog/api_logs_metrics.go | 721 -- api/v2/datadog/api_metrics.go | 1841 ----- api/v2/datadog/api_opsgenie_integration.go | 755 -- api/v2/datadog/api_organizations.go | 190 - api/v2/datadog/api_processes.go | 309 - api/v2/datadog/api_roles.go | 2036 ----- api/v2/datadog/api_rum.go | 667 -- api/v2/datadog/api_security_monitoring.go | 2443 ------ api/v2/datadog/api_service_accounts.go | 832 -- api/v2/datadog/api_usage_metering.go | 1143 --- api/v2/datadog/api_users.go | 1517 ---- api/v2/datadog/model_api_error_response.go | 103 - .../model_api_key_create_attributes.go | 103 - api/v2/datadog/model_api_key_create_data.go | 153 - .../datadog/model_api_key_create_request.go | 110 - api/v2/datadog/model_api_key_relationships.go | 155 - api/v2/datadog/model_api_key_response.go | 148 - .../model_api_key_response_included_item.go | 123 - .../model_api_key_update_attributes.go | 103 - api/v2/datadog/model_api_key_update_data.go | 186 - .../datadog/model_api_key_update_request.go | 110 - api/v2/datadog/model_api_keys_response.go | 141 - api/v2/datadog/model_api_keys_sort.go | 121 - api/v2/datadog/model_api_keys_type.go | 107 - ...model_application_key_create_attributes.go | 143 - .../model_application_key_create_data.go | 153 - .../model_application_key_create_request.go | 110 - .../model_application_key_relationships.go | 109 - .../datadog/model_application_key_response.go | 148 - ..._application_key_response_included_item.go | 155 - ...model_application_key_update_attributes.go | 142 - .../model_application_key_update_data.go | 186 - .../model_application_key_update_request.go | 110 - api/v2/datadog/model_application_keys_sort.go | 117 - api/v2/datadog/model_application_keys_type.go | 107 - api/v2/datadog/model_audit_logs_event.go | 199 - .../model_audit_logs_event_attributes.go | 226 - api/v2/datadog/model_audit_logs_event_type.go | 107 - .../model_audit_logs_events_response.go | 194 - .../datadog/model_audit_logs_query_filter.go | 192 - .../datadog/model_audit_logs_query_options.go | 146 - .../model_audit_logs_query_page_options.go | 145 - .../model_audit_logs_response_links.go | 103 - .../model_audit_logs_response_metadata.go | 274 - .../datadog/model_audit_logs_response_page.go | 102 - .../model_audit_logs_response_status.go | 109 - .../model_audit_logs_search_events_request.go | 249 - api/v2/datadog/model_audit_logs_sort.go | 109 - api/v2/datadog/model_audit_logs_warning.go | 180 - api/v2/datadog/model_auth_n_mapping.go | 238 - .../model_auth_n_mapping_attributes.go | 267 - .../model_auth_n_mapping_create_attributes.go | 141 - .../model_auth_n_mapping_create_data.go | 205 - ...del_auth_n_mapping_create_relationships.go | 109 - .../model_auth_n_mapping_create_request.go | 110 - .../datadog/model_auth_n_mapping_included.go | 155 - .../model_auth_n_mapping_relationships.go | 155 - .../datadog/model_auth_n_mapping_response.go | 148 - .../model_auth_n_mapping_update_attributes.go | 141 - .../model_auth_n_mapping_update_data.go | 238 - ...del_auth_n_mapping_update_relationships.go | 109 - .../model_auth_n_mapping_update_request.go | 110 - .../datadog/model_auth_n_mappings_response.go | 187 - api/v2/datadog/model_auth_n_mappings_sort.go | 129 - api/v2/datadog/model_auth_n_mappings_type.go | 107 - api/v2/datadog/model_chargeback_breakdown.go | 180 - ...workload_security_agent_rule_attributes.go | 506 -- ...d_security_agent_rule_create_attributes.go | 214 - ...orkload_security_agent_rule_create_data.go | 153 - ...load_security_agent_rule_create_request.go | 110 - ..._security_agent_rule_creator_attributes.go | 141 - ...cloud_workload_security_agent_rule_data.go | 199 - ...d_workload_security_agent_rule_response.go | 109 - ...cloud_workload_security_agent_rule_type.go | 107 - ...d_security_agent_rule_update_attributes.go | 180 - ...orkload_security_agent_rule_update_data.go | 153 - ...load_security_agent_rule_update_request.go | 110 - ..._security_agent_rule_updater_attributes.go | 141 - ...load_security_agent_rules_list_response.go | 102 - api/v2/datadog/model_content_encoding.go | 109 - api/v2/datadog/model_cost_by_org.go | 199 - .../datadog/model_cost_by_org_attributes.go | 263 - api/v2/datadog/model_cost_by_org_response.go | 102 - api/v2/datadog/model_cost_by_org_type.go | 107 - api/v2/datadog/model_creator.go | 180 - .../model_dashboard_list_add_items_request.go | 102 - ...model_dashboard_list_add_items_response.go | 102 - ...del_dashboard_list_delete_items_request.go | 102 - ...el_dashboard_list_delete_items_response.go | 102 - api/v2/datadog/model_dashboard_list_item.go | 550 -- .../model_dashboard_list_item_request.go | 144 - .../model_dashboard_list_item_response.go | 144 - api/v2/datadog/model_dashboard_list_items.go | 142 - ...del_dashboard_list_update_items_request.go | 102 - ...el_dashboard_list_update_items_response.go | 102 - api/v2/datadog/model_dashboard_type.go | 115 - api/v2/datadog/model_event.go | 219 - api/v2/datadog/model_event_attributes.go | 869 --- api/v2/datadog/model_event_priority.go | 109 - api/v2/datadog/model_event_response.go | 199 - .../model_event_response_attributes.go | 192 - api/v2/datadog/model_event_status_type.go | 123 - api/v2/datadog/model_event_type.go | 107 - api/v2/datadog/model_events_list_request.go | 249 - api/v2/datadog/model_events_list_response.go | 194 - .../model_events_list_response_links.go | 103 - api/v2/datadog/model_events_query_filter.go | 192 - api/v2/datadog/model_events_query_options.go | 146 - api/v2/datadog/model_events_request_page.go | 145 - .../datadog/model_events_response_metadata.go | 227 - .../model_events_response_metadata_page.go | 103 - api/v2/datadog/model_events_sort.go | 109 - api/v2/datadog/model_events_warning.go | 180 - api/v2/datadog/model_full_api_key.go | 245 - .../datadog/model_full_api_key_attributes.go | 258 - api/v2/datadog/model_full_application_key.go | 245 - .../model_full_application_key_attributes.go | 259 - api/v2/datadog/model_hourly_usage.go | 199 - .../datadog/model_hourly_usage_attributes.go | 302 - .../datadog/model_hourly_usage_measurement.go | 154 - api/v2/datadog/model_hourly_usage_metadata.go | 109 - .../datadog/model_hourly_usage_pagination.go | 115 - api/v2/datadog/model_hourly_usage_response.go | 148 - api/v2/datadog/model_hourly_usage_type.go | 111 - api/v2/datadog/model_http_log_error.go | 180 - api/v2/datadog/model_http_log_errors.go | 102 - api/v2/datadog/model_http_log_item.go | 265 - .../datadog/model_id_p_metadata_form_data.go | 103 - .../model_incident_create_attributes.go | 253 - api/v2/datadog/model_incident_create_data.go | 199 - .../model_incident_create_relationships.go | 110 - .../datadog/model_incident_create_request.go | 110 - .../model_incident_field_attributes.go | 155 - ...ncident_field_attributes_multiple_value.go | 154 - ..._incident_field_attributes_single_value.go | 166 - ...dent_field_attributes_single_value_type.go | 109 - ...el_incident_field_attributes_value_type.go | 113 - ...odel_incident_integration_metadata_type.go | 107 - .../model_incident_notification_handle.go | 141 - .../datadog/model_incident_postmortem_type.go | 107 - .../datadog/model_incident_related_object.go | 107 - api/v2/datadog/model_incident_response.go | 149 - .../model_incident_response_attributes.go | 835 -- .../datadog/model_incident_response_data.go | 238 - .../model_incident_response_included_item.go | 123 - .../datadog/model_incident_response_meta.go | 109 - ...model_incident_response_meta_pagination.go | 180 - .../model_incident_response_relationships.go | 293 - ...odel_incident_service_create_attributes.go | 103 - .../model_incident_service_create_data.go | 205 - .../model_incident_service_create_request.go | 110 - .../model_incident_service_included_items.go | 123 - .../model_incident_service_relationships.go | 155 - .../model_incident_service_response.go | 149 - ...el_incident_service_response_attributes.go | 189 - .../model_incident_service_response_data.go | 238 - api/v2/datadog/model_incident_service_type.go | 107 - ...odel_incident_service_update_attributes.go | 103 - .../model_incident_service_update_data.go | 244 - .../model_incident_service_update_request.go | 110 - .../model_incident_services_response.go | 188 - .../model_incident_team_create_attributes.go | 103 - .../model_incident_team_create_data.go | 205 - .../model_incident_team_create_request.go | 110 - .../model_incident_team_included_items.go | 123 - .../model_incident_team_relationships.go | 155 - .../datadog/model_incident_team_response.go | 149 - ...model_incident_team_response_attributes.go | 189 - .../model_incident_team_response_data.go | 245 - api/v2/datadog/model_incident_team_type.go | 107 - .../model_incident_team_update_attributes.go | 103 - .../model_incident_team_update_data.go | 244 - .../model_incident_team_update_request.go | 110 - .../datadog/model_incident_teams_response.go | 188 - ...ncident_timeline_cell_create_attributes.go | 123 - ...ent_timeline_cell_markdown_content_type.go | 107 - ...imeline_cell_markdown_create_attributes.go | 196 - ...cell_markdown_create_attributes_content.go | 102 - api/v2/datadog/model_incident_type.go | 107 - .../model_incident_update_attributes.go | 461 -- api/v2/datadog/model_incident_update_data.go | 238 - .../model_incident_update_relationships.go | 201 - .../datadog/model_incident_update_request.go | 110 - api/v2/datadog/model_incidents_response.go | 188 - .../datadog/model_intake_payload_accepted.go | 102 - .../model_list_application_keys_response.go | 141 - api/v2/datadog/model_log.go | 199 - api/v2/datadog/model_log_attributes.go | 345 - api/v2/datadog/model_log_type.go | 107 - api/v2/datadog/model_logs_aggregate_bucket.go | 141 - .../model_logs_aggregate_bucket_value.go | 187 - ..._logs_aggregate_bucket_value_timeseries.go | 51 - ...aggregate_bucket_value_timeseries_point.go | 141 - .../datadog/model_logs_aggregate_request.go | 280 - .../model_logs_aggregate_request_page.go | 102 - .../datadog/model_logs_aggregate_response.go | 155 - .../model_logs_aggregate_response_data.go | 102 - .../model_logs_aggregate_response_status.go | 109 - api/v2/datadog/model_logs_aggregate_sort.go | 247 - .../datadog/model_logs_aggregate_sort_type.go | 109 - .../model_logs_aggregation_function.go | 129 - api/v2/datadog/model_logs_archive.go | 109 - .../datadog/model_logs_archive_attributes.go | 353 - .../model_logs_archive_create_request.go | 109 - ..._logs_archive_create_request_attributes.go | 304 - ..._logs_archive_create_request_definition.go | 151 - ...logs_archive_create_request_destination.go | 187 - .../datadog/model_logs_archive_definition.go | 188 - .../datadog/model_logs_archive_destination.go | 187 - .../model_logs_archive_destination_azure.go | 297 - ...del_logs_archive_destination_azure_type.go | 107 - .../model_logs_archive_destination_gcs.go | 225 - ...model_logs_archive_destination_gcs_type.go | 107 - .../model_logs_archive_destination_s3.go | 225 - .../model_logs_archive_destination_s3_type.go | 107 - .../model_logs_archive_integration_azure.go | 136 - .../model_logs_archive_integration_gcs.go | 136 - .../model_logs_archive_integration_s3.go | 136 - api/v2/datadog/model_logs_archive_order.go | 109 - .../model_logs_archive_order_attributes.go | 104 - .../model_logs_archive_order_definition.go | 153 - ...odel_logs_archive_order_definition_type.go | 107 - api/v2/datadog/model_logs_archive_state.go | 113 - api/v2/datadog/model_logs_archives.go | 102 - api/v2/datadog/model_logs_compute.go | 241 - api/v2/datadog/model_logs_compute_type.go | 109 - api/v2/datadog/model_logs_group_by.go | 317 - .../datadog/model_logs_group_by_histogram.go | 172 - api/v2/datadog/model_logs_group_by_missing.go | 155 - api/v2/datadog/model_logs_group_by_total.go | 187 - api/v2/datadog/model_logs_list_request.go | 249 - .../datadog/model_logs_list_request_page.go | 145 - api/v2/datadog/model_logs_list_response.go | 194 - .../datadog/model_logs_list_response_links.go | 103 - api/v2/datadog/model_logs_metric_compute.go | 150 - ...el_logs_metric_compute_aggregation_type.go | 109 - .../model_logs_metric_create_attributes.go | 195 - .../datadog/model_logs_metric_create_data.go | 186 - .../model_logs_metric_create_request.go | 110 - api/v2/datadog/model_logs_metric_filter.go | 106 - api/v2/datadog/model_logs_metric_group_by.go | 142 - api/v2/datadog/model_logs_metric_response.go | 109 - .../model_logs_metric_response_attributes.go | 194 - .../model_logs_metric_response_compute.go | 149 - ...etric_response_compute_aggregation_type.go | 109 - .../model_logs_metric_response_data.go | 199 - .../model_logs_metric_response_filter.go | 102 - .../model_logs_metric_response_group_by.go | 141 - api/v2/datadog/model_logs_metric_type.go | 107 - .../model_logs_metric_update_attributes.go | 148 - .../datadog/model_logs_metric_update_data.go | 153 - .../model_logs_metric_update_request.go | 110 - api/v2/datadog/model_logs_metrics_response.go | 102 - api/v2/datadog/model_logs_query_filter.go | 231 - api/v2/datadog/model_logs_query_options.go | 146 - .../datadog/model_logs_response_metadata.go | 274 - .../model_logs_response_metadata_page.go | 103 - api/v2/datadog/model_logs_sort.go | 109 - api/v2/datadog/model_logs_sort_order.go | 109 - api/v2/datadog/model_logs_warning.go | 180 - api/v2/datadog/model_metric.go | 153 - api/v2/datadog/model_metric_all_tags.go | 199 - .../model_metric_all_tags_attributes.go | 102 - .../datadog/model_metric_all_tags_response.go | 109 - .../model_metric_bulk_configure_tags_type.go | 107 - .../model_metric_bulk_tag_config_create.go | 192 - ...etric_bulk_tag_config_create_attributes.go | 141 - ...l_metric_bulk_tag_config_create_request.go | 110 - .../model_metric_bulk_tag_config_delete.go | 192 - ...etric_bulk_tag_config_delete_attributes.go | 102 - ...l_metric_bulk_tag_config_delete_request.go | 110 - .../model_metric_bulk_tag_config_response.go | 110 - .../model_metric_bulk_tag_config_status.go | 193 - ...etric_bulk_tag_config_status_attributes.go | 180 - .../datadog/model_metric_content_encoding.go | 107 - .../model_metric_custom_aggregation.go | 152 - .../model_metric_custom_space_aggregation.go | 113 - .../model_metric_custom_time_aggregation.go | 115 - .../datadog/model_metric_distinct_volume.go | 199 - ...model_metric_distinct_volume_attributes.go | 102 - .../model_metric_distinct_volume_type.go | 107 - api/v2/datadog/model_metric_estimate.go | 199 - .../model_metric_estimate_attributes.go | 197 - .../model_metric_estimate_resource_type.go | 107 - .../datadog/model_metric_estimate_response.go | 109 - api/v2/datadog/model_metric_estimate_type.go | 111 - .../model_metric_ingested_indexed_volume.go | 199 - ...tric_ingested_indexed_volume_attributes.go | 141 - ...del_metric_ingested_indexed_volume_type.go | 107 - api/v2/datadog/model_metric_intake_type.go | 113 - api/v2/datadog/model_metric_metadata.go | 109 - api/v2/datadog/model_metric_origin.go | 192 - api/v2/datadog/model_metric_payload.go | 103 - api/v2/datadog/model_metric_point.go | 142 - api/v2/datadog/model_metric_resource.go | 141 - api/v2/datadog/model_metric_series.go | 425 -- .../datadog/model_metric_tag_configuration.go | 199 - ...del_metric_tag_configuration_attributes.go | 334 - ...ric_tag_configuration_create_attributes.go | 240 - ...el_metric_tag_configuration_create_data.go | 192 - ...metric_tag_configuration_create_request.go | 110 - ...l_metric_tag_configuration_metric_types.go | 113 - ...model_metric_tag_configuration_response.go | 109 - .../model_metric_tag_configuration_type.go | 107 - ...ric_tag_configuration_update_attributes.go | 196 - ...el_metric_tag_configuration_update_data.go | 192 - ...metric_tag_configuration_update_request.go | 110 - api/v2/datadog/model_metric_type.go | 107 - api/v2/datadog/model_metric_volumes.go | 155 - .../datadog/model_metric_volumes_response.go | 102 - ...l_metrics_and_metric_tag_configurations.go | 155 - ..._and_metric_tag_configurations_response.go | 102 - api/v2/datadog/model_monitor_type.go | 542 -- .../model_nullable_relationship_to_user.go | 105 - ...odel_nullable_relationship_to_user_data.go | 196 - ...odel_opsgenie_service_create_attributes.go | 216 - .../model_opsgenie_service_create_data.go | 153 - .../model_opsgenie_service_create_request.go | 110 - .../model_opsgenie_service_region_type.go | 111 - .../model_opsgenie_service_response.go | 110 - ...el_opsgenie_service_response_attributes.go | 201 - .../model_opsgenie_service_response_data.go | 186 - api/v2/datadog/model_opsgenie_service_type.go | 107 - ...odel_opsgenie_service_update_attributes.go | 240 - .../model_opsgenie_service_update_data.go | 186 - .../model_opsgenie_service_update_request.go | 110 - .../model_opsgenie_services_response.go | 103 - api/v2/datadog/model_organization.go | 198 - .../datadog/model_organization_attributes.go | 384 - api/v2/datadog/model_organizations_type.go | 107 - api/v2/datadog/model_pagination.go | 141 - api/v2/datadog/model_partial_api_key.go | 245 - .../model_partial_api_key_attributes.go | 219 - .../datadog/model_partial_application_key.go | 245 - ...odel_partial_application_key_attributes.go | 220 - .../model_partial_application_key_response.go | 148 - api/v2/datadog/model_permission.go | 198 - api/v2/datadog/model_permission_attributes.go | 341 - api/v2/datadog/model_permissions_response.go | 102 - api/v2/datadog/model_permissions_type.go | 107 - .../datadog/model_process_summaries_meta.go | 109 - .../model_process_summaries_meta_page.go | 142 - .../model_process_summaries_response.go | 148 - api/v2/datadog/model_process_summary.go | 199 - .../model_process_summary_attributes.go | 375 - api/v2/datadog/model_process_summary_type.go | 107 - api/v2/datadog/model_query_sort_order.go | 109 - ...p_to_incident_integration_metadata_data.go | 146 - ...nship_to_incident_integration_metadatas.go | 103 - ...del_relationship_to_incident_postmortem.go | 110 - ...elationship_to_incident_postmortem_data.go | 146 - .../model_relationship_to_organization.go | 110 - ...model_relationship_to_organization_data.go | 146 - .../model_relationship_to_organizations.go | 103 - .../model_relationship_to_permission.go | 109 - .../model_relationship_to_permission_data.go | 153 - .../model_relationship_to_permissions.go | 102 - api/v2/datadog/model_relationship_to_role.go | 109 - .../model_relationship_to_role_data.go | 153 - api/v2/datadog/model_relationship_to_roles.go | 102 - ...elationship_to_saml_assertion_attribute.go | 110 - ...onship_to_saml_assertion_attribute_data.go | 146 - api/v2/datadog/model_relationship_to_user.go | 110 - .../model_relationship_to_user_data.go | 146 - api/v2/datadog/model_relationship_to_users.go | 103 - .../datadog/model_response_meta_attributes.go | 109 - api/v2/datadog/model_role.go | 244 - api/v2/datadog/model_role_attributes.go | 228 - api/v2/datadog/model_role_clone.go | 153 - api/v2/datadog/model_role_clone_attributes.go | 103 - api/v2/datadog/model_role_clone_request.go | 110 - .../datadog/model_role_create_attributes.go | 190 - api/v2/datadog/model_role_create_data.go | 207 - api/v2/datadog/model_role_create_request.go | 110 - api/v2/datadog/model_role_create_response.go | 109 - .../model_role_create_response_data.go | 244 - api/v2/datadog/model_role_relationships.go | 155 - api/v2/datadog/model_role_response.go | 109 - .../model_role_response_relationships.go | 109 - .../datadog/model_role_update_attributes.go | 189 - api/v2/datadog/model_role_update_data.go | 186 - api/v2/datadog/model_role_update_request.go | 110 - api/v2/datadog/model_role_update_response.go | 109 - .../model_role_update_response_data.go | 244 - api/v2/datadog/model_roles_response.go | 148 - api/v2/datadog/model_roles_sort.go | 117 - api/v2/datadog/model_roles_type.go | 107 - .../model_rum_aggregate_bucket_value.go | 187 - ...l_rum_aggregate_bucket_value_timeseries.go | 51 - ...aggregate_bucket_value_timeseries_point.go | 146 - api/v2/datadog/model_rum_aggregate_request.go | 280 - api/v2/datadog/model_rum_aggregate_sort.go | 247 - .../datadog/model_rum_aggregate_sort_type.go | 109 - .../model_rum_aggregation_buckets_response.go | 102 - .../datadog/model_rum_aggregation_function.go | 129 - .../model_rum_analytics_aggregate_response.go | 201 - api/v2/datadog/model_rum_bucket_response.go | 141 - api/v2/datadog/model_rum_compute.go | 241 - api/v2/datadog/model_rum_compute_type.go | 109 - api/v2/datadog/model_rum_event.go | 199 - api/v2/datadog/model_rum_event_attributes.go | 226 - api/v2/datadog/model_rum_event_type.go | 107 - api/v2/datadog/model_rum_events_response.go | 194 - api/v2/datadog/model_rum_group_by.go | 317 - .../datadog/model_rum_group_by_histogram.go | 172 - api/v2/datadog/model_rum_group_by_missing.go | 155 - api/v2/datadog/model_rum_group_by_total.go | 187 - api/v2/datadog/model_rum_query_filter.go | 192 - api/v2/datadog/model_rum_query_options.go | 146 - .../datadog/model_rum_query_page_options.go | 145 - api/v2/datadog/model_rum_response_links.go | 103 - api/v2/datadog/model_rum_response_metadata.go | 274 - api/v2/datadog/model_rum_response_page.go | 102 - api/v2/datadog/model_rum_response_status.go | 109 - .../model_rum_search_events_request.go | 249 - api/v2/datadog/model_rum_sort.go | 109 - api/v2/datadog/model_rum_sort_order.go | 109 - api/v2/datadog/model_rum_warning.go | 180 - .../datadog/model_saml_assertion_attribute.go | 192 - ...del_saml_assertion_attribute_attributes.go | 141 - .../model_saml_assertion_attributes_type.go | 107 - api/v2/datadog/model_security_filter.go | 199 - .../model_security_filter_attributes.go | 344 - ...model_security_filter_create_attributes.go | 243 - .../model_security_filter_create_data.go | 153 - .../model_security_filter_create_request.go | 110 - .../model_security_filter_exclusion_filter.go | 136 - ...curity_filter_exclusion_filter_response.go | 141 - ...odel_security_filter_filtered_data_type.go | 107 - api/v2/datadog/model_security_filter_meta.go | 102 - .../datadog/model_security_filter_response.go | 155 - api/v2/datadog/model_security_filter_type.go | 107 - ...model_security_filter_update_attributes.go | 305 - .../model_security_filter_update_data.go | 153 - .../model_security_filter_update_request.go | 110 - .../model_security_filters_response.go | 148 - .../model_security_monitoring_filter.go | 149 - ...model_security_monitoring_filter_action.go | 109 - ...security_monitoring_list_rules_response.go | 148 - .../model_security_monitoring_rule_case.go | 228 - ...el_security_monitoring_rule_case_create.go | 229 - ...security_monitoring_rule_create_payload.go | 439 -- ...curity_monitoring_rule_detection_method.go | 115 - ...urity_monitoring_rule_evaluation_window.go | 122 - ...onitoring_rule_hardcoded_evaluator_type.go | 107 - ...nitoring_rule_impossible_travel_options.go | 103 - ...del_security_monitoring_rule_keep_alive.go | 126 - ...ity_monitoring_rule_max_signal_duration.go | 130 - ...urity_monitoring_rule_new_value_options.go | 264 - ...ing_rule_new_value_options_forget_after.go | 117 - ...ule_new_value_options_learning_duration.go | 112 - ..._rule_new_value_options_learning_method.go | 109 - ...le_new_value_options_learning_threshold.go | 109 - .../model_security_monitoring_rule_options.go | 434 -- .../model_security_monitoring_rule_query.go | 345 - ...urity_monitoring_rule_query_aggregation.go | 117 - ...l_security_monitoring_rule_query_create.go | 346 - ...model_security_monitoring_rule_response.go | 741 -- ...model_security_monitoring_rule_severity.go | 115 - ...el_security_monitoring_rule_type_create.go | 109 - ...odel_security_monitoring_rule_type_read.go | 113 - ...security_monitoring_rule_update_payload.go | 460 -- .../model_security_monitoring_signal.go | 200 - ...curity_monitoring_signal_archive_reason.go | 113 - ...oring_signal_assignee_update_attributes.go | 149 - ..._monitoring_signal_assignee_update_data.go | 110 - ...nitoring_signal_assignee_update_request.go | 110 - ...l_security_monitoring_signal_attributes.go | 225 - ...ring_signal_incidents_update_attributes.go | 142 - ...monitoring_signal_incidents_update_data.go | 110 - ...itoring_signal_incidents_update_request.go | 110 - ...security_monitoring_signal_list_request.go | 202 - ...y_monitoring_signal_list_request_filter.go | 189 - ...ity_monitoring_signal_list_request_page.go | 145 - .../model_security_monitoring_signal_state.go | 111 - ...nitoring_signal_state_update_attributes.go | 236 - ...ity_monitoring_signal_state_update_data.go | 110 - ..._monitoring_signal_state_update_request.go | 110 - ...ity_monitoring_signal_triage_attributes.go | 440 -- ...ty_monitoring_signal_triage_update_data.go | 109 - ...onitoring_signal_triage_update_response.go | 110 - .../model_security_monitoring_signal_type.go | 107 - ...curity_monitoring_signals_list_response.go | 195 - ..._monitoring_signals_list_response_links.go | 103 - ...y_monitoring_signals_list_response_meta.go | 109 - ...itoring_signals_list_response_meta_page.go | 103 - .../model_security_monitoring_signals_sort.go | 109 - .../model_security_monitoring_triage_user.go | 220 - ...model_service_account_create_attributes.go | 214 - .../model_service_account_create_data.go | 199 - .../model_service_account_create_request.go | 110 - ...pplication_security_monitoring_response.go | 102 - .../datadog/model_usage_attributes_object.go | 266 - api/v2/datadog/model_usage_data_object.go | 199 - ...sage_lambda_traced_invocations_response.go | 102 - ..._usage_observability_pipelines_response.go | 102 - .../datadog/model_usage_time_series_object.go | 159 - .../datadog/model_usage_time_series_type.go | 107 - api/v2/datadog/model_user.go | 245 - api/v2/datadog/model_user_attributes.go | 525 -- .../datadog/model_user_create_attributes.go | 181 - api/v2/datadog/model_user_create_data.go | 199 - api/v2/datadog/model_user_create_request.go | 110 - api/v2/datadog/model_user_invitation_data.go | 153 - .../model_user_invitation_data_attributes.go | 228 - .../model_user_invitation_relationships.go | 110 - .../datadog/model_user_invitation_response.go | 109 - .../model_user_invitation_response_data.go | 199 - .../datadog/model_user_invitations_request.go | 103 - .../model_user_invitations_response.go | 102 - api/v2/datadog/model_user_invitations_type.go | 107 - api/v2/datadog/model_user_relationships.go | 109 - api/v2/datadog/model_user_response.go | 148 - .../model_user_response_included_item.go | 187 - .../model_user_response_relationships.go | 247 - .../datadog/model_user_update_attributes.go | 180 - api/v2/datadog/model_user_update_data.go | 186 - api/v2/datadog/model_user_update_request.go | 110 - api/v2/datadog/model_users_response.go | 187 - api/v2/datadog/model_users_type.go | 107 - 1285 files changed, 310068 deletions(-) delete mode 100644 api/common/client.go delete mode 100644 api/common/configuration.go delete mode 100644 api/common/no_zstd.go delete mode 100644 api/common/utils.go delete mode 100644 api/common/zstd.go delete mode 100644 api/v1/datadog/api_authentication.go delete mode 100644 api/v1/datadog/api_aws_integration.go delete mode 100644 api/v1/datadog/api_aws_logs_integration.go delete mode 100644 api/v1/datadog/api_azure_integration.go delete mode 100644 api/v1/datadog/api_dashboard_lists.go delete mode 100644 api/v1/datadog/api_dashboards.go delete mode 100644 api/v1/datadog/api_downtimes.go delete mode 100644 api/v1/datadog/api_events.go delete mode 100644 api/v1/datadog/api_gcp_integration.go delete mode 100644 api/v1/datadog/api_hosts.go delete mode 100644 api/v1/datadog/api_ip_ranges.go delete mode 100644 api/v1/datadog/api_key_management.go delete mode 100644 api/v1/datadog/api_logs.go delete mode 100644 api/v1/datadog/api_logs_indexes.go delete mode 100644 api/v1/datadog/api_logs_pipelines.go delete mode 100644 api/v1/datadog/api_metrics.go delete mode 100644 api/v1/datadog/api_monitors.go delete mode 100644 api/v1/datadog/api_notebooks.go delete mode 100644 api/v1/datadog/api_organizations.go delete mode 100644 api/v1/datadog/api_pager_duty_integration.go delete mode 100644 api/v1/datadog/api_security_monitoring.go delete mode 100644 api/v1/datadog/api_service_checks.go delete mode 100644 api/v1/datadog/api_service_level_objective_corrections.go delete mode 100644 api/v1/datadog/api_service_level_objectives.go delete mode 100644 api/v1/datadog/api_slack_integration.go delete mode 100644 api/v1/datadog/api_snapshots.go delete mode 100644 api/v1/datadog/api_synthetics.go delete mode 100644 api/v1/datadog/api_tags.go delete mode 100644 api/v1/datadog/api_usage_metering.go delete mode 100644 api/v1/datadog/api_users.go delete mode 100644 api/v1/datadog/api_webhooks_integration.go delete mode 100644 api/v1/datadog/model_access_role.go delete mode 100644 api/v1/datadog/model_add_signal_to_incident_request.go delete mode 100644 api/v1/datadog/model_alert_graph_widget_definition.go delete mode 100644 api/v1/datadog/model_alert_graph_widget_definition_type.go delete mode 100644 api/v1/datadog/model_alert_value_widget_definition.go delete mode 100644 api/v1/datadog/model_alert_value_widget_definition_type.go delete mode 100644 api/v1/datadog/model_api_error_response.go delete mode 100644 api/v1/datadog/model_api_key.go delete mode 100644 api/v1/datadog/model_api_key_list_response.go delete mode 100644 api/v1/datadog/model_api_key_response.go delete mode 100644 api/v1/datadog/model_apm_stats_query_column_type.go delete mode 100644 api/v1/datadog/model_apm_stats_query_definition.go delete mode 100644 api/v1/datadog/model_apm_stats_query_row_type.go delete mode 100644 api/v1/datadog/model_application_key.go delete mode 100644 api/v1/datadog/model_application_key_list_response.go delete mode 100644 api/v1/datadog/model_application_key_response.go delete mode 100644 api/v1/datadog/model_authentication_validation_response.go delete mode 100644 api/v1/datadog/model_aws_account.go delete mode 100644 api/v1/datadog/model_aws_account_and_lambda_request.go delete mode 100644 api/v1/datadog/model_aws_account_create_response.go delete mode 100644 api/v1/datadog/model_aws_account_delete_request.go delete mode 100644 api/v1/datadog/model_aws_account_list_response.go delete mode 100644 api/v1/datadog/model_aws_logs_async_error.go delete mode 100644 api/v1/datadog/model_aws_logs_async_response.go delete mode 100644 api/v1/datadog/model_aws_logs_lambda.go delete mode 100644 api/v1/datadog/model_aws_logs_list_response.go delete mode 100644 api/v1/datadog/model_aws_logs_list_services_response.go delete mode 100644 api/v1/datadog/model_aws_logs_services_request.go delete mode 100644 api/v1/datadog/model_aws_namespace.go delete mode 100644 api/v1/datadog/model_aws_tag_filter.go delete mode 100644 api/v1/datadog/model_aws_tag_filter_create_request.go delete mode 100644 api/v1/datadog/model_aws_tag_filter_delete_request.go delete mode 100644 api/v1/datadog/model_aws_tag_filter_list_response.go delete mode 100644 api/v1/datadog/model_azure_account.go delete mode 100644 api/v1/datadog/model_cancel_downtimes_by_scope_request.go delete mode 100644 api/v1/datadog/model_canceled_downtimes_ids.go delete mode 100644 api/v1/datadog/model_change_widget_definition.go delete mode 100644 api/v1/datadog/model_change_widget_definition_type.go delete mode 100644 api/v1/datadog/model_change_widget_request.go delete mode 100644 api/v1/datadog/model_check_can_delete_monitor_response.go delete mode 100644 api/v1/datadog/model_check_can_delete_monitor_response_data.go delete mode 100644 api/v1/datadog/model_check_can_delete_slo_response.go delete mode 100644 api/v1/datadog/model_check_can_delete_slo_response_data.go delete mode 100644 api/v1/datadog/model_check_status_widget_definition.go delete mode 100644 api/v1/datadog/model_check_status_widget_definition_type.go delete mode 100644 api/v1/datadog/model_content_encoding.go delete mode 100644 api/v1/datadog/model_creator.go delete mode 100644 api/v1/datadog/model_dashboard.go delete mode 100644 api/v1/datadog/model_dashboard_bulk_action_data.go delete mode 100644 api/v1/datadog/model_dashboard_bulk_delete_request.go delete mode 100644 api/v1/datadog/model_dashboard_delete_response.go delete mode 100644 api/v1/datadog/model_dashboard_layout_type.go delete mode 100644 api/v1/datadog/model_dashboard_list.go delete mode 100644 api/v1/datadog/model_dashboard_list_delete_response.go delete mode 100644 api/v1/datadog/model_dashboard_list_list_response.go delete mode 100644 api/v1/datadog/model_dashboard_reflow_type.go delete mode 100644 api/v1/datadog/model_dashboard_resource_type.go delete mode 100644 api/v1/datadog/model_dashboard_restore_request.go delete mode 100644 api/v1/datadog/model_dashboard_summary.go delete mode 100644 api/v1/datadog/model_dashboard_summary_definition.go delete mode 100644 api/v1/datadog/model_dashboard_template_variable.go delete mode 100644 api/v1/datadog/model_dashboard_template_variable_preset.go delete mode 100644 api/v1/datadog/model_dashboard_template_variable_preset_value.go delete mode 100644 api/v1/datadog/model_deleted_monitor.go delete mode 100644 api/v1/datadog/model_distribution_point_item.go delete mode 100644 api/v1/datadog/model_distribution_points_content_encoding.go delete mode 100644 api/v1/datadog/model_distribution_points_payload.go delete mode 100644 api/v1/datadog/model_distribution_points_series.go delete mode 100644 api/v1/datadog/model_distribution_points_type.go delete mode 100644 api/v1/datadog/model_distribution_widget_definition.go delete mode 100644 api/v1/datadog/model_distribution_widget_definition_type.go delete mode 100644 api/v1/datadog/model_distribution_widget_histogram_request_query.go delete mode 100644 api/v1/datadog/model_distribution_widget_histogram_request_type.go delete mode 100644 api/v1/datadog/model_distribution_widget_request.go delete mode 100644 api/v1/datadog/model_distribution_widget_x_axis.go delete mode 100644 api/v1/datadog/model_distribution_widget_y_axis.go delete mode 100644 api/v1/datadog/model_downtime.go delete mode 100644 api/v1/datadog/model_downtime_child.go delete mode 100644 api/v1/datadog/model_downtime_recurrence.go delete mode 100644 api/v1/datadog/model_event.go delete mode 100644 api/v1/datadog/model_event_alert_type.go delete mode 100644 api/v1/datadog/model_event_create_request.go delete mode 100644 api/v1/datadog/model_event_create_response.go delete mode 100644 api/v1/datadog/model_event_list_response.go delete mode 100644 api/v1/datadog/model_event_priority.go delete mode 100644 api/v1/datadog/model_event_query_definition.go delete mode 100644 api/v1/datadog/model_event_response.go delete mode 100644 api/v1/datadog/model_event_stream_widget_definition.go delete mode 100644 api/v1/datadog/model_event_stream_widget_definition_type.go delete mode 100644 api/v1/datadog/model_event_timeline_widget_definition.go delete mode 100644 api/v1/datadog/model_event_timeline_widget_definition_type.go delete mode 100644 api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go delete mode 100644 api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go delete mode 100644 api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go delete mode 100644 api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go delete mode 100644 api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go delete mode 100644 api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go delete mode 100644 api/v1/datadog/model_formula_and_function_event_aggregation.go delete mode 100644 api/v1/datadog/model_formula_and_function_event_query_definition.go delete mode 100644 api/v1/datadog/model_formula_and_function_event_query_definition_compute.go delete mode 100644 api/v1/datadog/model_formula_and_function_event_query_definition_search.go delete mode 100644 api/v1/datadog/model_formula_and_function_event_query_group_by.go delete mode 100644 api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go delete mode 100644 api/v1/datadog/model_formula_and_function_events_data_source.go delete mode 100644 api/v1/datadog/model_formula_and_function_metric_aggregation.go delete mode 100644 api/v1/datadog/model_formula_and_function_metric_data_source.go delete mode 100644 api/v1/datadog/model_formula_and_function_metric_query_definition.go delete mode 100644 api/v1/datadog/model_formula_and_function_process_query_data_source.go delete mode 100644 api/v1/datadog/model_formula_and_function_process_query_definition.go delete mode 100644 api/v1/datadog/model_formula_and_function_query_definition.go delete mode 100644 api/v1/datadog/model_formula_and_function_response_format.go delete mode 100644 api/v1/datadog/model_free_text_widget_definition.go delete mode 100644 api/v1/datadog/model_free_text_widget_definition_type.go delete mode 100644 api/v1/datadog/model_funnel_query.go delete mode 100644 api/v1/datadog/model_funnel_request_type.go delete mode 100644 api/v1/datadog/model_funnel_source.go delete mode 100644 api/v1/datadog/model_funnel_step.go delete mode 100644 api/v1/datadog/model_funnel_widget_definition.go delete mode 100644 api/v1/datadog/model_funnel_widget_definition_type.go delete mode 100644 api/v1/datadog/model_funnel_widget_request.go delete mode 100644 api/v1/datadog/model_gcp_account.go delete mode 100644 api/v1/datadog/model_geomap_widget_definition.go delete mode 100644 api/v1/datadog/model_geomap_widget_definition_style.go delete mode 100644 api/v1/datadog/model_geomap_widget_definition_type.go delete mode 100644 api/v1/datadog/model_geomap_widget_definition_view.go delete mode 100644 api/v1/datadog/model_geomap_widget_request.go delete mode 100644 api/v1/datadog/model_graph_snapshot.go delete mode 100644 api/v1/datadog/model_group_widget_definition.go delete mode 100644 api/v1/datadog/model_group_widget_definition_type.go delete mode 100644 api/v1/datadog/model_heat_map_widget_definition.go delete mode 100644 api/v1/datadog/model_heat_map_widget_definition_type.go delete mode 100644 api/v1/datadog/model_heat_map_widget_request.go delete mode 100644 api/v1/datadog/model_host.go delete mode 100644 api/v1/datadog/model_host_list_response.go delete mode 100644 api/v1/datadog/model_host_map_request.go delete mode 100644 api/v1/datadog/model_host_map_widget_definition.go delete mode 100644 api/v1/datadog/model_host_map_widget_definition_requests.go delete mode 100644 api/v1/datadog/model_host_map_widget_definition_style.go delete mode 100644 api/v1/datadog/model_host_map_widget_definition_type.go delete mode 100644 api/v1/datadog/model_host_meta.go delete mode 100644 api/v1/datadog/model_host_meta_install_method.go delete mode 100644 api/v1/datadog/model_host_metrics.go delete mode 100644 api/v1/datadog/model_host_mute_response.go delete mode 100644 api/v1/datadog/model_host_mute_settings.go delete mode 100644 api/v1/datadog/model_host_tags.go delete mode 100644 api/v1/datadog/model_host_totals.go delete mode 100644 api/v1/datadog/model_hourly_usage_attribution_body.go delete mode 100644 api/v1/datadog/model_hourly_usage_attribution_metadata.go delete mode 100644 api/v1/datadog/model_hourly_usage_attribution_pagination.go delete mode 100644 api/v1/datadog/model_hourly_usage_attribution_response.go delete mode 100644 api/v1/datadog/model_hourly_usage_attribution_usage_type.go delete mode 100644 api/v1/datadog/model_http_log_error.go delete mode 100644 api/v1/datadog/model_http_log_item.go delete mode 100644 api/v1/datadog/model_http_method.go delete mode 100644 api/v1/datadog/model_i_frame_widget_definition.go delete mode 100644 api/v1/datadog/model_i_frame_widget_definition_type.go delete mode 100644 api/v1/datadog/model_idp_form_data.go delete mode 100644 api/v1/datadog/model_idp_response.go delete mode 100644 api/v1/datadog/model_image_widget_definition.go delete mode 100644 api/v1/datadog/model_image_widget_definition_type.go delete mode 100644 api/v1/datadog/model_intake_payload_accepted.go delete mode 100644 api/v1/datadog/model_ip_prefixes_agents.go delete mode 100644 api/v1/datadog/model_ip_prefixes_api.go delete mode 100644 api/v1/datadog/model_ip_prefixes_apm.go delete mode 100644 api/v1/datadog/model_ip_prefixes_logs.go delete mode 100644 api/v1/datadog/model_ip_prefixes_process.go delete mode 100644 api/v1/datadog/model_ip_prefixes_synthetics.go delete mode 100644 api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go delete mode 100644 api/v1/datadog/model_ip_prefixes_webhooks.go delete mode 100644 api/v1/datadog/model_ip_ranges.go delete mode 100644 api/v1/datadog/model_list_stream_column.go delete mode 100644 api/v1/datadog/model_list_stream_column_width.go delete mode 100644 api/v1/datadog/model_list_stream_query.go delete mode 100644 api/v1/datadog/model_list_stream_response_format.go delete mode 100644 api/v1/datadog/model_list_stream_source.go delete mode 100644 api/v1/datadog/model_list_stream_widget_definition.go delete mode 100644 api/v1/datadog/model_list_stream_widget_definition_type.go delete mode 100644 api/v1/datadog/model_list_stream_widget_request.go delete mode 100644 api/v1/datadog/model_log.go delete mode 100644 api/v1/datadog/model_log_content.go delete mode 100644 api/v1/datadog/model_log_query_definition.go delete mode 100644 api/v1/datadog/model_log_query_definition_group_by.go delete mode 100644 api/v1/datadog/model_log_query_definition_group_by_sort.go delete mode 100644 api/v1/datadog/model_log_query_definition_search.go delete mode 100644 api/v1/datadog/model_log_stream_widget_definition.go delete mode 100644 api/v1/datadog/model_log_stream_widget_definition_type.go delete mode 100644 api/v1/datadog/model_logs_api_error.go delete mode 100644 api/v1/datadog/model_logs_api_error_response.go delete mode 100644 api/v1/datadog/model_logs_arithmetic_processor.go delete mode 100644 api/v1/datadog/model_logs_arithmetic_processor_type.go delete mode 100644 api/v1/datadog/model_logs_attribute_remapper.go delete mode 100644 api/v1/datadog/model_logs_attribute_remapper_type.go delete mode 100644 api/v1/datadog/model_logs_by_retention.go delete mode 100644 api/v1/datadog/model_logs_by_retention_monthly_usage.go delete mode 100644 api/v1/datadog/model_logs_by_retention_org_usage.go delete mode 100644 api/v1/datadog/model_logs_by_retention_orgs.go delete mode 100644 api/v1/datadog/model_logs_category_processor.go delete mode 100644 api/v1/datadog/model_logs_category_processor_category.go delete mode 100644 api/v1/datadog/model_logs_category_processor_type.go delete mode 100644 api/v1/datadog/model_logs_date_remapper.go delete mode 100644 api/v1/datadog/model_logs_date_remapper_type.go delete mode 100644 api/v1/datadog/model_logs_exclusion.go delete mode 100644 api/v1/datadog/model_logs_exclusion_filter.go delete mode 100644 api/v1/datadog/model_logs_filter.go delete mode 100644 api/v1/datadog/model_logs_geo_ip_parser.go delete mode 100644 api/v1/datadog/model_logs_geo_ip_parser_type.go delete mode 100644 api/v1/datadog/model_logs_grok_parser.go delete mode 100644 api/v1/datadog/model_logs_grok_parser_rules.go delete mode 100644 api/v1/datadog/model_logs_grok_parser_type.go delete mode 100644 api/v1/datadog/model_logs_index.go delete mode 100644 api/v1/datadog/model_logs_index_list_response.go delete mode 100644 api/v1/datadog/model_logs_index_update_request.go delete mode 100644 api/v1/datadog/model_logs_indexes_order.go delete mode 100644 api/v1/datadog/model_logs_list_request.go delete mode 100644 api/v1/datadog/model_logs_list_request_time.go delete mode 100644 api/v1/datadog/model_logs_list_response.go delete mode 100644 api/v1/datadog/model_logs_lookup_processor.go delete mode 100644 api/v1/datadog/model_logs_lookup_processor_type.go delete mode 100644 api/v1/datadog/model_logs_message_remapper.go delete mode 100644 api/v1/datadog/model_logs_message_remapper_type.go delete mode 100644 api/v1/datadog/model_logs_pipeline.go delete mode 100644 api/v1/datadog/model_logs_pipeline_processor.go delete mode 100644 api/v1/datadog/model_logs_pipeline_processor_type.go delete mode 100644 api/v1/datadog/model_logs_pipelines_order.go delete mode 100644 api/v1/datadog/model_logs_processor.go delete mode 100644 api/v1/datadog/model_logs_query_compute.go delete mode 100644 api/v1/datadog/model_logs_retention_agg_sum_usage.go delete mode 100644 api/v1/datadog/model_logs_retention_sum_usage.go delete mode 100644 api/v1/datadog/model_logs_service_remapper.go delete mode 100644 api/v1/datadog/model_logs_service_remapper_type.go delete mode 100644 api/v1/datadog/model_logs_sort.go delete mode 100644 api/v1/datadog/model_logs_status_remapper.go delete mode 100644 api/v1/datadog/model_logs_status_remapper_type.go delete mode 100644 api/v1/datadog/model_logs_string_builder_processor.go delete mode 100644 api/v1/datadog/model_logs_string_builder_processor_type.go delete mode 100644 api/v1/datadog/model_logs_trace_remapper.go delete mode 100644 api/v1/datadog/model_logs_trace_remapper_type.go delete mode 100644 api/v1/datadog/model_logs_url_parser.go delete mode 100644 api/v1/datadog/model_logs_url_parser_type.go delete mode 100644 api/v1/datadog/model_logs_user_agent_parser.go delete mode 100644 api/v1/datadog/model_logs_user_agent_parser_type.go delete mode 100644 api/v1/datadog/model_metric_content_encoding.go delete mode 100644 api/v1/datadog/model_metric_metadata.go delete mode 100644 api/v1/datadog/model_metric_search_response.go delete mode 100644 api/v1/datadog/model_metric_search_response_results.go delete mode 100644 api/v1/datadog/model_metrics_list_response.go delete mode 100644 api/v1/datadog/model_metrics_payload.go delete mode 100644 api/v1/datadog/model_metrics_query_metadata.go delete mode 100644 api/v1/datadog/model_metrics_query_response.go delete mode 100644 api/v1/datadog/model_metrics_query_unit.go delete mode 100644 api/v1/datadog/model_monitor.go delete mode 100644 api/v1/datadog/model_monitor_device_id.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_events_data_source.go delete mode 100644 api/v1/datadog/model_monitor_formula_and_function_query_definition.go delete mode 100644 api/v1/datadog/model_monitor_group_search_response.go delete mode 100644 api/v1/datadog/model_monitor_group_search_response_counts.go delete mode 100644 api/v1/datadog/model_monitor_group_search_result.go delete mode 100644 api/v1/datadog/model_monitor_options.go delete mode 100644 api/v1/datadog/model_monitor_options_aggregation.go delete mode 100644 api/v1/datadog/model_monitor_overall_states.go delete mode 100644 api/v1/datadog/model_monitor_renotify_status_type.go delete mode 100644 api/v1/datadog/model_monitor_search_count_item.go delete mode 100644 api/v1/datadog/model_monitor_search_response.go delete mode 100644 api/v1/datadog/model_monitor_search_response_counts.go delete mode 100644 api/v1/datadog/model_monitor_search_response_metadata.go delete mode 100644 api/v1/datadog/model_monitor_search_result.go delete mode 100644 api/v1/datadog/model_monitor_search_result_notification.go delete mode 100644 api/v1/datadog/model_monitor_state.go delete mode 100644 api/v1/datadog/model_monitor_state_group.go delete mode 100644 api/v1/datadog/model_monitor_summary_widget_definition.go delete mode 100644 api/v1/datadog/model_monitor_summary_widget_definition_type.go delete mode 100644 api/v1/datadog/model_monitor_threshold_window_options.go delete mode 100644 api/v1/datadog/model_monitor_thresholds.go delete mode 100644 api/v1/datadog/model_monitor_type.go delete mode 100644 api/v1/datadog/model_monitor_update_request.go delete mode 100644 api/v1/datadog/model_monthly_usage_attribution_body.go delete mode 100644 api/v1/datadog/model_monthly_usage_attribution_metadata.go delete mode 100644 api/v1/datadog/model_monthly_usage_attribution_pagination.go delete mode 100644 api/v1/datadog/model_monthly_usage_attribution_response.go delete mode 100644 api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go delete mode 100644 api/v1/datadog/model_monthly_usage_attribution_values.go delete mode 100644 api/v1/datadog/model_note_widget_definition.go delete mode 100644 api/v1/datadog/model_note_widget_definition_type.go delete mode 100644 api/v1/datadog/model_notebook_absolute_time.go delete mode 100644 api/v1/datadog/model_notebook_author.go delete mode 100644 api/v1/datadog/model_notebook_cell_create_request.go delete mode 100644 api/v1/datadog/model_notebook_cell_create_request_attributes.go delete mode 100644 api/v1/datadog/model_notebook_cell_resource_type.go delete mode 100644 api/v1/datadog/model_notebook_cell_response.go delete mode 100644 api/v1/datadog/model_notebook_cell_response_attributes.go delete mode 100644 api/v1/datadog/model_notebook_cell_time.go delete mode 100644 api/v1/datadog/model_notebook_cell_update_request.go delete mode 100644 api/v1/datadog/model_notebook_cell_update_request_attributes.go delete mode 100644 api/v1/datadog/model_notebook_create_data.go delete mode 100644 api/v1/datadog/model_notebook_create_data_attributes.go delete mode 100644 api/v1/datadog/model_notebook_create_request.go delete mode 100644 api/v1/datadog/model_notebook_distribution_cell_attributes.go delete mode 100644 api/v1/datadog/model_notebook_global_time.go delete mode 100644 api/v1/datadog/model_notebook_graph_size.go delete mode 100644 api/v1/datadog/model_notebook_heat_map_cell_attributes.go delete mode 100644 api/v1/datadog/model_notebook_log_stream_cell_attributes.go delete mode 100644 api/v1/datadog/model_notebook_markdown_cell_attributes.go delete mode 100644 api/v1/datadog/model_notebook_markdown_cell_definition.go delete mode 100644 api/v1/datadog/model_notebook_markdown_cell_definition_type.go delete mode 100644 api/v1/datadog/model_notebook_metadata.go delete mode 100644 api/v1/datadog/model_notebook_metadata_type.go delete mode 100644 api/v1/datadog/model_notebook_relative_time.go delete mode 100644 api/v1/datadog/model_notebook_resource_type.go delete mode 100644 api/v1/datadog/model_notebook_response.go delete mode 100644 api/v1/datadog/model_notebook_response_data.go delete mode 100644 api/v1/datadog/model_notebook_response_data_attributes.go delete mode 100644 api/v1/datadog/model_notebook_split_by.go delete mode 100644 api/v1/datadog/model_notebook_status.go delete mode 100644 api/v1/datadog/model_notebook_timeseries_cell_attributes.go delete mode 100644 api/v1/datadog/model_notebook_toplist_cell_attributes.go delete mode 100644 api/v1/datadog/model_notebook_update_cell.go delete mode 100644 api/v1/datadog/model_notebook_update_data.go delete mode 100644 api/v1/datadog/model_notebook_update_data_attributes.go delete mode 100644 api/v1/datadog/model_notebook_update_request.go delete mode 100644 api/v1/datadog/model_notebooks_response.go delete mode 100644 api/v1/datadog/model_notebooks_response_data.go delete mode 100644 api/v1/datadog/model_notebooks_response_data_attributes.go delete mode 100644 api/v1/datadog/model_notebooks_response_meta.go delete mode 100644 api/v1/datadog/model_notebooks_response_page.go delete mode 100644 api/v1/datadog/model_org_downgraded_response.go delete mode 100644 api/v1/datadog/model_organization.go delete mode 100644 api/v1/datadog/model_organization_billing.go delete mode 100644 api/v1/datadog/model_organization_create_body.go delete mode 100644 api/v1/datadog/model_organization_create_response.go delete mode 100644 api/v1/datadog/model_organization_list_response.go delete mode 100644 api/v1/datadog/model_organization_response.go delete mode 100644 api/v1/datadog/model_organization_settings.go delete mode 100644 api/v1/datadog/model_organization_settings_saml.go delete mode 100644 api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go delete mode 100644 api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go delete mode 100644 api/v1/datadog/model_organization_settings_saml_strict_mode.go delete mode 100644 api/v1/datadog/model_organization_subscription.go delete mode 100644 api/v1/datadog/model_pager_duty_service.go delete mode 100644 api/v1/datadog/model_pager_duty_service_key.go delete mode 100644 api/v1/datadog/model_pager_duty_service_name.go delete mode 100644 api/v1/datadog/model_pagination.go delete mode 100644 api/v1/datadog/model_process_query_definition.go delete mode 100644 api/v1/datadog/model_query_sort_order.go delete mode 100644 api/v1/datadog/model_query_value_widget_definition.go delete mode 100644 api/v1/datadog/model_query_value_widget_definition_type.go delete mode 100644 api/v1/datadog/model_query_value_widget_request.go delete mode 100644 api/v1/datadog/model_response_meta_attributes.go delete mode 100644 api/v1/datadog/model_scatter_plot_request.go delete mode 100644 api/v1/datadog/model_scatter_plot_widget_definition.go delete mode 100644 api/v1/datadog/model_scatter_plot_widget_definition_requests.go delete mode 100644 api/v1/datadog/model_scatter_plot_widget_definition_type.go delete mode 100644 api/v1/datadog/model_scatterplot_dimension.go delete mode 100644 api/v1/datadog/model_scatterplot_table_request.go delete mode 100644 api/v1/datadog/model_scatterplot_widget_aggregator.go delete mode 100644 api/v1/datadog/model_scatterplot_widget_formula.go delete mode 100644 api/v1/datadog/model_search_slo_response.go delete mode 100644 api/v1/datadog/model_search_slo_response_data.go delete mode 100644 api/v1/datadog/model_search_slo_response_data_attributes.go delete mode 100644 api/v1/datadog/model_search_slo_response_data_attributes_facets.go delete mode 100644 api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go delete mode 100644 api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go delete mode 100644 api/v1/datadog/model_search_slo_response_links.go delete mode 100644 api/v1/datadog/model_search_slo_response_meta.go delete mode 100644 api/v1/datadog/model_search_slo_response_meta_page.go delete mode 100644 api/v1/datadog/model_series.go delete mode 100644 api/v1/datadog/model_service_check.go delete mode 100644 api/v1/datadog/model_service_check_status.go delete mode 100644 api/v1/datadog/model_service_level_objective.go delete mode 100644 api/v1/datadog/model_service_level_objective_query.go delete mode 100644 api/v1/datadog/model_service_level_objective_request.go delete mode 100644 api/v1/datadog/model_service_map_widget_definition.go delete mode 100644 api/v1/datadog/model_service_map_widget_definition_type.go delete mode 100644 api/v1/datadog/model_service_summary_widget_definition.go delete mode 100644 api/v1/datadog/model_service_summary_widget_definition_type.go delete mode 100644 api/v1/datadog/model_signal_archive_reason.go delete mode 100644 api/v1/datadog/model_signal_assignee_update_request.go delete mode 100644 api/v1/datadog/model_signal_state_update_request.go delete mode 100644 api/v1/datadog/model_signal_triage_state.go delete mode 100644 api/v1/datadog/model_slack_integration_channel.go delete mode 100644 api/v1/datadog/model_slack_integration_channel_display.go delete mode 100644 api/v1/datadog/model_slo_bulk_delete_error.go delete mode 100644 api/v1/datadog/model_slo_bulk_delete_response.go delete mode 100644 api/v1/datadog/model_slo_bulk_delete_response_data.go delete mode 100644 api/v1/datadog/model_slo_correction.go delete mode 100644 api/v1/datadog/model_slo_correction_category.go delete mode 100644 api/v1/datadog/model_slo_correction_create_data.go delete mode 100644 api/v1/datadog/model_slo_correction_create_request.go delete mode 100644 api/v1/datadog/model_slo_correction_create_request_attributes.go delete mode 100644 api/v1/datadog/model_slo_correction_list_response.go delete mode 100644 api/v1/datadog/model_slo_correction_response.go delete mode 100644 api/v1/datadog/model_slo_correction_response_attributes.go delete mode 100644 api/v1/datadog/model_slo_correction_response_attributes_modifier.go delete mode 100644 api/v1/datadog/model_slo_correction_type.go delete mode 100644 api/v1/datadog/model_slo_correction_update_data.go delete mode 100644 api/v1/datadog/model_slo_correction_update_request.go delete mode 100644 api/v1/datadog/model_slo_correction_update_request_attributes.go delete mode 100644 api/v1/datadog/model_slo_delete_response.go delete mode 100644 api/v1/datadog/model_slo_error_timeframe.go delete mode 100644 api/v1/datadog/model_slo_history_metrics.go delete mode 100644 api/v1/datadog/model_slo_history_metrics_series.go delete mode 100644 api/v1/datadog/model_slo_history_metrics_series_metadata.go delete mode 100644 api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go delete mode 100644 api/v1/datadog/model_slo_history_monitor.go delete mode 100644 api/v1/datadog/model_slo_history_response.go delete mode 100644 api/v1/datadog/model_slo_history_response_data.go delete mode 100644 api/v1/datadog/model_slo_history_response_error.go delete mode 100644 api/v1/datadog/model_slo_history_response_error_with_type.go delete mode 100644 api/v1/datadog/model_slo_history_sli_data.go delete mode 100644 api/v1/datadog/model_slo_list_response.go delete mode 100644 api/v1/datadog/model_slo_list_response_metadata.go delete mode 100644 api/v1/datadog/model_slo_list_response_metadata_page.go delete mode 100644 api/v1/datadog/model_slo_response.go delete mode 100644 api/v1/datadog/model_slo_response_data.go delete mode 100644 api/v1/datadog/model_slo_threshold.go delete mode 100644 api/v1/datadog/model_slo_timeframe.go delete mode 100644 api/v1/datadog/model_slo_type.go delete mode 100644 api/v1/datadog/model_slo_type_numeric.go delete mode 100644 api/v1/datadog/model_slo_widget_definition.go delete mode 100644 api/v1/datadog/model_slo_widget_definition_type.go delete mode 100644 api/v1/datadog/model_successful_signal_update_response.go delete mode 100644 api/v1/datadog/model_sunburst_widget_definition.go delete mode 100644 api/v1/datadog/model_sunburst_widget_definition_type.go delete mode 100644 api/v1/datadog/model_sunburst_widget_legend.go delete mode 100644 api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go delete mode 100644 api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go delete mode 100644 api/v1/datadog/model_sunburst_widget_legend_table.go delete mode 100644 api/v1/datadog/model_sunburst_widget_legend_table_type.go delete mode 100644 api/v1/datadog/model_sunburst_widget_request.go delete mode 100644 api/v1/datadog/model_synthetics_api_step.go delete mode 100644 api/v1/datadog/model_synthetics_api_step_subtype.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_config.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_failure_code.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_result_data.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_result_failure.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_result_full.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_result_full_check.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_result_short.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_result_short_result.go delete mode 100644 api/v1/datadog/model_synthetics_api_test_type.go delete mode 100644 api/v1/datadog/model_synthetics_assertion.go delete mode 100644 api/v1/datadog/model_synthetics_assertion_json_path_operator.go delete mode 100644 api/v1/datadog/model_synthetics_assertion_json_path_target.go delete mode 100644 api/v1/datadog/model_synthetics_assertion_json_path_target_target.go delete mode 100644 api/v1/datadog/model_synthetics_assertion_operator.go delete mode 100644 api/v1/datadog/model_synthetics_assertion_target.go delete mode 100644 api/v1/datadog/model_synthetics_assertion_type.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_digest.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_digest_type.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_ntlm.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_sigv4.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_web.go delete mode 100644 api/v1/datadog/model_synthetics_basic_auth_web_type.go delete mode 100644 api/v1/datadog/model_synthetics_batch_details.go delete mode 100644 api/v1/datadog/model_synthetics_batch_details_data.go delete mode 100644 api/v1/datadog/model_synthetics_batch_result.go delete mode 100644 api/v1/datadog/model_synthetics_browser_error.go delete mode 100644 api/v1/datadog/model_synthetics_browser_error_type.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_config.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_failure_code.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_result_data.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_result_failure.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_result_full.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_result_full_check.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_result_short.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_result_short_result.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_rum_settings.go delete mode 100644 api/v1/datadog/model_synthetics_browser_test_type.go delete mode 100644 api/v1/datadog/model_synthetics_browser_variable.go delete mode 100644 api/v1/datadog/model_synthetics_browser_variable_type.go delete mode 100644 api/v1/datadog/model_synthetics_check_type.go delete mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata.go delete mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go delete mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_git.go delete mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.go delete mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_provider.go delete mode 100644 api/v1/datadog/model_synthetics_ci_test_.go delete mode 100644 api/v1/datadog/model_synthetics_ci_test_body.go delete mode 100644 api/v1/datadog/model_synthetics_config_variable.go delete mode 100644 api/v1/datadog/model_synthetics_config_variable_type.go delete mode 100644 api/v1/datadog/model_synthetics_core_web_vitals.go delete mode 100644 api/v1/datadog/model_synthetics_delete_tests_payload.go delete mode 100644 api/v1/datadog/model_synthetics_delete_tests_response.go delete mode 100644 api/v1/datadog/model_synthetics_deleted_test_.go delete mode 100644 api/v1/datadog/model_synthetics_device.go delete mode 100644 api/v1/datadog/model_synthetics_device_id.go delete mode 100644 api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go delete mode 100644 api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go delete mode 100644 api/v1/datadog/model_synthetics_global_variable.go delete mode 100644 api/v1/datadog/model_synthetics_global_variable_attributes.go delete mode 100644 api/v1/datadog/model_synthetics_global_variable_parse_test_options.go delete mode 100644 api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go delete mode 100644 api/v1/datadog/model_synthetics_global_variable_parser_type.go delete mode 100644 api/v1/datadog/model_synthetics_global_variable_value.go delete mode 100644 api/v1/datadog/model_synthetics_list_global_variables_response.go delete mode 100644 api/v1/datadog/model_synthetics_list_tests_response.go delete mode 100644 api/v1/datadog/model_synthetics_location.go delete mode 100644 api/v1/datadog/model_synthetics_locations.go delete mode 100644 api/v1/datadog/model_synthetics_parsing_options.go delete mode 100644 api/v1/datadog/model_synthetics_playing_tab.go delete mode 100644 api/v1/datadog/model_synthetics_private_location.go delete mode 100644 api/v1/datadog/model_synthetics_private_location_creation_response.go delete mode 100644 api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go delete mode 100644 api/v1/datadog/model_synthetics_private_location_metadata.go delete mode 100644 api/v1/datadog/model_synthetics_private_location_secrets.go delete mode 100644 api/v1/datadog/model_synthetics_private_location_secrets_authentication.go delete mode 100644 api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.go delete mode 100644 api/v1/datadog/model_synthetics_ssl_certificate.go delete mode 100644 api/v1/datadog/model_synthetics_ssl_certificate_issuer.go delete mode 100644 api/v1/datadog/model_synthetics_ssl_certificate_subject.go delete mode 100644 api/v1/datadog/model_synthetics_status.go delete mode 100644 api/v1/datadog/model_synthetics_step.go delete mode 100644 api/v1/datadog/model_synthetics_step_detail.go delete mode 100644 api/v1/datadog/model_synthetics_step_detail_warning.go delete mode 100644 api/v1/datadog/model_synthetics_step_type.go delete mode 100644 api/v1/datadog/model_synthetics_test_ci_options.go delete mode 100644 api/v1/datadog/model_synthetics_test_config.go delete mode 100644 api/v1/datadog/model_synthetics_test_details.go delete mode 100644 api/v1/datadog/model_synthetics_test_details_sub_type.go delete mode 100644 api/v1/datadog/model_synthetics_test_details_type.go delete mode 100644 api/v1/datadog/model_synthetics_test_execution_rule.go delete mode 100644 api/v1/datadog/model_synthetics_test_monitor_status.go delete mode 100644 api/v1/datadog/model_synthetics_test_options.go delete mode 100644 api/v1/datadog/model_synthetics_test_options_monitor_options.go delete mode 100644 api/v1/datadog/model_synthetics_test_options_retry.go delete mode 100644 api/v1/datadog/model_synthetics_test_pause_status.go delete mode 100644 api/v1/datadog/model_synthetics_test_process_status.go delete mode 100644 api/v1/datadog/model_synthetics_test_request.go delete mode 100644 api/v1/datadog/model_synthetics_test_request_certificate.go delete mode 100644 api/v1/datadog/model_synthetics_test_request_certificate_item.go delete mode 100644 api/v1/datadog/model_synthetics_test_request_proxy.go delete mode 100644 api/v1/datadog/model_synthetics_timing.go delete mode 100644 api/v1/datadog/model_synthetics_trigger_body.go delete mode 100644 api/v1/datadog/model_synthetics_trigger_ci_test_location.go delete mode 100644 api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go delete mode 100644 api/v1/datadog/model_synthetics_trigger_ci_tests_response.go delete mode 100644 api/v1/datadog/model_synthetics_trigger_test_.go delete mode 100644 api/v1/datadog/model_synthetics_update_test_pause_status_payload.go delete mode 100644 api/v1/datadog/model_synthetics_variable_parser.go delete mode 100644 api/v1/datadog/model_synthetics_warning_type.go delete mode 100644 api/v1/datadog/model_table_widget_cell_display_mode.go delete mode 100644 api/v1/datadog/model_table_widget_definition.go delete mode 100644 api/v1/datadog/model_table_widget_definition_type.go delete mode 100644 api/v1/datadog/model_table_widget_has_search_bar.go delete mode 100644 api/v1/datadog/model_table_widget_request.go delete mode 100644 api/v1/datadog/model_tag_to_hosts.go delete mode 100644 api/v1/datadog/model_target_format_type.go delete mode 100644 api/v1/datadog/model_timeseries_background.go delete mode 100644 api/v1/datadog/model_timeseries_background_type.go delete mode 100644 api/v1/datadog/model_timeseries_widget_definition.go delete mode 100644 api/v1/datadog/model_timeseries_widget_definition_type.go delete mode 100644 api/v1/datadog/model_timeseries_widget_expression_alias.go delete mode 100644 api/v1/datadog/model_timeseries_widget_legend_column.go delete mode 100644 api/v1/datadog/model_timeseries_widget_legend_layout.go delete mode 100644 api/v1/datadog/model_timeseries_widget_request.go delete mode 100644 api/v1/datadog/model_toplist_widget_definition.go delete mode 100644 api/v1/datadog/model_toplist_widget_definition_type.go delete mode 100644 api/v1/datadog/model_toplist_widget_request.go delete mode 100644 api/v1/datadog/model_tree_map_color_by.go delete mode 100644 api/v1/datadog/model_tree_map_group_by.go delete mode 100644 api/v1/datadog/model_tree_map_size_by.go delete mode 100644 api/v1/datadog/model_tree_map_widget_definition.go delete mode 100644 api/v1/datadog/model_tree_map_widget_definition_type.go delete mode 100644 api/v1/datadog/model_tree_map_widget_request.go delete mode 100644 api/v1/datadog/model_usage_analyzed_logs_hour.go delete mode 100644 api/v1/datadog/model_usage_analyzed_logs_response.go delete mode 100644 api/v1/datadog/model_usage_attribution_aggregates_body.go delete mode 100644 api/v1/datadog/model_usage_attribution_body.go delete mode 100644 api/v1/datadog/model_usage_attribution_metadata.go delete mode 100644 api/v1/datadog/model_usage_attribution_pagination.go delete mode 100644 api/v1/datadog/model_usage_attribution_response.go delete mode 100644 api/v1/datadog/model_usage_attribution_sort.go delete mode 100644 api/v1/datadog/model_usage_attribution_supported_metrics.go delete mode 100644 api/v1/datadog/model_usage_attribution_values.go delete mode 100644 api/v1/datadog/model_usage_audit_logs_hour.go delete mode 100644 api/v1/datadog/model_usage_audit_logs_response.go delete mode 100644 api/v1/datadog/model_usage_billable_summary_body.go delete mode 100644 api/v1/datadog/model_usage_billable_summary_hour.go delete mode 100644 api/v1/datadog/model_usage_billable_summary_keys.go delete mode 100644 api/v1/datadog/model_usage_billable_summary_response.go delete mode 100644 api/v1/datadog/model_usage_ci_visibility_hour.go delete mode 100644 api/v1/datadog/model_usage_ci_visibility_response.go delete mode 100644 api/v1/datadog/model_usage_cloud_security_posture_management_hour.go delete mode 100644 api/v1/datadog/model_usage_cloud_security_posture_management_response.go delete mode 100644 api/v1/datadog/model_usage_custom_reports_attributes.go delete mode 100644 api/v1/datadog/model_usage_custom_reports_data.go delete mode 100644 api/v1/datadog/model_usage_custom_reports_meta.go delete mode 100644 api/v1/datadog/model_usage_custom_reports_page.go delete mode 100644 api/v1/datadog/model_usage_custom_reports_response.go delete mode 100644 api/v1/datadog/model_usage_cws_hour.go delete mode 100644 api/v1/datadog/model_usage_cws_response.go delete mode 100644 api/v1/datadog/model_usage_dbm_hour.go delete mode 100644 api/v1/datadog/model_usage_dbm_response.go delete mode 100644 api/v1/datadog/model_usage_fargate_hour.go delete mode 100644 api/v1/datadog/model_usage_fargate_response.go delete mode 100644 api/v1/datadog/model_usage_host_hour.go delete mode 100644 api/v1/datadog/model_usage_hosts_response.go delete mode 100644 api/v1/datadog/model_usage_incident_management_hour.go delete mode 100644 api/v1/datadog/model_usage_incident_management_response.go delete mode 100644 api/v1/datadog/model_usage_indexed_spans_hour.go delete mode 100644 api/v1/datadog/model_usage_indexed_spans_response.go delete mode 100644 api/v1/datadog/model_usage_ingested_spans_hour.go delete mode 100644 api/v1/datadog/model_usage_ingested_spans_response.go delete mode 100644 api/v1/datadog/model_usage_io_t_hour.go delete mode 100644 api/v1/datadog/model_usage_io_t_response.go delete mode 100644 api/v1/datadog/model_usage_lambda_hour.go delete mode 100644 api/v1/datadog/model_usage_lambda_response.go delete mode 100644 api/v1/datadog/model_usage_logs_by_index_hour.go delete mode 100644 api/v1/datadog/model_usage_logs_by_index_response.go delete mode 100644 api/v1/datadog/model_usage_logs_by_retention_hour.go delete mode 100644 api/v1/datadog/model_usage_logs_by_retention_response.go delete mode 100644 api/v1/datadog/model_usage_logs_hour.go delete mode 100644 api/v1/datadog/model_usage_logs_response.go delete mode 100644 api/v1/datadog/model_usage_metric_category.go delete mode 100644 api/v1/datadog/model_usage_network_flows_hour.go delete mode 100644 api/v1/datadog/model_usage_network_flows_response.go delete mode 100644 api/v1/datadog/model_usage_network_hosts_hour.go delete mode 100644 api/v1/datadog/model_usage_network_hosts_response.go delete mode 100644 api/v1/datadog/model_usage_online_archive_hour.go delete mode 100644 api/v1/datadog/model_usage_online_archive_response.go delete mode 100644 api/v1/datadog/model_usage_profiling_hour.go delete mode 100644 api/v1/datadog/model_usage_profiling_response.go delete mode 100644 api/v1/datadog/model_usage_reports_type.go delete mode 100644 api/v1/datadog/model_usage_rum_sessions_hour.go delete mode 100644 api/v1/datadog/model_usage_rum_sessions_response.go delete mode 100644 api/v1/datadog/model_usage_rum_units_hour.go delete mode 100644 api/v1/datadog/model_usage_rum_units_response.go delete mode 100644 api/v1/datadog/model_usage_sds_hour.go delete mode 100644 api/v1/datadog/model_usage_sds_response.go delete mode 100644 api/v1/datadog/model_usage_snmp_hour.go delete mode 100644 api/v1/datadog/model_usage_snmp_response.go delete mode 100644 api/v1/datadog/model_usage_sort.go delete mode 100644 api/v1/datadog/model_usage_sort_direction.go delete mode 100644 api/v1/datadog/model_usage_specified_custom_reports_attributes.go delete mode 100644 api/v1/datadog/model_usage_specified_custom_reports_data.go delete mode 100644 api/v1/datadog/model_usage_specified_custom_reports_meta.go delete mode 100644 api/v1/datadog/model_usage_specified_custom_reports_page.go delete mode 100644 api/v1/datadog/model_usage_specified_custom_reports_response.go delete mode 100644 api/v1/datadog/model_usage_summary_date.go delete mode 100644 api/v1/datadog/model_usage_summary_date_org.go delete mode 100644 api/v1/datadog/model_usage_summary_response.go delete mode 100644 api/v1/datadog/model_usage_synthetics_api_hour.go delete mode 100644 api/v1/datadog/model_usage_synthetics_api_response.go delete mode 100644 api/v1/datadog/model_usage_synthetics_browser_hour.go delete mode 100644 api/v1/datadog/model_usage_synthetics_browser_response.go delete mode 100644 api/v1/datadog/model_usage_synthetics_hour.go delete mode 100644 api/v1/datadog/model_usage_synthetics_response.go delete mode 100644 api/v1/datadog/model_usage_timeseries_hour.go delete mode 100644 api/v1/datadog/model_usage_timeseries_response.go delete mode 100644 api/v1/datadog/model_usage_top_avg_metrics_hour.go delete mode 100644 api/v1/datadog/model_usage_top_avg_metrics_metadata.go delete mode 100644 api/v1/datadog/model_usage_top_avg_metrics_pagination.go delete mode 100644 api/v1/datadog/model_usage_top_avg_metrics_response.go delete mode 100644 api/v1/datadog/model_user.go delete mode 100644 api/v1/datadog/model_user_disable_response.go delete mode 100644 api/v1/datadog/model_user_list_response.go delete mode 100644 api/v1/datadog/model_user_response.go delete mode 100644 api/v1/datadog/model_webhooks_integration.go delete mode 100644 api/v1/datadog/model_webhooks_integration_custom_variable.go delete mode 100644 api/v1/datadog/model_webhooks_integration_custom_variable_response.go delete mode 100644 api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go delete mode 100644 api/v1/datadog/model_webhooks_integration_encoding.go delete mode 100644 api/v1/datadog/model_webhooks_integration_update_request.go delete mode 100644 api/v1/datadog/model_widget.go delete mode 100644 api/v1/datadog/model_widget_aggregator.go delete mode 100644 api/v1/datadog/model_widget_axis.go delete mode 100644 api/v1/datadog/model_widget_change_type.go delete mode 100644 api/v1/datadog/model_widget_color_preference.go delete mode 100644 api/v1/datadog/model_widget_comparator.go delete mode 100644 api/v1/datadog/model_widget_compare_to.go delete mode 100644 api/v1/datadog/model_widget_conditional_format.go delete mode 100644 api/v1/datadog/model_widget_custom_link.go delete mode 100644 api/v1/datadog/model_widget_definition.go delete mode 100644 api/v1/datadog/model_widget_display_type.go delete mode 100644 api/v1/datadog/model_widget_event.go delete mode 100644 api/v1/datadog/model_widget_event_size.go delete mode 100644 api/v1/datadog/model_widget_field_sort.go delete mode 100644 api/v1/datadog/model_widget_formula.go delete mode 100644 api/v1/datadog/model_widget_formula_limit.go delete mode 100644 api/v1/datadog/model_widget_grouping.go delete mode 100644 api/v1/datadog/model_widget_horizontal_align.go delete mode 100644 api/v1/datadog/model_widget_image_sizing.go delete mode 100644 api/v1/datadog/model_widget_layout.go delete mode 100644 api/v1/datadog/model_widget_layout_type.go delete mode 100644 api/v1/datadog/model_widget_line_type.go delete mode 100644 api/v1/datadog/model_widget_line_width.go delete mode 100644 api/v1/datadog/model_widget_live_span.go delete mode 100644 api/v1/datadog/model_widget_margin.go delete mode 100644 api/v1/datadog/model_widget_marker.go delete mode 100644 api/v1/datadog/model_widget_message_display.go delete mode 100644 api/v1/datadog/model_widget_monitor_summary_display_format.go delete mode 100644 api/v1/datadog/model_widget_monitor_summary_sort.go delete mode 100644 api/v1/datadog/model_widget_node_type.go delete mode 100644 api/v1/datadog/model_widget_order_by.go delete mode 100644 api/v1/datadog/model_widget_palette.go delete mode 100644 api/v1/datadog/model_widget_request_style.go delete mode 100644 api/v1/datadog/model_widget_service_summary_display_format.go delete mode 100644 api/v1/datadog/model_widget_size_format.go delete mode 100644 api/v1/datadog/model_widget_sort.go delete mode 100644 api/v1/datadog/model_widget_style.go delete mode 100644 api/v1/datadog/model_widget_summary_type.go delete mode 100644 api/v1/datadog/model_widget_text_align.go delete mode 100644 api/v1/datadog/model_widget_tick_edge.go delete mode 100644 api/v1/datadog/model_widget_time.go delete mode 100644 api/v1/datadog/model_widget_time_windows_.go delete mode 100644 api/v1/datadog/model_widget_vertical_align.go delete mode 100644 api/v1/datadog/model_widget_view_mode.go delete mode 100644 api/v1/datadog/model_widget_viz_type.go delete mode 100644 api/v2/datadog/api_audit.go delete mode 100644 api/v2/datadog/api_auth_n_mappings.go delete mode 100644 api/v2/datadog/api_cloud_workload_security.go delete mode 100644 api/v2/datadog/api_dashboard_lists.go delete mode 100644 api/v2/datadog/api_events.go delete mode 100644 api/v2/datadog/api_incident_services.go delete mode 100644 api/v2/datadog/api_incident_teams.go delete mode 100644 api/v2/datadog/api_incidents.go delete mode 100644 api/v2/datadog/api_key_management.go delete mode 100644 api/v2/datadog/api_logs.go delete mode 100644 api/v2/datadog/api_logs_archives.go delete mode 100644 api/v2/datadog/api_logs_metrics.go delete mode 100644 api/v2/datadog/api_metrics.go delete mode 100644 api/v2/datadog/api_opsgenie_integration.go delete mode 100644 api/v2/datadog/api_organizations.go delete mode 100644 api/v2/datadog/api_processes.go delete mode 100644 api/v2/datadog/api_roles.go delete mode 100644 api/v2/datadog/api_rum.go delete mode 100644 api/v2/datadog/api_security_monitoring.go delete mode 100644 api/v2/datadog/api_service_accounts.go delete mode 100644 api/v2/datadog/api_usage_metering.go delete mode 100644 api/v2/datadog/api_users.go delete mode 100644 api/v2/datadog/model_api_error_response.go delete mode 100644 api/v2/datadog/model_api_key_create_attributes.go delete mode 100644 api/v2/datadog/model_api_key_create_data.go delete mode 100644 api/v2/datadog/model_api_key_create_request.go delete mode 100644 api/v2/datadog/model_api_key_relationships.go delete mode 100644 api/v2/datadog/model_api_key_response.go delete mode 100644 api/v2/datadog/model_api_key_response_included_item.go delete mode 100644 api/v2/datadog/model_api_key_update_attributes.go delete mode 100644 api/v2/datadog/model_api_key_update_data.go delete mode 100644 api/v2/datadog/model_api_key_update_request.go delete mode 100644 api/v2/datadog/model_api_keys_response.go delete mode 100644 api/v2/datadog/model_api_keys_sort.go delete mode 100644 api/v2/datadog/model_api_keys_type.go delete mode 100644 api/v2/datadog/model_application_key_create_attributes.go delete mode 100644 api/v2/datadog/model_application_key_create_data.go delete mode 100644 api/v2/datadog/model_application_key_create_request.go delete mode 100644 api/v2/datadog/model_application_key_relationships.go delete mode 100644 api/v2/datadog/model_application_key_response.go delete mode 100644 api/v2/datadog/model_application_key_response_included_item.go delete mode 100644 api/v2/datadog/model_application_key_update_attributes.go delete mode 100644 api/v2/datadog/model_application_key_update_data.go delete mode 100644 api/v2/datadog/model_application_key_update_request.go delete mode 100644 api/v2/datadog/model_application_keys_sort.go delete mode 100644 api/v2/datadog/model_application_keys_type.go delete mode 100644 api/v2/datadog/model_audit_logs_event.go delete mode 100644 api/v2/datadog/model_audit_logs_event_attributes.go delete mode 100644 api/v2/datadog/model_audit_logs_event_type.go delete mode 100644 api/v2/datadog/model_audit_logs_events_response.go delete mode 100644 api/v2/datadog/model_audit_logs_query_filter.go delete mode 100644 api/v2/datadog/model_audit_logs_query_options.go delete mode 100644 api/v2/datadog/model_audit_logs_query_page_options.go delete mode 100644 api/v2/datadog/model_audit_logs_response_links.go delete mode 100644 api/v2/datadog/model_audit_logs_response_metadata.go delete mode 100644 api/v2/datadog/model_audit_logs_response_page.go delete mode 100644 api/v2/datadog/model_audit_logs_response_status.go delete mode 100644 api/v2/datadog/model_audit_logs_search_events_request.go delete mode 100644 api/v2/datadog/model_audit_logs_sort.go delete mode 100644 api/v2/datadog/model_audit_logs_warning.go delete mode 100644 api/v2/datadog/model_auth_n_mapping.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_attributes.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_create_attributes.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_create_data.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_create_relationships.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_create_request.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_included.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_relationships.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_response.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_update_attributes.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_update_data.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_update_relationships.go delete mode 100644 api/v2/datadog/model_auth_n_mapping_update_request.go delete mode 100644 api/v2/datadog/model_auth_n_mappings_response.go delete mode 100644 api/v2/datadog/model_auth_n_mappings_sort.go delete mode 100644 api/v2/datadog/model_auth_n_mappings_type.go delete mode 100644 api/v2/datadog/model_chargeback_breakdown.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_data.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_response.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_type.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go delete mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.go delete mode 100644 api/v2/datadog/model_content_encoding.go delete mode 100644 api/v2/datadog/model_cost_by_org.go delete mode 100644 api/v2/datadog/model_cost_by_org_attributes.go delete mode 100644 api/v2/datadog/model_cost_by_org_response.go delete mode 100644 api/v2/datadog/model_cost_by_org_type.go delete mode 100644 api/v2/datadog/model_creator.go delete mode 100644 api/v2/datadog/model_dashboard_list_add_items_request.go delete mode 100644 api/v2/datadog/model_dashboard_list_add_items_response.go delete mode 100644 api/v2/datadog/model_dashboard_list_delete_items_request.go delete mode 100644 api/v2/datadog/model_dashboard_list_delete_items_response.go delete mode 100644 api/v2/datadog/model_dashboard_list_item.go delete mode 100644 api/v2/datadog/model_dashboard_list_item_request.go delete mode 100644 api/v2/datadog/model_dashboard_list_item_response.go delete mode 100644 api/v2/datadog/model_dashboard_list_items.go delete mode 100644 api/v2/datadog/model_dashboard_list_update_items_request.go delete mode 100644 api/v2/datadog/model_dashboard_list_update_items_response.go delete mode 100644 api/v2/datadog/model_dashboard_type.go delete mode 100644 api/v2/datadog/model_event.go delete mode 100644 api/v2/datadog/model_event_attributes.go delete mode 100644 api/v2/datadog/model_event_priority.go delete mode 100644 api/v2/datadog/model_event_response.go delete mode 100644 api/v2/datadog/model_event_response_attributes.go delete mode 100644 api/v2/datadog/model_event_status_type.go delete mode 100644 api/v2/datadog/model_event_type.go delete mode 100644 api/v2/datadog/model_events_list_request.go delete mode 100644 api/v2/datadog/model_events_list_response.go delete mode 100644 api/v2/datadog/model_events_list_response_links.go delete mode 100644 api/v2/datadog/model_events_query_filter.go delete mode 100644 api/v2/datadog/model_events_query_options.go delete mode 100644 api/v2/datadog/model_events_request_page.go delete mode 100644 api/v2/datadog/model_events_response_metadata.go delete mode 100644 api/v2/datadog/model_events_response_metadata_page.go delete mode 100644 api/v2/datadog/model_events_sort.go delete mode 100644 api/v2/datadog/model_events_warning.go delete mode 100644 api/v2/datadog/model_full_api_key.go delete mode 100644 api/v2/datadog/model_full_api_key_attributes.go delete mode 100644 api/v2/datadog/model_full_application_key.go delete mode 100644 api/v2/datadog/model_full_application_key_attributes.go delete mode 100644 api/v2/datadog/model_hourly_usage.go delete mode 100644 api/v2/datadog/model_hourly_usage_attributes.go delete mode 100644 api/v2/datadog/model_hourly_usage_measurement.go delete mode 100644 api/v2/datadog/model_hourly_usage_metadata.go delete mode 100644 api/v2/datadog/model_hourly_usage_pagination.go delete mode 100644 api/v2/datadog/model_hourly_usage_response.go delete mode 100644 api/v2/datadog/model_hourly_usage_type.go delete mode 100644 api/v2/datadog/model_http_log_error.go delete mode 100644 api/v2/datadog/model_http_log_errors.go delete mode 100644 api/v2/datadog/model_http_log_item.go delete mode 100644 api/v2/datadog/model_id_p_metadata_form_data.go delete mode 100644 api/v2/datadog/model_incident_create_attributes.go delete mode 100644 api/v2/datadog/model_incident_create_data.go delete mode 100644 api/v2/datadog/model_incident_create_relationships.go delete mode 100644 api/v2/datadog/model_incident_create_request.go delete mode 100644 api/v2/datadog/model_incident_field_attributes.go delete mode 100644 api/v2/datadog/model_incident_field_attributes_multiple_value.go delete mode 100644 api/v2/datadog/model_incident_field_attributes_single_value.go delete mode 100644 api/v2/datadog/model_incident_field_attributes_single_value_type.go delete mode 100644 api/v2/datadog/model_incident_field_attributes_value_type.go delete mode 100644 api/v2/datadog/model_incident_integration_metadata_type.go delete mode 100644 api/v2/datadog/model_incident_notification_handle.go delete mode 100644 api/v2/datadog/model_incident_postmortem_type.go delete mode 100644 api/v2/datadog/model_incident_related_object.go delete mode 100644 api/v2/datadog/model_incident_response.go delete mode 100644 api/v2/datadog/model_incident_response_attributes.go delete mode 100644 api/v2/datadog/model_incident_response_data.go delete mode 100644 api/v2/datadog/model_incident_response_included_item.go delete mode 100644 api/v2/datadog/model_incident_response_meta.go delete mode 100644 api/v2/datadog/model_incident_response_meta_pagination.go delete mode 100644 api/v2/datadog/model_incident_response_relationships.go delete mode 100644 api/v2/datadog/model_incident_service_create_attributes.go delete mode 100644 api/v2/datadog/model_incident_service_create_data.go delete mode 100644 api/v2/datadog/model_incident_service_create_request.go delete mode 100644 api/v2/datadog/model_incident_service_included_items.go delete mode 100644 api/v2/datadog/model_incident_service_relationships.go delete mode 100644 api/v2/datadog/model_incident_service_response.go delete mode 100644 api/v2/datadog/model_incident_service_response_attributes.go delete mode 100644 api/v2/datadog/model_incident_service_response_data.go delete mode 100644 api/v2/datadog/model_incident_service_type.go delete mode 100644 api/v2/datadog/model_incident_service_update_attributes.go delete mode 100644 api/v2/datadog/model_incident_service_update_data.go delete mode 100644 api/v2/datadog/model_incident_service_update_request.go delete mode 100644 api/v2/datadog/model_incident_services_response.go delete mode 100644 api/v2/datadog/model_incident_team_create_attributes.go delete mode 100644 api/v2/datadog/model_incident_team_create_data.go delete mode 100644 api/v2/datadog/model_incident_team_create_request.go delete mode 100644 api/v2/datadog/model_incident_team_included_items.go delete mode 100644 api/v2/datadog/model_incident_team_relationships.go delete mode 100644 api/v2/datadog/model_incident_team_response.go delete mode 100644 api/v2/datadog/model_incident_team_response_attributes.go delete mode 100644 api/v2/datadog/model_incident_team_response_data.go delete mode 100644 api/v2/datadog/model_incident_team_type.go delete mode 100644 api/v2/datadog/model_incident_team_update_attributes.go delete mode 100644 api/v2/datadog/model_incident_team_update_data.go delete mode 100644 api/v2/datadog/model_incident_team_update_request.go delete mode 100644 api/v2/datadog/model_incident_teams_response.go delete mode 100644 api/v2/datadog/model_incident_timeline_cell_create_attributes.go delete mode 100644 api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go delete mode 100644 api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go delete mode 100644 api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.go delete mode 100644 api/v2/datadog/model_incident_type.go delete mode 100644 api/v2/datadog/model_incident_update_attributes.go delete mode 100644 api/v2/datadog/model_incident_update_data.go delete mode 100644 api/v2/datadog/model_incident_update_relationships.go delete mode 100644 api/v2/datadog/model_incident_update_request.go delete mode 100644 api/v2/datadog/model_incidents_response.go delete mode 100644 api/v2/datadog/model_intake_payload_accepted.go delete mode 100644 api/v2/datadog/model_list_application_keys_response.go delete mode 100644 api/v2/datadog/model_log.go delete mode 100644 api/v2/datadog/model_log_attributes.go delete mode 100644 api/v2/datadog/model_log_type.go delete mode 100644 api/v2/datadog/model_logs_aggregate_bucket.go delete mode 100644 api/v2/datadog/model_logs_aggregate_bucket_value.go delete mode 100644 api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go delete mode 100644 api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go delete mode 100644 api/v2/datadog/model_logs_aggregate_request.go delete mode 100644 api/v2/datadog/model_logs_aggregate_request_page.go delete mode 100644 api/v2/datadog/model_logs_aggregate_response.go delete mode 100644 api/v2/datadog/model_logs_aggregate_response_data.go delete mode 100644 api/v2/datadog/model_logs_aggregate_response_status.go delete mode 100644 api/v2/datadog/model_logs_aggregate_sort.go delete mode 100644 api/v2/datadog/model_logs_aggregate_sort_type.go delete mode 100644 api/v2/datadog/model_logs_aggregation_function.go delete mode 100644 api/v2/datadog/model_logs_archive.go delete mode 100644 api/v2/datadog/model_logs_archive_attributes.go delete mode 100644 api/v2/datadog/model_logs_archive_create_request.go delete mode 100644 api/v2/datadog/model_logs_archive_create_request_attributes.go delete mode 100644 api/v2/datadog/model_logs_archive_create_request_definition.go delete mode 100644 api/v2/datadog/model_logs_archive_create_request_destination.go delete mode 100644 api/v2/datadog/model_logs_archive_definition.go delete mode 100644 api/v2/datadog/model_logs_archive_destination.go delete mode 100644 api/v2/datadog/model_logs_archive_destination_azure.go delete mode 100644 api/v2/datadog/model_logs_archive_destination_azure_type.go delete mode 100644 api/v2/datadog/model_logs_archive_destination_gcs.go delete mode 100644 api/v2/datadog/model_logs_archive_destination_gcs_type.go delete mode 100644 api/v2/datadog/model_logs_archive_destination_s3.go delete mode 100644 api/v2/datadog/model_logs_archive_destination_s3_type.go delete mode 100644 api/v2/datadog/model_logs_archive_integration_azure.go delete mode 100644 api/v2/datadog/model_logs_archive_integration_gcs.go delete mode 100644 api/v2/datadog/model_logs_archive_integration_s3.go delete mode 100644 api/v2/datadog/model_logs_archive_order.go delete mode 100644 api/v2/datadog/model_logs_archive_order_attributes.go delete mode 100644 api/v2/datadog/model_logs_archive_order_definition.go delete mode 100644 api/v2/datadog/model_logs_archive_order_definition_type.go delete mode 100644 api/v2/datadog/model_logs_archive_state.go delete mode 100644 api/v2/datadog/model_logs_archives.go delete mode 100644 api/v2/datadog/model_logs_compute.go delete mode 100644 api/v2/datadog/model_logs_compute_type.go delete mode 100644 api/v2/datadog/model_logs_group_by.go delete mode 100644 api/v2/datadog/model_logs_group_by_histogram.go delete mode 100644 api/v2/datadog/model_logs_group_by_missing.go delete mode 100644 api/v2/datadog/model_logs_group_by_total.go delete mode 100644 api/v2/datadog/model_logs_list_request.go delete mode 100644 api/v2/datadog/model_logs_list_request_page.go delete mode 100644 api/v2/datadog/model_logs_list_response.go delete mode 100644 api/v2/datadog/model_logs_list_response_links.go delete mode 100644 api/v2/datadog/model_logs_metric_compute.go delete mode 100644 api/v2/datadog/model_logs_metric_compute_aggregation_type.go delete mode 100644 api/v2/datadog/model_logs_metric_create_attributes.go delete mode 100644 api/v2/datadog/model_logs_metric_create_data.go delete mode 100644 api/v2/datadog/model_logs_metric_create_request.go delete mode 100644 api/v2/datadog/model_logs_metric_filter.go delete mode 100644 api/v2/datadog/model_logs_metric_group_by.go delete mode 100644 api/v2/datadog/model_logs_metric_response.go delete mode 100644 api/v2/datadog/model_logs_metric_response_attributes.go delete mode 100644 api/v2/datadog/model_logs_metric_response_compute.go delete mode 100644 api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go delete mode 100644 api/v2/datadog/model_logs_metric_response_data.go delete mode 100644 api/v2/datadog/model_logs_metric_response_filter.go delete mode 100644 api/v2/datadog/model_logs_metric_response_group_by.go delete mode 100644 api/v2/datadog/model_logs_metric_type.go delete mode 100644 api/v2/datadog/model_logs_metric_update_attributes.go delete mode 100644 api/v2/datadog/model_logs_metric_update_data.go delete mode 100644 api/v2/datadog/model_logs_metric_update_request.go delete mode 100644 api/v2/datadog/model_logs_metrics_response.go delete mode 100644 api/v2/datadog/model_logs_query_filter.go delete mode 100644 api/v2/datadog/model_logs_query_options.go delete mode 100644 api/v2/datadog/model_logs_response_metadata.go delete mode 100644 api/v2/datadog/model_logs_response_metadata_page.go delete mode 100644 api/v2/datadog/model_logs_sort.go delete mode 100644 api/v2/datadog/model_logs_sort_order.go delete mode 100644 api/v2/datadog/model_logs_warning.go delete mode 100644 api/v2/datadog/model_metric.go delete mode 100644 api/v2/datadog/model_metric_all_tags.go delete mode 100644 api/v2/datadog/model_metric_all_tags_attributes.go delete mode 100644 api/v2/datadog/model_metric_all_tags_response.go delete mode 100644 api/v2/datadog/model_metric_bulk_configure_tags_type.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_create.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_create_request.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_delete.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_delete_attributes.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_delete_request.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_response.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_status.go delete mode 100644 api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go delete mode 100644 api/v2/datadog/model_metric_content_encoding.go delete mode 100644 api/v2/datadog/model_metric_custom_aggregation.go delete mode 100644 api/v2/datadog/model_metric_custom_space_aggregation.go delete mode 100644 api/v2/datadog/model_metric_custom_time_aggregation.go delete mode 100644 api/v2/datadog/model_metric_distinct_volume.go delete mode 100644 api/v2/datadog/model_metric_distinct_volume_attributes.go delete mode 100644 api/v2/datadog/model_metric_distinct_volume_type.go delete mode 100644 api/v2/datadog/model_metric_estimate.go delete mode 100644 api/v2/datadog/model_metric_estimate_attributes.go delete mode 100644 api/v2/datadog/model_metric_estimate_resource_type.go delete mode 100644 api/v2/datadog/model_metric_estimate_response.go delete mode 100644 api/v2/datadog/model_metric_estimate_type.go delete mode 100644 api/v2/datadog/model_metric_ingested_indexed_volume.go delete mode 100644 api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go delete mode 100644 api/v2/datadog/model_metric_ingested_indexed_volume_type.go delete mode 100644 api/v2/datadog/model_metric_intake_type.go delete mode 100644 api/v2/datadog/model_metric_metadata.go delete mode 100644 api/v2/datadog/model_metric_origin.go delete mode 100644 api/v2/datadog/model_metric_payload.go delete mode 100644 api/v2/datadog/model_metric_point.go delete mode 100644 api/v2/datadog/model_metric_resource.go delete mode 100644 api/v2/datadog/model_metric_series.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_attributes.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_create_attributes.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_create_data.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_create_request.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_metric_types.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_response.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_type.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_update_attributes.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_update_data.go delete mode 100644 api/v2/datadog/model_metric_tag_configuration_update_request.go delete mode 100644 api/v2/datadog/model_metric_type.go delete mode 100644 api/v2/datadog/model_metric_volumes.go delete mode 100644 api/v2/datadog/model_metric_volumes_response.go delete mode 100644 api/v2/datadog/model_metrics_and_metric_tag_configurations.go delete mode 100644 api/v2/datadog/model_metrics_and_metric_tag_configurations_response.go delete mode 100644 api/v2/datadog/model_monitor_type.go delete mode 100644 api/v2/datadog/model_nullable_relationship_to_user.go delete mode 100644 api/v2/datadog/model_nullable_relationship_to_user_data.go delete mode 100644 api/v2/datadog/model_opsgenie_service_create_attributes.go delete mode 100644 api/v2/datadog/model_opsgenie_service_create_data.go delete mode 100644 api/v2/datadog/model_opsgenie_service_create_request.go delete mode 100644 api/v2/datadog/model_opsgenie_service_region_type.go delete mode 100644 api/v2/datadog/model_opsgenie_service_response.go delete mode 100644 api/v2/datadog/model_opsgenie_service_response_attributes.go delete mode 100644 api/v2/datadog/model_opsgenie_service_response_data.go delete mode 100644 api/v2/datadog/model_opsgenie_service_type.go delete mode 100644 api/v2/datadog/model_opsgenie_service_update_attributes.go delete mode 100644 api/v2/datadog/model_opsgenie_service_update_data.go delete mode 100644 api/v2/datadog/model_opsgenie_service_update_request.go delete mode 100644 api/v2/datadog/model_opsgenie_services_response.go delete mode 100644 api/v2/datadog/model_organization.go delete mode 100644 api/v2/datadog/model_organization_attributes.go delete mode 100644 api/v2/datadog/model_organizations_type.go delete mode 100644 api/v2/datadog/model_pagination.go delete mode 100644 api/v2/datadog/model_partial_api_key.go delete mode 100644 api/v2/datadog/model_partial_api_key_attributes.go delete mode 100644 api/v2/datadog/model_partial_application_key.go delete mode 100644 api/v2/datadog/model_partial_application_key_attributes.go delete mode 100644 api/v2/datadog/model_partial_application_key_response.go delete mode 100644 api/v2/datadog/model_permission.go delete mode 100644 api/v2/datadog/model_permission_attributes.go delete mode 100644 api/v2/datadog/model_permissions_response.go delete mode 100644 api/v2/datadog/model_permissions_type.go delete mode 100644 api/v2/datadog/model_process_summaries_meta.go delete mode 100644 api/v2/datadog/model_process_summaries_meta_page.go delete mode 100644 api/v2/datadog/model_process_summaries_response.go delete mode 100644 api/v2/datadog/model_process_summary.go delete mode 100644 api/v2/datadog/model_process_summary_attributes.go delete mode 100644 api/v2/datadog/model_process_summary_type.go delete mode 100644 api/v2/datadog/model_query_sort_order.go delete mode 100644 api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go delete mode 100644 api/v2/datadog/model_relationship_to_incident_integration_metadatas.go delete mode 100644 api/v2/datadog/model_relationship_to_incident_postmortem.go delete mode 100644 api/v2/datadog/model_relationship_to_incident_postmortem_data.go delete mode 100644 api/v2/datadog/model_relationship_to_organization.go delete mode 100644 api/v2/datadog/model_relationship_to_organization_data.go delete mode 100644 api/v2/datadog/model_relationship_to_organizations.go delete mode 100644 api/v2/datadog/model_relationship_to_permission.go delete mode 100644 api/v2/datadog/model_relationship_to_permission_data.go delete mode 100644 api/v2/datadog/model_relationship_to_permissions.go delete mode 100644 api/v2/datadog/model_relationship_to_role.go delete mode 100644 api/v2/datadog/model_relationship_to_role_data.go delete mode 100644 api/v2/datadog/model_relationship_to_roles.go delete mode 100644 api/v2/datadog/model_relationship_to_saml_assertion_attribute.go delete mode 100644 api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go delete mode 100644 api/v2/datadog/model_relationship_to_user.go delete mode 100644 api/v2/datadog/model_relationship_to_user_data.go delete mode 100644 api/v2/datadog/model_relationship_to_users.go delete mode 100644 api/v2/datadog/model_response_meta_attributes.go delete mode 100644 api/v2/datadog/model_role.go delete mode 100644 api/v2/datadog/model_role_attributes.go delete mode 100644 api/v2/datadog/model_role_clone.go delete mode 100644 api/v2/datadog/model_role_clone_attributes.go delete mode 100644 api/v2/datadog/model_role_clone_request.go delete mode 100644 api/v2/datadog/model_role_create_attributes.go delete mode 100644 api/v2/datadog/model_role_create_data.go delete mode 100644 api/v2/datadog/model_role_create_request.go delete mode 100644 api/v2/datadog/model_role_create_response.go delete mode 100644 api/v2/datadog/model_role_create_response_data.go delete mode 100644 api/v2/datadog/model_role_relationships.go delete mode 100644 api/v2/datadog/model_role_response.go delete mode 100644 api/v2/datadog/model_role_response_relationships.go delete mode 100644 api/v2/datadog/model_role_update_attributes.go delete mode 100644 api/v2/datadog/model_role_update_data.go delete mode 100644 api/v2/datadog/model_role_update_request.go delete mode 100644 api/v2/datadog/model_role_update_response.go delete mode 100644 api/v2/datadog/model_role_update_response_data.go delete mode 100644 api/v2/datadog/model_roles_response.go delete mode 100644 api/v2/datadog/model_roles_sort.go delete mode 100644 api/v2/datadog/model_roles_type.go delete mode 100644 api/v2/datadog/model_rum_aggregate_bucket_value.go delete mode 100644 api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go delete mode 100644 api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go delete mode 100644 api/v2/datadog/model_rum_aggregate_request.go delete mode 100644 api/v2/datadog/model_rum_aggregate_sort.go delete mode 100644 api/v2/datadog/model_rum_aggregate_sort_type.go delete mode 100644 api/v2/datadog/model_rum_aggregation_buckets_response.go delete mode 100644 api/v2/datadog/model_rum_aggregation_function.go delete mode 100644 api/v2/datadog/model_rum_analytics_aggregate_response.go delete mode 100644 api/v2/datadog/model_rum_bucket_response.go delete mode 100644 api/v2/datadog/model_rum_compute.go delete mode 100644 api/v2/datadog/model_rum_compute_type.go delete mode 100644 api/v2/datadog/model_rum_event.go delete mode 100644 api/v2/datadog/model_rum_event_attributes.go delete mode 100644 api/v2/datadog/model_rum_event_type.go delete mode 100644 api/v2/datadog/model_rum_events_response.go delete mode 100644 api/v2/datadog/model_rum_group_by.go delete mode 100644 api/v2/datadog/model_rum_group_by_histogram.go delete mode 100644 api/v2/datadog/model_rum_group_by_missing.go delete mode 100644 api/v2/datadog/model_rum_group_by_total.go delete mode 100644 api/v2/datadog/model_rum_query_filter.go delete mode 100644 api/v2/datadog/model_rum_query_options.go delete mode 100644 api/v2/datadog/model_rum_query_page_options.go delete mode 100644 api/v2/datadog/model_rum_response_links.go delete mode 100644 api/v2/datadog/model_rum_response_metadata.go delete mode 100644 api/v2/datadog/model_rum_response_page.go delete mode 100644 api/v2/datadog/model_rum_response_status.go delete mode 100644 api/v2/datadog/model_rum_search_events_request.go delete mode 100644 api/v2/datadog/model_rum_sort.go delete mode 100644 api/v2/datadog/model_rum_sort_order.go delete mode 100644 api/v2/datadog/model_rum_warning.go delete mode 100644 api/v2/datadog/model_saml_assertion_attribute.go delete mode 100644 api/v2/datadog/model_saml_assertion_attribute_attributes.go delete mode 100644 api/v2/datadog/model_saml_assertion_attributes_type.go delete mode 100644 api/v2/datadog/model_security_filter.go delete mode 100644 api/v2/datadog/model_security_filter_attributes.go delete mode 100644 api/v2/datadog/model_security_filter_create_attributes.go delete mode 100644 api/v2/datadog/model_security_filter_create_data.go delete mode 100644 api/v2/datadog/model_security_filter_create_request.go delete mode 100644 api/v2/datadog/model_security_filter_exclusion_filter.go delete mode 100644 api/v2/datadog/model_security_filter_exclusion_filter_response.go delete mode 100644 api/v2/datadog/model_security_filter_filtered_data_type.go delete mode 100644 api/v2/datadog/model_security_filter_meta.go delete mode 100644 api/v2/datadog/model_security_filter_response.go delete mode 100644 api/v2/datadog/model_security_filter_type.go delete mode 100644 api/v2/datadog/model_security_filter_update_attributes.go delete mode 100644 api/v2/datadog/model_security_filter_update_data.go delete mode 100644 api/v2/datadog/model_security_filter_update_request.go delete mode 100644 api/v2/datadog/model_security_filters_response.go delete mode 100644 api/v2/datadog/model_security_monitoring_filter.go delete mode 100644 api/v2/datadog/model_security_monitoring_filter_action.go delete mode 100644 api/v2/datadog/model_security_monitoring_list_rules_response.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_case.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_case_create.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_create_payload.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_detection_method.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_evaluation_window.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_keep_alive.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_options.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_query.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_query_aggregation.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_query_create.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_response.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_severity.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_type_create.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_type_read.go delete mode 100644 api/v2/datadog/model_security_monitoring_rule_update_payload.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_archive_reason.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_assignee_update_data.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_assignee_update_request.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_attributes.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_incidents_update_data.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_incidents_update_request.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_list_request.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_list_request_filter.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_list_request_page.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_state.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_state_update_data.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_state_update_request.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_triage_attributes.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_triage_update_data.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_triage_update_response.go delete mode 100644 api/v2/datadog/model_security_monitoring_signal_type.go delete mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response.go delete mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response_links.go delete mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response_meta.go delete mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go delete mode 100644 api/v2/datadog/model_security_monitoring_signals_sort.go delete mode 100644 api/v2/datadog/model_security_monitoring_triage_user.go delete mode 100644 api/v2/datadog/model_service_account_create_attributes.go delete mode 100644 api/v2/datadog/model_service_account_create_data.go delete mode 100644 api/v2/datadog/model_service_account_create_request.go delete mode 100644 api/v2/datadog/model_usage_application_security_monitoring_response.go delete mode 100644 api/v2/datadog/model_usage_attributes_object.go delete mode 100644 api/v2/datadog/model_usage_data_object.go delete mode 100644 api/v2/datadog/model_usage_lambda_traced_invocations_response.go delete mode 100644 api/v2/datadog/model_usage_observability_pipelines_response.go delete mode 100644 api/v2/datadog/model_usage_time_series_object.go delete mode 100644 api/v2/datadog/model_usage_time_series_type.go delete mode 100644 api/v2/datadog/model_user.go delete mode 100644 api/v2/datadog/model_user_attributes.go delete mode 100644 api/v2/datadog/model_user_create_attributes.go delete mode 100644 api/v2/datadog/model_user_create_data.go delete mode 100644 api/v2/datadog/model_user_create_request.go delete mode 100644 api/v2/datadog/model_user_invitation_data.go delete mode 100644 api/v2/datadog/model_user_invitation_data_attributes.go delete mode 100644 api/v2/datadog/model_user_invitation_relationships.go delete mode 100644 api/v2/datadog/model_user_invitation_response.go delete mode 100644 api/v2/datadog/model_user_invitation_response_data.go delete mode 100644 api/v2/datadog/model_user_invitations_request.go delete mode 100644 api/v2/datadog/model_user_invitations_response.go delete mode 100644 api/v2/datadog/model_user_invitations_type.go delete mode 100644 api/v2/datadog/model_user_relationships.go delete mode 100644 api/v2/datadog/model_user_response.go delete mode 100644 api/v2/datadog/model_user_response_included_item.go delete mode 100644 api/v2/datadog/model_user_response_relationships.go delete mode 100644 api/v2/datadog/model_user_update_attributes.go delete mode 100644 api/v2/datadog/model_user_update_data.go delete mode 100644 api/v2/datadog/model_user_update_request.go delete mode 100644 api/v2/datadog/model_users_response.go delete mode 100644 api/v2/datadog/model_users_type.go diff --git a/api/common/client.go b/api/common/client.go deleted file mode 100644 index 1779ca92192..00000000000 --- a/api/common/client.go +++ /dev/null @@ -1,492 +0,0 @@ -// 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 common - -import ( - "bytes" - "compress/gzip" - "compress/zlib" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - - "golang.org/x/oauth2" -) - -var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) -) - -// APIClient manages communication with the Datadog API V2 Collection API v1.0. -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - Cfg *Configuration -} - -// FormFile holds parameters for a file in multipart/form-data request. -type FormFile struct { - FormFileName string - FileName string - FileBytes []byte -} - -// Service holds APIClient -type Service struct { - Client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(cfg *Configuration) *APIClient { - if cfg.HTTPClient == nil { - cfg.HTTPClient = http.DefaultClient - } - - c := &APIClient{} - c.Cfg = cfg - - return c -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// contains is a case insensitive match, finding needle in a haystack. -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type.? -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -// ParameterToString convert interface{} parameters to string, using a delimiter if format is provided. -func ParameterToString(obj interface{}, collectionFormat string) string { - var delimiter string - - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } else if t, ok := obj.(time.Time); ok { - if t.Nanosecond() == 0 { - return t.Format("2006-01-02T15:04:05Z07:00") - } - return t.Format("2006-01-02T15:04:05.000Z07:00") - } - - return fmt.Sprintf("%v", obj) -} - -// helper for converting interface{} parameters to json strings. -func parameterToJson(obj interface{}) (string, error) { - jsonBuf, err := json.Marshal(obj) - if err != nil { - return "", err - } - return string(jsonBuf), err -} - -// CallAPI do the request. -func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error) { - if c.Cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) - if err != nil { - return nil, err - } - // Strip any api keys from the response being logged - keys, ok := request.Context().Value(ContextAPIKeys).(map[string]APIKey) - if keys != nil && ok { - for _, apiKey := range keys { - valueRegex := regexp.MustCompile(fmt.Sprintf("(?m)%s", apiKey.Key)) - dump = valueRegex.ReplaceAll(dump, []byte("REDACTED")) - } - } - log.Printf("\n%s\n", string(dump)) - } - - resp, err := c.Cfg.HTTPClient.Do(request) - if err != nil { - return resp, err - } - - if c.Cfg.Debug { - dump, err := httputil.DumpResponse(resp, true) - if err != nil { - return resp, err - } - log.Printf("\n%s\n", string(dump)) - } - return resp, err -} - -// GetConfig allows modification of underlying config for alternate implementations and testing. -// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior. -func (c *APIClient) GetConfig() *Configuration { - return c.Cfg -} - -// PrepareRequest build the request. -func (c *APIClient) PrepareRequest( - ctx context.Context, - path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams url.Values, - formFile *FormFile) (localVarRequest *http.Request, err error) { - - var body *bytes.Buffer - - // Detect postBody type and post. - if postBody != nil { - contentType := headerParams["Content-Type"] - if contentType == "" { - contentType = detectContentType(postBody) - headerParams["Content-Type"] = contentType - } - - body, err = setBody(postBody, contentType) - if err != nil { - return nil, err - } - } - - // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || formFile != nil { - if body != nil { - return nil, errors.New("cannot specify postBody and multipart form at the same time") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - if formFile != nil { - w.Boundary() - part, err := w.CreateFormFile(formFile.FormFileName, filepath.Base(formFile.FileName)) - if err != nil { - return nil, err - } - _, err = part.Write(formFile.FileBytes) - if err != nil { - return nil, err - } - } - - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("cannot specify postBody and x-www-form-urlencoded form at the same time") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Override request host, if applicable - if c.Cfg.Host != "" { - url.Host = c.Cfg.Host - } - - // Override request scheme, if applicable - if c.Cfg.Scheme != "" { - url.Scheme = c.Cfg.Scheme - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = query.Encode() - - // Generate a new request - if body != nil { - if headerParams["Content-Encoding"] == "gzip" { - var buf bytes.Buffer - compressor := gzip.NewWriter(&buf) - if _, err = compressor.Write(body.Bytes()); err != nil { - return nil, err - } - if err = compressor.Close(); err != nil { - return nil, err - } - body = &buf - - } else if headerParams["Content-Encoding"] == "deflate" { - var buf bytes.Buffer - compressor := zlib.NewWriter(&buf) - if _, err = compressor.Write(body.Bytes()); err != nil { - return nil, err - } - if err = compressor.Close(); err != nil { - return nil, err - } - body = &buf - } else if headerParams["Content-Encoding"] == "zstd1" { - body, err = compressZstd(body.Bytes()) - if err != nil { - return nil, err - } - } - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers.Set(h, v) - } - localVarRequest.Header = headers - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.Cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { - // We were able to grab an oauth2 token from the context - var latestToken *oauth2.Token - if latestToken, err = tok.Token(); err != nil { - return nil, err - } - - latestToken.SetAuthHeader(localVarRequest) - } - - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - } - - for header, value := range c.Cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } - - if !c.Cfg.Compress { - // gzip is on by default, so disable it by setting encoding to identity - localVarRequest.Header.Add("Accept-Encoding", "identity") - } - return localVarRequest, nil -} - -// Decode unmarshal bytes into an interface -func (c *APIClient) Decode(v interface{}, b []byte, contentType string) (err error) { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - if xmlCheck.MatchString(contentType) { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } - if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas - if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined - if err = unmarshalObj.UnmarshalJSON(b); err != nil { - return err - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model - return err - } - return nil -} - -// Add a file to the multipart request. -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// ReportError Prevent trying to import "fmt". -func ReportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -} - -// Set request body from an interface{}. -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if reflect.ValueOf(body).IsNil() { - return nil, nil - } - - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if fp, ok := body.(**os.File); ok { - _, err = bodyBuf.ReadFrom(*fp) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { - err = xml.NewEncoder(bodyBuf).Encode(body) - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - return nil, fmt.Errorf("invalid body type %s", contentType) - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header. -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// GenericOpenAPIError Provides access to the body, error and model on returned errors. -type GenericOpenAPIError struct { - ErrorBody []byte - ErrorMessage string - ErrorModel interface{} -} - -// Error returns non-empty string if there was an error. -func (e GenericOpenAPIError) Error() string { - return e.ErrorMessage -} - -// Body returns the raw bytes of the response. -func (e GenericOpenAPIError) Body() []byte { - return e.ErrorBody -} - -// Model returns the unpacked model of the error. -func (e GenericOpenAPIError) Model() interface{} { - return e.ErrorModel -} diff --git a/api/common/configuration.go b/api/common/configuration.go deleted file mode 100644 index 29885c0a1e4..00000000000 --- a/api/common/configuration.go +++ /dev/null @@ -1,582 +0,0 @@ -// 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 common - -import ( - "context" - "fmt" - "log" - "net/http" - "os" - "runtime" - "strings" - - client "github.com/DataDog/datadog-api-client-go/v2" -) - -// contextKeys are used to identify the type of value in the context. -// Since these are string, it is possible to get a short description of the -// context key for logging and debugging using key.String(). - -type contextKey string - -func (c contextKey) String() string { - return "auth " + string(c) -} - -var ( - // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. - ContextOAuth2 = contextKey("token") - - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - - // ContextAPIKeys takes a string apikey as authentication for the request - ContextAPIKeys = contextKey("apiKeys") - - // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. - ContextHttpSignatureAuth = contextKey("httpsignature") - - // ContextServerIndex uses a server configuration from the index. - ContextServerIndex = contextKey("serverIndex") - - // ContextOperationServerIndices uses a server configuration from the index mapping. - ContextOperationServerIndices = contextKey("serverOperationIndices") - - // ContextServerVariables overrides a server configuration variables. - ContextServerVariables = contextKey("serverVariables") - - // ContextOperationServerVariables overrides a server configuration variables using operation specific values. - ContextOperationServerVariables = contextKey("serverOperationVariables") -) - -// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth. -type BasicAuth struct { - UserName string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` -} - -// APIKey provides API key based authentication to a request passed via context using ContextAPIKey. -type APIKey struct { - Key string - Prefix string -} - -// ServerVariable stores the information about a server variable. -type ServerVariable struct { - Description string - DefaultValue string - EnumValues []string -} - -// ServerConfiguration stores the information about a server. -type ServerConfiguration struct { - URL string - Description string - Variables map[string]ServerVariable -} - -// ServerConfigurations stores multiple ServerConfiguration items. -type ServerConfigurations []ServerConfiguration - -// Configuration stores the configuration of the API client -type Configuration struct { - Host string `json:"host,omitempty"` - Scheme string `json:"scheme,omitempty"` - DefaultHeader map[string]string `json:"defaultHeader,omitempty"` - UserAgent string `json:"userAgent,omitempty"` - Debug bool `json:"debug,omitempty"` - Compress bool `json:"compress,omitempty"` - Servers ServerConfigurations - OperationServers map[string]ServerConfigurations - HTTPClient *http.Client - unstableOperations map[string]bool -} - -// NewConfiguration returns a new Configuration object. -func NewConfiguration() *Configuration { - cfg := &Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: getUserAgent(), - Debug: false, - Compress: true, - Servers: ServerConfigurations{ - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "The regional site for Datadog customers.", - DefaultValue: "datadoghq.com", - EnumValues: []string{ - "datadoghq.com", - "us3.datadoghq.com", - "us5.datadoghq.com", - "datadoghq.eu", - "ddog-gov.com", - }, - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "api", - }, - }, - }, - { - URL: "{protocol}://{name}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "name": { - Description: "Full site DNS name.", - DefaultValue: "api.datadoghq.com", - }, - "protocol": { - Description: "The protocol for accessing the API.", - DefaultValue: "https", - }, - }, - }, - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "Any Datadog deployment.", - DefaultValue: "datadoghq.com", - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "api", - }, - }, - }, - }, - OperationServers: map[string]ServerConfigurations{ - "v1.IPRangesApi.GetIPRanges": { - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "The regional site for Datadog customers.", - DefaultValue: "datadoghq.com", - EnumValues: []string{ - "datadoghq.com", - "us3.datadoghq.com", - "us5.datadoghq.com", - "datadoghq.eu", - "ddog-gov.com", - }, - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "ip-ranges", - }, - }, - }, - { - URL: "{protocol}://{name}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "name": { - Description: "Full site DNS name.", - DefaultValue: "ip-ranges.datadoghq.com", - }, - "protocol": { - Description: "The protocol for accessing the API.", - DefaultValue: "https", - }, - }, - }, - { - URL: "https://{subdomain}.datadoghq.com", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "ip-ranges", - }, - }, - }, - }, - "v1.ServiceLevelObjectivesApi.SearchSLO": { - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "The regional site for Datadog customers.", - DefaultValue: "datadoghq.com", - EnumValues: []string{ - "datadoghq.com", - "us3.datadoghq.com", - "us5.datadoghq.com", - "ddog-gov.com", - }, - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "api", - }, - }, - }, - { - URL: "{protocol}://{name}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "name": { - Description: "Full site DNS name.", - DefaultValue: "api.datadoghq.com", - }, - "protocol": { - Description: "The protocol for accessing the API.", - DefaultValue: "https", - }, - }, - }, - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "Any Datadog deployment.", - DefaultValue: "datadoghq.com", - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "api", - }, - }, - }, - }, - "v1.LogsApi.SubmitLog": { - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "The regional site for Datadog customers.", - DefaultValue: "datadoghq.com", - EnumValues: []string{ - "datadoghq.com", - "us3.datadoghq.com", - "us5.datadoghq.com", - "datadoghq.eu", - "ddog-gov.com", - }, - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "http-intake.logs", - }, - }, - }, - { - URL: "{protocol}://{name}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "name": { - Description: "Full site DNS name.", - DefaultValue: "http-intake.logs.datadoghq.com", - }, - "protocol": { - Description: "The protocol for accessing the API.", - DefaultValue: "https", - }, - }, - }, - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "Any Datadog deployment.", - DefaultValue: "datadoghq.com", - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "http-intake.logs", - }, - }, - }, - }, - "v2.LogsApi.SubmitLog": { - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "The regional site for customers.", - DefaultValue: "datadoghq.com", - EnumValues: []string{ - "datadoghq.com", - "us3.datadoghq.com", - "us5.datadoghq.com", - "datadoghq.eu", - "ddog-gov.com", - }, - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "http-intake.logs", - }, - }, - }, - { - URL: "{protocol}://{name}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "name": { - Description: "Full site DNS name.", - DefaultValue: "http-intake.logs.datadoghq.com", - }, - "protocol": { - Description: "The protocol for accessing the API.", - DefaultValue: "https", - }, - }, - }, - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "Any Datadog deployment.", - DefaultValue: "datadoghq.com", - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "http-intake.logs", - }, - }, - }, - }, - }, - unstableOperations: map[string]bool{ - "v1.GetDailyCustomReports": false, - "v1.GetMonthlyCustomReports": false, - "v1.GetSpecifiedDailyCustomReports": false, - "v1.GetSpecifiedMonthlyCustomReports": false, - "v1.GetUsageAttribution": false, - "v1.GetSLOHistory": false, - "v1.SearchSLO": false, - "v2.ListEvents": false, - "v2.SearchEvents": false, - "v2.CreateIncident": false, - "v2.DeleteIncident": false, - "v2.GetIncident": false, - "v2.ListIncidents": false, - "v2.UpdateIncident": false, - "v2.CreateIncidentService": false, - "v2.DeleteIncidentService": false, - "v2.GetIncidentService": false, - "v2.ListIncidentServices": false, - "v2.UpdateIncidentService": false, - "v2.CreateIncidentTeam": false, - "v2.DeleteIncidentTeam": false, - "v2.GetIncidentTeam": false, - "v2.ListIncidentTeams": false, - "v2.UpdateIncidentTeam": false, - "v2.GetEstimatedCostByOrg": false, - }, - } - return cfg -} - -// AddDefaultHeader adds a new HTTP header to the default header in the request. -func (c *Configuration) AddDefaultHeader(key string, value string) { - c.DefaultHeader[key] = value -} - -// URL formats template on a index using given variables. -func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { - if index < 0 || len(sc) <= index { - return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) - } - server := sc[index] - url := server.URL - - // go through variables and replace placeholders - for name, variable := range server.Variables { - if value, ok := variables[name]; ok { - found := bool(len(variable.EnumValues) == 0) - for _, enumValue := range variable.EnumValues { - if value == enumValue { - found = true - } - } - if !found { - return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) - } - url = strings.Replace(url, "{"+name+"}", value, -1) - } else { - url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) - } - } - return url, nil -} - -// ServerURL returns URL based on server settings. -func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { - return c.Servers.URL(index, variables) -} - -func getServerIndex(ctx context.Context) (int, error) { - si := ctx.Value(ContextServerIndex) - if si != nil { - if index, ok := si.(int); ok { - return index, nil - } - return 0, ReportError("invalid type %T should be int", si) - } - return 0, nil -} - -func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { - osi := ctx.Value(ContextOperationServerIndices) - if osi != nil { - operationIndices, ok := osi.(map[string]int) - if !ok { - return 0, ReportError("invalid type %T should be map[string]int", osi) - } - index, ok := operationIndices[endpoint] - if ok { - return index, nil - } - } - return getServerIndex(ctx) -} - -func getServerVariables(ctx context.Context) (map[string]string, error) { - sv := ctx.Value(ContextServerVariables) - if sv != nil { - if variables, ok := sv.(map[string]string); ok { - return variables, nil - } - return nil, ReportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) - } - return nil, nil -} - -func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { - osv := ctx.Value(ContextOperationServerVariables) - if osv != nil { - operationVariables, ok := osv.(map[string]map[string]string) - if !ok { - return nil, ReportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) - } - variables, ok := operationVariables[endpoint] - if ok { - return variables, nil - } - } - return getServerVariables(ctx) -} - -// ServerURLWithContext returns a new server URL given an endpoint. -func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { - sc, ok := c.OperationServers[endpoint] - if !ok { - sc = c.Servers - } - - if ctx == nil { - return sc.URL(0, nil) - } - - index, err := getServerOperationIndex(ctx, endpoint) - if err != nil { - return "", err - } - - variables, err := getServerOperationVariables(ctx, endpoint) - if err != nil { - return "", err - } - - return sc.URL(index, variables) -} - -// GetUnstableOperations returns a slice with all unstable operation Ids. -func (c *Configuration) GetUnstableOperations() []string { - ids := make([]string, len(c.unstableOperations)) - for id := range c.unstableOperations { - ids = append(ids, id) - } - return ids -} - -// SetUnstableOperationEnabled sets an unstable operation as enabled (true) or disabled (false). -// This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" -// Returns true if the operation is marked as unstable and thus was enabled/disabled, false otherwise. -func (c *Configuration) SetUnstableOperationEnabled(operation string, enabled bool) bool { - if _, ok := c.unstableOperations[operation]; ok { - c.unstableOperations[operation] = enabled - return true - } - log.Printf("WARNING: '%s' is not an unstable operation, can't enable/disable", operation) - return false -} - -// IsUnstableOperation determines whether an operation is an unstable operation. -// This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo". -func (c *Configuration) IsUnstableOperation(operation string) bool { - _, present := c.unstableOperations[operation] - return present -} - -// IsUnstableOperationEnabled determines whether an unstable operation is enabled. -// This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" -// Returns true if the operation is unstable and it is enabled, false otherwise. -func (c *Configuration) IsUnstableOperationEnabled(operation string) bool { - if enabled, present := c.unstableOperations[operation]; present { - return enabled - } - log.Printf("WARNING: '%s' is not an unstable operation, is always enabled", operation) - return false -} - -func getUserAgent() string { - return fmt.Sprintf( - "datadog-api-client-go/%s (go %s; os %s; arch %s)", - client.Version, - runtime.Version(), - runtime.GOOS, - runtime.GOARCH, - ) -} - -// NewDefaultContext returns a new context setup with environment variables. -func NewDefaultContext(ctx context.Context) context.Context { - if ctx == nil { - ctx = context.Background() - } - - if site, ok := os.LookupEnv("DD_SITE"); ok { - ctx = context.WithValue( - ctx, - ContextServerVariables, - map[string]string{"site": site}, - ) - } - - keys := make(map[string]APIKey) - if apiKey, ok := os.LookupEnv("DD_API_KEY"); ok { - keys["apiKeyAuth"] = APIKey{Key: apiKey} - } - if apiKey, ok := os.LookupEnv("DD_APP_KEY"); ok { - keys["appKeyAuth"] = APIKey{Key: apiKey} - } - ctx = context.WithValue( - ctx, - ContextAPIKeys, - keys, - ) - - return ctx -} diff --git a/api/common/no_zstd.go b/api/common/no_zstd.go deleted file mode 100644 index 12da6f8c4af..00000000000 --- a/api/common/no_zstd.go +++ /dev/null @@ -1,16 +0,0 @@ -// 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. - -//go:build !cgo - -package common - -import ( - "bytes" - "errors" -) - -func compressZstd(body []byte) (*bytes.Buffer, error) { - return nil, errors.New("zstd not supported") -} diff --git a/api/common/utils.go b/api/common/utils.go deleted file mode 100644 index 9702b528730..00000000000 --- a/api/common/utils.go +++ /dev/null @@ -1,437 +0,0 @@ -// 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 common - -import ( - "encoding/json" - "reflect" - "strings" - "time" -) - -// PtrBool is a helper routine that returns a pointer to given boolean value. -func PtrBool(v bool) *bool { return &v } - -// PtrInt is a helper routine that returns a pointer to given integer value. -func PtrInt(v int) *int { return &v } - -// PtrInt32 is a helper routine that returns a pointer to given integer value. -func PtrInt32(v int32) *int32 { return &v } - -// PtrInt64 is a helper routine that returns a pointer to given integer value. -func PtrInt64(v int64) *int64 { return &v } - -// PtrFloat32 is a helper routine that returns a pointer to given float value. -func PtrFloat32(v float32) *float32 { return &v } - -// PtrFloat64 is a helper routine that returns a pointer to given float value. -func PtrFloat64(v float64) *float64 { return &v } - -// PtrString is a helper routine that returns a pointer to given string value. -func PtrString(v string) *string { return &v } - -// PtrTime is helper routine that returns a pointer to given Time value. -func PtrTime(v time.Time) *time.Time { return &v } - -// NullableBool is a struct to hold a nullable boolean value. -type NullableBool struct { - value *bool - isSet bool -} - -// Get returns the value associated with the nullable bool. -func (v NullableBool) Get() *bool { - return v.value -} - -// Set sets the value associated with the nullable bool. -func (v *NullableBool) Set(val *bool) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableBool) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable bool. -func (v *NullableBool) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableBool instantiates a new nullable bool. -func NewNullableBool(val *bool) *NullableBool { - return &NullableBool{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableBool) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableBool) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// NullableInt is a struct to hold a nullable int value. -type NullableInt struct { - value *int - isSet bool -} - -// Get returns the value associated with the nullable int. -func (v NullableInt) Get() *int { - return v.value -} - -// Set sets the value associated with the nullable int. -func (v *NullableInt) Set(val *int) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableInt) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable int. -func (v *NullableInt) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableInt instantiates a new nullable int. -func NewNullableInt(val *int) *NullableInt { - return &NullableInt{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableInt) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableInt) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// NullableInt32 is a struct to hold a nullable int32 value. -type NullableInt32 struct { - value *int32 - isSet bool -} - -// Get returns the value associated with the nullable int32. -func (v NullableInt32) Get() *int32 { - return v.value -} - -// Set sets the value associated with the nullable int32. -func (v *NullableInt32) Set(val *int32) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableInt32) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable int32. -func (v *NullableInt32) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableInt32 instantiates a new nullable int32. -func NewNullableInt32(val *int32) *NullableInt32 { - return &NullableInt32{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableInt32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableInt32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// NullableInt64 is a struct to hold a nullable int64 value. -type NullableInt64 struct { - value *int64 - isSet bool -} - -// Get returns the value associated with the nullable int64. -func (v NullableInt64) Get() *int64 { - return v.value -} - -// Set sets the value associated with the nullable int64. -func (v *NullableInt64) Set(val *int64) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableInt64) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable int64. -func (v *NullableInt64) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableInt64 instantiates a new nullable int64. -func NewNullableInt64(val *int64) *NullableInt64 { - return &NullableInt64{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableInt64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableInt64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// NullableFloat32 is a struct to hold a nullable float32 value. -type NullableFloat32 struct { - value *float32 - isSet bool -} - -// Get returns the value associated with the nullable float32. -func (v NullableFloat32) Get() *float32 { - return v.value -} - -// Set sets the value associated with the nullable float32. -func (v *NullableFloat32) Set(val *float32) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableFloat32) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable float32. -func (v *NullableFloat32) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFloat32 instantiates a new nullable float32. -func NewNullableFloat32(val *float32) *NullableFloat32 { - return &NullableFloat32{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFloat32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableFloat32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// NullableFloat64 is a struct to hold a nullable float64 value. -type NullableFloat64 struct { - value *float64 - isSet bool -} - -// Get returns the value associated with the nullable float64. -func (v NullableFloat64) Get() *float64 { - return v.value -} - -// Set sets the value associated with the nullable float64. -func (v *NullableFloat64) Set(val *float64) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableFloat64) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable float64. -func (v *NullableFloat64) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFloat64 instantiates a new nullable float64. -func NewNullableFloat64(val *float64) *NullableFloat64 { - return &NullableFloat64{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFloat64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableFloat64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// NullableString is a struct to hold a nullable string value. -type NullableString struct { - value *string - isSet bool -} - -// Get returns the value associated with the nullable string. -func (v NullableString) Get() *string { - return v.value -} - -// Set sets the value associated with the nullable string. -func (v *NullableString) Set(val *string) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableString) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable string. -func (v *NullableString) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableString instantiates a new nullable string. -func NewNullableString(val *string) *NullableString { - return &NullableString{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableString) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableString) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// NullableTime is a struct to hold a nullable Time value. -type NullableTime struct { - value *time.Time - isSet bool -} - -// Get returns the value associated with the nullable Time. -func (v NullableTime) Get() *time.Time { - return v.value -} - -// Set sets the value associated with the nullable Time. -func (v *NullableTime) Set(val *time.Time) { - v.value = val - v.isSet = true -} - -// IsSet returns true if the value has been set. -func (v NullableTime) IsSet() bool { - return v.isSet -} - -// Unset resets fields of the nullable Time. -func (v *NullableTime) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTime instantiates a new nullable Time. -func NewNullableTime(val *time.Time) *NullableTime { - return &NullableTime{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTime) MarshalJSON() ([]byte, error) { - return v.value.MarshalJSON() -} - -// UnmarshalJSON deserializes to the associated value. -func (v *NullableTime) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// ContainsUnparsedObject returns true if the given data contains an unparsed object from the API. -func ContainsUnparsedObject(i interface{}) (bool, interface{}) { - v := reflect.ValueOf(i) - switch v.Kind() { - case reflect.Array, reflect.Slice: - for i := 0; i < v.Len(); i++ { - if n, m := ContainsUnparsedObject(v.Index(i).Interface()); n { - return n, m - } - } - case reflect.Map: - for _, k := range v.MapKeys() { - if n, m := ContainsUnparsedObject(v.MapIndex(k).Interface()); n { - return n, m - } - } - case reflect.Struct: - if u := v.FieldByName("UnparsedObject"); u.IsValid() && !u.IsNil() { - return true, u.Interface() - } - for i := 0; i < v.NumField(); i++ { - if fn := v.Type().Field(i).Name; string(fn[0]) == strings.ToUpper(string(fn[0])) && fn != "UnparsedObject" { - if n, m := ContainsUnparsedObject(v.Field(i).Interface()); n { - return n, m - } - } else if fn == "value" { // Special case for Nullables - if get := v.MethodByName("Get"); get.IsValid() { - if n, m := ContainsUnparsedObject(get.Call([]reflect.Value{})[0].Interface()); n { - return n, m - } - } - } - } - case reflect.Interface, reflect.Ptr: - if !v.IsNil() { - return ContainsUnparsedObject(v.Elem().Interface()) - } - default: - if v.IsValid() { - if m := v.MethodByName("IsValid"); m.IsValid() { - if !m.Call([]reflect.Value{})[0].Bool() { - return true, v.Interface() - } - } - } - } - return false, nil -} diff --git a/api/common/zstd.go b/api/common/zstd.go deleted file mode 100644 index f1b9043d623..00000000000 --- a/api/common/zstd.go +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -//go:build cgo - -package common - -import ( - "bytes" - - "github.com/DataDog/zstd" -) - -func compressZstd(body []byte) (*bytes.Buffer, error) { - var buf bytes.Buffer - compressor := zstd.NewWriter(&buf) - if _, err := compressor.Write(body); err != nil { - return nil, err - } - if err := compressor.Close(); err != nil { - return nil, err - } - return &buf, nil -} diff --git a/api/v1/datadog/api_authentication.go b/api/v1/datadog/api_authentication.go deleted file mode 100644 index 8f721409ecd..00000000000 --- a/api/v1/datadog/api_authentication.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// AuthenticationApi service type -type AuthenticationApi common.Service - -type apiValidateRequest struct { - ctx _context.Context -} - -func (a *AuthenticationApi) buildValidateRequest(ctx _context.Context) (apiValidateRequest, error) { - req := apiValidateRequest{ - ctx: ctx, - } - return req, nil -} - -// Validate Validate API key. -// Check if the API key (not the APP key) is valid. If invalid, a 403 is returned. -func (a *AuthenticationApi) Validate(ctx _context.Context) (AuthenticationValidationResponse, *_nethttp.Response, error) { - req, err := a.buildValidateRequest(ctx) - if err != nil { - var localVarReturnValue AuthenticationValidationResponse - return localVarReturnValue, nil, err - } - - return a.validateExecute(req) -} - -// validateExecute executes the request. -func (a *AuthenticationApi) validateExecute(r apiValidateRequest) (AuthenticationValidationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue AuthenticationValidationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AuthenticationApi.Validate") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/validate" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewAuthenticationApi Returns NewAuthenticationApi. -func NewAuthenticationApi(client *common.APIClient) *AuthenticationApi { - return &AuthenticationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_aws_integration.go b/api/v1/datadog/api_aws_integration.go deleted file mode 100644 index 79847ee3fd0..00000000000 --- a/api/v1/datadog/api_aws_integration.go +++ /dev/null @@ -1,1412 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// AWSIntegrationApi service type -type AWSIntegrationApi common.Service - -type apiCreateAWSAccountRequest struct { - ctx _context.Context - body *AWSAccount -} - -func (a *AWSIntegrationApi) buildCreateAWSAccountRequest(ctx _context.Context, body AWSAccount) (apiCreateAWSAccountRequest, error) { - req := apiCreateAWSAccountRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateAWSAccount Create an AWS integration. -// Create a Datadog-Amazon Web Services integration. -// Using the `POST` method updates your integration configuration -// by adding your new configuration to the existing one in your Datadog organization. -// A unique AWS Account ID for role based authentication. -func (a *AWSIntegrationApi) CreateAWSAccount(ctx _context.Context, body AWSAccount) (AWSAccountCreateResponse, *_nethttp.Response, error) { - req, err := a.buildCreateAWSAccountRequest(ctx, body) - if err != nil { - var localVarReturnValue AWSAccountCreateResponse - return localVarReturnValue, nil, err - } - - return a.createAWSAccountExecute(req) -} - -// createAWSAccountExecute executes the request. -func (a *AWSIntegrationApi) createAWSAccountExecute(r apiCreateAWSAccountRequest) (AWSAccountCreateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue AWSAccountCreateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.CreateAWSAccount") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateAWSTagFilterRequest struct { - ctx _context.Context - body *AWSTagFilterCreateRequest -} - -func (a *AWSIntegrationApi) buildCreateAWSTagFilterRequest(ctx _context.Context, body AWSTagFilterCreateRequest) (apiCreateAWSTagFilterRequest, error) { - req := apiCreateAWSTagFilterRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateAWSTagFilter Set an AWS tag filter. -// Set an AWS tag filter. -func (a *AWSIntegrationApi) CreateAWSTagFilter(ctx _context.Context, body AWSTagFilterCreateRequest) (interface{}, *_nethttp.Response, error) { - req, err := a.buildCreateAWSTagFilterRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.createAWSTagFilterExecute(req) -} - -// createAWSTagFilterExecute executes the request. -func (a *AWSIntegrationApi) createAWSTagFilterExecute(r apiCreateAWSTagFilterRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.CreateAWSTagFilter") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/filtering" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateNewAWSExternalIDRequest struct { - ctx _context.Context - body *AWSAccount -} - -func (a *AWSIntegrationApi) buildCreateNewAWSExternalIDRequest(ctx _context.Context, body AWSAccount) (apiCreateNewAWSExternalIDRequest, error) { - req := apiCreateNewAWSExternalIDRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateNewAWSExternalID Generate a new external ID. -// Generate a new AWS external ID for a given AWS account ID and role name pair. -func (a *AWSIntegrationApi) CreateNewAWSExternalID(ctx _context.Context, body AWSAccount) (AWSAccountCreateResponse, *_nethttp.Response, error) { - req, err := a.buildCreateNewAWSExternalIDRequest(ctx, body) - if err != nil { - var localVarReturnValue AWSAccountCreateResponse - return localVarReturnValue, nil, err - } - - return a.createNewAWSExternalIDExecute(req) -} - -// createNewAWSExternalIDExecute executes the request. -func (a *AWSIntegrationApi) createNewAWSExternalIDExecute(r apiCreateNewAWSExternalIDRequest) (AWSAccountCreateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue AWSAccountCreateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.CreateNewAWSExternalID") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/generate_new_external_id" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteAWSAccountRequest struct { - ctx _context.Context - body *AWSAccountDeleteRequest -} - -func (a *AWSIntegrationApi) buildDeleteAWSAccountRequest(ctx _context.Context, body AWSAccountDeleteRequest) (apiDeleteAWSAccountRequest, error) { - req := apiDeleteAWSAccountRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteAWSAccount Delete an AWS integration. -// Delete a Datadog-AWS integration matching the specified `account_id` and `role_name parameters`. -func (a *AWSIntegrationApi) DeleteAWSAccount(ctx _context.Context, body AWSAccountDeleteRequest) (interface{}, *_nethttp.Response, error) { - req, err := a.buildDeleteAWSAccountRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.deleteAWSAccountExecute(req) -} - -// deleteAWSAccountExecute executes the request. -func (a *AWSIntegrationApi) deleteAWSAccountExecute(r apiDeleteAWSAccountRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.DeleteAWSAccount") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteAWSTagFilterRequest struct { - ctx _context.Context - body *AWSTagFilterDeleteRequest -} - -func (a *AWSIntegrationApi) buildDeleteAWSTagFilterRequest(ctx _context.Context, body AWSTagFilterDeleteRequest) (apiDeleteAWSTagFilterRequest, error) { - req := apiDeleteAWSTagFilterRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteAWSTagFilter Delete a tag filtering entry. -// Delete a tag filtering entry. -func (a *AWSIntegrationApi) DeleteAWSTagFilter(ctx _context.Context, body AWSTagFilterDeleteRequest) (interface{}, *_nethttp.Response, error) { - req, err := a.buildDeleteAWSTagFilterRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.deleteAWSTagFilterExecute(req) -} - -// deleteAWSTagFilterExecute executes the request. -func (a *AWSIntegrationApi) deleteAWSTagFilterExecute(r apiDeleteAWSTagFilterRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.DeleteAWSTagFilter") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/filtering" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAWSAccountsRequest struct { - ctx _context.Context - accountId *string - roleName *string - accessKeyId *string -} - -// ListAWSAccountsOptionalParameters holds optional parameters for ListAWSAccounts. -type ListAWSAccountsOptionalParameters struct { - AccountId *string - RoleName *string - AccessKeyId *string -} - -// NewListAWSAccountsOptionalParameters creates an empty struct for parameters. -func NewListAWSAccountsOptionalParameters() *ListAWSAccountsOptionalParameters { - this := ListAWSAccountsOptionalParameters{} - return &this -} - -// WithAccountId sets the corresponding parameter name and returns the struct. -func (r *ListAWSAccountsOptionalParameters) WithAccountId(accountId string) *ListAWSAccountsOptionalParameters { - r.AccountId = &accountId - return r -} - -// WithRoleName sets the corresponding parameter name and returns the struct. -func (r *ListAWSAccountsOptionalParameters) WithRoleName(roleName string) *ListAWSAccountsOptionalParameters { - r.RoleName = &roleName - return r -} - -// WithAccessKeyId sets the corresponding parameter name and returns the struct. -func (r *ListAWSAccountsOptionalParameters) WithAccessKeyId(accessKeyId string) *ListAWSAccountsOptionalParameters { - r.AccessKeyId = &accessKeyId - return r -} - -func (a *AWSIntegrationApi) buildListAWSAccountsRequest(ctx _context.Context, o ...ListAWSAccountsOptionalParameters) (apiListAWSAccountsRequest, error) { - req := apiListAWSAccountsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListAWSAccountsOptionalParameters is allowed") - } - - if o != nil { - req.accountId = o[0].AccountId - req.roleName = o[0].RoleName - req.accessKeyId = o[0].AccessKeyId - } - return req, nil -} - -// ListAWSAccounts List all AWS integrations. -// List all Datadog-AWS integrations available in your Datadog organization. -func (a *AWSIntegrationApi) ListAWSAccounts(ctx _context.Context, o ...ListAWSAccountsOptionalParameters) (AWSAccountListResponse, *_nethttp.Response, error) { - req, err := a.buildListAWSAccountsRequest(ctx, o...) - if err != nil { - var localVarReturnValue AWSAccountListResponse - return localVarReturnValue, nil, err - } - - return a.listAWSAccountsExecute(req) -} - -// listAWSAccountsExecute executes the request. -func (a *AWSIntegrationApi) listAWSAccountsExecute(r apiListAWSAccountsRequest) (AWSAccountListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue AWSAccountListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.ListAWSAccounts") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.accountId != nil { - localVarQueryParams.Add("account_id", common.ParameterToString(*r.accountId, "")) - } - if r.roleName != nil { - localVarQueryParams.Add("role_name", common.ParameterToString(*r.roleName, "")) - } - if r.accessKeyId != nil { - localVarQueryParams.Add("access_key_id", common.ParameterToString(*r.accessKeyId, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAWSTagFiltersRequest struct { - ctx _context.Context - accountId *string -} - -func (a *AWSIntegrationApi) buildListAWSTagFiltersRequest(ctx _context.Context, accountId string) (apiListAWSTagFiltersRequest, error) { - req := apiListAWSTagFiltersRequest{ - ctx: ctx, - accountId: &accountId, - } - return req, nil -} - -// ListAWSTagFilters Get all AWS tag filters. -// Get all AWS tag filters. -func (a *AWSIntegrationApi) ListAWSTagFilters(ctx _context.Context, accountId string) (AWSTagFilterListResponse, *_nethttp.Response, error) { - req, err := a.buildListAWSTagFiltersRequest(ctx, accountId) - if err != nil { - var localVarReturnValue AWSTagFilterListResponse - return localVarReturnValue, nil, err - } - - return a.listAWSTagFiltersExecute(req) -} - -// listAWSTagFiltersExecute executes the request. -func (a *AWSIntegrationApi) listAWSTagFiltersExecute(r apiListAWSTagFiltersRequest) (AWSTagFilterListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue AWSTagFilterListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.ListAWSTagFilters") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/filtering" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.accountId == nil { - return localVarReturnValue, nil, common.ReportError("accountId is required and must be specified") - } - localVarQueryParams.Add("account_id", common.ParameterToString(*r.accountId, "")) - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAvailableAWSNamespacesRequest struct { - ctx _context.Context -} - -func (a *AWSIntegrationApi) buildListAvailableAWSNamespacesRequest(ctx _context.Context) (apiListAvailableAWSNamespacesRequest, error) { - req := apiListAvailableAWSNamespacesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListAvailableAWSNamespaces List namespace rules. -// List all namespace rules for a given Datadog-AWS integration. This endpoint takes no arguments. -func (a *AWSIntegrationApi) ListAvailableAWSNamespaces(ctx _context.Context) ([]string, *_nethttp.Response, error) { - req, err := a.buildListAvailableAWSNamespacesRequest(ctx) - if err != nil { - var localVarReturnValue []string - return localVarReturnValue, nil, err - } - - return a.listAvailableAWSNamespacesExecute(req) -} - -// listAvailableAWSNamespacesExecute executes the request. -func (a *AWSIntegrationApi) listAvailableAWSNamespacesExecute(r apiListAvailableAWSNamespacesRequest) ([]string, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []string - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.ListAvailableAWSNamespaces") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/available_namespace_rules" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateAWSAccountRequest struct { - ctx _context.Context - body *AWSAccount - accountId *string - roleName *string - accessKeyId *string -} - -// UpdateAWSAccountOptionalParameters holds optional parameters for UpdateAWSAccount. -type UpdateAWSAccountOptionalParameters struct { - AccountId *string - RoleName *string - AccessKeyId *string -} - -// NewUpdateAWSAccountOptionalParameters creates an empty struct for parameters. -func NewUpdateAWSAccountOptionalParameters() *UpdateAWSAccountOptionalParameters { - this := UpdateAWSAccountOptionalParameters{} - return &this -} - -// WithAccountId sets the corresponding parameter name and returns the struct. -func (r *UpdateAWSAccountOptionalParameters) WithAccountId(accountId string) *UpdateAWSAccountOptionalParameters { - r.AccountId = &accountId - return r -} - -// WithRoleName sets the corresponding parameter name and returns the struct. -func (r *UpdateAWSAccountOptionalParameters) WithRoleName(roleName string) *UpdateAWSAccountOptionalParameters { - r.RoleName = &roleName - return r -} - -// WithAccessKeyId sets the corresponding parameter name and returns the struct. -func (r *UpdateAWSAccountOptionalParameters) WithAccessKeyId(accessKeyId string) *UpdateAWSAccountOptionalParameters { - r.AccessKeyId = &accessKeyId - return r -} - -func (a *AWSIntegrationApi) buildUpdateAWSAccountRequest(ctx _context.Context, body AWSAccount, o ...UpdateAWSAccountOptionalParameters) (apiUpdateAWSAccountRequest, error) { - req := apiUpdateAWSAccountRequest{ - ctx: ctx, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type UpdateAWSAccountOptionalParameters is allowed") - } - - if o != nil { - req.accountId = o[0].AccountId - req.roleName = o[0].RoleName - req.accessKeyId = o[0].AccessKeyId - } - return req, nil -} - -// UpdateAWSAccount Update an AWS integration. -// Update a Datadog-Amazon Web Services integration. -func (a *AWSIntegrationApi) UpdateAWSAccount(ctx _context.Context, body AWSAccount, o ...UpdateAWSAccountOptionalParameters) (interface{}, *_nethttp.Response, error) { - req, err := a.buildUpdateAWSAccountRequest(ctx, body, o...) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.updateAWSAccountExecute(req) -} - -// updateAWSAccountExecute executes the request. -func (a *AWSIntegrationApi) updateAWSAccountExecute(r apiUpdateAWSAccountRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.UpdateAWSAccount") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - if r.accountId != nil { - localVarQueryParams.Add("account_id", common.ParameterToString(*r.accountId, "")) - } - if r.roleName != nil { - localVarQueryParams.Add("role_name", common.ParameterToString(*r.roleName, "")) - } - if r.accessKeyId != nil { - localVarQueryParams.Add("access_key_id", common.ParameterToString(*r.accessKeyId, "")) - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewAWSIntegrationApi Returns NewAWSIntegrationApi. -func NewAWSIntegrationApi(client *common.APIClient) *AWSIntegrationApi { - return &AWSIntegrationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_aws_logs_integration.go b/api/v1/datadog/api_aws_logs_integration.go deleted file mode 100644 index 26c700f1ea7..00000000000 --- a/api/v1/datadog/api_aws_logs_integration.go +++ /dev/null @@ -1,1010 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// AWSLogsIntegrationApi service type -type AWSLogsIntegrationApi common.Service - -type apiCheckAWSLogsLambdaAsyncRequest struct { - ctx _context.Context - body *AWSAccountAndLambdaRequest -} - -func (a *AWSLogsIntegrationApi) buildCheckAWSLogsLambdaAsyncRequest(ctx _context.Context, body AWSAccountAndLambdaRequest) (apiCheckAWSLogsLambdaAsyncRequest, error) { - req := apiCheckAWSLogsLambdaAsyncRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CheckAWSLogsLambdaAsync Check that an AWS Lambda Function exists. -// Test if permissions are present to add a log-forwarding triggers for the given services and AWS account. The input -// is the same as for Enable an AWS service log collection. Subsequent requests will always repeat the above, so this -// endpoint can be polled intermittently instead of blocking. -// -// - Returns a status of 'created' when it's checking if the Lambda exists in the account. -// - Returns a status of 'waiting' while checking. -// - Returns a status of 'checked and ok' if the Lambda exists. -// - Returns a status of 'error' if the Lambda does not exist. -func (a *AWSLogsIntegrationApi) CheckAWSLogsLambdaAsync(ctx _context.Context, body AWSAccountAndLambdaRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { - req, err := a.buildCheckAWSLogsLambdaAsyncRequest(ctx, body) - if err != nil { - var localVarReturnValue AWSLogsAsyncResponse - return localVarReturnValue, nil, err - } - - return a.checkAWSLogsLambdaAsyncExecute(req) -} - -// checkAWSLogsLambdaAsyncExecute executes the request. -func (a *AWSLogsIntegrationApi) checkAWSLogsLambdaAsyncExecute(r apiCheckAWSLogsLambdaAsyncRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue AWSLogsAsyncResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.CheckAWSLogsLambdaAsync") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/logs/check_async" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCheckAWSLogsServicesAsyncRequest struct { - ctx _context.Context - body *AWSLogsServicesRequest -} - -func (a *AWSLogsIntegrationApi) buildCheckAWSLogsServicesAsyncRequest(ctx _context.Context, body AWSLogsServicesRequest) (apiCheckAWSLogsServicesAsyncRequest, error) { - req := apiCheckAWSLogsServicesAsyncRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CheckAWSLogsServicesAsync Check permissions for log services. -// Test if permissions are present to add log-forwarding triggers for the -// given services and AWS account. Input is the same as for `EnableAWSLogServices`. -// Done async, so can be repeatedly polled in a non-blocking fashion until -// the async request completes. -// -// - Returns a status of `created` when it's checking if the permissions exists -// in the AWS account. -// - Returns a status of `waiting` while checking. -// - Returns a status of `checked and ok` if the Lambda exists. -// - Returns a status of `error` if the Lambda does not exist. -func (a *AWSLogsIntegrationApi) CheckAWSLogsServicesAsync(ctx _context.Context, body AWSLogsServicesRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { - req, err := a.buildCheckAWSLogsServicesAsyncRequest(ctx, body) - if err != nil { - var localVarReturnValue AWSLogsAsyncResponse - return localVarReturnValue, nil, err - } - - return a.checkAWSLogsServicesAsyncExecute(req) -} - -// checkAWSLogsServicesAsyncExecute executes the request. -func (a *AWSLogsIntegrationApi) checkAWSLogsServicesAsyncExecute(r apiCheckAWSLogsServicesAsyncRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue AWSLogsAsyncResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.CheckAWSLogsServicesAsync") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/logs/services_async" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateAWSLambdaARNRequest struct { - ctx _context.Context - body *AWSAccountAndLambdaRequest -} - -func (a *AWSLogsIntegrationApi) buildCreateAWSLambdaARNRequest(ctx _context.Context, body AWSAccountAndLambdaRequest) (apiCreateAWSLambdaARNRequest, error) { - req := apiCreateAWSLambdaARNRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateAWSLambdaARN Add AWS Log Lambda ARN. -// Attach the Lambda ARN of the Lambda created for the Datadog-AWS log collection to your AWS account ID to enable log collection. -func (a *AWSLogsIntegrationApi) CreateAWSLambdaARN(ctx _context.Context, body AWSAccountAndLambdaRequest) (interface{}, *_nethttp.Response, error) { - req, err := a.buildCreateAWSLambdaARNRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.createAWSLambdaARNExecute(req) -} - -// createAWSLambdaARNExecute executes the request. -func (a *AWSLogsIntegrationApi) createAWSLambdaARNExecute(r apiCreateAWSLambdaARNRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.CreateAWSLambdaARN") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/logs" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteAWSLambdaARNRequest struct { - ctx _context.Context - body *AWSAccountAndLambdaRequest -} - -func (a *AWSLogsIntegrationApi) buildDeleteAWSLambdaARNRequest(ctx _context.Context, body AWSAccountAndLambdaRequest) (apiDeleteAWSLambdaARNRequest, error) { - req := apiDeleteAWSLambdaARNRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteAWSLambdaARN Delete an AWS Logs integration. -// Delete a Datadog-AWS logs configuration by removing the specific Lambda ARN associated with a given AWS account. -func (a *AWSLogsIntegrationApi) DeleteAWSLambdaARN(ctx _context.Context, body AWSAccountAndLambdaRequest) (interface{}, *_nethttp.Response, error) { - req, err := a.buildDeleteAWSLambdaARNRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.deleteAWSLambdaARNExecute(req) -} - -// deleteAWSLambdaARNExecute executes the request. -func (a *AWSLogsIntegrationApi) deleteAWSLambdaARNExecute(r apiDeleteAWSLambdaARNRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.DeleteAWSLambdaARN") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/logs" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiEnableAWSLogServicesRequest struct { - ctx _context.Context - body *AWSLogsServicesRequest -} - -func (a *AWSLogsIntegrationApi) buildEnableAWSLogServicesRequest(ctx _context.Context, body AWSLogsServicesRequest) (apiEnableAWSLogServicesRequest, error) { - req := apiEnableAWSLogServicesRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// EnableAWSLogServices Enable an AWS Logs integration. -// Enable automatic log collection for a list of services. This should be run after running `CreateAWSLambdaARN` to save the configuration. -func (a *AWSLogsIntegrationApi) EnableAWSLogServices(ctx _context.Context, body AWSLogsServicesRequest) (interface{}, *_nethttp.Response, error) { - req, err := a.buildEnableAWSLogServicesRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.enableAWSLogServicesExecute(req) -} - -// enableAWSLogServicesExecute executes the request. -func (a *AWSLogsIntegrationApi) enableAWSLogServicesExecute(r apiEnableAWSLogServicesRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.EnableAWSLogServices") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/logs/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAWSLogsIntegrationsRequest struct { - ctx _context.Context -} - -func (a *AWSLogsIntegrationApi) buildListAWSLogsIntegrationsRequest(ctx _context.Context) (apiListAWSLogsIntegrationsRequest, error) { - req := apiListAWSLogsIntegrationsRequest{ - ctx: ctx, - } - return req, nil -} - -// ListAWSLogsIntegrations List all AWS Logs integrations. -// List all Datadog-AWS Logs integrations configured in your Datadog account. -func (a *AWSLogsIntegrationApi) ListAWSLogsIntegrations(ctx _context.Context) ([]AWSLogsListResponse, *_nethttp.Response, error) { - req, err := a.buildListAWSLogsIntegrationsRequest(ctx) - if err != nil { - var localVarReturnValue []AWSLogsListResponse - return localVarReturnValue, nil, err - } - - return a.listAWSLogsIntegrationsExecute(req) -} - -// listAWSLogsIntegrationsExecute executes the request. -func (a *AWSLogsIntegrationApi) listAWSLogsIntegrationsExecute(r apiListAWSLogsIntegrationsRequest) ([]AWSLogsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []AWSLogsListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.ListAWSLogsIntegrations") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/logs" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAWSLogsServicesRequest struct { - ctx _context.Context -} - -func (a *AWSLogsIntegrationApi) buildListAWSLogsServicesRequest(ctx _context.Context) (apiListAWSLogsServicesRequest, error) { - req := apiListAWSLogsServicesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListAWSLogsServices Get list of AWS log ready services. -// Get the list of current AWS services that Datadog offers automatic log collection. Use returned service IDs with the services parameter for the Enable an AWS service log collection API endpoint. -func (a *AWSLogsIntegrationApi) ListAWSLogsServices(ctx _context.Context) ([]AWSLogsListServicesResponse, *_nethttp.Response, error) { - req, err := a.buildListAWSLogsServicesRequest(ctx) - if err != nil { - var localVarReturnValue []AWSLogsListServicesResponse - return localVarReturnValue, nil, err - } - - return a.listAWSLogsServicesExecute(req) -} - -// listAWSLogsServicesExecute executes the request. -func (a *AWSLogsIntegrationApi) listAWSLogsServicesExecute(r apiListAWSLogsServicesRequest) ([]AWSLogsListServicesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []AWSLogsListServicesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.ListAWSLogsServices") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/aws/logs/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewAWSLogsIntegrationApi Returns NewAWSLogsIntegrationApi. -func NewAWSLogsIntegrationApi(client *common.APIClient) *AWSLogsIntegrationApi { - return &AWSLogsIntegrationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_azure_integration.go b/api/v1/datadog/api_azure_integration.go deleted file mode 100644 index d34a5ad69df..00000000000 --- a/api/v1/datadog/api_azure_integration.go +++ /dev/null @@ -1,735 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// AzureIntegrationApi service type -type AzureIntegrationApi common.Service - -type apiCreateAzureIntegrationRequest struct { - ctx _context.Context - body *AzureAccount -} - -func (a *AzureIntegrationApi) buildCreateAzureIntegrationRequest(ctx _context.Context, body AzureAccount) (apiCreateAzureIntegrationRequest, error) { - req := apiCreateAzureIntegrationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateAzureIntegration Create an Azure integration. -// Create a Datadog-Azure integration. -// -// Using the `POST` method updates your integration configuration by adding your new -// configuration to the existing one in your Datadog organization. -// -// Using the `PUT` method updates your integration configuration by replacing your -// current configuration with the new one sent to your Datadog organization. -func (a *AzureIntegrationApi) CreateAzureIntegration(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { - req, err := a.buildCreateAzureIntegrationRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.createAzureIntegrationExecute(req) -} - -// createAzureIntegrationExecute executes the request. -func (a *AzureIntegrationApi) createAzureIntegrationExecute(r apiCreateAzureIntegrationRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.CreateAzureIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/azure" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteAzureIntegrationRequest struct { - ctx _context.Context - body *AzureAccount -} - -func (a *AzureIntegrationApi) buildDeleteAzureIntegrationRequest(ctx _context.Context, body AzureAccount) (apiDeleteAzureIntegrationRequest, error) { - req := apiDeleteAzureIntegrationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteAzureIntegration Delete an Azure integration. -// Delete a given Datadog-Azure integration from your Datadog account. -func (a *AzureIntegrationApi) DeleteAzureIntegration(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { - req, err := a.buildDeleteAzureIntegrationRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.deleteAzureIntegrationExecute(req) -} - -// deleteAzureIntegrationExecute executes the request. -func (a *AzureIntegrationApi) deleteAzureIntegrationExecute(r apiDeleteAzureIntegrationRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.DeleteAzureIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/azure" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAzureIntegrationRequest struct { - ctx _context.Context -} - -func (a *AzureIntegrationApi) buildListAzureIntegrationRequest(ctx _context.Context) (apiListAzureIntegrationRequest, error) { - req := apiListAzureIntegrationRequest{ - ctx: ctx, - } - return req, nil -} - -// ListAzureIntegration List all Azure integrations. -// List all Datadog-Azure integrations configured in your Datadog account. -func (a *AzureIntegrationApi) ListAzureIntegration(ctx _context.Context) ([]AzureAccount, *_nethttp.Response, error) { - req, err := a.buildListAzureIntegrationRequest(ctx) - if err != nil { - var localVarReturnValue []AzureAccount - return localVarReturnValue, nil, err - } - - return a.listAzureIntegrationExecute(req) -} - -// listAzureIntegrationExecute executes the request. -func (a *AzureIntegrationApi) listAzureIntegrationExecute(r apiListAzureIntegrationRequest) ([]AzureAccount, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []AzureAccount - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.ListAzureIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/azure" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateAzureHostFiltersRequest struct { - ctx _context.Context - body *AzureAccount -} - -func (a *AzureIntegrationApi) buildUpdateAzureHostFiltersRequest(ctx _context.Context, body AzureAccount) (apiUpdateAzureHostFiltersRequest, error) { - req := apiUpdateAzureHostFiltersRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// UpdateAzureHostFilters Update Azure integration host filters. -// Update the defined list of host filters for a given Datadog-Azure integration. -func (a *AzureIntegrationApi) UpdateAzureHostFilters(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { - req, err := a.buildUpdateAzureHostFiltersRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.updateAzureHostFiltersExecute(req) -} - -// updateAzureHostFiltersExecute executes the request. -func (a *AzureIntegrationApi) updateAzureHostFiltersExecute(r apiUpdateAzureHostFiltersRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.UpdateAzureHostFilters") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/azure/host_filters" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateAzureIntegrationRequest struct { - ctx _context.Context - body *AzureAccount -} - -func (a *AzureIntegrationApi) buildUpdateAzureIntegrationRequest(ctx _context.Context, body AzureAccount) (apiUpdateAzureIntegrationRequest, error) { - req := apiUpdateAzureIntegrationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// UpdateAzureIntegration Update an Azure integration. -// Update a Datadog-Azure integration. Requires an existing `tenant_name` and `client_id`. -// Any other fields supplied will overwrite existing values. To overwrite `tenant_name` or `client_id`, -// use `new_tenant_name` and `new_client_id`. To leave a field unchanged, do not supply that field in the payload. -func (a *AzureIntegrationApi) UpdateAzureIntegration(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { - req, err := a.buildUpdateAzureIntegrationRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.updateAzureIntegrationExecute(req) -} - -// updateAzureIntegrationExecute executes the request. -func (a *AzureIntegrationApi) updateAzureIntegrationExecute(r apiUpdateAzureIntegrationRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.UpdateAzureIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/azure" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewAzureIntegrationApi Returns NewAzureIntegrationApi. -func NewAzureIntegrationApi(client *common.APIClient) *AzureIntegrationApi { - return &AzureIntegrationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_dashboard_lists.go b/api/v1/datadog/api_dashboard_lists.go deleted file mode 100644 index 937ebcb7863..00000000000 --- a/api/v1/datadog/api_dashboard_lists.go +++ /dev/null @@ -1,721 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DashboardListsApi service type -type DashboardListsApi common.Service - -type apiCreateDashboardListRequest struct { - ctx _context.Context - body *DashboardList -} - -func (a *DashboardListsApi) buildCreateDashboardListRequest(ctx _context.Context, body DashboardList) (apiCreateDashboardListRequest, error) { - req := apiCreateDashboardListRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateDashboardList Create a dashboard list. -// Create an empty dashboard list. -func (a *DashboardListsApi) CreateDashboardList(ctx _context.Context, body DashboardList) (DashboardList, *_nethttp.Response, error) { - req, err := a.buildCreateDashboardListRequest(ctx, body) - if err != nil { - var localVarReturnValue DashboardList - return localVarReturnValue, nil, err - } - - return a.createDashboardListExecute(req) -} - -// createDashboardListExecute executes the request. -func (a *DashboardListsApi) createDashboardListExecute(r apiCreateDashboardListRequest) (DashboardList, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue DashboardList - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.CreateDashboardList") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/lists/manual" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteDashboardListRequest struct { - ctx _context.Context - listId int64 -} - -func (a *DashboardListsApi) buildDeleteDashboardListRequest(ctx _context.Context, listId int64) (apiDeleteDashboardListRequest, error) { - req := apiDeleteDashboardListRequest{ - ctx: ctx, - listId: listId, - } - return req, nil -} - -// DeleteDashboardList Delete a dashboard list. -// Delete a dashboard list. -func (a *DashboardListsApi) DeleteDashboardList(ctx _context.Context, listId int64) (DashboardListDeleteResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteDashboardListRequest(ctx, listId) - if err != nil { - var localVarReturnValue DashboardListDeleteResponse - return localVarReturnValue, nil, err - } - - return a.deleteDashboardListExecute(req) -} - -// deleteDashboardListExecute executes the request. -func (a *DashboardListsApi) deleteDashboardListExecute(r apiDeleteDashboardListRequest) (DashboardListDeleteResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue DashboardListDeleteResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.DeleteDashboardList") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/lists/manual/{list_id}" - localVarPath = strings.Replace(localVarPath, "{"+"list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.listId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetDashboardListRequest struct { - ctx _context.Context - listId int64 -} - -func (a *DashboardListsApi) buildGetDashboardListRequest(ctx _context.Context, listId int64) (apiGetDashboardListRequest, error) { - req := apiGetDashboardListRequest{ - ctx: ctx, - listId: listId, - } - return req, nil -} - -// GetDashboardList Get a dashboard list. -// Fetch an existing dashboard list's definition. -func (a *DashboardListsApi) GetDashboardList(ctx _context.Context, listId int64) (DashboardList, *_nethttp.Response, error) { - req, err := a.buildGetDashboardListRequest(ctx, listId) - if err != nil { - var localVarReturnValue DashboardList - return localVarReturnValue, nil, err - } - - return a.getDashboardListExecute(req) -} - -// getDashboardListExecute executes the request. -func (a *DashboardListsApi) getDashboardListExecute(r apiGetDashboardListRequest) (DashboardList, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue DashboardList - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.GetDashboardList") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/lists/manual/{list_id}" - localVarPath = strings.Replace(localVarPath, "{"+"list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.listId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListDashboardListsRequest struct { - ctx _context.Context -} - -func (a *DashboardListsApi) buildListDashboardListsRequest(ctx _context.Context) (apiListDashboardListsRequest, error) { - req := apiListDashboardListsRequest{ - ctx: ctx, - } - return req, nil -} - -// ListDashboardLists Get all dashboard lists. -// Fetch all of your existing dashboard list definitions. -func (a *DashboardListsApi) ListDashboardLists(ctx _context.Context) (DashboardListListResponse, *_nethttp.Response, error) { - req, err := a.buildListDashboardListsRequest(ctx) - if err != nil { - var localVarReturnValue DashboardListListResponse - return localVarReturnValue, nil, err - } - - return a.listDashboardListsExecute(req) -} - -// listDashboardListsExecute executes the request. -func (a *DashboardListsApi) listDashboardListsExecute(r apiListDashboardListsRequest) (DashboardListListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue DashboardListListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.ListDashboardLists") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/lists/manual" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateDashboardListRequest struct { - ctx _context.Context - listId int64 - body *DashboardList -} - -func (a *DashboardListsApi) buildUpdateDashboardListRequest(ctx _context.Context, listId int64, body DashboardList) (apiUpdateDashboardListRequest, error) { - req := apiUpdateDashboardListRequest{ - ctx: ctx, - listId: listId, - body: &body, - } - return req, nil -} - -// UpdateDashboardList Update a dashboard list. -// Update the name of a dashboard list. -func (a *DashboardListsApi) UpdateDashboardList(ctx _context.Context, listId int64, body DashboardList) (DashboardList, *_nethttp.Response, error) { - req, err := a.buildUpdateDashboardListRequest(ctx, listId, body) - if err != nil { - var localVarReturnValue DashboardList - return localVarReturnValue, nil, err - } - - return a.updateDashboardListExecute(req) -} - -// updateDashboardListExecute executes the request. -func (a *DashboardListsApi) updateDashboardListExecute(r apiUpdateDashboardListRequest) (DashboardList, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue DashboardList - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.UpdateDashboardList") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/lists/manual/{list_id}" - localVarPath = strings.Replace(localVarPath, "{"+"list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.listId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewDashboardListsApi Returns NewDashboardListsApi. -func NewDashboardListsApi(client *common.APIClient) *DashboardListsApi { - return &DashboardListsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_dashboards.go b/api/v1/datadog/api_dashboards.go deleted file mode 100644 index 5598c85ce6d..00000000000 --- a/api/v1/datadog/api_dashboards.go +++ /dev/null @@ -1,1046 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DashboardsApi service type -type DashboardsApi common.Service - -type apiCreateDashboardRequest struct { - ctx _context.Context - body *Dashboard -} - -func (a *DashboardsApi) buildCreateDashboardRequest(ctx _context.Context, body Dashboard) (apiCreateDashboardRequest, error) { - req := apiCreateDashboardRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateDashboard Create a new dashboard. -// Create a dashboard using the specified options. When defining queries in your widgets, take note of which queries should have the `as_count()` or `as_rate()` modifiers appended. -// Refer to the following [documentation](https://docs.datadoghq.com/developers/metrics/type_modifiers/?tab=count#in-application-modifiers) for more information on these modifiers. -func (a *DashboardsApi) CreateDashboard(ctx _context.Context, body Dashboard) (Dashboard, *_nethttp.Response, error) { - req, err := a.buildCreateDashboardRequest(ctx, body) - if err != nil { - var localVarReturnValue Dashboard - return localVarReturnValue, nil, err - } - - return a.createDashboardExecute(req) -} - -// createDashboardExecute executes the request. -func (a *DashboardsApi) createDashboardExecute(r apiCreateDashboardRequest) (Dashboard, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue Dashboard - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.CreateDashboard") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteDashboardRequest struct { - ctx _context.Context - dashboardId string -} - -func (a *DashboardsApi) buildDeleteDashboardRequest(ctx _context.Context, dashboardId string) (apiDeleteDashboardRequest, error) { - req := apiDeleteDashboardRequest{ - ctx: ctx, - dashboardId: dashboardId, - } - return req, nil -} - -// DeleteDashboard Delete a dashboard. -// Delete a dashboard using the specified ID. -func (a *DashboardsApi) DeleteDashboard(ctx _context.Context, dashboardId string) (DashboardDeleteResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteDashboardRequest(ctx, dashboardId) - if err != nil { - var localVarReturnValue DashboardDeleteResponse - return localVarReturnValue, nil, err - } - - return a.deleteDashboardExecute(req) -} - -// deleteDashboardExecute executes the request. -func (a *DashboardsApi) deleteDashboardExecute(r apiDeleteDashboardRequest) (DashboardDeleteResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue DashboardDeleteResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.DeleteDashboard") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/{dashboard_id}" - localVarPath = strings.Replace(localVarPath, "{"+"dashboard_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteDashboardsRequest struct { - ctx _context.Context - body *DashboardBulkDeleteRequest -} - -func (a *DashboardsApi) buildDeleteDashboardsRequest(ctx _context.Context, body DashboardBulkDeleteRequest) (apiDeleteDashboardsRequest, error) { - req := apiDeleteDashboardsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteDashboards Delete dashboards. -// Delete dashboards using the specified IDs. If there are any failures, no dashboards will be deleted (partial success is not allowed). -func (a *DashboardsApi) DeleteDashboards(ctx _context.Context, body DashboardBulkDeleteRequest) (*_nethttp.Response, error) { - req, err := a.buildDeleteDashboardsRequest(ctx, body) - if err != nil { - return nil, err - } - - return a.deleteDashboardsExecute(req) -} - -// deleteDashboardsExecute executes the request. -func (a *DashboardsApi) deleteDashboardsExecute(r apiDeleteDashboardsRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.DeleteDashboards") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "*/*" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetDashboardRequest struct { - ctx _context.Context - dashboardId string -} - -func (a *DashboardsApi) buildGetDashboardRequest(ctx _context.Context, dashboardId string) (apiGetDashboardRequest, error) { - req := apiGetDashboardRequest{ - ctx: ctx, - dashboardId: dashboardId, - } - return req, nil -} - -// GetDashboard Get a dashboard. -// Get a dashboard using the specified ID. -func (a *DashboardsApi) GetDashboard(ctx _context.Context, dashboardId string) (Dashboard, *_nethttp.Response, error) { - req, err := a.buildGetDashboardRequest(ctx, dashboardId) - if err != nil { - var localVarReturnValue Dashboard - return localVarReturnValue, nil, err - } - - return a.getDashboardExecute(req) -} - -// getDashboardExecute executes the request. -func (a *DashboardsApi) getDashboardExecute(r apiGetDashboardRequest) (Dashboard, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue Dashboard - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.GetDashboard") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/{dashboard_id}" - localVarPath = strings.Replace(localVarPath, "{"+"dashboard_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListDashboardsRequest struct { - ctx _context.Context - filterShared *bool - filterDeleted *bool -} - -// ListDashboardsOptionalParameters holds optional parameters for ListDashboards. -type ListDashboardsOptionalParameters struct { - FilterShared *bool - FilterDeleted *bool -} - -// NewListDashboardsOptionalParameters creates an empty struct for parameters. -func NewListDashboardsOptionalParameters() *ListDashboardsOptionalParameters { - this := ListDashboardsOptionalParameters{} - return &this -} - -// WithFilterShared sets the corresponding parameter name and returns the struct. -func (r *ListDashboardsOptionalParameters) WithFilterShared(filterShared bool) *ListDashboardsOptionalParameters { - r.FilterShared = &filterShared - return r -} - -// WithFilterDeleted sets the corresponding parameter name and returns the struct. -func (r *ListDashboardsOptionalParameters) WithFilterDeleted(filterDeleted bool) *ListDashboardsOptionalParameters { - r.FilterDeleted = &filterDeleted - return r -} - -func (a *DashboardsApi) buildListDashboardsRequest(ctx _context.Context, o ...ListDashboardsOptionalParameters) (apiListDashboardsRequest, error) { - req := apiListDashboardsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListDashboardsOptionalParameters is allowed") - } - - if o != nil { - req.filterShared = o[0].FilterShared - req.filterDeleted = o[0].FilterDeleted - } - return req, nil -} - -// ListDashboards Get all dashboards. -// Get all dashboards. -// -// **Note**: This query will only return custom created or cloned dashboards. -// This query will not return preset dashboards. -func (a *DashboardsApi) ListDashboards(ctx _context.Context, o ...ListDashboardsOptionalParameters) (DashboardSummary, *_nethttp.Response, error) { - req, err := a.buildListDashboardsRequest(ctx, o...) - if err != nil { - var localVarReturnValue DashboardSummary - return localVarReturnValue, nil, err - } - - return a.listDashboardsExecute(req) -} - -// listDashboardsExecute executes the request. -func (a *DashboardsApi) listDashboardsExecute(r apiListDashboardsRequest) (DashboardSummary, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue DashboardSummary - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.ListDashboards") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterShared != nil { - localVarQueryParams.Add("filter[shared]", common.ParameterToString(*r.filterShared, "")) - } - if r.filterDeleted != nil { - localVarQueryParams.Add("filter[deleted]", common.ParameterToString(*r.filterDeleted, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiRestoreDashboardsRequest struct { - ctx _context.Context - body *DashboardRestoreRequest -} - -func (a *DashboardsApi) buildRestoreDashboardsRequest(ctx _context.Context, body DashboardRestoreRequest) (apiRestoreDashboardsRequest, error) { - req := apiRestoreDashboardsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// RestoreDashboards Restore deleted dashboards. -// Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed). -func (a *DashboardsApi) RestoreDashboards(ctx _context.Context, body DashboardRestoreRequest) (*_nethttp.Response, error) { - req, err := a.buildRestoreDashboardsRequest(ctx, body) - if err != nil { - return nil, err - } - - return a.restoreDashboardsExecute(req) -} - -// restoreDashboardsExecute executes the request. -func (a *DashboardsApi) restoreDashboardsExecute(r apiRestoreDashboardsRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.RestoreDashboards") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "*/*" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiUpdateDashboardRequest struct { - ctx _context.Context - dashboardId string - body *Dashboard -} - -func (a *DashboardsApi) buildUpdateDashboardRequest(ctx _context.Context, dashboardId string, body Dashboard) (apiUpdateDashboardRequest, error) { - req := apiUpdateDashboardRequest{ - ctx: ctx, - dashboardId: dashboardId, - body: &body, - } - return req, nil -} - -// UpdateDashboard Update a dashboard. -// Update a dashboard using the specified ID. -func (a *DashboardsApi) UpdateDashboard(ctx _context.Context, dashboardId string, body Dashboard) (Dashboard, *_nethttp.Response, error) { - req, err := a.buildUpdateDashboardRequest(ctx, dashboardId, body) - if err != nil { - var localVarReturnValue Dashboard - return localVarReturnValue, nil, err - } - - return a.updateDashboardExecute(req) -} - -// updateDashboardExecute executes the request. -func (a *DashboardsApi) updateDashboardExecute(r apiUpdateDashboardRequest) (Dashboard, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue Dashboard - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.UpdateDashboard") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/dashboard/{dashboard_id}" - localVarPath = strings.Replace(localVarPath, "{"+"dashboard_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewDashboardsApi Returns NewDashboardsApi. -func NewDashboardsApi(client *common.APIClient) *DashboardsApi { - return &DashboardsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_downtimes.go b/api/v1/datadog/api_downtimes.go deleted file mode 100644 index 66e49b50eb3..00000000000 --- a/api/v1/datadog/api_downtimes.go +++ /dev/null @@ -1,1027 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DowntimesApi service type -type DowntimesApi common.Service - -type apiCancelDowntimeRequest struct { - ctx _context.Context - downtimeId int64 -} - -func (a *DowntimesApi) buildCancelDowntimeRequest(ctx _context.Context, downtimeId int64) (apiCancelDowntimeRequest, error) { - req := apiCancelDowntimeRequest{ - ctx: ctx, - downtimeId: downtimeId, - } - return req, nil -} - -// CancelDowntime Cancel a downtime. -// Cancel a downtime. -func (a *DowntimesApi) CancelDowntime(ctx _context.Context, downtimeId int64) (*_nethttp.Response, error) { - req, err := a.buildCancelDowntimeRequest(ctx, downtimeId) - if err != nil { - return nil, err - } - - return a.cancelDowntimeExecute(req) -} - -// cancelDowntimeExecute executes the request. -func (a *DowntimesApi) cancelDowntimeExecute(r apiCancelDowntimeRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.CancelDowntime") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/downtime/{downtime_id}" - localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(common.ParameterToString(r.downtimeId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiCancelDowntimesByScopeRequest struct { - ctx _context.Context - body *CancelDowntimesByScopeRequest -} - -func (a *DowntimesApi) buildCancelDowntimesByScopeRequest(ctx _context.Context, body CancelDowntimesByScopeRequest) (apiCancelDowntimesByScopeRequest, error) { - req := apiCancelDowntimesByScopeRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CancelDowntimesByScope Cancel downtimes by scope. -// Delete all downtimes that match the scope of `X`. -func (a *DowntimesApi) CancelDowntimesByScope(ctx _context.Context, body CancelDowntimesByScopeRequest) (CanceledDowntimesIds, *_nethttp.Response, error) { - req, err := a.buildCancelDowntimesByScopeRequest(ctx, body) - if err != nil { - var localVarReturnValue CanceledDowntimesIds - return localVarReturnValue, nil, err - } - - return a.cancelDowntimesByScopeExecute(req) -} - -// cancelDowntimesByScopeExecute executes the request. -func (a *DowntimesApi) cancelDowntimesByScopeExecute(r apiCancelDowntimesByScopeRequest) (CanceledDowntimesIds, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue CanceledDowntimesIds - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.CancelDowntimesByScope") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/downtime/cancel/by_scope" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateDowntimeRequest struct { - ctx _context.Context - body *Downtime -} - -func (a *DowntimesApi) buildCreateDowntimeRequest(ctx _context.Context, body Downtime) (apiCreateDowntimeRequest, error) { - req := apiCreateDowntimeRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateDowntime Schedule a downtime. -// Schedule a downtime. -func (a *DowntimesApi) CreateDowntime(ctx _context.Context, body Downtime) (Downtime, *_nethttp.Response, error) { - req, err := a.buildCreateDowntimeRequest(ctx, body) - if err != nil { - var localVarReturnValue Downtime - return localVarReturnValue, nil, err - } - - return a.createDowntimeExecute(req) -} - -// createDowntimeExecute executes the request. -func (a *DowntimesApi) createDowntimeExecute(r apiCreateDowntimeRequest) (Downtime, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue Downtime - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.CreateDowntime") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/downtime" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetDowntimeRequest struct { - ctx _context.Context - downtimeId int64 -} - -func (a *DowntimesApi) buildGetDowntimeRequest(ctx _context.Context, downtimeId int64) (apiGetDowntimeRequest, error) { - req := apiGetDowntimeRequest{ - ctx: ctx, - downtimeId: downtimeId, - } - return req, nil -} - -// GetDowntime Get a downtime. -// Get downtime detail by `downtime_id`. -func (a *DowntimesApi) GetDowntime(ctx _context.Context, downtimeId int64) (Downtime, *_nethttp.Response, error) { - req, err := a.buildGetDowntimeRequest(ctx, downtimeId) - if err != nil { - var localVarReturnValue Downtime - return localVarReturnValue, nil, err - } - - return a.getDowntimeExecute(req) -} - -// getDowntimeExecute executes the request. -func (a *DowntimesApi) getDowntimeExecute(r apiGetDowntimeRequest) (Downtime, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue Downtime - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.GetDowntime") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/downtime/{downtime_id}" - localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(common.ParameterToString(r.downtimeId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListDowntimesRequest struct { - ctx _context.Context - currentOnly *bool -} - -// ListDowntimesOptionalParameters holds optional parameters for ListDowntimes. -type ListDowntimesOptionalParameters struct { - CurrentOnly *bool -} - -// NewListDowntimesOptionalParameters creates an empty struct for parameters. -func NewListDowntimesOptionalParameters() *ListDowntimesOptionalParameters { - this := ListDowntimesOptionalParameters{} - return &this -} - -// WithCurrentOnly sets the corresponding parameter name and returns the struct. -func (r *ListDowntimesOptionalParameters) WithCurrentOnly(currentOnly bool) *ListDowntimesOptionalParameters { - r.CurrentOnly = ¤tOnly - return r -} - -func (a *DowntimesApi) buildListDowntimesRequest(ctx _context.Context, o ...ListDowntimesOptionalParameters) (apiListDowntimesRequest, error) { - req := apiListDowntimesRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListDowntimesOptionalParameters is allowed") - } - - if o != nil { - req.currentOnly = o[0].CurrentOnly - } - return req, nil -} - -// ListDowntimes Get all downtimes. -// Get all scheduled downtimes. -func (a *DowntimesApi) ListDowntimes(ctx _context.Context, o ...ListDowntimesOptionalParameters) ([]Downtime, *_nethttp.Response, error) { - req, err := a.buildListDowntimesRequest(ctx, o...) - if err != nil { - var localVarReturnValue []Downtime - return localVarReturnValue, nil, err - } - - return a.listDowntimesExecute(req) -} - -// listDowntimesExecute executes the request. -func (a *DowntimesApi) listDowntimesExecute(r apiListDowntimesRequest) ([]Downtime, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []Downtime - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.ListDowntimes") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/downtime" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.currentOnly != nil { - localVarQueryParams.Add("current_only", common.ParameterToString(*r.currentOnly, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListMonitorDowntimesRequest struct { - ctx _context.Context - monitorId int64 -} - -func (a *DowntimesApi) buildListMonitorDowntimesRequest(ctx _context.Context, monitorId int64) (apiListMonitorDowntimesRequest, error) { - req := apiListMonitorDowntimesRequest{ - ctx: ctx, - monitorId: monitorId, - } - return req, nil -} - -// ListMonitorDowntimes Get all downtimes for a monitor. -// Get all active downtimes for the specified monitor. -func (a *DowntimesApi) ListMonitorDowntimes(ctx _context.Context, monitorId int64) ([]Downtime, *_nethttp.Response, error) { - req, err := a.buildListMonitorDowntimesRequest(ctx, monitorId) - if err != nil { - var localVarReturnValue []Downtime - return localVarReturnValue, nil, err - } - - return a.listMonitorDowntimesExecute(req) -} - -// listMonitorDowntimesExecute executes the request. -func (a *DowntimesApi) listMonitorDowntimesExecute(r apiListMonitorDowntimesRequest) ([]Downtime, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []Downtime - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.ListMonitorDowntimes") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}/downtimes" - localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateDowntimeRequest struct { - ctx _context.Context - downtimeId int64 - body *Downtime -} - -func (a *DowntimesApi) buildUpdateDowntimeRequest(ctx _context.Context, downtimeId int64, body Downtime) (apiUpdateDowntimeRequest, error) { - req := apiUpdateDowntimeRequest{ - ctx: ctx, - downtimeId: downtimeId, - body: &body, - } - return req, nil -} - -// UpdateDowntime Update a downtime. -// Update a single downtime by `downtime_id`. -func (a *DowntimesApi) UpdateDowntime(ctx _context.Context, downtimeId int64, body Downtime) (Downtime, *_nethttp.Response, error) { - req, err := a.buildUpdateDowntimeRequest(ctx, downtimeId, body) - if err != nil { - var localVarReturnValue Downtime - return localVarReturnValue, nil, err - } - - return a.updateDowntimeExecute(req) -} - -// updateDowntimeExecute executes the request. -func (a *DowntimesApi) updateDowntimeExecute(r apiUpdateDowntimeRequest) (Downtime, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue Downtime - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.UpdateDowntime") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/downtime/{downtime_id}" - localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(common.ParameterToString(r.downtimeId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewDowntimesApi Returns NewDowntimesApi. -func NewDowntimesApi(client *common.APIClient) *DowntimesApi { - return &DowntimesApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_events.go b/api/v1/datadog/api_events.go deleted file mode 100644 index 739fe6bbf7a..00000000000 --- a/api/v1/datadog/api_events.go +++ /dev/null @@ -1,529 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// EventsApi service type -type EventsApi common.Service - -type apiCreateEventRequest struct { - ctx _context.Context - body *EventCreateRequest -} - -func (a *EventsApi) buildCreateEventRequest(ctx _context.Context, body EventCreateRequest) (apiCreateEventRequest, error) { - req := apiCreateEventRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateEvent Post an event. -// This endpoint allows you to post events to the stream. -// Tag them, set priority and event aggregate them with other events. -func (a *EventsApi) CreateEvent(ctx _context.Context, body EventCreateRequest) (EventCreateResponse, *_nethttp.Response, error) { - req, err := a.buildCreateEventRequest(ctx, body) - if err != nil { - var localVarReturnValue EventCreateResponse - return localVarReturnValue, nil, err - } - - return a.createEventExecute(req) -} - -// createEventExecute executes the request. -func (a *EventsApi) createEventExecute(r apiCreateEventRequest) (EventCreateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue EventCreateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.EventsApi.CreateEvent") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/events" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetEventRequest struct { - ctx _context.Context - eventId int64 -} - -func (a *EventsApi) buildGetEventRequest(ctx _context.Context, eventId int64) (apiGetEventRequest, error) { - req := apiGetEventRequest{ - ctx: ctx, - eventId: eventId, - } - return req, nil -} - -// GetEvent Get an event. -// This endpoint allows you to query for event details. -// -// **Note**: If the event you’re querying contains markdown formatting of any kind, -// you may see characters such as `%`,`\`,`n` in your output. -func (a *EventsApi) GetEvent(ctx _context.Context, eventId int64) (EventResponse, *_nethttp.Response, error) { - req, err := a.buildGetEventRequest(ctx, eventId) - if err != nil { - var localVarReturnValue EventResponse - return localVarReturnValue, nil, err - } - - return a.getEventExecute(req) -} - -// getEventExecute executes the request. -func (a *EventsApi) getEventExecute(r apiGetEventRequest) (EventResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue EventResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.EventsApi.GetEvent") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/events/{event_id}" - localVarPath = strings.Replace(localVarPath, "{"+"event_id"+"}", _neturl.PathEscape(common.ParameterToString(r.eventId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListEventsRequest struct { - ctx _context.Context - start *int64 - end *int64 - priority *EventPriority - sources *string - tags *string - unaggregated *bool - excludeAggregate *bool - page *int32 -} - -// ListEventsOptionalParameters holds optional parameters for ListEvents. -type ListEventsOptionalParameters struct { - Priority *EventPriority - Sources *string - Tags *string - Unaggregated *bool - ExcludeAggregate *bool - Page *int32 -} - -// NewListEventsOptionalParameters creates an empty struct for parameters. -func NewListEventsOptionalParameters() *ListEventsOptionalParameters { - this := ListEventsOptionalParameters{} - return &this -} - -// WithPriority sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithPriority(priority EventPriority) *ListEventsOptionalParameters { - r.Priority = &priority - return r -} - -// WithSources sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithSources(sources string) *ListEventsOptionalParameters { - r.Sources = &sources - return r -} - -// WithTags sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithTags(tags string) *ListEventsOptionalParameters { - r.Tags = &tags - return r -} - -// WithUnaggregated sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithUnaggregated(unaggregated bool) *ListEventsOptionalParameters { - r.Unaggregated = &unaggregated - return r -} - -// WithExcludeAggregate sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithExcludeAggregate(excludeAggregate bool) *ListEventsOptionalParameters { - r.ExcludeAggregate = &excludeAggregate - return r -} - -// WithPage sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithPage(page int32) *ListEventsOptionalParameters { - r.Page = &page - return r -} - -func (a *EventsApi) buildListEventsRequest(ctx _context.Context, start int64, end int64, o ...ListEventsOptionalParameters) (apiListEventsRequest, error) { - req := apiListEventsRequest{ - ctx: ctx, - start: &start, - end: &end, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListEventsOptionalParameters is allowed") - } - - if o != nil { - req.priority = o[0].Priority - req.sources = o[0].Sources - req.tags = o[0].Tags - req.unaggregated = o[0].Unaggregated - req.excludeAggregate = o[0].ExcludeAggregate - req.page = o[0].Page - } - return req, nil -} - -// ListEvents Get a list of events. -// The event stream can be queried and filtered by time, priority, sources and tags. -// -// **Notes**: -// - If the event you’re querying contains markdown formatting of any kind, -// you may see characters such as `%`,`\`,`n` in your output. -// -// - This endpoint returns a maximum of `1000` most recent results. To return additional results, -// identify the last timestamp of the last result and set that as the `end` query time to -// paginate the results. You can also use the page parameter to specify which set of `1000` results to return. -func (a *EventsApi) ListEvents(ctx _context.Context, start int64, end int64, o ...ListEventsOptionalParameters) (EventListResponse, *_nethttp.Response, error) { - req, err := a.buildListEventsRequest(ctx, start, end, o...) - if err != nil { - var localVarReturnValue EventListResponse - return localVarReturnValue, nil, err - } - - return a.listEventsExecute(req) -} - -// listEventsExecute executes the request. -func (a *EventsApi) listEventsExecute(r apiListEventsRequest) (EventListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue EventListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.EventsApi.ListEvents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/events" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.start == nil { - return localVarReturnValue, nil, common.ReportError("start is required and must be specified") - } - if r.end == nil { - return localVarReturnValue, nil, common.ReportError("end is required and must be specified") - } - localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) - localVarQueryParams.Add("end", common.ParameterToString(*r.end, "")) - if r.priority != nil { - localVarQueryParams.Add("priority", common.ParameterToString(*r.priority, "")) - } - if r.sources != nil { - localVarQueryParams.Add("sources", common.ParameterToString(*r.sources, "")) - } - if r.tags != nil { - localVarQueryParams.Add("tags", common.ParameterToString(*r.tags, "")) - } - if r.unaggregated != nil { - localVarQueryParams.Add("unaggregated", common.ParameterToString(*r.unaggregated, "")) - } - if r.excludeAggregate != nil { - localVarQueryParams.Add("exclude_aggregate", common.ParameterToString(*r.excludeAggregate, "")) - } - if r.page != nil { - localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewEventsApi Returns NewEventsApi. -func NewEventsApi(client *common.APIClient) *EventsApi { - return &EventsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_gcp_integration.go b/api/v1/datadog/api_gcp_integration.go deleted file mode 100644 index 70b6e7e0e6a..00000000000 --- a/api/v1/datadog/api_gcp_integration.go +++ /dev/null @@ -1,588 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// GCPIntegrationApi service type -type GCPIntegrationApi common.Service - -type apiCreateGCPIntegrationRequest struct { - ctx _context.Context - body *GCPAccount -} - -func (a *GCPIntegrationApi) buildCreateGCPIntegrationRequest(ctx _context.Context, body GCPAccount) (apiCreateGCPIntegrationRequest, error) { - req := apiCreateGCPIntegrationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateGCPIntegration Create a GCP integration. -// Create a Datadog-GCP integration. -func (a *GCPIntegrationApi) CreateGCPIntegration(ctx _context.Context, body GCPAccount) (interface{}, *_nethttp.Response, error) { - req, err := a.buildCreateGCPIntegrationRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.createGCPIntegrationExecute(req) -} - -// createGCPIntegrationExecute executes the request. -func (a *GCPIntegrationApi) createGCPIntegrationExecute(r apiCreateGCPIntegrationRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.CreateGCPIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/gcp" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteGCPIntegrationRequest struct { - ctx _context.Context - body *GCPAccount -} - -func (a *GCPIntegrationApi) buildDeleteGCPIntegrationRequest(ctx _context.Context, body GCPAccount) (apiDeleteGCPIntegrationRequest, error) { - req := apiDeleteGCPIntegrationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteGCPIntegration Delete a GCP integration. -// Delete a given Datadog-GCP integration. -func (a *GCPIntegrationApi) DeleteGCPIntegration(ctx _context.Context, body GCPAccount) (interface{}, *_nethttp.Response, error) { - req, err := a.buildDeleteGCPIntegrationRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.deleteGCPIntegrationExecute(req) -} - -// deleteGCPIntegrationExecute executes the request. -func (a *GCPIntegrationApi) deleteGCPIntegrationExecute(r apiDeleteGCPIntegrationRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.DeleteGCPIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/gcp" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListGCPIntegrationRequest struct { - ctx _context.Context -} - -func (a *GCPIntegrationApi) buildListGCPIntegrationRequest(ctx _context.Context) (apiListGCPIntegrationRequest, error) { - req := apiListGCPIntegrationRequest{ - ctx: ctx, - } - return req, nil -} - -// ListGCPIntegration List all GCP integrations. -// List all Datadog-GCP integrations configured in your Datadog account. -func (a *GCPIntegrationApi) ListGCPIntegration(ctx _context.Context) ([]GCPAccount, *_nethttp.Response, error) { - req, err := a.buildListGCPIntegrationRequest(ctx) - if err != nil { - var localVarReturnValue []GCPAccount - return localVarReturnValue, nil, err - } - - return a.listGCPIntegrationExecute(req) -} - -// listGCPIntegrationExecute executes the request. -func (a *GCPIntegrationApi) listGCPIntegrationExecute(r apiListGCPIntegrationRequest) ([]GCPAccount, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []GCPAccount - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.ListGCPIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/gcp" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateGCPIntegrationRequest struct { - ctx _context.Context - body *GCPAccount -} - -func (a *GCPIntegrationApi) buildUpdateGCPIntegrationRequest(ctx _context.Context, body GCPAccount) (apiUpdateGCPIntegrationRequest, error) { - req := apiUpdateGCPIntegrationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// UpdateGCPIntegration Update a GCP integration. -// Update a Datadog-GCP integrations host_filters and/or auto-mute. -// Requires a `project_id` and `client_email`, however these fields cannot be updated. -// If you need to update these fields, delete and use the create (`POST`) endpoint. -// The unspecified fields will keep their original values. -func (a *GCPIntegrationApi) UpdateGCPIntegration(ctx _context.Context, body GCPAccount) (interface{}, *_nethttp.Response, error) { - req, err := a.buildUpdateGCPIntegrationRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.updateGCPIntegrationExecute(req) -} - -// updateGCPIntegrationExecute executes the request. -func (a *GCPIntegrationApi) updateGCPIntegrationExecute(r apiUpdateGCPIntegrationRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.UpdateGCPIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/gcp" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewGCPIntegrationApi Returns NewGCPIntegrationApi. -func NewGCPIntegrationApi(client *common.APIClient) *GCPIntegrationApi { - return &GCPIntegrationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_hosts.go b/api/v1/datadog/api_hosts.go deleted file mode 100644 index ca8c9c33f07..00000000000 --- a/api/v1/datadog/api_hosts.go +++ /dev/null @@ -1,722 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// HostsApi service type -type HostsApi common.Service - -type apiGetHostTotalsRequest struct { - ctx _context.Context - from *int64 -} - -// GetHostTotalsOptionalParameters holds optional parameters for GetHostTotals. -type GetHostTotalsOptionalParameters struct { - From *int64 -} - -// NewGetHostTotalsOptionalParameters creates an empty struct for parameters. -func NewGetHostTotalsOptionalParameters() *GetHostTotalsOptionalParameters { - this := GetHostTotalsOptionalParameters{} - return &this -} - -// WithFrom sets the corresponding parameter name and returns the struct. -func (r *GetHostTotalsOptionalParameters) WithFrom(from int64) *GetHostTotalsOptionalParameters { - r.From = &from - return r -} - -func (a *HostsApi) buildGetHostTotalsRequest(ctx _context.Context, o ...GetHostTotalsOptionalParameters) (apiGetHostTotalsRequest, error) { - req := apiGetHostTotalsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetHostTotalsOptionalParameters is allowed") - } - - if o != nil { - req.from = o[0].From - } - return req, nil -} - -// GetHostTotals Get the total number of active hosts. -// This endpoint returns the total number of active and up hosts in your Datadog account. -// Active means the host has reported in the past hour, and up means it has reported in the past two hours. -func (a *HostsApi) GetHostTotals(ctx _context.Context, o ...GetHostTotalsOptionalParameters) (HostTotals, *_nethttp.Response, error) { - req, err := a.buildGetHostTotalsRequest(ctx, o...) - if err != nil { - var localVarReturnValue HostTotals - return localVarReturnValue, nil, err - } - - return a.getHostTotalsExecute(req) -} - -// getHostTotalsExecute executes the request. -func (a *HostsApi) getHostTotalsExecute(r apiGetHostTotalsRequest) (HostTotals, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue HostTotals - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.GetHostTotals") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/hosts/totals" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.from != nil { - localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListHostsRequest struct { - ctx _context.Context - filter *string - sortField *string - sortDir *string - start *int64 - count *int64 - from *int64 - includeMutedHostsData *bool - includeHostsMetadata *bool -} - -// ListHostsOptionalParameters holds optional parameters for ListHosts. -type ListHostsOptionalParameters struct { - Filter *string - SortField *string - SortDir *string - Start *int64 - Count *int64 - From *int64 - IncludeMutedHostsData *bool - IncludeHostsMetadata *bool -} - -// NewListHostsOptionalParameters creates an empty struct for parameters. -func NewListHostsOptionalParameters() *ListHostsOptionalParameters { - this := ListHostsOptionalParameters{} - return &this -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithFilter(filter string) *ListHostsOptionalParameters { - r.Filter = &filter - return r -} - -// WithSortField sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithSortField(sortField string) *ListHostsOptionalParameters { - r.SortField = &sortField - return r -} - -// WithSortDir sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithSortDir(sortDir string) *ListHostsOptionalParameters { - r.SortDir = &sortDir - return r -} - -// WithStart sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithStart(start int64) *ListHostsOptionalParameters { - r.Start = &start - return r -} - -// WithCount sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithCount(count int64) *ListHostsOptionalParameters { - r.Count = &count - return r -} - -// WithFrom sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithFrom(from int64) *ListHostsOptionalParameters { - r.From = &from - return r -} - -// WithIncludeMutedHostsData sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithIncludeMutedHostsData(includeMutedHostsData bool) *ListHostsOptionalParameters { - r.IncludeMutedHostsData = &includeMutedHostsData - return r -} - -// WithIncludeHostsMetadata sets the corresponding parameter name and returns the struct. -func (r *ListHostsOptionalParameters) WithIncludeHostsMetadata(includeHostsMetadata bool) *ListHostsOptionalParameters { - r.IncludeHostsMetadata = &includeHostsMetadata - return r -} - -func (a *HostsApi) buildListHostsRequest(ctx _context.Context, o ...ListHostsOptionalParameters) (apiListHostsRequest, error) { - req := apiListHostsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListHostsOptionalParameters is allowed") - } - - if o != nil { - req.filter = o[0].Filter - req.sortField = o[0].SortField - req.sortDir = o[0].SortDir - req.start = o[0].Start - req.count = o[0].Count - req.from = o[0].From - req.includeMutedHostsData = o[0].IncludeMutedHostsData - req.includeHostsMetadata = o[0].IncludeHostsMetadata - } - return req, nil -} - -// ListHosts Get all hosts for your organization. -// This endpoint allows searching for hosts by name, alias, or tag. -// Hosts live within the past 3 hours are included by default. -// Retention is 7 days. -// Results are paginated with a max of 1000 results at a time. -func (a *HostsApi) ListHosts(ctx _context.Context, o ...ListHostsOptionalParameters) (HostListResponse, *_nethttp.Response, error) { - req, err := a.buildListHostsRequest(ctx, o...) - if err != nil { - var localVarReturnValue HostListResponse - return localVarReturnValue, nil, err - } - - return a.listHostsExecute(req) -} - -// listHostsExecute executes the request. -func (a *HostsApi) listHostsExecute(r apiListHostsRequest) (HostListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue HostListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.ListHosts") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/hosts" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - if r.sortField != nil { - localVarQueryParams.Add("sort_field", common.ParameterToString(*r.sortField, "")) - } - if r.sortDir != nil { - localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) - } - if r.start != nil { - localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) - } - if r.count != nil { - localVarQueryParams.Add("count", common.ParameterToString(*r.count, "")) - } - if r.from != nil { - localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) - } - if r.includeMutedHostsData != nil { - localVarQueryParams.Add("include_muted_hosts_data", common.ParameterToString(*r.includeMutedHostsData, "")) - } - if r.includeHostsMetadata != nil { - localVarQueryParams.Add("include_hosts_metadata", common.ParameterToString(*r.includeHostsMetadata, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiMuteHostRequest struct { - ctx _context.Context - hostName string - body *HostMuteSettings -} - -func (a *HostsApi) buildMuteHostRequest(ctx _context.Context, hostName string, body HostMuteSettings) (apiMuteHostRequest, error) { - req := apiMuteHostRequest{ - ctx: ctx, - hostName: hostName, - body: &body, - } - return req, nil -} - -// MuteHost Mute a host. -// Mute a host. -func (a *HostsApi) MuteHost(ctx _context.Context, hostName string, body HostMuteSettings) (HostMuteResponse, *_nethttp.Response, error) { - req, err := a.buildMuteHostRequest(ctx, hostName, body) - if err != nil { - var localVarReturnValue HostMuteResponse - return localVarReturnValue, nil, err - } - - return a.muteHostExecute(req) -} - -// muteHostExecute executes the request. -func (a *HostsApi) muteHostExecute(r apiMuteHostRequest) (HostMuteResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue HostMuteResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.MuteHost") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/host/{host_name}/mute" - localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUnmuteHostRequest struct { - ctx _context.Context - hostName string -} - -func (a *HostsApi) buildUnmuteHostRequest(ctx _context.Context, hostName string) (apiUnmuteHostRequest, error) { - req := apiUnmuteHostRequest{ - ctx: ctx, - hostName: hostName, - } - return req, nil -} - -// UnmuteHost Unmute a host. -// Unmutes a host. This endpoint takes no JSON arguments. -func (a *HostsApi) UnmuteHost(ctx _context.Context, hostName string) (HostMuteResponse, *_nethttp.Response, error) { - req, err := a.buildUnmuteHostRequest(ctx, hostName) - if err != nil { - var localVarReturnValue HostMuteResponse - return localVarReturnValue, nil, err - } - - return a.unmuteHostExecute(req) -} - -// unmuteHostExecute executes the request. -func (a *HostsApi) unmuteHostExecute(r apiUnmuteHostRequest) (HostMuteResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue HostMuteResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.UnmuteHost") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/host/{host_name}/unmute" - localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewHostsApi Returns NewHostsApi. -func NewHostsApi(client *common.APIClient) *HostsApi { - return &HostsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_ip_ranges.go b/api/v1/datadog/api_ip_ranges.go deleted file mode 100644 index 5e6f5c563f6..00000000000 --- a/api/v1/datadog/api_ip_ranges.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// IPRangesApi service type -type IPRangesApi common.Service - -type apiGetIPRangesRequest struct { - ctx _context.Context -} - -func (a *IPRangesApi) buildGetIPRangesRequest(ctx _context.Context) (apiGetIPRangesRequest, error) { - req := apiGetIPRangesRequest{ - ctx: ctx, - } - return req, nil -} - -// GetIPRanges List IP Ranges. -// Get information about Datadog IP ranges. -func (a *IPRangesApi) GetIPRanges(ctx _context.Context) (IPRanges, *_nethttp.Response, error) { - req, err := a.buildGetIPRangesRequest(ctx) - if err != nil { - var localVarReturnValue IPRanges - return localVarReturnValue, nil, err - } - - return a.getIPRangesExecute(req) -} - -// getIPRangesExecute executes the request. -func (a *IPRangesApi) getIPRangesExecute(r apiGetIPRangesRequest) (IPRanges, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IPRanges - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.IPRangesApi.GetIPRanges") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewIPRangesApi Returns NewIPRangesApi. -func NewIPRangesApi(client *common.APIClient) *IPRangesApi { - return &IPRangesApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_key_management.go b/api/v1/datadog/api_key_management.go deleted file mode 100644 index 9052cfa9092..00000000000 --- a/api/v1/datadog/api_key_management.go +++ /dev/null @@ -1,1443 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// KeyManagementApi service type -type KeyManagementApi common.Service - -type apiCreateAPIKeyRequest struct { - ctx _context.Context - body *ApiKey -} - -func (a *KeyManagementApi) buildCreateAPIKeyRequest(ctx _context.Context, body ApiKey) (apiCreateAPIKeyRequest, error) { - req := apiCreateAPIKeyRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateAPIKey Create an API key. -// Creates an API key with a given name. -func (a *KeyManagementApi) CreateAPIKey(ctx _context.Context, body ApiKey) (ApiKeyResponse, *_nethttp.Response, error) { - req, err := a.buildCreateAPIKeyRequest(ctx, body) - if err != nil { - var localVarReturnValue ApiKeyResponse - return localVarReturnValue, nil, err - } - - return a.createAPIKeyExecute(req) -} - -// createAPIKeyExecute executes the request. -func (a *KeyManagementApi) createAPIKeyExecute(r apiCreateAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue ApiKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.CreateAPIKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/api_key" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateApplicationKeyRequest struct { - ctx _context.Context - body *ApplicationKey -} - -func (a *KeyManagementApi) buildCreateApplicationKeyRequest(ctx _context.Context, body ApplicationKey) (apiCreateApplicationKeyRequest, error) { - req := apiCreateApplicationKeyRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateApplicationKey Create an application key. -// Create an application key with a given name. -func (a *KeyManagementApi) CreateApplicationKey(ctx _context.Context, body ApplicationKey) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildCreateApplicationKeyRequest(ctx, body) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.createApplicationKeyExecute(req) -} - -// createApplicationKeyExecute executes the request. -func (a *KeyManagementApi) createApplicationKeyExecute(r apiCreateApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.CreateApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/application_key" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteAPIKeyRequest struct { - ctx _context.Context - key string -} - -func (a *KeyManagementApi) buildDeleteAPIKeyRequest(ctx _context.Context, key string) (apiDeleteAPIKeyRequest, error) { - req := apiDeleteAPIKeyRequest{ - ctx: ctx, - key: key, - } - return req, nil -} - -// DeleteAPIKey Delete an API key. -// Delete a given API key. -func (a *KeyManagementApi) DeleteAPIKey(ctx _context.Context, key string) (ApiKeyResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteAPIKeyRequest(ctx, key) - if err != nil { - var localVarReturnValue ApiKeyResponse - return localVarReturnValue, nil, err - } - - return a.deleteAPIKeyExecute(req) -} - -// deleteAPIKeyExecute executes the request. -func (a *KeyManagementApi) deleteAPIKeyExecute(r apiDeleteAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue ApiKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.DeleteAPIKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/api_key/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteApplicationKeyRequest struct { - ctx _context.Context - key string -} - -func (a *KeyManagementApi) buildDeleteApplicationKeyRequest(ctx _context.Context, key string) (apiDeleteApplicationKeyRequest, error) { - req := apiDeleteApplicationKeyRequest{ - ctx: ctx, - key: key, - } - return req, nil -} - -// DeleteApplicationKey Delete an application key. -// Delete a given application key. -func (a *KeyManagementApi) DeleteApplicationKey(ctx _context.Context, key string) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteApplicationKeyRequest(ctx, key) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.deleteApplicationKeyExecute(req) -} - -// deleteApplicationKeyExecute executes the request. -func (a *KeyManagementApi) deleteApplicationKeyExecute(r apiDeleteApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.DeleteApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/application_key/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetAPIKeyRequest struct { - ctx _context.Context - key string -} - -func (a *KeyManagementApi) buildGetAPIKeyRequest(ctx _context.Context, key string) (apiGetAPIKeyRequest, error) { - req := apiGetAPIKeyRequest{ - ctx: ctx, - key: key, - } - return req, nil -} - -// GetAPIKey Get API key. -// Get a given API key. -func (a *KeyManagementApi) GetAPIKey(ctx _context.Context, key string) (ApiKeyResponse, *_nethttp.Response, error) { - req, err := a.buildGetAPIKeyRequest(ctx, key) - if err != nil { - var localVarReturnValue ApiKeyResponse - return localVarReturnValue, nil, err - } - - return a.getAPIKeyExecute(req) -} - -// getAPIKeyExecute executes the request. -func (a *KeyManagementApi) getAPIKeyExecute(r apiGetAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ApiKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.GetAPIKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/api_key/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetApplicationKeyRequest struct { - ctx _context.Context - key string -} - -func (a *KeyManagementApi) buildGetApplicationKeyRequest(ctx _context.Context, key string) (apiGetApplicationKeyRequest, error) { - req := apiGetApplicationKeyRequest{ - ctx: ctx, - key: key, - } - return req, nil -} - -// GetApplicationKey Get an application key. -// Get a given application key. -func (a *KeyManagementApi) GetApplicationKey(ctx _context.Context, key string) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildGetApplicationKeyRequest(ctx, key) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.getApplicationKeyExecute(req) -} - -// getApplicationKeyExecute executes the request. -func (a *KeyManagementApi) getApplicationKeyExecute(r apiGetApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.GetApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/application_key/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAPIKeysRequest struct { - ctx _context.Context -} - -func (a *KeyManagementApi) buildListAPIKeysRequest(ctx _context.Context) (apiListAPIKeysRequest, error) { - req := apiListAPIKeysRequest{ - ctx: ctx, - } - return req, nil -} - -// ListAPIKeys Get all API keys. -// Get all API keys available for your account. -func (a *KeyManagementApi) ListAPIKeys(ctx _context.Context) (ApiKeyListResponse, *_nethttp.Response, error) { - req, err := a.buildListAPIKeysRequest(ctx) - if err != nil { - var localVarReturnValue ApiKeyListResponse - return localVarReturnValue, nil, err - } - - return a.listAPIKeysExecute(req) -} - -// listAPIKeysExecute executes the request. -func (a *KeyManagementApi) listAPIKeysExecute(r apiListAPIKeysRequest) (ApiKeyListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ApiKeyListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.ListAPIKeys") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/api_key" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListApplicationKeysRequest struct { - ctx _context.Context -} - -func (a *KeyManagementApi) buildListApplicationKeysRequest(ctx _context.Context) (apiListApplicationKeysRequest, error) { - req := apiListApplicationKeysRequest{ - ctx: ctx, - } - return req, nil -} - -// ListApplicationKeys Get all application keys. -// Get all application keys available for your Datadog account. -func (a *KeyManagementApi) ListApplicationKeys(ctx _context.Context) (ApplicationKeyListResponse, *_nethttp.Response, error) { - req, err := a.buildListApplicationKeysRequest(ctx) - if err != nil { - var localVarReturnValue ApplicationKeyListResponse - return localVarReturnValue, nil, err - } - - return a.listApplicationKeysExecute(req) -} - -// listApplicationKeysExecute executes the request. -func (a *KeyManagementApi) listApplicationKeysExecute(r apiListApplicationKeysRequest) (ApplicationKeyListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ApplicationKeyListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.ListApplicationKeys") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/application_key" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateAPIKeyRequest struct { - ctx _context.Context - key string - body *ApiKey -} - -func (a *KeyManagementApi) buildUpdateAPIKeyRequest(ctx _context.Context, key string, body ApiKey) (apiUpdateAPIKeyRequest, error) { - req := apiUpdateAPIKeyRequest{ - ctx: ctx, - key: key, - body: &body, - } - return req, nil -} - -// UpdateAPIKey Edit an API key. -// Edit an API key name. -func (a *KeyManagementApi) UpdateAPIKey(ctx _context.Context, key string, body ApiKey) (ApiKeyResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateAPIKeyRequest(ctx, key, body) - if err != nil { - var localVarReturnValue ApiKeyResponse - return localVarReturnValue, nil, err - } - - return a.updateAPIKeyExecute(req) -} - -// updateAPIKeyExecute executes the request. -func (a *KeyManagementApi) updateAPIKeyExecute(r apiUpdateAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue ApiKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.UpdateAPIKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/api_key/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateApplicationKeyRequest struct { - ctx _context.Context - key string - body *ApplicationKey -} - -func (a *KeyManagementApi) buildUpdateApplicationKeyRequest(ctx _context.Context, key string, body ApplicationKey) (apiUpdateApplicationKeyRequest, error) { - req := apiUpdateApplicationKeyRequest{ - ctx: ctx, - key: key, - body: &body, - } - return req, nil -} - -// UpdateApplicationKey Edit an application key. -// Edit an application key name. -func (a *KeyManagementApi) UpdateApplicationKey(ctx _context.Context, key string, body ApplicationKey) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateApplicationKeyRequest(ctx, key, body) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.updateApplicationKeyExecute(req) -} - -// updateApplicationKeyExecute executes the request. -func (a *KeyManagementApi) updateApplicationKeyExecute(r apiUpdateApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.UpdateApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/application_key/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewKeyManagementApi Returns NewKeyManagementApi. -func NewKeyManagementApi(client *common.APIClient) *KeyManagementApi { - return &KeyManagementApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_logs.go b/api/v1/datadog/api_logs.go deleted file mode 100644 index 9d608353187..00000000000 --- a/api/v1/datadog/api_logs.go +++ /dev/null @@ -1,354 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsApi service type -type LogsApi common.Service - -type apiListLogsRequest struct { - ctx _context.Context - body *LogsListRequest -} - -func (a *LogsApi) buildListLogsRequest(ctx _context.Context, body LogsListRequest) (apiListLogsRequest, error) { - req := apiListLogsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// ListLogs Search logs. -// List endpoint returns logs that match a log search query. -// [Results are paginated][1]. -// -// **If you are considering archiving logs for your organization, -// consider use of the Datadog archive capabilities instead of the log list API. -// See [Datadog Logs Archive documentation][2].** -// -// [1]: /logs/guide/collect-multiple-logs-with-pagination -// [2]: https://docs.datadoghq.com/logs/archives -func (a *LogsApi) ListLogs(ctx _context.Context, body LogsListRequest) (LogsListResponse, *_nethttp.Response, error) { - req, err := a.buildListLogsRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsListResponse - return localVarReturnValue, nil, err - } - - return a.listLogsExecute(req) -} - -// listLogsExecute executes the request. -func (a *LogsApi) listLogsExecute(r apiListLogsRequest) (LogsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue LogsListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsApi.ListLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs-queries/list" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSubmitLogRequest struct { - ctx _context.Context - body *[]HTTPLogItem - contentEncoding *ContentEncoding - ddtags *string -} - -// SubmitLogOptionalParameters holds optional parameters for SubmitLog. -type SubmitLogOptionalParameters struct { - ContentEncoding *ContentEncoding - Ddtags *string -} - -// NewSubmitLogOptionalParameters creates an empty struct for parameters. -func NewSubmitLogOptionalParameters() *SubmitLogOptionalParameters { - this := SubmitLogOptionalParameters{} - return &this -} - -// WithContentEncoding sets the corresponding parameter name and returns the struct. -func (r *SubmitLogOptionalParameters) WithContentEncoding(contentEncoding ContentEncoding) *SubmitLogOptionalParameters { - r.ContentEncoding = &contentEncoding - return r -} - -// WithDdtags sets the corresponding parameter name and returns the struct. -func (r *SubmitLogOptionalParameters) WithDdtags(ddtags string) *SubmitLogOptionalParameters { - r.Ddtags = &ddtags - return r -} - -func (a *LogsApi) buildSubmitLogRequest(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (apiSubmitLogRequest, error) { - req := apiSubmitLogRequest{ - ctx: ctx, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SubmitLogOptionalParameters is allowed") - } - - if o != nil { - req.contentEncoding = o[0].ContentEncoding - req.ddtags = o[0].Ddtags - } - return req, nil -} - -// SubmitLog Send logs. -// Send your logs to your Datadog platform over HTTP. Limits per HTTP request are: -// -// - Maximum content size per payload (uncompressed): 5MB -// - Maximum size for a single log: 1MB -// - Maximum array size if sending multiple logs in an array: 1000 entries -// -// Any log exceeding 1MB is accepted and truncated by Datadog: -// - For a single log request, the API truncates the log at 1MB and returns a 2xx. -// - For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx. -// -// Datadog recommends sending your logs compressed. -// Add the `Content-Encoding: gzip` header to the request when sending compressed logs. -// -// The status codes answered by the HTTP API are: -// - 200: OK -// - 400: Bad request (likely an issue in the payload formatting) -// - 403: Permission issue (likely using an invalid API Key) -// - 413: Payload too large (batch is above 5MB uncompressed) -// - 5xx: Internal error, request should be retried after some time -func (a *LogsApi) SubmitLog(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (interface{}, *_nethttp.Response, error) { - req, err := a.buildSubmitLogRequest(ctx, body, o...) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.submitLogExecute(req) -} - -// submitLogExecute executes the request. -func (a *LogsApi) submitLogExecute(r apiSubmitLogRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsApi.SubmitLog") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/input" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - if r.ddtags != nil { - localVarQueryParams.Add("ddtags", common.ParameterToString(*r.ddtags, "")) - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - if r.contentEncoding != nil { - localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") - } - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v HTTPLogError - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewLogsApi Returns NewLogsApi. -func NewLogsApi(client *common.APIClient) *LogsApi { - return &LogsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_logs_indexes.go b/api/v1/datadog/api_logs_indexes.go deleted file mode 100644 index efc99536328..00000000000 --- a/api/v1/datadog/api_logs_indexes.go +++ /dev/null @@ -1,848 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsIndexesApi service type -type LogsIndexesApi common.Service - -type apiCreateLogsIndexRequest struct { - ctx _context.Context - body *LogsIndex -} - -func (a *LogsIndexesApi) buildCreateLogsIndexRequest(ctx _context.Context, body LogsIndex) (apiCreateLogsIndexRequest, error) { - req := apiCreateLogsIndexRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateLogsIndex Create an index. -// Creates a new index. Returns the Index object passed in the request body when the request is successful. -func (a *LogsIndexesApi) CreateLogsIndex(ctx _context.Context, body LogsIndex) (LogsIndex, *_nethttp.Response, error) { - req, err := a.buildCreateLogsIndexRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsIndex - return localVarReturnValue, nil, err - } - - return a.createLogsIndexExecute(req) -} - -// createLogsIndexExecute executes the request. -func (a *LogsIndexesApi) createLogsIndexExecute(r apiCreateLogsIndexRequest) (LogsIndex, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue LogsIndex - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.CreateLogsIndex") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/indexes" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetLogsIndexRequest struct { - ctx _context.Context - name string -} - -func (a *LogsIndexesApi) buildGetLogsIndexRequest(ctx _context.Context, name string) (apiGetLogsIndexRequest, error) { - req := apiGetLogsIndexRequest{ - ctx: ctx, - name: name, - } - return req, nil -} - -// GetLogsIndex Get an index. -// Get one log index from your organization. This endpoint takes no JSON arguments. -func (a *LogsIndexesApi) GetLogsIndex(ctx _context.Context, name string) (LogsIndex, *_nethttp.Response, error) { - req, err := a.buildGetLogsIndexRequest(ctx, name) - if err != nil { - var localVarReturnValue LogsIndex - return localVarReturnValue, nil, err - } - - return a.getLogsIndexExecute(req) -} - -// getLogsIndexExecute executes the request. -func (a *LogsIndexesApi) getLogsIndexExecute(r apiGetLogsIndexRequest) (LogsIndex, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsIndex - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.GetLogsIndex") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/indexes/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", _neturl.PathEscape(common.ParameterToString(r.name, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - var v LogsAPIErrorResponse - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetLogsIndexOrderRequest struct { - ctx _context.Context -} - -func (a *LogsIndexesApi) buildGetLogsIndexOrderRequest(ctx _context.Context) (apiGetLogsIndexOrderRequest, error) { - req := apiGetLogsIndexOrderRequest{ - ctx: ctx, - } - return req, nil -} - -// GetLogsIndexOrder Get indexes order. -// Get the current order of your log indexes. This endpoint takes no JSON arguments. -func (a *LogsIndexesApi) GetLogsIndexOrder(ctx _context.Context) (LogsIndexesOrder, *_nethttp.Response, error) { - req, err := a.buildGetLogsIndexOrderRequest(ctx) - if err != nil { - var localVarReturnValue LogsIndexesOrder - return localVarReturnValue, nil, err - } - - return a.getLogsIndexOrderExecute(req) -} - -// getLogsIndexOrderExecute executes the request. -func (a *LogsIndexesApi) getLogsIndexOrderExecute(r apiGetLogsIndexOrderRequest) (LogsIndexesOrder, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsIndexesOrder - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.GetLogsIndexOrder") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/index-order" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListLogIndexesRequest struct { - ctx _context.Context -} - -func (a *LogsIndexesApi) buildListLogIndexesRequest(ctx _context.Context) (apiListLogIndexesRequest, error) { - req := apiListLogIndexesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListLogIndexes Get all indexes. -// The Index object describes the configuration of a log index. -// This endpoint returns an array of the `LogIndex` objects of your organization. -func (a *LogsIndexesApi) ListLogIndexes(ctx _context.Context) (LogsIndexListResponse, *_nethttp.Response, error) { - req, err := a.buildListLogIndexesRequest(ctx) - if err != nil { - var localVarReturnValue LogsIndexListResponse - return localVarReturnValue, nil, err - } - - return a.listLogIndexesExecute(req) -} - -// listLogIndexesExecute executes the request. -func (a *LogsIndexesApi) listLogIndexesExecute(r apiListLogIndexesRequest) (LogsIndexListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsIndexListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.ListLogIndexes") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/indexes" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateLogsIndexRequest struct { - ctx _context.Context - name string - body *LogsIndexUpdateRequest -} - -func (a *LogsIndexesApi) buildUpdateLogsIndexRequest(ctx _context.Context, name string, body LogsIndexUpdateRequest) (apiUpdateLogsIndexRequest, error) { - req := apiUpdateLogsIndexRequest{ - ctx: ctx, - name: name, - body: &body, - } - return req, nil -} - -// UpdateLogsIndex Update an index. -// Update an index as identified by its name. -// Returns the Index object passed in the request body when the request is successful. -// -// Using the `PUT` method updates your index’s configuration by **replacing** -// your current configuration with the new one sent to your Datadog organization. -func (a *LogsIndexesApi) UpdateLogsIndex(ctx _context.Context, name string, body LogsIndexUpdateRequest) (LogsIndex, *_nethttp.Response, error) { - req, err := a.buildUpdateLogsIndexRequest(ctx, name, body) - if err != nil { - var localVarReturnValue LogsIndex - return localVarReturnValue, nil, err - } - - return a.updateLogsIndexExecute(req) -} - -// updateLogsIndexExecute executes the request. -func (a *LogsIndexesApi) updateLogsIndexExecute(r apiUpdateLogsIndexRequest) (LogsIndex, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue LogsIndex - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.UpdateLogsIndex") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/indexes/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", _neturl.PathEscape(common.ParameterToString(r.name, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 429 { - var v LogsAPIErrorResponse - 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateLogsIndexOrderRequest struct { - ctx _context.Context - body *LogsIndexesOrder -} - -func (a *LogsIndexesApi) buildUpdateLogsIndexOrderRequest(ctx _context.Context, body LogsIndexesOrder) (apiUpdateLogsIndexOrderRequest, error) { - req := apiUpdateLogsIndexOrderRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// UpdateLogsIndexOrder Update indexes order. -// This endpoint updates the index order of your organization. -// It returns the index order object passed in the request body when the request is successful. -func (a *LogsIndexesApi) UpdateLogsIndexOrder(ctx _context.Context, body LogsIndexesOrder) (LogsIndexesOrder, *_nethttp.Response, error) { - req, err := a.buildUpdateLogsIndexOrderRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsIndexesOrder - return localVarReturnValue, nil, err - } - - return a.updateLogsIndexOrderExecute(req) -} - -// updateLogsIndexOrderExecute executes the request. -func (a *LogsIndexesApi) updateLogsIndexOrderExecute(r apiUpdateLogsIndexOrderRequest) (LogsIndexesOrder, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue LogsIndexesOrder - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.UpdateLogsIndexOrder") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/index-order" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewLogsIndexesApi Returns NewLogsIndexesApi. -func NewLogsIndexesApi(client *common.APIClient) *LogsIndexesApi { - return &LogsIndexesApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_logs_pipelines.go b/api/v1/datadog/api_logs_pipelines.go deleted file mode 100644 index 80682e0c95d..00000000000 --- a/api/v1/datadog/api_logs_pipelines.go +++ /dev/null @@ -1,988 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsPipelinesApi service type -type LogsPipelinesApi common.Service - -type apiCreateLogsPipelineRequest struct { - ctx _context.Context - body *LogsPipeline -} - -func (a *LogsPipelinesApi) buildCreateLogsPipelineRequest(ctx _context.Context, body LogsPipeline) (apiCreateLogsPipelineRequest, error) { - req := apiCreateLogsPipelineRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateLogsPipeline Create a pipeline. -// Create a pipeline in your organization. -func (a *LogsPipelinesApi) CreateLogsPipeline(ctx _context.Context, body LogsPipeline) (LogsPipeline, *_nethttp.Response, error) { - req, err := a.buildCreateLogsPipelineRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsPipeline - return localVarReturnValue, nil, err - } - - return a.createLogsPipelineExecute(req) -} - -// createLogsPipelineExecute executes the request. -func (a *LogsPipelinesApi) createLogsPipelineExecute(r apiCreateLogsPipelineRequest) (LogsPipeline, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue LogsPipeline - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.CreateLogsPipeline") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/pipelines" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteLogsPipelineRequest struct { - ctx _context.Context - pipelineId string -} - -func (a *LogsPipelinesApi) buildDeleteLogsPipelineRequest(ctx _context.Context, pipelineId string) (apiDeleteLogsPipelineRequest, error) { - req := apiDeleteLogsPipelineRequest{ - ctx: ctx, - pipelineId: pipelineId, - } - return req, nil -} - -// DeleteLogsPipeline Delete a pipeline. -// Delete a given pipeline from your organization. -// This endpoint takes no JSON arguments. -func (a *LogsPipelinesApi) DeleteLogsPipeline(ctx _context.Context, pipelineId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteLogsPipelineRequest(ctx, pipelineId) - if err != nil { - return nil, err - } - - return a.deleteLogsPipelineExecute(req) -} - -// deleteLogsPipelineExecute executes the request. -func (a *LogsPipelinesApi) deleteLogsPipelineExecute(r apiDeleteLogsPipelineRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.DeleteLogsPipeline") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/pipelines/{pipeline_id}" - localVarPath = strings.Replace(localVarPath, "{"+"pipeline_id"+"}", _neturl.PathEscape(common.ParameterToString(r.pipelineId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetLogsPipelineRequest struct { - ctx _context.Context - pipelineId string -} - -func (a *LogsPipelinesApi) buildGetLogsPipelineRequest(ctx _context.Context, pipelineId string) (apiGetLogsPipelineRequest, error) { - req := apiGetLogsPipelineRequest{ - ctx: ctx, - pipelineId: pipelineId, - } - return req, nil -} - -// GetLogsPipeline Get a pipeline. -// Get a specific pipeline from your organization. -// This endpoint takes no JSON arguments. -func (a *LogsPipelinesApi) GetLogsPipeline(ctx _context.Context, pipelineId string) (LogsPipeline, *_nethttp.Response, error) { - req, err := a.buildGetLogsPipelineRequest(ctx, pipelineId) - if err != nil { - var localVarReturnValue LogsPipeline - return localVarReturnValue, nil, err - } - - return a.getLogsPipelineExecute(req) -} - -// getLogsPipelineExecute executes the request. -func (a *LogsPipelinesApi) getLogsPipelineExecute(r apiGetLogsPipelineRequest) (LogsPipeline, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsPipeline - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.GetLogsPipeline") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/pipelines/{pipeline_id}" - localVarPath = strings.Replace(localVarPath, "{"+"pipeline_id"+"}", _neturl.PathEscape(common.ParameterToString(r.pipelineId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetLogsPipelineOrderRequest struct { - ctx _context.Context -} - -func (a *LogsPipelinesApi) buildGetLogsPipelineOrderRequest(ctx _context.Context) (apiGetLogsPipelineOrderRequest, error) { - req := apiGetLogsPipelineOrderRequest{ - ctx: ctx, - } - return req, nil -} - -// GetLogsPipelineOrder Get pipeline order. -// Get the current order of your pipelines. -// This endpoint takes no JSON arguments. -func (a *LogsPipelinesApi) GetLogsPipelineOrder(ctx _context.Context) (LogsPipelinesOrder, *_nethttp.Response, error) { - req, err := a.buildGetLogsPipelineOrderRequest(ctx) - if err != nil { - var localVarReturnValue LogsPipelinesOrder - return localVarReturnValue, nil, err - } - - return a.getLogsPipelineOrderExecute(req) -} - -// getLogsPipelineOrderExecute executes the request. -func (a *LogsPipelinesApi) getLogsPipelineOrderExecute(r apiGetLogsPipelineOrderRequest) (LogsPipelinesOrder, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsPipelinesOrder - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.GetLogsPipelineOrder") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/pipeline-order" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListLogsPipelinesRequest struct { - ctx _context.Context -} - -func (a *LogsPipelinesApi) buildListLogsPipelinesRequest(ctx _context.Context) (apiListLogsPipelinesRequest, error) { - req := apiListLogsPipelinesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListLogsPipelines Get all pipelines. -// Get all pipelines from your organization. -// This endpoint takes no JSON arguments. -func (a *LogsPipelinesApi) ListLogsPipelines(ctx _context.Context) ([]LogsPipeline, *_nethttp.Response, error) { - req, err := a.buildListLogsPipelinesRequest(ctx) - if err != nil { - var localVarReturnValue []LogsPipeline - return localVarReturnValue, nil, err - } - - return a.listLogsPipelinesExecute(req) -} - -// listLogsPipelinesExecute executes the request. -func (a *LogsPipelinesApi) listLogsPipelinesExecute(r apiListLogsPipelinesRequest) ([]LogsPipeline, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []LogsPipeline - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.ListLogsPipelines") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/pipelines" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateLogsPipelineRequest struct { - ctx _context.Context - pipelineId string - body *LogsPipeline -} - -func (a *LogsPipelinesApi) buildUpdateLogsPipelineRequest(ctx _context.Context, pipelineId string, body LogsPipeline) (apiUpdateLogsPipelineRequest, error) { - req := apiUpdateLogsPipelineRequest{ - ctx: ctx, - pipelineId: pipelineId, - body: &body, - } - return req, nil -} - -// UpdateLogsPipeline Update a pipeline. -// Update a given pipeline configuration to change it’s processors or their order. -// -// **Note**: Using this method updates your pipeline configuration by **replacing** -// your current configuration with the new one sent to your Datadog organization. -func (a *LogsPipelinesApi) UpdateLogsPipeline(ctx _context.Context, pipelineId string, body LogsPipeline) (LogsPipeline, *_nethttp.Response, error) { - req, err := a.buildUpdateLogsPipelineRequest(ctx, pipelineId, body) - if err != nil { - var localVarReturnValue LogsPipeline - return localVarReturnValue, nil, err - } - - return a.updateLogsPipelineExecute(req) -} - -// updateLogsPipelineExecute executes the request. -func (a *LogsPipelinesApi) updateLogsPipelineExecute(r apiUpdateLogsPipelineRequest) (LogsPipeline, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue LogsPipeline - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.UpdateLogsPipeline") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/pipelines/{pipeline_id}" - localVarPath = strings.Replace(localVarPath, "{"+"pipeline_id"+"}", _neturl.PathEscape(common.ParameterToString(r.pipelineId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateLogsPipelineOrderRequest struct { - ctx _context.Context - body *LogsPipelinesOrder -} - -func (a *LogsPipelinesApi) buildUpdateLogsPipelineOrderRequest(ctx _context.Context, body LogsPipelinesOrder) (apiUpdateLogsPipelineOrderRequest, error) { - req := apiUpdateLogsPipelineOrderRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// UpdateLogsPipelineOrder Update pipeline order. -// Update the order of your pipelines. Since logs are processed sequentially, reordering a pipeline may change -// the structure and content of the data processed by other pipelines and their processors. -// -// **Note**: Using the `PUT` method updates your pipeline order by replacing your current order -// with the new one sent to your Datadog organization. -func (a *LogsPipelinesApi) UpdateLogsPipelineOrder(ctx _context.Context, body LogsPipelinesOrder) (LogsPipelinesOrder, *_nethttp.Response, error) { - req, err := a.buildUpdateLogsPipelineOrderRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsPipelinesOrder - return localVarReturnValue, nil, err - } - - return a.updateLogsPipelineOrderExecute(req) -} - -// updateLogsPipelineOrderExecute executes the request. -func (a *LogsPipelinesApi) updateLogsPipelineOrderExecute(r apiUpdateLogsPipelineOrderRequest) (LogsPipelinesOrder, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue LogsPipelinesOrder - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.UpdateLogsPipelineOrder") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/logs/config/pipeline-order" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v LogsAPIErrorResponse - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 422 { - var v LogsAPIErrorResponse - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewLogsPipelinesApi Returns NewLogsPipelinesApi. -func NewLogsPipelinesApi(client *common.APIClient) *LogsPipelinesApi { - return &LogsPipelinesApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_metrics.go b/api/v1/datadog/api_metrics.go deleted file mode 100644 index 720f46c6549..00000000000 --- a/api/v1/datadog/api_metrics.go +++ /dev/null @@ -1,1152 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MetricsApi service type -type MetricsApi common.Service - -type apiGetMetricMetadataRequest struct { - ctx _context.Context - metricName string -} - -func (a *MetricsApi) buildGetMetricMetadataRequest(ctx _context.Context, metricName string) (apiGetMetricMetadataRequest, error) { - req := apiGetMetricMetadataRequest{ - ctx: ctx, - metricName: metricName, - } - return req, nil -} - -// GetMetricMetadata Get metric metadata. -// Get metadata about a specific metric. -func (a *MetricsApi) GetMetricMetadata(ctx _context.Context, metricName string) (MetricMetadata, *_nethttp.Response, error) { - req, err := a.buildGetMetricMetadataRequest(ctx, metricName) - if err != nil { - var localVarReturnValue MetricMetadata - return localVarReturnValue, nil, err - } - - return a.getMetricMetadataExecute(req) -} - -// getMetricMetadataExecute executes the request. -func (a *MetricsApi) getMetricMetadataExecute(r apiGetMetricMetadataRequest) (MetricMetadata, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricMetadata - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.GetMetricMetadata") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/metrics/{metric_name}" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListActiveMetricsRequest struct { - ctx _context.Context - from *int64 - host *string - tagFilter *string -} - -// ListActiveMetricsOptionalParameters holds optional parameters for ListActiveMetrics. -type ListActiveMetricsOptionalParameters struct { - Host *string - TagFilter *string -} - -// NewListActiveMetricsOptionalParameters creates an empty struct for parameters. -func NewListActiveMetricsOptionalParameters() *ListActiveMetricsOptionalParameters { - this := ListActiveMetricsOptionalParameters{} - return &this -} - -// WithHost sets the corresponding parameter name and returns the struct. -func (r *ListActiveMetricsOptionalParameters) WithHost(host string) *ListActiveMetricsOptionalParameters { - r.Host = &host - return r -} - -// WithTagFilter sets the corresponding parameter name and returns the struct. -func (r *ListActiveMetricsOptionalParameters) WithTagFilter(tagFilter string) *ListActiveMetricsOptionalParameters { - r.TagFilter = &tagFilter - return r -} - -func (a *MetricsApi) buildListActiveMetricsRequest(ctx _context.Context, from int64, o ...ListActiveMetricsOptionalParameters) (apiListActiveMetricsRequest, error) { - req := apiListActiveMetricsRequest{ - ctx: ctx, - from: &from, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListActiveMetricsOptionalParameters is allowed") - } - - if o != nil { - req.host = o[0].Host - req.tagFilter = o[0].TagFilter - } - return req, nil -} - -// ListActiveMetrics Get active metrics list. -// Get the list of actively reporting metrics from a given time until now. -func (a *MetricsApi) ListActiveMetrics(ctx _context.Context, from int64, o ...ListActiveMetricsOptionalParameters) (MetricsListResponse, *_nethttp.Response, error) { - req, err := a.buildListActiveMetricsRequest(ctx, from, o...) - if err != nil { - var localVarReturnValue MetricsListResponse - return localVarReturnValue, nil, err - } - - return a.listActiveMetricsExecute(req) -} - -// listActiveMetricsExecute executes the request. -func (a *MetricsApi) listActiveMetricsExecute(r apiListActiveMetricsRequest) (MetricsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricsListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.ListActiveMetrics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/metrics" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.from == nil { - return localVarReturnValue, nil, common.ReportError("from is required and must be specified") - } - localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) - if r.host != nil { - localVarQueryParams.Add("host", common.ParameterToString(*r.host, "")) - } - if r.tagFilter != nil { - localVarQueryParams.Add("tag_filter", common.ParameterToString(*r.tagFilter, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListMetricsRequest struct { - ctx _context.Context - q *string -} - -func (a *MetricsApi) buildListMetricsRequest(ctx _context.Context, q string) (apiListMetricsRequest, error) { - req := apiListMetricsRequest{ - ctx: ctx, - q: &q, - } - return req, nil -} - -// ListMetrics Search metrics. -// Search for metrics from the last 24 hours in Datadog. -func (a *MetricsApi) ListMetrics(ctx _context.Context, q string) (MetricSearchResponse, *_nethttp.Response, error) { - req, err := a.buildListMetricsRequest(ctx, q) - if err != nil { - var localVarReturnValue MetricSearchResponse - return localVarReturnValue, nil, err - } - - return a.listMetricsExecute(req) -} - -// listMetricsExecute executes the request. -func (a *MetricsApi) listMetricsExecute(r apiListMetricsRequest) (MetricSearchResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricSearchResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.ListMetrics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.q == nil { - return localVarReturnValue, nil, common.ReportError("q is required and must be specified") - } - localVarQueryParams.Add("q", common.ParameterToString(*r.q, "")) - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiQueryMetricsRequest struct { - ctx _context.Context - from *int64 - to *int64 - query *string -} - -func (a *MetricsApi) buildQueryMetricsRequest(ctx _context.Context, from int64, to int64, query string) (apiQueryMetricsRequest, error) { - req := apiQueryMetricsRequest{ - ctx: ctx, - from: &from, - to: &to, - query: &query, - } - return req, nil -} - -// QueryMetrics Query timeseries points. -// Query timeseries points. -func (a *MetricsApi) QueryMetrics(ctx _context.Context, from int64, to int64, query string) (MetricsQueryResponse, *_nethttp.Response, error) { - req, err := a.buildQueryMetricsRequest(ctx, from, to, query) - if err != nil { - var localVarReturnValue MetricsQueryResponse - return localVarReturnValue, nil, err - } - - return a.queryMetricsExecute(req) -} - -// queryMetricsExecute executes the request. -func (a *MetricsApi) queryMetricsExecute(r apiQueryMetricsRequest) (MetricsQueryResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricsQueryResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.QueryMetrics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/query" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.from == nil { - return localVarReturnValue, nil, common.ReportError("from is required and must be specified") - } - if r.to == nil { - return localVarReturnValue, nil, common.ReportError("to is required and must be specified") - } - if r.query == nil { - return localVarReturnValue, nil, common.ReportError("query is required and must be specified") - } - localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) - localVarQueryParams.Add("to", common.ParameterToString(*r.to, "")) - localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSubmitDistributionPointsRequest struct { - ctx _context.Context - body *DistributionPointsPayload - contentEncoding *DistributionPointsContentEncoding -} - -// SubmitDistributionPointsOptionalParameters holds optional parameters for SubmitDistributionPoints. -type SubmitDistributionPointsOptionalParameters struct { - ContentEncoding *DistributionPointsContentEncoding -} - -// NewSubmitDistributionPointsOptionalParameters creates an empty struct for parameters. -func NewSubmitDistributionPointsOptionalParameters() *SubmitDistributionPointsOptionalParameters { - this := SubmitDistributionPointsOptionalParameters{} - return &this -} - -// WithContentEncoding sets the corresponding parameter name and returns the struct. -func (r *SubmitDistributionPointsOptionalParameters) WithContentEncoding(contentEncoding DistributionPointsContentEncoding) *SubmitDistributionPointsOptionalParameters { - r.ContentEncoding = &contentEncoding - return r -} - -func (a *MetricsApi) buildSubmitDistributionPointsRequest(ctx _context.Context, body DistributionPointsPayload, o ...SubmitDistributionPointsOptionalParameters) (apiSubmitDistributionPointsRequest, error) { - req := apiSubmitDistributionPointsRequest{ - ctx: ctx, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SubmitDistributionPointsOptionalParameters is allowed") - } - - if o != nil { - req.contentEncoding = o[0].ContentEncoding - } - return req, nil -} - -// SubmitDistributionPoints Submit distribution points. -// The distribution points end-point allows you to post distribution data that can be graphed on Datadog’s dashboards. -func (a *MetricsApi) SubmitDistributionPoints(ctx _context.Context, body DistributionPointsPayload, o ...SubmitDistributionPointsOptionalParameters) (IntakePayloadAccepted, *_nethttp.Response, error) { - req, err := a.buildSubmitDistributionPointsRequest(ctx, body, o...) - if err != nil { - var localVarReturnValue IntakePayloadAccepted - return localVarReturnValue, nil, err - } - - return a.submitDistributionPointsExecute(req) -} - -// submitDistributionPointsExecute executes the request. -func (a *MetricsApi) submitDistributionPointsExecute(r apiSubmitDistributionPointsRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IntakePayloadAccepted - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.SubmitDistributionPoints") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/distribution_points" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "text/json" - localVarHeaderParams["Accept"] = "application/json" - - if r.contentEncoding != nil { - localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") - } - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 408 { - 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 - } - if localVarHTTPResponse.StatusCode == 413 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSubmitMetricsRequest struct { - ctx _context.Context - body *MetricsPayload - contentEncoding *MetricContentEncoding -} - -// SubmitMetricsOptionalParameters holds optional parameters for SubmitMetrics. -type SubmitMetricsOptionalParameters struct { - ContentEncoding *MetricContentEncoding -} - -// NewSubmitMetricsOptionalParameters creates an empty struct for parameters. -func NewSubmitMetricsOptionalParameters() *SubmitMetricsOptionalParameters { - this := SubmitMetricsOptionalParameters{} - return &this -} - -// WithContentEncoding sets the corresponding parameter name and returns the struct. -func (r *SubmitMetricsOptionalParameters) WithContentEncoding(contentEncoding MetricContentEncoding) *SubmitMetricsOptionalParameters { - r.ContentEncoding = &contentEncoding - return r -} - -func (a *MetricsApi) buildSubmitMetricsRequest(ctx _context.Context, body MetricsPayload, o ...SubmitMetricsOptionalParameters) (apiSubmitMetricsRequest, error) { - req := apiSubmitMetricsRequest{ - ctx: ctx, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SubmitMetricsOptionalParameters is allowed") - } - - if o != nil { - req.contentEncoding = o[0].ContentEncoding - } - return req, nil -} - -// SubmitMetrics Submit metrics. -// The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. -// The maximum payload size is 3.2 megabytes (3200000 bytes). Compressed payloads must have a decompressed size of less than 62 megabytes (62914560 bytes). -// -// If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect: -// -// - 64 bits for the timestamp -// - 64 bits for the value -// - 40 bytes for the metric names -// - 50 bytes for the timeseries -// - The full payload is approximately 100 bytes. However, with the DogStatsD API, -// compression is applied, which reduces the payload size. -func (a *MetricsApi) SubmitMetrics(ctx _context.Context, body MetricsPayload, o ...SubmitMetricsOptionalParameters) (IntakePayloadAccepted, *_nethttp.Response, error) { - req, err := a.buildSubmitMetricsRequest(ctx, body, o...) - if err != nil { - var localVarReturnValue IntakePayloadAccepted - return localVarReturnValue, nil, err - } - - return a.submitMetricsExecute(req) -} - -// submitMetricsExecute executes the request. -func (a *MetricsApi) submitMetricsExecute(r apiSubmitMetricsRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IntakePayloadAccepted - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.SubmitMetrics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/series" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "text/json" - localVarHeaderParams["Accept"] = "application/json" - - if r.contentEncoding != nil { - localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") - } - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 408 { - 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 - } - if localVarHTTPResponse.StatusCode == 413 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateMetricMetadataRequest struct { - ctx _context.Context - metricName string - body *MetricMetadata -} - -func (a *MetricsApi) buildUpdateMetricMetadataRequest(ctx _context.Context, metricName string, body MetricMetadata) (apiUpdateMetricMetadataRequest, error) { - req := apiUpdateMetricMetadataRequest{ - ctx: ctx, - metricName: metricName, - body: &body, - } - return req, nil -} - -// UpdateMetricMetadata Edit metric metadata. -// Edit metadata of a specific metric. Find out more about [supported types](https://docs.datadoghq.com/developers/metrics). -func (a *MetricsApi) UpdateMetricMetadata(ctx _context.Context, metricName string, body MetricMetadata) (MetricMetadata, *_nethttp.Response, error) { - req, err := a.buildUpdateMetricMetadataRequest(ctx, metricName, body) - if err != nil { - var localVarReturnValue MetricMetadata - return localVarReturnValue, nil, err - } - - return a.updateMetricMetadataExecute(req) -} - -// updateMetricMetadataExecute executes the request. -func (a *MetricsApi) updateMetricMetadataExecute(r apiUpdateMetricMetadataRequest) (MetricMetadata, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue MetricMetadata - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.UpdateMetricMetadata") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/metrics/{metric_name}" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewMetricsApi Returns NewMetricsApi. -func NewMetricsApi(client *common.APIClient) *MetricsApi { - return &MetricsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_monitors.go b/api/v1/datadog/api_monitors.go deleted file mode 100644 index c4124710d72..00000000000 --- a/api/v1/datadog/api_monitors.go +++ /dev/null @@ -1,1953 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonitorsApi service type -type MonitorsApi common.Service - -type apiCheckCanDeleteMonitorRequest struct { - ctx _context.Context - monitorIds *[]int64 -} - -func (a *MonitorsApi) buildCheckCanDeleteMonitorRequest(ctx _context.Context, monitorIds []int64) (apiCheckCanDeleteMonitorRequest, error) { - req := apiCheckCanDeleteMonitorRequest{ - ctx: ctx, - monitorIds: &monitorIds, - } - return req, nil -} - -// CheckCanDeleteMonitor Check if a monitor can be deleted. -// Check if the given monitors can be deleted. -func (a *MonitorsApi) CheckCanDeleteMonitor(ctx _context.Context, monitorIds []int64) (CheckCanDeleteMonitorResponse, *_nethttp.Response, error) { - req, err := a.buildCheckCanDeleteMonitorRequest(ctx, monitorIds) - if err != nil { - var localVarReturnValue CheckCanDeleteMonitorResponse - return localVarReturnValue, nil, err - } - - return a.checkCanDeleteMonitorExecute(req) -} - -// checkCanDeleteMonitorExecute executes the request. -func (a *MonitorsApi) checkCanDeleteMonitorExecute(r apiCheckCanDeleteMonitorRequest) (CheckCanDeleteMonitorResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue CheckCanDeleteMonitorResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.CheckCanDeleteMonitor") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/can_delete" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.monitorIds == nil { - return localVarReturnValue, nil, common.ReportError("monitorIds is required and must be specified") - } - localVarQueryParams.Add("monitor_ids", common.ParameterToString(*r.monitorIds, "csv")) - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v CheckCanDeleteMonitorResponse - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateMonitorRequest struct { - ctx _context.Context - body *Monitor -} - -func (a *MonitorsApi) buildCreateMonitorRequest(ctx _context.Context, body Monitor) (apiCreateMonitorRequest, error) { - req := apiCreateMonitorRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateMonitor Create a monitor. -// Create a monitor using the specified options. -// -// #### Monitor Types -// -// The type of monitor chosen from: -// -// - anomaly: `query alert` -// - APM: `query alert` or `trace-analytics alert` -// - composite: `composite` -// - custom: `service check` -// - event: `event alert` -// - forecast: `query alert` -// - host: `service check` -// - integration: `query alert` or `service check` -// - live process: `process alert` -// - logs: `log alert` -// - metric: `query alert` -// - network: `service check` -// - outlier: `query alert` -// - process: `service check` -// - rum: `rum alert` -// - SLO: `slo alert` -// - watchdog: `event alert` -// - event-v2: `event-v2 alert` -// - audit: `audit alert` -// - error-tracking: `error-tracking alert` -// -// #### Query Types -// -// **Metric Alert Query** -// -// Example: `time_aggr(time_window):space_aggr:metric{tags} [by {key}] operator #` -// -// - `time_aggr`: avg, sum, max, min, change, or pct_change -// - `time_window`: `last_#m` (with `#` between 1 and 10080 depending on the monitor type) or `last_#h`(with `#` between 1 and 168 depending on the monitor type) or `last_1d`, or `last_1w` -// - `space_aggr`: avg, sum, min, or max -// - `tags`: one or more tags (comma-separated), or * -// - `key`: a 'key' in key:value tag syntax; defines a separate alert for each tag in the group (multi-alert) -// - `operator`: <, <=, >, >=, ==, or != -// - `#`: an integer or decimal number used to set the threshold -// -// If you are using the `_change_` or `_pct_change_` time aggregator, instead use `change_aggr(time_aggr(time_window), -// timeshift):space_aggr:metric{tags} [by {key}] operator #` with: -// -// - `change_aggr` change, pct_change -// - `time_aggr` avg, sum, max, min [Learn more](https://docs.datadoghq.com/monitors/create/types/#define-the-conditions) -// - `time_window` last\_#m (between 1 and 2880 depending on the monitor type), last\_#h (between 1 and 48 depending on the monitor type), or last_#d (1 or 2) -// - `timeshift` #m_ago (5, 10, 15, or 30), #h_ago (1, 2, or 4), or 1d_ago -// -// Use this to create an outlier monitor using the following query: -// `avg(last_30m):outliers(avg:system.cpu.user{role:es-events-data} by {host}, 'dbscan', 7) > 0` -// -// **Service Check Query** -// -// Example: `"check".over(tags).last(count).by(group).count_by_status()` -// -// - `check` name of the check, for example `datadog.agent.up` -// - `tags` one or more quoted tags (comma-separated), or "*". for example: `.over("env:prod", "role:db")`; `over` cannot be blank. -// - `count` must be at greater than or equal to your max threshold (defined in the `options`). It is limited to 100. -// For example, if you've specified to notify on 1 critical, 3 ok, and 2 warn statuses, `count` should be at least 3. -// - `group` must be specified for check monitors. Per-check grouping is already explicitly known for some service checks. -// For example, Postgres integration monitors are tagged by `db`, `host`, and `port`, and Network monitors by `host`, `instance`, and `url`. See [Service Checks](https://docs.datadoghq.com/api/latest/service-checks/) documentation for more information. -// -// **Event Alert Query** -// -// Example: `events('sources:nagios status:error,warning priority:normal tags: "string query"').rollup("count").last("1h")"` -// -// - `event`, the event query string: -// - `string_query` free text query to match against event title and text. -// - `sources` event sources (comma-separated). -// - `status` event statuses (comma-separated). Valid options: error, warn, and info. -// - `priority` event priorities (comma-separated). Valid options: low, normal, all. -// - `host` event reporting host (comma-separated). -// - `tags` event tags (comma-separated). -// - `excluded_tags` excluded event tags (comma-separated). -// - `rollup` the stats roll-up method. `count` is the only supported method now. -// - `last` the timeframe to roll up the counts. Examples: 45m, 4h. Supported timeframes: m, h and d. This value should not exceed 48 hours. -// -// **NOTE** The Event Alert Query is being deprecated and replaced by the Event V2 Alert Query. For more information, see the [Event Migration guide](https://docs.datadoghq.com/events/guides/migrating_to_new_events_features/). -// -// **Event V2 Alert Query** -// -// Example: `events(query).rollup(rollup_method[, measure]).last(time_window) operator #` -// -// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). -// - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. -// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. -// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). -// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. -// - `#` an integer or decimal number used to set the threshold. -// -// **Process Alert Query** -// -// Example: `processes(search).over(tags).rollup('count').last(timeframe) operator #` -// -// - `search` free text search string for querying processes. -// Matching processes match results on the [Live Processes](https://docs.datadoghq.com/infrastructure/process/?tab=linuxwindows) page. -// - `tags` one or more tags (comma-separated) -// - `timeframe` the timeframe to roll up the counts. Examples: 10m, 4h. Supported timeframes: s, m, h and d -// - `operator` <, <=, >, >=, ==, or != -// - `#` an integer or decimal number used to set the threshold -// -// **Logs Alert Query** -// -// Example: `logs(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #` -// -// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). -// - `index_name` For multi-index organizations, the log index in which the request is performed. -// - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. -// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. -// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). -// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. -// - `#` an integer or decimal number used to set the threshold. -// -// **Composite Query** -// -// Example: `12345 && 67890`, where `12345` and `67890` are the IDs of non-composite monitors -// -// * `name` [*required*, *default* = **dynamic, based on query**]: The name of the alert. -// * `message` [*required*, *default* = **dynamic, based on query**]: A message to include with notifications for this monitor. -// Email notifications can be sent to specific users by using the same '@username' notation as events. -// * `tags` [*optional*, *default* = **empty list**]: A list of tags to associate with your monitor. -// When getting all monitor details via the API, use the `monitor_tags` argument to filter results by these tags. -// It is only available via the API and isn't visible or editable in the Datadog UI. -// -// **SLO Alert Query** -// -// Example: `error_budget("slo_id").over("time_window") operator #` -// -// - `slo_id`: The alphanumeric SLO ID of the SLO you are configuring the alert for. -// - `time_window`: The time window of the SLO target you wish to alert on. Valid options: `7d`, `30d`, `90d`. -// - `operator`: `>=` or `>` -// -// **Audit Alert Query** -// -// Example: `audits(query).rollup(rollup_method[, measure]).last(time_window) operator #` -// -// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). -// - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. -// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. -// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). -// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. -// - `#` an integer or decimal number used to set the threshold. -// -// **NOTE** Only available on US1-FED and in closed beta on US1, EU, US3, and US5. -// -// **CI Pipelines Alert Query** -// -// Example: `ci-pipelines(query).rollup(rollup_method[, measure]).last(time_window) operator #` -// -// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). -// - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. -// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. -// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). -// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. -// - `#` an integer or decimal number used to set the threshold. -// -// **NOTE** CI Pipeline monitors are in alpha on US1, EU, US3 and US5. -// -// **CI Tests Alert Query** -// -// Example: `ci-tests(query).rollup(rollup_method[, measure]).last(time_window) operator #` -// -// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). -// - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. -// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. -// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). -// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. -// - `#` an integer or decimal number used to set the threshold. -// -// **NOTE** CI Test monitors are available only in closed beta on US1, EU, US3 and US5. -// -// **Error Tracking Alert Query** -// -// Example(RUM): `error-tracking-rum(query).rollup(rollup_method[, measure]).last(time_window) operator #` -// Example(APM Traces): `error-tracking-traces(query).rollup(rollup_method[, measure]).last(time_window) operator #` -// -// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). -// - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. -// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. -// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). -// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. -// - `#` an integer or decimal number used to set the threshold. -func (a *MonitorsApi) CreateMonitor(ctx _context.Context, body Monitor) (Monitor, *_nethttp.Response, error) { - req, err := a.buildCreateMonitorRequest(ctx, body) - if err != nil { - var localVarReturnValue Monitor - return localVarReturnValue, nil, err - } - - return a.createMonitorExecute(req) -} - -// createMonitorExecute executes the request. -func (a *MonitorsApi) createMonitorExecute(r apiCreateMonitorRequest) (Monitor, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue Monitor - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.CreateMonitor") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteMonitorRequest struct { - ctx _context.Context - monitorId int64 - force *string -} - -// DeleteMonitorOptionalParameters holds optional parameters for DeleteMonitor. -type DeleteMonitorOptionalParameters struct { - Force *string -} - -// NewDeleteMonitorOptionalParameters creates an empty struct for parameters. -func NewDeleteMonitorOptionalParameters() *DeleteMonitorOptionalParameters { - this := DeleteMonitorOptionalParameters{} - return &this -} - -// WithForce sets the corresponding parameter name and returns the struct. -func (r *DeleteMonitorOptionalParameters) WithForce(force string) *DeleteMonitorOptionalParameters { - r.Force = &force - return r -} - -func (a *MonitorsApi) buildDeleteMonitorRequest(ctx _context.Context, monitorId int64, o ...DeleteMonitorOptionalParameters) (apiDeleteMonitorRequest, error) { - req := apiDeleteMonitorRequest{ - ctx: ctx, - monitorId: monitorId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type DeleteMonitorOptionalParameters is allowed") - } - - if o != nil { - req.force = o[0].Force - } - return req, nil -} - -// DeleteMonitor Delete a monitor. -// Delete the specified monitor -func (a *MonitorsApi) DeleteMonitor(ctx _context.Context, monitorId int64, o ...DeleteMonitorOptionalParameters) (DeletedMonitor, *_nethttp.Response, error) { - req, err := a.buildDeleteMonitorRequest(ctx, monitorId, o...) - if err != nil { - var localVarReturnValue DeletedMonitor - return localVarReturnValue, nil, err - } - - return a.deleteMonitorExecute(req) -} - -// deleteMonitorExecute executes the request. -func (a *MonitorsApi) deleteMonitorExecute(r apiDeleteMonitorRequest) (DeletedMonitor, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue DeletedMonitor - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.DeleteMonitor") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" - localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.force != nil { - localVarQueryParams.Add("force", common.ParameterToString(*r.force, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetMonitorRequest struct { - ctx _context.Context - monitorId int64 - groupStates *string -} - -// GetMonitorOptionalParameters holds optional parameters for GetMonitor. -type GetMonitorOptionalParameters struct { - GroupStates *string -} - -// NewGetMonitorOptionalParameters creates an empty struct for parameters. -func NewGetMonitorOptionalParameters() *GetMonitorOptionalParameters { - this := GetMonitorOptionalParameters{} - return &this -} - -// WithGroupStates sets the corresponding parameter name and returns the struct. -func (r *GetMonitorOptionalParameters) WithGroupStates(groupStates string) *GetMonitorOptionalParameters { - r.GroupStates = &groupStates - return r -} - -func (a *MonitorsApi) buildGetMonitorRequest(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (apiGetMonitorRequest, error) { - req := apiGetMonitorRequest{ - ctx: ctx, - monitorId: monitorId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetMonitorOptionalParameters is allowed") - } - - if o != nil { - req.groupStates = o[0].GroupStates - } - return req, nil -} - -// GetMonitor Get a monitor's details. -// Get details about the specified monitor from your organization. -func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (Monitor, *_nethttp.Response, error) { - req, err := a.buildGetMonitorRequest(ctx, monitorId, o...) - if err != nil { - var localVarReturnValue Monitor - return localVarReturnValue, nil, err - } - - return a.getMonitorExecute(req) -} - -// getMonitorExecute executes the request. -func (a *MonitorsApi) getMonitorExecute(r apiGetMonitorRequest) (Monitor, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue Monitor - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.GetMonitor") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" - localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.groupStates != nil { - localVarQueryParams.Add("group_states", common.ParameterToString(*r.groupStates, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListMonitorsRequest struct { - ctx _context.Context - groupStates *string - name *string - tags *string - monitorTags *string - withDowntimes *bool - idOffset *int64 - page *int64 - pageSize *int32 -} - -// ListMonitorsOptionalParameters holds optional parameters for ListMonitors. -type ListMonitorsOptionalParameters struct { - GroupStates *string - Name *string - Tags *string - MonitorTags *string - WithDowntimes *bool - IdOffset *int64 - Page *int64 - PageSize *int32 -} - -// NewListMonitorsOptionalParameters creates an empty struct for parameters. -func NewListMonitorsOptionalParameters() *ListMonitorsOptionalParameters { - this := ListMonitorsOptionalParameters{} - return &this -} - -// WithGroupStates sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithGroupStates(groupStates string) *ListMonitorsOptionalParameters { - r.GroupStates = &groupStates - return r -} - -// WithName sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithName(name string) *ListMonitorsOptionalParameters { - r.Name = &name - return r -} - -// WithTags sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithTags(tags string) *ListMonitorsOptionalParameters { - r.Tags = &tags - return r -} - -// WithMonitorTags sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithMonitorTags(monitorTags string) *ListMonitorsOptionalParameters { - r.MonitorTags = &monitorTags - return r -} - -// WithWithDowntimes sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithWithDowntimes(withDowntimes bool) *ListMonitorsOptionalParameters { - r.WithDowntimes = &withDowntimes - return r -} - -// WithIdOffset sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithIdOffset(idOffset int64) *ListMonitorsOptionalParameters { - r.IdOffset = &idOffset - return r -} - -// WithPage sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithPage(page int64) *ListMonitorsOptionalParameters { - r.Page = &page - return r -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListMonitorsOptionalParameters) WithPageSize(pageSize int32) *ListMonitorsOptionalParameters { - r.PageSize = &pageSize - return r -} - -func (a *MonitorsApi) buildListMonitorsRequest(ctx _context.Context, o ...ListMonitorsOptionalParameters) (apiListMonitorsRequest, error) { - req := apiListMonitorsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListMonitorsOptionalParameters is allowed") - } - - if o != nil { - req.groupStates = o[0].GroupStates - req.name = o[0].Name - req.tags = o[0].Tags - req.monitorTags = o[0].MonitorTags - req.withDowntimes = o[0].WithDowntimes - req.idOffset = o[0].IdOffset - req.page = o[0].Page - req.pageSize = o[0].PageSize - } - return req, nil -} - -// ListMonitors Get all monitor details. -// Get details about the specified monitor from your organization. -func (a *MonitorsApi) ListMonitors(ctx _context.Context, o ...ListMonitorsOptionalParameters) ([]Monitor, *_nethttp.Response, error) { - req, err := a.buildListMonitorsRequest(ctx, o...) - if err != nil { - var localVarReturnValue []Monitor - return localVarReturnValue, nil, err - } - - return a.listMonitorsExecute(req) -} - -// listMonitorsExecute executes the request. -func (a *MonitorsApi) listMonitorsExecute(r apiListMonitorsRequest) ([]Monitor, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []Monitor - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.ListMonitors") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.groupStates != nil { - localVarQueryParams.Add("group_states", common.ParameterToString(*r.groupStates, "")) - } - if r.name != nil { - localVarQueryParams.Add("name", common.ParameterToString(*r.name, "")) - } - if r.tags != nil { - localVarQueryParams.Add("tags", common.ParameterToString(*r.tags, "")) - } - if r.monitorTags != nil { - localVarQueryParams.Add("monitor_tags", common.ParameterToString(*r.monitorTags, "")) - } - if r.withDowntimes != nil { - localVarQueryParams.Add("with_downtimes", common.ParameterToString(*r.withDowntimes, "")) - } - if r.idOffset != nil { - localVarQueryParams.Add("id_offset", common.ParameterToString(*r.idOffset, "")) - } - if r.page != nil { - localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) - } - if r.pageSize != nil { - localVarQueryParams.Add("page_size", common.ParameterToString(*r.pageSize, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSearchMonitorGroupsRequest struct { - ctx _context.Context - query *string - page *int64 - perPage *int64 - sort *string -} - -// SearchMonitorGroupsOptionalParameters holds optional parameters for SearchMonitorGroups. -type SearchMonitorGroupsOptionalParameters struct { - Query *string - Page *int64 - PerPage *int64 - Sort *string -} - -// NewSearchMonitorGroupsOptionalParameters creates an empty struct for parameters. -func NewSearchMonitorGroupsOptionalParameters() *SearchMonitorGroupsOptionalParameters { - this := SearchMonitorGroupsOptionalParameters{} - return &this -} - -// WithQuery sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorGroupsOptionalParameters) WithQuery(query string) *SearchMonitorGroupsOptionalParameters { - r.Query = &query - return r -} - -// WithPage sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorGroupsOptionalParameters) WithPage(page int64) *SearchMonitorGroupsOptionalParameters { - r.Page = &page - return r -} - -// WithPerPage sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorGroupsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorGroupsOptionalParameters { - r.PerPage = &perPage - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorGroupsOptionalParameters) WithSort(sort string) *SearchMonitorGroupsOptionalParameters { - r.Sort = &sort - return r -} - -func (a *MonitorsApi) buildSearchMonitorGroupsRequest(ctx _context.Context, o ...SearchMonitorGroupsOptionalParameters) (apiSearchMonitorGroupsRequest, error) { - req := apiSearchMonitorGroupsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SearchMonitorGroupsOptionalParameters is allowed") - } - - if o != nil { - req.query = o[0].Query - req.page = o[0].Page - req.perPage = o[0].PerPage - req.sort = o[0].Sort - } - return req, nil -} - -// SearchMonitorGroups Monitors group search. -// Search and filter your monitor groups details. -func (a *MonitorsApi) SearchMonitorGroups(ctx _context.Context, o ...SearchMonitorGroupsOptionalParameters) (MonitorGroupSearchResponse, *_nethttp.Response, error) { - req, err := a.buildSearchMonitorGroupsRequest(ctx, o...) - if err != nil { - var localVarReturnValue MonitorGroupSearchResponse - return localVarReturnValue, nil, err - } - - return a.searchMonitorGroupsExecute(req) -} - -// searchMonitorGroupsExecute executes the request. -func (a *MonitorsApi) searchMonitorGroupsExecute(r apiSearchMonitorGroupsRequest) (MonitorGroupSearchResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MonitorGroupSearchResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.SearchMonitorGroups") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/groups/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.query != nil { - localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) - } - if r.page != nil { - localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) - } - if r.perPage != nil { - localVarQueryParams.Add("per_page", common.ParameterToString(*r.perPage, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSearchMonitorsRequest struct { - ctx _context.Context - query *string - page *int64 - perPage *int64 - sort *string -} - -// SearchMonitorsOptionalParameters holds optional parameters for SearchMonitors. -type SearchMonitorsOptionalParameters struct { - Query *string - Page *int64 - PerPage *int64 - Sort *string -} - -// NewSearchMonitorsOptionalParameters creates an empty struct for parameters. -func NewSearchMonitorsOptionalParameters() *SearchMonitorsOptionalParameters { - this := SearchMonitorsOptionalParameters{} - return &this -} - -// WithQuery sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorsOptionalParameters) WithQuery(query string) *SearchMonitorsOptionalParameters { - r.Query = &query - return r -} - -// WithPage sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorsOptionalParameters) WithPage(page int64) *SearchMonitorsOptionalParameters { - r.Page = &page - return r -} - -// WithPerPage sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorsOptionalParameters { - r.PerPage = &perPage - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *SearchMonitorsOptionalParameters) WithSort(sort string) *SearchMonitorsOptionalParameters { - r.Sort = &sort - return r -} - -func (a *MonitorsApi) buildSearchMonitorsRequest(ctx _context.Context, o ...SearchMonitorsOptionalParameters) (apiSearchMonitorsRequest, error) { - req := apiSearchMonitorsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SearchMonitorsOptionalParameters is allowed") - } - - if o != nil { - req.query = o[0].Query - req.page = o[0].Page - req.perPage = o[0].PerPage - req.sort = o[0].Sort - } - return req, nil -} - -// SearchMonitors Monitors search. -// Search and filter your monitors details. -func (a *MonitorsApi) SearchMonitors(ctx _context.Context, o ...SearchMonitorsOptionalParameters) (MonitorSearchResponse, *_nethttp.Response, error) { - req, err := a.buildSearchMonitorsRequest(ctx, o...) - if err != nil { - var localVarReturnValue MonitorSearchResponse - return localVarReturnValue, nil, err - } - - return a.searchMonitorsExecute(req) -} - -// searchMonitorsExecute executes the request. -func (a *MonitorsApi) searchMonitorsExecute(r apiSearchMonitorsRequest) (MonitorSearchResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MonitorSearchResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.SearchMonitors") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.query != nil { - localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) - } - if r.page != nil { - localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) - } - if r.perPage != nil { - localVarQueryParams.Add("per_page", common.ParameterToString(*r.perPage, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateMonitorRequest struct { - ctx _context.Context - monitorId int64 - body *MonitorUpdateRequest -} - -func (a *MonitorsApi) buildUpdateMonitorRequest(ctx _context.Context, monitorId int64, body MonitorUpdateRequest) (apiUpdateMonitorRequest, error) { - req := apiUpdateMonitorRequest{ - ctx: ctx, - monitorId: monitorId, - body: &body, - } - return req, nil -} - -// UpdateMonitor Edit a monitor. -// Edit the specified monitor. -func (a *MonitorsApi) UpdateMonitor(ctx _context.Context, monitorId int64, body MonitorUpdateRequest) (Monitor, *_nethttp.Response, error) { - req, err := a.buildUpdateMonitorRequest(ctx, monitorId, body) - if err != nil { - var localVarReturnValue Monitor - return localVarReturnValue, nil, err - } - - return a.updateMonitorExecute(req) -} - -// updateMonitorExecute executes the request. -func (a *MonitorsApi) updateMonitorExecute(r apiUpdateMonitorRequest) (Monitor, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue Monitor - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.UpdateMonitor") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" - localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiValidateExistingMonitorRequest struct { - ctx _context.Context - monitorId int64 - body *Monitor -} - -func (a *MonitorsApi) buildValidateExistingMonitorRequest(ctx _context.Context, monitorId int64, body Monitor) (apiValidateExistingMonitorRequest, error) { - req := apiValidateExistingMonitorRequest{ - ctx: ctx, - monitorId: monitorId, - body: &body, - } - return req, nil -} - -// ValidateExistingMonitor Validate an existing monitor. -// Validate the monitor provided in the request. -func (a *MonitorsApi) ValidateExistingMonitor(ctx _context.Context, monitorId int64, body Monitor) (interface{}, *_nethttp.Response, error) { - req, err := a.buildValidateExistingMonitorRequest(ctx, monitorId, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.validateExistingMonitorExecute(req) -} - -// validateExistingMonitorExecute executes the request. -func (a *MonitorsApi) validateExistingMonitorExecute(r apiValidateExistingMonitorRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.ValidateExistingMonitor") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}/validate" - localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiValidateMonitorRequest struct { - ctx _context.Context - body *Monitor -} - -func (a *MonitorsApi) buildValidateMonitorRequest(ctx _context.Context, body Monitor) (apiValidateMonitorRequest, error) { - req := apiValidateMonitorRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// ValidateMonitor Validate a monitor. -// Validate the monitor provided in the request. -func (a *MonitorsApi) ValidateMonitor(ctx _context.Context, body Monitor) (interface{}, *_nethttp.Response, error) { - req, err := a.buildValidateMonitorRequest(ctx, body) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.validateMonitorExecute(req) -} - -// validateMonitorExecute executes the request. -func (a *MonitorsApi) validateMonitorExecute(r apiValidateMonitorRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.ValidateMonitor") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monitor/validate" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewMonitorsApi Returns NewMonitorsApi. -func NewMonitorsApi(client *common.APIClient) *MonitorsApi { - return &MonitorsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_notebooks.go b/api/v1/datadog/api_notebooks.go deleted file mode 100644 index 085aa59fe6f..00000000000 --- a/api/v1/datadog/api_notebooks.go +++ /dev/null @@ -1,884 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// NotebooksApi service type -type NotebooksApi common.Service - -type apiCreateNotebookRequest struct { - ctx _context.Context - body *NotebookCreateRequest -} - -func (a *NotebooksApi) buildCreateNotebookRequest(ctx _context.Context, body NotebookCreateRequest) (apiCreateNotebookRequest, error) { - req := apiCreateNotebookRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateNotebook Create a notebook. -// Create a notebook using the specified options. -func (a *NotebooksApi) CreateNotebook(ctx _context.Context, body NotebookCreateRequest) (NotebookResponse, *_nethttp.Response, error) { - req, err := a.buildCreateNotebookRequest(ctx, body) - if err != nil { - var localVarReturnValue NotebookResponse - return localVarReturnValue, nil, err - } - - return a.createNotebookExecute(req) -} - -// createNotebookExecute executes the request. -func (a *NotebooksApi) createNotebookExecute(r apiCreateNotebookRequest) (NotebookResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue NotebookResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.CreateNotebook") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/notebooks" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteNotebookRequest struct { - ctx _context.Context - notebookId int64 -} - -func (a *NotebooksApi) buildDeleteNotebookRequest(ctx _context.Context, notebookId int64) (apiDeleteNotebookRequest, error) { - req := apiDeleteNotebookRequest{ - ctx: ctx, - notebookId: notebookId, - } - return req, nil -} - -// DeleteNotebook Delete a notebook. -// Delete a notebook using the specified ID. -func (a *NotebooksApi) DeleteNotebook(ctx _context.Context, notebookId int64) (*_nethttp.Response, error) { - req, err := a.buildDeleteNotebookRequest(ctx, notebookId) - if err != nil { - return nil, err - } - - return a.deleteNotebookExecute(req) -} - -// deleteNotebookExecute executes the request. -func (a *NotebooksApi) deleteNotebookExecute(r apiDeleteNotebookRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.DeleteNotebook") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/notebooks/{notebook_id}" - localVarPath = strings.Replace(localVarPath, "{"+"notebook_id"+"}", _neturl.PathEscape(common.ParameterToString(r.notebookId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetNotebookRequest struct { - ctx _context.Context - notebookId int64 -} - -func (a *NotebooksApi) buildGetNotebookRequest(ctx _context.Context, notebookId int64) (apiGetNotebookRequest, error) { - req := apiGetNotebookRequest{ - ctx: ctx, - notebookId: notebookId, - } - return req, nil -} - -// GetNotebook Get a notebook. -// Get a notebook using the specified notebook ID. -func (a *NotebooksApi) GetNotebook(ctx _context.Context, notebookId int64) (NotebookResponse, *_nethttp.Response, error) { - req, err := a.buildGetNotebookRequest(ctx, notebookId) - if err != nil { - var localVarReturnValue NotebookResponse - return localVarReturnValue, nil, err - } - - return a.getNotebookExecute(req) -} - -// getNotebookExecute executes the request. -func (a *NotebooksApi) getNotebookExecute(r apiGetNotebookRequest) (NotebookResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue NotebookResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.GetNotebook") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/notebooks/{notebook_id}" - localVarPath = strings.Replace(localVarPath, "{"+"notebook_id"+"}", _neturl.PathEscape(common.ParameterToString(r.notebookId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListNotebooksRequest struct { - ctx _context.Context - authorHandle *string - excludeAuthorHandle *string - start *int64 - count *int64 - sortField *string - sortDir *string - query *string - includeCells *bool - isTemplate *bool - typeVar *string -} - -// ListNotebooksOptionalParameters holds optional parameters for ListNotebooks. -type ListNotebooksOptionalParameters struct { - AuthorHandle *string - ExcludeAuthorHandle *string - Start *int64 - Count *int64 - SortField *string - SortDir *string - Query *string - IncludeCells *bool - IsTemplate *bool - Type *string -} - -// NewListNotebooksOptionalParameters creates an empty struct for parameters. -func NewListNotebooksOptionalParameters() *ListNotebooksOptionalParameters { - this := ListNotebooksOptionalParameters{} - return &this -} - -// WithAuthorHandle sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithAuthorHandle(authorHandle string) *ListNotebooksOptionalParameters { - r.AuthorHandle = &authorHandle - return r -} - -// WithExcludeAuthorHandle sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithExcludeAuthorHandle(excludeAuthorHandle string) *ListNotebooksOptionalParameters { - r.ExcludeAuthorHandle = &excludeAuthorHandle - return r -} - -// WithStart sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithStart(start int64) *ListNotebooksOptionalParameters { - r.Start = &start - return r -} - -// WithCount sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithCount(count int64) *ListNotebooksOptionalParameters { - r.Count = &count - return r -} - -// WithSortField sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithSortField(sortField string) *ListNotebooksOptionalParameters { - r.SortField = &sortField - return r -} - -// WithSortDir sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithSortDir(sortDir string) *ListNotebooksOptionalParameters { - r.SortDir = &sortDir - return r -} - -// WithQuery sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithQuery(query string) *ListNotebooksOptionalParameters { - r.Query = &query - return r -} - -// WithIncludeCells sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithIncludeCells(includeCells bool) *ListNotebooksOptionalParameters { - r.IncludeCells = &includeCells - return r -} - -// WithIsTemplate sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithIsTemplate(isTemplate bool) *ListNotebooksOptionalParameters { - r.IsTemplate = &isTemplate - return r -} - -// WithType sets the corresponding parameter name and returns the struct. -func (r *ListNotebooksOptionalParameters) WithType(typeVar string) *ListNotebooksOptionalParameters { - r.Type = &typeVar - return r -} - -func (a *NotebooksApi) buildListNotebooksRequest(ctx _context.Context, o ...ListNotebooksOptionalParameters) (apiListNotebooksRequest, error) { - req := apiListNotebooksRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListNotebooksOptionalParameters is allowed") - } - - if o != nil { - req.authorHandle = o[0].AuthorHandle - req.excludeAuthorHandle = o[0].ExcludeAuthorHandle - req.start = o[0].Start - req.count = o[0].Count - req.sortField = o[0].SortField - req.sortDir = o[0].SortDir - req.query = o[0].Query - req.includeCells = o[0].IncludeCells - req.isTemplate = o[0].IsTemplate - req.typeVar = o[0].Type - } - return req, nil -} - -// ListNotebooks Get all notebooks. -// Get all notebooks. This can also be used to search for notebooks with a particular `query` in the notebook -// `name` or author `handle`. -func (a *NotebooksApi) ListNotebooks(ctx _context.Context, o ...ListNotebooksOptionalParameters) (NotebooksResponse, *_nethttp.Response, error) { - req, err := a.buildListNotebooksRequest(ctx, o...) - if err != nil { - var localVarReturnValue NotebooksResponse - return localVarReturnValue, nil, err - } - - return a.listNotebooksExecute(req) -} - -// listNotebooksExecute executes the request. -func (a *NotebooksApi) listNotebooksExecute(r apiListNotebooksRequest) (NotebooksResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue NotebooksResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.ListNotebooks") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/notebooks" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.authorHandle != nil { - localVarQueryParams.Add("author_handle", common.ParameterToString(*r.authorHandle, "")) - } - if r.excludeAuthorHandle != nil { - localVarQueryParams.Add("exclude_author_handle", common.ParameterToString(*r.excludeAuthorHandle, "")) - } - if r.start != nil { - localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) - } - if r.count != nil { - localVarQueryParams.Add("count", common.ParameterToString(*r.count, "")) - } - if r.sortField != nil { - localVarQueryParams.Add("sort_field", common.ParameterToString(*r.sortField, "")) - } - if r.sortDir != nil { - localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) - } - if r.query != nil { - localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) - } - if r.includeCells != nil { - localVarQueryParams.Add("include_cells", common.ParameterToString(*r.includeCells, "")) - } - if r.isTemplate != nil { - localVarQueryParams.Add("is_template", common.ParameterToString(*r.isTemplate, "")) - } - if r.typeVar != nil { - localVarQueryParams.Add("type", common.ParameterToString(*r.typeVar, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateNotebookRequest struct { - ctx _context.Context - notebookId int64 - body *NotebookUpdateRequest -} - -func (a *NotebooksApi) buildUpdateNotebookRequest(ctx _context.Context, notebookId int64, body NotebookUpdateRequest) (apiUpdateNotebookRequest, error) { - req := apiUpdateNotebookRequest{ - ctx: ctx, - notebookId: notebookId, - body: &body, - } - return req, nil -} - -// UpdateNotebook Update a notebook. -// Update a notebook using the specified ID. -func (a *NotebooksApi) UpdateNotebook(ctx _context.Context, notebookId int64, body NotebookUpdateRequest) (NotebookResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateNotebookRequest(ctx, notebookId, body) - if err != nil { - var localVarReturnValue NotebookResponse - return localVarReturnValue, nil, err - } - - return a.updateNotebookExecute(req) -} - -// updateNotebookExecute executes the request. -func (a *NotebooksApi) updateNotebookExecute(r apiUpdateNotebookRequest) (NotebookResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue NotebookResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.UpdateNotebook") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/notebooks/{notebook_id}" - localVarPath = strings.Replace(localVarPath, "{"+"notebook_id"+"}", _neturl.PathEscape(common.ParameterToString(r.notebookId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewNotebooksApi Returns NewNotebooksApi. -func NewNotebooksApi(client *common.APIClient) *NotebooksApi { - return &NotebooksApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_organizations.go b/api/v1/datadog/api_organizations.go deleted file mode 100644 index 888932450d8..00000000000 --- a/api/v1/datadog/api_organizations.go +++ /dev/null @@ -1,888 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "os" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// OrganizationsApi service type -type OrganizationsApi common.Service - -type apiCreateChildOrgRequest struct { - ctx _context.Context - body *OrganizationCreateBody -} - -func (a *OrganizationsApi) buildCreateChildOrgRequest(ctx _context.Context, body OrganizationCreateBody) (apiCreateChildOrgRequest, error) { - req := apiCreateChildOrgRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateChildOrg Create a child organization. -// Create a child organization. -// -// This endpoint requires the -// [multi-organization account](https://docs.datadoghq.com/account_management/multi_organization/) -// feature and must be enabled by -// [contacting support](https://docs.datadoghq.com/help/). -// -// Once a new child organization is created, you can interact with it -// by using the `org.public_id`, `api_key.key`, and -// `application_key.hash` provided in the response. -func (a *OrganizationsApi) CreateChildOrg(ctx _context.Context, body OrganizationCreateBody) (OrganizationCreateResponse, *_nethttp.Response, error) { - req, err := a.buildCreateChildOrgRequest(ctx, body) - if err != nil { - var localVarReturnValue OrganizationCreateResponse - return localVarReturnValue, nil, err - } - - return a.createChildOrgExecute(req) -} - -// createChildOrgExecute executes the request. -func (a *OrganizationsApi) createChildOrgExecute(r apiCreateChildOrgRequest) (OrganizationCreateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue OrganizationCreateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.CreateChildOrg") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/org" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDowngradeOrgRequest struct { - ctx _context.Context - publicId string -} - -func (a *OrganizationsApi) buildDowngradeOrgRequest(ctx _context.Context, publicId string) (apiDowngradeOrgRequest, error) { - req := apiDowngradeOrgRequest{ - ctx: ctx, - publicId: publicId, - } - return req, nil -} - -// DowngradeOrg Spin-off Child Organization. -// Only available for MSP customers. Removes a child organization from the hierarchy of the master organization and places the child organization on a 30-day trial. -func (a *OrganizationsApi) DowngradeOrg(ctx _context.Context, publicId string) (OrgDowngradedResponse, *_nethttp.Response, error) { - req, err := a.buildDowngradeOrgRequest(ctx, publicId) - if err != nil { - var localVarReturnValue OrgDowngradedResponse - return localVarReturnValue, nil, err - } - - return a.downgradeOrgExecute(req) -} - -// downgradeOrgExecute executes the request. -func (a *OrganizationsApi) downgradeOrgExecute(r apiDowngradeOrgRequest) (OrgDowngradedResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue OrgDowngradedResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.DowngradeOrg") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/org/{public_id}/downgrade" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetOrgRequest struct { - ctx _context.Context - publicId string -} - -func (a *OrganizationsApi) buildGetOrgRequest(ctx _context.Context, publicId string) (apiGetOrgRequest, error) { - req := apiGetOrgRequest{ - ctx: ctx, - publicId: publicId, - } - return req, nil -} - -// GetOrg Get organization information. -// Get organization information. -func (a *OrganizationsApi) GetOrg(ctx _context.Context, publicId string) (OrganizationResponse, *_nethttp.Response, error) { - req, err := a.buildGetOrgRequest(ctx, publicId) - if err != nil { - var localVarReturnValue OrganizationResponse - return localVarReturnValue, nil, err - } - - return a.getOrgExecute(req) -} - -// getOrgExecute executes the request. -func (a *OrganizationsApi) getOrgExecute(r apiGetOrgRequest) (OrganizationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue OrganizationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.GetOrg") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/org/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListOrgsRequest struct { - ctx _context.Context -} - -func (a *OrganizationsApi) buildListOrgsRequest(ctx _context.Context) (apiListOrgsRequest, error) { - req := apiListOrgsRequest{ - ctx: ctx, - } - return req, nil -} - -// ListOrgs List your managed organizations. -// This endpoint returns data on your top-level organization. -func (a *OrganizationsApi) ListOrgs(ctx _context.Context) (OrganizationListResponse, *_nethttp.Response, error) { - req, err := a.buildListOrgsRequest(ctx) - if err != nil { - var localVarReturnValue OrganizationListResponse - return localVarReturnValue, nil, err - } - - return a.listOrgsExecute(req) -} - -// listOrgsExecute executes the request. -func (a *OrganizationsApi) listOrgsExecute(r apiListOrgsRequest) (OrganizationListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue OrganizationListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.ListOrgs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/org" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateOrgRequest struct { - ctx _context.Context - publicId string - body *Organization -} - -func (a *OrganizationsApi) buildUpdateOrgRequest(ctx _context.Context, publicId string, body Organization) (apiUpdateOrgRequest, error) { - req := apiUpdateOrgRequest{ - ctx: ctx, - publicId: publicId, - body: &body, - } - return req, nil -} - -// UpdateOrg Update your organization. -// Update your organization. -func (a *OrganizationsApi) UpdateOrg(ctx _context.Context, publicId string, body Organization) (OrganizationResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateOrgRequest(ctx, publicId, body) - if err != nil { - var localVarReturnValue OrganizationResponse - return localVarReturnValue, nil, err - } - - return a.updateOrgExecute(req) -} - -// updateOrgExecute executes the request. -func (a *OrganizationsApi) updateOrgExecute(r apiUpdateOrgRequest) (OrganizationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue OrganizationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.UpdateOrg") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/org/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUploadIdPForOrgRequest struct { - ctx _context.Context - publicId string - idpFile **os.File -} - -func (a *OrganizationsApi) buildUploadIdPForOrgRequest(ctx _context.Context, publicId string, idpFile *os.File) (apiUploadIdPForOrgRequest, error) { - req := apiUploadIdPForOrgRequest{ - ctx: ctx, - publicId: publicId, - idpFile: &idpFile, - } - return req, nil -} - -// UploadIdPForOrg Upload IdP metadata. -// There are a couple of options for updating the Identity Provider (IdP) -// metadata from your SAML IdP. -// -// * **Multipart Form-Data**: Post the IdP metadata file using a form post. -// -// * **XML Body:** Post the IdP metadata file as the body of the request. -func (a *OrganizationsApi) UploadIdPForOrg(ctx _context.Context, publicId string, idpFile *os.File) (IdpResponse, *_nethttp.Response, error) { - req, err := a.buildUploadIdPForOrgRequest(ctx, publicId, idpFile) - if err != nil { - var localVarReturnValue IdpResponse - return localVarReturnValue, nil, err - } - - return a.uploadIdPForOrgExecute(req) -} - -// uploadIdPForOrgExecute executes the request. -func (a *OrganizationsApi) uploadIdPForOrgExecute(r apiUploadIdPForOrgRequest) (IdpResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IdpResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.UploadIdPForOrg") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/org/{public_id}/idp_metadata" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.idpFile == nil { - return localVarReturnValue, nil, common.ReportError("idpFile is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "multipart/form-data" - localVarHeaderParams["Accept"] = "application/json" - - formFile := common.FormFile{} - formFile.FormFileName = "idp_file" - localVarFile := *r.idpFile - if localVarFile != nil { - fbs, _ := _ioutil.ReadAll(localVarFile) - formFile.FileBytes = fbs - formFile.FileName = localVarFile.Name() - localVarFile.Close() - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, &formFile) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 415 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewOrganizationsApi Returns NewOrganizationsApi. -func NewOrganizationsApi(client *common.APIClient) *OrganizationsApi { - return &OrganizationsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_pager_duty_integration.go b/api/v1/datadog/api_pager_duty_integration.go deleted file mode 100644 index ca0f2851cce..00000000000 --- a/api/v1/datadog/api_pager_duty_integration.go +++ /dev/null @@ -1,574 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// PagerDutyIntegrationApi service type -type PagerDutyIntegrationApi common.Service - -type apiCreatePagerDutyIntegrationServiceRequest struct { - ctx _context.Context - body *PagerDutyService -} - -func (a *PagerDutyIntegrationApi) buildCreatePagerDutyIntegrationServiceRequest(ctx _context.Context, body PagerDutyService) (apiCreatePagerDutyIntegrationServiceRequest, error) { - req := apiCreatePagerDutyIntegrationServiceRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreatePagerDutyIntegrationService Create a new service object. -// Create a new service object in the PagerDuty integration. -func (a *PagerDutyIntegrationApi) CreatePagerDutyIntegrationService(ctx _context.Context, body PagerDutyService) (PagerDutyServiceName, *_nethttp.Response, error) { - req, err := a.buildCreatePagerDutyIntegrationServiceRequest(ctx, body) - if err != nil { - var localVarReturnValue PagerDutyServiceName - return localVarReturnValue, nil, err - } - - return a.createPagerDutyIntegrationServiceExecute(req) -} - -// createPagerDutyIntegrationServiceExecute executes the request. -func (a *PagerDutyIntegrationApi) createPagerDutyIntegrationServiceExecute(r apiCreatePagerDutyIntegrationServiceRequest) (PagerDutyServiceName, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue PagerDutyServiceName - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.CreatePagerDutyIntegrationService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeletePagerDutyIntegrationServiceRequest struct { - ctx _context.Context - serviceName string -} - -func (a *PagerDutyIntegrationApi) buildDeletePagerDutyIntegrationServiceRequest(ctx _context.Context, serviceName string) (apiDeletePagerDutyIntegrationServiceRequest, error) { - req := apiDeletePagerDutyIntegrationServiceRequest{ - ctx: ctx, - serviceName: serviceName, - } - return req, nil -} - -// DeletePagerDutyIntegrationService Delete a single service object. -// Delete a single service object in the Datadog-PagerDuty integration. -func (a *PagerDutyIntegrationApi) DeletePagerDutyIntegrationService(ctx _context.Context, serviceName string) (*_nethttp.Response, error) { - req, err := a.buildDeletePagerDutyIntegrationServiceRequest(ctx, serviceName) - if err != nil { - return nil, err - } - - return a.deletePagerDutyIntegrationServiceExecute(req) -} - -// deletePagerDutyIntegrationServiceExecute executes the request. -func (a *PagerDutyIntegrationApi) deletePagerDutyIntegrationServiceExecute(r apiDeletePagerDutyIntegrationServiceRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.DeletePagerDutyIntegrationService") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services/{service_name}" - localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetPagerDutyIntegrationServiceRequest struct { - ctx _context.Context - serviceName string -} - -func (a *PagerDutyIntegrationApi) buildGetPagerDutyIntegrationServiceRequest(ctx _context.Context, serviceName string) (apiGetPagerDutyIntegrationServiceRequest, error) { - req := apiGetPagerDutyIntegrationServiceRequest{ - ctx: ctx, - serviceName: serviceName, - } - return req, nil -} - -// GetPagerDutyIntegrationService Get a single service object. -// Get service name in the Datadog-PagerDuty integration. -func (a *PagerDutyIntegrationApi) GetPagerDutyIntegrationService(ctx _context.Context, serviceName string) (PagerDutyServiceName, *_nethttp.Response, error) { - req, err := a.buildGetPagerDutyIntegrationServiceRequest(ctx, serviceName) - if err != nil { - var localVarReturnValue PagerDutyServiceName - return localVarReturnValue, nil, err - } - - return a.getPagerDutyIntegrationServiceExecute(req) -} - -// getPagerDutyIntegrationServiceExecute executes the request. -func (a *PagerDutyIntegrationApi) getPagerDutyIntegrationServiceExecute(r apiGetPagerDutyIntegrationServiceRequest) (PagerDutyServiceName, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue PagerDutyServiceName - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.GetPagerDutyIntegrationService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services/{service_name}" - localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdatePagerDutyIntegrationServiceRequest struct { - ctx _context.Context - serviceName string - body *PagerDutyServiceKey -} - -func (a *PagerDutyIntegrationApi) buildUpdatePagerDutyIntegrationServiceRequest(ctx _context.Context, serviceName string, body PagerDutyServiceKey) (apiUpdatePagerDutyIntegrationServiceRequest, error) { - req := apiUpdatePagerDutyIntegrationServiceRequest{ - ctx: ctx, - serviceName: serviceName, - body: &body, - } - return req, nil -} - -// UpdatePagerDutyIntegrationService Update a single service object. -// Update a single service object in the Datadog-PagerDuty integration. -func (a *PagerDutyIntegrationApi) UpdatePagerDutyIntegrationService(ctx _context.Context, serviceName string, body PagerDutyServiceKey) (*_nethttp.Response, error) { - req, err := a.buildUpdatePagerDutyIntegrationServiceRequest(ctx, serviceName, body) - if err != nil { - return nil, err - } - - return a.updatePagerDutyIntegrationServiceExecute(req) -} - -// updatePagerDutyIntegrationServiceExecute executes the request. -func (a *PagerDutyIntegrationApi) updatePagerDutyIntegrationServiceExecute(r apiUpdatePagerDutyIntegrationServiceRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.UpdatePagerDutyIntegrationService") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services/{service_name}" - localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "*/*" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -// NewPagerDutyIntegrationApi Returns NewPagerDutyIntegrationApi. -func NewPagerDutyIntegrationApi(client *common.APIClient) *PagerDutyIntegrationApi { - return &PagerDutyIntegrationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_security_monitoring.go b/api/v1/datadog/api_security_monitoring.go deleted file mode 100644 index 190aab4f5c5..00000000000 --- a/api/v1/datadog/api_security_monitoring.go +++ /dev/null @@ -1,488 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SecurityMonitoringApi service type -type SecurityMonitoringApi common.Service - -type apiAddSecurityMonitoringSignalToIncidentRequest struct { - ctx _context.Context - signalId string - body *AddSignalToIncidentRequest -} - -func (a *SecurityMonitoringApi) buildAddSecurityMonitoringSignalToIncidentRequest(ctx _context.Context, signalId string, body AddSignalToIncidentRequest) (apiAddSecurityMonitoringSignalToIncidentRequest, error) { - req := apiAddSecurityMonitoringSignalToIncidentRequest{ - ctx: ctx, - signalId: signalId, - body: &body, - } - return req, nil -} - -// AddSecurityMonitoringSignalToIncident Add a security signal to an incident. -// Add a security signal to an incident. This makes it possible to search for signals by incident within the signal explorer and to view the signals on the incident timeline. -func (a *SecurityMonitoringApi) AddSecurityMonitoringSignalToIncident(ctx _context.Context, signalId string, body AddSignalToIncidentRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { - req, err := a.buildAddSecurityMonitoringSignalToIncidentRequest(ctx, signalId, body) - if err != nil { - var localVarReturnValue SuccessfulSignalUpdateResponse - return localVarReturnValue, nil, err - } - - return a.addSecurityMonitoringSignalToIncidentExecute(req) -} - -// addSecurityMonitoringSignalToIncidentExecute executes the request. -func (a *SecurityMonitoringApi) addSecurityMonitoringSignalToIncidentExecute(r apiAddSecurityMonitoringSignalToIncidentRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SuccessfulSignalUpdateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SecurityMonitoringApi.AddSecurityMonitoringSignalToIncident") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/security_analytics/signals/{signal_id}/add_to_incident" - localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiEditSecurityMonitoringSignalAssigneeRequest struct { - ctx _context.Context - signalId string - body *SignalAssigneeUpdateRequest -} - -func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalAssigneeRequest(ctx _context.Context, signalId string, body SignalAssigneeUpdateRequest) (apiEditSecurityMonitoringSignalAssigneeRequest, error) { - req := apiEditSecurityMonitoringSignalAssigneeRequest{ - ctx: ctx, - signalId: signalId, - body: &body, - } - return req, nil -} - -// EditSecurityMonitoringSignalAssignee Modify the triage assignee of a security signal. -// Modify the triage assignee of a security signal. -func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalAssignee(ctx _context.Context, signalId string, body SignalAssigneeUpdateRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { - req, err := a.buildEditSecurityMonitoringSignalAssigneeRequest(ctx, signalId, body) - if err != nil { - var localVarReturnValue SuccessfulSignalUpdateResponse - return localVarReturnValue, nil, err - } - - return a.editSecurityMonitoringSignalAssigneeExecute(req) -} - -// editSecurityMonitoringSignalAssigneeExecute executes the request. -func (a *SecurityMonitoringApi) editSecurityMonitoringSignalAssigneeExecute(r apiEditSecurityMonitoringSignalAssigneeRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SuccessfulSignalUpdateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/security_analytics/signals/{signal_id}/assignee" - localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiEditSecurityMonitoringSignalStateRequest struct { - ctx _context.Context - signalId string - body *SignalStateUpdateRequest -} - -func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalStateRequest(ctx _context.Context, signalId string, body SignalStateUpdateRequest) (apiEditSecurityMonitoringSignalStateRequest, error) { - req := apiEditSecurityMonitoringSignalStateRequest{ - ctx: ctx, - signalId: signalId, - body: &body, - } - return req, nil -} - -// EditSecurityMonitoringSignalState Change the triage state of a security signal. -// Change the triage state of a security signal. -func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalState(ctx _context.Context, signalId string, body SignalStateUpdateRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { - req, err := a.buildEditSecurityMonitoringSignalStateRequest(ctx, signalId, body) - if err != nil { - var localVarReturnValue SuccessfulSignalUpdateResponse - return localVarReturnValue, nil, err - } - - return a.editSecurityMonitoringSignalStateExecute(req) -} - -// editSecurityMonitoringSignalStateExecute executes the request. -func (a *SecurityMonitoringApi) editSecurityMonitoringSignalStateExecute(r apiEditSecurityMonitoringSignalStateRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SuccessfulSignalUpdateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SecurityMonitoringApi.EditSecurityMonitoringSignalState") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/security_analytics/signals/{signal_id}/state" - localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewSecurityMonitoringApi Returns NewSecurityMonitoringApi. -func NewSecurityMonitoringApi(client *common.APIClient) *SecurityMonitoringApi { - return &SecurityMonitoringApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_service_checks.go b/api/v1/datadog/api_service_checks.go deleted file mode 100644 index 8c8aeaa762e..00000000000 --- a/api/v1/datadog/api_service_checks.go +++ /dev/null @@ -1,175 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// ServiceChecksApi service type -type ServiceChecksApi common.Service - -type apiSubmitServiceCheckRequest struct { - ctx _context.Context - body *[]ServiceCheck -} - -func (a *ServiceChecksApi) buildSubmitServiceCheckRequest(ctx _context.Context, body []ServiceCheck) (apiSubmitServiceCheckRequest, error) { - req := apiSubmitServiceCheckRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// SubmitServiceCheck Submit a Service Check. -// Submit a list of Service Checks. -// -// **Notes**: -// - A valid API key is required. -// - Service checks can be submitted up to 10 minutes in the past. -func (a *ServiceChecksApi) SubmitServiceCheck(ctx _context.Context, body []ServiceCheck) (IntakePayloadAccepted, *_nethttp.Response, error) { - req, err := a.buildSubmitServiceCheckRequest(ctx, body) - if err != nil { - var localVarReturnValue IntakePayloadAccepted - return localVarReturnValue, nil, err - } - - return a.submitServiceCheckExecute(req) -} - -// submitServiceCheckExecute executes the request. -func (a *ServiceChecksApi) submitServiceCheckExecute(r apiSubmitServiceCheckRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IntakePayloadAccepted - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceChecksApi.SubmitServiceCheck") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/check_run" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 408 { - 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 - } - if localVarHTTPResponse.StatusCode == 413 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewServiceChecksApi Returns NewServiceChecksApi. -func NewServiceChecksApi(client *common.APIClient) *ServiceChecksApi { - return &ServiceChecksApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_service_level_objective_corrections.go b/api/v1/datadog/api_service_level_objective_corrections.go deleted file mode 100644 index a58799a5a57..00000000000 --- a/api/v1/datadog/api_service_level_objective_corrections.go +++ /dev/null @@ -1,719 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// ServiceLevelObjectiveCorrectionsApi service type -type ServiceLevelObjectiveCorrectionsApi common.Service - -type apiCreateSLOCorrectionRequest struct { - ctx _context.Context - body *SLOCorrectionCreateRequest -} - -func (a *ServiceLevelObjectiveCorrectionsApi) buildCreateSLOCorrectionRequest(ctx _context.Context, body SLOCorrectionCreateRequest) (apiCreateSLOCorrectionRequest, error) { - req := apiCreateSLOCorrectionRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateSLOCorrection Create an SLO correction. -// Create an SLO Correction. -func (a *ServiceLevelObjectiveCorrectionsApi) CreateSLOCorrection(ctx _context.Context, body SLOCorrectionCreateRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { - req, err := a.buildCreateSLOCorrectionRequest(ctx, body) - if err != nil { - var localVarReturnValue SLOCorrectionResponse - return localVarReturnValue, nil, err - } - - return a.createSLOCorrectionExecute(req) -} - -// createSLOCorrectionExecute executes the request. -func (a *ServiceLevelObjectiveCorrectionsApi) createSLOCorrectionExecute(r apiCreateSLOCorrectionRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SLOCorrectionResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.CreateSLOCorrection") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/correction" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteSLOCorrectionRequest struct { - ctx _context.Context - sloCorrectionId string -} - -func (a *ServiceLevelObjectiveCorrectionsApi) buildDeleteSLOCorrectionRequest(ctx _context.Context, sloCorrectionId string) (apiDeleteSLOCorrectionRequest, error) { - req := apiDeleteSLOCorrectionRequest{ - ctx: ctx, - sloCorrectionId: sloCorrectionId, - } - return req, nil -} - -// DeleteSLOCorrection Delete an SLO correction. -// Permanently delete the specified SLO correction object. -func (a *ServiceLevelObjectiveCorrectionsApi) DeleteSLOCorrection(ctx _context.Context, sloCorrectionId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteSLOCorrectionRequest(ctx, sloCorrectionId) - if err != nil { - return nil, err - } - - return a.deleteSLOCorrectionExecute(req) -} - -// deleteSLOCorrectionExecute executes the request. -func (a *ServiceLevelObjectiveCorrectionsApi) deleteSLOCorrectionExecute(r apiDeleteSLOCorrectionRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.DeleteSLOCorrection") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/correction/{slo_correction_id}" - localVarPath = strings.Replace(localVarPath, "{"+"slo_correction_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloCorrectionId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetSLOCorrectionRequest struct { - ctx _context.Context - sloCorrectionId string -} - -func (a *ServiceLevelObjectiveCorrectionsApi) buildGetSLOCorrectionRequest(ctx _context.Context, sloCorrectionId string) (apiGetSLOCorrectionRequest, error) { - req := apiGetSLOCorrectionRequest{ - ctx: ctx, - sloCorrectionId: sloCorrectionId, - } - return req, nil -} - -// GetSLOCorrection Get an SLO correction for an SLO. -// Get an SLO correction. -func (a *ServiceLevelObjectiveCorrectionsApi) GetSLOCorrection(ctx _context.Context, sloCorrectionId string) (SLOCorrectionResponse, *_nethttp.Response, error) { - req, err := a.buildGetSLOCorrectionRequest(ctx, sloCorrectionId) - if err != nil { - var localVarReturnValue SLOCorrectionResponse - return localVarReturnValue, nil, err - } - - return a.getSLOCorrectionExecute(req) -} - -// getSLOCorrectionExecute executes the request. -func (a *ServiceLevelObjectiveCorrectionsApi) getSLOCorrectionExecute(r apiGetSLOCorrectionRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SLOCorrectionResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.GetSLOCorrection") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/correction/{slo_correction_id}" - localVarPath = strings.Replace(localVarPath, "{"+"slo_correction_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloCorrectionId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListSLOCorrectionRequest struct { - ctx _context.Context -} - -func (a *ServiceLevelObjectiveCorrectionsApi) buildListSLOCorrectionRequest(ctx _context.Context) (apiListSLOCorrectionRequest, error) { - req := apiListSLOCorrectionRequest{ - ctx: ctx, - } - return req, nil -} - -// ListSLOCorrection Get all SLO corrections. -// Get all Service Level Objective corrections. -func (a *ServiceLevelObjectiveCorrectionsApi) ListSLOCorrection(ctx _context.Context) (SLOCorrectionListResponse, *_nethttp.Response, error) { - req, err := a.buildListSLOCorrectionRequest(ctx) - if err != nil { - var localVarReturnValue SLOCorrectionListResponse - return localVarReturnValue, nil, err - } - - return a.listSLOCorrectionExecute(req) -} - -// listSLOCorrectionExecute executes the request. -func (a *ServiceLevelObjectiveCorrectionsApi) listSLOCorrectionExecute(r apiListSLOCorrectionRequest) (SLOCorrectionListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SLOCorrectionListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.ListSLOCorrection") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/correction" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateSLOCorrectionRequest struct { - ctx _context.Context - sloCorrectionId string - body *SLOCorrectionUpdateRequest -} - -func (a *ServiceLevelObjectiveCorrectionsApi) buildUpdateSLOCorrectionRequest(ctx _context.Context, sloCorrectionId string, body SLOCorrectionUpdateRequest) (apiUpdateSLOCorrectionRequest, error) { - req := apiUpdateSLOCorrectionRequest{ - ctx: ctx, - sloCorrectionId: sloCorrectionId, - body: &body, - } - return req, nil -} - -// UpdateSLOCorrection Update an SLO correction. -// Update the specified SLO correction object. -func (a *ServiceLevelObjectiveCorrectionsApi) UpdateSLOCorrection(ctx _context.Context, sloCorrectionId string, body SLOCorrectionUpdateRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateSLOCorrectionRequest(ctx, sloCorrectionId, body) - if err != nil { - var localVarReturnValue SLOCorrectionResponse - return localVarReturnValue, nil, err - } - - return a.updateSLOCorrectionExecute(req) -} - -// updateSLOCorrectionExecute executes the request. -func (a *ServiceLevelObjectiveCorrectionsApi) updateSLOCorrectionExecute(r apiUpdateSLOCorrectionRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SLOCorrectionResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.UpdateSLOCorrection") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/correction/{slo_correction_id}" - localVarPath = strings.Replace(localVarPath, "{"+"slo_correction_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloCorrectionId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewServiceLevelObjectiveCorrectionsApi Returns NewServiceLevelObjectiveCorrectionsApi. -func NewServiceLevelObjectiveCorrectionsApi(client *common.APIClient) *ServiceLevelObjectiveCorrectionsApi { - return &ServiceLevelObjectiveCorrectionsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_service_level_objectives.go b/api/v1/datadog/api_service_level_objectives.go deleted file mode 100644 index bf20d83fd0f..00000000000 --- a/api/v1/datadog/api_service_level_objectives.go +++ /dev/null @@ -1,1749 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _fmt "fmt" - _ioutil "io/ioutil" - _log "log" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// ServiceLevelObjectivesApi service type -type ServiceLevelObjectivesApi common.Service - -type apiCheckCanDeleteSLORequest struct { - ctx _context.Context - ids *string -} - -func (a *ServiceLevelObjectivesApi) buildCheckCanDeleteSLORequest(ctx _context.Context, ids string) (apiCheckCanDeleteSLORequest, error) { - req := apiCheckCanDeleteSLORequest{ - ctx: ctx, - ids: &ids, - } - return req, nil -} - -// CheckCanDeleteSLO Check if SLOs can be safely deleted. -// Check if an SLO can be safely deleted. For example, -// assure an SLO can be deleted without disrupting a dashboard. -func (a *ServiceLevelObjectivesApi) CheckCanDeleteSLO(ctx _context.Context, ids string) (CheckCanDeleteSLOResponse, *_nethttp.Response, error) { - req, err := a.buildCheckCanDeleteSLORequest(ctx, ids) - if err != nil { - var localVarReturnValue CheckCanDeleteSLOResponse - return localVarReturnValue, nil, err - } - - return a.checkCanDeleteSLOExecute(req) -} - -// checkCanDeleteSLOExecute executes the request. -func (a *ServiceLevelObjectivesApi) checkCanDeleteSLOExecute(r apiCheckCanDeleteSLORequest) (CheckCanDeleteSLOResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue CheckCanDeleteSLOResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.CheckCanDeleteSLO") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/can_delete" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.ids == nil { - return localVarReturnValue, nil, common.ReportError("ids is required and must be specified") - } - localVarQueryParams.Add("ids", common.ParameterToString(*r.ids, "")) - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v CheckCanDeleteSLOResponse - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateSLORequest struct { - ctx _context.Context - body *ServiceLevelObjectiveRequest -} - -func (a *ServiceLevelObjectivesApi) buildCreateSLORequest(ctx _context.Context, body ServiceLevelObjectiveRequest) (apiCreateSLORequest, error) { - req := apiCreateSLORequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateSLO Create an SLO object. -// Create a service level objective object. -func (a *ServiceLevelObjectivesApi) CreateSLO(ctx _context.Context, body ServiceLevelObjectiveRequest) (SLOListResponse, *_nethttp.Response, error) { - req, err := a.buildCreateSLORequest(ctx, body) - if err != nil { - var localVarReturnValue SLOListResponse - return localVarReturnValue, nil, err - } - - return a.createSLOExecute(req) -} - -// createSLOExecute executes the request. -func (a *ServiceLevelObjectivesApi) createSLOExecute(r apiCreateSLORequest) (SLOListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SLOListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.CreateSLO") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteSLORequest struct { - ctx _context.Context - sloId string - force *string -} - -// DeleteSLOOptionalParameters holds optional parameters for DeleteSLO. -type DeleteSLOOptionalParameters struct { - Force *string -} - -// NewDeleteSLOOptionalParameters creates an empty struct for parameters. -func NewDeleteSLOOptionalParameters() *DeleteSLOOptionalParameters { - this := DeleteSLOOptionalParameters{} - return &this -} - -// WithForce sets the corresponding parameter name and returns the struct. -func (r *DeleteSLOOptionalParameters) WithForce(force string) *DeleteSLOOptionalParameters { - r.Force = &force - return r -} - -func (a *ServiceLevelObjectivesApi) buildDeleteSLORequest(ctx _context.Context, sloId string, o ...DeleteSLOOptionalParameters) (apiDeleteSLORequest, error) { - req := apiDeleteSLORequest{ - ctx: ctx, - sloId: sloId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type DeleteSLOOptionalParameters is allowed") - } - - if o != nil { - req.force = o[0].Force - } - return req, nil -} - -// DeleteSLO Delete an SLO. -// Permanently delete the specified service level objective object. -// -// If an SLO is used in a dashboard, the `DELETE /v1/slo/` endpoint returns -// a 409 conflict error because the SLO is referenced in a dashboard. -func (a *ServiceLevelObjectivesApi) DeleteSLO(ctx _context.Context, sloId string, o ...DeleteSLOOptionalParameters) (SLODeleteResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteSLORequest(ctx, sloId, o...) - if err != nil { - var localVarReturnValue SLODeleteResponse - return localVarReturnValue, nil, err - } - - return a.deleteSLOExecute(req) -} - -// deleteSLOExecute executes the request. -func (a *ServiceLevelObjectivesApi) deleteSLOExecute(r apiDeleteSLORequest) (SLODeleteResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue SLODeleteResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.DeleteSLO") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/{slo_id}" - localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.force != nil { - localVarQueryParams.Add("force", common.ParameterToString(*r.force, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v SLODeleteResponse - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteSLOTimeframeInBulkRequest struct { - ctx _context.Context - body *map[string][]SLOTimeframe -} - -func (a *ServiceLevelObjectivesApi) buildDeleteSLOTimeframeInBulkRequest(ctx _context.Context, body map[string][]SLOTimeframe) (apiDeleteSLOTimeframeInBulkRequest, error) { - req := apiDeleteSLOTimeframeInBulkRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteSLOTimeframeInBulk Bulk Delete SLO Timeframes. -// Delete (or partially delete) multiple service level objective objects. -// -// This endpoint facilitates deletion of one or more thresholds for one or more -// service level objective objects. If all thresholds are deleted, the service level -// objective object is deleted as well. -func (a *ServiceLevelObjectivesApi) DeleteSLOTimeframeInBulk(ctx _context.Context, body map[string][]SLOTimeframe) (SLOBulkDeleteResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteSLOTimeframeInBulkRequest(ctx, body) - if err != nil { - var localVarReturnValue SLOBulkDeleteResponse - return localVarReturnValue, nil, err - } - - return a.deleteSLOTimeframeInBulkExecute(req) -} - -// deleteSLOTimeframeInBulkExecute executes the request. -func (a *ServiceLevelObjectivesApi) deleteSLOTimeframeInBulkExecute(r apiDeleteSLOTimeframeInBulkRequest) (SLOBulkDeleteResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SLOBulkDeleteResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.DeleteSLOTimeframeInBulk") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/bulk_delete" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSLORequest struct { - ctx _context.Context - sloId string - withConfiguredAlertIds *bool -} - -// GetSLOOptionalParameters holds optional parameters for GetSLO. -type GetSLOOptionalParameters struct { - WithConfiguredAlertIds *bool -} - -// NewGetSLOOptionalParameters creates an empty struct for parameters. -func NewGetSLOOptionalParameters() *GetSLOOptionalParameters { - this := GetSLOOptionalParameters{} - return &this -} - -// WithWithConfiguredAlertIds sets the corresponding parameter name and returns the struct. -func (r *GetSLOOptionalParameters) WithWithConfiguredAlertIds(withConfiguredAlertIds bool) *GetSLOOptionalParameters { - r.WithConfiguredAlertIds = &withConfiguredAlertIds - return r -} - -func (a *ServiceLevelObjectivesApi) buildGetSLORequest(ctx _context.Context, sloId string, o ...GetSLOOptionalParameters) (apiGetSLORequest, error) { - req := apiGetSLORequest{ - ctx: ctx, - sloId: sloId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetSLOOptionalParameters is allowed") - } - - if o != nil { - req.withConfiguredAlertIds = o[0].WithConfiguredAlertIds - } - return req, nil -} - -// GetSLO Get an SLO's details. -// Get a service level objective object. -func (a *ServiceLevelObjectivesApi) GetSLO(ctx _context.Context, sloId string, o ...GetSLOOptionalParameters) (SLOResponse, *_nethttp.Response, error) { - req, err := a.buildGetSLORequest(ctx, sloId, o...) - if err != nil { - var localVarReturnValue SLOResponse - return localVarReturnValue, nil, err - } - - return a.getSLOExecute(req) -} - -// getSLOExecute executes the request. -func (a *ServiceLevelObjectivesApi) getSLOExecute(r apiGetSLORequest) (SLOResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SLOResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.GetSLO") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/{slo_id}" - localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.withConfiguredAlertIds != nil { - localVarQueryParams.Add("with_configured_alert_ids", common.ParameterToString(*r.withConfiguredAlertIds, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSLOCorrectionsRequest struct { - ctx _context.Context - sloId string -} - -func (a *ServiceLevelObjectivesApi) buildGetSLOCorrectionsRequest(ctx _context.Context, sloId string) (apiGetSLOCorrectionsRequest, error) { - req := apiGetSLOCorrectionsRequest{ - ctx: ctx, - sloId: sloId, - } - return req, nil -} - -// GetSLOCorrections Get Corrections For an SLO. -// Get corrections applied to an SLO -func (a *ServiceLevelObjectivesApi) GetSLOCorrections(ctx _context.Context, sloId string) (SLOCorrectionListResponse, *_nethttp.Response, error) { - req, err := a.buildGetSLOCorrectionsRequest(ctx, sloId) - if err != nil { - var localVarReturnValue SLOCorrectionListResponse - return localVarReturnValue, nil, err - } - - return a.getSLOCorrectionsExecute(req) -} - -// getSLOCorrectionsExecute executes the request. -func (a *ServiceLevelObjectivesApi) getSLOCorrectionsExecute(r apiGetSLOCorrectionsRequest) (SLOCorrectionListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SLOCorrectionListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.GetSLOCorrections") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/{slo_id}/corrections" - localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSLOHistoryRequest struct { - ctx _context.Context - sloId string - fromTs *int64 - toTs *int64 - target *float64 - applyCorrection *bool -} - -// GetSLOHistoryOptionalParameters holds optional parameters for GetSLOHistory. -type GetSLOHistoryOptionalParameters struct { - Target *float64 - ApplyCorrection *bool -} - -// NewGetSLOHistoryOptionalParameters creates an empty struct for parameters. -func NewGetSLOHistoryOptionalParameters() *GetSLOHistoryOptionalParameters { - this := GetSLOHistoryOptionalParameters{} - return &this -} - -// WithTarget sets the corresponding parameter name and returns the struct. -func (r *GetSLOHistoryOptionalParameters) WithTarget(target float64) *GetSLOHistoryOptionalParameters { - r.Target = &target - return r -} - -// WithApplyCorrection sets the corresponding parameter name and returns the struct. -func (r *GetSLOHistoryOptionalParameters) WithApplyCorrection(applyCorrection bool) *GetSLOHistoryOptionalParameters { - r.ApplyCorrection = &applyCorrection - return r -} - -func (a *ServiceLevelObjectivesApi) buildGetSLOHistoryRequest(ctx _context.Context, sloId string, fromTs int64, toTs int64, o ...GetSLOHistoryOptionalParameters) (apiGetSLOHistoryRequest, error) { - req := apiGetSLOHistoryRequest{ - ctx: ctx, - sloId: sloId, - fromTs: &fromTs, - toTs: &toTs, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetSLOHistoryOptionalParameters is allowed") - } - - if o != nil { - req.target = o[0].Target - req.applyCorrection = o[0].ApplyCorrection - } - return req, nil -} - -// GetSLOHistory Get an SLO's history. -// Get a specific SLO’s history, regardless of its SLO type. -// -// The detailed history data is structured according to the source data type. -// For example, metric data is included for event SLOs that use -// the metric source, and monitor SLO types include the monitor transition history. -// -// **Note:** There are different response formats for event based and time based SLOs. -// Examples of both are shown. -func (a *ServiceLevelObjectivesApi) GetSLOHistory(ctx _context.Context, sloId string, fromTs int64, toTs int64, o ...GetSLOHistoryOptionalParameters) (SLOHistoryResponse, *_nethttp.Response, error) { - req, err := a.buildGetSLOHistoryRequest(ctx, sloId, fromTs, toTs, o...) - if err != nil { - var localVarReturnValue SLOHistoryResponse - return localVarReturnValue, nil, err - } - - return a.getSLOHistoryExecute(req) -} - -// getSLOHistoryExecute executes the request. -func (a *ServiceLevelObjectivesApi) getSLOHistoryExecute(r apiGetSLOHistoryRequest) (SLOHistoryResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SLOHistoryResponse - ) - - operationId := "v1.GetSLOHistory" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.GetSLOHistory") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/{slo_id}/history" - localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.fromTs == nil { - return localVarReturnValue, nil, common.ReportError("fromTs is required and must be specified") - } - if r.toTs == nil { - return localVarReturnValue, nil, common.ReportError("toTs is required and must be specified") - } - localVarQueryParams.Add("from_ts", common.ParameterToString(*r.fromTs, "")) - localVarQueryParams.Add("to_ts", common.ParameterToString(*r.toTs, "")) - if r.target != nil { - localVarQueryParams.Add("target", common.ParameterToString(*r.target, "")) - } - if r.applyCorrection != nil { - localVarQueryParams.Add("apply_correction", common.ParameterToString(*r.applyCorrection, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListSLOsRequest struct { - ctx _context.Context - ids *string - query *string - tagsQuery *string - metricsQuery *string - limit *int64 - offset *int64 -} - -// ListSLOsOptionalParameters holds optional parameters for ListSLOs. -type ListSLOsOptionalParameters struct { - Ids *string - Query *string - TagsQuery *string - MetricsQuery *string - Limit *int64 - Offset *int64 -} - -// NewListSLOsOptionalParameters creates an empty struct for parameters. -func NewListSLOsOptionalParameters() *ListSLOsOptionalParameters { - this := ListSLOsOptionalParameters{} - return &this -} - -// WithIds sets the corresponding parameter name and returns the struct. -func (r *ListSLOsOptionalParameters) WithIds(ids string) *ListSLOsOptionalParameters { - r.Ids = &ids - return r -} - -// WithQuery sets the corresponding parameter name and returns the struct. -func (r *ListSLOsOptionalParameters) WithQuery(query string) *ListSLOsOptionalParameters { - r.Query = &query - return r -} - -// WithTagsQuery sets the corresponding parameter name and returns the struct. -func (r *ListSLOsOptionalParameters) WithTagsQuery(tagsQuery string) *ListSLOsOptionalParameters { - r.TagsQuery = &tagsQuery - return r -} - -// WithMetricsQuery sets the corresponding parameter name and returns the struct. -func (r *ListSLOsOptionalParameters) WithMetricsQuery(metricsQuery string) *ListSLOsOptionalParameters { - r.MetricsQuery = &metricsQuery - return r -} - -// WithLimit sets the corresponding parameter name and returns the struct. -func (r *ListSLOsOptionalParameters) WithLimit(limit int64) *ListSLOsOptionalParameters { - r.Limit = &limit - return r -} - -// WithOffset sets the corresponding parameter name and returns the struct. -func (r *ListSLOsOptionalParameters) WithOffset(offset int64) *ListSLOsOptionalParameters { - r.Offset = &offset - return r -} - -func (a *ServiceLevelObjectivesApi) buildListSLOsRequest(ctx _context.Context, o ...ListSLOsOptionalParameters) (apiListSLOsRequest, error) { - req := apiListSLOsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListSLOsOptionalParameters is allowed") - } - - if o != nil { - req.ids = o[0].Ids - req.query = o[0].Query - req.tagsQuery = o[0].TagsQuery - req.metricsQuery = o[0].MetricsQuery - req.limit = o[0].Limit - req.offset = o[0].Offset - } - return req, nil -} - -// ListSLOs Get all SLOs. -// Get a list of service level objective objects for your organization. -func (a *ServiceLevelObjectivesApi) ListSLOs(ctx _context.Context, o ...ListSLOsOptionalParameters) (SLOListResponse, *_nethttp.Response, error) { - req, err := a.buildListSLOsRequest(ctx, o...) - if err != nil { - var localVarReturnValue SLOListResponse - return localVarReturnValue, nil, err - } - - return a.listSLOsExecute(req) -} - -// listSLOsExecute executes the request. -func (a *ServiceLevelObjectivesApi) listSLOsExecute(r apiListSLOsRequest) (SLOListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SLOListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.ListSLOs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.ids != nil { - localVarQueryParams.Add("ids", common.ParameterToString(*r.ids, "")) - } - if r.query != nil { - localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) - } - if r.tagsQuery != nil { - localVarQueryParams.Add("tags_query", common.ParameterToString(*r.tagsQuery, "")) - } - if r.metricsQuery != nil { - localVarQueryParams.Add("metrics_query", common.ParameterToString(*r.metricsQuery, "")) - } - if r.limit != nil { - localVarQueryParams.Add("limit", common.ParameterToString(*r.limit, "")) - } - if r.offset != nil { - localVarQueryParams.Add("offset", common.ParameterToString(*r.offset, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSearchSLORequest struct { - ctx _context.Context - query *string - pageSize *int64 - pageNumber *int64 -} - -// SearchSLOOptionalParameters holds optional parameters for SearchSLO. -type SearchSLOOptionalParameters struct { - Query *string - PageSize *int64 - PageNumber *int64 -} - -// NewSearchSLOOptionalParameters creates an empty struct for parameters. -func NewSearchSLOOptionalParameters() *SearchSLOOptionalParameters { - this := SearchSLOOptionalParameters{} - return &this -} - -// WithQuery sets the corresponding parameter name and returns the struct. -func (r *SearchSLOOptionalParameters) WithQuery(query string) *SearchSLOOptionalParameters { - r.Query = &query - return r -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *SearchSLOOptionalParameters) WithPageSize(pageSize int64) *SearchSLOOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *SearchSLOOptionalParameters) WithPageNumber(pageNumber int64) *SearchSLOOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -func (a *ServiceLevelObjectivesApi) buildSearchSLORequest(ctx _context.Context, o ...SearchSLOOptionalParameters) (apiSearchSLORequest, error) { - req := apiSearchSLORequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SearchSLOOptionalParameters is allowed") - } - - if o != nil { - req.query = o[0].Query - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - } - return req, nil -} - -// SearchSLO Search for SLOs. -// Get a list of service level objective objects for your organization. -func (a *ServiceLevelObjectivesApi) SearchSLO(ctx _context.Context, o ...SearchSLOOptionalParameters) (SearchSLOResponse, *_nethttp.Response, error) { - req, err := a.buildSearchSLORequest(ctx, o...) - if err != nil { - var localVarReturnValue SearchSLOResponse - return localVarReturnValue, nil, err - } - - return a.searchSLOExecute(req) -} - -// searchSLOExecute executes the request. -func (a *ServiceLevelObjectivesApi) searchSLOExecute(r apiSearchSLORequest) (SearchSLOResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SearchSLOResponse - ) - - operationId := "v1.SearchSLO" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.SearchSLO") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.query != nil { - localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) - } - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateSLORequest struct { - ctx _context.Context - sloId string - body *ServiceLevelObjective -} - -func (a *ServiceLevelObjectivesApi) buildUpdateSLORequest(ctx _context.Context, sloId string, body ServiceLevelObjective) (apiUpdateSLORequest, error) { - req := apiUpdateSLORequest{ - ctx: ctx, - sloId: sloId, - body: &body, - } - return req, nil -} - -// UpdateSLO Update an SLO. -// Update the specified service level objective object. -func (a *ServiceLevelObjectivesApi) UpdateSLO(ctx _context.Context, sloId string, body ServiceLevelObjective) (SLOListResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateSLORequest(ctx, sloId, body) - if err != nil { - var localVarReturnValue SLOListResponse - return localVarReturnValue, nil, err - } - - return a.updateSLOExecute(req) -} - -// updateSLOExecute executes the request. -func (a *ServiceLevelObjectivesApi) updateSLOExecute(r apiUpdateSLORequest) (SLOListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue SLOListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.UpdateSLO") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/slo/{slo_id}" - localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewServiceLevelObjectivesApi Returns NewServiceLevelObjectivesApi. -func NewServiceLevelObjectivesApi(client *common.APIClient) *ServiceLevelObjectivesApi { - return &ServiceLevelObjectivesApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_slack_integration.go b/api/v1/datadog/api_slack_integration.go deleted file mode 100644 index 476f6d8a5f0..00000000000 --- a/api/v1/datadog/api_slack_integration.go +++ /dev/null @@ -1,770 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SlackIntegrationApi service type -type SlackIntegrationApi common.Service - -type apiCreateSlackIntegrationChannelRequest struct { - ctx _context.Context - accountName string - body *SlackIntegrationChannel -} - -func (a *SlackIntegrationApi) buildCreateSlackIntegrationChannelRequest(ctx _context.Context, accountName string, body SlackIntegrationChannel) (apiCreateSlackIntegrationChannelRequest, error) { - req := apiCreateSlackIntegrationChannelRequest{ - ctx: ctx, - accountName: accountName, - body: &body, - } - return req, nil -} - -// CreateSlackIntegrationChannel Create a Slack integration channel. -// Add a channel to your Datadog-Slack integration. -func (a *SlackIntegrationApi) CreateSlackIntegrationChannel(ctx _context.Context, accountName string, body SlackIntegrationChannel) (SlackIntegrationChannel, *_nethttp.Response, error) { - req, err := a.buildCreateSlackIntegrationChannelRequest(ctx, accountName, body) - if err != nil { - var localVarReturnValue SlackIntegrationChannel - return localVarReturnValue, nil, err - } - - return a.createSlackIntegrationChannelExecute(req) -} - -// createSlackIntegrationChannelExecute executes the request. -func (a *SlackIntegrationApi) createSlackIntegrationChannelExecute(r apiCreateSlackIntegrationChannelRequest) (SlackIntegrationChannel, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SlackIntegrationChannel - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.CreateSlackIntegrationChannel") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels" - localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSlackIntegrationChannelRequest struct { - ctx _context.Context - accountName string - channelName string -} - -func (a *SlackIntegrationApi) buildGetSlackIntegrationChannelRequest(ctx _context.Context, accountName string, channelName string) (apiGetSlackIntegrationChannelRequest, error) { - req := apiGetSlackIntegrationChannelRequest{ - ctx: ctx, - accountName: accountName, - channelName: channelName, - } - return req, nil -} - -// GetSlackIntegrationChannel Get a Slack integration channel. -// Get a channel configured for your Datadog-Slack integration. -func (a *SlackIntegrationApi) GetSlackIntegrationChannel(ctx _context.Context, accountName string, channelName string) (SlackIntegrationChannel, *_nethttp.Response, error) { - req, err := a.buildGetSlackIntegrationChannelRequest(ctx, accountName, channelName) - if err != nil { - var localVarReturnValue SlackIntegrationChannel - return localVarReturnValue, nil, err - } - - return a.getSlackIntegrationChannelExecute(req) -} - -// getSlackIntegrationChannelExecute executes the request. -func (a *SlackIntegrationApi) getSlackIntegrationChannelExecute(r apiGetSlackIntegrationChannelRequest) (SlackIntegrationChannel, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SlackIntegrationChannel - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.GetSlackIntegrationChannel") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}" - localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"channel_name"+"}", _neturl.PathEscape(common.ParameterToString(r.channelName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSlackIntegrationChannelsRequest struct { - ctx _context.Context - accountName string -} - -func (a *SlackIntegrationApi) buildGetSlackIntegrationChannelsRequest(ctx _context.Context, accountName string) (apiGetSlackIntegrationChannelsRequest, error) { - req := apiGetSlackIntegrationChannelsRequest{ - ctx: ctx, - accountName: accountName, - } - return req, nil -} - -// GetSlackIntegrationChannels Get all channels in a Slack integration. -// Get a list of all channels configured for your Datadog-Slack integration. -func (a *SlackIntegrationApi) GetSlackIntegrationChannels(ctx _context.Context, accountName string) ([]SlackIntegrationChannel, *_nethttp.Response, error) { - req, err := a.buildGetSlackIntegrationChannelsRequest(ctx, accountName) - if err != nil { - var localVarReturnValue []SlackIntegrationChannel - return localVarReturnValue, nil, err - } - - return a.getSlackIntegrationChannelsExecute(req) -} - -// getSlackIntegrationChannelsExecute executes the request. -func (a *SlackIntegrationApi) getSlackIntegrationChannelsExecute(r apiGetSlackIntegrationChannelsRequest) ([]SlackIntegrationChannel, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue []SlackIntegrationChannel - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.GetSlackIntegrationChannels") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels" - localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiRemoveSlackIntegrationChannelRequest struct { - ctx _context.Context - accountName string - channelName string -} - -func (a *SlackIntegrationApi) buildRemoveSlackIntegrationChannelRequest(ctx _context.Context, accountName string, channelName string) (apiRemoveSlackIntegrationChannelRequest, error) { - req := apiRemoveSlackIntegrationChannelRequest{ - ctx: ctx, - accountName: accountName, - channelName: channelName, - } - return req, nil -} - -// RemoveSlackIntegrationChannel Remove a Slack integration channel. -// Remove a channel from your Datadog-Slack integration. -func (a *SlackIntegrationApi) RemoveSlackIntegrationChannel(ctx _context.Context, accountName string, channelName string) (*_nethttp.Response, error) { - req, err := a.buildRemoveSlackIntegrationChannelRequest(ctx, accountName, channelName) - if err != nil { - return nil, err - } - - return a.removeSlackIntegrationChannelExecute(req) -} - -// removeSlackIntegrationChannelExecute executes the request. -func (a *SlackIntegrationApi) removeSlackIntegrationChannelExecute(r apiRemoveSlackIntegrationChannelRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.RemoveSlackIntegrationChannel") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}" - localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"channel_name"+"}", _neturl.PathEscape(common.ParameterToString(r.channelName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiUpdateSlackIntegrationChannelRequest struct { - ctx _context.Context - accountName string - channelName string - body *SlackIntegrationChannel -} - -func (a *SlackIntegrationApi) buildUpdateSlackIntegrationChannelRequest(ctx _context.Context, accountName string, channelName string, body SlackIntegrationChannel) (apiUpdateSlackIntegrationChannelRequest, error) { - req := apiUpdateSlackIntegrationChannelRequest{ - ctx: ctx, - accountName: accountName, - channelName: channelName, - body: &body, - } - return req, nil -} - -// UpdateSlackIntegrationChannel Update a Slack integration channel. -// Update a channel used in your Datadog-Slack integration. -func (a *SlackIntegrationApi) UpdateSlackIntegrationChannel(ctx _context.Context, accountName string, channelName string, body SlackIntegrationChannel) (SlackIntegrationChannel, *_nethttp.Response, error) { - req, err := a.buildUpdateSlackIntegrationChannelRequest(ctx, accountName, channelName, body) - if err != nil { - var localVarReturnValue SlackIntegrationChannel - return localVarReturnValue, nil, err - } - - return a.updateSlackIntegrationChannelExecute(req) -} - -// updateSlackIntegrationChannelExecute executes the request. -func (a *SlackIntegrationApi) updateSlackIntegrationChannelExecute(r apiUpdateSlackIntegrationChannelRequest) (SlackIntegrationChannel, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SlackIntegrationChannel - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.UpdateSlackIntegrationChannel") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}" - localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"channel_name"+"}", _neturl.PathEscape(common.ParameterToString(r.channelName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewSlackIntegrationApi Returns NewSlackIntegrationApi. -func NewSlackIntegrationApi(client *common.APIClient) *SlackIntegrationApi { - return &SlackIntegrationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_snapshots.go b/api/v1/datadog/api_snapshots.go deleted file mode 100644 index abcb545e428..00000000000 --- a/api/v1/datadog/api_snapshots.go +++ /dev/null @@ -1,261 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SnapshotsApi service type -type SnapshotsApi common.Service - -type apiGetGraphSnapshotRequest struct { - ctx _context.Context - start *int64 - end *int64 - metricQuery *string - eventQuery *string - graphDef *string - title *string - height *int64 - width *int64 -} - -// GetGraphSnapshotOptionalParameters holds optional parameters for GetGraphSnapshot. -type GetGraphSnapshotOptionalParameters struct { - MetricQuery *string - EventQuery *string - GraphDef *string - Title *string - Height *int64 - Width *int64 -} - -// NewGetGraphSnapshotOptionalParameters creates an empty struct for parameters. -func NewGetGraphSnapshotOptionalParameters() *GetGraphSnapshotOptionalParameters { - this := GetGraphSnapshotOptionalParameters{} - return &this -} - -// WithMetricQuery sets the corresponding parameter name and returns the struct. -func (r *GetGraphSnapshotOptionalParameters) WithMetricQuery(metricQuery string) *GetGraphSnapshotOptionalParameters { - r.MetricQuery = &metricQuery - return r -} - -// WithEventQuery sets the corresponding parameter name and returns the struct. -func (r *GetGraphSnapshotOptionalParameters) WithEventQuery(eventQuery string) *GetGraphSnapshotOptionalParameters { - r.EventQuery = &eventQuery - return r -} - -// WithGraphDef sets the corresponding parameter name and returns the struct. -func (r *GetGraphSnapshotOptionalParameters) WithGraphDef(graphDef string) *GetGraphSnapshotOptionalParameters { - r.GraphDef = &graphDef - return r -} - -// WithTitle sets the corresponding parameter name and returns the struct. -func (r *GetGraphSnapshotOptionalParameters) WithTitle(title string) *GetGraphSnapshotOptionalParameters { - r.Title = &title - return r -} - -// WithHeight sets the corresponding parameter name and returns the struct. -func (r *GetGraphSnapshotOptionalParameters) WithHeight(height int64) *GetGraphSnapshotOptionalParameters { - r.Height = &height - return r -} - -// WithWidth sets the corresponding parameter name and returns the struct. -func (r *GetGraphSnapshotOptionalParameters) WithWidth(width int64) *GetGraphSnapshotOptionalParameters { - r.Width = &width - return r -} - -func (a *SnapshotsApi) buildGetGraphSnapshotRequest(ctx _context.Context, start int64, end int64, o ...GetGraphSnapshotOptionalParameters) (apiGetGraphSnapshotRequest, error) { - req := apiGetGraphSnapshotRequest{ - ctx: ctx, - start: &start, - end: &end, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetGraphSnapshotOptionalParameters is allowed") - } - - if o != nil { - req.metricQuery = o[0].MetricQuery - req.eventQuery = o[0].EventQuery - req.graphDef = o[0].GraphDef - req.title = o[0].Title - req.height = o[0].Height - req.width = o[0].Width - } - return req, nil -} - -// GetGraphSnapshot Take graph snapshots. -// Take graph snapshots. -// **Note**: When a snapshot is created, there is some delay before it is available. -func (a *SnapshotsApi) GetGraphSnapshot(ctx _context.Context, start int64, end int64, o ...GetGraphSnapshotOptionalParameters) (GraphSnapshot, *_nethttp.Response, error) { - req, err := a.buildGetGraphSnapshotRequest(ctx, start, end, o...) - if err != nil { - var localVarReturnValue GraphSnapshot - return localVarReturnValue, nil, err - } - - return a.getGraphSnapshotExecute(req) -} - -// getGraphSnapshotExecute executes the request. -func (a *SnapshotsApi) getGraphSnapshotExecute(r apiGetGraphSnapshotRequest) (GraphSnapshot, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue GraphSnapshot - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SnapshotsApi.GetGraphSnapshot") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/graph/snapshot" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.start == nil { - return localVarReturnValue, nil, common.ReportError("start is required and must be specified") - } - if r.end == nil { - return localVarReturnValue, nil, common.ReportError("end is required and must be specified") - } - localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) - localVarQueryParams.Add("end", common.ParameterToString(*r.end, "")) - if r.metricQuery != nil { - localVarQueryParams.Add("metric_query", common.ParameterToString(*r.metricQuery, "")) - } - if r.eventQuery != nil { - localVarQueryParams.Add("event_query", common.ParameterToString(*r.eventQuery, "")) - } - if r.graphDef != nil { - localVarQueryParams.Add("graph_def", common.ParameterToString(*r.graphDef, "")) - } - if r.title != nil { - localVarQueryParams.Add("title", common.ParameterToString(*r.title, "")) - } - if r.height != nil { - localVarQueryParams.Add("height", common.ParameterToString(*r.height, "")) - } - if r.width != nil { - localVarQueryParams.Add("width", common.ParameterToString(*r.width, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewSnapshotsApi Returns NewSnapshotsApi. -func NewSnapshotsApi(client *common.APIClient) *SnapshotsApi { - return &SnapshotsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_synthetics.go b/api/v1/datadog/api_synthetics.go deleted file mode 100644 index 0332646926d..00000000000 --- a/api/v1/datadog/api_synthetics.go +++ /dev/null @@ -1,3883 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "reflect" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SyntheticsApi service type -type SyntheticsApi common.Service - -type apiCreateGlobalVariableRequest struct { - ctx _context.Context - body *SyntheticsGlobalVariable -} - -func (a *SyntheticsApi) buildCreateGlobalVariableRequest(ctx _context.Context, body SyntheticsGlobalVariable) (apiCreateGlobalVariableRequest, error) { - req := apiCreateGlobalVariableRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateGlobalVariable Create a global variable. -// Create a Synthetics global variable. -func (a *SyntheticsApi) CreateGlobalVariable(ctx _context.Context, body SyntheticsGlobalVariable) (SyntheticsGlobalVariable, *_nethttp.Response, error) { - req, err := a.buildCreateGlobalVariableRequest(ctx, body) - if err != nil { - var localVarReturnValue SyntheticsGlobalVariable - return localVarReturnValue, nil, err - } - - return a.createGlobalVariableExecute(req) -} - -// createGlobalVariableExecute executes the request. -func (a *SyntheticsApi) createGlobalVariableExecute(r apiCreateGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SyntheticsGlobalVariable - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreateGlobalVariable") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/variables" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreatePrivateLocationRequest struct { - ctx _context.Context - body *SyntheticsPrivateLocation -} - -func (a *SyntheticsApi) buildCreatePrivateLocationRequest(ctx _context.Context, body SyntheticsPrivateLocation) (apiCreatePrivateLocationRequest, error) { - req := apiCreatePrivateLocationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreatePrivateLocation Create a private location. -// Create a new Synthetics private location. -func (a *SyntheticsApi) CreatePrivateLocation(ctx _context.Context, body SyntheticsPrivateLocation) (SyntheticsPrivateLocationCreationResponse, *_nethttp.Response, error) { - req, err := a.buildCreatePrivateLocationRequest(ctx, body) - if err != nil { - var localVarReturnValue SyntheticsPrivateLocationCreationResponse - return localVarReturnValue, nil, err - } - - return a.createPrivateLocationExecute(req) -} - -// createPrivateLocationExecute executes the request. -func (a *SyntheticsApi) createPrivateLocationExecute(r apiCreatePrivateLocationRequest) (SyntheticsPrivateLocationCreationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SyntheticsPrivateLocationCreationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreatePrivateLocation") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/private-locations" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 402 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateSyntheticsAPITestRequest struct { - ctx _context.Context - body *SyntheticsAPITest -} - -func (a *SyntheticsApi) buildCreateSyntheticsAPITestRequest(ctx _context.Context, body SyntheticsAPITest) (apiCreateSyntheticsAPITestRequest, error) { - req := apiCreateSyntheticsAPITestRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateSyntheticsAPITest Create an API test. -// Create a Synthetic API test. -func (a *SyntheticsApi) CreateSyntheticsAPITest(ctx _context.Context, body SyntheticsAPITest) (SyntheticsAPITest, *_nethttp.Response, error) { - req, err := a.buildCreateSyntheticsAPITestRequest(ctx, body) - if err != nil { - var localVarReturnValue SyntheticsAPITest - return localVarReturnValue, nil, err - } - - return a.createSyntheticsAPITestExecute(req) -} - -// createSyntheticsAPITestExecute executes the request. -func (a *SyntheticsApi) createSyntheticsAPITestExecute(r apiCreateSyntheticsAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SyntheticsAPITest - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreateSyntheticsAPITest") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/api" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 402 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateSyntheticsBrowserTestRequest struct { - ctx _context.Context - body *SyntheticsBrowserTest -} - -func (a *SyntheticsApi) buildCreateSyntheticsBrowserTestRequest(ctx _context.Context, body SyntheticsBrowserTest) (apiCreateSyntheticsBrowserTestRequest, error) { - req := apiCreateSyntheticsBrowserTestRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateSyntheticsBrowserTest Create a browser test. -// Create a Synthetic browser test. -func (a *SyntheticsApi) CreateSyntheticsBrowserTest(ctx _context.Context, body SyntheticsBrowserTest) (SyntheticsBrowserTest, *_nethttp.Response, error) { - req, err := a.buildCreateSyntheticsBrowserTestRequest(ctx, body) - if err != nil { - var localVarReturnValue SyntheticsBrowserTest - return localVarReturnValue, nil, err - } - - return a.createSyntheticsBrowserTestExecute(req) -} - -// createSyntheticsBrowserTestExecute executes the request. -func (a *SyntheticsApi) createSyntheticsBrowserTestExecute(r apiCreateSyntheticsBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SyntheticsBrowserTest - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreateSyntheticsBrowserTest") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 402 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteGlobalVariableRequest struct { - ctx _context.Context - variableId string -} - -func (a *SyntheticsApi) buildDeleteGlobalVariableRequest(ctx _context.Context, variableId string) (apiDeleteGlobalVariableRequest, error) { - req := apiDeleteGlobalVariableRequest{ - ctx: ctx, - variableId: variableId, - } - return req, nil -} - -// DeleteGlobalVariable Delete a global variable. -// Delete a Synthetics global variable. -func (a *SyntheticsApi) DeleteGlobalVariable(ctx _context.Context, variableId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteGlobalVariableRequest(ctx, variableId) - if err != nil { - return nil, err - } - - return a.deleteGlobalVariableExecute(req) -} - -// deleteGlobalVariableExecute executes the request. -func (a *SyntheticsApi) deleteGlobalVariableExecute(r apiDeleteGlobalVariableRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.DeleteGlobalVariable") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" - localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(common.ParameterToString(r.variableId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiDeletePrivateLocationRequest struct { - ctx _context.Context - locationId string -} - -func (a *SyntheticsApi) buildDeletePrivateLocationRequest(ctx _context.Context, locationId string) (apiDeletePrivateLocationRequest, error) { - req := apiDeletePrivateLocationRequest{ - ctx: ctx, - locationId: locationId, - } - return req, nil -} - -// DeletePrivateLocation Delete a private location. -// Delete a Synthetics private location. -func (a *SyntheticsApi) DeletePrivateLocation(ctx _context.Context, locationId string) (*_nethttp.Response, error) { - req, err := a.buildDeletePrivateLocationRequest(ctx, locationId) - if err != nil { - return nil, err - } - - return a.deletePrivateLocationExecute(req) -} - -// deletePrivateLocationExecute executes the request. -func (a *SyntheticsApi) deletePrivateLocationExecute(r apiDeletePrivateLocationRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.DeletePrivateLocation") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" - localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(common.ParameterToString(r.locationId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiDeleteTestsRequest struct { - ctx _context.Context - body *SyntheticsDeleteTestsPayload -} - -func (a *SyntheticsApi) buildDeleteTestsRequest(ctx _context.Context, body SyntheticsDeleteTestsPayload) (apiDeleteTestsRequest, error) { - req := apiDeleteTestsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteTests Delete tests. -// Delete multiple Synthetic tests by ID. -func (a *SyntheticsApi) DeleteTests(ctx _context.Context, body SyntheticsDeleteTestsPayload) (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteTestsRequest(ctx, body) - if err != nil { - var localVarReturnValue SyntheticsDeleteTestsResponse - return localVarReturnValue, nil, err - } - - return a.deleteTestsExecute(req) -} - -// deleteTestsExecute executes the request. -func (a *SyntheticsApi) deleteTestsExecute(r apiDeleteTestsRequest) (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SyntheticsDeleteTestsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.DeleteTests") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/delete" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiEditGlobalVariableRequest struct { - ctx _context.Context - variableId string - body *SyntheticsGlobalVariable -} - -func (a *SyntheticsApi) buildEditGlobalVariableRequest(ctx _context.Context, variableId string, body SyntheticsGlobalVariable) (apiEditGlobalVariableRequest, error) { - req := apiEditGlobalVariableRequest{ - ctx: ctx, - variableId: variableId, - body: &body, - } - return req, nil -} - -// EditGlobalVariable Edit a global variable. -// Edit a Synthetics global variable. -func (a *SyntheticsApi) EditGlobalVariable(ctx _context.Context, variableId string, body SyntheticsGlobalVariable) (SyntheticsGlobalVariable, *_nethttp.Response, error) { - req, err := a.buildEditGlobalVariableRequest(ctx, variableId, body) - if err != nil { - var localVarReturnValue SyntheticsGlobalVariable - return localVarReturnValue, nil, err - } - - return a.editGlobalVariableExecute(req) -} - -// editGlobalVariableExecute executes the request. -func (a *SyntheticsApi) editGlobalVariableExecute(r apiEditGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue SyntheticsGlobalVariable - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.EditGlobalVariable") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" - localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(common.ParameterToString(r.variableId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetAPITestRequest struct { - ctx _context.Context - publicId string -} - -func (a *SyntheticsApi) buildGetAPITestRequest(ctx _context.Context, publicId string) (apiGetAPITestRequest, error) { - req := apiGetAPITestRequest{ - ctx: ctx, - publicId: publicId, - } - return req, nil -} - -// GetAPITest Get an API test. -// Get the detailed configuration associated with -// a Synthetic API test. -func (a *SyntheticsApi) GetAPITest(ctx _context.Context, publicId string) (SyntheticsAPITest, *_nethttp.Response, error) { - req, err := a.buildGetAPITestRequest(ctx, publicId) - if err != nil { - var localVarReturnValue SyntheticsAPITest - return localVarReturnValue, nil, err - } - - return a.getAPITestExecute(req) -} - -// getAPITestExecute executes the request. -func (a *SyntheticsApi) getAPITestExecute(r apiGetAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsAPITest - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetAPITest") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/api/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetAPITestLatestResultsRequest struct { - ctx _context.Context - publicId string - fromTs *int64 - toTs *int64 - probeDc *[]string -} - -// GetAPITestLatestResultsOptionalParameters holds optional parameters for GetAPITestLatestResults. -type GetAPITestLatestResultsOptionalParameters struct { - FromTs *int64 - ToTs *int64 - ProbeDc *[]string -} - -// NewGetAPITestLatestResultsOptionalParameters creates an empty struct for parameters. -func NewGetAPITestLatestResultsOptionalParameters() *GetAPITestLatestResultsOptionalParameters { - this := GetAPITestLatestResultsOptionalParameters{} - return &this -} - -// WithFromTs sets the corresponding parameter name and returns the struct. -func (r *GetAPITestLatestResultsOptionalParameters) WithFromTs(fromTs int64) *GetAPITestLatestResultsOptionalParameters { - r.FromTs = &fromTs - return r -} - -// WithToTs sets the corresponding parameter name and returns the struct. -func (r *GetAPITestLatestResultsOptionalParameters) WithToTs(toTs int64) *GetAPITestLatestResultsOptionalParameters { - r.ToTs = &toTs - return r -} - -// WithProbeDc sets the corresponding parameter name and returns the struct. -func (r *GetAPITestLatestResultsOptionalParameters) WithProbeDc(probeDc []string) *GetAPITestLatestResultsOptionalParameters { - r.ProbeDc = &probeDc - return r -} - -func (a *SyntheticsApi) buildGetAPITestLatestResultsRequest(ctx _context.Context, publicId string, o ...GetAPITestLatestResultsOptionalParameters) (apiGetAPITestLatestResultsRequest, error) { - req := apiGetAPITestLatestResultsRequest{ - ctx: ctx, - publicId: publicId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetAPITestLatestResultsOptionalParameters is allowed") - } - - if o != nil { - req.fromTs = o[0].FromTs - req.toTs = o[0].ToTs - req.probeDc = o[0].ProbeDc - } - return req, nil -} - -// GetAPITestLatestResults Get an API test's latest results summaries. -// Get the last 50 test results summaries for a given Synthetics API test. -func (a *SyntheticsApi) GetAPITestLatestResults(ctx _context.Context, publicId string, o ...GetAPITestLatestResultsOptionalParameters) (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { - req, err := a.buildGetAPITestLatestResultsRequest(ctx, publicId, o...) - if err != nil { - var localVarReturnValue SyntheticsGetAPITestLatestResultsResponse - return localVarReturnValue, nil, err - } - - return a.getAPITestLatestResultsExecute(req) -} - -// getAPITestLatestResultsExecute executes the request. -func (a *SyntheticsApi) getAPITestLatestResultsExecute(r apiGetAPITestLatestResultsRequest) (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsGetAPITestLatestResultsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetAPITestLatestResults") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.fromTs != nil { - localVarQueryParams.Add("from_ts", common.ParameterToString(*r.fromTs, "")) - } - if r.toTs != nil { - localVarQueryParams.Add("to_ts", common.ParameterToString(*r.toTs, "")) - } - if r.probeDc != nil { - t := *r.probeDc - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("probe_dc", common.ParameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("probe_dc", common.ParameterToString(t, "multi")) - } - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetAPITestResultRequest struct { - ctx _context.Context - publicId string - resultId string -} - -func (a *SyntheticsApi) buildGetAPITestResultRequest(ctx _context.Context, publicId string, resultId string) (apiGetAPITestResultRequest, error) { - req := apiGetAPITestResultRequest{ - ctx: ctx, - publicId: publicId, - resultId: resultId, - } - return req, nil -} - -// GetAPITestResult Get an API test result. -// Get a specific full result from a given (API) Synthetic test. -func (a *SyntheticsApi) GetAPITestResult(ctx _context.Context, publicId string, resultId string) (SyntheticsAPITestResultFull, *_nethttp.Response, error) { - req, err := a.buildGetAPITestResultRequest(ctx, publicId, resultId) - if err != nil { - var localVarReturnValue SyntheticsAPITestResultFull - return localVarReturnValue, nil, err - } - - return a.getAPITestResultExecute(req) -} - -// getAPITestResultExecute executes the request. -func (a *SyntheticsApi) getAPITestResultExecute(r apiGetAPITestResultRequest) (SyntheticsAPITestResultFull, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsAPITestResultFull - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetAPITestResult") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results/{result_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(common.ParameterToString(r.resultId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetBrowserTestRequest struct { - ctx _context.Context - publicId string -} - -func (a *SyntheticsApi) buildGetBrowserTestRequest(ctx _context.Context, publicId string) (apiGetBrowserTestRequest, error) { - req := apiGetBrowserTestRequest{ - ctx: ctx, - publicId: publicId, - } - return req, nil -} - -// GetBrowserTest Get a browser test. -// Get the detailed configuration (including steps) associated with -// a Synthetic browser test. -func (a *SyntheticsApi) GetBrowserTest(ctx _context.Context, publicId string) (SyntheticsBrowserTest, *_nethttp.Response, error) { - req, err := a.buildGetBrowserTestRequest(ctx, publicId) - if err != nil { - var localVarReturnValue SyntheticsBrowserTest - return localVarReturnValue, nil, err - } - - return a.getBrowserTestExecute(req) -} - -// getBrowserTestExecute executes the request. -func (a *SyntheticsApi) getBrowserTestExecute(r apiGetBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsBrowserTest - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetBrowserTest") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetBrowserTestLatestResultsRequest struct { - ctx _context.Context - publicId string - fromTs *int64 - toTs *int64 - probeDc *[]string -} - -// GetBrowserTestLatestResultsOptionalParameters holds optional parameters for GetBrowserTestLatestResults. -type GetBrowserTestLatestResultsOptionalParameters struct { - FromTs *int64 - ToTs *int64 - ProbeDc *[]string -} - -// NewGetBrowserTestLatestResultsOptionalParameters creates an empty struct for parameters. -func NewGetBrowserTestLatestResultsOptionalParameters() *GetBrowserTestLatestResultsOptionalParameters { - this := GetBrowserTestLatestResultsOptionalParameters{} - return &this -} - -// WithFromTs sets the corresponding parameter name and returns the struct. -func (r *GetBrowserTestLatestResultsOptionalParameters) WithFromTs(fromTs int64) *GetBrowserTestLatestResultsOptionalParameters { - r.FromTs = &fromTs - return r -} - -// WithToTs sets the corresponding parameter name and returns the struct. -func (r *GetBrowserTestLatestResultsOptionalParameters) WithToTs(toTs int64) *GetBrowserTestLatestResultsOptionalParameters { - r.ToTs = &toTs - return r -} - -// WithProbeDc sets the corresponding parameter name and returns the struct. -func (r *GetBrowserTestLatestResultsOptionalParameters) WithProbeDc(probeDc []string) *GetBrowserTestLatestResultsOptionalParameters { - r.ProbeDc = &probeDc - return r -} - -func (a *SyntheticsApi) buildGetBrowserTestLatestResultsRequest(ctx _context.Context, publicId string, o ...GetBrowserTestLatestResultsOptionalParameters) (apiGetBrowserTestLatestResultsRequest, error) { - req := apiGetBrowserTestLatestResultsRequest{ - ctx: ctx, - publicId: publicId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetBrowserTestLatestResultsOptionalParameters is allowed") - } - - if o != nil { - req.fromTs = o[0].FromTs - req.toTs = o[0].ToTs - req.probeDc = o[0].ProbeDc - } - return req, nil -} - -// GetBrowserTestLatestResults Get a browser test's latest results summaries. -// Get the last 50 test results summaries for a given Synthetics Browser test. -func (a *SyntheticsApi) GetBrowserTestLatestResults(ctx _context.Context, publicId string, o ...GetBrowserTestLatestResultsOptionalParameters) (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { - req, err := a.buildGetBrowserTestLatestResultsRequest(ctx, publicId, o...) - if err != nil { - var localVarReturnValue SyntheticsGetBrowserTestLatestResultsResponse - return localVarReturnValue, nil, err - } - - return a.getBrowserTestLatestResultsExecute(req) -} - -// getBrowserTestLatestResultsExecute executes the request. -func (a *SyntheticsApi) getBrowserTestLatestResultsExecute(r apiGetBrowserTestLatestResultsRequest) (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsGetBrowserTestLatestResultsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetBrowserTestLatestResults") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.fromTs != nil { - localVarQueryParams.Add("from_ts", common.ParameterToString(*r.fromTs, "")) - } - if r.toTs != nil { - localVarQueryParams.Add("to_ts", common.ParameterToString(*r.toTs, "")) - } - if r.probeDc != nil { - t := *r.probeDc - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("probe_dc", common.ParameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("probe_dc", common.ParameterToString(t, "multi")) - } - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetBrowserTestResultRequest struct { - ctx _context.Context - publicId string - resultId string -} - -func (a *SyntheticsApi) buildGetBrowserTestResultRequest(ctx _context.Context, publicId string, resultId string) (apiGetBrowserTestResultRequest, error) { - req := apiGetBrowserTestResultRequest{ - ctx: ctx, - publicId: publicId, - resultId: resultId, - } - return req, nil -} - -// GetBrowserTestResult Get a browser test result. -// Get a specific full result from a given (browser) Synthetic test. -func (a *SyntheticsApi) GetBrowserTestResult(ctx _context.Context, publicId string, resultId string) (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { - req, err := a.buildGetBrowserTestResultRequest(ctx, publicId, resultId) - if err != nil { - var localVarReturnValue SyntheticsBrowserTestResultFull - return localVarReturnValue, nil, err - } - - return a.getBrowserTestResultExecute(req) -} - -// getBrowserTestResultExecute executes the request. -func (a *SyntheticsApi) getBrowserTestResultExecute(r apiGetBrowserTestResultRequest) (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsBrowserTestResultFull - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetBrowserTestResult") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(common.ParameterToString(r.resultId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetGlobalVariableRequest struct { - ctx _context.Context - variableId string -} - -func (a *SyntheticsApi) buildGetGlobalVariableRequest(ctx _context.Context, variableId string) (apiGetGlobalVariableRequest, error) { - req := apiGetGlobalVariableRequest{ - ctx: ctx, - variableId: variableId, - } - return req, nil -} - -// GetGlobalVariable Get a global variable. -// Get the detailed configuration of a global variable. -func (a *SyntheticsApi) GetGlobalVariable(ctx _context.Context, variableId string) (SyntheticsGlobalVariable, *_nethttp.Response, error) { - req, err := a.buildGetGlobalVariableRequest(ctx, variableId) - if err != nil { - var localVarReturnValue SyntheticsGlobalVariable - return localVarReturnValue, nil, err - } - - return a.getGlobalVariableExecute(req) -} - -// getGlobalVariableExecute executes the request. -func (a *SyntheticsApi) getGlobalVariableExecute(r apiGetGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsGlobalVariable - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetGlobalVariable") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" - localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(common.ParameterToString(r.variableId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetPrivateLocationRequest struct { - ctx _context.Context - locationId string -} - -func (a *SyntheticsApi) buildGetPrivateLocationRequest(ctx _context.Context, locationId string) (apiGetPrivateLocationRequest, error) { - req := apiGetPrivateLocationRequest{ - ctx: ctx, - locationId: locationId, - } - return req, nil -} - -// GetPrivateLocation Get a private location. -// Get a Synthetics private location. -func (a *SyntheticsApi) GetPrivateLocation(ctx _context.Context, locationId string) (SyntheticsPrivateLocation, *_nethttp.Response, error) { - req, err := a.buildGetPrivateLocationRequest(ctx, locationId) - if err != nil { - var localVarReturnValue SyntheticsPrivateLocation - return localVarReturnValue, nil, err - } - - return a.getPrivateLocationExecute(req) -} - -// getPrivateLocationExecute executes the request. -func (a *SyntheticsApi) getPrivateLocationExecute(r apiGetPrivateLocationRequest) (SyntheticsPrivateLocation, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsPrivateLocation - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetPrivateLocation") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" - localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(common.ParameterToString(r.locationId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSyntheticsCIBatchRequest struct { - ctx _context.Context - batchId string -} - -func (a *SyntheticsApi) buildGetSyntheticsCIBatchRequest(ctx _context.Context, batchId string) (apiGetSyntheticsCIBatchRequest, error) { - req := apiGetSyntheticsCIBatchRequest{ - ctx: ctx, - batchId: batchId, - } - return req, nil -} - -// GetSyntheticsCIBatch Get details of batch. -// Get a batch's updated details. -func (a *SyntheticsApi) GetSyntheticsCIBatch(ctx _context.Context, batchId string) (SyntheticsBatchDetails, *_nethttp.Response, error) { - req, err := a.buildGetSyntheticsCIBatchRequest(ctx, batchId) - if err != nil { - var localVarReturnValue SyntheticsBatchDetails - return localVarReturnValue, nil, err - } - - return a.getSyntheticsCIBatchExecute(req) -} - -// getSyntheticsCIBatchExecute executes the request. -func (a *SyntheticsApi) getSyntheticsCIBatchExecute(r apiGetSyntheticsCIBatchRequest) (SyntheticsBatchDetails, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsBatchDetails - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetSyntheticsCIBatch") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/ci/batch/{batch_id}" - localVarPath = strings.Replace(localVarPath, "{"+"batch_id"+"}", _neturl.PathEscape(common.ParameterToString(r.batchId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetTestRequest struct { - ctx _context.Context - publicId string -} - -func (a *SyntheticsApi) buildGetTestRequest(ctx _context.Context, publicId string) (apiGetTestRequest, error) { - req := apiGetTestRequest{ - ctx: ctx, - publicId: publicId, - } - return req, nil -} - -// GetTest Get a test configuration. -// Get the detailed configuration associated with a Synthetics test. -func (a *SyntheticsApi) GetTest(ctx _context.Context, publicId string) (SyntheticsTestDetails, *_nethttp.Response, error) { - req, err := a.buildGetTestRequest(ctx, publicId) - if err != nil { - var localVarReturnValue SyntheticsTestDetails - return localVarReturnValue, nil, err - } - - return a.getTestExecute(req) -} - -// getTestExecute executes the request. -func (a *SyntheticsApi) getTestExecute(r apiGetTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsTestDetails - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetTest") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListGlobalVariablesRequest struct { - ctx _context.Context -} - -func (a *SyntheticsApi) buildListGlobalVariablesRequest(ctx _context.Context) (apiListGlobalVariablesRequest, error) { - req := apiListGlobalVariablesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListGlobalVariables Get all global variables. -// Get the list of all Synthetics global variables. -func (a *SyntheticsApi) ListGlobalVariables(ctx _context.Context) (SyntheticsListGlobalVariablesResponse, *_nethttp.Response, error) { - req, err := a.buildListGlobalVariablesRequest(ctx) - if err != nil { - var localVarReturnValue SyntheticsListGlobalVariablesResponse - return localVarReturnValue, nil, err - } - - return a.listGlobalVariablesExecute(req) -} - -// listGlobalVariablesExecute executes the request. -func (a *SyntheticsApi) listGlobalVariablesExecute(r apiListGlobalVariablesRequest) (SyntheticsListGlobalVariablesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsListGlobalVariablesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.ListGlobalVariables") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/variables" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListLocationsRequest struct { - ctx _context.Context -} - -func (a *SyntheticsApi) buildListLocationsRequest(ctx _context.Context) (apiListLocationsRequest, error) { - req := apiListLocationsRequest{ - ctx: ctx, - } - return req, nil -} - -// ListLocations Get all locations (public and private). -// Get the list of public and private locations available for Synthetic -// tests. No arguments required. -func (a *SyntheticsApi) ListLocations(ctx _context.Context) (SyntheticsLocations, *_nethttp.Response, error) { - req, err := a.buildListLocationsRequest(ctx) - if err != nil { - var localVarReturnValue SyntheticsLocations - return localVarReturnValue, nil, err - } - - return a.listLocationsExecute(req) -} - -// listLocationsExecute executes the request. -func (a *SyntheticsApi) listLocationsExecute(r apiListLocationsRequest) (SyntheticsLocations, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsLocations - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.ListLocations") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/locations" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListTestsRequest struct { - ctx _context.Context -} - -func (a *SyntheticsApi) buildListTestsRequest(ctx _context.Context) (apiListTestsRequest, error) { - req := apiListTestsRequest{ - ctx: ctx, - } - return req, nil -} - -// ListTests Get the list of all tests. -// Get the list of all Synthetic tests. -func (a *SyntheticsApi) ListTests(ctx _context.Context) (SyntheticsListTestsResponse, *_nethttp.Response, error) { - req, err := a.buildListTestsRequest(ctx) - if err != nil { - var localVarReturnValue SyntheticsListTestsResponse - return localVarReturnValue, nil, err - } - - return a.listTestsExecute(req) -} - -// listTestsExecute executes the request. -func (a *SyntheticsApi) listTestsExecute(r apiListTestsRequest) (SyntheticsListTestsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SyntheticsListTestsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.ListTests") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiTriggerCITestsRequest struct { - ctx _context.Context - body *SyntheticsCITestBody -} - -func (a *SyntheticsApi) buildTriggerCITestsRequest(ctx _context.Context, body SyntheticsCITestBody) (apiTriggerCITestsRequest, error) { - req := apiTriggerCITestsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// TriggerCITests Trigger tests from CI/CD pipelines. -// Trigger a set of Synthetics tests for continuous integration. -func (a *SyntheticsApi) TriggerCITests(ctx _context.Context, body SyntheticsCITestBody) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { - req, err := a.buildTriggerCITestsRequest(ctx, body) - if err != nil { - var localVarReturnValue SyntheticsTriggerCITestsResponse - return localVarReturnValue, nil, err - } - - return a.triggerCITestsExecute(req) -} - -// triggerCITestsExecute executes the request. -func (a *SyntheticsApi) triggerCITestsExecute(r apiTriggerCITestsRequest) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SyntheticsTriggerCITestsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.TriggerCITests") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/trigger/ci" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiTriggerTestsRequest struct { - ctx _context.Context - body *SyntheticsTriggerBody -} - -func (a *SyntheticsApi) buildTriggerTestsRequest(ctx _context.Context, body SyntheticsTriggerBody) (apiTriggerTestsRequest, error) { - req := apiTriggerTestsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// TriggerTests Trigger Synthetics tests. -// Trigger a set of Synthetics tests. -func (a *SyntheticsApi) TriggerTests(ctx _context.Context, body SyntheticsTriggerBody) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { - req, err := a.buildTriggerTestsRequest(ctx, body) - if err != nil { - var localVarReturnValue SyntheticsTriggerCITestsResponse - return localVarReturnValue, nil, err - } - - return a.triggerTestsExecute(req) -} - -// triggerTestsExecute executes the request. -func (a *SyntheticsApi) triggerTestsExecute(r apiTriggerTestsRequest) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SyntheticsTriggerCITestsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.TriggerTests") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/trigger" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateAPITestRequest struct { - ctx _context.Context - publicId string - body *SyntheticsAPITest -} - -func (a *SyntheticsApi) buildUpdateAPITestRequest(ctx _context.Context, publicId string, body SyntheticsAPITest) (apiUpdateAPITestRequest, error) { - req := apiUpdateAPITestRequest{ - ctx: ctx, - publicId: publicId, - body: &body, - } - return req, nil -} - -// UpdateAPITest Edit an API test. -// Edit the configuration of a Synthetic API test. -func (a *SyntheticsApi) UpdateAPITest(ctx _context.Context, publicId string, body SyntheticsAPITest) (SyntheticsAPITest, *_nethttp.Response, error) { - req, err := a.buildUpdateAPITestRequest(ctx, publicId, body) - if err != nil { - var localVarReturnValue SyntheticsAPITest - return localVarReturnValue, nil, err - } - - return a.updateAPITestExecute(req) -} - -// updateAPITestExecute executes the request. -func (a *SyntheticsApi) updateAPITestExecute(r apiUpdateAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue SyntheticsAPITest - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdateAPITest") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/api/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateBrowserTestRequest struct { - ctx _context.Context - publicId string - body *SyntheticsBrowserTest -} - -func (a *SyntheticsApi) buildUpdateBrowserTestRequest(ctx _context.Context, publicId string, body SyntheticsBrowserTest) (apiUpdateBrowserTestRequest, error) { - req := apiUpdateBrowserTestRequest{ - ctx: ctx, - publicId: publicId, - body: &body, - } - return req, nil -} - -// UpdateBrowserTest Edit a browser test. -// Edit the configuration of a Synthetic browser test. -func (a *SyntheticsApi) UpdateBrowserTest(ctx _context.Context, publicId string, body SyntheticsBrowserTest) (SyntheticsBrowserTest, *_nethttp.Response, error) { - req, err := a.buildUpdateBrowserTestRequest(ctx, publicId, body) - if err != nil { - var localVarReturnValue SyntheticsBrowserTest - return localVarReturnValue, nil, err - } - - return a.updateBrowserTestExecute(req) -} - -// updateBrowserTestExecute executes the request. -func (a *SyntheticsApi) updateBrowserTestExecute(r apiUpdateBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue SyntheticsBrowserTest - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdateBrowserTest") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdatePrivateLocationRequest struct { - ctx _context.Context - locationId string - body *SyntheticsPrivateLocation -} - -func (a *SyntheticsApi) buildUpdatePrivateLocationRequest(ctx _context.Context, locationId string, body SyntheticsPrivateLocation) (apiUpdatePrivateLocationRequest, error) { - req := apiUpdatePrivateLocationRequest{ - ctx: ctx, - locationId: locationId, - body: &body, - } - return req, nil -} - -// UpdatePrivateLocation Edit a private location. -// Edit a Synthetics private location. -func (a *SyntheticsApi) UpdatePrivateLocation(ctx _context.Context, locationId string, body SyntheticsPrivateLocation) (SyntheticsPrivateLocation, *_nethttp.Response, error) { - req, err := a.buildUpdatePrivateLocationRequest(ctx, locationId, body) - if err != nil { - var localVarReturnValue SyntheticsPrivateLocation - return localVarReturnValue, nil, err - } - - return a.updatePrivateLocationExecute(req) -} - -// updatePrivateLocationExecute executes the request. -func (a *SyntheticsApi) updatePrivateLocationExecute(r apiUpdatePrivateLocationRequest) (SyntheticsPrivateLocation, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue SyntheticsPrivateLocation - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdatePrivateLocation") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" - localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(common.ParameterToString(r.locationId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateTestPauseStatusRequest struct { - ctx _context.Context - publicId string - body *SyntheticsUpdateTestPauseStatusPayload -} - -func (a *SyntheticsApi) buildUpdateTestPauseStatusRequest(ctx _context.Context, publicId string, body SyntheticsUpdateTestPauseStatusPayload) (apiUpdateTestPauseStatusRequest, error) { - req := apiUpdateTestPauseStatusRequest{ - ctx: ctx, - publicId: publicId, - body: &body, - } - return req, nil -} - -// UpdateTestPauseStatus Pause or start a test. -// Pause or start a Synthetics test by changing the status. -func (a *SyntheticsApi) UpdateTestPauseStatus(ctx _context.Context, publicId string, body SyntheticsUpdateTestPauseStatusPayload) (bool, *_nethttp.Response, error) { - req, err := a.buildUpdateTestPauseStatusRequest(ctx, publicId, body) - if err != nil { - var localVarReturnValue bool - return localVarReturnValue, nil, err - } - - return a.updateTestPauseStatusExecute(req) -} - -// updateTestPauseStatusExecute executes the request. -func (a *SyntheticsApi) updateTestPauseStatusExecute(r apiUpdateTestPauseStatusRequest) (bool, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue bool - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdateTestPauseStatus") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/status" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewSyntheticsApi Returns NewSyntheticsApi. -func NewSyntheticsApi(client *common.APIClient) *SyntheticsApi { - return &SyntheticsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_tags.go b/api/v1/datadog/api_tags.go deleted file mode 100644 index bd70f5982bd..00000000000 --- a/api/v1/datadog/api_tags.go +++ /dev/null @@ -1,861 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// TagsApi service type -type TagsApi common.Service - -type apiCreateHostTagsRequest struct { - ctx _context.Context - hostName string - body *HostTags - source *string -} - -// CreateHostTagsOptionalParameters holds optional parameters for CreateHostTags. -type CreateHostTagsOptionalParameters struct { - Source *string -} - -// NewCreateHostTagsOptionalParameters creates an empty struct for parameters. -func NewCreateHostTagsOptionalParameters() *CreateHostTagsOptionalParameters { - this := CreateHostTagsOptionalParameters{} - return &this -} - -// WithSource sets the corresponding parameter name and returns the struct. -func (r *CreateHostTagsOptionalParameters) WithSource(source string) *CreateHostTagsOptionalParameters { - r.Source = &source - return r -} - -func (a *TagsApi) buildCreateHostTagsRequest(ctx _context.Context, hostName string, body HostTags, o ...CreateHostTagsOptionalParameters) (apiCreateHostTagsRequest, error) { - req := apiCreateHostTagsRequest{ - ctx: ctx, - hostName: hostName, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type CreateHostTagsOptionalParameters is allowed") - } - - if o != nil { - req.source = o[0].Source - } - return req, nil -} - -// CreateHostTags Add tags to a host. -// This endpoint allows you to add new tags to a host, -// optionally specifying where these tags come from. -func (a *TagsApi) CreateHostTags(ctx _context.Context, hostName string, body HostTags, o ...CreateHostTagsOptionalParameters) (HostTags, *_nethttp.Response, error) { - req, err := a.buildCreateHostTagsRequest(ctx, hostName, body, o...) - if err != nil { - var localVarReturnValue HostTags - return localVarReturnValue, nil, err - } - - return a.createHostTagsExecute(req) -} - -// createHostTagsExecute executes the request. -func (a *TagsApi) createHostTagsExecute(r apiCreateHostTagsRequest) (HostTags, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue HostTags - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.CreateHostTags") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" - localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - if r.source != nil { - localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteHostTagsRequest struct { - ctx _context.Context - hostName string - source *string -} - -// DeleteHostTagsOptionalParameters holds optional parameters for DeleteHostTags. -type DeleteHostTagsOptionalParameters struct { - Source *string -} - -// NewDeleteHostTagsOptionalParameters creates an empty struct for parameters. -func NewDeleteHostTagsOptionalParameters() *DeleteHostTagsOptionalParameters { - this := DeleteHostTagsOptionalParameters{} - return &this -} - -// WithSource sets the corresponding parameter name and returns the struct. -func (r *DeleteHostTagsOptionalParameters) WithSource(source string) *DeleteHostTagsOptionalParameters { - r.Source = &source - return r -} - -func (a *TagsApi) buildDeleteHostTagsRequest(ctx _context.Context, hostName string, o ...DeleteHostTagsOptionalParameters) (apiDeleteHostTagsRequest, error) { - req := apiDeleteHostTagsRequest{ - ctx: ctx, - hostName: hostName, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type DeleteHostTagsOptionalParameters is allowed") - } - - if o != nil { - req.source = o[0].Source - } - return req, nil -} - -// DeleteHostTags Remove host tags. -// This endpoint allows you to remove all user-assigned tags -// for a single host. -func (a *TagsApi) DeleteHostTags(ctx _context.Context, hostName string, o ...DeleteHostTagsOptionalParameters) (*_nethttp.Response, error) { - req, err := a.buildDeleteHostTagsRequest(ctx, hostName, o...) - if err != nil { - return nil, err - } - - return a.deleteHostTagsExecute(req) -} - -// deleteHostTagsExecute executes the request. -func (a *TagsApi) deleteHostTagsExecute(r apiDeleteHostTagsRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.DeleteHostTags") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" - localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.source != nil { - localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) - } - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetHostTagsRequest struct { - ctx _context.Context - hostName string - source *string -} - -// GetHostTagsOptionalParameters holds optional parameters for GetHostTags. -type GetHostTagsOptionalParameters struct { - Source *string -} - -// NewGetHostTagsOptionalParameters creates an empty struct for parameters. -func NewGetHostTagsOptionalParameters() *GetHostTagsOptionalParameters { - this := GetHostTagsOptionalParameters{} - return &this -} - -// WithSource sets the corresponding parameter name and returns the struct. -func (r *GetHostTagsOptionalParameters) WithSource(source string) *GetHostTagsOptionalParameters { - r.Source = &source - return r -} - -func (a *TagsApi) buildGetHostTagsRequest(ctx _context.Context, hostName string, o ...GetHostTagsOptionalParameters) (apiGetHostTagsRequest, error) { - req := apiGetHostTagsRequest{ - ctx: ctx, - hostName: hostName, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetHostTagsOptionalParameters is allowed") - } - - if o != nil { - req.source = o[0].Source - } - return req, nil -} - -// GetHostTags Get host tags. -// Return the list of tags that apply to a given host. -func (a *TagsApi) GetHostTags(ctx _context.Context, hostName string, o ...GetHostTagsOptionalParameters) (HostTags, *_nethttp.Response, error) { - req, err := a.buildGetHostTagsRequest(ctx, hostName, o...) - if err != nil { - var localVarReturnValue HostTags - return localVarReturnValue, nil, err - } - - return a.getHostTagsExecute(req) -} - -// getHostTagsExecute executes the request. -func (a *TagsApi) getHostTagsExecute(r apiGetHostTagsRequest) (HostTags, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue HostTags - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.GetHostTags") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" - localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.source != nil { - localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListHostTagsRequest struct { - ctx _context.Context - source *string -} - -// ListHostTagsOptionalParameters holds optional parameters for ListHostTags. -type ListHostTagsOptionalParameters struct { - Source *string -} - -// NewListHostTagsOptionalParameters creates an empty struct for parameters. -func NewListHostTagsOptionalParameters() *ListHostTagsOptionalParameters { - this := ListHostTagsOptionalParameters{} - return &this -} - -// WithSource sets the corresponding parameter name and returns the struct. -func (r *ListHostTagsOptionalParameters) WithSource(source string) *ListHostTagsOptionalParameters { - r.Source = &source - return r -} - -func (a *TagsApi) buildListHostTagsRequest(ctx _context.Context, o ...ListHostTagsOptionalParameters) (apiListHostTagsRequest, error) { - req := apiListHostTagsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListHostTagsOptionalParameters is allowed") - } - - if o != nil { - req.source = o[0].Source - } - return req, nil -} - -// ListHostTags Get Tags. -// Return a mapping of tags to hosts for your whole infrastructure. -func (a *TagsApi) ListHostTags(ctx _context.Context, o ...ListHostTagsOptionalParameters) (TagToHosts, *_nethttp.Response, error) { - req, err := a.buildListHostTagsRequest(ctx, o...) - if err != nil { - var localVarReturnValue TagToHosts - return localVarReturnValue, nil, err - } - - return a.listHostTagsExecute(req) -} - -// listHostTagsExecute executes the request. -func (a *TagsApi) listHostTagsExecute(r apiListHostTagsRequest) (TagToHosts, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue TagToHosts - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.ListHostTags") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/tags/hosts" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.source != nil { - localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateHostTagsRequest struct { - ctx _context.Context - hostName string - body *HostTags - source *string -} - -// UpdateHostTagsOptionalParameters holds optional parameters for UpdateHostTags. -type UpdateHostTagsOptionalParameters struct { - Source *string -} - -// NewUpdateHostTagsOptionalParameters creates an empty struct for parameters. -func NewUpdateHostTagsOptionalParameters() *UpdateHostTagsOptionalParameters { - this := UpdateHostTagsOptionalParameters{} - return &this -} - -// WithSource sets the corresponding parameter name and returns the struct. -func (r *UpdateHostTagsOptionalParameters) WithSource(source string) *UpdateHostTagsOptionalParameters { - r.Source = &source - return r -} - -func (a *TagsApi) buildUpdateHostTagsRequest(ctx _context.Context, hostName string, body HostTags, o ...UpdateHostTagsOptionalParameters) (apiUpdateHostTagsRequest, error) { - req := apiUpdateHostTagsRequest{ - ctx: ctx, - hostName: hostName, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type UpdateHostTagsOptionalParameters is allowed") - } - - if o != nil { - req.source = o[0].Source - } - return req, nil -} - -// UpdateHostTags Update host tags. -// This endpoint allows you to update/replace all tags in -// an integration source with those supplied in the request. -func (a *TagsApi) UpdateHostTags(ctx _context.Context, hostName string, body HostTags, o ...UpdateHostTagsOptionalParameters) (HostTags, *_nethttp.Response, error) { - req, err := a.buildUpdateHostTagsRequest(ctx, hostName, body, o...) - if err != nil { - var localVarReturnValue HostTags - return localVarReturnValue, nil, err - } - - return a.updateHostTagsExecute(req) -} - -// updateHostTagsExecute executes the request. -func (a *TagsApi) updateHostTagsExecute(r apiUpdateHostTagsRequest) (HostTags, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue HostTags - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.UpdateHostTags") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" - localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - if r.source != nil { - localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewTagsApi Returns NewTagsApi. -func NewTagsApi(client *common.APIClient) *TagsApi { - return &TagsApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_usage_metering.go b/api/v1/datadog/api_usage_metering.go deleted file mode 100644 index 9ade55f4792..00000000000 --- a/api/v1/datadog/api_usage_metering.go +++ /dev/null @@ -1,6764 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _fmt "fmt" - _ioutil "io/ioutil" - _log "log" - _nethttp "net/http" - _neturl "net/url" - "reflect" - "strings" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsageMeteringApi service type -type UsageMeteringApi common.Service - -type apiGetDailyCustomReportsRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sortDir *UsageSortDirection - sort *UsageSort -} - -// GetDailyCustomReportsOptionalParameters holds optional parameters for GetDailyCustomReports. -type GetDailyCustomReportsOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - SortDir *UsageSortDirection - Sort *UsageSort -} - -// NewGetDailyCustomReportsOptionalParameters creates an empty struct for parameters. -func NewGetDailyCustomReportsOptionalParameters() *GetDailyCustomReportsOptionalParameters { - this := GetDailyCustomReportsOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *GetDailyCustomReportsOptionalParameters) WithPageSize(pageSize int64) *GetDailyCustomReportsOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *GetDailyCustomReportsOptionalParameters) WithPageNumber(pageNumber int64) *GetDailyCustomReportsOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSortDir sets the corresponding parameter name and returns the struct. -func (r *GetDailyCustomReportsOptionalParameters) WithSortDir(sortDir UsageSortDirection) *GetDailyCustomReportsOptionalParameters { - r.SortDir = &sortDir - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *GetDailyCustomReportsOptionalParameters) WithSort(sort UsageSort) *GetDailyCustomReportsOptionalParameters { - r.Sort = &sort - return r -} - -func (a *UsageMeteringApi) buildGetDailyCustomReportsRequest(ctx _context.Context, o ...GetDailyCustomReportsOptionalParameters) (apiGetDailyCustomReportsRequest, error) { - req := apiGetDailyCustomReportsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetDailyCustomReportsOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sortDir = o[0].SortDir - req.sort = o[0].Sort - } - return req, nil -} - -// GetDailyCustomReports Get the list of available daily custom reports. -// Get daily custom reports. -func (a *UsageMeteringApi) GetDailyCustomReports(ctx _context.Context, o ...GetDailyCustomReportsOptionalParameters) (UsageCustomReportsResponse, *_nethttp.Response, error) { - req, err := a.buildGetDailyCustomReportsRequest(ctx, o...) - if err != nil { - var localVarReturnValue UsageCustomReportsResponse - return localVarReturnValue, nil, err - } - - return a.getDailyCustomReportsExecute(req) -} - -// getDailyCustomReportsExecute executes the request. -func (a *UsageMeteringApi) getDailyCustomReportsExecute(r apiGetDailyCustomReportsRequest) (UsageCustomReportsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageCustomReportsResponse - ) - - operationId := "v1.GetDailyCustomReports" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetDailyCustomReports") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/daily_custom_reports" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sortDir != nil { - localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetHourlyUsageAttributionRequest struct { - ctx _context.Context - startHr *time.Time - usageType *HourlyUsageAttributionUsageType - endHr *time.Time - nextRecordId *string - tagBreakdownKeys *string - includeDescendants *bool -} - -// GetHourlyUsageAttributionOptionalParameters holds optional parameters for GetHourlyUsageAttribution. -type GetHourlyUsageAttributionOptionalParameters struct { - EndHr *time.Time - NextRecordId *string - TagBreakdownKeys *string - IncludeDescendants *bool -} - -// NewGetHourlyUsageAttributionOptionalParameters creates an empty struct for parameters. -func NewGetHourlyUsageAttributionOptionalParameters() *GetHourlyUsageAttributionOptionalParameters { - this := GetHourlyUsageAttributionOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageAttributionOptionalParameters) WithEndHr(endHr time.Time) *GetHourlyUsageAttributionOptionalParameters { - r.EndHr = &endHr - return r -} - -// WithNextRecordId sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageAttributionOptionalParameters) WithNextRecordId(nextRecordId string) *GetHourlyUsageAttributionOptionalParameters { - r.NextRecordId = &nextRecordId - return r -} - -// WithTagBreakdownKeys sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageAttributionOptionalParameters) WithTagBreakdownKeys(tagBreakdownKeys string) *GetHourlyUsageAttributionOptionalParameters { - r.TagBreakdownKeys = &tagBreakdownKeys - return r -} - -// WithIncludeDescendants sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageAttributionOptionalParameters) WithIncludeDescendants(includeDescendants bool) *GetHourlyUsageAttributionOptionalParameters { - r.IncludeDescendants = &includeDescendants - return r -} - -func (a *UsageMeteringApi) buildGetHourlyUsageAttributionRequest(ctx _context.Context, startHr time.Time, usageType HourlyUsageAttributionUsageType, o ...GetHourlyUsageAttributionOptionalParameters) (apiGetHourlyUsageAttributionRequest, error) { - req := apiGetHourlyUsageAttributionRequest{ - ctx: ctx, - startHr: &startHr, - usageType: &usageType, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetHourlyUsageAttributionOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - req.nextRecordId = o[0].NextRecordId - req.tagBreakdownKeys = o[0].TagBreakdownKeys - req.includeDescendants = o[0].IncludeDescendants - } - return req, nil -} - -// GetHourlyUsageAttribution Get hourly usage attribution. -// Get hourly usage attribution. -// -// This API endpoint is paginated. To make sure you receive all records, check if the value of `next_record_id` is -// set in the response. If it is, make another request and pass `next_record_id` as a parameter. -// Pseudo code example: -// -// ``` -// response := GetHourlyUsageAttribution(start_month) -// cursor := response.metadata.pagination.next_record_id -// WHILE cursor != null BEGIN -// sleep(5 seconds) # Avoid running into rate limit -// response := GetHourlyUsageAttribution(start_month, next_record_id=cursor) -// cursor := response.metadata.pagination.next_record_id -// END -// ``` -func (a *UsageMeteringApi) GetHourlyUsageAttribution(ctx _context.Context, startHr time.Time, usageType HourlyUsageAttributionUsageType, o ...GetHourlyUsageAttributionOptionalParameters) (HourlyUsageAttributionResponse, *_nethttp.Response, error) { - req, err := a.buildGetHourlyUsageAttributionRequest(ctx, startHr, usageType, o...) - if err != nil { - var localVarReturnValue HourlyUsageAttributionResponse - return localVarReturnValue, nil, err - } - - return a.getHourlyUsageAttributionExecute(req) -} - -// getHourlyUsageAttributionExecute executes the request. -func (a *UsageMeteringApi) getHourlyUsageAttributionExecute(r apiGetHourlyUsageAttributionRequest) (HourlyUsageAttributionResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue HourlyUsageAttributionResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetHourlyUsageAttribution") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/hourly-attribution" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - if r.usageType == nil { - return localVarReturnValue, nil, common.ReportError("usageType is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - localVarQueryParams.Add("usage_type", common.ParameterToString(*r.usageType, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - if r.nextRecordId != nil { - localVarQueryParams.Add("next_record_id", common.ParameterToString(*r.nextRecordId, "")) - } - if r.tagBreakdownKeys != nil { - localVarQueryParams.Add("tag_breakdown_keys", common.ParameterToString(*r.tagBreakdownKeys, "")) - } - if r.includeDescendants != nil { - localVarQueryParams.Add("include_descendants", common.ParameterToString(*r.includeDescendants, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetIncidentManagementRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetIncidentManagementOptionalParameters holds optional parameters for GetIncidentManagement. -type GetIncidentManagementOptionalParameters struct { - EndHr *time.Time -} - -// NewGetIncidentManagementOptionalParameters creates an empty struct for parameters. -func NewGetIncidentManagementOptionalParameters() *GetIncidentManagementOptionalParameters { - this := GetIncidentManagementOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetIncidentManagementOptionalParameters) WithEndHr(endHr time.Time) *GetIncidentManagementOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetIncidentManagementRequest(ctx _context.Context, startHr time.Time, o ...GetIncidentManagementOptionalParameters) (apiGetIncidentManagementRequest, error) { - req := apiGetIncidentManagementRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetIncidentManagementOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetIncidentManagement Get hourly usage for incident management. -// Get hourly usage for incident management. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetIncidentManagement(ctx _context.Context, startHr time.Time, o ...GetIncidentManagementOptionalParameters) (UsageIncidentManagementResponse, *_nethttp.Response, error) { - req, err := a.buildGetIncidentManagementRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageIncidentManagementResponse - return localVarReturnValue, nil, err - } - - return a.getIncidentManagementExecute(req) -} - -// getIncidentManagementExecute executes the request. -func (a *UsageMeteringApi) getIncidentManagementExecute(r apiGetIncidentManagementRequest) (UsageIncidentManagementResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageIncidentManagementResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetIncidentManagement") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/incident-management" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetIngestedSpansRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetIngestedSpansOptionalParameters holds optional parameters for GetIngestedSpans. -type GetIngestedSpansOptionalParameters struct { - EndHr *time.Time -} - -// NewGetIngestedSpansOptionalParameters creates an empty struct for parameters. -func NewGetIngestedSpansOptionalParameters() *GetIngestedSpansOptionalParameters { - this := GetIngestedSpansOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetIngestedSpansOptionalParameters) WithEndHr(endHr time.Time) *GetIngestedSpansOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetIngestedSpansRequest(ctx _context.Context, startHr time.Time, o ...GetIngestedSpansOptionalParameters) (apiGetIngestedSpansRequest, error) { - req := apiGetIngestedSpansRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetIngestedSpansOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetIngestedSpans Get hourly usage for ingested spans. -// Get hourly usage for ingested spans. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetIngestedSpans(ctx _context.Context, startHr time.Time, o ...GetIngestedSpansOptionalParameters) (UsageIngestedSpansResponse, *_nethttp.Response, error) { - req, err := a.buildGetIngestedSpansRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageIngestedSpansResponse - return localVarReturnValue, nil, err - } - - return a.getIngestedSpansExecute(req) -} - -// getIngestedSpansExecute executes the request. -func (a *UsageMeteringApi) getIngestedSpansExecute(r apiGetIngestedSpansRequest) (UsageIngestedSpansResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageIngestedSpansResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetIngestedSpans") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/ingested-spans" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetMonthlyCustomReportsRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sortDir *UsageSortDirection - sort *UsageSort -} - -// GetMonthlyCustomReportsOptionalParameters holds optional parameters for GetMonthlyCustomReports. -type GetMonthlyCustomReportsOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - SortDir *UsageSortDirection - Sort *UsageSort -} - -// NewGetMonthlyCustomReportsOptionalParameters creates an empty struct for parameters. -func NewGetMonthlyCustomReportsOptionalParameters() *GetMonthlyCustomReportsOptionalParameters { - this := GetMonthlyCustomReportsOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyCustomReportsOptionalParameters) WithPageSize(pageSize int64) *GetMonthlyCustomReportsOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyCustomReportsOptionalParameters) WithPageNumber(pageNumber int64) *GetMonthlyCustomReportsOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSortDir sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyCustomReportsOptionalParameters) WithSortDir(sortDir UsageSortDirection) *GetMonthlyCustomReportsOptionalParameters { - r.SortDir = &sortDir - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyCustomReportsOptionalParameters) WithSort(sort UsageSort) *GetMonthlyCustomReportsOptionalParameters { - r.Sort = &sort - return r -} - -func (a *UsageMeteringApi) buildGetMonthlyCustomReportsRequest(ctx _context.Context, o ...GetMonthlyCustomReportsOptionalParameters) (apiGetMonthlyCustomReportsRequest, error) { - req := apiGetMonthlyCustomReportsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetMonthlyCustomReportsOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sortDir = o[0].SortDir - req.sort = o[0].Sort - } - return req, nil -} - -// GetMonthlyCustomReports Get the list of available monthly custom reports. -// Get monthly custom reports. -func (a *UsageMeteringApi) GetMonthlyCustomReports(ctx _context.Context, o ...GetMonthlyCustomReportsOptionalParameters) (UsageCustomReportsResponse, *_nethttp.Response, error) { - req, err := a.buildGetMonthlyCustomReportsRequest(ctx, o...) - if err != nil { - var localVarReturnValue UsageCustomReportsResponse - return localVarReturnValue, nil, err - } - - return a.getMonthlyCustomReportsExecute(req) -} - -// getMonthlyCustomReportsExecute executes the request. -func (a *UsageMeteringApi) getMonthlyCustomReportsExecute(r apiGetMonthlyCustomReportsRequest) (UsageCustomReportsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageCustomReportsResponse - ) - - operationId := "v1.GetMonthlyCustomReports" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetMonthlyCustomReports") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monthly_custom_reports" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sortDir != nil { - localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetMonthlyUsageAttributionRequest struct { - ctx _context.Context - startMonth *time.Time - fields *MonthlyUsageAttributionSupportedMetrics - endMonth *time.Time - sortDirection *UsageSortDirection - sortName *MonthlyUsageAttributionSupportedMetrics - tagBreakdownKeys *string - nextRecordId *string - includeDescendants *bool -} - -// GetMonthlyUsageAttributionOptionalParameters holds optional parameters for GetMonthlyUsageAttribution. -type GetMonthlyUsageAttributionOptionalParameters struct { - EndMonth *time.Time - SortDirection *UsageSortDirection - SortName *MonthlyUsageAttributionSupportedMetrics - TagBreakdownKeys *string - NextRecordId *string - IncludeDescendants *bool -} - -// NewGetMonthlyUsageAttributionOptionalParameters creates an empty struct for parameters. -func NewGetMonthlyUsageAttributionOptionalParameters() *GetMonthlyUsageAttributionOptionalParameters { - this := GetMonthlyUsageAttributionOptionalParameters{} - return &this -} - -// WithEndMonth sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyUsageAttributionOptionalParameters) WithEndMonth(endMonth time.Time) *GetMonthlyUsageAttributionOptionalParameters { - r.EndMonth = &endMonth - return r -} - -// WithSortDirection sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyUsageAttributionOptionalParameters) WithSortDirection(sortDirection UsageSortDirection) *GetMonthlyUsageAttributionOptionalParameters { - r.SortDirection = &sortDirection - return r -} - -// WithSortName sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyUsageAttributionOptionalParameters) WithSortName(sortName MonthlyUsageAttributionSupportedMetrics) *GetMonthlyUsageAttributionOptionalParameters { - r.SortName = &sortName - return r -} - -// WithTagBreakdownKeys sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyUsageAttributionOptionalParameters) WithTagBreakdownKeys(tagBreakdownKeys string) *GetMonthlyUsageAttributionOptionalParameters { - r.TagBreakdownKeys = &tagBreakdownKeys - return r -} - -// WithNextRecordId sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyUsageAttributionOptionalParameters) WithNextRecordId(nextRecordId string) *GetMonthlyUsageAttributionOptionalParameters { - r.NextRecordId = &nextRecordId - return r -} - -// WithIncludeDescendants sets the corresponding parameter name and returns the struct. -func (r *GetMonthlyUsageAttributionOptionalParameters) WithIncludeDescendants(includeDescendants bool) *GetMonthlyUsageAttributionOptionalParameters { - r.IncludeDescendants = &includeDescendants - return r -} - -func (a *UsageMeteringApi) buildGetMonthlyUsageAttributionRequest(ctx _context.Context, startMonth time.Time, fields MonthlyUsageAttributionSupportedMetrics, o ...GetMonthlyUsageAttributionOptionalParameters) (apiGetMonthlyUsageAttributionRequest, error) { - req := apiGetMonthlyUsageAttributionRequest{ - ctx: ctx, - startMonth: &startMonth, - fields: &fields, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetMonthlyUsageAttributionOptionalParameters is allowed") - } - - if o != nil { - req.endMonth = o[0].EndMonth - req.sortDirection = o[0].SortDirection - req.sortName = o[0].SortName - req.tagBreakdownKeys = o[0].TagBreakdownKeys - req.nextRecordId = o[0].NextRecordId - req.includeDescendants = o[0].IncludeDescendants - } - return req, nil -} - -// GetMonthlyUsageAttribution Get monthly usage attribution. -// Get monthly usage attribution. -// -// This API endpoint is paginated. To make sure you receive all records, check if the value of `next_record_id` is -// set in the response. If it is, make another request and pass `next_record_id` as a parameter. -// Pseudo code example: -// -// ``` -// response := GetMonthlyUsageAttribution(start_month) -// cursor := response.metadata.pagination.next_record_id -// WHILE cursor != null BEGIN -// sleep(5 seconds) # Avoid running into rate limit -// response := GetMonthlyUsageAttribution(start_month, next_record_id=cursor) -// cursor := response.metadata.pagination.next_record_id -// END -// ``` -func (a *UsageMeteringApi) GetMonthlyUsageAttribution(ctx _context.Context, startMonth time.Time, fields MonthlyUsageAttributionSupportedMetrics, o ...GetMonthlyUsageAttributionOptionalParameters) (MonthlyUsageAttributionResponse, *_nethttp.Response, error) { - req, err := a.buildGetMonthlyUsageAttributionRequest(ctx, startMonth, fields, o...) - if err != nil { - var localVarReturnValue MonthlyUsageAttributionResponse - return localVarReturnValue, nil, err - } - - return a.getMonthlyUsageAttributionExecute(req) -} - -// getMonthlyUsageAttributionExecute executes the request. -func (a *UsageMeteringApi) getMonthlyUsageAttributionExecute(r apiGetMonthlyUsageAttributionRequest) (MonthlyUsageAttributionResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MonthlyUsageAttributionResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetMonthlyUsageAttribution") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/monthly-attribution" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startMonth == nil { - return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") - } - if r.fields == nil { - return localVarReturnValue, nil, common.ReportError("fields is required and must be specified") - } - localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) - localVarQueryParams.Add("fields", common.ParameterToString(*r.fields, "")) - if r.endMonth != nil { - localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) - } - if r.sortDirection != nil { - localVarQueryParams.Add("sort_direction", common.ParameterToString(*r.sortDirection, "")) - } - if r.sortName != nil { - localVarQueryParams.Add("sort_name", common.ParameterToString(*r.sortName, "")) - } - if r.tagBreakdownKeys != nil { - localVarQueryParams.Add("tag_breakdown_keys", common.ParameterToString(*r.tagBreakdownKeys, "")) - } - if r.nextRecordId != nil { - localVarQueryParams.Add("next_record_id", common.ParameterToString(*r.nextRecordId, "")) - } - if r.includeDescendants != nil { - localVarQueryParams.Add("include_descendants", common.ParameterToString(*r.includeDescendants, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSpecifiedDailyCustomReportsRequest struct { - ctx _context.Context - reportId string -} - -func (a *UsageMeteringApi) buildGetSpecifiedDailyCustomReportsRequest(ctx _context.Context, reportId string) (apiGetSpecifiedDailyCustomReportsRequest, error) { - req := apiGetSpecifiedDailyCustomReportsRequest{ - ctx: ctx, - reportId: reportId, - } - return req, nil -} - -// GetSpecifiedDailyCustomReports Get specified daily custom reports. -// Get specified daily custom reports. -func (a *UsageMeteringApi) GetSpecifiedDailyCustomReports(ctx _context.Context, reportId string) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { - req, err := a.buildGetSpecifiedDailyCustomReportsRequest(ctx, reportId) - if err != nil { - var localVarReturnValue UsageSpecifiedCustomReportsResponse - return localVarReturnValue, nil, err - } - - return a.getSpecifiedDailyCustomReportsExecute(req) -} - -// getSpecifiedDailyCustomReportsExecute executes the request. -func (a *UsageMeteringApi) getSpecifiedDailyCustomReportsExecute(r apiGetSpecifiedDailyCustomReportsRequest) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSpecifiedCustomReportsResponse - ) - - operationId := "v1.GetSpecifiedDailyCustomReports" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetSpecifiedDailyCustomReports") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/daily_custom_reports/{report_id}" - localVarPath = strings.Replace(localVarPath, "{"+"report_id"+"}", _neturl.PathEscape(common.ParameterToString(r.reportId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSpecifiedMonthlyCustomReportsRequest struct { - ctx _context.Context - reportId string -} - -func (a *UsageMeteringApi) buildGetSpecifiedMonthlyCustomReportsRequest(ctx _context.Context, reportId string) (apiGetSpecifiedMonthlyCustomReportsRequest, error) { - req := apiGetSpecifiedMonthlyCustomReportsRequest{ - ctx: ctx, - reportId: reportId, - } - return req, nil -} - -// GetSpecifiedMonthlyCustomReports Get specified monthly custom reports. -// Get specified monthly custom reports. -func (a *UsageMeteringApi) GetSpecifiedMonthlyCustomReports(ctx _context.Context, reportId string) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { - req, err := a.buildGetSpecifiedMonthlyCustomReportsRequest(ctx, reportId) - if err != nil { - var localVarReturnValue UsageSpecifiedCustomReportsResponse - return localVarReturnValue, nil, err - } - - return a.getSpecifiedMonthlyCustomReportsExecute(req) -} - -// getSpecifiedMonthlyCustomReportsExecute executes the request. -func (a *UsageMeteringApi) getSpecifiedMonthlyCustomReportsExecute(r apiGetSpecifiedMonthlyCustomReportsRequest) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSpecifiedCustomReportsResponse - ) - - operationId := "v1.GetSpecifiedMonthlyCustomReports" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetSpecifiedMonthlyCustomReports") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/monthly_custom_reports/{report_id}" - localVarPath = strings.Replace(localVarPath, "{"+"report_id"+"}", _neturl.PathEscape(common.ParameterToString(r.reportId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageAnalyzedLogsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageAnalyzedLogsOptionalParameters holds optional parameters for GetUsageAnalyzedLogs. -type GetUsageAnalyzedLogsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageAnalyzedLogsOptionalParameters creates an empty struct for parameters. -func NewGetUsageAnalyzedLogsOptionalParameters() *GetUsageAnalyzedLogsOptionalParameters { - this := GetUsageAnalyzedLogsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageAnalyzedLogsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageAnalyzedLogsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageAnalyzedLogsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageAnalyzedLogsOptionalParameters) (apiGetUsageAnalyzedLogsRequest, error) { - req := apiGetUsageAnalyzedLogsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageAnalyzedLogsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageAnalyzedLogs Get hourly usage for analyzed logs. -// Get hourly usage for analyzed logs (Security Monitoring). -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageAnalyzedLogs(ctx _context.Context, startHr time.Time, o ...GetUsageAnalyzedLogsOptionalParameters) (UsageAnalyzedLogsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageAnalyzedLogsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageAnalyzedLogsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageAnalyzedLogsExecute(req) -} - -// getUsageAnalyzedLogsExecute executes the request. -func (a *UsageMeteringApi) getUsageAnalyzedLogsExecute(r apiGetUsageAnalyzedLogsRequest) (UsageAnalyzedLogsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageAnalyzedLogsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageAnalyzedLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/analyzed_logs" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageAttributionRequest struct { - ctx _context.Context - startMonth *time.Time - fields *UsageAttributionSupportedMetrics - endMonth *time.Time - sortDirection *UsageSortDirection - sortName *UsageAttributionSort - includeDescendants *bool - offset *int64 - limit *int64 -} - -// GetUsageAttributionOptionalParameters holds optional parameters for GetUsageAttribution. -type GetUsageAttributionOptionalParameters struct { - EndMonth *time.Time - SortDirection *UsageSortDirection - SortName *UsageAttributionSort - IncludeDescendants *bool - Offset *int64 - Limit *int64 -} - -// NewGetUsageAttributionOptionalParameters creates an empty struct for parameters. -func NewGetUsageAttributionOptionalParameters() *GetUsageAttributionOptionalParameters { - this := GetUsageAttributionOptionalParameters{} - return &this -} - -// WithEndMonth sets the corresponding parameter name and returns the struct. -func (r *GetUsageAttributionOptionalParameters) WithEndMonth(endMonth time.Time) *GetUsageAttributionOptionalParameters { - r.EndMonth = &endMonth - return r -} - -// WithSortDirection sets the corresponding parameter name and returns the struct. -func (r *GetUsageAttributionOptionalParameters) WithSortDirection(sortDirection UsageSortDirection) *GetUsageAttributionOptionalParameters { - r.SortDirection = &sortDirection - return r -} - -// WithSortName sets the corresponding parameter name and returns the struct. -func (r *GetUsageAttributionOptionalParameters) WithSortName(sortName UsageAttributionSort) *GetUsageAttributionOptionalParameters { - r.SortName = &sortName - return r -} - -// WithIncludeDescendants sets the corresponding parameter name and returns the struct. -func (r *GetUsageAttributionOptionalParameters) WithIncludeDescendants(includeDescendants bool) *GetUsageAttributionOptionalParameters { - r.IncludeDescendants = &includeDescendants - return r -} - -// WithOffset sets the corresponding parameter name and returns the struct. -func (r *GetUsageAttributionOptionalParameters) WithOffset(offset int64) *GetUsageAttributionOptionalParameters { - r.Offset = &offset - return r -} - -// WithLimit sets the corresponding parameter name and returns the struct. -func (r *GetUsageAttributionOptionalParameters) WithLimit(limit int64) *GetUsageAttributionOptionalParameters { - r.Limit = &limit - return r -} - -func (a *UsageMeteringApi) buildGetUsageAttributionRequest(ctx _context.Context, startMonth time.Time, fields UsageAttributionSupportedMetrics, o ...GetUsageAttributionOptionalParameters) (apiGetUsageAttributionRequest, error) { - req := apiGetUsageAttributionRequest{ - ctx: ctx, - startMonth: &startMonth, - fields: &fields, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageAttributionOptionalParameters is allowed") - } - - if o != nil { - req.endMonth = o[0].EndMonth - req.sortDirection = o[0].SortDirection - req.sortName = o[0].SortName - req.includeDescendants = o[0].IncludeDescendants - req.offset = o[0].Offset - req.limit = o[0].Limit - } - return req, nil -} - -// GetUsageAttribution Get usage attribution. -// Get usage attribution. -func (a *UsageMeteringApi) GetUsageAttribution(ctx _context.Context, startMonth time.Time, fields UsageAttributionSupportedMetrics, o ...GetUsageAttributionOptionalParameters) (UsageAttributionResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageAttributionRequest(ctx, startMonth, fields, o...) - if err != nil { - var localVarReturnValue UsageAttributionResponse - return localVarReturnValue, nil, err - } - - return a.getUsageAttributionExecute(req) -} - -// getUsageAttributionExecute executes the request. -func (a *UsageMeteringApi) getUsageAttributionExecute(r apiGetUsageAttributionRequest) (UsageAttributionResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageAttributionResponse - ) - - operationId := "v1.GetUsageAttribution" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageAttribution") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/attribution" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startMonth == nil { - return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") - } - if r.fields == nil { - return localVarReturnValue, nil, common.ReportError("fields is required and must be specified") - } - localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) - localVarQueryParams.Add("fields", common.ParameterToString(*r.fields, "")) - if r.endMonth != nil { - localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) - } - if r.sortDirection != nil { - localVarQueryParams.Add("sort_direction", common.ParameterToString(*r.sortDirection, "")) - } - if r.sortName != nil { - localVarQueryParams.Add("sort_name", common.ParameterToString(*r.sortName, "")) - } - if r.includeDescendants != nil { - localVarQueryParams.Add("include_descendants", common.ParameterToString(*r.includeDescendants, "")) - } - if r.offset != nil { - localVarQueryParams.Add("offset", common.ParameterToString(*r.offset, "")) - } - if r.limit != nil { - localVarQueryParams.Add("limit", common.ParameterToString(*r.limit, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageAuditLogsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageAuditLogsOptionalParameters holds optional parameters for GetUsageAuditLogs. -type GetUsageAuditLogsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageAuditLogsOptionalParameters creates an empty struct for parameters. -func NewGetUsageAuditLogsOptionalParameters() *GetUsageAuditLogsOptionalParameters { - this := GetUsageAuditLogsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageAuditLogsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageAuditLogsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageAuditLogsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageAuditLogsOptionalParameters) (apiGetUsageAuditLogsRequest, error) { - req := apiGetUsageAuditLogsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageAuditLogsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageAuditLogs Get hourly usage for audit logs. -// Get hourly usage for audit logs. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageAuditLogs(ctx _context.Context, startHr time.Time, o ...GetUsageAuditLogsOptionalParameters) (UsageAuditLogsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageAuditLogsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageAuditLogsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageAuditLogsExecute(req) -} - -// getUsageAuditLogsExecute executes the request. -func (a *UsageMeteringApi) getUsageAuditLogsExecute(r apiGetUsageAuditLogsRequest) (UsageAuditLogsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageAuditLogsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageAuditLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/audit_logs" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageBillableSummaryRequest struct { - ctx _context.Context - month *time.Time -} - -// GetUsageBillableSummaryOptionalParameters holds optional parameters for GetUsageBillableSummary. -type GetUsageBillableSummaryOptionalParameters struct { - Month *time.Time -} - -// NewGetUsageBillableSummaryOptionalParameters creates an empty struct for parameters. -func NewGetUsageBillableSummaryOptionalParameters() *GetUsageBillableSummaryOptionalParameters { - this := GetUsageBillableSummaryOptionalParameters{} - return &this -} - -// WithMonth sets the corresponding parameter name and returns the struct. -func (r *GetUsageBillableSummaryOptionalParameters) WithMonth(month time.Time) *GetUsageBillableSummaryOptionalParameters { - r.Month = &month - return r -} - -func (a *UsageMeteringApi) buildGetUsageBillableSummaryRequest(ctx _context.Context, o ...GetUsageBillableSummaryOptionalParameters) (apiGetUsageBillableSummaryRequest, error) { - req := apiGetUsageBillableSummaryRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageBillableSummaryOptionalParameters is allowed") - } - - if o != nil { - req.month = o[0].Month - } - return req, nil -} - -// GetUsageBillableSummary Get billable usage across your account. -// Get billable usage across your account. -func (a *UsageMeteringApi) GetUsageBillableSummary(ctx _context.Context, o ...GetUsageBillableSummaryOptionalParameters) (UsageBillableSummaryResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageBillableSummaryRequest(ctx, o...) - if err != nil { - var localVarReturnValue UsageBillableSummaryResponse - return localVarReturnValue, nil, err - } - - return a.getUsageBillableSummaryExecute(req) -} - -// getUsageBillableSummaryExecute executes the request. -func (a *UsageMeteringApi) getUsageBillableSummaryExecute(r apiGetUsageBillableSummaryRequest) (UsageBillableSummaryResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageBillableSummaryResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageBillableSummary") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/billable-summary" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.month != nil { - localVarQueryParams.Add("month", common.ParameterToString(*r.month, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageCIAppRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageCIAppOptionalParameters holds optional parameters for GetUsageCIApp. -type GetUsageCIAppOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageCIAppOptionalParameters creates an empty struct for parameters. -func NewGetUsageCIAppOptionalParameters() *GetUsageCIAppOptionalParameters { - this := GetUsageCIAppOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageCIAppOptionalParameters) WithEndHr(endHr time.Time) *GetUsageCIAppOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageCIAppRequest(ctx _context.Context, startHr time.Time, o ...GetUsageCIAppOptionalParameters) (apiGetUsageCIAppRequest, error) { - req := apiGetUsageCIAppRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageCIAppOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageCIApp Get hourly usage for CI visibility. -// Get hourly usage for CI visibility (tests, pipeline, and spans). -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageCIApp(ctx _context.Context, startHr time.Time, o ...GetUsageCIAppOptionalParameters) (UsageCIVisibilityResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageCIAppRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageCIVisibilityResponse - return localVarReturnValue, nil, err - } - - return a.getUsageCIAppExecute(req) -} - -// getUsageCIAppExecute executes the request. -func (a *UsageMeteringApi) getUsageCIAppExecute(r apiGetUsageCIAppRequest) (UsageCIVisibilityResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageCIVisibilityResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageCIApp") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/ci-app" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageCWSRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageCWSOptionalParameters holds optional parameters for GetUsageCWS. -type GetUsageCWSOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageCWSOptionalParameters creates an empty struct for parameters. -func NewGetUsageCWSOptionalParameters() *GetUsageCWSOptionalParameters { - this := GetUsageCWSOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageCWSOptionalParameters) WithEndHr(endHr time.Time) *GetUsageCWSOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageCWSRequest(ctx _context.Context, startHr time.Time, o ...GetUsageCWSOptionalParameters) (apiGetUsageCWSRequest, error) { - req := apiGetUsageCWSRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageCWSOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageCWS Get hourly usage for cloud workload security. -// Get hourly usage for cloud workload security. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageCWS(ctx _context.Context, startHr time.Time, o ...GetUsageCWSOptionalParameters) (UsageCWSResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageCWSRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageCWSResponse - return localVarReturnValue, nil, err - } - - return a.getUsageCWSExecute(req) -} - -// getUsageCWSExecute executes the request. -func (a *UsageMeteringApi) getUsageCWSExecute(r apiGetUsageCWSRequest) (UsageCWSResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageCWSResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageCWS") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/cws" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageCloudSecurityPostureManagementRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageCloudSecurityPostureManagementOptionalParameters holds optional parameters for GetUsageCloudSecurityPostureManagement. -type GetUsageCloudSecurityPostureManagementOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageCloudSecurityPostureManagementOptionalParameters creates an empty struct for parameters. -func NewGetUsageCloudSecurityPostureManagementOptionalParameters() *GetUsageCloudSecurityPostureManagementOptionalParameters { - this := GetUsageCloudSecurityPostureManagementOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageCloudSecurityPostureManagementOptionalParameters) WithEndHr(endHr time.Time) *GetUsageCloudSecurityPostureManagementOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageCloudSecurityPostureManagementRequest(ctx _context.Context, startHr time.Time, o ...GetUsageCloudSecurityPostureManagementOptionalParameters) (apiGetUsageCloudSecurityPostureManagementRequest, error) { - req := apiGetUsageCloudSecurityPostureManagementRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageCloudSecurityPostureManagementOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageCloudSecurityPostureManagement Get hourly usage for CSPM. -// Get hourly usage for cloud security posture management (CSPM). -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageCloudSecurityPostureManagement(ctx _context.Context, startHr time.Time, o ...GetUsageCloudSecurityPostureManagementOptionalParameters) (UsageCloudSecurityPostureManagementResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageCloudSecurityPostureManagementRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageCloudSecurityPostureManagementResponse - return localVarReturnValue, nil, err - } - - return a.getUsageCloudSecurityPostureManagementExecute(req) -} - -// getUsageCloudSecurityPostureManagementExecute executes the request. -func (a *UsageMeteringApi) getUsageCloudSecurityPostureManagementExecute(r apiGetUsageCloudSecurityPostureManagementRequest) (UsageCloudSecurityPostureManagementResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageCloudSecurityPostureManagementResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageCloudSecurityPostureManagement") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/cspm" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageDBMRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageDBMOptionalParameters holds optional parameters for GetUsageDBM. -type GetUsageDBMOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageDBMOptionalParameters creates an empty struct for parameters. -func NewGetUsageDBMOptionalParameters() *GetUsageDBMOptionalParameters { - this := GetUsageDBMOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageDBMOptionalParameters) WithEndHr(endHr time.Time) *GetUsageDBMOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageDBMRequest(ctx _context.Context, startHr time.Time, o ...GetUsageDBMOptionalParameters) (apiGetUsageDBMRequest, error) { - req := apiGetUsageDBMRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageDBMOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageDBM Get hourly usage for database monitoring. -// Get hourly usage for database monitoring -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageDBM(ctx _context.Context, startHr time.Time, o ...GetUsageDBMOptionalParameters) (UsageDBMResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageDBMRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageDBMResponse - return localVarReturnValue, nil, err - } - - return a.getUsageDBMExecute(req) -} - -// getUsageDBMExecute executes the request. -func (a *UsageMeteringApi) getUsageDBMExecute(r apiGetUsageDBMRequest) (UsageDBMResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageDBMResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageDBM") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/dbm" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageFargateRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageFargateOptionalParameters holds optional parameters for GetUsageFargate. -type GetUsageFargateOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageFargateOptionalParameters creates an empty struct for parameters. -func NewGetUsageFargateOptionalParameters() *GetUsageFargateOptionalParameters { - this := GetUsageFargateOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageFargateOptionalParameters) WithEndHr(endHr time.Time) *GetUsageFargateOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageFargateRequest(ctx _context.Context, startHr time.Time, o ...GetUsageFargateOptionalParameters) (apiGetUsageFargateRequest, error) { - req := apiGetUsageFargateRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageFargateOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageFargate Get hourly usage for Fargate. -// Get hourly usage for [Fargate](https://docs.datadoghq.com/integrations/ecs_fargate/). -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageFargate(ctx _context.Context, startHr time.Time, o ...GetUsageFargateOptionalParameters) (UsageFargateResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageFargateRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageFargateResponse - return localVarReturnValue, nil, err - } - - return a.getUsageFargateExecute(req) -} - -// getUsageFargateExecute executes the request. -func (a *UsageMeteringApi) getUsageFargateExecute(r apiGetUsageFargateRequest) (UsageFargateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageFargateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageFargate") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/fargate" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageHostsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageHostsOptionalParameters holds optional parameters for GetUsageHosts. -type GetUsageHostsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageHostsOptionalParameters creates an empty struct for parameters. -func NewGetUsageHostsOptionalParameters() *GetUsageHostsOptionalParameters { - this := GetUsageHostsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageHostsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageHostsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageHostsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageHostsOptionalParameters) (apiGetUsageHostsRequest, error) { - req := apiGetUsageHostsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageHostsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageHosts Get hourly usage for hosts and containers. -// Get hourly usage for hosts and containers. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageHosts(ctx _context.Context, startHr time.Time, o ...GetUsageHostsOptionalParameters) (UsageHostsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageHostsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageHostsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageHostsExecute(req) -} - -// getUsageHostsExecute executes the request. -func (a *UsageMeteringApi) getUsageHostsExecute(r apiGetUsageHostsRequest) (UsageHostsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageHostsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageHosts") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/hosts" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageIndexedSpansRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageIndexedSpansOptionalParameters holds optional parameters for GetUsageIndexedSpans. -type GetUsageIndexedSpansOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageIndexedSpansOptionalParameters creates an empty struct for parameters. -func NewGetUsageIndexedSpansOptionalParameters() *GetUsageIndexedSpansOptionalParameters { - this := GetUsageIndexedSpansOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageIndexedSpansOptionalParameters) WithEndHr(endHr time.Time) *GetUsageIndexedSpansOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageIndexedSpansRequest(ctx _context.Context, startHr time.Time, o ...GetUsageIndexedSpansOptionalParameters) (apiGetUsageIndexedSpansRequest, error) { - req := apiGetUsageIndexedSpansRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageIndexedSpansOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageIndexedSpans Get hourly usage for indexed spans. -// Get hourly usage for indexed spans. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageIndexedSpans(ctx _context.Context, startHr time.Time, o ...GetUsageIndexedSpansOptionalParameters) (UsageIndexedSpansResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageIndexedSpansRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageIndexedSpansResponse - return localVarReturnValue, nil, err - } - - return a.getUsageIndexedSpansExecute(req) -} - -// getUsageIndexedSpansExecute executes the request. -func (a *UsageMeteringApi) getUsageIndexedSpansExecute(r apiGetUsageIndexedSpansRequest) (UsageIndexedSpansResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageIndexedSpansResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageIndexedSpans") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/indexed-spans" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageInternetOfThingsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageInternetOfThingsOptionalParameters holds optional parameters for GetUsageInternetOfThings. -type GetUsageInternetOfThingsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageInternetOfThingsOptionalParameters creates an empty struct for parameters. -func NewGetUsageInternetOfThingsOptionalParameters() *GetUsageInternetOfThingsOptionalParameters { - this := GetUsageInternetOfThingsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageInternetOfThingsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageInternetOfThingsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageInternetOfThingsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageInternetOfThingsOptionalParameters) (apiGetUsageInternetOfThingsRequest, error) { - req := apiGetUsageInternetOfThingsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageInternetOfThingsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageInternetOfThings Get hourly usage for IoT. -// Get hourly usage for IoT. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageInternetOfThings(ctx _context.Context, startHr time.Time, o ...GetUsageInternetOfThingsOptionalParameters) (UsageIoTResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageInternetOfThingsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageIoTResponse - return localVarReturnValue, nil, err - } - - return a.getUsageInternetOfThingsExecute(req) -} - -// getUsageInternetOfThingsExecute executes the request. -func (a *UsageMeteringApi) getUsageInternetOfThingsExecute(r apiGetUsageInternetOfThingsRequest) (UsageIoTResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageIoTResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageInternetOfThings") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/iot" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageLambdaRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageLambdaOptionalParameters holds optional parameters for GetUsageLambda. -type GetUsageLambdaOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageLambdaOptionalParameters creates an empty struct for parameters. -func NewGetUsageLambdaOptionalParameters() *GetUsageLambdaOptionalParameters { - this := GetUsageLambdaOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageLambdaOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLambdaOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageLambdaRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaOptionalParameters) (apiGetUsageLambdaRequest, error) { - req := apiGetUsageLambdaRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageLambdaOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageLambda Get hourly usage for lambda. -// Get hourly usage for lambda. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageLambda(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaOptionalParameters) (UsageLambdaResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageLambdaRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageLambdaResponse - return localVarReturnValue, nil, err - } - - return a.getUsageLambdaExecute(req) -} - -// getUsageLambdaExecute executes the request. -func (a *UsageMeteringApi) getUsageLambdaExecute(r apiGetUsageLambdaRequest) (UsageLambdaResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageLambdaResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLambda") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/aws_lambda" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageLogsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageLogsOptionalParameters holds optional parameters for GetUsageLogs. -type GetUsageLogsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageLogsOptionalParameters creates an empty struct for parameters. -func NewGetUsageLogsOptionalParameters() *GetUsageLogsOptionalParameters { - this := GetUsageLogsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageLogsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLogsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageLogsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLogsOptionalParameters) (apiGetUsageLogsRequest, error) { - req := apiGetUsageLogsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageLogsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageLogs Get hourly usage for logs. -// Get hourly usage for logs. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageLogs(ctx _context.Context, startHr time.Time, o ...GetUsageLogsOptionalParameters) (UsageLogsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageLogsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageLogsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageLogsExecute(req) -} - -// getUsageLogsExecute executes the request. -func (a *UsageMeteringApi) getUsageLogsExecute(r apiGetUsageLogsRequest) (UsageLogsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageLogsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/logs" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageLogsByIndexRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time - indexName *[]string -} - -// GetUsageLogsByIndexOptionalParameters holds optional parameters for GetUsageLogsByIndex. -type GetUsageLogsByIndexOptionalParameters struct { - EndHr *time.Time - IndexName *[]string -} - -// NewGetUsageLogsByIndexOptionalParameters creates an empty struct for parameters. -func NewGetUsageLogsByIndexOptionalParameters() *GetUsageLogsByIndexOptionalParameters { - this := GetUsageLogsByIndexOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageLogsByIndexOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLogsByIndexOptionalParameters { - r.EndHr = &endHr - return r -} - -// WithIndexName sets the corresponding parameter name and returns the struct. -func (r *GetUsageLogsByIndexOptionalParameters) WithIndexName(indexName []string) *GetUsageLogsByIndexOptionalParameters { - r.IndexName = &indexName - return r -} - -func (a *UsageMeteringApi) buildGetUsageLogsByIndexRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByIndexOptionalParameters) (apiGetUsageLogsByIndexRequest, error) { - req := apiGetUsageLogsByIndexRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageLogsByIndexOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - req.indexName = o[0].IndexName - } - return req, nil -} - -// GetUsageLogsByIndex Get hourly usage for logs by index. -// Get hourly usage for logs by index. -func (a *UsageMeteringApi) GetUsageLogsByIndex(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByIndexOptionalParameters) (UsageLogsByIndexResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageLogsByIndexRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageLogsByIndexResponse - return localVarReturnValue, nil, err - } - - return a.getUsageLogsByIndexExecute(req) -} - -// getUsageLogsByIndexExecute executes the request. -func (a *UsageMeteringApi) getUsageLogsByIndexExecute(r apiGetUsageLogsByIndexRequest) (UsageLogsByIndexResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageLogsByIndexResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLogsByIndex") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/logs_by_index" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - if r.indexName != nil { - t := *r.indexName - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("index_name", common.ParameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("index_name", common.ParameterToString(t, "multi")) - } - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageLogsByRetentionRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageLogsByRetentionOptionalParameters holds optional parameters for GetUsageLogsByRetention. -type GetUsageLogsByRetentionOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageLogsByRetentionOptionalParameters creates an empty struct for parameters. -func NewGetUsageLogsByRetentionOptionalParameters() *GetUsageLogsByRetentionOptionalParameters { - this := GetUsageLogsByRetentionOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageLogsByRetentionOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLogsByRetentionOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageLogsByRetentionRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByRetentionOptionalParameters) (apiGetUsageLogsByRetentionRequest, error) { - req := apiGetUsageLogsByRetentionRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageLogsByRetentionOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageLogsByRetention Get hourly logs usage by retention. -// Get hourly usage for indexed logs by retention period. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageLogsByRetention(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByRetentionOptionalParameters) (UsageLogsByRetentionResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageLogsByRetentionRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageLogsByRetentionResponse - return localVarReturnValue, nil, err - } - - return a.getUsageLogsByRetentionExecute(req) -} - -// getUsageLogsByRetentionExecute executes the request. -func (a *UsageMeteringApi) getUsageLogsByRetentionExecute(r apiGetUsageLogsByRetentionRequest) (UsageLogsByRetentionResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageLogsByRetentionResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLogsByRetention") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/logs-by-retention" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageNetworkFlowsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageNetworkFlowsOptionalParameters holds optional parameters for GetUsageNetworkFlows. -type GetUsageNetworkFlowsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageNetworkFlowsOptionalParameters creates an empty struct for parameters. -func NewGetUsageNetworkFlowsOptionalParameters() *GetUsageNetworkFlowsOptionalParameters { - this := GetUsageNetworkFlowsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageNetworkFlowsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageNetworkFlowsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageNetworkFlowsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkFlowsOptionalParameters) (apiGetUsageNetworkFlowsRequest, error) { - req := apiGetUsageNetworkFlowsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageNetworkFlowsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageNetworkFlows get hourly usage for network flows. -// Get hourly usage for network flows. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageNetworkFlows(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkFlowsOptionalParameters) (UsageNetworkFlowsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageNetworkFlowsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageNetworkFlowsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageNetworkFlowsExecute(req) -} - -// getUsageNetworkFlowsExecute executes the request. -func (a *UsageMeteringApi) getUsageNetworkFlowsExecute(r apiGetUsageNetworkFlowsRequest) (UsageNetworkFlowsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageNetworkFlowsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageNetworkFlows") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/network_flows" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageNetworkHostsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageNetworkHostsOptionalParameters holds optional parameters for GetUsageNetworkHosts. -type GetUsageNetworkHostsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageNetworkHostsOptionalParameters creates an empty struct for parameters. -func NewGetUsageNetworkHostsOptionalParameters() *GetUsageNetworkHostsOptionalParameters { - this := GetUsageNetworkHostsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageNetworkHostsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageNetworkHostsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageNetworkHostsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkHostsOptionalParameters) (apiGetUsageNetworkHostsRequest, error) { - req := apiGetUsageNetworkHostsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageNetworkHostsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageNetworkHosts Get hourly usage for network hosts. -// Get hourly usage for network hosts. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageNetworkHosts(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkHostsOptionalParameters) (UsageNetworkHostsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageNetworkHostsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageNetworkHostsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageNetworkHostsExecute(req) -} - -// getUsageNetworkHostsExecute executes the request. -func (a *UsageMeteringApi) getUsageNetworkHostsExecute(r apiGetUsageNetworkHostsRequest) (UsageNetworkHostsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageNetworkHostsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageNetworkHosts") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/network_hosts" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageOnlineArchiveRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageOnlineArchiveOptionalParameters holds optional parameters for GetUsageOnlineArchive. -type GetUsageOnlineArchiveOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageOnlineArchiveOptionalParameters creates an empty struct for parameters. -func NewGetUsageOnlineArchiveOptionalParameters() *GetUsageOnlineArchiveOptionalParameters { - this := GetUsageOnlineArchiveOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageOnlineArchiveOptionalParameters) WithEndHr(endHr time.Time) *GetUsageOnlineArchiveOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageOnlineArchiveRequest(ctx _context.Context, startHr time.Time, o ...GetUsageOnlineArchiveOptionalParameters) (apiGetUsageOnlineArchiveRequest, error) { - req := apiGetUsageOnlineArchiveRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageOnlineArchiveOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageOnlineArchive Get hourly usage for online archive. -// Get hourly usage for online archive. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageOnlineArchive(ctx _context.Context, startHr time.Time, o ...GetUsageOnlineArchiveOptionalParameters) (UsageOnlineArchiveResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageOnlineArchiveRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageOnlineArchiveResponse - return localVarReturnValue, nil, err - } - - return a.getUsageOnlineArchiveExecute(req) -} - -// getUsageOnlineArchiveExecute executes the request. -func (a *UsageMeteringApi) getUsageOnlineArchiveExecute(r apiGetUsageOnlineArchiveRequest) (UsageOnlineArchiveResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageOnlineArchiveResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageOnlineArchive") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/online-archive" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageProfilingRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageProfilingOptionalParameters holds optional parameters for GetUsageProfiling. -type GetUsageProfilingOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageProfilingOptionalParameters creates an empty struct for parameters. -func NewGetUsageProfilingOptionalParameters() *GetUsageProfilingOptionalParameters { - this := GetUsageProfilingOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageProfilingOptionalParameters) WithEndHr(endHr time.Time) *GetUsageProfilingOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageProfilingRequest(ctx _context.Context, startHr time.Time, o ...GetUsageProfilingOptionalParameters) (apiGetUsageProfilingRequest, error) { - req := apiGetUsageProfilingRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageProfilingOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageProfiling Get hourly usage for profiled hosts. -// Get hourly usage for profiled hosts. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageProfiling(ctx _context.Context, startHr time.Time, o ...GetUsageProfilingOptionalParameters) (UsageProfilingResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageProfilingRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageProfilingResponse - return localVarReturnValue, nil, err - } - - return a.getUsageProfilingExecute(req) -} - -// getUsageProfilingExecute executes the request. -func (a *UsageMeteringApi) getUsageProfilingExecute(r apiGetUsageProfilingRequest) (UsageProfilingResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageProfilingResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageProfiling") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/profiling" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageRumSessionsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time - typeVar *string -} - -// GetUsageRumSessionsOptionalParameters holds optional parameters for GetUsageRumSessions. -type GetUsageRumSessionsOptionalParameters struct { - EndHr *time.Time - Type *string -} - -// NewGetUsageRumSessionsOptionalParameters creates an empty struct for parameters. -func NewGetUsageRumSessionsOptionalParameters() *GetUsageRumSessionsOptionalParameters { - this := GetUsageRumSessionsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageRumSessionsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageRumSessionsOptionalParameters { - r.EndHr = &endHr - return r -} - -// WithType sets the corresponding parameter name and returns the struct. -func (r *GetUsageRumSessionsOptionalParameters) WithType(typeVar string) *GetUsageRumSessionsOptionalParameters { - r.Type = &typeVar - return r -} - -func (a *UsageMeteringApi) buildGetUsageRumSessionsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageRumSessionsOptionalParameters) (apiGetUsageRumSessionsRequest, error) { - req := apiGetUsageRumSessionsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageRumSessionsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - req.typeVar = o[0].Type - } - return req, nil -} - -// GetUsageRumSessions Get hourly usage for RUM sessions. -// Get hourly usage for [RUM](https://docs.datadoghq.com/real_user_monitoring/) Sessions. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageRumSessions(ctx _context.Context, startHr time.Time, o ...GetUsageRumSessionsOptionalParameters) (UsageRumSessionsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageRumSessionsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageRumSessionsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageRumSessionsExecute(req) -} - -// getUsageRumSessionsExecute executes the request. -func (a *UsageMeteringApi) getUsageRumSessionsExecute(r apiGetUsageRumSessionsRequest) (UsageRumSessionsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageRumSessionsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageRumSessions") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/rum_sessions" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - if r.typeVar != nil { - localVarQueryParams.Add("type", common.ParameterToString(*r.typeVar, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageRumUnitsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageRumUnitsOptionalParameters holds optional parameters for GetUsageRumUnits. -type GetUsageRumUnitsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageRumUnitsOptionalParameters creates an empty struct for parameters. -func NewGetUsageRumUnitsOptionalParameters() *GetUsageRumUnitsOptionalParameters { - this := GetUsageRumUnitsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageRumUnitsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageRumUnitsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageRumUnitsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageRumUnitsOptionalParameters) (apiGetUsageRumUnitsRequest, error) { - req := apiGetUsageRumUnitsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageRumUnitsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageRumUnits Get hourly usage for RUM units. -// Get hourly usage for [RUM](https://docs.datadoghq.com/real_user_monitoring/) Units. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageRumUnits(ctx _context.Context, startHr time.Time, o ...GetUsageRumUnitsOptionalParameters) (UsageRumUnitsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageRumUnitsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageRumUnitsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageRumUnitsExecute(req) -} - -// getUsageRumUnitsExecute executes the request. -func (a *UsageMeteringApi) getUsageRumUnitsExecute(r apiGetUsageRumUnitsRequest) (UsageRumUnitsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageRumUnitsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageRumUnits") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/rum" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageSDSRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageSDSOptionalParameters holds optional parameters for GetUsageSDS. -type GetUsageSDSOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageSDSOptionalParameters creates an empty struct for parameters. -func NewGetUsageSDSOptionalParameters() *GetUsageSDSOptionalParameters { - this := GetUsageSDSOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageSDSOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSDSOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageSDSRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSDSOptionalParameters) (apiGetUsageSDSRequest, error) { - req := apiGetUsageSDSRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageSDSOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageSDS Get hourly usage for sensitive data scanner. -// Get hourly usage for sensitive data scanner. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageSDS(ctx _context.Context, startHr time.Time, o ...GetUsageSDSOptionalParameters) (UsageSDSResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageSDSRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageSDSResponse - return localVarReturnValue, nil, err - } - - return a.getUsageSDSExecute(req) -} - -// getUsageSDSExecute executes the request. -func (a *UsageMeteringApi) getUsageSDSExecute(r apiGetUsageSDSRequest) (UsageSDSResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSDSResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSDS") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/sds" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageSNMPRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageSNMPOptionalParameters holds optional parameters for GetUsageSNMP. -type GetUsageSNMPOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageSNMPOptionalParameters creates an empty struct for parameters. -func NewGetUsageSNMPOptionalParameters() *GetUsageSNMPOptionalParameters { - this := GetUsageSNMPOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageSNMPOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSNMPOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageSNMPRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSNMPOptionalParameters) (apiGetUsageSNMPRequest, error) { - req := apiGetUsageSNMPRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageSNMPOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageSNMP Get hourly usage for SNMP devices. -// Get hourly usage for SNMP devices. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageSNMP(ctx _context.Context, startHr time.Time, o ...GetUsageSNMPOptionalParameters) (UsageSNMPResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageSNMPRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageSNMPResponse - return localVarReturnValue, nil, err - } - - return a.getUsageSNMPExecute(req) -} - -// getUsageSNMPExecute executes the request. -func (a *UsageMeteringApi) getUsageSNMPExecute(r apiGetUsageSNMPRequest) (UsageSNMPResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSNMPResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSNMP") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/snmp" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageSummaryRequest struct { - ctx _context.Context - startMonth *time.Time - endMonth *time.Time - includeOrgDetails *bool -} - -// GetUsageSummaryOptionalParameters holds optional parameters for GetUsageSummary. -type GetUsageSummaryOptionalParameters struct { - EndMonth *time.Time - IncludeOrgDetails *bool -} - -// NewGetUsageSummaryOptionalParameters creates an empty struct for parameters. -func NewGetUsageSummaryOptionalParameters() *GetUsageSummaryOptionalParameters { - this := GetUsageSummaryOptionalParameters{} - return &this -} - -// WithEndMonth sets the corresponding parameter name and returns the struct. -func (r *GetUsageSummaryOptionalParameters) WithEndMonth(endMonth time.Time) *GetUsageSummaryOptionalParameters { - r.EndMonth = &endMonth - return r -} - -// WithIncludeOrgDetails sets the corresponding parameter name and returns the struct. -func (r *GetUsageSummaryOptionalParameters) WithIncludeOrgDetails(includeOrgDetails bool) *GetUsageSummaryOptionalParameters { - r.IncludeOrgDetails = &includeOrgDetails - return r -} - -func (a *UsageMeteringApi) buildGetUsageSummaryRequest(ctx _context.Context, startMonth time.Time, o ...GetUsageSummaryOptionalParameters) (apiGetUsageSummaryRequest, error) { - req := apiGetUsageSummaryRequest{ - ctx: ctx, - startMonth: &startMonth, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageSummaryOptionalParameters is allowed") - } - - if o != nil { - req.endMonth = o[0].EndMonth - req.includeOrgDetails = o[0].IncludeOrgDetails - } - return req, nil -} - -// GetUsageSummary Get usage across your multi-org account. -// Get usage across your multi-org account. You must have the multi-org feature enabled. -func (a *UsageMeteringApi) GetUsageSummary(ctx _context.Context, startMonth time.Time, o ...GetUsageSummaryOptionalParameters) (UsageSummaryResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageSummaryRequest(ctx, startMonth, o...) - if err != nil { - var localVarReturnValue UsageSummaryResponse - return localVarReturnValue, nil, err - } - - return a.getUsageSummaryExecute(req) -} - -// getUsageSummaryExecute executes the request. -func (a *UsageMeteringApi) getUsageSummaryExecute(r apiGetUsageSummaryRequest) (UsageSummaryResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSummaryResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSummary") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/summary" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startMonth == nil { - return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") - } - localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) - if r.endMonth != nil { - localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) - } - if r.includeOrgDetails != nil { - localVarQueryParams.Add("include_org_details", common.ParameterToString(*r.includeOrgDetails, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageSyntheticsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageSyntheticsOptionalParameters holds optional parameters for GetUsageSynthetics. -type GetUsageSyntheticsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageSyntheticsOptionalParameters creates an empty struct for parameters. -func NewGetUsageSyntheticsOptionalParameters() *GetUsageSyntheticsOptionalParameters { - this := GetUsageSyntheticsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageSyntheticsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSyntheticsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageSyntheticsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsOptionalParameters) (apiGetUsageSyntheticsRequest, error) { - req := apiGetUsageSyntheticsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageSyntheticsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageSynthetics Get hourly usage for synthetics checks. -// Get hourly usage for [synthetics checks](https://docs.datadoghq.com/synthetics/). -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageSynthetics(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsOptionalParameters) (UsageSyntheticsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageSyntheticsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageSyntheticsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageSyntheticsExecute(req) -} - -// getUsageSyntheticsExecute executes the request. -func (a *UsageMeteringApi) getUsageSyntheticsExecute(r apiGetUsageSyntheticsRequest) (UsageSyntheticsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSyntheticsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSynthetics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/synthetics" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageSyntheticsAPIRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageSyntheticsAPIOptionalParameters holds optional parameters for GetUsageSyntheticsAPI. -type GetUsageSyntheticsAPIOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageSyntheticsAPIOptionalParameters creates an empty struct for parameters. -func NewGetUsageSyntheticsAPIOptionalParameters() *GetUsageSyntheticsAPIOptionalParameters { - this := GetUsageSyntheticsAPIOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageSyntheticsAPIOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSyntheticsAPIOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageSyntheticsAPIRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsAPIOptionalParameters) (apiGetUsageSyntheticsAPIRequest, error) { - req := apiGetUsageSyntheticsAPIRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageSyntheticsAPIOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageSyntheticsAPI Get hourly usage for synthetics API checks. -// Get hourly usage for [synthetics API checks](https://docs.datadoghq.com/synthetics/). -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageSyntheticsAPI(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsAPIOptionalParameters) (UsageSyntheticsAPIResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageSyntheticsAPIRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageSyntheticsAPIResponse - return localVarReturnValue, nil, err - } - - return a.getUsageSyntheticsAPIExecute(req) -} - -// getUsageSyntheticsAPIExecute executes the request. -func (a *UsageMeteringApi) getUsageSyntheticsAPIExecute(r apiGetUsageSyntheticsAPIRequest) (UsageSyntheticsAPIResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSyntheticsAPIResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSyntheticsAPI") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/synthetics_api" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageSyntheticsBrowserRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageSyntheticsBrowserOptionalParameters holds optional parameters for GetUsageSyntheticsBrowser. -type GetUsageSyntheticsBrowserOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageSyntheticsBrowserOptionalParameters creates an empty struct for parameters. -func NewGetUsageSyntheticsBrowserOptionalParameters() *GetUsageSyntheticsBrowserOptionalParameters { - this := GetUsageSyntheticsBrowserOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageSyntheticsBrowserOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSyntheticsBrowserOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageSyntheticsBrowserRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsBrowserOptionalParameters) (apiGetUsageSyntheticsBrowserRequest, error) { - req := apiGetUsageSyntheticsBrowserRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageSyntheticsBrowserOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageSyntheticsBrowser Get hourly usage for synthetics browser checks. -// Get hourly usage for synthetics browser checks. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageSyntheticsBrowser(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsBrowserOptionalParameters) (UsageSyntheticsBrowserResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageSyntheticsBrowserRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageSyntheticsBrowserResponse - return localVarReturnValue, nil, err - } - - return a.getUsageSyntheticsBrowserExecute(req) -} - -// getUsageSyntheticsBrowserExecute executes the request. -func (a *UsageMeteringApi) getUsageSyntheticsBrowserExecute(r apiGetUsageSyntheticsBrowserRequest) (UsageSyntheticsBrowserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageSyntheticsBrowserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSyntheticsBrowser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/synthetics_browser" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageTimeseriesRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageTimeseriesOptionalParameters holds optional parameters for GetUsageTimeseries. -type GetUsageTimeseriesOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageTimeseriesOptionalParameters creates an empty struct for parameters. -func NewGetUsageTimeseriesOptionalParameters() *GetUsageTimeseriesOptionalParameters { - this := GetUsageTimeseriesOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageTimeseriesOptionalParameters) WithEndHr(endHr time.Time) *GetUsageTimeseriesOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageTimeseriesRequest(ctx _context.Context, startHr time.Time, o ...GetUsageTimeseriesOptionalParameters) (apiGetUsageTimeseriesRequest, error) { - req := apiGetUsageTimeseriesRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageTimeseriesOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageTimeseries Get hourly usage for custom metrics. -// Get hourly usage for [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/). -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. -func (a *UsageMeteringApi) GetUsageTimeseries(ctx _context.Context, startHr time.Time, o ...GetUsageTimeseriesOptionalParameters) (UsageTimeseriesResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageTimeseriesRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageTimeseriesResponse - return localVarReturnValue, nil, err - } - - return a.getUsageTimeseriesExecute(req) -} - -// getUsageTimeseriesExecute executes the request. -func (a *UsageMeteringApi) getUsageTimeseriesExecute(r apiGetUsageTimeseriesRequest) (UsageTimeseriesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageTimeseriesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageTimeseries") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/timeseries" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageTopAvgMetricsRequest struct { - ctx _context.Context - month *time.Time - day *time.Time - names *[]string - limit *int32 - nextRecordId *string -} - -// GetUsageTopAvgMetricsOptionalParameters holds optional parameters for GetUsageTopAvgMetrics. -type GetUsageTopAvgMetricsOptionalParameters struct { - Month *time.Time - Day *time.Time - Names *[]string - Limit *int32 - NextRecordId *string -} - -// NewGetUsageTopAvgMetricsOptionalParameters creates an empty struct for parameters. -func NewGetUsageTopAvgMetricsOptionalParameters() *GetUsageTopAvgMetricsOptionalParameters { - this := GetUsageTopAvgMetricsOptionalParameters{} - return &this -} - -// WithMonth sets the corresponding parameter name and returns the struct. -func (r *GetUsageTopAvgMetricsOptionalParameters) WithMonth(month time.Time) *GetUsageTopAvgMetricsOptionalParameters { - r.Month = &month - return r -} - -// WithDay sets the corresponding parameter name and returns the struct. -func (r *GetUsageTopAvgMetricsOptionalParameters) WithDay(day time.Time) *GetUsageTopAvgMetricsOptionalParameters { - r.Day = &day - return r -} - -// WithNames sets the corresponding parameter name and returns the struct. -func (r *GetUsageTopAvgMetricsOptionalParameters) WithNames(names []string) *GetUsageTopAvgMetricsOptionalParameters { - r.Names = &names - return r -} - -// WithLimit sets the corresponding parameter name and returns the struct. -func (r *GetUsageTopAvgMetricsOptionalParameters) WithLimit(limit int32) *GetUsageTopAvgMetricsOptionalParameters { - r.Limit = &limit - return r -} - -// WithNextRecordId sets the corresponding parameter name and returns the struct. -func (r *GetUsageTopAvgMetricsOptionalParameters) WithNextRecordId(nextRecordId string) *GetUsageTopAvgMetricsOptionalParameters { - r.NextRecordId = &nextRecordId - return r -} - -func (a *UsageMeteringApi) buildGetUsageTopAvgMetricsRequest(ctx _context.Context, o ...GetUsageTopAvgMetricsOptionalParameters) (apiGetUsageTopAvgMetricsRequest, error) { - req := apiGetUsageTopAvgMetricsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageTopAvgMetricsOptionalParameters is allowed") - } - - if o != nil { - req.month = o[0].Month - req.day = o[0].Day - req.names = o[0].Names - req.limit = o[0].Limit - req.nextRecordId = o[0].NextRecordId - } - return req, nil -} - -// GetUsageTopAvgMetrics Get all custom metrics by hourly average. -// Get all [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/) by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed. -func (a *UsageMeteringApi) GetUsageTopAvgMetrics(ctx _context.Context, o ...GetUsageTopAvgMetricsOptionalParameters) (UsageTopAvgMetricsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageTopAvgMetricsRequest(ctx, o...) - if err != nil { - var localVarReturnValue UsageTopAvgMetricsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageTopAvgMetricsExecute(req) -} - -// getUsageTopAvgMetricsExecute executes the request. -func (a *UsageMeteringApi) getUsageTopAvgMetricsExecute(r apiGetUsageTopAvgMetricsRequest) (UsageTopAvgMetricsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageTopAvgMetricsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageTopAvgMetrics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/usage/top_avg_metrics" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.month != nil { - localVarQueryParams.Add("month", common.ParameterToString(*r.month, "")) - } - if r.day != nil { - localVarQueryParams.Add("day", common.ParameterToString(*r.day, "")) - } - if r.names != nil { - t := *r.names - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("names", common.ParameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("names", common.ParameterToString(t, "multi")) - } - } - if r.limit != nil { - localVarQueryParams.Add("limit", common.ParameterToString(*r.limit, "")) - } - if r.nextRecordId != nil { - localVarQueryParams.Add("next_record_id", common.ParameterToString(*r.nextRecordId, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewUsageMeteringApi Returns NewUsageMeteringApi. -func NewUsageMeteringApi(client *common.APIClient) *UsageMeteringApi { - return &UsageMeteringApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_users.go b/api/v1/datadog/api_users.go deleted file mode 100644 index 1cea2836a6b..00000000000 --- a/api/v1/datadog/api_users.go +++ /dev/null @@ -1,747 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsersApi service type -type UsersApi common.Service - -type apiCreateUserRequest struct { - ctx _context.Context - body *User -} - -func (a *UsersApi) buildCreateUserRequest(ctx _context.Context, body User) (apiCreateUserRequest, error) { - req := apiCreateUserRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateUser Create a user. -// Create a user for your organization. -// -// **Note**: Users can only be created with the admin access role -// if application keys belong to administrators. -func (a *UsersApi) CreateUser(ctx _context.Context, body User) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildCreateUserRequest(ctx, body) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.createUserExecute(req) -} - -// createUserExecute executes the request. -func (a *UsersApi) createUserExecute(r apiCreateUserRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.CreateUser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/user" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDisableUserRequest struct { - ctx _context.Context - userHandle string -} - -func (a *UsersApi) buildDisableUserRequest(ctx _context.Context, userHandle string) (apiDisableUserRequest, error) { - req := apiDisableUserRequest{ - ctx: ctx, - userHandle: userHandle, - } - return req, nil -} - -// DisableUser Disable a user. -// Delete a user from an organization. -// -// **Note**: This endpoint can only be used with application keys belonging to -// administrators. -func (a *UsersApi) DisableUser(ctx _context.Context, userHandle string) (UserDisableResponse, *_nethttp.Response, error) { - req, err := a.buildDisableUserRequest(ctx, userHandle) - if err != nil { - var localVarReturnValue UserDisableResponse - return localVarReturnValue, nil, err - } - - return a.disableUserExecute(req) -} - -// disableUserExecute executes the request. -func (a *UsersApi) disableUserExecute(r apiDisableUserRequest) (UserDisableResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue UserDisableResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.DisableUser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/user/{user_handle}" - localVarPath = strings.Replace(localVarPath, "{"+"user_handle"+"}", _neturl.PathEscape(common.ParameterToString(r.userHandle, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUserRequest struct { - ctx _context.Context - userHandle string -} - -func (a *UsersApi) buildGetUserRequest(ctx _context.Context, userHandle string) (apiGetUserRequest, error) { - req := apiGetUserRequest{ - ctx: ctx, - userHandle: userHandle, - } - return req, nil -} - -// GetUser Get user details. -// Get a user's details. -func (a *UsersApi) GetUser(ctx _context.Context, userHandle string) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildGetUserRequest(ctx, userHandle) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.getUserExecute(req) -} - -// getUserExecute executes the request. -func (a *UsersApi) getUserExecute(r apiGetUserRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.GetUser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/user/{user_handle}" - localVarPath = strings.Replace(localVarPath, "{"+"user_handle"+"}", _neturl.PathEscape(common.ParameterToString(r.userHandle, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListUsersRequest struct { - ctx _context.Context -} - -func (a *UsersApi) buildListUsersRequest(ctx _context.Context) (apiListUsersRequest, error) { - req := apiListUsersRequest{ - ctx: ctx, - } - return req, nil -} - -// ListUsers List all users. -// List all users for your organization. -func (a *UsersApi) ListUsers(ctx _context.Context) (UserListResponse, *_nethttp.Response, error) { - req, err := a.buildListUsersRequest(ctx) - if err != nil { - var localVarReturnValue UserListResponse - return localVarReturnValue, nil, err - } - - return a.listUsersExecute(req) -} - -// listUsersExecute executes the request. -func (a *UsersApi) listUsersExecute(r apiListUsersRequest) (UserListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UserListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.ListUsers") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/user" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateUserRequest struct { - ctx _context.Context - userHandle string - body *User -} - -func (a *UsersApi) buildUpdateUserRequest(ctx _context.Context, userHandle string, body User) (apiUpdateUserRequest, error) { - req := apiUpdateUserRequest{ - ctx: ctx, - userHandle: userHandle, - body: &body, - } - return req, nil -} - -// UpdateUser Update a user. -// Update a user information. -// -// **Note**: It can only be used with application keys belonging to administrators. -func (a *UsersApi) UpdateUser(ctx _context.Context, userHandle string, body User) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateUserRequest(ctx, userHandle, body) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.updateUserExecute(req) -} - -// updateUserExecute executes the request. -func (a *UsersApi) updateUserExecute(r apiUpdateUserRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.UpdateUser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/user/{user_handle}" - localVarPath = strings.Replace(localVarPath, "{"+"user_handle"+"}", _neturl.PathEscape(common.ParameterToString(r.userHandle, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewUsersApi Returns NewUsersApi. -func NewUsersApi(client *common.APIClient) *UsersApi { - return &UsersApi{ - Client: client, - } -} diff --git a/api/v1/datadog/api_webhooks_integration.go b/api/v1/datadog/api_webhooks_integration.go deleted file mode 100644 index fc0e4a13000..00000000000 --- a/api/v1/datadog/api_webhooks_integration.go +++ /dev/null @@ -1,1165 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// WebhooksIntegrationApi service type -type WebhooksIntegrationApi common.Service - -type apiCreateWebhooksIntegrationRequest struct { - ctx _context.Context - body *WebhooksIntegration -} - -func (a *WebhooksIntegrationApi) buildCreateWebhooksIntegrationRequest(ctx _context.Context, body WebhooksIntegration) (apiCreateWebhooksIntegrationRequest, error) { - req := apiCreateWebhooksIntegrationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateWebhooksIntegration Create a webhooks integration. -// Creates an endpoint with the name ``. -func (a *WebhooksIntegrationApi) CreateWebhooksIntegration(ctx _context.Context, body WebhooksIntegration) (WebhooksIntegration, *_nethttp.Response, error) { - req, err := a.buildCreateWebhooksIntegrationRequest(ctx, body) - if err != nil { - var localVarReturnValue WebhooksIntegration - return localVarReturnValue, nil, err - } - - return a.createWebhooksIntegrationExecute(req) -} - -// createWebhooksIntegrationExecute executes the request. -func (a *WebhooksIntegrationApi) createWebhooksIntegrationExecute(r apiCreateWebhooksIntegrationRequest) (WebhooksIntegration, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue WebhooksIntegration - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.CreateWebhooksIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateWebhooksIntegrationCustomVariableRequest struct { - ctx _context.Context - body *WebhooksIntegrationCustomVariable -} - -func (a *WebhooksIntegrationApi) buildCreateWebhooksIntegrationCustomVariableRequest(ctx _context.Context, body WebhooksIntegrationCustomVariable) (apiCreateWebhooksIntegrationCustomVariableRequest, error) { - req := apiCreateWebhooksIntegrationCustomVariableRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateWebhooksIntegrationCustomVariable Create a custom variable. -// Creates an endpoint with the name ``. -func (a *WebhooksIntegrationApi) CreateWebhooksIntegrationCustomVariable(ctx _context.Context, body WebhooksIntegrationCustomVariable) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { - req, err := a.buildCreateWebhooksIntegrationCustomVariableRequest(ctx, body) - if err != nil { - var localVarReturnValue WebhooksIntegrationCustomVariableResponse - return localVarReturnValue, nil, err - } - - return a.createWebhooksIntegrationCustomVariableExecute(req) -} - -// createWebhooksIntegrationCustomVariableExecute executes the request. -func (a *WebhooksIntegrationApi) createWebhooksIntegrationCustomVariableExecute(r apiCreateWebhooksIntegrationCustomVariableRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue WebhooksIntegrationCustomVariableResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.CreateWebhooksIntegrationCustomVariable") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteWebhooksIntegrationRequest struct { - ctx _context.Context - webhookName string -} - -func (a *WebhooksIntegrationApi) buildDeleteWebhooksIntegrationRequest(ctx _context.Context, webhookName string) (apiDeleteWebhooksIntegrationRequest, error) { - req := apiDeleteWebhooksIntegrationRequest{ - ctx: ctx, - webhookName: webhookName, - } - return req, nil -} - -// DeleteWebhooksIntegration Delete a webhook. -// Deletes the endpoint with the name ``. -func (a *WebhooksIntegrationApi) DeleteWebhooksIntegration(ctx _context.Context, webhookName string) (*_nethttp.Response, error) { - req, err := a.buildDeleteWebhooksIntegrationRequest(ctx, webhookName) - if err != nil { - return nil, err - } - - return a.deleteWebhooksIntegrationExecute(req) -} - -// deleteWebhooksIntegrationExecute executes the request. -func (a *WebhooksIntegrationApi) deleteWebhooksIntegrationExecute(r apiDeleteWebhooksIntegrationRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.DeleteWebhooksIntegration") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}" - localVarPath = strings.Replace(localVarPath, "{"+"webhook_name"+"}", _neturl.PathEscape(common.ParameterToString(r.webhookName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiDeleteWebhooksIntegrationCustomVariableRequest struct { - ctx _context.Context - customVariableName string -} - -func (a *WebhooksIntegrationApi) buildDeleteWebhooksIntegrationCustomVariableRequest(ctx _context.Context, customVariableName string) (apiDeleteWebhooksIntegrationCustomVariableRequest, error) { - req := apiDeleteWebhooksIntegrationCustomVariableRequest{ - ctx: ctx, - customVariableName: customVariableName, - } - return req, nil -} - -// DeleteWebhooksIntegrationCustomVariable Delete a custom variable. -// Deletes the endpoint with the name ``. -func (a *WebhooksIntegrationApi) DeleteWebhooksIntegrationCustomVariable(ctx _context.Context, customVariableName string) (*_nethttp.Response, error) { - req, err := a.buildDeleteWebhooksIntegrationCustomVariableRequest(ctx, customVariableName) - if err != nil { - return nil, err - } - - return a.deleteWebhooksIntegrationCustomVariableExecute(req) -} - -// deleteWebhooksIntegrationCustomVariableExecute executes the request. -func (a *WebhooksIntegrationApi) deleteWebhooksIntegrationCustomVariableExecute(r apiDeleteWebhooksIntegrationCustomVariableRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.DeleteWebhooksIntegrationCustomVariable") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}" - localVarPath = strings.Replace(localVarPath, "{"+"custom_variable_name"+"}", _neturl.PathEscape(common.ParameterToString(r.customVariableName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetWebhooksIntegrationRequest struct { - ctx _context.Context - webhookName string -} - -func (a *WebhooksIntegrationApi) buildGetWebhooksIntegrationRequest(ctx _context.Context, webhookName string) (apiGetWebhooksIntegrationRequest, error) { - req := apiGetWebhooksIntegrationRequest{ - ctx: ctx, - webhookName: webhookName, - } - return req, nil -} - -// GetWebhooksIntegration Get a webhook integration. -// Gets the content of the webhook with the name ``. -func (a *WebhooksIntegrationApi) GetWebhooksIntegration(ctx _context.Context, webhookName string) (WebhooksIntegration, *_nethttp.Response, error) { - req, err := a.buildGetWebhooksIntegrationRequest(ctx, webhookName) - if err != nil { - var localVarReturnValue WebhooksIntegration - return localVarReturnValue, nil, err - } - - return a.getWebhooksIntegrationExecute(req) -} - -// getWebhooksIntegrationExecute executes the request. -func (a *WebhooksIntegrationApi) getWebhooksIntegrationExecute(r apiGetWebhooksIntegrationRequest) (WebhooksIntegration, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue WebhooksIntegration - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.GetWebhooksIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}" - localVarPath = strings.Replace(localVarPath, "{"+"webhook_name"+"}", _neturl.PathEscape(common.ParameterToString(r.webhookName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetWebhooksIntegrationCustomVariableRequest struct { - ctx _context.Context - customVariableName string -} - -func (a *WebhooksIntegrationApi) buildGetWebhooksIntegrationCustomVariableRequest(ctx _context.Context, customVariableName string) (apiGetWebhooksIntegrationCustomVariableRequest, error) { - req := apiGetWebhooksIntegrationCustomVariableRequest{ - ctx: ctx, - customVariableName: customVariableName, - } - return req, nil -} - -// GetWebhooksIntegrationCustomVariable Get a custom variable. -// Shows the content of the custom variable with the name ``. -// -// If the custom variable is secret, the value does not return in the -// response payload. -func (a *WebhooksIntegrationApi) GetWebhooksIntegrationCustomVariable(ctx _context.Context, customVariableName string) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { - req, err := a.buildGetWebhooksIntegrationCustomVariableRequest(ctx, customVariableName) - if err != nil { - var localVarReturnValue WebhooksIntegrationCustomVariableResponse - return localVarReturnValue, nil, err - } - - return a.getWebhooksIntegrationCustomVariableExecute(req) -} - -// getWebhooksIntegrationCustomVariableExecute executes the request. -func (a *WebhooksIntegrationApi) getWebhooksIntegrationCustomVariableExecute(r apiGetWebhooksIntegrationCustomVariableRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue WebhooksIntegrationCustomVariableResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.GetWebhooksIntegrationCustomVariable") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}" - localVarPath = strings.Replace(localVarPath, "{"+"custom_variable_name"+"}", _neturl.PathEscape(common.ParameterToString(r.customVariableName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateWebhooksIntegrationRequest struct { - ctx _context.Context - webhookName string - body *WebhooksIntegrationUpdateRequest -} - -func (a *WebhooksIntegrationApi) buildUpdateWebhooksIntegrationRequest(ctx _context.Context, webhookName string, body WebhooksIntegrationUpdateRequest) (apiUpdateWebhooksIntegrationRequest, error) { - req := apiUpdateWebhooksIntegrationRequest{ - ctx: ctx, - webhookName: webhookName, - body: &body, - } - return req, nil -} - -// UpdateWebhooksIntegration Update a webhook. -// Updates the endpoint with the name ``. -func (a *WebhooksIntegrationApi) UpdateWebhooksIntegration(ctx _context.Context, webhookName string, body WebhooksIntegrationUpdateRequest) (WebhooksIntegration, *_nethttp.Response, error) { - req, err := a.buildUpdateWebhooksIntegrationRequest(ctx, webhookName, body) - if err != nil { - var localVarReturnValue WebhooksIntegration - return localVarReturnValue, nil, err - } - - return a.updateWebhooksIntegrationExecute(req) -} - -// updateWebhooksIntegrationExecute executes the request. -func (a *WebhooksIntegrationApi) updateWebhooksIntegrationExecute(r apiUpdateWebhooksIntegrationRequest) (WebhooksIntegration, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue WebhooksIntegration - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.UpdateWebhooksIntegration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}" - localVarPath = strings.Replace(localVarPath, "{"+"webhook_name"+"}", _neturl.PathEscape(common.ParameterToString(r.webhookName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateWebhooksIntegrationCustomVariableRequest struct { - ctx _context.Context - customVariableName string - body *WebhooksIntegrationCustomVariableUpdateRequest -} - -func (a *WebhooksIntegrationApi) buildUpdateWebhooksIntegrationCustomVariableRequest(ctx _context.Context, customVariableName string, body WebhooksIntegrationCustomVariableUpdateRequest) (apiUpdateWebhooksIntegrationCustomVariableRequest, error) { - req := apiUpdateWebhooksIntegrationCustomVariableRequest{ - ctx: ctx, - customVariableName: customVariableName, - body: &body, - } - return req, nil -} - -// UpdateWebhooksIntegrationCustomVariable Update a custom variable. -// Updates the endpoint with the name ``. -func (a *WebhooksIntegrationApi) UpdateWebhooksIntegrationCustomVariable(ctx _context.Context, customVariableName string, body WebhooksIntegrationCustomVariableUpdateRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateWebhooksIntegrationCustomVariableRequest(ctx, customVariableName, body) - if err != nil { - var localVarReturnValue WebhooksIntegrationCustomVariableResponse - return localVarReturnValue, nil, err - } - - return a.updateWebhooksIntegrationCustomVariableExecute(req) -} - -// updateWebhooksIntegrationCustomVariableExecute executes the request. -func (a *WebhooksIntegrationApi) updateWebhooksIntegrationCustomVariableExecute(r apiUpdateWebhooksIntegrationCustomVariableRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue WebhooksIntegrationCustomVariableResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.UpdateWebhooksIntegrationCustomVariable") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}" - localVarPath = strings.Replace(localVarPath, "{"+"custom_variable_name"+"}", _neturl.PathEscape(common.ParameterToString(r.customVariableName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewWebhooksIntegrationApi Returns NewWebhooksIntegrationApi. -func NewWebhooksIntegrationApi(client *common.APIClient) *WebhooksIntegrationApi { - return &WebhooksIntegrationApi{ - Client: client, - } -} diff --git a/api/v1/datadog/model_access_role.go b/api/v1/datadog/model_access_role.go deleted file mode 100644 index 4cca97c9417..00000000000 --- a/api/v1/datadog/model_access_role.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AccessRole The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). -type AccessRole string - -// List of AccessRole. -const ( - ACCESSROLE_STANDARD AccessRole = "st" - ACCESSROLE_ADMIN AccessRole = "adm" - ACCESSROLE_READ_ONLY AccessRole = "ro" - ACCESSROLE_ERROR AccessRole = "ERROR" -) - -var allowedAccessRoleEnumValues = []AccessRole{ - ACCESSROLE_STANDARD, - ACCESSROLE_ADMIN, - ACCESSROLE_READ_ONLY, - ACCESSROLE_ERROR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AccessRole) GetAllowedValues() []AccessRole { - return allowedAccessRoleEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AccessRole) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AccessRole(value) - return nil -} - -// NewAccessRoleFromValue returns a pointer to a valid AccessRole -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAccessRoleFromValue(v string) (*AccessRole, error) { - ev := AccessRole(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AccessRole: valid values are %v", v, allowedAccessRoleEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AccessRole) IsValid() bool { - for _, existing := range allowedAccessRoleEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AccessRole value. -func (v AccessRole) Ptr() *AccessRole { - return &v -} - -// NullableAccessRole handles when a null is used for AccessRole. -type NullableAccessRole struct { - value *AccessRole - isSet bool -} - -// Get returns the associated value. -func (v NullableAccessRole) Get() *AccessRole { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAccessRole) Set(val *AccessRole) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAccessRole) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAccessRole) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAccessRole initializes the struct as if Set has been called. -func NewNullableAccessRole(val *AccessRole) *NullableAccessRole { - return &NullableAccessRole{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAccessRole) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAccessRole) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_add_signal_to_incident_request.go b/api/v1/datadog/model_add_signal_to_incident_request.go deleted file mode 100644 index 31e77c04d50..00000000000 --- a/api/v1/datadog/model_add_signal_to_incident_request.go +++ /dev/null @@ -1,181 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AddSignalToIncidentRequest Attributes describing which incident to add the signal to. -type AddSignalToIncidentRequest struct { - // Whether to post the signal on the incident timeline. - AddToSignalTimeline *bool `json:"add_to_signal_timeline,omitempty"` - // Public ID attribute of the incident to which the signal will be added. - IncidentId int64 `json:"incident_id"` - // Version of the updated signal. If server side version is higher, update will be rejected. - Version *int64 `json:"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{} -} - -// NewAddSignalToIncidentRequest instantiates a new AddSignalToIncidentRequest 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 NewAddSignalToIncidentRequest(incidentId int64) *AddSignalToIncidentRequest { - this := AddSignalToIncidentRequest{} - this.IncidentId = incidentId - return &this -} - -// NewAddSignalToIncidentRequestWithDefaults instantiates a new AddSignalToIncidentRequest 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 NewAddSignalToIncidentRequestWithDefaults() *AddSignalToIncidentRequest { - this := AddSignalToIncidentRequest{} - return &this -} - -// GetAddToSignalTimeline returns the AddToSignalTimeline field value if set, zero value otherwise. -func (o *AddSignalToIncidentRequest) GetAddToSignalTimeline() bool { - if o == nil || o.AddToSignalTimeline == nil { - var ret bool - return ret - } - return *o.AddToSignalTimeline -} - -// GetAddToSignalTimelineOk returns a tuple with the AddToSignalTimeline field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AddSignalToIncidentRequest) GetAddToSignalTimelineOk() (*bool, bool) { - if o == nil || o.AddToSignalTimeline == nil { - return nil, false - } - return o.AddToSignalTimeline, true -} - -// HasAddToSignalTimeline returns a boolean if a field has been set. -func (o *AddSignalToIncidentRequest) HasAddToSignalTimeline() bool { - if o != nil && o.AddToSignalTimeline != nil { - return true - } - - return false -} - -// SetAddToSignalTimeline gets a reference to the given bool and assigns it to the AddToSignalTimeline field. -func (o *AddSignalToIncidentRequest) SetAddToSignalTimeline(v bool) { - o.AddToSignalTimeline = &v -} - -// GetIncidentId returns the IncidentId field value. -func (o *AddSignalToIncidentRequest) GetIncidentId() int64 { - if o == nil { - var ret int64 - return ret - } - return o.IncidentId -} - -// GetIncidentIdOk returns a tuple with the IncidentId field value -// and a boolean to check if the value has been set. -func (o *AddSignalToIncidentRequest) GetIncidentIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.IncidentId, true -} - -// SetIncidentId sets field value. -func (o *AddSignalToIncidentRequest) SetIncidentId(v int64) { - o.IncidentId = v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *AddSignalToIncidentRequest) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AddSignalToIncidentRequest) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *AddSignalToIncidentRequest) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *AddSignalToIncidentRequest) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AddSignalToIncidentRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AddToSignalTimeline != nil { - toSerialize["add_to_signal_timeline"] = o.AddToSignalTimeline - } - toSerialize["incident_id"] = o.IncidentId - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AddSignalToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - IncidentId *int64 `json:"incident_id"` - }{} - all := struct { - AddToSignalTimeline *bool `json:"add_to_signal_timeline,omitempty"` - IncidentId int64 `json:"incident_id"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IncidentId == nil { - return fmt.Errorf("Required field incident_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AddToSignalTimeline = all.AddToSignalTimeline - o.IncidentId = all.IncidentId - o.Version = all.Version - return nil -} diff --git a/api/v1/datadog/model_alert_graph_widget_definition.go b/api/v1/datadog/model_alert_graph_widget_definition.go deleted file mode 100644 index 3d8d319b2eb..00000000000 --- a/api/v1/datadog/model_alert_graph_widget_definition.go +++ /dev/null @@ -1,358 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AlertGraphWidgetDefinition Alert graphs are timeseries graphs showing the current status of any monitor defined on your system. -type AlertGraphWidgetDefinition struct { - // ID of the alert to use in the widget. - AlertId string `json:"alert_id"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // The title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the alert graph widget. - Type AlertGraphWidgetDefinitionType `json:"type"` - // Whether to display the Alert Graph as a timeseries or a top list. - VizType WidgetVizType `json:"viz_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{} -} - -// NewAlertGraphWidgetDefinition instantiates a new AlertGraphWidgetDefinition 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 NewAlertGraphWidgetDefinition(alertId string, typeVar AlertGraphWidgetDefinitionType, vizType WidgetVizType) *AlertGraphWidgetDefinition { - this := AlertGraphWidgetDefinition{} - this.AlertId = alertId - this.Type = typeVar - this.VizType = vizType - return &this -} - -// NewAlertGraphWidgetDefinitionWithDefaults instantiates a new AlertGraphWidgetDefinition 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 NewAlertGraphWidgetDefinitionWithDefaults() *AlertGraphWidgetDefinition { - this := AlertGraphWidgetDefinition{} - var typeVar AlertGraphWidgetDefinitionType = ALERTGRAPHWIDGETDEFINITIONTYPE_ALERT_GRAPH - this.Type = typeVar - return &this -} - -// GetAlertId returns the AlertId field value. -func (o *AlertGraphWidgetDefinition) GetAlertId() string { - if o == nil { - var ret string - return ret - } - return o.AlertId -} - -// GetAlertIdOk returns a tuple with the AlertId field value -// and a boolean to check if the value has been set. -func (o *AlertGraphWidgetDefinition) GetAlertIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.AlertId, true -} - -// SetAlertId sets field value. -func (o *AlertGraphWidgetDefinition) SetAlertId(v string) { - o.AlertId = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *AlertGraphWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertGraphWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *AlertGraphWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *AlertGraphWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *AlertGraphWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertGraphWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *AlertGraphWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *AlertGraphWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *AlertGraphWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertGraphWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *AlertGraphWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *AlertGraphWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *AlertGraphWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertGraphWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *AlertGraphWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *AlertGraphWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *AlertGraphWidgetDefinition) GetType() AlertGraphWidgetDefinitionType { - if o == nil { - var ret AlertGraphWidgetDefinitionType - 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 *AlertGraphWidgetDefinition) GetTypeOk() (*AlertGraphWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *AlertGraphWidgetDefinition) SetType(v AlertGraphWidgetDefinitionType) { - o.Type = v -} - -// GetVizType returns the VizType field value. -func (o *AlertGraphWidgetDefinition) GetVizType() WidgetVizType { - if o == nil { - var ret WidgetVizType - return ret - } - return o.VizType -} - -// GetVizTypeOk returns a tuple with the VizType field value -// and a boolean to check if the value has been set. -func (o *AlertGraphWidgetDefinition) GetVizTypeOk() (*WidgetVizType, bool) { - if o == nil { - return nil, false - } - return &o.VizType, true -} - -// SetVizType sets field value. -func (o *AlertGraphWidgetDefinition) SetVizType(v WidgetVizType) { - o.VizType = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AlertGraphWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["alert_id"] = o.AlertId - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - toSerialize["viz_type"] = o.VizType - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - AlertId *string `json:"alert_id"` - Type *AlertGraphWidgetDefinitionType `json:"type"` - VizType *WidgetVizType `json:"viz_type"` - }{} - all := struct { - AlertId string `json:"alert_id"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type AlertGraphWidgetDefinitionType `json:"type"` - VizType WidgetVizType `json:"viz_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AlertId == nil { - return fmt.Errorf("Required field alert_id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - if required.VizType == nil { - return fmt.Errorf("Required field viz_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.VizType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AlertId = all.AlertId - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - o.VizType = all.VizType - return nil -} diff --git a/api/v1/datadog/model_alert_graph_widget_definition_type.go b/api/v1/datadog/model_alert_graph_widget_definition_type.go deleted file mode 100644 index c0d56c7520a..00000000000 --- a/api/v1/datadog/model_alert_graph_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AlertGraphWidgetDefinitionType Type of the alert graph widget. -type AlertGraphWidgetDefinitionType string - -// List of AlertGraphWidgetDefinitionType. -const ( - ALERTGRAPHWIDGETDEFINITIONTYPE_ALERT_GRAPH AlertGraphWidgetDefinitionType = "alert_graph" -) - -var allowedAlertGraphWidgetDefinitionTypeEnumValues = []AlertGraphWidgetDefinitionType{ - ALERTGRAPHWIDGETDEFINITIONTYPE_ALERT_GRAPH, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AlertGraphWidgetDefinitionType) GetAllowedValues() []AlertGraphWidgetDefinitionType { - return allowedAlertGraphWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AlertGraphWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AlertGraphWidgetDefinitionType(value) - return nil -} - -// NewAlertGraphWidgetDefinitionTypeFromValue returns a pointer to a valid AlertGraphWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAlertGraphWidgetDefinitionTypeFromValue(v string) (*AlertGraphWidgetDefinitionType, error) { - ev := AlertGraphWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AlertGraphWidgetDefinitionType: valid values are %v", v, allowedAlertGraphWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AlertGraphWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedAlertGraphWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AlertGraphWidgetDefinitionType value. -func (v AlertGraphWidgetDefinitionType) Ptr() *AlertGraphWidgetDefinitionType { - return &v -} - -// NullableAlertGraphWidgetDefinitionType handles when a null is used for AlertGraphWidgetDefinitionType. -type NullableAlertGraphWidgetDefinitionType struct { - value *AlertGraphWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableAlertGraphWidgetDefinitionType) Get() *AlertGraphWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAlertGraphWidgetDefinitionType) Set(val *AlertGraphWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAlertGraphWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAlertGraphWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAlertGraphWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableAlertGraphWidgetDefinitionType(val *AlertGraphWidgetDefinitionType) *NullableAlertGraphWidgetDefinitionType { - return &NullableAlertGraphWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAlertGraphWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAlertGraphWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_alert_value_widget_definition.go b/api/v1/datadog/model_alert_value_widget_definition.go deleted file mode 100644 index 2f183c01b27..00000000000 --- a/api/v1/datadog/model_alert_value_widget_definition.go +++ /dev/null @@ -1,396 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AlertValueWidgetDefinition Alert values are query values showing the current value of the metric in any monitor defined on your system. -type AlertValueWidgetDefinition struct { - // ID of the alert to use in the widget. - AlertId string `json:"alert_id"` - // Number of decimal to show. If not defined, will use the raw value. - Precision *int64 `json:"precision,omitempty"` - // How to align the text on the widget. - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of value in the widget. - TitleSize *string `json:"title_size,omitempty"` - // Type of the alert value widget. - Type AlertValueWidgetDefinitionType `json:"type"` - // Unit to display with the value. - Unit *string `json:"unit,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{} -} - -// NewAlertValueWidgetDefinition instantiates a new AlertValueWidgetDefinition 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 NewAlertValueWidgetDefinition(alertId string, typeVar AlertValueWidgetDefinitionType) *AlertValueWidgetDefinition { - this := AlertValueWidgetDefinition{} - this.AlertId = alertId - this.Type = typeVar - return &this -} - -// NewAlertValueWidgetDefinitionWithDefaults instantiates a new AlertValueWidgetDefinition 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 NewAlertValueWidgetDefinitionWithDefaults() *AlertValueWidgetDefinition { - this := AlertValueWidgetDefinition{} - var typeVar AlertValueWidgetDefinitionType = ALERTVALUEWIDGETDEFINITIONTYPE_ALERT_VALUE - this.Type = typeVar - return &this -} - -// GetAlertId returns the AlertId field value. -func (o *AlertValueWidgetDefinition) GetAlertId() string { - if o == nil { - var ret string - return ret - } - return o.AlertId -} - -// GetAlertIdOk returns a tuple with the AlertId field value -// and a boolean to check if the value has been set. -func (o *AlertValueWidgetDefinition) GetAlertIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.AlertId, true -} - -// SetAlertId sets field value. -func (o *AlertValueWidgetDefinition) SetAlertId(v string) { - o.AlertId = v -} - -// GetPrecision returns the Precision field value if set, zero value otherwise. -func (o *AlertValueWidgetDefinition) GetPrecision() int64 { - if o == nil || o.Precision == nil { - var ret int64 - return ret - } - return *o.Precision -} - -// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertValueWidgetDefinition) GetPrecisionOk() (*int64, bool) { - if o == nil || o.Precision == nil { - return nil, false - } - return o.Precision, true -} - -// HasPrecision returns a boolean if a field has been set. -func (o *AlertValueWidgetDefinition) HasPrecision() bool { - if o != nil && o.Precision != nil { - return true - } - - return false -} - -// SetPrecision gets a reference to the given int64 and assigns it to the Precision field. -func (o *AlertValueWidgetDefinition) SetPrecision(v int64) { - o.Precision = &v -} - -// GetTextAlign returns the TextAlign field value if set, zero value otherwise. -func (o *AlertValueWidgetDefinition) GetTextAlign() WidgetTextAlign { - if o == nil || o.TextAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TextAlign -} - -// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertValueWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TextAlign == nil { - return nil, false - } - return o.TextAlign, true -} - -// HasTextAlign returns a boolean if a field has been set. -func (o *AlertValueWidgetDefinition) HasTextAlign() bool { - if o != nil && o.TextAlign != nil { - return true - } - - return false -} - -// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. -func (o *AlertValueWidgetDefinition) SetTextAlign(v WidgetTextAlign) { - o.TextAlign = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *AlertValueWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertValueWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *AlertValueWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *AlertValueWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *AlertValueWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertValueWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *AlertValueWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *AlertValueWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *AlertValueWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertValueWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *AlertValueWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *AlertValueWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *AlertValueWidgetDefinition) GetType() AlertValueWidgetDefinitionType { - if o == nil { - var ret AlertValueWidgetDefinitionType - 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 *AlertValueWidgetDefinition) GetTypeOk() (*AlertValueWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *AlertValueWidgetDefinition) SetType(v AlertValueWidgetDefinitionType) { - o.Type = v -} - -// GetUnit returns the Unit field value if set, zero value otherwise. -func (o *AlertValueWidgetDefinition) GetUnit() string { - if o == nil || o.Unit == nil { - var ret string - return ret - } - return *o.Unit -} - -// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertValueWidgetDefinition) GetUnitOk() (*string, bool) { - if o == nil || o.Unit == nil { - return nil, false - } - return o.Unit, true -} - -// HasUnit returns a boolean if a field has been set. -func (o *AlertValueWidgetDefinition) HasUnit() bool { - if o != nil && o.Unit != nil { - return true - } - - return false -} - -// SetUnit gets a reference to the given string and assigns it to the Unit field. -func (o *AlertValueWidgetDefinition) SetUnit(v string) { - o.Unit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AlertValueWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["alert_id"] = o.AlertId - if o.Precision != nil { - toSerialize["precision"] = o.Precision - } - if o.TextAlign != nil { - toSerialize["text_align"] = o.TextAlign - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - if o.Unit != nil { - toSerialize["unit"] = o.Unit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - AlertId *string `json:"alert_id"` - Type *AlertValueWidgetDefinitionType `json:"type"` - }{} - all := struct { - AlertId string `json:"alert_id"` - Precision *int64 `json:"precision,omitempty"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type AlertValueWidgetDefinitionType `json:"type"` - Unit *string `json:"unit,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AlertId == nil { - return fmt.Errorf("Required field alert_id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AlertId = all.AlertId - o.Precision = all.Precision - o.TextAlign = all.TextAlign - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - o.Unit = all.Unit - return nil -} diff --git a/api/v1/datadog/model_alert_value_widget_definition_type.go b/api/v1/datadog/model_alert_value_widget_definition_type.go deleted file mode 100644 index 141199b1612..00000000000 --- a/api/v1/datadog/model_alert_value_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AlertValueWidgetDefinitionType Type of the alert value widget. -type AlertValueWidgetDefinitionType string - -// List of AlertValueWidgetDefinitionType. -const ( - ALERTVALUEWIDGETDEFINITIONTYPE_ALERT_VALUE AlertValueWidgetDefinitionType = "alert_value" -) - -var allowedAlertValueWidgetDefinitionTypeEnumValues = []AlertValueWidgetDefinitionType{ - ALERTVALUEWIDGETDEFINITIONTYPE_ALERT_VALUE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AlertValueWidgetDefinitionType) GetAllowedValues() []AlertValueWidgetDefinitionType { - return allowedAlertValueWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AlertValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AlertValueWidgetDefinitionType(value) - return nil -} - -// NewAlertValueWidgetDefinitionTypeFromValue returns a pointer to a valid AlertValueWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAlertValueWidgetDefinitionTypeFromValue(v string) (*AlertValueWidgetDefinitionType, error) { - ev := AlertValueWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AlertValueWidgetDefinitionType: valid values are %v", v, allowedAlertValueWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AlertValueWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedAlertValueWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AlertValueWidgetDefinitionType value. -func (v AlertValueWidgetDefinitionType) Ptr() *AlertValueWidgetDefinitionType { - return &v -} - -// NullableAlertValueWidgetDefinitionType handles when a null is used for AlertValueWidgetDefinitionType. -type NullableAlertValueWidgetDefinitionType struct { - value *AlertValueWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableAlertValueWidgetDefinitionType) Get() *AlertValueWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAlertValueWidgetDefinitionType) Set(val *AlertValueWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAlertValueWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAlertValueWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAlertValueWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableAlertValueWidgetDefinitionType(val *AlertValueWidgetDefinitionType) *NullableAlertValueWidgetDefinitionType { - return &NullableAlertValueWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAlertValueWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAlertValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_api_error_response.go b/api/v1/datadog/model_api_error_response.go deleted file mode 100644 index 4c7fac22dbd..00000000000 --- a/api/v1/datadog/model_api_error_response.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIErrorResponse Error response object. -type APIErrorResponse struct { - // Array of errors returned by the API. - Errors []string `json:"errors"` - // 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{} -} - -// NewAPIErrorResponse instantiates a new APIErrorResponse 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 NewAPIErrorResponse(errors []string) *APIErrorResponse { - this := APIErrorResponse{} - this.Errors = errors - return &this -} - -// NewAPIErrorResponseWithDefaults instantiates a new APIErrorResponse 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 NewAPIErrorResponseWithDefaults() *APIErrorResponse { - this := APIErrorResponse{} - return &this -} - -// GetErrors returns the Errors field value. -func (o *APIErrorResponse) GetErrors() []string { - if o == nil { - var ret []string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value -// and a boolean to check if the value has been set. -func (o *APIErrorResponse) GetErrorsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Errors, true -} - -// SetErrors sets field value. -func (o *APIErrorResponse) SetErrors(v []string) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIErrorResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["errors"] = o.Errors - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Errors *[]string `json:"errors"` - }{} - all := struct { - Errors []string `json:"errors"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Errors == nil { - return fmt.Errorf("Required field errors missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Errors = all.Errors - return nil -} diff --git a/api/v1/datadog/model_api_key.go b/api/v1/datadog/model_api_key.go deleted file mode 100644 index da50a520eb8..00000000000 --- a/api/v1/datadog/model_api_key.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApiKey Datadog API key. -type ApiKey struct { - // Date of creation of the API key. - Created *string `json:"created,omitempty"` - // Datadog user handle that created the API key. - CreatedBy *string `json:"created_by,omitempty"` - // API key. - Key *string `json:"key,omitempty"` - // Name of your API key. - Name *string `json:"name,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{} -} - -// NewApiKey instantiates a new ApiKey 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 NewApiKey() *ApiKey { - this := ApiKey{} - return &this -} - -// NewApiKeyWithDefaults instantiates a new ApiKey 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 NewApiKeyWithDefaults() *ApiKey { - this := ApiKey{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *ApiKey) GetCreated() string { - if o == nil || o.Created == nil { - var ret string - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApiKey) GetCreatedOk() (*string, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *ApiKey) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given string and assigns it to the Created field. -func (o *ApiKey) SetCreated(v string) { - o.Created = &v -} - -// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. -func (o *ApiKey) GetCreatedBy() string { - if o == nil || o.CreatedBy == nil { - var ret string - return ret - } - return *o.CreatedBy -} - -// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApiKey) GetCreatedByOk() (*string, bool) { - if o == nil || o.CreatedBy == nil { - return nil, false - } - return o.CreatedBy, true -} - -// HasCreatedBy returns a boolean if a field has been set. -func (o *ApiKey) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { - return true - } - - return false -} - -// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. -func (o *ApiKey) SetCreatedBy(v string) { - o.CreatedBy = &v -} - -// GetKey returns the Key field value if set, zero value otherwise. -func (o *ApiKey) GetKey() string { - if o == nil || o.Key == nil { - var ret string - return ret - } - return *o.Key -} - -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApiKey) GetKeyOk() (*string, bool) { - if o == nil || o.Key == nil { - return nil, false - } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *ApiKey) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false -} - -// SetKey gets a reference to the given string and assigns it to the Key field. -func (o *ApiKey) SetKey(v string) { - o.Key = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *ApiKey) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApiKey) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *ApiKey) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *ApiKey) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApiKey) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Created != nil { - toSerialize["created"] = o.Created - } - if o.CreatedBy != nil { - toSerialize["created_by"] = o.CreatedBy - } - if o.Key != nil { - toSerialize["key"] = o.Key - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApiKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Created *string `json:"created,omitempty"` - CreatedBy *string `json:"created_by,omitempty"` - Key *string `json:"key,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Created = all.Created - o.CreatedBy = all.CreatedBy - o.Key = all.Key - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_api_key_list_response.go b/api/v1/datadog/model_api_key_list_response.go deleted file mode 100644 index 16d9f98705c..00000000000 --- a/api/v1/datadog/model_api_key_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApiKeyListResponse List of API and application keys available for a given organization. -type ApiKeyListResponse struct { - // Array of API keys. - ApiKeys []ApiKey `json:"api_keys,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{} -} - -// NewApiKeyListResponse instantiates a new ApiKeyListResponse 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 NewApiKeyListResponse() *ApiKeyListResponse { - this := ApiKeyListResponse{} - return &this -} - -// NewApiKeyListResponseWithDefaults instantiates a new ApiKeyListResponse 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 NewApiKeyListResponseWithDefaults() *ApiKeyListResponse { - this := ApiKeyListResponse{} - return &this -} - -// GetApiKeys returns the ApiKeys field value if set, zero value otherwise. -func (o *ApiKeyListResponse) GetApiKeys() []ApiKey { - if o == nil || o.ApiKeys == nil { - var ret []ApiKey - return ret - } - return o.ApiKeys -} - -// GetApiKeysOk returns a tuple with the ApiKeys field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApiKeyListResponse) GetApiKeysOk() (*[]ApiKey, bool) { - if o == nil || o.ApiKeys == nil { - return nil, false - } - return &o.ApiKeys, true -} - -// HasApiKeys returns a boolean if a field has been set. -func (o *ApiKeyListResponse) HasApiKeys() bool { - if o != nil && o.ApiKeys != nil { - return true - } - - return false -} - -// SetApiKeys gets a reference to the given []ApiKey and assigns it to the ApiKeys field. -func (o *ApiKeyListResponse) SetApiKeys(v []ApiKey) { - o.ApiKeys = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApiKeyListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApiKeys != nil { - toSerialize["api_keys"] = o.ApiKeys - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApiKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApiKeys []ApiKey `json:"api_keys,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ApiKeys = all.ApiKeys - return nil -} diff --git a/api/v1/datadog/model_api_key_response.go b/api/v1/datadog/model_api_key_response.go deleted file mode 100644 index a6adb164eb8..00000000000 --- a/api/v1/datadog/model_api_key_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApiKeyResponse An API key with its associated metadata. -type ApiKeyResponse struct { - // Datadog API key. - ApiKey *ApiKey `json:"api_key,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{} -} - -// NewApiKeyResponse instantiates a new ApiKeyResponse 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 NewApiKeyResponse() *ApiKeyResponse { - this := ApiKeyResponse{} - return &this -} - -// NewApiKeyResponseWithDefaults instantiates a new ApiKeyResponse 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 NewApiKeyResponseWithDefaults() *ApiKeyResponse { - this := ApiKeyResponse{} - return &this -} - -// GetApiKey returns the ApiKey field value if set, zero value otherwise. -func (o *ApiKeyResponse) GetApiKey() ApiKey { - if o == nil || o.ApiKey == nil { - var ret ApiKey - return ret - } - return *o.ApiKey -} - -// GetApiKeyOk returns a tuple with the ApiKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApiKeyResponse) GetApiKeyOk() (*ApiKey, bool) { - if o == nil || o.ApiKey == nil { - return nil, false - } - return o.ApiKey, true -} - -// HasApiKey returns a boolean if a field has been set. -func (o *ApiKeyResponse) HasApiKey() bool { - if o != nil && o.ApiKey != nil { - return true - } - - return false -} - -// SetApiKey gets a reference to the given ApiKey and assigns it to the ApiKey field. -func (o *ApiKeyResponse) SetApiKey(v ApiKey) { - o.ApiKey = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApiKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApiKey != nil { - toSerialize["api_key"] = o.ApiKey - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApiKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApiKey *ApiKey `json:"api_key,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApiKey != nil && all.ApiKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApiKey = all.ApiKey - return nil -} diff --git a/api/v1/datadog/model_apm_stats_query_column_type.go b/api/v1/datadog/model_apm_stats_query_column_type.go deleted file mode 100644 index 5a0634923af..00000000000 --- a/api/v1/datadog/model_apm_stats_query_column_type.go +++ /dev/null @@ -1,236 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApmStatsQueryColumnType Column properties. -type ApmStatsQueryColumnType struct { - // A user-assigned alias for the column. - Alias *string `json:"alias,omitempty"` - // Define a display mode for the table cell. - CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` - // Column name. - Name string `json:"name"` - // Widget sorting methods. - Order *WidgetSort `json:"order,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{} -} - -// NewApmStatsQueryColumnType instantiates a new ApmStatsQueryColumnType 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 NewApmStatsQueryColumnType(name string) *ApmStatsQueryColumnType { - this := ApmStatsQueryColumnType{} - this.Name = name - return &this -} - -// NewApmStatsQueryColumnTypeWithDefaults instantiates a new ApmStatsQueryColumnType 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 NewApmStatsQueryColumnTypeWithDefaults() *ApmStatsQueryColumnType { - this := ApmStatsQueryColumnType{} - return &this -} - -// GetAlias returns the Alias field value if set, zero value otherwise. -func (o *ApmStatsQueryColumnType) GetAlias() string { - if o == nil || o.Alias == nil { - var ret string - return ret - } - return *o.Alias -} - -// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryColumnType) GetAliasOk() (*string, bool) { - if o == nil || o.Alias == nil { - return nil, false - } - return o.Alias, true -} - -// HasAlias returns a boolean if a field has been set. -func (o *ApmStatsQueryColumnType) HasAlias() bool { - if o != nil && o.Alias != nil { - return true - } - - return false -} - -// SetAlias gets a reference to the given string and assigns it to the Alias field. -func (o *ApmStatsQueryColumnType) SetAlias(v string) { - o.Alias = &v -} - -// GetCellDisplayMode returns the CellDisplayMode field value if set, zero value otherwise. -func (o *ApmStatsQueryColumnType) GetCellDisplayMode() TableWidgetCellDisplayMode { - if o == nil || o.CellDisplayMode == nil { - var ret TableWidgetCellDisplayMode - return ret - } - return *o.CellDisplayMode -} - -// GetCellDisplayModeOk returns a tuple with the CellDisplayMode field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryColumnType) GetCellDisplayModeOk() (*TableWidgetCellDisplayMode, bool) { - if o == nil || o.CellDisplayMode == nil { - return nil, false - } - return o.CellDisplayMode, true -} - -// HasCellDisplayMode returns a boolean if a field has been set. -func (o *ApmStatsQueryColumnType) HasCellDisplayMode() bool { - if o != nil && o.CellDisplayMode != nil { - return true - } - - return false -} - -// SetCellDisplayMode gets a reference to the given TableWidgetCellDisplayMode and assigns it to the CellDisplayMode field. -func (o *ApmStatsQueryColumnType) SetCellDisplayMode(v TableWidgetCellDisplayMode) { - o.CellDisplayMode = &v -} - -// GetName returns the Name field value. -func (o *ApmStatsQueryColumnType) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryColumnType) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *ApmStatsQueryColumnType) SetName(v string) { - o.Name = v -} - -// GetOrder returns the Order field value if set, zero value otherwise. -func (o *ApmStatsQueryColumnType) GetOrder() WidgetSort { - if o == nil || o.Order == nil { - var ret WidgetSort - return ret - } - return *o.Order -} - -// GetOrderOk returns a tuple with the Order field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryColumnType) GetOrderOk() (*WidgetSort, bool) { - if o == nil || o.Order == nil { - return nil, false - } - return o.Order, true -} - -// HasOrder returns a boolean if a field has been set. -func (o *ApmStatsQueryColumnType) HasOrder() bool { - if o != nil && o.Order != nil { - return true - } - - return false -} - -// SetOrder gets a reference to the given WidgetSort and assigns it to the Order field. -func (o *ApmStatsQueryColumnType) SetOrder(v WidgetSort) { - o.Order = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApmStatsQueryColumnType) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Alias != nil { - toSerialize["alias"] = o.Alias - } - if o.CellDisplayMode != nil { - toSerialize["cell_display_mode"] = o.CellDisplayMode - } - toSerialize["name"] = o.Name - if o.Order != nil { - toSerialize["order"] = o.Order - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Alias *string `json:"alias,omitempty"` - CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` - Name string `json:"name"` - Order *WidgetSort `json:"order,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.CellDisplayMode; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Alias = all.Alias - o.CellDisplayMode = all.CellDisplayMode - o.Name = all.Name - o.Order = all.Order - return nil -} diff --git a/api/v1/datadog/model_apm_stats_query_definition.go b/api/v1/datadog/model_apm_stats_query_definition.go deleted file mode 100644 index 45996bbe03d..00000000000 --- a/api/v1/datadog/model_apm_stats_query_definition.go +++ /dev/null @@ -1,321 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApmStatsQueryDefinition The APM stats query for table and distributions widgets. -type ApmStatsQueryDefinition struct { - // Column properties used by the front end for display. - Columns []ApmStatsQueryColumnType `json:"columns,omitempty"` - // Environment name. - Env string `json:"env"` - // Operation name associated with service. - Name string `json:"name"` - // The organization's host group name and value. - PrimaryTag string `json:"primary_tag"` - // Resource name. - Resource *string `json:"resource,omitempty"` - // The level of detail for the request. - RowType ApmStatsQueryRowType `json:"row_type"` - // Service name. - Service string `json:"service"` - // 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{} -} - -// NewApmStatsQueryDefinition instantiates a new ApmStatsQueryDefinition 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 NewApmStatsQueryDefinition(env string, name string, primaryTag string, rowType ApmStatsQueryRowType, service string) *ApmStatsQueryDefinition { - this := ApmStatsQueryDefinition{} - this.Env = env - this.Name = name - this.PrimaryTag = primaryTag - this.RowType = rowType - this.Service = service - return &this -} - -// NewApmStatsQueryDefinitionWithDefaults instantiates a new ApmStatsQueryDefinition 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 NewApmStatsQueryDefinitionWithDefaults() *ApmStatsQueryDefinition { - this := ApmStatsQueryDefinition{} - return &this -} - -// GetColumns returns the Columns field value if set, zero value otherwise. -func (o *ApmStatsQueryDefinition) GetColumns() []ApmStatsQueryColumnType { - if o == nil || o.Columns == nil { - var ret []ApmStatsQueryColumnType - return ret - } - return o.Columns -} - -// GetColumnsOk returns a tuple with the Columns field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryDefinition) GetColumnsOk() (*[]ApmStatsQueryColumnType, bool) { - if o == nil || o.Columns == nil { - return nil, false - } - return &o.Columns, true -} - -// HasColumns returns a boolean if a field has been set. -func (o *ApmStatsQueryDefinition) HasColumns() bool { - if o != nil && o.Columns != nil { - return true - } - - return false -} - -// SetColumns gets a reference to the given []ApmStatsQueryColumnType and assigns it to the Columns field. -func (o *ApmStatsQueryDefinition) SetColumns(v []ApmStatsQueryColumnType) { - o.Columns = v -} - -// GetEnv returns the Env field value. -func (o *ApmStatsQueryDefinition) GetEnv() string { - if o == nil { - var ret string - return ret - } - return o.Env -} - -// GetEnvOk returns a tuple with the Env field value -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryDefinition) GetEnvOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Env, true -} - -// SetEnv sets field value. -func (o *ApmStatsQueryDefinition) SetEnv(v string) { - o.Env = v -} - -// GetName returns the Name field value. -func (o *ApmStatsQueryDefinition) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryDefinition) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *ApmStatsQueryDefinition) SetName(v string) { - o.Name = v -} - -// GetPrimaryTag returns the PrimaryTag field value. -func (o *ApmStatsQueryDefinition) GetPrimaryTag() string { - if o == nil { - var ret string - return ret - } - return o.PrimaryTag -} - -// GetPrimaryTagOk returns a tuple with the PrimaryTag field value -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryDefinition) GetPrimaryTagOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.PrimaryTag, true -} - -// SetPrimaryTag sets field value. -func (o *ApmStatsQueryDefinition) SetPrimaryTag(v string) { - o.PrimaryTag = v -} - -// GetResource returns the Resource field value if set, zero value otherwise. -func (o *ApmStatsQueryDefinition) GetResource() string { - if o == nil || o.Resource == nil { - var ret string - return ret - } - return *o.Resource -} - -// GetResourceOk returns a tuple with the Resource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryDefinition) GetResourceOk() (*string, bool) { - if o == nil || o.Resource == nil { - return nil, false - } - return o.Resource, true -} - -// HasResource returns a boolean if a field has been set. -func (o *ApmStatsQueryDefinition) HasResource() bool { - if o != nil && o.Resource != nil { - return true - } - - return false -} - -// SetResource gets a reference to the given string and assigns it to the Resource field. -func (o *ApmStatsQueryDefinition) SetResource(v string) { - o.Resource = &v -} - -// GetRowType returns the RowType field value. -func (o *ApmStatsQueryDefinition) GetRowType() ApmStatsQueryRowType { - if o == nil { - var ret ApmStatsQueryRowType - return ret - } - return o.RowType -} - -// GetRowTypeOk returns a tuple with the RowType field value -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryDefinition) GetRowTypeOk() (*ApmStatsQueryRowType, bool) { - if o == nil { - return nil, false - } - return &o.RowType, true -} - -// SetRowType sets field value. -func (o *ApmStatsQueryDefinition) SetRowType(v ApmStatsQueryRowType) { - o.RowType = v -} - -// GetService returns the Service field value. -func (o *ApmStatsQueryDefinition) GetService() string { - if o == nil { - var ret string - return ret - } - return o.Service -} - -// GetServiceOk returns a tuple with the Service field value -// and a boolean to check if the value has been set. -func (o *ApmStatsQueryDefinition) GetServiceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Service, true -} - -// SetService sets field value. -func (o *ApmStatsQueryDefinition) SetService(v string) { - o.Service = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApmStatsQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Columns != nil { - toSerialize["columns"] = o.Columns - } - toSerialize["env"] = o.Env - toSerialize["name"] = o.Name - toSerialize["primary_tag"] = o.PrimaryTag - if o.Resource != nil { - toSerialize["resource"] = o.Resource - } - toSerialize["row_type"] = o.RowType - toSerialize["service"] = o.Service - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApmStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Env *string `json:"env"` - Name *string `json:"name"` - PrimaryTag *string `json:"primary_tag"` - RowType *ApmStatsQueryRowType `json:"row_type"` - Service *string `json:"service"` - }{} - all := struct { - Columns []ApmStatsQueryColumnType `json:"columns,omitempty"` - Env string `json:"env"` - Name string `json:"name"` - PrimaryTag string `json:"primary_tag"` - Resource *string `json:"resource,omitempty"` - RowType ApmStatsQueryRowType `json:"row_type"` - Service string `json:"service"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Env == nil { - return fmt.Errorf("Required field env missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.PrimaryTag == nil { - return fmt.Errorf("Required field primary_tag missing") - } - if required.RowType == nil { - return fmt.Errorf("Required field row_type missing") - } - if required.Service == nil { - return fmt.Errorf("Required field service missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.RowType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Columns = all.Columns - o.Env = all.Env - o.Name = all.Name - o.PrimaryTag = all.PrimaryTag - o.Resource = all.Resource - o.RowType = all.RowType - o.Service = all.Service - return nil -} diff --git a/api/v1/datadog/model_apm_stats_query_row_type.go b/api/v1/datadog/model_apm_stats_query_row_type.go deleted file mode 100644 index b94bce937b0..00000000000 --- a/api/v1/datadog/model_apm_stats_query_row_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApmStatsQueryRowType The level of detail for the request. -type ApmStatsQueryRowType string - -// List of ApmStatsQueryRowType. -const ( - APMSTATSQUERYROWTYPE_SERVICE ApmStatsQueryRowType = "service" - APMSTATSQUERYROWTYPE_RESOURCE ApmStatsQueryRowType = "resource" - APMSTATSQUERYROWTYPE_SPAN ApmStatsQueryRowType = "span" -) - -var allowedApmStatsQueryRowTypeEnumValues = []ApmStatsQueryRowType{ - APMSTATSQUERYROWTYPE_SERVICE, - APMSTATSQUERYROWTYPE_RESOURCE, - APMSTATSQUERYROWTYPE_SPAN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ApmStatsQueryRowType) GetAllowedValues() []ApmStatsQueryRowType { - return allowedApmStatsQueryRowTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ApmStatsQueryRowType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ApmStatsQueryRowType(value) - return nil -} - -// NewApmStatsQueryRowTypeFromValue returns a pointer to a valid ApmStatsQueryRowType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewApmStatsQueryRowTypeFromValue(v string) (*ApmStatsQueryRowType, error) { - ev := ApmStatsQueryRowType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ApmStatsQueryRowType: valid values are %v", v, allowedApmStatsQueryRowTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ApmStatsQueryRowType) IsValid() bool { - for _, existing := range allowedApmStatsQueryRowTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ApmStatsQueryRowType value. -func (v ApmStatsQueryRowType) Ptr() *ApmStatsQueryRowType { - return &v -} - -// NullableApmStatsQueryRowType handles when a null is used for ApmStatsQueryRowType. -type NullableApmStatsQueryRowType struct { - value *ApmStatsQueryRowType - isSet bool -} - -// Get returns the associated value. -func (v NullableApmStatsQueryRowType) Get() *ApmStatsQueryRowType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApmStatsQueryRowType) Set(val *ApmStatsQueryRowType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApmStatsQueryRowType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableApmStatsQueryRowType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApmStatsQueryRowType initializes the struct as if Set has been called. -func NewNullableApmStatsQueryRowType(val *ApmStatsQueryRowType) *NullableApmStatsQueryRowType { - return &NullableApmStatsQueryRowType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApmStatsQueryRowType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApmStatsQueryRowType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_application_key.go b/api/v1/datadog/model_application_key.go deleted file mode 100644 index 56c8219b90a..00000000000 --- a/api/v1/datadog/model_application_key.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApplicationKey An application key with its associated metadata. -type ApplicationKey struct { - // Hash of an application key. - Hash *string `json:"hash,omitempty"` - // Name of an application key. - Name *string `json:"name,omitempty"` - // Owner of an application key. - Owner *string `json:"owner,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{} -} - -// NewApplicationKey instantiates a new ApplicationKey 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 NewApplicationKey() *ApplicationKey { - this := ApplicationKey{} - return &this -} - -// NewApplicationKeyWithDefaults instantiates a new ApplicationKey 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 NewApplicationKeyWithDefaults() *ApplicationKey { - this := ApplicationKey{} - return &this -} - -// GetHash returns the Hash field value if set, zero value otherwise. -func (o *ApplicationKey) GetHash() string { - if o == nil || o.Hash == nil { - var ret string - return ret - } - return *o.Hash -} - -// GetHashOk returns a tuple with the Hash field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKey) GetHashOk() (*string, bool) { - if o == nil || o.Hash == nil { - return nil, false - } - return o.Hash, true -} - -// HasHash returns a boolean if a field has been set. -func (o *ApplicationKey) HasHash() bool { - if o != nil && o.Hash != nil { - return true - } - - return false -} - -// SetHash gets a reference to the given string and assigns it to the Hash field. -func (o *ApplicationKey) SetHash(v string) { - o.Hash = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *ApplicationKey) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKey) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *ApplicationKey) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *ApplicationKey) SetName(v string) { - o.Name = &v -} - -// GetOwner returns the Owner field value if set, zero value otherwise. -func (o *ApplicationKey) GetOwner() string { - if o == nil || o.Owner == nil { - var ret string - return ret - } - return *o.Owner -} - -// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKey) GetOwnerOk() (*string, bool) { - if o == nil || o.Owner == nil { - return nil, false - } - return o.Owner, true -} - -// HasOwner returns a boolean if a field has been set. -func (o *ApplicationKey) HasOwner() bool { - if o != nil && o.Owner != nil { - return true - } - - return false -} - -// SetOwner gets a reference to the given string and assigns it to the Owner field. -func (o *ApplicationKey) SetOwner(v string) { - o.Owner = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKey) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hash != nil { - toSerialize["hash"] = o.Hash - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Owner != nil { - toSerialize["owner"] = o.Owner - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hash *string `json:"hash,omitempty"` - Name *string `json:"name,omitempty"` - Owner *string `json:"owner,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hash = all.Hash - o.Name = all.Name - o.Owner = all.Owner - return nil -} diff --git a/api/v1/datadog/model_application_key_list_response.go b/api/v1/datadog/model_application_key_list_response.go deleted file mode 100644 index 66a9776c13f..00000000000 --- a/api/v1/datadog/model_application_key_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApplicationKeyListResponse An application key response. -type ApplicationKeyListResponse struct { - // Array of application keys. - ApplicationKeys []ApplicationKey `json:"application_keys,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{} -} - -// NewApplicationKeyListResponse instantiates a new ApplicationKeyListResponse 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 NewApplicationKeyListResponse() *ApplicationKeyListResponse { - this := ApplicationKeyListResponse{} - return &this -} - -// NewApplicationKeyListResponseWithDefaults instantiates a new ApplicationKeyListResponse 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 NewApplicationKeyListResponseWithDefaults() *ApplicationKeyListResponse { - this := ApplicationKeyListResponse{} - return &this -} - -// GetApplicationKeys returns the ApplicationKeys field value if set, zero value otherwise. -func (o *ApplicationKeyListResponse) GetApplicationKeys() []ApplicationKey { - if o == nil || o.ApplicationKeys == nil { - var ret []ApplicationKey - return ret - } - return o.ApplicationKeys -} - -// GetApplicationKeysOk returns a tuple with the ApplicationKeys field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKeyListResponse) GetApplicationKeysOk() (*[]ApplicationKey, bool) { - if o == nil || o.ApplicationKeys == nil { - return nil, false - } - return &o.ApplicationKeys, true -} - -// HasApplicationKeys returns a boolean if a field has been set. -func (o *ApplicationKeyListResponse) HasApplicationKeys() bool { - if o != nil && o.ApplicationKeys != nil { - return true - } - - return false -} - -// SetApplicationKeys gets a reference to the given []ApplicationKey and assigns it to the ApplicationKeys field. -func (o *ApplicationKeyListResponse) SetApplicationKeys(v []ApplicationKey) { - o.ApplicationKeys = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApplicationKeys != nil { - toSerialize["application_keys"] = o.ApplicationKeys - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApplicationKeys []ApplicationKey `json:"application_keys,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ApplicationKeys = all.ApplicationKeys - return nil -} diff --git a/api/v1/datadog/model_application_key_response.go b/api/v1/datadog/model_application_key_response.go deleted file mode 100644 index 75fcb54a465..00000000000 --- a/api/v1/datadog/model_application_key_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApplicationKeyResponse An application key response. -type ApplicationKeyResponse struct { - // An application key with its associated metadata. - ApplicationKey *ApplicationKey `json:"application_key,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{} -} - -// NewApplicationKeyResponse instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponse() *ApplicationKeyResponse { - this := ApplicationKeyResponse{} - return &this -} - -// NewApplicationKeyResponseWithDefaults instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponseWithDefaults() *ApplicationKeyResponse { - this := ApplicationKeyResponse{} - return &this -} - -// GetApplicationKey returns the ApplicationKey field value if set, zero value otherwise. -func (o *ApplicationKeyResponse) GetApplicationKey() ApplicationKey { - if o == nil || o.ApplicationKey == nil { - var ret ApplicationKey - return ret - } - return *o.ApplicationKey -} - -// GetApplicationKeyOk returns a tuple with the ApplicationKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKeyResponse) GetApplicationKeyOk() (*ApplicationKey, bool) { - if o == nil || o.ApplicationKey == nil { - return nil, false - } - return o.ApplicationKey, true -} - -// HasApplicationKey returns a boolean if a field has been set. -func (o *ApplicationKeyResponse) HasApplicationKey() bool { - if o != nil && o.ApplicationKey != nil { - return true - } - - return false -} - -// SetApplicationKey gets a reference to the given ApplicationKey and assigns it to the ApplicationKey field. -func (o *ApplicationKeyResponse) SetApplicationKey(v ApplicationKey) { - o.ApplicationKey = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApplicationKey != nil { - toSerialize["application_key"] = o.ApplicationKey - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApplicationKey *ApplicationKey `json:"application_key,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApplicationKey != nil && all.ApplicationKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApplicationKey = all.ApplicationKey - return nil -} diff --git a/api/v1/datadog/model_authentication_validation_response.go b/api/v1/datadog/model_authentication_validation_response.go deleted file mode 100644 index 0a46542f31a..00000000000 --- a/api/v1/datadog/model_authentication_validation_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthenticationValidationResponse Represent validation endpoint responses. -type AuthenticationValidationResponse struct { - // Return `true` if the authentication response is valid. - Valid *bool `json:"valid,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{} -} - -// NewAuthenticationValidationResponse instantiates a new AuthenticationValidationResponse 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 NewAuthenticationValidationResponse() *AuthenticationValidationResponse { - this := AuthenticationValidationResponse{} - return &this -} - -// NewAuthenticationValidationResponseWithDefaults instantiates a new AuthenticationValidationResponse 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 NewAuthenticationValidationResponseWithDefaults() *AuthenticationValidationResponse { - this := AuthenticationValidationResponse{} - return &this -} - -// GetValid returns the Valid field value if set, zero value otherwise. -func (o *AuthenticationValidationResponse) GetValid() bool { - if o == nil || o.Valid == nil { - var ret bool - return ret - } - return *o.Valid -} - -// GetValidOk returns a tuple with the Valid field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthenticationValidationResponse) GetValidOk() (*bool, bool) { - if o == nil || o.Valid == nil { - return nil, false - } - return o.Valid, true -} - -// HasValid returns a boolean if a field has been set. -func (o *AuthenticationValidationResponse) HasValid() bool { - if o != nil && o.Valid != nil { - return true - } - - return false -} - -// SetValid gets a reference to the given bool and assigns it to the Valid field. -func (o *AuthenticationValidationResponse) SetValid(v bool) { - o.Valid = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthenticationValidationResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Valid != nil { - toSerialize["valid"] = o.Valid - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthenticationValidationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Valid *bool `json:"valid,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Valid = all.Valid - return nil -} diff --git a/api/v1/datadog/model_aws_account.go b/api/v1/datadog/model_aws_account.go deleted file mode 100644 index 86154f541ee..00000000000 --- a/api/v1/datadog/model_aws_account.go +++ /dev/null @@ -1,512 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSAccount Returns the AWS account associated with this integration. -type AWSAccount struct { - // Your AWS access key ID. Only required if your AWS account is a GovCloud or China account. - AccessKeyId *string `json:"access_key_id,omitempty"` - // Your AWS Account ID without dashes. - AccountId *string `json:"account_id,omitempty"` - // An object, (in the form `{"namespace1":true/false, "namespace2":true/false}`), - // that enables or disables metric collection for specific AWS namespaces for this - // AWS account only. - AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"` - // Whether Datadog collects cloud security posture management resources from your AWS account. This includes additional resources not covered under the general `resource_collection`. - CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"` - // An array of AWS regions to exclude from metrics collection. - ExcludedRegions []string `json:"excluded_regions,omitempty"` - // The array of EC2 tags (in the form `key:value`) defines a filter that Datadog uses when collecting metrics from EC2. - // Wildcards, such as `?` (for single characters) and `*` (for multiple characters) can also be used. - // Only hosts that match one of the defined tags - // will be imported into Datadog. The rest will be ignored. - // Host matching a given tag can also be excluded by adding `!` before the tag. - // For example, `env:production,instance-type:c1.*,!region:us-east-1` - FilterTags []string `json:"filter_tags,omitempty"` - // Array of tags (in the form `key:value`) to add to all hosts - // and metrics reporting through this integration. - HostTags []string `json:"host_tags,omitempty"` - // Whether Datadog collects metrics for this AWS account. - MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"` - // Whether Datadog collects a standard set of resources from your AWS account. - ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` - // Your Datadog role delegation name. - RoleName *string `json:"role_name,omitempty"` - // Your AWS secret access key. Only required if your AWS account is a GovCloud or China account. - SecretAccessKey *string `json:"secret_access_key,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{} -} - -// NewAWSAccount instantiates a new AWSAccount 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 NewAWSAccount() *AWSAccount { - this := AWSAccount{} - var cspmResourceCollectionEnabled bool = false - this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled - var metricsCollectionEnabled bool = true - this.MetricsCollectionEnabled = &metricsCollectionEnabled - var resourceCollectionEnabled bool = false - this.ResourceCollectionEnabled = &resourceCollectionEnabled - return &this -} - -// NewAWSAccountWithDefaults instantiates a new AWSAccount 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 NewAWSAccountWithDefaults() *AWSAccount { - this := AWSAccount{} - var cspmResourceCollectionEnabled bool = false - this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled - var metricsCollectionEnabled bool = true - this.MetricsCollectionEnabled = &metricsCollectionEnabled - var resourceCollectionEnabled bool = false - this.ResourceCollectionEnabled = &resourceCollectionEnabled - return &this -} - -// GetAccessKeyId returns the AccessKeyId field value if set, zero value otherwise. -func (o *AWSAccount) GetAccessKeyId() string { - if o == nil || o.AccessKeyId == nil { - var ret string - return ret - } - return *o.AccessKeyId -} - -// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetAccessKeyIdOk() (*string, bool) { - if o == nil || o.AccessKeyId == nil { - return nil, false - } - return o.AccessKeyId, true -} - -// HasAccessKeyId returns a boolean if a field has been set. -func (o *AWSAccount) HasAccessKeyId() bool { - if o != nil && o.AccessKeyId != nil { - return true - } - - return false -} - -// SetAccessKeyId gets a reference to the given string and assigns it to the AccessKeyId field. -func (o *AWSAccount) SetAccessKeyId(v string) { - o.AccessKeyId = &v -} - -// GetAccountId returns the AccountId field value if set, zero value otherwise. -func (o *AWSAccount) GetAccountId() string { - if o == nil || o.AccountId == nil { - var ret string - return ret - } - return *o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetAccountIdOk() (*string, bool) { - if o == nil || o.AccountId == nil { - return nil, false - } - return o.AccountId, true -} - -// HasAccountId returns a boolean if a field has been set. -func (o *AWSAccount) HasAccountId() bool { - if o != nil && o.AccountId != nil { - return true - } - - return false -} - -// SetAccountId gets a reference to the given string and assigns it to the AccountId field. -func (o *AWSAccount) SetAccountId(v string) { - o.AccountId = &v -} - -// GetAccountSpecificNamespaceRules returns the AccountSpecificNamespaceRules field value if set, zero value otherwise. -func (o *AWSAccount) GetAccountSpecificNamespaceRules() map[string]bool { - if o == nil || o.AccountSpecificNamespaceRules == nil { - var ret map[string]bool - return ret - } - return o.AccountSpecificNamespaceRules -} - -// GetAccountSpecificNamespaceRulesOk returns a tuple with the AccountSpecificNamespaceRules field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetAccountSpecificNamespaceRulesOk() (*map[string]bool, bool) { - if o == nil || o.AccountSpecificNamespaceRules == nil { - return nil, false - } - return &o.AccountSpecificNamespaceRules, true -} - -// HasAccountSpecificNamespaceRules returns a boolean if a field has been set. -func (o *AWSAccount) HasAccountSpecificNamespaceRules() bool { - if o != nil && o.AccountSpecificNamespaceRules != nil { - return true - } - - return false -} - -// SetAccountSpecificNamespaceRules gets a reference to the given map[string]bool and assigns it to the AccountSpecificNamespaceRules field. -func (o *AWSAccount) SetAccountSpecificNamespaceRules(v map[string]bool) { - o.AccountSpecificNamespaceRules = v -} - -// GetCspmResourceCollectionEnabled returns the CspmResourceCollectionEnabled field value if set, zero value otherwise. -func (o *AWSAccount) GetCspmResourceCollectionEnabled() bool { - if o == nil || o.CspmResourceCollectionEnabled == nil { - var ret bool - return ret - } - return *o.CspmResourceCollectionEnabled -} - -// GetCspmResourceCollectionEnabledOk returns a tuple with the CspmResourceCollectionEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetCspmResourceCollectionEnabledOk() (*bool, bool) { - if o == nil || o.CspmResourceCollectionEnabled == nil { - return nil, false - } - return o.CspmResourceCollectionEnabled, true -} - -// HasCspmResourceCollectionEnabled returns a boolean if a field has been set. -func (o *AWSAccount) HasCspmResourceCollectionEnabled() bool { - if o != nil && o.CspmResourceCollectionEnabled != nil { - return true - } - - return false -} - -// SetCspmResourceCollectionEnabled gets a reference to the given bool and assigns it to the CspmResourceCollectionEnabled field. -func (o *AWSAccount) SetCspmResourceCollectionEnabled(v bool) { - o.CspmResourceCollectionEnabled = &v -} - -// GetExcludedRegions returns the ExcludedRegions field value if set, zero value otherwise. -func (o *AWSAccount) GetExcludedRegions() []string { - if o == nil || o.ExcludedRegions == nil { - var ret []string - return ret - } - return o.ExcludedRegions -} - -// GetExcludedRegionsOk returns a tuple with the ExcludedRegions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetExcludedRegionsOk() (*[]string, bool) { - if o == nil || o.ExcludedRegions == nil { - return nil, false - } - return &o.ExcludedRegions, true -} - -// HasExcludedRegions returns a boolean if a field has been set. -func (o *AWSAccount) HasExcludedRegions() bool { - if o != nil && o.ExcludedRegions != nil { - return true - } - - return false -} - -// SetExcludedRegions gets a reference to the given []string and assigns it to the ExcludedRegions field. -func (o *AWSAccount) SetExcludedRegions(v []string) { - o.ExcludedRegions = v -} - -// GetFilterTags returns the FilterTags field value if set, zero value otherwise. -func (o *AWSAccount) GetFilterTags() []string { - if o == nil || o.FilterTags == nil { - var ret []string - return ret - } - return o.FilterTags -} - -// GetFilterTagsOk returns a tuple with the FilterTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetFilterTagsOk() (*[]string, bool) { - if o == nil || o.FilterTags == nil { - return nil, false - } - return &o.FilterTags, true -} - -// HasFilterTags returns a boolean if a field has been set. -func (o *AWSAccount) HasFilterTags() bool { - if o != nil && o.FilterTags != nil { - return true - } - - return false -} - -// SetFilterTags gets a reference to the given []string and assigns it to the FilterTags field. -func (o *AWSAccount) SetFilterTags(v []string) { - o.FilterTags = v -} - -// GetHostTags returns the HostTags field value if set, zero value otherwise. -func (o *AWSAccount) GetHostTags() []string { - if o == nil || o.HostTags == nil { - var ret []string - return ret - } - return o.HostTags -} - -// GetHostTagsOk returns a tuple with the HostTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetHostTagsOk() (*[]string, bool) { - if o == nil || o.HostTags == nil { - return nil, false - } - return &o.HostTags, true -} - -// HasHostTags returns a boolean if a field has been set. -func (o *AWSAccount) HasHostTags() bool { - if o != nil && o.HostTags != nil { - return true - } - - return false -} - -// SetHostTags gets a reference to the given []string and assigns it to the HostTags field. -func (o *AWSAccount) SetHostTags(v []string) { - o.HostTags = v -} - -// GetMetricsCollectionEnabled returns the MetricsCollectionEnabled field value if set, zero value otherwise. -func (o *AWSAccount) GetMetricsCollectionEnabled() bool { - if o == nil || o.MetricsCollectionEnabled == nil { - var ret bool - return ret - } - return *o.MetricsCollectionEnabled -} - -// GetMetricsCollectionEnabledOk returns a tuple with the MetricsCollectionEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetMetricsCollectionEnabledOk() (*bool, bool) { - if o == nil || o.MetricsCollectionEnabled == nil { - return nil, false - } - return o.MetricsCollectionEnabled, true -} - -// HasMetricsCollectionEnabled returns a boolean if a field has been set. -func (o *AWSAccount) HasMetricsCollectionEnabled() bool { - if o != nil && o.MetricsCollectionEnabled != nil { - return true - } - - return false -} - -// SetMetricsCollectionEnabled gets a reference to the given bool and assigns it to the MetricsCollectionEnabled field. -func (o *AWSAccount) SetMetricsCollectionEnabled(v bool) { - o.MetricsCollectionEnabled = &v -} - -// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise. -func (o *AWSAccount) GetResourceCollectionEnabled() bool { - if o == nil || o.ResourceCollectionEnabled == nil { - var ret bool - return ret - } - return *o.ResourceCollectionEnabled -} - -// GetResourceCollectionEnabledOk returns a tuple with the ResourceCollectionEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetResourceCollectionEnabledOk() (*bool, bool) { - if o == nil || o.ResourceCollectionEnabled == nil { - return nil, false - } - return o.ResourceCollectionEnabled, true -} - -// HasResourceCollectionEnabled returns a boolean if a field has been set. -func (o *AWSAccount) HasResourceCollectionEnabled() bool { - if o != nil && o.ResourceCollectionEnabled != nil { - return true - } - - return false -} - -// SetResourceCollectionEnabled gets a reference to the given bool and assigns it to the ResourceCollectionEnabled field. -func (o *AWSAccount) SetResourceCollectionEnabled(v bool) { - o.ResourceCollectionEnabled = &v -} - -// GetRoleName returns the RoleName field value if set, zero value otherwise. -func (o *AWSAccount) GetRoleName() string { - if o == nil || o.RoleName == nil { - var ret string - return ret - } - return *o.RoleName -} - -// GetRoleNameOk returns a tuple with the RoleName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetRoleNameOk() (*string, bool) { - if o == nil || o.RoleName == nil { - return nil, false - } - return o.RoleName, true -} - -// HasRoleName returns a boolean if a field has been set. -func (o *AWSAccount) HasRoleName() bool { - if o != nil && o.RoleName != nil { - return true - } - - return false -} - -// SetRoleName gets a reference to the given string and assigns it to the RoleName field. -func (o *AWSAccount) SetRoleName(v string) { - o.RoleName = &v -} - -// GetSecretAccessKey returns the SecretAccessKey field value if set, zero value otherwise. -func (o *AWSAccount) GetSecretAccessKey() string { - if o == nil || o.SecretAccessKey == nil { - var ret string - return ret - } - return *o.SecretAccessKey -} - -// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccount) GetSecretAccessKeyOk() (*string, bool) { - if o == nil || o.SecretAccessKey == nil { - return nil, false - } - return o.SecretAccessKey, true -} - -// HasSecretAccessKey returns a boolean if a field has been set. -func (o *AWSAccount) HasSecretAccessKey() bool { - if o != nil && o.SecretAccessKey != nil { - return true - } - - return false -} - -// SetSecretAccessKey gets a reference to the given string and assigns it to the SecretAccessKey field. -func (o *AWSAccount) SetSecretAccessKey(v string) { - o.SecretAccessKey = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSAccount) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AccessKeyId != nil { - toSerialize["access_key_id"] = o.AccessKeyId - } - if o.AccountId != nil { - toSerialize["account_id"] = o.AccountId - } - if o.AccountSpecificNamespaceRules != nil { - toSerialize["account_specific_namespace_rules"] = o.AccountSpecificNamespaceRules - } - if o.CspmResourceCollectionEnabled != nil { - toSerialize["cspm_resource_collection_enabled"] = o.CspmResourceCollectionEnabled - } - if o.ExcludedRegions != nil { - toSerialize["excluded_regions"] = o.ExcludedRegions - } - if o.FilterTags != nil { - toSerialize["filter_tags"] = o.FilterTags - } - if o.HostTags != nil { - toSerialize["host_tags"] = o.HostTags - } - if o.MetricsCollectionEnabled != nil { - toSerialize["metrics_collection_enabled"] = o.MetricsCollectionEnabled - } - if o.ResourceCollectionEnabled != nil { - toSerialize["resource_collection_enabled"] = o.ResourceCollectionEnabled - } - if o.RoleName != nil { - toSerialize["role_name"] = o.RoleName - } - if o.SecretAccessKey != nil { - toSerialize["secret_access_key"] = o.SecretAccessKey - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AccessKeyId *string `json:"access_key_id,omitempty"` - AccountId *string `json:"account_id,omitempty"` - AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"` - CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"` - ExcludedRegions []string `json:"excluded_regions,omitempty"` - FilterTags []string `json:"filter_tags,omitempty"` - HostTags []string `json:"host_tags,omitempty"` - MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"` - ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` - RoleName *string `json:"role_name,omitempty"` - SecretAccessKey *string `json:"secret_access_key,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccessKeyId = all.AccessKeyId - o.AccountId = all.AccountId - o.AccountSpecificNamespaceRules = all.AccountSpecificNamespaceRules - o.CspmResourceCollectionEnabled = all.CspmResourceCollectionEnabled - o.ExcludedRegions = all.ExcludedRegions - o.FilterTags = all.FilterTags - o.HostTags = all.HostTags - o.MetricsCollectionEnabled = all.MetricsCollectionEnabled - o.ResourceCollectionEnabled = all.ResourceCollectionEnabled - o.RoleName = all.RoleName - o.SecretAccessKey = all.SecretAccessKey - return nil -} diff --git a/api/v1/datadog/model_aws_account_and_lambda_request.go b/api/v1/datadog/model_aws_account_and_lambda_request.go deleted file mode 100644 index 9314400e7bd..00000000000 --- a/api/v1/datadog/model_aws_account_and_lambda_request.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AWSAccountAndLambdaRequest AWS account ID and Lambda ARN. -type AWSAccountAndLambdaRequest struct { - // Your AWS Account ID without dashes. - AccountId string `json:"account_id"` - // ARN of the Datadog Lambda created during the Datadog-Amazon Web services Log collection setup. - LambdaArn string `json:"lambda_arn"` - // 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{} -} - -// NewAWSAccountAndLambdaRequest instantiates a new AWSAccountAndLambdaRequest 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 NewAWSAccountAndLambdaRequest(accountId string, lambdaArn string) *AWSAccountAndLambdaRequest { - this := AWSAccountAndLambdaRequest{} - this.AccountId = accountId - this.LambdaArn = lambdaArn - return &this -} - -// NewAWSAccountAndLambdaRequestWithDefaults instantiates a new AWSAccountAndLambdaRequest 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 NewAWSAccountAndLambdaRequestWithDefaults() *AWSAccountAndLambdaRequest { - this := AWSAccountAndLambdaRequest{} - return &this -} - -// GetAccountId returns the AccountId field value. -func (o *AWSAccountAndLambdaRequest) GetAccountId() string { - if o == nil { - var ret string - return ret - } - return o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value -// and a boolean to check if the value has been set. -func (o *AWSAccountAndLambdaRequest) GetAccountIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.AccountId, true -} - -// SetAccountId sets field value. -func (o *AWSAccountAndLambdaRequest) SetAccountId(v string) { - o.AccountId = v -} - -// GetLambdaArn returns the LambdaArn field value. -func (o *AWSAccountAndLambdaRequest) GetLambdaArn() string { - if o == nil { - var ret string - return ret - } - return o.LambdaArn -} - -// GetLambdaArnOk returns a tuple with the LambdaArn field value -// and a boolean to check if the value has been set. -func (o *AWSAccountAndLambdaRequest) GetLambdaArnOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.LambdaArn, true -} - -// SetLambdaArn sets field value. -func (o *AWSAccountAndLambdaRequest) SetLambdaArn(v string) { - o.LambdaArn = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSAccountAndLambdaRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["account_id"] = o.AccountId - toSerialize["lambda_arn"] = o.LambdaArn - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSAccountAndLambdaRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - AccountId *string `json:"account_id"` - LambdaArn *string `json:"lambda_arn"` - }{} - all := struct { - AccountId string `json:"account_id"` - LambdaArn string `json:"lambda_arn"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccountId == nil { - return fmt.Errorf("Required field account_id missing") - } - if required.LambdaArn == nil { - return fmt.Errorf("Required field lambda_arn missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccountId = all.AccountId - o.LambdaArn = all.LambdaArn - return nil -} diff --git a/api/v1/datadog/model_aws_account_create_response.go b/api/v1/datadog/model_aws_account_create_response.go deleted file mode 100644 index 4fb560c03b6..00000000000 --- a/api/v1/datadog/model_aws_account_create_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSAccountCreateResponse The Response returned by the AWS Create Account call. -type AWSAccountCreateResponse struct { - // AWS external_id. - ExternalId *string `json:"external_id,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{} -} - -// NewAWSAccountCreateResponse instantiates a new AWSAccountCreateResponse 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 NewAWSAccountCreateResponse() *AWSAccountCreateResponse { - this := AWSAccountCreateResponse{} - return &this -} - -// NewAWSAccountCreateResponseWithDefaults instantiates a new AWSAccountCreateResponse 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 NewAWSAccountCreateResponseWithDefaults() *AWSAccountCreateResponse { - this := AWSAccountCreateResponse{} - return &this -} - -// GetExternalId returns the ExternalId field value if set, zero value otherwise. -func (o *AWSAccountCreateResponse) GetExternalId() string { - if o == nil || o.ExternalId == nil { - var ret string - return ret - } - return *o.ExternalId -} - -// GetExternalIdOk returns a tuple with the ExternalId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccountCreateResponse) GetExternalIdOk() (*string, bool) { - if o == nil || o.ExternalId == nil { - return nil, false - } - return o.ExternalId, true -} - -// HasExternalId returns a boolean if a field has been set. -func (o *AWSAccountCreateResponse) HasExternalId() bool { - if o != nil && o.ExternalId != nil { - return true - } - - return false -} - -// SetExternalId gets a reference to the given string and assigns it to the ExternalId field. -func (o *AWSAccountCreateResponse) SetExternalId(v string) { - o.ExternalId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSAccountCreateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ExternalId != nil { - toSerialize["external_id"] = o.ExternalId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSAccountCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ExternalId *string `json:"external_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ExternalId = all.ExternalId - return nil -} diff --git a/api/v1/datadog/model_aws_account_delete_request.go b/api/v1/datadog/model_aws_account_delete_request.go deleted file mode 100644 index 8928b0c1253..00000000000 --- a/api/v1/datadog/model_aws_account_delete_request.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSAccountDeleteRequest List of AWS accounts to delete. -type AWSAccountDeleteRequest struct { - // Your AWS access key ID. Only required if your AWS account is a GovCloud or China account. - AccessKeyId *string `json:"access_key_id,omitempty"` - // Your AWS Account ID without dashes. - AccountId *string `json:"account_id,omitempty"` - // Your Datadog role delegation name. - RoleName *string `json:"role_name,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{} -} - -// NewAWSAccountDeleteRequest instantiates a new AWSAccountDeleteRequest 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 NewAWSAccountDeleteRequest() *AWSAccountDeleteRequest { - this := AWSAccountDeleteRequest{} - return &this -} - -// NewAWSAccountDeleteRequestWithDefaults instantiates a new AWSAccountDeleteRequest 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 NewAWSAccountDeleteRequestWithDefaults() *AWSAccountDeleteRequest { - this := AWSAccountDeleteRequest{} - return &this -} - -// GetAccessKeyId returns the AccessKeyId field value if set, zero value otherwise. -func (o *AWSAccountDeleteRequest) GetAccessKeyId() string { - if o == nil || o.AccessKeyId == nil { - var ret string - return ret - } - return *o.AccessKeyId -} - -// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccountDeleteRequest) GetAccessKeyIdOk() (*string, bool) { - if o == nil || o.AccessKeyId == nil { - return nil, false - } - return o.AccessKeyId, true -} - -// HasAccessKeyId returns a boolean if a field has been set. -func (o *AWSAccountDeleteRequest) HasAccessKeyId() bool { - if o != nil && o.AccessKeyId != nil { - return true - } - - return false -} - -// SetAccessKeyId gets a reference to the given string and assigns it to the AccessKeyId field. -func (o *AWSAccountDeleteRequest) SetAccessKeyId(v string) { - o.AccessKeyId = &v -} - -// GetAccountId returns the AccountId field value if set, zero value otherwise. -func (o *AWSAccountDeleteRequest) GetAccountId() string { - if o == nil || o.AccountId == nil { - var ret string - return ret - } - return *o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccountDeleteRequest) GetAccountIdOk() (*string, bool) { - if o == nil || o.AccountId == nil { - return nil, false - } - return o.AccountId, true -} - -// HasAccountId returns a boolean if a field has been set. -func (o *AWSAccountDeleteRequest) HasAccountId() bool { - if o != nil && o.AccountId != nil { - return true - } - - return false -} - -// SetAccountId gets a reference to the given string and assigns it to the AccountId field. -func (o *AWSAccountDeleteRequest) SetAccountId(v string) { - o.AccountId = &v -} - -// GetRoleName returns the RoleName field value if set, zero value otherwise. -func (o *AWSAccountDeleteRequest) GetRoleName() string { - if o == nil || o.RoleName == nil { - var ret string - return ret - } - return *o.RoleName -} - -// GetRoleNameOk returns a tuple with the RoleName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccountDeleteRequest) GetRoleNameOk() (*string, bool) { - if o == nil || o.RoleName == nil { - return nil, false - } - return o.RoleName, true -} - -// HasRoleName returns a boolean if a field has been set. -func (o *AWSAccountDeleteRequest) HasRoleName() bool { - if o != nil && o.RoleName != nil { - return true - } - - return false -} - -// SetRoleName gets a reference to the given string and assigns it to the RoleName field. -func (o *AWSAccountDeleteRequest) SetRoleName(v string) { - o.RoleName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSAccountDeleteRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AccessKeyId != nil { - toSerialize["access_key_id"] = o.AccessKeyId - } - if o.AccountId != nil { - toSerialize["account_id"] = o.AccountId - } - if o.RoleName != nil { - toSerialize["role_name"] = o.RoleName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSAccountDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AccessKeyId *string `json:"access_key_id,omitempty"` - AccountId *string `json:"account_id,omitempty"` - RoleName *string `json:"role_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccessKeyId = all.AccessKeyId - o.AccountId = all.AccountId - o.RoleName = all.RoleName - return nil -} diff --git a/api/v1/datadog/model_aws_account_list_response.go b/api/v1/datadog/model_aws_account_list_response.go deleted file mode 100644 index 65bd7c06618..00000000000 --- a/api/v1/datadog/model_aws_account_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSAccountListResponse List of enabled AWS accounts. -type AWSAccountListResponse struct { - // List of enabled AWS accounts. - Accounts []AWSAccount `json:"accounts,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{} -} - -// NewAWSAccountListResponse instantiates a new AWSAccountListResponse 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 NewAWSAccountListResponse() *AWSAccountListResponse { - this := AWSAccountListResponse{} - return &this -} - -// NewAWSAccountListResponseWithDefaults instantiates a new AWSAccountListResponse 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 NewAWSAccountListResponseWithDefaults() *AWSAccountListResponse { - this := AWSAccountListResponse{} - return &this -} - -// GetAccounts returns the Accounts field value if set, zero value otherwise. -func (o *AWSAccountListResponse) GetAccounts() []AWSAccount { - if o == nil || o.Accounts == nil { - var ret []AWSAccount - return ret - } - return o.Accounts -} - -// GetAccountsOk returns a tuple with the Accounts field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSAccountListResponse) GetAccountsOk() (*[]AWSAccount, bool) { - if o == nil || o.Accounts == nil { - return nil, false - } - return &o.Accounts, true -} - -// HasAccounts returns a boolean if a field has been set. -func (o *AWSAccountListResponse) HasAccounts() bool { - if o != nil && o.Accounts != nil { - return true - } - - return false -} - -// SetAccounts gets a reference to the given []AWSAccount and assigns it to the Accounts field. -func (o *AWSAccountListResponse) SetAccounts(v []AWSAccount) { - o.Accounts = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSAccountListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Accounts != nil { - toSerialize["accounts"] = o.Accounts - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSAccountListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Accounts []AWSAccount `json:"accounts,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Accounts = all.Accounts - return nil -} diff --git a/api/v1/datadog/model_aws_logs_async_error.go b/api/v1/datadog/model_aws_logs_async_error.go deleted file mode 100644 index e766a09f7f1..00000000000 --- a/api/v1/datadog/model_aws_logs_async_error.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSLogsAsyncError Description of errors. -type AWSLogsAsyncError struct { - // Code properties - Code *string `json:"code,omitempty"` - // Message content. - Message *string `json:"message,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{} -} - -// NewAWSLogsAsyncError instantiates a new AWSLogsAsyncError 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 NewAWSLogsAsyncError() *AWSLogsAsyncError { - this := AWSLogsAsyncError{} - return &this -} - -// NewAWSLogsAsyncErrorWithDefaults instantiates a new AWSLogsAsyncError 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 NewAWSLogsAsyncErrorWithDefaults() *AWSLogsAsyncError { - this := AWSLogsAsyncError{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *AWSLogsAsyncError) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsAsyncError) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *AWSLogsAsyncError) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *AWSLogsAsyncError) SetCode(v string) { - o.Code = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *AWSLogsAsyncError) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsAsyncError) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *AWSLogsAsyncError) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *AWSLogsAsyncError) SetMessage(v string) { - o.Message = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSLogsAsyncError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSLogsAsyncError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_aws_logs_async_response.go b/api/v1/datadog/model_aws_logs_async_response.go deleted file mode 100644 index df6090401b0..00000000000 --- a/api/v1/datadog/model_aws_logs_async_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSLogsAsyncResponse A list of all Datadog-AWS logs integrations available in your Datadog organization. -type AWSLogsAsyncResponse struct { - // List of errors. - Errors []AWSLogsAsyncError `json:"errors,omitempty"` - // Status of the properties. - Status *string `json:"status,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{} -} - -// NewAWSLogsAsyncResponse instantiates a new AWSLogsAsyncResponse 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 NewAWSLogsAsyncResponse() *AWSLogsAsyncResponse { - this := AWSLogsAsyncResponse{} - return &this -} - -// NewAWSLogsAsyncResponseWithDefaults instantiates a new AWSLogsAsyncResponse 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 NewAWSLogsAsyncResponseWithDefaults() *AWSLogsAsyncResponse { - this := AWSLogsAsyncResponse{} - return &this -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *AWSLogsAsyncResponse) GetErrors() []AWSLogsAsyncError { - if o == nil || o.Errors == nil { - var ret []AWSLogsAsyncError - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsAsyncResponse) GetErrorsOk() (*[]AWSLogsAsyncError, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *AWSLogsAsyncResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []AWSLogsAsyncError and assigns it to the Errors field. -func (o *AWSLogsAsyncResponse) SetErrors(v []AWSLogsAsyncError) { - o.Errors = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *AWSLogsAsyncResponse) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsAsyncResponse) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *AWSLogsAsyncResponse) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *AWSLogsAsyncResponse) SetStatus(v string) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSLogsAsyncResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSLogsAsyncResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Errors []AWSLogsAsyncError `json:"errors,omitempty"` - Status *string `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Errors = all.Errors - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_aws_logs_lambda.go b/api/v1/datadog/model_aws_logs_lambda.go deleted file mode 100644 index dc81fed7218..00000000000 --- a/api/v1/datadog/model_aws_logs_lambda.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSLogsLambda Description of the Lambdas. -type AWSLogsLambda struct { - // Available ARN IDs. - Arn *string `json:"arn,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{} -} - -// NewAWSLogsLambda instantiates a new AWSLogsLambda 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 NewAWSLogsLambda() *AWSLogsLambda { - this := AWSLogsLambda{} - return &this -} - -// NewAWSLogsLambdaWithDefaults instantiates a new AWSLogsLambda 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 NewAWSLogsLambdaWithDefaults() *AWSLogsLambda { - this := AWSLogsLambda{} - return &this -} - -// GetArn returns the Arn field value if set, zero value otherwise. -func (o *AWSLogsLambda) GetArn() string { - if o == nil || o.Arn == nil { - var ret string - return ret - } - return *o.Arn -} - -// GetArnOk returns a tuple with the Arn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsLambda) GetArnOk() (*string, bool) { - if o == nil || o.Arn == nil { - return nil, false - } - return o.Arn, true -} - -// HasArn returns a boolean if a field has been set. -func (o *AWSLogsLambda) HasArn() bool { - if o != nil && o.Arn != nil { - return true - } - - return false -} - -// SetArn gets a reference to the given string and assigns it to the Arn field. -func (o *AWSLogsLambda) SetArn(v string) { - o.Arn = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSLogsLambda) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Arn != nil { - toSerialize["arn"] = o.Arn - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSLogsLambda) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Arn *string `json:"arn,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Arn = all.Arn - return nil -} diff --git a/api/v1/datadog/model_aws_logs_list_response.go b/api/v1/datadog/model_aws_logs_list_response.go deleted file mode 100644 index f763afea567..00000000000 --- a/api/v1/datadog/model_aws_logs_list_response.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSLogsListResponse A list of all Datadog-AWS logs integrations available in your Datadog organization. -type AWSLogsListResponse struct { - // Your AWS Account ID without dashes. - AccountId *string `json:"account_id,omitempty"` - // List of ARNs configured in your Datadog account. - Lambdas []AWSLogsLambda `json:"lambdas,omitempty"` - // Array of services IDs. - Services []string `json:"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{} -} - -// NewAWSLogsListResponse instantiates a new AWSLogsListResponse 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 NewAWSLogsListResponse() *AWSLogsListResponse { - this := AWSLogsListResponse{} - return &this -} - -// NewAWSLogsListResponseWithDefaults instantiates a new AWSLogsListResponse 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 NewAWSLogsListResponseWithDefaults() *AWSLogsListResponse { - this := AWSLogsListResponse{} - return &this -} - -// GetAccountId returns the AccountId field value if set, zero value otherwise. -func (o *AWSLogsListResponse) GetAccountId() string { - if o == nil || o.AccountId == nil { - var ret string - return ret - } - return *o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsListResponse) GetAccountIdOk() (*string, bool) { - if o == nil || o.AccountId == nil { - return nil, false - } - return o.AccountId, true -} - -// HasAccountId returns a boolean if a field has been set. -func (o *AWSLogsListResponse) HasAccountId() bool { - if o != nil && o.AccountId != nil { - return true - } - - return false -} - -// SetAccountId gets a reference to the given string and assigns it to the AccountId field. -func (o *AWSLogsListResponse) SetAccountId(v string) { - o.AccountId = &v -} - -// GetLambdas returns the Lambdas field value if set, zero value otherwise. -func (o *AWSLogsListResponse) GetLambdas() []AWSLogsLambda { - if o == nil || o.Lambdas == nil { - var ret []AWSLogsLambda - return ret - } - return o.Lambdas -} - -// GetLambdasOk returns a tuple with the Lambdas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsListResponse) GetLambdasOk() (*[]AWSLogsLambda, bool) { - if o == nil || o.Lambdas == nil { - return nil, false - } - return &o.Lambdas, true -} - -// HasLambdas returns a boolean if a field has been set. -func (o *AWSLogsListResponse) HasLambdas() bool { - if o != nil && o.Lambdas != nil { - return true - } - - return false -} - -// SetLambdas gets a reference to the given []AWSLogsLambda and assigns it to the Lambdas field. -func (o *AWSLogsListResponse) SetLambdas(v []AWSLogsLambda) { - o.Lambdas = v -} - -// GetServices returns the Services field value if set, zero value otherwise. -func (o *AWSLogsListResponse) 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 *AWSLogsListResponse) 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 *AWSLogsListResponse) HasServices() bool { - if o != nil && o.Services != nil { - return true - } - - return false -} - -// SetServices gets a reference to the given []string and assigns it to the Services field. -func (o *AWSLogsListResponse) SetServices(v []string) { - o.Services = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSLogsListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AccountId != nil { - toSerialize["account_id"] = o.AccountId - } - if o.Lambdas != nil { - toSerialize["lambdas"] = o.Lambdas - } - if o.Services != nil { - toSerialize["services"] = o.Services - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSLogsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AccountId *string `json:"account_id,omitempty"` - Lambdas []AWSLogsLambda `json:"lambdas,omitempty"` - Services []string `json:"services,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccountId = all.AccountId - o.Lambdas = all.Lambdas - o.Services = all.Services - return nil -} diff --git a/api/v1/datadog/model_aws_logs_list_services_response.go b/api/v1/datadog/model_aws_logs_list_services_response.go deleted file mode 100644 index 8583788ee71..00000000000 --- a/api/v1/datadog/model_aws_logs_list_services_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSLogsListServicesResponse The list of current AWS services for which Datadog offers automatic log collection. -type AWSLogsListServicesResponse struct { - // Key value in returned object. - Id *string `json:"id,omitempty"` - // Name of service available for configuration with Datadog logs. - Label *string `json:"label,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{} -} - -// NewAWSLogsListServicesResponse instantiates a new AWSLogsListServicesResponse 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 NewAWSLogsListServicesResponse() *AWSLogsListServicesResponse { - this := AWSLogsListServicesResponse{} - return &this -} - -// NewAWSLogsListServicesResponseWithDefaults instantiates a new AWSLogsListServicesResponse 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 NewAWSLogsListServicesResponseWithDefaults() *AWSLogsListServicesResponse { - this := AWSLogsListServicesResponse{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *AWSLogsListServicesResponse) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsListServicesResponse) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *AWSLogsListServicesResponse) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *AWSLogsListServicesResponse) SetId(v string) { - o.Id = &v -} - -// GetLabel returns the Label field value if set, zero value otherwise. -func (o *AWSLogsListServicesResponse) GetLabel() string { - if o == nil || o.Label == nil { - var ret string - return ret - } - return *o.Label -} - -// GetLabelOk returns a tuple with the Label field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSLogsListServicesResponse) GetLabelOk() (*string, bool) { - if o == nil || o.Label == nil { - return nil, false - } - return o.Label, true -} - -// HasLabel returns a boolean if a field has been set. -func (o *AWSLogsListServicesResponse) HasLabel() bool { - if o != nil && o.Label != nil { - return true - } - - return false -} - -// SetLabel gets a reference to the given string and assigns it to the Label field. -func (o *AWSLogsListServicesResponse) SetLabel(v string) { - o.Label = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSLogsListServicesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Label != nil { - toSerialize["label"] = o.Label - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSLogsListServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Label *string `json:"label,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Label = all.Label - return nil -} diff --git a/api/v1/datadog/model_aws_logs_services_request.go b/api/v1/datadog/model_aws_logs_services_request.go deleted file mode 100644 index afb2e655728..00000000000 --- a/api/v1/datadog/model_aws_logs_services_request.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AWSLogsServicesRequest A list of current AWS services for which Datadog offers automatic log collection. -type AWSLogsServicesRequest struct { - // Your AWS Account ID without dashes. - AccountId string `json:"account_id"` - // Array of services IDs set to enable automatic log collection. Discover the list of available services with the get list of AWS log ready services API endpoint. - Services []string `json:"services"` - // 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{} -} - -// NewAWSLogsServicesRequest instantiates a new AWSLogsServicesRequest 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 NewAWSLogsServicesRequest(accountId string, services []string) *AWSLogsServicesRequest { - this := AWSLogsServicesRequest{} - this.AccountId = accountId - this.Services = services - return &this -} - -// NewAWSLogsServicesRequestWithDefaults instantiates a new AWSLogsServicesRequest 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 NewAWSLogsServicesRequestWithDefaults() *AWSLogsServicesRequest { - this := AWSLogsServicesRequest{} - return &this -} - -// GetAccountId returns the AccountId field value. -func (o *AWSLogsServicesRequest) GetAccountId() string { - if o == nil { - var ret string - return ret - } - return o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value -// and a boolean to check if the value has been set. -func (o *AWSLogsServicesRequest) GetAccountIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.AccountId, true -} - -// SetAccountId sets field value. -func (o *AWSLogsServicesRequest) SetAccountId(v string) { - o.AccountId = v -} - -// GetServices returns the Services field value. -func (o *AWSLogsServicesRequest) GetServices() []string { - if o == nil { - var ret []string - return ret - } - return o.Services -} - -// GetServicesOk returns a tuple with the Services field value -// and a boolean to check if the value has been set. -func (o *AWSLogsServicesRequest) GetServicesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Services, true -} - -// SetServices sets field value. -func (o *AWSLogsServicesRequest) SetServices(v []string) { - o.Services = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSLogsServicesRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["account_id"] = o.AccountId - toSerialize["services"] = o.Services - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSLogsServicesRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - AccountId *string `json:"account_id"` - Services *[]string `json:"services"` - }{} - all := struct { - AccountId string `json:"account_id"` - Services []string `json:"services"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccountId == nil { - return fmt.Errorf("Required field account_id missing") - } - if required.Services == nil { - return fmt.Errorf("Required field services missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccountId = all.AccountId - o.Services = all.Services - return nil -} diff --git a/api/v1/datadog/model_aws_namespace.go b/api/v1/datadog/model_aws_namespace.go deleted file mode 100644 index 7c7f2296693..00000000000 --- a/api/v1/datadog/model_aws_namespace.go +++ /dev/null @@ -1,119 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AWSNamespace The namespace associated with the tag filter entry. -type AWSNamespace string - -// List of AWSNamespace. -const ( - AWSNAMESPACE_ELB AWSNamespace = "elb" - AWSNAMESPACE_APPLICATION_ELB AWSNamespace = "application_elb" - AWSNAMESPACE_SQS AWSNamespace = "sqs" - AWSNAMESPACE_RDS AWSNamespace = "rds" - AWSNAMESPACE_CUSTOM AWSNamespace = "custom" - AWSNAMESPACE_NETWORK_ELB AWSNamespace = "network_elb" - AWSNAMESPACE_LAMBDA AWSNamespace = "lambda" -) - -var allowedAWSNamespaceEnumValues = []AWSNamespace{ - AWSNAMESPACE_ELB, - AWSNAMESPACE_APPLICATION_ELB, - AWSNAMESPACE_SQS, - AWSNAMESPACE_RDS, - AWSNAMESPACE_CUSTOM, - AWSNAMESPACE_NETWORK_ELB, - AWSNAMESPACE_LAMBDA, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AWSNamespace) GetAllowedValues() []AWSNamespace { - return allowedAWSNamespaceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AWSNamespace) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AWSNamespace(value) - return nil -} - -// NewAWSNamespaceFromValue returns a pointer to a valid AWSNamespace -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAWSNamespaceFromValue(v string) (*AWSNamespace, error) { - ev := AWSNamespace(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AWSNamespace: valid values are %v", v, allowedAWSNamespaceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AWSNamespace) IsValid() bool { - for _, existing := range allowedAWSNamespaceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AWSNamespace value. -func (v AWSNamespace) Ptr() *AWSNamespace { - return &v -} - -// NullableAWSNamespace handles when a null is used for AWSNamespace. -type NullableAWSNamespace struct { - value *AWSNamespace - isSet bool -} - -// Get returns the associated value. -func (v NullableAWSNamespace) Get() *AWSNamespace { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAWSNamespace) Set(val *AWSNamespace) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAWSNamespace) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAWSNamespace) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAWSNamespace initializes the struct as if Set has been called. -func NewNullableAWSNamespace(val *AWSNamespace) *NullableAWSNamespace { - return &NullableAWSNamespace{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAWSNamespace) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAWSNamespace) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_aws_tag_filter.go b/api/v1/datadog/model_aws_tag_filter.go deleted file mode 100644 index 4eda5ed3bdb..00000000000 --- a/api/v1/datadog/model_aws_tag_filter.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSTagFilter A tag filter. -type AWSTagFilter struct { - // The namespace associated with the tag filter entry. - Namespace *AWSNamespace `json:"namespace,omitempty"` - // The tag filter string. - TagFilterStr *string `json:"tag_filter_str,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{} -} - -// NewAWSTagFilter instantiates a new AWSTagFilter 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 NewAWSTagFilter() *AWSTagFilter { - this := AWSTagFilter{} - return &this -} - -// NewAWSTagFilterWithDefaults instantiates a new AWSTagFilter 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 NewAWSTagFilterWithDefaults() *AWSTagFilter { - this := AWSTagFilter{} - return &this -} - -// GetNamespace returns the Namespace field value if set, zero value otherwise. -func (o *AWSTagFilter) GetNamespace() AWSNamespace { - if o == nil || o.Namespace == nil { - var ret AWSNamespace - 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 *AWSTagFilter) GetNamespaceOk() (*AWSNamespace, 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 *AWSTagFilter) HasNamespace() bool { - if o != nil && o.Namespace != nil { - return true - } - - return false -} - -// SetNamespace gets a reference to the given AWSNamespace and assigns it to the Namespace field. -func (o *AWSTagFilter) SetNamespace(v AWSNamespace) { - o.Namespace = &v -} - -// GetTagFilterStr returns the TagFilterStr field value if set, zero value otherwise. -func (o *AWSTagFilter) GetTagFilterStr() string { - if o == nil || o.TagFilterStr == nil { - var ret string - return ret - } - return *o.TagFilterStr -} - -// GetTagFilterStrOk returns a tuple with the TagFilterStr field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSTagFilter) GetTagFilterStrOk() (*string, bool) { - if o == nil || o.TagFilterStr == nil { - return nil, false - } - return o.TagFilterStr, true -} - -// HasTagFilterStr returns a boolean if a field has been set. -func (o *AWSTagFilter) HasTagFilterStr() bool { - if o != nil && o.TagFilterStr != nil { - return true - } - - return false -} - -// SetTagFilterStr gets a reference to the given string and assigns it to the TagFilterStr field. -func (o *AWSTagFilter) SetTagFilterStr(v string) { - o.TagFilterStr = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSTagFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Namespace != nil { - toSerialize["namespace"] = o.Namespace - } - if o.TagFilterStr != nil { - toSerialize["tag_filter_str"] = o.TagFilterStr - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSTagFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Namespace *AWSNamespace `json:"namespace,omitempty"` - TagFilterStr *string `json:"tag_filter_str,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Namespace; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Namespace = all.Namespace - o.TagFilterStr = all.TagFilterStr - return nil -} diff --git a/api/v1/datadog/model_aws_tag_filter_create_request.go b/api/v1/datadog/model_aws_tag_filter_create_request.go deleted file mode 100644 index f82776ae695..00000000000 --- a/api/v1/datadog/model_aws_tag_filter_create_request.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSTagFilterCreateRequest The objects used to set an AWS tag filter. -type AWSTagFilterCreateRequest struct { - // Your AWS Account ID without dashes. - AccountId *string `json:"account_id,omitempty"` - // The namespace associated with the tag filter entry. - Namespace *AWSNamespace `json:"namespace,omitempty"` - // The tag filter string. - TagFilterStr *string `json:"tag_filter_str,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{} -} - -// NewAWSTagFilterCreateRequest instantiates a new AWSTagFilterCreateRequest 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 NewAWSTagFilterCreateRequest() *AWSTagFilterCreateRequest { - this := AWSTagFilterCreateRequest{} - return &this -} - -// NewAWSTagFilterCreateRequestWithDefaults instantiates a new AWSTagFilterCreateRequest 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 NewAWSTagFilterCreateRequestWithDefaults() *AWSTagFilterCreateRequest { - this := AWSTagFilterCreateRequest{} - return &this -} - -// GetAccountId returns the AccountId field value if set, zero value otherwise. -func (o *AWSTagFilterCreateRequest) GetAccountId() string { - if o == nil || o.AccountId == nil { - var ret string - return ret - } - return *o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSTagFilterCreateRequest) GetAccountIdOk() (*string, bool) { - if o == nil || o.AccountId == nil { - return nil, false - } - return o.AccountId, true -} - -// HasAccountId returns a boolean if a field has been set. -func (o *AWSTagFilterCreateRequest) HasAccountId() bool { - if o != nil && o.AccountId != nil { - return true - } - - return false -} - -// SetAccountId gets a reference to the given string and assigns it to the AccountId field. -func (o *AWSTagFilterCreateRequest) SetAccountId(v string) { - o.AccountId = &v -} - -// GetNamespace returns the Namespace field value if set, zero value otherwise. -func (o *AWSTagFilterCreateRequest) GetNamespace() AWSNamespace { - if o == nil || o.Namespace == nil { - var ret AWSNamespace - 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 *AWSTagFilterCreateRequest) GetNamespaceOk() (*AWSNamespace, 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 *AWSTagFilterCreateRequest) HasNamespace() bool { - if o != nil && o.Namespace != nil { - return true - } - - return false -} - -// SetNamespace gets a reference to the given AWSNamespace and assigns it to the Namespace field. -func (o *AWSTagFilterCreateRequest) SetNamespace(v AWSNamespace) { - o.Namespace = &v -} - -// GetTagFilterStr returns the TagFilterStr field value if set, zero value otherwise. -func (o *AWSTagFilterCreateRequest) GetTagFilterStr() string { - if o == nil || o.TagFilterStr == nil { - var ret string - return ret - } - return *o.TagFilterStr -} - -// GetTagFilterStrOk returns a tuple with the TagFilterStr field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSTagFilterCreateRequest) GetTagFilterStrOk() (*string, bool) { - if o == nil || o.TagFilterStr == nil { - return nil, false - } - return o.TagFilterStr, true -} - -// HasTagFilterStr returns a boolean if a field has been set. -func (o *AWSTagFilterCreateRequest) HasTagFilterStr() bool { - if o != nil && o.TagFilterStr != nil { - return true - } - - return false -} - -// SetTagFilterStr gets a reference to the given string and assigns it to the TagFilterStr field. -func (o *AWSTagFilterCreateRequest) SetTagFilterStr(v string) { - o.TagFilterStr = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSTagFilterCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AccountId != nil { - toSerialize["account_id"] = o.AccountId - } - if o.Namespace != nil { - toSerialize["namespace"] = o.Namespace - } - if o.TagFilterStr != nil { - toSerialize["tag_filter_str"] = o.TagFilterStr - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSTagFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AccountId *string `json:"account_id,omitempty"` - Namespace *AWSNamespace `json:"namespace,omitempty"` - TagFilterStr *string `json:"tag_filter_str,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Namespace; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccountId = all.AccountId - o.Namespace = all.Namespace - o.TagFilterStr = all.TagFilterStr - return nil -} diff --git a/api/v1/datadog/model_aws_tag_filter_delete_request.go b/api/v1/datadog/model_aws_tag_filter_delete_request.go deleted file mode 100644 index b69d463d48c..00000000000 --- a/api/v1/datadog/model_aws_tag_filter_delete_request.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSTagFilterDeleteRequest The objects used to delete an AWS tag filter entry. -type AWSTagFilterDeleteRequest struct { - // The unique identifier of your AWS account. - AccountId *string `json:"account_id,omitempty"` - // The namespace associated with the tag filter entry. - Namespace *AWSNamespace `json:"namespace,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{} -} - -// NewAWSTagFilterDeleteRequest instantiates a new AWSTagFilterDeleteRequest 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 NewAWSTagFilterDeleteRequest() *AWSTagFilterDeleteRequest { - this := AWSTagFilterDeleteRequest{} - return &this -} - -// NewAWSTagFilterDeleteRequestWithDefaults instantiates a new AWSTagFilterDeleteRequest 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 NewAWSTagFilterDeleteRequestWithDefaults() *AWSTagFilterDeleteRequest { - this := AWSTagFilterDeleteRequest{} - return &this -} - -// GetAccountId returns the AccountId field value if set, zero value otherwise. -func (o *AWSTagFilterDeleteRequest) GetAccountId() string { - if o == nil || o.AccountId == nil { - var ret string - return ret - } - return *o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSTagFilterDeleteRequest) GetAccountIdOk() (*string, bool) { - if o == nil || o.AccountId == nil { - return nil, false - } - return o.AccountId, true -} - -// HasAccountId returns a boolean if a field has been set. -func (o *AWSTagFilterDeleteRequest) HasAccountId() bool { - if o != nil && o.AccountId != nil { - return true - } - - return false -} - -// SetAccountId gets a reference to the given string and assigns it to the AccountId field. -func (o *AWSTagFilterDeleteRequest) SetAccountId(v string) { - o.AccountId = &v -} - -// GetNamespace returns the Namespace field value if set, zero value otherwise. -func (o *AWSTagFilterDeleteRequest) GetNamespace() AWSNamespace { - if o == nil || o.Namespace == nil { - var ret AWSNamespace - 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 *AWSTagFilterDeleteRequest) GetNamespaceOk() (*AWSNamespace, 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 *AWSTagFilterDeleteRequest) HasNamespace() bool { - if o != nil && o.Namespace != nil { - return true - } - - return false -} - -// SetNamespace gets a reference to the given AWSNamespace and assigns it to the Namespace field. -func (o *AWSTagFilterDeleteRequest) SetNamespace(v AWSNamespace) { - o.Namespace = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSTagFilterDeleteRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AccountId != nil { - toSerialize["account_id"] = o.AccountId - } - if o.Namespace != nil { - toSerialize["namespace"] = o.Namespace - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSTagFilterDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AccountId *string `json:"account_id,omitempty"` - Namespace *AWSNamespace `json:"namespace,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Namespace; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccountId = all.AccountId - o.Namespace = all.Namespace - return nil -} diff --git a/api/v1/datadog/model_aws_tag_filter_list_response.go b/api/v1/datadog/model_aws_tag_filter_list_response.go deleted file mode 100644 index 4a632db9ce2..00000000000 --- a/api/v1/datadog/model_aws_tag_filter_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AWSTagFilterListResponse An array of tag filter rules by `namespace` and tag filter string. -type AWSTagFilterListResponse struct { - // An array of tag filters. - Filters []AWSTagFilter `json:"filters,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{} -} - -// NewAWSTagFilterListResponse instantiates a new AWSTagFilterListResponse 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 NewAWSTagFilterListResponse() *AWSTagFilterListResponse { - this := AWSTagFilterListResponse{} - return &this -} - -// NewAWSTagFilterListResponseWithDefaults instantiates a new AWSTagFilterListResponse 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 NewAWSTagFilterListResponseWithDefaults() *AWSTagFilterListResponse { - this := AWSTagFilterListResponse{} - return &this -} - -// GetFilters returns the Filters field value if set, zero value otherwise. -func (o *AWSTagFilterListResponse) GetFilters() []AWSTagFilter { - if o == nil || o.Filters == nil { - var ret []AWSTagFilter - return ret - } - return o.Filters -} - -// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AWSTagFilterListResponse) GetFiltersOk() (*[]AWSTagFilter, bool) { - if o == nil || o.Filters == nil { - return nil, false - } - return &o.Filters, true -} - -// HasFilters returns a boolean if a field has been set. -func (o *AWSTagFilterListResponse) HasFilters() bool { - if o != nil && o.Filters != nil { - return true - } - - return false -} - -// SetFilters gets a reference to the given []AWSTagFilter and assigns it to the Filters field. -func (o *AWSTagFilterListResponse) SetFilters(v []AWSTagFilter) { - o.Filters = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AWSTagFilterListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filters != nil { - toSerialize["filters"] = o.Filters - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AWSTagFilterListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filters []AWSTagFilter `json:"filters,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Filters = all.Filters - return nil -} diff --git a/api/v1/datadog/model_azure_account.go b/api/v1/datadog/model_azure_account.go deleted file mode 100644 index 79d4a37eb67..00000000000 --- a/api/v1/datadog/model_azure_account.go +++ /dev/null @@ -1,376 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AzureAccount Datadog-Azure integrations configured for your organization. -type AzureAccount struct { - // Silence monitors for expected Azure VM shutdowns. - Automute *bool `json:"automute,omitempty"` - // Your Azure web application ID. - ClientId *string `json:"client_id,omitempty"` - // Your Azure web application secret key. - ClientSecret *string `json:"client_secret,omitempty"` - // Errors in your configuration. - Errors []string `json:"errors,omitempty"` - // Limit the Azure instances that are pulled into Datadog by using tags. - // Only hosts that match one of the defined tags are imported into Datadog. - HostFilters *string `json:"host_filters,omitempty"` - // Your New Azure web application ID. - NewClientId *string `json:"new_client_id,omitempty"` - // Your New Azure Active Directory ID. - NewTenantName *string `json:"new_tenant_name,omitempty"` - // Your Azure Active Directory ID. - TenantName *string `json:"tenant_name,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{} -} - -// NewAzureAccount instantiates a new AzureAccount 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 NewAzureAccount() *AzureAccount { - this := AzureAccount{} - return &this -} - -// NewAzureAccountWithDefaults instantiates a new AzureAccount 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 NewAzureAccountWithDefaults() *AzureAccount { - this := AzureAccount{} - return &this -} - -// GetAutomute returns the Automute field value if set, zero value otherwise. -func (o *AzureAccount) GetAutomute() bool { - if o == nil || o.Automute == nil { - var ret bool - return ret - } - return *o.Automute -} - -// GetAutomuteOk returns a tuple with the Automute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetAutomuteOk() (*bool, bool) { - if o == nil || o.Automute == nil { - return nil, false - } - return o.Automute, true -} - -// HasAutomute returns a boolean if a field has been set. -func (o *AzureAccount) HasAutomute() bool { - if o != nil && o.Automute != nil { - return true - } - - return false -} - -// SetAutomute gets a reference to the given bool and assigns it to the Automute field. -func (o *AzureAccount) SetAutomute(v bool) { - o.Automute = &v -} - -// GetClientId returns the ClientId field value if set, zero value otherwise. -func (o *AzureAccount) GetClientId() string { - if o == nil || o.ClientId == nil { - var ret string - return ret - } - return *o.ClientId -} - -// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetClientIdOk() (*string, bool) { - if o == nil || o.ClientId == nil { - return nil, false - } - return o.ClientId, true -} - -// HasClientId returns a boolean if a field has been set. -func (o *AzureAccount) HasClientId() bool { - if o != nil && o.ClientId != nil { - return true - } - - return false -} - -// SetClientId gets a reference to the given string and assigns it to the ClientId field. -func (o *AzureAccount) SetClientId(v string) { - o.ClientId = &v -} - -// GetClientSecret returns the ClientSecret field value if set, zero value otherwise. -func (o *AzureAccount) GetClientSecret() string { - if o == nil || o.ClientSecret == nil { - var ret string - return ret - } - return *o.ClientSecret -} - -// GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetClientSecretOk() (*string, bool) { - if o == nil || o.ClientSecret == nil { - return nil, false - } - return o.ClientSecret, true -} - -// HasClientSecret returns a boolean if a field has been set. -func (o *AzureAccount) HasClientSecret() bool { - if o != nil && o.ClientSecret != nil { - return true - } - - return false -} - -// SetClientSecret gets a reference to the given string and assigns it to the ClientSecret field. -func (o *AzureAccount) SetClientSecret(v string) { - o.ClientSecret = &v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *AzureAccount) GetErrors() []string { - if o == nil || o.Errors == nil { - var ret []string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetErrorsOk() (*[]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *AzureAccount) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []string and assigns it to the Errors field. -func (o *AzureAccount) SetErrors(v []string) { - o.Errors = v -} - -// GetHostFilters returns the HostFilters field value if set, zero value otherwise. -func (o *AzureAccount) GetHostFilters() string { - if o == nil || o.HostFilters == nil { - var ret string - return ret - } - return *o.HostFilters -} - -// GetHostFiltersOk returns a tuple with the HostFilters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetHostFiltersOk() (*string, bool) { - if o == nil || o.HostFilters == nil { - return nil, false - } - return o.HostFilters, true -} - -// HasHostFilters returns a boolean if a field has been set. -func (o *AzureAccount) HasHostFilters() bool { - if o != nil && o.HostFilters != nil { - return true - } - - return false -} - -// SetHostFilters gets a reference to the given string and assigns it to the HostFilters field. -func (o *AzureAccount) SetHostFilters(v string) { - o.HostFilters = &v -} - -// GetNewClientId returns the NewClientId field value if set, zero value otherwise. -func (o *AzureAccount) GetNewClientId() string { - if o == nil || o.NewClientId == nil { - var ret string - return ret - } - return *o.NewClientId -} - -// GetNewClientIdOk returns a tuple with the NewClientId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetNewClientIdOk() (*string, bool) { - if o == nil || o.NewClientId == nil { - return nil, false - } - return o.NewClientId, true -} - -// HasNewClientId returns a boolean if a field has been set. -func (o *AzureAccount) HasNewClientId() bool { - if o != nil && o.NewClientId != nil { - return true - } - - return false -} - -// SetNewClientId gets a reference to the given string and assigns it to the NewClientId field. -func (o *AzureAccount) SetNewClientId(v string) { - o.NewClientId = &v -} - -// GetNewTenantName returns the NewTenantName field value if set, zero value otherwise. -func (o *AzureAccount) GetNewTenantName() string { - if o == nil || o.NewTenantName == nil { - var ret string - return ret - } - return *o.NewTenantName -} - -// GetNewTenantNameOk returns a tuple with the NewTenantName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetNewTenantNameOk() (*string, bool) { - if o == nil || o.NewTenantName == nil { - return nil, false - } - return o.NewTenantName, true -} - -// HasNewTenantName returns a boolean if a field has been set. -func (o *AzureAccount) HasNewTenantName() bool { - if o != nil && o.NewTenantName != nil { - return true - } - - return false -} - -// SetNewTenantName gets a reference to the given string and assigns it to the NewTenantName field. -func (o *AzureAccount) SetNewTenantName(v string) { - o.NewTenantName = &v -} - -// GetTenantName returns the TenantName field value if set, zero value otherwise. -func (o *AzureAccount) GetTenantName() string { - if o == nil || o.TenantName == nil { - var ret string - return ret - } - return *o.TenantName -} - -// GetTenantNameOk returns a tuple with the TenantName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AzureAccount) GetTenantNameOk() (*string, bool) { - if o == nil || o.TenantName == nil { - return nil, false - } - return o.TenantName, true -} - -// HasTenantName returns a boolean if a field has been set. -func (o *AzureAccount) HasTenantName() bool { - if o != nil && o.TenantName != nil { - return true - } - - return false -} - -// SetTenantName gets a reference to the given string and assigns it to the TenantName field. -func (o *AzureAccount) SetTenantName(v string) { - o.TenantName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AzureAccount) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Automute != nil { - toSerialize["automute"] = o.Automute - } - if o.ClientId != nil { - toSerialize["client_id"] = o.ClientId - } - if o.ClientSecret != nil { - toSerialize["client_secret"] = o.ClientSecret - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - if o.HostFilters != nil { - toSerialize["host_filters"] = o.HostFilters - } - if o.NewClientId != nil { - toSerialize["new_client_id"] = o.NewClientId - } - if o.NewTenantName != nil { - toSerialize["new_tenant_name"] = o.NewTenantName - } - if o.TenantName != nil { - toSerialize["tenant_name"] = o.TenantName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AzureAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Automute *bool `json:"automute,omitempty"` - ClientId *string `json:"client_id,omitempty"` - ClientSecret *string `json:"client_secret,omitempty"` - Errors []string `json:"errors,omitempty"` - HostFilters *string `json:"host_filters,omitempty"` - NewClientId *string `json:"new_client_id,omitempty"` - NewTenantName *string `json:"new_tenant_name,omitempty"` - TenantName *string `json:"tenant_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Automute = all.Automute - o.ClientId = all.ClientId - o.ClientSecret = all.ClientSecret - o.Errors = all.Errors - o.HostFilters = all.HostFilters - o.NewClientId = all.NewClientId - o.NewTenantName = all.NewTenantName - o.TenantName = all.TenantName - return nil -} diff --git a/api/v1/datadog/model_cancel_downtimes_by_scope_request.go b/api/v1/datadog/model_cancel_downtimes_by_scope_request.go deleted file mode 100644 index c45b0a4340b..00000000000 --- a/api/v1/datadog/model_cancel_downtimes_by_scope_request.go +++ /dev/null @@ -1,105 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CancelDowntimesByScopeRequest Cancel downtimes according to scope. -type CancelDowntimesByScopeRequest struct { - // The scope(s) to which the downtime applies. For example, `host:app2`. - // Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. - // The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`). - Scope string `json:"scope"` - // 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{} -} - -// NewCancelDowntimesByScopeRequest instantiates a new CancelDowntimesByScopeRequest 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 NewCancelDowntimesByScopeRequest(scope string) *CancelDowntimesByScopeRequest { - this := CancelDowntimesByScopeRequest{} - this.Scope = scope - return &this -} - -// NewCancelDowntimesByScopeRequestWithDefaults instantiates a new CancelDowntimesByScopeRequest 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 NewCancelDowntimesByScopeRequestWithDefaults() *CancelDowntimesByScopeRequest { - this := CancelDowntimesByScopeRequest{} - return &this -} - -// GetScope returns the Scope field value. -func (o *CancelDowntimesByScopeRequest) GetScope() string { - if o == nil { - var ret string - return ret - } - return o.Scope -} - -// GetScopeOk returns a tuple with the Scope field value -// and a boolean to check if the value has been set. -func (o *CancelDowntimesByScopeRequest) GetScopeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Scope, true -} - -// SetScope sets field value. -func (o *CancelDowntimesByScopeRequest) SetScope(v string) { - o.Scope = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CancelDowntimesByScopeRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["scope"] = o.Scope - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CancelDowntimesByScopeRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Scope *string `json:"scope"` - }{} - all := struct { - Scope string `json:"scope"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Scope == nil { - return fmt.Errorf("Required field scope missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Scope = all.Scope - return nil -} diff --git a/api/v1/datadog/model_canceled_downtimes_ids.go b/api/v1/datadog/model_canceled_downtimes_ids.go deleted file mode 100644 index e95ce9baa4b..00000000000 --- a/api/v1/datadog/model_canceled_downtimes_ids.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CanceledDowntimesIds Object containing array of IDs of canceled downtimes. -type CanceledDowntimesIds struct { - // ID of downtimes that were canceled. - CancelledIds []int64 `json:"cancelled_ids,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{} -} - -// NewCanceledDowntimesIds instantiates a new CanceledDowntimesIds 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 NewCanceledDowntimesIds() *CanceledDowntimesIds { - this := CanceledDowntimesIds{} - return &this -} - -// NewCanceledDowntimesIdsWithDefaults instantiates a new CanceledDowntimesIds 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 NewCanceledDowntimesIdsWithDefaults() *CanceledDowntimesIds { - this := CanceledDowntimesIds{} - return &this -} - -// GetCancelledIds returns the CancelledIds field value if set, zero value otherwise. -func (o *CanceledDowntimesIds) GetCancelledIds() []int64 { - if o == nil || o.CancelledIds == nil { - var ret []int64 - return ret - } - return o.CancelledIds -} - -// GetCancelledIdsOk returns a tuple with the CancelledIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CanceledDowntimesIds) GetCancelledIdsOk() (*[]int64, bool) { - if o == nil || o.CancelledIds == nil { - return nil, false - } - return &o.CancelledIds, true -} - -// HasCancelledIds returns a boolean if a field has been set. -func (o *CanceledDowntimesIds) HasCancelledIds() bool { - if o != nil && o.CancelledIds != nil { - return true - } - - return false -} - -// SetCancelledIds gets a reference to the given []int64 and assigns it to the CancelledIds field. -func (o *CanceledDowntimesIds) SetCancelledIds(v []int64) { - o.CancelledIds = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CanceledDowntimesIds) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CancelledIds != nil { - toSerialize["cancelled_ids"] = o.CancelledIds - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CanceledDowntimesIds) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CancelledIds []int64 `json:"cancelled_ids,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CancelledIds = all.CancelledIds - return nil -} diff --git a/api/v1/datadog/model_change_widget_definition.go b/api/v1/datadog/model_change_widget_definition.go deleted file mode 100644 index dc16bcb6cc0..00000000000 --- a/api/v1/datadog/model_change_widget_definition.go +++ /dev/null @@ -1,359 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ChangeWidgetDefinition The Change graph shows you the change in a value over the time period chosen. -type ChangeWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // Array of one request object to display in the widget. - // - // See the dedicated [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json) - // to learn how to build the `REQUEST_SCHEMA`. - Requests []ChangeWidgetRequest `json:"requests"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the change widget. - Type ChangeWidgetDefinitionType `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{} -} - -// NewChangeWidgetDefinition instantiates a new ChangeWidgetDefinition 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 NewChangeWidgetDefinition(requests []ChangeWidgetRequest, typeVar ChangeWidgetDefinitionType) *ChangeWidgetDefinition { - this := ChangeWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewChangeWidgetDefinitionWithDefaults instantiates a new ChangeWidgetDefinition 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 NewChangeWidgetDefinitionWithDefaults() *ChangeWidgetDefinition { - this := ChangeWidgetDefinition{} - var typeVar ChangeWidgetDefinitionType = CHANGEWIDGETDEFINITIONTYPE_CHANGE - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *ChangeWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *ChangeWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *ChangeWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetRequests returns the Requests field value. -func (o *ChangeWidgetDefinition) GetRequests() []ChangeWidgetRequest { - if o == nil { - var ret []ChangeWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *ChangeWidgetDefinition) GetRequestsOk() (*[]ChangeWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *ChangeWidgetDefinition) SetRequests(v []ChangeWidgetRequest) { - o.Requests = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *ChangeWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *ChangeWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *ChangeWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *ChangeWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *ChangeWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *ChangeWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *ChangeWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *ChangeWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *ChangeWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *ChangeWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *ChangeWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *ChangeWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *ChangeWidgetDefinition) GetType() ChangeWidgetDefinitionType { - if o == nil { - var ret ChangeWidgetDefinitionType - 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 *ChangeWidgetDefinition) GetTypeOk() (*ChangeWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ChangeWidgetDefinition) SetType(v ChangeWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ChangeWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - toSerialize["requests"] = o.Requests - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]ChangeWidgetRequest `json:"requests"` - Type *ChangeWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests []ChangeWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ChangeWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.Requests = all.Requests - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_change_widget_definition_type.go b/api/v1/datadog/model_change_widget_definition_type.go deleted file mode 100644 index 1c1af8f17f9..00000000000 --- a/api/v1/datadog/model_change_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ChangeWidgetDefinitionType Type of the change widget. -type ChangeWidgetDefinitionType string - -// List of ChangeWidgetDefinitionType. -const ( - CHANGEWIDGETDEFINITIONTYPE_CHANGE ChangeWidgetDefinitionType = "change" -) - -var allowedChangeWidgetDefinitionTypeEnumValues = []ChangeWidgetDefinitionType{ - CHANGEWIDGETDEFINITIONTYPE_CHANGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ChangeWidgetDefinitionType) GetAllowedValues() []ChangeWidgetDefinitionType { - return allowedChangeWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ChangeWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ChangeWidgetDefinitionType(value) - return nil -} - -// NewChangeWidgetDefinitionTypeFromValue returns a pointer to a valid ChangeWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewChangeWidgetDefinitionTypeFromValue(v string) (*ChangeWidgetDefinitionType, error) { - ev := ChangeWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ChangeWidgetDefinitionType: valid values are %v", v, allowedChangeWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ChangeWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedChangeWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ChangeWidgetDefinitionType value. -func (v ChangeWidgetDefinitionType) Ptr() *ChangeWidgetDefinitionType { - return &v -} - -// NullableChangeWidgetDefinitionType handles when a null is used for ChangeWidgetDefinitionType. -type NullableChangeWidgetDefinitionType struct { - value *ChangeWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableChangeWidgetDefinitionType) Get() *ChangeWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableChangeWidgetDefinitionType) Set(val *ChangeWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableChangeWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableChangeWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableChangeWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableChangeWidgetDefinitionType(val *ChangeWidgetDefinitionType) *NullableChangeWidgetDefinitionType { - return &NullableChangeWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableChangeWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableChangeWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_change_widget_request.go b/api/v1/datadog/model_change_widget_request.go deleted file mode 100644 index 68f6bd6c7f1..00000000000 --- a/api/v1/datadog/model_change_widget_request.go +++ /dev/null @@ -1,861 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ChangeWidgetRequest Updated change widget. -type ChangeWidgetRequest struct { - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // Show the absolute or the relative change. - ChangeType *WidgetChangeType `json:"change_type,omitempty"` - // Timeframe used for the change comparison. - CompareTo *WidgetCompareTo `json:"compare_to,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // Whether to show increase as good. - IncreaseGood *bool `json:"increase_good,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // What to order by. - OrderBy *WidgetOrderBy `json:"order_by,omitempty"` - // Widget sorting methods. - OrderDir *WidgetSort `json:"order_dir,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Query definition. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - // Whether to show the present value. - ShowPresent *bool `json:"show_present,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{} -} - -// NewChangeWidgetRequest instantiates a new ChangeWidgetRequest 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 NewChangeWidgetRequest() *ChangeWidgetRequest { - this := ChangeWidgetRequest{} - return &this -} - -// NewChangeWidgetRequestWithDefaults instantiates a new ChangeWidgetRequest 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 NewChangeWidgetRequestWithDefaults() *ChangeWidgetRequest { - this := ChangeWidgetRequest{} - return &this -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *ChangeWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetChangeType returns the ChangeType field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetChangeType() WidgetChangeType { - if o == nil || o.ChangeType == nil { - var ret WidgetChangeType - return ret - } - return *o.ChangeType -} - -// GetChangeTypeOk returns a tuple with the ChangeType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetChangeTypeOk() (*WidgetChangeType, bool) { - if o == nil || o.ChangeType == nil { - return nil, false - } - return o.ChangeType, true -} - -// HasChangeType returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasChangeType() bool { - if o != nil && o.ChangeType != nil { - return true - } - - return false -} - -// SetChangeType gets a reference to the given WidgetChangeType and assigns it to the ChangeType field. -func (o *ChangeWidgetRequest) SetChangeType(v WidgetChangeType) { - o.ChangeType = &v -} - -// GetCompareTo returns the CompareTo field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetCompareTo() WidgetCompareTo { - if o == nil || o.CompareTo == nil { - var ret WidgetCompareTo - return ret - } - return *o.CompareTo -} - -// GetCompareToOk returns a tuple with the CompareTo field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetCompareToOk() (*WidgetCompareTo, bool) { - if o == nil || o.CompareTo == nil { - return nil, false - } - return o.CompareTo, true -} - -// HasCompareTo returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasCompareTo() bool { - if o != nil && o.CompareTo != nil { - return true - } - - return false -} - -// SetCompareTo gets a reference to the given WidgetCompareTo and assigns it to the CompareTo field. -func (o *ChangeWidgetRequest) SetCompareTo(v WidgetCompareTo) { - o.CompareTo = &v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *ChangeWidgetRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *ChangeWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetIncreaseGood returns the IncreaseGood field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetIncreaseGood() bool { - if o == nil || o.IncreaseGood == nil { - var ret bool - return ret - } - return *o.IncreaseGood -} - -// GetIncreaseGoodOk returns a tuple with the IncreaseGood field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetIncreaseGoodOk() (*bool, bool) { - if o == nil || o.IncreaseGood == nil { - return nil, false - } - return o.IncreaseGood, true -} - -// HasIncreaseGood returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasIncreaseGood() bool { - if o != nil && o.IncreaseGood != nil { - return true - } - - return false -} - -// SetIncreaseGood gets a reference to the given bool and assigns it to the IncreaseGood field. -func (o *ChangeWidgetRequest) SetIncreaseGood(v bool) { - o.IncreaseGood = &v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *ChangeWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *ChangeWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetOrderBy returns the OrderBy field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetOrderBy() WidgetOrderBy { - if o == nil || o.OrderBy == nil { - var ret WidgetOrderBy - return ret - } - return *o.OrderBy -} - -// GetOrderByOk returns a tuple with the OrderBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetOrderByOk() (*WidgetOrderBy, bool) { - if o == nil || o.OrderBy == nil { - return nil, false - } - return o.OrderBy, true -} - -// HasOrderBy returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasOrderBy() bool { - if o != nil && o.OrderBy != nil { - return true - } - - return false -} - -// SetOrderBy gets a reference to the given WidgetOrderBy and assigns it to the OrderBy field. -func (o *ChangeWidgetRequest) SetOrderBy(v WidgetOrderBy) { - o.OrderBy = &v -} - -// GetOrderDir returns the OrderDir field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetOrderDir() WidgetSort { - if o == nil || o.OrderDir == nil { - var ret WidgetSort - return ret - } - return *o.OrderDir -} - -// GetOrderDirOk returns a tuple with the OrderDir field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetOrderDirOk() (*WidgetSort, bool) { - if o == nil || o.OrderDir == nil { - return nil, false - } - return o.OrderDir, true -} - -// HasOrderDir returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasOrderDir() bool { - if o != nil && o.OrderDir != nil { - return true - } - - return false -} - -// SetOrderDir gets a reference to the given WidgetSort and assigns it to the OrderDir field. -func (o *ChangeWidgetRequest) SetOrderDir(v WidgetSort) { - o.OrderDir = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *ChangeWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *ChangeWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *ChangeWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *ChangeWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *ChangeWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *ChangeWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *ChangeWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// GetShowPresent returns the ShowPresent field value if set, zero value otherwise. -func (o *ChangeWidgetRequest) GetShowPresent() bool { - if o == nil || o.ShowPresent == nil { - var ret bool - return ret - } - return *o.ShowPresent -} - -// GetShowPresentOk returns a tuple with the ShowPresent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChangeWidgetRequest) GetShowPresentOk() (*bool, bool) { - if o == nil || o.ShowPresent == nil { - return nil, false - } - return o.ShowPresent, true -} - -// HasShowPresent returns a boolean if a field has been set. -func (o *ChangeWidgetRequest) HasShowPresent() bool { - if o != nil && o.ShowPresent != nil { - return true - } - - return false -} - -// SetShowPresent gets a reference to the given bool and assigns it to the ShowPresent field. -func (o *ChangeWidgetRequest) SetShowPresent(v bool) { - o.ShowPresent = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ChangeWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.ChangeType != nil { - toSerialize["change_type"] = o.ChangeType - } - if o.CompareTo != nil { - toSerialize["compare_to"] = o.CompareTo - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.IncreaseGood != nil { - toSerialize["increase_good"] = o.IncreaseGood - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.OrderBy != nil { - toSerialize["order_by"] = o.OrderBy - } - if o.OrderDir != nil { - toSerialize["order_dir"] = o.OrderDir - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - if o.ShowPresent != nil { - toSerialize["show_present"] = o.ShowPresent - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ChangeWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - ChangeType *WidgetChangeType `json:"change_type,omitempty"` - CompareTo *WidgetCompareTo `json:"compare_to,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - Formulas []WidgetFormula `json:"formulas,omitempty"` - IncreaseGood *bool `json:"increase_good,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - OrderBy *WidgetOrderBy `json:"order_by,omitempty"` - OrderDir *WidgetSort `json:"order_dir,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - ShowPresent *bool `json:"show_present,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ChangeType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.CompareTo; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.OrderBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.OrderDir; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - o.ChangeType = all.ChangeType - o.CompareTo = all.CompareTo - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - o.Formulas = all.Formulas - o.IncreaseGood = all.IncreaseGood - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - o.OrderBy = all.OrderBy - o.OrderDir = all.OrderDir - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - o.ShowPresent = all.ShowPresent - return nil -} diff --git a/api/v1/datadog/model_check_can_delete_monitor_response.go b/api/v1/datadog/model_check_can_delete_monitor_response.go deleted file mode 100644 index f4d699b15b9..00000000000 --- a/api/v1/datadog/model_check_can_delete_monitor_response.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CheckCanDeleteMonitorResponse Response of monitor IDs that can or can't be safely deleted. -type CheckCanDeleteMonitorResponse struct { - // Wrapper object with the list of monitor IDs. - Data CheckCanDeleteMonitorResponseData `json:"data"` - // A mapping of Monitor ID to strings denoting where it's used. - Errors map[string][]string `json:"errors,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{} -} - -// NewCheckCanDeleteMonitorResponse instantiates a new CheckCanDeleteMonitorResponse 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 NewCheckCanDeleteMonitorResponse(data CheckCanDeleteMonitorResponseData) *CheckCanDeleteMonitorResponse { - this := CheckCanDeleteMonitorResponse{} - this.Data = data - return &this -} - -// NewCheckCanDeleteMonitorResponseWithDefaults instantiates a new CheckCanDeleteMonitorResponse 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 NewCheckCanDeleteMonitorResponseWithDefaults() *CheckCanDeleteMonitorResponse { - this := CheckCanDeleteMonitorResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *CheckCanDeleteMonitorResponse) GetData() CheckCanDeleteMonitorResponseData { - if o == nil { - var ret CheckCanDeleteMonitorResponseData - 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 *CheckCanDeleteMonitorResponse) GetDataOk() (*CheckCanDeleteMonitorResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *CheckCanDeleteMonitorResponse) SetData(v CheckCanDeleteMonitorResponseData) { - o.Data = v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *CheckCanDeleteMonitorResponse) GetErrors() map[string][]string { - if o == nil || o.Errors == nil { - var ret map[string][]string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckCanDeleteMonitorResponse) GetErrorsOk() (*map[string][]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *CheckCanDeleteMonitorResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given map[string][]string and assigns it to the Errors field. -func (o *CheckCanDeleteMonitorResponse) SetErrors(v map[string][]string) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CheckCanDeleteMonitorResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CheckCanDeleteMonitorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *CheckCanDeleteMonitorResponseData `json:"data"` - }{} - all := struct { - Data CheckCanDeleteMonitorResponseData `json:"data"` - Errors map[string][]string `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Errors = all.Errors - return nil -} diff --git a/api/v1/datadog/model_check_can_delete_monitor_response_data.go b/api/v1/datadog/model_check_can_delete_monitor_response_data.go deleted file mode 100644 index 3077013a2b8..00000000000 --- a/api/v1/datadog/model_check_can_delete_monitor_response_data.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CheckCanDeleteMonitorResponseData Wrapper object with the list of monitor IDs. -type CheckCanDeleteMonitorResponseData struct { - // An array of of Monitor IDs that can be safely deleted. - Ok []int64 `json:"ok,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{} -} - -// NewCheckCanDeleteMonitorResponseData instantiates a new CheckCanDeleteMonitorResponseData 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 NewCheckCanDeleteMonitorResponseData() *CheckCanDeleteMonitorResponseData { - this := CheckCanDeleteMonitorResponseData{} - return &this -} - -// NewCheckCanDeleteMonitorResponseDataWithDefaults instantiates a new CheckCanDeleteMonitorResponseData 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 NewCheckCanDeleteMonitorResponseDataWithDefaults() *CheckCanDeleteMonitorResponseData { - this := CheckCanDeleteMonitorResponseData{} - return &this -} - -// GetOk returns the Ok field value if set, zero value otherwise. -func (o *CheckCanDeleteMonitorResponseData) GetOk() []int64 { - if o == nil || o.Ok == nil { - var ret []int64 - return ret - } - return o.Ok -} - -// GetOkOk returns a tuple with the Ok field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckCanDeleteMonitorResponseData) GetOkOk() (*[]int64, bool) { - if o == nil || o.Ok == nil { - return nil, false - } - return &o.Ok, true -} - -// HasOk returns a boolean if a field has been set. -func (o *CheckCanDeleteMonitorResponseData) HasOk() bool { - if o != nil && o.Ok != nil { - return true - } - - return false -} - -// SetOk gets a reference to the given []int64 and assigns it to the Ok field. -func (o *CheckCanDeleteMonitorResponseData) SetOk(v []int64) { - o.Ok = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CheckCanDeleteMonitorResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Ok != nil { - toSerialize["ok"] = o.Ok - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CheckCanDeleteMonitorResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Ok []int64 `json:"ok,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Ok = all.Ok - return nil -} diff --git a/api/v1/datadog/model_check_can_delete_slo_response.go b/api/v1/datadog/model_check_can_delete_slo_response.go deleted file mode 100644 index 1db481b8e6e..00000000000 --- a/api/v1/datadog/model_check_can_delete_slo_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CheckCanDeleteSLOResponse A service level objective response containing the requested object. -type CheckCanDeleteSLOResponse struct { - // An array of service level objective objects. - Data *CheckCanDeleteSLOResponseData `json:"data,omitempty"` - // A mapping of SLO id to it's current usages. - Errors map[string]string `json:"errors,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{} -} - -// NewCheckCanDeleteSLOResponse instantiates a new CheckCanDeleteSLOResponse 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 NewCheckCanDeleteSLOResponse() *CheckCanDeleteSLOResponse { - this := CheckCanDeleteSLOResponse{} - return &this -} - -// NewCheckCanDeleteSLOResponseWithDefaults instantiates a new CheckCanDeleteSLOResponse 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 NewCheckCanDeleteSLOResponseWithDefaults() *CheckCanDeleteSLOResponse { - this := CheckCanDeleteSLOResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *CheckCanDeleteSLOResponse) GetData() CheckCanDeleteSLOResponseData { - if o == nil || o.Data == nil { - var ret CheckCanDeleteSLOResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckCanDeleteSLOResponse) GetDataOk() (*CheckCanDeleteSLOResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *CheckCanDeleteSLOResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given CheckCanDeleteSLOResponseData and assigns it to the Data field. -func (o *CheckCanDeleteSLOResponse) SetData(v CheckCanDeleteSLOResponseData) { - o.Data = &v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *CheckCanDeleteSLOResponse) GetErrors() map[string]string { - if o == nil || o.Errors == nil { - var ret map[string]string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckCanDeleteSLOResponse) GetErrorsOk() (*map[string]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *CheckCanDeleteSLOResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given map[string]string and assigns it to the Errors field. -func (o *CheckCanDeleteSLOResponse) SetErrors(v map[string]string) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CheckCanDeleteSLOResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CheckCanDeleteSLOResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *CheckCanDeleteSLOResponseData `json:"data,omitempty"` - Errors map[string]string `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Errors = all.Errors - return nil -} diff --git a/api/v1/datadog/model_check_can_delete_slo_response_data.go b/api/v1/datadog/model_check_can_delete_slo_response_data.go deleted file mode 100644 index 5ed74f61890..00000000000 --- a/api/v1/datadog/model_check_can_delete_slo_response_data.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CheckCanDeleteSLOResponseData An array of service level objective objects. -type CheckCanDeleteSLOResponseData struct { - // An array of of SLO IDs that can be safely deleted. - Ok []string `json:"ok,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{} -} - -// NewCheckCanDeleteSLOResponseData instantiates a new CheckCanDeleteSLOResponseData 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 NewCheckCanDeleteSLOResponseData() *CheckCanDeleteSLOResponseData { - this := CheckCanDeleteSLOResponseData{} - return &this -} - -// NewCheckCanDeleteSLOResponseDataWithDefaults instantiates a new CheckCanDeleteSLOResponseData 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 NewCheckCanDeleteSLOResponseDataWithDefaults() *CheckCanDeleteSLOResponseData { - this := CheckCanDeleteSLOResponseData{} - return &this -} - -// GetOk returns the Ok field value if set, zero value otherwise. -func (o *CheckCanDeleteSLOResponseData) GetOk() []string { - if o == nil || o.Ok == nil { - var ret []string - return ret - } - return o.Ok -} - -// GetOkOk returns a tuple with the Ok field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckCanDeleteSLOResponseData) GetOkOk() (*[]string, bool) { - if o == nil || o.Ok == nil { - return nil, false - } - return &o.Ok, true -} - -// HasOk returns a boolean if a field has been set. -func (o *CheckCanDeleteSLOResponseData) HasOk() bool { - if o != nil && o.Ok != nil { - return true - } - - return false -} - -// SetOk gets a reference to the given []string and assigns it to the Ok field. -func (o *CheckCanDeleteSLOResponseData) SetOk(v []string) { - o.Ok = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CheckCanDeleteSLOResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Ok != nil { - toSerialize["ok"] = o.Ok - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CheckCanDeleteSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Ok []string `json:"ok,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Ok = all.Ok - return nil -} diff --git a/api/v1/datadog/model_check_status_widget_definition.go b/api/v1/datadog/model_check_status_widget_definition.go deleted file mode 100644 index f8056530dd5..00000000000 --- a/api/v1/datadog/model_check_status_widget_definition.go +++ /dev/null @@ -1,475 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CheckStatusWidgetDefinition Check status shows the current status or number of results for any check performed. -type CheckStatusWidgetDefinition struct { - // Name of the check to use in the widget. - Check string `json:"check"` - // Group reporting a single check. - Group *string `json:"group,omitempty"` - // List of tag prefixes to group by in the case of a cluster check. - GroupBy []string `json:"group_by,omitempty"` - // The kind of grouping to use. - Grouping WidgetGrouping `json:"grouping"` - // List of tags used to filter the groups reporting a cluster check. - Tags []string `json:"tags,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the check status widget. - Type CheckStatusWidgetDefinitionType `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{} -} - -// NewCheckStatusWidgetDefinition instantiates a new CheckStatusWidgetDefinition 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 NewCheckStatusWidgetDefinition(check string, grouping WidgetGrouping, typeVar CheckStatusWidgetDefinitionType) *CheckStatusWidgetDefinition { - this := CheckStatusWidgetDefinition{} - this.Check = check - this.Grouping = grouping - this.Type = typeVar - return &this -} - -// NewCheckStatusWidgetDefinitionWithDefaults instantiates a new CheckStatusWidgetDefinition 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 NewCheckStatusWidgetDefinitionWithDefaults() *CheckStatusWidgetDefinition { - this := CheckStatusWidgetDefinition{} - var typeVar CheckStatusWidgetDefinitionType = CHECKSTATUSWIDGETDEFINITIONTYPE_CHECK_STATUS - this.Type = typeVar - return &this -} - -// GetCheck returns the Check field value. -func (o *CheckStatusWidgetDefinition) GetCheck() string { - if o == nil { - var ret string - return ret - } - return o.Check -} - -// GetCheckOk returns a tuple with the Check field value -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetCheckOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Check, true -} - -// SetCheck sets field value. -func (o *CheckStatusWidgetDefinition) SetCheck(v string) { - o.Check = v -} - -// GetGroup returns the Group field value if set, zero value otherwise. -func (o *CheckStatusWidgetDefinition) GetGroup() string { - if o == nil || o.Group == nil { - var ret string - return ret - } - return *o.Group -} - -// GetGroupOk returns a tuple with the Group field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetGroupOk() (*string, bool) { - if o == nil || o.Group == nil { - return nil, false - } - return o.Group, true -} - -// HasGroup returns a boolean if a field has been set. -func (o *CheckStatusWidgetDefinition) HasGroup() bool { - if o != nil && o.Group != nil { - return true - } - - return false -} - -// SetGroup gets a reference to the given string and assigns it to the Group field. -func (o *CheckStatusWidgetDefinition) SetGroup(v string) { - o.Group = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *CheckStatusWidgetDefinition) GetGroupBy() []string { - if o == nil || o.GroupBy == nil { - var ret []string - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetGroupByOk() (*[]string, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *CheckStatusWidgetDefinition) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. -func (o *CheckStatusWidgetDefinition) SetGroupBy(v []string) { - o.GroupBy = v -} - -// GetGrouping returns the Grouping field value. -func (o *CheckStatusWidgetDefinition) GetGrouping() WidgetGrouping { - if o == nil { - var ret WidgetGrouping - return ret - } - return o.Grouping -} - -// GetGroupingOk returns a tuple with the Grouping field value -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetGroupingOk() (*WidgetGrouping, bool) { - if o == nil { - return nil, false - } - return &o.Grouping, true -} - -// SetGrouping sets field value. -func (o *CheckStatusWidgetDefinition) SetGrouping(v WidgetGrouping) { - o.Grouping = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *CheckStatusWidgetDefinition) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *CheckStatusWidgetDefinition) GetTagsOk() (*[]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 *CheckStatusWidgetDefinition) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *CheckStatusWidgetDefinition) SetTags(v []string) { - o.Tags = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *CheckStatusWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *CheckStatusWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *CheckStatusWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *CheckStatusWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *CheckStatusWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *CheckStatusWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *CheckStatusWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *CheckStatusWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *CheckStatusWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *CheckStatusWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CheckStatusWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *CheckStatusWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *CheckStatusWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *CheckStatusWidgetDefinition) GetType() CheckStatusWidgetDefinitionType { - if o == nil { - var ret CheckStatusWidgetDefinitionType - 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 *CheckStatusWidgetDefinition) GetTypeOk() (*CheckStatusWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *CheckStatusWidgetDefinition) SetType(v CheckStatusWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CheckStatusWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["check"] = o.Check - if o.Group != nil { - toSerialize["group"] = o.Group - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - toSerialize["grouping"] = o.Grouping - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Check *string `json:"check"` - Grouping *WidgetGrouping `json:"grouping"` - Type *CheckStatusWidgetDefinitionType `json:"type"` - }{} - all := struct { - Check string `json:"check"` - Group *string `json:"group,omitempty"` - GroupBy []string `json:"group_by,omitempty"` - Grouping WidgetGrouping `json:"grouping"` - Tags []string `json:"tags,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type CheckStatusWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Check == nil { - return fmt.Errorf("Required field check missing") - } - if required.Grouping == nil { - return fmt.Errorf("Required field grouping missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Grouping; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Check = all.Check - o.Group = all.Group - o.GroupBy = all.GroupBy - o.Grouping = all.Grouping - o.Tags = all.Tags - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_check_status_widget_definition_type.go b/api/v1/datadog/model_check_status_widget_definition_type.go deleted file mode 100644 index f54da27b8ff..00000000000 --- a/api/v1/datadog/model_check_status_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CheckStatusWidgetDefinitionType Type of the check status widget. -type CheckStatusWidgetDefinitionType string - -// List of CheckStatusWidgetDefinitionType. -const ( - CHECKSTATUSWIDGETDEFINITIONTYPE_CHECK_STATUS CheckStatusWidgetDefinitionType = "check_status" -) - -var allowedCheckStatusWidgetDefinitionTypeEnumValues = []CheckStatusWidgetDefinitionType{ - CHECKSTATUSWIDGETDEFINITIONTYPE_CHECK_STATUS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *CheckStatusWidgetDefinitionType) GetAllowedValues() []CheckStatusWidgetDefinitionType { - return allowedCheckStatusWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *CheckStatusWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = CheckStatusWidgetDefinitionType(value) - return nil -} - -// NewCheckStatusWidgetDefinitionTypeFromValue returns a pointer to a valid CheckStatusWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewCheckStatusWidgetDefinitionTypeFromValue(v string) (*CheckStatusWidgetDefinitionType, error) { - ev := CheckStatusWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for CheckStatusWidgetDefinitionType: valid values are %v", v, allowedCheckStatusWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v CheckStatusWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedCheckStatusWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to CheckStatusWidgetDefinitionType value. -func (v CheckStatusWidgetDefinitionType) Ptr() *CheckStatusWidgetDefinitionType { - return &v -} - -// NullableCheckStatusWidgetDefinitionType handles when a null is used for CheckStatusWidgetDefinitionType. -type NullableCheckStatusWidgetDefinitionType struct { - value *CheckStatusWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableCheckStatusWidgetDefinitionType) Get() *CheckStatusWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCheckStatusWidgetDefinitionType) Set(val *CheckStatusWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCheckStatusWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCheckStatusWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCheckStatusWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableCheckStatusWidgetDefinitionType(val *CheckStatusWidgetDefinitionType) *NullableCheckStatusWidgetDefinitionType { - return &NullableCheckStatusWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCheckStatusWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCheckStatusWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_content_encoding.go b/api/v1/datadog/model_content_encoding.go deleted file mode 100644 index 96c002db1df..00000000000 --- a/api/v1/datadog/model_content_encoding.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ContentEncoding HTTP header used to compress the media-type. -type ContentEncoding string - -// List of ContentEncoding. -const ( - CONTENTENCODING_GZIP ContentEncoding = "gzip" - CONTENTENCODING_DEFLATE ContentEncoding = "deflate" -) - -var allowedContentEncodingEnumValues = []ContentEncoding{ - CONTENTENCODING_GZIP, - CONTENTENCODING_DEFLATE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ContentEncoding) GetAllowedValues() []ContentEncoding { - return allowedContentEncodingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ContentEncoding) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ContentEncoding(value) - return nil -} - -// NewContentEncodingFromValue returns a pointer to a valid ContentEncoding -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewContentEncodingFromValue(v string) (*ContentEncoding, error) { - ev := ContentEncoding(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ContentEncoding: valid values are %v", v, allowedContentEncodingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ContentEncoding) IsValid() bool { - for _, existing := range allowedContentEncodingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ContentEncoding value. -func (v ContentEncoding) Ptr() *ContentEncoding { - return &v -} - -// NullableContentEncoding handles when a null is used for ContentEncoding. -type NullableContentEncoding struct { - value *ContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableContentEncoding) Get() *ContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableContentEncoding) Set(val *ContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableContentEncoding initializes the struct as if Set has been called. -func NewNullableContentEncoding(val *ContentEncoding) *NullableContentEncoding { - return &NullableContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_creator.go b/api/v1/datadog/model_creator.go deleted file mode 100644 index 36727914b60..00000000000 --- a/api/v1/datadog/model_creator.go +++ /dev/null @@ -1,193 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// Creator Object describing the creator of the shared element. -type Creator struct { - // Email of the creator. - Email *string `json:"email,omitempty"` - // Handle of the creator. - Handle *string `json:"handle,omitempty"` - // Name of the creator. - Name common.NullableString `json:"name,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{} -} - -// NewCreator instantiates a new Creator 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 NewCreator() *Creator { - this := Creator{} - return &this -} - -// NewCreatorWithDefaults instantiates a new Creator 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 NewCreatorWithDefaults() *Creator { - this := Creator{} - return &this -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *Creator) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Creator) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *Creator) HasEmail() bool { - if o != nil && o.Email != nil { - return true - } - - return false -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *Creator) SetEmail(v string) { - o.Email = &v -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *Creator) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Creator) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *Creator) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *Creator) SetHandle(v string) { - o.Handle = &v -} - -// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Creator) GetName() string { - if o == nil || o.Name.Get() == nil { - var ret string - return ret - } - return *o.Name.Get() -} - -// GetNameOk returns a tuple with the Name 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 *Creator) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name.Get(), o.Name.IsSet() -} - -// HasName returns a boolean if a field has been set. -func (o *Creator) HasName() bool { - if o != nil && o.Name.IsSet() { - return true - } - - return false -} - -// SetName gets a reference to the given common.NullableString and assigns it to the Name field. -func (o *Creator) SetName(v string) { - o.Name.Set(&v) -} - -// SetNameNil sets the value for Name to be an explicit nil. -func (o *Creator) SetNameNil() { - o.Name.Set(nil) -} - -// UnsetName ensures that no value is present for Name, not even an explicit nil. -func (o *Creator) UnsetName() { - o.Name.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o Creator) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Name.IsSet() { - toSerialize["name"] = o.Name.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Email *string `json:"email,omitempty"` - Handle *string `json:"handle,omitempty"` - Name common.NullableString `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Email = all.Email - o.Handle = all.Handle - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_dashboard.go b/api/v1/datadog/model_dashboard.go deleted file mode 100644 index 9743306c2a0..00000000000 --- a/api/v1/datadog/model_dashboard.go +++ /dev/null @@ -1,739 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// Dashboard A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying -// key performance metrics, which enable you to monitor the health of your infrastructure. -type Dashboard struct { - // Identifier of the dashboard author. - AuthorHandle *string `json:"author_handle,omitempty"` - // Name of the dashboard author. - AuthorName common.NullableString `json:"author_name,omitempty"` - // Creation date of the dashboard. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Description of the dashboard. - Description common.NullableString `json:"description,omitempty"` - // ID of the dashboard. - Id *string `json:"id,omitempty"` - // Whether this dashboard is read-only. If True, only the author and admins can make changes to it. Prefer using `restricted_roles` to manage write authorization. - // Deprecated - IsReadOnly *bool `json:"is_read_only,omitempty"` - // Layout type of the dashboard. - LayoutType DashboardLayoutType `json:"layout_type"` - // Modification date of the dashboard. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // List of handles of users to notify when changes are made to this dashboard. - NotifyList []string `json:"notify_list,omitempty"` - // Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'. - // If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto', - // widgets should not have layouts. - ReflowType *DashboardReflowType `json:"reflow_type,omitempty"` - // A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard. - RestrictedRoles []string `json:"restricted_roles,omitempty"` - // Array of template variables saved views. - TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"` - // List of template variables for this dashboard. - TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"` - // Title of the dashboard. - Title string `json:"title"` - // The URL of the dashboard. - Url *string `json:"url,omitempty"` - // List of widgets to display on the dashboard. - Widgets []Widget `json:"widgets"` - // 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{} -} - -// NewDashboard instantiates a new Dashboard 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 NewDashboard(layoutType DashboardLayoutType, title string, widgets []Widget) *Dashboard { - this := Dashboard{} - var isReadOnly bool = false - this.IsReadOnly = &isReadOnly - this.LayoutType = layoutType - this.Title = title - this.Widgets = widgets - return &this -} - -// NewDashboardWithDefaults instantiates a new Dashboard 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 NewDashboardWithDefaults() *Dashboard { - this := Dashboard{} - var isReadOnly bool = false - this.IsReadOnly = &isReadOnly - return &this -} - -// GetAuthorHandle returns the AuthorHandle field value if set, zero value otherwise. -func (o *Dashboard) GetAuthorHandle() string { - if o == nil || o.AuthorHandle == nil { - var ret string - return ret - } - return *o.AuthorHandle -} - -// GetAuthorHandleOk returns a tuple with the AuthorHandle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Dashboard) GetAuthorHandleOk() (*string, bool) { - if o == nil || o.AuthorHandle == nil { - return nil, false - } - return o.AuthorHandle, true -} - -// HasAuthorHandle returns a boolean if a field has been set. -func (o *Dashboard) HasAuthorHandle() bool { - if o != nil && o.AuthorHandle != nil { - return true - } - - return false -} - -// SetAuthorHandle gets a reference to the given string and assigns it to the AuthorHandle field. -func (o *Dashboard) SetAuthorHandle(v string) { - o.AuthorHandle = &v -} - -// GetAuthorName returns the AuthorName field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Dashboard) GetAuthorName() string { - if o == nil || o.AuthorName.Get() == nil { - var ret string - return ret - } - return *o.AuthorName.Get() -} - -// GetAuthorNameOk returns a tuple with the AuthorName 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 *Dashboard) GetAuthorNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.AuthorName.Get(), o.AuthorName.IsSet() -} - -// HasAuthorName returns a boolean if a field has been set. -func (o *Dashboard) HasAuthorName() bool { - if o != nil && o.AuthorName.IsSet() { - return true - } - - return false -} - -// SetAuthorName gets a reference to the given common.NullableString and assigns it to the AuthorName field. -func (o *Dashboard) SetAuthorName(v string) { - o.AuthorName.Set(&v) -} - -// SetAuthorNameNil sets the value for AuthorName to be an explicit nil. -func (o *Dashboard) SetAuthorNameNil() { - o.AuthorName.Set(nil) -} - -// UnsetAuthorName ensures that no value is present for AuthorName, not even an explicit nil. -func (o *Dashboard) UnsetAuthorName() { - o.AuthorName.Unset() -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *Dashboard) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Dashboard) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *Dashboard) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *Dashboard) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Dashboard) GetDescription() string { - if o == nil || o.Description.Get() == nil { - var ret string - return ret - } - return *o.Description.Get() -} - -// GetDescriptionOk returns a tuple with the Description 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 *Dashboard) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Description.Get(), o.Description.IsSet() -} - -// HasDescription returns a boolean if a field has been set. -func (o *Dashboard) HasDescription() bool { - if o != nil && o.Description.IsSet() { - return true - } - - return false -} - -// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. -func (o *Dashboard) SetDescription(v string) { - o.Description.Set(&v) -} - -// SetDescriptionNil sets the value for Description to be an explicit nil. -func (o *Dashboard) SetDescriptionNil() { - o.Description.Set(nil) -} - -// UnsetDescription ensures that no value is present for Description, not even an explicit nil. -func (o *Dashboard) UnsetDescription() { - o.Description.Unset() -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Dashboard) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Dashboard) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Dashboard) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Dashboard) SetId(v string) { - o.Id = &v -} - -// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. -// Deprecated -func (o *Dashboard) GetIsReadOnly() bool { - if o == nil || o.IsReadOnly == nil { - var ret bool - return ret - } - return *o.IsReadOnly -} - -// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *Dashboard) GetIsReadOnlyOk() (*bool, bool) { - if o == nil || o.IsReadOnly == nil { - return nil, false - } - return o.IsReadOnly, true -} - -// HasIsReadOnly returns a boolean if a field has been set. -func (o *Dashboard) HasIsReadOnly() bool { - if o != nil && o.IsReadOnly != nil { - return true - } - - return false -} - -// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. -// Deprecated -func (o *Dashboard) SetIsReadOnly(v bool) { - o.IsReadOnly = &v -} - -// GetLayoutType returns the LayoutType field value. -func (o *Dashboard) GetLayoutType() DashboardLayoutType { - if o == nil { - var ret DashboardLayoutType - return ret - } - return o.LayoutType -} - -// GetLayoutTypeOk returns a tuple with the LayoutType field value -// and a boolean to check if the value has been set. -func (o *Dashboard) GetLayoutTypeOk() (*DashboardLayoutType, bool) { - if o == nil { - return nil, false - } - return &o.LayoutType, true -} - -// SetLayoutType sets field value. -func (o *Dashboard) SetLayoutType(v DashboardLayoutType) { - o.LayoutType = v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *Dashboard) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Dashboard) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *Dashboard) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *Dashboard) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetNotifyList returns the NotifyList field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Dashboard) GetNotifyList() []string { - if o == nil { - var ret []string - return ret - } - return o.NotifyList -} - -// GetNotifyListOk returns a tuple with the NotifyList 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 *Dashboard) GetNotifyListOk() (*[]string, bool) { - if o == nil || o.NotifyList == nil { - return nil, false - } - return &o.NotifyList, true -} - -// HasNotifyList returns a boolean if a field has been set. -func (o *Dashboard) HasNotifyList() bool { - if o != nil && o.NotifyList != nil { - return true - } - - return false -} - -// SetNotifyList gets a reference to the given []string and assigns it to the NotifyList field. -func (o *Dashboard) SetNotifyList(v []string) { - o.NotifyList = v -} - -// GetReflowType returns the ReflowType field value if set, zero value otherwise. -func (o *Dashboard) GetReflowType() DashboardReflowType { - if o == nil || o.ReflowType == nil { - var ret DashboardReflowType - return ret - } - return *o.ReflowType -} - -// GetReflowTypeOk returns a tuple with the ReflowType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Dashboard) GetReflowTypeOk() (*DashboardReflowType, bool) { - if o == nil || o.ReflowType == nil { - return nil, false - } - return o.ReflowType, true -} - -// HasReflowType returns a boolean if a field has been set. -func (o *Dashboard) HasReflowType() bool { - if o != nil && o.ReflowType != nil { - return true - } - - return false -} - -// SetReflowType gets a reference to the given DashboardReflowType and assigns it to the ReflowType field. -func (o *Dashboard) SetReflowType(v DashboardReflowType) { - o.ReflowType = &v -} - -// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. -func (o *Dashboard) GetRestrictedRoles() []string { - if o == nil || o.RestrictedRoles == nil { - var ret []string - return ret - } - return o.RestrictedRoles -} - -// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Dashboard) GetRestrictedRolesOk() (*[]string, bool) { - if o == nil || o.RestrictedRoles == nil { - return nil, false - } - return &o.RestrictedRoles, true -} - -// HasRestrictedRoles returns a boolean if a field has been set. -func (o *Dashboard) HasRestrictedRoles() bool { - if o != nil && o.RestrictedRoles != nil { - return true - } - - return false -} - -// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. -func (o *Dashboard) SetRestrictedRoles(v []string) { - o.RestrictedRoles = v -} - -// GetTemplateVariablePresets returns the TemplateVariablePresets field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Dashboard) GetTemplateVariablePresets() []DashboardTemplateVariablePreset { - if o == nil { - var ret []DashboardTemplateVariablePreset - return ret - } - return o.TemplateVariablePresets -} - -// GetTemplateVariablePresetsOk returns a tuple with the TemplateVariablePresets 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 *Dashboard) GetTemplateVariablePresetsOk() (*[]DashboardTemplateVariablePreset, bool) { - if o == nil || o.TemplateVariablePresets == nil { - return nil, false - } - return &o.TemplateVariablePresets, true -} - -// HasTemplateVariablePresets returns a boolean if a field has been set. -func (o *Dashboard) HasTemplateVariablePresets() bool { - if o != nil && o.TemplateVariablePresets != nil { - return true - } - - return false -} - -// SetTemplateVariablePresets gets a reference to the given []DashboardTemplateVariablePreset and assigns it to the TemplateVariablePresets field. -func (o *Dashboard) SetTemplateVariablePresets(v []DashboardTemplateVariablePreset) { - o.TemplateVariablePresets = v -} - -// GetTemplateVariables returns the TemplateVariables field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Dashboard) GetTemplateVariables() []DashboardTemplateVariable { - if o == nil { - var ret []DashboardTemplateVariable - return ret - } - return o.TemplateVariables -} - -// GetTemplateVariablesOk returns a tuple with the TemplateVariables 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 *Dashboard) GetTemplateVariablesOk() (*[]DashboardTemplateVariable, bool) { - if o == nil || o.TemplateVariables == nil { - return nil, false - } - return &o.TemplateVariables, true -} - -// HasTemplateVariables returns a boolean if a field has been set. -func (o *Dashboard) HasTemplateVariables() bool { - if o != nil && o.TemplateVariables != nil { - return true - } - - return false -} - -// SetTemplateVariables gets a reference to the given []DashboardTemplateVariable and assigns it to the TemplateVariables field. -func (o *Dashboard) SetTemplateVariables(v []DashboardTemplateVariable) { - o.TemplateVariables = v -} - -// GetTitle returns the Title field value. -func (o *Dashboard) GetTitle() string { - if o == nil { - var ret string - return ret - } - return o.Title -} - -// GetTitleOk returns a tuple with the Title field value -// and a boolean to check if the value has been set. -func (o *Dashboard) GetTitleOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Title, true -} - -// SetTitle sets field value. -func (o *Dashboard) SetTitle(v string) { - o.Title = v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *Dashboard) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Dashboard) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *Dashboard) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *Dashboard) SetUrl(v string) { - o.Url = &v -} - -// GetWidgets returns the Widgets field value. -func (o *Dashboard) GetWidgets() []Widget { - if o == nil { - var ret []Widget - return ret - } - return o.Widgets -} - -// GetWidgetsOk returns a tuple with the Widgets field value -// and a boolean to check if the value has been set. -func (o *Dashboard) GetWidgetsOk() (*[]Widget, bool) { - if o == nil { - return nil, false - } - return &o.Widgets, true -} - -// SetWidgets sets field value. -func (o *Dashboard) SetWidgets(v []Widget) { - o.Widgets = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Dashboard) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AuthorHandle != nil { - toSerialize["author_handle"] = o.AuthorHandle - } - if o.AuthorName.IsSet() { - toSerialize["author_name"] = o.AuthorName.Get() - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Description.IsSet() { - toSerialize["description"] = o.Description.Get() - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IsReadOnly != nil { - toSerialize["is_read_only"] = o.IsReadOnly - } - toSerialize["layout_type"] = o.LayoutType - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.NotifyList != nil { - toSerialize["notify_list"] = o.NotifyList - } - if o.ReflowType != nil { - toSerialize["reflow_type"] = o.ReflowType - } - if o.RestrictedRoles != nil { - toSerialize["restricted_roles"] = o.RestrictedRoles - } - if o.TemplateVariablePresets != nil { - toSerialize["template_variable_presets"] = o.TemplateVariablePresets - } - if o.TemplateVariables != nil { - toSerialize["template_variables"] = o.TemplateVariables - } - toSerialize["title"] = o.Title - if o.Url != nil { - toSerialize["url"] = o.Url - } - toSerialize["widgets"] = o.Widgets - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - LayoutType *DashboardLayoutType `json:"layout_type"` - Title *string `json:"title"` - Widgets *[]Widget `json:"widgets"` - }{} - all := struct { - AuthorHandle *string `json:"author_handle,omitempty"` - AuthorName common.NullableString `json:"author_name,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Description common.NullableString `json:"description,omitempty"` - Id *string `json:"id,omitempty"` - IsReadOnly *bool `json:"is_read_only,omitempty"` - LayoutType DashboardLayoutType `json:"layout_type"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - NotifyList []string `json:"notify_list,omitempty"` - ReflowType *DashboardReflowType `json:"reflow_type,omitempty"` - RestrictedRoles []string `json:"restricted_roles,omitempty"` - TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"` - TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"` - Title string `json:"title"` - Url *string `json:"url,omitempty"` - Widgets []Widget `json:"widgets"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.LayoutType == nil { - return fmt.Errorf("Required field layout_type missing") - } - if required.Title == nil { - return fmt.Errorf("Required field title missing") - } - if required.Widgets == nil { - return fmt.Errorf("Required field widgets missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LayoutType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ReflowType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AuthorHandle = all.AuthorHandle - o.AuthorName = all.AuthorName - o.CreatedAt = all.CreatedAt - o.Description = all.Description - o.Id = all.Id - o.IsReadOnly = all.IsReadOnly - o.LayoutType = all.LayoutType - o.ModifiedAt = all.ModifiedAt - o.NotifyList = all.NotifyList - o.ReflowType = all.ReflowType - o.RestrictedRoles = all.RestrictedRoles - o.TemplateVariablePresets = all.TemplateVariablePresets - o.TemplateVariables = all.TemplateVariables - o.Title = all.Title - o.Url = all.Url - o.Widgets = all.Widgets - return nil -} diff --git a/api/v1/datadog/model_dashboard_bulk_action_data.go b/api/v1/datadog/model_dashboard_bulk_action_data.go deleted file mode 100644 index 454e541aea6..00000000000 --- a/api/v1/datadog/model_dashboard_bulk_action_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardBulkActionData Dashboard bulk action request data. -type DashboardBulkActionData struct { - // Dashboard resource ID. - Id string `json:"id"` - // Dashboard resource type. - Type DashboardResourceType `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{} -} - -// NewDashboardBulkActionData instantiates a new DashboardBulkActionData 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 NewDashboardBulkActionData(id string, typeVar DashboardResourceType) *DashboardBulkActionData { - this := DashboardBulkActionData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewDashboardBulkActionDataWithDefaults instantiates a new DashboardBulkActionData 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 NewDashboardBulkActionDataWithDefaults() *DashboardBulkActionData { - this := DashboardBulkActionData{} - var typeVar DashboardResourceType = DASHBOARDRESOURCETYPE_DASHBOARD - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *DashboardBulkActionData) 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 *DashboardBulkActionData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *DashboardBulkActionData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *DashboardBulkActionData) GetType() DashboardResourceType { - if o == nil { - var ret DashboardResourceType - 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 *DashboardBulkActionData) GetTypeOk() (*DashboardResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *DashboardBulkActionData) SetType(v DashboardResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardBulkActionData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardBulkActionData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *DashboardResourceType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type DashboardResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_dashboard_bulk_delete_request.go b/api/v1/datadog/model_dashboard_bulk_delete_request.go deleted file mode 100644 index d5567b23ddb..00000000000 --- a/api/v1/datadog/model_dashboard_bulk_delete_request.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardBulkDeleteRequest Dashboard bulk delete request body. -type DashboardBulkDeleteRequest struct { - // List of dashboard bulk action request data objects. - Data []DashboardBulkActionData `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{} -} - -// NewDashboardBulkDeleteRequest instantiates a new DashboardBulkDeleteRequest 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 NewDashboardBulkDeleteRequest(data []DashboardBulkActionData) *DashboardBulkDeleteRequest { - this := DashboardBulkDeleteRequest{} - this.Data = data - return &this -} - -// NewDashboardBulkDeleteRequestWithDefaults instantiates a new DashboardBulkDeleteRequest 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 NewDashboardBulkDeleteRequestWithDefaults() *DashboardBulkDeleteRequest { - this := DashboardBulkDeleteRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *DashboardBulkDeleteRequest) GetData() []DashboardBulkActionData { - if o == nil { - var ret []DashboardBulkActionData - 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 *DashboardBulkDeleteRequest) GetDataOk() (*[]DashboardBulkActionData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *DashboardBulkDeleteRequest) SetData(v []DashboardBulkActionData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardBulkDeleteRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardBulkDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]DashboardBulkActionData `json:"data"` - }{} - all := struct { - Data []DashboardBulkActionData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_dashboard_delete_response.go b/api/v1/datadog/model_dashboard_delete_response.go deleted file mode 100644 index ba632231fb0..00000000000 --- a/api/v1/datadog/model_dashboard_delete_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardDeleteResponse Response from the delete dashboard call. -type DashboardDeleteResponse struct { - // ID of the deleted dashboard. - DeletedDashboardId *string `json:"deleted_dashboard_id,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{} -} - -// NewDashboardDeleteResponse instantiates a new DashboardDeleteResponse 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 NewDashboardDeleteResponse() *DashboardDeleteResponse { - this := DashboardDeleteResponse{} - return &this -} - -// NewDashboardDeleteResponseWithDefaults instantiates a new DashboardDeleteResponse 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 NewDashboardDeleteResponseWithDefaults() *DashboardDeleteResponse { - this := DashboardDeleteResponse{} - return &this -} - -// GetDeletedDashboardId returns the DeletedDashboardId field value if set, zero value otherwise. -func (o *DashboardDeleteResponse) GetDeletedDashboardId() string { - if o == nil || o.DeletedDashboardId == nil { - var ret string - return ret - } - return *o.DeletedDashboardId -} - -// GetDeletedDashboardIdOk returns a tuple with the DeletedDashboardId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardDeleteResponse) GetDeletedDashboardIdOk() (*string, bool) { - if o == nil || o.DeletedDashboardId == nil { - return nil, false - } - return o.DeletedDashboardId, true -} - -// HasDeletedDashboardId returns a boolean if a field has been set. -func (o *DashboardDeleteResponse) HasDeletedDashboardId() bool { - if o != nil && o.DeletedDashboardId != nil { - return true - } - - return false -} - -// SetDeletedDashboardId gets a reference to the given string and assigns it to the DeletedDashboardId field. -func (o *DashboardDeleteResponse) SetDeletedDashboardId(v string) { - o.DeletedDashboardId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardDeleteResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DeletedDashboardId != nil { - toSerialize["deleted_dashboard_id"] = o.DeletedDashboardId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DeletedDashboardId *string `json:"deleted_dashboard_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DeletedDashboardId = all.DeletedDashboardId - return nil -} diff --git a/api/v1/datadog/model_dashboard_layout_type.go b/api/v1/datadog/model_dashboard_layout_type.go deleted file mode 100644 index d9e9b2d8b63..00000000000 --- a/api/v1/datadog/model_dashboard_layout_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardLayoutType Layout type of the dashboard. -type DashboardLayoutType string - -// List of DashboardLayoutType. -const ( - DASHBOARDLAYOUTTYPE_ORDERED DashboardLayoutType = "ordered" - DASHBOARDLAYOUTTYPE_FREE DashboardLayoutType = "free" -) - -var allowedDashboardLayoutTypeEnumValues = []DashboardLayoutType{ - DASHBOARDLAYOUTTYPE_ORDERED, - DASHBOARDLAYOUTTYPE_FREE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DashboardLayoutType) GetAllowedValues() []DashboardLayoutType { - return allowedDashboardLayoutTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DashboardLayoutType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DashboardLayoutType(value) - return nil -} - -// NewDashboardLayoutTypeFromValue returns a pointer to a valid DashboardLayoutType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDashboardLayoutTypeFromValue(v string) (*DashboardLayoutType, error) { - ev := DashboardLayoutType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DashboardLayoutType: valid values are %v", v, allowedDashboardLayoutTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DashboardLayoutType) IsValid() bool { - for _, existing := range allowedDashboardLayoutTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DashboardLayoutType value. -func (v DashboardLayoutType) Ptr() *DashboardLayoutType { - return &v -} - -// NullableDashboardLayoutType handles when a null is used for DashboardLayoutType. -type NullableDashboardLayoutType struct { - value *DashboardLayoutType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardLayoutType) Get() *DashboardLayoutType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardLayoutType) Set(val *DashboardLayoutType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardLayoutType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardLayoutType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardLayoutType initializes the struct as if Set has been called. -func NewNullableDashboardLayoutType(val *DashboardLayoutType) *NullableDashboardLayoutType { - return &NullableDashboardLayoutType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardLayoutType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardLayoutType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_dashboard_list.go b/api/v1/datadog/model_dashboard_list.go deleted file mode 100644 index d55c8b7c076..00000000000 --- a/api/v1/datadog/model_dashboard_list.go +++ /dev/null @@ -1,392 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" -) - -// DashboardList Your Datadog Dashboards. -type DashboardList struct { - // Object describing the creator of the shared element. - Author *Creator `json:"author,omitempty"` - // Date of creation of the dashboard list. - Created *time.Time `json:"created,omitempty"` - // The number of dashboards in the list. - DashboardCount *int64 `json:"dashboard_count,omitempty"` - // The ID of the dashboard list. - Id *int64 `json:"id,omitempty"` - // Whether or not the list is in the favorites. - IsFavorite *bool `json:"is_favorite,omitempty"` - // Date of last edition of the dashboard list. - Modified *time.Time `json:"modified,omitempty"` - // The name of the dashboard list. - Name string `json:"name"` - // The type of dashboard list. - Type *string `json:"type,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{} -} - -// NewDashboardList instantiates a new DashboardList 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 NewDashboardList(name string) *DashboardList { - this := DashboardList{} - this.Name = name - return &this -} - -// NewDashboardListWithDefaults instantiates a new DashboardList 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 NewDashboardListWithDefaults() *DashboardList { - this := DashboardList{} - return &this -} - -// GetAuthor returns the Author field value if set, zero value otherwise. -func (o *DashboardList) GetAuthor() Creator { - if o == nil || o.Author == nil { - var ret Creator - return ret - } - return *o.Author -} - -// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardList) GetAuthorOk() (*Creator, bool) { - if o == nil || o.Author == nil { - return nil, false - } - return o.Author, true -} - -// HasAuthor returns a boolean if a field has been set. -func (o *DashboardList) HasAuthor() bool { - if o != nil && o.Author != nil { - return true - } - - return false -} - -// SetAuthor gets a reference to the given Creator and assigns it to the Author field. -func (o *DashboardList) SetAuthor(v Creator) { - o.Author = &v -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *DashboardList) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardList) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *DashboardList) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *DashboardList) SetCreated(v time.Time) { - o.Created = &v -} - -// GetDashboardCount returns the DashboardCount field value if set, zero value otherwise. -func (o *DashboardList) GetDashboardCount() int64 { - if o == nil || o.DashboardCount == nil { - var ret int64 - return ret - } - return *o.DashboardCount -} - -// GetDashboardCountOk returns a tuple with the DashboardCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardList) GetDashboardCountOk() (*int64, bool) { - if o == nil || o.DashboardCount == nil { - return nil, false - } - return o.DashboardCount, true -} - -// HasDashboardCount returns a boolean if a field has been set. -func (o *DashboardList) HasDashboardCount() bool { - if o != nil && o.DashboardCount != nil { - return true - } - - return false -} - -// SetDashboardCount gets a reference to the given int64 and assigns it to the DashboardCount field. -func (o *DashboardList) SetDashboardCount(v int64) { - o.DashboardCount = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *DashboardList) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardList) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *DashboardList) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *DashboardList) SetId(v int64) { - o.Id = &v -} - -// GetIsFavorite returns the IsFavorite field value if set, zero value otherwise. -func (o *DashboardList) GetIsFavorite() bool { - if o == nil || o.IsFavorite == nil { - var ret bool - return ret - } - return *o.IsFavorite -} - -// GetIsFavoriteOk returns a tuple with the IsFavorite field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardList) GetIsFavoriteOk() (*bool, bool) { - if o == nil || o.IsFavorite == nil { - return nil, false - } - return o.IsFavorite, true -} - -// HasIsFavorite returns a boolean if a field has been set. -func (o *DashboardList) HasIsFavorite() bool { - if o != nil && o.IsFavorite != nil { - return true - } - - return false -} - -// SetIsFavorite gets a reference to the given bool and assigns it to the IsFavorite field. -func (o *DashboardList) SetIsFavorite(v bool) { - o.IsFavorite = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *DashboardList) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardList) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *DashboardList) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *DashboardList) SetModified(v time.Time) { - o.Modified = &v -} - -// GetName returns the Name field value. -func (o *DashboardList) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *DashboardList) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *DashboardList) SetName(v string) { - o.Name = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *DashboardList) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardList) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *DashboardList) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *DashboardList) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardList) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Author != nil { - toSerialize["author"] = o.Author - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.DashboardCount != nil { - toSerialize["dashboard_count"] = o.DashboardCount - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IsFavorite != nil { - toSerialize["is_favorite"] = o.IsFavorite - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - toSerialize["name"] = o.Name - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Author *Creator `json:"author,omitempty"` - Created *time.Time `json:"created,omitempty"` - DashboardCount *int64 `json:"dashboard_count,omitempty"` - Id *int64 `json:"id,omitempty"` - IsFavorite *bool `json:"is_favorite,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Name string `json:"name"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Author = all.Author - o.Created = all.Created - o.DashboardCount = all.DashboardCount - o.Id = all.Id - o.IsFavorite = all.IsFavorite - o.Modified = all.Modified - o.Name = all.Name - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_dashboard_list_delete_response.go b/api/v1/datadog/model_dashboard_list_delete_response.go deleted file mode 100644 index 8ebd8c0cd26..00000000000 --- a/api/v1/datadog/model_dashboard_list_delete_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListDeleteResponse Deleted dashboard details. -type DashboardListDeleteResponse struct { - // ID of the deleted dashboard list. - DeletedDashboardListId *int64 `json:"deleted_dashboard_list_id,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{} -} - -// NewDashboardListDeleteResponse instantiates a new DashboardListDeleteResponse 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 NewDashboardListDeleteResponse() *DashboardListDeleteResponse { - this := DashboardListDeleteResponse{} - return &this -} - -// NewDashboardListDeleteResponseWithDefaults instantiates a new DashboardListDeleteResponse 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 NewDashboardListDeleteResponseWithDefaults() *DashboardListDeleteResponse { - this := DashboardListDeleteResponse{} - return &this -} - -// GetDeletedDashboardListId returns the DeletedDashboardListId field value if set, zero value otherwise. -func (o *DashboardListDeleteResponse) GetDeletedDashboardListId() int64 { - if o == nil || o.DeletedDashboardListId == nil { - var ret int64 - return ret - } - return *o.DeletedDashboardListId -} - -// GetDeletedDashboardListIdOk returns a tuple with the DeletedDashboardListId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListDeleteResponse) GetDeletedDashboardListIdOk() (*int64, bool) { - if o == nil || o.DeletedDashboardListId == nil { - return nil, false - } - return o.DeletedDashboardListId, true -} - -// HasDeletedDashboardListId returns a boolean if a field has been set. -func (o *DashboardListDeleteResponse) HasDeletedDashboardListId() bool { - if o != nil && o.DeletedDashboardListId != nil { - return true - } - - return false -} - -// SetDeletedDashboardListId gets a reference to the given int64 and assigns it to the DeletedDashboardListId field. -func (o *DashboardListDeleteResponse) SetDeletedDashboardListId(v int64) { - o.DeletedDashboardListId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListDeleteResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DeletedDashboardListId != nil { - toSerialize["deleted_dashboard_list_id"] = o.DeletedDashboardListId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DeletedDashboardListId *int64 `json:"deleted_dashboard_list_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DeletedDashboardListId = all.DeletedDashboardListId - return nil -} diff --git a/api/v1/datadog/model_dashboard_list_list_response.go b/api/v1/datadog/model_dashboard_list_list_response.go deleted file mode 100644 index 78b08d820f3..00000000000 --- a/api/v1/datadog/model_dashboard_list_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListListResponse Information on your dashboard lists. -type DashboardListListResponse struct { - // List of all your dashboard lists. - DashboardLists []DashboardList `json:"dashboard_lists,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{} -} - -// NewDashboardListListResponse instantiates a new DashboardListListResponse 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 NewDashboardListListResponse() *DashboardListListResponse { - this := DashboardListListResponse{} - return &this -} - -// NewDashboardListListResponseWithDefaults instantiates a new DashboardListListResponse 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 NewDashboardListListResponseWithDefaults() *DashboardListListResponse { - this := DashboardListListResponse{} - return &this -} - -// GetDashboardLists returns the DashboardLists field value if set, zero value otherwise. -func (o *DashboardListListResponse) GetDashboardLists() []DashboardList { - if o == nil || o.DashboardLists == nil { - var ret []DashboardList - return ret - } - return o.DashboardLists -} - -// GetDashboardListsOk returns a tuple with the DashboardLists field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListListResponse) GetDashboardListsOk() (*[]DashboardList, bool) { - if o == nil || o.DashboardLists == nil { - return nil, false - } - return &o.DashboardLists, true -} - -// HasDashboardLists returns a boolean if a field has been set. -func (o *DashboardListListResponse) HasDashboardLists() bool { - if o != nil && o.DashboardLists != nil { - return true - } - - return false -} - -// SetDashboardLists gets a reference to the given []DashboardList and assigns it to the DashboardLists field. -func (o *DashboardListListResponse) SetDashboardLists(v []DashboardList) { - o.DashboardLists = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DashboardLists != nil { - toSerialize["dashboard_lists"] = o.DashboardLists - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DashboardLists []DashboardList `json:"dashboard_lists,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DashboardLists = all.DashboardLists - return nil -} diff --git a/api/v1/datadog/model_dashboard_reflow_type.go b/api/v1/datadog/model_dashboard_reflow_type.go deleted file mode 100644 index 5d03b2dc73a..00000000000 --- a/api/v1/datadog/model_dashboard_reflow_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardReflowType Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'. -// If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto', -// widgets should not have layouts. -type DashboardReflowType string - -// List of DashboardReflowType. -const ( - DASHBOARDREFLOWTYPE_AUTO DashboardReflowType = "auto" - DASHBOARDREFLOWTYPE_FIXED DashboardReflowType = "fixed" -) - -var allowedDashboardReflowTypeEnumValues = []DashboardReflowType{ - DASHBOARDREFLOWTYPE_AUTO, - DASHBOARDREFLOWTYPE_FIXED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DashboardReflowType) GetAllowedValues() []DashboardReflowType { - return allowedDashboardReflowTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DashboardReflowType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DashboardReflowType(value) - return nil -} - -// NewDashboardReflowTypeFromValue returns a pointer to a valid DashboardReflowType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDashboardReflowTypeFromValue(v string) (*DashboardReflowType, error) { - ev := DashboardReflowType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DashboardReflowType: valid values are %v", v, allowedDashboardReflowTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DashboardReflowType) IsValid() bool { - for _, existing := range allowedDashboardReflowTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DashboardReflowType value. -func (v DashboardReflowType) Ptr() *DashboardReflowType { - return &v -} - -// NullableDashboardReflowType handles when a null is used for DashboardReflowType. -type NullableDashboardReflowType struct { - value *DashboardReflowType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardReflowType) Get() *DashboardReflowType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardReflowType) Set(val *DashboardReflowType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardReflowType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardReflowType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardReflowType initializes the struct as if Set has been called. -func NewNullableDashboardReflowType(val *DashboardReflowType) *NullableDashboardReflowType { - return &NullableDashboardReflowType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardReflowType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardReflowType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_dashboard_resource_type.go b/api/v1/datadog/model_dashboard_resource_type.go deleted file mode 100644 index 48a4b1eb2be..00000000000 --- a/api/v1/datadog/model_dashboard_resource_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardResourceType Dashboard resource type. -type DashboardResourceType string - -// List of DashboardResourceType. -const ( - DASHBOARDRESOURCETYPE_DASHBOARD DashboardResourceType = "dashboard" -) - -var allowedDashboardResourceTypeEnumValues = []DashboardResourceType{ - DASHBOARDRESOURCETYPE_DASHBOARD, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DashboardResourceType) GetAllowedValues() []DashboardResourceType { - return allowedDashboardResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DashboardResourceType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DashboardResourceType(value) - return nil -} - -// NewDashboardResourceTypeFromValue returns a pointer to a valid DashboardResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDashboardResourceTypeFromValue(v string) (*DashboardResourceType, error) { - ev := DashboardResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DashboardResourceType: valid values are %v", v, allowedDashboardResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DashboardResourceType) IsValid() bool { - for _, existing := range allowedDashboardResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DashboardResourceType value. -func (v DashboardResourceType) Ptr() *DashboardResourceType { - return &v -} - -// NullableDashboardResourceType handles when a null is used for DashboardResourceType. -type NullableDashboardResourceType struct { - value *DashboardResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardResourceType) Get() *DashboardResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardResourceType) Set(val *DashboardResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardResourceType initializes the struct as if Set has been called. -func NewNullableDashboardResourceType(val *DashboardResourceType) *NullableDashboardResourceType { - return &NullableDashboardResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_dashboard_restore_request.go b/api/v1/datadog/model_dashboard_restore_request.go deleted file mode 100644 index 329bda2791e..00000000000 --- a/api/v1/datadog/model_dashboard_restore_request.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardRestoreRequest Dashboard restore request body. -type DashboardRestoreRequest struct { - // List of dashboard bulk action request data objects. - Data []DashboardBulkActionData `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{} -} - -// NewDashboardRestoreRequest instantiates a new DashboardRestoreRequest 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 NewDashboardRestoreRequest(data []DashboardBulkActionData) *DashboardRestoreRequest { - this := DashboardRestoreRequest{} - this.Data = data - return &this -} - -// NewDashboardRestoreRequestWithDefaults instantiates a new DashboardRestoreRequest 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 NewDashboardRestoreRequestWithDefaults() *DashboardRestoreRequest { - this := DashboardRestoreRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *DashboardRestoreRequest) GetData() []DashboardBulkActionData { - if o == nil { - var ret []DashboardBulkActionData - 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 *DashboardRestoreRequest) GetDataOk() (*[]DashboardBulkActionData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *DashboardRestoreRequest) SetData(v []DashboardBulkActionData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardRestoreRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardRestoreRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]DashboardBulkActionData `json:"data"` - }{} - all := struct { - Data []DashboardBulkActionData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_dashboard_summary.go b/api/v1/datadog/model_dashboard_summary.go deleted file mode 100644 index ced1626f741..00000000000 --- a/api/v1/datadog/model_dashboard_summary.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardSummary Dashboard summary response. -type DashboardSummary struct { - // List of dashboard definitions. - Dashboards []DashboardSummaryDefinition `json:"dashboards,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{} -} - -// NewDashboardSummary instantiates a new DashboardSummary 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 NewDashboardSummary() *DashboardSummary { - this := DashboardSummary{} - return &this -} - -// NewDashboardSummaryWithDefaults instantiates a new DashboardSummary 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 NewDashboardSummaryWithDefaults() *DashboardSummary { - this := DashboardSummary{} - return &this -} - -// GetDashboards returns the Dashboards field value if set, zero value otherwise. -func (o *DashboardSummary) GetDashboards() []DashboardSummaryDefinition { - if o == nil || o.Dashboards == nil { - var ret []DashboardSummaryDefinition - return ret - } - return o.Dashboards -} - -// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummary) GetDashboardsOk() (*[]DashboardSummaryDefinition, bool) { - if o == nil || o.Dashboards == nil { - return nil, false - } - return &o.Dashboards, true -} - -// HasDashboards returns a boolean if a field has been set. -func (o *DashboardSummary) HasDashboards() bool { - if o != nil && o.Dashboards != nil { - return true - } - - return false -} - -// SetDashboards gets a reference to the given []DashboardSummaryDefinition and assigns it to the Dashboards field. -func (o *DashboardSummary) SetDashboards(v []DashboardSummaryDefinition) { - o.Dashboards = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardSummary) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Dashboards != nil { - toSerialize["dashboards"] = o.Dashboards - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardSummary) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Dashboards []DashboardSummaryDefinition `json:"dashboards,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Dashboards = all.Dashboards - return nil -} diff --git a/api/v1/datadog/model_dashboard_summary_definition.go b/api/v1/datadog/model_dashboard_summary_definition.go deleted file mode 100644 index d4c81fe70be..00000000000 --- a/api/v1/datadog/model_dashboard_summary_definition.go +++ /dev/null @@ -1,444 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DashboardSummaryDefinition Dashboard definition. -type DashboardSummaryDefinition struct { - // Identifier of the dashboard author. - AuthorHandle *string `json:"author_handle,omitempty"` - // Creation date of the dashboard. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Description of the dashboard. - Description common.NullableString `json:"description,omitempty"` - // Dashboard identifier. - Id *string `json:"id,omitempty"` - // Whether this dashboard is read-only. If True, only the author and admins can make changes to it. - IsReadOnly *bool `json:"is_read_only,omitempty"` - // Layout type of the dashboard. - LayoutType *DashboardLayoutType `json:"layout_type,omitempty"` - // Modification date of the dashboard. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // Title of the dashboard. - Title *string `json:"title,omitempty"` - // URL of the dashboard. - Url *string `json:"url,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{} -} - -// NewDashboardSummaryDefinition instantiates a new DashboardSummaryDefinition 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 NewDashboardSummaryDefinition() *DashboardSummaryDefinition { - this := DashboardSummaryDefinition{} - return &this -} - -// NewDashboardSummaryDefinitionWithDefaults instantiates a new DashboardSummaryDefinition 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 NewDashboardSummaryDefinitionWithDefaults() *DashboardSummaryDefinition { - this := DashboardSummaryDefinition{} - return &this -} - -// GetAuthorHandle returns the AuthorHandle field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetAuthorHandle() string { - if o == nil || o.AuthorHandle == nil { - var ret string - return ret - } - return *o.AuthorHandle -} - -// GetAuthorHandleOk returns a tuple with the AuthorHandle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetAuthorHandleOk() (*string, bool) { - if o == nil || o.AuthorHandle == nil { - return nil, false - } - return o.AuthorHandle, true -} - -// HasAuthorHandle returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasAuthorHandle() bool { - if o != nil && o.AuthorHandle != nil { - return true - } - - return false -} - -// SetAuthorHandle gets a reference to the given string and assigns it to the AuthorHandle field. -func (o *DashboardSummaryDefinition) SetAuthorHandle(v string) { - o.AuthorHandle = &v -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *DashboardSummaryDefinition) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DashboardSummaryDefinition) GetDescription() string { - if o == nil || o.Description.Get() == nil { - var ret string - return ret - } - return *o.Description.Get() -} - -// GetDescriptionOk returns a tuple with the Description 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 *DashboardSummaryDefinition) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Description.Get(), o.Description.IsSet() -} - -// HasDescription returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasDescription() bool { - if o != nil && o.Description.IsSet() { - return true - } - - return false -} - -// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. -func (o *DashboardSummaryDefinition) SetDescription(v string) { - o.Description.Set(&v) -} - -// SetDescriptionNil sets the value for Description to be an explicit nil. -func (o *DashboardSummaryDefinition) SetDescriptionNil() { - o.Description.Set(nil) -} - -// UnsetDescription ensures that no value is present for Description, not even an explicit nil. -func (o *DashboardSummaryDefinition) UnsetDescription() { - o.Description.Unset() -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *DashboardSummaryDefinition) SetId(v string) { - o.Id = &v -} - -// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetIsReadOnly() bool { - if o == nil || o.IsReadOnly == nil { - var ret bool - return ret - } - return *o.IsReadOnly -} - -// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetIsReadOnlyOk() (*bool, bool) { - if o == nil || o.IsReadOnly == nil { - return nil, false - } - return o.IsReadOnly, true -} - -// HasIsReadOnly returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasIsReadOnly() bool { - if o != nil && o.IsReadOnly != nil { - return true - } - - return false -} - -// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. -func (o *DashboardSummaryDefinition) SetIsReadOnly(v bool) { - o.IsReadOnly = &v -} - -// GetLayoutType returns the LayoutType field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetLayoutType() DashboardLayoutType { - if o == nil || o.LayoutType == nil { - var ret DashboardLayoutType - return ret - } - return *o.LayoutType -} - -// GetLayoutTypeOk returns a tuple with the LayoutType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetLayoutTypeOk() (*DashboardLayoutType, bool) { - if o == nil || o.LayoutType == nil { - return nil, false - } - return o.LayoutType, true -} - -// HasLayoutType returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasLayoutType() bool { - if o != nil && o.LayoutType != nil { - return true - } - - return false -} - -// SetLayoutType gets a reference to the given DashboardLayoutType and assigns it to the LayoutType field. -func (o *DashboardSummaryDefinition) SetLayoutType(v DashboardLayoutType) { - o.LayoutType = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *DashboardSummaryDefinition) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *DashboardSummaryDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *DashboardSummaryDefinition) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardSummaryDefinition) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *DashboardSummaryDefinition) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *DashboardSummaryDefinition) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardSummaryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AuthorHandle != nil { - toSerialize["author_handle"] = o.AuthorHandle - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Description.IsSet() { - toSerialize["description"] = o.Description.Get() - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IsReadOnly != nil { - toSerialize["is_read_only"] = o.IsReadOnly - } - if o.LayoutType != nil { - toSerialize["layout_type"] = o.LayoutType - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardSummaryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AuthorHandle *string `json:"author_handle,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Description common.NullableString `json:"description,omitempty"` - Id *string `json:"id,omitempty"` - IsReadOnly *bool `json:"is_read_only,omitempty"` - LayoutType *DashboardLayoutType `json:"layout_type,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Title *string `json:"title,omitempty"` - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LayoutType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AuthorHandle = all.AuthorHandle - o.CreatedAt = all.CreatedAt - o.Description = all.Description - o.Id = all.Id - o.IsReadOnly = all.IsReadOnly - o.LayoutType = all.LayoutType - o.ModifiedAt = all.ModifiedAt - o.Title = all.Title - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_dashboard_template_variable.go b/api/v1/datadog/model_dashboard_template_variable.go deleted file mode 100644 index 6ce40d1c720..00000000000 --- a/api/v1/datadog/model_dashboard_template_variable.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DashboardTemplateVariable Template variable. -type DashboardTemplateVariable struct { - // The list of values that the template variable drop-down is limited to. - AvailableValues []string `json:"available_values,omitempty"` - // The default value for the template variable on dashboard load. - Default common.NullableString `json:"default,omitempty"` - // The name of the variable. - Name string `json:"name"` - // The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down. - Prefix common.NullableString `json:"prefix,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{} -} - -// NewDashboardTemplateVariable instantiates a new DashboardTemplateVariable 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 NewDashboardTemplateVariable(name string) *DashboardTemplateVariable { - this := DashboardTemplateVariable{} - this.Name = name - return &this -} - -// NewDashboardTemplateVariableWithDefaults instantiates a new DashboardTemplateVariable 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 NewDashboardTemplateVariableWithDefaults() *DashboardTemplateVariable { - this := DashboardTemplateVariable{} - return &this -} - -// GetAvailableValues returns the AvailableValues field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DashboardTemplateVariable) GetAvailableValues() []string { - if o == nil { - var ret []string - return ret - } - return o.AvailableValues -} - -// GetAvailableValuesOk returns a tuple with the AvailableValues 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 *DashboardTemplateVariable) GetAvailableValuesOk() (*[]string, bool) { - if o == nil || o.AvailableValues == nil { - return nil, false - } - return &o.AvailableValues, true -} - -// HasAvailableValues returns a boolean if a field has been set. -func (o *DashboardTemplateVariable) HasAvailableValues() bool { - if o != nil && o.AvailableValues != nil { - return true - } - - return false -} - -// SetAvailableValues gets a reference to the given []string and assigns it to the AvailableValues field. -func (o *DashboardTemplateVariable) SetAvailableValues(v []string) { - o.AvailableValues = v -} - -// GetDefault returns the Default field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DashboardTemplateVariable) GetDefault() string { - if o == nil || o.Default.Get() == nil { - var ret string - return ret - } - return *o.Default.Get() -} - -// GetDefaultOk returns a tuple with the Default 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 *DashboardTemplateVariable) GetDefaultOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Default.Get(), o.Default.IsSet() -} - -// HasDefault returns a boolean if a field has been set. -func (o *DashboardTemplateVariable) HasDefault() bool { - if o != nil && o.Default.IsSet() { - return true - } - - return false -} - -// SetDefault gets a reference to the given common.NullableString and assigns it to the Default field. -func (o *DashboardTemplateVariable) SetDefault(v string) { - o.Default.Set(&v) -} - -// SetDefaultNil sets the value for Default to be an explicit nil. -func (o *DashboardTemplateVariable) SetDefaultNil() { - o.Default.Set(nil) -} - -// UnsetDefault ensures that no value is present for Default, not even an explicit nil. -func (o *DashboardTemplateVariable) UnsetDefault() { - o.Default.Unset() -} - -// GetName returns the Name field value. -func (o *DashboardTemplateVariable) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *DashboardTemplateVariable) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *DashboardTemplateVariable) SetName(v string) { - o.Name = v -} - -// GetPrefix returns the Prefix field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DashboardTemplateVariable) GetPrefix() string { - if o == nil || o.Prefix.Get() == nil { - var ret string - return ret - } - return *o.Prefix.Get() -} - -// GetPrefixOk returns a tuple with the Prefix 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 *DashboardTemplateVariable) GetPrefixOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Prefix.Get(), o.Prefix.IsSet() -} - -// HasPrefix returns a boolean if a field has been set. -func (o *DashboardTemplateVariable) HasPrefix() bool { - if o != nil && o.Prefix.IsSet() { - return true - } - - return false -} - -// SetPrefix gets a reference to the given common.NullableString and assigns it to the Prefix field. -func (o *DashboardTemplateVariable) SetPrefix(v string) { - o.Prefix.Set(&v) -} - -// SetPrefixNil sets the value for Prefix to be an explicit nil. -func (o *DashboardTemplateVariable) SetPrefixNil() { - o.Prefix.Set(nil) -} - -// UnsetPrefix ensures that no value is present for Prefix, not even an explicit nil. -func (o *DashboardTemplateVariable) UnsetPrefix() { - o.Prefix.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardTemplateVariable) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AvailableValues != nil { - toSerialize["available_values"] = o.AvailableValues - } - if o.Default.IsSet() { - toSerialize["default"] = o.Default.Get() - } - toSerialize["name"] = o.Name - if o.Prefix.IsSet() { - toSerialize["prefix"] = o.Prefix.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - AvailableValues []string `json:"available_values,omitempty"` - Default common.NullableString `json:"default,omitempty"` - Name string `json:"name"` - Prefix common.NullableString `json:"prefix,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AvailableValues = all.AvailableValues - o.Default = all.Default - o.Name = all.Name - o.Prefix = all.Prefix - return nil -} diff --git a/api/v1/datadog/model_dashboard_template_variable_preset.go b/api/v1/datadog/model_dashboard_template_variable_preset.go deleted file mode 100644 index 0b286022367..00000000000 --- a/api/v1/datadog/model_dashboard_template_variable_preset.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardTemplateVariablePreset Template variables saved views. -type DashboardTemplateVariablePreset struct { - // The name of the variable. - Name *string `json:"name,omitempty"` - // List of variables. - TemplateVariables []DashboardTemplateVariablePresetValue `json:"template_variables,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{} -} - -// NewDashboardTemplateVariablePreset instantiates a new DashboardTemplateVariablePreset 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 NewDashboardTemplateVariablePreset() *DashboardTemplateVariablePreset { - this := DashboardTemplateVariablePreset{} - return &this -} - -// NewDashboardTemplateVariablePresetWithDefaults instantiates a new DashboardTemplateVariablePreset 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 NewDashboardTemplateVariablePresetWithDefaults() *DashboardTemplateVariablePreset { - this := DashboardTemplateVariablePreset{} - return &this -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *DashboardTemplateVariablePreset) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardTemplateVariablePreset) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *DashboardTemplateVariablePreset) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *DashboardTemplateVariablePreset) SetName(v string) { - o.Name = &v -} - -// GetTemplateVariables returns the TemplateVariables field value if set, zero value otherwise. -func (o *DashboardTemplateVariablePreset) GetTemplateVariables() []DashboardTemplateVariablePresetValue { - if o == nil || o.TemplateVariables == nil { - var ret []DashboardTemplateVariablePresetValue - return ret - } - return o.TemplateVariables -} - -// GetTemplateVariablesOk returns a tuple with the TemplateVariables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardTemplateVariablePreset) GetTemplateVariablesOk() (*[]DashboardTemplateVariablePresetValue, bool) { - if o == nil || o.TemplateVariables == nil { - return nil, false - } - return &o.TemplateVariables, true -} - -// HasTemplateVariables returns a boolean if a field has been set. -func (o *DashboardTemplateVariablePreset) HasTemplateVariables() bool { - if o != nil && o.TemplateVariables != nil { - return true - } - - return false -} - -// SetTemplateVariables gets a reference to the given []DashboardTemplateVariablePresetValue and assigns it to the TemplateVariables field. -func (o *DashboardTemplateVariablePreset) SetTemplateVariables(v []DashboardTemplateVariablePresetValue) { - o.TemplateVariables = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardTemplateVariablePreset) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.TemplateVariables != nil { - toSerialize["template_variables"] = o.TemplateVariables - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardTemplateVariablePreset) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Name *string `json:"name,omitempty"` - TemplateVariables []DashboardTemplateVariablePresetValue `json:"template_variables,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - o.TemplateVariables = all.TemplateVariables - return nil -} diff --git a/api/v1/datadog/model_dashboard_template_variable_preset_value.go b/api/v1/datadog/model_dashboard_template_variable_preset_value.go deleted file mode 100644 index d27a57fab9b..00000000000 --- a/api/v1/datadog/model_dashboard_template_variable_preset_value.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardTemplateVariablePresetValue Template variables saved views. -type DashboardTemplateVariablePresetValue struct { - // The name of the variable. - Name *string `json:"name,omitempty"` - // The value of the template variable within the saved view. - Value *string `json:"value,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{} -} - -// NewDashboardTemplateVariablePresetValue instantiates a new DashboardTemplateVariablePresetValue 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 NewDashboardTemplateVariablePresetValue() *DashboardTemplateVariablePresetValue { - this := DashboardTemplateVariablePresetValue{} - return &this -} - -// NewDashboardTemplateVariablePresetValueWithDefaults instantiates a new DashboardTemplateVariablePresetValue 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 NewDashboardTemplateVariablePresetValueWithDefaults() *DashboardTemplateVariablePresetValue { - this := DashboardTemplateVariablePresetValue{} - return &this -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *DashboardTemplateVariablePresetValue) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardTemplateVariablePresetValue) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *DashboardTemplateVariablePresetValue) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *DashboardTemplateVariablePresetValue) SetName(v string) { - o.Name = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *DashboardTemplateVariablePresetValue) GetValue() string { - if o == nil || o.Value == nil { - var ret string - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardTemplateVariablePresetValue) GetValueOk() (*string, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *DashboardTemplateVariablePresetValue) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given string and assigns it to the Value field. -func (o *DashboardTemplateVariablePresetValue) SetValue(v string) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardTemplateVariablePresetValue) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardTemplateVariablePresetValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_deleted_monitor.go b/api/v1/datadog/model_deleted_monitor.go deleted file mode 100644 index 86a32af8f69..00000000000 --- a/api/v1/datadog/model_deleted_monitor.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DeletedMonitor Response from the delete monitor call. -type DeletedMonitor struct { - // ID of the deleted monitor. - DeletedMonitorId *int64 `json:"deleted_monitor_id,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{} -} - -// NewDeletedMonitor instantiates a new DeletedMonitor 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 NewDeletedMonitor() *DeletedMonitor { - this := DeletedMonitor{} - return &this -} - -// NewDeletedMonitorWithDefaults instantiates a new DeletedMonitor 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 NewDeletedMonitorWithDefaults() *DeletedMonitor { - this := DeletedMonitor{} - return &this -} - -// GetDeletedMonitorId returns the DeletedMonitorId field value if set, zero value otherwise. -func (o *DeletedMonitor) GetDeletedMonitorId() int64 { - if o == nil || o.DeletedMonitorId == nil { - var ret int64 - return ret - } - return *o.DeletedMonitorId -} - -// GetDeletedMonitorIdOk returns a tuple with the DeletedMonitorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DeletedMonitor) GetDeletedMonitorIdOk() (*int64, bool) { - if o == nil || o.DeletedMonitorId == nil { - return nil, false - } - return o.DeletedMonitorId, true -} - -// HasDeletedMonitorId returns a boolean if a field has been set. -func (o *DeletedMonitor) HasDeletedMonitorId() bool { - if o != nil && o.DeletedMonitorId != nil { - return true - } - - return false -} - -// SetDeletedMonitorId gets a reference to the given int64 and assigns it to the DeletedMonitorId field. -func (o *DeletedMonitor) SetDeletedMonitorId(v int64) { - o.DeletedMonitorId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DeletedMonitor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DeletedMonitorId != nil { - toSerialize["deleted_monitor_id"] = o.DeletedMonitorId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DeletedMonitor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DeletedMonitorId *int64 `json:"deleted_monitor_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DeletedMonitorId = all.DeletedMonitorId - return nil -} diff --git a/api/v1/datadog/model_distribution_point_item.go b/api/v1/datadog/model_distribution_point_item.go deleted file mode 100644 index c33484d5f3a..00000000000 --- a/api/v1/datadog/model_distribution_point_item.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DistributionPointItem - List of distribution point. -type DistributionPointItem struct { - DistributionPointTimestamp *float64 - DistributionPointData *[]float64 - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// DistributionPointTimestampAsDistributionPointItem is a convenience function that returns float64 wrapped in DistributionPointItem. -func DistributionPointTimestampAsDistributionPointItem(v *float64) DistributionPointItem { - return DistributionPointItem{DistributionPointTimestamp: v} -} - -// DistributionPointDataAsDistributionPointItem is a convenience function that returns []float64 wrapped in DistributionPointItem. -func DistributionPointDataAsDistributionPointItem(v *[]float64) DistributionPointItem { - return DistributionPointItem{DistributionPointData: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *DistributionPointItem) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into DistributionPointTimestamp - err = json.Unmarshal(data, &obj.DistributionPointTimestamp) - if err == nil { - if obj.DistributionPointTimestamp != nil { - jsonDistributionPointTimestamp, _ := json.Marshal(obj.DistributionPointTimestamp) - if string(jsonDistributionPointTimestamp) == "{}" { // empty struct - obj.DistributionPointTimestamp = nil - } else { - match++ - } - } else { - obj.DistributionPointTimestamp = nil - } - } else { - obj.DistributionPointTimestamp = nil - } - - // try to unmarshal data into DistributionPointData - err = json.Unmarshal(data, &obj.DistributionPointData) - if err == nil { - if obj.DistributionPointData != nil { - jsonDistributionPointData, _ := json.Marshal(obj.DistributionPointData) - if string(jsonDistributionPointData) == "{}" { // empty struct - obj.DistributionPointData = nil - } else { - match++ - } - } else { - obj.DistributionPointData = nil - } - } else { - obj.DistributionPointData = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.DistributionPointTimestamp = nil - obj.DistributionPointData = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj DistributionPointItem) MarshalJSON() ([]byte, error) { - if obj.DistributionPointTimestamp != nil { - return json.Marshal(&obj.DistributionPointTimestamp) - } - - if obj.DistributionPointData != nil { - return json.Marshal(&obj.DistributionPointData) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *DistributionPointItem) GetActualInstance() interface{} { - if obj.DistributionPointTimestamp != nil { - return obj.DistributionPointTimestamp - } - - if obj.DistributionPointData != nil { - return obj.DistributionPointData - } - - // all schemas are nil - return nil -} - -// NullableDistributionPointItem handles when a null is used for DistributionPointItem. -type NullableDistributionPointItem struct { - value *DistributionPointItem - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionPointItem) Get() *DistributionPointItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionPointItem) Set(val *DistributionPointItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionPointItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableDistributionPointItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionPointItem initializes the struct as if Set has been called. -func NewNullableDistributionPointItem(val *DistributionPointItem) *NullableDistributionPointItem { - return &NullableDistributionPointItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionPointItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionPointItem) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_distribution_points_content_encoding.go b/api/v1/datadog/model_distribution_points_content_encoding.go deleted file mode 100644 index 8b770b886ca..00000000000 --- a/api/v1/datadog/model_distribution_points_content_encoding.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DistributionPointsContentEncoding HTTP header used to compress the media-type. -type DistributionPointsContentEncoding string - -// List of DistributionPointsContentEncoding. -const ( - DISTRIBUTIONPOINTSCONTENTENCODING_DEFLATE DistributionPointsContentEncoding = "deflate" -) - -var allowedDistributionPointsContentEncodingEnumValues = []DistributionPointsContentEncoding{ - DISTRIBUTIONPOINTSCONTENTENCODING_DEFLATE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DistributionPointsContentEncoding) GetAllowedValues() []DistributionPointsContentEncoding { - return allowedDistributionPointsContentEncodingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DistributionPointsContentEncoding) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DistributionPointsContentEncoding(value) - return nil -} - -// NewDistributionPointsContentEncodingFromValue returns a pointer to a valid DistributionPointsContentEncoding -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDistributionPointsContentEncodingFromValue(v string) (*DistributionPointsContentEncoding, error) { - ev := DistributionPointsContentEncoding(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DistributionPointsContentEncoding: valid values are %v", v, allowedDistributionPointsContentEncodingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DistributionPointsContentEncoding) IsValid() bool { - for _, existing := range allowedDistributionPointsContentEncodingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DistributionPointsContentEncoding value. -func (v DistributionPointsContentEncoding) Ptr() *DistributionPointsContentEncoding { - return &v -} - -// NullableDistributionPointsContentEncoding handles when a null is used for DistributionPointsContentEncoding. -type NullableDistributionPointsContentEncoding struct { - value *DistributionPointsContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionPointsContentEncoding) Get() *DistributionPointsContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionPointsContentEncoding) Set(val *DistributionPointsContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionPointsContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionPointsContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionPointsContentEncoding initializes the struct as if Set has been called. -func NewNullableDistributionPointsContentEncoding(val *DistributionPointsContentEncoding) *NullableDistributionPointsContentEncoding { - return &NullableDistributionPointsContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionPointsContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionPointsContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_distribution_points_payload.go b/api/v1/datadog/model_distribution_points_payload.go deleted file mode 100644 index 5264e294702..00000000000 --- a/api/v1/datadog/model_distribution_points_payload.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DistributionPointsPayload The distribution points payload. -type DistributionPointsPayload struct { - // A list of distribution points series to submit to Datadog. - Series []DistributionPointsSeries `json:"series"` - // 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{} -} - -// NewDistributionPointsPayload instantiates a new DistributionPointsPayload 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 NewDistributionPointsPayload(series []DistributionPointsSeries) *DistributionPointsPayload { - this := DistributionPointsPayload{} - this.Series = series - return &this -} - -// NewDistributionPointsPayloadWithDefaults instantiates a new DistributionPointsPayload 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 NewDistributionPointsPayloadWithDefaults() *DistributionPointsPayload { - this := DistributionPointsPayload{} - return &this -} - -// GetSeries returns the Series field value. -func (o *DistributionPointsPayload) GetSeries() []DistributionPointsSeries { - if o == nil { - var ret []DistributionPointsSeries - return ret - } - return o.Series -} - -// GetSeriesOk returns a tuple with the Series field value -// and a boolean to check if the value has been set. -func (o *DistributionPointsPayload) GetSeriesOk() (*[]DistributionPointsSeries, bool) { - if o == nil { - return nil, false - } - return &o.Series, true -} - -// SetSeries sets field value. -func (o *DistributionPointsPayload) SetSeries(v []DistributionPointsSeries) { - o.Series = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DistributionPointsPayload) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["series"] = o.Series - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DistributionPointsPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Series *[]DistributionPointsSeries `json:"series"` - }{} - all := struct { - Series []DistributionPointsSeries `json:"series"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Series == nil { - return fmt.Errorf("Required field series missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Series = all.Series - return nil -} diff --git a/api/v1/datadog/model_distribution_points_series.go b/api/v1/datadog/model_distribution_points_series.go deleted file mode 100644 index 4874ff8e599..00000000000 --- a/api/v1/datadog/model_distribution_points_series.go +++ /dev/null @@ -1,265 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DistributionPointsSeries A distribution points metric to submit to Datadog. -type DistributionPointsSeries struct { - // The name of the host that produced the distribution point metric. - Host *string `json:"host,omitempty"` - // The name of the distribution points metric. - Metric string `json:"metric"` - // Points relating to the distribution point metric. All points must be tuples with timestamp and a list of values (cannot be a string). Timestamps should be in POSIX time in seconds. - Points [][]DistributionPointItem `json:"points"` - // A list of tags associated with the distribution point metric. - Tags []string `json:"tags,omitempty"` - // The type of the distribution point. - Type *DistributionPointsType `json:"type,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{} -} - -// NewDistributionPointsSeries instantiates a new DistributionPointsSeries 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 NewDistributionPointsSeries(metric string, points [][]DistributionPointItem) *DistributionPointsSeries { - this := DistributionPointsSeries{} - this.Metric = metric - this.Points = points - var typeVar DistributionPointsType = DISTRIBUTIONPOINTSTYPE_DISTRIBUTION - this.Type = &typeVar - return &this -} - -// NewDistributionPointsSeriesWithDefaults instantiates a new DistributionPointsSeries 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 NewDistributionPointsSeriesWithDefaults() *DistributionPointsSeries { - this := DistributionPointsSeries{} - var typeVar DistributionPointsType = DISTRIBUTIONPOINTSTYPE_DISTRIBUTION - this.Type = &typeVar - return &this -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *DistributionPointsSeries) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionPointsSeries) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *DistributionPointsSeries) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *DistributionPointsSeries) SetHost(v string) { - o.Host = &v -} - -// GetMetric returns the Metric field value. -func (o *DistributionPointsSeries) GetMetric() string { - if o == nil { - var ret string - return ret - } - return o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value -// and a boolean to check if the value has been set. -func (o *DistributionPointsSeries) GetMetricOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Metric, true -} - -// SetMetric sets field value. -func (o *DistributionPointsSeries) SetMetric(v string) { - o.Metric = v -} - -// GetPoints returns the Points field value. -func (o *DistributionPointsSeries) GetPoints() [][]DistributionPointItem { - if o == nil { - var ret [][]DistributionPointItem - return ret - } - return o.Points -} - -// GetPointsOk returns a tuple with the Points field value -// and a boolean to check if the value has been set. -func (o *DistributionPointsSeries) GetPointsOk() (*[][]DistributionPointItem, bool) { - if o == nil { - return nil, false - } - return &o.Points, true -} - -// SetPoints sets field value. -func (o *DistributionPointsSeries) SetPoints(v [][]DistributionPointItem) { - o.Points = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *DistributionPointsSeries) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *DistributionPointsSeries) GetTagsOk() (*[]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 *DistributionPointsSeries) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *DistributionPointsSeries) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *DistributionPointsSeries) GetType() DistributionPointsType { - if o == nil || o.Type == nil { - var ret DistributionPointsType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionPointsSeries) GetTypeOk() (*DistributionPointsType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *DistributionPointsSeries) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given DistributionPointsType and assigns it to the Type field. -func (o *DistributionPointsSeries) SetType(v DistributionPointsType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DistributionPointsSeries) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - toSerialize["metric"] = o.Metric - toSerialize["points"] = o.Points - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Metric *string `json:"metric"` - Points *[][]DistributionPointItem `json:"points"` - }{} - all := struct { - Host *string `json:"host,omitempty"` - Metric string `json:"metric"` - Points [][]DistributionPointItem `json:"points"` - Tags []string `json:"tags,omitempty"` - Type *DistributionPointsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("Required field metric missing") - } - if required.Points == nil { - return fmt.Errorf("Required field points missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Host = all.Host - o.Metric = all.Metric - o.Points = all.Points - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_distribution_points_type.go b/api/v1/datadog/model_distribution_points_type.go deleted file mode 100644 index 08ed0979b9d..00000000000 --- a/api/v1/datadog/model_distribution_points_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DistributionPointsType The type of the distribution point. -type DistributionPointsType string - -// List of DistributionPointsType. -const ( - DISTRIBUTIONPOINTSTYPE_DISTRIBUTION DistributionPointsType = "distribution" -) - -var allowedDistributionPointsTypeEnumValues = []DistributionPointsType{ - DISTRIBUTIONPOINTSTYPE_DISTRIBUTION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DistributionPointsType) GetAllowedValues() []DistributionPointsType { - return allowedDistributionPointsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DistributionPointsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DistributionPointsType(value) - return nil -} - -// NewDistributionPointsTypeFromValue returns a pointer to a valid DistributionPointsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDistributionPointsTypeFromValue(v string) (*DistributionPointsType, error) { - ev := DistributionPointsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DistributionPointsType: valid values are %v", v, allowedDistributionPointsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DistributionPointsType) IsValid() bool { - for _, existing := range allowedDistributionPointsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DistributionPointsType value. -func (v DistributionPointsType) Ptr() *DistributionPointsType { - return &v -} - -// NullableDistributionPointsType handles when a null is used for DistributionPointsType. -type NullableDistributionPointsType struct { - value *DistributionPointsType - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionPointsType) Get() *DistributionPointsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionPointsType) Set(val *DistributionPointsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionPointsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionPointsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionPointsType initializes the struct as if Set has been called. -func NewNullableDistributionPointsType(val *DistributionPointsType) *NullableDistributionPointsType { - return &NullableDistributionPointsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionPointsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionPointsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_distribution_widget_definition.go b/api/v1/datadog/model_distribution_widget_definition.go deleted file mode 100644 index cc71850961d..00000000000 --- a/api/v1/datadog/model_distribution_widget_definition.go +++ /dev/null @@ -1,539 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DistributionWidgetDefinition The Distribution visualization is another way of showing metrics -// aggregated across one or several tags, such as hosts. -// Unlike the heat map, a distribution graph’s x-axis is quantity rather than time. -type DistributionWidgetDefinition struct { - // (Deprecated) The widget legend was replaced by a tooltip and sidebar. - // Deprecated - LegendSize *string `json:"legend_size,omitempty"` - // List of markers. - Markers []WidgetMarker `json:"markers,omitempty"` - // Array of one request object to display in the widget. - // - // See the dedicated [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json) - // to learn how to build the `REQUEST_SCHEMA`. - Requests []DistributionWidgetRequest `json:"requests"` - // (Deprecated) The widget legend was replaced by a tooltip and sidebar. - // Deprecated - ShowLegend *bool `json:"show_legend,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the distribution widget. - Type DistributionWidgetDefinitionType `json:"type"` - // X Axis controls for the distribution widget. - Xaxis *DistributionWidgetXAxis `json:"xaxis,omitempty"` - // Y Axis controls for the distribution widget. - Yaxis *DistributionWidgetYAxis `json:"yaxis,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{} -} - -// NewDistributionWidgetDefinition instantiates a new DistributionWidgetDefinition 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 NewDistributionWidgetDefinition(requests []DistributionWidgetRequest, typeVar DistributionWidgetDefinitionType) *DistributionWidgetDefinition { - this := DistributionWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewDistributionWidgetDefinitionWithDefaults instantiates a new DistributionWidgetDefinition 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 NewDistributionWidgetDefinitionWithDefaults() *DistributionWidgetDefinition { - this := DistributionWidgetDefinition{} - var typeVar DistributionWidgetDefinitionType = DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION - this.Type = typeVar - return &this -} - -// GetLegendSize returns the LegendSize field value if set, zero value otherwise. -// Deprecated -func (o *DistributionWidgetDefinition) GetLegendSize() string { - if o == nil || o.LegendSize == nil { - var ret string - return ret - } - return *o.LegendSize -} - -// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *DistributionWidgetDefinition) GetLegendSizeOk() (*string, bool) { - if o == nil || o.LegendSize == nil { - return nil, false - } - return o.LegendSize, true -} - -// HasLegendSize returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasLegendSize() bool { - if o != nil && o.LegendSize != nil { - return true - } - - return false -} - -// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. -// Deprecated -func (o *DistributionWidgetDefinition) SetLegendSize(v string) { - o.LegendSize = &v -} - -// GetMarkers returns the Markers field value if set, zero value otherwise. -func (o *DistributionWidgetDefinition) GetMarkers() []WidgetMarker { - if o == nil || o.Markers == nil { - var ret []WidgetMarker - return ret - } - return o.Markers -} - -// GetMarkersOk returns a tuple with the Markers field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetMarkersOk() (*[]WidgetMarker, bool) { - if o == nil || o.Markers == nil { - return nil, false - } - return &o.Markers, true -} - -// HasMarkers returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasMarkers() bool { - if o != nil && o.Markers != nil { - return true - } - - return false -} - -// SetMarkers gets a reference to the given []WidgetMarker and assigns it to the Markers field. -func (o *DistributionWidgetDefinition) SetMarkers(v []WidgetMarker) { - o.Markers = v -} - -// GetRequests returns the Requests field value. -func (o *DistributionWidgetDefinition) GetRequests() []DistributionWidgetRequest { - if o == nil { - var ret []DistributionWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetRequestsOk() (*[]DistributionWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *DistributionWidgetDefinition) SetRequests(v []DistributionWidgetRequest) { - o.Requests = v -} - -// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. -// Deprecated -func (o *DistributionWidgetDefinition) GetShowLegend() bool { - if o == nil || o.ShowLegend == nil { - var ret bool - return ret - } - return *o.ShowLegend -} - -// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *DistributionWidgetDefinition) GetShowLegendOk() (*bool, bool) { - if o == nil || o.ShowLegend == nil { - return nil, false - } - return o.ShowLegend, true -} - -// HasShowLegend returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasShowLegend() bool { - if o != nil && o.ShowLegend != nil { - return true - } - - return false -} - -// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. -// Deprecated -func (o *DistributionWidgetDefinition) SetShowLegend(v bool) { - o.ShowLegend = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *DistributionWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *DistributionWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *DistributionWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *DistributionWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *DistributionWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *DistributionWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *DistributionWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *DistributionWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *DistributionWidgetDefinition) GetType() DistributionWidgetDefinitionType { - if o == nil { - var ret DistributionWidgetDefinitionType - 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 *DistributionWidgetDefinition) GetTypeOk() (*DistributionWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *DistributionWidgetDefinition) SetType(v DistributionWidgetDefinitionType) { - o.Type = v -} - -// GetXaxis returns the Xaxis field value if set, zero value otherwise. -func (o *DistributionWidgetDefinition) GetXaxis() DistributionWidgetXAxis { - if o == nil || o.Xaxis == nil { - var ret DistributionWidgetXAxis - return ret - } - return *o.Xaxis -} - -// GetXaxisOk returns a tuple with the Xaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetXaxisOk() (*DistributionWidgetXAxis, bool) { - if o == nil || o.Xaxis == nil { - return nil, false - } - return o.Xaxis, true -} - -// HasXaxis returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasXaxis() bool { - if o != nil && o.Xaxis != nil { - return true - } - - return false -} - -// SetXaxis gets a reference to the given DistributionWidgetXAxis and assigns it to the Xaxis field. -func (o *DistributionWidgetDefinition) SetXaxis(v DistributionWidgetXAxis) { - o.Xaxis = &v -} - -// GetYaxis returns the Yaxis field value if set, zero value otherwise. -func (o *DistributionWidgetDefinition) GetYaxis() DistributionWidgetYAxis { - if o == nil || o.Yaxis == nil { - var ret DistributionWidgetYAxis - return ret - } - return *o.Yaxis -} - -// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetDefinition) GetYaxisOk() (*DistributionWidgetYAxis, bool) { - if o == nil || o.Yaxis == nil { - return nil, false - } - return o.Yaxis, true -} - -// HasYaxis returns a boolean if a field has been set. -func (o *DistributionWidgetDefinition) HasYaxis() bool { - if o != nil && o.Yaxis != nil { - return true - } - - return false -} - -// SetYaxis gets a reference to the given DistributionWidgetYAxis and assigns it to the Yaxis field. -func (o *DistributionWidgetDefinition) SetYaxis(v DistributionWidgetYAxis) { - o.Yaxis = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DistributionWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LegendSize != nil { - toSerialize["legend_size"] = o.LegendSize - } - if o.Markers != nil { - toSerialize["markers"] = o.Markers - } - toSerialize["requests"] = o.Requests - if o.ShowLegend != nil { - toSerialize["show_legend"] = o.ShowLegend - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - if o.Xaxis != nil { - toSerialize["xaxis"] = o.Xaxis - } - if o.Yaxis != nil { - toSerialize["yaxis"] = o.Yaxis - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]DistributionWidgetRequest `json:"requests"` - Type *DistributionWidgetDefinitionType `json:"type"` - }{} - all := struct { - LegendSize *string `json:"legend_size,omitempty"` - Markers []WidgetMarker `json:"markers,omitempty"` - Requests []DistributionWidgetRequest `json:"requests"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type DistributionWidgetDefinitionType `json:"type"` - Xaxis *DistributionWidgetXAxis `json:"xaxis,omitempty"` - Yaxis *DistributionWidgetYAxis `json:"yaxis,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LegendSize = all.LegendSize - o.Markers = all.Markers - o.Requests = all.Requests - o.ShowLegend = all.ShowLegend - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Xaxis = all.Xaxis - if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Yaxis = all.Yaxis - return nil -} diff --git a/api/v1/datadog/model_distribution_widget_definition_type.go b/api/v1/datadog/model_distribution_widget_definition_type.go deleted file mode 100644 index b1052ca6ef3..00000000000 --- a/api/v1/datadog/model_distribution_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DistributionWidgetDefinitionType Type of the distribution widget. -type DistributionWidgetDefinitionType string - -// List of DistributionWidgetDefinitionType. -const ( - DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION DistributionWidgetDefinitionType = "distribution" -) - -var allowedDistributionWidgetDefinitionTypeEnumValues = []DistributionWidgetDefinitionType{ - DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DistributionWidgetDefinitionType) GetAllowedValues() []DistributionWidgetDefinitionType { - return allowedDistributionWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DistributionWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DistributionWidgetDefinitionType(value) - return nil -} - -// NewDistributionWidgetDefinitionTypeFromValue returns a pointer to a valid DistributionWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDistributionWidgetDefinitionTypeFromValue(v string) (*DistributionWidgetDefinitionType, error) { - ev := DistributionWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DistributionWidgetDefinitionType: valid values are %v", v, allowedDistributionWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DistributionWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedDistributionWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DistributionWidgetDefinitionType value. -func (v DistributionWidgetDefinitionType) Ptr() *DistributionWidgetDefinitionType { - return &v -} - -// NullableDistributionWidgetDefinitionType handles when a null is used for DistributionWidgetDefinitionType. -type NullableDistributionWidgetDefinitionType struct { - value *DistributionWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionWidgetDefinitionType) Get() *DistributionWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionWidgetDefinitionType) Set(val *DistributionWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableDistributionWidgetDefinitionType(val *DistributionWidgetDefinitionType) *NullableDistributionWidgetDefinitionType { - return &NullableDistributionWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_distribution_widget_histogram_request_query.go b/api/v1/datadog/model_distribution_widget_histogram_request_query.go deleted file mode 100644 index b781bf109c0..00000000000 --- a/api/v1/datadog/model_distribution_widget_histogram_request_query.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DistributionWidgetHistogramRequestQuery - Query definition for Distribution Widget Histogram Request -type DistributionWidgetHistogramRequestQuery struct { - FormulaAndFunctionMetricQueryDefinition *FormulaAndFunctionMetricQueryDefinition - FormulaAndFunctionEventQueryDefinition *FormulaAndFunctionEventQueryDefinition - FormulaAndFunctionApmResourceStatsQueryDefinition *FormulaAndFunctionApmResourceStatsQueryDefinition - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// FormulaAndFunctionMetricQueryDefinitionAsDistributionWidgetHistogramRequestQuery is a convenience function that returns FormulaAndFunctionMetricQueryDefinition wrapped in DistributionWidgetHistogramRequestQuery. -func FormulaAndFunctionMetricQueryDefinitionAsDistributionWidgetHistogramRequestQuery(v *FormulaAndFunctionMetricQueryDefinition) DistributionWidgetHistogramRequestQuery { - return DistributionWidgetHistogramRequestQuery{FormulaAndFunctionMetricQueryDefinition: v} -} - -// FormulaAndFunctionEventQueryDefinitionAsDistributionWidgetHistogramRequestQuery is a convenience function that returns FormulaAndFunctionEventQueryDefinition wrapped in DistributionWidgetHistogramRequestQuery. -func FormulaAndFunctionEventQueryDefinitionAsDistributionWidgetHistogramRequestQuery(v *FormulaAndFunctionEventQueryDefinition) DistributionWidgetHistogramRequestQuery { - return DistributionWidgetHistogramRequestQuery{FormulaAndFunctionEventQueryDefinition: v} -} - -// FormulaAndFunctionApmResourceStatsQueryDefinitionAsDistributionWidgetHistogramRequestQuery is a convenience function that returns FormulaAndFunctionApmResourceStatsQueryDefinition wrapped in DistributionWidgetHistogramRequestQuery. -func FormulaAndFunctionApmResourceStatsQueryDefinitionAsDistributionWidgetHistogramRequestQuery(v *FormulaAndFunctionApmResourceStatsQueryDefinition) DistributionWidgetHistogramRequestQuery { - return DistributionWidgetHistogramRequestQuery{FormulaAndFunctionApmResourceStatsQueryDefinition: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *DistributionWidgetHistogramRequestQuery) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into FormulaAndFunctionMetricQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionMetricQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionMetricQueryDefinition != nil && obj.FormulaAndFunctionMetricQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionMetricQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionMetricQueryDefinition) - if string(jsonFormulaAndFunctionMetricQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionMetricQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionMetricQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionMetricQueryDefinition = nil - } - - // try to unmarshal data into FormulaAndFunctionEventQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionEventQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionEventQueryDefinition != nil && obj.FormulaAndFunctionEventQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionEventQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionEventQueryDefinition) - if string(jsonFormulaAndFunctionEventQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionEventQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionEventQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionEventQueryDefinition = nil - } - - // try to unmarshal data into FormulaAndFunctionApmResourceStatsQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionApmResourceStatsQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil && obj.FormulaAndFunctionApmResourceStatsQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionApmResourceStatsQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionApmResourceStatsQueryDefinition) - if string(jsonFormulaAndFunctionApmResourceStatsQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.FormulaAndFunctionMetricQueryDefinition = nil - obj.FormulaAndFunctionEventQueryDefinition = nil - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj DistributionWidgetHistogramRequestQuery) MarshalJSON() ([]byte, error) { - if obj.FormulaAndFunctionMetricQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionMetricQueryDefinition) - } - - if obj.FormulaAndFunctionEventQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionEventQueryDefinition) - } - - if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionApmResourceStatsQueryDefinition) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *DistributionWidgetHistogramRequestQuery) GetActualInstance() interface{} { - if obj.FormulaAndFunctionMetricQueryDefinition != nil { - return obj.FormulaAndFunctionMetricQueryDefinition - } - - if obj.FormulaAndFunctionEventQueryDefinition != nil { - return obj.FormulaAndFunctionEventQueryDefinition - } - - if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { - return obj.FormulaAndFunctionApmResourceStatsQueryDefinition - } - - // all schemas are nil - return nil -} - -// NullableDistributionWidgetHistogramRequestQuery handles when a null is used for DistributionWidgetHistogramRequestQuery. -type NullableDistributionWidgetHistogramRequestQuery struct { - value *DistributionWidgetHistogramRequestQuery - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionWidgetHistogramRequestQuery) Get() *DistributionWidgetHistogramRequestQuery { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionWidgetHistogramRequestQuery) Set(val *DistributionWidgetHistogramRequestQuery) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionWidgetHistogramRequestQuery) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableDistributionWidgetHistogramRequestQuery) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionWidgetHistogramRequestQuery initializes the struct as if Set has been called. -func NewNullableDistributionWidgetHistogramRequestQuery(val *DistributionWidgetHistogramRequestQuery) *NullableDistributionWidgetHistogramRequestQuery { - return &NullableDistributionWidgetHistogramRequestQuery{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionWidgetHistogramRequestQuery) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionWidgetHistogramRequestQuery) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_distribution_widget_histogram_request_type.go b/api/v1/datadog/model_distribution_widget_histogram_request_type.go deleted file mode 100644 index 2d25202874a..00000000000 --- a/api/v1/datadog/model_distribution_widget_histogram_request_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DistributionWidgetHistogramRequestType Request type for the histogram request. -type DistributionWidgetHistogramRequestType string - -// List of DistributionWidgetHistogramRequestType. -const ( - DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM DistributionWidgetHistogramRequestType = "histogram" -) - -var allowedDistributionWidgetHistogramRequestTypeEnumValues = []DistributionWidgetHistogramRequestType{ - DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DistributionWidgetHistogramRequestType) GetAllowedValues() []DistributionWidgetHistogramRequestType { - return allowedDistributionWidgetHistogramRequestTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DistributionWidgetHistogramRequestType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DistributionWidgetHistogramRequestType(value) - return nil -} - -// NewDistributionWidgetHistogramRequestTypeFromValue returns a pointer to a valid DistributionWidgetHistogramRequestType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDistributionWidgetHistogramRequestTypeFromValue(v string) (*DistributionWidgetHistogramRequestType, error) { - ev := DistributionWidgetHistogramRequestType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DistributionWidgetHistogramRequestType: valid values are %v", v, allowedDistributionWidgetHistogramRequestTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DistributionWidgetHistogramRequestType) IsValid() bool { - for _, existing := range allowedDistributionWidgetHistogramRequestTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DistributionWidgetHistogramRequestType value. -func (v DistributionWidgetHistogramRequestType) Ptr() *DistributionWidgetHistogramRequestType { - return &v -} - -// NullableDistributionWidgetHistogramRequestType handles when a null is used for DistributionWidgetHistogramRequestType. -type NullableDistributionWidgetHistogramRequestType struct { - value *DistributionWidgetHistogramRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableDistributionWidgetHistogramRequestType) Get() *DistributionWidgetHistogramRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDistributionWidgetHistogramRequestType) Set(val *DistributionWidgetHistogramRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDistributionWidgetHistogramRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDistributionWidgetHistogramRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDistributionWidgetHistogramRequestType initializes the struct as if Set has been called. -func NewNullableDistributionWidgetHistogramRequestType(val *DistributionWidgetHistogramRequestType) *NullableDistributionWidgetHistogramRequestType { - return &NullableDistributionWidgetHistogramRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDistributionWidgetHistogramRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDistributionWidgetHistogramRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_distribution_widget_request.go b/api/v1/datadog/model_distribution_widget_request.go deleted file mode 100644 index abac82b5928..00000000000 --- a/api/v1/datadog/model_distribution_widget_request.go +++ /dev/null @@ -1,648 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DistributionWidgetRequest Updated distribution widget. -type DistributionWidgetRequest struct { - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The APM stats query for table and distributions widgets. - ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Widget query. - Q *string `json:"q,omitempty"` - // Query definition for Distribution Widget Histogram Request - Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` - // Request type for the histogram request. - RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - // Widget style definition. - Style *WidgetStyle `json:"style,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{} -} - -// NewDistributionWidgetRequest instantiates a new DistributionWidgetRequest 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 NewDistributionWidgetRequest() *DistributionWidgetRequest { - this := DistributionWidgetRequest{} - return &this -} - -// NewDistributionWidgetRequestWithDefaults instantiates a new DistributionWidgetRequest 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 NewDistributionWidgetRequestWithDefaults() *DistributionWidgetRequest { - this := DistributionWidgetRequest{} - return &this -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *DistributionWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetApmStatsQuery returns the ApmStatsQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetApmStatsQuery() ApmStatsQueryDefinition { - if o == nil || o.ApmStatsQuery == nil { - var ret ApmStatsQueryDefinition - return ret - } - return *o.ApmStatsQuery -} - -// GetApmStatsQueryOk returns a tuple with the ApmStatsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetApmStatsQueryOk() (*ApmStatsQueryDefinition, bool) { - if o == nil || o.ApmStatsQuery == nil { - return nil, false - } - return o.ApmStatsQuery, true -} - -// HasApmStatsQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasApmStatsQuery() bool { - if o != nil && o.ApmStatsQuery != nil { - return true - } - - return false -} - -// SetApmStatsQuery gets a reference to the given ApmStatsQueryDefinition and assigns it to the ApmStatsQuery field. -func (o *DistributionWidgetRequest) SetApmStatsQuery(v ApmStatsQueryDefinition) { - o.ApmStatsQuery = &v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *DistributionWidgetRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *DistributionWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *DistributionWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *DistributionWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *DistributionWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *DistributionWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetQuery() DistributionWidgetHistogramRequestQuery { - if o == nil || o.Query == nil { - var ret DistributionWidgetHistogramRequestQuery - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetQueryOk() (*DistributionWidgetHistogramRequestQuery, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given DistributionWidgetHistogramRequestQuery and assigns it to the Query field. -func (o *DistributionWidgetRequest) SetQuery(v DistributionWidgetHistogramRequestQuery) { - o.Query = &v -} - -// GetRequestType returns the RequestType field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetRequestType() DistributionWidgetHistogramRequestType { - if o == nil || o.RequestType == nil { - var ret DistributionWidgetHistogramRequestType - return ret - } - return *o.RequestType -} - -// GetRequestTypeOk returns a tuple with the RequestType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetRequestTypeOk() (*DistributionWidgetHistogramRequestType, bool) { - if o == nil || o.RequestType == nil { - return nil, false - } - return o.RequestType, true -} - -// HasRequestType returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasRequestType() bool { - if o != nil && o.RequestType != nil { - return true - } - - return false -} - -// SetRequestType gets a reference to the given DistributionWidgetHistogramRequestType and assigns it to the RequestType field. -func (o *DistributionWidgetRequest) SetRequestType(v DistributionWidgetHistogramRequestType) { - o.RequestType = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *DistributionWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *DistributionWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// GetStyle returns the Style field value if set, zero value otherwise. -func (o *DistributionWidgetRequest) GetStyle() WidgetStyle { - if o == nil || o.Style == nil { - var ret WidgetStyle - return ret - } - return *o.Style -} - -// GetStyleOk returns a tuple with the Style field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetRequest) GetStyleOk() (*WidgetStyle, bool) { - if o == nil || o.Style == nil { - return nil, false - } - return o.Style, true -} - -// HasStyle returns a boolean if a field has been set. -func (o *DistributionWidgetRequest) HasStyle() bool { - if o != nil && o.Style != nil { - return true - } - - return false -} - -// SetStyle gets a reference to the given WidgetStyle and assigns it to the Style field. -func (o *DistributionWidgetRequest) SetStyle(v WidgetStyle) { - o.Style = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DistributionWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.ApmStatsQuery != nil { - toSerialize["apm_stats_query"] = o.ApmStatsQuery - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.RequestType != nil { - toSerialize["request_type"] = o.RequestType - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - if o.Style != nil { - toSerialize["style"] = o.Style - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` - RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - Style *WidgetStyle `json:"style,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.RequestType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.ApmStatsQuery != nil && all.ApmStatsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmStatsQuery = all.ApmStatsQuery - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - o.Query = all.Query - o.RequestType = all.RequestType - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Style = all.Style - return nil -} diff --git a/api/v1/datadog/model_distribution_widget_x_axis.go b/api/v1/datadog/model_distribution_widget_x_axis.go deleted file mode 100644 index fee4f35f7da..00000000000 --- a/api/v1/datadog/model_distribution_widget_x_axis.go +++ /dev/null @@ -1,231 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DistributionWidgetXAxis X Axis controls for the distribution widget. -type DistributionWidgetXAxis struct { - // True includes zero. - IncludeZero *bool `json:"include_zero,omitempty"` - // Specifies maximum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. - Max *string `json:"max,omitempty"` - // Specifies minimum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. - Min *string `json:"min,omitempty"` - // Specifies the scale type. Possible values are `linear`. - Scale *string `json:"scale,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{} -} - -// NewDistributionWidgetXAxis instantiates a new DistributionWidgetXAxis 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 NewDistributionWidgetXAxis() *DistributionWidgetXAxis { - this := DistributionWidgetXAxis{} - var max string = "auto" - this.Max = &max - var min string = "auto" - this.Min = &min - var scale string = "linear" - this.Scale = &scale - return &this -} - -// NewDistributionWidgetXAxisWithDefaults instantiates a new DistributionWidgetXAxis 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 NewDistributionWidgetXAxisWithDefaults() *DistributionWidgetXAxis { - this := DistributionWidgetXAxis{} - var max string = "auto" - this.Max = &max - var min string = "auto" - this.Min = &min - var scale string = "linear" - this.Scale = &scale - return &this -} - -// GetIncludeZero returns the IncludeZero field value if set, zero value otherwise. -func (o *DistributionWidgetXAxis) GetIncludeZero() bool { - if o == nil || o.IncludeZero == nil { - var ret bool - return ret - } - return *o.IncludeZero -} - -// GetIncludeZeroOk returns a tuple with the IncludeZero field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetXAxis) GetIncludeZeroOk() (*bool, bool) { - if o == nil || o.IncludeZero == nil { - return nil, false - } - return o.IncludeZero, true -} - -// HasIncludeZero returns a boolean if a field has been set. -func (o *DistributionWidgetXAxis) HasIncludeZero() bool { - if o != nil && o.IncludeZero != nil { - return true - } - - return false -} - -// SetIncludeZero gets a reference to the given bool and assigns it to the IncludeZero field. -func (o *DistributionWidgetXAxis) SetIncludeZero(v bool) { - o.IncludeZero = &v -} - -// GetMax returns the Max field value if set, zero value otherwise. -func (o *DistributionWidgetXAxis) GetMax() string { - if o == nil || o.Max == nil { - var ret string - return ret - } - return *o.Max -} - -// GetMaxOk returns a tuple with the Max field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetXAxis) GetMaxOk() (*string, bool) { - if o == nil || o.Max == nil { - return nil, false - } - return o.Max, true -} - -// HasMax returns a boolean if a field has been set. -func (o *DistributionWidgetXAxis) HasMax() bool { - if o != nil && o.Max != nil { - return true - } - - return false -} - -// SetMax gets a reference to the given string and assigns it to the Max field. -func (o *DistributionWidgetXAxis) SetMax(v string) { - o.Max = &v -} - -// GetMin returns the Min field value if set, zero value otherwise. -func (o *DistributionWidgetXAxis) GetMin() string { - if o == nil || o.Min == nil { - var ret string - return ret - } - return *o.Min -} - -// GetMinOk returns a tuple with the Min field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetXAxis) GetMinOk() (*string, bool) { - if o == nil || o.Min == nil { - return nil, false - } - return o.Min, true -} - -// HasMin returns a boolean if a field has been set. -func (o *DistributionWidgetXAxis) HasMin() bool { - if o != nil && o.Min != nil { - return true - } - - return false -} - -// SetMin gets a reference to the given string and assigns it to the Min field. -func (o *DistributionWidgetXAxis) SetMin(v string) { - o.Min = &v -} - -// GetScale returns the Scale field value if set, zero value otherwise. -func (o *DistributionWidgetXAxis) GetScale() string { - if o == nil || o.Scale == nil { - var ret string - return ret - } - return *o.Scale -} - -// GetScaleOk returns a tuple with the Scale field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetXAxis) GetScaleOk() (*string, bool) { - if o == nil || o.Scale == nil { - return nil, false - } - return o.Scale, true -} - -// HasScale returns a boolean if a field has been set. -func (o *DistributionWidgetXAxis) HasScale() bool { - if o != nil && o.Scale != nil { - return true - } - - return false -} - -// SetScale gets a reference to the given string and assigns it to the Scale field. -func (o *DistributionWidgetXAxis) SetScale(v string) { - o.Scale = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DistributionWidgetXAxis) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IncludeZero != nil { - toSerialize["include_zero"] = o.IncludeZero - } - if o.Max != nil { - toSerialize["max"] = o.Max - } - if o.Min != nil { - toSerialize["min"] = o.Min - } - if o.Scale != nil { - toSerialize["scale"] = o.Scale - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IncludeZero *bool `json:"include_zero,omitempty"` - Max *string `json:"max,omitempty"` - Min *string `json:"min,omitempty"` - Scale *string `json:"scale,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IncludeZero = all.IncludeZero - o.Max = all.Max - o.Min = all.Min - o.Scale = all.Scale - return nil -} diff --git a/api/v1/datadog/model_distribution_widget_y_axis.go b/api/v1/datadog/model_distribution_widget_y_axis.go deleted file mode 100644 index c071c8fe1e7..00000000000 --- a/api/v1/datadog/model_distribution_widget_y_axis.go +++ /dev/null @@ -1,270 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DistributionWidgetYAxis Y Axis controls for the distribution widget. -type DistributionWidgetYAxis struct { - // True includes zero. - IncludeZero *bool `json:"include_zero,omitempty"` - // The label of the axis to display on the graph. - Label *string `json:"label,omitempty"` - // Specifies the maximum value to show on the y-axis. It takes a number, or auto for default behavior. - Max *string `json:"max,omitempty"` - // Specifies minimum value to show on the y-axis. It takes a number, or auto for default behavior. - Min *string `json:"min,omitempty"` - // Specifies the scale type. Possible values are `linear` or `log`. - Scale *string `json:"scale,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{} -} - -// NewDistributionWidgetYAxis instantiates a new DistributionWidgetYAxis 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 NewDistributionWidgetYAxis() *DistributionWidgetYAxis { - this := DistributionWidgetYAxis{} - var max string = "auto" - this.Max = &max - var min string = "auto" - this.Min = &min - var scale string = "linear" - this.Scale = &scale - return &this -} - -// NewDistributionWidgetYAxisWithDefaults instantiates a new DistributionWidgetYAxis 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 NewDistributionWidgetYAxisWithDefaults() *DistributionWidgetYAxis { - this := DistributionWidgetYAxis{} - var max string = "auto" - this.Max = &max - var min string = "auto" - this.Min = &min - var scale string = "linear" - this.Scale = &scale - return &this -} - -// GetIncludeZero returns the IncludeZero field value if set, zero value otherwise. -func (o *DistributionWidgetYAxis) GetIncludeZero() bool { - if o == nil || o.IncludeZero == nil { - var ret bool - return ret - } - return *o.IncludeZero -} - -// GetIncludeZeroOk returns a tuple with the IncludeZero field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetYAxis) GetIncludeZeroOk() (*bool, bool) { - if o == nil || o.IncludeZero == nil { - return nil, false - } - return o.IncludeZero, true -} - -// HasIncludeZero returns a boolean if a field has been set. -func (o *DistributionWidgetYAxis) HasIncludeZero() bool { - if o != nil && o.IncludeZero != nil { - return true - } - - return false -} - -// SetIncludeZero gets a reference to the given bool and assigns it to the IncludeZero field. -func (o *DistributionWidgetYAxis) SetIncludeZero(v bool) { - o.IncludeZero = &v -} - -// GetLabel returns the Label field value if set, zero value otherwise. -func (o *DistributionWidgetYAxis) GetLabel() string { - if o == nil || o.Label == nil { - var ret string - return ret - } - return *o.Label -} - -// GetLabelOk returns a tuple with the Label field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetYAxis) GetLabelOk() (*string, bool) { - if o == nil || o.Label == nil { - return nil, false - } - return o.Label, true -} - -// HasLabel returns a boolean if a field has been set. -func (o *DistributionWidgetYAxis) HasLabel() bool { - if o != nil && o.Label != nil { - return true - } - - return false -} - -// SetLabel gets a reference to the given string and assigns it to the Label field. -func (o *DistributionWidgetYAxis) SetLabel(v string) { - o.Label = &v -} - -// GetMax returns the Max field value if set, zero value otherwise. -func (o *DistributionWidgetYAxis) GetMax() string { - if o == nil || o.Max == nil { - var ret string - return ret - } - return *o.Max -} - -// GetMaxOk returns a tuple with the Max field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetYAxis) GetMaxOk() (*string, bool) { - if o == nil || o.Max == nil { - return nil, false - } - return o.Max, true -} - -// HasMax returns a boolean if a field has been set. -func (o *DistributionWidgetYAxis) HasMax() bool { - if o != nil && o.Max != nil { - return true - } - - return false -} - -// SetMax gets a reference to the given string and assigns it to the Max field. -func (o *DistributionWidgetYAxis) SetMax(v string) { - o.Max = &v -} - -// GetMin returns the Min field value if set, zero value otherwise. -func (o *DistributionWidgetYAxis) GetMin() string { - if o == nil || o.Min == nil { - var ret string - return ret - } - return *o.Min -} - -// GetMinOk returns a tuple with the Min field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetYAxis) GetMinOk() (*string, bool) { - if o == nil || o.Min == nil { - return nil, false - } - return o.Min, true -} - -// HasMin returns a boolean if a field has been set. -func (o *DistributionWidgetYAxis) HasMin() bool { - if o != nil && o.Min != nil { - return true - } - - return false -} - -// SetMin gets a reference to the given string and assigns it to the Min field. -func (o *DistributionWidgetYAxis) SetMin(v string) { - o.Min = &v -} - -// GetScale returns the Scale field value if set, zero value otherwise. -func (o *DistributionWidgetYAxis) GetScale() string { - if o == nil || o.Scale == nil { - var ret string - return ret - } - return *o.Scale -} - -// GetScaleOk returns a tuple with the Scale field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DistributionWidgetYAxis) GetScaleOk() (*string, bool) { - if o == nil || o.Scale == nil { - return nil, false - } - return o.Scale, true -} - -// HasScale returns a boolean if a field has been set. -func (o *DistributionWidgetYAxis) HasScale() bool { - if o != nil && o.Scale != nil { - return true - } - - return false -} - -// SetScale gets a reference to the given string and assigns it to the Scale field. -func (o *DistributionWidgetYAxis) SetScale(v string) { - o.Scale = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DistributionWidgetYAxis) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IncludeZero != nil { - toSerialize["include_zero"] = o.IncludeZero - } - if o.Label != nil { - toSerialize["label"] = o.Label - } - if o.Max != nil { - toSerialize["max"] = o.Max - } - if o.Min != nil { - toSerialize["min"] = o.Min - } - if o.Scale != nil { - toSerialize["scale"] = o.Scale - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DistributionWidgetYAxis) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IncludeZero *bool `json:"include_zero,omitempty"` - Label *string `json:"label,omitempty"` - Max *string `json:"max,omitempty"` - Min *string `json:"min,omitempty"` - Scale *string `json:"scale,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IncludeZero = all.IncludeZero - o.Label = all.Label - o.Max = all.Max - o.Min = all.Min - o.Scale = all.Scale - return nil -} diff --git a/api/v1/datadog/model_downtime.go b/api/v1/datadog/model_downtime.go deleted file mode 100644 index c68eb44af44..00000000000 --- a/api/v1/datadog/model_downtime.go +++ /dev/null @@ -1,859 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// Downtime Downtiming gives you greater control over monitor notifications by -// allowing you to globally exclude scopes from alerting. -// Downtime settings, which can be scheduled with start and end times, -// prevent all alerting related to specified Datadog tags. -type Downtime struct { - // If a scheduled downtime currently exists. - Active *bool `json:"active,omitempty"` - // The downtime object definition of the active child for the original parent recurring downtime. This - // field will only exist on recurring downtimes. - ActiveChild NullableDowntimeChild `json:"active_child,omitempty"` - // If a scheduled downtime is canceled. - Canceled common.NullableInt64 `json:"canceled,omitempty"` - // User ID of the downtime creator. - CreatorId *int32 `json:"creator_id,omitempty"` - // If a downtime has been disabled. - Disabled *bool `json:"disabled,omitempty"` - // `0` for a downtime applied on `*` or all, - // `1` when the downtime is only scoped to hosts, - // or `2` when the downtime is scoped to anything but hosts. - DowntimeType *int32 `json:"downtime_type,omitempty"` - // POSIX timestamp to end the downtime. If not provided, - // the downtime is in effect indefinitely until you cancel it. - End common.NullableInt64 `json:"end,omitempty"` - // The downtime ID. - Id *int64 `json:"id,omitempty"` - // A message to include with notifications for this downtime. - // Email notifications can be sent to specific users by using the same `@username` notation as events. - Message *string `json:"message,omitempty"` - // A single monitor to which the downtime applies. - // If not provided, the downtime applies to all monitors. - MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` - // A comma-separated list of monitor tags. For example, tags that are applied directly to monitors, - // not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. - // The resulting downtime applies to monitors that match ALL provided monitor tags. - // For example, `service:postgres` **AND** `team:frontend`. - MonitorTags []string `json:"monitor_tags,omitempty"` - // If the first recovery notification during a downtime should be muted. - MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` - // ID of the parent Downtime. - ParentId common.NullableInt64 `json:"parent_id,omitempty"` - // An object defining the recurrence of the downtime. - Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` - // The scope(s) to which the downtime applies. For example, `host:app2`. - // Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. - // The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`). - Scope []string `json:"scope,omitempty"` - // POSIX timestamp to start the downtime. - // If not provided, the downtime starts the moment it is created. - Start *int64 `json:"start,omitempty"` - // The timezone in which to display the downtime's start and end times in Datadog applications. - Timezone *string `json:"timezone,omitempty"` - // ID of the last user that updated the downtime. - UpdaterId common.NullableInt32 `json:"updater_id,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{} -} - -// NewDowntime instantiates a new Downtime 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 NewDowntime() *Downtime { - this := Downtime{} - return &this -} - -// NewDowntimeWithDefaults instantiates a new Downtime 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 NewDowntimeWithDefaults() *Downtime { - this := Downtime{} - return &this -} - -// GetActive returns the Active field value if set, zero value otherwise. -func (o *Downtime) GetActive() bool { - if o == nil || o.Active == nil { - var ret bool - return ret - } - return *o.Active -} - -// GetActiveOk returns a tuple with the Active field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetActiveOk() (*bool, bool) { - if o == nil || o.Active == nil { - return nil, false - } - return o.Active, true -} - -// HasActive returns a boolean if a field has been set. -func (o *Downtime) HasActive() bool { - if o != nil && o.Active != nil { - return true - } - - return false -} - -// SetActive gets a reference to the given bool and assigns it to the Active field. -func (o *Downtime) SetActive(v bool) { - o.Active = &v -} - -// GetActiveChild returns the ActiveChild field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Downtime) GetActiveChild() DowntimeChild { - if o == nil || o.ActiveChild.Get() == nil { - var ret DowntimeChild - return ret - } - return *o.ActiveChild.Get() -} - -// GetActiveChildOk returns a tuple with the ActiveChild 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 *Downtime) GetActiveChildOk() (*DowntimeChild, bool) { - if o == nil { - return nil, false - } - return o.ActiveChild.Get(), o.ActiveChild.IsSet() -} - -// HasActiveChild returns a boolean if a field has been set. -func (o *Downtime) HasActiveChild() bool { - if o != nil && o.ActiveChild.IsSet() { - return true - } - - return false -} - -// SetActiveChild gets a reference to the given NullableDowntimeChild and assigns it to the ActiveChild field. -func (o *Downtime) SetActiveChild(v DowntimeChild) { - o.ActiveChild.Set(&v) -} - -// SetActiveChildNil sets the value for ActiveChild to be an explicit nil. -func (o *Downtime) SetActiveChildNil() { - o.ActiveChild.Set(nil) -} - -// UnsetActiveChild ensures that no value is present for ActiveChild, not even an explicit nil. -func (o *Downtime) UnsetActiveChild() { - o.ActiveChild.Unset() -} - -// GetCanceled returns the Canceled field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Downtime) GetCanceled() int64 { - if o == nil || o.Canceled.Get() == nil { - var ret int64 - return ret - } - return *o.Canceled.Get() -} - -// GetCanceledOk returns a tuple with the Canceled 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 *Downtime) GetCanceledOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Canceled.Get(), o.Canceled.IsSet() -} - -// HasCanceled returns a boolean if a field has been set. -func (o *Downtime) HasCanceled() bool { - if o != nil && o.Canceled.IsSet() { - return true - } - - return false -} - -// SetCanceled gets a reference to the given common.NullableInt64 and assigns it to the Canceled field. -func (o *Downtime) SetCanceled(v int64) { - o.Canceled.Set(&v) -} - -// SetCanceledNil sets the value for Canceled to be an explicit nil. -func (o *Downtime) SetCanceledNil() { - o.Canceled.Set(nil) -} - -// UnsetCanceled ensures that no value is present for Canceled, not even an explicit nil. -func (o *Downtime) UnsetCanceled() { - o.Canceled.Unset() -} - -// GetCreatorId returns the CreatorId field value if set, zero value otherwise. -func (o *Downtime) GetCreatorId() int32 { - if o == nil || o.CreatorId == nil { - var ret int32 - return ret - } - return *o.CreatorId -} - -// GetCreatorIdOk returns a tuple with the CreatorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetCreatorIdOk() (*int32, bool) { - if o == nil || o.CreatorId == nil { - return nil, false - } - return o.CreatorId, true -} - -// HasCreatorId returns a boolean if a field has been set. -func (o *Downtime) HasCreatorId() bool { - if o != nil && o.CreatorId != nil { - return true - } - - return false -} - -// SetCreatorId gets a reference to the given int32 and assigns it to the CreatorId field. -func (o *Downtime) SetCreatorId(v int32) { - o.CreatorId = &v -} - -// GetDisabled returns the Disabled field value if set, zero value otherwise. -func (o *Downtime) GetDisabled() bool { - if o == nil || o.Disabled == nil { - var ret bool - return ret - } - return *o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetDisabledOk() (*bool, bool) { - if o == nil || o.Disabled == nil { - return nil, false - } - return o.Disabled, true -} - -// HasDisabled returns a boolean if a field has been set. -func (o *Downtime) HasDisabled() bool { - if o != nil && o.Disabled != nil { - return true - } - - return false -} - -// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. -func (o *Downtime) SetDisabled(v bool) { - o.Disabled = &v -} - -// GetDowntimeType returns the DowntimeType field value if set, zero value otherwise. -func (o *Downtime) GetDowntimeType() int32 { - if o == nil || o.DowntimeType == nil { - var ret int32 - return ret - } - return *o.DowntimeType -} - -// GetDowntimeTypeOk returns a tuple with the DowntimeType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetDowntimeTypeOk() (*int32, bool) { - if o == nil || o.DowntimeType == nil { - return nil, false - } - return o.DowntimeType, true -} - -// HasDowntimeType returns a boolean if a field has been set. -func (o *Downtime) HasDowntimeType() bool { - if o != nil && o.DowntimeType != nil { - return true - } - - return false -} - -// SetDowntimeType gets a reference to the given int32 and assigns it to the DowntimeType field. -func (o *Downtime) SetDowntimeType(v int32) { - o.DowntimeType = &v -} - -// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Downtime) GetEnd() int64 { - if o == nil || o.End.Get() == nil { - var ret int64 - return ret - } - return *o.End.Get() -} - -// GetEndOk returns a tuple with the End 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 *Downtime) GetEndOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.End.Get(), o.End.IsSet() -} - -// HasEnd returns a boolean if a field has been set. -func (o *Downtime) HasEnd() bool { - if o != nil && o.End.IsSet() { - return true - } - - return false -} - -// SetEnd gets a reference to the given common.NullableInt64 and assigns it to the End field. -func (o *Downtime) SetEnd(v int64) { - o.End.Set(&v) -} - -// SetEndNil sets the value for End to be an explicit nil. -func (o *Downtime) SetEndNil() { - o.End.Set(nil) -} - -// UnsetEnd ensures that no value is present for End, not even an explicit nil. -func (o *Downtime) UnsetEnd() { - o.End.Unset() -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Downtime) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Downtime) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *Downtime) SetId(v int64) { - o.Id = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *Downtime) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *Downtime) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *Downtime) SetMessage(v string) { - o.Message = &v -} - -// GetMonitorId returns the MonitorId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Downtime) GetMonitorId() int64 { - if o == nil || o.MonitorId.Get() == nil { - var ret int64 - return ret - } - return *o.MonitorId.Get() -} - -// GetMonitorIdOk returns a tuple with the MonitorId 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 *Downtime) GetMonitorIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.MonitorId.Get(), o.MonitorId.IsSet() -} - -// HasMonitorId returns a boolean if a field has been set. -func (o *Downtime) HasMonitorId() bool { - if o != nil && o.MonitorId.IsSet() { - return true - } - - return false -} - -// SetMonitorId gets a reference to the given common.NullableInt64 and assigns it to the MonitorId field. -func (o *Downtime) SetMonitorId(v int64) { - o.MonitorId.Set(&v) -} - -// SetMonitorIdNil sets the value for MonitorId to be an explicit nil. -func (o *Downtime) SetMonitorIdNil() { - o.MonitorId.Set(nil) -} - -// UnsetMonitorId ensures that no value is present for MonitorId, not even an explicit nil. -func (o *Downtime) UnsetMonitorId() { - o.MonitorId.Unset() -} - -// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. -func (o *Downtime) GetMonitorTags() []string { - if o == nil || o.MonitorTags == nil { - var ret []string - return ret - } - return o.MonitorTags -} - -// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetMonitorTagsOk() (*[]string, bool) { - if o == nil || o.MonitorTags == nil { - return nil, false - } - return &o.MonitorTags, true -} - -// HasMonitorTags returns a boolean if a field has been set. -func (o *Downtime) HasMonitorTags() bool { - if o != nil && o.MonitorTags != nil { - return true - } - - return false -} - -// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. -func (o *Downtime) SetMonitorTags(v []string) { - o.MonitorTags = v -} - -// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise. -func (o *Downtime) GetMuteFirstRecoveryNotification() bool { - if o == nil || o.MuteFirstRecoveryNotification == nil { - var ret bool - return ret - } - return *o.MuteFirstRecoveryNotification -} - -// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetMuteFirstRecoveryNotificationOk() (*bool, bool) { - if o == nil || o.MuteFirstRecoveryNotification == nil { - return nil, false - } - return o.MuteFirstRecoveryNotification, true -} - -// HasMuteFirstRecoveryNotification returns a boolean if a field has been set. -func (o *Downtime) HasMuteFirstRecoveryNotification() bool { - if o != nil && o.MuteFirstRecoveryNotification != nil { - return true - } - - return false -} - -// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field. -func (o *Downtime) SetMuteFirstRecoveryNotification(v bool) { - o.MuteFirstRecoveryNotification = &v -} - -// GetParentId returns the ParentId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Downtime) GetParentId() int64 { - if o == nil || o.ParentId.Get() == nil { - var ret int64 - return ret - } - return *o.ParentId.Get() -} - -// GetParentIdOk returns a tuple with the ParentId 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 *Downtime) GetParentIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.ParentId.Get(), o.ParentId.IsSet() -} - -// HasParentId returns a boolean if a field has been set. -func (o *Downtime) HasParentId() bool { - if o != nil && o.ParentId.IsSet() { - return true - } - - return false -} - -// SetParentId gets a reference to the given common.NullableInt64 and assigns it to the ParentId field. -func (o *Downtime) SetParentId(v int64) { - o.ParentId.Set(&v) -} - -// SetParentIdNil sets the value for ParentId to be an explicit nil. -func (o *Downtime) SetParentIdNil() { - o.ParentId.Set(nil) -} - -// UnsetParentId ensures that no value is present for ParentId, not even an explicit nil. -func (o *Downtime) UnsetParentId() { - o.ParentId.Unset() -} - -// GetRecurrence returns the Recurrence field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Downtime) GetRecurrence() DowntimeRecurrence { - if o == nil || o.Recurrence.Get() == nil { - var ret DowntimeRecurrence - return ret - } - return *o.Recurrence.Get() -} - -// GetRecurrenceOk returns a tuple with the Recurrence 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 *Downtime) GetRecurrenceOk() (*DowntimeRecurrence, bool) { - if o == nil { - return nil, false - } - return o.Recurrence.Get(), o.Recurrence.IsSet() -} - -// HasRecurrence returns a boolean if a field has been set. -func (o *Downtime) HasRecurrence() bool { - if o != nil && o.Recurrence.IsSet() { - return true - } - - return false -} - -// SetRecurrence gets a reference to the given NullableDowntimeRecurrence and assigns it to the Recurrence field. -func (o *Downtime) SetRecurrence(v DowntimeRecurrence) { - o.Recurrence.Set(&v) -} - -// SetRecurrenceNil sets the value for Recurrence to be an explicit nil. -func (o *Downtime) SetRecurrenceNil() { - o.Recurrence.Set(nil) -} - -// UnsetRecurrence ensures that no value is present for Recurrence, not even an explicit nil. -func (o *Downtime) UnsetRecurrence() { - o.Recurrence.Unset() -} - -// GetScope returns the Scope field value if set, zero value otherwise. -func (o *Downtime) GetScope() []string { - if o == nil || o.Scope == nil { - var ret []string - return ret - } - return o.Scope -} - -// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetScopeOk() (*[]string, bool) { - if o == nil || o.Scope == nil { - return nil, false - } - return &o.Scope, true -} - -// HasScope returns a boolean if a field has been set. -func (o *Downtime) HasScope() bool { - if o != nil && o.Scope != nil { - return true - } - - return false -} - -// SetScope gets a reference to the given []string and assigns it to the Scope field. -func (o *Downtime) SetScope(v []string) { - o.Scope = v -} - -// GetStart returns the Start field value if set, zero value otherwise. -func (o *Downtime) GetStart() int64 { - if o == nil || o.Start == nil { - var ret int64 - return ret - } - return *o.Start -} - -// GetStartOk returns a tuple with the Start field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetStartOk() (*int64, bool) { - if o == nil || o.Start == nil { - return nil, false - } - return o.Start, true -} - -// HasStart returns a boolean if a field has been set. -func (o *Downtime) HasStart() bool { - if o != nil && o.Start != nil { - return true - } - - return false -} - -// SetStart gets a reference to the given int64 and assigns it to the Start field. -func (o *Downtime) SetStart(v int64) { - o.Start = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *Downtime) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Downtime) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *Downtime) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *Downtime) SetTimezone(v string) { - o.Timezone = &v -} - -// GetUpdaterId returns the UpdaterId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Downtime) GetUpdaterId() int32 { - if o == nil || o.UpdaterId.Get() == nil { - var ret int32 - return ret - } - return *o.UpdaterId.Get() -} - -// GetUpdaterIdOk returns a tuple with the UpdaterId 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 *Downtime) GetUpdaterIdOk() (*int32, bool) { - if o == nil { - return nil, false - } - return o.UpdaterId.Get(), o.UpdaterId.IsSet() -} - -// HasUpdaterId returns a boolean if a field has been set. -func (o *Downtime) HasUpdaterId() bool { - if o != nil && o.UpdaterId.IsSet() { - return true - } - - return false -} - -// SetUpdaterId gets a reference to the given common.NullableInt32 and assigns it to the UpdaterId field. -func (o *Downtime) SetUpdaterId(v int32) { - o.UpdaterId.Set(&v) -} - -// SetUpdaterIdNil sets the value for UpdaterId to be an explicit nil. -func (o *Downtime) SetUpdaterIdNil() { - o.UpdaterId.Set(nil) -} - -// UnsetUpdaterId ensures that no value is present for UpdaterId, not even an explicit nil. -func (o *Downtime) UnsetUpdaterId() { - o.UpdaterId.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o Downtime) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Active != nil { - toSerialize["active"] = o.Active - } - if o.ActiveChild.IsSet() { - toSerialize["active_child"] = o.ActiveChild.Get() - } - if o.Canceled.IsSet() { - toSerialize["canceled"] = o.Canceled.Get() - } - if o.CreatorId != nil { - toSerialize["creator_id"] = o.CreatorId - } - if o.Disabled != nil { - toSerialize["disabled"] = o.Disabled - } - if o.DowntimeType != nil { - toSerialize["downtime_type"] = o.DowntimeType - } - if o.End.IsSet() { - toSerialize["end"] = o.End.Get() - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.MonitorId.IsSet() { - toSerialize["monitor_id"] = o.MonitorId.Get() - } - if o.MonitorTags != nil { - toSerialize["monitor_tags"] = o.MonitorTags - } - if o.MuteFirstRecoveryNotification != nil { - toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification - } - if o.ParentId.IsSet() { - toSerialize["parent_id"] = o.ParentId.Get() - } - if o.Recurrence.IsSet() { - toSerialize["recurrence"] = o.Recurrence.Get() - } - if o.Scope != nil { - toSerialize["scope"] = o.Scope - } - if o.Start != nil { - toSerialize["start"] = o.Start - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - if o.UpdaterId.IsSet() { - toSerialize["updater_id"] = o.UpdaterId.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Downtime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Active *bool `json:"active,omitempty"` - ActiveChild NullableDowntimeChild `json:"active_child,omitempty"` - Canceled common.NullableInt64 `json:"canceled,omitempty"` - CreatorId *int32 `json:"creator_id,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - DowntimeType *int32 `json:"downtime_type,omitempty"` - End common.NullableInt64 `json:"end,omitempty"` - Id *int64 `json:"id,omitempty"` - Message *string `json:"message,omitempty"` - MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` - MonitorTags []string `json:"monitor_tags,omitempty"` - MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` - ParentId common.NullableInt64 `json:"parent_id,omitempty"` - Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` - Scope []string `json:"scope,omitempty"` - Start *int64 `json:"start,omitempty"` - Timezone *string `json:"timezone,omitempty"` - UpdaterId common.NullableInt32 `json:"updater_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Active = all.Active - o.ActiveChild = all.ActiveChild - o.Canceled = all.Canceled - o.CreatorId = all.CreatorId - o.Disabled = all.Disabled - o.DowntimeType = all.DowntimeType - o.End = all.End - o.Id = all.Id - o.Message = all.Message - o.MonitorId = all.MonitorId - o.MonitorTags = all.MonitorTags - o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification - o.ParentId = all.ParentId - o.Recurrence = all.Recurrence - o.Scope = all.Scope - o.Start = all.Start - o.Timezone = all.Timezone - o.UpdaterId = all.UpdaterId - return nil -} diff --git a/api/v1/datadog/model_downtime_child.go b/api/v1/datadog/model_downtime_child.go deleted file mode 100644 index 7c5438f4ad0..00000000000 --- a/api/v1/datadog/model_downtime_child.go +++ /dev/null @@ -1,856 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DowntimeChild The downtime object definition of the active child for the original parent recurring downtime. This -// field will only exist on recurring downtimes. -type DowntimeChild struct { - // If a scheduled downtime currently exists. - Active *bool `json:"active,omitempty"` - // If a scheduled downtime is canceled. - Canceled common.NullableInt64 `json:"canceled,omitempty"` - // User ID of the downtime creator. - CreatorId *int32 `json:"creator_id,omitempty"` - // If a downtime has been disabled. - Disabled *bool `json:"disabled,omitempty"` - // `0` for a downtime applied on `*` or all, - // `1` when the downtime is only scoped to hosts, - // or `2` when the downtime is scoped to anything but hosts. - DowntimeType *int32 `json:"downtime_type,omitempty"` - // POSIX timestamp to end the downtime. If not provided, - // the downtime is in effect indefinitely until you cancel it. - End common.NullableInt64 `json:"end,omitempty"` - // The downtime ID. - Id *int64 `json:"id,omitempty"` - // A message to include with notifications for this downtime. - // Email notifications can be sent to specific users by using the same `@username` notation as events. - Message *string `json:"message,omitempty"` - // A single monitor to which the downtime applies. - // If not provided, the downtime applies to all monitors. - MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` - // A comma-separated list of monitor tags. For example, tags that are applied directly to monitors, - // not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. - // The resulting downtime applies to monitors that match ALL provided monitor tags. - // For example, `service:postgres` **AND** `team:frontend`. - MonitorTags []string `json:"monitor_tags,omitempty"` - // If the first recovery notification during a downtime should be muted. - MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` - // ID of the parent Downtime. - ParentId common.NullableInt64 `json:"parent_id,omitempty"` - // An object defining the recurrence of the downtime. - Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` - // The scope(s) to which the downtime applies. For example, `host:app2`. - // Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. - // The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`). - Scope []string `json:"scope,omitempty"` - // POSIX timestamp to start the downtime. - // If not provided, the downtime starts the moment it is created. - Start *int64 `json:"start,omitempty"` - // The timezone in which to display the downtime's start and end times in Datadog applications. - Timezone *string `json:"timezone,omitempty"` - // ID of the last user that updated the downtime. - UpdaterId common.NullableInt32 `json:"updater_id,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{} -} - -// NewDowntimeChild instantiates a new DowntimeChild 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 NewDowntimeChild() *DowntimeChild { - this := DowntimeChild{} - return &this -} - -// NewDowntimeChildWithDefaults instantiates a new DowntimeChild 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 NewDowntimeChildWithDefaults() *DowntimeChild { - this := DowntimeChild{} - return &this -} - -// GetActive returns the Active field value if set, zero value otherwise. -func (o *DowntimeChild) GetActive() bool { - if o == nil || o.Active == nil { - var ret bool - return ret - } - return *o.Active -} - -// GetActiveOk returns a tuple with the Active field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetActiveOk() (*bool, bool) { - if o == nil || o.Active == nil { - return nil, false - } - return o.Active, true -} - -// HasActive returns a boolean if a field has been set. -func (o *DowntimeChild) HasActive() bool { - if o != nil && o.Active != nil { - return true - } - - return false -} - -// SetActive gets a reference to the given bool and assigns it to the Active field. -func (o *DowntimeChild) SetActive(v bool) { - o.Active = &v -} - -// GetCanceled returns the Canceled field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeChild) GetCanceled() int64 { - if o == nil || o.Canceled.Get() == nil { - var ret int64 - return ret - } - return *o.Canceled.Get() -} - -// GetCanceledOk returns a tuple with the Canceled 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 *DowntimeChild) GetCanceledOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Canceled.Get(), o.Canceled.IsSet() -} - -// HasCanceled returns a boolean if a field has been set. -func (o *DowntimeChild) HasCanceled() bool { - if o != nil && o.Canceled.IsSet() { - return true - } - - return false -} - -// SetCanceled gets a reference to the given common.NullableInt64 and assigns it to the Canceled field. -func (o *DowntimeChild) SetCanceled(v int64) { - o.Canceled.Set(&v) -} - -// SetCanceledNil sets the value for Canceled to be an explicit nil. -func (o *DowntimeChild) SetCanceledNil() { - o.Canceled.Set(nil) -} - -// UnsetCanceled ensures that no value is present for Canceled, not even an explicit nil. -func (o *DowntimeChild) UnsetCanceled() { - o.Canceled.Unset() -} - -// GetCreatorId returns the CreatorId field value if set, zero value otherwise. -func (o *DowntimeChild) GetCreatorId() int32 { - if o == nil || o.CreatorId == nil { - var ret int32 - return ret - } - return *o.CreatorId -} - -// GetCreatorIdOk returns a tuple with the CreatorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetCreatorIdOk() (*int32, bool) { - if o == nil || o.CreatorId == nil { - return nil, false - } - return o.CreatorId, true -} - -// HasCreatorId returns a boolean if a field has been set. -func (o *DowntimeChild) HasCreatorId() bool { - if o != nil && o.CreatorId != nil { - return true - } - - return false -} - -// SetCreatorId gets a reference to the given int32 and assigns it to the CreatorId field. -func (o *DowntimeChild) SetCreatorId(v int32) { - o.CreatorId = &v -} - -// GetDisabled returns the Disabled field value if set, zero value otherwise. -func (o *DowntimeChild) GetDisabled() bool { - if o == nil || o.Disabled == nil { - var ret bool - return ret - } - return *o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetDisabledOk() (*bool, bool) { - if o == nil || o.Disabled == nil { - return nil, false - } - return o.Disabled, true -} - -// HasDisabled returns a boolean if a field has been set. -func (o *DowntimeChild) HasDisabled() bool { - if o != nil && o.Disabled != nil { - return true - } - - return false -} - -// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. -func (o *DowntimeChild) SetDisabled(v bool) { - o.Disabled = &v -} - -// GetDowntimeType returns the DowntimeType field value if set, zero value otherwise. -func (o *DowntimeChild) GetDowntimeType() int32 { - if o == nil || o.DowntimeType == nil { - var ret int32 - return ret - } - return *o.DowntimeType -} - -// GetDowntimeTypeOk returns a tuple with the DowntimeType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetDowntimeTypeOk() (*int32, bool) { - if o == nil || o.DowntimeType == nil { - return nil, false - } - return o.DowntimeType, true -} - -// HasDowntimeType returns a boolean if a field has been set. -func (o *DowntimeChild) HasDowntimeType() bool { - if o != nil && o.DowntimeType != nil { - return true - } - - return false -} - -// SetDowntimeType gets a reference to the given int32 and assigns it to the DowntimeType field. -func (o *DowntimeChild) SetDowntimeType(v int32) { - o.DowntimeType = &v -} - -// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeChild) GetEnd() int64 { - if o == nil || o.End.Get() == nil { - var ret int64 - return ret - } - return *o.End.Get() -} - -// GetEndOk returns a tuple with the End 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 *DowntimeChild) GetEndOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.End.Get(), o.End.IsSet() -} - -// HasEnd returns a boolean if a field has been set. -func (o *DowntimeChild) HasEnd() bool { - if o != nil && o.End.IsSet() { - return true - } - - return false -} - -// SetEnd gets a reference to the given common.NullableInt64 and assigns it to the End field. -func (o *DowntimeChild) SetEnd(v int64) { - o.End.Set(&v) -} - -// SetEndNil sets the value for End to be an explicit nil. -func (o *DowntimeChild) SetEndNil() { - o.End.Set(nil) -} - -// UnsetEnd ensures that no value is present for End, not even an explicit nil. -func (o *DowntimeChild) UnsetEnd() { - o.End.Unset() -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *DowntimeChild) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *DowntimeChild) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *DowntimeChild) SetId(v int64) { - o.Id = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *DowntimeChild) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *DowntimeChild) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *DowntimeChild) SetMessage(v string) { - o.Message = &v -} - -// GetMonitorId returns the MonitorId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeChild) GetMonitorId() int64 { - if o == nil || o.MonitorId.Get() == nil { - var ret int64 - return ret - } - return *o.MonitorId.Get() -} - -// GetMonitorIdOk returns a tuple with the MonitorId 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 *DowntimeChild) GetMonitorIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.MonitorId.Get(), o.MonitorId.IsSet() -} - -// HasMonitorId returns a boolean if a field has been set. -func (o *DowntimeChild) HasMonitorId() bool { - if o != nil && o.MonitorId.IsSet() { - return true - } - - return false -} - -// SetMonitorId gets a reference to the given common.NullableInt64 and assigns it to the MonitorId field. -func (o *DowntimeChild) SetMonitorId(v int64) { - o.MonitorId.Set(&v) -} - -// SetMonitorIdNil sets the value for MonitorId to be an explicit nil. -func (o *DowntimeChild) SetMonitorIdNil() { - o.MonitorId.Set(nil) -} - -// UnsetMonitorId ensures that no value is present for MonitorId, not even an explicit nil. -func (o *DowntimeChild) UnsetMonitorId() { - o.MonitorId.Unset() -} - -// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. -func (o *DowntimeChild) GetMonitorTags() []string { - if o == nil || o.MonitorTags == nil { - var ret []string - return ret - } - return o.MonitorTags -} - -// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetMonitorTagsOk() (*[]string, bool) { - if o == nil || o.MonitorTags == nil { - return nil, false - } - return &o.MonitorTags, true -} - -// HasMonitorTags returns a boolean if a field has been set. -func (o *DowntimeChild) HasMonitorTags() bool { - if o != nil && o.MonitorTags != nil { - return true - } - - return false -} - -// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. -func (o *DowntimeChild) SetMonitorTags(v []string) { - o.MonitorTags = v -} - -// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise. -func (o *DowntimeChild) GetMuteFirstRecoveryNotification() bool { - if o == nil || o.MuteFirstRecoveryNotification == nil { - var ret bool - return ret - } - return *o.MuteFirstRecoveryNotification -} - -// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetMuteFirstRecoveryNotificationOk() (*bool, bool) { - if o == nil || o.MuteFirstRecoveryNotification == nil { - return nil, false - } - return o.MuteFirstRecoveryNotification, true -} - -// HasMuteFirstRecoveryNotification returns a boolean if a field has been set. -func (o *DowntimeChild) HasMuteFirstRecoveryNotification() bool { - if o != nil && o.MuteFirstRecoveryNotification != nil { - return true - } - - return false -} - -// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field. -func (o *DowntimeChild) SetMuteFirstRecoveryNotification(v bool) { - o.MuteFirstRecoveryNotification = &v -} - -// GetParentId returns the ParentId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeChild) GetParentId() int64 { - if o == nil || o.ParentId.Get() == nil { - var ret int64 - return ret - } - return *o.ParentId.Get() -} - -// GetParentIdOk returns a tuple with the ParentId 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 *DowntimeChild) GetParentIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.ParentId.Get(), o.ParentId.IsSet() -} - -// HasParentId returns a boolean if a field has been set. -func (o *DowntimeChild) HasParentId() bool { - if o != nil && o.ParentId.IsSet() { - return true - } - - return false -} - -// SetParentId gets a reference to the given common.NullableInt64 and assigns it to the ParentId field. -func (o *DowntimeChild) SetParentId(v int64) { - o.ParentId.Set(&v) -} - -// SetParentIdNil sets the value for ParentId to be an explicit nil. -func (o *DowntimeChild) SetParentIdNil() { - o.ParentId.Set(nil) -} - -// UnsetParentId ensures that no value is present for ParentId, not even an explicit nil. -func (o *DowntimeChild) UnsetParentId() { - o.ParentId.Unset() -} - -// GetRecurrence returns the Recurrence field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeChild) GetRecurrence() DowntimeRecurrence { - if o == nil || o.Recurrence.Get() == nil { - var ret DowntimeRecurrence - return ret - } - return *o.Recurrence.Get() -} - -// GetRecurrenceOk returns a tuple with the Recurrence 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 *DowntimeChild) GetRecurrenceOk() (*DowntimeRecurrence, bool) { - if o == nil { - return nil, false - } - return o.Recurrence.Get(), o.Recurrence.IsSet() -} - -// HasRecurrence returns a boolean if a field has been set. -func (o *DowntimeChild) HasRecurrence() bool { - if o != nil && o.Recurrence.IsSet() { - return true - } - - return false -} - -// SetRecurrence gets a reference to the given NullableDowntimeRecurrence and assigns it to the Recurrence field. -func (o *DowntimeChild) SetRecurrence(v DowntimeRecurrence) { - o.Recurrence.Set(&v) -} - -// SetRecurrenceNil sets the value for Recurrence to be an explicit nil. -func (o *DowntimeChild) SetRecurrenceNil() { - o.Recurrence.Set(nil) -} - -// UnsetRecurrence ensures that no value is present for Recurrence, not even an explicit nil. -func (o *DowntimeChild) UnsetRecurrence() { - o.Recurrence.Unset() -} - -// GetScope returns the Scope field value if set, zero value otherwise. -func (o *DowntimeChild) GetScope() []string { - if o == nil || o.Scope == nil { - var ret []string - return ret - } - return o.Scope -} - -// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetScopeOk() (*[]string, bool) { - if o == nil || o.Scope == nil { - return nil, false - } - return &o.Scope, true -} - -// HasScope returns a boolean if a field has been set. -func (o *DowntimeChild) HasScope() bool { - if o != nil && o.Scope != nil { - return true - } - - return false -} - -// SetScope gets a reference to the given []string and assigns it to the Scope field. -func (o *DowntimeChild) SetScope(v []string) { - o.Scope = v -} - -// GetStart returns the Start field value if set, zero value otherwise. -func (o *DowntimeChild) GetStart() int64 { - if o == nil || o.Start == nil { - var ret int64 - return ret - } - return *o.Start -} - -// GetStartOk returns a tuple with the Start field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetStartOk() (*int64, bool) { - if o == nil || o.Start == nil { - return nil, false - } - return o.Start, true -} - -// HasStart returns a boolean if a field has been set. -func (o *DowntimeChild) HasStart() bool { - if o != nil && o.Start != nil { - return true - } - - return false -} - -// SetStart gets a reference to the given int64 and assigns it to the Start field. -func (o *DowntimeChild) SetStart(v int64) { - o.Start = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *DowntimeChild) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeChild) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *DowntimeChild) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *DowntimeChild) SetTimezone(v string) { - o.Timezone = &v -} - -// GetUpdaterId returns the UpdaterId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeChild) GetUpdaterId() int32 { - if o == nil || o.UpdaterId.Get() == nil { - var ret int32 - return ret - } - return *o.UpdaterId.Get() -} - -// GetUpdaterIdOk returns a tuple with the UpdaterId 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 *DowntimeChild) GetUpdaterIdOk() (*int32, bool) { - if o == nil { - return nil, false - } - return o.UpdaterId.Get(), o.UpdaterId.IsSet() -} - -// HasUpdaterId returns a boolean if a field has been set. -func (o *DowntimeChild) HasUpdaterId() bool { - if o != nil && o.UpdaterId.IsSet() { - return true - } - - return false -} - -// SetUpdaterId gets a reference to the given common.NullableInt32 and assigns it to the UpdaterId field. -func (o *DowntimeChild) SetUpdaterId(v int32) { - o.UpdaterId.Set(&v) -} - -// SetUpdaterIdNil sets the value for UpdaterId to be an explicit nil. -func (o *DowntimeChild) SetUpdaterIdNil() { - o.UpdaterId.Set(nil) -} - -// UnsetUpdaterId ensures that no value is present for UpdaterId, not even an explicit nil. -func (o *DowntimeChild) UnsetUpdaterId() { - o.UpdaterId.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o DowntimeChild) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Active != nil { - toSerialize["active"] = o.Active - } - if o.Canceled.IsSet() { - toSerialize["canceled"] = o.Canceled.Get() - } - if o.CreatorId != nil { - toSerialize["creator_id"] = o.CreatorId - } - if o.Disabled != nil { - toSerialize["disabled"] = o.Disabled - } - if o.DowntimeType != nil { - toSerialize["downtime_type"] = o.DowntimeType - } - if o.End.IsSet() { - toSerialize["end"] = o.End.Get() - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.MonitorId.IsSet() { - toSerialize["monitor_id"] = o.MonitorId.Get() - } - if o.MonitorTags != nil { - toSerialize["monitor_tags"] = o.MonitorTags - } - if o.MuteFirstRecoveryNotification != nil { - toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification - } - if o.ParentId.IsSet() { - toSerialize["parent_id"] = o.ParentId.Get() - } - if o.Recurrence.IsSet() { - toSerialize["recurrence"] = o.Recurrence.Get() - } - if o.Scope != nil { - toSerialize["scope"] = o.Scope - } - if o.Start != nil { - toSerialize["start"] = o.Start - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - if o.UpdaterId.IsSet() { - toSerialize["updater_id"] = o.UpdaterId.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DowntimeChild) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Active *bool `json:"active,omitempty"` - Canceled common.NullableInt64 `json:"canceled,omitempty"` - CreatorId *int32 `json:"creator_id,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - DowntimeType *int32 `json:"downtime_type,omitempty"` - End common.NullableInt64 `json:"end,omitempty"` - Id *int64 `json:"id,omitempty"` - Message *string `json:"message,omitempty"` - MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` - MonitorTags []string `json:"monitor_tags,omitempty"` - MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` - ParentId common.NullableInt64 `json:"parent_id,omitempty"` - Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` - Scope []string `json:"scope,omitempty"` - Start *int64 `json:"start,omitempty"` - Timezone *string `json:"timezone,omitempty"` - UpdaterId common.NullableInt32 `json:"updater_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Active = all.Active - o.Canceled = all.Canceled - o.CreatorId = all.CreatorId - o.Disabled = all.Disabled - o.DowntimeType = all.DowntimeType - o.End = all.End - o.Id = all.Id - o.Message = all.Message - o.MonitorId = all.MonitorId - o.MonitorTags = all.MonitorTags - o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification - o.ParentId = all.ParentId - o.Recurrence = all.Recurrence - o.Scope = all.Scope - o.Start = all.Start - o.Timezone = all.Timezone - o.UpdaterId = all.UpdaterId - return nil -} - -// NullableDowntimeChild handles when a null is used for DowntimeChild. -type NullableDowntimeChild struct { - value *DowntimeChild - isSet bool -} - -// Get returns the associated value. -func (v NullableDowntimeChild) Get() *DowntimeChild { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDowntimeChild) Set(val *DowntimeChild) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDowntimeChild) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableDowntimeChild) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDowntimeChild initializes the struct as if Set has been called. -func NewNullableDowntimeChild(val *DowntimeChild) *NullableDowntimeChild { - return &NullableDowntimeChild{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDowntimeChild) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDowntimeChild) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_downtime_recurrence.go b/api/v1/datadog/model_downtime_recurrence.go deleted file mode 100644 index 6e0b81fb5d9..00000000000 --- a/api/v1/datadog/model_downtime_recurrence.go +++ /dev/null @@ -1,381 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DowntimeRecurrence An object defining the recurrence of the downtime. -type DowntimeRecurrence struct { - // How often to repeat as an integer. - // For example, to repeat every 3 days, select a type of `days` and a period of `3`. - Period *int32 `json:"period,omitempty"` - // The `RRULE` standard for defining recurring events (**requires to set "type" to rrule**) - // For example, to have a recurring event on the first day of each month, set the type to `rrule` and set the `FREQ` to `MONTHLY` and `BYMONTHDAY` to `1`. - // Most common `rrule` options from the [iCalendar Spec](https://tools.ietf.org/html/rfc5545) are supported. - // - // **Note**: Attributes specifying the duration in `RRULE` are not supported (for example, `DTSTART`, `DTEND`, `DURATION`). - // More examples available in this [downtime guide](https://docs.datadoghq.com/monitors/guide/suppress-alert-with-downtimes/?tab=api) - Rrule *string `json:"rrule,omitempty"` - // The type of recurrence. Choose from `days`, `weeks`, `months`, `years`, `rrule`. - Type *string `json:"type,omitempty"` - // The date at which the recurrence should end as a POSIX timestamp. - // `until_occurences` and `until_date` are mutually exclusive. - UntilDate common.NullableInt64 `json:"until_date,omitempty"` - // How many times the downtime is rescheduled. - // `until_occurences` and `until_date` are mutually exclusive. - UntilOccurrences common.NullableInt32 `json:"until_occurrences,omitempty"` - // A list of week days to repeat on. Choose from `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat` or `Sun`. - // Only applicable when type is weeks. First letter must be capitalized. - WeekDays []string `json:"week_days,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{} -} - -// NewDowntimeRecurrence instantiates a new DowntimeRecurrence 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 NewDowntimeRecurrence() *DowntimeRecurrence { - this := DowntimeRecurrence{} - return &this -} - -// NewDowntimeRecurrenceWithDefaults instantiates a new DowntimeRecurrence 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 NewDowntimeRecurrenceWithDefaults() *DowntimeRecurrence { - this := DowntimeRecurrence{} - return &this -} - -// GetPeriod returns the Period field value if set, zero value otherwise. -func (o *DowntimeRecurrence) GetPeriod() int32 { - if o == nil || o.Period == nil { - var ret int32 - return ret - } - return *o.Period -} - -// GetPeriodOk returns a tuple with the Period field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeRecurrence) GetPeriodOk() (*int32, bool) { - if o == nil || o.Period == nil { - return nil, false - } - return o.Period, true -} - -// HasPeriod returns a boolean if a field has been set. -func (o *DowntimeRecurrence) HasPeriod() bool { - if o != nil && o.Period != nil { - return true - } - - return false -} - -// SetPeriod gets a reference to the given int32 and assigns it to the Period field. -func (o *DowntimeRecurrence) SetPeriod(v int32) { - o.Period = &v -} - -// GetRrule returns the Rrule field value if set, zero value otherwise. -func (o *DowntimeRecurrence) GetRrule() string { - if o == nil || o.Rrule == nil { - var ret string - return ret - } - return *o.Rrule -} - -// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeRecurrence) GetRruleOk() (*string, bool) { - if o == nil || o.Rrule == nil { - return nil, false - } - return o.Rrule, true -} - -// HasRrule returns a boolean if a field has been set. -func (o *DowntimeRecurrence) HasRrule() bool { - if o != nil && o.Rrule != nil { - return true - } - - return false -} - -// SetRrule gets a reference to the given string and assigns it to the Rrule field. -func (o *DowntimeRecurrence) SetRrule(v string) { - o.Rrule = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *DowntimeRecurrence) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DowntimeRecurrence) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *DowntimeRecurrence) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *DowntimeRecurrence) SetType(v string) { - o.Type = &v -} - -// GetUntilDate returns the UntilDate field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeRecurrence) GetUntilDate() int64 { - if o == nil || o.UntilDate.Get() == nil { - var ret int64 - return ret - } - return *o.UntilDate.Get() -} - -// GetUntilDateOk returns a tuple with the UntilDate 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 *DowntimeRecurrence) GetUntilDateOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.UntilDate.Get(), o.UntilDate.IsSet() -} - -// HasUntilDate returns a boolean if a field has been set. -func (o *DowntimeRecurrence) HasUntilDate() bool { - if o != nil && o.UntilDate.IsSet() { - return true - } - - return false -} - -// SetUntilDate gets a reference to the given common.NullableInt64 and assigns it to the UntilDate field. -func (o *DowntimeRecurrence) SetUntilDate(v int64) { - o.UntilDate.Set(&v) -} - -// SetUntilDateNil sets the value for UntilDate to be an explicit nil. -func (o *DowntimeRecurrence) SetUntilDateNil() { - o.UntilDate.Set(nil) -} - -// UnsetUntilDate ensures that no value is present for UntilDate, not even an explicit nil. -func (o *DowntimeRecurrence) UnsetUntilDate() { - o.UntilDate.Unset() -} - -// GetUntilOccurrences returns the UntilOccurrences field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeRecurrence) GetUntilOccurrences() int32 { - if o == nil || o.UntilOccurrences.Get() == nil { - var ret int32 - return ret - } - return *o.UntilOccurrences.Get() -} - -// GetUntilOccurrencesOk returns a tuple with the UntilOccurrences 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 *DowntimeRecurrence) GetUntilOccurrencesOk() (*int32, bool) { - if o == nil { - return nil, false - } - return o.UntilOccurrences.Get(), o.UntilOccurrences.IsSet() -} - -// HasUntilOccurrences returns a boolean if a field has been set. -func (o *DowntimeRecurrence) HasUntilOccurrences() bool { - if o != nil && o.UntilOccurrences.IsSet() { - return true - } - - return false -} - -// SetUntilOccurrences gets a reference to the given common.NullableInt32 and assigns it to the UntilOccurrences field. -func (o *DowntimeRecurrence) SetUntilOccurrences(v int32) { - o.UntilOccurrences.Set(&v) -} - -// SetUntilOccurrencesNil sets the value for UntilOccurrences to be an explicit nil. -func (o *DowntimeRecurrence) SetUntilOccurrencesNil() { - o.UntilOccurrences.Set(nil) -} - -// UnsetUntilOccurrences ensures that no value is present for UntilOccurrences, not even an explicit nil. -func (o *DowntimeRecurrence) UnsetUntilOccurrences() { - o.UntilOccurrences.Unset() -} - -// GetWeekDays returns the WeekDays field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *DowntimeRecurrence) GetWeekDays() []string { - if o == nil { - var ret []string - return ret - } - return o.WeekDays -} - -// GetWeekDaysOk returns a tuple with the WeekDays 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 *DowntimeRecurrence) GetWeekDaysOk() (*[]string, bool) { - if o == nil || o.WeekDays == nil { - return nil, false - } - return &o.WeekDays, true -} - -// HasWeekDays returns a boolean if a field has been set. -func (o *DowntimeRecurrence) HasWeekDays() bool { - if o != nil && o.WeekDays != nil { - return true - } - - return false -} - -// SetWeekDays gets a reference to the given []string and assigns it to the WeekDays field. -func (o *DowntimeRecurrence) SetWeekDays(v []string) { - o.WeekDays = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DowntimeRecurrence) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Period != nil { - toSerialize["period"] = o.Period - } - if o.Rrule != nil { - toSerialize["rrule"] = o.Rrule - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.UntilDate.IsSet() { - toSerialize["until_date"] = o.UntilDate.Get() - } - if o.UntilOccurrences.IsSet() { - toSerialize["until_occurrences"] = o.UntilOccurrences.Get() - } - if o.WeekDays != nil { - toSerialize["week_days"] = o.WeekDays - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DowntimeRecurrence) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Period *int32 `json:"period,omitempty"` - Rrule *string `json:"rrule,omitempty"` - Type *string `json:"type,omitempty"` - UntilDate common.NullableInt64 `json:"until_date,omitempty"` - UntilOccurrences common.NullableInt32 `json:"until_occurrences,omitempty"` - WeekDays []string `json:"week_days,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Period = all.Period - o.Rrule = all.Rrule - o.Type = all.Type - o.UntilDate = all.UntilDate - o.UntilOccurrences = all.UntilOccurrences - o.WeekDays = all.WeekDays - return nil -} - -// NullableDowntimeRecurrence handles when a null is used for DowntimeRecurrence. -type NullableDowntimeRecurrence struct { - value *DowntimeRecurrence - isSet bool -} - -// Get returns the associated value. -func (v NullableDowntimeRecurrence) Get() *DowntimeRecurrence { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDowntimeRecurrence) Set(val *DowntimeRecurrence) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDowntimeRecurrence) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableDowntimeRecurrence) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDowntimeRecurrence initializes the struct as if Set has been called. -func NewNullableDowntimeRecurrence(val *DowntimeRecurrence) *NullableDowntimeRecurrence { - return &NullableDowntimeRecurrence{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDowntimeRecurrence) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDowntimeRecurrence) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_event.go b/api/v1/datadog/model_event.go deleted file mode 100644 index 1e572c8ccea..00000000000 --- a/api/v1/datadog/model_event.go +++ /dev/null @@ -1,605 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Event Object representing an event. -type Event struct { - // If an alert event is enabled, set its type. - // For example, `error`, `warning`, `info`, `success`, `user_update`, - // `recommendation`, and `snapshot`. - AlertType *EventAlertType `json:"alert_type,omitempty"` - // POSIX timestamp of the event. Must be sent as an integer (that is no quotes). - // Limited to events no older than 18 hours. - DateHappened *int64 `json:"date_happened,omitempty"` - // A device name. - DeviceName *string `json:"device_name,omitempty"` - // Host name to associate with the event. - // Any tags associated with the host are also applied to this event. - Host *string `json:"host,omitempty"` - // Integer ID of the event. - Id *int64 `json:"id,omitempty"` - // Handling IDs as large 64-bit numbers can cause loss of accuracy issues with some programming languages. - // Instead, use the string representation of the Event ID to avoid losing accuracy. - IdStr *string `json:"id_str,omitempty"` - // Payload of the event. - Payload *string `json:"payload,omitempty"` - // The priority of the event. For example, `normal` or `low`. - Priority NullableEventPriority `json:"priority,omitempty"` - // The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. - // The list of standard source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). - SourceTypeName *string `json:"source_type_name,omitempty"` - // A list of tags to apply to the event. - Tags []string `json:"tags,omitempty"` - // The body of the event. Limited to 4000 characters. The text supports markdown. - // To use markdown in the event text, start the text block with `%%% \n` and end the text block with `\n %%%`. - // Use `msg_text` with the Datadog Ruby library. - Text *string `json:"text,omitempty"` - // The event title. - Title *string `json:"title,omitempty"` - // URL of the event. - Url *string `json:"url,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{} -} - -// NewEvent instantiates a new Event 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 NewEvent() *Event { - this := Event{} - return &this -} - -// NewEventWithDefaults instantiates a new Event 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 NewEventWithDefaults() *Event { - this := Event{} - return &this -} - -// GetAlertType returns the AlertType field value if set, zero value otherwise. -func (o *Event) GetAlertType() EventAlertType { - if o == nil || o.AlertType == nil { - var ret EventAlertType - return ret - } - return *o.AlertType -} - -// GetAlertTypeOk returns a tuple with the AlertType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetAlertTypeOk() (*EventAlertType, bool) { - if o == nil || o.AlertType == nil { - return nil, false - } - return o.AlertType, true -} - -// HasAlertType returns a boolean if a field has been set. -func (o *Event) HasAlertType() bool { - if o != nil && o.AlertType != nil { - return true - } - - return false -} - -// SetAlertType gets a reference to the given EventAlertType and assigns it to the AlertType field. -func (o *Event) SetAlertType(v EventAlertType) { - o.AlertType = &v -} - -// GetDateHappened returns the DateHappened field value if set, zero value otherwise. -func (o *Event) GetDateHappened() int64 { - if o == nil || o.DateHappened == nil { - var ret int64 - return ret - } - return *o.DateHappened -} - -// GetDateHappenedOk returns a tuple with the DateHappened field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetDateHappenedOk() (*int64, bool) { - if o == nil || o.DateHappened == nil { - return nil, false - } - return o.DateHappened, true -} - -// HasDateHappened returns a boolean if a field has been set. -func (o *Event) HasDateHappened() bool { - if o != nil && o.DateHappened != nil { - return true - } - - return false -} - -// SetDateHappened gets a reference to the given int64 and assigns it to the DateHappened field. -func (o *Event) SetDateHappened(v int64) { - o.DateHappened = &v -} - -// GetDeviceName returns the DeviceName field value if set, zero value otherwise. -func (o *Event) GetDeviceName() string { - if o == nil || o.DeviceName == nil { - var ret string - return ret - } - return *o.DeviceName -} - -// GetDeviceNameOk returns a tuple with the DeviceName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetDeviceNameOk() (*string, bool) { - if o == nil || o.DeviceName == nil { - return nil, false - } - return o.DeviceName, true -} - -// HasDeviceName returns a boolean if a field has been set. -func (o *Event) HasDeviceName() bool { - if o != nil && o.DeviceName != nil { - return true - } - - return false -} - -// SetDeviceName gets a reference to the given string and assigns it to the DeviceName field. -func (o *Event) SetDeviceName(v string) { - o.DeviceName = &v -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *Event) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *Event) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *Event) SetHost(v string) { - o.Host = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Event) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Event) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *Event) SetId(v int64) { - o.Id = &v -} - -// GetIdStr returns the IdStr field value if set, zero value otherwise. -func (o *Event) GetIdStr() string { - if o == nil || o.IdStr == nil { - var ret string - return ret - } - return *o.IdStr -} - -// GetIdStrOk returns a tuple with the IdStr field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetIdStrOk() (*string, bool) { - if o == nil || o.IdStr == nil { - return nil, false - } - return o.IdStr, true -} - -// HasIdStr returns a boolean if a field has been set. -func (o *Event) HasIdStr() bool { - if o != nil && o.IdStr != nil { - return true - } - - return false -} - -// SetIdStr gets a reference to the given string and assigns it to the IdStr field. -func (o *Event) SetIdStr(v string) { - o.IdStr = &v -} - -// GetPayload returns the Payload field value if set, zero value otherwise. -func (o *Event) GetPayload() string { - if o == nil || o.Payload == nil { - var ret string - return ret - } - return *o.Payload -} - -// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetPayloadOk() (*string, bool) { - if o == nil || o.Payload == nil { - return nil, false - } - return o.Payload, true -} - -// HasPayload returns a boolean if a field has been set. -func (o *Event) HasPayload() bool { - if o != nil && o.Payload != nil { - return true - } - - return false -} - -// SetPayload gets a reference to the given string and assigns it to the Payload field. -func (o *Event) SetPayload(v string) { - o.Payload = &v -} - -// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Event) GetPriority() EventPriority { - if o == nil || o.Priority.Get() == nil { - var ret EventPriority - return ret - } - return *o.Priority.Get() -} - -// GetPriorityOk returns a tuple with the Priority 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 *Event) GetPriorityOk() (*EventPriority, bool) { - if o == nil { - return nil, false - } - return o.Priority.Get(), o.Priority.IsSet() -} - -// HasPriority returns a boolean if a field has been set. -func (o *Event) HasPriority() bool { - if o != nil && o.Priority.IsSet() { - return true - } - - return false -} - -// SetPriority gets a reference to the given NullableEventPriority and assigns it to the Priority field. -func (o *Event) SetPriority(v EventPriority) { - o.Priority.Set(&v) -} - -// SetPriorityNil sets the value for Priority to be an explicit nil. -func (o *Event) SetPriorityNil() { - o.Priority.Set(nil) -} - -// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. -func (o *Event) UnsetPriority() { - o.Priority.Unset() -} - -// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. -func (o *Event) GetSourceTypeName() string { - if o == nil || o.SourceTypeName == nil { - var ret string - return ret - } - return *o.SourceTypeName -} - -// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetSourceTypeNameOk() (*string, bool) { - if o == nil || o.SourceTypeName == nil { - return nil, false - } - return o.SourceTypeName, true -} - -// HasSourceTypeName returns a boolean if a field has been set. -func (o *Event) HasSourceTypeName() bool { - if o != nil && o.SourceTypeName != nil { - return true - } - - return false -} - -// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. -func (o *Event) SetSourceTypeName(v string) { - o.SourceTypeName = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *Event) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *Event) GetTagsOk() (*[]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 *Event) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *Event) SetTags(v []string) { - o.Tags = v -} - -// GetText returns the Text field value if set, zero value otherwise. -func (o *Event) GetText() string { - if o == nil || o.Text == nil { - var ret string - return ret - } - return *o.Text -} - -// GetTextOk returns a tuple with the Text field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetTextOk() (*string, bool) { - if o == nil || o.Text == nil { - return nil, false - } - return o.Text, true -} - -// HasText returns a boolean if a field has been set. -func (o *Event) HasText() bool { - if o != nil && o.Text != nil { - return true - } - - return false -} - -// SetText gets a reference to the given string and assigns it to the Text field. -func (o *Event) SetText(v string) { - o.Text = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *Event) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *Event) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *Event) SetTitle(v string) { - o.Title = &v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *Event) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *Event) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *Event) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Event) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AlertType != nil { - toSerialize["alert_type"] = o.AlertType - } - if o.DateHappened != nil { - toSerialize["date_happened"] = o.DateHappened - } - if o.DeviceName != nil { - toSerialize["device_name"] = o.DeviceName - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IdStr != nil { - toSerialize["id_str"] = o.IdStr - } - if o.Payload != nil { - toSerialize["payload"] = o.Payload - } - if o.Priority.IsSet() { - toSerialize["priority"] = o.Priority.Get() - } - if o.SourceTypeName != nil { - toSerialize["source_type_name"] = o.SourceTypeName - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Text != nil { - toSerialize["text"] = o.Text - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Event) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AlertType *EventAlertType `json:"alert_type,omitempty"` - DateHappened *int64 `json:"date_happened,omitempty"` - DeviceName *string `json:"device_name,omitempty"` - Host *string `json:"host,omitempty"` - Id *int64 `json:"id,omitempty"` - IdStr *string `json:"id_str,omitempty"` - Payload *string `json:"payload,omitempty"` - Priority NullableEventPriority `json:"priority,omitempty"` - SourceTypeName *string `json:"source_type_name,omitempty"` - Tags []string `json:"tags,omitempty"` - Text *string `json:"text,omitempty"` - Title *string `json:"title,omitempty"` - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.AlertType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AlertType = all.AlertType - o.DateHappened = all.DateHappened - o.DeviceName = all.DeviceName - o.Host = all.Host - o.Id = all.Id - o.IdStr = all.IdStr - o.Payload = all.Payload - o.Priority = all.Priority - o.SourceTypeName = all.SourceTypeName - o.Tags = all.Tags - o.Text = all.Text - o.Title = all.Title - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_event_alert_type.go b/api/v1/datadog/model_event_alert_type.go deleted file mode 100644 index 26e0e8737e6..00000000000 --- a/api/v1/datadog/model_event_alert_type.go +++ /dev/null @@ -1,121 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventAlertType If an alert event is enabled, set its type. -// For example, `error`, `warning`, `info`, `success`, `user_update`, -// `recommendation`, and `snapshot`. -type EventAlertType string - -// List of EventAlertType. -const ( - EVENTALERTTYPE_ERROR EventAlertType = "error" - EVENTALERTTYPE_WARNING EventAlertType = "warning" - EVENTALERTTYPE_INFO EventAlertType = "info" - EVENTALERTTYPE_SUCCESS EventAlertType = "success" - EVENTALERTTYPE_USER_UPDATE EventAlertType = "user_update" - EVENTALERTTYPE_RECOMMENDATION EventAlertType = "recommendation" - EVENTALERTTYPE_SNAPSHOT EventAlertType = "snapshot" -) - -var allowedEventAlertTypeEnumValues = []EventAlertType{ - EVENTALERTTYPE_ERROR, - EVENTALERTTYPE_WARNING, - EVENTALERTTYPE_INFO, - EVENTALERTTYPE_SUCCESS, - EVENTALERTTYPE_USER_UPDATE, - EVENTALERTTYPE_RECOMMENDATION, - EVENTALERTTYPE_SNAPSHOT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventAlertType) GetAllowedValues() []EventAlertType { - return allowedEventAlertTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventAlertType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventAlertType(value) - return nil -} - -// NewEventAlertTypeFromValue returns a pointer to a valid EventAlertType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventAlertTypeFromValue(v string) (*EventAlertType, error) { - ev := EventAlertType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventAlertType: valid values are %v", v, allowedEventAlertTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventAlertType) IsValid() bool { - for _, existing := range allowedEventAlertTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventAlertType value. -func (v EventAlertType) Ptr() *EventAlertType { - return &v -} - -// NullableEventAlertType handles when a null is used for EventAlertType. -type NullableEventAlertType struct { - value *EventAlertType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventAlertType) Get() *EventAlertType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventAlertType) Set(val *EventAlertType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventAlertType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventAlertType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventAlertType initializes the struct as if Set has been called. -func NewNullableEventAlertType(val *EventAlertType) *NullableEventAlertType { - return &NullableEventAlertType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventAlertType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventAlertType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_event_create_request.go b/api/v1/datadog/model_event_create_request.go deleted file mode 100644 index bbf76333186..00000000000 --- a/api/v1/datadog/model_event_create_request.go +++ /dev/null @@ -1,522 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventCreateRequest Object representing an event. -type EventCreateRequest struct { - // An arbitrary string to use for aggregation. Limited to 100 characters. - // If you specify a key, all events using that key are grouped together in the Event Stream. - AggregationKey *string `json:"aggregation_key,omitempty"` - // If an alert event is enabled, set its type. - // For example, `error`, `warning`, `info`, `success`, `user_update`, - // `recommendation`, and `snapshot`. - AlertType *EventAlertType `json:"alert_type,omitempty"` - // POSIX timestamp of the event. Must be sent as an integer (that is no quotes). - // Limited to events no older than 18 hours - DateHappened *int64 `json:"date_happened,omitempty"` - // A device name. - DeviceName *string `json:"device_name,omitempty"` - // Host name to associate with the event. - // Any tags associated with the host are also applied to this event. - Host *string `json:"host,omitempty"` - // The priority of the event. For example, `normal` or `low`. - Priority NullableEventPriority `json:"priority,omitempty"` - // ID of the parent event. Must be sent as an integer (that is no quotes). - RelatedEventId *int64 `json:"related_event_id,omitempty"` - // The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. - // A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). - SourceTypeName *string `json:"source_type_name,omitempty"` - // A list of tags to apply to the event. - Tags []string `json:"tags,omitempty"` - // The body of the event. Limited to 4000 characters. The text supports markdown. - // To use markdown in the event text, start the text block with `%%% \n` and end the text block with `\n %%%`. - // Use `msg_text` with the Datadog Ruby library. - Text string `json:"text"` - // The event title. - Title string `json:"title"` - // 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{} -} - -// NewEventCreateRequest instantiates a new EventCreateRequest 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 NewEventCreateRequest(text string, title string) *EventCreateRequest { - this := EventCreateRequest{} - this.Text = text - this.Title = title - return &this -} - -// NewEventCreateRequestWithDefaults instantiates a new EventCreateRequest 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 NewEventCreateRequestWithDefaults() *EventCreateRequest { - this := EventCreateRequest{} - return &this -} - -// GetAggregationKey returns the AggregationKey field value if set, zero value otherwise. -func (o *EventCreateRequest) GetAggregationKey() string { - if o == nil || o.AggregationKey == nil { - var ret string - return ret - } - return *o.AggregationKey -} - -// GetAggregationKeyOk returns a tuple with the AggregationKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetAggregationKeyOk() (*string, bool) { - if o == nil || o.AggregationKey == nil { - return nil, false - } - return o.AggregationKey, true -} - -// HasAggregationKey returns a boolean if a field has been set. -func (o *EventCreateRequest) HasAggregationKey() bool { - if o != nil && o.AggregationKey != nil { - return true - } - - return false -} - -// SetAggregationKey gets a reference to the given string and assigns it to the AggregationKey field. -func (o *EventCreateRequest) SetAggregationKey(v string) { - o.AggregationKey = &v -} - -// GetAlertType returns the AlertType field value if set, zero value otherwise. -func (o *EventCreateRequest) GetAlertType() EventAlertType { - if o == nil || o.AlertType == nil { - var ret EventAlertType - return ret - } - return *o.AlertType -} - -// GetAlertTypeOk returns a tuple with the AlertType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetAlertTypeOk() (*EventAlertType, bool) { - if o == nil || o.AlertType == nil { - return nil, false - } - return o.AlertType, true -} - -// HasAlertType returns a boolean if a field has been set. -func (o *EventCreateRequest) HasAlertType() bool { - if o != nil && o.AlertType != nil { - return true - } - - return false -} - -// SetAlertType gets a reference to the given EventAlertType and assigns it to the AlertType field. -func (o *EventCreateRequest) SetAlertType(v EventAlertType) { - o.AlertType = &v -} - -// GetDateHappened returns the DateHappened field value if set, zero value otherwise. -func (o *EventCreateRequest) GetDateHappened() int64 { - if o == nil || o.DateHappened == nil { - var ret int64 - return ret - } - return *o.DateHappened -} - -// GetDateHappenedOk returns a tuple with the DateHappened field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetDateHappenedOk() (*int64, bool) { - if o == nil || o.DateHappened == nil { - return nil, false - } - return o.DateHappened, true -} - -// HasDateHappened returns a boolean if a field has been set. -func (o *EventCreateRequest) HasDateHappened() bool { - if o != nil && o.DateHappened != nil { - return true - } - - return false -} - -// SetDateHappened gets a reference to the given int64 and assigns it to the DateHappened field. -func (o *EventCreateRequest) SetDateHappened(v int64) { - o.DateHappened = &v -} - -// GetDeviceName returns the DeviceName field value if set, zero value otherwise. -func (o *EventCreateRequest) GetDeviceName() string { - if o == nil || o.DeviceName == nil { - var ret string - return ret - } - return *o.DeviceName -} - -// GetDeviceNameOk returns a tuple with the DeviceName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetDeviceNameOk() (*string, bool) { - if o == nil || o.DeviceName == nil { - return nil, false - } - return o.DeviceName, true -} - -// HasDeviceName returns a boolean if a field has been set. -func (o *EventCreateRequest) HasDeviceName() bool { - if o != nil && o.DeviceName != nil { - return true - } - - return false -} - -// SetDeviceName gets a reference to the given string and assigns it to the DeviceName field. -func (o *EventCreateRequest) SetDeviceName(v string) { - o.DeviceName = &v -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *EventCreateRequest) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *EventCreateRequest) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *EventCreateRequest) SetHost(v string) { - o.Host = &v -} - -// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *EventCreateRequest) GetPriority() EventPriority { - if o == nil || o.Priority.Get() == nil { - var ret EventPriority - return ret - } - return *o.Priority.Get() -} - -// GetPriorityOk returns a tuple with the Priority 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 *EventCreateRequest) GetPriorityOk() (*EventPriority, bool) { - if o == nil { - return nil, false - } - return o.Priority.Get(), o.Priority.IsSet() -} - -// HasPriority returns a boolean if a field has been set. -func (o *EventCreateRequest) HasPriority() bool { - if o != nil && o.Priority.IsSet() { - return true - } - - return false -} - -// SetPriority gets a reference to the given NullableEventPriority and assigns it to the Priority field. -func (o *EventCreateRequest) SetPriority(v EventPriority) { - o.Priority.Set(&v) -} - -// SetPriorityNil sets the value for Priority to be an explicit nil. -func (o *EventCreateRequest) SetPriorityNil() { - o.Priority.Set(nil) -} - -// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. -func (o *EventCreateRequest) UnsetPriority() { - o.Priority.Unset() -} - -// GetRelatedEventId returns the RelatedEventId field value if set, zero value otherwise. -func (o *EventCreateRequest) GetRelatedEventId() int64 { - if o == nil || o.RelatedEventId == nil { - var ret int64 - return ret - } - return *o.RelatedEventId -} - -// GetRelatedEventIdOk returns a tuple with the RelatedEventId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetRelatedEventIdOk() (*int64, bool) { - if o == nil || o.RelatedEventId == nil { - return nil, false - } - return o.RelatedEventId, true -} - -// HasRelatedEventId returns a boolean if a field has been set. -func (o *EventCreateRequest) HasRelatedEventId() bool { - if o != nil && o.RelatedEventId != nil { - return true - } - - return false -} - -// SetRelatedEventId gets a reference to the given int64 and assigns it to the RelatedEventId field. -func (o *EventCreateRequest) SetRelatedEventId(v int64) { - o.RelatedEventId = &v -} - -// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. -func (o *EventCreateRequest) GetSourceTypeName() string { - if o == nil || o.SourceTypeName == nil { - var ret string - return ret - } - return *o.SourceTypeName -} - -// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetSourceTypeNameOk() (*string, bool) { - if o == nil || o.SourceTypeName == nil { - return nil, false - } - return o.SourceTypeName, true -} - -// HasSourceTypeName returns a boolean if a field has been set. -func (o *EventCreateRequest) HasSourceTypeName() bool { - if o != nil && o.SourceTypeName != nil { - return true - } - - return false -} - -// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. -func (o *EventCreateRequest) SetSourceTypeName(v string) { - o.SourceTypeName = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *EventCreateRequest) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *EventCreateRequest) GetTagsOk() (*[]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 *EventCreateRequest) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *EventCreateRequest) SetTags(v []string) { - o.Tags = v -} - -// GetText returns the Text field value. -func (o *EventCreateRequest) GetText() string { - if o == nil { - var ret string - return ret - } - return o.Text -} - -// GetTextOk returns a tuple with the Text field value -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetTextOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Text, true -} - -// SetText sets field value. -func (o *EventCreateRequest) SetText(v string) { - o.Text = v -} - -// GetTitle returns the Title field value. -func (o *EventCreateRequest) GetTitle() string { - if o == nil { - var ret string - return ret - } - return o.Title -} - -// GetTitleOk returns a tuple with the Title field value -// and a boolean to check if the value has been set. -func (o *EventCreateRequest) GetTitleOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Title, true -} - -// SetTitle sets field value. -func (o *EventCreateRequest) SetTitle(v string) { - o.Title = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AggregationKey != nil { - toSerialize["aggregation_key"] = o.AggregationKey - } - if o.AlertType != nil { - toSerialize["alert_type"] = o.AlertType - } - if o.DateHappened != nil { - toSerialize["date_happened"] = o.DateHappened - } - if o.DeviceName != nil { - toSerialize["device_name"] = o.DeviceName - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Priority.IsSet() { - toSerialize["priority"] = o.Priority.Get() - } - if o.RelatedEventId != nil { - toSerialize["related_event_id"] = o.RelatedEventId - } - if o.SourceTypeName != nil { - toSerialize["source_type_name"] = o.SourceTypeName - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - toSerialize["text"] = o.Text - toSerialize["title"] = o.Title - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Text *string `json:"text"` - Title *string `json:"title"` - }{} - all := struct { - AggregationKey *string `json:"aggregation_key,omitempty"` - AlertType *EventAlertType `json:"alert_type,omitempty"` - DateHappened *int64 `json:"date_happened,omitempty"` - DeviceName *string `json:"device_name,omitempty"` - Host *string `json:"host,omitempty"` - Priority NullableEventPriority `json:"priority,omitempty"` - RelatedEventId *int64 `json:"related_event_id,omitempty"` - SourceTypeName *string `json:"source_type_name,omitempty"` - Tags []string `json:"tags,omitempty"` - Text string `json:"text"` - Title string `json:"title"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Text == nil { - return fmt.Errorf("Required field text missing") - } - if required.Title == nil { - return fmt.Errorf("Required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.AlertType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AggregationKey = all.AggregationKey - o.AlertType = all.AlertType - o.DateHappened = all.DateHappened - o.DeviceName = all.DeviceName - o.Host = all.Host - o.Priority = all.Priority - o.RelatedEventId = all.RelatedEventId - o.SourceTypeName = all.SourceTypeName - o.Tags = all.Tags - o.Text = all.Text - o.Title = all.Title - return nil -} diff --git a/api/v1/datadog/model_event_create_response.go b/api/v1/datadog/model_event_create_response.go deleted file mode 100644 index 76fffc56efe..00000000000 --- a/api/v1/datadog/model_event_create_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventCreateResponse Object containing an event response. -type EventCreateResponse struct { - // Object representing an event. - Event *Event `json:"event,omitempty"` - // A status. - Status *string `json:"status,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{} -} - -// NewEventCreateResponse instantiates a new EventCreateResponse 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 NewEventCreateResponse() *EventCreateResponse { - this := EventCreateResponse{} - return &this -} - -// NewEventCreateResponseWithDefaults instantiates a new EventCreateResponse 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 NewEventCreateResponseWithDefaults() *EventCreateResponse { - this := EventCreateResponse{} - return &this -} - -// GetEvent returns the Event field value if set, zero value otherwise. -func (o *EventCreateResponse) GetEvent() Event { - if o == nil || o.Event == nil { - var ret Event - return ret - } - return *o.Event -} - -// GetEventOk returns a tuple with the Event field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateResponse) GetEventOk() (*Event, bool) { - if o == nil || o.Event == nil { - return nil, false - } - return o.Event, true -} - -// HasEvent returns a boolean if a field has been set. -func (o *EventCreateResponse) HasEvent() bool { - if o != nil && o.Event != nil { - return true - } - - return false -} - -// SetEvent gets a reference to the given Event and assigns it to the Event field. -func (o *EventCreateResponse) SetEvent(v Event) { - o.Event = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *EventCreateResponse) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateResponse) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *EventCreateResponse) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *EventCreateResponse) SetStatus(v string) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventCreateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Event != nil { - toSerialize["event"] = o.Event - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Event *Event `json:"event,omitempty"` - Status *string `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Event != nil && all.Event.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Event = all.Event - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_event_list_response.go b/api/v1/datadog/model_event_list_response.go deleted file mode 100644 index 258b6a3c39a..00000000000 --- a/api/v1/datadog/model_event_list_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventListResponse An event list response. -type EventListResponse struct { - // An array of events. - Events []Event `json:"events,omitempty"` - // A status. - Status *string `json:"status,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{} -} - -// NewEventListResponse instantiates a new EventListResponse 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 NewEventListResponse() *EventListResponse { - this := EventListResponse{} - return &this -} - -// NewEventListResponseWithDefaults instantiates a new EventListResponse 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 NewEventListResponseWithDefaults() *EventListResponse { - this := EventListResponse{} - return &this -} - -// GetEvents returns the Events field value if set, zero value otherwise. -func (o *EventListResponse) GetEvents() []Event { - if o == nil || o.Events == nil { - var ret []Event - return ret - } - return o.Events -} - -// GetEventsOk returns a tuple with the Events field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventListResponse) GetEventsOk() (*[]Event, bool) { - if o == nil || o.Events == nil { - return nil, false - } - return &o.Events, true -} - -// HasEvents returns a boolean if a field has been set. -func (o *EventListResponse) HasEvents() bool { - if o != nil && o.Events != nil { - return true - } - - return false -} - -// SetEvents gets a reference to the given []Event and assigns it to the Events field. -func (o *EventListResponse) SetEvents(v []Event) { - o.Events = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *EventListResponse) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventListResponse) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *EventListResponse) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *EventListResponse) SetStatus(v string) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Events != nil { - toSerialize["events"] = o.Events - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Events []Event `json:"events,omitempty"` - Status *string `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Events = all.Events - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_event_priority.go b/api/v1/datadog/model_event_priority.go deleted file mode 100644 index a06ba02f210..00000000000 --- a/api/v1/datadog/model_event_priority.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventPriority The priority of the event. For example, `normal` or `low`. -type EventPriority string - -// List of EventPriority. -const ( - EVENTPRIORITY_NORMAL EventPriority = "normal" - EVENTPRIORITY_LOW EventPriority = "low" -) - -var allowedEventPriorityEnumValues = []EventPriority{ - EVENTPRIORITY_NORMAL, - EVENTPRIORITY_LOW, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventPriority) GetAllowedValues() []EventPriority { - return allowedEventPriorityEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventPriority) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventPriority(value) - return nil -} - -// NewEventPriorityFromValue returns a pointer to a valid EventPriority -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventPriorityFromValue(v string) (*EventPriority, error) { - ev := EventPriority(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventPriority: valid values are %v", v, allowedEventPriorityEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventPriority) IsValid() bool { - for _, existing := range allowedEventPriorityEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventPriority value. -func (v EventPriority) Ptr() *EventPriority { - return &v -} - -// NullableEventPriority handles when a null is used for EventPriority. -type NullableEventPriority struct { - value *EventPriority - isSet bool -} - -// Get returns the associated value. -func (v NullableEventPriority) Get() *EventPriority { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventPriority) Set(val *EventPriority) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventPriority) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventPriority) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventPriority initializes the struct as if Set has been called. -func NewNullableEventPriority(val *EventPriority) *NullableEventPriority { - return &NullableEventPriority{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventPriority) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventPriority) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_event_query_definition.go b/api/v1/datadog/model_event_query_definition.go deleted file mode 100644 index c9953b5b2c8..00000000000 --- a/api/v1/datadog/model_event_query_definition.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventQueryDefinition The event query. -type EventQueryDefinition struct { - // The query being made on the event. - Search string `json:"search"` - // The execution method for multi-value filters. Can be either and or or. - TagsExecution string `json:"tags_execution"` - // 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{} -} - -// NewEventQueryDefinition instantiates a new EventQueryDefinition 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 NewEventQueryDefinition(search string, tagsExecution string) *EventQueryDefinition { - this := EventQueryDefinition{} - this.Search = search - this.TagsExecution = tagsExecution - return &this -} - -// NewEventQueryDefinitionWithDefaults instantiates a new EventQueryDefinition 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 NewEventQueryDefinitionWithDefaults() *EventQueryDefinition { - this := EventQueryDefinition{} - return &this -} - -// GetSearch returns the Search field value. -func (o *EventQueryDefinition) GetSearch() string { - if o == nil { - var ret string - return ret - } - return o.Search -} - -// GetSearchOk returns a tuple with the Search field value -// and a boolean to check if the value has been set. -func (o *EventQueryDefinition) GetSearchOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Search, true -} - -// SetSearch sets field value. -func (o *EventQueryDefinition) SetSearch(v string) { - o.Search = v -} - -// GetTagsExecution returns the TagsExecution field value. -func (o *EventQueryDefinition) GetTagsExecution() string { - if o == nil { - var ret string - return ret - } - return o.TagsExecution -} - -// GetTagsExecutionOk returns a tuple with the TagsExecution field value -// and a boolean to check if the value has been set. -func (o *EventQueryDefinition) GetTagsExecutionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.TagsExecution, true -} - -// SetTagsExecution sets field value. -func (o *EventQueryDefinition) SetTagsExecution(v string) { - o.TagsExecution = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["search"] = o.Search - toSerialize["tags_execution"] = o.TagsExecution - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Search *string `json:"search"` - TagsExecution *string `json:"tags_execution"` - }{} - all := struct { - Search string `json:"search"` - TagsExecution string `json:"tags_execution"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Search == nil { - return fmt.Errorf("Required field search missing") - } - if required.TagsExecution == nil { - return fmt.Errorf("Required field tags_execution missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Search = all.Search - o.TagsExecution = all.TagsExecution - return nil -} diff --git a/api/v1/datadog/model_event_response.go b/api/v1/datadog/model_event_response.go deleted file mode 100644 index a0e64b33d74..00000000000 --- a/api/v1/datadog/model_event_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventResponse Object containing an event response. -type EventResponse struct { - // Object representing an event. - Event *Event `json:"event,omitempty"` - // A status. - Status *string `json:"status,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{} -} - -// NewEventResponse instantiates a new EventResponse 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 NewEventResponse() *EventResponse { - this := EventResponse{} - return &this -} - -// NewEventResponseWithDefaults instantiates a new EventResponse 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 NewEventResponseWithDefaults() *EventResponse { - this := EventResponse{} - return &this -} - -// GetEvent returns the Event field value if set, zero value otherwise. -func (o *EventResponse) GetEvent() Event { - if o == nil || o.Event == nil { - var ret Event - return ret - } - return *o.Event -} - -// GetEventOk returns a tuple with the Event field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventResponse) GetEventOk() (*Event, bool) { - if o == nil || o.Event == nil { - return nil, false - } - return o.Event, true -} - -// HasEvent returns a boolean if a field has been set. -func (o *EventResponse) HasEvent() bool { - if o != nil && o.Event != nil { - return true - } - - return false -} - -// SetEvent gets a reference to the given Event and assigns it to the Event field. -func (o *EventResponse) SetEvent(v Event) { - o.Event = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *EventResponse) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventResponse) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *EventResponse) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *EventResponse) SetStatus(v string) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Event != nil { - toSerialize["event"] = o.Event - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Event *Event `json:"event,omitempty"` - Status *string `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Event != nil && all.Event.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Event = all.Event - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_event_stream_widget_definition.go b/api/v1/datadog/model_event_stream_widget_definition.go deleted file mode 100644 index 50e99ada886..00000000000 --- a/api/v1/datadog/model_event_stream_widget_definition.go +++ /dev/null @@ -1,404 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventStreamWidgetDefinition The event stream is a widget version of the stream of events -// on the Event Stream view. Only available on FREE layout dashboards. -type EventStreamWidgetDefinition struct { - // Size to use to display an event. - EventSize *WidgetEventSize `json:"event_size,omitempty"` - // Query to filter the event stream with. - Query string `json:"query"` - // The execution method for multi-value filters. Can be either and or or. - TagsExecution *string `json:"tags_execution,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the event stream widget. - Type EventStreamWidgetDefinitionType `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{} -} - -// NewEventStreamWidgetDefinition instantiates a new EventStreamWidgetDefinition 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 NewEventStreamWidgetDefinition(query string, typeVar EventStreamWidgetDefinitionType) *EventStreamWidgetDefinition { - this := EventStreamWidgetDefinition{} - this.Query = query - this.Type = typeVar - return &this -} - -// NewEventStreamWidgetDefinitionWithDefaults instantiates a new EventStreamWidgetDefinition 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 NewEventStreamWidgetDefinitionWithDefaults() *EventStreamWidgetDefinition { - this := EventStreamWidgetDefinition{} - var typeVar EventStreamWidgetDefinitionType = EVENTSTREAMWIDGETDEFINITIONTYPE_EVENT_STREAM - this.Type = typeVar - return &this -} - -// GetEventSize returns the EventSize field value if set, zero value otherwise. -func (o *EventStreamWidgetDefinition) GetEventSize() WidgetEventSize { - if o == nil || o.EventSize == nil { - var ret WidgetEventSize - return ret - } - return *o.EventSize -} - -// GetEventSizeOk returns a tuple with the EventSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventStreamWidgetDefinition) GetEventSizeOk() (*WidgetEventSize, bool) { - if o == nil || o.EventSize == nil { - return nil, false - } - return o.EventSize, true -} - -// HasEventSize returns a boolean if a field has been set. -func (o *EventStreamWidgetDefinition) HasEventSize() bool { - if o != nil && o.EventSize != nil { - return true - } - - return false -} - -// SetEventSize gets a reference to the given WidgetEventSize and assigns it to the EventSize field. -func (o *EventStreamWidgetDefinition) SetEventSize(v WidgetEventSize) { - o.EventSize = &v -} - -// GetQuery returns the Query field value. -func (o *EventStreamWidgetDefinition) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *EventStreamWidgetDefinition) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *EventStreamWidgetDefinition) SetQuery(v string) { - o.Query = v -} - -// GetTagsExecution returns the TagsExecution field value if set, zero value otherwise. -func (o *EventStreamWidgetDefinition) GetTagsExecution() string { - if o == nil || o.TagsExecution == nil { - var ret string - return ret - } - return *o.TagsExecution -} - -// GetTagsExecutionOk returns a tuple with the TagsExecution field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventStreamWidgetDefinition) GetTagsExecutionOk() (*string, bool) { - if o == nil || o.TagsExecution == nil { - return nil, false - } - return o.TagsExecution, true -} - -// HasTagsExecution returns a boolean if a field has been set. -func (o *EventStreamWidgetDefinition) HasTagsExecution() bool { - if o != nil && o.TagsExecution != nil { - return true - } - - return false -} - -// SetTagsExecution gets a reference to the given string and assigns it to the TagsExecution field. -func (o *EventStreamWidgetDefinition) SetTagsExecution(v string) { - o.TagsExecution = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *EventStreamWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventStreamWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *EventStreamWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *EventStreamWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *EventStreamWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventStreamWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *EventStreamWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *EventStreamWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *EventStreamWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventStreamWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *EventStreamWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *EventStreamWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *EventStreamWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventStreamWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *EventStreamWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *EventStreamWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *EventStreamWidgetDefinition) GetType() EventStreamWidgetDefinitionType { - if o == nil { - var ret EventStreamWidgetDefinitionType - 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 *EventStreamWidgetDefinition) GetTypeOk() (*EventStreamWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *EventStreamWidgetDefinition) SetType(v EventStreamWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventStreamWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.EventSize != nil { - toSerialize["event_size"] = o.EventSize - } - toSerialize["query"] = o.Query - if o.TagsExecution != nil { - toSerialize["tags_execution"] = o.TagsExecution - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *EventStreamWidgetDefinitionType `json:"type"` - }{} - all := struct { - EventSize *WidgetEventSize `json:"event_size,omitempty"` - Query string `json:"query"` - TagsExecution *string `json:"tags_execution,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type EventStreamWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EventSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.EventSize = all.EventSize - o.Query = all.Query - o.TagsExecution = all.TagsExecution - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_event_stream_widget_definition_type.go b/api/v1/datadog/model_event_stream_widget_definition_type.go deleted file mode 100644 index c08be45bc50..00000000000 --- a/api/v1/datadog/model_event_stream_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventStreamWidgetDefinitionType Type of the event stream widget. -type EventStreamWidgetDefinitionType string - -// List of EventStreamWidgetDefinitionType. -const ( - EVENTSTREAMWIDGETDEFINITIONTYPE_EVENT_STREAM EventStreamWidgetDefinitionType = "event_stream" -) - -var allowedEventStreamWidgetDefinitionTypeEnumValues = []EventStreamWidgetDefinitionType{ - EVENTSTREAMWIDGETDEFINITIONTYPE_EVENT_STREAM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventStreamWidgetDefinitionType) GetAllowedValues() []EventStreamWidgetDefinitionType { - return allowedEventStreamWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventStreamWidgetDefinitionType(value) - return nil -} - -// NewEventStreamWidgetDefinitionTypeFromValue returns a pointer to a valid EventStreamWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventStreamWidgetDefinitionTypeFromValue(v string) (*EventStreamWidgetDefinitionType, error) { - ev := EventStreamWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventStreamWidgetDefinitionType: valid values are %v", v, allowedEventStreamWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventStreamWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedEventStreamWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventStreamWidgetDefinitionType value. -func (v EventStreamWidgetDefinitionType) Ptr() *EventStreamWidgetDefinitionType { - return &v -} - -// NullableEventStreamWidgetDefinitionType handles when a null is used for EventStreamWidgetDefinitionType. -type NullableEventStreamWidgetDefinitionType struct { - value *EventStreamWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventStreamWidgetDefinitionType) Get() *EventStreamWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventStreamWidgetDefinitionType) Set(val *EventStreamWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventStreamWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventStreamWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventStreamWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableEventStreamWidgetDefinitionType(val *EventStreamWidgetDefinitionType) *NullableEventStreamWidgetDefinitionType { - return &NullableEventStreamWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_event_timeline_widget_definition.go b/api/v1/datadog/model_event_timeline_widget_definition.go deleted file mode 100644 index 93b15dd2c7a..00000000000 --- a/api/v1/datadog/model_event_timeline_widget_definition.go +++ /dev/null @@ -1,356 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventTimelineWidgetDefinition The event timeline is a widget version of the timeline that appears at the top of the Event Stream view. Only available on FREE layout dashboards. -type EventTimelineWidgetDefinition struct { - // Query to filter the event timeline with. - Query string `json:"query"` - // The execution method for multi-value filters. Can be either and or or. - TagsExecution *string `json:"tags_execution,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the event timeline widget. - Type EventTimelineWidgetDefinitionType `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{} -} - -// NewEventTimelineWidgetDefinition instantiates a new EventTimelineWidgetDefinition 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 NewEventTimelineWidgetDefinition(query string, typeVar EventTimelineWidgetDefinitionType) *EventTimelineWidgetDefinition { - this := EventTimelineWidgetDefinition{} - this.Query = query - this.Type = typeVar - return &this -} - -// NewEventTimelineWidgetDefinitionWithDefaults instantiates a new EventTimelineWidgetDefinition 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 NewEventTimelineWidgetDefinitionWithDefaults() *EventTimelineWidgetDefinition { - this := EventTimelineWidgetDefinition{} - var typeVar EventTimelineWidgetDefinitionType = EVENTTIMELINEWIDGETDEFINITIONTYPE_EVENT_TIMELINE - this.Type = typeVar - return &this -} - -// GetQuery returns the Query field value. -func (o *EventTimelineWidgetDefinition) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *EventTimelineWidgetDefinition) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *EventTimelineWidgetDefinition) SetQuery(v string) { - o.Query = v -} - -// GetTagsExecution returns the TagsExecution field value if set, zero value otherwise. -func (o *EventTimelineWidgetDefinition) GetTagsExecution() string { - if o == nil || o.TagsExecution == nil { - var ret string - return ret - } - return *o.TagsExecution -} - -// GetTagsExecutionOk returns a tuple with the TagsExecution field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventTimelineWidgetDefinition) GetTagsExecutionOk() (*string, bool) { - if o == nil || o.TagsExecution == nil { - return nil, false - } - return o.TagsExecution, true -} - -// HasTagsExecution returns a boolean if a field has been set. -func (o *EventTimelineWidgetDefinition) HasTagsExecution() bool { - if o != nil && o.TagsExecution != nil { - return true - } - - return false -} - -// SetTagsExecution gets a reference to the given string and assigns it to the TagsExecution field. -func (o *EventTimelineWidgetDefinition) SetTagsExecution(v string) { - o.TagsExecution = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *EventTimelineWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventTimelineWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *EventTimelineWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *EventTimelineWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *EventTimelineWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventTimelineWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *EventTimelineWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *EventTimelineWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *EventTimelineWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventTimelineWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *EventTimelineWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *EventTimelineWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *EventTimelineWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventTimelineWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *EventTimelineWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *EventTimelineWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *EventTimelineWidgetDefinition) GetType() EventTimelineWidgetDefinitionType { - if o == nil { - var ret EventTimelineWidgetDefinitionType - 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 *EventTimelineWidgetDefinition) GetTypeOk() (*EventTimelineWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *EventTimelineWidgetDefinition) SetType(v EventTimelineWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventTimelineWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["query"] = o.Query - if o.TagsExecution != nil { - toSerialize["tags_execution"] = o.TagsExecution - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *EventTimelineWidgetDefinitionType `json:"type"` - }{} - all := struct { - Query string `json:"query"` - TagsExecution *string `json:"tags_execution,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type EventTimelineWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - o.TagsExecution = all.TagsExecution - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_event_timeline_widget_definition_type.go b/api/v1/datadog/model_event_timeline_widget_definition_type.go deleted file mode 100644 index b4987245cf1..00000000000 --- a/api/v1/datadog/model_event_timeline_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventTimelineWidgetDefinitionType Type of the event timeline widget. -type EventTimelineWidgetDefinitionType string - -// List of EventTimelineWidgetDefinitionType. -const ( - EVENTTIMELINEWIDGETDEFINITIONTYPE_EVENT_TIMELINE EventTimelineWidgetDefinitionType = "event_timeline" -) - -var allowedEventTimelineWidgetDefinitionTypeEnumValues = []EventTimelineWidgetDefinitionType{ - EVENTTIMELINEWIDGETDEFINITIONTYPE_EVENT_TIMELINE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventTimelineWidgetDefinitionType) GetAllowedValues() []EventTimelineWidgetDefinitionType { - return allowedEventTimelineWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventTimelineWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventTimelineWidgetDefinitionType(value) - return nil -} - -// NewEventTimelineWidgetDefinitionTypeFromValue returns a pointer to a valid EventTimelineWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventTimelineWidgetDefinitionTypeFromValue(v string) (*EventTimelineWidgetDefinitionType, error) { - ev := EventTimelineWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventTimelineWidgetDefinitionType: valid values are %v", v, allowedEventTimelineWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventTimelineWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedEventTimelineWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventTimelineWidgetDefinitionType value. -func (v EventTimelineWidgetDefinitionType) Ptr() *EventTimelineWidgetDefinitionType { - return &v -} - -// NullableEventTimelineWidgetDefinitionType handles when a null is used for EventTimelineWidgetDefinitionType. -type NullableEventTimelineWidgetDefinitionType struct { - value *EventTimelineWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventTimelineWidgetDefinitionType) Get() *EventTimelineWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventTimelineWidgetDefinitionType) Set(val *EventTimelineWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventTimelineWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventTimelineWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventTimelineWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableEventTimelineWidgetDefinitionType(val *EventTimelineWidgetDefinitionType) *NullableEventTimelineWidgetDefinitionType { - return &NullableEventTimelineWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventTimelineWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventTimelineWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go b/api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go deleted file mode 100644 index 41f3c6e7070..00000000000 --- a/api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go +++ /dev/null @@ -1,119 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionApmDependencyStatName APM statistic. -type FormulaAndFunctionApmDependencyStatName string - -// List of FormulaAndFunctionApmDependencyStatName. -const ( - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_DURATION FormulaAndFunctionApmDependencyStatName = "avg_duration" - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_ROOT_DURATION FormulaAndFunctionApmDependencyStatName = "avg_root_duration" - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_SPANS_PER_TRACE FormulaAndFunctionApmDependencyStatName = "avg_spans_per_trace" - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_ERROR_RATE FormulaAndFunctionApmDependencyStatName = "error_rate" - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_EXEC_TIME FormulaAndFunctionApmDependencyStatName = "pct_exec_time" - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_OF_TRACES FormulaAndFunctionApmDependencyStatName = "pct_of_traces" - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_TOTAL_TRACES_COUNT FormulaAndFunctionApmDependencyStatName = "total_traces_count" -) - -var allowedFormulaAndFunctionApmDependencyStatNameEnumValues = []FormulaAndFunctionApmDependencyStatName{ - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_DURATION, - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_ROOT_DURATION, - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_SPANS_PER_TRACE, - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_ERROR_RATE, - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_EXEC_TIME, - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_OF_TRACES, - FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_TOTAL_TRACES_COUNT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionApmDependencyStatName) GetAllowedValues() []FormulaAndFunctionApmDependencyStatName { - return allowedFormulaAndFunctionApmDependencyStatNameEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionApmDependencyStatName) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionApmDependencyStatName(value) - return nil -} - -// NewFormulaAndFunctionApmDependencyStatNameFromValue returns a pointer to a valid FormulaAndFunctionApmDependencyStatName -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionApmDependencyStatNameFromValue(v string) (*FormulaAndFunctionApmDependencyStatName, error) { - ev := FormulaAndFunctionApmDependencyStatName(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmDependencyStatName: valid values are %v", v, allowedFormulaAndFunctionApmDependencyStatNameEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionApmDependencyStatName) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionApmDependencyStatNameEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionApmDependencyStatName value. -func (v FormulaAndFunctionApmDependencyStatName) Ptr() *FormulaAndFunctionApmDependencyStatName { - return &v -} - -// NullableFormulaAndFunctionApmDependencyStatName handles when a null is used for FormulaAndFunctionApmDependencyStatName. -type NullableFormulaAndFunctionApmDependencyStatName struct { - value *FormulaAndFunctionApmDependencyStatName - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatName) Get() *FormulaAndFunctionApmDependencyStatName { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmDependencyStatName) Set(val *FormulaAndFunctionApmDependencyStatName) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmDependencyStatName) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmDependencyStatName) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmDependencyStatName initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmDependencyStatName(val *FormulaAndFunctionApmDependencyStatName) *NullableFormulaAndFunctionApmDependencyStatName { - return &NullableFormulaAndFunctionApmDependencyStatName{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatName) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmDependencyStatName) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go b/api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go deleted file mode 100644 index 6b4eb95aa94..00000000000 --- a/api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionApmDependencyStatsDataSource Data source for APM dependency stats queries. -type FormulaAndFunctionApmDependencyStatsDataSource string - -// List of FormulaAndFunctionApmDependencyStatsDataSource. -const ( - FORMULAANDFUNCTIONAPMDEPENDENCYSTATSDATASOURCE_APM_DEPENDENCY_STATS FormulaAndFunctionApmDependencyStatsDataSource = "apm_dependency_stats" -) - -var allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues = []FormulaAndFunctionApmDependencyStatsDataSource{ - FORMULAANDFUNCTIONAPMDEPENDENCYSTATSDATASOURCE_APM_DEPENDENCY_STATS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionApmDependencyStatsDataSource) GetAllowedValues() []FormulaAndFunctionApmDependencyStatsDataSource { - return allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionApmDependencyStatsDataSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionApmDependencyStatsDataSource(value) - return nil -} - -// NewFormulaAndFunctionApmDependencyStatsDataSourceFromValue returns a pointer to a valid FormulaAndFunctionApmDependencyStatsDataSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionApmDependencyStatsDataSourceFromValue(v string) (*FormulaAndFunctionApmDependencyStatsDataSource, error) { - ev := FormulaAndFunctionApmDependencyStatsDataSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmDependencyStatsDataSource: valid values are %v", v, allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionApmDependencyStatsDataSource) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionApmDependencyStatsDataSource value. -func (v FormulaAndFunctionApmDependencyStatsDataSource) Ptr() *FormulaAndFunctionApmDependencyStatsDataSource { - return &v -} - -// NullableFormulaAndFunctionApmDependencyStatsDataSource handles when a null is used for FormulaAndFunctionApmDependencyStatsDataSource. -type NullableFormulaAndFunctionApmDependencyStatsDataSource struct { - value *FormulaAndFunctionApmDependencyStatsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) Get() *FormulaAndFunctionApmDependencyStatsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) Set(val *FormulaAndFunctionApmDependencyStatsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmDependencyStatsDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmDependencyStatsDataSource(val *FormulaAndFunctionApmDependencyStatsDataSource) *NullableFormulaAndFunctionApmDependencyStatsDataSource { - return &NullableFormulaAndFunctionApmDependencyStatsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go b/api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go deleted file mode 100644 index 4990fa2eefc..00000000000 --- a/api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go +++ /dev/null @@ -1,434 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionApmDependencyStatsQueryDefinition A formula and functions APM dependency stats query. -type FormulaAndFunctionApmDependencyStatsQueryDefinition struct { - // Data source for APM dependency stats queries. - DataSource FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` - // APM environment. - Env string `json:"env"` - // Determines whether stats for upstream or downstream dependencies should be queried. - IsUpstream *bool `json:"is_upstream,omitempty"` - // Name of query to use in formulas. - Name string `json:"name"` - // Name of operation on service. - OperationName string `json:"operation_name"` - // The name of the second primary tag used within APM; required when `primary_tag_value` is specified. See https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog. - PrimaryTagName *string `json:"primary_tag_name,omitempty"` - // Filter APM data by the second primary tag. `primary_tag_name` must also be specified. - PrimaryTagValue *string `json:"primary_tag_value,omitempty"` - // APM resource. - ResourceName string `json:"resource_name"` - // APM service. - Service string `json:"service"` - // APM statistic. - Stat FormulaAndFunctionApmDependencyStatName `json:"stat"` - // 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{} -} - -// NewFormulaAndFunctionApmDependencyStatsQueryDefinition instantiates a new FormulaAndFunctionApmDependencyStatsQueryDefinition 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 NewFormulaAndFunctionApmDependencyStatsQueryDefinition(dataSource FormulaAndFunctionApmDependencyStatsDataSource, env string, name string, operationName string, resourceName string, service string, stat FormulaAndFunctionApmDependencyStatName) *FormulaAndFunctionApmDependencyStatsQueryDefinition { - this := FormulaAndFunctionApmDependencyStatsQueryDefinition{} - this.DataSource = dataSource - this.Env = env - this.Name = name - this.OperationName = operationName - this.ResourceName = resourceName - this.Service = service - this.Stat = stat - return &this -} - -// NewFormulaAndFunctionApmDependencyStatsQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionApmDependencyStatsQueryDefinition 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 NewFormulaAndFunctionApmDependencyStatsQueryDefinitionWithDefaults() *FormulaAndFunctionApmDependencyStatsQueryDefinition { - this := FormulaAndFunctionApmDependencyStatsQueryDefinition{} - return &this -} - -// GetDataSource returns the DataSource field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetDataSource() FormulaAndFunctionApmDependencyStatsDataSource { - if o == nil { - var ret FormulaAndFunctionApmDependencyStatsDataSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionApmDependencyStatsDataSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetDataSource(v FormulaAndFunctionApmDependencyStatsDataSource) { - o.DataSource = v -} - -// GetEnv returns the Env field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetEnv() string { - if o == nil { - var ret string - return ret - } - return o.Env -} - -// GetEnvOk returns a tuple with the Env field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetEnvOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Env, true -} - -// SetEnv sets field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetEnv(v string) { - o.Env = v -} - -// GetIsUpstream returns the IsUpstream field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetIsUpstream() bool { - if o == nil || o.IsUpstream == nil { - var ret bool - return ret - } - return *o.IsUpstream -} - -// GetIsUpstreamOk returns a tuple with the IsUpstream field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetIsUpstreamOk() (*bool, bool) { - if o == nil || o.IsUpstream == nil { - return nil, false - } - return o.IsUpstream, true -} - -// HasIsUpstream returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) HasIsUpstream() bool { - if o != nil && o.IsUpstream != nil { - return true - } - - return false -} - -// SetIsUpstream gets a reference to the given bool and assigns it to the IsUpstream field. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetIsUpstream(v bool) { - o.IsUpstream = &v -} - -// GetName returns the Name field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetName(v string) { - o.Name = v -} - -// GetOperationName returns the OperationName field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetOperationName() string { - if o == nil { - var ret string - return ret - } - return o.OperationName -} - -// GetOperationNameOk returns a tuple with the OperationName field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetOperationNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.OperationName, true -} - -// SetOperationName sets field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetOperationName(v string) { - o.OperationName = v -} - -// GetPrimaryTagName returns the PrimaryTagName field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagName() string { - if o == nil || o.PrimaryTagName == nil { - var ret string - return ret - } - return *o.PrimaryTagName -} - -// GetPrimaryTagNameOk returns a tuple with the PrimaryTagName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagNameOk() (*string, bool) { - if o == nil || o.PrimaryTagName == nil { - return nil, false - } - return o.PrimaryTagName, true -} - -// HasPrimaryTagName returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) HasPrimaryTagName() bool { - if o != nil && o.PrimaryTagName != nil { - return true - } - - return false -} - -// SetPrimaryTagName gets a reference to the given string and assigns it to the PrimaryTagName field. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetPrimaryTagName(v string) { - o.PrimaryTagName = &v -} - -// GetPrimaryTagValue returns the PrimaryTagValue field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagValue() string { - if o == nil || o.PrimaryTagValue == nil { - var ret string - return ret - } - return *o.PrimaryTagValue -} - -// GetPrimaryTagValueOk returns a tuple with the PrimaryTagValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagValueOk() (*string, bool) { - if o == nil || o.PrimaryTagValue == nil { - return nil, false - } - return o.PrimaryTagValue, true -} - -// HasPrimaryTagValue returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) HasPrimaryTagValue() bool { - if o != nil && o.PrimaryTagValue != nil { - return true - } - - return false -} - -// SetPrimaryTagValue gets a reference to the given string and assigns it to the PrimaryTagValue field. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetPrimaryTagValue(v string) { - o.PrimaryTagValue = &v -} - -// GetResourceName returns the ResourceName field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetResourceName() string { - if o == nil { - var ret string - return ret - } - return o.ResourceName -} - -// GetResourceNameOk returns a tuple with the ResourceName field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetResourceNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ResourceName, true -} - -// SetResourceName sets field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetResourceName(v string) { - o.ResourceName = v -} - -// GetService returns the Service field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetService() string { - if o == nil { - var ret string - return ret - } - return o.Service -} - -// GetServiceOk returns a tuple with the Service field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetServiceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Service, true -} - -// SetService sets field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetService(v string) { - o.Service = v -} - -// GetStat returns the Stat field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetStat() FormulaAndFunctionApmDependencyStatName { - if o == nil { - var ret FormulaAndFunctionApmDependencyStatName - return ret - } - return o.Stat -} - -// GetStatOk returns a tuple with the Stat field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetStatOk() (*FormulaAndFunctionApmDependencyStatName, bool) { - if o == nil { - return nil, false - } - return &o.Stat, true -} - -// SetStat sets field value. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetStat(v FormulaAndFunctionApmDependencyStatName) { - o.Stat = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionApmDependencyStatsQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data_source"] = o.DataSource - toSerialize["env"] = o.Env - if o.IsUpstream != nil { - toSerialize["is_upstream"] = o.IsUpstream - } - toSerialize["name"] = o.Name - toSerialize["operation_name"] = o.OperationName - if o.PrimaryTagName != nil { - toSerialize["primary_tag_name"] = o.PrimaryTagName - } - if o.PrimaryTagValue != nil { - toSerialize["primary_tag_value"] = o.PrimaryTagValue - } - toSerialize["resource_name"] = o.ResourceName - toSerialize["service"] = o.Service - toSerialize["stat"] = o.Stat - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` - Env *string `json:"env"` - Name *string `json:"name"` - OperationName *string `json:"operation_name"` - ResourceName *string `json:"resource_name"` - Service *string `json:"service"` - Stat *FormulaAndFunctionApmDependencyStatName `json:"stat"` - }{} - all := struct { - DataSource FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` - Env string `json:"env"` - IsUpstream *bool `json:"is_upstream,omitempty"` - Name string `json:"name"` - OperationName string `json:"operation_name"` - PrimaryTagName *string `json:"primary_tag_name,omitempty"` - PrimaryTagValue *string `json:"primary_tag_value,omitempty"` - ResourceName string `json:"resource_name"` - Service string `json:"service"` - Stat FormulaAndFunctionApmDependencyStatName `json:"stat"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.Env == nil { - return fmt.Errorf("Required field env missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.OperationName == nil { - return fmt.Errorf("Required field operation_name missing") - } - if required.ResourceName == nil { - return fmt.Errorf("Required field resource_name missing") - } - if required.Service == nil { - return fmt.Errorf("Required field service missing") - } - if required.Stat == nil { - return fmt.Errorf("Required field stat missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Stat; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DataSource = all.DataSource - o.Env = all.Env - o.IsUpstream = all.IsUpstream - o.Name = all.Name - o.OperationName = all.OperationName - o.PrimaryTagName = all.PrimaryTagName - o.PrimaryTagValue = all.PrimaryTagValue - o.ResourceName = all.ResourceName - o.Service = all.Service - o.Stat = all.Stat - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go b/api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go deleted file mode 100644 index 823074356d4..00000000000 --- a/api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go +++ /dev/null @@ -1,127 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionApmResourceStatName APM resource stat name. -type FormulaAndFunctionApmResourceStatName string - -// List of FormulaAndFunctionApmResourceStatName. -const ( - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERRORS FormulaAndFunctionApmResourceStatName = "errors" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERROR_RATE FormulaAndFunctionApmResourceStatName = "error_rate" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_HITS FormulaAndFunctionApmResourceStatName = "hits" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_AVG FormulaAndFunctionApmResourceStatName = "latency_avg" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_DISTRIBUTION FormulaAndFunctionApmResourceStatName = "latency_distribution" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_MAX FormulaAndFunctionApmResourceStatName = "latency_max" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P50 FormulaAndFunctionApmResourceStatName = "latency_p50" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P75 FormulaAndFunctionApmResourceStatName = "latency_p75" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P90 FormulaAndFunctionApmResourceStatName = "latency_p90" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P95 FormulaAndFunctionApmResourceStatName = "latency_p95" - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P99 FormulaAndFunctionApmResourceStatName = "latency_p99" -) - -var allowedFormulaAndFunctionApmResourceStatNameEnumValues = []FormulaAndFunctionApmResourceStatName{ - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERRORS, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERROR_RATE, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_HITS, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_AVG, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_DISTRIBUTION, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_MAX, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P50, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P75, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P90, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P95, - FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P99, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionApmResourceStatName) GetAllowedValues() []FormulaAndFunctionApmResourceStatName { - return allowedFormulaAndFunctionApmResourceStatNameEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionApmResourceStatName) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionApmResourceStatName(value) - return nil -} - -// NewFormulaAndFunctionApmResourceStatNameFromValue returns a pointer to a valid FormulaAndFunctionApmResourceStatName -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionApmResourceStatNameFromValue(v string) (*FormulaAndFunctionApmResourceStatName, error) { - ev := FormulaAndFunctionApmResourceStatName(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmResourceStatName: valid values are %v", v, allowedFormulaAndFunctionApmResourceStatNameEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionApmResourceStatName) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionApmResourceStatNameEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionApmResourceStatName value. -func (v FormulaAndFunctionApmResourceStatName) Ptr() *FormulaAndFunctionApmResourceStatName { - return &v -} - -// NullableFormulaAndFunctionApmResourceStatName handles when a null is used for FormulaAndFunctionApmResourceStatName. -type NullableFormulaAndFunctionApmResourceStatName struct { - value *FormulaAndFunctionApmResourceStatName - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmResourceStatName) Get() *FormulaAndFunctionApmResourceStatName { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmResourceStatName) Set(val *FormulaAndFunctionApmResourceStatName) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmResourceStatName) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmResourceStatName) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmResourceStatName initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmResourceStatName(val *FormulaAndFunctionApmResourceStatName) *NullableFormulaAndFunctionApmResourceStatName { - return &NullableFormulaAndFunctionApmResourceStatName{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmResourceStatName) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmResourceStatName) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go b/api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go deleted file mode 100644 index 652ec79553c..00000000000 --- a/api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionApmResourceStatsDataSource Data source for APM resource stats queries. -type FormulaAndFunctionApmResourceStatsDataSource string - -// List of FormulaAndFunctionApmResourceStatsDataSource. -const ( - FORMULAANDFUNCTIONAPMRESOURCESTATSDATASOURCE_APM_RESOURCE_STATS FormulaAndFunctionApmResourceStatsDataSource = "apm_resource_stats" -) - -var allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues = []FormulaAndFunctionApmResourceStatsDataSource{ - FORMULAANDFUNCTIONAPMRESOURCESTATSDATASOURCE_APM_RESOURCE_STATS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionApmResourceStatsDataSource) GetAllowedValues() []FormulaAndFunctionApmResourceStatsDataSource { - return allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionApmResourceStatsDataSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionApmResourceStatsDataSource(value) - return nil -} - -// NewFormulaAndFunctionApmResourceStatsDataSourceFromValue returns a pointer to a valid FormulaAndFunctionApmResourceStatsDataSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionApmResourceStatsDataSourceFromValue(v string) (*FormulaAndFunctionApmResourceStatsDataSource, error) { - ev := FormulaAndFunctionApmResourceStatsDataSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmResourceStatsDataSource: valid values are %v", v, allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionApmResourceStatsDataSource) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionApmResourceStatsDataSource value. -func (v FormulaAndFunctionApmResourceStatsDataSource) Ptr() *FormulaAndFunctionApmResourceStatsDataSource { - return &v -} - -// NullableFormulaAndFunctionApmResourceStatsDataSource handles when a null is used for FormulaAndFunctionApmResourceStatsDataSource. -type NullableFormulaAndFunctionApmResourceStatsDataSource struct { - value *FormulaAndFunctionApmResourceStatsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionApmResourceStatsDataSource) Get() *FormulaAndFunctionApmResourceStatsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) Set(val *FormulaAndFunctionApmResourceStatsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionApmResourceStatsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionApmResourceStatsDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionApmResourceStatsDataSource(val *FormulaAndFunctionApmResourceStatsDataSource) *NullableFormulaAndFunctionApmResourceStatsDataSource { - return &NullableFormulaAndFunctionApmResourceStatsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionApmResourceStatsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go b/api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go deleted file mode 100644 index b998bc0a572..00000000000 --- a/api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go +++ /dev/null @@ -1,446 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionApmResourceStatsQueryDefinition APM resource stats query using formulas and functions. -type FormulaAndFunctionApmResourceStatsQueryDefinition struct { - // Data source for APM resource stats queries. - DataSource FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` - // APM environment. - Env string `json:"env"` - // Array of fields to group results by. - GroupBy []string `json:"group_by,omitempty"` - // Name of this query to use in formulas. - Name string `json:"name"` - // Name of operation on service. - OperationName *string `json:"operation_name,omitempty"` - // Name of the second primary tag used within APM. Required when `primary_tag_value` is specified. See https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog - PrimaryTagName *string `json:"primary_tag_name,omitempty"` - // Value of the second primary tag by which to filter APM data. `primary_tag_name` must also be specified. - PrimaryTagValue *string `json:"primary_tag_value,omitempty"` - // APM resource name. - ResourceName *string `json:"resource_name,omitempty"` - // APM service name. - Service string `json:"service"` - // APM resource stat name. - Stat FormulaAndFunctionApmResourceStatName `json:"stat"` - // 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{} -} - -// NewFormulaAndFunctionApmResourceStatsQueryDefinition instantiates a new FormulaAndFunctionApmResourceStatsQueryDefinition 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 NewFormulaAndFunctionApmResourceStatsQueryDefinition(dataSource FormulaAndFunctionApmResourceStatsDataSource, env string, name string, service string, stat FormulaAndFunctionApmResourceStatName) *FormulaAndFunctionApmResourceStatsQueryDefinition { - this := FormulaAndFunctionApmResourceStatsQueryDefinition{} - this.DataSource = dataSource - this.Env = env - this.Name = name - this.Service = service - this.Stat = stat - return &this -} - -// NewFormulaAndFunctionApmResourceStatsQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionApmResourceStatsQueryDefinition 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 NewFormulaAndFunctionApmResourceStatsQueryDefinitionWithDefaults() *FormulaAndFunctionApmResourceStatsQueryDefinition { - this := FormulaAndFunctionApmResourceStatsQueryDefinition{} - return &this -} - -// GetDataSource returns the DataSource field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetDataSource() FormulaAndFunctionApmResourceStatsDataSource { - if o == nil { - var ret FormulaAndFunctionApmResourceStatsDataSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionApmResourceStatsDataSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetDataSource(v FormulaAndFunctionApmResourceStatsDataSource) { - o.DataSource = v -} - -// GetEnv returns the Env field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetEnv() string { - if o == nil { - var ret string - return ret - } - return o.Env -} - -// GetEnvOk returns a tuple with the Env field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetEnvOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Env, true -} - -// SetEnv sets field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetEnv(v string) { - o.Env = v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetGroupBy() []string { - if o == nil || o.GroupBy == nil { - var ret []string - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetGroupByOk() (*[]string, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetGroupBy(v []string) { - o.GroupBy = v -} - -// GetName returns the Name field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetName(v string) { - o.Name = v -} - -// GetOperationName returns the OperationName field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetOperationName() string { - if o == nil || o.OperationName == nil { - var ret string - return ret - } - return *o.OperationName -} - -// GetOperationNameOk returns a tuple with the OperationName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetOperationNameOk() (*string, bool) { - if o == nil || o.OperationName == nil { - return nil, false - } - return o.OperationName, true -} - -// HasOperationName returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasOperationName() bool { - if o != nil && o.OperationName != nil { - return true - } - - return false -} - -// SetOperationName gets a reference to the given string and assigns it to the OperationName field. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetOperationName(v string) { - o.OperationName = &v -} - -// GetPrimaryTagName returns the PrimaryTagName field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagName() string { - if o == nil || o.PrimaryTagName == nil { - var ret string - return ret - } - return *o.PrimaryTagName -} - -// GetPrimaryTagNameOk returns a tuple with the PrimaryTagName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagNameOk() (*string, bool) { - if o == nil || o.PrimaryTagName == nil { - return nil, false - } - return o.PrimaryTagName, true -} - -// HasPrimaryTagName returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasPrimaryTagName() bool { - if o != nil && o.PrimaryTagName != nil { - return true - } - - return false -} - -// SetPrimaryTagName gets a reference to the given string and assigns it to the PrimaryTagName field. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetPrimaryTagName(v string) { - o.PrimaryTagName = &v -} - -// GetPrimaryTagValue returns the PrimaryTagValue field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagValue() string { - if o == nil || o.PrimaryTagValue == nil { - var ret string - return ret - } - return *o.PrimaryTagValue -} - -// GetPrimaryTagValueOk returns a tuple with the PrimaryTagValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagValueOk() (*string, bool) { - if o == nil || o.PrimaryTagValue == nil { - return nil, false - } - return o.PrimaryTagValue, true -} - -// HasPrimaryTagValue returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasPrimaryTagValue() bool { - if o != nil && o.PrimaryTagValue != nil { - return true - } - - return false -} - -// SetPrimaryTagValue gets a reference to the given string and assigns it to the PrimaryTagValue field. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetPrimaryTagValue(v string) { - o.PrimaryTagValue = &v -} - -// GetResourceName returns the ResourceName field value if set, zero value otherwise. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetResourceName() string { - if o == nil || o.ResourceName == nil { - var ret string - return ret - } - return *o.ResourceName -} - -// GetResourceNameOk returns a tuple with the ResourceName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetResourceNameOk() (*string, bool) { - if o == nil || o.ResourceName == nil { - return nil, false - } - return o.ResourceName, true -} - -// HasResourceName returns a boolean if a field has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasResourceName() bool { - if o != nil && o.ResourceName != nil { - return true - } - - return false -} - -// SetResourceName gets a reference to the given string and assigns it to the ResourceName field. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetResourceName(v string) { - o.ResourceName = &v -} - -// GetService returns the Service field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetService() string { - if o == nil { - var ret string - return ret - } - return o.Service -} - -// GetServiceOk returns a tuple with the Service field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetServiceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Service, true -} - -// SetService sets field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetService(v string) { - o.Service = v -} - -// GetStat returns the Stat field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetStat() FormulaAndFunctionApmResourceStatName { - if o == nil { - var ret FormulaAndFunctionApmResourceStatName - return ret - } - return o.Stat -} - -// GetStatOk returns a tuple with the Stat field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetStatOk() (*FormulaAndFunctionApmResourceStatName, bool) { - if o == nil { - return nil, false - } - return &o.Stat, true -} - -// SetStat sets field value. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetStat(v FormulaAndFunctionApmResourceStatName) { - o.Stat = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionApmResourceStatsQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data_source"] = o.DataSource - toSerialize["env"] = o.Env - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - toSerialize["name"] = o.Name - if o.OperationName != nil { - toSerialize["operation_name"] = o.OperationName - } - if o.PrimaryTagName != nil { - toSerialize["primary_tag_name"] = o.PrimaryTagName - } - if o.PrimaryTagValue != nil { - toSerialize["primary_tag_value"] = o.PrimaryTagValue - } - if o.ResourceName != nil { - toSerialize["resource_name"] = o.ResourceName - } - toSerialize["service"] = o.Service - toSerialize["stat"] = o.Stat - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` - Env *string `json:"env"` - Name *string `json:"name"` - Service *string `json:"service"` - Stat *FormulaAndFunctionApmResourceStatName `json:"stat"` - }{} - all := struct { - DataSource FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` - Env string `json:"env"` - GroupBy []string `json:"group_by,omitempty"` - Name string `json:"name"` - OperationName *string `json:"operation_name,omitempty"` - PrimaryTagName *string `json:"primary_tag_name,omitempty"` - PrimaryTagValue *string `json:"primary_tag_value,omitempty"` - ResourceName *string `json:"resource_name,omitempty"` - Service string `json:"service"` - Stat FormulaAndFunctionApmResourceStatName `json:"stat"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.Env == nil { - return fmt.Errorf("Required field env missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Service == nil { - return fmt.Errorf("Required field service missing") - } - if required.Stat == nil { - return fmt.Errorf("Required field stat missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Stat; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DataSource = all.DataSource - o.Env = all.Env - o.GroupBy = all.GroupBy - o.Name = all.Name - o.OperationName = all.OperationName - o.PrimaryTagName = all.PrimaryTagName - o.PrimaryTagValue = all.PrimaryTagValue - o.ResourceName = all.ResourceName - o.Service = all.Service - o.Stat = all.Stat - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_event_aggregation.go b/api/v1/datadog/model_formula_and_function_event_aggregation.go deleted file mode 100644 index 3d3667439f7..00000000000 --- a/api/v1/datadog/model_formula_and_function_event_aggregation.go +++ /dev/null @@ -1,129 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionEventAggregation Aggregation methods for event platform queries. -type FormulaAndFunctionEventAggregation string - -// List of FormulaAndFunctionEventAggregation. -const ( - FORMULAANDFUNCTIONEVENTAGGREGATION_COUNT FormulaAndFunctionEventAggregation = "count" - FORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY FormulaAndFunctionEventAggregation = "cardinality" - FORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN FormulaAndFunctionEventAggregation = "median" - FORMULAANDFUNCTIONEVENTAGGREGATION_PC75 FormulaAndFunctionEventAggregation = "pc75" - FORMULAANDFUNCTIONEVENTAGGREGATION_PC90 FormulaAndFunctionEventAggregation = "pc90" - FORMULAANDFUNCTIONEVENTAGGREGATION_PC95 FormulaAndFunctionEventAggregation = "pc95" - FORMULAANDFUNCTIONEVENTAGGREGATION_PC98 FormulaAndFunctionEventAggregation = "pc98" - FORMULAANDFUNCTIONEVENTAGGREGATION_PC99 FormulaAndFunctionEventAggregation = "pc99" - FORMULAANDFUNCTIONEVENTAGGREGATION_SUM FormulaAndFunctionEventAggregation = "sum" - FORMULAANDFUNCTIONEVENTAGGREGATION_MIN FormulaAndFunctionEventAggregation = "min" - FORMULAANDFUNCTIONEVENTAGGREGATION_MAX FormulaAndFunctionEventAggregation = "max" - FORMULAANDFUNCTIONEVENTAGGREGATION_AVG FormulaAndFunctionEventAggregation = "avg" -) - -var allowedFormulaAndFunctionEventAggregationEnumValues = []FormulaAndFunctionEventAggregation{ - FORMULAANDFUNCTIONEVENTAGGREGATION_COUNT, - FORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY, - FORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN, - FORMULAANDFUNCTIONEVENTAGGREGATION_PC75, - FORMULAANDFUNCTIONEVENTAGGREGATION_PC90, - FORMULAANDFUNCTIONEVENTAGGREGATION_PC95, - FORMULAANDFUNCTIONEVENTAGGREGATION_PC98, - FORMULAANDFUNCTIONEVENTAGGREGATION_PC99, - FORMULAANDFUNCTIONEVENTAGGREGATION_SUM, - FORMULAANDFUNCTIONEVENTAGGREGATION_MIN, - FORMULAANDFUNCTIONEVENTAGGREGATION_MAX, - FORMULAANDFUNCTIONEVENTAGGREGATION_AVG, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionEventAggregation) GetAllowedValues() []FormulaAndFunctionEventAggregation { - return allowedFormulaAndFunctionEventAggregationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionEventAggregation(value) - return nil -} - -// NewFormulaAndFunctionEventAggregationFromValue returns a pointer to a valid FormulaAndFunctionEventAggregation -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionEventAggregationFromValue(v string) (*FormulaAndFunctionEventAggregation, error) { - ev := FormulaAndFunctionEventAggregation(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionEventAggregation: valid values are %v", v, allowedFormulaAndFunctionEventAggregationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionEventAggregation) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionEventAggregationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionEventAggregation value. -func (v FormulaAndFunctionEventAggregation) Ptr() *FormulaAndFunctionEventAggregation { - return &v -} - -// NullableFormulaAndFunctionEventAggregation handles when a null is used for FormulaAndFunctionEventAggregation. -type NullableFormulaAndFunctionEventAggregation struct { - value *FormulaAndFunctionEventAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionEventAggregation) Get() *FormulaAndFunctionEventAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionEventAggregation) Set(val *FormulaAndFunctionEventAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionEventAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionEventAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionEventAggregation initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionEventAggregation(val *FormulaAndFunctionEventAggregation) *NullableFormulaAndFunctionEventAggregation { - return &NullableFormulaAndFunctionEventAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionEventAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_event_query_definition.go b/api/v1/datadog/model_formula_and_function_event_query_definition.go deleted file mode 100644 index f673feb854c..00000000000 --- a/api/v1/datadog/model_formula_and_function_event_query_definition.go +++ /dev/null @@ -1,308 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionEventQueryDefinition A formula and functions events query. -type FormulaAndFunctionEventQueryDefinition struct { - // Compute options. - Compute FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - // Data source for event platform-based queries. - DataSource FormulaAndFunctionEventsDataSource `json:"data_source"` - // Group by options. - GroupBy []FormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` - // An array of index names to query in the stream. Omit or use `[]` to query all indexes at once. - Indexes []string `json:"indexes,omitempty"` - // Name of the query for use in formulas. - Name string `json:"name"` - // Search options. - Search *FormulaAndFunctionEventQueryDefinitionSearch `json:"search,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{} -} - -// NewFormulaAndFunctionEventQueryDefinition instantiates a new FormulaAndFunctionEventQueryDefinition 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 NewFormulaAndFunctionEventQueryDefinition(compute FormulaAndFunctionEventQueryDefinitionCompute, dataSource FormulaAndFunctionEventsDataSource, name string) *FormulaAndFunctionEventQueryDefinition { - this := FormulaAndFunctionEventQueryDefinition{} - this.Compute = compute - this.DataSource = dataSource - this.Name = name - return &this -} - -// NewFormulaAndFunctionEventQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionEventQueryDefinition 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 NewFormulaAndFunctionEventQueryDefinitionWithDefaults() *FormulaAndFunctionEventQueryDefinition { - this := FormulaAndFunctionEventQueryDefinition{} - return &this -} - -// GetCompute returns the Compute field value. -func (o *FormulaAndFunctionEventQueryDefinition) GetCompute() FormulaAndFunctionEventQueryDefinitionCompute { - if o == nil { - var ret FormulaAndFunctionEventQueryDefinitionCompute - return ret - } - return o.Compute -} - -// GetComputeOk returns a tuple with the Compute field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinition) GetComputeOk() (*FormulaAndFunctionEventQueryDefinitionCompute, bool) { - if o == nil { - return nil, false - } - return &o.Compute, true -} - -// SetCompute sets field value. -func (o *FormulaAndFunctionEventQueryDefinition) SetCompute(v FormulaAndFunctionEventQueryDefinitionCompute) { - o.Compute = v -} - -// GetDataSource returns the DataSource field value. -func (o *FormulaAndFunctionEventQueryDefinition) GetDataSource() FormulaAndFunctionEventsDataSource { - if o == nil { - var ret FormulaAndFunctionEventsDataSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionEventsDataSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *FormulaAndFunctionEventQueryDefinition) SetDataSource(v FormulaAndFunctionEventsDataSource) { - o.DataSource = v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryDefinition) GetGroupBy() []FormulaAndFunctionEventQueryGroupBy { - if o == nil || o.GroupBy == nil { - var ret []FormulaAndFunctionEventQueryGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinition) GetGroupByOk() (*[]FormulaAndFunctionEventQueryGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryDefinition) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []FormulaAndFunctionEventQueryGroupBy and assigns it to the GroupBy field. -func (o *FormulaAndFunctionEventQueryDefinition) SetGroupBy(v []FormulaAndFunctionEventQueryGroupBy) { - o.GroupBy = v -} - -// GetIndexes returns the Indexes field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryDefinition) GetIndexes() []string { - if o == nil || o.Indexes == nil { - var ret []string - return ret - } - return o.Indexes -} - -// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinition) GetIndexesOk() (*[]string, bool) { - if o == nil || o.Indexes == nil { - return nil, false - } - return &o.Indexes, true -} - -// HasIndexes returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryDefinition) HasIndexes() bool { - if o != nil && o.Indexes != nil { - return true - } - - return false -} - -// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. -func (o *FormulaAndFunctionEventQueryDefinition) SetIndexes(v []string) { - o.Indexes = v -} - -// GetName returns the Name field value. -func (o *FormulaAndFunctionEventQueryDefinition) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinition) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *FormulaAndFunctionEventQueryDefinition) SetName(v string) { - o.Name = v -} - -// GetSearch returns the Search field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryDefinition) GetSearch() FormulaAndFunctionEventQueryDefinitionSearch { - if o == nil || o.Search == nil { - var ret FormulaAndFunctionEventQueryDefinitionSearch - return ret - } - return *o.Search -} - -// GetSearchOk returns a tuple with the Search field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinition) GetSearchOk() (*FormulaAndFunctionEventQueryDefinitionSearch, bool) { - if o == nil || o.Search == nil { - return nil, false - } - return o.Search, true -} - -// HasSearch returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryDefinition) HasSearch() bool { - if o != nil && o.Search != nil { - return true - } - - return false -} - -// SetSearch gets a reference to the given FormulaAndFunctionEventQueryDefinitionSearch and assigns it to the Search field. -func (o *FormulaAndFunctionEventQueryDefinition) SetSearch(v FormulaAndFunctionEventQueryDefinitionSearch) { - o.Search = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["compute"] = o.Compute - toSerialize["data_source"] = o.DataSource - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Indexes != nil { - toSerialize["indexes"] = o.Indexes - } - toSerialize["name"] = o.Name - if o.Search != nil { - toSerialize["search"] = o.Search - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Compute *FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - DataSource *FormulaAndFunctionEventsDataSource `json:"data_source"` - Name *string `json:"name"` - }{} - all := struct { - Compute FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - DataSource FormulaAndFunctionEventsDataSource `json:"data_source"` - GroupBy []FormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Name string `json:"name"` - Search *FormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("Required field compute missing") - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Compute = all.Compute - o.DataSource = all.DataSource - o.GroupBy = all.GroupBy - o.Indexes = all.Indexes - o.Name = all.Name - if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Search = all.Search - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_event_query_definition_compute.go b/api/v1/datadog/model_formula_and_function_event_query_definition_compute.go deleted file mode 100644 index 8a2d9ad268f..00000000000 --- a/api/v1/datadog/model_formula_and_function_event_query_definition_compute.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionEventQueryDefinitionCompute Compute options. -type FormulaAndFunctionEventQueryDefinitionCompute struct { - // Aggregation methods for event platform queries. - Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` - // A time interval in milliseconds. - Interval *int64 `json:"interval,omitempty"` - // Measurable attribute to compute. - Metric *string `json:"metric,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{} -} - -// NewFormulaAndFunctionEventQueryDefinitionCompute instantiates a new FormulaAndFunctionEventQueryDefinitionCompute 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 NewFormulaAndFunctionEventQueryDefinitionCompute(aggregation FormulaAndFunctionEventAggregation) *FormulaAndFunctionEventQueryDefinitionCompute { - this := FormulaAndFunctionEventQueryDefinitionCompute{} - this.Aggregation = aggregation - return &this -} - -// NewFormulaAndFunctionEventQueryDefinitionComputeWithDefaults instantiates a new FormulaAndFunctionEventQueryDefinitionCompute 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 NewFormulaAndFunctionEventQueryDefinitionComputeWithDefaults() *FormulaAndFunctionEventQueryDefinitionCompute { - this := FormulaAndFunctionEventQueryDefinitionCompute{} - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetAggregation() FormulaAndFunctionEventAggregation { - if o == nil { - var ret FormulaAndFunctionEventAggregation - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetAggregationOk() (*FormulaAndFunctionEventAggregation, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) SetAggregation(v FormulaAndFunctionEventAggregation) { - o.Aggregation = v -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetInterval() int64 { - if o == nil || o.Interval == nil { - var ret int64 - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetIntervalOk() (*int64, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given int64 and assigns it to the Interval field. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) SetInterval(v int64) { - o.Interval = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) SetMetric(v string) { - o.Metric = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` - }{} - all := struct { - Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` - Interval *int64 `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Interval = all.Interval - o.Metric = all.Metric - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_event_query_definition_search.go b/api/v1/datadog/model_formula_and_function_event_query_definition_search.go deleted file mode 100644 index 7bd2fadad93..00000000000 --- a/api/v1/datadog/model_formula_and_function_event_query_definition_search.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionEventQueryDefinitionSearch Search options. -type FormulaAndFunctionEventQueryDefinitionSearch struct { - // Events search string. - Query string `json:"query"` - // 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{} -} - -// NewFormulaAndFunctionEventQueryDefinitionSearch instantiates a new FormulaAndFunctionEventQueryDefinitionSearch 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 NewFormulaAndFunctionEventQueryDefinitionSearch(query string) *FormulaAndFunctionEventQueryDefinitionSearch { - this := FormulaAndFunctionEventQueryDefinitionSearch{} - this.Query = query - return &this -} - -// NewFormulaAndFunctionEventQueryDefinitionSearchWithDefaults instantiates a new FormulaAndFunctionEventQueryDefinitionSearch 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 NewFormulaAndFunctionEventQueryDefinitionSearchWithDefaults() *FormulaAndFunctionEventQueryDefinitionSearch { - this := FormulaAndFunctionEventQueryDefinitionSearch{} - return &this -} - -// GetQuery returns the Query field value. -func (o *FormulaAndFunctionEventQueryDefinitionSearch) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryDefinitionSearch) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *FormulaAndFunctionEventQueryDefinitionSearch) SetQuery(v string) { - o.Query = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["query"] = o.Query - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} - all := struct { - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_event_query_group_by.go b/api/v1/datadog/model_formula_and_function_event_query_group_by.go deleted file mode 100644 index 2852c351a1c..00000000000 --- a/api/v1/datadog/model_formula_and_function_event_query_group_by.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionEventQueryGroupBy List of objects used to group by. -type FormulaAndFunctionEventQueryGroupBy struct { - // Event facet. - Facet string `json:"facet"` - // Number of groups to return. - Limit *int64 `json:"limit,omitempty"` - // Options for sorting group by results. - Sort *FormulaAndFunctionEventQueryGroupBySort `json:"sort,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{} -} - -// NewFormulaAndFunctionEventQueryGroupBy instantiates a new FormulaAndFunctionEventQueryGroupBy 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 NewFormulaAndFunctionEventQueryGroupBy(facet string) *FormulaAndFunctionEventQueryGroupBy { - this := FormulaAndFunctionEventQueryGroupBy{} - this.Facet = facet - return &this -} - -// NewFormulaAndFunctionEventQueryGroupByWithDefaults instantiates a new FormulaAndFunctionEventQueryGroupBy 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 NewFormulaAndFunctionEventQueryGroupByWithDefaults() *FormulaAndFunctionEventQueryGroupBy { - this := FormulaAndFunctionEventQueryGroupBy{} - return &this -} - -// GetFacet returns the Facet field value. -func (o *FormulaAndFunctionEventQueryGroupBy) GetFacet() string { - if o == nil { - var ret string - return ret - } - return o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryGroupBy) GetFacetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Facet, true -} - -// SetFacet sets field value. -func (o *FormulaAndFunctionEventQueryGroupBy) SetFacet(v string) { - o.Facet = v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryGroupBy) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryGroupBy) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryGroupBy) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *FormulaAndFunctionEventQueryGroupBy) SetLimit(v int64) { - o.Limit = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryGroupBy) GetSort() FormulaAndFunctionEventQueryGroupBySort { - if o == nil || o.Sort == nil { - var ret FormulaAndFunctionEventQueryGroupBySort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryGroupBy) GetSortOk() (*FormulaAndFunctionEventQueryGroupBySort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryGroupBy) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given FormulaAndFunctionEventQueryGroupBySort and assigns it to the Sort field. -func (o *FormulaAndFunctionEventQueryGroupBy) SetSort(v FormulaAndFunctionEventQueryGroupBySort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["facet"] = o.Facet - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} - all := struct { - Facet string `json:"facet"` - Limit *int64 `json:"limit,omitempty"` - Sort *FormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("Required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Facet = all.Facet - o.Limit = all.Limit - if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Sort = all.Sort - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go b/api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go deleted file mode 100644 index dc7ad5758e5..00000000000 --- a/api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionEventQueryGroupBySort Options for sorting group by results. -type FormulaAndFunctionEventQueryGroupBySort struct { - // Aggregation methods for event platform queries. - Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` - // Metric used for sorting group by results. - Metric *string `json:"metric,omitempty"` - // Direction of sort. - Order *QuerySortOrder `json:"order,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{} -} - -// NewFormulaAndFunctionEventQueryGroupBySort instantiates a new FormulaAndFunctionEventQueryGroupBySort 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 NewFormulaAndFunctionEventQueryGroupBySort(aggregation FormulaAndFunctionEventAggregation) *FormulaAndFunctionEventQueryGroupBySort { - this := FormulaAndFunctionEventQueryGroupBySort{} - this.Aggregation = aggregation - var order QuerySortOrder = QUERYSORTORDER_DESC - this.Order = &order - return &this -} - -// NewFormulaAndFunctionEventQueryGroupBySortWithDefaults instantiates a new FormulaAndFunctionEventQueryGroupBySort 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 NewFormulaAndFunctionEventQueryGroupBySortWithDefaults() *FormulaAndFunctionEventQueryGroupBySort { - this := FormulaAndFunctionEventQueryGroupBySort{} - var order QuerySortOrder = QUERYSORTORDER_DESC - this.Order = &order - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *FormulaAndFunctionEventQueryGroupBySort) GetAggregation() FormulaAndFunctionEventAggregation { - if o == nil { - var ret FormulaAndFunctionEventAggregation - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryGroupBySort) GetAggregationOk() (*FormulaAndFunctionEventAggregation, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *FormulaAndFunctionEventQueryGroupBySort) SetAggregation(v FormulaAndFunctionEventAggregation) { - o.Aggregation = v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryGroupBySort) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryGroupBySort) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryGroupBySort) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *FormulaAndFunctionEventQueryGroupBySort) SetMetric(v string) { - o.Metric = &v -} - -// GetOrder returns the Order field value if set, zero value otherwise. -func (o *FormulaAndFunctionEventQueryGroupBySort) GetOrder() QuerySortOrder { - if o == nil || o.Order == nil { - var ret QuerySortOrder - return ret - } - return *o.Order -} - -// GetOrderOk returns a tuple with the Order field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionEventQueryGroupBySort) GetOrderOk() (*QuerySortOrder, bool) { - if o == nil || o.Order == nil { - return nil, false - } - return o.Order, true -} - -// HasOrder returns a boolean if a field has been set. -func (o *FormulaAndFunctionEventQueryGroupBySort) HasOrder() bool { - if o != nil && o.Order != nil { - return true - } - - return false -} - -// SetOrder gets a reference to the given QuerySortOrder and assigns it to the Order field. -func (o *FormulaAndFunctionEventQueryGroupBySort) SetOrder(v QuerySortOrder) { - o.Order = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Order != nil { - toSerialize["order"] = o.Order - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` - }{} - all := struct { - Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` - Metric *string `json:"metric,omitempty"` - Order *QuerySortOrder `json:"order,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Metric = all.Metric - o.Order = all.Order - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_events_data_source.go b/api/v1/datadog/model_formula_and_function_events_data_source.go deleted file mode 100644 index c502bceb811..00000000000 --- a/api/v1/datadog/model_formula_and_function_events_data_source.go +++ /dev/null @@ -1,121 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionEventsDataSource Data source for event platform-based queries. -type FormulaAndFunctionEventsDataSource string - -// List of FormulaAndFunctionEventsDataSource. -const ( - FORMULAANDFUNCTIONEVENTSDATASOURCE_LOGS FormulaAndFunctionEventsDataSource = "logs" - FORMULAANDFUNCTIONEVENTSDATASOURCE_SPANS FormulaAndFunctionEventsDataSource = "spans" - FORMULAANDFUNCTIONEVENTSDATASOURCE_NETWORK FormulaAndFunctionEventsDataSource = "network" - FORMULAANDFUNCTIONEVENTSDATASOURCE_RUM FormulaAndFunctionEventsDataSource = "rum" - FORMULAANDFUNCTIONEVENTSDATASOURCE_SECURITY_SIGNALS FormulaAndFunctionEventsDataSource = "security_signals" - FORMULAANDFUNCTIONEVENTSDATASOURCE_PROFILES FormulaAndFunctionEventsDataSource = "profiles" - FORMULAANDFUNCTIONEVENTSDATASOURCE_AUDIT FormulaAndFunctionEventsDataSource = "audit" - FORMULAANDFUNCTIONEVENTSDATASOURCE_EVENTS FormulaAndFunctionEventsDataSource = "events" -) - -var allowedFormulaAndFunctionEventsDataSourceEnumValues = []FormulaAndFunctionEventsDataSource{ - FORMULAANDFUNCTIONEVENTSDATASOURCE_LOGS, - FORMULAANDFUNCTIONEVENTSDATASOURCE_SPANS, - FORMULAANDFUNCTIONEVENTSDATASOURCE_NETWORK, - FORMULAANDFUNCTIONEVENTSDATASOURCE_RUM, - FORMULAANDFUNCTIONEVENTSDATASOURCE_SECURITY_SIGNALS, - FORMULAANDFUNCTIONEVENTSDATASOURCE_PROFILES, - FORMULAANDFUNCTIONEVENTSDATASOURCE_AUDIT, - FORMULAANDFUNCTIONEVENTSDATASOURCE_EVENTS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionEventsDataSource) GetAllowedValues() []FormulaAndFunctionEventsDataSource { - return allowedFormulaAndFunctionEventsDataSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionEventsDataSource(value) - return nil -} - -// NewFormulaAndFunctionEventsDataSourceFromValue returns a pointer to a valid FormulaAndFunctionEventsDataSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionEventsDataSourceFromValue(v string) (*FormulaAndFunctionEventsDataSource, error) { - ev := FormulaAndFunctionEventsDataSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionEventsDataSource: valid values are %v", v, allowedFormulaAndFunctionEventsDataSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionEventsDataSource) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionEventsDataSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionEventsDataSource value. -func (v FormulaAndFunctionEventsDataSource) Ptr() *FormulaAndFunctionEventsDataSource { - return &v -} - -// NullableFormulaAndFunctionEventsDataSource handles when a null is used for FormulaAndFunctionEventsDataSource. -type NullableFormulaAndFunctionEventsDataSource struct { - value *FormulaAndFunctionEventsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionEventsDataSource) Get() *FormulaAndFunctionEventsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionEventsDataSource) Set(val *FormulaAndFunctionEventsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionEventsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionEventsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionEventsDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionEventsDataSource(val *FormulaAndFunctionEventsDataSource) *NullableFormulaAndFunctionEventsDataSource { - return &NullableFormulaAndFunctionEventsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionEventsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_metric_aggregation.go b/api/v1/datadog/model_formula_and_function_metric_aggregation.go deleted file mode 100644 index c17f966c2bf..00000000000 --- a/api/v1/datadog/model_formula_and_function_metric_aggregation.go +++ /dev/null @@ -1,121 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionMetricAggregation The aggregation methods available for metrics queries. -type FormulaAndFunctionMetricAggregation string - -// List of FormulaAndFunctionMetricAggregation. -const ( - FORMULAANDFUNCTIONMETRICAGGREGATION_AVG FormulaAndFunctionMetricAggregation = "avg" - FORMULAANDFUNCTIONMETRICAGGREGATION_MIN FormulaAndFunctionMetricAggregation = "min" - FORMULAANDFUNCTIONMETRICAGGREGATION_MAX FormulaAndFunctionMetricAggregation = "max" - FORMULAANDFUNCTIONMETRICAGGREGATION_SUM FormulaAndFunctionMetricAggregation = "sum" - FORMULAANDFUNCTIONMETRICAGGREGATION_LAST FormulaAndFunctionMetricAggregation = "last" - FORMULAANDFUNCTIONMETRICAGGREGATION_AREA FormulaAndFunctionMetricAggregation = "area" - FORMULAANDFUNCTIONMETRICAGGREGATION_L2NORM FormulaAndFunctionMetricAggregation = "l2norm" - FORMULAANDFUNCTIONMETRICAGGREGATION_PERCENTILE FormulaAndFunctionMetricAggregation = "percentile" -) - -var allowedFormulaAndFunctionMetricAggregationEnumValues = []FormulaAndFunctionMetricAggregation{ - FORMULAANDFUNCTIONMETRICAGGREGATION_AVG, - FORMULAANDFUNCTIONMETRICAGGREGATION_MIN, - FORMULAANDFUNCTIONMETRICAGGREGATION_MAX, - FORMULAANDFUNCTIONMETRICAGGREGATION_SUM, - FORMULAANDFUNCTIONMETRICAGGREGATION_LAST, - FORMULAANDFUNCTIONMETRICAGGREGATION_AREA, - FORMULAANDFUNCTIONMETRICAGGREGATION_L2NORM, - FORMULAANDFUNCTIONMETRICAGGREGATION_PERCENTILE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionMetricAggregation) GetAllowedValues() []FormulaAndFunctionMetricAggregation { - return allowedFormulaAndFunctionMetricAggregationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionMetricAggregation) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionMetricAggregation(value) - return nil -} - -// NewFormulaAndFunctionMetricAggregationFromValue returns a pointer to a valid FormulaAndFunctionMetricAggregation -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionMetricAggregationFromValue(v string) (*FormulaAndFunctionMetricAggregation, error) { - ev := FormulaAndFunctionMetricAggregation(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionMetricAggregation: valid values are %v", v, allowedFormulaAndFunctionMetricAggregationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionMetricAggregation) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionMetricAggregationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionMetricAggregation value. -func (v FormulaAndFunctionMetricAggregation) Ptr() *FormulaAndFunctionMetricAggregation { - return &v -} - -// NullableFormulaAndFunctionMetricAggregation handles when a null is used for FormulaAndFunctionMetricAggregation. -type NullableFormulaAndFunctionMetricAggregation struct { - value *FormulaAndFunctionMetricAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionMetricAggregation) Get() *FormulaAndFunctionMetricAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionMetricAggregation) Set(val *FormulaAndFunctionMetricAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionMetricAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionMetricAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionMetricAggregation initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionMetricAggregation(val *FormulaAndFunctionMetricAggregation) *NullableFormulaAndFunctionMetricAggregation { - return &NullableFormulaAndFunctionMetricAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionMetricAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionMetricAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_metric_data_source.go b/api/v1/datadog/model_formula_and_function_metric_data_source.go deleted file mode 100644 index 682b3834f7c..00000000000 --- a/api/v1/datadog/model_formula_and_function_metric_data_source.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionMetricDataSource Data source for metrics queries. -type FormulaAndFunctionMetricDataSource string - -// List of FormulaAndFunctionMetricDataSource. -const ( - FORMULAANDFUNCTIONMETRICDATASOURCE_METRICS FormulaAndFunctionMetricDataSource = "metrics" -) - -var allowedFormulaAndFunctionMetricDataSourceEnumValues = []FormulaAndFunctionMetricDataSource{ - FORMULAANDFUNCTIONMETRICDATASOURCE_METRICS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionMetricDataSource) GetAllowedValues() []FormulaAndFunctionMetricDataSource { - return allowedFormulaAndFunctionMetricDataSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionMetricDataSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionMetricDataSource(value) - return nil -} - -// NewFormulaAndFunctionMetricDataSourceFromValue returns a pointer to a valid FormulaAndFunctionMetricDataSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionMetricDataSourceFromValue(v string) (*FormulaAndFunctionMetricDataSource, error) { - ev := FormulaAndFunctionMetricDataSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionMetricDataSource: valid values are %v", v, allowedFormulaAndFunctionMetricDataSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionMetricDataSource) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionMetricDataSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionMetricDataSource value. -func (v FormulaAndFunctionMetricDataSource) Ptr() *FormulaAndFunctionMetricDataSource { - return &v -} - -// NullableFormulaAndFunctionMetricDataSource handles when a null is used for FormulaAndFunctionMetricDataSource. -type NullableFormulaAndFunctionMetricDataSource struct { - value *FormulaAndFunctionMetricDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionMetricDataSource) Get() *FormulaAndFunctionMetricDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionMetricDataSource) Set(val *FormulaAndFunctionMetricDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionMetricDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionMetricDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionMetricDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionMetricDataSource(val *FormulaAndFunctionMetricDataSource) *NullableFormulaAndFunctionMetricDataSource { - return &NullableFormulaAndFunctionMetricDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionMetricDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionMetricDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_metric_query_definition.go b/api/v1/datadog/model_formula_and_function_metric_query_definition.go deleted file mode 100644 index aa4fadd292e..00000000000 --- a/api/v1/datadog/model_formula_and_function_metric_query_definition.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionMetricQueryDefinition A formula and functions metrics query. -type FormulaAndFunctionMetricQueryDefinition struct { - // The aggregation methods available for metrics queries. - Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` - // Data source for metrics queries. - DataSource FormulaAndFunctionMetricDataSource `json:"data_source"` - // Name of the query for use in formulas. - Name string `json:"name"` - // Metrics query definition. - Query string `json:"query"` - // 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{} -} - -// NewFormulaAndFunctionMetricQueryDefinition instantiates a new FormulaAndFunctionMetricQueryDefinition 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 NewFormulaAndFunctionMetricQueryDefinition(dataSource FormulaAndFunctionMetricDataSource, name string, query string) *FormulaAndFunctionMetricQueryDefinition { - this := FormulaAndFunctionMetricQueryDefinition{} - this.DataSource = dataSource - this.Name = name - this.Query = query - return &this -} - -// NewFormulaAndFunctionMetricQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionMetricQueryDefinition 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 NewFormulaAndFunctionMetricQueryDefinitionWithDefaults() *FormulaAndFunctionMetricQueryDefinition { - this := FormulaAndFunctionMetricQueryDefinition{} - return &this -} - -// GetAggregator returns the Aggregator field value if set, zero value otherwise. -func (o *FormulaAndFunctionMetricQueryDefinition) GetAggregator() FormulaAndFunctionMetricAggregation { - if o == nil || o.Aggregator == nil { - var ret FormulaAndFunctionMetricAggregation - return ret - } - return *o.Aggregator -} - -// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionMetricQueryDefinition) GetAggregatorOk() (*FormulaAndFunctionMetricAggregation, bool) { - if o == nil || o.Aggregator == nil { - return nil, false - } - return o.Aggregator, true -} - -// HasAggregator returns a boolean if a field has been set. -func (o *FormulaAndFunctionMetricQueryDefinition) HasAggregator() bool { - if o != nil && o.Aggregator != nil { - return true - } - - return false -} - -// SetAggregator gets a reference to the given FormulaAndFunctionMetricAggregation and assigns it to the Aggregator field. -func (o *FormulaAndFunctionMetricQueryDefinition) SetAggregator(v FormulaAndFunctionMetricAggregation) { - o.Aggregator = &v -} - -// GetDataSource returns the DataSource field value. -func (o *FormulaAndFunctionMetricQueryDefinition) GetDataSource() FormulaAndFunctionMetricDataSource { - if o == nil { - var ret FormulaAndFunctionMetricDataSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionMetricQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionMetricDataSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *FormulaAndFunctionMetricQueryDefinition) SetDataSource(v FormulaAndFunctionMetricDataSource) { - o.DataSource = v -} - -// GetName returns the Name field value. -func (o *FormulaAndFunctionMetricQueryDefinition) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionMetricQueryDefinition) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *FormulaAndFunctionMetricQueryDefinition) SetName(v string) { - o.Name = v -} - -// GetQuery returns the Query field value. -func (o *FormulaAndFunctionMetricQueryDefinition) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionMetricQueryDefinition) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *FormulaAndFunctionMetricQueryDefinition) SetQuery(v string) { - o.Query = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionMetricQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregator != nil { - toSerialize["aggregator"] = o.Aggregator - } - toSerialize["data_source"] = o.DataSource - toSerialize["name"] = o.Name - toSerialize["query"] = o.Query - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionMetricDataSource `json:"data_source"` - Name *string `json:"name"` - Query *string `json:"query"` - }{} - all := struct { - Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` - DataSource FormulaAndFunctionMetricDataSource `json:"data_source"` - Name string `json:"name"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator - o.DataSource = all.DataSource - o.Name = all.Name - o.Query = all.Query - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_process_query_data_source.go b/api/v1/datadog/model_formula_and_function_process_query_data_source.go deleted file mode 100644 index d3302bfd25a..00000000000 --- a/api/v1/datadog/model_formula_and_function_process_query_data_source.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionProcessQueryDataSource Data sources that rely on the process backend. -type FormulaAndFunctionProcessQueryDataSource string - -// List of FormulaAndFunctionProcessQueryDataSource. -const ( - FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_PROCESS FormulaAndFunctionProcessQueryDataSource = "process" - FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_CONTAINER FormulaAndFunctionProcessQueryDataSource = "container" -) - -var allowedFormulaAndFunctionProcessQueryDataSourceEnumValues = []FormulaAndFunctionProcessQueryDataSource{ - FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_PROCESS, - FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_CONTAINER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionProcessQueryDataSource) GetAllowedValues() []FormulaAndFunctionProcessQueryDataSource { - return allowedFormulaAndFunctionProcessQueryDataSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionProcessQueryDataSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionProcessQueryDataSource(value) - return nil -} - -// NewFormulaAndFunctionProcessQueryDataSourceFromValue returns a pointer to a valid FormulaAndFunctionProcessQueryDataSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionProcessQueryDataSourceFromValue(v string) (*FormulaAndFunctionProcessQueryDataSource, error) { - ev := FormulaAndFunctionProcessQueryDataSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionProcessQueryDataSource: valid values are %v", v, allowedFormulaAndFunctionProcessQueryDataSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionProcessQueryDataSource) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionProcessQueryDataSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionProcessQueryDataSource value. -func (v FormulaAndFunctionProcessQueryDataSource) Ptr() *FormulaAndFunctionProcessQueryDataSource { - return &v -} - -// NullableFormulaAndFunctionProcessQueryDataSource handles when a null is used for FormulaAndFunctionProcessQueryDataSource. -type NullableFormulaAndFunctionProcessQueryDataSource struct { - value *FormulaAndFunctionProcessQueryDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionProcessQueryDataSource) Get() *FormulaAndFunctionProcessQueryDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionProcessQueryDataSource) Set(val *FormulaAndFunctionProcessQueryDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionProcessQueryDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionProcessQueryDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionProcessQueryDataSource initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionProcessQueryDataSource(val *FormulaAndFunctionProcessQueryDataSource) *NullableFormulaAndFunctionProcessQueryDataSource { - return &NullableFormulaAndFunctionProcessQueryDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionProcessQueryDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionProcessQueryDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_process_query_definition.go b/api/v1/datadog/model_formula_and_function_process_query_definition.go deleted file mode 100644 index 25f754e45b4..00000000000 --- a/api/v1/datadog/model_formula_and_function_process_query_definition.go +++ /dev/null @@ -1,431 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionProcessQueryDefinition Process query using formulas and functions. -type FormulaAndFunctionProcessQueryDefinition struct { - // The aggregation methods available for metrics queries. - Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` - // Data sources that rely on the process backend. - DataSource FormulaAndFunctionProcessQueryDataSource `json:"data_source"` - // Whether to normalize the CPU percentages. - IsNormalizedCpu *bool `json:"is_normalized_cpu,omitempty"` - // Number of hits to return. - Limit *int64 `json:"limit,omitempty"` - // Process metric name. - Metric string `json:"metric"` - // Name of query for use in formulas. - Name string `json:"name"` - // Direction of sort. - Sort *QuerySortOrder `json:"sort,omitempty"` - // An array of tags to filter by. - TagFilters []string `json:"tag_filters,omitempty"` - // Text to use as filter. - TextFilter *string `json:"text_filter,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{} -} - -// NewFormulaAndFunctionProcessQueryDefinition instantiates a new FormulaAndFunctionProcessQueryDefinition 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 NewFormulaAndFunctionProcessQueryDefinition(dataSource FormulaAndFunctionProcessQueryDataSource, metric string, name string) *FormulaAndFunctionProcessQueryDefinition { - this := FormulaAndFunctionProcessQueryDefinition{} - this.DataSource = dataSource - this.Metric = metric - this.Name = name - var sort QuerySortOrder = QUERYSORTORDER_DESC - this.Sort = &sort - return &this -} - -// NewFormulaAndFunctionProcessQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionProcessQueryDefinition 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 NewFormulaAndFunctionProcessQueryDefinitionWithDefaults() *FormulaAndFunctionProcessQueryDefinition { - this := FormulaAndFunctionProcessQueryDefinition{} - var sort QuerySortOrder = QUERYSORTORDER_DESC - this.Sort = &sort - return &this -} - -// GetAggregator returns the Aggregator field value if set, zero value otherwise. -func (o *FormulaAndFunctionProcessQueryDefinition) GetAggregator() FormulaAndFunctionMetricAggregation { - if o == nil || o.Aggregator == nil { - var ret FormulaAndFunctionMetricAggregation - return ret - } - return *o.Aggregator -} - -// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetAggregatorOk() (*FormulaAndFunctionMetricAggregation, bool) { - if o == nil || o.Aggregator == nil { - return nil, false - } - return o.Aggregator, true -} - -// HasAggregator returns a boolean if a field has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) HasAggregator() bool { - if o != nil && o.Aggregator != nil { - return true - } - - return false -} - -// SetAggregator gets a reference to the given FormulaAndFunctionMetricAggregation and assigns it to the Aggregator field. -func (o *FormulaAndFunctionProcessQueryDefinition) SetAggregator(v FormulaAndFunctionMetricAggregation) { - o.Aggregator = &v -} - -// GetDataSource returns the DataSource field value. -func (o *FormulaAndFunctionProcessQueryDefinition) GetDataSource() FormulaAndFunctionProcessQueryDataSource { - if o == nil { - var ret FormulaAndFunctionProcessQueryDataSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionProcessQueryDataSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *FormulaAndFunctionProcessQueryDefinition) SetDataSource(v FormulaAndFunctionProcessQueryDataSource) { - o.DataSource = v -} - -// GetIsNormalizedCpu returns the IsNormalizedCpu field value if set, zero value otherwise. -func (o *FormulaAndFunctionProcessQueryDefinition) GetIsNormalizedCpu() bool { - if o == nil || o.IsNormalizedCpu == nil { - var ret bool - return ret - } - return *o.IsNormalizedCpu -} - -// GetIsNormalizedCpuOk returns a tuple with the IsNormalizedCpu field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetIsNormalizedCpuOk() (*bool, bool) { - if o == nil || o.IsNormalizedCpu == nil { - return nil, false - } - return o.IsNormalizedCpu, true -} - -// HasIsNormalizedCpu returns a boolean if a field has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) HasIsNormalizedCpu() bool { - if o != nil && o.IsNormalizedCpu != nil { - return true - } - - return false -} - -// SetIsNormalizedCpu gets a reference to the given bool and assigns it to the IsNormalizedCpu field. -func (o *FormulaAndFunctionProcessQueryDefinition) SetIsNormalizedCpu(v bool) { - o.IsNormalizedCpu = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *FormulaAndFunctionProcessQueryDefinition) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *FormulaAndFunctionProcessQueryDefinition) SetLimit(v int64) { - o.Limit = &v -} - -// GetMetric returns the Metric field value. -func (o *FormulaAndFunctionProcessQueryDefinition) GetMetric() string { - if o == nil { - var ret string - return ret - } - return o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetMetricOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Metric, true -} - -// SetMetric sets field value. -func (o *FormulaAndFunctionProcessQueryDefinition) SetMetric(v string) { - o.Metric = v -} - -// GetName returns the Name field value. -func (o *FormulaAndFunctionProcessQueryDefinition) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *FormulaAndFunctionProcessQueryDefinition) SetName(v string) { - o.Name = v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *FormulaAndFunctionProcessQueryDefinition) GetSort() QuerySortOrder { - if o == nil || o.Sort == nil { - var ret QuerySortOrder - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetSortOk() (*QuerySortOrder, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given QuerySortOrder and assigns it to the Sort field. -func (o *FormulaAndFunctionProcessQueryDefinition) SetSort(v QuerySortOrder) { - o.Sort = &v -} - -// GetTagFilters returns the TagFilters field value if set, zero value otherwise. -func (o *FormulaAndFunctionProcessQueryDefinition) GetTagFilters() []string { - if o == nil || o.TagFilters == nil { - var ret []string - return ret - } - return o.TagFilters -} - -// GetTagFiltersOk returns a tuple with the TagFilters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetTagFiltersOk() (*[]string, bool) { - if o == nil || o.TagFilters == nil { - return nil, false - } - return &o.TagFilters, true -} - -// HasTagFilters returns a boolean if a field has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) HasTagFilters() bool { - if o != nil && o.TagFilters != nil { - return true - } - - return false -} - -// SetTagFilters gets a reference to the given []string and assigns it to the TagFilters field. -func (o *FormulaAndFunctionProcessQueryDefinition) SetTagFilters(v []string) { - o.TagFilters = v -} - -// GetTextFilter returns the TextFilter field value if set, zero value otherwise. -func (o *FormulaAndFunctionProcessQueryDefinition) GetTextFilter() string { - if o == nil || o.TextFilter == nil { - var ret string - return ret - } - return *o.TextFilter -} - -// GetTextFilterOk returns a tuple with the TextFilter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) GetTextFilterOk() (*string, bool) { - if o == nil || o.TextFilter == nil { - return nil, false - } - return o.TextFilter, true -} - -// HasTextFilter returns a boolean if a field has been set. -func (o *FormulaAndFunctionProcessQueryDefinition) HasTextFilter() bool { - if o != nil && o.TextFilter != nil { - return true - } - - return false -} - -// SetTextFilter gets a reference to the given string and assigns it to the TextFilter field. -func (o *FormulaAndFunctionProcessQueryDefinition) SetTextFilter(v string) { - o.TextFilter = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FormulaAndFunctionProcessQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregator != nil { - toSerialize["aggregator"] = o.Aggregator - } - toSerialize["data_source"] = o.DataSource - if o.IsNormalizedCpu != nil { - toSerialize["is_normalized_cpu"] = o.IsNormalizedCpu - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - toSerialize["metric"] = o.Metric - toSerialize["name"] = o.Name - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - if o.TagFilters != nil { - toSerialize["tag_filters"] = o.TagFilters - } - if o.TextFilter != nil { - toSerialize["text_filter"] = o.TextFilter - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionProcessQueryDataSource `json:"data_source"` - Metric *string `json:"metric"` - Name *string `json:"name"` - }{} - all := struct { - Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` - DataSource FormulaAndFunctionProcessQueryDataSource `json:"data_source"` - IsNormalizedCpu *bool `json:"is_normalized_cpu,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Metric string `json:"metric"` - Name string `json:"name"` - Sort *QuerySortOrder `json:"sort,omitempty"` - TagFilters []string `json:"tag_filters,omitempty"` - TextFilter *string `json:"text_filter,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.Metric == nil { - return fmt.Errorf("Required field metric missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator - o.DataSource = all.DataSource - o.IsNormalizedCpu = all.IsNormalizedCpu - o.Limit = all.Limit - o.Metric = all.Metric - o.Name = all.Name - o.Sort = all.Sort - o.TagFilters = all.TagFilters - o.TextFilter = all.TextFilter - return nil -} diff --git a/api/v1/datadog/model_formula_and_function_query_definition.go b/api/v1/datadog/model_formula_and_function_query_definition.go deleted file mode 100644 index e7fd79566d8..00000000000 --- a/api/v1/datadog/model_formula_and_function_query_definition.go +++ /dev/null @@ -1,251 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// FormulaAndFunctionQueryDefinition - A formula and function query. -type FormulaAndFunctionQueryDefinition struct { - FormulaAndFunctionMetricQueryDefinition *FormulaAndFunctionMetricQueryDefinition - FormulaAndFunctionEventQueryDefinition *FormulaAndFunctionEventQueryDefinition - FormulaAndFunctionProcessQueryDefinition *FormulaAndFunctionProcessQueryDefinition - FormulaAndFunctionApmDependencyStatsQueryDefinition *FormulaAndFunctionApmDependencyStatsQueryDefinition - FormulaAndFunctionApmResourceStatsQueryDefinition *FormulaAndFunctionApmResourceStatsQueryDefinition - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// FormulaAndFunctionMetricQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionMetricQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. -func FormulaAndFunctionMetricQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionMetricQueryDefinition) FormulaAndFunctionQueryDefinition { - return FormulaAndFunctionQueryDefinition{FormulaAndFunctionMetricQueryDefinition: v} -} - -// FormulaAndFunctionEventQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionEventQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. -func FormulaAndFunctionEventQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionEventQueryDefinition) FormulaAndFunctionQueryDefinition { - return FormulaAndFunctionQueryDefinition{FormulaAndFunctionEventQueryDefinition: v} -} - -// FormulaAndFunctionProcessQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionProcessQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. -func FormulaAndFunctionProcessQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionProcessQueryDefinition) FormulaAndFunctionQueryDefinition { - return FormulaAndFunctionQueryDefinition{FormulaAndFunctionProcessQueryDefinition: v} -} - -// FormulaAndFunctionApmDependencyStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionApmDependencyStatsQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. -func FormulaAndFunctionApmDependencyStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionApmDependencyStatsQueryDefinition) FormulaAndFunctionQueryDefinition { - return FormulaAndFunctionQueryDefinition{FormulaAndFunctionApmDependencyStatsQueryDefinition: v} -} - -// FormulaAndFunctionApmResourceStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionApmResourceStatsQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. -func FormulaAndFunctionApmResourceStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionApmResourceStatsQueryDefinition) FormulaAndFunctionQueryDefinition { - return FormulaAndFunctionQueryDefinition{FormulaAndFunctionApmResourceStatsQueryDefinition: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *FormulaAndFunctionQueryDefinition) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into FormulaAndFunctionMetricQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionMetricQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionMetricQueryDefinition != nil && obj.FormulaAndFunctionMetricQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionMetricQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionMetricQueryDefinition) - if string(jsonFormulaAndFunctionMetricQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionMetricQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionMetricQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionMetricQueryDefinition = nil - } - - // try to unmarshal data into FormulaAndFunctionEventQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionEventQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionEventQueryDefinition != nil && obj.FormulaAndFunctionEventQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionEventQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionEventQueryDefinition) - if string(jsonFormulaAndFunctionEventQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionEventQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionEventQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionEventQueryDefinition = nil - } - - // try to unmarshal data into FormulaAndFunctionProcessQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionProcessQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionProcessQueryDefinition != nil && obj.FormulaAndFunctionProcessQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionProcessQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionProcessQueryDefinition) - if string(jsonFormulaAndFunctionProcessQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionProcessQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionProcessQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionProcessQueryDefinition = nil - } - - // try to unmarshal data into FormulaAndFunctionApmDependencyStatsQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionApmDependencyStatsQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionApmDependencyStatsQueryDefinition != nil && obj.FormulaAndFunctionApmDependencyStatsQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionApmDependencyStatsQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionApmDependencyStatsQueryDefinition) - if string(jsonFormulaAndFunctionApmDependencyStatsQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil - } - - // try to unmarshal data into FormulaAndFunctionApmResourceStatsQueryDefinition - err = json.Unmarshal(data, &obj.FormulaAndFunctionApmResourceStatsQueryDefinition) - if err == nil { - if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil && obj.FormulaAndFunctionApmResourceStatsQueryDefinition.UnparsedObject == nil { - jsonFormulaAndFunctionApmResourceStatsQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionApmResourceStatsQueryDefinition) - if string(jsonFormulaAndFunctionApmResourceStatsQueryDefinition) == "{}" { // empty struct - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - } else { - match++ - } - } else { - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - } - } else { - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.FormulaAndFunctionMetricQueryDefinition = nil - obj.FormulaAndFunctionEventQueryDefinition = nil - obj.FormulaAndFunctionProcessQueryDefinition = nil - obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil - obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj FormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { - if obj.FormulaAndFunctionMetricQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionMetricQueryDefinition) - } - - if obj.FormulaAndFunctionEventQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionEventQueryDefinition) - } - - if obj.FormulaAndFunctionProcessQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionProcessQueryDefinition) - } - - if obj.FormulaAndFunctionApmDependencyStatsQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionApmDependencyStatsQueryDefinition) - } - - if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { - return json.Marshal(&obj.FormulaAndFunctionApmResourceStatsQueryDefinition) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *FormulaAndFunctionQueryDefinition) GetActualInstance() interface{} { - if obj.FormulaAndFunctionMetricQueryDefinition != nil { - return obj.FormulaAndFunctionMetricQueryDefinition - } - - if obj.FormulaAndFunctionEventQueryDefinition != nil { - return obj.FormulaAndFunctionEventQueryDefinition - } - - if obj.FormulaAndFunctionProcessQueryDefinition != nil { - return obj.FormulaAndFunctionProcessQueryDefinition - } - - if obj.FormulaAndFunctionApmDependencyStatsQueryDefinition != nil { - return obj.FormulaAndFunctionApmDependencyStatsQueryDefinition - } - - if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { - return obj.FormulaAndFunctionApmResourceStatsQueryDefinition - } - - // all schemas are nil - return nil -} - -// NullableFormulaAndFunctionQueryDefinition handles when a null is used for FormulaAndFunctionQueryDefinition. -type NullableFormulaAndFunctionQueryDefinition struct { - value *FormulaAndFunctionQueryDefinition - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionQueryDefinition) Get() *FormulaAndFunctionQueryDefinition { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionQueryDefinition) Set(val *FormulaAndFunctionQueryDefinition) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionQueryDefinition) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableFormulaAndFunctionQueryDefinition) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionQueryDefinition initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionQueryDefinition(val *FormulaAndFunctionQueryDefinition) *NullableFormulaAndFunctionQueryDefinition { - return &NullableFormulaAndFunctionQueryDefinition{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionQueryDefinition) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_formula_and_function_response_format.go b/api/v1/datadog/model_formula_and_function_response_format.go deleted file mode 100644 index 8b9f85b4980..00000000000 --- a/api/v1/datadog/model_formula_and_function_response_format.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FormulaAndFunctionResponseFormat Timeseries or Scalar response. -type FormulaAndFunctionResponseFormat string - -// List of FormulaAndFunctionResponseFormat. -const ( - FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES FormulaAndFunctionResponseFormat = "timeseries" - FORMULAANDFUNCTIONRESPONSEFORMAT_SCALAR FormulaAndFunctionResponseFormat = "scalar" -) - -var allowedFormulaAndFunctionResponseFormatEnumValues = []FormulaAndFunctionResponseFormat{ - FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES, - FORMULAANDFUNCTIONRESPONSEFORMAT_SCALAR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FormulaAndFunctionResponseFormat) GetAllowedValues() []FormulaAndFunctionResponseFormat { - return allowedFormulaAndFunctionResponseFormatEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FormulaAndFunctionResponseFormat) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FormulaAndFunctionResponseFormat(value) - return nil -} - -// NewFormulaAndFunctionResponseFormatFromValue returns a pointer to a valid FormulaAndFunctionResponseFormat -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFormulaAndFunctionResponseFormatFromValue(v string) (*FormulaAndFunctionResponseFormat, error) { - ev := FormulaAndFunctionResponseFormat(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionResponseFormat: valid values are %v", v, allowedFormulaAndFunctionResponseFormatEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FormulaAndFunctionResponseFormat) IsValid() bool { - for _, existing := range allowedFormulaAndFunctionResponseFormatEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FormulaAndFunctionResponseFormat value. -func (v FormulaAndFunctionResponseFormat) Ptr() *FormulaAndFunctionResponseFormat { - return &v -} - -// NullableFormulaAndFunctionResponseFormat handles when a null is used for FormulaAndFunctionResponseFormat. -type NullableFormulaAndFunctionResponseFormat struct { - value *FormulaAndFunctionResponseFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableFormulaAndFunctionResponseFormat) Get() *FormulaAndFunctionResponseFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFormulaAndFunctionResponseFormat) Set(val *FormulaAndFunctionResponseFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFormulaAndFunctionResponseFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFormulaAndFunctionResponseFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFormulaAndFunctionResponseFormat initializes the struct as if Set has been called. -func NewNullableFormulaAndFunctionResponseFormat(val *FormulaAndFunctionResponseFormat) *NullableFormulaAndFunctionResponseFormat { - return &NullableFormulaAndFunctionResponseFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFormulaAndFunctionResponseFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFormulaAndFunctionResponseFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_free_text_widget_definition.go b/api/v1/datadog/model_free_text_widget_definition.go deleted file mode 100644 index d5e313285bf..00000000000 --- a/api/v1/datadog/model_free_text_widget_definition.go +++ /dev/null @@ -1,271 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FreeTextWidgetDefinition Free text is a widget that allows you to add headings to your screenboard. Commonly used to state the overall purpose of the dashboard. Only available on FREE layout dashboards. -type FreeTextWidgetDefinition struct { - // Color of the text. - Color *string `json:"color,omitempty"` - // Size of the text. - FontSize *string `json:"font_size,omitempty"` - // Text to display. - Text string `json:"text"` - // How to align the text on the widget. - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - // Type of the free text widget. - Type FreeTextWidgetDefinitionType `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{} -} - -// NewFreeTextWidgetDefinition instantiates a new FreeTextWidgetDefinition 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 NewFreeTextWidgetDefinition(text string, typeVar FreeTextWidgetDefinitionType) *FreeTextWidgetDefinition { - this := FreeTextWidgetDefinition{} - this.Text = text - this.Type = typeVar - return &this -} - -// NewFreeTextWidgetDefinitionWithDefaults instantiates a new FreeTextWidgetDefinition 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 NewFreeTextWidgetDefinitionWithDefaults() *FreeTextWidgetDefinition { - this := FreeTextWidgetDefinition{} - var typeVar FreeTextWidgetDefinitionType = FREETEXTWIDGETDEFINITIONTYPE_FREE_TEXT - this.Type = typeVar - return &this -} - -// GetColor returns the Color field value if set, zero value otherwise. -func (o *FreeTextWidgetDefinition) GetColor() string { - if o == nil || o.Color == nil { - var ret string - return ret - } - return *o.Color -} - -// GetColorOk returns a tuple with the Color field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FreeTextWidgetDefinition) GetColorOk() (*string, bool) { - if o == nil || o.Color == nil { - return nil, false - } - return o.Color, true -} - -// HasColor returns a boolean if a field has been set. -func (o *FreeTextWidgetDefinition) HasColor() bool { - if o != nil && o.Color != nil { - return true - } - - return false -} - -// SetColor gets a reference to the given string and assigns it to the Color field. -func (o *FreeTextWidgetDefinition) SetColor(v string) { - o.Color = &v -} - -// GetFontSize returns the FontSize field value if set, zero value otherwise. -func (o *FreeTextWidgetDefinition) GetFontSize() string { - if o == nil || o.FontSize == nil { - var ret string - return ret - } - return *o.FontSize -} - -// GetFontSizeOk returns a tuple with the FontSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FreeTextWidgetDefinition) GetFontSizeOk() (*string, bool) { - if o == nil || o.FontSize == nil { - return nil, false - } - return o.FontSize, true -} - -// HasFontSize returns a boolean if a field has been set. -func (o *FreeTextWidgetDefinition) HasFontSize() bool { - if o != nil && o.FontSize != nil { - return true - } - - return false -} - -// SetFontSize gets a reference to the given string and assigns it to the FontSize field. -func (o *FreeTextWidgetDefinition) SetFontSize(v string) { - o.FontSize = &v -} - -// GetText returns the Text field value. -func (o *FreeTextWidgetDefinition) GetText() string { - if o == nil { - var ret string - return ret - } - return o.Text -} - -// GetTextOk returns a tuple with the Text field value -// and a boolean to check if the value has been set. -func (o *FreeTextWidgetDefinition) GetTextOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Text, true -} - -// SetText sets field value. -func (o *FreeTextWidgetDefinition) SetText(v string) { - o.Text = v -} - -// GetTextAlign returns the TextAlign field value if set, zero value otherwise. -func (o *FreeTextWidgetDefinition) GetTextAlign() WidgetTextAlign { - if o == nil || o.TextAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TextAlign -} - -// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FreeTextWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TextAlign == nil { - return nil, false - } - return o.TextAlign, true -} - -// HasTextAlign returns a boolean if a field has been set. -func (o *FreeTextWidgetDefinition) HasTextAlign() bool { - if o != nil && o.TextAlign != nil { - return true - } - - return false -} - -// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. -func (o *FreeTextWidgetDefinition) SetTextAlign(v WidgetTextAlign) { - o.TextAlign = &v -} - -// GetType returns the Type field value. -func (o *FreeTextWidgetDefinition) GetType() FreeTextWidgetDefinitionType { - if o == nil { - var ret FreeTextWidgetDefinitionType - 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 *FreeTextWidgetDefinition) GetTypeOk() (*FreeTextWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *FreeTextWidgetDefinition) SetType(v FreeTextWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FreeTextWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Color != nil { - toSerialize["color"] = o.Color - } - if o.FontSize != nil { - toSerialize["font_size"] = o.FontSize - } - toSerialize["text"] = o.Text - if o.TextAlign != nil { - toSerialize["text_align"] = o.TextAlign - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Text *string `json:"text"` - Type *FreeTextWidgetDefinitionType `json:"type"` - }{} - all := struct { - Color *string `json:"color,omitempty"` - FontSize *string `json:"font_size,omitempty"` - Text string `json:"text"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - Type FreeTextWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Text == nil { - return fmt.Errorf("Required field text missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Color = all.Color - o.FontSize = all.FontSize - o.Text = all.Text - o.TextAlign = all.TextAlign - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_free_text_widget_definition_type.go b/api/v1/datadog/model_free_text_widget_definition_type.go deleted file mode 100644 index a7b6ad0a94f..00000000000 --- a/api/v1/datadog/model_free_text_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FreeTextWidgetDefinitionType Type of the free text widget. -type FreeTextWidgetDefinitionType string - -// List of FreeTextWidgetDefinitionType. -const ( - FREETEXTWIDGETDEFINITIONTYPE_FREE_TEXT FreeTextWidgetDefinitionType = "free_text" -) - -var allowedFreeTextWidgetDefinitionTypeEnumValues = []FreeTextWidgetDefinitionType{ - FREETEXTWIDGETDEFINITIONTYPE_FREE_TEXT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FreeTextWidgetDefinitionType) GetAllowedValues() []FreeTextWidgetDefinitionType { - return allowedFreeTextWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FreeTextWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FreeTextWidgetDefinitionType(value) - return nil -} - -// NewFreeTextWidgetDefinitionTypeFromValue returns a pointer to a valid FreeTextWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFreeTextWidgetDefinitionTypeFromValue(v string) (*FreeTextWidgetDefinitionType, error) { - ev := FreeTextWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FreeTextWidgetDefinitionType: valid values are %v", v, allowedFreeTextWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FreeTextWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedFreeTextWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FreeTextWidgetDefinitionType value. -func (v FreeTextWidgetDefinitionType) Ptr() *FreeTextWidgetDefinitionType { - return &v -} - -// NullableFreeTextWidgetDefinitionType handles when a null is used for FreeTextWidgetDefinitionType. -type NullableFreeTextWidgetDefinitionType struct { - value *FreeTextWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableFreeTextWidgetDefinitionType) Get() *FreeTextWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFreeTextWidgetDefinitionType) Set(val *FreeTextWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFreeTextWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFreeTextWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFreeTextWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableFreeTextWidgetDefinitionType(val *FreeTextWidgetDefinitionType) *NullableFreeTextWidgetDefinitionType { - return &NullableFreeTextWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFreeTextWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFreeTextWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_funnel_query.go b/api/v1/datadog/model_funnel_query.go deleted file mode 100644 index 8eb45eac3b2..00000000000 --- a/api/v1/datadog/model_funnel_query.go +++ /dev/null @@ -1,179 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FunnelQuery Updated funnel widget. -type FunnelQuery struct { - // Source from which to query items to display in the funnel. - DataSource FunnelSource `json:"data_source"` - // The widget query. - QueryString string `json:"query_string"` - // List of funnel steps. - Steps []FunnelStep `json:"steps"` - // 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{} -} - -// NewFunnelQuery instantiates a new FunnelQuery 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 NewFunnelQuery(dataSource FunnelSource, queryString string, steps []FunnelStep) *FunnelQuery { - this := FunnelQuery{} - this.DataSource = dataSource - this.QueryString = queryString - this.Steps = steps - return &this -} - -// NewFunnelQueryWithDefaults instantiates a new FunnelQuery 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 NewFunnelQueryWithDefaults() *FunnelQuery { - this := FunnelQuery{} - var dataSource FunnelSource = FUNNELSOURCE_RUM - this.DataSource = dataSource - return &this -} - -// GetDataSource returns the DataSource field value. -func (o *FunnelQuery) GetDataSource() FunnelSource { - if o == nil { - var ret FunnelSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *FunnelQuery) GetDataSourceOk() (*FunnelSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *FunnelQuery) SetDataSource(v FunnelSource) { - o.DataSource = v -} - -// GetQueryString returns the QueryString field value. -func (o *FunnelQuery) GetQueryString() string { - if o == nil { - var ret string - return ret - } - return o.QueryString -} - -// GetQueryStringOk returns a tuple with the QueryString field value -// and a boolean to check if the value has been set. -func (o *FunnelQuery) GetQueryStringOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.QueryString, true -} - -// SetQueryString sets field value. -func (o *FunnelQuery) SetQueryString(v string) { - o.QueryString = v -} - -// GetSteps returns the Steps field value. -func (o *FunnelQuery) GetSteps() []FunnelStep { - if o == nil { - var ret []FunnelStep - return ret - } - return o.Steps -} - -// GetStepsOk returns a tuple with the Steps field value -// and a boolean to check if the value has been set. -func (o *FunnelQuery) GetStepsOk() (*[]FunnelStep, bool) { - if o == nil { - return nil, false - } - return &o.Steps, true -} - -// SetSteps sets field value. -func (o *FunnelQuery) SetSteps(v []FunnelStep) { - o.Steps = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FunnelQuery) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data_source"] = o.DataSource - toSerialize["query_string"] = o.QueryString - toSerialize["steps"] = o.Steps - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FunnelQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - DataSource *FunnelSource `json:"data_source"` - QueryString *string `json:"query_string"` - Steps *[]FunnelStep `json:"steps"` - }{} - all := struct { - DataSource FunnelSource `json:"data_source"` - QueryString string `json:"query_string"` - Steps []FunnelStep `json:"steps"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.QueryString == nil { - return fmt.Errorf("Required field query_string missing") - } - if required.Steps == nil { - return fmt.Errorf("Required field steps missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DataSource = all.DataSource - o.QueryString = all.QueryString - o.Steps = all.Steps - return nil -} diff --git a/api/v1/datadog/model_funnel_request_type.go b/api/v1/datadog/model_funnel_request_type.go deleted file mode 100644 index e967d3b6f42..00000000000 --- a/api/v1/datadog/model_funnel_request_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FunnelRequestType Widget request type. -type FunnelRequestType string - -// List of FunnelRequestType. -const ( - FUNNELREQUESTTYPE_FUNNEL FunnelRequestType = "funnel" -) - -var allowedFunnelRequestTypeEnumValues = []FunnelRequestType{ - FUNNELREQUESTTYPE_FUNNEL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FunnelRequestType) GetAllowedValues() []FunnelRequestType { - return allowedFunnelRequestTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FunnelRequestType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FunnelRequestType(value) - return nil -} - -// NewFunnelRequestTypeFromValue returns a pointer to a valid FunnelRequestType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFunnelRequestTypeFromValue(v string) (*FunnelRequestType, error) { - ev := FunnelRequestType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FunnelRequestType: valid values are %v", v, allowedFunnelRequestTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FunnelRequestType) IsValid() bool { - for _, existing := range allowedFunnelRequestTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FunnelRequestType value. -func (v FunnelRequestType) Ptr() *FunnelRequestType { - return &v -} - -// NullableFunnelRequestType handles when a null is used for FunnelRequestType. -type NullableFunnelRequestType struct { - value *FunnelRequestType - isSet bool -} - -// Get returns the associated value. -func (v NullableFunnelRequestType) Get() *FunnelRequestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFunnelRequestType) Set(val *FunnelRequestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFunnelRequestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFunnelRequestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFunnelRequestType initializes the struct as if Set has been called. -func NewNullableFunnelRequestType(val *FunnelRequestType) *NullableFunnelRequestType { - return &NullableFunnelRequestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFunnelRequestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFunnelRequestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_funnel_source.go b/api/v1/datadog/model_funnel_source.go deleted file mode 100644 index 42f6c5be771..00000000000 --- a/api/v1/datadog/model_funnel_source.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FunnelSource Source from which to query items to display in the funnel. -type FunnelSource string - -// List of FunnelSource. -const ( - FUNNELSOURCE_RUM FunnelSource = "rum" -) - -var allowedFunnelSourceEnumValues = []FunnelSource{ - FUNNELSOURCE_RUM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FunnelSource) GetAllowedValues() []FunnelSource { - return allowedFunnelSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FunnelSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FunnelSource(value) - return nil -} - -// NewFunnelSourceFromValue returns a pointer to a valid FunnelSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFunnelSourceFromValue(v string) (*FunnelSource, error) { - ev := FunnelSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FunnelSource: valid values are %v", v, allowedFunnelSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FunnelSource) IsValid() bool { - for _, existing := range allowedFunnelSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FunnelSource value. -func (v FunnelSource) Ptr() *FunnelSource { - return &v -} - -// NullableFunnelSource handles when a null is used for FunnelSource. -type NullableFunnelSource struct { - value *FunnelSource - isSet bool -} - -// Get returns the associated value. -func (v NullableFunnelSource) Get() *FunnelSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFunnelSource) Set(val *FunnelSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFunnelSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFunnelSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFunnelSource initializes the struct as if Set has been called. -func NewNullableFunnelSource(val *FunnelSource) *NullableFunnelSource { - return &NullableFunnelSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFunnelSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFunnelSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_funnel_step.go b/api/v1/datadog/model_funnel_step.go deleted file mode 100644 index 4c11c0c1c73..00000000000 --- a/api/v1/datadog/model_funnel_step.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FunnelStep The funnel step. -type FunnelStep struct { - // The facet of the step. - Facet string `json:"facet"` - // The value of the step. - Value string `json:"value"` - // 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{} -} - -// NewFunnelStep instantiates a new FunnelStep 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 NewFunnelStep(facet string, value string) *FunnelStep { - this := FunnelStep{} - this.Facet = facet - this.Value = value - return &this -} - -// NewFunnelStepWithDefaults instantiates a new FunnelStep 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 NewFunnelStepWithDefaults() *FunnelStep { - this := FunnelStep{} - return &this -} - -// GetFacet returns the Facet field value. -func (o *FunnelStep) GetFacet() string { - if o == nil { - var ret string - return ret - } - return o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value -// and a boolean to check if the value has been set. -func (o *FunnelStep) GetFacetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Facet, true -} - -// SetFacet sets field value. -func (o *FunnelStep) SetFacet(v string) { - o.Facet = v -} - -// GetValue returns the Value field value. -func (o *FunnelStep) GetValue() string { - if o == nil { - var ret string - return ret - } - return o.Value -} - -// GetValueOk returns a tuple with the Value field value -// and a boolean to check if the value has been set. -func (o *FunnelStep) GetValueOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Value, true -} - -// SetValue sets field value. -func (o *FunnelStep) SetValue(v string) { - o.Value = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FunnelStep) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["facet"] = o.Facet - toSerialize["value"] = o.Value - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FunnelStep) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - Value *string `json:"value"` - }{} - all := struct { - Facet string `json:"facet"` - Value string `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("Required field facet missing") - } - if required.Value == nil { - return fmt.Errorf("Required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Facet = all.Facet - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_funnel_widget_definition.go b/api/v1/datadog/model_funnel_widget_definition.go deleted file mode 100644 index d1225dd856f..00000000000 --- a/api/v1/datadog/model_funnel_widget_definition.go +++ /dev/null @@ -1,318 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FunnelWidgetDefinition The funnel visualization displays a funnel of user sessions that maps a sequence of view navigation and user interaction in your application. -// -type FunnelWidgetDefinition struct { - // Request payload used to query items. - Requests []FunnelWidgetRequest `json:"requests"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // The title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // The size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of funnel widget. - Type FunnelWidgetDefinitionType `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{} -} - -// NewFunnelWidgetDefinition instantiates a new FunnelWidgetDefinition 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 NewFunnelWidgetDefinition(requests []FunnelWidgetRequest, typeVar FunnelWidgetDefinitionType) *FunnelWidgetDefinition { - this := FunnelWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewFunnelWidgetDefinitionWithDefaults instantiates a new FunnelWidgetDefinition 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 NewFunnelWidgetDefinitionWithDefaults() *FunnelWidgetDefinition { - this := FunnelWidgetDefinition{} - var typeVar FunnelWidgetDefinitionType = FUNNELWIDGETDEFINITIONTYPE_FUNNEL - this.Type = typeVar - return &this -} - -// GetRequests returns the Requests field value. -func (o *FunnelWidgetDefinition) GetRequests() []FunnelWidgetRequest { - if o == nil { - var ret []FunnelWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *FunnelWidgetDefinition) GetRequestsOk() (*[]FunnelWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *FunnelWidgetDefinition) SetRequests(v []FunnelWidgetRequest) { - o.Requests = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *FunnelWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FunnelWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *FunnelWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *FunnelWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *FunnelWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FunnelWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *FunnelWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *FunnelWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *FunnelWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FunnelWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *FunnelWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *FunnelWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *FunnelWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FunnelWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *FunnelWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *FunnelWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *FunnelWidgetDefinition) GetType() FunnelWidgetDefinitionType { - if o == nil { - var ret FunnelWidgetDefinitionType - 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 *FunnelWidgetDefinition) GetTypeOk() (*FunnelWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *FunnelWidgetDefinition) SetType(v FunnelWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FunnelWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["requests"] = o.Requests - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]FunnelWidgetRequest `json:"requests"` - Type *FunnelWidgetDefinitionType `json:"type"` - }{} - all := struct { - Requests []FunnelWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type FunnelWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Requests = all.Requests - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_funnel_widget_definition_type.go b/api/v1/datadog/model_funnel_widget_definition_type.go deleted file mode 100644 index c722413a155..00000000000 --- a/api/v1/datadog/model_funnel_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FunnelWidgetDefinitionType Type of funnel widget. -type FunnelWidgetDefinitionType string - -// List of FunnelWidgetDefinitionType. -const ( - FUNNELWIDGETDEFINITIONTYPE_FUNNEL FunnelWidgetDefinitionType = "funnel" -) - -var allowedFunnelWidgetDefinitionTypeEnumValues = []FunnelWidgetDefinitionType{ - FUNNELWIDGETDEFINITIONTYPE_FUNNEL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *FunnelWidgetDefinitionType) GetAllowedValues() []FunnelWidgetDefinitionType { - return allowedFunnelWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *FunnelWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = FunnelWidgetDefinitionType(value) - return nil -} - -// NewFunnelWidgetDefinitionTypeFromValue returns a pointer to a valid FunnelWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewFunnelWidgetDefinitionTypeFromValue(v string) (*FunnelWidgetDefinitionType, error) { - ev := FunnelWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for FunnelWidgetDefinitionType: valid values are %v", v, allowedFunnelWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v FunnelWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedFunnelWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to FunnelWidgetDefinitionType value. -func (v FunnelWidgetDefinitionType) Ptr() *FunnelWidgetDefinitionType { - return &v -} - -// NullableFunnelWidgetDefinitionType handles when a null is used for FunnelWidgetDefinitionType. -type NullableFunnelWidgetDefinitionType struct { - value *FunnelWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableFunnelWidgetDefinitionType) Get() *FunnelWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableFunnelWidgetDefinitionType) Set(val *FunnelWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableFunnelWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableFunnelWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableFunnelWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableFunnelWidgetDefinitionType(val *FunnelWidgetDefinitionType) *NullableFunnelWidgetDefinitionType { - return &NullableFunnelWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableFunnelWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableFunnelWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_funnel_widget_request.go b/api/v1/datadog/model_funnel_widget_request.go deleted file mode 100644 index ca14ea7c85e..00000000000 --- a/api/v1/datadog/model_funnel_widget_request.go +++ /dev/null @@ -1,151 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// FunnelWidgetRequest Updated funnel widget. -type FunnelWidgetRequest struct { - // Updated funnel widget. - Query FunnelQuery `json:"query"` - // Widget request type. - RequestType FunnelRequestType `json:"request_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{} -} - -// NewFunnelWidgetRequest instantiates a new FunnelWidgetRequest 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 NewFunnelWidgetRequest(query FunnelQuery, requestType FunnelRequestType) *FunnelWidgetRequest { - this := FunnelWidgetRequest{} - this.Query = query - this.RequestType = requestType - return &this -} - -// NewFunnelWidgetRequestWithDefaults instantiates a new FunnelWidgetRequest 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 NewFunnelWidgetRequestWithDefaults() *FunnelWidgetRequest { - this := FunnelWidgetRequest{} - return &this -} - -// GetQuery returns the Query field value. -func (o *FunnelWidgetRequest) GetQuery() FunnelQuery { - if o == nil { - var ret FunnelQuery - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *FunnelWidgetRequest) GetQueryOk() (*FunnelQuery, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *FunnelWidgetRequest) SetQuery(v FunnelQuery) { - o.Query = v -} - -// GetRequestType returns the RequestType field value. -func (o *FunnelWidgetRequest) GetRequestType() FunnelRequestType { - if o == nil { - var ret FunnelRequestType - return ret - } - return o.RequestType -} - -// GetRequestTypeOk returns a tuple with the RequestType field value -// and a boolean to check if the value has been set. -func (o *FunnelWidgetRequest) GetRequestTypeOk() (*FunnelRequestType, bool) { - if o == nil { - return nil, false - } - return &o.RequestType, true -} - -// SetRequestType sets field value. -func (o *FunnelWidgetRequest) SetRequestType(v FunnelRequestType) { - o.RequestType = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FunnelWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["query"] = o.Query - toSerialize["request_type"] = o.RequestType - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FunnelWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *FunnelQuery `json:"query"` - RequestType *FunnelRequestType `json:"request_type"` - }{} - all := struct { - Query FunnelQuery `json:"query"` - RequestType FunnelRequestType `json:"request_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - if required.RequestType == nil { - return fmt.Errorf("Required field request_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.RequestType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Query = all.Query - o.RequestType = all.RequestType - return nil -} diff --git a/api/v1/datadog/model_gcp_account.go b/api/v1/datadog/model_gcp_account.go deleted file mode 100644 index 6d5cf73cd98..00000000000 --- a/api/v1/datadog/model_gcp_account.go +++ /dev/null @@ -1,572 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// GCPAccount Your Google Cloud Platform Account. -type GCPAccount struct { - // Should be `https://www.googleapis.com/oauth2/v1/certs`. - AuthProviderX509CertUrl *string `json:"auth_provider_x509_cert_url,omitempty"` - // Should be `https://accounts.google.com/o/oauth2/auth`. - AuthUri *string `json:"auth_uri,omitempty"` - // Silence monitors for expected GCE instance shutdowns. - Automute *bool `json:"automute,omitempty"` - // Your email found in your JSON service account key. - ClientEmail *string `json:"client_email,omitempty"` - // Your ID found in your JSON service account key. - ClientId *string `json:"client_id,omitempty"` - // Should be `https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL` - // where `$CLIENT_EMAIL` is the email found in your JSON service account key. - ClientX509CertUrl *string `json:"client_x509_cert_url,omitempty"` - // An array of errors. - Errors []string `json:"errors,omitempty"` - // Limit the GCE instances that are pulled into Datadog by using tags. - // Only hosts that match one of the defined tags are imported into Datadog. - HostFilters *string `json:"host_filters,omitempty"` - // Your private key name found in your JSON service account key. - PrivateKey *string `json:"private_key,omitempty"` - // Your private key ID found in your JSON service account key. - PrivateKeyId *string `json:"private_key_id,omitempty"` - // Your Google Cloud project ID found in your JSON service account key. - ProjectId *string `json:"project_id,omitempty"` - // Should be `https://accounts.google.com/o/oauth2/token`. - TokenUri *string `json:"token_uri,omitempty"` - // The value for service_account found in your JSON service account key. - Type *string `json:"type,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{} -} - -// NewGCPAccount instantiates a new GCPAccount 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 NewGCPAccount() *GCPAccount { - this := GCPAccount{} - return &this -} - -// NewGCPAccountWithDefaults instantiates a new GCPAccount 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 NewGCPAccountWithDefaults() *GCPAccount { - this := GCPAccount{} - return &this -} - -// GetAuthProviderX509CertUrl returns the AuthProviderX509CertUrl field value if set, zero value otherwise. -func (o *GCPAccount) GetAuthProviderX509CertUrl() string { - if o == nil || o.AuthProviderX509CertUrl == nil { - var ret string - return ret - } - return *o.AuthProviderX509CertUrl -} - -// GetAuthProviderX509CertUrlOk returns a tuple with the AuthProviderX509CertUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetAuthProviderX509CertUrlOk() (*string, bool) { - if o == nil || o.AuthProviderX509CertUrl == nil { - return nil, false - } - return o.AuthProviderX509CertUrl, true -} - -// HasAuthProviderX509CertUrl returns a boolean if a field has been set. -func (o *GCPAccount) HasAuthProviderX509CertUrl() bool { - if o != nil && o.AuthProviderX509CertUrl != nil { - return true - } - - return false -} - -// SetAuthProviderX509CertUrl gets a reference to the given string and assigns it to the AuthProviderX509CertUrl field. -func (o *GCPAccount) SetAuthProviderX509CertUrl(v string) { - o.AuthProviderX509CertUrl = &v -} - -// GetAuthUri returns the AuthUri field value if set, zero value otherwise. -func (o *GCPAccount) GetAuthUri() string { - if o == nil || o.AuthUri == nil { - var ret string - return ret - } - return *o.AuthUri -} - -// GetAuthUriOk returns a tuple with the AuthUri field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetAuthUriOk() (*string, bool) { - if o == nil || o.AuthUri == nil { - return nil, false - } - return o.AuthUri, true -} - -// HasAuthUri returns a boolean if a field has been set. -func (o *GCPAccount) HasAuthUri() bool { - if o != nil && o.AuthUri != nil { - return true - } - - return false -} - -// SetAuthUri gets a reference to the given string and assigns it to the AuthUri field. -func (o *GCPAccount) SetAuthUri(v string) { - o.AuthUri = &v -} - -// GetAutomute returns the Automute field value if set, zero value otherwise. -func (o *GCPAccount) GetAutomute() bool { - if o == nil || o.Automute == nil { - var ret bool - return ret - } - return *o.Automute -} - -// GetAutomuteOk returns a tuple with the Automute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetAutomuteOk() (*bool, bool) { - if o == nil || o.Automute == nil { - return nil, false - } - return o.Automute, true -} - -// HasAutomute returns a boolean if a field has been set. -func (o *GCPAccount) HasAutomute() bool { - if o != nil && o.Automute != nil { - return true - } - - return false -} - -// SetAutomute gets a reference to the given bool and assigns it to the Automute field. -func (o *GCPAccount) SetAutomute(v bool) { - o.Automute = &v -} - -// GetClientEmail returns the ClientEmail field value if set, zero value otherwise. -func (o *GCPAccount) GetClientEmail() string { - if o == nil || o.ClientEmail == nil { - var ret string - return ret - } - return *o.ClientEmail -} - -// GetClientEmailOk returns a tuple with the ClientEmail field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetClientEmailOk() (*string, bool) { - if o == nil || o.ClientEmail == nil { - return nil, false - } - return o.ClientEmail, true -} - -// HasClientEmail returns a boolean if a field has been set. -func (o *GCPAccount) HasClientEmail() bool { - if o != nil && o.ClientEmail != nil { - return true - } - - return false -} - -// SetClientEmail gets a reference to the given string and assigns it to the ClientEmail field. -func (o *GCPAccount) SetClientEmail(v string) { - o.ClientEmail = &v -} - -// GetClientId returns the ClientId field value if set, zero value otherwise. -func (o *GCPAccount) GetClientId() string { - if o == nil || o.ClientId == nil { - var ret string - return ret - } - return *o.ClientId -} - -// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetClientIdOk() (*string, bool) { - if o == nil || o.ClientId == nil { - return nil, false - } - return o.ClientId, true -} - -// HasClientId returns a boolean if a field has been set. -func (o *GCPAccount) HasClientId() bool { - if o != nil && o.ClientId != nil { - return true - } - - return false -} - -// SetClientId gets a reference to the given string and assigns it to the ClientId field. -func (o *GCPAccount) SetClientId(v string) { - o.ClientId = &v -} - -// GetClientX509CertUrl returns the ClientX509CertUrl field value if set, zero value otherwise. -func (o *GCPAccount) GetClientX509CertUrl() string { - if o == nil || o.ClientX509CertUrl == nil { - var ret string - return ret - } - return *o.ClientX509CertUrl -} - -// GetClientX509CertUrlOk returns a tuple with the ClientX509CertUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetClientX509CertUrlOk() (*string, bool) { - if o == nil || o.ClientX509CertUrl == nil { - return nil, false - } - return o.ClientX509CertUrl, true -} - -// HasClientX509CertUrl returns a boolean if a field has been set. -func (o *GCPAccount) HasClientX509CertUrl() bool { - if o != nil && o.ClientX509CertUrl != nil { - return true - } - - return false -} - -// SetClientX509CertUrl gets a reference to the given string and assigns it to the ClientX509CertUrl field. -func (o *GCPAccount) SetClientX509CertUrl(v string) { - o.ClientX509CertUrl = &v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *GCPAccount) GetErrors() []string { - if o == nil || o.Errors == nil { - var ret []string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetErrorsOk() (*[]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *GCPAccount) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []string and assigns it to the Errors field. -func (o *GCPAccount) SetErrors(v []string) { - o.Errors = v -} - -// GetHostFilters returns the HostFilters field value if set, zero value otherwise. -func (o *GCPAccount) GetHostFilters() string { - if o == nil || o.HostFilters == nil { - var ret string - return ret - } - return *o.HostFilters -} - -// GetHostFiltersOk returns a tuple with the HostFilters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetHostFiltersOk() (*string, bool) { - if o == nil || o.HostFilters == nil { - return nil, false - } - return o.HostFilters, true -} - -// HasHostFilters returns a boolean if a field has been set. -func (o *GCPAccount) HasHostFilters() bool { - if o != nil && o.HostFilters != nil { - return true - } - - return false -} - -// SetHostFilters gets a reference to the given string and assigns it to the HostFilters field. -func (o *GCPAccount) SetHostFilters(v string) { - o.HostFilters = &v -} - -// GetPrivateKey returns the PrivateKey field value if set, zero value otherwise. -func (o *GCPAccount) GetPrivateKey() string { - if o == nil || o.PrivateKey == nil { - var ret string - return ret - } - return *o.PrivateKey -} - -// GetPrivateKeyOk returns a tuple with the PrivateKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetPrivateKeyOk() (*string, bool) { - if o == nil || o.PrivateKey == nil { - return nil, false - } - return o.PrivateKey, true -} - -// HasPrivateKey returns a boolean if a field has been set. -func (o *GCPAccount) HasPrivateKey() bool { - if o != nil && o.PrivateKey != nil { - return true - } - - return false -} - -// SetPrivateKey gets a reference to the given string and assigns it to the PrivateKey field. -func (o *GCPAccount) SetPrivateKey(v string) { - o.PrivateKey = &v -} - -// GetPrivateKeyId returns the PrivateKeyId field value if set, zero value otherwise. -func (o *GCPAccount) GetPrivateKeyId() string { - if o == nil || o.PrivateKeyId == nil { - var ret string - return ret - } - return *o.PrivateKeyId -} - -// GetPrivateKeyIdOk returns a tuple with the PrivateKeyId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetPrivateKeyIdOk() (*string, bool) { - if o == nil || o.PrivateKeyId == nil { - return nil, false - } - return o.PrivateKeyId, true -} - -// HasPrivateKeyId returns a boolean if a field has been set. -func (o *GCPAccount) HasPrivateKeyId() bool { - if o != nil && o.PrivateKeyId != nil { - return true - } - - return false -} - -// SetPrivateKeyId gets a reference to the given string and assigns it to the PrivateKeyId field. -func (o *GCPAccount) SetPrivateKeyId(v string) { - o.PrivateKeyId = &v -} - -// GetProjectId returns the ProjectId field value if set, zero value otherwise. -func (o *GCPAccount) GetProjectId() string { - if o == nil || o.ProjectId == nil { - var ret string - return ret - } - return *o.ProjectId -} - -// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetProjectIdOk() (*string, bool) { - if o == nil || o.ProjectId == nil { - return nil, false - } - return o.ProjectId, true -} - -// HasProjectId returns a boolean if a field has been set. -func (o *GCPAccount) HasProjectId() bool { - if o != nil && o.ProjectId != nil { - return true - } - - return false -} - -// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. -func (o *GCPAccount) SetProjectId(v string) { - o.ProjectId = &v -} - -// GetTokenUri returns the TokenUri field value if set, zero value otherwise. -func (o *GCPAccount) GetTokenUri() string { - if o == nil || o.TokenUri == nil { - var ret string - return ret - } - return *o.TokenUri -} - -// GetTokenUriOk returns a tuple with the TokenUri field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetTokenUriOk() (*string, bool) { - if o == nil || o.TokenUri == nil { - return nil, false - } - return o.TokenUri, true -} - -// HasTokenUri returns a boolean if a field has been set. -func (o *GCPAccount) HasTokenUri() bool { - if o != nil && o.TokenUri != nil { - return true - } - - return false -} - -// SetTokenUri gets a reference to the given string and assigns it to the TokenUri field. -func (o *GCPAccount) SetTokenUri(v string) { - o.TokenUri = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *GCPAccount) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GCPAccount) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *GCPAccount) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *GCPAccount) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o GCPAccount) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AuthProviderX509CertUrl != nil { - toSerialize["auth_provider_x509_cert_url"] = o.AuthProviderX509CertUrl - } - if o.AuthUri != nil { - toSerialize["auth_uri"] = o.AuthUri - } - if o.Automute != nil { - toSerialize["automute"] = o.Automute - } - if o.ClientEmail != nil { - toSerialize["client_email"] = o.ClientEmail - } - if o.ClientId != nil { - toSerialize["client_id"] = o.ClientId - } - if o.ClientX509CertUrl != nil { - toSerialize["client_x509_cert_url"] = o.ClientX509CertUrl - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - if o.HostFilters != nil { - toSerialize["host_filters"] = o.HostFilters - } - if o.PrivateKey != nil { - toSerialize["private_key"] = o.PrivateKey - } - if o.PrivateKeyId != nil { - toSerialize["private_key_id"] = o.PrivateKeyId - } - if o.ProjectId != nil { - toSerialize["project_id"] = o.ProjectId - } - if o.TokenUri != nil { - toSerialize["token_uri"] = o.TokenUri - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *GCPAccount) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AuthProviderX509CertUrl *string `json:"auth_provider_x509_cert_url,omitempty"` - AuthUri *string `json:"auth_uri,omitempty"` - Automute *bool `json:"automute,omitempty"` - ClientEmail *string `json:"client_email,omitempty"` - ClientId *string `json:"client_id,omitempty"` - ClientX509CertUrl *string `json:"client_x509_cert_url,omitempty"` - Errors []string `json:"errors,omitempty"` - HostFilters *string `json:"host_filters,omitempty"` - PrivateKey *string `json:"private_key,omitempty"` - PrivateKeyId *string `json:"private_key_id,omitempty"` - ProjectId *string `json:"project_id,omitempty"` - TokenUri *string `json:"token_uri,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AuthProviderX509CertUrl = all.AuthProviderX509CertUrl - o.AuthUri = all.AuthUri - o.Automute = all.Automute - o.ClientEmail = all.ClientEmail - o.ClientId = all.ClientId - o.ClientX509CertUrl = all.ClientX509CertUrl - o.Errors = all.Errors - o.HostFilters = all.HostFilters - o.PrivateKey = all.PrivateKey - o.PrivateKeyId = all.PrivateKeyId - o.ProjectId = all.ProjectId - o.TokenUri = all.TokenUri - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_geomap_widget_definition.go b/api/v1/datadog/model_geomap_widget_definition.go deleted file mode 100644 index 8326fba9518..00000000000 --- a/api/v1/datadog/model_geomap_widget_definition.go +++ /dev/null @@ -1,439 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// GeomapWidgetDefinition This visualization displays a series of values by country on a world map. -type GeomapWidgetDefinition struct { - // A list of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // Array of one request object to display in the widget. The request must contain a `group-by` tag whose value is a country ISO code. - // - // See the [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json) - // for information about building the `REQUEST_SCHEMA`. - Requests []GeomapWidgetRequest `json:"requests"` - // The style to apply to the widget. - Style GeomapWidgetDefinitionStyle `json:"style"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // The title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // The size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the geomap widget. - Type GeomapWidgetDefinitionType `json:"type"` - // The view of the world that the map should render. - View GeomapWidgetDefinitionView `json:"view"` - // 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{} -} - -// NewGeomapWidgetDefinition instantiates a new GeomapWidgetDefinition 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 NewGeomapWidgetDefinition(requests []GeomapWidgetRequest, style GeomapWidgetDefinitionStyle, typeVar GeomapWidgetDefinitionType, view GeomapWidgetDefinitionView) *GeomapWidgetDefinition { - this := GeomapWidgetDefinition{} - this.Requests = requests - this.Style = style - this.Type = typeVar - this.View = view - return &this -} - -// NewGeomapWidgetDefinitionWithDefaults instantiates a new GeomapWidgetDefinition 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 NewGeomapWidgetDefinitionWithDefaults() *GeomapWidgetDefinition { - this := GeomapWidgetDefinition{} - var typeVar GeomapWidgetDefinitionType = GEOMAPWIDGETDEFINITIONTYPE_GEOMAP - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *GeomapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *GeomapWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *GeomapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetRequests returns the Requests field value. -func (o *GeomapWidgetDefinition) GetRequests() []GeomapWidgetRequest { - if o == nil { - var ret []GeomapWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetRequestsOk() (*[]GeomapWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *GeomapWidgetDefinition) SetRequests(v []GeomapWidgetRequest) { - o.Requests = v -} - -// GetStyle returns the Style field value. -func (o *GeomapWidgetDefinition) GetStyle() GeomapWidgetDefinitionStyle { - if o == nil { - var ret GeomapWidgetDefinitionStyle - return ret - } - return o.Style -} - -// GetStyleOk returns a tuple with the Style field value -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetStyleOk() (*GeomapWidgetDefinitionStyle, bool) { - if o == nil { - return nil, false - } - return &o.Style, true -} - -// SetStyle sets field value. -func (o *GeomapWidgetDefinition) SetStyle(v GeomapWidgetDefinitionStyle) { - o.Style = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *GeomapWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *GeomapWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *GeomapWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *GeomapWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *GeomapWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *GeomapWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *GeomapWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *GeomapWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *GeomapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *GeomapWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *GeomapWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *GeomapWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *GeomapWidgetDefinition) GetType() GeomapWidgetDefinitionType { - if o == nil { - var ret GeomapWidgetDefinitionType - 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 *GeomapWidgetDefinition) GetTypeOk() (*GeomapWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *GeomapWidgetDefinition) SetType(v GeomapWidgetDefinitionType) { - o.Type = v -} - -// GetView returns the View field value. -func (o *GeomapWidgetDefinition) GetView() GeomapWidgetDefinitionView { - if o == nil { - var ret GeomapWidgetDefinitionView - return ret - } - return o.View -} - -// GetViewOk returns a tuple with the View field value -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinition) GetViewOk() (*GeomapWidgetDefinitionView, bool) { - if o == nil { - return nil, false - } - return &o.View, true -} - -// SetView sets field value. -func (o *GeomapWidgetDefinition) SetView(v GeomapWidgetDefinitionView) { - o.View = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o GeomapWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - toSerialize["requests"] = o.Requests - toSerialize["style"] = o.Style - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - toSerialize["view"] = o.View - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]GeomapWidgetRequest `json:"requests"` - Style *GeomapWidgetDefinitionStyle `json:"style"` - Type *GeomapWidgetDefinitionType `json:"type"` - View *GeomapWidgetDefinitionView `json:"view"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests []GeomapWidgetRequest `json:"requests"` - Style GeomapWidgetDefinitionStyle `json:"style"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type GeomapWidgetDefinitionType `json:"type"` - View GeomapWidgetDefinitionView `json:"view"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Style == nil { - return fmt.Errorf("Required field style missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - if required.View == nil { - return fmt.Errorf("Required field view missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.Requests = all.Requests - if all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Style = all.Style - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - if all.View.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.View = all.View - return nil -} diff --git a/api/v1/datadog/model_geomap_widget_definition_style.go b/api/v1/datadog/model_geomap_widget_definition_style.go deleted file mode 100644 index 8a41cab7dcc..00000000000 --- a/api/v1/datadog/model_geomap_widget_definition_style.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// GeomapWidgetDefinitionStyle The style to apply to the widget. -type GeomapWidgetDefinitionStyle struct { - // The color palette to apply to the widget. - Palette string `json:"palette"` - // Whether to flip the palette tones. - PaletteFlip bool `json:"palette_flip"` - // 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{} -} - -// NewGeomapWidgetDefinitionStyle instantiates a new GeomapWidgetDefinitionStyle 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 NewGeomapWidgetDefinitionStyle(palette string, paletteFlip bool) *GeomapWidgetDefinitionStyle { - this := GeomapWidgetDefinitionStyle{} - this.Palette = palette - this.PaletteFlip = paletteFlip - return &this -} - -// NewGeomapWidgetDefinitionStyleWithDefaults instantiates a new GeomapWidgetDefinitionStyle 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 NewGeomapWidgetDefinitionStyleWithDefaults() *GeomapWidgetDefinitionStyle { - this := GeomapWidgetDefinitionStyle{} - return &this -} - -// GetPalette returns the Palette field value. -func (o *GeomapWidgetDefinitionStyle) GetPalette() string { - if o == nil { - var ret string - return ret - } - return o.Palette -} - -// GetPaletteOk returns a tuple with the Palette field value -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinitionStyle) GetPaletteOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Palette, true -} - -// SetPalette sets field value. -func (o *GeomapWidgetDefinitionStyle) SetPalette(v string) { - o.Palette = v -} - -// GetPaletteFlip returns the PaletteFlip field value. -func (o *GeomapWidgetDefinitionStyle) GetPaletteFlip() bool { - if o == nil { - var ret bool - return ret - } - return o.PaletteFlip -} - -// GetPaletteFlipOk returns a tuple with the PaletteFlip field value -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinitionStyle) GetPaletteFlipOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.PaletteFlip, true -} - -// SetPaletteFlip sets field value. -func (o *GeomapWidgetDefinitionStyle) SetPaletteFlip(v bool) { - o.PaletteFlip = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o GeomapWidgetDefinitionStyle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["palette"] = o.Palette - toSerialize["palette_flip"] = o.PaletteFlip - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *GeomapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Palette *string `json:"palette"` - PaletteFlip *bool `json:"palette_flip"` - }{} - all := struct { - Palette string `json:"palette"` - PaletteFlip bool `json:"palette_flip"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Palette == nil { - return fmt.Errorf("Required field palette missing") - } - if required.PaletteFlip == nil { - return fmt.Errorf("Required field palette_flip missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Palette = all.Palette - o.PaletteFlip = all.PaletteFlip - return nil -} diff --git a/api/v1/datadog/model_geomap_widget_definition_type.go b/api/v1/datadog/model_geomap_widget_definition_type.go deleted file mode 100644 index cadabf22809..00000000000 --- a/api/v1/datadog/model_geomap_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// GeomapWidgetDefinitionType Type of the geomap widget. -type GeomapWidgetDefinitionType string - -// List of GeomapWidgetDefinitionType. -const ( - GEOMAPWIDGETDEFINITIONTYPE_GEOMAP GeomapWidgetDefinitionType = "geomap" -) - -var allowedGeomapWidgetDefinitionTypeEnumValues = []GeomapWidgetDefinitionType{ - GEOMAPWIDGETDEFINITIONTYPE_GEOMAP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *GeomapWidgetDefinitionType) GetAllowedValues() []GeomapWidgetDefinitionType { - return allowedGeomapWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *GeomapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = GeomapWidgetDefinitionType(value) - return nil -} - -// NewGeomapWidgetDefinitionTypeFromValue returns a pointer to a valid GeomapWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewGeomapWidgetDefinitionTypeFromValue(v string) (*GeomapWidgetDefinitionType, error) { - ev := GeomapWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for GeomapWidgetDefinitionType: valid values are %v", v, allowedGeomapWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v GeomapWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedGeomapWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to GeomapWidgetDefinitionType value. -func (v GeomapWidgetDefinitionType) Ptr() *GeomapWidgetDefinitionType { - return &v -} - -// NullableGeomapWidgetDefinitionType handles when a null is used for GeomapWidgetDefinitionType. -type NullableGeomapWidgetDefinitionType struct { - value *GeomapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableGeomapWidgetDefinitionType) Get() *GeomapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableGeomapWidgetDefinitionType) Set(val *GeomapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableGeomapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableGeomapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableGeomapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableGeomapWidgetDefinitionType(val *GeomapWidgetDefinitionType) *NullableGeomapWidgetDefinitionType { - return &NullableGeomapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableGeomapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableGeomapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_geomap_widget_definition_view.go b/api/v1/datadog/model_geomap_widget_definition_view.go deleted file mode 100644 index a6702d3f492..00000000000 --- a/api/v1/datadog/model_geomap_widget_definition_view.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// GeomapWidgetDefinitionView The view of the world that the map should render. -type GeomapWidgetDefinitionView struct { - // The 2-letter ISO code of a country to focus the map on. Or `WORLD`. - Focus string `json:"focus"` - // 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{} -} - -// NewGeomapWidgetDefinitionView instantiates a new GeomapWidgetDefinitionView 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 NewGeomapWidgetDefinitionView(focus string) *GeomapWidgetDefinitionView { - this := GeomapWidgetDefinitionView{} - this.Focus = focus - return &this -} - -// NewGeomapWidgetDefinitionViewWithDefaults instantiates a new GeomapWidgetDefinitionView 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 NewGeomapWidgetDefinitionViewWithDefaults() *GeomapWidgetDefinitionView { - this := GeomapWidgetDefinitionView{} - return &this -} - -// GetFocus returns the Focus field value. -func (o *GeomapWidgetDefinitionView) GetFocus() string { - if o == nil { - var ret string - return ret - } - return o.Focus -} - -// GetFocusOk returns a tuple with the Focus field value -// and a boolean to check if the value has been set. -func (o *GeomapWidgetDefinitionView) GetFocusOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Focus, true -} - -// SetFocus sets field value. -func (o *GeomapWidgetDefinitionView) SetFocus(v string) { - o.Focus = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o GeomapWidgetDefinitionView) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["focus"] = o.Focus - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *GeomapWidgetDefinitionView) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Focus *string `json:"focus"` - }{} - all := struct { - Focus string `json:"focus"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Focus == nil { - return fmt.Errorf("Required field focus missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Focus = all.Focus - return nil -} diff --git a/api/v1/datadog/model_geomap_widget_request.go b/api/v1/datadog/model_geomap_widget_request.go deleted file mode 100644 index b0f619dda85..00000000000 --- a/api/v1/datadog/model_geomap_widget_request.go +++ /dev/null @@ -1,365 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// GeomapWidgetRequest An updated geomap widget. -type GeomapWidgetRequest struct { - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The widget metrics query. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,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{} -} - -// NewGeomapWidgetRequest instantiates a new GeomapWidgetRequest 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 NewGeomapWidgetRequest() *GeomapWidgetRequest { - this := GeomapWidgetRequest{} - return &this -} - -// NewGeomapWidgetRequestWithDefaults instantiates a new GeomapWidgetRequest 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 NewGeomapWidgetRequestWithDefaults() *GeomapWidgetRequest { - this := GeomapWidgetRequest{} - return &this -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *GeomapWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *GeomapWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *GeomapWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *GeomapWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *GeomapWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *GeomapWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *GeomapWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *GeomapWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *GeomapWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *GeomapWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *GeomapWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *GeomapWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *GeomapWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *GeomapWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *GeomapWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *GeomapWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *GeomapWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *GeomapWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *GeomapWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GeomapWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *GeomapWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *GeomapWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o GeomapWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *GeomapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Formulas []WidgetFormula `json:"formulas,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Formulas = all.Formulas - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - return nil -} diff --git a/api/v1/datadog/model_graph_snapshot.go b/api/v1/datadog/model_graph_snapshot.go deleted file mode 100644 index ad30e623e78..00000000000 --- a/api/v1/datadog/model_graph_snapshot.go +++ /dev/null @@ -1,182 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// GraphSnapshot Object representing a graph snapshot. -type GraphSnapshot struct { - // A JSON document defining the graph. `graph_def` can be used instead of `metric_query`. - // The JSON document uses the [grammar defined here](https://docs.datadoghq.com/graphing/graphing_json/#grammar) - // and should be formatted to a single line then URL encoded. - GraphDef *string `json:"graph_def,omitempty"` - // The metric query. One of `metric_query` or `graph_def` is required. - MetricQuery *string `json:"metric_query,omitempty"` - // URL of your [graph snapshot](https://docs.datadoghq.com/metrics/explorer/#snapshot). - SnapshotUrl *string `json:"snapshot_url,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{} -} - -// NewGraphSnapshot instantiates a new GraphSnapshot 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 NewGraphSnapshot() *GraphSnapshot { - this := GraphSnapshot{} - return &this -} - -// NewGraphSnapshotWithDefaults instantiates a new GraphSnapshot 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 NewGraphSnapshotWithDefaults() *GraphSnapshot { - this := GraphSnapshot{} - return &this -} - -// GetGraphDef returns the GraphDef field value if set, zero value otherwise. -func (o *GraphSnapshot) GetGraphDef() string { - if o == nil || o.GraphDef == nil { - var ret string - return ret - } - return *o.GraphDef -} - -// GetGraphDefOk returns a tuple with the GraphDef field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GraphSnapshot) GetGraphDefOk() (*string, bool) { - if o == nil || o.GraphDef == nil { - return nil, false - } - return o.GraphDef, true -} - -// HasGraphDef returns a boolean if a field has been set. -func (o *GraphSnapshot) HasGraphDef() bool { - if o != nil && o.GraphDef != nil { - return true - } - - return false -} - -// SetGraphDef gets a reference to the given string and assigns it to the GraphDef field. -func (o *GraphSnapshot) SetGraphDef(v string) { - o.GraphDef = &v -} - -// GetMetricQuery returns the MetricQuery field value if set, zero value otherwise. -func (o *GraphSnapshot) GetMetricQuery() string { - if o == nil || o.MetricQuery == nil { - var ret string - return ret - } - return *o.MetricQuery -} - -// GetMetricQueryOk returns a tuple with the MetricQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GraphSnapshot) GetMetricQueryOk() (*string, bool) { - if o == nil || o.MetricQuery == nil { - return nil, false - } - return o.MetricQuery, true -} - -// HasMetricQuery returns a boolean if a field has been set. -func (o *GraphSnapshot) HasMetricQuery() bool { - if o != nil && o.MetricQuery != nil { - return true - } - - return false -} - -// SetMetricQuery gets a reference to the given string and assigns it to the MetricQuery field. -func (o *GraphSnapshot) SetMetricQuery(v string) { - o.MetricQuery = &v -} - -// GetSnapshotUrl returns the SnapshotUrl field value if set, zero value otherwise. -func (o *GraphSnapshot) GetSnapshotUrl() string { - if o == nil || o.SnapshotUrl == nil { - var ret string - return ret - } - return *o.SnapshotUrl -} - -// GetSnapshotUrlOk returns a tuple with the SnapshotUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GraphSnapshot) GetSnapshotUrlOk() (*string, bool) { - if o == nil || o.SnapshotUrl == nil { - return nil, false - } - return o.SnapshotUrl, true -} - -// HasSnapshotUrl returns a boolean if a field has been set. -func (o *GraphSnapshot) HasSnapshotUrl() bool { - if o != nil && o.SnapshotUrl != nil { - return true - } - - return false -} - -// SetSnapshotUrl gets a reference to the given string and assigns it to the SnapshotUrl field. -func (o *GraphSnapshot) SetSnapshotUrl(v string) { - o.SnapshotUrl = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o GraphSnapshot) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.GraphDef != nil { - toSerialize["graph_def"] = o.GraphDef - } - if o.MetricQuery != nil { - toSerialize["metric_query"] = o.MetricQuery - } - if o.SnapshotUrl != nil { - toSerialize["snapshot_url"] = o.SnapshotUrl - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *GraphSnapshot) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - GraphDef *string `json:"graph_def,omitempty"` - MetricQuery *string `json:"metric_query,omitempty"` - SnapshotUrl *string `json:"snapshot_url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.GraphDef = all.GraphDef - o.MetricQuery = all.MetricQuery - o.SnapshotUrl = all.SnapshotUrl - return nil -} diff --git a/api/v1/datadog/model_group_widget_definition.go b/api/v1/datadog/model_group_widget_definition.go deleted file mode 100644 index b056f598634..00000000000 --- a/api/v1/datadog/model_group_widget_definition.go +++ /dev/null @@ -1,394 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// GroupWidgetDefinition The groups widget allows you to keep similar graphs together on your timeboard. Each group has a custom header, can hold one to many graphs, and is collapsible. -type GroupWidgetDefinition struct { - // Background color of the group title. - BackgroundColor *string `json:"background_color,omitempty"` - // URL of image to display as a banner for the group. - BannerImg *string `json:"banner_img,omitempty"` - // Layout type of the group. - LayoutType WidgetLayoutType `json:"layout_type"` - // Whether to show the title or not. - ShowTitle *bool `json:"show_title,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Type of the group widget. - Type GroupWidgetDefinitionType `json:"type"` - // List of widget groups. - Widgets []Widget `json:"widgets"` - // 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{} -} - -// NewGroupWidgetDefinition instantiates a new GroupWidgetDefinition 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 NewGroupWidgetDefinition(layoutType WidgetLayoutType, typeVar GroupWidgetDefinitionType, widgets []Widget) *GroupWidgetDefinition { - this := GroupWidgetDefinition{} - this.LayoutType = layoutType - var showTitle bool = true - this.ShowTitle = &showTitle - this.Type = typeVar - this.Widgets = widgets - return &this -} - -// NewGroupWidgetDefinitionWithDefaults instantiates a new GroupWidgetDefinition 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 NewGroupWidgetDefinitionWithDefaults() *GroupWidgetDefinition { - this := GroupWidgetDefinition{} - var showTitle bool = true - this.ShowTitle = &showTitle - var typeVar GroupWidgetDefinitionType = GROUPWIDGETDEFINITIONTYPE_GROUP - this.Type = typeVar - return &this -} - -// GetBackgroundColor returns the BackgroundColor field value if set, zero value otherwise. -func (o *GroupWidgetDefinition) GetBackgroundColor() string { - if o == nil || o.BackgroundColor == nil { - var ret string - return ret - } - return *o.BackgroundColor -} - -// GetBackgroundColorOk returns a tuple with the BackgroundColor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GroupWidgetDefinition) GetBackgroundColorOk() (*string, bool) { - if o == nil || o.BackgroundColor == nil { - return nil, false - } - return o.BackgroundColor, true -} - -// HasBackgroundColor returns a boolean if a field has been set. -func (o *GroupWidgetDefinition) HasBackgroundColor() bool { - if o != nil && o.BackgroundColor != nil { - return true - } - - return false -} - -// SetBackgroundColor gets a reference to the given string and assigns it to the BackgroundColor field. -func (o *GroupWidgetDefinition) SetBackgroundColor(v string) { - o.BackgroundColor = &v -} - -// GetBannerImg returns the BannerImg field value if set, zero value otherwise. -func (o *GroupWidgetDefinition) GetBannerImg() string { - if o == nil || o.BannerImg == nil { - var ret string - return ret - } - return *o.BannerImg -} - -// GetBannerImgOk returns a tuple with the BannerImg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GroupWidgetDefinition) GetBannerImgOk() (*string, bool) { - if o == nil || o.BannerImg == nil { - return nil, false - } - return o.BannerImg, true -} - -// HasBannerImg returns a boolean if a field has been set. -func (o *GroupWidgetDefinition) HasBannerImg() bool { - if o != nil && o.BannerImg != nil { - return true - } - - return false -} - -// SetBannerImg gets a reference to the given string and assigns it to the BannerImg field. -func (o *GroupWidgetDefinition) SetBannerImg(v string) { - o.BannerImg = &v -} - -// GetLayoutType returns the LayoutType field value. -func (o *GroupWidgetDefinition) GetLayoutType() WidgetLayoutType { - if o == nil { - var ret WidgetLayoutType - return ret - } - return o.LayoutType -} - -// GetLayoutTypeOk returns a tuple with the LayoutType field value -// and a boolean to check if the value has been set. -func (o *GroupWidgetDefinition) GetLayoutTypeOk() (*WidgetLayoutType, bool) { - if o == nil { - return nil, false - } - return &o.LayoutType, true -} - -// SetLayoutType sets field value. -func (o *GroupWidgetDefinition) SetLayoutType(v WidgetLayoutType) { - o.LayoutType = v -} - -// GetShowTitle returns the ShowTitle field value if set, zero value otherwise. -func (o *GroupWidgetDefinition) GetShowTitle() bool { - if o == nil || o.ShowTitle == nil { - var ret bool - return ret - } - return *o.ShowTitle -} - -// GetShowTitleOk returns a tuple with the ShowTitle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GroupWidgetDefinition) GetShowTitleOk() (*bool, bool) { - if o == nil || o.ShowTitle == nil { - return nil, false - } - return o.ShowTitle, true -} - -// HasShowTitle returns a boolean if a field has been set. -func (o *GroupWidgetDefinition) HasShowTitle() bool { - if o != nil && o.ShowTitle != nil { - return true - } - - return false -} - -// SetShowTitle gets a reference to the given bool and assigns it to the ShowTitle field. -func (o *GroupWidgetDefinition) SetShowTitle(v bool) { - o.ShowTitle = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *GroupWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GroupWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *GroupWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *GroupWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *GroupWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GroupWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *GroupWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *GroupWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetType returns the Type field value. -func (o *GroupWidgetDefinition) GetType() GroupWidgetDefinitionType { - if o == nil { - var ret GroupWidgetDefinitionType - 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 *GroupWidgetDefinition) GetTypeOk() (*GroupWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *GroupWidgetDefinition) SetType(v GroupWidgetDefinitionType) { - o.Type = v -} - -// GetWidgets returns the Widgets field value. -func (o *GroupWidgetDefinition) GetWidgets() []Widget { - if o == nil { - var ret []Widget - return ret - } - return o.Widgets -} - -// GetWidgetsOk returns a tuple with the Widgets field value -// and a boolean to check if the value has been set. -func (o *GroupWidgetDefinition) GetWidgetsOk() (*[]Widget, bool) { - if o == nil { - return nil, false - } - return &o.Widgets, true -} - -// SetWidgets sets field value. -func (o *GroupWidgetDefinition) SetWidgets(v []Widget) { - o.Widgets = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o GroupWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BackgroundColor != nil { - toSerialize["background_color"] = o.BackgroundColor - } - if o.BannerImg != nil { - toSerialize["banner_img"] = o.BannerImg - } - toSerialize["layout_type"] = o.LayoutType - if o.ShowTitle != nil { - toSerialize["show_title"] = o.ShowTitle - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - toSerialize["type"] = o.Type - toSerialize["widgets"] = o.Widgets - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - LayoutType *WidgetLayoutType `json:"layout_type"` - Type *GroupWidgetDefinitionType `json:"type"` - Widgets *[]Widget `json:"widgets"` - }{} - all := struct { - BackgroundColor *string `json:"background_color,omitempty"` - BannerImg *string `json:"banner_img,omitempty"` - LayoutType WidgetLayoutType `json:"layout_type"` - ShowTitle *bool `json:"show_title,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - Type GroupWidgetDefinitionType `json:"type"` - Widgets []Widget `json:"widgets"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.LayoutType == nil { - return fmt.Errorf("Required field layout_type missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - if required.Widgets == nil { - return fmt.Errorf("Required field widgets missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LayoutType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BackgroundColor = all.BackgroundColor - o.BannerImg = all.BannerImg - o.LayoutType = all.LayoutType - o.ShowTitle = all.ShowTitle - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.Type = all.Type - o.Widgets = all.Widgets - return nil -} diff --git a/api/v1/datadog/model_group_widget_definition_type.go b/api/v1/datadog/model_group_widget_definition_type.go deleted file mode 100644 index 0617706b4aa..00000000000 --- a/api/v1/datadog/model_group_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// GroupWidgetDefinitionType Type of the group widget. -type GroupWidgetDefinitionType string - -// List of GroupWidgetDefinitionType. -const ( - GROUPWIDGETDEFINITIONTYPE_GROUP GroupWidgetDefinitionType = "group" -) - -var allowedGroupWidgetDefinitionTypeEnumValues = []GroupWidgetDefinitionType{ - GROUPWIDGETDEFINITIONTYPE_GROUP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *GroupWidgetDefinitionType) GetAllowedValues() []GroupWidgetDefinitionType { - return allowedGroupWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *GroupWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = GroupWidgetDefinitionType(value) - return nil -} - -// NewGroupWidgetDefinitionTypeFromValue returns a pointer to a valid GroupWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewGroupWidgetDefinitionTypeFromValue(v string) (*GroupWidgetDefinitionType, error) { - ev := GroupWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for GroupWidgetDefinitionType: valid values are %v", v, allowedGroupWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v GroupWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedGroupWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to GroupWidgetDefinitionType value. -func (v GroupWidgetDefinitionType) Ptr() *GroupWidgetDefinitionType { - return &v -} - -// NullableGroupWidgetDefinitionType handles when a null is used for GroupWidgetDefinitionType. -type NullableGroupWidgetDefinitionType struct { - value *GroupWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableGroupWidgetDefinitionType) Get() *GroupWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableGroupWidgetDefinitionType) Set(val *GroupWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableGroupWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableGroupWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableGroupWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableGroupWidgetDefinitionType(val *GroupWidgetDefinitionType) *NullableGroupWidgetDefinitionType { - return &NullableGroupWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableGroupWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableGroupWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_heat_map_widget_definition.go b/api/v1/datadog/model_heat_map_widget_definition.go deleted file mode 100644 index a9dd645e94d..00000000000 --- a/api/v1/datadog/model_heat_map_widget_definition.go +++ /dev/null @@ -1,519 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HeatMapWidgetDefinition The heat map visualization shows metrics aggregated across many tags, such as hosts. The more hosts that have a particular value, the darker that square is. -type HeatMapWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // List of widget events. - Events []WidgetEvent `json:"events,omitempty"` - // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". - LegendSize *string `json:"legend_size,omitempty"` - // List of widget types. - Requests []HeatMapWidgetRequest `json:"requests"` - // Whether or not to display the legend on this widget. - ShowLegend *bool `json:"show_legend,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the heat map widget. - Type HeatMapWidgetDefinitionType `json:"type"` - // Axis controls for the widget. - Yaxis *WidgetAxis `json:"yaxis,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{} -} - -// NewHeatMapWidgetDefinition instantiates a new HeatMapWidgetDefinition 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 NewHeatMapWidgetDefinition(requests []HeatMapWidgetRequest, typeVar HeatMapWidgetDefinitionType) *HeatMapWidgetDefinition { - this := HeatMapWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewHeatMapWidgetDefinitionWithDefaults instantiates a new HeatMapWidgetDefinition 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 NewHeatMapWidgetDefinitionWithDefaults() *HeatMapWidgetDefinition { - this := HeatMapWidgetDefinition{} - var typeVar HeatMapWidgetDefinitionType = HEATMAPWIDGETDEFINITIONTYPE_HEATMAP - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *HeatMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetEvents returns the Events field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetEvents() []WidgetEvent { - if o == nil || o.Events == nil { - var ret []WidgetEvent - return ret - } - return o.Events -} - -// GetEventsOk returns a tuple with the Events field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetEventsOk() (*[]WidgetEvent, bool) { - if o == nil || o.Events == nil { - return nil, false - } - return &o.Events, true -} - -// HasEvents returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasEvents() bool { - if o != nil && o.Events != nil { - return true - } - - return false -} - -// SetEvents gets a reference to the given []WidgetEvent and assigns it to the Events field. -func (o *HeatMapWidgetDefinition) SetEvents(v []WidgetEvent) { - o.Events = v -} - -// GetLegendSize returns the LegendSize field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetLegendSize() string { - if o == nil || o.LegendSize == nil { - var ret string - return ret - } - return *o.LegendSize -} - -// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetLegendSizeOk() (*string, bool) { - if o == nil || o.LegendSize == nil { - return nil, false - } - return o.LegendSize, true -} - -// HasLegendSize returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasLegendSize() bool { - if o != nil && o.LegendSize != nil { - return true - } - - return false -} - -// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. -func (o *HeatMapWidgetDefinition) SetLegendSize(v string) { - o.LegendSize = &v -} - -// GetRequests returns the Requests field value. -func (o *HeatMapWidgetDefinition) GetRequests() []HeatMapWidgetRequest { - if o == nil { - var ret []HeatMapWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetRequestsOk() (*[]HeatMapWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *HeatMapWidgetDefinition) SetRequests(v []HeatMapWidgetRequest) { - o.Requests = v -} - -// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetShowLegend() bool { - if o == nil || o.ShowLegend == nil { - var ret bool - return ret - } - return *o.ShowLegend -} - -// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetShowLegendOk() (*bool, bool) { - if o == nil || o.ShowLegend == nil { - return nil, false - } - return o.ShowLegend, true -} - -// HasShowLegend returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasShowLegend() bool { - if o != nil && o.ShowLegend != nil { - return true - } - - return false -} - -// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. -func (o *HeatMapWidgetDefinition) SetShowLegend(v bool) { - o.ShowLegend = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *HeatMapWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *HeatMapWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *HeatMapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *HeatMapWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *HeatMapWidgetDefinition) GetType() HeatMapWidgetDefinitionType { - if o == nil { - var ret HeatMapWidgetDefinitionType - 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 *HeatMapWidgetDefinition) GetTypeOk() (*HeatMapWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *HeatMapWidgetDefinition) SetType(v HeatMapWidgetDefinitionType) { - o.Type = v -} - -// GetYaxis returns the Yaxis field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetYaxis() WidgetAxis { - if o == nil || o.Yaxis == nil { - var ret WidgetAxis - return ret - } - return *o.Yaxis -} - -// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetYaxisOk() (*WidgetAxis, bool) { - if o == nil || o.Yaxis == nil { - return nil, false - } - return o.Yaxis, true -} - -// HasYaxis returns a boolean if a field has been set. -func (o *HeatMapWidgetDefinition) HasYaxis() bool { - if o != nil && o.Yaxis != nil { - return true - } - - return false -} - -// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. -func (o *HeatMapWidgetDefinition) SetYaxis(v WidgetAxis) { - o.Yaxis = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HeatMapWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - if o.Events != nil { - toSerialize["events"] = o.Events - } - if o.LegendSize != nil { - toSerialize["legend_size"] = o.LegendSize - } - toSerialize["requests"] = o.Requests - if o.ShowLegend != nil { - toSerialize["show_legend"] = o.ShowLegend - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - if o.Yaxis != nil { - toSerialize["yaxis"] = o.Yaxis - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]HeatMapWidgetRequest `json:"requests"` - Type *HeatMapWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Events []WidgetEvent `json:"events,omitempty"` - LegendSize *string `json:"legend_size,omitempty"` - Requests []HeatMapWidgetRequest `json:"requests"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type HeatMapWidgetDefinitionType `json:"type"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.Events = all.Events - o.LegendSize = all.LegendSize - o.Requests = all.Requests - o.ShowLegend = all.ShowLegend - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Yaxis = all.Yaxis - return nil -} diff --git a/api/v1/datadog/model_heat_map_widget_definition_type.go b/api/v1/datadog/model_heat_map_widget_definition_type.go deleted file mode 100644 index eb36583e598..00000000000 --- a/api/v1/datadog/model_heat_map_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HeatMapWidgetDefinitionType Type of the heat map widget. -type HeatMapWidgetDefinitionType string - -// List of HeatMapWidgetDefinitionType. -const ( - HEATMAPWIDGETDEFINITIONTYPE_HEATMAP HeatMapWidgetDefinitionType = "heatmap" -) - -var allowedHeatMapWidgetDefinitionTypeEnumValues = []HeatMapWidgetDefinitionType{ - HEATMAPWIDGETDEFINITIONTYPE_HEATMAP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *HeatMapWidgetDefinitionType) GetAllowedValues() []HeatMapWidgetDefinitionType { - return allowedHeatMapWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *HeatMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = HeatMapWidgetDefinitionType(value) - return nil -} - -// NewHeatMapWidgetDefinitionTypeFromValue returns a pointer to a valid HeatMapWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewHeatMapWidgetDefinitionTypeFromValue(v string) (*HeatMapWidgetDefinitionType, error) { - ev := HeatMapWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for HeatMapWidgetDefinitionType: valid values are %v", v, allowedHeatMapWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v HeatMapWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedHeatMapWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to HeatMapWidgetDefinitionType value. -func (v HeatMapWidgetDefinitionType) Ptr() *HeatMapWidgetDefinitionType { - return &v -} - -// NullableHeatMapWidgetDefinitionType handles when a null is used for HeatMapWidgetDefinitionType. -type NullableHeatMapWidgetDefinitionType struct { - value *HeatMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableHeatMapWidgetDefinitionType) Get() *HeatMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHeatMapWidgetDefinitionType) Set(val *HeatMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHeatMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHeatMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHeatMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableHeatMapWidgetDefinitionType(val *HeatMapWidgetDefinitionType) *NullableHeatMapWidgetDefinitionType { - return &NullableHeatMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHeatMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHeatMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_heat_map_widget_request.go b/api/v1/datadog/model_heat_map_widget_request.go deleted file mode 100644 index 7b4089d13e5..00000000000 --- a/api/v1/datadog/model_heat_map_widget_request.go +++ /dev/null @@ -1,516 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HeatMapWidgetRequest Updated heat map widget. -type HeatMapWidgetRequest struct { - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The event query. - EventQuery *EventQueryDefinition `json:"event_query,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Widget query. - Q *string `json:"q,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - // Widget style definition. - Style *WidgetStyle `json:"style,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{} -} - -// NewHeatMapWidgetRequest instantiates a new HeatMapWidgetRequest 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 NewHeatMapWidgetRequest() *HeatMapWidgetRequest { - this := HeatMapWidgetRequest{} - return &this -} - -// NewHeatMapWidgetRequestWithDefaults instantiates a new HeatMapWidgetRequest 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 NewHeatMapWidgetRequestWithDefaults() *HeatMapWidgetRequest { - this := HeatMapWidgetRequest{} - return &this -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *HeatMapWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetEventQuery() EventQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret EventQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetEventQueryOk() (*EventQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given EventQueryDefinition and assigns it to the EventQuery field. -func (o *HeatMapWidgetRequest) SetEventQuery(v EventQueryDefinition) { - o.EventQuery = &v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *HeatMapWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *HeatMapWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *HeatMapWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *HeatMapWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *HeatMapWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *HeatMapWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *HeatMapWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// GetStyle returns the Style field value if set, zero value otherwise. -func (o *HeatMapWidgetRequest) GetStyle() WidgetStyle { - if o == nil || o.Style == nil { - var ret WidgetStyle - return ret - } - return *o.Style -} - -// GetStyleOk returns a tuple with the Style field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HeatMapWidgetRequest) GetStyleOk() (*WidgetStyle, bool) { - if o == nil || o.Style == nil { - return nil, false - } - return o.Style, true -} - -// HasStyle returns a boolean if a field has been set. -func (o *HeatMapWidgetRequest) HasStyle() bool { - if o != nil && o.Style != nil { - return true - } - - return false -} - -// SetStyle gets a reference to the given WidgetStyle and assigns it to the Style field. -func (o *HeatMapWidgetRequest) SetStyle(v WidgetStyle) { - o.Style = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HeatMapWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - if o.Style != nil { - toSerialize["style"] = o.Style - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - EventQuery *EventQueryDefinition `json:"event_query,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - Style *WidgetStyle `json:"style,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Style = all.Style - return nil -} diff --git a/api/v1/datadog/model_host.go b/api/v1/datadog/model_host.go deleted file mode 100644 index 23cbe9d6698..00000000000 --- a/api/v1/datadog/model_host.go +++ /dev/null @@ -1,623 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Host Object representing a host. -type Host struct { - // Host aliases collected by Datadog. - Aliases []string `json:"aliases,omitempty"` - // The Datadog integrations reporting metrics for the host. - Apps []string `json:"apps,omitempty"` - // AWS name of your host. - AwsName *string `json:"aws_name,omitempty"` - // The host name. - HostName *string `json:"host_name,omitempty"` - // The host ID. - Id *int64 `json:"id,omitempty"` - // If a host is muted or unmuted. - IsMuted *bool `json:"is_muted,omitempty"` - // Last time the host reported a metric data point. - LastReportedTime *int64 `json:"last_reported_time,omitempty"` - // Metadata associated with your host. - Meta *HostMeta `json:"meta,omitempty"` - // Host Metrics collected. - Metrics *HostMetrics `json:"metrics,omitempty"` - // Timeout of the mute applied to your host. - MuteTimeout *int64 `json:"mute_timeout,omitempty"` - // The host name. - Name *string `json:"name,omitempty"` - // Source or cloud provider associated with your host. - Sources []string `json:"sources,omitempty"` - // List of tags for each source (AWS, Datadog Agent, Chef..). - TagsBySource map[string][]string `json:"tags_by_source,omitempty"` - // Displays UP when the expected metrics are received and displays `???` if no metrics are received. - Up *bool `json:"up,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{} -} - -// NewHost instantiates a new Host 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 NewHost() *Host { - this := Host{} - return &this -} - -// NewHostWithDefaults instantiates a new Host 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 NewHostWithDefaults() *Host { - this := Host{} - return &this -} - -// GetAliases returns the Aliases field value if set, zero value otherwise. -func (o *Host) GetAliases() []string { - if o == nil || o.Aliases == nil { - var ret []string - return ret - } - return o.Aliases -} - -// GetAliasesOk returns a tuple with the Aliases field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetAliasesOk() (*[]string, bool) { - if o == nil || o.Aliases == nil { - return nil, false - } - return &o.Aliases, true -} - -// HasAliases returns a boolean if a field has been set. -func (o *Host) HasAliases() bool { - if o != nil && o.Aliases != nil { - return true - } - - return false -} - -// SetAliases gets a reference to the given []string and assigns it to the Aliases field. -func (o *Host) SetAliases(v []string) { - o.Aliases = v -} - -// GetApps returns the Apps field value if set, zero value otherwise. -func (o *Host) GetApps() []string { - if o == nil || o.Apps == nil { - var ret []string - return ret - } - return o.Apps -} - -// GetAppsOk returns a tuple with the Apps field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetAppsOk() (*[]string, bool) { - if o == nil || o.Apps == nil { - return nil, false - } - return &o.Apps, true -} - -// HasApps returns a boolean if a field has been set. -func (o *Host) HasApps() bool { - if o != nil && o.Apps != nil { - return true - } - - return false -} - -// SetApps gets a reference to the given []string and assigns it to the Apps field. -func (o *Host) SetApps(v []string) { - o.Apps = v -} - -// GetAwsName returns the AwsName field value if set, zero value otherwise. -func (o *Host) GetAwsName() string { - if o == nil || o.AwsName == nil { - var ret string - return ret - } - return *o.AwsName -} - -// GetAwsNameOk returns a tuple with the AwsName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetAwsNameOk() (*string, bool) { - if o == nil || o.AwsName == nil { - return nil, false - } - return o.AwsName, true -} - -// HasAwsName returns a boolean if a field has been set. -func (o *Host) HasAwsName() bool { - if o != nil && o.AwsName != nil { - return true - } - - return false -} - -// SetAwsName gets a reference to the given string and assigns it to the AwsName field. -func (o *Host) SetAwsName(v string) { - o.AwsName = &v -} - -// GetHostName returns the HostName field value if set, zero value otherwise. -func (o *Host) 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 *Host) 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 *Host) HasHostName() bool { - if o != nil && o.HostName != nil { - return true - } - - return false -} - -// SetHostName gets a reference to the given string and assigns it to the HostName field. -func (o *Host) SetHostName(v string) { - o.HostName = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Host) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Host) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *Host) SetId(v int64) { - o.Id = &v -} - -// GetIsMuted returns the IsMuted field value if set, zero value otherwise. -func (o *Host) GetIsMuted() bool { - if o == nil || o.IsMuted == nil { - var ret bool - return ret - } - return *o.IsMuted -} - -// GetIsMutedOk returns a tuple with the IsMuted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetIsMutedOk() (*bool, bool) { - if o == nil || o.IsMuted == nil { - return nil, false - } - return o.IsMuted, true -} - -// HasIsMuted returns a boolean if a field has been set. -func (o *Host) HasIsMuted() bool { - if o != nil && o.IsMuted != nil { - return true - } - - return false -} - -// SetIsMuted gets a reference to the given bool and assigns it to the IsMuted field. -func (o *Host) SetIsMuted(v bool) { - o.IsMuted = &v -} - -// GetLastReportedTime returns the LastReportedTime field value if set, zero value otherwise. -func (o *Host) GetLastReportedTime() int64 { - if o == nil || o.LastReportedTime == nil { - var ret int64 - return ret - } - return *o.LastReportedTime -} - -// GetLastReportedTimeOk returns a tuple with the LastReportedTime field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetLastReportedTimeOk() (*int64, bool) { - if o == nil || o.LastReportedTime == nil { - return nil, false - } - return o.LastReportedTime, true -} - -// HasLastReportedTime returns a boolean if a field has been set. -func (o *Host) HasLastReportedTime() bool { - if o != nil && o.LastReportedTime != nil { - return true - } - - return false -} - -// SetLastReportedTime gets a reference to the given int64 and assigns it to the LastReportedTime field. -func (o *Host) SetLastReportedTime(v int64) { - o.LastReportedTime = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *Host) GetMeta() HostMeta { - if o == nil || o.Meta == nil { - var ret HostMeta - 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 *Host) GetMetaOk() (*HostMeta, 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 *Host) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given HostMeta and assigns it to the Meta field. -func (o *Host) SetMeta(v HostMeta) { - o.Meta = &v -} - -// GetMetrics returns the Metrics field value if set, zero value otherwise. -func (o *Host) GetMetrics() HostMetrics { - if o == nil || o.Metrics == nil { - var ret HostMetrics - return ret - } - return *o.Metrics -} - -// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetMetricsOk() (*HostMetrics, bool) { - if o == nil || o.Metrics == nil { - return nil, false - } - return o.Metrics, true -} - -// HasMetrics returns a boolean if a field has been set. -func (o *Host) HasMetrics() bool { - if o != nil && o.Metrics != nil { - return true - } - - return false -} - -// SetMetrics gets a reference to the given HostMetrics and assigns it to the Metrics field. -func (o *Host) SetMetrics(v HostMetrics) { - o.Metrics = &v -} - -// GetMuteTimeout returns the MuteTimeout field value if set, zero value otherwise. -func (o *Host) GetMuteTimeout() int64 { - if o == nil || o.MuteTimeout == nil { - var ret int64 - return ret - } - return *o.MuteTimeout -} - -// GetMuteTimeoutOk returns a tuple with the MuteTimeout field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetMuteTimeoutOk() (*int64, bool) { - if o == nil || o.MuteTimeout == nil { - return nil, false - } - return o.MuteTimeout, true -} - -// HasMuteTimeout returns a boolean if a field has been set. -func (o *Host) HasMuteTimeout() bool { - if o != nil && o.MuteTimeout != nil { - return true - } - - return false -} - -// SetMuteTimeout gets a reference to the given int64 and assigns it to the MuteTimeout field. -func (o *Host) SetMuteTimeout(v int64) { - o.MuteTimeout = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *Host) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *Host) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *Host) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value if set, zero value otherwise. -func (o *Host) GetSources() []string { - if o == nil || o.Sources == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetSourcesOk() (*[]string, bool) { - if o == nil || o.Sources == nil { - return nil, false - } - return &o.Sources, true -} - -// HasSources returns a boolean if a field has been set. -func (o *Host) HasSources() bool { - if o != nil && o.Sources != nil { - return true - } - - return false -} - -// SetSources gets a reference to the given []string and assigns it to the Sources field. -func (o *Host) SetSources(v []string) { - o.Sources = v -} - -// GetTagsBySource returns the TagsBySource field value if set, zero value otherwise. -func (o *Host) GetTagsBySource() map[string][]string { - if o == nil || o.TagsBySource == nil { - var ret map[string][]string - return ret - } - return o.TagsBySource -} - -// GetTagsBySourceOk returns a tuple with the TagsBySource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetTagsBySourceOk() (*map[string][]string, bool) { - if o == nil || o.TagsBySource == nil { - return nil, false - } - return &o.TagsBySource, true -} - -// HasTagsBySource returns a boolean if a field has been set. -func (o *Host) HasTagsBySource() bool { - if o != nil && o.TagsBySource != nil { - return true - } - - return false -} - -// SetTagsBySource gets a reference to the given map[string][]string and assigns it to the TagsBySource field. -func (o *Host) SetTagsBySource(v map[string][]string) { - o.TagsBySource = v -} - -// GetUp returns the Up field value if set, zero value otherwise. -func (o *Host) GetUp() bool { - if o == nil || o.Up == nil { - var ret bool - return ret - } - return *o.Up -} - -// GetUpOk returns a tuple with the Up field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Host) GetUpOk() (*bool, bool) { - if o == nil || o.Up == nil { - return nil, false - } - return o.Up, true -} - -// HasUp returns a boolean if a field has been set. -func (o *Host) HasUp() bool { - if o != nil && o.Up != nil { - return true - } - - return false -} - -// SetUp gets a reference to the given bool and assigns it to the Up field. -func (o *Host) SetUp(v bool) { - o.Up = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Host) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aliases != nil { - toSerialize["aliases"] = o.Aliases - } - if o.Apps != nil { - toSerialize["apps"] = o.Apps - } - if o.AwsName != nil { - toSerialize["aws_name"] = o.AwsName - } - if o.HostName != nil { - toSerialize["host_name"] = o.HostName - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IsMuted != nil { - toSerialize["is_muted"] = o.IsMuted - } - if o.LastReportedTime != nil { - toSerialize["last_reported_time"] = o.LastReportedTime - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - if o.Metrics != nil { - toSerialize["metrics"] = o.Metrics - } - if o.MuteTimeout != nil { - toSerialize["mute_timeout"] = o.MuteTimeout - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Sources != nil { - toSerialize["sources"] = o.Sources - } - if o.TagsBySource != nil { - toSerialize["tags_by_source"] = o.TagsBySource - } - if o.Up != nil { - toSerialize["up"] = o.Up - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Host) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aliases []string `json:"aliases,omitempty"` - Apps []string `json:"apps,omitempty"` - AwsName *string `json:"aws_name,omitempty"` - HostName *string `json:"host_name,omitempty"` - Id *int64 `json:"id,omitempty"` - IsMuted *bool `json:"is_muted,omitempty"` - LastReportedTime *int64 `json:"last_reported_time,omitempty"` - Meta *HostMeta `json:"meta,omitempty"` - Metrics *HostMetrics `json:"metrics,omitempty"` - MuteTimeout *int64 `json:"mute_timeout,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources,omitempty"` - TagsBySource map[string][]string `json:"tags_by_source,omitempty"` - Up *bool `json:"up,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aliases = all.Aliases - o.Apps = all.Apps - o.AwsName = all.AwsName - o.HostName = all.HostName - o.Id = all.Id - o.IsMuted = all.IsMuted - o.LastReportedTime = all.LastReportedTime - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - if all.Metrics != nil && all.Metrics.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metrics = all.Metrics - o.MuteTimeout = all.MuteTimeout - o.Name = all.Name - o.Sources = all.Sources - o.TagsBySource = all.TagsBySource - o.Up = all.Up - return nil -} diff --git a/api/v1/datadog/model_host_list_response.go b/api/v1/datadog/model_host_list_response.go deleted file mode 100644 index e9d519c7e32..00000000000 --- a/api/v1/datadog/model_host_list_response.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostListResponse Response with Host information from Datadog. -type HostListResponse struct { - // Array of hosts. - HostList []Host `json:"host_list,omitempty"` - // Number of host matching the query. - TotalMatching *int64 `json:"total_matching,omitempty"` - // Number of host returned. - TotalReturned *int64 `json:"total_returned,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{} -} - -// NewHostListResponse instantiates a new HostListResponse 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 NewHostListResponse() *HostListResponse { - this := HostListResponse{} - return &this -} - -// NewHostListResponseWithDefaults instantiates a new HostListResponse 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 NewHostListResponseWithDefaults() *HostListResponse { - this := HostListResponse{} - return &this -} - -// GetHostList returns the HostList field value if set, zero value otherwise. -func (o *HostListResponse) GetHostList() []Host { - if o == nil || o.HostList == nil { - var ret []Host - return ret - } - return o.HostList -} - -// GetHostListOk returns a tuple with the HostList field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostListResponse) GetHostListOk() (*[]Host, bool) { - if o == nil || o.HostList == nil { - return nil, false - } - return &o.HostList, true -} - -// HasHostList returns a boolean if a field has been set. -func (o *HostListResponse) HasHostList() bool { - if o != nil && o.HostList != nil { - return true - } - - return false -} - -// SetHostList gets a reference to the given []Host and assigns it to the HostList field. -func (o *HostListResponse) SetHostList(v []Host) { - o.HostList = v -} - -// GetTotalMatching returns the TotalMatching field value if set, zero value otherwise. -func (o *HostListResponse) GetTotalMatching() int64 { - if o == nil || o.TotalMatching == nil { - var ret int64 - return ret - } - return *o.TotalMatching -} - -// GetTotalMatchingOk returns a tuple with the TotalMatching field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostListResponse) GetTotalMatchingOk() (*int64, bool) { - if o == nil || o.TotalMatching == nil { - return nil, false - } - return o.TotalMatching, true -} - -// HasTotalMatching returns a boolean if a field has been set. -func (o *HostListResponse) HasTotalMatching() bool { - if o != nil && o.TotalMatching != nil { - return true - } - - return false -} - -// SetTotalMatching gets a reference to the given int64 and assigns it to the TotalMatching field. -func (o *HostListResponse) SetTotalMatching(v int64) { - o.TotalMatching = &v -} - -// GetTotalReturned returns the TotalReturned field value if set, zero value otherwise. -func (o *HostListResponse) GetTotalReturned() int64 { - if o == nil || o.TotalReturned == nil { - var ret int64 - return ret - } - return *o.TotalReturned -} - -// GetTotalReturnedOk returns a tuple with the TotalReturned field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostListResponse) GetTotalReturnedOk() (*int64, bool) { - if o == nil || o.TotalReturned == nil { - return nil, false - } - return o.TotalReturned, true -} - -// HasTotalReturned returns a boolean if a field has been set. -func (o *HostListResponse) HasTotalReturned() bool { - if o != nil && o.TotalReturned != nil { - return true - } - - return false -} - -// SetTotalReturned gets a reference to the given int64 and assigns it to the TotalReturned field. -func (o *HostListResponse) SetTotalReturned(v int64) { - o.TotalReturned = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.HostList != nil { - toSerialize["host_list"] = o.HostList - } - if o.TotalMatching != nil { - toSerialize["total_matching"] = o.TotalMatching - } - if o.TotalReturned != nil { - toSerialize["total_returned"] = o.TotalReturned - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - HostList []Host `json:"host_list,omitempty"` - TotalMatching *int64 `json:"total_matching,omitempty"` - TotalReturned *int64 `json:"total_returned,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.HostList = all.HostList - o.TotalMatching = all.TotalMatching - o.TotalReturned = all.TotalReturned - return nil -} diff --git a/api/v1/datadog/model_host_map_request.go b/api/v1/datadog/model_host_map_request.go deleted file mode 100644 index 82dc1e20f34..00000000000 --- a/api/v1/datadog/model_host_map_request.go +++ /dev/null @@ -1,470 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMapRequest Updated host map. -type HostMapRequest struct { - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Query definition. - Q *string `json:"q,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,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{} -} - -// NewHostMapRequest instantiates a new HostMapRequest 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 NewHostMapRequest() *HostMapRequest { - this := HostMapRequest{} - return &this -} - -// NewHostMapRequestWithDefaults instantiates a new HostMapRequest 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 NewHostMapRequestWithDefaults() *HostMapRequest { - this := HostMapRequest{} - return &this -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *HostMapRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *HostMapRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *HostMapRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *HostMapRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *HostMapRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *HostMapRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *HostMapRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *HostMapRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *HostMapRequest) SetQ(v string) { - o.Q = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *HostMapRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *HostMapRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *HostMapRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *HostMapRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMapRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMapRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - return nil -} diff --git a/api/v1/datadog/model_host_map_widget_definition.go b/api/v1/datadog/model_host_map_widget_definition.go deleted file mode 100644 index 26e0a39ea79..00000000000 --- a/api/v1/datadog/model_host_map_widget_definition.go +++ /dev/null @@ -1,605 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HostMapWidgetDefinition The host map widget graphs any metric across your hosts using the same visualization available from the main Host Map page. -type HostMapWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // List of tag prefixes to group by. - Group []string `json:"group,omitempty"` - // Whether to show the hosts that don’t fit in a group. - NoGroupHosts *bool `json:"no_group_hosts,omitempty"` - // Whether to show the hosts with no metrics. - NoMetricHosts *bool `json:"no_metric_hosts,omitempty"` - // Which type of node to use in the map. - NodeType *WidgetNodeType `json:"node_type,omitempty"` - // Notes on the title. - Notes *string `json:"notes,omitempty"` - // List of definitions. - Requests HostMapWidgetDefinitionRequests `json:"requests"` - // List of tags used to filter the map. - Scope []string `json:"scope,omitempty"` - // The style to apply to the widget. - Style *HostMapWidgetDefinitionStyle `json:"style,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the host map widget. - Type HostMapWidgetDefinitionType `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{} -} - -// NewHostMapWidgetDefinition instantiates a new HostMapWidgetDefinition 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 NewHostMapWidgetDefinition(requests HostMapWidgetDefinitionRequests, typeVar HostMapWidgetDefinitionType) *HostMapWidgetDefinition { - this := HostMapWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewHostMapWidgetDefinitionWithDefaults instantiates a new HostMapWidgetDefinition 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 NewHostMapWidgetDefinitionWithDefaults() *HostMapWidgetDefinition { - this := HostMapWidgetDefinition{} - var typeVar HostMapWidgetDefinitionType = HOSTMAPWIDGETDEFINITIONTYPE_HOSTMAP - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *HostMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetGroup returns the Group field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetGroup() []string { - if o == nil || o.Group == nil { - var ret []string - return ret - } - return o.Group -} - -// GetGroupOk returns a tuple with the Group field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetGroupOk() (*[]string, bool) { - if o == nil || o.Group == nil { - return nil, false - } - return &o.Group, true -} - -// HasGroup returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasGroup() bool { - if o != nil && o.Group != nil { - return true - } - - return false -} - -// SetGroup gets a reference to the given []string and assigns it to the Group field. -func (o *HostMapWidgetDefinition) SetGroup(v []string) { - o.Group = v -} - -// GetNoGroupHosts returns the NoGroupHosts field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetNoGroupHosts() bool { - if o == nil || o.NoGroupHosts == nil { - var ret bool - return ret - } - return *o.NoGroupHosts -} - -// GetNoGroupHostsOk returns a tuple with the NoGroupHosts field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetNoGroupHostsOk() (*bool, bool) { - if o == nil || o.NoGroupHosts == nil { - return nil, false - } - return o.NoGroupHosts, true -} - -// HasNoGroupHosts returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasNoGroupHosts() bool { - if o != nil && o.NoGroupHosts != nil { - return true - } - - return false -} - -// SetNoGroupHosts gets a reference to the given bool and assigns it to the NoGroupHosts field. -func (o *HostMapWidgetDefinition) SetNoGroupHosts(v bool) { - o.NoGroupHosts = &v -} - -// GetNoMetricHosts returns the NoMetricHosts field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetNoMetricHosts() bool { - if o == nil || o.NoMetricHosts == nil { - var ret bool - return ret - } - return *o.NoMetricHosts -} - -// GetNoMetricHostsOk returns a tuple with the NoMetricHosts field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetNoMetricHostsOk() (*bool, bool) { - if o == nil || o.NoMetricHosts == nil { - return nil, false - } - return o.NoMetricHosts, true -} - -// HasNoMetricHosts returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasNoMetricHosts() bool { - if o != nil && o.NoMetricHosts != nil { - return true - } - - return false -} - -// SetNoMetricHosts gets a reference to the given bool and assigns it to the NoMetricHosts field. -func (o *HostMapWidgetDefinition) SetNoMetricHosts(v bool) { - o.NoMetricHosts = &v -} - -// GetNodeType returns the NodeType field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetNodeType() WidgetNodeType { - if o == nil || o.NodeType == nil { - var ret WidgetNodeType - return ret - } - return *o.NodeType -} - -// GetNodeTypeOk returns a tuple with the NodeType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetNodeTypeOk() (*WidgetNodeType, bool) { - if o == nil || o.NodeType == nil { - return nil, false - } - return o.NodeType, true -} - -// HasNodeType returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasNodeType() bool { - if o != nil && o.NodeType != nil { - return true - } - - return false -} - -// SetNodeType gets a reference to the given WidgetNodeType and assigns it to the NodeType field. -func (o *HostMapWidgetDefinition) SetNodeType(v WidgetNodeType) { - o.NodeType = &v -} - -// GetNotes returns the Notes field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetNotes() string { - if o == nil || o.Notes == nil { - var ret string - return ret - } - return *o.Notes -} - -// GetNotesOk returns a tuple with the Notes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetNotesOk() (*string, bool) { - if o == nil || o.Notes == nil { - return nil, false - } - return o.Notes, true -} - -// HasNotes returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasNotes() bool { - if o != nil && o.Notes != nil { - return true - } - - return false -} - -// SetNotes gets a reference to the given string and assigns it to the Notes field. -func (o *HostMapWidgetDefinition) SetNotes(v string) { - o.Notes = &v -} - -// GetRequests returns the Requests field value. -func (o *HostMapWidgetDefinition) GetRequests() HostMapWidgetDefinitionRequests { - if o == nil { - var ret HostMapWidgetDefinitionRequests - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetRequestsOk() (*HostMapWidgetDefinitionRequests, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *HostMapWidgetDefinition) SetRequests(v HostMapWidgetDefinitionRequests) { - o.Requests = v -} - -// GetScope returns the Scope field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetScope() []string { - if o == nil || o.Scope == nil { - var ret []string - return ret - } - return o.Scope -} - -// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetScopeOk() (*[]string, bool) { - if o == nil || o.Scope == nil { - return nil, false - } - return &o.Scope, true -} - -// HasScope returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasScope() bool { - if o != nil && o.Scope != nil { - return true - } - - return false -} - -// SetScope gets a reference to the given []string and assigns it to the Scope field. -func (o *HostMapWidgetDefinition) SetScope(v []string) { - o.Scope = v -} - -// GetStyle returns the Style field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetStyle() HostMapWidgetDefinitionStyle { - if o == nil || o.Style == nil { - var ret HostMapWidgetDefinitionStyle - return ret - } - return *o.Style -} - -// GetStyleOk returns a tuple with the Style field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetStyleOk() (*HostMapWidgetDefinitionStyle, bool) { - if o == nil || o.Style == nil { - return nil, false - } - return o.Style, true -} - -// HasStyle returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasStyle() bool { - if o != nil && o.Style != nil { - return true - } - - return false -} - -// SetStyle gets a reference to the given HostMapWidgetDefinitionStyle and assigns it to the Style field. -func (o *HostMapWidgetDefinition) SetStyle(v HostMapWidgetDefinitionStyle) { - o.Style = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *HostMapWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *HostMapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *HostMapWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *HostMapWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *HostMapWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *HostMapWidgetDefinition) GetType() HostMapWidgetDefinitionType { - if o == nil { - var ret HostMapWidgetDefinitionType - 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 *HostMapWidgetDefinition) GetTypeOk() (*HostMapWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *HostMapWidgetDefinition) SetType(v HostMapWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMapWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - if o.Group != nil { - toSerialize["group"] = o.Group - } - if o.NoGroupHosts != nil { - toSerialize["no_group_hosts"] = o.NoGroupHosts - } - if o.NoMetricHosts != nil { - toSerialize["no_metric_hosts"] = o.NoMetricHosts - } - if o.NodeType != nil { - toSerialize["node_type"] = o.NodeType - } - if o.Notes != nil { - toSerialize["notes"] = o.Notes - } - toSerialize["requests"] = o.Requests - if o.Scope != nil { - toSerialize["scope"] = o.Scope - } - if o.Style != nil { - toSerialize["style"] = o.Style - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *HostMapWidgetDefinitionRequests `json:"requests"` - Type *HostMapWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Group []string `json:"group,omitempty"` - NoGroupHosts *bool `json:"no_group_hosts,omitempty"` - NoMetricHosts *bool `json:"no_metric_hosts,omitempty"` - NodeType *WidgetNodeType `json:"node_type,omitempty"` - Notes *string `json:"notes,omitempty"` - Requests HostMapWidgetDefinitionRequests `json:"requests"` - Scope []string `json:"scope,omitempty"` - Style *HostMapWidgetDefinitionStyle `json:"style,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type HostMapWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.NodeType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.Group = all.Group - o.NoGroupHosts = all.NoGroupHosts - o.NoMetricHosts = all.NoMetricHosts - o.NodeType = all.NodeType - o.Notes = all.Notes - if all.Requests.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Requests = all.Requests - o.Scope = all.Scope - if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Style = all.Style - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_host_map_widget_definition_requests.go b/api/v1/datadog/model_host_map_widget_definition_requests.go deleted file mode 100644 index a8c07bb067d..00000000000 --- a/api/v1/datadog/model_host_map_widget_definition_requests.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMapWidgetDefinitionRequests List of definitions. -type HostMapWidgetDefinitionRequests struct { - // Updated host map. - Fill *HostMapRequest `json:"fill,omitempty"` - // Updated host map. - Size *HostMapRequest `json:"size,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{} -} - -// NewHostMapWidgetDefinitionRequests instantiates a new HostMapWidgetDefinitionRequests 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 NewHostMapWidgetDefinitionRequests() *HostMapWidgetDefinitionRequests { - this := HostMapWidgetDefinitionRequests{} - return &this -} - -// NewHostMapWidgetDefinitionRequestsWithDefaults instantiates a new HostMapWidgetDefinitionRequests 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 NewHostMapWidgetDefinitionRequestsWithDefaults() *HostMapWidgetDefinitionRequests { - this := HostMapWidgetDefinitionRequests{} - return &this -} - -// GetFill returns the Fill field value if set, zero value otherwise. -func (o *HostMapWidgetDefinitionRequests) GetFill() HostMapRequest { - if o == nil || o.Fill == nil { - var ret HostMapRequest - return ret - } - return *o.Fill -} - -// GetFillOk returns a tuple with the Fill field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinitionRequests) GetFillOk() (*HostMapRequest, bool) { - if o == nil || o.Fill == nil { - return nil, false - } - return o.Fill, true -} - -// HasFill returns a boolean if a field has been set. -func (o *HostMapWidgetDefinitionRequests) HasFill() bool { - if o != nil && o.Fill != nil { - return true - } - - return false -} - -// SetFill gets a reference to the given HostMapRequest and assigns it to the Fill field. -func (o *HostMapWidgetDefinitionRequests) SetFill(v HostMapRequest) { - o.Fill = &v -} - -// GetSize returns the Size field value if set, zero value otherwise. -func (o *HostMapWidgetDefinitionRequests) GetSize() HostMapRequest { - if o == nil || o.Size == nil { - var ret HostMapRequest - return ret - } - return *o.Size -} - -// GetSizeOk returns a tuple with the Size field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinitionRequests) GetSizeOk() (*HostMapRequest, bool) { - if o == nil || o.Size == nil { - return nil, false - } - return o.Size, true -} - -// HasSize returns a boolean if a field has been set. -func (o *HostMapWidgetDefinitionRequests) HasSize() bool { - if o != nil && o.Size != nil { - return true - } - - return false -} - -// SetSize gets a reference to the given HostMapRequest and assigns it to the Size field. -func (o *HostMapWidgetDefinitionRequests) SetSize(v HostMapRequest) { - o.Size = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMapWidgetDefinitionRequests) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Fill != nil { - toSerialize["fill"] = o.Fill - } - if o.Size != nil { - toSerialize["size"] = o.Size - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMapWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Fill *HostMapRequest `json:"fill,omitempty"` - Size *HostMapRequest `json:"size,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Fill != nil && all.Fill.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Fill = all.Fill - if all.Size != nil && all.Size.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Size = all.Size - return nil -} diff --git a/api/v1/datadog/model_host_map_widget_definition_style.go b/api/v1/datadog/model_host_map_widget_definition_style.go deleted file mode 100644 index 9264369786b..00000000000 --- a/api/v1/datadog/model_host_map_widget_definition_style.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMapWidgetDefinitionStyle The style to apply to the widget. -type HostMapWidgetDefinitionStyle struct { - // Max value to use to color the map. - FillMax *string `json:"fill_max,omitempty"` - // Min value to use to color the map. - FillMin *string `json:"fill_min,omitempty"` - // Color palette to apply to the widget. - Palette *string `json:"palette,omitempty"` - // Whether to flip the palette tones. - PaletteFlip *bool `json:"palette_flip,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{} -} - -// NewHostMapWidgetDefinitionStyle instantiates a new HostMapWidgetDefinitionStyle 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 NewHostMapWidgetDefinitionStyle() *HostMapWidgetDefinitionStyle { - this := HostMapWidgetDefinitionStyle{} - return &this -} - -// NewHostMapWidgetDefinitionStyleWithDefaults instantiates a new HostMapWidgetDefinitionStyle 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 NewHostMapWidgetDefinitionStyleWithDefaults() *HostMapWidgetDefinitionStyle { - this := HostMapWidgetDefinitionStyle{} - return &this -} - -// GetFillMax returns the FillMax field value if set, zero value otherwise. -func (o *HostMapWidgetDefinitionStyle) GetFillMax() string { - if o == nil || o.FillMax == nil { - var ret string - return ret - } - return *o.FillMax -} - -// GetFillMaxOk returns a tuple with the FillMax field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinitionStyle) GetFillMaxOk() (*string, bool) { - if o == nil || o.FillMax == nil { - return nil, false - } - return o.FillMax, true -} - -// HasFillMax returns a boolean if a field has been set. -func (o *HostMapWidgetDefinitionStyle) HasFillMax() bool { - if o != nil && o.FillMax != nil { - return true - } - - return false -} - -// SetFillMax gets a reference to the given string and assigns it to the FillMax field. -func (o *HostMapWidgetDefinitionStyle) SetFillMax(v string) { - o.FillMax = &v -} - -// GetFillMin returns the FillMin field value if set, zero value otherwise. -func (o *HostMapWidgetDefinitionStyle) GetFillMin() string { - if o == nil || o.FillMin == nil { - var ret string - return ret - } - return *o.FillMin -} - -// GetFillMinOk returns a tuple with the FillMin field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinitionStyle) GetFillMinOk() (*string, bool) { - if o == nil || o.FillMin == nil { - return nil, false - } - return o.FillMin, true -} - -// HasFillMin returns a boolean if a field has been set. -func (o *HostMapWidgetDefinitionStyle) HasFillMin() bool { - if o != nil && o.FillMin != nil { - return true - } - - return false -} - -// SetFillMin gets a reference to the given string and assigns it to the FillMin field. -func (o *HostMapWidgetDefinitionStyle) SetFillMin(v string) { - o.FillMin = &v -} - -// GetPalette returns the Palette field value if set, zero value otherwise. -func (o *HostMapWidgetDefinitionStyle) GetPalette() string { - if o == nil || o.Palette == nil { - var ret string - return ret - } - return *o.Palette -} - -// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinitionStyle) GetPaletteOk() (*string, bool) { - if o == nil || o.Palette == nil { - return nil, false - } - return o.Palette, true -} - -// HasPalette returns a boolean if a field has been set. -func (o *HostMapWidgetDefinitionStyle) HasPalette() bool { - if o != nil && o.Palette != nil { - return true - } - - return false -} - -// SetPalette gets a reference to the given string and assigns it to the Palette field. -func (o *HostMapWidgetDefinitionStyle) SetPalette(v string) { - o.Palette = &v -} - -// GetPaletteFlip returns the PaletteFlip field value if set, zero value otherwise. -func (o *HostMapWidgetDefinitionStyle) GetPaletteFlip() bool { - if o == nil || o.PaletteFlip == nil { - var ret bool - return ret - } - return *o.PaletteFlip -} - -// GetPaletteFlipOk returns a tuple with the PaletteFlip field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMapWidgetDefinitionStyle) GetPaletteFlipOk() (*bool, bool) { - if o == nil || o.PaletteFlip == nil { - return nil, false - } - return o.PaletteFlip, true -} - -// HasPaletteFlip returns a boolean if a field has been set. -func (o *HostMapWidgetDefinitionStyle) HasPaletteFlip() bool { - if o != nil && o.PaletteFlip != nil { - return true - } - - return false -} - -// SetPaletteFlip gets a reference to the given bool and assigns it to the PaletteFlip field. -func (o *HostMapWidgetDefinitionStyle) SetPaletteFlip(v bool) { - o.PaletteFlip = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMapWidgetDefinitionStyle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.FillMax != nil { - toSerialize["fill_max"] = o.FillMax - } - if o.FillMin != nil { - toSerialize["fill_min"] = o.FillMin - } - if o.Palette != nil { - toSerialize["palette"] = o.Palette - } - if o.PaletteFlip != nil { - toSerialize["palette_flip"] = o.PaletteFlip - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - FillMax *string `json:"fill_max,omitempty"` - FillMin *string `json:"fill_min,omitempty"` - Palette *string `json:"palette,omitempty"` - PaletteFlip *bool `json:"palette_flip,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.FillMax = all.FillMax - o.FillMin = all.FillMin - o.Palette = all.Palette - o.PaletteFlip = all.PaletteFlip - return nil -} diff --git a/api/v1/datadog/model_host_map_widget_definition_type.go b/api/v1/datadog/model_host_map_widget_definition_type.go deleted file mode 100644 index 16e9b86274c..00000000000 --- a/api/v1/datadog/model_host_map_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HostMapWidgetDefinitionType Type of the host map widget. -type HostMapWidgetDefinitionType string - -// List of HostMapWidgetDefinitionType. -const ( - HOSTMAPWIDGETDEFINITIONTYPE_HOSTMAP HostMapWidgetDefinitionType = "hostmap" -) - -var allowedHostMapWidgetDefinitionTypeEnumValues = []HostMapWidgetDefinitionType{ - HOSTMAPWIDGETDEFINITIONTYPE_HOSTMAP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *HostMapWidgetDefinitionType) GetAllowedValues() []HostMapWidgetDefinitionType { - return allowedHostMapWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *HostMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = HostMapWidgetDefinitionType(value) - return nil -} - -// NewHostMapWidgetDefinitionTypeFromValue returns a pointer to a valid HostMapWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewHostMapWidgetDefinitionTypeFromValue(v string) (*HostMapWidgetDefinitionType, error) { - ev := HostMapWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for HostMapWidgetDefinitionType: valid values are %v", v, allowedHostMapWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v HostMapWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedHostMapWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to HostMapWidgetDefinitionType value. -func (v HostMapWidgetDefinitionType) Ptr() *HostMapWidgetDefinitionType { - return &v -} - -// NullableHostMapWidgetDefinitionType handles when a null is used for HostMapWidgetDefinitionType. -type NullableHostMapWidgetDefinitionType struct { - value *HostMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableHostMapWidgetDefinitionType) Get() *HostMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHostMapWidgetDefinitionType) Set(val *HostMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHostMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHostMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHostMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableHostMapWidgetDefinitionType(val *HostMapWidgetDefinitionType) *NullableHostMapWidgetDefinitionType { - return &NullableHostMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHostMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHostMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_host_meta.go b/api/v1/datadog/model_host_meta.go deleted file mode 100644 index bc5dd55e269..00000000000 --- a/api/v1/datadog/model_host_meta.go +++ /dev/null @@ -1,655 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMeta Metadata associated with your host. -type HostMeta struct { - // A list of Agent checks running on the host. - AgentChecks [][]interface{} `json:"agent_checks,omitempty"` - // The Datadog Agent version. - AgentVersion *string `json:"agent_version,omitempty"` - // The number of cores. - CpuCores *int64 `json:"cpuCores,omitempty"` - // An array of Mac versions. - FbsdV []string `json:"fbsdV,omitempty"` - // JSON string containing system information. - Gohai *string `json:"gohai,omitempty"` - // Agent install method. - InstallMethod *HostMetaInstallMethod `json:"install_method,omitempty"` - // An array of Mac versions. - MacV []string `json:"macV,omitempty"` - // The machine architecture. - Machine *string `json:"machine,omitempty"` - // Array of Unix versions. - NixV []string `json:"nixV,omitempty"` - // The OS platform. - Platform *string `json:"platform,omitempty"` - // The processor. - Processor *string `json:"processor,omitempty"` - // The Python version. - PythonV *string `json:"pythonV,omitempty"` - // The socket fqdn. - SocketFqdn *string `json:"socket-fqdn,omitempty"` - // The socket hostname. - SocketHostname *string `json:"socket-hostname,omitempty"` - // An array of Windows versions. - WinV []string `json:"winV,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{} -} - -// NewHostMeta instantiates a new HostMeta 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 NewHostMeta() *HostMeta { - this := HostMeta{} - return &this -} - -// NewHostMetaWithDefaults instantiates a new HostMeta 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 NewHostMetaWithDefaults() *HostMeta { - this := HostMeta{} - return &this -} - -// GetAgentChecks returns the AgentChecks field value if set, zero value otherwise. -func (o *HostMeta) GetAgentChecks() [][]interface{} { - if o == nil || o.AgentChecks == nil { - var ret [][]interface{} - return ret - } - return o.AgentChecks -} - -// GetAgentChecksOk returns a tuple with the AgentChecks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetAgentChecksOk() (*[][]interface{}, bool) { - if o == nil || o.AgentChecks == nil { - return nil, false - } - return &o.AgentChecks, true -} - -// HasAgentChecks returns a boolean if a field has been set. -func (o *HostMeta) HasAgentChecks() bool { - if o != nil && o.AgentChecks != nil { - return true - } - - return false -} - -// SetAgentChecks gets a reference to the given [][]interface{} and assigns it to the AgentChecks field. -func (o *HostMeta) SetAgentChecks(v [][]interface{}) { - o.AgentChecks = v -} - -// GetAgentVersion returns the AgentVersion field value if set, zero value otherwise. -func (o *HostMeta) GetAgentVersion() string { - if o == nil || o.AgentVersion == nil { - var ret string - return ret - } - return *o.AgentVersion -} - -// GetAgentVersionOk returns a tuple with the AgentVersion field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetAgentVersionOk() (*string, bool) { - if o == nil || o.AgentVersion == nil { - return nil, false - } - return o.AgentVersion, true -} - -// HasAgentVersion returns a boolean if a field has been set. -func (o *HostMeta) HasAgentVersion() bool { - if o != nil && o.AgentVersion != nil { - return true - } - - return false -} - -// SetAgentVersion gets a reference to the given string and assigns it to the AgentVersion field. -func (o *HostMeta) SetAgentVersion(v string) { - o.AgentVersion = &v -} - -// GetCpuCores returns the CpuCores field value if set, zero value otherwise. -func (o *HostMeta) GetCpuCores() int64 { - if o == nil || o.CpuCores == nil { - var ret int64 - return ret - } - return *o.CpuCores -} - -// GetCpuCoresOk returns a tuple with the CpuCores field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetCpuCoresOk() (*int64, bool) { - if o == nil || o.CpuCores == nil { - return nil, false - } - return o.CpuCores, true -} - -// HasCpuCores returns a boolean if a field has been set. -func (o *HostMeta) HasCpuCores() bool { - if o != nil && o.CpuCores != nil { - return true - } - - return false -} - -// SetCpuCores gets a reference to the given int64 and assigns it to the CpuCores field. -func (o *HostMeta) SetCpuCores(v int64) { - o.CpuCores = &v -} - -// GetFbsdV returns the FbsdV field value if set, zero value otherwise. -func (o *HostMeta) GetFbsdV() []string { - if o == nil || o.FbsdV == nil { - var ret []string - return ret - } - return o.FbsdV -} - -// GetFbsdVOk returns a tuple with the FbsdV field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetFbsdVOk() (*[]string, bool) { - if o == nil || o.FbsdV == nil { - return nil, false - } - return &o.FbsdV, true -} - -// HasFbsdV returns a boolean if a field has been set. -func (o *HostMeta) HasFbsdV() bool { - if o != nil && o.FbsdV != nil { - return true - } - - return false -} - -// SetFbsdV gets a reference to the given []string and assigns it to the FbsdV field. -func (o *HostMeta) SetFbsdV(v []string) { - o.FbsdV = v -} - -// GetGohai returns the Gohai field value if set, zero value otherwise. -func (o *HostMeta) GetGohai() string { - if o == nil || o.Gohai == nil { - var ret string - return ret - } - return *o.Gohai -} - -// GetGohaiOk returns a tuple with the Gohai field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetGohaiOk() (*string, bool) { - if o == nil || o.Gohai == nil { - return nil, false - } - return o.Gohai, true -} - -// HasGohai returns a boolean if a field has been set. -func (o *HostMeta) HasGohai() bool { - if o != nil && o.Gohai != nil { - return true - } - - return false -} - -// SetGohai gets a reference to the given string and assigns it to the Gohai field. -func (o *HostMeta) SetGohai(v string) { - o.Gohai = &v -} - -// GetInstallMethod returns the InstallMethod field value if set, zero value otherwise. -func (o *HostMeta) GetInstallMethod() HostMetaInstallMethod { - if o == nil || o.InstallMethod == nil { - var ret HostMetaInstallMethod - return ret - } - return *o.InstallMethod -} - -// GetInstallMethodOk returns a tuple with the InstallMethod field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetInstallMethodOk() (*HostMetaInstallMethod, bool) { - if o == nil || o.InstallMethod == nil { - return nil, false - } - return o.InstallMethod, true -} - -// HasInstallMethod returns a boolean if a field has been set. -func (o *HostMeta) HasInstallMethod() bool { - if o != nil && o.InstallMethod != nil { - return true - } - - return false -} - -// SetInstallMethod gets a reference to the given HostMetaInstallMethod and assigns it to the InstallMethod field. -func (o *HostMeta) SetInstallMethod(v HostMetaInstallMethod) { - o.InstallMethod = &v -} - -// GetMacV returns the MacV field value if set, zero value otherwise. -func (o *HostMeta) GetMacV() []string { - if o == nil || o.MacV == nil { - var ret []string - return ret - } - return o.MacV -} - -// GetMacVOk returns a tuple with the MacV field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetMacVOk() (*[]string, bool) { - if o == nil || o.MacV == nil { - return nil, false - } - return &o.MacV, true -} - -// HasMacV returns a boolean if a field has been set. -func (o *HostMeta) HasMacV() bool { - if o != nil && o.MacV != nil { - return true - } - - return false -} - -// SetMacV gets a reference to the given []string and assigns it to the MacV field. -func (o *HostMeta) SetMacV(v []string) { - o.MacV = v -} - -// GetMachine returns the Machine field value if set, zero value otherwise. -func (o *HostMeta) GetMachine() string { - if o == nil || o.Machine == nil { - var ret string - return ret - } - return *o.Machine -} - -// GetMachineOk returns a tuple with the Machine field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetMachineOk() (*string, bool) { - if o == nil || o.Machine == nil { - return nil, false - } - return o.Machine, true -} - -// HasMachine returns a boolean if a field has been set. -func (o *HostMeta) HasMachine() bool { - if o != nil && o.Machine != nil { - return true - } - - return false -} - -// SetMachine gets a reference to the given string and assigns it to the Machine field. -func (o *HostMeta) SetMachine(v string) { - o.Machine = &v -} - -// GetNixV returns the NixV field value if set, zero value otherwise. -func (o *HostMeta) GetNixV() []string { - if o == nil || o.NixV == nil { - var ret []string - return ret - } - return o.NixV -} - -// GetNixVOk returns a tuple with the NixV field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetNixVOk() (*[]string, bool) { - if o == nil || o.NixV == nil { - return nil, false - } - return &o.NixV, true -} - -// HasNixV returns a boolean if a field has been set. -func (o *HostMeta) HasNixV() bool { - if o != nil && o.NixV != nil { - return true - } - - return false -} - -// SetNixV gets a reference to the given []string and assigns it to the NixV field. -func (o *HostMeta) SetNixV(v []string) { - o.NixV = v -} - -// GetPlatform returns the Platform field value if set, zero value otherwise. -func (o *HostMeta) GetPlatform() string { - if o == nil || o.Platform == nil { - var ret string - return ret - } - return *o.Platform -} - -// GetPlatformOk returns a tuple with the Platform field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetPlatformOk() (*string, bool) { - if o == nil || o.Platform == nil { - return nil, false - } - return o.Platform, true -} - -// HasPlatform returns a boolean if a field has been set. -func (o *HostMeta) HasPlatform() bool { - if o != nil && o.Platform != nil { - return true - } - - return false -} - -// SetPlatform gets a reference to the given string and assigns it to the Platform field. -func (o *HostMeta) SetPlatform(v string) { - o.Platform = &v -} - -// GetProcessor returns the Processor field value if set, zero value otherwise. -func (o *HostMeta) GetProcessor() string { - if o == nil || o.Processor == nil { - var ret string - return ret - } - return *o.Processor -} - -// GetProcessorOk returns a tuple with the Processor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetProcessorOk() (*string, bool) { - if o == nil || o.Processor == nil { - return nil, false - } - return o.Processor, true -} - -// HasProcessor returns a boolean if a field has been set. -func (o *HostMeta) HasProcessor() bool { - if o != nil && o.Processor != nil { - return true - } - - return false -} - -// SetProcessor gets a reference to the given string and assigns it to the Processor field. -func (o *HostMeta) SetProcessor(v string) { - o.Processor = &v -} - -// GetPythonV returns the PythonV field value if set, zero value otherwise. -func (o *HostMeta) GetPythonV() string { - if o == nil || o.PythonV == nil { - var ret string - return ret - } - return *o.PythonV -} - -// GetPythonVOk returns a tuple with the PythonV field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetPythonVOk() (*string, bool) { - if o == nil || o.PythonV == nil { - return nil, false - } - return o.PythonV, true -} - -// HasPythonV returns a boolean if a field has been set. -func (o *HostMeta) HasPythonV() bool { - if o != nil && o.PythonV != nil { - return true - } - - return false -} - -// SetPythonV gets a reference to the given string and assigns it to the PythonV field. -func (o *HostMeta) SetPythonV(v string) { - o.PythonV = &v -} - -// GetSocketFqdn returns the SocketFqdn field value if set, zero value otherwise. -func (o *HostMeta) GetSocketFqdn() string { - if o == nil || o.SocketFqdn == nil { - var ret string - return ret - } - return *o.SocketFqdn -} - -// GetSocketFqdnOk returns a tuple with the SocketFqdn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetSocketFqdnOk() (*string, bool) { - if o == nil || o.SocketFqdn == nil { - return nil, false - } - return o.SocketFqdn, true -} - -// HasSocketFqdn returns a boolean if a field has been set. -func (o *HostMeta) HasSocketFqdn() bool { - if o != nil && o.SocketFqdn != nil { - return true - } - - return false -} - -// SetSocketFqdn gets a reference to the given string and assigns it to the SocketFqdn field. -func (o *HostMeta) SetSocketFqdn(v string) { - o.SocketFqdn = &v -} - -// GetSocketHostname returns the SocketHostname field value if set, zero value otherwise. -func (o *HostMeta) GetSocketHostname() string { - if o == nil || o.SocketHostname == nil { - var ret string - return ret - } - return *o.SocketHostname -} - -// GetSocketHostnameOk returns a tuple with the SocketHostname field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetSocketHostnameOk() (*string, bool) { - if o == nil || o.SocketHostname == nil { - return nil, false - } - return o.SocketHostname, true -} - -// HasSocketHostname returns a boolean if a field has been set. -func (o *HostMeta) HasSocketHostname() bool { - if o != nil && o.SocketHostname != nil { - return true - } - - return false -} - -// SetSocketHostname gets a reference to the given string and assigns it to the SocketHostname field. -func (o *HostMeta) SetSocketHostname(v string) { - o.SocketHostname = &v -} - -// GetWinV returns the WinV field value if set, zero value otherwise. -func (o *HostMeta) GetWinV() []string { - if o == nil || o.WinV == nil { - var ret []string - return ret - } - return o.WinV -} - -// GetWinVOk returns a tuple with the WinV field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMeta) GetWinVOk() (*[]string, bool) { - if o == nil || o.WinV == nil { - return nil, false - } - return &o.WinV, true -} - -// HasWinV returns a boolean if a field has been set. -func (o *HostMeta) HasWinV() bool { - if o != nil && o.WinV != nil { - return true - } - - return false -} - -// SetWinV gets a reference to the given []string and assigns it to the WinV field. -func (o *HostMeta) SetWinV(v []string) { - o.WinV = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AgentChecks != nil { - toSerialize["agent_checks"] = o.AgentChecks - } - if o.AgentVersion != nil { - toSerialize["agent_version"] = o.AgentVersion - } - if o.CpuCores != nil { - toSerialize["cpuCores"] = o.CpuCores - } - if o.FbsdV != nil { - toSerialize["fbsdV"] = o.FbsdV - } - if o.Gohai != nil { - toSerialize["gohai"] = o.Gohai - } - if o.InstallMethod != nil { - toSerialize["install_method"] = o.InstallMethod - } - if o.MacV != nil { - toSerialize["macV"] = o.MacV - } - if o.Machine != nil { - toSerialize["machine"] = o.Machine - } - if o.NixV != nil { - toSerialize["nixV"] = o.NixV - } - if o.Platform != nil { - toSerialize["platform"] = o.Platform - } - if o.Processor != nil { - toSerialize["processor"] = o.Processor - } - if o.PythonV != nil { - toSerialize["pythonV"] = o.PythonV - } - if o.SocketFqdn != nil { - toSerialize["socket-fqdn"] = o.SocketFqdn - } - if o.SocketHostname != nil { - toSerialize["socket-hostname"] = o.SocketHostname - } - if o.WinV != nil { - toSerialize["winV"] = o.WinV - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AgentChecks [][]interface{} `json:"agent_checks,omitempty"` - AgentVersion *string `json:"agent_version,omitempty"` - CpuCores *int64 `json:"cpuCores,omitempty"` - FbsdV []string `json:"fbsdV,omitempty"` - Gohai *string `json:"gohai,omitempty"` - InstallMethod *HostMetaInstallMethod `json:"install_method,omitempty"` - MacV []string `json:"macV,omitempty"` - Machine *string `json:"machine,omitempty"` - NixV []string `json:"nixV,omitempty"` - Platform *string `json:"platform,omitempty"` - Processor *string `json:"processor,omitempty"` - PythonV *string `json:"pythonV,omitempty"` - SocketFqdn *string `json:"socket-fqdn,omitempty"` - SocketHostname *string `json:"socket-hostname,omitempty"` - WinV []string `json:"winV,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AgentChecks = all.AgentChecks - o.AgentVersion = all.AgentVersion - o.CpuCores = all.CpuCores - o.FbsdV = all.FbsdV - o.Gohai = all.Gohai - if all.InstallMethod != nil && all.InstallMethod.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.InstallMethod = all.InstallMethod - o.MacV = all.MacV - o.Machine = all.Machine - o.NixV = all.NixV - o.Platform = all.Platform - o.Processor = all.Processor - o.PythonV = all.PythonV - o.SocketFqdn = all.SocketFqdn - o.SocketHostname = all.SocketHostname - o.WinV = all.WinV - return nil -} diff --git a/api/v1/datadog/model_host_meta_install_method.go b/api/v1/datadog/model_host_meta_install_method.go deleted file mode 100644 index a21034320a8..00000000000 --- a/api/v1/datadog/model_host_meta_install_method.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMetaInstallMethod Agent install method. -type HostMetaInstallMethod struct { - // The installer version. - InstallerVersion *string `json:"installer_version,omitempty"` - // Tool used to install the agent. - Tool *string `json:"tool,omitempty"` - // The tool version. - ToolVersion *string `json:"tool_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{} -} - -// NewHostMetaInstallMethod instantiates a new HostMetaInstallMethod 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 NewHostMetaInstallMethod() *HostMetaInstallMethod { - this := HostMetaInstallMethod{} - return &this -} - -// NewHostMetaInstallMethodWithDefaults instantiates a new HostMetaInstallMethod 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 NewHostMetaInstallMethodWithDefaults() *HostMetaInstallMethod { - this := HostMetaInstallMethod{} - return &this -} - -// GetInstallerVersion returns the InstallerVersion field value if set, zero value otherwise. -func (o *HostMetaInstallMethod) GetInstallerVersion() string { - if o == nil || o.InstallerVersion == nil { - var ret string - return ret - } - return *o.InstallerVersion -} - -// GetInstallerVersionOk returns a tuple with the InstallerVersion field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMetaInstallMethod) GetInstallerVersionOk() (*string, bool) { - if o == nil || o.InstallerVersion == nil { - return nil, false - } - return o.InstallerVersion, true -} - -// HasInstallerVersion returns a boolean if a field has been set. -func (o *HostMetaInstallMethod) HasInstallerVersion() bool { - if o != nil && o.InstallerVersion != nil { - return true - } - - return false -} - -// SetInstallerVersion gets a reference to the given string and assigns it to the InstallerVersion field. -func (o *HostMetaInstallMethod) SetInstallerVersion(v string) { - o.InstallerVersion = &v -} - -// GetTool returns the Tool field value if set, zero value otherwise. -func (o *HostMetaInstallMethod) GetTool() string { - if o == nil || o.Tool == nil { - var ret string - return ret - } - return *o.Tool -} - -// GetToolOk returns a tuple with the Tool field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMetaInstallMethod) GetToolOk() (*string, bool) { - if o == nil || o.Tool == nil { - return nil, false - } - return o.Tool, true -} - -// HasTool returns a boolean if a field has been set. -func (o *HostMetaInstallMethod) HasTool() bool { - if o != nil && o.Tool != nil { - return true - } - - return false -} - -// SetTool gets a reference to the given string and assigns it to the Tool field. -func (o *HostMetaInstallMethod) SetTool(v string) { - o.Tool = &v -} - -// GetToolVersion returns the ToolVersion field value if set, zero value otherwise. -func (o *HostMetaInstallMethod) GetToolVersion() string { - if o == nil || o.ToolVersion == nil { - var ret string - return ret - } - return *o.ToolVersion -} - -// GetToolVersionOk returns a tuple with the ToolVersion field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMetaInstallMethod) GetToolVersionOk() (*string, bool) { - if o == nil || o.ToolVersion == nil { - return nil, false - } - return o.ToolVersion, true -} - -// HasToolVersion returns a boolean if a field has been set. -func (o *HostMetaInstallMethod) HasToolVersion() bool { - if o != nil && o.ToolVersion != nil { - return true - } - - return false -} - -// SetToolVersion gets a reference to the given string and assigns it to the ToolVersion field. -func (o *HostMetaInstallMethod) SetToolVersion(v string) { - o.ToolVersion = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMetaInstallMethod) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.InstallerVersion != nil { - toSerialize["installer_version"] = o.InstallerVersion - } - if o.Tool != nil { - toSerialize["tool"] = o.Tool - } - if o.ToolVersion != nil { - toSerialize["tool_version"] = o.ToolVersion - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMetaInstallMethod) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - InstallerVersion *string `json:"installer_version,omitempty"` - Tool *string `json:"tool,omitempty"` - ToolVersion *string `json:"tool_version,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.InstallerVersion = all.InstallerVersion - o.Tool = all.Tool - o.ToolVersion = all.ToolVersion - return nil -} diff --git a/api/v1/datadog/model_host_metrics.go b/api/v1/datadog/model_host_metrics.go deleted file mode 100644 index 46298cd7230..00000000000 --- a/api/v1/datadog/model_host_metrics.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMetrics Host Metrics collected. -type HostMetrics struct { - // The percent of CPU used (everything but idle). - Cpu *float64 `json:"cpu,omitempty"` - // The percent of CPU spent waiting on the IO (not reported for all platforms). - Iowait *float64 `json:"iowait,omitempty"` - // The system load over the last 15 minutes. - Load *float64 `json:"load,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{} -} - -// NewHostMetrics instantiates a new HostMetrics 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 NewHostMetrics() *HostMetrics { - this := HostMetrics{} - return &this -} - -// NewHostMetricsWithDefaults instantiates a new HostMetrics 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 NewHostMetricsWithDefaults() *HostMetrics { - this := HostMetrics{} - return &this -} - -// GetCpu returns the Cpu field value if set, zero value otherwise. -func (o *HostMetrics) GetCpu() float64 { - if o == nil || o.Cpu == nil { - var ret float64 - return ret - } - return *o.Cpu -} - -// GetCpuOk returns a tuple with the Cpu field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMetrics) GetCpuOk() (*float64, bool) { - if o == nil || o.Cpu == nil { - return nil, false - } - return o.Cpu, true -} - -// HasCpu returns a boolean if a field has been set. -func (o *HostMetrics) HasCpu() bool { - if o != nil && o.Cpu != nil { - return true - } - - return false -} - -// SetCpu gets a reference to the given float64 and assigns it to the Cpu field. -func (o *HostMetrics) SetCpu(v float64) { - o.Cpu = &v -} - -// GetIowait returns the Iowait field value if set, zero value otherwise. -func (o *HostMetrics) GetIowait() float64 { - if o == nil || o.Iowait == nil { - var ret float64 - return ret - } - return *o.Iowait -} - -// GetIowaitOk returns a tuple with the Iowait field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMetrics) GetIowaitOk() (*float64, bool) { - if o == nil || o.Iowait == nil { - return nil, false - } - return o.Iowait, true -} - -// HasIowait returns a boolean if a field has been set. -func (o *HostMetrics) HasIowait() bool { - if o != nil && o.Iowait != nil { - return true - } - - return false -} - -// SetIowait gets a reference to the given float64 and assigns it to the Iowait field. -func (o *HostMetrics) SetIowait(v float64) { - o.Iowait = &v -} - -// GetLoad returns the Load field value if set, zero value otherwise. -func (o *HostMetrics) GetLoad() float64 { - if o == nil || o.Load == nil { - var ret float64 - return ret - } - return *o.Load -} - -// GetLoadOk returns a tuple with the Load field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMetrics) GetLoadOk() (*float64, bool) { - if o == nil || o.Load == nil { - return nil, false - } - return o.Load, true -} - -// HasLoad returns a boolean if a field has been set. -func (o *HostMetrics) HasLoad() bool { - if o != nil && o.Load != nil { - return true - } - - return false -} - -// SetLoad gets a reference to the given float64 and assigns it to the Load field. -func (o *HostMetrics) SetLoad(v float64) { - o.Load = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMetrics) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cpu != nil { - toSerialize["cpu"] = o.Cpu - } - if o.Iowait != nil { - toSerialize["iowait"] = o.Iowait - } - if o.Load != nil { - toSerialize["load"] = o.Load - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMetrics) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cpu *float64 `json:"cpu,omitempty"` - Iowait *float64 `json:"iowait,omitempty"` - Load *float64 `json:"load,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cpu = all.Cpu - o.Iowait = all.Iowait - o.Load = all.Load - return nil -} diff --git a/api/v1/datadog/model_host_mute_response.go b/api/v1/datadog/model_host_mute_response.go deleted file mode 100644 index f8d2f84af7a..00000000000 --- a/api/v1/datadog/model_host_mute_response.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMuteResponse Response with the list of muted host for your organization. -type HostMuteResponse struct { - // Action applied to the hosts. - Action *string `json:"action,omitempty"` - // POSIX timestamp in seconds when the host is unmuted. - End *int64 `json:"end,omitempty"` - // The host name. - Hostname *string `json:"hostname,omitempty"` - // Message associated with the mute. - Message *string `json:"message,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{} -} - -// NewHostMuteResponse instantiates a new HostMuteResponse 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 NewHostMuteResponse() *HostMuteResponse { - this := HostMuteResponse{} - return &this -} - -// NewHostMuteResponseWithDefaults instantiates a new HostMuteResponse 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 NewHostMuteResponseWithDefaults() *HostMuteResponse { - this := HostMuteResponse{} - return &this -} - -// GetAction returns the Action field value if set, zero value otherwise. -func (o *HostMuteResponse) GetAction() string { - if o == nil || o.Action == nil { - var ret string - return ret - } - return *o.Action -} - -// GetActionOk returns a tuple with the Action field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMuteResponse) GetActionOk() (*string, bool) { - if o == nil || o.Action == nil { - return nil, false - } - return o.Action, true -} - -// HasAction returns a boolean if a field has been set. -func (o *HostMuteResponse) HasAction() bool { - if o != nil && o.Action != nil { - return true - } - - return false -} - -// SetAction gets a reference to the given string and assigns it to the Action field. -func (o *HostMuteResponse) SetAction(v string) { - o.Action = &v -} - -// GetEnd returns the End field value if set, zero value otherwise. -func (o *HostMuteResponse) GetEnd() int64 { - if o == nil || o.End == nil { - var ret int64 - return ret - } - return *o.End -} - -// GetEndOk returns a tuple with the End field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMuteResponse) GetEndOk() (*int64, bool) { - if o == nil || o.End == nil { - return nil, false - } - return o.End, true -} - -// HasEnd returns a boolean if a field has been set. -func (o *HostMuteResponse) HasEnd() bool { - if o != nil && o.End != nil { - return true - } - - return false -} - -// SetEnd gets a reference to the given int64 and assigns it to the End field. -func (o *HostMuteResponse) SetEnd(v int64) { - o.End = &v -} - -// GetHostname returns the Hostname field value if set, zero value otherwise. -func (o *HostMuteResponse) 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 *HostMuteResponse) 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 *HostMuteResponse) HasHostname() bool { - if o != nil && o.Hostname != nil { - return true - } - - return false -} - -// SetHostname gets a reference to the given string and assigns it to the Hostname field. -func (o *HostMuteResponse) SetHostname(v string) { - o.Hostname = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *HostMuteResponse) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMuteResponse) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *HostMuteResponse) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *HostMuteResponse) SetMessage(v string) { - o.Message = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMuteResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Action != nil { - toSerialize["action"] = o.Action - } - if o.End != nil { - toSerialize["end"] = o.End - } - if o.Hostname != nil { - toSerialize["hostname"] = o.Hostname - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMuteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Action *string `json:"action,omitempty"` - End *int64 `json:"end,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Message *string `json:"message,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Action = all.Action - o.End = all.End - o.Hostname = all.Hostname - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_host_mute_settings.go b/api/v1/datadog/model_host_mute_settings.go deleted file mode 100644 index b7a31866438..00000000000 --- a/api/v1/datadog/model_host_mute_settings.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostMuteSettings Combination of settings to mute a host. -type HostMuteSettings struct { - // POSIX timestamp in seconds when the host is unmuted. If omitted, the host remains muted until explicitly unmuted. - End *int64 `json:"end,omitempty"` - // Message to associate with the muting of this host. - Message *string `json:"message,omitempty"` - // If true and the host is already muted, replaces existing host mute settings. - Override *bool `json:"override,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{} -} - -// NewHostMuteSettings instantiates a new HostMuteSettings 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 NewHostMuteSettings() *HostMuteSettings { - this := HostMuteSettings{} - return &this -} - -// NewHostMuteSettingsWithDefaults instantiates a new HostMuteSettings 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 NewHostMuteSettingsWithDefaults() *HostMuteSettings { - this := HostMuteSettings{} - return &this -} - -// GetEnd returns the End field value if set, zero value otherwise. -func (o *HostMuteSettings) GetEnd() int64 { - if o == nil || o.End == nil { - var ret int64 - return ret - } - return *o.End -} - -// GetEndOk returns a tuple with the End field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMuteSettings) GetEndOk() (*int64, bool) { - if o == nil || o.End == nil { - return nil, false - } - return o.End, true -} - -// HasEnd returns a boolean if a field has been set. -func (o *HostMuteSettings) HasEnd() bool { - if o != nil && o.End != nil { - return true - } - - return false -} - -// SetEnd gets a reference to the given int64 and assigns it to the End field. -func (o *HostMuteSettings) SetEnd(v int64) { - o.End = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *HostMuteSettings) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMuteSettings) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *HostMuteSettings) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *HostMuteSettings) SetMessage(v string) { - o.Message = &v -} - -// GetOverride returns the Override field value if set, zero value otherwise. -func (o *HostMuteSettings) GetOverride() bool { - if o == nil || o.Override == nil { - var ret bool - return ret - } - return *o.Override -} - -// GetOverrideOk returns a tuple with the Override field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostMuteSettings) GetOverrideOk() (*bool, bool) { - if o == nil || o.Override == nil { - return nil, false - } - return o.Override, true -} - -// HasOverride returns a boolean if a field has been set. -func (o *HostMuteSettings) HasOverride() bool { - if o != nil && o.Override != nil { - return true - } - - return false -} - -// SetOverride gets a reference to the given bool and assigns it to the Override field. -func (o *HostMuteSettings) SetOverride(v bool) { - o.Override = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostMuteSettings) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.End != nil { - toSerialize["end"] = o.End - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Override != nil { - toSerialize["override"] = o.Override - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostMuteSettings) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - End *int64 `json:"end,omitempty"` - Message *string `json:"message,omitempty"` - Override *bool `json:"override,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.End = all.End - o.Message = all.Message - o.Override = all.Override - return nil -} diff --git a/api/v1/datadog/model_host_tags.go b/api/v1/datadog/model_host_tags.go deleted file mode 100644 index 82f8257b020..00000000000 --- a/api/v1/datadog/model_host_tags.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostTags Set of tags to associate with your host. -type HostTags struct { - // Your host name. - Host *string `json:"host,omitempty"` - // A list of tags to apply to the host. - Tags []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{} -} - -// NewHostTags instantiates a new HostTags 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 NewHostTags() *HostTags { - this := HostTags{} - return &this -} - -// NewHostTagsWithDefaults instantiates a new HostTags 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 NewHostTagsWithDefaults() *HostTags { - this := HostTags{} - return &this -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *HostTags) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostTags) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *HostTags) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *HostTags) SetHost(v string) { - o.Host = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *HostTags) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *HostTags) GetTagsOk() (*[]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 *HostTags) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *HostTags) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostTags) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostTags) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Host *string `json:"host,omitempty"` - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Host = all.Host - o.Tags = all.Tags - return nil -} diff --git a/api/v1/datadog/model_host_totals.go b/api/v1/datadog/model_host_totals.go deleted file mode 100644 index 9456bbbebd7..00000000000 --- a/api/v1/datadog/model_host_totals.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HostTotals Total number of host currently monitored by Datadog. -type HostTotals struct { - // Total number of active host (UP and ???) reporting to Datadog. - TotalActive *int64 `json:"total_active,omitempty"` - // Number of host that are UP and reporting to Datadog. - TotalUp *int64 `json:"total_up,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{} -} - -// NewHostTotals instantiates a new HostTotals 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 NewHostTotals() *HostTotals { - this := HostTotals{} - return &this -} - -// NewHostTotalsWithDefaults instantiates a new HostTotals 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 NewHostTotalsWithDefaults() *HostTotals { - this := HostTotals{} - return &this -} - -// GetTotalActive returns the TotalActive field value if set, zero value otherwise. -func (o *HostTotals) GetTotalActive() int64 { - if o == nil || o.TotalActive == nil { - var ret int64 - return ret - } - return *o.TotalActive -} - -// GetTotalActiveOk returns a tuple with the TotalActive field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostTotals) GetTotalActiveOk() (*int64, bool) { - if o == nil || o.TotalActive == nil { - return nil, false - } - return o.TotalActive, true -} - -// HasTotalActive returns a boolean if a field has been set. -func (o *HostTotals) HasTotalActive() bool { - if o != nil && o.TotalActive != nil { - return true - } - - return false -} - -// SetTotalActive gets a reference to the given int64 and assigns it to the TotalActive field. -func (o *HostTotals) SetTotalActive(v int64) { - o.TotalActive = &v -} - -// GetTotalUp returns the TotalUp field value if set, zero value otherwise. -func (o *HostTotals) GetTotalUp() int64 { - if o == nil || o.TotalUp == nil { - var ret int64 - return ret - } - return *o.TotalUp -} - -// GetTotalUpOk returns a tuple with the TotalUp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HostTotals) GetTotalUpOk() (*int64, bool) { - if o == nil || o.TotalUp == nil { - return nil, false - } - return o.TotalUp, true -} - -// HasTotalUp returns a boolean if a field has been set. -func (o *HostTotals) HasTotalUp() bool { - if o != nil && o.TotalUp != nil { - return true - } - - return false -} - -// SetTotalUp gets a reference to the given int64 and assigns it to the TotalUp field. -func (o *HostTotals) SetTotalUp(v int64) { - o.TotalUp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HostTotals) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TotalActive != nil { - toSerialize["total_active"] = o.TotalActive - } - if o.TotalUp != nil { - toSerialize["total_up"] = o.TotalUp - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HostTotals) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TotalActive *int64 `json:"total_active,omitempty"` - TotalUp *int64 `json:"total_up,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TotalActive = all.TotalActive - o.TotalUp = all.TotalUp - return nil -} diff --git a/api/v1/datadog/model_hourly_usage_attribution_body.go b/api/v1/datadog/model_hourly_usage_attribution_body.go deleted file mode 100644 index 8fa5e64cc5b..00000000000 --- a/api/v1/datadog/model_hourly_usage_attribution_body.go +++ /dev/null @@ -1,392 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// HourlyUsageAttributionBody The usage for one set of tags for one hour. -type HourlyUsageAttributionBody struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The name of the organization. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The source of the usage attribution tag configuration and the selected tags in the format of `::://////`. - TagConfigSource *string `json:"tag_config_source,omitempty"` - // Tag keys and values. - // - // A `null` value here means that the requested tag breakdown cannot be applied because it does not match the [tags - // configured for usage attribution](https://docs.datadoghq.com/account_management/billing/usage_attribution/#getting-started). - // In this scenario the API returns the total usage, not broken down by tags. - Tags map[string][]string `json:"tags,omitempty"` - // Total product usage for the given tags within the hour. - TotalUsageSum *float64 `json:"total_usage_sum,omitempty"` - // Shows the most recent hour in the current month for all organizations where usages are calculated. - UpdatedAt *string `json:"updated_at,omitempty"` - // Supported products for hourly usage attribution requests. - UsageType *HourlyUsageAttributionUsageType `json:"usage_type,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{} -} - -// NewHourlyUsageAttributionBody instantiates a new HourlyUsageAttributionBody 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 NewHourlyUsageAttributionBody() *HourlyUsageAttributionBody { - this := HourlyUsageAttributionBody{} - return &this -} - -// NewHourlyUsageAttributionBodyWithDefaults instantiates a new HourlyUsageAttributionBody 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 NewHourlyUsageAttributionBodyWithDefaults() *HourlyUsageAttributionBody { - this := HourlyUsageAttributionBody{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionBody) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *HourlyUsageAttributionBody) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *HourlyUsageAttributionBody) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionBody) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *HourlyUsageAttributionBody) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *HourlyUsageAttributionBody) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionBody) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *HourlyUsageAttributionBody) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *HourlyUsageAttributionBody) SetPublicId(v string) { - o.PublicId = &v -} - -// GetTagConfigSource returns the TagConfigSource field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) GetTagConfigSource() string { - if o == nil || o.TagConfigSource == nil { - var ret string - return ret - } - return *o.TagConfigSource -} - -// GetTagConfigSourceOk returns a tuple with the TagConfigSource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionBody) GetTagConfigSourceOk() (*string, bool) { - if o == nil || o.TagConfigSource == nil { - return nil, false - } - return o.TagConfigSource, true -} - -// HasTagConfigSource returns a boolean if a field has been set. -func (o *HourlyUsageAttributionBody) HasTagConfigSource() bool { - if o != nil && o.TagConfigSource != nil { - return true - } - - return false -} - -// SetTagConfigSource gets a reference to the given string and assigns it to the TagConfigSource field. -func (o *HourlyUsageAttributionBody) SetTagConfigSource(v string) { - o.TagConfigSource = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) 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 *HourlyUsageAttributionBody) 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 *HourlyUsageAttributionBody) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. -func (o *HourlyUsageAttributionBody) SetTags(v map[string][]string) { - o.Tags = v -} - -// GetTotalUsageSum returns the TotalUsageSum field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) GetTotalUsageSum() float64 { - if o == nil || o.TotalUsageSum == nil { - var ret float64 - return ret - } - return *o.TotalUsageSum -} - -// GetTotalUsageSumOk returns a tuple with the TotalUsageSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionBody) GetTotalUsageSumOk() (*float64, bool) { - if o == nil || o.TotalUsageSum == nil { - return nil, false - } - return o.TotalUsageSum, true -} - -// HasTotalUsageSum returns a boolean if a field has been set. -func (o *HourlyUsageAttributionBody) HasTotalUsageSum() bool { - if o != nil && o.TotalUsageSum != nil { - return true - } - - return false -} - -// SetTotalUsageSum gets a reference to the given float64 and assigns it to the TotalUsageSum field. -func (o *HourlyUsageAttributionBody) SetTotalUsageSum(v float64) { - o.TotalUsageSum = &v -} - -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) GetUpdatedAt() string { - if o == nil || o.UpdatedAt == nil { - var ret string - return ret - } - return *o.UpdatedAt -} - -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionBody) GetUpdatedAtOk() (*string, bool) { - if o == nil || o.UpdatedAt == nil { - return nil, false - } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *HourlyUsageAttributionBody) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false -} - -// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. -func (o *HourlyUsageAttributionBody) SetUpdatedAt(v string) { - o.UpdatedAt = &v -} - -// GetUsageType returns the UsageType field value if set, zero value otherwise. -func (o *HourlyUsageAttributionBody) GetUsageType() HourlyUsageAttributionUsageType { - if o == nil || o.UsageType == nil { - var ret HourlyUsageAttributionUsageType - return ret - } - return *o.UsageType -} - -// GetUsageTypeOk returns a tuple with the UsageType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionBody) GetUsageTypeOk() (*HourlyUsageAttributionUsageType, bool) { - if o == nil || o.UsageType == nil { - return nil, false - } - return o.UsageType, true -} - -// HasUsageType returns a boolean if a field has been set. -func (o *HourlyUsageAttributionBody) HasUsageType() bool { - if o != nil && o.UsageType != nil { - return true - } - - return false -} - -// SetUsageType gets a reference to the given HourlyUsageAttributionUsageType and assigns it to the UsageType field. -func (o *HourlyUsageAttributionBody) SetUsageType(v HourlyUsageAttributionUsageType) { - o.UsageType = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageAttributionBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.TagConfigSource != nil { - toSerialize["tag_config_source"] = o.TagConfigSource - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.TotalUsageSum != nil { - toSerialize["total_usage_sum"] = o.TotalUsageSum - } - if o.UpdatedAt != nil { - toSerialize["updated_at"] = o.UpdatedAt - } - if o.UsageType != nil { - toSerialize["usage_type"] = o.UsageType - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - TagConfigSource *string `json:"tag_config_source,omitempty"` - Tags map[string][]string `json:"tags,omitempty"` - TotalUsageSum *float64 `json:"total_usage_sum,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` - UsageType *HourlyUsageAttributionUsageType `json:"usage_type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.UsageType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.TagConfigSource = all.TagConfigSource - o.Tags = all.Tags - o.TotalUsageSum = all.TotalUsageSum - o.UpdatedAt = all.UpdatedAt - o.UsageType = all.UsageType - return nil -} diff --git a/api/v1/datadog/model_hourly_usage_attribution_metadata.go b/api/v1/datadog/model_hourly_usage_attribution_metadata.go deleted file mode 100644 index ab886292bf0..00000000000 --- a/api/v1/datadog/model_hourly_usage_attribution_metadata.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HourlyUsageAttributionMetadata The object containing document metadata. -type HourlyUsageAttributionMetadata struct { - // The metadata for the current pagination. - Pagination *HourlyUsageAttributionPagination `json:"pagination,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{} -} - -// NewHourlyUsageAttributionMetadata instantiates a new HourlyUsageAttributionMetadata 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 NewHourlyUsageAttributionMetadata() *HourlyUsageAttributionMetadata { - this := HourlyUsageAttributionMetadata{} - return &this -} - -// NewHourlyUsageAttributionMetadataWithDefaults instantiates a new HourlyUsageAttributionMetadata 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 NewHourlyUsageAttributionMetadataWithDefaults() *HourlyUsageAttributionMetadata { - this := HourlyUsageAttributionMetadata{} - return &this -} - -// GetPagination returns the Pagination field value if set, zero value otherwise. -func (o *HourlyUsageAttributionMetadata) GetPagination() HourlyUsageAttributionPagination { - if o == nil || o.Pagination == nil { - var ret HourlyUsageAttributionPagination - return ret - } - return *o.Pagination -} - -// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionMetadata) GetPaginationOk() (*HourlyUsageAttributionPagination, bool) { - if o == nil || o.Pagination == nil { - return nil, false - } - return o.Pagination, true -} - -// HasPagination returns a boolean if a field has been set. -func (o *HourlyUsageAttributionMetadata) HasPagination() bool { - if o != nil && o.Pagination != nil { - return true - } - - return false -} - -// SetPagination gets a reference to the given HourlyUsageAttributionPagination and assigns it to the Pagination field. -func (o *HourlyUsageAttributionMetadata) SetPagination(v HourlyUsageAttributionPagination) { - o.Pagination = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageAttributionMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Pagination != nil { - toSerialize["pagination"] = o.Pagination - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Pagination *HourlyUsageAttributionPagination `json:"pagination,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pagination = all.Pagination - return nil -} diff --git a/api/v1/datadog/model_hourly_usage_attribution_pagination.go b/api/v1/datadog/model_hourly_usage_attribution_pagination.go deleted file mode 100644 index 38006ad2bcc..00000000000 --- a/api/v1/datadog/model_hourly_usage_attribution_pagination.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// HourlyUsageAttributionPagination The metadata for the current pagination. -type HourlyUsageAttributionPagination struct { - // The cursor to get the next results (if any). To make the next request, use the same parameters and add `next_record_id`. - NextRecordId common.NullableString `json:"next_record_id,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{} -} - -// NewHourlyUsageAttributionPagination instantiates a new HourlyUsageAttributionPagination 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 NewHourlyUsageAttributionPagination() *HourlyUsageAttributionPagination { - this := HourlyUsageAttributionPagination{} - return &this -} - -// NewHourlyUsageAttributionPaginationWithDefaults instantiates a new HourlyUsageAttributionPagination 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 NewHourlyUsageAttributionPaginationWithDefaults() *HourlyUsageAttributionPagination { - this := HourlyUsageAttributionPagination{} - return &this -} - -// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *HourlyUsageAttributionPagination) GetNextRecordId() string { - if o == nil || o.NextRecordId.Get() == nil { - var ret string - return ret - } - return *o.NextRecordId.Get() -} - -// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *HourlyUsageAttributionPagination) GetNextRecordIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.NextRecordId.Get(), o.NextRecordId.IsSet() -} - -// HasNextRecordId returns a boolean if a field has been set. -func (o *HourlyUsageAttributionPagination) HasNextRecordId() bool { - if o != nil && o.NextRecordId.IsSet() { - return true - } - - return false -} - -// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. -func (o *HourlyUsageAttributionPagination) SetNextRecordId(v string) { - o.NextRecordId.Set(&v) -} - -// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. -func (o *HourlyUsageAttributionPagination) SetNextRecordIdNil() { - o.NextRecordId.Set(nil) -} - -// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. -func (o *HourlyUsageAttributionPagination) UnsetNextRecordId() { - o.NextRecordId.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageAttributionPagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.NextRecordId.IsSet() { - toSerialize["next_record_id"] = o.NextRecordId.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - NextRecordId common.NullableString `json:"next_record_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.NextRecordId = all.NextRecordId - return nil -} diff --git a/api/v1/datadog/model_hourly_usage_attribution_response.go b/api/v1/datadog/model_hourly_usage_attribution_response.go deleted file mode 100644 index 3446b5d14b9..00000000000 --- a/api/v1/datadog/model_hourly_usage_attribution_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HourlyUsageAttributionResponse Response containing the hourly usage attribution by tag(s). -type HourlyUsageAttributionResponse struct { - // The object containing document metadata. - Metadata *HourlyUsageAttributionMetadata `json:"metadata,omitempty"` - // Get the hourly usage attribution by tag(s). - Usage []HourlyUsageAttributionBody `json:"usage,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{} -} - -// NewHourlyUsageAttributionResponse instantiates a new HourlyUsageAttributionResponse 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 NewHourlyUsageAttributionResponse() *HourlyUsageAttributionResponse { - this := HourlyUsageAttributionResponse{} - return &this -} - -// NewHourlyUsageAttributionResponseWithDefaults instantiates a new HourlyUsageAttributionResponse 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 NewHourlyUsageAttributionResponseWithDefaults() *HourlyUsageAttributionResponse { - this := HourlyUsageAttributionResponse{} - return &this -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *HourlyUsageAttributionResponse) GetMetadata() HourlyUsageAttributionMetadata { - if o == nil || o.Metadata == nil { - var ret HourlyUsageAttributionMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionResponse) GetMetadataOk() (*HourlyUsageAttributionMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *HourlyUsageAttributionResponse) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given HourlyUsageAttributionMetadata and assigns it to the Metadata field. -func (o *HourlyUsageAttributionResponse) SetMetadata(v HourlyUsageAttributionMetadata) { - o.Metadata = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *HourlyUsageAttributionResponse) GetUsage() []HourlyUsageAttributionBody { - if o == nil || o.Usage == nil { - var ret []HourlyUsageAttributionBody - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributionResponse) GetUsageOk() (*[]HourlyUsageAttributionBody, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *HourlyUsageAttributionResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []HourlyUsageAttributionBody and assigns it to the Usage field. -func (o *HourlyUsageAttributionResponse) SetUsage(v []HourlyUsageAttributionBody) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageAttributionResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Metadata *HourlyUsageAttributionMetadata `json:"metadata,omitempty"` - Usage []HourlyUsageAttributionBody `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_hourly_usage_attribution_usage_type.go b/api/v1/datadog/model_hourly_usage_attribution_usage_type.go deleted file mode 100644 index 96ef5c85b60..00000000000 --- a/api/v1/datadog/model_hourly_usage_attribution_usage_type.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HourlyUsageAttributionUsageType Supported products for hourly usage attribution requests. -type HourlyUsageAttributionUsageType string - -// List of HourlyUsageAttributionUsageType. -const ( - HOURLYUSAGEATTRIBUTIONUSAGETYPE_API_USAGE HourlyUsageAttributionUsageType = "api_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_HOST_USAGE HourlyUsageAttributionUsageType = "apm_host_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_USAGE HourlyUsageAttributionUsageType = "appsec_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_BROWSER_USAGE HourlyUsageAttributionUsageType = "browser_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_USAGE HourlyUsageAttributionUsageType = "container_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_CONTAINERS_USAGE HourlyUsageAttributionUsageType = "cspm_containers_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_HOSTS_USAGE HourlyUsageAttributionUsageType = "cspm_hosts_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CUSTOM_TIMESERIES_USAGE HourlyUsageAttributionUsageType = "custom_timeseries_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_CONTAINERS_USAGE HourlyUsageAttributionUsageType = "cws_containers_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_HOSTS_USAGE HourlyUsageAttributionUsageType = "cws_hosts_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_HOSTS_USAGE HourlyUsageAttributionUsageType = "dbm_hosts_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_QUERIES_USAGE HourlyUsageAttributionUsageType = "dbm_queries_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_LOGS_USAGE HourlyUsageAttributionUsageType = "estimated_indexed_logs_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_SPANS_USAGE HourlyUsageAttributionUsageType = "estimated_indexed_spans_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INGESTED_SPANS_USAGE HourlyUsageAttributionUsageType = "estimated_ingested_spans_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_FARGATE_USAGE HourlyUsageAttributionUsageType = "fargate_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_FUNCTIONS_USAGE HourlyUsageAttributionUsageType = "functions_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_INDEXED_LOGS_USAGE HourlyUsageAttributionUsageType = "indexed_logs_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_INFRA_HOST_USAGE HourlyUsageAttributionUsageType = "infra_host_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_INVOCATIONS_USAGE HourlyUsageAttributionUsageType = "invocations_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_NPM_HOST_USAGE HourlyUsageAttributionUsageType = "npm_host_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_CONTAINER_USAGE HourlyUsageAttributionUsageType = "profiled_container_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_HOST_USAGE HourlyUsageAttributionUsageType = "profiled_host_usage" - HOURLYUSAGEATTRIBUTIONUSAGETYPE_SNMP_USAGE HourlyUsageAttributionUsageType = "snmp_usage" -) - -var allowedHourlyUsageAttributionUsageTypeEnumValues = []HourlyUsageAttributionUsageType{ - HOURLYUSAGEATTRIBUTIONUSAGETYPE_API_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_HOST_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_BROWSER_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_CONTAINERS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_HOSTS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CUSTOM_TIMESERIES_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_CONTAINERS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_HOSTS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_HOSTS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_QUERIES_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_LOGS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_SPANS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INGESTED_SPANS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_FARGATE_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_FUNCTIONS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_INDEXED_LOGS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_INFRA_HOST_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_INVOCATIONS_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_NPM_HOST_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_CONTAINER_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_HOST_USAGE, - HOURLYUSAGEATTRIBUTIONUSAGETYPE_SNMP_USAGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *HourlyUsageAttributionUsageType) GetAllowedValues() []HourlyUsageAttributionUsageType { - return allowedHourlyUsageAttributionUsageTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *HourlyUsageAttributionUsageType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = HourlyUsageAttributionUsageType(value) - return nil -} - -// NewHourlyUsageAttributionUsageTypeFromValue returns a pointer to a valid HourlyUsageAttributionUsageType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewHourlyUsageAttributionUsageTypeFromValue(v string) (*HourlyUsageAttributionUsageType, error) { - ev := HourlyUsageAttributionUsageType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for HourlyUsageAttributionUsageType: valid values are %v", v, allowedHourlyUsageAttributionUsageTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v HourlyUsageAttributionUsageType) IsValid() bool { - for _, existing := range allowedHourlyUsageAttributionUsageTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to HourlyUsageAttributionUsageType value. -func (v HourlyUsageAttributionUsageType) Ptr() *HourlyUsageAttributionUsageType { - return &v -} - -// NullableHourlyUsageAttributionUsageType handles when a null is used for HourlyUsageAttributionUsageType. -type NullableHourlyUsageAttributionUsageType struct { - value *HourlyUsageAttributionUsageType - isSet bool -} - -// Get returns the associated value. -func (v NullableHourlyUsageAttributionUsageType) Get() *HourlyUsageAttributionUsageType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHourlyUsageAttributionUsageType) Set(val *HourlyUsageAttributionUsageType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHourlyUsageAttributionUsageType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHourlyUsageAttributionUsageType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHourlyUsageAttributionUsageType initializes the struct as if Set has been called. -func NewNullableHourlyUsageAttributionUsageType(val *HourlyUsageAttributionUsageType) *NullableHourlyUsageAttributionUsageType { - return &NullableHourlyUsageAttributionUsageType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHourlyUsageAttributionUsageType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHourlyUsageAttributionUsageType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_http_log_error.go b/api/v1/datadog/model_http_log_error.go deleted file mode 100644 index f223a1f1c79..00000000000 --- a/api/v1/datadog/model_http_log_error.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HTTPLogError Invalid query performed. -type HTTPLogError struct { - // Error code. - Code int32 `json:"code"` - // Error message. - Message string `json:"message"` - // 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{} -} - -// NewHTTPLogError instantiates a new HTTPLogError 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 NewHTTPLogError(code int32, message string) *HTTPLogError { - this := HTTPLogError{} - this.Code = code - this.Message = message - return &this -} - -// NewHTTPLogErrorWithDefaults instantiates a new HTTPLogError 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 NewHTTPLogErrorWithDefaults() *HTTPLogError { - this := HTTPLogError{} - return &this -} - -// GetCode returns the Code field value. -func (o *HTTPLogError) GetCode() int32 { - if o == nil { - var ret int32 - return ret - } - return o.Code -} - -// GetCodeOk returns a tuple with the Code field value -// and a boolean to check if the value has been set. -func (o *HTTPLogError) GetCodeOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Code, true -} - -// SetCode sets field value. -func (o *HTTPLogError) SetCode(v int32) { - o.Code = v -} - -// GetMessage returns the Message field value. -func (o *HTTPLogError) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *HTTPLogError) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *HTTPLogError) SetMessage(v string) { - o.Message = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HTTPLogError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["code"] = o.Code - toSerialize["message"] = o.Message - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Code *int32 `json:"code"` - Message *string `json:"message"` - }{} - all := struct { - Code int32 `json:"code"` - Message string `json:"message"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Code == nil { - return fmt.Errorf("Required field code missing") - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_http_log_item.go b/api/v1/datadog/model_http_log_item.go deleted file mode 100644 index e0a9b9d7679..00000000000 --- a/api/v1/datadog/model_http_log_item.go +++ /dev/null @@ -1,265 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HTTPLogItem Logs that are sent over HTTP. -type HTTPLogItem struct { - // The integration name associated with your log: the technology from which the log originated. - // When it matches an integration name, Datadog automatically installs the corresponding parsers and facets. - // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). - Ddsource *string `json:"ddsource,omitempty"` - // Tags associated with your logs. - Ddtags *string `json:"ddtags,omitempty"` - // The name of the originating host of the log. - Hostname *string `json:"hostname,omitempty"` - // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) - // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. - // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. - Message string `json:"message"` - // The name of the application or service generating the log events. - // It is used to switch from Logs to APM, so make sure you define the same value when you use both products. - // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). - Service *string `json:"service,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]string -} - -// NewHTTPLogItem instantiates a new HTTPLogItem 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 NewHTTPLogItem(message string) *HTTPLogItem { - this := HTTPLogItem{} - this.Message = message - return &this -} - -// NewHTTPLogItemWithDefaults instantiates a new HTTPLogItem 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 NewHTTPLogItemWithDefaults() *HTTPLogItem { - this := HTTPLogItem{} - return &this -} - -// GetDdsource returns the Ddsource field value if set, zero value otherwise. -func (o *HTTPLogItem) GetDdsource() string { - if o == nil || o.Ddsource == nil { - var ret string - return ret - } - return *o.Ddsource -} - -// GetDdsourceOk returns a tuple with the Ddsource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogItem) GetDdsourceOk() (*string, bool) { - if o == nil || o.Ddsource == nil { - return nil, false - } - return o.Ddsource, true -} - -// HasDdsource returns a boolean if a field has been set. -func (o *HTTPLogItem) HasDdsource() bool { - if o != nil && o.Ddsource != nil { - return true - } - - return false -} - -// SetDdsource gets a reference to the given string and assigns it to the Ddsource field. -func (o *HTTPLogItem) SetDdsource(v string) { - o.Ddsource = &v -} - -// GetDdtags returns the Ddtags field value if set, zero value otherwise. -func (o *HTTPLogItem) GetDdtags() string { - if o == nil || o.Ddtags == nil { - var ret string - return ret - } - return *o.Ddtags -} - -// GetDdtagsOk returns a tuple with the Ddtags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogItem) GetDdtagsOk() (*string, bool) { - if o == nil || o.Ddtags == nil { - return nil, false - } - return o.Ddtags, true -} - -// HasDdtags returns a boolean if a field has been set. -func (o *HTTPLogItem) HasDdtags() bool { - if o != nil && o.Ddtags != nil { - return true - } - - return false -} - -// SetDdtags gets a reference to the given string and assigns it to the Ddtags field. -func (o *HTTPLogItem) SetDdtags(v string) { - o.Ddtags = &v -} - -// GetHostname returns the Hostname field value if set, zero value otherwise. -func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasHostname() bool { - if o != nil && o.Hostname != nil { - return true - } - - return false -} - -// SetHostname gets a reference to the given string and assigns it to the Hostname field. -func (o *HTTPLogItem) SetHostname(v string) { - o.Hostname = &v -} - -// GetMessage returns the Message field value. -func (o *HTTPLogItem) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *HTTPLogItem) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *HTTPLogItem) SetMessage(v string) { - o.Message = v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *HTTPLogItem) SetService(v string) { - o.Service = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HTTPLogItem) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Ddsource != nil { - toSerialize["ddsource"] = o.Ddsource - } - if o.Ddtags != nil { - toSerialize["ddtags"] = o.Ddtags - } - if o.Hostname != nil { - toSerialize["hostname"] = o.Hostname - } - toSerialize["message"] = o.Message - if o.Service != nil { - toSerialize["service"] = o.Service - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Message *string `json:"message"` - }{} - all := struct { - Ddsource *string `json:"ddsource,omitempty"` - Ddtags *string `json:"ddtags,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Message string `json:"message"` - Service *string `json:"service,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Ddsource = all.Ddsource - o.Ddtags = all.Ddtags - o.Hostname = all.Hostname - o.Message = all.Message - o.Service = all.Service - return nil -} diff --git a/api/v1/datadog/model_http_method.go b/api/v1/datadog/model_http_method.go deleted file mode 100644 index 67c48f4b031..00000000000 --- a/api/v1/datadog/model_http_method.go +++ /dev/null @@ -1,119 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HTTPMethod The HTTP method. -type HTTPMethod string - -// List of HTTPMethod. -const ( - HTTPMETHOD_GET HTTPMethod = "GET" - HTTPMETHOD_POST HTTPMethod = "POST" - HTTPMETHOD_PATCH HTTPMethod = "PATCH" - HTTPMETHOD_PUT HTTPMethod = "PUT" - HTTPMETHOD_DELETE HTTPMethod = "DELETE" - HTTPMETHOD_HEAD HTTPMethod = "HEAD" - HTTPMETHOD_OPTIONS HTTPMethod = "OPTIONS" -) - -var allowedHTTPMethodEnumValues = []HTTPMethod{ - HTTPMETHOD_GET, - HTTPMETHOD_POST, - HTTPMETHOD_PATCH, - HTTPMETHOD_PUT, - HTTPMETHOD_DELETE, - HTTPMETHOD_HEAD, - HTTPMETHOD_OPTIONS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *HTTPMethod) GetAllowedValues() []HTTPMethod { - return allowedHTTPMethodEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *HTTPMethod) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = HTTPMethod(value) - return nil -} - -// NewHTTPMethodFromValue returns a pointer to a valid HTTPMethod -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewHTTPMethodFromValue(v string) (*HTTPMethod, error) { - ev := HTTPMethod(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for HTTPMethod: valid values are %v", v, allowedHTTPMethodEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v HTTPMethod) IsValid() bool { - for _, existing := range allowedHTTPMethodEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to HTTPMethod value. -func (v HTTPMethod) Ptr() *HTTPMethod { - return &v -} - -// NullableHTTPMethod handles when a null is used for HTTPMethod. -type NullableHTTPMethod struct { - value *HTTPMethod - isSet bool -} - -// Get returns the associated value. -func (v NullableHTTPMethod) Get() *HTTPMethod { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHTTPMethod) Set(val *HTTPMethod) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHTTPMethod) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHTTPMethod) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHTTPMethod initializes the struct as if Set has been called. -func NewNullableHTTPMethod(val *HTTPMethod) *NullableHTTPMethod { - return &NullableHTTPMethod{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHTTPMethod) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHTTPMethod) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_i_frame_widget_definition.go b/api/v1/datadog/model_i_frame_widget_definition.go deleted file mode 100644 index 1cf24743deb..00000000000 --- a/api/v1/datadog/model_i_frame_widget_definition.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IFrameWidgetDefinition The iframe widget allows you to embed a portion of any other web page on your dashboard. Only available on FREE layout dashboards. -type IFrameWidgetDefinition struct { - // Type of the iframe widget. - Type IFrameWidgetDefinitionType `json:"type"` - // URL of the iframe. - Url string `json:"url"` - // 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{} -} - -// NewIFrameWidgetDefinition instantiates a new IFrameWidgetDefinition 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 NewIFrameWidgetDefinition(typeVar IFrameWidgetDefinitionType, url string) *IFrameWidgetDefinition { - this := IFrameWidgetDefinition{} - this.Type = typeVar - this.Url = url - return &this -} - -// NewIFrameWidgetDefinitionWithDefaults instantiates a new IFrameWidgetDefinition 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 NewIFrameWidgetDefinitionWithDefaults() *IFrameWidgetDefinition { - this := IFrameWidgetDefinition{} - var typeVar IFrameWidgetDefinitionType = IFRAMEWIDGETDEFINITIONTYPE_IFRAME - this.Type = typeVar - return &this -} - -// GetType returns the Type field value. -func (o *IFrameWidgetDefinition) GetType() IFrameWidgetDefinitionType { - if o == nil { - var ret IFrameWidgetDefinitionType - 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 *IFrameWidgetDefinition) GetTypeOk() (*IFrameWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IFrameWidgetDefinition) SetType(v IFrameWidgetDefinitionType) { - o.Type = v -} - -// GetUrl returns the Url field value. -func (o *IFrameWidgetDefinition) GetUrl() string { - if o == nil { - var ret string - return ret - } - return o.Url -} - -// GetUrlOk returns a tuple with the Url field value -// and a boolean to check if the value has been set. -func (o *IFrameWidgetDefinition) GetUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Url, true -} - -// SetUrl sets field value. -func (o *IFrameWidgetDefinition) SetUrl(v string) { - o.Url = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IFrameWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["type"] = o.Type - toSerialize["url"] = o.Url - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IFrameWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *IFrameWidgetDefinitionType `json:"type"` - Url *string `json:"url"` - }{} - all := struct { - Type IFrameWidgetDefinitionType `json:"type"` - Url string `json:"url"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - if required.Url == nil { - return fmt.Errorf("Required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_i_frame_widget_definition_type.go b/api/v1/datadog/model_i_frame_widget_definition_type.go deleted file mode 100644 index 2005b4d9e08..00000000000 --- a/api/v1/datadog/model_i_frame_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IFrameWidgetDefinitionType Type of the iframe widget. -type IFrameWidgetDefinitionType string - -// List of IFrameWidgetDefinitionType. -const ( - IFRAMEWIDGETDEFINITIONTYPE_IFRAME IFrameWidgetDefinitionType = "iframe" -) - -var allowedIFrameWidgetDefinitionTypeEnumValues = []IFrameWidgetDefinitionType{ - IFRAMEWIDGETDEFINITIONTYPE_IFRAME, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IFrameWidgetDefinitionType) GetAllowedValues() []IFrameWidgetDefinitionType { - return allowedIFrameWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IFrameWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IFrameWidgetDefinitionType(value) - return nil -} - -// NewIFrameWidgetDefinitionTypeFromValue returns a pointer to a valid IFrameWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIFrameWidgetDefinitionTypeFromValue(v string) (*IFrameWidgetDefinitionType, error) { - ev := IFrameWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IFrameWidgetDefinitionType: valid values are %v", v, allowedIFrameWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IFrameWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedIFrameWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IFrameWidgetDefinitionType value. -func (v IFrameWidgetDefinitionType) Ptr() *IFrameWidgetDefinitionType { - return &v -} - -// NullableIFrameWidgetDefinitionType handles when a null is used for IFrameWidgetDefinitionType. -type NullableIFrameWidgetDefinitionType struct { - value *IFrameWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableIFrameWidgetDefinitionType) Get() *IFrameWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIFrameWidgetDefinitionType) Set(val *IFrameWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIFrameWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIFrameWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIFrameWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableIFrameWidgetDefinitionType(val *IFrameWidgetDefinitionType) *NullableIFrameWidgetDefinitionType { - return &NullableIFrameWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIFrameWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIFrameWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_idp_form_data.go b/api/v1/datadog/model_idp_form_data.go deleted file mode 100644 index 705e01006ba..00000000000 --- a/api/v1/datadog/model_idp_form_data.go +++ /dev/null @@ -1,104 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "os" -) - -// IdpFormData Object describing the IdP configuration. -type IdpFormData struct { - // The path to the XML metadata file you wish to upload. - IdpFile *os.File `json:"idp_file"` - // 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{} -} - -// NewIdpFormData instantiates a new IdpFormData 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 NewIdpFormData(idpFile *os.File) *IdpFormData { - this := IdpFormData{} - this.IdpFile = idpFile - return &this -} - -// NewIdpFormDataWithDefaults instantiates a new IdpFormData 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 NewIdpFormDataWithDefaults() *IdpFormData { - this := IdpFormData{} - return &this -} - -// GetIdpFile returns the IdpFile field value. -func (o *IdpFormData) GetIdpFile() *os.File { - if o == nil { - var ret *os.File - return ret - } - return o.IdpFile -} - -// GetIdpFileOk returns a tuple with the IdpFile field value -// and a boolean to check if the value has been set. -func (o *IdpFormData) GetIdpFileOk() (**os.File, bool) { - if o == nil { - return nil, false - } - return &o.IdpFile, true -} - -// SetIdpFile sets field value. -func (o *IdpFormData) SetIdpFile(v *os.File) { - o.IdpFile = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IdpFormData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["idp_file"] = o.IdpFile - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IdpFormData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - IdpFile **os.File `json:"idp_file"` - }{} - all := struct { - IdpFile *os.File `json:"idp_file"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IdpFile == nil { - return fmt.Errorf("Required field idp_file missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IdpFile = all.IdpFile - return nil -} diff --git a/api/v1/datadog/model_idp_response.go b/api/v1/datadog/model_idp_response.go deleted file mode 100644 index 4d73383655d..00000000000 --- a/api/v1/datadog/model_idp_response.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IdpResponse The IdP response object. -type IdpResponse struct { - // Identity provider response. - Message string `json:"message"` - // 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{} -} - -// NewIdpResponse instantiates a new IdpResponse 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 NewIdpResponse(message string) *IdpResponse { - this := IdpResponse{} - this.Message = message - return &this -} - -// NewIdpResponseWithDefaults instantiates a new IdpResponse 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 NewIdpResponseWithDefaults() *IdpResponse { - this := IdpResponse{} - return &this -} - -// GetMessage returns the Message field value. -func (o *IdpResponse) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *IdpResponse) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *IdpResponse) SetMessage(v string) { - o.Message = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IdpResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["message"] = o.Message - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IdpResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Message *string `json:"message"` - }{} - all := struct { - Message string `json:"message"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_image_widget_definition.go b/api/v1/datadog/model_image_widget_definition.go deleted file mode 100644 index d790e9251ef..00000000000 --- a/api/v1/datadog/model_image_widget_definition.go +++ /dev/null @@ -1,461 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ImageWidgetDefinition The image widget allows you to embed an image on your dashboard. An image can be a PNG, JPG, or animated GIF. Only available on FREE layout dashboards. -type ImageWidgetDefinition struct { - // Whether to display a background or not. - HasBackground *bool `json:"has_background,omitempty"` - // Whether to display a border or not. - HasBorder *bool `json:"has_border,omitempty"` - // Horizontal alignment. - HorizontalAlign *WidgetHorizontalAlign `json:"horizontal_align,omitempty"` - // Size of the margins around the image. - // **Note**: `small` and `large` values are deprecated. - Margin *WidgetMargin `json:"margin,omitempty"` - // How to size the image on the widget. The values are based on the image `object-fit` CSS properties. - // **Note**: `zoom`, `fit` and `center` values are deprecated. - Sizing *WidgetImageSizing `json:"sizing,omitempty"` - // Type of the image widget. - Type ImageWidgetDefinitionType `json:"type"` - // URL of the image. - Url string `json:"url"` - // URL of the image in dark mode. - UrlDarkTheme *string `json:"url_dark_theme,omitempty"` - // Vertical alignment. - VerticalAlign *WidgetVerticalAlign `json:"vertical_align,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{} -} - -// NewImageWidgetDefinition instantiates a new ImageWidgetDefinition 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 NewImageWidgetDefinition(typeVar ImageWidgetDefinitionType, url string) *ImageWidgetDefinition { - this := ImageWidgetDefinition{} - var hasBackground bool = true - this.HasBackground = &hasBackground - var hasBorder bool = true - this.HasBorder = &hasBorder - this.Type = typeVar - this.Url = url - return &this -} - -// NewImageWidgetDefinitionWithDefaults instantiates a new ImageWidgetDefinition 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 NewImageWidgetDefinitionWithDefaults() *ImageWidgetDefinition { - this := ImageWidgetDefinition{} - var hasBackground bool = true - this.HasBackground = &hasBackground - var hasBorder bool = true - this.HasBorder = &hasBorder - var typeVar ImageWidgetDefinitionType = IMAGEWIDGETDEFINITIONTYPE_IMAGE - this.Type = typeVar - return &this -} - -// GetHasBackground returns the HasBackground field value if set, zero value otherwise. -func (o *ImageWidgetDefinition) GetHasBackground() bool { - if o == nil || o.HasBackground == nil { - var ret bool - return ret - } - return *o.HasBackground -} - -// GetHasBackgroundOk returns a tuple with the HasBackground field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetHasBackgroundOk() (*bool, bool) { - if o == nil || o.HasBackground == nil { - return nil, false - } - return o.HasBackground, true -} - -// HasHasBackground returns a boolean if a field has been set. -func (o *ImageWidgetDefinition) HasHasBackground() bool { - if o != nil && o.HasBackground != nil { - return true - } - - return false -} - -// SetHasBackground gets a reference to the given bool and assigns it to the HasBackground field. -func (o *ImageWidgetDefinition) SetHasBackground(v bool) { - o.HasBackground = &v -} - -// GetHasBorder returns the HasBorder field value if set, zero value otherwise. -func (o *ImageWidgetDefinition) GetHasBorder() bool { - if o == nil || o.HasBorder == nil { - var ret bool - return ret - } - return *o.HasBorder -} - -// GetHasBorderOk returns a tuple with the HasBorder field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetHasBorderOk() (*bool, bool) { - if o == nil || o.HasBorder == nil { - return nil, false - } - return o.HasBorder, true -} - -// HasHasBorder returns a boolean if a field has been set. -func (o *ImageWidgetDefinition) HasHasBorder() bool { - if o != nil && o.HasBorder != nil { - return true - } - - return false -} - -// SetHasBorder gets a reference to the given bool and assigns it to the HasBorder field. -func (o *ImageWidgetDefinition) SetHasBorder(v bool) { - o.HasBorder = &v -} - -// GetHorizontalAlign returns the HorizontalAlign field value if set, zero value otherwise. -func (o *ImageWidgetDefinition) GetHorizontalAlign() WidgetHorizontalAlign { - if o == nil || o.HorizontalAlign == nil { - var ret WidgetHorizontalAlign - return ret - } - return *o.HorizontalAlign -} - -// GetHorizontalAlignOk returns a tuple with the HorizontalAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetHorizontalAlignOk() (*WidgetHorizontalAlign, bool) { - if o == nil || o.HorizontalAlign == nil { - return nil, false - } - return o.HorizontalAlign, true -} - -// HasHorizontalAlign returns a boolean if a field has been set. -func (o *ImageWidgetDefinition) HasHorizontalAlign() bool { - if o != nil && o.HorizontalAlign != nil { - return true - } - - return false -} - -// SetHorizontalAlign gets a reference to the given WidgetHorizontalAlign and assigns it to the HorizontalAlign field. -func (o *ImageWidgetDefinition) SetHorizontalAlign(v WidgetHorizontalAlign) { - o.HorizontalAlign = &v -} - -// GetMargin returns the Margin field value if set, zero value otherwise. -func (o *ImageWidgetDefinition) GetMargin() WidgetMargin { - if o == nil || o.Margin == nil { - var ret WidgetMargin - return ret - } - return *o.Margin -} - -// GetMarginOk returns a tuple with the Margin field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetMarginOk() (*WidgetMargin, bool) { - if o == nil || o.Margin == nil { - return nil, false - } - return o.Margin, true -} - -// HasMargin returns a boolean if a field has been set. -func (o *ImageWidgetDefinition) HasMargin() bool { - if o != nil && o.Margin != nil { - return true - } - - return false -} - -// SetMargin gets a reference to the given WidgetMargin and assigns it to the Margin field. -func (o *ImageWidgetDefinition) SetMargin(v WidgetMargin) { - o.Margin = &v -} - -// GetSizing returns the Sizing field value if set, zero value otherwise. -func (o *ImageWidgetDefinition) GetSizing() WidgetImageSizing { - if o == nil || o.Sizing == nil { - var ret WidgetImageSizing - return ret - } - return *o.Sizing -} - -// GetSizingOk returns a tuple with the Sizing field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetSizingOk() (*WidgetImageSizing, bool) { - if o == nil || o.Sizing == nil { - return nil, false - } - return o.Sizing, true -} - -// HasSizing returns a boolean if a field has been set. -func (o *ImageWidgetDefinition) HasSizing() bool { - if o != nil && o.Sizing != nil { - return true - } - - return false -} - -// SetSizing gets a reference to the given WidgetImageSizing and assigns it to the Sizing field. -func (o *ImageWidgetDefinition) SetSizing(v WidgetImageSizing) { - o.Sizing = &v -} - -// GetType returns the Type field value. -func (o *ImageWidgetDefinition) GetType() ImageWidgetDefinitionType { - if o == nil { - var ret ImageWidgetDefinitionType - 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 *ImageWidgetDefinition) GetTypeOk() (*ImageWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ImageWidgetDefinition) SetType(v ImageWidgetDefinitionType) { - o.Type = v -} - -// GetUrl returns the Url field value. -func (o *ImageWidgetDefinition) GetUrl() string { - if o == nil { - var ret string - return ret - } - return o.Url -} - -// GetUrlOk returns a tuple with the Url field value -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Url, true -} - -// SetUrl sets field value. -func (o *ImageWidgetDefinition) SetUrl(v string) { - o.Url = v -} - -// GetUrlDarkTheme returns the UrlDarkTheme field value if set, zero value otherwise. -func (o *ImageWidgetDefinition) GetUrlDarkTheme() string { - if o == nil || o.UrlDarkTheme == nil { - var ret string - return ret - } - return *o.UrlDarkTheme -} - -// GetUrlDarkThemeOk returns a tuple with the UrlDarkTheme field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetUrlDarkThemeOk() (*string, bool) { - if o == nil || o.UrlDarkTheme == nil { - return nil, false - } - return o.UrlDarkTheme, true -} - -// HasUrlDarkTheme returns a boolean if a field has been set. -func (o *ImageWidgetDefinition) HasUrlDarkTheme() bool { - if o != nil && o.UrlDarkTheme != nil { - return true - } - - return false -} - -// SetUrlDarkTheme gets a reference to the given string and assigns it to the UrlDarkTheme field. -func (o *ImageWidgetDefinition) SetUrlDarkTheme(v string) { - o.UrlDarkTheme = &v -} - -// GetVerticalAlign returns the VerticalAlign field value if set, zero value otherwise. -func (o *ImageWidgetDefinition) GetVerticalAlign() WidgetVerticalAlign { - if o == nil || o.VerticalAlign == nil { - var ret WidgetVerticalAlign - return ret - } - return *o.VerticalAlign -} - -// GetVerticalAlignOk returns a tuple with the VerticalAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ImageWidgetDefinition) GetVerticalAlignOk() (*WidgetVerticalAlign, bool) { - if o == nil || o.VerticalAlign == nil { - return nil, false - } - return o.VerticalAlign, true -} - -// HasVerticalAlign returns a boolean if a field has been set. -func (o *ImageWidgetDefinition) HasVerticalAlign() bool { - if o != nil && o.VerticalAlign != nil { - return true - } - - return false -} - -// SetVerticalAlign gets a reference to the given WidgetVerticalAlign and assigns it to the VerticalAlign field. -func (o *ImageWidgetDefinition) SetVerticalAlign(v WidgetVerticalAlign) { - o.VerticalAlign = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ImageWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.HasBackground != nil { - toSerialize["has_background"] = o.HasBackground - } - if o.HasBorder != nil { - toSerialize["has_border"] = o.HasBorder - } - if o.HorizontalAlign != nil { - toSerialize["horizontal_align"] = o.HorizontalAlign - } - if o.Margin != nil { - toSerialize["margin"] = o.Margin - } - if o.Sizing != nil { - toSerialize["sizing"] = o.Sizing - } - toSerialize["type"] = o.Type - toSerialize["url"] = o.Url - if o.UrlDarkTheme != nil { - toSerialize["url_dark_theme"] = o.UrlDarkTheme - } - if o.VerticalAlign != nil { - toSerialize["vertical_align"] = o.VerticalAlign - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *ImageWidgetDefinitionType `json:"type"` - Url *string `json:"url"` - }{} - all := struct { - HasBackground *bool `json:"has_background,omitempty"` - HasBorder *bool `json:"has_border,omitempty"` - HorizontalAlign *WidgetHorizontalAlign `json:"horizontal_align,omitempty"` - Margin *WidgetMargin `json:"margin,omitempty"` - Sizing *WidgetImageSizing `json:"sizing,omitempty"` - Type ImageWidgetDefinitionType `json:"type"` - Url string `json:"url"` - UrlDarkTheme *string `json:"url_dark_theme,omitempty"` - VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - if required.Url == nil { - return fmt.Errorf("Required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.HorizontalAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Margin; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sizing; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.VerticalAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.HasBackground = all.HasBackground - o.HasBorder = all.HasBorder - o.HorizontalAlign = all.HorizontalAlign - o.Margin = all.Margin - o.Sizing = all.Sizing - o.Type = all.Type - o.Url = all.Url - o.UrlDarkTheme = all.UrlDarkTheme - o.VerticalAlign = all.VerticalAlign - return nil -} diff --git a/api/v1/datadog/model_image_widget_definition_type.go b/api/v1/datadog/model_image_widget_definition_type.go deleted file mode 100644 index 7949b31af90..00000000000 --- a/api/v1/datadog/model_image_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ImageWidgetDefinitionType Type of the image widget. -type ImageWidgetDefinitionType string - -// List of ImageWidgetDefinitionType. -const ( - IMAGEWIDGETDEFINITIONTYPE_IMAGE ImageWidgetDefinitionType = "image" -) - -var allowedImageWidgetDefinitionTypeEnumValues = []ImageWidgetDefinitionType{ - IMAGEWIDGETDEFINITIONTYPE_IMAGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ImageWidgetDefinitionType) GetAllowedValues() []ImageWidgetDefinitionType { - return allowedImageWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ImageWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ImageWidgetDefinitionType(value) - return nil -} - -// NewImageWidgetDefinitionTypeFromValue returns a pointer to a valid ImageWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewImageWidgetDefinitionTypeFromValue(v string) (*ImageWidgetDefinitionType, error) { - ev := ImageWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ImageWidgetDefinitionType: valid values are %v", v, allowedImageWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ImageWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedImageWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ImageWidgetDefinitionType value. -func (v ImageWidgetDefinitionType) Ptr() *ImageWidgetDefinitionType { - return &v -} - -// NullableImageWidgetDefinitionType handles when a null is used for ImageWidgetDefinitionType. -type NullableImageWidgetDefinitionType struct { - value *ImageWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableImageWidgetDefinitionType) Get() *ImageWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableImageWidgetDefinitionType) Set(val *ImageWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableImageWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableImageWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableImageWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableImageWidgetDefinitionType(val *ImageWidgetDefinitionType) *NullableImageWidgetDefinitionType { - return &NullableImageWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableImageWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableImageWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_intake_payload_accepted.go b/api/v1/datadog/model_intake_payload_accepted.go deleted file mode 100644 index 28de606ebf6..00000000000 --- a/api/v1/datadog/model_intake_payload_accepted.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IntakePayloadAccepted The payload accepted for intake. -type IntakePayloadAccepted struct { - // The status of the intake payload. - Status *string `json:"status,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{} -} - -// NewIntakePayloadAccepted instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAccepted() *IntakePayloadAccepted { - this := IntakePayloadAccepted{} - return &this -} - -// NewIntakePayloadAcceptedWithDefaults instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAcceptedWithDefaults() *IntakePayloadAccepted { - this := IntakePayloadAccepted{} - return &this -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *IntakePayloadAccepted) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IntakePayloadAccepted) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *IntakePayloadAccepted) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *IntakePayloadAccepted) SetStatus(v string) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IntakePayloadAccepted) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Status *string `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_agents.go b/api/v1/datadog/model_ip_prefixes_agents.go deleted file mode 100644 index 22d8a7730b4..00000000000 --- a/api/v1/datadog/model_ip_prefixes_agents.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesAgents Available prefix information for the Agent endpoints. -type IPPrefixesAgents struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,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{} -} - -// NewIPPrefixesAgents instantiates a new IPPrefixesAgents 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 NewIPPrefixesAgents() *IPPrefixesAgents { - this := IPPrefixesAgents{} - return &this -} - -// NewIPPrefixesAgentsWithDefaults instantiates a new IPPrefixesAgents 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 NewIPPrefixesAgentsWithDefaults() *IPPrefixesAgents { - this := IPPrefixesAgents{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesAgents) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesAgents) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesAgents) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesAgents) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesAgents) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesAgents) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesAgents) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesAgents) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesAgents) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesAgents) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv6 = all.PrefixesIpv6 - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_api.go b/api/v1/datadog/model_ip_prefixes_api.go deleted file mode 100644 index 4a9bf056e7a..00000000000 --- a/api/v1/datadog/model_ip_prefixes_api.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesAPI Available prefix information for the API endpoints. -type IPPrefixesAPI struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,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{} -} - -// NewIPPrefixesAPI instantiates a new IPPrefixesAPI 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 NewIPPrefixesAPI() *IPPrefixesAPI { - this := IPPrefixesAPI{} - return &this -} - -// NewIPPrefixesAPIWithDefaults instantiates a new IPPrefixesAPI 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 NewIPPrefixesAPIWithDefaults() *IPPrefixesAPI { - this := IPPrefixesAPI{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesAPI) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesAPI) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesAPI) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesAPI) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesAPI) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesAPI) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesAPI) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesAPI) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesAPI) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesAPI) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv6 = all.PrefixesIpv6 - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_apm.go b/api/v1/datadog/model_ip_prefixes_apm.go deleted file mode 100644 index 90aec8a5478..00000000000 --- a/api/v1/datadog/model_ip_prefixes_apm.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesAPM Available prefix information for the APM endpoints. -type IPPrefixesAPM struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,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{} -} - -// NewIPPrefixesAPM instantiates a new IPPrefixesAPM 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 NewIPPrefixesAPM() *IPPrefixesAPM { - this := IPPrefixesAPM{} - return &this -} - -// NewIPPrefixesAPMWithDefaults instantiates a new IPPrefixesAPM 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 NewIPPrefixesAPMWithDefaults() *IPPrefixesAPM { - this := IPPrefixesAPM{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesAPM) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesAPM) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesAPM) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesAPM) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesAPM) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesAPM) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesAPM) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesAPM) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesAPM) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesAPM) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv6 = all.PrefixesIpv6 - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_logs.go b/api/v1/datadog/model_ip_prefixes_logs.go deleted file mode 100644 index f2c5f1efb7f..00000000000 --- a/api/v1/datadog/model_ip_prefixes_logs.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesLogs Available prefix information for the Logs endpoints. -type IPPrefixesLogs struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,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{} -} - -// NewIPPrefixesLogs instantiates a new IPPrefixesLogs 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 NewIPPrefixesLogs() *IPPrefixesLogs { - this := IPPrefixesLogs{} - return &this -} - -// NewIPPrefixesLogsWithDefaults instantiates a new IPPrefixesLogs 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 NewIPPrefixesLogsWithDefaults() *IPPrefixesLogs { - this := IPPrefixesLogs{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesLogs) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesLogs) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesLogs) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesLogs) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesLogs) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesLogs) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesLogs) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesLogs) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesLogs) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesLogs) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv6 = all.PrefixesIpv6 - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_process.go b/api/v1/datadog/model_ip_prefixes_process.go deleted file mode 100644 index ee432fec530..00000000000 --- a/api/v1/datadog/model_ip_prefixes_process.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesProcess Available prefix information for the Process endpoints. -type IPPrefixesProcess struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,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{} -} - -// NewIPPrefixesProcess instantiates a new IPPrefixesProcess 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 NewIPPrefixesProcess() *IPPrefixesProcess { - this := IPPrefixesProcess{} - return &this -} - -// NewIPPrefixesProcessWithDefaults instantiates a new IPPrefixesProcess 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 NewIPPrefixesProcessWithDefaults() *IPPrefixesProcess { - this := IPPrefixesProcess{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesProcess) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesProcess) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesProcess) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesProcess) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesProcess) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesProcess) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesProcess) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesProcess) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesProcess) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesProcess) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv6 = all.PrefixesIpv6 - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_synthetics.go b/api/v1/datadog/model_ip_prefixes_synthetics.go deleted file mode 100644 index 2d9c84eb20d..00000000000 --- a/api/v1/datadog/model_ip_prefixes_synthetics.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesSynthetics Available prefix information for the Synthetics endpoints. -type IPPrefixesSynthetics struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv4 prefixes by location. - PrefixesIpv4ByLocation map[string][]string `json:"prefixes_ipv4_by_location,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - // List of IPv6 prefixes by location. - PrefixesIpv6ByLocation map[string][]string `json:"prefixes_ipv6_by_location,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{} -} - -// NewIPPrefixesSynthetics instantiates a new IPPrefixesSynthetics 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 NewIPPrefixesSynthetics() *IPPrefixesSynthetics { - this := IPPrefixesSynthetics{} - return &this -} - -// NewIPPrefixesSyntheticsWithDefaults instantiates a new IPPrefixesSynthetics 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 NewIPPrefixesSyntheticsWithDefaults() *IPPrefixesSynthetics { - this := IPPrefixesSynthetics{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesSynthetics) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesSynthetics) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesSynthetics) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesSynthetics) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv4ByLocation returns the PrefixesIpv4ByLocation field value if set, zero value otherwise. -func (o *IPPrefixesSynthetics) GetPrefixesIpv4ByLocation() map[string][]string { - if o == nil || o.PrefixesIpv4ByLocation == nil { - var ret map[string][]string - return ret - } - return o.PrefixesIpv4ByLocation -} - -// GetPrefixesIpv4ByLocationOk returns a tuple with the PrefixesIpv4ByLocation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesSynthetics) GetPrefixesIpv4ByLocationOk() (*map[string][]string, bool) { - if o == nil || o.PrefixesIpv4ByLocation == nil { - return nil, false - } - return &o.PrefixesIpv4ByLocation, true -} - -// HasPrefixesIpv4ByLocation returns a boolean if a field has been set. -func (o *IPPrefixesSynthetics) HasPrefixesIpv4ByLocation() bool { - if o != nil && o.PrefixesIpv4ByLocation != nil { - return true - } - - return false -} - -// SetPrefixesIpv4ByLocation gets a reference to the given map[string][]string and assigns it to the PrefixesIpv4ByLocation field. -func (o *IPPrefixesSynthetics) SetPrefixesIpv4ByLocation(v map[string][]string) { - o.PrefixesIpv4ByLocation = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesSynthetics) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesSynthetics) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesSynthetics) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesSynthetics) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// GetPrefixesIpv6ByLocation returns the PrefixesIpv6ByLocation field value if set, zero value otherwise. -func (o *IPPrefixesSynthetics) GetPrefixesIpv6ByLocation() map[string][]string { - if o == nil || o.PrefixesIpv6ByLocation == nil { - var ret map[string][]string - return ret - } - return o.PrefixesIpv6ByLocation -} - -// GetPrefixesIpv6ByLocationOk returns a tuple with the PrefixesIpv6ByLocation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesSynthetics) GetPrefixesIpv6ByLocationOk() (*map[string][]string, bool) { - if o == nil || o.PrefixesIpv6ByLocation == nil { - return nil, false - } - return &o.PrefixesIpv6ByLocation, true -} - -// HasPrefixesIpv6ByLocation returns a boolean if a field has been set. -func (o *IPPrefixesSynthetics) HasPrefixesIpv6ByLocation() bool { - if o != nil && o.PrefixesIpv6ByLocation != nil { - return true - } - - return false -} - -// SetPrefixesIpv6ByLocation gets a reference to the given map[string][]string and assigns it to the PrefixesIpv6ByLocation field. -func (o *IPPrefixesSynthetics) SetPrefixesIpv6ByLocation(v map[string][]string) { - o.PrefixesIpv6ByLocation = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesSynthetics) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv4ByLocation != nil { - toSerialize["prefixes_ipv4_by_location"] = o.PrefixesIpv4ByLocation - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - if o.PrefixesIpv6ByLocation != nil { - toSerialize["prefixes_ipv6_by_location"] = o.PrefixesIpv6ByLocation - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesSynthetics) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv4ByLocation map[string][]string `json:"prefixes_ipv4_by_location,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - PrefixesIpv6ByLocation map[string][]string `json:"prefixes_ipv6_by_location,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv4ByLocation = all.PrefixesIpv4ByLocation - o.PrefixesIpv6 = all.PrefixesIpv6 - o.PrefixesIpv6ByLocation = all.PrefixesIpv6ByLocation - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go b/api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go deleted file mode 100644 index d9e3bc41c71..00000000000 --- a/api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesSyntheticsPrivateLocations Available prefix information for the Synthetics Private Locations endpoints. -type IPPrefixesSyntheticsPrivateLocations struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,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{} -} - -// NewIPPrefixesSyntheticsPrivateLocations instantiates a new IPPrefixesSyntheticsPrivateLocations 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 NewIPPrefixesSyntheticsPrivateLocations() *IPPrefixesSyntheticsPrivateLocations { - this := IPPrefixesSyntheticsPrivateLocations{} - return &this -} - -// NewIPPrefixesSyntheticsPrivateLocationsWithDefaults instantiates a new IPPrefixesSyntheticsPrivateLocations 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 NewIPPrefixesSyntheticsPrivateLocationsWithDefaults() *IPPrefixesSyntheticsPrivateLocations { - this := IPPrefixesSyntheticsPrivateLocations{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesSyntheticsPrivateLocations) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesSyntheticsPrivateLocations) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesSyntheticsPrivateLocations) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesSyntheticsPrivateLocations) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesSyntheticsPrivateLocations) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesSyntheticsPrivateLocations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv6 = all.PrefixesIpv6 - return nil -} diff --git a/api/v1/datadog/model_ip_prefixes_webhooks.go b/api/v1/datadog/model_ip_prefixes_webhooks.go deleted file mode 100644 index feebfe969e5..00000000000 --- a/api/v1/datadog/model_ip_prefixes_webhooks.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPPrefixesWebhooks Available prefix information for the Webhook endpoints. -type IPPrefixesWebhooks struct { - // List of IPv4 prefixes. - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - // List of IPv6 prefixes. - PrefixesIpv6 []string `json:"prefixes_ipv6,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{} -} - -// NewIPPrefixesWebhooks instantiates a new IPPrefixesWebhooks 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 NewIPPrefixesWebhooks() *IPPrefixesWebhooks { - this := IPPrefixesWebhooks{} - return &this -} - -// NewIPPrefixesWebhooksWithDefaults instantiates a new IPPrefixesWebhooks 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 NewIPPrefixesWebhooksWithDefaults() *IPPrefixesWebhooks { - this := IPPrefixesWebhooks{} - return &this -} - -// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. -func (o *IPPrefixesWebhooks) GetPrefixesIpv4() []string { - if o == nil || o.PrefixesIpv4 == nil { - var ret []string - return ret - } - return o.PrefixesIpv4 -} - -// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesWebhooks) GetPrefixesIpv4Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv4 == nil { - return nil, false - } - return &o.PrefixesIpv4, true -} - -// HasPrefixesIpv4 returns a boolean if a field has been set. -func (o *IPPrefixesWebhooks) HasPrefixesIpv4() bool { - if o != nil && o.PrefixesIpv4 != nil { - return true - } - - return false -} - -// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. -func (o *IPPrefixesWebhooks) SetPrefixesIpv4(v []string) { - o.PrefixesIpv4 = v -} - -// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. -func (o *IPPrefixesWebhooks) GetPrefixesIpv6() []string { - if o == nil || o.PrefixesIpv6 == nil { - var ret []string - return ret - } - return o.PrefixesIpv6 -} - -// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPPrefixesWebhooks) GetPrefixesIpv6Ok() (*[]string, bool) { - if o == nil || o.PrefixesIpv6 == nil { - return nil, false - } - return &o.PrefixesIpv6, true -} - -// HasPrefixesIpv6 returns a boolean if a field has been set. -func (o *IPPrefixesWebhooks) HasPrefixesIpv6() bool { - if o != nil && o.PrefixesIpv6 != nil { - return true - } - - return false -} - -// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. -func (o *IPPrefixesWebhooks) SetPrefixesIpv6(v []string) { - o.PrefixesIpv6 = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPPrefixesWebhooks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrefixesIpv4 != nil { - toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 - } - if o.PrefixesIpv6 != nil { - toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPPrefixesWebhooks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` - PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrefixesIpv4 = all.PrefixesIpv4 - o.PrefixesIpv6 = all.PrefixesIpv6 - return nil -} diff --git a/api/v1/datadog/model_ip_ranges.go b/api/v1/datadog/model_ip_ranges.go deleted file mode 100644 index 647124d46ce..00000000000 --- a/api/v1/datadog/model_ip_ranges.go +++ /dev/null @@ -1,509 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IPRanges IP ranges. -type IPRanges struct { - // Available prefix information for the Agent endpoints. - Agents *IPPrefixesAgents `json:"agents,omitempty"` - // Available prefix information for the API endpoints. - Api *IPPrefixesAPI `json:"api,omitempty"` - // Available prefix information for the APM endpoints. - Apm *IPPrefixesAPM `json:"apm,omitempty"` - // Available prefix information for the Logs endpoints. - Logs *IPPrefixesLogs `json:"logs,omitempty"` - // Date when last updated, in the form `YYYY-MM-DD-hh-mm-ss`. - Modified *string `json:"modified,omitempty"` - // Available prefix information for the Process endpoints. - Process *IPPrefixesProcess `json:"process,omitempty"` - // Available prefix information for the Synthetics endpoints. - Synthetics *IPPrefixesSynthetics `json:"synthetics,omitempty"` - // Available prefix information for the Synthetics Private Locations endpoints. - SyntheticsPrivateLocations *IPPrefixesSyntheticsPrivateLocations `json:"synthetics-private-locations,omitempty"` - // Version of the IP list. - Version *int64 `json:"version,omitempty"` - // Available prefix information for the Webhook endpoints. - Webhooks *IPPrefixesWebhooks `json:"webhooks,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{} -} - -// NewIPRanges instantiates a new IPRanges 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 NewIPRanges() *IPRanges { - this := IPRanges{} - return &this -} - -// NewIPRangesWithDefaults instantiates a new IPRanges 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 NewIPRangesWithDefaults() *IPRanges { - this := IPRanges{} - return &this -} - -// GetAgents returns the Agents field value if set, zero value otherwise. -func (o *IPRanges) GetAgents() IPPrefixesAgents { - if o == nil || o.Agents == nil { - var ret IPPrefixesAgents - return ret - } - return *o.Agents -} - -// GetAgentsOk returns a tuple with the Agents field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetAgentsOk() (*IPPrefixesAgents, bool) { - if o == nil || o.Agents == nil { - return nil, false - } - return o.Agents, true -} - -// HasAgents returns a boolean if a field has been set. -func (o *IPRanges) HasAgents() bool { - if o != nil && o.Agents != nil { - return true - } - - return false -} - -// SetAgents gets a reference to the given IPPrefixesAgents and assigns it to the Agents field. -func (o *IPRanges) SetAgents(v IPPrefixesAgents) { - o.Agents = &v -} - -// GetApi returns the Api field value if set, zero value otherwise. -func (o *IPRanges) GetApi() IPPrefixesAPI { - if o == nil || o.Api == nil { - var ret IPPrefixesAPI - return ret - } - return *o.Api -} - -// GetApiOk returns a tuple with the Api field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetApiOk() (*IPPrefixesAPI, bool) { - if o == nil || o.Api == nil { - return nil, false - } - return o.Api, true -} - -// HasApi returns a boolean if a field has been set. -func (o *IPRanges) HasApi() bool { - if o != nil && o.Api != nil { - return true - } - - return false -} - -// SetApi gets a reference to the given IPPrefixesAPI and assigns it to the Api field. -func (o *IPRanges) SetApi(v IPPrefixesAPI) { - o.Api = &v -} - -// GetApm returns the Apm field value if set, zero value otherwise. -func (o *IPRanges) GetApm() IPPrefixesAPM { - if o == nil || o.Apm == nil { - var ret IPPrefixesAPM - return ret - } - return *o.Apm -} - -// GetApmOk returns a tuple with the Apm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetApmOk() (*IPPrefixesAPM, bool) { - if o == nil || o.Apm == nil { - return nil, false - } - return o.Apm, true -} - -// HasApm returns a boolean if a field has been set. -func (o *IPRanges) HasApm() bool { - if o != nil && o.Apm != nil { - return true - } - - return false -} - -// SetApm gets a reference to the given IPPrefixesAPM and assigns it to the Apm field. -func (o *IPRanges) SetApm(v IPPrefixesAPM) { - o.Apm = &v -} - -// GetLogs returns the Logs field value if set, zero value otherwise. -func (o *IPRanges) GetLogs() IPPrefixesLogs { - if o == nil || o.Logs == nil { - var ret IPPrefixesLogs - return ret - } - return *o.Logs -} - -// GetLogsOk returns a tuple with the Logs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetLogsOk() (*IPPrefixesLogs, bool) { - if o == nil || o.Logs == nil { - return nil, false - } - return o.Logs, true -} - -// HasLogs returns a boolean if a field has been set. -func (o *IPRanges) HasLogs() bool { - if o != nil && o.Logs != nil { - return true - } - - return false -} - -// SetLogs gets a reference to the given IPPrefixesLogs and assigns it to the Logs field. -func (o *IPRanges) SetLogs(v IPPrefixesLogs) { - o.Logs = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *IPRanges) GetModified() string { - if o == nil || o.Modified == nil { - var ret string - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetModifiedOk() (*string, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *IPRanges) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given string and assigns it to the Modified field. -func (o *IPRanges) SetModified(v string) { - o.Modified = &v -} - -// GetProcess returns the Process field value if set, zero value otherwise. -func (o *IPRanges) GetProcess() IPPrefixesProcess { - if o == nil || o.Process == nil { - var ret IPPrefixesProcess - return ret - } - return *o.Process -} - -// GetProcessOk returns a tuple with the Process field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetProcessOk() (*IPPrefixesProcess, bool) { - if o == nil || o.Process == nil { - return nil, false - } - return o.Process, true -} - -// HasProcess returns a boolean if a field has been set. -func (o *IPRanges) HasProcess() bool { - if o != nil && o.Process != nil { - return true - } - - return false -} - -// SetProcess gets a reference to the given IPPrefixesProcess and assigns it to the Process field. -func (o *IPRanges) SetProcess(v IPPrefixesProcess) { - o.Process = &v -} - -// GetSynthetics returns the Synthetics field value if set, zero value otherwise. -func (o *IPRanges) GetSynthetics() IPPrefixesSynthetics { - if o == nil || o.Synthetics == nil { - var ret IPPrefixesSynthetics - return ret - } - return *o.Synthetics -} - -// GetSyntheticsOk returns a tuple with the Synthetics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetSyntheticsOk() (*IPPrefixesSynthetics, bool) { - if o == nil || o.Synthetics == nil { - return nil, false - } - return o.Synthetics, true -} - -// HasSynthetics returns a boolean if a field has been set. -func (o *IPRanges) HasSynthetics() bool { - if o != nil && o.Synthetics != nil { - return true - } - - return false -} - -// SetSynthetics gets a reference to the given IPPrefixesSynthetics and assigns it to the Synthetics field. -func (o *IPRanges) SetSynthetics(v IPPrefixesSynthetics) { - o.Synthetics = &v -} - -// GetSyntheticsPrivateLocations returns the SyntheticsPrivateLocations field value if set, zero value otherwise. -func (o *IPRanges) GetSyntheticsPrivateLocations() IPPrefixesSyntheticsPrivateLocations { - if o == nil || o.SyntheticsPrivateLocations == nil { - var ret IPPrefixesSyntheticsPrivateLocations - return ret - } - return *o.SyntheticsPrivateLocations -} - -// GetSyntheticsPrivateLocationsOk returns a tuple with the SyntheticsPrivateLocations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetSyntheticsPrivateLocationsOk() (*IPPrefixesSyntheticsPrivateLocations, bool) { - if o == nil || o.SyntheticsPrivateLocations == nil { - return nil, false - } - return o.SyntheticsPrivateLocations, true -} - -// HasSyntheticsPrivateLocations returns a boolean if a field has been set. -func (o *IPRanges) HasSyntheticsPrivateLocations() bool { - if o != nil && o.SyntheticsPrivateLocations != nil { - return true - } - - return false -} - -// SetSyntheticsPrivateLocations gets a reference to the given IPPrefixesSyntheticsPrivateLocations and assigns it to the SyntheticsPrivateLocations field. -func (o *IPRanges) SetSyntheticsPrivateLocations(v IPPrefixesSyntheticsPrivateLocations) { - o.SyntheticsPrivateLocations = &v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *IPRanges) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *IPRanges) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *IPRanges) SetVersion(v int64) { - o.Version = &v -} - -// GetWebhooks returns the Webhooks field value if set, zero value otherwise. -func (o *IPRanges) GetWebhooks() IPPrefixesWebhooks { - if o == nil || o.Webhooks == nil { - var ret IPPrefixesWebhooks - return ret - } - return *o.Webhooks -} - -// GetWebhooksOk returns a tuple with the Webhooks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IPRanges) GetWebhooksOk() (*IPPrefixesWebhooks, bool) { - if o == nil || o.Webhooks == nil { - return nil, false - } - return o.Webhooks, true -} - -// HasWebhooks returns a boolean if a field has been set. -func (o *IPRanges) HasWebhooks() bool { - if o != nil && o.Webhooks != nil { - return true - } - - return false -} - -// SetWebhooks gets a reference to the given IPPrefixesWebhooks and assigns it to the Webhooks field. -func (o *IPRanges) SetWebhooks(v IPPrefixesWebhooks) { - o.Webhooks = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IPRanges) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Agents != nil { - toSerialize["agents"] = o.Agents - } - if o.Api != nil { - toSerialize["api"] = o.Api - } - if o.Apm != nil { - toSerialize["apm"] = o.Apm - } - if o.Logs != nil { - toSerialize["logs"] = o.Logs - } - if o.Modified != nil { - toSerialize["modified"] = o.Modified - } - if o.Process != nil { - toSerialize["process"] = o.Process - } - if o.Synthetics != nil { - toSerialize["synthetics"] = o.Synthetics - } - if o.SyntheticsPrivateLocations != nil { - toSerialize["synthetics-private-locations"] = o.SyntheticsPrivateLocations - } - if o.Version != nil { - toSerialize["version"] = o.Version - } - if o.Webhooks != nil { - toSerialize["webhooks"] = o.Webhooks - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Agents *IPPrefixesAgents `json:"agents,omitempty"` - Api *IPPrefixesAPI `json:"api,omitempty"` - Apm *IPPrefixesAPM `json:"apm,omitempty"` - Logs *IPPrefixesLogs `json:"logs,omitempty"` - Modified *string `json:"modified,omitempty"` - Process *IPPrefixesProcess `json:"process,omitempty"` - Synthetics *IPPrefixesSynthetics `json:"synthetics,omitempty"` - SyntheticsPrivateLocations *IPPrefixesSyntheticsPrivateLocations `json:"synthetics-private-locations,omitempty"` - Version *int64 `json:"version,omitempty"` - Webhooks *IPPrefixesWebhooks `json:"webhooks,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Agents != nil && all.Agents.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Agents = all.Agents - if all.Api != nil && all.Api.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Api = all.Api - if all.Apm != nil && all.Apm.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Apm = all.Apm - if all.Logs != nil && all.Logs.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Logs = all.Logs - o.Modified = all.Modified - if all.Process != nil && all.Process.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Process = all.Process - if all.Synthetics != nil && all.Synthetics.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Synthetics = all.Synthetics - if all.SyntheticsPrivateLocations != nil && all.SyntheticsPrivateLocations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SyntheticsPrivateLocations = all.SyntheticsPrivateLocations - o.Version = all.Version - if all.Webhooks != nil && all.Webhooks.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Webhooks = all.Webhooks - return nil -} diff --git a/api/v1/datadog/model_list_stream_column.go b/api/v1/datadog/model_list_stream_column.go deleted file mode 100644 index dcd7d22985f..00000000000 --- a/api/v1/datadog/model_list_stream_column.go +++ /dev/null @@ -1,144 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamColumn Widget column. -type ListStreamColumn struct { - // Widget column field. - Field string `json:"field"` - // Widget column width. - Width ListStreamColumnWidth `json:"width"` - // 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{} -} - -// NewListStreamColumn instantiates a new ListStreamColumn 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 NewListStreamColumn(field string, width ListStreamColumnWidth) *ListStreamColumn { - this := ListStreamColumn{} - this.Field = field - this.Width = width - return &this -} - -// NewListStreamColumnWithDefaults instantiates a new ListStreamColumn 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 NewListStreamColumnWithDefaults() *ListStreamColumn { - this := ListStreamColumn{} - return &this -} - -// GetField returns the Field field value. -func (o *ListStreamColumn) GetField() string { - if o == nil { - var ret string - return ret - } - return o.Field -} - -// GetFieldOk returns a tuple with the Field field value -// and a boolean to check if the value has been set. -func (o *ListStreamColumn) GetFieldOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Field, true -} - -// SetField sets field value. -func (o *ListStreamColumn) SetField(v string) { - o.Field = v -} - -// GetWidth returns the Width field value. -func (o *ListStreamColumn) GetWidth() ListStreamColumnWidth { - if o == nil { - var ret ListStreamColumnWidth - return ret - } - return o.Width -} - -// GetWidthOk returns a tuple with the Width field value -// and a boolean to check if the value has been set. -func (o *ListStreamColumn) GetWidthOk() (*ListStreamColumnWidth, bool) { - if o == nil { - return nil, false - } - return &o.Width, true -} - -// SetWidth sets field value. -func (o *ListStreamColumn) SetWidth(v ListStreamColumnWidth) { - o.Width = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ListStreamColumn) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["field"] = o.Field - toSerialize["width"] = o.Width - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ListStreamColumn) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Field *string `json:"field"` - Width *ListStreamColumnWidth `json:"width"` - }{} - all := struct { - Field string `json:"field"` - Width ListStreamColumnWidth `json:"width"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Field == nil { - return fmt.Errorf("Required field field missing") - } - if required.Width == nil { - return fmt.Errorf("Required field width missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Width; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Field = all.Field - o.Width = all.Width - return nil -} diff --git a/api/v1/datadog/model_list_stream_column_width.go b/api/v1/datadog/model_list_stream_column_width.go deleted file mode 100644 index 6024127005e..00000000000 --- a/api/v1/datadog/model_list_stream_column_width.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamColumnWidth Widget column width. -type ListStreamColumnWidth string - -// List of ListStreamColumnWidth. -const ( - LISTSTREAMCOLUMNWIDTH_AUTO ListStreamColumnWidth = "auto" - LISTSTREAMCOLUMNWIDTH_COMPACT ListStreamColumnWidth = "compact" - LISTSTREAMCOLUMNWIDTH_FULL ListStreamColumnWidth = "full" -) - -var allowedListStreamColumnWidthEnumValues = []ListStreamColumnWidth{ - LISTSTREAMCOLUMNWIDTH_AUTO, - LISTSTREAMCOLUMNWIDTH_COMPACT, - LISTSTREAMCOLUMNWIDTH_FULL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ListStreamColumnWidth) GetAllowedValues() []ListStreamColumnWidth { - return allowedListStreamColumnWidthEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ListStreamColumnWidth) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ListStreamColumnWidth(value) - return nil -} - -// NewListStreamColumnWidthFromValue returns a pointer to a valid ListStreamColumnWidth -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewListStreamColumnWidthFromValue(v string) (*ListStreamColumnWidth, error) { - ev := ListStreamColumnWidth(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ListStreamColumnWidth: valid values are %v", v, allowedListStreamColumnWidthEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ListStreamColumnWidth) IsValid() bool { - for _, existing := range allowedListStreamColumnWidthEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ListStreamColumnWidth value. -func (v ListStreamColumnWidth) Ptr() *ListStreamColumnWidth { - return &v -} - -// NullableListStreamColumnWidth handles when a null is used for ListStreamColumnWidth. -type NullableListStreamColumnWidth struct { - value *ListStreamColumnWidth - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamColumnWidth) Get() *ListStreamColumnWidth { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamColumnWidth) Set(val *ListStreamColumnWidth) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamColumnWidth) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamColumnWidth) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamColumnWidth initializes the struct as if Set has been called. -func NewNullableListStreamColumnWidth(val *ListStreamColumnWidth) *NullableListStreamColumnWidth { - return &NullableListStreamColumnWidth{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamColumnWidth) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamColumnWidth) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_list_stream_query.go b/api/v1/datadog/model_list_stream_query.go deleted file mode 100644 index afc58d07a0f..00000000000 --- a/api/v1/datadog/model_list_stream_query.go +++ /dev/null @@ -1,185 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamQuery Updated list stream widget. -type ListStreamQuery struct { - // Source from which to query items to display in the stream. - DataSource ListStreamSource `json:"data_source"` - // List of indexes. - Indexes []string `json:"indexes,omitempty"` - // Widget query. - QueryString string `json:"query_string"` - // 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{} -} - -// NewListStreamQuery instantiates a new ListStreamQuery 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 NewListStreamQuery(dataSource ListStreamSource, queryString string) *ListStreamQuery { - this := ListStreamQuery{} - this.DataSource = dataSource - this.QueryString = queryString - return &this -} - -// NewListStreamQueryWithDefaults instantiates a new ListStreamQuery 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 NewListStreamQueryWithDefaults() *ListStreamQuery { - this := ListStreamQuery{} - var dataSource ListStreamSource = LISTSTREAMSOURCE_APM_ISSUE_STREAM - this.DataSource = dataSource - return &this -} - -// GetDataSource returns the DataSource field value. -func (o *ListStreamQuery) GetDataSource() ListStreamSource { - if o == nil { - var ret ListStreamSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *ListStreamQuery) GetDataSourceOk() (*ListStreamSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *ListStreamQuery) SetDataSource(v ListStreamSource) { - o.DataSource = v -} - -// GetIndexes returns the Indexes field value if set, zero value otherwise. -func (o *ListStreamQuery) GetIndexes() []string { - if o == nil || o.Indexes == nil { - var ret []string - return ret - } - return o.Indexes -} - -// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListStreamQuery) GetIndexesOk() (*[]string, bool) { - if o == nil || o.Indexes == nil { - return nil, false - } - return &o.Indexes, true -} - -// HasIndexes returns a boolean if a field has been set. -func (o *ListStreamQuery) HasIndexes() bool { - if o != nil && o.Indexes != nil { - return true - } - - return false -} - -// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. -func (o *ListStreamQuery) SetIndexes(v []string) { - o.Indexes = v -} - -// GetQueryString returns the QueryString field value. -func (o *ListStreamQuery) GetQueryString() string { - if o == nil { - var ret string - return ret - } - return o.QueryString -} - -// GetQueryStringOk returns a tuple with the QueryString field value -// and a boolean to check if the value has been set. -func (o *ListStreamQuery) GetQueryStringOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.QueryString, true -} - -// SetQueryString sets field value. -func (o *ListStreamQuery) SetQueryString(v string) { - o.QueryString = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ListStreamQuery) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data_source"] = o.DataSource - if o.Indexes != nil { - toSerialize["indexes"] = o.Indexes - } - toSerialize["query_string"] = o.QueryString - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - DataSource *ListStreamSource `json:"data_source"` - QueryString *string `json:"query_string"` - }{} - all := struct { - DataSource ListStreamSource `json:"data_source"` - Indexes []string `json:"indexes,omitempty"` - QueryString string `json:"query_string"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.QueryString == nil { - return fmt.Errorf("Required field query_string missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DataSource = all.DataSource - o.Indexes = all.Indexes - o.QueryString = all.QueryString - return nil -} diff --git a/api/v1/datadog/model_list_stream_response_format.go b/api/v1/datadog/model_list_stream_response_format.go deleted file mode 100644 index d33a14ba82d..00000000000 --- a/api/v1/datadog/model_list_stream_response_format.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamResponseFormat Widget response format. -type ListStreamResponseFormat string - -// List of ListStreamResponseFormat. -const ( - LISTSTREAMRESPONSEFORMAT_EVENT_LIST ListStreamResponseFormat = "event_list" -) - -var allowedListStreamResponseFormatEnumValues = []ListStreamResponseFormat{ - LISTSTREAMRESPONSEFORMAT_EVENT_LIST, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ListStreamResponseFormat) GetAllowedValues() []ListStreamResponseFormat { - return allowedListStreamResponseFormatEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ListStreamResponseFormat) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ListStreamResponseFormat(value) - return nil -} - -// NewListStreamResponseFormatFromValue returns a pointer to a valid ListStreamResponseFormat -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewListStreamResponseFormatFromValue(v string) (*ListStreamResponseFormat, error) { - ev := ListStreamResponseFormat(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ListStreamResponseFormat: valid values are %v", v, allowedListStreamResponseFormatEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ListStreamResponseFormat) IsValid() bool { - for _, existing := range allowedListStreamResponseFormatEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ListStreamResponseFormat value. -func (v ListStreamResponseFormat) Ptr() *ListStreamResponseFormat { - return &v -} - -// NullableListStreamResponseFormat handles when a null is used for ListStreamResponseFormat. -type NullableListStreamResponseFormat struct { - value *ListStreamResponseFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamResponseFormat) Get() *ListStreamResponseFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamResponseFormat) Set(val *ListStreamResponseFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamResponseFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamResponseFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamResponseFormat initializes the struct as if Set has been called. -func NewNullableListStreamResponseFormat(val *ListStreamResponseFormat) *NullableListStreamResponseFormat { - return &NullableListStreamResponseFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamResponseFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamResponseFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_list_stream_source.go b/api/v1/datadog/model_list_stream_source.go deleted file mode 100644 index ad40e5d2878..00000000000 --- a/api/v1/datadog/model_list_stream_source.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamSource Source from which to query items to display in the stream. -type ListStreamSource string - -// List of ListStreamSource. -const ( - LISTSTREAMSOURCE_LOGS_STREAM ListStreamSource = "logs_stream" - LISTSTREAMSOURCE_AUDIT_STREAM ListStreamSource = "audit_stream" - LISTSTREAMSOURCE_RUM_ISSUE_STREAM ListStreamSource = "rum_issue_stream" - LISTSTREAMSOURCE_APM_ISSUE_STREAM ListStreamSource = "apm_issue_stream" -) - -var allowedListStreamSourceEnumValues = []ListStreamSource{ - LISTSTREAMSOURCE_LOGS_STREAM, - LISTSTREAMSOURCE_AUDIT_STREAM, - LISTSTREAMSOURCE_RUM_ISSUE_STREAM, - LISTSTREAMSOURCE_APM_ISSUE_STREAM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ListStreamSource) GetAllowedValues() []ListStreamSource { - return allowedListStreamSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ListStreamSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ListStreamSource(value) - return nil -} - -// NewListStreamSourceFromValue returns a pointer to a valid ListStreamSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewListStreamSourceFromValue(v string) (*ListStreamSource, error) { - ev := ListStreamSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ListStreamSource: valid values are %v", v, allowedListStreamSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ListStreamSource) IsValid() bool { - for _, existing := range allowedListStreamSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ListStreamSource value. -func (v ListStreamSource) Ptr() *ListStreamSource { - return &v -} - -// NullableListStreamSource handles when a null is used for ListStreamSource. -type NullableListStreamSource struct { - value *ListStreamSource - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamSource) Get() *ListStreamSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamSource) Set(val *ListStreamSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamSource initializes the struct as if Set has been called. -func NewNullableListStreamSource(val *ListStreamSource) *NullableListStreamSource { - return &NullableListStreamSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_list_stream_widget_definition.go b/api/v1/datadog/model_list_stream_widget_definition.go deleted file mode 100644 index f481dd31dc2..00000000000 --- a/api/v1/datadog/model_list_stream_widget_definition.go +++ /dev/null @@ -1,397 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamWidgetDefinition The list stream visualization displays a table of recent events in your application that -// match a search criteria using user-defined columns. -// -type ListStreamWidgetDefinition struct { - // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". - LegendSize *string `json:"legend_size,omitempty"` - // Request payload used to query items. - Requests []ListStreamWidgetRequest `json:"requests"` - // Whether or not to display the legend on this widget. - ShowLegend *bool `json:"show_legend,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the list stream widget. - Type ListStreamWidgetDefinitionType `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{} -} - -// NewListStreamWidgetDefinition instantiates a new ListStreamWidgetDefinition 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 NewListStreamWidgetDefinition(requests []ListStreamWidgetRequest, typeVar ListStreamWidgetDefinitionType) *ListStreamWidgetDefinition { - this := ListStreamWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewListStreamWidgetDefinitionWithDefaults instantiates a new ListStreamWidgetDefinition 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 NewListStreamWidgetDefinitionWithDefaults() *ListStreamWidgetDefinition { - this := ListStreamWidgetDefinition{} - var typeVar ListStreamWidgetDefinitionType = LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM - this.Type = typeVar - return &this -} - -// GetLegendSize returns the LegendSize field value if set, zero value otherwise. -func (o *ListStreamWidgetDefinition) GetLegendSize() string { - if o == nil || o.LegendSize == nil { - var ret string - return ret - } - return *o.LegendSize -} - -// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetDefinition) GetLegendSizeOk() (*string, bool) { - if o == nil || o.LegendSize == nil { - return nil, false - } - return o.LegendSize, true -} - -// HasLegendSize returns a boolean if a field has been set. -func (o *ListStreamWidgetDefinition) HasLegendSize() bool { - if o != nil && o.LegendSize != nil { - return true - } - - return false -} - -// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. -func (o *ListStreamWidgetDefinition) SetLegendSize(v string) { - o.LegendSize = &v -} - -// GetRequests returns the Requests field value. -func (o *ListStreamWidgetDefinition) GetRequests() []ListStreamWidgetRequest { - if o == nil { - var ret []ListStreamWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetDefinition) GetRequestsOk() (*[]ListStreamWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *ListStreamWidgetDefinition) SetRequests(v []ListStreamWidgetRequest) { - o.Requests = v -} - -// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. -func (o *ListStreamWidgetDefinition) GetShowLegend() bool { - if o == nil || o.ShowLegend == nil { - var ret bool - return ret - } - return *o.ShowLegend -} - -// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetDefinition) GetShowLegendOk() (*bool, bool) { - if o == nil || o.ShowLegend == nil { - return nil, false - } - return o.ShowLegend, true -} - -// HasShowLegend returns a boolean if a field has been set. -func (o *ListStreamWidgetDefinition) HasShowLegend() bool { - if o != nil && o.ShowLegend != nil { - return true - } - - return false -} - -// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. -func (o *ListStreamWidgetDefinition) SetShowLegend(v bool) { - o.ShowLegend = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *ListStreamWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *ListStreamWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *ListStreamWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *ListStreamWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *ListStreamWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *ListStreamWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *ListStreamWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *ListStreamWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *ListStreamWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *ListStreamWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *ListStreamWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *ListStreamWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *ListStreamWidgetDefinition) GetType() ListStreamWidgetDefinitionType { - if o == nil { - var ret ListStreamWidgetDefinitionType - 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 *ListStreamWidgetDefinition) GetTypeOk() (*ListStreamWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ListStreamWidgetDefinition) SetType(v ListStreamWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ListStreamWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LegendSize != nil { - toSerialize["legend_size"] = o.LegendSize - } - toSerialize["requests"] = o.Requests - if o.ShowLegend != nil { - toSerialize["show_legend"] = o.ShowLegend - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]ListStreamWidgetRequest `json:"requests"` - Type *ListStreamWidgetDefinitionType `json:"type"` - }{} - all := struct { - LegendSize *string `json:"legend_size,omitempty"` - Requests []ListStreamWidgetRequest `json:"requests"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ListStreamWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LegendSize = all.LegendSize - o.Requests = all.Requests - o.ShowLegend = all.ShowLegend - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_list_stream_widget_definition_type.go b/api/v1/datadog/model_list_stream_widget_definition_type.go deleted file mode 100644 index fcaf6165822..00000000000 --- a/api/v1/datadog/model_list_stream_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamWidgetDefinitionType Type of the list stream widget. -type ListStreamWidgetDefinitionType string - -// List of ListStreamWidgetDefinitionType. -const ( - LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM ListStreamWidgetDefinitionType = "list_stream" -) - -var allowedListStreamWidgetDefinitionTypeEnumValues = []ListStreamWidgetDefinitionType{ - LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ListStreamWidgetDefinitionType) GetAllowedValues() []ListStreamWidgetDefinitionType { - return allowedListStreamWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ListStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ListStreamWidgetDefinitionType(value) - return nil -} - -// NewListStreamWidgetDefinitionTypeFromValue returns a pointer to a valid ListStreamWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewListStreamWidgetDefinitionTypeFromValue(v string) (*ListStreamWidgetDefinitionType, error) { - ev := ListStreamWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ListStreamWidgetDefinitionType: valid values are %v", v, allowedListStreamWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ListStreamWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedListStreamWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ListStreamWidgetDefinitionType value. -func (v ListStreamWidgetDefinitionType) Ptr() *ListStreamWidgetDefinitionType { - return &v -} - -// NullableListStreamWidgetDefinitionType handles when a null is used for ListStreamWidgetDefinitionType. -type NullableListStreamWidgetDefinitionType struct { - value *ListStreamWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableListStreamWidgetDefinitionType) Get() *ListStreamWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableListStreamWidgetDefinitionType) Set(val *ListStreamWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableListStreamWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableListStreamWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableListStreamWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableListStreamWidgetDefinitionType(val *ListStreamWidgetDefinitionType) *NullableListStreamWidgetDefinitionType { - return &NullableListStreamWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableListStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableListStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_list_stream_widget_request.go b/api/v1/datadog/model_list_stream_widget_request.go deleted file mode 100644 index 0e738397ba1..00000000000 --- a/api/v1/datadog/model_list_stream_widget_request.go +++ /dev/null @@ -1,184 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ListStreamWidgetRequest Updated list stream widget. -type ListStreamWidgetRequest struct { - // Widget columns. - Columns []ListStreamColumn `json:"columns"` - // Updated list stream widget. - Query ListStreamQuery `json:"query"` - // Widget response format. - ResponseFormat ListStreamResponseFormat `json:"response_format"` - // 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{} -} - -// NewListStreamWidgetRequest instantiates a new ListStreamWidgetRequest 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 NewListStreamWidgetRequest(columns []ListStreamColumn, query ListStreamQuery, responseFormat ListStreamResponseFormat) *ListStreamWidgetRequest { - this := ListStreamWidgetRequest{} - this.Columns = columns - this.Query = query - this.ResponseFormat = responseFormat - return &this -} - -// NewListStreamWidgetRequestWithDefaults instantiates a new ListStreamWidgetRequest 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 NewListStreamWidgetRequestWithDefaults() *ListStreamWidgetRequest { - this := ListStreamWidgetRequest{} - return &this -} - -// GetColumns returns the Columns field value. -func (o *ListStreamWidgetRequest) GetColumns() []ListStreamColumn { - if o == nil { - var ret []ListStreamColumn - return ret - } - return o.Columns -} - -// GetColumnsOk returns a tuple with the Columns field value -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetRequest) GetColumnsOk() (*[]ListStreamColumn, bool) { - if o == nil { - return nil, false - } - return &o.Columns, true -} - -// SetColumns sets field value. -func (o *ListStreamWidgetRequest) SetColumns(v []ListStreamColumn) { - o.Columns = v -} - -// GetQuery returns the Query field value. -func (o *ListStreamWidgetRequest) GetQuery() ListStreamQuery { - if o == nil { - var ret ListStreamQuery - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetRequest) GetQueryOk() (*ListStreamQuery, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *ListStreamWidgetRequest) SetQuery(v ListStreamQuery) { - o.Query = v -} - -// GetResponseFormat returns the ResponseFormat field value. -func (o *ListStreamWidgetRequest) GetResponseFormat() ListStreamResponseFormat { - if o == nil { - var ret ListStreamResponseFormat - return ret - } - return o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value -// and a boolean to check if the value has been set. -func (o *ListStreamWidgetRequest) GetResponseFormatOk() (*ListStreamResponseFormat, bool) { - if o == nil { - return nil, false - } - return &o.ResponseFormat, true -} - -// SetResponseFormat sets field value. -func (o *ListStreamWidgetRequest) SetResponseFormat(v ListStreamResponseFormat) { - o.ResponseFormat = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ListStreamWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["columns"] = o.Columns - toSerialize["query"] = o.Query - toSerialize["response_format"] = o.ResponseFormat - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Columns *[]ListStreamColumn `json:"columns"` - Query *ListStreamQuery `json:"query"` - ResponseFormat *ListStreamResponseFormat `json:"response_format"` - }{} - all := struct { - Columns []ListStreamColumn `json:"columns"` - Query ListStreamQuery `json:"query"` - ResponseFormat ListStreamResponseFormat `json:"response_format"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Columns == nil { - return fmt.Errorf("Required field columns missing") - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - if required.ResponseFormat == nil { - return fmt.Errorf("Required field response_format missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Columns = all.Columns - if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Query = all.Query - o.ResponseFormat = all.ResponseFormat - return nil -} diff --git a/api/v1/datadog/model_log.go b/api/v1/datadog/model_log.go deleted file mode 100644 index 44e2ad26bcc..00000000000 --- a/api/v1/datadog/model_log.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Log Object describing a log after being processed and stored by Datadog. -type Log struct { - // JSON object containing all log attributes and their associated values. - Content *LogContent `json:"content,omitempty"` - // Unique ID of the Log. - Id *string `json:"id,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{} -} - -// NewLog instantiates a new Log 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 NewLog() *Log { - this := Log{} - return &this -} - -// NewLogWithDefaults instantiates a new Log 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 NewLogWithDefaults() *Log { - this := Log{} - return &this -} - -// GetContent returns the Content field value if set, zero value otherwise. -func (o *Log) GetContent() LogContent { - if o == nil || o.Content == nil { - var ret LogContent - return ret - } - return *o.Content -} - -// GetContentOk returns a tuple with the Content field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Log) GetContentOk() (*LogContent, bool) { - if o == nil || o.Content == nil { - return nil, false - } - return o.Content, true -} - -// HasContent returns a boolean if a field has been set. -func (o *Log) HasContent() bool { - if o != nil && o.Content != nil { - return true - } - - return false -} - -// SetContent gets a reference to the given LogContent and assigns it to the Content field. -func (o *Log) SetContent(v LogContent) { - o.Content = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Log) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Log) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Log) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Log) SetId(v string) { - o.Id = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Log) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Content != nil { - toSerialize["content"] = o.Content - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Log) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Content *LogContent `json:"content,omitempty"` - Id *string `json:"id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Content != nil && all.Content.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Content = all.Content - o.Id = all.Id - return nil -} diff --git a/api/v1/datadog/model_log_content.go b/api/v1/datadog/model_log_content.go deleted file mode 100644 index 72c70cede33..00000000000 --- a/api/v1/datadog/model_log_content.go +++ /dev/null @@ -1,306 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// LogContent JSON object containing all log attributes and their associated values. -type LogContent struct { - // JSON object of attributes from your log. - Attributes map[string]interface{} `json:"attributes,omitempty"` - // Name of the machine from where the logs are being sent. - Host *string `json:"host,omitempty"` - // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) - // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. - // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. - Message *string `json:"message,omitempty"` - // The name of the application or service generating the log events. - // It is used to switch from Logs to APM, so make sure you define the same - // value when you use both products. - Service *string `json:"service,omitempty"` - // Array of tags associated with your log. - Tags []string `json:"tags,omitempty"` - // Timestamp of your log. - Timestamp *time.Time `json:"timestamp,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{} -} - -// NewLogContent instantiates a new LogContent 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 NewLogContent() *LogContent { - this := LogContent{} - return &this -} - -// NewLogContentWithDefaults instantiates a new LogContent 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 NewLogContentWithDefaults() *LogContent { - this := LogContent{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *LogContent) GetAttributes() map[string]interface{} { - if o == nil || o.Attributes == nil { - var ret map[string]interface{} - return ret - } - return o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogContent) GetAttributesOk() (*map[string]interface{}, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return &o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *LogContent) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. -func (o *LogContent) SetAttributes(v map[string]interface{}) { - o.Attributes = v -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *LogContent) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogContent) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *LogContent) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *LogContent) SetHost(v string) { - o.Host = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *LogContent) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogContent) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *LogContent) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *LogContent) SetMessage(v string) { - o.Message = &v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *LogContent) 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 *LogContent) 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 *LogContent) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *LogContent) SetService(v string) { - o.Service = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *LogContent) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *LogContent) GetTagsOk() (*[]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 *LogContent) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *LogContent) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *LogContent) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogContent) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *LogContent) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *LogContent) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogContent) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Service != nil { - toSerialize["service"] = o.Service - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogContent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes map[string]interface{} `json:"attributes,omitempty"` - Host *string `json:"host,omitempty"` - Message *string `json:"message,omitempty"` - Service *string `json:"service,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Host = all.Host - o.Message = all.Message - o.Service = all.Service - o.Tags = all.Tags - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v1/datadog/model_log_query_definition.go b/api/v1/datadog/model_log_query_definition.go deleted file mode 100644 index 5ea75c2aed1..00000000000 --- a/api/v1/datadog/model_log_query_definition.go +++ /dev/null @@ -1,272 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogQueryDefinition The log query. -type LogQueryDefinition struct { - // Define computation for a log query. - Compute *LogsQueryCompute `json:"compute,omitempty"` - // List of tag prefixes to group by in the case of a cluster check. - GroupBy []LogQueryDefinitionGroupBy `json:"group_by,omitempty"` - // A coma separated-list of index names. Use "*" query all indexes at once. [Multiple Indexes](https://docs.datadoghq.com/logs/indexes/#multiple-indexes) - Index *string `json:"index,omitempty"` - // This field is mutually exclusive with `compute`. - MultiCompute []LogsQueryCompute `json:"multi_compute,omitempty"` - // The query being made on the logs. - Search *LogQueryDefinitionSearch `json:"search,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{} -} - -// NewLogQueryDefinition instantiates a new LogQueryDefinition 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 NewLogQueryDefinition() *LogQueryDefinition { - this := LogQueryDefinition{} - return &this -} - -// NewLogQueryDefinitionWithDefaults instantiates a new LogQueryDefinition 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 NewLogQueryDefinitionWithDefaults() *LogQueryDefinition { - this := LogQueryDefinition{} - return &this -} - -// GetCompute returns the Compute field value if set, zero value otherwise. -func (o *LogQueryDefinition) GetCompute() LogsQueryCompute { - if o == nil || o.Compute == nil { - var ret LogsQueryCompute - return ret - } - return *o.Compute -} - -// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinition) GetComputeOk() (*LogsQueryCompute, bool) { - if o == nil || o.Compute == nil { - return nil, false - } - return o.Compute, true -} - -// HasCompute returns a boolean if a field has been set. -func (o *LogQueryDefinition) HasCompute() bool { - if o != nil && o.Compute != nil { - return true - } - - return false -} - -// SetCompute gets a reference to the given LogsQueryCompute and assigns it to the Compute field. -func (o *LogQueryDefinition) SetCompute(v LogsQueryCompute) { - o.Compute = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *LogQueryDefinition) GetGroupBy() []LogQueryDefinitionGroupBy { - if o == nil || o.GroupBy == nil { - var ret []LogQueryDefinitionGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinition) GetGroupByOk() (*[]LogQueryDefinitionGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *LogQueryDefinition) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []LogQueryDefinitionGroupBy and assigns it to the GroupBy field. -func (o *LogQueryDefinition) SetGroupBy(v []LogQueryDefinitionGroupBy) { - o.GroupBy = v -} - -// GetIndex returns the Index field value if set, zero value otherwise. -func (o *LogQueryDefinition) GetIndex() string { - if o == nil || o.Index == nil { - var ret string - return ret - } - return *o.Index -} - -// GetIndexOk returns a tuple with the Index field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinition) GetIndexOk() (*string, bool) { - if o == nil || o.Index == nil { - return nil, false - } - return o.Index, true -} - -// HasIndex returns a boolean if a field has been set. -func (o *LogQueryDefinition) HasIndex() bool { - if o != nil && o.Index != nil { - return true - } - - return false -} - -// SetIndex gets a reference to the given string and assigns it to the Index field. -func (o *LogQueryDefinition) SetIndex(v string) { - o.Index = &v -} - -// GetMultiCompute returns the MultiCompute field value if set, zero value otherwise. -func (o *LogQueryDefinition) GetMultiCompute() []LogsQueryCompute { - if o == nil || o.MultiCompute == nil { - var ret []LogsQueryCompute - return ret - } - return o.MultiCompute -} - -// GetMultiComputeOk returns a tuple with the MultiCompute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinition) GetMultiComputeOk() (*[]LogsQueryCompute, bool) { - if o == nil || o.MultiCompute == nil { - return nil, false - } - return &o.MultiCompute, true -} - -// HasMultiCompute returns a boolean if a field has been set. -func (o *LogQueryDefinition) HasMultiCompute() bool { - if o != nil && o.MultiCompute != nil { - return true - } - - return false -} - -// SetMultiCompute gets a reference to the given []LogsQueryCompute and assigns it to the MultiCompute field. -func (o *LogQueryDefinition) SetMultiCompute(v []LogsQueryCompute) { - o.MultiCompute = v -} - -// GetSearch returns the Search field value if set, zero value otherwise. -func (o *LogQueryDefinition) GetSearch() LogQueryDefinitionSearch { - if o == nil || o.Search == nil { - var ret LogQueryDefinitionSearch - return ret - } - return *o.Search -} - -// GetSearchOk returns a tuple with the Search field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinition) GetSearchOk() (*LogQueryDefinitionSearch, bool) { - if o == nil || o.Search == nil { - return nil, false - } - return o.Search, true -} - -// HasSearch returns a boolean if a field has been set. -func (o *LogQueryDefinition) HasSearch() bool { - if o != nil && o.Search != nil { - return true - } - - return false -} - -// SetSearch gets a reference to the given LogQueryDefinitionSearch and assigns it to the Search field. -func (o *LogQueryDefinition) SetSearch(v LogQueryDefinitionSearch) { - o.Search = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Compute != nil { - toSerialize["compute"] = o.Compute - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Index != nil { - toSerialize["index"] = o.Index - } - if o.MultiCompute != nil { - toSerialize["multi_compute"] = o.MultiCompute - } - if o.Search != nil { - toSerialize["search"] = o.Search - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Compute *LogsQueryCompute `json:"compute,omitempty"` - GroupBy []LogQueryDefinitionGroupBy `json:"group_by,omitempty"` - Index *string `json:"index,omitempty"` - MultiCompute []LogsQueryCompute `json:"multi_compute,omitempty"` - Search *LogQueryDefinitionSearch `json:"search,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Compute = all.Compute - o.GroupBy = all.GroupBy - o.Index = all.Index - o.MultiCompute = all.MultiCompute - if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Search = all.Search - return nil -} diff --git a/api/v1/datadog/model_log_query_definition_group_by.go b/api/v1/datadog/model_log_query_definition_group_by.go deleted file mode 100644 index dff6a22ac8c..00000000000 --- a/api/v1/datadog/model_log_query_definition_group_by.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogQueryDefinitionGroupBy Defined items in the group. -type LogQueryDefinitionGroupBy struct { - // Facet name. - Facet string `json:"facet"` - // Maximum number of items in the group. - Limit *int64 `json:"limit,omitempty"` - // Define a sorting method. - Sort *LogQueryDefinitionGroupBySort `json:"sort,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{} -} - -// NewLogQueryDefinitionGroupBy instantiates a new LogQueryDefinitionGroupBy 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 NewLogQueryDefinitionGroupBy(facet string) *LogQueryDefinitionGroupBy { - this := LogQueryDefinitionGroupBy{} - this.Facet = facet - return &this -} - -// NewLogQueryDefinitionGroupByWithDefaults instantiates a new LogQueryDefinitionGroupBy 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 NewLogQueryDefinitionGroupByWithDefaults() *LogQueryDefinitionGroupBy { - this := LogQueryDefinitionGroupBy{} - return &this -} - -// GetFacet returns the Facet field value. -func (o *LogQueryDefinitionGroupBy) GetFacet() string { - if o == nil { - var ret string - return ret - } - return o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value -// and a boolean to check if the value has been set. -func (o *LogQueryDefinitionGroupBy) GetFacetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Facet, true -} - -// SetFacet sets field value. -func (o *LogQueryDefinitionGroupBy) SetFacet(v string) { - o.Facet = v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *LogQueryDefinitionGroupBy) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinitionGroupBy) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *LogQueryDefinitionGroupBy) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *LogQueryDefinitionGroupBy) SetLimit(v int64) { - o.Limit = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *LogQueryDefinitionGroupBy) GetSort() LogQueryDefinitionGroupBySort { - if o == nil || o.Sort == nil { - var ret LogQueryDefinitionGroupBySort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinitionGroupBy) GetSortOk() (*LogQueryDefinitionGroupBySort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *LogQueryDefinitionGroupBy) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given LogQueryDefinitionGroupBySort and assigns it to the Sort field. -func (o *LogQueryDefinitionGroupBy) SetSort(v LogQueryDefinitionGroupBySort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogQueryDefinitionGroupBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["facet"] = o.Facet - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogQueryDefinitionGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} - all := struct { - Facet string `json:"facet"` - Limit *int64 `json:"limit,omitempty"` - Sort *LogQueryDefinitionGroupBySort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("Required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Facet = all.Facet - o.Limit = all.Limit - if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Sort = all.Sort - return nil -} diff --git a/api/v1/datadog/model_log_query_definition_group_by_sort.go b/api/v1/datadog/model_log_query_definition_group_by_sort.go deleted file mode 100644 index 07580ade9fe..00000000000 --- a/api/v1/datadog/model_log_query_definition_group_by_sort.go +++ /dev/null @@ -1,183 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogQueryDefinitionGroupBySort Define a sorting method. -type LogQueryDefinitionGroupBySort struct { - // The aggregation method. - Aggregation string `json:"aggregation"` - // Facet name. - Facet *string `json:"facet,omitempty"` - // Widget sorting methods. - Order WidgetSort `json:"order"` - // 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{} -} - -// NewLogQueryDefinitionGroupBySort instantiates a new LogQueryDefinitionGroupBySort 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 NewLogQueryDefinitionGroupBySort(aggregation string, order WidgetSort) *LogQueryDefinitionGroupBySort { - this := LogQueryDefinitionGroupBySort{} - this.Aggregation = aggregation - this.Order = order - return &this -} - -// NewLogQueryDefinitionGroupBySortWithDefaults instantiates a new LogQueryDefinitionGroupBySort 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 NewLogQueryDefinitionGroupBySortWithDefaults() *LogQueryDefinitionGroupBySort { - this := LogQueryDefinitionGroupBySort{} - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *LogQueryDefinitionGroupBySort) GetAggregation() string { - if o == nil { - var ret string - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *LogQueryDefinitionGroupBySort) GetAggregationOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *LogQueryDefinitionGroupBySort) SetAggregation(v string) { - o.Aggregation = v -} - -// GetFacet returns the Facet field value if set, zero value otherwise. -func (o *LogQueryDefinitionGroupBySort) GetFacet() string { - if o == nil || o.Facet == nil { - var ret string - return ret - } - return *o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogQueryDefinitionGroupBySort) GetFacetOk() (*string, bool) { - if o == nil || o.Facet == nil { - return nil, false - } - return o.Facet, true -} - -// HasFacet returns a boolean if a field has been set. -func (o *LogQueryDefinitionGroupBySort) HasFacet() bool { - if o != nil && o.Facet != nil { - return true - } - - return false -} - -// SetFacet gets a reference to the given string and assigns it to the Facet field. -func (o *LogQueryDefinitionGroupBySort) SetFacet(v string) { - o.Facet = &v -} - -// GetOrder returns the Order field value. -func (o *LogQueryDefinitionGroupBySort) GetOrder() WidgetSort { - if o == nil { - var ret WidgetSort - return ret - } - return o.Order -} - -// GetOrderOk returns a tuple with the Order field value -// and a boolean to check if the value has been set. -func (o *LogQueryDefinitionGroupBySort) GetOrderOk() (*WidgetSort, bool) { - if o == nil { - return nil, false - } - return &o.Order, true -} - -// SetOrder sets field value. -func (o *LogQueryDefinitionGroupBySort) SetOrder(v WidgetSort) { - o.Order = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogQueryDefinitionGroupBySort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Facet != nil { - toSerialize["facet"] = o.Facet - } - toSerialize["order"] = o.Order - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogQueryDefinitionGroupBySort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *string `json:"aggregation"` - Order *WidgetSort `json:"order"` - }{} - all := struct { - Aggregation string `json:"aggregation"` - Facet *string `json:"facet,omitempty"` - Order WidgetSort `json:"order"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - if required.Order == nil { - return fmt.Errorf("Required field order missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Facet = all.Facet - o.Order = all.Order - return nil -} diff --git a/api/v1/datadog/model_log_query_definition_search.go b/api/v1/datadog/model_log_query_definition_search.go deleted file mode 100644 index 0bea0063686..00000000000 --- a/api/v1/datadog/model_log_query_definition_search.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogQueryDefinitionSearch The query being made on the logs. -type LogQueryDefinitionSearch struct { - // Search value to apply. - Query string `json:"query"` - // 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{} -} - -// NewLogQueryDefinitionSearch instantiates a new LogQueryDefinitionSearch 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 NewLogQueryDefinitionSearch(query string) *LogQueryDefinitionSearch { - this := LogQueryDefinitionSearch{} - this.Query = query - return &this -} - -// NewLogQueryDefinitionSearchWithDefaults instantiates a new LogQueryDefinitionSearch 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 NewLogQueryDefinitionSearchWithDefaults() *LogQueryDefinitionSearch { - this := LogQueryDefinitionSearch{} - return &this -} - -// GetQuery returns the Query field value. -func (o *LogQueryDefinitionSearch) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *LogQueryDefinitionSearch) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *LogQueryDefinitionSearch) SetQuery(v string) { - o.Query = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogQueryDefinitionSearch) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["query"] = o.Query - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} - all := struct { - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - return nil -} diff --git a/api/v1/datadog/model_log_stream_widget_definition.go b/api/v1/datadog/model_log_stream_widget_definition.go deleted file mode 100644 index 9b07b7075a1..00000000000 --- a/api/v1/datadog/model_log_stream_widget_definition.go +++ /dev/null @@ -1,615 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogStreamWidgetDefinition The Log Stream displays a log flow matching the defined query. Only available on FREE layout dashboards. -type LogStreamWidgetDefinition struct { - // Which columns to display on the widget. - Columns []string `json:"columns,omitempty"` - // An array of index names to query in the stream. Use [] to query all indexes at once. - Indexes []string `json:"indexes,omitempty"` - // ID of the log set to use. - // Deprecated - Logset *string `json:"logset,omitempty"` - // Amount of log lines to display - MessageDisplay *WidgetMessageDisplay `json:"message_display,omitempty"` - // Query to filter the log stream with. - Query *string `json:"query,omitempty"` - // Whether to show the date column or not - ShowDateColumn *bool `json:"show_date_column,omitempty"` - // Whether to show the message column or not - ShowMessageColumn *bool `json:"show_message_column,omitempty"` - // Which column and order to sort by - Sort *WidgetFieldSort `json:"sort,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the log stream widget. - Type LogStreamWidgetDefinitionType `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{} -} - -// NewLogStreamWidgetDefinition instantiates a new LogStreamWidgetDefinition 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 NewLogStreamWidgetDefinition(typeVar LogStreamWidgetDefinitionType) *LogStreamWidgetDefinition { - this := LogStreamWidgetDefinition{} - this.Type = typeVar - return &this -} - -// NewLogStreamWidgetDefinitionWithDefaults instantiates a new LogStreamWidgetDefinition 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 NewLogStreamWidgetDefinitionWithDefaults() *LogStreamWidgetDefinition { - this := LogStreamWidgetDefinition{} - var typeVar LogStreamWidgetDefinitionType = LOGSTREAMWIDGETDEFINITIONTYPE_LOG_STREAM - this.Type = typeVar - return &this -} - -// GetColumns returns the Columns field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetColumns() []string { - if o == nil || o.Columns == nil { - var ret []string - return ret - } - return o.Columns -} - -// GetColumnsOk returns a tuple with the Columns field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetColumnsOk() (*[]string, bool) { - if o == nil || o.Columns == nil { - return nil, false - } - return &o.Columns, true -} - -// HasColumns returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasColumns() bool { - if o != nil && o.Columns != nil { - return true - } - - return false -} - -// SetColumns gets a reference to the given []string and assigns it to the Columns field. -func (o *LogStreamWidgetDefinition) SetColumns(v []string) { - o.Columns = v -} - -// GetIndexes returns the Indexes field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetIndexes() []string { - if o == nil || o.Indexes == nil { - var ret []string - return ret - } - return o.Indexes -} - -// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetIndexesOk() (*[]string, bool) { - if o == nil || o.Indexes == nil { - return nil, false - } - return &o.Indexes, true -} - -// HasIndexes returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasIndexes() bool { - if o != nil && o.Indexes != nil { - return true - } - - return false -} - -// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. -func (o *LogStreamWidgetDefinition) SetIndexes(v []string) { - o.Indexes = v -} - -// GetLogset returns the Logset field value if set, zero value otherwise. -// Deprecated -func (o *LogStreamWidgetDefinition) GetLogset() string { - if o == nil || o.Logset == nil { - var ret string - return ret - } - return *o.Logset -} - -// GetLogsetOk returns a tuple with the Logset field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *LogStreamWidgetDefinition) GetLogsetOk() (*string, bool) { - if o == nil || o.Logset == nil { - return nil, false - } - return o.Logset, true -} - -// HasLogset returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasLogset() bool { - if o != nil && o.Logset != nil { - return true - } - - return false -} - -// SetLogset gets a reference to the given string and assigns it to the Logset field. -// Deprecated -func (o *LogStreamWidgetDefinition) SetLogset(v string) { - o.Logset = &v -} - -// GetMessageDisplay returns the MessageDisplay field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetMessageDisplay() WidgetMessageDisplay { - if o == nil || o.MessageDisplay == nil { - var ret WidgetMessageDisplay - return ret - } - return *o.MessageDisplay -} - -// GetMessageDisplayOk returns a tuple with the MessageDisplay field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetMessageDisplayOk() (*WidgetMessageDisplay, bool) { - if o == nil || o.MessageDisplay == nil { - return nil, false - } - return o.MessageDisplay, true -} - -// HasMessageDisplay returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasMessageDisplay() bool { - if o != nil && o.MessageDisplay != nil { - return true - } - - return false -} - -// SetMessageDisplay gets a reference to the given WidgetMessageDisplay and assigns it to the MessageDisplay field. -func (o *LogStreamWidgetDefinition) SetMessageDisplay(v WidgetMessageDisplay) { - o.MessageDisplay = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *LogStreamWidgetDefinition) SetQuery(v string) { - o.Query = &v -} - -// GetShowDateColumn returns the ShowDateColumn field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetShowDateColumn() bool { - if o == nil || o.ShowDateColumn == nil { - var ret bool - return ret - } - return *o.ShowDateColumn -} - -// GetShowDateColumnOk returns a tuple with the ShowDateColumn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetShowDateColumnOk() (*bool, bool) { - if o == nil || o.ShowDateColumn == nil { - return nil, false - } - return o.ShowDateColumn, true -} - -// HasShowDateColumn returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasShowDateColumn() bool { - if o != nil && o.ShowDateColumn != nil { - return true - } - - return false -} - -// SetShowDateColumn gets a reference to the given bool and assigns it to the ShowDateColumn field. -func (o *LogStreamWidgetDefinition) SetShowDateColumn(v bool) { - o.ShowDateColumn = &v -} - -// GetShowMessageColumn returns the ShowMessageColumn field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetShowMessageColumn() bool { - if o == nil || o.ShowMessageColumn == nil { - var ret bool - return ret - } - return *o.ShowMessageColumn -} - -// GetShowMessageColumnOk returns a tuple with the ShowMessageColumn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetShowMessageColumnOk() (*bool, bool) { - if o == nil || o.ShowMessageColumn == nil { - return nil, false - } - return o.ShowMessageColumn, true -} - -// HasShowMessageColumn returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasShowMessageColumn() bool { - if o != nil && o.ShowMessageColumn != nil { - return true - } - - return false -} - -// SetShowMessageColumn gets a reference to the given bool and assigns it to the ShowMessageColumn field. -func (o *LogStreamWidgetDefinition) SetShowMessageColumn(v bool) { - o.ShowMessageColumn = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetSort() WidgetFieldSort { - if o == nil || o.Sort == nil { - var ret WidgetFieldSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetSortOk() (*WidgetFieldSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given WidgetFieldSort and assigns it to the Sort field. -func (o *LogStreamWidgetDefinition) SetSort(v WidgetFieldSort) { - o.Sort = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *LogStreamWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *LogStreamWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *LogStreamWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *LogStreamWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogStreamWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *LogStreamWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *LogStreamWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *LogStreamWidgetDefinition) GetType() LogStreamWidgetDefinitionType { - if o == nil { - var ret LogStreamWidgetDefinitionType - 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 *LogStreamWidgetDefinition) GetTypeOk() (*LogStreamWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogStreamWidgetDefinition) SetType(v LogStreamWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogStreamWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Columns != nil { - toSerialize["columns"] = o.Columns - } - if o.Indexes != nil { - toSerialize["indexes"] = o.Indexes - } - if o.Logset != nil { - toSerialize["logset"] = o.Logset - } - if o.MessageDisplay != nil { - toSerialize["message_display"] = o.MessageDisplay - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.ShowDateColumn != nil { - toSerialize["show_date_column"] = o.ShowDateColumn - } - if o.ShowMessageColumn != nil { - toSerialize["show_message_column"] = o.ShowMessageColumn - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *LogStreamWidgetDefinitionType `json:"type"` - }{} - all := struct { - Columns []string `json:"columns,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Logset *string `json:"logset,omitempty"` - MessageDisplay *WidgetMessageDisplay `json:"message_display,omitempty"` - Query *string `json:"query,omitempty"` - ShowDateColumn *bool `json:"show_date_column,omitempty"` - ShowMessageColumn *bool `json:"show_message_column,omitempty"` - Sort *WidgetFieldSort `json:"sort,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type LogStreamWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.MessageDisplay; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Columns = all.Columns - o.Indexes = all.Indexes - o.Logset = all.Logset - o.MessageDisplay = all.MessageDisplay - o.Query = all.Query - o.ShowDateColumn = all.ShowDateColumn - o.ShowMessageColumn = all.ShowMessageColumn - if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Sort = all.Sort - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_log_stream_widget_definition_type.go b/api/v1/datadog/model_log_stream_widget_definition_type.go deleted file mode 100644 index 3edcb490175..00000000000 --- a/api/v1/datadog/model_log_stream_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogStreamWidgetDefinitionType Type of the log stream widget. -type LogStreamWidgetDefinitionType string - -// List of LogStreamWidgetDefinitionType. -const ( - LOGSTREAMWIDGETDEFINITIONTYPE_LOG_STREAM LogStreamWidgetDefinitionType = "log_stream" -) - -var allowedLogStreamWidgetDefinitionTypeEnumValues = []LogStreamWidgetDefinitionType{ - LOGSTREAMWIDGETDEFINITIONTYPE_LOG_STREAM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogStreamWidgetDefinitionType) GetAllowedValues() []LogStreamWidgetDefinitionType { - return allowedLogStreamWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogStreamWidgetDefinitionType(value) - return nil -} - -// NewLogStreamWidgetDefinitionTypeFromValue returns a pointer to a valid LogStreamWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogStreamWidgetDefinitionTypeFromValue(v string) (*LogStreamWidgetDefinitionType, error) { - ev := LogStreamWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogStreamWidgetDefinitionType: valid values are %v", v, allowedLogStreamWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogStreamWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedLogStreamWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogStreamWidgetDefinitionType value. -func (v LogStreamWidgetDefinitionType) Ptr() *LogStreamWidgetDefinitionType { - return &v -} - -// NullableLogStreamWidgetDefinitionType handles when a null is used for LogStreamWidgetDefinitionType. -type NullableLogStreamWidgetDefinitionType struct { - value *LogStreamWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogStreamWidgetDefinitionType) Get() *LogStreamWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogStreamWidgetDefinitionType) Set(val *LogStreamWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogStreamWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogStreamWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogStreamWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableLogStreamWidgetDefinitionType(val *LogStreamWidgetDefinitionType) *NullableLogStreamWidgetDefinitionType { - return &NullableLogStreamWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_api_error.go b/api/v1/datadog/model_logs_api_error.go deleted file mode 100644 index e74552885cd..00000000000 --- a/api/v1/datadog/model_logs_api_error.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAPIError Error returned by the Logs API -type LogsAPIError struct { - // Code identifying the error - Code *string `json:"code,omitempty"` - // Additional error details - Details []LogsAPIError `json:"details,omitempty"` - // Error message - Message *string `json:"message,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{} -} - -// NewLogsAPIError instantiates a new LogsAPIError 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 NewLogsAPIError() *LogsAPIError { - this := LogsAPIError{} - return &this -} - -// NewLogsAPIErrorWithDefaults instantiates a new LogsAPIError 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 NewLogsAPIErrorWithDefaults() *LogsAPIError { - this := LogsAPIError{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *LogsAPIError) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAPIError) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *LogsAPIError) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *LogsAPIError) SetCode(v string) { - o.Code = &v -} - -// GetDetails returns the Details field value if set, zero value otherwise. -func (o *LogsAPIError) GetDetails() []LogsAPIError { - if o == nil || o.Details == nil { - var ret []LogsAPIError - return ret - } - return o.Details -} - -// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAPIError) GetDetailsOk() (*[]LogsAPIError, bool) { - if o == nil || o.Details == nil { - return nil, false - } - return &o.Details, true -} - -// HasDetails returns a boolean if a field has been set. -func (o *LogsAPIError) HasDetails() bool { - if o != nil && o.Details != nil { - return true - } - - return false -} - -// SetDetails gets a reference to the given []LogsAPIError and assigns it to the Details field. -func (o *LogsAPIError) SetDetails(v []LogsAPIError) { - o.Details = v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *LogsAPIError) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAPIError) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *LogsAPIError) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *LogsAPIError) SetMessage(v string) { - o.Message = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAPIError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Details != nil { - toSerialize["details"] = o.Details - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAPIError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *string `json:"code,omitempty"` - Details []LogsAPIError `json:"details,omitempty"` - Message *string `json:"message,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Details = all.Details - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_logs_api_error_response.go b/api/v1/datadog/model_logs_api_error_response.go deleted file mode 100644 index 66599a8d418..00000000000 --- a/api/v1/datadog/model_logs_api_error_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAPIErrorResponse Response returned by the Logs API when errors occur. -type LogsAPIErrorResponse struct { - // Error returned by the Logs API - Error *LogsAPIError `json:"error,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{} -} - -// NewLogsAPIErrorResponse instantiates a new LogsAPIErrorResponse 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 NewLogsAPIErrorResponse() *LogsAPIErrorResponse { - this := LogsAPIErrorResponse{} - return &this -} - -// NewLogsAPIErrorResponseWithDefaults instantiates a new LogsAPIErrorResponse 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 NewLogsAPIErrorResponseWithDefaults() *LogsAPIErrorResponse { - this := LogsAPIErrorResponse{} - return &this -} - -// GetError returns the Error field value if set, zero value otherwise. -func (o *LogsAPIErrorResponse) GetError() LogsAPIError { - if o == nil || o.Error == nil { - var ret LogsAPIError - return ret - } - return *o.Error -} - -// GetErrorOk returns a tuple with the Error field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAPIErrorResponse) GetErrorOk() (*LogsAPIError, bool) { - if o == nil || o.Error == nil { - return nil, false - } - return o.Error, true -} - -// HasError returns a boolean if a field has been set. -func (o *LogsAPIErrorResponse) HasError() bool { - if o != nil && o.Error != nil { - return true - } - - return false -} - -// SetError gets a reference to the given LogsAPIError and assigns it to the Error field. -func (o *LogsAPIErrorResponse) SetError(v LogsAPIError) { - o.Error = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAPIErrorResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Error != nil { - toSerialize["error"] = o.Error - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Error *LogsAPIError `json:"error,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Error != nil && all.Error.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Error = all.Error - return nil -} diff --git a/api/v1/datadog/model_logs_arithmetic_processor.go b/api/v1/datadog/model_logs_arithmetic_processor.go deleted file mode 100644 index e7062883e93..00000000000 --- a/api/v1/datadog/model_logs_arithmetic_processor.go +++ /dev/null @@ -1,325 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArithmeticProcessor Use the Arithmetic Processor to add a new attribute (without spaces or special characters -// in the new attribute name) to a log with the result of the provided formula. -// This enables you to remap different time attributes with different units into a single attribute, -// or to compute operations on attributes within the same log. -// -// The formula can use parentheses and the basic arithmetic operators `-`, `+`, `*`, `/`. -// -// By default, the calculation is skipped if an attribute is missing. -// Select “Replace missing attribute by 0” to automatically populate -// missing attribute values with 0 to ensure that the calculation is done. -// An attribute is missing if it is not found in the log attributes, -// or if it cannot be converted to a number. -// -// *Notes*: -// -// - The operator `-` needs to be space split in the formula as it can also be contained in attribute names. -// - If the target attribute already exists, it is overwritten by the result of the formula. -// - Results are rounded up to the 9th decimal. For example, if the result of the formula is `0.1234567891`, -// the actual value stored for the attribute is `0.123456789`. -// - If you need to scale a unit of measure, -// see [Scale Filter](https://docs.datadoghq.com/logs/log_configuration/parsing/?tab=filter#matcher-and-filter). -type LogsArithmeticProcessor struct { - // Arithmetic operation between one or more log attributes. - Expression string `json:"expression"` - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // If `true`, it replaces all missing attributes of expression by `0`, `false` - // skip the operation if an attribute is missing. - IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Name of the attribute that contains the result of the arithmetic operation. - Target string `json:"target"` - // Type of logs arithmetic processor. - Type LogsArithmeticProcessorType `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{} -} - -// NewLogsArithmeticProcessor instantiates a new LogsArithmeticProcessor 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 NewLogsArithmeticProcessor(expression string, target string, typeVar LogsArithmeticProcessorType) *LogsArithmeticProcessor { - this := LogsArithmeticProcessor{} - this.Expression = expression - var isEnabled bool = false - this.IsEnabled = &isEnabled - var isReplaceMissing bool = false - this.IsReplaceMissing = &isReplaceMissing - this.Target = target - this.Type = typeVar - return &this -} - -// NewLogsArithmeticProcessorWithDefaults instantiates a new LogsArithmeticProcessor 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 NewLogsArithmeticProcessorWithDefaults() *LogsArithmeticProcessor { - this := LogsArithmeticProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var isReplaceMissing bool = false - this.IsReplaceMissing = &isReplaceMissing - var typeVar LogsArithmeticProcessorType = LOGSARITHMETICPROCESSORTYPE_ARITHMETIC_PROCESSOR - this.Type = typeVar - return &this -} - -// GetExpression returns the Expression field value. -func (o *LogsArithmeticProcessor) GetExpression() string { - if o == nil { - var ret string - return ret - } - return o.Expression -} - -// GetExpressionOk returns a tuple with the Expression field value -// and a boolean to check if the value has been set. -func (o *LogsArithmeticProcessor) GetExpressionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Expression, true -} - -// SetExpression sets field value. -func (o *LogsArithmeticProcessor) SetExpression(v string) { - o.Expression = v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsArithmeticProcessor) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArithmeticProcessor) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsArithmeticProcessor) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsArithmeticProcessor) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetIsReplaceMissing returns the IsReplaceMissing field value if set, zero value otherwise. -func (o *LogsArithmeticProcessor) GetIsReplaceMissing() bool { - if o == nil || o.IsReplaceMissing == nil { - var ret bool - return ret - } - return *o.IsReplaceMissing -} - -// GetIsReplaceMissingOk returns a tuple with the IsReplaceMissing field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArithmeticProcessor) GetIsReplaceMissingOk() (*bool, bool) { - if o == nil || o.IsReplaceMissing == nil { - return nil, false - } - return o.IsReplaceMissing, true -} - -// HasIsReplaceMissing returns a boolean if a field has been set. -func (o *LogsArithmeticProcessor) HasIsReplaceMissing() bool { - if o != nil && o.IsReplaceMissing != nil { - return true - } - - return false -} - -// SetIsReplaceMissing gets a reference to the given bool and assigns it to the IsReplaceMissing field. -func (o *LogsArithmeticProcessor) SetIsReplaceMissing(v bool) { - o.IsReplaceMissing = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsArithmeticProcessor) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArithmeticProcessor) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsArithmeticProcessor) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsArithmeticProcessor) SetName(v string) { - o.Name = &v -} - -// GetTarget returns the Target field value. -func (o *LogsArithmeticProcessor) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsArithmeticProcessor) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsArithmeticProcessor) SetTarget(v string) { - o.Target = v -} - -// GetType returns the Type field value. -func (o *LogsArithmeticProcessor) GetType() LogsArithmeticProcessorType { - if o == nil { - var ret LogsArithmeticProcessorType - 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 *LogsArithmeticProcessor) GetTypeOk() (*LogsArithmeticProcessorType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsArithmeticProcessor) SetType(v LogsArithmeticProcessorType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArithmeticProcessor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["expression"] = o.Expression - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.IsReplaceMissing != nil { - toSerialize["is_replace_missing"] = o.IsReplaceMissing - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["target"] = o.Target - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Expression *string `json:"expression"` - Target *string `json:"target"` - Type *LogsArithmeticProcessorType `json:"type"` - }{} - all := struct { - Expression string `json:"expression"` - IsEnabled *bool `json:"is_enabled,omitempty"` - IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` - Name *string `json:"name,omitempty"` - Target string `json:"target"` - Type LogsArithmeticProcessorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Expression == nil { - return fmt.Errorf("Required field expression missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Expression = all.Expression - o.IsEnabled = all.IsEnabled - o.IsReplaceMissing = all.IsReplaceMissing - o.Name = all.Name - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_arithmetic_processor_type.go b/api/v1/datadog/model_logs_arithmetic_processor_type.go deleted file mode 100644 index 0f4779dca4c..00000000000 --- a/api/v1/datadog/model_logs_arithmetic_processor_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArithmeticProcessorType Type of logs arithmetic processor. -type LogsArithmeticProcessorType string - -// List of LogsArithmeticProcessorType. -const ( - LOGSARITHMETICPROCESSORTYPE_ARITHMETIC_PROCESSOR LogsArithmeticProcessorType = "arithmetic-processor" -) - -var allowedLogsArithmeticProcessorTypeEnumValues = []LogsArithmeticProcessorType{ - LOGSARITHMETICPROCESSORTYPE_ARITHMETIC_PROCESSOR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsArithmeticProcessorType) GetAllowedValues() []LogsArithmeticProcessorType { - return allowedLogsArithmeticProcessorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsArithmeticProcessorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsArithmeticProcessorType(value) - return nil -} - -// NewLogsArithmeticProcessorTypeFromValue returns a pointer to a valid LogsArithmeticProcessorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsArithmeticProcessorTypeFromValue(v string) (*LogsArithmeticProcessorType, error) { - ev := LogsArithmeticProcessorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsArithmeticProcessorType: valid values are %v", v, allowedLogsArithmeticProcessorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsArithmeticProcessorType) IsValid() bool { - for _, existing := range allowedLogsArithmeticProcessorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsArithmeticProcessorType value. -func (v LogsArithmeticProcessorType) Ptr() *LogsArithmeticProcessorType { - return &v -} - -// NullableLogsArithmeticProcessorType handles when a null is used for LogsArithmeticProcessorType. -type NullableLogsArithmeticProcessorType struct { - value *LogsArithmeticProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArithmeticProcessorType) Get() *LogsArithmeticProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArithmeticProcessorType) Set(val *LogsArithmeticProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArithmeticProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArithmeticProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArithmeticProcessorType initializes the struct as if Set has been called. -func NewNullableLogsArithmeticProcessorType(val *LogsArithmeticProcessorType) *NullableLogsArithmeticProcessorType { - return &NullableLogsArithmeticProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArithmeticProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArithmeticProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_attribute_remapper.go b/api/v1/datadog/model_logs_attribute_remapper.go deleted file mode 100644 index 8a155068dbf..00000000000 --- a/api/v1/datadog/model_logs_attribute_remapper.go +++ /dev/null @@ -1,484 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsAttributeRemapper The remapper processor remaps any source attribute(s) or tag to another target attribute or tag. -// Constraints on the tag/attribute name are explained in the [Tag Best Practice documentation](https://docs.datadoghq.com/logs/guide/log-parsing-best-practice). -// Some additional constraints are applied as `:` or `,` are not allowed in the target tag/attribute name. -type LogsAttributeRemapper struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Override or not the target element if already set, - OverrideOnConflict *bool `json:"override_on_conflict,omitempty"` - // Remove or preserve the remapped source element. - PreserveSource *bool `json:"preserve_source,omitempty"` - // Defines if the sources are from log `attribute` or `tag`. - SourceType *string `json:"source_type,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Final attribute or tag name to remap the sources to. - Target string `json:"target"` - // If the `target_type` of the remapper is `attribute`, try to cast the value to a new specific type. - // If the cast is not possible, the original type is kept. `string`, `integer`, or `double` are the possible types. - // If the `target_type` is `tag`, this parameter may not be specified. - TargetFormat *TargetFormatType `json:"target_format,omitempty"` - // Defines if the final attribute or tag name is from log `attribute` or `tag`. - TargetType *string `json:"target_type,omitempty"` - // Type of logs attribute remapper. - Type LogsAttributeRemapperType `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{} -} - -// NewLogsAttributeRemapper instantiates a new LogsAttributeRemapper 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 NewLogsAttributeRemapper(sources []string, target string, typeVar LogsAttributeRemapperType) *LogsAttributeRemapper { - this := LogsAttributeRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var overrideOnConflict bool = false - this.OverrideOnConflict = &overrideOnConflict - var preserveSource bool = false - this.PreserveSource = &preserveSource - var sourceType string = "attribute" - this.SourceType = &sourceType - this.Sources = sources - this.Target = target - var targetType string = "attribute" - this.TargetType = &targetType - this.Type = typeVar - return &this -} - -// NewLogsAttributeRemapperWithDefaults instantiates a new LogsAttributeRemapper 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 NewLogsAttributeRemapperWithDefaults() *LogsAttributeRemapper { - this := LogsAttributeRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var overrideOnConflict bool = false - this.OverrideOnConflict = &overrideOnConflict - var preserveSource bool = false - this.PreserveSource = &preserveSource - var sourceType string = "attribute" - this.SourceType = &sourceType - var targetType string = "attribute" - this.TargetType = &targetType - var typeVar LogsAttributeRemapperType = LOGSATTRIBUTEREMAPPERTYPE_ATTRIBUTE_REMAPPER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsAttributeRemapper) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsAttributeRemapper) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsAttributeRemapper) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsAttributeRemapper) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsAttributeRemapper) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsAttributeRemapper) SetName(v string) { - o.Name = &v -} - -// GetOverrideOnConflict returns the OverrideOnConflict field value if set, zero value otherwise. -func (o *LogsAttributeRemapper) GetOverrideOnConflict() bool { - if o == nil || o.OverrideOnConflict == nil { - var ret bool - return ret - } - return *o.OverrideOnConflict -} - -// GetOverrideOnConflictOk returns a tuple with the OverrideOnConflict field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetOverrideOnConflictOk() (*bool, bool) { - if o == nil || o.OverrideOnConflict == nil { - return nil, false - } - return o.OverrideOnConflict, true -} - -// HasOverrideOnConflict returns a boolean if a field has been set. -func (o *LogsAttributeRemapper) HasOverrideOnConflict() bool { - if o != nil && o.OverrideOnConflict != nil { - return true - } - - return false -} - -// SetOverrideOnConflict gets a reference to the given bool and assigns it to the OverrideOnConflict field. -func (o *LogsAttributeRemapper) SetOverrideOnConflict(v bool) { - o.OverrideOnConflict = &v -} - -// GetPreserveSource returns the PreserveSource field value if set, zero value otherwise. -func (o *LogsAttributeRemapper) GetPreserveSource() bool { - if o == nil || o.PreserveSource == nil { - var ret bool - return ret - } - return *o.PreserveSource -} - -// GetPreserveSourceOk returns a tuple with the PreserveSource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetPreserveSourceOk() (*bool, bool) { - if o == nil || o.PreserveSource == nil { - return nil, false - } - return o.PreserveSource, true -} - -// HasPreserveSource returns a boolean if a field has been set. -func (o *LogsAttributeRemapper) HasPreserveSource() bool { - if o != nil && o.PreserveSource != nil { - return true - } - - return false -} - -// SetPreserveSource gets a reference to the given bool and assigns it to the PreserveSource field. -func (o *LogsAttributeRemapper) SetPreserveSource(v bool) { - o.PreserveSource = &v -} - -// GetSourceType returns the SourceType field value if set, zero value otherwise. -func (o *LogsAttributeRemapper) GetSourceType() string { - if o == nil || o.SourceType == nil { - var ret string - return ret - } - return *o.SourceType -} - -// GetSourceTypeOk returns a tuple with the SourceType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetSourceTypeOk() (*string, bool) { - if o == nil || o.SourceType == nil { - return nil, false - } - return o.SourceType, true -} - -// HasSourceType returns a boolean if a field has been set. -func (o *LogsAttributeRemapper) HasSourceType() bool { - if o != nil && o.SourceType != nil { - return true - } - - return false -} - -// SetSourceType gets a reference to the given string and assigns it to the SourceType field. -func (o *LogsAttributeRemapper) SetSourceType(v string) { - o.SourceType = &v -} - -// GetSources returns the Sources field value. -func (o *LogsAttributeRemapper) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsAttributeRemapper) SetSources(v []string) { - o.Sources = v -} - -// GetTarget returns the Target field value. -func (o *LogsAttributeRemapper) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsAttributeRemapper) SetTarget(v string) { - o.Target = v -} - -// GetTargetFormat returns the TargetFormat field value if set, zero value otherwise. -func (o *LogsAttributeRemapper) GetTargetFormat() TargetFormatType { - if o == nil || o.TargetFormat == nil { - var ret TargetFormatType - return ret - } - return *o.TargetFormat -} - -// GetTargetFormatOk returns a tuple with the TargetFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetTargetFormatOk() (*TargetFormatType, bool) { - if o == nil || o.TargetFormat == nil { - return nil, false - } - return o.TargetFormat, true -} - -// HasTargetFormat returns a boolean if a field has been set. -func (o *LogsAttributeRemapper) HasTargetFormat() bool { - if o != nil && o.TargetFormat != nil { - return true - } - - return false -} - -// SetTargetFormat gets a reference to the given TargetFormatType and assigns it to the TargetFormat field. -func (o *LogsAttributeRemapper) SetTargetFormat(v TargetFormatType) { - o.TargetFormat = &v -} - -// GetTargetType returns the TargetType field value if set, zero value otherwise. -func (o *LogsAttributeRemapper) GetTargetType() string { - if o == nil || o.TargetType == nil { - var ret string - return ret - } - return *o.TargetType -} - -// GetTargetTypeOk returns a tuple with the TargetType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAttributeRemapper) GetTargetTypeOk() (*string, bool) { - if o == nil || o.TargetType == nil { - return nil, false - } - return o.TargetType, true -} - -// HasTargetType returns a boolean if a field has been set. -func (o *LogsAttributeRemapper) HasTargetType() bool { - if o != nil && o.TargetType != nil { - return true - } - - return false -} - -// SetTargetType gets a reference to the given string and assigns it to the TargetType field. -func (o *LogsAttributeRemapper) SetTargetType(v string) { - o.TargetType = &v -} - -// GetType returns the Type field value. -func (o *LogsAttributeRemapper) GetType() LogsAttributeRemapperType { - if o == nil { - var ret LogsAttributeRemapperType - 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 *LogsAttributeRemapper) GetTypeOk() (*LogsAttributeRemapperType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsAttributeRemapper) SetType(v LogsAttributeRemapperType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAttributeRemapper) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.OverrideOnConflict != nil { - toSerialize["override_on_conflict"] = o.OverrideOnConflict - } - if o.PreserveSource != nil { - toSerialize["preserve_source"] = o.PreserveSource - } - if o.SourceType != nil { - toSerialize["source_type"] = o.SourceType - } - toSerialize["sources"] = o.Sources - toSerialize["target"] = o.Target - if o.TargetFormat != nil { - toSerialize["target_format"] = o.TargetFormat - } - if o.TargetType != nil { - toSerialize["target_type"] = o.TargetType - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsAttributeRemapperType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - OverrideOnConflict *bool `json:"override_on_conflict,omitempty"` - PreserveSource *bool `json:"preserve_source,omitempty"` - SourceType *string `json:"source_type,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - TargetFormat *TargetFormatType `json:"target_format,omitempty"` - TargetType *string `json:"target_type,omitempty"` - Type LogsAttributeRemapperType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TargetFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.OverrideOnConflict = all.OverrideOnConflict - o.PreserveSource = all.PreserveSource - o.SourceType = all.SourceType - o.Sources = all.Sources - o.Target = all.Target - o.TargetFormat = all.TargetFormat - o.TargetType = all.TargetType - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_attribute_remapper_type.go b/api/v1/datadog/model_logs_attribute_remapper_type.go deleted file mode 100644 index 35b7f0f7c92..00000000000 --- a/api/v1/datadog/model_logs_attribute_remapper_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsAttributeRemapperType Type of logs attribute remapper. -type LogsAttributeRemapperType string - -// List of LogsAttributeRemapperType. -const ( - LOGSATTRIBUTEREMAPPERTYPE_ATTRIBUTE_REMAPPER LogsAttributeRemapperType = "attribute-remapper" -) - -var allowedLogsAttributeRemapperTypeEnumValues = []LogsAttributeRemapperType{ - LOGSATTRIBUTEREMAPPERTYPE_ATTRIBUTE_REMAPPER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsAttributeRemapperType) GetAllowedValues() []LogsAttributeRemapperType { - return allowedLogsAttributeRemapperTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsAttributeRemapperType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsAttributeRemapperType(value) - return nil -} - -// NewLogsAttributeRemapperTypeFromValue returns a pointer to a valid LogsAttributeRemapperType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsAttributeRemapperTypeFromValue(v string) (*LogsAttributeRemapperType, error) { - ev := LogsAttributeRemapperType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsAttributeRemapperType: valid values are %v", v, allowedLogsAttributeRemapperTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsAttributeRemapperType) IsValid() bool { - for _, existing := range allowedLogsAttributeRemapperTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsAttributeRemapperType value. -func (v LogsAttributeRemapperType) Ptr() *LogsAttributeRemapperType { - return &v -} - -// NullableLogsAttributeRemapperType handles when a null is used for LogsAttributeRemapperType. -type NullableLogsAttributeRemapperType struct { - value *LogsAttributeRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAttributeRemapperType) Get() *LogsAttributeRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAttributeRemapperType) Set(val *LogsAttributeRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAttributeRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAttributeRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAttributeRemapperType initializes the struct as if Set has been called. -func NewNullableLogsAttributeRemapperType(val *LogsAttributeRemapperType) *NullableLogsAttributeRemapperType { - return &NullableLogsAttributeRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAttributeRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAttributeRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_by_retention.go b/api/v1/datadog/model_logs_by_retention.go deleted file mode 100644 index fb8d97c3c5a..00000000000 --- a/api/v1/datadog/model_logs_by_retention.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsByRetention Object containing logs usage data broken down by retention period. -type LogsByRetention struct { - // Indexed logs usage summary for each organization for each retention period with usage. - Orgs *LogsByRetentionOrgs `json:"orgs,omitempty"` - // Aggregated index logs usage for each retention period with usage. - Usage []LogsRetentionAggSumUsage `json:"usage,omitempty"` - // Object containing a summary of indexed logs usage by retention period for a single month. - UsageByMonth *LogsByRetentionMonthlyUsage `json:"usage_by_month,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{} -} - -// NewLogsByRetention instantiates a new LogsByRetention 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 NewLogsByRetention() *LogsByRetention { - this := LogsByRetention{} - return &this -} - -// NewLogsByRetentionWithDefaults instantiates a new LogsByRetention 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 NewLogsByRetentionWithDefaults() *LogsByRetention { - this := LogsByRetention{} - return &this -} - -// GetOrgs returns the Orgs field value if set, zero value otherwise. -func (o *LogsByRetention) GetOrgs() LogsByRetentionOrgs { - if o == nil || o.Orgs == nil { - var ret LogsByRetentionOrgs - return ret - } - return *o.Orgs -} - -// GetOrgsOk returns a tuple with the Orgs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsByRetention) GetOrgsOk() (*LogsByRetentionOrgs, bool) { - if o == nil || o.Orgs == nil { - return nil, false - } - return o.Orgs, true -} - -// HasOrgs returns a boolean if a field has been set. -func (o *LogsByRetention) HasOrgs() bool { - if o != nil && o.Orgs != nil { - return true - } - - return false -} - -// SetOrgs gets a reference to the given LogsByRetentionOrgs and assigns it to the Orgs field. -func (o *LogsByRetention) SetOrgs(v LogsByRetentionOrgs) { - o.Orgs = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *LogsByRetention) GetUsage() []LogsRetentionAggSumUsage { - if o == nil || o.Usage == nil { - var ret []LogsRetentionAggSumUsage - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsByRetention) GetUsageOk() (*[]LogsRetentionAggSumUsage, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *LogsByRetention) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []LogsRetentionAggSumUsage and assigns it to the Usage field. -func (o *LogsByRetention) SetUsage(v []LogsRetentionAggSumUsage) { - o.Usage = v -} - -// GetUsageByMonth returns the UsageByMonth field value if set, zero value otherwise. -func (o *LogsByRetention) GetUsageByMonth() LogsByRetentionMonthlyUsage { - if o == nil || o.UsageByMonth == nil { - var ret LogsByRetentionMonthlyUsage - return ret - } - return *o.UsageByMonth -} - -// GetUsageByMonthOk returns a tuple with the UsageByMonth field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsByRetention) GetUsageByMonthOk() (*LogsByRetentionMonthlyUsage, bool) { - if o == nil || o.UsageByMonth == nil { - return nil, false - } - return o.UsageByMonth, true -} - -// HasUsageByMonth returns a boolean if a field has been set. -func (o *LogsByRetention) HasUsageByMonth() bool { - if o != nil && o.UsageByMonth != nil { - return true - } - - return false -} - -// SetUsageByMonth gets a reference to the given LogsByRetentionMonthlyUsage and assigns it to the UsageByMonth field. -func (o *LogsByRetention) SetUsageByMonth(v LogsByRetentionMonthlyUsage) { - o.UsageByMonth = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsByRetention) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Orgs != nil { - toSerialize["orgs"] = o.Orgs - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - if o.UsageByMonth != nil { - toSerialize["usage_by_month"] = o.UsageByMonth - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsByRetention) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Orgs *LogsByRetentionOrgs `json:"orgs,omitempty"` - Usage []LogsRetentionAggSumUsage `json:"usage,omitempty"` - UsageByMonth *LogsByRetentionMonthlyUsage `json:"usage_by_month,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Orgs != nil && all.Orgs.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Orgs = all.Orgs - o.Usage = all.Usage - if all.UsageByMonth != nil && all.UsageByMonth.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.UsageByMonth = all.UsageByMonth - return nil -} diff --git a/api/v1/datadog/model_logs_by_retention_monthly_usage.go b/api/v1/datadog/model_logs_by_retention_monthly_usage.go deleted file mode 100644 index 70d47cdbfb2..00000000000 --- a/api/v1/datadog/model_logs_by_retention_monthly_usage.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// LogsByRetentionMonthlyUsage Object containing a summary of indexed logs usage by retention period for a single month. -type LogsByRetentionMonthlyUsage struct { - // The month for the usage. - Date *time.Time `json:"date,omitempty"` - // Indexed logs usage for each active retention for the month. - Usage []LogsRetentionSumUsage `json:"usage,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{} -} - -// NewLogsByRetentionMonthlyUsage instantiates a new LogsByRetentionMonthlyUsage 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 NewLogsByRetentionMonthlyUsage() *LogsByRetentionMonthlyUsage { - this := LogsByRetentionMonthlyUsage{} - return &this -} - -// NewLogsByRetentionMonthlyUsageWithDefaults instantiates a new LogsByRetentionMonthlyUsage 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 NewLogsByRetentionMonthlyUsageWithDefaults() *LogsByRetentionMonthlyUsage { - this := LogsByRetentionMonthlyUsage{} - return &this -} - -// GetDate returns the Date field value if set, zero value otherwise. -func (o *LogsByRetentionMonthlyUsage) GetDate() time.Time { - if o == nil || o.Date == nil { - var ret time.Time - return ret - } - return *o.Date -} - -// GetDateOk returns a tuple with the Date field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsByRetentionMonthlyUsage) GetDateOk() (*time.Time, bool) { - if o == nil || o.Date == nil { - return nil, false - } - return o.Date, true -} - -// HasDate returns a boolean if a field has been set. -func (o *LogsByRetentionMonthlyUsage) HasDate() bool { - if o != nil && o.Date != nil { - return true - } - - return false -} - -// SetDate gets a reference to the given time.Time and assigns it to the Date field. -func (o *LogsByRetentionMonthlyUsage) SetDate(v time.Time) { - o.Date = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *LogsByRetentionMonthlyUsage) GetUsage() []LogsRetentionSumUsage { - if o == nil || o.Usage == nil { - var ret []LogsRetentionSumUsage - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsByRetentionMonthlyUsage) GetUsageOk() (*[]LogsRetentionSumUsage, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *LogsByRetentionMonthlyUsage) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []LogsRetentionSumUsage and assigns it to the Usage field. -func (o *LogsByRetentionMonthlyUsage) SetUsage(v []LogsRetentionSumUsage) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsByRetentionMonthlyUsage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Date != nil { - if o.Date.Nanosecond() == 0 { - toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsByRetentionMonthlyUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Date *time.Time `json:"date,omitempty"` - Usage []LogsRetentionSumUsage `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Date = all.Date - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_logs_by_retention_org_usage.go b/api/v1/datadog/model_logs_by_retention_org_usage.go deleted file mode 100644 index ad16c8c2a0b..00000000000 --- a/api/v1/datadog/model_logs_by_retention_org_usage.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsByRetentionOrgUsage Indexed logs usage by retention for a single organization. -type LogsByRetentionOrgUsage struct { - // Indexed logs usage for each active retention for the organization. - Usage []LogsRetentionSumUsage `json:"usage,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{} -} - -// NewLogsByRetentionOrgUsage instantiates a new LogsByRetentionOrgUsage 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 NewLogsByRetentionOrgUsage() *LogsByRetentionOrgUsage { - this := LogsByRetentionOrgUsage{} - return &this -} - -// NewLogsByRetentionOrgUsageWithDefaults instantiates a new LogsByRetentionOrgUsage 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 NewLogsByRetentionOrgUsageWithDefaults() *LogsByRetentionOrgUsage { - this := LogsByRetentionOrgUsage{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *LogsByRetentionOrgUsage) GetUsage() []LogsRetentionSumUsage { - if o == nil || o.Usage == nil { - var ret []LogsRetentionSumUsage - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsByRetentionOrgUsage) GetUsageOk() (*[]LogsRetentionSumUsage, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *LogsByRetentionOrgUsage) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []LogsRetentionSumUsage and assigns it to the Usage field. -func (o *LogsByRetentionOrgUsage) SetUsage(v []LogsRetentionSumUsage) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsByRetentionOrgUsage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsByRetentionOrgUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []LogsRetentionSumUsage `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_logs_by_retention_orgs.go b/api/v1/datadog/model_logs_by_retention_orgs.go deleted file mode 100644 index cf82be023e5..00000000000 --- a/api/v1/datadog/model_logs_by_retention_orgs.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsByRetentionOrgs Indexed logs usage summary for each organization for each retention period with usage. -type LogsByRetentionOrgs struct { - // Indexed logs usage summary for each organization. - Usage []LogsByRetentionOrgUsage `json:"usage,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{} -} - -// NewLogsByRetentionOrgs instantiates a new LogsByRetentionOrgs 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 NewLogsByRetentionOrgs() *LogsByRetentionOrgs { - this := LogsByRetentionOrgs{} - return &this -} - -// NewLogsByRetentionOrgsWithDefaults instantiates a new LogsByRetentionOrgs 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 NewLogsByRetentionOrgsWithDefaults() *LogsByRetentionOrgs { - this := LogsByRetentionOrgs{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *LogsByRetentionOrgs) GetUsage() []LogsByRetentionOrgUsage { - if o == nil || o.Usage == nil { - var ret []LogsByRetentionOrgUsage - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsByRetentionOrgs) GetUsageOk() (*[]LogsByRetentionOrgUsage, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *LogsByRetentionOrgs) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []LogsByRetentionOrgUsage and assigns it to the Usage field. -func (o *LogsByRetentionOrgs) SetUsage(v []LogsByRetentionOrgUsage) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsByRetentionOrgs) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsByRetentionOrgs) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []LogsByRetentionOrgUsage `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_logs_category_processor.go b/api/v1/datadog/model_logs_category_processor.go deleted file mode 100644 index ab1c7b0c9b7..00000000000 --- a/api/v1/datadog/model_logs_category_processor.go +++ /dev/null @@ -1,274 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsCategoryProcessor Use the Category Processor to add a new attribute (without spaces or special characters in the new attribute name) -// to a log matching a provided search query. Use categories to create groups for an analytical view. -// For example, URL groups, machine groups, environments, and response time buckets. -// -// **Notes**: -// -// - The syntax of the query is the one of Logs Explorer search bar. -// The query can be done on any log attribute or tag, whether it is a facet or not. -// Wildcards can also be used inside your query. -// - Once the log has matched one of the Processor queries, it stops. -// Make sure they are properly ordered in case a log could match several queries. -// - The names of the categories must be unique. -// - Once defined in the Category Processor, you can map categories to log status using the Log Status Remapper. -type LogsCategoryProcessor struct { - // Array of filters to match or not a log and their - // corresponding `name` to assign a custom value to the log. - Categories []LogsCategoryProcessorCategory `json:"categories"` - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Name of the target attribute which value is defined by the matching category. - Target string `json:"target"` - // Type of logs category processor. - Type LogsCategoryProcessorType `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{} -} - -// NewLogsCategoryProcessor instantiates a new LogsCategoryProcessor 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 NewLogsCategoryProcessor(categories []LogsCategoryProcessorCategory, target string, typeVar LogsCategoryProcessorType) *LogsCategoryProcessor { - this := LogsCategoryProcessor{} - this.Categories = categories - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Target = target - this.Type = typeVar - return &this -} - -// NewLogsCategoryProcessorWithDefaults instantiates a new LogsCategoryProcessor 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 NewLogsCategoryProcessorWithDefaults() *LogsCategoryProcessor { - this := LogsCategoryProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsCategoryProcessorType = LOGSCATEGORYPROCESSORTYPE_CATEGORY_PROCESSOR - this.Type = typeVar - return &this -} - -// GetCategories returns the Categories field value. -func (o *LogsCategoryProcessor) GetCategories() []LogsCategoryProcessorCategory { - if o == nil { - var ret []LogsCategoryProcessorCategory - return ret - } - return o.Categories -} - -// GetCategoriesOk returns a tuple with the Categories field value -// and a boolean to check if the value has been set. -func (o *LogsCategoryProcessor) GetCategoriesOk() (*[]LogsCategoryProcessorCategory, bool) { - if o == nil { - return nil, false - } - return &o.Categories, true -} - -// SetCategories sets field value. -func (o *LogsCategoryProcessor) SetCategories(v []LogsCategoryProcessorCategory) { - o.Categories = v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsCategoryProcessor) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsCategoryProcessor) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsCategoryProcessor) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsCategoryProcessor) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsCategoryProcessor) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsCategoryProcessor) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsCategoryProcessor) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsCategoryProcessor) SetName(v string) { - o.Name = &v -} - -// GetTarget returns the Target field value. -func (o *LogsCategoryProcessor) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsCategoryProcessor) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsCategoryProcessor) SetTarget(v string) { - o.Target = v -} - -// GetType returns the Type field value. -func (o *LogsCategoryProcessor) GetType() LogsCategoryProcessorType { - if o == nil { - var ret LogsCategoryProcessorType - 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 *LogsCategoryProcessor) GetTypeOk() (*LogsCategoryProcessorType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsCategoryProcessor) SetType(v LogsCategoryProcessorType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsCategoryProcessor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["categories"] = o.Categories - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["target"] = o.Target - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Categories *[]LogsCategoryProcessorCategory `json:"categories"` - Target *string `json:"target"` - Type *LogsCategoryProcessorType `json:"type"` - }{} - all := struct { - Categories []LogsCategoryProcessorCategory `json:"categories"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Target string `json:"target"` - Type LogsCategoryProcessorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Categories == nil { - return fmt.Errorf("Required field categories missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Categories = all.Categories - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_category_processor_category.go b/api/v1/datadog/model_logs_category_processor_category.go deleted file mode 100644 index 6f915c0146a..00000000000 --- a/api/v1/datadog/model_logs_category_processor_category.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsCategoryProcessorCategory Object describing the logs filter. -type LogsCategoryProcessorCategory struct { - // Filter for logs. - Filter *LogsFilter `json:"filter,omitempty"` - // Value to assign to the target attribute. - Name *string `json:"name,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{} -} - -// NewLogsCategoryProcessorCategory instantiates a new LogsCategoryProcessorCategory 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 NewLogsCategoryProcessorCategory() *LogsCategoryProcessorCategory { - this := LogsCategoryProcessorCategory{} - return &this -} - -// NewLogsCategoryProcessorCategoryWithDefaults instantiates a new LogsCategoryProcessorCategory 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 NewLogsCategoryProcessorCategoryWithDefaults() *LogsCategoryProcessorCategory { - this := LogsCategoryProcessorCategory{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsCategoryProcessorCategory) GetFilter() LogsFilter { - if o == nil || o.Filter == nil { - var ret LogsFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsCategoryProcessorCategory) GetFilterOk() (*LogsFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsCategoryProcessorCategory) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsFilter and assigns it to the Filter field. -func (o *LogsCategoryProcessorCategory) SetFilter(v LogsFilter) { - o.Filter = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsCategoryProcessorCategory) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsCategoryProcessorCategory) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsCategoryProcessorCategory) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsCategoryProcessorCategory) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsCategoryProcessorCategory) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsCategoryProcessorCategory) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filter *LogsFilter `json:"filter,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_logs_category_processor_type.go b/api/v1/datadog/model_logs_category_processor_type.go deleted file mode 100644 index 1896db24d31..00000000000 --- a/api/v1/datadog/model_logs_category_processor_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsCategoryProcessorType Type of logs category processor. -type LogsCategoryProcessorType string - -// List of LogsCategoryProcessorType. -const ( - LOGSCATEGORYPROCESSORTYPE_CATEGORY_PROCESSOR LogsCategoryProcessorType = "category-processor" -) - -var allowedLogsCategoryProcessorTypeEnumValues = []LogsCategoryProcessorType{ - LOGSCATEGORYPROCESSORTYPE_CATEGORY_PROCESSOR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsCategoryProcessorType) GetAllowedValues() []LogsCategoryProcessorType { - return allowedLogsCategoryProcessorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsCategoryProcessorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsCategoryProcessorType(value) - return nil -} - -// NewLogsCategoryProcessorTypeFromValue returns a pointer to a valid LogsCategoryProcessorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsCategoryProcessorTypeFromValue(v string) (*LogsCategoryProcessorType, error) { - ev := LogsCategoryProcessorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsCategoryProcessorType: valid values are %v", v, allowedLogsCategoryProcessorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsCategoryProcessorType) IsValid() bool { - for _, existing := range allowedLogsCategoryProcessorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsCategoryProcessorType value. -func (v LogsCategoryProcessorType) Ptr() *LogsCategoryProcessorType { - return &v -} - -// NullableLogsCategoryProcessorType handles when a null is used for LogsCategoryProcessorType. -type NullableLogsCategoryProcessorType struct { - value *LogsCategoryProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsCategoryProcessorType) Get() *LogsCategoryProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsCategoryProcessorType) Set(val *LogsCategoryProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsCategoryProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsCategoryProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsCategoryProcessorType initializes the struct as if Set has been called. -func NewNullableLogsCategoryProcessorType(val *LogsCategoryProcessorType) *NullableLogsCategoryProcessorType { - return &NullableLogsCategoryProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsCategoryProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsCategoryProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_date_remapper.go b/api/v1/datadog/model_logs_date_remapper.go deleted file mode 100644 index 88c48b3e6c1..00000000000 --- a/api/v1/datadog/model_logs_date_remapper.go +++ /dev/null @@ -1,246 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsDateRemapper As Datadog receives logs, it timestamps them using the value(s) from any of these default attributes. -// -// - `timestamp` -// - `date` -// - `_timestamp` -// - `Timestamp` -// - `eventTime` -// - `published_date` -// -// If your logs put their dates in an attribute not in this list, -// use the log date Remapper Processor to define their date attribute as the official log timestamp. -// The recognized date formats are ISO8601, UNIX (the milliseconds EPOCH format), and RFC3164. -// -// **Note:** If your logs don’t contain any of the default attributes -// and you haven’t defined your own date attribute, Datadog timestamps -// the logs with the date it received them. -// -// If multiple log date remapper processors can be applied to a given log, -// only the first one (according to the pipelines order) is taken into account. -type LogsDateRemapper struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Type of logs date remapper. - Type LogsDateRemapperType `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{} -} - -// NewLogsDateRemapper instantiates a new LogsDateRemapper 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 NewLogsDateRemapper(sources []string, typeVar LogsDateRemapperType) *LogsDateRemapper { - this := LogsDateRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Sources = sources - this.Type = typeVar - return &this -} - -// NewLogsDateRemapperWithDefaults instantiates a new LogsDateRemapper 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 NewLogsDateRemapperWithDefaults() *LogsDateRemapper { - this := LogsDateRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsDateRemapperType = LOGSDATEREMAPPERTYPE_DATE_REMAPPER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsDateRemapper) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsDateRemapper) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsDateRemapper) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsDateRemapper) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsDateRemapper) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsDateRemapper) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsDateRemapper) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsDateRemapper) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value. -func (o *LogsDateRemapper) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsDateRemapper) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsDateRemapper) SetSources(v []string) { - o.Sources = v -} - -// GetType returns the Type field value. -func (o *LogsDateRemapper) GetType() LogsDateRemapperType { - if o == nil { - var ret LogsDateRemapperType - 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 *LogsDateRemapper) GetTypeOk() (*LogsDateRemapperType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsDateRemapper) SetType(v LogsDateRemapperType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsDateRemapper) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["sources"] = o.Sources - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsDateRemapperType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsDateRemapperType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_date_remapper_type.go b/api/v1/datadog/model_logs_date_remapper_type.go deleted file mode 100644 index 416ab4779c7..00000000000 --- a/api/v1/datadog/model_logs_date_remapper_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsDateRemapperType Type of logs date remapper. -type LogsDateRemapperType string - -// List of LogsDateRemapperType. -const ( - LOGSDATEREMAPPERTYPE_DATE_REMAPPER LogsDateRemapperType = "date-remapper" -) - -var allowedLogsDateRemapperTypeEnumValues = []LogsDateRemapperType{ - LOGSDATEREMAPPERTYPE_DATE_REMAPPER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsDateRemapperType) GetAllowedValues() []LogsDateRemapperType { - return allowedLogsDateRemapperTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsDateRemapperType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsDateRemapperType(value) - return nil -} - -// NewLogsDateRemapperTypeFromValue returns a pointer to a valid LogsDateRemapperType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsDateRemapperTypeFromValue(v string) (*LogsDateRemapperType, error) { - ev := LogsDateRemapperType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsDateRemapperType: valid values are %v", v, allowedLogsDateRemapperTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsDateRemapperType) IsValid() bool { - for _, existing := range allowedLogsDateRemapperTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsDateRemapperType value. -func (v LogsDateRemapperType) Ptr() *LogsDateRemapperType { - return &v -} - -// NullableLogsDateRemapperType handles when a null is used for LogsDateRemapperType. -type NullableLogsDateRemapperType struct { - value *LogsDateRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsDateRemapperType) Get() *LogsDateRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsDateRemapperType) Set(val *LogsDateRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsDateRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsDateRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsDateRemapperType initializes the struct as if Set has been called. -func NewNullableLogsDateRemapperType(val *LogsDateRemapperType) *NullableLogsDateRemapperType { - return &NullableLogsDateRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsDateRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsDateRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_exclusion.go b/api/v1/datadog/model_logs_exclusion.go deleted file mode 100644 index 7d381474499..00000000000 --- a/api/v1/datadog/model_logs_exclusion.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsExclusion Represents the index exclusion filter object from configuration API. -type LogsExclusion struct { - // Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle. - Filter *LogsExclusionFilter `json:"filter,omitempty"` - // Whether or not the exclusion filter is active. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the index exclusion filter. - Name string `json:"name"` - // 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{} -} - -// NewLogsExclusion instantiates a new LogsExclusion 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 NewLogsExclusion(name string) *LogsExclusion { - this := LogsExclusion{} - this.Name = name - return &this -} - -// NewLogsExclusionWithDefaults instantiates a new LogsExclusion 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 NewLogsExclusionWithDefaults() *LogsExclusion { - this := LogsExclusion{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsExclusion) GetFilter() LogsExclusionFilter { - if o == nil || o.Filter == nil { - var ret LogsExclusionFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsExclusion) GetFilterOk() (*LogsExclusionFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsExclusion) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsExclusionFilter and assigns it to the Filter field. -func (o *LogsExclusion) SetFilter(v LogsExclusionFilter) { - o.Filter = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsExclusion) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsExclusion) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsExclusion) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsExclusion) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value. -func (o *LogsExclusion) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *LogsExclusion) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *LogsExclusion) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsExclusion) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsExclusion) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Filter *LogsExclusionFilter `json:"filter,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.IsEnabled = all.IsEnabled - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_logs_exclusion_filter.go b/api/v1/datadog/model_logs_exclusion_filter.go deleted file mode 100644 index 8affe9814a0..00000000000 --- a/api/v1/datadog/model_logs_exclusion_filter.go +++ /dev/null @@ -1,144 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsExclusionFilter Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle. -type LogsExclusionFilter struct { - // Default query is `*`, meaning all logs flowing in the index would be excluded. - // Scope down exclusion filter to only a subset of logs with a log query. - Query *string `json:"query,omitempty"` - // Sample rate to apply to logs going through this exclusion filter, - // a value of 1.0 excludes all logs matching the query. - SampleRate float64 `json:"sample_rate"` - // 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{} -} - -// NewLogsExclusionFilter instantiates a new LogsExclusionFilter 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 NewLogsExclusionFilter(sampleRate float64) *LogsExclusionFilter { - this := LogsExclusionFilter{} - this.SampleRate = sampleRate - return &this -} - -// NewLogsExclusionFilterWithDefaults instantiates a new LogsExclusionFilter 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 NewLogsExclusionFilterWithDefaults() *LogsExclusionFilter { - this := LogsExclusionFilter{} - return &this -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *LogsExclusionFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsExclusionFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *LogsExclusionFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *LogsExclusionFilter) SetQuery(v string) { - o.Query = &v -} - -// GetSampleRate returns the SampleRate field value. -func (o *LogsExclusionFilter) GetSampleRate() float64 { - if o == nil { - var ret float64 - return ret - } - return o.SampleRate -} - -// GetSampleRateOk returns a tuple with the SampleRate field value -// and a boolean to check if the value has been set. -func (o *LogsExclusionFilter) GetSampleRateOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.SampleRate, true -} - -// SetSampleRate sets field value. -func (o *LogsExclusionFilter) SetSampleRate(v float64) { - o.SampleRate = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsExclusionFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - toSerialize["sample_rate"] = o.SampleRate - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - SampleRate *float64 `json:"sample_rate"` - }{} - all := struct { - Query *string `json:"query,omitempty"` - SampleRate float64 `json:"sample_rate"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.SampleRate == nil { - return fmt.Errorf("Required field sample_rate missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - o.SampleRate = all.SampleRate - return nil -} diff --git a/api/v1/datadog/model_logs_filter.go b/api/v1/datadog/model_logs_filter.go deleted file mode 100644 index f2894474519..00000000000 --- a/api/v1/datadog/model_logs_filter.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsFilter Filter for logs. -type LogsFilter struct { - // The filter query. - Query *string `json:"query,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{} -} - -// NewLogsFilter instantiates a new LogsFilter 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 NewLogsFilter() *LogsFilter { - this := LogsFilter{} - return &this -} - -// NewLogsFilterWithDefaults instantiates a new LogsFilter 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 NewLogsFilterWithDefaults() *LogsFilter { - this := LogsFilter{} - return &this -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *LogsFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *LogsFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *LogsFilter) SetQuery(v string) { - o.Query = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Query *string `json:"query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - return nil -} diff --git a/api/v1/datadog/model_logs_geo_ip_parser.go b/api/v1/datadog/model_logs_geo_ip_parser.go deleted file mode 100644 index 1787f5e68a5..00000000000 --- a/api/v1/datadog/model_logs_geo_ip_parser.go +++ /dev/null @@ -1,264 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsGeoIPParser The GeoIP parser takes an IP address attribute and extracts if available -// the Continent, Country, Subdivision, and City information in the target attribute path. -type LogsGeoIPParser struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Name of the parent attribute that contains all the extracted details from the `sources`. - Target string `json:"target"` - // Type of GeoIP parser. - Type LogsGeoIPParserType `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{} -} - -// NewLogsGeoIPParser instantiates a new LogsGeoIPParser 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 NewLogsGeoIPParser(sources []string, target string, typeVar LogsGeoIPParserType) *LogsGeoIPParser { - this := LogsGeoIPParser{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Sources = sources - this.Target = target - this.Type = typeVar - return &this -} - -// NewLogsGeoIPParserWithDefaults instantiates a new LogsGeoIPParser 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 NewLogsGeoIPParserWithDefaults() *LogsGeoIPParser { - this := LogsGeoIPParser{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var target string = "network.client.geoip" - this.Target = target - var typeVar LogsGeoIPParserType = LOGSGEOIPPARSERTYPE_GEO_IP_PARSER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsGeoIPParser) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGeoIPParser) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsGeoIPParser) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsGeoIPParser) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsGeoIPParser) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGeoIPParser) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsGeoIPParser) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsGeoIPParser) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value. -func (o *LogsGeoIPParser) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsGeoIPParser) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsGeoIPParser) SetSources(v []string) { - o.Sources = v -} - -// GetTarget returns the Target field value. -func (o *LogsGeoIPParser) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsGeoIPParser) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsGeoIPParser) SetTarget(v string) { - o.Target = v -} - -// GetType returns the Type field value. -func (o *LogsGeoIPParser) GetType() LogsGeoIPParserType { - if o == nil { - var ret LogsGeoIPParserType - 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 *LogsGeoIPParser) GetTypeOk() (*LogsGeoIPParserType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsGeoIPParser) SetType(v LogsGeoIPParserType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsGeoIPParser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["sources"] = o.Sources - toSerialize["target"] = o.Target - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsGeoIPParserType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - Type LogsGeoIPParserType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Sources = all.Sources - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_geo_ip_parser_type.go b/api/v1/datadog/model_logs_geo_ip_parser_type.go deleted file mode 100644 index ffb2ea7cfe8..00000000000 --- a/api/v1/datadog/model_logs_geo_ip_parser_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsGeoIPParserType Type of GeoIP parser. -type LogsGeoIPParserType string - -// List of LogsGeoIPParserType. -const ( - LOGSGEOIPPARSERTYPE_GEO_IP_PARSER LogsGeoIPParserType = "geo-ip-parser" -) - -var allowedLogsGeoIPParserTypeEnumValues = []LogsGeoIPParserType{ - LOGSGEOIPPARSERTYPE_GEO_IP_PARSER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsGeoIPParserType) GetAllowedValues() []LogsGeoIPParserType { - return allowedLogsGeoIPParserTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsGeoIPParserType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsGeoIPParserType(value) - return nil -} - -// NewLogsGeoIPParserTypeFromValue returns a pointer to a valid LogsGeoIPParserType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsGeoIPParserTypeFromValue(v string) (*LogsGeoIPParserType, error) { - ev := LogsGeoIPParserType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsGeoIPParserType: valid values are %v", v, allowedLogsGeoIPParserTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsGeoIPParserType) IsValid() bool { - for _, existing := range allowedLogsGeoIPParserTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsGeoIPParserType value. -func (v LogsGeoIPParserType) Ptr() *LogsGeoIPParserType { - return &v -} - -// NullableLogsGeoIPParserType handles when a null is used for LogsGeoIPParserType. -type NullableLogsGeoIPParserType struct { - value *LogsGeoIPParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGeoIPParserType) Get() *LogsGeoIPParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGeoIPParserType) Set(val *LogsGeoIPParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGeoIPParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsGeoIPParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGeoIPParserType initializes the struct as if Set has been called. -func NewNullableLogsGeoIPParserType(val *LogsGeoIPParserType) *NullableLogsGeoIPParserType { - return &NullableLogsGeoIPParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGeoIPParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGeoIPParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_grok_parser.go b/api/v1/datadog/model_logs_grok_parser.go deleted file mode 100644 index 66730fe8144..00000000000 --- a/api/v1/datadog/model_logs_grok_parser.go +++ /dev/null @@ -1,310 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsGrokParser Create custom grok rules to parse the full message or [a specific attribute of your raw event](https://docs.datadoghq.com/logs/log_configuration/parsing/#advanced-settings). -// For more information, see the [parsing section](https://docs.datadoghq.com/logs/log_configuration/parsing). -type LogsGrokParser struct { - // Set of rules for the grok parser. - Grok LogsGrokParserRules `json:"grok"` - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // List of sample logs to test this grok parser. - Samples []string `json:"samples,omitempty"` - // Name of the log attribute to parse. - Source string `json:"source"` - // Type of logs grok parser. - Type LogsGrokParserType `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{} -} - -// NewLogsGrokParser instantiates a new LogsGrokParser 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 NewLogsGrokParser(grok LogsGrokParserRules, source string, typeVar LogsGrokParserType) *LogsGrokParser { - this := LogsGrokParser{} - this.Grok = grok - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Source = source - this.Type = typeVar - return &this -} - -// NewLogsGrokParserWithDefaults instantiates a new LogsGrokParser 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 NewLogsGrokParserWithDefaults() *LogsGrokParser { - this := LogsGrokParser{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var source string = "message" - this.Source = source - var typeVar LogsGrokParserType = LOGSGROKPARSERTYPE_GROK_PARSER - this.Type = typeVar - return &this -} - -// GetGrok returns the Grok field value. -func (o *LogsGrokParser) GetGrok() LogsGrokParserRules { - if o == nil { - var ret LogsGrokParserRules - return ret - } - return o.Grok -} - -// GetGrokOk returns a tuple with the Grok field value -// and a boolean to check if the value has been set. -func (o *LogsGrokParser) GetGrokOk() (*LogsGrokParserRules, bool) { - if o == nil { - return nil, false - } - return &o.Grok, true -} - -// SetGrok sets field value. -func (o *LogsGrokParser) SetGrok(v LogsGrokParserRules) { - o.Grok = v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsGrokParser) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGrokParser) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsGrokParser) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsGrokParser) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsGrokParser) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGrokParser) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsGrokParser) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsGrokParser) SetName(v string) { - o.Name = &v -} - -// GetSamples returns the Samples field value if set, zero value otherwise. -func (o *LogsGrokParser) GetSamples() []string { - if o == nil || o.Samples == nil { - var ret []string - return ret - } - return o.Samples -} - -// GetSamplesOk returns a tuple with the Samples field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGrokParser) GetSamplesOk() (*[]string, bool) { - if o == nil || o.Samples == nil { - return nil, false - } - return &o.Samples, true -} - -// HasSamples returns a boolean if a field has been set. -func (o *LogsGrokParser) HasSamples() bool { - if o != nil && o.Samples != nil { - return true - } - - return false -} - -// SetSamples gets a reference to the given []string and assigns it to the Samples field. -func (o *LogsGrokParser) SetSamples(v []string) { - o.Samples = v -} - -// GetSource returns the Source field value. -func (o *LogsGrokParser) GetSource() string { - if o == nil { - var ret string - return ret - } - return o.Source -} - -// GetSourceOk returns a tuple with the Source field value -// and a boolean to check if the value has been set. -func (o *LogsGrokParser) GetSourceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Source, true -} - -// SetSource sets field value. -func (o *LogsGrokParser) SetSource(v string) { - o.Source = v -} - -// GetType returns the Type field value. -func (o *LogsGrokParser) GetType() LogsGrokParserType { - if o == nil { - var ret LogsGrokParserType - 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 *LogsGrokParser) GetTypeOk() (*LogsGrokParserType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsGrokParser) SetType(v LogsGrokParserType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsGrokParser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["grok"] = o.Grok - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Samples != nil { - toSerialize["samples"] = o.Samples - } - toSerialize["source"] = o.Source - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Grok *LogsGrokParserRules `json:"grok"` - Source *string `json:"source"` - Type *LogsGrokParserType `json:"type"` - }{} - all := struct { - Grok LogsGrokParserRules `json:"grok"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Samples []string `json:"samples,omitempty"` - Source string `json:"source"` - Type LogsGrokParserType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Grok == nil { - return fmt.Errorf("Required field grok missing") - } - if required.Source == nil { - return fmt.Errorf("Required field source missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Grok.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Grok = all.Grok - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Samples = all.Samples - o.Source = all.Source - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_grok_parser_rules.go b/api/v1/datadog/model_logs_grok_parser_rules.go deleted file mode 100644 index 1dcb84de9d3..00000000000 --- a/api/v1/datadog/model_logs_grok_parser_rules.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsGrokParserRules Set of rules for the grok parser. -type LogsGrokParserRules struct { - // List of match rules for the grok parser, separated by a new line. - MatchRules string `json:"match_rules"` - // List of support rules for the grok parser, separated by a new line. - SupportRules *string `json:"support_rules,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{} -} - -// NewLogsGrokParserRules instantiates a new LogsGrokParserRules 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 NewLogsGrokParserRules(matchRules string) *LogsGrokParserRules { - this := LogsGrokParserRules{} - this.MatchRules = matchRules - var supportRules string = "" - this.SupportRules = &supportRules - return &this -} - -// NewLogsGrokParserRulesWithDefaults instantiates a new LogsGrokParserRules 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 NewLogsGrokParserRulesWithDefaults() *LogsGrokParserRules { - this := LogsGrokParserRules{} - var supportRules string = "" - this.SupportRules = &supportRules - return &this -} - -// GetMatchRules returns the MatchRules field value. -func (o *LogsGrokParserRules) GetMatchRules() string { - if o == nil { - var ret string - return ret - } - return o.MatchRules -} - -// GetMatchRulesOk returns a tuple with the MatchRules field value -// and a boolean to check if the value has been set. -func (o *LogsGrokParserRules) GetMatchRulesOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.MatchRules, true -} - -// SetMatchRules sets field value. -func (o *LogsGrokParserRules) SetMatchRules(v string) { - o.MatchRules = v -} - -// GetSupportRules returns the SupportRules field value if set, zero value otherwise. -func (o *LogsGrokParserRules) GetSupportRules() string { - if o == nil || o.SupportRules == nil { - var ret string - return ret - } - return *o.SupportRules -} - -// GetSupportRulesOk returns a tuple with the SupportRules field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGrokParserRules) GetSupportRulesOk() (*string, bool) { - if o == nil || o.SupportRules == nil { - return nil, false - } - return o.SupportRules, true -} - -// HasSupportRules returns a boolean if a field has been set. -func (o *LogsGrokParserRules) HasSupportRules() bool { - if o != nil && o.SupportRules != nil { - return true - } - - return false -} - -// SetSupportRules gets a reference to the given string and assigns it to the SupportRules field. -func (o *LogsGrokParserRules) SetSupportRules(v string) { - o.SupportRules = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsGrokParserRules) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["match_rules"] = o.MatchRules - if o.SupportRules != nil { - toSerialize["support_rules"] = o.SupportRules - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsGrokParserRules) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - MatchRules *string `json:"match_rules"` - }{} - all := struct { - MatchRules string `json:"match_rules"` - SupportRules *string `json:"support_rules,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.MatchRules == nil { - return fmt.Errorf("Required field match_rules missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.MatchRules = all.MatchRules - o.SupportRules = all.SupportRules - return nil -} diff --git a/api/v1/datadog/model_logs_grok_parser_type.go b/api/v1/datadog/model_logs_grok_parser_type.go deleted file mode 100644 index 1a59b876892..00000000000 --- a/api/v1/datadog/model_logs_grok_parser_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsGrokParserType Type of logs grok parser. -type LogsGrokParserType string - -// List of LogsGrokParserType. -const ( - LOGSGROKPARSERTYPE_GROK_PARSER LogsGrokParserType = "grok-parser" -) - -var allowedLogsGrokParserTypeEnumValues = []LogsGrokParserType{ - LOGSGROKPARSERTYPE_GROK_PARSER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsGrokParserType) GetAllowedValues() []LogsGrokParserType { - return allowedLogsGrokParserTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsGrokParserType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsGrokParserType(value) - return nil -} - -// NewLogsGrokParserTypeFromValue returns a pointer to a valid LogsGrokParserType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsGrokParserTypeFromValue(v string) (*LogsGrokParserType, error) { - ev := LogsGrokParserType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsGrokParserType: valid values are %v", v, allowedLogsGrokParserTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsGrokParserType) IsValid() bool { - for _, existing := range allowedLogsGrokParserTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsGrokParserType value. -func (v LogsGrokParserType) Ptr() *LogsGrokParserType { - return &v -} - -// NullableLogsGrokParserType handles when a null is used for LogsGrokParserType. -type NullableLogsGrokParserType struct { - value *LogsGrokParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGrokParserType) Get() *LogsGrokParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGrokParserType) Set(val *LogsGrokParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGrokParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsGrokParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGrokParserType initializes the struct as if Set has been called. -func NewNullableLogsGrokParserType(val *LogsGrokParserType) *NullableLogsGrokParserType { - return &NullableLogsGrokParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGrokParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGrokParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_index.go b/api/v1/datadog/model_logs_index.go deleted file mode 100644 index d6715c78e20..00000000000 --- a/api/v1/datadog/model_logs_index.go +++ /dev/null @@ -1,303 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsIndex Object describing a Datadog Log index. -type LogsIndex struct { - // The number of log events you can send in this index per day before you are rate-limited. - DailyLimit *int64 `json:"daily_limit,omitempty"` - // An array of exclusion objects. The logs are tested against the query of each filter, - // following the order of the array. Only the first matching active exclusion matters, - // others (if any) are ignored. - ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` - // Filter for logs. - Filter LogsFilter `json:"filter"` - // A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. - // Rate limit is reset every-day at 2pm UTC. - IsRateLimited *bool `json:"is_rate_limited,omitempty"` - // The name of the index. - Name string `json:"name"` - // The number of days before logs are deleted from this index. Available values depend on - // retention plans specified in your organization's contract/subscriptions. - NumRetentionDays *int64 `json:"num_retention_days,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{} -} - -// NewLogsIndex instantiates a new LogsIndex 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 NewLogsIndex(filter LogsFilter, name string) *LogsIndex { - this := LogsIndex{} - this.Filter = filter - this.Name = name - return &this -} - -// NewLogsIndexWithDefaults instantiates a new LogsIndex 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 NewLogsIndexWithDefaults() *LogsIndex { - this := LogsIndex{} - return &this -} - -// GetDailyLimit returns the DailyLimit field value if set, zero value otherwise. -func (o *LogsIndex) GetDailyLimit() int64 { - if o == nil || o.DailyLimit == nil { - var ret int64 - return ret - } - return *o.DailyLimit -} - -// GetDailyLimitOk returns a tuple with the DailyLimit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndex) GetDailyLimitOk() (*int64, bool) { - if o == nil || o.DailyLimit == nil { - return nil, false - } - return o.DailyLimit, true -} - -// HasDailyLimit returns a boolean if a field has been set. -func (o *LogsIndex) HasDailyLimit() bool { - if o != nil && o.DailyLimit != nil { - return true - } - - return false -} - -// SetDailyLimit gets a reference to the given int64 and assigns it to the DailyLimit field. -func (o *LogsIndex) SetDailyLimit(v int64) { - o.DailyLimit = &v -} - -// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. -func (o *LogsIndex) GetExclusionFilters() []LogsExclusion { - if o == nil || o.ExclusionFilters == nil { - var ret []LogsExclusion - return ret - } - return o.ExclusionFilters -} - -// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndex) GetExclusionFiltersOk() (*[]LogsExclusion, bool) { - if o == nil || o.ExclusionFilters == nil { - return nil, false - } - return &o.ExclusionFilters, true -} - -// HasExclusionFilters returns a boolean if a field has been set. -func (o *LogsIndex) HasExclusionFilters() bool { - if o != nil && o.ExclusionFilters != nil { - return true - } - - return false -} - -// SetExclusionFilters gets a reference to the given []LogsExclusion and assigns it to the ExclusionFilters field. -func (o *LogsIndex) SetExclusionFilters(v []LogsExclusion) { - o.ExclusionFilters = v -} - -// GetFilter returns the Filter field value. -func (o *LogsIndex) GetFilter() LogsFilter { - if o == nil { - var ret LogsFilter - return ret - } - return o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value -// and a boolean to check if the value has been set. -func (o *LogsIndex) GetFilterOk() (*LogsFilter, bool) { - if o == nil { - return nil, false - } - return &o.Filter, true -} - -// SetFilter sets field value. -func (o *LogsIndex) SetFilter(v LogsFilter) { - o.Filter = v -} - -// GetIsRateLimited returns the IsRateLimited field value if set, zero value otherwise. -func (o *LogsIndex) GetIsRateLimited() bool { - if o == nil || o.IsRateLimited == nil { - var ret bool - return ret - } - return *o.IsRateLimited -} - -// GetIsRateLimitedOk returns a tuple with the IsRateLimited field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndex) GetIsRateLimitedOk() (*bool, bool) { - if o == nil || o.IsRateLimited == nil { - return nil, false - } - return o.IsRateLimited, true -} - -// HasIsRateLimited returns a boolean if a field has been set. -func (o *LogsIndex) HasIsRateLimited() bool { - if o != nil && o.IsRateLimited != nil { - return true - } - - return false -} - -// SetIsRateLimited gets a reference to the given bool and assigns it to the IsRateLimited field. -func (o *LogsIndex) SetIsRateLimited(v bool) { - o.IsRateLimited = &v -} - -// GetName returns the Name field value. -func (o *LogsIndex) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *LogsIndex) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *LogsIndex) SetName(v string) { - o.Name = v -} - -// GetNumRetentionDays returns the NumRetentionDays field value if set, zero value otherwise. -func (o *LogsIndex) GetNumRetentionDays() int64 { - if o == nil || o.NumRetentionDays == nil { - var ret int64 - return ret - } - return *o.NumRetentionDays -} - -// GetNumRetentionDaysOk returns a tuple with the NumRetentionDays field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndex) GetNumRetentionDaysOk() (*int64, bool) { - if o == nil || o.NumRetentionDays == nil { - return nil, false - } - return o.NumRetentionDays, true -} - -// HasNumRetentionDays returns a boolean if a field has been set. -func (o *LogsIndex) HasNumRetentionDays() bool { - if o != nil && o.NumRetentionDays != nil { - return true - } - - return false -} - -// SetNumRetentionDays gets a reference to the given int64 and assigns it to the NumRetentionDays field. -func (o *LogsIndex) SetNumRetentionDays(v int64) { - o.NumRetentionDays = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsIndex) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DailyLimit != nil { - toSerialize["daily_limit"] = o.DailyLimit - } - if o.ExclusionFilters != nil { - toSerialize["exclusion_filters"] = o.ExclusionFilters - } - toSerialize["filter"] = o.Filter - if o.IsRateLimited != nil { - toSerialize["is_rate_limited"] = o.IsRateLimited - } - toSerialize["name"] = o.Name - if o.NumRetentionDays != nil { - toSerialize["num_retention_days"] = o.NumRetentionDays - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Filter *LogsFilter `json:"filter"` - Name *string `json:"name"` - }{} - all := struct { - DailyLimit *int64 `json:"daily_limit,omitempty"` - ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` - Filter LogsFilter `json:"filter"` - IsRateLimited *bool `json:"is_rate_limited,omitempty"` - Name string `json:"name"` - NumRetentionDays *int64 `json:"num_retention_days,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Filter == nil { - return fmt.Errorf("Required field filter missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DailyLimit = all.DailyLimit - o.ExclusionFilters = all.ExclusionFilters - if all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.IsRateLimited = all.IsRateLimited - o.Name = all.Name - o.NumRetentionDays = all.NumRetentionDays - return nil -} diff --git a/api/v1/datadog/model_logs_index_list_response.go b/api/v1/datadog/model_logs_index_list_response.go deleted file mode 100644 index dd00ac6e4a5..00000000000 --- a/api/v1/datadog/model_logs_index_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsIndexListResponse Object with all Index configurations for a given organization. -type LogsIndexListResponse struct { - // Array of Log index configurations. - Indexes []LogsIndex `json:"indexes,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{} -} - -// NewLogsIndexListResponse instantiates a new LogsIndexListResponse 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 NewLogsIndexListResponse() *LogsIndexListResponse { - this := LogsIndexListResponse{} - return &this -} - -// NewLogsIndexListResponseWithDefaults instantiates a new LogsIndexListResponse 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 NewLogsIndexListResponseWithDefaults() *LogsIndexListResponse { - this := LogsIndexListResponse{} - return &this -} - -// GetIndexes returns the Indexes field value if set, zero value otherwise. -func (o *LogsIndexListResponse) GetIndexes() []LogsIndex { - if o == nil || o.Indexes == nil { - var ret []LogsIndex - return ret - } - return o.Indexes -} - -// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndexListResponse) GetIndexesOk() (*[]LogsIndex, bool) { - if o == nil || o.Indexes == nil { - return nil, false - } - return &o.Indexes, true -} - -// HasIndexes returns a boolean if a field has been set. -func (o *LogsIndexListResponse) HasIndexes() bool { - if o != nil && o.Indexes != nil { - return true - } - - return false -} - -// SetIndexes gets a reference to the given []LogsIndex and assigns it to the Indexes field. -func (o *LogsIndexListResponse) SetIndexes(v []LogsIndex) { - o.Indexes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsIndexListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Indexes != nil { - toSerialize["indexes"] = o.Indexes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsIndexListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Indexes []LogsIndex `json:"indexes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Indexes = all.Indexes - return nil -} diff --git a/api/v1/datadog/model_logs_index_update_request.go b/api/v1/datadog/model_logs_index_update_request.go deleted file mode 100644 index eb3765aae33..00000000000 --- a/api/v1/datadog/model_logs_index_update_request.go +++ /dev/null @@ -1,274 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsIndexUpdateRequest Object for updating a Datadog Log index. -type LogsIndexUpdateRequest struct { - // The number of log events you can send in this index per day before you are rate-limited. - DailyLimit *int64 `json:"daily_limit,omitempty"` - // If true, sets the `daily_limit` value to null and the index is not limited on a daily basis (any - // specified `daily_limit` value in the request is ignored). If false or omitted, the index's current - // `daily_limit` is maintained. - DisableDailyLimit *bool `json:"disable_daily_limit,omitempty"` - // An array of exclusion objects. The logs are tested against the query of each filter, - // following the order of the array. Only the first matching active exclusion matters, - // others (if any) are ignored. - ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` - // Filter for logs. - Filter LogsFilter `json:"filter"` - // The number of days before logs are deleted from this index. Available values depend on - // retention plans specified in your organization's contract/subscriptions. - // - // **Note:** Changing the retention for an index adjusts the length of retention for all logs - // already in this index. It may also affect billing. - NumRetentionDays *int64 `json:"num_retention_days,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{} -} - -// NewLogsIndexUpdateRequest instantiates a new LogsIndexUpdateRequest 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 NewLogsIndexUpdateRequest(filter LogsFilter) *LogsIndexUpdateRequest { - this := LogsIndexUpdateRequest{} - this.Filter = filter - return &this -} - -// NewLogsIndexUpdateRequestWithDefaults instantiates a new LogsIndexUpdateRequest 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 NewLogsIndexUpdateRequestWithDefaults() *LogsIndexUpdateRequest { - this := LogsIndexUpdateRequest{} - return &this -} - -// GetDailyLimit returns the DailyLimit field value if set, zero value otherwise. -func (o *LogsIndexUpdateRequest) GetDailyLimit() int64 { - if o == nil || o.DailyLimit == nil { - var ret int64 - return ret - } - return *o.DailyLimit -} - -// GetDailyLimitOk returns a tuple with the DailyLimit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndexUpdateRequest) GetDailyLimitOk() (*int64, bool) { - if o == nil || o.DailyLimit == nil { - return nil, false - } - return o.DailyLimit, true -} - -// HasDailyLimit returns a boolean if a field has been set. -func (o *LogsIndexUpdateRequest) HasDailyLimit() bool { - if o != nil && o.DailyLimit != nil { - return true - } - - return false -} - -// SetDailyLimit gets a reference to the given int64 and assigns it to the DailyLimit field. -func (o *LogsIndexUpdateRequest) SetDailyLimit(v int64) { - o.DailyLimit = &v -} - -// GetDisableDailyLimit returns the DisableDailyLimit field value if set, zero value otherwise. -func (o *LogsIndexUpdateRequest) GetDisableDailyLimit() bool { - if o == nil || o.DisableDailyLimit == nil { - var ret bool - return ret - } - return *o.DisableDailyLimit -} - -// GetDisableDailyLimitOk returns a tuple with the DisableDailyLimit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndexUpdateRequest) GetDisableDailyLimitOk() (*bool, bool) { - if o == nil || o.DisableDailyLimit == nil { - return nil, false - } - return o.DisableDailyLimit, true -} - -// HasDisableDailyLimit returns a boolean if a field has been set. -func (o *LogsIndexUpdateRequest) HasDisableDailyLimit() bool { - if o != nil && o.DisableDailyLimit != nil { - return true - } - - return false -} - -// SetDisableDailyLimit gets a reference to the given bool and assigns it to the DisableDailyLimit field. -func (o *LogsIndexUpdateRequest) SetDisableDailyLimit(v bool) { - o.DisableDailyLimit = &v -} - -// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. -func (o *LogsIndexUpdateRequest) GetExclusionFilters() []LogsExclusion { - if o == nil || o.ExclusionFilters == nil { - var ret []LogsExclusion - return ret - } - return o.ExclusionFilters -} - -// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndexUpdateRequest) GetExclusionFiltersOk() (*[]LogsExclusion, bool) { - if o == nil || o.ExclusionFilters == nil { - return nil, false - } - return &o.ExclusionFilters, true -} - -// HasExclusionFilters returns a boolean if a field has been set. -func (o *LogsIndexUpdateRequest) HasExclusionFilters() bool { - if o != nil && o.ExclusionFilters != nil { - return true - } - - return false -} - -// SetExclusionFilters gets a reference to the given []LogsExclusion and assigns it to the ExclusionFilters field. -func (o *LogsIndexUpdateRequest) SetExclusionFilters(v []LogsExclusion) { - o.ExclusionFilters = v -} - -// GetFilter returns the Filter field value. -func (o *LogsIndexUpdateRequest) GetFilter() LogsFilter { - if o == nil { - var ret LogsFilter - return ret - } - return o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value -// and a boolean to check if the value has been set. -func (o *LogsIndexUpdateRequest) GetFilterOk() (*LogsFilter, bool) { - if o == nil { - return nil, false - } - return &o.Filter, true -} - -// SetFilter sets field value. -func (o *LogsIndexUpdateRequest) SetFilter(v LogsFilter) { - o.Filter = v -} - -// GetNumRetentionDays returns the NumRetentionDays field value if set, zero value otherwise. -func (o *LogsIndexUpdateRequest) GetNumRetentionDays() int64 { - if o == nil || o.NumRetentionDays == nil { - var ret int64 - return ret - } - return *o.NumRetentionDays -} - -// GetNumRetentionDaysOk returns a tuple with the NumRetentionDays field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsIndexUpdateRequest) GetNumRetentionDaysOk() (*int64, bool) { - if o == nil || o.NumRetentionDays == nil { - return nil, false - } - return o.NumRetentionDays, true -} - -// HasNumRetentionDays returns a boolean if a field has been set. -func (o *LogsIndexUpdateRequest) HasNumRetentionDays() bool { - if o != nil && o.NumRetentionDays != nil { - return true - } - - return false -} - -// SetNumRetentionDays gets a reference to the given int64 and assigns it to the NumRetentionDays field. -func (o *LogsIndexUpdateRequest) SetNumRetentionDays(v int64) { - o.NumRetentionDays = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsIndexUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DailyLimit != nil { - toSerialize["daily_limit"] = o.DailyLimit - } - if o.DisableDailyLimit != nil { - toSerialize["disable_daily_limit"] = o.DisableDailyLimit - } - if o.ExclusionFilters != nil { - toSerialize["exclusion_filters"] = o.ExclusionFilters - } - toSerialize["filter"] = o.Filter - if o.NumRetentionDays != nil { - toSerialize["num_retention_days"] = o.NumRetentionDays - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Filter *LogsFilter `json:"filter"` - }{} - all := struct { - DailyLimit *int64 `json:"daily_limit,omitempty"` - DisableDailyLimit *bool `json:"disable_daily_limit,omitempty"` - ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` - Filter LogsFilter `json:"filter"` - NumRetentionDays *int64 `json:"num_retention_days,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Filter == nil { - return fmt.Errorf("Required field filter missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DailyLimit = all.DailyLimit - o.DisableDailyLimit = all.DisableDailyLimit - o.ExclusionFilters = all.ExclusionFilters - if all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.NumRetentionDays = all.NumRetentionDays - return nil -} diff --git a/api/v1/datadog/model_logs_indexes_order.go b/api/v1/datadog/model_logs_indexes_order.go deleted file mode 100644 index fecda023599..00000000000 --- a/api/v1/datadog/model_logs_indexes_order.go +++ /dev/null @@ -1,105 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsIndexesOrder Object containing the ordered list of log index names. -type LogsIndexesOrder struct { - // Array of strings identifying by their name(s) the index(es) of your organization. - // Logs are tested against the query filter of each index one by one, following the order of the array. - // Logs are eventually stored in the first matching index. - IndexNames []string `json:"index_names"` - // 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{} -} - -// NewLogsIndexesOrder instantiates a new LogsIndexesOrder 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 NewLogsIndexesOrder(indexNames []string) *LogsIndexesOrder { - this := LogsIndexesOrder{} - this.IndexNames = indexNames - return &this -} - -// NewLogsIndexesOrderWithDefaults instantiates a new LogsIndexesOrder 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 NewLogsIndexesOrderWithDefaults() *LogsIndexesOrder { - this := LogsIndexesOrder{} - return &this -} - -// GetIndexNames returns the IndexNames field value. -func (o *LogsIndexesOrder) GetIndexNames() []string { - if o == nil { - var ret []string - return ret - } - return o.IndexNames -} - -// GetIndexNamesOk returns a tuple with the IndexNames field value -// and a boolean to check if the value has been set. -func (o *LogsIndexesOrder) GetIndexNamesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.IndexNames, true -} - -// SetIndexNames sets field value. -func (o *LogsIndexesOrder) SetIndexNames(v []string) { - o.IndexNames = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsIndexesOrder) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["index_names"] = o.IndexNames - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsIndexesOrder) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - IndexNames *[]string `json:"index_names"` - }{} - all := struct { - IndexNames []string `json:"index_names"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IndexNames == nil { - return fmt.Errorf("Required field index_names missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IndexNames = all.IndexNames - return nil -} diff --git a/api/v1/datadog/model_logs_list_request.go b/api/v1/datadog/model_logs_list_request.go deleted file mode 100644 index 3adfa1c8574..00000000000 --- a/api/v1/datadog/model_logs_list_request.go +++ /dev/null @@ -1,318 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsListRequest Object to send with the request to retrieve a list of logs from your Organization. -type LogsListRequest struct { - // The log index on which the request is performed. For multi-index organizations, - // the default is all live indexes. Historical indexes of rehydrated logs must be specified. - Index *string `json:"index,omitempty"` - // Number of logs return in the response. - Limit *int32 `json:"limit,omitempty"` - // The search query - following the log search syntax. - Query *string `json:"query,omitempty"` - // Time-ascending `asc` or time-descending `desc` results. - Sort *LogsSort `json:"sort,omitempty"` - // Hash identifier of the first log to return in the list, available in a log `id` attribute. - // This parameter is used for the pagination feature. - // - // **Note**: This parameter is ignored if the corresponding log - // is out of the scope of the specified time window. - StartAt *string `json:"startAt,omitempty"` - // Timeframe to retrieve the log from. - Time LogsListRequestTime `json:"time"` - // 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{} -} - -// NewLogsListRequest instantiates a new LogsListRequest 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 NewLogsListRequest(time LogsListRequestTime) *LogsListRequest { - this := LogsListRequest{} - this.Time = time - return &this -} - -// NewLogsListRequestWithDefaults instantiates a new LogsListRequest 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 NewLogsListRequestWithDefaults() *LogsListRequest { - this := LogsListRequest{} - return &this -} - -// GetIndex returns the Index field value if set, zero value otherwise. -func (o *LogsListRequest) GetIndex() string { - if o == nil || o.Index == nil { - var ret string - return ret - } - return *o.Index -} - -// GetIndexOk returns a tuple with the Index field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetIndexOk() (*string, bool) { - if o == nil || o.Index == nil { - return nil, false - } - return o.Index, true -} - -// HasIndex returns a boolean if a field has been set. -func (o *LogsListRequest) HasIndex() bool { - if o != nil && o.Index != nil { - return true - } - - return false -} - -// SetIndex gets a reference to the given string and assigns it to the Index field. -func (o *LogsListRequest) SetIndex(v string) { - o.Index = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *LogsListRequest) GetLimit() int32 { - if o == nil || o.Limit == nil { - var ret int32 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetLimitOk() (*int32, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *LogsListRequest) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int32 and assigns it to the Limit field. -func (o *LogsListRequest) SetLimit(v int32) { - o.Limit = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *LogsListRequest) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *LogsListRequest) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *LogsListRequest) SetQuery(v string) { - o.Query = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *LogsListRequest) GetSort() LogsSort { - if o == nil || o.Sort == nil { - var ret LogsSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetSortOk() (*LogsSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *LogsListRequest) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given LogsSort and assigns it to the Sort field. -func (o *LogsListRequest) SetSort(v LogsSort) { - o.Sort = &v -} - -// GetStartAt returns the StartAt field value if set, zero value otherwise. -func (o *LogsListRequest) GetStartAt() string { - if o == nil || o.StartAt == nil { - var ret string - return ret - } - return *o.StartAt -} - -// GetStartAtOk returns a tuple with the StartAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetStartAtOk() (*string, bool) { - if o == nil || o.StartAt == nil { - return nil, false - } - return o.StartAt, true -} - -// HasStartAt returns a boolean if a field has been set. -func (o *LogsListRequest) HasStartAt() bool { - if o != nil && o.StartAt != nil { - return true - } - - return false -} - -// SetStartAt gets a reference to the given string and assigns it to the StartAt field. -func (o *LogsListRequest) SetStartAt(v string) { - o.StartAt = &v -} - -// GetTime returns the Time field value. -func (o *LogsListRequest) GetTime() LogsListRequestTime { - if o == nil { - var ret LogsListRequestTime - return ret - } - return o.Time -} - -// GetTimeOk returns a tuple with the Time field value -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetTimeOk() (*LogsListRequestTime, bool) { - if o == nil { - return nil, false - } - return &o.Time, true -} - -// SetTime sets field value. -func (o *LogsListRequest) SetTime(v LogsListRequestTime) { - o.Time = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsListRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Index != nil { - toSerialize["index"] = o.Index - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - if o.StartAt != nil { - toSerialize["startAt"] = o.StartAt - } - toSerialize["time"] = o.Time - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Time *LogsListRequestTime `json:"time"` - }{} - all := struct { - Index *string `json:"index,omitempty"` - Limit *int32 `json:"limit,omitempty"` - Query *string `json:"query,omitempty"` - Sort *LogsSort `json:"sort,omitempty"` - StartAt *string `json:"startAt,omitempty"` - Time LogsListRequestTime `json:"time"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Time == nil { - return fmt.Errorf("Required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Index = all.Index - o.Limit = all.Limit - o.Query = all.Query - o.Sort = all.Sort - o.StartAt = all.StartAt - if all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_logs_list_request_time.go b/api/v1/datadog/model_logs_list_request_time.go deleted file mode 100644 index dfd409ad7fd..00000000000 --- a/api/v1/datadog/model_logs_list_request_time.go +++ /dev/null @@ -1,185 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" -) - -// LogsListRequestTime Timeframe to retrieve the log from. -type LogsListRequestTime struct { - // Minimum timestamp for requested logs. - From time.Time `json:"from"` - // Timezone can be specified both as an offset (for example "UTC+03:00") - // or a regional zone (for example "Europe/Paris"). - Timezone *string `json:"timezone,omitempty"` - // Maximum timestamp for requested logs. - To time.Time `json:"to"` - // 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{} -} - -// NewLogsListRequestTime instantiates a new LogsListRequestTime 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 NewLogsListRequestTime(from time.Time, to time.Time) *LogsListRequestTime { - this := LogsListRequestTime{} - this.From = from - this.To = to - return &this -} - -// NewLogsListRequestTimeWithDefaults instantiates a new LogsListRequestTime 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 NewLogsListRequestTimeWithDefaults() *LogsListRequestTime { - this := LogsListRequestTime{} - return &this -} - -// GetFrom returns the From field value. -func (o *LogsListRequestTime) GetFrom() time.Time { - if o == nil { - var ret time.Time - return ret - } - return o.From -} - -// GetFromOk returns a tuple with the From field value -// and a boolean to check if the value has been set. -func (o *LogsListRequestTime) GetFromOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.From, true -} - -// SetFrom sets field value. -func (o *LogsListRequestTime) SetFrom(v time.Time) { - o.From = v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *LogsListRequestTime) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequestTime) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *LogsListRequestTime) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *LogsListRequestTime) SetTimezone(v string) { - o.Timezone = &v -} - -// GetTo returns the To field value. -func (o *LogsListRequestTime) GetTo() time.Time { - if o == nil { - var ret time.Time - return ret - } - return o.To -} - -// GetToOk returns a tuple with the To field value -// and a boolean to check if the value has been set. -func (o *LogsListRequestTime) GetToOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.To, true -} - -// SetTo sets field value. -func (o *LogsListRequestTime) SetTo(v time.Time) { - o.To = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsListRequestTime) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.From.Nanosecond() == 0 { - toSerialize["from"] = o.From.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["from"] = o.From.Format("2006-01-02T15:04:05.000Z07:00") - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - if o.To.Nanosecond() == 0 { - toSerialize["to"] = o.To.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["to"] = o.To.Format("2006-01-02T15:04:05.000Z07:00") - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsListRequestTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - From *time.Time `json:"from"` - To *time.Time `json:"to"` - }{} - all := struct { - From time.Time `json:"from"` - Timezone *string `json:"timezone,omitempty"` - To time.Time `json:"to"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.From == nil { - return fmt.Errorf("Required field from missing") - } - if required.To == nil { - return fmt.Errorf("Required field to missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.From = all.From - o.Timezone = all.Timezone - o.To = all.To - return nil -} diff --git a/api/v1/datadog/model_logs_list_response.go b/api/v1/datadog/model_logs_list_response.go deleted file mode 100644 index 02b5e778efc..00000000000 --- a/api/v1/datadog/model_logs_list_response.go +++ /dev/null @@ -1,181 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsListResponse Response object with all logs matching the request and pagination information. -type LogsListResponse struct { - // Array of logs matching the request and the `nextLogId` if sent. - Logs []Log `json:"logs,omitempty"` - // Hash identifier of the next log to return in the list. - // This parameter is used for the pagination feature. - NextLogId *string `json:"nextLogId,omitempty"` - // Status of the response. - Status *string `json:"status,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{} -} - -// NewLogsListResponse instantiates a new LogsListResponse 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 NewLogsListResponse() *LogsListResponse { - this := LogsListResponse{} - return &this -} - -// NewLogsListResponseWithDefaults instantiates a new LogsListResponse 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 NewLogsListResponseWithDefaults() *LogsListResponse { - this := LogsListResponse{} - return &this -} - -// GetLogs returns the Logs field value if set, zero value otherwise. -func (o *LogsListResponse) GetLogs() []Log { - if o == nil || o.Logs == nil { - var ret []Log - return ret - } - return o.Logs -} - -// GetLogsOk returns a tuple with the Logs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListResponse) GetLogsOk() (*[]Log, bool) { - if o == nil || o.Logs == nil { - return nil, false - } - return &o.Logs, true -} - -// HasLogs returns a boolean if a field has been set. -func (o *LogsListResponse) HasLogs() bool { - if o != nil && o.Logs != nil { - return true - } - - return false -} - -// SetLogs gets a reference to the given []Log and assigns it to the Logs field. -func (o *LogsListResponse) SetLogs(v []Log) { - o.Logs = v -} - -// GetNextLogId returns the NextLogId field value if set, zero value otherwise. -func (o *LogsListResponse) GetNextLogId() string { - if o == nil || o.NextLogId == nil { - var ret string - return ret - } - return *o.NextLogId -} - -// GetNextLogIdOk returns a tuple with the NextLogId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListResponse) GetNextLogIdOk() (*string, bool) { - if o == nil || o.NextLogId == nil { - return nil, false - } - return o.NextLogId, true -} - -// HasNextLogId returns a boolean if a field has been set. -func (o *LogsListResponse) HasNextLogId() bool { - if o != nil && o.NextLogId != nil { - return true - } - - return false -} - -// SetNextLogId gets a reference to the given string and assigns it to the NextLogId field. -func (o *LogsListResponse) SetNextLogId(v string) { - o.NextLogId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *LogsListResponse) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListResponse) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *LogsListResponse) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *LogsListResponse) SetStatus(v string) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Logs != nil { - toSerialize["logs"] = o.Logs - } - if o.NextLogId != nil { - toSerialize["nextLogId"] = o.NextLogId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Logs []Log `json:"logs,omitempty"` - NextLogId *string `json:"nextLogId,omitempty"` - Status *string `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Logs = all.Logs - o.NextLogId = all.NextLogId - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_logs_lookup_processor.go b/api/v1/datadog/model_logs_lookup_processor.go deleted file mode 100644 index 09e29afc8a4..00000000000 --- a/api/v1/datadog/model_logs_lookup_processor.go +++ /dev/null @@ -1,340 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsLookupProcessor Use the Lookup Processor to define a mapping between a log attribute -// and a human readable value saved in the processors mapping table. -// For example, you can use the Lookup Processor to map an internal service ID -// into a human readable service name. Alternatively, you could also use it to check -// if the MAC address that just attempted to connect to the production -// environment belongs to your list of stolen machines. -type LogsLookupProcessor struct { - // Value to set the target attribute if the source value is not found in the list. - DefaultLookup *string `json:"default_lookup,omitempty"` - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Mapping table of values for the source attribute and their associated target attribute values, - // formatted as `["source_key1,target_value1", "source_key2,target_value2"]` - LookupTable []string `json:"lookup_table"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Source attribute used to perform the lookup. - Source string `json:"source"` - // Name of the attribute that contains the corresponding value in the mapping list - // or the `default_lookup` if not found in the mapping list. - Target string `json:"target"` - // Type of logs lookup processor. - Type LogsLookupProcessorType `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{} -} - -// NewLogsLookupProcessor instantiates a new LogsLookupProcessor 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 NewLogsLookupProcessor(lookupTable []string, source string, target string, typeVar LogsLookupProcessorType) *LogsLookupProcessor { - this := LogsLookupProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.LookupTable = lookupTable - this.Source = source - this.Target = target - this.Type = typeVar - return &this -} - -// NewLogsLookupProcessorWithDefaults instantiates a new LogsLookupProcessor 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 NewLogsLookupProcessorWithDefaults() *LogsLookupProcessor { - this := LogsLookupProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsLookupProcessorType = LOGSLOOKUPPROCESSORTYPE_LOOKUP_PROCESSOR - this.Type = typeVar - return &this -} - -// GetDefaultLookup returns the DefaultLookup field value if set, zero value otherwise. -func (o *LogsLookupProcessor) GetDefaultLookup() string { - if o == nil || o.DefaultLookup == nil { - var ret string - return ret - } - return *o.DefaultLookup -} - -// GetDefaultLookupOk returns a tuple with the DefaultLookup field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsLookupProcessor) GetDefaultLookupOk() (*string, bool) { - if o == nil || o.DefaultLookup == nil { - return nil, false - } - return o.DefaultLookup, true -} - -// HasDefaultLookup returns a boolean if a field has been set. -func (o *LogsLookupProcessor) HasDefaultLookup() bool { - if o != nil && o.DefaultLookup != nil { - return true - } - - return false -} - -// SetDefaultLookup gets a reference to the given string and assigns it to the DefaultLookup field. -func (o *LogsLookupProcessor) SetDefaultLookup(v string) { - o.DefaultLookup = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsLookupProcessor) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsLookupProcessor) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsLookupProcessor) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsLookupProcessor) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetLookupTable returns the LookupTable field value. -func (o *LogsLookupProcessor) GetLookupTable() []string { - if o == nil { - var ret []string - return ret - } - return o.LookupTable -} - -// GetLookupTableOk returns a tuple with the LookupTable field value -// and a boolean to check if the value has been set. -func (o *LogsLookupProcessor) GetLookupTableOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.LookupTable, true -} - -// SetLookupTable sets field value. -func (o *LogsLookupProcessor) SetLookupTable(v []string) { - o.LookupTable = v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsLookupProcessor) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsLookupProcessor) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsLookupProcessor) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsLookupProcessor) SetName(v string) { - o.Name = &v -} - -// GetSource returns the Source field value. -func (o *LogsLookupProcessor) GetSource() string { - if o == nil { - var ret string - return ret - } - return o.Source -} - -// GetSourceOk returns a tuple with the Source field value -// and a boolean to check if the value has been set. -func (o *LogsLookupProcessor) GetSourceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Source, true -} - -// SetSource sets field value. -func (o *LogsLookupProcessor) SetSource(v string) { - o.Source = v -} - -// GetTarget returns the Target field value. -func (o *LogsLookupProcessor) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsLookupProcessor) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsLookupProcessor) SetTarget(v string) { - o.Target = v -} - -// GetType returns the Type field value. -func (o *LogsLookupProcessor) GetType() LogsLookupProcessorType { - if o == nil { - var ret LogsLookupProcessorType - 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 *LogsLookupProcessor) GetTypeOk() (*LogsLookupProcessorType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsLookupProcessor) SetType(v LogsLookupProcessorType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsLookupProcessor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DefaultLookup != nil { - toSerialize["default_lookup"] = o.DefaultLookup - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - toSerialize["lookup_table"] = o.LookupTable - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["source"] = o.Source - toSerialize["target"] = o.Target - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - LookupTable *[]string `json:"lookup_table"` - Source *string `json:"source"` - Target *string `json:"target"` - Type *LogsLookupProcessorType `json:"type"` - }{} - all := struct { - DefaultLookup *string `json:"default_lookup,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - LookupTable []string `json:"lookup_table"` - Name *string `json:"name,omitempty"` - Source string `json:"source"` - Target string `json:"target"` - Type LogsLookupProcessorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.LookupTable == nil { - return fmt.Errorf("Required field lookup_table missing") - } - if required.Source == nil { - return fmt.Errorf("Required field source missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DefaultLookup = all.DefaultLookup - o.IsEnabled = all.IsEnabled - o.LookupTable = all.LookupTable - o.Name = all.Name - o.Source = all.Source - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_lookup_processor_type.go b/api/v1/datadog/model_logs_lookup_processor_type.go deleted file mode 100644 index 4816a2af434..00000000000 --- a/api/v1/datadog/model_logs_lookup_processor_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsLookupProcessorType Type of logs lookup processor. -type LogsLookupProcessorType string - -// List of LogsLookupProcessorType. -const ( - LOGSLOOKUPPROCESSORTYPE_LOOKUP_PROCESSOR LogsLookupProcessorType = "lookup-processor" -) - -var allowedLogsLookupProcessorTypeEnumValues = []LogsLookupProcessorType{ - LOGSLOOKUPPROCESSORTYPE_LOOKUP_PROCESSOR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsLookupProcessorType) GetAllowedValues() []LogsLookupProcessorType { - return allowedLogsLookupProcessorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsLookupProcessorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsLookupProcessorType(value) - return nil -} - -// NewLogsLookupProcessorTypeFromValue returns a pointer to a valid LogsLookupProcessorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsLookupProcessorTypeFromValue(v string) (*LogsLookupProcessorType, error) { - ev := LogsLookupProcessorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsLookupProcessorType: valid values are %v", v, allowedLogsLookupProcessorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsLookupProcessorType) IsValid() bool { - for _, existing := range allowedLogsLookupProcessorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsLookupProcessorType value. -func (v LogsLookupProcessorType) Ptr() *LogsLookupProcessorType { - return &v -} - -// NullableLogsLookupProcessorType handles when a null is used for LogsLookupProcessorType. -type NullableLogsLookupProcessorType struct { - value *LogsLookupProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsLookupProcessorType) Get() *LogsLookupProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsLookupProcessorType) Set(val *LogsLookupProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsLookupProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsLookupProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsLookupProcessorType initializes the struct as if Set has been called. -func NewNullableLogsLookupProcessorType(val *LogsLookupProcessorType) *NullableLogsLookupProcessorType { - return &NullableLogsLookupProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsLookupProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsLookupProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_message_remapper.go b/api/v1/datadog/model_logs_message_remapper.go deleted file mode 100644 index 7ed39f4a764..00000000000 --- a/api/v1/datadog/model_logs_message_remapper.go +++ /dev/null @@ -1,233 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMessageRemapper The message is a key attribute in Datadog. -// It is displayed in the message column of the Log Explorer and you can do full string search on it. -// Use this Processor to define one or more attributes as the official log message. -// -// **Note:** If multiple log message remapper processors can be applied to a given log, -// only the first one (according to the pipeline order) is taken into account. -type LogsMessageRemapper struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Type of logs message remapper. - Type LogsMessageRemapperType `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{} -} - -// NewLogsMessageRemapper instantiates a new LogsMessageRemapper 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 NewLogsMessageRemapper(sources []string, typeVar LogsMessageRemapperType) *LogsMessageRemapper { - this := LogsMessageRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Sources = sources - this.Type = typeVar - return &this -} - -// NewLogsMessageRemapperWithDefaults instantiates a new LogsMessageRemapper 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 NewLogsMessageRemapperWithDefaults() *LogsMessageRemapper { - this := LogsMessageRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsMessageRemapperType = LOGSMESSAGEREMAPPERTYPE_MESSAGE_REMAPPER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsMessageRemapper) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMessageRemapper) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsMessageRemapper) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsMessageRemapper) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsMessageRemapper) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMessageRemapper) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsMessageRemapper) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsMessageRemapper) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value. -func (o *LogsMessageRemapper) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsMessageRemapper) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsMessageRemapper) SetSources(v []string) { - o.Sources = v -} - -// GetType returns the Type field value. -func (o *LogsMessageRemapper) GetType() LogsMessageRemapperType { - if o == nil { - var ret LogsMessageRemapperType - 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 *LogsMessageRemapper) GetTypeOk() (*LogsMessageRemapperType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsMessageRemapper) SetType(v LogsMessageRemapperType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMessageRemapper) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["sources"] = o.Sources - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsMessageRemapperType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsMessageRemapperType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_message_remapper_type.go b/api/v1/datadog/model_logs_message_remapper_type.go deleted file mode 100644 index b4a9ae036d7..00000000000 --- a/api/v1/datadog/model_logs_message_remapper_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMessageRemapperType Type of logs message remapper. -type LogsMessageRemapperType string - -// List of LogsMessageRemapperType. -const ( - LOGSMESSAGEREMAPPERTYPE_MESSAGE_REMAPPER LogsMessageRemapperType = "message-remapper" -) - -var allowedLogsMessageRemapperTypeEnumValues = []LogsMessageRemapperType{ - LOGSMESSAGEREMAPPERTYPE_MESSAGE_REMAPPER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsMessageRemapperType) GetAllowedValues() []LogsMessageRemapperType { - return allowedLogsMessageRemapperTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsMessageRemapperType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsMessageRemapperType(value) - return nil -} - -// NewLogsMessageRemapperTypeFromValue returns a pointer to a valid LogsMessageRemapperType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsMessageRemapperTypeFromValue(v string) (*LogsMessageRemapperType, error) { - ev := LogsMessageRemapperType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsMessageRemapperType: valid values are %v", v, allowedLogsMessageRemapperTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsMessageRemapperType) IsValid() bool { - for _, existing := range allowedLogsMessageRemapperTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsMessageRemapperType value. -func (v LogsMessageRemapperType) Ptr() *LogsMessageRemapperType { - return &v -} - -// NullableLogsMessageRemapperType handles when a null is used for LogsMessageRemapperType. -type NullableLogsMessageRemapperType struct { - value *LogsMessageRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMessageRemapperType) Get() *LogsMessageRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMessageRemapperType) Set(val *LogsMessageRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMessageRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMessageRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMessageRemapperType initializes the struct as if Set has been called. -func NewNullableLogsMessageRemapperType(val *LogsMessageRemapperType) *NullableLogsMessageRemapperType { - return &NullableLogsMessageRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMessageRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMessageRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_pipeline.go b/api/v1/datadog/model_logs_pipeline.go deleted file mode 100644 index b5f3b90898e..00000000000 --- a/api/v1/datadog/model_logs_pipeline.go +++ /dev/null @@ -1,348 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsPipeline Pipelines and processors operate on incoming logs, -// parsing and transforming them into structured attributes for easier querying. -// -// **Note**: These endpoints are only available for admin users. -// Make sure to use an application key created by an admin. -type LogsPipeline struct { - // Filter for logs. - Filter *LogsFilter `json:"filter,omitempty"` - // ID of the pipeline. - Id *string `json:"id,omitempty"` - // Whether or not the pipeline is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Whether or not the pipeline can be edited. - IsReadOnly *bool `json:"is_read_only,omitempty"` - // Name of the pipeline. - Name string `json:"name"` - // Ordered list of processors in this pipeline. - Processors []LogsProcessor `json:"processors,omitempty"` - // Type of pipeline. - Type *string `json:"type,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{} -} - -// NewLogsPipeline instantiates a new LogsPipeline 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 NewLogsPipeline(name string) *LogsPipeline { - this := LogsPipeline{} - this.Name = name - return &this -} - -// NewLogsPipelineWithDefaults instantiates a new LogsPipeline 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 NewLogsPipelineWithDefaults() *LogsPipeline { - this := LogsPipeline{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsPipeline) GetFilter() LogsFilter { - if o == nil || o.Filter == nil { - var ret LogsFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipeline) GetFilterOk() (*LogsFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsPipeline) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsFilter and assigns it to the Filter field. -func (o *LogsPipeline) SetFilter(v LogsFilter) { - o.Filter = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *LogsPipeline) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipeline) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *LogsPipeline) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *LogsPipeline) SetId(v string) { - o.Id = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsPipeline) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipeline) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsPipeline) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsPipeline) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. -func (o *LogsPipeline) GetIsReadOnly() bool { - if o == nil || o.IsReadOnly == nil { - var ret bool - return ret - } - return *o.IsReadOnly -} - -// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipeline) GetIsReadOnlyOk() (*bool, bool) { - if o == nil || o.IsReadOnly == nil { - return nil, false - } - return o.IsReadOnly, true -} - -// HasIsReadOnly returns a boolean if a field has been set. -func (o *LogsPipeline) HasIsReadOnly() bool { - if o != nil && o.IsReadOnly != nil { - return true - } - - return false -} - -// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. -func (o *LogsPipeline) SetIsReadOnly(v bool) { - o.IsReadOnly = &v -} - -// GetName returns the Name field value. -func (o *LogsPipeline) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *LogsPipeline) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *LogsPipeline) SetName(v string) { - o.Name = v -} - -// GetProcessors returns the Processors field value if set, zero value otherwise. -func (o *LogsPipeline) GetProcessors() []LogsProcessor { - if o == nil || o.Processors == nil { - var ret []LogsProcessor - return ret - } - return o.Processors -} - -// GetProcessorsOk returns a tuple with the Processors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipeline) GetProcessorsOk() (*[]LogsProcessor, bool) { - if o == nil || o.Processors == nil { - return nil, false - } - return &o.Processors, true -} - -// HasProcessors returns a boolean if a field has been set. -func (o *LogsPipeline) HasProcessors() bool { - if o != nil && o.Processors != nil { - return true - } - - return false -} - -// SetProcessors gets a reference to the given []LogsProcessor and assigns it to the Processors field. -func (o *LogsPipeline) SetProcessors(v []LogsProcessor) { - o.Processors = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *LogsPipeline) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipeline) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *LogsPipeline) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *LogsPipeline) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsPipeline) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.IsReadOnly != nil { - toSerialize["is_read_only"] = o.IsReadOnly - } - toSerialize["name"] = o.Name - if o.Processors != nil { - toSerialize["processors"] = o.Processors - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Filter *LogsFilter `json:"filter,omitempty"` - Id *string `json:"id,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - IsReadOnly *bool `json:"is_read_only,omitempty"` - Name string `json:"name"` - Processors []LogsProcessor `json:"processors,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.Id = all.Id - o.IsEnabled = all.IsEnabled - o.IsReadOnly = all.IsReadOnly - o.Name = all.Name - o.Processors = all.Processors - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_pipeline_processor.go b/api/v1/datadog/model_logs_pipeline_processor.go deleted file mode 100644 index 30f0c59fa51..00000000000 --- a/api/v1/datadog/model_logs_pipeline_processor.go +++ /dev/null @@ -1,284 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsPipelineProcessor Nested Pipelines are pipelines within a pipeline. Use Nested Pipelines to split the processing into two steps. -// For example, first use a high-level filtering such as team and then a second level of filtering based on the -// integration, service, or any other tag or attribute. -// -// A pipeline can contain Nested Pipelines and Processors whereas a Nested Pipeline can only contain Processors. -type LogsPipelineProcessor struct { - // Filter for logs. - Filter *LogsFilter `json:"filter,omitempty"` - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Ordered list of processors in this pipeline. - Processors []LogsProcessor `json:"processors,omitempty"` - // Type of logs pipeline processor. - Type LogsPipelineProcessorType `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{} -} - -// NewLogsPipelineProcessor instantiates a new LogsPipelineProcessor 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 NewLogsPipelineProcessor(typeVar LogsPipelineProcessorType) *LogsPipelineProcessor { - this := LogsPipelineProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Type = typeVar - return &this -} - -// NewLogsPipelineProcessorWithDefaults instantiates a new LogsPipelineProcessor 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 NewLogsPipelineProcessorWithDefaults() *LogsPipelineProcessor { - this := LogsPipelineProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsPipelineProcessorType = LOGSPIPELINEPROCESSORTYPE_PIPELINE - this.Type = typeVar - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsPipelineProcessor) GetFilter() LogsFilter { - if o == nil || o.Filter == nil { - var ret LogsFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipelineProcessor) GetFilterOk() (*LogsFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsPipelineProcessor) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsFilter and assigns it to the Filter field. -func (o *LogsPipelineProcessor) SetFilter(v LogsFilter) { - o.Filter = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsPipelineProcessor) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipelineProcessor) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsPipelineProcessor) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsPipelineProcessor) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsPipelineProcessor) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipelineProcessor) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsPipelineProcessor) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsPipelineProcessor) SetName(v string) { - o.Name = &v -} - -// GetProcessors returns the Processors field value if set, zero value otherwise. -func (o *LogsPipelineProcessor) GetProcessors() []LogsProcessor { - if o == nil || o.Processors == nil { - var ret []LogsProcessor - return ret - } - return o.Processors -} - -// GetProcessorsOk returns a tuple with the Processors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsPipelineProcessor) GetProcessorsOk() (*[]LogsProcessor, bool) { - if o == nil || o.Processors == nil { - return nil, false - } - return &o.Processors, true -} - -// HasProcessors returns a boolean if a field has been set. -func (o *LogsPipelineProcessor) HasProcessors() bool { - if o != nil && o.Processors != nil { - return true - } - - return false -} - -// SetProcessors gets a reference to the given []LogsProcessor and assigns it to the Processors field. -func (o *LogsPipelineProcessor) SetProcessors(v []LogsProcessor) { - o.Processors = v -} - -// GetType returns the Type field value. -func (o *LogsPipelineProcessor) GetType() LogsPipelineProcessorType { - if o == nil { - var ret LogsPipelineProcessorType - 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 *LogsPipelineProcessor) GetTypeOk() (*LogsPipelineProcessorType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsPipelineProcessor) SetType(v LogsPipelineProcessorType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsPipelineProcessor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Processors != nil { - toSerialize["processors"] = o.Processors - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *LogsPipelineProcessorType `json:"type"` - }{} - all := struct { - Filter *LogsFilter `json:"filter,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Processors []LogsProcessor `json:"processors,omitempty"` - Type LogsPipelineProcessorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Processors = all.Processors - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_pipeline_processor_type.go b/api/v1/datadog/model_logs_pipeline_processor_type.go deleted file mode 100644 index 326592e52a7..00000000000 --- a/api/v1/datadog/model_logs_pipeline_processor_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsPipelineProcessorType Type of logs pipeline processor. -type LogsPipelineProcessorType string - -// List of LogsPipelineProcessorType. -const ( - LOGSPIPELINEPROCESSORTYPE_PIPELINE LogsPipelineProcessorType = "pipeline" -) - -var allowedLogsPipelineProcessorTypeEnumValues = []LogsPipelineProcessorType{ - LOGSPIPELINEPROCESSORTYPE_PIPELINE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsPipelineProcessorType) GetAllowedValues() []LogsPipelineProcessorType { - return allowedLogsPipelineProcessorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsPipelineProcessorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsPipelineProcessorType(value) - return nil -} - -// NewLogsPipelineProcessorTypeFromValue returns a pointer to a valid LogsPipelineProcessorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsPipelineProcessorTypeFromValue(v string) (*LogsPipelineProcessorType, error) { - ev := LogsPipelineProcessorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsPipelineProcessorType: valid values are %v", v, allowedLogsPipelineProcessorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsPipelineProcessorType) IsValid() bool { - for _, existing := range allowedLogsPipelineProcessorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsPipelineProcessorType value. -func (v LogsPipelineProcessorType) Ptr() *LogsPipelineProcessorType { - return &v -} - -// NullableLogsPipelineProcessorType handles when a null is used for LogsPipelineProcessorType. -type NullableLogsPipelineProcessorType struct { - value *LogsPipelineProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsPipelineProcessorType) Get() *LogsPipelineProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsPipelineProcessorType) Set(val *LogsPipelineProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsPipelineProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsPipelineProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsPipelineProcessorType initializes the struct as if Set has been called. -func NewNullableLogsPipelineProcessorType(val *LogsPipelineProcessorType) *NullableLogsPipelineProcessorType { - return &NullableLogsPipelineProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsPipelineProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsPipelineProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_pipelines_order.go b/api/v1/datadog/model_logs_pipelines_order.go deleted file mode 100644 index 71c41c8ed04..00000000000 --- a/api/v1/datadog/model_logs_pipelines_order.go +++ /dev/null @@ -1,104 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsPipelinesOrder Object containing the ordered list of pipeline IDs. -type LogsPipelinesOrder struct { - // Ordered Array of `` strings, the order of pipeline IDs in the array - // define the overall Pipelines order for Datadog. - PipelineIds []string `json:"pipeline_ids"` - // 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{} -} - -// NewLogsPipelinesOrder instantiates a new LogsPipelinesOrder 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 NewLogsPipelinesOrder(pipelineIds []string) *LogsPipelinesOrder { - this := LogsPipelinesOrder{} - this.PipelineIds = pipelineIds - return &this -} - -// NewLogsPipelinesOrderWithDefaults instantiates a new LogsPipelinesOrder 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 NewLogsPipelinesOrderWithDefaults() *LogsPipelinesOrder { - this := LogsPipelinesOrder{} - return &this -} - -// GetPipelineIds returns the PipelineIds field value. -func (o *LogsPipelinesOrder) GetPipelineIds() []string { - if o == nil { - var ret []string - return ret - } - return o.PipelineIds -} - -// GetPipelineIdsOk returns a tuple with the PipelineIds field value -// and a boolean to check if the value has been set. -func (o *LogsPipelinesOrder) GetPipelineIdsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.PipelineIds, true -} - -// SetPipelineIds sets field value. -func (o *LogsPipelinesOrder) SetPipelineIds(v []string) { - o.PipelineIds = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsPipelinesOrder) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["pipeline_ids"] = o.PipelineIds - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsPipelinesOrder) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - PipelineIds *[]string `json:"pipeline_ids"` - }{} - all := struct { - PipelineIds []string `json:"pipeline_ids"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.PipelineIds == nil { - return fmt.Errorf("Required field pipeline_ids missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PipelineIds = all.PipelineIds - return nil -} diff --git a/api/v1/datadog/model_logs_processor.go b/api/v1/datadog/model_logs_processor.go deleted file mode 100644 index ee72c18c64d..00000000000 --- a/api/v1/datadog/model_logs_processor.go +++ /dev/null @@ -1,571 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsProcessor - Definition of a logs processor. -type LogsProcessor struct { - LogsGrokParser *LogsGrokParser - LogsDateRemapper *LogsDateRemapper - LogsStatusRemapper *LogsStatusRemapper - LogsServiceRemapper *LogsServiceRemapper - LogsMessageRemapper *LogsMessageRemapper - LogsAttributeRemapper *LogsAttributeRemapper - LogsURLParser *LogsURLParser - LogsUserAgentParser *LogsUserAgentParser - LogsCategoryProcessor *LogsCategoryProcessor - LogsArithmeticProcessor *LogsArithmeticProcessor - LogsStringBuilderProcessor *LogsStringBuilderProcessor - LogsPipelineProcessor *LogsPipelineProcessor - LogsGeoIPParser *LogsGeoIPParser - LogsLookupProcessor *LogsLookupProcessor - LogsTraceRemapper *LogsTraceRemapper - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// LogsGrokParserAsLogsProcessor is a convenience function that returns LogsGrokParser wrapped in LogsProcessor. -func LogsGrokParserAsLogsProcessor(v *LogsGrokParser) LogsProcessor { - return LogsProcessor{LogsGrokParser: v} -} - -// LogsDateRemapperAsLogsProcessor is a convenience function that returns LogsDateRemapper wrapped in LogsProcessor. -func LogsDateRemapperAsLogsProcessor(v *LogsDateRemapper) LogsProcessor { - return LogsProcessor{LogsDateRemapper: v} -} - -// LogsStatusRemapperAsLogsProcessor is a convenience function that returns LogsStatusRemapper wrapped in LogsProcessor. -func LogsStatusRemapperAsLogsProcessor(v *LogsStatusRemapper) LogsProcessor { - return LogsProcessor{LogsStatusRemapper: v} -} - -// LogsServiceRemapperAsLogsProcessor is a convenience function that returns LogsServiceRemapper wrapped in LogsProcessor. -func LogsServiceRemapperAsLogsProcessor(v *LogsServiceRemapper) LogsProcessor { - return LogsProcessor{LogsServiceRemapper: v} -} - -// LogsMessageRemapperAsLogsProcessor is a convenience function that returns LogsMessageRemapper wrapped in LogsProcessor. -func LogsMessageRemapperAsLogsProcessor(v *LogsMessageRemapper) LogsProcessor { - return LogsProcessor{LogsMessageRemapper: v} -} - -// LogsAttributeRemapperAsLogsProcessor is a convenience function that returns LogsAttributeRemapper wrapped in LogsProcessor. -func LogsAttributeRemapperAsLogsProcessor(v *LogsAttributeRemapper) LogsProcessor { - return LogsProcessor{LogsAttributeRemapper: v} -} - -// LogsURLParserAsLogsProcessor is a convenience function that returns LogsURLParser wrapped in LogsProcessor. -func LogsURLParserAsLogsProcessor(v *LogsURLParser) LogsProcessor { - return LogsProcessor{LogsURLParser: v} -} - -// LogsUserAgentParserAsLogsProcessor is a convenience function that returns LogsUserAgentParser wrapped in LogsProcessor. -func LogsUserAgentParserAsLogsProcessor(v *LogsUserAgentParser) LogsProcessor { - return LogsProcessor{LogsUserAgentParser: v} -} - -// LogsCategoryProcessorAsLogsProcessor is a convenience function that returns LogsCategoryProcessor wrapped in LogsProcessor. -func LogsCategoryProcessorAsLogsProcessor(v *LogsCategoryProcessor) LogsProcessor { - return LogsProcessor{LogsCategoryProcessor: v} -} - -// LogsArithmeticProcessorAsLogsProcessor is a convenience function that returns LogsArithmeticProcessor wrapped in LogsProcessor. -func LogsArithmeticProcessorAsLogsProcessor(v *LogsArithmeticProcessor) LogsProcessor { - return LogsProcessor{LogsArithmeticProcessor: v} -} - -// LogsStringBuilderProcessorAsLogsProcessor is a convenience function that returns LogsStringBuilderProcessor wrapped in LogsProcessor. -func LogsStringBuilderProcessorAsLogsProcessor(v *LogsStringBuilderProcessor) LogsProcessor { - return LogsProcessor{LogsStringBuilderProcessor: v} -} - -// LogsPipelineProcessorAsLogsProcessor is a convenience function that returns LogsPipelineProcessor wrapped in LogsProcessor. -func LogsPipelineProcessorAsLogsProcessor(v *LogsPipelineProcessor) LogsProcessor { - return LogsProcessor{LogsPipelineProcessor: v} -} - -// LogsGeoIPParserAsLogsProcessor is a convenience function that returns LogsGeoIPParser wrapped in LogsProcessor. -func LogsGeoIPParserAsLogsProcessor(v *LogsGeoIPParser) LogsProcessor { - return LogsProcessor{LogsGeoIPParser: v} -} - -// LogsLookupProcessorAsLogsProcessor is a convenience function that returns LogsLookupProcessor wrapped in LogsProcessor. -func LogsLookupProcessorAsLogsProcessor(v *LogsLookupProcessor) LogsProcessor { - return LogsProcessor{LogsLookupProcessor: v} -} - -// LogsTraceRemapperAsLogsProcessor is a convenience function that returns LogsTraceRemapper wrapped in LogsProcessor. -func LogsTraceRemapperAsLogsProcessor(v *LogsTraceRemapper) LogsProcessor { - return LogsProcessor{LogsTraceRemapper: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *LogsProcessor) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into LogsGrokParser - err = json.Unmarshal(data, &obj.LogsGrokParser) - if err == nil { - if obj.LogsGrokParser != nil && obj.LogsGrokParser.UnparsedObject == nil { - jsonLogsGrokParser, _ := json.Marshal(obj.LogsGrokParser) - if string(jsonLogsGrokParser) == "{}" { // empty struct - obj.LogsGrokParser = nil - } else { - match++ - } - } else { - obj.LogsGrokParser = nil - } - } else { - obj.LogsGrokParser = nil - } - - // try to unmarshal data into LogsDateRemapper - err = json.Unmarshal(data, &obj.LogsDateRemapper) - if err == nil { - if obj.LogsDateRemapper != nil && obj.LogsDateRemapper.UnparsedObject == nil { - jsonLogsDateRemapper, _ := json.Marshal(obj.LogsDateRemapper) - if string(jsonLogsDateRemapper) == "{}" { // empty struct - obj.LogsDateRemapper = nil - } else { - match++ - } - } else { - obj.LogsDateRemapper = nil - } - } else { - obj.LogsDateRemapper = nil - } - - // try to unmarshal data into LogsStatusRemapper - err = json.Unmarshal(data, &obj.LogsStatusRemapper) - if err == nil { - if obj.LogsStatusRemapper != nil && obj.LogsStatusRemapper.UnparsedObject == nil { - jsonLogsStatusRemapper, _ := json.Marshal(obj.LogsStatusRemapper) - if string(jsonLogsStatusRemapper) == "{}" { // empty struct - obj.LogsStatusRemapper = nil - } else { - match++ - } - } else { - obj.LogsStatusRemapper = nil - } - } else { - obj.LogsStatusRemapper = nil - } - - // try to unmarshal data into LogsServiceRemapper - err = json.Unmarshal(data, &obj.LogsServiceRemapper) - if err == nil { - if obj.LogsServiceRemapper != nil && obj.LogsServiceRemapper.UnparsedObject == nil { - jsonLogsServiceRemapper, _ := json.Marshal(obj.LogsServiceRemapper) - if string(jsonLogsServiceRemapper) == "{}" { // empty struct - obj.LogsServiceRemapper = nil - } else { - match++ - } - } else { - obj.LogsServiceRemapper = nil - } - } else { - obj.LogsServiceRemapper = nil - } - - // try to unmarshal data into LogsMessageRemapper - err = json.Unmarshal(data, &obj.LogsMessageRemapper) - if err == nil { - if obj.LogsMessageRemapper != nil && obj.LogsMessageRemapper.UnparsedObject == nil { - jsonLogsMessageRemapper, _ := json.Marshal(obj.LogsMessageRemapper) - if string(jsonLogsMessageRemapper) == "{}" { // empty struct - obj.LogsMessageRemapper = nil - } else { - match++ - } - } else { - obj.LogsMessageRemapper = nil - } - } else { - obj.LogsMessageRemapper = nil - } - - // try to unmarshal data into LogsAttributeRemapper - err = json.Unmarshal(data, &obj.LogsAttributeRemapper) - if err == nil { - if obj.LogsAttributeRemapper != nil && obj.LogsAttributeRemapper.UnparsedObject == nil { - jsonLogsAttributeRemapper, _ := json.Marshal(obj.LogsAttributeRemapper) - if string(jsonLogsAttributeRemapper) == "{}" { // empty struct - obj.LogsAttributeRemapper = nil - } else { - match++ - } - } else { - obj.LogsAttributeRemapper = nil - } - } else { - obj.LogsAttributeRemapper = nil - } - - // try to unmarshal data into LogsURLParser - err = json.Unmarshal(data, &obj.LogsURLParser) - if err == nil { - if obj.LogsURLParser != nil && obj.LogsURLParser.UnparsedObject == nil { - jsonLogsURLParser, _ := json.Marshal(obj.LogsURLParser) - if string(jsonLogsURLParser) == "{}" { // empty struct - obj.LogsURLParser = nil - } else { - match++ - } - } else { - obj.LogsURLParser = nil - } - } else { - obj.LogsURLParser = nil - } - - // try to unmarshal data into LogsUserAgentParser - err = json.Unmarshal(data, &obj.LogsUserAgentParser) - if err == nil { - if obj.LogsUserAgentParser != nil && obj.LogsUserAgentParser.UnparsedObject == nil { - jsonLogsUserAgentParser, _ := json.Marshal(obj.LogsUserAgentParser) - if string(jsonLogsUserAgentParser) == "{}" { // empty struct - obj.LogsUserAgentParser = nil - } else { - match++ - } - } else { - obj.LogsUserAgentParser = nil - } - } else { - obj.LogsUserAgentParser = nil - } - - // try to unmarshal data into LogsCategoryProcessor - err = json.Unmarshal(data, &obj.LogsCategoryProcessor) - if err == nil { - if obj.LogsCategoryProcessor != nil && obj.LogsCategoryProcessor.UnparsedObject == nil { - jsonLogsCategoryProcessor, _ := json.Marshal(obj.LogsCategoryProcessor) - if string(jsonLogsCategoryProcessor) == "{}" { // empty struct - obj.LogsCategoryProcessor = nil - } else { - match++ - } - } else { - obj.LogsCategoryProcessor = nil - } - } else { - obj.LogsCategoryProcessor = nil - } - - // try to unmarshal data into LogsArithmeticProcessor - err = json.Unmarshal(data, &obj.LogsArithmeticProcessor) - if err == nil { - if obj.LogsArithmeticProcessor != nil && obj.LogsArithmeticProcessor.UnparsedObject == nil { - jsonLogsArithmeticProcessor, _ := json.Marshal(obj.LogsArithmeticProcessor) - if string(jsonLogsArithmeticProcessor) == "{}" { // empty struct - obj.LogsArithmeticProcessor = nil - } else { - match++ - } - } else { - obj.LogsArithmeticProcessor = nil - } - } else { - obj.LogsArithmeticProcessor = nil - } - - // try to unmarshal data into LogsStringBuilderProcessor - err = json.Unmarshal(data, &obj.LogsStringBuilderProcessor) - if err == nil { - if obj.LogsStringBuilderProcessor != nil && obj.LogsStringBuilderProcessor.UnparsedObject == nil { - jsonLogsStringBuilderProcessor, _ := json.Marshal(obj.LogsStringBuilderProcessor) - if string(jsonLogsStringBuilderProcessor) == "{}" { // empty struct - obj.LogsStringBuilderProcessor = nil - } else { - match++ - } - } else { - obj.LogsStringBuilderProcessor = nil - } - } else { - obj.LogsStringBuilderProcessor = nil - } - - // try to unmarshal data into LogsPipelineProcessor - err = json.Unmarshal(data, &obj.LogsPipelineProcessor) - if err == nil { - if obj.LogsPipelineProcessor != nil && obj.LogsPipelineProcessor.UnparsedObject == nil { - jsonLogsPipelineProcessor, _ := json.Marshal(obj.LogsPipelineProcessor) - if string(jsonLogsPipelineProcessor) == "{}" { // empty struct - obj.LogsPipelineProcessor = nil - } else { - match++ - } - } else { - obj.LogsPipelineProcessor = nil - } - } else { - obj.LogsPipelineProcessor = nil - } - - // try to unmarshal data into LogsGeoIPParser - err = json.Unmarshal(data, &obj.LogsGeoIPParser) - if err == nil { - if obj.LogsGeoIPParser != nil && obj.LogsGeoIPParser.UnparsedObject == nil { - jsonLogsGeoIPParser, _ := json.Marshal(obj.LogsGeoIPParser) - if string(jsonLogsGeoIPParser) == "{}" { // empty struct - obj.LogsGeoIPParser = nil - } else { - match++ - } - } else { - obj.LogsGeoIPParser = nil - } - } else { - obj.LogsGeoIPParser = nil - } - - // try to unmarshal data into LogsLookupProcessor - err = json.Unmarshal(data, &obj.LogsLookupProcessor) - if err == nil { - if obj.LogsLookupProcessor != nil && obj.LogsLookupProcessor.UnparsedObject == nil { - jsonLogsLookupProcessor, _ := json.Marshal(obj.LogsLookupProcessor) - if string(jsonLogsLookupProcessor) == "{}" { // empty struct - obj.LogsLookupProcessor = nil - } else { - match++ - } - } else { - obj.LogsLookupProcessor = nil - } - } else { - obj.LogsLookupProcessor = nil - } - - // try to unmarshal data into LogsTraceRemapper - err = json.Unmarshal(data, &obj.LogsTraceRemapper) - if err == nil { - if obj.LogsTraceRemapper != nil && obj.LogsTraceRemapper.UnparsedObject == nil { - jsonLogsTraceRemapper, _ := json.Marshal(obj.LogsTraceRemapper) - if string(jsonLogsTraceRemapper) == "{}" { // empty struct - obj.LogsTraceRemapper = nil - } else { - match++ - } - } else { - obj.LogsTraceRemapper = nil - } - } else { - obj.LogsTraceRemapper = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.LogsGrokParser = nil - obj.LogsDateRemapper = nil - obj.LogsStatusRemapper = nil - obj.LogsServiceRemapper = nil - obj.LogsMessageRemapper = nil - obj.LogsAttributeRemapper = nil - obj.LogsURLParser = nil - obj.LogsUserAgentParser = nil - obj.LogsCategoryProcessor = nil - obj.LogsArithmeticProcessor = nil - obj.LogsStringBuilderProcessor = nil - obj.LogsPipelineProcessor = nil - obj.LogsGeoIPParser = nil - obj.LogsLookupProcessor = nil - obj.LogsTraceRemapper = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj LogsProcessor) MarshalJSON() ([]byte, error) { - if obj.LogsGrokParser != nil { - return json.Marshal(&obj.LogsGrokParser) - } - - if obj.LogsDateRemapper != nil { - return json.Marshal(&obj.LogsDateRemapper) - } - - if obj.LogsStatusRemapper != nil { - return json.Marshal(&obj.LogsStatusRemapper) - } - - if obj.LogsServiceRemapper != nil { - return json.Marshal(&obj.LogsServiceRemapper) - } - - if obj.LogsMessageRemapper != nil { - return json.Marshal(&obj.LogsMessageRemapper) - } - - if obj.LogsAttributeRemapper != nil { - return json.Marshal(&obj.LogsAttributeRemapper) - } - - if obj.LogsURLParser != nil { - return json.Marshal(&obj.LogsURLParser) - } - - if obj.LogsUserAgentParser != nil { - return json.Marshal(&obj.LogsUserAgentParser) - } - - if obj.LogsCategoryProcessor != nil { - return json.Marshal(&obj.LogsCategoryProcessor) - } - - if obj.LogsArithmeticProcessor != nil { - return json.Marshal(&obj.LogsArithmeticProcessor) - } - - if obj.LogsStringBuilderProcessor != nil { - return json.Marshal(&obj.LogsStringBuilderProcessor) - } - - if obj.LogsPipelineProcessor != nil { - return json.Marshal(&obj.LogsPipelineProcessor) - } - - if obj.LogsGeoIPParser != nil { - return json.Marshal(&obj.LogsGeoIPParser) - } - - if obj.LogsLookupProcessor != nil { - return json.Marshal(&obj.LogsLookupProcessor) - } - - if obj.LogsTraceRemapper != nil { - return json.Marshal(&obj.LogsTraceRemapper) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *LogsProcessor) GetActualInstance() interface{} { - if obj.LogsGrokParser != nil { - return obj.LogsGrokParser - } - - if obj.LogsDateRemapper != nil { - return obj.LogsDateRemapper - } - - if obj.LogsStatusRemapper != nil { - return obj.LogsStatusRemapper - } - - if obj.LogsServiceRemapper != nil { - return obj.LogsServiceRemapper - } - - if obj.LogsMessageRemapper != nil { - return obj.LogsMessageRemapper - } - - if obj.LogsAttributeRemapper != nil { - return obj.LogsAttributeRemapper - } - - if obj.LogsURLParser != nil { - return obj.LogsURLParser - } - - if obj.LogsUserAgentParser != nil { - return obj.LogsUserAgentParser - } - - if obj.LogsCategoryProcessor != nil { - return obj.LogsCategoryProcessor - } - - if obj.LogsArithmeticProcessor != nil { - return obj.LogsArithmeticProcessor - } - - if obj.LogsStringBuilderProcessor != nil { - return obj.LogsStringBuilderProcessor - } - - if obj.LogsPipelineProcessor != nil { - return obj.LogsPipelineProcessor - } - - if obj.LogsGeoIPParser != nil { - return obj.LogsGeoIPParser - } - - if obj.LogsLookupProcessor != nil { - return obj.LogsLookupProcessor - } - - if obj.LogsTraceRemapper != nil { - return obj.LogsTraceRemapper - } - - // all schemas are nil - return nil -} - -// NullableLogsProcessor handles when a null is used for LogsProcessor. -type NullableLogsProcessor struct { - value *LogsProcessor - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsProcessor) Get() *LogsProcessor { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsProcessor) Set(val *LogsProcessor) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsProcessor) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsProcessor) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsProcessor initializes the struct as if Set has been called. -func NewNullableLogsProcessor(val *LogsProcessor) *NullableLogsProcessor { - return &NullableLogsProcessor{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsProcessor) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsProcessor) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_query_compute.go b/api/v1/datadog/model_logs_query_compute.go deleted file mode 100644 index 91ee415dc5a..00000000000 --- a/api/v1/datadog/model_logs_query_compute.go +++ /dev/null @@ -1,181 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsQueryCompute Define computation for a log query. -type LogsQueryCompute struct { - // The aggregation method. - Aggregation string `json:"aggregation"` - // Facet name. - Facet *string `json:"facet,omitempty"` - // Define a time interval in seconds. - Interval *int64 `json:"interval,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{} -} - -// NewLogsQueryCompute instantiates a new LogsQueryCompute 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 NewLogsQueryCompute(aggregation string) *LogsQueryCompute { - this := LogsQueryCompute{} - this.Aggregation = aggregation - return &this -} - -// NewLogsQueryComputeWithDefaults instantiates a new LogsQueryCompute 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 NewLogsQueryComputeWithDefaults() *LogsQueryCompute { - this := LogsQueryCompute{} - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *LogsQueryCompute) GetAggregation() string { - if o == nil { - var ret string - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *LogsQueryCompute) GetAggregationOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *LogsQueryCompute) SetAggregation(v string) { - o.Aggregation = v -} - -// GetFacet returns the Facet field value if set, zero value otherwise. -func (o *LogsQueryCompute) GetFacet() string { - if o == nil || o.Facet == nil { - var ret string - return ret - } - return *o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryCompute) GetFacetOk() (*string, bool) { - if o == nil || o.Facet == nil { - return nil, false - } - return o.Facet, true -} - -// HasFacet returns a boolean if a field has been set. -func (o *LogsQueryCompute) HasFacet() bool { - if o != nil && o.Facet != nil { - return true - } - - return false -} - -// SetFacet gets a reference to the given string and assigns it to the Facet field. -func (o *LogsQueryCompute) SetFacet(v string) { - o.Facet = &v -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *LogsQueryCompute) GetInterval() int64 { - if o == nil || o.Interval == nil { - var ret int64 - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryCompute) GetIntervalOk() (*int64, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *LogsQueryCompute) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given int64 and assigns it to the Interval field. -func (o *LogsQueryCompute) SetInterval(v int64) { - o.Interval = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsQueryCompute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Facet != nil { - toSerialize["facet"] = o.Facet - } - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsQueryCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *string `json:"aggregation"` - }{} - all := struct { - Aggregation string `json:"aggregation"` - Facet *string `json:"facet,omitempty"` - Interval *int64 `json:"interval,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Facet = all.Facet - o.Interval = all.Interval - return nil -} diff --git a/api/v1/datadog/model_logs_retention_agg_sum_usage.go b/api/v1/datadog/model_logs_retention_agg_sum_usage.go deleted file mode 100644 index 0afe0ec4b5e..00000000000 --- a/api/v1/datadog/model_logs_retention_agg_sum_usage.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsRetentionAggSumUsage Object containing indexed logs usage aggregated across organizations and months for a retention period. -type LogsRetentionAggSumUsage struct { - // Total indexed logs for this retention period. - LogsIndexedLogsUsageAggSum *int64 `json:"logs_indexed_logs_usage_agg_sum,omitempty"` - // Live indexed logs for this retention period. - LogsLiveIndexedLogsUsageAggSum *int64 `json:"logs_live_indexed_logs_usage_agg_sum,omitempty"` - // Rehydrated indexed logs for this retention period. - LogsRehydratedIndexedLogsUsageAggSum *int64 `json:"logs_rehydrated_indexed_logs_usage_agg_sum,omitempty"` - // The retention period in days or "custom" for all custom retention periods. - Retention *string `json:"retention,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{} -} - -// NewLogsRetentionAggSumUsage instantiates a new LogsRetentionAggSumUsage 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 NewLogsRetentionAggSumUsage() *LogsRetentionAggSumUsage { - this := LogsRetentionAggSumUsage{} - return &this -} - -// NewLogsRetentionAggSumUsageWithDefaults instantiates a new LogsRetentionAggSumUsage 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 NewLogsRetentionAggSumUsageWithDefaults() *LogsRetentionAggSumUsage { - this := LogsRetentionAggSumUsage{} - return &this -} - -// GetLogsIndexedLogsUsageAggSum returns the LogsIndexedLogsUsageAggSum field value if set, zero value otherwise. -func (o *LogsRetentionAggSumUsage) GetLogsIndexedLogsUsageAggSum() int64 { - if o == nil || o.LogsIndexedLogsUsageAggSum == nil { - var ret int64 - return ret - } - return *o.LogsIndexedLogsUsageAggSum -} - -// GetLogsIndexedLogsUsageAggSumOk returns a tuple with the LogsIndexedLogsUsageAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionAggSumUsage) GetLogsIndexedLogsUsageAggSumOk() (*int64, bool) { - if o == nil || o.LogsIndexedLogsUsageAggSum == nil { - return nil, false - } - return o.LogsIndexedLogsUsageAggSum, true -} - -// HasLogsIndexedLogsUsageAggSum returns a boolean if a field has been set. -func (o *LogsRetentionAggSumUsage) HasLogsIndexedLogsUsageAggSum() bool { - if o != nil && o.LogsIndexedLogsUsageAggSum != nil { - return true - } - - return false -} - -// SetLogsIndexedLogsUsageAggSum gets a reference to the given int64 and assigns it to the LogsIndexedLogsUsageAggSum field. -func (o *LogsRetentionAggSumUsage) SetLogsIndexedLogsUsageAggSum(v int64) { - o.LogsIndexedLogsUsageAggSum = &v -} - -// GetLogsLiveIndexedLogsUsageAggSum returns the LogsLiveIndexedLogsUsageAggSum field value if set, zero value otherwise. -func (o *LogsRetentionAggSumUsage) GetLogsLiveIndexedLogsUsageAggSum() int64 { - if o == nil || o.LogsLiveIndexedLogsUsageAggSum == nil { - var ret int64 - return ret - } - return *o.LogsLiveIndexedLogsUsageAggSum -} - -// GetLogsLiveIndexedLogsUsageAggSumOk returns a tuple with the LogsLiveIndexedLogsUsageAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionAggSumUsage) GetLogsLiveIndexedLogsUsageAggSumOk() (*int64, bool) { - if o == nil || o.LogsLiveIndexedLogsUsageAggSum == nil { - return nil, false - } - return o.LogsLiveIndexedLogsUsageAggSum, true -} - -// HasLogsLiveIndexedLogsUsageAggSum returns a boolean if a field has been set. -func (o *LogsRetentionAggSumUsage) HasLogsLiveIndexedLogsUsageAggSum() bool { - if o != nil && o.LogsLiveIndexedLogsUsageAggSum != nil { - return true - } - - return false -} - -// SetLogsLiveIndexedLogsUsageAggSum gets a reference to the given int64 and assigns it to the LogsLiveIndexedLogsUsageAggSum field. -func (o *LogsRetentionAggSumUsage) SetLogsLiveIndexedLogsUsageAggSum(v int64) { - o.LogsLiveIndexedLogsUsageAggSum = &v -} - -// GetLogsRehydratedIndexedLogsUsageAggSum returns the LogsRehydratedIndexedLogsUsageAggSum field value if set, zero value otherwise. -func (o *LogsRetentionAggSumUsage) GetLogsRehydratedIndexedLogsUsageAggSum() int64 { - if o == nil || o.LogsRehydratedIndexedLogsUsageAggSum == nil { - var ret int64 - return ret - } - return *o.LogsRehydratedIndexedLogsUsageAggSum -} - -// GetLogsRehydratedIndexedLogsUsageAggSumOk returns a tuple with the LogsRehydratedIndexedLogsUsageAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionAggSumUsage) GetLogsRehydratedIndexedLogsUsageAggSumOk() (*int64, bool) { - if o == nil || o.LogsRehydratedIndexedLogsUsageAggSum == nil { - return nil, false - } - return o.LogsRehydratedIndexedLogsUsageAggSum, true -} - -// HasLogsRehydratedIndexedLogsUsageAggSum returns a boolean if a field has been set. -func (o *LogsRetentionAggSumUsage) HasLogsRehydratedIndexedLogsUsageAggSum() bool { - if o != nil && o.LogsRehydratedIndexedLogsUsageAggSum != nil { - return true - } - - return false -} - -// SetLogsRehydratedIndexedLogsUsageAggSum gets a reference to the given int64 and assigns it to the LogsRehydratedIndexedLogsUsageAggSum field. -func (o *LogsRetentionAggSumUsage) SetLogsRehydratedIndexedLogsUsageAggSum(v int64) { - o.LogsRehydratedIndexedLogsUsageAggSum = &v -} - -// GetRetention returns the Retention field value if set, zero value otherwise. -func (o *LogsRetentionAggSumUsage) GetRetention() string { - if o == nil || o.Retention == nil { - var ret string - return ret - } - return *o.Retention -} - -// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionAggSumUsage) GetRetentionOk() (*string, bool) { - if o == nil || o.Retention == nil { - return nil, false - } - return o.Retention, true -} - -// HasRetention returns a boolean if a field has been set. -func (o *LogsRetentionAggSumUsage) HasRetention() bool { - if o != nil && o.Retention != nil { - return true - } - - return false -} - -// SetRetention gets a reference to the given string and assigns it to the Retention field. -func (o *LogsRetentionAggSumUsage) SetRetention(v string) { - o.Retention = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsRetentionAggSumUsage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LogsIndexedLogsUsageAggSum != nil { - toSerialize["logs_indexed_logs_usage_agg_sum"] = o.LogsIndexedLogsUsageAggSum - } - if o.LogsLiveIndexedLogsUsageAggSum != nil { - toSerialize["logs_live_indexed_logs_usage_agg_sum"] = o.LogsLiveIndexedLogsUsageAggSum - } - if o.LogsRehydratedIndexedLogsUsageAggSum != nil { - toSerialize["logs_rehydrated_indexed_logs_usage_agg_sum"] = o.LogsRehydratedIndexedLogsUsageAggSum - } - if o.Retention != nil { - toSerialize["retention"] = o.Retention - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsRetentionAggSumUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - LogsIndexedLogsUsageAggSum *int64 `json:"logs_indexed_logs_usage_agg_sum,omitempty"` - LogsLiveIndexedLogsUsageAggSum *int64 `json:"logs_live_indexed_logs_usage_agg_sum,omitempty"` - LogsRehydratedIndexedLogsUsageAggSum *int64 `json:"logs_rehydrated_indexed_logs_usage_agg_sum,omitempty"` - Retention *string `json:"retention,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LogsIndexedLogsUsageAggSum = all.LogsIndexedLogsUsageAggSum - o.LogsLiveIndexedLogsUsageAggSum = all.LogsLiveIndexedLogsUsageAggSum - o.LogsRehydratedIndexedLogsUsageAggSum = all.LogsRehydratedIndexedLogsUsageAggSum - o.Retention = all.Retention - return nil -} diff --git a/api/v1/datadog/model_logs_retention_sum_usage.go b/api/v1/datadog/model_logs_retention_sum_usage.go deleted file mode 100644 index ae6dedc6af2..00000000000 --- a/api/v1/datadog/model_logs_retention_sum_usage.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsRetentionSumUsage Object containing indexed logs usage grouped by retention period and summed. -type LogsRetentionSumUsage struct { - // Total indexed logs for this retention period. - LogsIndexedLogsUsageSum *int64 `json:"logs_indexed_logs_usage_sum,omitempty"` - // Live indexed logs for this retention period. - LogsLiveIndexedLogsUsageSum *int64 `json:"logs_live_indexed_logs_usage_sum,omitempty"` - // Rehydrated indexed logs for this retention period. - LogsRehydratedIndexedLogsUsageSum *int64 `json:"logs_rehydrated_indexed_logs_usage_sum,omitempty"` - // The retention period in days or "custom" for all custom retention periods. - Retention *string `json:"retention,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{} -} - -// NewLogsRetentionSumUsage instantiates a new LogsRetentionSumUsage 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 NewLogsRetentionSumUsage() *LogsRetentionSumUsage { - this := LogsRetentionSumUsage{} - return &this -} - -// NewLogsRetentionSumUsageWithDefaults instantiates a new LogsRetentionSumUsage 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 NewLogsRetentionSumUsageWithDefaults() *LogsRetentionSumUsage { - this := LogsRetentionSumUsage{} - return &this -} - -// GetLogsIndexedLogsUsageSum returns the LogsIndexedLogsUsageSum field value if set, zero value otherwise. -func (o *LogsRetentionSumUsage) GetLogsIndexedLogsUsageSum() int64 { - if o == nil || o.LogsIndexedLogsUsageSum == nil { - var ret int64 - return ret - } - return *o.LogsIndexedLogsUsageSum -} - -// GetLogsIndexedLogsUsageSumOk returns a tuple with the LogsIndexedLogsUsageSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionSumUsage) GetLogsIndexedLogsUsageSumOk() (*int64, bool) { - if o == nil || o.LogsIndexedLogsUsageSum == nil { - return nil, false - } - return o.LogsIndexedLogsUsageSum, true -} - -// HasLogsIndexedLogsUsageSum returns a boolean if a field has been set. -func (o *LogsRetentionSumUsage) HasLogsIndexedLogsUsageSum() bool { - if o != nil && o.LogsIndexedLogsUsageSum != nil { - return true - } - - return false -} - -// SetLogsIndexedLogsUsageSum gets a reference to the given int64 and assigns it to the LogsIndexedLogsUsageSum field. -func (o *LogsRetentionSumUsage) SetLogsIndexedLogsUsageSum(v int64) { - o.LogsIndexedLogsUsageSum = &v -} - -// GetLogsLiveIndexedLogsUsageSum returns the LogsLiveIndexedLogsUsageSum field value if set, zero value otherwise. -func (o *LogsRetentionSumUsage) GetLogsLiveIndexedLogsUsageSum() int64 { - if o == nil || o.LogsLiveIndexedLogsUsageSum == nil { - var ret int64 - return ret - } - return *o.LogsLiveIndexedLogsUsageSum -} - -// GetLogsLiveIndexedLogsUsageSumOk returns a tuple with the LogsLiveIndexedLogsUsageSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionSumUsage) GetLogsLiveIndexedLogsUsageSumOk() (*int64, bool) { - if o == nil || o.LogsLiveIndexedLogsUsageSum == nil { - return nil, false - } - return o.LogsLiveIndexedLogsUsageSum, true -} - -// HasLogsLiveIndexedLogsUsageSum returns a boolean if a field has been set. -func (o *LogsRetentionSumUsage) HasLogsLiveIndexedLogsUsageSum() bool { - if o != nil && o.LogsLiveIndexedLogsUsageSum != nil { - return true - } - - return false -} - -// SetLogsLiveIndexedLogsUsageSum gets a reference to the given int64 and assigns it to the LogsLiveIndexedLogsUsageSum field. -func (o *LogsRetentionSumUsage) SetLogsLiveIndexedLogsUsageSum(v int64) { - o.LogsLiveIndexedLogsUsageSum = &v -} - -// GetLogsRehydratedIndexedLogsUsageSum returns the LogsRehydratedIndexedLogsUsageSum field value if set, zero value otherwise. -func (o *LogsRetentionSumUsage) GetLogsRehydratedIndexedLogsUsageSum() int64 { - if o == nil || o.LogsRehydratedIndexedLogsUsageSum == nil { - var ret int64 - return ret - } - return *o.LogsRehydratedIndexedLogsUsageSum -} - -// GetLogsRehydratedIndexedLogsUsageSumOk returns a tuple with the LogsRehydratedIndexedLogsUsageSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionSumUsage) GetLogsRehydratedIndexedLogsUsageSumOk() (*int64, bool) { - if o == nil || o.LogsRehydratedIndexedLogsUsageSum == nil { - return nil, false - } - return o.LogsRehydratedIndexedLogsUsageSum, true -} - -// HasLogsRehydratedIndexedLogsUsageSum returns a boolean if a field has been set. -func (o *LogsRetentionSumUsage) HasLogsRehydratedIndexedLogsUsageSum() bool { - if o != nil && o.LogsRehydratedIndexedLogsUsageSum != nil { - return true - } - - return false -} - -// SetLogsRehydratedIndexedLogsUsageSum gets a reference to the given int64 and assigns it to the LogsRehydratedIndexedLogsUsageSum field. -func (o *LogsRetentionSumUsage) SetLogsRehydratedIndexedLogsUsageSum(v int64) { - o.LogsRehydratedIndexedLogsUsageSum = &v -} - -// GetRetention returns the Retention field value if set, zero value otherwise. -func (o *LogsRetentionSumUsage) GetRetention() string { - if o == nil || o.Retention == nil { - var ret string - return ret - } - return *o.Retention -} - -// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsRetentionSumUsage) GetRetentionOk() (*string, bool) { - if o == nil || o.Retention == nil { - return nil, false - } - return o.Retention, true -} - -// HasRetention returns a boolean if a field has been set. -func (o *LogsRetentionSumUsage) HasRetention() bool { - if o != nil && o.Retention != nil { - return true - } - - return false -} - -// SetRetention gets a reference to the given string and assigns it to the Retention field. -func (o *LogsRetentionSumUsage) SetRetention(v string) { - o.Retention = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsRetentionSumUsage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LogsIndexedLogsUsageSum != nil { - toSerialize["logs_indexed_logs_usage_sum"] = o.LogsIndexedLogsUsageSum - } - if o.LogsLiveIndexedLogsUsageSum != nil { - toSerialize["logs_live_indexed_logs_usage_sum"] = o.LogsLiveIndexedLogsUsageSum - } - if o.LogsRehydratedIndexedLogsUsageSum != nil { - toSerialize["logs_rehydrated_indexed_logs_usage_sum"] = o.LogsRehydratedIndexedLogsUsageSum - } - if o.Retention != nil { - toSerialize["retention"] = o.Retention - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsRetentionSumUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - LogsIndexedLogsUsageSum *int64 `json:"logs_indexed_logs_usage_sum,omitempty"` - LogsLiveIndexedLogsUsageSum *int64 `json:"logs_live_indexed_logs_usage_sum,omitempty"` - LogsRehydratedIndexedLogsUsageSum *int64 `json:"logs_rehydrated_indexed_logs_usage_sum,omitempty"` - Retention *string `json:"retention,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LogsIndexedLogsUsageSum = all.LogsIndexedLogsUsageSum - o.LogsLiveIndexedLogsUsageSum = all.LogsLiveIndexedLogsUsageSum - o.LogsRehydratedIndexedLogsUsageSum = all.LogsRehydratedIndexedLogsUsageSum - o.Retention = all.Retention - return nil -} diff --git a/api/v1/datadog/model_logs_service_remapper.go b/api/v1/datadog/model_logs_service_remapper.go deleted file mode 100644 index 34ca12d4cd6..00000000000 --- a/api/v1/datadog/model_logs_service_remapper.go +++ /dev/null @@ -1,231 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsServiceRemapper Use this processor if you want to assign one or more attributes as the official service. -// -// **Note:** If multiple service remapper processors can be applied to a given log, -// only the first one (according to the pipeline order) is taken into account. -type LogsServiceRemapper struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Type of logs service remapper. - Type LogsServiceRemapperType `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{} -} - -// NewLogsServiceRemapper instantiates a new LogsServiceRemapper 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 NewLogsServiceRemapper(sources []string, typeVar LogsServiceRemapperType) *LogsServiceRemapper { - this := LogsServiceRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Sources = sources - this.Type = typeVar - return &this -} - -// NewLogsServiceRemapperWithDefaults instantiates a new LogsServiceRemapper 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 NewLogsServiceRemapperWithDefaults() *LogsServiceRemapper { - this := LogsServiceRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsServiceRemapperType = LOGSSERVICEREMAPPERTYPE_SERVICE_REMAPPER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsServiceRemapper) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsServiceRemapper) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsServiceRemapper) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsServiceRemapper) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsServiceRemapper) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsServiceRemapper) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsServiceRemapper) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsServiceRemapper) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value. -func (o *LogsServiceRemapper) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsServiceRemapper) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsServiceRemapper) SetSources(v []string) { - o.Sources = v -} - -// GetType returns the Type field value. -func (o *LogsServiceRemapper) GetType() LogsServiceRemapperType { - if o == nil { - var ret LogsServiceRemapperType - 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 *LogsServiceRemapper) GetTypeOk() (*LogsServiceRemapperType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsServiceRemapper) SetType(v LogsServiceRemapperType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsServiceRemapper) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["sources"] = o.Sources - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsServiceRemapperType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsServiceRemapperType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_service_remapper_type.go b/api/v1/datadog/model_logs_service_remapper_type.go deleted file mode 100644 index 4cea7cf58f5..00000000000 --- a/api/v1/datadog/model_logs_service_remapper_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsServiceRemapperType Type of logs service remapper. -type LogsServiceRemapperType string - -// List of LogsServiceRemapperType. -const ( - LOGSSERVICEREMAPPERTYPE_SERVICE_REMAPPER LogsServiceRemapperType = "service-remapper" -) - -var allowedLogsServiceRemapperTypeEnumValues = []LogsServiceRemapperType{ - LOGSSERVICEREMAPPERTYPE_SERVICE_REMAPPER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsServiceRemapperType) GetAllowedValues() []LogsServiceRemapperType { - return allowedLogsServiceRemapperTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsServiceRemapperType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsServiceRemapperType(value) - return nil -} - -// NewLogsServiceRemapperTypeFromValue returns a pointer to a valid LogsServiceRemapperType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsServiceRemapperTypeFromValue(v string) (*LogsServiceRemapperType, error) { - ev := LogsServiceRemapperType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsServiceRemapperType: valid values are %v", v, allowedLogsServiceRemapperTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsServiceRemapperType) IsValid() bool { - for _, existing := range allowedLogsServiceRemapperTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsServiceRemapperType value. -func (v LogsServiceRemapperType) Ptr() *LogsServiceRemapperType { - return &v -} - -// NullableLogsServiceRemapperType handles when a null is used for LogsServiceRemapperType. -type NullableLogsServiceRemapperType struct { - value *LogsServiceRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsServiceRemapperType) Get() *LogsServiceRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsServiceRemapperType) Set(val *LogsServiceRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsServiceRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsServiceRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsServiceRemapperType initializes the struct as if Set has been called. -func NewNullableLogsServiceRemapperType(val *LogsServiceRemapperType) *NullableLogsServiceRemapperType { - return &NullableLogsServiceRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsServiceRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsServiceRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_sort.go b/api/v1/datadog/model_logs_sort.go deleted file mode 100644 index 03eeda525f2..00000000000 --- a/api/v1/datadog/model_logs_sort.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsSort Time-ascending `asc` or time-descending `desc` results. -type LogsSort string - -// List of LogsSort. -const ( - LOGSSORT_TIME_ASCENDING LogsSort = "asc" - LOGSSORT_TIME_DESCENDING LogsSort = "desc" -) - -var allowedLogsSortEnumValues = []LogsSort{ - LOGSSORT_TIME_ASCENDING, - LOGSSORT_TIME_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsSort) GetAllowedValues() []LogsSort { - return allowedLogsSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsSort(value) - return nil -} - -// NewLogsSortFromValue returns a pointer to a valid LogsSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsSortFromValue(v string) (*LogsSort, error) { - ev := LogsSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsSort: valid values are %v", v, allowedLogsSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsSort) IsValid() bool { - for _, existing := range allowedLogsSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsSort value. -func (v LogsSort) Ptr() *LogsSort { - return &v -} - -// NullableLogsSort handles when a null is used for LogsSort. -type NullableLogsSort struct { - value *LogsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsSort) Get() *LogsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsSort) Set(val *LogsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsSort initializes the struct as if Set has been called. -func NewNullableLogsSort(val *LogsSort) *NullableLogsSort { - return &NullableLogsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_status_remapper.go b/api/v1/datadog/model_logs_status_remapper.go deleted file mode 100644 index c3a3d34616f..00000000000 --- a/api/v1/datadog/model_logs_status_remapper.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsStatusRemapper Use this Processor if you want to assign some attributes as the official status. -// -// Each incoming status value is mapped as follows. -// -// - Integers from 0 to 7 map to the Syslog severity standards -// - Strings beginning with `emerg` or f (case-insensitive) map to `emerg` (0) -// - Strings beginning with `a` (case-insensitive) map to `alert` (1) -// - Strings beginning with `c` (case-insensitive) map to `critical` (2) -// - Strings beginning with `err` (case-insensitive) map to `error` (3) -// - Strings beginning with `w` (case-insensitive) map to `warning` (4) -// - Strings beginning with `n` (case-insensitive) map to `notice` (5) -// - Strings beginning with `i` (case-insensitive) map to `info` (6) -// - Strings beginning with `d`, `trace` or `verbose` (case-insensitive) map to `debug` (7) -// - Strings beginning with `o` or matching `OK` or `Success` (case-insensitive) map to OK -// - All others map to `info` (6) -// -// **Note:** If multiple log status remapper processors can be applied to a given log, -// only the first one (according to the pipelines order) is taken into account. -type LogsStatusRemapper struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Type of logs status remapper. - Type LogsStatusRemapperType `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{} -} - -// NewLogsStatusRemapper instantiates a new LogsStatusRemapper 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 NewLogsStatusRemapper(sources []string, typeVar LogsStatusRemapperType) *LogsStatusRemapper { - this := LogsStatusRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Sources = sources - this.Type = typeVar - return &this -} - -// NewLogsStatusRemapperWithDefaults instantiates a new LogsStatusRemapper 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 NewLogsStatusRemapperWithDefaults() *LogsStatusRemapper { - this := LogsStatusRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsStatusRemapperType = LOGSSTATUSREMAPPERTYPE_STATUS_REMAPPER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsStatusRemapper) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsStatusRemapper) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsStatusRemapper) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsStatusRemapper) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsStatusRemapper) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsStatusRemapper) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsStatusRemapper) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsStatusRemapper) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value. -func (o *LogsStatusRemapper) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsStatusRemapper) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsStatusRemapper) SetSources(v []string) { - o.Sources = v -} - -// GetType returns the Type field value. -func (o *LogsStatusRemapper) GetType() LogsStatusRemapperType { - if o == nil { - var ret LogsStatusRemapperType - 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 *LogsStatusRemapper) GetTypeOk() (*LogsStatusRemapperType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsStatusRemapper) SetType(v LogsStatusRemapperType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsStatusRemapper) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["sources"] = o.Sources - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsStatusRemapperType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsStatusRemapperType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_status_remapper_type.go b/api/v1/datadog/model_logs_status_remapper_type.go deleted file mode 100644 index 20d6ab58402..00000000000 --- a/api/v1/datadog/model_logs_status_remapper_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsStatusRemapperType Type of logs status remapper. -type LogsStatusRemapperType string - -// List of LogsStatusRemapperType. -const ( - LOGSSTATUSREMAPPERTYPE_STATUS_REMAPPER LogsStatusRemapperType = "status-remapper" -) - -var allowedLogsStatusRemapperTypeEnumValues = []LogsStatusRemapperType{ - LOGSSTATUSREMAPPERTYPE_STATUS_REMAPPER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsStatusRemapperType) GetAllowedValues() []LogsStatusRemapperType { - return allowedLogsStatusRemapperTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsStatusRemapperType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsStatusRemapperType(value) - return nil -} - -// NewLogsStatusRemapperTypeFromValue returns a pointer to a valid LogsStatusRemapperType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsStatusRemapperTypeFromValue(v string) (*LogsStatusRemapperType, error) { - ev := LogsStatusRemapperType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsStatusRemapperType: valid values are %v", v, allowedLogsStatusRemapperTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsStatusRemapperType) IsValid() bool { - for _, existing := range allowedLogsStatusRemapperTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsStatusRemapperType value. -func (v LogsStatusRemapperType) Ptr() *LogsStatusRemapperType { - return &v -} - -// NullableLogsStatusRemapperType handles when a null is used for LogsStatusRemapperType. -type NullableLogsStatusRemapperType struct { - value *LogsStatusRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsStatusRemapperType) Get() *LogsStatusRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsStatusRemapperType) Set(val *LogsStatusRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsStatusRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsStatusRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsStatusRemapperType initializes the struct as if Set has been called. -func NewNullableLogsStatusRemapperType(val *LogsStatusRemapperType) *NullableLogsStatusRemapperType { - return &NullableLogsStatusRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsStatusRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsStatusRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_string_builder_processor.go b/api/v1/datadog/model_logs_string_builder_processor.go deleted file mode 100644 index dbc110b7f15..00000000000 --- a/api/v1/datadog/model_logs_string_builder_processor.go +++ /dev/null @@ -1,317 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsStringBuilderProcessor Use the string builder processor to add a new attribute (without spaces or special characters) -// to a log with the result of the provided template. -// This enables aggregation of different attributes or raw strings into a single attribute. -// -// The template is defined by both raw text and blocks with the syntax `%{attribute_path}`. -// -// **Notes**: -// -// - The processor only accepts attributes with values or an array of values in the blocks. -// - If an attribute cannot be used (object or array of object), -// it is replaced by an empty string or the entire operation is skipped depending on your selection. -// - If the target attribute already exists, it is overwritten by the result of the template. -// - Results of the template cannot exceed 256 characters. -type LogsStringBuilderProcessor struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // If true, it replaces all missing attributes of `template` by an empty string. - // If `false` (default), skips the operation for missing attributes. - IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // The name of the attribute that contains the result of the template. - Target string `json:"target"` - // A formula with one or more attributes and raw text. - Template string `json:"template"` - // Type of logs string builder processor. - Type LogsStringBuilderProcessorType `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{} -} - -// NewLogsStringBuilderProcessor instantiates a new LogsStringBuilderProcessor 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 NewLogsStringBuilderProcessor(target string, template string, typeVar LogsStringBuilderProcessorType) *LogsStringBuilderProcessor { - this := LogsStringBuilderProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var isReplaceMissing bool = false - this.IsReplaceMissing = &isReplaceMissing - this.Target = target - this.Template = template - this.Type = typeVar - return &this -} - -// NewLogsStringBuilderProcessorWithDefaults instantiates a new LogsStringBuilderProcessor 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 NewLogsStringBuilderProcessorWithDefaults() *LogsStringBuilderProcessor { - this := LogsStringBuilderProcessor{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var isReplaceMissing bool = false - this.IsReplaceMissing = &isReplaceMissing - var typeVar LogsStringBuilderProcessorType = LOGSSTRINGBUILDERPROCESSORTYPE_STRING_BUILDER_PROCESSOR - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsStringBuilderProcessor) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsStringBuilderProcessor) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsStringBuilderProcessor) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsStringBuilderProcessor) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetIsReplaceMissing returns the IsReplaceMissing field value if set, zero value otherwise. -func (o *LogsStringBuilderProcessor) GetIsReplaceMissing() bool { - if o == nil || o.IsReplaceMissing == nil { - var ret bool - return ret - } - return *o.IsReplaceMissing -} - -// GetIsReplaceMissingOk returns a tuple with the IsReplaceMissing field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsStringBuilderProcessor) GetIsReplaceMissingOk() (*bool, bool) { - if o == nil || o.IsReplaceMissing == nil { - return nil, false - } - return o.IsReplaceMissing, true -} - -// HasIsReplaceMissing returns a boolean if a field has been set. -func (o *LogsStringBuilderProcessor) HasIsReplaceMissing() bool { - if o != nil && o.IsReplaceMissing != nil { - return true - } - - return false -} - -// SetIsReplaceMissing gets a reference to the given bool and assigns it to the IsReplaceMissing field. -func (o *LogsStringBuilderProcessor) SetIsReplaceMissing(v bool) { - o.IsReplaceMissing = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsStringBuilderProcessor) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsStringBuilderProcessor) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsStringBuilderProcessor) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsStringBuilderProcessor) SetName(v string) { - o.Name = &v -} - -// GetTarget returns the Target field value. -func (o *LogsStringBuilderProcessor) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsStringBuilderProcessor) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsStringBuilderProcessor) SetTarget(v string) { - o.Target = v -} - -// GetTemplate returns the Template field value. -func (o *LogsStringBuilderProcessor) GetTemplate() string { - if o == nil { - var ret string - return ret - } - return o.Template -} - -// GetTemplateOk returns a tuple with the Template field value -// and a boolean to check if the value has been set. -func (o *LogsStringBuilderProcessor) GetTemplateOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Template, true -} - -// SetTemplate sets field value. -func (o *LogsStringBuilderProcessor) SetTemplate(v string) { - o.Template = v -} - -// GetType returns the Type field value. -func (o *LogsStringBuilderProcessor) GetType() LogsStringBuilderProcessorType { - if o == nil { - var ret LogsStringBuilderProcessorType - 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 *LogsStringBuilderProcessor) GetTypeOk() (*LogsStringBuilderProcessorType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsStringBuilderProcessor) SetType(v LogsStringBuilderProcessorType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsStringBuilderProcessor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.IsReplaceMissing != nil { - toSerialize["is_replace_missing"] = o.IsReplaceMissing - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["target"] = o.Target - toSerialize["template"] = o.Template - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Target *string `json:"target"` - Template *string `json:"template"` - Type *LogsStringBuilderProcessorType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` - Name *string `json:"name,omitempty"` - Target string `json:"target"` - Template string `json:"template"` - Type LogsStringBuilderProcessorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Template == nil { - return fmt.Errorf("Required field template missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.IsReplaceMissing = all.IsReplaceMissing - o.Name = all.Name - o.Target = all.Target - o.Template = all.Template - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_string_builder_processor_type.go b/api/v1/datadog/model_logs_string_builder_processor_type.go deleted file mode 100644 index 2411fcbc3c2..00000000000 --- a/api/v1/datadog/model_logs_string_builder_processor_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsStringBuilderProcessorType Type of logs string builder processor. -type LogsStringBuilderProcessorType string - -// List of LogsStringBuilderProcessorType. -const ( - LOGSSTRINGBUILDERPROCESSORTYPE_STRING_BUILDER_PROCESSOR LogsStringBuilderProcessorType = "string-builder-processor" -) - -var allowedLogsStringBuilderProcessorTypeEnumValues = []LogsStringBuilderProcessorType{ - LOGSSTRINGBUILDERPROCESSORTYPE_STRING_BUILDER_PROCESSOR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsStringBuilderProcessorType) GetAllowedValues() []LogsStringBuilderProcessorType { - return allowedLogsStringBuilderProcessorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsStringBuilderProcessorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsStringBuilderProcessorType(value) - return nil -} - -// NewLogsStringBuilderProcessorTypeFromValue returns a pointer to a valid LogsStringBuilderProcessorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsStringBuilderProcessorTypeFromValue(v string) (*LogsStringBuilderProcessorType, error) { - ev := LogsStringBuilderProcessorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsStringBuilderProcessorType: valid values are %v", v, allowedLogsStringBuilderProcessorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsStringBuilderProcessorType) IsValid() bool { - for _, existing := range allowedLogsStringBuilderProcessorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsStringBuilderProcessorType value. -func (v LogsStringBuilderProcessorType) Ptr() *LogsStringBuilderProcessorType { - return &v -} - -// NullableLogsStringBuilderProcessorType handles when a null is used for LogsStringBuilderProcessorType. -type NullableLogsStringBuilderProcessorType struct { - value *LogsStringBuilderProcessorType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsStringBuilderProcessorType) Get() *LogsStringBuilderProcessorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsStringBuilderProcessorType) Set(val *LogsStringBuilderProcessorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsStringBuilderProcessorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsStringBuilderProcessorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsStringBuilderProcessorType initializes the struct as if Set has been called. -func NewNullableLogsStringBuilderProcessorType(val *LogsStringBuilderProcessorType) *NullableLogsStringBuilderProcessorType { - return &NullableLogsStringBuilderProcessorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsStringBuilderProcessorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsStringBuilderProcessorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_trace_remapper.go b/api/v1/datadog/model_logs_trace_remapper.go deleted file mode 100644 index 8a927f6ea62..00000000000 --- a/api/v1/datadog/model_logs_trace_remapper.go +++ /dev/null @@ -1,239 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsTraceRemapper There are two ways to improve correlation between application traces and logs. -// -// 1. Follow the documentation on [how to inject a trace ID in the application logs](https://docs.datadoghq.com/tracing/connect_logs_and_traces) -// and by default log integrations take care of all the rest of the setup. -// -// 2. Use the Trace remapper processor to define a log attribute as its associated trace ID. -type LogsTraceRemapper struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Array of source attributes. - Sources []string `json:"sources,omitempty"` - // Type of logs trace remapper. - Type LogsTraceRemapperType `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{} -} - -// NewLogsTraceRemapper instantiates a new LogsTraceRemapper 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 NewLogsTraceRemapper(typeVar LogsTraceRemapperType) *LogsTraceRemapper { - this := LogsTraceRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - this.Type = typeVar - return &this -} - -// NewLogsTraceRemapperWithDefaults instantiates a new LogsTraceRemapper 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 NewLogsTraceRemapperWithDefaults() *LogsTraceRemapper { - this := LogsTraceRemapper{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var typeVar LogsTraceRemapperType = LOGSTRACEREMAPPERTYPE_TRACE_ID_REMAPPER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsTraceRemapper) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsTraceRemapper) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsTraceRemapper) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsTraceRemapper) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsTraceRemapper) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsTraceRemapper) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsTraceRemapper) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsTraceRemapper) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value if set, zero value otherwise. -func (o *LogsTraceRemapper) GetSources() []string { - if o == nil || o.Sources == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsTraceRemapper) GetSourcesOk() (*[]string, bool) { - if o == nil || o.Sources == nil { - return nil, false - } - return &o.Sources, true -} - -// HasSources returns a boolean if a field has been set. -func (o *LogsTraceRemapper) HasSources() bool { - if o != nil && o.Sources != nil { - return true - } - - return false -} - -// SetSources gets a reference to the given []string and assigns it to the Sources field. -func (o *LogsTraceRemapper) SetSources(v []string) { - o.Sources = v -} - -// GetType returns the Type field value. -func (o *LogsTraceRemapper) GetType() LogsTraceRemapperType { - if o == nil { - var ret LogsTraceRemapperType - 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 *LogsTraceRemapper) GetTypeOk() (*LogsTraceRemapperType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsTraceRemapper) SetType(v LogsTraceRemapperType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsTraceRemapper) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Sources != nil { - toSerialize["sources"] = o.Sources - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *LogsTraceRemapperType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources,omitempty"` - Type LogsTraceRemapperType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_trace_remapper_type.go b/api/v1/datadog/model_logs_trace_remapper_type.go deleted file mode 100644 index 735b81fb696..00000000000 --- a/api/v1/datadog/model_logs_trace_remapper_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsTraceRemapperType Type of logs trace remapper. -type LogsTraceRemapperType string - -// List of LogsTraceRemapperType. -const ( - LOGSTRACEREMAPPERTYPE_TRACE_ID_REMAPPER LogsTraceRemapperType = "trace-id-remapper" -) - -var allowedLogsTraceRemapperTypeEnumValues = []LogsTraceRemapperType{ - LOGSTRACEREMAPPERTYPE_TRACE_ID_REMAPPER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsTraceRemapperType) GetAllowedValues() []LogsTraceRemapperType { - return allowedLogsTraceRemapperTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsTraceRemapperType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsTraceRemapperType(value) - return nil -} - -// NewLogsTraceRemapperTypeFromValue returns a pointer to a valid LogsTraceRemapperType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsTraceRemapperTypeFromValue(v string) (*LogsTraceRemapperType, error) { - ev := LogsTraceRemapperType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsTraceRemapperType: valid values are %v", v, allowedLogsTraceRemapperTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsTraceRemapperType) IsValid() bool { - for _, existing := range allowedLogsTraceRemapperTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsTraceRemapperType value. -func (v LogsTraceRemapperType) Ptr() *LogsTraceRemapperType { - return &v -} - -// NullableLogsTraceRemapperType handles when a null is used for LogsTraceRemapperType. -type NullableLogsTraceRemapperType struct { - value *LogsTraceRemapperType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsTraceRemapperType) Get() *LogsTraceRemapperType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsTraceRemapperType) Set(val *LogsTraceRemapperType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsTraceRemapperType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsTraceRemapperType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsTraceRemapperType initializes the struct as if Set has been called. -func NewNullableLogsTraceRemapperType(val *LogsTraceRemapperType) *NullableLogsTraceRemapperType { - return &NullableLogsTraceRemapperType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsTraceRemapperType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsTraceRemapperType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_url_parser.go b/api/v1/datadog/model_logs_url_parser.go deleted file mode 100644 index c6c9f3420d2..00000000000 --- a/api/v1/datadog/model_logs_url_parser.go +++ /dev/null @@ -1,319 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsURLParser This processor extracts query parameters and other important parameters from a URL. -type LogsURLParser struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Normalize the ending slashes or not. - NormalizeEndingSlashes common.NullableBool `json:"normalize_ending_slashes,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Name of the parent attribute that contains all the extracted details from the `sources`. - Target string `json:"target"` - // Type of logs URL parser. - Type LogsURLParserType `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{} -} - -// NewLogsURLParser instantiates a new LogsURLParser 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 NewLogsURLParser(sources []string, target string, typeVar LogsURLParserType) *LogsURLParser { - this := LogsURLParser{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var normalizeEndingSlashes bool = false - this.NormalizeEndingSlashes = *common.NewNullableBool(&normalizeEndingSlashes) - this.Sources = sources - this.Target = target - this.Type = typeVar - return &this -} - -// NewLogsURLParserWithDefaults instantiates a new LogsURLParser 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 NewLogsURLParserWithDefaults() *LogsURLParser { - this := LogsURLParser{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var normalizeEndingSlashes bool = false - this.NormalizeEndingSlashes = *common.NewNullableBool(&normalizeEndingSlashes) - var target string = "http.url_details" - this.Target = target - var typeVar LogsURLParserType = LOGSURLPARSERTYPE_URL_PARSER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsURLParser) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsURLParser) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsURLParser) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsURLParser) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsURLParser) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsURLParser) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsURLParser) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsURLParser) SetName(v string) { - o.Name = &v -} - -// GetNormalizeEndingSlashes returns the NormalizeEndingSlashes field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *LogsURLParser) GetNormalizeEndingSlashes() bool { - if o == nil || o.NormalizeEndingSlashes.Get() == nil { - var ret bool - return ret - } - return *o.NormalizeEndingSlashes.Get() -} - -// GetNormalizeEndingSlashesOk returns a tuple with the NormalizeEndingSlashes 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 *LogsURLParser) GetNormalizeEndingSlashesOk() (*bool, bool) { - if o == nil { - return nil, false - } - return o.NormalizeEndingSlashes.Get(), o.NormalizeEndingSlashes.IsSet() -} - -// HasNormalizeEndingSlashes returns a boolean if a field has been set. -func (o *LogsURLParser) HasNormalizeEndingSlashes() bool { - if o != nil && o.NormalizeEndingSlashes.IsSet() { - return true - } - - return false -} - -// SetNormalizeEndingSlashes gets a reference to the given common.NullableBool and assigns it to the NormalizeEndingSlashes field. -func (o *LogsURLParser) SetNormalizeEndingSlashes(v bool) { - o.NormalizeEndingSlashes.Set(&v) -} - -// SetNormalizeEndingSlashesNil sets the value for NormalizeEndingSlashes to be an explicit nil. -func (o *LogsURLParser) SetNormalizeEndingSlashesNil() { - o.NormalizeEndingSlashes.Set(nil) -} - -// UnsetNormalizeEndingSlashes ensures that no value is present for NormalizeEndingSlashes, not even an explicit nil. -func (o *LogsURLParser) UnsetNormalizeEndingSlashes() { - o.NormalizeEndingSlashes.Unset() -} - -// GetSources returns the Sources field value. -func (o *LogsURLParser) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsURLParser) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsURLParser) SetSources(v []string) { - o.Sources = v -} - -// GetTarget returns the Target field value. -func (o *LogsURLParser) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsURLParser) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsURLParser) SetTarget(v string) { - o.Target = v -} - -// GetType returns the Type field value. -func (o *LogsURLParser) GetType() LogsURLParserType { - if o == nil { - var ret LogsURLParserType - 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 *LogsURLParser) GetTypeOk() (*LogsURLParserType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsURLParser) SetType(v LogsURLParserType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsURLParser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.NormalizeEndingSlashes.IsSet() { - toSerialize["normalize_ending_slashes"] = o.NormalizeEndingSlashes.Get() - } - toSerialize["sources"] = o.Sources - toSerialize["target"] = o.Target - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsURLParserType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - NormalizeEndingSlashes common.NullableBool `json:"normalize_ending_slashes,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - Type LogsURLParserType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.NormalizeEndingSlashes = all.NormalizeEndingSlashes - o.Sources = all.Sources - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_url_parser_type.go b/api/v1/datadog/model_logs_url_parser_type.go deleted file mode 100644 index 57562db6812..00000000000 --- a/api/v1/datadog/model_logs_url_parser_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsURLParserType Type of logs URL parser. -type LogsURLParserType string - -// List of LogsURLParserType. -const ( - LOGSURLPARSERTYPE_URL_PARSER LogsURLParserType = "url-parser" -) - -var allowedLogsURLParserTypeEnumValues = []LogsURLParserType{ - LOGSURLPARSERTYPE_URL_PARSER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsURLParserType) GetAllowedValues() []LogsURLParserType { - return allowedLogsURLParserTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsURLParserType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsURLParserType(value) - return nil -} - -// NewLogsURLParserTypeFromValue returns a pointer to a valid LogsURLParserType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsURLParserTypeFromValue(v string) (*LogsURLParserType, error) { - ev := LogsURLParserType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsURLParserType: valid values are %v", v, allowedLogsURLParserTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsURLParserType) IsValid() bool { - for _, existing := range allowedLogsURLParserTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsURLParserType value. -func (v LogsURLParserType) Ptr() *LogsURLParserType { - return &v -} - -// NullableLogsURLParserType handles when a null is used for LogsURLParserType. -type NullableLogsURLParserType struct { - value *LogsURLParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsURLParserType) Get() *LogsURLParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsURLParserType) Set(val *LogsURLParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsURLParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsURLParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsURLParserType initializes the struct as if Set has been called. -func NewNullableLogsURLParserType(val *LogsURLParserType) *NullableLogsURLParserType { - return &NullableLogsURLParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsURLParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsURLParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_logs_user_agent_parser.go b/api/v1/datadog/model_logs_user_agent_parser.go deleted file mode 100644 index b189976e23a..00000000000 --- a/api/v1/datadog/model_logs_user_agent_parser.go +++ /dev/null @@ -1,307 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsUserAgentParser The User-Agent parser takes a User-Agent attribute and extracts the OS, browser, device, and other user data. -// It recognizes major bots like the Google Bot, Yahoo Slurp, and Bing. -type LogsUserAgentParser struct { - // Whether or not the processor is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // Define if the source attribute is URL encoded or not. - IsEncoded *bool `json:"is_encoded,omitempty"` - // Name of the processor. - Name *string `json:"name,omitempty"` - // Array of source attributes. - Sources []string `json:"sources"` - // Name of the parent attribute that contains all the extracted details from the `sources`. - Target string `json:"target"` - // Type of logs User-Agent parser. - Type LogsUserAgentParserType `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{} -} - -// NewLogsUserAgentParser instantiates a new LogsUserAgentParser 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 NewLogsUserAgentParser(sources []string, target string, typeVar LogsUserAgentParserType) *LogsUserAgentParser { - this := LogsUserAgentParser{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var isEncoded bool = false - this.IsEncoded = &isEncoded - this.Sources = sources - this.Target = target - this.Type = typeVar - return &this -} - -// NewLogsUserAgentParserWithDefaults instantiates a new LogsUserAgentParser 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 NewLogsUserAgentParserWithDefaults() *LogsUserAgentParser { - this := LogsUserAgentParser{} - var isEnabled bool = false - this.IsEnabled = &isEnabled - var isEncoded bool = false - this.IsEncoded = &isEncoded - var target string = "http.useragent_details" - this.Target = target - var typeVar LogsUserAgentParserType = LOGSUSERAGENTPARSERTYPE_USER_AGENT_PARSER - this.Type = typeVar - return &this -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *LogsUserAgentParser) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsUserAgentParser) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *LogsUserAgentParser) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *LogsUserAgentParser) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetIsEncoded returns the IsEncoded field value if set, zero value otherwise. -func (o *LogsUserAgentParser) GetIsEncoded() bool { - if o == nil || o.IsEncoded == nil { - var ret bool - return ret - } - return *o.IsEncoded -} - -// GetIsEncodedOk returns a tuple with the IsEncoded field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsUserAgentParser) GetIsEncodedOk() (*bool, bool) { - if o == nil || o.IsEncoded == nil { - return nil, false - } - return o.IsEncoded, true -} - -// HasIsEncoded returns a boolean if a field has been set. -func (o *LogsUserAgentParser) HasIsEncoded() bool { - if o != nil && o.IsEncoded != nil { - return true - } - - return false -} - -// SetIsEncoded gets a reference to the given bool and assigns it to the IsEncoded field. -func (o *LogsUserAgentParser) SetIsEncoded(v bool) { - o.IsEncoded = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *LogsUserAgentParser) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsUserAgentParser) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *LogsUserAgentParser) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *LogsUserAgentParser) SetName(v string) { - o.Name = &v -} - -// GetSources returns the Sources field value. -func (o *LogsUserAgentParser) GetSources() []string { - if o == nil { - var ret []string - return ret - } - return o.Sources -} - -// GetSourcesOk returns a tuple with the Sources field value -// and a boolean to check if the value has been set. -func (o *LogsUserAgentParser) GetSourcesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Sources, true -} - -// SetSources sets field value. -func (o *LogsUserAgentParser) SetSources(v []string) { - o.Sources = v -} - -// GetTarget returns the Target field value. -func (o *LogsUserAgentParser) GetTarget() string { - if o == nil { - var ret string - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *LogsUserAgentParser) GetTargetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *LogsUserAgentParser) SetTarget(v string) { - o.Target = v -} - -// GetType returns the Type field value. -func (o *LogsUserAgentParser) GetType() LogsUserAgentParserType { - if o == nil { - var ret LogsUserAgentParserType - 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 *LogsUserAgentParser) GetTypeOk() (*LogsUserAgentParserType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsUserAgentParser) SetType(v LogsUserAgentParserType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsUserAgentParser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.IsEncoded != nil { - toSerialize["is_encoded"] = o.IsEncoded - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["sources"] = o.Sources - toSerialize["target"] = o.Target - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsUserAgentParserType `json:"type"` - }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - IsEncoded *bool `json:"is_encoded,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - Type LogsUserAgentParserType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("Required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsEnabled = all.IsEnabled - o.IsEncoded = all.IsEncoded - o.Name = all.Name - o.Sources = all.Sources - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_logs_user_agent_parser_type.go b/api/v1/datadog/model_logs_user_agent_parser_type.go deleted file mode 100644 index b2f36f2d6e5..00000000000 --- a/api/v1/datadog/model_logs_user_agent_parser_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsUserAgentParserType Type of logs User-Agent parser. -type LogsUserAgentParserType string - -// List of LogsUserAgentParserType. -const ( - LOGSUSERAGENTPARSERTYPE_USER_AGENT_PARSER LogsUserAgentParserType = "user-agent-parser" -) - -var allowedLogsUserAgentParserTypeEnumValues = []LogsUserAgentParserType{ - LOGSUSERAGENTPARSERTYPE_USER_AGENT_PARSER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsUserAgentParserType) GetAllowedValues() []LogsUserAgentParserType { - return allowedLogsUserAgentParserTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsUserAgentParserType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsUserAgentParserType(value) - return nil -} - -// NewLogsUserAgentParserTypeFromValue returns a pointer to a valid LogsUserAgentParserType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsUserAgentParserTypeFromValue(v string) (*LogsUserAgentParserType, error) { - ev := LogsUserAgentParserType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsUserAgentParserType: valid values are %v", v, allowedLogsUserAgentParserTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsUserAgentParserType) IsValid() bool { - for _, existing := range allowedLogsUserAgentParserTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsUserAgentParserType value. -func (v LogsUserAgentParserType) Ptr() *LogsUserAgentParserType { - return &v -} - -// NullableLogsUserAgentParserType handles when a null is used for LogsUserAgentParserType. -type NullableLogsUserAgentParserType struct { - value *LogsUserAgentParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsUserAgentParserType) Get() *LogsUserAgentParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsUserAgentParserType) Set(val *LogsUserAgentParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsUserAgentParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsUserAgentParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsUserAgentParserType initializes the struct as if Set has been called. -func NewNullableLogsUserAgentParserType(val *LogsUserAgentParserType) *NullableLogsUserAgentParserType { - return &NullableLogsUserAgentParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsUserAgentParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsUserAgentParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_metric_content_encoding.go b/api/v1/datadog/model_metric_content_encoding.go deleted file mode 100644 index 05dc8ba28e3..00000000000 --- a/api/v1/datadog/model_metric_content_encoding.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricContentEncoding HTTP header used to compress the media-type. -type MetricContentEncoding string - -// List of MetricContentEncoding. -const ( - METRICCONTENTENCODING_DEFLATE MetricContentEncoding = "deflate" -) - -var allowedMetricContentEncodingEnumValues = []MetricContentEncoding{ - METRICCONTENTENCODING_DEFLATE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricContentEncoding) GetAllowedValues() []MetricContentEncoding { - return allowedMetricContentEncodingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricContentEncoding) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricContentEncoding(value) - return nil -} - -// NewMetricContentEncodingFromValue returns a pointer to a valid MetricContentEncoding -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricContentEncodingFromValue(v string) (*MetricContentEncoding, error) { - ev := MetricContentEncoding(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricContentEncoding: valid values are %v", v, allowedMetricContentEncodingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricContentEncoding) IsValid() bool { - for _, existing := range allowedMetricContentEncodingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricContentEncoding value. -func (v MetricContentEncoding) Ptr() *MetricContentEncoding { - return &v -} - -// NullableMetricContentEncoding handles when a null is used for MetricContentEncoding. -type NullableMetricContentEncoding struct { - value *MetricContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricContentEncoding) Get() *MetricContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricContentEncoding) Set(val *MetricContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricContentEncoding initializes the struct as if Set has been called. -func NewNullableMetricContentEncoding(val *MetricContentEncoding) *NullableMetricContentEncoding { - return &NullableMetricContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_metric_metadata.go b/api/v1/datadog/model_metric_metadata.go deleted file mode 100644 index a129ca26bce..00000000000 --- a/api/v1/datadog/model_metric_metadata.go +++ /dev/null @@ -1,336 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricMetadata Object with all metric related metadata. -type MetricMetadata struct { - // Metric description. - Description *string `json:"description,omitempty"` - // Name of the integration that sent the metric if applicable. - Integration *string `json:"integration,omitempty"` - // Per unit of the metric such as `second` in `bytes per second`. - PerUnit *string `json:"per_unit,omitempty"` - // A more human-readable and abbreviated version of the metric name. - ShortName *string `json:"short_name,omitempty"` - // StatsD flush interval of the metric in seconds if applicable. - StatsdInterval *int64 `json:"statsd_interval,omitempty"` - // Metric type such as `gauge` or `rate`. - Type *string `json:"type,omitempty"` - // Primary unit of the metric such as `byte` or `operation`. - Unit *string `json:"unit,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{} -} - -// NewMetricMetadata instantiates a new MetricMetadata 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 NewMetricMetadata() *MetricMetadata { - this := MetricMetadata{} - return &this -} - -// NewMetricMetadataWithDefaults instantiates a new MetricMetadata 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 NewMetricMetadataWithDefaults() *MetricMetadata { - this := MetricMetadata{} - return &this -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *MetricMetadata) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *MetricMetadata) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *MetricMetadata) SetDescription(v string) { - o.Description = &v -} - -// GetIntegration returns the Integration field value if set, zero value otherwise. -func (o *MetricMetadata) GetIntegration() string { - if o == nil || o.Integration == nil { - var ret string - return ret - } - return *o.Integration -} - -// GetIntegrationOk returns a tuple with the Integration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetIntegrationOk() (*string, bool) { - if o == nil || o.Integration == nil { - return nil, false - } - return o.Integration, true -} - -// HasIntegration returns a boolean if a field has been set. -func (o *MetricMetadata) HasIntegration() bool { - if o != nil && o.Integration != nil { - return true - } - - return false -} - -// SetIntegration gets a reference to the given string and assigns it to the Integration field. -func (o *MetricMetadata) SetIntegration(v string) { - o.Integration = &v -} - -// GetPerUnit returns the PerUnit field value if set, zero value otherwise. -func (o *MetricMetadata) GetPerUnit() string { - if o == nil || o.PerUnit == nil { - var ret string - return ret - } - return *o.PerUnit -} - -// GetPerUnitOk returns a tuple with the PerUnit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetPerUnitOk() (*string, bool) { - if o == nil || o.PerUnit == nil { - return nil, false - } - return o.PerUnit, true -} - -// HasPerUnit returns a boolean if a field has been set. -func (o *MetricMetadata) HasPerUnit() bool { - if o != nil && o.PerUnit != nil { - return true - } - - return false -} - -// SetPerUnit gets a reference to the given string and assigns it to the PerUnit field. -func (o *MetricMetadata) SetPerUnit(v string) { - o.PerUnit = &v -} - -// GetShortName returns the ShortName field value if set, zero value otherwise. -func (o *MetricMetadata) GetShortName() string { - if o == nil || o.ShortName == nil { - var ret string - return ret - } - return *o.ShortName -} - -// GetShortNameOk returns a tuple with the ShortName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetShortNameOk() (*string, bool) { - if o == nil || o.ShortName == nil { - return nil, false - } - return o.ShortName, true -} - -// HasShortName returns a boolean if a field has been set. -func (o *MetricMetadata) HasShortName() bool { - if o != nil && o.ShortName != nil { - return true - } - - return false -} - -// SetShortName gets a reference to the given string and assigns it to the ShortName field. -func (o *MetricMetadata) SetShortName(v string) { - o.ShortName = &v -} - -// GetStatsdInterval returns the StatsdInterval field value if set, zero value otherwise. -func (o *MetricMetadata) GetStatsdInterval() int64 { - if o == nil || o.StatsdInterval == nil { - var ret int64 - return ret - } - return *o.StatsdInterval -} - -// GetStatsdIntervalOk returns a tuple with the StatsdInterval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetStatsdIntervalOk() (*int64, bool) { - if o == nil || o.StatsdInterval == nil { - return nil, false - } - return o.StatsdInterval, true -} - -// HasStatsdInterval returns a boolean if a field has been set. -func (o *MetricMetadata) HasStatsdInterval() bool { - if o != nil && o.StatsdInterval != nil { - return true - } - - return false -} - -// SetStatsdInterval gets a reference to the given int64 and assigns it to the StatsdInterval field. -func (o *MetricMetadata) SetStatsdInterval(v int64) { - o.StatsdInterval = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricMetadata) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricMetadata) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *MetricMetadata) SetType(v string) { - o.Type = &v -} - -// GetUnit returns the Unit field value if set, zero value otherwise. -func (o *MetricMetadata) GetUnit() string { - if o == nil || o.Unit == nil { - var ret string - return ret - } - return *o.Unit -} - -// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetUnitOk() (*string, bool) { - if o == nil || o.Unit == nil { - return nil, false - } - return o.Unit, true -} - -// HasUnit returns a boolean if a field has been set. -func (o *MetricMetadata) HasUnit() bool { - if o != nil && o.Unit != nil { - return true - } - - return false -} - -// SetUnit gets a reference to the given string and assigns it to the Unit field. -func (o *MetricMetadata) SetUnit(v string) { - o.Unit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Integration != nil { - toSerialize["integration"] = o.Integration - } - if o.PerUnit != nil { - toSerialize["per_unit"] = o.PerUnit - } - if o.ShortName != nil { - toSerialize["short_name"] = o.ShortName - } - if o.StatsdInterval != nil { - toSerialize["statsd_interval"] = o.StatsdInterval - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.Unit != nil { - toSerialize["unit"] = o.Unit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Description *string `json:"description,omitempty"` - Integration *string `json:"integration,omitempty"` - PerUnit *string `json:"per_unit,omitempty"` - ShortName *string `json:"short_name,omitempty"` - StatsdInterval *int64 `json:"statsd_interval,omitempty"` - Type *string `json:"type,omitempty"` - Unit *string `json:"unit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Description = all.Description - o.Integration = all.Integration - o.PerUnit = all.PerUnit - o.ShortName = all.ShortName - o.StatsdInterval = all.StatsdInterval - o.Type = all.Type - o.Unit = all.Unit - return nil -} diff --git a/api/v1/datadog/model_metric_search_response.go b/api/v1/datadog/model_metric_search_response.go deleted file mode 100644 index 964011c6cee..00000000000 --- a/api/v1/datadog/model_metric_search_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricSearchResponse Object containing the list of metrics matching the search query. -type MetricSearchResponse struct { - // Search result. - Results *MetricSearchResponseResults `json:"results,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{} -} - -// NewMetricSearchResponse instantiates a new MetricSearchResponse 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 NewMetricSearchResponse() *MetricSearchResponse { - this := MetricSearchResponse{} - return &this -} - -// NewMetricSearchResponseWithDefaults instantiates a new MetricSearchResponse 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 NewMetricSearchResponseWithDefaults() *MetricSearchResponse { - this := MetricSearchResponse{} - return &this -} - -// GetResults returns the Results field value if set, zero value otherwise. -func (o *MetricSearchResponse) GetResults() MetricSearchResponseResults { - if o == nil || o.Results == nil { - var ret MetricSearchResponseResults - return ret - } - return *o.Results -} - -// GetResultsOk returns a tuple with the Results field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSearchResponse) GetResultsOk() (*MetricSearchResponseResults, bool) { - if o == nil || o.Results == nil { - return nil, false - } - return o.Results, true -} - -// HasResults returns a boolean if a field has been set. -func (o *MetricSearchResponse) HasResults() bool { - if o != nil && o.Results != nil { - return true - } - - return false -} - -// SetResults gets a reference to the given MetricSearchResponseResults and assigns it to the Results field. -func (o *MetricSearchResponse) SetResults(v MetricSearchResponseResults) { - o.Results = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricSearchResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Results != nil { - toSerialize["results"] = o.Results - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricSearchResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Results *MetricSearchResponseResults `json:"results,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Results != nil && all.Results.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Results = all.Results - return nil -} diff --git a/api/v1/datadog/model_metric_search_response_results.go b/api/v1/datadog/model_metric_search_response_results.go deleted file mode 100644 index 867b668cba3..00000000000 --- a/api/v1/datadog/model_metric_search_response_results.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricSearchResponseResults Search result. -type MetricSearchResponseResults struct { - // List of metrics that match the search query. - Metrics []string `json:"metrics,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{} -} - -// NewMetricSearchResponseResults instantiates a new MetricSearchResponseResults 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 NewMetricSearchResponseResults() *MetricSearchResponseResults { - this := MetricSearchResponseResults{} - return &this -} - -// NewMetricSearchResponseResultsWithDefaults instantiates a new MetricSearchResponseResults 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 NewMetricSearchResponseResultsWithDefaults() *MetricSearchResponseResults { - this := MetricSearchResponseResults{} - return &this -} - -// GetMetrics returns the Metrics field value if set, zero value otherwise. -func (o *MetricSearchResponseResults) GetMetrics() []string { - if o == nil || o.Metrics == nil { - var ret []string - return ret - } - return o.Metrics -} - -// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSearchResponseResults) GetMetricsOk() (*[]string, bool) { - if o == nil || o.Metrics == nil { - return nil, false - } - return &o.Metrics, true -} - -// HasMetrics returns a boolean if a field has been set. -func (o *MetricSearchResponseResults) HasMetrics() bool { - if o != nil && o.Metrics != nil { - return true - } - - return false -} - -// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. -func (o *MetricSearchResponseResults) SetMetrics(v []string) { - o.Metrics = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricSearchResponseResults) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Metrics != nil { - toSerialize["metrics"] = o.Metrics - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricSearchResponseResults) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Metrics []string `json:"metrics,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Metrics = all.Metrics - return nil -} diff --git a/api/v1/datadog/model_metrics_list_response.go b/api/v1/datadog/model_metrics_list_response.go deleted file mode 100644 index da1fd57b7c6..00000000000 --- a/api/v1/datadog/model_metrics_list_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricsListResponse Object listing all metric names stored by Datadog since a given time. -type MetricsListResponse struct { - // Time when the metrics were active, seconds since the Unix epoch. - From *string `json:"from,omitempty"` - // List of metric names. - Metrics []string `json:"metrics,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{} -} - -// NewMetricsListResponse instantiates a new MetricsListResponse 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 NewMetricsListResponse() *MetricsListResponse { - this := MetricsListResponse{} - return &this -} - -// NewMetricsListResponseWithDefaults instantiates a new MetricsListResponse 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 NewMetricsListResponseWithDefaults() *MetricsListResponse { - this := MetricsListResponse{} - return &this -} - -// GetFrom returns the From field value if set, zero value otherwise. -func (o *MetricsListResponse) GetFrom() string { - if o == nil || o.From == nil { - var ret string - return ret - } - return *o.From -} - -// GetFromOk returns a tuple with the From field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsListResponse) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { - return nil, false - } - return o.From, true -} - -// HasFrom returns a boolean if a field has been set. -func (o *MetricsListResponse) HasFrom() bool { - if o != nil && o.From != nil { - return true - } - - return false -} - -// SetFrom gets a reference to the given string and assigns it to the From field. -func (o *MetricsListResponse) SetFrom(v string) { - o.From = &v -} - -// GetMetrics returns the Metrics field value if set, zero value otherwise. -func (o *MetricsListResponse) GetMetrics() []string { - if o == nil || o.Metrics == nil { - var ret []string - return ret - } - return o.Metrics -} - -// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsListResponse) GetMetricsOk() (*[]string, bool) { - if o == nil || o.Metrics == nil { - return nil, false - } - return &o.Metrics, true -} - -// HasMetrics returns a boolean if a field has been set. -func (o *MetricsListResponse) HasMetrics() bool { - if o != nil && o.Metrics != nil { - return true - } - - return false -} - -// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. -func (o *MetricsListResponse) SetMetrics(v []string) { - o.Metrics = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricsListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.From != nil { - toSerialize["from"] = o.From - } - if o.Metrics != nil { - toSerialize["metrics"] = o.Metrics - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - From *string `json:"from,omitempty"` - Metrics []string `json:"metrics,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.From = all.From - o.Metrics = all.Metrics - return nil -} diff --git a/api/v1/datadog/model_metrics_payload.go b/api/v1/datadog/model_metrics_payload.go deleted file mode 100644 index 15a92088bb1..00000000000 --- a/api/v1/datadog/model_metrics_payload.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricsPayload The metrics' payload. -type MetricsPayload struct { - // A list of time series to submit to Datadog. - Series []Series `json:"series"` - // 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{} -} - -// NewMetricsPayload instantiates a new MetricsPayload 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 NewMetricsPayload(series []Series) *MetricsPayload { - this := MetricsPayload{} - this.Series = series - return &this -} - -// NewMetricsPayloadWithDefaults instantiates a new MetricsPayload 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 NewMetricsPayloadWithDefaults() *MetricsPayload { - this := MetricsPayload{} - return &this -} - -// GetSeries returns the Series field value. -func (o *MetricsPayload) GetSeries() []Series { - if o == nil { - var ret []Series - return ret - } - return o.Series -} - -// GetSeriesOk returns a tuple with the Series field value -// and a boolean to check if the value has been set. -func (o *MetricsPayload) GetSeriesOk() (*[]Series, bool) { - if o == nil { - return nil, false - } - return &o.Series, true -} - -// SetSeries sets field value. -func (o *MetricsPayload) SetSeries(v []Series) { - o.Series = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricsPayload) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["series"] = o.Series - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricsPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Series *[]Series `json:"series"` - }{} - all := struct { - Series []Series `json:"series"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Series == nil { - return fmt.Errorf("Required field series missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Series = all.Series - return nil -} diff --git a/api/v1/datadog/model_metrics_query_metadata.go b/api/v1/datadog/model_metrics_query_metadata.go deleted file mode 100644 index db00105e3fc..00000000000 --- a/api/v1/datadog/model_metrics_query_metadata.go +++ /dev/null @@ -1,585 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MetricsQueryMetadata Object containing all metric names returned and their associated metadata. -type MetricsQueryMetadata struct { - // Aggregation type. - Aggr common.NullableString `json:"aggr,omitempty"` - // Display name of the metric. - DisplayName *string `json:"display_name,omitempty"` - // End of the time window, milliseconds since Unix epoch. - End *int64 `json:"end,omitempty"` - // Metric expression. - Expression *string `json:"expression,omitempty"` - // Number of seconds between data samples. - Interval *int64 `json:"interval,omitempty"` - // Number of data samples. - Length *int64 `json:"length,omitempty"` - // Metric name. - Metric *string `json:"metric,omitempty"` - // List of points of the time series. - Pointlist [][]*float64 `json:"pointlist,omitempty"` - // The index of the series' query within the request. - QueryIndex *int64 `json:"query_index,omitempty"` - // Metric scope, comma separated list of tags. - Scope *string `json:"scope,omitempty"` - // Start of the time window, milliseconds since Unix epoch. - Start *int64 `json:"start,omitempty"` - // Unique tags identifying this series. - TagSet []string `json:"tag_set,omitempty"` - // Detailed information about the metric unit. - // First element describes the "primary unit" (for example, `bytes` in `bytes per second`), - // second describes the "per unit" (for example, `second` in `bytes per second`). - Unit []MetricsQueryUnit `json:"unit,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{} -} - -// NewMetricsQueryMetadata instantiates a new MetricsQueryMetadata 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 NewMetricsQueryMetadata() *MetricsQueryMetadata { - this := MetricsQueryMetadata{} - return &this -} - -// NewMetricsQueryMetadataWithDefaults instantiates a new MetricsQueryMetadata 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 NewMetricsQueryMetadataWithDefaults() *MetricsQueryMetadata { - this := MetricsQueryMetadata{} - return &this -} - -// GetAggr returns the Aggr field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MetricsQueryMetadata) GetAggr() string { - if o == nil || o.Aggr.Get() == nil { - var ret string - return ret - } - return *o.Aggr.Get() -} - -// GetAggrOk returns a tuple with the Aggr 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 *MetricsQueryMetadata) GetAggrOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Aggr.Get(), o.Aggr.IsSet() -} - -// HasAggr returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasAggr() bool { - if o != nil && o.Aggr.IsSet() { - return true - } - - return false -} - -// SetAggr gets a reference to the given common.NullableString and assigns it to the Aggr field. -func (o *MetricsQueryMetadata) SetAggr(v string) { - o.Aggr.Set(&v) -} - -// SetAggrNil sets the value for Aggr to be an explicit nil. -func (o *MetricsQueryMetadata) SetAggrNil() { - o.Aggr.Set(nil) -} - -// UnsetAggr ensures that no value is present for Aggr, not even an explicit nil. -func (o *MetricsQueryMetadata) UnsetAggr() { - o.Aggr.Unset() -} - -// GetDisplayName returns the DisplayName field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetDisplayName() string { - if o == nil || o.DisplayName == nil { - var ret string - return ret - } - return *o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetDisplayNameOk() (*string, bool) { - if o == nil || o.DisplayName == nil { - return nil, false - } - return o.DisplayName, true -} - -// HasDisplayName returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasDisplayName() bool { - if o != nil && o.DisplayName != nil { - return true - } - - return false -} - -// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. -func (o *MetricsQueryMetadata) SetDisplayName(v string) { - o.DisplayName = &v -} - -// GetEnd returns the End field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetEnd() int64 { - if o == nil || o.End == nil { - var ret int64 - return ret - } - return *o.End -} - -// GetEndOk returns a tuple with the End field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetEndOk() (*int64, bool) { - if o == nil || o.End == nil { - return nil, false - } - return o.End, true -} - -// HasEnd returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasEnd() bool { - if o != nil && o.End != nil { - return true - } - - return false -} - -// SetEnd gets a reference to the given int64 and assigns it to the End field. -func (o *MetricsQueryMetadata) SetEnd(v int64) { - o.End = &v -} - -// GetExpression returns the Expression field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetExpression() string { - if o == nil || o.Expression == nil { - var ret string - return ret - } - return *o.Expression -} - -// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetExpressionOk() (*string, bool) { - if o == nil || o.Expression == nil { - return nil, false - } - return o.Expression, true -} - -// HasExpression returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasExpression() bool { - if o != nil && o.Expression != nil { - return true - } - - return false -} - -// SetExpression gets a reference to the given string and assigns it to the Expression field. -func (o *MetricsQueryMetadata) SetExpression(v string) { - o.Expression = &v -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetInterval() int64 { - if o == nil || o.Interval == nil { - var ret int64 - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetIntervalOk() (*int64, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given int64 and assigns it to the Interval field. -func (o *MetricsQueryMetadata) SetInterval(v int64) { - o.Interval = &v -} - -// GetLength returns the Length field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetLength() int64 { - if o == nil || o.Length == nil { - var ret int64 - return ret - } - return *o.Length -} - -// GetLengthOk returns a tuple with the Length field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetLengthOk() (*int64, bool) { - if o == nil || o.Length == nil { - return nil, false - } - return o.Length, true -} - -// HasLength returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasLength() bool { - if o != nil && o.Length != nil { - return true - } - - return false -} - -// SetLength gets a reference to the given int64 and assigns it to the Length field. -func (o *MetricsQueryMetadata) SetLength(v int64) { - o.Length = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *MetricsQueryMetadata) SetMetric(v string) { - o.Metric = &v -} - -// GetPointlist returns the Pointlist field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetPointlist() [][]*float64 { - if o == nil || o.Pointlist == nil { - var ret [][]*float64 - return ret - } - return o.Pointlist -} - -// GetPointlistOk returns a tuple with the Pointlist field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetPointlistOk() (*[][]*float64, bool) { - if o == nil || o.Pointlist == nil { - return nil, false - } - return &o.Pointlist, true -} - -// HasPointlist returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasPointlist() bool { - if o != nil && o.Pointlist != nil { - return true - } - - return false -} - -// SetPointlist gets a reference to the given [][]*float64 and assigns it to the Pointlist field. -func (o *MetricsQueryMetadata) SetPointlist(v [][]*float64) { - o.Pointlist = v -} - -// GetQueryIndex returns the QueryIndex field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetQueryIndex() int64 { - if o == nil || o.QueryIndex == nil { - var ret int64 - return ret - } - return *o.QueryIndex -} - -// GetQueryIndexOk returns a tuple with the QueryIndex field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetQueryIndexOk() (*int64, bool) { - if o == nil || o.QueryIndex == nil { - return nil, false - } - return o.QueryIndex, true -} - -// HasQueryIndex returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasQueryIndex() bool { - if o != nil && o.QueryIndex != nil { - return true - } - - return false -} - -// SetQueryIndex gets a reference to the given int64 and assigns it to the QueryIndex field. -func (o *MetricsQueryMetadata) SetQueryIndex(v int64) { - o.QueryIndex = &v -} - -// GetScope returns the Scope field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetScope() string { - if o == nil || o.Scope == nil { - var ret string - return ret - } - return *o.Scope -} - -// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetScopeOk() (*string, bool) { - if o == nil || o.Scope == nil { - return nil, false - } - return o.Scope, true -} - -// HasScope returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasScope() bool { - if o != nil && o.Scope != nil { - return true - } - - return false -} - -// SetScope gets a reference to the given string and assigns it to the Scope field. -func (o *MetricsQueryMetadata) SetScope(v string) { - o.Scope = &v -} - -// GetStart returns the Start field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetStart() int64 { - if o == nil || o.Start == nil { - var ret int64 - return ret - } - return *o.Start -} - -// GetStartOk returns a tuple with the Start field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetStartOk() (*int64, bool) { - if o == nil || o.Start == nil { - return nil, false - } - return o.Start, true -} - -// HasStart returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasStart() bool { - if o != nil && o.Start != nil { - return true - } - - return false -} - -// SetStart gets a reference to the given int64 and assigns it to the Start field. -func (o *MetricsQueryMetadata) SetStart(v int64) { - o.Start = &v -} - -// GetTagSet returns the TagSet field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetTagSet() []string { - if o == nil || o.TagSet == nil { - var ret []string - return ret - } - return o.TagSet -} - -// GetTagSetOk returns a tuple with the TagSet field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetTagSetOk() (*[]string, bool) { - if o == nil || o.TagSet == nil { - return nil, false - } - return &o.TagSet, true -} - -// HasTagSet returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasTagSet() bool { - if o != nil && o.TagSet != nil { - return true - } - - return false -} - -// SetTagSet gets a reference to the given []string and assigns it to the TagSet field. -func (o *MetricsQueryMetadata) SetTagSet(v []string) { - o.TagSet = v -} - -// GetUnit returns the Unit field value if set, zero value otherwise. -func (o *MetricsQueryMetadata) GetUnit() []MetricsQueryUnit { - if o == nil || o.Unit == nil { - var ret []MetricsQueryUnit - return ret - } - return o.Unit -} - -// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryMetadata) GetUnitOk() (*[]MetricsQueryUnit, bool) { - if o == nil || o.Unit == nil { - return nil, false - } - return &o.Unit, true -} - -// HasUnit returns a boolean if a field has been set. -func (o *MetricsQueryMetadata) HasUnit() bool { - if o != nil && o.Unit != nil { - return true - } - - return false -} - -// SetUnit gets a reference to the given []MetricsQueryUnit and assigns it to the Unit field. -func (o *MetricsQueryMetadata) SetUnit(v []MetricsQueryUnit) { - o.Unit = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricsQueryMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggr.IsSet() { - toSerialize["aggr"] = o.Aggr.Get() - } - if o.DisplayName != nil { - toSerialize["display_name"] = o.DisplayName - } - if o.End != nil { - toSerialize["end"] = o.End - } - if o.Expression != nil { - toSerialize["expression"] = o.Expression - } - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - if o.Length != nil { - toSerialize["length"] = o.Length - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Pointlist != nil { - toSerialize["pointlist"] = o.Pointlist - } - if o.QueryIndex != nil { - toSerialize["query_index"] = o.QueryIndex - } - if o.Scope != nil { - toSerialize["scope"] = o.Scope - } - if o.Start != nil { - toSerialize["start"] = o.Start - } - if o.TagSet != nil { - toSerialize["tag_set"] = o.TagSet - } - if o.Unit != nil { - toSerialize["unit"] = o.Unit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricsQueryMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggr common.NullableString `json:"aggr,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - End *int64 `json:"end,omitempty"` - Expression *string `json:"expression,omitempty"` - Interval *int64 `json:"interval,omitempty"` - Length *int64 `json:"length,omitempty"` - Metric *string `json:"metric,omitempty"` - Pointlist [][]*float64 `json:"pointlist,omitempty"` - QueryIndex *int64 `json:"query_index,omitempty"` - Scope *string `json:"scope,omitempty"` - Start *int64 `json:"start,omitempty"` - TagSet []string `json:"tag_set,omitempty"` - Unit []MetricsQueryUnit `json:"unit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggr = all.Aggr - o.DisplayName = all.DisplayName - o.End = all.End - o.Expression = all.Expression - o.Interval = all.Interval - o.Length = all.Length - o.Metric = all.Metric - o.Pointlist = all.Pointlist - o.QueryIndex = all.QueryIndex - o.Scope = all.Scope - o.Start = all.Start - o.TagSet = all.TagSet - o.Unit = all.Unit - return nil -} diff --git a/api/v1/datadog/model_metrics_query_response.go b/api/v1/datadog/model_metrics_query_response.go deleted file mode 100644 index 028b2405a0d..00000000000 --- a/api/v1/datadog/model_metrics_query_response.go +++ /dev/null @@ -1,414 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricsQueryResponse Response Object that includes your query and the list of metrics retrieved. -type MetricsQueryResponse struct { - // Message indicating the errors if status is not `ok`. - Error *string `json:"error,omitempty"` - // Start of requested time window, milliseconds since Unix epoch. - FromDate *int64 `json:"from_date,omitempty"` - // List of tag keys on which to group. - GroupBy []string `json:"group_by,omitempty"` - // Message indicating `success` if status is `ok`. - Message *string `json:"message,omitempty"` - // Query string - Query *string `json:"query,omitempty"` - // Type of response. - ResType *string `json:"res_type,omitempty"` - // List of timeseries queried. - Series []MetricsQueryMetadata `json:"series,omitempty"` - // Status of the query. - Status *string `json:"status,omitempty"` - // End of requested time window, milliseconds since Unix epoch. - ToDate *int64 `json:"to_date,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{} -} - -// NewMetricsQueryResponse instantiates a new MetricsQueryResponse 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 NewMetricsQueryResponse() *MetricsQueryResponse { - this := MetricsQueryResponse{} - return &this -} - -// NewMetricsQueryResponseWithDefaults instantiates a new MetricsQueryResponse 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 NewMetricsQueryResponseWithDefaults() *MetricsQueryResponse { - this := MetricsQueryResponse{} - return &this -} - -// GetError returns the Error field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetError() string { - if o == nil || o.Error == nil { - var ret string - return ret - } - return *o.Error -} - -// GetErrorOk returns a tuple with the Error field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetErrorOk() (*string, bool) { - if o == nil || o.Error == nil { - return nil, false - } - return o.Error, true -} - -// HasError returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasError() bool { - if o != nil && o.Error != nil { - return true - } - - return false -} - -// SetError gets a reference to the given string and assigns it to the Error field. -func (o *MetricsQueryResponse) SetError(v string) { - o.Error = &v -} - -// GetFromDate returns the FromDate field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetFromDate() int64 { - if o == nil || o.FromDate == nil { - var ret int64 - return ret - } - return *o.FromDate -} - -// GetFromDateOk returns a tuple with the FromDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetFromDateOk() (*int64, bool) { - if o == nil || o.FromDate == nil { - return nil, false - } - return o.FromDate, true -} - -// HasFromDate returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasFromDate() bool { - if o != nil && o.FromDate != nil { - return true - } - - return false -} - -// SetFromDate gets a reference to the given int64 and assigns it to the FromDate field. -func (o *MetricsQueryResponse) SetFromDate(v int64) { - o.FromDate = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetGroupBy() []string { - if o == nil || o.GroupBy == nil { - var ret []string - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetGroupByOk() (*[]string, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. -func (o *MetricsQueryResponse) SetGroupBy(v []string) { - o.GroupBy = v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *MetricsQueryResponse) SetMessage(v string) { - o.Message = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *MetricsQueryResponse) SetQuery(v string) { - o.Query = &v -} - -// GetResType returns the ResType field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetResType() string { - if o == nil || o.ResType == nil { - var ret string - return ret - } - return *o.ResType -} - -// GetResTypeOk returns a tuple with the ResType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetResTypeOk() (*string, bool) { - if o == nil || o.ResType == nil { - return nil, false - } - return o.ResType, true -} - -// HasResType returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasResType() bool { - if o != nil && o.ResType != nil { - return true - } - - return false -} - -// SetResType gets a reference to the given string and assigns it to the ResType field. -func (o *MetricsQueryResponse) SetResType(v string) { - o.ResType = &v -} - -// GetSeries returns the Series field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetSeries() []MetricsQueryMetadata { - if o == nil || o.Series == nil { - var ret []MetricsQueryMetadata - return ret - } - return o.Series -} - -// GetSeriesOk returns a tuple with the Series field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetSeriesOk() (*[]MetricsQueryMetadata, bool) { - if o == nil || o.Series == nil { - return nil, false - } - return &o.Series, true -} - -// HasSeries returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasSeries() bool { - if o != nil && o.Series != nil { - return true - } - - return false -} - -// SetSeries gets a reference to the given []MetricsQueryMetadata and assigns it to the Series field. -func (o *MetricsQueryResponse) SetSeries(v []MetricsQueryMetadata) { - o.Series = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *MetricsQueryResponse) SetStatus(v string) { - o.Status = &v -} - -// GetToDate returns the ToDate field value if set, zero value otherwise. -func (o *MetricsQueryResponse) GetToDate() int64 { - if o == nil || o.ToDate == nil { - var ret int64 - return ret - } - return *o.ToDate -} - -// GetToDateOk returns a tuple with the ToDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryResponse) GetToDateOk() (*int64, bool) { - if o == nil || o.ToDate == nil { - return nil, false - } - return o.ToDate, true -} - -// HasToDate returns a boolean if a field has been set. -func (o *MetricsQueryResponse) HasToDate() bool { - if o != nil && o.ToDate != nil { - return true - } - - return false -} - -// SetToDate gets a reference to the given int64 and assigns it to the ToDate field. -func (o *MetricsQueryResponse) SetToDate(v int64) { - o.ToDate = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricsQueryResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Error != nil { - toSerialize["error"] = o.Error - } - if o.FromDate != nil { - toSerialize["from_date"] = o.FromDate - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.ResType != nil { - toSerialize["res_type"] = o.ResType - } - if o.Series != nil { - toSerialize["series"] = o.Series - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.ToDate != nil { - toSerialize["to_date"] = o.ToDate - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricsQueryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Error *string `json:"error,omitempty"` - FromDate *int64 `json:"from_date,omitempty"` - GroupBy []string `json:"group_by,omitempty"` - Message *string `json:"message,omitempty"` - Query *string `json:"query,omitempty"` - ResType *string `json:"res_type,omitempty"` - Series []MetricsQueryMetadata `json:"series,omitempty"` - Status *string `json:"status,omitempty"` - ToDate *int64 `json:"to_date,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Error = all.Error - o.FromDate = all.FromDate - o.GroupBy = all.GroupBy - o.Message = all.Message - o.Query = all.Query - o.ResType = all.ResType - o.Series = all.Series - o.Status = all.Status - o.ToDate = all.ToDate - return nil -} diff --git a/api/v1/datadog/model_metrics_query_unit.go b/api/v1/datadog/model_metrics_query_unit.go deleted file mode 100644 index 40a50c04bef..00000000000 --- a/api/v1/datadog/model_metrics_query_unit.go +++ /dev/null @@ -1,308 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricsQueryUnit Object containing the metric unit family, scale factor, name, and short name. -type MetricsQueryUnit struct { - // Unit family, allows for conversion between units of the same family, for scaling. - Family *string `json:"family,omitempty"` - // Unit name - Name *string `json:"name,omitempty"` - // Plural form of the unit name. - Plural *string `json:"plural,omitempty"` - // Factor for scaling between units of the same family. - ScaleFactor *float64 `json:"scale_factor,omitempty"` - // Abbreviation of the unit. - ShortName *string `json:"short_name,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{} -} - -// NewMetricsQueryUnit instantiates a new MetricsQueryUnit 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 NewMetricsQueryUnit() *MetricsQueryUnit { - this := MetricsQueryUnit{} - return &this -} - -// NewMetricsQueryUnitWithDefaults instantiates a new MetricsQueryUnit 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 NewMetricsQueryUnitWithDefaults() *MetricsQueryUnit { - this := MetricsQueryUnit{} - return &this -} - -// GetFamily returns the Family field value if set, zero value otherwise. -func (o *MetricsQueryUnit) GetFamily() string { - if o == nil || o.Family == nil { - var ret string - return ret - } - return *o.Family -} - -// GetFamilyOk returns a tuple with the Family field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryUnit) GetFamilyOk() (*string, bool) { - if o == nil || o.Family == nil { - return nil, false - } - return o.Family, true -} - -// HasFamily returns a boolean if a field has been set. -func (o *MetricsQueryUnit) HasFamily() bool { - if o != nil && o.Family != nil { - return true - } - - return false -} - -// SetFamily gets a reference to the given string and assigns it to the Family field. -func (o *MetricsQueryUnit) SetFamily(v string) { - o.Family = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MetricsQueryUnit) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryUnit) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MetricsQueryUnit) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *MetricsQueryUnit) SetName(v string) { - o.Name = &v -} - -// GetPlural returns the Plural field value if set, zero value otherwise. -func (o *MetricsQueryUnit) GetPlural() string { - if o == nil || o.Plural == nil { - var ret string - return ret - } - return *o.Plural -} - -// GetPluralOk returns a tuple with the Plural field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryUnit) GetPluralOk() (*string, bool) { - if o == nil || o.Plural == nil { - return nil, false - } - return o.Plural, true -} - -// HasPlural returns a boolean if a field has been set. -func (o *MetricsQueryUnit) HasPlural() bool { - if o != nil && o.Plural != nil { - return true - } - - return false -} - -// SetPlural gets a reference to the given string and assigns it to the Plural field. -func (o *MetricsQueryUnit) SetPlural(v string) { - o.Plural = &v -} - -// GetScaleFactor returns the ScaleFactor field value if set, zero value otherwise. -func (o *MetricsQueryUnit) GetScaleFactor() float64 { - if o == nil || o.ScaleFactor == nil { - var ret float64 - return ret - } - return *o.ScaleFactor -} - -// GetScaleFactorOk returns a tuple with the ScaleFactor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryUnit) GetScaleFactorOk() (*float64, bool) { - if o == nil || o.ScaleFactor == nil { - return nil, false - } - return o.ScaleFactor, true -} - -// HasScaleFactor returns a boolean if a field has been set. -func (o *MetricsQueryUnit) HasScaleFactor() bool { - if o != nil && o.ScaleFactor != nil { - return true - } - - return false -} - -// SetScaleFactor gets a reference to the given float64 and assigns it to the ScaleFactor field. -func (o *MetricsQueryUnit) SetScaleFactor(v float64) { - o.ScaleFactor = &v -} - -// GetShortName returns the ShortName field value if set, zero value otherwise. -func (o *MetricsQueryUnit) GetShortName() string { - if o == nil || o.ShortName == nil { - var ret string - return ret - } - return *o.ShortName -} - -// GetShortNameOk returns a tuple with the ShortName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsQueryUnit) GetShortNameOk() (*string, bool) { - if o == nil || o.ShortName == nil { - return nil, false - } - return o.ShortName, true -} - -// HasShortName returns a boolean if a field has been set. -func (o *MetricsQueryUnit) HasShortName() bool { - if o != nil && o.ShortName != nil { - return true - } - - return false -} - -// SetShortName gets a reference to the given string and assigns it to the ShortName field. -func (o *MetricsQueryUnit) SetShortName(v string) { - o.ShortName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricsQueryUnit) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Family != nil { - toSerialize["family"] = o.Family - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Plural != nil { - toSerialize["plural"] = o.Plural - } - if o.ScaleFactor != nil { - toSerialize["scale_factor"] = o.ScaleFactor - } - if o.ShortName != nil { - toSerialize["short_name"] = o.ShortName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricsQueryUnit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Family *string `json:"family,omitempty"` - Name *string `json:"name,omitempty"` - Plural *string `json:"plural,omitempty"` - ScaleFactor *float64 `json:"scale_factor,omitempty"` - ShortName *string `json:"short_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Family = all.Family - o.Name = all.Name - o.Plural = all.Plural - o.ScaleFactor = all.ScaleFactor - o.ShortName = all.ShortName - return nil -} - -// NullableMetricsQueryUnit handles when a null is used for MetricsQueryUnit. -type NullableMetricsQueryUnit struct { - value *MetricsQueryUnit - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricsQueryUnit) Get() *MetricsQueryUnit { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricsQueryUnit) Set(val *MetricsQueryUnit) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricsQueryUnit) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMetricsQueryUnit) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricsQueryUnit initializes the struct as if Set has been called. -func NewNullableMetricsQueryUnit(val *MetricsQueryUnit) *NullableMetricsQueryUnit { - return &NullableMetricsQueryUnit{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricsQueryUnit) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricsQueryUnit) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor.go b/api/v1/datadog/model_monitor.go deleted file mode 100644 index f997b1d9521..00000000000 --- a/api/v1/datadog/model_monitor.go +++ /dev/null @@ -1,753 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// Monitor Object describing a monitor. -type Monitor struct { - // Timestamp of the monitor creation. - Created *time.Time `json:"created,omitempty"` - // Object describing the creator of the shared element. - Creator *Creator `json:"creator,omitempty"` - // Whether or not the monitor is deleted. (Always `null`) - Deleted common.NullableTime `json:"deleted,omitempty"` - // ID of this monitor. - Id *int64 `json:"id,omitempty"` - // A message to include with notifications for this monitor. - Message *string `json:"message,omitempty"` - // Last timestamp when the monitor was edited. - Modified *time.Time `json:"modified,omitempty"` - // Whether or not the monitor is broken down on different groups. - Multi *bool `json:"multi,omitempty"` - // The monitor name. - Name *string `json:"name,omitempty"` - // List of options associated with your monitor. - Options *MonitorOptions `json:"options,omitempty"` - // The different states your monitor can be in. - OverallState *MonitorOverallStates `json:"overall_state,omitempty"` - // Integer from 1 (high) to 5 (low) indicating alert severity. - Priority common.NullableInt64 `json:"priority,omitempty"` - // The monitor query. - Query string `json:"query"` - // A list of unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the [Roles API](https://docs.datadoghq.com/api/latest/roles/#list-roles) and are located in the `data.id` field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. `restricted_roles` is the successor of `locked`. For more information about `locked` and `restricted_roles`, see the [monitor options docs](https://docs.datadoghq.com/monitors/guide/monitor_api_options/#permissions-options). - RestrictedRoles []string `json:"restricted_roles,omitempty"` - // Wrapper object with the different monitor states. - State *MonitorState `json:"state,omitempty"` - // Tags associated to your monitor. - Tags []string `json:"tags,omitempty"` - // The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. - Type MonitorType `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{} -} - -// NewMonitor instantiates a new Monitor 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 NewMonitor(query string, typeVar MonitorType) *Monitor { - this := Monitor{} - this.Query = query - this.Type = typeVar - return &this -} - -// NewMonitorWithDefaults instantiates a new Monitor 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 NewMonitorWithDefaults() *Monitor { - this := Monitor{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *Monitor) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *Monitor) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *Monitor) SetCreated(v time.Time) { - o.Created = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *Monitor) GetCreator() Creator { - if o == nil || o.Creator == nil { - var ret Creator - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetCreatorOk() (*Creator, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *Monitor) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given Creator and assigns it to the Creator field. -func (o *Monitor) SetCreator(v Creator) { - o.Creator = &v -} - -// GetDeleted returns the Deleted field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Monitor) GetDeleted() time.Time { - if o == nil || o.Deleted.Get() == nil { - var ret time.Time - return ret - } - return *o.Deleted.Get() -} - -// GetDeletedOk returns a tuple with the Deleted 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 *Monitor) GetDeletedOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.Deleted.Get(), o.Deleted.IsSet() -} - -// HasDeleted returns a boolean if a field has been set. -func (o *Monitor) HasDeleted() bool { - if o != nil && o.Deleted.IsSet() { - return true - } - - return false -} - -// SetDeleted gets a reference to the given common.NullableTime and assigns it to the Deleted field. -func (o *Monitor) SetDeleted(v time.Time) { - o.Deleted.Set(&v) -} - -// SetDeletedNil sets the value for Deleted to be an explicit nil. -func (o *Monitor) SetDeletedNil() { - o.Deleted.Set(nil) -} - -// UnsetDeleted ensures that no value is present for Deleted, not even an explicit nil. -func (o *Monitor) UnsetDeleted() { - o.Deleted.Unset() -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Monitor) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Monitor) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *Monitor) SetId(v int64) { - o.Id = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *Monitor) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *Monitor) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *Monitor) SetMessage(v string) { - o.Message = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *Monitor) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *Monitor) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *Monitor) SetModified(v time.Time) { - o.Modified = &v -} - -// GetMulti returns the Multi field value if set, zero value otherwise. -func (o *Monitor) GetMulti() bool { - if o == nil || o.Multi == nil { - var ret bool - return ret - } - return *o.Multi -} - -// GetMultiOk returns a tuple with the Multi field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetMultiOk() (*bool, bool) { - if o == nil || o.Multi == nil { - return nil, false - } - return o.Multi, true -} - -// HasMulti returns a boolean if a field has been set. -func (o *Monitor) HasMulti() bool { - if o != nil && o.Multi != nil { - return true - } - - return false -} - -// SetMulti gets a reference to the given bool and assigns it to the Multi field. -func (o *Monitor) SetMulti(v bool) { - o.Multi = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *Monitor) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *Monitor) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *Monitor) SetName(v string) { - o.Name = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *Monitor) GetOptions() MonitorOptions { - if o == nil || o.Options == nil { - var ret MonitorOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetOptionsOk() (*MonitorOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *Monitor) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given MonitorOptions and assigns it to the Options field. -func (o *Monitor) SetOptions(v MonitorOptions) { - o.Options = &v -} - -// GetOverallState returns the OverallState field value if set, zero value otherwise. -func (o *Monitor) GetOverallState() MonitorOverallStates { - if o == nil || o.OverallState == nil { - var ret MonitorOverallStates - return ret - } - return *o.OverallState -} - -// GetOverallStateOk returns a tuple with the OverallState field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetOverallStateOk() (*MonitorOverallStates, bool) { - if o == nil || o.OverallState == nil { - return nil, false - } - return o.OverallState, true -} - -// HasOverallState returns a boolean if a field has been set. -func (o *Monitor) HasOverallState() bool { - if o != nil && o.OverallState != nil { - return true - } - - return false -} - -// SetOverallState gets a reference to the given MonitorOverallStates and assigns it to the OverallState field. -func (o *Monitor) SetOverallState(v MonitorOverallStates) { - o.OverallState = &v -} - -// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Monitor) GetPriority() int64 { - if o == nil || o.Priority.Get() == nil { - var ret int64 - return ret - } - return *o.Priority.Get() -} - -// GetPriorityOk returns a tuple with the Priority 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 *Monitor) GetPriorityOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Priority.Get(), o.Priority.IsSet() -} - -// HasPriority returns a boolean if a field has been set. -func (o *Monitor) HasPriority() bool { - if o != nil && o.Priority.IsSet() { - return true - } - - return false -} - -// SetPriority gets a reference to the given common.NullableInt64 and assigns it to the Priority field. -func (o *Monitor) SetPriority(v int64) { - o.Priority.Set(&v) -} - -// SetPriorityNil sets the value for Priority to be an explicit nil. -func (o *Monitor) SetPriorityNil() { - o.Priority.Set(nil) -} - -// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. -func (o *Monitor) UnsetPriority() { - o.Priority.Unset() -} - -// GetQuery returns the Query field value. -func (o *Monitor) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *Monitor) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *Monitor) SetQuery(v string) { - o.Query = v -} - -// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Monitor) GetRestrictedRoles() []string { - if o == nil { - var ret []string - return ret - } - return o.RestrictedRoles -} - -// GetRestrictedRolesOk returns a tuple with the RestrictedRoles 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 *Monitor) GetRestrictedRolesOk() (*[]string, bool) { - if o == nil || o.RestrictedRoles == nil { - return nil, false - } - return &o.RestrictedRoles, true -} - -// HasRestrictedRoles returns a boolean if a field has been set. -func (o *Monitor) HasRestrictedRoles() bool { - if o != nil && o.RestrictedRoles != nil { - return true - } - - return false -} - -// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. -func (o *Monitor) SetRestrictedRoles(v []string) { - o.RestrictedRoles = v -} - -// GetState returns the State field value if set, zero value otherwise. -func (o *Monitor) GetState() MonitorState { - if o == nil || o.State == nil { - var ret MonitorState - return ret - } - return *o.State -} - -// GetStateOk returns a tuple with the State field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Monitor) GetStateOk() (*MonitorState, bool) { - if o == nil || o.State == nil { - return nil, false - } - return o.State, true -} - -// HasState returns a boolean if a field has been set. -func (o *Monitor) HasState() bool { - if o != nil && o.State != nil { - return true - } - - return false -} - -// SetState gets a reference to the given MonitorState and assigns it to the State field. -func (o *Monitor) SetState(v MonitorState) { - o.State = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *Monitor) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *Monitor) GetTagsOk() (*[]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 *Monitor) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *Monitor) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value. -func (o *Monitor) GetType() MonitorType { - if o == nil { - var ret MonitorType - 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 *Monitor) GetTypeOk() (*MonitorType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *Monitor) SetType(v MonitorType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Monitor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.Deleted.IsSet() { - toSerialize["deleted"] = o.Deleted.Get() - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Multi != nil { - toSerialize["multi"] = o.Multi - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.OverallState != nil { - toSerialize["overall_state"] = o.OverallState - } - if o.Priority.IsSet() { - toSerialize["priority"] = o.Priority.Get() - } - toSerialize["query"] = o.Query - if o.RestrictedRoles != nil { - toSerialize["restricted_roles"] = o.RestrictedRoles - } - if o.State != nil { - toSerialize["state"] = o.State - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *MonitorType `json:"type"` - }{} - all := struct { - Created *time.Time `json:"created,omitempty"` - Creator *Creator `json:"creator,omitempty"` - Deleted common.NullableTime `json:"deleted,omitempty"` - Id *int64 `json:"id,omitempty"` - Message *string `json:"message,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Multi *bool `json:"multi,omitempty"` - Name *string `json:"name,omitempty"` - Options *MonitorOptions `json:"options,omitempty"` - OverallState *MonitorOverallStates `json:"overall_state,omitempty"` - Priority common.NullableInt64 `json:"priority,omitempty"` - Query string `json:"query"` - RestrictedRoles []string `json:"restricted_roles,omitempty"` - State *MonitorState `json:"state,omitempty"` - Tags []string `json:"tags,omitempty"` - Type MonitorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.OverallState; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Created = all.Created - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.Deleted = all.Deleted - o.Id = all.Id - o.Message = all.Message - o.Modified = all.Modified - o.Multi = all.Multi - o.Name = all.Name - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.OverallState = all.OverallState - o.Priority = all.Priority - o.Query = all.Query - o.RestrictedRoles = all.RestrictedRoles - if all.State != nil && all.State.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.State = all.State - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_monitor_device_id.go b/api/v1/datadog/model_monitor_device_id.go deleted file mode 100644 index 98eab25df61..00000000000 --- a/api/v1/datadog/model_monitor_device_id.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorDeviceID ID of the device the Synthetics monitor is running on. Same as `SyntheticsDeviceID`. -type MonitorDeviceID string - -// List of MonitorDeviceID. -const ( - MONITORDEVICEID_LAPTOP_LARGE MonitorDeviceID = "laptop_large" - MONITORDEVICEID_TABLET MonitorDeviceID = "tablet" - MONITORDEVICEID_MOBILE_SMALL MonitorDeviceID = "mobile_small" - MONITORDEVICEID_CHROME_LAPTOP_LARGE MonitorDeviceID = "chrome.laptop_large" - MONITORDEVICEID_CHROME_TABLET MonitorDeviceID = "chrome.tablet" - MONITORDEVICEID_CHROME_MOBILE_SMALL MonitorDeviceID = "chrome.mobile_small" - MONITORDEVICEID_FIREFOX_LAPTOP_LARGE MonitorDeviceID = "firefox.laptop_large" - MONITORDEVICEID_FIREFOX_TABLET MonitorDeviceID = "firefox.tablet" - MONITORDEVICEID_FIREFOX_MOBILE_SMALL MonitorDeviceID = "firefox.mobile_small" -) - -var allowedMonitorDeviceIDEnumValues = []MonitorDeviceID{ - MONITORDEVICEID_LAPTOP_LARGE, - MONITORDEVICEID_TABLET, - MONITORDEVICEID_MOBILE_SMALL, - MONITORDEVICEID_CHROME_LAPTOP_LARGE, - MONITORDEVICEID_CHROME_TABLET, - MONITORDEVICEID_CHROME_MOBILE_SMALL, - MONITORDEVICEID_FIREFOX_LAPTOP_LARGE, - MONITORDEVICEID_FIREFOX_TABLET, - MONITORDEVICEID_FIREFOX_MOBILE_SMALL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonitorDeviceID) GetAllowedValues() []MonitorDeviceID { - return allowedMonitorDeviceIDEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonitorDeviceID) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonitorDeviceID(value) - return nil -} - -// NewMonitorDeviceIDFromValue returns a pointer to a valid MonitorDeviceID -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonitorDeviceIDFromValue(v string) (*MonitorDeviceID, error) { - ev := MonitorDeviceID(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonitorDeviceID: valid values are %v", v, allowedMonitorDeviceIDEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonitorDeviceID) IsValid() bool { - for _, existing := range allowedMonitorDeviceIDEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonitorDeviceID value. -func (v MonitorDeviceID) Ptr() *MonitorDeviceID { - return &v -} - -// NullableMonitorDeviceID handles when a null is used for MonitorDeviceID. -type NullableMonitorDeviceID struct { - value *MonitorDeviceID - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorDeviceID) Get() *MonitorDeviceID { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorDeviceID) Set(val *MonitorDeviceID) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorDeviceID) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorDeviceID) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorDeviceID initializes the struct as if Set has been called. -func NewNullableMonitorDeviceID(val *MonitorDeviceID) *NullableMonitorDeviceID { - return &NullableMonitorDeviceID{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorDeviceID) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorDeviceID) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go b/api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go deleted file mode 100644 index 230c8e3f186..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go +++ /dev/null @@ -1,129 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorFormulaAndFunctionEventAggregation Aggregation methods for event platform queries. -type MonitorFormulaAndFunctionEventAggregation string - -// List of MonitorFormulaAndFunctionEventAggregation. -const ( - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_COUNT MonitorFormulaAndFunctionEventAggregation = "count" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY MonitorFormulaAndFunctionEventAggregation = "cardinality" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN MonitorFormulaAndFunctionEventAggregation = "median" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC75 MonitorFormulaAndFunctionEventAggregation = "pc75" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC90 MonitorFormulaAndFunctionEventAggregation = "pc90" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC95 MonitorFormulaAndFunctionEventAggregation = "pc95" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC98 MonitorFormulaAndFunctionEventAggregation = "pc98" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC99 MonitorFormulaAndFunctionEventAggregation = "pc99" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_SUM MonitorFormulaAndFunctionEventAggregation = "sum" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MIN MonitorFormulaAndFunctionEventAggregation = "min" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MAX MonitorFormulaAndFunctionEventAggregation = "max" - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_AVG MonitorFormulaAndFunctionEventAggregation = "avg" -) - -var allowedMonitorFormulaAndFunctionEventAggregationEnumValues = []MonitorFormulaAndFunctionEventAggregation{ - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_COUNT, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC75, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC90, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC95, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC98, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC99, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_SUM, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MIN, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MAX, - MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_AVG, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonitorFormulaAndFunctionEventAggregation) GetAllowedValues() []MonitorFormulaAndFunctionEventAggregation { - return allowedMonitorFormulaAndFunctionEventAggregationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonitorFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonitorFormulaAndFunctionEventAggregation(value) - return nil -} - -// NewMonitorFormulaAndFunctionEventAggregationFromValue returns a pointer to a valid MonitorFormulaAndFunctionEventAggregation -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonitorFormulaAndFunctionEventAggregationFromValue(v string) (*MonitorFormulaAndFunctionEventAggregation, error) { - ev := MonitorFormulaAndFunctionEventAggregation(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonitorFormulaAndFunctionEventAggregation: valid values are %v", v, allowedMonitorFormulaAndFunctionEventAggregationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonitorFormulaAndFunctionEventAggregation) IsValid() bool { - for _, existing := range allowedMonitorFormulaAndFunctionEventAggregationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonitorFormulaAndFunctionEventAggregation value. -func (v MonitorFormulaAndFunctionEventAggregation) Ptr() *MonitorFormulaAndFunctionEventAggregation { - return &v -} - -// NullableMonitorFormulaAndFunctionEventAggregation handles when a null is used for MonitorFormulaAndFunctionEventAggregation. -type NullableMonitorFormulaAndFunctionEventAggregation struct { - value *MonitorFormulaAndFunctionEventAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorFormulaAndFunctionEventAggregation) Get() *MonitorFormulaAndFunctionEventAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorFormulaAndFunctionEventAggregation) Set(val *MonitorFormulaAndFunctionEventAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorFormulaAndFunctionEventAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorFormulaAndFunctionEventAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorFormulaAndFunctionEventAggregation initializes the struct as if Set has been called. -func NewNullableMonitorFormulaAndFunctionEventAggregation(val *MonitorFormulaAndFunctionEventAggregation) *NullableMonitorFormulaAndFunctionEventAggregation { - return &NullableMonitorFormulaAndFunctionEventAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorFormulaAndFunctionEventAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go deleted file mode 100644 index d9071036b9a..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go +++ /dev/null @@ -1,308 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorFormulaAndFunctionEventQueryDefinition A formula and functions events query. -type MonitorFormulaAndFunctionEventQueryDefinition struct { - // Compute options. - Compute MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - // Data source for event platform-based queries. - DataSource MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` - // Group by options. - GroupBy []MonitorFormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` - // An array of index names to query in the stream. Omit or use `[]` to query all indexes at once. - Indexes []string `json:"indexes,omitempty"` - // Name of the query for use in formulas. - Name string `json:"name"` - // Search options. - Search *MonitorFormulaAndFunctionEventQueryDefinitionSearch `json:"search,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{} -} - -// NewMonitorFormulaAndFunctionEventQueryDefinition instantiates a new MonitorFormulaAndFunctionEventQueryDefinition 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 NewMonitorFormulaAndFunctionEventQueryDefinition(compute MonitorFormulaAndFunctionEventQueryDefinitionCompute, dataSource MonitorFormulaAndFunctionEventsDataSource, name string) *MonitorFormulaAndFunctionEventQueryDefinition { - this := MonitorFormulaAndFunctionEventQueryDefinition{} - this.Compute = compute - this.DataSource = dataSource - this.Name = name - return &this -} - -// NewMonitorFormulaAndFunctionEventQueryDefinitionWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryDefinition 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 NewMonitorFormulaAndFunctionEventQueryDefinitionWithDefaults() *MonitorFormulaAndFunctionEventQueryDefinition { - this := MonitorFormulaAndFunctionEventQueryDefinition{} - return &this -} - -// GetCompute returns the Compute field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetCompute() MonitorFormulaAndFunctionEventQueryDefinitionCompute { - if o == nil { - var ret MonitorFormulaAndFunctionEventQueryDefinitionCompute - return ret - } - return o.Compute -} - -// GetComputeOk returns a tuple with the Compute field value -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetComputeOk() (*MonitorFormulaAndFunctionEventQueryDefinitionCompute, bool) { - if o == nil { - return nil, false - } - return &o.Compute, true -} - -// SetCompute sets field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetCompute(v MonitorFormulaAndFunctionEventQueryDefinitionCompute) { - o.Compute = v -} - -// GetDataSource returns the DataSource field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetDataSource() MonitorFormulaAndFunctionEventsDataSource { - if o == nil { - var ret MonitorFormulaAndFunctionEventsDataSource - return ret - } - return o.DataSource -} - -// GetDataSourceOk returns a tuple with the DataSource field value -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetDataSourceOk() (*MonitorFormulaAndFunctionEventsDataSource, bool) { - if o == nil { - return nil, false - } - return &o.DataSource, true -} - -// SetDataSource sets field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetDataSource(v MonitorFormulaAndFunctionEventsDataSource) { - o.DataSource = v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetGroupBy() []MonitorFormulaAndFunctionEventQueryGroupBy { - if o == nil || o.GroupBy == nil { - var ret []MonitorFormulaAndFunctionEventQueryGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetGroupByOk() (*[]MonitorFormulaAndFunctionEventQueryGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []MonitorFormulaAndFunctionEventQueryGroupBy and assigns it to the GroupBy field. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetGroupBy(v []MonitorFormulaAndFunctionEventQueryGroupBy) { - o.GroupBy = v -} - -// GetIndexes returns the Indexes field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetIndexes() []string { - if o == nil || o.Indexes == nil { - var ret []string - return ret - } - return o.Indexes -} - -// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetIndexesOk() (*[]string, bool) { - if o == nil || o.Indexes == nil { - return nil, false - } - return &o.Indexes, true -} - -// HasIndexes returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) HasIndexes() bool { - if o != nil && o.Indexes != nil { - return true - } - - return false -} - -// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetIndexes(v []string) { - o.Indexes = v -} - -// GetName returns the Name field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetName(v string) { - o.Name = v -} - -// GetSearch returns the Search field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetSearch() MonitorFormulaAndFunctionEventQueryDefinitionSearch { - if o == nil || o.Search == nil { - var ret MonitorFormulaAndFunctionEventQueryDefinitionSearch - return ret - } - return *o.Search -} - -// GetSearchOk returns a tuple with the Search field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetSearchOk() (*MonitorFormulaAndFunctionEventQueryDefinitionSearch, bool) { - if o == nil || o.Search == nil { - return nil, false - } - return o.Search, true -} - -// HasSearch returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) HasSearch() bool { - if o != nil && o.Search != nil { - return true - } - - return false -} - -// SetSearch gets a reference to the given MonitorFormulaAndFunctionEventQueryDefinitionSearch and assigns it to the Search field. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetSearch(v MonitorFormulaAndFunctionEventQueryDefinitionSearch) { - o.Search = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorFormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["compute"] = o.Compute - toSerialize["data_source"] = o.DataSource - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Indexes != nil { - toSerialize["indexes"] = o.Indexes - } - toSerialize["name"] = o.Name - if o.Search != nil { - toSerialize["search"] = o.Search - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Compute *MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - DataSource *MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` - Name *string `json:"name"` - }{} - all := struct { - Compute MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - DataSource MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` - GroupBy []MonitorFormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Name string `json:"name"` - Search *MonitorFormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("Required field compute missing") - } - if required.DataSource == nil { - return fmt.Errorf("Required field data_source missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DataSource; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Compute = all.Compute - o.DataSource = all.DataSource - o.GroupBy = all.GroupBy - o.Indexes = all.Indexes - o.Name = all.Name - if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Search = all.Search - return nil -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go deleted file mode 100644 index 1767e165213..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorFormulaAndFunctionEventQueryDefinitionCompute Compute options. -type MonitorFormulaAndFunctionEventQueryDefinitionCompute struct { - // Aggregation methods for event platform queries. - Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - // A time interval in milliseconds. - Interval *int64 `json:"interval,omitempty"` - // Measurable attribute to compute. - Metric *string `json:"metric,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{} -} - -// NewMonitorFormulaAndFunctionEventQueryDefinitionCompute instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionCompute 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 NewMonitorFormulaAndFunctionEventQueryDefinitionCompute(aggregation MonitorFormulaAndFunctionEventAggregation) *MonitorFormulaAndFunctionEventQueryDefinitionCompute { - this := MonitorFormulaAndFunctionEventQueryDefinitionCompute{} - this.Aggregation = aggregation - return &this -} - -// NewMonitorFormulaAndFunctionEventQueryDefinitionComputeWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionCompute 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 NewMonitorFormulaAndFunctionEventQueryDefinitionComputeWithDefaults() *MonitorFormulaAndFunctionEventQueryDefinitionCompute { - this := MonitorFormulaAndFunctionEventQueryDefinitionCompute{} - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetAggregation() MonitorFormulaAndFunctionEventAggregation { - if o == nil { - var ret MonitorFormulaAndFunctionEventAggregation - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetAggregationOk() (*MonitorFormulaAndFunctionEventAggregation, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) SetAggregation(v MonitorFormulaAndFunctionEventAggregation) { - o.Aggregation = v -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetInterval() int64 { - if o == nil || o.Interval == nil { - var ret int64 - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetIntervalOk() (*int64, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given int64 and assigns it to the Interval field. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) SetInterval(v int64) { - o.Interval = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) SetMetric(v string) { - o.Metric = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorFormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - }{} - all := struct { - Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - Interval *int64 `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Interval = all.Interval - o.Metric = all.Metric - return nil -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go deleted file mode 100644 index 58de556db15..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorFormulaAndFunctionEventQueryDefinitionSearch Search options. -type MonitorFormulaAndFunctionEventQueryDefinitionSearch struct { - // Events search string. - Query string `json:"query"` - // 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{} -} - -// NewMonitorFormulaAndFunctionEventQueryDefinitionSearch instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionSearch 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 NewMonitorFormulaAndFunctionEventQueryDefinitionSearch(query string) *MonitorFormulaAndFunctionEventQueryDefinitionSearch { - this := MonitorFormulaAndFunctionEventQueryDefinitionSearch{} - this.Query = query - return &this -} - -// NewMonitorFormulaAndFunctionEventQueryDefinitionSearchWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionSearch 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 NewMonitorFormulaAndFunctionEventQueryDefinitionSearchWithDefaults() *MonitorFormulaAndFunctionEventQueryDefinitionSearch { - this := MonitorFormulaAndFunctionEventQueryDefinitionSearch{} - return &this -} - -// GetQuery returns the Query field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) SetQuery(v string) { - o.Query = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorFormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["query"] = o.Query - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} - all := struct { - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - return nil -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go deleted file mode 100644 index 05a7b6877df..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorFormulaAndFunctionEventQueryGroupBy List of objects used to group by. -type MonitorFormulaAndFunctionEventQueryGroupBy struct { - // Event facet. - Facet string `json:"facet"` - // Number of groups to return. - Limit *int64 `json:"limit,omitempty"` - // Options for sorting group by results. - Sort *MonitorFormulaAndFunctionEventQueryGroupBySort `json:"sort,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{} -} - -// NewMonitorFormulaAndFunctionEventQueryGroupBy instantiates a new MonitorFormulaAndFunctionEventQueryGroupBy 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 NewMonitorFormulaAndFunctionEventQueryGroupBy(facet string) *MonitorFormulaAndFunctionEventQueryGroupBy { - this := MonitorFormulaAndFunctionEventQueryGroupBy{} - this.Facet = facet - return &this -} - -// NewMonitorFormulaAndFunctionEventQueryGroupByWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryGroupBy 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 NewMonitorFormulaAndFunctionEventQueryGroupByWithDefaults() *MonitorFormulaAndFunctionEventQueryGroupBy { - this := MonitorFormulaAndFunctionEventQueryGroupBy{} - return &this -} - -// GetFacet returns the Facet field value. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetFacet() string { - if o == nil { - var ret string - return ret - } - return o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetFacetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Facet, true -} - -// SetFacet sets field value. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) SetFacet(v string) { - o.Facet = v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) SetLimit(v int64) { - o.Limit = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetSort() MonitorFormulaAndFunctionEventQueryGroupBySort { - if o == nil || o.Sort == nil { - var ret MonitorFormulaAndFunctionEventQueryGroupBySort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetSortOk() (*MonitorFormulaAndFunctionEventQueryGroupBySort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given MonitorFormulaAndFunctionEventQueryGroupBySort and assigns it to the Sort field. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) SetSort(v MonitorFormulaAndFunctionEventQueryGroupBySort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorFormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["facet"] = o.Facet - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorFormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} - all := struct { - Facet string `json:"facet"` - Limit *int64 `json:"limit,omitempty"` - Sort *MonitorFormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("Required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Facet = all.Facet - o.Limit = all.Limit - if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Sort = all.Sort - return nil -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go deleted file mode 100644 index 9f911df39e1..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorFormulaAndFunctionEventQueryGroupBySort Options for sorting group by results. -type MonitorFormulaAndFunctionEventQueryGroupBySort struct { - // Aggregation methods for event platform queries. - Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - // Metric used for sorting group by results. - Metric *string `json:"metric,omitempty"` - // Direction of sort. - Order *QuerySortOrder `json:"order,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{} -} - -// NewMonitorFormulaAndFunctionEventQueryGroupBySort instantiates a new MonitorFormulaAndFunctionEventQueryGroupBySort 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 NewMonitorFormulaAndFunctionEventQueryGroupBySort(aggregation MonitorFormulaAndFunctionEventAggregation) *MonitorFormulaAndFunctionEventQueryGroupBySort { - this := MonitorFormulaAndFunctionEventQueryGroupBySort{} - this.Aggregation = aggregation - var order QuerySortOrder = QUERYSORTORDER_DESC - this.Order = &order - return &this -} - -// NewMonitorFormulaAndFunctionEventQueryGroupBySortWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryGroupBySort 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 NewMonitorFormulaAndFunctionEventQueryGroupBySortWithDefaults() *MonitorFormulaAndFunctionEventQueryGroupBySort { - this := MonitorFormulaAndFunctionEventQueryGroupBySort{} - var order QuerySortOrder = QUERYSORTORDER_DESC - this.Order = &order - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetAggregation() MonitorFormulaAndFunctionEventAggregation { - if o == nil { - var ret MonitorFormulaAndFunctionEventAggregation - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetAggregationOk() (*MonitorFormulaAndFunctionEventAggregation, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) SetAggregation(v MonitorFormulaAndFunctionEventAggregation) { - o.Aggregation = v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) SetMetric(v string) { - o.Metric = &v -} - -// GetOrder returns the Order field value if set, zero value otherwise. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetOrder() QuerySortOrder { - if o == nil || o.Order == nil { - var ret QuerySortOrder - return ret - } - return *o.Order -} - -// GetOrderOk returns a tuple with the Order field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetOrderOk() (*QuerySortOrder, bool) { - if o == nil || o.Order == nil { - return nil, false - } - return o.Order, true -} - -// HasOrder returns a boolean if a field has been set. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) HasOrder() bool { - if o != nil && o.Order != nil { - return true - } - - return false -} - -// SetOrder gets a reference to the given QuerySortOrder and assigns it to the Order field. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) SetOrder(v QuerySortOrder) { - o.Order = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorFormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Order != nil { - toSerialize["order"] = o.Order - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - }{} - all := struct { - Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - Metric *string `json:"metric,omitempty"` - Order *QuerySortOrder `json:"order,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Metric = all.Metric - o.Order = all.Order - return nil -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_events_data_source.go b/api/v1/datadog/model_monitor_formula_and_function_events_data_source.go deleted file mode 100644 index 14138579c75..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_events_data_source.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorFormulaAndFunctionEventsDataSource Data source for event platform-based queries. -type MonitorFormulaAndFunctionEventsDataSource string - -// List of MonitorFormulaAndFunctionEventsDataSource. -const ( - MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_RUM MonitorFormulaAndFunctionEventsDataSource = "rum" - MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_PIPELINES MonitorFormulaAndFunctionEventsDataSource = "ci_pipelines" - MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_TESTS MonitorFormulaAndFunctionEventsDataSource = "ci_tests" -) - -var allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues = []MonitorFormulaAndFunctionEventsDataSource{ - MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_RUM, - MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_PIPELINES, - MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_TESTS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonitorFormulaAndFunctionEventsDataSource) GetAllowedValues() []MonitorFormulaAndFunctionEventsDataSource { - return allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonitorFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonitorFormulaAndFunctionEventsDataSource(value) - return nil -} - -// NewMonitorFormulaAndFunctionEventsDataSourceFromValue returns a pointer to a valid MonitorFormulaAndFunctionEventsDataSource -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonitorFormulaAndFunctionEventsDataSourceFromValue(v string) (*MonitorFormulaAndFunctionEventsDataSource, error) { - ev := MonitorFormulaAndFunctionEventsDataSource(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonitorFormulaAndFunctionEventsDataSource: valid values are %v", v, allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonitorFormulaAndFunctionEventsDataSource) IsValid() bool { - for _, existing := range allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonitorFormulaAndFunctionEventsDataSource value. -func (v MonitorFormulaAndFunctionEventsDataSource) Ptr() *MonitorFormulaAndFunctionEventsDataSource { - return &v -} - -// NullableMonitorFormulaAndFunctionEventsDataSource handles when a null is used for MonitorFormulaAndFunctionEventsDataSource. -type NullableMonitorFormulaAndFunctionEventsDataSource struct { - value *MonitorFormulaAndFunctionEventsDataSource - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorFormulaAndFunctionEventsDataSource) Get() *MonitorFormulaAndFunctionEventsDataSource { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorFormulaAndFunctionEventsDataSource) Set(val *MonitorFormulaAndFunctionEventsDataSource) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorFormulaAndFunctionEventsDataSource) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorFormulaAndFunctionEventsDataSource) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorFormulaAndFunctionEventsDataSource initializes the struct as if Set has been called. -func NewNullableMonitorFormulaAndFunctionEventsDataSource(val *MonitorFormulaAndFunctionEventsDataSource) *NullableMonitorFormulaAndFunctionEventsDataSource { - return &NullableMonitorFormulaAndFunctionEventsDataSource{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorFormulaAndFunctionEventsDataSource) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_formula_and_function_query_definition.go b/api/v1/datadog/model_monitor_formula_and_function_query_definition.go deleted file mode 100644 index eb16faddbdd..00000000000 --- a/api/v1/datadog/model_monitor_formula_and_function_query_definition.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorFormulaAndFunctionQueryDefinition - A formula and function query. -type MonitorFormulaAndFunctionQueryDefinition struct { - MonitorFormulaAndFunctionEventQueryDefinition *MonitorFormulaAndFunctionEventQueryDefinition - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// MonitorFormulaAndFunctionEventQueryDefinitionAsMonitorFormulaAndFunctionQueryDefinition is a convenience function that returns MonitorFormulaAndFunctionEventQueryDefinition wrapped in MonitorFormulaAndFunctionQueryDefinition. -func MonitorFormulaAndFunctionEventQueryDefinitionAsMonitorFormulaAndFunctionQueryDefinition(v *MonitorFormulaAndFunctionEventQueryDefinition) MonitorFormulaAndFunctionQueryDefinition { - return MonitorFormulaAndFunctionQueryDefinition{MonitorFormulaAndFunctionEventQueryDefinition: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *MonitorFormulaAndFunctionQueryDefinition) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into MonitorFormulaAndFunctionEventQueryDefinition - err = json.Unmarshal(data, &obj.MonitorFormulaAndFunctionEventQueryDefinition) - if err == nil { - if obj.MonitorFormulaAndFunctionEventQueryDefinition != nil && obj.MonitorFormulaAndFunctionEventQueryDefinition.UnparsedObject == nil { - jsonMonitorFormulaAndFunctionEventQueryDefinition, _ := json.Marshal(obj.MonitorFormulaAndFunctionEventQueryDefinition) - if string(jsonMonitorFormulaAndFunctionEventQueryDefinition) == "{}" { // empty struct - obj.MonitorFormulaAndFunctionEventQueryDefinition = nil - } else { - match++ - } - } else { - obj.MonitorFormulaAndFunctionEventQueryDefinition = nil - } - } else { - obj.MonitorFormulaAndFunctionEventQueryDefinition = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.MonitorFormulaAndFunctionEventQueryDefinition = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj MonitorFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { - if obj.MonitorFormulaAndFunctionEventQueryDefinition != nil { - return json.Marshal(&obj.MonitorFormulaAndFunctionEventQueryDefinition) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *MonitorFormulaAndFunctionQueryDefinition) GetActualInstance() interface{} { - if obj.MonitorFormulaAndFunctionEventQueryDefinition != nil { - return obj.MonitorFormulaAndFunctionEventQueryDefinition - } - - // all schemas are nil - return nil -} - -// NullableMonitorFormulaAndFunctionQueryDefinition handles when a null is used for MonitorFormulaAndFunctionQueryDefinition. -type NullableMonitorFormulaAndFunctionQueryDefinition struct { - value *MonitorFormulaAndFunctionQueryDefinition - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorFormulaAndFunctionQueryDefinition) Get() *MonitorFormulaAndFunctionQueryDefinition { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorFormulaAndFunctionQueryDefinition) Set(val *MonitorFormulaAndFunctionQueryDefinition) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorFormulaAndFunctionQueryDefinition) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMonitorFormulaAndFunctionQueryDefinition) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorFormulaAndFunctionQueryDefinition initializes the struct as if Set has been called. -func NewNullableMonitorFormulaAndFunctionQueryDefinition(val *MonitorFormulaAndFunctionQueryDefinition) *NullableMonitorFormulaAndFunctionQueryDefinition { - return &NullableMonitorFormulaAndFunctionQueryDefinition{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorFormulaAndFunctionQueryDefinition) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_group_search_response.go b/api/v1/datadog/model_monitor_group_search_response.go deleted file mode 100644 index 16373963d6f..00000000000 --- a/api/v1/datadog/model_monitor_group_search_response.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorGroupSearchResponse The response of a monitor group search. -type MonitorGroupSearchResponse struct { - // The counts of monitor groups per different criteria. - Counts *MonitorGroupSearchResponseCounts `json:"counts,omitempty"` - // The list of found monitor groups. - Groups []MonitorGroupSearchResult `json:"groups,omitempty"` - // Metadata about the response. - Metadata *MonitorSearchResponseMetadata `json:"metadata,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{} -} - -// NewMonitorGroupSearchResponse instantiates a new MonitorGroupSearchResponse 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 NewMonitorGroupSearchResponse() *MonitorGroupSearchResponse { - this := MonitorGroupSearchResponse{} - return &this -} - -// NewMonitorGroupSearchResponseWithDefaults instantiates a new MonitorGroupSearchResponse 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 NewMonitorGroupSearchResponseWithDefaults() *MonitorGroupSearchResponse { - this := MonitorGroupSearchResponse{} - return &this -} - -// GetCounts returns the Counts field value if set, zero value otherwise. -func (o *MonitorGroupSearchResponse) GetCounts() MonitorGroupSearchResponseCounts { - if o == nil || o.Counts == nil { - var ret MonitorGroupSearchResponseCounts - return ret - } - return *o.Counts -} - -// GetCountsOk returns a tuple with the Counts field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResponse) GetCountsOk() (*MonitorGroupSearchResponseCounts, bool) { - if o == nil || o.Counts == nil { - return nil, false - } - return o.Counts, true -} - -// HasCounts returns a boolean if a field has been set. -func (o *MonitorGroupSearchResponse) HasCounts() bool { - if o != nil && o.Counts != nil { - return true - } - - return false -} - -// SetCounts gets a reference to the given MonitorGroupSearchResponseCounts and assigns it to the Counts field. -func (o *MonitorGroupSearchResponse) SetCounts(v MonitorGroupSearchResponseCounts) { - o.Counts = &v -} - -// GetGroups returns the Groups field value if set, zero value otherwise. -func (o *MonitorGroupSearchResponse) GetGroups() []MonitorGroupSearchResult { - if o == nil || o.Groups == nil { - var ret []MonitorGroupSearchResult - 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 *MonitorGroupSearchResponse) GetGroupsOk() (*[]MonitorGroupSearchResult, 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 *MonitorGroupSearchResponse) HasGroups() bool { - if o != nil && o.Groups != nil { - return true - } - - return false -} - -// SetGroups gets a reference to the given []MonitorGroupSearchResult and assigns it to the Groups field. -func (o *MonitorGroupSearchResponse) SetGroups(v []MonitorGroupSearchResult) { - o.Groups = v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *MonitorGroupSearchResponse) GetMetadata() MonitorSearchResponseMetadata { - if o == nil || o.Metadata == nil { - var ret MonitorSearchResponseMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResponse) GetMetadataOk() (*MonitorSearchResponseMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *MonitorGroupSearchResponse) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given MonitorSearchResponseMetadata and assigns it to the Metadata field. -func (o *MonitorGroupSearchResponse) SetMetadata(v MonitorSearchResponseMetadata) { - o.Metadata = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorGroupSearchResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Counts != nil { - toSerialize["counts"] = o.Counts - } - if o.Groups != nil { - toSerialize["groups"] = o.Groups - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorGroupSearchResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Counts *MonitorGroupSearchResponseCounts `json:"counts,omitempty"` - Groups []MonitorGroupSearchResult `json:"groups,omitempty"` - Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Counts != nil && all.Counts.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Counts = all.Counts - o.Groups = all.Groups - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - return nil -} diff --git a/api/v1/datadog/model_monitor_group_search_response_counts.go b/api/v1/datadog/model_monitor_group_search_response_counts.go deleted file mode 100644 index 0c8cbb43248..00000000000 --- a/api/v1/datadog/model_monitor_group_search_response_counts.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorGroupSearchResponseCounts The counts of monitor groups per different criteria. -type MonitorGroupSearchResponseCounts struct { - // Search facets. - Status []MonitorSearchCountItem `json:"status,omitempty"` - // Search facets. - Type []MonitorSearchCountItem `json:"type,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{} -} - -// NewMonitorGroupSearchResponseCounts instantiates a new MonitorGroupSearchResponseCounts 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 NewMonitorGroupSearchResponseCounts() *MonitorGroupSearchResponseCounts { - this := MonitorGroupSearchResponseCounts{} - return &this -} - -// NewMonitorGroupSearchResponseCountsWithDefaults instantiates a new MonitorGroupSearchResponseCounts 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 NewMonitorGroupSearchResponseCountsWithDefaults() *MonitorGroupSearchResponseCounts { - this := MonitorGroupSearchResponseCounts{} - return &this -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *MonitorGroupSearchResponseCounts) GetStatus() []MonitorSearchCountItem { - if o == nil || o.Status == nil { - var ret []MonitorSearchCountItem - return ret - } - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResponseCounts) GetStatusOk() (*[]MonitorSearchCountItem, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return &o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *MonitorGroupSearchResponseCounts) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given []MonitorSearchCountItem and assigns it to the Status field. -func (o *MonitorGroupSearchResponseCounts) SetStatus(v []MonitorSearchCountItem) { - o.Status = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MonitorGroupSearchResponseCounts) GetType() []MonitorSearchCountItem { - if o == nil || o.Type == nil { - var ret []MonitorSearchCountItem - return ret - } - return o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResponseCounts) GetTypeOk() (*[]MonitorSearchCountItem, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return &o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MonitorGroupSearchResponseCounts) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given []MonitorSearchCountItem and assigns it to the Type field. -func (o *MonitorGroupSearchResponseCounts) SetType(v []MonitorSearchCountItem) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorGroupSearchResponseCounts) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorGroupSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Status []MonitorSearchCountItem `json:"status,omitempty"` - Type []MonitorSearchCountItem `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Status = all.Status - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_monitor_group_search_result.go b/api/v1/datadog/model_monitor_group_search_result.go deleted file mode 100644 index f61fc85b6e7..00000000000 --- a/api/v1/datadog/model_monitor_group_search_result.go +++ /dev/null @@ -1,357 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonitorGroupSearchResult A single monitor group search result. -type MonitorGroupSearchResult struct { - // The name of the group. - Group *string `json:"group,omitempty"` - // The list of tags of the monitor group. - GroupTags []string `json:"group_tags,omitempty"` - // Latest timestamp the monitor group was in NO_DATA state. - LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` - // Latest timestamp the monitor group triggered. - LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` - // The ID of the monitor. - MonitorId *int64 `json:"monitor_id,omitempty"` - // The name of the monitor. - MonitorName *string `json:"monitor_name,omitempty"` - // The different states your monitor can be in. - Status *MonitorOverallStates `json:"status,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{} -} - -// NewMonitorGroupSearchResult instantiates a new MonitorGroupSearchResult 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 NewMonitorGroupSearchResult() *MonitorGroupSearchResult { - this := MonitorGroupSearchResult{} - return &this -} - -// NewMonitorGroupSearchResultWithDefaults instantiates a new MonitorGroupSearchResult 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 NewMonitorGroupSearchResultWithDefaults() *MonitorGroupSearchResult { - this := MonitorGroupSearchResult{} - return &this -} - -// GetGroup returns the Group field value if set, zero value otherwise. -func (o *MonitorGroupSearchResult) GetGroup() string { - if o == nil || o.Group == nil { - var ret string - return ret - } - return *o.Group -} - -// GetGroupOk returns a tuple with the Group field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResult) GetGroupOk() (*string, bool) { - if o == nil || o.Group == nil { - return nil, false - } - return o.Group, true -} - -// HasGroup returns a boolean if a field has been set. -func (o *MonitorGroupSearchResult) HasGroup() bool { - if o != nil && o.Group != nil { - return true - } - - return false -} - -// SetGroup gets a reference to the given string and assigns it to the Group field. -func (o *MonitorGroupSearchResult) SetGroup(v string) { - o.Group = &v -} - -// GetGroupTags returns the GroupTags field value if set, zero value otherwise. -func (o *MonitorGroupSearchResult) GetGroupTags() []string { - if o == nil || o.GroupTags == nil { - var ret []string - return ret - } - return o.GroupTags -} - -// GetGroupTagsOk returns a tuple with the GroupTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResult) GetGroupTagsOk() (*[]string, bool) { - if o == nil || o.GroupTags == nil { - return nil, false - } - return &o.GroupTags, true -} - -// HasGroupTags returns a boolean if a field has been set. -func (o *MonitorGroupSearchResult) HasGroupTags() bool { - if o != nil && o.GroupTags != nil { - return true - } - - return false -} - -// SetGroupTags gets a reference to the given []string and assigns it to the GroupTags field. -func (o *MonitorGroupSearchResult) SetGroupTags(v []string) { - o.GroupTags = v -} - -// GetLastNodataTs returns the LastNodataTs field value if set, zero value otherwise. -func (o *MonitorGroupSearchResult) GetLastNodataTs() int64 { - if o == nil || o.LastNodataTs == nil { - var ret int64 - return ret - } - return *o.LastNodataTs -} - -// GetLastNodataTsOk returns a tuple with the LastNodataTs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResult) GetLastNodataTsOk() (*int64, bool) { - if o == nil || o.LastNodataTs == nil { - return nil, false - } - return o.LastNodataTs, true -} - -// HasLastNodataTs returns a boolean if a field has been set. -func (o *MonitorGroupSearchResult) HasLastNodataTs() bool { - if o != nil && o.LastNodataTs != nil { - return true - } - - return false -} - -// SetLastNodataTs gets a reference to the given int64 and assigns it to the LastNodataTs field. -func (o *MonitorGroupSearchResult) SetLastNodataTs(v int64) { - o.LastNodataTs = &v -} - -// GetLastTriggeredTs returns the LastTriggeredTs field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorGroupSearchResult) GetLastTriggeredTs() int64 { - if o == nil || o.LastTriggeredTs.Get() == nil { - var ret int64 - return ret - } - return *o.LastTriggeredTs.Get() -} - -// GetLastTriggeredTsOk returns a tuple with the LastTriggeredTs 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 *MonitorGroupSearchResult) GetLastTriggeredTsOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.LastTriggeredTs.Get(), o.LastTriggeredTs.IsSet() -} - -// HasLastTriggeredTs returns a boolean if a field has been set. -func (o *MonitorGroupSearchResult) HasLastTriggeredTs() bool { - if o != nil && o.LastTriggeredTs.IsSet() { - return true - } - - return false -} - -// SetLastTriggeredTs gets a reference to the given common.NullableInt64 and assigns it to the LastTriggeredTs field. -func (o *MonitorGroupSearchResult) SetLastTriggeredTs(v int64) { - o.LastTriggeredTs.Set(&v) -} - -// SetLastTriggeredTsNil sets the value for LastTriggeredTs to be an explicit nil. -func (o *MonitorGroupSearchResult) SetLastTriggeredTsNil() { - o.LastTriggeredTs.Set(nil) -} - -// UnsetLastTriggeredTs ensures that no value is present for LastTriggeredTs, not even an explicit nil. -func (o *MonitorGroupSearchResult) UnsetLastTriggeredTs() { - o.LastTriggeredTs.Unset() -} - -// GetMonitorId returns the MonitorId field value if set, zero value otherwise. -func (o *MonitorGroupSearchResult) GetMonitorId() int64 { - if o == nil || o.MonitorId == nil { - var ret int64 - return ret - } - return *o.MonitorId -} - -// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResult) GetMonitorIdOk() (*int64, bool) { - if o == nil || o.MonitorId == nil { - return nil, false - } - return o.MonitorId, true -} - -// HasMonitorId returns a boolean if a field has been set. -func (o *MonitorGroupSearchResult) HasMonitorId() bool { - if o != nil && o.MonitorId != nil { - return true - } - - return false -} - -// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. -func (o *MonitorGroupSearchResult) SetMonitorId(v int64) { - o.MonitorId = &v -} - -// GetMonitorName returns the MonitorName field value if set, zero value otherwise. -func (o *MonitorGroupSearchResult) GetMonitorName() string { - if o == nil || o.MonitorName == nil { - var ret string - return ret - } - return *o.MonitorName -} - -// GetMonitorNameOk returns a tuple with the MonitorName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResult) GetMonitorNameOk() (*string, bool) { - if o == nil || o.MonitorName == nil { - return nil, false - } - return o.MonitorName, true -} - -// HasMonitorName returns a boolean if a field has been set. -func (o *MonitorGroupSearchResult) HasMonitorName() bool { - if o != nil && o.MonitorName != nil { - return true - } - - return false -} - -// SetMonitorName gets a reference to the given string and assigns it to the MonitorName field. -func (o *MonitorGroupSearchResult) SetMonitorName(v string) { - o.MonitorName = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *MonitorGroupSearchResult) GetStatus() MonitorOverallStates { - if o == nil || o.Status == nil { - var ret MonitorOverallStates - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorGroupSearchResult) GetStatusOk() (*MonitorOverallStates, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *MonitorGroupSearchResult) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given MonitorOverallStates and assigns it to the Status field. -func (o *MonitorGroupSearchResult) SetStatus(v MonitorOverallStates) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorGroupSearchResult) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Group != nil { - toSerialize["group"] = o.Group - } - if o.GroupTags != nil { - toSerialize["group_tags"] = o.GroupTags - } - if o.LastNodataTs != nil { - toSerialize["last_nodata_ts"] = o.LastNodataTs - } - if o.LastTriggeredTs.IsSet() { - toSerialize["last_triggered_ts"] = o.LastTriggeredTs.Get() - } - if o.MonitorId != nil { - toSerialize["monitor_id"] = o.MonitorId - } - if o.MonitorName != nil { - toSerialize["monitor_name"] = o.MonitorName - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorGroupSearchResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Group *string `json:"group,omitempty"` - GroupTags []string `json:"group_tags,omitempty"` - LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` - LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` - MonitorId *int64 `json:"monitor_id,omitempty"` - MonitorName *string `json:"monitor_name,omitempty"` - Status *MonitorOverallStates `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Group = all.Group - o.GroupTags = all.GroupTags - o.LastNodataTs = all.LastNodataTs - o.LastTriggeredTs = all.LastTriggeredTs - o.MonitorId = all.MonitorId - o.MonitorName = all.MonitorName - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_monitor_options.go b/api/v1/datadog/model_monitor_options.go deleted file mode 100644 index 5beca6b0cd3..00000000000 --- a/api/v1/datadog/model_monitor_options.go +++ /dev/null @@ -1,1248 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonitorOptions List of options associated with your monitor. -type MonitorOptions struct { - // Type of aggregation performed in the monitor query. - Aggregation *MonitorOptionsAggregation `json:"aggregation,omitempty"` - // IDs of the device the Synthetics monitor is running on. - // Deprecated - DeviceIds []MonitorDeviceID `json:"device_ids,omitempty"` - // Whether or not to send a log sample when the log monitor triggers. - EnableLogsSample *bool `json:"enable_logs_sample,omitempty"` - // We recommend using the [is_renotify](https://docs.datadoghq.com/monitors/notify/?tab=is_alert#renotify), - // block in the original message instead. - // A message to include with a re-notification. Supports the `@username` notification we allow elsewhere. - // Not applicable if `renotify_interval` is `None`. - EscalationMessage *string `json:"escalation_message,omitempty"` - // Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to `300` (5min), - // the timeframe is set to `last_5m` and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. - // This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation. - EvaluationDelay common.NullableInt64 `json:"evaluation_delay,omitempty"` - // Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold. - GroupbySimpleMonitor *bool `json:"groupby_simple_monitor,omitempty"` - // A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title. - // - // **Examples** - // - If `True`, `[Triggered on {host:h1}] Monitor Title` - // - If `False`, `[Triggered] Monitor Title` - IncludeTags *bool `json:"include_tags,omitempty"` - // Whether or not the monitor is locked (only editable by creator and admins). Use `restricted_roles` instead. - // Deprecated - Locked *bool `json:"locked,omitempty"` - // How long the test should be in failure before alerting (integer, number of seconds, max 7200). - MinFailureDuration common.NullableInt64 `json:"min_failure_duration,omitempty"` - // The minimum number of locations in failure at the same time during - // at least one moment in the `min_failure_duration` period (`min_location_failed` and `min_failure_duration` - // are part of the advanced alerting rules - integer, >= 1). - MinLocationFailed common.NullableInt64 `json:"min_location_failed,omitempty"` - // Time (in seconds) to skip evaluations for new groups. - // - // For example, this option can be used to skip evaluations for new hosts while they initialize. - // - // Must be a non negative integer. - NewGroupDelay common.NullableInt64 `json:"new_group_delay,omitempty"` - // Time (in seconds) to allow a host to boot and applications - // to fully start before starting the evaluation of monitor results. - // Should be a non negative integer. - // - // Use new_group_delay instead. - // Deprecated - NewHostDelay common.NullableInt64 `json:"new_host_delay,omitempty"` - // The number of minutes before a monitor notifies after data stops reporting. - // Datadog recommends at least 2x the monitor timeframe for query alerts or 2 minutes for service checks. - // If omitted, 2x the evaluation timeframe is used for query alerts, and 24 hours is used for service checks. - NoDataTimeframe common.NullableInt64 `json:"no_data_timeframe,omitempty"` - // A Boolean indicating whether tagged users is notified on changes to this monitor. - NotifyAudit *bool `json:"notify_audit,omitempty"` - // A Boolean indicating whether this monitor notifies when data stops reporting. - NotifyNoData *bool `json:"notify_no_data,omitempty"` - // The number of minutes after the last notification before a monitor re-notifies on the current status. - // It only re-notifies if it’s not resolved. - RenotifyInterval common.NullableInt64 `json:"renotify_interval,omitempty"` - // The number of times re-notification messages should be sent on the current status at the provided re-notification interval. - RenotifyOccurrences common.NullableInt64 `json:"renotify_occurrences,omitempty"` - // The types of monitor statuses for which re-notification messages are sent. - RenotifyStatuses []MonitorRenotifyStatusType `json:"renotify_statuses,omitempty"` - // A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. - // We highly recommend you set this to `false` for sparse metrics, - // otherwise some evaluations are skipped. Default is false. - RequireFullWindow *bool `json:"require_full_window,omitempty"` - // Information about the downtime applied to the monitor. - // Deprecated - Silenced map[string]int64 `json:"silenced,omitempty"` - // ID of the corresponding Synthetic check. - // Deprecated - SyntheticsCheckId common.NullableString `json:"synthetics_check_id,omitempty"` - // Alerting time window options. - ThresholdWindows *MonitorThresholdWindowOptions `json:"threshold_windows,omitempty"` - // List of the different monitor threshold available. - Thresholds *MonitorThresholds `json:"thresholds,omitempty"` - // The number of hours of the monitor not reporting data before it automatically resolves from a triggered state. The minimum allowed value is 0 hours. The maximum allowed value is 24 hours. - TimeoutH common.NullableInt64 `json:"timeout_h,omitempty"` - // List of requests that can be used in the monitor query. **This feature is currently in beta.** - Variables []MonitorFormulaAndFunctionQueryDefinition `json:"variables,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{} -} - -// NewMonitorOptions instantiates a new MonitorOptions 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 NewMonitorOptions() *MonitorOptions { - this := MonitorOptions{} - var escalationMessage string = "none" - this.EscalationMessage = &escalationMessage - var includeTags bool = true - this.IncludeTags = &includeTags - var minFailureDuration int64 = 0 - this.MinFailureDuration = *common.NewNullableInt64(&minFailureDuration) - var minLocationFailed int64 = 1 - this.MinLocationFailed = *common.NewNullableInt64(&minLocationFailed) - var newHostDelay int64 = 300 - this.NewHostDelay = *common.NewNullableInt64(&newHostDelay) - var notifyAudit bool = false - this.NotifyAudit = ¬ifyAudit - var notifyNoData bool = false - this.NotifyNoData = ¬ifyNoData - this.RenotifyInterval = *common.NewNullableInt64(nil) - this.TimeoutH = *common.NewNullableInt64(nil) - return &this -} - -// NewMonitorOptionsWithDefaults instantiates a new MonitorOptions 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 NewMonitorOptionsWithDefaults() *MonitorOptions { - this := MonitorOptions{} - var escalationMessage string = "none" - this.EscalationMessage = &escalationMessage - var includeTags bool = true - this.IncludeTags = &includeTags - var minFailureDuration int64 = 0 - this.MinFailureDuration = *common.NewNullableInt64(&minFailureDuration) - var minLocationFailed int64 = 1 - this.MinLocationFailed = *common.NewNullableInt64(&minLocationFailed) - var newHostDelay int64 = 300 - this.NewHostDelay = *common.NewNullableInt64(&newHostDelay) - var notifyAudit bool = false - this.NotifyAudit = ¬ifyAudit - var notifyNoData bool = false - this.NotifyNoData = ¬ifyNoData - this.RenotifyInterval = *common.NewNullableInt64(nil) - this.TimeoutH = *common.NewNullableInt64(nil) - return &this -} - -// GetAggregation returns the Aggregation field value if set, zero value otherwise. -func (o *MonitorOptions) GetAggregation() MonitorOptionsAggregation { - if o == nil || o.Aggregation == nil { - var ret MonitorOptionsAggregation - return ret - } - return *o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetAggregationOk() (*MonitorOptionsAggregation, bool) { - if o == nil || o.Aggregation == nil { - return nil, false - } - return o.Aggregation, true -} - -// HasAggregation returns a boolean if a field has been set. -func (o *MonitorOptions) HasAggregation() bool { - if o != nil && o.Aggregation != nil { - return true - } - - return false -} - -// SetAggregation gets a reference to the given MonitorOptionsAggregation and assigns it to the Aggregation field. -func (o *MonitorOptions) SetAggregation(v MonitorOptionsAggregation) { - o.Aggregation = &v -} - -// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise. -// Deprecated -func (o *MonitorOptions) GetDeviceIds() []MonitorDeviceID { - if o == nil || o.DeviceIds == nil { - var ret []MonitorDeviceID - return ret - } - return o.DeviceIds -} - -// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *MonitorOptions) GetDeviceIdsOk() (*[]MonitorDeviceID, bool) { - if o == nil || o.DeviceIds == nil { - return nil, false - } - return &o.DeviceIds, true -} - -// HasDeviceIds returns a boolean if a field has been set. -func (o *MonitorOptions) HasDeviceIds() bool { - if o != nil && o.DeviceIds != nil { - return true - } - - return false -} - -// SetDeviceIds gets a reference to the given []MonitorDeviceID and assigns it to the DeviceIds field. -// Deprecated -func (o *MonitorOptions) SetDeviceIds(v []MonitorDeviceID) { - o.DeviceIds = v -} - -// GetEnableLogsSample returns the EnableLogsSample field value if set, zero value otherwise. -func (o *MonitorOptions) GetEnableLogsSample() bool { - if o == nil || o.EnableLogsSample == nil { - var ret bool - return ret - } - return *o.EnableLogsSample -} - -// GetEnableLogsSampleOk returns a tuple with the EnableLogsSample field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetEnableLogsSampleOk() (*bool, bool) { - if o == nil || o.EnableLogsSample == nil { - return nil, false - } - return o.EnableLogsSample, true -} - -// HasEnableLogsSample returns a boolean if a field has been set. -func (o *MonitorOptions) HasEnableLogsSample() bool { - if o != nil && o.EnableLogsSample != nil { - return true - } - - return false -} - -// SetEnableLogsSample gets a reference to the given bool and assigns it to the EnableLogsSample field. -func (o *MonitorOptions) SetEnableLogsSample(v bool) { - o.EnableLogsSample = &v -} - -// GetEscalationMessage returns the EscalationMessage field value if set, zero value otherwise. -func (o *MonitorOptions) GetEscalationMessage() string { - if o == nil || o.EscalationMessage == nil { - var ret string - return ret - } - return *o.EscalationMessage -} - -// GetEscalationMessageOk returns a tuple with the EscalationMessage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetEscalationMessageOk() (*string, bool) { - if o == nil || o.EscalationMessage == nil { - return nil, false - } - return o.EscalationMessage, true -} - -// HasEscalationMessage returns a boolean if a field has been set. -func (o *MonitorOptions) HasEscalationMessage() bool { - if o != nil && o.EscalationMessage != nil { - return true - } - - return false -} - -// SetEscalationMessage gets a reference to the given string and assigns it to the EscalationMessage field. -func (o *MonitorOptions) SetEscalationMessage(v string) { - o.EscalationMessage = &v -} - -// GetEvaluationDelay returns the EvaluationDelay field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetEvaluationDelay() int64 { - if o == nil || o.EvaluationDelay.Get() == nil { - var ret int64 - return ret - } - return *o.EvaluationDelay.Get() -} - -// GetEvaluationDelayOk returns a tuple with the EvaluationDelay 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 *MonitorOptions) GetEvaluationDelayOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.EvaluationDelay.Get(), o.EvaluationDelay.IsSet() -} - -// HasEvaluationDelay returns a boolean if a field has been set. -func (o *MonitorOptions) HasEvaluationDelay() bool { - if o != nil && o.EvaluationDelay.IsSet() { - return true - } - - return false -} - -// SetEvaluationDelay gets a reference to the given common.NullableInt64 and assigns it to the EvaluationDelay field. -func (o *MonitorOptions) SetEvaluationDelay(v int64) { - o.EvaluationDelay.Set(&v) -} - -// SetEvaluationDelayNil sets the value for EvaluationDelay to be an explicit nil. -func (o *MonitorOptions) SetEvaluationDelayNil() { - o.EvaluationDelay.Set(nil) -} - -// UnsetEvaluationDelay ensures that no value is present for EvaluationDelay, not even an explicit nil. -func (o *MonitorOptions) UnsetEvaluationDelay() { - o.EvaluationDelay.Unset() -} - -// GetGroupbySimpleMonitor returns the GroupbySimpleMonitor field value if set, zero value otherwise. -func (o *MonitorOptions) GetGroupbySimpleMonitor() bool { - if o == nil || o.GroupbySimpleMonitor == nil { - var ret bool - return ret - } - return *o.GroupbySimpleMonitor -} - -// GetGroupbySimpleMonitorOk returns a tuple with the GroupbySimpleMonitor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetGroupbySimpleMonitorOk() (*bool, bool) { - if o == nil || o.GroupbySimpleMonitor == nil { - return nil, false - } - return o.GroupbySimpleMonitor, true -} - -// HasGroupbySimpleMonitor returns a boolean if a field has been set. -func (o *MonitorOptions) HasGroupbySimpleMonitor() bool { - if o != nil && o.GroupbySimpleMonitor != nil { - return true - } - - return false -} - -// SetGroupbySimpleMonitor gets a reference to the given bool and assigns it to the GroupbySimpleMonitor field. -func (o *MonitorOptions) SetGroupbySimpleMonitor(v bool) { - o.GroupbySimpleMonitor = &v -} - -// GetIncludeTags returns the IncludeTags field value if set, zero value otherwise. -func (o *MonitorOptions) GetIncludeTags() bool { - if o == nil || o.IncludeTags == nil { - var ret bool - return ret - } - return *o.IncludeTags -} - -// GetIncludeTagsOk returns a tuple with the IncludeTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetIncludeTagsOk() (*bool, bool) { - if o == nil || o.IncludeTags == nil { - return nil, false - } - return o.IncludeTags, true -} - -// HasIncludeTags returns a boolean if a field has been set. -func (o *MonitorOptions) HasIncludeTags() bool { - if o != nil && o.IncludeTags != nil { - return true - } - - return false -} - -// SetIncludeTags gets a reference to the given bool and assigns it to the IncludeTags field. -func (o *MonitorOptions) SetIncludeTags(v bool) { - o.IncludeTags = &v -} - -// GetLocked returns the Locked field value if set, zero value otherwise. -// Deprecated -func (o *MonitorOptions) GetLocked() bool { - if o == nil || o.Locked == nil { - var ret bool - return ret - } - return *o.Locked -} - -// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *MonitorOptions) GetLockedOk() (*bool, bool) { - if o == nil || o.Locked == nil { - return nil, false - } - return o.Locked, true -} - -// HasLocked returns a boolean if a field has been set. -func (o *MonitorOptions) HasLocked() bool { - if o != nil && o.Locked != nil { - return true - } - - return false -} - -// SetLocked gets a reference to the given bool and assigns it to the Locked field. -// Deprecated -func (o *MonitorOptions) SetLocked(v bool) { - o.Locked = &v -} - -// GetMinFailureDuration returns the MinFailureDuration field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetMinFailureDuration() int64 { - if o == nil || o.MinFailureDuration.Get() == nil { - var ret int64 - return ret - } - return *o.MinFailureDuration.Get() -} - -// GetMinFailureDurationOk returns a tuple with the MinFailureDuration 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 *MonitorOptions) GetMinFailureDurationOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.MinFailureDuration.Get(), o.MinFailureDuration.IsSet() -} - -// HasMinFailureDuration returns a boolean if a field has been set. -func (o *MonitorOptions) HasMinFailureDuration() bool { - if o != nil && o.MinFailureDuration.IsSet() { - return true - } - - return false -} - -// SetMinFailureDuration gets a reference to the given common.NullableInt64 and assigns it to the MinFailureDuration field. -func (o *MonitorOptions) SetMinFailureDuration(v int64) { - o.MinFailureDuration.Set(&v) -} - -// SetMinFailureDurationNil sets the value for MinFailureDuration to be an explicit nil. -func (o *MonitorOptions) SetMinFailureDurationNil() { - o.MinFailureDuration.Set(nil) -} - -// UnsetMinFailureDuration ensures that no value is present for MinFailureDuration, not even an explicit nil. -func (o *MonitorOptions) UnsetMinFailureDuration() { - o.MinFailureDuration.Unset() -} - -// GetMinLocationFailed returns the MinLocationFailed field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetMinLocationFailed() int64 { - if o == nil || o.MinLocationFailed.Get() == nil { - var ret int64 - return ret - } - return *o.MinLocationFailed.Get() -} - -// GetMinLocationFailedOk returns a tuple with the MinLocationFailed 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 *MonitorOptions) GetMinLocationFailedOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.MinLocationFailed.Get(), o.MinLocationFailed.IsSet() -} - -// HasMinLocationFailed returns a boolean if a field has been set. -func (o *MonitorOptions) HasMinLocationFailed() bool { - if o != nil && o.MinLocationFailed.IsSet() { - return true - } - - return false -} - -// SetMinLocationFailed gets a reference to the given common.NullableInt64 and assigns it to the MinLocationFailed field. -func (o *MonitorOptions) SetMinLocationFailed(v int64) { - o.MinLocationFailed.Set(&v) -} - -// SetMinLocationFailedNil sets the value for MinLocationFailed to be an explicit nil. -func (o *MonitorOptions) SetMinLocationFailedNil() { - o.MinLocationFailed.Set(nil) -} - -// UnsetMinLocationFailed ensures that no value is present for MinLocationFailed, not even an explicit nil. -func (o *MonitorOptions) UnsetMinLocationFailed() { - o.MinLocationFailed.Unset() -} - -// GetNewGroupDelay returns the NewGroupDelay field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetNewGroupDelay() int64 { - if o == nil || o.NewGroupDelay.Get() == nil { - var ret int64 - return ret - } - return *o.NewGroupDelay.Get() -} - -// GetNewGroupDelayOk returns a tuple with the NewGroupDelay 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 *MonitorOptions) GetNewGroupDelayOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.NewGroupDelay.Get(), o.NewGroupDelay.IsSet() -} - -// HasNewGroupDelay returns a boolean if a field has been set. -func (o *MonitorOptions) HasNewGroupDelay() bool { - if o != nil && o.NewGroupDelay.IsSet() { - return true - } - - return false -} - -// SetNewGroupDelay gets a reference to the given common.NullableInt64 and assigns it to the NewGroupDelay field. -func (o *MonitorOptions) SetNewGroupDelay(v int64) { - o.NewGroupDelay.Set(&v) -} - -// SetNewGroupDelayNil sets the value for NewGroupDelay to be an explicit nil. -func (o *MonitorOptions) SetNewGroupDelayNil() { - o.NewGroupDelay.Set(nil) -} - -// UnsetNewGroupDelay ensures that no value is present for NewGroupDelay, not even an explicit nil. -func (o *MonitorOptions) UnsetNewGroupDelay() { - o.NewGroupDelay.Unset() -} - -// GetNewHostDelay returns the NewHostDelay field value if set, zero value otherwise (both if not set or set to explicit null). -// Deprecated -func (o *MonitorOptions) GetNewHostDelay() int64 { - if o == nil || o.NewHostDelay.Get() == nil { - var ret int64 - return ret - } - return *o.NewHostDelay.Get() -} - -// GetNewHostDelayOk returns a tuple with the NewHostDelay 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. -// Deprecated -func (o *MonitorOptions) GetNewHostDelayOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.NewHostDelay.Get(), o.NewHostDelay.IsSet() -} - -// HasNewHostDelay returns a boolean if a field has been set. -func (o *MonitorOptions) HasNewHostDelay() bool { - if o != nil && o.NewHostDelay.IsSet() { - return true - } - - return false -} - -// SetNewHostDelay gets a reference to the given common.NullableInt64 and assigns it to the NewHostDelay field. -// Deprecated -func (o *MonitorOptions) SetNewHostDelay(v int64) { - o.NewHostDelay.Set(&v) -} - -// SetNewHostDelayNil sets the value for NewHostDelay to be an explicit nil. -func (o *MonitorOptions) SetNewHostDelayNil() { - o.NewHostDelay.Set(nil) -} - -// UnsetNewHostDelay ensures that no value is present for NewHostDelay, not even an explicit nil. -func (o *MonitorOptions) UnsetNewHostDelay() { - o.NewHostDelay.Unset() -} - -// GetNoDataTimeframe returns the NoDataTimeframe field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetNoDataTimeframe() int64 { - if o == nil || o.NoDataTimeframe.Get() == nil { - var ret int64 - return ret - } - return *o.NoDataTimeframe.Get() -} - -// GetNoDataTimeframeOk returns a tuple with the NoDataTimeframe 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 *MonitorOptions) GetNoDataTimeframeOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.NoDataTimeframe.Get(), o.NoDataTimeframe.IsSet() -} - -// HasNoDataTimeframe returns a boolean if a field has been set. -func (o *MonitorOptions) HasNoDataTimeframe() bool { - if o != nil && o.NoDataTimeframe.IsSet() { - return true - } - - return false -} - -// SetNoDataTimeframe gets a reference to the given common.NullableInt64 and assigns it to the NoDataTimeframe field. -func (o *MonitorOptions) SetNoDataTimeframe(v int64) { - o.NoDataTimeframe.Set(&v) -} - -// SetNoDataTimeframeNil sets the value for NoDataTimeframe to be an explicit nil. -func (o *MonitorOptions) SetNoDataTimeframeNil() { - o.NoDataTimeframe.Set(nil) -} - -// UnsetNoDataTimeframe ensures that no value is present for NoDataTimeframe, not even an explicit nil. -func (o *MonitorOptions) UnsetNoDataTimeframe() { - o.NoDataTimeframe.Unset() -} - -// GetNotifyAudit returns the NotifyAudit field value if set, zero value otherwise. -func (o *MonitorOptions) GetNotifyAudit() bool { - if o == nil || o.NotifyAudit == nil { - var ret bool - return ret - } - return *o.NotifyAudit -} - -// GetNotifyAuditOk returns a tuple with the NotifyAudit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetNotifyAuditOk() (*bool, bool) { - if o == nil || o.NotifyAudit == nil { - return nil, false - } - return o.NotifyAudit, true -} - -// HasNotifyAudit returns a boolean if a field has been set. -func (o *MonitorOptions) HasNotifyAudit() bool { - if o != nil && o.NotifyAudit != nil { - return true - } - - return false -} - -// SetNotifyAudit gets a reference to the given bool and assigns it to the NotifyAudit field. -func (o *MonitorOptions) SetNotifyAudit(v bool) { - o.NotifyAudit = &v -} - -// GetNotifyNoData returns the NotifyNoData field value if set, zero value otherwise. -func (o *MonitorOptions) GetNotifyNoData() bool { - if o == nil || o.NotifyNoData == nil { - var ret bool - return ret - } - return *o.NotifyNoData -} - -// GetNotifyNoDataOk returns a tuple with the NotifyNoData field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetNotifyNoDataOk() (*bool, bool) { - if o == nil || o.NotifyNoData == nil { - return nil, false - } - return o.NotifyNoData, true -} - -// HasNotifyNoData returns a boolean if a field has been set. -func (o *MonitorOptions) HasNotifyNoData() bool { - if o != nil && o.NotifyNoData != nil { - return true - } - - return false -} - -// SetNotifyNoData gets a reference to the given bool and assigns it to the NotifyNoData field. -func (o *MonitorOptions) SetNotifyNoData(v bool) { - o.NotifyNoData = &v -} - -// GetRenotifyInterval returns the RenotifyInterval field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetRenotifyInterval() int64 { - if o == nil || o.RenotifyInterval.Get() == nil { - var ret int64 - return ret - } - return *o.RenotifyInterval.Get() -} - -// GetRenotifyIntervalOk returns a tuple with the RenotifyInterval 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 *MonitorOptions) GetRenotifyIntervalOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.RenotifyInterval.Get(), o.RenotifyInterval.IsSet() -} - -// HasRenotifyInterval returns a boolean if a field has been set. -func (o *MonitorOptions) HasRenotifyInterval() bool { - if o != nil && o.RenotifyInterval.IsSet() { - return true - } - - return false -} - -// SetRenotifyInterval gets a reference to the given common.NullableInt64 and assigns it to the RenotifyInterval field. -func (o *MonitorOptions) SetRenotifyInterval(v int64) { - o.RenotifyInterval.Set(&v) -} - -// SetRenotifyIntervalNil sets the value for RenotifyInterval to be an explicit nil. -func (o *MonitorOptions) SetRenotifyIntervalNil() { - o.RenotifyInterval.Set(nil) -} - -// UnsetRenotifyInterval ensures that no value is present for RenotifyInterval, not even an explicit nil. -func (o *MonitorOptions) UnsetRenotifyInterval() { - o.RenotifyInterval.Unset() -} - -// GetRenotifyOccurrences returns the RenotifyOccurrences field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetRenotifyOccurrences() int64 { - if o == nil || o.RenotifyOccurrences.Get() == nil { - var ret int64 - return ret - } - return *o.RenotifyOccurrences.Get() -} - -// GetRenotifyOccurrencesOk returns a tuple with the RenotifyOccurrences 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 *MonitorOptions) GetRenotifyOccurrencesOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.RenotifyOccurrences.Get(), o.RenotifyOccurrences.IsSet() -} - -// HasRenotifyOccurrences returns a boolean if a field has been set. -func (o *MonitorOptions) HasRenotifyOccurrences() bool { - if o != nil && o.RenotifyOccurrences.IsSet() { - return true - } - - return false -} - -// SetRenotifyOccurrences gets a reference to the given common.NullableInt64 and assigns it to the RenotifyOccurrences field. -func (o *MonitorOptions) SetRenotifyOccurrences(v int64) { - o.RenotifyOccurrences.Set(&v) -} - -// SetRenotifyOccurrencesNil sets the value for RenotifyOccurrences to be an explicit nil. -func (o *MonitorOptions) SetRenotifyOccurrencesNil() { - o.RenotifyOccurrences.Set(nil) -} - -// UnsetRenotifyOccurrences ensures that no value is present for RenotifyOccurrences, not even an explicit nil. -func (o *MonitorOptions) UnsetRenotifyOccurrences() { - o.RenotifyOccurrences.Unset() -} - -// GetRenotifyStatuses returns the RenotifyStatuses field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetRenotifyStatuses() []MonitorRenotifyStatusType { - if o == nil { - var ret []MonitorRenotifyStatusType - return ret - } - return o.RenotifyStatuses -} - -// GetRenotifyStatusesOk returns a tuple with the RenotifyStatuses 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 *MonitorOptions) GetRenotifyStatusesOk() (*[]MonitorRenotifyStatusType, bool) { - if o == nil || o.RenotifyStatuses == nil { - return nil, false - } - return &o.RenotifyStatuses, true -} - -// HasRenotifyStatuses returns a boolean if a field has been set. -func (o *MonitorOptions) HasRenotifyStatuses() bool { - if o != nil && o.RenotifyStatuses != nil { - return true - } - - return false -} - -// SetRenotifyStatuses gets a reference to the given []MonitorRenotifyStatusType and assigns it to the RenotifyStatuses field. -func (o *MonitorOptions) SetRenotifyStatuses(v []MonitorRenotifyStatusType) { - o.RenotifyStatuses = v -} - -// GetRequireFullWindow returns the RequireFullWindow field value if set, zero value otherwise. -func (o *MonitorOptions) GetRequireFullWindow() bool { - if o == nil || o.RequireFullWindow == nil { - var ret bool - return ret - } - return *o.RequireFullWindow -} - -// GetRequireFullWindowOk returns a tuple with the RequireFullWindow field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetRequireFullWindowOk() (*bool, bool) { - if o == nil || o.RequireFullWindow == nil { - return nil, false - } - return o.RequireFullWindow, true -} - -// HasRequireFullWindow returns a boolean if a field has been set. -func (o *MonitorOptions) HasRequireFullWindow() bool { - if o != nil && o.RequireFullWindow != nil { - return true - } - - return false -} - -// SetRequireFullWindow gets a reference to the given bool and assigns it to the RequireFullWindow field. -func (o *MonitorOptions) SetRequireFullWindow(v bool) { - o.RequireFullWindow = &v -} - -// GetSilenced returns the Silenced field value if set, zero value otherwise. -// Deprecated -func (o *MonitorOptions) GetSilenced() map[string]int64 { - if o == nil || o.Silenced == nil { - var ret map[string]int64 - return ret - } - return o.Silenced -} - -// GetSilencedOk returns a tuple with the Silenced field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *MonitorOptions) GetSilencedOk() (*map[string]int64, bool) { - if o == nil || o.Silenced == nil { - return nil, false - } - return &o.Silenced, true -} - -// HasSilenced returns a boolean if a field has been set. -func (o *MonitorOptions) HasSilenced() bool { - if o != nil && o.Silenced != nil { - return true - } - - return false -} - -// SetSilenced gets a reference to the given map[string]int64 and assigns it to the Silenced field. -// Deprecated -func (o *MonitorOptions) SetSilenced(v map[string]int64) { - o.Silenced = v -} - -// GetSyntheticsCheckId returns the SyntheticsCheckId field value if set, zero value otherwise (both if not set or set to explicit null). -// Deprecated -func (o *MonitorOptions) GetSyntheticsCheckId() string { - if o == nil || o.SyntheticsCheckId.Get() == nil { - var ret string - return ret - } - return *o.SyntheticsCheckId.Get() -} - -// GetSyntheticsCheckIdOk returns a tuple with the SyntheticsCheckId 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. -// Deprecated -func (o *MonitorOptions) GetSyntheticsCheckIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.SyntheticsCheckId.Get(), o.SyntheticsCheckId.IsSet() -} - -// HasSyntheticsCheckId returns a boolean if a field has been set. -func (o *MonitorOptions) HasSyntheticsCheckId() bool { - if o != nil && o.SyntheticsCheckId.IsSet() { - return true - } - - return false -} - -// SetSyntheticsCheckId gets a reference to the given common.NullableString and assigns it to the SyntheticsCheckId field. -// Deprecated -func (o *MonitorOptions) SetSyntheticsCheckId(v string) { - o.SyntheticsCheckId.Set(&v) -} - -// SetSyntheticsCheckIdNil sets the value for SyntheticsCheckId to be an explicit nil. -func (o *MonitorOptions) SetSyntheticsCheckIdNil() { - o.SyntheticsCheckId.Set(nil) -} - -// UnsetSyntheticsCheckId ensures that no value is present for SyntheticsCheckId, not even an explicit nil. -func (o *MonitorOptions) UnsetSyntheticsCheckId() { - o.SyntheticsCheckId.Unset() -} - -// GetThresholdWindows returns the ThresholdWindows field value if set, zero value otherwise. -func (o *MonitorOptions) GetThresholdWindows() MonitorThresholdWindowOptions { - if o == nil || o.ThresholdWindows == nil { - var ret MonitorThresholdWindowOptions - return ret - } - return *o.ThresholdWindows -} - -// GetThresholdWindowsOk returns a tuple with the ThresholdWindows field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetThresholdWindowsOk() (*MonitorThresholdWindowOptions, bool) { - if o == nil || o.ThresholdWindows == nil { - return nil, false - } - return o.ThresholdWindows, true -} - -// HasThresholdWindows returns a boolean if a field has been set. -func (o *MonitorOptions) HasThresholdWindows() bool { - if o != nil && o.ThresholdWindows != nil { - return true - } - - return false -} - -// SetThresholdWindows gets a reference to the given MonitorThresholdWindowOptions and assigns it to the ThresholdWindows field. -func (o *MonitorOptions) SetThresholdWindows(v MonitorThresholdWindowOptions) { - o.ThresholdWindows = &v -} - -// GetThresholds returns the Thresholds field value if set, zero value otherwise. -func (o *MonitorOptions) GetThresholds() MonitorThresholds { - if o == nil || o.Thresholds == nil { - var ret MonitorThresholds - return ret - } - return *o.Thresholds -} - -// GetThresholdsOk returns a tuple with the Thresholds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetThresholdsOk() (*MonitorThresholds, bool) { - if o == nil || o.Thresholds == nil { - return nil, false - } - return o.Thresholds, true -} - -// HasThresholds returns a boolean if a field has been set. -func (o *MonitorOptions) HasThresholds() bool { - if o != nil && o.Thresholds != nil { - return true - } - - return false -} - -// SetThresholds gets a reference to the given MonitorThresholds and assigns it to the Thresholds field. -func (o *MonitorOptions) SetThresholds(v MonitorThresholds) { - o.Thresholds = &v -} - -// GetTimeoutH returns the TimeoutH field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorOptions) GetTimeoutH() int64 { - if o == nil || o.TimeoutH.Get() == nil { - var ret int64 - return ret - } - return *o.TimeoutH.Get() -} - -// GetTimeoutHOk returns a tuple with the TimeoutH 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 *MonitorOptions) GetTimeoutHOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.TimeoutH.Get(), o.TimeoutH.IsSet() -} - -// HasTimeoutH returns a boolean if a field has been set. -func (o *MonitorOptions) HasTimeoutH() bool { - if o != nil && o.TimeoutH.IsSet() { - return true - } - - return false -} - -// SetTimeoutH gets a reference to the given common.NullableInt64 and assigns it to the TimeoutH field. -func (o *MonitorOptions) SetTimeoutH(v int64) { - o.TimeoutH.Set(&v) -} - -// SetTimeoutHNil sets the value for TimeoutH to be an explicit nil. -func (o *MonitorOptions) SetTimeoutHNil() { - o.TimeoutH.Set(nil) -} - -// UnsetTimeoutH ensures that no value is present for TimeoutH, not even an explicit nil. -func (o *MonitorOptions) UnsetTimeoutH() { - o.TimeoutH.Unset() -} - -// GetVariables returns the Variables field value if set, zero value otherwise. -func (o *MonitorOptions) GetVariables() []MonitorFormulaAndFunctionQueryDefinition { - if o == nil || o.Variables == nil { - var ret []MonitorFormulaAndFunctionQueryDefinition - return ret - } - return o.Variables -} - -// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptions) GetVariablesOk() (*[]MonitorFormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Variables == nil { - return nil, false - } - return &o.Variables, true -} - -// HasVariables returns a boolean if a field has been set. -func (o *MonitorOptions) HasVariables() bool { - if o != nil && o.Variables != nil { - return true - } - - return false -} - -// SetVariables gets a reference to the given []MonitorFormulaAndFunctionQueryDefinition and assigns it to the Variables field. -func (o *MonitorOptions) SetVariables(v []MonitorFormulaAndFunctionQueryDefinition) { - o.Variables = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregation != nil { - toSerialize["aggregation"] = o.Aggregation - } - if o.DeviceIds != nil { - toSerialize["device_ids"] = o.DeviceIds - } - if o.EnableLogsSample != nil { - toSerialize["enable_logs_sample"] = o.EnableLogsSample - } - if o.EscalationMessage != nil { - toSerialize["escalation_message"] = o.EscalationMessage - } - if o.EvaluationDelay.IsSet() { - toSerialize["evaluation_delay"] = o.EvaluationDelay.Get() - } - if o.GroupbySimpleMonitor != nil { - toSerialize["groupby_simple_monitor"] = o.GroupbySimpleMonitor - } - if o.IncludeTags != nil { - toSerialize["include_tags"] = o.IncludeTags - } - if o.Locked != nil { - toSerialize["locked"] = o.Locked - } - if o.MinFailureDuration.IsSet() { - toSerialize["min_failure_duration"] = o.MinFailureDuration.Get() - } - if o.MinLocationFailed.IsSet() { - toSerialize["min_location_failed"] = o.MinLocationFailed.Get() - } - if o.NewGroupDelay.IsSet() { - toSerialize["new_group_delay"] = o.NewGroupDelay.Get() - } - if o.NewHostDelay.IsSet() { - toSerialize["new_host_delay"] = o.NewHostDelay.Get() - } - if o.NoDataTimeframe.IsSet() { - toSerialize["no_data_timeframe"] = o.NoDataTimeframe.Get() - } - if o.NotifyAudit != nil { - toSerialize["notify_audit"] = o.NotifyAudit - } - if o.NotifyNoData != nil { - toSerialize["notify_no_data"] = o.NotifyNoData - } - if o.RenotifyInterval.IsSet() { - toSerialize["renotify_interval"] = o.RenotifyInterval.Get() - } - if o.RenotifyOccurrences.IsSet() { - toSerialize["renotify_occurrences"] = o.RenotifyOccurrences.Get() - } - if o.RenotifyStatuses != nil { - toSerialize["renotify_statuses"] = o.RenotifyStatuses - } - if o.RequireFullWindow != nil { - toSerialize["require_full_window"] = o.RequireFullWindow - } - if o.Silenced != nil { - toSerialize["silenced"] = o.Silenced - } - if o.SyntheticsCheckId.IsSet() { - toSerialize["synthetics_check_id"] = o.SyntheticsCheckId.Get() - } - if o.ThresholdWindows != nil { - toSerialize["threshold_windows"] = o.ThresholdWindows - } - if o.Thresholds != nil { - toSerialize["thresholds"] = o.Thresholds - } - if o.TimeoutH.IsSet() { - toSerialize["timeout_h"] = o.TimeoutH.Get() - } - if o.Variables != nil { - toSerialize["variables"] = o.Variables - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregation *MonitorOptionsAggregation `json:"aggregation,omitempty"` - DeviceIds []MonitorDeviceID `json:"device_ids,omitempty"` - EnableLogsSample *bool `json:"enable_logs_sample,omitempty"` - EscalationMessage *string `json:"escalation_message,omitempty"` - EvaluationDelay common.NullableInt64 `json:"evaluation_delay,omitempty"` - GroupbySimpleMonitor *bool `json:"groupby_simple_monitor,omitempty"` - IncludeTags *bool `json:"include_tags,omitempty"` - Locked *bool `json:"locked,omitempty"` - MinFailureDuration common.NullableInt64 `json:"min_failure_duration,omitempty"` - MinLocationFailed common.NullableInt64 `json:"min_location_failed,omitempty"` - NewGroupDelay common.NullableInt64 `json:"new_group_delay,omitempty"` - NewHostDelay common.NullableInt64 `json:"new_host_delay,omitempty"` - NoDataTimeframe common.NullableInt64 `json:"no_data_timeframe,omitempty"` - NotifyAudit *bool `json:"notify_audit,omitempty"` - NotifyNoData *bool `json:"notify_no_data,omitempty"` - RenotifyInterval common.NullableInt64 `json:"renotify_interval,omitempty"` - RenotifyOccurrences common.NullableInt64 `json:"renotify_occurrences,omitempty"` - RenotifyStatuses []MonitorRenotifyStatusType `json:"renotify_statuses,omitempty"` - RequireFullWindow *bool `json:"require_full_window,omitempty"` - Silenced map[string]int64 `json:"silenced,omitempty"` - SyntheticsCheckId common.NullableString `json:"synthetics_check_id,omitempty"` - ThresholdWindows *MonitorThresholdWindowOptions `json:"threshold_windows,omitempty"` - Thresholds *MonitorThresholds `json:"thresholds,omitempty"` - TimeoutH common.NullableInt64 `json:"timeout_h,omitempty"` - Variables []MonitorFormulaAndFunctionQueryDefinition `json:"variables,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Aggregation != nil && all.Aggregation.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Aggregation = all.Aggregation - o.DeviceIds = all.DeviceIds - o.EnableLogsSample = all.EnableLogsSample - o.EscalationMessage = all.EscalationMessage - o.EvaluationDelay = all.EvaluationDelay - o.GroupbySimpleMonitor = all.GroupbySimpleMonitor - o.IncludeTags = all.IncludeTags - o.Locked = all.Locked - o.MinFailureDuration = all.MinFailureDuration - o.MinLocationFailed = all.MinLocationFailed - o.NewGroupDelay = all.NewGroupDelay - o.NewHostDelay = all.NewHostDelay - o.NoDataTimeframe = all.NoDataTimeframe - o.NotifyAudit = all.NotifyAudit - o.NotifyNoData = all.NotifyNoData - o.RenotifyInterval = all.RenotifyInterval - o.RenotifyOccurrences = all.RenotifyOccurrences - o.RenotifyStatuses = all.RenotifyStatuses - o.RequireFullWindow = all.RequireFullWindow - o.Silenced = all.Silenced - o.SyntheticsCheckId = all.SyntheticsCheckId - if all.ThresholdWindows != nil && all.ThresholdWindows.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ThresholdWindows = all.ThresholdWindows - if all.Thresholds != nil && all.Thresholds.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Thresholds = all.Thresholds - o.TimeoutH = all.TimeoutH - o.Variables = all.Variables - return nil -} diff --git a/api/v1/datadog/model_monitor_options_aggregation.go b/api/v1/datadog/model_monitor_options_aggregation.go deleted file mode 100644 index 0b922c69d02..00000000000 --- a/api/v1/datadog/model_monitor_options_aggregation.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorOptionsAggregation Type of aggregation performed in the monitor query. -type MonitorOptionsAggregation struct { - // Group to break down the monitor on. - GroupBy *string `json:"group_by,omitempty"` - // Metric name used in the monitor. - Metric *string `json:"metric,omitempty"` - // Metric type used in the monitor. - Type *string `json:"type,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{} -} - -// NewMonitorOptionsAggregation instantiates a new MonitorOptionsAggregation 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 NewMonitorOptionsAggregation() *MonitorOptionsAggregation { - this := MonitorOptionsAggregation{} - return &this -} - -// NewMonitorOptionsAggregationWithDefaults instantiates a new MonitorOptionsAggregation 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 NewMonitorOptionsAggregationWithDefaults() *MonitorOptionsAggregation { - this := MonitorOptionsAggregation{} - return &this -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *MonitorOptionsAggregation) GetGroupBy() string { - if o == nil || o.GroupBy == nil { - var ret string - return ret - } - return *o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptionsAggregation) GetGroupByOk() (*string, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *MonitorOptionsAggregation) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given string and assigns it to the GroupBy field. -func (o *MonitorOptionsAggregation) SetGroupBy(v string) { - o.GroupBy = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *MonitorOptionsAggregation) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptionsAggregation) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *MonitorOptionsAggregation) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *MonitorOptionsAggregation) SetMetric(v string) { - o.Metric = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MonitorOptionsAggregation) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorOptionsAggregation) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MonitorOptionsAggregation) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *MonitorOptionsAggregation) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorOptionsAggregation) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorOptionsAggregation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - GroupBy *string `json:"group_by,omitempty"` - Metric *string `json:"metric,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.GroupBy = all.GroupBy - o.Metric = all.Metric - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_monitor_overall_states.go b/api/v1/datadog/model_monitor_overall_states.go deleted file mode 100644 index 51557c26937..00000000000 --- a/api/v1/datadog/model_monitor_overall_states.go +++ /dev/null @@ -1,119 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorOverallStates The different states your monitor can be in. -type MonitorOverallStates string - -// List of MonitorOverallStates. -const ( - MONITOROVERALLSTATES_ALERT MonitorOverallStates = "Alert" - MONITOROVERALLSTATES_IGNORED MonitorOverallStates = "Ignored" - MONITOROVERALLSTATES_NO_DATA MonitorOverallStates = "No Data" - MONITOROVERALLSTATES_OK MonitorOverallStates = "OK" - MONITOROVERALLSTATES_SKIPPED MonitorOverallStates = "Skipped" - MONITOROVERALLSTATES_UNKNOWN MonitorOverallStates = "Unknown" - MONITOROVERALLSTATES_WARN MonitorOverallStates = "Warn" -) - -var allowedMonitorOverallStatesEnumValues = []MonitorOverallStates{ - MONITOROVERALLSTATES_ALERT, - MONITOROVERALLSTATES_IGNORED, - MONITOROVERALLSTATES_NO_DATA, - MONITOROVERALLSTATES_OK, - MONITOROVERALLSTATES_SKIPPED, - MONITOROVERALLSTATES_UNKNOWN, - MONITOROVERALLSTATES_WARN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonitorOverallStates) GetAllowedValues() []MonitorOverallStates { - return allowedMonitorOverallStatesEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonitorOverallStates) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonitorOverallStates(value) - return nil -} - -// NewMonitorOverallStatesFromValue returns a pointer to a valid MonitorOverallStates -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonitorOverallStatesFromValue(v string) (*MonitorOverallStates, error) { - ev := MonitorOverallStates(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonitorOverallStates: valid values are %v", v, allowedMonitorOverallStatesEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonitorOverallStates) IsValid() bool { - for _, existing := range allowedMonitorOverallStatesEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonitorOverallStates value. -func (v MonitorOverallStates) Ptr() *MonitorOverallStates { - return &v -} - -// NullableMonitorOverallStates handles when a null is used for MonitorOverallStates. -type NullableMonitorOverallStates struct { - value *MonitorOverallStates - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorOverallStates) Get() *MonitorOverallStates { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorOverallStates) Set(val *MonitorOverallStates) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorOverallStates) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorOverallStates) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorOverallStates initializes the struct as if Set has been called. -func NewNullableMonitorOverallStates(val *MonitorOverallStates) *NullableMonitorOverallStates { - return &NullableMonitorOverallStates{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorOverallStates) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorOverallStates) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_renotify_status_type.go b/api/v1/datadog/model_monitor_renotify_status_type.go deleted file mode 100644 index 5f457c7c07a..00000000000 --- a/api/v1/datadog/model_monitor_renotify_status_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorRenotifyStatusType The different statuses for which renotification is supported. -type MonitorRenotifyStatusType string - -// List of MonitorRenotifyStatusType. -const ( - MONITORRENOTIFYSTATUSTYPE_ALERT MonitorRenotifyStatusType = "alert" - MONITORRENOTIFYSTATUSTYPE_WARN MonitorRenotifyStatusType = "warn" - MONITORRENOTIFYSTATUSTYPE_NO_DATA MonitorRenotifyStatusType = "no data" -) - -var allowedMonitorRenotifyStatusTypeEnumValues = []MonitorRenotifyStatusType{ - MONITORRENOTIFYSTATUSTYPE_ALERT, - MONITORRENOTIFYSTATUSTYPE_WARN, - MONITORRENOTIFYSTATUSTYPE_NO_DATA, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonitorRenotifyStatusType) GetAllowedValues() []MonitorRenotifyStatusType { - return allowedMonitorRenotifyStatusTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonitorRenotifyStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonitorRenotifyStatusType(value) - return nil -} - -// NewMonitorRenotifyStatusTypeFromValue returns a pointer to a valid MonitorRenotifyStatusType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonitorRenotifyStatusTypeFromValue(v string) (*MonitorRenotifyStatusType, error) { - ev := MonitorRenotifyStatusType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonitorRenotifyStatusType: valid values are %v", v, allowedMonitorRenotifyStatusTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonitorRenotifyStatusType) IsValid() bool { - for _, existing := range allowedMonitorRenotifyStatusTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonitorRenotifyStatusType value. -func (v MonitorRenotifyStatusType) Ptr() *MonitorRenotifyStatusType { - return &v -} - -// NullableMonitorRenotifyStatusType handles when a null is used for MonitorRenotifyStatusType. -type NullableMonitorRenotifyStatusType struct { - value *MonitorRenotifyStatusType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorRenotifyStatusType) Get() *MonitorRenotifyStatusType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorRenotifyStatusType) Set(val *MonitorRenotifyStatusType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorRenotifyStatusType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorRenotifyStatusType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorRenotifyStatusType initializes the struct as if Set has been called. -func NewNullableMonitorRenotifyStatusType(val *MonitorRenotifyStatusType) *NullableMonitorRenotifyStatusType { - return &NullableMonitorRenotifyStatusType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorRenotifyStatusType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorRenotifyStatusType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_search_count_item.go b/api/v1/datadog/model_monitor_search_count_item.go deleted file mode 100644 index ec8a5aeb9af..00000000000 --- a/api/v1/datadog/model_monitor_search_count_item.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorSearchCountItem A facet item. -type MonitorSearchCountItem struct { - // The number of found monitors with the listed value. - Count *int64 `json:"count,omitempty"` - // The facet value. - Name interface{} `json:"name,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{} -} - -// NewMonitorSearchCountItem instantiates a new MonitorSearchCountItem 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 NewMonitorSearchCountItem() *MonitorSearchCountItem { - this := MonitorSearchCountItem{} - return &this -} - -// NewMonitorSearchCountItemWithDefaults instantiates a new MonitorSearchCountItem 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 NewMonitorSearchCountItemWithDefaults() *MonitorSearchCountItem { - this := MonitorSearchCountItem{} - return &this -} - -// GetCount returns the Count field value if set, zero value otherwise. -func (o *MonitorSearchCountItem) GetCount() int64 { - if o == nil || o.Count == nil { - var ret int64 - return ret - } - return *o.Count -} - -// GetCountOk returns a tuple with the Count field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchCountItem) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { - return nil, false - } - return o.Count, true -} - -// HasCount returns a boolean if a field has been set. -func (o *MonitorSearchCountItem) HasCount() bool { - if o != nil && o.Count != nil { - return true - } - - return false -} - -// SetCount gets a reference to the given int64 and assigns it to the Count field. -func (o *MonitorSearchCountItem) SetCount(v int64) { - o.Count = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MonitorSearchCountItem) GetName() interface{} { - if o == nil || o.Name == nil { - var ret interface{} - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchCountItem) GetNameOk() (*interface{}, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return &o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MonitorSearchCountItem) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given interface{} and assigns it to the Name field. -func (o *MonitorSearchCountItem) SetName(v interface{}) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorSearchCountItem) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Count != nil { - toSerialize["count"] = o.Count - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorSearchCountItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Count *int64 `json:"count,omitempty"` - Name interface{} `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Count = all.Count - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_monitor_search_response.go b/api/v1/datadog/model_monitor_search_response.go deleted file mode 100644 index 0dabbdbfb84..00000000000 --- a/api/v1/datadog/model_monitor_search_response.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorSearchResponse The response form a monitor search. -type MonitorSearchResponse struct { - // The counts of monitors per different criteria. - Counts *MonitorSearchResponseCounts `json:"counts,omitempty"` - // Metadata about the response. - Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` - // The list of found monitors. - Monitors []MonitorSearchResult `json:"monitors,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{} -} - -// NewMonitorSearchResponse instantiates a new MonitorSearchResponse 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 NewMonitorSearchResponse() *MonitorSearchResponse { - this := MonitorSearchResponse{} - return &this -} - -// NewMonitorSearchResponseWithDefaults instantiates a new MonitorSearchResponse 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 NewMonitorSearchResponseWithDefaults() *MonitorSearchResponse { - this := MonitorSearchResponse{} - return &this -} - -// GetCounts returns the Counts field value if set, zero value otherwise. -func (o *MonitorSearchResponse) GetCounts() MonitorSearchResponseCounts { - if o == nil || o.Counts == nil { - var ret MonitorSearchResponseCounts - return ret - } - return *o.Counts -} - -// GetCountsOk returns a tuple with the Counts field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponse) GetCountsOk() (*MonitorSearchResponseCounts, bool) { - if o == nil || o.Counts == nil { - return nil, false - } - return o.Counts, true -} - -// HasCounts returns a boolean if a field has been set. -func (o *MonitorSearchResponse) HasCounts() bool { - if o != nil && o.Counts != nil { - return true - } - - return false -} - -// SetCounts gets a reference to the given MonitorSearchResponseCounts and assigns it to the Counts field. -func (o *MonitorSearchResponse) SetCounts(v MonitorSearchResponseCounts) { - o.Counts = &v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *MonitorSearchResponse) GetMetadata() MonitorSearchResponseMetadata { - if o == nil || o.Metadata == nil { - var ret MonitorSearchResponseMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponse) GetMetadataOk() (*MonitorSearchResponseMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *MonitorSearchResponse) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given MonitorSearchResponseMetadata and assigns it to the Metadata field. -func (o *MonitorSearchResponse) SetMetadata(v MonitorSearchResponseMetadata) { - o.Metadata = &v -} - -// GetMonitors returns the Monitors field value if set, zero value otherwise. -func (o *MonitorSearchResponse) GetMonitors() []MonitorSearchResult { - if o == nil || o.Monitors == nil { - var ret []MonitorSearchResult - return ret - } - return o.Monitors -} - -// GetMonitorsOk returns a tuple with the Monitors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponse) GetMonitorsOk() (*[]MonitorSearchResult, bool) { - if o == nil || o.Monitors == nil { - return nil, false - } - return &o.Monitors, true -} - -// HasMonitors returns a boolean if a field has been set. -func (o *MonitorSearchResponse) HasMonitors() bool { - if o != nil && o.Monitors != nil { - return true - } - - return false -} - -// SetMonitors gets a reference to the given []MonitorSearchResult and assigns it to the Monitors field. -func (o *MonitorSearchResponse) SetMonitors(v []MonitorSearchResult) { - o.Monitors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorSearchResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Counts != nil { - toSerialize["counts"] = o.Counts - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Monitors != nil { - toSerialize["monitors"] = o.Monitors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorSearchResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Counts *MonitorSearchResponseCounts `json:"counts,omitempty"` - Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` - Monitors []MonitorSearchResult `json:"monitors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Counts != nil && all.Counts.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Counts = all.Counts - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Monitors = all.Monitors - return nil -} diff --git a/api/v1/datadog/model_monitor_search_response_counts.go b/api/v1/datadog/model_monitor_search_response_counts.go deleted file mode 100644 index 7d006903b8e..00000000000 --- a/api/v1/datadog/model_monitor_search_response_counts.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorSearchResponseCounts The counts of monitors per different criteria. -type MonitorSearchResponseCounts struct { - // Search facets. - Muted []MonitorSearchCountItem `json:"muted,omitempty"` - // Search facets. - Status []MonitorSearchCountItem `json:"status,omitempty"` - // Search facets. - Tag []MonitorSearchCountItem `json:"tag,omitempty"` - // Search facets. - Type []MonitorSearchCountItem `json:"type,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{} -} - -// NewMonitorSearchResponseCounts instantiates a new MonitorSearchResponseCounts 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 NewMonitorSearchResponseCounts() *MonitorSearchResponseCounts { - this := MonitorSearchResponseCounts{} - return &this -} - -// NewMonitorSearchResponseCountsWithDefaults instantiates a new MonitorSearchResponseCounts 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 NewMonitorSearchResponseCountsWithDefaults() *MonitorSearchResponseCounts { - this := MonitorSearchResponseCounts{} - return &this -} - -// GetMuted returns the Muted field value if set, zero value otherwise. -func (o *MonitorSearchResponseCounts) GetMuted() []MonitorSearchCountItem { - if o == nil || o.Muted == nil { - var ret []MonitorSearchCountItem - return ret - } - return o.Muted -} - -// GetMutedOk returns a tuple with the Muted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseCounts) GetMutedOk() (*[]MonitorSearchCountItem, bool) { - if o == nil || o.Muted == nil { - return nil, false - } - return &o.Muted, true -} - -// HasMuted returns a boolean if a field has been set. -func (o *MonitorSearchResponseCounts) HasMuted() bool { - if o != nil && o.Muted != nil { - return true - } - - return false -} - -// SetMuted gets a reference to the given []MonitorSearchCountItem and assigns it to the Muted field. -func (o *MonitorSearchResponseCounts) SetMuted(v []MonitorSearchCountItem) { - o.Muted = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *MonitorSearchResponseCounts) GetStatus() []MonitorSearchCountItem { - if o == nil || o.Status == nil { - var ret []MonitorSearchCountItem - return ret - } - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseCounts) GetStatusOk() (*[]MonitorSearchCountItem, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return &o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *MonitorSearchResponseCounts) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given []MonitorSearchCountItem and assigns it to the Status field. -func (o *MonitorSearchResponseCounts) SetStatus(v []MonitorSearchCountItem) { - o.Status = v -} - -// GetTag returns the Tag field value if set, zero value otherwise. -func (o *MonitorSearchResponseCounts) GetTag() []MonitorSearchCountItem { - if o == nil || o.Tag == nil { - var ret []MonitorSearchCountItem - return ret - } - return o.Tag -} - -// GetTagOk returns a tuple with the Tag field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseCounts) GetTagOk() (*[]MonitorSearchCountItem, bool) { - if o == nil || o.Tag == nil { - return nil, false - } - return &o.Tag, true -} - -// HasTag returns a boolean if a field has been set. -func (o *MonitorSearchResponseCounts) HasTag() bool { - if o != nil && o.Tag != nil { - return true - } - - return false -} - -// SetTag gets a reference to the given []MonitorSearchCountItem and assigns it to the Tag field. -func (o *MonitorSearchResponseCounts) SetTag(v []MonitorSearchCountItem) { - o.Tag = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MonitorSearchResponseCounts) GetType() []MonitorSearchCountItem { - if o == nil || o.Type == nil { - var ret []MonitorSearchCountItem - return ret - } - return o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseCounts) GetTypeOk() (*[]MonitorSearchCountItem, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return &o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MonitorSearchResponseCounts) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given []MonitorSearchCountItem and assigns it to the Type field. -func (o *MonitorSearchResponseCounts) SetType(v []MonitorSearchCountItem) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorSearchResponseCounts) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Muted != nil { - toSerialize["muted"] = o.Muted - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Tag != nil { - toSerialize["tag"] = o.Tag - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Muted []MonitorSearchCountItem `json:"muted,omitempty"` - Status []MonitorSearchCountItem `json:"status,omitempty"` - Tag []MonitorSearchCountItem `json:"tag,omitempty"` - Type []MonitorSearchCountItem `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Muted = all.Muted - o.Status = all.Status - o.Tag = all.Tag - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_monitor_search_response_metadata.go b/api/v1/datadog/model_monitor_search_response_metadata.go deleted file mode 100644 index 8b332b434ce..00000000000 --- a/api/v1/datadog/model_monitor_search_response_metadata.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorSearchResponseMetadata Metadata about the response. -type MonitorSearchResponseMetadata struct { - // The page to start paginating from. - Page *int64 `json:"page,omitempty"` - // The number of pages. - PageCount *int64 `json:"page_count,omitempty"` - // The number of monitors to return per page. - PerPage *int64 `json:"per_page,omitempty"` - // The total number of monitors. - TotalCount *int64 `json:"total_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{} -} - -// NewMonitorSearchResponseMetadata instantiates a new MonitorSearchResponseMetadata 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 NewMonitorSearchResponseMetadata() *MonitorSearchResponseMetadata { - this := MonitorSearchResponseMetadata{} - return &this -} - -// NewMonitorSearchResponseMetadataWithDefaults instantiates a new MonitorSearchResponseMetadata 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 NewMonitorSearchResponseMetadataWithDefaults() *MonitorSearchResponseMetadata { - this := MonitorSearchResponseMetadata{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *MonitorSearchResponseMetadata) GetPage() int64 { - if o == nil || o.Page == nil { - var ret int64 - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseMetadata) GetPageOk() (*int64, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *MonitorSearchResponseMetadata) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given int64 and assigns it to the Page field. -func (o *MonitorSearchResponseMetadata) SetPage(v int64) { - o.Page = &v -} - -// GetPageCount returns the PageCount field value if set, zero value otherwise. -func (o *MonitorSearchResponseMetadata) GetPageCount() int64 { - if o == nil || o.PageCount == nil { - var ret int64 - return ret - } - return *o.PageCount -} - -// GetPageCountOk returns a tuple with the PageCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseMetadata) GetPageCountOk() (*int64, bool) { - if o == nil || o.PageCount == nil { - return nil, false - } - return o.PageCount, true -} - -// HasPageCount returns a boolean if a field has been set. -func (o *MonitorSearchResponseMetadata) HasPageCount() bool { - if o != nil && o.PageCount != nil { - return true - } - - return false -} - -// SetPageCount gets a reference to the given int64 and assigns it to the PageCount field. -func (o *MonitorSearchResponseMetadata) SetPageCount(v int64) { - o.PageCount = &v -} - -// GetPerPage returns the PerPage field value if set, zero value otherwise. -func (o *MonitorSearchResponseMetadata) GetPerPage() int64 { - if o == nil || o.PerPage == nil { - var ret int64 - return ret - } - return *o.PerPage -} - -// GetPerPageOk returns a tuple with the PerPage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseMetadata) GetPerPageOk() (*int64, bool) { - if o == nil || o.PerPage == nil { - return nil, false - } - return o.PerPage, true -} - -// HasPerPage returns a boolean if a field has been set. -func (o *MonitorSearchResponseMetadata) HasPerPage() bool { - if o != nil && o.PerPage != nil { - return true - } - - return false -} - -// SetPerPage gets a reference to the given int64 and assigns it to the PerPage field. -func (o *MonitorSearchResponseMetadata) SetPerPage(v int64) { - o.PerPage = &v -} - -// GetTotalCount returns the TotalCount field value if set, zero value otherwise. -func (o *MonitorSearchResponseMetadata) GetTotalCount() int64 { - if o == nil || o.TotalCount == nil { - var ret int64 - return ret - } - return *o.TotalCount -} - -// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResponseMetadata) GetTotalCountOk() (*int64, bool) { - if o == nil || o.TotalCount == nil { - return nil, false - } - return o.TotalCount, true -} - -// HasTotalCount returns a boolean if a field has been set. -func (o *MonitorSearchResponseMetadata) HasTotalCount() bool { - if o != nil && o.TotalCount != nil { - return true - } - - return false -} - -// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. -func (o *MonitorSearchResponseMetadata) SetTotalCount(v int64) { - o.TotalCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorSearchResponseMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.PageCount != nil { - toSerialize["page_count"] = o.PageCount - } - if o.PerPage != nil { - toSerialize["per_page"] = o.PerPage - } - if o.TotalCount != nil { - toSerialize["total_count"] = o.TotalCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorSearchResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *int64 `json:"page,omitempty"` - PageCount *int64 `json:"page_count,omitempty"` - PerPage *int64 `json:"per_page,omitempty"` - TotalCount *int64 `json:"total_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Page = all.Page - o.PageCount = all.PageCount - o.PerPage = all.PerPage - o.TotalCount = all.TotalCount - return nil -} diff --git a/api/v1/datadog/model_monitor_search_result.go b/api/v1/datadog/model_monitor_search_result.go deleted file mode 100644 index 90e0588e62e..00000000000 --- a/api/v1/datadog/model_monitor_search_result.go +++ /dev/null @@ -1,609 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonitorSearchResult Holds search results. -type MonitorSearchResult struct { - // Classification of the monitor. - Classification *string `json:"classification,omitempty"` - // Object describing the creator of the shared element. - Creator *Creator `json:"creator,omitempty"` - // ID of the monitor. - Id *int64 `json:"id,omitempty"` - // Latest timestamp the monitor triggered. - LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` - // Metrics used by the monitor. - Metrics []string `json:"metrics,omitempty"` - // The monitor name. - Name *string `json:"name,omitempty"` - // The notification triggered by the monitor. - Notifications []MonitorSearchResultNotification `json:"notifications,omitempty"` - // The ID of the organization. - OrgId *int64 `json:"org_id,omitempty"` - // The monitor query. - Query *string `json:"query,omitempty"` - // The scope(s) to which the downtime applies, for example `host:app2`. - // Provide multiple scopes as a comma-separated list, for example `env:dev,env:prod`. - // The resulting downtime applies to sources that matches ALL provided scopes - // (that is `env:dev AND env:prod`), NOT any of them. - Scopes []string `json:"scopes,omitempty"` - // The different states your monitor can be in. - Status *MonitorOverallStates `json:"status,omitempty"` - // Tags associated with the monitor. - Tags []string `json:"tags,omitempty"` - // The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. - Type *MonitorType `json:"type,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{} -} - -// NewMonitorSearchResult instantiates a new MonitorSearchResult 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 NewMonitorSearchResult() *MonitorSearchResult { - this := MonitorSearchResult{} - return &this -} - -// NewMonitorSearchResultWithDefaults instantiates a new MonitorSearchResult 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 NewMonitorSearchResultWithDefaults() *MonitorSearchResult { - this := MonitorSearchResult{} - return &this -} - -// GetClassification returns the Classification field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetClassification() string { - if o == nil || o.Classification == nil { - var ret string - return ret - } - return *o.Classification -} - -// GetClassificationOk returns a tuple with the Classification field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetClassificationOk() (*string, bool) { - if o == nil || o.Classification == nil { - return nil, false - } - return o.Classification, true -} - -// HasClassification returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasClassification() bool { - if o != nil && o.Classification != nil { - return true - } - - return false -} - -// SetClassification gets a reference to the given string and assigns it to the Classification field. -func (o *MonitorSearchResult) SetClassification(v string) { - o.Classification = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetCreator() Creator { - if o == nil || o.Creator == nil { - var ret Creator - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetCreatorOk() (*Creator, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given Creator and assigns it to the Creator field. -func (o *MonitorSearchResult) SetCreator(v Creator) { - o.Creator = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *MonitorSearchResult) SetId(v int64) { - o.Id = &v -} - -// GetLastTriggeredTs returns the LastTriggeredTs field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorSearchResult) GetLastTriggeredTs() int64 { - if o == nil || o.LastTriggeredTs.Get() == nil { - var ret int64 - return ret - } - return *o.LastTriggeredTs.Get() -} - -// GetLastTriggeredTsOk returns a tuple with the LastTriggeredTs 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 *MonitorSearchResult) GetLastTriggeredTsOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.LastTriggeredTs.Get(), o.LastTriggeredTs.IsSet() -} - -// HasLastTriggeredTs returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasLastTriggeredTs() bool { - if o != nil && o.LastTriggeredTs.IsSet() { - return true - } - - return false -} - -// SetLastTriggeredTs gets a reference to the given common.NullableInt64 and assigns it to the LastTriggeredTs field. -func (o *MonitorSearchResult) SetLastTriggeredTs(v int64) { - o.LastTriggeredTs.Set(&v) -} - -// SetLastTriggeredTsNil sets the value for LastTriggeredTs to be an explicit nil. -func (o *MonitorSearchResult) SetLastTriggeredTsNil() { - o.LastTriggeredTs.Set(nil) -} - -// UnsetLastTriggeredTs ensures that no value is present for LastTriggeredTs, not even an explicit nil. -func (o *MonitorSearchResult) UnsetLastTriggeredTs() { - o.LastTriggeredTs.Unset() -} - -// GetMetrics returns the Metrics field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetMetrics() []string { - if o == nil || o.Metrics == nil { - var ret []string - return ret - } - return o.Metrics -} - -// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetMetricsOk() (*[]string, bool) { - if o == nil || o.Metrics == nil { - return nil, false - } - return &o.Metrics, true -} - -// HasMetrics returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasMetrics() bool { - if o != nil && o.Metrics != nil { - return true - } - - return false -} - -// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. -func (o *MonitorSearchResult) SetMetrics(v []string) { - o.Metrics = v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *MonitorSearchResult) SetName(v string) { - o.Name = &v -} - -// GetNotifications returns the Notifications field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetNotifications() []MonitorSearchResultNotification { - if o == nil || o.Notifications == nil { - var ret []MonitorSearchResultNotification - return ret - } - return o.Notifications -} - -// GetNotificationsOk returns a tuple with the Notifications field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetNotificationsOk() (*[]MonitorSearchResultNotification, bool) { - if o == nil || o.Notifications == nil { - return nil, false - } - return &o.Notifications, true -} - -// HasNotifications returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasNotifications() bool { - if o != nil && o.Notifications != nil { - return true - } - - return false -} - -// SetNotifications gets a reference to the given []MonitorSearchResultNotification and assigns it to the Notifications field. -func (o *MonitorSearchResult) SetNotifications(v []MonitorSearchResultNotification) { - o.Notifications = v -} - -// GetOrgId returns the OrgId field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetOrgId() int64 { - if o == nil || o.OrgId == nil { - var ret int64 - return ret - } - return *o.OrgId -} - -// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetOrgIdOk() (*int64, bool) { - if o == nil || o.OrgId == nil { - return nil, false - } - return o.OrgId, true -} - -// HasOrgId returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasOrgId() bool { - if o != nil && o.OrgId != nil { - return true - } - - return false -} - -// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. -func (o *MonitorSearchResult) SetOrgId(v int64) { - o.OrgId = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *MonitorSearchResult) SetQuery(v string) { - o.Query = &v -} - -// GetScopes returns the Scopes field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetScopes() []string { - if o == nil || o.Scopes == nil { - var ret []string - return ret - } - return o.Scopes -} - -// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetScopesOk() (*[]string, bool) { - if o == nil || o.Scopes == nil { - return nil, false - } - return &o.Scopes, true -} - -// HasScopes returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasScopes() bool { - if o != nil && o.Scopes != nil { - return true - } - - return false -} - -// SetScopes gets a reference to the given []string and assigns it to the Scopes field. -func (o *MonitorSearchResult) SetScopes(v []string) { - o.Scopes = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetStatus() MonitorOverallStates { - if o == nil || o.Status == nil { - var ret MonitorOverallStates - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetStatusOk() (*MonitorOverallStates, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given MonitorOverallStates and assigns it to the Status field. -func (o *MonitorSearchResult) SetStatus(v MonitorOverallStates) { - o.Status = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MonitorSearchResult) GetTagsOk() (*[]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 *MonitorSearchResult) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MonitorSearchResult) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MonitorSearchResult) GetType() MonitorType { - if o == nil || o.Type == nil { - var ret MonitorType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResult) GetTypeOk() (*MonitorType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MonitorSearchResult) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MonitorType and assigns it to the Type field. -func (o *MonitorSearchResult) SetType(v MonitorType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorSearchResult) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Classification != nil { - toSerialize["classification"] = o.Classification - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.LastTriggeredTs.IsSet() { - toSerialize["last_triggered_ts"] = o.LastTriggeredTs.Get() - } - if o.Metrics != nil { - toSerialize["metrics"] = o.Metrics - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Notifications != nil { - toSerialize["notifications"] = o.Notifications - } - if o.OrgId != nil { - toSerialize["org_id"] = o.OrgId - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Scopes != nil { - toSerialize["scopes"] = o.Scopes - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorSearchResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Classification *string `json:"classification,omitempty"` - Creator *Creator `json:"creator,omitempty"` - Id *int64 `json:"id,omitempty"` - LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` - Metrics []string `json:"metrics,omitempty"` - Name *string `json:"name,omitempty"` - Notifications []MonitorSearchResultNotification `json:"notifications,omitempty"` - OrgId *int64 `json:"org_id,omitempty"` - Query *string `json:"query,omitempty"` - Scopes []string `json:"scopes,omitempty"` - Status *MonitorOverallStates `json:"status,omitempty"` - Tags []string `json:"tags,omitempty"` - Type *MonitorType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Classification = all.Classification - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.Id = all.Id - o.LastTriggeredTs = all.LastTriggeredTs - o.Metrics = all.Metrics - o.Name = all.Name - o.Notifications = all.Notifications - o.OrgId = all.OrgId - o.Query = all.Query - o.Scopes = all.Scopes - o.Status = all.Status - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_monitor_search_result_notification.go b/api/v1/datadog/model_monitor_search_result_notification.go deleted file mode 100644 index 95fc77cb930..00000000000 --- a/api/v1/datadog/model_monitor_search_result_notification.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorSearchResultNotification A notification triggered by the monitor. -type MonitorSearchResultNotification struct { - // The email address that received the notification. - Handle *string `json:"handle,omitempty"` - // The username receiving the notification - Name *string `json:"name,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{} -} - -// NewMonitorSearchResultNotification instantiates a new MonitorSearchResultNotification 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 NewMonitorSearchResultNotification() *MonitorSearchResultNotification { - this := MonitorSearchResultNotification{} - return &this -} - -// NewMonitorSearchResultNotificationWithDefaults instantiates a new MonitorSearchResultNotification 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 NewMonitorSearchResultNotificationWithDefaults() *MonitorSearchResultNotification { - this := MonitorSearchResultNotification{} - return &this -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *MonitorSearchResultNotification) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResultNotification) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *MonitorSearchResultNotification) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *MonitorSearchResultNotification) SetHandle(v string) { - o.Handle = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MonitorSearchResultNotification) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSearchResultNotification) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MonitorSearchResultNotification) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *MonitorSearchResultNotification) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorSearchResultNotification) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorSearchResultNotification) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Handle *string `json:"handle,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Handle = all.Handle - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_monitor_state.go b/api/v1/datadog/model_monitor_state.go deleted file mode 100644 index 04882bb4ff7..00000000000 --- a/api/v1/datadog/model_monitor_state.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorState Wrapper object with the different monitor states. -type MonitorState struct { - // Dictionary where the keys are groups (comma separated lists of tags) and the values are - // the list of groups your monitor is broken down on. - Groups map[string]MonitorStateGroup `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{} -} - -// NewMonitorState instantiates a new MonitorState 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 NewMonitorState() *MonitorState { - this := MonitorState{} - return &this -} - -// NewMonitorStateWithDefaults instantiates a new MonitorState 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 NewMonitorStateWithDefaults() *MonitorState { - this := MonitorState{} - return &this -} - -// GetGroups returns the Groups field value if set, zero value otherwise. -func (o *MonitorState) GetGroups() map[string]MonitorStateGroup { - if o == nil || o.Groups == nil { - var ret map[string]MonitorStateGroup - 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 *MonitorState) GetGroupsOk() (*map[string]MonitorStateGroup, 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 *MonitorState) HasGroups() bool { - if o != nil && o.Groups != nil { - return true - } - - return false -} - -// SetGroups gets a reference to the given map[string]MonitorStateGroup and assigns it to the Groups field. -func (o *MonitorState) SetGroups(v map[string]MonitorStateGroup) { - o.Groups = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorState) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Groups != nil { - toSerialize["groups"] = o.Groups - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorState) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Groups map[string]MonitorStateGroup `json:"groups,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Groups = all.Groups - return nil -} diff --git a/api/v1/datadog/model_monitor_state_group.go b/api/v1/datadog/model_monitor_state_group.go deleted file mode 100644 index 886170e950e..00000000000 --- a/api/v1/datadog/model_monitor_state_group.go +++ /dev/null @@ -1,305 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorStateGroup Monitor state for a single group. -type MonitorStateGroup struct { - // Latest timestamp the monitor was in NO_DATA state. - LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` - // Latest timestamp of the notification sent for this monitor group. - LastNotifiedTs *int64 `json:"last_notified_ts,omitempty"` - // Latest timestamp the monitor group was resolved. - LastResolvedTs *int64 `json:"last_resolved_ts,omitempty"` - // Latest timestamp the monitor group triggered. - LastTriggeredTs *int64 `json:"last_triggered_ts,omitempty"` - // The name of the monitor. - Name *string `json:"name,omitempty"` - // The different states your monitor can be in. - Status *MonitorOverallStates `json:"status,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{} -} - -// NewMonitorStateGroup instantiates a new MonitorStateGroup 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 NewMonitorStateGroup() *MonitorStateGroup { - this := MonitorStateGroup{} - return &this -} - -// NewMonitorStateGroupWithDefaults instantiates a new MonitorStateGroup 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 NewMonitorStateGroupWithDefaults() *MonitorStateGroup { - this := MonitorStateGroup{} - return &this -} - -// GetLastNodataTs returns the LastNodataTs field value if set, zero value otherwise. -func (o *MonitorStateGroup) GetLastNodataTs() int64 { - if o == nil || o.LastNodataTs == nil { - var ret int64 - return ret - } - return *o.LastNodataTs -} - -// GetLastNodataTsOk returns a tuple with the LastNodataTs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorStateGroup) GetLastNodataTsOk() (*int64, bool) { - if o == nil || o.LastNodataTs == nil { - return nil, false - } - return o.LastNodataTs, true -} - -// HasLastNodataTs returns a boolean if a field has been set. -func (o *MonitorStateGroup) HasLastNodataTs() bool { - if o != nil && o.LastNodataTs != nil { - return true - } - - return false -} - -// SetLastNodataTs gets a reference to the given int64 and assigns it to the LastNodataTs field. -func (o *MonitorStateGroup) SetLastNodataTs(v int64) { - o.LastNodataTs = &v -} - -// GetLastNotifiedTs returns the LastNotifiedTs field value if set, zero value otherwise. -func (o *MonitorStateGroup) GetLastNotifiedTs() int64 { - if o == nil || o.LastNotifiedTs == nil { - var ret int64 - return ret - } - return *o.LastNotifiedTs -} - -// GetLastNotifiedTsOk returns a tuple with the LastNotifiedTs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorStateGroup) GetLastNotifiedTsOk() (*int64, bool) { - if o == nil || o.LastNotifiedTs == nil { - return nil, false - } - return o.LastNotifiedTs, true -} - -// HasLastNotifiedTs returns a boolean if a field has been set. -func (o *MonitorStateGroup) HasLastNotifiedTs() bool { - if o != nil && o.LastNotifiedTs != nil { - return true - } - - return false -} - -// SetLastNotifiedTs gets a reference to the given int64 and assigns it to the LastNotifiedTs field. -func (o *MonitorStateGroup) SetLastNotifiedTs(v int64) { - o.LastNotifiedTs = &v -} - -// GetLastResolvedTs returns the LastResolvedTs field value if set, zero value otherwise. -func (o *MonitorStateGroup) GetLastResolvedTs() int64 { - if o == nil || o.LastResolvedTs == nil { - var ret int64 - return ret - } - return *o.LastResolvedTs -} - -// GetLastResolvedTsOk returns a tuple with the LastResolvedTs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorStateGroup) GetLastResolvedTsOk() (*int64, bool) { - if o == nil || o.LastResolvedTs == nil { - return nil, false - } - return o.LastResolvedTs, true -} - -// HasLastResolvedTs returns a boolean if a field has been set. -func (o *MonitorStateGroup) HasLastResolvedTs() bool { - if o != nil && o.LastResolvedTs != nil { - return true - } - - return false -} - -// SetLastResolvedTs gets a reference to the given int64 and assigns it to the LastResolvedTs field. -func (o *MonitorStateGroup) SetLastResolvedTs(v int64) { - o.LastResolvedTs = &v -} - -// GetLastTriggeredTs returns the LastTriggeredTs field value if set, zero value otherwise. -func (o *MonitorStateGroup) GetLastTriggeredTs() int64 { - if o == nil || o.LastTriggeredTs == nil { - var ret int64 - return ret - } - return *o.LastTriggeredTs -} - -// GetLastTriggeredTsOk returns a tuple with the LastTriggeredTs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorStateGroup) GetLastTriggeredTsOk() (*int64, bool) { - if o == nil || o.LastTriggeredTs == nil { - return nil, false - } - return o.LastTriggeredTs, true -} - -// HasLastTriggeredTs returns a boolean if a field has been set. -func (o *MonitorStateGroup) HasLastTriggeredTs() bool { - if o != nil && o.LastTriggeredTs != nil { - return true - } - - return false -} - -// SetLastTriggeredTs gets a reference to the given int64 and assigns it to the LastTriggeredTs field. -func (o *MonitorStateGroup) SetLastTriggeredTs(v int64) { - o.LastTriggeredTs = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MonitorStateGroup) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorStateGroup) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MonitorStateGroup) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *MonitorStateGroup) SetName(v string) { - o.Name = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *MonitorStateGroup) GetStatus() MonitorOverallStates { - if o == nil || o.Status == nil { - var ret MonitorOverallStates - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorStateGroup) GetStatusOk() (*MonitorOverallStates, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *MonitorStateGroup) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given MonitorOverallStates and assigns it to the Status field. -func (o *MonitorStateGroup) SetStatus(v MonitorOverallStates) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorStateGroup) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LastNodataTs != nil { - toSerialize["last_nodata_ts"] = o.LastNodataTs - } - if o.LastNotifiedTs != nil { - toSerialize["last_notified_ts"] = o.LastNotifiedTs - } - if o.LastResolvedTs != nil { - toSerialize["last_resolved_ts"] = o.LastResolvedTs - } - if o.LastTriggeredTs != nil { - toSerialize["last_triggered_ts"] = o.LastTriggeredTs - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorStateGroup) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` - LastNotifiedTs *int64 `json:"last_notified_ts,omitempty"` - LastResolvedTs *int64 `json:"last_resolved_ts,omitempty"` - LastTriggeredTs *int64 `json:"last_triggered_ts,omitempty"` - Name *string `json:"name,omitempty"` - Status *MonitorOverallStates `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LastNodataTs = all.LastNodataTs - o.LastNotifiedTs = all.LastNotifiedTs - o.LastResolvedTs = all.LastResolvedTs - o.LastTriggeredTs = all.LastTriggeredTs - o.Name = all.Name - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_monitor_summary_widget_definition.go b/api/v1/datadog/model_monitor_summary_widget_definition.go deleted file mode 100644 index 87a059663fe..00000000000 --- a/api/v1/datadog/model_monitor_summary_widget_definition.go +++ /dev/null @@ -1,623 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorSummaryWidgetDefinition The monitor summary widget displays a summary view of all your Datadog monitors, or a subset based on a query. Only available on FREE layout dashboards. -type MonitorSummaryWidgetDefinition struct { - // Which color to use on the widget. - ColorPreference *WidgetColorPreference `json:"color_preference,omitempty"` - // The number of monitors to display. - // Deprecated - Count *int64 `json:"count,omitempty"` - // What to display on the widget. - DisplayFormat *WidgetMonitorSummaryDisplayFormat `json:"display_format,omitempty"` - // Whether to show counts of 0 or not. - HideZeroCounts *bool `json:"hide_zero_counts,omitempty"` - // Query to filter the monitors with. - Query string `json:"query"` - // Whether to show the time that has elapsed since the monitor/group triggered. - ShowLastTriggered *bool `json:"show_last_triggered,omitempty"` - // Widget sorting methods. - Sort *WidgetMonitorSummarySort `json:"sort,omitempty"` - // The start of the list. Typically 0. - // Deprecated - Start *int64 `json:"start,omitempty"` - // Which summary type should be used. - SummaryType *WidgetSummaryType `json:"summary_type,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the monitor summary widget. - Type MonitorSummaryWidgetDefinitionType `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{} -} - -// NewMonitorSummaryWidgetDefinition instantiates a new MonitorSummaryWidgetDefinition 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 NewMonitorSummaryWidgetDefinition(query string, typeVar MonitorSummaryWidgetDefinitionType) *MonitorSummaryWidgetDefinition { - this := MonitorSummaryWidgetDefinition{} - this.Query = query - this.Type = typeVar - return &this -} - -// NewMonitorSummaryWidgetDefinitionWithDefaults instantiates a new MonitorSummaryWidgetDefinition 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 NewMonitorSummaryWidgetDefinitionWithDefaults() *MonitorSummaryWidgetDefinition { - this := MonitorSummaryWidgetDefinition{} - var typeVar MonitorSummaryWidgetDefinitionType = MONITORSUMMARYWIDGETDEFINITIONTYPE_MANAGE_STATUS - this.Type = typeVar - return &this -} - -// GetColorPreference returns the ColorPreference field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetColorPreference() WidgetColorPreference { - if o == nil || o.ColorPreference == nil { - var ret WidgetColorPreference - return ret - } - return *o.ColorPreference -} - -// GetColorPreferenceOk returns a tuple with the ColorPreference field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetColorPreferenceOk() (*WidgetColorPreference, bool) { - if o == nil || o.ColorPreference == nil { - return nil, false - } - return o.ColorPreference, true -} - -// HasColorPreference returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasColorPreference() bool { - if o != nil && o.ColorPreference != nil { - return true - } - - return false -} - -// SetColorPreference gets a reference to the given WidgetColorPreference and assigns it to the ColorPreference field. -func (o *MonitorSummaryWidgetDefinition) SetColorPreference(v WidgetColorPreference) { - o.ColorPreference = &v -} - -// GetCount returns the Count field value if set, zero value otherwise. -// Deprecated -func (o *MonitorSummaryWidgetDefinition) GetCount() int64 { - if o == nil || o.Count == nil { - var ret int64 - return ret - } - return *o.Count -} - -// GetCountOk returns a tuple with the Count field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *MonitorSummaryWidgetDefinition) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { - return nil, false - } - return o.Count, true -} - -// HasCount returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasCount() bool { - if o != nil && o.Count != nil { - return true - } - - return false -} - -// SetCount gets a reference to the given int64 and assigns it to the Count field. -// Deprecated -func (o *MonitorSummaryWidgetDefinition) SetCount(v int64) { - o.Count = &v -} - -// GetDisplayFormat returns the DisplayFormat field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetDisplayFormat() WidgetMonitorSummaryDisplayFormat { - if o == nil || o.DisplayFormat == nil { - var ret WidgetMonitorSummaryDisplayFormat - return ret - } - return *o.DisplayFormat -} - -// GetDisplayFormatOk returns a tuple with the DisplayFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetDisplayFormatOk() (*WidgetMonitorSummaryDisplayFormat, bool) { - if o == nil || o.DisplayFormat == nil { - return nil, false - } - return o.DisplayFormat, true -} - -// HasDisplayFormat returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasDisplayFormat() bool { - if o != nil && o.DisplayFormat != nil { - return true - } - - return false -} - -// SetDisplayFormat gets a reference to the given WidgetMonitorSummaryDisplayFormat and assigns it to the DisplayFormat field. -func (o *MonitorSummaryWidgetDefinition) SetDisplayFormat(v WidgetMonitorSummaryDisplayFormat) { - o.DisplayFormat = &v -} - -// GetHideZeroCounts returns the HideZeroCounts field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetHideZeroCounts() bool { - if o == nil || o.HideZeroCounts == nil { - var ret bool - return ret - } - return *o.HideZeroCounts -} - -// GetHideZeroCountsOk returns a tuple with the HideZeroCounts field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetHideZeroCountsOk() (*bool, bool) { - if o == nil || o.HideZeroCounts == nil { - return nil, false - } - return o.HideZeroCounts, true -} - -// HasHideZeroCounts returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasHideZeroCounts() bool { - if o != nil && o.HideZeroCounts != nil { - return true - } - - return false -} - -// SetHideZeroCounts gets a reference to the given bool and assigns it to the HideZeroCounts field. -func (o *MonitorSummaryWidgetDefinition) SetHideZeroCounts(v bool) { - o.HideZeroCounts = &v -} - -// GetQuery returns the Query field value. -func (o *MonitorSummaryWidgetDefinition) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *MonitorSummaryWidgetDefinition) SetQuery(v string) { - o.Query = v -} - -// GetShowLastTriggered returns the ShowLastTriggered field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetShowLastTriggered() bool { - if o == nil || o.ShowLastTriggered == nil { - var ret bool - return ret - } - return *o.ShowLastTriggered -} - -// GetShowLastTriggeredOk returns a tuple with the ShowLastTriggered field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetShowLastTriggeredOk() (*bool, bool) { - if o == nil || o.ShowLastTriggered == nil { - return nil, false - } - return o.ShowLastTriggered, true -} - -// HasShowLastTriggered returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasShowLastTriggered() bool { - if o != nil && o.ShowLastTriggered != nil { - return true - } - - return false -} - -// SetShowLastTriggered gets a reference to the given bool and assigns it to the ShowLastTriggered field. -func (o *MonitorSummaryWidgetDefinition) SetShowLastTriggered(v bool) { - o.ShowLastTriggered = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetSort() WidgetMonitorSummarySort { - if o == nil || o.Sort == nil { - var ret WidgetMonitorSummarySort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetSortOk() (*WidgetMonitorSummarySort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given WidgetMonitorSummarySort and assigns it to the Sort field. -func (o *MonitorSummaryWidgetDefinition) SetSort(v WidgetMonitorSummarySort) { - o.Sort = &v -} - -// GetStart returns the Start field value if set, zero value otherwise. -// Deprecated -func (o *MonitorSummaryWidgetDefinition) GetStart() int64 { - if o == nil || o.Start == nil { - var ret int64 - return ret - } - return *o.Start -} - -// GetStartOk returns a tuple with the Start field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *MonitorSummaryWidgetDefinition) GetStartOk() (*int64, bool) { - if o == nil || o.Start == nil { - return nil, false - } - return o.Start, true -} - -// HasStart returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasStart() bool { - if o != nil && o.Start != nil { - return true - } - - return false -} - -// SetStart gets a reference to the given int64 and assigns it to the Start field. -// Deprecated -func (o *MonitorSummaryWidgetDefinition) SetStart(v int64) { - o.Start = &v -} - -// GetSummaryType returns the SummaryType field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetSummaryType() WidgetSummaryType { - if o == nil || o.SummaryType == nil { - var ret WidgetSummaryType - return ret - } - return *o.SummaryType -} - -// GetSummaryTypeOk returns a tuple with the SummaryType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetSummaryTypeOk() (*WidgetSummaryType, bool) { - if o == nil || o.SummaryType == nil { - return nil, false - } - return o.SummaryType, true -} - -// HasSummaryType returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasSummaryType() bool { - if o != nil && o.SummaryType != nil { - return true - } - - return false -} - -// SetSummaryType gets a reference to the given WidgetSummaryType and assigns it to the SummaryType field. -func (o *MonitorSummaryWidgetDefinition) SetSummaryType(v WidgetSummaryType) { - o.SummaryType = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *MonitorSummaryWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *MonitorSummaryWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *MonitorSummaryWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorSummaryWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *MonitorSummaryWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *MonitorSummaryWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *MonitorSummaryWidgetDefinition) GetType() MonitorSummaryWidgetDefinitionType { - if o == nil { - var ret MonitorSummaryWidgetDefinitionType - 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 *MonitorSummaryWidgetDefinition) GetTypeOk() (*MonitorSummaryWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *MonitorSummaryWidgetDefinition) SetType(v MonitorSummaryWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ColorPreference != nil { - toSerialize["color_preference"] = o.ColorPreference - } - if o.Count != nil { - toSerialize["count"] = o.Count - } - if o.DisplayFormat != nil { - toSerialize["display_format"] = o.DisplayFormat - } - if o.HideZeroCounts != nil { - toSerialize["hide_zero_counts"] = o.HideZeroCounts - } - toSerialize["query"] = o.Query - if o.ShowLastTriggered != nil { - toSerialize["show_last_triggered"] = o.ShowLastTriggered - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - if o.Start != nil { - toSerialize["start"] = o.Start - } - if o.SummaryType != nil { - toSerialize["summary_type"] = o.SummaryType - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *MonitorSummaryWidgetDefinitionType `json:"type"` - }{} - all := struct { - ColorPreference *WidgetColorPreference `json:"color_preference,omitempty"` - Count *int64 `json:"count,omitempty"` - DisplayFormat *WidgetMonitorSummaryDisplayFormat `json:"display_format,omitempty"` - HideZeroCounts *bool `json:"hide_zero_counts,omitempty"` - Query string `json:"query"` - ShowLastTriggered *bool `json:"show_last_triggered,omitempty"` - Sort *WidgetMonitorSummarySort `json:"sort,omitempty"` - Start *int64 `json:"start,omitempty"` - SummaryType *WidgetSummaryType `json:"summary_type,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type MonitorSummaryWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ColorPreference; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DisplayFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.SummaryType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ColorPreference = all.ColorPreference - o.Count = all.Count - o.DisplayFormat = all.DisplayFormat - o.HideZeroCounts = all.HideZeroCounts - o.Query = all.Query - o.ShowLastTriggered = all.ShowLastTriggered - o.Sort = all.Sort - o.Start = all.Start - o.SummaryType = all.SummaryType - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_monitor_summary_widget_definition_type.go b/api/v1/datadog/model_monitor_summary_widget_definition_type.go deleted file mode 100644 index cd70ad8f4da..00000000000 --- a/api/v1/datadog/model_monitor_summary_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorSummaryWidgetDefinitionType Type of the monitor summary widget. -type MonitorSummaryWidgetDefinitionType string - -// List of MonitorSummaryWidgetDefinitionType. -const ( - MONITORSUMMARYWIDGETDEFINITIONTYPE_MANAGE_STATUS MonitorSummaryWidgetDefinitionType = "manage_status" -) - -var allowedMonitorSummaryWidgetDefinitionTypeEnumValues = []MonitorSummaryWidgetDefinitionType{ - MONITORSUMMARYWIDGETDEFINITIONTYPE_MANAGE_STATUS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonitorSummaryWidgetDefinitionType) GetAllowedValues() []MonitorSummaryWidgetDefinitionType { - return allowedMonitorSummaryWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonitorSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonitorSummaryWidgetDefinitionType(value) - return nil -} - -// NewMonitorSummaryWidgetDefinitionTypeFromValue returns a pointer to a valid MonitorSummaryWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonitorSummaryWidgetDefinitionTypeFromValue(v string) (*MonitorSummaryWidgetDefinitionType, error) { - ev := MonitorSummaryWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonitorSummaryWidgetDefinitionType: valid values are %v", v, allowedMonitorSummaryWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonitorSummaryWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedMonitorSummaryWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonitorSummaryWidgetDefinitionType value. -func (v MonitorSummaryWidgetDefinitionType) Ptr() *MonitorSummaryWidgetDefinitionType { - return &v -} - -// NullableMonitorSummaryWidgetDefinitionType handles when a null is used for MonitorSummaryWidgetDefinitionType. -type NullableMonitorSummaryWidgetDefinitionType struct { - value *MonitorSummaryWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorSummaryWidgetDefinitionType) Get() *MonitorSummaryWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorSummaryWidgetDefinitionType) Set(val *MonitorSummaryWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorSummaryWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorSummaryWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorSummaryWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableMonitorSummaryWidgetDefinitionType(val *MonitorSummaryWidgetDefinitionType) *NullableMonitorSummaryWidgetDefinitionType { - return &NullableMonitorSummaryWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorSummaryWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_threshold_window_options.go b/api/v1/datadog/model_monitor_threshold_window_options.go deleted file mode 100644 index 2e46b6e4d0f..00000000000 --- a/api/v1/datadog/model_monitor_threshold_window_options.go +++ /dev/null @@ -1,165 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonitorThresholdWindowOptions Alerting time window options. -type MonitorThresholdWindowOptions struct { - // Describes how long an anomalous metric must be normal before the alert recovers. - RecoveryWindow common.NullableString `json:"recovery_window,omitempty"` - // Describes how long a metric must be anomalous before an alert triggers. - TriggerWindow common.NullableString `json:"trigger_window,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{} -} - -// NewMonitorThresholdWindowOptions instantiates a new MonitorThresholdWindowOptions 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 NewMonitorThresholdWindowOptions() *MonitorThresholdWindowOptions { - this := MonitorThresholdWindowOptions{} - return &this -} - -// NewMonitorThresholdWindowOptionsWithDefaults instantiates a new MonitorThresholdWindowOptions 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 NewMonitorThresholdWindowOptionsWithDefaults() *MonitorThresholdWindowOptions { - this := MonitorThresholdWindowOptions{} - return &this -} - -// GetRecoveryWindow returns the RecoveryWindow field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorThresholdWindowOptions) GetRecoveryWindow() string { - if o == nil || o.RecoveryWindow.Get() == nil { - var ret string - return ret - } - return *o.RecoveryWindow.Get() -} - -// GetRecoveryWindowOk returns a tuple with the RecoveryWindow 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 *MonitorThresholdWindowOptions) GetRecoveryWindowOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.RecoveryWindow.Get(), o.RecoveryWindow.IsSet() -} - -// HasRecoveryWindow returns a boolean if a field has been set. -func (o *MonitorThresholdWindowOptions) HasRecoveryWindow() bool { - if o != nil && o.RecoveryWindow.IsSet() { - return true - } - - return false -} - -// SetRecoveryWindow gets a reference to the given common.NullableString and assigns it to the RecoveryWindow field. -func (o *MonitorThresholdWindowOptions) SetRecoveryWindow(v string) { - o.RecoveryWindow.Set(&v) -} - -// SetRecoveryWindowNil sets the value for RecoveryWindow to be an explicit nil. -func (o *MonitorThresholdWindowOptions) SetRecoveryWindowNil() { - o.RecoveryWindow.Set(nil) -} - -// UnsetRecoveryWindow ensures that no value is present for RecoveryWindow, not even an explicit nil. -func (o *MonitorThresholdWindowOptions) UnsetRecoveryWindow() { - o.RecoveryWindow.Unset() -} - -// GetTriggerWindow returns the TriggerWindow field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorThresholdWindowOptions) GetTriggerWindow() string { - if o == nil || o.TriggerWindow.Get() == nil { - var ret string - return ret - } - return *o.TriggerWindow.Get() -} - -// GetTriggerWindowOk returns a tuple with the TriggerWindow 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 *MonitorThresholdWindowOptions) GetTriggerWindowOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.TriggerWindow.Get(), o.TriggerWindow.IsSet() -} - -// HasTriggerWindow returns a boolean if a field has been set. -func (o *MonitorThresholdWindowOptions) HasTriggerWindow() bool { - if o != nil && o.TriggerWindow.IsSet() { - return true - } - - return false -} - -// SetTriggerWindow gets a reference to the given common.NullableString and assigns it to the TriggerWindow field. -func (o *MonitorThresholdWindowOptions) SetTriggerWindow(v string) { - o.TriggerWindow.Set(&v) -} - -// SetTriggerWindowNil sets the value for TriggerWindow to be an explicit nil. -func (o *MonitorThresholdWindowOptions) SetTriggerWindowNil() { - o.TriggerWindow.Set(nil) -} - -// UnsetTriggerWindow ensures that no value is present for TriggerWindow, not even an explicit nil. -func (o *MonitorThresholdWindowOptions) UnsetTriggerWindow() { - o.TriggerWindow.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorThresholdWindowOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.RecoveryWindow.IsSet() { - toSerialize["recovery_window"] = o.RecoveryWindow.Get() - } - if o.TriggerWindow.IsSet() { - toSerialize["trigger_window"] = o.TriggerWindow.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorThresholdWindowOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - RecoveryWindow common.NullableString `json:"recovery_window,omitempty"` - TriggerWindow common.NullableString `json:"trigger_window,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.RecoveryWindow = all.RecoveryWindow - o.TriggerWindow = all.TriggerWindow - return nil -} diff --git a/api/v1/datadog/model_monitor_thresholds.go b/api/v1/datadog/model_monitor_thresholds.go deleted file mode 100644 index 51d5788d157..00000000000 --- a/api/v1/datadog/model_monitor_thresholds.go +++ /dev/null @@ -1,354 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonitorThresholds List of the different monitor threshold available. -type MonitorThresholds struct { - // The monitor `CRITICAL` threshold. - Critical *float64 `json:"critical,omitempty"` - // The monitor `CRITICAL` recovery threshold. - CriticalRecovery common.NullableFloat64 `json:"critical_recovery,omitempty"` - // The monitor `OK` threshold. - Ok common.NullableFloat64 `json:"ok,omitempty"` - // The monitor UNKNOWN threshold. - Unknown common.NullableFloat64 `json:"unknown,omitempty"` - // The monitor `WARNING` threshold. - Warning common.NullableFloat64 `json:"warning,omitempty"` - // The monitor `WARNING` recovery threshold. - WarningRecovery common.NullableFloat64 `json:"warning_recovery,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{} -} - -// NewMonitorThresholds instantiates a new MonitorThresholds 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 NewMonitorThresholds() *MonitorThresholds { - this := MonitorThresholds{} - return &this -} - -// NewMonitorThresholdsWithDefaults instantiates a new MonitorThresholds 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 NewMonitorThresholdsWithDefaults() *MonitorThresholds { - this := MonitorThresholds{} - return &this -} - -// GetCritical returns the Critical field value if set, zero value otherwise. -func (o *MonitorThresholds) GetCritical() float64 { - if o == nil || o.Critical == nil { - var ret float64 - return ret - } - return *o.Critical -} - -// GetCriticalOk returns a tuple with the Critical field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorThresholds) GetCriticalOk() (*float64, bool) { - if o == nil || o.Critical == nil { - return nil, false - } - return o.Critical, true -} - -// HasCritical returns a boolean if a field has been set. -func (o *MonitorThresholds) HasCritical() bool { - if o != nil && o.Critical != nil { - return true - } - - return false -} - -// SetCritical gets a reference to the given float64 and assigns it to the Critical field. -func (o *MonitorThresholds) SetCritical(v float64) { - o.Critical = &v -} - -// GetCriticalRecovery returns the CriticalRecovery field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorThresholds) GetCriticalRecovery() float64 { - if o == nil || o.CriticalRecovery.Get() == nil { - var ret float64 - return ret - } - return *o.CriticalRecovery.Get() -} - -// GetCriticalRecoveryOk returns a tuple with the CriticalRecovery 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 *MonitorThresholds) GetCriticalRecoveryOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.CriticalRecovery.Get(), o.CriticalRecovery.IsSet() -} - -// HasCriticalRecovery returns a boolean if a field has been set. -func (o *MonitorThresholds) HasCriticalRecovery() bool { - if o != nil && o.CriticalRecovery.IsSet() { - return true - } - - return false -} - -// SetCriticalRecovery gets a reference to the given common.NullableFloat64 and assigns it to the CriticalRecovery field. -func (o *MonitorThresholds) SetCriticalRecovery(v float64) { - o.CriticalRecovery.Set(&v) -} - -// SetCriticalRecoveryNil sets the value for CriticalRecovery to be an explicit nil. -func (o *MonitorThresholds) SetCriticalRecoveryNil() { - o.CriticalRecovery.Set(nil) -} - -// UnsetCriticalRecovery ensures that no value is present for CriticalRecovery, not even an explicit nil. -func (o *MonitorThresholds) UnsetCriticalRecovery() { - o.CriticalRecovery.Unset() -} - -// GetOk returns the Ok field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorThresholds) GetOk() float64 { - if o == nil || o.Ok.Get() == nil { - var ret float64 - return ret - } - return *o.Ok.Get() -} - -// GetOkOk returns a tuple with the Ok 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 *MonitorThresholds) GetOkOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.Ok.Get(), o.Ok.IsSet() -} - -// HasOk returns a boolean if a field has been set. -func (o *MonitorThresholds) HasOk() bool { - if o != nil && o.Ok.IsSet() { - return true - } - - return false -} - -// SetOk gets a reference to the given common.NullableFloat64 and assigns it to the Ok field. -func (o *MonitorThresholds) SetOk(v float64) { - o.Ok.Set(&v) -} - -// SetOkNil sets the value for Ok to be an explicit nil. -func (o *MonitorThresholds) SetOkNil() { - o.Ok.Set(nil) -} - -// UnsetOk ensures that no value is present for Ok, not even an explicit nil. -func (o *MonitorThresholds) UnsetOk() { - o.Ok.Unset() -} - -// GetUnknown returns the Unknown field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorThresholds) GetUnknown() float64 { - if o == nil || o.Unknown.Get() == nil { - var ret float64 - return ret - } - return *o.Unknown.Get() -} - -// GetUnknownOk returns a tuple with the Unknown 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 *MonitorThresholds) GetUnknownOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.Unknown.Get(), o.Unknown.IsSet() -} - -// HasUnknown returns a boolean if a field has been set. -func (o *MonitorThresholds) HasUnknown() bool { - if o != nil && o.Unknown.IsSet() { - return true - } - - return false -} - -// SetUnknown gets a reference to the given common.NullableFloat64 and assigns it to the Unknown field. -func (o *MonitorThresholds) SetUnknown(v float64) { - o.Unknown.Set(&v) -} - -// SetUnknownNil sets the value for Unknown to be an explicit nil. -func (o *MonitorThresholds) SetUnknownNil() { - o.Unknown.Set(nil) -} - -// UnsetUnknown ensures that no value is present for Unknown, not even an explicit nil. -func (o *MonitorThresholds) UnsetUnknown() { - o.Unknown.Unset() -} - -// GetWarning returns the Warning field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorThresholds) GetWarning() float64 { - if o == nil || o.Warning.Get() == nil { - var ret float64 - return ret - } - return *o.Warning.Get() -} - -// GetWarningOk returns a tuple with the Warning 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 *MonitorThresholds) GetWarningOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.Warning.Get(), o.Warning.IsSet() -} - -// HasWarning returns a boolean if a field has been set. -func (o *MonitorThresholds) HasWarning() bool { - if o != nil && o.Warning.IsSet() { - return true - } - - return false -} - -// SetWarning gets a reference to the given common.NullableFloat64 and assigns it to the Warning field. -func (o *MonitorThresholds) SetWarning(v float64) { - o.Warning.Set(&v) -} - -// SetWarningNil sets the value for Warning to be an explicit nil. -func (o *MonitorThresholds) SetWarningNil() { - o.Warning.Set(nil) -} - -// UnsetWarning ensures that no value is present for Warning, not even an explicit nil. -func (o *MonitorThresholds) UnsetWarning() { - o.Warning.Unset() -} - -// GetWarningRecovery returns the WarningRecovery field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorThresholds) GetWarningRecovery() float64 { - if o == nil || o.WarningRecovery.Get() == nil { - var ret float64 - return ret - } - return *o.WarningRecovery.Get() -} - -// GetWarningRecoveryOk returns a tuple with the WarningRecovery 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 *MonitorThresholds) GetWarningRecoveryOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.WarningRecovery.Get(), o.WarningRecovery.IsSet() -} - -// HasWarningRecovery returns a boolean if a field has been set. -func (o *MonitorThresholds) HasWarningRecovery() bool { - if o != nil && o.WarningRecovery.IsSet() { - return true - } - - return false -} - -// SetWarningRecovery gets a reference to the given common.NullableFloat64 and assigns it to the WarningRecovery field. -func (o *MonitorThresholds) SetWarningRecovery(v float64) { - o.WarningRecovery.Set(&v) -} - -// SetWarningRecoveryNil sets the value for WarningRecovery to be an explicit nil. -func (o *MonitorThresholds) SetWarningRecoveryNil() { - o.WarningRecovery.Set(nil) -} - -// UnsetWarningRecovery ensures that no value is present for WarningRecovery, not even an explicit nil. -func (o *MonitorThresholds) UnsetWarningRecovery() { - o.WarningRecovery.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorThresholds) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Critical != nil { - toSerialize["critical"] = o.Critical - } - if o.CriticalRecovery.IsSet() { - toSerialize["critical_recovery"] = o.CriticalRecovery.Get() - } - if o.Ok.IsSet() { - toSerialize["ok"] = o.Ok.Get() - } - if o.Unknown.IsSet() { - toSerialize["unknown"] = o.Unknown.Get() - } - if o.Warning.IsSet() { - toSerialize["warning"] = o.Warning.Get() - } - if o.WarningRecovery.IsSet() { - toSerialize["warning_recovery"] = o.WarningRecovery.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorThresholds) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Critical *float64 `json:"critical,omitempty"` - CriticalRecovery common.NullableFloat64 `json:"critical_recovery,omitempty"` - Ok common.NullableFloat64 `json:"ok,omitempty"` - Unknown common.NullableFloat64 `json:"unknown,omitempty"` - Warning common.NullableFloat64 `json:"warning,omitempty"` - WarningRecovery common.NullableFloat64 `json:"warning_recovery,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Critical = all.Critical - o.CriticalRecovery = all.CriticalRecovery - o.Ok = all.Ok - o.Unknown = all.Unknown - o.Warning = all.Warning - o.WarningRecovery = all.WarningRecovery - return nil -} diff --git a/api/v1/datadog/model_monitor_type.go b/api/v1/datadog/model_monitor_type.go deleted file mode 100644 index c8fd2682cc5..00000000000 --- a/api/v1/datadog/model_monitor_type.go +++ /dev/null @@ -1,137 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonitorType The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. -type MonitorType string - -// List of MonitorType. -const ( - MONITORTYPE_COMPOSITE MonitorType = "composite" - MONITORTYPE_EVENT_ALERT MonitorType = "event alert" - MONITORTYPE_LOG_ALERT MonitorType = "log alert" - MONITORTYPE_METRIC_ALERT MonitorType = "metric alert" - MONITORTYPE_PROCESS_ALERT MonitorType = "process alert" - MONITORTYPE_QUERY_ALERT MonitorType = "query alert" - MONITORTYPE_RUM_ALERT MonitorType = "rum alert" - MONITORTYPE_SERVICE_CHECK MonitorType = "service check" - MONITORTYPE_SYNTHETICS_ALERT MonitorType = "synthetics alert" - MONITORTYPE_TRACE_ANALYTICS_ALERT MonitorType = "trace-analytics alert" - MONITORTYPE_SLO_ALERT MonitorType = "slo alert" - MONITORTYPE_EVENT_V2_ALERT MonitorType = "event-v2 alert" - MONITORTYPE_AUDIT_ALERT MonitorType = "audit alert" - MONITORTYPE_CI_PIPELINES_ALERT MonitorType = "ci-pipelines alert" - MONITORTYPE_CI_TESTS_ALERT MonitorType = "ci-tests alert" - MONITORTYPE_ERROR_TRACKING_ALERT MonitorType = "error-tracking alert" -) - -var allowedMonitorTypeEnumValues = []MonitorType{ - MONITORTYPE_COMPOSITE, - MONITORTYPE_EVENT_ALERT, - MONITORTYPE_LOG_ALERT, - MONITORTYPE_METRIC_ALERT, - MONITORTYPE_PROCESS_ALERT, - MONITORTYPE_QUERY_ALERT, - MONITORTYPE_RUM_ALERT, - MONITORTYPE_SERVICE_CHECK, - MONITORTYPE_SYNTHETICS_ALERT, - MONITORTYPE_TRACE_ANALYTICS_ALERT, - MONITORTYPE_SLO_ALERT, - MONITORTYPE_EVENT_V2_ALERT, - MONITORTYPE_AUDIT_ALERT, - MONITORTYPE_CI_PIPELINES_ALERT, - MONITORTYPE_CI_TESTS_ALERT, - MONITORTYPE_ERROR_TRACKING_ALERT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonitorType) GetAllowedValues() []MonitorType { - return allowedMonitorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonitorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonitorType(value) - return nil -} - -// NewMonitorTypeFromValue returns a pointer to a valid MonitorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonitorTypeFromValue(v string) (*MonitorType, error) { - ev := MonitorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonitorType: valid values are %v", v, allowedMonitorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonitorType) IsValid() bool { - for _, existing := range allowedMonitorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonitorType value. -func (v MonitorType) Ptr() *MonitorType { - return &v -} - -// NullableMonitorType handles when a null is used for MonitorType. -type NullableMonitorType struct { - value *MonitorType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorType) Get() *MonitorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorType) Set(val *MonitorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonitorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorType initializes the struct as if Set has been called. -func NewNullableMonitorType(val *MonitorType) *NullableMonitorType { - return &NullableMonitorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monitor_update_request.go b/api/v1/datadog/model_monitor_update_request.go deleted file mode 100644 index dd631de60e4..00000000000 --- a/api/v1/datadog/model_monitor_update_request.go +++ /dev/null @@ -1,746 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonitorUpdateRequest Object describing a monitor update request. -type MonitorUpdateRequest struct { - // Timestamp of the monitor creation. - Created *time.Time `json:"created,omitempty"` - // Object describing the creator of the shared element. - Creator *Creator `json:"creator,omitempty"` - // Whether or not the monitor is deleted. (Always `null`) - Deleted common.NullableTime `json:"deleted,omitempty"` - // ID of this monitor. - Id *int64 `json:"id,omitempty"` - // A message to include with notifications for this monitor. - Message *string `json:"message,omitempty"` - // Last timestamp when the monitor was edited. - Modified *time.Time `json:"modified,omitempty"` - // Whether or not the monitor is broken down on different groups. - Multi *bool `json:"multi,omitempty"` - // The monitor name. - Name *string `json:"name,omitempty"` - // List of options associated with your monitor. - Options *MonitorOptions `json:"options,omitempty"` - // The different states your monitor can be in. - OverallState *MonitorOverallStates `json:"overall_state,omitempty"` - // Integer from 1 (high) to 5 (low) indicating alert severity. - Priority *int64 `json:"priority,omitempty"` - // The monitor query. - Query *string `json:"query,omitempty"` - // A list of unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the [Roles API](https://docs.datadoghq.com/api/latest/roles/#list-roles) and are located in the `data.id` field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. `restricted_roles` is the successor of `locked`. For more information about `locked` and `restricted_roles`, see the [monitor options docs](https://docs.datadoghq.com/monitors/guide/monitor_api_options/#permissions-options). - RestrictedRoles []string `json:"restricted_roles,omitempty"` - // Wrapper object with the different monitor states. - State *MonitorState `json:"state,omitempty"` - // Tags associated to your monitor. - Tags []string `json:"tags,omitempty"` - // The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. - Type *MonitorType `json:"type,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{} -} - -// NewMonitorUpdateRequest instantiates a new MonitorUpdateRequest 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 NewMonitorUpdateRequest() *MonitorUpdateRequest { - this := MonitorUpdateRequest{} - return &this -} - -// NewMonitorUpdateRequestWithDefaults instantiates a new MonitorUpdateRequest 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 NewMonitorUpdateRequestWithDefaults() *MonitorUpdateRequest { - this := MonitorUpdateRequest{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *MonitorUpdateRequest) SetCreated(v time.Time) { - o.Created = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetCreator() Creator { - if o == nil || o.Creator == nil { - var ret Creator - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetCreatorOk() (*Creator, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given Creator and assigns it to the Creator field. -func (o *MonitorUpdateRequest) SetCreator(v Creator) { - o.Creator = &v -} - -// GetDeleted returns the Deleted field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonitorUpdateRequest) GetDeleted() time.Time { - if o == nil || o.Deleted.Get() == nil { - var ret time.Time - return ret - } - return *o.Deleted.Get() -} - -// GetDeletedOk returns a tuple with the Deleted 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 *MonitorUpdateRequest) GetDeletedOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.Deleted.Get(), o.Deleted.IsSet() -} - -// HasDeleted returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasDeleted() bool { - if o != nil && o.Deleted.IsSet() { - return true - } - - return false -} - -// SetDeleted gets a reference to the given common.NullableTime and assigns it to the Deleted field. -func (o *MonitorUpdateRequest) SetDeleted(v time.Time) { - o.Deleted.Set(&v) -} - -// SetDeletedNil sets the value for Deleted to be an explicit nil. -func (o *MonitorUpdateRequest) SetDeletedNil() { - o.Deleted.Set(nil) -} - -// UnsetDeleted ensures that no value is present for Deleted, not even an explicit nil. -func (o *MonitorUpdateRequest) UnsetDeleted() { - o.Deleted.Unset() -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *MonitorUpdateRequest) SetId(v int64) { - o.Id = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *MonitorUpdateRequest) SetMessage(v string) { - o.Message = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *MonitorUpdateRequest) SetModified(v time.Time) { - o.Modified = &v -} - -// GetMulti returns the Multi field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetMulti() bool { - if o == nil || o.Multi == nil { - var ret bool - return ret - } - return *o.Multi -} - -// GetMultiOk returns a tuple with the Multi field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetMultiOk() (*bool, bool) { - if o == nil || o.Multi == nil { - return nil, false - } - return o.Multi, true -} - -// HasMulti returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasMulti() bool { - if o != nil && o.Multi != nil { - return true - } - - return false -} - -// SetMulti gets a reference to the given bool and assigns it to the Multi field. -func (o *MonitorUpdateRequest) SetMulti(v bool) { - o.Multi = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *MonitorUpdateRequest) SetName(v string) { - o.Name = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetOptions() MonitorOptions { - if o == nil || o.Options == nil { - var ret MonitorOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetOptionsOk() (*MonitorOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given MonitorOptions and assigns it to the Options field. -func (o *MonitorUpdateRequest) SetOptions(v MonitorOptions) { - o.Options = &v -} - -// GetOverallState returns the OverallState field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetOverallState() MonitorOverallStates { - if o == nil || o.OverallState == nil { - var ret MonitorOverallStates - return ret - } - return *o.OverallState -} - -// GetOverallStateOk returns a tuple with the OverallState field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetOverallStateOk() (*MonitorOverallStates, bool) { - if o == nil || o.OverallState == nil { - return nil, false - } - return o.OverallState, true -} - -// HasOverallState returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasOverallState() bool { - if o != nil && o.OverallState != nil { - return true - } - - return false -} - -// SetOverallState gets a reference to the given MonitorOverallStates and assigns it to the OverallState field. -func (o *MonitorUpdateRequest) SetOverallState(v MonitorOverallStates) { - o.OverallState = &v -} - -// GetPriority returns the Priority field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetPriority() int64 { - if o == nil || o.Priority == nil { - var ret int64 - return ret - } - return *o.Priority -} - -// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetPriorityOk() (*int64, bool) { - if o == nil || o.Priority == nil { - return nil, false - } - return o.Priority, true -} - -// HasPriority returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasPriority() bool { - if o != nil && o.Priority != nil { - return true - } - - return false -} - -// SetPriority gets a reference to the given int64 and assigns it to the Priority field. -func (o *MonitorUpdateRequest) SetPriority(v int64) { - o.Priority = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *MonitorUpdateRequest) SetQuery(v string) { - o.Query = &v -} - -// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetRestrictedRoles() []string { - if o == nil || o.RestrictedRoles == nil { - var ret []string - return ret - } - return o.RestrictedRoles -} - -// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetRestrictedRolesOk() (*[]string, bool) { - if o == nil || o.RestrictedRoles == nil { - return nil, false - } - return &o.RestrictedRoles, true -} - -// HasRestrictedRoles returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasRestrictedRoles() bool { - if o != nil && o.RestrictedRoles != nil { - return true - } - - return false -} - -// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. -func (o *MonitorUpdateRequest) SetRestrictedRoles(v []string) { - o.RestrictedRoles = v -} - -// GetState returns the State field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetState() MonitorState { - if o == nil || o.State == nil { - var ret MonitorState - return ret - } - return *o.State -} - -// GetStateOk returns a tuple with the State field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetStateOk() (*MonitorState, bool) { - if o == nil || o.State == nil { - return nil, false - } - return o.State, true -} - -// HasState returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasState() bool { - if o != nil && o.State != nil { - return true - } - - return false -} - -// SetState gets a reference to the given MonitorState and assigns it to the State field. -func (o *MonitorUpdateRequest) SetState(v MonitorState) { - o.State = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MonitorUpdateRequest) GetTagsOk() (*[]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 *MonitorUpdateRequest) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MonitorUpdateRequest) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MonitorUpdateRequest) GetType() MonitorType { - if o == nil || o.Type == nil { - var ret MonitorType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorUpdateRequest) GetTypeOk() (*MonitorType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MonitorUpdateRequest) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MonitorType and assigns it to the Type field. -func (o *MonitorUpdateRequest) SetType(v MonitorType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.Deleted.IsSet() { - toSerialize["deleted"] = o.Deleted.Get() - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Multi != nil { - toSerialize["multi"] = o.Multi - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.OverallState != nil { - toSerialize["overall_state"] = o.OverallState - } - if o.Priority != nil { - toSerialize["priority"] = o.Priority - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.RestrictedRoles != nil { - toSerialize["restricted_roles"] = o.RestrictedRoles - } - if o.State != nil { - toSerialize["state"] = o.State - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Created *time.Time `json:"created,omitempty"` - Creator *Creator `json:"creator,omitempty"` - Deleted common.NullableTime `json:"deleted,omitempty"` - Id *int64 `json:"id,omitempty"` - Message *string `json:"message,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Multi *bool `json:"multi,omitempty"` - Name *string `json:"name,omitempty"` - Options *MonitorOptions `json:"options,omitempty"` - OverallState *MonitorOverallStates `json:"overall_state,omitempty"` - Priority *int64 `json:"priority,omitempty"` - Query *string `json:"query,omitempty"` - RestrictedRoles []string `json:"restricted_roles,omitempty"` - State *MonitorState `json:"state,omitempty"` - Tags []string `json:"tags,omitempty"` - Type *MonitorType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.OverallState; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Created = all.Created - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.Deleted = all.Deleted - o.Id = all.Id - o.Message = all.Message - o.Modified = all.Modified - o.Multi = all.Multi - o.Name = all.Name - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.OverallState = all.OverallState - o.Priority = all.Priority - o.Query = all.Query - o.RestrictedRoles = all.RestrictedRoles - if all.State != nil && all.State.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.State = all.State - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_monthly_usage_attribution_body.go b/api/v1/datadog/model_monthly_usage_attribution_body.go deleted file mode 100644 index 8f88a93ad9f..00000000000 --- a/api/v1/datadog/model_monthly_usage_attribution_body.go +++ /dev/null @@ -1,356 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// MonthlyUsageAttributionBody Usage Summary by tag for a given organization. -type MonthlyUsageAttributionBody struct { - // Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM]. - Month *time.Time `json:"month,omitempty"` - // The name of the organization. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The source of the usage attribution tag configuration and the selected tags in the format `::://////`. - TagConfigSource *string `json:"tag_config_source,omitempty"` - // Tag keys and values. - // - // A `null` value here means that the requested tag breakdown cannot be applied because it does not match the [tags - // configured for usage attribution](https://docs.datadoghq.com/account_management/billing/usage_attribution/#getting-started). - // In this scenario the API returns the total usage, not broken down by tags. - Tags map[string][]string `json:"tags,omitempty"` - // Datetime of the most recent update to the usage values. - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // Fields in Usage Summary by tag(s). - Values *MonthlyUsageAttributionValues `json:"values,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{} -} - -// NewMonthlyUsageAttributionBody instantiates a new MonthlyUsageAttributionBody 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 NewMonthlyUsageAttributionBody() *MonthlyUsageAttributionBody { - this := MonthlyUsageAttributionBody{} - return &this -} - -// NewMonthlyUsageAttributionBodyWithDefaults instantiates a new MonthlyUsageAttributionBody 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 NewMonthlyUsageAttributionBodyWithDefaults() *MonthlyUsageAttributionBody { - this := MonthlyUsageAttributionBody{} - return &this -} - -// GetMonth returns the Month field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionBody) GetMonth() time.Time { - if o == nil || o.Month == nil { - var ret time.Time - return ret - } - return *o.Month -} - -// GetMonthOk returns a tuple with the Month field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionBody) GetMonthOk() (*time.Time, bool) { - if o == nil || o.Month == nil { - return nil, false - } - return o.Month, true -} - -// HasMonth returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionBody) HasMonth() bool { - if o != nil && o.Month != nil { - return true - } - - return false -} - -// SetMonth gets a reference to the given time.Time and assigns it to the Month field. -func (o *MonthlyUsageAttributionBody) SetMonth(v time.Time) { - o.Month = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionBody) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionBody) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionBody) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *MonthlyUsageAttributionBody) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionBody) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionBody) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionBody) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *MonthlyUsageAttributionBody) SetPublicId(v string) { - o.PublicId = &v -} - -// GetTagConfigSource returns the TagConfigSource field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionBody) GetTagConfigSource() string { - if o == nil || o.TagConfigSource == nil { - var ret string - return ret - } - return *o.TagConfigSource -} - -// GetTagConfigSourceOk returns a tuple with the TagConfigSource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionBody) GetTagConfigSourceOk() (*string, bool) { - if o == nil || o.TagConfigSource == nil { - return nil, false - } - return o.TagConfigSource, true -} - -// HasTagConfigSource returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionBody) HasTagConfigSource() bool { - if o != nil && o.TagConfigSource != nil { - return true - } - - return false -} - -// SetTagConfigSource gets a reference to the given string and assigns it to the TagConfigSource field. -func (o *MonthlyUsageAttributionBody) SetTagConfigSource(v string) { - o.TagConfigSource = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionBody) 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 *MonthlyUsageAttributionBody) 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 *MonthlyUsageAttributionBody) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. -func (o *MonthlyUsageAttributionBody) SetTags(v map[string][]string) { - o.Tags = v -} - -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionBody) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { - var ret time.Time - return ret - } - return *o.UpdatedAt -} - -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionBody) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { - return nil, false - } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionBody) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false -} - -// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. -func (o *MonthlyUsageAttributionBody) SetUpdatedAt(v time.Time) { - o.UpdatedAt = &v -} - -// GetValues returns the Values field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionBody) GetValues() MonthlyUsageAttributionValues { - if o == nil || o.Values == nil { - var ret MonthlyUsageAttributionValues - return ret - } - return *o.Values -} - -// GetValuesOk returns a tuple with the Values field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionBody) GetValuesOk() (*MonthlyUsageAttributionValues, bool) { - if o == nil || o.Values == nil { - return nil, false - } - return o.Values, true -} - -// HasValues returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionBody) HasValues() bool { - if o != nil && o.Values != nil { - return true - } - - return false -} - -// SetValues gets a reference to the given MonthlyUsageAttributionValues and assigns it to the Values field. -func (o *MonthlyUsageAttributionBody) SetValues(v MonthlyUsageAttributionValues) { - o.Values = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonthlyUsageAttributionBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Month != nil { - if o.Month.Nanosecond() == 0 { - toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.TagConfigSource != nil { - toSerialize["tag_config_source"] = o.TagConfigSource - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.UpdatedAt != nil { - if o.UpdatedAt.Nanosecond() == 0 { - toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Values != nil { - toSerialize["values"] = o.Values - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonthlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Month *time.Time `json:"month,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - TagConfigSource *string `json:"tag_config_source,omitempty"` - Tags map[string][]string `json:"tags,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - Values *MonthlyUsageAttributionValues `json:"values,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Month = all.Month - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.TagConfigSource = all.TagConfigSource - o.Tags = all.Tags - o.UpdatedAt = all.UpdatedAt - if all.Values != nil && all.Values.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Values = all.Values - return nil -} diff --git a/api/v1/datadog/model_monthly_usage_attribution_metadata.go b/api/v1/datadog/model_monthly_usage_attribution_metadata.go deleted file mode 100644 index a5b04c27487..00000000000 --- a/api/v1/datadog/model_monthly_usage_attribution_metadata.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonthlyUsageAttributionMetadata The object containing document metadata. -type MonthlyUsageAttributionMetadata struct { - // An array of available aggregates. - Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` - // The metadata for the current pagination. - Pagination *MonthlyUsageAttributionPagination `json:"pagination,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{} -} - -// NewMonthlyUsageAttributionMetadata instantiates a new MonthlyUsageAttributionMetadata 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 NewMonthlyUsageAttributionMetadata() *MonthlyUsageAttributionMetadata { - this := MonthlyUsageAttributionMetadata{} - return &this -} - -// NewMonthlyUsageAttributionMetadataWithDefaults instantiates a new MonthlyUsageAttributionMetadata 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 NewMonthlyUsageAttributionMetadataWithDefaults() *MonthlyUsageAttributionMetadata { - this := MonthlyUsageAttributionMetadata{} - return &this -} - -// GetAggregates returns the Aggregates field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionMetadata) GetAggregates() []UsageAttributionAggregatesBody { - if o == nil || o.Aggregates == nil { - var ret []UsageAttributionAggregatesBody - return ret - } - return o.Aggregates -} - -// GetAggregatesOk returns a tuple with the Aggregates field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionMetadata) GetAggregatesOk() (*[]UsageAttributionAggregatesBody, bool) { - if o == nil || o.Aggregates == nil { - return nil, false - } - return &o.Aggregates, true -} - -// HasAggregates returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionMetadata) HasAggregates() bool { - if o != nil && o.Aggregates != nil { - return true - } - - return false -} - -// SetAggregates gets a reference to the given []UsageAttributionAggregatesBody and assigns it to the Aggregates field. -func (o *MonthlyUsageAttributionMetadata) SetAggregates(v []UsageAttributionAggregatesBody) { - o.Aggregates = v -} - -// GetPagination returns the Pagination field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionMetadata) GetPagination() MonthlyUsageAttributionPagination { - if o == nil || o.Pagination == nil { - var ret MonthlyUsageAttributionPagination - return ret - } - return *o.Pagination -} - -// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionMetadata) GetPaginationOk() (*MonthlyUsageAttributionPagination, bool) { - if o == nil || o.Pagination == nil { - return nil, false - } - return o.Pagination, true -} - -// HasPagination returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionMetadata) HasPagination() bool { - if o != nil && o.Pagination != nil { - return true - } - - return false -} - -// SetPagination gets a reference to the given MonthlyUsageAttributionPagination and assigns it to the Pagination field. -func (o *MonthlyUsageAttributionMetadata) SetPagination(v MonthlyUsageAttributionPagination) { - o.Pagination = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonthlyUsageAttributionMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregates != nil { - toSerialize["aggregates"] = o.Aggregates - } - if o.Pagination != nil { - toSerialize["pagination"] = o.Pagination - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonthlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` - Pagination *MonthlyUsageAttributionPagination `json:"pagination,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregates = all.Aggregates - if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pagination = all.Pagination - return nil -} diff --git a/api/v1/datadog/model_monthly_usage_attribution_pagination.go b/api/v1/datadog/model_monthly_usage_attribution_pagination.go deleted file mode 100644 index 8911a263d65..00000000000 --- a/api/v1/datadog/model_monthly_usage_attribution_pagination.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MonthlyUsageAttributionPagination The metadata for the current pagination. -type MonthlyUsageAttributionPagination struct { - // The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of the `next_record_id`. - NextRecordId common.NullableString `json:"next_record_id,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{} -} - -// NewMonthlyUsageAttributionPagination instantiates a new MonthlyUsageAttributionPagination 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 NewMonthlyUsageAttributionPagination() *MonthlyUsageAttributionPagination { - this := MonthlyUsageAttributionPagination{} - return &this -} - -// NewMonthlyUsageAttributionPaginationWithDefaults instantiates a new MonthlyUsageAttributionPagination 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 NewMonthlyUsageAttributionPaginationWithDefaults() *MonthlyUsageAttributionPagination { - this := MonthlyUsageAttributionPagination{} - return &this -} - -// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *MonthlyUsageAttributionPagination) GetNextRecordId() string { - if o == nil || o.NextRecordId.Get() == nil { - var ret string - return ret - } - return *o.NextRecordId.Get() -} - -// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *MonthlyUsageAttributionPagination) GetNextRecordIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.NextRecordId.Get(), o.NextRecordId.IsSet() -} - -// HasNextRecordId returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionPagination) HasNextRecordId() bool { - if o != nil && o.NextRecordId.IsSet() { - return true - } - - return false -} - -// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. -func (o *MonthlyUsageAttributionPagination) SetNextRecordId(v string) { - o.NextRecordId.Set(&v) -} - -// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. -func (o *MonthlyUsageAttributionPagination) SetNextRecordIdNil() { - o.NextRecordId.Set(nil) -} - -// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. -func (o *MonthlyUsageAttributionPagination) UnsetNextRecordId() { - o.NextRecordId.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonthlyUsageAttributionPagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.NextRecordId.IsSet() { - toSerialize["next_record_id"] = o.NextRecordId.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonthlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - NextRecordId common.NullableString `json:"next_record_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.NextRecordId = all.NextRecordId - return nil -} diff --git a/api/v1/datadog/model_monthly_usage_attribution_response.go b/api/v1/datadog/model_monthly_usage_attribution_response.go deleted file mode 100644 index 9c7c9ac5914..00000000000 --- a/api/v1/datadog/model_monthly_usage_attribution_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonthlyUsageAttributionResponse Response containing the monthly Usage Summary by tag(s). -type MonthlyUsageAttributionResponse struct { - // The object containing document metadata. - Metadata *MonthlyUsageAttributionMetadata `json:"metadata,omitempty"` - // Get usage summary by tag(s). - Usage []MonthlyUsageAttributionBody `json:"usage,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{} -} - -// NewMonthlyUsageAttributionResponse instantiates a new MonthlyUsageAttributionResponse 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 NewMonthlyUsageAttributionResponse() *MonthlyUsageAttributionResponse { - this := MonthlyUsageAttributionResponse{} - return &this -} - -// NewMonthlyUsageAttributionResponseWithDefaults instantiates a new MonthlyUsageAttributionResponse 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 NewMonthlyUsageAttributionResponseWithDefaults() *MonthlyUsageAttributionResponse { - this := MonthlyUsageAttributionResponse{} - return &this -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionResponse) GetMetadata() MonthlyUsageAttributionMetadata { - if o == nil || o.Metadata == nil { - var ret MonthlyUsageAttributionMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionResponse) GetMetadataOk() (*MonthlyUsageAttributionMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionResponse) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given MonthlyUsageAttributionMetadata and assigns it to the Metadata field. -func (o *MonthlyUsageAttributionResponse) SetMetadata(v MonthlyUsageAttributionMetadata) { - o.Metadata = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionResponse) GetUsage() []MonthlyUsageAttributionBody { - if o == nil || o.Usage == nil { - var ret []MonthlyUsageAttributionBody - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionResponse) GetUsageOk() (*[]MonthlyUsageAttributionBody, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []MonthlyUsageAttributionBody and assigns it to the Usage field. -func (o *MonthlyUsageAttributionResponse) SetUsage(v []MonthlyUsageAttributionBody) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonthlyUsageAttributionResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonthlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Metadata *MonthlyUsageAttributionMetadata `json:"metadata,omitempty"` - Usage []MonthlyUsageAttributionBody `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go b/api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go deleted file mode 100644 index 14e4838e2c9..00000000000 --- a/api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go +++ /dev/null @@ -1,203 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MonthlyUsageAttributionSupportedMetrics Supported metrics for monthly usage attribution requests. -type MonthlyUsageAttributionSupportedMetrics string - -// List of MonthlyUsageAttributionSupportedMetrics. -const ( - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE MonthlyUsageAttributionSupportedMetrics = "api_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "api_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "apm_host_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "apm_host_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE MonthlyUsageAttributionSupportedMetrics = "appsec_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "appsec_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE MonthlyUsageAttributionSupportedMetrics = "browser_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "browser_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE MonthlyUsageAttributionSupportedMetrics = "container_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "container_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cspm_containers_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_USAGE MonthlyUsageAttributionSupportedMetrics = "cspm_containers_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cspm_hosts_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_USAGE MonthlyUsageAttributionSupportedMetrics = "cspm_hosts_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE MonthlyUsageAttributionSupportedMetrics = "custom_timeseries_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "custom_timeseries_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cws_containers_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_USAGE MonthlyUsageAttributionSupportedMetrics = "cws_containers_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cws_hosts_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_USAGE MonthlyUsageAttributionSupportedMetrics = "cws_hosts_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "dbm_hosts_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE MonthlyUsageAttributionSupportedMetrics = "dbm_hosts_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "dbm_queries_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE MonthlyUsageAttributionSupportedMetrics = "dbm_queries_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_logs_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_logs_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_spans_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_spans_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE MonthlyUsageAttributionSupportedMetrics = "estimated_ingested_spans_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "estimated_ingested_spans_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE MonthlyUsageAttributionSupportedMetrics = "fargate_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "fargate_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_USAGE MonthlyUsageAttributionSupportedMetrics = "functions_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "functions_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_USAGE MonthlyUsageAttributionSupportedMetrics = "indexed_logs_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "indexed_logs_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "infra_host_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "infra_host_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_USAGE MonthlyUsageAttributionSupportedMetrics = "invocations_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "invocations_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "npm_host_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "npm_host_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE MonthlyUsageAttributionSupportedMetrics = "profiled_container_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "profiled_container_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "profiled_host_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "profiled_host_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE MonthlyUsageAttributionSupportedMetrics = "snmp_usage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "snmp_percentage" - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ALL MonthlyUsageAttributionSupportedMetrics = "*" -) - -var allowedMonthlyUsageAttributionSupportedMetricsEnumValues = []MonthlyUsageAttributionSupportedMetrics{ - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE, - MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ALL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MonthlyUsageAttributionSupportedMetrics) GetAllowedValues() []MonthlyUsageAttributionSupportedMetrics { - return allowedMonthlyUsageAttributionSupportedMetricsEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MonthlyUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MonthlyUsageAttributionSupportedMetrics(value) - return nil -} - -// NewMonthlyUsageAttributionSupportedMetricsFromValue returns a pointer to a valid MonthlyUsageAttributionSupportedMetrics -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMonthlyUsageAttributionSupportedMetricsFromValue(v string) (*MonthlyUsageAttributionSupportedMetrics, error) { - ev := MonthlyUsageAttributionSupportedMetrics(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MonthlyUsageAttributionSupportedMetrics: valid values are %v", v, allowedMonthlyUsageAttributionSupportedMetricsEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MonthlyUsageAttributionSupportedMetrics) IsValid() bool { - for _, existing := range allowedMonthlyUsageAttributionSupportedMetricsEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MonthlyUsageAttributionSupportedMetrics value. -func (v MonthlyUsageAttributionSupportedMetrics) Ptr() *MonthlyUsageAttributionSupportedMetrics { - return &v -} - -// NullableMonthlyUsageAttributionSupportedMetrics handles when a null is used for MonthlyUsageAttributionSupportedMetrics. -type NullableMonthlyUsageAttributionSupportedMetrics struct { - value *MonthlyUsageAttributionSupportedMetrics - isSet bool -} - -// Get returns the associated value. -func (v NullableMonthlyUsageAttributionSupportedMetrics) Get() *MonthlyUsageAttributionSupportedMetrics { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonthlyUsageAttributionSupportedMetrics) Set(val *MonthlyUsageAttributionSupportedMetrics) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonthlyUsageAttributionSupportedMetrics) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMonthlyUsageAttributionSupportedMetrics) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonthlyUsageAttributionSupportedMetrics initializes the struct as if Set has been called. -func NewNullableMonthlyUsageAttributionSupportedMetrics(val *MonthlyUsageAttributionSupportedMetrics) *NullableMonthlyUsageAttributionSupportedMetrics { - return &NullableMonthlyUsageAttributionSupportedMetrics{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonthlyUsageAttributionSupportedMetrics) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonthlyUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_monthly_usage_attribution_values.go b/api/v1/datadog/model_monthly_usage_attribution_values.go deleted file mode 100644 index 8138c2b3cfc..00000000000 --- a/api/v1/datadog/model_monthly_usage_attribution_values.go +++ /dev/null @@ -1,1467 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonthlyUsageAttributionValues Fields in Usage Summary by tag(s). -type MonthlyUsageAttributionValues struct { - // The percentage of synthetic API test usage by tag(s). - ApiPercentage *float64 `json:"api_percentage,omitempty"` - // The synthetic API test usage by tag(s). - ApiUsage *float64 `json:"api_usage,omitempty"` - // The percentage of APM host usage by tag(s). - ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` - // The APM host usage by tag(s). - ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` - // The percentage of Application Security Monitoring host usage by tag(s). - AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` - // The Application Security Monitoring host usage by tag(s). - AppsecUsage *float64 `json:"appsec_usage,omitempty"` - // The percentage of synthetic browser test usage by tag(s). - BrowserPercentage *float64 `json:"browser_percentage,omitempty"` - // The synthetic browser test usage by tag(s). - BrowserUsage *float64 `json:"browser_usage,omitempty"` - // The percentage of container usage by tag(s). - ContainerPercentage *float64 `json:"container_percentage,omitempty"` - // The container usage by tag(s). - ContainerUsage *float64 `json:"container_usage,omitempty"` - // The percentage of custom metrics usage by tag(s). - CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` - // The custom metrics usage by tag(s). - CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` - // The percentage of estimated live indexed logs usage by tag(s). This field is in private beta. - EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` - // The estimated live indexed logs usage by tag(s). This field is in private beta. - EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` - // The percentage of estimated indexed spans usage by tag(s). This field is in private beta. - EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` - // The estimated indexed spans usage by tag(s). This field is in private beta. - EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` - // The percentage of estimated ingested spans usage by tag(s). This field is in private beta. - EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` - // The estimated ingested spans usage by tag(s). This field is in private beta. - EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` - // The percentage of Fargate usage by tags. - FargatePercentage *float64 `json:"fargate_percentage,omitempty"` - // The Fargate usage by tags. - FargateUsage *float64 `json:"fargate_usage,omitempty"` - // The percentage of Lambda function usage by tag(s). - FunctionsPercentage *float64 `json:"functions_percentage,omitempty"` - // The Lambda function usage by tag(s). - FunctionsUsage *float64 `json:"functions_usage,omitempty"` - // The percentage of indexed logs usage by tags. - IndexedLogsPercentage *float64 `json:"indexed_logs_percentage,omitempty"` - // The indexed logs usage by tags. - IndexedLogsUsage *float64 `json:"indexed_logs_usage,omitempty"` - // The percentage of infrastructure host usage by tag(s). - InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` - // The infrastructure host usage by tag(s). - InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` - // The percentage of Lambda invocation usage by tag(s). - InvocationsPercentage *float64 `json:"invocations_percentage,omitempty"` - // The Lambda invocation usage by tag(s). - InvocationsUsage *float64 `json:"invocations_usage,omitempty"` - // The percentage of network host usage by tag(s). - NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` - // The network host usage by tag(s). - NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` - // The percentage of profiled container usage by tag(s). - ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` - // The profiled container usage by tag(s). - ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` - // The percentage of profiled hosts usage by tag(s). - ProfiledHostPercentage *float64 `json:"profiled_host_percentage,omitempty"` - // The profiled hosts usage by tag(s). - ProfiledHostUsage *float64 `json:"profiled_host_usage,omitempty"` - // The percentage of network device usage by tag(s). - SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` - // The network device usage by tag(s). - SnmpUsage *float64 `json:"snmp_usage,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{} -} - -// NewMonthlyUsageAttributionValues instantiates a new MonthlyUsageAttributionValues 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 NewMonthlyUsageAttributionValues() *MonthlyUsageAttributionValues { - this := MonthlyUsageAttributionValues{} - return &this -} - -// NewMonthlyUsageAttributionValuesWithDefaults instantiates a new MonthlyUsageAttributionValues 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 NewMonthlyUsageAttributionValuesWithDefaults() *MonthlyUsageAttributionValues { - this := MonthlyUsageAttributionValues{} - return &this -} - -// GetApiPercentage returns the ApiPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetApiPercentage() float64 { - if o == nil || o.ApiPercentage == nil { - var ret float64 - return ret - } - return *o.ApiPercentage -} - -// GetApiPercentageOk returns a tuple with the ApiPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetApiPercentageOk() (*float64, bool) { - if o == nil || o.ApiPercentage == nil { - return nil, false - } - return o.ApiPercentage, true -} - -// HasApiPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasApiPercentage() bool { - if o != nil && o.ApiPercentage != nil { - return true - } - - return false -} - -// SetApiPercentage gets a reference to the given float64 and assigns it to the ApiPercentage field. -func (o *MonthlyUsageAttributionValues) SetApiPercentage(v float64) { - o.ApiPercentage = &v -} - -// GetApiUsage returns the ApiUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetApiUsage() float64 { - if o == nil || o.ApiUsage == nil { - var ret float64 - return ret - } - return *o.ApiUsage -} - -// GetApiUsageOk returns a tuple with the ApiUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetApiUsageOk() (*float64, bool) { - if o == nil || o.ApiUsage == nil { - return nil, false - } - return o.ApiUsage, true -} - -// HasApiUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasApiUsage() bool { - if o != nil && o.ApiUsage != nil { - return true - } - - return false -} - -// SetApiUsage gets a reference to the given float64 and assigns it to the ApiUsage field. -func (o *MonthlyUsageAttributionValues) SetApiUsage(v float64) { - o.ApiUsage = &v -} - -// GetApmHostPercentage returns the ApmHostPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetApmHostPercentage() float64 { - if o == nil || o.ApmHostPercentage == nil { - var ret float64 - return ret - } - return *o.ApmHostPercentage -} - -// GetApmHostPercentageOk returns a tuple with the ApmHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetApmHostPercentageOk() (*float64, bool) { - if o == nil || o.ApmHostPercentage == nil { - return nil, false - } - return o.ApmHostPercentage, true -} - -// HasApmHostPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasApmHostPercentage() bool { - if o != nil && o.ApmHostPercentage != nil { - return true - } - - return false -} - -// SetApmHostPercentage gets a reference to the given float64 and assigns it to the ApmHostPercentage field. -func (o *MonthlyUsageAttributionValues) SetApmHostPercentage(v float64) { - o.ApmHostPercentage = &v -} - -// GetApmHostUsage returns the ApmHostUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetApmHostUsage() float64 { - if o == nil || o.ApmHostUsage == nil { - var ret float64 - return ret - } - return *o.ApmHostUsage -} - -// GetApmHostUsageOk returns a tuple with the ApmHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetApmHostUsageOk() (*float64, bool) { - if o == nil || o.ApmHostUsage == nil { - return nil, false - } - return o.ApmHostUsage, true -} - -// HasApmHostUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasApmHostUsage() bool { - if o != nil && o.ApmHostUsage != nil { - return true - } - - return false -} - -// SetApmHostUsage gets a reference to the given float64 and assigns it to the ApmHostUsage field. -func (o *MonthlyUsageAttributionValues) SetApmHostUsage(v float64) { - o.ApmHostUsage = &v -} - -// GetAppsecPercentage returns the AppsecPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetAppsecPercentage() float64 { - if o == nil || o.AppsecPercentage == nil { - var ret float64 - return ret - } - return *o.AppsecPercentage -} - -// GetAppsecPercentageOk returns a tuple with the AppsecPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetAppsecPercentageOk() (*float64, bool) { - if o == nil || o.AppsecPercentage == nil { - return nil, false - } - return o.AppsecPercentage, true -} - -// HasAppsecPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasAppsecPercentage() bool { - if o != nil && o.AppsecPercentage != nil { - return true - } - - return false -} - -// SetAppsecPercentage gets a reference to the given float64 and assigns it to the AppsecPercentage field. -func (o *MonthlyUsageAttributionValues) SetAppsecPercentage(v float64) { - o.AppsecPercentage = &v -} - -// GetAppsecUsage returns the AppsecUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetAppsecUsage() float64 { - if o == nil || o.AppsecUsage == nil { - var ret float64 - return ret - } - return *o.AppsecUsage -} - -// GetAppsecUsageOk returns a tuple with the AppsecUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetAppsecUsageOk() (*float64, bool) { - if o == nil || o.AppsecUsage == nil { - return nil, false - } - return o.AppsecUsage, true -} - -// HasAppsecUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasAppsecUsage() bool { - if o != nil && o.AppsecUsage != nil { - return true - } - - return false -} - -// SetAppsecUsage gets a reference to the given float64 and assigns it to the AppsecUsage field. -func (o *MonthlyUsageAttributionValues) SetAppsecUsage(v float64) { - o.AppsecUsage = &v -} - -// GetBrowserPercentage returns the BrowserPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetBrowserPercentage() float64 { - if o == nil || o.BrowserPercentage == nil { - var ret float64 - return ret - } - return *o.BrowserPercentage -} - -// GetBrowserPercentageOk returns a tuple with the BrowserPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetBrowserPercentageOk() (*float64, bool) { - if o == nil || o.BrowserPercentage == nil { - return nil, false - } - return o.BrowserPercentage, true -} - -// HasBrowserPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasBrowserPercentage() bool { - if o != nil && o.BrowserPercentage != nil { - return true - } - - return false -} - -// SetBrowserPercentage gets a reference to the given float64 and assigns it to the BrowserPercentage field. -func (o *MonthlyUsageAttributionValues) SetBrowserPercentage(v float64) { - o.BrowserPercentage = &v -} - -// GetBrowserUsage returns the BrowserUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetBrowserUsage() float64 { - if o == nil || o.BrowserUsage == nil { - var ret float64 - return ret - } - return *o.BrowserUsage -} - -// GetBrowserUsageOk returns a tuple with the BrowserUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetBrowserUsageOk() (*float64, bool) { - if o == nil || o.BrowserUsage == nil { - return nil, false - } - return o.BrowserUsage, true -} - -// HasBrowserUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasBrowserUsage() bool { - if o != nil && o.BrowserUsage != nil { - return true - } - - return false -} - -// SetBrowserUsage gets a reference to the given float64 and assigns it to the BrowserUsage field. -func (o *MonthlyUsageAttributionValues) SetBrowserUsage(v float64) { - o.BrowserUsage = &v -} - -// GetContainerPercentage returns the ContainerPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetContainerPercentage() float64 { - if o == nil || o.ContainerPercentage == nil { - var ret float64 - return ret - } - return *o.ContainerPercentage -} - -// GetContainerPercentageOk returns a tuple with the ContainerPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetContainerPercentageOk() (*float64, bool) { - if o == nil || o.ContainerPercentage == nil { - return nil, false - } - return o.ContainerPercentage, true -} - -// HasContainerPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasContainerPercentage() bool { - if o != nil && o.ContainerPercentage != nil { - return true - } - - return false -} - -// SetContainerPercentage gets a reference to the given float64 and assigns it to the ContainerPercentage field. -func (o *MonthlyUsageAttributionValues) SetContainerPercentage(v float64) { - o.ContainerPercentage = &v -} - -// GetContainerUsage returns the ContainerUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetContainerUsage() float64 { - if o == nil || o.ContainerUsage == nil { - var ret float64 - return ret - } - return *o.ContainerUsage -} - -// GetContainerUsageOk returns a tuple with the ContainerUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetContainerUsageOk() (*float64, bool) { - if o == nil || o.ContainerUsage == nil { - return nil, false - } - return o.ContainerUsage, true -} - -// HasContainerUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasContainerUsage() bool { - if o != nil && o.ContainerUsage != nil { - return true - } - - return false -} - -// SetContainerUsage gets a reference to the given float64 and assigns it to the ContainerUsage field. -func (o *MonthlyUsageAttributionValues) SetContainerUsage(v float64) { - o.ContainerUsage = &v -} - -// GetCustomTimeseriesPercentage returns the CustomTimeseriesPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesPercentage() float64 { - if o == nil || o.CustomTimeseriesPercentage == nil { - var ret float64 - return ret - } - return *o.CustomTimeseriesPercentage -} - -// GetCustomTimeseriesPercentageOk returns a tuple with the CustomTimeseriesPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesPercentageOk() (*float64, bool) { - if o == nil || o.CustomTimeseriesPercentage == nil { - return nil, false - } - return o.CustomTimeseriesPercentage, true -} - -// HasCustomTimeseriesPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasCustomTimeseriesPercentage() bool { - if o != nil && o.CustomTimeseriesPercentage != nil { - return true - } - - return false -} - -// SetCustomTimeseriesPercentage gets a reference to the given float64 and assigns it to the CustomTimeseriesPercentage field. -func (o *MonthlyUsageAttributionValues) SetCustomTimeseriesPercentage(v float64) { - o.CustomTimeseriesPercentage = &v -} - -// GetCustomTimeseriesUsage returns the CustomTimeseriesUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesUsage() float64 { - if o == nil || o.CustomTimeseriesUsage == nil { - var ret float64 - return ret - } - return *o.CustomTimeseriesUsage -} - -// GetCustomTimeseriesUsageOk returns a tuple with the CustomTimeseriesUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesUsageOk() (*float64, bool) { - if o == nil || o.CustomTimeseriesUsage == nil { - return nil, false - } - return o.CustomTimeseriesUsage, true -} - -// HasCustomTimeseriesUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasCustomTimeseriesUsage() bool { - if o != nil && o.CustomTimeseriesUsage != nil { - return true - } - - return false -} - -// SetCustomTimeseriesUsage gets a reference to the given float64 and assigns it to the CustomTimeseriesUsage field. -func (o *MonthlyUsageAttributionValues) SetCustomTimeseriesUsage(v float64) { - o.CustomTimeseriesUsage = &v -} - -// GetEstimatedIndexedLogsPercentage returns the EstimatedIndexedLogsPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsPercentage() float64 { - if o == nil || o.EstimatedIndexedLogsPercentage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedLogsPercentage -} - -// GetEstimatedIndexedLogsPercentageOk returns a tuple with the EstimatedIndexedLogsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsPercentageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedLogsPercentage == nil { - return nil, false - } - return o.EstimatedIndexedLogsPercentage, true -} - -// HasEstimatedIndexedLogsPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedLogsPercentage() bool { - if o != nil && o.EstimatedIndexedLogsPercentage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedLogsPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsPercentage field. -func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedLogsPercentage(v float64) { - o.EstimatedIndexedLogsPercentage = &v -} - -// GetEstimatedIndexedLogsUsage returns the EstimatedIndexedLogsUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsUsage() float64 { - if o == nil || o.EstimatedIndexedLogsUsage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedLogsUsage -} - -// GetEstimatedIndexedLogsUsageOk returns a tuple with the EstimatedIndexedLogsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsUsageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedLogsUsage == nil { - return nil, false - } - return o.EstimatedIndexedLogsUsage, true -} - -// HasEstimatedIndexedLogsUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedLogsUsage() bool { - if o != nil && o.EstimatedIndexedLogsUsage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedLogsUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsUsage field. -func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedLogsUsage(v float64) { - o.EstimatedIndexedLogsUsage = &v -} - -// GetEstimatedIndexedSpansPercentage returns the EstimatedIndexedSpansPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansPercentage() float64 { - if o == nil || o.EstimatedIndexedSpansPercentage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedSpansPercentage -} - -// GetEstimatedIndexedSpansPercentageOk returns a tuple with the EstimatedIndexedSpansPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansPercentageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedSpansPercentage == nil { - return nil, false - } - return o.EstimatedIndexedSpansPercentage, true -} - -// HasEstimatedIndexedSpansPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedSpansPercentage() bool { - if o != nil && o.EstimatedIndexedSpansPercentage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansPercentage field. -func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedSpansPercentage(v float64) { - o.EstimatedIndexedSpansPercentage = &v -} - -// GetEstimatedIndexedSpansUsage returns the EstimatedIndexedSpansUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansUsage() float64 { - if o == nil || o.EstimatedIndexedSpansUsage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedSpansUsage -} - -// GetEstimatedIndexedSpansUsageOk returns a tuple with the EstimatedIndexedSpansUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansUsageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedSpansUsage == nil { - return nil, false - } - return o.EstimatedIndexedSpansUsage, true -} - -// HasEstimatedIndexedSpansUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedSpansUsage() bool { - if o != nil && o.EstimatedIndexedSpansUsage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansUsage field. -func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedSpansUsage(v float64) { - o.EstimatedIndexedSpansUsage = &v -} - -// GetEstimatedIngestedSpansPercentage returns the EstimatedIngestedSpansPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansPercentage() float64 { - if o == nil || o.EstimatedIngestedSpansPercentage == nil { - var ret float64 - return ret - } - return *o.EstimatedIngestedSpansPercentage -} - -// GetEstimatedIngestedSpansPercentageOk returns a tuple with the EstimatedIngestedSpansPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansPercentageOk() (*float64, bool) { - if o == nil || o.EstimatedIngestedSpansPercentage == nil { - return nil, false - } - return o.EstimatedIngestedSpansPercentage, true -} - -// HasEstimatedIngestedSpansPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasEstimatedIngestedSpansPercentage() bool { - if o != nil && o.EstimatedIngestedSpansPercentage != nil { - return true - } - - return false -} - -// SetEstimatedIngestedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansPercentage field. -func (o *MonthlyUsageAttributionValues) SetEstimatedIngestedSpansPercentage(v float64) { - o.EstimatedIngestedSpansPercentage = &v -} - -// GetEstimatedIngestedSpansUsage returns the EstimatedIngestedSpansUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansUsage() float64 { - if o == nil || o.EstimatedIngestedSpansUsage == nil { - var ret float64 - return ret - } - return *o.EstimatedIngestedSpansUsage -} - -// GetEstimatedIngestedSpansUsageOk returns a tuple with the EstimatedIngestedSpansUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansUsageOk() (*float64, bool) { - if o == nil || o.EstimatedIngestedSpansUsage == nil { - return nil, false - } - return o.EstimatedIngestedSpansUsage, true -} - -// HasEstimatedIngestedSpansUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasEstimatedIngestedSpansUsage() bool { - if o != nil && o.EstimatedIngestedSpansUsage != nil { - return true - } - - return false -} - -// SetEstimatedIngestedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansUsage field. -func (o *MonthlyUsageAttributionValues) SetEstimatedIngestedSpansUsage(v float64) { - o.EstimatedIngestedSpansUsage = &v -} - -// GetFargatePercentage returns the FargatePercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetFargatePercentage() float64 { - if o == nil || o.FargatePercentage == nil { - var ret float64 - return ret - } - return *o.FargatePercentage -} - -// GetFargatePercentageOk returns a tuple with the FargatePercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetFargatePercentageOk() (*float64, bool) { - if o == nil || o.FargatePercentage == nil { - return nil, false - } - return o.FargatePercentage, true -} - -// HasFargatePercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasFargatePercentage() bool { - if o != nil && o.FargatePercentage != nil { - return true - } - - return false -} - -// SetFargatePercentage gets a reference to the given float64 and assigns it to the FargatePercentage field. -func (o *MonthlyUsageAttributionValues) SetFargatePercentage(v float64) { - o.FargatePercentage = &v -} - -// GetFargateUsage returns the FargateUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetFargateUsage() float64 { - if o == nil || o.FargateUsage == nil { - var ret float64 - return ret - } - return *o.FargateUsage -} - -// GetFargateUsageOk returns a tuple with the FargateUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetFargateUsageOk() (*float64, bool) { - if o == nil || o.FargateUsage == nil { - return nil, false - } - return o.FargateUsage, true -} - -// HasFargateUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasFargateUsage() bool { - if o != nil && o.FargateUsage != nil { - return true - } - - return false -} - -// SetFargateUsage gets a reference to the given float64 and assigns it to the FargateUsage field. -func (o *MonthlyUsageAttributionValues) SetFargateUsage(v float64) { - o.FargateUsage = &v -} - -// GetFunctionsPercentage returns the FunctionsPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetFunctionsPercentage() float64 { - if o == nil || o.FunctionsPercentage == nil { - var ret float64 - return ret - } - return *o.FunctionsPercentage -} - -// GetFunctionsPercentageOk returns a tuple with the FunctionsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetFunctionsPercentageOk() (*float64, bool) { - if o == nil || o.FunctionsPercentage == nil { - return nil, false - } - return o.FunctionsPercentage, true -} - -// HasFunctionsPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasFunctionsPercentage() bool { - if o != nil && o.FunctionsPercentage != nil { - return true - } - - return false -} - -// SetFunctionsPercentage gets a reference to the given float64 and assigns it to the FunctionsPercentage field. -func (o *MonthlyUsageAttributionValues) SetFunctionsPercentage(v float64) { - o.FunctionsPercentage = &v -} - -// GetFunctionsUsage returns the FunctionsUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetFunctionsUsage() float64 { - if o == nil || o.FunctionsUsage == nil { - var ret float64 - return ret - } - return *o.FunctionsUsage -} - -// GetFunctionsUsageOk returns a tuple with the FunctionsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetFunctionsUsageOk() (*float64, bool) { - if o == nil || o.FunctionsUsage == nil { - return nil, false - } - return o.FunctionsUsage, true -} - -// HasFunctionsUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasFunctionsUsage() bool { - if o != nil && o.FunctionsUsage != nil { - return true - } - - return false -} - -// SetFunctionsUsage gets a reference to the given float64 and assigns it to the FunctionsUsage field. -func (o *MonthlyUsageAttributionValues) SetFunctionsUsage(v float64) { - o.FunctionsUsage = &v -} - -// GetIndexedLogsPercentage returns the IndexedLogsPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetIndexedLogsPercentage() float64 { - if o == nil || o.IndexedLogsPercentage == nil { - var ret float64 - return ret - } - return *o.IndexedLogsPercentage -} - -// GetIndexedLogsPercentageOk returns a tuple with the IndexedLogsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetIndexedLogsPercentageOk() (*float64, bool) { - if o == nil || o.IndexedLogsPercentage == nil { - return nil, false - } - return o.IndexedLogsPercentage, true -} - -// HasIndexedLogsPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasIndexedLogsPercentage() bool { - if o != nil && o.IndexedLogsPercentage != nil { - return true - } - - return false -} - -// SetIndexedLogsPercentage gets a reference to the given float64 and assigns it to the IndexedLogsPercentage field. -func (o *MonthlyUsageAttributionValues) SetIndexedLogsPercentage(v float64) { - o.IndexedLogsPercentage = &v -} - -// GetIndexedLogsUsage returns the IndexedLogsUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetIndexedLogsUsage() float64 { - if o == nil || o.IndexedLogsUsage == nil { - var ret float64 - return ret - } - return *o.IndexedLogsUsage -} - -// GetIndexedLogsUsageOk returns a tuple with the IndexedLogsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetIndexedLogsUsageOk() (*float64, bool) { - if o == nil || o.IndexedLogsUsage == nil { - return nil, false - } - return o.IndexedLogsUsage, true -} - -// HasIndexedLogsUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasIndexedLogsUsage() bool { - if o != nil && o.IndexedLogsUsage != nil { - return true - } - - return false -} - -// SetIndexedLogsUsage gets a reference to the given float64 and assigns it to the IndexedLogsUsage field. -func (o *MonthlyUsageAttributionValues) SetIndexedLogsUsage(v float64) { - o.IndexedLogsUsage = &v -} - -// GetInfraHostPercentage returns the InfraHostPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetInfraHostPercentage() float64 { - if o == nil || o.InfraHostPercentage == nil { - var ret float64 - return ret - } - return *o.InfraHostPercentage -} - -// GetInfraHostPercentageOk returns a tuple with the InfraHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetInfraHostPercentageOk() (*float64, bool) { - if o == nil || o.InfraHostPercentage == nil { - return nil, false - } - return o.InfraHostPercentage, true -} - -// HasInfraHostPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasInfraHostPercentage() bool { - if o != nil && o.InfraHostPercentage != nil { - return true - } - - return false -} - -// SetInfraHostPercentage gets a reference to the given float64 and assigns it to the InfraHostPercentage field. -func (o *MonthlyUsageAttributionValues) SetInfraHostPercentage(v float64) { - o.InfraHostPercentage = &v -} - -// GetInfraHostUsage returns the InfraHostUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetInfraHostUsage() float64 { - if o == nil || o.InfraHostUsage == nil { - var ret float64 - return ret - } - return *o.InfraHostUsage -} - -// GetInfraHostUsageOk returns a tuple with the InfraHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetInfraHostUsageOk() (*float64, bool) { - if o == nil || o.InfraHostUsage == nil { - return nil, false - } - return o.InfraHostUsage, true -} - -// HasInfraHostUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasInfraHostUsage() bool { - if o != nil && o.InfraHostUsage != nil { - return true - } - - return false -} - -// SetInfraHostUsage gets a reference to the given float64 and assigns it to the InfraHostUsage field. -func (o *MonthlyUsageAttributionValues) SetInfraHostUsage(v float64) { - o.InfraHostUsage = &v -} - -// GetInvocationsPercentage returns the InvocationsPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetInvocationsPercentage() float64 { - if o == nil || o.InvocationsPercentage == nil { - var ret float64 - return ret - } - return *o.InvocationsPercentage -} - -// GetInvocationsPercentageOk returns a tuple with the InvocationsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetInvocationsPercentageOk() (*float64, bool) { - if o == nil || o.InvocationsPercentage == nil { - return nil, false - } - return o.InvocationsPercentage, true -} - -// HasInvocationsPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasInvocationsPercentage() bool { - if o != nil && o.InvocationsPercentage != nil { - return true - } - - return false -} - -// SetInvocationsPercentage gets a reference to the given float64 and assigns it to the InvocationsPercentage field. -func (o *MonthlyUsageAttributionValues) SetInvocationsPercentage(v float64) { - o.InvocationsPercentage = &v -} - -// GetInvocationsUsage returns the InvocationsUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetInvocationsUsage() float64 { - if o == nil || o.InvocationsUsage == nil { - var ret float64 - return ret - } - return *o.InvocationsUsage -} - -// GetInvocationsUsageOk returns a tuple with the InvocationsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetInvocationsUsageOk() (*float64, bool) { - if o == nil || o.InvocationsUsage == nil { - return nil, false - } - return o.InvocationsUsage, true -} - -// HasInvocationsUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasInvocationsUsage() bool { - if o != nil && o.InvocationsUsage != nil { - return true - } - - return false -} - -// SetInvocationsUsage gets a reference to the given float64 and assigns it to the InvocationsUsage field. -func (o *MonthlyUsageAttributionValues) SetInvocationsUsage(v float64) { - o.InvocationsUsage = &v -} - -// GetNpmHostPercentage returns the NpmHostPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetNpmHostPercentage() float64 { - if o == nil || o.NpmHostPercentage == nil { - var ret float64 - return ret - } - return *o.NpmHostPercentage -} - -// GetNpmHostPercentageOk returns a tuple with the NpmHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetNpmHostPercentageOk() (*float64, bool) { - if o == nil || o.NpmHostPercentage == nil { - return nil, false - } - return o.NpmHostPercentage, true -} - -// HasNpmHostPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasNpmHostPercentage() bool { - if o != nil && o.NpmHostPercentage != nil { - return true - } - - return false -} - -// SetNpmHostPercentage gets a reference to the given float64 and assigns it to the NpmHostPercentage field. -func (o *MonthlyUsageAttributionValues) SetNpmHostPercentage(v float64) { - o.NpmHostPercentage = &v -} - -// GetNpmHostUsage returns the NpmHostUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetNpmHostUsage() float64 { - if o == nil || o.NpmHostUsage == nil { - var ret float64 - return ret - } - return *o.NpmHostUsage -} - -// GetNpmHostUsageOk returns a tuple with the NpmHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetNpmHostUsageOk() (*float64, bool) { - if o == nil || o.NpmHostUsage == nil { - return nil, false - } - return o.NpmHostUsage, true -} - -// HasNpmHostUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasNpmHostUsage() bool { - if o != nil && o.NpmHostUsage != nil { - return true - } - - return false -} - -// SetNpmHostUsage gets a reference to the given float64 and assigns it to the NpmHostUsage field. -func (o *MonthlyUsageAttributionValues) SetNpmHostUsage(v float64) { - o.NpmHostUsage = &v -} - -// GetProfiledContainerPercentage returns the ProfiledContainerPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetProfiledContainerPercentage() float64 { - if o == nil || o.ProfiledContainerPercentage == nil { - var ret float64 - return ret - } - return *o.ProfiledContainerPercentage -} - -// GetProfiledContainerPercentageOk returns a tuple with the ProfiledContainerPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetProfiledContainerPercentageOk() (*float64, bool) { - if o == nil || o.ProfiledContainerPercentage == nil { - return nil, false - } - return o.ProfiledContainerPercentage, true -} - -// HasProfiledContainerPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasProfiledContainerPercentage() bool { - if o != nil && o.ProfiledContainerPercentage != nil { - return true - } - - return false -} - -// SetProfiledContainerPercentage gets a reference to the given float64 and assigns it to the ProfiledContainerPercentage field. -func (o *MonthlyUsageAttributionValues) SetProfiledContainerPercentage(v float64) { - o.ProfiledContainerPercentage = &v -} - -// GetProfiledContainerUsage returns the ProfiledContainerUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetProfiledContainerUsage() float64 { - if o == nil || o.ProfiledContainerUsage == nil { - var ret float64 - return ret - } - return *o.ProfiledContainerUsage -} - -// GetProfiledContainerUsageOk returns a tuple with the ProfiledContainerUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetProfiledContainerUsageOk() (*float64, bool) { - if o == nil || o.ProfiledContainerUsage == nil { - return nil, false - } - return o.ProfiledContainerUsage, true -} - -// HasProfiledContainerUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasProfiledContainerUsage() bool { - if o != nil && o.ProfiledContainerUsage != nil { - return true - } - - return false -} - -// SetProfiledContainerUsage gets a reference to the given float64 and assigns it to the ProfiledContainerUsage field. -func (o *MonthlyUsageAttributionValues) SetProfiledContainerUsage(v float64) { - o.ProfiledContainerUsage = &v -} - -// GetProfiledHostPercentage returns the ProfiledHostPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetProfiledHostPercentage() float64 { - if o == nil || o.ProfiledHostPercentage == nil { - var ret float64 - return ret - } - return *o.ProfiledHostPercentage -} - -// GetProfiledHostPercentageOk returns a tuple with the ProfiledHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetProfiledHostPercentageOk() (*float64, bool) { - if o == nil || o.ProfiledHostPercentage == nil { - return nil, false - } - return o.ProfiledHostPercentage, true -} - -// HasProfiledHostPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasProfiledHostPercentage() bool { - if o != nil && o.ProfiledHostPercentage != nil { - return true - } - - return false -} - -// SetProfiledHostPercentage gets a reference to the given float64 and assigns it to the ProfiledHostPercentage field. -func (o *MonthlyUsageAttributionValues) SetProfiledHostPercentage(v float64) { - o.ProfiledHostPercentage = &v -} - -// GetProfiledHostUsage returns the ProfiledHostUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetProfiledHostUsage() float64 { - if o == nil || o.ProfiledHostUsage == nil { - var ret float64 - return ret - } - return *o.ProfiledHostUsage -} - -// GetProfiledHostUsageOk returns a tuple with the ProfiledHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetProfiledHostUsageOk() (*float64, bool) { - if o == nil || o.ProfiledHostUsage == nil { - return nil, false - } - return o.ProfiledHostUsage, true -} - -// HasProfiledHostUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasProfiledHostUsage() bool { - if o != nil && o.ProfiledHostUsage != nil { - return true - } - - return false -} - -// SetProfiledHostUsage gets a reference to the given float64 and assigns it to the ProfiledHostUsage field. -func (o *MonthlyUsageAttributionValues) SetProfiledHostUsage(v float64) { - o.ProfiledHostUsage = &v -} - -// GetSnmpPercentage returns the SnmpPercentage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetSnmpPercentage() float64 { - if o == nil || o.SnmpPercentage == nil { - var ret float64 - return ret - } - return *o.SnmpPercentage -} - -// GetSnmpPercentageOk returns a tuple with the SnmpPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetSnmpPercentageOk() (*float64, bool) { - if o == nil || o.SnmpPercentage == nil { - return nil, false - } - return o.SnmpPercentage, true -} - -// HasSnmpPercentage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasSnmpPercentage() bool { - if o != nil && o.SnmpPercentage != nil { - return true - } - - return false -} - -// SetSnmpPercentage gets a reference to the given float64 and assigns it to the SnmpPercentage field. -func (o *MonthlyUsageAttributionValues) SetSnmpPercentage(v float64) { - o.SnmpPercentage = &v -} - -// GetSnmpUsage returns the SnmpUsage field value if set, zero value otherwise. -func (o *MonthlyUsageAttributionValues) GetSnmpUsage() float64 { - if o == nil || o.SnmpUsage == nil { - var ret float64 - return ret - } - return *o.SnmpUsage -} - -// GetSnmpUsageOk returns a tuple with the SnmpUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonthlyUsageAttributionValues) GetSnmpUsageOk() (*float64, bool) { - if o == nil || o.SnmpUsage == nil { - return nil, false - } - return o.SnmpUsage, true -} - -// HasSnmpUsage returns a boolean if a field has been set. -func (o *MonthlyUsageAttributionValues) HasSnmpUsage() bool { - if o != nil && o.SnmpUsage != nil { - return true - } - - return false -} - -// SetSnmpUsage gets a reference to the given float64 and assigns it to the SnmpUsage field. -func (o *MonthlyUsageAttributionValues) SetSnmpUsage(v float64) { - o.SnmpUsage = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonthlyUsageAttributionValues) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApiPercentage != nil { - toSerialize["api_percentage"] = o.ApiPercentage - } - if o.ApiUsage != nil { - toSerialize["api_usage"] = o.ApiUsage - } - if o.ApmHostPercentage != nil { - toSerialize["apm_host_percentage"] = o.ApmHostPercentage - } - if o.ApmHostUsage != nil { - toSerialize["apm_host_usage"] = o.ApmHostUsage - } - if o.AppsecPercentage != nil { - toSerialize["appsec_percentage"] = o.AppsecPercentage - } - if o.AppsecUsage != nil { - toSerialize["appsec_usage"] = o.AppsecUsage - } - if o.BrowserPercentage != nil { - toSerialize["browser_percentage"] = o.BrowserPercentage - } - if o.BrowserUsage != nil { - toSerialize["browser_usage"] = o.BrowserUsage - } - if o.ContainerPercentage != nil { - toSerialize["container_percentage"] = o.ContainerPercentage - } - if o.ContainerUsage != nil { - toSerialize["container_usage"] = o.ContainerUsage - } - if o.CustomTimeseriesPercentage != nil { - toSerialize["custom_timeseries_percentage"] = o.CustomTimeseriesPercentage - } - if o.CustomTimeseriesUsage != nil { - toSerialize["custom_timeseries_usage"] = o.CustomTimeseriesUsage - } - if o.EstimatedIndexedLogsPercentage != nil { - toSerialize["estimated_indexed_logs_percentage"] = o.EstimatedIndexedLogsPercentage - } - if o.EstimatedIndexedLogsUsage != nil { - toSerialize["estimated_indexed_logs_usage"] = o.EstimatedIndexedLogsUsage - } - if o.EstimatedIndexedSpansPercentage != nil { - toSerialize["estimated_indexed_spans_percentage"] = o.EstimatedIndexedSpansPercentage - } - if o.EstimatedIndexedSpansUsage != nil { - toSerialize["estimated_indexed_spans_usage"] = o.EstimatedIndexedSpansUsage - } - if o.EstimatedIngestedSpansPercentage != nil { - toSerialize["estimated_ingested_spans_percentage"] = o.EstimatedIngestedSpansPercentage - } - if o.EstimatedIngestedSpansUsage != nil { - toSerialize["estimated_ingested_spans_usage"] = o.EstimatedIngestedSpansUsage - } - if o.FargatePercentage != nil { - toSerialize["fargate_percentage"] = o.FargatePercentage - } - if o.FargateUsage != nil { - toSerialize["fargate_usage"] = o.FargateUsage - } - if o.FunctionsPercentage != nil { - toSerialize["functions_percentage"] = o.FunctionsPercentage - } - if o.FunctionsUsage != nil { - toSerialize["functions_usage"] = o.FunctionsUsage - } - if o.IndexedLogsPercentage != nil { - toSerialize["indexed_logs_percentage"] = o.IndexedLogsPercentage - } - if o.IndexedLogsUsage != nil { - toSerialize["indexed_logs_usage"] = o.IndexedLogsUsage - } - if o.InfraHostPercentage != nil { - toSerialize["infra_host_percentage"] = o.InfraHostPercentage - } - if o.InfraHostUsage != nil { - toSerialize["infra_host_usage"] = o.InfraHostUsage - } - if o.InvocationsPercentage != nil { - toSerialize["invocations_percentage"] = o.InvocationsPercentage - } - if o.InvocationsUsage != nil { - toSerialize["invocations_usage"] = o.InvocationsUsage - } - if o.NpmHostPercentage != nil { - toSerialize["npm_host_percentage"] = o.NpmHostPercentage - } - if o.NpmHostUsage != nil { - toSerialize["npm_host_usage"] = o.NpmHostUsage - } - if o.ProfiledContainerPercentage != nil { - toSerialize["profiled_container_percentage"] = o.ProfiledContainerPercentage - } - if o.ProfiledContainerUsage != nil { - toSerialize["profiled_container_usage"] = o.ProfiledContainerUsage - } - if o.ProfiledHostPercentage != nil { - toSerialize["profiled_host_percentage"] = o.ProfiledHostPercentage - } - if o.ProfiledHostUsage != nil { - toSerialize["profiled_host_usage"] = o.ProfiledHostUsage - } - if o.SnmpPercentage != nil { - toSerialize["snmp_percentage"] = o.SnmpPercentage - } - if o.SnmpUsage != nil { - toSerialize["snmp_usage"] = o.SnmpUsage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApiPercentage *float64 `json:"api_percentage,omitempty"` - ApiUsage *float64 `json:"api_usage,omitempty"` - ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` - ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` - AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` - AppsecUsage *float64 `json:"appsec_usage,omitempty"` - BrowserPercentage *float64 `json:"browser_percentage,omitempty"` - BrowserUsage *float64 `json:"browser_usage,omitempty"` - ContainerPercentage *float64 `json:"container_percentage,omitempty"` - ContainerUsage *float64 `json:"container_usage,omitempty"` - CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` - CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` - EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` - EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` - EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` - EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` - EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` - EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` - FargatePercentage *float64 `json:"fargate_percentage,omitempty"` - FargateUsage *float64 `json:"fargate_usage,omitempty"` - FunctionsPercentage *float64 `json:"functions_percentage,omitempty"` - FunctionsUsage *float64 `json:"functions_usage,omitempty"` - IndexedLogsPercentage *float64 `json:"indexed_logs_percentage,omitempty"` - IndexedLogsUsage *float64 `json:"indexed_logs_usage,omitempty"` - InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` - InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` - InvocationsPercentage *float64 `json:"invocations_percentage,omitempty"` - InvocationsUsage *float64 `json:"invocations_usage,omitempty"` - NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` - NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` - ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` - ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` - ProfiledHostPercentage *float64 `json:"profiled_host_percentage,omitempty"` - ProfiledHostUsage *float64 `json:"profiled_host_usage,omitempty"` - SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` - SnmpUsage *float64 `json:"snmp_usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ApiPercentage = all.ApiPercentage - o.ApiUsage = all.ApiUsage - o.ApmHostPercentage = all.ApmHostPercentage - o.ApmHostUsage = all.ApmHostUsage - o.AppsecPercentage = all.AppsecPercentage - o.AppsecUsage = all.AppsecUsage - o.BrowserPercentage = all.BrowserPercentage - o.BrowserUsage = all.BrowserUsage - o.ContainerPercentage = all.ContainerPercentage - o.ContainerUsage = all.ContainerUsage - o.CustomTimeseriesPercentage = all.CustomTimeseriesPercentage - o.CustomTimeseriesUsage = all.CustomTimeseriesUsage - o.EstimatedIndexedLogsPercentage = all.EstimatedIndexedLogsPercentage - o.EstimatedIndexedLogsUsage = all.EstimatedIndexedLogsUsage - o.EstimatedIndexedSpansPercentage = all.EstimatedIndexedSpansPercentage - o.EstimatedIndexedSpansUsage = all.EstimatedIndexedSpansUsage - o.EstimatedIngestedSpansPercentage = all.EstimatedIngestedSpansPercentage - o.EstimatedIngestedSpansUsage = all.EstimatedIngestedSpansUsage - o.FargatePercentage = all.FargatePercentage - o.FargateUsage = all.FargateUsage - o.FunctionsPercentage = all.FunctionsPercentage - o.FunctionsUsage = all.FunctionsUsage - o.IndexedLogsPercentage = all.IndexedLogsPercentage - o.IndexedLogsUsage = all.IndexedLogsUsage - o.InfraHostPercentage = all.InfraHostPercentage - o.InfraHostUsage = all.InfraHostUsage - o.InvocationsPercentage = all.InvocationsPercentage - o.InvocationsUsage = all.InvocationsUsage - o.NpmHostPercentage = all.NpmHostPercentage - o.NpmHostUsage = all.NpmHostUsage - o.ProfiledContainerPercentage = all.ProfiledContainerPercentage - o.ProfiledContainerUsage = all.ProfiledContainerUsage - o.ProfiledHostPercentage = all.ProfiledHostPercentage - o.ProfiledHostUsage = all.ProfiledHostUsage - o.SnmpPercentage = all.SnmpPercentage - o.SnmpUsage = all.SnmpUsage - return nil -} diff --git a/api/v1/datadog/model_note_widget_definition.go b/api/v1/datadog/model_note_widget_definition.go deleted file mode 100644 index 1a9582e7ef3..00000000000 --- a/api/v1/datadog/model_note_widget_definition.go +++ /dev/null @@ -1,486 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NoteWidgetDefinition The notes and links widget is similar to free text widget, but allows for more formatting options. -type NoteWidgetDefinition struct { - // Background color of the note. - BackgroundColor *string `json:"background_color,omitempty"` - // Content of the note. - Content string `json:"content"` - // Size of the text. - FontSize *string `json:"font_size,omitempty"` - // Whether to add padding or not. - HasPadding *bool `json:"has_padding,omitempty"` - // Whether to show a tick or not. - ShowTick *bool `json:"show_tick,omitempty"` - // How to align the text on the widget. - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - // Define how you want to align the text on the widget. - TickEdge *WidgetTickEdge `json:"tick_edge,omitempty"` - // Where to position the tick on an edge. - TickPos *string `json:"tick_pos,omitempty"` - // Type of the note widget. - Type NoteWidgetDefinitionType `json:"type"` - // Vertical alignment. - VerticalAlign *WidgetVerticalAlign `json:"vertical_align,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{} -} - -// NewNoteWidgetDefinition instantiates a new NoteWidgetDefinition 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 NewNoteWidgetDefinition(content string, typeVar NoteWidgetDefinitionType) *NoteWidgetDefinition { - this := NoteWidgetDefinition{} - this.Content = content - var hasPadding bool = true - this.HasPadding = &hasPadding - this.Type = typeVar - return &this -} - -// NewNoteWidgetDefinitionWithDefaults instantiates a new NoteWidgetDefinition 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 NewNoteWidgetDefinitionWithDefaults() *NoteWidgetDefinition { - this := NoteWidgetDefinition{} - var hasPadding bool = true - this.HasPadding = &hasPadding - var typeVar NoteWidgetDefinitionType = NOTEWIDGETDEFINITIONTYPE_NOTE - this.Type = typeVar - return &this -} - -// GetBackgroundColor returns the BackgroundColor field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetBackgroundColor() string { - if o == nil || o.BackgroundColor == nil { - var ret string - return ret - } - return *o.BackgroundColor -} - -// GetBackgroundColorOk returns a tuple with the BackgroundColor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetBackgroundColorOk() (*string, bool) { - if o == nil || o.BackgroundColor == nil { - return nil, false - } - return o.BackgroundColor, true -} - -// HasBackgroundColor returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasBackgroundColor() bool { - if o != nil && o.BackgroundColor != nil { - return true - } - - return false -} - -// SetBackgroundColor gets a reference to the given string and assigns it to the BackgroundColor field. -func (o *NoteWidgetDefinition) SetBackgroundColor(v string) { - o.BackgroundColor = &v -} - -// GetContent returns the Content field value. -func (o *NoteWidgetDefinition) GetContent() string { - if o == nil { - var ret string - return ret - } - return o.Content -} - -// GetContentOk returns a tuple with the Content field value -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetContentOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Content, true -} - -// SetContent sets field value. -func (o *NoteWidgetDefinition) SetContent(v string) { - o.Content = v -} - -// GetFontSize returns the FontSize field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetFontSize() string { - if o == nil || o.FontSize == nil { - var ret string - return ret - } - return *o.FontSize -} - -// GetFontSizeOk returns a tuple with the FontSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetFontSizeOk() (*string, bool) { - if o == nil || o.FontSize == nil { - return nil, false - } - return o.FontSize, true -} - -// HasFontSize returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasFontSize() bool { - if o != nil && o.FontSize != nil { - return true - } - - return false -} - -// SetFontSize gets a reference to the given string and assigns it to the FontSize field. -func (o *NoteWidgetDefinition) SetFontSize(v string) { - o.FontSize = &v -} - -// GetHasPadding returns the HasPadding field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetHasPadding() bool { - if o == nil || o.HasPadding == nil { - var ret bool - return ret - } - return *o.HasPadding -} - -// GetHasPaddingOk returns a tuple with the HasPadding field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetHasPaddingOk() (*bool, bool) { - if o == nil || o.HasPadding == nil { - return nil, false - } - return o.HasPadding, true -} - -// HasHasPadding returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasHasPadding() bool { - if o != nil && o.HasPadding != nil { - return true - } - - return false -} - -// SetHasPadding gets a reference to the given bool and assigns it to the HasPadding field. -func (o *NoteWidgetDefinition) SetHasPadding(v bool) { - o.HasPadding = &v -} - -// GetShowTick returns the ShowTick field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetShowTick() bool { - if o == nil || o.ShowTick == nil { - var ret bool - return ret - } - return *o.ShowTick -} - -// GetShowTickOk returns a tuple with the ShowTick field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetShowTickOk() (*bool, bool) { - if o == nil || o.ShowTick == nil { - return nil, false - } - return o.ShowTick, true -} - -// HasShowTick returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasShowTick() bool { - if o != nil && o.ShowTick != nil { - return true - } - - return false -} - -// SetShowTick gets a reference to the given bool and assigns it to the ShowTick field. -func (o *NoteWidgetDefinition) SetShowTick(v bool) { - o.ShowTick = &v -} - -// GetTextAlign returns the TextAlign field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetTextAlign() WidgetTextAlign { - if o == nil || o.TextAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TextAlign -} - -// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TextAlign == nil { - return nil, false - } - return o.TextAlign, true -} - -// HasTextAlign returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasTextAlign() bool { - if o != nil && o.TextAlign != nil { - return true - } - - return false -} - -// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. -func (o *NoteWidgetDefinition) SetTextAlign(v WidgetTextAlign) { - o.TextAlign = &v -} - -// GetTickEdge returns the TickEdge field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetTickEdge() WidgetTickEdge { - if o == nil || o.TickEdge == nil { - var ret WidgetTickEdge - return ret - } - return *o.TickEdge -} - -// GetTickEdgeOk returns a tuple with the TickEdge field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetTickEdgeOk() (*WidgetTickEdge, bool) { - if o == nil || o.TickEdge == nil { - return nil, false - } - return o.TickEdge, true -} - -// HasTickEdge returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasTickEdge() bool { - if o != nil && o.TickEdge != nil { - return true - } - - return false -} - -// SetTickEdge gets a reference to the given WidgetTickEdge and assigns it to the TickEdge field. -func (o *NoteWidgetDefinition) SetTickEdge(v WidgetTickEdge) { - o.TickEdge = &v -} - -// GetTickPos returns the TickPos field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetTickPos() string { - if o == nil || o.TickPos == nil { - var ret string - return ret - } - return *o.TickPos -} - -// GetTickPosOk returns a tuple with the TickPos field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetTickPosOk() (*string, bool) { - if o == nil || o.TickPos == nil { - return nil, false - } - return o.TickPos, true -} - -// HasTickPos returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasTickPos() bool { - if o != nil && o.TickPos != nil { - return true - } - - return false -} - -// SetTickPos gets a reference to the given string and assigns it to the TickPos field. -func (o *NoteWidgetDefinition) SetTickPos(v string) { - o.TickPos = &v -} - -// GetType returns the Type field value. -func (o *NoteWidgetDefinition) GetType() NoteWidgetDefinitionType { - if o == nil { - var ret NoteWidgetDefinitionType - 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 *NoteWidgetDefinition) GetTypeOk() (*NoteWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NoteWidgetDefinition) SetType(v NoteWidgetDefinitionType) { - o.Type = v -} - -// GetVerticalAlign returns the VerticalAlign field value if set, zero value otherwise. -func (o *NoteWidgetDefinition) GetVerticalAlign() WidgetVerticalAlign { - if o == nil || o.VerticalAlign == nil { - var ret WidgetVerticalAlign - return ret - } - return *o.VerticalAlign -} - -// GetVerticalAlignOk returns a tuple with the VerticalAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NoteWidgetDefinition) GetVerticalAlignOk() (*WidgetVerticalAlign, bool) { - if o == nil || o.VerticalAlign == nil { - return nil, false - } - return o.VerticalAlign, true -} - -// HasVerticalAlign returns a boolean if a field has been set. -func (o *NoteWidgetDefinition) HasVerticalAlign() bool { - if o != nil && o.VerticalAlign != nil { - return true - } - - return false -} - -// SetVerticalAlign gets a reference to the given WidgetVerticalAlign and assigns it to the VerticalAlign field. -func (o *NoteWidgetDefinition) SetVerticalAlign(v WidgetVerticalAlign) { - o.VerticalAlign = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NoteWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BackgroundColor != nil { - toSerialize["background_color"] = o.BackgroundColor - } - toSerialize["content"] = o.Content - if o.FontSize != nil { - toSerialize["font_size"] = o.FontSize - } - if o.HasPadding != nil { - toSerialize["has_padding"] = o.HasPadding - } - if o.ShowTick != nil { - toSerialize["show_tick"] = o.ShowTick - } - if o.TextAlign != nil { - toSerialize["text_align"] = o.TextAlign - } - if o.TickEdge != nil { - toSerialize["tick_edge"] = o.TickEdge - } - if o.TickPos != nil { - toSerialize["tick_pos"] = o.TickPos - } - toSerialize["type"] = o.Type - if o.VerticalAlign != nil { - toSerialize["vertical_align"] = o.VerticalAlign - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Content *string `json:"content"` - Type *NoteWidgetDefinitionType `json:"type"` - }{} - all := struct { - BackgroundColor *string `json:"background_color,omitempty"` - Content string `json:"content"` - FontSize *string `json:"font_size,omitempty"` - HasPadding *bool `json:"has_padding,omitempty"` - ShowTick *bool `json:"show_tick,omitempty"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - TickEdge *WidgetTickEdge `json:"tick_edge,omitempty"` - TickPos *string `json:"tick_pos,omitempty"` - Type NoteWidgetDefinitionType `json:"type"` - VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Content == nil { - return fmt.Errorf("Required field content missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TickEdge; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.VerticalAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BackgroundColor = all.BackgroundColor - o.Content = all.Content - o.FontSize = all.FontSize - o.HasPadding = all.HasPadding - o.ShowTick = all.ShowTick - o.TextAlign = all.TextAlign - o.TickEdge = all.TickEdge - o.TickPos = all.TickPos - o.Type = all.Type - o.VerticalAlign = all.VerticalAlign - return nil -} diff --git a/api/v1/datadog/model_note_widget_definition_type.go b/api/v1/datadog/model_note_widget_definition_type.go deleted file mode 100644 index 35e119ff70e..00000000000 --- a/api/v1/datadog/model_note_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NoteWidgetDefinitionType Type of the note widget. -type NoteWidgetDefinitionType string - -// List of NoteWidgetDefinitionType. -const ( - NOTEWIDGETDEFINITIONTYPE_NOTE NoteWidgetDefinitionType = "note" -) - -var allowedNoteWidgetDefinitionTypeEnumValues = []NoteWidgetDefinitionType{ - NOTEWIDGETDEFINITIONTYPE_NOTE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NoteWidgetDefinitionType) GetAllowedValues() []NoteWidgetDefinitionType { - return allowedNoteWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NoteWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NoteWidgetDefinitionType(value) - return nil -} - -// NewNoteWidgetDefinitionTypeFromValue returns a pointer to a valid NoteWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNoteWidgetDefinitionTypeFromValue(v string) (*NoteWidgetDefinitionType, error) { - ev := NoteWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NoteWidgetDefinitionType: valid values are %v", v, allowedNoteWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NoteWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedNoteWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NoteWidgetDefinitionType value. -func (v NoteWidgetDefinitionType) Ptr() *NoteWidgetDefinitionType { - return &v -} - -// NullableNoteWidgetDefinitionType handles when a null is used for NoteWidgetDefinitionType. -type NullableNoteWidgetDefinitionType struct { - value *NoteWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableNoteWidgetDefinitionType) Get() *NoteWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNoteWidgetDefinitionType) Set(val *NoteWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNoteWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNoteWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNoteWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableNoteWidgetDefinitionType(val *NoteWidgetDefinitionType) *NullableNoteWidgetDefinitionType { - return &NullableNoteWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNoteWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNoteWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_absolute_time.go b/api/v1/datadog/model_notebook_absolute_time.go deleted file mode 100644 index c24774b092e..00000000000 --- a/api/v1/datadog/model_notebook_absolute_time.go +++ /dev/null @@ -1,184 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" -) - -// NotebookAbsoluteTime Absolute timeframe. -type NotebookAbsoluteTime struct { - // The end time. - End time.Time `json:"end"` - // Indicates whether the timeframe should be shifted to end at the current time. - Live *bool `json:"live,omitempty"` - // The start time. - Start time.Time `json:"start"` - // 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{} -} - -// NewNotebookAbsoluteTime instantiates a new NotebookAbsoluteTime 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 NewNotebookAbsoluteTime(end time.Time, start time.Time) *NotebookAbsoluteTime { - this := NotebookAbsoluteTime{} - this.End = end - this.Start = start - return &this -} - -// NewNotebookAbsoluteTimeWithDefaults instantiates a new NotebookAbsoluteTime 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 NewNotebookAbsoluteTimeWithDefaults() *NotebookAbsoluteTime { - this := NotebookAbsoluteTime{} - return &this -} - -// GetEnd returns the End field value. -func (o *NotebookAbsoluteTime) GetEnd() time.Time { - if o == nil { - var ret time.Time - return ret - } - return o.End -} - -// GetEndOk returns a tuple with the End field value -// and a boolean to check if the value has been set. -func (o *NotebookAbsoluteTime) GetEndOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.End, true -} - -// SetEnd sets field value. -func (o *NotebookAbsoluteTime) SetEnd(v time.Time) { - o.End = v -} - -// GetLive returns the Live field value if set, zero value otherwise. -func (o *NotebookAbsoluteTime) GetLive() bool { - if o == nil || o.Live == nil { - var ret bool - return ret - } - return *o.Live -} - -// GetLiveOk returns a tuple with the Live field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAbsoluteTime) GetLiveOk() (*bool, bool) { - if o == nil || o.Live == nil { - return nil, false - } - return o.Live, true -} - -// HasLive returns a boolean if a field has been set. -func (o *NotebookAbsoluteTime) HasLive() bool { - if o != nil && o.Live != nil { - return true - } - - return false -} - -// SetLive gets a reference to the given bool and assigns it to the Live field. -func (o *NotebookAbsoluteTime) SetLive(v bool) { - o.Live = &v -} - -// GetStart returns the Start field value. -func (o *NotebookAbsoluteTime) GetStart() time.Time { - if o == nil { - var ret time.Time - return ret - } - return o.Start -} - -// GetStartOk returns a tuple with the Start field value -// and a boolean to check if the value has been set. -func (o *NotebookAbsoluteTime) GetStartOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.Start, true -} - -// SetStart sets field value. -func (o *NotebookAbsoluteTime) SetStart(v time.Time) { - o.Start = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookAbsoluteTime) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.End.Nanosecond() == 0 { - toSerialize["end"] = o.End.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["end"] = o.End.Format("2006-01-02T15:04:05.000Z07:00") - } - if o.Live != nil { - toSerialize["live"] = o.Live - } - if o.Start.Nanosecond() == 0 { - toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05.000Z07:00") - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookAbsoluteTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - End *time.Time `json:"end"` - Start *time.Time `json:"start"` - }{} - all := struct { - End time.Time `json:"end"` - Live *bool `json:"live,omitempty"` - Start time.Time `json:"start"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("Required field end missing") - } - if required.Start == nil { - return fmt.Errorf("Required field start missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.End = all.End - o.Live = all.Live - o.Start = all.Start - return nil -} diff --git a/api/v1/datadog/model_notebook_author.go b/api/v1/datadog/model_notebook_author.go deleted file mode 100644 index 7a1bb7cdb53..00000000000 --- a/api/v1/datadog/model_notebook_author.go +++ /dev/null @@ -1,443 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// NotebookAuthor Attributes of user object returned by the API. -type NotebookAuthor struct { - // Creation time of the user. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Whether the user is disabled. - Disabled *bool `json:"disabled,omitempty"` - // Email of the user. - Email *string `json:"email,omitempty"` - // Handle of the user. - Handle *string `json:"handle,omitempty"` - // URL of the user's icon. - Icon *string `json:"icon,omitempty"` - // Name of the user. - Name common.NullableString `json:"name,omitempty"` - // Status of the user. - Status *string `json:"status,omitempty"` - // Title of the user. - Title common.NullableString `json:"title,omitempty"` - // Whether the user is verified. - Verified *bool `json:"verified,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{} -} - -// NewNotebookAuthor instantiates a new NotebookAuthor 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 NewNotebookAuthor() *NotebookAuthor { - this := NotebookAuthor{} - return &this -} - -// NewNotebookAuthorWithDefaults instantiates a new NotebookAuthor 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 NewNotebookAuthorWithDefaults() *NotebookAuthor { - this := NotebookAuthor{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *NotebookAuthor) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAuthor) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *NotebookAuthor) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *NotebookAuthor) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetDisabled returns the Disabled field value if set, zero value otherwise. -func (o *NotebookAuthor) GetDisabled() bool { - if o == nil || o.Disabled == nil { - var ret bool - return ret - } - return *o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAuthor) GetDisabledOk() (*bool, bool) { - if o == nil || o.Disabled == nil { - return nil, false - } - return o.Disabled, true -} - -// HasDisabled returns a boolean if a field has been set. -func (o *NotebookAuthor) HasDisabled() bool { - if o != nil && o.Disabled != nil { - return true - } - - return false -} - -// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. -func (o *NotebookAuthor) SetDisabled(v bool) { - o.Disabled = &v -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *NotebookAuthor) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAuthor) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *NotebookAuthor) HasEmail() bool { - if o != nil && o.Email != nil { - return true - } - - return false -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *NotebookAuthor) SetEmail(v string) { - o.Email = &v -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *NotebookAuthor) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAuthor) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *NotebookAuthor) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *NotebookAuthor) SetHandle(v string) { - o.Handle = &v -} - -// GetIcon returns the Icon field value if set, zero value otherwise. -func (o *NotebookAuthor) GetIcon() string { - if o == nil || o.Icon == nil { - var ret string - return ret - } - return *o.Icon -} - -// GetIconOk returns a tuple with the Icon field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAuthor) GetIconOk() (*string, bool) { - if o == nil || o.Icon == nil { - return nil, false - } - return o.Icon, true -} - -// HasIcon returns a boolean if a field has been set. -func (o *NotebookAuthor) HasIcon() bool { - if o != nil && o.Icon != nil { - return true - } - - return false -} - -// SetIcon gets a reference to the given string and assigns it to the Icon field. -func (o *NotebookAuthor) SetIcon(v string) { - o.Icon = &v -} - -// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookAuthor) GetName() string { - if o == nil || o.Name.Get() == nil { - var ret string - return ret - } - return *o.Name.Get() -} - -// GetNameOk returns a tuple with the Name 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 *NotebookAuthor) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name.Get(), o.Name.IsSet() -} - -// HasName returns a boolean if a field has been set. -func (o *NotebookAuthor) HasName() bool { - if o != nil && o.Name.IsSet() { - return true - } - - return false -} - -// SetName gets a reference to the given common.NullableString and assigns it to the Name field. -func (o *NotebookAuthor) SetName(v string) { - o.Name.Set(&v) -} - -// SetNameNil sets the value for Name to be an explicit nil. -func (o *NotebookAuthor) SetNameNil() { - o.Name.Set(nil) -} - -// UnsetName ensures that no value is present for Name, not even an explicit nil. -func (o *NotebookAuthor) UnsetName() { - o.Name.Unset() -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *NotebookAuthor) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAuthor) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *NotebookAuthor) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *NotebookAuthor) SetStatus(v string) { - o.Status = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookAuthor) GetTitle() string { - if o == nil || o.Title.Get() == nil { - var ret string - return ret - } - return *o.Title.Get() -} - -// GetTitleOk returns a tuple with the Title 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 *NotebookAuthor) GetTitleOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Title.Get(), o.Title.IsSet() -} - -// HasTitle returns a boolean if a field has been set. -func (o *NotebookAuthor) HasTitle() bool { - if o != nil && o.Title.IsSet() { - return true - } - - return false -} - -// SetTitle gets a reference to the given common.NullableString and assigns it to the Title field. -func (o *NotebookAuthor) SetTitle(v string) { - o.Title.Set(&v) -} - -// SetTitleNil sets the value for Title to be an explicit nil. -func (o *NotebookAuthor) SetTitleNil() { - o.Title.Set(nil) -} - -// UnsetTitle ensures that no value is present for Title, not even an explicit nil. -func (o *NotebookAuthor) UnsetTitle() { - o.Title.Unset() -} - -// GetVerified returns the Verified field value if set, zero value otherwise. -func (o *NotebookAuthor) GetVerified() bool { - if o == nil || o.Verified == nil { - var ret bool - return ret - } - return *o.Verified -} - -// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookAuthor) GetVerifiedOk() (*bool, bool) { - if o == nil || o.Verified == nil { - return nil, false - } - return o.Verified, true -} - -// HasVerified returns a boolean if a field has been set. -func (o *NotebookAuthor) HasVerified() bool { - if o != nil && o.Verified != nil { - return true - } - - return false -} - -// SetVerified gets a reference to the given bool and assigns it to the Verified field. -func (o *NotebookAuthor) SetVerified(v bool) { - o.Verified = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookAuthor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Disabled != nil { - toSerialize["disabled"] = o.Disabled - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Icon != nil { - toSerialize["icon"] = o.Icon - } - if o.Name.IsSet() { - toSerialize["name"] = o.Name.Get() - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Title.IsSet() { - toSerialize["title"] = o.Title.Get() - } - if o.Verified != nil { - toSerialize["verified"] = o.Verified - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookAuthor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - Email *string `json:"email,omitempty"` - Handle *string `json:"handle,omitempty"` - Icon *string `json:"icon,omitempty"` - Name common.NullableString `json:"name,omitempty"` - Status *string `json:"status,omitempty"` - Title common.NullableString `json:"title,omitempty"` - Verified *bool `json:"verified,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.Disabled = all.Disabled - o.Email = all.Email - o.Handle = all.Handle - o.Icon = all.Icon - o.Name = all.Name - o.Status = all.Status - o.Title = all.Title - o.Verified = all.Verified - return nil -} diff --git a/api/v1/datadog/model_notebook_cell_create_request.go b/api/v1/datadog/model_notebook_cell_create_request.go deleted file mode 100644 index e6fa919a0c9..00000000000 --- a/api/v1/datadog/model_notebook_cell_create_request.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookCellCreateRequest The description of a notebook cell create request. -type NotebookCellCreateRequest struct { - // The attributes of a notebook cell in create cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, - // `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) - Attributes NotebookCellCreateRequestAttributes `json:"attributes"` - // Type of the Notebook Cell resource. - Type NotebookCellResourceType `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:-` -} - -// NewNotebookCellCreateRequest instantiates a new NotebookCellCreateRequest 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 NewNotebookCellCreateRequest(attributes NotebookCellCreateRequestAttributes, typeVar NotebookCellResourceType) *NotebookCellCreateRequest { - this := NotebookCellCreateRequest{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewNotebookCellCreateRequestWithDefaults instantiates a new NotebookCellCreateRequest 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 NewNotebookCellCreateRequestWithDefaults() *NotebookCellCreateRequest { - this := NotebookCellCreateRequest{} - var typeVar NotebookCellResourceType = NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *NotebookCellCreateRequest) GetAttributes() NotebookCellCreateRequestAttributes { - if o == nil { - var ret NotebookCellCreateRequestAttributes - 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 *NotebookCellCreateRequest) GetAttributesOk() (*NotebookCellCreateRequestAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *NotebookCellCreateRequest) SetAttributes(v NotebookCellCreateRequestAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *NotebookCellCreateRequest) GetType() NotebookCellResourceType { - if o == nil { - var ret NotebookCellResourceType - 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 *NotebookCellCreateRequest) GetTypeOk() (*NotebookCellResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookCellCreateRequest) SetType(v NotebookCellResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookCellCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookCellCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *NotebookCellCreateRequestAttributes `json:"attributes"` - Type *NotebookCellResourceType `json:"type"` - }{} - all := struct { - Attributes NotebookCellCreateRequestAttributes `json:"attributes"` - Type NotebookCellResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_cell_create_request_attributes.go b/api/v1/datadog/model_notebook_cell_create_request_attributes.go deleted file mode 100644 index 9dd241958d4..00000000000 --- a/api/v1/datadog/model_notebook_cell_create_request_attributes.go +++ /dev/null @@ -1,284 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookCellCreateRequestAttributes - The attributes of a notebook cell in create cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, -// `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) -type NotebookCellCreateRequestAttributes struct { - NotebookMarkdownCellAttributes *NotebookMarkdownCellAttributes - NotebookTimeseriesCellAttributes *NotebookTimeseriesCellAttributes - NotebookToplistCellAttributes *NotebookToplistCellAttributes - NotebookHeatMapCellAttributes *NotebookHeatMapCellAttributes - NotebookDistributionCellAttributes *NotebookDistributionCellAttributes - NotebookLogStreamCellAttributes *NotebookLogStreamCellAttributes - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// NotebookMarkdownCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookMarkdownCellAttributes wrapped in NotebookCellCreateRequestAttributes. -func NotebookMarkdownCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookMarkdownCellAttributes) NotebookCellCreateRequestAttributes { - return NotebookCellCreateRequestAttributes{NotebookMarkdownCellAttributes: v} -} - -// NotebookTimeseriesCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookTimeseriesCellAttributes wrapped in NotebookCellCreateRequestAttributes. -func NotebookTimeseriesCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookTimeseriesCellAttributes) NotebookCellCreateRequestAttributes { - return NotebookCellCreateRequestAttributes{NotebookTimeseriesCellAttributes: v} -} - -// NotebookToplistCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookToplistCellAttributes wrapped in NotebookCellCreateRequestAttributes. -func NotebookToplistCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookToplistCellAttributes) NotebookCellCreateRequestAttributes { - return NotebookCellCreateRequestAttributes{NotebookToplistCellAttributes: v} -} - -// NotebookHeatMapCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookHeatMapCellAttributes wrapped in NotebookCellCreateRequestAttributes. -func NotebookHeatMapCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookHeatMapCellAttributes) NotebookCellCreateRequestAttributes { - return NotebookCellCreateRequestAttributes{NotebookHeatMapCellAttributes: v} -} - -// NotebookDistributionCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookDistributionCellAttributes wrapped in NotebookCellCreateRequestAttributes. -func NotebookDistributionCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookDistributionCellAttributes) NotebookCellCreateRequestAttributes { - return NotebookCellCreateRequestAttributes{NotebookDistributionCellAttributes: v} -} - -// NotebookLogStreamCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookLogStreamCellAttributes wrapped in NotebookCellCreateRequestAttributes. -func NotebookLogStreamCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookLogStreamCellAttributes) NotebookCellCreateRequestAttributes { - return NotebookCellCreateRequestAttributes{NotebookLogStreamCellAttributes: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *NotebookCellCreateRequestAttributes) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into NotebookMarkdownCellAttributes - err = json.Unmarshal(data, &obj.NotebookMarkdownCellAttributes) - if err == nil { - if obj.NotebookMarkdownCellAttributes != nil && obj.NotebookMarkdownCellAttributes.UnparsedObject == nil { - jsonNotebookMarkdownCellAttributes, _ := json.Marshal(obj.NotebookMarkdownCellAttributes) - if string(jsonNotebookMarkdownCellAttributes) == "{}" { // empty struct - obj.NotebookMarkdownCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookMarkdownCellAttributes = nil - } - } else { - obj.NotebookMarkdownCellAttributes = nil - } - - // try to unmarshal data into NotebookTimeseriesCellAttributes - err = json.Unmarshal(data, &obj.NotebookTimeseriesCellAttributes) - if err == nil { - if obj.NotebookTimeseriesCellAttributes != nil && obj.NotebookTimeseriesCellAttributes.UnparsedObject == nil { - jsonNotebookTimeseriesCellAttributes, _ := json.Marshal(obj.NotebookTimeseriesCellAttributes) - if string(jsonNotebookTimeseriesCellAttributes) == "{}" { // empty struct - obj.NotebookTimeseriesCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookTimeseriesCellAttributes = nil - } - } else { - obj.NotebookTimeseriesCellAttributes = nil - } - - // try to unmarshal data into NotebookToplistCellAttributes - err = json.Unmarshal(data, &obj.NotebookToplistCellAttributes) - if err == nil { - if obj.NotebookToplistCellAttributes != nil && obj.NotebookToplistCellAttributes.UnparsedObject == nil { - jsonNotebookToplistCellAttributes, _ := json.Marshal(obj.NotebookToplistCellAttributes) - if string(jsonNotebookToplistCellAttributes) == "{}" { // empty struct - obj.NotebookToplistCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookToplistCellAttributes = nil - } - } else { - obj.NotebookToplistCellAttributes = nil - } - - // try to unmarshal data into NotebookHeatMapCellAttributes - err = json.Unmarshal(data, &obj.NotebookHeatMapCellAttributes) - if err == nil { - if obj.NotebookHeatMapCellAttributes != nil && obj.NotebookHeatMapCellAttributes.UnparsedObject == nil { - jsonNotebookHeatMapCellAttributes, _ := json.Marshal(obj.NotebookHeatMapCellAttributes) - if string(jsonNotebookHeatMapCellAttributes) == "{}" { // empty struct - obj.NotebookHeatMapCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookHeatMapCellAttributes = nil - } - } else { - obj.NotebookHeatMapCellAttributes = nil - } - - // try to unmarshal data into NotebookDistributionCellAttributes - err = json.Unmarshal(data, &obj.NotebookDistributionCellAttributes) - if err == nil { - if obj.NotebookDistributionCellAttributes != nil && obj.NotebookDistributionCellAttributes.UnparsedObject == nil { - jsonNotebookDistributionCellAttributes, _ := json.Marshal(obj.NotebookDistributionCellAttributes) - if string(jsonNotebookDistributionCellAttributes) == "{}" { // empty struct - obj.NotebookDistributionCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookDistributionCellAttributes = nil - } - } else { - obj.NotebookDistributionCellAttributes = nil - } - - // try to unmarshal data into NotebookLogStreamCellAttributes - err = json.Unmarshal(data, &obj.NotebookLogStreamCellAttributes) - if err == nil { - if obj.NotebookLogStreamCellAttributes != nil && obj.NotebookLogStreamCellAttributes.UnparsedObject == nil { - jsonNotebookLogStreamCellAttributes, _ := json.Marshal(obj.NotebookLogStreamCellAttributes) - if string(jsonNotebookLogStreamCellAttributes) == "{}" { // empty struct - obj.NotebookLogStreamCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookLogStreamCellAttributes = nil - } - } else { - obj.NotebookLogStreamCellAttributes = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.NotebookMarkdownCellAttributes = nil - obj.NotebookTimeseriesCellAttributes = nil - obj.NotebookToplistCellAttributes = nil - obj.NotebookHeatMapCellAttributes = nil - obj.NotebookDistributionCellAttributes = nil - obj.NotebookLogStreamCellAttributes = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj NotebookCellCreateRequestAttributes) MarshalJSON() ([]byte, error) { - if obj.NotebookMarkdownCellAttributes != nil { - return json.Marshal(&obj.NotebookMarkdownCellAttributes) - } - - if obj.NotebookTimeseriesCellAttributes != nil { - return json.Marshal(&obj.NotebookTimeseriesCellAttributes) - } - - if obj.NotebookToplistCellAttributes != nil { - return json.Marshal(&obj.NotebookToplistCellAttributes) - } - - if obj.NotebookHeatMapCellAttributes != nil { - return json.Marshal(&obj.NotebookHeatMapCellAttributes) - } - - if obj.NotebookDistributionCellAttributes != nil { - return json.Marshal(&obj.NotebookDistributionCellAttributes) - } - - if obj.NotebookLogStreamCellAttributes != nil { - return json.Marshal(&obj.NotebookLogStreamCellAttributes) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *NotebookCellCreateRequestAttributes) GetActualInstance() interface{} { - if obj.NotebookMarkdownCellAttributes != nil { - return obj.NotebookMarkdownCellAttributes - } - - if obj.NotebookTimeseriesCellAttributes != nil { - return obj.NotebookTimeseriesCellAttributes - } - - if obj.NotebookToplistCellAttributes != nil { - return obj.NotebookToplistCellAttributes - } - - if obj.NotebookHeatMapCellAttributes != nil { - return obj.NotebookHeatMapCellAttributes - } - - if obj.NotebookDistributionCellAttributes != nil { - return obj.NotebookDistributionCellAttributes - } - - if obj.NotebookLogStreamCellAttributes != nil { - return obj.NotebookLogStreamCellAttributes - } - - // all schemas are nil - return nil -} - -// NullableNotebookCellCreateRequestAttributes handles when a null is used for NotebookCellCreateRequestAttributes. -type NullableNotebookCellCreateRequestAttributes struct { - value *NotebookCellCreateRequestAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellCreateRequestAttributes) Get() *NotebookCellCreateRequestAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellCreateRequestAttributes) Set(val *NotebookCellCreateRequestAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellCreateRequestAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookCellCreateRequestAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellCreateRequestAttributes initializes the struct as if Set has been called. -func NewNullableNotebookCellCreateRequestAttributes(val *NotebookCellCreateRequestAttributes) *NullableNotebookCellCreateRequestAttributes { - return &NullableNotebookCellCreateRequestAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellCreateRequestAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellCreateRequestAttributes) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_cell_resource_type.go b/api/v1/datadog/model_notebook_cell_resource_type.go deleted file mode 100644 index 60c223ad8c9..00000000000 --- a/api/v1/datadog/model_notebook_cell_resource_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookCellResourceType Type of the Notebook Cell resource. -type NotebookCellResourceType string - -// List of NotebookCellResourceType. -const ( - NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS NotebookCellResourceType = "notebook_cells" -) - -var allowedNotebookCellResourceTypeEnumValues = []NotebookCellResourceType{ - NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NotebookCellResourceType) GetAllowedValues() []NotebookCellResourceType { - return allowedNotebookCellResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NotebookCellResourceType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NotebookCellResourceType(value) - return nil -} - -// NewNotebookCellResourceTypeFromValue returns a pointer to a valid NotebookCellResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNotebookCellResourceTypeFromValue(v string) (*NotebookCellResourceType, error) { - ev := NotebookCellResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NotebookCellResourceType: valid values are %v", v, allowedNotebookCellResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NotebookCellResourceType) IsValid() bool { - for _, existing := range allowedNotebookCellResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NotebookCellResourceType value. -func (v NotebookCellResourceType) Ptr() *NotebookCellResourceType { - return &v -} - -// NullableNotebookCellResourceType handles when a null is used for NotebookCellResourceType. -type NullableNotebookCellResourceType struct { - value *NotebookCellResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellResourceType) Get() *NotebookCellResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellResourceType) Set(val *NotebookCellResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookCellResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellResourceType initializes the struct as if Set has been called. -func NewNullableNotebookCellResourceType(val *NotebookCellResourceType) *NullableNotebookCellResourceType { - return &NullableNotebookCellResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_cell_response.go b/api/v1/datadog/model_notebook_cell_response.go deleted file mode 100644 index f7f663d4f94..00000000000 --- a/api/v1/datadog/model_notebook_cell_response.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookCellResponse The description of a notebook cell response. -type NotebookCellResponse struct { - // The attributes of a notebook cell response. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, - // `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) - Attributes NotebookCellResponseAttributes `json:"attributes"` - // Notebook cell ID. - Id string `json:"id"` - // Type of the Notebook Cell resource. - Type NotebookCellResourceType `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{} -} - -// NewNotebookCellResponse instantiates a new NotebookCellResponse 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 NewNotebookCellResponse(attributes NotebookCellResponseAttributes, id string, typeVar NotebookCellResourceType) *NotebookCellResponse { - this := NotebookCellResponse{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewNotebookCellResponseWithDefaults instantiates a new NotebookCellResponse 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 NewNotebookCellResponseWithDefaults() *NotebookCellResponse { - this := NotebookCellResponse{} - var typeVar NotebookCellResourceType = NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *NotebookCellResponse) GetAttributes() NotebookCellResponseAttributes { - if o == nil { - var ret NotebookCellResponseAttributes - 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 *NotebookCellResponse) GetAttributesOk() (*NotebookCellResponseAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *NotebookCellResponse) SetAttributes(v NotebookCellResponseAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *NotebookCellResponse) 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 *NotebookCellResponse) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *NotebookCellResponse) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *NotebookCellResponse) GetType() NotebookCellResourceType { - if o == nil { - var ret NotebookCellResourceType - 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 *NotebookCellResponse) GetTypeOk() (*NotebookCellResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookCellResponse) SetType(v NotebookCellResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookCellResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookCellResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *NotebookCellResponseAttributes `json:"attributes"` - Id *string `json:"id"` - Type *NotebookCellResourceType `json:"type"` - }{} - all := struct { - Attributes NotebookCellResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type NotebookCellResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_cell_response_attributes.go b/api/v1/datadog/model_notebook_cell_response_attributes.go deleted file mode 100644 index 4d4396a2a72..00000000000 --- a/api/v1/datadog/model_notebook_cell_response_attributes.go +++ /dev/null @@ -1,284 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookCellResponseAttributes - The attributes of a notebook cell response. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, -// `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) -type NotebookCellResponseAttributes struct { - NotebookMarkdownCellAttributes *NotebookMarkdownCellAttributes - NotebookTimeseriesCellAttributes *NotebookTimeseriesCellAttributes - NotebookToplistCellAttributes *NotebookToplistCellAttributes - NotebookHeatMapCellAttributes *NotebookHeatMapCellAttributes - NotebookDistributionCellAttributes *NotebookDistributionCellAttributes - NotebookLogStreamCellAttributes *NotebookLogStreamCellAttributes - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// NotebookMarkdownCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookMarkdownCellAttributes wrapped in NotebookCellResponseAttributes. -func NotebookMarkdownCellAttributesAsNotebookCellResponseAttributes(v *NotebookMarkdownCellAttributes) NotebookCellResponseAttributes { - return NotebookCellResponseAttributes{NotebookMarkdownCellAttributes: v} -} - -// NotebookTimeseriesCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookTimeseriesCellAttributes wrapped in NotebookCellResponseAttributes. -func NotebookTimeseriesCellAttributesAsNotebookCellResponseAttributes(v *NotebookTimeseriesCellAttributes) NotebookCellResponseAttributes { - return NotebookCellResponseAttributes{NotebookTimeseriesCellAttributes: v} -} - -// NotebookToplistCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookToplistCellAttributes wrapped in NotebookCellResponseAttributes. -func NotebookToplistCellAttributesAsNotebookCellResponseAttributes(v *NotebookToplistCellAttributes) NotebookCellResponseAttributes { - return NotebookCellResponseAttributes{NotebookToplistCellAttributes: v} -} - -// NotebookHeatMapCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookHeatMapCellAttributes wrapped in NotebookCellResponseAttributes. -func NotebookHeatMapCellAttributesAsNotebookCellResponseAttributes(v *NotebookHeatMapCellAttributes) NotebookCellResponseAttributes { - return NotebookCellResponseAttributes{NotebookHeatMapCellAttributes: v} -} - -// NotebookDistributionCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookDistributionCellAttributes wrapped in NotebookCellResponseAttributes. -func NotebookDistributionCellAttributesAsNotebookCellResponseAttributes(v *NotebookDistributionCellAttributes) NotebookCellResponseAttributes { - return NotebookCellResponseAttributes{NotebookDistributionCellAttributes: v} -} - -// NotebookLogStreamCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookLogStreamCellAttributes wrapped in NotebookCellResponseAttributes. -func NotebookLogStreamCellAttributesAsNotebookCellResponseAttributes(v *NotebookLogStreamCellAttributes) NotebookCellResponseAttributes { - return NotebookCellResponseAttributes{NotebookLogStreamCellAttributes: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *NotebookCellResponseAttributes) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into NotebookMarkdownCellAttributes - err = json.Unmarshal(data, &obj.NotebookMarkdownCellAttributes) - if err == nil { - if obj.NotebookMarkdownCellAttributes != nil && obj.NotebookMarkdownCellAttributes.UnparsedObject == nil { - jsonNotebookMarkdownCellAttributes, _ := json.Marshal(obj.NotebookMarkdownCellAttributes) - if string(jsonNotebookMarkdownCellAttributes) == "{}" { // empty struct - obj.NotebookMarkdownCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookMarkdownCellAttributes = nil - } - } else { - obj.NotebookMarkdownCellAttributes = nil - } - - // try to unmarshal data into NotebookTimeseriesCellAttributes - err = json.Unmarshal(data, &obj.NotebookTimeseriesCellAttributes) - if err == nil { - if obj.NotebookTimeseriesCellAttributes != nil && obj.NotebookTimeseriesCellAttributes.UnparsedObject == nil { - jsonNotebookTimeseriesCellAttributes, _ := json.Marshal(obj.NotebookTimeseriesCellAttributes) - if string(jsonNotebookTimeseriesCellAttributes) == "{}" { // empty struct - obj.NotebookTimeseriesCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookTimeseriesCellAttributes = nil - } - } else { - obj.NotebookTimeseriesCellAttributes = nil - } - - // try to unmarshal data into NotebookToplistCellAttributes - err = json.Unmarshal(data, &obj.NotebookToplistCellAttributes) - if err == nil { - if obj.NotebookToplistCellAttributes != nil && obj.NotebookToplistCellAttributes.UnparsedObject == nil { - jsonNotebookToplistCellAttributes, _ := json.Marshal(obj.NotebookToplistCellAttributes) - if string(jsonNotebookToplistCellAttributes) == "{}" { // empty struct - obj.NotebookToplistCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookToplistCellAttributes = nil - } - } else { - obj.NotebookToplistCellAttributes = nil - } - - // try to unmarshal data into NotebookHeatMapCellAttributes - err = json.Unmarshal(data, &obj.NotebookHeatMapCellAttributes) - if err == nil { - if obj.NotebookHeatMapCellAttributes != nil && obj.NotebookHeatMapCellAttributes.UnparsedObject == nil { - jsonNotebookHeatMapCellAttributes, _ := json.Marshal(obj.NotebookHeatMapCellAttributes) - if string(jsonNotebookHeatMapCellAttributes) == "{}" { // empty struct - obj.NotebookHeatMapCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookHeatMapCellAttributes = nil - } - } else { - obj.NotebookHeatMapCellAttributes = nil - } - - // try to unmarshal data into NotebookDistributionCellAttributes - err = json.Unmarshal(data, &obj.NotebookDistributionCellAttributes) - if err == nil { - if obj.NotebookDistributionCellAttributes != nil && obj.NotebookDistributionCellAttributes.UnparsedObject == nil { - jsonNotebookDistributionCellAttributes, _ := json.Marshal(obj.NotebookDistributionCellAttributes) - if string(jsonNotebookDistributionCellAttributes) == "{}" { // empty struct - obj.NotebookDistributionCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookDistributionCellAttributes = nil - } - } else { - obj.NotebookDistributionCellAttributes = nil - } - - // try to unmarshal data into NotebookLogStreamCellAttributes - err = json.Unmarshal(data, &obj.NotebookLogStreamCellAttributes) - if err == nil { - if obj.NotebookLogStreamCellAttributes != nil && obj.NotebookLogStreamCellAttributes.UnparsedObject == nil { - jsonNotebookLogStreamCellAttributes, _ := json.Marshal(obj.NotebookLogStreamCellAttributes) - if string(jsonNotebookLogStreamCellAttributes) == "{}" { // empty struct - obj.NotebookLogStreamCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookLogStreamCellAttributes = nil - } - } else { - obj.NotebookLogStreamCellAttributes = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.NotebookMarkdownCellAttributes = nil - obj.NotebookTimeseriesCellAttributes = nil - obj.NotebookToplistCellAttributes = nil - obj.NotebookHeatMapCellAttributes = nil - obj.NotebookDistributionCellAttributes = nil - obj.NotebookLogStreamCellAttributes = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj NotebookCellResponseAttributes) MarshalJSON() ([]byte, error) { - if obj.NotebookMarkdownCellAttributes != nil { - return json.Marshal(&obj.NotebookMarkdownCellAttributes) - } - - if obj.NotebookTimeseriesCellAttributes != nil { - return json.Marshal(&obj.NotebookTimeseriesCellAttributes) - } - - if obj.NotebookToplistCellAttributes != nil { - return json.Marshal(&obj.NotebookToplistCellAttributes) - } - - if obj.NotebookHeatMapCellAttributes != nil { - return json.Marshal(&obj.NotebookHeatMapCellAttributes) - } - - if obj.NotebookDistributionCellAttributes != nil { - return json.Marshal(&obj.NotebookDistributionCellAttributes) - } - - if obj.NotebookLogStreamCellAttributes != nil { - return json.Marshal(&obj.NotebookLogStreamCellAttributes) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *NotebookCellResponseAttributes) GetActualInstance() interface{} { - if obj.NotebookMarkdownCellAttributes != nil { - return obj.NotebookMarkdownCellAttributes - } - - if obj.NotebookTimeseriesCellAttributes != nil { - return obj.NotebookTimeseriesCellAttributes - } - - if obj.NotebookToplistCellAttributes != nil { - return obj.NotebookToplistCellAttributes - } - - if obj.NotebookHeatMapCellAttributes != nil { - return obj.NotebookHeatMapCellAttributes - } - - if obj.NotebookDistributionCellAttributes != nil { - return obj.NotebookDistributionCellAttributes - } - - if obj.NotebookLogStreamCellAttributes != nil { - return obj.NotebookLogStreamCellAttributes - } - - // all schemas are nil - return nil -} - -// NullableNotebookCellResponseAttributes handles when a null is used for NotebookCellResponseAttributes. -type NullableNotebookCellResponseAttributes struct { - value *NotebookCellResponseAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellResponseAttributes) Get() *NotebookCellResponseAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellResponseAttributes) Set(val *NotebookCellResponseAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellResponseAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookCellResponseAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellResponseAttributes initializes the struct as if Set has been called. -func NewNullableNotebookCellResponseAttributes(val *NotebookCellResponseAttributes) *NullableNotebookCellResponseAttributes { - return &NullableNotebookCellResponseAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellResponseAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellResponseAttributes) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_cell_time.go b/api/v1/datadog/model_notebook_cell_time.go deleted file mode 100644 index 201559bf14b..00000000000 --- a/api/v1/datadog/model_notebook_cell_time.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookCellTime - Timeframe for the notebook cell. When 'null', the notebook global time is used. -type NotebookCellTime struct { - NotebookRelativeTime *NotebookRelativeTime - NotebookAbsoluteTime *NotebookAbsoluteTime - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// NotebookRelativeTimeAsNotebookCellTime is a convenience function that returns NotebookRelativeTime wrapped in NotebookCellTime. -func NotebookRelativeTimeAsNotebookCellTime(v *NotebookRelativeTime) NotebookCellTime { - return NotebookCellTime{NotebookRelativeTime: v} -} - -// NotebookAbsoluteTimeAsNotebookCellTime is a convenience function that returns NotebookAbsoluteTime wrapped in NotebookCellTime. -func NotebookAbsoluteTimeAsNotebookCellTime(v *NotebookAbsoluteTime) NotebookCellTime { - return NotebookCellTime{NotebookAbsoluteTime: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *NotebookCellTime) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into NotebookRelativeTime - err = json.Unmarshal(data, &obj.NotebookRelativeTime) - if err == nil { - if obj.NotebookRelativeTime != nil && obj.NotebookRelativeTime.UnparsedObject == nil { - jsonNotebookRelativeTime, _ := json.Marshal(obj.NotebookRelativeTime) - if string(jsonNotebookRelativeTime) == "{}" { // empty struct - obj.NotebookRelativeTime = nil - } else { - match++ - } - } else { - obj.NotebookRelativeTime = nil - } - } else { - obj.NotebookRelativeTime = nil - } - - // try to unmarshal data into NotebookAbsoluteTime - err = json.Unmarshal(data, &obj.NotebookAbsoluteTime) - if err == nil { - if obj.NotebookAbsoluteTime != nil && obj.NotebookAbsoluteTime.UnparsedObject == nil { - jsonNotebookAbsoluteTime, _ := json.Marshal(obj.NotebookAbsoluteTime) - if string(jsonNotebookAbsoluteTime) == "{}" { // empty struct - obj.NotebookAbsoluteTime = nil - } else { - match++ - } - } else { - obj.NotebookAbsoluteTime = nil - } - } else { - obj.NotebookAbsoluteTime = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.NotebookRelativeTime = nil - obj.NotebookAbsoluteTime = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj NotebookCellTime) MarshalJSON() ([]byte, error) { - if obj.NotebookRelativeTime != nil { - return json.Marshal(&obj.NotebookRelativeTime) - } - - if obj.NotebookAbsoluteTime != nil { - return json.Marshal(&obj.NotebookAbsoluteTime) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *NotebookCellTime) GetActualInstance() interface{} { - if obj.NotebookRelativeTime != nil { - return obj.NotebookRelativeTime - } - - if obj.NotebookAbsoluteTime != nil { - return obj.NotebookAbsoluteTime - } - - // all schemas are nil - return nil -} - -// NullableNotebookCellTime handles when a null is used for NotebookCellTime. -type NullableNotebookCellTime struct { - value *NotebookCellTime - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellTime) Get() *NotebookCellTime { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellTime) Set(val *NotebookCellTime) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellTime) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookCellTime) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellTime initializes the struct as if Set has been called. -func NewNullableNotebookCellTime(val *NotebookCellTime) *NullableNotebookCellTime { - return &NullableNotebookCellTime{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellTime) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_cell_update_request.go b/api/v1/datadog/model_notebook_cell_update_request.go deleted file mode 100644 index c5fa310812b..00000000000 --- a/api/v1/datadog/model_notebook_cell_update_request.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookCellUpdateRequest The description of a notebook cell update request. -type NotebookCellUpdateRequest struct { - // The attributes of a notebook cell in update cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, - // `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) - Attributes NotebookCellUpdateRequestAttributes `json:"attributes"` - // Notebook cell ID. - Id string `json:"id"` - // Type of the Notebook Cell resource. - Type NotebookCellResourceType `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{} -} - -// NewNotebookCellUpdateRequest instantiates a new NotebookCellUpdateRequest 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 NewNotebookCellUpdateRequest(attributes NotebookCellUpdateRequestAttributes, id string, typeVar NotebookCellResourceType) *NotebookCellUpdateRequest { - this := NotebookCellUpdateRequest{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewNotebookCellUpdateRequestWithDefaults instantiates a new NotebookCellUpdateRequest 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 NewNotebookCellUpdateRequestWithDefaults() *NotebookCellUpdateRequest { - this := NotebookCellUpdateRequest{} - var typeVar NotebookCellResourceType = NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *NotebookCellUpdateRequest) GetAttributes() NotebookCellUpdateRequestAttributes { - if o == nil { - var ret NotebookCellUpdateRequestAttributes - 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 *NotebookCellUpdateRequest) GetAttributesOk() (*NotebookCellUpdateRequestAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *NotebookCellUpdateRequest) SetAttributes(v NotebookCellUpdateRequestAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *NotebookCellUpdateRequest) 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 *NotebookCellUpdateRequest) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *NotebookCellUpdateRequest) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *NotebookCellUpdateRequest) GetType() NotebookCellResourceType { - if o == nil { - var ret NotebookCellResourceType - 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 *NotebookCellUpdateRequest) GetTypeOk() (*NotebookCellResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookCellUpdateRequest) SetType(v NotebookCellResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookCellUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookCellUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *NotebookCellUpdateRequestAttributes `json:"attributes"` - Id *string `json:"id"` - Type *NotebookCellResourceType `json:"type"` - }{} - all := struct { - Attributes NotebookCellUpdateRequestAttributes `json:"attributes"` - Id string `json:"id"` - Type NotebookCellResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_cell_update_request_attributes.go b/api/v1/datadog/model_notebook_cell_update_request_attributes.go deleted file mode 100644 index d0de8351ecc..00000000000 --- a/api/v1/datadog/model_notebook_cell_update_request_attributes.go +++ /dev/null @@ -1,284 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookCellUpdateRequestAttributes - The attributes of a notebook cell in update cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, -// `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) -type NotebookCellUpdateRequestAttributes struct { - NotebookMarkdownCellAttributes *NotebookMarkdownCellAttributes - NotebookTimeseriesCellAttributes *NotebookTimeseriesCellAttributes - NotebookToplistCellAttributes *NotebookToplistCellAttributes - NotebookHeatMapCellAttributes *NotebookHeatMapCellAttributes - NotebookDistributionCellAttributes *NotebookDistributionCellAttributes - NotebookLogStreamCellAttributes *NotebookLogStreamCellAttributes - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// NotebookMarkdownCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookMarkdownCellAttributes wrapped in NotebookCellUpdateRequestAttributes. -func NotebookMarkdownCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookMarkdownCellAttributes) NotebookCellUpdateRequestAttributes { - return NotebookCellUpdateRequestAttributes{NotebookMarkdownCellAttributes: v} -} - -// NotebookTimeseriesCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookTimeseriesCellAttributes wrapped in NotebookCellUpdateRequestAttributes. -func NotebookTimeseriesCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookTimeseriesCellAttributes) NotebookCellUpdateRequestAttributes { - return NotebookCellUpdateRequestAttributes{NotebookTimeseriesCellAttributes: v} -} - -// NotebookToplistCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookToplistCellAttributes wrapped in NotebookCellUpdateRequestAttributes. -func NotebookToplistCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookToplistCellAttributes) NotebookCellUpdateRequestAttributes { - return NotebookCellUpdateRequestAttributes{NotebookToplistCellAttributes: v} -} - -// NotebookHeatMapCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookHeatMapCellAttributes wrapped in NotebookCellUpdateRequestAttributes. -func NotebookHeatMapCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookHeatMapCellAttributes) NotebookCellUpdateRequestAttributes { - return NotebookCellUpdateRequestAttributes{NotebookHeatMapCellAttributes: v} -} - -// NotebookDistributionCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookDistributionCellAttributes wrapped in NotebookCellUpdateRequestAttributes. -func NotebookDistributionCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookDistributionCellAttributes) NotebookCellUpdateRequestAttributes { - return NotebookCellUpdateRequestAttributes{NotebookDistributionCellAttributes: v} -} - -// NotebookLogStreamCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookLogStreamCellAttributes wrapped in NotebookCellUpdateRequestAttributes. -func NotebookLogStreamCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookLogStreamCellAttributes) NotebookCellUpdateRequestAttributes { - return NotebookCellUpdateRequestAttributes{NotebookLogStreamCellAttributes: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *NotebookCellUpdateRequestAttributes) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into NotebookMarkdownCellAttributes - err = json.Unmarshal(data, &obj.NotebookMarkdownCellAttributes) - if err == nil { - if obj.NotebookMarkdownCellAttributes != nil && obj.NotebookMarkdownCellAttributes.UnparsedObject == nil { - jsonNotebookMarkdownCellAttributes, _ := json.Marshal(obj.NotebookMarkdownCellAttributes) - if string(jsonNotebookMarkdownCellAttributes) == "{}" { // empty struct - obj.NotebookMarkdownCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookMarkdownCellAttributes = nil - } - } else { - obj.NotebookMarkdownCellAttributes = nil - } - - // try to unmarshal data into NotebookTimeseriesCellAttributes - err = json.Unmarshal(data, &obj.NotebookTimeseriesCellAttributes) - if err == nil { - if obj.NotebookTimeseriesCellAttributes != nil && obj.NotebookTimeseriesCellAttributes.UnparsedObject == nil { - jsonNotebookTimeseriesCellAttributes, _ := json.Marshal(obj.NotebookTimeseriesCellAttributes) - if string(jsonNotebookTimeseriesCellAttributes) == "{}" { // empty struct - obj.NotebookTimeseriesCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookTimeseriesCellAttributes = nil - } - } else { - obj.NotebookTimeseriesCellAttributes = nil - } - - // try to unmarshal data into NotebookToplistCellAttributes - err = json.Unmarshal(data, &obj.NotebookToplistCellAttributes) - if err == nil { - if obj.NotebookToplistCellAttributes != nil && obj.NotebookToplistCellAttributes.UnparsedObject == nil { - jsonNotebookToplistCellAttributes, _ := json.Marshal(obj.NotebookToplistCellAttributes) - if string(jsonNotebookToplistCellAttributes) == "{}" { // empty struct - obj.NotebookToplistCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookToplistCellAttributes = nil - } - } else { - obj.NotebookToplistCellAttributes = nil - } - - // try to unmarshal data into NotebookHeatMapCellAttributes - err = json.Unmarshal(data, &obj.NotebookHeatMapCellAttributes) - if err == nil { - if obj.NotebookHeatMapCellAttributes != nil && obj.NotebookHeatMapCellAttributes.UnparsedObject == nil { - jsonNotebookHeatMapCellAttributes, _ := json.Marshal(obj.NotebookHeatMapCellAttributes) - if string(jsonNotebookHeatMapCellAttributes) == "{}" { // empty struct - obj.NotebookHeatMapCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookHeatMapCellAttributes = nil - } - } else { - obj.NotebookHeatMapCellAttributes = nil - } - - // try to unmarshal data into NotebookDistributionCellAttributes - err = json.Unmarshal(data, &obj.NotebookDistributionCellAttributes) - if err == nil { - if obj.NotebookDistributionCellAttributes != nil && obj.NotebookDistributionCellAttributes.UnparsedObject == nil { - jsonNotebookDistributionCellAttributes, _ := json.Marshal(obj.NotebookDistributionCellAttributes) - if string(jsonNotebookDistributionCellAttributes) == "{}" { // empty struct - obj.NotebookDistributionCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookDistributionCellAttributes = nil - } - } else { - obj.NotebookDistributionCellAttributes = nil - } - - // try to unmarshal data into NotebookLogStreamCellAttributes - err = json.Unmarshal(data, &obj.NotebookLogStreamCellAttributes) - if err == nil { - if obj.NotebookLogStreamCellAttributes != nil && obj.NotebookLogStreamCellAttributes.UnparsedObject == nil { - jsonNotebookLogStreamCellAttributes, _ := json.Marshal(obj.NotebookLogStreamCellAttributes) - if string(jsonNotebookLogStreamCellAttributes) == "{}" { // empty struct - obj.NotebookLogStreamCellAttributes = nil - } else { - match++ - } - } else { - obj.NotebookLogStreamCellAttributes = nil - } - } else { - obj.NotebookLogStreamCellAttributes = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.NotebookMarkdownCellAttributes = nil - obj.NotebookTimeseriesCellAttributes = nil - obj.NotebookToplistCellAttributes = nil - obj.NotebookHeatMapCellAttributes = nil - obj.NotebookDistributionCellAttributes = nil - obj.NotebookLogStreamCellAttributes = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj NotebookCellUpdateRequestAttributes) MarshalJSON() ([]byte, error) { - if obj.NotebookMarkdownCellAttributes != nil { - return json.Marshal(&obj.NotebookMarkdownCellAttributes) - } - - if obj.NotebookTimeseriesCellAttributes != nil { - return json.Marshal(&obj.NotebookTimeseriesCellAttributes) - } - - if obj.NotebookToplistCellAttributes != nil { - return json.Marshal(&obj.NotebookToplistCellAttributes) - } - - if obj.NotebookHeatMapCellAttributes != nil { - return json.Marshal(&obj.NotebookHeatMapCellAttributes) - } - - if obj.NotebookDistributionCellAttributes != nil { - return json.Marshal(&obj.NotebookDistributionCellAttributes) - } - - if obj.NotebookLogStreamCellAttributes != nil { - return json.Marshal(&obj.NotebookLogStreamCellAttributes) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *NotebookCellUpdateRequestAttributes) GetActualInstance() interface{} { - if obj.NotebookMarkdownCellAttributes != nil { - return obj.NotebookMarkdownCellAttributes - } - - if obj.NotebookTimeseriesCellAttributes != nil { - return obj.NotebookTimeseriesCellAttributes - } - - if obj.NotebookToplistCellAttributes != nil { - return obj.NotebookToplistCellAttributes - } - - if obj.NotebookHeatMapCellAttributes != nil { - return obj.NotebookHeatMapCellAttributes - } - - if obj.NotebookDistributionCellAttributes != nil { - return obj.NotebookDistributionCellAttributes - } - - if obj.NotebookLogStreamCellAttributes != nil { - return obj.NotebookLogStreamCellAttributes - } - - // all schemas are nil - return nil -} - -// NullableNotebookCellUpdateRequestAttributes handles when a null is used for NotebookCellUpdateRequestAttributes. -type NullableNotebookCellUpdateRequestAttributes struct { - value *NotebookCellUpdateRequestAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookCellUpdateRequestAttributes) Get() *NotebookCellUpdateRequestAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookCellUpdateRequestAttributes) Set(val *NotebookCellUpdateRequestAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookCellUpdateRequestAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookCellUpdateRequestAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookCellUpdateRequestAttributes initializes the struct as if Set has been called. -func NewNullableNotebookCellUpdateRequestAttributes(val *NotebookCellUpdateRequestAttributes) *NullableNotebookCellUpdateRequestAttributes { - return &NullableNotebookCellUpdateRequestAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookCellUpdateRequestAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookCellUpdateRequestAttributes) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_create_data.go b/api/v1/datadog/model_notebook_create_data.go deleted file mode 100644 index bec1eec183c..00000000000 --- a/api/v1/datadog/model_notebook_create_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookCreateData The data for a notebook create request. -type NotebookCreateData struct { - // The data attributes of a notebook. - Attributes NotebookCreateDataAttributes `json:"attributes"` - // Type of the Notebook resource. - Type NotebookResourceType `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{} -} - -// NewNotebookCreateData instantiates a new NotebookCreateData 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 NewNotebookCreateData(attributes NotebookCreateDataAttributes, typeVar NotebookResourceType) *NotebookCreateData { - this := NotebookCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewNotebookCreateDataWithDefaults instantiates a new NotebookCreateData 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 NewNotebookCreateDataWithDefaults() *NotebookCreateData { - this := NotebookCreateData{} - var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *NotebookCreateData) GetAttributes() NotebookCreateDataAttributes { - if o == nil { - var ret NotebookCreateDataAttributes - 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 *NotebookCreateData) GetAttributesOk() (*NotebookCreateDataAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *NotebookCreateData) SetAttributes(v NotebookCreateDataAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *NotebookCreateData) GetType() NotebookResourceType { - if o == nil { - var ret NotebookResourceType - 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 *NotebookCreateData) GetTypeOk() (*NotebookResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookCreateData) SetType(v NotebookResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *NotebookCreateDataAttributes `json:"attributes"` - Type *NotebookResourceType `json:"type"` - }{} - all := struct { - Attributes NotebookCreateDataAttributes `json:"attributes"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_create_data_attributes.go b/api/v1/datadog/model_notebook_create_data_attributes.go deleted file mode 100644 index e7c05319d2a..00000000000 --- a/api/v1/datadog/model_notebook_create_data_attributes.go +++ /dev/null @@ -1,266 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookCreateDataAttributes The data attributes of a notebook. -type NotebookCreateDataAttributes struct { - // List of cells to display in the notebook. - Cells []NotebookCellCreateRequest `json:"cells"` - // Metadata associated with the notebook. - Metadata *NotebookMetadata `json:"metadata,omitempty"` - // The name of the notebook. - Name string `json:"name"` - // Publication status of the notebook. For now, always "published". - Status *NotebookStatus `json:"status,omitempty"` - // Notebook global timeframe. - Time NotebookGlobalTime `json:"time"` - // 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{} -} - -// NewNotebookCreateDataAttributes instantiates a new NotebookCreateDataAttributes 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 NewNotebookCreateDataAttributes(cells []NotebookCellCreateRequest, name string, time NotebookGlobalTime) *NotebookCreateDataAttributes { - this := NotebookCreateDataAttributes{} - this.Cells = cells - this.Name = name - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - this.Time = time - return &this -} - -// NewNotebookCreateDataAttributesWithDefaults instantiates a new NotebookCreateDataAttributes 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 NewNotebookCreateDataAttributesWithDefaults() *NotebookCreateDataAttributes { - this := NotebookCreateDataAttributes{} - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - return &this -} - -// GetCells returns the Cells field value. -func (o *NotebookCreateDataAttributes) GetCells() []NotebookCellCreateRequest { - if o == nil { - var ret []NotebookCellCreateRequest - return ret - } - return o.Cells -} - -// GetCellsOk returns a tuple with the Cells field value -// and a boolean to check if the value has been set. -func (o *NotebookCreateDataAttributes) GetCellsOk() (*[]NotebookCellCreateRequest, bool) { - if o == nil { - return nil, false - } - return &o.Cells, true -} - -// SetCells sets field value. -func (o *NotebookCreateDataAttributes) SetCells(v []NotebookCellCreateRequest) { - o.Cells = v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *NotebookCreateDataAttributes) GetMetadata() NotebookMetadata { - if o == nil || o.Metadata == nil { - var ret NotebookMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookCreateDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *NotebookCreateDataAttributes) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. -func (o *NotebookCreateDataAttributes) SetMetadata(v NotebookMetadata) { - o.Metadata = &v -} - -// GetName returns the Name field value. -func (o *NotebookCreateDataAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *NotebookCreateDataAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *NotebookCreateDataAttributes) SetName(v string) { - o.Name = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *NotebookCreateDataAttributes) GetStatus() NotebookStatus { - if o == nil || o.Status == nil { - var ret NotebookStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookCreateDataAttributes) GetStatusOk() (*NotebookStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *NotebookCreateDataAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. -func (o *NotebookCreateDataAttributes) SetStatus(v NotebookStatus) { - o.Status = &v -} - -// GetTime returns the Time field value. -func (o *NotebookCreateDataAttributes) GetTime() NotebookGlobalTime { - if o == nil { - var ret NotebookGlobalTime - return ret - } - return o.Time -} - -// GetTimeOk returns a tuple with the Time field value -// and a boolean to check if the value has been set. -func (o *NotebookCreateDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { - if o == nil { - return nil, false - } - return &o.Time, true -} - -// SetTime sets field value. -func (o *NotebookCreateDataAttributes) SetTime(v NotebookGlobalTime) { - o.Time = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookCreateDataAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["cells"] = o.Cells - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - toSerialize["name"] = o.Name - if o.Status != nil { - toSerialize["status"] = o.Status - } - toSerialize["time"] = o.Time - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Cells *[]NotebookCellCreateRequest `json:"cells"` - Name *string `json:"name"` - Time *NotebookGlobalTime `json:"time"` - }{} - all := struct { - Cells []NotebookCellCreateRequest `json:"cells"` - Metadata *NotebookMetadata `json:"metadata,omitempty"` - Name string `json:"name"` - Status *NotebookStatus `json:"status,omitempty"` - Time NotebookGlobalTime `json:"time"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Cells == nil { - return fmt.Errorf("Required field cells missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Time == nil { - return fmt.Errorf("Required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cells = all.Cells - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Name = all.Name - o.Status = all.Status - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_create_request.go b/api/v1/datadog/model_notebook_create_request.go deleted file mode 100644 index 3d9d5799f65..00000000000 --- a/api/v1/datadog/model_notebook_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookCreateRequest The description of a notebook create request. -type NotebookCreateRequest struct { - // The data for a notebook create request. - Data NotebookCreateData `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{} -} - -// NewNotebookCreateRequest instantiates a new NotebookCreateRequest 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 NewNotebookCreateRequest(data NotebookCreateData) *NotebookCreateRequest { - this := NotebookCreateRequest{} - this.Data = data - return &this -} - -// NewNotebookCreateRequestWithDefaults instantiates a new NotebookCreateRequest 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 NewNotebookCreateRequestWithDefaults() *NotebookCreateRequest { - this := NotebookCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *NotebookCreateRequest) GetData() NotebookCreateData { - if o == nil { - var ret NotebookCreateData - 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 *NotebookCreateRequest) GetDataOk() (*NotebookCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *NotebookCreateRequest) SetData(v NotebookCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *NotebookCreateData `json:"data"` - }{} - all := struct { - Data NotebookCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_notebook_distribution_cell_attributes.go b/api/v1/datadog/model_notebook_distribution_cell_attributes.go deleted file mode 100644 index 51a773ba179..00000000000 --- a/api/v1/datadog/model_notebook_distribution_cell_attributes.go +++ /dev/null @@ -1,255 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookDistributionCellAttributes The attributes of a notebook `distribution` cell. -type NotebookDistributionCellAttributes struct { - // The Distribution visualization is another way of showing metrics - // aggregated across one or several tags, such as hosts. - // Unlike the heat map, a distribution graph’s x-axis is quantity rather than time. - Definition DistributionWidgetDefinition `json:"definition"` - // The size of the graph. - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - // Object describing how to split the graph to display multiple visualizations per request. - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - // Timeframe for the notebook cell. When 'null', the notebook global time is used. - Time NullableNotebookCellTime `json:"time,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{} -} - -// NewNotebookDistributionCellAttributes instantiates a new NotebookDistributionCellAttributes 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 NewNotebookDistributionCellAttributes(definition DistributionWidgetDefinition) *NotebookDistributionCellAttributes { - this := NotebookDistributionCellAttributes{} - this.Definition = definition - return &this -} - -// NewNotebookDistributionCellAttributesWithDefaults instantiates a new NotebookDistributionCellAttributes 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 NewNotebookDistributionCellAttributesWithDefaults() *NotebookDistributionCellAttributes { - this := NotebookDistributionCellAttributes{} - return &this -} - -// GetDefinition returns the Definition field value. -func (o *NotebookDistributionCellAttributes) GetDefinition() DistributionWidgetDefinition { - if o == nil { - var ret DistributionWidgetDefinition - return ret - } - return o.Definition -} - -// GetDefinitionOk returns a tuple with the Definition field value -// and a boolean to check if the value has been set. -func (o *NotebookDistributionCellAttributes) GetDefinitionOk() (*DistributionWidgetDefinition, bool) { - if o == nil { - return nil, false - } - return &o.Definition, true -} - -// SetDefinition sets field value. -func (o *NotebookDistributionCellAttributes) SetDefinition(v DistributionWidgetDefinition) { - o.Definition = v -} - -// GetGraphSize returns the GraphSize field value if set, zero value otherwise. -func (o *NotebookDistributionCellAttributes) GetGraphSize() NotebookGraphSize { - if o == nil || o.GraphSize == nil { - var ret NotebookGraphSize - return ret - } - return *o.GraphSize -} - -// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookDistributionCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { - if o == nil || o.GraphSize == nil { - return nil, false - } - return o.GraphSize, true -} - -// HasGraphSize returns a boolean if a field has been set. -func (o *NotebookDistributionCellAttributes) HasGraphSize() bool { - if o != nil && o.GraphSize != nil { - return true - } - - return false -} - -// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. -func (o *NotebookDistributionCellAttributes) SetGraphSize(v NotebookGraphSize) { - o.GraphSize = &v -} - -// GetSplitBy returns the SplitBy field value if set, zero value otherwise. -func (o *NotebookDistributionCellAttributes) GetSplitBy() NotebookSplitBy { - if o == nil || o.SplitBy == nil { - var ret NotebookSplitBy - return ret - } - return *o.SplitBy -} - -// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookDistributionCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { - if o == nil || o.SplitBy == nil { - return nil, false - } - return o.SplitBy, true -} - -// HasSplitBy returns a boolean if a field has been set. -func (o *NotebookDistributionCellAttributes) HasSplitBy() bool { - if o != nil && o.SplitBy != nil { - return true - } - - return false -} - -// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. -func (o *NotebookDistributionCellAttributes) SetSplitBy(v NotebookSplitBy) { - o.SplitBy = &v -} - -// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookDistributionCellAttributes) GetTime() NotebookCellTime { - if o == nil || o.Time.Get() == nil { - var ret NotebookCellTime - return ret - } - return *o.Time.Get() -} - -// GetTimeOk returns a tuple with the Time 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 *NotebookDistributionCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { - if o == nil { - return nil, false - } - return o.Time.Get(), o.Time.IsSet() -} - -// HasTime returns a boolean if a field has been set. -func (o *NotebookDistributionCellAttributes) HasTime() bool { - if o != nil && o.Time.IsSet() { - return true - } - - return false -} - -// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. -func (o *NotebookDistributionCellAttributes) SetTime(v NotebookCellTime) { - o.Time.Set(&v) -} - -// SetTimeNil sets the value for Time to be an explicit nil. -func (o *NotebookDistributionCellAttributes) SetTimeNil() { - o.Time.Set(nil) -} - -// UnsetTime ensures that no value is present for Time, not even an explicit nil. -func (o *NotebookDistributionCellAttributes) UnsetTime() { - o.Time.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookDistributionCellAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["definition"] = o.Definition - if o.GraphSize != nil { - toSerialize["graph_size"] = o.GraphSize - } - if o.SplitBy != nil { - toSerialize["split_by"] = o.SplitBy - } - if o.Time.IsSet() { - toSerialize["time"] = o.Time.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Definition *DistributionWidgetDefinition `json:"definition"` - }{} - all := struct { - Definition DistributionWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("Required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Definition = all.Definition - o.GraphSize = all.GraphSize - if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SplitBy = all.SplitBy - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_global_time.go b/api/v1/datadog/model_notebook_global_time.go deleted file mode 100644 index 81952cca0b1..00000000000 --- a/api/v1/datadog/model_notebook_global_time.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookGlobalTime - Notebook global timeframe. -type NotebookGlobalTime struct { - NotebookRelativeTime *NotebookRelativeTime - NotebookAbsoluteTime *NotebookAbsoluteTime - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// NotebookRelativeTimeAsNotebookGlobalTime is a convenience function that returns NotebookRelativeTime wrapped in NotebookGlobalTime. -func NotebookRelativeTimeAsNotebookGlobalTime(v *NotebookRelativeTime) NotebookGlobalTime { - return NotebookGlobalTime{NotebookRelativeTime: v} -} - -// NotebookAbsoluteTimeAsNotebookGlobalTime is a convenience function that returns NotebookAbsoluteTime wrapped in NotebookGlobalTime. -func NotebookAbsoluteTimeAsNotebookGlobalTime(v *NotebookAbsoluteTime) NotebookGlobalTime { - return NotebookGlobalTime{NotebookAbsoluteTime: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *NotebookGlobalTime) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into NotebookRelativeTime - err = json.Unmarshal(data, &obj.NotebookRelativeTime) - if err == nil { - if obj.NotebookRelativeTime != nil && obj.NotebookRelativeTime.UnparsedObject == nil { - jsonNotebookRelativeTime, _ := json.Marshal(obj.NotebookRelativeTime) - if string(jsonNotebookRelativeTime) == "{}" { // empty struct - obj.NotebookRelativeTime = nil - } else { - match++ - } - } else { - obj.NotebookRelativeTime = nil - } - } else { - obj.NotebookRelativeTime = nil - } - - // try to unmarshal data into NotebookAbsoluteTime - err = json.Unmarshal(data, &obj.NotebookAbsoluteTime) - if err == nil { - if obj.NotebookAbsoluteTime != nil && obj.NotebookAbsoluteTime.UnparsedObject == nil { - jsonNotebookAbsoluteTime, _ := json.Marshal(obj.NotebookAbsoluteTime) - if string(jsonNotebookAbsoluteTime) == "{}" { // empty struct - obj.NotebookAbsoluteTime = nil - } else { - match++ - } - } else { - obj.NotebookAbsoluteTime = nil - } - } else { - obj.NotebookAbsoluteTime = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.NotebookRelativeTime = nil - obj.NotebookAbsoluteTime = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj NotebookGlobalTime) MarshalJSON() ([]byte, error) { - if obj.NotebookRelativeTime != nil { - return json.Marshal(&obj.NotebookRelativeTime) - } - - if obj.NotebookAbsoluteTime != nil { - return json.Marshal(&obj.NotebookAbsoluteTime) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *NotebookGlobalTime) GetActualInstance() interface{} { - if obj.NotebookRelativeTime != nil { - return obj.NotebookRelativeTime - } - - if obj.NotebookAbsoluteTime != nil { - return obj.NotebookAbsoluteTime - } - - // all schemas are nil - return nil -} - -// NullableNotebookGlobalTime handles when a null is used for NotebookGlobalTime. -type NullableNotebookGlobalTime struct { - value *NotebookGlobalTime - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookGlobalTime) Get() *NotebookGlobalTime { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookGlobalTime) Set(val *NotebookGlobalTime) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookGlobalTime) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookGlobalTime) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookGlobalTime initializes the struct as if Set has been called. -func NewNullableNotebookGlobalTime(val *NotebookGlobalTime) *NullableNotebookGlobalTime { - return &NullableNotebookGlobalTime{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookGlobalTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookGlobalTime) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_graph_size.go b/api/v1/datadog/model_notebook_graph_size.go deleted file mode 100644 index 191a016a3ad..00000000000 --- a/api/v1/datadog/model_notebook_graph_size.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookGraphSize The size of the graph. -type NotebookGraphSize string - -// List of NotebookGraphSize. -const ( - NOTEBOOKGRAPHSIZE_EXTRA_SMALL NotebookGraphSize = "xs" - NOTEBOOKGRAPHSIZE_SMALL NotebookGraphSize = "s" - NOTEBOOKGRAPHSIZE_MEDIUM NotebookGraphSize = "m" - NOTEBOOKGRAPHSIZE_LARGE NotebookGraphSize = "l" - NOTEBOOKGRAPHSIZE_EXTRA_LARGE NotebookGraphSize = "xl" -) - -var allowedNotebookGraphSizeEnumValues = []NotebookGraphSize{ - NOTEBOOKGRAPHSIZE_EXTRA_SMALL, - NOTEBOOKGRAPHSIZE_SMALL, - NOTEBOOKGRAPHSIZE_MEDIUM, - NOTEBOOKGRAPHSIZE_LARGE, - NOTEBOOKGRAPHSIZE_EXTRA_LARGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NotebookGraphSize) GetAllowedValues() []NotebookGraphSize { - return allowedNotebookGraphSizeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NotebookGraphSize) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NotebookGraphSize(value) - return nil -} - -// NewNotebookGraphSizeFromValue returns a pointer to a valid NotebookGraphSize -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNotebookGraphSizeFromValue(v string) (*NotebookGraphSize, error) { - ev := NotebookGraphSize(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NotebookGraphSize: valid values are %v", v, allowedNotebookGraphSizeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NotebookGraphSize) IsValid() bool { - for _, existing := range allowedNotebookGraphSizeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NotebookGraphSize value. -func (v NotebookGraphSize) Ptr() *NotebookGraphSize { - return &v -} - -// NullableNotebookGraphSize handles when a null is used for NotebookGraphSize. -type NullableNotebookGraphSize struct { - value *NotebookGraphSize - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookGraphSize) Get() *NotebookGraphSize { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookGraphSize) Set(val *NotebookGraphSize) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookGraphSize) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookGraphSize) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookGraphSize initializes the struct as if Set has been called. -func NewNullableNotebookGraphSize(val *NotebookGraphSize) *NullableNotebookGraphSize { - return &NullableNotebookGraphSize{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookGraphSize) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookGraphSize) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_heat_map_cell_attributes.go b/api/v1/datadog/model_notebook_heat_map_cell_attributes.go deleted file mode 100644 index 0158b80e6fb..00000000000 --- a/api/v1/datadog/model_notebook_heat_map_cell_attributes.go +++ /dev/null @@ -1,253 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookHeatMapCellAttributes The attributes of a notebook `heatmap` cell. -type NotebookHeatMapCellAttributes struct { - // The heat map visualization shows metrics aggregated across many tags, such as hosts. The more hosts that have a particular value, the darker that square is. - Definition HeatMapWidgetDefinition `json:"definition"` - // The size of the graph. - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - // Object describing how to split the graph to display multiple visualizations per request. - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - // Timeframe for the notebook cell. When 'null', the notebook global time is used. - Time NullableNotebookCellTime `json:"time,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{} -} - -// NewNotebookHeatMapCellAttributes instantiates a new NotebookHeatMapCellAttributes 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 NewNotebookHeatMapCellAttributes(definition HeatMapWidgetDefinition) *NotebookHeatMapCellAttributes { - this := NotebookHeatMapCellAttributes{} - this.Definition = definition - return &this -} - -// NewNotebookHeatMapCellAttributesWithDefaults instantiates a new NotebookHeatMapCellAttributes 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 NewNotebookHeatMapCellAttributesWithDefaults() *NotebookHeatMapCellAttributes { - this := NotebookHeatMapCellAttributes{} - return &this -} - -// GetDefinition returns the Definition field value. -func (o *NotebookHeatMapCellAttributes) GetDefinition() HeatMapWidgetDefinition { - if o == nil { - var ret HeatMapWidgetDefinition - return ret - } - return o.Definition -} - -// GetDefinitionOk returns a tuple with the Definition field value -// and a boolean to check if the value has been set. -func (o *NotebookHeatMapCellAttributes) GetDefinitionOk() (*HeatMapWidgetDefinition, bool) { - if o == nil { - return nil, false - } - return &o.Definition, true -} - -// SetDefinition sets field value. -func (o *NotebookHeatMapCellAttributes) SetDefinition(v HeatMapWidgetDefinition) { - o.Definition = v -} - -// GetGraphSize returns the GraphSize field value if set, zero value otherwise. -func (o *NotebookHeatMapCellAttributes) GetGraphSize() NotebookGraphSize { - if o == nil || o.GraphSize == nil { - var ret NotebookGraphSize - return ret - } - return *o.GraphSize -} - -// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookHeatMapCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { - if o == nil || o.GraphSize == nil { - return nil, false - } - return o.GraphSize, true -} - -// HasGraphSize returns a boolean if a field has been set. -func (o *NotebookHeatMapCellAttributes) HasGraphSize() bool { - if o != nil && o.GraphSize != nil { - return true - } - - return false -} - -// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. -func (o *NotebookHeatMapCellAttributes) SetGraphSize(v NotebookGraphSize) { - o.GraphSize = &v -} - -// GetSplitBy returns the SplitBy field value if set, zero value otherwise. -func (o *NotebookHeatMapCellAttributes) GetSplitBy() NotebookSplitBy { - if o == nil || o.SplitBy == nil { - var ret NotebookSplitBy - return ret - } - return *o.SplitBy -} - -// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookHeatMapCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { - if o == nil || o.SplitBy == nil { - return nil, false - } - return o.SplitBy, true -} - -// HasSplitBy returns a boolean if a field has been set. -func (o *NotebookHeatMapCellAttributes) HasSplitBy() bool { - if o != nil && o.SplitBy != nil { - return true - } - - return false -} - -// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. -func (o *NotebookHeatMapCellAttributes) SetSplitBy(v NotebookSplitBy) { - o.SplitBy = &v -} - -// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookHeatMapCellAttributes) GetTime() NotebookCellTime { - if o == nil || o.Time.Get() == nil { - var ret NotebookCellTime - return ret - } - return *o.Time.Get() -} - -// GetTimeOk returns a tuple with the Time 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 *NotebookHeatMapCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { - if o == nil { - return nil, false - } - return o.Time.Get(), o.Time.IsSet() -} - -// HasTime returns a boolean if a field has been set. -func (o *NotebookHeatMapCellAttributes) HasTime() bool { - if o != nil && o.Time.IsSet() { - return true - } - - return false -} - -// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. -func (o *NotebookHeatMapCellAttributes) SetTime(v NotebookCellTime) { - o.Time.Set(&v) -} - -// SetTimeNil sets the value for Time to be an explicit nil. -func (o *NotebookHeatMapCellAttributes) SetTimeNil() { - o.Time.Set(nil) -} - -// UnsetTime ensures that no value is present for Time, not even an explicit nil. -func (o *NotebookHeatMapCellAttributes) UnsetTime() { - o.Time.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookHeatMapCellAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["definition"] = o.Definition - if o.GraphSize != nil { - toSerialize["graph_size"] = o.GraphSize - } - if o.SplitBy != nil { - toSerialize["split_by"] = o.SplitBy - } - if o.Time.IsSet() { - toSerialize["time"] = o.Time.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Definition *HeatMapWidgetDefinition `json:"definition"` - }{} - all := struct { - Definition HeatMapWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("Required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Definition = all.Definition - o.GraphSize = all.GraphSize - if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SplitBy = all.SplitBy - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_log_stream_cell_attributes.go b/api/v1/datadog/model_notebook_log_stream_cell_attributes.go deleted file mode 100644 index 49a480b5701..00000000000 --- a/api/v1/datadog/model_notebook_log_stream_cell_attributes.go +++ /dev/null @@ -1,207 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookLogStreamCellAttributes The attributes of a notebook `log_stream` cell. -type NotebookLogStreamCellAttributes struct { - // The Log Stream displays a log flow matching the defined query. Only available on FREE layout dashboards. - Definition LogStreamWidgetDefinition `json:"definition"` - // The size of the graph. - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - // Timeframe for the notebook cell. When 'null', the notebook global time is used. - Time NullableNotebookCellTime `json:"time,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{} -} - -// NewNotebookLogStreamCellAttributes instantiates a new NotebookLogStreamCellAttributes 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 NewNotebookLogStreamCellAttributes(definition LogStreamWidgetDefinition) *NotebookLogStreamCellAttributes { - this := NotebookLogStreamCellAttributes{} - this.Definition = definition - return &this -} - -// NewNotebookLogStreamCellAttributesWithDefaults instantiates a new NotebookLogStreamCellAttributes 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 NewNotebookLogStreamCellAttributesWithDefaults() *NotebookLogStreamCellAttributes { - this := NotebookLogStreamCellAttributes{} - return &this -} - -// GetDefinition returns the Definition field value. -func (o *NotebookLogStreamCellAttributes) GetDefinition() LogStreamWidgetDefinition { - if o == nil { - var ret LogStreamWidgetDefinition - return ret - } - return o.Definition -} - -// GetDefinitionOk returns a tuple with the Definition field value -// and a boolean to check if the value has been set. -func (o *NotebookLogStreamCellAttributes) GetDefinitionOk() (*LogStreamWidgetDefinition, bool) { - if o == nil { - return nil, false - } - return &o.Definition, true -} - -// SetDefinition sets field value. -func (o *NotebookLogStreamCellAttributes) SetDefinition(v LogStreamWidgetDefinition) { - o.Definition = v -} - -// GetGraphSize returns the GraphSize field value if set, zero value otherwise. -func (o *NotebookLogStreamCellAttributes) GetGraphSize() NotebookGraphSize { - if o == nil || o.GraphSize == nil { - var ret NotebookGraphSize - return ret - } - return *o.GraphSize -} - -// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookLogStreamCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { - if o == nil || o.GraphSize == nil { - return nil, false - } - return o.GraphSize, true -} - -// HasGraphSize returns a boolean if a field has been set. -func (o *NotebookLogStreamCellAttributes) HasGraphSize() bool { - if o != nil && o.GraphSize != nil { - return true - } - - return false -} - -// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. -func (o *NotebookLogStreamCellAttributes) SetGraphSize(v NotebookGraphSize) { - o.GraphSize = &v -} - -// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookLogStreamCellAttributes) GetTime() NotebookCellTime { - if o == nil || o.Time.Get() == nil { - var ret NotebookCellTime - return ret - } - return *o.Time.Get() -} - -// GetTimeOk returns a tuple with the Time 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 *NotebookLogStreamCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { - if o == nil { - return nil, false - } - return o.Time.Get(), o.Time.IsSet() -} - -// HasTime returns a boolean if a field has been set. -func (o *NotebookLogStreamCellAttributes) HasTime() bool { - if o != nil && o.Time.IsSet() { - return true - } - - return false -} - -// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. -func (o *NotebookLogStreamCellAttributes) SetTime(v NotebookCellTime) { - o.Time.Set(&v) -} - -// SetTimeNil sets the value for Time to be an explicit nil. -func (o *NotebookLogStreamCellAttributes) SetTimeNil() { - o.Time.Set(nil) -} - -// UnsetTime ensures that no value is present for Time, not even an explicit nil. -func (o *NotebookLogStreamCellAttributes) UnsetTime() { - o.Time.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookLogStreamCellAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["definition"] = o.Definition - if o.GraphSize != nil { - toSerialize["graph_size"] = o.GraphSize - } - if o.Time.IsSet() { - toSerialize["time"] = o.Time.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookLogStreamCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Definition *LogStreamWidgetDefinition `json:"definition"` - }{} - all := struct { - Definition LogStreamWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("Required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Definition = all.Definition - o.GraphSize = all.GraphSize - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_markdown_cell_attributes.go b/api/v1/datadog/model_notebook_markdown_cell_attributes.go deleted file mode 100644 index 3e27a05377d..00000000000 --- a/api/v1/datadog/model_notebook_markdown_cell_attributes.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookMarkdownCellAttributes The attributes of a notebook `markdown` cell. -type NotebookMarkdownCellAttributes struct { - // Text in a notebook is formatted with [Markdown](https://daringfireball.net/projects/markdown/), which enables the use of headings, subheadings, links, images, lists, and code blocks. - Definition NotebookMarkdownCellDefinition `json:"definition"` - // 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{} -} - -// NewNotebookMarkdownCellAttributes instantiates a new NotebookMarkdownCellAttributes 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 NewNotebookMarkdownCellAttributes(definition NotebookMarkdownCellDefinition) *NotebookMarkdownCellAttributes { - this := NotebookMarkdownCellAttributes{} - this.Definition = definition - return &this -} - -// NewNotebookMarkdownCellAttributesWithDefaults instantiates a new NotebookMarkdownCellAttributes 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 NewNotebookMarkdownCellAttributesWithDefaults() *NotebookMarkdownCellAttributes { - this := NotebookMarkdownCellAttributes{} - return &this -} - -// GetDefinition returns the Definition field value. -func (o *NotebookMarkdownCellAttributes) GetDefinition() NotebookMarkdownCellDefinition { - if o == nil { - var ret NotebookMarkdownCellDefinition - return ret - } - return o.Definition -} - -// GetDefinitionOk returns a tuple with the Definition field value -// and a boolean to check if the value has been set. -func (o *NotebookMarkdownCellAttributes) GetDefinitionOk() (*NotebookMarkdownCellDefinition, bool) { - if o == nil { - return nil, false - } - return &o.Definition, true -} - -// SetDefinition sets field value. -func (o *NotebookMarkdownCellAttributes) SetDefinition(v NotebookMarkdownCellDefinition) { - o.Definition = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookMarkdownCellAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["definition"] = o.Definition - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookMarkdownCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Definition *NotebookMarkdownCellDefinition `json:"definition"` - }{} - all := struct { - Definition NotebookMarkdownCellDefinition `json:"definition"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("Required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Definition = all.Definition - return nil -} diff --git a/api/v1/datadog/model_notebook_markdown_cell_definition.go b/api/v1/datadog/model_notebook_markdown_cell_definition.go deleted file mode 100644 index 9e58db6adcd..00000000000 --- a/api/v1/datadog/model_notebook_markdown_cell_definition.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookMarkdownCellDefinition Text in a notebook is formatted with [Markdown](https://daringfireball.net/projects/markdown/), which enables the use of headings, subheadings, links, images, lists, and code blocks. -type NotebookMarkdownCellDefinition struct { - // The markdown content. - Text string `json:"text"` - // Type of the markdown cell. - Type NotebookMarkdownCellDefinitionType `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{} -} - -// NewNotebookMarkdownCellDefinition instantiates a new NotebookMarkdownCellDefinition 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 NewNotebookMarkdownCellDefinition(text string, typeVar NotebookMarkdownCellDefinitionType) *NotebookMarkdownCellDefinition { - this := NotebookMarkdownCellDefinition{} - this.Text = text - this.Type = typeVar - return &this -} - -// NewNotebookMarkdownCellDefinitionWithDefaults instantiates a new NotebookMarkdownCellDefinition 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 NewNotebookMarkdownCellDefinitionWithDefaults() *NotebookMarkdownCellDefinition { - this := NotebookMarkdownCellDefinition{} - var typeVar NotebookMarkdownCellDefinitionType = NOTEBOOKMARKDOWNCELLDEFINITIONTYPE_MARKDOWN - this.Type = typeVar - return &this -} - -// GetText returns the Text field value. -func (o *NotebookMarkdownCellDefinition) GetText() string { - if o == nil { - var ret string - return ret - } - return o.Text -} - -// GetTextOk returns a tuple with the Text field value -// and a boolean to check if the value has been set. -func (o *NotebookMarkdownCellDefinition) GetTextOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Text, true -} - -// SetText sets field value. -func (o *NotebookMarkdownCellDefinition) SetText(v string) { - o.Text = v -} - -// GetType returns the Type field value. -func (o *NotebookMarkdownCellDefinition) GetType() NotebookMarkdownCellDefinitionType { - if o == nil { - var ret NotebookMarkdownCellDefinitionType - 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 *NotebookMarkdownCellDefinition) GetTypeOk() (*NotebookMarkdownCellDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookMarkdownCellDefinition) SetType(v NotebookMarkdownCellDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookMarkdownCellDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["text"] = o.Text - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookMarkdownCellDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Text *string `json:"text"` - Type *NotebookMarkdownCellDefinitionType `json:"type"` - }{} - all := struct { - Text string `json:"text"` - Type NotebookMarkdownCellDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Text == nil { - return fmt.Errorf("Required field text missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Text = all.Text - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_markdown_cell_definition_type.go b/api/v1/datadog/model_notebook_markdown_cell_definition_type.go deleted file mode 100644 index c305d43ce8b..00000000000 --- a/api/v1/datadog/model_notebook_markdown_cell_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookMarkdownCellDefinitionType Type of the markdown cell. -type NotebookMarkdownCellDefinitionType string - -// List of NotebookMarkdownCellDefinitionType. -const ( - NOTEBOOKMARKDOWNCELLDEFINITIONTYPE_MARKDOWN NotebookMarkdownCellDefinitionType = "markdown" -) - -var allowedNotebookMarkdownCellDefinitionTypeEnumValues = []NotebookMarkdownCellDefinitionType{ - NOTEBOOKMARKDOWNCELLDEFINITIONTYPE_MARKDOWN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NotebookMarkdownCellDefinitionType) GetAllowedValues() []NotebookMarkdownCellDefinitionType { - return allowedNotebookMarkdownCellDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NotebookMarkdownCellDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NotebookMarkdownCellDefinitionType(value) - return nil -} - -// NewNotebookMarkdownCellDefinitionTypeFromValue returns a pointer to a valid NotebookMarkdownCellDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNotebookMarkdownCellDefinitionTypeFromValue(v string) (*NotebookMarkdownCellDefinitionType, error) { - ev := NotebookMarkdownCellDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NotebookMarkdownCellDefinitionType: valid values are %v", v, allowedNotebookMarkdownCellDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NotebookMarkdownCellDefinitionType) IsValid() bool { - for _, existing := range allowedNotebookMarkdownCellDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NotebookMarkdownCellDefinitionType value. -func (v NotebookMarkdownCellDefinitionType) Ptr() *NotebookMarkdownCellDefinitionType { - return &v -} - -// NullableNotebookMarkdownCellDefinitionType handles when a null is used for NotebookMarkdownCellDefinitionType. -type NullableNotebookMarkdownCellDefinitionType struct { - value *NotebookMarkdownCellDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookMarkdownCellDefinitionType) Get() *NotebookMarkdownCellDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookMarkdownCellDefinitionType) Set(val *NotebookMarkdownCellDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookMarkdownCellDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookMarkdownCellDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookMarkdownCellDefinitionType initializes the struct as if Set has been called. -func NewNullableNotebookMarkdownCellDefinitionType(val *NotebookMarkdownCellDefinitionType) *NullableNotebookMarkdownCellDefinitionType { - return &NullableNotebookMarkdownCellDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookMarkdownCellDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookMarkdownCellDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_metadata.go b/api/v1/datadog/model_notebook_metadata.go deleted file mode 100644 index ce37f528f73..00000000000 --- a/api/v1/datadog/model_notebook_metadata.go +++ /dev/null @@ -1,207 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookMetadata Metadata associated with the notebook. -type NotebookMetadata struct { - // Whether or not the notebook is a template. - IsTemplate *bool `json:"is_template,omitempty"` - // Whether or not the notebook takes snapshot image backups of the notebook's fixed-time graphs. - TakeSnapshots *bool `json:"take_snapshots,omitempty"` - // Metadata type of the notebook. - Type NullableNotebookMetadataType `json:"type,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{} -} - -// NewNotebookMetadata instantiates a new NotebookMetadata 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 NewNotebookMetadata() *NotebookMetadata { - this := NotebookMetadata{} - var isTemplate bool = false - this.IsTemplate = &isTemplate - var takeSnapshots bool = false - this.TakeSnapshots = &takeSnapshots - return &this -} - -// NewNotebookMetadataWithDefaults instantiates a new NotebookMetadata 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 NewNotebookMetadataWithDefaults() *NotebookMetadata { - this := NotebookMetadata{} - var isTemplate bool = false - this.IsTemplate = &isTemplate - var takeSnapshots bool = false - this.TakeSnapshots = &takeSnapshots - return &this -} - -// GetIsTemplate returns the IsTemplate field value if set, zero value otherwise. -func (o *NotebookMetadata) GetIsTemplate() bool { - if o == nil || o.IsTemplate == nil { - var ret bool - return ret - } - return *o.IsTemplate -} - -// GetIsTemplateOk returns a tuple with the IsTemplate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookMetadata) GetIsTemplateOk() (*bool, bool) { - if o == nil || o.IsTemplate == nil { - return nil, false - } - return o.IsTemplate, true -} - -// HasIsTemplate returns a boolean if a field has been set. -func (o *NotebookMetadata) HasIsTemplate() bool { - if o != nil && o.IsTemplate != nil { - return true - } - - return false -} - -// SetIsTemplate gets a reference to the given bool and assigns it to the IsTemplate field. -func (o *NotebookMetadata) SetIsTemplate(v bool) { - o.IsTemplate = &v -} - -// GetTakeSnapshots returns the TakeSnapshots field value if set, zero value otherwise. -func (o *NotebookMetadata) GetTakeSnapshots() bool { - if o == nil || o.TakeSnapshots == nil { - var ret bool - return ret - } - return *o.TakeSnapshots -} - -// GetTakeSnapshotsOk returns a tuple with the TakeSnapshots field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookMetadata) GetTakeSnapshotsOk() (*bool, bool) { - if o == nil || o.TakeSnapshots == nil { - return nil, false - } - return o.TakeSnapshots, true -} - -// HasTakeSnapshots returns a boolean if a field has been set. -func (o *NotebookMetadata) HasTakeSnapshots() bool { - if o != nil && o.TakeSnapshots != nil { - return true - } - - return false -} - -// SetTakeSnapshots gets a reference to the given bool and assigns it to the TakeSnapshots field. -func (o *NotebookMetadata) SetTakeSnapshots(v bool) { - o.TakeSnapshots = &v -} - -// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookMetadata) GetType() NotebookMetadataType { - if o == nil || o.Type.Get() == nil { - var ret NotebookMetadataType - return ret - } - return *o.Type.Get() -} - -// GetTypeOk returns a tuple with the Type 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 *NotebookMetadata) GetTypeOk() (*NotebookMetadataType, bool) { - if o == nil { - return nil, false - } - return o.Type.Get(), o.Type.IsSet() -} - -// HasType returns a boolean if a field has been set. -func (o *NotebookMetadata) HasType() bool { - if o != nil && o.Type.IsSet() { - return true - } - - return false -} - -// SetType gets a reference to the given NullableNotebookMetadataType and assigns it to the Type field. -func (o *NotebookMetadata) SetType(v NotebookMetadataType) { - o.Type.Set(&v) -} - -// SetTypeNil sets the value for Type to be an explicit nil. -func (o *NotebookMetadata) SetTypeNil() { - o.Type.Set(nil) -} - -// UnsetType ensures that no value is present for Type, not even an explicit nil. -func (o *NotebookMetadata) UnsetType() { - o.Type.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsTemplate != nil { - toSerialize["is_template"] = o.IsTemplate - } - if o.TakeSnapshots != nil { - toSerialize["take_snapshots"] = o.TakeSnapshots - } - if o.Type.IsSet() { - toSerialize["type"] = o.Type.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IsTemplate *bool `json:"is_template,omitempty"` - TakeSnapshots *bool `json:"take_snapshots,omitempty"` - Type NullableNotebookMetadataType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsTemplate = all.IsTemplate - o.TakeSnapshots = all.TakeSnapshots - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_metadata_type.go b/api/v1/datadog/model_notebook_metadata_type.go deleted file mode 100644 index 9f4204d58be..00000000000 --- a/api/v1/datadog/model_notebook_metadata_type.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookMetadataType Metadata type of the notebook. -type NotebookMetadataType string - -// List of NotebookMetadataType. -const ( - NOTEBOOKMETADATATYPE_POSTMORTEM NotebookMetadataType = "postmortem" - NOTEBOOKMETADATATYPE_RUNBOOK NotebookMetadataType = "runbook" - NOTEBOOKMETADATATYPE_INVESTIGATION NotebookMetadataType = "investigation" - NOTEBOOKMETADATATYPE_DOCUMENTATION NotebookMetadataType = "documentation" - NOTEBOOKMETADATATYPE_REPORT NotebookMetadataType = "report" -) - -var allowedNotebookMetadataTypeEnumValues = []NotebookMetadataType{ - NOTEBOOKMETADATATYPE_POSTMORTEM, - NOTEBOOKMETADATATYPE_RUNBOOK, - NOTEBOOKMETADATATYPE_INVESTIGATION, - NOTEBOOKMETADATATYPE_DOCUMENTATION, - NOTEBOOKMETADATATYPE_REPORT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NotebookMetadataType) GetAllowedValues() []NotebookMetadataType { - return allowedNotebookMetadataTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NotebookMetadataType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NotebookMetadataType(value) - return nil -} - -// NewNotebookMetadataTypeFromValue returns a pointer to a valid NotebookMetadataType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNotebookMetadataTypeFromValue(v string) (*NotebookMetadataType, error) { - ev := NotebookMetadataType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NotebookMetadataType: valid values are %v", v, allowedNotebookMetadataTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NotebookMetadataType) IsValid() bool { - for _, existing := range allowedNotebookMetadataTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NotebookMetadataType value. -func (v NotebookMetadataType) Ptr() *NotebookMetadataType { - return &v -} - -// NullableNotebookMetadataType handles when a null is used for NotebookMetadataType. -type NullableNotebookMetadataType struct { - value *NotebookMetadataType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookMetadataType) Get() *NotebookMetadataType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookMetadataType) Set(val *NotebookMetadataType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookMetadataType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookMetadataType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookMetadataType initializes the struct as if Set has been called. -func NewNullableNotebookMetadataType(val *NotebookMetadataType) *NullableNotebookMetadataType { - return &NullableNotebookMetadataType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookMetadataType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookMetadataType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_relative_time.go b/api/v1/datadog/model_notebook_relative_time.go deleted file mode 100644 index 2ce6f5f4c84..00000000000 --- a/api/v1/datadog/model_notebook_relative_time.go +++ /dev/null @@ -1,161 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookRelativeTime Relative timeframe. -type NotebookRelativeTime struct { - // The available timeframes depend on the widget you are using. - LiveSpan WidgetLiveSpan `json:"live_span"` - // 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{} -} - -// NewNotebookRelativeTime instantiates a new NotebookRelativeTime 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 NewNotebookRelativeTime(liveSpan WidgetLiveSpan) *NotebookRelativeTime { - this := NotebookRelativeTime{} - this.LiveSpan = liveSpan - return &this -} - -// NewNotebookRelativeTimeWithDefaults instantiates a new NotebookRelativeTime 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 NewNotebookRelativeTimeWithDefaults() *NotebookRelativeTime { - this := NotebookRelativeTime{} - return &this -} - -// GetLiveSpan returns the LiveSpan field value. -func (o *NotebookRelativeTime) GetLiveSpan() WidgetLiveSpan { - if o == nil { - var ret WidgetLiveSpan - return ret - } - return o.LiveSpan -} - -// GetLiveSpanOk returns a tuple with the LiveSpan field value -// and a boolean to check if the value has been set. -func (o *NotebookRelativeTime) GetLiveSpanOk() (*WidgetLiveSpan, bool) { - if o == nil { - return nil, false - } - return &o.LiveSpan, true -} - -// SetLiveSpan sets field value. -func (o *NotebookRelativeTime) SetLiveSpan(v WidgetLiveSpan) { - o.LiveSpan = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookRelativeTime) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["live_span"] = o.LiveSpan - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookRelativeTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - LiveSpan *WidgetLiveSpan `json:"live_span"` - }{} - all := struct { - LiveSpan WidgetLiveSpan `json:"live_span"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.LiveSpan == nil { - return fmt.Errorf("Required field live_span missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LiveSpan; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LiveSpan = all.LiveSpan - return nil -} - -// NullableNotebookRelativeTime handles when a null is used for NotebookRelativeTime. -type NullableNotebookRelativeTime struct { - value *NotebookRelativeTime - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookRelativeTime) Get() *NotebookRelativeTime { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookRelativeTime) Set(val *NotebookRelativeTime) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookRelativeTime) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookRelativeTime) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookRelativeTime initializes the struct as if Set has been called. -func NewNullableNotebookRelativeTime(val *NotebookRelativeTime) *NullableNotebookRelativeTime { - return &NullableNotebookRelativeTime{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookRelativeTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookRelativeTime) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_resource_type.go b/api/v1/datadog/model_notebook_resource_type.go deleted file mode 100644 index dc84c8ba3f3..00000000000 --- a/api/v1/datadog/model_notebook_resource_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookResourceType Type of the Notebook resource. -type NotebookResourceType string - -// List of NotebookResourceType. -const ( - NOTEBOOKRESOURCETYPE_NOTEBOOKS NotebookResourceType = "notebooks" -) - -var allowedNotebookResourceTypeEnumValues = []NotebookResourceType{ - NOTEBOOKRESOURCETYPE_NOTEBOOKS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NotebookResourceType) GetAllowedValues() []NotebookResourceType { - return allowedNotebookResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NotebookResourceType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NotebookResourceType(value) - return nil -} - -// NewNotebookResourceTypeFromValue returns a pointer to a valid NotebookResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNotebookResourceTypeFromValue(v string) (*NotebookResourceType, error) { - ev := NotebookResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NotebookResourceType: valid values are %v", v, allowedNotebookResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NotebookResourceType) IsValid() bool { - for _, existing := range allowedNotebookResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NotebookResourceType value. -func (v NotebookResourceType) Ptr() *NotebookResourceType { - return &v -} - -// NullableNotebookResourceType handles when a null is used for NotebookResourceType. -type NullableNotebookResourceType struct { - value *NotebookResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookResourceType) Get() *NotebookResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookResourceType) Set(val *NotebookResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookResourceType initializes the struct as if Set has been called. -func NewNullableNotebookResourceType(val *NotebookResourceType) *NullableNotebookResourceType { - return &NullableNotebookResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_response.go b/api/v1/datadog/model_notebook_response.go deleted file mode 100644 index 30b861705b2..00000000000 --- a/api/v1/datadog/model_notebook_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookResponse The description of a notebook response. -type NotebookResponse struct { - // The data for a notebook. - Data *NotebookResponseData `json:"data,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{} -} - -// NewNotebookResponse instantiates a new NotebookResponse 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 NewNotebookResponse() *NotebookResponse { - this := NotebookResponse{} - return &this -} - -// NewNotebookResponseWithDefaults instantiates a new NotebookResponse 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 NewNotebookResponseWithDefaults() *NotebookResponse { - this := NotebookResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *NotebookResponse) GetData() NotebookResponseData { - if o == nil || o.Data == nil { - var ret NotebookResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookResponse) GetDataOk() (*NotebookResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *NotebookResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given NotebookResponseData and assigns it to the Data field. -func (o *NotebookResponse) SetData(v NotebookResponseData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *NotebookResponseData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_notebook_response_data.go b/api/v1/datadog/model_notebook_response_data.go deleted file mode 100644 index 0f8bcde5ea1..00000000000 --- a/api/v1/datadog/model_notebook_response_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookResponseData The data for a notebook. -type NotebookResponseData struct { - // The attributes of a notebook. - Attributes NotebookResponseDataAttributes `json:"attributes"` - // Unique notebook ID, assigned when you create the notebook. - Id int64 `json:"id"` - // Type of the Notebook resource. - Type NotebookResourceType `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{} -} - -// NewNotebookResponseData instantiates a new NotebookResponseData 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 NewNotebookResponseData(attributes NotebookResponseDataAttributes, id int64, typeVar NotebookResourceType) *NotebookResponseData { - this := NotebookResponseData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewNotebookResponseDataWithDefaults instantiates a new NotebookResponseData 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 NewNotebookResponseDataWithDefaults() *NotebookResponseData { - this := NotebookResponseData{} - var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *NotebookResponseData) GetAttributes() NotebookResponseDataAttributes { - if o == nil { - var ret NotebookResponseDataAttributes - 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 *NotebookResponseData) GetAttributesOk() (*NotebookResponseDataAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *NotebookResponseData) SetAttributes(v NotebookResponseDataAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *NotebookResponseData) GetId() int64 { - if o == nil { - var ret int64 - 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 *NotebookResponseData) GetIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *NotebookResponseData) SetId(v int64) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *NotebookResponseData) GetType() NotebookResourceType { - if o == nil { - var ret NotebookResourceType - 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 *NotebookResponseData) GetTypeOk() (*NotebookResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookResponseData) SetType(v NotebookResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *NotebookResponseDataAttributes `json:"attributes"` - Id *int64 `json:"id"` - Type *NotebookResourceType `json:"type"` - }{} - all := struct { - Attributes NotebookResponseDataAttributes `json:"attributes"` - Id int64 `json:"id"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_response_data_attributes.go b/api/v1/datadog/model_notebook_response_data_attributes.go deleted file mode 100644 index d057acfee9f..00000000000 --- a/api/v1/datadog/model_notebook_response_data_attributes.go +++ /dev/null @@ -1,399 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" -) - -// NotebookResponseDataAttributes The attributes of a notebook. -type NotebookResponseDataAttributes struct { - // Attributes of user object returned by the API. - Author *NotebookAuthor `json:"author,omitempty"` - // List of cells to display in the notebook. - Cells []NotebookCellResponse `json:"cells"` - // UTC time stamp for when the notebook was created. - Created *time.Time `json:"created,omitempty"` - // Metadata associated with the notebook. - Metadata *NotebookMetadata `json:"metadata,omitempty"` - // UTC time stamp for when the notebook was last modified. - Modified *time.Time `json:"modified,omitempty"` - // The name of the notebook. - Name string `json:"name"` - // Publication status of the notebook. For now, always "published". - Status *NotebookStatus `json:"status,omitempty"` - // Notebook global timeframe. - Time NotebookGlobalTime `json:"time"` - // 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{} -} - -// NewNotebookResponseDataAttributes instantiates a new NotebookResponseDataAttributes 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 NewNotebookResponseDataAttributes(cells []NotebookCellResponse, name string, time NotebookGlobalTime) *NotebookResponseDataAttributes { - this := NotebookResponseDataAttributes{} - this.Cells = cells - this.Name = name - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - this.Time = time - return &this -} - -// NewNotebookResponseDataAttributesWithDefaults instantiates a new NotebookResponseDataAttributes 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 NewNotebookResponseDataAttributesWithDefaults() *NotebookResponseDataAttributes { - this := NotebookResponseDataAttributes{} - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - return &this -} - -// GetAuthor returns the Author field value if set, zero value otherwise. -func (o *NotebookResponseDataAttributes) GetAuthor() NotebookAuthor { - if o == nil || o.Author == nil { - var ret NotebookAuthor - return ret - } - return *o.Author -} - -// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetAuthorOk() (*NotebookAuthor, bool) { - if o == nil || o.Author == nil { - return nil, false - } - return o.Author, true -} - -// HasAuthor returns a boolean if a field has been set. -func (o *NotebookResponseDataAttributes) HasAuthor() bool { - if o != nil && o.Author != nil { - return true - } - - return false -} - -// SetAuthor gets a reference to the given NotebookAuthor and assigns it to the Author field. -func (o *NotebookResponseDataAttributes) SetAuthor(v NotebookAuthor) { - o.Author = &v -} - -// GetCells returns the Cells field value. -func (o *NotebookResponseDataAttributes) GetCells() []NotebookCellResponse { - if o == nil { - var ret []NotebookCellResponse - return ret - } - return o.Cells -} - -// GetCellsOk returns a tuple with the Cells field value -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetCellsOk() (*[]NotebookCellResponse, bool) { - if o == nil { - return nil, false - } - return &o.Cells, true -} - -// SetCells sets field value. -func (o *NotebookResponseDataAttributes) SetCells(v []NotebookCellResponse) { - o.Cells = v -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *NotebookResponseDataAttributes) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *NotebookResponseDataAttributes) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *NotebookResponseDataAttributes) SetCreated(v time.Time) { - o.Created = &v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *NotebookResponseDataAttributes) GetMetadata() NotebookMetadata { - if o == nil || o.Metadata == nil { - var ret NotebookMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *NotebookResponseDataAttributes) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. -func (o *NotebookResponseDataAttributes) SetMetadata(v NotebookMetadata) { - o.Metadata = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *NotebookResponseDataAttributes) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *NotebookResponseDataAttributes) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *NotebookResponseDataAttributes) SetModified(v time.Time) { - o.Modified = &v -} - -// GetName returns the Name field value. -func (o *NotebookResponseDataAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *NotebookResponseDataAttributes) SetName(v string) { - o.Name = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *NotebookResponseDataAttributes) GetStatus() NotebookStatus { - if o == nil || o.Status == nil { - var ret NotebookStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetStatusOk() (*NotebookStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *NotebookResponseDataAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. -func (o *NotebookResponseDataAttributes) SetStatus(v NotebookStatus) { - o.Status = &v -} - -// GetTime returns the Time field value. -func (o *NotebookResponseDataAttributes) GetTime() NotebookGlobalTime { - if o == nil { - var ret NotebookGlobalTime - return ret - } - return o.Time -} - -// GetTimeOk returns a tuple with the Time field value -// and a boolean to check if the value has been set. -func (o *NotebookResponseDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { - if o == nil { - return nil, false - } - return &o.Time, true -} - -// SetTime sets field value. -func (o *NotebookResponseDataAttributes) SetTime(v NotebookGlobalTime) { - o.Time = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookResponseDataAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Author != nil { - toSerialize["author"] = o.Author - } - toSerialize["cells"] = o.Cells - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - toSerialize["name"] = o.Name - if o.Status != nil { - toSerialize["status"] = o.Status - } - toSerialize["time"] = o.Time - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Cells *[]NotebookCellResponse `json:"cells"` - Name *string `json:"name"` - Time *NotebookGlobalTime `json:"time"` - }{} - all := struct { - Author *NotebookAuthor `json:"author,omitempty"` - Cells []NotebookCellResponse `json:"cells"` - Created *time.Time `json:"created,omitempty"` - Metadata *NotebookMetadata `json:"metadata,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Name string `json:"name"` - Status *NotebookStatus `json:"status,omitempty"` - Time NotebookGlobalTime `json:"time"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Cells == nil { - return fmt.Errorf("Required field cells missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Time == nil { - return fmt.Errorf("Required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Author = all.Author - o.Cells = all.Cells - o.Created = all.Created - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Modified = all.Modified - o.Name = all.Name - o.Status = all.Status - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_split_by.go b/api/v1/datadog/model_notebook_split_by.go deleted file mode 100644 index 272a028cea7..00000000000 --- a/api/v1/datadog/model_notebook_split_by.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookSplitBy Object describing how to split the graph to display multiple visualizations per request. -type NotebookSplitBy struct { - // Keys to split on. - Keys []string `json:"keys"` - // Tags to split on. - Tags []string `json:"tags"` - // 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{} -} - -// NewNotebookSplitBy instantiates a new NotebookSplitBy 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 NewNotebookSplitBy(keys []string, tags []string) *NotebookSplitBy { - this := NotebookSplitBy{} - this.Keys = keys - this.Tags = tags - return &this -} - -// NewNotebookSplitByWithDefaults instantiates a new NotebookSplitBy 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 NewNotebookSplitByWithDefaults() *NotebookSplitBy { - this := NotebookSplitBy{} - return &this -} - -// GetKeys returns the Keys field value. -func (o *NotebookSplitBy) GetKeys() []string { - if o == nil { - var ret []string - return ret - } - return o.Keys -} - -// GetKeysOk returns a tuple with the Keys field value -// and a boolean to check if the value has been set. -func (o *NotebookSplitBy) GetKeysOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Keys, true -} - -// SetKeys sets field value. -func (o *NotebookSplitBy) SetKeys(v []string) { - o.Keys = v -} - -// GetTags returns the Tags field value. -func (o *NotebookSplitBy) GetTags() []string { - if o == nil { - var ret []string - return ret - } - return o.Tags -} - -// GetTagsOk returns a tuple with the Tags field value -// and a boolean to check if the value has been set. -func (o *NotebookSplitBy) GetTagsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Tags, true -} - -// SetTags sets field value. -func (o *NotebookSplitBy) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookSplitBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["keys"] = o.Keys - toSerialize["tags"] = o.Tags - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookSplitBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Keys *[]string `json:"keys"` - Tags *[]string `json:"tags"` - }{} - all := struct { - Keys []string `json:"keys"` - Tags []string `json:"tags"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Keys == nil { - return fmt.Errorf("Required field keys missing") - } - if required.Tags == nil { - return fmt.Errorf("Required field tags missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Keys = all.Keys - o.Tags = all.Tags - return nil -} diff --git a/api/v1/datadog/model_notebook_status.go b/api/v1/datadog/model_notebook_status.go deleted file mode 100644 index dd861abfbe6..00000000000 --- a/api/v1/datadog/model_notebook_status.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookStatus Publication status of the notebook. For now, always "published". -type NotebookStatus string - -// List of NotebookStatus. -const ( - NOTEBOOKSTATUS_PUBLISHED NotebookStatus = "published" -) - -var allowedNotebookStatusEnumValues = []NotebookStatus{ - NOTEBOOKSTATUS_PUBLISHED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NotebookStatus) GetAllowedValues() []NotebookStatus { - return allowedNotebookStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NotebookStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NotebookStatus(value) - return nil -} - -// NewNotebookStatusFromValue returns a pointer to a valid NotebookStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNotebookStatusFromValue(v string) (*NotebookStatus, error) { - ev := NotebookStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NotebookStatus: valid values are %v", v, allowedNotebookStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NotebookStatus) IsValid() bool { - for _, existing := range allowedNotebookStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NotebookStatus value. -func (v NotebookStatus) Ptr() *NotebookStatus { - return &v -} - -// NullableNotebookStatus handles when a null is used for NotebookStatus. -type NullableNotebookStatus struct { - value *NotebookStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookStatus) Get() *NotebookStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookStatus) Set(val *NotebookStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableNotebookStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookStatus initializes the struct as if Set has been called. -func NewNullableNotebookStatus(val *NotebookStatus) *NullableNotebookStatus { - return &NullableNotebookStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_timeseries_cell_attributes.go b/api/v1/datadog/model_notebook_timeseries_cell_attributes.go deleted file mode 100644 index 6e23bc7ad6f..00000000000 --- a/api/v1/datadog/model_notebook_timeseries_cell_attributes.go +++ /dev/null @@ -1,253 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookTimeseriesCellAttributes The attributes of a notebook `timeseries` cell. -type NotebookTimeseriesCellAttributes struct { - // The timeseries visualization allows you to display the evolution of one or more metrics, log events, or Indexed Spans over time. - Definition TimeseriesWidgetDefinition `json:"definition"` - // The size of the graph. - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - // Object describing how to split the graph to display multiple visualizations per request. - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - // Timeframe for the notebook cell. When 'null', the notebook global time is used. - Time NullableNotebookCellTime `json:"time,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{} -} - -// NewNotebookTimeseriesCellAttributes instantiates a new NotebookTimeseriesCellAttributes 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 NewNotebookTimeseriesCellAttributes(definition TimeseriesWidgetDefinition) *NotebookTimeseriesCellAttributes { - this := NotebookTimeseriesCellAttributes{} - this.Definition = definition - return &this -} - -// NewNotebookTimeseriesCellAttributesWithDefaults instantiates a new NotebookTimeseriesCellAttributes 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 NewNotebookTimeseriesCellAttributesWithDefaults() *NotebookTimeseriesCellAttributes { - this := NotebookTimeseriesCellAttributes{} - return &this -} - -// GetDefinition returns the Definition field value. -func (o *NotebookTimeseriesCellAttributes) GetDefinition() TimeseriesWidgetDefinition { - if o == nil { - var ret TimeseriesWidgetDefinition - return ret - } - return o.Definition -} - -// GetDefinitionOk returns a tuple with the Definition field value -// and a boolean to check if the value has been set. -func (o *NotebookTimeseriesCellAttributes) GetDefinitionOk() (*TimeseriesWidgetDefinition, bool) { - if o == nil { - return nil, false - } - return &o.Definition, true -} - -// SetDefinition sets field value. -func (o *NotebookTimeseriesCellAttributes) SetDefinition(v TimeseriesWidgetDefinition) { - o.Definition = v -} - -// GetGraphSize returns the GraphSize field value if set, zero value otherwise. -func (o *NotebookTimeseriesCellAttributes) GetGraphSize() NotebookGraphSize { - if o == nil || o.GraphSize == nil { - var ret NotebookGraphSize - return ret - } - return *o.GraphSize -} - -// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookTimeseriesCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { - if o == nil || o.GraphSize == nil { - return nil, false - } - return o.GraphSize, true -} - -// HasGraphSize returns a boolean if a field has been set. -func (o *NotebookTimeseriesCellAttributes) HasGraphSize() bool { - if o != nil && o.GraphSize != nil { - return true - } - - return false -} - -// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. -func (o *NotebookTimeseriesCellAttributes) SetGraphSize(v NotebookGraphSize) { - o.GraphSize = &v -} - -// GetSplitBy returns the SplitBy field value if set, zero value otherwise. -func (o *NotebookTimeseriesCellAttributes) GetSplitBy() NotebookSplitBy { - if o == nil || o.SplitBy == nil { - var ret NotebookSplitBy - return ret - } - return *o.SplitBy -} - -// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookTimeseriesCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { - if o == nil || o.SplitBy == nil { - return nil, false - } - return o.SplitBy, true -} - -// HasSplitBy returns a boolean if a field has been set. -func (o *NotebookTimeseriesCellAttributes) HasSplitBy() bool { - if o != nil && o.SplitBy != nil { - return true - } - - return false -} - -// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. -func (o *NotebookTimeseriesCellAttributes) SetSplitBy(v NotebookSplitBy) { - o.SplitBy = &v -} - -// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookTimeseriesCellAttributes) GetTime() NotebookCellTime { - if o == nil || o.Time.Get() == nil { - var ret NotebookCellTime - return ret - } - return *o.Time.Get() -} - -// GetTimeOk returns a tuple with the Time 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 *NotebookTimeseriesCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { - if o == nil { - return nil, false - } - return o.Time.Get(), o.Time.IsSet() -} - -// HasTime returns a boolean if a field has been set. -func (o *NotebookTimeseriesCellAttributes) HasTime() bool { - if o != nil && o.Time.IsSet() { - return true - } - - return false -} - -// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. -func (o *NotebookTimeseriesCellAttributes) SetTime(v NotebookCellTime) { - o.Time.Set(&v) -} - -// SetTimeNil sets the value for Time to be an explicit nil. -func (o *NotebookTimeseriesCellAttributes) SetTimeNil() { - o.Time.Set(nil) -} - -// UnsetTime ensures that no value is present for Time, not even an explicit nil. -func (o *NotebookTimeseriesCellAttributes) UnsetTime() { - o.Time.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookTimeseriesCellAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["definition"] = o.Definition - if o.GraphSize != nil { - toSerialize["graph_size"] = o.GraphSize - } - if o.SplitBy != nil { - toSerialize["split_by"] = o.SplitBy - } - if o.Time.IsSet() { - toSerialize["time"] = o.Time.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Definition *TimeseriesWidgetDefinition `json:"definition"` - }{} - all := struct { - Definition TimeseriesWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("Required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Definition = all.Definition - o.GraphSize = all.GraphSize - if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SplitBy = all.SplitBy - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_toplist_cell_attributes.go b/api/v1/datadog/model_notebook_toplist_cell_attributes.go deleted file mode 100644 index 4064f663ea6..00000000000 --- a/api/v1/datadog/model_notebook_toplist_cell_attributes.go +++ /dev/null @@ -1,253 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookToplistCellAttributes The attributes of a notebook `toplist` cell. -type NotebookToplistCellAttributes struct { - // The top list visualization enables you to display a list of Tag value like hostname or service with the most or least of any metric value, such as highest consumers of CPU, hosts with the least disk space, etc. - Definition ToplistWidgetDefinition `json:"definition"` - // The size of the graph. - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - // Object describing how to split the graph to display multiple visualizations per request. - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - // Timeframe for the notebook cell. When 'null', the notebook global time is used. - Time NullableNotebookCellTime `json:"time,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{} -} - -// NewNotebookToplistCellAttributes instantiates a new NotebookToplistCellAttributes 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 NewNotebookToplistCellAttributes(definition ToplistWidgetDefinition) *NotebookToplistCellAttributes { - this := NotebookToplistCellAttributes{} - this.Definition = definition - return &this -} - -// NewNotebookToplistCellAttributesWithDefaults instantiates a new NotebookToplistCellAttributes 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 NewNotebookToplistCellAttributesWithDefaults() *NotebookToplistCellAttributes { - this := NotebookToplistCellAttributes{} - return &this -} - -// GetDefinition returns the Definition field value. -func (o *NotebookToplistCellAttributes) GetDefinition() ToplistWidgetDefinition { - if o == nil { - var ret ToplistWidgetDefinition - return ret - } - return o.Definition -} - -// GetDefinitionOk returns a tuple with the Definition field value -// and a boolean to check if the value has been set. -func (o *NotebookToplistCellAttributes) GetDefinitionOk() (*ToplistWidgetDefinition, bool) { - if o == nil { - return nil, false - } - return &o.Definition, true -} - -// SetDefinition sets field value. -func (o *NotebookToplistCellAttributes) SetDefinition(v ToplistWidgetDefinition) { - o.Definition = v -} - -// GetGraphSize returns the GraphSize field value if set, zero value otherwise. -func (o *NotebookToplistCellAttributes) GetGraphSize() NotebookGraphSize { - if o == nil || o.GraphSize == nil { - var ret NotebookGraphSize - return ret - } - return *o.GraphSize -} - -// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookToplistCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { - if o == nil || o.GraphSize == nil { - return nil, false - } - return o.GraphSize, true -} - -// HasGraphSize returns a boolean if a field has been set. -func (o *NotebookToplistCellAttributes) HasGraphSize() bool { - if o != nil && o.GraphSize != nil { - return true - } - - return false -} - -// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. -func (o *NotebookToplistCellAttributes) SetGraphSize(v NotebookGraphSize) { - o.GraphSize = &v -} - -// GetSplitBy returns the SplitBy field value if set, zero value otherwise. -func (o *NotebookToplistCellAttributes) GetSplitBy() NotebookSplitBy { - if o == nil || o.SplitBy == nil { - var ret NotebookSplitBy - return ret - } - return *o.SplitBy -} - -// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookToplistCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { - if o == nil || o.SplitBy == nil { - return nil, false - } - return o.SplitBy, true -} - -// HasSplitBy returns a boolean if a field has been set. -func (o *NotebookToplistCellAttributes) HasSplitBy() bool { - if o != nil && o.SplitBy != nil { - return true - } - - return false -} - -// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. -func (o *NotebookToplistCellAttributes) SetSplitBy(v NotebookSplitBy) { - o.SplitBy = &v -} - -// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *NotebookToplistCellAttributes) GetTime() NotebookCellTime { - if o == nil || o.Time.Get() == nil { - var ret NotebookCellTime - return ret - } - return *o.Time.Get() -} - -// GetTimeOk returns a tuple with the Time 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 *NotebookToplistCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { - if o == nil { - return nil, false - } - return o.Time.Get(), o.Time.IsSet() -} - -// HasTime returns a boolean if a field has been set. -func (o *NotebookToplistCellAttributes) HasTime() bool { - if o != nil && o.Time.IsSet() { - return true - } - - return false -} - -// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. -func (o *NotebookToplistCellAttributes) SetTime(v NotebookCellTime) { - o.Time.Set(&v) -} - -// SetTimeNil sets the value for Time to be an explicit nil. -func (o *NotebookToplistCellAttributes) SetTimeNil() { - o.Time.Set(nil) -} - -// UnsetTime ensures that no value is present for Time, not even an explicit nil. -func (o *NotebookToplistCellAttributes) UnsetTime() { - o.Time.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookToplistCellAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["definition"] = o.Definition - if o.GraphSize != nil { - toSerialize["graph_size"] = o.GraphSize - } - if o.SplitBy != nil { - toSerialize["split_by"] = o.SplitBy - } - if o.Time.IsSet() { - toSerialize["time"] = o.Time.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Definition *ToplistWidgetDefinition `json:"definition"` - }{} - all := struct { - Definition ToplistWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("Required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GraphSize; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Definition = all.Definition - o.GraphSize = all.GraphSize - if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SplitBy = all.SplitBy - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_update_cell.go b/api/v1/datadog/model_notebook_update_cell.go deleted file mode 100644 index fa67c4c3b15..00000000000 --- a/api/v1/datadog/model_notebook_update_cell.go +++ /dev/null @@ -1,156 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebookUpdateCell - Updating a notebook can either insert new cell(s) or update existing cell(s) by including the cell `id`. -// To delete existing cell(s), simply omit it from the list of cells. -type NotebookUpdateCell struct { - NotebookCellCreateRequest *NotebookCellCreateRequest - NotebookCellUpdateRequest *NotebookCellUpdateRequest - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// NotebookCellCreateRequestAsNotebookUpdateCell is a convenience function that returns NotebookCellCreateRequest wrapped in NotebookUpdateCell. -func NotebookCellCreateRequestAsNotebookUpdateCell(v *NotebookCellCreateRequest) NotebookUpdateCell { - return NotebookUpdateCell{NotebookCellCreateRequest: v} -} - -// NotebookCellUpdateRequestAsNotebookUpdateCell is a convenience function that returns NotebookCellUpdateRequest wrapped in NotebookUpdateCell. -func NotebookCellUpdateRequestAsNotebookUpdateCell(v *NotebookCellUpdateRequest) NotebookUpdateCell { - return NotebookUpdateCell{NotebookCellUpdateRequest: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *NotebookUpdateCell) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into NotebookCellCreateRequest - err = json.Unmarshal(data, &obj.NotebookCellCreateRequest) - if err == nil { - if obj.NotebookCellCreateRequest != nil && obj.NotebookCellCreateRequest.UnparsedObject == nil { - jsonNotebookCellCreateRequest, _ := json.Marshal(obj.NotebookCellCreateRequest) - if string(jsonNotebookCellCreateRequest) == "{}" { // empty struct - obj.NotebookCellCreateRequest = nil - } else { - match++ - } - } else { - obj.NotebookCellCreateRequest = nil - } - } else { - obj.NotebookCellCreateRequest = nil - } - - // try to unmarshal data into NotebookCellUpdateRequest - err = json.Unmarshal(data, &obj.NotebookCellUpdateRequest) - if err == nil { - if obj.NotebookCellUpdateRequest != nil && obj.NotebookCellUpdateRequest.UnparsedObject == nil { - jsonNotebookCellUpdateRequest, _ := json.Marshal(obj.NotebookCellUpdateRequest) - if string(jsonNotebookCellUpdateRequest) == "{}" { // empty struct - obj.NotebookCellUpdateRequest = nil - } else { - match++ - } - } else { - obj.NotebookCellUpdateRequest = nil - } - } else { - obj.NotebookCellUpdateRequest = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.NotebookCellCreateRequest = nil - obj.NotebookCellUpdateRequest = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj NotebookUpdateCell) MarshalJSON() ([]byte, error) { - if obj.NotebookCellCreateRequest != nil { - return json.Marshal(&obj.NotebookCellCreateRequest) - } - - if obj.NotebookCellUpdateRequest != nil { - return json.Marshal(&obj.NotebookCellUpdateRequest) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *NotebookUpdateCell) GetActualInstance() interface{} { - if obj.NotebookCellCreateRequest != nil { - return obj.NotebookCellCreateRequest - } - - if obj.NotebookCellUpdateRequest != nil { - return obj.NotebookCellUpdateRequest - } - - // all schemas are nil - return nil -} - -// NullableNotebookUpdateCell handles when a null is used for NotebookUpdateCell. -type NullableNotebookUpdateCell struct { - value *NotebookUpdateCell - isSet bool -} - -// Get returns the associated value. -func (v NullableNotebookUpdateCell) Get() *NotebookUpdateCell { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNotebookUpdateCell) Set(val *NotebookUpdateCell) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNotebookUpdateCell) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNotebookUpdateCell) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNotebookUpdateCell initializes the struct as if Set has been called. -func NewNullableNotebookUpdateCell(val *NotebookUpdateCell) *NullableNotebookUpdateCell { - return &NullableNotebookUpdateCell{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNotebookUpdateCell) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNotebookUpdateCell) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_notebook_update_data.go b/api/v1/datadog/model_notebook_update_data.go deleted file mode 100644 index 33eb4abbd7e..00000000000 --- a/api/v1/datadog/model_notebook_update_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookUpdateData The data for a notebook update request. -type NotebookUpdateData struct { - // The data attributes of a notebook. - Attributes NotebookUpdateDataAttributes `json:"attributes"` - // Type of the Notebook resource. - Type NotebookResourceType `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{} -} - -// NewNotebookUpdateData instantiates a new NotebookUpdateData 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 NewNotebookUpdateData(attributes NotebookUpdateDataAttributes, typeVar NotebookResourceType) *NotebookUpdateData { - this := NotebookUpdateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewNotebookUpdateDataWithDefaults instantiates a new NotebookUpdateData 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 NewNotebookUpdateDataWithDefaults() *NotebookUpdateData { - this := NotebookUpdateData{} - var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *NotebookUpdateData) GetAttributes() NotebookUpdateDataAttributes { - if o == nil { - var ret NotebookUpdateDataAttributes - 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 *NotebookUpdateData) GetAttributesOk() (*NotebookUpdateDataAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *NotebookUpdateData) SetAttributes(v NotebookUpdateDataAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *NotebookUpdateData) GetType() NotebookResourceType { - if o == nil { - var ret NotebookResourceType - 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 *NotebookUpdateData) GetTypeOk() (*NotebookResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookUpdateData) SetType(v NotebookResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *NotebookUpdateDataAttributes `json:"attributes"` - Type *NotebookResourceType `json:"type"` - }{} - all := struct { - Attributes NotebookUpdateDataAttributes `json:"attributes"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebook_update_data_attributes.go b/api/v1/datadog/model_notebook_update_data_attributes.go deleted file mode 100644 index ee1baf172da..00000000000 --- a/api/v1/datadog/model_notebook_update_data_attributes.go +++ /dev/null @@ -1,266 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookUpdateDataAttributes The data attributes of a notebook. -type NotebookUpdateDataAttributes struct { - // List of cells to display in the notebook. - Cells []NotebookUpdateCell `json:"cells"` - // Metadata associated with the notebook. - Metadata *NotebookMetadata `json:"metadata,omitempty"` - // The name of the notebook. - Name string `json:"name"` - // Publication status of the notebook. For now, always "published". - Status *NotebookStatus `json:"status,omitempty"` - // Notebook global timeframe. - Time NotebookGlobalTime `json:"time"` - // 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{} -} - -// NewNotebookUpdateDataAttributes instantiates a new NotebookUpdateDataAttributes 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 NewNotebookUpdateDataAttributes(cells []NotebookUpdateCell, name string, time NotebookGlobalTime) *NotebookUpdateDataAttributes { - this := NotebookUpdateDataAttributes{} - this.Cells = cells - this.Name = name - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - this.Time = time - return &this -} - -// NewNotebookUpdateDataAttributesWithDefaults instantiates a new NotebookUpdateDataAttributes 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 NewNotebookUpdateDataAttributesWithDefaults() *NotebookUpdateDataAttributes { - this := NotebookUpdateDataAttributes{} - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - return &this -} - -// GetCells returns the Cells field value. -func (o *NotebookUpdateDataAttributes) GetCells() []NotebookUpdateCell { - if o == nil { - var ret []NotebookUpdateCell - return ret - } - return o.Cells -} - -// GetCellsOk returns a tuple with the Cells field value -// and a boolean to check if the value has been set. -func (o *NotebookUpdateDataAttributes) GetCellsOk() (*[]NotebookUpdateCell, bool) { - if o == nil { - return nil, false - } - return &o.Cells, true -} - -// SetCells sets field value. -func (o *NotebookUpdateDataAttributes) SetCells(v []NotebookUpdateCell) { - o.Cells = v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *NotebookUpdateDataAttributes) GetMetadata() NotebookMetadata { - if o == nil || o.Metadata == nil { - var ret NotebookMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookUpdateDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *NotebookUpdateDataAttributes) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. -func (o *NotebookUpdateDataAttributes) SetMetadata(v NotebookMetadata) { - o.Metadata = &v -} - -// GetName returns the Name field value. -func (o *NotebookUpdateDataAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *NotebookUpdateDataAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *NotebookUpdateDataAttributes) SetName(v string) { - o.Name = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *NotebookUpdateDataAttributes) GetStatus() NotebookStatus { - if o == nil || o.Status == nil { - var ret NotebookStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebookUpdateDataAttributes) GetStatusOk() (*NotebookStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *NotebookUpdateDataAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. -func (o *NotebookUpdateDataAttributes) SetStatus(v NotebookStatus) { - o.Status = &v -} - -// GetTime returns the Time field value. -func (o *NotebookUpdateDataAttributes) GetTime() NotebookGlobalTime { - if o == nil { - var ret NotebookGlobalTime - return ret - } - return o.Time -} - -// GetTimeOk returns a tuple with the Time field value -// and a boolean to check if the value has been set. -func (o *NotebookUpdateDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { - if o == nil { - return nil, false - } - return &o.Time, true -} - -// SetTime sets field value. -func (o *NotebookUpdateDataAttributes) SetTime(v NotebookGlobalTime) { - o.Time = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookUpdateDataAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["cells"] = o.Cells - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - toSerialize["name"] = o.Name - if o.Status != nil { - toSerialize["status"] = o.Status - } - toSerialize["time"] = o.Time - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Cells *[]NotebookUpdateCell `json:"cells"` - Name *string `json:"name"` - Time *NotebookGlobalTime `json:"time"` - }{} - all := struct { - Cells []NotebookUpdateCell `json:"cells"` - Metadata *NotebookMetadata `json:"metadata,omitempty"` - Name string `json:"name"` - Status *NotebookStatus `json:"status,omitempty"` - Time NotebookGlobalTime `json:"time"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Cells == nil { - return fmt.Errorf("Required field cells missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Time == nil { - return fmt.Errorf("Required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cells = all.Cells - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Name = all.Name - o.Status = all.Status - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebook_update_request.go b/api/v1/datadog/model_notebook_update_request.go deleted file mode 100644 index 0c3e4bd7ba5..00000000000 --- a/api/v1/datadog/model_notebook_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebookUpdateRequest The description of a notebook update request. -type NotebookUpdateRequest struct { - // The data for a notebook update request. - Data NotebookUpdateData `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{} -} - -// NewNotebookUpdateRequest instantiates a new NotebookUpdateRequest 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 NewNotebookUpdateRequest(data NotebookUpdateData) *NotebookUpdateRequest { - this := NotebookUpdateRequest{} - this.Data = data - return &this -} - -// NewNotebookUpdateRequestWithDefaults instantiates a new NotebookUpdateRequest 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 NewNotebookUpdateRequestWithDefaults() *NotebookUpdateRequest { - this := NotebookUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *NotebookUpdateRequest) GetData() NotebookUpdateData { - if o == nil { - var ret NotebookUpdateData - 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 *NotebookUpdateRequest) GetDataOk() (*NotebookUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *NotebookUpdateRequest) SetData(v NotebookUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *NotebookUpdateData `json:"data"` - }{} - all := struct { - Data NotebookUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_notebooks_response.go b/api/v1/datadog/model_notebooks_response.go deleted file mode 100644 index f9c9d3b14b2..00000000000 --- a/api/v1/datadog/model_notebooks_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebooksResponse Notebooks get all response. -type NotebooksResponse struct { - // List of notebook definitions. - Data []NotebooksResponseData `json:"data,omitempty"` - // Searches metadata returned by the API. - Meta *NotebooksResponseMeta `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{} -} - -// NewNotebooksResponse instantiates a new NotebooksResponse 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 NewNotebooksResponse() *NotebooksResponse { - this := NotebooksResponse{} - return &this -} - -// NewNotebooksResponseWithDefaults instantiates a new NotebooksResponse 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 NewNotebooksResponseWithDefaults() *NotebooksResponse { - this := NotebooksResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *NotebooksResponse) GetData() []NotebooksResponseData { - if o == nil || o.Data == nil { - var ret []NotebooksResponseData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponse) GetDataOk() (*[]NotebooksResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *NotebooksResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []NotebooksResponseData and assigns it to the Data field. -func (o *NotebooksResponse) SetData(v []NotebooksResponseData) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *NotebooksResponse) GetMeta() NotebooksResponseMeta { - if o == nil || o.Meta == nil { - var ret NotebooksResponseMeta - 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 *NotebooksResponse) GetMetaOk() (*NotebooksResponseMeta, 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 *NotebooksResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given NotebooksResponseMeta and assigns it to the Meta field. -func (o *NotebooksResponse) SetMeta(v NotebooksResponseMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebooksResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebooksResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []NotebooksResponseData `json:"data,omitempty"` - Meta *NotebooksResponseMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v1/datadog/model_notebooks_response_data.go b/api/v1/datadog/model_notebooks_response_data.go deleted file mode 100644 index 2271886a717..00000000000 --- a/api/v1/datadog/model_notebooks_response_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NotebooksResponseData The data for a notebook in get all response. -type NotebooksResponseData struct { - // The attributes of a notebook in get all response. - Attributes NotebooksResponseDataAttributes `json:"attributes"` - // Unique notebook ID, assigned when you create the notebook. - Id int64 `json:"id"` - // Type of the Notebook resource. - Type NotebookResourceType `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{} -} - -// NewNotebooksResponseData instantiates a new NotebooksResponseData 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 NewNotebooksResponseData(attributes NotebooksResponseDataAttributes, id int64, typeVar NotebookResourceType) *NotebooksResponseData { - this := NotebooksResponseData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewNotebooksResponseDataWithDefaults instantiates a new NotebooksResponseData 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 NewNotebooksResponseDataWithDefaults() *NotebooksResponseData { - this := NotebooksResponseData{} - var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *NotebooksResponseData) GetAttributes() NotebooksResponseDataAttributes { - if o == nil { - var ret NotebooksResponseDataAttributes - 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 *NotebooksResponseData) GetAttributesOk() (*NotebooksResponseDataAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *NotebooksResponseData) SetAttributes(v NotebooksResponseDataAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *NotebooksResponseData) GetId() int64 { - if o == nil { - var ret int64 - 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 *NotebooksResponseData) GetIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *NotebooksResponseData) SetId(v int64) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *NotebooksResponseData) GetType() NotebookResourceType { - if o == nil { - var ret NotebookResourceType - 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 *NotebooksResponseData) GetTypeOk() (*NotebookResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebooksResponseData) SetType(v NotebookResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebooksResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebooksResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *NotebooksResponseDataAttributes `json:"attributes"` - Id *int64 `json:"id"` - Type *NotebookResourceType `json:"type"` - }{} - all := struct { - Attributes NotebooksResponseDataAttributes `json:"attributes"` - Id int64 `json:"id"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_notebooks_response_data_attributes.go b/api/v1/datadog/model_notebooks_response_data_attributes.go deleted file mode 100644 index 3ae0ee17835..00000000000 --- a/api/v1/datadog/model_notebooks_response_data_attributes.go +++ /dev/null @@ -1,411 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" -) - -// NotebooksResponseDataAttributes The attributes of a notebook in get all response. -type NotebooksResponseDataAttributes struct { - // Attributes of user object returned by the API. - Author *NotebookAuthor `json:"author,omitempty"` - // List of cells to display in the notebook. - Cells []NotebookCellResponse `json:"cells,omitempty"` - // UTC time stamp for when the notebook was created. - Created *time.Time `json:"created,omitempty"` - // Metadata associated with the notebook. - Metadata *NotebookMetadata `json:"metadata,omitempty"` - // UTC time stamp for when the notebook was last modified. - Modified *time.Time `json:"modified,omitempty"` - // The name of the notebook. - Name string `json:"name"` - // Publication status of the notebook. For now, always "published". - Status *NotebookStatus `json:"status,omitempty"` - // Notebook global timeframe. - Time *NotebookGlobalTime `json:"time,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{} -} - -// NewNotebooksResponseDataAttributes instantiates a new NotebooksResponseDataAttributes 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 NewNotebooksResponseDataAttributes(name string) *NotebooksResponseDataAttributes { - this := NotebooksResponseDataAttributes{} - this.Name = name - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - return &this -} - -// NewNotebooksResponseDataAttributesWithDefaults instantiates a new NotebooksResponseDataAttributes 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 NewNotebooksResponseDataAttributesWithDefaults() *NotebooksResponseDataAttributes { - this := NotebooksResponseDataAttributes{} - var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED - this.Status = &status - return &this -} - -// GetAuthor returns the Author field value if set, zero value otherwise. -func (o *NotebooksResponseDataAttributes) GetAuthor() NotebookAuthor { - if o == nil || o.Author == nil { - var ret NotebookAuthor - return ret - } - return *o.Author -} - -// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetAuthorOk() (*NotebookAuthor, bool) { - if o == nil || o.Author == nil { - return nil, false - } - return o.Author, true -} - -// HasAuthor returns a boolean if a field has been set. -func (o *NotebooksResponseDataAttributes) HasAuthor() bool { - if o != nil && o.Author != nil { - return true - } - - return false -} - -// SetAuthor gets a reference to the given NotebookAuthor and assigns it to the Author field. -func (o *NotebooksResponseDataAttributes) SetAuthor(v NotebookAuthor) { - o.Author = &v -} - -// GetCells returns the Cells field value if set, zero value otherwise. -func (o *NotebooksResponseDataAttributes) GetCells() []NotebookCellResponse { - if o == nil || o.Cells == nil { - var ret []NotebookCellResponse - return ret - } - return o.Cells -} - -// GetCellsOk returns a tuple with the Cells field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetCellsOk() (*[]NotebookCellResponse, bool) { - if o == nil || o.Cells == nil { - return nil, false - } - return &o.Cells, true -} - -// HasCells returns a boolean if a field has been set. -func (o *NotebooksResponseDataAttributes) HasCells() bool { - if o != nil && o.Cells != nil { - return true - } - - return false -} - -// SetCells gets a reference to the given []NotebookCellResponse and assigns it to the Cells field. -func (o *NotebooksResponseDataAttributes) SetCells(v []NotebookCellResponse) { - o.Cells = v -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *NotebooksResponseDataAttributes) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *NotebooksResponseDataAttributes) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *NotebooksResponseDataAttributes) SetCreated(v time.Time) { - o.Created = &v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *NotebooksResponseDataAttributes) GetMetadata() NotebookMetadata { - if o == nil || o.Metadata == nil { - var ret NotebookMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *NotebooksResponseDataAttributes) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. -func (o *NotebooksResponseDataAttributes) SetMetadata(v NotebookMetadata) { - o.Metadata = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *NotebooksResponseDataAttributes) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *NotebooksResponseDataAttributes) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *NotebooksResponseDataAttributes) SetModified(v time.Time) { - o.Modified = &v -} - -// GetName returns the Name field value. -func (o *NotebooksResponseDataAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *NotebooksResponseDataAttributes) SetName(v string) { - o.Name = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *NotebooksResponseDataAttributes) GetStatus() NotebookStatus { - if o == nil || o.Status == nil { - var ret NotebookStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetStatusOk() (*NotebookStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *NotebooksResponseDataAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. -func (o *NotebooksResponseDataAttributes) SetStatus(v NotebookStatus) { - o.Status = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *NotebooksResponseDataAttributes) GetTime() NotebookGlobalTime { - if o == nil || o.Time == nil { - var ret NotebookGlobalTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *NotebooksResponseDataAttributes) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given NotebookGlobalTime and assigns it to the Time field. -func (o *NotebooksResponseDataAttributes) SetTime(v NotebookGlobalTime) { - o.Time = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebooksResponseDataAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Author != nil { - toSerialize["author"] = o.Author - } - if o.Cells != nil { - toSerialize["cells"] = o.Cells - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - toSerialize["name"] = o.Name - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Author *NotebookAuthor `json:"author,omitempty"` - Cells []NotebookCellResponse `json:"cells,omitempty"` - Created *time.Time `json:"created,omitempty"` - Metadata *NotebookMetadata `json:"metadata,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Name string `json:"name"` - Status *NotebookStatus `json:"status,omitempty"` - Time *NotebookGlobalTime `json:"time,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Author = all.Author - o.Cells = all.Cells - o.Created = all.Created - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Modified = all.Modified - o.Name = all.Name - o.Status = all.Status - o.Time = all.Time - return nil -} diff --git a/api/v1/datadog/model_notebooks_response_meta.go b/api/v1/datadog/model_notebooks_response_meta.go deleted file mode 100644 index bd20c2269e6..00000000000 --- a/api/v1/datadog/model_notebooks_response_meta.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebooksResponseMeta Searches metadata returned by the API. -type NotebooksResponseMeta struct { - // Pagination metadata returned by the API. - Page *NotebooksResponsePage `json:"page,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{} -} - -// NewNotebooksResponseMeta instantiates a new NotebooksResponseMeta 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 NewNotebooksResponseMeta() *NotebooksResponseMeta { - this := NotebooksResponseMeta{} - return &this -} - -// NewNotebooksResponseMetaWithDefaults instantiates a new NotebooksResponseMeta 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 NewNotebooksResponseMetaWithDefaults() *NotebooksResponseMeta { - this := NotebooksResponseMeta{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *NotebooksResponseMeta) GetPage() NotebooksResponsePage { - if o == nil || o.Page == nil { - var ret NotebooksResponsePage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponseMeta) GetPageOk() (*NotebooksResponsePage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *NotebooksResponseMeta) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given NotebooksResponsePage and assigns it to the Page field. -func (o *NotebooksResponseMeta) SetPage(v NotebooksResponsePage) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebooksResponseMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebooksResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *NotebooksResponsePage `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v1/datadog/model_notebooks_response_page.go b/api/v1/datadog/model_notebooks_response_page.go deleted file mode 100644 index 2daa01ffec8..00000000000 --- a/api/v1/datadog/model_notebooks_response_page.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// NotebooksResponsePage Pagination metadata returned by the API. -type NotebooksResponsePage struct { - // The total number of notebooks that would be returned if the request was not filtered by `start` and `count` parameters. - TotalCount *int64 `json:"total_count,omitempty"` - // The total number of notebooks returned. - 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{} -} - -// NewNotebooksResponsePage instantiates a new NotebooksResponsePage 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 NewNotebooksResponsePage() *NotebooksResponsePage { - this := NotebooksResponsePage{} - return &this -} - -// NewNotebooksResponsePageWithDefaults instantiates a new NotebooksResponsePage 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 NewNotebooksResponsePageWithDefaults() *NotebooksResponsePage { - this := NotebooksResponsePage{} - return &this -} - -// GetTotalCount returns the TotalCount field value if set, zero value otherwise. -func (o *NotebooksResponsePage) GetTotalCount() int64 { - if o == nil || o.TotalCount == nil { - var ret int64 - return ret - } - return *o.TotalCount -} - -// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *NotebooksResponsePage) GetTotalCountOk() (*int64, bool) { - if o == nil || o.TotalCount == nil { - return nil, false - } - return o.TotalCount, true -} - -// HasTotalCount returns a boolean if a field has been set. -func (o *NotebooksResponsePage) HasTotalCount() bool { - if o != nil && o.TotalCount != nil { - return true - } - - return false -} - -// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. -func (o *NotebooksResponsePage) SetTotalCount(v int64) { - o.TotalCount = &v -} - -// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. -func (o *NotebooksResponsePage) 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 *NotebooksResponsePage) 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 *NotebooksResponsePage) HasTotalFilteredCount() bool { - if o != nil && o.TotalFilteredCount != nil { - return true - } - - return false -} - -// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. -func (o *NotebooksResponsePage) SetTotalFilteredCount(v int64) { - o.TotalFilteredCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebooksResponsePage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TotalCount != nil { - toSerialize["total_count"] = o.TotalCount - } - if o.TotalFilteredCount != nil { - toSerialize["total_filtered_count"] = o.TotalFilteredCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebooksResponsePage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TotalCount *int64 `json:"total_count,omitempty"` - TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TotalCount = all.TotalCount - o.TotalFilteredCount = all.TotalFilteredCount - return nil -} diff --git a/api/v1/datadog/model_org_downgraded_response.go b/api/v1/datadog/model_org_downgraded_response.go deleted file mode 100644 index 50a6cd070e6..00000000000 --- a/api/v1/datadog/model_org_downgraded_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrgDowngradedResponse Status of downgrade -type OrgDowngradedResponse struct { - // Information pertaining to the downgraded child organization. - Message *string `json:"message,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{} -} - -// NewOrgDowngradedResponse instantiates a new OrgDowngradedResponse 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 NewOrgDowngradedResponse() *OrgDowngradedResponse { - this := OrgDowngradedResponse{} - return &this -} - -// NewOrgDowngradedResponseWithDefaults instantiates a new OrgDowngradedResponse 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 NewOrgDowngradedResponseWithDefaults() *OrgDowngradedResponse { - this := OrgDowngradedResponse{} - return &this -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *OrgDowngradedResponse) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrgDowngradedResponse) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *OrgDowngradedResponse) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *OrgDowngradedResponse) SetMessage(v string) { - o.Message = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrgDowngradedResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrgDowngradedResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Message *string `json:"message,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_organization.go b/api/v1/datadog/model_organization.go deleted file mode 100644 index d382d63e93a..00000000000 --- a/api/v1/datadog/model_organization.go +++ /dev/null @@ -1,404 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Organization Create, edit, and manage organizations. -type Organization struct { - // A JSON array of billing type. - // Deprecated - Billing *OrganizationBilling `json:"billing,omitempty"` - // Date of the organization creation. - Created *string `json:"created,omitempty"` - // Description of the organization. - Description *string `json:"description,omitempty"` - // The name of the new child-organization, limited to 32 characters. - Name *string `json:"name,omitempty"` - // The `public_id` of the organization you are operating within. - PublicId *string `json:"public_id,omitempty"` - // A JSON array of settings. - Settings *OrganizationSettings `json:"settings,omitempty"` - // Subscription definition. - // Deprecated - Subscription *OrganizationSubscription `json:"subscription,omitempty"` - // Only available for MSP customers. Allows child organizations to be created on a trial plan. - Trial *bool `json:"trial,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{} -} - -// NewOrganization instantiates a new Organization 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 NewOrganization() *Organization { - this := Organization{} - return &this -} - -// NewOrganizationWithDefaults instantiates a new Organization 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 NewOrganizationWithDefaults() *Organization { - this := Organization{} - return &this -} - -// GetBilling returns the Billing field value if set, zero value otherwise. -// Deprecated -func (o *Organization) GetBilling() OrganizationBilling { - if o == nil || o.Billing == nil { - var ret OrganizationBilling - return ret - } - return *o.Billing -} - -// GetBillingOk returns a tuple with the Billing field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *Organization) GetBillingOk() (*OrganizationBilling, bool) { - if o == nil || o.Billing == nil { - return nil, false - } - return o.Billing, true -} - -// HasBilling returns a boolean if a field has been set. -func (o *Organization) HasBilling() bool { - if o != nil && o.Billing != nil { - return true - } - - return false -} - -// SetBilling gets a reference to the given OrganizationBilling and assigns it to the Billing field. -// Deprecated -func (o *Organization) SetBilling(v OrganizationBilling) { - o.Billing = &v -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *Organization) GetCreated() string { - if o == nil || o.Created == nil { - var ret string - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetCreatedOk() (*string, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *Organization) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given string and assigns it to the Created field. -func (o *Organization) SetCreated(v string) { - o.Created = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *Organization) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *Organization) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *Organization) SetDescription(v string) { - o.Description = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *Organization) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *Organization) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *Organization) SetName(v string) { - o.Name = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *Organization) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *Organization) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *Organization) SetPublicId(v string) { - o.PublicId = &v -} - -// GetSettings returns the Settings field value if set, zero value otherwise. -func (o *Organization) GetSettings() OrganizationSettings { - if o == nil || o.Settings == nil { - var ret OrganizationSettings - return ret - } - return *o.Settings -} - -// GetSettingsOk returns a tuple with the Settings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetSettingsOk() (*OrganizationSettings, bool) { - if o == nil || o.Settings == nil { - return nil, false - } - return o.Settings, true -} - -// HasSettings returns a boolean if a field has been set. -func (o *Organization) HasSettings() bool { - if o != nil && o.Settings != nil { - return true - } - - return false -} - -// SetSettings gets a reference to the given OrganizationSettings and assigns it to the Settings field. -func (o *Organization) SetSettings(v OrganizationSettings) { - o.Settings = &v -} - -// GetSubscription returns the Subscription field value if set, zero value otherwise. -// Deprecated -func (o *Organization) GetSubscription() OrganizationSubscription { - if o == nil || o.Subscription == nil { - var ret OrganizationSubscription - return ret - } - return *o.Subscription -} - -// GetSubscriptionOk returns a tuple with the Subscription field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *Organization) GetSubscriptionOk() (*OrganizationSubscription, bool) { - if o == nil || o.Subscription == nil { - return nil, false - } - return o.Subscription, true -} - -// HasSubscription returns a boolean if a field has been set. -func (o *Organization) HasSubscription() bool { - if o != nil && o.Subscription != nil { - return true - } - - return false -} - -// SetSubscription gets a reference to the given OrganizationSubscription and assigns it to the Subscription field. -// Deprecated -func (o *Organization) SetSubscription(v OrganizationSubscription) { - o.Subscription = &v -} - -// GetTrial returns the Trial field value if set, zero value otherwise. -func (o *Organization) GetTrial() bool { - if o == nil || o.Trial == nil { - var ret bool - return ret - } - return *o.Trial -} - -// GetTrialOk returns a tuple with the Trial field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetTrialOk() (*bool, bool) { - if o == nil || o.Trial == nil { - return nil, false - } - return o.Trial, true -} - -// HasTrial returns a boolean if a field has been set. -func (o *Organization) HasTrial() bool { - if o != nil && o.Trial != nil { - return true - } - - return false -} - -// SetTrial gets a reference to the given bool and assigns it to the Trial field. -func (o *Organization) SetTrial(v bool) { - o.Trial = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Organization) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Billing != nil { - toSerialize["billing"] = o.Billing - } - if o.Created != nil { - toSerialize["created"] = o.Created - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Settings != nil { - toSerialize["settings"] = o.Settings - } - if o.Subscription != nil { - toSerialize["subscription"] = o.Subscription - } - if o.Trial != nil { - toSerialize["trial"] = o.Trial - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Billing *OrganizationBilling `json:"billing,omitempty"` - Created *string `json:"created,omitempty"` - Description *string `json:"description,omitempty"` - Name *string `json:"name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - Settings *OrganizationSettings `json:"settings,omitempty"` - Subscription *OrganizationSubscription `json:"subscription,omitempty"` - Trial *bool `json:"trial,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Billing != nil && all.Billing.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Billing = all.Billing - o.Created = all.Created - o.Description = all.Description - o.Name = all.Name - o.PublicId = all.PublicId - if all.Settings != nil && all.Settings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Settings = all.Settings - if all.Subscription != nil && all.Subscription.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Subscription = all.Subscription - o.Trial = all.Trial - return nil -} diff --git a/api/v1/datadog/model_organization_billing.go b/api/v1/datadog/model_organization_billing.go deleted file mode 100644 index d8f031b6f59..00000000000 --- a/api/v1/datadog/model_organization_billing.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationBilling A JSON array of billing type. -type OrganizationBilling struct { - // The type of billing. Only `parent_billing` is supported. - Type *string `json:"type,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{} -} - -// NewOrganizationBilling instantiates a new OrganizationBilling 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 NewOrganizationBilling() *OrganizationBilling { - this := OrganizationBilling{} - return &this -} - -// NewOrganizationBillingWithDefaults instantiates a new OrganizationBilling 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 NewOrganizationBillingWithDefaults() *OrganizationBilling { - this := OrganizationBilling{} - return &this -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *OrganizationBilling) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationBilling) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *OrganizationBilling) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *OrganizationBilling) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationBilling) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationBilling) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_organization_create_body.go b/api/v1/datadog/model_organization_create_body.go deleted file mode 100644 index 28c17d26b70..00000000000 --- a/api/v1/datadog/model_organization_create_body.go +++ /dev/null @@ -1,203 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OrganizationCreateBody Object describing an organization to create. -type OrganizationCreateBody struct { - // A JSON array of billing type. - // Deprecated - Billing *OrganizationBilling `json:"billing,omitempty"` - // The name of the new child-organization, limited to 32 characters. - Name string `json:"name"` - // Subscription definition. - // Deprecated - Subscription *OrganizationSubscription `json:"subscription,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{} -} - -// NewOrganizationCreateBody instantiates a new OrganizationCreateBody 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 NewOrganizationCreateBody(name string) *OrganizationCreateBody { - this := OrganizationCreateBody{} - this.Name = name - return &this -} - -// NewOrganizationCreateBodyWithDefaults instantiates a new OrganizationCreateBody 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 NewOrganizationCreateBodyWithDefaults() *OrganizationCreateBody { - this := OrganizationCreateBody{} - return &this -} - -// GetBilling returns the Billing field value if set, zero value otherwise. -// Deprecated -func (o *OrganizationCreateBody) GetBilling() OrganizationBilling { - if o == nil || o.Billing == nil { - var ret OrganizationBilling - return ret - } - return *o.Billing -} - -// GetBillingOk returns a tuple with the Billing field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *OrganizationCreateBody) GetBillingOk() (*OrganizationBilling, bool) { - if o == nil || o.Billing == nil { - return nil, false - } - return o.Billing, true -} - -// HasBilling returns a boolean if a field has been set. -func (o *OrganizationCreateBody) HasBilling() bool { - if o != nil && o.Billing != nil { - return true - } - - return false -} - -// SetBilling gets a reference to the given OrganizationBilling and assigns it to the Billing field. -// Deprecated -func (o *OrganizationCreateBody) SetBilling(v OrganizationBilling) { - o.Billing = &v -} - -// GetName returns the Name field value. -func (o *OrganizationCreateBody) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *OrganizationCreateBody) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *OrganizationCreateBody) SetName(v string) { - o.Name = v -} - -// GetSubscription returns the Subscription field value if set, zero value otherwise. -// Deprecated -func (o *OrganizationCreateBody) GetSubscription() OrganizationSubscription { - if o == nil || o.Subscription == nil { - var ret OrganizationSubscription - return ret - } - return *o.Subscription -} - -// GetSubscriptionOk returns a tuple with the Subscription field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *OrganizationCreateBody) GetSubscriptionOk() (*OrganizationSubscription, bool) { - if o == nil || o.Subscription == nil { - return nil, false - } - return o.Subscription, true -} - -// HasSubscription returns a boolean if a field has been set. -func (o *OrganizationCreateBody) HasSubscription() bool { - if o != nil && o.Subscription != nil { - return true - } - - return false -} - -// SetSubscription gets a reference to the given OrganizationSubscription and assigns it to the Subscription field. -// Deprecated -func (o *OrganizationCreateBody) SetSubscription(v OrganizationSubscription) { - o.Subscription = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationCreateBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Billing != nil { - toSerialize["billing"] = o.Billing - } - toSerialize["name"] = o.Name - if o.Subscription != nil { - toSerialize["subscription"] = o.Subscription - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationCreateBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Billing *OrganizationBilling `json:"billing,omitempty"` - Name string `json:"name"` - Subscription *OrganizationSubscription `json:"subscription,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Billing != nil && all.Billing.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Billing = all.Billing - o.Name = all.Name - if all.Subscription != nil && all.Subscription.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Subscription = all.Subscription - return nil -} diff --git a/api/v1/datadog/model_organization_create_response.go b/api/v1/datadog/model_organization_create_response.go deleted file mode 100644 index cdd770d7dbf..00000000000 --- a/api/v1/datadog/model_organization_create_response.go +++ /dev/null @@ -1,247 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationCreateResponse Response object for an organization creation. -type OrganizationCreateResponse struct { - // Datadog API key. - ApiKey *ApiKey `json:"api_key,omitempty"` - // An application key with its associated metadata. - ApplicationKey *ApplicationKey `json:"application_key,omitempty"` - // Create, edit, and manage organizations. - Org *Organization `json:"org,omitempty"` - // Create, edit, and disable users. - User *User `json:"user,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{} -} - -// NewOrganizationCreateResponse instantiates a new OrganizationCreateResponse 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 NewOrganizationCreateResponse() *OrganizationCreateResponse { - this := OrganizationCreateResponse{} - return &this -} - -// NewOrganizationCreateResponseWithDefaults instantiates a new OrganizationCreateResponse 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 NewOrganizationCreateResponseWithDefaults() *OrganizationCreateResponse { - this := OrganizationCreateResponse{} - return &this -} - -// GetApiKey returns the ApiKey field value if set, zero value otherwise. -func (o *OrganizationCreateResponse) GetApiKey() ApiKey { - if o == nil || o.ApiKey == nil { - var ret ApiKey - return ret - } - return *o.ApiKey -} - -// GetApiKeyOk returns a tuple with the ApiKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationCreateResponse) GetApiKeyOk() (*ApiKey, bool) { - if o == nil || o.ApiKey == nil { - return nil, false - } - return o.ApiKey, true -} - -// HasApiKey returns a boolean if a field has been set. -func (o *OrganizationCreateResponse) HasApiKey() bool { - if o != nil && o.ApiKey != nil { - return true - } - - return false -} - -// SetApiKey gets a reference to the given ApiKey and assigns it to the ApiKey field. -func (o *OrganizationCreateResponse) SetApiKey(v ApiKey) { - o.ApiKey = &v -} - -// GetApplicationKey returns the ApplicationKey field value if set, zero value otherwise. -func (o *OrganizationCreateResponse) GetApplicationKey() ApplicationKey { - if o == nil || o.ApplicationKey == nil { - var ret ApplicationKey - return ret - } - return *o.ApplicationKey -} - -// GetApplicationKeyOk returns a tuple with the ApplicationKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationCreateResponse) GetApplicationKeyOk() (*ApplicationKey, bool) { - if o == nil || o.ApplicationKey == nil { - return nil, false - } - return o.ApplicationKey, true -} - -// HasApplicationKey returns a boolean if a field has been set. -func (o *OrganizationCreateResponse) HasApplicationKey() bool { - if o != nil && o.ApplicationKey != nil { - return true - } - - return false -} - -// SetApplicationKey gets a reference to the given ApplicationKey and assigns it to the ApplicationKey field. -func (o *OrganizationCreateResponse) SetApplicationKey(v ApplicationKey) { - o.ApplicationKey = &v -} - -// GetOrg returns the Org field value if set, zero value otherwise. -func (o *OrganizationCreateResponse) GetOrg() Organization { - if o == nil || o.Org == nil { - var ret Organization - return ret - } - return *o.Org -} - -// GetOrgOk returns a tuple with the Org field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationCreateResponse) GetOrgOk() (*Organization, bool) { - if o == nil || o.Org == nil { - return nil, false - } - return o.Org, true -} - -// HasOrg returns a boolean if a field has been set. -func (o *OrganizationCreateResponse) HasOrg() bool { - if o != nil && o.Org != nil { - return true - } - - return false -} - -// SetOrg gets a reference to the given Organization and assigns it to the Org field. -func (o *OrganizationCreateResponse) SetOrg(v Organization) { - o.Org = &v -} - -// GetUser returns the User field value if set, zero value otherwise. -func (o *OrganizationCreateResponse) GetUser() User { - if o == nil || o.User == nil { - var ret User - return ret - } - return *o.User -} - -// GetUserOk returns a tuple with the User field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationCreateResponse) GetUserOk() (*User, bool) { - if o == nil || o.User == nil { - return nil, false - } - return o.User, true -} - -// HasUser returns a boolean if a field has been set. -func (o *OrganizationCreateResponse) HasUser() bool { - if o != nil && o.User != nil { - return true - } - - return false -} - -// SetUser gets a reference to the given User and assigns it to the User field. -func (o *OrganizationCreateResponse) SetUser(v User) { - o.User = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationCreateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApiKey != nil { - toSerialize["api_key"] = o.ApiKey - } - if o.ApplicationKey != nil { - toSerialize["application_key"] = o.ApplicationKey - } - if o.Org != nil { - toSerialize["org"] = o.Org - } - if o.User != nil { - toSerialize["user"] = o.User - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApiKey *ApiKey `json:"api_key,omitempty"` - ApplicationKey *ApplicationKey `json:"application_key,omitempty"` - Org *Organization `json:"org,omitempty"` - User *User `json:"user,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApiKey != nil && all.ApiKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApiKey = all.ApiKey - if all.ApplicationKey != nil && all.ApplicationKey.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApplicationKey = all.ApplicationKey - if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Org = all.Org - if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.User = all.User - return nil -} diff --git a/api/v1/datadog/model_organization_list_response.go b/api/v1/datadog/model_organization_list_response.go deleted file mode 100644 index 5bdc8221aaa..00000000000 --- a/api/v1/datadog/model_organization_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationListResponse Response with the list of organizations. -type OrganizationListResponse struct { - // Array of organization objects. - Orgs []Organization `json:"orgs,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{} -} - -// NewOrganizationListResponse instantiates a new OrganizationListResponse 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 NewOrganizationListResponse() *OrganizationListResponse { - this := OrganizationListResponse{} - return &this -} - -// NewOrganizationListResponseWithDefaults instantiates a new OrganizationListResponse 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 NewOrganizationListResponseWithDefaults() *OrganizationListResponse { - this := OrganizationListResponse{} - return &this -} - -// GetOrgs returns the Orgs field value if set, zero value otherwise. -func (o *OrganizationListResponse) GetOrgs() []Organization { - if o == nil || o.Orgs == nil { - var ret []Organization - return ret - } - return o.Orgs -} - -// GetOrgsOk returns a tuple with the Orgs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationListResponse) GetOrgsOk() (*[]Organization, bool) { - if o == nil || o.Orgs == nil { - return nil, false - } - return &o.Orgs, true -} - -// HasOrgs returns a boolean if a field has been set. -func (o *OrganizationListResponse) HasOrgs() bool { - if o != nil && o.Orgs != nil { - return true - } - - return false -} - -// SetOrgs gets a reference to the given []Organization and assigns it to the Orgs field. -func (o *OrganizationListResponse) SetOrgs(v []Organization) { - o.Orgs = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Orgs != nil { - toSerialize["orgs"] = o.Orgs - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Orgs []Organization `json:"orgs,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Orgs = all.Orgs - return nil -} diff --git a/api/v1/datadog/model_organization_response.go b/api/v1/datadog/model_organization_response.go deleted file mode 100644 index ca52471c117..00000000000 --- a/api/v1/datadog/model_organization_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationResponse Response with an organization. -type OrganizationResponse struct { - // Create, edit, and manage organizations. - Org *Organization `json:"org,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{} -} - -// NewOrganizationResponse instantiates a new OrganizationResponse 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 NewOrganizationResponse() *OrganizationResponse { - this := OrganizationResponse{} - return &this -} - -// NewOrganizationResponseWithDefaults instantiates a new OrganizationResponse 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 NewOrganizationResponseWithDefaults() *OrganizationResponse { - this := OrganizationResponse{} - return &this -} - -// GetOrg returns the Org field value if set, zero value otherwise. -func (o *OrganizationResponse) GetOrg() Organization { - if o == nil || o.Org == nil { - var ret Organization - return ret - } - return *o.Org -} - -// GetOrgOk returns a tuple with the Org field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationResponse) GetOrgOk() (*Organization, bool) { - if o == nil || o.Org == nil { - return nil, false - } - return o.Org, true -} - -// HasOrg returns a boolean if a field has been set. -func (o *OrganizationResponse) HasOrg() bool { - if o != nil && o.Org != nil { - return true - } - - return false -} - -// SetOrg gets a reference to the given Organization and assigns it to the Org field. -func (o *OrganizationResponse) SetOrg(v Organization) { - o.Org = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Org != nil { - toSerialize["org"] = o.Org - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Org *Organization `json:"org,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Org = all.Org - return nil -} diff --git a/api/v1/datadog/model_organization_settings.go b/api/v1/datadog/model_organization_settings.go deleted file mode 100644 index 00441d21037..00000000000 --- a/api/v1/datadog/model_organization_settings.go +++ /dev/null @@ -1,494 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationSettings A JSON array of settings. -type OrganizationSettings struct { - // Whether or not the organization users can share widgets outside of Datadog. - PrivateWidgetShare *bool `json:"private_widget_share,omitempty"` - // Set the boolean property enabled to enable or disable single sign on with SAML. - // See the SAML documentation for more information about all SAML settings. - Saml *OrganizationSettingsSaml `json:"saml,omitempty"` - // The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). - SamlAutocreateAccessRole *AccessRole `json:"saml_autocreate_access_role,omitempty"` - // Has two properties, `enabled` (boolean) and `domains`, which is a list of domains without the @ symbol. - SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"` - // Whether or not SAML can be enabled for this organization. - SamlCanBeEnabled *bool `json:"saml_can_be_enabled,omitempty"` - // Identity provider endpoint for SAML authentication. - SamlIdpEndpoint *string `json:"saml_idp_endpoint,omitempty"` - // Has one property enabled (boolean). - SamlIdpInitiatedLogin *OrganizationSettingsSamlIdpInitiatedLogin `json:"saml_idp_initiated_login,omitempty"` - // Whether or not a SAML identity provider metadata file was provided to the Datadog organization. - SamlIdpMetadataUploaded *bool `json:"saml_idp_metadata_uploaded,omitempty"` - // URL for SAML logging. - SamlLoginUrl *string `json:"saml_login_url,omitempty"` - // Has one property enabled (boolean). - SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,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{} -} - -// NewOrganizationSettings instantiates a new OrganizationSettings 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 NewOrganizationSettings() *OrganizationSettings { - this := OrganizationSettings{} - var samlAutocreateAccessRole AccessRole = ACCESSROLE_STANDARD - this.SamlAutocreateAccessRole = &samlAutocreateAccessRole - return &this -} - -// NewOrganizationSettingsWithDefaults instantiates a new OrganizationSettings 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 NewOrganizationSettingsWithDefaults() *OrganizationSettings { - this := OrganizationSettings{} - var samlAutocreateAccessRole AccessRole = ACCESSROLE_STANDARD - this.SamlAutocreateAccessRole = &samlAutocreateAccessRole - return &this -} - -// GetPrivateWidgetShare returns the PrivateWidgetShare field value if set, zero value otherwise. -func (o *OrganizationSettings) GetPrivateWidgetShare() bool { - if o == nil || o.PrivateWidgetShare == nil { - var ret bool - return ret - } - return *o.PrivateWidgetShare -} - -// GetPrivateWidgetShareOk returns a tuple with the PrivateWidgetShare field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetPrivateWidgetShareOk() (*bool, bool) { - if o == nil || o.PrivateWidgetShare == nil { - return nil, false - } - return o.PrivateWidgetShare, true -} - -// HasPrivateWidgetShare returns a boolean if a field has been set. -func (o *OrganizationSettings) HasPrivateWidgetShare() bool { - if o != nil && o.PrivateWidgetShare != nil { - return true - } - - return false -} - -// SetPrivateWidgetShare gets a reference to the given bool and assigns it to the PrivateWidgetShare field. -func (o *OrganizationSettings) SetPrivateWidgetShare(v bool) { - o.PrivateWidgetShare = &v -} - -// GetSaml returns the Saml field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSaml() OrganizationSettingsSaml { - if o == nil || o.Saml == nil { - var ret OrganizationSettingsSaml - return ret - } - return *o.Saml -} - -// GetSamlOk returns a tuple with the Saml field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlOk() (*OrganizationSettingsSaml, bool) { - if o == nil || o.Saml == nil { - return nil, false - } - return o.Saml, true -} - -// HasSaml returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSaml() bool { - if o != nil && o.Saml != nil { - return true - } - - return false -} - -// SetSaml gets a reference to the given OrganizationSettingsSaml and assigns it to the Saml field. -func (o *OrganizationSettings) SetSaml(v OrganizationSettingsSaml) { - o.Saml = &v -} - -// GetSamlAutocreateAccessRole returns the SamlAutocreateAccessRole field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlAutocreateAccessRole() AccessRole { - if o == nil || o.SamlAutocreateAccessRole == nil { - var ret AccessRole - return ret - } - return *o.SamlAutocreateAccessRole -} - -// GetSamlAutocreateAccessRoleOk returns a tuple with the SamlAutocreateAccessRole field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlAutocreateAccessRoleOk() (*AccessRole, bool) { - if o == nil || o.SamlAutocreateAccessRole == nil { - return nil, false - } - return o.SamlAutocreateAccessRole, true -} - -// HasSamlAutocreateAccessRole returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlAutocreateAccessRole() bool { - if o != nil && o.SamlAutocreateAccessRole != nil { - return true - } - - return false -} - -// SetSamlAutocreateAccessRole gets a reference to the given AccessRole and assigns it to the SamlAutocreateAccessRole field. -func (o *OrganizationSettings) SetSamlAutocreateAccessRole(v AccessRole) { - o.SamlAutocreateAccessRole = &v -} - -// GetSamlAutocreateUsersDomains returns the SamlAutocreateUsersDomains field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlAutocreateUsersDomains() OrganizationSettingsSamlAutocreateUsersDomains { - if o == nil || o.SamlAutocreateUsersDomains == nil { - var ret OrganizationSettingsSamlAutocreateUsersDomains - return ret - } - return *o.SamlAutocreateUsersDomains -} - -// GetSamlAutocreateUsersDomainsOk returns a tuple with the SamlAutocreateUsersDomains field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlAutocreateUsersDomainsOk() (*OrganizationSettingsSamlAutocreateUsersDomains, bool) { - if o == nil || o.SamlAutocreateUsersDomains == nil { - return nil, false - } - return o.SamlAutocreateUsersDomains, true -} - -// HasSamlAutocreateUsersDomains returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlAutocreateUsersDomains() bool { - if o != nil && o.SamlAutocreateUsersDomains != nil { - return true - } - - return false -} - -// SetSamlAutocreateUsersDomains gets a reference to the given OrganizationSettingsSamlAutocreateUsersDomains and assigns it to the SamlAutocreateUsersDomains field. -func (o *OrganizationSettings) SetSamlAutocreateUsersDomains(v OrganizationSettingsSamlAutocreateUsersDomains) { - o.SamlAutocreateUsersDomains = &v -} - -// GetSamlCanBeEnabled returns the SamlCanBeEnabled field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlCanBeEnabled() bool { - if o == nil || o.SamlCanBeEnabled == nil { - var ret bool - return ret - } - return *o.SamlCanBeEnabled -} - -// GetSamlCanBeEnabledOk returns a tuple with the SamlCanBeEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlCanBeEnabledOk() (*bool, bool) { - if o == nil || o.SamlCanBeEnabled == nil { - return nil, false - } - return o.SamlCanBeEnabled, true -} - -// HasSamlCanBeEnabled returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlCanBeEnabled() bool { - if o != nil && o.SamlCanBeEnabled != nil { - return true - } - - return false -} - -// SetSamlCanBeEnabled gets a reference to the given bool and assigns it to the SamlCanBeEnabled field. -func (o *OrganizationSettings) SetSamlCanBeEnabled(v bool) { - o.SamlCanBeEnabled = &v -} - -// GetSamlIdpEndpoint returns the SamlIdpEndpoint field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlIdpEndpoint() string { - if o == nil || o.SamlIdpEndpoint == nil { - var ret string - return ret - } - return *o.SamlIdpEndpoint -} - -// GetSamlIdpEndpointOk returns a tuple with the SamlIdpEndpoint field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlIdpEndpointOk() (*string, bool) { - if o == nil || o.SamlIdpEndpoint == nil { - return nil, false - } - return o.SamlIdpEndpoint, true -} - -// HasSamlIdpEndpoint returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlIdpEndpoint() bool { - if o != nil && o.SamlIdpEndpoint != nil { - return true - } - - return false -} - -// SetSamlIdpEndpoint gets a reference to the given string and assigns it to the SamlIdpEndpoint field. -func (o *OrganizationSettings) SetSamlIdpEndpoint(v string) { - o.SamlIdpEndpoint = &v -} - -// GetSamlIdpInitiatedLogin returns the SamlIdpInitiatedLogin field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlIdpInitiatedLogin() OrganizationSettingsSamlIdpInitiatedLogin { - if o == nil || o.SamlIdpInitiatedLogin == nil { - var ret OrganizationSettingsSamlIdpInitiatedLogin - return ret - } - return *o.SamlIdpInitiatedLogin -} - -// GetSamlIdpInitiatedLoginOk returns a tuple with the SamlIdpInitiatedLogin field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlIdpInitiatedLoginOk() (*OrganizationSettingsSamlIdpInitiatedLogin, bool) { - if o == nil || o.SamlIdpInitiatedLogin == nil { - return nil, false - } - return o.SamlIdpInitiatedLogin, true -} - -// HasSamlIdpInitiatedLogin returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlIdpInitiatedLogin() bool { - if o != nil && o.SamlIdpInitiatedLogin != nil { - return true - } - - return false -} - -// SetSamlIdpInitiatedLogin gets a reference to the given OrganizationSettingsSamlIdpInitiatedLogin and assigns it to the SamlIdpInitiatedLogin field. -func (o *OrganizationSettings) SetSamlIdpInitiatedLogin(v OrganizationSettingsSamlIdpInitiatedLogin) { - o.SamlIdpInitiatedLogin = &v -} - -// GetSamlIdpMetadataUploaded returns the SamlIdpMetadataUploaded field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlIdpMetadataUploaded() bool { - if o == nil || o.SamlIdpMetadataUploaded == nil { - var ret bool - return ret - } - return *o.SamlIdpMetadataUploaded -} - -// GetSamlIdpMetadataUploadedOk returns a tuple with the SamlIdpMetadataUploaded field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlIdpMetadataUploadedOk() (*bool, bool) { - if o == nil || o.SamlIdpMetadataUploaded == nil { - return nil, false - } - return o.SamlIdpMetadataUploaded, true -} - -// HasSamlIdpMetadataUploaded returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlIdpMetadataUploaded() bool { - if o != nil && o.SamlIdpMetadataUploaded != nil { - return true - } - - return false -} - -// SetSamlIdpMetadataUploaded gets a reference to the given bool and assigns it to the SamlIdpMetadataUploaded field. -func (o *OrganizationSettings) SetSamlIdpMetadataUploaded(v bool) { - o.SamlIdpMetadataUploaded = &v -} - -// GetSamlLoginUrl returns the SamlLoginUrl field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlLoginUrl() string { - if o == nil || o.SamlLoginUrl == nil { - var ret string - return ret - } - return *o.SamlLoginUrl -} - -// GetSamlLoginUrlOk returns a tuple with the SamlLoginUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlLoginUrlOk() (*string, bool) { - if o == nil || o.SamlLoginUrl == nil { - return nil, false - } - return o.SamlLoginUrl, true -} - -// HasSamlLoginUrl returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlLoginUrl() bool { - if o != nil && o.SamlLoginUrl != nil { - return true - } - - return false -} - -// SetSamlLoginUrl gets a reference to the given string and assigns it to the SamlLoginUrl field. -func (o *OrganizationSettings) SetSamlLoginUrl(v string) { - o.SamlLoginUrl = &v -} - -// GetSamlStrictMode returns the SamlStrictMode field value if set, zero value otherwise. -func (o *OrganizationSettings) GetSamlStrictMode() OrganizationSettingsSamlStrictMode { - if o == nil || o.SamlStrictMode == nil { - var ret OrganizationSettingsSamlStrictMode - return ret - } - return *o.SamlStrictMode -} - -// GetSamlStrictModeOk returns a tuple with the SamlStrictMode field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettings) GetSamlStrictModeOk() (*OrganizationSettingsSamlStrictMode, bool) { - if o == nil || o.SamlStrictMode == nil { - return nil, false - } - return o.SamlStrictMode, true -} - -// HasSamlStrictMode returns a boolean if a field has been set. -func (o *OrganizationSettings) HasSamlStrictMode() bool { - if o != nil && o.SamlStrictMode != nil { - return true - } - - return false -} - -// SetSamlStrictMode gets a reference to the given OrganizationSettingsSamlStrictMode and assigns it to the SamlStrictMode field. -func (o *OrganizationSettings) SetSamlStrictMode(v OrganizationSettingsSamlStrictMode) { - o.SamlStrictMode = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationSettings) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PrivateWidgetShare != nil { - toSerialize["private_widget_share"] = o.PrivateWidgetShare - } - if o.Saml != nil { - toSerialize["saml"] = o.Saml - } - if o.SamlAutocreateAccessRole != nil { - toSerialize["saml_autocreate_access_role"] = o.SamlAutocreateAccessRole - } - if o.SamlAutocreateUsersDomains != nil { - toSerialize["saml_autocreate_users_domains"] = o.SamlAutocreateUsersDomains - } - if o.SamlCanBeEnabled != nil { - toSerialize["saml_can_be_enabled"] = o.SamlCanBeEnabled - } - if o.SamlIdpEndpoint != nil { - toSerialize["saml_idp_endpoint"] = o.SamlIdpEndpoint - } - if o.SamlIdpInitiatedLogin != nil { - toSerialize["saml_idp_initiated_login"] = o.SamlIdpInitiatedLogin - } - if o.SamlIdpMetadataUploaded != nil { - toSerialize["saml_idp_metadata_uploaded"] = o.SamlIdpMetadataUploaded - } - if o.SamlLoginUrl != nil { - toSerialize["saml_login_url"] = o.SamlLoginUrl - } - if o.SamlStrictMode != nil { - toSerialize["saml_strict_mode"] = o.SamlStrictMode - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationSettings) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PrivateWidgetShare *bool `json:"private_widget_share,omitempty"` - Saml *OrganizationSettingsSaml `json:"saml,omitempty"` - SamlAutocreateAccessRole *AccessRole `json:"saml_autocreate_access_role,omitempty"` - SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"` - SamlCanBeEnabled *bool `json:"saml_can_be_enabled,omitempty"` - SamlIdpEndpoint *string `json:"saml_idp_endpoint,omitempty"` - SamlIdpInitiatedLogin *OrganizationSettingsSamlIdpInitiatedLogin `json:"saml_idp_initiated_login,omitempty"` - SamlIdpMetadataUploaded *bool `json:"saml_idp_metadata_uploaded,omitempty"` - SamlLoginUrl *string `json:"saml_login_url,omitempty"` - SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.SamlAutocreateAccessRole; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PrivateWidgetShare = all.PrivateWidgetShare - if all.Saml != nil && all.Saml.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Saml = all.Saml - o.SamlAutocreateAccessRole = all.SamlAutocreateAccessRole - if all.SamlAutocreateUsersDomains != nil && all.SamlAutocreateUsersDomains.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SamlAutocreateUsersDomains = all.SamlAutocreateUsersDomains - o.SamlCanBeEnabled = all.SamlCanBeEnabled - o.SamlIdpEndpoint = all.SamlIdpEndpoint - if all.SamlIdpInitiatedLogin != nil && all.SamlIdpInitiatedLogin.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SamlIdpInitiatedLogin = all.SamlIdpInitiatedLogin - o.SamlIdpMetadataUploaded = all.SamlIdpMetadataUploaded - o.SamlLoginUrl = all.SamlLoginUrl - if all.SamlStrictMode != nil && all.SamlStrictMode.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SamlStrictMode = all.SamlStrictMode - return nil -} diff --git a/api/v1/datadog/model_organization_settings_saml.go b/api/v1/datadog/model_organization_settings_saml.go deleted file mode 100644 index 019e3b7972f..00000000000 --- a/api/v1/datadog/model_organization_settings_saml.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationSettingsSaml Set the boolean property enabled to enable or disable single sign on with SAML. -// See the SAML documentation for more information about all SAML settings. -type OrganizationSettingsSaml struct { - // Whether or not SAML is enabled for this organization. - Enabled *bool `json:"enabled,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{} -} - -// NewOrganizationSettingsSaml instantiates a new OrganizationSettingsSaml 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 NewOrganizationSettingsSaml() *OrganizationSettingsSaml { - this := OrganizationSettingsSaml{} - return &this -} - -// NewOrganizationSettingsSamlWithDefaults instantiates a new OrganizationSettingsSaml 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 NewOrganizationSettingsSamlWithDefaults() *OrganizationSettingsSaml { - this := OrganizationSettingsSaml{} - return &this -} - -// GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *OrganizationSettingsSaml) GetEnabled() bool { - if o == nil || o.Enabled == nil { - var ret bool - return ret - } - return *o.Enabled -} - -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettingsSaml) GetEnabledOk() (*bool, bool) { - if o == nil || o.Enabled == nil { - return nil, false - } - return o.Enabled, true -} - -// HasEnabled returns a boolean if a field has been set. -func (o *OrganizationSettingsSaml) HasEnabled() bool { - if o != nil && o.Enabled != nil { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *OrganizationSettingsSaml) SetEnabled(v bool) { - o.Enabled = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationSettingsSaml) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Enabled != nil { - toSerialize["enabled"] = o.Enabled - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationSettingsSaml) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Enabled *bool `json:"enabled,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Enabled = all.Enabled - return nil -} diff --git a/api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go b/api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go deleted file mode 100644 index 89929305b44..00000000000 --- a/api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationSettingsSamlAutocreateUsersDomains Has two properties, `enabled` (boolean) and `domains`, which is a list of domains without the @ symbol. -type OrganizationSettingsSamlAutocreateUsersDomains struct { - // List of domains where the SAML automated user creation is enabled. - Domains []string `json:"domains,omitempty"` - // Whether or not the automated user creation based on SAML domain is enabled. - Enabled *bool `json:"enabled,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{} -} - -// NewOrganizationSettingsSamlAutocreateUsersDomains instantiates a new OrganizationSettingsSamlAutocreateUsersDomains 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 NewOrganizationSettingsSamlAutocreateUsersDomains() *OrganizationSettingsSamlAutocreateUsersDomains { - this := OrganizationSettingsSamlAutocreateUsersDomains{} - return &this -} - -// NewOrganizationSettingsSamlAutocreateUsersDomainsWithDefaults instantiates a new OrganizationSettingsSamlAutocreateUsersDomains 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 NewOrganizationSettingsSamlAutocreateUsersDomainsWithDefaults() *OrganizationSettingsSamlAutocreateUsersDomains { - this := OrganizationSettingsSamlAutocreateUsersDomains{} - return &this -} - -// GetDomains returns the Domains field value if set, zero value otherwise. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetDomains() []string { - if o == nil || o.Domains == nil { - var ret []string - return ret - } - return o.Domains -} - -// GetDomainsOk returns a tuple with the Domains field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetDomainsOk() (*[]string, bool) { - if o == nil || o.Domains == nil { - return nil, false - } - return &o.Domains, true -} - -// HasDomains returns a boolean if a field has been set. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) HasDomains() bool { - if o != nil && o.Domains != nil { - return true - } - - return false -} - -// SetDomains gets a reference to the given []string and assigns it to the Domains field. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) SetDomains(v []string) { - o.Domains = v -} - -// GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetEnabled() bool { - if o == nil || o.Enabled == nil { - var ret bool - return ret - } - return *o.Enabled -} - -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetEnabledOk() (*bool, bool) { - if o == nil || o.Enabled == nil { - return nil, false - } - return o.Enabled, true -} - -// HasEnabled returns a boolean if a field has been set. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) HasEnabled() bool { - if o != nil && o.Enabled != nil { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) SetEnabled(v bool) { - o.Enabled = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationSettingsSamlAutocreateUsersDomains) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Domains != nil { - toSerialize["domains"] = o.Domains - } - if o.Enabled != nil { - toSerialize["enabled"] = o.Enabled - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationSettingsSamlAutocreateUsersDomains) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Domains []string `json:"domains,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Domains = all.Domains - o.Enabled = all.Enabled - return nil -} diff --git a/api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go b/api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go deleted file mode 100644 index 4487833b511..00000000000 --- a/api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationSettingsSamlIdpInitiatedLogin Has one property enabled (boolean). -type OrganizationSettingsSamlIdpInitiatedLogin struct { - // Whether SAML IdP initiated login is enabled, learn more - // in the [SAML documentation](https://docs.datadoghq.com/account_management/saml/#idp-initiated-login). - Enabled *bool `json:"enabled,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{} -} - -// NewOrganizationSettingsSamlIdpInitiatedLogin instantiates a new OrganizationSettingsSamlIdpInitiatedLogin 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 NewOrganizationSettingsSamlIdpInitiatedLogin() *OrganizationSettingsSamlIdpInitiatedLogin { - this := OrganizationSettingsSamlIdpInitiatedLogin{} - return &this -} - -// NewOrganizationSettingsSamlIdpInitiatedLoginWithDefaults instantiates a new OrganizationSettingsSamlIdpInitiatedLogin 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 NewOrganizationSettingsSamlIdpInitiatedLoginWithDefaults() *OrganizationSettingsSamlIdpInitiatedLogin { - this := OrganizationSettingsSamlIdpInitiatedLogin{} - return &this -} - -// GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *OrganizationSettingsSamlIdpInitiatedLogin) GetEnabled() bool { - if o == nil || o.Enabled == nil { - var ret bool - return ret - } - return *o.Enabled -} - -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettingsSamlIdpInitiatedLogin) GetEnabledOk() (*bool, bool) { - if o == nil || o.Enabled == nil { - return nil, false - } - return o.Enabled, true -} - -// HasEnabled returns a boolean if a field has been set. -func (o *OrganizationSettingsSamlIdpInitiatedLogin) HasEnabled() bool { - if o != nil && o.Enabled != nil { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *OrganizationSettingsSamlIdpInitiatedLogin) SetEnabled(v bool) { - o.Enabled = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationSettingsSamlIdpInitiatedLogin) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Enabled != nil { - toSerialize["enabled"] = o.Enabled - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationSettingsSamlIdpInitiatedLogin) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Enabled *bool `json:"enabled,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Enabled = all.Enabled - return nil -} diff --git a/api/v1/datadog/model_organization_settings_saml_strict_mode.go b/api/v1/datadog/model_organization_settings_saml_strict_mode.go deleted file mode 100644 index cbcb665b86b..00000000000 --- a/api/v1/datadog/model_organization_settings_saml_strict_mode.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationSettingsSamlStrictMode Has one property enabled (boolean). -type OrganizationSettingsSamlStrictMode struct { - // Whether or not the SAML strict mode is enabled. If true, all users must log in with SAML. - // Learn more on the [SAML Strict documentation](https://docs.datadoghq.com/account_management/saml/#saml-strict). - Enabled *bool `json:"enabled,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{} -} - -// NewOrganizationSettingsSamlStrictMode instantiates a new OrganizationSettingsSamlStrictMode 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 NewOrganizationSettingsSamlStrictMode() *OrganizationSettingsSamlStrictMode { - this := OrganizationSettingsSamlStrictMode{} - return &this -} - -// NewOrganizationSettingsSamlStrictModeWithDefaults instantiates a new OrganizationSettingsSamlStrictMode 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 NewOrganizationSettingsSamlStrictModeWithDefaults() *OrganizationSettingsSamlStrictMode { - this := OrganizationSettingsSamlStrictMode{} - return &this -} - -// GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *OrganizationSettingsSamlStrictMode) GetEnabled() bool { - if o == nil || o.Enabled == nil { - var ret bool - return ret - } - return *o.Enabled -} - -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSettingsSamlStrictMode) GetEnabledOk() (*bool, bool) { - if o == nil || o.Enabled == nil { - return nil, false - } - return o.Enabled, true -} - -// HasEnabled returns a boolean if a field has been set. -func (o *OrganizationSettingsSamlStrictMode) HasEnabled() bool { - if o != nil && o.Enabled != nil { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *OrganizationSettingsSamlStrictMode) SetEnabled(v bool) { - o.Enabled = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationSettingsSamlStrictMode) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Enabled != nil { - toSerialize["enabled"] = o.Enabled - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationSettingsSamlStrictMode) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Enabled *bool `json:"enabled,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Enabled = all.Enabled - return nil -} diff --git a/api/v1/datadog/model_organization_subscription.go b/api/v1/datadog/model_organization_subscription.go deleted file mode 100644 index e8d78b1c6db..00000000000 --- a/api/v1/datadog/model_organization_subscription.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// OrganizationSubscription Subscription definition. -type OrganizationSubscription struct { - // The subscription type. Types available are `trial`, `free`, and `pro`. - Type *string `json:"type,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{} -} - -// NewOrganizationSubscription instantiates a new OrganizationSubscription 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 NewOrganizationSubscription() *OrganizationSubscription { - this := OrganizationSubscription{} - return &this -} - -// NewOrganizationSubscriptionWithDefaults instantiates a new OrganizationSubscription 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 NewOrganizationSubscriptionWithDefaults() *OrganizationSubscription { - this := OrganizationSubscription{} - return &this -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *OrganizationSubscription) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationSubscription) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *OrganizationSubscription) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *OrganizationSubscription) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationSubscription) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationSubscription) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_pager_duty_service.go b/api/v1/datadog/model_pager_duty_service.go deleted file mode 100644 index f05a0e088df..00000000000 --- a/api/v1/datadog/model_pager_duty_service.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// PagerDutyService The PagerDuty service that is available for integration with Datadog. -type PagerDutyService struct { - // Your service key in PagerDuty. - ServiceKey string `json:"service_key"` - // Your service name associated with a service key in PagerDuty. - ServiceName string `json:"service_name"` - // 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{} -} - -// NewPagerDutyService instantiates a new PagerDutyService 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 NewPagerDutyService(serviceKey string, serviceName string) *PagerDutyService { - this := PagerDutyService{} - this.ServiceKey = serviceKey - this.ServiceName = serviceName - return &this -} - -// NewPagerDutyServiceWithDefaults instantiates a new PagerDutyService 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 NewPagerDutyServiceWithDefaults() *PagerDutyService { - this := PagerDutyService{} - return &this -} - -// GetServiceKey returns the ServiceKey field value. -func (o *PagerDutyService) GetServiceKey() string { - if o == nil { - var ret string - return ret - } - return o.ServiceKey -} - -// GetServiceKeyOk returns a tuple with the ServiceKey field value -// and a boolean to check if the value has been set. -func (o *PagerDutyService) GetServiceKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ServiceKey, true -} - -// SetServiceKey sets field value. -func (o *PagerDutyService) SetServiceKey(v string) { - o.ServiceKey = v -} - -// GetServiceName returns the ServiceName field value. -func (o *PagerDutyService) GetServiceName() string { - if o == nil { - var ret string - return ret - } - return o.ServiceName -} - -// GetServiceNameOk returns a tuple with the ServiceName field value -// and a boolean to check if the value has been set. -func (o *PagerDutyService) GetServiceNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ServiceName, true -} - -// SetServiceName sets field value. -func (o *PagerDutyService) SetServiceName(v string) { - o.ServiceName = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PagerDutyService) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["service_key"] = o.ServiceKey - toSerialize["service_name"] = o.ServiceName - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PagerDutyService) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ServiceKey *string `json:"service_key"` - ServiceName *string `json:"service_name"` - }{} - all := struct { - ServiceKey string `json:"service_key"` - ServiceName string `json:"service_name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceKey == nil { - return fmt.Errorf("Required field service_key missing") - } - if required.ServiceName == nil { - return fmt.Errorf("Required field service_name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ServiceKey = all.ServiceKey - o.ServiceName = all.ServiceName - return nil -} diff --git a/api/v1/datadog/model_pager_duty_service_key.go b/api/v1/datadog/model_pager_duty_service_key.go deleted file mode 100644 index 408a847cb00..00000000000 --- a/api/v1/datadog/model_pager_duty_service_key.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// PagerDutyServiceKey PagerDuty service object key. -type PagerDutyServiceKey struct { - // Your service key in PagerDuty. - ServiceKey string `json:"service_key"` - // 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{} -} - -// NewPagerDutyServiceKey instantiates a new PagerDutyServiceKey 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 NewPagerDutyServiceKey(serviceKey string) *PagerDutyServiceKey { - this := PagerDutyServiceKey{} - this.ServiceKey = serviceKey - return &this -} - -// NewPagerDutyServiceKeyWithDefaults instantiates a new PagerDutyServiceKey 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 NewPagerDutyServiceKeyWithDefaults() *PagerDutyServiceKey { - this := PagerDutyServiceKey{} - return &this -} - -// GetServiceKey returns the ServiceKey field value. -func (o *PagerDutyServiceKey) GetServiceKey() string { - if o == nil { - var ret string - return ret - } - return o.ServiceKey -} - -// GetServiceKeyOk returns a tuple with the ServiceKey field value -// and a boolean to check if the value has been set. -func (o *PagerDutyServiceKey) GetServiceKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ServiceKey, true -} - -// SetServiceKey sets field value. -func (o *PagerDutyServiceKey) SetServiceKey(v string) { - o.ServiceKey = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PagerDutyServiceKey) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["service_key"] = o.ServiceKey - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PagerDutyServiceKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ServiceKey *string `json:"service_key"` - }{} - all := struct { - ServiceKey string `json:"service_key"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceKey == nil { - return fmt.Errorf("Required field service_key missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ServiceKey = all.ServiceKey - return nil -} diff --git a/api/v1/datadog/model_pager_duty_service_name.go b/api/v1/datadog/model_pager_duty_service_name.go deleted file mode 100644 index ecae71ce9e1..00000000000 --- a/api/v1/datadog/model_pager_duty_service_name.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// PagerDutyServiceName PagerDuty service object name. -type PagerDutyServiceName struct { - // Your service name associated service key in PagerDuty. - ServiceName string `json:"service_name"` - // 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{} -} - -// NewPagerDutyServiceName instantiates a new PagerDutyServiceName 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 NewPagerDutyServiceName(serviceName string) *PagerDutyServiceName { - this := PagerDutyServiceName{} - this.ServiceName = serviceName - return &this -} - -// NewPagerDutyServiceNameWithDefaults instantiates a new PagerDutyServiceName 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 NewPagerDutyServiceNameWithDefaults() *PagerDutyServiceName { - this := PagerDutyServiceName{} - return &this -} - -// GetServiceName returns the ServiceName field value. -func (o *PagerDutyServiceName) GetServiceName() string { - if o == nil { - var ret string - return ret - } - return o.ServiceName -} - -// GetServiceNameOk returns a tuple with the ServiceName field value -// and a boolean to check if the value has been set. -func (o *PagerDutyServiceName) GetServiceNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ServiceName, true -} - -// SetServiceName sets field value. -func (o *PagerDutyServiceName) SetServiceName(v string) { - o.ServiceName = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PagerDutyServiceName) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["service_name"] = o.ServiceName - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PagerDutyServiceName) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ServiceName *string `json:"service_name"` - }{} - all := struct { - ServiceName string `json:"service_name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceName == nil { - return fmt.Errorf("Required field service_name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ServiceName = all.ServiceName - return nil -} diff --git a/api/v1/datadog/model_pagination.go b/api/v1/datadog/model_pagination.go deleted file mode 100644 index 8993857c687..00000000000 --- a/api/v1/datadog/model_pagination.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Pagination Pagination object. -type Pagination struct { - // Total count. - TotalCount *int64 `json:"total_count,omitempty"` - // Total count of elements matched by the filter. - 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{} -} - -// NewPagination instantiates a new Pagination 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 NewPagination() *Pagination { - this := Pagination{} - return &this -} - -// NewPaginationWithDefaults instantiates a new Pagination 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 NewPaginationWithDefaults() *Pagination { - this := Pagination{} - return &this -} - -// GetTotalCount returns the TotalCount field value if set, zero value otherwise. -func (o *Pagination) GetTotalCount() int64 { - if o == nil || o.TotalCount == nil { - var ret int64 - return ret - } - return *o.TotalCount -} - -// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Pagination) GetTotalCountOk() (*int64, bool) { - if o == nil || o.TotalCount == nil { - return nil, false - } - return o.TotalCount, true -} - -// HasTotalCount returns a boolean if a field has been set. -func (o *Pagination) HasTotalCount() bool { - if o != nil && o.TotalCount != nil { - return true - } - - return false -} - -// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. -func (o *Pagination) SetTotalCount(v int64) { - o.TotalCount = &v -} - -// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. -func (o *Pagination) 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 *Pagination) 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 *Pagination) HasTotalFilteredCount() bool { - if o != nil && o.TotalFilteredCount != nil { - return true - } - - return false -} - -// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. -func (o *Pagination) SetTotalFilteredCount(v int64) { - o.TotalFilteredCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Pagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TotalCount != nil { - toSerialize["total_count"] = o.TotalCount - } - if o.TotalFilteredCount != nil { - toSerialize["total_filtered_count"] = o.TotalFilteredCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TotalCount *int64 `json:"total_count,omitempty"` - TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TotalCount = all.TotalCount - o.TotalFilteredCount = all.TotalFilteredCount - return nil -} diff --git a/api/v1/datadog/model_process_query_definition.go b/api/v1/datadog/model_process_query_definition.go deleted file mode 100644 index 6c57c410f1b..00000000000 --- a/api/v1/datadog/model_process_query_definition.go +++ /dev/null @@ -1,220 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ProcessQueryDefinition The process query to use in the widget. -type ProcessQueryDefinition struct { - // List of processes. - FilterBy []string `json:"filter_by,omitempty"` - // Max number of items in the filter list. - Limit *int64 `json:"limit,omitempty"` - // Your chosen metric. - Metric string `json:"metric"` - // Your chosen search term. - SearchBy *string `json:"search_by,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{} -} - -// NewProcessQueryDefinition instantiates a new ProcessQueryDefinition 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 NewProcessQueryDefinition(metric string) *ProcessQueryDefinition { - this := ProcessQueryDefinition{} - this.Metric = metric - return &this -} - -// NewProcessQueryDefinitionWithDefaults instantiates a new ProcessQueryDefinition 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 NewProcessQueryDefinitionWithDefaults() *ProcessQueryDefinition { - this := ProcessQueryDefinition{} - return &this -} - -// GetFilterBy returns the FilterBy field value if set, zero value otherwise. -func (o *ProcessQueryDefinition) GetFilterBy() []string { - if o == nil || o.FilterBy == nil { - var ret []string - return ret - } - return o.FilterBy -} - -// GetFilterByOk returns a tuple with the FilterBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessQueryDefinition) GetFilterByOk() (*[]string, bool) { - if o == nil || o.FilterBy == nil { - return nil, false - } - return &o.FilterBy, true -} - -// HasFilterBy returns a boolean if a field has been set. -func (o *ProcessQueryDefinition) HasFilterBy() bool { - if o != nil && o.FilterBy != nil { - return true - } - - return false -} - -// SetFilterBy gets a reference to the given []string and assigns it to the FilterBy field. -func (o *ProcessQueryDefinition) SetFilterBy(v []string) { - o.FilterBy = v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *ProcessQueryDefinition) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessQueryDefinition) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *ProcessQueryDefinition) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *ProcessQueryDefinition) SetLimit(v int64) { - o.Limit = &v -} - -// GetMetric returns the Metric field value. -func (o *ProcessQueryDefinition) GetMetric() string { - if o == nil { - var ret string - return ret - } - return o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value -// and a boolean to check if the value has been set. -func (o *ProcessQueryDefinition) GetMetricOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Metric, true -} - -// SetMetric sets field value. -func (o *ProcessQueryDefinition) SetMetric(v string) { - o.Metric = v -} - -// GetSearchBy returns the SearchBy field value if set, zero value otherwise. -func (o *ProcessQueryDefinition) GetSearchBy() string { - if o == nil || o.SearchBy == nil { - var ret string - return ret - } - return *o.SearchBy -} - -// GetSearchByOk returns a tuple with the SearchBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessQueryDefinition) GetSearchByOk() (*string, bool) { - if o == nil || o.SearchBy == nil { - return nil, false - } - return o.SearchBy, true -} - -// HasSearchBy returns a boolean if a field has been set. -func (o *ProcessQueryDefinition) HasSearchBy() bool { - if o != nil && o.SearchBy != nil { - return true - } - - return false -} - -// SetSearchBy gets a reference to the given string and assigns it to the SearchBy field. -func (o *ProcessQueryDefinition) SetSearchBy(v string) { - o.SearchBy = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ProcessQueryDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.FilterBy != nil { - toSerialize["filter_by"] = o.FilterBy - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - toSerialize["metric"] = o.Metric - if o.SearchBy != nil { - toSerialize["search_by"] = o.SearchBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Metric *string `json:"metric"` - }{} - all := struct { - FilterBy []string `json:"filter_by,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Metric string `json:"metric"` - SearchBy *string `json:"search_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("Required field metric missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.FilterBy = all.FilterBy - o.Limit = all.Limit - o.Metric = all.Metric - o.SearchBy = all.SearchBy - return nil -} diff --git a/api/v1/datadog/model_query_sort_order.go b/api/v1/datadog/model_query_sort_order.go deleted file mode 100644 index 8074bfd22e3..00000000000 --- a/api/v1/datadog/model_query_sort_order.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// QuerySortOrder Direction of sort. -type QuerySortOrder string - -// List of QuerySortOrder. -const ( - QUERYSORTORDER_ASC QuerySortOrder = "asc" - QUERYSORTORDER_DESC QuerySortOrder = "desc" -) - -var allowedQuerySortOrderEnumValues = []QuerySortOrder{ - QUERYSORTORDER_ASC, - QUERYSORTORDER_DESC, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *QuerySortOrder) GetAllowedValues() []QuerySortOrder { - return allowedQuerySortOrderEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *QuerySortOrder) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = QuerySortOrder(value) - return nil -} - -// NewQuerySortOrderFromValue returns a pointer to a valid QuerySortOrder -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewQuerySortOrderFromValue(v string) (*QuerySortOrder, error) { - ev := QuerySortOrder(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for QuerySortOrder: valid values are %v", v, allowedQuerySortOrderEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v QuerySortOrder) IsValid() bool { - for _, existing := range allowedQuerySortOrderEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to QuerySortOrder value. -func (v QuerySortOrder) Ptr() *QuerySortOrder { - return &v -} - -// NullableQuerySortOrder handles when a null is used for QuerySortOrder. -type NullableQuerySortOrder struct { - value *QuerySortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableQuerySortOrder) Get() *QuerySortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableQuerySortOrder) Set(val *QuerySortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableQuerySortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableQuerySortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableQuerySortOrder initializes the struct as if Set has been called. -func NewNullableQuerySortOrder(val *QuerySortOrder) *NullableQuerySortOrder { - return &NullableQuerySortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableQuerySortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableQuerySortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_query_value_widget_definition.go b/api/v1/datadog/model_query_value_widget_definition.go deleted file mode 100644 index dfda3d8125e..00000000000 --- a/api/v1/datadog/model_query_value_widget_definition.go +++ /dev/null @@ -1,566 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// QueryValueWidgetDefinition Query values display the current value of a given metric, APM, or log query. -type QueryValueWidgetDefinition struct { - // Whether to use auto-scaling or not. - Autoscale *bool `json:"autoscale,omitempty"` - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // Display a unit of your choice on the widget. - CustomUnit *string `json:"custom_unit,omitempty"` - // Number of decimals to show. If not defined, the widget uses the raw value. - Precision *int64 `json:"precision,omitempty"` - // Widget definition. - Requests []QueryValueWidgetRequest `json:"requests"` - // How to align the text on the widget. - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Set a timeseries on the widget background. - TimeseriesBackground *TimeseriesBackground `json:"timeseries_background,omitempty"` - // Title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the query value widget. - Type QueryValueWidgetDefinitionType `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{} -} - -// NewQueryValueWidgetDefinition instantiates a new QueryValueWidgetDefinition 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 NewQueryValueWidgetDefinition(requests []QueryValueWidgetRequest, typeVar QueryValueWidgetDefinitionType) *QueryValueWidgetDefinition { - this := QueryValueWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewQueryValueWidgetDefinitionWithDefaults instantiates a new QueryValueWidgetDefinition 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 NewQueryValueWidgetDefinitionWithDefaults() *QueryValueWidgetDefinition { - this := QueryValueWidgetDefinition{} - var typeVar QueryValueWidgetDefinitionType = QUERYVALUEWIDGETDEFINITIONTYPE_QUERY_VALUE - this.Type = typeVar - return &this -} - -// GetAutoscale returns the Autoscale field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetAutoscale() bool { - if o == nil || o.Autoscale == nil { - var ret bool - return ret - } - return *o.Autoscale -} - -// GetAutoscaleOk returns a tuple with the Autoscale field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetAutoscaleOk() (*bool, bool) { - if o == nil || o.Autoscale == nil { - return nil, false - } - return o.Autoscale, true -} - -// HasAutoscale returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasAutoscale() bool { - if o != nil && o.Autoscale != nil { - return true - } - - return false -} - -// SetAutoscale gets a reference to the given bool and assigns it to the Autoscale field. -func (o *QueryValueWidgetDefinition) SetAutoscale(v bool) { - o.Autoscale = &v -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *QueryValueWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetCustomUnit returns the CustomUnit field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetCustomUnit() string { - if o == nil || o.CustomUnit == nil { - var ret string - return ret - } - return *o.CustomUnit -} - -// GetCustomUnitOk returns a tuple with the CustomUnit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetCustomUnitOk() (*string, bool) { - if o == nil || o.CustomUnit == nil { - return nil, false - } - return o.CustomUnit, true -} - -// HasCustomUnit returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasCustomUnit() bool { - if o != nil && o.CustomUnit != nil { - return true - } - - return false -} - -// SetCustomUnit gets a reference to the given string and assigns it to the CustomUnit field. -func (o *QueryValueWidgetDefinition) SetCustomUnit(v string) { - o.CustomUnit = &v -} - -// GetPrecision returns the Precision field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetPrecision() int64 { - if o == nil || o.Precision == nil { - var ret int64 - return ret - } - return *o.Precision -} - -// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetPrecisionOk() (*int64, bool) { - if o == nil || o.Precision == nil { - return nil, false - } - return o.Precision, true -} - -// HasPrecision returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasPrecision() bool { - if o != nil && o.Precision != nil { - return true - } - - return false -} - -// SetPrecision gets a reference to the given int64 and assigns it to the Precision field. -func (o *QueryValueWidgetDefinition) SetPrecision(v int64) { - o.Precision = &v -} - -// GetRequests returns the Requests field value. -func (o *QueryValueWidgetDefinition) GetRequests() []QueryValueWidgetRequest { - if o == nil { - var ret []QueryValueWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetRequestsOk() (*[]QueryValueWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *QueryValueWidgetDefinition) SetRequests(v []QueryValueWidgetRequest) { - o.Requests = v -} - -// GetTextAlign returns the TextAlign field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetTextAlign() WidgetTextAlign { - if o == nil || o.TextAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TextAlign -} - -// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TextAlign == nil { - return nil, false - } - return o.TextAlign, true -} - -// HasTextAlign returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasTextAlign() bool { - if o != nil && o.TextAlign != nil { - return true - } - - return false -} - -// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. -func (o *QueryValueWidgetDefinition) SetTextAlign(v WidgetTextAlign) { - o.TextAlign = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *QueryValueWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTimeseriesBackground returns the TimeseriesBackground field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetTimeseriesBackground() TimeseriesBackground { - if o == nil || o.TimeseriesBackground == nil { - var ret TimeseriesBackground - return ret - } - return *o.TimeseriesBackground -} - -// GetTimeseriesBackgroundOk returns a tuple with the TimeseriesBackground field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetTimeseriesBackgroundOk() (*TimeseriesBackground, bool) { - if o == nil || o.TimeseriesBackground == nil { - return nil, false - } - return o.TimeseriesBackground, true -} - -// HasTimeseriesBackground returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasTimeseriesBackground() bool { - if o != nil && o.TimeseriesBackground != nil { - return true - } - - return false -} - -// SetTimeseriesBackground gets a reference to the given TimeseriesBackground and assigns it to the TimeseriesBackground field. -func (o *QueryValueWidgetDefinition) SetTimeseriesBackground(v TimeseriesBackground) { - o.TimeseriesBackground = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *QueryValueWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *QueryValueWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *QueryValueWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *QueryValueWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *QueryValueWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *QueryValueWidgetDefinition) GetType() QueryValueWidgetDefinitionType { - if o == nil { - var ret QueryValueWidgetDefinitionType - 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 *QueryValueWidgetDefinition) GetTypeOk() (*QueryValueWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *QueryValueWidgetDefinition) SetType(v QueryValueWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o QueryValueWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Autoscale != nil { - toSerialize["autoscale"] = o.Autoscale - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - if o.CustomUnit != nil { - toSerialize["custom_unit"] = o.CustomUnit - } - if o.Precision != nil { - toSerialize["precision"] = o.Precision - } - toSerialize["requests"] = o.Requests - if o.TextAlign != nil { - toSerialize["text_align"] = o.TextAlign - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.TimeseriesBackground != nil { - toSerialize["timeseries_background"] = o.TimeseriesBackground - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]QueryValueWidgetRequest `json:"requests"` - Type *QueryValueWidgetDefinitionType `json:"type"` - }{} - all := struct { - Autoscale *bool `json:"autoscale,omitempty"` - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - CustomUnit *string `json:"custom_unit,omitempty"` - Precision *int64 `json:"precision,omitempty"` - Requests []QueryValueWidgetRequest `json:"requests"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - TimeseriesBackground *TimeseriesBackground `json:"timeseries_background,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type QueryValueWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TextAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Autoscale = all.Autoscale - o.CustomLinks = all.CustomLinks - o.CustomUnit = all.CustomUnit - o.Precision = all.Precision - o.Requests = all.Requests - o.TextAlign = all.TextAlign - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - if all.TimeseriesBackground != nil && all.TimeseriesBackground.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.TimeseriesBackground = all.TimeseriesBackground - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_query_value_widget_definition_type.go b/api/v1/datadog/model_query_value_widget_definition_type.go deleted file mode 100644 index afa74ec0c91..00000000000 --- a/api/v1/datadog/model_query_value_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// QueryValueWidgetDefinitionType Type of the query value widget. -type QueryValueWidgetDefinitionType string - -// List of QueryValueWidgetDefinitionType. -const ( - QUERYVALUEWIDGETDEFINITIONTYPE_QUERY_VALUE QueryValueWidgetDefinitionType = "query_value" -) - -var allowedQueryValueWidgetDefinitionTypeEnumValues = []QueryValueWidgetDefinitionType{ - QUERYVALUEWIDGETDEFINITIONTYPE_QUERY_VALUE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *QueryValueWidgetDefinitionType) GetAllowedValues() []QueryValueWidgetDefinitionType { - return allowedQueryValueWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *QueryValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = QueryValueWidgetDefinitionType(value) - return nil -} - -// NewQueryValueWidgetDefinitionTypeFromValue returns a pointer to a valid QueryValueWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewQueryValueWidgetDefinitionTypeFromValue(v string) (*QueryValueWidgetDefinitionType, error) { - ev := QueryValueWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for QueryValueWidgetDefinitionType: valid values are %v", v, allowedQueryValueWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v QueryValueWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedQueryValueWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to QueryValueWidgetDefinitionType value. -func (v QueryValueWidgetDefinitionType) Ptr() *QueryValueWidgetDefinitionType { - return &v -} - -// NullableQueryValueWidgetDefinitionType handles when a null is used for QueryValueWidgetDefinitionType. -type NullableQueryValueWidgetDefinitionType struct { - value *QueryValueWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableQueryValueWidgetDefinitionType) Get() *QueryValueWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableQueryValueWidgetDefinitionType) Set(val *QueryValueWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableQueryValueWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableQueryValueWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableQueryValueWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableQueryValueWidgetDefinitionType(val *QueryValueWidgetDefinitionType) *NullableQueryValueWidgetDefinitionType { - return &NullableQueryValueWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableQueryValueWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableQueryValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_query_value_widget_request.go b/api/v1/datadog/model_query_value_widget_request.go deleted file mode 100644 index cbe23d45554..00000000000 --- a/api/v1/datadog/model_query_value_widget_request.go +++ /dev/null @@ -1,727 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// QueryValueWidgetRequest Updated query value widget. -type QueryValueWidgetRequest struct { - // Aggregator used for the request. - Aggregator *WidgetAggregator `json:"aggregator,omitempty"` - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The log query. - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - // List of conditional formats. - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // TODO. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,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{} -} - -// NewQueryValueWidgetRequest instantiates a new QueryValueWidgetRequest 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 NewQueryValueWidgetRequest() *QueryValueWidgetRequest { - this := QueryValueWidgetRequest{} - return &this -} - -// NewQueryValueWidgetRequestWithDefaults instantiates a new QueryValueWidgetRequest 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 NewQueryValueWidgetRequestWithDefaults() *QueryValueWidgetRequest { - this := QueryValueWidgetRequest{} - return &this -} - -// GetAggregator returns the Aggregator field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetAggregator() WidgetAggregator { - if o == nil || o.Aggregator == nil { - var ret WidgetAggregator - return ret - } - return *o.Aggregator -} - -// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetAggregatorOk() (*WidgetAggregator, bool) { - if o == nil || o.Aggregator == nil { - return nil, false - } - return o.Aggregator, true -} - -// HasAggregator returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasAggregator() bool { - if o != nil && o.Aggregator != nil { - return true - } - - return false -} - -// SetAggregator gets a reference to the given WidgetAggregator and assigns it to the Aggregator field. -func (o *QueryValueWidgetRequest) SetAggregator(v WidgetAggregator) { - o.Aggregator = &v -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *QueryValueWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetAuditQuery() LogQueryDefinition { - if o == nil || o.AuditQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.AuditQuery -} - -// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.AuditQuery == nil { - return nil, false - } - return o.AuditQuery, true -} - -// HasAuditQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasAuditQuery() bool { - if o != nil && o.AuditQuery != nil { - return true - } - - return false -} - -// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. -func (o *QueryValueWidgetRequest) SetAuditQuery(v LogQueryDefinition) { - o.AuditQuery = &v -} - -// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetConditionalFormats() []WidgetConditionalFormat { - if o == nil || o.ConditionalFormats == nil { - var ret []WidgetConditionalFormat - return ret - } - return o.ConditionalFormats -} - -// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { - if o == nil || o.ConditionalFormats == nil { - return nil, false - } - return &o.ConditionalFormats, true -} - -// HasConditionalFormats returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasConditionalFormats() bool { - if o != nil && o.ConditionalFormats != nil { - return true - } - - return false -} - -// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. -func (o *QueryValueWidgetRequest) SetConditionalFormats(v []WidgetConditionalFormat) { - o.ConditionalFormats = v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *QueryValueWidgetRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *QueryValueWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *QueryValueWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *QueryValueWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *QueryValueWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *QueryValueWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *QueryValueWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *QueryValueWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *QueryValueWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *QueryValueWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *QueryValueWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *QueryValueWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *QueryValueWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *QueryValueWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o QueryValueWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregator != nil { - toSerialize["aggregator"] = o.Aggregator - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.AuditQuery != nil { - toSerialize["audit_query"] = o.AuditQuery - } - if o.ConditionalFormats != nil { - toSerialize["conditional_formats"] = o.ConditionalFormats - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *QueryValueWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregator *WidgetAggregator `json:"aggregator,omitempty"` - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - Formulas []WidgetFormula `json:"formulas,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.AuditQuery = all.AuditQuery - o.ConditionalFormats = all.ConditionalFormats - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - o.Formulas = all.Formulas - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - return nil -} diff --git a/api/v1/datadog/model_response_meta_attributes.go b/api/v1/datadog/model_response_meta_attributes.go deleted file mode 100644 index 40cc83c63a6..00000000000 --- a/api/v1/datadog/model_response_meta_attributes.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ResponseMetaAttributes Object describing meta attributes of response. -type ResponseMetaAttributes struct { - // Pagination object. - Page *Pagination `json:"page,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{} -} - -// NewResponseMetaAttributes instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributes() *ResponseMetaAttributes { - this := ResponseMetaAttributes{} - return &this -} - -// NewResponseMetaAttributesWithDefaults instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributesWithDefaults() *ResponseMetaAttributes { - this := ResponseMetaAttributes{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *ResponseMetaAttributes) GetPage() Pagination { - if o == nil || o.Page == nil { - var ret Pagination - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ResponseMetaAttributes) GetPageOk() (*Pagination, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *ResponseMetaAttributes) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given Pagination and assigns it to the Page field. -func (o *ResponseMetaAttributes) SetPage(v Pagination) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ResponseMetaAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *Pagination `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v1/datadog/model_scatter_plot_request.go b/api/v1/datadog/model_scatter_plot_request.go deleted file mode 100644 index 1f0e808beaa..00000000000 --- a/api/v1/datadog/model_scatter_plot_request.go +++ /dev/null @@ -1,517 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ScatterPlotRequest Updated scatter plot. -type ScatterPlotRequest struct { - // Aggregator used for the request. - Aggregator *ScatterplotWidgetAggregator `json:"aggregator,omitempty"` - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Query definition. - Q *string `json:"q,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,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{} -} - -// NewScatterPlotRequest instantiates a new ScatterPlotRequest 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 NewScatterPlotRequest() *ScatterPlotRequest { - this := ScatterPlotRequest{} - return &this -} - -// NewScatterPlotRequestWithDefaults instantiates a new ScatterPlotRequest 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 NewScatterPlotRequestWithDefaults() *ScatterPlotRequest { - this := ScatterPlotRequest{} - return &this -} - -// GetAggregator returns the Aggregator field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetAggregator() ScatterplotWidgetAggregator { - if o == nil || o.Aggregator == nil { - var ret ScatterplotWidgetAggregator - return ret - } - return *o.Aggregator -} - -// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetAggregatorOk() (*ScatterplotWidgetAggregator, bool) { - if o == nil || o.Aggregator == nil { - return nil, false - } - return o.Aggregator, true -} - -// HasAggregator returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasAggregator() bool { - if o != nil && o.Aggregator != nil { - return true - } - - return false -} - -// SetAggregator gets a reference to the given ScatterplotWidgetAggregator and assigns it to the Aggregator field. -func (o *ScatterPlotRequest) SetAggregator(v ScatterplotWidgetAggregator) { - o.Aggregator = &v -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *ScatterPlotRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *ScatterPlotRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *ScatterPlotRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *ScatterPlotRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *ScatterPlotRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *ScatterPlotRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *ScatterPlotRequest) SetQ(v string) { - o.Q = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *ScatterPlotRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *ScatterPlotRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *ScatterPlotRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *ScatterPlotRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ScatterPlotRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregator != nil { - toSerialize["aggregator"] = o.Aggregator - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ScatterPlotRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregator *ScatterplotWidgetAggregator `json:"aggregator,omitempty"` - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - return nil -} diff --git a/api/v1/datadog/model_scatter_plot_widget_definition.go b/api/v1/datadog/model_scatter_plot_widget_definition.go deleted file mode 100644 index bc0b5594d94..00000000000 --- a/api/v1/datadog/model_scatter_plot_widget_definition.go +++ /dev/null @@ -1,494 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ScatterPlotWidgetDefinition The scatter plot visualization allows you to graph a chosen scope over two different metrics with their respective aggregation. -type ScatterPlotWidgetDefinition struct { - // List of groups used for colors. - ColorByGroups []string `json:"color_by_groups,omitempty"` - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // Widget definition. - Requests ScatterPlotWidgetDefinitionRequests `json:"requests"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the scatter plot widget. - Type ScatterPlotWidgetDefinitionType `json:"type"` - // Axis controls for the widget. - Xaxis *WidgetAxis `json:"xaxis,omitempty"` - // Axis controls for the widget. - Yaxis *WidgetAxis `json:"yaxis,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{} -} - -// NewScatterPlotWidgetDefinition instantiates a new ScatterPlotWidgetDefinition 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 NewScatterPlotWidgetDefinition(requests ScatterPlotWidgetDefinitionRequests, typeVar ScatterPlotWidgetDefinitionType) *ScatterPlotWidgetDefinition { - this := ScatterPlotWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewScatterPlotWidgetDefinitionWithDefaults instantiates a new ScatterPlotWidgetDefinition 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 NewScatterPlotWidgetDefinitionWithDefaults() *ScatterPlotWidgetDefinition { - this := ScatterPlotWidgetDefinition{} - var typeVar ScatterPlotWidgetDefinitionType = SCATTERPLOTWIDGETDEFINITIONTYPE_SCATTERPLOT - this.Type = typeVar - return &this -} - -// GetColorByGroups returns the ColorByGroups field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetColorByGroups() []string { - if o == nil || o.ColorByGroups == nil { - var ret []string - return ret - } - return o.ColorByGroups -} - -// GetColorByGroupsOk returns a tuple with the ColorByGroups field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetColorByGroupsOk() (*[]string, bool) { - if o == nil || o.ColorByGroups == nil { - return nil, false - } - return &o.ColorByGroups, true -} - -// HasColorByGroups returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasColorByGroups() bool { - if o != nil && o.ColorByGroups != nil { - return true - } - - return false -} - -// SetColorByGroups gets a reference to the given []string and assigns it to the ColorByGroups field. -func (o *ScatterPlotWidgetDefinition) SetColorByGroups(v []string) { - o.ColorByGroups = v -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *ScatterPlotWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetRequests returns the Requests field value. -func (o *ScatterPlotWidgetDefinition) GetRequests() ScatterPlotWidgetDefinitionRequests { - if o == nil { - var ret ScatterPlotWidgetDefinitionRequests - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetRequestsOk() (*ScatterPlotWidgetDefinitionRequests, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *ScatterPlotWidgetDefinition) SetRequests(v ScatterPlotWidgetDefinitionRequests) { - o.Requests = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *ScatterPlotWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *ScatterPlotWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *ScatterPlotWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *ScatterPlotWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *ScatterPlotWidgetDefinition) GetType() ScatterPlotWidgetDefinitionType { - if o == nil { - var ret ScatterPlotWidgetDefinitionType - 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 *ScatterPlotWidgetDefinition) GetTypeOk() (*ScatterPlotWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ScatterPlotWidgetDefinition) SetType(v ScatterPlotWidgetDefinitionType) { - o.Type = v -} - -// GetXaxis returns the Xaxis field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetXaxis() WidgetAxis { - if o == nil || o.Xaxis == nil { - var ret WidgetAxis - return ret - } - return *o.Xaxis -} - -// GetXaxisOk returns a tuple with the Xaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetXaxisOk() (*WidgetAxis, bool) { - if o == nil || o.Xaxis == nil { - return nil, false - } - return o.Xaxis, true -} - -// HasXaxis returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasXaxis() bool { - if o != nil && o.Xaxis != nil { - return true - } - - return false -} - -// SetXaxis gets a reference to the given WidgetAxis and assigns it to the Xaxis field. -func (o *ScatterPlotWidgetDefinition) SetXaxis(v WidgetAxis) { - o.Xaxis = &v -} - -// GetYaxis returns the Yaxis field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinition) GetYaxis() WidgetAxis { - if o == nil || o.Yaxis == nil { - var ret WidgetAxis - return ret - } - return *o.Yaxis -} - -// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinition) GetYaxisOk() (*WidgetAxis, bool) { - if o == nil || o.Yaxis == nil { - return nil, false - } - return o.Yaxis, true -} - -// HasYaxis returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinition) HasYaxis() bool { - if o != nil && o.Yaxis != nil { - return true - } - - return false -} - -// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. -func (o *ScatterPlotWidgetDefinition) SetYaxis(v WidgetAxis) { - o.Yaxis = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ScatterPlotWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ColorByGroups != nil { - toSerialize["color_by_groups"] = o.ColorByGroups - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - toSerialize["requests"] = o.Requests - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - if o.Xaxis != nil { - toSerialize["xaxis"] = o.Xaxis - } - if o.Yaxis != nil { - toSerialize["yaxis"] = o.Yaxis - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *ScatterPlotWidgetDefinitionRequests `json:"requests"` - Type *ScatterPlotWidgetDefinitionType `json:"type"` - }{} - all := struct { - ColorByGroups []string `json:"color_by_groups,omitempty"` - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests ScatterPlotWidgetDefinitionRequests `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ScatterPlotWidgetDefinitionType `json:"type"` - Xaxis *WidgetAxis `json:"xaxis,omitempty"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ColorByGroups = all.ColorByGroups - o.CustomLinks = all.CustomLinks - if all.Requests.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Requests = all.Requests - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Xaxis = all.Xaxis - if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Yaxis = all.Yaxis - return nil -} diff --git a/api/v1/datadog/model_scatter_plot_widget_definition_requests.go b/api/v1/datadog/model_scatter_plot_widget_definition_requests.go deleted file mode 100644 index 3a19a3ab7e5..00000000000 --- a/api/v1/datadog/model_scatter_plot_widget_definition_requests.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ScatterPlotWidgetDefinitionRequests Widget definition. -type ScatterPlotWidgetDefinitionRequests struct { - // Scatterplot request containing formulas and functions. - Table *ScatterplotTableRequest `json:"table,omitempty"` - // Updated scatter plot. - X *ScatterPlotRequest `json:"x,omitempty"` - // Updated scatter plot. - Y *ScatterPlotRequest `json:"y,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{} -} - -// NewScatterPlotWidgetDefinitionRequests instantiates a new ScatterPlotWidgetDefinitionRequests 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 NewScatterPlotWidgetDefinitionRequests() *ScatterPlotWidgetDefinitionRequests { - this := ScatterPlotWidgetDefinitionRequests{} - return &this -} - -// NewScatterPlotWidgetDefinitionRequestsWithDefaults instantiates a new ScatterPlotWidgetDefinitionRequests 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 NewScatterPlotWidgetDefinitionRequestsWithDefaults() *ScatterPlotWidgetDefinitionRequests { - this := ScatterPlotWidgetDefinitionRequests{} - return &this -} - -// GetTable returns the Table field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinitionRequests) GetTable() ScatterplotTableRequest { - if o == nil || o.Table == nil { - var ret ScatterplotTableRequest - return ret - } - return *o.Table -} - -// GetTableOk returns a tuple with the Table field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinitionRequests) GetTableOk() (*ScatterplotTableRequest, bool) { - if o == nil || o.Table == nil { - return nil, false - } - return o.Table, true -} - -// HasTable returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinitionRequests) HasTable() bool { - if o != nil && o.Table != nil { - return true - } - - return false -} - -// SetTable gets a reference to the given ScatterplotTableRequest and assigns it to the Table field. -func (o *ScatterPlotWidgetDefinitionRequests) SetTable(v ScatterplotTableRequest) { - o.Table = &v -} - -// GetX returns the X field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinitionRequests) GetX() ScatterPlotRequest { - if o == nil || o.X == nil { - var ret ScatterPlotRequest - return ret - } - return *o.X -} - -// GetXOk returns a tuple with the X field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinitionRequests) GetXOk() (*ScatterPlotRequest, bool) { - if o == nil || o.X == nil { - return nil, false - } - return o.X, true -} - -// HasX returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinitionRequests) HasX() bool { - if o != nil && o.X != nil { - return true - } - - return false -} - -// SetX gets a reference to the given ScatterPlotRequest and assigns it to the X field. -func (o *ScatterPlotWidgetDefinitionRequests) SetX(v ScatterPlotRequest) { - o.X = &v -} - -// GetY returns the Y field value if set, zero value otherwise. -func (o *ScatterPlotWidgetDefinitionRequests) GetY() ScatterPlotRequest { - if o == nil || o.Y == nil { - var ret ScatterPlotRequest - return ret - } - return *o.Y -} - -// GetYOk returns a tuple with the Y field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterPlotWidgetDefinitionRequests) GetYOk() (*ScatterPlotRequest, bool) { - if o == nil || o.Y == nil { - return nil, false - } - return o.Y, true -} - -// HasY returns a boolean if a field has been set. -func (o *ScatterPlotWidgetDefinitionRequests) HasY() bool { - if o != nil && o.Y != nil { - return true - } - - return false -} - -// SetY gets a reference to the given ScatterPlotRequest and assigns it to the Y field. -func (o *ScatterPlotWidgetDefinitionRequests) SetY(v ScatterPlotRequest) { - o.Y = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ScatterPlotWidgetDefinitionRequests) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Table != nil { - toSerialize["table"] = o.Table - } - if o.X != nil { - toSerialize["x"] = o.X - } - if o.Y != nil { - toSerialize["y"] = o.Y - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ScatterPlotWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Table *ScatterplotTableRequest `json:"table,omitempty"` - X *ScatterPlotRequest `json:"x,omitempty"` - Y *ScatterPlotRequest `json:"y,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Table != nil && all.Table.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Table = all.Table - if all.X != nil && all.X.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.X = all.X - if all.Y != nil && all.Y.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Y = all.Y - return nil -} diff --git a/api/v1/datadog/model_scatter_plot_widget_definition_type.go b/api/v1/datadog/model_scatter_plot_widget_definition_type.go deleted file mode 100644 index 93ec5932477..00000000000 --- a/api/v1/datadog/model_scatter_plot_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ScatterPlotWidgetDefinitionType Type of the scatter plot widget. -type ScatterPlotWidgetDefinitionType string - -// List of ScatterPlotWidgetDefinitionType. -const ( - SCATTERPLOTWIDGETDEFINITIONTYPE_SCATTERPLOT ScatterPlotWidgetDefinitionType = "scatterplot" -) - -var allowedScatterPlotWidgetDefinitionTypeEnumValues = []ScatterPlotWidgetDefinitionType{ - SCATTERPLOTWIDGETDEFINITIONTYPE_SCATTERPLOT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ScatterPlotWidgetDefinitionType) GetAllowedValues() []ScatterPlotWidgetDefinitionType { - return allowedScatterPlotWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ScatterPlotWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ScatterPlotWidgetDefinitionType(value) - return nil -} - -// NewScatterPlotWidgetDefinitionTypeFromValue returns a pointer to a valid ScatterPlotWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewScatterPlotWidgetDefinitionTypeFromValue(v string) (*ScatterPlotWidgetDefinitionType, error) { - ev := ScatterPlotWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ScatterPlotWidgetDefinitionType: valid values are %v", v, allowedScatterPlotWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ScatterPlotWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedScatterPlotWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ScatterPlotWidgetDefinitionType value. -func (v ScatterPlotWidgetDefinitionType) Ptr() *ScatterPlotWidgetDefinitionType { - return &v -} - -// NullableScatterPlotWidgetDefinitionType handles when a null is used for ScatterPlotWidgetDefinitionType. -type NullableScatterPlotWidgetDefinitionType struct { - value *ScatterPlotWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableScatterPlotWidgetDefinitionType) Get() *ScatterPlotWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScatterPlotWidgetDefinitionType) Set(val *ScatterPlotWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScatterPlotWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScatterPlotWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScatterPlotWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableScatterPlotWidgetDefinitionType(val *ScatterPlotWidgetDefinitionType) *NullableScatterPlotWidgetDefinitionType { - return &NullableScatterPlotWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScatterPlotWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScatterPlotWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_scatterplot_dimension.go b/api/v1/datadog/model_scatterplot_dimension.go deleted file mode 100644 index 29adb0a1ddc..00000000000 --- a/api/v1/datadog/model_scatterplot_dimension.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ScatterplotDimension Dimension of the Scatterplot. -type ScatterplotDimension string - -// List of ScatterplotDimension. -const ( - SCATTERPLOTDIMENSION_X ScatterplotDimension = "x" - SCATTERPLOTDIMENSION_Y ScatterplotDimension = "y" - SCATTERPLOTDIMENSION_RADIUS ScatterplotDimension = "radius" - SCATTERPLOTDIMENSION_COLOR ScatterplotDimension = "color" -) - -var allowedScatterplotDimensionEnumValues = []ScatterplotDimension{ - SCATTERPLOTDIMENSION_X, - SCATTERPLOTDIMENSION_Y, - SCATTERPLOTDIMENSION_RADIUS, - SCATTERPLOTDIMENSION_COLOR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ScatterplotDimension) GetAllowedValues() []ScatterplotDimension { - return allowedScatterplotDimensionEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ScatterplotDimension) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ScatterplotDimension(value) - return nil -} - -// NewScatterplotDimensionFromValue returns a pointer to a valid ScatterplotDimension -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewScatterplotDimensionFromValue(v string) (*ScatterplotDimension, error) { - ev := ScatterplotDimension(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ScatterplotDimension: valid values are %v", v, allowedScatterplotDimensionEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ScatterplotDimension) IsValid() bool { - for _, existing := range allowedScatterplotDimensionEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ScatterplotDimension value. -func (v ScatterplotDimension) Ptr() *ScatterplotDimension { - return &v -} - -// NullableScatterplotDimension handles when a null is used for ScatterplotDimension. -type NullableScatterplotDimension struct { - value *ScatterplotDimension - isSet bool -} - -// Get returns the associated value. -func (v NullableScatterplotDimension) Get() *ScatterplotDimension { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScatterplotDimension) Set(val *ScatterplotDimension) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScatterplotDimension) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScatterplotDimension) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScatterplotDimension initializes the struct as if Set has been called. -func NewNullableScatterplotDimension(val *ScatterplotDimension) *NullableScatterplotDimension { - return &NullableScatterplotDimension{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScatterplotDimension) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScatterplotDimension) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_scatterplot_table_request.go b/api/v1/datadog/model_scatterplot_table_request.go deleted file mode 100644 index 573ddd43a9f..00000000000 --- a/api/v1/datadog/model_scatterplot_table_request.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ScatterplotTableRequest Scatterplot request containing formulas and functions. -type ScatterplotTableRequest struct { - // List of Scatterplot formulas that operate on queries. - Formulas []ScatterplotWidgetFormula `json:"formulas,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,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{} -} - -// NewScatterplotTableRequest instantiates a new ScatterplotTableRequest 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 NewScatterplotTableRequest() *ScatterplotTableRequest { - this := ScatterplotTableRequest{} - return &this -} - -// NewScatterplotTableRequestWithDefaults instantiates a new ScatterplotTableRequest 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 NewScatterplotTableRequestWithDefaults() *ScatterplotTableRequest { - this := ScatterplotTableRequest{} - return &this -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *ScatterplotTableRequest) GetFormulas() []ScatterplotWidgetFormula { - if o == nil || o.Formulas == nil { - var ret []ScatterplotWidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterplotTableRequest) GetFormulasOk() (*[]ScatterplotWidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *ScatterplotTableRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []ScatterplotWidgetFormula and assigns it to the Formulas field. -func (o *ScatterplotTableRequest) SetFormulas(v []ScatterplotWidgetFormula) { - o.Formulas = v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *ScatterplotTableRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterplotTableRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *ScatterplotTableRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *ScatterplotTableRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *ScatterplotTableRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterplotTableRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *ScatterplotTableRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *ScatterplotTableRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ScatterplotTableRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ScatterplotTableRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Formulas []ScatterplotWidgetFormula `json:"formulas,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Formulas = all.Formulas - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - return nil -} diff --git a/api/v1/datadog/model_scatterplot_widget_aggregator.go b/api/v1/datadog/model_scatterplot_widget_aggregator.go deleted file mode 100644 index b90b949d59a..00000000000 --- a/api/v1/datadog/model_scatterplot_widget_aggregator.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ScatterplotWidgetAggregator Aggregator used for the request. -type ScatterplotWidgetAggregator string - -// List of ScatterplotWidgetAggregator. -const ( - SCATTERPLOTWIDGETAGGREGATOR_AVERAGE ScatterplotWidgetAggregator = "avg" - SCATTERPLOTWIDGETAGGREGATOR_LAST ScatterplotWidgetAggregator = "last" - SCATTERPLOTWIDGETAGGREGATOR_MAXIMUM ScatterplotWidgetAggregator = "max" - SCATTERPLOTWIDGETAGGREGATOR_MINIMUM ScatterplotWidgetAggregator = "min" - SCATTERPLOTWIDGETAGGREGATOR_SUM ScatterplotWidgetAggregator = "sum" -) - -var allowedScatterplotWidgetAggregatorEnumValues = []ScatterplotWidgetAggregator{ - SCATTERPLOTWIDGETAGGREGATOR_AVERAGE, - SCATTERPLOTWIDGETAGGREGATOR_LAST, - SCATTERPLOTWIDGETAGGREGATOR_MAXIMUM, - SCATTERPLOTWIDGETAGGREGATOR_MINIMUM, - SCATTERPLOTWIDGETAGGREGATOR_SUM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ScatterplotWidgetAggregator) GetAllowedValues() []ScatterplotWidgetAggregator { - return allowedScatterplotWidgetAggregatorEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ScatterplotWidgetAggregator) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ScatterplotWidgetAggregator(value) - return nil -} - -// NewScatterplotWidgetAggregatorFromValue returns a pointer to a valid ScatterplotWidgetAggregator -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewScatterplotWidgetAggregatorFromValue(v string) (*ScatterplotWidgetAggregator, error) { - ev := ScatterplotWidgetAggregator(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ScatterplotWidgetAggregator: valid values are %v", v, allowedScatterplotWidgetAggregatorEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ScatterplotWidgetAggregator) IsValid() bool { - for _, existing := range allowedScatterplotWidgetAggregatorEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ScatterplotWidgetAggregator value. -func (v ScatterplotWidgetAggregator) Ptr() *ScatterplotWidgetAggregator { - return &v -} - -// NullableScatterplotWidgetAggregator handles when a null is used for ScatterplotWidgetAggregator. -type NullableScatterplotWidgetAggregator struct { - value *ScatterplotWidgetAggregator - isSet bool -} - -// Get returns the associated value. -func (v NullableScatterplotWidgetAggregator) Get() *ScatterplotWidgetAggregator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableScatterplotWidgetAggregator) Set(val *ScatterplotWidgetAggregator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableScatterplotWidgetAggregator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableScatterplotWidgetAggregator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableScatterplotWidgetAggregator initializes the struct as if Set has been called. -func NewNullableScatterplotWidgetAggregator(val *ScatterplotWidgetAggregator) *NullableScatterplotWidgetAggregator { - return &NullableScatterplotWidgetAggregator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableScatterplotWidgetAggregator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableScatterplotWidgetAggregator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_scatterplot_widget_formula.go b/api/v1/datadog/model_scatterplot_widget_formula.go deleted file mode 100644 index 259e213ef10..00000000000 --- a/api/v1/datadog/model_scatterplot_widget_formula.go +++ /dev/null @@ -1,183 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ScatterplotWidgetFormula Formula to be used in a Scatterplot widget query. -type ScatterplotWidgetFormula struct { - // Expression alias. - Alias *string `json:"alias,omitempty"` - // Dimension of the Scatterplot. - Dimension ScatterplotDimension `json:"dimension"` - // String expression built from queries, formulas, and functions. - Formula string `json:"formula"` - // 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{} -} - -// NewScatterplotWidgetFormula instantiates a new ScatterplotWidgetFormula 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 NewScatterplotWidgetFormula(dimension ScatterplotDimension, formula string) *ScatterplotWidgetFormula { - this := ScatterplotWidgetFormula{} - this.Dimension = dimension - this.Formula = formula - return &this -} - -// NewScatterplotWidgetFormulaWithDefaults instantiates a new ScatterplotWidgetFormula 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 NewScatterplotWidgetFormulaWithDefaults() *ScatterplotWidgetFormula { - this := ScatterplotWidgetFormula{} - return &this -} - -// GetAlias returns the Alias field value if set, zero value otherwise. -func (o *ScatterplotWidgetFormula) GetAlias() string { - if o == nil || o.Alias == nil { - var ret string - return ret - } - return *o.Alias -} - -// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScatterplotWidgetFormula) GetAliasOk() (*string, bool) { - if o == nil || o.Alias == nil { - return nil, false - } - return o.Alias, true -} - -// HasAlias returns a boolean if a field has been set. -func (o *ScatterplotWidgetFormula) HasAlias() bool { - if o != nil && o.Alias != nil { - return true - } - - return false -} - -// SetAlias gets a reference to the given string and assigns it to the Alias field. -func (o *ScatterplotWidgetFormula) SetAlias(v string) { - o.Alias = &v -} - -// GetDimension returns the Dimension field value. -func (o *ScatterplotWidgetFormula) GetDimension() ScatterplotDimension { - if o == nil { - var ret ScatterplotDimension - return ret - } - return o.Dimension -} - -// GetDimensionOk returns a tuple with the Dimension field value -// and a boolean to check if the value has been set. -func (o *ScatterplotWidgetFormula) GetDimensionOk() (*ScatterplotDimension, bool) { - if o == nil { - return nil, false - } - return &o.Dimension, true -} - -// SetDimension sets field value. -func (o *ScatterplotWidgetFormula) SetDimension(v ScatterplotDimension) { - o.Dimension = v -} - -// GetFormula returns the Formula field value. -func (o *ScatterplotWidgetFormula) GetFormula() string { - if o == nil { - var ret string - return ret - } - return o.Formula -} - -// GetFormulaOk returns a tuple with the Formula field value -// and a boolean to check if the value has been set. -func (o *ScatterplotWidgetFormula) GetFormulaOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Formula, true -} - -// SetFormula sets field value. -func (o *ScatterplotWidgetFormula) SetFormula(v string) { - o.Formula = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ScatterplotWidgetFormula) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Alias != nil { - toSerialize["alias"] = o.Alias - } - toSerialize["dimension"] = o.Dimension - toSerialize["formula"] = o.Formula - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ScatterplotWidgetFormula) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Dimension *ScatterplotDimension `json:"dimension"` - Formula *string `json:"formula"` - }{} - all := struct { - Alias *string `json:"alias,omitempty"` - Dimension ScatterplotDimension `json:"dimension"` - Formula string `json:"formula"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Dimension == nil { - return fmt.Errorf("Required field dimension missing") - } - if required.Formula == nil { - return fmt.Errorf("Required field formula missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Dimension; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Alias = all.Alias - o.Dimension = all.Dimension - o.Formula = all.Formula - return nil -} diff --git a/api/v1/datadog/model_search_slo_response.go b/api/v1/datadog/model_search_slo_response.go deleted file mode 100644 index 047270cdf3c..00000000000 --- a/api/v1/datadog/model_search_slo_response.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponse A search SLO response containing results from the search query. -type SearchSLOResponse struct { - // Data from search SLO response. - Data *SearchSLOResponseData `json:"data,omitempty"` - // Pagination links. - Links *SearchSLOResponseLinks `json:"links,omitempty"` - // Searches metadata returned by the API. - Meta *SearchSLOResponseMeta `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{} -} - -// NewSearchSLOResponse instantiates a new SearchSLOResponse 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 NewSearchSLOResponse() *SearchSLOResponse { - this := SearchSLOResponse{} - return &this -} - -// NewSearchSLOResponseWithDefaults instantiates a new SearchSLOResponse 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 NewSearchSLOResponseWithDefaults() *SearchSLOResponse { - this := SearchSLOResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SearchSLOResponse) GetData() SearchSLOResponseData { - if o == nil || o.Data == nil { - var ret SearchSLOResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponse) GetDataOk() (*SearchSLOResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SearchSLOResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SearchSLOResponseData and assigns it to the Data field. -func (o *SearchSLOResponse) SetData(v SearchSLOResponseData) { - o.Data = &v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *SearchSLOResponse) GetLinks() SearchSLOResponseLinks { - if o == nil || o.Links == nil { - var ret SearchSLOResponseLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponse) GetLinksOk() (*SearchSLOResponseLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *SearchSLOResponse) HasLinks() bool { - if o != nil && o.Links != nil { - return true - } - - return false -} - -// SetLinks gets a reference to the given SearchSLOResponseLinks and assigns it to the Links field. -func (o *SearchSLOResponse) SetLinks(v SearchSLOResponseLinks) { - o.Links = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *SearchSLOResponse) GetMeta() SearchSLOResponseMeta { - if o == nil || o.Meta == nil { - var ret SearchSLOResponseMeta - 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 *SearchSLOResponse) GetMetaOk() (*SearchSLOResponseMeta, 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 *SearchSLOResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given SearchSLOResponseMeta and assigns it to the Meta field. -func (o *SearchSLOResponse) SetMeta(v SearchSLOResponseMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SearchSLOResponseData `json:"data,omitempty"` - Links *SearchSLOResponseLinks `json:"links,omitempty"` - Meta *SearchSLOResponseMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Links = all.Links - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_data.go b/api/v1/datadog/model_search_slo_response_data.go deleted file mode 100644 index 7b80c224ef7..00000000000 --- a/api/v1/datadog/model_search_slo_response_data.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseData Data from search SLO response. -type SearchSLOResponseData struct { - // Attributes - Attributes *SearchSLOResponseDataAttributes `json:"attributes,omitempty"` - // Type of service level objective result. - Type *string `json:"type,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{} -} - -// NewSearchSLOResponseData instantiates a new SearchSLOResponseData 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 NewSearchSLOResponseData() *SearchSLOResponseData { - this := SearchSLOResponseData{} - return &this -} - -// NewSearchSLOResponseDataWithDefaults instantiates a new SearchSLOResponseData 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 NewSearchSLOResponseDataWithDefaults() *SearchSLOResponseData { - this := SearchSLOResponseData{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SearchSLOResponseData) GetAttributes() SearchSLOResponseDataAttributes { - if o == nil || o.Attributes == nil { - var ret SearchSLOResponseDataAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseData) GetAttributesOk() (*SearchSLOResponseDataAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SearchSLOResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SearchSLOResponseDataAttributes and assigns it to the Attributes field. -func (o *SearchSLOResponseData) SetAttributes(v SearchSLOResponseDataAttributes) { - o.Attributes = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SearchSLOResponseData) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseData) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SearchSLOResponseData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *SearchSLOResponseData) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *SearchSLOResponseDataAttributes `json:"attributes,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes.go b/api/v1/datadog/model_search_slo_response_data_attributes.go deleted file mode 100644 index 5da67c4bf90..00000000000 --- a/api/v1/datadog/model_search_slo_response_data_attributes.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseDataAttributes Attributes -type SearchSLOResponseDataAttributes struct { - // Facets - Facets *SearchSLOResponseDataAttributesFacets `json:"facets,omitempty"` - // SLOs - Slo []ServiceLevelObjective `json:"slo,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{} -} - -// NewSearchSLOResponseDataAttributes instantiates a new SearchSLOResponseDataAttributes 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 NewSearchSLOResponseDataAttributes() *SearchSLOResponseDataAttributes { - this := SearchSLOResponseDataAttributes{} - return &this -} - -// NewSearchSLOResponseDataAttributesWithDefaults instantiates a new SearchSLOResponseDataAttributes 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 NewSearchSLOResponseDataAttributesWithDefaults() *SearchSLOResponseDataAttributes { - this := SearchSLOResponseDataAttributes{} - return &this -} - -// GetFacets returns the Facets field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributes) GetFacets() SearchSLOResponseDataAttributesFacets { - if o == nil || o.Facets == nil { - var ret SearchSLOResponseDataAttributesFacets - return ret - } - return *o.Facets -} - -// GetFacetsOk returns a tuple with the Facets field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributes) GetFacetsOk() (*SearchSLOResponseDataAttributesFacets, bool) { - if o == nil || o.Facets == nil { - return nil, false - } - return o.Facets, true -} - -// HasFacets returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributes) HasFacets() bool { - if o != nil && o.Facets != nil { - return true - } - - return false -} - -// SetFacets gets a reference to the given SearchSLOResponseDataAttributesFacets and assigns it to the Facets field. -func (o *SearchSLOResponseDataAttributes) SetFacets(v SearchSLOResponseDataAttributesFacets) { - o.Facets = &v -} - -// GetSlo returns the Slo field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributes) GetSlo() []ServiceLevelObjective { - if o == nil || o.Slo == nil { - var ret []ServiceLevelObjective - return ret - } - return o.Slo -} - -// GetSloOk returns a tuple with the Slo field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributes) GetSloOk() (*[]ServiceLevelObjective, bool) { - if o == nil || o.Slo == nil { - return nil, false - } - return &o.Slo, true -} - -// HasSlo returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributes) HasSlo() bool { - if o != nil && o.Slo != nil { - return true - } - - return false -} - -// SetSlo gets a reference to the given []ServiceLevelObjective and assigns it to the Slo field. -func (o *SearchSLOResponseDataAttributes) SetSlo(v []ServiceLevelObjective) { - o.Slo = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseDataAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Facets != nil { - toSerialize["facets"] = o.Facets - } - if o.Slo != nil { - toSerialize["slo"] = o.Slo - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Facets *SearchSLOResponseDataAttributesFacets `json:"facets,omitempty"` - Slo []ServiceLevelObjective `json:"slo,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Facets != nil && all.Facets.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Facets = all.Facets - o.Slo = all.Slo - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes_facets.go b/api/v1/datadog/model_search_slo_response_data_attributes_facets.go deleted file mode 100644 index 970158321b4..00000000000 --- a/api/v1/datadog/model_search_slo_response_data_attributes_facets.go +++ /dev/null @@ -1,375 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseDataAttributesFacets Facets -type SearchSLOResponseDataAttributesFacets struct { - // All tags associated with an SLO. - AllTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"all_tags,omitempty"` - // Creator of an SLO. - CreatorName []SearchSLOResponseDataAttributesFacetsObjectString `json:"creator_name,omitempty"` - // Tags with the `env` tag key. - EnvTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"env_tags,omitempty"` - // Tags with the `service` tag key. - ServiceTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"service_tags,omitempty"` - // Type of SLO. - SloType []SearchSLOResponseDataAttributesFacetsObjectInt `json:"slo_type,omitempty"` - // SLO Target - Target []SearchSLOResponseDataAttributesFacetsObjectInt `json:"target,omitempty"` - // Tags with the `team` tag key. - TeamTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"team_tags,omitempty"` - // Timeframes of SLOs. - Timeframe []SearchSLOResponseDataAttributesFacetsObjectString `json:"timeframe,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{} -} - -// NewSearchSLOResponseDataAttributesFacets instantiates a new SearchSLOResponseDataAttributesFacets 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 NewSearchSLOResponseDataAttributesFacets() *SearchSLOResponseDataAttributesFacets { - this := SearchSLOResponseDataAttributesFacets{} - return &this -} - -// NewSearchSLOResponseDataAttributesFacetsWithDefaults instantiates a new SearchSLOResponseDataAttributesFacets 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 NewSearchSLOResponseDataAttributesFacetsWithDefaults() *SearchSLOResponseDataAttributesFacets { - this := SearchSLOResponseDataAttributesFacets{} - return &this -} - -// GetAllTags returns the AllTags field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetAllTags() []SearchSLOResponseDataAttributesFacetsObjectString { - if o == nil || o.AllTags == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectString - return ret - } - return o.AllTags -} - -// GetAllTagsOk returns a tuple with the AllTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetAllTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { - if o == nil || o.AllTags == nil { - return nil, false - } - return &o.AllTags, true -} - -// HasAllTags returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasAllTags() bool { - if o != nil && o.AllTags != nil { - return true - } - - return false -} - -// SetAllTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the AllTags field. -func (o *SearchSLOResponseDataAttributesFacets) SetAllTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { - o.AllTags = v -} - -// GetCreatorName returns the CreatorName field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetCreatorName() []SearchSLOResponseDataAttributesFacetsObjectString { - if o == nil || o.CreatorName == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectString - return ret - } - return o.CreatorName -} - -// GetCreatorNameOk returns a tuple with the CreatorName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetCreatorNameOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { - if o == nil || o.CreatorName == nil { - return nil, false - } - return &o.CreatorName, true -} - -// HasCreatorName returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasCreatorName() bool { - if o != nil && o.CreatorName != nil { - return true - } - - return false -} - -// SetCreatorName gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the CreatorName field. -func (o *SearchSLOResponseDataAttributesFacets) SetCreatorName(v []SearchSLOResponseDataAttributesFacetsObjectString) { - o.CreatorName = v -} - -// GetEnvTags returns the EnvTags field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetEnvTags() []SearchSLOResponseDataAttributesFacetsObjectString { - if o == nil || o.EnvTags == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectString - return ret - } - return o.EnvTags -} - -// GetEnvTagsOk returns a tuple with the EnvTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetEnvTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { - if o == nil || o.EnvTags == nil { - return nil, false - } - return &o.EnvTags, true -} - -// HasEnvTags returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasEnvTags() bool { - if o != nil && o.EnvTags != nil { - return true - } - - return false -} - -// SetEnvTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the EnvTags field. -func (o *SearchSLOResponseDataAttributesFacets) SetEnvTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { - o.EnvTags = v -} - -// GetServiceTags returns the ServiceTags field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetServiceTags() []SearchSLOResponseDataAttributesFacetsObjectString { - if o == nil || o.ServiceTags == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectString - return ret - } - return o.ServiceTags -} - -// GetServiceTagsOk returns a tuple with the ServiceTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetServiceTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { - if o == nil || o.ServiceTags == nil { - return nil, false - } - return &o.ServiceTags, true -} - -// HasServiceTags returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasServiceTags() bool { - if o != nil && o.ServiceTags != nil { - return true - } - - return false -} - -// SetServiceTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the ServiceTags field. -func (o *SearchSLOResponseDataAttributesFacets) SetServiceTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { - o.ServiceTags = v -} - -// GetSloType returns the SloType field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetSloType() []SearchSLOResponseDataAttributesFacetsObjectInt { - if o == nil || o.SloType == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectInt - return ret - } - return o.SloType -} - -// GetSloTypeOk returns a tuple with the SloType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetSloTypeOk() (*[]SearchSLOResponseDataAttributesFacetsObjectInt, bool) { - if o == nil || o.SloType == nil { - return nil, false - } - return &o.SloType, true -} - -// HasSloType returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasSloType() bool { - if o != nil && o.SloType != nil { - return true - } - - return false -} - -// SetSloType gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectInt and assigns it to the SloType field. -func (o *SearchSLOResponseDataAttributesFacets) SetSloType(v []SearchSLOResponseDataAttributesFacetsObjectInt) { - o.SloType = v -} - -// GetTarget returns the Target field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetTarget() []SearchSLOResponseDataAttributesFacetsObjectInt { - if o == nil || o.Target == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectInt - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetTargetOk() (*[]SearchSLOResponseDataAttributesFacetsObjectInt, bool) { - if o == nil || o.Target == nil { - return nil, false - } - return &o.Target, true -} - -// HasTarget returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasTarget() bool { - if o != nil && o.Target != nil { - return true - } - - return false -} - -// SetTarget gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectInt and assigns it to the Target field. -func (o *SearchSLOResponseDataAttributesFacets) SetTarget(v []SearchSLOResponseDataAttributesFacetsObjectInt) { - o.Target = v -} - -// GetTeamTags returns the TeamTags field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetTeamTags() []SearchSLOResponseDataAttributesFacetsObjectString { - if o == nil || o.TeamTags == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectString - return ret - } - return o.TeamTags -} - -// GetTeamTagsOk returns a tuple with the TeamTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetTeamTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { - if o == nil || o.TeamTags == nil { - return nil, false - } - return &o.TeamTags, true -} - -// HasTeamTags returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasTeamTags() bool { - if o != nil && o.TeamTags != nil { - return true - } - - return false -} - -// SetTeamTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the TeamTags field. -func (o *SearchSLOResponseDataAttributesFacets) SetTeamTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { - o.TeamTags = v -} - -// GetTimeframe returns the Timeframe field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacets) GetTimeframe() []SearchSLOResponseDataAttributesFacetsObjectString { - if o == nil || o.Timeframe == nil { - var ret []SearchSLOResponseDataAttributesFacetsObjectString - return ret - } - return o.Timeframe -} - -// GetTimeframeOk returns a tuple with the Timeframe field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacets) GetTimeframeOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { - if o == nil || o.Timeframe == nil { - return nil, false - } - return &o.Timeframe, true -} - -// HasTimeframe returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacets) HasTimeframe() bool { - if o != nil && o.Timeframe != nil { - return true - } - - return false -} - -// SetTimeframe gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the Timeframe field. -func (o *SearchSLOResponseDataAttributesFacets) SetTimeframe(v []SearchSLOResponseDataAttributesFacetsObjectString) { - o.Timeframe = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseDataAttributesFacets) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AllTags != nil { - toSerialize["all_tags"] = o.AllTags - } - if o.CreatorName != nil { - toSerialize["creator_name"] = o.CreatorName - } - if o.EnvTags != nil { - toSerialize["env_tags"] = o.EnvTags - } - if o.ServiceTags != nil { - toSerialize["service_tags"] = o.ServiceTags - } - if o.SloType != nil { - toSerialize["slo_type"] = o.SloType - } - if o.Target != nil { - toSerialize["target"] = o.Target - } - if o.TeamTags != nil { - toSerialize["team_tags"] = o.TeamTags - } - if o.Timeframe != nil { - toSerialize["timeframe"] = o.Timeframe - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseDataAttributesFacets) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AllTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"all_tags,omitempty"` - CreatorName []SearchSLOResponseDataAttributesFacetsObjectString `json:"creator_name,omitempty"` - EnvTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"env_tags,omitempty"` - ServiceTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"service_tags,omitempty"` - SloType []SearchSLOResponseDataAttributesFacetsObjectInt `json:"slo_type,omitempty"` - Target []SearchSLOResponseDataAttributesFacetsObjectInt `json:"target,omitempty"` - TeamTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"team_tags,omitempty"` - Timeframe []SearchSLOResponseDataAttributesFacetsObjectString `json:"timeframe,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AllTags = all.AllTags - o.CreatorName = all.CreatorName - o.EnvTags = all.EnvTags - o.ServiceTags = all.ServiceTags - o.SloType = all.SloType - o.Target = all.Target - o.TeamTags = all.TeamTags - o.Timeframe = all.Timeframe - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go b/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go deleted file mode 100644 index 609ff9e4992..00000000000 --- a/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseDataAttributesFacetsObjectInt Facet -type SearchSLOResponseDataAttributesFacetsObjectInt struct { - // Count - Count *int64 `json:"count,omitempty"` - // Facet - Name *float64 `json:"name,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{} -} - -// NewSearchSLOResponseDataAttributesFacetsObjectInt instantiates a new SearchSLOResponseDataAttributesFacetsObjectInt 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 NewSearchSLOResponseDataAttributesFacetsObjectInt() *SearchSLOResponseDataAttributesFacetsObjectInt { - this := SearchSLOResponseDataAttributesFacetsObjectInt{} - return &this -} - -// NewSearchSLOResponseDataAttributesFacetsObjectIntWithDefaults instantiates a new SearchSLOResponseDataAttributesFacetsObjectInt 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 NewSearchSLOResponseDataAttributesFacetsObjectIntWithDefaults() *SearchSLOResponseDataAttributesFacetsObjectInt { - this := SearchSLOResponseDataAttributesFacetsObjectInt{} - return &this -} - -// GetCount returns the Count field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetCount() int64 { - if o == nil || o.Count == nil { - var ret int64 - return ret - } - return *o.Count -} - -// GetCountOk returns a tuple with the Count field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { - return nil, false - } - return o.Count, true -} - -// HasCount returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) HasCount() bool { - if o != nil && o.Count != nil { - return true - } - - return false -} - -// SetCount gets a reference to the given int64 and assigns it to the Count field. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) SetCount(v int64) { - o.Count = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetName() float64 { - if o == nil || o.Name == nil { - var ret float64 - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetNameOk() (*float64, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given float64 and assigns it to the Name field. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) SetName(v float64) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseDataAttributesFacetsObjectInt) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Count != nil { - toSerialize["count"] = o.Count - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseDataAttributesFacetsObjectInt) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Count *int64 `json:"count,omitempty"` - Name *float64 `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Count = all.Count - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go b/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go deleted file mode 100644 index d8066a3400d..00000000000 --- a/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseDataAttributesFacetsObjectString Facet -type SearchSLOResponseDataAttributesFacetsObjectString struct { - // Count - Count *int64 `json:"count,omitempty"` - // Facet - Name *string `json:"name,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{} -} - -// NewSearchSLOResponseDataAttributesFacetsObjectString instantiates a new SearchSLOResponseDataAttributesFacetsObjectString 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 NewSearchSLOResponseDataAttributesFacetsObjectString() *SearchSLOResponseDataAttributesFacetsObjectString { - this := SearchSLOResponseDataAttributesFacetsObjectString{} - return &this -} - -// NewSearchSLOResponseDataAttributesFacetsObjectStringWithDefaults instantiates a new SearchSLOResponseDataAttributesFacetsObjectString 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 NewSearchSLOResponseDataAttributesFacetsObjectStringWithDefaults() *SearchSLOResponseDataAttributesFacetsObjectString { - this := SearchSLOResponseDataAttributesFacetsObjectString{} - return &this -} - -// GetCount returns the Count field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetCount() int64 { - if o == nil || o.Count == nil { - var ret int64 - return ret - } - return *o.Count -} - -// GetCountOk returns a tuple with the Count field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { - return nil, false - } - return o.Count, true -} - -// HasCount returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) HasCount() bool { - if o != nil && o.Count != nil { - return true - } - - return false -} - -// SetCount gets a reference to the given int64 and assigns it to the Count field. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) SetCount(v int64) { - o.Count = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseDataAttributesFacetsObjectString) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Count != nil { - toSerialize["count"] = o.Count - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseDataAttributesFacetsObjectString) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Count *int64 `json:"count,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Count = all.Count - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_links.go b/api/v1/datadog/model_search_slo_response_links.go deleted file mode 100644 index 2388ddfbba7..00000000000 --- a/api/v1/datadog/model_search_slo_response_links.go +++ /dev/null @@ -1,258 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseLinks Pagination links. -type SearchSLOResponseLinks struct { - // Link to last page. - First *string `json:"first,omitempty"` - // Link to first page. - Last *string `json:"last,omitempty"` - // Link to the next page. - Next *string `json:"next,omitempty"` - // Link to previous page. - Prev *string `json:"prev,omitempty"` - // Link to current page. - Self *string `json:"self,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{} -} - -// NewSearchSLOResponseLinks instantiates a new SearchSLOResponseLinks 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 NewSearchSLOResponseLinks() *SearchSLOResponseLinks { - this := SearchSLOResponseLinks{} - return &this -} - -// NewSearchSLOResponseLinksWithDefaults instantiates a new SearchSLOResponseLinks 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 NewSearchSLOResponseLinksWithDefaults() *SearchSLOResponseLinks { - this := SearchSLOResponseLinks{} - return &this -} - -// GetFirst returns the First field value if set, zero value otherwise. -func (o *SearchSLOResponseLinks) GetFirst() string { - if o == nil || o.First == nil { - var ret string - return ret - } - return *o.First -} - -// GetFirstOk returns a tuple with the First field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseLinks) GetFirstOk() (*string, bool) { - if o == nil || o.First == nil { - return nil, false - } - return o.First, true -} - -// HasFirst returns a boolean if a field has been set. -func (o *SearchSLOResponseLinks) HasFirst() bool { - if o != nil && o.First != nil { - return true - } - - return false -} - -// SetFirst gets a reference to the given string and assigns it to the First field. -func (o *SearchSLOResponseLinks) SetFirst(v string) { - o.First = &v -} - -// GetLast returns the Last field value if set, zero value otherwise. -func (o *SearchSLOResponseLinks) GetLast() string { - if o == nil || o.Last == nil { - var ret string - return ret - } - return *o.Last -} - -// GetLastOk returns a tuple with the Last field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseLinks) GetLastOk() (*string, bool) { - if o == nil || o.Last == nil { - return nil, false - } - return o.Last, true -} - -// HasLast returns a boolean if a field has been set. -func (o *SearchSLOResponseLinks) HasLast() bool { - if o != nil && o.Last != nil { - return true - } - - return false -} - -// SetLast gets a reference to the given string and assigns it to the Last field. -func (o *SearchSLOResponseLinks) SetLast(v string) { - o.Last = &v -} - -// GetNext returns the Next field value if set, zero value otherwise. -func (o *SearchSLOResponseLinks) GetNext() string { - if o == nil || o.Next == nil { - var ret string - return ret - } - return *o.Next -} - -// GetNextOk returns a tuple with the Next field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseLinks) GetNextOk() (*string, bool) { - if o == nil || o.Next == nil { - return nil, false - } - return o.Next, true -} - -// HasNext returns a boolean if a field has been set. -func (o *SearchSLOResponseLinks) HasNext() bool { - if o != nil && o.Next != nil { - return true - } - - return false -} - -// SetNext gets a reference to the given string and assigns it to the Next field. -func (o *SearchSLOResponseLinks) SetNext(v string) { - o.Next = &v -} - -// GetPrev returns the Prev field value if set, zero value otherwise. -func (o *SearchSLOResponseLinks) GetPrev() string { - if o == nil || o.Prev == nil { - var ret string - return ret - } - return *o.Prev -} - -// GetPrevOk returns a tuple with the Prev field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseLinks) GetPrevOk() (*string, bool) { - if o == nil || o.Prev == nil { - return nil, false - } - return o.Prev, true -} - -// HasPrev returns a boolean if a field has been set. -func (o *SearchSLOResponseLinks) HasPrev() bool { - if o != nil && o.Prev != nil { - return true - } - - return false -} - -// SetPrev gets a reference to the given string and assigns it to the Prev field. -func (o *SearchSLOResponseLinks) SetPrev(v string) { - o.Prev = &v -} - -// GetSelf returns the Self field value if set, zero value otherwise. -func (o *SearchSLOResponseLinks) GetSelf() string { - if o == nil || o.Self == nil { - var ret string - return ret - } - return *o.Self -} - -// GetSelfOk returns a tuple with the Self field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseLinks) GetSelfOk() (*string, bool) { - if o == nil || o.Self == nil { - return nil, false - } - return o.Self, true -} - -// HasSelf returns a boolean if a field has been set. -func (o *SearchSLOResponseLinks) HasSelf() bool { - if o != nil && o.Self != nil { - return true - } - - return false -} - -// SetSelf gets a reference to the given string and assigns it to the Self field. -func (o *SearchSLOResponseLinks) SetSelf(v string) { - o.Self = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseLinks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.First != nil { - toSerialize["first"] = o.First - } - if o.Last != nil { - toSerialize["last"] = o.Last - } - if o.Next != nil { - toSerialize["next"] = o.Next - } - if o.Prev != nil { - toSerialize["prev"] = o.Prev - } - if o.Self != nil { - toSerialize["self"] = o.Self - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - First *string `json:"first,omitempty"` - Last *string `json:"last,omitempty"` - Next *string `json:"next,omitempty"` - Prev *string `json:"prev,omitempty"` - Self *string `json:"self,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.First = all.First - o.Last = all.Last - o.Next = all.Next - o.Prev = all.Prev - o.Self = all.Self - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_meta.go b/api/v1/datadog/model_search_slo_response_meta.go deleted file mode 100644 index e2441de62fb..00000000000 --- a/api/v1/datadog/model_search_slo_response_meta.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseMeta Searches metadata returned by the API. -type SearchSLOResponseMeta struct { - // Pagination metadata returned by the API. - Pagination *SearchSLOResponseMetaPage `json:"pagination,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{} -} - -// NewSearchSLOResponseMeta instantiates a new SearchSLOResponseMeta 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 NewSearchSLOResponseMeta() *SearchSLOResponseMeta { - this := SearchSLOResponseMeta{} - return &this -} - -// NewSearchSLOResponseMetaWithDefaults instantiates a new SearchSLOResponseMeta 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 NewSearchSLOResponseMetaWithDefaults() *SearchSLOResponseMeta { - this := SearchSLOResponseMeta{} - return &this -} - -// GetPagination returns the Pagination field value if set, zero value otherwise. -func (o *SearchSLOResponseMeta) GetPagination() SearchSLOResponseMetaPage { - if o == nil || o.Pagination == nil { - var ret SearchSLOResponseMetaPage - return ret - } - return *o.Pagination -} - -// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMeta) GetPaginationOk() (*SearchSLOResponseMetaPage, bool) { - if o == nil || o.Pagination == nil { - return nil, false - } - return o.Pagination, true -} - -// HasPagination returns a boolean if a field has been set. -func (o *SearchSLOResponseMeta) HasPagination() bool { - if o != nil && o.Pagination != nil { - return true - } - - return false -} - -// SetPagination gets a reference to the given SearchSLOResponseMetaPage and assigns it to the Pagination field. -func (o *SearchSLOResponseMeta) SetPagination(v SearchSLOResponseMetaPage) { - o.Pagination = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Pagination != nil { - toSerialize["pagination"] = o.Pagination - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Pagination *SearchSLOResponseMetaPage `json:"pagination,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pagination = all.Pagination - return nil -} diff --git a/api/v1/datadog/model_search_slo_response_meta_page.go b/api/v1/datadog/model_search_slo_response_meta_page.go deleted file mode 100644 index aee031ce762..00000000000 --- a/api/v1/datadog/model_search_slo_response_meta_page.go +++ /dev/null @@ -1,375 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SearchSLOResponseMetaPage Pagination metadata returned by the API. -type SearchSLOResponseMetaPage struct { - // The first number. - FirstNumber *int64 `json:"first_number,omitempty"` - // The last number. - LastNumber *int64 `json:"last_number,omitempty"` - // The next number. - NextNumber *int64 `json:"next_number,omitempty"` - // The page number. - Number *int64 `json:"number,omitempty"` - // The previous page number. - PrevNumber *int64 `json:"prev_number,omitempty"` - // The size of the response. - Size *int64 `json:"size,omitempty"` - // The total number of SLOs in the response. - Total *int64 `json:"total,omitempty"` - // Type of pagination. - Type *string `json:"type,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{} -} - -// NewSearchSLOResponseMetaPage instantiates a new SearchSLOResponseMetaPage 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 NewSearchSLOResponseMetaPage() *SearchSLOResponseMetaPage { - this := SearchSLOResponseMetaPage{} - return &this -} - -// NewSearchSLOResponseMetaPageWithDefaults instantiates a new SearchSLOResponseMetaPage 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 NewSearchSLOResponseMetaPageWithDefaults() *SearchSLOResponseMetaPage { - this := SearchSLOResponseMetaPage{} - return &this -} - -// GetFirstNumber returns the FirstNumber field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetFirstNumber() int64 { - if o == nil || o.FirstNumber == nil { - var ret int64 - return ret - } - return *o.FirstNumber -} - -// GetFirstNumberOk returns a tuple with the FirstNumber field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetFirstNumberOk() (*int64, bool) { - if o == nil || o.FirstNumber == nil { - return nil, false - } - return o.FirstNumber, true -} - -// HasFirstNumber returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasFirstNumber() bool { - if o != nil && o.FirstNumber != nil { - return true - } - - return false -} - -// SetFirstNumber gets a reference to the given int64 and assigns it to the FirstNumber field. -func (o *SearchSLOResponseMetaPage) SetFirstNumber(v int64) { - o.FirstNumber = &v -} - -// GetLastNumber returns the LastNumber field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetLastNumber() int64 { - if o == nil || o.LastNumber == nil { - var ret int64 - return ret - } - return *o.LastNumber -} - -// GetLastNumberOk returns a tuple with the LastNumber field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetLastNumberOk() (*int64, bool) { - if o == nil || o.LastNumber == nil { - return nil, false - } - return o.LastNumber, true -} - -// HasLastNumber returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasLastNumber() bool { - if o != nil && o.LastNumber != nil { - return true - } - - return false -} - -// SetLastNumber gets a reference to the given int64 and assigns it to the LastNumber field. -func (o *SearchSLOResponseMetaPage) SetLastNumber(v int64) { - o.LastNumber = &v -} - -// GetNextNumber returns the NextNumber field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetNextNumber() int64 { - if o == nil || o.NextNumber == nil { - var ret int64 - return ret - } - return *o.NextNumber -} - -// GetNextNumberOk returns a tuple with the NextNumber field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetNextNumberOk() (*int64, bool) { - if o == nil || o.NextNumber == nil { - return nil, false - } - return o.NextNumber, true -} - -// HasNextNumber returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasNextNumber() bool { - if o != nil && o.NextNumber != nil { - return true - } - - return false -} - -// SetNextNumber gets a reference to the given int64 and assigns it to the NextNumber field. -func (o *SearchSLOResponseMetaPage) SetNextNumber(v int64) { - o.NextNumber = &v -} - -// GetNumber returns the Number field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetNumber() int64 { - if o == nil || o.Number == nil { - var ret int64 - return ret - } - return *o.Number -} - -// GetNumberOk returns a tuple with the Number field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetNumberOk() (*int64, bool) { - if o == nil || o.Number == nil { - return nil, false - } - return o.Number, true -} - -// HasNumber returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasNumber() bool { - if o != nil && o.Number != nil { - return true - } - - return false -} - -// SetNumber gets a reference to the given int64 and assigns it to the Number field. -func (o *SearchSLOResponseMetaPage) SetNumber(v int64) { - o.Number = &v -} - -// GetPrevNumber returns the PrevNumber field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetPrevNumber() int64 { - if o == nil || o.PrevNumber == nil { - var ret int64 - return ret - } - return *o.PrevNumber -} - -// GetPrevNumberOk returns a tuple with the PrevNumber field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetPrevNumberOk() (*int64, bool) { - if o == nil || o.PrevNumber == nil { - return nil, false - } - return o.PrevNumber, true -} - -// HasPrevNumber returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasPrevNumber() bool { - if o != nil && o.PrevNumber != nil { - return true - } - - return false -} - -// SetPrevNumber gets a reference to the given int64 and assigns it to the PrevNumber field. -func (o *SearchSLOResponseMetaPage) SetPrevNumber(v int64) { - o.PrevNumber = &v -} - -// GetSize returns the Size field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetSize() int64 { - if o == nil || o.Size == nil { - var ret int64 - return ret - } - return *o.Size -} - -// GetSizeOk returns a tuple with the Size field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetSizeOk() (*int64, bool) { - if o == nil || o.Size == nil { - return nil, false - } - return o.Size, true -} - -// HasSize returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasSize() bool { - if o != nil && o.Size != nil { - return true - } - - return false -} - -// SetSize gets a reference to the given int64 and assigns it to the Size field. -func (o *SearchSLOResponseMetaPage) SetSize(v int64) { - o.Size = &v -} - -// GetTotal returns the Total field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetTotal() int64 { - if o == nil || o.Total == nil { - var ret int64 - return ret - } - return *o.Total -} - -// GetTotalOk returns a tuple with the Total field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetTotalOk() (*int64, bool) { - if o == nil || o.Total == nil { - return nil, false - } - return o.Total, true -} - -// HasTotal returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasTotal() bool { - if o != nil && o.Total != nil { - return true - } - - return false -} - -// SetTotal gets a reference to the given int64 and assigns it to the Total field. -func (o *SearchSLOResponseMetaPage) SetTotal(v int64) { - o.Total = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SearchSLOResponseMetaPage) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SearchSLOResponseMetaPage) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SearchSLOResponseMetaPage) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *SearchSLOResponseMetaPage) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SearchSLOResponseMetaPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.FirstNumber != nil { - toSerialize["first_number"] = o.FirstNumber - } - if o.LastNumber != nil { - toSerialize["last_number"] = o.LastNumber - } - if o.NextNumber != nil { - toSerialize["next_number"] = o.NextNumber - } - if o.Number != nil { - toSerialize["number"] = o.Number - } - if o.PrevNumber != nil { - toSerialize["prev_number"] = o.PrevNumber - } - if o.Size != nil { - toSerialize["size"] = o.Size - } - if o.Total != nil { - toSerialize["total"] = o.Total - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SearchSLOResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - FirstNumber *int64 `json:"first_number,omitempty"` - LastNumber *int64 `json:"last_number,omitempty"` - NextNumber *int64 `json:"next_number,omitempty"` - Number *int64 `json:"number,omitempty"` - PrevNumber *int64 `json:"prev_number,omitempty"` - Size *int64 `json:"size,omitempty"` - Total *int64 `json:"total,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.FirstNumber = all.FirstNumber - o.LastNumber = all.LastNumber - o.NextNumber = all.NextNumber - o.Number = all.Number - o.PrevNumber = all.PrevNumber - o.Size = all.Size - o.Total = all.Total - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_series.go b/api/v1/datadog/model_series.go deleted file mode 100644 index 5e1759b636d..00000000000 --- a/api/v1/datadog/model_series.go +++ /dev/null @@ -1,312 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// Series A metric to submit to Datadog. -// See [Datadog metrics](https://docs.datadoghq.com/developers/metrics/#custom-metrics-properties). -type Series struct { - // The name of the host that produced the metric. - Host *string `json:"host,omitempty"` - // If the type of the metric is rate or count, define the corresponding interval. - Interval common.NullableInt64 `json:"interval,omitempty"` - // The name of the timeseries. - Metric string `json:"metric"` - // Points relating to a metric. All points must be tuples with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past. - Points [][]*float64 `json:"points"` - // A list of tags associated with the metric. - Tags []string `json:"tags,omitempty"` - // The type of the metric. Valid types are "",`count`, `gauge`, and `rate`. - Type *string `json:"type,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{} -} - -// NewSeries instantiates a new Series 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 NewSeries(metric string, points [][]*float64) *Series { - this := Series{} - this.Interval = *common.NewNullableInt64(nil) - this.Metric = metric - this.Points = points - var typeVar string = "" - this.Type = &typeVar - return &this -} - -// NewSeriesWithDefaults instantiates a new Series 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 NewSeriesWithDefaults() *Series { - this := Series{} - this.Interval = *common.NewNullableInt64(nil) - var typeVar string = "" - this.Type = &typeVar - return &this -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *Series) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Series) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *Series) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *Series) SetHost(v string) { - o.Host = &v -} - -// GetInterval returns the Interval field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Series) GetInterval() int64 { - if o == nil || o.Interval.Get() == nil { - var ret int64 - return ret - } - return *o.Interval.Get() -} - -// GetIntervalOk returns a tuple with the Interval 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 *Series) GetIntervalOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Interval.Get(), o.Interval.IsSet() -} - -// HasInterval returns a boolean if a field has been set. -func (o *Series) HasInterval() bool { - if o != nil && o.Interval.IsSet() { - return true - } - - return false -} - -// SetInterval gets a reference to the given common.NullableInt64 and assigns it to the Interval field. -func (o *Series) SetInterval(v int64) { - o.Interval.Set(&v) -} - -// SetIntervalNil sets the value for Interval to be an explicit nil. -func (o *Series) SetIntervalNil() { - o.Interval.Set(nil) -} - -// UnsetInterval ensures that no value is present for Interval, not even an explicit nil. -func (o *Series) UnsetInterval() { - o.Interval.Unset() -} - -// GetMetric returns the Metric field value. -func (o *Series) GetMetric() string { - if o == nil { - var ret string - return ret - } - return o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value -// and a boolean to check if the value has been set. -func (o *Series) GetMetricOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Metric, true -} - -// SetMetric sets field value. -func (o *Series) SetMetric(v string) { - o.Metric = v -} - -// GetPoints returns the Points field value. -func (o *Series) GetPoints() [][]*float64 { - if o == nil { - var ret [][]*float64 - return ret - } - return o.Points -} - -// GetPointsOk returns a tuple with the Points field value -// and a boolean to check if the value has been set. -func (o *Series) GetPointsOk() (*[][]*float64, bool) { - if o == nil { - return nil, false - } - return &o.Points, true -} - -// SetPoints sets field value. -func (o *Series) SetPoints(v [][]*float64) { - o.Points = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *Series) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *Series) GetTagsOk() (*[]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 *Series) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *Series) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *Series) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Series) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *Series) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *Series) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Series) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Interval.IsSet() { - toSerialize["interval"] = o.Interval.Get() - } - toSerialize["metric"] = o.Metric - toSerialize["points"] = o.Points - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Series) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Metric *string `json:"metric"` - Points *[][]*float64 `json:"points"` - }{} - all := struct { - Host *string `json:"host,omitempty"` - Interval common.NullableInt64 `json:"interval,omitempty"` - Metric string `json:"metric"` - Points [][]*float64 `json:"points"` - Tags []string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("Required field metric missing") - } - if required.Points == nil { - return fmt.Errorf("Required field points missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Host = all.Host - o.Interval = all.Interval - o.Metric = all.Metric - o.Points = all.Points - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_service_check.go b/api/v1/datadog/model_service_check.go deleted file mode 100644 index aa85e14edb8..00000000000 --- a/api/v1/datadog/model_service_check.go +++ /dev/null @@ -1,288 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceCheck An object containing service check and status. -type ServiceCheck struct { - // The check. - Check string `json:"check"` - // The host name correlated with the check. - HostName string `json:"host_name"` - // Message containing check status. - Message *string `json:"message,omitempty"` - // The status of a service check. - Status ServiceCheckStatus `json:"status"` - // Tags related to a check. - Tags []string `json:"tags"` - // Time of check. - Timestamp *int64 `json:"timestamp,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{} -} - -// NewServiceCheck instantiates a new ServiceCheck 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 NewServiceCheck(check string, hostName string, status ServiceCheckStatus, tags []string) *ServiceCheck { - this := ServiceCheck{} - this.Check = check - this.HostName = hostName - this.Status = status - this.Tags = tags - return &this -} - -// NewServiceCheckWithDefaults instantiates a new ServiceCheck 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 NewServiceCheckWithDefaults() *ServiceCheck { - this := ServiceCheck{} - return &this -} - -// GetCheck returns the Check field value. -func (o *ServiceCheck) GetCheck() string { - if o == nil { - var ret string - return ret - } - return o.Check -} - -// GetCheckOk returns a tuple with the Check field value -// and a boolean to check if the value has been set. -func (o *ServiceCheck) GetCheckOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Check, true -} - -// SetCheck sets field value. -func (o *ServiceCheck) SetCheck(v string) { - o.Check = v -} - -// GetHostName returns the HostName field value. -func (o *ServiceCheck) GetHostName() string { - if o == nil { - var ret string - return ret - } - return o.HostName -} - -// GetHostNameOk returns a tuple with the HostName field value -// and a boolean to check if the value has been set. -func (o *ServiceCheck) GetHostNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.HostName, true -} - -// SetHostName sets field value. -func (o *ServiceCheck) SetHostName(v string) { - o.HostName = v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *ServiceCheck) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceCheck) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *ServiceCheck) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *ServiceCheck) SetMessage(v string) { - o.Message = &v -} - -// GetStatus returns the Status field value. -func (o *ServiceCheck) GetStatus() ServiceCheckStatus { - if o == nil { - var ret ServiceCheckStatus - return ret - } - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value -// and a boolean to check if the value has been set. -func (o *ServiceCheck) GetStatusOk() (*ServiceCheckStatus, bool) { - if o == nil { - return nil, false - } - return &o.Status, true -} - -// SetStatus sets field value. -func (o *ServiceCheck) SetStatus(v ServiceCheckStatus) { - o.Status = v -} - -// GetTags returns the Tags field value. -func (o *ServiceCheck) GetTags() []string { - if o == nil { - var ret []string - return ret - } - return o.Tags -} - -// GetTagsOk returns a tuple with the Tags field value -// and a boolean to check if the value has been set. -func (o *ServiceCheck) GetTagsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Tags, true -} - -// SetTags sets field value. -func (o *ServiceCheck) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *ServiceCheck) GetTimestamp() int64 { - if o == nil || o.Timestamp == nil { - var ret int64 - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceCheck) GetTimestampOk() (*int64, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *ServiceCheck) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. -func (o *ServiceCheck) SetTimestamp(v int64) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceCheck) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["check"] = o.Check - toSerialize["host_name"] = o.HostName - if o.Message != nil { - toSerialize["message"] = o.Message - } - toSerialize["status"] = o.Status - toSerialize["tags"] = o.Tags - if o.Timestamp != nil { - toSerialize["timestamp"] = o.Timestamp - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceCheck) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Check *string `json:"check"` - HostName *string `json:"host_name"` - Status *ServiceCheckStatus `json:"status"` - Tags *[]string `json:"tags"` - }{} - all := struct { - Check string `json:"check"` - HostName string `json:"host_name"` - Message *string `json:"message,omitempty"` - Status ServiceCheckStatus `json:"status"` - Tags []string `json:"tags"` - Timestamp *int64 `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Check == nil { - return fmt.Errorf("Required field check missing") - } - if required.HostName == nil { - return fmt.Errorf("Required field host_name missing") - } - if required.Status == nil { - return fmt.Errorf("Required field status missing") - } - if required.Tags == nil { - return fmt.Errorf("Required field tags missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Check = all.Check - o.HostName = all.HostName - o.Message = all.Message - o.Status = all.Status - o.Tags = all.Tags - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v1/datadog/model_service_check_status.go b/api/v1/datadog/model_service_check_status.go deleted file mode 100644 index 9ec8dbb9ffc..00000000000 --- a/api/v1/datadog/model_service_check_status.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceCheckStatus The status of a service check. -type ServiceCheckStatus int32 - -// List of ServiceCheckStatus. -const ( - SERVICECHECKSTATUS_OK ServiceCheckStatus = 0 - SERVICECHECKSTATUS_WARNING ServiceCheckStatus = 1 - SERVICECHECKSTATUS_CRITICAL ServiceCheckStatus = 2 - SERVICECHECKSTATUS_UNKNOWN ServiceCheckStatus = 3 -) - -var allowedServiceCheckStatusEnumValues = []ServiceCheckStatus{ - SERVICECHECKSTATUS_OK, - SERVICECHECKSTATUS_WARNING, - SERVICECHECKSTATUS_CRITICAL, - SERVICECHECKSTATUS_UNKNOWN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ServiceCheckStatus) GetAllowedValues() []ServiceCheckStatus { - return allowedServiceCheckStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ServiceCheckStatus) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ServiceCheckStatus(value) - return nil -} - -// NewServiceCheckStatusFromValue returns a pointer to a valid ServiceCheckStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewServiceCheckStatusFromValue(v int32) (*ServiceCheckStatus, error) { - ev := ServiceCheckStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ServiceCheckStatus: valid values are %v", v, allowedServiceCheckStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ServiceCheckStatus) IsValid() bool { - for _, existing := range allowedServiceCheckStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ServiceCheckStatus value. -func (v ServiceCheckStatus) Ptr() *ServiceCheckStatus { - return &v -} - -// NullableServiceCheckStatus handles when a null is used for ServiceCheckStatus. -type NullableServiceCheckStatus struct { - value *ServiceCheckStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceCheckStatus) Get() *ServiceCheckStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceCheckStatus) Set(val *ServiceCheckStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceCheckStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceCheckStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceCheckStatus initializes the struct as if Set has been called. -func NewNullableServiceCheckStatus(val *ServiceCheckStatus) *NullableServiceCheckStatus { - return &NullableServiceCheckStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceCheckStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceCheckStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_service_level_objective.go b/api/v1/datadog/model_service_level_objective.go deleted file mode 100644 index f9c170f6fd7..00000000000 --- a/api/v1/datadog/model_service_level_objective.go +++ /dev/null @@ -1,619 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// ServiceLevelObjective A service level objective object includes a service level indicator, thresholds -// for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). -type ServiceLevelObjective struct { - // Creation timestamp (UNIX time in seconds) - // - // Always included in service level objective responses. - CreatedAt *int64 `json:"created_at,omitempty"` - // Object describing the creator of the shared element. - Creator *Creator `json:"creator,omitempty"` - // A user-defined description of the service level objective. - // - // Always included in service level objective responses (but may be `null`). - // Optional in create/update requests. - Description common.NullableString `json:"description,omitempty"` - // A list of (up to 100) monitor groups that narrow the scope of a monitor service level objective. - // - // Included in service level objective responses if it is not empty. Optional in - // create/update requests for monitor service level objectives, but may only be - // used when then length of the `monitor_ids` field is one. - Groups []string `json:"groups,omitempty"` - // A unique identifier for the service level objective object. - // - // Always included in service level objective responses. - Id *string `json:"id,omitempty"` - // Modification timestamp (UNIX time in seconds) - // - // Always included in service level objective responses. - ModifiedAt *int64 `json:"modified_at,omitempty"` - // A list of monitor ids that defines the scope of a monitor service level - // objective. **Required if type is `monitor`**. - MonitorIds []int64 `json:"monitor_ids,omitempty"` - // The union of monitor tags for all monitors referenced by the `monitor_ids` - // field. - // Always included in service level objective responses for monitor-based service level - // objectives (but may be empty). Ignored in create/update requests. Does not - // affect which monitors are included in the service level objective (that is - // determined entirely by the `monitor_ids` field). - MonitorTags []string `json:"monitor_tags,omitempty"` - // The name of the service level objective object. - Name string `json:"name"` - // A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator - // to be used because this will sum up all request counts instead of averaging them, or taking the max or - // min of all of those requests. - Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` - // A list of tags associated with this service level objective. - // Always included in service level objective responses (but may be empty). - // Optional in create/update requests. - Tags []string `json:"tags,omitempty"` - // The thresholds (timeframes and associated targets) for this service level - // objective object. - Thresholds []SLOThreshold `json:"thresholds"` - // The type of the service level objective. - Type SLOType `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{} -} - -// NewServiceLevelObjective instantiates a new ServiceLevelObjective 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 NewServiceLevelObjective(name string, thresholds []SLOThreshold, typeVar SLOType) *ServiceLevelObjective { - this := ServiceLevelObjective{} - this.Name = name - this.Thresholds = thresholds - this.Type = typeVar - return &this -} - -// NewServiceLevelObjectiveWithDefaults instantiates a new ServiceLevelObjective 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 NewServiceLevelObjectiveWithDefaults() *ServiceLevelObjective { - this := ServiceLevelObjective{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetCreatedAt() int64 { - if o == nil || o.CreatedAt == nil { - var ret int64 - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetCreatedAtOk() (*int64, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. -func (o *ServiceLevelObjective) SetCreatedAt(v int64) { - o.CreatedAt = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetCreator() Creator { - if o == nil || o.Creator == nil { - var ret Creator - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetCreatorOk() (*Creator, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given Creator and assigns it to the Creator field. -func (o *ServiceLevelObjective) SetCreator(v Creator) { - o.Creator = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *ServiceLevelObjective) GetDescription() string { - if o == nil || o.Description.Get() == nil { - var ret string - return ret - } - return *o.Description.Get() -} - -// GetDescriptionOk returns a tuple with the Description 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 *ServiceLevelObjective) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Description.Get(), o.Description.IsSet() -} - -// HasDescription returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasDescription() bool { - if o != nil && o.Description.IsSet() { - return true - } - - return false -} - -// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. -func (o *ServiceLevelObjective) SetDescription(v string) { - o.Description.Set(&v) -} - -// SetDescriptionNil sets the value for Description to be an explicit nil. -func (o *ServiceLevelObjective) SetDescriptionNil() { - o.Description.Set(nil) -} - -// UnsetDescription ensures that no value is present for Description, not even an explicit nil. -func (o *ServiceLevelObjective) UnsetDescription() { - o.Description.Unset() -} - -// GetGroups returns the Groups field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetGroups() []string { - if o == nil || o.Groups == nil { - var ret []string - 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 *ServiceLevelObjective) GetGroupsOk() (*[]string, 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 *ServiceLevelObjective) HasGroups() bool { - if o != nil && o.Groups != nil { - return true - } - - return false -} - -// SetGroups gets a reference to the given []string and assigns it to the Groups field. -func (o *ServiceLevelObjective) SetGroups(v []string) { - o.Groups = v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *ServiceLevelObjective) SetId(v string) { - o.Id = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetModifiedAt() int64 { - if o == nil || o.ModifiedAt == nil { - var ret int64 - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetModifiedAtOk() (*int64, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given int64 and assigns it to the ModifiedAt field. -func (o *ServiceLevelObjective) SetModifiedAt(v int64) { - o.ModifiedAt = &v -} - -// GetMonitorIds returns the MonitorIds field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetMonitorIds() []int64 { - if o == nil || o.MonitorIds == nil { - var ret []int64 - return ret - } - return o.MonitorIds -} - -// GetMonitorIdsOk returns a tuple with the MonitorIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetMonitorIdsOk() (*[]int64, bool) { - if o == nil || o.MonitorIds == nil { - return nil, false - } - return &o.MonitorIds, true -} - -// HasMonitorIds returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasMonitorIds() bool { - if o != nil && o.MonitorIds != nil { - return true - } - - return false -} - -// SetMonitorIds gets a reference to the given []int64 and assigns it to the MonitorIds field. -func (o *ServiceLevelObjective) SetMonitorIds(v []int64) { - o.MonitorIds = v -} - -// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetMonitorTags() []string { - if o == nil || o.MonitorTags == nil { - var ret []string - return ret - } - return o.MonitorTags -} - -// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetMonitorTagsOk() (*[]string, bool) { - if o == nil || o.MonitorTags == nil { - return nil, false - } - return &o.MonitorTags, true -} - -// HasMonitorTags returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasMonitorTags() bool { - if o != nil && o.MonitorTags != nil { - return true - } - - return false -} - -// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. -func (o *ServiceLevelObjective) SetMonitorTags(v []string) { - o.MonitorTags = v -} - -// GetName returns the Name field value. -func (o *ServiceLevelObjective) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *ServiceLevelObjective) SetName(v string) { - o.Name = v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetQuery() ServiceLevelObjectiveQuery { - if o == nil || o.Query == nil { - var ret ServiceLevelObjectiveQuery - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetQueryOk() (*ServiceLevelObjectiveQuery, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *ServiceLevelObjective) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given ServiceLevelObjectiveQuery and assigns it to the Query field. -func (o *ServiceLevelObjective) SetQuery(v ServiceLevelObjectiveQuery) { - o.Query = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *ServiceLevelObjective) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *ServiceLevelObjective) GetTagsOk() (*[]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 *ServiceLevelObjective) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *ServiceLevelObjective) SetTags(v []string) { - o.Tags = v -} - -// GetThresholds returns the Thresholds field value. -func (o *ServiceLevelObjective) GetThresholds() []SLOThreshold { - if o == nil { - var ret []SLOThreshold - return ret - } - return o.Thresholds -} - -// GetThresholdsOk returns a tuple with the Thresholds field value -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjective) GetThresholdsOk() (*[]SLOThreshold, bool) { - if o == nil { - return nil, false - } - return &o.Thresholds, true -} - -// SetThresholds sets field value. -func (o *ServiceLevelObjective) SetThresholds(v []SLOThreshold) { - o.Thresholds = v -} - -// GetType returns the Type field value. -func (o *ServiceLevelObjective) GetType() SLOType { - if o == nil { - var ret SLOType - 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 *ServiceLevelObjective) GetTypeOk() (*SLOType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ServiceLevelObjective) SetType(v SLOType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceLevelObjective) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.Description.IsSet() { - toSerialize["description"] = o.Description.Get() - } - if o.Groups != nil { - toSerialize["groups"] = o.Groups - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.ModifiedAt != nil { - toSerialize["modified_at"] = o.ModifiedAt - } - if o.MonitorIds != nil { - toSerialize["monitor_ids"] = o.MonitorIds - } - if o.MonitorTags != nil { - toSerialize["monitor_tags"] = o.MonitorTags - } - toSerialize["name"] = o.Name - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - toSerialize["thresholds"] = o.Thresholds - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Thresholds *[]SLOThreshold `json:"thresholds"` - Type *SLOType `json:"type"` - }{} - all := struct { - CreatedAt *int64 `json:"created_at,omitempty"` - Creator *Creator `json:"creator,omitempty"` - Description common.NullableString `json:"description,omitempty"` - Groups []string `json:"groups,omitempty"` - Id *string `json:"id,omitempty"` - ModifiedAt *int64 `json:"modified_at,omitempty"` - MonitorIds []int64 `json:"monitor_ids,omitempty"` - MonitorTags []string `json:"monitor_tags,omitempty"` - Name string `json:"name"` - Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` - Tags []string `json:"tags,omitempty"` - Thresholds []SLOThreshold `json:"thresholds"` - Type SLOType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Thresholds == nil { - return fmt.Errorf("Required field thresholds missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.Description = all.Description - o.Groups = all.Groups - o.Id = all.Id - o.ModifiedAt = all.ModifiedAt - o.MonitorIds = all.MonitorIds - o.MonitorTags = all.MonitorTags - o.Name = all.Name - if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Query = all.Query - o.Tags = all.Tags - o.Thresholds = all.Thresholds - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_service_level_objective_query.go b/api/v1/datadog/model_service_level_objective_query.go deleted file mode 100644 index 7be49dae628..00000000000 --- a/api/v1/datadog/model_service_level_objective_query.go +++ /dev/null @@ -1,138 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceLevelObjectiveQuery A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator -// to be used because this will sum up all request counts instead of averaging them, or taking the max or -// min of all of those requests. -type ServiceLevelObjectiveQuery struct { - // A Datadog metric query for total (valid) events. - Denominator string `json:"denominator"` - // A Datadog metric query for good events. - Numerator string `json:"numerator"` - // 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{} -} - -// NewServiceLevelObjectiveQuery instantiates a new ServiceLevelObjectiveQuery 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 NewServiceLevelObjectiveQuery(denominator string, numerator string) *ServiceLevelObjectiveQuery { - this := ServiceLevelObjectiveQuery{} - this.Denominator = denominator - this.Numerator = numerator - return &this -} - -// NewServiceLevelObjectiveQueryWithDefaults instantiates a new ServiceLevelObjectiveQuery 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 NewServiceLevelObjectiveQueryWithDefaults() *ServiceLevelObjectiveQuery { - this := ServiceLevelObjectiveQuery{} - return &this -} - -// GetDenominator returns the Denominator field value. -func (o *ServiceLevelObjectiveQuery) GetDenominator() string { - if o == nil { - var ret string - return ret - } - return o.Denominator -} - -// GetDenominatorOk returns a tuple with the Denominator field value -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjectiveQuery) GetDenominatorOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Denominator, true -} - -// SetDenominator sets field value. -func (o *ServiceLevelObjectiveQuery) SetDenominator(v string) { - o.Denominator = v -} - -// GetNumerator returns the Numerator field value. -func (o *ServiceLevelObjectiveQuery) GetNumerator() string { - if o == nil { - var ret string - return ret - } - return o.Numerator -} - -// GetNumeratorOk returns a tuple with the Numerator field value -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjectiveQuery) GetNumeratorOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Numerator, true -} - -// SetNumerator sets field value. -func (o *ServiceLevelObjectiveQuery) SetNumerator(v string) { - o.Numerator = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceLevelObjectiveQuery) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["denominator"] = o.Denominator - toSerialize["numerator"] = o.Numerator - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceLevelObjectiveQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Denominator *string `json:"denominator"` - Numerator *string `json:"numerator"` - }{} - all := struct { - Denominator string `json:"denominator"` - Numerator string `json:"numerator"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Denominator == nil { - return fmt.Errorf("Required field denominator missing") - } - if required.Numerator == nil { - return fmt.Errorf("Required field numerator missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Denominator = all.Denominator - o.Numerator = all.Numerator - return nil -} diff --git a/api/v1/datadog/model_service_level_objective_request.go b/api/v1/datadog/model_service_level_objective_request.go deleted file mode 100644 index bbed358168f..00000000000 --- a/api/v1/datadog/model_service_level_objective_request.go +++ /dev/null @@ -1,406 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// ServiceLevelObjectiveRequest A service level objective object includes a service level indicator, thresholds -// for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). -type ServiceLevelObjectiveRequest struct { - // A user-defined description of the service level objective. - // - // Always included in service level objective responses (but may be `null`). - // Optional in create/update requests. - Description common.NullableString `json:"description,omitempty"` - // A list of (up to 100) monitor groups that narrow the scope of a monitor service level objective. - // - // Included in service level objective responses if it is not empty. Optional in - // create/update requests for monitor service level objectives, but may only be - // used when then length of the `monitor_ids` field is one. - Groups []string `json:"groups,omitempty"` - // A list of monitor IDs that defines the scope of a monitor service level - // objective. **Required if type is `monitor`**. - MonitorIds []int64 `json:"monitor_ids,omitempty"` - // The name of the service level objective object. - Name string `json:"name"` - // A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator - // to be used because this will sum up all request counts instead of averaging them, or taking the max or - // min of all of those requests. - Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` - // A list of tags associated with this service level objective. - // Always included in service level objective responses (but may be empty). - // Optional in create/update requests. - Tags []string `json:"tags,omitempty"` - // The thresholds (timeframes and associated targets) for this service level - // objective object. - Thresholds []SLOThreshold `json:"thresholds"` - // The type of the service level objective. - Type SLOType `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{} -} - -// NewServiceLevelObjectiveRequest instantiates a new ServiceLevelObjectiveRequest 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 NewServiceLevelObjectiveRequest(name string, thresholds []SLOThreshold, typeVar SLOType) *ServiceLevelObjectiveRequest { - this := ServiceLevelObjectiveRequest{} - this.Name = name - this.Thresholds = thresholds - this.Type = typeVar - return &this -} - -// NewServiceLevelObjectiveRequestWithDefaults instantiates a new ServiceLevelObjectiveRequest 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 NewServiceLevelObjectiveRequestWithDefaults() *ServiceLevelObjectiveRequest { - this := ServiceLevelObjectiveRequest{} - return &this -} - -// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *ServiceLevelObjectiveRequest) GetDescription() string { - if o == nil || o.Description.Get() == nil { - var ret string - return ret - } - return *o.Description.Get() -} - -// GetDescriptionOk returns a tuple with the Description 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 *ServiceLevelObjectiveRequest) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Description.Get(), o.Description.IsSet() -} - -// HasDescription returns a boolean if a field has been set. -func (o *ServiceLevelObjectiveRequest) HasDescription() bool { - if o != nil && o.Description.IsSet() { - return true - } - - return false -} - -// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. -func (o *ServiceLevelObjectiveRequest) SetDescription(v string) { - o.Description.Set(&v) -} - -// SetDescriptionNil sets the value for Description to be an explicit nil. -func (o *ServiceLevelObjectiveRequest) SetDescriptionNil() { - o.Description.Set(nil) -} - -// UnsetDescription ensures that no value is present for Description, not even an explicit nil. -func (o *ServiceLevelObjectiveRequest) UnsetDescription() { - o.Description.Unset() -} - -// GetGroups returns the Groups field value if set, zero value otherwise. -func (o *ServiceLevelObjectiveRequest) GetGroups() []string { - if o == nil || o.Groups == nil { - var ret []string - 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 *ServiceLevelObjectiveRequest) GetGroupsOk() (*[]string, 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 *ServiceLevelObjectiveRequest) HasGroups() bool { - if o != nil && o.Groups != nil { - return true - } - - return false -} - -// SetGroups gets a reference to the given []string and assigns it to the Groups field. -func (o *ServiceLevelObjectiveRequest) SetGroups(v []string) { - o.Groups = v -} - -// GetMonitorIds returns the MonitorIds field value if set, zero value otherwise. -func (o *ServiceLevelObjectiveRequest) GetMonitorIds() []int64 { - if o == nil || o.MonitorIds == nil { - var ret []int64 - return ret - } - return o.MonitorIds -} - -// GetMonitorIdsOk returns a tuple with the MonitorIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjectiveRequest) GetMonitorIdsOk() (*[]int64, bool) { - if o == nil || o.MonitorIds == nil { - return nil, false - } - return &o.MonitorIds, true -} - -// HasMonitorIds returns a boolean if a field has been set. -func (o *ServiceLevelObjectiveRequest) HasMonitorIds() bool { - if o != nil && o.MonitorIds != nil { - return true - } - - return false -} - -// SetMonitorIds gets a reference to the given []int64 and assigns it to the MonitorIds field. -func (o *ServiceLevelObjectiveRequest) SetMonitorIds(v []int64) { - o.MonitorIds = v -} - -// GetName returns the Name field value. -func (o *ServiceLevelObjectiveRequest) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjectiveRequest) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *ServiceLevelObjectiveRequest) SetName(v string) { - o.Name = v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *ServiceLevelObjectiveRequest) GetQuery() ServiceLevelObjectiveQuery { - if o == nil || o.Query == nil { - var ret ServiceLevelObjectiveQuery - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjectiveRequest) GetQueryOk() (*ServiceLevelObjectiveQuery, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *ServiceLevelObjectiveRequest) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given ServiceLevelObjectiveQuery and assigns it to the Query field. -func (o *ServiceLevelObjectiveRequest) SetQuery(v ServiceLevelObjectiveQuery) { - o.Query = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *ServiceLevelObjectiveRequest) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *ServiceLevelObjectiveRequest) GetTagsOk() (*[]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 *ServiceLevelObjectiveRequest) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *ServiceLevelObjectiveRequest) SetTags(v []string) { - o.Tags = v -} - -// GetThresholds returns the Thresholds field value. -func (o *ServiceLevelObjectiveRequest) GetThresholds() []SLOThreshold { - if o == nil { - var ret []SLOThreshold - return ret - } - return o.Thresholds -} - -// GetThresholdsOk returns a tuple with the Thresholds field value -// and a boolean to check if the value has been set. -func (o *ServiceLevelObjectiveRequest) GetThresholdsOk() (*[]SLOThreshold, bool) { - if o == nil { - return nil, false - } - return &o.Thresholds, true -} - -// SetThresholds sets field value. -func (o *ServiceLevelObjectiveRequest) SetThresholds(v []SLOThreshold) { - o.Thresholds = v -} - -// GetType returns the Type field value. -func (o *ServiceLevelObjectiveRequest) GetType() SLOType { - if o == nil { - var ret SLOType - 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 *ServiceLevelObjectiveRequest) GetTypeOk() (*SLOType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ServiceLevelObjectiveRequest) SetType(v SLOType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceLevelObjectiveRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Description.IsSet() { - toSerialize["description"] = o.Description.Get() - } - if o.Groups != nil { - toSerialize["groups"] = o.Groups - } - if o.MonitorIds != nil { - toSerialize["monitor_ids"] = o.MonitorIds - } - toSerialize["name"] = o.Name - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - toSerialize["thresholds"] = o.Thresholds - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Thresholds *[]SLOThreshold `json:"thresholds"` - Type *SLOType `json:"type"` - }{} - all := struct { - Description common.NullableString `json:"description,omitempty"` - Groups []string `json:"groups,omitempty"` - MonitorIds []int64 `json:"monitor_ids,omitempty"` - Name string `json:"name"` - Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` - Tags []string `json:"tags,omitempty"` - Thresholds []SLOThreshold `json:"thresholds"` - Type SLOType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Thresholds == nil { - return fmt.Errorf("Required field thresholds missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Description = all.Description - o.Groups = all.Groups - o.MonitorIds = all.MonitorIds - o.Name = all.Name - if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Query = all.Query - o.Tags = all.Tags - o.Thresholds = all.Thresholds - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_service_map_widget_definition.go b/api/v1/datadog/model_service_map_widget_definition.go deleted file mode 100644 index fe064ee0f7f..00000000000 --- a/api/v1/datadog/model_service_map_widget_definition.go +++ /dev/null @@ -1,343 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceMapWidgetDefinition This widget displays a map of a service to all of the services that call it, and all of the services that it calls. -type ServiceMapWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // Your environment and primary tag (or * if enabled for your account). - Filters []string `json:"filters"` - // The ID of the service you want to map. - Service string `json:"service"` - // The title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the service map widget. - Type ServiceMapWidgetDefinitionType `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{} -} - -// NewServiceMapWidgetDefinition instantiates a new ServiceMapWidgetDefinition 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 NewServiceMapWidgetDefinition(filters []string, service string, typeVar ServiceMapWidgetDefinitionType) *ServiceMapWidgetDefinition { - this := ServiceMapWidgetDefinition{} - this.Filters = filters - this.Service = service - this.Type = typeVar - return &this -} - -// NewServiceMapWidgetDefinitionWithDefaults instantiates a new ServiceMapWidgetDefinition 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 NewServiceMapWidgetDefinitionWithDefaults() *ServiceMapWidgetDefinition { - this := ServiceMapWidgetDefinition{} - var typeVar ServiceMapWidgetDefinitionType = SERVICEMAPWIDGETDEFINITIONTYPE_SERVICEMAP - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *ServiceMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *ServiceMapWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *ServiceMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetFilters returns the Filters field value. -func (o *ServiceMapWidgetDefinition) GetFilters() []string { - if o == nil { - var ret []string - return ret - } - return o.Filters -} - -// GetFiltersOk returns a tuple with the Filters field value -// and a boolean to check if the value has been set. -func (o *ServiceMapWidgetDefinition) GetFiltersOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Filters, true -} - -// SetFilters sets field value. -func (o *ServiceMapWidgetDefinition) SetFilters(v []string) { - o.Filters = v -} - -// GetService returns the Service field value. -func (o *ServiceMapWidgetDefinition) GetService() string { - if o == nil { - var ret string - return ret - } - return o.Service -} - -// GetServiceOk returns a tuple with the Service field value -// and a boolean to check if the value has been set. -func (o *ServiceMapWidgetDefinition) GetServiceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Service, true -} - -// SetService sets field value. -func (o *ServiceMapWidgetDefinition) SetService(v string) { - o.Service = v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *ServiceMapWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceMapWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *ServiceMapWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *ServiceMapWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *ServiceMapWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceMapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *ServiceMapWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *ServiceMapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *ServiceMapWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceMapWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *ServiceMapWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *ServiceMapWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *ServiceMapWidgetDefinition) GetType() ServiceMapWidgetDefinitionType { - if o == nil { - var ret ServiceMapWidgetDefinitionType - 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 *ServiceMapWidgetDefinition) GetTypeOk() (*ServiceMapWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ServiceMapWidgetDefinition) SetType(v ServiceMapWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceMapWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - toSerialize["filters"] = o.Filters - toSerialize["service"] = o.Service - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Filters *[]string `json:"filters"` - Service *string `json:"service"` - Type *ServiceMapWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Filters []string `json:"filters"` - Service string `json:"service"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ServiceMapWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Filters == nil { - return fmt.Errorf("Required field filters missing") - } - if required.Service == nil { - return fmt.Errorf("Required field service missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.Filters = all.Filters - o.Service = all.Service - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_service_map_widget_definition_type.go b/api/v1/datadog/model_service_map_widget_definition_type.go deleted file mode 100644 index f084b19964c..00000000000 --- a/api/v1/datadog/model_service_map_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceMapWidgetDefinitionType Type of the service map widget. -type ServiceMapWidgetDefinitionType string - -// List of ServiceMapWidgetDefinitionType. -const ( - SERVICEMAPWIDGETDEFINITIONTYPE_SERVICEMAP ServiceMapWidgetDefinitionType = "servicemap" -) - -var allowedServiceMapWidgetDefinitionTypeEnumValues = []ServiceMapWidgetDefinitionType{ - SERVICEMAPWIDGETDEFINITIONTYPE_SERVICEMAP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ServiceMapWidgetDefinitionType) GetAllowedValues() []ServiceMapWidgetDefinitionType { - return allowedServiceMapWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ServiceMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ServiceMapWidgetDefinitionType(value) - return nil -} - -// NewServiceMapWidgetDefinitionTypeFromValue returns a pointer to a valid ServiceMapWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewServiceMapWidgetDefinitionTypeFromValue(v string) (*ServiceMapWidgetDefinitionType, error) { - ev := ServiceMapWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ServiceMapWidgetDefinitionType: valid values are %v", v, allowedServiceMapWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ServiceMapWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedServiceMapWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ServiceMapWidgetDefinitionType value. -func (v ServiceMapWidgetDefinitionType) Ptr() *ServiceMapWidgetDefinitionType { - return &v -} - -// NullableServiceMapWidgetDefinitionType handles when a null is used for ServiceMapWidgetDefinitionType. -type NullableServiceMapWidgetDefinitionType struct { - value *ServiceMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceMapWidgetDefinitionType) Get() *ServiceMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceMapWidgetDefinitionType) Set(val *ServiceMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableServiceMapWidgetDefinitionType(val *ServiceMapWidgetDefinitionType) *NullableServiceMapWidgetDefinitionType { - return &NullableServiceMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_service_summary_widget_definition.go b/api/v1/datadog/model_service_summary_widget_definition.go deleted file mode 100644 index a47b4a89fb3..00000000000 --- a/api/v1/datadog/model_service_summary_widget_definition.go +++ /dev/null @@ -1,711 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceSummaryWidgetDefinition The service summary displays the graphs of a chosen service in your screenboard. Only available on FREE layout dashboards. -type ServiceSummaryWidgetDefinition struct { - // Number of columns to display. - DisplayFormat *WidgetServiceSummaryDisplayFormat `json:"display_format,omitempty"` - // APM environment. - Env string `json:"env"` - // APM service. - Service string `json:"service"` - // Whether to show the latency breakdown or not. - ShowBreakdown *bool `json:"show_breakdown,omitempty"` - // Whether to show the latency distribution or not. - ShowDistribution *bool `json:"show_distribution,omitempty"` - // Whether to show the error metrics or not. - ShowErrors *bool `json:"show_errors,omitempty"` - // Whether to show the hits metrics or not. - ShowHits *bool `json:"show_hits,omitempty"` - // Whether to show the latency metrics or not. - ShowLatency *bool `json:"show_latency,omitempty"` - // Whether to show the resource list or not. - ShowResourceList *bool `json:"show_resource_list,omitempty"` - // Size of the widget. - SizeFormat *WidgetSizeFormat `json:"size_format,omitempty"` - // APM span name. - SpanName string `json:"span_name"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the service summary widget. - Type ServiceSummaryWidgetDefinitionType `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{} -} - -// NewServiceSummaryWidgetDefinition instantiates a new ServiceSummaryWidgetDefinition 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 NewServiceSummaryWidgetDefinition(env string, service string, spanName string, typeVar ServiceSummaryWidgetDefinitionType) *ServiceSummaryWidgetDefinition { - this := ServiceSummaryWidgetDefinition{} - this.Env = env - this.Service = service - this.SpanName = spanName - this.Type = typeVar - return &this -} - -// NewServiceSummaryWidgetDefinitionWithDefaults instantiates a new ServiceSummaryWidgetDefinition 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 NewServiceSummaryWidgetDefinitionWithDefaults() *ServiceSummaryWidgetDefinition { - this := ServiceSummaryWidgetDefinition{} - var typeVar ServiceSummaryWidgetDefinitionType = SERVICESUMMARYWIDGETDEFINITIONTYPE_TRACE_SERVICE - this.Type = typeVar - return &this -} - -// GetDisplayFormat returns the DisplayFormat field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetDisplayFormat() WidgetServiceSummaryDisplayFormat { - if o == nil || o.DisplayFormat == nil { - var ret WidgetServiceSummaryDisplayFormat - return ret - } - return *o.DisplayFormat -} - -// GetDisplayFormatOk returns a tuple with the DisplayFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetDisplayFormatOk() (*WidgetServiceSummaryDisplayFormat, bool) { - if o == nil || o.DisplayFormat == nil { - return nil, false - } - return o.DisplayFormat, true -} - -// HasDisplayFormat returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasDisplayFormat() bool { - if o != nil && o.DisplayFormat != nil { - return true - } - - return false -} - -// SetDisplayFormat gets a reference to the given WidgetServiceSummaryDisplayFormat and assigns it to the DisplayFormat field. -func (o *ServiceSummaryWidgetDefinition) SetDisplayFormat(v WidgetServiceSummaryDisplayFormat) { - o.DisplayFormat = &v -} - -// GetEnv returns the Env field value. -func (o *ServiceSummaryWidgetDefinition) GetEnv() string { - if o == nil { - var ret string - return ret - } - return o.Env -} - -// GetEnvOk returns a tuple with the Env field value -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetEnvOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Env, true -} - -// SetEnv sets field value. -func (o *ServiceSummaryWidgetDefinition) SetEnv(v string) { - o.Env = v -} - -// GetService returns the Service field value. -func (o *ServiceSummaryWidgetDefinition) GetService() string { - if o == nil { - var ret string - return ret - } - return o.Service -} - -// GetServiceOk returns a tuple with the Service field value -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetServiceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Service, true -} - -// SetService sets field value. -func (o *ServiceSummaryWidgetDefinition) SetService(v string) { - o.Service = v -} - -// GetShowBreakdown returns the ShowBreakdown field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetShowBreakdown() bool { - if o == nil || o.ShowBreakdown == nil { - var ret bool - return ret - } - return *o.ShowBreakdown -} - -// GetShowBreakdownOk returns a tuple with the ShowBreakdown field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetShowBreakdownOk() (*bool, bool) { - if o == nil || o.ShowBreakdown == nil { - return nil, false - } - return o.ShowBreakdown, true -} - -// HasShowBreakdown returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasShowBreakdown() bool { - if o != nil && o.ShowBreakdown != nil { - return true - } - - return false -} - -// SetShowBreakdown gets a reference to the given bool and assigns it to the ShowBreakdown field. -func (o *ServiceSummaryWidgetDefinition) SetShowBreakdown(v bool) { - o.ShowBreakdown = &v -} - -// GetShowDistribution returns the ShowDistribution field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetShowDistribution() bool { - if o == nil || o.ShowDistribution == nil { - var ret bool - return ret - } - return *o.ShowDistribution -} - -// GetShowDistributionOk returns a tuple with the ShowDistribution field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetShowDistributionOk() (*bool, bool) { - if o == nil || o.ShowDistribution == nil { - return nil, false - } - return o.ShowDistribution, true -} - -// HasShowDistribution returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasShowDistribution() bool { - if o != nil && o.ShowDistribution != nil { - return true - } - - return false -} - -// SetShowDistribution gets a reference to the given bool and assigns it to the ShowDistribution field. -func (o *ServiceSummaryWidgetDefinition) SetShowDistribution(v bool) { - o.ShowDistribution = &v -} - -// GetShowErrors returns the ShowErrors field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetShowErrors() bool { - if o == nil || o.ShowErrors == nil { - var ret bool - return ret - } - return *o.ShowErrors -} - -// GetShowErrorsOk returns a tuple with the ShowErrors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetShowErrorsOk() (*bool, bool) { - if o == nil || o.ShowErrors == nil { - return nil, false - } - return o.ShowErrors, true -} - -// HasShowErrors returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasShowErrors() bool { - if o != nil && o.ShowErrors != nil { - return true - } - - return false -} - -// SetShowErrors gets a reference to the given bool and assigns it to the ShowErrors field. -func (o *ServiceSummaryWidgetDefinition) SetShowErrors(v bool) { - o.ShowErrors = &v -} - -// GetShowHits returns the ShowHits field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetShowHits() bool { - if o == nil || o.ShowHits == nil { - var ret bool - return ret - } - return *o.ShowHits -} - -// GetShowHitsOk returns a tuple with the ShowHits field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetShowHitsOk() (*bool, bool) { - if o == nil || o.ShowHits == nil { - return nil, false - } - return o.ShowHits, true -} - -// HasShowHits returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasShowHits() bool { - if o != nil && o.ShowHits != nil { - return true - } - - return false -} - -// SetShowHits gets a reference to the given bool and assigns it to the ShowHits field. -func (o *ServiceSummaryWidgetDefinition) SetShowHits(v bool) { - o.ShowHits = &v -} - -// GetShowLatency returns the ShowLatency field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetShowLatency() bool { - if o == nil || o.ShowLatency == nil { - var ret bool - return ret - } - return *o.ShowLatency -} - -// GetShowLatencyOk returns a tuple with the ShowLatency field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetShowLatencyOk() (*bool, bool) { - if o == nil || o.ShowLatency == nil { - return nil, false - } - return o.ShowLatency, true -} - -// HasShowLatency returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasShowLatency() bool { - if o != nil && o.ShowLatency != nil { - return true - } - - return false -} - -// SetShowLatency gets a reference to the given bool and assigns it to the ShowLatency field. -func (o *ServiceSummaryWidgetDefinition) SetShowLatency(v bool) { - o.ShowLatency = &v -} - -// GetShowResourceList returns the ShowResourceList field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetShowResourceList() bool { - if o == nil || o.ShowResourceList == nil { - var ret bool - return ret - } - return *o.ShowResourceList -} - -// GetShowResourceListOk returns a tuple with the ShowResourceList field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetShowResourceListOk() (*bool, bool) { - if o == nil || o.ShowResourceList == nil { - return nil, false - } - return o.ShowResourceList, true -} - -// HasShowResourceList returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasShowResourceList() bool { - if o != nil && o.ShowResourceList != nil { - return true - } - - return false -} - -// SetShowResourceList gets a reference to the given bool and assigns it to the ShowResourceList field. -func (o *ServiceSummaryWidgetDefinition) SetShowResourceList(v bool) { - o.ShowResourceList = &v -} - -// GetSizeFormat returns the SizeFormat field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetSizeFormat() WidgetSizeFormat { - if o == nil || o.SizeFormat == nil { - var ret WidgetSizeFormat - return ret - } - return *o.SizeFormat -} - -// GetSizeFormatOk returns a tuple with the SizeFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetSizeFormatOk() (*WidgetSizeFormat, bool) { - if o == nil || o.SizeFormat == nil { - return nil, false - } - return o.SizeFormat, true -} - -// HasSizeFormat returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasSizeFormat() bool { - if o != nil && o.SizeFormat != nil { - return true - } - - return false -} - -// SetSizeFormat gets a reference to the given WidgetSizeFormat and assigns it to the SizeFormat field. -func (o *ServiceSummaryWidgetDefinition) SetSizeFormat(v WidgetSizeFormat) { - o.SizeFormat = &v -} - -// GetSpanName returns the SpanName field value. -func (o *ServiceSummaryWidgetDefinition) GetSpanName() string { - if o == nil { - var ret string - return ret - } - return o.SpanName -} - -// GetSpanNameOk returns a tuple with the SpanName field value -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetSpanNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.SpanName, true -} - -// SetSpanName sets field value. -func (o *ServiceSummaryWidgetDefinition) SetSpanName(v string) { - o.SpanName = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *ServiceSummaryWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *ServiceSummaryWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *ServiceSummaryWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *ServiceSummaryWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceSummaryWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *ServiceSummaryWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *ServiceSummaryWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *ServiceSummaryWidgetDefinition) GetType() ServiceSummaryWidgetDefinitionType { - if o == nil { - var ret ServiceSummaryWidgetDefinitionType - 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 *ServiceSummaryWidgetDefinition) GetTypeOk() (*ServiceSummaryWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ServiceSummaryWidgetDefinition) SetType(v ServiceSummaryWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DisplayFormat != nil { - toSerialize["display_format"] = o.DisplayFormat - } - toSerialize["env"] = o.Env - toSerialize["service"] = o.Service - if o.ShowBreakdown != nil { - toSerialize["show_breakdown"] = o.ShowBreakdown - } - if o.ShowDistribution != nil { - toSerialize["show_distribution"] = o.ShowDistribution - } - if o.ShowErrors != nil { - toSerialize["show_errors"] = o.ShowErrors - } - if o.ShowHits != nil { - toSerialize["show_hits"] = o.ShowHits - } - if o.ShowLatency != nil { - toSerialize["show_latency"] = o.ShowLatency - } - if o.ShowResourceList != nil { - toSerialize["show_resource_list"] = o.ShowResourceList - } - if o.SizeFormat != nil { - toSerialize["size_format"] = o.SizeFormat - } - toSerialize["span_name"] = o.SpanName - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Env *string `json:"env"` - Service *string `json:"service"` - SpanName *string `json:"span_name"` - Type *ServiceSummaryWidgetDefinitionType `json:"type"` - }{} - all := struct { - DisplayFormat *WidgetServiceSummaryDisplayFormat `json:"display_format,omitempty"` - Env string `json:"env"` - Service string `json:"service"` - ShowBreakdown *bool `json:"show_breakdown,omitempty"` - ShowDistribution *bool `json:"show_distribution,omitempty"` - ShowErrors *bool `json:"show_errors,omitempty"` - ShowHits *bool `json:"show_hits,omitempty"` - ShowLatency *bool `json:"show_latency,omitempty"` - ShowResourceList *bool `json:"show_resource_list,omitempty"` - SizeFormat *WidgetSizeFormat `json:"size_format,omitempty"` - SpanName string `json:"span_name"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ServiceSummaryWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Env == nil { - return fmt.Errorf("Required field env missing") - } - if required.Service == nil { - return fmt.Errorf("Required field service missing") - } - if required.SpanName == nil { - return fmt.Errorf("Required field span_name missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DisplayFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.SizeFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DisplayFormat = all.DisplayFormat - o.Env = all.Env - o.Service = all.Service - o.ShowBreakdown = all.ShowBreakdown - o.ShowDistribution = all.ShowDistribution - o.ShowErrors = all.ShowErrors - o.ShowHits = all.ShowHits - o.ShowLatency = all.ShowLatency - o.ShowResourceList = all.ShowResourceList - o.SizeFormat = all.SizeFormat - o.SpanName = all.SpanName - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_service_summary_widget_definition_type.go b/api/v1/datadog/model_service_summary_widget_definition_type.go deleted file mode 100644 index dce7f9690f4..00000000000 --- a/api/v1/datadog/model_service_summary_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceSummaryWidgetDefinitionType Type of the service summary widget. -type ServiceSummaryWidgetDefinitionType string - -// List of ServiceSummaryWidgetDefinitionType. -const ( - SERVICESUMMARYWIDGETDEFINITIONTYPE_TRACE_SERVICE ServiceSummaryWidgetDefinitionType = "trace_service" -) - -var allowedServiceSummaryWidgetDefinitionTypeEnumValues = []ServiceSummaryWidgetDefinitionType{ - SERVICESUMMARYWIDGETDEFINITIONTYPE_TRACE_SERVICE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ServiceSummaryWidgetDefinitionType) GetAllowedValues() []ServiceSummaryWidgetDefinitionType { - return allowedServiceSummaryWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ServiceSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ServiceSummaryWidgetDefinitionType(value) - return nil -} - -// NewServiceSummaryWidgetDefinitionTypeFromValue returns a pointer to a valid ServiceSummaryWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewServiceSummaryWidgetDefinitionTypeFromValue(v string) (*ServiceSummaryWidgetDefinitionType, error) { - ev := ServiceSummaryWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ServiceSummaryWidgetDefinitionType: valid values are %v", v, allowedServiceSummaryWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ServiceSummaryWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedServiceSummaryWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ServiceSummaryWidgetDefinitionType value. -func (v ServiceSummaryWidgetDefinitionType) Ptr() *ServiceSummaryWidgetDefinitionType { - return &v -} - -// NullableServiceSummaryWidgetDefinitionType handles when a null is used for ServiceSummaryWidgetDefinitionType. -type NullableServiceSummaryWidgetDefinitionType struct { - value *ServiceSummaryWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableServiceSummaryWidgetDefinitionType) Get() *ServiceSummaryWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableServiceSummaryWidgetDefinitionType) Set(val *ServiceSummaryWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableServiceSummaryWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableServiceSummaryWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableServiceSummaryWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableServiceSummaryWidgetDefinitionType(val *ServiceSummaryWidgetDefinitionType) *NullableServiceSummaryWidgetDefinitionType { - return &NullableServiceSummaryWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableServiceSummaryWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableServiceSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_signal_archive_reason.go b/api/v1/datadog/model_signal_archive_reason.go deleted file mode 100644 index 88fac37466a..00000000000 --- a/api/v1/datadog/model_signal_archive_reason.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SignalArchiveReason Reason why a signal has been archived. -type SignalArchiveReason string - -// List of SignalArchiveReason. -const ( - SIGNALARCHIVEREASON_NONE SignalArchiveReason = "none" - SIGNALARCHIVEREASON_FALSE_POSITIVE SignalArchiveReason = "false_positive" - SIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE SignalArchiveReason = "testing_or_maintenance" - SIGNALARCHIVEREASON_OTHER SignalArchiveReason = "other" -) - -var allowedSignalArchiveReasonEnumValues = []SignalArchiveReason{ - SIGNALARCHIVEREASON_NONE, - SIGNALARCHIVEREASON_FALSE_POSITIVE, - SIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE, - SIGNALARCHIVEREASON_OTHER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SignalArchiveReason) GetAllowedValues() []SignalArchiveReason { - return allowedSignalArchiveReasonEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SignalArchiveReason) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SignalArchiveReason(value) - return nil -} - -// NewSignalArchiveReasonFromValue returns a pointer to a valid SignalArchiveReason -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSignalArchiveReasonFromValue(v string) (*SignalArchiveReason, error) { - ev := SignalArchiveReason(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SignalArchiveReason: valid values are %v", v, allowedSignalArchiveReasonEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SignalArchiveReason) IsValid() bool { - for _, existing := range allowedSignalArchiveReasonEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SignalArchiveReason value. -func (v SignalArchiveReason) Ptr() *SignalArchiveReason { - return &v -} - -// NullableSignalArchiveReason handles when a null is used for SignalArchiveReason. -type NullableSignalArchiveReason struct { - value *SignalArchiveReason - isSet bool -} - -// Get returns the associated value. -func (v NullableSignalArchiveReason) Get() *SignalArchiveReason { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSignalArchiveReason) Set(val *SignalArchiveReason) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSignalArchiveReason) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSignalArchiveReason) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSignalArchiveReason initializes the struct as if Set has been called. -func NewNullableSignalArchiveReason(val *SignalArchiveReason) *NullableSignalArchiveReason { - return &NullableSignalArchiveReason{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSignalArchiveReason) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSignalArchiveReason) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_signal_assignee_update_request.go b/api/v1/datadog/model_signal_assignee_update_request.go deleted file mode 100644 index 713825df8e8..00000000000 --- a/api/v1/datadog/model_signal_assignee_update_request.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SignalAssigneeUpdateRequest Attributes describing an assignee update operation over a security signal. -type SignalAssigneeUpdateRequest struct { - // The UUID of the user being assigned. Use empty string to return signal to unassigned. - Assignee string `json:"assignee"` - // Version of the updated signal. If server side version is higher, update will be rejected. - Version *int64 `json:"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{} -} - -// NewSignalAssigneeUpdateRequest instantiates a new SignalAssigneeUpdateRequest 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 NewSignalAssigneeUpdateRequest(assignee string) *SignalAssigneeUpdateRequest { - this := SignalAssigneeUpdateRequest{} - this.Assignee = assignee - return &this -} - -// NewSignalAssigneeUpdateRequestWithDefaults instantiates a new SignalAssigneeUpdateRequest 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 NewSignalAssigneeUpdateRequestWithDefaults() *SignalAssigneeUpdateRequest { - this := SignalAssigneeUpdateRequest{} - return &this -} - -// GetAssignee returns the Assignee field value. -func (o *SignalAssigneeUpdateRequest) GetAssignee() string { - if o == nil { - var ret string - return ret - } - return o.Assignee -} - -// GetAssigneeOk returns a tuple with the Assignee field value -// and a boolean to check if the value has been set. -func (o *SignalAssigneeUpdateRequest) GetAssigneeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Assignee, true -} - -// SetAssignee sets field value. -func (o *SignalAssigneeUpdateRequest) SetAssignee(v string) { - o.Assignee = v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SignalAssigneeUpdateRequest) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SignalAssigneeUpdateRequest) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SignalAssigneeUpdateRequest) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *SignalAssigneeUpdateRequest) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SignalAssigneeUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["assignee"] = o.Assignee - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Assignee *string `json:"assignee"` - }{} - all := struct { - Assignee string `json:"assignee"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assignee == nil { - return fmt.Errorf("Required field assignee missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Assignee = all.Assignee - o.Version = all.Version - return nil -} diff --git a/api/v1/datadog/model_signal_state_update_request.go b/api/v1/datadog/model_signal_state_update_request.go deleted file mode 100644 index 3d24a6d99fc..00000000000 --- a/api/v1/datadog/model_signal_state_update_request.go +++ /dev/null @@ -1,236 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SignalStateUpdateRequest Attributes describing the change of state for a given state. -type SignalStateUpdateRequest struct { - // Optional comment to explain why a signal is being archived. - ArchiveComment *string `json:"archiveComment,omitempty"` - // Reason why a signal has been archived. - ArchiveReason *SignalArchiveReason `json:"archiveReason,omitempty"` - // The new triage state of the signal. - State SignalTriageState `json:"state"` - // Version of the updated signal. If server side version is higher, update will be rejected. - Version *int64 `json:"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{} -} - -// NewSignalStateUpdateRequest instantiates a new SignalStateUpdateRequest 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 NewSignalStateUpdateRequest(state SignalTriageState) *SignalStateUpdateRequest { - this := SignalStateUpdateRequest{} - this.State = state - return &this -} - -// NewSignalStateUpdateRequestWithDefaults instantiates a new SignalStateUpdateRequest 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 NewSignalStateUpdateRequestWithDefaults() *SignalStateUpdateRequest { - this := SignalStateUpdateRequest{} - return &this -} - -// GetArchiveComment returns the ArchiveComment field value if set, zero value otherwise. -func (o *SignalStateUpdateRequest) GetArchiveComment() string { - if o == nil || o.ArchiveComment == nil { - var ret string - return ret - } - return *o.ArchiveComment -} - -// GetArchiveCommentOk returns a tuple with the ArchiveComment field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SignalStateUpdateRequest) GetArchiveCommentOk() (*string, bool) { - if o == nil || o.ArchiveComment == nil { - return nil, false - } - return o.ArchiveComment, true -} - -// HasArchiveComment returns a boolean if a field has been set. -func (o *SignalStateUpdateRequest) HasArchiveComment() bool { - if o != nil && o.ArchiveComment != nil { - return true - } - - return false -} - -// SetArchiveComment gets a reference to the given string and assigns it to the ArchiveComment field. -func (o *SignalStateUpdateRequest) SetArchiveComment(v string) { - o.ArchiveComment = &v -} - -// GetArchiveReason returns the ArchiveReason field value if set, zero value otherwise. -func (o *SignalStateUpdateRequest) GetArchiveReason() SignalArchiveReason { - if o == nil || o.ArchiveReason == nil { - var ret SignalArchiveReason - return ret - } - return *o.ArchiveReason -} - -// GetArchiveReasonOk returns a tuple with the ArchiveReason field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SignalStateUpdateRequest) GetArchiveReasonOk() (*SignalArchiveReason, bool) { - if o == nil || o.ArchiveReason == nil { - return nil, false - } - return o.ArchiveReason, true -} - -// HasArchiveReason returns a boolean if a field has been set. -func (o *SignalStateUpdateRequest) HasArchiveReason() bool { - if o != nil && o.ArchiveReason != nil { - return true - } - - return false -} - -// SetArchiveReason gets a reference to the given SignalArchiveReason and assigns it to the ArchiveReason field. -func (o *SignalStateUpdateRequest) SetArchiveReason(v SignalArchiveReason) { - o.ArchiveReason = &v -} - -// GetState returns the State field value. -func (o *SignalStateUpdateRequest) GetState() SignalTriageState { - if o == nil { - var ret SignalTriageState - return ret - } - return o.State -} - -// GetStateOk returns a tuple with the State field value -// and a boolean to check if the value has been set. -func (o *SignalStateUpdateRequest) GetStateOk() (*SignalTriageState, bool) { - if o == nil { - return nil, false - } - return &o.State, true -} - -// SetState sets field value. -func (o *SignalStateUpdateRequest) SetState(v SignalTriageState) { - o.State = v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SignalStateUpdateRequest) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SignalStateUpdateRequest) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SignalStateUpdateRequest) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *SignalStateUpdateRequest) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SignalStateUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ArchiveComment != nil { - toSerialize["archiveComment"] = o.ArchiveComment - } - if o.ArchiveReason != nil { - toSerialize["archiveReason"] = o.ArchiveReason - } - toSerialize["state"] = o.State - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - State *SignalTriageState `json:"state"` - }{} - all := struct { - ArchiveComment *string `json:"archiveComment,omitempty"` - ArchiveReason *SignalArchiveReason `json:"archiveReason,omitempty"` - State SignalTriageState `json:"state"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.State == nil { - return fmt.Errorf("Required field state missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ArchiveReason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.State; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ArchiveComment = all.ArchiveComment - o.ArchiveReason = all.ArchiveReason - o.State = all.State - o.Version = all.Version - return nil -} diff --git a/api/v1/datadog/model_signal_triage_state.go b/api/v1/datadog/model_signal_triage_state.go deleted file mode 100644 index fb063fd04d9..00000000000 --- a/api/v1/datadog/model_signal_triage_state.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SignalTriageState The new triage state of the signal. -type SignalTriageState string - -// List of SignalTriageState. -const ( - SIGNALTRIAGESTATE_OPEN SignalTriageState = "open" - SIGNALTRIAGESTATE_ARCHIVED SignalTriageState = "archived" - SIGNALTRIAGESTATE_UNDER_REVIEW SignalTriageState = "under_review" -) - -var allowedSignalTriageStateEnumValues = []SignalTriageState{ - SIGNALTRIAGESTATE_OPEN, - SIGNALTRIAGESTATE_ARCHIVED, - SIGNALTRIAGESTATE_UNDER_REVIEW, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SignalTriageState) GetAllowedValues() []SignalTriageState { - return allowedSignalTriageStateEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SignalTriageState) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SignalTriageState(value) - return nil -} - -// NewSignalTriageStateFromValue returns a pointer to a valid SignalTriageState -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSignalTriageStateFromValue(v string) (*SignalTriageState, error) { - ev := SignalTriageState(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SignalTriageState: valid values are %v", v, allowedSignalTriageStateEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SignalTriageState) IsValid() bool { - for _, existing := range allowedSignalTriageStateEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SignalTriageState value. -func (v SignalTriageState) Ptr() *SignalTriageState { - return &v -} - -// NullableSignalTriageState handles when a null is used for SignalTriageState. -type NullableSignalTriageState struct { - value *SignalTriageState - isSet bool -} - -// Get returns the associated value. -func (v NullableSignalTriageState) Get() *SignalTriageState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSignalTriageState) Set(val *SignalTriageState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSignalTriageState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSignalTriageState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSignalTriageState initializes the struct as if Set has been called. -func NewNullableSignalTriageState(val *SignalTriageState) *NullableSignalTriageState { - return &NullableSignalTriageState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSignalTriageState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSignalTriageState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slack_integration_channel.go b/api/v1/datadog/model_slack_integration_channel.go deleted file mode 100644 index daaddef9075..00000000000 --- a/api/v1/datadog/model_slack_integration_channel.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SlackIntegrationChannel The Slack channel configuration. -type SlackIntegrationChannel struct { - // Configuration options for what is shown in an alert event message. - Display *SlackIntegrationChannelDisplay `json:"display,omitempty"` - // Your channel name. - Name *string `json:"name,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{} -} - -// NewSlackIntegrationChannel instantiates a new SlackIntegrationChannel 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 NewSlackIntegrationChannel() *SlackIntegrationChannel { - this := SlackIntegrationChannel{} - return &this -} - -// NewSlackIntegrationChannelWithDefaults instantiates a new SlackIntegrationChannel 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 NewSlackIntegrationChannelWithDefaults() *SlackIntegrationChannel { - this := SlackIntegrationChannel{} - return &this -} - -// GetDisplay returns the Display field value if set, zero value otherwise. -func (o *SlackIntegrationChannel) GetDisplay() SlackIntegrationChannelDisplay { - if o == nil || o.Display == nil { - var ret SlackIntegrationChannelDisplay - return ret - } - return *o.Display -} - -// GetDisplayOk returns a tuple with the Display field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SlackIntegrationChannel) GetDisplayOk() (*SlackIntegrationChannelDisplay, bool) { - if o == nil || o.Display == nil { - return nil, false - } - return o.Display, true -} - -// HasDisplay returns a boolean if a field has been set. -func (o *SlackIntegrationChannel) HasDisplay() bool { - if o != nil && o.Display != nil { - return true - } - - return false -} - -// SetDisplay gets a reference to the given SlackIntegrationChannelDisplay and assigns it to the Display field. -func (o *SlackIntegrationChannel) SetDisplay(v SlackIntegrationChannelDisplay) { - o.Display = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SlackIntegrationChannel) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SlackIntegrationChannel) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SlackIntegrationChannel) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SlackIntegrationChannel) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SlackIntegrationChannel) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Display != nil { - toSerialize["display"] = o.Display - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SlackIntegrationChannel) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Display *SlackIntegrationChannelDisplay `json:"display,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Display != nil && all.Display.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Display = all.Display - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_slack_integration_channel_display.go b/api/v1/datadog/model_slack_integration_channel_display.go deleted file mode 100644 index 6d886bc1c45..00000000000 --- a/api/v1/datadog/model_slack_integration_channel_display.go +++ /dev/null @@ -1,235 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SlackIntegrationChannelDisplay Configuration options for what is shown in an alert event message. -type SlackIntegrationChannelDisplay struct { - // Show the main body of the alert event. - Message *bool `json:"message,omitempty"` - // Show the list of @-handles in the alert event. - Notified *bool `json:"notified,omitempty"` - // Show the alert event's snapshot image. - Snapshot *bool `json:"snapshot,omitempty"` - // Show the scopes on which the monitor alerted. - Tags *bool `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{} -} - -// NewSlackIntegrationChannelDisplay instantiates a new SlackIntegrationChannelDisplay 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 NewSlackIntegrationChannelDisplay() *SlackIntegrationChannelDisplay { - this := SlackIntegrationChannelDisplay{} - var message bool = true - this.Message = &message - var notified bool = true - this.Notified = ¬ified - var snapshot bool = true - this.Snapshot = &snapshot - var tags bool = true - this.Tags = &tags - return &this -} - -// NewSlackIntegrationChannelDisplayWithDefaults instantiates a new SlackIntegrationChannelDisplay 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 NewSlackIntegrationChannelDisplayWithDefaults() *SlackIntegrationChannelDisplay { - this := SlackIntegrationChannelDisplay{} - var message bool = true - this.Message = &message - var notified bool = true - this.Notified = ¬ified - var snapshot bool = true - this.Snapshot = &snapshot - var tags bool = true - this.Tags = &tags - return &this -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SlackIntegrationChannelDisplay) GetMessage() bool { - if o == nil || o.Message == nil { - var ret bool - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SlackIntegrationChannelDisplay) GetMessageOk() (*bool, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SlackIntegrationChannelDisplay) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given bool and assigns it to the Message field. -func (o *SlackIntegrationChannelDisplay) SetMessage(v bool) { - o.Message = &v -} - -// GetNotified returns the Notified field value if set, zero value otherwise. -func (o *SlackIntegrationChannelDisplay) GetNotified() bool { - if o == nil || o.Notified == nil { - var ret bool - return ret - } - return *o.Notified -} - -// GetNotifiedOk returns a tuple with the Notified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SlackIntegrationChannelDisplay) GetNotifiedOk() (*bool, bool) { - if o == nil || o.Notified == nil { - return nil, false - } - return o.Notified, true -} - -// HasNotified returns a boolean if a field has been set. -func (o *SlackIntegrationChannelDisplay) HasNotified() bool { - if o != nil && o.Notified != nil { - return true - } - - return false -} - -// SetNotified gets a reference to the given bool and assigns it to the Notified field. -func (o *SlackIntegrationChannelDisplay) SetNotified(v bool) { - o.Notified = &v -} - -// GetSnapshot returns the Snapshot field value if set, zero value otherwise. -func (o *SlackIntegrationChannelDisplay) GetSnapshot() bool { - if o == nil || o.Snapshot == nil { - var ret bool - return ret - } - return *o.Snapshot -} - -// GetSnapshotOk returns a tuple with the Snapshot field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SlackIntegrationChannelDisplay) GetSnapshotOk() (*bool, bool) { - if o == nil || o.Snapshot == nil { - return nil, false - } - return o.Snapshot, true -} - -// HasSnapshot returns a boolean if a field has been set. -func (o *SlackIntegrationChannelDisplay) HasSnapshot() bool { - if o != nil && o.Snapshot != nil { - return true - } - - return false -} - -// SetSnapshot gets a reference to the given bool and assigns it to the Snapshot field. -func (o *SlackIntegrationChannelDisplay) SetSnapshot(v bool) { - o.Snapshot = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SlackIntegrationChannelDisplay) GetTags() bool { - if o == nil || o.Tags == nil { - var ret bool - 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 *SlackIntegrationChannelDisplay) GetTagsOk() (*bool, 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 *SlackIntegrationChannelDisplay) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given bool and assigns it to the Tags field. -func (o *SlackIntegrationChannelDisplay) SetTags(v bool) { - o.Tags = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SlackIntegrationChannelDisplay) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Notified != nil { - toSerialize["notified"] = o.Notified - } - if o.Snapshot != nil { - toSerialize["snapshot"] = o.Snapshot - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SlackIntegrationChannelDisplay) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Message *bool `json:"message,omitempty"` - Notified *bool `json:"notified,omitempty"` - Snapshot *bool `json:"snapshot,omitempty"` - Tags *bool `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Message = all.Message - o.Notified = all.Notified - o.Snapshot = all.Snapshot - o.Tags = all.Tags - return nil -} diff --git a/api/v1/datadog/model_slo_bulk_delete_error.go b/api/v1/datadog/model_slo_bulk_delete_error.go deleted file mode 100644 index 9be42bd43c4..00000000000 --- a/api/v1/datadog/model_slo_bulk_delete_error.go +++ /dev/null @@ -1,179 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOBulkDeleteError Object describing the error. -type SLOBulkDeleteError struct { - // The ID of the service level objective object associated with - // this error. - Id string `json:"id"` - // The error message. - Message string `json:"message"` - // The timeframe of the threshold associated with this error - // or "all" if all thresholds are affected. - Timeframe SLOErrorTimeframe `json:"timeframe"` - // 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{} -} - -// NewSLOBulkDeleteError instantiates a new SLOBulkDeleteError 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 NewSLOBulkDeleteError(id string, message string, timeframe SLOErrorTimeframe) *SLOBulkDeleteError { - this := SLOBulkDeleteError{} - this.Id = id - this.Message = message - this.Timeframe = timeframe - return &this -} - -// NewSLOBulkDeleteErrorWithDefaults instantiates a new SLOBulkDeleteError 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 NewSLOBulkDeleteErrorWithDefaults() *SLOBulkDeleteError { - this := SLOBulkDeleteError{} - return &this -} - -// GetId returns the Id field value. -func (o *SLOBulkDeleteError) 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 *SLOBulkDeleteError) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *SLOBulkDeleteError) SetId(v string) { - o.Id = v -} - -// GetMessage returns the Message field value. -func (o *SLOBulkDeleteError) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *SLOBulkDeleteError) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *SLOBulkDeleteError) SetMessage(v string) { - o.Message = v -} - -// GetTimeframe returns the Timeframe field value. -func (o *SLOBulkDeleteError) GetTimeframe() SLOErrorTimeframe { - if o == nil { - var ret SLOErrorTimeframe - return ret - } - return o.Timeframe -} - -// GetTimeframeOk returns a tuple with the Timeframe field value -// and a boolean to check if the value has been set. -func (o *SLOBulkDeleteError) GetTimeframeOk() (*SLOErrorTimeframe, bool) { - if o == nil { - return nil, false - } - return &o.Timeframe, true -} - -// SetTimeframe sets field value. -func (o *SLOBulkDeleteError) SetTimeframe(v SLOErrorTimeframe) { - o.Timeframe = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOBulkDeleteError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["message"] = o.Message - toSerialize["timeframe"] = o.Timeframe - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOBulkDeleteError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Message *string `json:"message"` - Timeframe *SLOErrorTimeframe `json:"timeframe"` - }{} - all := struct { - Id string `json:"id"` - Message string `json:"message"` - Timeframe SLOErrorTimeframe `json:"timeframe"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - if required.Timeframe == nil { - return fmt.Errorf("Required field timeframe missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Timeframe; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Message = all.Message - o.Timeframe = all.Timeframe - return nil -} diff --git a/api/v1/datadog/model_slo_bulk_delete_response.go b/api/v1/datadog/model_slo_bulk_delete_response.go deleted file mode 100644 index 10842fa95e3..00000000000 --- a/api/v1/datadog/model_slo_bulk_delete_response.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOBulkDeleteResponse The bulk partial delete service level objective object endpoint -// response. -// -// This endpoint operates on multiple service level objective objects, so -// it may be partially successful. In such cases, the "data" and "error" -// fields in this response indicate which deletions succeeded and failed. -type SLOBulkDeleteResponse struct { - // An array of service level objective objects. - Data *SLOBulkDeleteResponseData `json:"data,omitempty"` - // Array of errors object returned. - Errors []SLOBulkDeleteError `json:"errors,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{} -} - -// NewSLOBulkDeleteResponse instantiates a new SLOBulkDeleteResponse 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 NewSLOBulkDeleteResponse() *SLOBulkDeleteResponse { - this := SLOBulkDeleteResponse{} - return &this -} - -// NewSLOBulkDeleteResponseWithDefaults instantiates a new SLOBulkDeleteResponse 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 NewSLOBulkDeleteResponseWithDefaults() *SLOBulkDeleteResponse { - this := SLOBulkDeleteResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOBulkDeleteResponse) GetData() SLOBulkDeleteResponseData { - if o == nil || o.Data == nil { - var ret SLOBulkDeleteResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOBulkDeleteResponse) GetDataOk() (*SLOBulkDeleteResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOBulkDeleteResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SLOBulkDeleteResponseData and assigns it to the Data field. -func (o *SLOBulkDeleteResponse) SetData(v SLOBulkDeleteResponseData) { - o.Data = &v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *SLOBulkDeleteResponse) GetErrors() []SLOBulkDeleteError { - if o == nil || o.Errors == nil { - var ret []SLOBulkDeleteError - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOBulkDeleteResponse) GetErrorsOk() (*[]SLOBulkDeleteError, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *SLOBulkDeleteResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []SLOBulkDeleteError and assigns it to the Errors field. -func (o *SLOBulkDeleteResponse) SetErrors(v []SLOBulkDeleteError) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOBulkDeleteResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOBulkDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SLOBulkDeleteResponseData `json:"data,omitempty"` - Errors []SLOBulkDeleteError `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Errors = all.Errors - return nil -} diff --git a/api/v1/datadog/model_slo_bulk_delete_response_data.go b/api/v1/datadog/model_slo_bulk_delete_response_data.go deleted file mode 100644 index d2aad858bb9..00000000000 --- a/api/v1/datadog/model_slo_bulk_delete_response_data.go +++ /dev/null @@ -1,144 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOBulkDeleteResponseData An array of service level objective objects. -type SLOBulkDeleteResponseData struct { - // An array of service level objective object IDs that indicates - // which objects that were completely deleted. - Deleted []string `json:"deleted,omitempty"` - // An array of service level objective object IDs that indicates - // which objects that were modified (objects for which at least one - // threshold was deleted, but that were not completely deleted). - Updated []string `json:"updated,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{} -} - -// NewSLOBulkDeleteResponseData instantiates a new SLOBulkDeleteResponseData 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 NewSLOBulkDeleteResponseData() *SLOBulkDeleteResponseData { - this := SLOBulkDeleteResponseData{} - return &this -} - -// NewSLOBulkDeleteResponseDataWithDefaults instantiates a new SLOBulkDeleteResponseData 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 NewSLOBulkDeleteResponseDataWithDefaults() *SLOBulkDeleteResponseData { - this := SLOBulkDeleteResponseData{} - return &this -} - -// GetDeleted returns the Deleted field value if set, zero value otherwise. -func (o *SLOBulkDeleteResponseData) GetDeleted() []string { - if o == nil || o.Deleted == nil { - var ret []string - return ret - } - return o.Deleted -} - -// GetDeletedOk returns a tuple with the Deleted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOBulkDeleteResponseData) GetDeletedOk() (*[]string, bool) { - if o == nil || o.Deleted == nil { - return nil, false - } - return &o.Deleted, true -} - -// HasDeleted returns a boolean if a field has been set. -func (o *SLOBulkDeleteResponseData) HasDeleted() bool { - if o != nil && o.Deleted != nil { - return true - } - - return false -} - -// SetDeleted gets a reference to the given []string and assigns it to the Deleted field. -func (o *SLOBulkDeleteResponseData) SetDeleted(v []string) { - o.Deleted = v -} - -// GetUpdated returns the Updated field value if set, zero value otherwise. -func (o *SLOBulkDeleteResponseData) GetUpdated() []string { - if o == nil || o.Updated == nil { - var ret []string - return ret - } - return o.Updated -} - -// GetUpdatedOk returns a tuple with the Updated field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOBulkDeleteResponseData) GetUpdatedOk() (*[]string, bool) { - if o == nil || o.Updated == nil { - return nil, false - } - return &o.Updated, true -} - -// HasUpdated returns a boolean if a field has been set. -func (o *SLOBulkDeleteResponseData) HasUpdated() bool { - if o != nil && o.Updated != nil { - return true - } - - return false -} - -// SetUpdated gets a reference to the given []string and assigns it to the Updated field. -func (o *SLOBulkDeleteResponseData) SetUpdated(v []string) { - o.Updated = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOBulkDeleteResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Deleted != nil { - toSerialize["deleted"] = o.Deleted - } - if o.Updated != nil { - toSerialize["updated"] = o.Updated - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOBulkDeleteResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Deleted []string `json:"deleted,omitempty"` - Updated []string `json:"updated,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Deleted = all.Deleted - o.Updated = all.Updated - return nil -} diff --git a/api/v1/datadog/model_slo_correction.go b/api/v1/datadog/model_slo_correction.go deleted file mode 100644 index 20e96341580..00000000000 --- a/api/v1/datadog/model_slo_correction.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrection The response object of a list of SLO corrections. -type SLOCorrection struct { - // The attribute object associated with the SLO correction. - Attributes *SLOCorrectionResponseAttributes `json:"attributes,omitempty"` - // The ID of the SLO correction. - Id *string `json:"id,omitempty"` - // SLO correction resource type. - Type *SLOCorrectionType `json:"type,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{} -} - -// NewSLOCorrection instantiates a new SLOCorrection 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 NewSLOCorrection() *SLOCorrection { - this := SLOCorrection{} - var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION - this.Type = &typeVar - return &this -} - -// NewSLOCorrectionWithDefaults instantiates a new SLOCorrection 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 NewSLOCorrectionWithDefaults() *SLOCorrection { - this := SLOCorrection{} - var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SLOCorrection) GetAttributes() SLOCorrectionResponseAttributes { - if o == nil || o.Attributes == nil { - var ret SLOCorrectionResponseAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrection) GetAttributesOk() (*SLOCorrectionResponseAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SLOCorrection) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SLOCorrectionResponseAttributes and assigns it to the Attributes field. -func (o *SLOCorrection) SetAttributes(v SLOCorrectionResponseAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SLOCorrection) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrection) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SLOCorrection) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SLOCorrection) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SLOCorrection) GetType() SLOCorrectionType { - if o == nil || o.Type == nil { - var ret SLOCorrectionType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrection) GetTypeOk() (*SLOCorrectionType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SLOCorrection) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SLOCorrectionType and assigns it to the Type field. -func (o *SLOCorrection) SetType(v SLOCorrectionType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrection) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrection) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *SLOCorrectionResponseAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *SLOCorrectionType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_slo_correction_category.go b/api/v1/datadog/model_slo_correction_category.go deleted file mode 100644 index 3a4bdc40304..00000000000 --- a/api/v1/datadog/model_slo_correction_category.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOCorrectionCategory Category the SLO correction belongs to. -type SLOCorrectionCategory string - -// List of SLOCorrectionCategory. -const ( - SLOCORRECTIONCATEGORY_SCHEDULED_MAINTENANCE SLOCorrectionCategory = "Scheduled Maintenance" - SLOCORRECTIONCATEGORY_OUTSIDE_BUSINESS_HOURS SLOCorrectionCategory = "Outside Business Hours" - SLOCORRECTIONCATEGORY_DEPLOYMENT SLOCorrectionCategory = "Deployment" - SLOCORRECTIONCATEGORY_OTHER SLOCorrectionCategory = "Other" -) - -var allowedSLOCorrectionCategoryEnumValues = []SLOCorrectionCategory{ - SLOCORRECTIONCATEGORY_SCHEDULED_MAINTENANCE, - SLOCORRECTIONCATEGORY_OUTSIDE_BUSINESS_HOURS, - SLOCORRECTIONCATEGORY_DEPLOYMENT, - SLOCORRECTIONCATEGORY_OTHER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SLOCorrectionCategory) GetAllowedValues() []SLOCorrectionCategory { - return allowedSLOCorrectionCategoryEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SLOCorrectionCategory) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SLOCorrectionCategory(value) - return nil -} - -// NewSLOCorrectionCategoryFromValue returns a pointer to a valid SLOCorrectionCategory -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSLOCorrectionCategoryFromValue(v string) (*SLOCorrectionCategory, error) { - ev := SLOCorrectionCategory(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SLOCorrectionCategory: valid values are %v", v, allowedSLOCorrectionCategoryEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SLOCorrectionCategory) IsValid() bool { - for _, existing := range allowedSLOCorrectionCategoryEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SLOCorrectionCategory value. -func (v SLOCorrectionCategory) Ptr() *SLOCorrectionCategory { - return &v -} - -// NullableSLOCorrectionCategory handles when a null is used for SLOCorrectionCategory. -type NullableSLOCorrectionCategory struct { - value *SLOCorrectionCategory - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOCorrectionCategory) Get() *SLOCorrectionCategory { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOCorrectionCategory) Set(val *SLOCorrectionCategory) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOCorrectionCategory) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOCorrectionCategory) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOCorrectionCategory initializes the struct as if Set has been called. -func NewNullableSLOCorrectionCategory(val *SLOCorrectionCategory) *NullableSLOCorrectionCategory { - return &NullableSLOCorrectionCategory{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOCorrectionCategory) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOCorrectionCategory) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_correction_create_data.go b/api/v1/datadog/model_slo_correction_create_data.go deleted file mode 100644 index 34f7477eaf3..00000000000 --- a/api/v1/datadog/model_slo_correction_create_data.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOCorrectionCreateData The data object associated with the SLO correction to be created. -type SLOCorrectionCreateData struct { - // The attribute object associated with the SLO correction to be created. - Attributes *SLOCorrectionCreateRequestAttributes `json:"attributes,omitempty"` - // SLO correction resource type. - Type SLOCorrectionType `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{} -} - -// NewSLOCorrectionCreateData instantiates a new SLOCorrectionCreateData 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 NewSLOCorrectionCreateData(typeVar SLOCorrectionType) *SLOCorrectionCreateData { - this := SLOCorrectionCreateData{} - this.Type = typeVar - return &this -} - -// NewSLOCorrectionCreateDataWithDefaults instantiates a new SLOCorrectionCreateData 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 NewSLOCorrectionCreateDataWithDefaults() *SLOCorrectionCreateData { - this := SLOCorrectionCreateData{} - var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SLOCorrectionCreateData) GetAttributes() SLOCorrectionCreateRequestAttributes { - if o == nil || o.Attributes == nil { - var ret SLOCorrectionCreateRequestAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateData) GetAttributesOk() (*SLOCorrectionCreateRequestAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SLOCorrectionCreateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SLOCorrectionCreateRequestAttributes and assigns it to the Attributes field. -func (o *SLOCorrectionCreateData) SetAttributes(v SLOCorrectionCreateRequestAttributes) { - o.Attributes = &v -} - -// GetType returns the Type field value. -func (o *SLOCorrectionCreateData) GetType() SLOCorrectionType { - if o == nil { - var ret SLOCorrectionType - 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 *SLOCorrectionCreateData) GetTypeOk() (*SLOCorrectionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SLOCorrectionCreateData) SetType(v SLOCorrectionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *SLOCorrectionType `json:"type"` - }{} - all := struct { - Attributes *SLOCorrectionCreateRequestAttributes `json:"attributes,omitempty"` - Type SLOCorrectionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_slo_correction_create_request.go b/api/v1/datadog/model_slo_correction_create_request.go deleted file mode 100644 index e8d0bc1ffbf..00000000000 --- a/api/v1/datadog/model_slo_correction_create_request.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrectionCreateRequest An object that defines a correction to be applied to an SLO. -type SLOCorrectionCreateRequest struct { - // The data object associated with the SLO correction to be created. - Data *SLOCorrectionCreateData `json:"data,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{} -} - -// NewSLOCorrectionCreateRequest instantiates a new SLOCorrectionCreateRequest 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 NewSLOCorrectionCreateRequest() *SLOCorrectionCreateRequest { - this := SLOCorrectionCreateRequest{} - return &this -} - -// NewSLOCorrectionCreateRequestWithDefaults instantiates a new SLOCorrectionCreateRequest 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 NewSLOCorrectionCreateRequestWithDefaults() *SLOCorrectionCreateRequest { - this := SLOCorrectionCreateRequest{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOCorrectionCreateRequest) GetData() SLOCorrectionCreateData { - if o == nil || o.Data == nil { - var ret SLOCorrectionCreateData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequest) GetDataOk() (*SLOCorrectionCreateData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOCorrectionCreateRequest) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SLOCorrectionCreateData and assigns it to the Data field. -func (o *SLOCorrectionCreateRequest) SetData(v SLOCorrectionCreateData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SLOCorrectionCreateData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_slo_correction_create_request_attributes.go b/api/v1/datadog/model_slo_correction_create_request_attributes.go deleted file mode 100644 index ca14fa7295d..00000000000 --- a/api/v1/datadog/model_slo_correction_create_request_attributes.go +++ /dev/null @@ -1,373 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOCorrectionCreateRequestAttributes The attribute object associated with the SLO correction to be created. -type SLOCorrectionCreateRequestAttributes struct { - // Category the SLO correction belongs to. - Category SLOCorrectionCategory `json:"category"` - // Description of the correction being made. - Description *string `json:"description,omitempty"` - // Length of time (in seconds) for a specified `rrule` recurring SLO correction. - Duration *int64 `json:"duration,omitempty"` - // Ending time of the correction in epoch seconds. - End *int64 `json:"end,omitempty"` - // The recurrence rules as defined in the iCalendar RFC 5545. The supported rules for SLO corrections - // are `FREQ`, `INTERVAL`, `COUNT` and `UNTIL`. - Rrule *string `json:"rrule,omitempty"` - // ID of the SLO that this correction applies to. - SloId string `json:"slo_id"` - // Starting time of the correction in epoch seconds. - Start int64 `json:"start"` - // The timezone to display in the UI for the correction times (defaults to "UTC"). - Timezone *string `json:"timezone,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{} -} - -// NewSLOCorrectionCreateRequestAttributes instantiates a new SLOCorrectionCreateRequestAttributes 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 NewSLOCorrectionCreateRequestAttributes(category SLOCorrectionCategory, sloId string, start int64) *SLOCorrectionCreateRequestAttributes { - this := SLOCorrectionCreateRequestAttributes{} - this.Category = category - this.SloId = sloId - this.Start = start - return &this -} - -// NewSLOCorrectionCreateRequestAttributesWithDefaults instantiates a new SLOCorrectionCreateRequestAttributes 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 NewSLOCorrectionCreateRequestAttributesWithDefaults() *SLOCorrectionCreateRequestAttributes { - this := SLOCorrectionCreateRequestAttributes{} - return &this -} - -// GetCategory returns the Category field value. -func (o *SLOCorrectionCreateRequestAttributes) GetCategory() SLOCorrectionCategory { - if o == nil { - var ret SLOCorrectionCategory - return ret - } - return o.Category -} - -// GetCategoryOk returns a tuple with the Category field value -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetCategoryOk() (*SLOCorrectionCategory, bool) { - if o == nil { - return nil, false - } - return &o.Category, true -} - -// SetCategory sets field value. -func (o *SLOCorrectionCreateRequestAttributes) SetCategory(v SLOCorrectionCategory) { - o.Category = v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *SLOCorrectionCreateRequestAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *SLOCorrectionCreateRequestAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *SLOCorrectionCreateRequestAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise. -func (o *SLOCorrectionCreateRequestAttributes) GetDuration() int64 { - if o == nil || o.Duration == nil { - var ret int64 - return ret - } - return *o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetDurationOk() (*int64, bool) { - if o == nil || o.Duration == nil { - return nil, false - } - return o.Duration, true -} - -// HasDuration returns a boolean if a field has been set. -func (o *SLOCorrectionCreateRequestAttributes) HasDuration() bool { - if o != nil && o.Duration != nil { - return true - } - - return false -} - -// SetDuration gets a reference to the given int64 and assigns it to the Duration field. -func (o *SLOCorrectionCreateRequestAttributes) SetDuration(v int64) { - o.Duration = &v -} - -// GetEnd returns the End field value if set, zero value otherwise. -func (o *SLOCorrectionCreateRequestAttributes) GetEnd() int64 { - if o == nil || o.End == nil { - var ret int64 - return ret - } - return *o.End -} - -// GetEndOk returns a tuple with the End field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetEndOk() (*int64, bool) { - if o == nil || o.End == nil { - return nil, false - } - return o.End, true -} - -// HasEnd returns a boolean if a field has been set. -func (o *SLOCorrectionCreateRequestAttributes) HasEnd() bool { - if o != nil && o.End != nil { - return true - } - - return false -} - -// SetEnd gets a reference to the given int64 and assigns it to the End field. -func (o *SLOCorrectionCreateRequestAttributes) SetEnd(v int64) { - o.End = &v -} - -// GetRrule returns the Rrule field value if set, zero value otherwise. -func (o *SLOCorrectionCreateRequestAttributes) GetRrule() string { - if o == nil || o.Rrule == nil { - var ret string - return ret - } - return *o.Rrule -} - -// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetRruleOk() (*string, bool) { - if o == nil || o.Rrule == nil { - return nil, false - } - return o.Rrule, true -} - -// HasRrule returns a boolean if a field has been set. -func (o *SLOCorrectionCreateRequestAttributes) HasRrule() bool { - if o != nil && o.Rrule != nil { - return true - } - - return false -} - -// SetRrule gets a reference to the given string and assigns it to the Rrule field. -func (o *SLOCorrectionCreateRequestAttributes) SetRrule(v string) { - o.Rrule = &v -} - -// GetSloId returns the SloId field value. -func (o *SLOCorrectionCreateRequestAttributes) GetSloId() string { - if o == nil { - var ret string - return ret - } - return o.SloId -} - -// GetSloIdOk returns a tuple with the SloId field value -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetSloIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.SloId, true -} - -// SetSloId sets field value. -func (o *SLOCorrectionCreateRequestAttributes) SetSloId(v string) { - o.SloId = v -} - -// GetStart returns the Start field value. -func (o *SLOCorrectionCreateRequestAttributes) GetStart() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Start -} - -// GetStartOk returns a tuple with the Start field value -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetStartOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Start, true -} - -// SetStart sets field value. -func (o *SLOCorrectionCreateRequestAttributes) SetStart(v int64) { - o.Start = v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *SLOCorrectionCreateRequestAttributes) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionCreateRequestAttributes) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *SLOCorrectionCreateRequestAttributes) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *SLOCorrectionCreateRequestAttributes) SetTimezone(v string) { - o.Timezone = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionCreateRequestAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["category"] = o.Category - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Duration != nil { - toSerialize["duration"] = o.Duration - } - if o.End != nil { - toSerialize["end"] = o.End - } - if o.Rrule != nil { - toSerialize["rrule"] = o.Rrule - } - toSerialize["slo_id"] = o.SloId - toSerialize["start"] = o.Start - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Category *SLOCorrectionCategory `json:"category"` - SloId *string `json:"slo_id"` - Start *int64 `json:"start"` - }{} - all := struct { - Category SLOCorrectionCategory `json:"category"` - Description *string `json:"description,omitempty"` - Duration *int64 `json:"duration,omitempty"` - End *int64 `json:"end,omitempty"` - Rrule *string `json:"rrule,omitempty"` - SloId string `json:"slo_id"` - Start int64 `json:"start"` - Timezone *string `json:"timezone,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Category == nil { - return fmt.Errorf("Required field category missing") - } - if required.SloId == nil { - return fmt.Errorf("Required field slo_id missing") - } - if required.Start == nil { - return fmt.Errorf("Required field start missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Category; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Category = all.Category - o.Description = all.Description - o.Duration = all.Duration - o.End = all.End - o.Rrule = all.Rrule - o.SloId = all.SloId - o.Start = all.Start - o.Timezone = all.Timezone - return nil -} diff --git a/api/v1/datadog/model_slo_correction_list_response.go b/api/v1/datadog/model_slo_correction_list_response.go deleted file mode 100644 index 30635615de6..00000000000 --- a/api/v1/datadog/model_slo_correction_list_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrectionListResponse A list of SLO correction objects. -type SLOCorrectionListResponse struct { - // The list of of SLO corrections objects. - Data []SLOCorrection `json:"data,omitempty"` - // Object describing meta attributes of response. - Meta *ResponseMetaAttributes `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{} -} - -// NewSLOCorrectionListResponse instantiates a new SLOCorrectionListResponse 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 NewSLOCorrectionListResponse() *SLOCorrectionListResponse { - this := SLOCorrectionListResponse{} - return &this -} - -// NewSLOCorrectionListResponseWithDefaults instantiates a new SLOCorrectionListResponse 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 NewSLOCorrectionListResponseWithDefaults() *SLOCorrectionListResponse { - this := SLOCorrectionListResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOCorrectionListResponse) GetData() []SLOCorrection { - if o == nil || o.Data == nil { - var ret []SLOCorrection - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionListResponse) GetDataOk() (*[]SLOCorrection, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOCorrectionListResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []SLOCorrection and assigns it to the Data field. -func (o *SLOCorrectionListResponse) SetData(v []SLOCorrection) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *SLOCorrectionListResponse) GetMeta() ResponseMetaAttributes { - if o == nil || o.Meta == nil { - var ret ResponseMetaAttributes - 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 *SLOCorrectionListResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *SLOCorrectionListResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. -func (o *SLOCorrectionListResponse) SetMeta(v ResponseMetaAttributes) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []SLOCorrection `json:"data,omitempty"` - Meta *ResponseMetaAttributes `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v1/datadog/model_slo_correction_response.go b/api/v1/datadog/model_slo_correction_response.go deleted file mode 100644 index ea64e447c76..00000000000 --- a/api/v1/datadog/model_slo_correction_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrectionResponse The response object of an SLO correction. -type SLOCorrectionResponse struct { - // The response object of a list of SLO corrections. - Data *SLOCorrection `json:"data,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{} -} - -// NewSLOCorrectionResponse instantiates a new SLOCorrectionResponse 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 NewSLOCorrectionResponse() *SLOCorrectionResponse { - this := SLOCorrectionResponse{} - return &this -} - -// NewSLOCorrectionResponseWithDefaults instantiates a new SLOCorrectionResponse 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 NewSLOCorrectionResponseWithDefaults() *SLOCorrectionResponse { - this := SLOCorrectionResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOCorrectionResponse) GetData() SLOCorrection { - if o == nil || o.Data == nil { - var ret SLOCorrection - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponse) GetDataOk() (*SLOCorrection, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOCorrectionResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SLOCorrection and assigns it to the Data field. -func (o *SLOCorrectionResponse) SetData(v SLOCorrection) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SLOCorrection `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_slo_correction_response_attributes.go b/api/v1/datadog/model_slo_correction_response_attributes.go deleted file mode 100644 index 731ee1bd0f2..00000000000 --- a/api/v1/datadog/model_slo_correction_response_attributes.go +++ /dev/null @@ -1,582 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SLOCorrectionResponseAttributes The attribute object associated with the SLO correction. -type SLOCorrectionResponseAttributes struct { - // Category the SLO correction belongs to. - Category *SLOCorrectionCategory `json:"category,omitempty"` - // The epoch timestamp of when the correction was created at. - CreatedAt *int64 `json:"created_at,omitempty"` - // Object describing the creator of the shared element. - Creator *Creator `json:"creator,omitempty"` - // Description of the correction being made. - Description *string `json:"description,omitempty"` - // Length of time (in seconds) for a specified `rrule` recurring SLO correction. - Duration common.NullableInt64 `json:"duration,omitempty"` - // Ending time of the correction in epoch seconds. - End *int64 `json:"end,omitempty"` - // The epoch timestamp of when the correction was modified at. - ModifiedAt *int64 `json:"modified_at,omitempty"` - // Modifier of the object. - Modifier NullableSLOCorrectionResponseAttributesModifier `json:"modifier,omitempty"` - // The recurrence rules as defined in the iCalendar RFC 5545. The supported rules for SLO corrections - // are `FREQ`, `INTERVAL`, `COUNT`, and `UNTIL`. - Rrule common.NullableString `json:"rrule,omitempty"` - // ID of the SLO that this correction applies to. - SloId *string `json:"slo_id,omitempty"` - // Starting time of the correction in epoch seconds. - Start *int64 `json:"start,omitempty"` - // The timezone to display in the UI for the correction times (defaults to "UTC"). - Timezone *string `json:"timezone,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{} -} - -// NewSLOCorrectionResponseAttributes instantiates a new SLOCorrectionResponseAttributes 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 NewSLOCorrectionResponseAttributes() *SLOCorrectionResponseAttributes { - this := SLOCorrectionResponseAttributes{} - return &this -} - -// NewSLOCorrectionResponseAttributesWithDefaults instantiates a new SLOCorrectionResponseAttributes 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 NewSLOCorrectionResponseAttributesWithDefaults() *SLOCorrectionResponseAttributes { - this := SLOCorrectionResponseAttributes{} - return &this -} - -// GetCategory returns the Category field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetCategory() SLOCorrectionCategory { - if o == nil || o.Category == nil { - var ret SLOCorrectionCategory - return ret - } - return *o.Category -} - -// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetCategoryOk() (*SLOCorrectionCategory, bool) { - if o == nil || o.Category == nil { - return nil, false - } - return o.Category, true -} - -// HasCategory returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasCategory() bool { - if o != nil && o.Category != nil { - return true - } - - return false -} - -// SetCategory gets a reference to the given SLOCorrectionCategory and assigns it to the Category field. -func (o *SLOCorrectionResponseAttributes) SetCategory(v SLOCorrectionCategory) { - o.Category = &v -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetCreatedAt() int64 { - if o == nil || o.CreatedAt == nil { - var ret int64 - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetCreatedAtOk() (*int64, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. -func (o *SLOCorrectionResponseAttributes) SetCreatedAt(v int64) { - o.CreatedAt = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetCreator() Creator { - if o == nil || o.Creator == nil { - var ret Creator - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetCreatorOk() (*Creator, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given Creator and assigns it to the Creator field. -func (o *SLOCorrectionResponseAttributes) SetCreator(v Creator) { - o.Creator = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *SLOCorrectionResponseAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SLOCorrectionResponseAttributes) GetDuration() int64 { - if o == nil || o.Duration.Get() == nil { - var ret int64 - return ret - } - return *o.Duration.Get() -} - -// GetDurationOk returns a tuple with the Duration 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 *SLOCorrectionResponseAttributes) GetDurationOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Duration.Get(), o.Duration.IsSet() -} - -// HasDuration returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasDuration() bool { - if o != nil && o.Duration.IsSet() { - return true - } - - return false -} - -// SetDuration gets a reference to the given common.NullableInt64 and assigns it to the Duration field. -func (o *SLOCorrectionResponseAttributes) SetDuration(v int64) { - o.Duration.Set(&v) -} - -// SetDurationNil sets the value for Duration to be an explicit nil. -func (o *SLOCorrectionResponseAttributes) SetDurationNil() { - o.Duration.Set(nil) -} - -// UnsetDuration ensures that no value is present for Duration, not even an explicit nil. -func (o *SLOCorrectionResponseAttributes) UnsetDuration() { - o.Duration.Unset() -} - -// GetEnd returns the End field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetEnd() int64 { - if o == nil || o.End == nil { - var ret int64 - return ret - } - return *o.End -} - -// GetEndOk returns a tuple with the End field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetEndOk() (*int64, bool) { - if o == nil || o.End == nil { - return nil, false - } - return o.End, true -} - -// HasEnd returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasEnd() bool { - if o != nil && o.End != nil { - return true - } - - return false -} - -// SetEnd gets a reference to the given int64 and assigns it to the End field. -func (o *SLOCorrectionResponseAttributes) SetEnd(v int64) { - o.End = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetModifiedAt() int64 { - if o == nil || o.ModifiedAt == nil { - var ret int64 - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetModifiedAtOk() (*int64, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given int64 and assigns it to the ModifiedAt field. -func (o *SLOCorrectionResponseAttributes) SetModifiedAt(v int64) { - o.ModifiedAt = &v -} - -// GetModifier returns the Modifier field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SLOCorrectionResponseAttributes) GetModifier() SLOCorrectionResponseAttributesModifier { - if o == nil || o.Modifier.Get() == nil { - var ret SLOCorrectionResponseAttributesModifier - return ret - } - return *o.Modifier.Get() -} - -// GetModifierOk returns a tuple with the Modifier 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 *SLOCorrectionResponseAttributes) GetModifierOk() (*SLOCorrectionResponseAttributesModifier, bool) { - if o == nil { - return nil, false - } - return o.Modifier.Get(), o.Modifier.IsSet() -} - -// HasModifier returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasModifier() bool { - if o != nil && o.Modifier.IsSet() { - return true - } - - return false -} - -// SetModifier gets a reference to the given NullableSLOCorrectionResponseAttributesModifier and assigns it to the Modifier field. -func (o *SLOCorrectionResponseAttributes) SetModifier(v SLOCorrectionResponseAttributesModifier) { - o.Modifier.Set(&v) -} - -// SetModifierNil sets the value for Modifier to be an explicit nil. -func (o *SLOCorrectionResponseAttributes) SetModifierNil() { - o.Modifier.Set(nil) -} - -// UnsetModifier ensures that no value is present for Modifier, not even an explicit nil. -func (o *SLOCorrectionResponseAttributes) UnsetModifier() { - o.Modifier.Unset() -} - -// GetRrule returns the Rrule field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SLOCorrectionResponseAttributes) GetRrule() string { - if o == nil || o.Rrule.Get() == nil { - var ret string - return ret - } - return *o.Rrule.Get() -} - -// GetRruleOk returns a tuple with the Rrule 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 *SLOCorrectionResponseAttributes) GetRruleOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Rrule.Get(), o.Rrule.IsSet() -} - -// HasRrule returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasRrule() bool { - if o != nil && o.Rrule.IsSet() { - return true - } - - return false -} - -// SetRrule gets a reference to the given common.NullableString and assigns it to the Rrule field. -func (o *SLOCorrectionResponseAttributes) SetRrule(v string) { - o.Rrule.Set(&v) -} - -// SetRruleNil sets the value for Rrule to be an explicit nil. -func (o *SLOCorrectionResponseAttributes) SetRruleNil() { - o.Rrule.Set(nil) -} - -// UnsetRrule ensures that no value is present for Rrule, not even an explicit nil. -func (o *SLOCorrectionResponseAttributes) UnsetRrule() { - o.Rrule.Unset() -} - -// GetSloId returns the SloId field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetSloId() string { - if o == nil || o.SloId == nil { - var ret string - return ret - } - return *o.SloId -} - -// GetSloIdOk returns a tuple with the SloId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetSloIdOk() (*string, bool) { - if o == nil || o.SloId == nil { - return nil, false - } - return o.SloId, true -} - -// HasSloId returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasSloId() bool { - if o != nil && o.SloId != nil { - return true - } - - return false -} - -// SetSloId gets a reference to the given string and assigns it to the SloId field. -func (o *SLOCorrectionResponseAttributes) SetSloId(v string) { - o.SloId = &v -} - -// GetStart returns the Start field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetStart() int64 { - if o == nil || o.Start == nil { - var ret int64 - return ret - } - return *o.Start -} - -// GetStartOk returns a tuple with the Start field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetStartOk() (*int64, bool) { - if o == nil || o.Start == nil { - return nil, false - } - return o.Start, true -} - -// HasStart returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasStart() bool { - if o != nil && o.Start != nil { - return true - } - - return false -} - -// SetStart gets a reference to the given int64 and assigns it to the Start field. -func (o *SLOCorrectionResponseAttributes) SetStart(v int64) { - o.Start = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributes) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributes) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributes) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *SLOCorrectionResponseAttributes) SetTimezone(v string) { - o.Timezone = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Category != nil { - toSerialize["category"] = o.Category - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Duration.IsSet() { - toSerialize["duration"] = o.Duration.Get() - } - if o.End != nil { - toSerialize["end"] = o.End - } - if o.ModifiedAt != nil { - toSerialize["modified_at"] = o.ModifiedAt - } - if o.Modifier.IsSet() { - toSerialize["modifier"] = o.Modifier.Get() - } - if o.Rrule.IsSet() { - toSerialize["rrule"] = o.Rrule.Get() - } - if o.SloId != nil { - toSerialize["slo_id"] = o.SloId - } - if o.Start != nil { - toSerialize["start"] = o.Start - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Category *SLOCorrectionCategory `json:"category,omitempty"` - CreatedAt *int64 `json:"created_at,omitempty"` - Creator *Creator `json:"creator,omitempty"` - Description *string `json:"description,omitempty"` - Duration common.NullableInt64 `json:"duration,omitempty"` - End *int64 `json:"end,omitempty"` - ModifiedAt *int64 `json:"modified_at,omitempty"` - Modifier NullableSLOCorrectionResponseAttributesModifier `json:"modifier,omitempty"` - Rrule common.NullableString `json:"rrule,omitempty"` - SloId *string `json:"slo_id,omitempty"` - Start *int64 `json:"start,omitempty"` - Timezone *string `json:"timezone,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Category; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Category = all.Category - o.CreatedAt = all.CreatedAt - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.Description = all.Description - o.Duration = all.Duration - o.End = all.End - o.ModifiedAt = all.ModifiedAt - o.Modifier = all.Modifier - o.Rrule = all.Rrule - o.SloId = all.SloId - o.Start = all.Start - o.Timezone = all.Timezone - return nil -} diff --git a/api/v1/datadog/model_slo_correction_response_attributes_modifier.go b/api/v1/datadog/model_slo_correction_response_attributes_modifier.go deleted file mode 100644 index 8c103e182c6..00000000000 --- a/api/v1/datadog/model_slo_correction_response_attributes_modifier.go +++ /dev/null @@ -1,230 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrectionResponseAttributesModifier Modifier of the object. -type SLOCorrectionResponseAttributesModifier struct { - // Email of the Modifier. - Email *string `json:"email,omitempty"` - // Handle of the Modifier. - Handle *string `json:"handle,omitempty"` - // Name of the Modifier. - Name *string `json:"name,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{} -} - -// NewSLOCorrectionResponseAttributesModifier instantiates a new SLOCorrectionResponseAttributesModifier 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 NewSLOCorrectionResponseAttributesModifier() *SLOCorrectionResponseAttributesModifier { - this := SLOCorrectionResponseAttributesModifier{} - return &this -} - -// NewSLOCorrectionResponseAttributesModifierWithDefaults instantiates a new SLOCorrectionResponseAttributesModifier 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 NewSLOCorrectionResponseAttributesModifierWithDefaults() *SLOCorrectionResponseAttributesModifier { - this := SLOCorrectionResponseAttributesModifier{} - return &this -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributesModifier) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributesModifier) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributesModifier) HasEmail() bool { - if o != nil && o.Email != nil { - return true - } - - return false -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *SLOCorrectionResponseAttributesModifier) SetEmail(v string) { - o.Email = &v -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributesModifier) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributesModifier) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributesModifier) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *SLOCorrectionResponseAttributesModifier) SetHandle(v string) { - o.Handle = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SLOCorrectionResponseAttributesModifier) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionResponseAttributesModifier) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SLOCorrectionResponseAttributesModifier) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SLOCorrectionResponseAttributesModifier) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionResponseAttributesModifier) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionResponseAttributesModifier) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Email *string `json:"email,omitempty"` - Handle *string `json:"handle,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Email = all.Email - o.Handle = all.Handle - o.Name = all.Name - return nil -} - -// NullableSLOCorrectionResponseAttributesModifier handles when a null is used for SLOCorrectionResponseAttributesModifier. -type NullableSLOCorrectionResponseAttributesModifier struct { - value *SLOCorrectionResponseAttributesModifier - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOCorrectionResponseAttributesModifier) Get() *SLOCorrectionResponseAttributesModifier { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOCorrectionResponseAttributesModifier) Set(val *SLOCorrectionResponseAttributesModifier) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOCorrectionResponseAttributesModifier) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSLOCorrectionResponseAttributesModifier) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOCorrectionResponseAttributesModifier initializes the struct as if Set has been called. -func NewNullableSLOCorrectionResponseAttributesModifier(val *SLOCorrectionResponseAttributesModifier) *NullableSLOCorrectionResponseAttributesModifier { - return &NullableSLOCorrectionResponseAttributesModifier{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOCorrectionResponseAttributesModifier) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOCorrectionResponseAttributesModifier) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_correction_type.go b/api/v1/datadog/model_slo_correction_type.go deleted file mode 100644 index eecf17f9e3d..00000000000 --- a/api/v1/datadog/model_slo_correction_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOCorrectionType SLO correction resource type. -type SLOCorrectionType string - -// List of SLOCorrectionType. -const ( - SLOCORRECTIONTYPE_CORRECTION SLOCorrectionType = "correction" -) - -var allowedSLOCorrectionTypeEnumValues = []SLOCorrectionType{ - SLOCORRECTIONTYPE_CORRECTION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SLOCorrectionType) GetAllowedValues() []SLOCorrectionType { - return allowedSLOCorrectionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SLOCorrectionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SLOCorrectionType(value) - return nil -} - -// NewSLOCorrectionTypeFromValue returns a pointer to a valid SLOCorrectionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSLOCorrectionTypeFromValue(v string) (*SLOCorrectionType, error) { - ev := SLOCorrectionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SLOCorrectionType: valid values are %v", v, allowedSLOCorrectionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SLOCorrectionType) IsValid() bool { - for _, existing := range allowedSLOCorrectionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SLOCorrectionType value. -func (v SLOCorrectionType) Ptr() *SLOCorrectionType { - return &v -} - -// NullableSLOCorrectionType handles when a null is used for SLOCorrectionType. -type NullableSLOCorrectionType struct { - value *SLOCorrectionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOCorrectionType) Get() *SLOCorrectionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOCorrectionType) Set(val *SLOCorrectionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOCorrectionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOCorrectionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOCorrectionType initializes the struct as if Set has been called. -func NewNullableSLOCorrectionType(val *SLOCorrectionType) *NullableSLOCorrectionType { - return &NullableSLOCorrectionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOCorrectionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOCorrectionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_correction_update_data.go b/api/v1/datadog/model_slo_correction_update_data.go deleted file mode 100644 index b062e60efb0..00000000000 --- a/api/v1/datadog/model_slo_correction_update_data.go +++ /dev/null @@ -1,160 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrectionUpdateData The data object associated with the SLO correction to be updated. -type SLOCorrectionUpdateData struct { - // The attribute object associated with the SLO correction to be updated. - Attributes *SLOCorrectionUpdateRequestAttributes `json:"attributes,omitempty"` - // SLO correction resource type. - Type *SLOCorrectionType `json:"type,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{} -} - -// NewSLOCorrectionUpdateData instantiates a new SLOCorrectionUpdateData 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 NewSLOCorrectionUpdateData() *SLOCorrectionUpdateData { - this := SLOCorrectionUpdateData{} - var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION - this.Type = &typeVar - return &this -} - -// NewSLOCorrectionUpdateDataWithDefaults instantiates a new SLOCorrectionUpdateData 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 NewSLOCorrectionUpdateDataWithDefaults() *SLOCorrectionUpdateData { - this := SLOCorrectionUpdateData{} - var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateData) GetAttributes() SLOCorrectionUpdateRequestAttributes { - if o == nil || o.Attributes == nil { - var ret SLOCorrectionUpdateRequestAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateData) GetAttributesOk() (*SLOCorrectionUpdateRequestAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SLOCorrectionUpdateRequestAttributes and assigns it to the Attributes field. -func (o *SLOCorrectionUpdateData) SetAttributes(v SLOCorrectionUpdateRequestAttributes) { - o.Attributes = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateData) GetType() SLOCorrectionType { - if o == nil || o.Type == nil { - var ret SLOCorrectionType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateData) GetTypeOk() (*SLOCorrectionType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SLOCorrectionType and assigns it to the Type field. -func (o *SLOCorrectionUpdateData) SetType(v SLOCorrectionType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *SLOCorrectionUpdateRequestAttributes `json:"attributes,omitempty"` - Type *SLOCorrectionType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_slo_correction_update_request.go b/api/v1/datadog/model_slo_correction_update_request.go deleted file mode 100644 index 5632ca28a2f..00000000000 --- a/api/v1/datadog/model_slo_correction_update_request.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrectionUpdateRequest An object that defines a correction to be applied to an SLO. -type SLOCorrectionUpdateRequest struct { - // The data object associated with the SLO correction to be updated. - Data *SLOCorrectionUpdateData `json:"data,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{} -} - -// NewSLOCorrectionUpdateRequest instantiates a new SLOCorrectionUpdateRequest 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 NewSLOCorrectionUpdateRequest() *SLOCorrectionUpdateRequest { - this := SLOCorrectionUpdateRequest{} - return &this -} - -// NewSLOCorrectionUpdateRequestWithDefaults instantiates a new SLOCorrectionUpdateRequest 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 NewSLOCorrectionUpdateRequestWithDefaults() *SLOCorrectionUpdateRequest { - this := SLOCorrectionUpdateRequest{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequest) GetData() SLOCorrectionUpdateData { - if o == nil || o.Data == nil { - var ret SLOCorrectionUpdateData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequest) GetDataOk() (*SLOCorrectionUpdateData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequest) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SLOCorrectionUpdateData and assigns it to the Data field. -func (o *SLOCorrectionUpdateRequest) SetData(v SLOCorrectionUpdateData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SLOCorrectionUpdateData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_slo_correction_update_request_attributes.go b/api/v1/datadog/model_slo_correction_update_request_attributes.go deleted file mode 100644 index 4b04a29a2ef..00000000000 --- a/api/v1/datadog/model_slo_correction_update_request_attributes.go +++ /dev/null @@ -1,345 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOCorrectionUpdateRequestAttributes The attribute object associated with the SLO correction to be updated. -type SLOCorrectionUpdateRequestAttributes struct { - // Category the SLO correction belongs to. - Category *SLOCorrectionCategory `json:"category,omitempty"` - // Description of the correction being made. - Description *string `json:"description,omitempty"` - // Length of time (in seconds) for a specified `rrule` recurring SLO correction. - Duration *int64 `json:"duration,omitempty"` - // Ending time of the correction in epoch seconds. - End *int64 `json:"end,omitempty"` - // The recurrence rules as defined in the iCalendar RFC 5545. The supported rules for SLO corrections - // are `FREQ`, `INTERVAL`, `COUNT`, and `UNTIL`. - Rrule *string `json:"rrule,omitempty"` - // Starting time of the correction in epoch seconds. - Start *int64 `json:"start,omitempty"` - // The timezone to display in the UI for the correction times (defaults to "UTC"). - Timezone *string `json:"timezone,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{} -} - -// NewSLOCorrectionUpdateRequestAttributes instantiates a new SLOCorrectionUpdateRequestAttributes 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 NewSLOCorrectionUpdateRequestAttributes() *SLOCorrectionUpdateRequestAttributes { - this := SLOCorrectionUpdateRequestAttributes{} - return &this -} - -// NewSLOCorrectionUpdateRequestAttributesWithDefaults instantiates a new SLOCorrectionUpdateRequestAttributes 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 NewSLOCorrectionUpdateRequestAttributesWithDefaults() *SLOCorrectionUpdateRequestAttributes { - this := SLOCorrectionUpdateRequestAttributes{} - return &this -} - -// GetCategory returns the Category field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequestAttributes) GetCategory() SLOCorrectionCategory { - if o == nil || o.Category == nil { - var ret SLOCorrectionCategory - return ret - } - return *o.Category -} - -// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequestAttributes) GetCategoryOk() (*SLOCorrectionCategory, bool) { - if o == nil || o.Category == nil { - return nil, false - } - return o.Category, true -} - -// HasCategory returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequestAttributes) HasCategory() bool { - if o != nil && o.Category != nil { - return true - } - - return false -} - -// SetCategory gets a reference to the given SLOCorrectionCategory and assigns it to the Category field. -func (o *SLOCorrectionUpdateRequestAttributes) SetCategory(v SLOCorrectionCategory) { - o.Category = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequestAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequestAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequestAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *SLOCorrectionUpdateRequestAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequestAttributes) GetDuration() int64 { - if o == nil || o.Duration == nil { - var ret int64 - return ret - } - return *o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequestAttributes) GetDurationOk() (*int64, bool) { - if o == nil || o.Duration == nil { - return nil, false - } - return o.Duration, true -} - -// HasDuration returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequestAttributes) HasDuration() bool { - if o != nil && o.Duration != nil { - return true - } - - return false -} - -// SetDuration gets a reference to the given int64 and assigns it to the Duration field. -func (o *SLOCorrectionUpdateRequestAttributes) SetDuration(v int64) { - o.Duration = &v -} - -// GetEnd returns the End field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequestAttributes) GetEnd() int64 { - if o == nil || o.End == nil { - var ret int64 - return ret - } - return *o.End -} - -// GetEndOk returns a tuple with the End field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequestAttributes) GetEndOk() (*int64, bool) { - if o == nil || o.End == nil { - return nil, false - } - return o.End, true -} - -// HasEnd returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequestAttributes) HasEnd() bool { - if o != nil && o.End != nil { - return true - } - - return false -} - -// SetEnd gets a reference to the given int64 and assigns it to the End field. -func (o *SLOCorrectionUpdateRequestAttributes) SetEnd(v int64) { - o.End = &v -} - -// GetRrule returns the Rrule field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequestAttributes) GetRrule() string { - if o == nil || o.Rrule == nil { - var ret string - return ret - } - return *o.Rrule -} - -// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequestAttributes) GetRruleOk() (*string, bool) { - if o == nil || o.Rrule == nil { - return nil, false - } - return o.Rrule, true -} - -// HasRrule returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequestAttributes) HasRrule() bool { - if o != nil && o.Rrule != nil { - return true - } - - return false -} - -// SetRrule gets a reference to the given string and assigns it to the Rrule field. -func (o *SLOCorrectionUpdateRequestAttributes) SetRrule(v string) { - o.Rrule = &v -} - -// GetStart returns the Start field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequestAttributes) GetStart() int64 { - if o == nil || o.Start == nil { - var ret int64 - return ret - } - return *o.Start -} - -// GetStartOk returns a tuple with the Start field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequestAttributes) GetStartOk() (*int64, bool) { - if o == nil || o.Start == nil { - return nil, false - } - return o.Start, true -} - -// HasStart returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequestAttributes) HasStart() bool { - if o != nil && o.Start != nil { - return true - } - - return false -} - -// SetStart gets a reference to the given int64 and assigns it to the Start field. -func (o *SLOCorrectionUpdateRequestAttributes) SetStart(v int64) { - o.Start = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *SLOCorrectionUpdateRequestAttributes) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOCorrectionUpdateRequestAttributes) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *SLOCorrectionUpdateRequestAttributes) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *SLOCorrectionUpdateRequestAttributes) SetTimezone(v string) { - o.Timezone = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOCorrectionUpdateRequestAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Category != nil { - toSerialize["category"] = o.Category - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Duration != nil { - toSerialize["duration"] = o.Duration - } - if o.End != nil { - toSerialize["end"] = o.End - } - if o.Rrule != nil { - toSerialize["rrule"] = o.Rrule - } - if o.Start != nil { - toSerialize["start"] = o.Start - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOCorrectionUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Category *SLOCorrectionCategory `json:"category,omitempty"` - Description *string `json:"description,omitempty"` - Duration *int64 `json:"duration,omitempty"` - End *int64 `json:"end,omitempty"` - Rrule *string `json:"rrule,omitempty"` - Start *int64 `json:"start,omitempty"` - Timezone *string `json:"timezone,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Category; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Category = all.Category - o.Description = all.Description - o.Duration = all.Duration - o.End = all.End - o.Rrule = all.Rrule - o.Start = all.Start - o.Timezone = all.Timezone - return nil -} diff --git a/api/v1/datadog/model_slo_delete_response.go b/api/v1/datadog/model_slo_delete_response.go deleted file mode 100644 index e3bbece63d8..00000000000 --- a/api/v1/datadog/model_slo_delete_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLODeleteResponse A response list of all service level objective deleted. -type SLODeleteResponse struct { - // An array containing the ID of the deleted service level objective object. - Data []string `json:"data,omitempty"` - // An dictionary containing the ID of the SLO as key and a deletion error as value. - Errors map[string]string `json:"errors,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{} -} - -// NewSLODeleteResponse instantiates a new SLODeleteResponse 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 NewSLODeleteResponse() *SLODeleteResponse { - this := SLODeleteResponse{} - return &this -} - -// NewSLODeleteResponseWithDefaults instantiates a new SLODeleteResponse 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 NewSLODeleteResponseWithDefaults() *SLODeleteResponse { - this := SLODeleteResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLODeleteResponse) GetData() []string { - if o == nil || o.Data == nil { - var ret []string - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLODeleteResponse) GetDataOk() (*[]string, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLODeleteResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []string and assigns it to the Data field. -func (o *SLODeleteResponse) SetData(v []string) { - o.Data = v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *SLODeleteResponse) GetErrors() map[string]string { - if o == nil || o.Errors == nil { - var ret map[string]string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLODeleteResponse) GetErrorsOk() (*map[string]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *SLODeleteResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given map[string]string and assigns it to the Errors field. -func (o *SLODeleteResponse) SetErrors(v map[string]string) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLODeleteResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLODeleteResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []string `json:"data,omitempty"` - Errors map[string]string `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Errors = all.Errors - return nil -} diff --git a/api/v1/datadog/model_slo_error_timeframe.go b/api/v1/datadog/model_slo_error_timeframe.go deleted file mode 100644 index 71f69418e98..00000000000 --- a/api/v1/datadog/model_slo_error_timeframe.go +++ /dev/null @@ -1,114 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOErrorTimeframe The timeframe of the threshold associated with this error -// or "all" if all thresholds are affected. -type SLOErrorTimeframe string - -// List of SLOErrorTimeframe. -const ( - SLOERRORTIMEFRAME_SEVEN_DAYS SLOErrorTimeframe = "7d" - SLOERRORTIMEFRAME_THIRTY_DAYS SLOErrorTimeframe = "30d" - SLOERRORTIMEFRAME_NINETY_DAYS SLOErrorTimeframe = "90d" - SLOERRORTIMEFRAME_ALL SLOErrorTimeframe = "all" -) - -var allowedSLOErrorTimeframeEnumValues = []SLOErrorTimeframe{ - SLOERRORTIMEFRAME_SEVEN_DAYS, - SLOERRORTIMEFRAME_THIRTY_DAYS, - SLOERRORTIMEFRAME_NINETY_DAYS, - SLOERRORTIMEFRAME_ALL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SLOErrorTimeframe) GetAllowedValues() []SLOErrorTimeframe { - return allowedSLOErrorTimeframeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SLOErrorTimeframe) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SLOErrorTimeframe(value) - return nil -} - -// NewSLOErrorTimeframeFromValue returns a pointer to a valid SLOErrorTimeframe -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSLOErrorTimeframeFromValue(v string) (*SLOErrorTimeframe, error) { - ev := SLOErrorTimeframe(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SLOErrorTimeframe: valid values are %v", v, allowedSLOErrorTimeframeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SLOErrorTimeframe) IsValid() bool { - for _, existing := range allowedSLOErrorTimeframeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SLOErrorTimeframe value. -func (v SLOErrorTimeframe) Ptr() *SLOErrorTimeframe { - return &v -} - -// NullableSLOErrorTimeframe handles when a null is used for SLOErrorTimeframe. -type NullableSLOErrorTimeframe struct { - value *SLOErrorTimeframe - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOErrorTimeframe) Get() *SLOErrorTimeframe { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOErrorTimeframe) Set(val *SLOErrorTimeframe) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOErrorTimeframe) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOErrorTimeframe) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOErrorTimeframe initializes the struct as if Set has been called. -func NewNullableSLOErrorTimeframe(val *SLOErrorTimeframe) *NullableSLOErrorTimeframe { - return &NullableSLOErrorTimeframe{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOErrorTimeframe) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOErrorTimeframe) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_history_metrics.go b/api/v1/datadog/model_slo_history_metrics.go deleted file mode 100644 index 76f5560bcbf..00000000000 --- a/api/v1/datadog/model_slo_history_metrics.go +++ /dev/null @@ -1,358 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOHistoryMetrics A `metric` based SLO history response. -// -// This is not included in responses for `monitor` based SLOs. -type SLOHistoryMetrics struct { - // A representation of `metric` based SLO time series for the provided queries. - // This is the same response type from `batch_query` endpoint. - Denominator SLOHistoryMetricsSeries `json:"denominator"` - // The aggregated query interval for the series data. It's implicit based on the query time window. - Interval int64 `json:"interval"` - // Optional message if there are specific query issues/warnings. - Message *string `json:"message,omitempty"` - // A representation of `metric` based SLO time series for the provided queries. - // This is the same response type from `batch_query` endpoint. - Numerator SLOHistoryMetricsSeries `json:"numerator"` - // The combined numerator and denominator query CSV. - Query string `json:"query"` - // The series result type. This mimics `batch_query` response type. - ResType string `json:"res_type"` - // The series response version type. This mimics `batch_query` response type. - RespVersion int64 `json:"resp_version"` - // An array of query timestamps in EPOCH milliseconds. - Times []float64 `json:"times"` - // 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{} -} - -// NewSLOHistoryMetrics instantiates a new SLOHistoryMetrics 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 NewSLOHistoryMetrics(denominator SLOHistoryMetricsSeries, interval int64, numerator SLOHistoryMetricsSeries, query string, resType string, respVersion int64, times []float64) *SLOHistoryMetrics { - this := SLOHistoryMetrics{} - this.Denominator = denominator - this.Interval = interval - this.Numerator = numerator - this.Query = query - this.ResType = resType - this.RespVersion = respVersion - this.Times = times - return &this -} - -// NewSLOHistoryMetricsWithDefaults instantiates a new SLOHistoryMetrics 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 NewSLOHistoryMetricsWithDefaults() *SLOHistoryMetrics { - this := SLOHistoryMetrics{} - return &this -} - -// GetDenominator returns the Denominator field value. -func (o *SLOHistoryMetrics) GetDenominator() SLOHistoryMetricsSeries { - if o == nil { - var ret SLOHistoryMetricsSeries - return ret - } - return o.Denominator -} - -// GetDenominatorOk returns a tuple with the Denominator field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetDenominatorOk() (*SLOHistoryMetricsSeries, bool) { - if o == nil { - return nil, false - } - return &o.Denominator, true -} - -// SetDenominator sets field value. -func (o *SLOHistoryMetrics) SetDenominator(v SLOHistoryMetricsSeries) { - o.Denominator = v -} - -// GetInterval returns the Interval field value. -func (o *SLOHistoryMetrics) GetInterval() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetIntervalOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Interval, true -} - -// SetInterval sets field value. -func (o *SLOHistoryMetrics) SetInterval(v int64) { - o.Interval = v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SLOHistoryMetrics) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SLOHistoryMetrics) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SLOHistoryMetrics) SetMessage(v string) { - o.Message = &v -} - -// GetNumerator returns the Numerator field value. -func (o *SLOHistoryMetrics) GetNumerator() SLOHistoryMetricsSeries { - if o == nil { - var ret SLOHistoryMetricsSeries - return ret - } - return o.Numerator -} - -// GetNumeratorOk returns a tuple with the Numerator field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetNumeratorOk() (*SLOHistoryMetricsSeries, bool) { - if o == nil { - return nil, false - } - return &o.Numerator, true -} - -// SetNumerator sets field value. -func (o *SLOHistoryMetrics) SetNumerator(v SLOHistoryMetricsSeries) { - o.Numerator = v -} - -// GetQuery returns the Query field value. -func (o *SLOHistoryMetrics) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *SLOHistoryMetrics) SetQuery(v string) { - o.Query = v -} - -// GetResType returns the ResType field value. -func (o *SLOHistoryMetrics) GetResType() string { - if o == nil { - var ret string - return ret - } - return o.ResType -} - -// GetResTypeOk returns a tuple with the ResType field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetResTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ResType, true -} - -// SetResType sets field value. -func (o *SLOHistoryMetrics) SetResType(v string) { - o.ResType = v -} - -// GetRespVersion returns the RespVersion field value. -func (o *SLOHistoryMetrics) GetRespVersion() int64 { - if o == nil { - var ret int64 - return ret - } - return o.RespVersion -} - -// GetRespVersionOk returns a tuple with the RespVersion field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetRespVersionOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.RespVersion, true -} - -// SetRespVersion sets field value. -func (o *SLOHistoryMetrics) SetRespVersion(v int64) { - o.RespVersion = v -} - -// GetTimes returns the Times field value. -func (o *SLOHistoryMetrics) GetTimes() []float64 { - if o == nil { - var ret []float64 - return ret - } - return o.Times -} - -// GetTimesOk returns a tuple with the Times field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetrics) GetTimesOk() (*[]float64, bool) { - if o == nil { - return nil, false - } - return &o.Times, true -} - -// SetTimes sets field value. -func (o *SLOHistoryMetrics) SetTimes(v []float64) { - o.Times = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryMetrics) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["denominator"] = o.Denominator - toSerialize["interval"] = o.Interval - if o.Message != nil { - toSerialize["message"] = o.Message - } - toSerialize["numerator"] = o.Numerator - toSerialize["query"] = o.Query - toSerialize["res_type"] = o.ResType - toSerialize["resp_version"] = o.RespVersion - toSerialize["times"] = o.Times - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Denominator *SLOHistoryMetricsSeries `json:"denominator"` - Interval *int64 `json:"interval"` - Numerator *SLOHistoryMetricsSeries `json:"numerator"` - Query *string `json:"query"` - ResType *string `json:"res_type"` - RespVersion *int64 `json:"resp_version"` - Times *[]float64 `json:"times"` - }{} - all := struct { - Denominator SLOHistoryMetricsSeries `json:"denominator"` - Interval int64 `json:"interval"` - Message *string `json:"message,omitempty"` - Numerator SLOHistoryMetricsSeries `json:"numerator"` - Query string `json:"query"` - ResType string `json:"res_type"` - RespVersion int64 `json:"resp_version"` - Times []float64 `json:"times"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Denominator == nil { - return fmt.Errorf("Required field denominator missing") - } - if required.Interval == nil { - return fmt.Errorf("Required field interval missing") - } - if required.Numerator == nil { - return fmt.Errorf("Required field numerator missing") - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - if required.ResType == nil { - return fmt.Errorf("Required field res_type missing") - } - if required.RespVersion == nil { - return fmt.Errorf("Required field resp_version missing") - } - if required.Times == nil { - return fmt.Errorf("Required field times missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Denominator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Denominator = all.Denominator - o.Interval = all.Interval - o.Message = all.Message - if all.Numerator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Numerator = all.Numerator - o.Query = all.Query - o.ResType = all.ResType - o.RespVersion = all.RespVersion - o.Times = all.Times - return nil -} diff --git a/api/v1/datadog/model_slo_history_metrics_series.go b/api/v1/datadog/model_slo_history_metrics_series.go deleted file mode 100644 index ec2dc0ba4de..00000000000 --- a/api/v1/datadog/model_slo_history_metrics_series.go +++ /dev/null @@ -1,216 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOHistoryMetricsSeries A representation of `metric` based SLO time series for the provided queries. -// This is the same response type from `batch_query` endpoint. -type SLOHistoryMetricsSeries struct { - // Count of submitted metrics. - Count int64 `json:"count"` - // Query metadata. - Metadata *SLOHistoryMetricsSeriesMetadata `json:"metadata,omitempty"` - // Total sum of the query. - Sum float64 `json:"sum"` - // The query values for each metric. - Values []float64 `json:"values"` - // 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{} -} - -// NewSLOHistoryMetricsSeries instantiates a new SLOHistoryMetricsSeries 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 NewSLOHistoryMetricsSeries(count int64, sum float64, values []float64) *SLOHistoryMetricsSeries { - this := SLOHistoryMetricsSeries{} - this.Count = count - this.Sum = sum - this.Values = values - return &this -} - -// NewSLOHistoryMetricsSeriesWithDefaults instantiates a new SLOHistoryMetricsSeries 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 NewSLOHistoryMetricsSeriesWithDefaults() *SLOHistoryMetricsSeries { - this := SLOHistoryMetricsSeries{} - return &this -} - -// GetCount returns the Count field value. -func (o *SLOHistoryMetricsSeries) GetCount() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Count -} - -// GetCountOk returns a tuple with the Count field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeries) GetCountOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Count, true -} - -// SetCount sets field value. -func (o *SLOHistoryMetricsSeries) SetCount(v int64) { - o.Count = v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeries) GetMetadata() SLOHistoryMetricsSeriesMetadata { - if o == nil || o.Metadata == nil { - var ret SLOHistoryMetricsSeriesMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeries) GetMetadataOk() (*SLOHistoryMetricsSeriesMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeries) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given SLOHistoryMetricsSeriesMetadata and assigns it to the Metadata field. -func (o *SLOHistoryMetricsSeries) SetMetadata(v SLOHistoryMetricsSeriesMetadata) { - o.Metadata = &v -} - -// GetSum returns the Sum field value. -func (o *SLOHistoryMetricsSeries) GetSum() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Sum -} - -// GetSumOk returns a tuple with the Sum field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeries) GetSumOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Sum, true -} - -// SetSum sets field value. -func (o *SLOHistoryMetricsSeries) SetSum(v float64) { - o.Sum = v -} - -// GetValues returns the Values field value. -func (o *SLOHistoryMetricsSeries) GetValues() []float64 { - if o == nil { - var ret []float64 - return ret - } - return o.Values -} - -// GetValuesOk returns a tuple with the Values field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeries) GetValuesOk() (*[]float64, bool) { - if o == nil { - return nil, false - } - return &o.Values, true -} - -// SetValues sets field value. -func (o *SLOHistoryMetricsSeries) SetValues(v []float64) { - o.Values = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryMetricsSeries) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["count"] = o.Count - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - toSerialize["sum"] = o.Sum - toSerialize["values"] = o.Values - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Count *int64 `json:"count"` - Sum *float64 `json:"sum"` - Values *[]float64 `json:"values"` - }{} - all := struct { - Count int64 `json:"count"` - Metadata *SLOHistoryMetricsSeriesMetadata `json:"metadata,omitempty"` - Sum float64 `json:"sum"` - Values []float64 `json:"values"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Count == nil { - return fmt.Errorf("Required field count missing") - } - if required.Sum == nil { - return fmt.Errorf("Required field sum missing") - } - if required.Values == nil { - return fmt.Errorf("Required field values missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Count = all.Count - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Sum = all.Sum - o.Values = all.Values - return nil -} diff --git a/api/v1/datadog/model_slo_history_metrics_series_metadata.go b/api/v1/datadog/model_slo_history_metrics_series_metadata.go deleted file mode 100644 index 41872c49b2e..00000000000 --- a/api/v1/datadog/model_slo_history_metrics_series_metadata.go +++ /dev/null @@ -1,300 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOHistoryMetricsSeriesMetadata Query metadata. -type SLOHistoryMetricsSeriesMetadata struct { - // Query aggregator function. - Aggr *string `json:"aggr,omitempty"` - // Query expression. - Expression *string `json:"expression,omitempty"` - // Query metric used. - Metric *string `json:"metric,omitempty"` - // Query index from original combined query. - QueryIndex *int64 `json:"query_index,omitempty"` - // Query scope. - Scope *string `json:"scope,omitempty"` - // An array of metric units that contains up to two unit objects. - // For example, bytes represents one unit object and bytes per second represents two unit objects. - // If a metric query only has one unit object, the second array element is null. - Unit []SLOHistoryMetricsSeriesMetadataUnit `json:"unit,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{} -} - -// NewSLOHistoryMetricsSeriesMetadata instantiates a new SLOHistoryMetricsSeriesMetadata 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 NewSLOHistoryMetricsSeriesMetadata() *SLOHistoryMetricsSeriesMetadata { - this := SLOHistoryMetricsSeriesMetadata{} - return &this -} - -// NewSLOHistoryMetricsSeriesMetadataWithDefaults instantiates a new SLOHistoryMetricsSeriesMetadata 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 NewSLOHistoryMetricsSeriesMetadataWithDefaults() *SLOHistoryMetricsSeriesMetadata { - this := SLOHistoryMetricsSeriesMetadata{} - return &this -} - -// GetAggr returns the Aggr field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadata) GetAggr() string { - if o == nil || o.Aggr == nil { - var ret string - return ret - } - return *o.Aggr -} - -// GetAggrOk returns a tuple with the Aggr field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadata) GetAggrOk() (*string, bool) { - if o == nil || o.Aggr == nil { - return nil, false - } - return o.Aggr, true -} - -// HasAggr returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadata) HasAggr() bool { - if o != nil && o.Aggr != nil { - return true - } - - return false -} - -// SetAggr gets a reference to the given string and assigns it to the Aggr field. -func (o *SLOHistoryMetricsSeriesMetadata) SetAggr(v string) { - o.Aggr = &v -} - -// GetExpression returns the Expression field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadata) GetExpression() string { - if o == nil || o.Expression == nil { - var ret string - return ret - } - return *o.Expression -} - -// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadata) GetExpressionOk() (*string, bool) { - if o == nil || o.Expression == nil { - return nil, false - } - return o.Expression, true -} - -// HasExpression returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadata) HasExpression() bool { - if o != nil && o.Expression != nil { - return true - } - - return false -} - -// SetExpression gets a reference to the given string and assigns it to the Expression field. -func (o *SLOHistoryMetricsSeriesMetadata) SetExpression(v string) { - o.Expression = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadata) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadata) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadata) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *SLOHistoryMetricsSeriesMetadata) SetMetric(v string) { - o.Metric = &v -} - -// GetQueryIndex returns the QueryIndex field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadata) GetQueryIndex() int64 { - if o == nil || o.QueryIndex == nil { - var ret int64 - return ret - } - return *o.QueryIndex -} - -// GetQueryIndexOk returns a tuple with the QueryIndex field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadata) GetQueryIndexOk() (*int64, bool) { - if o == nil || o.QueryIndex == nil { - return nil, false - } - return o.QueryIndex, true -} - -// HasQueryIndex returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadata) HasQueryIndex() bool { - if o != nil && o.QueryIndex != nil { - return true - } - - return false -} - -// SetQueryIndex gets a reference to the given int64 and assigns it to the QueryIndex field. -func (o *SLOHistoryMetricsSeriesMetadata) SetQueryIndex(v int64) { - o.QueryIndex = &v -} - -// GetScope returns the Scope field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadata) GetScope() string { - if o == nil || o.Scope == nil { - var ret string - return ret - } - return *o.Scope -} - -// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadata) GetScopeOk() (*string, bool) { - if o == nil || o.Scope == nil { - return nil, false - } - return o.Scope, true -} - -// HasScope returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadata) HasScope() bool { - if o != nil && o.Scope != nil { - return true - } - - return false -} - -// SetScope gets a reference to the given string and assigns it to the Scope field. -func (o *SLOHistoryMetricsSeriesMetadata) SetScope(v string) { - o.Scope = &v -} - -// GetUnit returns the Unit field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SLOHistoryMetricsSeriesMetadata) GetUnit() []SLOHistoryMetricsSeriesMetadataUnit { - if o == nil { - var ret []SLOHistoryMetricsSeriesMetadataUnit - return ret - } - return o.Unit -} - -// GetUnitOk returns a tuple with the Unit 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 *SLOHistoryMetricsSeriesMetadata) GetUnitOk() (*[]SLOHistoryMetricsSeriesMetadataUnit, bool) { - if o == nil || o.Unit == nil { - return nil, false - } - return &o.Unit, true -} - -// HasUnit returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadata) HasUnit() bool { - if o != nil && o.Unit != nil { - return true - } - - return false -} - -// SetUnit gets a reference to the given []SLOHistoryMetricsSeriesMetadataUnit and assigns it to the Unit field. -func (o *SLOHistoryMetricsSeriesMetadata) SetUnit(v []SLOHistoryMetricsSeriesMetadataUnit) { - o.Unit = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryMetricsSeriesMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggr != nil { - toSerialize["aggr"] = o.Aggr - } - if o.Expression != nil { - toSerialize["expression"] = o.Expression - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.QueryIndex != nil { - toSerialize["query_index"] = o.QueryIndex - } - if o.Scope != nil { - toSerialize["scope"] = o.Scope - } - if o.Unit != nil { - toSerialize["unit"] = o.Unit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryMetricsSeriesMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggr *string `json:"aggr,omitempty"` - Expression *string `json:"expression,omitempty"` - Metric *string `json:"metric,omitempty"` - QueryIndex *int64 `json:"query_index,omitempty"` - Scope *string `json:"scope,omitempty"` - Unit []SLOHistoryMetricsSeriesMetadataUnit `json:"unit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggr = all.Aggr - o.Expression = all.Expression - o.Metric = all.Metric - o.QueryIndex = all.QueryIndex - o.Scope = all.Scope - o.Unit = all.Unit - return nil -} diff --git a/api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go b/api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go deleted file mode 100644 index 10b42461b80..00000000000 --- a/api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go +++ /dev/null @@ -1,371 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SLOHistoryMetricsSeriesMetadataUnit An Object of metric units. -type SLOHistoryMetricsSeriesMetadataUnit struct { - // The family of metric unit, for example `bytes` is the family for `kibibyte`, `byte`, and `bit` units. - Family *string `json:"family,omitempty"` - // The ID of the metric unit. - Id *int64 `json:"id,omitempty"` - // The unit of the metric, for instance `byte`. - Name *string `json:"name,omitempty"` - // The plural Unit of metric, for instance `bytes`. - Plural common.NullableString `json:"plural,omitempty"` - // The scale factor of metric unit, for instance `1.0`. - ScaleFactor *float64 `json:"scale_factor,omitempty"` - // A shorter and abbreviated version of the metric unit, for instance `B`. - ShortName common.NullableString `json:"short_name,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{} -} - -// NewSLOHistoryMetricsSeriesMetadataUnit instantiates a new SLOHistoryMetricsSeriesMetadataUnit 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 NewSLOHistoryMetricsSeriesMetadataUnit() *SLOHistoryMetricsSeriesMetadataUnit { - this := SLOHistoryMetricsSeriesMetadataUnit{} - return &this -} - -// NewSLOHistoryMetricsSeriesMetadataUnitWithDefaults instantiates a new SLOHistoryMetricsSeriesMetadataUnit 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 NewSLOHistoryMetricsSeriesMetadataUnitWithDefaults() *SLOHistoryMetricsSeriesMetadataUnit { - this := SLOHistoryMetricsSeriesMetadataUnit{} - return &this -} - -// GetFamily returns the Family field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetFamily() string { - if o == nil || o.Family == nil { - var ret string - return ret - } - return *o.Family -} - -// GetFamilyOk returns a tuple with the Family field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetFamilyOk() (*string, bool) { - if o == nil || o.Family == nil { - return nil, false - } - return o.Family, true -} - -// HasFamily returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) HasFamily() bool { - if o != nil && o.Family != nil { - return true - } - - return false -} - -// SetFamily gets a reference to the given string and assigns it to the Family field. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetFamily(v string) { - o.Family = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetId(v int64) { - o.Id = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetName(v string) { - o.Name = &v -} - -// GetPlural returns the Plural field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetPlural() string { - if o == nil || o.Plural.Get() == nil { - var ret string - return ret - } - return *o.Plural.Get() -} - -// GetPluralOk returns a tuple with the Plural 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 *SLOHistoryMetricsSeriesMetadataUnit) GetPluralOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Plural.Get(), o.Plural.IsSet() -} - -// HasPlural returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) HasPlural() bool { - if o != nil && o.Plural.IsSet() { - return true - } - - return false -} - -// SetPlural gets a reference to the given common.NullableString and assigns it to the Plural field. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetPlural(v string) { - o.Plural.Set(&v) -} - -// SetPluralNil sets the value for Plural to be an explicit nil. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetPluralNil() { - o.Plural.Set(nil) -} - -// UnsetPlural ensures that no value is present for Plural, not even an explicit nil. -func (o *SLOHistoryMetricsSeriesMetadataUnit) UnsetPlural() { - o.Plural.Unset() -} - -// GetScaleFactor returns the ScaleFactor field value if set, zero value otherwise. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetScaleFactor() float64 { - if o == nil || o.ScaleFactor == nil { - var ret float64 - return ret - } - return *o.ScaleFactor -} - -// GetScaleFactorOk returns a tuple with the ScaleFactor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetScaleFactorOk() (*float64, bool) { - if o == nil || o.ScaleFactor == nil { - return nil, false - } - return o.ScaleFactor, true -} - -// HasScaleFactor returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) HasScaleFactor() bool { - if o != nil && o.ScaleFactor != nil { - return true - } - - return false -} - -// SetScaleFactor gets a reference to the given float64 and assigns it to the ScaleFactor field. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetScaleFactor(v float64) { - o.ScaleFactor = &v -} - -// GetShortName returns the ShortName field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SLOHistoryMetricsSeriesMetadataUnit) GetShortName() string { - if o == nil || o.ShortName.Get() == nil { - var ret string - return ret - } - return *o.ShortName.Get() -} - -// GetShortNameOk returns a tuple with the ShortName 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 *SLOHistoryMetricsSeriesMetadataUnit) GetShortNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.ShortName.Get(), o.ShortName.IsSet() -} - -// HasShortName returns a boolean if a field has been set. -func (o *SLOHistoryMetricsSeriesMetadataUnit) HasShortName() bool { - if o != nil && o.ShortName.IsSet() { - return true - } - - return false -} - -// SetShortName gets a reference to the given common.NullableString and assigns it to the ShortName field. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetShortName(v string) { - o.ShortName.Set(&v) -} - -// SetShortNameNil sets the value for ShortName to be an explicit nil. -func (o *SLOHistoryMetricsSeriesMetadataUnit) SetShortNameNil() { - o.ShortName.Set(nil) -} - -// UnsetShortName ensures that no value is present for ShortName, not even an explicit nil. -func (o *SLOHistoryMetricsSeriesMetadataUnit) UnsetShortName() { - o.ShortName.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryMetricsSeriesMetadataUnit) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Family != nil { - toSerialize["family"] = o.Family - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Plural.IsSet() { - toSerialize["plural"] = o.Plural.Get() - } - if o.ScaleFactor != nil { - toSerialize["scale_factor"] = o.ScaleFactor - } - if o.ShortName.IsSet() { - toSerialize["short_name"] = o.ShortName.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Family *string `json:"family,omitempty"` - Id *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Plural common.NullableString `json:"plural,omitempty"` - ScaleFactor *float64 `json:"scale_factor,omitempty"` - ShortName common.NullableString `json:"short_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Family = all.Family - o.Id = all.Id - o.Name = all.Name - o.Plural = all.Plural - o.ScaleFactor = all.ScaleFactor - o.ShortName = all.ShortName - return nil -} - -// NullableSLOHistoryMetricsSeriesMetadataUnit handles when a null is used for SLOHistoryMetricsSeriesMetadataUnit. -type NullableSLOHistoryMetricsSeriesMetadataUnit struct { - value *SLOHistoryMetricsSeriesMetadataUnit - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOHistoryMetricsSeriesMetadataUnit) Get() *SLOHistoryMetricsSeriesMetadataUnit { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOHistoryMetricsSeriesMetadataUnit) Set(val *SLOHistoryMetricsSeriesMetadataUnit) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOHistoryMetricsSeriesMetadataUnit) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSLOHistoryMetricsSeriesMetadataUnit) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOHistoryMetricsSeriesMetadataUnit initializes the struct as if Set has been called. -func NewNullableSLOHistoryMetricsSeriesMetadataUnit(val *SLOHistoryMetricsSeriesMetadataUnit) *NullableSLOHistoryMetricsSeriesMetadataUnit { - return &NullableSLOHistoryMetricsSeriesMetadataUnit{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOHistoryMetricsSeriesMetadataUnit) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_history_monitor.go b/api/v1/datadog/model_slo_history_monitor.go deleted file mode 100644 index 5603febc096..00000000000 --- a/api/v1/datadog/model_slo_history_monitor.go +++ /dev/null @@ -1,541 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOHistoryMonitor An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. -// This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs. -type SLOHistoryMonitor struct { - // A mapping of threshold `timeframe` to the remaining error budget. - ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` - // An array of error objects returned while querying the history data for the service level objective. - Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` - // For groups in a grouped SLO, this is the group name. - Group *string `json:"group,omitempty"` - // For `monitor` based SLOs, this includes the aggregated history as arrays that include time series and uptime data where `0=monitor` is in `OK` state and `1=monitor` is in `alert` state. - History [][]float64 `json:"history,omitempty"` - // For `monitor` based SLOs, this is the last modified timestamp in epoch seconds of the monitor. - MonitorModified *int64 `json:"monitor_modified,omitempty"` - // For `monitor` based SLOs, this describes the type of monitor. - MonitorType *string `json:"monitor_type,omitempty"` - // For groups in a grouped SLO, this is the group name. For monitors in a multi-monitor SLO, this is the monitor name. - Name *string `json:"name,omitempty"` - // The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. Use `span_precision` instead. - // Deprecated - Precision *float64 `json:"precision,omitempty"` - // For `monitor` based SLOs, when `true` this indicates that a replay is in progress to give an accurate uptime - // calculation. - Preview *bool `json:"preview,omitempty"` - // The current SLI value of the SLO over the history window. - SliValue *float64 `json:"sli_value,omitempty"` - // The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. - SpanPrecision *float64 `json:"span_precision,omitempty"` - // Use `sli_value` instead. - // Deprecated - Uptime *float64 `json:"uptime,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{} -} - -// NewSLOHistoryMonitor instantiates a new SLOHistoryMonitor 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 NewSLOHistoryMonitor() *SLOHistoryMonitor { - this := SLOHistoryMonitor{} - return &this -} - -// NewSLOHistoryMonitorWithDefaults instantiates a new SLOHistoryMonitor 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 NewSLOHistoryMonitorWithDefaults() *SLOHistoryMonitor { - this := SLOHistoryMonitor{} - return &this -} - -// GetErrorBudgetRemaining returns the ErrorBudgetRemaining field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetErrorBudgetRemaining() map[string]float64 { - if o == nil || o.ErrorBudgetRemaining == nil { - var ret map[string]float64 - return ret - } - return o.ErrorBudgetRemaining -} - -// GetErrorBudgetRemainingOk returns a tuple with the ErrorBudgetRemaining field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetErrorBudgetRemainingOk() (*map[string]float64, bool) { - if o == nil || o.ErrorBudgetRemaining == nil { - return nil, false - } - return &o.ErrorBudgetRemaining, true -} - -// HasErrorBudgetRemaining returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasErrorBudgetRemaining() bool { - if o != nil && o.ErrorBudgetRemaining != nil { - return true - } - - return false -} - -// SetErrorBudgetRemaining gets a reference to the given map[string]float64 and assigns it to the ErrorBudgetRemaining field. -func (o *SLOHistoryMonitor) SetErrorBudgetRemaining(v map[string]float64) { - o.ErrorBudgetRemaining = v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetErrors() []SLOHistoryResponseErrorWithType { - if o == nil || o.Errors == nil { - var ret []SLOHistoryResponseErrorWithType - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetErrorsOk() (*[]SLOHistoryResponseErrorWithType, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []SLOHistoryResponseErrorWithType and assigns it to the Errors field. -func (o *SLOHistoryMonitor) SetErrors(v []SLOHistoryResponseErrorWithType) { - o.Errors = v -} - -// GetGroup returns the Group field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetGroup() string { - if o == nil || o.Group == nil { - var ret string - return ret - } - return *o.Group -} - -// GetGroupOk returns a tuple with the Group field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetGroupOk() (*string, bool) { - if o == nil || o.Group == nil { - return nil, false - } - return o.Group, true -} - -// HasGroup returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasGroup() bool { - if o != nil && o.Group != nil { - return true - } - - return false -} - -// SetGroup gets a reference to the given string and assigns it to the Group field. -func (o *SLOHistoryMonitor) SetGroup(v string) { - o.Group = &v -} - -// GetHistory returns the History field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetHistory() [][]float64 { - if o == nil || o.History == nil { - var ret [][]float64 - return ret - } - return o.History -} - -// GetHistoryOk returns a tuple with the History field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetHistoryOk() (*[][]float64, bool) { - if o == nil || o.History == nil { - return nil, false - } - return &o.History, true -} - -// HasHistory returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasHistory() bool { - if o != nil && o.History != nil { - return true - } - - return false -} - -// SetHistory gets a reference to the given [][]float64 and assigns it to the History field. -func (o *SLOHistoryMonitor) SetHistory(v [][]float64) { - o.History = v -} - -// GetMonitorModified returns the MonitorModified field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetMonitorModified() int64 { - if o == nil || o.MonitorModified == nil { - var ret int64 - return ret - } - return *o.MonitorModified -} - -// GetMonitorModifiedOk returns a tuple with the MonitorModified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetMonitorModifiedOk() (*int64, bool) { - if o == nil || o.MonitorModified == nil { - return nil, false - } - return o.MonitorModified, true -} - -// HasMonitorModified returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasMonitorModified() bool { - if o != nil && o.MonitorModified != nil { - return true - } - - return false -} - -// SetMonitorModified gets a reference to the given int64 and assigns it to the MonitorModified field. -func (o *SLOHistoryMonitor) SetMonitorModified(v int64) { - o.MonitorModified = &v -} - -// GetMonitorType returns the MonitorType field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetMonitorType() string { - if o == nil || o.MonitorType == nil { - var ret string - return ret - } - return *o.MonitorType -} - -// GetMonitorTypeOk returns a tuple with the MonitorType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetMonitorTypeOk() (*string, bool) { - if o == nil || o.MonitorType == nil { - return nil, false - } - return o.MonitorType, true -} - -// HasMonitorType returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasMonitorType() bool { - if o != nil && o.MonitorType != nil { - return true - } - - return false -} - -// SetMonitorType gets a reference to the given string and assigns it to the MonitorType field. -func (o *SLOHistoryMonitor) SetMonitorType(v string) { - o.MonitorType = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SLOHistoryMonitor) SetName(v string) { - o.Name = &v -} - -// GetPrecision returns the Precision field value if set, zero value otherwise. -// Deprecated -func (o *SLOHistoryMonitor) GetPrecision() float64 { - if o == nil || o.Precision == nil { - var ret float64 - return ret - } - return *o.Precision -} - -// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *SLOHistoryMonitor) GetPrecisionOk() (*float64, bool) { - if o == nil || o.Precision == nil { - return nil, false - } - return o.Precision, true -} - -// HasPrecision returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasPrecision() bool { - if o != nil && o.Precision != nil { - return true - } - - return false -} - -// SetPrecision gets a reference to the given float64 and assigns it to the Precision field. -// Deprecated -func (o *SLOHistoryMonitor) SetPrecision(v float64) { - o.Precision = &v -} - -// GetPreview returns the Preview field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetPreview() bool { - if o == nil || o.Preview == nil { - var ret bool - return ret - } - return *o.Preview -} - -// GetPreviewOk returns a tuple with the Preview field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetPreviewOk() (*bool, bool) { - if o == nil || o.Preview == nil { - return nil, false - } - return o.Preview, true -} - -// HasPreview returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasPreview() bool { - if o != nil && o.Preview != nil { - return true - } - - return false -} - -// SetPreview gets a reference to the given bool and assigns it to the Preview field. -func (o *SLOHistoryMonitor) SetPreview(v bool) { - o.Preview = &v -} - -// GetSliValue returns the SliValue field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetSliValue() float64 { - if o == nil || o.SliValue == nil { - var ret float64 - return ret - } - return *o.SliValue -} - -// GetSliValueOk returns a tuple with the SliValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetSliValueOk() (*float64, bool) { - if o == nil || o.SliValue == nil { - return nil, false - } - return o.SliValue, true -} - -// HasSliValue returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasSliValue() bool { - if o != nil && o.SliValue != nil { - return true - } - - return false -} - -// SetSliValue gets a reference to the given float64 and assigns it to the SliValue field. -func (o *SLOHistoryMonitor) SetSliValue(v float64) { - o.SliValue = &v -} - -// GetSpanPrecision returns the SpanPrecision field value if set, zero value otherwise. -func (o *SLOHistoryMonitor) GetSpanPrecision() float64 { - if o == nil || o.SpanPrecision == nil { - var ret float64 - return ret - } - return *o.SpanPrecision -} - -// GetSpanPrecisionOk returns a tuple with the SpanPrecision field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryMonitor) GetSpanPrecisionOk() (*float64, bool) { - if o == nil || o.SpanPrecision == nil { - return nil, false - } - return o.SpanPrecision, true -} - -// HasSpanPrecision returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasSpanPrecision() bool { - if o != nil && o.SpanPrecision != nil { - return true - } - - return false -} - -// SetSpanPrecision gets a reference to the given float64 and assigns it to the SpanPrecision field. -func (o *SLOHistoryMonitor) SetSpanPrecision(v float64) { - o.SpanPrecision = &v -} - -// GetUptime returns the Uptime field value if set, zero value otherwise. -// Deprecated -func (o *SLOHistoryMonitor) GetUptime() float64 { - if o == nil || o.Uptime == nil { - var ret float64 - return ret - } - return *o.Uptime -} - -// GetUptimeOk returns a tuple with the Uptime field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *SLOHistoryMonitor) GetUptimeOk() (*float64, bool) { - if o == nil || o.Uptime == nil { - return nil, false - } - return o.Uptime, true -} - -// HasUptime returns a boolean if a field has been set. -func (o *SLOHistoryMonitor) HasUptime() bool { - if o != nil && o.Uptime != nil { - return true - } - - return false -} - -// SetUptime gets a reference to the given float64 and assigns it to the Uptime field. -// Deprecated -func (o *SLOHistoryMonitor) SetUptime(v float64) { - o.Uptime = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryMonitor) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ErrorBudgetRemaining != nil { - toSerialize["error_budget_remaining"] = o.ErrorBudgetRemaining - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - if o.Group != nil { - toSerialize["group"] = o.Group - } - if o.History != nil { - toSerialize["history"] = o.History - } - if o.MonitorModified != nil { - toSerialize["monitor_modified"] = o.MonitorModified - } - if o.MonitorType != nil { - toSerialize["monitor_type"] = o.MonitorType - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Precision != nil { - toSerialize["precision"] = o.Precision - } - if o.Preview != nil { - toSerialize["preview"] = o.Preview - } - if o.SliValue != nil { - toSerialize["sli_value"] = o.SliValue - } - if o.SpanPrecision != nil { - toSerialize["span_precision"] = o.SpanPrecision - } - if o.Uptime != nil { - toSerialize["uptime"] = o.Uptime - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryMonitor) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` - Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` - Group *string `json:"group,omitempty"` - History [][]float64 `json:"history,omitempty"` - MonitorModified *int64 `json:"monitor_modified,omitempty"` - MonitorType *string `json:"monitor_type,omitempty"` - Name *string `json:"name,omitempty"` - Precision *float64 `json:"precision,omitempty"` - Preview *bool `json:"preview,omitempty"` - SliValue *float64 `json:"sli_value,omitempty"` - SpanPrecision *float64 `json:"span_precision,omitempty"` - Uptime *float64 `json:"uptime,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ErrorBudgetRemaining = all.ErrorBudgetRemaining - o.Errors = all.Errors - o.Group = all.Group - o.History = all.History - o.MonitorModified = all.MonitorModified - o.MonitorType = all.MonitorType - o.Name = all.Name - o.Precision = all.Precision - o.Preview = all.Preview - o.SliValue = all.SliValue - o.SpanPrecision = all.SpanPrecision - o.Uptime = all.Uptime - return nil -} diff --git a/api/v1/datadog/model_slo_history_response.go b/api/v1/datadog/model_slo_history_response.go deleted file mode 100644 index 3daccd041ba..00000000000 --- a/api/v1/datadog/model_slo_history_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOHistoryResponse A service level objective history response. -type SLOHistoryResponse struct { - // An array of service level objective objects. - Data *SLOHistoryResponseData `json:"data,omitempty"` - // A list of errors while querying the history data for the service level objective. - Errors []SLOHistoryResponseError `json:"errors,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{} -} - -// NewSLOHistoryResponse instantiates a new SLOHistoryResponse 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 NewSLOHistoryResponse() *SLOHistoryResponse { - this := SLOHistoryResponse{} - return &this -} - -// NewSLOHistoryResponseWithDefaults instantiates a new SLOHistoryResponse 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 NewSLOHistoryResponseWithDefaults() *SLOHistoryResponse { - this := SLOHistoryResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOHistoryResponse) GetData() SLOHistoryResponseData { - if o == nil || o.Data == nil { - var ret SLOHistoryResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponse) GetDataOk() (*SLOHistoryResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOHistoryResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SLOHistoryResponseData and assigns it to the Data field. -func (o *SLOHistoryResponse) SetData(v SLOHistoryResponseData) { - o.Data = &v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *SLOHistoryResponse) GetErrors() []SLOHistoryResponseError { - if o == nil || o.Errors == nil { - var ret []SLOHistoryResponseError - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponse) GetErrorsOk() (*[]SLOHistoryResponseError, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *SLOHistoryResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []SLOHistoryResponseError and assigns it to the Errors field. -func (o *SLOHistoryResponse) SetErrors(v []SLOHistoryResponseError) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SLOHistoryResponseData `json:"data,omitempty"` - Errors []SLOHistoryResponseError `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Errors = all.Errors - return nil -} diff --git a/api/v1/datadog/model_slo_history_response_data.go b/api/v1/datadog/model_slo_history_response_data.go deleted file mode 100644 index 3593e5b8b15..00000000000 --- a/api/v1/datadog/model_slo_history_response_data.go +++ /dev/null @@ -1,494 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOHistoryResponseData An array of service level objective objects. -type SLOHistoryResponseData struct { - // The `from` timestamp in epoch seconds. - FromTs *int64 `json:"from_ts,omitempty"` - // For `metric` based SLOs where the query includes a group-by clause, this represents the list of grouping parameters. - // - // This is not included in responses for `monitor` based SLOs. - GroupBy []string `json:"group_by,omitempty"` - // For grouped SLOs, this represents SLI data for specific groups. - // - // This is not included in the responses for `metric` based SLOs. - Groups []SLOHistoryMonitor `json:"groups,omitempty"` - // For multi-monitor SLOs, this represents SLI data for specific monitors. - // - // This is not included in the responses for `metric` based SLOs. - Monitors []SLOHistoryMonitor `json:"monitors,omitempty"` - // An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. - // This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs. - Overall *SLOHistorySLIData `json:"overall,omitempty"` - // A `metric` based SLO history response. - // - // This is not included in responses for `monitor` based SLOs. - Series *SLOHistoryMetrics `json:"series,omitempty"` - // mapping of string timeframe to the SLO threshold. - Thresholds map[string]SLOThreshold `json:"thresholds,omitempty"` - // The `to` timestamp in epoch seconds. - ToTs *int64 `json:"to_ts,omitempty"` - // The type of the service level objective. - Type *SLOType `json:"type,omitempty"` - // A numeric representation of the type of the service level objective (`0` for - // monitor, `1` for metric). Always included in service level objective responses. - // Ignored in create/update requests. - TypeId *SLOTypeNumeric `json:"type_id,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{} -} - -// NewSLOHistoryResponseData instantiates a new SLOHistoryResponseData 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 NewSLOHistoryResponseData() *SLOHistoryResponseData { - this := SLOHistoryResponseData{} - return &this -} - -// NewSLOHistoryResponseDataWithDefaults instantiates a new SLOHistoryResponseData 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 NewSLOHistoryResponseDataWithDefaults() *SLOHistoryResponseData { - this := SLOHistoryResponseData{} - return &this -} - -// GetFromTs returns the FromTs field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetFromTs() int64 { - if o == nil || o.FromTs == nil { - var ret int64 - return ret - } - return *o.FromTs -} - -// GetFromTsOk returns a tuple with the FromTs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetFromTsOk() (*int64, bool) { - if o == nil || o.FromTs == nil { - return nil, false - } - return o.FromTs, true -} - -// HasFromTs returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasFromTs() bool { - if o != nil && o.FromTs != nil { - return true - } - - return false -} - -// SetFromTs gets a reference to the given int64 and assigns it to the FromTs field. -func (o *SLOHistoryResponseData) SetFromTs(v int64) { - o.FromTs = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetGroupBy() []string { - if o == nil || o.GroupBy == nil { - var ret []string - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetGroupByOk() (*[]string, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. -func (o *SLOHistoryResponseData) SetGroupBy(v []string) { - o.GroupBy = v -} - -// GetGroups returns the Groups field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetGroups() []SLOHistoryMonitor { - if o == nil || o.Groups == nil { - var ret []SLOHistoryMonitor - 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 *SLOHistoryResponseData) GetGroupsOk() (*[]SLOHistoryMonitor, 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 *SLOHistoryResponseData) HasGroups() bool { - if o != nil && o.Groups != nil { - return true - } - - return false -} - -// SetGroups gets a reference to the given []SLOHistoryMonitor and assigns it to the Groups field. -func (o *SLOHistoryResponseData) SetGroups(v []SLOHistoryMonitor) { - o.Groups = v -} - -// GetMonitors returns the Monitors field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetMonitors() []SLOHistoryMonitor { - if o == nil || o.Monitors == nil { - var ret []SLOHistoryMonitor - return ret - } - return o.Monitors -} - -// GetMonitorsOk returns a tuple with the Monitors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetMonitorsOk() (*[]SLOHistoryMonitor, bool) { - if o == nil || o.Monitors == nil { - return nil, false - } - return &o.Monitors, true -} - -// HasMonitors returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasMonitors() bool { - if o != nil && o.Monitors != nil { - return true - } - - return false -} - -// SetMonitors gets a reference to the given []SLOHistoryMonitor and assigns it to the Monitors field. -func (o *SLOHistoryResponseData) SetMonitors(v []SLOHistoryMonitor) { - o.Monitors = v -} - -// GetOverall returns the Overall field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetOverall() SLOHistorySLIData { - if o == nil || o.Overall == nil { - var ret SLOHistorySLIData - return ret - } - return *o.Overall -} - -// GetOverallOk returns a tuple with the Overall field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetOverallOk() (*SLOHistorySLIData, bool) { - if o == nil || o.Overall == nil { - return nil, false - } - return o.Overall, true -} - -// HasOverall returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasOverall() bool { - if o != nil && o.Overall != nil { - return true - } - - return false -} - -// SetOverall gets a reference to the given SLOHistorySLIData and assigns it to the Overall field. -func (o *SLOHistoryResponseData) SetOverall(v SLOHistorySLIData) { - o.Overall = &v -} - -// GetSeries returns the Series field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetSeries() SLOHistoryMetrics { - if o == nil || o.Series == nil { - var ret SLOHistoryMetrics - return ret - } - return *o.Series -} - -// GetSeriesOk returns a tuple with the Series field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetSeriesOk() (*SLOHistoryMetrics, bool) { - if o == nil || o.Series == nil { - return nil, false - } - return o.Series, true -} - -// HasSeries returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasSeries() bool { - if o != nil && o.Series != nil { - return true - } - - return false -} - -// SetSeries gets a reference to the given SLOHistoryMetrics and assigns it to the Series field. -func (o *SLOHistoryResponseData) SetSeries(v SLOHistoryMetrics) { - o.Series = &v -} - -// GetThresholds returns the Thresholds field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetThresholds() map[string]SLOThreshold { - if o == nil || o.Thresholds == nil { - var ret map[string]SLOThreshold - return ret - } - return o.Thresholds -} - -// GetThresholdsOk returns a tuple with the Thresholds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetThresholdsOk() (*map[string]SLOThreshold, bool) { - if o == nil || o.Thresholds == nil { - return nil, false - } - return &o.Thresholds, true -} - -// HasThresholds returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasThresholds() bool { - if o != nil && o.Thresholds != nil { - return true - } - - return false -} - -// SetThresholds gets a reference to the given map[string]SLOThreshold and assigns it to the Thresholds field. -func (o *SLOHistoryResponseData) SetThresholds(v map[string]SLOThreshold) { - o.Thresholds = v -} - -// GetToTs returns the ToTs field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetToTs() int64 { - if o == nil || o.ToTs == nil { - var ret int64 - return ret - } - return *o.ToTs -} - -// GetToTsOk returns a tuple with the ToTs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetToTsOk() (*int64, bool) { - if o == nil || o.ToTs == nil { - return nil, false - } - return o.ToTs, true -} - -// HasToTs returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasToTs() bool { - if o != nil && o.ToTs != nil { - return true - } - - return false -} - -// SetToTs gets a reference to the given int64 and assigns it to the ToTs field. -func (o *SLOHistoryResponseData) SetToTs(v int64) { - o.ToTs = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetType() SLOType { - if o == nil || o.Type == nil { - var ret SLOType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetTypeOk() (*SLOType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SLOType and assigns it to the Type field. -func (o *SLOHistoryResponseData) SetType(v SLOType) { - o.Type = &v -} - -// GetTypeId returns the TypeId field value if set, zero value otherwise. -func (o *SLOHistoryResponseData) GetTypeId() SLOTypeNumeric { - if o == nil || o.TypeId == nil { - var ret SLOTypeNumeric - return ret - } - return *o.TypeId -} - -// GetTypeIdOk returns a tuple with the TypeId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseData) GetTypeIdOk() (*SLOTypeNumeric, bool) { - if o == nil || o.TypeId == nil { - return nil, false - } - return o.TypeId, true -} - -// HasTypeId returns a boolean if a field has been set. -func (o *SLOHistoryResponseData) HasTypeId() bool { - if o != nil && o.TypeId != nil { - return true - } - - return false -} - -// SetTypeId gets a reference to the given SLOTypeNumeric and assigns it to the TypeId field. -func (o *SLOHistoryResponseData) SetTypeId(v SLOTypeNumeric) { - o.TypeId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.FromTs != nil { - toSerialize["from_ts"] = o.FromTs - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Groups != nil { - toSerialize["groups"] = o.Groups - } - if o.Monitors != nil { - toSerialize["monitors"] = o.Monitors - } - if o.Overall != nil { - toSerialize["overall"] = o.Overall - } - if o.Series != nil { - toSerialize["series"] = o.Series - } - if o.Thresholds != nil { - toSerialize["thresholds"] = o.Thresholds - } - if o.ToTs != nil { - toSerialize["to_ts"] = o.ToTs - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.TypeId != nil { - toSerialize["type_id"] = o.TypeId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - FromTs *int64 `json:"from_ts,omitempty"` - GroupBy []string `json:"group_by,omitempty"` - Groups []SLOHistoryMonitor `json:"groups,omitempty"` - Monitors []SLOHistoryMonitor `json:"monitors,omitempty"` - Overall *SLOHistorySLIData `json:"overall,omitempty"` - Series *SLOHistoryMetrics `json:"series,omitempty"` - Thresholds map[string]SLOThreshold `json:"thresholds,omitempty"` - ToTs *int64 `json:"to_ts,omitempty"` - Type *SLOType `json:"type,omitempty"` - TypeId *SLOTypeNumeric `json:"type_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TypeId; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.FromTs = all.FromTs - o.GroupBy = all.GroupBy - o.Groups = all.Groups - o.Monitors = all.Monitors - if all.Overall != nil && all.Overall.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Overall = all.Overall - if all.Series != nil && all.Series.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Series = all.Series - o.Thresholds = all.Thresholds - o.ToTs = all.ToTs - o.Type = all.Type - o.TypeId = all.TypeId - return nil -} diff --git a/api/v1/datadog/model_slo_history_response_error.go b/api/v1/datadog/model_slo_history_response_error.go deleted file mode 100644 index 9d1709d50e1..00000000000 --- a/api/v1/datadog/model_slo_history_response_error.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOHistoryResponseError A list of errors while querying the history data for the service level objective. -type SLOHistoryResponseError struct { - // Human readable error. - Error *string `json:"error,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{} -} - -// NewSLOHistoryResponseError instantiates a new SLOHistoryResponseError 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 NewSLOHistoryResponseError() *SLOHistoryResponseError { - this := SLOHistoryResponseError{} - return &this -} - -// NewSLOHistoryResponseErrorWithDefaults instantiates a new SLOHistoryResponseError 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 NewSLOHistoryResponseErrorWithDefaults() *SLOHistoryResponseError { - this := SLOHistoryResponseError{} - return &this -} - -// GetError returns the Error field value if set, zero value otherwise. -func (o *SLOHistoryResponseError) GetError() string { - if o == nil || o.Error == nil { - var ret string - return ret - } - return *o.Error -} - -// GetErrorOk returns a tuple with the Error field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseError) GetErrorOk() (*string, bool) { - if o == nil || o.Error == nil { - return nil, false - } - return o.Error, true -} - -// HasError returns a boolean if a field has been set. -func (o *SLOHistoryResponseError) HasError() bool { - if o != nil && o.Error != nil { - return true - } - - return false -} - -// SetError gets a reference to the given string and assigns it to the Error field. -func (o *SLOHistoryResponseError) SetError(v string) { - o.Error = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryResponseError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Error != nil { - toSerialize["error"] = o.Error - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryResponseError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Error *string `json:"error,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Error = all.Error - return nil -} diff --git a/api/v1/datadog/model_slo_history_response_error_with_type.go b/api/v1/datadog/model_slo_history_response_error_with_type.go deleted file mode 100644 index 777a921c8f9..00000000000 --- a/api/v1/datadog/model_slo_history_response_error_with_type.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOHistoryResponseErrorWithType An object describing the error with error type and error message. -type SLOHistoryResponseErrorWithType struct { - // A message with more details about the error. - ErrorMessage string `json:"error_message"` - // Type of the error. - ErrorType string `json:"error_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{} -} - -// NewSLOHistoryResponseErrorWithType instantiates a new SLOHistoryResponseErrorWithType 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 NewSLOHistoryResponseErrorWithType(errorMessage string, errorType string) *SLOHistoryResponseErrorWithType { - this := SLOHistoryResponseErrorWithType{} - this.ErrorMessage = errorMessage - this.ErrorType = errorType - return &this -} - -// NewSLOHistoryResponseErrorWithTypeWithDefaults instantiates a new SLOHistoryResponseErrorWithType 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 NewSLOHistoryResponseErrorWithTypeWithDefaults() *SLOHistoryResponseErrorWithType { - this := SLOHistoryResponseErrorWithType{} - return &this -} - -// GetErrorMessage returns the ErrorMessage field value. -func (o *SLOHistoryResponseErrorWithType) GetErrorMessage() string { - if o == nil { - var ret string - return ret - } - return o.ErrorMessage -} - -// GetErrorMessageOk returns a tuple with the ErrorMessage field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseErrorWithType) GetErrorMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ErrorMessage, true -} - -// SetErrorMessage sets field value. -func (o *SLOHistoryResponseErrorWithType) SetErrorMessage(v string) { - o.ErrorMessage = v -} - -// GetErrorType returns the ErrorType field value. -func (o *SLOHistoryResponseErrorWithType) GetErrorType() string { - if o == nil { - var ret string - return ret - } - return o.ErrorType -} - -// GetErrorTypeOk returns a tuple with the ErrorType field value -// and a boolean to check if the value has been set. -func (o *SLOHistoryResponseErrorWithType) GetErrorTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ErrorType, true -} - -// SetErrorType sets field value. -func (o *SLOHistoryResponseErrorWithType) SetErrorType(v string) { - o.ErrorType = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistoryResponseErrorWithType) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["error_message"] = o.ErrorMessage - toSerialize["error_type"] = o.ErrorType - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistoryResponseErrorWithType) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ErrorMessage *string `json:"error_message"` - ErrorType *string `json:"error_type"` - }{} - all := struct { - ErrorMessage string `json:"error_message"` - ErrorType string `json:"error_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ErrorMessage == nil { - return fmt.Errorf("Required field error_message missing") - } - if required.ErrorType == nil { - return fmt.Errorf("Required field error_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ErrorMessage = all.ErrorMessage - o.ErrorType = all.ErrorType - return nil -} diff --git a/api/v1/datadog/model_slo_history_sli_data.go b/api/v1/datadog/model_slo_history_sli_data.go deleted file mode 100644 index 7b5f87b6910..00000000000 --- a/api/v1/datadog/model_slo_history_sli_data.go +++ /dev/null @@ -1,537 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOHistorySLIData An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. -// This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs. -type SLOHistorySLIData struct { - // A mapping of threshold `timeframe` to the remaining error budget. - ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` - // An array of error objects returned while querying the history data for the service level objective. - Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` - // For groups in a grouped SLO, this is the group name. - Group *string `json:"group,omitempty"` - // For `monitor` based SLOs, this includes the aggregated history as arrays that include time series and uptime data where `0=monitor` is in `OK` state and `1=monitor` is in `alert` state. - History [][]float64 `json:"history,omitempty"` - // For `monitor` based SLOs, this is the last modified timestamp in epoch seconds of the monitor. - MonitorModified *int64 `json:"monitor_modified,omitempty"` - // For `monitor` based SLOs, this describes the type of monitor. - MonitorType *string `json:"monitor_type,omitempty"` - // For groups in a grouped SLO, this is the group name. For monitors in a multi-monitor SLO, this is the monitor name. - Name *string `json:"name,omitempty"` - // A mapping of threshold `timeframe` to number of accurate decimals, regardless of the from && to timestamp. - Precision map[string]float64 `json:"precision,omitempty"` - // For `monitor` based SLOs, when `true` this indicates that a replay is in progress to give an accurate uptime - // calculation. - Preview *bool `json:"preview,omitempty"` - // The current SLI value of the SLO over the history window. - SliValue *float64 `json:"sli_value,omitempty"` - // The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. - SpanPrecision *float64 `json:"span_precision,omitempty"` - // Use `sli_value` instead. - // Deprecated - Uptime *float64 `json:"uptime,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{} -} - -// NewSLOHistorySLIData instantiates a new SLOHistorySLIData 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 NewSLOHistorySLIData() *SLOHistorySLIData { - this := SLOHistorySLIData{} - return &this -} - -// NewSLOHistorySLIDataWithDefaults instantiates a new SLOHistorySLIData 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 NewSLOHistorySLIDataWithDefaults() *SLOHistorySLIData { - this := SLOHistorySLIData{} - return &this -} - -// GetErrorBudgetRemaining returns the ErrorBudgetRemaining field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetErrorBudgetRemaining() map[string]float64 { - if o == nil || o.ErrorBudgetRemaining == nil { - var ret map[string]float64 - return ret - } - return o.ErrorBudgetRemaining -} - -// GetErrorBudgetRemainingOk returns a tuple with the ErrorBudgetRemaining field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetErrorBudgetRemainingOk() (*map[string]float64, bool) { - if o == nil || o.ErrorBudgetRemaining == nil { - return nil, false - } - return &o.ErrorBudgetRemaining, true -} - -// HasErrorBudgetRemaining returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasErrorBudgetRemaining() bool { - if o != nil && o.ErrorBudgetRemaining != nil { - return true - } - - return false -} - -// SetErrorBudgetRemaining gets a reference to the given map[string]float64 and assigns it to the ErrorBudgetRemaining field. -func (o *SLOHistorySLIData) SetErrorBudgetRemaining(v map[string]float64) { - o.ErrorBudgetRemaining = v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetErrors() []SLOHistoryResponseErrorWithType { - if o == nil || o.Errors == nil { - var ret []SLOHistoryResponseErrorWithType - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetErrorsOk() (*[]SLOHistoryResponseErrorWithType, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []SLOHistoryResponseErrorWithType and assigns it to the Errors field. -func (o *SLOHistorySLIData) SetErrors(v []SLOHistoryResponseErrorWithType) { - o.Errors = v -} - -// GetGroup returns the Group field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetGroup() string { - if o == nil || o.Group == nil { - var ret string - return ret - } - return *o.Group -} - -// GetGroupOk returns a tuple with the Group field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetGroupOk() (*string, bool) { - if o == nil || o.Group == nil { - return nil, false - } - return o.Group, true -} - -// HasGroup returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasGroup() bool { - if o != nil && o.Group != nil { - return true - } - - return false -} - -// SetGroup gets a reference to the given string and assigns it to the Group field. -func (o *SLOHistorySLIData) SetGroup(v string) { - o.Group = &v -} - -// GetHistory returns the History field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetHistory() [][]float64 { - if o == nil || o.History == nil { - var ret [][]float64 - return ret - } - return o.History -} - -// GetHistoryOk returns a tuple with the History field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetHistoryOk() (*[][]float64, bool) { - if o == nil || o.History == nil { - return nil, false - } - return &o.History, true -} - -// HasHistory returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasHistory() bool { - if o != nil && o.History != nil { - return true - } - - return false -} - -// SetHistory gets a reference to the given [][]float64 and assigns it to the History field. -func (o *SLOHistorySLIData) SetHistory(v [][]float64) { - o.History = v -} - -// GetMonitorModified returns the MonitorModified field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetMonitorModified() int64 { - if o == nil || o.MonitorModified == nil { - var ret int64 - return ret - } - return *o.MonitorModified -} - -// GetMonitorModifiedOk returns a tuple with the MonitorModified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetMonitorModifiedOk() (*int64, bool) { - if o == nil || o.MonitorModified == nil { - return nil, false - } - return o.MonitorModified, true -} - -// HasMonitorModified returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasMonitorModified() bool { - if o != nil && o.MonitorModified != nil { - return true - } - - return false -} - -// SetMonitorModified gets a reference to the given int64 and assigns it to the MonitorModified field. -func (o *SLOHistorySLIData) SetMonitorModified(v int64) { - o.MonitorModified = &v -} - -// GetMonitorType returns the MonitorType field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetMonitorType() string { - if o == nil || o.MonitorType == nil { - var ret string - return ret - } - return *o.MonitorType -} - -// GetMonitorTypeOk returns a tuple with the MonitorType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetMonitorTypeOk() (*string, bool) { - if o == nil || o.MonitorType == nil { - return nil, false - } - return o.MonitorType, true -} - -// HasMonitorType returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasMonitorType() bool { - if o != nil && o.MonitorType != nil { - return true - } - - return false -} - -// SetMonitorType gets a reference to the given string and assigns it to the MonitorType field. -func (o *SLOHistorySLIData) SetMonitorType(v string) { - o.MonitorType = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SLOHistorySLIData) SetName(v string) { - o.Name = &v -} - -// GetPrecision returns the Precision field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetPrecision() map[string]float64 { - if o == nil || o.Precision == nil { - var ret map[string]float64 - return ret - } - return o.Precision -} - -// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetPrecisionOk() (*map[string]float64, bool) { - if o == nil || o.Precision == nil { - return nil, false - } - return &o.Precision, true -} - -// HasPrecision returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasPrecision() bool { - if o != nil && o.Precision != nil { - return true - } - - return false -} - -// SetPrecision gets a reference to the given map[string]float64 and assigns it to the Precision field. -func (o *SLOHistorySLIData) SetPrecision(v map[string]float64) { - o.Precision = v -} - -// GetPreview returns the Preview field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetPreview() bool { - if o == nil || o.Preview == nil { - var ret bool - return ret - } - return *o.Preview -} - -// GetPreviewOk returns a tuple with the Preview field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetPreviewOk() (*bool, bool) { - if o == nil || o.Preview == nil { - return nil, false - } - return o.Preview, true -} - -// HasPreview returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasPreview() bool { - if o != nil && o.Preview != nil { - return true - } - - return false -} - -// SetPreview gets a reference to the given bool and assigns it to the Preview field. -func (o *SLOHistorySLIData) SetPreview(v bool) { - o.Preview = &v -} - -// GetSliValue returns the SliValue field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetSliValue() float64 { - if o == nil || o.SliValue == nil { - var ret float64 - return ret - } - return *o.SliValue -} - -// GetSliValueOk returns a tuple with the SliValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetSliValueOk() (*float64, bool) { - if o == nil || o.SliValue == nil { - return nil, false - } - return o.SliValue, true -} - -// HasSliValue returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasSliValue() bool { - if o != nil && o.SliValue != nil { - return true - } - - return false -} - -// SetSliValue gets a reference to the given float64 and assigns it to the SliValue field. -func (o *SLOHistorySLIData) SetSliValue(v float64) { - o.SliValue = &v -} - -// GetSpanPrecision returns the SpanPrecision field value if set, zero value otherwise. -func (o *SLOHistorySLIData) GetSpanPrecision() float64 { - if o == nil || o.SpanPrecision == nil { - var ret float64 - return ret - } - return *o.SpanPrecision -} - -// GetSpanPrecisionOk returns a tuple with the SpanPrecision field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOHistorySLIData) GetSpanPrecisionOk() (*float64, bool) { - if o == nil || o.SpanPrecision == nil { - return nil, false - } - return o.SpanPrecision, true -} - -// HasSpanPrecision returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasSpanPrecision() bool { - if o != nil && o.SpanPrecision != nil { - return true - } - - return false -} - -// SetSpanPrecision gets a reference to the given float64 and assigns it to the SpanPrecision field. -func (o *SLOHistorySLIData) SetSpanPrecision(v float64) { - o.SpanPrecision = &v -} - -// GetUptime returns the Uptime field value if set, zero value otherwise. -// Deprecated -func (o *SLOHistorySLIData) GetUptime() float64 { - if o == nil || o.Uptime == nil { - var ret float64 - return ret - } - return *o.Uptime -} - -// GetUptimeOk returns a tuple with the Uptime field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *SLOHistorySLIData) GetUptimeOk() (*float64, bool) { - if o == nil || o.Uptime == nil { - return nil, false - } - return o.Uptime, true -} - -// HasUptime returns a boolean if a field has been set. -func (o *SLOHistorySLIData) HasUptime() bool { - if o != nil && o.Uptime != nil { - return true - } - - return false -} - -// SetUptime gets a reference to the given float64 and assigns it to the Uptime field. -// Deprecated -func (o *SLOHistorySLIData) SetUptime(v float64) { - o.Uptime = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOHistorySLIData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ErrorBudgetRemaining != nil { - toSerialize["error_budget_remaining"] = o.ErrorBudgetRemaining - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - if o.Group != nil { - toSerialize["group"] = o.Group - } - if o.History != nil { - toSerialize["history"] = o.History - } - if o.MonitorModified != nil { - toSerialize["monitor_modified"] = o.MonitorModified - } - if o.MonitorType != nil { - toSerialize["monitor_type"] = o.MonitorType - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Precision != nil { - toSerialize["precision"] = o.Precision - } - if o.Preview != nil { - toSerialize["preview"] = o.Preview - } - if o.SliValue != nil { - toSerialize["sli_value"] = o.SliValue - } - if o.SpanPrecision != nil { - toSerialize["span_precision"] = o.SpanPrecision - } - if o.Uptime != nil { - toSerialize["uptime"] = o.Uptime - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOHistorySLIData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` - Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` - Group *string `json:"group,omitempty"` - History [][]float64 `json:"history,omitempty"` - MonitorModified *int64 `json:"monitor_modified,omitempty"` - MonitorType *string `json:"monitor_type,omitempty"` - Name *string `json:"name,omitempty"` - Precision map[string]float64 `json:"precision,omitempty"` - Preview *bool `json:"preview,omitempty"` - SliValue *float64 `json:"sli_value,omitempty"` - SpanPrecision *float64 `json:"span_precision,omitempty"` - Uptime *float64 `json:"uptime,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ErrorBudgetRemaining = all.ErrorBudgetRemaining - o.Errors = all.Errors - o.Group = all.Group - o.History = all.History - o.MonitorModified = all.MonitorModified - o.MonitorType = all.MonitorType - o.Name = all.Name - o.Precision = all.Precision - o.Preview = all.Preview - o.SliValue = all.SliValue - o.SpanPrecision = all.SpanPrecision - o.Uptime = all.Uptime - return nil -} diff --git a/api/v1/datadog/model_slo_list_response.go b/api/v1/datadog/model_slo_list_response.go deleted file mode 100644 index 3e63c1e0e96..00000000000 --- a/api/v1/datadog/model_slo_list_response.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOListResponse A response with one or more service level objective. -type SLOListResponse struct { - // An array of service level objective objects. - Data []ServiceLevelObjective `json:"data,omitempty"` - // An array of error messages. Each endpoint documents how/whether this field is - // used. - Errors []string `json:"errors,omitempty"` - // The metadata object containing additional information about the list of SLOs. - Metadata *SLOListResponseMetadata `json:"metadata,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{} -} - -// NewSLOListResponse instantiates a new SLOListResponse 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 NewSLOListResponse() *SLOListResponse { - this := SLOListResponse{} - return &this -} - -// NewSLOListResponseWithDefaults instantiates a new SLOListResponse 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 NewSLOListResponseWithDefaults() *SLOListResponse { - this := SLOListResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOListResponse) GetData() []ServiceLevelObjective { - if o == nil || o.Data == nil { - var ret []ServiceLevelObjective - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOListResponse) GetDataOk() (*[]ServiceLevelObjective, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOListResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []ServiceLevelObjective and assigns it to the Data field. -func (o *SLOListResponse) SetData(v []ServiceLevelObjective) { - o.Data = v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *SLOListResponse) GetErrors() []string { - if o == nil || o.Errors == nil { - var ret []string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOListResponse) GetErrorsOk() (*[]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *SLOListResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []string and assigns it to the Errors field. -func (o *SLOListResponse) SetErrors(v []string) { - o.Errors = v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *SLOListResponse) GetMetadata() SLOListResponseMetadata { - if o == nil || o.Metadata == nil { - var ret SLOListResponseMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOListResponse) GetMetadataOk() (*SLOListResponseMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *SLOListResponse) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given SLOListResponseMetadata and assigns it to the Metadata field. -func (o *SLOListResponse) SetMetadata(v SLOListResponseMetadata) { - o.Metadata = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []ServiceLevelObjective `json:"data,omitempty"` - Errors []string `json:"errors,omitempty"` - Metadata *SLOListResponseMetadata `json:"metadata,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Errors = all.Errors - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - return nil -} diff --git a/api/v1/datadog/model_slo_list_response_metadata.go b/api/v1/datadog/model_slo_list_response_metadata.go deleted file mode 100644 index d8e9d05d7fa..00000000000 --- a/api/v1/datadog/model_slo_list_response_metadata.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOListResponseMetadata The metadata object containing additional information about the list of SLOs. -type SLOListResponseMetadata struct { - // The object containing information about the pages of the list of SLOs. - Page *SLOListResponseMetadataPage `json:"page,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{} -} - -// NewSLOListResponseMetadata instantiates a new SLOListResponseMetadata 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 NewSLOListResponseMetadata() *SLOListResponseMetadata { - this := SLOListResponseMetadata{} - return &this -} - -// NewSLOListResponseMetadataWithDefaults instantiates a new SLOListResponseMetadata 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 NewSLOListResponseMetadataWithDefaults() *SLOListResponseMetadata { - this := SLOListResponseMetadata{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *SLOListResponseMetadata) GetPage() SLOListResponseMetadataPage { - if o == nil || o.Page == nil { - var ret SLOListResponseMetadataPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOListResponseMetadata) GetPageOk() (*SLOListResponseMetadataPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *SLOListResponseMetadata) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given SLOListResponseMetadataPage and assigns it to the Page field. -func (o *SLOListResponseMetadata) SetPage(v SLOListResponseMetadataPage) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOListResponseMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOListResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *SLOListResponseMetadataPage `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v1/datadog/model_slo_list_response_metadata_page.go b/api/v1/datadog/model_slo_list_response_metadata_page.go deleted file mode 100644 index ff0ef2036ef..00000000000 --- a/api/v1/datadog/model_slo_list_response_metadata_page.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOListResponseMetadataPage The object containing information about the pages of the list of SLOs. -type SLOListResponseMetadataPage struct { - // The total number of resources that could be retrieved ignoring the parameters and filters in the request. - TotalCount *int64 `json:"total_count,omitempty"` - // The total number of resources that match the parameters and filters in the request. This attribute can be used by a client to determine the total number of 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{} -} - -// NewSLOListResponseMetadataPage instantiates a new SLOListResponseMetadataPage 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 NewSLOListResponseMetadataPage() *SLOListResponseMetadataPage { - this := SLOListResponseMetadataPage{} - return &this -} - -// NewSLOListResponseMetadataPageWithDefaults instantiates a new SLOListResponseMetadataPage 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 NewSLOListResponseMetadataPageWithDefaults() *SLOListResponseMetadataPage { - this := SLOListResponseMetadataPage{} - return &this -} - -// GetTotalCount returns the TotalCount field value if set, zero value otherwise. -func (o *SLOListResponseMetadataPage) GetTotalCount() int64 { - if o == nil || o.TotalCount == nil { - var ret int64 - return ret - } - return *o.TotalCount -} - -// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOListResponseMetadataPage) GetTotalCountOk() (*int64, bool) { - if o == nil || o.TotalCount == nil { - return nil, false - } - return o.TotalCount, true -} - -// HasTotalCount returns a boolean if a field has been set. -func (o *SLOListResponseMetadataPage) HasTotalCount() bool { - if o != nil && o.TotalCount != nil { - return true - } - - return false -} - -// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. -func (o *SLOListResponseMetadataPage) SetTotalCount(v int64) { - o.TotalCount = &v -} - -// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. -func (o *SLOListResponseMetadataPage) 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 *SLOListResponseMetadataPage) 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 *SLOListResponseMetadataPage) HasTotalFilteredCount() bool { - if o != nil && o.TotalFilteredCount != nil { - return true - } - - return false -} - -// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. -func (o *SLOListResponseMetadataPage) SetTotalFilteredCount(v int64) { - o.TotalFilteredCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOListResponseMetadataPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TotalCount != nil { - toSerialize["total_count"] = o.TotalCount - } - if o.TotalFilteredCount != nil { - toSerialize["total_filtered_count"] = o.TotalFilteredCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOListResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TotalCount *int64 `json:"total_count,omitempty"` - TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TotalCount = all.TotalCount - o.TotalFilteredCount = all.TotalFilteredCount - return nil -} diff --git a/api/v1/datadog/model_slo_response.go b/api/v1/datadog/model_slo_response.go deleted file mode 100644 index 721b074a9fa..00000000000 --- a/api/v1/datadog/model_slo_response.go +++ /dev/null @@ -1,150 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SLOResponse A service level objective response containing a single service level objective. -type SLOResponse struct { - // A service level objective object includes a service level indicator, thresholds - // for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). - Data *SLOResponseData `json:"data,omitempty"` - // An array of error messages. Each endpoint documents how/whether this field is - // used. - Errors []string `json:"errors,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{} -} - -// NewSLOResponse instantiates a new SLOResponse 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 NewSLOResponse() *SLOResponse { - this := SLOResponse{} - return &this -} - -// NewSLOResponseWithDefaults instantiates a new SLOResponse 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 NewSLOResponseWithDefaults() *SLOResponse { - this := SLOResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SLOResponse) GetData() SLOResponseData { - if o == nil || o.Data == nil { - var ret SLOResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponse) GetDataOk() (*SLOResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SLOResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SLOResponseData and assigns it to the Data field. -func (o *SLOResponse) SetData(v SLOResponseData) { - o.Data = &v -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *SLOResponse) GetErrors() []string { - if o == nil || o.Errors == nil { - var ret []string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponse) GetErrorsOk() (*[]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *SLOResponse) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []string and assigns it to the Errors field. -func (o *SLOResponse) SetErrors(v []string) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SLOResponseData `json:"data,omitempty"` - Errors []string `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Errors = all.Errors - return nil -} diff --git a/api/v1/datadog/model_slo_response_data.go b/api/v1/datadog/model_slo_response_data.go deleted file mode 100644 index 6095487e5b3..00000000000 --- a/api/v1/datadog/model_slo_response_data.go +++ /dev/null @@ -1,669 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SLOResponseData A service level objective object includes a service level indicator, thresholds -// for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). -type SLOResponseData struct { - // A list of SLO monitors IDs that reference this SLO. This field is returned only when `with_configured_alert_ids` parameter is true in query. - ConfiguredAlertIds []int64 `json:"configured_alert_ids,omitempty"` - // Creation timestamp (UNIX time in seconds) - // - // Always included in service level objective responses. - CreatedAt *int64 `json:"created_at,omitempty"` - // Object describing the creator of the shared element. - Creator *Creator `json:"creator,omitempty"` - // A user-defined description of the service level objective. - // - // Always included in service level objective responses (but may be `null`). - // Optional in create/update requests. - Description common.NullableString `json:"description,omitempty"` - // A list of (up to 20) monitor groups that narrow the scope of a monitor service level objective. - // - // Included in service level objective responses if it is not empty. Optional in - // create/update requests for monitor service level objectives, but may only be - // used when then length of the `monitor_ids` field is one. - Groups []string `json:"groups,omitempty"` - // A unique identifier for the service level objective object. - // - // Always included in service level objective responses. - Id *string `json:"id,omitempty"` - // Modification timestamp (UNIX time in seconds) - // - // Always included in service level objective responses. - ModifiedAt *int64 `json:"modified_at,omitempty"` - // A list of monitor ids that defines the scope of a monitor service level - // objective. **Required if type is `monitor`**. - MonitorIds []int64 `json:"monitor_ids,omitempty"` - // The union of monitor tags for all monitors referenced by the `monitor_ids` - // field. - // Always included in service level objective responses for monitor service level - // objectives (but may be empty). Ignored in create/update requests. Does not - // affect which monitors are included in the service level objective (that is - // determined entirely by the `monitor_ids` field). - MonitorTags []string `json:"monitor_tags,omitempty"` - // The name of the service level objective object. - Name *string `json:"name,omitempty"` - // A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator - // to be used because this will sum up all request counts instead of averaging them, or taking the max or - // min of all of those requests. - Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` - // A list of tags associated with this service level objective. - // Always included in service level objective responses (but may be empty). - // Optional in create/update requests. - Tags []string `json:"tags,omitempty"` - // The thresholds (timeframes and associated targets) for this service level - // objective object. - Thresholds []SLOThreshold `json:"thresholds,omitempty"` - // The type of the service level objective. - Type *SLOType `json:"type,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{} -} - -// NewSLOResponseData instantiates a new SLOResponseData 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 NewSLOResponseData() *SLOResponseData { - this := SLOResponseData{} - return &this -} - -// NewSLOResponseDataWithDefaults instantiates a new SLOResponseData 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 NewSLOResponseDataWithDefaults() *SLOResponseData { - this := SLOResponseData{} - return &this -} - -// GetConfiguredAlertIds returns the ConfiguredAlertIds field value if set, zero value otherwise. -func (o *SLOResponseData) GetConfiguredAlertIds() []int64 { - if o == nil || o.ConfiguredAlertIds == nil { - var ret []int64 - return ret - } - return o.ConfiguredAlertIds -} - -// GetConfiguredAlertIdsOk returns a tuple with the ConfiguredAlertIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetConfiguredAlertIdsOk() (*[]int64, bool) { - if o == nil || o.ConfiguredAlertIds == nil { - return nil, false - } - return &o.ConfiguredAlertIds, true -} - -// HasConfiguredAlertIds returns a boolean if a field has been set. -func (o *SLOResponseData) HasConfiguredAlertIds() bool { - if o != nil && o.ConfiguredAlertIds != nil { - return true - } - - return false -} - -// SetConfiguredAlertIds gets a reference to the given []int64 and assigns it to the ConfiguredAlertIds field. -func (o *SLOResponseData) SetConfiguredAlertIds(v []int64) { - o.ConfiguredAlertIds = v -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *SLOResponseData) GetCreatedAt() int64 { - if o == nil || o.CreatedAt == nil { - var ret int64 - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetCreatedAtOk() (*int64, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *SLOResponseData) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. -func (o *SLOResponseData) SetCreatedAt(v int64) { - o.CreatedAt = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *SLOResponseData) GetCreator() Creator { - if o == nil || o.Creator == nil { - var ret Creator - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetCreatorOk() (*Creator, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *SLOResponseData) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given Creator and assigns it to the Creator field. -func (o *SLOResponseData) SetCreator(v Creator) { - o.Creator = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SLOResponseData) GetDescription() string { - if o == nil || o.Description.Get() == nil { - var ret string - return ret - } - return *o.Description.Get() -} - -// GetDescriptionOk returns a tuple with the Description 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 *SLOResponseData) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Description.Get(), o.Description.IsSet() -} - -// HasDescription returns a boolean if a field has been set. -func (o *SLOResponseData) HasDescription() bool { - if o != nil && o.Description.IsSet() { - return true - } - - return false -} - -// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. -func (o *SLOResponseData) SetDescription(v string) { - o.Description.Set(&v) -} - -// SetDescriptionNil sets the value for Description to be an explicit nil. -func (o *SLOResponseData) SetDescriptionNil() { - o.Description.Set(nil) -} - -// UnsetDescription ensures that no value is present for Description, not even an explicit nil. -func (o *SLOResponseData) UnsetDescription() { - o.Description.Unset() -} - -// GetGroups returns the Groups field value if set, zero value otherwise. -func (o *SLOResponseData) GetGroups() []string { - if o == nil || o.Groups == nil { - var ret []string - 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 *SLOResponseData) GetGroupsOk() (*[]string, 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 *SLOResponseData) HasGroups() bool { - if o != nil && o.Groups != nil { - return true - } - - return false -} - -// SetGroups gets a reference to the given []string and assigns it to the Groups field. -func (o *SLOResponseData) SetGroups(v []string) { - o.Groups = v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SLOResponseData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SLOResponseData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SLOResponseData) SetId(v string) { - o.Id = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *SLOResponseData) GetModifiedAt() int64 { - if o == nil || o.ModifiedAt == nil { - var ret int64 - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetModifiedAtOk() (*int64, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *SLOResponseData) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given int64 and assigns it to the ModifiedAt field. -func (o *SLOResponseData) SetModifiedAt(v int64) { - o.ModifiedAt = &v -} - -// GetMonitorIds returns the MonitorIds field value if set, zero value otherwise. -func (o *SLOResponseData) GetMonitorIds() []int64 { - if o == nil || o.MonitorIds == nil { - var ret []int64 - return ret - } - return o.MonitorIds -} - -// GetMonitorIdsOk returns a tuple with the MonitorIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetMonitorIdsOk() (*[]int64, bool) { - if o == nil || o.MonitorIds == nil { - return nil, false - } - return &o.MonitorIds, true -} - -// HasMonitorIds returns a boolean if a field has been set. -func (o *SLOResponseData) HasMonitorIds() bool { - if o != nil && o.MonitorIds != nil { - return true - } - - return false -} - -// SetMonitorIds gets a reference to the given []int64 and assigns it to the MonitorIds field. -func (o *SLOResponseData) SetMonitorIds(v []int64) { - o.MonitorIds = v -} - -// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. -func (o *SLOResponseData) GetMonitorTags() []string { - if o == nil || o.MonitorTags == nil { - var ret []string - return ret - } - return o.MonitorTags -} - -// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetMonitorTagsOk() (*[]string, bool) { - if o == nil || o.MonitorTags == nil { - return nil, false - } - return &o.MonitorTags, true -} - -// HasMonitorTags returns a boolean if a field has been set. -func (o *SLOResponseData) HasMonitorTags() bool { - if o != nil && o.MonitorTags != nil { - return true - } - - return false -} - -// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. -func (o *SLOResponseData) SetMonitorTags(v []string) { - o.MonitorTags = v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SLOResponseData) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SLOResponseData) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SLOResponseData) SetName(v string) { - o.Name = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SLOResponseData) GetQuery() ServiceLevelObjectiveQuery { - if o == nil || o.Query == nil { - var ret ServiceLevelObjectiveQuery - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetQueryOk() (*ServiceLevelObjectiveQuery, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SLOResponseData) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given ServiceLevelObjectiveQuery and assigns it to the Query field. -func (o *SLOResponseData) SetQuery(v ServiceLevelObjectiveQuery) { - o.Query = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SLOResponseData) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SLOResponseData) GetTagsOk() (*[]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 *SLOResponseData) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SLOResponseData) SetTags(v []string) { - o.Tags = v -} - -// GetThresholds returns the Thresholds field value if set, zero value otherwise. -func (o *SLOResponseData) GetThresholds() []SLOThreshold { - if o == nil || o.Thresholds == nil { - var ret []SLOThreshold - return ret - } - return o.Thresholds -} - -// GetThresholdsOk returns a tuple with the Thresholds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetThresholdsOk() (*[]SLOThreshold, bool) { - if o == nil || o.Thresholds == nil { - return nil, false - } - return &o.Thresholds, true -} - -// HasThresholds returns a boolean if a field has been set. -func (o *SLOResponseData) HasThresholds() bool { - if o != nil && o.Thresholds != nil { - return true - } - - return false -} - -// SetThresholds gets a reference to the given []SLOThreshold and assigns it to the Thresholds field. -func (o *SLOResponseData) SetThresholds(v []SLOThreshold) { - o.Thresholds = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SLOResponseData) GetType() SLOType { - if o == nil || o.Type == nil { - var ret SLOType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOResponseData) GetTypeOk() (*SLOType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SLOResponseData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SLOType and assigns it to the Type field. -func (o *SLOResponseData) SetType(v SLOType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ConfiguredAlertIds != nil { - toSerialize["configured_alert_ids"] = o.ConfiguredAlertIds - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.Description.IsSet() { - toSerialize["description"] = o.Description.Get() - } - if o.Groups != nil { - toSerialize["groups"] = o.Groups - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.ModifiedAt != nil { - toSerialize["modified_at"] = o.ModifiedAt - } - if o.MonitorIds != nil { - toSerialize["monitor_ids"] = o.MonitorIds - } - if o.MonitorTags != nil { - toSerialize["monitor_tags"] = o.MonitorTags - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Thresholds != nil { - toSerialize["thresholds"] = o.Thresholds - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ConfiguredAlertIds []int64 `json:"configured_alert_ids,omitempty"` - CreatedAt *int64 `json:"created_at,omitempty"` - Creator *Creator `json:"creator,omitempty"` - Description common.NullableString `json:"description,omitempty"` - Groups []string `json:"groups,omitempty"` - Id *string `json:"id,omitempty"` - ModifiedAt *int64 `json:"modified_at,omitempty"` - MonitorIds []int64 `json:"monitor_ids,omitempty"` - MonitorTags []string `json:"monitor_tags,omitempty"` - Name *string `json:"name,omitempty"` - Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` - Tags []string `json:"tags,omitempty"` - Thresholds []SLOThreshold `json:"thresholds,omitempty"` - Type *SLOType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ConfiguredAlertIds = all.ConfiguredAlertIds - o.CreatedAt = all.CreatedAt - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.Description = all.Description - o.Groups = all.Groups - o.Id = all.Id - o.ModifiedAt = all.ModifiedAt - o.MonitorIds = all.MonitorIds - o.MonitorTags = all.MonitorTags - o.Name = all.Name - if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Query = all.Query - o.Tags = all.Tags - o.Thresholds = all.Thresholds - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_slo_threshold.go b/api/v1/datadog/model_slo_threshold.go deleted file mode 100644 index 457ff7d13d3..00000000000 --- a/api/v1/datadog/model_slo_threshold.go +++ /dev/null @@ -1,270 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOThreshold SLO thresholds (target and optionally warning) for a single time window. -type SLOThreshold struct { - // The target value for the service level indicator within the corresponding - // timeframe. - Target float64 `json:"target"` - // A string representation of the target that indicates its precision. - // It uses trailing zeros to show significant decimal places (for example `98.00`). - // - // Always included in service level objective responses. Ignored in - // create/update requests. - TargetDisplay *string `json:"target_display,omitempty"` - // The SLO time window options. - Timeframe SLOTimeframe `json:"timeframe"` - // The warning value for the service level objective. - Warning *float64 `json:"warning,omitempty"` - // A string representation of the warning target (see the description of - // the `target_display` field for details). - // - // Included in service level objective responses if a warning target exists. - // Ignored in create/update requests. - WarningDisplay *string `json:"warning_display,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{} -} - -// NewSLOThreshold instantiates a new SLOThreshold 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 NewSLOThreshold(target float64, timeframe SLOTimeframe) *SLOThreshold { - this := SLOThreshold{} - this.Target = target - this.Timeframe = timeframe - return &this -} - -// NewSLOThresholdWithDefaults instantiates a new SLOThreshold 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 NewSLOThresholdWithDefaults() *SLOThreshold { - this := SLOThreshold{} - return &this -} - -// GetTarget returns the Target field value. -func (o *SLOThreshold) GetTarget() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *SLOThreshold) GetTargetOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *SLOThreshold) SetTarget(v float64) { - o.Target = v -} - -// GetTargetDisplay returns the TargetDisplay field value if set, zero value otherwise. -func (o *SLOThreshold) GetTargetDisplay() string { - if o == nil || o.TargetDisplay == nil { - var ret string - return ret - } - return *o.TargetDisplay -} - -// GetTargetDisplayOk returns a tuple with the TargetDisplay field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOThreshold) GetTargetDisplayOk() (*string, bool) { - if o == nil || o.TargetDisplay == nil { - return nil, false - } - return o.TargetDisplay, true -} - -// HasTargetDisplay returns a boolean if a field has been set. -func (o *SLOThreshold) HasTargetDisplay() bool { - if o != nil && o.TargetDisplay != nil { - return true - } - - return false -} - -// SetTargetDisplay gets a reference to the given string and assigns it to the TargetDisplay field. -func (o *SLOThreshold) SetTargetDisplay(v string) { - o.TargetDisplay = &v -} - -// GetTimeframe returns the Timeframe field value. -func (o *SLOThreshold) GetTimeframe() SLOTimeframe { - if o == nil { - var ret SLOTimeframe - return ret - } - return o.Timeframe -} - -// GetTimeframeOk returns a tuple with the Timeframe field value -// and a boolean to check if the value has been set. -func (o *SLOThreshold) GetTimeframeOk() (*SLOTimeframe, bool) { - if o == nil { - return nil, false - } - return &o.Timeframe, true -} - -// SetTimeframe sets field value. -func (o *SLOThreshold) SetTimeframe(v SLOTimeframe) { - o.Timeframe = v -} - -// GetWarning returns the Warning field value if set, zero value otherwise. -func (o *SLOThreshold) GetWarning() float64 { - if o == nil || o.Warning == nil { - var ret float64 - return ret - } - return *o.Warning -} - -// GetWarningOk returns a tuple with the Warning field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOThreshold) GetWarningOk() (*float64, bool) { - if o == nil || o.Warning == nil { - return nil, false - } - return o.Warning, true -} - -// HasWarning returns a boolean if a field has been set. -func (o *SLOThreshold) HasWarning() bool { - if o != nil && o.Warning != nil { - return true - } - - return false -} - -// SetWarning gets a reference to the given float64 and assigns it to the Warning field. -func (o *SLOThreshold) SetWarning(v float64) { - o.Warning = &v -} - -// GetWarningDisplay returns the WarningDisplay field value if set, zero value otherwise. -func (o *SLOThreshold) GetWarningDisplay() string { - if o == nil || o.WarningDisplay == nil { - var ret string - return ret - } - return *o.WarningDisplay -} - -// GetWarningDisplayOk returns a tuple with the WarningDisplay field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOThreshold) GetWarningDisplayOk() (*string, bool) { - if o == nil || o.WarningDisplay == nil { - return nil, false - } - return o.WarningDisplay, true -} - -// HasWarningDisplay returns a boolean if a field has been set. -func (o *SLOThreshold) HasWarningDisplay() bool { - if o != nil && o.WarningDisplay != nil { - return true - } - - return false -} - -// SetWarningDisplay gets a reference to the given string and assigns it to the WarningDisplay field. -func (o *SLOThreshold) SetWarningDisplay(v string) { - o.WarningDisplay = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOThreshold) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["target"] = o.Target - if o.TargetDisplay != nil { - toSerialize["target_display"] = o.TargetDisplay - } - toSerialize["timeframe"] = o.Timeframe - if o.Warning != nil { - toSerialize["warning"] = o.Warning - } - if o.WarningDisplay != nil { - toSerialize["warning_display"] = o.WarningDisplay - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Target *float64 `json:"target"` - Timeframe *SLOTimeframe `json:"timeframe"` - }{} - all := struct { - Target float64 `json:"target"` - TargetDisplay *string `json:"target_display,omitempty"` - Timeframe SLOTimeframe `json:"timeframe"` - Warning *float64 `json:"warning,omitempty"` - WarningDisplay *string `json:"warning_display,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Timeframe == nil { - return fmt.Errorf("Required field timeframe missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Timeframe; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Target = all.Target - o.TargetDisplay = all.TargetDisplay - o.Timeframe = all.Timeframe - o.Warning = all.Warning - o.WarningDisplay = all.WarningDisplay - return nil -} diff --git a/api/v1/datadog/model_slo_timeframe.go b/api/v1/datadog/model_slo_timeframe.go deleted file mode 100644 index 15eb8efe82b..00000000000 --- a/api/v1/datadog/model_slo_timeframe.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOTimeframe The SLO time window options. -type SLOTimeframe string - -// List of SLOTimeframe. -const ( - SLOTIMEFRAME_SEVEN_DAYS SLOTimeframe = "7d" - SLOTIMEFRAME_THIRTY_DAYS SLOTimeframe = "30d" - SLOTIMEFRAME_NINETY_DAYS SLOTimeframe = "90d" - SLOTIMEFRAME_CUSTOM SLOTimeframe = "custom" -) - -var allowedSLOTimeframeEnumValues = []SLOTimeframe{ - SLOTIMEFRAME_SEVEN_DAYS, - SLOTIMEFRAME_THIRTY_DAYS, - SLOTIMEFRAME_NINETY_DAYS, - SLOTIMEFRAME_CUSTOM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SLOTimeframe) GetAllowedValues() []SLOTimeframe { - return allowedSLOTimeframeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SLOTimeframe) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SLOTimeframe(value) - return nil -} - -// NewSLOTimeframeFromValue returns a pointer to a valid SLOTimeframe -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSLOTimeframeFromValue(v string) (*SLOTimeframe, error) { - ev := SLOTimeframe(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SLOTimeframe: valid values are %v", v, allowedSLOTimeframeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SLOTimeframe) IsValid() bool { - for _, existing := range allowedSLOTimeframeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SLOTimeframe value. -func (v SLOTimeframe) Ptr() *SLOTimeframe { - return &v -} - -// NullableSLOTimeframe handles when a null is used for SLOTimeframe. -type NullableSLOTimeframe struct { - value *SLOTimeframe - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOTimeframe) Get() *SLOTimeframe { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOTimeframe) Set(val *SLOTimeframe) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOTimeframe) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOTimeframe) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOTimeframe initializes the struct as if Set has been called. -func NewNullableSLOTimeframe(val *SLOTimeframe) *NullableSLOTimeframe { - return &NullableSLOTimeframe{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOTimeframe) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOTimeframe) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_type.go b/api/v1/datadog/model_slo_type.go deleted file mode 100644 index 2f580816e71..00000000000 --- a/api/v1/datadog/model_slo_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOType The type of the service level objective. -type SLOType string - -// List of SLOType. -const ( - SLOTYPE_METRIC SLOType = "metric" - SLOTYPE_MONITOR SLOType = "monitor" -) - -var allowedSLOTypeEnumValues = []SLOType{ - SLOTYPE_METRIC, - SLOTYPE_MONITOR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SLOType) GetAllowedValues() []SLOType { - return allowedSLOTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SLOType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SLOType(value) - return nil -} - -// NewSLOTypeFromValue returns a pointer to a valid SLOType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSLOTypeFromValue(v string) (*SLOType, error) { - ev := SLOType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SLOType: valid values are %v", v, allowedSLOTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SLOType) IsValid() bool { - for _, existing := range allowedSLOTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SLOType value. -func (v SLOType) Ptr() *SLOType { - return &v -} - -// NullableSLOType handles when a null is used for SLOType. -type NullableSLOType struct { - value *SLOType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOType) Get() *SLOType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOType) Set(val *SLOType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOType initializes the struct as if Set has been called. -func NewNullableSLOType(val *SLOType) *NullableSLOType { - return &NullableSLOType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_type_numeric.go b/api/v1/datadog/model_slo_type_numeric.go deleted file mode 100644 index 74a28cbc3fc..00000000000 --- a/api/v1/datadog/model_slo_type_numeric.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOTypeNumeric A numeric representation of the type of the service level objective (`0` for -// monitor, `1` for metric). Always included in service level objective responses. -// Ignored in create/update requests. -type SLOTypeNumeric int32 - -// List of SLOTypeNumeric. -const ( - SLOTYPENUMERIC_MONITOR SLOTypeNumeric = 0 - SLOTYPENUMERIC_METRIC SLOTypeNumeric = 1 -) - -var allowedSLOTypeNumericEnumValues = []SLOTypeNumeric{ - SLOTYPENUMERIC_MONITOR, - SLOTYPENUMERIC_METRIC, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SLOTypeNumeric) GetAllowedValues() []SLOTypeNumeric { - return allowedSLOTypeNumericEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SLOTypeNumeric) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SLOTypeNumeric(value) - return nil -} - -// NewSLOTypeNumericFromValue returns a pointer to a valid SLOTypeNumeric -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSLOTypeNumericFromValue(v int32) (*SLOTypeNumeric, error) { - ev := SLOTypeNumeric(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SLOTypeNumeric: valid values are %v", v, allowedSLOTypeNumericEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SLOTypeNumeric) IsValid() bool { - for _, existing := range allowedSLOTypeNumericEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SLOTypeNumeric value. -func (v SLOTypeNumeric) Ptr() *SLOTypeNumeric { - return &v -} - -// NullableSLOTypeNumeric handles when a null is used for SLOTypeNumeric. -type NullableSLOTypeNumeric struct { - value *SLOTypeNumeric - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOTypeNumeric) Get() *SLOTypeNumeric { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOTypeNumeric) Set(val *SLOTypeNumeric) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOTypeNumeric) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOTypeNumeric) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOTypeNumeric initializes the struct as if Set has been called. -func NewNullableSLOTypeNumeric(val *SLOTypeNumeric) *NullableSLOTypeNumeric { - return &NullableSLOTypeNumeric{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOTypeNumeric) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOTypeNumeric) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_slo_widget_definition.go b/api/v1/datadog/model_slo_widget_definition.go deleted file mode 100644 index 4113057c6e3..00000000000 --- a/api/v1/datadog/model_slo_widget_definition.go +++ /dev/null @@ -1,476 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOWidgetDefinition Use the SLO and uptime widget to track your SLOs (Service Level Objectives) and uptime on screenboards and timeboards. -type SLOWidgetDefinition struct { - // Defined global time target. - GlobalTimeTarget *string `json:"global_time_target,omitempty"` - // Defined error budget. - ShowErrorBudget *bool `json:"show_error_budget,omitempty"` - // ID of the SLO displayed. - SloId *string `json:"slo_id,omitempty"` - // Times being monitored. - TimeWindows []WidgetTimeWindows `json:"time_windows,omitempty"` - // Title of the widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the SLO widget. - Type SLOWidgetDefinitionType `json:"type"` - // Define how you want the SLO to be displayed. - ViewMode *WidgetViewMode `json:"view_mode,omitempty"` - // Type of view displayed by the widget. - ViewType string `json:"view_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{} -} - -// NewSLOWidgetDefinition instantiates a new SLOWidgetDefinition 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 NewSLOWidgetDefinition(typeVar SLOWidgetDefinitionType, viewType string) *SLOWidgetDefinition { - this := SLOWidgetDefinition{} - this.Type = typeVar - this.ViewType = viewType - return &this -} - -// NewSLOWidgetDefinitionWithDefaults instantiates a new SLOWidgetDefinition 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 NewSLOWidgetDefinitionWithDefaults() *SLOWidgetDefinition { - this := SLOWidgetDefinition{} - var typeVar SLOWidgetDefinitionType = SLOWIDGETDEFINITIONTYPE_SLO - this.Type = typeVar - var viewType string = "detail" - this.ViewType = viewType - return &this -} - -// GetGlobalTimeTarget returns the GlobalTimeTarget field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetGlobalTimeTarget() string { - if o == nil || o.GlobalTimeTarget == nil { - var ret string - return ret - } - return *o.GlobalTimeTarget -} - -// GetGlobalTimeTargetOk returns a tuple with the GlobalTimeTarget field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetGlobalTimeTargetOk() (*string, bool) { - if o == nil || o.GlobalTimeTarget == nil { - return nil, false - } - return o.GlobalTimeTarget, true -} - -// HasGlobalTimeTarget returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasGlobalTimeTarget() bool { - if o != nil && o.GlobalTimeTarget != nil { - return true - } - - return false -} - -// SetGlobalTimeTarget gets a reference to the given string and assigns it to the GlobalTimeTarget field. -func (o *SLOWidgetDefinition) SetGlobalTimeTarget(v string) { - o.GlobalTimeTarget = &v -} - -// GetShowErrorBudget returns the ShowErrorBudget field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetShowErrorBudget() bool { - if o == nil || o.ShowErrorBudget == nil { - var ret bool - return ret - } - return *o.ShowErrorBudget -} - -// GetShowErrorBudgetOk returns a tuple with the ShowErrorBudget field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetShowErrorBudgetOk() (*bool, bool) { - if o == nil || o.ShowErrorBudget == nil { - return nil, false - } - return o.ShowErrorBudget, true -} - -// HasShowErrorBudget returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasShowErrorBudget() bool { - if o != nil && o.ShowErrorBudget != nil { - return true - } - - return false -} - -// SetShowErrorBudget gets a reference to the given bool and assigns it to the ShowErrorBudget field. -func (o *SLOWidgetDefinition) SetShowErrorBudget(v bool) { - o.ShowErrorBudget = &v -} - -// GetSloId returns the SloId field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetSloId() string { - if o == nil || o.SloId == nil { - var ret string - return ret - } - return *o.SloId -} - -// GetSloIdOk returns a tuple with the SloId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetSloIdOk() (*string, bool) { - if o == nil || o.SloId == nil { - return nil, false - } - return o.SloId, true -} - -// HasSloId returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasSloId() bool { - if o != nil && o.SloId != nil { - return true - } - - return false -} - -// SetSloId gets a reference to the given string and assigns it to the SloId field. -func (o *SLOWidgetDefinition) SetSloId(v string) { - o.SloId = &v -} - -// GetTimeWindows returns the TimeWindows field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetTimeWindows() []WidgetTimeWindows { - if o == nil || o.TimeWindows == nil { - var ret []WidgetTimeWindows - return ret - } - return o.TimeWindows -} - -// GetTimeWindowsOk returns a tuple with the TimeWindows field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetTimeWindowsOk() (*[]WidgetTimeWindows, bool) { - if o == nil || o.TimeWindows == nil { - return nil, false - } - return &o.TimeWindows, true -} - -// HasTimeWindows returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasTimeWindows() bool { - if o != nil && o.TimeWindows != nil { - return true - } - - return false -} - -// SetTimeWindows gets a reference to the given []WidgetTimeWindows and assigns it to the TimeWindows field. -func (o *SLOWidgetDefinition) SetTimeWindows(v []WidgetTimeWindows) { - o.TimeWindows = v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *SLOWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *SLOWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *SLOWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *SLOWidgetDefinition) GetType() SLOWidgetDefinitionType { - if o == nil { - var ret SLOWidgetDefinitionType - 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 *SLOWidgetDefinition) GetTypeOk() (*SLOWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SLOWidgetDefinition) SetType(v SLOWidgetDefinitionType) { - o.Type = v -} - -// GetViewMode returns the ViewMode field value if set, zero value otherwise. -func (o *SLOWidgetDefinition) GetViewMode() WidgetViewMode { - if o == nil || o.ViewMode == nil { - var ret WidgetViewMode - return ret - } - return *o.ViewMode -} - -// GetViewModeOk returns a tuple with the ViewMode field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetViewModeOk() (*WidgetViewMode, bool) { - if o == nil || o.ViewMode == nil { - return nil, false - } - return o.ViewMode, true -} - -// HasViewMode returns a boolean if a field has been set. -func (o *SLOWidgetDefinition) HasViewMode() bool { - if o != nil && o.ViewMode != nil { - return true - } - - return false -} - -// SetViewMode gets a reference to the given WidgetViewMode and assigns it to the ViewMode field. -func (o *SLOWidgetDefinition) SetViewMode(v WidgetViewMode) { - o.ViewMode = &v -} - -// GetViewType returns the ViewType field value. -func (o *SLOWidgetDefinition) GetViewType() string { - if o == nil { - var ret string - return ret - } - return o.ViewType -} - -// GetViewTypeOk returns a tuple with the ViewType field value -// and a boolean to check if the value has been set. -func (o *SLOWidgetDefinition) GetViewTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ViewType, true -} - -// SetViewType sets field value. -func (o *SLOWidgetDefinition) SetViewType(v string) { - o.ViewType = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SLOWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.GlobalTimeTarget != nil { - toSerialize["global_time_target"] = o.GlobalTimeTarget - } - if o.ShowErrorBudget != nil { - toSerialize["show_error_budget"] = o.ShowErrorBudget - } - if o.SloId != nil { - toSerialize["slo_id"] = o.SloId - } - if o.TimeWindows != nil { - toSerialize["time_windows"] = o.TimeWindows - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - if o.ViewMode != nil { - toSerialize["view_mode"] = o.ViewMode - } - toSerialize["view_type"] = o.ViewType - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *SLOWidgetDefinitionType `json:"type"` - ViewType *string `json:"view_type"` - }{} - all := struct { - GlobalTimeTarget *string `json:"global_time_target,omitempty"` - ShowErrorBudget *bool `json:"show_error_budget,omitempty"` - SloId *string `json:"slo_id,omitempty"` - TimeWindows []WidgetTimeWindows `json:"time_windows,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type SLOWidgetDefinitionType `json:"type"` - ViewMode *WidgetViewMode `json:"view_mode,omitempty"` - ViewType string `json:"view_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - if required.ViewType == nil { - return fmt.Errorf("Required field view_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ViewMode; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.GlobalTimeTarget = all.GlobalTimeTarget - o.ShowErrorBudget = all.ShowErrorBudget - o.SloId = all.SloId - o.TimeWindows = all.TimeWindows - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - o.ViewMode = all.ViewMode - o.ViewType = all.ViewType - return nil -} diff --git a/api/v1/datadog/model_slo_widget_definition_type.go b/api/v1/datadog/model_slo_widget_definition_type.go deleted file mode 100644 index 349a7888302..00000000000 --- a/api/v1/datadog/model_slo_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SLOWidgetDefinitionType Type of the SLO widget. -type SLOWidgetDefinitionType string - -// List of SLOWidgetDefinitionType. -const ( - SLOWIDGETDEFINITIONTYPE_SLO SLOWidgetDefinitionType = "slo" -) - -var allowedSLOWidgetDefinitionTypeEnumValues = []SLOWidgetDefinitionType{ - SLOWIDGETDEFINITIONTYPE_SLO, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SLOWidgetDefinitionType) GetAllowedValues() []SLOWidgetDefinitionType { - return allowedSLOWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SLOWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SLOWidgetDefinitionType(value) - return nil -} - -// NewSLOWidgetDefinitionTypeFromValue returns a pointer to a valid SLOWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSLOWidgetDefinitionTypeFromValue(v string) (*SLOWidgetDefinitionType, error) { - ev := SLOWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SLOWidgetDefinitionType: valid values are %v", v, allowedSLOWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SLOWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedSLOWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SLOWidgetDefinitionType value. -func (v SLOWidgetDefinitionType) Ptr() *SLOWidgetDefinitionType { - return &v -} - -// NullableSLOWidgetDefinitionType handles when a null is used for SLOWidgetDefinitionType. -type NullableSLOWidgetDefinitionType struct { - value *SLOWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSLOWidgetDefinitionType) Get() *SLOWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSLOWidgetDefinitionType) Set(val *SLOWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSLOWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSLOWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSLOWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableSLOWidgetDefinitionType(val *SLOWidgetDefinitionType) *NullableSLOWidgetDefinitionType { - return &NullableSLOWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSLOWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSLOWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_successful_signal_update_response.go b/api/v1/datadog/model_successful_signal_update_response.go deleted file mode 100644 index c0a4d096892..00000000000 --- a/api/v1/datadog/model_successful_signal_update_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SuccessfulSignalUpdateResponse Updated signal data following a successfully performed update. -type SuccessfulSignalUpdateResponse struct { - // Status of the response. - Status *string `json:"status,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{} -} - -// NewSuccessfulSignalUpdateResponse instantiates a new SuccessfulSignalUpdateResponse 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 NewSuccessfulSignalUpdateResponse() *SuccessfulSignalUpdateResponse { - this := SuccessfulSignalUpdateResponse{} - return &this -} - -// NewSuccessfulSignalUpdateResponseWithDefaults instantiates a new SuccessfulSignalUpdateResponse 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 NewSuccessfulSignalUpdateResponseWithDefaults() *SuccessfulSignalUpdateResponse { - this := SuccessfulSignalUpdateResponse{} - return &this -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SuccessfulSignalUpdateResponse) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SuccessfulSignalUpdateResponse) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SuccessfulSignalUpdateResponse) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *SuccessfulSignalUpdateResponse) SetStatus(v string) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SuccessfulSignalUpdateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SuccessfulSignalUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Status *string `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_sunburst_widget_definition.go b/api/v1/datadog/model_sunburst_widget_definition.go deleted file mode 100644 index 1960607ffc9..00000000000 --- a/api/v1/datadog/model_sunburst_widget_definition.go +++ /dev/null @@ -1,434 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SunburstWidgetDefinition Sunbursts are spot on to highlight how groups contribute to the total of a query. -type SunburstWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // Show the total value in this widget. - HideTotal *bool `json:"hide_total,omitempty"` - // Configuration of the legend. - Legend *SunburstWidgetLegend `json:"legend,omitempty"` - // List of sunburst widget requests. - Requests []SunburstWidgetRequest `json:"requests"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the Sunburst widget. - Type SunburstWidgetDefinitionType `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{} -} - -// NewSunburstWidgetDefinition instantiates a new SunburstWidgetDefinition 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 NewSunburstWidgetDefinition(requests []SunburstWidgetRequest, typeVar SunburstWidgetDefinitionType) *SunburstWidgetDefinition { - this := SunburstWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewSunburstWidgetDefinitionWithDefaults instantiates a new SunburstWidgetDefinition 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 NewSunburstWidgetDefinitionWithDefaults() *SunburstWidgetDefinition { - this := SunburstWidgetDefinition{} - var typeVar SunburstWidgetDefinitionType = SUNBURSTWIDGETDEFINITIONTYPE_SUNBURST - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *SunburstWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *SunburstWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *SunburstWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetHideTotal returns the HideTotal field value if set, zero value otherwise. -func (o *SunburstWidgetDefinition) GetHideTotal() bool { - if o == nil || o.HideTotal == nil { - var ret bool - return ret - } - return *o.HideTotal -} - -// GetHideTotalOk returns a tuple with the HideTotal field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetHideTotalOk() (*bool, bool) { - if o == nil || o.HideTotal == nil { - return nil, false - } - return o.HideTotal, true -} - -// HasHideTotal returns a boolean if a field has been set. -func (o *SunburstWidgetDefinition) HasHideTotal() bool { - if o != nil && o.HideTotal != nil { - return true - } - - return false -} - -// SetHideTotal gets a reference to the given bool and assigns it to the HideTotal field. -func (o *SunburstWidgetDefinition) SetHideTotal(v bool) { - o.HideTotal = &v -} - -// GetLegend returns the Legend field value if set, zero value otherwise. -func (o *SunburstWidgetDefinition) GetLegend() SunburstWidgetLegend { - if o == nil || o.Legend == nil { - var ret SunburstWidgetLegend - return ret - } - return *o.Legend -} - -// GetLegendOk returns a tuple with the Legend field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetLegendOk() (*SunburstWidgetLegend, bool) { - if o == nil || o.Legend == nil { - return nil, false - } - return o.Legend, true -} - -// HasLegend returns a boolean if a field has been set. -func (o *SunburstWidgetDefinition) HasLegend() bool { - if o != nil && o.Legend != nil { - return true - } - - return false -} - -// SetLegend gets a reference to the given SunburstWidgetLegend and assigns it to the Legend field. -func (o *SunburstWidgetDefinition) SetLegend(v SunburstWidgetLegend) { - o.Legend = &v -} - -// GetRequests returns the Requests field value. -func (o *SunburstWidgetDefinition) GetRequests() []SunburstWidgetRequest { - if o == nil { - var ret []SunburstWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetRequestsOk() (*[]SunburstWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *SunburstWidgetDefinition) SetRequests(v []SunburstWidgetRequest) { - o.Requests = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *SunburstWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *SunburstWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *SunburstWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *SunburstWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *SunburstWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *SunburstWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *SunburstWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *SunburstWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *SunburstWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *SunburstWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *SunburstWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *SunburstWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *SunburstWidgetDefinition) GetType() SunburstWidgetDefinitionType { - if o == nil { - var ret SunburstWidgetDefinitionType - 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 *SunburstWidgetDefinition) GetTypeOk() (*SunburstWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SunburstWidgetDefinition) SetType(v SunburstWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SunburstWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - if o.HideTotal != nil { - toSerialize["hide_total"] = o.HideTotal - } - if o.Legend != nil { - toSerialize["legend"] = o.Legend - } - toSerialize["requests"] = o.Requests - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]SunburstWidgetRequest `json:"requests"` - Type *SunburstWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - HideTotal *bool `json:"hide_total,omitempty"` - Legend *SunburstWidgetLegend `json:"legend,omitempty"` - Requests []SunburstWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type SunburstWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.HideTotal = all.HideTotal - o.Legend = all.Legend - o.Requests = all.Requests - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_sunburst_widget_definition_type.go b/api/v1/datadog/model_sunburst_widget_definition_type.go deleted file mode 100644 index 5ab9bd73f1d..00000000000 --- a/api/v1/datadog/model_sunburst_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SunburstWidgetDefinitionType Type of the Sunburst widget. -type SunburstWidgetDefinitionType string - -// List of SunburstWidgetDefinitionType. -const ( - SUNBURSTWIDGETDEFINITIONTYPE_SUNBURST SunburstWidgetDefinitionType = "sunburst" -) - -var allowedSunburstWidgetDefinitionTypeEnumValues = []SunburstWidgetDefinitionType{ - SUNBURSTWIDGETDEFINITIONTYPE_SUNBURST, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SunburstWidgetDefinitionType) GetAllowedValues() []SunburstWidgetDefinitionType { - return allowedSunburstWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SunburstWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SunburstWidgetDefinitionType(value) - return nil -} - -// NewSunburstWidgetDefinitionTypeFromValue returns a pointer to a valid SunburstWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSunburstWidgetDefinitionTypeFromValue(v string) (*SunburstWidgetDefinitionType, error) { - ev := SunburstWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SunburstWidgetDefinitionType: valid values are %v", v, allowedSunburstWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SunburstWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedSunburstWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SunburstWidgetDefinitionType value. -func (v SunburstWidgetDefinitionType) Ptr() *SunburstWidgetDefinitionType { - return &v -} - -// NullableSunburstWidgetDefinitionType handles when a null is used for SunburstWidgetDefinitionType. -type NullableSunburstWidgetDefinitionType struct { - value *SunburstWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetDefinitionType) Get() *SunburstWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetDefinitionType) Set(val *SunburstWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSunburstWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableSunburstWidgetDefinitionType(val *SunburstWidgetDefinitionType) *NullableSunburstWidgetDefinitionType { - return &NullableSunburstWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_sunburst_widget_legend.go b/api/v1/datadog/model_sunburst_widget_legend.go deleted file mode 100644 index 28e182fd973..00000000000 --- a/api/v1/datadog/model_sunburst_widget_legend.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SunburstWidgetLegend - Configuration of the legend. -type SunburstWidgetLegend struct { - SunburstWidgetLegendTable *SunburstWidgetLegendTable - SunburstWidgetLegendInlineAutomatic *SunburstWidgetLegendInlineAutomatic - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// SunburstWidgetLegendTableAsSunburstWidgetLegend is a convenience function that returns SunburstWidgetLegendTable wrapped in SunburstWidgetLegend. -func SunburstWidgetLegendTableAsSunburstWidgetLegend(v *SunburstWidgetLegendTable) SunburstWidgetLegend { - return SunburstWidgetLegend{SunburstWidgetLegendTable: v} -} - -// SunburstWidgetLegendInlineAutomaticAsSunburstWidgetLegend is a convenience function that returns SunburstWidgetLegendInlineAutomatic wrapped in SunburstWidgetLegend. -func SunburstWidgetLegendInlineAutomaticAsSunburstWidgetLegend(v *SunburstWidgetLegendInlineAutomatic) SunburstWidgetLegend { - return SunburstWidgetLegend{SunburstWidgetLegendInlineAutomatic: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *SunburstWidgetLegend) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into SunburstWidgetLegendTable - err = json.Unmarshal(data, &obj.SunburstWidgetLegendTable) - if err == nil { - if obj.SunburstWidgetLegendTable != nil && obj.SunburstWidgetLegendTable.UnparsedObject == nil { - jsonSunburstWidgetLegendTable, _ := json.Marshal(obj.SunburstWidgetLegendTable) - if string(jsonSunburstWidgetLegendTable) == "{}" { // empty struct - obj.SunburstWidgetLegendTable = nil - } else { - match++ - } - } else { - obj.SunburstWidgetLegendTable = nil - } - } else { - obj.SunburstWidgetLegendTable = nil - } - - // try to unmarshal data into SunburstWidgetLegendInlineAutomatic - err = json.Unmarshal(data, &obj.SunburstWidgetLegendInlineAutomatic) - if err == nil { - if obj.SunburstWidgetLegendInlineAutomatic != nil && obj.SunburstWidgetLegendInlineAutomatic.UnparsedObject == nil { - jsonSunburstWidgetLegendInlineAutomatic, _ := json.Marshal(obj.SunburstWidgetLegendInlineAutomatic) - if string(jsonSunburstWidgetLegendInlineAutomatic) == "{}" { // empty struct - obj.SunburstWidgetLegendInlineAutomatic = nil - } else { - match++ - } - } else { - obj.SunburstWidgetLegendInlineAutomatic = nil - } - } else { - obj.SunburstWidgetLegendInlineAutomatic = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.SunburstWidgetLegendTable = nil - obj.SunburstWidgetLegendInlineAutomatic = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj SunburstWidgetLegend) MarshalJSON() ([]byte, error) { - if obj.SunburstWidgetLegendTable != nil { - return json.Marshal(&obj.SunburstWidgetLegendTable) - } - - if obj.SunburstWidgetLegendInlineAutomatic != nil { - return json.Marshal(&obj.SunburstWidgetLegendInlineAutomatic) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *SunburstWidgetLegend) GetActualInstance() interface{} { - if obj.SunburstWidgetLegendTable != nil { - return obj.SunburstWidgetLegendTable - } - - if obj.SunburstWidgetLegendInlineAutomatic != nil { - return obj.SunburstWidgetLegendInlineAutomatic - } - - // all schemas are nil - return nil -} - -// NullableSunburstWidgetLegend handles when a null is used for SunburstWidgetLegend. -type NullableSunburstWidgetLegend struct { - value *SunburstWidgetLegend - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetLegend) Get() *SunburstWidgetLegend { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetLegend) Set(val *SunburstWidgetLegend) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetLegend) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSunburstWidgetLegend) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetLegend initializes the struct as if Set has been called. -func NewNullableSunburstWidgetLegend(val *SunburstWidgetLegend) *NullableSunburstWidgetLegend { - return &NullableSunburstWidgetLegend{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetLegend) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetLegend) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go b/api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go deleted file mode 100644 index 920425631c5..00000000000 --- a/api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SunburstWidgetLegendInlineAutomatic Configuration of inline or automatic legends. -type SunburstWidgetLegendInlineAutomatic struct { - // Whether to hide the percentages of the groups. - HidePercent *bool `json:"hide_percent,omitempty"` - // Whether to hide the values of the groups. - HideValue *bool `json:"hide_value,omitempty"` - // Whether to show the legend inline or let it be automatically generated. - Type SunburstWidgetLegendInlineAutomaticType `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{} -} - -// NewSunburstWidgetLegendInlineAutomatic instantiates a new SunburstWidgetLegendInlineAutomatic 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 NewSunburstWidgetLegendInlineAutomatic(typeVar SunburstWidgetLegendInlineAutomaticType) *SunburstWidgetLegendInlineAutomatic { - this := SunburstWidgetLegendInlineAutomatic{} - this.Type = typeVar - return &this -} - -// NewSunburstWidgetLegendInlineAutomaticWithDefaults instantiates a new SunburstWidgetLegendInlineAutomatic 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 NewSunburstWidgetLegendInlineAutomaticWithDefaults() *SunburstWidgetLegendInlineAutomatic { - this := SunburstWidgetLegendInlineAutomatic{} - return &this -} - -// GetHidePercent returns the HidePercent field value if set, zero value otherwise. -func (o *SunburstWidgetLegendInlineAutomatic) GetHidePercent() bool { - if o == nil || o.HidePercent == nil { - var ret bool - return ret - } - return *o.HidePercent -} - -// GetHidePercentOk returns a tuple with the HidePercent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetLegendInlineAutomatic) GetHidePercentOk() (*bool, bool) { - if o == nil || o.HidePercent == nil { - return nil, false - } - return o.HidePercent, true -} - -// HasHidePercent returns a boolean if a field has been set. -func (o *SunburstWidgetLegendInlineAutomatic) HasHidePercent() bool { - if o != nil && o.HidePercent != nil { - return true - } - - return false -} - -// SetHidePercent gets a reference to the given bool and assigns it to the HidePercent field. -func (o *SunburstWidgetLegendInlineAutomatic) SetHidePercent(v bool) { - o.HidePercent = &v -} - -// GetHideValue returns the HideValue field value if set, zero value otherwise. -func (o *SunburstWidgetLegendInlineAutomatic) GetHideValue() bool { - if o == nil || o.HideValue == nil { - var ret bool - return ret - } - return *o.HideValue -} - -// GetHideValueOk returns a tuple with the HideValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetLegendInlineAutomatic) GetHideValueOk() (*bool, bool) { - if o == nil || o.HideValue == nil { - return nil, false - } - return o.HideValue, true -} - -// HasHideValue returns a boolean if a field has been set. -func (o *SunburstWidgetLegendInlineAutomatic) HasHideValue() bool { - if o != nil && o.HideValue != nil { - return true - } - - return false -} - -// SetHideValue gets a reference to the given bool and assigns it to the HideValue field. -func (o *SunburstWidgetLegendInlineAutomatic) SetHideValue(v bool) { - o.HideValue = &v -} - -// GetType returns the Type field value. -func (o *SunburstWidgetLegendInlineAutomatic) GetType() SunburstWidgetLegendInlineAutomaticType { - if o == nil { - var ret SunburstWidgetLegendInlineAutomaticType - 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 *SunburstWidgetLegendInlineAutomatic) GetTypeOk() (*SunburstWidgetLegendInlineAutomaticType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SunburstWidgetLegendInlineAutomatic) SetType(v SunburstWidgetLegendInlineAutomaticType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SunburstWidgetLegendInlineAutomatic) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.HidePercent != nil { - toSerialize["hide_percent"] = o.HidePercent - } - if o.HideValue != nil { - toSerialize["hide_value"] = o.HideValue - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SunburstWidgetLegendInlineAutomatic) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *SunburstWidgetLegendInlineAutomaticType `json:"type"` - }{} - all := struct { - HidePercent *bool `json:"hide_percent,omitempty"` - HideValue *bool `json:"hide_value,omitempty"` - Type SunburstWidgetLegendInlineAutomaticType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.HidePercent = all.HidePercent - o.HideValue = all.HideValue - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go b/api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go deleted file mode 100644 index 23bb38307dd..00000000000 --- a/api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SunburstWidgetLegendInlineAutomaticType Whether to show the legend inline or let it be automatically generated. -type SunburstWidgetLegendInlineAutomaticType string - -// List of SunburstWidgetLegendInlineAutomaticType. -const ( - SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_INLINE SunburstWidgetLegendInlineAutomaticType = "inline" - SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_AUTOMATIC SunburstWidgetLegendInlineAutomaticType = "automatic" -) - -var allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues = []SunburstWidgetLegendInlineAutomaticType{ - SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_INLINE, - SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_AUTOMATIC, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SunburstWidgetLegendInlineAutomaticType) GetAllowedValues() []SunburstWidgetLegendInlineAutomaticType { - return allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SunburstWidgetLegendInlineAutomaticType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SunburstWidgetLegendInlineAutomaticType(value) - return nil -} - -// NewSunburstWidgetLegendInlineAutomaticTypeFromValue returns a pointer to a valid SunburstWidgetLegendInlineAutomaticType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSunburstWidgetLegendInlineAutomaticTypeFromValue(v string) (*SunburstWidgetLegendInlineAutomaticType, error) { - ev := SunburstWidgetLegendInlineAutomaticType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SunburstWidgetLegendInlineAutomaticType: valid values are %v", v, allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SunburstWidgetLegendInlineAutomaticType) IsValid() bool { - for _, existing := range allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SunburstWidgetLegendInlineAutomaticType value. -func (v SunburstWidgetLegendInlineAutomaticType) Ptr() *SunburstWidgetLegendInlineAutomaticType { - return &v -} - -// NullableSunburstWidgetLegendInlineAutomaticType handles when a null is used for SunburstWidgetLegendInlineAutomaticType. -type NullableSunburstWidgetLegendInlineAutomaticType struct { - value *SunburstWidgetLegendInlineAutomaticType - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetLegendInlineAutomaticType) Get() *SunburstWidgetLegendInlineAutomaticType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetLegendInlineAutomaticType) Set(val *SunburstWidgetLegendInlineAutomaticType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetLegendInlineAutomaticType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSunburstWidgetLegendInlineAutomaticType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetLegendInlineAutomaticType initializes the struct as if Set has been called. -func NewNullableSunburstWidgetLegendInlineAutomaticType(val *SunburstWidgetLegendInlineAutomaticType) *NullableSunburstWidgetLegendInlineAutomaticType { - return &NullableSunburstWidgetLegendInlineAutomaticType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetLegendInlineAutomaticType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetLegendInlineAutomaticType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_sunburst_widget_legend_table.go b/api/v1/datadog/model_sunburst_widget_legend_table.go deleted file mode 100644 index 2fa8a8bae82..00000000000 --- a/api/v1/datadog/model_sunburst_widget_legend_table.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SunburstWidgetLegendTable Configuration of table-based legend. -type SunburstWidgetLegendTable struct { - // Whether or not to show a table legend. - Type SunburstWidgetLegendTableType `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{} -} - -// NewSunburstWidgetLegendTable instantiates a new SunburstWidgetLegendTable 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 NewSunburstWidgetLegendTable(typeVar SunburstWidgetLegendTableType) *SunburstWidgetLegendTable { - this := SunburstWidgetLegendTable{} - this.Type = typeVar - return &this -} - -// NewSunburstWidgetLegendTableWithDefaults instantiates a new SunburstWidgetLegendTable 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 NewSunburstWidgetLegendTableWithDefaults() *SunburstWidgetLegendTable { - this := SunburstWidgetLegendTable{} - return &this -} - -// GetType returns the Type field value. -func (o *SunburstWidgetLegendTable) GetType() SunburstWidgetLegendTableType { - if o == nil { - var ret SunburstWidgetLegendTableType - 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 *SunburstWidgetLegendTable) GetTypeOk() (*SunburstWidgetLegendTableType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SunburstWidgetLegendTable) SetType(v SunburstWidgetLegendTableType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SunburstWidgetLegendTable) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SunburstWidgetLegendTable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *SunburstWidgetLegendTableType `json:"type"` - }{} - all := struct { - Type SunburstWidgetLegendTableType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_sunburst_widget_legend_table_type.go b/api/v1/datadog/model_sunburst_widget_legend_table_type.go deleted file mode 100644 index 87afb23c1b6..00000000000 --- a/api/v1/datadog/model_sunburst_widget_legend_table_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SunburstWidgetLegendTableType Whether or not to show a table legend. -type SunburstWidgetLegendTableType string - -// List of SunburstWidgetLegendTableType. -const ( - SUNBURSTWIDGETLEGENDTABLETYPE_TABLE SunburstWidgetLegendTableType = "table" - SUNBURSTWIDGETLEGENDTABLETYPE_NONE SunburstWidgetLegendTableType = "none" -) - -var allowedSunburstWidgetLegendTableTypeEnumValues = []SunburstWidgetLegendTableType{ - SUNBURSTWIDGETLEGENDTABLETYPE_TABLE, - SUNBURSTWIDGETLEGENDTABLETYPE_NONE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SunburstWidgetLegendTableType) GetAllowedValues() []SunburstWidgetLegendTableType { - return allowedSunburstWidgetLegendTableTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SunburstWidgetLegendTableType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SunburstWidgetLegendTableType(value) - return nil -} - -// NewSunburstWidgetLegendTableTypeFromValue returns a pointer to a valid SunburstWidgetLegendTableType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSunburstWidgetLegendTableTypeFromValue(v string) (*SunburstWidgetLegendTableType, error) { - ev := SunburstWidgetLegendTableType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SunburstWidgetLegendTableType: valid values are %v", v, allowedSunburstWidgetLegendTableTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SunburstWidgetLegendTableType) IsValid() bool { - for _, existing := range allowedSunburstWidgetLegendTableTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SunburstWidgetLegendTableType value. -func (v SunburstWidgetLegendTableType) Ptr() *SunburstWidgetLegendTableType { - return &v -} - -// NullableSunburstWidgetLegendTableType handles when a null is used for SunburstWidgetLegendTableType. -type NullableSunburstWidgetLegendTableType struct { - value *SunburstWidgetLegendTableType - isSet bool -} - -// Get returns the associated value. -func (v NullableSunburstWidgetLegendTableType) Get() *SunburstWidgetLegendTableType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSunburstWidgetLegendTableType) Set(val *SunburstWidgetLegendTableType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSunburstWidgetLegendTableType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSunburstWidgetLegendTableType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSunburstWidgetLegendTableType initializes the struct as if Set has been called. -func NewNullableSunburstWidgetLegendTableType(val *SunburstWidgetLegendTableType) *NullableSunburstWidgetLegendTableType { - return &NullableSunburstWidgetLegendTableType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSunburstWidgetLegendTableType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSunburstWidgetLegendTableType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_sunburst_widget_request.go b/api/v1/datadog/model_sunburst_widget_request.go deleted file mode 100644 index d87e0d1985f..00000000000 --- a/api/v1/datadog/model_sunburst_widget_request.go +++ /dev/null @@ -1,641 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SunburstWidgetRequest Request definition of sunburst widget. -type SunburstWidgetRequest struct { - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The log query. - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Widget query. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,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{} -} - -// NewSunburstWidgetRequest instantiates a new SunburstWidgetRequest 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 NewSunburstWidgetRequest() *SunburstWidgetRequest { - this := SunburstWidgetRequest{} - return &this -} - -// NewSunburstWidgetRequestWithDefaults instantiates a new SunburstWidgetRequest 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 NewSunburstWidgetRequestWithDefaults() *SunburstWidgetRequest { - this := SunburstWidgetRequest{} - return &this -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *SunburstWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetAuditQuery() LogQueryDefinition { - if o == nil || o.AuditQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.AuditQuery -} - -// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.AuditQuery == nil { - return nil, false - } - return o.AuditQuery, true -} - -// HasAuditQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasAuditQuery() bool { - if o != nil && o.AuditQuery != nil { - return true - } - - return false -} - -// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. -func (o *SunburstWidgetRequest) SetAuditQuery(v LogQueryDefinition) { - o.AuditQuery = &v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *SunburstWidgetRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *SunburstWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *SunburstWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *SunburstWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *SunburstWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *SunburstWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *SunburstWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *SunburstWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *SunburstWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *SunburstWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *SunburstWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SunburstWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *SunburstWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *SunburstWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SunburstWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.AuditQuery != nil { - toSerialize["audit_query"] = o.AuditQuery - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SunburstWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - Formulas []WidgetFormula `json:"formulas,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.AuditQuery = all.AuditQuery - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - o.Formulas = all.Formulas - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_step.go b/api/v1/datadog/model_synthetics_api_step.go deleted file mode 100644 index c26f2fea407..00000000000 --- a/api/v1/datadog/model_synthetics_api_step.go +++ /dev/null @@ -1,381 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAPIStep The steps used in a Synthetics multistep API test. -type SyntheticsAPIStep struct { - // Determines whether or not to continue with test if this step fails. - AllowFailure *bool `json:"allowFailure,omitempty"` - // Array of assertions used for the test. - Assertions []SyntheticsAssertion `json:"assertions"` - // Array of values to parse and save as variables from the response. - ExtractedValues []SyntheticsParsingOptions `json:"extractedValues,omitempty"` - // Determines whether or not to consider the entire test as failed if this step fails. - // Can be used only if `allowFailure` is `true`. - IsCritical *bool `json:"isCritical,omitempty"` - // The name of the step. - Name string `json:"name"` - // Object describing the Synthetic test request. - Request SyntheticsTestRequest `json:"request"` - // Object describing the retry strategy to apply to a Synthetic test. - Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - // The subtype of the Synthetic multistep API test step, currently only supporting `http`. - Subtype SyntheticsAPIStepSubtype `json:"subtype"` - // 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{} -} - -// NewSyntheticsAPIStep instantiates a new SyntheticsAPIStep 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 NewSyntheticsAPIStep(assertions []SyntheticsAssertion, name string, request SyntheticsTestRequest, subtype SyntheticsAPIStepSubtype) *SyntheticsAPIStep { - this := SyntheticsAPIStep{} - this.Assertions = assertions - this.Name = name - this.Request = request - this.Subtype = subtype - return &this -} - -// NewSyntheticsAPIStepWithDefaults instantiates a new SyntheticsAPIStep 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 NewSyntheticsAPIStepWithDefaults() *SyntheticsAPIStep { - this := SyntheticsAPIStep{} - return &this -} - -// GetAllowFailure returns the AllowFailure field value if set, zero value otherwise. -func (o *SyntheticsAPIStep) GetAllowFailure() bool { - if o == nil || o.AllowFailure == nil { - var ret bool - return ret - } - return *o.AllowFailure -} - -// GetAllowFailureOk returns a tuple with the AllowFailure field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetAllowFailureOk() (*bool, bool) { - if o == nil || o.AllowFailure == nil { - return nil, false - } - return o.AllowFailure, true -} - -// HasAllowFailure returns a boolean if a field has been set. -func (o *SyntheticsAPIStep) HasAllowFailure() bool { - if o != nil && o.AllowFailure != nil { - return true - } - - return false -} - -// SetAllowFailure gets a reference to the given bool and assigns it to the AllowFailure field. -func (o *SyntheticsAPIStep) SetAllowFailure(v bool) { - o.AllowFailure = &v -} - -// GetAssertions returns the Assertions field value. -func (o *SyntheticsAPIStep) GetAssertions() []SyntheticsAssertion { - if o == nil { - var ret []SyntheticsAssertion - return ret - } - return o.Assertions -} - -// GetAssertionsOk returns a tuple with the Assertions field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { - if o == nil { - return nil, false - } - return &o.Assertions, true -} - -// SetAssertions sets field value. -func (o *SyntheticsAPIStep) SetAssertions(v []SyntheticsAssertion) { - o.Assertions = v -} - -// GetExtractedValues returns the ExtractedValues field value if set, zero value otherwise. -func (o *SyntheticsAPIStep) GetExtractedValues() []SyntheticsParsingOptions { - if o == nil || o.ExtractedValues == nil { - var ret []SyntheticsParsingOptions - return ret - } - return o.ExtractedValues -} - -// GetExtractedValuesOk returns a tuple with the ExtractedValues field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetExtractedValuesOk() (*[]SyntheticsParsingOptions, bool) { - if o == nil || o.ExtractedValues == nil { - return nil, false - } - return &o.ExtractedValues, true -} - -// HasExtractedValues returns a boolean if a field has been set. -func (o *SyntheticsAPIStep) HasExtractedValues() bool { - if o != nil && o.ExtractedValues != nil { - return true - } - - return false -} - -// SetExtractedValues gets a reference to the given []SyntheticsParsingOptions and assigns it to the ExtractedValues field. -func (o *SyntheticsAPIStep) SetExtractedValues(v []SyntheticsParsingOptions) { - o.ExtractedValues = v -} - -// GetIsCritical returns the IsCritical field value if set, zero value otherwise. -func (o *SyntheticsAPIStep) GetIsCritical() bool { - if o == nil || o.IsCritical == nil { - var ret bool - return ret - } - return *o.IsCritical -} - -// GetIsCriticalOk returns a tuple with the IsCritical field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetIsCriticalOk() (*bool, bool) { - if o == nil || o.IsCritical == nil { - return nil, false - } - return o.IsCritical, true -} - -// HasIsCritical returns a boolean if a field has been set. -func (o *SyntheticsAPIStep) HasIsCritical() bool { - if o != nil && o.IsCritical != nil { - return true - } - - return false -} - -// SetIsCritical gets a reference to the given bool and assigns it to the IsCritical field. -func (o *SyntheticsAPIStep) SetIsCritical(v bool) { - o.IsCritical = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsAPIStep) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsAPIStep) SetName(v string) { - o.Name = v -} - -// GetRequest returns the Request field value. -func (o *SyntheticsAPIStep) GetRequest() SyntheticsTestRequest { - if o == nil { - var ret SyntheticsTestRequest - return ret - } - return o.Request -} - -// GetRequestOk returns a tuple with the Request field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetRequestOk() (*SyntheticsTestRequest, bool) { - if o == nil { - return nil, false - } - return &o.Request, true -} - -// SetRequest sets field value. -func (o *SyntheticsAPIStep) SetRequest(v SyntheticsTestRequest) { - o.Request = v -} - -// GetRetry returns the Retry field value if set, zero value otherwise. -func (o *SyntheticsAPIStep) GetRetry() SyntheticsTestOptionsRetry { - if o == nil || o.Retry == nil { - var ret SyntheticsTestOptionsRetry - return ret - } - return *o.Retry -} - -// GetRetryOk returns a tuple with the Retry field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetRetryOk() (*SyntheticsTestOptionsRetry, bool) { - if o == nil || o.Retry == nil { - return nil, false - } - return o.Retry, true -} - -// HasRetry returns a boolean if a field has been set. -func (o *SyntheticsAPIStep) HasRetry() bool { - if o != nil && o.Retry != nil { - return true - } - - return false -} - -// SetRetry gets a reference to the given SyntheticsTestOptionsRetry and assigns it to the Retry field. -func (o *SyntheticsAPIStep) SetRetry(v SyntheticsTestOptionsRetry) { - o.Retry = &v -} - -// GetSubtype returns the Subtype field value. -func (o *SyntheticsAPIStep) GetSubtype() SyntheticsAPIStepSubtype { - if o == nil { - var ret SyntheticsAPIStepSubtype - return ret - } - return o.Subtype -} - -// GetSubtypeOk returns a tuple with the Subtype field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPIStep) GetSubtypeOk() (*SyntheticsAPIStepSubtype, bool) { - if o == nil { - return nil, false - } - return &o.Subtype, true -} - -// SetSubtype sets field value. -func (o *SyntheticsAPIStep) SetSubtype(v SyntheticsAPIStepSubtype) { - o.Subtype = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPIStep) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AllowFailure != nil { - toSerialize["allowFailure"] = o.AllowFailure - } - toSerialize["assertions"] = o.Assertions - if o.ExtractedValues != nil { - toSerialize["extractedValues"] = o.ExtractedValues - } - if o.IsCritical != nil { - toSerialize["isCritical"] = o.IsCritical - } - toSerialize["name"] = o.Name - toSerialize["request"] = o.Request - if o.Retry != nil { - toSerialize["retry"] = o.Retry - } - toSerialize["subtype"] = o.Subtype - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Assertions *[]SyntheticsAssertion `json:"assertions"` - Name *string `json:"name"` - Request *SyntheticsTestRequest `json:"request"` - Subtype *SyntheticsAPIStepSubtype `json:"subtype"` - }{} - all := struct { - AllowFailure *bool `json:"allowFailure,omitempty"` - Assertions []SyntheticsAssertion `json:"assertions"` - ExtractedValues []SyntheticsParsingOptions `json:"extractedValues,omitempty"` - IsCritical *bool `json:"isCritical,omitempty"` - Name string `json:"name"` - Request SyntheticsTestRequest `json:"request"` - Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - Subtype SyntheticsAPIStepSubtype `json:"subtype"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assertions == nil { - return fmt.Errorf("Required field assertions missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Request == nil { - return fmt.Errorf("Required field request missing") - } - if required.Subtype == nil { - return fmt.Errorf("Required field subtype missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Subtype; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AllowFailure = all.AllowFailure - o.Assertions = all.Assertions - o.ExtractedValues = all.ExtractedValues - o.IsCritical = all.IsCritical - o.Name = all.Name - if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Request = all.Request - if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Retry = all.Retry - o.Subtype = all.Subtype - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_step_subtype.go b/api/v1/datadog/model_synthetics_api_step_subtype.go deleted file mode 100644 index b9be3ed801d..00000000000 --- a/api/v1/datadog/model_synthetics_api_step_subtype.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAPIStepSubtype The subtype of the Synthetic multistep API test step, currently only supporting `http`. -type SyntheticsAPIStepSubtype string - -// List of SyntheticsAPIStepSubtype. -const ( - SYNTHETICSAPISTEPSUBTYPE_HTTP SyntheticsAPIStepSubtype = "http" -) - -var allowedSyntheticsAPIStepSubtypeEnumValues = []SyntheticsAPIStepSubtype{ - SYNTHETICSAPISTEPSUBTYPE_HTTP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsAPIStepSubtype) GetAllowedValues() []SyntheticsAPIStepSubtype { - return allowedSyntheticsAPIStepSubtypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsAPIStepSubtype) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsAPIStepSubtype(value) - return nil -} - -// NewSyntheticsAPIStepSubtypeFromValue returns a pointer to a valid SyntheticsAPIStepSubtype -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsAPIStepSubtypeFromValue(v string) (*SyntheticsAPIStepSubtype, error) { - ev := SyntheticsAPIStepSubtype(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsAPIStepSubtype: valid values are %v", v, allowedSyntheticsAPIStepSubtypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsAPIStepSubtype) IsValid() bool { - for _, existing := range allowedSyntheticsAPIStepSubtypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsAPIStepSubtype value. -func (v SyntheticsAPIStepSubtype) Ptr() *SyntheticsAPIStepSubtype { - return &v -} - -// NullableSyntheticsAPIStepSubtype handles when a null is used for SyntheticsAPIStepSubtype. -type NullableSyntheticsAPIStepSubtype struct { - value *SyntheticsAPIStepSubtype - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAPIStepSubtype) Get() *SyntheticsAPIStepSubtype { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAPIStepSubtype) Set(val *SyntheticsAPIStepSubtype) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAPIStepSubtype) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAPIStepSubtype) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAPIStepSubtype initializes the struct as if Set has been called. -func NewNullableSyntheticsAPIStepSubtype(val *SyntheticsAPIStepSubtype) *NullableSyntheticsAPIStepSubtype { - return &NullableSyntheticsAPIStepSubtype{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAPIStepSubtype) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAPIStepSubtype) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_api_test_.go b/api/v1/datadog/model_synthetics_api_test_.go deleted file mode 100644 index 62122994fc4..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_.go +++ /dev/null @@ -1,505 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAPITest Object containing details about a Synthetic API test. -type SyntheticsAPITest struct { - // Configuration object for a Synthetic API test. - Config SyntheticsAPITestConfig `json:"config"` - // Array of locations used to run the test. - Locations []string `json:"locations"` - // Notification message associated with the test. - Message string `json:"message"` - // The associated monitor ID. - MonitorId *int64 `json:"monitor_id,omitempty"` - // Name of the test. - Name string `json:"name"` - // Object describing the extra options for a Synthetic test. - Options SyntheticsTestOptions `json:"options"` - // The public ID for the test. - PublicId *string `json:"public_id,omitempty"` - // Define whether you want to start (`live`) or pause (`paused`) a - // Synthetic test. - Status *SyntheticsTestPauseStatus `json:"status,omitempty"` - // The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, - // `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. - Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` - // Array of tags attached to the test. - Tags []string `json:"tags,omitempty"` - // Type of the Synthetic test, `api`. - Type SyntheticsAPITestType `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{} -} - -// NewSyntheticsAPITest instantiates a new SyntheticsAPITest 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 NewSyntheticsAPITest(config SyntheticsAPITestConfig, locations []string, message string, name string, options SyntheticsTestOptions, typeVar SyntheticsAPITestType) *SyntheticsAPITest { - this := SyntheticsAPITest{} - this.Config = config - this.Locations = locations - this.Message = message - this.Name = name - this.Options = options - this.Type = typeVar - return &this -} - -// NewSyntheticsAPITestWithDefaults instantiates a new SyntheticsAPITest 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 NewSyntheticsAPITestWithDefaults() *SyntheticsAPITest { - this := SyntheticsAPITest{} - var typeVar SyntheticsAPITestType = SYNTHETICSAPITESTTYPE_API - this.Type = typeVar - return &this -} - -// GetConfig returns the Config field value. -func (o *SyntheticsAPITest) GetConfig() SyntheticsAPITestConfig { - if o == nil { - var ret SyntheticsAPITestConfig - return ret - } - return o.Config -} - -// GetConfigOk returns a tuple with the Config field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetConfigOk() (*SyntheticsAPITestConfig, bool) { - if o == nil { - return nil, false - } - return &o.Config, true -} - -// SetConfig sets field value. -func (o *SyntheticsAPITest) SetConfig(v SyntheticsAPITestConfig) { - o.Config = v -} - -// GetLocations returns the Locations field value. -func (o *SyntheticsAPITest) GetLocations() []string { - if o == nil { - var ret []string - return ret - } - return o.Locations -} - -// GetLocationsOk returns a tuple with the Locations field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetLocationsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Locations, true -} - -// SetLocations sets field value. -func (o *SyntheticsAPITest) SetLocations(v []string) { - o.Locations = v -} - -// GetMessage returns the Message field value. -func (o *SyntheticsAPITest) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *SyntheticsAPITest) SetMessage(v string) { - o.Message = v -} - -// GetMonitorId returns the MonitorId field value if set, zero value otherwise. -func (o *SyntheticsAPITest) GetMonitorId() int64 { - if o == nil || o.MonitorId == nil { - var ret int64 - return ret - } - return *o.MonitorId -} - -// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetMonitorIdOk() (*int64, bool) { - if o == nil || o.MonitorId == nil { - return nil, false - } - return o.MonitorId, true -} - -// HasMonitorId returns a boolean if a field has been set. -func (o *SyntheticsAPITest) HasMonitorId() bool { - if o != nil && o.MonitorId != nil { - return true - } - - return false -} - -// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. -func (o *SyntheticsAPITest) SetMonitorId(v int64) { - o.MonitorId = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsAPITest) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsAPITest) SetName(v string) { - o.Name = v -} - -// GetOptions returns the Options field value. -func (o *SyntheticsAPITest) GetOptions() SyntheticsTestOptions { - if o == nil { - var ret SyntheticsTestOptions - return ret - } - return o.Options -} - -// GetOptionsOk returns a tuple with the Options field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetOptionsOk() (*SyntheticsTestOptions, bool) { - if o == nil { - return nil, false - } - return &o.Options, true -} - -// SetOptions sets field value. -func (o *SyntheticsAPITest) SetOptions(v SyntheticsTestOptions) { - o.Options = v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *SyntheticsAPITest) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *SyntheticsAPITest) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *SyntheticsAPITest) SetPublicId(v string) { - o.PublicId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsAPITest) GetStatus() SyntheticsTestPauseStatus { - if o == nil || o.Status == nil { - var ret SyntheticsTestPauseStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsAPITest) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. -func (o *SyntheticsAPITest) SetStatus(v SyntheticsTestPauseStatus) { - o.Status = &v -} - -// GetSubtype returns the Subtype field value if set, zero value otherwise. -func (o *SyntheticsAPITest) GetSubtype() SyntheticsTestDetailsSubType { - if o == nil || o.Subtype == nil { - var ret SyntheticsTestDetailsSubType - return ret - } - return *o.Subtype -} - -// GetSubtypeOk returns a tuple with the Subtype field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITest) GetSubtypeOk() (*SyntheticsTestDetailsSubType, bool) { - if o == nil || o.Subtype == nil { - return nil, false - } - return o.Subtype, true -} - -// HasSubtype returns a boolean if a field has been set. -func (o *SyntheticsAPITest) HasSubtype() bool { - if o != nil && o.Subtype != nil { - return true - } - - return false -} - -// SetSubtype gets a reference to the given SyntheticsTestDetailsSubType and assigns it to the Subtype field. -func (o *SyntheticsAPITest) SetSubtype(v SyntheticsTestDetailsSubType) { - o.Subtype = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SyntheticsAPITest) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SyntheticsAPITest) GetTagsOk() (*[]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 *SyntheticsAPITest) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SyntheticsAPITest) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value. -func (o *SyntheticsAPITest) GetType() SyntheticsAPITestType { - if o == nil { - var ret SyntheticsAPITestType - 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 *SyntheticsAPITest) GetTypeOk() (*SyntheticsAPITestType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsAPITest) SetType(v SyntheticsAPITestType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPITest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["config"] = o.Config - toSerialize["locations"] = o.Locations - toSerialize["message"] = o.Message - if o.MonitorId != nil { - toSerialize["monitor_id"] = o.MonitorId - } - toSerialize["name"] = o.Name - toSerialize["options"] = o.Options - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Subtype != nil { - toSerialize["subtype"] = o.Subtype - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Config *SyntheticsAPITestConfig `json:"config"` - Locations *[]string `json:"locations"` - Message *string `json:"message"` - Name *string `json:"name"` - Options *SyntheticsTestOptions `json:"options"` - Type *SyntheticsAPITestType `json:"type"` - }{} - all := struct { - Config SyntheticsAPITestConfig `json:"config"` - Locations []string `json:"locations"` - Message string `json:"message"` - MonitorId *int64 `json:"monitor_id,omitempty"` - Name string `json:"name"` - Options SyntheticsTestOptions `json:"options"` - PublicId *string `json:"public_id,omitempty"` - Status *SyntheticsTestPauseStatus `json:"status,omitempty"` - Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` - Tags []string `json:"tags,omitempty"` - Type SyntheticsAPITestType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Config == nil { - return fmt.Errorf("Required field config missing") - } - if required.Locations == nil { - return fmt.Errorf("Required field locations missing") - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Options == nil { - return fmt.Errorf("Required field options missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Subtype; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Config = all.Config - o.Locations = all.Locations - o.Message = all.Message - o.MonitorId = all.MonitorId - o.Name = all.Name - if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.PublicId = all.PublicId - o.Status = all.Status - o.Subtype = all.Subtype - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_config.go b/api/v1/datadog/model_synthetics_api_test_config.go deleted file mode 100644 index 26ca3a4cde3..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_config.go +++ /dev/null @@ -1,226 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsAPITestConfig Configuration object for a Synthetic API test. -type SyntheticsAPITestConfig struct { - // Array of assertions used for the test. Required for single API tests. - Assertions []SyntheticsAssertion `json:"assertions,omitempty"` - // Array of variables used for the test. - ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` - // Object describing the Synthetic test request. - Request *SyntheticsTestRequest `json:"request,omitempty"` - // When the test subtype is `multi`, the steps of the test. - Steps []SyntheticsAPIStep `json:"steps,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{} -} - -// NewSyntheticsAPITestConfig instantiates a new SyntheticsAPITestConfig 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 NewSyntheticsAPITestConfig() *SyntheticsAPITestConfig { - this := SyntheticsAPITestConfig{} - return &this -} - -// NewSyntheticsAPITestConfigWithDefaults instantiates a new SyntheticsAPITestConfig 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 NewSyntheticsAPITestConfigWithDefaults() *SyntheticsAPITestConfig { - this := SyntheticsAPITestConfig{} - return &this -} - -// GetAssertions returns the Assertions field value if set, zero value otherwise. -func (o *SyntheticsAPITestConfig) GetAssertions() []SyntheticsAssertion { - if o == nil || o.Assertions == nil { - var ret []SyntheticsAssertion - return ret - } - return o.Assertions -} - -// GetAssertionsOk returns a tuple with the Assertions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { - if o == nil || o.Assertions == nil { - return nil, false - } - return &o.Assertions, true -} - -// HasAssertions returns a boolean if a field has been set. -func (o *SyntheticsAPITestConfig) HasAssertions() bool { - if o != nil && o.Assertions != nil { - return true - } - - return false -} - -// SetAssertions gets a reference to the given []SyntheticsAssertion and assigns it to the Assertions field. -func (o *SyntheticsAPITestConfig) SetAssertions(v []SyntheticsAssertion) { - o.Assertions = v -} - -// GetConfigVariables returns the ConfigVariables field value if set, zero value otherwise. -func (o *SyntheticsAPITestConfig) GetConfigVariables() []SyntheticsConfigVariable { - if o == nil || o.ConfigVariables == nil { - var ret []SyntheticsConfigVariable - return ret - } - return o.ConfigVariables -} - -// GetConfigVariablesOk returns a tuple with the ConfigVariables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool) { - if o == nil || o.ConfigVariables == nil { - return nil, false - } - return &o.ConfigVariables, true -} - -// HasConfigVariables returns a boolean if a field has been set. -func (o *SyntheticsAPITestConfig) HasConfigVariables() bool { - if o != nil && o.ConfigVariables != nil { - return true - } - - return false -} - -// SetConfigVariables gets a reference to the given []SyntheticsConfigVariable and assigns it to the ConfigVariables field. -func (o *SyntheticsAPITestConfig) SetConfigVariables(v []SyntheticsConfigVariable) { - o.ConfigVariables = v -} - -// GetRequest returns the Request field value if set, zero value otherwise. -func (o *SyntheticsAPITestConfig) GetRequest() SyntheticsTestRequest { - if o == nil || o.Request == nil { - var ret SyntheticsTestRequest - return ret - } - return *o.Request -} - -// GetRequestOk returns a tuple with the Request field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { - if o == nil || o.Request == nil { - return nil, false - } - return o.Request, true -} - -// HasRequest returns a boolean if a field has been set. -func (o *SyntheticsAPITestConfig) HasRequest() bool { - if o != nil && o.Request != nil { - return true - } - - return false -} - -// SetRequest gets a reference to the given SyntheticsTestRequest and assigns it to the Request field. -func (o *SyntheticsAPITestConfig) SetRequest(v SyntheticsTestRequest) { - o.Request = &v -} - -// GetSteps returns the Steps field value if set, zero value otherwise. -func (o *SyntheticsAPITestConfig) GetSteps() []SyntheticsAPIStep { - if o == nil || o.Steps == nil { - var ret []SyntheticsAPIStep - return ret - } - return o.Steps -} - -// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestConfig) GetStepsOk() (*[]SyntheticsAPIStep, bool) { - if o == nil || o.Steps == nil { - return nil, false - } - return &o.Steps, true -} - -// HasSteps returns a boolean if a field has been set. -func (o *SyntheticsAPITestConfig) HasSteps() bool { - if o != nil && o.Steps != nil { - return true - } - - return false -} - -// SetSteps gets a reference to the given []SyntheticsAPIStep and assigns it to the Steps field. -func (o *SyntheticsAPITestConfig) SetSteps(v []SyntheticsAPIStep) { - o.Steps = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPITestConfig) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Assertions != nil { - toSerialize["assertions"] = o.Assertions - } - if o.ConfigVariables != nil { - toSerialize["configVariables"] = o.ConfigVariables - } - if o.Request != nil { - toSerialize["request"] = o.Request - } - if o.Steps != nil { - toSerialize["steps"] = o.Steps - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPITestConfig) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Assertions []SyntheticsAssertion `json:"assertions,omitempty"` - ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` - Request *SyntheticsTestRequest `json:"request,omitempty"` - Steps []SyntheticsAPIStep `json:"steps,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Assertions = all.Assertions - o.ConfigVariables = all.ConfigVariables - if all.Request != nil && all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Request = all.Request - o.Steps = all.Steps - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_failure_code.go b/api/v1/datadog/model_synthetics_api_test_failure_code.go deleted file mode 100644 index 37be90a63a0..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_failure_code.go +++ /dev/null @@ -1,157 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsApiTestFailureCode Error code that can be returned by a Synthetic test. -type SyntheticsApiTestFailureCode string - -// List of SyntheticsApiTestFailureCode. -const ( - SYNTHETICSAPITESTFAILURECODE_BODY_TOO_LARGE SyntheticsApiTestFailureCode = "BODY_TOO_LARGE" - SYNTHETICSAPITESTFAILURECODE_DENIED SyntheticsApiTestFailureCode = "DENIED" - SYNTHETICSAPITESTFAILURECODE_TOO_MANY_REDIRECTS SyntheticsApiTestFailureCode = "TOO_MANY_REDIRECTS" - SYNTHETICSAPITESTFAILURECODE_AUTHENTICATION_ERROR SyntheticsApiTestFailureCode = "AUTHENTICATION_ERROR" - SYNTHETICSAPITESTFAILURECODE_DECRYPTION SyntheticsApiTestFailureCode = "DECRYPTION" - SYNTHETICSAPITESTFAILURECODE_INVALID_CHAR_IN_HEADER SyntheticsApiTestFailureCode = "INVALID_CHAR_IN_HEADER" - SYNTHETICSAPITESTFAILURECODE_HEADER_TOO_LARGE SyntheticsApiTestFailureCode = "HEADER_TOO_LARGE" - SYNTHETICSAPITESTFAILURECODE_HEADERS_INCOMPATIBLE_CONTENT_LENGTH SyntheticsApiTestFailureCode = "HEADERS_INCOMPATIBLE_CONTENT_LENGTH" - SYNTHETICSAPITESTFAILURECODE_INVALID_REQUEST SyntheticsApiTestFailureCode = "INVALID_REQUEST" - SYNTHETICSAPITESTFAILURECODE_REQUIRES_UPDATE SyntheticsApiTestFailureCode = "REQUIRES_UPDATE" - SYNTHETICSAPITESTFAILURECODE_UNESCAPED_CHARACTERS_IN_REQUEST_PATH SyntheticsApiTestFailureCode = "UNESCAPED_CHARACTERS_IN_REQUEST_PATH" - SYNTHETICSAPITESTFAILURECODE_MALFORMED_RESPONSE SyntheticsApiTestFailureCode = "MALFORMED_RESPONSE" - SYNTHETICSAPITESTFAILURECODE_INCORRECT_ASSERTION SyntheticsApiTestFailureCode = "INCORRECT_ASSERTION" - SYNTHETICSAPITESTFAILURECODE_CONNREFUSED SyntheticsApiTestFailureCode = "CONNREFUSED" - SYNTHETICSAPITESTFAILURECODE_CONNRESET SyntheticsApiTestFailureCode = "CONNRESET" - SYNTHETICSAPITESTFAILURECODE_DNS SyntheticsApiTestFailureCode = "DNS" - SYNTHETICSAPITESTFAILURECODE_HOSTUNREACH SyntheticsApiTestFailureCode = "HOSTUNREACH" - SYNTHETICSAPITESTFAILURECODE_NETUNREACH SyntheticsApiTestFailureCode = "NETUNREACH" - SYNTHETICSAPITESTFAILURECODE_TIMEOUT SyntheticsApiTestFailureCode = "TIMEOUT" - SYNTHETICSAPITESTFAILURECODE_SSL SyntheticsApiTestFailureCode = "SSL" - SYNTHETICSAPITESTFAILURECODE_OCSP SyntheticsApiTestFailureCode = "OCSP" - SYNTHETICSAPITESTFAILURECODE_INVALID_TEST SyntheticsApiTestFailureCode = "INVALID_TEST" - SYNTHETICSAPITESTFAILURECODE_TUNNEL SyntheticsApiTestFailureCode = "TUNNEL" - SYNTHETICSAPITESTFAILURECODE_WEBSOCKET SyntheticsApiTestFailureCode = "WEBSOCKET" - SYNTHETICSAPITESTFAILURECODE_UNKNOWN SyntheticsApiTestFailureCode = "UNKNOWN" - SYNTHETICSAPITESTFAILURECODE_INTERNAL_ERROR SyntheticsApiTestFailureCode = "INTERNAL_ERROR" -) - -var allowedSyntheticsApiTestFailureCodeEnumValues = []SyntheticsApiTestFailureCode{ - SYNTHETICSAPITESTFAILURECODE_BODY_TOO_LARGE, - SYNTHETICSAPITESTFAILURECODE_DENIED, - SYNTHETICSAPITESTFAILURECODE_TOO_MANY_REDIRECTS, - SYNTHETICSAPITESTFAILURECODE_AUTHENTICATION_ERROR, - SYNTHETICSAPITESTFAILURECODE_DECRYPTION, - SYNTHETICSAPITESTFAILURECODE_INVALID_CHAR_IN_HEADER, - SYNTHETICSAPITESTFAILURECODE_HEADER_TOO_LARGE, - SYNTHETICSAPITESTFAILURECODE_HEADERS_INCOMPATIBLE_CONTENT_LENGTH, - SYNTHETICSAPITESTFAILURECODE_INVALID_REQUEST, - SYNTHETICSAPITESTFAILURECODE_REQUIRES_UPDATE, - SYNTHETICSAPITESTFAILURECODE_UNESCAPED_CHARACTERS_IN_REQUEST_PATH, - SYNTHETICSAPITESTFAILURECODE_MALFORMED_RESPONSE, - SYNTHETICSAPITESTFAILURECODE_INCORRECT_ASSERTION, - SYNTHETICSAPITESTFAILURECODE_CONNREFUSED, - SYNTHETICSAPITESTFAILURECODE_CONNRESET, - SYNTHETICSAPITESTFAILURECODE_DNS, - SYNTHETICSAPITESTFAILURECODE_HOSTUNREACH, - SYNTHETICSAPITESTFAILURECODE_NETUNREACH, - SYNTHETICSAPITESTFAILURECODE_TIMEOUT, - SYNTHETICSAPITESTFAILURECODE_SSL, - SYNTHETICSAPITESTFAILURECODE_OCSP, - SYNTHETICSAPITESTFAILURECODE_INVALID_TEST, - SYNTHETICSAPITESTFAILURECODE_TUNNEL, - SYNTHETICSAPITESTFAILURECODE_WEBSOCKET, - SYNTHETICSAPITESTFAILURECODE_UNKNOWN, - SYNTHETICSAPITESTFAILURECODE_INTERNAL_ERROR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsApiTestFailureCode) GetAllowedValues() []SyntheticsApiTestFailureCode { - return allowedSyntheticsApiTestFailureCodeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsApiTestFailureCode) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsApiTestFailureCode(value) - return nil -} - -// NewSyntheticsApiTestFailureCodeFromValue returns a pointer to a valid SyntheticsApiTestFailureCode -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsApiTestFailureCodeFromValue(v string) (*SyntheticsApiTestFailureCode, error) { - ev := SyntheticsApiTestFailureCode(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsApiTestFailureCode: valid values are %v", v, allowedSyntheticsApiTestFailureCodeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsApiTestFailureCode) IsValid() bool { - for _, existing := range allowedSyntheticsApiTestFailureCodeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsApiTestFailureCode value. -func (v SyntheticsApiTestFailureCode) Ptr() *SyntheticsApiTestFailureCode { - return &v -} - -// NullableSyntheticsApiTestFailureCode handles when a null is used for SyntheticsApiTestFailureCode. -type NullableSyntheticsApiTestFailureCode struct { - value *SyntheticsApiTestFailureCode - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsApiTestFailureCode) Get() *SyntheticsApiTestFailureCode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsApiTestFailureCode) Set(val *SyntheticsApiTestFailureCode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsApiTestFailureCode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsApiTestFailureCode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsApiTestFailureCode initializes the struct as if Set has been called. -func NewNullableSyntheticsApiTestFailureCode(val *SyntheticsApiTestFailureCode) *NullableSyntheticsApiTestFailureCode { - return &NullableSyntheticsApiTestFailureCode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsApiTestFailureCode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsApiTestFailureCode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_api_test_result_data.go b/api/v1/datadog/model_synthetics_api_test_result_data.go deleted file mode 100644 index 7d5a1c4a958..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_result_data.go +++ /dev/null @@ -1,444 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsAPITestResultData Object containing results for your Synthetic API test. -type SyntheticsAPITestResultData struct { - // Object describing the SSL certificate used for a Synthetic test. - Cert *SyntheticsSSLCertificate `json:"cert,omitempty"` - // Status of a Synthetic test. - EventType *SyntheticsTestProcessStatus `json:"eventType,omitempty"` - // The API test failure details. - Failure *SyntheticsApiTestResultFailure `json:"failure,omitempty"` - // The API test HTTP status code. - HttpStatusCode *int64 `json:"httpStatusCode,omitempty"` - // Request header object used for the API test. - RequestHeaders map[string]interface{} `json:"requestHeaders,omitempty"` - // Response body returned for the API test. - ResponseBody *string `json:"responseBody,omitempty"` - // Response headers returned for the API test. - ResponseHeaders map[string]interface{} `json:"responseHeaders,omitempty"` - // Global size in byte of the API test response. - ResponseSize *int64 `json:"responseSize,omitempty"` - // Object containing all metrics and their values collected for a Synthetic API test. - // Learn more about those metrics in [Synthetics documentation](https://docs.datadoghq.com/synthetics/#metrics). - Timings *SyntheticsTiming `json:"timings,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{} -} - -// NewSyntheticsAPITestResultData instantiates a new SyntheticsAPITestResultData 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 NewSyntheticsAPITestResultData() *SyntheticsAPITestResultData { - this := SyntheticsAPITestResultData{} - return &this -} - -// NewSyntheticsAPITestResultDataWithDefaults instantiates a new SyntheticsAPITestResultData 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 NewSyntheticsAPITestResultDataWithDefaults() *SyntheticsAPITestResultData { - this := SyntheticsAPITestResultData{} - return &this -} - -// GetCert returns the Cert field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetCert() SyntheticsSSLCertificate { - if o == nil || o.Cert == nil { - var ret SyntheticsSSLCertificate - return ret - } - return *o.Cert -} - -// GetCertOk returns a tuple with the Cert field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetCertOk() (*SyntheticsSSLCertificate, bool) { - if o == nil || o.Cert == nil { - return nil, false - } - return o.Cert, true -} - -// HasCert returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasCert() bool { - if o != nil && o.Cert != nil { - return true - } - - return false -} - -// SetCert gets a reference to the given SyntheticsSSLCertificate and assigns it to the Cert field. -func (o *SyntheticsAPITestResultData) SetCert(v SyntheticsSSLCertificate) { - o.Cert = &v -} - -// GetEventType returns the EventType field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetEventType() SyntheticsTestProcessStatus { - if o == nil || o.EventType == nil { - var ret SyntheticsTestProcessStatus - return ret - } - return *o.EventType -} - -// GetEventTypeOk returns a tuple with the EventType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetEventTypeOk() (*SyntheticsTestProcessStatus, bool) { - if o == nil || o.EventType == nil { - return nil, false - } - return o.EventType, true -} - -// HasEventType returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasEventType() bool { - if o != nil && o.EventType != nil { - return true - } - - return false -} - -// SetEventType gets a reference to the given SyntheticsTestProcessStatus and assigns it to the EventType field. -func (o *SyntheticsAPITestResultData) SetEventType(v SyntheticsTestProcessStatus) { - o.EventType = &v -} - -// GetFailure returns the Failure field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetFailure() SyntheticsApiTestResultFailure { - if o == nil || o.Failure == nil { - var ret SyntheticsApiTestResultFailure - return ret - } - return *o.Failure -} - -// GetFailureOk returns a tuple with the Failure field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetFailureOk() (*SyntheticsApiTestResultFailure, bool) { - if o == nil || o.Failure == nil { - return nil, false - } - return o.Failure, true -} - -// HasFailure returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasFailure() bool { - if o != nil && o.Failure != nil { - return true - } - - return false -} - -// SetFailure gets a reference to the given SyntheticsApiTestResultFailure and assigns it to the Failure field. -func (o *SyntheticsAPITestResultData) SetFailure(v SyntheticsApiTestResultFailure) { - o.Failure = &v -} - -// GetHttpStatusCode returns the HttpStatusCode field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetHttpStatusCode() int64 { - if o == nil || o.HttpStatusCode == nil { - var ret int64 - return ret - } - return *o.HttpStatusCode -} - -// GetHttpStatusCodeOk returns a tuple with the HttpStatusCode field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetHttpStatusCodeOk() (*int64, bool) { - if o == nil || o.HttpStatusCode == nil { - return nil, false - } - return o.HttpStatusCode, true -} - -// HasHttpStatusCode returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasHttpStatusCode() bool { - if o != nil && o.HttpStatusCode != nil { - return true - } - - return false -} - -// SetHttpStatusCode gets a reference to the given int64 and assigns it to the HttpStatusCode field. -func (o *SyntheticsAPITestResultData) SetHttpStatusCode(v int64) { - o.HttpStatusCode = &v -} - -// GetRequestHeaders returns the RequestHeaders field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetRequestHeaders() map[string]interface{} { - if o == nil || o.RequestHeaders == nil { - var ret map[string]interface{} - return ret - } - return o.RequestHeaders -} - -// GetRequestHeadersOk returns a tuple with the RequestHeaders field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetRequestHeadersOk() (*map[string]interface{}, bool) { - if o == nil || o.RequestHeaders == nil { - return nil, false - } - return &o.RequestHeaders, true -} - -// HasRequestHeaders returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasRequestHeaders() bool { - if o != nil && o.RequestHeaders != nil { - return true - } - - return false -} - -// SetRequestHeaders gets a reference to the given map[string]interface{} and assigns it to the RequestHeaders field. -func (o *SyntheticsAPITestResultData) SetRequestHeaders(v map[string]interface{}) { - o.RequestHeaders = v -} - -// GetResponseBody returns the ResponseBody field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetResponseBody() string { - if o == nil || o.ResponseBody == nil { - var ret string - return ret - } - return *o.ResponseBody -} - -// GetResponseBodyOk returns a tuple with the ResponseBody field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetResponseBodyOk() (*string, bool) { - if o == nil || o.ResponseBody == nil { - return nil, false - } - return o.ResponseBody, true -} - -// HasResponseBody returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasResponseBody() bool { - if o != nil && o.ResponseBody != nil { - return true - } - - return false -} - -// SetResponseBody gets a reference to the given string and assigns it to the ResponseBody field. -func (o *SyntheticsAPITestResultData) SetResponseBody(v string) { - o.ResponseBody = &v -} - -// GetResponseHeaders returns the ResponseHeaders field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetResponseHeaders() map[string]interface{} { - if o == nil || o.ResponseHeaders == nil { - var ret map[string]interface{} - return ret - } - return o.ResponseHeaders -} - -// GetResponseHeadersOk returns a tuple with the ResponseHeaders field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetResponseHeadersOk() (*map[string]interface{}, bool) { - if o == nil || o.ResponseHeaders == nil { - return nil, false - } - return &o.ResponseHeaders, true -} - -// HasResponseHeaders returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasResponseHeaders() bool { - if o != nil && o.ResponseHeaders != nil { - return true - } - - return false -} - -// SetResponseHeaders gets a reference to the given map[string]interface{} and assigns it to the ResponseHeaders field. -func (o *SyntheticsAPITestResultData) SetResponseHeaders(v map[string]interface{}) { - o.ResponseHeaders = v -} - -// GetResponseSize returns the ResponseSize field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetResponseSize() int64 { - if o == nil || o.ResponseSize == nil { - var ret int64 - return ret - } - return *o.ResponseSize -} - -// GetResponseSizeOk returns a tuple with the ResponseSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetResponseSizeOk() (*int64, bool) { - if o == nil || o.ResponseSize == nil { - return nil, false - } - return o.ResponseSize, true -} - -// HasResponseSize returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasResponseSize() bool { - if o != nil && o.ResponseSize != nil { - return true - } - - return false -} - -// SetResponseSize gets a reference to the given int64 and assigns it to the ResponseSize field. -func (o *SyntheticsAPITestResultData) SetResponseSize(v int64) { - o.ResponseSize = &v -} - -// GetTimings returns the Timings field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultData) GetTimings() SyntheticsTiming { - if o == nil || o.Timings == nil { - var ret SyntheticsTiming - return ret - } - return *o.Timings -} - -// GetTimingsOk returns a tuple with the Timings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultData) GetTimingsOk() (*SyntheticsTiming, bool) { - if o == nil || o.Timings == nil { - return nil, false - } - return o.Timings, true -} - -// HasTimings returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultData) HasTimings() bool { - if o != nil && o.Timings != nil { - return true - } - - return false -} - -// SetTimings gets a reference to the given SyntheticsTiming and assigns it to the Timings field. -func (o *SyntheticsAPITestResultData) SetTimings(v SyntheticsTiming) { - o.Timings = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPITestResultData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cert != nil { - toSerialize["cert"] = o.Cert - } - if o.EventType != nil { - toSerialize["eventType"] = o.EventType - } - if o.Failure != nil { - toSerialize["failure"] = o.Failure - } - if o.HttpStatusCode != nil { - toSerialize["httpStatusCode"] = o.HttpStatusCode - } - if o.RequestHeaders != nil { - toSerialize["requestHeaders"] = o.RequestHeaders - } - if o.ResponseBody != nil { - toSerialize["responseBody"] = o.ResponseBody - } - if o.ResponseHeaders != nil { - toSerialize["responseHeaders"] = o.ResponseHeaders - } - if o.ResponseSize != nil { - toSerialize["responseSize"] = o.ResponseSize - } - if o.Timings != nil { - toSerialize["timings"] = o.Timings - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cert *SyntheticsSSLCertificate `json:"cert,omitempty"` - EventType *SyntheticsTestProcessStatus `json:"eventType,omitempty"` - Failure *SyntheticsApiTestResultFailure `json:"failure,omitempty"` - HttpStatusCode *int64 `json:"httpStatusCode,omitempty"` - RequestHeaders map[string]interface{} `json:"requestHeaders,omitempty"` - ResponseBody *string `json:"responseBody,omitempty"` - ResponseHeaders map[string]interface{} `json:"responseHeaders,omitempty"` - ResponseSize *int64 `json:"responseSize,omitempty"` - Timings *SyntheticsTiming `json:"timings,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EventType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Cert != nil && all.Cert.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Cert = all.Cert - o.EventType = all.EventType - if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Failure = all.Failure - o.HttpStatusCode = all.HttpStatusCode - o.RequestHeaders = all.RequestHeaders - o.ResponseBody = all.ResponseBody - o.ResponseHeaders = all.ResponseHeaders - o.ResponseSize = all.ResponseSize - if all.Timings != nil && all.Timings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Timings = all.Timings - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_result_failure.go b/api/v1/datadog/model_synthetics_api_test_result_failure.go deleted file mode 100644 index 2e0dca70788..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_result_failure.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsApiTestResultFailure The API test failure details. -type SyntheticsApiTestResultFailure struct { - // Error code that can be returned by a Synthetic test. - Code *SyntheticsApiTestFailureCode `json:"code,omitempty"` - // The API test error message. - Message *string `json:"message,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{} -} - -// NewSyntheticsApiTestResultFailure instantiates a new SyntheticsApiTestResultFailure 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 NewSyntheticsApiTestResultFailure() *SyntheticsApiTestResultFailure { - this := SyntheticsApiTestResultFailure{} - return &this -} - -// NewSyntheticsApiTestResultFailureWithDefaults instantiates a new SyntheticsApiTestResultFailure 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 NewSyntheticsApiTestResultFailureWithDefaults() *SyntheticsApiTestResultFailure { - this := SyntheticsApiTestResultFailure{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *SyntheticsApiTestResultFailure) GetCode() SyntheticsApiTestFailureCode { - if o == nil || o.Code == nil { - var ret SyntheticsApiTestFailureCode - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsApiTestResultFailure) GetCodeOk() (*SyntheticsApiTestFailureCode, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *SyntheticsApiTestResultFailure) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given SyntheticsApiTestFailureCode and assigns it to the Code field. -func (o *SyntheticsApiTestResultFailure) SetCode(v SyntheticsApiTestFailureCode) { - o.Code = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SyntheticsApiTestResultFailure) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsApiTestResultFailure) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SyntheticsApiTestResultFailure) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SyntheticsApiTestResultFailure) SetMessage(v string) { - o.Message = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsApiTestResultFailure) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsApiTestResultFailure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *SyntheticsApiTestFailureCode `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Code; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_result_full.go b/api/v1/datadog/model_synthetics_api_test_result_full.go deleted file mode 100644 index ed8388cb162..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_result_full.go +++ /dev/null @@ -1,361 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsAPITestResultFull Object returned describing a API test result. -type SyntheticsAPITestResultFull struct { - // Object describing the API test configuration. - Check *SyntheticsAPITestResultFullCheck `json:"check,omitempty"` - // When the API test was conducted. - CheckTime *float64 `json:"check_time,omitempty"` - // Version of the API test used. - CheckVersion *int64 `json:"check_version,omitempty"` - // Locations for which to query the API test results. - ProbeDc *string `json:"probe_dc,omitempty"` - // Object containing results for your Synthetic API test. - Result *SyntheticsAPITestResultData `json:"result,omitempty"` - // ID of the API test result. - ResultId *string `json:"result_id,omitempty"` - // The status of your Synthetic monitor. - // * `O` for not triggered - // * `1` for triggered - // * `2` for no data - Status *SyntheticsTestMonitorStatus `json:"status,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{} -} - -// NewSyntheticsAPITestResultFull instantiates a new SyntheticsAPITestResultFull 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 NewSyntheticsAPITestResultFull() *SyntheticsAPITestResultFull { - this := SyntheticsAPITestResultFull{} - return &this -} - -// NewSyntheticsAPITestResultFullWithDefaults instantiates a new SyntheticsAPITestResultFull 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 NewSyntheticsAPITestResultFullWithDefaults() *SyntheticsAPITestResultFull { - this := SyntheticsAPITestResultFull{} - return &this -} - -// GetCheck returns the Check field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultFull) GetCheck() SyntheticsAPITestResultFullCheck { - if o == nil || o.Check == nil { - var ret SyntheticsAPITestResultFullCheck - return ret - } - return *o.Check -} - -// GetCheckOk returns a tuple with the Check field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFull) GetCheckOk() (*SyntheticsAPITestResultFullCheck, bool) { - if o == nil || o.Check == nil { - return nil, false - } - return o.Check, true -} - -// HasCheck returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultFull) HasCheck() bool { - if o != nil && o.Check != nil { - return true - } - - return false -} - -// SetCheck gets a reference to the given SyntheticsAPITestResultFullCheck and assigns it to the Check field. -func (o *SyntheticsAPITestResultFull) SetCheck(v SyntheticsAPITestResultFullCheck) { - o.Check = &v -} - -// GetCheckTime returns the CheckTime field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultFull) GetCheckTime() float64 { - if o == nil || o.CheckTime == nil { - var ret float64 - return ret - } - return *o.CheckTime -} - -// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFull) GetCheckTimeOk() (*float64, bool) { - if o == nil || o.CheckTime == nil { - return nil, false - } - return o.CheckTime, true -} - -// HasCheckTime returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultFull) HasCheckTime() bool { - if o != nil && o.CheckTime != nil { - return true - } - - return false -} - -// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. -func (o *SyntheticsAPITestResultFull) SetCheckTime(v float64) { - o.CheckTime = &v -} - -// GetCheckVersion returns the CheckVersion field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultFull) GetCheckVersion() int64 { - if o == nil || o.CheckVersion == nil { - var ret int64 - return ret - } - return *o.CheckVersion -} - -// GetCheckVersionOk returns a tuple with the CheckVersion field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFull) GetCheckVersionOk() (*int64, bool) { - if o == nil || o.CheckVersion == nil { - return nil, false - } - return o.CheckVersion, true -} - -// HasCheckVersion returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultFull) HasCheckVersion() bool { - if o != nil && o.CheckVersion != nil { - return true - } - - return false -} - -// SetCheckVersion gets a reference to the given int64 and assigns it to the CheckVersion field. -func (o *SyntheticsAPITestResultFull) SetCheckVersion(v int64) { - o.CheckVersion = &v -} - -// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultFull) GetProbeDc() string { - if o == nil || o.ProbeDc == nil { - var ret string - return ret - } - return *o.ProbeDc -} - -// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFull) GetProbeDcOk() (*string, bool) { - if o == nil || o.ProbeDc == nil { - return nil, false - } - return o.ProbeDc, true -} - -// HasProbeDc returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultFull) HasProbeDc() bool { - if o != nil && o.ProbeDc != nil { - return true - } - - return false -} - -// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. -func (o *SyntheticsAPITestResultFull) SetProbeDc(v string) { - o.ProbeDc = &v -} - -// GetResult returns the Result field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultFull) GetResult() SyntheticsAPITestResultData { - if o == nil || o.Result == nil { - var ret SyntheticsAPITestResultData - return ret - } - return *o.Result -} - -// GetResultOk returns a tuple with the Result field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFull) GetResultOk() (*SyntheticsAPITestResultData, bool) { - if o == nil || o.Result == nil { - return nil, false - } - return o.Result, true -} - -// HasResult returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultFull) HasResult() bool { - if o != nil && o.Result != nil { - return true - } - - return false -} - -// SetResult gets a reference to the given SyntheticsAPITestResultData and assigns it to the Result field. -func (o *SyntheticsAPITestResultFull) SetResult(v SyntheticsAPITestResultData) { - o.Result = &v -} - -// GetResultId returns the ResultId field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultFull) GetResultId() string { - if o == nil || o.ResultId == nil { - var ret string - return ret - } - return *o.ResultId -} - -// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFull) GetResultIdOk() (*string, bool) { - if o == nil || o.ResultId == nil { - return nil, false - } - return o.ResultId, true -} - -// HasResultId returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultFull) HasResultId() bool { - if o != nil && o.ResultId != nil { - return true - } - - return false -} - -// SetResultId gets a reference to the given string and assigns it to the ResultId field. -func (o *SyntheticsAPITestResultFull) SetResultId(v string) { - o.ResultId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultFull) GetStatus() SyntheticsTestMonitorStatus { - if o == nil || o.Status == nil { - var ret SyntheticsTestMonitorStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFull) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultFull) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. -func (o *SyntheticsAPITestResultFull) SetStatus(v SyntheticsTestMonitorStatus) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPITestResultFull) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Check != nil { - toSerialize["check"] = o.Check - } - if o.CheckTime != nil { - toSerialize["check_time"] = o.CheckTime - } - if o.CheckVersion != nil { - toSerialize["check_version"] = o.CheckVersion - } - if o.ProbeDc != nil { - toSerialize["probe_dc"] = o.ProbeDc - } - if o.Result != nil { - toSerialize["result"] = o.Result - } - if o.ResultId != nil { - toSerialize["result_id"] = o.ResultId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPITestResultFull) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Check *SyntheticsAPITestResultFullCheck `json:"check,omitempty"` - CheckTime *float64 `json:"check_time,omitempty"` - CheckVersion *int64 `json:"check_version,omitempty"` - ProbeDc *string `json:"probe_dc,omitempty"` - Result *SyntheticsAPITestResultData `json:"result,omitempty"` - ResultId *string `json:"result_id,omitempty"` - Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Check != nil && all.Check.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Check = all.Check - o.CheckTime = all.CheckTime - o.CheckVersion = all.CheckVersion - o.ProbeDc = all.ProbeDc - if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Result = all.Result - o.ResultId = all.ResultId - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_result_full_check.go b/api/v1/datadog/model_synthetics_api_test_result_full_check.go deleted file mode 100644 index 0cffc3dad7d..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_result_full_check.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAPITestResultFullCheck Object describing the API test configuration. -type SyntheticsAPITestResultFullCheck struct { - // Configuration object for a Synthetic test. - Config SyntheticsTestConfig `json:"config"` - // 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{} -} - -// NewSyntheticsAPITestResultFullCheck instantiates a new SyntheticsAPITestResultFullCheck 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 NewSyntheticsAPITestResultFullCheck(config SyntheticsTestConfig) *SyntheticsAPITestResultFullCheck { - this := SyntheticsAPITestResultFullCheck{} - this.Config = config - return &this -} - -// NewSyntheticsAPITestResultFullCheckWithDefaults instantiates a new SyntheticsAPITestResultFullCheck 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 NewSyntheticsAPITestResultFullCheckWithDefaults() *SyntheticsAPITestResultFullCheck { - this := SyntheticsAPITestResultFullCheck{} - return &this -} - -// GetConfig returns the Config field value. -func (o *SyntheticsAPITestResultFullCheck) GetConfig() SyntheticsTestConfig { - if o == nil { - var ret SyntheticsTestConfig - return ret - } - return o.Config -} - -// GetConfigOk returns a tuple with the Config field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultFullCheck) GetConfigOk() (*SyntheticsTestConfig, bool) { - if o == nil { - return nil, false - } - return &o.Config, true -} - -// SetConfig sets field value. -func (o *SyntheticsAPITestResultFullCheck) SetConfig(v SyntheticsTestConfig) { - o.Config = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPITestResultFullCheck) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["config"] = o.Config - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPITestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Config *SyntheticsTestConfig `json:"config"` - }{} - all := struct { - Config SyntheticsTestConfig `json:"config"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Config == nil { - return fmt.Errorf("Required field config missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Config = all.Config - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_result_short.go b/api/v1/datadog/model_synthetics_api_test_result_short.go deleted file mode 100644 index b6111b4c707..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_result_short.go +++ /dev/null @@ -1,276 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsAPITestResultShort Object with the results of a single Synthetic API test. -type SyntheticsAPITestResultShort struct { - // Last time the API test was performed. - CheckTime *float64 `json:"check_time,omitempty"` - // Location from which the API test was performed. - ProbeDc *string `json:"probe_dc,omitempty"` - // Result of the last API test run. - Result *SyntheticsAPITestResultShortResult `json:"result,omitempty"` - // ID of the API test result. - ResultId *string `json:"result_id,omitempty"` - // The status of your Synthetic monitor. - // * `O` for not triggered - // * `1` for triggered - // * `2` for no data - Status *SyntheticsTestMonitorStatus `json:"status,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{} -} - -// NewSyntheticsAPITestResultShort instantiates a new SyntheticsAPITestResultShort 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 NewSyntheticsAPITestResultShort() *SyntheticsAPITestResultShort { - this := SyntheticsAPITestResultShort{} - return &this -} - -// NewSyntheticsAPITestResultShortWithDefaults instantiates a new SyntheticsAPITestResultShort 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 NewSyntheticsAPITestResultShortWithDefaults() *SyntheticsAPITestResultShort { - this := SyntheticsAPITestResultShort{} - return &this -} - -// GetCheckTime returns the CheckTime field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultShort) GetCheckTime() float64 { - if o == nil || o.CheckTime == nil { - var ret float64 - return ret - } - return *o.CheckTime -} - -// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultShort) GetCheckTimeOk() (*float64, bool) { - if o == nil || o.CheckTime == nil { - return nil, false - } - return o.CheckTime, true -} - -// HasCheckTime returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultShort) HasCheckTime() bool { - if o != nil && o.CheckTime != nil { - return true - } - - return false -} - -// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. -func (o *SyntheticsAPITestResultShort) SetCheckTime(v float64) { - o.CheckTime = &v -} - -// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultShort) GetProbeDc() string { - if o == nil || o.ProbeDc == nil { - var ret string - return ret - } - return *o.ProbeDc -} - -// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultShort) GetProbeDcOk() (*string, bool) { - if o == nil || o.ProbeDc == nil { - return nil, false - } - return o.ProbeDc, true -} - -// HasProbeDc returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultShort) HasProbeDc() bool { - if o != nil && o.ProbeDc != nil { - return true - } - - return false -} - -// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. -func (o *SyntheticsAPITestResultShort) SetProbeDc(v string) { - o.ProbeDc = &v -} - -// GetResult returns the Result field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultShort) GetResult() SyntheticsAPITestResultShortResult { - if o == nil || o.Result == nil { - var ret SyntheticsAPITestResultShortResult - return ret - } - return *o.Result -} - -// GetResultOk returns a tuple with the Result field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultShort) GetResultOk() (*SyntheticsAPITestResultShortResult, bool) { - if o == nil || o.Result == nil { - return nil, false - } - return o.Result, true -} - -// HasResult returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultShort) HasResult() bool { - if o != nil && o.Result != nil { - return true - } - - return false -} - -// SetResult gets a reference to the given SyntheticsAPITestResultShortResult and assigns it to the Result field. -func (o *SyntheticsAPITestResultShort) SetResult(v SyntheticsAPITestResultShortResult) { - o.Result = &v -} - -// GetResultId returns the ResultId field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultShort) GetResultId() string { - if o == nil || o.ResultId == nil { - var ret string - return ret - } - return *o.ResultId -} - -// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultShort) GetResultIdOk() (*string, bool) { - if o == nil || o.ResultId == nil { - return nil, false - } - return o.ResultId, true -} - -// HasResultId returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultShort) HasResultId() bool { - if o != nil && o.ResultId != nil { - return true - } - - return false -} - -// SetResultId gets a reference to the given string and assigns it to the ResultId field. -func (o *SyntheticsAPITestResultShort) SetResultId(v string) { - o.ResultId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultShort) GetStatus() SyntheticsTestMonitorStatus { - if o == nil || o.Status == nil { - var ret SyntheticsTestMonitorStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultShort) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultShort) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. -func (o *SyntheticsAPITestResultShort) SetStatus(v SyntheticsTestMonitorStatus) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPITestResultShort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CheckTime != nil { - toSerialize["check_time"] = o.CheckTime - } - if o.ProbeDc != nil { - toSerialize["probe_dc"] = o.ProbeDc - } - if o.Result != nil { - toSerialize["result"] = o.Result - } - if o.ResultId != nil { - toSerialize["result_id"] = o.ResultId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPITestResultShort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CheckTime *float64 `json:"check_time,omitempty"` - ProbeDc *string `json:"probe_dc,omitempty"` - Result *SyntheticsAPITestResultShortResult `json:"result,omitempty"` - ResultId *string `json:"result_id,omitempty"` - Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CheckTime = all.CheckTime - o.ProbeDc = all.ProbeDc - if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Result = all.Result - o.ResultId = all.ResultId - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_result_short_result.go b/api/v1/datadog/model_synthetics_api_test_result_short_result.go deleted file mode 100644 index 21149cc07ef..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_result_short_result.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsAPITestResultShortResult Result of the last API test run. -type SyntheticsAPITestResultShortResult struct { - // Describes if the test run has passed or failed. - Passed *bool `json:"passed,omitempty"` - // Object containing all metrics and their values collected for a Synthetic API test. - // Learn more about those metrics in [Synthetics documentation](https://docs.datadoghq.com/synthetics/#metrics). - Timings *SyntheticsTiming `json:"timings,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{} -} - -// NewSyntheticsAPITestResultShortResult instantiates a new SyntheticsAPITestResultShortResult 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 NewSyntheticsAPITestResultShortResult() *SyntheticsAPITestResultShortResult { - this := SyntheticsAPITestResultShortResult{} - return &this -} - -// NewSyntheticsAPITestResultShortResultWithDefaults instantiates a new SyntheticsAPITestResultShortResult 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 NewSyntheticsAPITestResultShortResultWithDefaults() *SyntheticsAPITestResultShortResult { - this := SyntheticsAPITestResultShortResult{} - return &this -} - -// GetPassed returns the Passed field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultShortResult) GetPassed() bool { - if o == nil || o.Passed == nil { - var ret bool - return ret - } - return *o.Passed -} - -// GetPassedOk returns a tuple with the Passed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultShortResult) GetPassedOk() (*bool, bool) { - if o == nil || o.Passed == nil { - return nil, false - } - return o.Passed, true -} - -// HasPassed returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultShortResult) HasPassed() bool { - if o != nil && o.Passed != nil { - return true - } - - return false -} - -// SetPassed gets a reference to the given bool and assigns it to the Passed field. -func (o *SyntheticsAPITestResultShortResult) SetPassed(v bool) { - o.Passed = &v -} - -// GetTimings returns the Timings field value if set, zero value otherwise. -func (o *SyntheticsAPITestResultShortResult) GetTimings() SyntheticsTiming { - if o == nil || o.Timings == nil { - var ret SyntheticsTiming - return ret - } - return *o.Timings -} - -// GetTimingsOk returns a tuple with the Timings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAPITestResultShortResult) GetTimingsOk() (*SyntheticsTiming, bool) { - if o == nil || o.Timings == nil { - return nil, false - } - return o.Timings, true -} - -// HasTimings returns a boolean if a field has been set. -func (o *SyntheticsAPITestResultShortResult) HasTimings() bool { - if o != nil && o.Timings != nil { - return true - } - - return false -} - -// SetTimings gets a reference to the given SyntheticsTiming and assigns it to the Timings field. -func (o *SyntheticsAPITestResultShortResult) SetTimings(v SyntheticsTiming) { - o.Timings = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAPITestResultShortResult) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Passed != nil { - toSerialize["passed"] = o.Passed - } - if o.Timings != nil { - toSerialize["timings"] = o.Timings - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAPITestResultShortResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Passed *bool `json:"passed,omitempty"` - Timings *SyntheticsTiming `json:"timings,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Passed = all.Passed - if all.Timings != nil && all.Timings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Timings = all.Timings - return nil -} diff --git a/api/v1/datadog/model_synthetics_api_test_type.go b/api/v1/datadog/model_synthetics_api_test_type.go deleted file mode 100644 index 3a70ccfcd9c..00000000000 --- a/api/v1/datadog/model_synthetics_api_test_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAPITestType Type of the Synthetic test, `api`. -type SyntheticsAPITestType string - -// List of SyntheticsAPITestType. -const ( - SYNTHETICSAPITESTTYPE_API SyntheticsAPITestType = "api" -) - -var allowedSyntheticsAPITestTypeEnumValues = []SyntheticsAPITestType{ - SYNTHETICSAPITESTTYPE_API, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsAPITestType) GetAllowedValues() []SyntheticsAPITestType { - return allowedSyntheticsAPITestTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsAPITestType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsAPITestType(value) - return nil -} - -// NewSyntheticsAPITestTypeFromValue returns a pointer to a valid SyntheticsAPITestType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsAPITestTypeFromValue(v string) (*SyntheticsAPITestType, error) { - ev := SyntheticsAPITestType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsAPITestType: valid values are %v", v, allowedSyntheticsAPITestTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsAPITestType) IsValid() bool { - for _, existing := range allowedSyntheticsAPITestTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsAPITestType value. -func (v SyntheticsAPITestType) Ptr() *SyntheticsAPITestType { - return &v -} - -// NullableSyntheticsAPITestType handles when a null is used for SyntheticsAPITestType. -type NullableSyntheticsAPITestType struct { - value *SyntheticsAPITestType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAPITestType) Get() *SyntheticsAPITestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAPITestType) Set(val *SyntheticsAPITestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAPITestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAPITestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAPITestType initializes the struct as if Set has been called. -func NewNullableSyntheticsAPITestType(val *SyntheticsAPITestType) *NullableSyntheticsAPITestType { - return &NullableSyntheticsAPITestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAPITestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAPITestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_assertion.go b/api/v1/datadog/model_synthetics_assertion.go deleted file mode 100644 index 6272d78d42c..00000000000 --- a/api/v1/datadog/model_synthetics_assertion.go +++ /dev/null @@ -1,156 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsAssertion - Object describing the assertions type, their associated operator, -// which property they apply, and upon which target. -type SyntheticsAssertion struct { - SyntheticsAssertionTarget *SyntheticsAssertionTarget - SyntheticsAssertionJSONPathTarget *SyntheticsAssertionJSONPathTarget - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// SyntheticsAssertionTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionTarget wrapped in SyntheticsAssertion. -func SyntheticsAssertionTargetAsSyntheticsAssertion(v *SyntheticsAssertionTarget) SyntheticsAssertion { - return SyntheticsAssertion{SyntheticsAssertionTarget: v} -} - -// SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionJSONPathTarget wrapped in SyntheticsAssertion. -func SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion(v *SyntheticsAssertionJSONPathTarget) SyntheticsAssertion { - return SyntheticsAssertion{SyntheticsAssertionJSONPathTarget: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into SyntheticsAssertionTarget - err = json.Unmarshal(data, &obj.SyntheticsAssertionTarget) - if err == nil { - if obj.SyntheticsAssertionTarget != nil && obj.SyntheticsAssertionTarget.UnparsedObject == nil { - jsonSyntheticsAssertionTarget, _ := json.Marshal(obj.SyntheticsAssertionTarget) - if string(jsonSyntheticsAssertionTarget) == "{}" { // empty struct - obj.SyntheticsAssertionTarget = nil - } else { - match++ - } - } else { - obj.SyntheticsAssertionTarget = nil - } - } else { - obj.SyntheticsAssertionTarget = nil - } - - // try to unmarshal data into SyntheticsAssertionJSONPathTarget - err = json.Unmarshal(data, &obj.SyntheticsAssertionJSONPathTarget) - if err == nil { - if obj.SyntheticsAssertionJSONPathTarget != nil && obj.SyntheticsAssertionJSONPathTarget.UnparsedObject == nil { - jsonSyntheticsAssertionJSONPathTarget, _ := json.Marshal(obj.SyntheticsAssertionJSONPathTarget) - if string(jsonSyntheticsAssertionJSONPathTarget) == "{}" { // empty struct - obj.SyntheticsAssertionJSONPathTarget = nil - } else { - match++ - } - } else { - obj.SyntheticsAssertionJSONPathTarget = nil - } - } else { - obj.SyntheticsAssertionJSONPathTarget = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.SyntheticsAssertionTarget = nil - obj.SyntheticsAssertionJSONPathTarget = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj SyntheticsAssertion) MarshalJSON() ([]byte, error) { - if obj.SyntheticsAssertionTarget != nil { - return json.Marshal(&obj.SyntheticsAssertionTarget) - } - - if obj.SyntheticsAssertionJSONPathTarget != nil { - return json.Marshal(&obj.SyntheticsAssertionJSONPathTarget) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *SyntheticsAssertion) GetActualInstance() interface{} { - if obj.SyntheticsAssertionTarget != nil { - return obj.SyntheticsAssertionTarget - } - - if obj.SyntheticsAssertionJSONPathTarget != nil { - return obj.SyntheticsAssertionJSONPathTarget - } - - // all schemas are nil - return nil -} - -// NullableSyntheticsAssertion handles when a null is used for SyntheticsAssertion. -type NullableSyntheticsAssertion struct { - value *SyntheticsAssertion - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertion) Get() *SyntheticsAssertion { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertion) Set(val *SyntheticsAssertion) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertion) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSyntheticsAssertion) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertion initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertion(val *SyntheticsAssertion) *NullableSyntheticsAssertion { - return &NullableSyntheticsAssertion{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertion) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertion) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_assertion_json_path_operator.go b/api/v1/datadog/model_synthetics_assertion_json_path_operator.go deleted file mode 100644 index 83742b5e642..00000000000 --- a/api/v1/datadog/model_synthetics_assertion_json_path_operator.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAssertionJSONPathOperator Assertion operator to apply. -type SyntheticsAssertionJSONPathOperator string - -// List of SyntheticsAssertionJSONPathOperator. -const ( - SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH SyntheticsAssertionJSONPathOperator = "validatesJSONPath" -) - -var allowedSyntheticsAssertionJSONPathOperatorEnumValues = []SyntheticsAssertionJSONPathOperator{ - SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsAssertionJSONPathOperator) GetAllowedValues() []SyntheticsAssertionJSONPathOperator { - return allowedSyntheticsAssertionJSONPathOperatorEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsAssertionJSONPathOperator) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsAssertionJSONPathOperator(value) - return nil -} - -// NewSyntheticsAssertionJSONPathOperatorFromValue returns a pointer to a valid SyntheticsAssertionJSONPathOperator -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsAssertionJSONPathOperatorFromValue(v string) (*SyntheticsAssertionJSONPathOperator, error) { - ev := SyntheticsAssertionJSONPathOperator(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionJSONPathOperator: valid values are %v", v, allowedSyntheticsAssertionJSONPathOperatorEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsAssertionJSONPathOperator) IsValid() bool { - for _, existing := range allowedSyntheticsAssertionJSONPathOperatorEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsAssertionJSONPathOperator value. -func (v SyntheticsAssertionJSONPathOperator) Ptr() *SyntheticsAssertionJSONPathOperator { - return &v -} - -// NullableSyntheticsAssertionJSONPathOperator handles when a null is used for SyntheticsAssertionJSONPathOperator. -type NullableSyntheticsAssertionJSONPathOperator struct { - value *SyntheticsAssertionJSONPathOperator - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertionJSONPathOperator) Get() *SyntheticsAssertionJSONPathOperator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertionJSONPathOperator) Set(val *SyntheticsAssertionJSONPathOperator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertionJSONPathOperator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAssertionJSONPathOperator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertionJSONPathOperator initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertionJSONPathOperator(val *SyntheticsAssertionJSONPathOperator) *NullableSyntheticsAssertionJSONPathOperator { - return &NullableSyntheticsAssertionJSONPathOperator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertionJSONPathOperator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertionJSONPathOperator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_assertion_json_path_target.go b/api/v1/datadog/model_synthetics_assertion_json_path_target.go deleted file mode 100644 index 2bc20041396..00000000000 --- a/api/v1/datadog/model_synthetics_assertion_json_path_target.go +++ /dev/null @@ -1,237 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAssertionJSONPathTarget An assertion for the `validatesJSONPath` operator. -type SyntheticsAssertionJSONPathTarget struct { - // Assertion operator to apply. - Operator SyntheticsAssertionJSONPathOperator `json:"operator"` - // The associated assertion property. - Property *string `json:"property,omitempty"` - // Composed target for `validatesJSONPath` operator. - Target *SyntheticsAssertionJSONPathTargetTarget `json:"target,omitempty"` - // Type of the assertion. - Type SyntheticsAssertionType `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{} -} - -// NewSyntheticsAssertionJSONPathTarget instantiates a new SyntheticsAssertionJSONPathTarget 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 NewSyntheticsAssertionJSONPathTarget(operator SyntheticsAssertionJSONPathOperator, typeVar SyntheticsAssertionType) *SyntheticsAssertionJSONPathTarget { - this := SyntheticsAssertionJSONPathTarget{} - this.Operator = operator - this.Type = typeVar - return &this -} - -// NewSyntheticsAssertionJSONPathTargetWithDefaults instantiates a new SyntheticsAssertionJSONPathTarget 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 NewSyntheticsAssertionJSONPathTargetWithDefaults() *SyntheticsAssertionJSONPathTarget { - this := SyntheticsAssertionJSONPathTarget{} - return &this -} - -// GetOperator returns the Operator field value. -func (o *SyntheticsAssertionJSONPathTarget) GetOperator() SyntheticsAssertionJSONPathOperator { - if o == nil { - var ret SyntheticsAssertionJSONPathOperator - return ret - } - return o.Operator -} - -// GetOperatorOk returns a tuple with the Operator field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionJSONPathTarget) GetOperatorOk() (*SyntheticsAssertionJSONPathOperator, bool) { - if o == nil { - return nil, false - } - return &o.Operator, true -} - -// SetOperator sets field value. -func (o *SyntheticsAssertionJSONPathTarget) SetOperator(v SyntheticsAssertionJSONPathOperator) { - o.Operator = v -} - -// GetProperty returns the Property field value if set, zero value otherwise. -func (o *SyntheticsAssertionJSONPathTarget) GetProperty() string { - if o == nil || o.Property == nil { - var ret string - return ret - } - return *o.Property -} - -// GetPropertyOk returns a tuple with the Property field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionJSONPathTarget) GetPropertyOk() (*string, bool) { - if o == nil || o.Property == nil { - return nil, false - } - return o.Property, true -} - -// HasProperty returns a boolean if a field has been set. -func (o *SyntheticsAssertionJSONPathTarget) HasProperty() bool { - if o != nil && o.Property != nil { - return true - } - - return false -} - -// SetProperty gets a reference to the given string and assigns it to the Property field. -func (o *SyntheticsAssertionJSONPathTarget) SetProperty(v string) { - o.Property = &v -} - -// GetTarget returns the Target field value if set, zero value otherwise. -func (o *SyntheticsAssertionJSONPathTarget) GetTarget() SyntheticsAssertionJSONPathTargetTarget { - if o == nil || o.Target == nil { - var ret SyntheticsAssertionJSONPathTargetTarget - return ret - } - return *o.Target -} - -// GetTargetOk returns a tuple with the Target field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionJSONPathTarget) GetTargetOk() (*SyntheticsAssertionJSONPathTargetTarget, bool) { - if o == nil || o.Target == nil { - return nil, false - } - return o.Target, true -} - -// HasTarget returns a boolean if a field has been set. -func (o *SyntheticsAssertionJSONPathTarget) HasTarget() bool { - if o != nil && o.Target != nil { - return true - } - - return false -} - -// SetTarget gets a reference to the given SyntheticsAssertionJSONPathTargetTarget and assigns it to the Target field. -func (o *SyntheticsAssertionJSONPathTarget) SetTarget(v SyntheticsAssertionJSONPathTargetTarget) { - o.Target = &v -} - -// GetType returns the Type field value. -func (o *SyntheticsAssertionJSONPathTarget) GetType() SyntheticsAssertionType { - if o == nil { - var ret SyntheticsAssertionType - 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 *SyntheticsAssertionJSONPathTarget) GetTypeOk() (*SyntheticsAssertionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsAssertionJSONPathTarget) SetType(v SyntheticsAssertionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAssertionJSONPathTarget) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["operator"] = o.Operator - if o.Property != nil { - toSerialize["property"] = o.Property - } - if o.Target != nil { - toSerialize["target"] = o.Target - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Operator *SyntheticsAssertionJSONPathOperator `json:"operator"` - Type *SyntheticsAssertionType `json:"type"` - }{} - all := struct { - Operator SyntheticsAssertionJSONPathOperator `json:"operator"` - Property *string `json:"property,omitempty"` - Target *SyntheticsAssertionJSONPathTargetTarget `json:"target,omitempty"` - Type SyntheticsAssertionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Operator == nil { - return fmt.Errorf("Required field operator missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Operator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Operator = all.Operator - o.Property = all.Property - if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_assertion_json_path_target_target.go b/api/v1/datadog/model_synthetics_assertion_json_path_target_target.go deleted file mode 100644 index 0381c430024..00000000000 --- a/api/v1/datadog/model_synthetics_assertion_json_path_target_target.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsAssertionJSONPathTargetTarget Composed target for `validatesJSONPath` operator. -type SyntheticsAssertionJSONPathTargetTarget struct { - // The JSON path to assert. - JsonPath *string `json:"jsonPath,omitempty"` - // The specific operator to use on the path. - Operator *string `json:"operator,omitempty"` - // The path target value to compare to. - TargetValue interface{} `json:"targetValue,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{} -} - -// NewSyntheticsAssertionJSONPathTargetTarget instantiates a new SyntheticsAssertionJSONPathTargetTarget 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 NewSyntheticsAssertionJSONPathTargetTarget() *SyntheticsAssertionJSONPathTargetTarget { - this := SyntheticsAssertionJSONPathTargetTarget{} - return &this -} - -// NewSyntheticsAssertionJSONPathTargetTargetWithDefaults instantiates a new SyntheticsAssertionJSONPathTargetTarget 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 NewSyntheticsAssertionJSONPathTargetTargetWithDefaults() *SyntheticsAssertionJSONPathTargetTarget { - this := SyntheticsAssertionJSONPathTargetTarget{} - return &this -} - -// GetJsonPath returns the JsonPath field value if set, zero value otherwise. -func (o *SyntheticsAssertionJSONPathTargetTarget) GetJsonPath() string { - if o == nil || o.JsonPath == nil { - var ret string - return ret - } - return *o.JsonPath -} - -// GetJsonPathOk returns a tuple with the JsonPath field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionJSONPathTargetTarget) GetJsonPathOk() (*string, bool) { - if o == nil || o.JsonPath == nil { - return nil, false - } - return o.JsonPath, true -} - -// HasJsonPath returns a boolean if a field has been set. -func (o *SyntheticsAssertionJSONPathTargetTarget) HasJsonPath() bool { - if o != nil && o.JsonPath != nil { - return true - } - - return false -} - -// SetJsonPath gets a reference to the given string and assigns it to the JsonPath field. -func (o *SyntheticsAssertionJSONPathTargetTarget) SetJsonPath(v string) { - o.JsonPath = &v -} - -// GetOperator returns the Operator field value if set, zero value otherwise. -func (o *SyntheticsAssertionJSONPathTargetTarget) GetOperator() string { - if o == nil || o.Operator == nil { - var ret string - return ret - } - return *o.Operator -} - -// GetOperatorOk returns a tuple with the Operator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionJSONPathTargetTarget) GetOperatorOk() (*string, bool) { - if o == nil || o.Operator == nil { - return nil, false - } - return o.Operator, true -} - -// HasOperator returns a boolean if a field has been set. -func (o *SyntheticsAssertionJSONPathTargetTarget) HasOperator() bool { - if o != nil && o.Operator != nil { - return true - } - - return false -} - -// SetOperator gets a reference to the given string and assigns it to the Operator field. -func (o *SyntheticsAssertionJSONPathTargetTarget) SetOperator(v string) { - o.Operator = &v -} - -// GetTargetValue returns the TargetValue field value if set, zero value otherwise. -func (o *SyntheticsAssertionJSONPathTargetTarget) GetTargetValue() interface{} { - if o == nil || o.TargetValue == nil { - var ret interface{} - return ret - } - return o.TargetValue -} - -// GetTargetValueOk returns a tuple with the TargetValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionJSONPathTargetTarget) GetTargetValueOk() (*interface{}, bool) { - if o == nil || o.TargetValue == nil { - return nil, false - } - return &o.TargetValue, true -} - -// HasTargetValue returns a boolean if a field has been set. -func (o *SyntheticsAssertionJSONPathTargetTarget) HasTargetValue() bool { - if o != nil && o.TargetValue != nil { - return true - } - - return false -} - -// SetTargetValue gets a reference to the given interface{} and assigns it to the TargetValue field. -func (o *SyntheticsAssertionJSONPathTargetTarget) SetTargetValue(v interface{}) { - o.TargetValue = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAssertionJSONPathTargetTarget) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.JsonPath != nil { - toSerialize["jsonPath"] = o.JsonPath - } - if o.Operator != nil { - toSerialize["operator"] = o.Operator - } - if o.TargetValue != nil { - toSerialize["targetValue"] = o.TargetValue - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAssertionJSONPathTargetTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - JsonPath *string `json:"jsonPath,omitempty"` - Operator *string `json:"operator,omitempty"` - TargetValue interface{} `json:"targetValue,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.JsonPath = all.JsonPath - o.Operator = all.Operator - o.TargetValue = all.TargetValue - return nil -} diff --git a/api/v1/datadog/model_synthetics_assertion_operator.go b/api/v1/datadog/model_synthetics_assertion_operator.go deleted file mode 100644 index e4339657304..00000000000 --- a/api/v1/datadog/model_synthetics_assertion_operator.go +++ /dev/null @@ -1,131 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAssertionOperator Assertion operator to apply. -type SyntheticsAssertionOperator string - -// List of SyntheticsAssertionOperator. -const ( - SYNTHETICSASSERTIONOPERATOR_CONTAINS SyntheticsAssertionOperator = "contains" - SYNTHETICSASSERTIONOPERATOR_DOES_NOT_CONTAIN SyntheticsAssertionOperator = "doesNotContain" - SYNTHETICSASSERTIONOPERATOR_IS SyntheticsAssertionOperator = "is" - SYNTHETICSASSERTIONOPERATOR_IS_NOT SyntheticsAssertionOperator = "isNot" - SYNTHETICSASSERTIONOPERATOR_LESS_THAN SyntheticsAssertionOperator = "lessThan" - SYNTHETICSASSERTIONOPERATOR_LESS_THAN_OR_EQUAL SyntheticsAssertionOperator = "lessThanOrEqual" - SYNTHETICSASSERTIONOPERATOR_MORE_THAN SyntheticsAssertionOperator = "moreThan" - SYNTHETICSASSERTIONOPERATOR_MORE_THAN_OR_EQUAL SyntheticsAssertionOperator = "moreThanOrEqual" - SYNTHETICSASSERTIONOPERATOR_MATCHES SyntheticsAssertionOperator = "matches" - SYNTHETICSASSERTIONOPERATOR_DOES_NOT_MATCH SyntheticsAssertionOperator = "doesNotMatch" - SYNTHETICSASSERTIONOPERATOR_VALIDATES SyntheticsAssertionOperator = "validates" - SYNTHETICSASSERTIONOPERATOR_IS_IN_MORE_DAYS_THAN SyntheticsAssertionOperator = "isInMoreThan" - SYNTHETICSASSERTIONOPERATOR_IS_IN_LESS_DAYS_THAN SyntheticsAssertionOperator = "isInLessThan" -) - -var allowedSyntheticsAssertionOperatorEnumValues = []SyntheticsAssertionOperator{ - SYNTHETICSASSERTIONOPERATOR_CONTAINS, - SYNTHETICSASSERTIONOPERATOR_DOES_NOT_CONTAIN, - SYNTHETICSASSERTIONOPERATOR_IS, - SYNTHETICSASSERTIONOPERATOR_IS_NOT, - SYNTHETICSASSERTIONOPERATOR_LESS_THAN, - SYNTHETICSASSERTIONOPERATOR_LESS_THAN_OR_EQUAL, - SYNTHETICSASSERTIONOPERATOR_MORE_THAN, - SYNTHETICSASSERTIONOPERATOR_MORE_THAN_OR_EQUAL, - SYNTHETICSASSERTIONOPERATOR_MATCHES, - SYNTHETICSASSERTIONOPERATOR_DOES_NOT_MATCH, - SYNTHETICSASSERTIONOPERATOR_VALIDATES, - SYNTHETICSASSERTIONOPERATOR_IS_IN_MORE_DAYS_THAN, - SYNTHETICSASSERTIONOPERATOR_IS_IN_LESS_DAYS_THAN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsAssertionOperator) GetAllowedValues() []SyntheticsAssertionOperator { - return allowedSyntheticsAssertionOperatorEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsAssertionOperator) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsAssertionOperator(value) - return nil -} - -// NewSyntheticsAssertionOperatorFromValue returns a pointer to a valid SyntheticsAssertionOperator -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsAssertionOperatorFromValue(v string) (*SyntheticsAssertionOperator, error) { - ev := SyntheticsAssertionOperator(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionOperator: valid values are %v", v, allowedSyntheticsAssertionOperatorEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsAssertionOperator) IsValid() bool { - for _, existing := range allowedSyntheticsAssertionOperatorEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsAssertionOperator value. -func (v SyntheticsAssertionOperator) Ptr() *SyntheticsAssertionOperator { - return &v -} - -// NullableSyntheticsAssertionOperator handles when a null is used for SyntheticsAssertionOperator. -type NullableSyntheticsAssertionOperator struct { - value *SyntheticsAssertionOperator - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertionOperator) Get() *SyntheticsAssertionOperator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertionOperator) Set(val *SyntheticsAssertionOperator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertionOperator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAssertionOperator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertionOperator initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertionOperator(val *SyntheticsAssertionOperator) *NullableSyntheticsAssertionOperator { - return &NullableSyntheticsAssertionOperator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertionOperator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertionOperator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_assertion_target.go b/api/v1/datadog/model_synthetics_assertion_target.go deleted file mode 100644 index cee6dee2b02..00000000000 --- a/api/v1/datadog/model_synthetics_assertion_target.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAssertionTarget An assertion which uses a simple target. -type SyntheticsAssertionTarget struct { - // Assertion operator to apply. - Operator SyntheticsAssertionOperator `json:"operator"` - // The associated assertion property. - Property *string `json:"property,omitempty"` - // Value used by the operator. - Target interface{} `json:"target"` - // Type of the assertion. - Type SyntheticsAssertionType `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{} -} - -// NewSyntheticsAssertionTarget instantiates a new SyntheticsAssertionTarget 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 NewSyntheticsAssertionTarget(operator SyntheticsAssertionOperator, target interface{}, typeVar SyntheticsAssertionType) *SyntheticsAssertionTarget { - this := SyntheticsAssertionTarget{} - this.Operator = operator - this.Target = target - this.Type = typeVar - return &this -} - -// NewSyntheticsAssertionTargetWithDefaults instantiates a new SyntheticsAssertionTarget 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 NewSyntheticsAssertionTargetWithDefaults() *SyntheticsAssertionTarget { - this := SyntheticsAssertionTarget{} - return &this -} - -// GetOperator returns the Operator field value. -func (o *SyntheticsAssertionTarget) GetOperator() SyntheticsAssertionOperator { - if o == nil { - var ret SyntheticsAssertionOperator - return ret - } - return o.Operator -} - -// GetOperatorOk returns a tuple with the Operator field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionTarget) GetOperatorOk() (*SyntheticsAssertionOperator, bool) { - if o == nil { - return nil, false - } - return &o.Operator, true -} - -// SetOperator sets field value. -func (o *SyntheticsAssertionTarget) SetOperator(v SyntheticsAssertionOperator) { - o.Operator = v -} - -// GetProperty returns the Property field value if set, zero value otherwise. -func (o *SyntheticsAssertionTarget) GetProperty() string { - if o == nil || o.Property == nil { - var ret string - return ret - } - return *o.Property -} - -// GetPropertyOk returns a tuple with the Property field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionTarget) GetPropertyOk() (*string, bool) { - if o == nil || o.Property == nil { - return nil, false - } - return o.Property, true -} - -// HasProperty returns a boolean if a field has been set. -func (o *SyntheticsAssertionTarget) HasProperty() bool { - if o != nil && o.Property != nil { - return true - } - - return false -} - -// SetProperty gets a reference to the given string and assigns it to the Property field. -func (o *SyntheticsAssertionTarget) SetProperty(v string) { - o.Property = &v -} - -// GetTarget returns the Target field value. -func (o *SyntheticsAssertionTarget) GetTarget() interface{} { - if o == nil { - var ret interface{} - return ret - } - return o.Target -} - -// GetTargetOk returns a tuple with the Target field value -// and a boolean to check if the value has been set. -func (o *SyntheticsAssertionTarget) GetTargetOk() (*interface{}, bool) { - if o == nil { - return nil, false - } - return &o.Target, true -} - -// SetTarget sets field value. -func (o *SyntheticsAssertionTarget) SetTarget(v interface{}) { - o.Target = v -} - -// GetType returns the Type field value. -func (o *SyntheticsAssertionTarget) GetType() SyntheticsAssertionType { - if o == nil { - var ret SyntheticsAssertionType - 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 *SyntheticsAssertionTarget) GetTypeOk() (*SyntheticsAssertionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsAssertionTarget) SetType(v SyntheticsAssertionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsAssertionTarget) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["operator"] = o.Operator - if o.Property != nil { - toSerialize["property"] = o.Property - } - toSerialize["target"] = o.Target - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Operator *SyntheticsAssertionOperator `json:"operator"` - Target *interface{} `json:"target"` - Type *SyntheticsAssertionType `json:"type"` - }{} - all := struct { - Operator SyntheticsAssertionOperator `json:"operator"` - Property *string `json:"property,omitempty"` - Target interface{} `json:"target"` - Type SyntheticsAssertionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Operator == nil { - return fmt.Errorf("Required field operator missing") - } - if required.Target == nil { - return fmt.Errorf("Required field target missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Operator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Operator = all.Operator - o.Property = all.Property - o.Target = all.Target - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_assertion_type.go b/api/v1/datadog/model_synthetics_assertion_type.go deleted file mode 100644 index 5499a2dfb4a..00000000000 --- a/api/v1/datadog/model_synthetics_assertion_type.go +++ /dev/null @@ -1,139 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsAssertionType Type of the assertion. -type SyntheticsAssertionType string - -// List of SyntheticsAssertionType. -const ( - SYNTHETICSASSERTIONTYPE_BODY SyntheticsAssertionType = "body" - SYNTHETICSASSERTIONTYPE_HEADER SyntheticsAssertionType = "header" - SYNTHETICSASSERTIONTYPE_STATUS_CODE SyntheticsAssertionType = "statusCode" - SYNTHETICSASSERTIONTYPE_CERTIFICATE SyntheticsAssertionType = "certificate" - SYNTHETICSASSERTIONTYPE_RESPONSE_TIME SyntheticsAssertionType = "responseTime" - SYNTHETICSASSERTIONTYPE_PROPERTY SyntheticsAssertionType = "property" - SYNTHETICSASSERTIONTYPE_RECORD_EVERY SyntheticsAssertionType = "recordEvery" - SYNTHETICSASSERTIONTYPE_RECORD_SOME SyntheticsAssertionType = "recordSome" - SYNTHETICSASSERTIONTYPE_TLS_VERSION SyntheticsAssertionType = "tlsVersion" - SYNTHETICSASSERTIONTYPE_MIN_TLS_VERSION SyntheticsAssertionType = "minTlsVersion" - SYNTHETICSASSERTIONTYPE_LATENCY SyntheticsAssertionType = "latency" - SYNTHETICSASSERTIONTYPE_PACKET_LOSS_PERCENTAGE SyntheticsAssertionType = "packetLossPercentage" - SYNTHETICSASSERTIONTYPE_PACKETS_RECEIVED SyntheticsAssertionType = "packetsReceived" - SYNTHETICSASSERTIONTYPE_NETWORK_HOP SyntheticsAssertionType = "networkHop" - SYNTHETICSASSERTIONTYPE_RECEIVED_MESSAGE SyntheticsAssertionType = "receivedMessage" - SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS SyntheticsAssertionType = "grpcHealthcheckStatus" - SYNTHETICSASSERTIONTYPE_CONNECTION SyntheticsAssertionType = "connection" -) - -var allowedSyntheticsAssertionTypeEnumValues = []SyntheticsAssertionType{ - SYNTHETICSASSERTIONTYPE_BODY, - SYNTHETICSASSERTIONTYPE_HEADER, - SYNTHETICSASSERTIONTYPE_STATUS_CODE, - SYNTHETICSASSERTIONTYPE_CERTIFICATE, - SYNTHETICSASSERTIONTYPE_RESPONSE_TIME, - SYNTHETICSASSERTIONTYPE_PROPERTY, - SYNTHETICSASSERTIONTYPE_RECORD_EVERY, - SYNTHETICSASSERTIONTYPE_RECORD_SOME, - SYNTHETICSASSERTIONTYPE_TLS_VERSION, - SYNTHETICSASSERTIONTYPE_MIN_TLS_VERSION, - SYNTHETICSASSERTIONTYPE_LATENCY, - SYNTHETICSASSERTIONTYPE_PACKET_LOSS_PERCENTAGE, - SYNTHETICSASSERTIONTYPE_PACKETS_RECEIVED, - SYNTHETICSASSERTIONTYPE_NETWORK_HOP, - SYNTHETICSASSERTIONTYPE_RECEIVED_MESSAGE, - SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS, - SYNTHETICSASSERTIONTYPE_CONNECTION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsAssertionType) GetAllowedValues() []SyntheticsAssertionType { - return allowedSyntheticsAssertionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsAssertionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsAssertionType(value) - return nil -} - -// NewSyntheticsAssertionTypeFromValue returns a pointer to a valid SyntheticsAssertionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsAssertionTypeFromValue(v string) (*SyntheticsAssertionType, error) { - ev := SyntheticsAssertionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionType: valid values are %v", v, allowedSyntheticsAssertionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsAssertionType) IsValid() bool { - for _, existing := range allowedSyntheticsAssertionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsAssertionType value. -func (v SyntheticsAssertionType) Ptr() *SyntheticsAssertionType { - return &v -} - -// NullableSyntheticsAssertionType handles when a null is used for SyntheticsAssertionType. -type NullableSyntheticsAssertionType struct { - value *SyntheticsAssertionType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsAssertionType) Get() *SyntheticsAssertionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsAssertionType) Set(val *SyntheticsAssertionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsAssertionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsAssertionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsAssertionType initializes the struct as if Set has been called. -func NewNullableSyntheticsAssertionType(val *SyntheticsAssertionType) *NullableSyntheticsAssertionType { - return &NullableSyntheticsAssertionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsAssertionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsAssertionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_basic_auth.go b/api/v1/datadog/model_synthetics_basic_auth.go deleted file mode 100644 index f45be6c5a5e..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBasicAuth - Object to handle basic authentication when performing the test. -type SyntheticsBasicAuth struct { - SyntheticsBasicAuthWeb *SyntheticsBasicAuthWeb - SyntheticsBasicAuthSigv4 *SyntheticsBasicAuthSigv4 - SyntheticsBasicAuthNTLM *SyntheticsBasicAuthNTLM - SyntheticsBasicAuthDigest *SyntheticsBasicAuthDigest - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// SyntheticsBasicAuthWebAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthWeb wrapped in SyntheticsBasicAuth. -func SyntheticsBasicAuthWebAsSyntheticsBasicAuth(v *SyntheticsBasicAuthWeb) SyntheticsBasicAuth { - return SyntheticsBasicAuth{SyntheticsBasicAuthWeb: v} -} - -// SyntheticsBasicAuthSigv4AsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthSigv4 wrapped in SyntheticsBasicAuth. -func SyntheticsBasicAuthSigv4AsSyntheticsBasicAuth(v *SyntheticsBasicAuthSigv4) SyntheticsBasicAuth { - return SyntheticsBasicAuth{SyntheticsBasicAuthSigv4: v} -} - -// SyntheticsBasicAuthNTLMAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthNTLM wrapped in SyntheticsBasicAuth. -func SyntheticsBasicAuthNTLMAsSyntheticsBasicAuth(v *SyntheticsBasicAuthNTLM) SyntheticsBasicAuth { - return SyntheticsBasicAuth{SyntheticsBasicAuthNTLM: v} -} - -// SyntheticsBasicAuthDigestAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthDigest wrapped in SyntheticsBasicAuth. -func SyntheticsBasicAuthDigestAsSyntheticsBasicAuth(v *SyntheticsBasicAuthDigest) SyntheticsBasicAuth { - return SyntheticsBasicAuth{SyntheticsBasicAuthDigest: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into SyntheticsBasicAuthWeb - err = json.Unmarshal(data, &obj.SyntheticsBasicAuthWeb) - if err == nil { - if obj.SyntheticsBasicAuthWeb != nil && obj.SyntheticsBasicAuthWeb.UnparsedObject == nil { - jsonSyntheticsBasicAuthWeb, _ := json.Marshal(obj.SyntheticsBasicAuthWeb) - if string(jsonSyntheticsBasicAuthWeb) == "{}" { // empty struct - obj.SyntheticsBasicAuthWeb = nil - } else { - match++ - } - } else { - obj.SyntheticsBasicAuthWeb = nil - } - } else { - obj.SyntheticsBasicAuthWeb = nil - } - - // try to unmarshal data into SyntheticsBasicAuthSigv4 - err = json.Unmarshal(data, &obj.SyntheticsBasicAuthSigv4) - if err == nil { - if obj.SyntheticsBasicAuthSigv4 != nil && obj.SyntheticsBasicAuthSigv4.UnparsedObject == nil { - jsonSyntheticsBasicAuthSigv4, _ := json.Marshal(obj.SyntheticsBasicAuthSigv4) - if string(jsonSyntheticsBasicAuthSigv4) == "{}" { // empty struct - obj.SyntheticsBasicAuthSigv4 = nil - } else { - match++ - } - } else { - obj.SyntheticsBasicAuthSigv4 = nil - } - } else { - obj.SyntheticsBasicAuthSigv4 = nil - } - - // try to unmarshal data into SyntheticsBasicAuthNTLM - err = json.Unmarshal(data, &obj.SyntheticsBasicAuthNTLM) - if err == nil { - if obj.SyntheticsBasicAuthNTLM != nil && obj.SyntheticsBasicAuthNTLM.UnparsedObject == nil { - jsonSyntheticsBasicAuthNTLM, _ := json.Marshal(obj.SyntheticsBasicAuthNTLM) - if string(jsonSyntheticsBasicAuthNTLM) == "{}" { // empty struct - obj.SyntheticsBasicAuthNTLM = nil - } else { - match++ - } - } else { - obj.SyntheticsBasicAuthNTLM = nil - } - } else { - obj.SyntheticsBasicAuthNTLM = nil - } - - // try to unmarshal data into SyntheticsBasicAuthDigest - err = json.Unmarshal(data, &obj.SyntheticsBasicAuthDigest) - if err == nil { - if obj.SyntheticsBasicAuthDigest != nil && obj.SyntheticsBasicAuthDigest.UnparsedObject == nil { - jsonSyntheticsBasicAuthDigest, _ := json.Marshal(obj.SyntheticsBasicAuthDigest) - if string(jsonSyntheticsBasicAuthDigest) == "{}" { // empty struct - obj.SyntheticsBasicAuthDigest = nil - } else { - match++ - } - } else { - obj.SyntheticsBasicAuthDigest = nil - } - } else { - obj.SyntheticsBasicAuthDigest = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.SyntheticsBasicAuthWeb = nil - obj.SyntheticsBasicAuthSigv4 = nil - obj.SyntheticsBasicAuthNTLM = nil - obj.SyntheticsBasicAuthDigest = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj SyntheticsBasicAuth) MarshalJSON() ([]byte, error) { - if obj.SyntheticsBasicAuthWeb != nil { - return json.Marshal(&obj.SyntheticsBasicAuthWeb) - } - - if obj.SyntheticsBasicAuthSigv4 != nil { - return json.Marshal(&obj.SyntheticsBasicAuthSigv4) - } - - if obj.SyntheticsBasicAuthNTLM != nil { - return json.Marshal(&obj.SyntheticsBasicAuthNTLM) - } - - if obj.SyntheticsBasicAuthDigest != nil { - return json.Marshal(&obj.SyntheticsBasicAuthDigest) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *SyntheticsBasicAuth) GetActualInstance() interface{} { - if obj.SyntheticsBasicAuthWeb != nil { - return obj.SyntheticsBasicAuthWeb - } - - if obj.SyntheticsBasicAuthSigv4 != nil { - return obj.SyntheticsBasicAuthSigv4 - } - - if obj.SyntheticsBasicAuthNTLM != nil { - return obj.SyntheticsBasicAuthNTLM - } - - if obj.SyntheticsBasicAuthDigest != nil { - return obj.SyntheticsBasicAuthDigest - } - - // all schemas are nil - return nil -} - -// NullableSyntheticsBasicAuth handles when a null is used for SyntheticsBasicAuth. -type NullableSyntheticsBasicAuth struct { - value *SyntheticsBasicAuth - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuth) Get() *SyntheticsBasicAuth { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuth) Set(val *SyntheticsBasicAuth) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuth) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableSyntheticsBasicAuth) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuth initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuth(val *SyntheticsBasicAuth) *NullableSyntheticsBasicAuth { - return &NullableSyntheticsBasicAuth{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuth) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuth) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest.go b/api/v1/datadog/model_synthetics_basic_auth_digest.go deleted file mode 100644 index 3615ee77437..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_digest.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthDigest Object to handle digest authentication when performing the test. -type SyntheticsBasicAuthDigest struct { - // Password to use for the digest authentication. - Password string `json:"password"` - // The type of basic authentication to use when performing the test. - Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` - // Username to use for the digest authentication. - Username string `json:"username"` - // 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{} -} - -// NewSyntheticsBasicAuthDigest instantiates a new SyntheticsBasicAuthDigest 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 NewSyntheticsBasicAuthDigest(password string, username string) *SyntheticsBasicAuthDigest { - this := SyntheticsBasicAuthDigest{} - this.Password = password - var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST - this.Type = &typeVar - this.Username = username - return &this -} - -// NewSyntheticsBasicAuthDigestWithDefaults instantiates a new SyntheticsBasicAuthDigest 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 NewSyntheticsBasicAuthDigestWithDefaults() *SyntheticsBasicAuthDigest { - this := SyntheticsBasicAuthDigest{} - var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST - this.Type = &typeVar - return &this -} - -// GetPassword returns the Password field value. -func (o *SyntheticsBasicAuthDigest) GetPassword() string { - if o == nil { - var ret string - return ret - } - return o.Password -} - -// GetPasswordOk returns a tuple with the Password field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthDigest) GetPasswordOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Password, true -} - -// SetPassword sets field value. -func (o *SyntheticsBasicAuthDigest) SetPassword(v string) { - o.Password = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthDigest) GetType() SyntheticsBasicAuthDigestType { - if o == nil || o.Type == nil { - var ret SyntheticsBasicAuthDigestType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthDigest) GetTypeOk() (*SyntheticsBasicAuthDigestType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthDigest) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SyntheticsBasicAuthDigestType and assigns it to the Type field. -func (o *SyntheticsBasicAuthDigest) SetType(v SyntheticsBasicAuthDigestType) { - o.Type = &v -} - -// GetUsername returns the Username field value. -func (o *SyntheticsBasicAuthDigest) GetUsername() string { - if o == nil { - var ret string - return ret - } - return o.Username -} - -// GetUsernameOk returns a tuple with the Username field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthDigest) GetUsernameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Username, true -} - -// SetUsername sets field value. -func (o *SyntheticsBasicAuthDigest) SetUsername(v string) { - o.Username = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBasicAuthDigest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["password"] = o.Password - if o.Type != nil { - toSerialize["type"] = o.Type - } - toSerialize["username"] = o.Username - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Password *string `json:"password"` - Username *string `json:"username"` - }{} - all := struct { - Password string `json:"password"` - Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` - Username string `json:"username"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Password == nil { - return fmt.Errorf("Required field password missing") - } - if required.Username == nil { - return fmt.Errorf("Required field username missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Password = all.Password - o.Type = all.Type - o.Username = all.Username - return nil -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest_type.go b/api/v1/datadog/model_synthetics_basic_auth_digest_type.go deleted file mode 100644 index f054e3531ad..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_digest_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthDigestType The type of basic authentication to use when performing the test. -type SyntheticsBasicAuthDigestType string - -// List of SyntheticsBasicAuthDigestType. -const ( - SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST SyntheticsBasicAuthDigestType = "digest" -) - -var allowedSyntheticsBasicAuthDigestTypeEnumValues = []SyntheticsBasicAuthDigestType{ - SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBasicAuthDigestType) GetAllowedValues() []SyntheticsBasicAuthDigestType { - return allowedSyntheticsBasicAuthDigestTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBasicAuthDigestType(value) - return nil -} - -// NewSyntheticsBasicAuthDigestTypeFromValue returns a pointer to a valid SyntheticsBasicAuthDigestType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBasicAuthDigestTypeFromValue(v string) (*SyntheticsBasicAuthDigestType, error) { - ev := SyntheticsBasicAuthDigestType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthDigestType: valid values are %v", v, allowedSyntheticsBasicAuthDigestTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBasicAuthDigestType) IsValid() bool { - for _, existing := range allowedSyntheticsBasicAuthDigestTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBasicAuthDigestType value. -func (v SyntheticsBasicAuthDigestType) Ptr() *SyntheticsBasicAuthDigestType { - return &v -} - -// NullableSyntheticsBasicAuthDigestType handles when a null is used for SyntheticsBasicAuthDigestType. -type NullableSyntheticsBasicAuthDigestType struct { - value *SyntheticsBasicAuthDigestType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthDigestType) Get() *SyntheticsBasicAuthDigestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthDigestType) Set(val *SyntheticsBasicAuthDigestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthDigestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthDigestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthDigestType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthDigestType(val *SyntheticsBasicAuthDigestType) *NullableSyntheticsBasicAuthDigestType { - return &NullableSyntheticsBasicAuthDigestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthDigestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_ntlm.go b/api/v1/datadog/model_synthetics_basic_auth_ntlm.go deleted file mode 100644 index 310800fd694..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_ntlm.go +++ /dev/null @@ -1,269 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthNTLM Object to handle `NTLM` authentication when performing the test. -type SyntheticsBasicAuthNTLM struct { - // Domain for the authentication to use when performing the test. - Domain *string `json:"domain,omitempty"` - // Password for the authentication to use when performing the test. - Password *string `json:"password,omitempty"` - // The type of authentication to use when performing the test. - Type SyntheticsBasicAuthNTLMType `json:"type"` - // Username for the authentication to use when performing the test. - Username *string `json:"username,omitempty"` - // Workstation for the authentication to use when performing the test. - Workstation *string `json:"workstation,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{} -} - -// NewSyntheticsBasicAuthNTLM instantiates a new SyntheticsBasicAuthNTLM 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 NewSyntheticsBasicAuthNTLM(typeVar SyntheticsBasicAuthNTLMType) *SyntheticsBasicAuthNTLM { - this := SyntheticsBasicAuthNTLM{} - this.Type = typeVar - return &this -} - -// NewSyntheticsBasicAuthNTLMWithDefaults instantiates a new SyntheticsBasicAuthNTLM 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 NewSyntheticsBasicAuthNTLMWithDefaults() *SyntheticsBasicAuthNTLM { - this := SyntheticsBasicAuthNTLM{} - var typeVar SyntheticsBasicAuthNTLMType = SYNTHETICSBASICAUTHNTLMTYPE_NTLM - this.Type = typeVar - return &this -} - -// GetDomain returns the Domain field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthNTLM) GetDomain() string { - if o == nil || o.Domain == nil { - var ret string - return ret - } - return *o.Domain -} - -// GetDomainOk returns a tuple with the Domain field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthNTLM) GetDomainOk() (*string, bool) { - if o == nil || o.Domain == nil { - return nil, false - } - return o.Domain, true -} - -// HasDomain returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthNTLM) HasDomain() bool { - if o != nil && o.Domain != nil { - return true - } - - return false -} - -// SetDomain gets a reference to the given string and assigns it to the Domain field. -func (o *SyntheticsBasicAuthNTLM) SetDomain(v string) { - o.Domain = &v -} - -// GetPassword returns the Password field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthNTLM) GetPassword() string { - if o == nil || o.Password == nil { - var ret string - return ret - } - return *o.Password -} - -// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthNTLM) GetPasswordOk() (*string, bool) { - if o == nil || o.Password == nil { - return nil, false - } - return o.Password, true -} - -// HasPassword returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthNTLM) HasPassword() bool { - if o != nil && o.Password != nil { - return true - } - - return false -} - -// SetPassword gets a reference to the given string and assigns it to the Password field. -func (o *SyntheticsBasicAuthNTLM) SetPassword(v string) { - o.Password = &v -} - -// GetType returns the Type field value. -func (o *SyntheticsBasicAuthNTLM) GetType() SyntheticsBasicAuthNTLMType { - if o == nil { - var ret SyntheticsBasicAuthNTLMType - 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 *SyntheticsBasicAuthNTLM) GetTypeOk() (*SyntheticsBasicAuthNTLMType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsBasicAuthNTLM) SetType(v SyntheticsBasicAuthNTLMType) { - o.Type = v -} - -// GetUsername returns the Username field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthNTLM) GetUsername() string { - if o == nil || o.Username == nil { - var ret string - return ret - } - return *o.Username -} - -// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthNTLM) GetUsernameOk() (*string, bool) { - if o == nil || o.Username == nil { - return nil, false - } - return o.Username, true -} - -// HasUsername returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthNTLM) HasUsername() bool { - if o != nil && o.Username != nil { - return true - } - - return false -} - -// SetUsername gets a reference to the given string and assigns it to the Username field. -func (o *SyntheticsBasicAuthNTLM) SetUsername(v string) { - o.Username = &v -} - -// GetWorkstation returns the Workstation field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthNTLM) GetWorkstation() string { - if o == nil || o.Workstation == nil { - var ret string - return ret - } - return *o.Workstation -} - -// GetWorkstationOk returns a tuple with the Workstation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthNTLM) GetWorkstationOk() (*string, bool) { - if o == nil || o.Workstation == nil { - return nil, false - } - return o.Workstation, true -} - -// HasWorkstation returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthNTLM) HasWorkstation() bool { - if o != nil && o.Workstation != nil { - return true - } - - return false -} - -// SetWorkstation gets a reference to the given string and assigns it to the Workstation field. -func (o *SyntheticsBasicAuthNTLM) SetWorkstation(v string) { - o.Workstation = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBasicAuthNTLM) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Domain != nil { - toSerialize["domain"] = o.Domain - } - if o.Password != nil { - toSerialize["password"] = o.Password - } - toSerialize["type"] = o.Type - if o.Username != nil { - toSerialize["username"] = o.Username - } - if o.Workstation != nil { - toSerialize["workstation"] = o.Workstation - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *SyntheticsBasicAuthNTLMType `json:"type"` - }{} - all := struct { - Domain *string `json:"domain,omitempty"` - Password *string `json:"password,omitempty"` - Type SyntheticsBasicAuthNTLMType `json:"type"` - Username *string `json:"username,omitempty"` - Workstation *string `json:"workstation,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Domain = all.Domain - o.Password = all.Password - o.Type = all.Type - o.Username = all.Username - o.Workstation = all.Workstation - return nil -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go b/api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go deleted file mode 100644 index eff9fbe505d..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthNTLMType The type of authentication to use when performing the test. -type SyntheticsBasicAuthNTLMType string - -// List of SyntheticsBasicAuthNTLMType. -const ( - SYNTHETICSBASICAUTHNTLMTYPE_NTLM SyntheticsBasicAuthNTLMType = "ntlm" -) - -var allowedSyntheticsBasicAuthNTLMTypeEnumValues = []SyntheticsBasicAuthNTLMType{ - SYNTHETICSBASICAUTHNTLMTYPE_NTLM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBasicAuthNTLMType) GetAllowedValues() []SyntheticsBasicAuthNTLMType { - return allowedSyntheticsBasicAuthNTLMTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBasicAuthNTLMType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBasicAuthNTLMType(value) - return nil -} - -// NewSyntheticsBasicAuthNTLMTypeFromValue returns a pointer to a valid SyntheticsBasicAuthNTLMType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBasicAuthNTLMTypeFromValue(v string) (*SyntheticsBasicAuthNTLMType, error) { - ev := SyntheticsBasicAuthNTLMType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthNTLMType: valid values are %v", v, allowedSyntheticsBasicAuthNTLMTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBasicAuthNTLMType) IsValid() bool { - for _, existing := range allowedSyntheticsBasicAuthNTLMTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBasicAuthNTLMType value. -func (v SyntheticsBasicAuthNTLMType) Ptr() *SyntheticsBasicAuthNTLMType { - return &v -} - -// NullableSyntheticsBasicAuthNTLMType handles when a null is used for SyntheticsBasicAuthNTLMType. -type NullableSyntheticsBasicAuthNTLMType struct { - value *SyntheticsBasicAuthNTLMType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthNTLMType) Get() *SyntheticsBasicAuthNTLMType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthNTLMType) Set(val *SyntheticsBasicAuthNTLMType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthNTLMType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthNTLMType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthNTLMType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthNTLMType(val *SyntheticsBasicAuthNTLMType) *NullableSyntheticsBasicAuthNTLMType { - return &NullableSyntheticsBasicAuthNTLMType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthNTLMType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthNTLMType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_sigv4.go b/api/v1/datadog/model_synthetics_basic_auth_sigv4.go deleted file mode 100644 index 563aeac2a72..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_sigv4.go +++ /dev/null @@ -1,296 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthSigv4 Object to handle `SIGV4` authentication when performing the test. -type SyntheticsBasicAuthSigv4 struct { - // Access key for the `SIGV4` authentication. - AccessKey string `json:"accessKey"` - // Region for the `SIGV4` authentication. - Region *string `json:"region,omitempty"` - // Secret key for the `SIGV4` authentication. - SecretKey string `json:"secretKey"` - // Service name for the `SIGV4` authentication. - ServiceName *string `json:"serviceName,omitempty"` - // Session token for the `SIGV4` authentication. - SessionToken *string `json:"sessionToken,omitempty"` - // The type of authentication to use when performing the test. - Type SyntheticsBasicAuthSigv4Type `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{} -} - -// NewSyntheticsBasicAuthSigv4 instantiates a new SyntheticsBasicAuthSigv4 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 NewSyntheticsBasicAuthSigv4(accessKey string, secretKey string, typeVar SyntheticsBasicAuthSigv4Type) *SyntheticsBasicAuthSigv4 { - this := SyntheticsBasicAuthSigv4{} - this.AccessKey = accessKey - this.SecretKey = secretKey - this.Type = typeVar - return &this -} - -// NewSyntheticsBasicAuthSigv4WithDefaults instantiates a new SyntheticsBasicAuthSigv4 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 NewSyntheticsBasicAuthSigv4WithDefaults() *SyntheticsBasicAuthSigv4 { - this := SyntheticsBasicAuthSigv4{} - var typeVar SyntheticsBasicAuthSigv4Type = SYNTHETICSBASICAUTHSIGV4TYPE_SIGV4 - this.Type = typeVar - return &this -} - -// GetAccessKey returns the AccessKey field value. -func (o *SyntheticsBasicAuthSigv4) GetAccessKey() string { - if o == nil { - var ret string - return ret - } - return o.AccessKey -} - -// GetAccessKeyOk returns a tuple with the AccessKey field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthSigv4) GetAccessKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.AccessKey, true -} - -// SetAccessKey sets field value. -func (o *SyntheticsBasicAuthSigv4) SetAccessKey(v string) { - o.AccessKey = v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthSigv4) GetRegion() string { - if o == nil || o.Region == nil { - var ret string - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthSigv4) GetRegionOk() (*string, bool) { - if o == nil || o.Region == nil { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthSigv4) HasRegion() bool { - if o != nil && o.Region != nil { - return true - } - - return false -} - -// SetRegion gets a reference to the given string and assigns it to the Region field. -func (o *SyntheticsBasicAuthSigv4) SetRegion(v string) { - o.Region = &v -} - -// GetSecretKey returns the SecretKey field value. -func (o *SyntheticsBasicAuthSigv4) GetSecretKey() string { - if o == nil { - var ret string - return ret - } - return o.SecretKey -} - -// GetSecretKeyOk returns a tuple with the SecretKey field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthSigv4) GetSecretKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.SecretKey, true -} - -// SetSecretKey sets field value. -func (o *SyntheticsBasicAuthSigv4) SetSecretKey(v string) { - o.SecretKey = v -} - -// GetServiceName returns the ServiceName field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthSigv4) GetServiceName() string { - if o == nil || o.ServiceName == nil { - var ret string - return ret - } - return *o.ServiceName -} - -// GetServiceNameOk returns a tuple with the ServiceName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthSigv4) GetServiceNameOk() (*string, bool) { - if o == nil || o.ServiceName == nil { - return nil, false - } - return o.ServiceName, true -} - -// HasServiceName returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthSigv4) HasServiceName() bool { - if o != nil && o.ServiceName != nil { - return true - } - - return false -} - -// SetServiceName gets a reference to the given string and assigns it to the ServiceName field. -func (o *SyntheticsBasicAuthSigv4) SetServiceName(v string) { - o.ServiceName = &v -} - -// GetSessionToken returns the SessionToken field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthSigv4) GetSessionToken() string { - if o == nil || o.SessionToken == nil { - var ret string - return ret - } - return *o.SessionToken -} - -// GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthSigv4) GetSessionTokenOk() (*string, bool) { - if o == nil || o.SessionToken == nil { - return nil, false - } - return o.SessionToken, true -} - -// HasSessionToken returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthSigv4) HasSessionToken() bool { - if o != nil && o.SessionToken != nil { - return true - } - - return false -} - -// SetSessionToken gets a reference to the given string and assigns it to the SessionToken field. -func (o *SyntheticsBasicAuthSigv4) SetSessionToken(v string) { - o.SessionToken = &v -} - -// GetType returns the Type field value. -func (o *SyntheticsBasicAuthSigv4) GetType() SyntheticsBasicAuthSigv4Type { - if o == nil { - var ret SyntheticsBasicAuthSigv4Type - 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 *SyntheticsBasicAuthSigv4) GetTypeOk() (*SyntheticsBasicAuthSigv4Type, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsBasicAuthSigv4) SetType(v SyntheticsBasicAuthSigv4Type) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBasicAuthSigv4) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["accessKey"] = o.AccessKey - if o.Region != nil { - toSerialize["region"] = o.Region - } - toSerialize["secretKey"] = o.SecretKey - if o.ServiceName != nil { - toSerialize["serviceName"] = o.ServiceName - } - if o.SessionToken != nil { - toSerialize["sessionToken"] = o.SessionToken - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - AccessKey *string `json:"accessKey"` - SecretKey *string `json:"secretKey"` - Type *SyntheticsBasicAuthSigv4Type `json:"type"` - }{} - all := struct { - AccessKey string `json:"accessKey"` - Region *string `json:"region,omitempty"` - SecretKey string `json:"secretKey"` - ServiceName *string `json:"serviceName,omitempty"` - SessionToken *string `json:"sessionToken,omitempty"` - Type SyntheticsBasicAuthSigv4Type `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccessKey == nil { - return fmt.Errorf("Required field accessKey missing") - } - if required.SecretKey == nil { - return fmt.Errorf("Required field secretKey missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccessKey = all.AccessKey - o.Region = all.Region - o.SecretKey = all.SecretKey - o.ServiceName = all.ServiceName - o.SessionToken = all.SessionToken - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go b/api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go deleted file mode 100644 index 79d87dfae2d..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthSigv4Type The type of authentication to use when performing the test. -type SyntheticsBasicAuthSigv4Type string - -// List of SyntheticsBasicAuthSigv4Type. -const ( - SYNTHETICSBASICAUTHSIGV4TYPE_SIGV4 SyntheticsBasicAuthSigv4Type = "sigv4" -) - -var allowedSyntheticsBasicAuthSigv4TypeEnumValues = []SyntheticsBasicAuthSigv4Type{ - SYNTHETICSBASICAUTHSIGV4TYPE_SIGV4, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBasicAuthSigv4Type) GetAllowedValues() []SyntheticsBasicAuthSigv4Type { - return allowedSyntheticsBasicAuthSigv4TypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBasicAuthSigv4Type) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBasicAuthSigv4Type(value) - return nil -} - -// NewSyntheticsBasicAuthSigv4TypeFromValue returns a pointer to a valid SyntheticsBasicAuthSigv4Type -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBasicAuthSigv4TypeFromValue(v string) (*SyntheticsBasicAuthSigv4Type, error) { - ev := SyntheticsBasicAuthSigv4Type(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthSigv4Type: valid values are %v", v, allowedSyntheticsBasicAuthSigv4TypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBasicAuthSigv4Type) IsValid() bool { - for _, existing := range allowedSyntheticsBasicAuthSigv4TypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBasicAuthSigv4Type value. -func (v SyntheticsBasicAuthSigv4Type) Ptr() *SyntheticsBasicAuthSigv4Type { - return &v -} - -// NullableSyntheticsBasicAuthSigv4Type handles when a null is used for SyntheticsBasicAuthSigv4Type. -type NullableSyntheticsBasicAuthSigv4Type struct { - value *SyntheticsBasicAuthSigv4Type - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthSigv4Type) Get() *SyntheticsBasicAuthSigv4Type { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthSigv4Type) Set(val *SyntheticsBasicAuthSigv4Type) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthSigv4Type) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthSigv4Type) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthSigv4Type initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthSigv4Type(val *SyntheticsBasicAuthSigv4Type) *NullableSyntheticsBasicAuthSigv4Type { - return &NullableSyntheticsBasicAuthSigv4Type{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthSigv4Type) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthSigv4Type) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_web.go b/api/v1/datadog/model_synthetics_basic_auth_web.go deleted file mode 100644 index b018a64b35c..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_web.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthWeb Object to handle basic authentication when performing the test. -type SyntheticsBasicAuthWeb struct { - // Password to use for the basic authentication. - Password string `json:"password"` - // The type of basic authentication to use when performing the test. - Type *SyntheticsBasicAuthWebType `json:"type,omitempty"` - // Username to use for the basic authentication. - Username string `json:"username"` - // 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{} -} - -// NewSyntheticsBasicAuthWeb instantiates a new SyntheticsBasicAuthWeb 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 NewSyntheticsBasicAuthWeb(password string, username string) *SyntheticsBasicAuthWeb { - this := SyntheticsBasicAuthWeb{} - this.Password = password - var typeVar SyntheticsBasicAuthWebType = SYNTHETICSBASICAUTHWEBTYPE_WEB - this.Type = &typeVar - this.Username = username - return &this -} - -// NewSyntheticsBasicAuthWebWithDefaults instantiates a new SyntheticsBasicAuthWeb 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 NewSyntheticsBasicAuthWebWithDefaults() *SyntheticsBasicAuthWeb { - this := SyntheticsBasicAuthWeb{} - var typeVar SyntheticsBasicAuthWebType = SYNTHETICSBASICAUTHWEBTYPE_WEB - this.Type = &typeVar - return &this -} - -// GetPassword returns the Password field value. -func (o *SyntheticsBasicAuthWeb) GetPassword() string { - if o == nil { - var ret string - return ret - } - return o.Password -} - -// GetPasswordOk returns a tuple with the Password field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthWeb) GetPasswordOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Password, true -} - -// SetPassword sets field value. -func (o *SyntheticsBasicAuthWeb) SetPassword(v string) { - o.Password = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SyntheticsBasicAuthWeb) GetType() SyntheticsBasicAuthWebType { - if o == nil || o.Type == nil { - var ret SyntheticsBasicAuthWebType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthWeb) GetTypeOk() (*SyntheticsBasicAuthWebType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SyntheticsBasicAuthWeb) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SyntheticsBasicAuthWebType and assigns it to the Type field. -func (o *SyntheticsBasicAuthWeb) SetType(v SyntheticsBasicAuthWebType) { - o.Type = &v -} - -// GetUsername returns the Username field value. -func (o *SyntheticsBasicAuthWeb) GetUsername() string { - if o == nil { - var ret string - return ret - } - return o.Username -} - -// GetUsernameOk returns a tuple with the Username field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBasicAuthWeb) GetUsernameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Username, true -} - -// SetUsername sets field value. -func (o *SyntheticsBasicAuthWeb) SetUsername(v string) { - o.Username = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["password"] = o.Password - if o.Type != nil { - toSerialize["type"] = o.Type - } - toSerialize["username"] = o.Username - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Password *string `json:"password"` - Username *string `json:"username"` - }{} - all := struct { - Password string `json:"password"` - Type *SyntheticsBasicAuthWebType `json:"type,omitempty"` - Username string `json:"username"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Password == nil { - return fmt.Errorf("Required field password missing") - } - if required.Username == nil { - return fmt.Errorf("Required field username missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Password = all.Password - o.Type = all.Type - o.Username = all.Username - return nil -} diff --git a/api/v1/datadog/model_synthetics_basic_auth_web_type.go b/api/v1/datadog/model_synthetics_basic_auth_web_type.go deleted file mode 100644 index 886871688b7..00000000000 --- a/api/v1/datadog/model_synthetics_basic_auth_web_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBasicAuthWebType The type of basic authentication to use when performing the test. -type SyntheticsBasicAuthWebType string - -// List of SyntheticsBasicAuthWebType. -const ( - SYNTHETICSBASICAUTHWEBTYPE_WEB SyntheticsBasicAuthWebType = "web" -) - -var allowedSyntheticsBasicAuthWebTypeEnumValues = []SyntheticsBasicAuthWebType{ - SYNTHETICSBASICAUTHWEBTYPE_WEB, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBasicAuthWebType) GetAllowedValues() []SyntheticsBasicAuthWebType { - return allowedSyntheticsBasicAuthWebTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBasicAuthWebType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBasicAuthWebType(value) - return nil -} - -// NewSyntheticsBasicAuthWebTypeFromValue returns a pointer to a valid SyntheticsBasicAuthWebType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBasicAuthWebTypeFromValue(v string) (*SyntheticsBasicAuthWebType, error) { - ev := SyntheticsBasicAuthWebType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthWebType: valid values are %v", v, allowedSyntheticsBasicAuthWebTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBasicAuthWebType) IsValid() bool { - for _, existing := range allowedSyntheticsBasicAuthWebTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBasicAuthWebType value. -func (v SyntheticsBasicAuthWebType) Ptr() *SyntheticsBasicAuthWebType { - return &v -} - -// NullableSyntheticsBasicAuthWebType handles when a null is used for SyntheticsBasicAuthWebType. -type NullableSyntheticsBasicAuthWebType struct { - value *SyntheticsBasicAuthWebType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBasicAuthWebType) Get() *SyntheticsBasicAuthWebType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBasicAuthWebType) Set(val *SyntheticsBasicAuthWebType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBasicAuthWebType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBasicAuthWebType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBasicAuthWebType initializes the struct as if Set has been called. -func NewNullableSyntheticsBasicAuthWebType(val *SyntheticsBasicAuthWebType) *NullableSyntheticsBasicAuthWebType { - return &NullableSyntheticsBasicAuthWebType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBasicAuthWebType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBasicAuthWebType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_batch_details.go b/api/v1/datadog/model_synthetics_batch_details.go deleted file mode 100644 index 5937aa47eba..00000000000 --- a/api/v1/datadog/model_synthetics_batch_details.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBatchDetails Details about a batch response. -type SyntheticsBatchDetails struct { - // Wrapper object that contains the details of a batch. - Data *SyntheticsBatchDetailsData `json:"data,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{} -} - -// NewSyntheticsBatchDetails instantiates a new SyntheticsBatchDetails 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 NewSyntheticsBatchDetails() *SyntheticsBatchDetails { - this := SyntheticsBatchDetails{} - return &this -} - -// NewSyntheticsBatchDetailsWithDefaults instantiates a new SyntheticsBatchDetails 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 NewSyntheticsBatchDetailsWithDefaults() *SyntheticsBatchDetails { - this := SyntheticsBatchDetails{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SyntheticsBatchDetails) GetData() SyntheticsBatchDetailsData { - if o == nil || o.Data == nil { - var ret SyntheticsBatchDetailsData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchDetails) GetDataOk() (*SyntheticsBatchDetailsData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SyntheticsBatchDetails) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SyntheticsBatchDetailsData and assigns it to the Data field. -func (o *SyntheticsBatchDetails) SetData(v SyntheticsBatchDetailsData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBatchDetails) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBatchDetails) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SyntheticsBatchDetailsData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v1/datadog/model_synthetics_batch_details_data.go b/api/v1/datadog/model_synthetics_batch_details_data.go deleted file mode 100644 index 08a008357a8..00000000000 --- a/api/v1/datadog/model_synthetics_batch_details_data.go +++ /dev/null @@ -1,195 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBatchDetailsData Wrapper object that contains the details of a batch. -type SyntheticsBatchDetailsData struct { - // Metadata for the Synthetics tests run. - Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - // List of results for the batch. - Results []SyntheticsBatchResult `json:"results,omitempty"` - // Determines whether or not the batch has passed, failed, or is in progress. - Status *SyntheticsStatus `json:"status,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{} -} - -// NewSyntheticsBatchDetailsData instantiates a new SyntheticsBatchDetailsData 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 NewSyntheticsBatchDetailsData() *SyntheticsBatchDetailsData { - this := SyntheticsBatchDetailsData{} - return &this -} - -// NewSyntheticsBatchDetailsDataWithDefaults instantiates a new SyntheticsBatchDetailsData 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 NewSyntheticsBatchDetailsDataWithDefaults() *SyntheticsBatchDetailsData { - this := SyntheticsBatchDetailsData{} - return &this -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *SyntheticsBatchDetailsData) GetMetadata() SyntheticsCIBatchMetadata { - if o == nil || o.Metadata == nil { - var ret SyntheticsCIBatchMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchDetailsData) GetMetadataOk() (*SyntheticsCIBatchMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *SyntheticsBatchDetailsData) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given SyntheticsCIBatchMetadata and assigns it to the Metadata field. -func (o *SyntheticsBatchDetailsData) SetMetadata(v SyntheticsCIBatchMetadata) { - o.Metadata = &v -} - -// GetResults returns the Results field value if set, zero value otherwise. -func (o *SyntheticsBatchDetailsData) GetResults() []SyntheticsBatchResult { - if o == nil || o.Results == nil { - var ret []SyntheticsBatchResult - return ret - } - return o.Results -} - -// GetResultsOk returns a tuple with the Results field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchDetailsData) GetResultsOk() (*[]SyntheticsBatchResult, bool) { - if o == nil || o.Results == nil { - return nil, false - } - return &o.Results, true -} - -// HasResults returns a boolean if a field has been set. -func (o *SyntheticsBatchDetailsData) HasResults() bool { - if o != nil && o.Results != nil { - return true - } - - return false -} - -// SetResults gets a reference to the given []SyntheticsBatchResult and assigns it to the Results field. -func (o *SyntheticsBatchDetailsData) SetResults(v []SyntheticsBatchResult) { - o.Results = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsBatchDetailsData) GetStatus() SyntheticsStatus { - if o == nil || o.Status == nil { - var ret SyntheticsStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchDetailsData) GetStatusOk() (*SyntheticsStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsBatchDetailsData) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsStatus and assigns it to the Status field. -func (o *SyntheticsBatchDetailsData) SetStatus(v SyntheticsStatus) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBatchDetailsData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Results != nil { - toSerialize["results"] = o.Results - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBatchDetailsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - Results []SyntheticsBatchResult `json:"results,omitempty"` - Status *SyntheticsStatus `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Results = all.Results - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_synthetics_batch_result.go b/api/v1/datadog/model_synthetics_batch_result.go deleted file mode 100644 index a9ac5e47dc1..00000000000 --- a/api/v1/datadog/model_synthetics_batch_result.go +++ /dev/null @@ -1,485 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBatchResult Object with the results of a Synthetics batch. -type SyntheticsBatchResult struct { - // The device ID. - Device *SyntheticsDeviceID `json:"device,omitempty"` - // Total duration in millisecond of the test. - Duration *float64 `json:"duration,omitempty"` - // Execution rule for a Synthetics test. - ExecutionRule *SyntheticsTestExecutionRule `json:"execution_rule,omitempty"` - // Name of the location. - Location *string `json:"location,omitempty"` - // The ID of the result to get. - ResultId *string `json:"result_id,omitempty"` - // Number of times this result has been retried. - Retries *float64 `json:"retries,omitempty"` - // Determines whether or not the batch has passed, failed, or is in progress. - Status *SyntheticsStatus `json:"status,omitempty"` - // Name of the test. - TestName *string `json:"test_name,omitempty"` - // The public ID of the Synthetic test. - TestPublicId *string `json:"test_public_id,omitempty"` - // Type of the Synthetic test, either `api` or `browser`. - TestType *SyntheticsTestDetailsType `json:"test_type,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{} -} - -// NewSyntheticsBatchResult instantiates a new SyntheticsBatchResult 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 NewSyntheticsBatchResult() *SyntheticsBatchResult { - this := SyntheticsBatchResult{} - return &this -} - -// NewSyntheticsBatchResultWithDefaults instantiates a new SyntheticsBatchResult 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 NewSyntheticsBatchResultWithDefaults() *SyntheticsBatchResult { - this := SyntheticsBatchResult{} - return &this -} - -// GetDevice returns the Device field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetDevice() SyntheticsDeviceID { - if o == nil || o.Device == nil { - var ret SyntheticsDeviceID - return ret - } - return *o.Device -} - -// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetDeviceOk() (*SyntheticsDeviceID, bool) { - if o == nil || o.Device == nil { - return nil, false - } - return o.Device, true -} - -// HasDevice returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasDevice() bool { - if o != nil && o.Device != nil { - return true - } - - return false -} - -// SetDevice gets a reference to the given SyntheticsDeviceID and assigns it to the Device field. -func (o *SyntheticsBatchResult) SetDevice(v SyntheticsDeviceID) { - o.Device = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetDuration() float64 { - if o == nil || o.Duration == nil { - var ret float64 - return ret - } - return *o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetDurationOk() (*float64, bool) { - if o == nil || o.Duration == nil { - return nil, false - } - return o.Duration, true -} - -// HasDuration returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasDuration() bool { - if o != nil && o.Duration != nil { - return true - } - - return false -} - -// SetDuration gets a reference to the given float64 and assigns it to the Duration field. -func (o *SyntheticsBatchResult) SetDuration(v float64) { - o.Duration = &v -} - -// GetExecutionRule returns the ExecutionRule field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetExecutionRule() SyntheticsTestExecutionRule { - if o == nil || o.ExecutionRule == nil { - var ret SyntheticsTestExecutionRule - return ret - } - return *o.ExecutionRule -} - -// GetExecutionRuleOk returns a tuple with the ExecutionRule field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetExecutionRuleOk() (*SyntheticsTestExecutionRule, bool) { - if o == nil || o.ExecutionRule == nil { - return nil, false - } - return o.ExecutionRule, true -} - -// HasExecutionRule returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasExecutionRule() bool { - if o != nil && o.ExecutionRule != nil { - return true - } - - return false -} - -// SetExecutionRule gets a reference to the given SyntheticsTestExecutionRule and assigns it to the ExecutionRule field. -func (o *SyntheticsBatchResult) SetExecutionRule(v SyntheticsTestExecutionRule) { - o.ExecutionRule = &v -} - -// GetLocation returns the Location field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetLocation() string { - if o == nil || o.Location == nil { - var ret string - return ret - } - return *o.Location -} - -// GetLocationOk returns a tuple with the Location field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetLocationOk() (*string, bool) { - if o == nil || o.Location == nil { - return nil, false - } - return o.Location, true -} - -// HasLocation returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false -} - -// SetLocation gets a reference to the given string and assigns it to the Location field. -func (o *SyntheticsBatchResult) SetLocation(v string) { - o.Location = &v -} - -// GetResultId returns the ResultId field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetResultId() string { - if o == nil || o.ResultId == nil { - var ret string - return ret - } - return *o.ResultId -} - -// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetResultIdOk() (*string, bool) { - if o == nil || o.ResultId == nil { - return nil, false - } - return o.ResultId, true -} - -// HasResultId returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasResultId() bool { - if o != nil && o.ResultId != nil { - return true - } - - return false -} - -// SetResultId gets a reference to the given string and assigns it to the ResultId field. -func (o *SyntheticsBatchResult) SetResultId(v string) { - o.ResultId = &v -} - -// GetRetries returns the Retries field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetRetries() float64 { - if o == nil || o.Retries == nil { - var ret float64 - return ret - } - return *o.Retries -} - -// GetRetriesOk returns a tuple with the Retries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetRetriesOk() (*float64, bool) { - if o == nil || o.Retries == nil { - return nil, false - } - return o.Retries, true -} - -// HasRetries returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasRetries() bool { - if o != nil && o.Retries != nil { - return true - } - - return false -} - -// SetRetries gets a reference to the given float64 and assigns it to the Retries field. -func (o *SyntheticsBatchResult) SetRetries(v float64) { - o.Retries = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetStatus() SyntheticsStatus { - if o == nil || o.Status == nil { - var ret SyntheticsStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetStatusOk() (*SyntheticsStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsStatus and assigns it to the Status field. -func (o *SyntheticsBatchResult) SetStatus(v SyntheticsStatus) { - o.Status = &v -} - -// GetTestName returns the TestName field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetTestName() string { - if o == nil || o.TestName == nil { - var ret string - return ret - } - return *o.TestName -} - -// GetTestNameOk returns a tuple with the TestName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetTestNameOk() (*string, bool) { - if o == nil || o.TestName == nil { - return nil, false - } - return o.TestName, true -} - -// HasTestName returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasTestName() bool { - if o != nil && o.TestName != nil { - return true - } - - return false -} - -// SetTestName gets a reference to the given string and assigns it to the TestName field. -func (o *SyntheticsBatchResult) SetTestName(v string) { - o.TestName = &v -} - -// GetTestPublicId returns the TestPublicId field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetTestPublicId() string { - if o == nil || o.TestPublicId == nil { - var ret string - return ret - } - return *o.TestPublicId -} - -// GetTestPublicIdOk returns a tuple with the TestPublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetTestPublicIdOk() (*string, bool) { - if o == nil || o.TestPublicId == nil { - return nil, false - } - return o.TestPublicId, true -} - -// HasTestPublicId returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasTestPublicId() bool { - if o != nil && o.TestPublicId != nil { - return true - } - - return false -} - -// SetTestPublicId gets a reference to the given string and assigns it to the TestPublicId field. -func (o *SyntheticsBatchResult) SetTestPublicId(v string) { - o.TestPublicId = &v -} - -// GetTestType returns the TestType field value if set, zero value otherwise. -func (o *SyntheticsBatchResult) GetTestType() SyntheticsTestDetailsType { - if o == nil || o.TestType == nil { - var ret SyntheticsTestDetailsType - return ret - } - return *o.TestType -} - -// GetTestTypeOk returns a tuple with the TestType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBatchResult) GetTestTypeOk() (*SyntheticsTestDetailsType, bool) { - if o == nil || o.TestType == nil { - return nil, false - } - return o.TestType, true -} - -// HasTestType returns a boolean if a field has been set. -func (o *SyntheticsBatchResult) HasTestType() bool { - if o != nil && o.TestType != nil { - return true - } - - return false -} - -// SetTestType gets a reference to the given SyntheticsTestDetailsType and assigns it to the TestType field. -func (o *SyntheticsBatchResult) SetTestType(v SyntheticsTestDetailsType) { - o.TestType = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBatchResult) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Device != nil { - toSerialize["device"] = o.Device - } - if o.Duration != nil { - toSerialize["duration"] = o.Duration - } - if o.ExecutionRule != nil { - toSerialize["execution_rule"] = o.ExecutionRule - } - if o.Location != nil { - toSerialize["location"] = o.Location - } - if o.ResultId != nil { - toSerialize["result_id"] = o.ResultId - } - if o.Retries != nil { - toSerialize["retries"] = o.Retries - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.TestName != nil { - toSerialize["test_name"] = o.TestName - } - if o.TestPublicId != nil { - toSerialize["test_public_id"] = o.TestPublicId - } - if o.TestType != nil { - toSerialize["test_type"] = o.TestType - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBatchResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Device *SyntheticsDeviceID `json:"device,omitempty"` - Duration *float64 `json:"duration,omitempty"` - ExecutionRule *SyntheticsTestExecutionRule `json:"execution_rule,omitempty"` - Location *string `json:"location,omitempty"` - ResultId *string `json:"result_id,omitempty"` - Retries *float64 `json:"retries,omitempty"` - Status *SyntheticsStatus `json:"status,omitempty"` - TestName *string `json:"test_name,omitempty"` - TestPublicId *string `json:"test_public_id,omitempty"` - TestType *SyntheticsTestDetailsType `json:"test_type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Device; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ExecutionRule; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TestType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Device = all.Device - o.Duration = all.Duration - o.ExecutionRule = all.ExecutionRule - o.Location = all.Location - o.ResultId = all.ResultId - o.Retries = all.Retries - o.Status = all.Status - o.TestName = all.TestName - o.TestPublicId = all.TestPublicId - o.TestType = all.TestType - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_error.go b/api/v1/datadog/model_synthetics_browser_error.go deleted file mode 100644 index baa171e312f..00000000000 --- a/api/v1/datadog/model_synthetics_browser_error.go +++ /dev/null @@ -1,216 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserError Error response object for a browser test. -type SyntheticsBrowserError struct { - // Description of the error. - Description string `json:"description"` - // Name of the error. - Name string `json:"name"` - // Status Code of the error. - Status *int64 `json:"status,omitempty"` - // Error type returned by a browser test. - Type SyntheticsBrowserErrorType `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{} -} - -// NewSyntheticsBrowserError instantiates a new SyntheticsBrowserError 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 NewSyntheticsBrowserError(description string, name string, typeVar SyntheticsBrowserErrorType) *SyntheticsBrowserError { - this := SyntheticsBrowserError{} - this.Description = description - this.Name = name - this.Type = typeVar - return &this -} - -// NewSyntheticsBrowserErrorWithDefaults instantiates a new SyntheticsBrowserError 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 NewSyntheticsBrowserErrorWithDefaults() *SyntheticsBrowserError { - this := SyntheticsBrowserError{} - return &this -} - -// GetDescription returns the Description field value. -func (o *SyntheticsBrowserError) GetDescription() string { - if o == nil { - var ret string - return ret - } - return o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserError) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Description, true -} - -// SetDescription sets field value. -func (o *SyntheticsBrowserError) SetDescription(v string) { - o.Description = v -} - -// GetName returns the Name field value. -func (o *SyntheticsBrowserError) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserError) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsBrowserError) SetName(v string) { - o.Name = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsBrowserError) GetStatus() int64 { - if o == nil || o.Status == nil { - var ret int64 - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserError) GetStatusOk() (*int64, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsBrowserError) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given int64 and assigns it to the Status field. -func (o *SyntheticsBrowserError) SetStatus(v int64) { - o.Status = &v -} - -// GetType returns the Type field value. -func (o *SyntheticsBrowserError) GetType() SyntheticsBrowserErrorType { - if o == nil { - var ret SyntheticsBrowserErrorType - 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 *SyntheticsBrowserError) GetTypeOk() (*SyntheticsBrowserErrorType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsBrowserError) SetType(v SyntheticsBrowserErrorType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["description"] = o.Description - toSerialize["name"] = o.Name - if o.Status != nil { - toSerialize["status"] = o.Status - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Description *string `json:"description"` - Name *string `json:"name"` - Type *SyntheticsBrowserErrorType `json:"type"` - }{} - all := struct { - Description string `json:"description"` - Name string `json:"name"` - Status *int64 `json:"status,omitempty"` - Type SyntheticsBrowserErrorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Description == nil { - return fmt.Errorf("Required field description missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Description = all.Description - o.Name = all.Name - o.Status = all.Status - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_error_type.go b/api/v1/datadog/model_synthetics_browser_error_type.go deleted file mode 100644 index e2e2697a746..00000000000 --- a/api/v1/datadog/model_synthetics_browser_error_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserErrorType Error type returned by a browser test. -type SyntheticsBrowserErrorType string - -// List of SyntheticsBrowserErrorType. -const ( - SYNTHETICSBROWSERERRORTYPE_NETWORK SyntheticsBrowserErrorType = "network" - SYNTHETICSBROWSERERRORTYPE_JS SyntheticsBrowserErrorType = "js" -) - -var allowedSyntheticsBrowserErrorTypeEnumValues = []SyntheticsBrowserErrorType{ - SYNTHETICSBROWSERERRORTYPE_NETWORK, - SYNTHETICSBROWSERERRORTYPE_JS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBrowserErrorType) GetAllowedValues() []SyntheticsBrowserErrorType { - return allowedSyntheticsBrowserErrorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBrowserErrorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBrowserErrorType(value) - return nil -} - -// NewSyntheticsBrowserErrorTypeFromValue returns a pointer to a valid SyntheticsBrowserErrorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBrowserErrorTypeFromValue(v string) (*SyntheticsBrowserErrorType, error) { - ev := SyntheticsBrowserErrorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserErrorType: valid values are %v", v, allowedSyntheticsBrowserErrorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBrowserErrorType) IsValid() bool { - for _, existing := range allowedSyntheticsBrowserErrorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBrowserErrorType value. -func (v SyntheticsBrowserErrorType) Ptr() *SyntheticsBrowserErrorType { - return &v -} - -// NullableSyntheticsBrowserErrorType handles when a null is used for SyntheticsBrowserErrorType. -type NullableSyntheticsBrowserErrorType struct { - value *SyntheticsBrowserErrorType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserErrorType) Get() *SyntheticsBrowserErrorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserErrorType) Set(val *SyntheticsBrowserErrorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserErrorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserErrorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserErrorType initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserErrorType(val *SyntheticsBrowserErrorType) *NullableSyntheticsBrowserErrorType { - return &NullableSyntheticsBrowserErrorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserErrorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserErrorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_browser_test_.go b/api/v1/datadog/model_synthetics_browser_test_.go deleted file mode 100644 index 20b60aa247e..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_.go +++ /dev/null @@ -1,496 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserTest Object containing details about a Synthetic browser test. -type SyntheticsBrowserTest struct { - // Configuration object for a Synthetic browser test. - Config SyntheticsBrowserTestConfig `json:"config"` - // Array of locations used to run the test. - Locations []string `json:"locations"` - // Notification message associated with the test. Message can either be text or an empty string. - Message string `json:"message"` - // The associated monitor ID. - MonitorId *int64 `json:"monitor_id,omitempty"` - // Name of the test. - Name string `json:"name"` - // Object describing the extra options for a Synthetic test. - Options SyntheticsTestOptions `json:"options"` - // The public ID of the test. - PublicId *string `json:"public_id,omitempty"` - // Define whether you want to start (`live`) or pause (`paused`) a - // Synthetic test. - Status *SyntheticsTestPauseStatus `json:"status,omitempty"` - // The steps of the test. - Steps []SyntheticsStep `json:"steps,omitempty"` - // Array of tags attached to the test. - Tags []string `json:"tags,omitempty"` - // Type of the Synthetic test, `browser`. - Type SyntheticsBrowserTestType `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{} -} - -// NewSyntheticsBrowserTest instantiates a new SyntheticsBrowserTest 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 NewSyntheticsBrowserTest(config SyntheticsBrowserTestConfig, locations []string, message string, name string, options SyntheticsTestOptions, typeVar SyntheticsBrowserTestType) *SyntheticsBrowserTest { - this := SyntheticsBrowserTest{} - this.Config = config - this.Locations = locations - this.Message = message - this.Name = name - this.Options = options - this.Type = typeVar - return &this -} - -// NewSyntheticsBrowserTestWithDefaults instantiates a new SyntheticsBrowserTest 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 NewSyntheticsBrowserTestWithDefaults() *SyntheticsBrowserTest { - this := SyntheticsBrowserTest{} - var typeVar SyntheticsBrowserTestType = SYNTHETICSBROWSERTESTTYPE_BROWSER - this.Type = typeVar - return &this -} - -// GetConfig returns the Config field value. -func (o *SyntheticsBrowserTest) GetConfig() SyntheticsBrowserTestConfig { - if o == nil { - var ret SyntheticsBrowserTestConfig - return ret - } - return o.Config -} - -// GetConfigOk returns a tuple with the Config field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetConfigOk() (*SyntheticsBrowserTestConfig, bool) { - if o == nil { - return nil, false - } - return &o.Config, true -} - -// SetConfig sets field value. -func (o *SyntheticsBrowserTest) SetConfig(v SyntheticsBrowserTestConfig) { - o.Config = v -} - -// GetLocations returns the Locations field value. -func (o *SyntheticsBrowserTest) GetLocations() []string { - if o == nil { - var ret []string - return ret - } - return o.Locations -} - -// GetLocationsOk returns a tuple with the Locations field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetLocationsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Locations, true -} - -// SetLocations sets field value. -func (o *SyntheticsBrowserTest) SetLocations(v []string) { - o.Locations = v -} - -// GetMessage returns the Message field value. -func (o *SyntheticsBrowserTest) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *SyntheticsBrowserTest) SetMessage(v string) { - o.Message = v -} - -// GetMonitorId returns the MonitorId field value if set, zero value otherwise. -func (o *SyntheticsBrowserTest) GetMonitorId() int64 { - if o == nil || o.MonitorId == nil { - var ret int64 - return ret - } - return *o.MonitorId -} - -// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetMonitorIdOk() (*int64, bool) { - if o == nil || o.MonitorId == nil { - return nil, false - } - return o.MonitorId, true -} - -// HasMonitorId returns a boolean if a field has been set. -func (o *SyntheticsBrowserTest) HasMonitorId() bool { - if o != nil && o.MonitorId != nil { - return true - } - - return false -} - -// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. -func (o *SyntheticsBrowserTest) SetMonitorId(v int64) { - o.MonitorId = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsBrowserTest) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsBrowserTest) SetName(v string) { - o.Name = v -} - -// GetOptions returns the Options field value. -func (o *SyntheticsBrowserTest) GetOptions() SyntheticsTestOptions { - if o == nil { - var ret SyntheticsTestOptions - return ret - } - return o.Options -} - -// GetOptionsOk returns a tuple with the Options field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetOptionsOk() (*SyntheticsTestOptions, bool) { - if o == nil { - return nil, false - } - return &o.Options, true -} - -// SetOptions sets field value. -func (o *SyntheticsBrowserTest) SetOptions(v SyntheticsTestOptions) { - o.Options = v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *SyntheticsBrowserTest) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *SyntheticsBrowserTest) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *SyntheticsBrowserTest) SetPublicId(v string) { - o.PublicId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsBrowserTest) GetStatus() SyntheticsTestPauseStatus { - if o == nil || o.Status == nil { - var ret SyntheticsTestPauseStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsBrowserTest) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. -func (o *SyntheticsBrowserTest) SetStatus(v SyntheticsTestPauseStatus) { - o.Status = &v -} - -// GetSteps returns the Steps field value if set, zero value otherwise. -func (o *SyntheticsBrowserTest) GetSteps() []SyntheticsStep { - if o == nil || o.Steps == nil { - var ret []SyntheticsStep - return ret - } - return o.Steps -} - -// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTest) GetStepsOk() (*[]SyntheticsStep, bool) { - if o == nil || o.Steps == nil { - return nil, false - } - return &o.Steps, true -} - -// HasSteps returns a boolean if a field has been set. -func (o *SyntheticsBrowserTest) HasSteps() bool { - if o != nil && o.Steps != nil { - return true - } - - return false -} - -// SetSteps gets a reference to the given []SyntheticsStep and assigns it to the Steps field. -func (o *SyntheticsBrowserTest) SetSteps(v []SyntheticsStep) { - o.Steps = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SyntheticsBrowserTest) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SyntheticsBrowserTest) GetTagsOk() (*[]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 *SyntheticsBrowserTest) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SyntheticsBrowserTest) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value. -func (o *SyntheticsBrowserTest) GetType() SyntheticsBrowserTestType { - if o == nil { - var ret SyntheticsBrowserTestType - 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 *SyntheticsBrowserTest) GetTypeOk() (*SyntheticsBrowserTestType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsBrowserTest) SetType(v SyntheticsBrowserTestType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["config"] = o.Config - toSerialize["locations"] = o.Locations - toSerialize["message"] = o.Message - if o.MonitorId != nil { - toSerialize["monitor_id"] = o.MonitorId - } - toSerialize["name"] = o.Name - toSerialize["options"] = o.Options - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Steps != nil { - toSerialize["steps"] = o.Steps - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Config *SyntheticsBrowserTestConfig `json:"config"` - Locations *[]string `json:"locations"` - Message *string `json:"message"` - Name *string `json:"name"` - Options *SyntheticsTestOptions `json:"options"` - Type *SyntheticsBrowserTestType `json:"type"` - }{} - all := struct { - Config SyntheticsBrowserTestConfig `json:"config"` - Locations []string `json:"locations"` - Message string `json:"message"` - MonitorId *int64 `json:"monitor_id,omitempty"` - Name string `json:"name"` - Options SyntheticsTestOptions `json:"options"` - PublicId *string `json:"public_id,omitempty"` - Status *SyntheticsTestPauseStatus `json:"status,omitempty"` - Steps []SyntheticsStep `json:"steps,omitempty"` - Tags []string `json:"tags,omitempty"` - Type SyntheticsBrowserTestType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Config == nil { - return fmt.Errorf("Required field config missing") - } - if required.Locations == nil { - return fmt.Errorf("Required field locations missing") - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Options == nil { - return fmt.Errorf("Required field options missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Config = all.Config - o.Locations = all.Locations - o.Message = all.Message - o.MonitorId = all.MonitorId - o.Name = all.Name - if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.PublicId = all.PublicId - o.Status = all.Status - o.Steps = all.Steps - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_config.go b/api/v1/datadog/model_synthetics_browser_test_config.go deleted file mode 100644 index 8f12f59799d..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_config.go +++ /dev/null @@ -1,260 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserTestConfig Configuration object for a Synthetic browser test. -type SyntheticsBrowserTestConfig struct { - // Array of assertions used for the test. - Assertions []SyntheticsAssertion `json:"assertions"` - // Array of variables used for the test. - ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` - // Object describing the Synthetic test request. - Request SyntheticsTestRequest `json:"request"` - // Cookies to be used for the request, using the [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) syntax. - SetCookie *string `json:"setCookie,omitempty"` - // Array of variables used for the test steps. - Variables []SyntheticsBrowserVariable `json:"variables,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{} -} - -// NewSyntheticsBrowserTestConfig instantiates a new SyntheticsBrowserTestConfig 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 NewSyntheticsBrowserTestConfig(assertions []SyntheticsAssertion, request SyntheticsTestRequest) *SyntheticsBrowserTestConfig { - this := SyntheticsBrowserTestConfig{} - this.Assertions = assertions - this.Request = request - return &this -} - -// NewSyntheticsBrowserTestConfigWithDefaults instantiates a new SyntheticsBrowserTestConfig 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 NewSyntheticsBrowserTestConfigWithDefaults() *SyntheticsBrowserTestConfig { - this := SyntheticsBrowserTestConfig{} - return &this -} - -// GetAssertions returns the Assertions field value. -func (o *SyntheticsBrowserTestConfig) GetAssertions() []SyntheticsAssertion { - if o == nil { - var ret []SyntheticsAssertion - return ret - } - return o.Assertions -} - -// GetAssertionsOk returns a tuple with the Assertions field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { - if o == nil { - return nil, false - } - return &o.Assertions, true -} - -// SetAssertions sets field value. -func (o *SyntheticsBrowserTestConfig) SetAssertions(v []SyntheticsAssertion) { - o.Assertions = v -} - -// GetConfigVariables returns the ConfigVariables field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestConfig) GetConfigVariables() []SyntheticsConfigVariable { - if o == nil || o.ConfigVariables == nil { - var ret []SyntheticsConfigVariable - return ret - } - return o.ConfigVariables -} - -// GetConfigVariablesOk returns a tuple with the ConfigVariables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool) { - if o == nil || o.ConfigVariables == nil { - return nil, false - } - return &o.ConfigVariables, true -} - -// HasConfigVariables returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestConfig) HasConfigVariables() bool { - if o != nil && o.ConfigVariables != nil { - return true - } - - return false -} - -// SetConfigVariables gets a reference to the given []SyntheticsConfigVariable and assigns it to the ConfigVariables field. -func (o *SyntheticsBrowserTestConfig) SetConfigVariables(v []SyntheticsConfigVariable) { - o.ConfigVariables = v -} - -// GetRequest returns the Request field value. -func (o *SyntheticsBrowserTestConfig) GetRequest() SyntheticsTestRequest { - if o == nil { - var ret SyntheticsTestRequest - return ret - } - return o.Request -} - -// GetRequestOk returns a tuple with the Request field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { - if o == nil { - return nil, false - } - return &o.Request, true -} - -// SetRequest sets field value. -func (o *SyntheticsBrowserTestConfig) SetRequest(v SyntheticsTestRequest) { - o.Request = v -} - -// GetSetCookie returns the SetCookie field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestConfig) GetSetCookie() string { - if o == nil || o.SetCookie == nil { - var ret string - return ret - } - return *o.SetCookie -} - -// GetSetCookieOk returns a tuple with the SetCookie field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestConfig) GetSetCookieOk() (*string, bool) { - if o == nil || o.SetCookie == nil { - return nil, false - } - return o.SetCookie, true -} - -// HasSetCookie returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestConfig) HasSetCookie() bool { - if o != nil && o.SetCookie != nil { - return true - } - - return false -} - -// SetSetCookie gets a reference to the given string and assigns it to the SetCookie field. -func (o *SyntheticsBrowserTestConfig) SetSetCookie(v string) { - o.SetCookie = &v -} - -// GetVariables returns the Variables field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestConfig) GetVariables() []SyntheticsBrowserVariable { - if o == nil || o.Variables == nil { - var ret []SyntheticsBrowserVariable - return ret - } - return o.Variables -} - -// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestConfig) GetVariablesOk() (*[]SyntheticsBrowserVariable, bool) { - if o == nil || o.Variables == nil { - return nil, false - } - return &o.Variables, true -} - -// HasVariables returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestConfig) HasVariables() bool { - if o != nil && o.Variables != nil { - return true - } - - return false -} - -// SetVariables gets a reference to the given []SyntheticsBrowserVariable and assigns it to the Variables field. -func (o *SyntheticsBrowserTestConfig) SetVariables(v []SyntheticsBrowserVariable) { - o.Variables = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestConfig) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["assertions"] = o.Assertions - if o.ConfigVariables != nil { - toSerialize["configVariables"] = o.ConfigVariables - } - toSerialize["request"] = o.Request - if o.SetCookie != nil { - toSerialize["setCookie"] = o.SetCookie - } - if o.Variables != nil { - toSerialize["variables"] = o.Variables - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Assertions *[]SyntheticsAssertion `json:"assertions"` - Request *SyntheticsTestRequest `json:"request"` - }{} - all := struct { - Assertions []SyntheticsAssertion `json:"assertions"` - ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` - Request SyntheticsTestRequest `json:"request"` - SetCookie *string `json:"setCookie,omitempty"` - Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assertions == nil { - return fmt.Errorf("Required field assertions missing") - } - if required.Request == nil { - return fmt.Errorf("Required field request missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Assertions = all.Assertions - o.ConfigVariables = all.ConfigVariables - if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Request = all.Request - o.SetCookie = all.SetCookie - o.Variables = all.Variables - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_failure_code.go b/api/v1/datadog/model_synthetics_browser_test_failure_code.go deleted file mode 100644 index 3a7cc489968..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_failure_code.go +++ /dev/null @@ -1,171 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserTestFailureCode Error code that can be returned by a Synthetic test. -type SyntheticsBrowserTestFailureCode string - -// List of SyntheticsBrowserTestFailureCode. -const ( - SYNTHETICSBROWSERTESTFAILURECODE_API_REQUEST_FAILURE SyntheticsBrowserTestFailureCode = "API_REQUEST_FAILURE" - SYNTHETICSBROWSERTESTFAILURECODE_ASSERTION_FAILURE SyntheticsBrowserTestFailureCode = "ASSERTION_FAILURE" - SYNTHETICSBROWSERTESTFAILURECODE_DOWNLOAD_FILE_TOO_LARGE SyntheticsBrowserTestFailureCode = "DOWNLOAD_FILE_TOO_LARGE" - SYNTHETICSBROWSERTESTFAILURECODE_ELEMENT_NOT_INTERACTABLE SyntheticsBrowserTestFailureCode = "ELEMENT_NOT_INTERACTABLE" - SYNTHETICSBROWSERTESTFAILURECODE_EMAIL_VARIABLE_NOT_DEFINED SyntheticsBrowserTestFailureCode = "EMAIL_VARIABLE_NOT_DEFINED" - SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT SyntheticsBrowserTestFailureCode = "EVALUATE_JAVASCRIPT" - SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT_CONTEXT SyntheticsBrowserTestFailureCode = "EVALUATE_JAVASCRIPT_CONTEXT" - SYNTHETICSBROWSERTESTFAILURECODE_EXTRACT_VARIABLE SyntheticsBrowserTestFailureCode = "EXTRACT_VARIABLE" - SYNTHETICSBROWSERTESTFAILURECODE_FORBIDDEN_URL SyntheticsBrowserTestFailureCode = "FORBIDDEN_URL" - SYNTHETICSBROWSERTESTFAILURECODE_FRAME_DETACHED SyntheticsBrowserTestFailureCode = "FRAME_DETACHED" - SYNTHETICSBROWSERTESTFAILURECODE_INCONSISTENCIES SyntheticsBrowserTestFailureCode = "INCONSISTENCIES" - SYNTHETICSBROWSERTESTFAILURECODE_INTERNAL_ERROR SyntheticsBrowserTestFailureCode = "INTERNAL_ERROR" - SYNTHETICSBROWSERTESTFAILURECODE_INVALID_TYPE_TEXT_DELAY SyntheticsBrowserTestFailureCode = "INVALID_TYPE_TEXT_DELAY" - SYNTHETICSBROWSERTESTFAILURECODE_INVALID_URL SyntheticsBrowserTestFailureCode = "INVALID_URL" - SYNTHETICSBROWSERTESTFAILURECODE_INVALID_VARIABLE_PATTERN SyntheticsBrowserTestFailureCode = "INVALID_VARIABLE_PATTERN" - SYNTHETICSBROWSERTESTFAILURECODE_INVISIBLE_ELEMENT SyntheticsBrowserTestFailureCode = "INVISIBLE_ELEMENT" - SYNTHETICSBROWSERTESTFAILURECODE_LOCATE_ELEMENT SyntheticsBrowserTestFailureCode = "LOCATE_ELEMENT" - SYNTHETICSBROWSERTESTFAILURECODE_NAVIGATE_TO_LINK SyntheticsBrowserTestFailureCode = "NAVIGATE_TO_LINK" - SYNTHETICSBROWSERTESTFAILURECODE_OPEN_URL SyntheticsBrowserTestFailureCode = "OPEN_URL" - SYNTHETICSBROWSERTESTFAILURECODE_PRESS_KEY SyntheticsBrowserTestFailureCode = "PRESS_KEY" - SYNTHETICSBROWSERTESTFAILURECODE_SERVER_CERTIFICATE SyntheticsBrowserTestFailureCode = "SERVER_CERTIFICATE" - SYNTHETICSBROWSERTESTFAILURECODE_SELECT_OPTION SyntheticsBrowserTestFailureCode = "SELECT_OPTION" - SYNTHETICSBROWSERTESTFAILURECODE_STEP_TIMEOUT SyntheticsBrowserTestFailureCode = "STEP_TIMEOUT" - SYNTHETICSBROWSERTESTFAILURECODE_SUB_TEST_NOT_PASSED SyntheticsBrowserTestFailureCode = "SUB_TEST_NOT_PASSED" - SYNTHETICSBROWSERTESTFAILURECODE_TEST_TIMEOUT SyntheticsBrowserTestFailureCode = "TEST_TIMEOUT" - SYNTHETICSBROWSERTESTFAILURECODE_TOO_MANY_HTTP_REQUESTS SyntheticsBrowserTestFailureCode = "TOO_MANY_HTTP_REQUESTS" - SYNTHETICSBROWSERTESTFAILURECODE_UNAVAILABLE_BROWSER SyntheticsBrowserTestFailureCode = "UNAVAILABLE_BROWSER" - SYNTHETICSBROWSERTESTFAILURECODE_UNKNOWN SyntheticsBrowserTestFailureCode = "UNKNOWN" - SYNTHETICSBROWSERTESTFAILURECODE_UNSUPPORTED_AUTH_SCHEMA SyntheticsBrowserTestFailureCode = "UNSUPPORTED_AUTH_SCHEMA" - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_ELEMENT_TYPE SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_ELEMENT_TYPE" - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DIALOG SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_DIALOG" - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DYNAMIC_ELEMENT SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_DYNAMIC_ELEMENT" - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_NAME SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_NAME" -) - -var allowedSyntheticsBrowserTestFailureCodeEnumValues = []SyntheticsBrowserTestFailureCode{ - SYNTHETICSBROWSERTESTFAILURECODE_API_REQUEST_FAILURE, - SYNTHETICSBROWSERTESTFAILURECODE_ASSERTION_FAILURE, - SYNTHETICSBROWSERTESTFAILURECODE_DOWNLOAD_FILE_TOO_LARGE, - SYNTHETICSBROWSERTESTFAILURECODE_ELEMENT_NOT_INTERACTABLE, - SYNTHETICSBROWSERTESTFAILURECODE_EMAIL_VARIABLE_NOT_DEFINED, - SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT, - SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT_CONTEXT, - SYNTHETICSBROWSERTESTFAILURECODE_EXTRACT_VARIABLE, - SYNTHETICSBROWSERTESTFAILURECODE_FORBIDDEN_URL, - SYNTHETICSBROWSERTESTFAILURECODE_FRAME_DETACHED, - SYNTHETICSBROWSERTESTFAILURECODE_INCONSISTENCIES, - SYNTHETICSBROWSERTESTFAILURECODE_INTERNAL_ERROR, - SYNTHETICSBROWSERTESTFAILURECODE_INVALID_TYPE_TEXT_DELAY, - SYNTHETICSBROWSERTESTFAILURECODE_INVALID_URL, - SYNTHETICSBROWSERTESTFAILURECODE_INVALID_VARIABLE_PATTERN, - SYNTHETICSBROWSERTESTFAILURECODE_INVISIBLE_ELEMENT, - SYNTHETICSBROWSERTESTFAILURECODE_LOCATE_ELEMENT, - SYNTHETICSBROWSERTESTFAILURECODE_NAVIGATE_TO_LINK, - SYNTHETICSBROWSERTESTFAILURECODE_OPEN_URL, - SYNTHETICSBROWSERTESTFAILURECODE_PRESS_KEY, - SYNTHETICSBROWSERTESTFAILURECODE_SERVER_CERTIFICATE, - SYNTHETICSBROWSERTESTFAILURECODE_SELECT_OPTION, - SYNTHETICSBROWSERTESTFAILURECODE_STEP_TIMEOUT, - SYNTHETICSBROWSERTESTFAILURECODE_SUB_TEST_NOT_PASSED, - SYNTHETICSBROWSERTESTFAILURECODE_TEST_TIMEOUT, - SYNTHETICSBROWSERTESTFAILURECODE_TOO_MANY_HTTP_REQUESTS, - SYNTHETICSBROWSERTESTFAILURECODE_UNAVAILABLE_BROWSER, - SYNTHETICSBROWSERTESTFAILURECODE_UNKNOWN, - SYNTHETICSBROWSERTESTFAILURECODE_UNSUPPORTED_AUTH_SCHEMA, - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_ELEMENT_TYPE, - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DIALOG, - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DYNAMIC_ELEMENT, - SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_NAME, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBrowserTestFailureCode) GetAllowedValues() []SyntheticsBrowserTestFailureCode { - return allowedSyntheticsBrowserTestFailureCodeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBrowserTestFailureCode) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBrowserTestFailureCode(value) - return nil -} - -// NewSyntheticsBrowserTestFailureCodeFromValue returns a pointer to a valid SyntheticsBrowserTestFailureCode -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBrowserTestFailureCodeFromValue(v string) (*SyntheticsBrowserTestFailureCode, error) { - ev := SyntheticsBrowserTestFailureCode(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserTestFailureCode: valid values are %v", v, allowedSyntheticsBrowserTestFailureCodeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBrowserTestFailureCode) IsValid() bool { - for _, existing := range allowedSyntheticsBrowserTestFailureCodeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBrowserTestFailureCode value. -func (v SyntheticsBrowserTestFailureCode) Ptr() *SyntheticsBrowserTestFailureCode { - return &v -} - -// NullableSyntheticsBrowserTestFailureCode handles when a null is used for SyntheticsBrowserTestFailureCode. -type NullableSyntheticsBrowserTestFailureCode struct { - value *SyntheticsBrowserTestFailureCode - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserTestFailureCode) Get() *SyntheticsBrowserTestFailureCode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserTestFailureCode) Set(val *SyntheticsBrowserTestFailureCode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserTestFailureCode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserTestFailureCode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserTestFailureCode initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserTestFailureCode(val *SyntheticsBrowserTestFailureCode) *NullableSyntheticsBrowserTestFailureCode { - return &NullableSyntheticsBrowserTestFailureCode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserTestFailureCode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserTestFailureCode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_data.go b/api/v1/datadog/model_synthetics_browser_test_result_data.go deleted file mode 100644 index 7df59a48de3..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_result_data.go +++ /dev/null @@ -1,546 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBrowserTestResultData Object containing results for your Synthetic browser test. -type SyntheticsBrowserTestResultData struct { - // Type of browser device used for the browser test. - BrowserType *string `json:"browserType,omitempty"` - // Browser version used for the browser test. - BrowserVersion *string `json:"browserVersion,omitempty"` - // Object describing the device used to perform the Synthetic test. - Device *SyntheticsDevice `json:"device,omitempty"` - // Global duration in second of the browser test. - Duration *float64 `json:"duration,omitempty"` - // Error returned for the browser test. - Error *string `json:"error,omitempty"` - // The browser test failure details. - Failure *SyntheticsBrowserTestResultFailure `json:"failure,omitempty"` - // Whether or not the browser test was conducted. - Passed *bool `json:"passed,omitempty"` - // The amount of email received during the browser test. - ReceivedEmailCount *int64 `json:"receivedEmailCount,omitempty"` - // Starting URL for the browser test. - StartUrl *string `json:"startUrl,omitempty"` - // Array containing the different browser test steps. - StepDetails []SyntheticsStepDetail `json:"stepDetails,omitempty"` - // Whether or not a thumbnail is associated with the browser test. - ThumbnailsBucketKey *bool `json:"thumbnailsBucketKey,omitempty"` - // Time in second to wait before the browser test starts after - // reaching the start URL. - TimeToInteractive *float64 `json:"timeToInteractive,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{} -} - -// NewSyntheticsBrowserTestResultData instantiates a new SyntheticsBrowserTestResultData 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 NewSyntheticsBrowserTestResultData() *SyntheticsBrowserTestResultData { - this := SyntheticsBrowserTestResultData{} - return &this -} - -// NewSyntheticsBrowserTestResultDataWithDefaults instantiates a new SyntheticsBrowserTestResultData 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 NewSyntheticsBrowserTestResultDataWithDefaults() *SyntheticsBrowserTestResultData { - this := SyntheticsBrowserTestResultData{} - return &this -} - -// GetBrowserType returns the BrowserType field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetBrowserType() string { - if o == nil || o.BrowserType == nil { - var ret string - return ret - } - return *o.BrowserType -} - -// GetBrowserTypeOk returns a tuple with the BrowserType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetBrowserTypeOk() (*string, bool) { - if o == nil || o.BrowserType == nil { - return nil, false - } - return o.BrowserType, true -} - -// HasBrowserType returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasBrowserType() bool { - if o != nil && o.BrowserType != nil { - return true - } - - return false -} - -// SetBrowserType gets a reference to the given string and assigns it to the BrowserType field. -func (o *SyntheticsBrowserTestResultData) SetBrowserType(v string) { - o.BrowserType = &v -} - -// GetBrowserVersion returns the BrowserVersion field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetBrowserVersion() string { - if o == nil || o.BrowserVersion == nil { - var ret string - return ret - } - return *o.BrowserVersion -} - -// GetBrowserVersionOk returns a tuple with the BrowserVersion field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetBrowserVersionOk() (*string, bool) { - if o == nil || o.BrowserVersion == nil { - return nil, false - } - return o.BrowserVersion, true -} - -// HasBrowserVersion returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasBrowserVersion() bool { - if o != nil && o.BrowserVersion != nil { - return true - } - - return false -} - -// SetBrowserVersion gets a reference to the given string and assigns it to the BrowserVersion field. -func (o *SyntheticsBrowserTestResultData) SetBrowserVersion(v string) { - o.BrowserVersion = &v -} - -// GetDevice returns the Device field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetDevice() SyntheticsDevice { - if o == nil || o.Device == nil { - var ret SyntheticsDevice - return ret - } - return *o.Device -} - -// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetDeviceOk() (*SyntheticsDevice, bool) { - if o == nil || o.Device == nil { - return nil, false - } - return o.Device, true -} - -// HasDevice returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasDevice() bool { - if o != nil && o.Device != nil { - return true - } - - return false -} - -// SetDevice gets a reference to the given SyntheticsDevice and assigns it to the Device field. -func (o *SyntheticsBrowserTestResultData) SetDevice(v SyntheticsDevice) { - o.Device = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetDuration() float64 { - if o == nil || o.Duration == nil { - var ret float64 - return ret - } - return *o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetDurationOk() (*float64, bool) { - if o == nil || o.Duration == nil { - return nil, false - } - return o.Duration, true -} - -// HasDuration returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasDuration() bool { - if o != nil && o.Duration != nil { - return true - } - - return false -} - -// SetDuration gets a reference to the given float64 and assigns it to the Duration field. -func (o *SyntheticsBrowserTestResultData) SetDuration(v float64) { - o.Duration = &v -} - -// GetError returns the Error field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetError() string { - if o == nil || o.Error == nil { - var ret string - return ret - } - return *o.Error -} - -// GetErrorOk returns a tuple with the Error field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetErrorOk() (*string, bool) { - if o == nil || o.Error == nil { - return nil, false - } - return o.Error, true -} - -// HasError returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasError() bool { - if o != nil && o.Error != nil { - return true - } - - return false -} - -// SetError gets a reference to the given string and assigns it to the Error field. -func (o *SyntheticsBrowserTestResultData) SetError(v string) { - o.Error = &v -} - -// GetFailure returns the Failure field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetFailure() SyntheticsBrowserTestResultFailure { - if o == nil || o.Failure == nil { - var ret SyntheticsBrowserTestResultFailure - return ret - } - return *o.Failure -} - -// GetFailureOk returns a tuple with the Failure field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetFailureOk() (*SyntheticsBrowserTestResultFailure, bool) { - if o == nil || o.Failure == nil { - return nil, false - } - return o.Failure, true -} - -// HasFailure returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasFailure() bool { - if o != nil && o.Failure != nil { - return true - } - - return false -} - -// SetFailure gets a reference to the given SyntheticsBrowserTestResultFailure and assigns it to the Failure field. -func (o *SyntheticsBrowserTestResultData) SetFailure(v SyntheticsBrowserTestResultFailure) { - o.Failure = &v -} - -// GetPassed returns the Passed field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetPassed() bool { - if o == nil || o.Passed == nil { - var ret bool - return ret - } - return *o.Passed -} - -// GetPassedOk returns a tuple with the Passed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetPassedOk() (*bool, bool) { - if o == nil || o.Passed == nil { - return nil, false - } - return o.Passed, true -} - -// HasPassed returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasPassed() bool { - if o != nil && o.Passed != nil { - return true - } - - return false -} - -// SetPassed gets a reference to the given bool and assigns it to the Passed field. -func (o *SyntheticsBrowserTestResultData) SetPassed(v bool) { - o.Passed = &v -} - -// GetReceivedEmailCount returns the ReceivedEmailCount field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetReceivedEmailCount() int64 { - if o == nil || o.ReceivedEmailCount == nil { - var ret int64 - return ret - } - return *o.ReceivedEmailCount -} - -// GetReceivedEmailCountOk returns a tuple with the ReceivedEmailCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetReceivedEmailCountOk() (*int64, bool) { - if o == nil || o.ReceivedEmailCount == nil { - return nil, false - } - return o.ReceivedEmailCount, true -} - -// HasReceivedEmailCount returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasReceivedEmailCount() bool { - if o != nil && o.ReceivedEmailCount != nil { - return true - } - - return false -} - -// SetReceivedEmailCount gets a reference to the given int64 and assigns it to the ReceivedEmailCount field. -func (o *SyntheticsBrowserTestResultData) SetReceivedEmailCount(v int64) { - o.ReceivedEmailCount = &v -} - -// GetStartUrl returns the StartUrl field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetStartUrl() string { - if o == nil || o.StartUrl == nil { - var ret string - return ret - } - return *o.StartUrl -} - -// GetStartUrlOk returns a tuple with the StartUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetStartUrlOk() (*string, bool) { - if o == nil || o.StartUrl == nil { - return nil, false - } - return o.StartUrl, true -} - -// HasStartUrl returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasStartUrl() bool { - if o != nil && o.StartUrl != nil { - return true - } - - return false -} - -// SetStartUrl gets a reference to the given string and assigns it to the StartUrl field. -func (o *SyntheticsBrowserTestResultData) SetStartUrl(v string) { - o.StartUrl = &v -} - -// GetStepDetails returns the StepDetails field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetStepDetails() []SyntheticsStepDetail { - if o == nil || o.StepDetails == nil { - var ret []SyntheticsStepDetail - return ret - } - return o.StepDetails -} - -// GetStepDetailsOk returns a tuple with the StepDetails field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetStepDetailsOk() (*[]SyntheticsStepDetail, bool) { - if o == nil || o.StepDetails == nil { - return nil, false - } - return &o.StepDetails, true -} - -// HasStepDetails returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasStepDetails() bool { - if o != nil && o.StepDetails != nil { - return true - } - - return false -} - -// SetStepDetails gets a reference to the given []SyntheticsStepDetail and assigns it to the StepDetails field. -func (o *SyntheticsBrowserTestResultData) SetStepDetails(v []SyntheticsStepDetail) { - o.StepDetails = v -} - -// GetThumbnailsBucketKey returns the ThumbnailsBucketKey field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetThumbnailsBucketKey() bool { - if o == nil || o.ThumbnailsBucketKey == nil { - var ret bool - return ret - } - return *o.ThumbnailsBucketKey -} - -// GetThumbnailsBucketKeyOk returns a tuple with the ThumbnailsBucketKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetThumbnailsBucketKeyOk() (*bool, bool) { - if o == nil || o.ThumbnailsBucketKey == nil { - return nil, false - } - return o.ThumbnailsBucketKey, true -} - -// HasThumbnailsBucketKey returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasThumbnailsBucketKey() bool { - if o != nil && o.ThumbnailsBucketKey != nil { - return true - } - - return false -} - -// SetThumbnailsBucketKey gets a reference to the given bool and assigns it to the ThumbnailsBucketKey field. -func (o *SyntheticsBrowserTestResultData) SetThumbnailsBucketKey(v bool) { - o.ThumbnailsBucketKey = &v -} - -// GetTimeToInteractive returns the TimeToInteractive field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultData) GetTimeToInteractive() float64 { - if o == nil || o.TimeToInteractive == nil { - var ret float64 - return ret - } - return *o.TimeToInteractive -} - -// GetTimeToInteractiveOk returns a tuple with the TimeToInteractive field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultData) GetTimeToInteractiveOk() (*float64, bool) { - if o == nil || o.TimeToInteractive == nil { - return nil, false - } - return o.TimeToInteractive, true -} - -// HasTimeToInteractive returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultData) HasTimeToInteractive() bool { - if o != nil && o.TimeToInteractive != nil { - return true - } - - return false -} - -// SetTimeToInteractive gets a reference to the given float64 and assigns it to the TimeToInteractive field. -func (o *SyntheticsBrowserTestResultData) SetTimeToInteractive(v float64) { - o.TimeToInteractive = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestResultData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BrowserType != nil { - toSerialize["browserType"] = o.BrowserType - } - if o.BrowserVersion != nil { - toSerialize["browserVersion"] = o.BrowserVersion - } - if o.Device != nil { - toSerialize["device"] = o.Device - } - if o.Duration != nil { - toSerialize["duration"] = o.Duration - } - if o.Error != nil { - toSerialize["error"] = o.Error - } - if o.Failure != nil { - toSerialize["failure"] = o.Failure - } - if o.Passed != nil { - toSerialize["passed"] = o.Passed - } - if o.ReceivedEmailCount != nil { - toSerialize["receivedEmailCount"] = o.ReceivedEmailCount - } - if o.StartUrl != nil { - toSerialize["startUrl"] = o.StartUrl - } - if o.StepDetails != nil { - toSerialize["stepDetails"] = o.StepDetails - } - if o.ThumbnailsBucketKey != nil { - toSerialize["thumbnailsBucketKey"] = o.ThumbnailsBucketKey - } - if o.TimeToInteractive != nil { - toSerialize["timeToInteractive"] = o.TimeToInteractive - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestResultData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BrowserType *string `json:"browserType,omitempty"` - BrowserVersion *string `json:"browserVersion,omitempty"` - Device *SyntheticsDevice `json:"device,omitempty"` - Duration *float64 `json:"duration,omitempty"` - Error *string `json:"error,omitempty"` - Failure *SyntheticsBrowserTestResultFailure `json:"failure,omitempty"` - Passed *bool `json:"passed,omitempty"` - ReceivedEmailCount *int64 `json:"receivedEmailCount,omitempty"` - StartUrl *string `json:"startUrl,omitempty"` - StepDetails []SyntheticsStepDetail `json:"stepDetails,omitempty"` - ThumbnailsBucketKey *bool `json:"thumbnailsBucketKey,omitempty"` - TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BrowserType = all.BrowserType - o.BrowserVersion = all.BrowserVersion - if all.Device != nil && all.Device.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Device = all.Device - o.Duration = all.Duration - o.Error = all.Error - if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Failure = all.Failure - o.Passed = all.Passed - o.ReceivedEmailCount = all.ReceivedEmailCount - o.StartUrl = all.StartUrl - o.StepDetails = all.StepDetails - o.ThumbnailsBucketKey = all.ThumbnailsBucketKey - o.TimeToInteractive = all.TimeToInteractive - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_failure.go b/api/v1/datadog/model_synthetics_browser_test_result_failure.go deleted file mode 100644 index de81093deae..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_result_failure.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBrowserTestResultFailure The browser test failure details. -type SyntheticsBrowserTestResultFailure struct { - // Error code that can be returned by a Synthetic test. - Code *SyntheticsBrowserTestFailureCode `json:"code,omitempty"` - // The browser test error message. - Message *string `json:"message,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{} -} - -// NewSyntheticsBrowserTestResultFailure instantiates a new SyntheticsBrowserTestResultFailure 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 NewSyntheticsBrowserTestResultFailure() *SyntheticsBrowserTestResultFailure { - this := SyntheticsBrowserTestResultFailure{} - return &this -} - -// NewSyntheticsBrowserTestResultFailureWithDefaults instantiates a new SyntheticsBrowserTestResultFailure 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 NewSyntheticsBrowserTestResultFailureWithDefaults() *SyntheticsBrowserTestResultFailure { - this := SyntheticsBrowserTestResultFailure{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFailure) GetCode() SyntheticsBrowserTestFailureCode { - if o == nil || o.Code == nil { - var ret SyntheticsBrowserTestFailureCode - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFailure) GetCodeOk() (*SyntheticsBrowserTestFailureCode, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFailure) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given SyntheticsBrowserTestFailureCode and assigns it to the Code field. -func (o *SyntheticsBrowserTestResultFailure) SetCode(v SyntheticsBrowserTestFailureCode) { - o.Code = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFailure) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFailure) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFailure) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SyntheticsBrowserTestResultFailure) SetMessage(v string) { - o.Message = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestResultFailure) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestResultFailure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *SyntheticsBrowserTestFailureCode `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Code; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_full.go b/api/v1/datadog/model_synthetics_browser_test_result_full.go deleted file mode 100644 index 94fe3ca74df..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_result_full.go +++ /dev/null @@ -1,361 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBrowserTestResultFull Object returned describing a browser test result. -type SyntheticsBrowserTestResultFull struct { - // Object describing the browser test configuration. - Check *SyntheticsBrowserTestResultFullCheck `json:"check,omitempty"` - // When the browser test was conducted. - CheckTime *float64 `json:"check_time,omitempty"` - // Version of the browser test used. - CheckVersion *int64 `json:"check_version,omitempty"` - // Location from which the browser test was performed. - ProbeDc *string `json:"probe_dc,omitempty"` - // Object containing results for your Synthetic browser test. - Result *SyntheticsBrowserTestResultData `json:"result,omitempty"` - // ID of the browser test result. - ResultId *string `json:"result_id,omitempty"` - // The status of your Synthetic monitor. - // * `O` for not triggered - // * `1` for triggered - // * `2` for no data - Status *SyntheticsTestMonitorStatus `json:"status,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{} -} - -// NewSyntheticsBrowserTestResultFull instantiates a new SyntheticsBrowserTestResultFull 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 NewSyntheticsBrowserTestResultFull() *SyntheticsBrowserTestResultFull { - this := SyntheticsBrowserTestResultFull{} - return &this -} - -// NewSyntheticsBrowserTestResultFullWithDefaults instantiates a new SyntheticsBrowserTestResultFull 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 NewSyntheticsBrowserTestResultFullWithDefaults() *SyntheticsBrowserTestResultFull { - this := SyntheticsBrowserTestResultFull{} - return &this -} - -// GetCheck returns the Check field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFull) GetCheck() SyntheticsBrowserTestResultFullCheck { - if o == nil || o.Check == nil { - var ret SyntheticsBrowserTestResultFullCheck - return ret - } - return *o.Check -} - -// GetCheckOk returns a tuple with the Check field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFull) GetCheckOk() (*SyntheticsBrowserTestResultFullCheck, bool) { - if o == nil || o.Check == nil { - return nil, false - } - return o.Check, true -} - -// HasCheck returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFull) HasCheck() bool { - if o != nil && o.Check != nil { - return true - } - - return false -} - -// SetCheck gets a reference to the given SyntheticsBrowserTestResultFullCheck and assigns it to the Check field. -func (o *SyntheticsBrowserTestResultFull) SetCheck(v SyntheticsBrowserTestResultFullCheck) { - o.Check = &v -} - -// GetCheckTime returns the CheckTime field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFull) GetCheckTime() float64 { - if o == nil || o.CheckTime == nil { - var ret float64 - return ret - } - return *o.CheckTime -} - -// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFull) GetCheckTimeOk() (*float64, bool) { - if o == nil || o.CheckTime == nil { - return nil, false - } - return o.CheckTime, true -} - -// HasCheckTime returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFull) HasCheckTime() bool { - if o != nil && o.CheckTime != nil { - return true - } - - return false -} - -// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. -func (o *SyntheticsBrowserTestResultFull) SetCheckTime(v float64) { - o.CheckTime = &v -} - -// GetCheckVersion returns the CheckVersion field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFull) GetCheckVersion() int64 { - if o == nil || o.CheckVersion == nil { - var ret int64 - return ret - } - return *o.CheckVersion -} - -// GetCheckVersionOk returns a tuple with the CheckVersion field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFull) GetCheckVersionOk() (*int64, bool) { - if o == nil || o.CheckVersion == nil { - return nil, false - } - return o.CheckVersion, true -} - -// HasCheckVersion returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFull) HasCheckVersion() bool { - if o != nil && o.CheckVersion != nil { - return true - } - - return false -} - -// SetCheckVersion gets a reference to the given int64 and assigns it to the CheckVersion field. -func (o *SyntheticsBrowserTestResultFull) SetCheckVersion(v int64) { - o.CheckVersion = &v -} - -// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFull) GetProbeDc() string { - if o == nil || o.ProbeDc == nil { - var ret string - return ret - } - return *o.ProbeDc -} - -// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFull) GetProbeDcOk() (*string, bool) { - if o == nil || o.ProbeDc == nil { - return nil, false - } - return o.ProbeDc, true -} - -// HasProbeDc returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFull) HasProbeDc() bool { - if o != nil && o.ProbeDc != nil { - return true - } - - return false -} - -// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. -func (o *SyntheticsBrowserTestResultFull) SetProbeDc(v string) { - o.ProbeDc = &v -} - -// GetResult returns the Result field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFull) GetResult() SyntheticsBrowserTestResultData { - if o == nil || o.Result == nil { - var ret SyntheticsBrowserTestResultData - return ret - } - return *o.Result -} - -// GetResultOk returns a tuple with the Result field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFull) GetResultOk() (*SyntheticsBrowserTestResultData, bool) { - if o == nil || o.Result == nil { - return nil, false - } - return o.Result, true -} - -// HasResult returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFull) HasResult() bool { - if o != nil && o.Result != nil { - return true - } - - return false -} - -// SetResult gets a reference to the given SyntheticsBrowserTestResultData and assigns it to the Result field. -func (o *SyntheticsBrowserTestResultFull) SetResult(v SyntheticsBrowserTestResultData) { - o.Result = &v -} - -// GetResultId returns the ResultId field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFull) GetResultId() string { - if o == nil || o.ResultId == nil { - var ret string - return ret - } - return *o.ResultId -} - -// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFull) GetResultIdOk() (*string, bool) { - if o == nil || o.ResultId == nil { - return nil, false - } - return o.ResultId, true -} - -// HasResultId returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFull) HasResultId() bool { - if o != nil && o.ResultId != nil { - return true - } - - return false -} - -// SetResultId gets a reference to the given string and assigns it to the ResultId field. -func (o *SyntheticsBrowserTestResultFull) SetResultId(v string) { - o.ResultId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultFull) GetStatus() SyntheticsTestMonitorStatus { - if o == nil || o.Status == nil { - var ret SyntheticsTestMonitorStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFull) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultFull) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. -func (o *SyntheticsBrowserTestResultFull) SetStatus(v SyntheticsTestMonitorStatus) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestResultFull) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Check != nil { - toSerialize["check"] = o.Check - } - if o.CheckTime != nil { - toSerialize["check_time"] = o.CheckTime - } - if o.CheckVersion != nil { - toSerialize["check_version"] = o.CheckVersion - } - if o.ProbeDc != nil { - toSerialize["probe_dc"] = o.ProbeDc - } - if o.Result != nil { - toSerialize["result"] = o.Result - } - if o.ResultId != nil { - toSerialize["result_id"] = o.ResultId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestResultFull) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Check *SyntheticsBrowserTestResultFullCheck `json:"check,omitempty"` - CheckTime *float64 `json:"check_time,omitempty"` - CheckVersion *int64 `json:"check_version,omitempty"` - ProbeDc *string `json:"probe_dc,omitempty"` - Result *SyntheticsBrowserTestResultData `json:"result,omitempty"` - ResultId *string `json:"result_id,omitempty"` - Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Check != nil && all.Check.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Check = all.Check - o.CheckTime = all.CheckTime - o.CheckVersion = all.CheckVersion - o.ProbeDc = all.ProbeDc - if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Result = all.Result - o.ResultId = all.ResultId - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_full_check.go b/api/v1/datadog/model_synthetics_browser_test_result_full_check.go deleted file mode 100644 index 58dd163e7e0..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_result_full_check.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserTestResultFullCheck Object describing the browser test configuration. -type SyntheticsBrowserTestResultFullCheck struct { - // Configuration object for a Synthetic test. - Config SyntheticsTestConfig `json:"config"` - // 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{} -} - -// NewSyntheticsBrowserTestResultFullCheck instantiates a new SyntheticsBrowserTestResultFullCheck 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 NewSyntheticsBrowserTestResultFullCheck(config SyntheticsTestConfig) *SyntheticsBrowserTestResultFullCheck { - this := SyntheticsBrowserTestResultFullCheck{} - this.Config = config - return &this -} - -// NewSyntheticsBrowserTestResultFullCheckWithDefaults instantiates a new SyntheticsBrowserTestResultFullCheck 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 NewSyntheticsBrowserTestResultFullCheckWithDefaults() *SyntheticsBrowserTestResultFullCheck { - this := SyntheticsBrowserTestResultFullCheck{} - return &this -} - -// GetConfig returns the Config field value. -func (o *SyntheticsBrowserTestResultFullCheck) GetConfig() SyntheticsTestConfig { - if o == nil { - var ret SyntheticsTestConfig - return ret - } - return o.Config -} - -// GetConfigOk returns a tuple with the Config field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultFullCheck) GetConfigOk() (*SyntheticsTestConfig, bool) { - if o == nil { - return nil, false - } - return &o.Config, true -} - -// SetConfig sets field value. -func (o *SyntheticsBrowserTestResultFullCheck) SetConfig(v SyntheticsTestConfig) { - o.Config = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestResultFullCheck) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["config"] = o.Config - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Config *SyntheticsTestConfig `json:"config"` - }{} - all := struct { - Config SyntheticsTestConfig `json:"config"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Config == nil { - return fmt.Errorf("Required field config missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Config = all.Config - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_short.go b/api/v1/datadog/model_synthetics_browser_test_result_short.go deleted file mode 100644 index 156b12edd88..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_result_short.go +++ /dev/null @@ -1,276 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBrowserTestResultShort Object with the results of a single Synthetic browser test. -type SyntheticsBrowserTestResultShort struct { - // Last time the browser test was performed. - CheckTime *float64 `json:"check_time,omitempty"` - // Location from which the Browser test was performed. - ProbeDc *string `json:"probe_dc,omitempty"` - // Object with the result of the last browser test run. - Result *SyntheticsBrowserTestResultShortResult `json:"result,omitempty"` - // ID of the browser test result. - ResultId *string `json:"result_id,omitempty"` - // The status of your Synthetic monitor. - // * `O` for not triggered - // * `1` for triggered - // * `2` for no data - Status *SyntheticsTestMonitorStatus `json:"status,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{} -} - -// NewSyntheticsBrowserTestResultShort instantiates a new SyntheticsBrowserTestResultShort 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 NewSyntheticsBrowserTestResultShort() *SyntheticsBrowserTestResultShort { - this := SyntheticsBrowserTestResultShort{} - return &this -} - -// NewSyntheticsBrowserTestResultShortWithDefaults instantiates a new SyntheticsBrowserTestResultShort 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 NewSyntheticsBrowserTestResultShortWithDefaults() *SyntheticsBrowserTestResultShort { - this := SyntheticsBrowserTestResultShort{} - return &this -} - -// GetCheckTime returns the CheckTime field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShort) GetCheckTime() float64 { - if o == nil || o.CheckTime == nil { - var ret float64 - return ret - } - return *o.CheckTime -} - -// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShort) GetCheckTimeOk() (*float64, bool) { - if o == nil || o.CheckTime == nil { - return nil, false - } - return o.CheckTime, true -} - -// HasCheckTime returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShort) HasCheckTime() bool { - if o != nil && o.CheckTime != nil { - return true - } - - return false -} - -// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. -func (o *SyntheticsBrowserTestResultShort) SetCheckTime(v float64) { - o.CheckTime = &v -} - -// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShort) GetProbeDc() string { - if o == nil || o.ProbeDc == nil { - var ret string - return ret - } - return *o.ProbeDc -} - -// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShort) GetProbeDcOk() (*string, bool) { - if o == nil || o.ProbeDc == nil { - return nil, false - } - return o.ProbeDc, true -} - -// HasProbeDc returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShort) HasProbeDc() bool { - if o != nil && o.ProbeDc != nil { - return true - } - - return false -} - -// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. -func (o *SyntheticsBrowserTestResultShort) SetProbeDc(v string) { - o.ProbeDc = &v -} - -// GetResult returns the Result field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShort) GetResult() SyntheticsBrowserTestResultShortResult { - if o == nil || o.Result == nil { - var ret SyntheticsBrowserTestResultShortResult - return ret - } - return *o.Result -} - -// GetResultOk returns a tuple with the Result field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShort) GetResultOk() (*SyntheticsBrowserTestResultShortResult, bool) { - if o == nil || o.Result == nil { - return nil, false - } - return o.Result, true -} - -// HasResult returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShort) HasResult() bool { - if o != nil && o.Result != nil { - return true - } - - return false -} - -// SetResult gets a reference to the given SyntheticsBrowserTestResultShortResult and assigns it to the Result field. -func (o *SyntheticsBrowserTestResultShort) SetResult(v SyntheticsBrowserTestResultShortResult) { - o.Result = &v -} - -// GetResultId returns the ResultId field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShort) GetResultId() string { - if o == nil || o.ResultId == nil { - var ret string - return ret - } - return *o.ResultId -} - -// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShort) GetResultIdOk() (*string, bool) { - if o == nil || o.ResultId == nil { - return nil, false - } - return o.ResultId, true -} - -// HasResultId returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShort) HasResultId() bool { - if o != nil && o.ResultId != nil { - return true - } - - return false -} - -// SetResultId gets a reference to the given string and assigns it to the ResultId field. -func (o *SyntheticsBrowserTestResultShort) SetResultId(v string) { - o.ResultId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShort) GetStatus() SyntheticsTestMonitorStatus { - if o == nil || o.Status == nil { - var ret SyntheticsTestMonitorStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShort) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShort) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. -func (o *SyntheticsBrowserTestResultShort) SetStatus(v SyntheticsTestMonitorStatus) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestResultShort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CheckTime != nil { - toSerialize["check_time"] = o.CheckTime - } - if o.ProbeDc != nil { - toSerialize["probe_dc"] = o.ProbeDc - } - if o.Result != nil { - toSerialize["result"] = o.Result - } - if o.ResultId != nil { - toSerialize["result_id"] = o.ResultId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestResultShort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CheckTime *float64 `json:"check_time,omitempty"` - ProbeDc *string `json:"probe_dc,omitempty"` - Result *SyntheticsBrowserTestResultShortResult `json:"result,omitempty"` - ResultId *string `json:"result_id,omitempty"` - Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CheckTime = all.CheckTime - o.ProbeDc = all.ProbeDc - if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Result = all.Result - o.ResultId = all.ResultId - o.Status = all.Status - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_short_result.go b/api/v1/datadog/model_synthetics_browser_test_result_short_result.go deleted file mode 100644 index 2312614f6a8..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_result_short_result.go +++ /dev/null @@ -1,265 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsBrowserTestResultShortResult Object with the result of the last browser test run. -type SyntheticsBrowserTestResultShortResult struct { - // Object describing the device used to perform the Synthetic test. - Device *SyntheticsDevice `json:"device,omitempty"` - // Length in milliseconds of the browser test run. - Duration *float64 `json:"duration,omitempty"` - // Amount of errors collected for a single browser test run. - ErrorCount *int64 `json:"errorCount,omitempty"` - // Amount of browser test steps completed before failing. - StepCountCompleted *int64 `json:"stepCountCompleted,omitempty"` - // Total amount of browser test steps. - StepCountTotal *int64 `json:"stepCountTotal,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{} -} - -// NewSyntheticsBrowserTestResultShortResult instantiates a new SyntheticsBrowserTestResultShortResult 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 NewSyntheticsBrowserTestResultShortResult() *SyntheticsBrowserTestResultShortResult { - this := SyntheticsBrowserTestResultShortResult{} - return &this -} - -// NewSyntheticsBrowserTestResultShortResultWithDefaults instantiates a new SyntheticsBrowserTestResultShortResult 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 NewSyntheticsBrowserTestResultShortResultWithDefaults() *SyntheticsBrowserTestResultShortResult { - this := SyntheticsBrowserTestResultShortResult{} - return &this -} - -// GetDevice returns the Device field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShortResult) GetDevice() SyntheticsDevice { - if o == nil || o.Device == nil { - var ret SyntheticsDevice - return ret - } - return *o.Device -} - -// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShortResult) GetDeviceOk() (*SyntheticsDevice, bool) { - if o == nil || o.Device == nil { - return nil, false - } - return o.Device, true -} - -// HasDevice returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShortResult) HasDevice() bool { - if o != nil && o.Device != nil { - return true - } - - return false -} - -// SetDevice gets a reference to the given SyntheticsDevice and assigns it to the Device field. -func (o *SyntheticsBrowserTestResultShortResult) SetDevice(v SyntheticsDevice) { - o.Device = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShortResult) GetDuration() float64 { - if o == nil || o.Duration == nil { - var ret float64 - return ret - } - return *o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShortResult) GetDurationOk() (*float64, bool) { - if o == nil || o.Duration == nil { - return nil, false - } - return o.Duration, true -} - -// HasDuration returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShortResult) HasDuration() bool { - if o != nil && o.Duration != nil { - return true - } - - return false -} - -// SetDuration gets a reference to the given float64 and assigns it to the Duration field. -func (o *SyntheticsBrowserTestResultShortResult) SetDuration(v float64) { - o.Duration = &v -} - -// GetErrorCount returns the ErrorCount field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShortResult) GetErrorCount() int64 { - if o == nil || o.ErrorCount == nil { - var ret int64 - return ret - } - return *o.ErrorCount -} - -// GetErrorCountOk returns a tuple with the ErrorCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShortResult) GetErrorCountOk() (*int64, bool) { - if o == nil || o.ErrorCount == nil { - return nil, false - } - return o.ErrorCount, true -} - -// HasErrorCount returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShortResult) HasErrorCount() bool { - if o != nil && o.ErrorCount != nil { - return true - } - - return false -} - -// SetErrorCount gets a reference to the given int64 and assigns it to the ErrorCount field. -func (o *SyntheticsBrowserTestResultShortResult) SetErrorCount(v int64) { - o.ErrorCount = &v -} - -// GetStepCountCompleted returns the StepCountCompleted field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShortResult) GetStepCountCompleted() int64 { - if o == nil || o.StepCountCompleted == nil { - var ret int64 - return ret - } - return *o.StepCountCompleted -} - -// GetStepCountCompletedOk returns a tuple with the StepCountCompleted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShortResult) GetStepCountCompletedOk() (*int64, bool) { - if o == nil || o.StepCountCompleted == nil { - return nil, false - } - return o.StepCountCompleted, true -} - -// HasStepCountCompleted returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShortResult) HasStepCountCompleted() bool { - if o != nil && o.StepCountCompleted != nil { - return true - } - - return false -} - -// SetStepCountCompleted gets a reference to the given int64 and assigns it to the StepCountCompleted field. -func (o *SyntheticsBrowserTestResultShortResult) SetStepCountCompleted(v int64) { - o.StepCountCompleted = &v -} - -// GetStepCountTotal returns the StepCountTotal field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestResultShortResult) GetStepCountTotal() int64 { - if o == nil || o.StepCountTotal == nil { - var ret int64 - return ret - } - return *o.StepCountTotal -} - -// GetStepCountTotalOk returns a tuple with the StepCountTotal field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestResultShortResult) GetStepCountTotalOk() (*int64, bool) { - if o == nil || o.StepCountTotal == nil { - return nil, false - } - return o.StepCountTotal, true -} - -// HasStepCountTotal returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestResultShortResult) HasStepCountTotal() bool { - if o != nil && o.StepCountTotal != nil { - return true - } - - return false -} - -// SetStepCountTotal gets a reference to the given int64 and assigns it to the StepCountTotal field. -func (o *SyntheticsBrowserTestResultShortResult) SetStepCountTotal(v int64) { - o.StepCountTotal = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestResultShortResult) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Device != nil { - toSerialize["device"] = o.Device - } - if o.Duration != nil { - toSerialize["duration"] = o.Duration - } - if o.ErrorCount != nil { - toSerialize["errorCount"] = o.ErrorCount - } - if o.StepCountCompleted != nil { - toSerialize["stepCountCompleted"] = o.StepCountCompleted - } - if o.StepCountTotal != nil { - toSerialize["stepCountTotal"] = o.StepCountTotal - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestResultShortResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Device *SyntheticsDevice `json:"device,omitempty"` - Duration *float64 `json:"duration,omitempty"` - ErrorCount *int64 `json:"errorCount,omitempty"` - StepCountCompleted *int64 `json:"stepCountCompleted,omitempty"` - StepCountTotal *int64 `json:"stepCountTotal,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Device != nil && all.Device.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Device = all.Device - o.Duration = all.Duration - o.ErrorCount = all.ErrorCount - o.StepCountCompleted = all.StepCountCompleted - o.StepCountTotal = all.StepCountTotal - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_rum_settings.go b/api/v1/datadog/model_synthetics_browser_test_rum_settings.go deleted file mode 100644 index 356a5890d1a..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_rum_settings.go +++ /dev/null @@ -1,191 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserTestRumSettings The RUM data collection settings for the Synthetic browser test. -// **Note:** There are 3 ways to format RUM settings: -// -// `{ isEnabled: false }` -// RUM data is not collected. -// -// `{ isEnabled: true }` -// RUM data is collected from the Synthetic test's default application. -// -// `{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 }` -// RUM data is collected using the specified application. -type SyntheticsBrowserTestRumSettings struct { - // RUM application ID used to collect RUM data for the browser test. - ApplicationId *string `json:"applicationId,omitempty"` - // RUM application API key ID used to collect RUM data for the browser test. - ClientTokenId *int64 `json:"clientTokenId,omitempty"` - // Determines whether RUM data is collected during test runs. - IsEnabled bool `json:"isEnabled"` - // 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{} -} - -// NewSyntheticsBrowserTestRumSettings instantiates a new SyntheticsBrowserTestRumSettings 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 NewSyntheticsBrowserTestRumSettings(isEnabled bool) *SyntheticsBrowserTestRumSettings { - this := SyntheticsBrowserTestRumSettings{} - this.IsEnabled = isEnabled - return &this -} - -// NewSyntheticsBrowserTestRumSettingsWithDefaults instantiates a new SyntheticsBrowserTestRumSettings 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 NewSyntheticsBrowserTestRumSettingsWithDefaults() *SyntheticsBrowserTestRumSettings { - this := SyntheticsBrowserTestRumSettings{} - return &this -} - -// GetApplicationId returns the ApplicationId field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestRumSettings) GetApplicationId() string { - if o == nil || o.ApplicationId == nil { - var ret string - return ret - } - return *o.ApplicationId -} - -// GetApplicationIdOk returns a tuple with the ApplicationId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestRumSettings) GetApplicationIdOk() (*string, bool) { - if o == nil || o.ApplicationId == nil { - return nil, false - } - return o.ApplicationId, true -} - -// HasApplicationId returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestRumSettings) HasApplicationId() bool { - if o != nil && o.ApplicationId != nil { - return true - } - - return false -} - -// SetApplicationId gets a reference to the given string and assigns it to the ApplicationId field. -func (o *SyntheticsBrowserTestRumSettings) SetApplicationId(v string) { - o.ApplicationId = &v -} - -// GetClientTokenId returns the ClientTokenId field value if set, zero value otherwise. -func (o *SyntheticsBrowserTestRumSettings) GetClientTokenId() int64 { - if o == nil || o.ClientTokenId == nil { - var ret int64 - return ret - } - return *o.ClientTokenId -} - -// GetClientTokenIdOk returns a tuple with the ClientTokenId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestRumSettings) GetClientTokenIdOk() (*int64, bool) { - if o == nil || o.ClientTokenId == nil { - return nil, false - } - return o.ClientTokenId, true -} - -// HasClientTokenId returns a boolean if a field has been set. -func (o *SyntheticsBrowserTestRumSettings) HasClientTokenId() bool { - if o != nil && o.ClientTokenId != nil { - return true - } - - return false -} - -// SetClientTokenId gets a reference to the given int64 and assigns it to the ClientTokenId field. -func (o *SyntheticsBrowserTestRumSettings) SetClientTokenId(v int64) { - o.ClientTokenId = &v -} - -// GetIsEnabled returns the IsEnabled field value. -func (o *SyntheticsBrowserTestRumSettings) GetIsEnabled() bool { - if o == nil { - var ret bool - return ret - } - return o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserTestRumSettings) GetIsEnabledOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.IsEnabled, true -} - -// SetIsEnabled sets field value. -func (o *SyntheticsBrowserTestRumSettings) SetIsEnabled(v bool) { - o.IsEnabled = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserTestRumSettings) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApplicationId != nil { - toSerialize["applicationId"] = o.ApplicationId - } - if o.ClientTokenId != nil { - toSerialize["clientTokenId"] = o.ClientTokenId - } - toSerialize["isEnabled"] = o.IsEnabled - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserTestRumSettings) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - IsEnabled *bool `json:"isEnabled"` - }{} - all := struct { - ApplicationId *string `json:"applicationId,omitempty"` - ClientTokenId *int64 `json:"clientTokenId,omitempty"` - IsEnabled bool `json:"isEnabled"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IsEnabled == nil { - return fmt.Errorf("Required field isEnabled missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ApplicationId = all.ApplicationId - o.ClientTokenId = all.ClientTokenId - o.IsEnabled = all.IsEnabled - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_test_type.go b/api/v1/datadog/model_synthetics_browser_test_type.go deleted file mode 100644 index 4db9b7e1eec..00000000000 --- a/api/v1/datadog/model_synthetics_browser_test_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserTestType Type of the Synthetic test, `browser`. -type SyntheticsBrowserTestType string - -// List of SyntheticsBrowserTestType. -const ( - SYNTHETICSBROWSERTESTTYPE_BROWSER SyntheticsBrowserTestType = "browser" -) - -var allowedSyntheticsBrowserTestTypeEnumValues = []SyntheticsBrowserTestType{ - SYNTHETICSBROWSERTESTTYPE_BROWSER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBrowserTestType) GetAllowedValues() []SyntheticsBrowserTestType { - return allowedSyntheticsBrowserTestTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBrowserTestType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBrowserTestType(value) - return nil -} - -// NewSyntheticsBrowserTestTypeFromValue returns a pointer to a valid SyntheticsBrowserTestType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBrowserTestTypeFromValue(v string) (*SyntheticsBrowserTestType, error) { - ev := SyntheticsBrowserTestType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserTestType: valid values are %v", v, allowedSyntheticsBrowserTestTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBrowserTestType) IsValid() bool { - for _, existing := range allowedSyntheticsBrowserTestTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBrowserTestType value. -func (v SyntheticsBrowserTestType) Ptr() *SyntheticsBrowserTestType { - return &v -} - -// NullableSyntheticsBrowserTestType handles when a null is used for SyntheticsBrowserTestType. -type NullableSyntheticsBrowserTestType struct { - value *SyntheticsBrowserTestType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserTestType) Get() *SyntheticsBrowserTestType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserTestType) Set(val *SyntheticsBrowserTestType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserTestType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserTestType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserTestType initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserTestType(val *SyntheticsBrowserTestType) *NullableSyntheticsBrowserTestType { - return &NullableSyntheticsBrowserTestType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserTestType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserTestType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_browser_variable.go b/api/v1/datadog/model_synthetics_browser_variable.go deleted file mode 100644 index d836ba9c039..00000000000 --- a/api/v1/datadog/model_synthetics_browser_variable.go +++ /dev/null @@ -1,262 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserVariable Object defining a variable that can be used in your browser test. -// Learn more in the [Browser test Actions documentation](https://docs.datadoghq.com/synthetics/browser_tests/actions#variable). -type SyntheticsBrowserVariable struct { - // Example for the variable. - Example *string `json:"example,omitempty"` - // ID for the variable. Global variables require an ID. - Id *string `json:"id,omitempty"` - // Name of the variable. - Name string `json:"name"` - // Pattern of the variable. - Pattern *string `json:"pattern,omitempty"` - // Type of browser test variable. - Type SyntheticsBrowserVariableType `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{} -} - -// NewSyntheticsBrowserVariable instantiates a new SyntheticsBrowserVariable 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 NewSyntheticsBrowserVariable(name string, typeVar SyntheticsBrowserVariableType) *SyntheticsBrowserVariable { - this := SyntheticsBrowserVariable{} - this.Name = name - this.Type = typeVar - return &this -} - -// NewSyntheticsBrowserVariableWithDefaults instantiates a new SyntheticsBrowserVariable 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 NewSyntheticsBrowserVariableWithDefaults() *SyntheticsBrowserVariable { - this := SyntheticsBrowserVariable{} - return &this -} - -// GetExample returns the Example field value if set, zero value otherwise. -func (o *SyntheticsBrowserVariable) GetExample() string { - if o == nil || o.Example == nil { - var ret string - return ret - } - return *o.Example -} - -// GetExampleOk returns a tuple with the Example field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserVariable) GetExampleOk() (*string, bool) { - if o == nil || o.Example == nil { - return nil, false - } - return o.Example, true -} - -// HasExample returns a boolean if a field has been set. -func (o *SyntheticsBrowserVariable) HasExample() bool { - if o != nil && o.Example != nil { - return true - } - - return false -} - -// SetExample gets a reference to the given string and assigns it to the Example field. -func (o *SyntheticsBrowserVariable) SetExample(v string) { - o.Example = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsBrowserVariable) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserVariable) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsBrowserVariable) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SyntheticsBrowserVariable) SetId(v string) { - o.Id = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsBrowserVariable) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserVariable) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsBrowserVariable) SetName(v string) { - o.Name = v -} - -// GetPattern returns the Pattern field value if set, zero value otherwise. -func (o *SyntheticsBrowserVariable) GetPattern() string { - if o == nil || o.Pattern == nil { - var ret string - return ret - } - return *o.Pattern -} - -// GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsBrowserVariable) GetPatternOk() (*string, bool) { - if o == nil || o.Pattern == nil { - return nil, false - } - return o.Pattern, true -} - -// HasPattern returns a boolean if a field has been set. -func (o *SyntheticsBrowserVariable) HasPattern() bool { - if o != nil && o.Pattern != nil { - return true - } - - return false -} - -// SetPattern gets a reference to the given string and assigns it to the Pattern field. -func (o *SyntheticsBrowserVariable) SetPattern(v string) { - o.Pattern = &v -} - -// GetType returns the Type field value. -func (o *SyntheticsBrowserVariable) GetType() SyntheticsBrowserVariableType { - if o == nil { - var ret SyntheticsBrowserVariableType - 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 *SyntheticsBrowserVariable) GetTypeOk() (*SyntheticsBrowserVariableType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsBrowserVariable) SetType(v SyntheticsBrowserVariableType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsBrowserVariable) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Example != nil { - toSerialize["example"] = o.Example - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - toSerialize["name"] = o.Name - if o.Pattern != nil { - toSerialize["pattern"] = o.Pattern - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Type *SyntheticsBrowserVariableType `json:"type"` - }{} - all := struct { - Example *string `json:"example,omitempty"` - Id *string `json:"id,omitempty"` - Name string `json:"name"` - Pattern *string `json:"pattern,omitempty"` - Type SyntheticsBrowserVariableType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Example = all.Example - o.Id = all.Id - o.Name = all.Name - o.Pattern = all.Pattern - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_browser_variable_type.go b/api/v1/datadog/model_synthetics_browser_variable_type.go deleted file mode 100644 index c59c03c0bfe..00000000000 --- a/api/v1/datadog/model_synthetics_browser_variable_type.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsBrowserVariableType Type of browser test variable. -type SyntheticsBrowserVariableType string - -// List of SyntheticsBrowserVariableType. -const ( - SYNTHETICSBROWSERVARIABLETYPE_ELEMENT SyntheticsBrowserVariableType = "element" - SYNTHETICSBROWSERVARIABLETYPE_EMAIL SyntheticsBrowserVariableType = "email" - SYNTHETICSBROWSERVARIABLETYPE_GLOBAL SyntheticsBrowserVariableType = "global" - SYNTHETICSBROWSERVARIABLETYPE_JAVASCRIPT SyntheticsBrowserVariableType = "javascript" - SYNTHETICSBROWSERVARIABLETYPE_TEXT SyntheticsBrowserVariableType = "text" -) - -var allowedSyntheticsBrowserVariableTypeEnumValues = []SyntheticsBrowserVariableType{ - SYNTHETICSBROWSERVARIABLETYPE_ELEMENT, - SYNTHETICSBROWSERVARIABLETYPE_EMAIL, - SYNTHETICSBROWSERVARIABLETYPE_GLOBAL, - SYNTHETICSBROWSERVARIABLETYPE_JAVASCRIPT, - SYNTHETICSBROWSERVARIABLETYPE_TEXT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsBrowserVariableType) GetAllowedValues() []SyntheticsBrowserVariableType { - return allowedSyntheticsBrowserVariableTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsBrowserVariableType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsBrowserVariableType(value) - return nil -} - -// NewSyntheticsBrowserVariableTypeFromValue returns a pointer to a valid SyntheticsBrowserVariableType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsBrowserVariableTypeFromValue(v string) (*SyntheticsBrowserVariableType, error) { - ev := SyntheticsBrowserVariableType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserVariableType: valid values are %v", v, allowedSyntheticsBrowserVariableTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsBrowserVariableType) IsValid() bool { - for _, existing := range allowedSyntheticsBrowserVariableTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsBrowserVariableType value. -func (v SyntheticsBrowserVariableType) Ptr() *SyntheticsBrowserVariableType { - return &v -} - -// NullableSyntheticsBrowserVariableType handles when a null is used for SyntheticsBrowserVariableType. -type NullableSyntheticsBrowserVariableType struct { - value *SyntheticsBrowserVariableType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsBrowserVariableType) Get() *SyntheticsBrowserVariableType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsBrowserVariableType) Set(val *SyntheticsBrowserVariableType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsBrowserVariableType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsBrowserVariableType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsBrowserVariableType initializes the struct as if Set has been called. -func NewNullableSyntheticsBrowserVariableType(val *SyntheticsBrowserVariableType) *NullableSyntheticsBrowserVariableType { - return &NullableSyntheticsBrowserVariableType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsBrowserVariableType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsBrowserVariableType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_check_type.go b/api/v1/datadog/model_synthetics_check_type.go deleted file mode 100644 index 109a18c7788..00000000000 --- a/api/v1/datadog/model_synthetics_check_type.go +++ /dev/null @@ -1,133 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsCheckType Type of assertion to apply in an API test. -type SyntheticsCheckType string - -// List of SyntheticsCheckType. -const ( - SYNTHETICSCHECKTYPE_EQUALS SyntheticsCheckType = "equals" - SYNTHETICSCHECKTYPE_NOT_EQUALS SyntheticsCheckType = "notEquals" - SYNTHETICSCHECKTYPE_CONTAINS SyntheticsCheckType = "contains" - SYNTHETICSCHECKTYPE_NOT_CONTAINS SyntheticsCheckType = "notContains" - SYNTHETICSCHECKTYPE_STARTS_WITH SyntheticsCheckType = "startsWith" - SYNTHETICSCHECKTYPE_NOT_STARTS_WITH SyntheticsCheckType = "notStartsWith" - SYNTHETICSCHECKTYPE_GREATER SyntheticsCheckType = "greater" - SYNTHETICSCHECKTYPE_LOWER SyntheticsCheckType = "lower" - SYNTHETICSCHECKTYPE_GREATER_EQUALS SyntheticsCheckType = "greaterEquals" - SYNTHETICSCHECKTYPE_LOWER_EQUALS SyntheticsCheckType = "lowerEquals" - SYNTHETICSCHECKTYPE_MATCH_REGEX SyntheticsCheckType = "matchRegex" - SYNTHETICSCHECKTYPE_BETWEEN SyntheticsCheckType = "between" - SYNTHETICSCHECKTYPE_IS_EMPTY SyntheticsCheckType = "isEmpty" - SYNTHETICSCHECKTYPE_NOT_IS_EMPTY SyntheticsCheckType = "notIsEmpty" -) - -var allowedSyntheticsCheckTypeEnumValues = []SyntheticsCheckType{ - SYNTHETICSCHECKTYPE_EQUALS, - SYNTHETICSCHECKTYPE_NOT_EQUALS, - SYNTHETICSCHECKTYPE_CONTAINS, - SYNTHETICSCHECKTYPE_NOT_CONTAINS, - SYNTHETICSCHECKTYPE_STARTS_WITH, - SYNTHETICSCHECKTYPE_NOT_STARTS_WITH, - SYNTHETICSCHECKTYPE_GREATER, - SYNTHETICSCHECKTYPE_LOWER, - SYNTHETICSCHECKTYPE_GREATER_EQUALS, - SYNTHETICSCHECKTYPE_LOWER_EQUALS, - SYNTHETICSCHECKTYPE_MATCH_REGEX, - SYNTHETICSCHECKTYPE_BETWEEN, - SYNTHETICSCHECKTYPE_IS_EMPTY, - SYNTHETICSCHECKTYPE_NOT_IS_EMPTY, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsCheckType) GetAllowedValues() []SyntheticsCheckType { - return allowedSyntheticsCheckTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsCheckType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsCheckType(value) - return nil -} - -// NewSyntheticsCheckTypeFromValue returns a pointer to a valid SyntheticsCheckType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsCheckTypeFromValue(v string) (*SyntheticsCheckType, error) { - ev := SyntheticsCheckType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsCheckType: valid values are %v", v, allowedSyntheticsCheckTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsCheckType) IsValid() bool { - for _, existing := range allowedSyntheticsCheckTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsCheckType value. -func (v SyntheticsCheckType) Ptr() *SyntheticsCheckType { - return &v -} - -// NullableSyntheticsCheckType handles when a null is used for SyntheticsCheckType. -type NullableSyntheticsCheckType struct { - value *SyntheticsCheckType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsCheckType) Get() *SyntheticsCheckType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsCheckType) Set(val *SyntheticsCheckType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsCheckType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsCheckType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsCheckType initializes the struct as if Set has been called. -func NewNullableSyntheticsCheckType(val *SyntheticsCheckType) *NullableSyntheticsCheckType { - return &NullableSyntheticsCheckType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsCheckType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsCheckType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata.go b/api/v1/datadog/model_synthetics_ci_batch_metadata.go deleted file mode 100644 index 479e6b8d7b8..00000000000 --- a/api/v1/datadog/model_synthetics_ci_batch_metadata.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsCIBatchMetadata Metadata for the Synthetics tests run. -type SyntheticsCIBatchMetadata struct { - // Description of the CI provider. - Ci *SyntheticsCIBatchMetadataCI `json:"ci,omitempty"` - // Git information. - Git *SyntheticsCIBatchMetadataGit `json:"git,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{} -} - -// NewSyntheticsCIBatchMetadata instantiates a new SyntheticsCIBatchMetadata 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 NewSyntheticsCIBatchMetadata() *SyntheticsCIBatchMetadata { - this := SyntheticsCIBatchMetadata{} - return &this -} - -// NewSyntheticsCIBatchMetadataWithDefaults instantiates a new SyntheticsCIBatchMetadata 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 NewSyntheticsCIBatchMetadataWithDefaults() *SyntheticsCIBatchMetadata { - this := SyntheticsCIBatchMetadata{} - return &this -} - -// GetCi returns the Ci field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadata) GetCi() SyntheticsCIBatchMetadataCI { - if o == nil || o.Ci == nil { - var ret SyntheticsCIBatchMetadataCI - return ret - } - return *o.Ci -} - -// GetCiOk returns a tuple with the Ci field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadata) GetCiOk() (*SyntheticsCIBatchMetadataCI, bool) { - if o == nil || o.Ci == nil { - return nil, false - } - return o.Ci, true -} - -// HasCi returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadata) HasCi() bool { - if o != nil && o.Ci != nil { - return true - } - - return false -} - -// SetCi gets a reference to the given SyntheticsCIBatchMetadataCI and assigns it to the Ci field. -func (o *SyntheticsCIBatchMetadata) SetCi(v SyntheticsCIBatchMetadataCI) { - o.Ci = &v -} - -// GetGit returns the Git field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadata) GetGit() SyntheticsCIBatchMetadataGit { - if o == nil || o.Git == nil { - var ret SyntheticsCIBatchMetadataGit - return ret - } - return *o.Git -} - -// GetGitOk returns a tuple with the Git field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadata) GetGitOk() (*SyntheticsCIBatchMetadataGit, bool) { - if o == nil || o.Git == nil { - return nil, false - } - return o.Git, true -} - -// HasGit returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadata) HasGit() bool { - if o != nil && o.Git != nil { - return true - } - - return false -} - -// SetGit gets a reference to the given SyntheticsCIBatchMetadataGit and assigns it to the Git field. -func (o *SyntheticsCIBatchMetadata) SetGit(v SyntheticsCIBatchMetadataGit) { - o.Git = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCIBatchMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Ci != nil { - toSerialize["ci"] = o.Ci - } - if o.Git != nil { - toSerialize["git"] = o.Git - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCIBatchMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Ci *SyntheticsCIBatchMetadataCI `json:"ci,omitempty"` - Git *SyntheticsCIBatchMetadataGit `json:"git,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Ci != nil && all.Ci.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Ci = all.Ci - if all.Git != nil && all.Git.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Git = all.Git - return nil -} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go deleted file mode 100644 index 357ce0b2f1b..00000000000 --- a/api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsCIBatchMetadataCI Description of the CI provider. -type SyntheticsCIBatchMetadataCI struct { - // Description of the CI pipeline. - Pipeline *SyntheticsCIBatchMetadataPipeline `json:"pipeline,omitempty"` - // Description of the CI provider. - Provider *SyntheticsCIBatchMetadataProvider `json:"provider,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{} -} - -// NewSyntheticsCIBatchMetadataCI instantiates a new SyntheticsCIBatchMetadataCI 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 NewSyntheticsCIBatchMetadataCI() *SyntheticsCIBatchMetadataCI { - this := SyntheticsCIBatchMetadataCI{} - return &this -} - -// NewSyntheticsCIBatchMetadataCIWithDefaults instantiates a new SyntheticsCIBatchMetadataCI 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 NewSyntheticsCIBatchMetadataCIWithDefaults() *SyntheticsCIBatchMetadataCI { - this := SyntheticsCIBatchMetadataCI{} - return &this -} - -// GetPipeline returns the Pipeline field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadataCI) GetPipeline() SyntheticsCIBatchMetadataPipeline { - if o == nil || o.Pipeline == nil { - var ret SyntheticsCIBatchMetadataPipeline - return ret - } - return *o.Pipeline -} - -// GetPipelineOk returns a tuple with the Pipeline field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadataCI) GetPipelineOk() (*SyntheticsCIBatchMetadataPipeline, bool) { - if o == nil || o.Pipeline == nil { - return nil, false - } - return o.Pipeline, true -} - -// HasPipeline returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadataCI) HasPipeline() bool { - if o != nil && o.Pipeline != nil { - return true - } - - return false -} - -// SetPipeline gets a reference to the given SyntheticsCIBatchMetadataPipeline and assigns it to the Pipeline field. -func (o *SyntheticsCIBatchMetadataCI) SetPipeline(v SyntheticsCIBatchMetadataPipeline) { - o.Pipeline = &v -} - -// GetProvider returns the Provider field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadataCI) GetProvider() SyntheticsCIBatchMetadataProvider { - if o == nil || o.Provider == nil { - var ret SyntheticsCIBatchMetadataProvider - return ret - } - return *o.Provider -} - -// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadataCI) GetProviderOk() (*SyntheticsCIBatchMetadataProvider, bool) { - if o == nil || o.Provider == nil { - return nil, false - } - return o.Provider, true -} - -// HasProvider returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadataCI) HasProvider() bool { - if o != nil && o.Provider != nil { - return true - } - - return false -} - -// SetProvider gets a reference to the given SyntheticsCIBatchMetadataProvider and assigns it to the Provider field. -func (o *SyntheticsCIBatchMetadataCI) SetProvider(v SyntheticsCIBatchMetadataProvider) { - o.Provider = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCIBatchMetadataCI) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Pipeline != nil { - toSerialize["pipeline"] = o.Pipeline - } - if o.Provider != nil { - toSerialize["provider"] = o.Provider - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCIBatchMetadataCI) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Pipeline *SyntheticsCIBatchMetadataPipeline `json:"pipeline,omitempty"` - Provider *SyntheticsCIBatchMetadataProvider `json:"provider,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Pipeline != nil && all.Pipeline.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pipeline = all.Pipeline - if all.Provider != nil && all.Provider.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Provider = all.Provider - return nil -} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go deleted file mode 100644 index 6b1e65c99fe..00000000000 --- a/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsCIBatchMetadataGit Git information. -type SyntheticsCIBatchMetadataGit struct { - // Branch name. - Branch *string `json:"branch,omitempty"` - // The commit SHA. - CommitSha *string `json:"commitSha,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{} -} - -// NewSyntheticsCIBatchMetadataGit instantiates a new SyntheticsCIBatchMetadataGit 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 NewSyntheticsCIBatchMetadataGit() *SyntheticsCIBatchMetadataGit { - this := SyntheticsCIBatchMetadataGit{} - return &this -} - -// NewSyntheticsCIBatchMetadataGitWithDefaults instantiates a new SyntheticsCIBatchMetadataGit 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 NewSyntheticsCIBatchMetadataGitWithDefaults() *SyntheticsCIBatchMetadataGit { - this := SyntheticsCIBatchMetadataGit{} - return &this -} - -// GetBranch returns the Branch field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadataGit) GetBranch() string { - if o == nil || o.Branch == nil { - var ret string - return ret - } - return *o.Branch -} - -// GetBranchOk returns a tuple with the Branch field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadataGit) GetBranchOk() (*string, bool) { - if o == nil || o.Branch == nil { - return nil, false - } - return o.Branch, true -} - -// HasBranch returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadataGit) HasBranch() bool { - if o != nil && o.Branch != nil { - return true - } - - return false -} - -// SetBranch gets a reference to the given string and assigns it to the Branch field. -func (o *SyntheticsCIBatchMetadataGit) SetBranch(v string) { - o.Branch = &v -} - -// GetCommitSha returns the CommitSha field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadataGit) GetCommitSha() string { - if o == nil || o.CommitSha == nil { - var ret string - return ret - } - return *o.CommitSha -} - -// GetCommitShaOk returns a tuple with the CommitSha field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadataGit) GetCommitShaOk() (*string, bool) { - if o == nil || o.CommitSha == nil { - return nil, false - } - return o.CommitSha, true -} - -// HasCommitSha returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadataGit) HasCommitSha() bool { - if o != nil && o.CommitSha != nil { - return true - } - - return false -} - -// SetCommitSha gets a reference to the given string and assigns it to the CommitSha field. -func (o *SyntheticsCIBatchMetadataGit) SetCommitSha(v string) { - o.CommitSha = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCIBatchMetadataGit) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Branch != nil { - toSerialize["branch"] = o.Branch - } - if o.CommitSha != nil { - toSerialize["commitSha"] = o.CommitSha - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCIBatchMetadataGit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Branch *string `json:"branch,omitempty"` - CommitSha *string `json:"commitSha,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Branch = all.Branch - o.CommitSha = all.CommitSha - return nil -} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.go deleted file mode 100644 index d6a4940152e..00000000000 --- a/api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsCIBatchMetadataPipeline Description of the CI pipeline. -type SyntheticsCIBatchMetadataPipeline struct { - // URL of the pipeline. - Url *string `json:"url,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{} -} - -// NewSyntheticsCIBatchMetadataPipeline instantiates a new SyntheticsCIBatchMetadataPipeline 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 NewSyntheticsCIBatchMetadataPipeline() *SyntheticsCIBatchMetadataPipeline { - this := SyntheticsCIBatchMetadataPipeline{} - return &this -} - -// NewSyntheticsCIBatchMetadataPipelineWithDefaults instantiates a new SyntheticsCIBatchMetadataPipeline 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 NewSyntheticsCIBatchMetadataPipelineWithDefaults() *SyntheticsCIBatchMetadataPipeline { - this := SyntheticsCIBatchMetadataPipeline{} - return &this -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadataPipeline) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadataPipeline) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadataPipeline) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *SyntheticsCIBatchMetadataPipeline) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCIBatchMetadataPipeline) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCIBatchMetadataPipeline) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_provider.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_provider.go deleted file mode 100644 index 2916c5beeed..00000000000 --- a/api/v1/datadog/model_synthetics_ci_batch_metadata_provider.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsCIBatchMetadataProvider Description of the CI provider. -type SyntheticsCIBatchMetadataProvider struct { - // Name of the CI provider. - Name *string `json:"name,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{} -} - -// NewSyntheticsCIBatchMetadataProvider instantiates a new SyntheticsCIBatchMetadataProvider 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 NewSyntheticsCIBatchMetadataProvider() *SyntheticsCIBatchMetadataProvider { - this := SyntheticsCIBatchMetadataProvider{} - return &this -} - -// NewSyntheticsCIBatchMetadataProviderWithDefaults instantiates a new SyntheticsCIBatchMetadataProvider 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 NewSyntheticsCIBatchMetadataProviderWithDefaults() *SyntheticsCIBatchMetadataProvider { - this := SyntheticsCIBatchMetadataProvider{} - return &this -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SyntheticsCIBatchMetadataProvider) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCIBatchMetadataProvider) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SyntheticsCIBatchMetadataProvider) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SyntheticsCIBatchMetadataProvider) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCIBatchMetadataProvider) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCIBatchMetadataProvider) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_synthetics_ci_test_.go b/api/v1/datadog/model_synthetics_ci_test_.go deleted file mode 100644 index c8124fac889..00000000000 --- a/api/v1/datadog/model_synthetics_ci_test_.go +++ /dev/null @@ -1,624 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsCITest Test configuration for Synthetics CI -type SyntheticsCITest struct { - // Disable certificate checks in API tests. - AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"` - // Object to handle basic authentication when performing the test. - BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` - // Body to include in the test. - Body *string `json:"body,omitempty"` - // Type of the data sent in a synthetics API test. - BodyType *string `json:"bodyType,omitempty"` - // Cookies for the request. - Cookies *string `json:"cookies,omitempty"` - // For browser test, array with the different device IDs used to run the test. - DeviceIds []SyntheticsDeviceID `json:"deviceIds,omitempty"` - // For API HTTP test, whether or not the test should follow redirects. - FollowRedirects *bool `json:"followRedirects,omitempty"` - // Headers to include when performing the test. - Headers map[string]string `json:"headers,omitempty"` - // Array of locations used to run the test. - Locations []string `json:"locations,omitempty"` - // Metadata for the Synthetics tests run. - Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - // The public ID of the Synthetics test to trigger. - PublicId string `json:"public_id"` - // Object describing the retry strategy to apply to a Synthetic test. - Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - // Starting URL for the browser test. - StartUrl *string `json:"startUrl,omitempty"` - // Variables to replace in the test. - Variables map[string]string `json:"variables,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{} -} - -// NewSyntheticsCITest instantiates a new SyntheticsCITest 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 NewSyntheticsCITest(publicId string) *SyntheticsCITest { - this := SyntheticsCITest{} - this.PublicId = publicId - return &this -} - -// NewSyntheticsCITestWithDefaults instantiates a new SyntheticsCITest 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 NewSyntheticsCITestWithDefaults() *SyntheticsCITest { - this := SyntheticsCITest{} - return &this -} - -// GetAllowInsecureCertificates returns the AllowInsecureCertificates field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetAllowInsecureCertificates() bool { - if o == nil || o.AllowInsecureCertificates == nil { - var ret bool - return ret - } - return *o.AllowInsecureCertificates -} - -// GetAllowInsecureCertificatesOk returns a tuple with the AllowInsecureCertificates field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetAllowInsecureCertificatesOk() (*bool, bool) { - if o == nil || o.AllowInsecureCertificates == nil { - return nil, false - } - return o.AllowInsecureCertificates, true -} - -// HasAllowInsecureCertificates returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasAllowInsecureCertificates() bool { - if o != nil && o.AllowInsecureCertificates != nil { - return true - } - - return false -} - -// SetAllowInsecureCertificates gets a reference to the given bool and assigns it to the AllowInsecureCertificates field. -func (o *SyntheticsCITest) SetAllowInsecureCertificates(v bool) { - o.AllowInsecureCertificates = &v -} - -// GetBasicAuth returns the BasicAuth field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetBasicAuth() SyntheticsBasicAuth { - if o == nil || o.BasicAuth == nil { - var ret SyntheticsBasicAuth - return ret - } - return *o.BasicAuth -} - -// GetBasicAuthOk returns a tuple with the BasicAuth field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetBasicAuthOk() (*SyntheticsBasicAuth, bool) { - if o == nil || o.BasicAuth == nil { - return nil, false - } - return o.BasicAuth, true -} - -// HasBasicAuth returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasBasicAuth() bool { - if o != nil && o.BasicAuth != nil { - return true - } - - return false -} - -// SetBasicAuth gets a reference to the given SyntheticsBasicAuth and assigns it to the BasicAuth field. -func (o *SyntheticsCITest) SetBasicAuth(v SyntheticsBasicAuth) { - o.BasicAuth = &v -} - -// GetBody returns the Body field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetBody() string { - if o == nil || o.Body == nil { - var ret string - return ret - } - return *o.Body -} - -// GetBodyOk returns a tuple with the Body field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetBodyOk() (*string, bool) { - if o == nil || o.Body == nil { - return nil, false - } - return o.Body, true -} - -// HasBody returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasBody() bool { - if o != nil && o.Body != nil { - return true - } - - return false -} - -// SetBody gets a reference to the given string and assigns it to the Body field. -func (o *SyntheticsCITest) SetBody(v string) { - o.Body = &v -} - -// GetBodyType returns the BodyType field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetBodyType() string { - if o == nil || o.BodyType == nil { - var ret string - return ret - } - return *o.BodyType -} - -// GetBodyTypeOk returns a tuple with the BodyType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetBodyTypeOk() (*string, bool) { - if o == nil || o.BodyType == nil { - return nil, false - } - return o.BodyType, true -} - -// HasBodyType returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasBodyType() bool { - if o != nil && o.BodyType != nil { - return true - } - - return false -} - -// SetBodyType gets a reference to the given string and assigns it to the BodyType field. -func (o *SyntheticsCITest) SetBodyType(v string) { - o.BodyType = &v -} - -// GetCookies returns the Cookies field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetCookies() string { - if o == nil || o.Cookies == nil { - var ret string - return ret - } - return *o.Cookies -} - -// GetCookiesOk returns a tuple with the Cookies field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetCookiesOk() (*string, bool) { - if o == nil || o.Cookies == nil { - return nil, false - } - return o.Cookies, true -} - -// HasCookies returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasCookies() bool { - if o != nil && o.Cookies != nil { - return true - } - - return false -} - -// SetCookies gets a reference to the given string and assigns it to the Cookies field. -func (o *SyntheticsCITest) SetCookies(v string) { - o.Cookies = &v -} - -// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetDeviceIds() []SyntheticsDeviceID { - if o == nil || o.DeviceIds == nil { - var ret []SyntheticsDeviceID - return ret - } - return o.DeviceIds -} - -// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetDeviceIdsOk() (*[]SyntheticsDeviceID, bool) { - if o == nil || o.DeviceIds == nil { - return nil, false - } - return &o.DeviceIds, true -} - -// HasDeviceIds returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasDeviceIds() bool { - if o != nil && o.DeviceIds != nil { - return true - } - - return false -} - -// SetDeviceIds gets a reference to the given []SyntheticsDeviceID and assigns it to the DeviceIds field. -func (o *SyntheticsCITest) SetDeviceIds(v []SyntheticsDeviceID) { - o.DeviceIds = v -} - -// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetFollowRedirects() bool { - if o == nil || o.FollowRedirects == nil { - var ret bool - return ret - } - return *o.FollowRedirects -} - -// GetFollowRedirectsOk returns a tuple with the FollowRedirects field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetFollowRedirectsOk() (*bool, bool) { - if o == nil || o.FollowRedirects == nil { - return nil, false - } - return o.FollowRedirects, true -} - -// HasFollowRedirects returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasFollowRedirects() bool { - if o != nil && o.FollowRedirects != nil { - return true - } - - return false -} - -// SetFollowRedirects gets a reference to the given bool and assigns it to the FollowRedirects field. -func (o *SyntheticsCITest) SetFollowRedirects(v bool) { - o.FollowRedirects = &v -} - -// GetHeaders returns the Headers field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetHeaders() map[string]string { - if o == nil || o.Headers == nil { - var ret map[string]string - return ret - } - return o.Headers -} - -// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetHeadersOk() (*map[string]string, bool) { - if o == nil || o.Headers == nil { - return nil, false - } - return &o.Headers, true -} - -// HasHeaders returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasHeaders() bool { - if o != nil && o.Headers != nil { - return true - } - - return false -} - -// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field. -func (o *SyntheticsCITest) SetHeaders(v map[string]string) { - o.Headers = v -} - -// GetLocations returns the Locations field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetLocations() []string { - if o == nil || o.Locations == nil { - var ret []string - return ret - } - return o.Locations -} - -// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetLocationsOk() (*[]string, bool) { - if o == nil || o.Locations == nil { - return nil, false - } - return &o.Locations, true -} - -// HasLocations returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasLocations() bool { - if o != nil && o.Locations != nil { - return true - } - - return false -} - -// SetLocations gets a reference to the given []string and assigns it to the Locations field. -func (o *SyntheticsCITest) SetLocations(v []string) { - o.Locations = v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetMetadata() SyntheticsCIBatchMetadata { - if o == nil || o.Metadata == nil { - var ret SyntheticsCIBatchMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetMetadataOk() (*SyntheticsCIBatchMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given SyntheticsCIBatchMetadata and assigns it to the Metadata field. -func (o *SyntheticsCITest) SetMetadata(v SyntheticsCIBatchMetadata) { - o.Metadata = &v -} - -// GetPublicId returns the PublicId field value. -func (o *SyntheticsCITest) GetPublicId() string { - if o == nil { - var ret string - return ret - } - return o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetPublicIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.PublicId, true -} - -// SetPublicId sets field value. -func (o *SyntheticsCITest) SetPublicId(v string) { - o.PublicId = v -} - -// GetRetry returns the Retry field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetRetry() SyntheticsTestOptionsRetry { - if o == nil || o.Retry == nil { - var ret SyntheticsTestOptionsRetry - return ret - } - return *o.Retry -} - -// GetRetryOk returns a tuple with the Retry field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetRetryOk() (*SyntheticsTestOptionsRetry, bool) { - if o == nil || o.Retry == nil { - return nil, false - } - return o.Retry, true -} - -// HasRetry returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasRetry() bool { - if o != nil && o.Retry != nil { - return true - } - - return false -} - -// SetRetry gets a reference to the given SyntheticsTestOptionsRetry and assigns it to the Retry field. -func (o *SyntheticsCITest) SetRetry(v SyntheticsTestOptionsRetry) { - o.Retry = &v -} - -// GetStartUrl returns the StartUrl field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetStartUrl() string { - if o == nil || o.StartUrl == nil { - var ret string - return ret - } - return *o.StartUrl -} - -// GetStartUrlOk returns a tuple with the StartUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetStartUrlOk() (*string, bool) { - if o == nil || o.StartUrl == nil { - return nil, false - } - return o.StartUrl, true -} - -// HasStartUrl returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasStartUrl() bool { - if o != nil && o.StartUrl != nil { - return true - } - - return false -} - -// SetStartUrl gets a reference to the given string and assigns it to the StartUrl field. -func (o *SyntheticsCITest) SetStartUrl(v string) { - o.StartUrl = &v -} - -// GetVariables returns the Variables field value if set, zero value otherwise. -func (o *SyntheticsCITest) GetVariables() map[string]string { - if o == nil || o.Variables == nil { - var ret map[string]string - return ret - } - return o.Variables -} - -// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITest) GetVariablesOk() (*map[string]string, bool) { - if o == nil || o.Variables == nil { - return nil, false - } - return &o.Variables, true -} - -// HasVariables returns a boolean if a field has been set. -func (o *SyntheticsCITest) HasVariables() bool { - if o != nil && o.Variables != nil { - return true - } - - return false -} - -// SetVariables gets a reference to the given map[string]string and assigns it to the Variables field. -func (o *SyntheticsCITest) SetVariables(v map[string]string) { - o.Variables = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCITest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AllowInsecureCertificates != nil { - toSerialize["allowInsecureCertificates"] = o.AllowInsecureCertificates - } - if o.BasicAuth != nil { - toSerialize["basicAuth"] = o.BasicAuth - } - if o.Body != nil { - toSerialize["body"] = o.Body - } - if o.BodyType != nil { - toSerialize["bodyType"] = o.BodyType - } - if o.Cookies != nil { - toSerialize["cookies"] = o.Cookies - } - if o.DeviceIds != nil { - toSerialize["deviceIds"] = o.DeviceIds - } - if o.FollowRedirects != nil { - toSerialize["followRedirects"] = o.FollowRedirects - } - if o.Headers != nil { - toSerialize["headers"] = o.Headers - } - if o.Locations != nil { - toSerialize["locations"] = o.Locations - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - toSerialize["public_id"] = o.PublicId - if o.Retry != nil { - toSerialize["retry"] = o.Retry - } - if o.StartUrl != nil { - toSerialize["startUrl"] = o.StartUrl - } - if o.Variables != nil { - toSerialize["variables"] = o.Variables - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - PublicId *string `json:"public_id"` - }{} - all := struct { - AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"` - BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` - Body *string `json:"body,omitempty"` - BodyType *string `json:"bodyType,omitempty"` - Cookies *string `json:"cookies,omitempty"` - DeviceIds []SyntheticsDeviceID `json:"deviceIds,omitempty"` - FollowRedirects *bool `json:"followRedirects,omitempty"` - Headers map[string]string `json:"headers,omitempty"` - Locations []string `json:"locations,omitempty"` - Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - PublicId string `json:"public_id"` - Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - StartUrl *string `json:"startUrl,omitempty"` - Variables map[string]string `json:"variables,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.PublicId == nil { - return fmt.Errorf("Required field public_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AllowInsecureCertificates = all.AllowInsecureCertificates - o.BasicAuth = all.BasicAuth - o.Body = all.Body - o.BodyType = all.BodyType - o.Cookies = all.Cookies - o.DeviceIds = all.DeviceIds - o.FollowRedirects = all.FollowRedirects - o.Headers = all.Headers - o.Locations = all.Locations - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.PublicId = all.PublicId - if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Retry = all.Retry - o.StartUrl = all.StartUrl - o.Variables = all.Variables - return nil -} diff --git a/api/v1/datadog/model_synthetics_ci_test_body.go b/api/v1/datadog/model_synthetics_ci_test_body.go deleted file mode 100644 index c8967377318..00000000000 --- a/api/v1/datadog/model_synthetics_ci_test_body.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsCITestBody Object describing the synthetics tests to trigger. -type SyntheticsCITestBody struct { - // Individual synthetics test. - Tests []SyntheticsCITest `json:"tests,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{} -} - -// NewSyntheticsCITestBody instantiates a new SyntheticsCITestBody 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 NewSyntheticsCITestBody() *SyntheticsCITestBody { - this := SyntheticsCITestBody{} - return &this -} - -// NewSyntheticsCITestBodyWithDefaults instantiates a new SyntheticsCITestBody 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 NewSyntheticsCITestBodyWithDefaults() *SyntheticsCITestBody { - this := SyntheticsCITestBody{} - return &this -} - -// GetTests returns the Tests field value if set, zero value otherwise. -func (o *SyntheticsCITestBody) GetTests() []SyntheticsCITest { - if o == nil || o.Tests == nil { - var ret []SyntheticsCITest - return ret - } - return o.Tests -} - -// GetTestsOk returns a tuple with the Tests field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCITestBody) GetTestsOk() (*[]SyntheticsCITest, bool) { - if o == nil || o.Tests == nil { - return nil, false - } - return &o.Tests, true -} - -// HasTests returns a boolean if a field has been set. -func (o *SyntheticsCITestBody) HasTests() bool { - if o != nil && o.Tests != nil { - return true - } - - return false -} - -// SetTests gets a reference to the given []SyntheticsCITest and assigns it to the Tests field. -func (o *SyntheticsCITestBody) SetTests(v []SyntheticsCITest) { - o.Tests = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCITestBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Tests != nil { - toSerialize["tests"] = o.Tests - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCITestBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Tests []SyntheticsCITest `json:"tests,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Tests = all.Tests - return nil -} diff --git a/api/v1/datadog/model_synthetics_config_variable.go b/api/v1/datadog/model_synthetics_config_variable.go deleted file mode 100644 index 31dcb2517cf..00000000000 --- a/api/v1/datadog/model_synthetics_config_variable.go +++ /dev/null @@ -1,261 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsConfigVariable Object defining a variable that can be used in your test configuration. -type SyntheticsConfigVariable struct { - // Example for the variable. - Example *string `json:"example,omitempty"` - // ID of the variable for global variables. - Id *string `json:"id,omitempty"` - // Name of the variable. - Name string `json:"name"` - // Pattern of the variable. - Pattern *string `json:"pattern,omitempty"` - // Type of the configuration variable. - Type SyntheticsConfigVariableType `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{} -} - -// NewSyntheticsConfigVariable instantiates a new SyntheticsConfigVariable 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 NewSyntheticsConfigVariable(name string, typeVar SyntheticsConfigVariableType) *SyntheticsConfigVariable { - this := SyntheticsConfigVariable{} - this.Name = name - this.Type = typeVar - return &this -} - -// NewSyntheticsConfigVariableWithDefaults instantiates a new SyntheticsConfigVariable 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 NewSyntheticsConfigVariableWithDefaults() *SyntheticsConfigVariable { - this := SyntheticsConfigVariable{} - return &this -} - -// GetExample returns the Example field value if set, zero value otherwise. -func (o *SyntheticsConfigVariable) GetExample() string { - if o == nil || o.Example == nil { - var ret string - return ret - } - return *o.Example -} - -// GetExampleOk returns a tuple with the Example field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsConfigVariable) GetExampleOk() (*string, bool) { - if o == nil || o.Example == nil { - return nil, false - } - return o.Example, true -} - -// HasExample returns a boolean if a field has been set. -func (o *SyntheticsConfigVariable) HasExample() bool { - if o != nil && o.Example != nil { - return true - } - - return false -} - -// SetExample gets a reference to the given string and assigns it to the Example field. -func (o *SyntheticsConfigVariable) SetExample(v string) { - o.Example = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsConfigVariable) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsConfigVariable) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsConfigVariable) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SyntheticsConfigVariable) SetId(v string) { - o.Id = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsConfigVariable) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsConfigVariable) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsConfigVariable) SetName(v string) { - o.Name = v -} - -// GetPattern returns the Pattern field value if set, zero value otherwise. -func (o *SyntheticsConfigVariable) GetPattern() string { - if o == nil || o.Pattern == nil { - var ret string - return ret - } - return *o.Pattern -} - -// GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsConfigVariable) GetPatternOk() (*string, bool) { - if o == nil || o.Pattern == nil { - return nil, false - } - return o.Pattern, true -} - -// HasPattern returns a boolean if a field has been set. -func (o *SyntheticsConfigVariable) HasPattern() bool { - if o != nil && o.Pattern != nil { - return true - } - - return false -} - -// SetPattern gets a reference to the given string and assigns it to the Pattern field. -func (o *SyntheticsConfigVariable) SetPattern(v string) { - o.Pattern = &v -} - -// GetType returns the Type field value. -func (o *SyntheticsConfigVariable) GetType() SyntheticsConfigVariableType { - if o == nil { - var ret SyntheticsConfigVariableType - 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 *SyntheticsConfigVariable) GetTypeOk() (*SyntheticsConfigVariableType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsConfigVariable) SetType(v SyntheticsConfigVariableType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsConfigVariable) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Example != nil { - toSerialize["example"] = o.Example - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - toSerialize["name"] = o.Name - if o.Pattern != nil { - toSerialize["pattern"] = o.Pattern - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Type *SyntheticsConfigVariableType `json:"type"` - }{} - all := struct { - Example *string `json:"example,omitempty"` - Id *string `json:"id,omitempty"` - Name string `json:"name"` - Pattern *string `json:"pattern,omitempty"` - Type SyntheticsConfigVariableType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Example = all.Example - o.Id = all.Id - o.Name = all.Name - o.Pattern = all.Pattern - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_config_variable_type.go b/api/v1/datadog/model_synthetics_config_variable_type.go deleted file mode 100644 index a880574355e..00000000000 --- a/api/v1/datadog/model_synthetics_config_variable_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsConfigVariableType Type of the configuration variable. -type SyntheticsConfigVariableType string - -// List of SyntheticsConfigVariableType. -const ( - SYNTHETICSCONFIGVARIABLETYPE_GLOBAL SyntheticsConfigVariableType = "global" - SYNTHETICSCONFIGVARIABLETYPE_TEXT SyntheticsConfigVariableType = "text" -) - -var allowedSyntheticsConfigVariableTypeEnumValues = []SyntheticsConfigVariableType{ - SYNTHETICSCONFIGVARIABLETYPE_GLOBAL, - SYNTHETICSCONFIGVARIABLETYPE_TEXT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsConfigVariableType) GetAllowedValues() []SyntheticsConfigVariableType { - return allowedSyntheticsConfigVariableTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsConfigVariableType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsConfigVariableType(value) - return nil -} - -// NewSyntheticsConfigVariableTypeFromValue returns a pointer to a valid SyntheticsConfigVariableType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsConfigVariableTypeFromValue(v string) (*SyntheticsConfigVariableType, error) { - ev := SyntheticsConfigVariableType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsConfigVariableType: valid values are %v", v, allowedSyntheticsConfigVariableTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsConfigVariableType) IsValid() bool { - for _, existing := range allowedSyntheticsConfigVariableTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsConfigVariableType value. -func (v SyntheticsConfigVariableType) Ptr() *SyntheticsConfigVariableType { - return &v -} - -// NullableSyntheticsConfigVariableType handles when a null is used for SyntheticsConfigVariableType. -type NullableSyntheticsConfigVariableType struct { - value *SyntheticsConfigVariableType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsConfigVariableType) Get() *SyntheticsConfigVariableType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsConfigVariableType) Set(val *SyntheticsConfigVariableType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsConfigVariableType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsConfigVariableType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsConfigVariableType initializes the struct as if Set has been called. -func NewNullableSyntheticsConfigVariableType(val *SyntheticsConfigVariableType) *NullableSyntheticsConfigVariableType { - return &NullableSyntheticsConfigVariableType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsConfigVariableType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsConfigVariableType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_core_web_vitals.go b/api/v1/datadog/model_synthetics_core_web_vitals.go deleted file mode 100644 index ff84ec43aa2..00000000000 --- a/api/v1/datadog/model_synthetics_core_web_vitals.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsCoreWebVitals Core Web Vitals attached to a browser test step. -type SyntheticsCoreWebVitals struct { - // Cumulative Layout Shift. - Cls *float64 `json:"cls,omitempty"` - // Largest Contentful Paint in milliseconds. - Lcp *float64 `json:"lcp,omitempty"` - // URL attached to the metrics. - Url *string `json:"url,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{} -} - -// NewSyntheticsCoreWebVitals instantiates a new SyntheticsCoreWebVitals 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 NewSyntheticsCoreWebVitals() *SyntheticsCoreWebVitals { - this := SyntheticsCoreWebVitals{} - return &this -} - -// NewSyntheticsCoreWebVitalsWithDefaults instantiates a new SyntheticsCoreWebVitals 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 NewSyntheticsCoreWebVitalsWithDefaults() *SyntheticsCoreWebVitals { - this := SyntheticsCoreWebVitals{} - return &this -} - -// GetCls returns the Cls field value if set, zero value otherwise. -func (o *SyntheticsCoreWebVitals) GetCls() float64 { - if o == nil || o.Cls == nil { - var ret float64 - return ret - } - return *o.Cls -} - -// GetClsOk returns a tuple with the Cls field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCoreWebVitals) GetClsOk() (*float64, bool) { - if o == nil || o.Cls == nil { - return nil, false - } - return o.Cls, true -} - -// HasCls returns a boolean if a field has been set. -func (o *SyntheticsCoreWebVitals) HasCls() bool { - if o != nil && o.Cls != nil { - return true - } - - return false -} - -// SetCls gets a reference to the given float64 and assigns it to the Cls field. -func (o *SyntheticsCoreWebVitals) SetCls(v float64) { - o.Cls = &v -} - -// GetLcp returns the Lcp field value if set, zero value otherwise. -func (o *SyntheticsCoreWebVitals) GetLcp() float64 { - if o == nil || o.Lcp == nil { - var ret float64 - return ret - } - return *o.Lcp -} - -// GetLcpOk returns a tuple with the Lcp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCoreWebVitals) GetLcpOk() (*float64, bool) { - if o == nil || o.Lcp == nil { - return nil, false - } - return o.Lcp, true -} - -// HasLcp returns a boolean if a field has been set. -func (o *SyntheticsCoreWebVitals) HasLcp() bool { - if o != nil && o.Lcp != nil { - return true - } - - return false -} - -// SetLcp gets a reference to the given float64 and assigns it to the Lcp field. -func (o *SyntheticsCoreWebVitals) SetLcp(v float64) { - o.Lcp = &v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *SyntheticsCoreWebVitals) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsCoreWebVitals) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *SyntheticsCoreWebVitals) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *SyntheticsCoreWebVitals) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsCoreWebVitals) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cls != nil { - toSerialize["cls"] = o.Cls - } - if o.Lcp != nil { - toSerialize["lcp"] = o.Lcp - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsCoreWebVitals) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cls *float64 `json:"cls,omitempty"` - Lcp *float64 `json:"lcp,omitempty"` - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cls = all.Cls - o.Lcp = all.Lcp - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_synthetics_delete_tests_payload.go b/api/v1/datadog/model_synthetics_delete_tests_payload.go deleted file mode 100644 index 4b8c3c2c00f..00000000000 --- a/api/v1/datadog/model_synthetics_delete_tests_payload.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsDeleteTestsPayload A JSON list of the ID or IDs of the Synthetic tests that you want -// to delete. -type SyntheticsDeleteTestsPayload struct { - // An array of Synthetic test IDs you want to delete. - PublicIds []string `json:"public_ids,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{} -} - -// NewSyntheticsDeleteTestsPayload instantiates a new SyntheticsDeleteTestsPayload 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 NewSyntheticsDeleteTestsPayload() *SyntheticsDeleteTestsPayload { - this := SyntheticsDeleteTestsPayload{} - return &this -} - -// NewSyntheticsDeleteTestsPayloadWithDefaults instantiates a new SyntheticsDeleteTestsPayload 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 NewSyntheticsDeleteTestsPayloadWithDefaults() *SyntheticsDeleteTestsPayload { - this := SyntheticsDeleteTestsPayload{} - return &this -} - -// GetPublicIds returns the PublicIds field value if set, zero value otherwise. -func (o *SyntheticsDeleteTestsPayload) GetPublicIds() []string { - if o == nil || o.PublicIds == nil { - var ret []string - return ret - } - return o.PublicIds -} - -// GetPublicIdsOk returns a tuple with the PublicIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsDeleteTestsPayload) GetPublicIdsOk() (*[]string, bool) { - if o == nil || o.PublicIds == nil { - return nil, false - } - return &o.PublicIds, true -} - -// HasPublicIds returns a boolean if a field has been set. -func (o *SyntheticsDeleteTestsPayload) HasPublicIds() bool { - if o != nil && o.PublicIds != nil { - return true - } - - return false -} - -// SetPublicIds gets a reference to the given []string and assigns it to the PublicIds field. -func (o *SyntheticsDeleteTestsPayload) SetPublicIds(v []string) { - o.PublicIds = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsDeleteTestsPayload) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.PublicIds != nil { - toSerialize["public_ids"] = o.PublicIds - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsDeleteTestsPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - PublicIds []string `json:"public_ids,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.PublicIds = all.PublicIds - return nil -} diff --git a/api/v1/datadog/model_synthetics_delete_tests_response.go b/api/v1/datadog/model_synthetics_delete_tests_response.go deleted file mode 100644 index 8da48748c9d..00000000000 --- a/api/v1/datadog/model_synthetics_delete_tests_response.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsDeleteTestsResponse Response object for deleting Synthetic tests. -type SyntheticsDeleteTestsResponse struct { - // Array of objects containing a deleted Synthetic test ID with - // the associated deletion timestamp. - DeletedTests []SyntheticsDeletedTest `json:"deleted_tests,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{} -} - -// NewSyntheticsDeleteTestsResponse instantiates a new SyntheticsDeleteTestsResponse 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 NewSyntheticsDeleteTestsResponse() *SyntheticsDeleteTestsResponse { - this := SyntheticsDeleteTestsResponse{} - return &this -} - -// NewSyntheticsDeleteTestsResponseWithDefaults instantiates a new SyntheticsDeleteTestsResponse 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 NewSyntheticsDeleteTestsResponseWithDefaults() *SyntheticsDeleteTestsResponse { - this := SyntheticsDeleteTestsResponse{} - return &this -} - -// GetDeletedTests returns the DeletedTests field value if set, zero value otherwise. -func (o *SyntheticsDeleteTestsResponse) GetDeletedTests() []SyntheticsDeletedTest { - if o == nil || o.DeletedTests == nil { - var ret []SyntheticsDeletedTest - return ret - } - return o.DeletedTests -} - -// GetDeletedTestsOk returns a tuple with the DeletedTests field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsDeleteTestsResponse) GetDeletedTestsOk() (*[]SyntheticsDeletedTest, bool) { - if o == nil || o.DeletedTests == nil { - return nil, false - } - return &o.DeletedTests, true -} - -// HasDeletedTests returns a boolean if a field has been set. -func (o *SyntheticsDeleteTestsResponse) HasDeletedTests() bool { - if o != nil && o.DeletedTests != nil { - return true - } - - return false -} - -// SetDeletedTests gets a reference to the given []SyntheticsDeletedTest and assigns it to the DeletedTests field. -func (o *SyntheticsDeleteTestsResponse) SetDeletedTests(v []SyntheticsDeletedTest) { - o.DeletedTests = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsDeleteTestsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DeletedTests != nil { - toSerialize["deleted_tests"] = o.DeletedTests - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsDeleteTestsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DeletedTests []SyntheticsDeletedTest `json:"deleted_tests,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DeletedTests = all.DeletedTests - return nil -} diff --git a/api/v1/datadog/model_synthetics_deleted_test_.go b/api/v1/datadog/model_synthetics_deleted_test_.go deleted file mode 100644 index 932b02a8679..00000000000 --- a/api/v1/datadog/model_synthetics_deleted_test_.go +++ /dev/null @@ -1,147 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// SyntheticsDeletedTest Object containing a deleted Synthetic test ID with the associated -// deletion timestamp. -type SyntheticsDeletedTest struct { - // Deletion timestamp of the Synthetic test ID. - DeletedAt *time.Time `json:"deleted_at,omitempty"` - // The Synthetic test ID deleted. - PublicId *string `json:"public_id,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{} -} - -// NewSyntheticsDeletedTest instantiates a new SyntheticsDeletedTest 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 NewSyntheticsDeletedTest() *SyntheticsDeletedTest { - this := SyntheticsDeletedTest{} - return &this -} - -// NewSyntheticsDeletedTestWithDefaults instantiates a new SyntheticsDeletedTest 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 NewSyntheticsDeletedTestWithDefaults() *SyntheticsDeletedTest { - this := SyntheticsDeletedTest{} - return &this -} - -// GetDeletedAt returns the DeletedAt field value if set, zero value otherwise. -func (o *SyntheticsDeletedTest) GetDeletedAt() time.Time { - if o == nil || o.DeletedAt == nil { - var ret time.Time - return ret - } - return *o.DeletedAt -} - -// GetDeletedAtOk returns a tuple with the DeletedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsDeletedTest) GetDeletedAtOk() (*time.Time, bool) { - if o == nil || o.DeletedAt == nil { - return nil, false - } - return o.DeletedAt, true -} - -// HasDeletedAt returns a boolean if a field has been set. -func (o *SyntheticsDeletedTest) HasDeletedAt() bool { - if o != nil && o.DeletedAt != nil { - return true - } - - return false -} - -// SetDeletedAt gets a reference to the given time.Time and assigns it to the DeletedAt field. -func (o *SyntheticsDeletedTest) SetDeletedAt(v time.Time) { - o.DeletedAt = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *SyntheticsDeletedTest) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsDeletedTest) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *SyntheticsDeletedTest) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *SyntheticsDeletedTest) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsDeletedTest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DeletedAt != nil { - if o.DeletedAt.Nanosecond() == 0 { - toSerialize["deleted_at"] = o.DeletedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["deleted_at"] = o.DeletedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsDeletedTest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DeletedAt *time.Time `json:"deleted_at,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DeletedAt = all.DeletedAt - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_synthetics_device.go b/api/v1/datadog/model_synthetics_device.go deleted file mode 100644 index df5a57bca9c..00000000000 --- a/api/v1/datadog/model_synthetics_device.go +++ /dev/null @@ -1,249 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsDevice Object describing the device used to perform the Synthetic test. -type SyntheticsDevice struct { - // Screen height of the device. - Height int64 `json:"height"` - // The device ID. - Id SyntheticsDeviceID `json:"id"` - // Whether or not the device is a mobile. - IsMobile *bool `json:"isMobile,omitempty"` - // The device name. - Name string `json:"name"` - // Screen width of the device. - Width int64 `json:"width"` - // 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{} -} - -// NewSyntheticsDevice instantiates a new SyntheticsDevice 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 NewSyntheticsDevice(height int64, id SyntheticsDeviceID, name string, width int64) *SyntheticsDevice { - this := SyntheticsDevice{} - this.Height = height - this.Id = id - this.Name = name - this.Width = width - return &this -} - -// NewSyntheticsDeviceWithDefaults instantiates a new SyntheticsDevice 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 NewSyntheticsDeviceWithDefaults() *SyntheticsDevice { - this := SyntheticsDevice{} - return &this -} - -// GetHeight returns the Height field value. -func (o *SyntheticsDevice) GetHeight() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Height -} - -// GetHeightOk returns a tuple with the Height field value -// and a boolean to check if the value has been set. -func (o *SyntheticsDevice) GetHeightOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Height, true -} - -// SetHeight sets field value. -func (o *SyntheticsDevice) SetHeight(v int64) { - o.Height = v -} - -// GetId returns the Id field value. -func (o *SyntheticsDevice) GetId() SyntheticsDeviceID { - if o == nil { - var ret SyntheticsDeviceID - 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 *SyntheticsDevice) GetIdOk() (*SyntheticsDeviceID, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *SyntheticsDevice) SetId(v SyntheticsDeviceID) { - o.Id = v -} - -// GetIsMobile returns the IsMobile field value if set, zero value otherwise. -func (o *SyntheticsDevice) GetIsMobile() bool { - if o == nil || o.IsMobile == nil { - var ret bool - return ret - } - return *o.IsMobile -} - -// GetIsMobileOk returns a tuple with the IsMobile field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsDevice) GetIsMobileOk() (*bool, bool) { - if o == nil || o.IsMobile == nil { - return nil, false - } - return o.IsMobile, true -} - -// HasIsMobile returns a boolean if a field has been set. -func (o *SyntheticsDevice) HasIsMobile() bool { - if o != nil && o.IsMobile != nil { - return true - } - - return false -} - -// SetIsMobile gets a reference to the given bool and assigns it to the IsMobile field. -func (o *SyntheticsDevice) SetIsMobile(v bool) { - o.IsMobile = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsDevice) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsDevice) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsDevice) SetName(v string) { - o.Name = v -} - -// GetWidth returns the Width field value. -func (o *SyntheticsDevice) GetWidth() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Width -} - -// GetWidthOk returns a tuple with the Width field value -// and a boolean to check if the value has been set. -func (o *SyntheticsDevice) GetWidthOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Width, true -} - -// SetWidth sets field value. -func (o *SyntheticsDevice) SetWidth(v int64) { - o.Width = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsDevice) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["height"] = o.Height - toSerialize["id"] = o.Id - if o.IsMobile != nil { - toSerialize["isMobile"] = o.IsMobile - } - toSerialize["name"] = o.Name - toSerialize["width"] = o.Width - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsDevice) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Height *int64 `json:"height"` - Id *SyntheticsDeviceID `json:"id"` - Name *string `json:"name"` - Width *int64 `json:"width"` - }{} - all := struct { - Height int64 `json:"height"` - Id SyntheticsDeviceID `json:"id"` - IsMobile *bool `json:"isMobile,omitempty"` - Name string `json:"name"` - Width int64 `json:"width"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Height == nil { - return fmt.Errorf("Required field height missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Width == nil { - return fmt.Errorf("Required field width missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Id; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Height = all.Height - o.Id = all.Id - o.IsMobile = all.IsMobile - o.Name = all.Name - o.Width = all.Width - return nil -} diff --git a/api/v1/datadog/model_synthetics_device_id.go b/api/v1/datadog/model_synthetics_device_id.go deleted file mode 100644 index e607814692a..00000000000 --- a/api/v1/datadog/model_synthetics_device_id.go +++ /dev/null @@ -1,129 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsDeviceID The device ID. -type SyntheticsDeviceID string - -// List of SyntheticsDeviceID. -const ( - SYNTHETICSDEVICEID_LAPTOP_LARGE SyntheticsDeviceID = "laptop_large" - SYNTHETICSDEVICEID_TABLET SyntheticsDeviceID = "tablet" - SYNTHETICSDEVICEID_MOBILE_SMALL SyntheticsDeviceID = "mobile_small" - SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE SyntheticsDeviceID = "chrome.laptop_large" - SYNTHETICSDEVICEID_CHROME_TABLET SyntheticsDeviceID = "chrome.tablet" - SYNTHETICSDEVICEID_CHROME_MOBILE_SMALL SyntheticsDeviceID = "chrome.mobile_small" - SYNTHETICSDEVICEID_FIREFOX_LAPTOP_LARGE SyntheticsDeviceID = "firefox.laptop_large" - SYNTHETICSDEVICEID_FIREFOX_TABLET SyntheticsDeviceID = "firefox.tablet" - SYNTHETICSDEVICEID_FIREFOX_MOBILE_SMALL SyntheticsDeviceID = "firefox.mobile_small" - SYNTHETICSDEVICEID_EDGE_LAPTOP_LARGE SyntheticsDeviceID = "edge.laptop_large" - SYNTHETICSDEVICEID_EDGE_TABLET SyntheticsDeviceID = "edge.tablet" - SYNTHETICSDEVICEID_EDGE_MOBILE_SMALL SyntheticsDeviceID = "edge.mobile_small" -) - -var allowedSyntheticsDeviceIDEnumValues = []SyntheticsDeviceID{ - SYNTHETICSDEVICEID_LAPTOP_LARGE, - SYNTHETICSDEVICEID_TABLET, - SYNTHETICSDEVICEID_MOBILE_SMALL, - SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE, - SYNTHETICSDEVICEID_CHROME_TABLET, - SYNTHETICSDEVICEID_CHROME_MOBILE_SMALL, - SYNTHETICSDEVICEID_FIREFOX_LAPTOP_LARGE, - SYNTHETICSDEVICEID_FIREFOX_TABLET, - SYNTHETICSDEVICEID_FIREFOX_MOBILE_SMALL, - SYNTHETICSDEVICEID_EDGE_LAPTOP_LARGE, - SYNTHETICSDEVICEID_EDGE_TABLET, - SYNTHETICSDEVICEID_EDGE_MOBILE_SMALL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsDeviceID) GetAllowedValues() []SyntheticsDeviceID { - return allowedSyntheticsDeviceIDEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsDeviceID) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsDeviceID(value) - return nil -} - -// NewSyntheticsDeviceIDFromValue returns a pointer to a valid SyntheticsDeviceID -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsDeviceIDFromValue(v string) (*SyntheticsDeviceID, error) { - ev := SyntheticsDeviceID(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsDeviceID: valid values are %v", v, allowedSyntheticsDeviceIDEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsDeviceID) IsValid() bool { - for _, existing := range allowedSyntheticsDeviceIDEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsDeviceID value. -func (v SyntheticsDeviceID) Ptr() *SyntheticsDeviceID { - return &v -} - -// NullableSyntheticsDeviceID handles when a null is used for SyntheticsDeviceID. -type NullableSyntheticsDeviceID struct { - value *SyntheticsDeviceID - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsDeviceID) Get() *SyntheticsDeviceID { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsDeviceID) Set(val *SyntheticsDeviceID) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsDeviceID) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsDeviceID) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsDeviceID initializes the struct as if Set has been called. -func NewNullableSyntheticsDeviceID(val *SyntheticsDeviceID) *NullableSyntheticsDeviceID { - return &NullableSyntheticsDeviceID{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsDeviceID) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsDeviceID) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go b/api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go deleted file mode 100644 index a273d3546ee..00000000000 --- a/api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsGetAPITestLatestResultsResponse Object with the latest Synthetic API test run. -type SyntheticsGetAPITestLatestResultsResponse struct { - // Timestamp of the latest API test run. - LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` - // Result of the latest API test run. - Results []SyntheticsAPITestResultShort `json:"results,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{} -} - -// NewSyntheticsGetAPITestLatestResultsResponse instantiates a new SyntheticsGetAPITestLatestResultsResponse 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 NewSyntheticsGetAPITestLatestResultsResponse() *SyntheticsGetAPITestLatestResultsResponse { - this := SyntheticsGetAPITestLatestResultsResponse{} - return &this -} - -// NewSyntheticsGetAPITestLatestResultsResponseWithDefaults instantiates a new SyntheticsGetAPITestLatestResultsResponse 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 NewSyntheticsGetAPITestLatestResultsResponseWithDefaults() *SyntheticsGetAPITestLatestResultsResponse { - this := SyntheticsGetAPITestLatestResultsResponse{} - return &this -} - -// GetLastTimestampFetched returns the LastTimestampFetched field value if set, zero value otherwise. -func (o *SyntheticsGetAPITestLatestResultsResponse) GetLastTimestampFetched() int64 { - if o == nil || o.LastTimestampFetched == nil { - var ret int64 - return ret - } - return *o.LastTimestampFetched -} - -// GetLastTimestampFetchedOk returns a tuple with the LastTimestampFetched field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGetAPITestLatestResultsResponse) GetLastTimestampFetchedOk() (*int64, bool) { - if o == nil || o.LastTimestampFetched == nil { - return nil, false - } - return o.LastTimestampFetched, true -} - -// HasLastTimestampFetched returns a boolean if a field has been set. -func (o *SyntheticsGetAPITestLatestResultsResponse) HasLastTimestampFetched() bool { - if o != nil && o.LastTimestampFetched != nil { - return true - } - - return false -} - -// SetLastTimestampFetched gets a reference to the given int64 and assigns it to the LastTimestampFetched field. -func (o *SyntheticsGetAPITestLatestResultsResponse) SetLastTimestampFetched(v int64) { - o.LastTimestampFetched = &v -} - -// GetResults returns the Results field value if set, zero value otherwise. -func (o *SyntheticsGetAPITestLatestResultsResponse) GetResults() []SyntheticsAPITestResultShort { - if o == nil || o.Results == nil { - var ret []SyntheticsAPITestResultShort - return ret - } - return o.Results -} - -// GetResultsOk returns a tuple with the Results field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGetAPITestLatestResultsResponse) GetResultsOk() (*[]SyntheticsAPITestResultShort, bool) { - if o == nil || o.Results == nil { - return nil, false - } - return &o.Results, true -} - -// HasResults returns a boolean if a field has been set. -func (o *SyntheticsGetAPITestLatestResultsResponse) HasResults() bool { - if o != nil && o.Results != nil { - return true - } - - return false -} - -// SetResults gets a reference to the given []SyntheticsAPITestResultShort and assigns it to the Results field. -func (o *SyntheticsGetAPITestLatestResultsResponse) SetResults(v []SyntheticsAPITestResultShort) { - o.Results = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsGetAPITestLatestResultsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LastTimestampFetched != nil { - toSerialize["last_timestamp_fetched"] = o.LastTimestampFetched - } - if o.Results != nil { - toSerialize["results"] = o.Results - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsGetAPITestLatestResultsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` - Results []SyntheticsAPITestResultShort `json:"results,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LastTimestampFetched = all.LastTimestampFetched - o.Results = all.Results - return nil -} diff --git a/api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go b/api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go deleted file mode 100644 index 232e3608fd5..00000000000 --- a/api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsGetBrowserTestLatestResultsResponse Object with the latest Synthetic browser test run. -type SyntheticsGetBrowserTestLatestResultsResponse struct { - // Timestamp of the latest browser test run. - LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` - // Result of the latest browser test run. - Results []SyntheticsBrowserTestResultShort `json:"results,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{} -} - -// NewSyntheticsGetBrowserTestLatestResultsResponse instantiates a new SyntheticsGetBrowserTestLatestResultsResponse 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 NewSyntheticsGetBrowserTestLatestResultsResponse() *SyntheticsGetBrowserTestLatestResultsResponse { - this := SyntheticsGetBrowserTestLatestResultsResponse{} - return &this -} - -// NewSyntheticsGetBrowserTestLatestResultsResponseWithDefaults instantiates a new SyntheticsGetBrowserTestLatestResultsResponse 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 NewSyntheticsGetBrowserTestLatestResultsResponseWithDefaults() *SyntheticsGetBrowserTestLatestResultsResponse { - this := SyntheticsGetBrowserTestLatestResultsResponse{} - return &this -} - -// GetLastTimestampFetched returns the LastTimestampFetched field value if set, zero value otherwise. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetLastTimestampFetched() int64 { - if o == nil || o.LastTimestampFetched == nil { - var ret int64 - return ret - } - return *o.LastTimestampFetched -} - -// GetLastTimestampFetchedOk returns a tuple with the LastTimestampFetched field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetLastTimestampFetchedOk() (*int64, bool) { - if o == nil || o.LastTimestampFetched == nil { - return nil, false - } - return o.LastTimestampFetched, true -} - -// HasLastTimestampFetched returns a boolean if a field has been set. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) HasLastTimestampFetched() bool { - if o != nil && o.LastTimestampFetched != nil { - return true - } - - return false -} - -// SetLastTimestampFetched gets a reference to the given int64 and assigns it to the LastTimestampFetched field. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) SetLastTimestampFetched(v int64) { - o.LastTimestampFetched = &v -} - -// GetResults returns the Results field value if set, zero value otherwise. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetResults() []SyntheticsBrowserTestResultShort { - if o == nil || o.Results == nil { - var ret []SyntheticsBrowserTestResultShort - return ret - } - return o.Results -} - -// GetResultsOk returns a tuple with the Results field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetResultsOk() (*[]SyntheticsBrowserTestResultShort, bool) { - if o == nil || o.Results == nil { - return nil, false - } - return &o.Results, true -} - -// HasResults returns a boolean if a field has been set. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) HasResults() bool { - if o != nil && o.Results != nil { - return true - } - - return false -} - -// SetResults gets a reference to the given []SyntheticsBrowserTestResultShort and assigns it to the Results field. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) SetResults(v []SyntheticsBrowserTestResultShort) { - o.Results = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsGetBrowserTestLatestResultsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LastTimestampFetched != nil { - toSerialize["last_timestamp_fetched"] = o.LastTimestampFetched - } - if o.Results != nil { - toSerialize["results"] = o.Results - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsGetBrowserTestLatestResultsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` - Results []SyntheticsBrowserTestResultShort `json:"results,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LastTimestampFetched = all.LastTimestampFetched - o.Results = all.Results - return nil -} diff --git a/api/v1/datadog/model_synthetics_global_variable.go b/api/v1/datadog/model_synthetics_global_variable.go deleted file mode 100644 index 90acdd414cf..00000000000 --- a/api/v1/datadog/model_synthetics_global_variable.go +++ /dev/null @@ -1,379 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsGlobalVariable Synthetics global variable. -type SyntheticsGlobalVariable struct { - // Attributes of the global variable. - Attributes *SyntheticsGlobalVariableAttributes `json:"attributes,omitempty"` - // Description of the global variable. - Description string `json:"description"` - // Unique identifier of the global variable. - Id *string `json:"id,omitempty"` - // Name of the global variable. Unique across Synthetics global variables. - Name string `json:"name"` - // Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with `parse_test_public_id`. - ParseTestOptions *SyntheticsGlobalVariableParseTestOptions `json:"parse_test_options,omitempty"` - // A Synthetic test ID to use as a test to generate the variable value. - ParseTestPublicId *string `json:"parse_test_public_id,omitempty"` - // Tags of the global variable. - Tags []string `json:"tags"` - // Value of the global variable. - Value SyntheticsGlobalVariableValue `json:"value"` - // 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{} -} - -// NewSyntheticsGlobalVariable instantiates a new SyntheticsGlobalVariable 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 NewSyntheticsGlobalVariable(description string, name string, tags []string, value SyntheticsGlobalVariableValue) *SyntheticsGlobalVariable { - this := SyntheticsGlobalVariable{} - this.Description = description - this.Name = name - this.Tags = tags - this.Value = value - return &this -} - -// NewSyntheticsGlobalVariableWithDefaults instantiates a new SyntheticsGlobalVariable 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 NewSyntheticsGlobalVariableWithDefaults() *SyntheticsGlobalVariable { - this := SyntheticsGlobalVariable{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariable) GetAttributes() SyntheticsGlobalVariableAttributes { - if o == nil || o.Attributes == nil { - var ret SyntheticsGlobalVariableAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetAttributesOk() (*SyntheticsGlobalVariableAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariable) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SyntheticsGlobalVariableAttributes and assigns it to the Attributes field. -func (o *SyntheticsGlobalVariable) SetAttributes(v SyntheticsGlobalVariableAttributes) { - o.Attributes = &v -} - -// GetDescription returns the Description field value. -func (o *SyntheticsGlobalVariable) GetDescription() string { - if o == nil { - var ret string - return ret - } - return o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Description, true -} - -// SetDescription sets field value. -func (o *SyntheticsGlobalVariable) SetDescription(v string) { - o.Description = v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariable) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariable) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SyntheticsGlobalVariable) SetId(v string) { - o.Id = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsGlobalVariable) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsGlobalVariable) SetName(v string) { - o.Name = v -} - -// GetParseTestOptions returns the ParseTestOptions field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariable) GetParseTestOptions() SyntheticsGlobalVariableParseTestOptions { - if o == nil || o.ParseTestOptions == nil { - var ret SyntheticsGlobalVariableParseTestOptions - return ret - } - return *o.ParseTestOptions -} - -// GetParseTestOptionsOk returns a tuple with the ParseTestOptions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetParseTestOptionsOk() (*SyntheticsGlobalVariableParseTestOptions, bool) { - if o == nil || o.ParseTestOptions == nil { - return nil, false - } - return o.ParseTestOptions, true -} - -// HasParseTestOptions returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariable) HasParseTestOptions() bool { - if o != nil && o.ParseTestOptions != nil { - return true - } - - return false -} - -// SetParseTestOptions gets a reference to the given SyntheticsGlobalVariableParseTestOptions and assigns it to the ParseTestOptions field. -func (o *SyntheticsGlobalVariable) SetParseTestOptions(v SyntheticsGlobalVariableParseTestOptions) { - o.ParseTestOptions = &v -} - -// GetParseTestPublicId returns the ParseTestPublicId field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariable) GetParseTestPublicId() string { - if o == nil || o.ParseTestPublicId == nil { - var ret string - return ret - } - return *o.ParseTestPublicId -} - -// GetParseTestPublicIdOk returns a tuple with the ParseTestPublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetParseTestPublicIdOk() (*string, bool) { - if o == nil || o.ParseTestPublicId == nil { - return nil, false - } - return o.ParseTestPublicId, true -} - -// HasParseTestPublicId returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariable) HasParseTestPublicId() bool { - if o != nil && o.ParseTestPublicId != nil { - return true - } - - return false -} - -// SetParseTestPublicId gets a reference to the given string and assigns it to the ParseTestPublicId field. -func (o *SyntheticsGlobalVariable) SetParseTestPublicId(v string) { - o.ParseTestPublicId = &v -} - -// GetTags returns the Tags field value. -func (o *SyntheticsGlobalVariable) GetTags() []string { - if o == nil { - var ret []string - return ret - } - return o.Tags -} - -// GetTagsOk returns a tuple with the Tags field value -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetTagsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Tags, true -} - -// SetTags sets field value. -func (o *SyntheticsGlobalVariable) SetTags(v []string) { - o.Tags = v -} - -// GetValue returns the Value field value. -func (o *SyntheticsGlobalVariable) GetValue() SyntheticsGlobalVariableValue { - if o == nil { - var ret SyntheticsGlobalVariableValue - return ret - } - return o.Value -} - -// GetValueOk returns a tuple with the Value field value -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariable) GetValueOk() (*SyntheticsGlobalVariableValue, bool) { - if o == nil { - return nil, false - } - return &o.Value, true -} - -// SetValue sets field value. -func (o *SyntheticsGlobalVariable) SetValue(v SyntheticsGlobalVariableValue) { - o.Value = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsGlobalVariable) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["description"] = o.Description - if o.Id != nil { - toSerialize["id"] = o.Id - } - toSerialize["name"] = o.Name - if o.ParseTestOptions != nil { - toSerialize["parse_test_options"] = o.ParseTestOptions - } - if o.ParseTestPublicId != nil { - toSerialize["parse_test_public_id"] = o.ParseTestPublicId - } - toSerialize["tags"] = o.Tags - toSerialize["value"] = o.Value - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Description *string `json:"description"` - Name *string `json:"name"` - Tags *[]string `json:"tags"` - Value *SyntheticsGlobalVariableValue `json:"value"` - }{} - all := struct { - Attributes *SyntheticsGlobalVariableAttributes `json:"attributes,omitempty"` - Description string `json:"description"` - Id *string `json:"id,omitempty"` - Name string `json:"name"` - ParseTestOptions *SyntheticsGlobalVariableParseTestOptions `json:"parse_test_options,omitempty"` - ParseTestPublicId *string `json:"parse_test_public_id,omitempty"` - Tags []string `json:"tags"` - Value SyntheticsGlobalVariableValue `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Description == nil { - return fmt.Errorf("Required field description missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Tags == nil { - return fmt.Errorf("Required field tags missing") - } - if required.Value == nil { - return fmt.Errorf("Required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Description = all.Description - o.Id = all.Id - o.Name = all.Name - if all.ParseTestOptions != nil && all.ParseTestOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ParseTestOptions = all.ParseTestOptions - o.ParseTestPublicId = all.ParseTestPublicId - o.Tags = all.Tags - if all.Value.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_synthetics_global_variable_attributes.go b/api/v1/datadog/model_synthetics_global_variable_attributes.go deleted file mode 100644 index 709d27cc6eb..00000000000 --- a/api/v1/datadog/model_synthetics_global_variable_attributes.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsGlobalVariableAttributes Attributes of the global variable. -type SyntheticsGlobalVariableAttributes struct { - // A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. - RestrictedRoles []string `json:"restricted_roles,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{} -} - -// NewSyntheticsGlobalVariableAttributes instantiates a new SyntheticsGlobalVariableAttributes 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 NewSyntheticsGlobalVariableAttributes() *SyntheticsGlobalVariableAttributes { - this := SyntheticsGlobalVariableAttributes{} - return &this -} - -// NewSyntheticsGlobalVariableAttributesWithDefaults instantiates a new SyntheticsGlobalVariableAttributes 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 NewSyntheticsGlobalVariableAttributesWithDefaults() *SyntheticsGlobalVariableAttributes { - this := SyntheticsGlobalVariableAttributes{} - return &this -} - -// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariableAttributes) GetRestrictedRoles() []string { - if o == nil || o.RestrictedRoles == nil { - var ret []string - return ret - } - return o.RestrictedRoles -} - -// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariableAttributes) GetRestrictedRolesOk() (*[]string, bool) { - if o == nil || o.RestrictedRoles == nil { - return nil, false - } - return &o.RestrictedRoles, true -} - -// HasRestrictedRoles returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariableAttributes) HasRestrictedRoles() bool { - if o != nil && o.RestrictedRoles != nil { - return true - } - - return false -} - -// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. -func (o *SyntheticsGlobalVariableAttributes) SetRestrictedRoles(v []string) { - o.RestrictedRoles = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsGlobalVariableAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.RestrictedRoles != nil { - toSerialize["restricted_roles"] = o.RestrictedRoles - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsGlobalVariableAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - RestrictedRoles []string `json:"restricted_roles,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.RestrictedRoles = all.RestrictedRoles - return nil -} diff --git a/api/v1/datadog/model_synthetics_global_variable_parse_test_options.go b/api/v1/datadog/model_synthetics_global_variable_parse_test_options.go deleted file mode 100644 index d6595257e0c..00000000000 --- a/api/v1/datadog/model_synthetics_global_variable_parse_test_options.go +++ /dev/null @@ -1,190 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsGlobalVariableParseTestOptions Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with `parse_test_public_id`. -type SyntheticsGlobalVariableParseTestOptions struct { - // When type is `http_header`, name of the header to use to extract the value. - Field *string `json:"field,omitempty"` - // Details of the parser to use for the global variable. - Parser SyntheticsVariableParser `json:"parser"` - // Property of the Synthetics Test Response to use for a Synthetics global variable. - Type SyntheticsGlobalVariableParseTestOptionsType `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{} -} - -// NewSyntheticsGlobalVariableParseTestOptions instantiates a new SyntheticsGlobalVariableParseTestOptions 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 NewSyntheticsGlobalVariableParseTestOptions(parser SyntheticsVariableParser, typeVar SyntheticsGlobalVariableParseTestOptionsType) *SyntheticsGlobalVariableParseTestOptions { - this := SyntheticsGlobalVariableParseTestOptions{} - this.Parser = parser - this.Type = typeVar - return &this -} - -// NewSyntheticsGlobalVariableParseTestOptionsWithDefaults instantiates a new SyntheticsGlobalVariableParseTestOptions 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 NewSyntheticsGlobalVariableParseTestOptionsWithDefaults() *SyntheticsGlobalVariableParseTestOptions { - this := SyntheticsGlobalVariableParseTestOptions{} - return &this -} - -// GetField returns the Field field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariableParseTestOptions) GetField() string { - if o == nil || o.Field == nil { - var ret string - return ret - } - return *o.Field -} - -// GetFieldOk returns a tuple with the Field field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariableParseTestOptions) GetFieldOk() (*string, bool) { - if o == nil || o.Field == nil { - return nil, false - } - return o.Field, true -} - -// HasField returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariableParseTestOptions) HasField() bool { - if o != nil && o.Field != nil { - return true - } - - return false -} - -// SetField gets a reference to the given string and assigns it to the Field field. -func (o *SyntheticsGlobalVariableParseTestOptions) SetField(v string) { - o.Field = &v -} - -// GetParser returns the Parser field value. -func (o *SyntheticsGlobalVariableParseTestOptions) GetParser() SyntheticsVariableParser { - if o == nil { - var ret SyntheticsVariableParser - return ret - } - return o.Parser -} - -// GetParserOk returns a tuple with the Parser field value -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariableParseTestOptions) GetParserOk() (*SyntheticsVariableParser, bool) { - if o == nil { - return nil, false - } - return &o.Parser, true -} - -// SetParser sets field value. -func (o *SyntheticsGlobalVariableParseTestOptions) SetParser(v SyntheticsVariableParser) { - o.Parser = v -} - -// GetType returns the Type field value. -func (o *SyntheticsGlobalVariableParseTestOptions) GetType() SyntheticsGlobalVariableParseTestOptionsType { - if o == nil { - var ret SyntheticsGlobalVariableParseTestOptionsType - 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 *SyntheticsGlobalVariableParseTestOptions) GetTypeOk() (*SyntheticsGlobalVariableParseTestOptionsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsGlobalVariableParseTestOptions) SetType(v SyntheticsGlobalVariableParseTestOptionsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsGlobalVariableParseTestOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Field != nil { - toSerialize["field"] = o.Field - } - toSerialize["parser"] = o.Parser - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Parser *SyntheticsVariableParser `json:"parser"` - Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type"` - }{} - all := struct { - Field *string `json:"field,omitempty"` - Parser SyntheticsVariableParser `json:"parser"` - Type SyntheticsGlobalVariableParseTestOptionsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Parser == nil { - return fmt.Errorf("Required field parser missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Field = all.Field - if all.Parser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Parser = all.Parser - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go b/api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go deleted file mode 100644 index 7422775dd2d..00000000000 --- a/api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsGlobalVariableParseTestOptionsType Property of the Synthetics Test Response to use for a Synthetics global variable. -type SyntheticsGlobalVariableParseTestOptionsType string - -// List of SyntheticsGlobalVariableParseTestOptionsType. -const ( - SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY SyntheticsGlobalVariableParseTestOptionsType = "http_body" - SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER SyntheticsGlobalVariableParseTestOptionsType = "http_header" -) - -var allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues = []SyntheticsGlobalVariableParseTestOptionsType{ - SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY, - SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsGlobalVariableParseTestOptionsType) GetAllowedValues() []SyntheticsGlobalVariableParseTestOptionsType { - return allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsGlobalVariableParseTestOptionsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsGlobalVariableParseTestOptionsType(value) - return nil -} - -// NewSyntheticsGlobalVariableParseTestOptionsTypeFromValue returns a pointer to a valid SyntheticsGlobalVariableParseTestOptionsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsGlobalVariableParseTestOptionsTypeFromValue(v string) (*SyntheticsGlobalVariableParseTestOptionsType, error) { - ev := SyntheticsGlobalVariableParseTestOptionsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsGlobalVariableParseTestOptionsType: valid values are %v", v, allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsGlobalVariableParseTestOptionsType) IsValid() bool { - for _, existing := range allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsGlobalVariableParseTestOptionsType value. -func (v SyntheticsGlobalVariableParseTestOptionsType) Ptr() *SyntheticsGlobalVariableParseTestOptionsType { - return &v -} - -// NullableSyntheticsGlobalVariableParseTestOptionsType handles when a null is used for SyntheticsGlobalVariableParseTestOptionsType. -type NullableSyntheticsGlobalVariableParseTestOptionsType struct { - value *SyntheticsGlobalVariableParseTestOptionsType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsGlobalVariableParseTestOptionsType) Get() *SyntheticsGlobalVariableParseTestOptionsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) Set(val *SyntheticsGlobalVariableParseTestOptionsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsGlobalVariableParseTestOptionsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsGlobalVariableParseTestOptionsType initializes the struct as if Set has been called. -func NewNullableSyntheticsGlobalVariableParseTestOptionsType(val *SyntheticsGlobalVariableParseTestOptionsType) *NullableSyntheticsGlobalVariableParseTestOptionsType { - return &NullableSyntheticsGlobalVariableParseTestOptionsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsGlobalVariableParseTestOptionsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_global_variable_parser_type.go b/api/v1/datadog/model_synthetics_global_variable_parser_type.go deleted file mode 100644 index f389f8a5310..00000000000 --- a/api/v1/datadog/model_synthetics_global_variable_parser_type.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsGlobalVariableParserType Type of parser for a Synthetics global variable from a synthetics test. -type SyntheticsGlobalVariableParserType string - -// List of SyntheticsGlobalVariableParserType. -const ( - SYNTHETICSGLOBALVARIABLEPARSERTYPE_RAW SyntheticsGlobalVariableParserType = "raw" - SYNTHETICSGLOBALVARIABLEPARSERTYPE_JSON_PATH SyntheticsGlobalVariableParserType = "json_path" - SYNTHETICSGLOBALVARIABLEPARSERTYPE_REGEX SyntheticsGlobalVariableParserType = "regex" - SYNTHETICSGLOBALVARIABLEPARSERTYPE_X_PATH SyntheticsGlobalVariableParserType = "x_path" -) - -var allowedSyntheticsGlobalVariableParserTypeEnumValues = []SyntheticsGlobalVariableParserType{ - SYNTHETICSGLOBALVARIABLEPARSERTYPE_RAW, - SYNTHETICSGLOBALVARIABLEPARSERTYPE_JSON_PATH, - SYNTHETICSGLOBALVARIABLEPARSERTYPE_REGEX, - SYNTHETICSGLOBALVARIABLEPARSERTYPE_X_PATH, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsGlobalVariableParserType) GetAllowedValues() []SyntheticsGlobalVariableParserType { - return allowedSyntheticsGlobalVariableParserTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsGlobalVariableParserType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsGlobalVariableParserType(value) - return nil -} - -// NewSyntheticsGlobalVariableParserTypeFromValue returns a pointer to a valid SyntheticsGlobalVariableParserType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsGlobalVariableParserTypeFromValue(v string) (*SyntheticsGlobalVariableParserType, error) { - ev := SyntheticsGlobalVariableParserType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsGlobalVariableParserType: valid values are %v", v, allowedSyntheticsGlobalVariableParserTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsGlobalVariableParserType) IsValid() bool { - for _, existing := range allowedSyntheticsGlobalVariableParserTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsGlobalVariableParserType value. -func (v SyntheticsGlobalVariableParserType) Ptr() *SyntheticsGlobalVariableParserType { - return &v -} - -// NullableSyntheticsGlobalVariableParserType handles when a null is used for SyntheticsGlobalVariableParserType. -type NullableSyntheticsGlobalVariableParserType struct { - value *SyntheticsGlobalVariableParserType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsGlobalVariableParserType) Get() *SyntheticsGlobalVariableParserType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsGlobalVariableParserType) Set(val *SyntheticsGlobalVariableParserType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsGlobalVariableParserType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsGlobalVariableParserType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsGlobalVariableParserType initializes the struct as if Set has been called. -func NewNullableSyntheticsGlobalVariableParserType(val *SyntheticsGlobalVariableParserType) *NullableSyntheticsGlobalVariableParserType { - return &NullableSyntheticsGlobalVariableParserType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsGlobalVariableParserType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsGlobalVariableParserType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_global_variable_value.go b/api/v1/datadog/model_synthetics_global_variable_value.go deleted file mode 100644 index 38d008c8567..00000000000 --- a/api/v1/datadog/model_synthetics_global_variable_value.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsGlobalVariableValue Value of the global variable. -type SyntheticsGlobalVariableValue struct { - // Determines if the value of the variable is hidden. - Secure *bool `json:"secure,omitempty"` - // Value of the global variable. When reading a global variable, - // the value will not be present if the variable is hidden with the `secure` property. - Value *string `json:"value,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{} -} - -// NewSyntheticsGlobalVariableValue instantiates a new SyntheticsGlobalVariableValue 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 NewSyntheticsGlobalVariableValue() *SyntheticsGlobalVariableValue { - this := SyntheticsGlobalVariableValue{} - return &this -} - -// NewSyntheticsGlobalVariableValueWithDefaults instantiates a new SyntheticsGlobalVariableValue 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 NewSyntheticsGlobalVariableValueWithDefaults() *SyntheticsGlobalVariableValue { - this := SyntheticsGlobalVariableValue{} - return &this -} - -// GetSecure returns the Secure field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariableValue) GetSecure() bool { - if o == nil || o.Secure == nil { - var ret bool - return ret - } - return *o.Secure -} - -// GetSecureOk returns a tuple with the Secure field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariableValue) GetSecureOk() (*bool, bool) { - if o == nil || o.Secure == nil { - return nil, false - } - return o.Secure, true -} - -// HasSecure returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariableValue) HasSecure() bool { - if o != nil && o.Secure != nil { - return true - } - - return false -} - -// SetSecure gets a reference to the given bool and assigns it to the Secure field. -func (o *SyntheticsGlobalVariableValue) SetSecure(v bool) { - o.Secure = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *SyntheticsGlobalVariableValue) GetValue() string { - if o == nil || o.Value == nil { - var ret string - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsGlobalVariableValue) GetValueOk() (*string, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *SyntheticsGlobalVariableValue) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given string and assigns it to the Value field. -func (o *SyntheticsGlobalVariableValue) SetValue(v string) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsGlobalVariableValue) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Secure != nil { - toSerialize["secure"] = o.Secure - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsGlobalVariableValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Secure *bool `json:"secure,omitempty"` - Value *string `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Secure = all.Secure - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_synthetics_list_global_variables_response.go b/api/v1/datadog/model_synthetics_list_global_variables_response.go deleted file mode 100644 index 3e7d841c62f..00000000000 --- a/api/v1/datadog/model_synthetics_list_global_variables_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsListGlobalVariablesResponse Object containing an array of Synthetic global variables. -type SyntheticsListGlobalVariablesResponse struct { - // Array of Synthetic global variables. - Variables []SyntheticsGlobalVariable `json:"variables,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{} -} - -// NewSyntheticsListGlobalVariablesResponse instantiates a new SyntheticsListGlobalVariablesResponse 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 NewSyntheticsListGlobalVariablesResponse() *SyntheticsListGlobalVariablesResponse { - this := SyntheticsListGlobalVariablesResponse{} - return &this -} - -// NewSyntheticsListGlobalVariablesResponseWithDefaults instantiates a new SyntheticsListGlobalVariablesResponse 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 NewSyntheticsListGlobalVariablesResponseWithDefaults() *SyntheticsListGlobalVariablesResponse { - this := SyntheticsListGlobalVariablesResponse{} - return &this -} - -// GetVariables returns the Variables field value if set, zero value otherwise. -func (o *SyntheticsListGlobalVariablesResponse) GetVariables() []SyntheticsGlobalVariable { - if o == nil || o.Variables == nil { - var ret []SyntheticsGlobalVariable - return ret - } - return o.Variables -} - -// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsListGlobalVariablesResponse) GetVariablesOk() (*[]SyntheticsGlobalVariable, bool) { - if o == nil || o.Variables == nil { - return nil, false - } - return &o.Variables, true -} - -// HasVariables returns a boolean if a field has been set. -func (o *SyntheticsListGlobalVariablesResponse) HasVariables() bool { - if o != nil && o.Variables != nil { - return true - } - - return false -} - -// SetVariables gets a reference to the given []SyntheticsGlobalVariable and assigns it to the Variables field. -func (o *SyntheticsListGlobalVariablesResponse) SetVariables(v []SyntheticsGlobalVariable) { - o.Variables = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsListGlobalVariablesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Variables != nil { - toSerialize["variables"] = o.Variables - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsListGlobalVariablesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Variables []SyntheticsGlobalVariable `json:"variables,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Variables = all.Variables - return nil -} diff --git a/api/v1/datadog/model_synthetics_list_tests_response.go b/api/v1/datadog/model_synthetics_list_tests_response.go deleted file mode 100644 index c3a209ed501..00000000000 --- a/api/v1/datadog/model_synthetics_list_tests_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsListTestsResponse Object containing an array of Synthetic tests configuration. -type SyntheticsListTestsResponse struct { - // Array of Synthetic tests configuration. - Tests []SyntheticsTestDetails `json:"tests,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{} -} - -// NewSyntheticsListTestsResponse instantiates a new SyntheticsListTestsResponse 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 NewSyntheticsListTestsResponse() *SyntheticsListTestsResponse { - this := SyntheticsListTestsResponse{} - return &this -} - -// NewSyntheticsListTestsResponseWithDefaults instantiates a new SyntheticsListTestsResponse 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 NewSyntheticsListTestsResponseWithDefaults() *SyntheticsListTestsResponse { - this := SyntheticsListTestsResponse{} - return &this -} - -// GetTests returns the Tests field value if set, zero value otherwise. -func (o *SyntheticsListTestsResponse) GetTests() []SyntheticsTestDetails { - if o == nil || o.Tests == nil { - var ret []SyntheticsTestDetails - return ret - } - return o.Tests -} - -// GetTestsOk returns a tuple with the Tests field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsListTestsResponse) GetTestsOk() (*[]SyntheticsTestDetails, bool) { - if o == nil || o.Tests == nil { - return nil, false - } - return &o.Tests, true -} - -// HasTests returns a boolean if a field has been set. -func (o *SyntheticsListTestsResponse) HasTests() bool { - if o != nil && o.Tests != nil { - return true - } - - return false -} - -// SetTests gets a reference to the given []SyntheticsTestDetails and assigns it to the Tests field. -func (o *SyntheticsListTestsResponse) SetTests(v []SyntheticsTestDetails) { - o.Tests = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsListTestsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Tests != nil { - toSerialize["tests"] = o.Tests - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsListTestsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Tests []SyntheticsTestDetails `json:"tests,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Tests = all.Tests - return nil -} diff --git a/api/v1/datadog/model_synthetics_location.go b/api/v1/datadog/model_synthetics_location.go deleted file mode 100644 index 63226bcab80..00000000000 --- a/api/v1/datadog/model_synthetics_location.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsLocation Synthetic location that can be used when creating or editing a -// test. -type SyntheticsLocation struct { - // Unique identifier of the location. - Id *string `json:"id,omitempty"` - // Name of the location. - Name *string `json:"name,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{} -} - -// NewSyntheticsLocation instantiates a new SyntheticsLocation 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 NewSyntheticsLocation() *SyntheticsLocation { - this := SyntheticsLocation{} - return &this -} - -// NewSyntheticsLocationWithDefaults instantiates a new SyntheticsLocation 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 NewSyntheticsLocationWithDefaults() *SyntheticsLocation { - this := SyntheticsLocation{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsLocation) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsLocation) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsLocation) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SyntheticsLocation) SetId(v string) { - o.Id = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SyntheticsLocation) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsLocation) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SyntheticsLocation) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SyntheticsLocation) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsLocation) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsLocation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_synthetics_locations.go b/api/v1/datadog/model_synthetics_locations.go deleted file mode 100644 index 498df4fb190..00000000000 --- a/api/v1/datadog/model_synthetics_locations.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsLocations List of Synthetics locations. -type SyntheticsLocations struct { - // List of Synthetics locations. - Locations []SyntheticsLocation `json:"locations,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{} -} - -// NewSyntheticsLocations instantiates a new SyntheticsLocations 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 NewSyntheticsLocations() *SyntheticsLocations { - this := SyntheticsLocations{} - return &this -} - -// NewSyntheticsLocationsWithDefaults instantiates a new SyntheticsLocations 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 NewSyntheticsLocationsWithDefaults() *SyntheticsLocations { - this := SyntheticsLocations{} - return &this -} - -// GetLocations returns the Locations field value if set, zero value otherwise. -func (o *SyntheticsLocations) GetLocations() []SyntheticsLocation { - if o == nil || o.Locations == nil { - var ret []SyntheticsLocation - return ret - } - return o.Locations -} - -// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsLocations) GetLocationsOk() (*[]SyntheticsLocation, bool) { - if o == nil || o.Locations == nil { - return nil, false - } - return &o.Locations, true -} - -// HasLocations returns a boolean if a field has been set. -func (o *SyntheticsLocations) HasLocations() bool { - if o != nil && o.Locations != nil { - return true - } - - return false -} - -// SetLocations gets a reference to the given []SyntheticsLocation and assigns it to the Locations field. -func (o *SyntheticsLocations) SetLocations(v []SyntheticsLocation) { - o.Locations = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsLocations) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Locations != nil { - toSerialize["locations"] = o.Locations - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsLocations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Locations []SyntheticsLocation `json:"locations,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Locations = all.Locations - return nil -} diff --git a/api/v1/datadog/model_synthetics_parsing_options.go b/api/v1/datadog/model_synthetics_parsing_options.go deleted file mode 100644 index 7623adf26ea..00000000000 --- a/api/v1/datadog/model_synthetics_parsing_options.go +++ /dev/null @@ -1,234 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsParsingOptions Parsing options for variables to extract. -type SyntheticsParsingOptions struct { - // When type is `http_header`, name of the header to use to extract the value. - Field *string `json:"field,omitempty"` - // Name of the variable to extract. - Name *string `json:"name,omitempty"` - // Details of the parser to use for the global variable. - Parser *SyntheticsVariableParser `json:"parser,omitempty"` - // Property of the Synthetics Test Response to use for a Synthetics global variable. - Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type,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{} -} - -// NewSyntheticsParsingOptions instantiates a new SyntheticsParsingOptions 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 NewSyntheticsParsingOptions() *SyntheticsParsingOptions { - this := SyntheticsParsingOptions{} - return &this -} - -// NewSyntheticsParsingOptionsWithDefaults instantiates a new SyntheticsParsingOptions 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 NewSyntheticsParsingOptionsWithDefaults() *SyntheticsParsingOptions { - this := SyntheticsParsingOptions{} - return &this -} - -// GetField returns the Field field value if set, zero value otherwise. -func (o *SyntheticsParsingOptions) GetField() string { - if o == nil || o.Field == nil { - var ret string - return ret - } - return *o.Field -} - -// GetFieldOk returns a tuple with the Field field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsParsingOptions) GetFieldOk() (*string, bool) { - if o == nil || o.Field == nil { - return nil, false - } - return o.Field, true -} - -// HasField returns a boolean if a field has been set. -func (o *SyntheticsParsingOptions) HasField() bool { - if o != nil && o.Field != nil { - return true - } - - return false -} - -// SetField gets a reference to the given string and assigns it to the Field field. -func (o *SyntheticsParsingOptions) SetField(v string) { - o.Field = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SyntheticsParsingOptions) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsParsingOptions) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SyntheticsParsingOptions) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SyntheticsParsingOptions) SetName(v string) { - o.Name = &v -} - -// GetParser returns the Parser field value if set, zero value otherwise. -func (o *SyntheticsParsingOptions) GetParser() SyntheticsVariableParser { - if o == nil || o.Parser == nil { - var ret SyntheticsVariableParser - return ret - } - return *o.Parser -} - -// GetParserOk returns a tuple with the Parser field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsParsingOptions) GetParserOk() (*SyntheticsVariableParser, bool) { - if o == nil || o.Parser == nil { - return nil, false - } - return o.Parser, true -} - -// HasParser returns a boolean if a field has been set. -func (o *SyntheticsParsingOptions) HasParser() bool { - if o != nil && o.Parser != nil { - return true - } - - return false -} - -// SetParser gets a reference to the given SyntheticsVariableParser and assigns it to the Parser field. -func (o *SyntheticsParsingOptions) SetParser(v SyntheticsVariableParser) { - o.Parser = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SyntheticsParsingOptions) GetType() SyntheticsGlobalVariableParseTestOptionsType { - if o == nil || o.Type == nil { - var ret SyntheticsGlobalVariableParseTestOptionsType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsParsingOptions) GetTypeOk() (*SyntheticsGlobalVariableParseTestOptionsType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SyntheticsParsingOptions) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SyntheticsGlobalVariableParseTestOptionsType and assigns it to the Type field. -func (o *SyntheticsParsingOptions) SetType(v SyntheticsGlobalVariableParseTestOptionsType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsParsingOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Field != nil { - toSerialize["field"] = o.Field - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Parser != nil { - toSerialize["parser"] = o.Parser - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsParsingOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Field *string `json:"field,omitempty"` - Name *string `json:"name,omitempty"` - Parser *SyntheticsVariableParser `json:"parser,omitempty"` - Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Field = all.Field - o.Name = all.Name - if all.Parser != nil && all.Parser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Parser = all.Parser - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_playing_tab.go b/api/v1/datadog/model_synthetics_playing_tab.go deleted file mode 100644 index cd518a468dc..00000000000 --- a/api/v1/datadog/model_synthetics_playing_tab.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsPlayingTab Navigate between different tabs for your browser test. -type SyntheticsPlayingTab int64 - -// List of SyntheticsPlayingTab. -const ( - SYNTHETICSPLAYINGTAB_MAIN_TAB SyntheticsPlayingTab = -1 - SYNTHETICSPLAYINGTAB_NEW_TAB SyntheticsPlayingTab = 0 - SYNTHETICSPLAYINGTAB_TAB_1 SyntheticsPlayingTab = 1 - SYNTHETICSPLAYINGTAB_TAB_2 SyntheticsPlayingTab = 2 - SYNTHETICSPLAYINGTAB_TAB_3 SyntheticsPlayingTab = 3 -) - -var allowedSyntheticsPlayingTabEnumValues = []SyntheticsPlayingTab{ - SYNTHETICSPLAYINGTAB_MAIN_TAB, - SYNTHETICSPLAYINGTAB_NEW_TAB, - SYNTHETICSPLAYINGTAB_TAB_1, - SYNTHETICSPLAYINGTAB_TAB_2, - SYNTHETICSPLAYINGTAB_TAB_3, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsPlayingTab) GetAllowedValues() []SyntheticsPlayingTab { - return allowedSyntheticsPlayingTabEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsPlayingTab) UnmarshalJSON(src []byte) error { - var value int64 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsPlayingTab(value) - return nil -} - -// NewSyntheticsPlayingTabFromValue returns a pointer to a valid SyntheticsPlayingTab -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsPlayingTabFromValue(v int64) (*SyntheticsPlayingTab, error) { - ev := SyntheticsPlayingTab(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsPlayingTab: valid values are %v", v, allowedSyntheticsPlayingTabEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsPlayingTab) IsValid() bool { - for _, existing := range allowedSyntheticsPlayingTabEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsPlayingTab value. -func (v SyntheticsPlayingTab) Ptr() *SyntheticsPlayingTab { - return &v -} - -// NullableSyntheticsPlayingTab handles when a null is used for SyntheticsPlayingTab. -type NullableSyntheticsPlayingTab struct { - value *SyntheticsPlayingTab - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsPlayingTab) Get() *SyntheticsPlayingTab { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsPlayingTab) Set(val *SyntheticsPlayingTab) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsPlayingTab) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsPlayingTab) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsPlayingTab initializes the struct as if Set has been called. -func NewNullableSyntheticsPlayingTab(val *SyntheticsPlayingTab) *NullableSyntheticsPlayingTab { - return &NullableSyntheticsPlayingTab{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsPlayingTab) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsPlayingTab) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_private_location.go b/api/v1/datadog/model_synthetics_private_location.go deleted file mode 100644 index 0c9d5f483f1..00000000000 --- a/api/v1/datadog/model_synthetics_private_location.go +++ /dev/null @@ -1,300 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsPrivateLocation Object containing information about the private location to create. -type SyntheticsPrivateLocation struct { - // Description of the private location. - Description string `json:"description"` - // Unique identifier of the private location. - Id *string `json:"id,omitempty"` - // Object containing metadata about the private location. - Metadata *SyntheticsPrivateLocationMetadata `json:"metadata,omitempty"` - // Name of the private location. - Name string `json:"name"` - // Secrets for the private location. Only present in the response when creating the private location. - Secrets *SyntheticsPrivateLocationSecrets `json:"secrets,omitempty"` - // Array of tags attached to the private location. - Tags []string `json:"tags"` - // 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{} -} - -// NewSyntheticsPrivateLocation instantiates a new SyntheticsPrivateLocation 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 NewSyntheticsPrivateLocation(description string, name string, tags []string) *SyntheticsPrivateLocation { - this := SyntheticsPrivateLocation{} - this.Description = description - this.Name = name - this.Tags = tags - return &this -} - -// NewSyntheticsPrivateLocationWithDefaults instantiates a new SyntheticsPrivateLocation 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 NewSyntheticsPrivateLocationWithDefaults() *SyntheticsPrivateLocation { - this := SyntheticsPrivateLocation{} - return &this -} - -// GetDescription returns the Description field value. -func (o *SyntheticsPrivateLocation) GetDescription() string { - if o == nil { - var ret string - return ret - } - return o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocation) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Description, true -} - -// SetDescription sets field value. -func (o *SyntheticsPrivateLocation) SetDescription(v string) { - o.Description = v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocation) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocation) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocation) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SyntheticsPrivateLocation) SetId(v string) { - o.Id = &v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocation) GetMetadata() SyntheticsPrivateLocationMetadata { - if o == nil || o.Metadata == nil { - var ret SyntheticsPrivateLocationMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocation) GetMetadataOk() (*SyntheticsPrivateLocationMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocation) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given SyntheticsPrivateLocationMetadata and assigns it to the Metadata field. -func (o *SyntheticsPrivateLocation) SetMetadata(v SyntheticsPrivateLocationMetadata) { - o.Metadata = &v -} - -// GetName returns the Name field value. -func (o *SyntheticsPrivateLocation) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocation) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SyntheticsPrivateLocation) SetName(v string) { - o.Name = v -} - -// GetSecrets returns the Secrets field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocation) GetSecrets() SyntheticsPrivateLocationSecrets { - if o == nil || o.Secrets == nil { - var ret SyntheticsPrivateLocationSecrets - return ret - } - return *o.Secrets -} - -// GetSecretsOk returns a tuple with the Secrets field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocation) GetSecretsOk() (*SyntheticsPrivateLocationSecrets, bool) { - if o == nil || o.Secrets == nil { - return nil, false - } - return o.Secrets, true -} - -// HasSecrets returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocation) HasSecrets() bool { - if o != nil && o.Secrets != nil { - return true - } - - return false -} - -// SetSecrets gets a reference to the given SyntheticsPrivateLocationSecrets and assigns it to the Secrets field. -func (o *SyntheticsPrivateLocation) SetSecrets(v SyntheticsPrivateLocationSecrets) { - o.Secrets = &v -} - -// GetTags returns the Tags field value. -func (o *SyntheticsPrivateLocation) GetTags() []string { - if o == nil { - var ret []string - return ret - } - return o.Tags -} - -// GetTagsOk returns a tuple with the Tags field value -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocation) GetTagsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Tags, true -} - -// SetTags sets field value. -func (o *SyntheticsPrivateLocation) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsPrivateLocation) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["description"] = o.Description - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - toSerialize["name"] = o.Name - if o.Secrets != nil { - toSerialize["secrets"] = o.Secrets - } - toSerialize["tags"] = o.Tags - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Description *string `json:"description"` - Name *string `json:"name"` - Tags *[]string `json:"tags"` - }{} - all := struct { - Description string `json:"description"` - Id *string `json:"id,omitempty"` - Metadata *SyntheticsPrivateLocationMetadata `json:"metadata,omitempty"` - Name string `json:"name"` - Secrets *SyntheticsPrivateLocationSecrets `json:"secrets,omitempty"` - Tags []string `json:"tags"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Description == nil { - return fmt.Errorf("Required field description missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Tags == nil { - return fmt.Errorf("Required field tags missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Description = all.Description - o.Id = all.Id - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Name = all.Name - if all.Secrets != nil && all.Secrets.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Secrets = all.Secrets - o.Tags = all.Tags - return nil -} diff --git a/api/v1/datadog/model_synthetics_private_location_creation_response.go b/api/v1/datadog/model_synthetics_private_location_creation_response.go deleted file mode 100644 index 95198ab7343..00000000000 --- a/api/v1/datadog/model_synthetics_private_location_creation_response.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsPrivateLocationCreationResponse Object that contains the new private location, the public key for result encryption, and the configuration skeleton. -type SyntheticsPrivateLocationCreationResponse struct { - // Configuration skeleton for the private location. See installation instructions of the private location on how to use this configuration. - Config interface{} `json:"config,omitempty"` - // Object containing information about the private location to create. - PrivateLocation *SyntheticsPrivateLocation `json:"private_location,omitempty"` - // Public key for the result encryption. - ResultEncryption *SyntheticsPrivateLocationCreationResponseResultEncryption `json:"result_encryption,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{} -} - -// NewSyntheticsPrivateLocationCreationResponse instantiates a new SyntheticsPrivateLocationCreationResponse 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 NewSyntheticsPrivateLocationCreationResponse() *SyntheticsPrivateLocationCreationResponse { - this := SyntheticsPrivateLocationCreationResponse{} - return &this -} - -// NewSyntheticsPrivateLocationCreationResponseWithDefaults instantiates a new SyntheticsPrivateLocationCreationResponse 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 NewSyntheticsPrivateLocationCreationResponseWithDefaults() *SyntheticsPrivateLocationCreationResponse { - this := SyntheticsPrivateLocationCreationResponse{} - return &this -} - -// GetConfig returns the Config field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationCreationResponse) GetConfig() interface{} { - if o == nil || o.Config == nil { - var ret interface{} - 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 *SyntheticsPrivateLocationCreationResponse) GetConfigOk() (*interface{}, 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 *SyntheticsPrivateLocationCreationResponse) HasConfig() bool { - if o != nil && o.Config != nil { - return true - } - - return false -} - -// SetConfig gets a reference to the given interface{} and assigns it to the Config field. -func (o *SyntheticsPrivateLocationCreationResponse) SetConfig(v interface{}) { - o.Config = v -} - -// GetPrivateLocation returns the PrivateLocation field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationCreationResponse) GetPrivateLocation() SyntheticsPrivateLocation { - if o == nil || o.PrivateLocation == nil { - var ret SyntheticsPrivateLocation - return ret - } - return *o.PrivateLocation -} - -// GetPrivateLocationOk returns a tuple with the PrivateLocation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationCreationResponse) GetPrivateLocationOk() (*SyntheticsPrivateLocation, bool) { - if o == nil || o.PrivateLocation == nil { - return nil, false - } - return o.PrivateLocation, true -} - -// HasPrivateLocation returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationCreationResponse) HasPrivateLocation() bool { - if o != nil && o.PrivateLocation != nil { - return true - } - - return false -} - -// SetPrivateLocation gets a reference to the given SyntheticsPrivateLocation and assigns it to the PrivateLocation field. -func (o *SyntheticsPrivateLocationCreationResponse) SetPrivateLocation(v SyntheticsPrivateLocation) { - o.PrivateLocation = &v -} - -// GetResultEncryption returns the ResultEncryption field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationCreationResponse) GetResultEncryption() SyntheticsPrivateLocationCreationResponseResultEncryption { - if o == nil || o.ResultEncryption == nil { - var ret SyntheticsPrivateLocationCreationResponseResultEncryption - return ret - } - return *o.ResultEncryption -} - -// GetResultEncryptionOk returns a tuple with the ResultEncryption field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationCreationResponse) GetResultEncryptionOk() (*SyntheticsPrivateLocationCreationResponseResultEncryption, bool) { - if o == nil || o.ResultEncryption == nil { - return nil, false - } - return o.ResultEncryption, true -} - -// HasResultEncryption returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationCreationResponse) HasResultEncryption() bool { - if o != nil && o.ResultEncryption != nil { - return true - } - - return false -} - -// SetResultEncryption gets a reference to the given SyntheticsPrivateLocationCreationResponseResultEncryption and assigns it to the ResultEncryption field. -func (o *SyntheticsPrivateLocationCreationResponse) SetResultEncryption(v SyntheticsPrivateLocationCreationResponseResultEncryption) { - o.ResultEncryption = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsPrivateLocationCreationResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Config != nil { - toSerialize["config"] = o.Config - } - if o.PrivateLocation != nil { - toSerialize["private_location"] = o.PrivateLocation - } - if o.ResultEncryption != nil { - toSerialize["result_encryption"] = o.ResultEncryption - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsPrivateLocationCreationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Config interface{} `json:"config,omitempty"` - PrivateLocation *SyntheticsPrivateLocation `json:"private_location,omitempty"` - ResultEncryption *SyntheticsPrivateLocationCreationResponseResultEncryption `json:"result_encryption,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Config = all.Config - if all.PrivateLocation != nil && all.PrivateLocation.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.PrivateLocation = all.PrivateLocation - if all.ResultEncryption != nil && all.ResultEncryption.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ResultEncryption = all.ResultEncryption - return nil -} diff --git a/api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go b/api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go deleted file mode 100644 index e8283780af5..00000000000 --- a/api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsPrivateLocationCreationResponseResultEncryption Public key for the result encryption. -type SyntheticsPrivateLocationCreationResponseResultEncryption struct { - // Fingerprint for the encryption key. - Id *string `json:"id,omitempty"` - // Public key for result encryption. - Key *string `json:"key,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{} -} - -// NewSyntheticsPrivateLocationCreationResponseResultEncryption instantiates a new SyntheticsPrivateLocationCreationResponseResultEncryption 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 NewSyntheticsPrivateLocationCreationResponseResultEncryption() *SyntheticsPrivateLocationCreationResponseResultEncryption { - this := SyntheticsPrivateLocationCreationResponseResultEncryption{} - return &this -} - -// NewSyntheticsPrivateLocationCreationResponseResultEncryptionWithDefaults instantiates a new SyntheticsPrivateLocationCreationResponseResultEncryption 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 NewSyntheticsPrivateLocationCreationResponseResultEncryptionWithDefaults() *SyntheticsPrivateLocationCreationResponseResultEncryption { - this := SyntheticsPrivateLocationCreationResponseResultEncryption{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) SetId(v string) { - o.Id = &v -} - -// GetKey returns the Key field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetKey() string { - if o == nil || o.Key == nil { - var ret string - return ret - } - return *o.Key -} - -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetKeyOk() (*string, bool) { - if o == nil || o.Key == nil { - return nil, false - } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false -} - -// SetKey gets a reference to the given string and assigns it to the Key field. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) SetKey(v string) { - o.Key = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsPrivateLocationCreationResponseResultEncryption) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Key != nil { - toSerialize["key"] = o.Key - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Key *string `json:"key,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Key = all.Key - return nil -} diff --git a/api/v1/datadog/model_synthetics_private_location_metadata.go b/api/v1/datadog/model_synthetics_private_location_metadata.go deleted file mode 100644 index 3a8a485fbf3..00000000000 --- a/api/v1/datadog/model_synthetics_private_location_metadata.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsPrivateLocationMetadata Object containing metadata about the private location. -type SyntheticsPrivateLocationMetadata struct { - // A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. - RestrictedRoles []string `json:"restricted_roles,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{} -} - -// NewSyntheticsPrivateLocationMetadata instantiates a new SyntheticsPrivateLocationMetadata 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 NewSyntheticsPrivateLocationMetadata() *SyntheticsPrivateLocationMetadata { - this := SyntheticsPrivateLocationMetadata{} - return &this -} - -// NewSyntheticsPrivateLocationMetadataWithDefaults instantiates a new SyntheticsPrivateLocationMetadata 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 NewSyntheticsPrivateLocationMetadataWithDefaults() *SyntheticsPrivateLocationMetadata { - this := SyntheticsPrivateLocationMetadata{} - return &this -} - -// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationMetadata) GetRestrictedRoles() []string { - if o == nil || o.RestrictedRoles == nil { - var ret []string - return ret - } - return o.RestrictedRoles -} - -// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationMetadata) GetRestrictedRolesOk() (*[]string, bool) { - if o == nil || o.RestrictedRoles == nil { - return nil, false - } - return &o.RestrictedRoles, true -} - -// HasRestrictedRoles returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationMetadata) HasRestrictedRoles() bool { - if o != nil && o.RestrictedRoles != nil { - return true - } - - return false -} - -// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. -func (o *SyntheticsPrivateLocationMetadata) SetRestrictedRoles(v []string) { - o.RestrictedRoles = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsPrivateLocationMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.RestrictedRoles != nil { - toSerialize["restricted_roles"] = o.RestrictedRoles - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsPrivateLocationMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - RestrictedRoles []string `json:"restricted_roles,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.RestrictedRoles = all.RestrictedRoles - return nil -} diff --git a/api/v1/datadog/model_synthetics_private_location_secrets.go b/api/v1/datadog/model_synthetics_private_location_secrets.go deleted file mode 100644 index 7e4d2e3aeac..00000000000 --- a/api/v1/datadog/model_synthetics_private_location_secrets.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsPrivateLocationSecrets Secrets for the private location. Only present in the response when creating the private location. -type SyntheticsPrivateLocationSecrets struct { - // Authentication part of the secrets. - Authentication *SyntheticsPrivateLocationSecretsAuthentication `json:"authentication,omitempty"` - // Private key for the private location. - ConfigDecryption *SyntheticsPrivateLocationSecretsConfigDecryption `json:"config_decryption,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{} -} - -// NewSyntheticsPrivateLocationSecrets instantiates a new SyntheticsPrivateLocationSecrets 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 NewSyntheticsPrivateLocationSecrets() *SyntheticsPrivateLocationSecrets { - this := SyntheticsPrivateLocationSecrets{} - return &this -} - -// NewSyntheticsPrivateLocationSecretsWithDefaults instantiates a new SyntheticsPrivateLocationSecrets 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 NewSyntheticsPrivateLocationSecretsWithDefaults() *SyntheticsPrivateLocationSecrets { - this := SyntheticsPrivateLocationSecrets{} - return &this -} - -// GetAuthentication returns the Authentication field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationSecrets) GetAuthentication() SyntheticsPrivateLocationSecretsAuthentication { - if o == nil || o.Authentication == nil { - var ret SyntheticsPrivateLocationSecretsAuthentication - return ret - } - return *o.Authentication -} - -// GetAuthenticationOk returns a tuple with the Authentication field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationSecrets) GetAuthenticationOk() (*SyntheticsPrivateLocationSecretsAuthentication, bool) { - if o == nil || o.Authentication == nil { - return nil, false - } - return o.Authentication, true -} - -// HasAuthentication returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationSecrets) HasAuthentication() bool { - if o != nil && o.Authentication != nil { - return true - } - - return false -} - -// SetAuthentication gets a reference to the given SyntheticsPrivateLocationSecretsAuthentication and assigns it to the Authentication field. -func (o *SyntheticsPrivateLocationSecrets) SetAuthentication(v SyntheticsPrivateLocationSecretsAuthentication) { - o.Authentication = &v -} - -// GetConfigDecryption returns the ConfigDecryption field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationSecrets) GetConfigDecryption() SyntheticsPrivateLocationSecretsConfigDecryption { - if o == nil || o.ConfigDecryption == nil { - var ret SyntheticsPrivateLocationSecretsConfigDecryption - return ret - } - return *o.ConfigDecryption -} - -// GetConfigDecryptionOk returns a tuple with the ConfigDecryption field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationSecrets) GetConfigDecryptionOk() (*SyntheticsPrivateLocationSecretsConfigDecryption, bool) { - if o == nil || o.ConfigDecryption == nil { - return nil, false - } - return o.ConfigDecryption, true -} - -// HasConfigDecryption returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationSecrets) HasConfigDecryption() bool { - if o != nil && o.ConfigDecryption != nil { - return true - } - - return false -} - -// SetConfigDecryption gets a reference to the given SyntheticsPrivateLocationSecretsConfigDecryption and assigns it to the ConfigDecryption field. -func (o *SyntheticsPrivateLocationSecrets) SetConfigDecryption(v SyntheticsPrivateLocationSecretsConfigDecryption) { - o.ConfigDecryption = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsPrivateLocationSecrets) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Authentication != nil { - toSerialize["authentication"] = o.Authentication - } - if o.ConfigDecryption != nil { - toSerialize["config_decryption"] = o.ConfigDecryption - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsPrivateLocationSecrets) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Authentication *SyntheticsPrivateLocationSecretsAuthentication `json:"authentication,omitempty"` - ConfigDecryption *SyntheticsPrivateLocationSecretsConfigDecryption `json:"config_decryption,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Authentication != nil && all.Authentication.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Authentication = all.Authentication - if all.ConfigDecryption != nil && all.ConfigDecryption.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ConfigDecryption = all.ConfigDecryption - return nil -} diff --git a/api/v1/datadog/model_synthetics_private_location_secrets_authentication.go b/api/v1/datadog/model_synthetics_private_location_secrets_authentication.go deleted file mode 100644 index 58a8b2da515..00000000000 --- a/api/v1/datadog/model_synthetics_private_location_secrets_authentication.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsPrivateLocationSecretsAuthentication Authentication part of the secrets. -type SyntheticsPrivateLocationSecretsAuthentication struct { - // Access key for the private location. - Id *string `json:"id,omitempty"` - // Secret access key for the private location. - Key *string `json:"key,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{} -} - -// NewSyntheticsPrivateLocationSecretsAuthentication instantiates a new SyntheticsPrivateLocationSecretsAuthentication 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 NewSyntheticsPrivateLocationSecretsAuthentication() *SyntheticsPrivateLocationSecretsAuthentication { - this := SyntheticsPrivateLocationSecretsAuthentication{} - return &this -} - -// NewSyntheticsPrivateLocationSecretsAuthenticationWithDefaults instantiates a new SyntheticsPrivateLocationSecretsAuthentication 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 NewSyntheticsPrivateLocationSecretsAuthenticationWithDefaults() *SyntheticsPrivateLocationSecretsAuthentication { - this := SyntheticsPrivateLocationSecretsAuthentication{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationSecretsAuthentication) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationSecretsAuthentication) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationSecretsAuthentication) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SyntheticsPrivateLocationSecretsAuthentication) SetId(v string) { - o.Id = &v -} - -// GetKey returns the Key field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationSecretsAuthentication) GetKey() string { - if o == nil || o.Key == nil { - var ret string - return ret - } - return *o.Key -} - -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationSecretsAuthentication) GetKeyOk() (*string, bool) { - if o == nil || o.Key == nil { - return nil, false - } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationSecretsAuthentication) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false -} - -// SetKey gets a reference to the given string and assigns it to the Key field. -func (o *SyntheticsPrivateLocationSecretsAuthentication) SetKey(v string) { - o.Key = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsPrivateLocationSecretsAuthentication) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Key != nil { - toSerialize["key"] = o.Key - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsPrivateLocationSecretsAuthentication) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Key *string `json:"key,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Key = all.Key - return nil -} diff --git a/api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.go b/api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.go deleted file mode 100644 index 5d9d8959b04..00000000000 --- a/api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsPrivateLocationSecretsConfigDecryption Private key for the private location. -type SyntheticsPrivateLocationSecretsConfigDecryption struct { - // Private key for the private location. - Key *string `json:"key,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{} -} - -// NewSyntheticsPrivateLocationSecretsConfigDecryption instantiates a new SyntheticsPrivateLocationSecretsConfigDecryption 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 NewSyntheticsPrivateLocationSecretsConfigDecryption() *SyntheticsPrivateLocationSecretsConfigDecryption { - this := SyntheticsPrivateLocationSecretsConfigDecryption{} - return &this -} - -// NewSyntheticsPrivateLocationSecretsConfigDecryptionWithDefaults instantiates a new SyntheticsPrivateLocationSecretsConfigDecryption 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 NewSyntheticsPrivateLocationSecretsConfigDecryptionWithDefaults() *SyntheticsPrivateLocationSecretsConfigDecryption { - this := SyntheticsPrivateLocationSecretsConfigDecryption{} - return &this -} - -// GetKey returns the Key field value if set, zero value otherwise. -func (o *SyntheticsPrivateLocationSecretsConfigDecryption) GetKey() string { - if o == nil || o.Key == nil { - var ret string - return ret - } - return *o.Key -} - -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsPrivateLocationSecretsConfigDecryption) GetKeyOk() (*string, bool) { - if o == nil || o.Key == nil { - return nil, false - } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *SyntheticsPrivateLocationSecretsConfigDecryption) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false -} - -// SetKey gets a reference to the given string and assigns it to the Key field. -func (o *SyntheticsPrivateLocationSecretsConfigDecryption) SetKey(v string) { - o.Key = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsPrivateLocationSecretsConfigDecryption) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Key != nil { - toSerialize["key"] = o.Key - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsPrivateLocationSecretsConfigDecryption) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Key *string `json:"key,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Key = all.Key - return nil -} diff --git a/api/v1/datadog/model_synthetics_ssl_certificate.go b/api/v1/datadog/model_synthetics_ssl_certificate.go deleted file mode 100644 index 06a908b2737..00000000000 --- a/api/v1/datadog/model_synthetics_ssl_certificate.go +++ /dev/null @@ -1,554 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// SyntheticsSSLCertificate Object describing the SSL certificate used for a Synthetic test. -type SyntheticsSSLCertificate struct { - // Cipher used for the connection. - Cipher *string `json:"cipher,omitempty"` - // Exponent associated to the certificate. - Exponent *float64 `json:"exponent,omitempty"` - // Array of extensions and details used for the certificate. - ExtKeyUsage []string `json:"extKeyUsage,omitempty"` - // MD5 digest of the DER-encoded Certificate information. - Fingerprint *string `json:"fingerprint,omitempty"` - // SHA-1 digest of the DER-encoded Certificate information. - Fingerprint256 *string `json:"fingerprint256,omitempty"` - // Object describing the issuer of a SSL certificate. - Issuer *SyntheticsSSLCertificateIssuer `json:"issuer,omitempty"` - // Modulus associated to the SSL certificate private key. - Modulus *string `json:"modulus,omitempty"` - // TLS protocol used for the test. - Protocol *string `json:"protocol,omitempty"` - // Serial Number assigned by Symantec to the SSL certificate. - SerialNumber *string `json:"serialNumber,omitempty"` - // Object describing the SSL certificate used for the test. - Subject *SyntheticsSSLCertificateSubject `json:"subject,omitempty"` - // Date from which the SSL certificate is valid. - ValidFrom *time.Time `json:"validFrom,omitempty"` - // Date until which the SSL certificate is valid. - ValidTo *time.Time `json:"validTo,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{} -} - -// NewSyntheticsSSLCertificate instantiates a new SyntheticsSSLCertificate 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 NewSyntheticsSSLCertificate() *SyntheticsSSLCertificate { - this := SyntheticsSSLCertificate{} - return &this -} - -// NewSyntheticsSSLCertificateWithDefaults instantiates a new SyntheticsSSLCertificate 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 NewSyntheticsSSLCertificateWithDefaults() *SyntheticsSSLCertificate { - this := SyntheticsSSLCertificate{} - return &this -} - -// GetCipher returns the Cipher field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetCipher() string { - if o == nil || o.Cipher == nil { - var ret string - return ret - } - return *o.Cipher -} - -// GetCipherOk returns a tuple with the Cipher field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetCipherOk() (*string, bool) { - if o == nil || o.Cipher == nil { - return nil, false - } - return o.Cipher, true -} - -// HasCipher returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasCipher() bool { - if o != nil && o.Cipher != nil { - return true - } - - return false -} - -// SetCipher gets a reference to the given string and assigns it to the Cipher field. -func (o *SyntheticsSSLCertificate) SetCipher(v string) { - o.Cipher = &v -} - -// GetExponent returns the Exponent field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetExponent() float64 { - if o == nil || o.Exponent == nil { - var ret float64 - return ret - } - return *o.Exponent -} - -// GetExponentOk returns a tuple with the Exponent field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetExponentOk() (*float64, bool) { - if o == nil || o.Exponent == nil { - return nil, false - } - return o.Exponent, true -} - -// HasExponent returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasExponent() bool { - if o != nil && o.Exponent != nil { - return true - } - - return false -} - -// SetExponent gets a reference to the given float64 and assigns it to the Exponent field. -func (o *SyntheticsSSLCertificate) SetExponent(v float64) { - o.Exponent = &v -} - -// GetExtKeyUsage returns the ExtKeyUsage field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetExtKeyUsage() []string { - if o == nil || o.ExtKeyUsage == nil { - var ret []string - return ret - } - return o.ExtKeyUsage -} - -// GetExtKeyUsageOk returns a tuple with the ExtKeyUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetExtKeyUsageOk() (*[]string, bool) { - if o == nil || o.ExtKeyUsage == nil { - return nil, false - } - return &o.ExtKeyUsage, true -} - -// HasExtKeyUsage returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasExtKeyUsage() bool { - if o != nil && o.ExtKeyUsage != nil { - return true - } - - return false -} - -// SetExtKeyUsage gets a reference to the given []string and assigns it to the ExtKeyUsage field. -func (o *SyntheticsSSLCertificate) SetExtKeyUsage(v []string) { - o.ExtKeyUsage = v -} - -// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetFingerprint() string { - if o == nil || o.Fingerprint == nil { - var ret string - return ret - } - return *o.Fingerprint -} - -// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetFingerprintOk() (*string, bool) { - if o == nil || o.Fingerprint == nil { - return nil, false - } - return o.Fingerprint, true -} - -// HasFingerprint returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasFingerprint() bool { - if o != nil && o.Fingerprint != nil { - return true - } - - return false -} - -// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. -func (o *SyntheticsSSLCertificate) SetFingerprint(v string) { - o.Fingerprint = &v -} - -// GetFingerprint256 returns the Fingerprint256 field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetFingerprint256() string { - if o == nil || o.Fingerprint256 == nil { - var ret string - return ret - } - return *o.Fingerprint256 -} - -// GetFingerprint256Ok returns a tuple with the Fingerprint256 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetFingerprint256Ok() (*string, bool) { - if o == nil || o.Fingerprint256 == nil { - return nil, false - } - return o.Fingerprint256, true -} - -// HasFingerprint256 returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasFingerprint256() bool { - if o != nil && o.Fingerprint256 != nil { - return true - } - - return false -} - -// SetFingerprint256 gets a reference to the given string and assigns it to the Fingerprint256 field. -func (o *SyntheticsSSLCertificate) SetFingerprint256(v string) { - o.Fingerprint256 = &v -} - -// GetIssuer returns the Issuer field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetIssuer() SyntheticsSSLCertificateIssuer { - if o == nil || o.Issuer == nil { - var ret SyntheticsSSLCertificateIssuer - return ret - } - return *o.Issuer -} - -// GetIssuerOk returns a tuple with the Issuer field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetIssuerOk() (*SyntheticsSSLCertificateIssuer, bool) { - if o == nil || o.Issuer == nil { - return nil, false - } - return o.Issuer, true -} - -// HasIssuer returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasIssuer() bool { - if o != nil && o.Issuer != nil { - return true - } - - return false -} - -// SetIssuer gets a reference to the given SyntheticsSSLCertificateIssuer and assigns it to the Issuer field. -func (o *SyntheticsSSLCertificate) SetIssuer(v SyntheticsSSLCertificateIssuer) { - o.Issuer = &v -} - -// GetModulus returns the Modulus field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetModulus() string { - if o == nil || o.Modulus == nil { - var ret string - return ret - } - return *o.Modulus -} - -// GetModulusOk returns a tuple with the Modulus field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetModulusOk() (*string, bool) { - if o == nil || o.Modulus == nil { - return nil, false - } - return o.Modulus, true -} - -// HasModulus returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasModulus() bool { - if o != nil && o.Modulus != nil { - return true - } - - return false -} - -// SetModulus gets a reference to the given string and assigns it to the Modulus field. -func (o *SyntheticsSSLCertificate) SetModulus(v string) { - o.Modulus = &v -} - -// GetProtocol returns the Protocol field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetProtocol() string { - if o == nil || o.Protocol == nil { - var ret string - return ret - } - return *o.Protocol -} - -// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetProtocolOk() (*string, bool) { - if o == nil || o.Protocol == nil { - return nil, false - } - return o.Protocol, true -} - -// HasProtocol returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasProtocol() bool { - if o != nil && o.Protocol != nil { - return true - } - - return false -} - -// SetProtocol gets a reference to the given string and assigns it to the Protocol field. -func (o *SyntheticsSSLCertificate) SetProtocol(v string) { - o.Protocol = &v -} - -// GetSerialNumber returns the SerialNumber field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetSerialNumber() string { - if o == nil || o.SerialNumber == nil { - var ret string - return ret - } - return *o.SerialNumber -} - -// GetSerialNumberOk returns a tuple with the SerialNumber field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetSerialNumberOk() (*string, bool) { - if o == nil || o.SerialNumber == nil { - return nil, false - } - return o.SerialNumber, true -} - -// HasSerialNumber returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasSerialNumber() bool { - if o != nil && o.SerialNumber != nil { - return true - } - - return false -} - -// SetSerialNumber gets a reference to the given string and assigns it to the SerialNumber field. -func (o *SyntheticsSSLCertificate) SetSerialNumber(v string) { - o.SerialNumber = &v -} - -// GetSubject returns the Subject field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetSubject() SyntheticsSSLCertificateSubject { - if o == nil || o.Subject == nil { - var ret SyntheticsSSLCertificateSubject - return ret - } - return *o.Subject -} - -// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetSubjectOk() (*SyntheticsSSLCertificateSubject, bool) { - if o == nil || o.Subject == nil { - return nil, false - } - return o.Subject, true -} - -// HasSubject returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasSubject() bool { - if o != nil && o.Subject != nil { - return true - } - - return false -} - -// SetSubject gets a reference to the given SyntheticsSSLCertificateSubject and assigns it to the Subject field. -func (o *SyntheticsSSLCertificate) SetSubject(v SyntheticsSSLCertificateSubject) { - o.Subject = &v -} - -// GetValidFrom returns the ValidFrom field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetValidFrom() time.Time { - if o == nil || o.ValidFrom == nil { - var ret time.Time - return ret - } - return *o.ValidFrom -} - -// GetValidFromOk returns a tuple with the ValidFrom field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetValidFromOk() (*time.Time, bool) { - if o == nil || o.ValidFrom == nil { - return nil, false - } - return o.ValidFrom, true -} - -// HasValidFrom returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasValidFrom() bool { - if o != nil && o.ValidFrom != nil { - return true - } - - return false -} - -// SetValidFrom gets a reference to the given time.Time and assigns it to the ValidFrom field. -func (o *SyntheticsSSLCertificate) SetValidFrom(v time.Time) { - o.ValidFrom = &v -} - -// GetValidTo returns the ValidTo field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificate) GetValidTo() time.Time { - if o == nil || o.ValidTo == nil { - var ret time.Time - return ret - } - return *o.ValidTo -} - -// GetValidToOk returns a tuple with the ValidTo field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificate) GetValidToOk() (*time.Time, bool) { - if o == nil || o.ValidTo == nil { - return nil, false - } - return o.ValidTo, true -} - -// HasValidTo returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificate) HasValidTo() bool { - if o != nil && o.ValidTo != nil { - return true - } - - return false -} - -// SetValidTo gets a reference to the given time.Time and assigns it to the ValidTo field. -func (o *SyntheticsSSLCertificate) SetValidTo(v time.Time) { - o.ValidTo = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsSSLCertificate) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cipher != nil { - toSerialize["cipher"] = o.Cipher - } - if o.Exponent != nil { - toSerialize["exponent"] = o.Exponent - } - if o.ExtKeyUsage != nil { - toSerialize["extKeyUsage"] = o.ExtKeyUsage - } - if o.Fingerprint != nil { - toSerialize["fingerprint"] = o.Fingerprint - } - if o.Fingerprint256 != nil { - toSerialize["fingerprint256"] = o.Fingerprint256 - } - if o.Issuer != nil { - toSerialize["issuer"] = o.Issuer - } - if o.Modulus != nil { - toSerialize["modulus"] = o.Modulus - } - if o.Protocol != nil { - toSerialize["protocol"] = o.Protocol - } - if o.SerialNumber != nil { - toSerialize["serialNumber"] = o.SerialNumber - } - if o.Subject != nil { - toSerialize["subject"] = o.Subject - } - if o.ValidFrom != nil { - if o.ValidFrom.Nanosecond() == 0 { - toSerialize["validFrom"] = o.ValidFrom.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["validFrom"] = o.ValidFrom.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.ValidTo != nil { - if o.ValidTo.Nanosecond() == 0 { - toSerialize["validTo"] = o.ValidTo.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["validTo"] = o.ValidTo.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsSSLCertificate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cipher *string `json:"cipher,omitempty"` - Exponent *float64 `json:"exponent,omitempty"` - ExtKeyUsage []string `json:"extKeyUsage,omitempty"` - Fingerprint *string `json:"fingerprint,omitempty"` - Fingerprint256 *string `json:"fingerprint256,omitempty"` - Issuer *SyntheticsSSLCertificateIssuer `json:"issuer,omitempty"` - Modulus *string `json:"modulus,omitempty"` - Protocol *string `json:"protocol,omitempty"` - SerialNumber *string `json:"serialNumber,omitempty"` - Subject *SyntheticsSSLCertificateSubject `json:"subject,omitempty"` - ValidFrom *time.Time `json:"validFrom,omitempty"` - ValidTo *time.Time `json:"validTo,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cipher = all.Cipher - o.Exponent = all.Exponent - o.ExtKeyUsage = all.ExtKeyUsage - o.Fingerprint = all.Fingerprint - o.Fingerprint256 = all.Fingerprint256 - if all.Issuer != nil && all.Issuer.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Issuer = all.Issuer - o.Modulus = all.Modulus - o.Protocol = all.Protocol - o.SerialNumber = all.SerialNumber - if all.Subject != nil && all.Subject.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Subject = all.Subject - o.ValidFrom = all.ValidFrom - o.ValidTo = all.ValidTo - return nil -} diff --git a/api/v1/datadog/model_synthetics_ssl_certificate_issuer.go b/api/v1/datadog/model_synthetics_ssl_certificate_issuer.go deleted file mode 100644 index 2f5b7a57f39..00000000000 --- a/api/v1/datadog/model_synthetics_ssl_certificate_issuer.go +++ /dev/null @@ -1,297 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsSSLCertificateIssuer Object describing the issuer of a SSL certificate. -type SyntheticsSSLCertificateIssuer struct { - // Country Name that issued the certificate. - C *string `json:"C,omitempty"` - // Common Name that issued certificate. - Cn *string `json:"CN,omitempty"` - // Locality that issued the certificate. - L *string `json:"L,omitempty"` - // Organization that issued the certificate. - O *string `json:"O,omitempty"` - // Organizational Unit that issued the certificate. - Ou *string `json:"OU,omitempty"` - // State Or Province Name that issued the certificate. - St *string `json:"ST,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{} -} - -// NewSyntheticsSSLCertificateIssuer instantiates a new SyntheticsSSLCertificateIssuer 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 NewSyntheticsSSLCertificateIssuer() *SyntheticsSSLCertificateIssuer { - this := SyntheticsSSLCertificateIssuer{} - return &this -} - -// NewSyntheticsSSLCertificateIssuerWithDefaults instantiates a new SyntheticsSSLCertificateIssuer 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 NewSyntheticsSSLCertificateIssuerWithDefaults() *SyntheticsSSLCertificateIssuer { - this := SyntheticsSSLCertificateIssuer{} - return &this -} - -// GetC returns the C field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateIssuer) GetC() string { - if o == nil || o.C == nil { - var ret string - return ret - } - return *o.C -} - -// GetCOk returns a tuple with the C field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateIssuer) GetCOk() (*string, bool) { - if o == nil || o.C == nil { - return nil, false - } - return o.C, true -} - -// HasC returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateIssuer) HasC() bool { - if o != nil && o.C != nil { - return true - } - - return false -} - -// SetC gets a reference to the given string and assigns it to the C field. -func (o *SyntheticsSSLCertificateIssuer) SetC(v string) { - o.C = &v -} - -// GetCn returns the Cn field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateIssuer) GetCn() string { - if o == nil || o.Cn == nil { - var ret string - return ret - } - return *o.Cn -} - -// GetCnOk returns a tuple with the Cn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateIssuer) GetCnOk() (*string, bool) { - if o == nil || o.Cn == nil { - return nil, false - } - return o.Cn, true -} - -// HasCn returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateIssuer) HasCn() bool { - if o != nil && o.Cn != nil { - return true - } - - return false -} - -// SetCn gets a reference to the given string and assigns it to the Cn field. -func (o *SyntheticsSSLCertificateIssuer) SetCn(v string) { - o.Cn = &v -} - -// GetL returns the L field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateIssuer) GetL() string { - if o == nil || o.L == nil { - var ret string - return ret - } - return *o.L -} - -// GetLOk returns a tuple with the L field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateIssuer) GetLOk() (*string, bool) { - if o == nil || o.L == nil { - return nil, false - } - return o.L, true -} - -// HasL returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateIssuer) HasL() bool { - if o != nil && o.L != nil { - return true - } - - return false -} - -// SetL gets a reference to the given string and assigns it to the L field. -func (o *SyntheticsSSLCertificateIssuer) SetL(v string) { - o.L = &v -} - -// GetO returns the O field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateIssuer) GetO() string { - if o == nil || o.O == nil { - var ret string - return ret - } - return *o.O -} - -// GetOOk returns a tuple with the O field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateIssuer) GetOOk() (*string, bool) { - if o == nil || o.O == nil { - return nil, false - } - return o.O, true -} - -// HasO returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateIssuer) HasO() bool { - if o != nil && o.O != nil { - return true - } - - return false -} - -// SetO gets a reference to the given string and assigns it to the O field. -func (o *SyntheticsSSLCertificateIssuer) SetO(v string) { - o.O = &v -} - -// GetOu returns the Ou field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateIssuer) GetOu() string { - if o == nil || o.Ou == nil { - var ret string - return ret - } - return *o.Ou -} - -// GetOuOk returns a tuple with the Ou field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateIssuer) GetOuOk() (*string, bool) { - if o == nil || o.Ou == nil { - return nil, false - } - return o.Ou, true -} - -// HasOu returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateIssuer) HasOu() bool { - if o != nil && o.Ou != nil { - return true - } - - return false -} - -// SetOu gets a reference to the given string and assigns it to the Ou field. -func (o *SyntheticsSSLCertificateIssuer) SetOu(v string) { - o.Ou = &v -} - -// GetSt returns the St field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateIssuer) GetSt() string { - if o == nil || o.St == nil { - var ret string - return ret - } - return *o.St -} - -// GetStOk returns a tuple with the St field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateIssuer) GetStOk() (*string, bool) { - if o == nil || o.St == nil { - return nil, false - } - return o.St, true -} - -// HasSt returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateIssuer) HasSt() bool { - if o != nil && o.St != nil { - return true - } - - return false -} - -// SetSt gets a reference to the given string and assigns it to the St field. -func (o *SyntheticsSSLCertificateIssuer) SetSt(v string) { - o.St = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsSSLCertificateIssuer) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.C != nil { - toSerialize["C"] = o.C - } - if o.Cn != nil { - toSerialize["CN"] = o.Cn - } - if o.L != nil { - toSerialize["L"] = o.L - } - if o.O != nil { - toSerialize["O"] = o.O - } - if o.Ou != nil { - toSerialize["OU"] = o.Ou - } - if o.St != nil { - toSerialize["ST"] = o.St - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsSSLCertificateIssuer) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - C *string `json:"C,omitempty"` - Cn *string `json:"CN,omitempty"` - L *string `json:"L,omitempty"` - O *string `json:"O,omitempty"` - Ou *string `json:"OU,omitempty"` - St *string `json:"ST,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.C = all.C - o.Cn = all.Cn - o.L = all.L - o.O = all.O - o.Ou = all.Ou - o.St = all.St - return nil -} diff --git a/api/v1/datadog/model_synthetics_ssl_certificate_subject.go b/api/v1/datadog/model_synthetics_ssl_certificate_subject.go deleted file mode 100644 index 64f0bc8b90e..00000000000 --- a/api/v1/datadog/model_synthetics_ssl_certificate_subject.go +++ /dev/null @@ -1,336 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsSSLCertificateSubject Object describing the SSL certificate used for the test. -type SyntheticsSSLCertificateSubject struct { - // Country Name associated with the certificate. - C *string `json:"C,omitempty"` - // Common Name that associated with the certificate. - Cn *string `json:"CN,omitempty"` - // Locality associated with the certificate. - L *string `json:"L,omitempty"` - // Organization associated with the certificate. - O *string `json:"O,omitempty"` - // Organizational Unit associated with the certificate. - Ou *string `json:"OU,omitempty"` - // State Or Province Name associated with the certificate. - St *string `json:"ST,omitempty"` - // Subject Alternative Name associated with the certificate. - AltName *string `json:"altName,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{} -} - -// NewSyntheticsSSLCertificateSubject instantiates a new SyntheticsSSLCertificateSubject 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 NewSyntheticsSSLCertificateSubject() *SyntheticsSSLCertificateSubject { - this := SyntheticsSSLCertificateSubject{} - return &this -} - -// NewSyntheticsSSLCertificateSubjectWithDefaults instantiates a new SyntheticsSSLCertificateSubject 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 NewSyntheticsSSLCertificateSubjectWithDefaults() *SyntheticsSSLCertificateSubject { - this := SyntheticsSSLCertificateSubject{} - return &this -} - -// GetC returns the C field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateSubject) GetC() string { - if o == nil || o.C == nil { - var ret string - return ret - } - return *o.C -} - -// GetCOk returns a tuple with the C field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateSubject) GetCOk() (*string, bool) { - if o == nil || o.C == nil { - return nil, false - } - return o.C, true -} - -// HasC returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateSubject) HasC() bool { - if o != nil && o.C != nil { - return true - } - - return false -} - -// SetC gets a reference to the given string and assigns it to the C field. -func (o *SyntheticsSSLCertificateSubject) SetC(v string) { - o.C = &v -} - -// GetCn returns the Cn field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateSubject) GetCn() string { - if o == nil || o.Cn == nil { - var ret string - return ret - } - return *o.Cn -} - -// GetCnOk returns a tuple with the Cn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateSubject) GetCnOk() (*string, bool) { - if o == nil || o.Cn == nil { - return nil, false - } - return o.Cn, true -} - -// HasCn returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateSubject) HasCn() bool { - if o != nil && o.Cn != nil { - return true - } - - return false -} - -// SetCn gets a reference to the given string and assigns it to the Cn field. -func (o *SyntheticsSSLCertificateSubject) SetCn(v string) { - o.Cn = &v -} - -// GetL returns the L field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateSubject) GetL() string { - if o == nil || o.L == nil { - var ret string - return ret - } - return *o.L -} - -// GetLOk returns a tuple with the L field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateSubject) GetLOk() (*string, bool) { - if o == nil || o.L == nil { - return nil, false - } - return o.L, true -} - -// HasL returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateSubject) HasL() bool { - if o != nil && o.L != nil { - return true - } - - return false -} - -// SetL gets a reference to the given string and assigns it to the L field. -func (o *SyntheticsSSLCertificateSubject) SetL(v string) { - o.L = &v -} - -// GetO returns the O field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateSubject) GetO() string { - if o == nil || o.O == nil { - var ret string - return ret - } - return *o.O -} - -// GetOOk returns a tuple with the O field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateSubject) GetOOk() (*string, bool) { - if o == nil || o.O == nil { - return nil, false - } - return o.O, true -} - -// HasO returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateSubject) HasO() bool { - if o != nil && o.O != nil { - return true - } - - return false -} - -// SetO gets a reference to the given string and assigns it to the O field. -func (o *SyntheticsSSLCertificateSubject) SetO(v string) { - o.O = &v -} - -// GetOu returns the Ou field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateSubject) GetOu() string { - if o == nil || o.Ou == nil { - var ret string - return ret - } - return *o.Ou -} - -// GetOuOk returns a tuple with the Ou field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateSubject) GetOuOk() (*string, bool) { - if o == nil || o.Ou == nil { - return nil, false - } - return o.Ou, true -} - -// HasOu returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateSubject) HasOu() bool { - if o != nil && o.Ou != nil { - return true - } - - return false -} - -// SetOu gets a reference to the given string and assigns it to the Ou field. -func (o *SyntheticsSSLCertificateSubject) SetOu(v string) { - o.Ou = &v -} - -// GetSt returns the St field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateSubject) GetSt() string { - if o == nil || o.St == nil { - var ret string - return ret - } - return *o.St -} - -// GetStOk returns a tuple with the St field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateSubject) GetStOk() (*string, bool) { - if o == nil || o.St == nil { - return nil, false - } - return o.St, true -} - -// HasSt returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateSubject) HasSt() bool { - if o != nil && o.St != nil { - return true - } - - return false -} - -// SetSt gets a reference to the given string and assigns it to the St field. -func (o *SyntheticsSSLCertificateSubject) SetSt(v string) { - o.St = &v -} - -// GetAltName returns the AltName field value if set, zero value otherwise. -func (o *SyntheticsSSLCertificateSubject) GetAltName() string { - if o == nil || o.AltName == nil { - var ret string - return ret - } - return *o.AltName -} - -// GetAltNameOk returns a tuple with the AltName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsSSLCertificateSubject) GetAltNameOk() (*string, bool) { - if o == nil || o.AltName == nil { - return nil, false - } - return o.AltName, true -} - -// HasAltName returns a boolean if a field has been set. -func (o *SyntheticsSSLCertificateSubject) HasAltName() bool { - if o != nil && o.AltName != nil { - return true - } - - return false -} - -// SetAltName gets a reference to the given string and assigns it to the AltName field. -func (o *SyntheticsSSLCertificateSubject) SetAltName(v string) { - o.AltName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsSSLCertificateSubject) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.C != nil { - toSerialize["C"] = o.C - } - if o.Cn != nil { - toSerialize["CN"] = o.Cn - } - if o.L != nil { - toSerialize["L"] = o.L - } - if o.O != nil { - toSerialize["O"] = o.O - } - if o.Ou != nil { - toSerialize["OU"] = o.Ou - } - if o.St != nil { - toSerialize["ST"] = o.St - } - if o.AltName != nil { - toSerialize["altName"] = o.AltName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsSSLCertificateSubject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - C *string `json:"C,omitempty"` - Cn *string `json:"CN,omitempty"` - L *string `json:"L,omitempty"` - O *string `json:"O,omitempty"` - Ou *string `json:"OU,omitempty"` - St *string `json:"ST,omitempty"` - AltName *string `json:"altName,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.C = all.C - o.Cn = all.Cn - o.L = all.L - o.O = all.O - o.Ou = all.Ou - o.St = all.St - o.AltName = all.AltName - return nil -} diff --git a/api/v1/datadog/model_synthetics_status.go b/api/v1/datadog/model_synthetics_status.go deleted file mode 100644 index b6f66ac5600..00000000000 --- a/api/v1/datadog/model_synthetics_status.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsStatus Determines whether or not the batch has passed, failed, or is in progress. -type SyntheticsStatus string - -// List of SyntheticsStatus. -const ( - SYNTHETICSSTATUS_PASSED SyntheticsStatus = "passed" - SYNTHETICSSTATUS_skipped SyntheticsStatus = "skipped" - SYNTHETICSSTATUS_failed SyntheticsStatus = "failed" -) - -var allowedSyntheticsStatusEnumValues = []SyntheticsStatus{ - SYNTHETICSSTATUS_PASSED, - SYNTHETICSSTATUS_skipped, - SYNTHETICSSTATUS_failed, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsStatus) GetAllowedValues() []SyntheticsStatus { - return allowedSyntheticsStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsStatus(value) - return nil -} - -// NewSyntheticsStatusFromValue returns a pointer to a valid SyntheticsStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsStatusFromValue(v string) (*SyntheticsStatus, error) { - ev := SyntheticsStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsStatus: valid values are %v", v, allowedSyntheticsStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsStatus) IsValid() bool { - for _, existing := range allowedSyntheticsStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsStatus value. -func (v SyntheticsStatus) Ptr() *SyntheticsStatus { - return &v -} - -// NullableSyntheticsStatus handles when a null is used for SyntheticsStatus. -type NullableSyntheticsStatus struct { - value *SyntheticsStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsStatus) Get() *SyntheticsStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsStatus) Set(val *SyntheticsStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsStatus(val *SyntheticsStatus) *NullableSyntheticsStatus { - return &NullableSyntheticsStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_step.go b/api/v1/datadog/model_synthetics_step.go deleted file mode 100644 index cec6c47f2fd..00000000000 --- a/api/v1/datadog/model_synthetics_step.go +++ /dev/null @@ -1,305 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsStep The steps used in a Synthetics browser test. -type SyntheticsStep struct { - // A boolean set to allow this step to fail. - AllowFailure *bool `json:"allowFailure,omitempty"` - // A boolean to use in addition to `allowFailure` to determine if the test should be marked as failed when the step fails. - IsCritical *bool `json:"isCritical,omitempty"` - // The name of the step. - Name *string `json:"name,omitempty"` - // The parameters of the step. - Params interface{} `json:"params,omitempty"` - // The time before declaring a step failed. - Timeout *int64 `json:"timeout,omitempty"` - // Step type used in your Synthetic test. - Type *SyntheticsStepType `json:"type,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{} -} - -// NewSyntheticsStep instantiates a new SyntheticsStep 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 NewSyntheticsStep() *SyntheticsStep { - this := SyntheticsStep{} - return &this -} - -// NewSyntheticsStepWithDefaults instantiates a new SyntheticsStep 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 NewSyntheticsStepWithDefaults() *SyntheticsStep { - this := SyntheticsStep{} - return &this -} - -// GetAllowFailure returns the AllowFailure field value if set, zero value otherwise. -func (o *SyntheticsStep) GetAllowFailure() bool { - if o == nil || o.AllowFailure == nil { - var ret bool - return ret - } - return *o.AllowFailure -} - -// GetAllowFailureOk returns a tuple with the AllowFailure field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStep) GetAllowFailureOk() (*bool, bool) { - if o == nil || o.AllowFailure == nil { - return nil, false - } - return o.AllowFailure, true -} - -// HasAllowFailure returns a boolean if a field has been set. -func (o *SyntheticsStep) HasAllowFailure() bool { - if o != nil && o.AllowFailure != nil { - return true - } - - return false -} - -// SetAllowFailure gets a reference to the given bool and assigns it to the AllowFailure field. -func (o *SyntheticsStep) SetAllowFailure(v bool) { - o.AllowFailure = &v -} - -// GetIsCritical returns the IsCritical field value if set, zero value otherwise. -func (o *SyntheticsStep) GetIsCritical() bool { - if o == nil || o.IsCritical == nil { - var ret bool - return ret - } - return *o.IsCritical -} - -// GetIsCriticalOk returns a tuple with the IsCritical field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStep) GetIsCriticalOk() (*bool, bool) { - if o == nil || o.IsCritical == nil { - return nil, false - } - return o.IsCritical, true -} - -// HasIsCritical returns a boolean if a field has been set. -func (o *SyntheticsStep) HasIsCritical() bool { - if o != nil && o.IsCritical != nil { - return true - } - - return false -} - -// SetIsCritical gets a reference to the given bool and assigns it to the IsCritical field. -func (o *SyntheticsStep) SetIsCritical(v bool) { - o.IsCritical = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SyntheticsStep) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStep) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SyntheticsStep) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SyntheticsStep) SetName(v string) { - o.Name = &v -} - -// GetParams returns the Params field value if set, zero value otherwise. -func (o *SyntheticsStep) GetParams() interface{} { - if o == nil || o.Params == nil { - var ret interface{} - return ret - } - return o.Params -} - -// GetParamsOk returns a tuple with the Params field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStep) GetParamsOk() (*interface{}, bool) { - if o == nil || o.Params == nil { - return nil, false - } - return &o.Params, true -} - -// HasParams returns a boolean if a field has been set. -func (o *SyntheticsStep) HasParams() bool { - if o != nil && o.Params != nil { - return true - } - - return false -} - -// SetParams gets a reference to the given interface{} and assigns it to the Params field. -func (o *SyntheticsStep) SetParams(v interface{}) { - o.Params = v -} - -// GetTimeout returns the Timeout field value if set, zero value otherwise. -func (o *SyntheticsStep) GetTimeout() int64 { - if o == nil || o.Timeout == nil { - var ret int64 - return ret - } - return *o.Timeout -} - -// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStep) GetTimeoutOk() (*int64, bool) { - if o == nil || o.Timeout == nil { - return nil, false - } - return o.Timeout, true -} - -// HasTimeout returns a boolean if a field has been set. -func (o *SyntheticsStep) HasTimeout() bool { - if o != nil && o.Timeout != nil { - return true - } - - return false -} - -// SetTimeout gets a reference to the given int64 and assigns it to the Timeout field. -func (o *SyntheticsStep) SetTimeout(v int64) { - o.Timeout = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SyntheticsStep) GetType() SyntheticsStepType { - if o == nil || o.Type == nil { - var ret SyntheticsStepType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStep) GetTypeOk() (*SyntheticsStepType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SyntheticsStep) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SyntheticsStepType and assigns it to the Type field. -func (o *SyntheticsStep) SetType(v SyntheticsStepType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsStep) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AllowFailure != nil { - toSerialize["allowFailure"] = o.AllowFailure - } - if o.IsCritical != nil { - toSerialize["isCritical"] = o.IsCritical - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Params != nil { - toSerialize["params"] = o.Params - } - if o.Timeout != nil { - toSerialize["timeout"] = o.Timeout - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AllowFailure *bool `json:"allowFailure,omitempty"` - IsCritical *bool `json:"isCritical,omitempty"` - Name *string `json:"name,omitempty"` - Params interface{} `json:"params,omitempty"` - Timeout *int64 `json:"timeout,omitempty"` - Type *SyntheticsStepType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AllowFailure = all.AllowFailure - o.IsCritical = all.IsCritical - o.Name = all.Name - o.Params = all.Params - o.Timeout = all.Timeout - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_step_detail.go b/api/v1/datadog/model_synthetics_step_detail.go deleted file mode 100644 index 928074e3556..00000000000 --- a/api/v1/datadog/model_synthetics_step_detail.go +++ /dev/null @@ -1,751 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsStepDetail Object describing a step for a Synthetic test. -type SyntheticsStepDetail struct { - // Array of errors collected for a browser test. - BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"` - // Type of assertion to apply in an API test. - CheckType *SyntheticsCheckType `json:"checkType,omitempty"` - // Description of the test. - Description *string `json:"description,omitempty"` - // Total duration in millisecond of the test. - Duration *float64 `json:"duration,omitempty"` - // Error returned by the test. - Error *string `json:"error,omitempty"` - // Navigate between different tabs for your browser test. - PlayingTab *SyntheticsPlayingTab `json:"playingTab,omitempty"` - // Whether or not screenshots where collected by the test. - ScreenshotBucketKey *bool `json:"screenshotBucketKey,omitempty"` - // Whether or not to skip this step. - Skipped *bool `json:"skipped,omitempty"` - // Whether or not snapshots where collected by the test. - SnapshotBucketKey *bool `json:"snapshotBucketKey,omitempty"` - // The step ID. - StepId *int64 `json:"stepId,omitempty"` - // If this steps include a sub-test. - // [Subtests documentation](https://docs.datadoghq.com/synthetics/browser_tests/advanced_options/#subtests). - SubTestStepDetails []SyntheticsStepDetail `json:"subTestStepDetails,omitempty"` - // Time before starting the step. - TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` - // Step type used in your Synthetic test. - Type *SyntheticsStepType `json:"type,omitempty"` - // URL to perform the step against. - Url *string `json:"url,omitempty"` - // Value for the step. - Value interface{} `json:"value,omitempty"` - // Array of Core Web Vitals metrics for the step. - VitalsMetrics []SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"` - // Warning collected that didn't failed the step. - Warnings []SyntheticsStepDetailWarning `json:"warnings,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{} -} - -// NewSyntheticsStepDetail instantiates a new SyntheticsStepDetail 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 NewSyntheticsStepDetail() *SyntheticsStepDetail { - this := SyntheticsStepDetail{} - return &this -} - -// NewSyntheticsStepDetailWithDefaults instantiates a new SyntheticsStepDetail 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 NewSyntheticsStepDetailWithDefaults() *SyntheticsStepDetail { - this := SyntheticsStepDetail{} - return &this -} - -// GetBrowserErrors returns the BrowserErrors field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetBrowserErrors() []SyntheticsBrowserError { - if o == nil || o.BrowserErrors == nil { - var ret []SyntheticsBrowserError - return ret - } - return o.BrowserErrors -} - -// GetBrowserErrorsOk returns a tuple with the BrowserErrors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetBrowserErrorsOk() (*[]SyntheticsBrowserError, bool) { - if o == nil || o.BrowserErrors == nil { - return nil, false - } - return &o.BrowserErrors, true -} - -// HasBrowserErrors returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasBrowserErrors() bool { - if o != nil && o.BrowserErrors != nil { - return true - } - - return false -} - -// SetBrowserErrors gets a reference to the given []SyntheticsBrowserError and assigns it to the BrowserErrors field. -func (o *SyntheticsStepDetail) SetBrowserErrors(v []SyntheticsBrowserError) { - o.BrowserErrors = v -} - -// GetCheckType returns the CheckType field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetCheckType() SyntheticsCheckType { - if o == nil || o.CheckType == nil { - var ret SyntheticsCheckType - return ret - } - return *o.CheckType -} - -// GetCheckTypeOk returns a tuple with the CheckType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetCheckTypeOk() (*SyntheticsCheckType, bool) { - if o == nil || o.CheckType == nil { - return nil, false - } - return o.CheckType, true -} - -// HasCheckType returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasCheckType() bool { - if o != nil && o.CheckType != nil { - return true - } - - return false -} - -// SetCheckType gets a reference to the given SyntheticsCheckType and assigns it to the CheckType field. -func (o *SyntheticsStepDetail) SetCheckType(v SyntheticsCheckType) { - o.CheckType = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *SyntheticsStepDetail) SetDescription(v string) { - o.Description = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetDuration() float64 { - if o == nil || o.Duration == nil { - var ret float64 - return ret - } - return *o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetDurationOk() (*float64, bool) { - if o == nil || o.Duration == nil { - return nil, false - } - return o.Duration, true -} - -// HasDuration returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasDuration() bool { - if o != nil && o.Duration != nil { - return true - } - - return false -} - -// SetDuration gets a reference to the given float64 and assigns it to the Duration field. -func (o *SyntheticsStepDetail) SetDuration(v float64) { - o.Duration = &v -} - -// GetError returns the Error field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetError() string { - if o == nil || o.Error == nil { - var ret string - return ret - } - return *o.Error -} - -// GetErrorOk returns a tuple with the Error field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetErrorOk() (*string, bool) { - if o == nil || o.Error == nil { - return nil, false - } - return o.Error, true -} - -// HasError returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasError() bool { - if o != nil && o.Error != nil { - return true - } - - return false -} - -// SetError gets a reference to the given string and assigns it to the Error field. -func (o *SyntheticsStepDetail) SetError(v string) { - o.Error = &v -} - -// GetPlayingTab returns the PlayingTab field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetPlayingTab() SyntheticsPlayingTab { - if o == nil || o.PlayingTab == nil { - var ret SyntheticsPlayingTab - return ret - } - return *o.PlayingTab -} - -// GetPlayingTabOk returns a tuple with the PlayingTab field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetPlayingTabOk() (*SyntheticsPlayingTab, bool) { - if o == nil || o.PlayingTab == nil { - return nil, false - } - return o.PlayingTab, true -} - -// HasPlayingTab returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasPlayingTab() bool { - if o != nil && o.PlayingTab != nil { - return true - } - - return false -} - -// SetPlayingTab gets a reference to the given SyntheticsPlayingTab and assigns it to the PlayingTab field. -func (o *SyntheticsStepDetail) SetPlayingTab(v SyntheticsPlayingTab) { - o.PlayingTab = &v -} - -// GetScreenshotBucketKey returns the ScreenshotBucketKey field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetScreenshotBucketKey() bool { - if o == nil || o.ScreenshotBucketKey == nil { - var ret bool - return ret - } - return *o.ScreenshotBucketKey -} - -// GetScreenshotBucketKeyOk returns a tuple with the ScreenshotBucketKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetScreenshotBucketKeyOk() (*bool, bool) { - if o == nil || o.ScreenshotBucketKey == nil { - return nil, false - } - return o.ScreenshotBucketKey, true -} - -// HasScreenshotBucketKey returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasScreenshotBucketKey() bool { - if o != nil && o.ScreenshotBucketKey != nil { - return true - } - - return false -} - -// SetScreenshotBucketKey gets a reference to the given bool and assigns it to the ScreenshotBucketKey field. -func (o *SyntheticsStepDetail) SetScreenshotBucketKey(v bool) { - o.ScreenshotBucketKey = &v -} - -// GetSkipped returns the Skipped field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetSkipped() bool { - if o == nil || o.Skipped == nil { - var ret bool - return ret - } - return *o.Skipped -} - -// GetSkippedOk returns a tuple with the Skipped field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetSkippedOk() (*bool, bool) { - if o == nil || o.Skipped == nil { - return nil, false - } - return o.Skipped, true -} - -// HasSkipped returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasSkipped() bool { - if o != nil && o.Skipped != nil { - return true - } - - return false -} - -// SetSkipped gets a reference to the given bool and assigns it to the Skipped field. -func (o *SyntheticsStepDetail) SetSkipped(v bool) { - o.Skipped = &v -} - -// GetSnapshotBucketKey returns the SnapshotBucketKey field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetSnapshotBucketKey() bool { - if o == nil || o.SnapshotBucketKey == nil { - var ret bool - return ret - } - return *o.SnapshotBucketKey -} - -// GetSnapshotBucketKeyOk returns a tuple with the SnapshotBucketKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetSnapshotBucketKeyOk() (*bool, bool) { - if o == nil || o.SnapshotBucketKey == nil { - return nil, false - } - return o.SnapshotBucketKey, true -} - -// HasSnapshotBucketKey returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasSnapshotBucketKey() bool { - if o != nil && o.SnapshotBucketKey != nil { - return true - } - - return false -} - -// SetSnapshotBucketKey gets a reference to the given bool and assigns it to the SnapshotBucketKey field. -func (o *SyntheticsStepDetail) SetSnapshotBucketKey(v bool) { - o.SnapshotBucketKey = &v -} - -// GetStepId returns the StepId field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetStepId() int64 { - if o == nil || o.StepId == nil { - var ret int64 - return ret - } - return *o.StepId -} - -// GetStepIdOk returns a tuple with the StepId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetStepIdOk() (*int64, bool) { - if o == nil || o.StepId == nil { - return nil, false - } - return o.StepId, true -} - -// HasStepId returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasStepId() bool { - if o != nil && o.StepId != nil { - return true - } - - return false -} - -// SetStepId gets a reference to the given int64 and assigns it to the StepId field. -func (o *SyntheticsStepDetail) SetStepId(v int64) { - o.StepId = &v -} - -// GetSubTestStepDetails returns the SubTestStepDetails field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetSubTestStepDetails() []SyntheticsStepDetail { - if o == nil || o.SubTestStepDetails == nil { - var ret []SyntheticsStepDetail - return ret - } - return o.SubTestStepDetails -} - -// GetSubTestStepDetailsOk returns a tuple with the SubTestStepDetails field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetSubTestStepDetailsOk() (*[]SyntheticsStepDetail, bool) { - if o == nil || o.SubTestStepDetails == nil { - return nil, false - } - return &o.SubTestStepDetails, true -} - -// HasSubTestStepDetails returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasSubTestStepDetails() bool { - if o != nil && o.SubTestStepDetails != nil { - return true - } - - return false -} - -// SetSubTestStepDetails gets a reference to the given []SyntheticsStepDetail and assigns it to the SubTestStepDetails field. -func (o *SyntheticsStepDetail) SetSubTestStepDetails(v []SyntheticsStepDetail) { - o.SubTestStepDetails = v -} - -// GetTimeToInteractive returns the TimeToInteractive field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetTimeToInteractive() float64 { - if o == nil || o.TimeToInteractive == nil { - var ret float64 - return ret - } - return *o.TimeToInteractive -} - -// GetTimeToInteractiveOk returns a tuple with the TimeToInteractive field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetTimeToInteractiveOk() (*float64, bool) { - if o == nil || o.TimeToInteractive == nil { - return nil, false - } - return o.TimeToInteractive, true -} - -// HasTimeToInteractive returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasTimeToInteractive() bool { - if o != nil && o.TimeToInteractive != nil { - return true - } - - return false -} - -// SetTimeToInteractive gets a reference to the given float64 and assigns it to the TimeToInteractive field. -func (o *SyntheticsStepDetail) SetTimeToInteractive(v float64) { - o.TimeToInteractive = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetType() SyntheticsStepType { - if o == nil || o.Type == nil { - var ret SyntheticsStepType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetTypeOk() (*SyntheticsStepType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SyntheticsStepType and assigns it to the Type field. -func (o *SyntheticsStepDetail) SetType(v SyntheticsStepType) { - o.Type = &v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *SyntheticsStepDetail) SetUrl(v string) { - o.Url = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetValue() interface{} { - if o == nil || o.Value == nil { - var ret interface{} - return ret - } - return o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetValueOk() (*interface{}, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return &o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given interface{} and assigns it to the Value field. -func (o *SyntheticsStepDetail) SetValue(v interface{}) { - o.Value = v -} - -// GetVitalsMetrics returns the VitalsMetrics field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetVitalsMetrics() []SyntheticsCoreWebVitals { - if o == nil || o.VitalsMetrics == nil { - var ret []SyntheticsCoreWebVitals - return ret - } - return o.VitalsMetrics -} - -// GetVitalsMetricsOk returns a tuple with the VitalsMetrics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetVitalsMetricsOk() (*[]SyntheticsCoreWebVitals, bool) { - if o == nil || o.VitalsMetrics == nil { - return nil, false - } - return &o.VitalsMetrics, true -} - -// HasVitalsMetrics returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasVitalsMetrics() bool { - if o != nil && o.VitalsMetrics != nil { - return true - } - - return false -} - -// SetVitalsMetrics gets a reference to the given []SyntheticsCoreWebVitals and assigns it to the VitalsMetrics field. -func (o *SyntheticsStepDetail) SetVitalsMetrics(v []SyntheticsCoreWebVitals) { - o.VitalsMetrics = v -} - -// GetWarnings returns the Warnings field value if set, zero value otherwise. -func (o *SyntheticsStepDetail) GetWarnings() []SyntheticsStepDetailWarning { - if o == nil || o.Warnings == nil { - var ret []SyntheticsStepDetailWarning - return ret - } - return o.Warnings -} - -// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetWarningsOk() (*[]SyntheticsStepDetailWarning, bool) { - if o == nil || o.Warnings == nil { - return nil, false - } - return &o.Warnings, true -} - -// HasWarnings returns a boolean if a field has been set. -func (o *SyntheticsStepDetail) HasWarnings() bool { - if o != nil && o.Warnings != nil { - return true - } - - return false -} - -// SetWarnings gets a reference to the given []SyntheticsStepDetailWarning and assigns it to the Warnings field. -func (o *SyntheticsStepDetail) SetWarnings(v []SyntheticsStepDetailWarning) { - o.Warnings = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsStepDetail) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BrowserErrors != nil { - toSerialize["browserErrors"] = o.BrowserErrors - } - if o.CheckType != nil { - toSerialize["checkType"] = o.CheckType - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Duration != nil { - toSerialize["duration"] = o.Duration - } - if o.Error != nil { - toSerialize["error"] = o.Error - } - if o.PlayingTab != nil { - toSerialize["playingTab"] = o.PlayingTab - } - if o.ScreenshotBucketKey != nil { - toSerialize["screenshotBucketKey"] = o.ScreenshotBucketKey - } - if o.Skipped != nil { - toSerialize["skipped"] = o.Skipped - } - if o.SnapshotBucketKey != nil { - toSerialize["snapshotBucketKey"] = o.SnapshotBucketKey - } - if o.StepId != nil { - toSerialize["stepId"] = o.StepId - } - if o.SubTestStepDetails != nil { - toSerialize["subTestStepDetails"] = o.SubTestStepDetails - } - if o.TimeToInteractive != nil { - toSerialize["timeToInteractive"] = o.TimeToInteractive - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - if o.VitalsMetrics != nil { - toSerialize["vitalsMetrics"] = o.VitalsMetrics - } - if o.Warnings != nil { - toSerialize["warnings"] = o.Warnings - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"` - CheckType *SyntheticsCheckType `json:"checkType,omitempty"` - Description *string `json:"description,omitempty"` - Duration *float64 `json:"duration,omitempty"` - Error *string `json:"error,omitempty"` - PlayingTab *SyntheticsPlayingTab `json:"playingTab,omitempty"` - ScreenshotBucketKey *bool `json:"screenshotBucketKey,omitempty"` - Skipped *bool `json:"skipped,omitempty"` - SnapshotBucketKey *bool `json:"snapshotBucketKey,omitempty"` - StepId *int64 `json:"stepId,omitempty"` - SubTestStepDetails []SyntheticsStepDetail `json:"subTestStepDetails,omitempty"` - TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` - Type *SyntheticsStepType `json:"type,omitempty"` - Url *string `json:"url,omitempty"` - Value interface{} `json:"value,omitempty"` - VitalsMetrics []SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"` - Warnings []SyntheticsStepDetailWarning `json:"warnings,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.CheckType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.PlayingTab; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BrowserErrors = all.BrowserErrors - o.CheckType = all.CheckType - o.Description = all.Description - o.Duration = all.Duration - o.Error = all.Error - o.PlayingTab = all.PlayingTab - o.ScreenshotBucketKey = all.ScreenshotBucketKey - o.Skipped = all.Skipped - o.SnapshotBucketKey = all.SnapshotBucketKey - o.StepId = all.StepId - o.SubTestStepDetails = all.SubTestStepDetails - o.TimeToInteractive = all.TimeToInteractive - o.Type = all.Type - o.Url = all.Url - o.Value = all.Value - o.VitalsMetrics = all.VitalsMetrics - o.Warnings = all.Warnings - return nil -} diff --git a/api/v1/datadog/model_synthetics_step_detail_warning.go b/api/v1/datadog/model_synthetics_step_detail_warning.go deleted file mode 100644 index 477c8e68bac..00000000000 --- a/api/v1/datadog/model_synthetics_step_detail_warning.go +++ /dev/null @@ -1,144 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsStepDetailWarning Object collecting warnings for a given step. -type SyntheticsStepDetailWarning struct { - // Message for the warning. - Message string `json:"message"` - // User locator used. - Type SyntheticsWarningType `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{} -} - -// NewSyntheticsStepDetailWarning instantiates a new SyntheticsStepDetailWarning 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 NewSyntheticsStepDetailWarning(message string, typeVar SyntheticsWarningType) *SyntheticsStepDetailWarning { - this := SyntheticsStepDetailWarning{} - this.Message = message - this.Type = typeVar - return &this -} - -// NewSyntheticsStepDetailWarningWithDefaults instantiates a new SyntheticsStepDetailWarning 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 NewSyntheticsStepDetailWarningWithDefaults() *SyntheticsStepDetailWarning { - this := SyntheticsStepDetailWarning{} - return &this -} - -// GetMessage returns the Message field value. -func (o *SyntheticsStepDetailWarning) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *SyntheticsStepDetailWarning) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *SyntheticsStepDetailWarning) SetMessage(v string) { - o.Message = v -} - -// GetType returns the Type field value. -func (o *SyntheticsStepDetailWarning) GetType() SyntheticsWarningType { - if o == nil { - var ret SyntheticsWarningType - 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 *SyntheticsStepDetailWarning) GetTypeOk() (*SyntheticsWarningType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsStepDetailWarning) SetType(v SyntheticsWarningType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsStepDetailWarning) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["message"] = o.Message - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsStepDetailWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Message *string `json:"message"` - Type *SyntheticsWarningType `json:"type"` - }{} - all := struct { - Message string `json:"message"` - Type SyntheticsWarningType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Message = all.Message - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_step_type.go b/api/v1/datadog/model_synthetics_step_type.go deleted file mode 100644 index 7850d166b05..00000000000 --- a/api/v1/datadog/model_synthetics_step_type.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsStepType Step type used in your Synthetic test. -type SyntheticsStepType string - -// List of SyntheticsStepType. -const ( - SYNTHETICSSTEPTYPE_ASSERT_CURRENT_URL SyntheticsStepType = "assertCurrentUrl" - SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_ATTRIBUTE SyntheticsStepType = "assertElementAttribute" - SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_CONTENT SyntheticsStepType = "assertElementContent" - SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_PRESENT SyntheticsStepType = "assertElementPresent" - SYNTHETICSSTEPTYPE_ASSERT_EMAIL SyntheticsStepType = "assertEmail" - SYNTHETICSSTEPTYPE_ASSERT_FILE_DOWNLOAD SyntheticsStepType = "assertFileDownload" - SYNTHETICSSTEPTYPE_ASSERT_FROM_JAVASCRIPT SyntheticsStepType = "assertFromJavascript" - SYNTHETICSSTEPTYPE_ASSERT_PAGE_CONTAINS SyntheticsStepType = "assertPageContains" - SYNTHETICSSTEPTYPE_ASSERT_PAGE_LACKS SyntheticsStepType = "assertPageLacks" - SYNTHETICSSTEPTYPE_CLICK SyntheticsStepType = "click" - SYNTHETICSSTEPTYPE_EXTRACT_FROM_JAVASCRIPT SyntheticsStepType = "extractFromJavascript" - SYNTHETICSSTEPTYPE_EXTRACT_VARIABLE SyntheticsStepType = "extractVariable" - SYNTHETICSSTEPTYPE_GO_TO_EMAIL_LINK SyntheticsStepType = "goToEmailLink" - SYNTHETICSSTEPTYPE_GO_TO_URL SyntheticsStepType = "goToUrl" - SYNTHETICSSTEPTYPE_GO_TO_URL_AND_MEASURE_TTI SyntheticsStepType = "goToUrlAndMeasureTti" - SYNTHETICSSTEPTYPE_HOVER SyntheticsStepType = "hover" - SYNTHETICSSTEPTYPE_PLAY_SUB_TEST SyntheticsStepType = "playSubTest" - SYNTHETICSSTEPTYPE_PRESS_KEY SyntheticsStepType = "pressKey" - SYNTHETICSSTEPTYPE_REFRESH SyntheticsStepType = "refresh" - SYNTHETICSSTEPTYPE_RUN_API_TEST SyntheticsStepType = "runApiTest" - SYNTHETICSSTEPTYPE_SCROLL SyntheticsStepType = "scroll" - SYNTHETICSSTEPTYPE_SELECT_OPTION SyntheticsStepType = "selectOption" - SYNTHETICSSTEPTYPE_TYPE_TEXT SyntheticsStepType = "typeText" - SYNTHETICSSTEPTYPE_UPLOAD_FILES SyntheticsStepType = "uploadFiles" - SYNTHETICSSTEPTYPE_WAIT SyntheticsStepType = "wait" -) - -var allowedSyntheticsStepTypeEnumValues = []SyntheticsStepType{ - SYNTHETICSSTEPTYPE_ASSERT_CURRENT_URL, - SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_ATTRIBUTE, - SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_CONTENT, - SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_PRESENT, - SYNTHETICSSTEPTYPE_ASSERT_EMAIL, - SYNTHETICSSTEPTYPE_ASSERT_FILE_DOWNLOAD, - SYNTHETICSSTEPTYPE_ASSERT_FROM_JAVASCRIPT, - SYNTHETICSSTEPTYPE_ASSERT_PAGE_CONTAINS, - SYNTHETICSSTEPTYPE_ASSERT_PAGE_LACKS, - SYNTHETICSSTEPTYPE_CLICK, - SYNTHETICSSTEPTYPE_EXTRACT_FROM_JAVASCRIPT, - SYNTHETICSSTEPTYPE_EXTRACT_VARIABLE, - SYNTHETICSSTEPTYPE_GO_TO_EMAIL_LINK, - SYNTHETICSSTEPTYPE_GO_TO_URL, - SYNTHETICSSTEPTYPE_GO_TO_URL_AND_MEASURE_TTI, - SYNTHETICSSTEPTYPE_HOVER, - SYNTHETICSSTEPTYPE_PLAY_SUB_TEST, - SYNTHETICSSTEPTYPE_PRESS_KEY, - SYNTHETICSSTEPTYPE_REFRESH, - SYNTHETICSSTEPTYPE_RUN_API_TEST, - SYNTHETICSSTEPTYPE_SCROLL, - SYNTHETICSSTEPTYPE_SELECT_OPTION, - SYNTHETICSSTEPTYPE_TYPE_TEXT, - SYNTHETICSSTEPTYPE_UPLOAD_FILES, - SYNTHETICSSTEPTYPE_WAIT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsStepType) GetAllowedValues() []SyntheticsStepType { - return allowedSyntheticsStepTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsStepType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsStepType(value) - return nil -} - -// NewSyntheticsStepTypeFromValue returns a pointer to a valid SyntheticsStepType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsStepTypeFromValue(v string) (*SyntheticsStepType, error) { - ev := SyntheticsStepType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsStepType: valid values are %v", v, allowedSyntheticsStepTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsStepType) IsValid() bool { - for _, existing := range allowedSyntheticsStepTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsStepType value. -func (v SyntheticsStepType) Ptr() *SyntheticsStepType { - return &v -} - -// NullableSyntheticsStepType handles when a null is used for SyntheticsStepType. -type NullableSyntheticsStepType struct { - value *SyntheticsStepType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsStepType) Get() *SyntheticsStepType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsStepType) Set(val *SyntheticsStepType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsStepType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsStepType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsStepType initializes the struct as if Set has been called. -func NewNullableSyntheticsStepType(val *SyntheticsStepType) *NullableSyntheticsStepType { - return &NullableSyntheticsStepType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsStepType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsStepType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_test_ci_options.go b/api/v1/datadog/model_synthetics_test_ci_options.go deleted file mode 100644 index f4c8cbb19a2..00000000000 --- a/api/v1/datadog/model_synthetics_test_ci_options.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestCiOptions CI/CD options for a Synthetic test. -type SyntheticsTestCiOptions struct { - // Execution rule for a Synthetics test. - ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,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{} -} - -// NewSyntheticsTestCiOptions instantiates a new SyntheticsTestCiOptions 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 NewSyntheticsTestCiOptions() *SyntheticsTestCiOptions { - this := SyntheticsTestCiOptions{} - return &this -} - -// NewSyntheticsTestCiOptionsWithDefaults instantiates a new SyntheticsTestCiOptions 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 NewSyntheticsTestCiOptionsWithDefaults() *SyntheticsTestCiOptions { - this := SyntheticsTestCiOptions{} - return &this -} - -// GetExecutionRule returns the ExecutionRule field value if set, zero value otherwise. -func (o *SyntheticsTestCiOptions) GetExecutionRule() SyntheticsTestExecutionRule { - if o == nil || o.ExecutionRule == nil { - var ret SyntheticsTestExecutionRule - return ret - } - return *o.ExecutionRule -} - -// GetExecutionRuleOk returns a tuple with the ExecutionRule field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestCiOptions) GetExecutionRuleOk() (*SyntheticsTestExecutionRule, bool) { - if o == nil || o.ExecutionRule == nil { - return nil, false - } - return o.ExecutionRule, true -} - -// HasExecutionRule returns a boolean if a field has been set. -func (o *SyntheticsTestCiOptions) HasExecutionRule() bool { - if o != nil && o.ExecutionRule != nil { - return true - } - - return false -} - -// SetExecutionRule gets a reference to the given SyntheticsTestExecutionRule and assigns it to the ExecutionRule field. -func (o *SyntheticsTestCiOptions) SetExecutionRule(v SyntheticsTestExecutionRule) { - o.ExecutionRule = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestCiOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ExecutionRule != nil { - toSerialize["executionRule"] = o.ExecutionRule - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ExecutionRule; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ExecutionRule = all.ExecutionRule - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_config.go b/api/v1/datadog/model_synthetics_test_config.go deleted file mode 100644 index fad98e43084..00000000000 --- a/api/v1/datadog/model_synthetics_test_config.go +++ /dev/null @@ -1,226 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestConfig Configuration object for a Synthetic test. -type SyntheticsTestConfig struct { - // Array of assertions used for the test. Required for single API tests. - Assertions []SyntheticsAssertion `json:"assertions,omitempty"` - // Array of variables used for the test. - ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` - // Object describing the Synthetic test request. - Request *SyntheticsTestRequest `json:"request,omitempty"` - // Browser tests only - array of variables used for the test steps. - Variables []SyntheticsBrowserVariable `json:"variables,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{} -} - -// NewSyntheticsTestConfig instantiates a new SyntheticsTestConfig 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 NewSyntheticsTestConfig() *SyntheticsTestConfig { - this := SyntheticsTestConfig{} - return &this -} - -// NewSyntheticsTestConfigWithDefaults instantiates a new SyntheticsTestConfig 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 NewSyntheticsTestConfigWithDefaults() *SyntheticsTestConfig { - this := SyntheticsTestConfig{} - return &this -} - -// GetAssertions returns the Assertions field value if set, zero value otherwise. -func (o *SyntheticsTestConfig) GetAssertions() []SyntheticsAssertion { - if o == nil || o.Assertions == nil { - var ret []SyntheticsAssertion - return ret - } - return o.Assertions -} - -// GetAssertionsOk returns a tuple with the Assertions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { - if o == nil || o.Assertions == nil { - return nil, false - } - return &o.Assertions, true -} - -// HasAssertions returns a boolean if a field has been set. -func (o *SyntheticsTestConfig) HasAssertions() bool { - if o != nil && o.Assertions != nil { - return true - } - - return false -} - -// SetAssertions gets a reference to the given []SyntheticsAssertion and assigns it to the Assertions field. -func (o *SyntheticsTestConfig) SetAssertions(v []SyntheticsAssertion) { - o.Assertions = v -} - -// GetConfigVariables returns the ConfigVariables field value if set, zero value otherwise. -func (o *SyntheticsTestConfig) GetConfigVariables() []SyntheticsConfigVariable { - if o == nil || o.ConfigVariables == nil { - var ret []SyntheticsConfigVariable - return ret - } - return o.ConfigVariables -} - -// GetConfigVariablesOk returns a tuple with the ConfigVariables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool) { - if o == nil || o.ConfigVariables == nil { - return nil, false - } - return &o.ConfigVariables, true -} - -// HasConfigVariables returns a boolean if a field has been set. -func (o *SyntheticsTestConfig) HasConfigVariables() bool { - if o != nil && o.ConfigVariables != nil { - return true - } - - return false -} - -// SetConfigVariables gets a reference to the given []SyntheticsConfigVariable and assigns it to the ConfigVariables field. -func (o *SyntheticsTestConfig) SetConfigVariables(v []SyntheticsConfigVariable) { - o.ConfigVariables = v -} - -// GetRequest returns the Request field value if set, zero value otherwise. -func (o *SyntheticsTestConfig) GetRequest() SyntheticsTestRequest { - if o == nil || o.Request == nil { - var ret SyntheticsTestRequest - return ret - } - return *o.Request -} - -// GetRequestOk returns a tuple with the Request field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { - if o == nil || o.Request == nil { - return nil, false - } - return o.Request, true -} - -// HasRequest returns a boolean if a field has been set. -func (o *SyntheticsTestConfig) HasRequest() bool { - if o != nil && o.Request != nil { - return true - } - - return false -} - -// SetRequest gets a reference to the given SyntheticsTestRequest and assigns it to the Request field. -func (o *SyntheticsTestConfig) SetRequest(v SyntheticsTestRequest) { - o.Request = &v -} - -// GetVariables returns the Variables field value if set, zero value otherwise. -func (o *SyntheticsTestConfig) GetVariables() []SyntheticsBrowserVariable { - if o == nil || o.Variables == nil { - var ret []SyntheticsBrowserVariable - return ret - } - return o.Variables -} - -// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestConfig) GetVariablesOk() (*[]SyntheticsBrowserVariable, bool) { - if o == nil || o.Variables == nil { - return nil, false - } - return &o.Variables, true -} - -// HasVariables returns a boolean if a field has been set. -func (o *SyntheticsTestConfig) HasVariables() bool { - if o != nil && o.Variables != nil { - return true - } - - return false -} - -// SetVariables gets a reference to the given []SyntheticsBrowserVariable and assigns it to the Variables field. -func (o *SyntheticsTestConfig) SetVariables(v []SyntheticsBrowserVariable) { - o.Variables = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestConfig) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Assertions != nil { - toSerialize["assertions"] = o.Assertions - } - if o.ConfigVariables != nil { - toSerialize["configVariables"] = o.ConfigVariables - } - if o.Request != nil { - toSerialize["request"] = o.Request - } - if o.Variables != nil { - toSerialize["variables"] = o.Variables - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestConfig) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Assertions []SyntheticsAssertion `json:"assertions,omitempty"` - ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` - Request *SyntheticsTestRequest `json:"request,omitempty"` - Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Assertions = all.Assertions - o.ConfigVariables = all.ConfigVariables - if all.Request != nil && all.Request.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Request = all.Request - o.Variables = all.Variables - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_details.go b/api/v1/datadog/model_synthetics_test_details.go deleted file mode 100644 index b1d0f6f79d2..00000000000 --- a/api/v1/datadog/model_synthetics_test_details.go +++ /dev/null @@ -1,617 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestDetails Object containing details about your Synthetic test. -type SyntheticsTestDetails struct { - // Configuration object for a Synthetic test. - Config *SyntheticsTestConfig `json:"config,omitempty"` - // Object describing the creator of the shared element. - Creator *Creator `json:"creator,omitempty"` - // Array of locations used to run the test. - Locations []string `json:"locations,omitempty"` - // Notification message associated with the test. - Message *string `json:"message,omitempty"` - // The associated monitor ID. - MonitorId *int64 `json:"monitor_id,omitempty"` - // Name of the test. - Name *string `json:"name,omitempty"` - // Object describing the extra options for a Synthetic test. - Options *SyntheticsTestOptions `json:"options,omitempty"` - // The test public ID. - PublicId *string `json:"public_id,omitempty"` - // Define whether you want to start (`live`) or pause (`paused`) a - // Synthetic test. - Status *SyntheticsTestPauseStatus `json:"status,omitempty"` - // For browser test, the steps of the test. - Steps []SyntheticsStep `json:"steps,omitempty"` - // The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, - // `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. - Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` - // Array of tags attached to the test. - Tags []string `json:"tags,omitempty"` - // Type of the Synthetic test, either `api` or `browser`. - Type *SyntheticsTestDetailsType `json:"type,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{} -} - -// NewSyntheticsTestDetails instantiates a new SyntheticsTestDetails 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 NewSyntheticsTestDetails() *SyntheticsTestDetails { - this := SyntheticsTestDetails{} - return &this -} - -// NewSyntheticsTestDetailsWithDefaults instantiates a new SyntheticsTestDetails 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 NewSyntheticsTestDetailsWithDefaults() *SyntheticsTestDetails { - this := SyntheticsTestDetails{} - return &this -} - -// GetConfig returns the Config field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetConfig() SyntheticsTestConfig { - if o == nil || o.Config == nil { - var ret SyntheticsTestConfig - 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 *SyntheticsTestDetails) GetConfigOk() (*SyntheticsTestConfig, 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 *SyntheticsTestDetails) HasConfig() bool { - if o != nil && o.Config != nil { - return true - } - - return false -} - -// SetConfig gets a reference to the given SyntheticsTestConfig and assigns it to the Config field. -func (o *SyntheticsTestDetails) SetConfig(v SyntheticsTestConfig) { - o.Config = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetCreator() Creator { - if o == nil || o.Creator == nil { - var ret Creator - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetCreatorOk() (*Creator, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given Creator and assigns it to the Creator field. -func (o *SyntheticsTestDetails) SetCreator(v Creator) { - o.Creator = &v -} - -// GetLocations returns the Locations field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetLocations() []string { - if o == nil || o.Locations == nil { - var ret []string - return ret - } - return o.Locations -} - -// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetLocationsOk() (*[]string, bool) { - if o == nil || o.Locations == nil { - return nil, false - } - return &o.Locations, true -} - -// HasLocations returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasLocations() bool { - if o != nil && o.Locations != nil { - return true - } - - return false -} - -// SetLocations gets a reference to the given []string and assigns it to the Locations field. -func (o *SyntheticsTestDetails) SetLocations(v []string) { - o.Locations = v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SyntheticsTestDetails) SetMessage(v string) { - o.Message = &v -} - -// GetMonitorId returns the MonitorId field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetMonitorId() int64 { - if o == nil || o.MonitorId == nil { - var ret int64 - return ret - } - return *o.MonitorId -} - -// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetMonitorIdOk() (*int64, bool) { - if o == nil || o.MonitorId == nil { - return nil, false - } - return o.MonitorId, true -} - -// HasMonitorId returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasMonitorId() bool { - if o != nil && o.MonitorId != nil { - return true - } - - return false -} - -// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. -func (o *SyntheticsTestDetails) SetMonitorId(v int64) { - o.MonitorId = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SyntheticsTestDetails) SetName(v string) { - o.Name = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetOptions() SyntheticsTestOptions { - if o == nil || o.Options == nil { - var ret SyntheticsTestOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetOptionsOk() (*SyntheticsTestOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given SyntheticsTestOptions and assigns it to the Options field. -func (o *SyntheticsTestDetails) SetOptions(v SyntheticsTestOptions) { - o.Options = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *SyntheticsTestDetails) SetPublicId(v string) { - o.PublicId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetStatus() SyntheticsTestPauseStatus { - if o == nil || o.Status == nil { - var ret SyntheticsTestPauseStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. -func (o *SyntheticsTestDetails) SetStatus(v SyntheticsTestPauseStatus) { - o.Status = &v -} - -// GetSteps returns the Steps field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetSteps() []SyntheticsStep { - if o == nil || o.Steps == nil { - var ret []SyntheticsStep - return ret - } - return o.Steps -} - -// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetStepsOk() (*[]SyntheticsStep, bool) { - if o == nil || o.Steps == nil { - return nil, false - } - return &o.Steps, true -} - -// HasSteps returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasSteps() bool { - if o != nil && o.Steps != nil { - return true - } - - return false -} - -// SetSteps gets a reference to the given []SyntheticsStep and assigns it to the Steps field. -func (o *SyntheticsTestDetails) SetSteps(v []SyntheticsStep) { - o.Steps = v -} - -// GetSubtype returns the Subtype field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetSubtype() SyntheticsTestDetailsSubType { - if o == nil || o.Subtype == nil { - var ret SyntheticsTestDetailsSubType - return ret - } - return *o.Subtype -} - -// GetSubtypeOk returns a tuple with the Subtype field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetSubtypeOk() (*SyntheticsTestDetailsSubType, bool) { - if o == nil || o.Subtype == nil { - return nil, false - } - return o.Subtype, true -} - -// HasSubtype returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasSubtype() bool { - if o != nil && o.Subtype != nil { - return true - } - - return false -} - -// SetSubtype gets a reference to the given SyntheticsTestDetailsSubType and assigns it to the Subtype field. -func (o *SyntheticsTestDetails) SetSubtype(v SyntheticsTestDetailsSubType) { - o.Subtype = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SyntheticsTestDetails) GetTagsOk() (*[]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 *SyntheticsTestDetails) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SyntheticsTestDetails) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SyntheticsTestDetails) GetType() SyntheticsTestDetailsType { - if o == nil || o.Type == nil { - var ret SyntheticsTestDetailsType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestDetails) GetTypeOk() (*SyntheticsTestDetailsType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SyntheticsTestDetails) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SyntheticsTestDetailsType and assigns it to the Type field. -func (o *SyntheticsTestDetails) SetType(v SyntheticsTestDetailsType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestDetails) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Config != nil { - toSerialize["config"] = o.Config - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.Locations != nil { - toSerialize["locations"] = o.Locations - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.MonitorId != nil { - toSerialize["monitor_id"] = o.MonitorId - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Steps != nil { - toSerialize["steps"] = o.Steps - } - if o.Subtype != nil { - toSerialize["subtype"] = o.Subtype - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestDetails) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Config *SyntheticsTestConfig `json:"config,omitempty"` - Creator *Creator `json:"creator,omitempty"` - Locations []string `json:"locations,omitempty"` - Message *string `json:"message,omitempty"` - MonitorId *int64 `json:"monitor_id,omitempty"` - Name *string `json:"name,omitempty"` - Options *SyntheticsTestOptions `json:"options,omitempty"` - PublicId *string `json:"public_id,omitempty"` - Status *SyntheticsTestPauseStatus `json:"status,omitempty"` - Steps []SyntheticsStep `json:"steps,omitempty"` - Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` - Tags []string `json:"tags,omitempty"` - Type *SyntheticsTestDetailsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Subtype; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Config != nil && all.Config.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Config = all.Config - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.Locations = all.Locations - o.Message = all.Message - o.MonitorId = all.MonitorId - o.Name = all.Name - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.PublicId = all.PublicId - o.Status = all.Status - o.Steps = all.Steps - o.Subtype = all.Subtype - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_details_sub_type.go b/api/v1/datadog/model_synthetics_test_details_sub_type.go deleted file mode 100644 index 7b20e6e1442..00000000000 --- a/api/v1/datadog/model_synthetics_test_details_sub_type.go +++ /dev/null @@ -1,124 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTestDetailsSubType The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, -// `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. -type SyntheticsTestDetailsSubType string - -// List of SyntheticsTestDetailsSubType. -const ( - SYNTHETICSTESTDETAILSSUBTYPE_HTTP SyntheticsTestDetailsSubType = "http" - SYNTHETICSTESTDETAILSSUBTYPE_SSL SyntheticsTestDetailsSubType = "ssl" - SYNTHETICSTESTDETAILSSUBTYPE_TCP SyntheticsTestDetailsSubType = "tcp" - SYNTHETICSTESTDETAILSSUBTYPE_DNS SyntheticsTestDetailsSubType = "dns" - SYNTHETICSTESTDETAILSSUBTYPE_MULTI SyntheticsTestDetailsSubType = "multi" - SYNTHETICSTESTDETAILSSUBTYPE_ICMP SyntheticsTestDetailsSubType = "icmp" - SYNTHETICSTESTDETAILSSUBTYPE_UDP SyntheticsTestDetailsSubType = "udp" - SYNTHETICSTESTDETAILSSUBTYPE_WEBSOCKET SyntheticsTestDetailsSubType = "websocket" - SYNTHETICSTESTDETAILSSUBTYPE_GRPC SyntheticsTestDetailsSubType = "grpc" -) - -var allowedSyntheticsTestDetailsSubTypeEnumValues = []SyntheticsTestDetailsSubType{ - SYNTHETICSTESTDETAILSSUBTYPE_HTTP, - SYNTHETICSTESTDETAILSSUBTYPE_SSL, - SYNTHETICSTESTDETAILSSUBTYPE_TCP, - SYNTHETICSTESTDETAILSSUBTYPE_DNS, - SYNTHETICSTESTDETAILSSUBTYPE_MULTI, - SYNTHETICSTESTDETAILSSUBTYPE_ICMP, - SYNTHETICSTESTDETAILSSUBTYPE_UDP, - SYNTHETICSTESTDETAILSSUBTYPE_WEBSOCKET, - SYNTHETICSTESTDETAILSSUBTYPE_GRPC, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsTestDetailsSubType) GetAllowedValues() []SyntheticsTestDetailsSubType { - return allowedSyntheticsTestDetailsSubTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsTestDetailsSubType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsTestDetailsSubType(value) - return nil -} - -// NewSyntheticsTestDetailsSubTypeFromValue returns a pointer to a valid SyntheticsTestDetailsSubType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsTestDetailsSubTypeFromValue(v string) (*SyntheticsTestDetailsSubType, error) { - ev := SyntheticsTestDetailsSubType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestDetailsSubType: valid values are %v", v, allowedSyntheticsTestDetailsSubTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsTestDetailsSubType) IsValid() bool { - for _, existing := range allowedSyntheticsTestDetailsSubTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsTestDetailsSubType value. -func (v SyntheticsTestDetailsSubType) Ptr() *SyntheticsTestDetailsSubType { - return &v -} - -// NullableSyntheticsTestDetailsSubType handles when a null is used for SyntheticsTestDetailsSubType. -type NullableSyntheticsTestDetailsSubType struct { - value *SyntheticsTestDetailsSubType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestDetailsSubType) Get() *SyntheticsTestDetailsSubType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestDetailsSubType) Set(val *SyntheticsTestDetailsSubType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestDetailsSubType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestDetailsSubType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestDetailsSubType initializes the struct as if Set has been called. -func NewNullableSyntheticsTestDetailsSubType(val *SyntheticsTestDetailsSubType) *NullableSyntheticsTestDetailsSubType { - return &NullableSyntheticsTestDetailsSubType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestDetailsSubType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestDetailsSubType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_test_details_type.go b/api/v1/datadog/model_synthetics_test_details_type.go deleted file mode 100644 index b784444d929..00000000000 --- a/api/v1/datadog/model_synthetics_test_details_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTestDetailsType Type of the Synthetic test, either `api` or `browser`. -type SyntheticsTestDetailsType string - -// List of SyntheticsTestDetailsType. -const ( - SYNTHETICSTESTDETAILSTYPE_API SyntheticsTestDetailsType = "api" - SYNTHETICSTESTDETAILSTYPE_BROWSER SyntheticsTestDetailsType = "browser" -) - -var allowedSyntheticsTestDetailsTypeEnumValues = []SyntheticsTestDetailsType{ - SYNTHETICSTESTDETAILSTYPE_API, - SYNTHETICSTESTDETAILSTYPE_BROWSER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsTestDetailsType) GetAllowedValues() []SyntheticsTestDetailsType { - return allowedSyntheticsTestDetailsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsTestDetailsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsTestDetailsType(value) - return nil -} - -// NewSyntheticsTestDetailsTypeFromValue returns a pointer to a valid SyntheticsTestDetailsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsTestDetailsTypeFromValue(v string) (*SyntheticsTestDetailsType, error) { - ev := SyntheticsTestDetailsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestDetailsType: valid values are %v", v, allowedSyntheticsTestDetailsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsTestDetailsType) IsValid() bool { - for _, existing := range allowedSyntheticsTestDetailsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsTestDetailsType value. -func (v SyntheticsTestDetailsType) Ptr() *SyntheticsTestDetailsType { - return &v -} - -// NullableSyntheticsTestDetailsType handles when a null is used for SyntheticsTestDetailsType. -type NullableSyntheticsTestDetailsType struct { - value *SyntheticsTestDetailsType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestDetailsType) Get() *SyntheticsTestDetailsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestDetailsType) Set(val *SyntheticsTestDetailsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestDetailsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestDetailsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestDetailsType initializes the struct as if Set has been called. -func NewNullableSyntheticsTestDetailsType(val *SyntheticsTestDetailsType) *NullableSyntheticsTestDetailsType { - return &NullableSyntheticsTestDetailsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestDetailsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestDetailsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_test_execution_rule.go b/api/v1/datadog/model_synthetics_test_execution_rule.go deleted file mode 100644 index 41bca6d8545..00000000000 --- a/api/v1/datadog/model_synthetics_test_execution_rule.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTestExecutionRule Execution rule for a Synthetics test. -type SyntheticsTestExecutionRule string - -// List of SyntheticsTestExecutionRule. -const ( - SYNTHETICSTESTEXECUTIONRULE_BLOCKING SyntheticsTestExecutionRule = "blocking" - SYNTHETICSTESTEXECUTIONRULE_NON_BLOCKING SyntheticsTestExecutionRule = "non_blocking" - SYNTHETICSTESTEXECUTIONRULE_SKIPPED SyntheticsTestExecutionRule = "skipped" -) - -var allowedSyntheticsTestExecutionRuleEnumValues = []SyntheticsTestExecutionRule{ - SYNTHETICSTESTEXECUTIONRULE_BLOCKING, - SYNTHETICSTESTEXECUTIONRULE_NON_BLOCKING, - SYNTHETICSTESTEXECUTIONRULE_SKIPPED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsTestExecutionRule) GetAllowedValues() []SyntheticsTestExecutionRule { - return allowedSyntheticsTestExecutionRuleEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsTestExecutionRule) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsTestExecutionRule(value) - return nil -} - -// NewSyntheticsTestExecutionRuleFromValue returns a pointer to a valid SyntheticsTestExecutionRule -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsTestExecutionRuleFromValue(v string) (*SyntheticsTestExecutionRule, error) { - ev := SyntheticsTestExecutionRule(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestExecutionRule: valid values are %v", v, allowedSyntheticsTestExecutionRuleEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsTestExecutionRule) IsValid() bool { - for _, existing := range allowedSyntheticsTestExecutionRuleEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsTestExecutionRule value. -func (v SyntheticsTestExecutionRule) Ptr() *SyntheticsTestExecutionRule { - return &v -} - -// NullableSyntheticsTestExecutionRule handles when a null is used for SyntheticsTestExecutionRule. -type NullableSyntheticsTestExecutionRule struct { - value *SyntheticsTestExecutionRule - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestExecutionRule) Get() *SyntheticsTestExecutionRule { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestExecutionRule) Set(val *SyntheticsTestExecutionRule) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestExecutionRule) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestExecutionRule) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestExecutionRule initializes the struct as if Set has been called. -func NewNullableSyntheticsTestExecutionRule(val *SyntheticsTestExecutionRule) *NullableSyntheticsTestExecutionRule { - return &NullableSyntheticsTestExecutionRule{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestExecutionRule) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestExecutionRule) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_test_monitor_status.go b/api/v1/datadog/model_synthetics_test_monitor_status.go deleted file mode 100644 index 88d35f2183b..00000000000 --- a/api/v1/datadog/model_synthetics_test_monitor_status.go +++ /dev/null @@ -1,114 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTestMonitorStatus The status of your Synthetic monitor. -// * `O` for not triggered -// * `1` for triggered -// * `2` for no data -type SyntheticsTestMonitorStatus int64 - -// List of SyntheticsTestMonitorStatus. -const ( - SYNTHETICSTESTMONITORSTATUS_UNTRIGGERED SyntheticsTestMonitorStatus = 0 - SYNTHETICSTESTMONITORSTATUS_TRIGGERED SyntheticsTestMonitorStatus = 1 - SYNTHETICSTESTMONITORSTATUS_NO_DATA SyntheticsTestMonitorStatus = 2 -) - -var allowedSyntheticsTestMonitorStatusEnumValues = []SyntheticsTestMonitorStatus{ - SYNTHETICSTESTMONITORSTATUS_UNTRIGGERED, - SYNTHETICSTESTMONITORSTATUS_TRIGGERED, - SYNTHETICSTESTMONITORSTATUS_NO_DATA, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsTestMonitorStatus) GetAllowedValues() []SyntheticsTestMonitorStatus { - return allowedSyntheticsTestMonitorStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsTestMonitorStatus) UnmarshalJSON(src []byte) error { - var value int64 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsTestMonitorStatus(value) - return nil -} - -// NewSyntheticsTestMonitorStatusFromValue returns a pointer to a valid SyntheticsTestMonitorStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsTestMonitorStatusFromValue(v int64) (*SyntheticsTestMonitorStatus, error) { - ev := SyntheticsTestMonitorStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestMonitorStatus: valid values are %v", v, allowedSyntheticsTestMonitorStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsTestMonitorStatus) IsValid() bool { - for _, existing := range allowedSyntheticsTestMonitorStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsTestMonitorStatus value. -func (v SyntheticsTestMonitorStatus) Ptr() *SyntheticsTestMonitorStatus { - return &v -} - -// NullableSyntheticsTestMonitorStatus handles when a null is used for SyntheticsTestMonitorStatus. -type NullableSyntheticsTestMonitorStatus struct { - value *SyntheticsTestMonitorStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestMonitorStatus) Get() *SyntheticsTestMonitorStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestMonitorStatus) Set(val *SyntheticsTestMonitorStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestMonitorStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestMonitorStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestMonitorStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsTestMonitorStatus(val *SyntheticsTestMonitorStatus) *NullableSyntheticsTestMonitorStatus { - return &NullableSyntheticsTestMonitorStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestMonitorStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestMonitorStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_test_options.go b/api/v1/datadog/model_synthetics_test_options.go deleted file mode 100644 index 982ce4b0f5d..00000000000 --- a/api/v1/datadog/model_synthetics_test_options.go +++ /dev/null @@ -1,767 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestOptions Object describing the extra options for a Synthetic test. -type SyntheticsTestOptions struct { - // For SSL test, whether or not the test should allow self signed - // certificates. - AcceptSelfSigned *bool `json:"accept_self_signed,omitempty"` - // Allows loading insecure content for an HTTP request. - AllowInsecure *bool `json:"allow_insecure,omitempty"` - // For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP. - CheckCertificateRevocation *bool `json:"checkCertificateRevocation,omitempty"` - // CI/CD options for a Synthetic test. - Ci *SyntheticsTestCiOptions `json:"ci,omitempty"` - // For browser test, array with the different device IDs used to run the test. - DeviceIds []SyntheticsDeviceID `json:"device_ids,omitempty"` - // Whether or not to disable CORS mechanism. - DisableCors *bool `json:"disableCors,omitempty"` - // For API HTTP test, whether or not the test should follow redirects. - FollowRedirects *bool `json:"follow_redirects,omitempty"` - // Minimum amount of time in failure required to trigger an alert. - MinFailureDuration *int64 `json:"min_failure_duration,omitempty"` - // Minimum number of locations in failure required to trigger - // an alert. - MinLocationFailed *int64 `json:"min_location_failed,omitempty"` - // The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs. - MonitorName *string `json:"monitor_name,omitempty"` - // Object containing the options for a Synthetic test as a monitor - // (for example, renotification). - MonitorOptions *SyntheticsTestOptionsMonitorOptions `json:"monitor_options,omitempty"` - // Integer from 1 (high) to 5 (low) indicating alert severity. - MonitorPriority *int32 `json:"monitor_priority,omitempty"` - // Prevents saving screenshots of the steps. - NoScreenshot *bool `json:"noScreenshot,omitempty"` - // A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. - RestrictedRoles []string `json:"restricted_roles,omitempty"` - // Object describing the retry strategy to apply to a Synthetic test. - Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - // The RUM data collection settings for the Synthetic browser test. - // **Note:** There are 3 ways to format RUM settings: - // - // `{ isEnabled: false }` - // RUM data is not collected. - // - // `{ isEnabled: true }` - // RUM data is collected from the Synthetic test's default application. - // - // `{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 }` - // RUM data is collected using the specified application. - RumSettings *SyntheticsBrowserTestRumSettings `json:"rumSettings,omitempty"` - // The frequency at which to run the Synthetic test (in seconds). - TickEvery *int64 `json:"tick_every,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{} -} - -// NewSyntheticsTestOptions instantiates a new SyntheticsTestOptions 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 NewSyntheticsTestOptions() *SyntheticsTestOptions { - this := SyntheticsTestOptions{} - return &this -} - -// NewSyntheticsTestOptionsWithDefaults instantiates a new SyntheticsTestOptions 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 NewSyntheticsTestOptionsWithDefaults() *SyntheticsTestOptions { - this := SyntheticsTestOptions{} - return &this -} - -// GetAcceptSelfSigned returns the AcceptSelfSigned field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetAcceptSelfSigned() bool { - if o == nil || o.AcceptSelfSigned == nil { - var ret bool - return ret - } - return *o.AcceptSelfSigned -} - -// GetAcceptSelfSignedOk returns a tuple with the AcceptSelfSigned field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetAcceptSelfSignedOk() (*bool, bool) { - if o == nil || o.AcceptSelfSigned == nil { - return nil, false - } - return o.AcceptSelfSigned, true -} - -// HasAcceptSelfSigned returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasAcceptSelfSigned() bool { - if o != nil && o.AcceptSelfSigned != nil { - return true - } - - return false -} - -// SetAcceptSelfSigned gets a reference to the given bool and assigns it to the AcceptSelfSigned field. -func (o *SyntheticsTestOptions) SetAcceptSelfSigned(v bool) { - o.AcceptSelfSigned = &v -} - -// GetAllowInsecure returns the AllowInsecure field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetAllowInsecure() bool { - if o == nil || o.AllowInsecure == nil { - var ret bool - return ret - } - return *o.AllowInsecure -} - -// GetAllowInsecureOk returns a tuple with the AllowInsecure field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetAllowInsecureOk() (*bool, bool) { - if o == nil || o.AllowInsecure == nil { - return nil, false - } - return o.AllowInsecure, true -} - -// HasAllowInsecure returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasAllowInsecure() bool { - if o != nil && o.AllowInsecure != nil { - return true - } - - return false -} - -// SetAllowInsecure gets a reference to the given bool and assigns it to the AllowInsecure field. -func (o *SyntheticsTestOptions) SetAllowInsecure(v bool) { - o.AllowInsecure = &v -} - -// GetCheckCertificateRevocation returns the CheckCertificateRevocation field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetCheckCertificateRevocation() bool { - if o == nil || o.CheckCertificateRevocation == nil { - var ret bool - return ret - } - return *o.CheckCertificateRevocation -} - -// GetCheckCertificateRevocationOk returns a tuple with the CheckCertificateRevocation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetCheckCertificateRevocationOk() (*bool, bool) { - if o == nil || o.CheckCertificateRevocation == nil { - return nil, false - } - return o.CheckCertificateRevocation, true -} - -// HasCheckCertificateRevocation returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasCheckCertificateRevocation() bool { - if o != nil && o.CheckCertificateRevocation != nil { - return true - } - - return false -} - -// SetCheckCertificateRevocation gets a reference to the given bool and assigns it to the CheckCertificateRevocation field. -func (o *SyntheticsTestOptions) SetCheckCertificateRevocation(v bool) { - o.CheckCertificateRevocation = &v -} - -// GetCi returns the Ci field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetCi() SyntheticsTestCiOptions { - if o == nil || o.Ci == nil { - var ret SyntheticsTestCiOptions - return ret - } - return *o.Ci -} - -// GetCiOk returns a tuple with the Ci field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetCiOk() (*SyntheticsTestCiOptions, bool) { - if o == nil || o.Ci == nil { - return nil, false - } - return o.Ci, true -} - -// HasCi returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasCi() bool { - if o != nil && o.Ci != nil { - return true - } - - return false -} - -// SetCi gets a reference to the given SyntheticsTestCiOptions and assigns it to the Ci field. -func (o *SyntheticsTestOptions) SetCi(v SyntheticsTestCiOptions) { - o.Ci = &v -} - -// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetDeviceIds() []SyntheticsDeviceID { - if o == nil || o.DeviceIds == nil { - var ret []SyntheticsDeviceID - return ret - } - return o.DeviceIds -} - -// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetDeviceIdsOk() (*[]SyntheticsDeviceID, bool) { - if o == nil || o.DeviceIds == nil { - return nil, false - } - return &o.DeviceIds, true -} - -// HasDeviceIds returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasDeviceIds() bool { - if o != nil && o.DeviceIds != nil { - return true - } - - return false -} - -// SetDeviceIds gets a reference to the given []SyntheticsDeviceID and assigns it to the DeviceIds field. -func (o *SyntheticsTestOptions) SetDeviceIds(v []SyntheticsDeviceID) { - o.DeviceIds = v -} - -// GetDisableCors returns the DisableCors field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetDisableCors() bool { - if o == nil || o.DisableCors == nil { - var ret bool - return ret - } - return *o.DisableCors -} - -// GetDisableCorsOk returns a tuple with the DisableCors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetDisableCorsOk() (*bool, bool) { - if o == nil || o.DisableCors == nil { - return nil, false - } - return o.DisableCors, true -} - -// HasDisableCors returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasDisableCors() bool { - if o != nil && o.DisableCors != nil { - return true - } - - return false -} - -// SetDisableCors gets a reference to the given bool and assigns it to the DisableCors field. -func (o *SyntheticsTestOptions) SetDisableCors(v bool) { - o.DisableCors = &v -} - -// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetFollowRedirects() bool { - if o == nil || o.FollowRedirects == nil { - var ret bool - return ret - } - return *o.FollowRedirects -} - -// GetFollowRedirectsOk returns a tuple with the FollowRedirects field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetFollowRedirectsOk() (*bool, bool) { - if o == nil || o.FollowRedirects == nil { - return nil, false - } - return o.FollowRedirects, true -} - -// HasFollowRedirects returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasFollowRedirects() bool { - if o != nil && o.FollowRedirects != nil { - return true - } - - return false -} - -// SetFollowRedirects gets a reference to the given bool and assigns it to the FollowRedirects field. -func (o *SyntheticsTestOptions) SetFollowRedirects(v bool) { - o.FollowRedirects = &v -} - -// GetMinFailureDuration returns the MinFailureDuration field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetMinFailureDuration() int64 { - if o == nil || o.MinFailureDuration == nil { - var ret int64 - return ret - } - return *o.MinFailureDuration -} - -// GetMinFailureDurationOk returns a tuple with the MinFailureDuration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetMinFailureDurationOk() (*int64, bool) { - if o == nil || o.MinFailureDuration == nil { - return nil, false - } - return o.MinFailureDuration, true -} - -// HasMinFailureDuration returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasMinFailureDuration() bool { - if o != nil && o.MinFailureDuration != nil { - return true - } - - return false -} - -// SetMinFailureDuration gets a reference to the given int64 and assigns it to the MinFailureDuration field. -func (o *SyntheticsTestOptions) SetMinFailureDuration(v int64) { - o.MinFailureDuration = &v -} - -// GetMinLocationFailed returns the MinLocationFailed field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetMinLocationFailed() int64 { - if o == nil || o.MinLocationFailed == nil { - var ret int64 - return ret - } - return *o.MinLocationFailed -} - -// GetMinLocationFailedOk returns a tuple with the MinLocationFailed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetMinLocationFailedOk() (*int64, bool) { - if o == nil || o.MinLocationFailed == nil { - return nil, false - } - return o.MinLocationFailed, true -} - -// HasMinLocationFailed returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasMinLocationFailed() bool { - if o != nil && o.MinLocationFailed != nil { - return true - } - - return false -} - -// SetMinLocationFailed gets a reference to the given int64 and assigns it to the MinLocationFailed field. -func (o *SyntheticsTestOptions) SetMinLocationFailed(v int64) { - o.MinLocationFailed = &v -} - -// GetMonitorName returns the MonitorName field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetMonitorName() string { - if o == nil || o.MonitorName == nil { - var ret string - return ret - } - return *o.MonitorName -} - -// GetMonitorNameOk returns a tuple with the MonitorName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetMonitorNameOk() (*string, bool) { - if o == nil || o.MonitorName == nil { - return nil, false - } - return o.MonitorName, true -} - -// HasMonitorName returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasMonitorName() bool { - if o != nil && o.MonitorName != nil { - return true - } - - return false -} - -// SetMonitorName gets a reference to the given string and assigns it to the MonitorName field. -func (o *SyntheticsTestOptions) SetMonitorName(v string) { - o.MonitorName = &v -} - -// GetMonitorOptions returns the MonitorOptions field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetMonitorOptions() SyntheticsTestOptionsMonitorOptions { - if o == nil || o.MonitorOptions == nil { - var ret SyntheticsTestOptionsMonitorOptions - return ret - } - return *o.MonitorOptions -} - -// GetMonitorOptionsOk returns a tuple with the MonitorOptions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetMonitorOptionsOk() (*SyntheticsTestOptionsMonitorOptions, bool) { - if o == nil || o.MonitorOptions == nil { - return nil, false - } - return o.MonitorOptions, true -} - -// HasMonitorOptions returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasMonitorOptions() bool { - if o != nil && o.MonitorOptions != nil { - return true - } - - return false -} - -// SetMonitorOptions gets a reference to the given SyntheticsTestOptionsMonitorOptions and assigns it to the MonitorOptions field. -func (o *SyntheticsTestOptions) SetMonitorOptions(v SyntheticsTestOptionsMonitorOptions) { - o.MonitorOptions = &v -} - -// GetMonitorPriority returns the MonitorPriority field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetMonitorPriority() int32 { - if o == nil || o.MonitorPriority == nil { - var ret int32 - return ret - } - return *o.MonitorPriority -} - -// GetMonitorPriorityOk returns a tuple with the MonitorPriority field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetMonitorPriorityOk() (*int32, bool) { - if o == nil || o.MonitorPriority == nil { - return nil, false - } - return o.MonitorPriority, true -} - -// HasMonitorPriority returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasMonitorPriority() bool { - if o != nil && o.MonitorPriority != nil { - return true - } - - return false -} - -// SetMonitorPriority gets a reference to the given int32 and assigns it to the MonitorPriority field. -func (o *SyntheticsTestOptions) SetMonitorPriority(v int32) { - o.MonitorPriority = &v -} - -// GetNoScreenshot returns the NoScreenshot field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetNoScreenshot() bool { - if o == nil || o.NoScreenshot == nil { - var ret bool - return ret - } - return *o.NoScreenshot -} - -// GetNoScreenshotOk returns a tuple with the NoScreenshot field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetNoScreenshotOk() (*bool, bool) { - if o == nil || o.NoScreenshot == nil { - return nil, false - } - return o.NoScreenshot, true -} - -// HasNoScreenshot returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasNoScreenshot() bool { - if o != nil && o.NoScreenshot != nil { - return true - } - - return false -} - -// SetNoScreenshot gets a reference to the given bool and assigns it to the NoScreenshot field. -func (o *SyntheticsTestOptions) SetNoScreenshot(v bool) { - o.NoScreenshot = &v -} - -// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetRestrictedRoles() []string { - if o == nil || o.RestrictedRoles == nil { - var ret []string - return ret - } - return o.RestrictedRoles -} - -// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetRestrictedRolesOk() (*[]string, bool) { - if o == nil || o.RestrictedRoles == nil { - return nil, false - } - return &o.RestrictedRoles, true -} - -// HasRestrictedRoles returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasRestrictedRoles() bool { - if o != nil && o.RestrictedRoles != nil { - return true - } - - return false -} - -// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. -func (o *SyntheticsTestOptions) SetRestrictedRoles(v []string) { - o.RestrictedRoles = v -} - -// GetRetry returns the Retry field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetRetry() SyntheticsTestOptionsRetry { - if o == nil || o.Retry == nil { - var ret SyntheticsTestOptionsRetry - return ret - } - return *o.Retry -} - -// GetRetryOk returns a tuple with the Retry field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetRetryOk() (*SyntheticsTestOptionsRetry, bool) { - if o == nil || o.Retry == nil { - return nil, false - } - return o.Retry, true -} - -// HasRetry returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasRetry() bool { - if o != nil && o.Retry != nil { - return true - } - - return false -} - -// SetRetry gets a reference to the given SyntheticsTestOptionsRetry and assigns it to the Retry field. -func (o *SyntheticsTestOptions) SetRetry(v SyntheticsTestOptionsRetry) { - o.Retry = &v -} - -// GetRumSettings returns the RumSettings field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetRumSettings() SyntheticsBrowserTestRumSettings { - if o == nil || o.RumSettings == nil { - var ret SyntheticsBrowserTestRumSettings - return ret - } - return *o.RumSettings -} - -// GetRumSettingsOk returns a tuple with the RumSettings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetRumSettingsOk() (*SyntheticsBrowserTestRumSettings, bool) { - if o == nil || o.RumSettings == nil { - return nil, false - } - return o.RumSettings, true -} - -// HasRumSettings returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasRumSettings() bool { - if o != nil && o.RumSettings != nil { - return true - } - - return false -} - -// SetRumSettings gets a reference to the given SyntheticsBrowserTestRumSettings and assigns it to the RumSettings field. -func (o *SyntheticsTestOptions) SetRumSettings(v SyntheticsBrowserTestRumSettings) { - o.RumSettings = &v -} - -// GetTickEvery returns the TickEvery field value if set, zero value otherwise. -func (o *SyntheticsTestOptions) GetTickEvery() int64 { - if o == nil || o.TickEvery == nil { - var ret int64 - return ret - } - return *o.TickEvery -} - -// GetTickEveryOk returns a tuple with the TickEvery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptions) GetTickEveryOk() (*int64, bool) { - if o == nil || o.TickEvery == nil { - return nil, false - } - return o.TickEvery, true -} - -// HasTickEvery returns a boolean if a field has been set. -func (o *SyntheticsTestOptions) HasTickEvery() bool { - if o != nil && o.TickEvery != nil { - return true - } - - return false -} - -// SetTickEvery gets a reference to the given int64 and assigns it to the TickEvery field. -func (o *SyntheticsTestOptions) SetTickEvery(v int64) { - o.TickEvery = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AcceptSelfSigned != nil { - toSerialize["accept_self_signed"] = o.AcceptSelfSigned - } - if o.AllowInsecure != nil { - toSerialize["allow_insecure"] = o.AllowInsecure - } - if o.CheckCertificateRevocation != nil { - toSerialize["checkCertificateRevocation"] = o.CheckCertificateRevocation - } - if o.Ci != nil { - toSerialize["ci"] = o.Ci - } - if o.DeviceIds != nil { - toSerialize["device_ids"] = o.DeviceIds - } - if o.DisableCors != nil { - toSerialize["disableCors"] = o.DisableCors - } - if o.FollowRedirects != nil { - toSerialize["follow_redirects"] = o.FollowRedirects - } - if o.MinFailureDuration != nil { - toSerialize["min_failure_duration"] = o.MinFailureDuration - } - if o.MinLocationFailed != nil { - toSerialize["min_location_failed"] = o.MinLocationFailed - } - if o.MonitorName != nil { - toSerialize["monitor_name"] = o.MonitorName - } - if o.MonitorOptions != nil { - toSerialize["monitor_options"] = o.MonitorOptions - } - if o.MonitorPriority != nil { - toSerialize["monitor_priority"] = o.MonitorPriority - } - if o.NoScreenshot != nil { - toSerialize["noScreenshot"] = o.NoScreenshot - } - if o.RestrictedRoles != nil { - toSerialize["restricted_roles"] = o.RestrictedRoles - } - if o.Retry != nil { - toSerialize["retry"] = o.Retry - } - if o.RumSettings != nil { - toSerialize["rumSettings"] = o.RumSettings - } - if o.TickEvery != nil { - toSerialize["tick_every"] = o.TickEvery - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AcceptSelfSigned *bool `json:"accept_self_signed,omitempty"` - AllowInsecure *bool `json:"allow_insecure,omitempty"` - CheckCertificateRevocation *bool `json:"checkCertificateRevocation,omitempty"` - Ci *SyntheticsTestCiOptions `json:"ci,omitempty"` - DeviceIds []SyntheticsDeviceID `json:"device_ids,omitempty"` - DisableCors *bool `json:"disableCors,omitempty"` - FollowRedirects *bool `json:"follow_redirects,omitempty"` - MinFailureDuration *int64 `json:"min_failure_duration,omitempty"` - MinLocationFailed *int64 `json:"min_location_failed,omitempty"` - MonitorName *string `json:"monitor_name,omitempty"` - MonitorOptions *SyntheticsTestOptionsMonitorOptions `json:"monitor_options,omitempty"` - MonitorPriority *int32 `json:"monitor_priority,omitempty"` - NoScreenshot *bool `json:"noScreenshot,omitempty"` - RestrictedRoles []string `json:"restricted_roles,omitempty"` - Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - RumSettings *SyntheticsBrowserTestRumSettings `json:"rumSettings,omitempty"` - TickEvery *int64 `json:"tick_every,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AcceptSelfSigned = all.AcceptSelfSigned - o.AllowInsecure = all.AllowInsecure - o.CheckCertificateRevocation = all.CheckCertificateRevocation - if all.Ci != nil && all.Ci.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Ci = all.Ci - o.DeviceIds = all.DeviceIds - o.DisableCors = all.DisableCors - o.FollowRedirects = all.FollowRedirects - o.MinFailureDuration = all.MinFailureDuration - o.MinLocationFailed = all.MinLocationFailed - o.MonitorName = all.MonitorName - if all.MonitorOptions != nil && all.MonitorOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.MonitorOptions = all.MonitorOptions - o.MonitorPriority = all.MonitorPriority - o.NoScreenshot = all.NoScreenshot - o.RestrictedRoles = all.RestrictedRoles - if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Retry = all.Retry - if all.RumSettings != nil && all.RumSettings.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumSettings = all.RumSettings - o.TickEvery = all.TickEvery - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_options_monitor_options.go b/api/v1/datadog/model_synthetics_test_options_monitor_options.go deleted file mode 100644 index 38aea847057..00000000000 --- a/api/v1/datadog/model_synthetics_test_options_monitor_options.go +++ /dev/null @@ -1,104 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestOptionsMonitorOptions Object containing the options for a Synthetic test as a monitor -// (for example, renotification). -type SyntheticsTestOptionsMonitorOptions struct { - // Time interval before renotifying if the test is still failing - // (in minutes). - RenotifyInterval *int64 `json:"renotify_interval,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{} -} - -// NewSyntheticsTestOptionsMonitorOptions instantiates a new SyntheticsTestOptionsMonitorOptions 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 NewSyntheticsTestOptionsMonitorOptions() *SyntheticsTestOptionsMonitorOptions { - this := SyntheticsTestOptionsMonitorOptions{} - return &this -} - -// NewSyntheticsTestOptionsMonitorOptionsWithDefaults instantiates a new SyntheticsTestOptionsMonitorOptions 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 NewSyntheticsTestOptionsMonitorOptionsWithDefaults() *SyntheticsTestOptionsMonitorOptions { - this := SyntheticsTestOptionsMonitorOptions{} - return &this -} - -// GetRenotifyInterval returns the RenotifyInterval field value if set, zero value otherwise. -func (o *SyntheticsTestOptionsMonitorOptions) GetRenotifyInterval() int64 { - if o == nil || o.RenotifyInterval == nil { - var ret int64 - return ret - } - return *o.RenotifyInterval -} - -// GetRenotifyIntervalOk returns a tuple with the RenotifyInterval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptionsMonitorOptions) GetRenotifyIntervalOk() (*int64, bool) { - if o == nil || o.RenotifyInterval == nil { - return nil, false - } - return o.RenotifyInterval, true -} - -// HasRenotifyInterval returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsMonitorOptions) HasRenotifyInterval() bool { - if o != nil && o.RenotifyInterval != nil { - return true - } - - return false -} - -// SetRenotifyInterval gets a reference to the given int64 and assigns it to the RenotifyInterval field. -func (o *SyntheticsTestOptionsMonitorOptions) SetRenotifyInterval(v int64) { - o.RenotifyInterval = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestOptionsMonitorOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.RenotifyInterval != nil { - toSerialize["renotify_interval"] = o.RenotifyInterval - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestOptionsMonitorOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - RenotifyInterval *int64 `json:"renotify_interval,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.RenotifyInterval = all.RenotifyInterval - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_options_retry.go b/api/v1/datadog/model_synthetics_test_options_retry.go deleted file mode 100644 index c7841710205..00000000000 --- a/api/v1/datadog/model_synthetics_test_options_retry.go +++ /dev/null @@ -1,143 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestOptionsRetry Object describing the retry strategy to apply to a Synthetic test. -type SyntheticsTestOptionsRetry struct { - // Number of times a test needs to be retried before marking a - // location as failed. Defaults to 0. - Count *int64 `json:"count,omitempty"` - // Time interval between retries (in milliseconds). Defaults to - // 300ms. - Interval *float64 `json:"interval,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{} -} - -// NewSyntheticsTestOptionsRetry instantiates a new SyntheticsTestOptionsRetry 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 NewSyntheticsTestOptionsRetry() *SyntheticsTestOptionsRetry { - this := SyntheticsTestOptionsRetry{} - return &this -} - -// NewSyntheticsTestOptionsRetryWithDefaults instantiates a new SyntheticsTestOptionsRetry 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 NewSyntheticsTestOptionsRetryWithDefaults() *SyntheticsTestOptionsRetry { - this := SyntheticsTestOptionsRetry{} - return &this -} - -// GetCount returns the Count field value if set, zero value otherwise. -func (o *SyntheticsTestOptionsRetry) GetCount() int64 { - if o == nil || o.Count == nil { - var ret int64 - return ret - } - return *o.Count -} - -// GetCountOk returns a tuple with the Count field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptionsRetry) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { - return nil, false - } - return o.Count, true -} - -// HasCount returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsRetry) HasCount() bool { - if o != nil && o.Count != nil { - return true - } - - return false -} - -// SetCount gets a reference to the given int64 and assigns it to the Count field. -func (o *SyntheticsTestOptionsRetry) SetCount(v int64) { - o.Count = &v -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *SyntheticsTestOptionsRetry) GetInterval() float64 { - if o == nil || o.Interval == nil { - var ret float64 - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestOptionsRetry) GetIntervalOk() (*float64, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsRetry) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given float64 and assigns it to the Interval field. -func (o *SyntheticsTestOptionsRetry) SetInterval(v float64) { - o.Interval = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestOptionsRetry) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Count != nil { - toSerialize["count"] = o.Count - } - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestOptionsRetry) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Count *int64 `json:"count,omitempty"` - Interval *float64 `json:"interval,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Count = all.Count - o.Interval = all.Interval - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_pause_status.go b/api/v1/datadog/model_synthetics_test_pause_status.go deleted file mode 100644 index 6ddc9aeacd1..00000000000 --- a/api/v1/datadog/model_synthetics_test_pause_status.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTestPauseStatus Define whether you want to start (`live`) or pause (`paused`) a -// Synthetic test. -type SyntheticsTestPauseStatus string - -// List of SyntheticsTestPauseStatus. -const ( - SYNTHETICSTESTPAUSESTATUS_LIVE SyntheticsTestPauseStatus = "live" - SYNTHETICSTESTPAUSESTATUS_PAUSED SyntheticsTestPauseStatus = "paused" -) - -var allowedSyntheticsTestPauseStatusEnumValues = []SyntheticsTestPauseStatus{ - SYNTHETICSTESTPAUSESTATUS_LIVE, - SYNTHETICSTESTPAUSESTATUS_PAUSED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsTestPauseStatus) GetAllowedValues() []SyntheticsTestPauseStatus { - return allowedSyntheticsTestPauseStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsTestPauseStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsTestPauseStatus(value) - return nil -} - -// NewSyntheticsTestPauseStatusFromValue returns a pointer to a valid SyntheticsTestPauseStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsTestPauseStatusFromValue(v string) (*SyntheticsTestPauseStatus, error) { - ev := SyntheticsTestPauseStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestPauseStatus: valid values are %v", v, allowedSyntheticsTestPauseStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsTestPauseStatus) IsValid() bool { - for _, existing := range allowedSyntheticsTestPauseStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsTestPauseStatus value. -func (v SyntheticsTestPauseStatus) Ptr() *SyntheticsTestPauseStatus { - return &v -} - -// NullableSyntheticsTestPauseStatus handles when a null is used for SyntheticsTestPauseStatus. -type NullableSyntheticsTestPauseStatus struct { - value *SyntheticsTestPauseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestPauseStatus) Get() *SyntheticsTestPauseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestPauseStatus) Set(val *SyntheticsTestPauseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestPauseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestPauseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestPauseStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsTestPauseStatus(val *SyntheticsTestPauseStatus) *NullableSyntheticsTestPauseStatus { - return &NullableSyntheticsTestPauseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestPauseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestPauseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_test_process_status.go b/api/v1/datadog/model_synthetics_test_process_status.go deleted file mode 100644 index 949e0740eb8..00000000000 --- a/api/v1/datadog/model_synthetics_test_process_status.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTestProcessStatus Status of a Synthetic test. -type SyntheticsTestProcessStatus string - -// List of SyntheticsTestProcessStatus. -const ( - SYNTHETICSTESTPROCESSSTATUS_NOT_SCHEDULED SyntheticsTestProcessStatus = "not_scheduled" - SYNTHETICSTESTPROCESSSTATUS_SCHEDULED SyntheticsTestProcessStatus = "scheduled" - SYNTHETICSTESTPROCESSSTATUS_STARTED SyntheticsTestProcessStatus = "started" - SYNTHETICSTESTPROCESSSTATUS_FINISHED SyntheticsTestProcessStatus = "finished" - SYNTHETICSTESTPROCESSSTATUS_FINISHED_WITH_ERROR SyntheticsTestProcessStatus = "finished_with_error" -) - -var allowedSyntheticsTestProcessStatusEnumValues = []SyntheticsTestProcessStatus{ - SYNTHETICSTESTPROCESSSTATUS_NOT_SCHEDULED, - SYNTHETICSTESTPROCESSSTATUS_SCHEDULED, - SYNTHETICSTESTPROCESSSTATUS_STARTED, - SYNTHETICSTESTPROCESSSTATUS_FINISHED, - SYNTHETICSTESTPROCESSSTATUS_FINISHED_WITH_ERROR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsTestProcessStatus) GetAllowedValues() []SyntheticsTestProcessStatus { - return allowedSyntheticsTestProcessStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsTestProcessStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsTestProcessStatus(value) - return nil -} - -// NewSyntheticsTestProcessStatusFromValue returns a pointer to a valid SyntheticsTestProcessStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsTestProcessStatusFromValue(v string) (*SyntheticsTestProcessStatus, error) { - ev := SyntheticsTestProcessStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestProcessStatus: valid values are %v", v, allowedSyntheticsTestProcessStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsTestProcessStatus) IsValid() bool { - for _, existing := range allowedSyntheticsTestProcessStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsTestProcessStatus value. -func (v SyntheticsTestProcessStatus) Ptr() *SyntheticsTestProcessStatus { - return &v -} - -// NullableSyntheticsTestProcessStatus handles when a null is used for SyntheticsTestProcessStatus. -type NullableSyntheticsTestProcessStatus struct { - value *SyntheticsTestProcessStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsTestProcessStatus) Get() *SyntheticsTestProcessStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsTestProcessStatus) Set(val *SyntheticsTestProcessStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsTestProcessStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsTestProcessStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsTestProcessStatus initializes the struct as if Set has been called. -func NewNullableSyntheticsTestProcessStatus(val *SyntheticsTestProcessStatus) *NullableSyntheticsTestProcessStatus { - return &NullableSyntheticsTestProcessStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsTestProcessStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsTestProcessStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_synthetics_test_request.go b/api/v1/datadog/model_synthetics_test_request.go deleted file mode 100644 index e83070b0a36..00000000000 --- a/api/v1/datadog/model_synthetics_test_request.go +++ /dev/null @@ -1,945 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestRequest Object describing the Synthetic test request. -type SyntheticsTestRequest struct { - // Allows loading insecure content for an HTTP request in a multistep test step. - AllowInsecure *bool `json:"allow_insecure,omitempty"` - // Object to handle basic authentication when performing the test. - BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` - // Body to include in the test. - Body *string `json:"body,omitempty"` - // Client certificate to use when performing the test request. - Certificate *SyntheticsTestRequestCertificate `json:"certificate,omitempty"` - // DNS server to use for DNS tests. - DnsServer *string `json:"dnsServer,omitempty"` - // DNS server port to use for DNS tests. - DnsServerPort *int32 `json:"dnsServerPort,omitempty"` - // Specifies whether or not the request follows redirects. - FollowRedirects *bool `json:"follow_redirects,omitempty"` - // Headers to include when performing the test. - Headers map[string]string `json:"headers,omitempty"` - // Host name to perform the test with. - Host *string `json:"host,omitempty"` - // Message to send for UDP or WebSocket tests. - Message *string `json:"message,omitempty"` - // Metadata to include when performing the gRPC test. - Metadata map[string]string `json:"metadata,omitempty"` - // The HTTP method. - Method *HTTPMethod `json:"method,omitempty"` - // Determines whether or not to save the response body. - NoSavingResponseBody *bool `json:"noSavingResponseBody,omitempty"` - // Number of pings to use per test. - NumberOfPackets *int32 `json:"numberOfPackets,omitempty"` - // Port to use when performing the test. - Port *int64 `json:"port,omitempty"` - // The proxy to perform the test. - Proxy *SyntheticsTestRequestProxy `json:"proxy,omitempty"` - // Query to use for the test. - Query interface{} `json:"query,omitempty"` - // For SSL tests, it specifies on which server you want to initiate the TLS handshake, - // allowing the server to present one of multiple possible certificates on - // the same IP address and TCP port number. - Servername *string `json:"servername,omitempty"` - // gRPC service on which you want to perform the healthcheck. - Service *string `json:"service,omitempty"` - // Turns on a traceroute probe to discover all gateways along the path to the host destination. - ShouldTrackHops *bool `json:"shouldTrackHops,omitempty"` - // Timeout in seconds for the test. - Timeout *float64 `json:"timeout,omitempty"` - // URL to perform the test with. - Url *string `json:"url,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{} -} - -// NewSyntheticsTestRequest instantiates a new SyntheticsTestRequest 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 NewSyntheticsTestRequest() *SyntheticsTestRequest { - this := SyntheticsTestRequest{} - return &this -} - -// NewSyntheticsTestRequestWithDefaults instantiates a new SyntheticsTestRequest 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 NewSyntheticsTestRequestWithDefaults() *SyntheticsTestRequest { - this := SyntheticsTestRequest{} - return &this -} - -// GetAllowInsecure returns the AllowInsecure field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetAllowInsecure() bool { - if o == nil || o.AllowInsecure == nil { - var ret bool - return ret - } - return *o.AllowInsecure -} - -// GetAllowInsecureOk returns a tuple with the AllowInsecure field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetAllowInsecureOk() (*bool, bool) { - if o == nil || o.AllowInsecure == nil { - return nil, false - } - return o.AllowInsecure, true -} - -// HasAllowInsecure returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasAllowInsecure() bool { - if o != nil && o.AllowInsecure != nil { - return true - } - - return false -} - -// SetAllowInsecure gets a reference to the given bool and assigns it to the AllowInsecure field. -func (o *SyntheticsTestRequest) SetAllowInsecure(v bool) { - o.AllowInsecure = &v -} - -// GetBasicAuth returns the BasicAuth field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetBasicAuth() SyntheticsBasicAuth { - if o == nil || o.BasicAuth == nil { - var ret SyntheticsBasicAuth - return ret - } - return *o.BasicAuth -} - -// GetBasicAuthOk returns a tuple with the BasicAuth field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetBasicAuthOk() (*SyntheticsBasicAuth, bool) { - if o == nil || o.BasicAuth == nil { - return nil, false - } - return o.BasicAuth, true -} - -// HasBasicAuth returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasBasicAuth() bool { - if o != nil && o.BasicAuth != nil { - return true - } - - return false -} - -// SetBasicAuth gets a reference to the given SyntheticsBasicAuth and assigns it to the BasicAuth field. -func (o *SyntheticsTestRequest) SetBasicAuth(v SyntheticsBasicAuth) { - o.BasicAuth = &v -} - -// GetBody returns the Body field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetBody() string { - if o == nil || o.Body == nil { - var ret string - return ret - } - return *o.Body -} - -// GetBodyOk returns a tuple with the Body field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetBodyOk() (*string, bool) { - if o == nil || o.Body == nil { - return nil, false - } - return o.Body, true -} - -// HasBody returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasBody() bool { - if o != nil && o.Body != nil { - return true - } - - return false -} - -// SetBody gets a reference to the given string and assigns it to the Body field. -func (o *SyntheticsTestRequest) SetBody(v string) { - o.Body = &v -} - -// GetCertificate returns the Certificate field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetCertificate() SyntheticsTestRequestCertificate { - if o == nil || o.Certificate == nil { - var ret SyntheticsTestRequestCertificate - return ret - } - return *o.Certificate -} - -// GetCertificateOk returns a tuple with the Certificate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetCertificateOk() (*SyntheticsTestRequestCertificate, bool) { - if o == nil || o.Certificate == nil { - return nil, false - } - return o.Certificate, true -} - -// HasCertificate returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasCertificate() bool { - if o != nil && o.Certificate != nil { - return true - } - - return false -} - -// SetCertificate gets a reference to the given SyntheticsTestRequestCertificate and assigns it to the Certificate field. -func (o *SyntheticsTestRequest) SetCertificate(v SyntheticsTestRequestCertificate) { - o.Certificate = &v -} - -// GetDnsServer returns the DnsServer field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetDnsServer() string { - if o == nil || o.DnsServer == nil { - var ret string - return ret - } - return *o.DnsServer -} - -// GetDnsServerOk returns a tuple with the DnsServer field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetDnsServerOk() (*string, bool) { - if o == nil || o.DnsServer == nil { - return nil, false - } - return o.DnsServer, true -} - -// HasDnsServer returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasDnsServer() bool { - if o != nil && o.DnsServer != nil { - return true - } - - return false -} - -// SetDnsServer gets a reference to the given string and assigns it to the DnsServer field. -func (o *SyntheticsTestRequest) SetDnsServer(v string) { - o.DnsServer = &v -} - -// GetDnsServerPort returns the DnsServerPort field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetDnsServerPort() int32 { - if o == nil || o.DnsServerPort == nil { - var ret int32 - return ret - } - return *o.DnsServerPort -} - -// GetDnsServerPortOk returns a tuple with the DnsServerPort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetDnsServerPortOk() (*int32, bool) { - if o == nil || o.DnsServerPort == nil { - return nil, false - } - return o.DnsServerPort, true -} - -// HasDnsServerPort returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasDnsServerPort() bool { - if o != nil && o.DnsServerPort != nil { - return true - } - - return false -} - -// SetDnsServerPort gets a reference to the given int32 and assigns it to the DnsServerPort field. -func (o *SyntheticsTestRequest) SetDnsServerPort(v int32) { - o.DnsServerPort = &v -} - -// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetFollowRedirects() bool { - if o == nil || o.FollowRedirects == nil { - var ret bool - return ret - } - return *o.FollowRedirects -} - -// GetFollowRedirectsOk returns a tuple with the FollowRedirects field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetFollowRedirectsOk() (*bool, bool) { - if o == nil || o.FollowRedirects == nil { - return nil, false - } - return o.FollowRedirects, true -} - -// HasFollowRedirects returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasFollowRedirects() bool { - if o != nil && o.FollowRedirects != nil { - return true - } - - return false -} - -// SetFollowRedirects gets a reference to the given bool and assigns it to the FollowRedirects field. -func (o *SyntheticsTestRequest) SetFollowRedirects(v bool) { - o.FollowRedirects = &v -} - -// GetHeaders returns the Headers field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetHeaders() map[string]string { - if o == nil || o.Headers == nil { - var ret map[string]string - return ret - } - return o.Headers -} - -// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetHeadersOk() (*map[string]string, bool) { - if o == nil || o.Headers == nil { - return nil, false - } - return &o.Headers, true -} - -// HasHeaders returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasHeaders() bool { - if o != nil && o.Headers != nil { - return true - } - - return false -} - -// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field. -func (o *SyntheticsTestRequest) SetHeaders(v map[string]string) { - o.Headers = v -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *SyntheticsTestRequest) SetHost(v string) { - o.Host = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SyntheticsTestRequest) SetMessage(v string) { - o.Message = &v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetMetadata() map[string]string { - if o == nil || o.Metadata == nil { - var ret map[string]string - return ret - } - return o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetMetadataOk() (*map[string]string, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return &o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. -func (o *SyntheticsTestRequest) SetMetadata(v map[string]string) { - o.Metadata = v -} - -// GetMethod returns the Method field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetMethod() HTTPMethod { - if o == nil || o.Method == nil { - var ret HTTPMethod - return ret - } - return *o.Method -} - -// GetMethodOk returns a tuple with the Method field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetMethodOk() (*HTTPMethod, bool) { - if o == nil || o.Method == nil { - return nil, false - } - return o.Method, true -} - -// HasMethod returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasMethod() bool { - if o != nil && o.Method != nil { - return true - } - - return false -} - -// SetMethod gets a reference to the given HTTPMethod and assigns it to the Method field. -func (o *SyntheticsTestRequest) SetMethod(v HTTPMethod) { - o.Method = &v -} - -// GetNoSavingResponseBody returns the NoSavingResponseBody field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetNoSavingResponseBody() bool { - if o == nil || o.NoSavingResponseBody == nil { - var ret bool - return ret - } - return *o.NoSavingResponseBody -} - -// GetNoSavingResponseBodyOk returns a tuple with the NoSavingResponseBody field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetNoSavingResponseBodyOk() (*bool, bool) { - if o == nil || o.NoSavingResponseBody == nil { - return nil, false - } - return o.NoSavingResponseBody, true -} - -// HasNoSavingResponseBody returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasNoSavingResponseBody() bool { - if o != nil && o.NoSavingResponseBody != nil { - return true - } - - return false -} - -// SetNoSavingResponseBody gets a reference to the given bool and assigns it to the NoSavingResponseBody field. -func (o *SyntheticsTestRequest) SetNoSavingResponseBody(v bool) { - o.NoSavingResponseBody = &v -} - -// GetNumberOfPackets returns the NumberOfPackets field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetNumberOfPackets() int32 { - if o == nil || o.NumberOfPackets == nil { - var ret int32 - return ret - } - return *o.NumberOfPackets -} - -// GetNumberOfPacketsOk returns a tuple with the NumberOfPackets field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetNumberOfPacketsOk() (*int32, bool) { - if o == nil || o.NumberOfPackets == nil { - return nil, false - } - return o.NumberOfPackets, true -} - -// HasNumberOfPackets returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasNumberOfPackets() bool { - if o != nil && o.NumberOfPackets != nil { - return true - } - - return false -} - -// SetNumberOfPackets gets a reference to the given int32 and assigns it to the NumberOfPackets field. -func (o *SyntheticsTestRequest) SetNumberOfPackets(v int32) { - o.NumberOfPackets = &v -} - -// GetPort returns the Port field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetPort() int64 { - if o == nil || o.Port == nil { - var ret int64 - return ret - } - return *o.Port -} - -// GetPortOk returns a tuple with the Port field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetPortOk() (*int64, bool) { - if o == nil || o.Port == nil { - return nil, false - } - return o.Port, true -} - -// HasPort returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasPort() bool { - if o != nil && o.Port != nil { - return true - } - - return false -} - -// SetPort gets a reference to the given int64 and assigns it to the Port field. -func (o *SyntheticsTestRequest) SetPort(v int64) { - o.Port = &v -} - -// GetProxy returns the Proxy field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetProxy() SyntheticsTestRequestProxy { - if o == nil || o.Proxy == nil { - var ret SyntheticsTestRequestProxy - return ret - } - return *o.Proxy -} - -// GetProxyOk returns a tuple with the Proxy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetProxyOk() (*SyntheticsTestRequestProxy, bool) { - if o == nil || o.Proxy == nil { - return nil, false - } - return o.Proxy, true -} - -// HasProxy returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasProxy() bool { - if o != nil && o.Proxy != nil { - return true - } - - return false -} - -// SetProxy gets a reference to the given SyntheticsTestRequestProxy and assigns it to the Proxy field. -func (o *SyntheticsTestRequest) SetProxy(v SyntheticsTestRequestProxy) { - o.Proxy = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetQuery() interface{} { - if o == nil || o.Query == nil { - var ret interface{} - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetQueryOk() (*interface{}, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return &o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given interface{} and assigns it to the Query field. -func (o *SyntheticsTestRequest) SetQuery(v interface{}) { - o.Query = v -} - -// GetServername returns the Servername field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetServername() string { - if o == nil || o.Servername == nil { - var ret string - return ret - } - return *o.Servername -} - -// GetServernameOk returns a tuple with the Servername field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetServernameOk() (*string, bool) { - if o == nil || o.Servername == nil { - return nil, false - } - return o.Servername, true -} - -// HasServername returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasServername() bool { - if o != nil && o.Servername != nil { - return true - } - - return false -} - -// SetServername gets a reference to the given string and assigns it to the Servername field. -func (o *SyntheticsTestRequest) SetServername(v string) { - o.Servername = &v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) 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 *SyntheticsTestRequest) 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 *SyntheticsTestRequest) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *SyntheticsTestRequest) SetService(v string) { - o.Service = &v -} - -// GetShouldTrackHops returns the ShouldTrackHops field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetShouldTrackHops() bool { - if o == nil || o.ShouldTrackHops == nil { - var ret bool - return ret - } - return *o.ShouldTrackHops -} - -// GetShouldTrackHopsOk returns a tuple with the ShouldTrackHops field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetShouldTrackHopsOk() (*bool, bool) { - if o == nil || o.ShouldTrackHops == nil { - return nil, false - } - return o.ShouldTrackHops, true -} - -// HasShouldTrackHops returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasShouldTrackHops() bool { - if o != nil && o.ShouldTrackHops != nil { - return true - } - - return false -} - -// SetShouldTrackHops gets a reference to the given bool and assigns it to the ShouldTrackHops field. -func (o *SyntheticsTestRequest) SetShouldTrackHops(v bool) { - o.ShouldTrackHops = &v -} - -// GetTimeout returns the Timeout field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetTimeout() float64 { - if o == nil || o.Timeout == nil { - var ret float64 - return ret - } - return *o.Timeout -} - -// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetTimeoutOk() (*float64, bool) { - if o == nil || o.Timeout == nil { - return nil, false - } - return o.Timeout, true -} - -// HasTimeout returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasTimeout() bool { - if o != nil && o.Timeout != nil { - return true - } - - return false -} - -// SetTimeout gets a reference to the given float64 and assigns it to the Timeout field. -func (o *SyntheticsTestRequest) SetTimeout(v float64) { - o.Timeout = &v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *SyntheticsTestRequest) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequest) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *SyntheticsTestRequest) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *SyntheticsTestRequest) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AllowInsecure != nil { - toSerialize["allow_insecure"] = o.AllowInsecure - } - if o.BasicAuth != nil { - toSerialize["basicAuth"] = o.BasicAuth - } - if o.Body != nil { - toSerialize["body"] = o.Body - } - if o.Certificate != nil { - toSerialize["certificate"] = o.Certificate - } - if o.DnsServer != nil { - toSerialize["dnsServer"] = o.DnsServer - } - if o.DnsServerPort != nil { - toSerialize["dnsServerPort"] = o.DnsServerPort - } - if o.FollowRedirects != nil { - toSerialize["follow_redirects"] = o.FollowRedirects - } - if o.Headers != nil { - toSerialize["headers"] = o.Headers - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Method != nil { - toSerialize["method"] = o.Method - } - if o.NoSavingResponseBody != nil { - toSerialize["noSavingResponseBody"] = o.NoSavingResponseBody - } - if o.NumberOfPackets != nil { - toSerialize["numberOfPackets"] = o.NumberOfPackets - } - if o.Port != nil { - toSerialize["port"] = o.Port - } - if o.Proxy != nil { - toSerialize["proxy"] = o.Proxy - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Servername != nil { - toSerialize["servername"] = o.Servername - } - if o.Service != nil { - toSerialize["service"] = o.Service - } - if o.ShouldTrackHops != nil { - toSerialize["shouldTrackHops"] = o.ShouldTrackHops - } - if o.Timeout != nil { - toSerialize["timeout"] = o.Timeout - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AllowInsecure *bool `json:"allow_insecure,omitempty"` - BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` - Body *string `json:"body,omitempty"` - Certificate *SyntheticsTestRequestCertificate `json:"certificate,omitempty"` - DnsServer *string `json:"dnsServer,omitempty"` - DnsServerPort *int32 `json:"dnsServerPort,omitempty"` - FollowRedirects *bool `json:"follow_redirects,omitempty"` - Headers map[string]string `json:"headers,omitempty"` - Host *string `json:"host,omitempty"` - Message *string `json:"message,omitempty"` - Metadata map[string]string `json:"metadata,omitempty"` - Method *HTTPMethod `json:"method,omitempty"` - NoSavingResponseBody *bool `json:"noSavingResponseBody,omitempty"` - NumberOfPackets *int32 `json:"numberOfPackets,omitempty"` - Port *int64 `json:"port,omitempty"` - Proxy *SyntheticsTestRequestProxy `json:"proxy,omitempty"` - Query interface{} `json:"query,omitempty"` - Servername *string `json:"servername,omitempty"` - Service *string `json:"service,omitempty"` - ShouldTrackHops *bool `json:"shouldTrackHops,omitempty"` - Timeout *float64 `json:"timeout,omitempty"` - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Method; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AllowInsecure = all.AllowInsecure - o.BasicAuth = all.BasicAuth - o.Body = all.Body - if all.Certificate != nil && all.Certificate.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Certificate = all.Certificate - o.DnsServer = all.DnsServer - o.DnsServerPort = all.DnsServerPort - o.FollowRedirects = all.FollowRedirects - o.Headers = all.Headers - o.Host = all.Host - o.Message = all.Message - o.Metadata = all.Metadata - o.Method = all.Method - o.NoSavingResponseBody = all.NoSavingResponseBody - o.NumberOfPackets = all.NumberOfPackets - o.Port = all.Port - if all.Proxy != nil && all.Proxy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Proxy = all.Proxy - o.Query = all.Query - o.Servername = all.Servername - o.Service = all.Service - o.ShouldTrackHops = all.ShouldTrackHops - o.Timeout = all.Timeout - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_request_certificate.go b/api/v1/datadog/model_synthetics_test_request_certificate.go deleted file mode 100644 index 3cc47a8cea8..00000000000 --- a/api/v1/datadog/model_synthetics_test_request_certificate.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestRequestCertificate Client certificate to use when performing the test request. -type SyntheticsTestRequestCertificate struct { - // Define a request certificate. - Cert *SyntheticsTestRequestCertificateItem `json:"cert,omitempty"` - // Define a request certificate. - Key *SyntheticsTestRequestCertificateItem `json:"key,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{} -} - -// NewSyntheticsTestRequestCertificate instantiates a new SyntheticsTestRequestCertificate 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 NewSyntheticsTestRequestCertificate() *SyntheticsTestRequestCertificate { - this := SyntheticsTestRequestCertificate{} - return &this -} - -// NewSyntheticsTestRequestCertificateWithDefaults instantiates a new SyntheticsTestRequestCertificate 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 NewSyntheticsTestRequestCertificateWithDefaults() *SyntheticsTestRequestCertificate { - this := SyntheticsTestRequestCertificate{} - return &this -} - -// GetCert returns the Cert field value if set, zero value otherwise. -func (o *SyntheticsTestRequestCertificate) GetCert() SyntheticsTestRequestCertificateItem { - if o == nil || o.Cert == nil { - var ret SyntheticsTestRequestCertificateItem - return ret - } - return *o.Cert -} - -// GetCertOk returns a tuple with the Cert field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequestCertificate) GetCertOk() (*SyntheticsTestRequestCertificateItem, bool) { - if o == nil || o.Cert == nil { - return nil, false - } - return o.Cert, true -} - -// HasCert returns a boolean if a field has been set. -func (o *SyntheticsTestRequestCertificate) HasCert() bool { - if o != nil && o.Cert != nil { - return true - } - - return false -} - -// SetCert gets a reference to the given SyntheticsTestRequestCertificateItem and assigns it to the Cert field. -func (o *SyntheticsTestRequestCertificate) SetCert(v SyntheticsTestRequestCertificateItem) { - o.Cert = &v -} - -// GetKey returns the Key field value if set, zero value otherwise. -func (o *SyntheticsTestRequestCertificate) GetKey() SyntheticsTestRequestCertificateItem { - if o == nil || o.Key == nil { - var ret SyntheticsTestRequestCertificateItem - return ret - } - return *o.Key -} - -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequestCertificate) GetKeyOk() (*SyntheticsTestRequestCertificateItem, bool) { - if o == nil || o.Key == nil { - return nil, false - } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *SyntheticsTestRequestCertificate) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false -} - -// SetKey gets a reference to the given SyntheticsTestRequestCertificateItem and assigns it to the Key field. -func (o *SyntheticsTestRequestCertificate) SetKey(v SyntheticsTestRequestCertificateItem) { - o.Key = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestRequestCertificate) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cert != nil { - toSerialize["cert"] = o.Cert - } - if o.Key != nil { - toSerialize["key"] = o.Key - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestRequestCertificate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cert *SyntheticsTestRequestCertificateItem `json:"cert,omitempty"` - Key *SyntheticsTestRequestCertificateItem `json:"key,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Cert != nil && all.Cert.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Cert = all.Cert - if all.Key != nil && all.Key.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Key = all.Key - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_request_certificate_item.go b/api/v1/datadog/model_synthetics_test_request_certificate_item.go deleted file mode 100644 index 361460e34c7..00000000000 --- a/api/v1/datadog/model_synthetics_test_request_certificate_item.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTestRequestCertificateItem Define a request certificate. -type SyntheticsTestRequestCertificateItem struct { - // Content of the certificate or key. - Content *string `json:"content,omitempty"` - // File name for the certificate or key. - Filename *string `json:"filename,omitempty"` - // Date of update of the certificate or key, ISO format. - UpdatedAt *string `json:"updatedAt,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{} -} - -// NewSyntheticsTestRequestCertificateItem instantiates a new SyntheticsTestRequestCertificateItem 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 NewSyntheticsTestRequestCertificateItem() *SyntheticsTestRequestCertificateItem { - this := SyntheticsTestRequestCertificateItem{} - return &this -} - -// NewSyntheticsTestRequestCertificateItemWithDefaults instantiates a new SyntheticsTestRequestCertificateItem 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 NewSyntheticsTestRequestCertificateItemWithDefaults() *SyntheticsTestRequestCertificateItem { - this := SyntheticsTestRequestCertificateItem{} - return &this -} - -// GetContent returns the Content field value if set, zero value otherwise. -func (o *SyntheticsTestRequestCertificateItem) GetContent() string { - if o == nil || o.Content == nil { - var ret string - return ret - } - return *o.Content -} - -// GetContentOk returns a tuple with the Content field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequestCertificateItem) GetContentOk() (*string, bool) { - if o == nil || o.Content == nil { - return nil, false - } - return o.Content, true -} - -// HasContent returns a boolean if a field has been set. -func (o *SyntheticsTestRequestCertificateItem) HasContent() bool { - if o != nil && o.Content != nil { - return true - } - - return false -} - -// SetContent gets a reference to the given string and assigns it to the Content field. -func (o *SyntheticsTestRequestCertificateItem) SetContent(v string) { - o.Content = &v -} - -// GetFilename returns the Filename field value if set, zero value otherwise. -func (o *SyntheticsTestRequestCertificateItem) GetFilename() string { - if o == nil || o.Filename == nil { - var ret string - return ret - } - return *o.Filename -} - -// GetFilenameOk returns a tuple with the Filename field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequestCertificateItem) GetFilenameOk() (*string, bool) { - if o == nil || o.Filename == nil { - return nil, false - } - return o.Filename, true -} - -// HasFilename returns a boolean if a field has been set. -func (o *SyntheticsTestRequestCertificateItem) HasFilename() bool { - if o != nil && o.Filename != nil { - return true - } - - return false -} - -// SetFilename gets a reference to the given string and assigns it to the Filename field. -func (o *SyntheticsTestRequestCertificateItem) SetFilename(v string) { - o.Filename = &v -} - -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. -func (o *SyntheticsTestRequestCertificateItem) GetUpdatedAt() string { - if o == nil || o.UpdatedAt == nil { - var ret string - return ret - } - return *o.UpdatedAt -} - -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequestCertificateItem) GetUpdatedAtOk() (*string, bool) { - if o == nil || o.UpdatedAt == nil { - return nil, false - } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *SyntheticsTestRequestCertificateItem) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false -} - -// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. -func (o *SyntheticsTestRequestCertificateItem) SetUpdatedAt(v string) { - o.UpdatedAt = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestRequestCertificateItem) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Content != nil { - toSerialize["content"] = o.Content - } - if o.Filename != nil { - toSerialize["filename"] = o.Filename - } - if o.UpdatedAt != nil { - toSerialize["updatedAt"] = o.UpdatedAt - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestRequestCertificateItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Content *string `json:"content,omitempty"` - Filename *string `json:"filename,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Content = all.Content - o.Filename = all.Filename - o.UpdatedAt = all.UpdatedAt - return nil -} diff --git a/api/v1/datadog/model_synthetics_test_request_proxy.go b/api/v1/datadog/model_synthetics_test_request_proxy.go deleted file mode 100644 index 04db0531793..00000000000 --- a/api/v1/datadog/model_synthetics_test_request_proxy.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTestRequestProxy The proxy to perform the test. -type SyntheticsTestRequestProxy struct { - // Headers to include when performing the test. - Headers map[string]string `json:"headers,omitempty"` - // URL of the proxy to perform the test. - Url string `json:"url"` - // 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{} -} - -// NewSyntheticsTestRequestProxy instantiates a new SyntheticsTestRequestProxy 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 NewSyntheticsTestRequestProxy(url string) *SyntheticsTestRequestProxy { - this := SyntheticsTestRequestProxy{} - this.Url = url - return &this -} - -// NewSyntheticsTestRequestProxyWithDefaults instantiates a new SyntheticsTestRequestProxy 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 NewSyntheticsTestRequestProxyWithDefaults() *SyntheticsTestRequestProxy { - this := SyntheticsTestRequestProxy{} - return &this -} - -// GetHeaders returns the Headers field value if set, zero value otherwise. -func (o *SyntheticsTestRequestProxy) GetHeaders() map[string]string { - if o == nil || o.Headers == nil { - var ret map[string]string - return ret - } - return o.Headers -} - -// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequestProxy) GetHeadersOk() (*map[string]string, bool) { - if o == nil || o.Headers == nil { - return nil, false - } - return &o.Headers, true -} - -// HasHeaders returns a boolean if a field has been set. -func (o *SyntheticsTestRequestProxy) HasHeaders() bool { - if o != nil && o.Headers != nil { - return true - } - - return false -} - -// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field. -func (o *SyntheticsTestRequestProxy) SetHeaders(v map[string]string) { - o.Headers = v -} - -// GetUrl returns the Url field value. -func (o *SyntheticsTestRequestProxy) GetUrl() string { - if o == nil { - var ret string - return ret - } - return o.Url -} - -// GetUrlOk returns a tuple with the Url field value -// and a boolean to check if the value has been set. -func (o *SyntheticsTestRequestProxy) GetUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Url, true -} - -// SetUrl sets field value. -func (o *SyntheticsTestRequestProxy) SetUrl(v string) { - o.Url = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTestRequestProxy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Headers != nil { - toSerialize["headers"] = o.Headers - } - toSerialize["url"] = o.Url - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTestRequestProxy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Url *string `json:"url"` - }{} - all := struct { - Headers map[string]string `json:"headers,omitempty"` - Url string `json:"url"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Url == nil { - return fmt.Errorf("Required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Headers = all.Headers - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_synthetics_timing.go b/api/v1/datadog/model_synthetics_timing.go deleted file mode 100644 index 592d4411193..00000000000 --- a/api/v1/datadog/model_synthetics_timing.go +++ /dev/null @@ -1,415 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTiming Object containing all metrics and their values collected for a Synthetic API test. -// Learn more about those metrics in [Synthetics documentation](https://docs.datadoghq.com/synthetics/#metrics). -type SyntheticsTiming struct { - // The duration in millisecond of the DNS lookup. - Dns *float64 `json:"dns,omitempty"` - // The time in millisecond to download the response. - Download *float64 `json:"download,omitempty"` - // The time in millisecond to first byte. - FirstByte *float64 `json:"firstByte,omitempty"` - // The duration in millisecond of the TLS handshake. - Handshake *float64 `json:"handshake,omitempty"` - // The time in millisecond spent during redirections. - Redirect *float64 `json:"redirect,omitempty"` - // The duration in millisecond of the TLS handshake. - Ssl *float64 `json:"ssl,omitempty"` - // Time in millisecond to establish the TCP connection. - Tcp *float64 `json:"tcp,omitempty"` - // The overall time in millisecond the request took to be processed. - Total *float64 `json:"total,omitempty"` - // Time spent in millisecond waiting for a response. - Wait *float64 `json:"wait,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{} -} - -// NewSyntheticsTiming instantiates a new SyntheticsTiming 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 NewSyntheticsTiming() *SyntheticsTiming { - this := SyntheticsTiming{} - return &this -} - -// NewSyntheticsTimingWithDefaults instantiates a new SyntheticsTiming 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 NewSyntheticsTimingWithDefaults() *SyntheticsTiming { - this := SyntheticsTiming{} - return &this -} - -// GetDns returns the Dns field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetDns() float64 { - if o == nil || o.Dns == nil { - var ret float64 - return ret - } - return *o.Dns -} - -// GetDnsOk returns a tuple with the Dns field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetDnsOk() (*float64, bool) { - if o == nil || o.Dns == nil { - return nil, false - } - return o.Dns, true -} - -// HasDns returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasDns() bool { - if o != nil && o.Dns != nil { - return true - } - - return false -} - -// SetDns gets a reference to the given float64 and assigns it to the Dns field. -func (o *SyntheticsTiming) SetDns(v float64) { - o.Dns = &v -} - -// GetDownload returns the Download field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetDownload() float64 { - if o == nil || o.Download == nil { - var ret float64 - return ret - } - return *o.Download -} - -// GetDownloadOk returns a tuple with the Download field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetDownloadOk() (*float64, bool) { - if o == nil || o.Download == nil { - return nil, false - } - return o.Download, true -} - -// HasDownload returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasDownload() bool { - if o != nil && o.Download != nil { - return true - } - - return false -} - -// SetDownload gets a reference to the given float64 and assigns it to the Download field. -func (o *SyntheticsTiming) SetDownload(v float64) { - o.Download = &v -} - -// GetFirstByte returns the FirstByte field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetFirstByte() float64 { - if o == nil || o.FirstByte == nil { - var ret float64 - return ret - } - return *o.FirstByte -} - -// GetFirstByteOk returns a tuple with the FirstByte field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetFirstByteOk() (*float64, bool) { - if o == nil || o.FirstByte == nil { - return nil, false - } - return o.FirstByte, true -} - -// HasFirstByte returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasFirstByte() bool { - if o != nil && o.FirstByte != nil { - return true - } - - return false -} - -// SetFirstByte gets a reference to the given float64 and assigns it to the FirstByte field. -func (o *SyntheticsTiming) SetFirstByte(v float64) { - o.FirstByte = &v -} - -// GetHandshake returns the Handshake field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetHandshake() float64 { - if o == nil || o.Handshake == nil { - var ret float64 - return ret - } - return *o.Handshake -} - -// GetHandshakeOk returns a tuple with the Handshake field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetHandshakeOk() (*float64, bool) { - if o == nil || o.Handshake == nil { - return nil, false - } - return o.Handshake, true -} - -// HasHandshake returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasHandshake() bool { - if o != nil && o.Handshake != nil { - return true - } - - return false -} - -// SetHandshake gets a reference to the given float64 and assigns it to the Handshake field. -func (o *SyntheticsTiming) SetHandshake(v float64) { - o.Handshake = &v -} - -// GetRedirect returns the Redirect field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetRedirect() float64 { - if o == nil || o.Redirect == nil { - var ret float64 - return ret - } - return *o.Redirect -} - -// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetRedirectOk() (*float64, bool) { - if o == nil || o.Redirect == nil { - return nil, false - } - return o.Redirect, true -} - -// HasRedirect returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasRedirect() bool { - if o != nil && o.Redirect != nil { - return true - } - - return false -} - -// SetRedirect gets a reference to the given float64 and assigns it to the Redirect field. -func (o *SyntheticsTiming) SetRedirect(v float64) { - o.Redirect = &v -} - -// GetSsl returns the Ssl field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetSsl() float64 { - if o == nil || o.Ssl == nil { - var ret float64 - return ret - } - return *o.Ssl -} - -// GetSslOk returns a tuple with the Ssl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetSslOk() (*float64, bool) { - if o == nil || o.Ssl == nil { - return nil, false - } - return o.Ssl, true -} - -// HasSsl returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasSsl() bool { - if o != nil && o.Ssl != nil { - return true - } - - return false -} - -// SetSsl gets a reference to the given float64 and assigns it to the Ssl field. -func (o *SyntheticsTiming) SetSsl(v float64) { - o.Ssl = &v -} - -// GetTcp returns the Tcp field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetTcp() float64 { - if o == nil || o.Tcp == nil { - var ret float64 - return ret - } - return *o.Tcp -} - -// GetTcpOk returns a tuple with the Tcp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetTcpOk() (*float64, bool) { - if o == nil || o.Tcp == nil { - return nil, false - } - return o.Tcp, true -} - -// HasTcp returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasTcp() bool { - if o != nil && o.Tcp != nil { - return true - } - - return false -} - -// SetTcp gets a reference to the given float64 and assigns it to the Tcp field. -func (o *SyntheticsTiming) SetTcp(v float64) { - o.Tcp = &v -} - -// GetTotal returns the Total field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetTotal() float64 { - if o == nil || o.Total == nil { - var ret float64 - return ret - } - return *o.Total -} - -// GetTotalOk returns a tuple with the Total field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetTotalOk() (*float64, bool) { - if o == nil || o.Total == nil { - return nil, false - } - return o.Total, true -} - -// HasTotal returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasTotal() bool { - if o != nil && o.Total != nil { - return true - } - - return false -} - -// SetTotal gets a reference to the given float64 and assigns it to the Total field. -func (o *SyntheticsTiming) SetTotal(v float64) { - o.Total = &v -} - -// GetWait returns the Wait field value if set, zero value otherwise. -func (o *SyntheticsTiming) GetWait() float64 { - if o == nil || o.Wait == nil { - var ret float64 - return ret - } - return *o.Wait -} - -// GetWaitOk returns a tuple with the Wait field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTiming) GetWaitOk() (*float64, bool) { - if o == nil || o.Wait == nil { - return nil, false - } - return o.Wait, true -} - -// HasWait returns a boolean if a field has been set. -func (o *SyntheticsTiming) HasWait() bool { - if o != nil && o.Wait != nil { - return true - } - - return false -} - -// SetWait gets a reference to the given float64 and assigns it to the Wait field. -func (o *SyntheticsTiming) SetWait(v float64) { - o.Wait = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTiming) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Dns != nil { - toSerialize["dns"] = o.Dns - } - if o.Download != nil { - toSerialize["download"] = o.Download - } - if o.FirstByte != nil { - toSerialize["firstByte"] = o.FirstByte - } - if o.Handshake != nil { - toSerialize["handshake"] = o.Handshake - } - if o.Redirect != nil { - toSerialize["redirect"] = o.Redirect - } - if o.Ssl != nil { - toSerialize["ssl"] = o.Ssl - } - if o.Tcp != nil { - toSerialize["tcp"] = o.Tcp - } - if o.Total != nil { - toSerialize["total"] = o.Total - } - if o.Wait != nil { - toSerialize["wait"] = o.Wait - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTiming) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Dns *float64 `json:"dns,omitempty"` - Download *float64 `json:"download,omitempty"` - FirstByte *float64 `json:"firstByte,omitempty"` - Handshake *float64 `json:"handshake,omitempty"` - Redirect *float64 `json:"redirect,omitempty"` - Ssl *float64 `json:"ssl,omitempty"` - Tcp *float64 `json:"tcp,omitempty"` - Total *float64 `json:"total,omitempty"` - Wait *float64 `json:"wait,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Dns = all.Dns - o.Download = all.Download - o.FirstByte = all.FirstByte - o.Handshake = all.Handshake - o.Redirect = all.Redirect - o.Ssl = all.Ssl - o.Tcp = all.Tcp - o.Total = all.Total - o.Wait = all.Wait - return nil -} diff --git a/api/v1/datadog/model_synthetics_trigger_body.go b/api/v1/datadog/model_synthetics_trigger_body.go deleted file mode 100644 index 1b03f875341..00000000000 --- a/api/v1/datadog/model_synthetics_trigger_body.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTriggerBody Object describing the synthetics tests to trigger. -type SyntheticsTriggerBody struct { - // Individual synthetics test. - Tests []SyntheticsTriggerTest `json:"tests"` - // 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{} -} - -// NewSyntheticsTriggerBody instantiates a new SyntheticsTriggerBody 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 NewSyntheticsTriggerBody(tests []SyntheticsTriggerTest) *SyntheticsTriggerBody { - this := SyntheticsTriggerBody{} - this.Tests = tests - return &this -} - -// NewSyntheticsTriggerBodyWithDefaults instantiates a new SyntheticsTriggerBody 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 NewSyntheticsTriggerBodyWithDefaults() *SyntheticsTriggerBody { - this := SyntheticsTriggerBody{} - return &this -} - -// GetTests returns the Tests field value. -func (o *SyntheticsTriggerBody) GetTests() []SyntheticsTriggerTest { - if o == nil { - var ret []SyntheticsTriggerTest - return ret - } - return o.Tests -} - -// GetTestsOk returns a tuple with the Tests field value -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerBody) GetTestsOk() (*[]SyntheticsTriggerTest, bool) { - if o == nil { - return nil, false - } - return &o.Tests, true -} - -// SetTests sets field value. -func (o *SyntheticsTriggerBody) SetTests(v []SyntheticsTriggerTest) { - o.Tests = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTriggerBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["tests"] = o.Tests - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTriggerBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Tests *[]SyntheticsTriggerTest `json:"tests"` - }{} - all := struct { - Tests []SyntheticsTriggerTest `json:"tests"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Tests == nil { - return fmt.Errorf("Required field tests missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Tests = all.Tests - return nil -} diff --git a/api/v1/datadog/model_synthetics_trigger_ci_test_location.go b/api/v1/datadog/model_synthetics_trigger_ci_test_location.go deleted file mode 100644 index 1352969cd62..00000000000 --- a/api/v1/datadog/model_synthetics_trigger_ci_test_location.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTriggerCITestLocation Synthetics location. -type SyntheticsTriggerCITestLocation struct { - // Unique identifier of the location. - Id *int64 `json:"id,omitempty"` - // Name of the location. - Name *string `json:"name,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{} -} - -// NewSyntheticsTriggerCITestLocation instantiates a new SyntheticsTriggerCITestLocation 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 NewSyntheticsTriggerCITestLocation() *SyntheticsTriggerCITestLocation { - this := SyntheticsTriggerCITestLocation{} - return &this -} - -// NewSyntheticsTriggerCITestLocationWithDefaults instantiates a new SyntheticsTriggerCITestLocation 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 NewSyntheticsTriggerCITestLocationWithDefaults() *SyntheticsTriggerCITestLocation { - this := SyntheticsTriggerCITestLocation{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestLocation) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestLocation) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestLocation) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *SyntheticsTriggerCITestLocation) SetId(v int64) { - o.Id = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestLocation) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestLocation) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestLocation) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SyntheticsTriggerCITestLocation) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTriggerCITestLocation) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTriggerCITestLocation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Name = all.Name - return nil -} diff --git a/api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go b/api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go deleted file mode 100644 index a13c727f263..00000000000 --- a/api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go +++ /dev/null @@ -1,227 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsTriggerCITestRunResult Information about a single test run. -type SyntheticsTriggerCITestRunResult struct { - // The device ID. - Device *SyntheticsDeviceID `json:"device,omitempty"` - // The location ID of the test run. - Location *int64 `json:"location,omitempty"` - // The public ID of the Synthetics test. - PublicId *string `json:"public_id,omitempty"` - // ID of the result. - ResultId *string `json:"result_id,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{} -} - -// NewSyntheticsTriggerCITestRunResult instantiates a new SyntheticsTriggerCITestRunResult 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 NewSyntheticsTriggerCITestRunResult() *SyntheticsTriggerCITestRunResult { - this := SyntheticsTriggerCITestRunResult{} - return &this -} - -// NewSyntheticsTriggerCITestRunResultWithDefaults instantiates a new SyntheticsTriggerCITestRunResult 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 NewSyntheticsTriggerCITestRunResultWithDefaults() *SyntheticsTriggerCITestRunResult { - this := SyntheticsTriggerCITestRunResult{} - return &this -} - -// GetDevice returns the Device field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestRunResult) GetDevice() SyntheticsDeviceID { - if o == nil || o.Device == nil { - var ret SyntheticsDeviceID - return ret - } - return *o.Device -} - -// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestRunResult) GetDeviceOk() (*SyntheticsDeviceID, bool) { - if o == nil || o.Device == nil { - return nil, false - } - return o.Device, true -} - -// HasDevice returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestRunResult) HasDevice() bool { - if o != nil && o.Device != nil { - return true - } - - return false -} - -// SetDevice gets a reference to the given SyntheticsDeviceID and assigns it to the Device field. -func (o *SyntheticsTriggerCITestRunResult) SetDevice(v SyntheticsDeviceID) { - o.Device = &v -} - -// GetLocation returns the Location field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestRunResult) GetLocation() int64 { - if o == nil || o.Location == nil { - var ret int64 - return ret - } - return *o.Location -} - -// GetLocationOk returns a tuple with the Location field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestRunResult) GetLocationOk() (*int64, bool) { - if o == nil || o.Location == nil { - return nil, false - } - return o.Location, true -} - -// HasLocation returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestRunResult) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false -} - -// SetLocation gets a reference to the given int64 and assigns it to the Location field. -func (o *SyntheticsTriggerCITestRunResult) SetLocation(v int64) { - o.Location = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestRunResult) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestRunResult) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestRunResult) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *SyntheticsTriggerCITestRunResult) SetPublicId(v string) { - o.PublicId = &v -} - -// GetResultId returns the ResultId field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestRunResult) GetResultId() string { - if o == nil || o.ResultId == nil { - var ret string - return ret - } - return *o.ResultId -} - -// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestRunResult) GetResultIdOk() (*string, bool) { - if o == nil || o.ResultId == nil { - return nil, false - } - return o.ResultId, true -} - -// HasResultId returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestRunResult) HasResultId() bool { - if o != nil && o.ResultId != nil { - return true - } - - return false -} - -// SetResultId gets a reference to the given string and assigns it to the ResultId field. -func (o *SyntheticsTriggerCITestRunResult) SetResultId(v string) { - o.ResultId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTriggerCITestRunResult) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Device != nil { - toSerialize["device"] = o.Device - } - if o.Location != nil { - toSerialize["location"] = o.Location - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.ResultId != nil { - toSerialize["result_id"] = o.ResultId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTriggerCITestRunResult) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Device *SyntheticsDeviceID `json:"device,omitempty"` - Location *int64 `json:"location,omitempty"` - PublicId *string `json:"public_id,omitempty"` - ResultId *string `json:"result_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Device; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Device = all.Device - o.Location = all.Location - o.PublicId = all.PublicId - o.ResultId = all.ResultId - return nil -} diff --git a/api/v1/datadog/model_synthetics_trigger_ci_tests_response.go b/api/v1/datadog/model_synthetics_trigger_ci_tests_response.go deleted file mode 100644 index fb6d22aff61..00000000000 --- a/api/v1/datadog/model_synthetics_trigger_ci_tests_response.go +++ /dev/null @@ -1,232 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SyntheticsTriggerCITestsResponse Object containing information about the tests triggered. -type SyntheticsTriggerCITestsResponse struct { - // The public ID of the batch triggered. - BatchId common.NullableString `json:"batch_id,omitempty"` - // List of Synthetics locations. - Locations []SyntheticsTriggerCITestLocation `json:"locations,omitempty"` - // Information about the tests runs. - Results []SyntheticsTriggerCITestRunResult `json:"results,omitempty"` - // The public IDs of the Synthetics test triggered. - TriggeredCheckIds []string `json:"triggered_check_ids,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{} -} - -// NewSyntheticsTriggerCITestsResponse instantiates a new SyntheticsTriggerCITestsResponse 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 NewSyntheticsTriggerCITestsResponse() *SyntheticsTriggerCITestsResponse { - this := SyntheticsTriggerCITestsResponse{} - return &this -} - -// NewSyntheticsTriggerCITestsResponseWithDefaults instantiates a new SyntheticsTriggerCITestsResponse 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 NewSyntheticsTriggerCITestsResponseWithDefaults() *SyntheticsTriggerCITestsResponse { - this := SyntheticsTriggerCITestsResponse{} - return &this -} - -// GetBatchId returns the BatchId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SyntheticsTriggerCITestsResponse) GetBatchId() string { - if o == nil || o.BatchId.Get() == nil { - var ret string - return ret - } - return *o.BatchId.Get() -} - -// GetBatchIdOk returns a tuple with the BatchId 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 *SyntheticsTriggerCITestsResponse) GetBatchIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.BatchId.Get(), o.BatchId.IsSet() -} - -// HasBatchId returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestsResponse) HasBatchId() bool { - if o != nil && o.BatchId.IsSet() { - return true - } - - return false -} - -// SetBatchId gets a reference to the given common.NullableString and assigns it to the BatchId field. -func (o *SyntheticsTriggerCITestsResponse) SetBatchId(v string) { - o.BatchId.Set(&v) -} - -// SetBatchIdNil sets the value for BatchId to be an explicit nil. -func (o *SyntheticsTriggerCITestsResponse) SetBatchIdNil() { - o.BatchId.Set(nil) -} - -// UnsetBatchId ensures that no value is present for BatchId, not even an explicit nil. -func (o *SyntheticsTriggerCITestsResponse) UnsetBatchId() { - o.BatchId.Unset() -} - -// GetLocations returns the Locations field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestsResponse) GetLocations() []SyntheticsTriggerCITestLocation { - if o == nil || o.Locations == nil { - var ret []SyntheticsTriggerCITestLocation - return ret - } - return o.Locations -} - -// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestsResponse) GetLocationsOk() (*[]SyntheticsTriggerCITestLocation, bool) { - if o == nil || o.Locations == nil { - return nil, false - } - return &o.Locations, true -} - -// HasLocations returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestsResponse) HasLocations() bool { - if o != nil && o.Locations != nil { - return true - } - - return false -} - -// SetLocations gets a reference to the given []SyntheticsTriggerCITestLocation and assigns it to the Locations field. -func (o *SyntheticsTriggerCITestsResponse) SetLocations(v []SyntheticsTriggerCITestLocation) { - o.Locations = v -} - -// GetResults returns the Results field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestsResponse) GetResults() []SyntheticsTriggerCITestRunResult { - if o == nil || o.Results == nil { - var ret []SyntheticsTriggerCITestRunResult - return ret - } - return o.Results -} - -// GetResultsOk returns a tuple with the Results field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestsResponse) GetResultsOk() (*[]SyntheticsTriggerCITestRunResult, bool) { - if o == nil || o.Results == nil { - return nil, false - } - return &o.Results, true -} - -// HasResults returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestsResponse) HasResults() bool { - if o != nil && o.Results != nil { - return true - } - - return false -} - -// SetResults gets a reference to the given []SyntheticsTriggerCITestRunResult and assigns it to the Results field. -func (o *SyntheticsTriggerCITestsResponse) SetResults(v []SyntheticsTriggerCITestRunResult) { - o.Results = v -} - -// GetTriggeredCheckIds returns the TriggeredCheckIds field value if set, zero value otherwise. -func (o *SyntheticsTriggerCITestsResponse) GetTriggeredCheckIds() []string { - if o == nil || o.TriggeredCheckIds == nil { - var ret []string - return ret - } - return o.TriggeredCheckIds -} - -// GetTriggeredCheckIdsOk returns a tuple with the TriggeredCheckIds field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerCITestsResponse) GetTriggeredCheckIdsOk() (*[]string, bool) { - if o == nil || o.TriggeredCheckIds == nil { - return nil, false - } - return &o.TriggeredCheckIds, true -} - -// HasTriggeredCheckIds returns a boolean if a field has been set. -func (o *SyntheticsTriggerCITestsResponse) HasTriggeredCheckIds() bool { - if o != nil && o.TriggeredCheckIds != nil { - return true - } - - return false -} - -// SetTriggeredCheckIds gets a reference to the given []string and assigns it to the TriggeredCheckIds field. -func (o *SyntheticsTriggerCITestsResponse) SetTriggeredCheckIds(v []string) { - o.TriggeredCheckIds = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTriggerCITestsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BatchId.IsSet() { - toSerialize["batch_id"] = o.BatchId.Get() - } - if o.Locations != nil { - toSerialize["locations"] = o.Locations - } - if o.Results != nil { - toSerialize["results"] = o.Results - } - if o.TriggeredCheckIds != nil { - toSerialize["triggered_check_ids"] = o.TriggeredCheckIds - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTriggerCITestsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BatchId common.NullableString `json:"batch_id,omitempty"` - Locations []SyntheticsTriggerCITestLocation `json:"locations,omitempty"` - Results []SyntheticsTriggerCITestRunResult `json:"results,omitempty"` - TriggeredCheckIds []string `json:"triggered_check_ids,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BatchId = all.BatchId - o.Locations = all.Locations - o.Results = all.Results - o.TriggeredCheckIds = all.TriggeredCheckIds - return nil -} diff --git a/api/v1/datadog/model_synthetics_trigger_test_.go b/api/v1/datadog/model_synthetics_trigger_test_.go deleted file mode 100644 index fc49cb6802a..00000000000 --- a/api/v1/datadog/model_synthetics_trigger_test_.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsTriggerTest Test configuration for Synthetics -type SyntheticsTriggerTest struct { - // Metadata for the Synthetics tests run. - Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - // The public ID of the Synthetics test to trigger. - PublicId string `json:"public_id"` - // 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{} -} - -// NewSyntheticsTriggerTest instantiates a new SyntheticsTriggerTest 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 NewSyntheticsTriggerTest(publicId string) *SyntheticsTriggerTest { - this := SyntheticsTriggerTest{} - this.PublicId = publicId - return &this -} - -// NewSyntheticsTriggerTestWithDefaults instantiates a new SyntheticsTriggerTest 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 NewSyntheticsTriggerTestWithDefaults() *SyntheticsTriggerTest { - this := SyntheticsTriggerTest{} - return &this -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *SyntheticsTriggerTest) GetMetadata() SyntheticsCIBatchMetadata { - if o == nil || o.Metadata == nil { - var ret SyntheticsCIBatchMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerTest) GetMetadataOk() (*SyntheticsCIBatchMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *SyntheticsTriggerTest) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given SyntheticsCIBatchMetadata and assigns it to the Metadata field. -func (o *SyntheticsTriggerTest) SetMetadata(v SyntheticsCIBatchMetadata) { - o.Metadata = &v -} - -// GetPublicId returns the PublicId field value. -func (o *SyntheticsTriggerTest) GetPublicId() string { - if o == nil { - var ret string - return ret - } - return o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value -// and a boolean to check if the value has been set. -func (o *SyntheticsTriggerTest) GetPublicIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.PublicId, true -} - -// SetPublicId sets field value. -func (o *SyntheticsTriggerTest) SetPublicId(v string) { - o.PublicId = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsTriggerTest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - toSerialize["public_id"] = o.PublicId - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsTriggerTest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - PublicId *string `json:"public_id"` - }{} - all := struct { - Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - PublicId string `json:"public_id"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.PublicId == nil { - return fmt.Errorf("Required field public_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_synthetics_update_test_pause_status_payload.go b/api/v1/datadog/model_synthetics_update_test_pause_status_payload.go deleted file mode 100644 index 87a0e807c44..00000000000 --- a/api/v1/datadog/model_synthetics_update_test_pause_status_payload.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SyntheticsUpdateTestPauseStatusPayload Object to start or pause an existing Synthetic test. -type SyntheticsUpdateTestPauseStatusPayload struct { - // Define whether you want to start (`live`) or pause (`paused`) a - // Synthetic test. - NewStatus *SyntheticsTestPauseStatus `json:"new_status,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{} -} - -// NewSyntheticsUpdateTestPauseStatusPayload instantiates a new SyntheticsUpdateTestPauseStatusPayload 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 NewSyntheticsUpdateTestPauseStatusPayload() *SyntheticsUpdateTestPauseStatusPayload { - this := SyntheticsUpdateTestPauseStatusPayload{} - return &this -} - -// NewSyntheticsUpdateTestPauseStatusPayloadWithDefaults instantiates a new SyntheticsUpdateTestPauseStatusPayload 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 NewSyntheticsUpdateTestPauseStatusPayloadWithDefaults() *SyntheticsUpdateTestPauseStatusPayload { - this := SyntheticsUpdateTestPauseStatusPayload{} - return &this -} - -// GetNewStatus returns the NewStatus field value if set, zero value otherwise. -func (o *SyntheticsUpdateTestPauseStatusPayload) GetNewStatus() SyntheticsTestPauseStatus { - if o == nil || o.NewStatus == nil { - var ret SyntheticsTestPauseStatus - return ret - } - return *o.NewStatus -} - -// GetNewStatusOk returns a tuple with the NewStatus field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsUpdateTestPauseStatusPayload) GetNewStatusOk() (*SyntheticsTestPauseStatus, bool) { - if o == nil || o.NewStatus == nil { - return nil, false - } - return o.NewStatus, true -} - -// HasNewStatus returns a boolean if a field has been set. -func (o *SyntheticsUpdateTestPauseStatusPayload) HasNewStatus() bool { - if o != nil && o.NewStatus != nil { - return true - } - - return false -} - -// SetNewStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the NewStatus field. -func (o *SyntheticsUpdateTestPauseStatusPayload) SetNewStatus(v SyntheticsTestPauseStatus) { - o.NewStatus = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsUpdateTestPauseStatusPayload) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.NewStatus != nil { - toSerialize["new_status"] = o.NewStatus - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsUpdateTestPauseStatusPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - NewStatus *SyntheticsTestPauseStatus `json:"new_status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.NewStatus; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.NewStatus = all.NewStatus - return nil -} diff --git a/api/v1/datadog/model_synthetics_variable_parser.go b/api/v1/datadog/model_synthetics_variable_parser.go deleted file mode 100644 index 0b6922cbe26..00000000000 --- a/api/v1/datadog/model_synthetics_variable_parser.go +++ /dev/null @@ -1,150 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsVariableParser Details of the parser to use for the global variable. -type SyntheticsVariableParser struct { - // Type of parser for a Synthetics global variable from a synthetics test. - Type SyntheticsGlobalVariableParserType `json:"type"` - // Regex or JSON path used for the parser. Not used with type `raw`. - Value *string `json:"value,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{} -} - -// NewSyntheticsVariableParser instantiates a new SyntheticsVariableParser 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 NewSyntheticsVariableParser(typeVar SyntheticsGlobalVariableParserType) *SyntheticsVariableParser { - this := SyntheticsVariableParser{} - this.Type = typeVar - return &this -} - -// NewSyntheticsVariableParserWithDefaults instantiates a new SyntheticsVariableParser 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 NewSyntheticsVariableParserWithDefaults() *SyntheticsVariableParser { - this := SyntheticsVariableParser{} - return &this -} - -// GetType returns the Type field value. -func (o *SyntheticsVariableParser) GetType() SyntheticsGlobalVariableParserType { - if o == nil { - var ret SyntheticsGlobalVariableParserType - 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 *SyntheticsVariableParser) GetTypeOk() (*SyntheticsGlobalVariableParserType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SyntheticsVariableParser) SetType(v SyntheticsGlobalVariableParserType) { - o.Type = v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *SyntheticsVariableParser) GetValue() string { - if o == nil || o.Value == nil { - var ret string - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsVariableParser) GetValueOk() (*string, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *SyntheticsVariableParser) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given string and assigns it to the Value field. -func (o *SyntheticsVariableParser) SetValue(v string) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsVariableParser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["type"] = o.Type - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsVariableParser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *SyntheticsGlobalVariableParserType `json:"type"` - }{} - all := struct { - Type SyntheticsGlobalVariableParserType `json:"type"` - Value *string `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_synthetics_warning_type.go b/api/v1/datadog/model_synthetics_warning_type.go deleted file mode 100644 index 31f44e7b352..00000000000 --- a/api/v1/datadog/model_synthetics_warning_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SyntheticsWarningType User locator used. -type SyntheticsWarningType string - -// List of SyntheticsWarningType. -const ( - SYNTHETICSWARNINGTYPE_USER_LOCATOR SyntheticsWarningType = "user_locator" -) - -var allowedSyntheticsWarningTypeEnumValues = []SyntheticsWarningType{ - SYNTHETICSWARNINGTYPE_USER_LOCATOR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsWarningType) GetAllowedValues() []SyntheticsWarningType { - return allowedSyntheticsWarningTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsWarningType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsWarningType(value) - return nil -} - -// NewSyntheticsWarningTypeFromValue returns a pointer to a valid SyntheticsWarningType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsWarningTypeFromValue(v string) (*SyntheticsWarningType, error) { - ev := SyntheticsWarningType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsWarningType: valid values are %v", v, allowedSyntheticsWarningTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsWarningType) IsValid() bool { - for _, existing := range allowedSyntheticsWarningTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsWarningType value. -func (v SyntheticsWarningType) Ptr() *SyntheticsWarningType { - return &v -} - -// NullableSyntheticsWarningType handles when a null is used for SyntheticsWarningType. -type NullableSyntheticsWarningType struct { - value *SyntheticsWarningType - isSet bool -} - -// Get returns the associated value. -func (v NullableSyntheticsWarningType) Get() *SyntheticsWarningType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSyntheticsWarningType) Set(val *SyntheticsWarningType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSyntheticsWarningType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSyntheticsWarningType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSyntheticsWarningType initializes the struct as if Set has been called. -func NewNullableSyntheticsWarningType(val *SyntheticsWarningType) *NullableSyntheticsWarningType { - return &NullableSyntheticsWarningType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSyntheticsWarningType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSyntheticsWarningType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_table_widget_cell_display_mode.go b/api/v1/datadog/model_table_widget_cell_display_mode.go deleted file mode 100644 index ebd16587d4c..00000000000 --- a/api/v1/datadog/model_table_widget_cell_display_mode.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TableWidgetCellDisplayMode Define a display mode for the table cell. -type TableWidgetCellDisplayMode string - -// List of TableWidgetCellDisplayMode. -const ( - TABLEWIDGETCELLDISPLAYMODE_NUMBER TableWidgetCellDisplayMode = "number" - TABLEWIDGETCELLDISPLAYMODE_BAR TableWidgetCellDisplayMode = "bar" -) - -var allowedTableWidgetCellDisplayModeEnumValues = []TableWidgetCellDisplayMode{ - TABLEWIDGETCELLDISPLAYMODE_NUMBER, - TABLEWIDGETCELLDISPLAYMODE_BAR, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TableWidgetCellDisplayMode) GetAllowedValues() []TableWidgetCellDisplayMode { - return allowedTableWidgetCellDisplayModeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TableWidgetCellDisplayMode) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TableWidgetCellDisplayMode(value) - return nil -} - -// NewTableWidgetCellDisplayModeFromValue returns a pointer to a valid TableWidgetCellDisplayMode -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTableWidgetCellDisplayModeFromValue(v string) (*TableWidgetCellDisplayMode, error) { - ev := TableWidgetCellDisplayMode(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TableWidgetCellDisplayMode: valid values are %v", v, allowedTableWidgetCellDisplayModeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TableWidgetCellDisplayMode) IsValid() bool { - for _, existing := range allowedTableWidgetCellDisplayModeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TableWidgetCellDisplayMode value. -func (v TableWidgetCellDisplayMode) Ptr() *TableWidgetCellDisplayMode { - return &v -} - -// NullableTableWidgetCellDisplayMode handles when a null is used for TableWidgetCellDisplayMode. -type NullableTableWidgetCellDisplayMode struct { - value *TableWidgetCellDisplayMode - isSet bool -} - -// Get returns the associated value. -func (v NullableTableWidgetCellDisplayMode) Get() *TableWidgetCellDisplayMode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTableWidgetCellDisplayMode) Set(val *TableWidgetCellDisplayMode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTableWidgetCellDisplayMode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTableWidgetCellDisplayMode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTableWidgetCellDisplayMode initializes the struct as if Set has been called. -func NewNullableTableWidgetCellDisplayMode(val *TableWidgetCellDisplayMode) *NullableTableWidgetCellDisplayMode { - return &NullableTableWidgetCellDisplayMode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTableWidgetCellDisplayMode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTableWidgetCellDisplayMode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_table_widget_definition.go b/api/v1/datadog/model_table_widget_definition.go deleted file mode 100644 index 8b79ece5610..00000000000 --- a/api/v1/datadog/model_table_widget_definition.go +++ /dev/null @@ -1,403 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TableWidgetDefinition The table visualization is available on timeboards and screenboards. It displays columns of metrics grouped by tag key. -type TableWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // Controls the display of the search bar. - HasSearchBar *TableWidgetHasSearchBar `json:"has_search_bar,omitempty"` - // Widget definition. - Requests []TableWidgetRequest `json:"requests"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the table widget. - Type TableWidgetDefinitionType `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{} -} - -// NewTableWidgetDefinition instantiates a new TableWidgetDefinition 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 NewTableWidgetDefinition(requests []TableWidgetRequest, typeVar TableWidgetDefinitionType) *TableWidgetDefinition { - this := TableWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewTableWidgetDefinitionWithDefaults instantiates a new TableWidgetDefinition 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 NewTableWidgetDefinitionWithDefaults() *TableWidgetDefinition { - this := TableWidgetDefinition{} - var typeVar TableWidgetDefinitionType = TABLEWIDGETDEFINITIONTYPE_QUERY_TABLE - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *TableWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *TableWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *TableWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetHasSearchBar returns the HasSearchBar field value if set, zero value otherwise. -func (o *TableWidgetDefinition) GetHasSearchBar() TableWidgetHasSearchBar { - if o == nil || o.HasSearchBar == nil { - var ret TableWidgetHasSearchBar - return ret - } - return *o.HasSearchBar -} - -// GetHasSearchBarOk returns a tuple with the HasSearchBar field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetDefinition) GetHasSearchBarOk() (*TableWidgetHasSearchBar, bool) { - if o == nil || o.HasSearchBar == nil { - return nil, false - } - return o.HasSearchBar, true -} - -// HasHasSearchBar returns a boolean if a field has been set. -func (o *TableWidgetDefinition) HasHasSearchBar() bool { - if o != nil && o.HasSearchBar != nil { - return true - } - - return false -} - -// SetHasSearchBar gets a reference to the given TableWidgetHasSearchBar and assigns it to the HasSearchBar field. -func (o *TableWidgetDefinition) SetHasSearchBar(v TableWidgetHasSearchBar) { - o.HasSearchBar = &v -} - -// GetRequests returns the Requests field value. -func (o *TableWidgetDefinition) GetRequests() []TableWidgetRequest { - if o == nil { - var ret []TableWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *TableWidgetDefinition) GetRequestsOk() (*[]TableWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *TableWidgetDefinition) SetRequests(v []TableWidgetRequest) { - o.Requests = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *TableWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *TableWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *TableWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *TableWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *TableWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *TableWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *TableWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *TableWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *TableWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *TableWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *TableWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *TableWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *TableWidgetDefinition) GetType() TableWidgetDefinitionType { - if o == nil { - var ret TableWidgetDefinitionType - 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 *TableWidgetDefinition) GetTypeOk() (*TableWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *TableWidgetDefinition) SetType(v TableWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TableWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - if o.HasSearchBar != nil { - toSerialize["has_search_bar"] = o.HasSearchBar - } - toSerialize["requests"] = o.Requests - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]TableWidgetRequest `json:"requests"` - Type *TableWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - HasSearchBar *TableWidgetHasSearchBar `json:"has_search_bar,omitempty"` - Requests []TableWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type TableWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.HasSearchBar; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.HasSearchBar = all.HasSearchBar - o.Requests = all.Requests - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_table_widget_definition_type.go b/api/v1/datadog/model_table_widget_definition_type.go deleted file mode 100644 index acfdd3c0396..00000000000 --- a/api/v1/datadog/model_table_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TableWidgetDefinitionType Type of the table widget. -type TableWidgetDefinitionType string - -// List of TableWidgetDefinitionType. -const ( - TABLEWIDGETDEFINITIONTYPE_QUERY_TABLE TableWidgetDefinitionType = "query_table" -) - -var allowedTableWidgetDefinitionTypeEnumValues = []TableWidgetDefinitionType{ - TABLEWIDGETDEFINITIONTYPE_QUERY_TABLE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TableWidgetDefinitionType) GetAllowedValues() []TableWidgetDefinitionType { - return allowedTableWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TableWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TableWidgetDefinitionType(value) - return nil -} - -// NewTableWidgetDefinitionTypeFromValue returns a pointer to a valid TableWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTableWidgetDefinitionTypeFromValue(v string) (*TableWidgetDefinitionType, error) { - ev := TableWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TableWidgetDefinitionType: valid values are %v", v, allowedTableWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TableWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedTableWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TableWidgetDefinitionType value. -func (v TableWidgetDefinitionType) Ptr() *TableWidgetDefinitionType { - return &v -} - -// NullableTableWidgetDefinitionType handles when a null is used for TableWidgetDefinitionType. -type NullableTableWidgetDefinitionType struct { - value *TableWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableTableWidgetDefinitionType) Get() *TableWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTableWidgetDefinitionType) Set(val *TableWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTableWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTableWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTableWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableTableWidgetDefinitionType(val *TableWidgetDefinitionType) *NullableTableWidgetDefinitionType { - return &NullableTableWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTableWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTableWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_table_widget_has_search_bar.go b/api/v1/datadog/model_table_widget_has_search_bar.go deleted file mode 100644 index 25997e72749..00000000000 --- a/api/v1/datadog/model_table_widget_has_search_bar.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TableWidgetHasSearchBar Controls the display of the search bar. -type TableWidgetHasSearchBar string - -// List of TableWidgetHasSearchBar. -const ( - TABLEWIDGETHASSEARCHBAR_ALWAYS TableWidgetHasSearchBar = "always" - TABLEWIDGETHASSEARCHBAR_NEVER TableWidgetHasSearchBar = "never" - TABLEWIDGETHASSEARCHBAR_AUTO TableWidgetHasSearchBar = "auto" -) - -var allowedTableWidgetHasSearchBarEnumValues = []TableWidgetHasSearchBar{ - TABLEWIDGETHASSEARCHBAR_ALWAYS, - TABLEWIDGETHASSEARCHBAR_NEVER, - TABLEWIDGETHASSEARCHBAR_AUTO, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TableWidgetHasSearchBar) GetAllowedValues() []TableWidgetHasSearchBar { - return allowedTableWidgetHasSearchBarEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TableWidgetHasSearchBar) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TableWidgetHasSearchBar(value) - return nil -} - -// NewTableWidgetHasSearchBarFromValue returns a pointer to a valid TableWidgetHasSearchBar -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTableWidgetHasSearchBarFromValue(v string) (*TableWidgetHasSearchBar, error) { - ev := TableWidgetHasSearchBar(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TableWidgetHasSearchBar: valid values are %v", v, allowedTableWidgetHasSearchBarEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TableWidgetHasSearchBar) IsValid() bool { - for _, existing := range allowedTableWidgetHasSearchBarEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TableWidgetHasSearchBar value. -func (v TableWidgetHasSearchBar) Ptr() *TableWidgetHasSearchBar { - return &v -} - -// NullableTableWidgetHasSearchBar handles when a null is used for TableWidgetHasSearchBar. -type NullableTableWidgetHasSearchBar struct { - value *TableWidgetHasSearchBar - isSet bool -} - -// Get returns the associated value. -func (v NullableTableWidgetHasSearchBar) Get() *TableWidgetHasSearchBar { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTableWidgetHasSearchBar) Set(val *TableWidgetHasSearchBar) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTableWidgetHasSearchBar) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTableWidgetHasSearchBar) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTableWidgetHasSearchBar initializes the struct as if Set has been called. -func NewNullableTableWidgetHasSearchBar(val *TableWidgetHasSearchBar) *NullableTableWidgetHasSearchBar { - return &NullableTableWidgetHasSearchBar{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTableWidgetHasSearchBar) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTableWidgetHasSearchBar) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_table_widget_request.go b/api/v1/datadog/model_table_widget_request.go deleted file mode 100644 index b6acfa74a38..00000000000 --- a/api/v1/datadog/model_table_widget_request.go +++ /dev/null @@ -1,891 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// TableWidgetRequest Updated table widget. -type TableWidgetRequest struct { - // Aggregator used for the request. - Aggregator *WidgetAggregator `json:"aggregator,omitempty"` - // The column name (defaults to the metric name). - Alias *string `json:"alias,omitempty"` - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The APM stats query for table and distributions widgets. - ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` - // A list of display modes for each table cell. - CellDisplayMode []TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` - // List of conditional formats. - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // For metric queries, the number of lines to show in the table. Only one request should have this property. - Limit *int64 `json:"limit,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // Widget sorting methods. - Order *WidgetSort `json:"order,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Query definition. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,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{} -} - -// NewTableWidgetRequest instantiates a new TableWidgetRequest 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 NewTableWidgetRequest() *TableWidgetRequest { - this := TableWidgetRequest{} - return &this -} - -// NewTableWidgetRequestWithDefaults instantiates a new TableWidgetRequest 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 NewTableWidgetRequestWithDefaults() *TableWidgetRequest { - this := TableWidgetRequest{} - return &this -} - -// GetAggregator returns the Aggregator field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetAggregator() WidgetAggregator { - if o == nil || o.Aggregator == nil { - var ret WidgetAggregator - return ret - } - return *o.Aggregator -} - -// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetAggregatorOk() (*WidgetAggregator, bool) { - if o == nil || o.Aggregator == nil { - return nil, false - } - return o.Aggregator, true -} - -// HasAggregator returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasAggregator() bool { - if o != nil && o.Aggregator != nil { - return true - } - - return false -} - -// SetAggregator gets a reference to the given WidgetAggregator and assigns it to the Aggregator field. -func (o *TableWidgetRequest) SetAggregator(v WidgetAggregator) { - o.Aggregator = &v -} - -// GetAlias returns the Alias field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetAlias() string { - if o == nil || o.Alias == nil { - var ret string - return ret - } - return *o.Alias -} - -// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetAliasOk() (*string, bool) { - if o == nil || o.Alias == nil { - return nil, false - } - return o.Alias, true -} - -// HasAlias returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasAlias() bool { - if o != nil && o.Alias != nil { - return true - } - - return false -} - -// SetAlias gets a reference to the given string and assigns it to the Alias field. -func (o *TableWidgetRequest) SetAlias(v string) { - o.Alias = &v -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *TableWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetApmStatsQuery returns the ApmStatsQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetApmStatsQuery() ApmStatsQueryDefinition { - if o == nil || o.ApmStatsQuery == nil { - var ret ApmStatsQueryDefinition - return ret - } - return *o.ApmStatsQuery -} - -// GetApmStatsQueryOk returns a tuple with the ApmStatsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetApmStatsQueryOk() (*ApmStatsQueryDefinition, bool) { - if o == nil || o.ApmStatsQuery == nil { - return nil, false - } - return o.ApmStatsQuery, true -} - -// HasApmStatsQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasApmStatsQuery() bool { - if o != nil && o.ApmStatsQuery != nil { - return true - } - - return false -} - -// SetApmStatsQuery gets a reference to the given ApmStatsQueryDefinition and assigns it to the ApmStatsQuery field. -func (o *TableWidgetRequest) SetApmStatsQuery(v ApmStatsQueryDefinition) { - o.ApmStatsQuery = &v -} - -// GetCellDisplayMode returns the CellDisplayMode field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetCellDisplayMode() []TableWidgetCellDisplayMode { - if o == nil || o.CellDisplayMode == nil { - var ret []TableWidgetCellDisplayMode - return ret - } - return o.CellDisplayMode -} - -// GetCellDisplayModeOk returns a tuple with the CellDisplayMode field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetCellDisplayModeOk() (*[]TableWidgetCellDisplayMode, bool) { - if o == nil || o.CellDisplayMode == nil { - return nil, false - } - return &o.CellDisplayMode, true -} - -// HasCellDisplayMode returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasCellDisplayMode() bool { - if o != nil && o.CellDisplayMode != nil { - return true - } - - return false -} - -// SetCellDisplayMode gets a reference to the given []TableWidgetCellDisplayMode and assigns it to the CellDisplayMode field. -func (o *TableWidgetRequest) SetCellDisplayMode(v []TableWidgetCellDisplayMode) { - o.CellDisplayMode = v -} - -// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetConditionalFormats() []WidgetConditionalFormat { - if o == nil || o.ConditionalFormats == nil { - var ret []WidgetConditionalFormat - return ret - } - return o.ConditionalFormats -} - -// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { - if o == nil || o.ConditionalFormats == nil { - return nil, false - } - return &o.ConditionalFormats, true -} - -// HasConditionalFormats returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasConditionalFormats() bool { - if o != nil && o.ConditionalFormats != nil { - return true - } - - return false -} - -// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. -func (o *TableWidgetRequest) SetConditionalFormats(v []WidgetConditionalFormat) { - o.ConditionalFormats = v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *TableWidgetRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *TableWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *TableWidgetRequest) SetLimit(v int64) { - o.Limit = &v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *TableWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *TableWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetOrder returns the Order field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetOrder() WidgetSort { - if o == nil || o.Order == nil { - var ret WidgetSort - return ret - } - return *o.Order -} - -// GetOrderOk returns a tuple with the Order field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetOrderOk() (*WidgetSort, bool) { - if o == nil || o.Order == nil { - return nil, false - } - return o.Order, true -} - -// HasOrder returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasOrder() bool { - if o != nil && o.Order != nil { - return true - } - - return false -} - -// SetOrder gets a reference to the given WidgetSort and assigns it to the Order field. -func (o *TableWidgetRequest) SetOrder(v WidgetSort) { - o.Order = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *TableWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *TableWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *TableWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *TableWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *TableWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *TableWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *TableWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TableWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *TableWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *TableWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TableWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregator != nil { - toSerialize["aggregator"] = o.Aggregator - } - if o.Alias != nil { - toSerialize["alias"] = o.Alias - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.ApmStatsQuery != nil { - toSerialize["apm_stats_query"] = o.ApmStatsQuery - } - if o.CellDisplayMode != nil { - toSerialize["cell_display_mode"] = o.CellDisplayMode - } - if o.ConditionalFormats != nil { - toSerialize["conditional_formats"] = o.ConditionalFormats - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.Order != nil { - toSerialize["order"] = o.Order - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TableWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregator *WidgetAggregator `json:"aggregator,omitempty"` - Alias *string `json:"alias,omitempty"` - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` - CellDisplayMode []TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - Formulas []WidgetFormula `json:"formulas,omitempty"` - Limit *int64 `json:"limit,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - Order *WidgetSort `json:"order,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregator; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregator = all.Aggregator - o.Alias = all.Alias - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.ApmStatsQuery != nil && all.ApmStatsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmStatsQuery = all.ApmStatsQuery - o.CellDisplayMode = all.CellDisplayMode - o.ConditionalFormats = all.ConditionalFormats - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - o.Formulas = all.Formulas - o.Limit = all.Limit - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - o.Order = all.Order - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - return nil -} diff --git a/api/v1/datadog/model_tag_to_hosts.go b/api/v1/datadog/model_tag_to_hosts.go deleted file mode 100644 index 3040532d7c1..00000000000 --- a/api/v1/datadog/model_tag_to_hosts.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// TagToHosts In this object, the key is the tag, the value is a list of host names that are reporting that tag. -type TagToHosts struct { - // A list of tags to apply to the host. - 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{} -} - -// NewTagToHosts instantiates a new TagToHosts 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 NewTagToHosts() *TagToHosts { - this := TagToHosts{} - return &this -} - -// NewTagToHostsWithDefaults instantiates a new TagToHosts 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 NewTagToHostsWithDefaults() *TagToHosts { - this := TagToHosts{} - return &this -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *TagToHosts) 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 *TagToHosts) 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 *TagToHosts) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. -func (o *TagToHosts) SetTags(v map[string][]string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TagToHosts) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TagToHosts) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Tags map[string][]string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Tags = all.Tags - return nil -} diff --git a/api/v1/datadog/model_target_format_type.go b/api/v1/datadog/model_target_format_type.go deleted file mode 100644 index 5bdec101ffc..00000000000 --- a/api/v1/datadog/model_target_format_type.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TargetFormatType If the `target_type` of the remapper is `attribute`, try to cast the value to a new specific type. -// If the cast is not possible, the original type is kept. `string`, `integer`, or `double` are the possible types. -// If the `target_type` is `tag`, this parameter may not be specified. -type TargetFormatType string - -// List of TargetFormatType. -const ( - TARGETFORMATTYPE_AUTO TargetFormatType = "auto" - TARGETFORMATTYPE_STRING TargetFormatType = "string" - TARGETFORMATTYPE_INTEGER TargetFormatType = "integer" - TARGETFORMATTYPE_DOUBLE TargetFormatType = "double" -) - -var allowedTargetFormatTypeEnumValues = []TargetFormatType{ - TARGETFORMATTYPE_AUTO, - TARGETFORMATTYPE_STRING, - TARGETFORMATTYPE_INTEGER, - TARGETFORMATTYPE_DOUBLE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TargetFormatType) GetAllowedValues() []TargetFormatType { - return allowedTargetFormatTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TargetFormatType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TargetFormatType(value) - return nil -} - -// NewTargetFormatTypeFromValue returns a pointer to a valid TargetFormatType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTargetFormatTypeFromValue(v string) (*TargetFormatType, error) { - ev := TargetFormatType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TargetFormatType: valid values are %v", v, allowedTargetFormatTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TargetFormatType) IsValid() bool { - for _, existing := range allowedTargetFormatTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TargetFormatType value. -func (v TargetFormatType) Ptr() *TargetFormatType { - return &v -} - -// NullableTargetFormatType handles when a null is used for TargetFormatType. -type NullableTargetFormatType struct { - value *TargetFormatType - isSet bool -} - -// Get returns the associated value. -func (v NullableTargetFormatType) Get() *TargetFormatType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTargetFormatType) Set(val *TargetFormatType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTargetFormatType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTargetFormatType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTargetFormatType initializes the struct as if Set has been called. -func NewNullableTargetFormatType(val *TargetFormatType) *NullableTargetFormatType { - return &NullableTargetFormatType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTargetFormatType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTargetFormatType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_timeseries_background.go b/api/v1/datadog/model_timeseries_background.go deleted file mode 100644 index b6625993944..00000000000 --- a/api/v1/datadog/model_timeseries_background.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TimeseriesBackground Set a timeseries on the widget background. -type TimeseriesBackground struct { - // Timeseries is made using an area or bars. - Type TimeseriesBackgroundType `json:"type"` - // Axis controls for the widget. - Yaxis *WidgetAxis `json:"yaxis,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{} -} - -// NewTimeseriesBackground instantiates a new TimeseriesBackground 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 NewTimeseriesBackground(typeVar TimeseriesBackgroundType) *TimeseriesBackground { - this := TimeseriesBackground{} - this.Type = typeVar - return &this -} - -// NewTimeseriesBackgroundWithDefaults instantiates a new TimeseriesBackground 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 NewTimeseriesBackgroundWithDefaults() *TimeseriesBackground { - this := TimeseriesBackground{} - var typeVar TimeseriesBackgroundType = TIMESERIESBACKGROUNDTYPE_AREA - this.Type = typeVar - return &this -} - -// GetType returns the Type field value. -func (o *TimeseriesBackground) GetType() TimeseriesBackgroundType { - if o == nil { - var ret TimeseriesBackgroundType - 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 *TimeseriesBackground) GetTypeOk() (*TimeseriesBackgroundType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *TimeseriesBackground) SetType(v TimeseriesBackgroundType) { - o.Type = v -} - -// GetYaxis returns the Yaxis field value if set, zero value otherwise. -func (o *TimeseriesBackground) GetYaxis() WidgetAxis { - if o == nil || o.Yaxis == nil { - var ret WidgetAxis - return ret - } - return *o.Yaxis -} - -// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesBackground) GetYaxisOk() (*WidgetAxis, bool) { - if o == nil || o.Yaxis == nil { - return nil, false - } - return o.Yaxis, true -} - -// HasYaxis returns a boolean if a field has been set. -func (o *TimeseriesBackground) HasYaxis() bool { - if o != nil && o.Yaxis != nil { - return true - } - - return false -} - -// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. -func (o *TimeseriesBackground) SetYaxis(v WidgetAxis) { - o.Yaxis = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TimeseriesBackground) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["type"] = o.Type - if o.Yaxis != nil { - toSerialize["yaxis"] = o.Yaxis - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TimeseriesBackground) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *TimeseriesBackgroundType `json:"type"` - }{} - all := struct { - Type TimeseriesBackgroundType `json:"type"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Yaxis = all.Yaxis - return nil -} diff --git a/api/v1/datadog/model_timeseries_background_type.go b/api/v1/datadog/model_timeseries_background_type.go deleted file mode 100644 index 627d10ac0a6..00000000000 --- a/api/v1/datadog/model_timeseries_background_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TimeseriesBackgroundType Timeseries is made using an area or bars. -type TimeseriesBackgroundType string - -// List of TimeseriesBackgroundType. -const ( - TIMESERIESBACKGROUNDTYPE_BARS TimeseriesBackgroundType = "bars" - TIMESERIESBACKGROUNDTYPE_AREA TimeseriesBackgroundType = "area" -) - -var allowedTimeseriesBackgroundTypeEnumValues = []TimeseriesBackgroundType{ - TIMESERIESBACKGROUNDTYPE_BARS, - TIMESERIESBACKGROUNDTYPE_AREA, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TimeseriesBackgroundType) GetAllowedValues() []TimeseriesBackgroundType { - return allowedTimeseriesBackgroundTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TimeseriesBackgroundType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TimeseriesBackgroundType(value) - return nil -} - -// NewTimeseriesBackgroundTypeFromValue returns a pointer to a valid TimeseriesBackgroundType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTimeseriesBackgroundTypeFromValue(v string) (*TimeseriesBackgroundType, error) { - ev := TimeseriesBackgroundType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TimeseriesBackgroundType: valid values are %v", v, allowedTimeseriesBackgroundTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TimeseriesBackgroundType) IsValid() bool { - for _, existing := range allowedTimeseriesBackgroundTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TimeseriesBackgroundType value. -func (v TimeseriesBackgroundType) Ptr() *TimeseriesBackgroundType { - return &v -} - -// NullableTimeseriesBackgroundType handles when a null is used for TimeseriesBackgroundType. -type NullableTimeseriesBackgroundType struct { - value *TimeseriesBackgroundType - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesBackgroundType) Get() *TimeseriesBackgroundType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesBackgroundType) Set(val *TimeseriesBackgroundType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesBackgroundType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesBackgroundType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesBackgroundType initializes the struct as if Set has been called. -func NewNullableTimeseriesBackgroundType(val *TimeseriesBackgroundType) *NullableTimeseriesBackgroundType { - return &NullableTimeseriesBackgroundType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesBackgroundType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesBackgroundType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_timeseries_widget_definition.go b/api/v1/datadog/model_timeseries_widget_definition.go deleted file mode 100644 index 6ec08d46b6c..00000000000 --- a/api/v1/datadog/model_timeseries_widget_definition.go +++ /dev/null @@ -1,690 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TimeseriesWidgetDefinition The timeseries visualization allows you to display the evolution of one or more metrics, log events, or Indexed Spans over time. -type TimeseriesWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // List of widget events. - Events []WidgetEvent `json:"events,omitempty"` - // Columns displayed in the legend. - LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"` - // Layout of the legend. - LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"` - // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". - LegendSize *string `json:"legend_size,omitempty"` - // List of markers. - Markers []WidgetMarker `json:"markers,omitempty"` - // List of timeseries widget requests. - Requests []TimeseriesWidgetRequest `json:"requests"` - // Axis controls for the widget. - RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"` - // (screenboard only) Show the legend for this widget. - ShowLegend *bool `json:"show_legend,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the timeseries widget. - Type TimeseriesWidgetDefinitionType `json:"type"` - // Axis controls for the widget. - Yaxis *WidgetAxis `json:"yaxis,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{} -} - -// NewTimeseriesWidgetDefinition instantiates a new TimeseriesWidgetDefinition 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 NewTimeseriesWidgetDefinition(requests []TimeseriesWidgetRequest, typeVar TimeseriesWidgetDefinitionType) *TimeseriesWidgetDefinition { - this := TimeseriesWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewTimeseriesWidgetDefinitionWithDefaults instantiates a new TimeseriesWidgetDefinition 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 NewTimeseriesWidgetDefinitionWithDefaults() *TimeseriesWidgetDefinition { - this := TimeseriesWidgetDefinition{} - var typeVar TimeseriesWidgetDefinitionType = TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *TimeseriesWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetEvents returns the Events field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetEvents() []WidgetEvent { - if o == nil || o.Events == nil { - var ret []WidgetEvent - return ret - } - return o.Events -} - -// GetEventsOk returns a tuple with the Events field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetEventsOk() (*[]WidgetEvent, bool) { - if o == nil || o.Events == nil { - return nil, false - } - return &o.Events, true -} - -// HasEvents returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasEvents() bool { - if o != nil && o.Events != nil { - return true - } - - return false -} - -// SetEvents gets a reference to the given []WidgetEvent and assigns it to the Events field. -func (o *TimeseriesWidgetDefinition) SetEvents(v []WidgetEvent) { - o.Events = v -} - -// GetLegendColumns returns the LegendColumns field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetLegendColumns() []TimeseriesWidgetLegendColumn { - if o == nil || o.LegendColumns == nil { - var ret []TimeseriesWidgetLegendColumn - return ret - } - return o.LegendColumns -} - -// GetLegendColumnsOk returns a tuple with the LegendColumns field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetLegendColumnsOk() (*[]TimeseriesWidgetLegendColumn, bool) { - if o == nil || o.LegendColumns == nil { - return nil, false - } - return &o.LegendColumns, true -} - -// HasLegendColumns returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasLegendColumns() bool { - if o != nil && o.LegendColumns != nil { - return true - } - - return false -} - -// SetLegendColumns gets a reference to the given []TimeseriesWidgetLegendColumn and assigns it to the LegendColumns field. -func (o *TimeseriesWidgetDefinition) SetLegendColumns(v []TimeseriesWidgetLegendColumn) { - o.LegendColumns = v -} - -// GetLegendLayout returns the LegendLayout field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetLegendLayout() TimeseriesWidgetLegendLayout { - if o == nil || o.LegendLayout == nil { - var ret TimeseriesWidgetLegendLayout - return ret - } - return *o.LegendLayout -} - -// GetLegendLayoutOk returns a tuple with the LegendLayout field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetLegendLayoutOk() (*TimeseriesWidgetLegendLayout, bool) { - if o == nil || o.LegendLayout == nil { - return nil, false - } - return o.LegendLayout, true -} - -// HasLegendLayout returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasLegendLayout() bool { - if o != nil && o.LegendLayout != nil { - return true - } - - return false -} - -// SetLegendLayout gets a reference to the given TimeseriesWidgetLegendLayout and assigns it to the LegendLayout field. -func (o *TimeseriesWidgetDefinition) SetLegendLayout(v TimeseriesWidgetLegendLayout) { - o.LegendLayout = &v -} - -// GetLegendSize returns the LegendSize field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetLegendSize() string { - if o == nil || o.LegendSize == nil { - var ret string - return ret - } - return *o.LegendSize -} - -// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetLegendSizeOk() (*string, bool) { - if o == nil || o.LegendSize == nil { - return nil, false - } - return o.LegendSize, true -} - -// HasLegendSize returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasLegendSize() bool { - if o != nil && o.LegendSize != nil { - return true - } - - return false -} - -// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. -func (o *TimeseriesWidgetDefinition) SetLegendSize(v string) { - o.LegendSize = &v -} - -// GetMarkers returns the Markers field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetMarkers() []WidgetMarker { - if o == nil || o.Markers == nil { - var ret []WidgetMarker - return ret - } - return o.Markers -} - -// GetMarkersOk returns a tuple with the Markers field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetMarkersOk() (*[]WidgetMarker, bool) { - if o == nil || o.Markers == nil { - return nil, false - } - return &o.Markers, true -} - -// HasMarkers returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasMarkers() bool { - if o != nil && o.Markers != nil { - return true - } - - return false -} - -// SetMarkers gets a reference to the given []WidgetMarker and assigns it to the Markers field. -func (o *TimeseriesWidgetDefinition) SetMarkers(v []WidgetMarker) { - o.Markers = v -} - -// GetRequests returns the Requests field value. -func (o *TimeseriesWidgetDefinition) GetRequests() []TimeseriesWidgetRequest { - if o == nil { - var ret []TimeseriesWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetRequestsOk() (*[]TimeseriesWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *TimeseriesWidgetDefinition) SetRequests(v []TimeseriesWidgetRequest) { - o.Requests = v -} - -// GetRightYaxis returns the RightYaxis field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetRightYaxis() WidgetAxis { - if o == nil || o.RightYaxis == nil { - var ret WidgetAxis - return ret - } - return *o.RightYaxis -} - -// GetRightYaxisOk returns a tuple with the RightYaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetRightYaxisOk() (*WidgetAxis, bool) { - if o == nil || o.RightYaxis == nil { - return nil, false - } - return o.RightYaxis, true -} - -// HasRightYaxis returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasRightYaxis() bool { - if o != nil && o.RightYaxis != nil { - return true - } - - return false -} - -// SetRightYaxis gets a reference to the given WidgetAxis and assigns it to the RightYaxis field. -func (o *TimeseriesWidgetDefinition) SetRightYaxis(v WidgetAxis) { - o.RightYaxis = &v -} - -// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetShowLegend() bool { - if o == nil || o.ShowLegend == nil { - var ret bool - return ret - } - return *o.ShowLegend -} - -// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetShowLegendOk() (*bool, bool) { - if o == nil || o.ShowLegend == nil { - return nil, false - } - return o.ShowLegend, true -} - -// HasShowLegend returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasShowLegend() bool { - if o != nil && o.ShowLegend != nil { - return true - } - - return false -} - -// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. -func (o *TimeseriesWidgetDefinition) SetShowLegend(v bool) { - o.ShowLegend = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *TimeseriesWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *TimeseriesWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *TimeseriesWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *TimeseriesWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *TimeseriesWidgetDefinition) GetType() TimeseriesWidgetDefinitionType { - if o == nil { - var ret TimeseriesWidgetDefinitionType - 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 *TimeseriesWidgetDefinition) GetTypeOk() (*TimeseriesWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *TimeseriesWidgetDefinition) SetType(v TimeseriesWidgetDefinitionType) { - o.Type = v -} - -// GetYaxis returns the Yaxis field value if set, zero value otherwise. -func (o *TimeseriesWidgetDefinition) GetYaxis() WidgetAxis { - if o == nil || o.Yaxis == nil { - var ret WidgetAxis - return ret - } - return *o.Yaxis -} - -// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetDefinition) GetYaxisOk() (*WidgetAxis, bool) { - if o == nil || o.Yaxis == nil { - return nil, false - } - return o.Yaxis, true -} - -// HasYaxis returns a boolean if a field has been set. -func (o *TimeseriesWidgetDefinition) HasYaxis() bool { - if o != nil && o.Yaxis != nil { - return true - } - - return false -} - -// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. -func (o *TimeseriesWidgetDefinition) SetYaxis(v WidgetAxis) { - o.Yaxis = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TimeseriesWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - if o.Events != nil { - toSerialize["events"] = o.Events - } - if o.LegendColumns != nil { - toSerialize["legend_columns"] = o.LegendColumns - } - if o.LegendLayout != nil { - toSerialize["legend_layout"] = o.LegendLayout - } - if o.LegendSize != nil { - toSerialize["legend_size"] = o.LegendSize - } - if o.Markers != nil { - toSerialize["markers"] = o.Markers - } - toSerialize["requests"] = o.Requests - if o.RightYaxis != nil { - toSerialize["right_yaxis"] = o.RightYaxis - } - if o.ShowLegend != nil { - toSerialize["show_legend"] = o.ShowLegend - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - if o.Yaxis != nil { - toSerialize["yaxis"] = o.Yaxis - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]TimeseriesWidgetRequest `json:"requests"` - Type *TimeseriesWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Events []WidgetEvent `json:"events,omitempty"` - LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"` - LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"` - LegendSize *string `json:"legend_size,omitempty"` - Markers []WidgetMarker `json:"markers,omitempty"` - Requests []TimeseriesWidgetRequest `json:"requests"` - RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type TimeseriesWidgetDefinitionType `json:"type"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LegendLayout; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.Events = all.Events - o.LegendColumns = all.LegendColumns - o.LegendLayout = all.LegendLayout - o.LegendSize = all.LegendSize - o.Markers = all.Markers - o.Requests = all.Requests - if all.RightYaxis != nil && all.RightYaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RightYaxis = all.RightYaxis - o.ShowLegend = all.ShowLegend - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Yaxis = all.Yaxis - return nil -} diff --git a/api/v1/datadog/model_timeseries_widget_definition_type.go b/api/v1/datadog/model_timeseries_widget_definition_type.go deleted file mode 100644 index 312f7b681ad..00000000000 --- a/api/v1/datadog/model_timeseries_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TimeseriesWidgetDefinitionType Type of the timeseries widget. -type TimeseriesWidgetDefinitionType string - -// List of TimeseriesWidgetDefinitionType. -const ( - TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES TimeseriesWidgetDefinitionType = "timeseries" -) - -var allowedTimeseriesWidgetDefinitionTypeEnumValues = []TimeseriesWidgetDefinitionType{ - TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TimeseriesWidgetDefinitionType) GetAllowedValues() []TimeseriesWidgetDefinitionType { - return allowedTimeseriesWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TimeseriesWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TimeseriesWidgetDefinitionType(value) - return nil -} - -// NewTimeseriesWidgetDefinitionTypeFromValue returns a pointer to a valid TimeseriesWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTimeseriesWidgetDefinitionTypeFromValue(v string) (*TimeseriesWidgetDefinitionType, error) { - ev := TimeseriesWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TimeseriesWidgetDefinitionType: valid values are %v", v, allowedTimeseriesWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TimeseriesWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedTimeseriesWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TimeseriesWidgetDefinitionType value. -func (v TimeseriesWidgetDefinitionType) Ptr() *TimeseriesWidgetDefinitionType { - return &v -} - -// NullableTimeseriesWidgetDefinitionType handles when a null is used for TimeseriesWidgetDefinitionType. -type NullableTimeseriesWidgetDefinitionType struct { - value *TimeseriesWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesWidgetDefinitionType) Get() *TimeseriesWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesWidgetDefinitionType) Set(val *TimeseriesWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableTimeseriesWidgetDefinitionType(val *TimeseriesWidgetDefinitionType) *NullableTimeseriesWidgetDefinitionType { - return &NullableTimeseriesWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_timeseries_widget_expression_alias.go b/api/v1/datadog/model_timeseries_widget_expression_alias.go deleted file mode 100644 index fdaae03f7b6..00000000000 --- a/api/v1/datadog/model_timeseries_widget_expression_alias.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TimeseriesWidgetExpressionAlias Define an expression alias. -type TimeseriesWidgetExpressionAlias struct { - // Expression alias. - AliasName *string `json:"alias_name,omitempty"` - // Expression name. - Expression string `json:"expression"` - // 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{} -} - -// NewTimeseriesWidgetExpressionAlias instantiates a new TimeseriesWidgetExpressionAlias 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 NewTimeseriesWidgetExpressionAlias(expression string) *TimeseriesWidgetExpressionAlias { - this := TimeseriesWidgetExpressionAlias{} - this.Expression = expression - return &this -} - -// NewTimeseriesWidgetExpressionAliasWithDefaults instantiates a new TimeseriesWidgetExpressionAlias 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 NewTimeseriesWidgetExpressionAliasWithDefaults() *TimeseriesWidgetExpressionAlias { - this := TimeseriesWidgetExpressionAlias{} - return &this -} - -// GetAliasName returns the AliasName field value if set, zero value otherwise. -func (o *TimeseriesWidgetExpressionAlias) GetAliasName() string { - if o == nil || o.AliasName == nil { - var ret string - return ret - } - return *o.AliasName -} - -// GetAliasNameOk returns a tuple with the AliasName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetExpressionAlias) GetAliasNameOk() (*string, bool) { - if o == nil || o.AliasName == nil { - return nil, false - } - return o.AliasName, true -} - -// HasAliasName returns a boolean if a field has been set. -func (o *TimeseriesWidgetExpressionAlias) HasAliasName() bool { - if o != nil && o.AliasName != nil { - return true - } - - return false -} - -// SetAliasName gets a reference to the given string and assigns it to the AliasName field. -func (o *TimeseriesWidgetExpressionAlias) SetAliasName(v string) { - o.AliasName = &v -} - -// GetExpression returns the Expression field value. -func (o *TimeseriesWidgetExpressionAlias) GetExpression() string { - if o == nil { - var ret string - return ret - } - return o.Expression -} - -// GetExpressionOk returns a tuple with the Expression field value -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetExpressionAlias) GetExpressionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Expression, true -} - -// SetExpression sets field value. -func (o *TimeseriesWidgetExpressionAlias) SetExpression(v string) { - o.Expression = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TimeseriesWidgetExpressionAlias) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AliasName != nil { - toSerialize["alias_name"] = o.AliasName - } - toSerialize["expression"] = o.Expression - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TimeseriesWidgetExpressionAlias) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Expression *string `json:"expression"` - }{} - all := struct { - AliasName *string `json:"alias_name,omitempty"` - Expression string `json:"expression"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Expression == nil { - return fmt.Errorf("Required field expression missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AliasName = all.AliasName - o.Expression = all.Expression - return nil -} diff --git a/api/v1/datadog/model_timeseries_widget_legend_column.go b/api/v1/datadog/model_timeseries_widget_legend_column.go deleted file mode 100644 index 104dd11c44f..00000000000 --- a/api/v1/datadog/model_timeseries_widget_legend_column.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TimeseriesWidgetLegendColumn Legend column. -type TimeseriesWidgetLegendColumn string - -// List of TimeseriesWidgetLegendColumn. -const ( - TIMESERIESWIDGETLEGENDCOLUMN_VALUE TimeseriesWidgetLegendColumn = "value" - TIMESERIESWIDGETLEGENDCOLUMN_AVG TimeseriesWidgetLegendColumn = "avg" - TIMESERIESWIDGETLEGENDCOLUMN_SUM TimeseriesWidgetLegendColumn = "sum" - TIMESERIESWIDGETLEGENDCOLUMN_MIN TimeseriesWidgetLegendColumn = "min" - TIMESERIESWIDGETLEGENDCOLUMN_MAX TimeseriesWidgetLegendColumn = "max" -) - -var allowedTimeseriesWidgetLegendColumnEnumValues = []TimeseriesWidgetLegendColumn{ - TIMESERIESWIDGETLEGENDCOLUMN_VALUE, - TIMESERIESWIDGETLEGENDCOLUMN_AVG, - TIMESERIESWIDGETLEGENDCOLUMN_SUM, - TIMESERIESWIDGETLEGENDCOLUMN_MIN, - TIMESERIESWIDGETLEGENDCOLUMN_MAX, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TimeseriesWidgetLegendColumn) GetAllowedValues() []TimeseriesWidgetLegendColumn { - return allowedTimeseriesWidgetLegendColumnEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TimeseriesWidgetLegendColumn) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TimeseriesWidgetLegendColumn(value) - return nil -} - -// NewTimeseriesWidgetLegendColumnFromValue returns a pointer to a valid TimeseriesWidgetLegendColumn -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTimeseriesWidgetLegendColumnFromValue(v string) (*TimeseriesWidgetLegendColumn, error) { - ev := TimeseriesWidgetLegendColumn(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TimeseriesWidgetLegendColumn: valid values are %v", v, allowedTimeseriesWidgetLegendColumnEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TimeseriesWidgetLegendColumn) IsValid() bool { - for _, existing := range allowedTimeseriesWidgetLegendColumnEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TimeseriesWidgetLegendColumn value. -func (v TimeseriesWidgetLegendColumn) Ptr() *TimeseriesWidgetLegendColumn { - return &v -} - -// NullableTimeseriesWidgetLegendColumn handles when a null is used for TimeseriesWidgetLegendColumn. -type NullableTimeseriesWidgetLegendColumn struct { - value *TimeseriesWidgetLegendColumn - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesWidgetLegendColumn) Get() *TimeseriesWidgetLegendColumn { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesWidgetLegendColumn) Set(val *TimeseriesWidgetLegendColumn) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesWidgetLegendColumn) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesWidgetLegendColumn) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesWidgetLegendColumn initializes the struct as if Set has been called. -func NewNullableTimeseriesWidgetLegendColumn(val *TimeseriesWidgetLegendColumn) *NullableTimeseriesWidgetLegendColumn { - return &NullableTimeseriesWidgetLegendColumn{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesWidgetLegendColumn) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesWidgetLegendColumn) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_timeseries_widget_legend_layout.go b/api/v1/datadog/model_timeseries_widget_legend_layout.go deleted file mode 100644 index 0fca079a9f2..00000000000 --- a/api/v1/datadog/model_timeseries_widget_legend_layout.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TimeseriesWidgetLegendLayout Layout of the legend. -type TimeseriesWidgetLegendLayout string - -// List of TimeseriesWidgetLegendLayout. -const ( - TIMESERIESWIDGETLEGENDLAYOUT_AUTO TimeseriesWidgetLegendLayout = "auto" - TIMESERIESWIDGETLEGENDLAYOUT_HORIZONTAL TimeseriesWidgetLegendLayout = "horizontal" - TIMESERIESWIDGETLEGENDLAYOUT_VERTICAL TimeseriesWidgetLegendLayout = "vertical" -) - -var allowedTimeseriesWidgetLegendLayoutEnumValues = []TimeseriesWidgetLegendLayout{ - TIMESERIESWIDGETLEGENDLAYOUT_AUTO, - TIMESERIESWIDGETLEGENDLAYOUT_HORIZONTAL, - TIMESERIESWIDGETLEGENDLAYOUT_VERTICAL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TimeseriesWidgetLegendLayout) GetAllowedValues() []TimeseriesWidgetLegendLayout { - return allowedTimeseriesWidgetLegendLayoutEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TimeseriesWidgetLegendLayout) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TimeseriesWidgetLegendLayout(value) - return nil -} - -// NewTimeseriesWidgetLegendLayoutFromValue returns a pointer to a valid TimeseriesWidgetLegendLayout -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTimeseriesWidgetLegendLayoutFromValue(v string) (*TimeseriesWidgetLegendLayout, error) { - ev := TimeseriesWidgetLegendLayout(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TimeseriesWidgetLegendLayout: valid values are %v", v, allowedTimeseriesWidgetLegendLayoutEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TimeseriesWidgetLegendLayout) IsValid() bool { - for _, existing := range allowedTimeseriesWidgetLegendLayoutEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TimeseriesWidgetLegendLayout value. -func (v TimeseriesWidgetLegendLayout) Ptr() *TimeseriesWidgetLegendLayout { - return &v -} - -// NullableTimeseriesWidgetLegendLayout handles when a null is used for TimeseriesWidgetLegendLayout. -type NullableTimeseriesWidgetLegendLayout struct { - value *TimeseriesWidgetLegendLayout - isSet bool -} - -// Get returns the associated value. -func (v NullableTimeseriesWidgetLegendLayout) Get() *TimeseriesWidgetLegendLayout { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTimeseriesWidgetLegendLayout) Set(val *TimeseriesWidgetLegendLayout) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTimeseriesWidgetLegendLayout) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTimeseriesWidgetLegendLayout) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTimeseriesWidgetLegendLayout initializes the struct as if Set has been called. -func NewNullableTimeseriesWidgetLegendLayout(val *TimeseriesWidgetLegendLayout) *NullableTimeseriesWidgetLegendLayout { - return &NullableTimeseriesWidgetLegendLayout{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTimeseriesWidgetLegendLayout) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTimeseriesWidgetLegendLayout) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_timeseries_widget_request.go b/api/v1/datadog/model_timeseries_widget_request.go deleted file mode 100644 index 5ab9ef19e01..00000000000 --- a/api/v1/datadog/model_timeseries_widget_request.go +++ /dev/null @@ -1,812 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// TimeseriesWidgetRequest Updated timeseries widget. -type TimeseriesWidgetRequest struct { - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The log query. - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - // Type of display to use for the request. - DisplayType *WidgetDisplayType `json:"display_type,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // Used to define expression aliases. - Metadata []TimeseriesWidgetExpressionAlias `json:"metadata,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // Whether or not to display a second y-axis on the right. - OnRightYaxis *bool `json:"on_right_yaxis,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Widget query. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - // Define request widget style. - Style *WidgetRequestStyle `json:"style,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{} -} - -// NewTimeseriesWidgetRequest instantiates a new TimeseriesWidgetRequest 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 NewTimeseriesWidgetRequest() *TimeseriesWidgetRequest { - this := TimeseriesWidgetRequest{} - return &this -} - -// NewTimeseriesWidgetRequestWithDefaults instantiates a new TimeseriesWidgetRequest 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 NewTimeseriesWidgetRequestWithDefaults() *TimeseriesWidgetRequest { - this := TimeseriesWidgetRequest{} - return &this -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *TimeseriesWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetAuditQuery() LogQueryDefinition { - if o == nil || o.AuditQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.AuditQuery -} - -// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.AuditQuery == nil { - return nil, false - } - return o.AuditQuery, true -} - -// HasAuditQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasAuditQuery() bool { - if o != nil && o.AuditQuery != nil { - return true - } - - return false -} - -// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. -func (o *TimeseriesWidgetRequest) SetAuditQuery(v LogQueryDefinition) { - o.AuditQuery = &v -} - -// GetDisplayType returns the DisplayType field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetDisplayType() WidgetDisplayType { - if o == nil || o.DisplayType == nil { - var ret WidgetDisplayType - return ret - } - return *o.DisplayType -} - -// GetDisplayTypeOk returns a tuple with the DisplayType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetDisplayTypeOk() (*WidgetDisplayType, bool) { - if o == nil || o.DisplayType == nil { - return nil, false - } - return o.DisplayType, true -} - -// HasDisplayType returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasDisplayType() bool { - if o != nil && o.DisplayType != nil { - return true - } - - return false -} - -// SetDisplayType gets a reference to the given WidgetDisplayType and assigns it to the DisplayType field. -func (o *TimeseriesWidgetRequest) SetDisplayType(v WidgetDisplayType) { - o.DisplayType = &v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *TimeseriesWidgetRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *TimeseriesWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *TimeseriesWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetMetadata() []TimeseriesWidgetExpressionAlias { - if o == nil || o.Metadata == nil { - var ret []TimeseriesWidgetExpressionAlias - return ret - } - return o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetMetadataOk() (*[]TimeseriesWidgetExpressionAlias, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return &o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given []TimeseriesWidgetExpressionAlias and assigns it to the Metadata field. -func (o *TimeseriesWidgetRequest) SetMetadata(v []TimeseriesWidgetExpressionAlias) { - o.Metadata = v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *TimeseriesWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetOnRightYaxis returns the OnRightYaxis field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetOnRightYaxis() bool { - if o == nil || o.OnRightYaxis == nil { - var ret bool - return ret - } - return *o.OnRightYaxis -} - -// GetOnRightYaxisOk returns a tuple with the OnRightYaxis field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetOnRightYaxisOk() (*bool, bool) { - if o == nil || o.OnRightYaxis == nil { - return nil, false - } - return o.OnRightYaxis, true -} - -// HasOnRightYaxis returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasOnRightYaxis() bool { - if o != nil && o.OnRightYaxis != nil { - return true - } - - return false -} - -// SetOnRightYaxis gets a reference to the given bool and assigns it to the OnRightYaxis field. -func (o *TimeseriesWidgetRequest) SetOnRightYaxis(v bool) { - o.OnRightYaxis = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *TimeseriesWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *TimeseriesWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *TimeseriesWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *TimeseriesWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *TimeseriesWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *TimeseriesWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *TimeseriesWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// GetStyle returns the Style field value if set, zero value otherwise. -func (o *TimeseriesWidgetRequest) GetStyle() WidgetRequestStyle { - if o == nil || o.Style == nil { - var ret WidgetRequestStyle - return ret - } - return *o.Style -} - -// GetStyleOk returns a tuple with the Style field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeseriesWidgetRequest) GetStyleOk() (*WidgetRequestStyle, bool) { - if o == nil || o.Style == nil { - return nil, false - } - return o.Style, true -} - -// HasStyle returns a boolean if a field has been set. -func (o *TimeseriesWidgetRequest) HasStyle() bool { - if o != nil && o.Style != nil { - return true - } - - return false -} - -// SetStyle gets a reference to the given WidgetRequestStyle and assigns it to the Style field. -func (o *TimeseriesWidgetRequest) SetStyle(v WidgetRequestStyle) { - o.Style = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TimeseriesWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.AuditQuery != nil { - toSerialize["audit_query"] = o.AuditQuery - } - if o.DisplayType != nil { - toSerialize["display_type"] = o.DisplayType - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.OnRightYaxis != nil { - toSerialize["on_right_yaxis"] = o.OnRightYaxis - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - if o.Style != nil { - toSerialize["style"] = o.Style - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - DisplayType *WidgetDisplayType `json:"display_type,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - Formulas []WidgetFormula `json:"formulas,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - Metadata []TimeseriesWidgetExpressionAlias `json:"metadata,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - OnRightYaxis *bool `json:"on_right_yaxis,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - Style *WidgetRequestStyle `json:"style,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DisplayType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.AuditQuery = all.AuditQuery - o.DisplayType = all.DisplayType - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - o.Formulas = all.Formulas - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - o.Metadata = all.Metadata - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - o.OnRightYaxis = all.OnRightYaxis - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Style = all.Style - return nil -} diff --git a/api/v1/datadog/model_toplist_widget_definition.go b/api/v1/datadog/model_toplist_widget_definition.go deleted file mode 100644 index d7bce963817..00000000000 --- a/api/v1/datadog/model_toplist_widget_definition.go +++ /dev/null @@ -1,356 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ToplistWidgetDefinition The top list visualization enables you to display a list of Tag value like hostname or service with the most or least of any metric value, such as highest consumers of CPU, hosts with the least disk space, etc. -type ToplistWidgetDefinition struct { - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // List of top list widget requests. - Requests []ToplistWidgetRequest `json:"requests"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of your widget. - Title *string `json:"title,omitempty"` - // How to align the text on the widget. - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - // Size of the title. - TitleSize *string `json:"title_size,omitempty"` - // Type of the top list widget. - Type ToplistWidgetDefinitionType `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{} -} - -// NewToplistWidgetDefinition instantiates a new ToplistWidgetDefinition 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 NewToplistWidgetDefinition(requests []ToplistWidgetRequest, typeVar ToplistWidgetDefinitionType) *ToplistWidgetDefinition { - this := ToplistWidgetDefinition{} - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewToplistWidgetDefinitionWithDefaults instantiates a new ToplistWidgetDefinition 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 NewToplistWidgetDefinitionWithDefaults() *ToplistWidgetDefinition { - this := ToplistWidgetDefinition{} - var typeVar ToplistWidgetDefinitionType = TOPLISTWIDGETDEFINITIONTYPE_TOPLIST - this.Type = typeVar - return &this -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *ToplistWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *ToplistWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *ToplistWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetRequests returns the Requests field value. -func (o *ToplistWidgetDefinition) GetRequests() []ToplistWidgetRequest { - if o == nil { - var ret []ToplistWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *ToplistWidgetDefinition) GetRequestsOk() (*[]ToplistWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *ToplistWidgetDefinition) SetRequests(v []ToplistWidgetRequest) { - o.Requests = v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *ToplistWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *ToplistWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *ToplistWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *ToplistWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *ToplistWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *ToplistWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. -func (o *ToplistWidgetDefinition) GetTitleAlign() WidgetTextAlign { - if o == nil || o.TitleAlign == nil { - var ret WidgetTextAlign - return ret - } - return *o.TitleAlign -} - -// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { - if o == nil || o.TitleAlign == nil { - return nil, false - } - return o.TitleAlign, true -} - -// HasTitleAlign returns a boolean if a field has been set. -func (o *ToplistWidgetDefinition) HasTitleAlign() bool { - if o != nil && o.TitleAlign != nil { - return true - } - - return false -} - -// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. -func (o *ToplistWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { - o.TitleAlign = &v -} - -// GetTitleSize returns the TitleSize field value if set, zero value otherwise. -func (o *ToplistWidgetDefinition) GetTitleSize() string { - if o == nil || o.TitleSize == nil { - var ret string - return ret - } - return *o.TitleSize -} - -// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetDefinition) GetTitleSizeOk() (*string, bool) { - if o == nil || o.TitleSize == nil { - return nil, false - } - return o.TitleSize, true -} - -// HasTitleSize returns a boolean if a field has been set. -func (o *ToplistWidgetDefinition) HasTitleSize() bool { - if o != nil && o.TitleSize != nil { - return true - } - - return false -} - -// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. -func (o *ToplistWidgetDefinition) SetTitleSize(v string) { - o.TitleSize = &v -} - -// GetType returns the Type field value. -func (o *ToplistWidgetDefinition) GetType() ToplistWidgetDefinitionType { - if o == nil { - var ret ToplistWidgetDefinitionType - 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 *ToplistWidgetDefinition) GetTypeOk() (*ToplistWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ToplistWidgetDefinition) SetType(v ToplistWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ToplistWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - toSerialize["requests"] = o.Requests - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - if o.TitleAlign != nil { - toSerialize["title_align"] = o.TitleAlign - } - if o.TitleSize != nil { - toSerialize["title_size"] = o.TitleSize - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]ToplistWidgetRequest `json:"requests"` - Type *ToplistWidgetDefinitionType `json:"type"` - }{} - all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests []ToplistWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ToplistWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.TitleAlign; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomLinks = all.CustomLinks - o.Requests = all.Requests - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.TitleAlign = all.TitleAlign - o.TitleSize = all.TitleSize - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_toplist_widget_definition_type.go b/api/v1/datadog/model_toplist_widget_definition_type.go deleted file mode 100644 index 19f230f2b7f..00000000000 --- a/api/v1/datadog/model_toplist_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ToplistWidgetDefinitionType Type of the top list widget. -type ToplistWidgetDefinitionType string - -// List of ToplistWidgetDefinitionType. -const ( - TOPLISTWIDGETDEFINITIONTYPE_TOPLIST ToplistWidgetDefinitionType = "toplist" -) - -var allowedToplistWidgetDefinitionTypeEnumValues = []ToplistWidgetDefinitionType{ - TOPLISTWIDGETDEFINITIONTYPE_TOPLIST, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ToplistWidgetDefinitionType) GetAllowedValues() []ToplistWidgetDefinitionType { - return allowedToplistWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ToplistWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ToplistWidgetDefinitionType(value) - return nil -} - -// NewToplistWidgetDefinitionTypeFromValue returns a pointer to a valid ToplistWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewToplistWidgetDefinitionTypeFromValue(v string) (*ToplistWidgetDefinitionType, error) { - ev := ToplistWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ToplistWidgetDefinitionType: valid values are %v", v, allowedToplistWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ToplistWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedToplistWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ToplistWidgetDefinitionType value. -func (v ToplistWidgetDefinitionType) Ptr() *ToplistWidgetDefinitionType { - return &v -} - -// NullableToplistWidgetDefinitionType handles when a null is used for ToplistWidgetDefinitionType. -type NullableToplistWidgetDefinitionType struct { - value *ToplistWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableToplistWidgetDefinitionType) Get() *ToplistWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableToplistWidgetDefinitionType) Set(val *ToplistWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableToplistWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableToplistWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableToplistWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableToplistWidgetDefinitionType(val *ToplistWidgetDefinitionType) *NullableToplistWidgetDefinitionType { - return &NullableToplistWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableToplistWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableToplistWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_toplist_widget_request.go b/api/v1/datadog/model_toplist_widget_request.go deleted file mode 100644 index 421a8e26ee6..00000000000 --- a/api/v1/datadog/model_toplist_widget_request.go +++ /dev/null @@ -1,726 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ToplistWidgetRequest Updated top list widget. -type ToplistWidgetRequest struct { - // The log query. - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - // The log query. - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - // List of conditional formats. - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - // The log query. - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // The log query. - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - // The log query. - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - // The process query to use in the widget. - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - // The log query. - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - // Widget query. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - // The log query. - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - // The log query. - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - // Define request widget style. - Style *WidgetRequestStyle `json:"style,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{} -} - -// NewToplistWidgetRequest instantiates a new ToplistWidgetRequest 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 NewToplistWidgetRequest() *ToplistWidgetRequest { - this := ToplistWidgetRequest{} - return &this -} - -// NewToplistWidgetRequestWithDefaults instantiates a new ToplistWidgetRequest 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 NewToplistWidgetRequestWithDefaults() *ToplistWidgetRequest { - this := ToplistWidgetRequest{} - return &this -} - -// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetApmQuery() LogQueryDefinition { - if o == nil || o.ApmQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ApmQuery -} - -// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ApmQuery == nil { - return nil, false - } - return o.ApmQuery, true -} - -// HasApmQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasApmQuery() bool { - if o != nil && o.ApmQuery != nil { - return true - } - - return false -} - -// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. -func (o *ToplistWidgetRequest) SetApmQuery(v LogQueryDefinition) { - o.ApmQuery = &v -} - -// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetAuditQuery() LogQueryDefinition { - if o == nil || o.AuditQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.AuditQuery -} - -// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.AuditQuery == nil { - return nil, false - } - return o.AuditQuery, true -} - -// HasAuditQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasAuditQuery() bool { - if o != nil && o.AuditQuery != nil { - return true - } - - return false -} - -// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. -func (o *ToplistWidgetRequest) SetAuditQuery(v LogQueryDefinition) { - o.AuditQuery = &v -} - -// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetConditionalFormats() []WidgetConditionalFormat { - if o == nil || o.ConditionalFormats == nil { - var ret []WidgetConditionalFormat - return ret - } - return o.ConditionalFormats -} - -// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { - if o == nil || o.ConditionalFormats == nil { - return nil, false - } - return &o.ConditionalFormats, true -} - -// HasConditionalFormats returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasConditionalFormats() bool { - if o != nil && o.ConditionalFormats != nil { - return true - } - - return false -} - -// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. -func (o *ToplistWidgetRequest) SetConditionalFormats(v []WidgetConditionalFormat) { - o.ConditionalFormats = v -} - -// GetEventQuery returns the EventQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetEventQuery() LogQueryDefinition { - if o == nil || o.EventQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.EventQuery -} - -// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.EventQuery == nil { - return nil, false - } - return o.EventQuery, true -} - -// HasEventQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasEventQuery() bool { - if o != nil && o.EventQuery != nil { - return true - } - - return false -} - -// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. -func (o *ToplistWidgetRequest) SetEventQuery(v LogQueryDefinition) { - o.EventQuery = &v -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *ToplistWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetLogQuery returns the LogQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetLogQuery() LogQueryDefinition { - if o == nil || o.LogQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.LogQuery -} - -// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.LogQuery == nil { - return nil, false - } - return o.LogQuery, true -} - -// HasLogQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasLogQuery() bool { - if o != nil && o.LogQuery != nil { - return true - } - - return false -} - -// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. -func (o *ToplistWidgetRequest) SetLogQuery(v LogQueryDefinition) { - o.LogQuery = &v -} - -// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetNetworkQuery() LogQueryDefinition { - if o == nil || o.NetworkQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.NetworkQuery -} - -// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.NetworkQuery == nil { - return nil, false - } - return o.NetworkQuery, true -} - -// HasNetworkQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasNetworkQuery() bool { - if o != nil && o.NetworkQuery != nil { - return true - } - - return false -} - -// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. -func (o *ToplistWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { - o.NetworkQuery = &v -} - -// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetProcessQuery() ProcessQueryDefinition { - if o == nil || o.ProcessQuery == nil { - var ret ProcessQueryDefinition - return ret - } - return *o.ProcessQuery -} - -// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { - if o == nil || o.ProcessQuery == nil { - return nil, false - } - return o.ProcessQuery, true -} - -// HasProcessQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasProcessQuery() bool { - if o != nil && o.ProcessQuery != nil { - return true - } - - return false -} - -// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. -func (o *ToplistWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { - o.ProcessQuery = &v -} - -// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { - if o == nil || o.ProfileMetricsQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.ProfileMetricsQuery -} - -// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.ProfileMetricsQuery == nil { - return nil, false - } - return o.ProfileMetricsQuery, true -} - -// HasProfileMetricsQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasProfileMetricsQuery() bool { - if o != nil && o.ProfileMetricsQuery != nil { - return true - } - - return false -} - -// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. -func (o *ToplistWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { - o.ProfileMetricsQuery = &v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *ToplistWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *ToplistWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *ToplistWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// GetRumQuery returns the RumQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetRumQuery() LogQueryDefinition { - if o == nil || o.RumQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.RumQuery -} - -// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.RumQuery == nil { - return nil, false - } - return o.RumQuery, true -} - -// HasRumQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasRumQuery() bool { - if o != nil && o.RumQuery != nil { - return true - } - - return false -} - -// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. -func (o *ToplistWidgetRequest) SetRumQuery(v LogQueryDefinition) { - o.RumQuery = &v -} - -// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetSecurityQuery() LogQueryDefinition { - if o == nil || o.SecurityQuery == nil { - var ret LogQueryDefinition - return ret - } - return *o.SecurityQuery -} - -// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { - if o == nil || o.SecurityQuery == nil { - return nil, false - } - return o.SecurityQuery, true -} - -// HasSecurityQuery returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasSecurityQuery() bool { - if o != nil && o.SecurityQuery != nil { - return true - } - - return false -} - -// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. -func (o *ToplistWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { - o.SecurityQuery = &v -} - -// GetStyle returns the Style field value if set, zero value otherwise. -func (o *ToplistWidgetRequest) GetStyle() WidgetRequestStyle { - if o == nil || o.Style == nil { - var ret WidgetRequestStyle - return ret - } - return *o.Style -} - -// GetStyleOk returns a tuple with the Style field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ToplistWidgetRequest) GetStyleOk() (*WidgetRequestStyle, bool) { - if o == nil || o.Style == nil { - return nil, false - } - return o.Style, true -} - -// HasStyle returns a boolean if a field has been set. -func (o *ToplistWidgetRequest) HasStyle() bool { - if o != nil && o.Style != nil { - return true - } - - return false -} - -// SetStyle gets a reference to the given WidgetRequestStyle and assigns it to the Style field. -func (o *ToplistWidgetRequest) SetStyle(v WidgetRequestStyle) { - o.Style = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ToplistWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmQuery != nil { - toSerialize["apm_query"] = o.ApmQuery - } - if o.AuditQuery != nil { - toSerialize["audit_query"] = o.AuditQuery - } - if o.ConditionalFormats != nil { - toSerialize["conditional_formats"] = o.ConditionalFormats - } - if o.EventQuery != nil { - toSerialize["event_query"] = o.EventQuery - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.LogQuery != nil { - toSerialize["log_query"] = o.LogQuery - } - if o.NetworkQuery != nil { - toSerialize["network_query"] = o.NetworkQuery - } - if o.ProcessQuery != nil { - toSerialize["process_query"] = o.ProcessQuery - } - if o.ProfileMetricsQuery != nil { - toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - if o.RumQuery != nil { - toSerialize["rum_query"] = o.RumQuery - } - if o.SecurityQuery != nil { - toSerialize["security_query"] = o.SecurityQuery - } - if o.Style != nil { - toSerialize["style"] = o.Style - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ToplistWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - EventQuery *LogQueryDefinition `json:"event_query,omitempty"` - Formulas []WidgetFormula `json:"formulas,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - Style *WidgetRequestStyle `json:"style,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmQuery = all.ApmQuery - if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.AuditQuery = all.AuditQuery - o.ConditionalFormats = all.ConditionalFormats - if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.EventQuery = all.EventQuery - o.Formulas = all.Formulas - if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogQuery = all.LogQuery - if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkQuery = all.NetworkQuery - if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProcessQuery = all.ProcessQuery - if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfileMetricsQuery = all.ProfileMetricsQuery - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumQuery = all.RumQuery - if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SecurityQuery = all.SecurityQuery - if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Style = all.Style - return nil -} diff --git a/api/v1/datadog/model_tree_map_color_by.go b/api/v1/datadog/model_tree_map_color_by.go deleted file mode 100644 index 399a4753799..00000000000 --- a/api/v1/datadog/model_tree_map_color_by.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TreeMapColorBy (deprecated) The attribute formerly used to determine color in the widget. -type TreeMapColorBy string - -// List of TreeMapColorBy. -const ( - TREEMAPCOLORBY_USER TreeMapColorBy = "user" -) - -var allowedTreeMapColorByEnumValues = []TreeMapColorBy{ - TREEMAPCOLORBY_USER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TreeMapColorBy) GetAllowedValues() []TreeMapColorBy { - return allowedTreeMapColorByEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TreeMapColorBy) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TreeMapColorBy(value) - return nil -} - -// NewTreeMapColorByFromValue returns a pointer to a valid TreeMapColorBy -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTreeMapColorByFromValue(v string) (*TreeMapColorBy, error) { - ev := TreeMapColorBy(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TreeMapColorBy: valid values are %v", v, allowedTreeMapColorByEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TreeMapColorBy) IsValid() bool { - for _, existing := range allowedTreeMapColorByEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TreeMapColorBy value. -func (v TreeMapColorBy) Ptr() *TreeMapColorBy { - return &v -} - -// NullableTreeMapColorBy handles when a null is used for TreeMapColorBy. -type NullableTreeMapColorBy struct { - value *TreeMapColorBy - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapColorBy) Get() *TreeMapColorBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapColorBy) Set(val *TreeMapColorBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapColorBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapColorBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapColorBy initializes the struct as if Set has been called. -func NewNullableTreeMapColorBy(val *TreeMapColorBy) *NullableTreeMapColorBy { - return &NullableTreeMapColorBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapColorBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapColorBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_tree_map_group_by.go b/api/v1/datadog/model_tree_map_group_by.go deleted file mode 100644 index a26a03d685c..00000000000 --- a/api/v1/datadog/model_tree_map_group_by.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TreeMapGroupBy (deprecated) The attribute formerly used to group elements in the widget. -type TreeMapGroupBy string - -// List of TreeMapGroupBy. -const ( - TREEMAPGROUPBY_USER TreeMapGroupBy = "user" - TREEMAPGROUPBY_FAMILY TreeMapGroupBy = "family" - TREEMAPGROUPBY_PROCESS TreeMapGroupBy = "process" -) - -var allowedTreeMapGroupByEnumValues = []TreeMapGroupBy{ - TREEMAPGROUPBY_USER, - TREEMAPGROUPBY_FAMILY, - TREEMAPGROUPBY_PROCESS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TreeMapGroupBy) GetAllowedValues() []TreeMapGroupBy { - return allowedTreeMapGroupByEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TreeMapGroupBy) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TreeMapGroupBy(value) - return nil -} - -// NewTreeMapGroupByFromValue returns a pointer to a valid TreeMapGroupBy -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTreeMapGroupByFromValue(v string) (*TreeMapGroupBy, error) { - ev := TreeMapGroupBy(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TreeMapGroupBy: valid values are %v", v, allowedTreeMapGroupByEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TreeMapGroupBy) IsValid() bool { - for _, existing := range allowedTreeMapGroupByEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TreeMapGroupBy value. -func (v TreeMapGroupBy) Ptr() *TreeMapGroupBy { - return &v -} - -// NullableTreeMapGroupBy handles when a null is used for TreeMapGroupBy. -type NullableTreeMapGroupBy struct { - value *TreeMapGroupBy - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapGroupBy) Get() *TreeMapGroupBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapGroupBy) Set(val *TreeMapGroupBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapGroupBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapGroupBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapGroupBy initializes the struct as if Set has been called. -func NewNullableTreeMapGroupBy(val *TreeMapGroupBy) *NullableTreeMapGroupBy { - return &NullableTreeMapGroupBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapGroupBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapGroupBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_tree_map_size_by.go b/api/v1/datadog/model_tree_map_size_by.go deleted file mode 100644 index e829c3ba168..00000000000 --- a/api/v1/datadog/model_tree_map_size_by.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TreeMapSizeBy (deprecated) The attribute formerly used to determine size in the widget. -type TreeMapSizeBy string - -// List of TreeMapSizeBy. -const ( - TREEMAPSIZEBY_PCT_CPU TreeMapSizeBy = "pct_cpu" - TREEMAPSIZEBY_PCT_MEM TreeMapSizeBy = "pct_mem" -) - -var allowedTreeMapSizeByEnumValues = []TreeMapSizeBy{ - TREEMAPSIZEBY_PCT_CPU, - TREEMAPSIZEBY_PCT_MEM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TreeMapSizeBy) GetAllowedValues() []TreeMapSizeBy { - return allowedTreeMapSizeByEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TreeMapSizeBy) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TreeMapSizeBy(value) - return nil -} - -// NewTreeMapSizeByFromValue returns a pointer to a valid TreeMapSizeBy -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTreeMapSizeByFromValue(v string) (*TreeMapSizeBy, error) { - ev := TreeMapSizeBy(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TreeMapSizeBy: valid values are %v", v, allowedTreeMapSizeByEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TreeMapSizeBy) IsValid() bool { - for _, existing := range allowedTreeMapSizeByEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TreeMapSizeBy value. -func (v TreeMapSizeBy) Ptr() *TreeMapSizeBy { - return &v -} - -// NullableTreeMapSizeBy handles when a null is used for TreeMapSizeBy. -type NullableTreeMapSizeBy struct { - value *TreeMapSizeBy - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapSizeBy) Get() *TreeMapSizeBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapSizeBy) Set(val *TreeMapSizeBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapSizeBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapSizeBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapSizeBy initializes the struct as if Set has been called. -func NewNullableTreeMapSizeBy(val *TreeMapSizeBy) *NullableTreeMapSizeBy { - return &NullableTreeMapSizeBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapSizeBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapSizeBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_tree_map_widget_definition.go b/api/v1/datadog/model_tree_map_widget_definition.go deleted file mode 100644 index e0ff448966f..00000000000 --- a/api/v1/datadog/model_tree_map_widget_definition.go +++ /dev/null @@ -1,427 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TreeMapWidgetDefinition The treemap visualization enables you to display hierarchical and nested data. It is well suited for queries that describe part-whole relationships, such as resource usage by availability zone, data center, or team. -type TreeMapWidgetDefinition struct { - // (deprecated) The attribute formerly used to determine color in the widget. - // Deprecated - ColorBy *TreeMapColorBy `json:"color_by,omitempty"` - // List of custom links. - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - // (deprecated) The attribute formerly used to group elements in the widget. - // Deprecated - GroupBy *TreeMapGroupBy `json:"group_by,omitempty"` - // List of treemap widget requests. - Requests []TreeMapWidgetRequest `json:"requests"` - // (deprecated) The attribute formerly used to determine size in the widget. - // Deprecated - SizeBy *TreeMapSizeBy `json:"size_by,omitempty"` - // Time setting for the widget. - Time *WidgetTime `json:"time,omitempty"` - // Title of your widget. - Title *string `json:"title,omitempty"` - // Type of the treemap widget. - Type TreeMapWidgetDefinitionType `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{} -} - -// NewTreeMapWidgetDefinition instantiates a new TreeMapWidgetDefinition 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 NewTreeMapWidgetDefinition(requests []TreeMapWidgetRequest, typeVar TreeMapWidgetDefinitionType) *TreeMapWidgetDefinition { - this := TreeMapWidgetDefinition{} - var colorBy TreeMapColorBy = TREEMAPCOLORBY_USER - this.ColorBy = &colorBy - this.Requests = requests - this.Type = typeVar - return &this -} - -// NewTreeMapWidgetDefinitionWithDefaults instantiates a new TreeMapWidgetDefinition 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 NewTreeMapWidgetDefinitionWithDefaults() *TreeMapWidgetDefinition { - this := TreeMapWidgetDefinition{} - var colorBy TreeMapColorBy = TREEMAPCOLORBY_USER - this.ColorBy = &colorBy - var typeVar TreeMapWidgetDefinitionType = TREEMAPWIDGETDEFINITIONTYPE_TREEMAP - this.Type = typeVar - return &this -} - -// GetColorBy returns the ColorBy field value if set, zero value otherwise. -// Deprecated -func (o *TreeMapWidgetDefinition) GetColorBy() TreeMapColorBy { - if o == nil || o.ColorBy == nil { - var ret TreeMapColorBy - return ret - } - return *o.ColorBy -} - -// GetColorByOk returns a tuple with the ColorBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *TreeMapWidgetDefinition) GetColorByOk() (*TreeMapColorBy, bool) { - if o == nil || o.ColorBy == nil { - return nil, false - } - return o.ColorBy, true -} - -// HasColorBy returns a boolean if a field has been set. -func (o *TreeMapWidgetDefinition) HasColorBy() bool { - if o != nil && o.ColorBy != nil { - return true - } - - return false -} - -// SetColorBy gets a reference to the given TreeMapColorBy and assigns it to the ColorBy field. -// Deprecated -func (o *TreeMapWidgetDefinition) SetColorBy(v TreeMapColorBy) { - o.ColorBy = &v -} - -// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. -func (o *TreeMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { - if o == nil || o.CustomLinks == nil { - var ret []WidgetCustomLink - return ret - } - return o.CustomLinks -} - -// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { - if o == nil || o.CustomLinks == nil { - return nil, false - } - return &o.CustomLinks, true -} - -// HasCustomLinks returns a boolean if a field has been set. -func (o *TreeMapWidgetDefinition) HasCustomLinks() bool { - if o != nil && o.CustomLinks != nil { - return true - } - - return false -} - -// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. -func (o *TreeMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { - o.CustomLinks = v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -// Deprecated -func (o *TreeMapWidgetDefinition) GetGroupBy() TreeMapGroupBy { - if o == nil || o.GroupBy == nil { - var ret TreeMapGroupBy - return ret - } - return *o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *TreeMapWidgetDefinition) GetGroupByOk() (*TreeMapGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *TreeMapWidgetDefinition) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given TreeMapGroupBy and assigns it to the GroupBy field. -// Deprecated -func (o *TreeMapWidgetDefinition) SetGroupBy(v TreeMapGroupBy) { - o.GroupBy = &v -} - -// GetRequests returns the Requests field value. -func (o *TreeMapWidgetDefinition) GetRequests() []TreeMapWidgetRequest { - if o == nil { - var ret []TreeMapWidgetRequest - return ret - } - return o.Requests -} - -// GetRequestsOk returns a tuple with the Requests field value -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetDefinition) GetRequestsOk() (*[]TreeMapWidgetRequest, bool) { - if o == nil { - return nil, false - } - return &o.Requests, true -} - -// SetRequests sets field value. -func (o *TreeMapWidgetDefinition) SetRequests(v []TreeMapWidgetRequest) { - o.Requests = v -} - -// GetSizeBy returns the SizeBy field value if set, zero value otherwise. -// Deprecated -func (o *TreeMapWidgetDefinition) GetSizeBy() TreeMapSizeBy { - if o == nil || o.SizeBy == nil { - var ret TreeMapSizeBy - return ret - } - return *o.SizeBy -} - -// GetSizeByOk returns a tuple with the SizeBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *TreeMapWidgetDefinition) GetSizeByOk() (*TreeMapSizeBy, bool) { - if o == nil || o.SizeBy == nil { - return nil, false - } - return o.SizeBy, true -} - -// HasSizeBy returns a boolean if a field has been set. -func (o *TreeMapWidgetDefinition) HasSizeBy() bool { - if o != nil && o.SizeBy != nil { - return true - } - - return false -} - -// SetSizeBy gets a reference to the given TreeMapSizeBy and assigns it to the SizeBy field. -// Deprecated -func (o *TreeMapWidgetDefinition) SetSizeBy(v TreeMapSizeBy) { - o.SizeBy = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *TreeMapWidgetDefinition) GetTime() WidgetTime { - if o == nil || o.Time == nil { - var ret WidgetTime - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *TreeMapWidgetDefinition) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. -func (o *TreeMapWidgetDefinition) SetTime(v WidgetTime) { - o.Time = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *TreeMapWidgetDefinition) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetDefinition) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *TreeMapWidgetDefinition) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *TreeMapWidgetDefinition) SetTitle(v string) { - o.Title = &v -} - -// GetType returns the Type field value. -func (o *TreeMapWidgetDefinition) GetType() TreeMapWidgetDefinitionType { - if o == nil { - var ret TreeMapWidgetDefinitionType - 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 *TreeMapWidgetDefinition) GetTypeOk() (*TreeMapWidgetDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *TreeMapWidgetDefinition) SetType(v TreeMapWidgetDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TreeMapWidgetDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ColorBy != nil { - toSerialize["color_by"] = o.ColorBy - } - if o.CustomLinks != nil { - toSerialize["custom_links"] = o.CustomLinks - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - toSerialize["requests"] = o.Requests - if o.SizeBy != nil { - toSerialize["size_by"] = o.SizeBy - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Requests *[]TreeMapWidgetRequest `json:"requests"` - Type *TreeMapWidgetDefinitionType `json:"type"` - }{} - all := struct { - ColorBy *TreeMapColorBy `json:"color_by,omitempty"` - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - GroupBy *TreeMapGroupBy `json:"group_by,omitempty"` - Requests []TreeMapWidgetRequest `json:"requests"` - SizeBy *TreeMapSizeBy `json:"size_by,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - Type TreeMapWidgetDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("Required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ColorBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.GroupBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.SizeBy; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ColorBy = all.ColorBy - o.CustomLinks = all.CustomLinks - o.GroupBy = all.GroupBy - o.Requests = all.Requests - o.SizeBy = all.SizeBy - if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Time = all.Time - o.Title = all.Title - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_tree_map_widget_definition_type.go b/api/v1/datadog/model_tree_map_widget_definition_type.go deleted file mode 100644 index e781d666e3a..00000000000 --- a/api/v1/datadog/model_tree_map_widget_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// TreeMapWidgetDefinitionType Type of the treemap widget. -type TreeMapWidgetDefinitionType string - -// List of TreeMapWidgetDefinitionType. -const ( - TREEMAPWIDGETDEFINITIONTYPE_TREEMAP TreeMapWidgetDefinitionType = "treemap" -) - -var allowedTreeMapWidgetDefinitionTypeEnumValues = []TreeMapWidgetDefinitionType{ - TREEMAPWIDGETDEFINITIONTYPE_TREEMAP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *TreeMapWidgetDefinitionType) GetAllowedValues() []TreeMapWidgetDefinitionType { - return allowedTreeMapWidgetDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *TreeMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = TreeMapWidgetDefinitionType(value) - return nil -} - -// NewTreeMapWidgetDefinitionTypeFromValue returns a pointer to a valid TreeMapWidgetDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewTreeMapWidgetDefinitionTypeFromValue(v string) (*TreeMapWidgetDefinitionType, error) { - ev := TreeMapWidgetDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for TreeMapWidgetDefinitionType: valid values are %v", v, allowedTreeMapWidgetDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v TreeMapWidgetDefinitionType) IsValid() bool { - for _, existing := range allowedTreeMapWidgetDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TreeMapWidgetDefinitionType value. -func (v TreeMapWidgetDefinitionType) Ptr() *TreeMapWidgetDefinitionType { - return &v -} - -// NullableTreeMapWidgetDefinitionType handles when a null is used for TreeMapWidgetDefinitionType. -type NullableTreeMapWidgetDefinitionType struct { - value *TreeMapWidgetDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableTreeMapWidgetDefinitionType) Get() *TreeMapWidgetDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableTreeMapWidgetDefinitionType) Set(val *TreeMapWidgetDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableTreeMapWidgetDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableTreeMapWidgetDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableTreeMapWidgetDefinitionType initializes the struct as if Set has been called. -func NewNullableTreeMapWidgetDefinitionType(val *TreeMapWidgetDefinitionType) *NullableTreeMapWidgetDefinitionType { - return &NullableTreeMapWidgetDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableTreeMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableTreeMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_tree_map_widget_request.go b/api/v1/datadog/model_tree_map_widget_request.go deleted file mode 100644 index efec5c03329..00000000000 --- a/api/v1/datadog/model_tree_map_widget_request.go +++ /dev/null @@ -1,227 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// TreeMapWidgetRequest An updated treemap widget. -type TreeMapWidgetRequest struct { - // List of formulas that operate on queries. - Formulas []WidgetFormula `json:"formulas,omitempty"` - // The widget metrics query. - Q *string `json:"q,omitempty"` - // List of queries that can be returned directly or used in formulas. - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - // Timeseries or Scalar response. - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,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{} -} - -// NewTreeMapWidgetRequest instantiates a new TreeMapWidgetRequest 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 NewTreeMapWidgetRequest() *TreeMapWidgetRequest { - this := TreeMapWidgetRequest{} - return &this -} - -// NewTreeMapWidgetRequestWithDefaults instantiates a new TreeMapWidgetRequest 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 NewTreeMapWidgetRequestWithDefaults() *TreeMapWidgetRequest { - this := TreeMapWidgetRequest{} - return &this -} - -// GetFormulas returns the Formulas field value if set, zero value otherwise. -func (o *TreeMapWidgetRequest) GetFormulas() []WidgetFormula { - if o == nil || o.Formulas == nil { - var ret []WidgetFormula - return ret - } - return o.Formulas -} - -// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { - if o == nil || o.Formulas == nil { - return nil, false - } - return &o.Formulas, true -} - -// HasFormulas returns a boolean if a field has been set. -func (o *TreeMapWidgetRequest) HasFormulas() bool { - if o != nil && o.Formulas != nil { - return true - } - - return false -} - -// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. -func (o *TreeMapWidgetRequest) SetFormulas(v []WidgetFormula) { - o.Formulas = v -} - -// GetQ returns the Q field value if set, zero value otherwise. -func (o *TreeMapWidgetRequest) GetQ() string { - if o == nil || o.Q == nil { - var ret string - return ret - } - return *o.Q -} - -// GetQOk returns a tuple with the Q field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetRequest) GetQOk() (*string, bool) { - if o == nil || o.Q == nil { - return nil, false - } - return o.Q, true -} - -// HasQ returns a boolean if a field has been set. -func (o *TreeMapWidgetRequest) HasQ() bool { - if o != nil && o.Q != nil { - return true - } - - return false -} - -// SetQ gets a reference to the given string and assigns it to the Q field. -func (o *TreeMapWidgetRequest) SetQ(v string) { - o.Q = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *TreeMapWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { - if o == nil || o.Queries == nil { - var ret []FormulaAndFunctionQueryDefinition - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *TreeMapWidgetRequest) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. -func (o *TreeMapWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { - o.Queries = v -} - -// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. -func (o *TreeMapWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { - if o == nil || o.ResponseFormat == nil { - var ret FormulaAndFunctionResponseFormat - return ret - } - return *o.ResponseFormat -} - -// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TreeMapWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { - if o == nil || o.ResponseFormat == nil { - return nil, false - } - return o.ResponseFormat, true -} - -// HasResponseFormat returns a boolean if a field has been set. -func (o *TreeMapWidgetRequest) HasResponseFormat() bool { - if o != nil && o.ResponseFormat != nil { - return true - } - - return false -} - -// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. -func (o *TreeMapWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { - o.ResponseFormat = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o TreeMapWidgetRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Formulas != nil { - toSerialize["formulas"] = o.Formulas - } - if o.Q != nil { - toSerialize["q"] = o.Q - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.ResponseFormat != nil { - toSerialize["response_format"] = o.ResponseFormat - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *TreeMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Formulas []WidgetFormula `json:"formulas,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ResponseFormat; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Formulas = all.Formulas - o.Q = all.Q - o.Queries = all.Queries - o.ResponseFormat = all.ResponseFormat - return nil -} diff --git a/api/v1/datadog/model_usage_analyzed_logs_hour.go b/api/v1/datadog/model_usage_analyzed_logs_hour.go deleted file mode 100644 index 59daa4a5207..00000000000 --- a/api/v1/datadog/model_usage_analyzed_logs_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageAnalyzedLogsHour The number of analyzed logs for each hour for a given organization. -type UsageAnalyzedLogsHour struct { - // Contains the number of analyzed logs. - AnalyzedLogs *int64 `json:"analyzed_logs,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageAnalyzedLogsHour instantiates a new UsageAnalyzedLogsHour 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 NewUsageAnalyzedLogsHour() *UsageAnalyzedLogsHour { - this := UsageAnalyzedLogsHour{} - return &this -} - -// NewUsageAnalyzedLogsHourWithDefaults instantiates a new UsageAnalyzedLogsHour 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 NewUsageAnalyzedLogsHourWithDefaults() *UsageAnalyzedLogsHour { - this := UsageAnalyzedLogsHour{} - return &this -} - -// GetAnalyzedLogs returns the AnalyzedLogs field value if set, zero value otherwise. -func (o *UsageAnalyzedLogsHour) GetAnalyzedLogs() int64 { - if o == nil || o.AnalyzedLogs == nil { - var ret int64 - return ret - } - return *o.AnalyzedLogs -} - -// GetAnalyzedLogsOk returns a tuple with the AnalyzedLogs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAnalyzedLogsHour) GetAnalyzedLogsOk() (*int64, bool) { - if o == nil || o.AnalyzedLogs == nil { - return nil, false - } - return o.AnalyzedLogs, true -} - -// HasAnalyzedLogs returns a boolean if a field has been set. -func (o *UsageAnalyzedLogsHour) HasAnalyzedLogs() bool { - if o != nil && o.AnalyzedLogs != nil { - return true - } - - return false -} - -// SetAnalyzedLogs gets a reference to the given int64 and assigns it to the AnalyzedLogs field. -func (o *UsageAnalyzedLogsHour) SetAnalyzedLogs(v int64) { - o.AnalyzedLogs = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageAnalyzedLogsHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAnalyzedLogsHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageAnalyzedLogsHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageAnalyzedLogsHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageAnalyzedLogsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAnalyzedLogsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageAnalyzedLogsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageAnalyzedLogsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageAnalyzedLogsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAnalyzedLogsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageAnalyzedLogsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageAnalyzedLogsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAnalyzedLogsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AnalyzedLogs != nil { - toSerialize["analyzed_logs"] = o.AnalyzedLogs - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAnalyzedLogsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AnalyzedLogs *int64 `json:"analyzed_logs,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AnalyzedLogs = all.AnalyzedLogs - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_analyzed_logs_response.go b/api/v1/datadog/model_usage_analyzed_logs_response.go deleted file mode 100644 index 77c1e3e5f4a..00000000000 --- a/api/v1/datadog/model_usage_analyzed_logs_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAnalyzedLogsResponse A response containing the number of analyzed logs for each hour for a given organization. -type UsageAnalyzedLogsResponse struct { - // Get hourly usage for analyzed logs. - Usage []UsageAnalyzedLogsHour `json:"usage,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{} -} - -// NewUsageAnalyzedLogsResponse instantiates a new UsageAnalyzedLogsResponse 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 NewUsageAnalyzedLogsResponse() *UsageAnalyzedLogsResponse { - this := UsageAnalyzedLogsResponse{} - return &this -} - -// NewUsageAnalyzedLogsResponseWithDefaults instantiates a new UsageAnalyzedLogsResponse 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 NewUsageAnalyzedLogsResponseWithDefaults() *UsageAnalyzedLogsResponse { - this := UsageAnalyzedLogsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageAnalyzedLogsResponse) GetUsage() []UsageAnalyzedLogsHour { - if o == nil || o.Usage == nil { - var ret []UsageAnalyzedLogsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAnalyzedLogsResponse) GetUsageOk() (*[]UsageAnalyzedLogsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageAnalyzedLogsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageAnalyzedLogsHour and assigns it to the Usage field. -func (o *UsageAnalyzedLogsResponse) SetUsage(v []UsageAnalyzedLogsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAnalyzedLogsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAnalyzedLogsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageAnalyzedLogsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_attribution_aggregates_body.go b/api/v1/datadog/model_usage_attribution_aggregates_body.go deleted file mode 100644 index b1856602de1..00000000000 --- a/api/v1/datadog/model_usage_attribution_aggregates_body.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAttributionAggregatesBody The object containing the aggregates. -type UsageAttributionAggregatesBody struct { - // The aggregate type. - AggType *string `json:"agg_type,omitempty"` - // The field. - Field *string `json:"field,omitempty"` - // The value for a given field. - Value *float64 `json:"value,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{} -} - -// NewUsageAttributionAggregatesBody instantiates a new UsageAttributionAggregatesBody 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 NewUsageAttributionAggregatesBody() *UsageAttributionAggregatesBody { - this := UsageAttributionAggregatesBody{} - return &this -} - -// NewUsageAttributionAggregatesBodyWithDefaults instantiates a new UsageAttributionAggregatesBody 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 NewUsageAttributionAggregatesBodyWithDefaults() *UsageAttributionAggregatesBody { - this := UsageAttributionAggregatesBody{} - return &this -} - -// GetAggType returns the AggType field value if set, zero value otherwise. -func (o *UsageAttributionAggregatesBody) GetAggType() string { - if o == nil || o.AggType == nil { - var ret string - return ret - } - return *o.AggType -} - -// GetAggTypeOk returns a tuple with the AggType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionAggregatesBody) GetAggTypeOk() (*string, bool) { - if o == nil || o.AggType == nil { - return nil, false - } - return o.AggType, true -} - -// HasAggType returns a boolean if a field has been set. -func (o *UsageAttributionAggregatesBody) HasAggType() bool { - if o != nil && o.AggType != nil { - return true - } - - return false -} - -// SetAggType gets a reference to the given string and assigns it to the AggType field. -func (o *UsageAttributionAggregatesBody) SetAggType(v string) { - o.AggType = &v -} - -// GetField returns the Field field value if set, zero value otherwise. -func (o *UsageAttributionAggregatesBody) GetField() string { - if o == nil || o.Field == nil { - var ret string - return ret - } - return *o.Field -} - -// GetFieldOk returns a tuple with the Field field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionAggregatesBody) GetFieldOk() (*string, bool) { - if o == nil || o.Field == nil { - return nil, false - } - return o.Field, true -} - -// HasField returns a boolean if a field has been set. -func (o *UsageAttributionAggregatesBody) HasField() bool { - if o != nil && o.Field != nil { - return true - } - - return false -} - -// SetField gets a reference to the given string and assigns it to the Field field. -func (o *UsageAttributionAggregatesBody) SetField(v string) { - o.Field = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *UsageAttributionAggregatesBody) GetValue() float64 { - if o == nil || o.Value == nil { - var ret float64 - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionAggregatesBody) GetValueOk() (*float64, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *UsageAttributionAggregatesBody) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given float64 and assigns it to the Value field. -func (o *UsageAttributionAggregatesBody) SetValue(v float64) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAttributionAggregatesBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AggType != nil { - toSerialize["agg_type"] = o.AggType - } - if o.Field != nil { - toSerialize["field"] = o.Field - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAttributionAggregatesBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AggType *string `json:"agg_type,omitempty"` - Field *string `json:"field,omitempty"` - Value *float64 `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AggType = all.AggType - o.Field = all.Field - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_usage_attribution_body.go b/api/v1/datadog/model_usage_attribution_body.go deleted file mode 100644 index 912f0b0b37f..00000000000 --- a/api/v1/datadog/model_usage_attribution_body.go +++ /dev/null @@ -1,352 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageAttributionBody Usage Summary by tag for a given organization. -type UsageAttributionBody struct { - // Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM]. - Month *time.Time `json:"month,omitempty"` - // The name of the organization. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The source of the usage attribution tag configuration and the selected tags in the format `::://////`. - TagConfigSource *string `json:"tag_config_source,omitempty"` - // Tag keys and values. - // - // A `null` value here means that the requested tag breakdown cannot be applied because it does not match the [tags - // configured for usage attribution](https://docs.datadoghq.com/account_management/billing/usage_attribution/#getting-started). - // In this scenario the API returns the total usage, not broken down by tags. - Tags map[string][]string `json:"tags,omitempty"` - // Shows the the most recent hour in the current months for all organizations for which all usages were calculated. - UpdatedAt *string `json:"updated_at,omitempty"` - // Fields in Usage Summary by tag(s). - Values *UsageAttributionValues `json:"values,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{} -} - -// NewUsageAttributionBody instantiates a new UsageAttributionBody 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 NewUsageAttributionBody() *UsageAttributionBody { - this := UsageAttributionBody{} - return &this -} - -// NewUsageAttributionBodyWithDefaults instantiates a new UsageAttributionBody 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 NewUsageAttributionBodyWithDefaults() *UsageAttributionBody { - this := UsageAttributionBody{} - return &this -} - -// GetMonth returns the Month field value if set, zero value otherwise. -func (o *UsageAttributionBody) GetMonth() time.Time { - if o == nil || o.Month == nil { - var ret time.Time - return ret - } - return *o.Month -} - -// GetMonthOk returns a tuple with the Month field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionBody) GetMonthOk() (*time.Time, bool) { - if o == nil || o.Month == nil { - return nil, false - } - return o.Month, true -} - -// HasMonth returns a boolean if a field has been set. -func (o *UsageAttributionBody) HasMonth() bool { - if o != nil && o.Month != nil { - return true - } - - return false -} - -// SetMonth gets a reference to the given time.Time and assigns it to the Month field. -func (o *UsageAttributionBody) SetMonth(v time.Time) { - o.Month = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageAttributionBody) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionBody) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageAttributionBody) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageAttributionBody) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageAttributionBody) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionBody) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageAttributionBody) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageAttributionBody) SetPublicId(v string) { - o.PublicId = &v -} - -// GetTagConfigSource returns the TagConfigSource field value if set, zero value otherwise. -func (o *UsageAttributionBody) GetTagConfigSource() string { - if o == nil || o.TagConfigSource == nil { - var ret string - return ret - } - return *o.TagConfigSource -} - -// GetTagConfigSourceOk returns a tuple with the TagConfigSource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionBody) GetTagConfigSourceOk() (*string, bool) { - if o == nil || o.TagConfigSource == nil { - return nil, false - } - return o.TagConfigSource, true -} - -// HasTagConfigSource returns a boolean if a field has been set. -func (o *UsageAttributionBody) HasTagConfigSource() bool { - if o != nil && o.TagConfigSource != nil { - return true - } - - return false -} - -// SetTagConfigSource gets a reference to the given string and assigns it to the TagConfigSource field. -func (o *UsageAttributionBody) SetTagConfigSource(v string) { - o.TagConfigSource = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *UsageAttributionBody) 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 *UsageAttributionBody) 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 *UsageAttributionBody) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. -func (o *UsageAttributionBody) SetTags(v map[string][]string) { - o.Tags = v -} - -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. -func (o *UsageAttributionBody) GetUpdatedAt() string { - if o == nil || o.UpdatedAt == nil { - var ret string - return ret - } - return *o.UpdatedAt -} - -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionBody) GetUpdatedAtOk() (*string, bool) { - if o == nil || o.UpdatedAt == nil { - return nil, false - } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *UsageAttributionBody) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false -} - -// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. -func (o *UsageAttributionBody) SetUpdatedAt(v string) { - o.UpdatedAt = &v -} - -// GetValues returns the Values field value if set, zero value otherwise. -func (o *UsageAttributionBody) GetValues() UsageAttributionValues { - if o == nil || o.Values == nil { - var ret UsageAttributionValues - return ret - } - return *o.Values -} - -// GetValuesOk returns a tuple with the Values field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionBody) GetValuesOk() (*UsageAttributionValues, bool) { - if o == nil || o.Values == nil { - return nil, false - } - return o.Values, true -} - -// HasValues returns a boolean if a field has been set. -func (o *UsageAttributionBody) HasValues() bool { - if o != nil && o.Values != nil { - return true - } - - return false -} - -// SetValues gets a reference to the given UsageAttributionValues and assigns it to the Values field. -func (o *UsageAttributionBody) SetValues(v UsageAttributionValues) { - o.Values = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAttributionBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Month != nil { - if o.Month.Nanosecond() == 0 { - toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.TagConfigSource != nil { - toSerialize["tag_config_source"] = o.TagConfigSource - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.UpdatedAt != nil { - toSerialize["updated_at"] = o.UpdatedAt - } - if o.Values != nil { - toSerialize["values"] = o.Values - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Month *time.Time `json:"month,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - TagConfigSource *string `json:"tag_config_source,omitempty"` - Tags map[string][]string `json:"tags,omitempty"` - UpdatedAt *string `json:"updated_at,omitempty"` - Values *UsageAttributionValues `json:"values,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Month = all.Month - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.TagConfigSource = all.TagConfigSource - o.Tags = all.Tags - o.UpdatedAt = all.UpdatedAt - if all.Values != nil && all.Values.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Values = all.Values - return nil -} diff --git a/api/v1/datadog/model_usage_attribution_metadata.go b/api/v1/datadog/model_usage_attribution_metadata.go deleted file mode 100644 index c89ef16e828..00000000000 --- a/api/v1/datadog/model_usage_attribution_metadata.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAttributionMetadata The object containing document metadata. -type UsageAttributionMetadata struct { - // An array of available aggregates. - Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` - // The metadata for the current pagination. - Pagination *UsageAttributionPagination `json:"pagination,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{} -} - -// NewUsageAttributionMetadata instantiates a new UsageAttributionMetadata 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 NewUsageAttributionMetadata() *UsageAttributionMetadata { - this := UsageAttributionMetadata{} - return &this -} - -// NewUsageAttributionMetadataWithDefaults instantiates a new UsageAttributionMetadata 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 NewUsageAttributionMetadataWithDefaults() *UsageAttributionMetadata { - this := UsageAttributionMetadata{} - return &this -} - -// GetAggregates returns the Aggregates field value if set, zero value otherwise. -func (o *UsageAttributionMetadata) GetAggregates() []UsageAttributionAggregatesBody { - if o == nil || o.Aggregates == nil { - var ret []UsageAttributionAggregatesBody - return ret - } - return o.Aggregates -} - -// GetAggregatesOk returns a tuple with the Aggregates field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionMetadata) GetAggregatesOk() (*[]UsageAttributionAggregatesBody, bool) { - if o == nil || o.Aggregates == nil { - return nil, false - } - return &o.Aggregates, true -} - -// HasAggregates returns a boolean if a field has been set. -func (o *UsageAttributionMetadata) HasAggregates() bool { - if o != nil && o.Aggregates != nil { - return true - } - - return false -} - -// SetAggregates gets a reference to the given []UsageAttributionAggregatesBody and assigns it to the Aggregates field. -func (o *UsageAttributionMetadata) SetAggregates(v []UsageAttributionAggregatesBody) { - o.Aggregates = v -} - -// GetPagination returns the Pagination field value if set, zero value otherwise. -func (o *UsageAttributionMetadata) GetPagination() UsageAttributionPagination { - if o == nil || o.Pagination == nil { - var ret UsageAttributionPagination - return ret - } - return *o.Pagination -} - -// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionMetadata) GetPaginationOk() (*UsageAttributionPagination, bool) { - if o == nil || o.Pagination == nil { - return nil, false - } - return o.Pagination, true -} - -// HasPagination returns a boolean if a field has been set. -func (o *UsageAttributionMetadata) HasPagination() bool { - if o != nil && o.Pagination != nil { - return true - } - - return false -} - -// SetPagination gets a reference to the given UsageAttributionPagination and assigns it to the Pagination field. -func (o *UsageAttributionMetadata) SetPagination(v UsageAttributionPagination) { - o.Pagination = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAttributionMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregates != nil { - toSerialize["aggregates"] = o.Aggregates - } - if o.Pagination != nil { - toSerialize["pagination"] = o.Pagination - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` - Pagination *UsageAttributionPagination `json:"pagination,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregates = all.Aggregates - if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pagination = all.Pagination - return nil -} diff --git a/api/v1/datadog/model_usage_attribution_pagination.go b/api/v1/datadog/model_usage_attribution_pagination.go deleted file mode 100644 index f4f28a87af3..00000000000 --- a/api/v1/datadog/model_usage_attribution_pagination.go +++ /dev/null @@ -1,258 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAttributionPagination The metadata for the current pagination. -type UsageAttributionPagination struct { - // Maximum amount of records to be returned. - Limit *int64 `json:"limit,omitempty"` - // Records to be skipped before beginning to return. - Offset *int64 `json:"offset,omitempty"` - // Direction to sort by. - SortDirection *string `json:"sort_direction,omitempty"` - // Field to sort by. - SortName *string `json:"sort_name,omitempty"` - // Total number of records. - TotalNumberOfRecords *int64 `json:"total_number_of_records,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{} -} - -// NewUsageAttributionPagination instantiates a new UsageAttributionPagination 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 NewUsageAttributionPagination() *UsageAttributionPagination { - this := UsageAttributionPagination{} - return &this -} - -// NewUsageAttributionPaginationWithDefaults instantiates a new UsageAttributionPagination 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 NewUsageAttributionPaginationWithDefaults() *UsageAttributionPagination { - this := UsageAttributionPagination{} - return &this -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *UsageAttributionPagination) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionPagination) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *UsageAttributionPagination) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *UsageAttributionPagination) SetLimit(v int64) { - o.Limit = &v -} - -// GetOffset returns the Offset field value if set, zero value otherwise. -func (o *UsageAttributionPagination) GetOffset() int64 { - if o == nil || o.Offset == nil { - var ret int64 - return ret - } - return *o.Offset -} - -// GetOffsetOk returns a tuple with the Offset field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionPagination) GetOffsetOk() (*int64, bool) { - if o == nil || o.Offset == nil { - return nil, false - } - return o.Offset, true -} - -// HasOffset returns a boolean if a field has been set. -func (o *UsageAttributionPagination) HasOffset() bool { - if o != nil && o.Offset != nil { - return true - } - - return false -} - -// SetOffset gets a reference to the given int64 and assigns it to the Offset field. -func (o *UsageAttributionPagination) SetOffset(v int64) { - o.Offset = &v -} - -// GetSortDirection returns the SortDirection field value if set, zero value otherwise. -func (o *UsageAttributionPagination) GetSortDirection() string { - if o == nil || o.SortDirection == nil { - var ret string - return ret - } - return *o.SortDirection -} - -// GetSortDirectionOk returns a tuple with the SortDirection field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionPagination) GetSortDirectionOk() (*string, bool) { - if o == nil || o.SortDirection == nil { - return nil, false - } - return o.SortDirection, true -} - -// HasSortDirection returns a boolean if a field has been set. -func (o *UsageAttributionPagination) HasSortDirection() bool { - if o != nil && o.SortDirection != nil { - return true - } - - return false -} - -// SetSortDirection gets a reference to the given string and assigns it to the SortDirection field. -func (o *UsageAttributionPagination) SetSortDirection(v string) { - o.SortDirection = &v -} - -// GetSortName returns the SortName field value if set, zero value otherwise. -func (o *UsageAttributionPagination) GetSortName() string { - if o == nil || o.SortName == nil { - var ret string - return ret - } - return *o.SortName -} - -// GetSortNameOk returns a tuple with the SortName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionPagination) GetSortNameOk() (*string, bool) { - if o == nil || o.SortName == nil { - return nil, false - } - return o.SortName, true -} - -// HasSortName returns a boolean if a field has been set. -func (o *UsageAttributionPagination) HasSortName() bool { - if o != nil && o.SortName != nil { - return true - } - - return false -} - -// SetSortName gets a reference to the given string and assigns it to the SortName field. -func (o *UsageAttributionPagination) SetSortName(v string) { - o.SortName = &v -} - -// GetTotalNumberOfRecords returns the TotalNumberOfRecords field value if set, zero value otherwise. -func (o *UsageAttributionPagination) GetTotalNumberOfRecords() int64 { - if o == nil || o.TotalNumberOfRecords == nil { - var ret int64 - return ret - } - return *o.TotalNumberOfRecords -} - -// GetTotalNumberOfRecordsOk returns a tuple with the TotalNumberOfRecords field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionPagination) GetTotalNumberOfRecordsOk() (*int64, bool) { - if o == nil || o.TotalNumberOfRecords == nil { - return nil, false - } - return o.TotalNumberOfRecords, true -} - -// HasTotalNumberOfRecords returns a boolean if a field has been set. -func (o *UsageAttributionPagination) HasTotalNumberOfRecords() bool { - if o != nil && o.TotalNumberOfRecords != nil { - return true - } - - return false -} - -// SetTotalNumberOfRecords gets a reference to the given int64 and assigns it to the TotalNumberOfRecords field. -func (o *UsageAttributionPagination) SetTotalNumberOfRecords(v int64) { - o.TotalNumberOfRecords = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAttributionPagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.Offset != nil { - toSerialize["offset"] = o.Offset - } - if o.SortDirection != nil { - toSerialize["sort_direction"] = o.SortDirection - } - if o.SortName != nil { - toSerialize["sort_name"] = o.SortName - } - if o.TotalNumberOfRecords != nil { - toSerialize["total_number_of_records"] = o.TotalNumberOfRecords - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Limit *int64 `json:"limit,omitempty"` - Offset *int64 `json:"offset,omitempty"` - SortDirection *string `json:"sort_direction,omitempty"` - SortName *string `json:"sort_name,omitempty"` - TotalNumberOfRecords *int64 `json:"total_number_of_records,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Limit = all.Limit - o.Offset = all.Offset - o.SortDirection = all.SortDirection - o.SortName = all.SortName - o.TotalNumberOfRecords = all.TotalNumberOfRecords - return nil -} diff --git a/api/v1/datadog/model_usage_attribution_response.go b/api/v1/datadog/model_usage_attribution_response.go deleted file mode 100644 index 27f9afd9c05..00000000000 --- a/api/v1/datadog/model_usage_attribution_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAttributionResponse Response containing the Usage Summary by tag(s). -type UsageAttributionResponse struct { - // The object containing document metadata. - Metadata *UsageAttributionMetadata `json:"metadata,omitempty"` - // Get usage summary by tag(s). - Usage []UsageAttributionBody `json:"usage,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{} -} - -// NewUsageAttributionResponse instantiates a new UsageAttributionResponse 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 NewUsageAttributionResponse() *UsageAttributionResponse { - this := UsageAttributionResponse{} - return &this -} - -// NewUsageAttributionResponseWithDefaults instantiates a new UsageAttributionResponse 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 NewUsageAttributionResponseWithDefaults() *UsageAttributionResponse { - this := UsageAttributionResponse{} - return &this -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *UsageAttributionResponse) GetMetadata() UsageAttributionMetadata { - if o == nil || o.Metadata == nil { - var ret UsageAttributionMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionResponse) GetMetadataOk() (*UsageAttributionMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *UsageAttributionResponse) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given UsageAttributionMetadata and assigns it to the Metadata field. -func (o *UsageAttributionResponse) SetMetadata(v UsageAttributionMetadata) { - o.Metadata = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageAttributionResponse) GetUsage() []UsageAttributionBody { - if o == nil || o.Usage == nil { - var ret []UsageAttributionBody - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionResponse) GetUsageOk() (*[]UsageAttributionBody, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageAttributionResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageAttributionBody and assigns it to the Usage field. -func (o *UsageAttributionResponse) SetUsage(v []UsageAttributionBody) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAttributionResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Metadata *UsageAttributionMetadata `json:"metadata,omitempty"` - Usage []UsageAttributionBody `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_attribution_sort.go b/api/v1/datadog/model_usage_attribution_sort.go deleted file mode 100644 index 58ac757a77b..00000000000 --- a/api/v1/datadog/model_usage_attribution_sort.go +++ /dev/null @@ -1,161 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsageAttributionSort The field to sort by. -type UsageAttributionSort string - -// List of UsageAttributionSort. -const ( - USAGEATTRIBUTIONSORT_API_PERCENTAGE UsageAttributionSort = "api_percentage" - USAGEATTRIBUTIONSORT_SNMP_USAGE UsageAttributionSort = "snmp_usage" - USAGEATTRIBUTIONSORT_APM_HOST_USAGE UsageAttributionSort = "apm_host_usage" - USAGEATTRIBUTIONSORT_API_USAGE UsageAttributionSort = "api_usage" - USAGEATTRIBUTIONSORT_APPSEC_USAGE UsageAttributionSort = "appsec_usage" - USAGEATTRIBUTIONSORT_APPSEC_PERCENTAGE UsageAttributionSort = "appsec_percentage" - USAGEATTRIBUTIONSORT_CONTAINER_USAGE UsageAttributionSort = "container_usage" - USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_PERCENTAGE UsageAttributionSort = "custom_timeseries_percentage" - USAGEATTRIBUTIONSORT_CONTAINER_PERCENTAGE UsageAttributionSort = "container_percentage" - USAGEATTRIBUTIONSORT_APM_HOST_PERCENTAGE UsageAttributionSort = "apm_host_percentage" - USAGEATTRIBUTIONSORT_NPM_HOST_PERCENTAGE UsageAttributionSort = "npm_host_percentage" - USAGEATTRIBUTIONSORT_BROWSER_PERCENTAGE UsageAttributionSort = "browser_percentage" - USAGEATTRIBUTIONSORT_BROWSER_USAGE UsageAttributionSort = "browser_usage" - USAGEATTRIBUTIONSORT_INFRA_HOST_PERCENTAGE UsageAttributionSort = "infra_host_percentage" - USAGEATTRIBUTIONSORT_SNMP_PERCENTAGE UsageAttributionSort = "snmp_percentage" - USAGEATTRIBUTIONSORT_NPM_HOST_USAGE UsageAttributionSort = "npm_host_usage" - USAGEATTRIBUTIONSORT_INFRA_HOST_USAGE UsageAttributionSort = "infra_host_usage" - USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_USAGE UsageAttributionSort = "custom_timeseries_usage" - USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_USAGE UsageAttributionSort = "lambda_functions_usage" - USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_PERCENTAGE UsageAttributionSort = "lambda_functions_percentage" - USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_USAGE UsageAttributionSort = "lambda_invocations_usage" - USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_PERCENTAGE UsageAttributionSort = "lambda_invocations_percentage" - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_USAGE UsageAttributionSort = "estimated_indexed_logs_usage" - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_PERCENTAGE UsageAttributionSort = "estimated_indexed_logs_percentage" - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_USAGE UsageAttributionSort = "estimated_indexed_spans_usage" - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_PERCENTAGE UsageAttributionSort = "estimated_indexed_spans_percentage" - USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_USAGE UsageAttributionSort = "estimated_ingested_spans_usage" - USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_PERCENTAGE UsageAttributionSort = "estimated_ingested_spans_percentage" -) - -var allowedUsageAttributionSortEnumValues = []UsageAttributionSort{ - USAGEATTRIBUTIONSORT_API_PERCENTAGE, - USAGEATTRIBUTIONSORT_SNMP_USAGE, - USAGEATTRIBUTIONSORT_APM_HOST_USAGE, - USAGEATTRIBUTIONSORT_API_USAGE, - USAGEATTRIBUTIONSORT_APPSEC_USAGE, - USAGEATTRIBUTIONSORT_APPSEC_PERCENTAGE, - USAGEATTRIBUTIONSORT_CONTAINER_USAGE, - USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_PERCENTAGE, - USAGEATTRIBUTIONSORT_CONTAINER_PERCENTAGE, - USAGEATTRIBUTIONSORT_APM_HOST_PERCENTAGE, - USAGEATTRIBUTIONSORT_NPM_HOST_PERCENTAGE, - USAGEATTRIBUTIONSORT_BROWSER_PERCENTAGE, - USAGEATTRIBUTIONSORT_BROWSER_USAGE, - USAGEATTRIBUTIONSORT_INFRA_HOST_PERCENTAGE, - USAGEATTRIBUTIONSORT_SNMP_PERCENTAGE, - USAGEATTRIBUTIONSORT_NPM_HOST_USAGE, - USAGEATTRIBUTIONSORT_INFRA_HOST_USAGE, - USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_USAGE, - USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_USAGE, - USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_PERCENTAGE, - USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_USAGE, - USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_PERCENTAGE, - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_USAGE, - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_PERCENTAGE, - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_USAGE, - USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_PERCENTAGE, - USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_USAGE, - USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_PERCENTAGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsageAttributionSort) GetAllowedValues() []UsageAttributionSort { - return allowedUsageAttributionSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsageAttributionSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsageAttributionSort(value) - return nil -} - -// NewUsageAttributionSortFromValue returns a pointer to a valid UsageAttributionSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsageAttributionSortFromValue(v string) (*UsageAttributionSort, error) { - ev := UsageAttributionSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsageAttributionSort: valid values are %v", v, allowedUsageAttributionSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsageAttributionSort) IsValid() bool { - for _, existing := range allowedUsageAttributionSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsageAttributionSort value. -func (v UsageAttributionSort) Ptr() *UsageAttributionSort { - return &v -} - -// NullableUsageAttributionSort handles when a null is used for UsageAttributionSort. -type NullableUsageAttributionSort struct { - value *UsageAttributionSort - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageAttributionSort) Get() *UsageAttributionSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageAttributionSort) Set(val *UsageAttributionSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageAttributionSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageAttributionSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageAttributionSort initializes the struct as if Set has been called. -func NewNullableUsageAttributionSort(val *UsageAttributionSort) *NullableUsageAttributionSort { - return &NullableUsageAttributionSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageAttributionSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageAttributionSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_usage_attribution_supported_metrics.go b/api/v1/datadog/model_usage_attribution_supported_metrics.go deleted file mode 100644 index f2130b1025d..00000000000 --- a/api/v1/datadog/model_usage_attribution_supported_metrics.go +++ /dev/null @@ -1,183 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsageAttributionSupportedMetrics Supported fields for usage attribution requests (valid requests contain one or more metrics, or `*` for all). -type UsageAttributionSupportedMetrics string - -// List of UsageAttributionSupportedMetrics. -const ( - USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE UsageAttributionSupportedMetrics = "custom_timeseries_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE UsageAttributionSupportedMetrics = "container_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE UsageAttributionSupportedMetrics = "snmp_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE UsageAttributionSupportedMetrics = "apm_host_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE UsageAttributionSupportedMetrics = "browser_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "npm_host_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE UsageAttributionSupportedMetrics = "infra_host_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE UsageAttributionSupportedMetrics = "custom_timeseries_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE UsageAttributionSupportedMetrics = "container_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE UsageAttributionSupportedMetrics = "api_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "apm_host_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "infra_host_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE UsageAttributionSupportedMetrics = "snmp_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE UsageAttributionSupportedMetrics = "browser_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE UsageAttributionSupportedMetrics = "api_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE UsageAttributionSupportedMetrics = "npm_host_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_USAGE UsageAttributionSupportedMetrics = "lambda_functions_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_PERCENTAGE UsageAttributionSupportedMetrics = "lambda_functions_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_USAGE UsageAttributionSupportedMetrics = "lambda_invocations_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_PERCENTAGE UsageAttributionSupportedMetrics = "lambda_invocations_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE UsageAttributionSupportedMetrics = "fargate_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE UsageAttributionSupportedMetrics = "fargate_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE UsageAttributionSupportedMetrics = "profiled_host_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "profiled_host_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE UsageAttributionSupportedMetrics = "profiled_container_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE UsageAttributionSupportedMetrics = "profiled_container_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE UsageAttributionSupportedMetrics = "dbm_hosts_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE UsageAttributionSupportedMetrics = "dbm_hosts_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE UsageAttributionSupportedMetrics = "dbm_queries_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE UsageAttributionSupportedMetrics = "dbm_queries_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE UsageAttributionSupportedMetrics = "estimated_indexed_logs_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE UsageAttributionSupportedMetrics = "estimated_indexed_logs_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE UsageAttributionSupportedMetrics = "appsec_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE UsageAttributionSupportedMetrics = "appsec_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE UsageAttributionSupportedMetrics = "estimated_indexed_spans_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE UsageAttributionSupportedMetrics = "estimated_indexed_spans_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE UsageAttributionSupportedMetrics = "estimated_ingested_spans_usage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE UsageAttributionSupportedMetrics = "estimated_ingested_spans_percentage" - USAGEATTRIBUTIONSUPPORTEDMETRICS_ALL UsageAttributionSupportedMetrics = "*" -) - -var allowedUsageAttributionSupportedMetricsEnumValues = []UsageAttributionSupportedMetrics{ - USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE, - USAGEATTRIBUTIONSUPPORTEDMETRICS_ALL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsageAttributionSupportedMetrics) GetAllowedValues() []UsageAttributionSupportedMetrics { - return allowedUsageAttributionSupportedMetricsEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsageAttributionSupportedMetrics(value) - return nil -} - -// NewUsageAttributionSupportedMetricsFromValue returns a pointer to a valid UsageAttributionSupportedMetrics -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsageAttributionSupportedMetricsFromValue(v string) (*UsageAttributionSupportedMetrics, error) { - ev := UsageAttributionSupportedMetrics(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsageAttributionSupportedMetrics: valid values are %v", v, allowedUsageAttributionSupportedMetricsEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsageAttributionSupportedMetrics) IsValid() bool { - for _, existing := range allowedUsageAttributionSupportedMetricsEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsageAttributionSupportedMetrics value. -func (v UsageAttributionSupportedMetrics) Ptr() *UsageAttributionSupportedMetrics { - return &v -} - -// NullableUsageAttributionSupportedMetrics handles when a null is used for UsageAttributionSupportedMetrics. -type NullableUsageAttributionSupportedMetrics struct { - value *UsageAttributionSupportedMetrics - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageAttributionSupportedMetrics) Get() *UsageAttributionSupportedMetrics { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageAttributionSupportedMetrics) Set(val *UsageAttributionSupportedMetrics) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageAttributionSupportedMetrics) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageAttributionSupportedMetrics) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageAttributionSupportedMetrics initializes the struct as if Set has been called. -func NewNullableUsageAttributionSupportedMetrics(val *UsageAttributionSupportedMetrics) *NullableUsageAttributionSupportedMetrics { - return &NullableUsageAttributionSupportedMetrics{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageAttributionSupportedMetrics) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_usage_attribution_values.go b/api/v1/datadog/model_usage_attribution_values.go deleted file mode 100644 index 0f9bfe0a271..00000000000 --- a/api/v1/datadog/model_usage_attribution_values.go +++ /dev/null @@ -1,1779 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAttributionValues Fields in Usage Summary by tag(s). -type UsageAttributionValues struct { - // The percentage of synthetic API test usage by tag(s). - ApiPercentage *float64 `json:"api_percentage,omitempty"` - // The synthetic API test usage by tag(s). - ApiUsage *float64 `json:"api_usage,omitempty"` - // The percentage of APM host usage by tag(s). - ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` - // The APM host usage by tag(s). - ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` - // The percentage of Application Security Monitoring host usage by tag(s). - AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` - // The Application Security Monitoring host usage by tag(s). - AppsecUsage *float64 `json:"appsec_usage,omitempty"` - // The percentage of synthetic browser test usage by tag(s). - BrowserPercentage *float64 `json:"browser_percentage,omitempty"` - // The synthetic browser test usage by tag(s). - BrowserUsage *float64 `json:"browser_usage,omitempty"` - // The percentage of container usage by tag(s). - ContainerPercentage *float64 `json:"container_percentage,omitempty"` - // The container usage by tag(s). - ContainerUsage *float64 `json:"container_usage,omitempty"` - // The percentage of Cloud Security Posture Management container usage by tag(s) - CspmContainerPercentage *float64 `json:"cspm_container_percentage,omitempty"` - // The Cloud Security Posture Management container usage by tag(s) - CspmContainerUsage *float64 `json:"cspm_container_usage,omitempty"` - // The percentage of Cloud Security Posture Management host usage by tag(s) - CspmHostPercentage *float64 `json:"cspm_host_percentage,omitempty"` - // The Cloud Security Posture Management host usage by tag(s) - CspmHostUsage *float64 `json:"cspm_host_usage,omitempty"` - // The percentage of custom metrics usage by tag(s). - CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` - // The custom metrics usage by tag(s). - CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` - // The percentage of Cloud Workload Security container usage by tag(s) - CwsContainerPercentage *float64 `json:"cws_container_percentage,omitempty"` - // The Cloud Workload Security container usage by tag(s) - CwsContainerUsage *float64 `json:"cws_container_usage,omitempty"` - // The percentage of Cloud Workload Security host usage by tag(s) - CwsHostPercentage *float64 `json:"cws_host_percentage,omitempty"` - // The Cloud Workload Security host usage by tag(s) - CwsHostUsage *float64 `json:"cws_host_usage,omitempty"` - // The percentage of Database Monitoring host usage by tag(s). - DbmHostsPercentage *float64 `json:"dbm_hosts_percentage,omitempty"` - // The Database Monitoring host usage by tag(s). - DbmHostsUsage *float64 `json:"dbm_hosts_usage,omitempty"` - // The percentage of Database Monitoring normalized queries usage by tag(s). - DbmQueriesPercentage *float64 `json:"dbm_queries_percentage,omitempty"` - // The Database Monitoring normalized queries usage by tag(s). - DbmQueriesUsage *float64 `json:"dbm_queries_usage,omitempty"` - // The percentage of estimated live indexed logs usage by tag(s). Note this field is in private beta. - EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` - // The estimated live indexed logs usage by tag(s). Note this field is in private beta. - EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` - // The percentage of estimated indexed spans usage by tag(s). Note this field is in private beta. - EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` - // The estimated indexed spans usage by tag(s). Note this field is in private beta. - EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` - // The percentage of estimated ingested spans usage by tag(s). Note this field is in private beta. - EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` - // The estimated ingested spans usage by tag(s). Note this field is in private beta. - EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` - // The percentage of infrastructure host usage by tag(s). - InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` - // The infrastructure host usage by tag(s). - InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` - // The percentage of Lambda function usage by tag(s). - LambdaFunctionsPercentage *float64 `json:"lambda_functions_percentage,omitempty"` - // The Lambda function usage by tag(s). - LambdaFunctionsUsage *float64 `json:"lambda_functions_usage,omitempty"` - // The percentage of Lambda invocation usage by tag(s). - LambdaInvocationsPercentage *float64 `json:"lambda_invocations_percentage,omitempty"` - // The Lambda invocation usage by tag(s). - LambdaInvocationsUsage *float64 `json:"lambda_invocations_usage,omitempty"` - // The percentage of network host usage by tag(s). - NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` - // The network host usage by tag(s). - NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` - // The percentage of profiled containers usage by tag(s). - ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` - // The profiled container usage by tag(s). - ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` - // The percentage of profiled hosts usage by tag(s). - ProfiledHostsPercentage *float64 `json:"profiled_hosts_percentage,omitempty"` - // The profiled host usage by tag(s). - ProfiledHostsUsage *float64 `json:"profiled_hosts_usage,omitempty"` - // The percentage of network device usage by tag(s). - SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` - // The network device usage by tag(s). - SnmpUsage *float64 `json:"snmp_usage,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{} -} - -// NewUsageAttributionValues instantiates a new UsageAttributionValues 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 NewUsageAttributionValues() *UsageAttributionValues { - this := UsageAttributionValues{} - return &this -} - -// NewUsageAttributionValuesWithDefaults instantiates a new UsageAttributionValues 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 NewUsageAttributionValuesWithDefaults() *UsageAttributionValues { - this := UsageAttributionValues{} - return &this -} - -// GetApiPercentage returns the ApiPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetApiPercentage() float64 { - if o == nil || o.ApiPercentage == nil { - var ret float64 - return ret - } - return *o.ApiPercentage -} - -// GetApiPercentageOk returns a tuple with the ApiPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetApiPercentageOk() (*float64, bool) { - if o == nil || o.ApiPercentage == nil { - return nil, false - } - return o.ApiPercentage, true -} - -// HasApiPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasApiPercentage() bool { - if o != nil && o.ApiPercentage != nil { - return true - } - - return false -} - -// SetApiPercentage gets a reference to the given float64 and assigns it to the ApiPercentage field. -func (o *UsageAttributionValues) SetApiPercentage(v float64) { - o.ApiPercentage = &v -} - -// GetApiUsage returns the ApiUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetApiUsage() float64 { - if o == nil || o.ApiUsage == nil { - var ret float64 - return ret - } - return *o.ApiUsage -} - -// GetApiUsageOk returns a tuple with the ApiUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetApiUsageOk() (*float64, bool) { - if o == nil || o.ApiUsage == nil { - return nil, false - } - return o.ApiUsage, true -} - -// HasApiUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasApiUsage() bool { - if o != nil && o.ApiUsage != nil { - return true - } - - return false -} - -// SetApiUsage gets a reference to the given float64 and assigns it to the ApiUsage field. -func (o *UsageAttributionValues) SetApiUsage(v float64) { - o.ApiUsage = &v -} - -// GetApmHostPercentage returns the ApmHostPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetApmHostPercentage() float64 { - if o == nil || o.ApmHostPercentage == nil { - var ret float64 - return ret - } - return *o.ApmHostPercentage -} - -// GetApmHostPercentageOk returns a tuple with the ApmHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetApmHostPercentageOk() (*float64, bool) { - if o == nil || o.ApmHostPercentage == nil { - return nil, false - } - return o.ApmHostPercentage, true -} - -// HasApmHostPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasApmHostPercentage() bool { - if o != nil && o.ApmHostPercentage != nil { - return true - } - - return false -} - -// SetApmHostPercentage gets a reference to the given float64 and assigns it to the ApmHostPercentage field. -func (o *UsageAttributionValues) SetApmHostPercentage(v float64) { - o.ApmHostPercentage = &v -} - -// GetApmHostUsage returns the ApmHostUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetApmHostUsage() float64 { - if o == nil || o.ApmHostUsage == nil { - var ret float64 - return ret - } - return *o.ApmHostUsage -} - -// GetApmHostUsageOk returns a tuple with the ApmHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetApmHostUsageOk() (*float64, bool) { - if o == nil || o.ApmHostUsage == nil { - return nil, false - } - return o.ApmHostUsage, true -} - -// HasApmHostUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasApmHostUsage() bool { - if o != nil && o.ApmHostUsage != nil { - return true - } - - return false -} - -// SetApmHostUsage gets a reference to the given float64 and assigns it to the ApmHostUsage field. -func (o *UsageAttributionValues) SetApmHostUsage(v float64) { - o.ApmHostUsage = &v -} - -// GetAppsecPercentage returns the AppsecPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetAppsecPercentage() float64 { - if o == nil || o.AppsecPercentage == nil { - var ret float64 - return ret - } - return *o.AppsecPercentage -} - -// GetAppsecPercentageOk returns a tuple with the AppsecPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetAppsecPercentageOk() (*float64, bool) { - if o == nil || o.AppsecPercentage == nil { - return nil, false - } - return o.AppsecPercentage, true -} - -// HasAppsecPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasAppsecPercentage() bool { - if o != nil && o.AppsecPercentage != nil { - return true - } - - return false -} - -// SetAppsecPercentage gets a reference to the given float64 and assigns it to the AppsecPercentage field. -func (o *UsageAttributionValues) SetAppsecPercentage(v float64) { - o.AppsecPercentage = &v -} - -// GetAppsecUsage returns the AppsecUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetAppsecUsage() float64 { - if o == nil || o.AppsecUsage == nil { - var ret float64 - return ret - } - return *o.AppsecUsage -} - -// GetAppsecUsageOk returns a tuple with the AppsecUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetAppsecUsageOk() (*float64, bool) { - if o == nil || o.AppsecUsage == nil { - return nil, false - } - return o.AppsecUsage, true -} - -// HasAppsecUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasAppsecUsage() bool { - if o != nil && o.AppsecUsage != nil { - return true - } - - return false -} - -// SetAppsecUsage gets a reference to the given float64 and assigns it to the AppsecUsage field. -func (o *UsageAttributionValues) SetAppsecUsage(v float64) { - o.AppsecUsage = &v -} - -// GetBrowserPercentage returns the BrowserPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetBrowserPercentage() float64 { - if o == nil || o.BrowserPercentage == nil { - var ret float64 - return ret - } - return *o.BrowserPercentage -} - -// GetBrowserPercentageOk returns a tuple with the BrowserPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetBrowserPercentageOk() (*float64, bool) { - if o == nil || o.BrowserPercentage == nil { - return nil, false - } - return o.BrowserPercentage, true -} - -// HasBrowserPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasBrowserPercentage() bool { - if o != nil && o.BrowserPercentage != nil { - return true - } - - return false -} - -// SetBrowserPercentage gets a reference to the given float64 and assigns it to the BrowserPercentage field. -func (o *UsageAttributionValues) SetBrowserPercentage(v float64) { - o.BrowserPercentage = &v -} - -// GetBrowserUsage returns the BrowserUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetBrowserUsage() float64 { - if o == nil || o.BrowserUsage == nil { - var ret float64 - return ret - } - return *o.BrowserUsage -} - -// GetBrowserUsageOk returns a tuple with the BrowserUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetBrowserUsageOk() (*float64, bool) { - if o == nil || o.BrowserUsage == nil { - return nil, false - } - return o.BrowserUsage, true -} - -// HasBrowserUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasBrowserUsage() bool { - if o != nil && o.BrowserUsage != nil { - return true - } - - return false -} - -// SetBrowserUsage gets a reference to the given float64 and assigns it to the BrowserUsage field. -func (o *UsageAttributionValues) SetBrowserUsage(v float64) { - o.BrowserUsage = &v -} - -// GetContainerPercentage returns the ContainerPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetContainerPercentage() float64 { - if o == nil || o.ContainerPercentage == nil { - var ret float64 - return ret - } - return *o.ContainerPercentage -} - -// GetContainerPercentageOk returns a tuple with the ContainerPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetContainerPercentageOk() (*float64, bool) { - if o == nil || o.ContainerPercentage == nil { - return nil, false - } - return o.ContainerPercentage, true -} - -// HasContainerPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasContainerPercentage() bool { - if o != nil && o.ContainerPercentage != nil { - return true - } - - return false -} - -// SetContainerPercentage gets a reference to the given float64 and assigns it to the ContainerPercentage field. -func (o *UsageAttributionValues) SetContainerPercentage(v float64) { - o.ContainerPercentage = &v -} - -// GetContainerUsage returns the ContainerUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetContainerUsage() float64 { - if o == nil || o.ContainerUsage == nil { - var ret float64 - return ret - } - return *o.ContainerUsage -} - -// GetContainerUsageOk returns a tuple with the ContainerUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetContainerUsageOk() (*float64, bool) { - if o == nil || o.ContainerUsage == nil { - return nil, false - } - return o.ContainerUsage, true -} - -// HasContainerUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasContainerUsage() bool { - if o != nil && o.ContainerUsage != nil { - return true - } - - return false -} - -// SetContainerUsage gets a reference to the given float64 and assigns it to the ContainerUsage field. -func (o *UsageAttributionValues) SetContainerUsage(v float64) { - o.ContainerUsage = &v -} - -// GetCspmContainerPercentage returns the CspmContainerPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCspmContainerPercentage() float64 { - if o == nil || o.CspmContainerPercentage == nil { - var ret float64 - return ret - } - return *o.CspmContainerPercentage -} - -// GetCspmContainerPercentageOk returns a tuple with the CspmContainerPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCspmContainerPercentageOk() (*float64, bool) { - if o == nil || o.CspmContainerPercentage == nil { - return nil, false - } - return o.CspmContainerPercentage, true -} - -// HasCspmContainerPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCspmContainerPercentage() bool { - if o != nil && o.CspmContainerPercentage != nil { - return true - } - - return false -} - -// SetCspmContainerPercentage gets a reference to the given float64 and assigns it to the CspmContainerPercentage field. -func (o *UsageAttributionValues) SetCspmContainerPercentage(v float64) { - o.CspmContainerPercentage = &v -} - -// GetCspmContainerUsage returns the CspmContainerUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCspmContainerUsage() float64 { - if o == nil || o.CspmContainerUsage == nil { - var ret float64 - return ret - } - return *o.CspmContainerUsage -} - -// GetCspmContainerUsageOk returns a tuple with the CspmContainerUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCspmContainerUsageOk() (*float64, bool) { - if o == nil || o.CspmContainerUsage == nil { - return nil, false - } - return o.CspmContainerUsage, true -} - -// HasCspmContainerUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCspmContainerUsage() bool { - if o != nil && o.CspmContainerUsage != nil { - return true - } - - return false -} - -// SetCspmContainerUsage gets a reference to the given float64 and assigns it to the CspmContainerUsage field. -func (o *UsageAttributionValues) SetCspmContainerUsage(v float64) { - o.CspmContainerUsage = &v -} - -// GetCspmHostPercentage returns the CspmHostPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCspmHostPercentage() float64 { - if o == nil || o.CspmHostPercentage == nil { - var ret float64 - return ret - } - return *o.CspmHostPercentage -} - -// GetCspmHostPercentageOk returns a tuple with the CspmHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCspmHostPercentageOk() (*float64, bool) { - if o == nil || o.CspmHostPercentage == nil { - return nil, false - } - return o.CspmHostPercentage, true -} - -// HasCspmHostPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCspmHostPercentage() bool { - if o != nil && o.CspmHostPercentage != nil { - return true - } - - return false -} - -// SetCspmHostPercentage gets a reference to the given float64 and assigns it to the CspmHostPercentage field. -func (o *UsageAttributionValues) SetCspmHostPercentage(v float64) { - o.CspmHostPercentage = &v -} - -// GetCspmHostUsage returns the CspmHostUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCspmHostUsage() float64 { - if o == nil || o.CspmHostUsage == nil { - var ret float64 - return ret - } - return *o.CspmHostUsage -} - -// GetCspmHostUsageOk returns a tuple with the CspmHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCspmHostUsageOk() (*float64, bool) { - if o == nil || o.CspmHostUsage == nil { - return nil, false - } - return o.CspmHostUsage, true -} - -// HasCspmHostUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCspmHostUsage() bool { - if o != nil && o.CspmHostUsage != nil { - return true - } - - return false -} - -// SetCspmHostUsage gets a reference to the given float64 and assigns it to the CspmHostUsage field. -func (o *UsageAttributionValues) SetCspmHostUsage(v float64) { - o.CspmHostUsage = &v -} - -// GetCustomTimeseriesPercentage returns the CustomTimeseriesPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCustomTimeseriesPercentage() float64 { - if o == nil || o.CustomTimeseriesPercentage == nil { - var ret float64 - return ret - } - return *o.CustomTimeseriesPercentage -} - -// GetCustomTimeseriesPercentageOk returns a tuple with the CustomTimeseriesPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCustomTimeseriesPercentageOk() (*float64, bool) { - if o == nil || o.CustomTimeseriesPercentage == nil { - return nil, false - } - return o.CustomTimeseriesPercentage, true -} - -// HasCustomTimeseriesPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCustomTimeseriesPercentage() bool { - if o != nil && o.CustomTimeseriesPercentage != nil { - return true - } - - return false -} - -// SetCustomTimeseriesPercentage gets a reference to the given float64 and assigns it to the CustomTimeseriesPercentage field. -func (o *UsageAttributionValues) SetCustomTimeseriesPercentage(v float64) { - o.CustomTimeseriesPercentage = &v -} - -// GetCustomTimeseriesUsage returns the CustomTimeseriesUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCustomTimeseriesUsage() float64 { - if o == nil || o.CustomTimeseriesUsage == nil { - var ret float64 - return ret - } - return *o.CustomTimeseriesUsage -} - -// GetCustomTimeseriesUsageOk returns a tuple with the CustomTimeseriesUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCustomTimeseriesUsageOk() (*float64, bool) { - if o == nil || o.CustomTimeseriesUsage == nil { - return nil, false - } - return o.CustomTimeseriesUsage, true -} - -// HasCustomTimeseriesUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCustomTimeseriesUsage() bool { - if o != nil && o.CustomTimeseriesUsage != nil { - return true - } - - return false -} - -// SetCustomTimeseriesUsage gets a reference to the given float64 and assigns it to the CustomTimeseriesUsage field. -func (o *UsageAttributionValues) SetCustomTimeseriesUsage(v float64) { - o.CustomTimeseriesUsage = &v -} - -// GetCwsContainerPercentage returns the CwsContainerPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCwsContainerPercentage() float64 { - if o == nil || o.CwsContainerPercentage == nil { - var ret float64 - return ret - } - return *o.CwsContainerPercentage -} - -// GetCwsContainerPercentageOk returns a tuple with the CwsContainerPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCwsContainerPercentageOk() (*float64, bool) { - if o == nil || o.CwsContainerPercentage == nil { - return nil, false - } - return o.CwsContainerPercentage, true -} - -// HasCwsContainerPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCwsContainerPercentage() bool { - if o != nil && o.CwsContainerPercentage != nil { - return true - } - - return false -} - -// SetCwsContainerPercentage gets a reference to the given float64 and assigns it to the CwsContainerPercentage field. -func (o *UsageAttributionValues) SetCwsContainerPercentage(v float64) { - o.CwsContainerPercentage = &v -} - -// GetCwsContainerUsage returns the CwsContainerUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCwsContainerUsage() float64 { - if o == nil || o.CwsContainerUsage == nil { - var ret float64 - return ret - } - return *o.CwsContainerUsage -} - -// GetCwsContainerUsageOk returns a tuple with the CwsContainerUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCwsContainerUsageOk() (*float64, bool) { - if o == nil || o.CwsContainerUsage == nil { - return nil, false - } - return o.CwsContainerUsage, true -} - -// HasCwsContainerUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCwsContainerUsage() bool { - if o != nil && o.CwsContainerUsage != nil { - return true - } - - return false -} - -// SetCwsContainerUsage gets a reference to the given float64 and assigns it to the CwsContainerUsage field. -func (o *UsageAttributionValues) SetCwsContainerUsage(v float64) { - o.CwsContainerUsage = &v -} - -// GetCwsHostPercentage returns the CwsHostPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCwsHostPercentage() float64 { - if o == nil || o.CwsHostPercentage == nil { - var ret float64 - return ret - } - return *o.CwsHostPercentage -} - -// GetCwsHostPercentageOk returns a tuple with the CwsHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCwsHostPercentageOk() (*float64, bool) { - if o == nil || o.CwsHostPercentage == nil { - return nil, false - } - return o.CwsHostPercentage, true -} - -// HasCwsHostPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCwsHostPercentage() bool { - if o != nil && o.CwsHostPercentage != nil { - return true - } - - return false -} - -// SetCwsHostPercentage gets a reference to the given float64 and assigns it to the CwsHostPercentage field. -func (o *UsageAttributionValues) SetCwsHostPercentage(v float64) { - o.CwsHostPercentage = &v -} - -// GetCwsHostUsage returns the CwsHostUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetCwsHostUsage() float64 { - if o == nil || o.CwsHostUsage == nil { - var ret float64 - return ret - } - return *o.CwsHostUsage -} - -// GetCwsHostUsageOk returns a tuple with the CwsHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetCwsHostUsageOk() (*float64, bool) { - if o == nil || o.CwsHostUsage == nil { - return nil, false - } - return o.CwsHostUsage, true -} - -// HasCwsHostUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasCwsHostUsage() bool { - if o != nil && o.CwsHostUsage != nil { - return true - } - - return false -} - -// SetCwsHostUsage gets a reference to the given float64 and assigns it to the CwsHostUsage field. -func (o *UsageAttributionValues) SetCwsHostUsage(v float64) { - o.CwsHostUsage = &v -} - -// GetDbmHostsPercentage returns the DbmHostsPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetDbmHostsPercentage() float64 { - if o == nil || o.DbmHostsPercentage == nil { - var ret float64 - return ret - } - return *o.DbmHostsPercentage -} - -// GetDbmHostsPercentageOk returns a tuple with the DbmHostsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetDbmHostsPercentageOk() (*float64, bool) { - if o == nil || o.DbmHostsPercentage == nil { - return nil, false - } - return o.DbmHostsPercentage, true -} - -// HasDbmHostsPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasDbmHostsPercentage() bool { - if o != nil && o.DbmHostsPercentage != nil { - return true - } - - return false -} - -// SetDbmHostsPercentage gets a reference to the given float64 and assigns it to the DbmHostsPercentage field. -func (o *UsageAttributionValues) SetDbmHostsPercentage(v float64) { - o.DbmHostsPercentage = &v -} - -// GetDbmHostsUsage returns the DbmHostsUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetDbmHostsUsage() float64 { - if o == nil || o.DbmHostsUsage == nil { - var ret float64 - return ret - } - return *o.DbmHostsUsage -} - -// GetDbmHostsUsageOk returns a tuple with the DbmHostsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetDbmHostsUsageOk() (*float64, bool) { - if o == nil || o.DbmHostsUsage == nil { - return nil, false - } - return o.DbmHostsUsage, true -} - -// HasDbmHostsUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasDbmHostsUsage() bool { - if o != nil && o.DbmHostsUsage != nil { - return true - } - - return false -} - -// SetDbmHostsUsage gets a reference to the given float64 and assigns it to the DbmHostsUsage field. -func (o *UsageAttributionValues) SetDbmHostsUsage(v float64) { - o.DbmHostsUsage = &v -} - -// GetDbmQueriesPercentage returns the DbmQueriesPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetDbmQueriesPercentage() float64 { - if o == nil || o.DbmQueriesPercentage == nil { - var ret float64 - return ret - } - return *o.DbmQueriesPercentage -} - -// GetDbmQueriesPercentageOk returns a tuple with the DbmQueriesPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetDbmQueriesPercentageOk() (*float64, bool) { - if o == nil || o.DbmQueriesPercentage == nil { - return nil, false - } - return o.DbmQueriesPercentage, true -} - -// HasDbmQueriesPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasDbmQueriesPercentage() bool { - if o != nil && o.DbmQueriesPercentage != nil { - return true - } - - return false -} - -// SetDbmQueriesPercentage gets a reference to the given float64 and assigns it to the DbmQueriesPercentage field. -func (o *UsageAttributionValues) SetDbmQueriesPercentage(v float64) { - o.DbmQueriesPercentage = &v -} - -// GetDbmQueriesUsage returns the DbmQueriesUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetDbmQueriesUsage() float64 { - if o == nil || o.DbmQueriesUsage == nil { - var ret float64 - return ret - } - return *o.DbmQueriesUsage -} - -// GetDbmQueriesUsageOk returns a tuple with the DbmQueriesUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetDbmQueriesUsageOk() (*float64, bool) { - if o == nil || o.DbmQueriesUsage == nil { - return nil, false - } - return o.DbmQueriesUsage, true -} - -// HasDbmQueriesUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasDbmQueriesUsage() bool { - if o != nil && o.DbmQueriesUsage != nil { - return true - } - - return false -} - -// SetDbmQueriesUsage gets a reference to the given float64 and assigns it to the DbmQueriesUsage field. -func (o *UsageAttributionValues) SetDbmQueriesUsage(v float64) { - o.DbmQueriesUsage = &v -} - -// GetEstimatedIndexedLogsPercentage returns the EstimatedIndexedLogsPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetEstimatedIndexedLogsPercentage() float64 { - if o == nil || o.EstimatedIndexedLogsPercentage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedLogsPercentage -} - -// GetEstimatedIndexedLogsPercentageOk returns a tuple with the EstimatedIndexedLogsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetEstimatedIndexedLogsPercentageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedLogsPercentage == nil { - return nil, false - } - return o.EstimatedIndexedLogsPercentage, true -} - -// HasEstimatedIndexedLogsPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasEstimatedIndexedLogsPercentage() bool { - if o != nil && o.EstimatedIndexedLogsPercentage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedLogsPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsPercentage field. -func (o *UsageAttributionValues) SetEstimatedIndexedLogsPercentage(v float64) { - o.EstimatedIndexedLogsPercentage = &v -} - -// GetEstimatedIndexedLogsUsage returns the EstimatedIndexedLogsUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetEstimatedIndexedLogsUsage() float64 { - if o == nil || o.EstimatedIndexedLogsUsage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedLogsUsage -} - -// GetEstimatedIndexedLogsUsageOk returns a tuple with the EstimatedIndexedLogsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetEstimatedIndexedLogsUsageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedLogsUsage == nil { - return nil, false - } - return o.EstimatedIndexedLogsUsage, true -} - -// HasEstimatedIndexedLogsUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasEstimatedIndexedLogsUsage() bool { - if o != nil && o.EstimatedIndexedLogsUsage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedLogsUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsUsage field. -func (o *UsageAttributionValues) SetEstimatedIndexedLogsUsage(v float64) { - o.EstimatedIndexedLogsUsage = &v -} - -// GetEstimatedIndexedSpansPercentage returns the EstimatedIndexedSpansPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetEstimatedIndexedSpansPercentage() float64 { - if o == nil || o.EstimatedIndexedSpansPercentage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedSpansPercentage -} - -// GetEstimatedIndexedSpansPercentageOk returns a tuple with the EstimatedIndexedSpansPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetEstimatedIndexedSpansPercentageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedSpansPercentage == nil { - return nil, false - } - return o.EstimatedIndexedSpansPercentage, true -} - -// HasEstimatedIndexedSpansPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasEstimatedIndexedSpansPercentage() bool { - if o != nil && o.EstimatedIndexedSpansPercentage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansPercentage field. -func (o *UsageAttributionValues) SetEstimatedIndexedSpansPercentage(v float64) { - o.EstimatedIndexedSpansPercentage = &v -} - -// GetEstimatedIndexedSpansUsage returns the EstimatedIndexedSpansUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetEstimatedIndexedSpansUsage() float64 { - if o == nil || o.EstimatedIndexedSpansUsage == nil { - var ret float64 - return ret - } - return *o.EstimatedIndexedSpansUsage -} - -// GetEstimatedIndexedSpansUsageOk returns a tuple with the EstimatedIndexedSpansUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetEstimatedIndexedSpansUsageOk() (*float64, bool) { - if o == nil || o.EstimatedIndexedSpansUsage == nil { - return nil, false - } - return o.EstimatedIndexedSpansUsage, true -} - -// HasEstimatedIndexedSpansUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasEstimatedIndexedSpansUsage() bool { - if o != nil && o.EstimatedIndexedSpansUsage != nil { - return true - } - - return false -} - -// SetEstimatedIndexedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansUsage field. -func (o *UsageAttributionValues) SetEstimatedIndexedSpansUsage(v float64) { - o.EstimatedIndexedSpansUsage = &v -} - -// GetEstimatedIngestedSpansPercentage returns the EstimatedIngestedSpansPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetEstimatedIngestedSpansPercentage() float64 { - if o == nil || o.EstimatedIngestedSpansPercentage == nil { - var ret float64 - return ret - } - return *o.EstimatedIngestedSpansPercentage -} - -// GetEstimatedIngestedSpansPercentageOk returns a tuple with the EstimatedIngestedSpansPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetEstimatedIngestedSpansPercentageOk() (*float64, bool) { - if o == nil || o.EstimatedIngestedSpansPercentage == nil { - return nil, false - } - return o.EstimatedIngestedSpansPercentage, true -} - -// HasEstimatedIngestedSpansPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasEstimatedIngestedSpansPercentage() bool { - if o != nil && o.EstimatedIngestedSpansPercentage != nil { - return true - } - - return false -} - -// SetEstimatedIngestedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansPercentage field. -func (o *UsageAttributionValues) SetEstimatedIngestedSpansPercentage(v float64) { - o.EstimatedIngestedSpansPercentage = &v -} - -// GetEstimatedIngestedSpansUsage returns the EstimatedIngestedSpansUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetEstimatedIngestedSpansUsage() float64 { - if o == nil || o.EstimatedIngestedSpansUsage == nil { - var ret float64 - return ret - } - return *o.EstimatedIngestedSpansUsage -} - -// GetEstimatedIngestedSpansUsageOk returns a tuple with the EstimatedIngestedSpansUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetEstimatedIngestedSpansUsageOk() (*float64, bool) { - if o == nil || o.EstimatedIngestedSpansUsage == nil { - return nil, false - } - return o.EstimatedIngestedSpansUsage, true -} - -// HasEstimatedIngestedSpansUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasEstimatedIngestedSpansUsage() bool { - if o != nil && o.EstimatedIngestedSpansUsage != nil { - return true - } - - return false -} - -// SetEstimatedIngestedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansUsage field. -func (o *UsageAttributionValues) SetEstimatedIngestedSpansUsage(v float64) { - o.EstimatedIngestedSpansUsage = &v -} - -// GetInfraHostPercentage returns the InfraHostPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetInfraHostPercentage() float64 { - if o == nil || o.InfraHostPercentage == nil { - var ret float64 - return ret - } - return *o.InfraHostPercentage -} - -// GetInfraHostPercentageOk returns a tuple with the InfraHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetInfraHostPercentageOk() (*float64, bool) { - if o == nil || o.InfraHostPercentage == nil { - return nil, false - } - return o.InfraHostPercentage, true -} - -// HasInfraHostPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasInfraHostPercentage() bool { - if o != nil && o.InfraHostPercentage != nil { - return true - } - - return false -} - -// SetInfraHostPercentage gets a reference to the given float64 and assigns it to the InfraHostPercentage field. -func (o *UsageAttributionValues) SetInfraHostPercentage(v float64) { - o.InfraHostPercentage = &v -} - -// GetInfraHostUsage returns the InfraHostUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetInfraHostUsage() float64 { - if o == nil || o.InfraHostUsage == nil { - var ret float64 - return ret - } - return *o.InfraHostUsage -} - -// GetInfraHostUsageOk returns a tuple with the InfraHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetInfraHostUsageOk() (*float64, bool) { - if o == nil || o.InfraHostUsage == nil { - return nil, false - } - return o.InfraHostUsage, true -} - -// HasInfraHostUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasInfraHostUsage() bool { - if o != nil && o.InfraHostUsage != nil { - return true - } - - return false -} - -// SetInfraHostUsage gets a reference to the given float64 and assigns it to the InfraHostUsage field. -func (o *UsageAttributionValues) SetInfraHostUsage(v float64) { - o.InfraHostUsage = &v -} - -// GetLambdaFunctionsPercentage returns the LambdaFunctionsPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetLambdaFunctionsPercentage() float64 { - if o == nil || o.LambdaFunctionsPercentage == nil { - var ret float64 - return ret - } - return *o.LambdaFunctionsPercentage -} - -// GetLambdaFunctionsPercentageOk returns a tuple with the LambdaFunctionsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetLambdaFunctionsPercentageOk() (*float64, bool) { - if o == nil || o.LambdaFunctionsPercentage == nil { - return nil, false - } - return o.LambdaFunctionsPercentage, true -} - -// HasLambdaFunctionsPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasLambdaFunctionsPercentage() bool { - if o != nil && o.LambdaFunctionsPercentage != nil { - return true - } - - return false -} - -// SetLambdaFunctionsPercentage gets a reference to the given float64 and assigns it to the LambdaFunctionsPercentage field. -func (o *UsageAttributionValues) SetLambdaFunctionsPercentage(v float64) { - o.LambdaFunctionsPercentage = &v -} - -// GetLambdaFunctionsUsage returns the LambdaFunctionsUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetLambdaFunctionsUsage() float64 { - if o == nil || o.LambdaFunctionsUsage == nil { - var ret float64 - return ret - } - return *o.LambdaFunctionsUsage -} - -// GetLambdaFunctionsUsageOk returns a tuple with the LambdaFunctionsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetLambdaFunctionsUsageOk() (*float64, bool) { - if o == nil || o.LambdaFunctionsUsage == nil { - return nil, false - } - return o.LambdaFunctionsUsage, true -} - -// HasLambdaFunctionsUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasLambdaFunctionsUsage() bool { - if o != nil && o.LambdaFunctionsUsage != nil { - return true - } - - return false -} - -// SetLambdaFunctionsUsage gets a reference to the given float64 and assigns it to the LambdaFunctionsUsage field. -func (o *UsageAttributionValues) SetLambdaFunctionsUsage(v float64) { - o.LambdaFunctionsUsage = &v -} - -// GetLambdaInvocationsPercentage returns the LambdaInvocationsPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetLambdaInvocationsPercentage() float64 { - if o == nil || o.LambdaInvocationsPercentage == nil { - var ret float64 - return ret - } - return *o.LambdaInvocationsPercentage -} - -// GetLambdaInvocationsPercentageOk returns a tuple with the LambdaInvocationsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetLambdaInvocationsPercentageOk() (*float64, bool) { - if o == nil || o.LambdaInvocationsPercentage == nil { - return nil, false - } - return o.LambdaInvocationsPercentage, true -} - -// HasLambdaInvocationsPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasLambdaInvocationsPercentage() bool { - if o != nil && o.LambdaInvocationsPercentage != nil { - return true - } - - return false -} - -// SetLambdaInvocationsPercentage gets a reference to the given float64 and assigns it to the LambdaInvocationsPercentage field. -func (o *UsageAttributionValues) SetLambdaInvocationsPercentage(v float64) { - o.LambdaInvocationsPercentage = &v -} - -// GetLambdaInvocationsUsage returns the LambdaInvocationsUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetLambdaInvocationsUsage() float64 { - if o == nil || o.LambdaInvocationsUsage == nil { - var ret float64 - return ret - } - return *o.LambdaInvocationsUsage -} - -// GetLambdaInvocationsUsageOk returns a tuple with the LambdaInvocationsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetLambdaInvocationsUsageOk() (*float64, bool) { - if o == nil || o.LambdaInvocationsUsage == nil { - return nil, false - } - return o.LambdaInvocationsUsage, true -} - -// HasLambdaInvocationsUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasLambdaInvocationsUsage() bool { - if o != nil && o.LambdaInvocationsUsage != nil { - return true - } - - return false -} - -// SetLambdaInvocationsUsage gets a reference to the given float64 and assigns it to the LambdaInvocationsUsage field. -func (o *UsageAttributionValues) SetLambdaInvocationsUsage(v float64) { - o.LambdaInvocationsUsage = &v -} - -// GetNpmHostPercentage returns the NpmHostPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetNpmHostPercentage() float64 { - if o == nil || o.NpmHostPercentage == nil { - var ret float64 - return ret - } - return *o.NpmHostPercentage -} - -// GetNpmHostPercentageOk returns a tuple with the NpmHostPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetNpmHostPercentageOk() (*float64, bool) { - if o == nil || o.NpmHostPercentage == nil { - return nil, false - } - return o.NpmHostPercentage, true -} - -// HasNpmHostPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasNpmHostPercentage() bool { - if o != nil && o.NpmHostPercentage != nil { - return true - } - - return false -} - -// SetNpmHostPercentage gets a reference to the given float64 and assigns it to the NpmHostPercentage field. -func (o *UsageAttributionValues) SetNpmHostPercentage(v float64) { - o.NpmHostPercentage = &v -} - -// GetNpmHostUsage returns the NpmHostUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetNpmHostUsage() float64 { - if o == nil || o.NpmHostUsage == nil { - var ret float64 - return ret - } - return *o.NpmHostUsage -} - -// GetNpmHostUsageOk returns a tuple with the NpmHostUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetNpmHostUsageOk() (*float64, bool) { - if o == nil || o.NpmHostUsage == nil { - return nil, false - } - return o.NpmHostUsage, true -} - -// HasNpmHostUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasNpmHostUsage() bool { - if o != nil && o.NpmHostUsage != nil { - return true - } - - return false -} - -// SetNpmHostUsage gets a reference to the given float64 and assigns it to the NpmHostUsage field. -func (o *UsageAttributionValues) SetNpmHostUsage(v float64) { - o.NpmHostUsage = &v -} - -// GetProfiledContainerPercentage returns the ProfiledContainerPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetProfiledContainerPercentage() float64 { - if o == nil || o.ProfiledContainerPercentage == nil { - var ret float64 - return ret - } - return *o.ProfiledContainerPercentage -} - -// GetProfiledContainerPercentageOk returns a tuple with the ProfiledContainerPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetProfiledContainerPercentageOk() (*float64, bool) { - if o == nil || o.ProfiledContainerPercentage == nil { - return nil, false - } - return o.ProfiledContainerPercentage, true -} - -// HasProfiledContainerPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasProfiledContainerPercentage() bool { - if o != nil && o.ProfiledContainerPercentage != nil { - return true - } - - return false -} - -// SetProfiledContainerPercentage gets a reference to the given float64 and assigns it to the ProfiledContainerPercentage field. -func (o *UsageAttributionValues) SetProfiledContainerPercentage(v float64) { - o.ProfiledContainerPercentage = &v -} - -// GetProfiledContainerUsage returns the ProfiledContainerUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetProfiledContainerUsage() float64 { - if o == nil || o.ProfiledContainerUsage == nil { - var ret float64 - return ret - } - return *o.ProfiledContainerUsage -} - -// GetProfiledContainerUsageOk returns a tuple with the ProfiledContainerUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetProfiledContainerUsageOk() (*float64, bool) { - if o == nil || o.ProfiledContainerUsage == nil { - return nil, false - } - return o.ProfiledContainerUsage, true -} - -// HasProfiledContainerUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasProfiledContainerUsage() bool { - if o != nil && o.ProfiledContainerUsage != nil { - return true - } - - return false -} - -// SetProfiledContainerUsage gets a reference to the given float64 and assigns it to the ProfiledContainerUsage field. -func (o *UsageAttributionValues) SetProfiledContainerUsage(v float64) { - o.ProfiledContainerUsage = &v -} - -// GetProfiledHostsPercentage returns the ProfiledHostsPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetProfiledHostsPercentage() float64 { - if o == nil || o.ProfiledHostsPercentage == nil { - var ret float64 - return ret - } - return *o.ProfiledHostsPercentage -} - -// GetProfiledHostsPercentageOk returns a tuple with the ProfiledHostsPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetProfiledHostsPercentageOk() (*float64, bool) { - if o == nil || o.ProfiledHostsPercentage == nil { - return nil, false - } - return o.ProfiledHostsPercentage, true -} - -// HasProfiledHostsPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasProfiledHostsPercentage() bool { - if o != nil && o.ProfiledHostsPercentage != nil { - return true - } - - return false -} - -// SetProfiledHostsPercentage gets a reference to the given float64 and assigns it to the ProfiledHostsPercentage field. -func (o *UsageAttributionValues) SetProfiledHostsPercentage(v float64) { - o.ProfiledHostsPercentage = &v -} - -// GetProfiledHostsUsage returns the ProfiledHostsUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetProfiledHostsUsage() float64 { - if o == nil || o.ProfiledHostsUsage == nil { - var ret float64 - return ret - } - return *o.ProfiledHostsUsage -} - -// GetProfiledHostsUsageOk returns a tuple with the ProfiledHostsUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetProfiledHostsUsageOk() (*float64, bool) { - if o == nil || o.ProfiledHostsUsage == nil { - return nil, false - } - return o.ProfiledHostsUsage, true -} - -// HasProfiledHostsUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasProfiledHostsUsage() bool { - if o != nil && o.ProfiledHostsUsage != nil { - return true - } - - return false -} - -// SetProfiledHostsUsage gets a reference to the given float64 and assigns it to the ProfiledHostsUsage field. -func (o *UsageAttributionValues) SetProfiledHostsUsage(v float64) { - o.ProfiledHostsUsage = &v -} - -// GetSnmpPercentage returns the SnmpPercentage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetSnmpPercentage() float64 { - if o == nil || o.SnmpPercentage == nil { - var ret float64 - return ret - } - return *o.SnmpPercentage -} - -// GetSnmpPercentageOk returns a tuple with the SnmpPercentage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetSnmpPercentageOk() (*float64, bool) { - if o == nil || o.SnmpPercentage == nil { - return nil, false - } - return o.SnmpPercentage, true -} - -// HasSnmpPercentage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasSnmpPercentage() bool { - if o != nil && o.SnmpPercentage != nil { - return true - } - - return false -} - -// SetSnmpPercentage gets a reference to the given float64 and assigns it to the SnmpPercentage field. -func (o *UsageAttributionValues) SetSnmpPercentage(v float64) { - o.SnmpPercentage = &v -} - -// GetSnmpUsage returns the SnmpUsage field value if set, zero value otherwise. -func (o *UsageAttributionValues) GetSnmpUsage() float64 { - if o == nil || o.SnmpUsage == nil { - var ret float64 - return ret - } - return *o.SnmpUsage -} - -// GetSnmpUsageOk returns a tuple with the SnmpUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributionValues) GetSnmpUsageOk() (*float64, bool) { - if o == nil || o.SnmpUsage == nil { - return nil, false - } - return o.SnmpUsage, true -} - -// HasSnmpUsage returns a boolean if a field has been set. -func (o *UsageAttributionValues) HasSnmpUsage() bool { - if o != nil && o.SnmpUsage != nil { - return true - } - - return false -} - -// SetSnmpUsage gets a reference to the given float64 and assigns it to the SnmpUsage field. -func (o *UsageAttributionValues) SetSnmpUsage(v float64) { - o.SnmpUsage = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAttributionValues) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApiPercentage != nil { - toSerialize["api_percentage"] = o.ApiPercentage - } - if o.ApiUsage != nil { - toSerialize["api_usage"] = o.ApiUsage - } - if o.ApmHostPercentage != nil { - toSerialize["apm_host_percentage"] = o.ApmHostPercentage - } - if o.ApmHostUsage != nil { - toSerialize["apm_host_usage"] = o.ApmHostUsage - } - if o.AppsecPercentage != nil { - toSerialize["appsec_percentage"] = o.AppsecPercentage - } - if o.AppsecUsage != nil { - toSerialize["appsec_usage"] = o.AppsecUsage - } - if o.BrowserPercentage != nil { - toSerialize["browser_percentage"] = o.BrowserPercentage - } - if o.BrowserUsage != nil { - toSerialize["browser_usage"] = o.BrowserUsage - } - if o.ContainerPercentage != nil { - toSerialize["container_percentage"] = o.ContainerPercentage - } - if o.ContainerUsage != nil { - toSerialize["container_usage"] = o.ContainerUsage - } - if o.CspmContainerPercentage != nil { - toSerialize["cspm_container_percentage"] = o.CspmContainerPercentage - } - if o.CspmContainerUsage != nil { - toSerialize["cspm_container_usage"] = o.CspmContainerUsage - } - if o.CspmHostPercentage != nil { - toSerialize["cspm_host_percentage"] = o.CspmHostPercentage - } - if o.CspmHostUsage != nil { - toSerialize["cspm_host_usage"] = o.CspmHostUsage - } - if o.CustomTimeseriesPercentage != nil { - toSerialize["custom_timeseries_percentage"] = o.CustomTimeseriesPercentage - } - if o.CustomTimeseriesUsage != nil { - toSerialize["custom_timeseries_usage"] = o.CustomTimeseriesUsage - } - if o.CwsContainerPercentage != nil { - toSerialize["cws_container_percentage"] = o.CwsContainerPercentage - } - if o.CwsContainerUsage != nil { - toSerialize["cws_container_usage"] = o.CwsContainerUsage - } - if o.CwsHostPercentage != nil { - toSerialize["cws_host_percentage"] = o.CwsHostPercentage - } - if o.CwsHostUsage != nil { - toSerialize["cws_host_usage"] = o.CwsHostUsage - } - if o.DbmHostsPercentage != nil { - toSerialize["dbm_hosts_percentage"] = o.DbmHostsPercentage - } - if o.DbmHostsUsage != nil { - toSerialize["dbm_hosts_usage"] = o.DbmHostsUsage - } - if o.DbmQueriesPercentage != nil { - toSerialize["dbm_queries_percentage"] = o.DbmQueriesPercentage - } - if o.DbmQueriesUsage != nil { - toSerialize["dbm_queries_usage"] = o.DbmQueriesUsage - } - if o.EstimatedIndexedLogsPercentage != nil { - toSerialize["estimated_indexed_logs_percentage"] = o.EstimatedIndexedLogsPercentage - } - if o.EstimatedIndexedLogsUsage != nil { - toSerialize["estimated_indexed_logs_usage"] = o.EstimatedIndexedLogsUsage - } - if o.EstimatedIndexedSpansPercentage != nil { - toSerialize["estimated_indexed_spans_percentage"] = o.EstimatedIndexedSpansPercentage - } - if o.EstimatedIndexedSpansUsage != nil { - toSerialize["estimated_indexed_spans_usage"] = o.EstimatedIndexedSpansUsage - } - if o.EstimatedIngestedSpansPercentage != nil { - toSerialize["estimated_ingested_spans_percentage"] = o.EstimatedIngestedSpansPercentage - } - if o.EstimatedIngestedSpansUsage != nil { - toSerialize["estimated_ingested_spans_usage"] = o.EstimatedIngestedSpansUsage - } - if o.InfraHostPercentage != nil { - toSerialize["infra_host_percentage"] = o.InfraHostPercentage - } - if o.InfraHostUsage != nil { - toSerialize["infra_host_usage"] = o.InfraHostUsage - } - if o.LambdaFunctionsPercentage != nil { - toSerialize["lambda_functions_percentage"] = o.LambdaFunctionsPercentage - } - if o.LambdaFunctionsUsage != nil { - toSerialize["lambda_functions_usage"] = o.LambdaFunctionsUsage - } - if o.LambdaInvocationsPercentage != nil { - toSerialize["lambda_invocations_percentage"] = o.LambdaInvocationsPercentage - } - if o.LambdaInvocationsUsage != nil { - toSerialize["lambda_invocations_usage"] = o.LambdaInvocationsUsage - } - if o.NpmHostPercentage != nil { - toSerialize["npm_host_percentage"] = o.NpmHostPercentage - } - if o.NpmHostUsage != nil { - toSerialize["npm_host_usage"] = o.NpmHostUsage - } - if o.ProfiledContainerPercentage != nil { - toSerialize["profiled_container_percentage"] = o.ProfiledContainerPercentage - } - if o.ProfiledContainerUsage != nil { - toSerialize["profiled_container_usage"] = o.ProfiledContainerUsage - } - if o.ProfiledHostsPercentage != nil { - toSerialize["profiled_hosts_percentage"] = o.ProfiledHostsPercentage - } - if o.ProfiledHostsUsage != nil { - toSerialize["profiled_hosts_usage"] = o.ProfiledHostsUsage - } - if o.SnmpPercentage != nil { - toSerialize["snmp_percentage"] = o.SnmpPercentage - } - if o.SnmpUsage != nil { - toSerialize["snmp_usage"] = o.SnmpUsage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApiPercentage *float64 `json:"api_percentage,omitempty"` - ApiUsage *float64 `json:"api_usage,omitempty"` - ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` - ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` - AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` - AppsecUsage *float64 `json:"appsec_usage,omitempty"` - BrowserPercentage *float64 `json:"browser_percentage,omitempty"` - BrowserUsage *float64 `json:"browser_usage,omitempty"` - ContainerPercentage *float64 `json:"container_percentage,omitempty"` - ContainerUsage *float64 `json:"container_usage,omitempty"` - CspmContainerPercentage *float64 `json:"cspm_container_percentage,omitempty"` - CspmContainerUsage *float64 `json:"cspm_container_usage,omitempty"` - CspmHostPercentage *float64 `json:"cspm_host_percentage,omitempty"` - CspmHostUsage *float64 `json:"cspm_host_usage,omitempty"` - CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` - CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` - CwsContainerPercentage *float64 `json:"cws_container_percentage,omitempty"` - CwsContainerUsage *float64 `json:"cws_container_usage,omitempty"` - CwsHostPercentage *float64 `json:"cws_host_percentage,omitempty"` - CwsHostUsage *float64 `json:"cws_host_usage,omitempty"` - DbmHostsPercentage *float64 `json:"dbm_hosts_percentage,omitempty"` - DbmHostsUsage *float64 `json:"dbm_hosts_usage,omitempty"` - DbmQueriesPercentage *float64 `json:"dbm_queries_percentage,omitempty"` - DbmQueriesUsage *float64 `json:"dbm_queries_usage,omitempty"` - EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` - EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` - EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` - EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` - EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` - EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` - InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` - InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` - LambdaFunctionsPercentage *float64 `json:"lambda_functions_percentage,omitempty"` - LambdaFunctionsUsage *float64 `json:"lambda_functions_usage,omitempty"` - LambdaInvocationsPercentage *float64 `json:"lambda_invocations_percentage,omitempty"` - LambdaInvocationsUsage *float64 `json:"lambda_invocations_usage,omitempty"` - NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` - NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` - ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` - ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` - ProfiledHostsPercentage *float64 `json:"profiled_hosts_percentage,omitempty"` - ProfiledHostsUsage *float64 `json:"profiled_hosts_usage,omitempty"` - SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` - SnmpUsage *float64 `json:"snmp_usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ApiPercentage = all.ApiPercentage - o.ApiUsage = all.ApiUsage - o.ApmHostPercentage = all.ApmHostPercentage - o.ApmHostUsage = all.ApmHostUsage - o.AppsecPercentage = all.AppsecPercentage - o.AppsecUsage = all.AppsecUsage - o.BrowserPercentage = all.BrowserPercentage - o.BrowserUsage = all.BrowserUsage - o.ContainerPercentage = all.ContainerPercentage - o.ContainerUsage = all.ContainerUsage - o.CspmContainerPercentage = all.CspmContainerPercentage - o.CspmContainerUsage = all.CspmContainerUsage - o.CspmHostPercentage = all.CspmHostPercentage - o.CspmHostUsage = all.CspmHostUsage - o.CustomTimeseriesPercentage = all.CustomTimeseriesPercentage - o.CustomTimeseriesUsage = all.CustomTimeseriesUsage - o.CwsContainerPercentage = all.CwsContainerPercentage - o.CwsContainerUsage = all.CwsContainerUsage - o.CwsHostPercentage = all.CwsHostPercentage - o.CwsHostUsage = all.CwsHostUsage - o.DbmHostsPercentage = all.DbmHostsPercentage - o.DbmHostsUsage = all.DbmHostsUsage - o.DbmQueriesPercentage = all.DbmQueriesPercentage - o.DbmQueriesUsage = all.DbmQueriesUsage - o.EstimatedIndexedLogsPercentage = all.EstimatedIndexedLogsPercentage - o.EstimatedIndexedLogsUsage = all.EstimatedIndexedLogsUsage - o.EstimatedIndexedSpansPercentage = all.EstimatedIndexedSpansPercentage - o.EstimatedIndexedSpansUsage = all.EstimatedIndexedSpansUsage - o.EstimatedIngestedSpansPercentage = all.EstimatedIngestedSpansPercentage - o.EstimatedIngestedSpansUsage = all.EstimatedIngestedSpansUsage - o.InfraHostPercentage = all.InfraHostPercentage - o.InfraHostUsage = all.InfraHostUsage - o.LambdaFunctionsPercentage = all.LambdaFunctionsPercentage - o.LambdaFunctionsUsage = all.LambdaFunctionsUsage - o.LambdaInvocationsPercentage = all.LambdaInvocationsPercentage - o.LambdaInvocationsUsage = all.LambdaInvocationsUsage - o.NpmHostPercentage = all.NpmHostPercentage - o.NpmHostUsage = all.NpmHostUsage - o.ProfiledContainerPercentage = all.ProfiledContainerPercentage - o.ProfiledContainerUsage = all.ProfiledContainerUsage - o.ProfiledHostsPercentage = all.ProfiledHostsPercentage - o.ProfiledHostsUsage = all.ProfiledHostsUsage - o.SnmpPercentage = all.SnmpPercentage - o.SnmpUsage = all.SnmpUsage - return nil -} diff --git a/api/v1/datadog/model_usage_audit_logs_hour.go b/api/v1/datadog/model_usage_audit_logs_hour.go deleted file mode 100644 index 7c1d3cc9a54..00000000000 --- a/api/v1/datadog/model_usage_audit_logs_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageAuditLogsHour Audit logs usage for a given organization for a given hour. -type UsageAuditLogsHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The total number of audit logs lines indexed during a given hour. - LinesIndexed *int64 `json:"lines_indexed,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageAuditLogsHour instantiates a new UsageAuditLogsHour 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 NewUsageAuditLogsHour() *UsageAuditLogsHour { - this := UsageAuditLogsHour{} - return &this -} - -// NewUsageAuditLogsHourWithDefaults instantiates a new UsageAuditLogsHour 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 NewUsageAuditLogsHourWithDefaults() *UsageAuditLogsHour { - this := UsageAuditLogsHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageAuditLogsHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAuditLogsHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageAuditLogsHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageAuditLogsHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetLinesIndexed returns the LinesIndexed field value if set, zero value otherwise. -func (o *UsageAuditLogsHour) GetLinesIndexed() int64 { - if o == nil || o.LinesIndexed == nil { - var ret int64 - return ret - } - return *o.LinesIndexed -} - -// GetLinesIndexedOk returns a tuple with the LinesIndexed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAuditLogsHour) GetLinesIndexedOk() (*int64, bool) { - if o == nil || o.LinesIndexed == nil { - return nil, false - } - return o.LinesIndexed, true -} - -// HasLinesIndexed returns a boolean if a field has been set. -func (o *UsageAuditLogsHour) HasLinesIndexed() bool { - if o != nil && o.LinesIndexed != nil { - return true - } - - return false -} - -// SetLinesIndexed gets a reference to the given int64 and assigns it to the LinesIndexed field. -func (o *UsageAuditLogsHour) SetLinesIndexed(v int64) { - o.LinesIndexed = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageAuditLogsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAuditLogsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageAuditLogsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageAuditLogsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageAuditLogsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAuditLogsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageAuditLogsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageAuditLogsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAuditLogsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.LinesIndexed != nil { - toSerialize["lines_indexed"] = o.LinesIndexed - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAuditLogsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - LinesIndexed *int64 `json:"lines_indexed,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.LinesIndexed = all.LinesIndexed - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_audit_logs_response.go b/api/v1/datadog/model_usage_audit_logs_response.go deleted file mode 100644 index 6e778cfb9a1..00000000000 --- a/api/v1/datadog/model_usage_audit_logs_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAuditLogsResponse Response containing the audit logs usage for each hour for a given organization. -type UsageAuditLogsResponse struct { - // Get hourly usage for audit logs. - Usage []UsageAuditLogsHour `json:"usage,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{} -} - -// NewUsageAuditLogsResponse instantiates a new UsageAuditLogsResponse 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 NewUsageAuditLogsResponse() *UsageAuditLogsResponse { - this := UsageAuditLogsResponse{} - return &this -} - -// NewUsageAuditLogsResponseWithDefaults instantiates a new UsageAuditLogsResponse 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 NewUsageAuditLogsResponseWithDefaults() *UsageAuditLogsResponse { - this := UsageAuditLogsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageAuditLogsResponse) GetUsage() []UsageAuditLogsHour { - if o == nil || o.Usage == nil { - var ret []UsageAuditLogsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAuditLogsResponse) GetUsageOk() (*[]UsageAuditLogsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageAuditLogsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageAuditLogsHour and assigns it to the Usage field. -func (o *UsageAuditLogsResponse) SetUsage(v []UsageAuditLogsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAuditLogsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAuditLogsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageAuditLogsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_billable_summary_body.go b/api/v1/datadog/model_usage_billable_summary_body.go deleted file mode 100644 index 1bfd4616cef..00000000000 --- a/api/v1/datadog/model_usage_billable_summary_body.go +++ /dev/null @@ -1,345 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageBillableSummaryBody Response with properties for each aggregated usage type. -type UsageBillableSummaryBody struct { - // The total account usage. - AccountBillableUsage *int64 `json:"account_billable_usage,omitempty"` - // Elapsed usage hours for some billable product. - ElapsedUsageHours *int64 `json:"elapsed_usage_hours,omitempty"` - // The first billable hour for the org. - FirstBillableUsageHour *time.Time `json:"first_billable_usage_hour,omitempty"` - // The last billable hour for the org. - LastBillableUsageHour *time.Time `json:"last_billable_usage_hour,omitempty"` - // The number of units used within the billable timeframe. - OrgBillableUsage *int64 `json:"org_billable_usage,omitempty"` - // The percentage of account usage the org represents. - PercentageInAccount *float64 `json:"percentage_in_account,omitempty"` - // Units pertaining to the usage. - UsageUnit *string `json:"usage_unit,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{} -} - -// NewUsageBillableSummaryBody instantiates a new UsageBillableSummaryBody 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 NewUsageBillableSummaryBody() *UsageBillableSummaryBody { - this := UsageBillableSummaryBody{} - return &this -} - -// NewUsageBillableSummaryBodyWithDefaults instantiates a new UsageBillableSummaryBody 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 NewUsageBillableSummaryBodyWithDefaults() *UsageBillableSummaryBody { - this := UsageBillableSummaryBody{} - return &this -} - -// GetAccountBillableUsage returns the AccountBillableUsage field value if set, zero value otherwise. -func (o *UsageBillableSummaryBody) GetAccountBillableUsage() int64 { - if o == nil || o.AccountBillableUsage == nil { - var ret int64 - return ret - } - return *o.AccountBillableUsage -} - -// GetAccountBillableUsageOk returns a tuple with the AccountBillableUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryBody) GetAccountBillableUsageOk() (*int64, bool) { - if o == nil || o.AccountBillableUsage == nil { - return nil, false - } - return o.AccountBillableUsage, true -} - -// HasAccountBillableUsage returns a boolean if a field has been set. -func (o *UsageBillableSummaryBody) HasAccountBillableUsage() bool { - if o != nil && o.AccountBillableUsage != nil { - return true - } - - return false -} - -// SetAccountBillableUsage gets a reference to the given int64 and assigns it to the AccountBillableUsage field. -func (o *UsageBillableSummaryBody) SetAccountBillableUsage(v int64) { - o.AccountBillableUsage = &v -} - -// GetElapsedUsageHours returns the ElapsedUsageHours field value if set, zero value otherwise. -func (o *UsageBillableSummaryBody) GetElapsedUsageHours() int64 { - if o == nil || o.ElapsedUsageHours == nil { - var ret int64 - return ret - } - return *o.ElapsedUsageHours -} - -// GetElapsedUsageHoursOk returns a tuple with the ElapsedUsageHours field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryBody) GetElapsedUsageHoursOk() (*int64, bool) { - if o == nil || o.ElapsedUsageHours == nil { - return nil, false - } - return o.ElapsedUsageHours, true -} - -// HasElapsedUsageHours returns a boolean if a field has been set. -func (o *UsageBillableSummaryBody) HasElapsedUsageHours() bool { - if o != nil && o.ElapsedUsageHours != nil { - return true - } - - return false -} - -// SetElapsedUsageHours gets a reference to the given int64 and assigns it to the ElapsedUsageHours field. -func (o *UsageBillableSummaryBody) SetElapsedUsageHours(v int64) { - o.ElapsedUsageHours = &v -} - -// GetFirstBillableUsageHour returns the FirstBillableUsageHour field value if set, zero value otherwise. -func (o *UsageBillableSummaryBody) GetFirstBillableUsageHour() time.Time { - if o == nil || o.FirstBillableUsageHour == nil { - var ret time.Time - return ret - } - return *o.FirstBillableUsageHour -} - -// GetFirstBillableUsageHourOk returns a tuple with the FirstBillableUsageHour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryBody) GetFirstBillableUsageHourOk() (*time.Time, bool) { - if o == nil || o.FirstBillableUsageHour == nil { - return nil, false - } - return o.FirstBillableUsageHour, true -} - -// HasFirstBillableUsageHour returns a boolean if a field has been set. -func (o *UsageBillableSummaryBody) HasFirstBillableUsageHour() bool { - if o != nil && o.FirstBillableUsageHour != nil { - return true - } - - return false -} - -// SetFirstBillableUsageHour gets a reference to the given time.Time and assigns it to the FirstBillableUsageHour field. -func (o *UsageBillableSummaryBody) SetFirstBillableUsageHour(v time.Time) { - o.FirstBillableUsageHour = &v -} - -// GetLastBillableUsageHour returns the LastBillableUsageHour field value if set, zero value otherwise. -func (o *UsageBillableSummaryBody) GetLastBillableUsageHour() time.Time { - if o == nil || o.LastBillableUsageHour == nil { - var ret time.Time - return ret - } - return *o.LastBillableUsageHour -} - -// GetLastBillableUsageHourOk returns a tuple with the LastBillableUsageHour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryBody) GetLastBillableUsageHourOk() (*time.Time, bool) { - if o == nil || o.LastBillableUsageHour == nil { - return nil, false - } - return o.LastBillableUsageHour, true -} - -// HasLastBillableUsageHour returns a boolean if a field has been set. -func (o *UsageBillableSummaryBody) HasLastBillableUsageHour() bool { - if o != nil && o.LastBillableUsageHour != nil { - return true - } - - return false -} - -// SetLastBillableUsageHour gets a reference to the given time.Time and assigns it to the LastBillableUsageHour field. -func (o *UsageBillableSummaryBody) SetLastBillableUsageHour(v time.Time) { - o.LastBillableUsageHour = &v -} - -// GetOrgBillableUsage returns the OrgBillableUsage field value if set, zero value otherwise. -func (o *UsageBillableSummaryBody) GetOrgBillableUsage() int64 { - if o == nil || o.OrgBillableUsage == nil { - var ret int64 - return ret - } - return *o.OrgBillableUsage -} - -// GetOrgBillableUsageOk returns a tuple with the OrgBillableUsage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryBody) GetOrgBillableUsageOk() (*int64, bool) { - if o == nil || o.OrgBillableUsage == nil { - return nil, false - } - return o.OrgBillableUsage, true -} - -// HasOrgBillableUsage returns a boolean if a field has been set. -func (o *UsageBillableSummaryBody) HasOrgBillableUsage() bool { - if o != nil && o.OrgBillableUsage != nil { - return true - } - - return false -} - -// SetOrgBillableUsage gets a reference to the given int64 and assigns it to the OrgBillableUsage field. -func (o *UsageBillableSummaryBody) SetOrgBillableUsage(v int64) { - o.OrgBillableUsage = &v -} - -// GetPercentageInAccount returns the PercentageInAccount field value if set, zero value otherwise. -func (o *UsageBillableSummaryBody) GetPercentageInAccount() float64 { - if o == nil || o.PercentageInAccount == nil { - var ret float64 - return ret - } - return *o.PercentageInAccount -} - -// GetPercentageInAccountOk returns a tuple with the PercentageInAccount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryBody) GetPercentageInAccountOk() (*float64, bool) { - if o == nil || o.PercentageInAccount == nil { - return nil, false - } - return o.PercentageInAccount, true -} - -// HasPercentageInAccount returns a boolean if a field has been set. -func (o *UsageBillableSummaryBody) HasPercentageInAccount() bool { - if o != nil && o.PercentageInAccount != nil { - return true - } - - return false -} - -// SetPercentageInAccount gets a reference to the given float64 and assigns it to the PercentageInAccount field. -func (o *UsageBillableSummaryBody) SetPercentageInAccount(v float64) { - o.PercentageInAccount = &v -} - -// GetUsageUnit returns the UsageUnit field value if set, zero value otherwise. -func (o *UsageBillableSummaryBody) GetUsageUnit() string { - if o == nil || o.UsageUnit == nil { - var ret string - return ret - } - return *o.UsageUnit -} - -// GetUsageUnitOk returns a tuple with the UsageUnit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryBody) GetUsageUnitOk() (*string, bool) { - if o == nil || o.UsageUnit == nil { - return nil, false - } - return o.UsageUnit, true -} - -// HasUsageUnit returns a boolean if a field has been set. -func (o *UsageBillableSummaryBody) HasUsageUnit() bool { - if o != nil && o.UsageUnit != nil { - return true - } - - return false -} - -// SetUsageUnit gets a reference to the given string and assigns it to the UsageUnit field. -func (o *UsageBillableSummaryBody) SetUsageUnit(v string) { - o.UsageUnit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageBillableSummaryBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AccountBillableUsage != nil { - toSerialize["account_billable_usage"] = o.AccountBillableUsage - } - if o.ElapsedUsageHours != nil { - toSerialize["elapsed_usage_hours"] = o.ElapsedUsageHours - } - if o.FirstBillableUsageHour != nil { - if o.FirstBillableUsageHour.Nanosecond() == 0 { - toSerialize["first_billable_usage_hour"] = o.FirstBillableUsageHour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["first_billable_usage_hour"] = o.FirstBillableUsageHour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.LastBillableUsageHour != nil { - if o.LastBillableUsageHour.Nanosecond() == 0 { - toSerialize["last_billable_usage_hour"] = o.LastBillableUsageHour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["last_billable_usage_hour"] = o.LastBillableUsageHour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgBillableUsage != nil { - toSerialize["org_billable_usage"] = o.OrgBillableUsage - } - if o.PercentageInAccount != nil { - toSerialize["percentage_in_account"] = o.PercentageInAccount - } - if o.UsageUnit != nil { - toSerialize["usage_unit"] = o.UsageUnit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageBillableSummaryBody) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AccountBillableUsage *int64 `json:"account_billable_usage,omitempty"` - ElapsedUsageHours *int64 `json:"elapsed_usage_hours,omitempty"` - FirstBillableUsageHour *time.Time `json:"first_billable_usage_hour,omitempty"` - LastBillableUsageHour *time.Time `json:"last_billable_usage_hour,omitempty"` - OrgBillableUsage *int64 `json:"org_billable_usage,omitempty"` - PercentageInAccount *float64 `json:"percentage_in_account,omitempty"` - UsageUnit *string `json:"usage_unit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccountBillableUsage = all.AccountBillableUsage - o.ElapsedUsageHours = all.ElapsedUsageHours - o.FirstBillableUsageHour = all.FirstBillableUsageHour - o.LastBillableUsageHour = all.LastBillableUsageHour - o.OrgBillableUsage = all.OrgBillableUsage - o.PercentageInAccount = all.PercentageInAccount - o.UsageUnit = all.UsageUnit - return nil -} diff --git a/api/v1/datadog/model_usage_billable_summary_hour.go b/api/v1/datadog/model_usage_billable_summary_hour.go deleted file mode 100644 index da06af9ffee..00000000000 --- a/api/v1/datadog/model_usage_billable_summary_hour.go +++ /dev/null @@ -1,391 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageBillableSummaryHour Response with monthly summary of data billed by Datadog. -type UsageBillableSummaryHour struct { - // The billing plan. - BillingPlan *string `json:"billing_plan,omitempty"` - // Shows the last date of usage. - EndDate *time.Time `json:"end_date,omitempty"` - // The number of organizations. - NumOrgs *int64 `json:"num_orgs,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // Shows usage aggregation for a billing period. - RatioInMonth *float64 `json:"ratio_in_month,omitempty"` - // Shows the first date of usage. - StartDate *time.Time `json:"start_date,omitempty"` - // Response with aggregated usage types. - Usage *UsageBillableSummaryKeys `json:"usage,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{} -} - -// NewUsageBillableSummaryHour instantiates a new UsageBillableSummaryHour 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 NewUsageBillableSummaryHour() *UsageBillableSummaryHour { - this := UsageBillableSummaryHour{} - return &this -} - -// NewUsageBillableSummaryHourWithDefaults instantiates a new UsageBillableSummaryHour 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 NewUsageBillableSummaryHourWithDefaults() *UsageBillableSummaryHour { - this := UsageBillableSummaryHour{} - return &this -} - -// GetBillingPlan returns the BillingPlan field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetBillingPlan() string { - if o == nil || o.BillingPlan == nil { - var ret string - return ret - } - return *o.BillingPlan -} - -// GetBillingPlanOk returns a tuple with the BillingPlan field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetBillingPlanOk() (*string, bool) { - if o == nil || o.BillingPlan == nil { - return nil, false - } - return o.BillingPlan, true -} - -// HasBillingPlan returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasBillingPlan() bool { - if o != nil && o.BillingPlan != nil { - return true - } - - return false -} - -// SetBillingPlan gets a reference to the given string and assigns it to the BillingPlan field. -func (o *UsageBillableSummaryHour) SetBillingPlan(v string) { - o.BillingPlan = &v -} - -// GetEndDate returns the EndDate field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetEndDate() time.Time { - if o == nil || o.EndDate == nil { - var ret time.Time - return ret - } - return *o.EndDate -} - -// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetEndDateOk() (*time.Time, bool) { - if o == nil || o.EndDate == nil { - return nil, false - } - return o.EndDate, true -} - -// HasEndDate returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasEndDate() bool { - if o != nil && o.EndDate != nil { - return true - } - - return false -} - -// SetEndDate gets a reference to the given time.Time and assigns it to the EndDate field. -func (o *UsageBillableSummaryHour) SetEndDate(v time.Time) { - o.EndDate = &v -} - -// GetNumOrgs returns the NumOrgs field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetNumOrgs() int64 { - if o == nil || o.NumOrgs == nil { - var ret int64 - return ret - } - return *o.NumOrgs -} - -// GetNumOrgsOk returns a tuple with the NumOrgs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetNumOrgsOk() (*int64, bool) { - if o == nil || o.NumOrgs == nil { - return nil, false - } - return o.NumOrgs, true -} - -// HasNumOrgs returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasNumOrgs() bool { - if o != nil && o.NumOrgs != nil { - return true - } - - return false -} - -// SetNumOrgs gets a reference to the given int64 and assigns it to the NumOrgs field. -func (o *UsageBillableSummaryHour) SetNumOrgs(v int64) { - o.NumOrgs = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageBillableSummaryHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageBillableSummaryHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetRatioInMonth returns the RatioInMonth field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetRatioInMonth() float64 { - if o == nil || o.RatioInMonth == nil { - var ret float64 - return ret - } - return *o.RatioInMonth -} - -// GetRatioInMonthOk returns a tuple with the RatioInMonth field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetRatioInMonthOk() (*float64, bool) { - if o == nil || o.RatioInMonth == nil { - return nil, false - } - return o.RatioInMonth, true -} - -// HasRatioInMonth returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasRatioInMonth() bool { - if o != nil && o.RatioInMonth != nil { - return true - } - - return false -} - -// SetRatioInMonth gets a reference to the given float64 and assigns it to the RatioInMonth field. -func (o *UsageBillableSummaryHour) SetRatioInMonth(v float64) { - o.RatioInMonth = &v -} - -// GetStartDate returns the StartDate field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetStartDate() time.Time { - if o == nil || o.StartDate == nil { - var ret time.Time - return ret - } - return *o.StartDate -} - -// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetStartDateOk() (*time.Time, bool) { - if o == nil || o.StartDate == nil { - return nil, false - } - return o.StartDate, true -} - -// HasStartDate returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasStartDate() bool { - if o != nil && o.StartDate != nil { - return true - } - - return false -} - -// SetStartDate gets a reference to the given time.Time and assigns it to the StartDate field. -func (o *UsageBillableSummaryHour) SetStartDate(v time.Time) { - o.StartDate = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageBillableSummaryHour) GetUsage() UsageBillableSummaryKeys { - if o == nil || o.Usage == nil { - var ret UsageBillableSummaryKeys - return ret - } - return *o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryHour) GetUsageOk() (*UsageBillableSummaryKeys, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageBillableSummaryHour) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given UsageBillableSummaryKeys and assigns it to the Usage field. -func (o *UsageBillableSummaryHour) SetUsage(v UsageBillableSummaryKeys) { - o.Usage = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageBillableSummaryHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BillingPlan != nil { - toSerialize["billing_plan"] = o.BillingPlan - } - if o.EndDate != nil { - if o.EndDate.Nanosecond() == 0 { - toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.NumOrgs != nil { - toSerialize["num_orgs"] = o.NumOrgs - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.RatioInMonth != nil { - toSerialize["ratio_in_month"] = o.RatioInMonth - } - if o.StartDate != nil { - if o.StartDate.Nanosecond() == 0 { - toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageBillableSummaryHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BillingPlan *string `json:"billing_plan,omitempty"` - EndDate *time.Time `json:"end_date,omitempty"` - NumOrgs *int64 `json:"num_orgs,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - RatioInMonth *float64 `json:"ratio_in_month,omitempty"` - StartDate *time.Time `json:"start_date,omitempty"` - Usage *UsageBillableSummaryKeys `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BillingPlan = all.BillingPlan - o.EndDate = all.EndDate - o.NumOrgs = all.NumOrgs - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.RatioInMonth = all.RatioInMonth - o.StartDate = all.StartDate - if all.Usage != nil && all.Usage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_billable_summary_keys.go b/api/v1/datadog/model_usage_billable_summary_keys.go deleted file mode 100644 index b6a69a8bf73..00000000000 --- a/api/v1/datadog/model_usage_billable_summary_keys.go +++ /dev/null @@ -1,3697 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageBillableSummaryKeys Response with aggregated usage types. -type UsageBillableSummaryKeys struct { - // Response with properties for each aggregated usage type. - ApmFargateAverage *UsageBillableSummaryBody `json:"apm_fargate_average,omitempty"` - // Response with properties for each aggregated usage type. - ApmFargateSum *UsageBillableSummaryBody `json:"apm_fargate_sum,omitempty"` - // Response with properties for each aggregated usage type. - ApmHostSum *UsageBillableSummaryBody `json:"apm_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - ApmHostTop99p *UsageBillableSummaryBody `json:"apm_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - ApmProfilerHostSum *UsageBillableSummaryBody `json:"apm_profiler_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - ApmProfilerHostTop99p *UsageBillableSummaryBody `json:"apm_profiler_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - ApmTraceSearchSum *UsageBillableSummaryBody `json:"apm_trace_search_sum,omitempty"` - // Response with properties for each aggregated usage type. - ApplicationSecurityHostSum *UsageBillableSummaryBody `json:"application_security_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - CiPipelineIndexedSpansSum *UsageBillableSummaryBody `json:"ci_pipeline_indexed_spans_sum,omitempty"` - // Response with properties for each aggregated usage type. - CiPipelineMaximum *UsageBillableSummaryBody `json:"ci_pipeline_maximum,omitempty"` - // Response with properties for each aggregated usage type. - CiPipelineSum *UsageBillableSummaryBody `json:"ci_pipeline_sum,omitempty"` - // Response with properties for each aggregated usage type. - CiTestIndexedSpansSum *UsageBillableSummaryBody `json:"ci_test_indexed_spans_sum,omitempty"` - // Response with properties for each aggregated usage type. - CiTestingMaximum *UsageBillableSummaryBody `json:"ci_testing_maximum,omitempty"` - // Response with properties for each aggregated usage type. - CiTestingSum *UsageBillableSummaryBody `json:"ci_testing_sum,omitempty"` - // Response with properties for each aggregated usage type. - CspmContainerSum *UsageBillableSummaryBody `json:"cspm_container_sum,omitempty"` - // Response with properties for each aggregated usage type. - CspmHostSum *UsageBillableSummaryBody `json:"cspm_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - CspmHostTop99p *UsageBillableSummaryBody `json:"cspm_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - CustomEventSum *UsageBillableSummaryBody `json:"custom_event_sum,omitempty"` - // Response with properties for each aggregated usage type. - CwsContainerSum *UsageBillableSummaryBody `json:"cws_container_sum,omitempty"` - // Response with properties for each aggregated usage type. - CwsHostSum *UsageBillableSummaryBody `json:"cws_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - CwsHostTop99p *UsageBillableSummaryBody `json:"cws_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - DbmHostSum *UsageBillableSummaryBody `json:"dbm_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - DbmHostTop99p *UsageBillableSummaryBody `json:"dbm_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - DbmNormalizedQueriesAverage *UsageBillableSummaryBody `json:"dbm_normalized_queries_average,omitempty"` - // Response with properties for each aggregated usage type. - DbmNormalizedQueriesSum *UsageBillableSummaryBody `json:"dbm_normalized_queries_sum,omitempty"` - // Response with properties for each aggregated usage type. - FargateContainerApmAndProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_average,omitempty"` - // Response with properties for each aggregated usage type. - FargateContainerApmAndProfilerSum *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_sum,omitempty"` - // Response with properties for each aggregated usage type. - FargateContainerAverage *UsageBillableSummaryBody `json:"fargate_container_average,omitempty"` - // Response with properties for each aggregated usage type. - FargateContainerProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_profiler_average,omitempty"` - // Response with properties for each aggregated usage type. - FargateContainerProfilerSum *UsageBillableSummaryBody `json:"fargate_container_profiler_sum,omitempty"` - // Response with properties for each aggregated usage type. - FargateContainerSum *UsageBillableSummaryBody `json:"fargate_container_sum,omitempty"` - // Response with properties for each aggregated usage type. - IncidentManagementMaximum *UsageBillableSummaryBody `json:"incident_management_maximum,omitempty"` - // Response with properties for each aggregated usage type. - IncidentManagementSum *UsageBillableSummaryBody `json:"incident_management_sum,omitempty"` - // Response with properties for each aggregated usage type. - InfraAndApmHostSum *UsageBillableSummaryBody `json:"infra_and_apm_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - InfraAndApmHostTop99p *UsageBillableSummaryBody `json:"infra_and_apm_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - InfraContainerSum *UsageBillableSummaryBody `json:"infra_container_sum,omitempty"` - // Response with properties for each aggregated usage type. - InfraHostSum *UsageBillableSummaryBody `json:"infra_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - InfraHostTop99p *UsageBillableSummaryBody `json:"infra_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - IngestedSpansSum *UsageBillableSummaryBody `json:"ingested_spans_sum,omitempty"` - // Response with properties for each aggregated usage type. - IngestedTimeseriesAverage *UsageBillableSummaryBody `json:"ingested_timeseries_average,omitempty"` - // Response with properties for each aggregated usage type. - IngestedTimeseriesSum *UsageBillableSummaryBody `json:"ingested_timeseries_sum,omitempty"` - // Response with properties for each aggregated usage type. - IotSum *UsageBillableSummaryBody `json:"iot_sum,omitempty"` - // Response with properties for each aggregated usage type. - IotTop99p *UsageBillableSummaryBody `json:"iot_top99p,omitempty"` - // Response with properties for each aggregated usage type. - LambdaFunctionAverage *UsageBillableSummaryBody `json:"lambda_function_average,omitempty"` - // Response with properties for each aggregated usage type. - LambdaFunctionSum *UsageBillableSummaryBody `json:"lambda_function_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed15daySum *UsageBillableSummaryBody `json:"logs_indexed_15day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed180daySum *UsageBillableSummaryBody `json:"logs_indexed_180day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed30daySum *UsageBillableSummaryBody `json:"logs_indexed_30day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed360daySum *UsageBillableSummaryBody `json:"logs_indexed_360day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed3daySum *UsageBillableSummaryBody `json:"logs_indexed_3day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed45daySum *UsageBillableSummaryBody `json:"logs_indexed_45day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed60daySum *UsageBillableSummaryBody `json:"logs_indexed_60day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed7daySum *UsageBillableSummaryBody `json:"logs_indexed_7day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexed90daySum *UsageBillableSummaryBody `json:"logs_indexed_90day_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexedCustomRetentionSum *UsageBillableSummaryBody `json:"logs_indexed_custom_retention_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIndexedSum *UsageBillableSummaryBody `json:"logs_indexed_sum,omitempty"` - // Response with properties for each aggregated usage type. - LogsIngestedSum *UsageBillableSummaryBody `json:"logs_ingested_sum,omitempty"` - // Response with properties for each aggregated usage type. - NetworkDeviceSum *UsageBillableSummaryBody `json:"network_device_sum,omitempty"` - // Response with properties for each aggregated usage type. - NetworkDeviceTop99p *UsageBillableSummaryBody `json:"network_device_top99p,omitempty"` - // Response with properties for each aggregated usage type. - NpmFlowSum *UsageBillableSummaryBody `json:"npm_flow_sum,omitempty"` - // Response with properties for each aggregated usage type. - NpmHostSum *UsageBillableSummaryBody `json:"npm_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - NpmHostTop99p *UsageBillableSummaryBody `json:"npm_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - ObservabilityPipelineSum *UsageBillableSummaryBody `json:"observability_pipeline_sum,omitempty"` - // Response with properties for each aggregated usage type. - OnlineArchiveSum *UsageBillableSummaryBody `json:"online_archive_sum,omitempty"` - // Response with properties for each aggregated usage type. - ProfContainerSum *UsageBillableSummaryBody `json:"prof_container_sum,omitempty"` - // Response with properties for each aggregated usage type. - ProfHostSum *UsageBillableSummaryBody `json:"prof_host_sum,omitempty"` - // Response with properties for each aggregated usage type. - ProfHostTop99p *UsageBillableSummaryBody `json:"prof_host_top99p,omitempty"` - // Response with properties for each aggregated usage type. - RumLiteSum *UsageBillableSummaryBody `json:"rum_lite_sum,omitempty"` - // Response with properties for each aggregated usage type. - RumReplaySum *UsageBillableSummaryBody `json:"rum_replay_sum,omitempty"` - // Response with properties for each aggregated usage type. - RumSum *UsageBillableSummaryBody `json:"rum_sum,omitempty"` - // Response with properties for each aggregated usage type. - RumUnitsSum *UsageBillableSummaryBody `json:"rum_units_sum,omitempty"` - // Response with properties for each aggregated usage type. - SensitiveDataScannerSum *UsageBillableSummaryBody `json:"sensitive_data_scanner_sum,omitempty"` - // Response with properties for each aggregated usage type. - ServerlessInvocationSum *UsageBillableSummaryBody `json:"serverless_invocation_sum,omitempty"` - // Response with properties for each aggregated usage type. - SiemSum *UsageBillableSummaryBody `json:"siem_sum,omitempty"` - // Response with properties for each aggregated usage type. - StandardTimeseriesAverage *UsageBillableSummaryBody `json:"standard_timeseries_average,omitempty"` - // Response with properties for each aggregated usage type. - SyntheticsApiTestsSum *UsageBillableSummaryBody `json:"synthetics_api_tests_sum,omitempty"` - // Response with properties for each aggregated usage type. - SyntheticsBrowserChecksSum *UsageBillableSummaryBody `json:"synthetics_browser_checks_sum,omitempty"` - // Response with properties for each aggregated usage type. - TimeseriesAverage *UsageBillableSummaryBody `json:"timeseries_average,omitempty"` - // Response with properties for each aggregated usage type. - TimeseriesSum *UsageBillableSummaryBody `json:"timeseries_sum,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{} -} - -// NewUsageBillableSummaryKeys instantiates a new UsageBillableSummaryKeys 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 NewUsageBillableSummaryKeys() *UsageBillableSummaryKeys { - this := UsageBillableSummaryKeys{} - return &this -} - -// NewUsageBillableSummaryKeysWithDefaults instantiates a new UsageBillableSummaryKeys 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 NewUsageBillableSummaryKeysWithDefaults() *UsageBillableSummaryKeys { - this := UsageBillableSummaryKeys{} - return &this -} - -// GetApmFargateAverage returns the ApmFargateAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApmFargateAverage() UsageBillableSummaryBody { - if o == nil || o.ApmFargateAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApmFargateAverage -} - -// GetApmFargateAverageOk returns a tuple with the ApmFargateAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApmFargateAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApmFargateAverage == nil { - return nil, false - } - return o.ApmFargateAverage, true -} - -// HasApmFargateAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApmFargateAverage() bool { - if o != nil && o.ApmFargateAverage != nil { - return true - } - - return false -} - -// SetApmFargateAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmFargateAverage field. -func (o *UsageBillableSummaryKeys) SetApmFargateAverage(v UsageBillableSummaryBody) { - o.ApmFargateAverage = &v -} - -// GetApmFargateSum returns the ApmFargateSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApmFargateSum() UsageBillableSummaryBody { - if o == nil || o.ApmFargateSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApmFargateSum -} - -// GetApmFargateSumOk returns a tuple with the ApmFargateSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApmFargateSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApmFargateSum == nil { - return nil, false - } - return o.ApmFargateSum, true -} - -// HasApmFargateSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApmFargateSum() bool { - if o != nil && o.ApmFargateSum != nil { - return true - } - - return false -} - -// SetApmFargateSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmFargateSum field. -func (o *UsageBillableSummaryKeys) SetApmFargateSum(v UsageBillableSummaryBody) { - o.ApmFargateSum = &v -} - -// GetApmHostSum returns the ApmHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApmHostSum() UsageBillableSummaryBody { - if o == nil || o.ApmHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApmHostSum -} - -// GetApmHostSumOk returns a tuple with the ApmHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApmHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApmHostSum == nil { - return nil, false - } - return o.ApmHostSum, true -} - -// HasApmHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApmHostSum() bool { - if o != nil && o.ApmHostSum != nil { - return true - } - - return false -} - -// SetApmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmHostSum field. -func (o *UsageBillableSummaryKeys) SetApmHostSum(v UsageBillableSummaryBody) { - o.ApmHostSum = &v -} - -// GetApmHostTop99p returns the ApmHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApmHostTop99p() UsageBillableSummaryBody { - if o == nil || o.ApmHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApmHostTop99p -} - -// GetApmHostTop99pOk returns a tuple with the ApmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApmHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApmHostTop99p == nil { - return nil, false - } - return o.ApmHostTop99p, true -} - -// HasApmHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApmHostTop99p() bool { - if o != nil && o.ApmHostTop99p != nil { - return true - } - - return false -} - -// SetApmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmHostTop99p field. -func (o *UsageBillableSummaryKeys) SetApmHostTop99p(v UsageBillableSummaryBody) { - o.ApmHostTop99p = &v -} - -// GetApmProfilerHostSum returns the ApmProfilerHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApmProfilerHostSum() UsageBillableSummaryBody { - if o == nil || o.ApmProfilerHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApmProfilerHostSum -} - -// GetApmProfilerHostSumOk returns a tuple with the ApmProfilerHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApmProfilerHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApmProfilerHostSum == nil { - return nil, false - } - return o.ApmProfilerHostSum, true -} - -// HasApmProfilerHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApmProfilerHostSum() bool { - if o != nil && o.ApmProfilerHostSum != nil { - return true - } - - return false -} - -// SetApmProfilerHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmProfilerHostSum field. -func (o *UsageBillableSummaryKeys) SetApmProfilerHostSum(v UsageBillableSummaryBody) { - o.ApmProfilerHostSum = &v -} - -// GetApmProfilerHostTop99p returns the ApmProfilerHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApmProfilerHostTop99p() UsageBillableSummaryBody { - if o == nil || o.ApmProfilerHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApmProfilerHostTop99p -} - -// GetApmProfilerHostTop99pOk returns a tuple with the ApmProfilerHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApmProfilerHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApmProfilerHostTop99p == nil { - return nil, false - } - return o.ApmProfilerHostTop99p, true -} - -// HasApmProfilerHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApmProfilerHostTop99p() bool { - if o != nil && o.ApmProfilerHostTop99p != nil { - return true - } - - return false -} - -// SetApmProfilerHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmProfilerHostTop99p field. -func (o *UsageBillableSummaryKeys) SetApmProfilerHostTop99p(v UsageBillableSummaryBody) { - o.ApmProfilerHostTop99p = &v -} - -// GetApmTraceSearchSum returns the ApmTraceSearchSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApmTraceSearchSum() UsageBillableSummaryBody { - if o == nil || o.ApmTraceSearchSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApmTraceSearchSum -} - -// GetApmTraceSearchSumOk returns a tuple with the ApmTraceSearchSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApmTraceSearchSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApmTraceSearchSum == nil { - return nil, false - } - return o.ApmTraceSearchSum, true -} - -// HasApmTraceSearchSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApmTraceSearchSum() bool { - if o != nil && o.ApmTraceSearchSum != nil { - return true - } - - return false -} - -// SetApmTraceSearchSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmTraceSearchSum field. -func (o *UsageBillableSummaryKeys) SetApmTraceSearchSum(v UsageBillableSummaryBody) { - o.ApmTraceSearchSum = &v -} - -// GetApplicationSecurityHostSum returns the ApplicationSecurityHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetApplicationSecurityHostSum() UsageBillableSummaryBody { - if o == nil || o.ApplicationSecurityHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ApplicationSecurityHostSum -} - -// GetApplicationSecurityHostSumOk returns a tuple with the ApplicationSecurityHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetApplicationSecurityHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ApplicationSecurityHostSum == nil { - return nil, false - } - return o.ApplicationSecurityHostSum, true -} - -// HasApplicationSecurityHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasApplicationSecurityHostSum() bool { - if o != nil && o.ApplicationSecurityHostSum != nil { - return true - } - - return false -} - -// SetApplicationSecurityHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApplicationSecurityHostSum field. -func (o *UsageBillableSummaryKeys) SetApplicationSecurityHostSum(v UsageBillableSummaryBody) { - o.ApplicationSecurityHostSum = &v -} - -// GetCiPipelineIndexedSpansSum returns the CiPipelineIndexedSpansSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCiPipelineIndexedSpansSum() UsageBillableSummaryBody { - if o == nil || o.CiPipelineIndexedSpansSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CiPipelineIndexedSpansSum -} - -// GetCiPipelineIndexedSpansSumOk returns a tuple with the CiPipelineIndexedSpansSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCiPipelineIndexedSpansSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CiPipelineIndexedSpansSum == nil { - return nil, false - } - return o.CiPipelineIndexedSpansSum, true -} - -// HasCiPipelineIndexedSpansSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCiPipelineIndexedSpansSum() bool { - if o != nil && o.CiPipelineIndexedSpansSum != nil { - return true - } - - return false -} - -// SetCiPipelineIndexedSpansSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiPipelineIndexedSpansSum field. -func (o *UsageBillableSummaryKeys) SetCiPipelineIndexedSpansSum(v UsageBillableSummaryBody) { - o.CiPipelineIndexedSpansSum = &v -} - -// GetCiPipelineMaximum returns the CiPipelineMaximum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCiPipelineMaximum() UsageBillableSummaryBody { - if o == nil || o.CiPipelineMaximum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CiPipelineMaximum -} - -// GetCiPipelineMaximumOk returns a tuple with the CiPipelineMaximum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCiPipelineMaximumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CiPipelineMaximum == nil { - return nil, false - } - return o.CiPipelineMaximum, true -} - -// HasCiPipelineMaximum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCiPipelineMaximum() bool { - if o != nil && o.CiPipelineMaximum != nil { - return true - } - - return false -} - -// SetCiPipelineMaximum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiPipelineMaximum field. -func (o *UsageBillableSummaryKeys) SetCiPipelineMaximum(v UsageBillableSummaryBody) { - o.CiPipelineMaximum = &v -} - -// GetCiPipelineSum returns the CiPipelineSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCiPipelineSum() UsageBillableSummaryBody { - if o == nil || o.CiPipelineSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CiPipelineSum -} - -// GetCiPipelineSumOk returns a tuple with the CiPipelineSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCiPipelineSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CiPipelineSum == nil { - return nil, false - } - return o.CiPipelineSum, true -} - -// HasCiPipelineSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCiPipelineSum() bool { - if o != nil && o.CiPipelineSum != nil { - return true - } - - return false -} - -// SetCiPipelineSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiPipelineSum field. -func (o *UsageBillableSummaryKeys) SetCiPipelineSum(v UsageBillableSummaryBody) { - o.CiPipelineSum = &v -} - -// GetCiTestIndexedSpansSum returns the CiTestIndexedSpansSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCiTestIndexedSpansSum() UsageBillableSummaryBody { - if o == nil || o.CiTestIndexedSpansSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CiTestIndexedSpansSum -} - -// GetCiTestIndexedSpansSumOk returns a tuple with the CiTestIndexedSpansSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCiTestIndexedSpansSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CiTestIndexedSpansSum == nil { - return nil, false - } - return o.CiTestIndexedSpansSum, true -} - -// HasCiTestIndexedSpansSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCiTestIndexedSpansSum() bool { - if o != nil && o.CiTestIndexedSpansSum != nil { - return true - } - - return false -} - -// SetCiTestIndexedSpansSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiTestIndexedSpansSum field. -func (o *UsageBillableSummaryKeys) SetCiTestIndexedSpansSum(v UsageBillableSummaryBody) { - o.CiTestIndexedSpansSum = &v -} - -// GetCiTestingMaximum returns the CiTestingMaximum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCiTestingMaximum() UsageBillableSummaryBody { - if o == nil || o.CiTestingMaximum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CiTestingMaximum -} - -// GetCiTestingMaximumOk returns a tuple with the CiTestingMaximum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCiTestingMaximumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CiTestingMaximum == nil { - return nil, false - } - return o.CiTestingMaximum, true -} - -// HasCiTestingMaximum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCiTestingMaximum() bool { - if o != nil && o.CiTestingMaximum != nil { - return true - } - - return false -} - -// SetCiTestingMaximum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiTestingMaximum field. -func (o *UsageBillableSummaryKeys) SetCiTestingMaximum(v UsageBillableSummaryBody) { - o.CiTestingMaximum = &v -} - -// GetCiTestingSum returns the CiTestingSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCiTestingSum() UsageBillableSummaryBody { - if o == nil || o.CiTestingSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CiTestingSum -} - -// GetCiTestingSumOk returns a tuple with the CiTestingSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCiTestingSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CiTestingSum == nil { - return nil, false - } - return o.CiTestingSum, true -} - -// HasCiTestingSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCiTestingSum() bool { - if o != nil && o.CiTestingSum != nil { - return true - } - - return false -} - -// SetCiTestingSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiTestingSum field. -func (o *UsageBillableSummaryKeys) SetCiTestingSum(v UsageBillableSummaryBody) { - o.CiTestingSum = &v -} - -// GetCspmContainerSum returns the CspmContainerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCspmContainerSum() UsageBillableSummaryBody { - if o == nil || o.CspmContainerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CspmContainerSum -} - -// GetCspmContainerSumOk returns a tuple with the CspmContainerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCspmContainerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CspmContainerSum == nil { - return nil, false - } - return o.CspmContainerSum, true -} - -// HasCspmContainerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCspmContainerSum() bool { - if o != nil && o.CspmContainerSum != nil { - return true - } - - return false -} - -// SetCspmContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CspmContainerSum field. -func (o *UsageBillableSummaryKeys) SetCspmContainerSum(v UsageBillableSummaryBody) { - o.CspmContainerSum = &v -} - -// GetCspmHostSum returns the CspmHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCspmHostSum() UsageBillableSummaryBody { - if o == nil || o.CspmHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CspmHostSum -} - -// GetCspmHostSumOk returns a tuple with the CspmHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCspmHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CspmHostSum == nil { - return nil, false - } - return o.CspmHostSum, true -} - -// HasCspmHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCspmHostSum() bool { - if o != nil && o.CspmHostSum != nil { - return true - } - - return false -} - -// SetCspmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CspmHostSum field. -func (o *UsageBillableSummaryKeys) SetCspmHostSum(v UsageBillableSummaryBody) { - o.CspmHostSum = &v -} - -// GetCspmHostTop99p returns the CspmHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCspmHostTop99p() UsageBillableSummaryBody { - if o == nil || o.CspmHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CspmHostTop99p -} - -// GetCspmHostTop99pOk returns a tuple with the CspmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCspmHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CspmHostTop99p == nil { - return nil, false - } - return o.CspmHostTop99p, true -} - -// HasCspmHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCspmHostTop99p() bool { - if o != nil && o.CspmHostTop99p != nil { - return true - } - - return false -} - -// SetCspmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the CspmHostTop99p field. -func (o *UsageBillableSummaryKeys) SetCspmHostTop99p(v UsageBillableSummaryBody) { - o.CspmHostTop99p = &v -} - -// GetCustomEventSum returns the CustomEventSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCustomEventSum() UsageBillableSummaryBody { - if o == nil || o.CustomEventSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CustomEventSum -} - -// GetCustomEventSumOk returns a tuple with the CustomEventSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCustomEventSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CustomEventSum == nil { - return nil, false - } - return o.CustomEventSum, true -} - -// HasCustomEventSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCustomEventSum() bool { - if o != nil && o.CustomEventSum != nil { - return true - } - - return false -} - -// SetCustomEventSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CustomEventSum field. -func (o *UsageBillableSummaryKeys) SetCustomEventSum(v UsageBillableSummaryBody) { - o.CustomEventSum = &v -} - -// GetCwsContainerSum returns the CwsContainerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCwsContainerSum() UsageBillableSummaryBody { - if o == nil || o.CwsContainerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CwsContainerSum -} - -// GetCwsContainerSumOk returns a tuple with the CwsContainerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCwsContainerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CwsContainerSum == nil { - return nil, false - } - return o.CwsContainerSum, true -} - -// HasCwsContainerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCwsContainerSum() bool { - if o != nil && o.CwsContainerSum != nil { - return true - } - - return false -} - -// SetCwsContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CwsContainerSum field. -func (o *UsageBillableSummaryKeys) SetCwsContainerSum(v UsageBillableSummaryBody) { - o.CwsContainerSum = &v -} - -// GetCwsHostSum returns the CwsHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCwsHostSum() UsageBillableSummaryBody { - if o == nil || o.CwsHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CwsHostSum -} - -// GetCwsHostSumOk returns a tuple with the CwsHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCwsHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CwsHostSum == nil { - return nil, false - } - return o.CwsHostSum, true -} - -// HasCwsHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCwsHostSum() bool { - if o != nil && o.CwsHostSum != nil { - return true - } - - return false -} - -// SetCwsHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CwsHostSum field. -func (o *UsageBillableSummaryKeys) SetCwsHostSum(v UsageBillableSummaryBody) { - o.CwsHostSum = &v -} - -// GetCwsHostTop99p returns the CwsHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetCwsHostTop99p() UsageBillableSummaryBody { - if o == nil || o.CwsHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.CwsHostTop99p -} - -// GetCwsHostTop99pOk returns a tuple with the CwsHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetCwsHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.CwsHostTop99p == nil { - return nil, false - } - return o.CwsHostTop99p, true -} - -// HasCwsHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasCwsHostTop99p() bool { - if o != nil && o.CwsHostTop99p != nil { - return true - } - - return false -} - -// SetCwsHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the CwsHostTop99p field. -func (o *UsageBillableSummaryKeys) SetCwsHostTop99p(v UsageBillableSummaryBody) { - o.CwsHostTop99p = &v -} - -// GetDbmHostSum returns the DbmHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetDbmHostSum() UsageBillableSummaryBody { - if o == nil || o.DbmHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.DbmHostSum -} - -// GetDbmHostSumOk returns a tuple with the DbmHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetDbmHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.DbmHostSum == nil { - return nil, false - } - return o.DbmHostSum, true -} - -// HasDbmHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasDbmHostSum() bool { - if o != nil && o.DbmHostSum != nil { - return true - } - - return false -} - -// SetDbmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmHostSum field. -func (o *UsageBillableSummaryKeys) SetDbmHostSum(v UsageBillableSummaryBody) { - o.DbmHostSum = &v -} - -// GetDbmHostTop99p returns the DbmHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetDbmHostTop99p() UsageBillableSummaryBody { - if o == nil || o.DbmHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.DbmHostTop99p -} - -// GetDbmHostTop99pOk returns a tuple with the DbmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetDbmHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.DbmHostTop99p == nil { - return nil, false - } - return o.DbmHostTop99p, true -} - -// HasDbmHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasDbmHostTop99p() bool { - if o != nil && o.DbmHostTop99p != nil { - return true - } - - return false -} - -// SetDbmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmHostTop99p field. -func (o *UsageBillableSummaryKeys) SetDbmHostTop99p(v UsageBillableSummaryBody) { - o.DbmHostTop99p = &v -} - -// GetDbmNormalizedQueriesAverage returns the DbmNormalizedQueriesAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesAverage() UsageBillableSummaryBody { - if o == nil || o.DbmNormalizedQueriesAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.DbmNormalizedQueriesAverage -} - -// GetDbmNormalizedQueriesAverageOk returns a tuple with the DbmNormalizedQueriesAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.DbmNormalizedQueriesAverage == nil { - return nil, false - } - return o.DbmNormalizedQueriesAverage, true -} - -// HasDbmNormalizedQueriesAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasDbmNormalizedQueriesAverage() bool { - if o != nil && o.DbmNormalizedQueriesAverage != nil { - return true - } - - return false -} - -// SetDbmNormalizedQueriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmNormalizedQueriesAverage field. -func (o *UsageBillableSummaryKeys) SetDbmNormalizedQueriesAverage(v UsageBillableSummaryBody) { - o.DbmNormalizedQueriesAverage = &v -} - -// GetDbmNormalizedQueriesSum returns the DbmNormalizedQueriesSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesSum() UsageBillableSummaryBody { - if o == nil || o.DbmNormalizedQueriesSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.DbmNormalizedQueriesSum -} - -// GetDbmNormalizedQueriesSumOk returns a tuple with the DbmNormalizedQueriesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.DbmNormalizedQueriesSum == nil { - return nil, false - } - return o.DbmNormalizedQueriesSum, true -} - -// HasDbmNormalizedQueriesSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasDbmNormalizedQueriesSum() bool { - if o != nil && o.DbmNormalizedQueriesSum != nil { - return true - } - - return false -} - -// SetDbmNormalizedQueriesSum gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmNormalizedQueriesSum field. -func (o *UsageBillableSummaryKeys) SetDbmNormalizedQueriesSum(v UsageBillableSummaryBody) { - o.DbmNormalizedQueriesSum = &v -} - -// GetFargateContainerApmAndProfilerAverage returns the FargateContainerApmAndProfilerAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerAverage() UsageBillableSummaryBody { - if o == nil || o.FargateContainerApmAndProfilerAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.FargateContainerApmAndProfilerAverage -} - -// GetFargateContainerApmAndProfilerAverageOk returns a tuple with the FargateContainerApmAndProfilerAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.FargateContainerApmAndProfilerAverage == nil { - return nil, false - } - return o.FargateContainerApmAndProfilerAverage, true -} - -// HasFargateContainerApmAndProfilerAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasFargateContainerApmAndProfilerAverage() bool { - if o != nil && o.FargateContainerApmAndProfilerAverage != nil { - return true - } - - return false -} - -// SetFargateContainerApmAndProfilerAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerApmAndProfilerAverage field. -func (o *UsageBillableSummaryKeys) SetFargateContainerApmAndProfilerAverage(v UsageBillableSummaryBody) { - o.FargateContainerApmAndProfilerAverage = &v -} - -// GetFargateContainerApmAndProfilerSum returns the FargateContainerApmAndProfilerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerSum() UsageBillableSummaryBody { - if o == nil || o.FargateContainerApmAndProfilerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.FargateContainerApmAndProfilerSum -} - -// GetFargateContainerApmAndProfilerSumOk returns a tuple with the FargateContainerApmAndProfilerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.FargateContainerApmAndProfilerSum == nil { - return nil, false - } - return o.FargateContainerApmAndProfilerSum, true -} - -// HasFargateContainerApmAndProfilerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasFargateContainerApmAndProfilerSum() bool { - if o != nil && o.FargateContainerApmAndProfilerSum != nil { - return true - } - - return false -} - -// SetFargateContainerApmAndProfilerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerApmAndProfilerSum field. -func (o *UsageBillableSummaryKeys) SetFargateContainerApmAndProfilerSum(v UsageBillableSummaryBody) { - o.FargateContainerApmAndProfilerSum = &v -} - -// GetFargateContainerAverage returns the FargateContainerAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetFargateContainerAverage() UsageBillableSummaryBody { - if o == nil || o.FargateContainerAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.FargateContainerAverage -} - -// GetFargateContainerAverageOk returns a tuple with the FargateContainerAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetFargateContainerAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.FargateContainerAverage == nil { - return nil, false - } - return o.FargateContainerAverage, true -} - -// HasFargateContainerAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasFargateContainerAverage() bool { - if o != nil && o.FargateContainerAverage != nil { - return true - } - - return false -} - -// SetFargateContainerAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerAverage field. -func (o *UsageBillableSummaryKeys) SetFargateContainerAverage(v UsageBillableSummaryBody) { - o.FargateContainerAverage = &v -} - -// GetFargateContainerProfilerAverage returns the FargateContainerProfilerAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerAverage() UsageBillableSummaryBody { - if o == nil || o.FargateContainerProfilerAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.FargateContainerProfilerAverage -} - -// GetFargateContainerProfilerAverageOk returns a tuple with the FargateContainerProfilerAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.FargateContainerProfilerAverage == nil { - return nil, false - } - return o.FargateContainerProfilerAverage, true -} - -// HasFargateContainerProfilerAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasFargateContainerProfilerAverage() bool { - if o != nil && o.FargateContainerProfilerAverage != nil { - return true - } - - return false -} - -// SetFargateContainerProfilerAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerProfilerAverage field. -func (o *UsageBillableSummaryKeys) SetFargateContainerProfilerAverage(v UsageBillableSummaryBody) { - o.FargateContainerProfilerAverage = &v -} - -// GetFargateContainerProfilerSum returns the FargateContainerProfilerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerSum() UsageBillableSummaryBody { - if o == nil || o.FargateContainerProfilerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.FargateContainerProfilerSum -} - -// GetFargateContainerProfilerSumOk returns a tuple with the FargateContainerProfilerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.FargateContainerProfilerSum == nil { - return nil, false - } - return o.FargateContainerProfilerSum, true -} - -// HasFargateContainerProfilerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasFargateContainerProfilerSum() bool { - if o != nil && o.FargateContainerProfilerSum != nil { - return true - } - - return false -} - -// SetFargateContainerProfilerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerProfilerSum field. -func (o *UsageBillableSummaryKeys) SetFargateContainerProfilerSum(v UsageBillableSummaryBody) { - o.FargateContainerProfilerSum = &v -} - -// GetFargateContainerSum returns the FargateContainerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetFargateContainerSum() UsageBillableSummaryBody { - if o == nil || o.FargateContainerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.FargateContainerSum -} - -// GetFargateContainerSumOk returns a tuple with the FargateContainerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetFargateContainerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.FargateContainerSum == nil { - return nil, false - } - return o.FargateContainerSum, true -} - -// HasFargateContainerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasFargateContainerSum() bool { - if o != nil && o.FargateContainerSum != nil { - return true - } - - return false -} - -// SetFargateContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerSum field. -func (o *UsageBillableSummaryKeys) SetFargateContainerSum(v UsageBillableSummaryBody) { - o.FargateContainerSum = &v -} - -// GetIncidentManagementMaximum returns the IncidentManagementMaximum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetIncidentManagementMaximum() UsageBillableSummaryBody { - if o == nil || o.IncidentManagementMaximum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.IncidentManagementMaximum -} - -// GetIncidentManagementMaximumOk returns a tuple with the IncidentManagementMaximum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetIncidentManagementMaximumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.IncidentManagementMaximum == nil { - return nil, false - } - return o.IncidentManagementMaximum, true -} - -// HasIncidentManagementMaximum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasIncidentManagementMaximum() bool { - if o != nil && o.IncidentManagementMaximum != nil { - return true - } - - return false -} - -// SetIncidentManagementMaximum gets a reference to the given UsageBillableSummaryBody and assigns it to the IncidentManagementMaximum field. -func (o *UsageBillableSummaryKeys) SetIncidentManagementMaximum(v UsageBillableSummaryBody) { - o.IncidentManagementMaximum = &v -} - -// GetIncidentManagementSum returns the IncidentManagementSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetIncidentManagementSum() UsageBillableSummaryBody { - if o == nil || o.IncidentManagementSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.IncidentManagementSum -} - -// GetIncidentManagementSumOk returns a tuple with the IncidentManagementSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetIncidentManagementSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.IncidentManagementSum == nil { - return nil, false - } - return o.IncidentManagementSum, true -} - -// HasIncidentManagementSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasIncidentManagementSum() bool { - if o != nil && o.IncidentManagementSum != nil { - return true - } - - return false -} - -// SetIncidentManagementSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IncidentManagementSum field. -func (o *UsageBillableSummaryKeys) SetIncidentManagementSum(v UsageBillableSummaryBody) { - o.IncidentManagementSum = &v -} - -// GetInfraAndApmHostSum returns the InfraAndApmHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetInfraAndApmHostSum() UsageBillableSummaryBody { - if o == nil || o.InfraAndApmHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.InfraAndApmHostSum -} - -// GetInfraAndApmHostSumOk returns a tuple with the InfraAndApmHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetInfraAndApmHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.InfraAndApmHostSum == nil { - return nil, false - } - return o.InfraAndApmHostSum, true -} - -// HasInfraAndApmHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasInfraAndApmHostSum() bool { - if o != nil && o.InfraAndApmHostSum != nil { - return true - } - - return false -} - -// SetInfraAndApmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraAndApmHostSum field. -func (o *UsageBillableSummaryKeys) SetInfraAndApmHostSum(v UsageBillableSummaryBody) { - o.InfraAndApmHostSum = &v -} - -// GetInfraAndApmHostTop99p returns the InfraAndApmHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetInfraAndApmHostTop99p() UsageBillableSummaryBody { - if o == nil || o.InfraAndApmHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.InfraAndApmHostTop99p -} - -// GetInfraAndApmHostTop99pOk returns a tuple with the InfraAndApmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetInfraAndApmHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.InfraAndApmHostTop99p == nil { - return nil, false - } - return o.InfraAndApmHostTop99p, true -} - -// HasInfraAndApmHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasInfraAndApmHostTop99p() bool { - if o != nil && o.InfraAndApmHostTop99p != nil { - return true - } - - return false -} - -// SetInfraAndApmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraAndApmHostTop99p field. -func (o *UsageBillableSummaryKeys) SetInfraAndApmHostTop99p(v UsageBillableSummaryBody) { - o.InfraAndApmHostTop99p = &v -} - -// GetInfraContainerSum returns the InfraContainerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetInfraContainerSum() UsageBillableSummaryBody { - if o == nil || o.InfraContainerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.InfraContainerSum -} - -// GetInfraContainerSumOk returns a tuple with the InfraContainerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetInfraContainerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.InfraContainerSum == nil { - return nil, false - } - return o.InfraContainerSum, true -} - -// HasInfraContainerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasInfraContainerSum() bool { - if o != nil && o.InfraContainerSum != nil { - return true - } - - return false -} - -// SetInfraContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraContainerSum field. -func (o *UsageBillableSummaryKeys) SetInfraContainerSum(v UsageBillableSummaryBody) { - o.InfraContainerSum = &v -} - -// GetInfraHostSum returns the InfraHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetInfraHostSum() UsageBillableSummaryBody { - if o == nil || o.InfraHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.InfraHostSum -} - -// GetInfraHostSumOk returns a tuple with the InfraHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetInfraHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.InfraHostSum == nil { - return nil, false - } - return o.InfraHostSum, true -} - -// HasInfraHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasInfraHostSum() bool { - if o != nil && o.InfraHostSum != nil { - return true - } - - return false -} - -// SetInfraHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraHostSum field. -func (o *UsageBillableSummaryKeys) SetInfraHostSum(v UsageBillableSummaryBody) { - o.InfraHostSum = &v -} - -// GetInfraHostTop99p returns the InfraHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetInfraHostTop99p() UsageBillableSummaryBody { - if o == nil || o.InfraHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.InfraHostTop99p -} - -// GetInfraHostTop99pOk returns a tuple with the InfraHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetInfraHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.InfraHostTop99p == nil { - return nil, false - } - return o.InfraHostTop99p, true -} - -// HasInfraHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasInfraHostTop99p() bool { - if o != nil && o.InfraHostTop99p != nil { - return true - } - - return false -} - -// SetInfraHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraHostTop99p field. -func (o *UsageBillableSummaryKeys) SetInfraHostTop99p(v UsageBillableSummaryBody) { - o.InfraHostTop99p = &v -} - -// GetIngestedSpansSum returns the IngestedSpansSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetIngestedSpansSum() UsageBillableSummaryBody { - if o == nil || o.IngestedSpansSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.IngestedSpansSum -} - -// GetIngestedSpansSumOk returns a tuple with the IngestedSpansSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetIngestedSpansSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.IngestedSpansSum == nil { - return nil, false - } - return o.IngestedSpansSum, true -} - -// HasIngestedSpansSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasIngestedSpansSum() bool { - if o != nil && o.IngestedSpansSum != nil { - return true - } - - return false -} - -// SetIngestedSpansSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IngestedSpansSum field. -func (o *UsageBillableSummaryKeys) SetIngestedSpansSum(v UsageBillableSummaryBody) { - o.IngestedSpansSum = &v -} - -// GetIngestedTimeseriesAverage returns the IngestedTimeseriesAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesAverage() UsageBillableSummaryBody { - if o == nil || o.IngestedTimeseriesAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.IngestedTimeseriesAverage -} - -// GetIngestedTimeseriesAverageOk returns a tuple with the IngestedTimeseriesAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.IngestedTimeseriesAverage == nil { - return nil, false - } - return o.IngestedTimeseriesAverage, true -} - -// HasIngestedTimeseriesAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasIngestedTimeseriesAverage() bool { - if o != nil && o.IngestedTimeseriesAverage != nil { - return true - } - - return false -} - -// SetIngestedTimeseriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the IngestedTimeseriesAverage field. -func (o *UsageBillableSummaryKeys) SetIngestedTimeseriesAverage(v UsageBillableSummaryBody) { - o.IngestedTimeseriesAverage = &v -} - -// GetIngestedTimeseriesSum returns the IngestedTimeseriesSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesSum() UsageBillableSummaryBody { - if o == nil || o.IngestedTimeseriesSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.IngestedTimeseriesSum -} - -// GetIngestedTimeseriesSumOk returns a tuple with the IngestedTimeseriesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.IngestedTimeseriesSum == nil { - return nil, false - } - return o.IngestedTimeseriesSum, true -} - -// HasIngestedTimeseriesSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasIngestedTimeseriesSum() bool { - if o != nil && o.IngestedTimeseriesSum != nil { - return true - } - - return false -} - -// SetIngestedTimeseriesSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IngestedTimeseriesSum field. -func (o *UsageBillableSummaryKeys) SetIngestedTimeseriesSum(v UsageBillableSummaryBody) { - o.IngestedTimeseriesSum = &v -} - -// GetIotSum returns the IotSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetIotSum() UsageBillableSummaryBody { - if o == nil || o.IotSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.IotSum -} - -// GetIotSumOk returns a tuple with the IotSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetIotSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.IotSum == nil { - return nil, false - } - return o.IotSum, true -} - -// HasIotSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasIotSum() bool { - if o != nil && o.IotSum != nil { - return true - } - - return false -} - -// SetIotSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IotSum field. -func (o *UsageBillableSummaryKeys) SetIotSum(v UsageBillableSummaryBody) { - o.IotSum = &v -} - -// GetIotTop99p returns the IotTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetIotTop99p() UsageBillableSummaryBody { - if o == nil || o.IotTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.IotTop99p -} - -// GetIotTop99pOk returns a tuple with the IotTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetIotTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.IotTop99p == nil { - return nil, false - } - return o.IotTop99p, true -} - -// HasIotTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasIotTop99p() bool { - if o != nil && o.IotTop99p != nil { - return true - } - - return false -} - -// SetIotTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the IotTop99p field. -func (o *UsageBillableSummaryKeys) SetIotTop99p(v UsageBillableSummaryBody) { - o.IotTop99p = &v -} - -// GetLambdaFunctionAverage returns the LambdaFunctionAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLambdaFunctionAverage() UsageBillableSummaryBody { - if o == nil || o.LambdaFunctionAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LambdaFunctionAverage -} - -// GetLambdaFunctionAverageOk returns a tuple with the LambdaFunctionAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLambdaFunctionAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LambdaFunctionAverage == nil { - return nil, false - } - return o.LambdaFunctionAverage, true -} - -// HasLambdaFunctionAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLambdaFunctionAverage() bool { - if o != nil && o.LambdaFunctionAverage != nil { - return true - } - - return false -} - -// SetLambdaFunctionAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the LambdaFunctionAverage field. -func (o *UsageBillableSummaryKeys) SetLambdaFunctionAverage(v UsageBillableSummaryBody) { - o.LambdaFunctionAverage = &v -} - -// GetLambdaFunctionSum returns the LambdaFunctionSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLambdaFunctionSum() UsageBillableSummaryBody { - if o == nil || o.LambdaFunctionSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LambdaFunctionSum -} - -// GetLambdaFunctionSumOk returns a tuple with the LambdaFunctionSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLambdaFunctionSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LambdaFunctionSum == nil { - return nil, false - } - return o.LambdaFunctionSum, true -} - -// HasLambdaFunctionSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLambdaFunctionSum() bool { - if o != nil && o.LambdaFunctionSum != nil { - return true - } - - return false -} - -// SetLambdaFunctionSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LambdaFunctionSum field. -func (o *UsageBillableSummaryKeys) SetLambdaFunctionSum(v UsageBillableSummaryBody) { - o.LambdaFunctionSum = &v -} - -// GetLogsIndexed15daySum returns the LogsIndexed15daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed15daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed15daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed15daySum -} - -// GetLogsIndexed15daySumOk returns a tuple with the LogsIndexed15daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed15daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed15daySum == nil { - return nil, false - } - return o.LogsIndexed15daySum, true -} - -// HasLogsIndexed15daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed15daySum() bool { - if o != nil && o.LogsIndexed15daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed15daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed15daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed15daySum(v UsageBillableSummaryBody) { - o.LogsIndexed15daySum = &v -} - -// GetLogsIndexed180daySum returns the LogsIndexed180daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed180daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed180daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed180daySum -} - -// GetLogsIndexed180daySumOk returns a tuple with the LogsIndexed180daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed180daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed180daySum == nil { - return nil, false - } - return o.LogsIndexed180daySum, true -} - -// HasLogsIndexed180daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed180daySum() bool { - if o != nil && o.LogsIndexed180daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed180daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed180daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed180daySum(v UsageBillableSummaryBody) { - o.LogsIndexed180daySum = &v -} - -// GetLogsIndexed30daySum returns the LogsIndexed30daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed30daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed30daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed30daySum -} - -// GetLogsIndexed30daySumOk returns a tuple with the LogsIndexed30daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed30daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed30daySum == nil { - return nil, false - } - return o.LogsIndexed30daySum, true -} - -// HasLogsIndexed30daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed30daySum() bool { - if o != nil && o.LogsIndexed30daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed30daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed30daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed30daySum(v UsageBillableSummaryBody) { - o.LogsIndexed30daySum = &v -} - -// GetLogsIndexed360daySum returns the LogsIndexed360daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed360daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed360daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed360daySum -} - -// GetLogsIndexed360daySumOk returns a tuple with the LogsIndexed360daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed360daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed360daySum == nil { - return nil, false - } - return o.LogsIndexed360daySum, true -} - -// HasLogsIndexed360daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed360daySum() bool { - if o != nil && o.LogsIndexed360daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed360daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed360daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed360daySum(v UsageBillableSummaryBody) { - o.LogsIndexed360daySum = &v -} - -// GetLogsIndexed3daySum returns the LogsIndexed3daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed3daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed3daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed3daySum -} - -// GetLogsIndexed3daySumOk returns a tuple with the LogsIndexed3daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed3daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed3daySum == nil { - return nil, false - } - return o.LogsIndexed3daySum, true -} - -// HasLogsIndexed3daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed3daySum() bool { - if o != nil && o.LogsIndexed3daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed3daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed3daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed3daySum(v UsageBillableSummaryBody) { - o.LogsIndexed3daySum = &v -} - -// GetLogsIndexed45daySum returns the LogsIndexed45daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed45daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed45daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed45daySum -} - -// GetLogsIndexed45daySumOk returns a tuple with the LogsIndexed45daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed45daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed45daySum == nil { - return nil, false - } - return o.LogsIndexed45daySum, true -} - -// HasLogsIndexed45daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed45daySum() bool { - if o != nil && o.LogsIndexed45daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed45daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed45daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed45daySum(v UsageBillableSummaryBody) { - o.LogsIndexed45daySum = &v -} - -// GetLogsIndexed60daySum returns the LogsIndexed60daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed60daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed60daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed60daySum -} - -// GetLogsIndexed60daySumOk returns a tuple with the LogsIndexed60daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed60daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed60daySum == nil { - return nil, false - } - return o.LogsIndexed60daySum, true -} - -// HasLogsIndexed60daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed60daySum() bool { - if o != nil && o.LogsIndexed60daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed60daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed60daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed60daySum(v UsageBillableSummaryBody) { - o.LogsIndexed60daySum = &v -} - -// GetLogsIndexed7daySum returns the LogsIndexed7daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed7daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed7daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed7daySum -} - -// GetLogsIndexed7daySumOk returns a tuple with the LogsIndexed7daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed7daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed7daySum == nil { - return nil, false - } - return o.LogsIndexed7daySum, true -} - -// HasLogsIndexed7daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed7daySum() bool { - if o != nil && o.LogsIndexed7daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed7daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed7daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed7daySum(v UsageBillableSummaryBody) { - o.LogsIndexed7daySum = &v -} - -// GetLogsIndexed90daySum returns the LogsIndexed90daySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexed90daySum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexed90daySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexed90daySum -} - -// GetLogsIndexed90daySumOk returns a tuple with the LogsIndexed90daySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexed90daySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexed90daySum == nil { - return nil, false - } - return o.LogsIndexed90daySum, true -} - -// HasLogsIndexed90daySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexed90daySum() bool { - if o != nil && o.LogsIndexed90daySum != nil { - return true - } - - return false -} - -// SetLogsIndexed90daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed90daySum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexed90daySum(v UsageBillableSummaryBody) { - o.LogsIndexed90daySum = &v -} - -// GetLogsIndexedCustomRetentionSum returns the LogsIndexedCustomRetentionSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexedCustomRetentionSum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexedCustomRetentionSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexedCustomRetentionSum -} - -// GetLogsIndexedCustomRetentionSumOk returns a tuple with the LogsIndexedCustomRetentionSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexedCustomRetentionSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexedCustomRetentionSum == nil { - return nil, false - } - return o.LogsIndexedCustomRetentionSum, true -} - -// HasLogsIndexedCustomRetentionSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexedCustomRetentionSum() bool { - if o != nil && o.LogsIndexedCustomRetentionSum != nil { - return true - } - - return false -} - -// SetLogsIndexedCustomRetentionSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexedCustomRetentionSum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexedCustomRetentionSum(v UsageBillableSummaryBody) { - o.LogsIndexedCustomRetentionSum = &v -} - -// GetLogsIndexedSum returns the LogsIndexedSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIndexedSum() UsageBillableSummaryBody { - if o == nil || o.LogsIndexedSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIndexedSum -} - -// GetLogsIndexedSumOk returns a tuple with the LogsIndexedSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIndexedSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIndexedSum == nil { - return nil, false - } - return o.LogsIndexedSum, true -} - -// HasLogsIndexedSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIndexedSum() bool { - if o != nil && o.LogsIndexedSum != nil { - return true - } - - return false -} - -// SetLogsIndexedSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexedSum field. -func (o *UsageBillableSummaryKeys) SetLogsIndexedSum(v UsageBillableSummaryBody) { - o.LogsIndexedSum = &v -} - -// GetLogsIngestedSum returns the LogsIngestedSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetLogsIngestedSum() UsageBillableSummaryBody { - if o == nil || o.LogsIngestedSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.LogsIngestedSum -} - -// GetLogsIngestedSumOk returns a tuple with the LogsIngestedSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetLogsIngestedSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.LogsIngestedSum == nil { - return nil, false - } - return o.LogsIngestedSum, true -} - -// HasLogsIngestedSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasLogsIngestedSum() bool { - if o != nil && o.LogsIngestedSum != nil { - return true - } - - return false -} - -// SetLogsIngestedSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIngestedSum field. -func (o *UsageBillableSummaryKeys) SetLogsIngestedSum(v UsageBillableSummaryBody) { - o.LogsIngestedSum = &v -} - -// GetNetworkDeviceSum returns the NetworkDeviceSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetNetworkDeviceSum() UsageBillableSummaryBody { - if o == nil || o.NetworkDeviceSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.NetworkDeviceSum -} - -// GetNetworkDeviceSumOk returns a tuple with the NetworkDeviceSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetNetworkDeviceSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.NetworkDeviceSum == nil { - return nil, false - } - return o.NetworkDeviceSum, true -} - -// HasNetworkDeviceSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasNetworkDeviceSum() bool { - if o != nil && o.NetworkDeviceSum != nil { - return true - } - - return false -} - -// SetNetworkDeviceSum gets a reference to the given UsageBillableSummaryBody and assigns it to the NetworkDeviceSum field. -func (o *UsageBillableSummaryKeys) SetNetworkDeviceSum(v UsageBillableSummaryBody) { - o.NetworkDeviceSum = &v -} - -// GetNetworkDeviceTop99p returns the NetworkDeviceTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetNetworkDeviceTop99p() UsageBillableSummaryBody { - if o == nil || o.NetworkDeviceTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.NetworkDeviceTop99p -} - -// GetNetworkDeviceTop99pOk returns a tuple with the NetworkDeviceTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetNetworkDeviceTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.NetworkDeviceTop99p == nil { - return nil, false - } - return o.NetworkDeviceTop99p, true -} - -// HasNetworkDeviceTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasNetworkDeviceTop99p() bool { - if o != nil && o.NetworkDeviceTop99p != nil { - return true - } - - return false -} - -// SetNetworkDeviceTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the NetworkDeviceTop99p field. -func (o *UsageBillableSummaryKeys) SetNetworkDeviceTop99p(v UsageBillableSummaryBody) { - o.NetworkDeviceTop99p = &v -} - -// GetNpmFlowSum returns the NpmFlowSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetNpmFlowSum() UsageBillableSummaryBody { - if o == nil || o.NpmFlowSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.NpmFlowSum -} - -// GetNpmFlowSumOk returns a tuple with the NpmFlowSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetNpmFlowSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.NpmFlowSum == nil { - return nil, false - } - return o.NpmFlowSum, true -} - -// HasNpmFlowSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasNpmFlowSum() bool { - if o != nil && o.NpmFlowSum != nil { - return true - } - - return false -} - -// SetNpmFlowSum gets a reference to the given UsageBillableSummaryBody and assigns it to the NpmFlowSum field. -func (o *UsageBillableSummaryKeys) SetNpmFlowSum(v UsageBillableSummaryBody) { - o.NpmFlowSum = &v -} - -// GetNpmHostSum returns the NpmHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetNpmHostSum() UsageBillableSummaryBody { - if o == nil || o.NpmHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.NpmHostSum -} - -// GetNpmHostSumOk returns a tuple with the NpmHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetNpmHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.NpmHostSum == nil { - return nil, false - } - return o.NpmHostSum, true -} - -// HasNpmHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasNpmHostSum() bool { - if o != nil && o.NpmHostSum != nil { - return true - } - - return false -} - -// SetNpmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the NpmHostSum field. -func (o *UsageBillableSummaryKeys) SetNpmHostSum(v UsageBillableSummaryBody) { - o.NpmHostSum = &v -} - -// GetNpmHostTop99p returns the NpmHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetNpmHostTop99p() UsageBillableSummaryBody { - if o == nil || o.NpmHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.NpmHostTop99p -} - -// GetNpmHostTop99pOk returns a tuple with the NpmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetNpmHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.NpmHostTop99p == nil { - return nil, false - } - return o.NpmHostTop99p, true -} - -// HasNpmHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasNpmHostTop99p() bool { - if o != nil && o.NpmHostTop99p != nil { - return true - } - - return false -} - -// SetNpmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the NpmHostTop99p field. -func (o *UsageBillableSummaryKeys) SetNpmHostTop99p(v UsageBillableSummaryBody) { - o.NpmHostTop99p = &v -} - -// GetObservabilityPipelineSum returns the ObservabilityPipelineSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetObservabilityPipelineSum() UsageBillableSummaryBody { - if o == nil || o.ObservabilityPipelineSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ObservabilityPipelineSum -} - -// GetObservabilityPipelineSumOk returns a tuple with the ObservabilityPipelineSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetObservabilityPipelineSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ObservabilityPipelineSum == nil { - return nil, false - } - return o.ObservabilityPipelineSum, true -} - -// HasObservabilityPipelineSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasObservabilityPipelineSum() bool { - if o != nil && o.ObservabilityPipelineSum != nil { - return true - } - - return false -} - -// SetObservabilityPipelineSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ObservabilityPipelineSum field. -func (o *UsageBillableSummaryKeys) SetObservabilityPipelineSum(v UsageBillableSummaryBody) { - o.ObservabilityPipelineSum = &v -} - -// GetOnlineArchiveSum returns the OnlineArchiveSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetOnlineArchiveSum() UsageBillableSummaryBody { - if o == nil || o.OnlineArchiveSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.OnlineArchiveSum -} - -// GetOnlineArchiveSumOk returns a tuple with the OnlineArchiveSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetOnlineArchiveSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.OnlineArchiveSum == nil { - return nil, false - } - return o.OnlineArchiveSum, true -} - -// HasOnlineArchiveSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasOnlineArchiveSum() bool { - if o != nil && o.OnlineArchiveSum != nil { - return true - } - - return false -} - -// SetOnlineArchiveSum gets a reference to the given UsageBillableSummaryBody and assigns it to the OnlineArchiveSum field. -func (o *UsageBillableSummaryKeys) SetOnlineArchiveSum(v UsageBillableSummaryBody) { - o.OnlineArchiveSum = &v -} - -// GetProfContainerSum returns the ProfContainerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetProfContainerSum() UsageBillableSummaryBody { - if o == nil || o.ProfContainerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ProfContainerSum -} - -// GetProfContainerSumOk returns a tuple with the ProfContainerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetProfContainerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ProfContainerSum == nil { - return nil, false - } - return o.ProfContainerSum, true -} - -// HasProfContainerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasProfContainerSum() bool { - if o != nil && o.ProfContainerSum != nil { - return true - } - - return false -} - -// SetProfContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ProfContainerSum field. -func (o *UsageBillableSummaryKeys) SetProfContainerSum(v UsageBillableSummaryBody) { - o.ProfContainerSum = &v -} - -// GetProfHostSum returns the ProfHostSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetProfHostSum() UsageBillableSummaryBody { - if o == nil || o.ProfHostSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ProfHostSum -} - -// GetProfHostSumOk returns a tuple with the ProfHostSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetProfHostSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ProfHostSum == nil { - return nil, false - } - return o.ProfHostSum, true -} - -// HasProfHostSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasProfHostSum() bool { - if o != nil && o.ProfHostSum != nil { - return true - } - - return false -} - -// SetProfHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ProfHostSum field. -func (o *UsageBillableSummaryKeys) SetProfHostSum(v UsageBillableSummaryBody) { - o.ProfHostSum = &v -} - -// GetProfHostTop99p returns the ProfHostTop99p field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetProfHostTop99p() UsageBillableSummaryBody { - if o == nil || o.ProfHostTop99p == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ProfHostTop99p -} - -// GetProfHostTop99pOk returns a tuple with the ProfHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetProfHostTop99pOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ProfHostTop99p == nil { - return nil, false - } - return o.ProfHostTop99p, true -} - -// HasProfHostTop99p returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasProfHostTop99p() bool { - if o != nil && o.ProfHostTop99p != nil { - return true - } - - return false -} - -// SetProfHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the ProfHostTop99p field. -func (o *UsageBillableSummaryKeys) SetProfHostTop99p(v UsageBillableSummaryBody) { - o.ProfHostTop99p = &v -} - -// GetRumLiteSum returns the RumLiteSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetRumLiteSum() UsageBillableSummaryBody { - if o == nil || o.RumLiteSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.RumLiteSum -} - -// GetRumLiteSumOk returns a tuple with the RumLiteSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetRumLiteSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.RumLiteSum == nil { - return nil, false - } - return o.RumLiteSum, true -} - -// HasRumLiteSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasRumLiteSum() bool { - if o != nil && o.RumLiteSum != nil { - return true - } - - return false -} - -// SetRumLiteSum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumLiteSum field. -func (o *UsageBillableSummaryKeys) SetRumLiteSum(v UsageBillableSummaryBody) { - o.RumLiteSum = &v -} - -// GetRumReplaySum returns the RumReplaySum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetRumReplaySum() UsageBillableSummaryBody { - if o == nil || o.RumReplaySum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.RumReplaySum -} - -// GetRumReplaySumOk returns a tuple with the RumReplaySum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetRumReplaySumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.RumReplaySum == nil { - return nil, false - } - return o.RumReplaySum, true -} - -// HasRumReplaySum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasRumReplaySum() bool { - if o != nil && o.RumReplaySum != nil { - return true - } - - return false -} - -// SetRumReplaySum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumReplaySum field. -func (o *UsageBillableSummaryKeys) SetRumReplaySum(v UsageBillableSummaryBody) { - o.RumReplaySum = &v -} - -// GetRumSum returns the RumSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetRumSum() UsageBillableSummaryBody { - if o == nil || o.RumSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.RumSum -} - -// GetRumSumOk returns a tuple with the RumSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetRumSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.RumSum == nil { - return nil, false - } - return o.RumSum, true -} - -// HasRumSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasRumSum() bool { - if o != nil && o.RumSum != nil { - return true - } - - return false -} - -// SetRumSum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumSum field. -func (o *UsageBillableSummaryKeys) SetRumSum(v UsageBillableSummaryBody) { - o.RumSum = &v -} - -// GetRumUnitsSum returns the RumUnitsSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetRumUnitsSum() UsageBillableSummaryBody { - if o == nil || o.RumUnitsSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.RumUnitsSum -} - -// GetRumUnitsSumOk returns a tuple with the RumUnitsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetRumUnitsSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.RumUnitsSum == nil { - return nil, false - } - return o.RumUnitsSum, true -} - -// HasRumUnitsSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasRumUnitsSum() bool { - if o != nil && o.RumUnitsSum != nil { - return true - } - - return false -} - -// SetRumUnitsSum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumUnitsSum field. -func (o *UsageBillableSummaryKeys) SetRumUnitsSum(v UsageBillableSummaryBody) { - o.RumUnitsSum = &v -} - -// GetSensitiveDataScannerSum returns the SensitiveDataScannerSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetSensitiveDataScannerSum() UsageBillableSummaryBody { - if o == nil || o.SensitiveDataScannerSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.SensitiveDataScannerSum -} - -// GetSensitiveDataScannerSumOk returns a tuple with the SensitiveDataScannerSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetSensitiveDataScannerSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.SensitiveDataScannerSum == nil { - return nil, false - } - return o.SensitiveDataScannerSum, true -} - -// HasSensitiveDataScannerSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasSensitiveDataScannerSum() bool { - if o != nil && o.SensitiveDataScannerSum != nil { - return true - } - - return false -} - -// SetSensitiveDataScannerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SensitiveDataScannerSum field. -func (o *UsageBillableSummaryKeys) SetSensitiveDataScannerSum(v UsageBillableSummaryBody) { - o.SensitiveDataScannerSum = &v -} - -// GetServerlessInvocationSum returns the ServerlessInvocationSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetServerlessInvocationSum() UsageBillableSummaryBody { - if o == nil || o.ServerlessInvocationSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.ServerlessInvocationSum -} - -// GetServerlessInvocationSumOk returns a tuple with the ServerlessInvocationSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetServerlessInvocationSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.ServerlessInvocationSum == nil { - return nil, false - } - return o.ServerlessInvocationSum, true -} - -// HasServerlessInvocationSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasServerlessInvocationSum() bool { - if o != nil && o.ServerlessInvocationSum != nil { - return true - } - - return false -} - -// SetServerlessInvocationSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ServerlessInvocationSum field. -func (o *UsageBillableSummaryKeys) SetServerlessInvocationSum(v UsageBillableSummaryBody) { - o.ServerlessInvocationSum = &v -} - -// GetSiemSum returns the SiemSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetSiemSum() UsageBillableSummaryBody { - if o == nil || o.SiemSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.SiemSum -} - -// GetSiemSumOk returns a tuple with the SiemSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetSiemSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.SiemSum == nil { - return nil, false - } - return o.SiemSum, true -} - -// HasSiemSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasSiemSum() bool { - if o != nil && o.SiemSum != nil { - return true - } - - return false -} - -// SetSiemSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SiemSum field. -func (o *UsageBillableSummaryKeys) SetSiemSum(v UsageBillableSummaryBody) { - o.SiemSum = &v -} - -// GetStandardTimeseriesAverage returns the StandardTimeseriesAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetStandardTimeseriesAverage() UsageBillableSummaryBody { - if o == nil || o.StandardTimeseriesAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.StandardTimeseriesAverage -} - -// GetStandardTimeseriesAverageOk returns a tuple with the StandardTimeseriesAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetStandardTimeseriesAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.StandardTimeseriesAverage == nil { - return nil, false - } - return o.StandardTimeseriesAverage, true -} - -// HasStandardTimeseriesAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasStandardTimeseriesAverage() bool { - if o != nil && o.StandardTimeseriesAverage != nil { - return true - } - - return false -} - -// SetStandardTimeseriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the StandardTimeseriesAverage field. -func (o *UsageBillableSummaryKeys) SetStandardTimeseriesAverage(v UsageBillableSummaryBody) { - o.StandardTimeseriesAverage = &v -} - -// GetSyntheticsApiTestsSum returns the SyntheticsApiTestsSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetSyntheticsApiTestsSum() UsageBillableSummaryBody { - if o == nil || o.SyntheticsApiTestsSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.SyntheticsApiTestsSum -} - -// GetSyntheticsApiTestsSumOk returns a tuple with the SyntheticsApiTestsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetSyntheticsApiTestsSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.SyntheticsApiTestsSum == nil { - return nil, false - } - return o.SyntheticsApiTestsSum, true -} - -// HasSyntheticsApiTestsSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasSyntheticsApiTestsSum() bool { - if o != nil && o.SyntheticsApiTestsSum != nil { - return true - } - - return false -} - -// SetSyntheticsApiTestsSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SyntheticsApiTestsSum field. -func (o *UsageBillableSummaryKeys) SetSyntheticsApiTestsSum(v UsageBillableSummaryBody) { - o.SyntheticsApiTestsSum = &v -} - -// GetSyntheticsBrowserChecksSum returns the SyntheticsBrowserChecksSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetSyntheticsBrowserChecksSum() UsageBillableSummaryBody { - if o == nil || o.SyntheticsBrowserChecksSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.SyntheticsBrowserChecksSum -} - -// GetSyntheticsBrowserChecksSumOk returns a tuple with the SyntheticsBrowserChecksSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetSyntheticsBrowserChecksSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.SyntheticsBrowserChecksSum == nil { - return nil, false - } - return o.SyntheticsBrowserChecksSum, true -} - -// HasSyntheticsBrowserChecksSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasSyntheticsBrowserChecksSum() bool { - if o != nil && o.SyntheticsBrowserChecksSum != nil { - return true - } - - return false -} - -// SetSyntheticsBrowserChecksSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SyntheticsBrowserChecksSum field. -func (o *UsageBillableSummaryKeys) SetSyntheticsBrowserChecksSum(v UsageBillableSummaryBody) { - o.SyntheticsBrowserChecksSum = &v -} - -// GetTimeseriesAverage returns the TimeseriesAverage field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetTimeseriesAverage() UsageBillableSummaryBody { - if o == nil || o.TimeseriesAverage == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.TimeseriesAverage -} - -// GetTimeseriesAverageOk returns a tuple with the TimeseriesAverage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetTimeseriesAverageOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.TimeseriesAverage == nil { - return nil, false - } - return o.TimeseriesAverage, true -} - -// HasTimeseriesAverage returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasTimeseriesAverage() bool { - if o != nil && o.TimeseriesAverage != nil { - return true - } - - return false -} - -// SetTimeseriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the TimeseriesAverage field. -func (o *UsageBillableSummaryKeys) SetTimeseriesAverage(v UsageBillableSummaryBody) { - o.TimeseriesAverage = &v -} - -// GetTimeseriesSum returns the TimeseriesSum field value if set, zero value otherwise. -func (o *UsageBillableSummaryKeys) GetTimeseriesSum() UsageBillableSummaryBody { - if o == nil || o.TimeseriesSum == nil { - var ret UsageBillableSummaryBody - return ret - } - return *o.TimeseriesSum -} - -// GetTimeseriesSumOk returns a tuple with the TimeseriesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryKeys) GetTimeseriesSumOk() (*UsageBillableSummaryBody, bool) { - if o == nil || o.TimeseriesSum == nil { - return nil, false - } - return o.TimeseriesSum, true -} - -// HasTimeseriesSum returns a boolean if a field has been set. -func (o *UsageBillableSummaryKeys) HasTimeseriesSum() bool { - if o != nil && o.TimeseriesSum != nil { - return true - } - - return false -} - -// SetTimeseriesSum gets a reference to the given UsageBillableSummaryBody and assigns it to the TimeseriesSum field. -func (o *UsageBillableSummaryKeys) SetTimeseriesSum(v UsageBillableSummaryBody) { - o.TimeseriesSum = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageBillableSummaryKeys) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ApmFargateAverage != nil { - toSerialize["apm_fargate_average"] = o.ApmFargateAverage - } - if o.ApmFargateSum != nil { - toSerialize["apm_fargate_sum"] = o.ApmFargateSum - } - if o.ApmHostSum != nil { - toSerialize["apm_host_sum"] = o.ApmHostSum - } - if o.ApmHostTop99p != nil { - toSerialize["apm_host_top99p"] = o.ApmHostTop99p - } - if o.ApmProfilerHostSum != nil { - toSerialize["apm_profiler_host_sum"] = o.ApmProfilerHostSum - } - if o.ApmProfilerHostTop99p != nil { - toSerialize["apm_profiler_host_top99p"] = o.ApmProfilerHostTop99p - } - if o.ApmTraceSearchSum != nil { - toSerialize["apm_trace_search_sum"] = o.ApmTraceSearchSum - } - if o.ApplicationSecurityHostSum != nil { - toSerialize["application_security_host_sum"] = o.ApplicationSecurityHostSum - } - if o.CiPipelineIndexedSpansSum != nil { - toSerialize["ci_pipeline_indexed_spans_sum"] = o.CiPipelineIndexedSpansSum - } - if o.CiPipelineMaximum != nil { - toSerialize["ci_pipeline_maximum"] = o.CiPipelineMaximum - } - if o.CiPipelineSum != nil { - toSerialize["ci_pipeline_sum"] = o.CiPipelineSum - } - if o.CiTestIndexedSpansSum != nil { - toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum - } - if o.CiTestingMaximum != nil { - toSerialize["ci_testing_maximum"] = o.CiTestingMaximum - } - if o.CiTestingSum != nil { - toSerialize["ci_testing_sum"] = o.CiTestingSum - } - if o.CspmContainerSum != nil { - toSerialize["cspm_container_sum"] = o.CspmContainerSum - } - if o.CspmHostSum != nil { - toSerialize["cspm_host_sum"] = o.CspmHostSum - } - if o.CspmHostTop99p != nil { - toSerialize["cspm_host_top99p"] = o.CspmHostTop99p - } - if o.CustomEventSum != nil { - toSerialize["custom_event_sum"] = o.CustomEventSum - } - if o.CwsContainerSum != nil { - toSerialize["cws_container_sum"] = o.CwsContainerSum - } - if o.CwsHostSum != nil { - toSerialize["cws_host_sum"] = o.CwsHostSum - } - if o.CwsHostTop99p != nil { - toSerialize["cws_host_top99p"] = o.CwsHostTop99p - } - if o.DbmHostSum != nil { - toSerialize["dbm_host_sum"] = o.DbmHostSum - } - if o.DbmHostTop99p != nil { - toSerialize["dbm_host_top99p"] = o.DbmHostTop99p - } - if o.DbmNormalizedQueriesAverage != nil { - toSerialize["dbm_normalized_queries_average"] = o.DbmNormalizedQueriesAverage - } - if o.DbmNormalizedQueriesSum != nil { - toSerialize["dbm_normalized_queries_sum"] = o.DbmNormalizedQueriesSum - } - if o.FargateContainerApmAndProfilerAverage != nil { - toSerialize["fargate_container_apm_and_profiler_average"] = o.FargateContainerApmAndProfilerAverage - } - if o.FargateContainerApmAndProfilerSum != nil { - toSerialize["fargate_container_apm_and_profiler_sum"] = o.FargateContainerApmAndProfilerSum - } - if o.FargateContainerAverage != nil { - toSerialize["fargate_container_average"] = o.FargateContainerAverage - } - if o.FargateContainerProfilerAverage != nil { - toSerialize["fargate_container_profiler_average"] = o.FargateContainerProfilerAverage - } - if o.FargateContainerProfilerSum != nil { - toSerialize["fargate_container_profiler_sum"] = o.FargateContainerProfilerSum - } - if o.FargateContainerSum != nil { - toSerialize["fargate_container_sum"] = o.FargateContainerSum - } - if o.IncidentManagementMaximum != nil { - toSerialize["incident_management_maximum"] = o.IncidentManagementMaximum - } - if o.IncidentManagementSum != nil { - toSerialize["incident_management_sum"] = o.IncidentManagementSum - } - if o.InfraAndApmHostSum != nil { - toSerialize["infra_and_apm_host_sum"] = o.InfraAndApmHostSum - } - if o.InfraAndApmHostTop99p != nil { - toSerialize["infra_and_apm_host_top99p"] = o.InfraAndApmHostTop99p - } - if o.InfraContainerSum != nil { - toSerialize["infra_container_sum"] = o.InfraContainerSum - } - if o.InfraHostSum != nil { - toSerialize["infra_host_sum"] = o.InfraHostSum - } - if o.InfraHostTop99p != nil { - toSerialize["infra_host_top99p"] = o.InfraHostTop99p - } - if o.IngestedSpansSum != nil { - toSerialize["ingested_spans_sum"] = o.IngestedSpansSum - } - if o.IngestedTimeseriesAverage != nil { - toSerialize["ingested_timeseries_average"] = o.IngestedTimeseriesAverage - } - if o.IngestedTimeseriesSum != nil { - toSerialize["ingested_timeseries_sum"] = o.IngestedTimeseriesSum - } - if o.IotSum != nil { - toSerialize["iot_sum"] = o.IotSum - } - if o.IotTop99p != nil { - toSerialize["iot_top99p"] = o.IotTop99p - } - if o.LambdaFunctionAverage != nil { - toSerialize["lambda_function_average"] = o.LambdaFunctionAverage - } - if o.LambdaFunctionSum != nil { - toSerialize["lambda_function_sum"] = o.LambdaFunctionSum - } - if o.LogsIndexed15daySum != nil { - toSerialize["logs_indexed_15day_sum"] = o.LogsIndexed15daySum - } - if o.LogsIndexed180daySum != nil { - toSerialize["logs_indexed_180day_sum"] = o.LogsIndexed180daySum - } - if o.LogsIndexed30daySum != nil { - toSerialize["logs_indexed_30day_sum"] = o.LogsIndexed30daySum - } - if o.LogsIndexed360daySum != nil { - toSerialize["logs_indexed_360day_sum"] = o.LogsIndexed360daySum - } - if o.LogsIndexed3daySum != nil { - toSerialize["logs_indexed_3day_sum"] = o.LogsIndexed3daySum - } - if o.LogsIndexed45daySum != nil { - toSerialize["logs_indexed_45day_sum"] = o.LogsIndexed45daySum - } - if o.LogsIndexed60daySum != nil { - toSerialize["logs_indexed_60day_sum"] = o.LogsIndexed60daySum - } - if o.LogsIndexed7daySum != nil { - toSerialize["logs_indexed_7day_sum"] = o.LogsIndexed7daySum - } - if o.LogsIndexed90daySum != nil { - toSerialize["logs_indexed_90day_sum"] = o.LogsIndexed90daySum - } - if o.LogsIndexedCustomRetentionSum != nil { - toSerialize["logs_indexed_custom_retention_sum"] = o.LogsIndexedCustomRetentionSum - } - if o.LogsIndexedSum != nil { - toSerialize["logs_indexed_sum"] = o.LogsIndexedSum - } - if o.LogsIngestedSum != nil { - toSerialize["logs_ingested_sum"] = o.LogsIngestedSum - } - if o.NetworkDeviceSum != nil { - toSerialize["network_device_sum"] = o.NetworkDeviceSum - } - if o.NetworkDeviceTop99p != nil { - toSerialize["network_device_top99p"] = o.NetworkDeviceTop99p - } - if o.NpmFlowSum != nil { - toSerialize["npm_flow_sum"] = o.NpmFlowSum - } - if o.NpmHostSum != nil { - toSerialize["npm_host_sum"] = o.NpmHostSum - } - if o.NpmHostTop99p != nil { - toSerialize["npm_host_top99p"] = o.NpmHostTop99p - } - if o.ObservabilityPipelineSum != nil { - toSerialize["observability_pipeline_sum"] = o.ObservabilityPipelineSum - } - if o.OnlineArchiveSum != nil { - toSerialize["online_archive_sum"] = o.OnlineArchiveSum - } - if o.ProfContainerSum != nil { - toSerialize["prof_container_sum"] = o.ProfContainerSum - } - if o.ProfHostSum != nil { - toSerialize["prof_host_sum"] = o.ProfHostSum - } - if o.ProfHostTop99p != nil { - toSerialize["prof_host_top99p"] = o.ProfHostTop99p - } - if o.RumLiteSum != nil { - toSerialize["rum_lite_sum"] = o.RumLiteSum - } - if o.RumReplaySum != nil { - toSerialize["rum_replay_sum"] = o.RumReplaySum - } - if o.RumSum != nil { - toSerialize["rum_sum"] = o.RumSum - } - if o.RumUnitsSum != nil { - toSerialize["rum_units_sum"] = o.RumUnitsSum - } - if o.SensitiveDataScannerSum != nil { - toSerialize["sensitive_data_scanner_sum"] = o.SensitiveDataScannerSum - } - if o.ServerlessInvocationSum != nil { - toSerialize["serverless_invocation_sum"] = o.ServerlessInvocationSum - } - if o.SiemSum != nil { - toSerialize["siem_sum"] = o.SiemSum - } - if o.StandardTimeseriesAverage != nil { - toSerialize["standard_timeseries_average"] = o.StandardTimeseriesAverage - } - if o.SyntheticsApiTestsSum != nil { - toSerialize["synthetics_api_tests_sum"] = o.SyntheticsApiTestsSum - } - if o.SyntheticsBrowserChecksSum != nil { - toSerialize["synthetics_browser_checks_sum"] = o.SyntheticsBrowserChecksSum - } - if o.TimeseriesAverage != nil { - toSerialize["timeseries_average"] = o.TimeseriesAverage - } - if o.TimeseriesSum != nil { - toSerialize["timeseries_sum"] = o.TimeseriesSum - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageBillableSummaryKeys) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ApmFargateAverage *UsageBillableSummaryBody `json:"apm_fargate_average,omitempty"` - ApmFargateSum *UsageBillableSummaryBody `json:"apm_fargate_sum,omitempty"` - ApmHostSum *UsageBillableSummaryBody `json:"apm_host_sum,omitempty"` - ApmHostTop99p *UsageBillableSummaryBody `json:"apm_host_top99p,omitempty"` - ApmProfilerHostSum *UsageBillableSummaryBody `json:"apm_profiler_host_sum,omitempty"` - ApmProfilerHostTop99p *UsageBillableSummaryBody `json:"apm_profiler_host_top99p,omitempty"` - ApmTraceSearchSum *UsageBillableSummaryBody `json:"apm_trace_search_sum,omitempty"` - ApplicationSecurityHostSum *UsageBillableSummaryBody `json:"application_security_host_sum,omitempty"` - CiPipelineIndexedSpansSum *UsageBillableSummaryBody `json:"ci_pipeline_indexed_spans_sum,omitempty"` - CiPipelineMaximum *UsageBillableSummaryBody `json:"ci_pipeline_maximum,omitempty"` - CiPipelineSum *UsageBillableSummaryBody `json:"ci_pipeline_sum,omitempty"` - CiTestIndexedSpansSum *UsageBillableSummaryBody `json:"ci_test_indexed_spans_sum,omitempty"` - CiTestingMaximum *UsageBillableSummaryBody `json:"ci_testing_maximum,omitempty"` - CiTestingSum *UsageBillableSummaryBody `json:"ci_testing_sum,omitempty"` - CspmContainerSum *UsageBillableSummaryBody `json:"cspm_container_sum,omitempty"` - CspmHostSum *UsageBillableSummaryBody `json:"cspm_host_sum,omitempty"` - CspmHostTop99p *UsageBillableSummaryBody `json:"cspm_host_top99p,omitempty"` - CustomEventSum *UsageBillableSummaryBody `json:"custom_event_sum,omitempty"` - CwsContainerSum *UsageBillableSummaryBody `json:"cws_container_sum,omitempty"` - CwsHostSum *UsageBillableSummaryBody `json:"cws_host_sum,omitempty"` - CwsHostTop99p *UsageBillableSummaryBody `json:"cws_host_top99p,omitempty"` - DbmHostSum *UsageBillableSummaryBody `json:"dbm_host_sum,omitempty"` - DbmHostTop99p *UsageBillableSummaryBody `json:"dbm_host_top99p,omitempty"` - DbmNormalizedQueriesAverage *UsageBillableSummaryBody `json:"dbm_normalized_queries_average,omitempty"` - DbmNormalizedQueriesSum *UsageBillableSummaryBody `json:"dbm_normalized_queries_sum,omitempty"` - FargateContainerApmAndProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_average,omitempty"` - FargateContainerApmAndProfilerSum *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_sum,omitempty"` - FargateContainerAverage *UsageBillableSummaryBody `json:"fargate_container_average,omitempty"` - FargateContainerProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_profiler_average,omitempty"` - FargateContainerProfilerSum *UsageBillableSummaryBody `json:"fargate_container_profiler_sum,omitempty"` - FargateContainerSum *UsageBillableSummaryBody `json:"fargate_container_sum,omitempty"` - IncidentManagementMaximum *UsageBillableSummaryBody `json:"incident_management_maximum,omitempty"` - IncidentManagementSum *UsageBillableSummaryBody `json:"incident_management_sum,omitempty"` - InfraAndApmHostSum *UsageBillableSummaryBody `json:"infra_and_apm_host_sum,omitempty"` - InfraAndApmHostTop99p *UsageBillableSummaryBody `json:"infra_and_apm_host_top99p,omitempty"` - InfraContainerSum *UsageBillableSummaryBody `json:"infra_container_sum,omitempty"` - InfraHostSum *UsageBillableSummaryBody `json:"infra_host_sum,omitempty"` - InfraHostTop99p *UsageBillableSummaryBody `json:"infra_host_top99p,omitempty"` - IngestedSpansSum *UsageBillableSummaryBody `json:"ingested_spans_sum,omitempty"` - IngestedTimeseriesAverage *UsageBillableSummaryBody `json:"ingested_timeseries_average,omitempty"` - IngestedTimeseriesSum *UsageBillableSummaryBody `json:"ingested_timeseries_sum,omitempty"` - IotSum *UsageBillableSummaryBody `json:"iot_sum,omitempty"` - IotTop99p *UsageBillableSummaryBody `json:"iot_top99p,omitempty"` - LambdaFunctionAverage *UsageBillableSummaryBody `json:"lambda_function_average,omitempty"` - LambdaFunctionSum *UsageBillableSummaryBody `json:"lambda_function_sum,omitempty"` - LogsIndexed15daySum *UsageBillableSummaryBody `json:"logs_indexed_15day_sum,omitempty"` - LogsIndexed180daySum *UsageBillableSummaryBody `json:"logs_indexed_180day_sum,omitempty"` - LogsIndexed30daySum *UsageBillableSummaryBody `json:"logs_indexed_30day_sum,omitempty"` - LogsIndexed360daySum *UsageBillableSummaryBody `json:"logs_indexed_360day_sum,omitempty"` - LogsIndexed3daySum *UsageBillableSummaryBody `json:"logs_indexed_3day_sum,omitempty"` - LogsIndexed45daySum *UsageBillableSummaryBody `json:"logs_indexed_45day_sum,omitempty"` - LogsIndexed60daySum *UsageBillableSummaryBody `json:"logs_indexed_60day_sum,omitempty"` - LogsIndexed7daySum *UsageBillableSummaryBody `json:"logs_indexed_7day_sum,omitempty"` - LogsIndexed90daySum *UsageBillableSummaryBody `json:"logs_indexed_90day_sum,omitempty"` - LogsIndexedCustomRetentionSum *UsageBillableSummaryBody `json:"logs_indexed_custom_retention_sum,omitempty"` - LogsIndexedSum *UsageBillableSummaryBody `json:"logs_indexed_sum,omitempty"` - LogsIngestedSum *UsageBillableSummaryBody `json:"logs_ingested_sum,omitempty"` - NetworkDeviceSum *UsageBillableSummaryBody `json:"network_device_sum,omitempty"` - NetworkDeviceTop99p *UsageBillableSummaryBody `json:"network_device_top99p,omitempty"` - NpmFlowSum *UsageBillableSummaryBody `json:"npm_flow_sum,omitempty"` - NpmHostSum *UsageBillableSummaryBody `json:"npm_host_sum,omitempty"` - NpmHostTop99p *UsageBillableSummaryBody `json:"npm_host_top99p,omitempty"` - ObservabilityPipelineSum *UsageBillableSummaryBody `json:"observability_pipeline_sum,omitempty"` - OnlineArchiveSum *UsageBillableSummaryBody `json:"online_archive_sum,omitempty"` - ProfContainerSum *UsageBillableSummaryBody `json:"prof_container_sum,omitempty"` - ProfHostSum *UsageBillableSummaryBody `json:"prof_host_sum,omitempty"` - ProfHostTop99p *UsageBillableSummaryBody `json:"prof_host_top99p,omitempty"` - RumLiteSum *UsageBillableSummaryBody `json:"rum_lite_sum,omitempty"` - RumReplaySum *UsageBillableSummaryBody `json:"rum_replay_sum,omitempty"` - RumSum *UsageBillableSummaryBody `json:"rum_sum,omitempty"` - RumUnitsSum *UsageBillableSummaryBody `json:"rum_units_sum,omitempty"` - SensitiveDataScannerSum *UsageBillableSummaryBody `json:"sensitive_data_scanner_sum,omitempty"` - ServerlessInvocationSum *UsageBillableSummaryBody `json:"serverless_invocation_sum,omitempty"` - SiemSum *UsageBillableSummaryBody `json:"siem_sum,omitempty"` - StandardTimeseriesAverage *UsageBillableSummaryBody `json:"standard_timeseries_average,omitempty"` - SyntheticsApiTestsSum *UsageBillableSummaryBody `json:"synthetics_api_tests_sum,omitempty"` - SyntheticsBrowserChecksSum *UsageBillableSummaryBody `json:"synthetics_browser_checks_sum,omitempty"` - TimeseriesAverage *UsageBillableSummaryBody `json:"timeseries_average,omitempty"` - TimeseriesSum *UsageBillableSummaryBody `json:"timeseries_sum,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.ApmFargateAverage != nil && all.ApmFargateAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmFargateAverage = all.ApmFargateAverage - if all.ApmFargateSum != nil && all.ApmFargateSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmFargateSum = all.ApmFargateSum - if all.ApmHostSum != nil && all.ApmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmHostSum = all.ApmHostSum - if all.ApmHostTop99p != nil && all.ApmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmHostTop99p = all.ApmHostTop99p - if all.ApmProfilerHostSum != nil && all.ApmProfilerHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmProfilerHostSum = all.ApmProfilerHostSum - if all.ApmProfilerHostTop99p != nil && all.ApmProfilerHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmProfilerHostTop99p = all.ApmProfilerHostTop99p - if all.ApmTraceSearchSum != nil && all.ApmTraceSearchSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApmTraceSearchSum = all.ApmTraceSearchSum - if all.ApplicationSecurityHostSum != nil && all.ApplicationSecurityHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ApplicationSecurityHostSum = all.ApplicationSecurityHostSum - if all.CiPipelineIndexedSpansSum != nil && all.CiPipelineIndexedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum - if all.CiPipelineMaximum != nil && all.CiPipelineMaximum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CiPipelineMaximum = all.CiPipelineMaximum - if all.CiPipelineSum != nil && all.CiPipelineSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CiPipelineSum = all.CiPipelineSum - if all.CiTestIndexedSpansSum != nil && all.CiTestIndexedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum - if all.CiTestingMaximum != nil && all.CiTestingMaximum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CiTestingMaximum = all.CiTestingMaximum - if all.CiTestingSum != nil && all.CiTestingSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CiTestingSum = all.CiTestingSum - if all.CspmContainerSum != nil && all.CspmContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CspmContainerSum = all.CspmContainerSum - if all.CspmHostSum != nil && all.CspmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CspmHostSum = all.CspmHostSum - if all.CspmHostTop99p != nil && all.CspmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CspmHostTop99p = all.CspmHostTop99p - if all.CustomEventSum != nil && all.CustomEventSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CustomEventSum = all.CustomEventSum - if all.CwsContainerSum != nil && all.CwsContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CwsContainerSum = all.CwsContainerSum - if all.CwsHostSum != nil && all.CwsHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CwsHostSum = all.CwsHostSum - if all.CwsHostTop99p != nil && all.CwsHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CwsHostTop99p = all.CwsHostTop99p - if all.DbmHostSum != nil && all.DbmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.DbmHostSum = all.DbmHostSum - if all.DbmHostTop99p != nil && all.DbmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.DbmHostTop99p = all.DbmHostTop99p - if all.DbmNormalizedQueriesAverage != nil && all.DbmNormalizedQueriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.DbmNormalizedQueriesAverage = all.DbmNormalizedQueriesAverage - if all.DbmNormalizedQueriesSum != nil && all.DbmNormalizedQueriesSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.DbmNormalizedQueriesSum = all.DbmNormalizedQueriesSum - if all.FargateContainerApmAndProfilerAverage != nil && all.FargateContainerApmAndProfilerAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.FargateContainerApmAndProfilerAverage = all.FargateContainerApmAndProfilerAverage - if all.FargateContainerApmAndProfilerSum != nil && all.FargateContainerApmAndProfilerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.FargateContainerApmAndProfilerSum = all.FargateContainerApmAndProfilerSum - if all.FargateContainerAverage != nil && all.FargateContainerAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.FargateContainerAverage = all.FargateContainerAverage - if all.FargateContainerProfilerAverage != nil && all.FargateContainerProfilerAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.FargateContainerProfilerAverage = all.FargateContainerProfilerAverage - if all.FargateContainerProfilerSum != nil && all.FargateContainerProfilerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.FargateContainerProfilerSum = all.FargateContainerProfilerSum - if all.FargateContainerSum != nil && all.FargateContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.FargateContainerSum = all.FargateContainerSum - if all.IncidentManagementMaximum != nil && all.IncidentManagementMaximum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.IncidentManagementMaximum = all.IncidentManagementMaximum - if all.IncidentManagementSum != nil && all.IncidentManagementSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.IncidentManagementSum = all.IncidentManagementSum - if all.InfraAndApmHostSum != nil && all.InfraAndApmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.InfraAndApmHostSum = all.InfraAndApmHostSum - if all.InfraAndApmHostTop99p != nil && all.InfraAndApmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.InfraAndApmHostTop99p = all.InfraAndApmHostTop99p - if all.InfraContainerSum != nil && all.InfraContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.InfraContainerSum = all.InfraContainerSum - if all.InfraHostSum != nil && all.InfraHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.InfraHostSum = all.InfraHostSum - if all.InfraHostTop99p != nil && all.InfraHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.InfraHostTop99p = all.InfraHostTop99p - if all.IngestedSpansSum != nil && all.IngestedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.IngestedSpansSum = all.IngestedSpansSum - if all.IngestedTimeseriesAverage != nil && all.IngestedTimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.IngestedTimeseriesAverage = all.IngestedTimeseriesAverage - if all.IngestedTimeseriesSum != nil && all.IngestedTimeseriesSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.IngestedTimeseriesSum = all.IngestedTimeseriesSum - if all.IotSum != nil && all.IotSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.IotSum = all.IotSum - if all.IotTop99p != nil && all.IotTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.IotTop99p = all.IotTop99p - if all.LambdaFunctionAverage != nil && all.LambdaFunctionAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LambdaFunctionAverage = all.LambdaFunctionAverage - if all.LambdaFunctionSum != nil && all.LambdaFunctionSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LambdaFunctionSum = all.LambdaFunctionSum - if all.LogsIndexed15daySum != nil && all.LogsIndexed15daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed15daySum = all.LogsIndexed15daySum - if all.LogsIndexed180daySum != nil && all.LogsIndexed180daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed180daySum = all.LogsIndexed180daySum - if all.LogsIndexed30daySum != nil && all.LogsIndexed30daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed30daySum = all.LogsIndexed30daySum - if all.LogsIndexed360daySum != nil && all.LogsIndexed360daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed360daySum = all.LogsIndexed360daySum - if all.LogsIndexed3daySum != nil && all.LogsIndexed3daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed3daySum = all.LogsIndexed3daySum - if all.LogsIndexed45daySum != nil && all.LogsIndexed45daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed45daySum = all.LogsIndexed45daySum - if all.LogsIndexed60daySum != nil && all.LogsIndexed60daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed60daySum = all.LogsIndexed60daySum - if all.LogsIndexed7daySum != nil && all.LogsIndexed7daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed7daySum = all.LogsIndexed7daySum - if all.LogsIndexed90daySum != nil && all.LogsIndexed90daySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexed90daySum = all.LogsIndexed90daySum - if all.LogsIndexedCustomRetentionSum != nil && all.LogsIndexedCustomRetentionSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexedCustomRetentionSum = all.LogsIndexedCustomRetentionSum - if all.LogsIndexedSum != nil && all.LogsIndexedSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIndexedSum = all.LogsIndexedSum - if all.LogsIngestedSum != nil && all.LogsIngestedSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsIngestedSum = all.LogsIngestedSum - if all.NetworkDeviceSum != nil && all.NetworkDeviceSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkDeviceSum = all.NetworkDeviceSum - if all.NetworkDeviceTop99p != nil && all.NetworkDeviceTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NetworkDeviceTop99p = all.NetworkDeviceTop99p - if all.NpmFlowSum != nil && all.NpmFlowSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NpmFlowSum = all.NpmFlowSum - if all.NpmHostSum != nil && all.NpmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NpmHostSum = all.NpmHostSum - if all.NpmHostTop99p != nil && all.NpmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NpmHostTop99p = all.NpmHostTop99p - if all.ObservabilityPipelineSum != nil && all.ObservabilityPipelineSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ObservabilityPipelineSum = all.ObservabilityPipelineSum - if all.OnlineArchiveSum != nil && all.OnlineArchiveSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.OnlineArchiveSum = all.OnlineArchiveSum - if all.ProfContainerSum != nil && all.ProfContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfContainerSum = all.ProfContainerSum - if all.ProfHostSum != nil && all.ProfHostSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfHostSum = all.ProfHostSum - if all.ProfHostTop99p != nil && all.ProfHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ProfHostTop99p = all.ProfHostTop99p - if all.RumLiteSum != nil && all.RumLiteSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumLiteSum = all.RumLiteSum - if all.RumReplaySum != nil && all.RumReplaySum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumReplaySum = all.RumReplaySum - if all.RumSum != nil && all.RumSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumSum = all.RumSum - if all.RumUnitsSum != nil && all.RumUnitsSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.RumUnitsSum = all.RumUnitsSum - if all.SensitiveDataScannerSum != nil && all.SensitiveDataScannerSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SensitiveDataScannerSum = all.SensitiveDataScannerSum - if all.ServerlessInvocationSum != nil && all.ServerlessInvocationSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ServerlessInvocationSum = all.ServerlessInvocationSum - if all.SiemSum != nil && all.SiemSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SiemSum = all.SiemSum - if all.StandardTimeseriesAverage != nil && all.StandardTimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.StandardTimeseriesAverage = all.StandardTimeseriesAverage - if all.SyntheticsApiTestsSum != nil && all.SyntheticsApiTestsSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SyntheticsApiTestsSum = all.SyntheticsApiTestsSum - if all.SyntheticsBrowserChecksSum != nil && all.SyntheticsBrowserChecksSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SyntheticsBrowserChecksSum = all.SyntheticsBrowserChecksSum - if all.TimeseriesAverage != nil && all.TimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.TimeseriesAverage = all.TimeseriesAverage - if all.TimeseriesSum != nil && all.TimeseriesSum.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.TimeseriesSum = all.TimeseriesSum - return nil -} diff --git a/api/v1/datadog/model_usage_billable_summary_response.go b/api/v1/datadog/model_usage_billable_summary_response.go deleted file mode 100644 index bd8d7bd503c..00000000000 --- a/api/v1/datadog/model_usage_billable_summary_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageBillableSummaryResponse Response with monthly summary of data billed by Datadog. -type UsageBillableSummaryResponse struct { - // An array of objects regarding usage of billable summary. - Usage []UsageBillableSummaryHour `json:"usage,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{} -} - -// NewUsageBillableSummaryResponse instantiates a new UsageBillableSummaryResponse 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 NewUsageBillableSummaryResponse() *UsageBillableSummaryResponse { - this := UsageBillableSummaryResponse{} - return &this -} - -// NewUsageBillableSummaryResponseWithDefaults instantiates a new UsageBillableSummaryResponse 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 NewUsageBillableSummaryResponseWithDefaults() *UsageBillableSummaryResponse { - this := UsageBillableSummaryResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageBillableSummaryResponse) GetUsage() []UsageBillableSummaryHour { - if o == nil || o.Usage == nil { - var ret []UsageBillableSummaryHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageBillableSummaryResponse) GetUsageOk() (*[]UsageBillableSummaryHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageBillableSummaryResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageBillableSummaryHour and assigns it to the Usage field. -func (o *UsageBillableSummaryResponse) SetUsage(v []UsageBillableSummaryHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageBillableSummaryResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageBillableSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageBillableSummaryHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_ci_visibility_hour.go b/api/v1/datadog/model_usage_ci_visibility_hour.go deleted file mode 100644 index af8010eec77..00000000000 --- a/api/v1/datadog/model_usage_ci_visibility_hour.go +++ /dev/null @@ -1,297 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCIVisibilityHour CI visibility usage in a given hour. -type UsageCIVisibilityHour struct { - // The number of spans for pipelines in the queried hour. - CiPipelineIndexedSpans *int32 `json:"ci_pipeline_indexed_spans,omitempty"` - // The number of spans for tests in the queried hour. - CiTestIndexedSpans *int32 `json:"ci_test_indexed_spans,omitempty"` - // Shows the total count of all active Git committers for Pipelines in the current month. A committer is active if they commit at least 3 times in a given month. - CiVisibilityPipelineCommitters *int32 `json:"ci_visibility_pipeline_committers,omitempty"` - // The total count of all active Git committers for tests in the current month. A committer is active if they commit at least 3 times in a given month. - CiVisibilityTestCommitters *int32 `json:"ci_visibility_test_committers,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageCIVisibilityHour instantiates a new UsageCIVisibilityHour 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 NewUsageCIVisibilityHour() *UsageCIVisibilityHour { - this := UsageCIVisibilityHour{} - return &this -} - -// NewUsageCIVisibilityHourWithDefaults instantiates a new UsageCIVisibilityHour 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 NewUsageCIVisibilityHourWithDefaults() *UsageCIVisibilityHour { - this := UsageCIVisibilityHour{} - return &this -} - -// GetCiPipelineIndexedSpans returns the CiPipelineIndexedSpans field value if set, zero value otherwise. -func (o *UsageCIVisibilityHour) GetCiPipelineIndexedSpans() int32 { - if o == nil || o.CiPipelineIndexedSpans == nil { - var ret int32 - return ret - } - return *o.CiPipelineIndexedSpans -} - -// GetCiPipelineIndexedSpansOk returns a tuple with the CiPipelineIndexedSpans field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCIVisibilityHour) GetCiPipelineIndexedSpansOk() (*int32, bool) { - if o == nil || o.CiPipelineIndexedSpans == nil { - return nil, false - } - return o.CiPipelineIndexedSpans, true -} - -// HasCiPipelineIndexedSpans returns a boolean if a field has been set. -func (o *UsageCIVisibilityHour) HasCiPipelineIndexedSpans() bool { - if o != nil && o.CiPipelineIndexedSpans != nil { - return true - } - - return false -} - -// SetCiPipelineIndexedSpans gets a reference to the given int32 and assigns it to the CiPipelineIndexedSpans field. -func (o *UsageCIVisibilityHour) SetCiPipelineIndexedSpans(v int32) { - o.CiPipelineIndexedSpans = &v -} - -// GetCiTestIndexedSpans returns the CiTestIndexedSpans field value if set, zero value otherwise. -func (o *UsageCIVisibilityHour) GetCiTestIndexedSpans() int32 { - if o == nil || o.CiTestIndexedSpans == nil { - var ret int32 - return ret - } - return *o.CiTestIndexedSpans -} - -// GetCiTestIndexedSpansOk returns a tuple with the CiTestIndexedSpans field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCIVisibilityHour) GetCiTestIndexedSpansOk() (*int32, bool) { - if o == nil || o.CiTestIndexedSpans == nil { - return nil, false - } - return o.CiTestIndexedSpans, true -} - -// HasCiTestIndexedSpans returns a boolean if a field has been set. -func (o *UsageCIVisibilityHour) HasCiTestIndexedSpans() bool { - if o != nil && o.CiTestIndexedSpans != nil { - return true - } - - return false -} - -// SetCiTestIndexedSpans gets a reference to the given int32 and assigns it to the CiTestIndexedSpans field. -func (o *UsageCIVisibilityHour) SetCiTestIndexedSpans(v int32) { - o.CiTestIndexedSpans = &v -} - -// GetCiVisibilityPipelineCommitters returns the CiVisibilityPipelineCommitters field value if set, zero value otherwise. -func (o *UsageCIVisibilityHour) GetCiVisibilityPipelineCommitters() int32 { - if o == nil || o.CiVisibilityPipelineCommitters == nil { - var ret int32 - return ret - } - return *o.CiVisibilityPipelineCommitters -} - -// GetCiVisibilityPipelineCommittersOk returns a tuple with the CiVisibilityPipelineCommitters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCIVisibilityHour) GetCiVisibilityPipelineCommittersOk() (*int32, bool) { - if o == nil || o.CiVisibilityPipelineCommitters == nil { - return nil, false - } - return o.CiVisibilityPipelineCommitters, true -} - -// HasCiVisibilityPipelineCommitters returns a boolean if a field has been set. -func (o *UsageCIVisibilityHour) HasCiVisibilityPipelineCommitters() bool { - if o != nil && o.CiVisibilityPipelineCommitters != nil { - return true - } - - return false -} - -// SetCiVisibilityPipelineCommitters gets a reference to the given int32 and assigns it to the CiVisibilityPipelineCommitters field. -func (o *UsageCIVisibilityHour) SetCiVisibilityPipelineCommitters(v int32) { - o.CiVisibilityPipelineCommitters = &v -} - -// GetCiVisibilityTestCommitters returns the CiVisibilityTestCommitters field value if set, zero value otherwise. -func (o *UsageCIVisibilityHour) GetCiVisibilityTestCommitters() int32 { - if o == nil || o.CiVisibilityTestCommitters == nil { - var ret int32 - return ret - } - return *o.CiVisibilityTestCommitters -} - -// GetCiVisibilityTestCommittersOk returns a tuple with the CiVisibilityTestCommitters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCIVisibilityHour) GetCiVisibilityTestCommittersOk() (*int32, bool) { - if o == nil || o.CiVisibilityTestCommitters == nil { - return nil, false - } - return o.CiVisibilityTestCommitters, true -} - -// HasCiVisibilityTestCommitters returns a boolean if a field has been set. -func (o *UsageCIVisibilityHour) HasCiVisibilityTestCommitters() bool { - if o != nil && o.CiVisibilityTestCommitters != nil { - return true - } - - return false -} - -// SetCiVisibilityTestCommitters gets a reference to the given int32 and assigns it to the CiVisibilityTestCommitters field. -func (o *UsageCIVisibilityHour) SetCiVisibilityTestCommitters(v int32) { - o.CiVisibilityTestCommitters = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageCIVisibilityHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCIVisibilityHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageCIVisibilityHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageCIVisibilityHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageCIVisibilityHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCIVisibilityHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageCIVisibilityHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageCIVisibilityHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCIVisibilityHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CiPipelineIndexedSpans != nil { - toSerialize["ci_pipeline_indexed_spans"] = o.CiPipelineIndexedSpans - } - if o.CiTestIndexedSpans != nil { - toSerialize["ci_test_indexed_spans"] = o.CiTestIndexedSpans - } - if o.CiVisibilityPipelineCommitters != nil { - toSerialize["ci_visibility_pipeline_committers"] = o.CiVisibilityPipelineCommitters - } - if o.CiVisibilityTestCommitters != nil { - toSerialize["ci_visibility_test_committers"] = o.CiVisibilityTestCommitters - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCIVisibilityHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CiPipelineIndexedSpans *int32 `json:"ci_pipeline_indexed_spans,omitempty"` - CiTestIndexedSpans *int32 `json:"ci_test_indexed_spans,omitempty"` - CiVisibilityPipelineCommitters *int32 `json:"ci_visibility_pipeline_committers,omitempty"` - CiVisibilityTestCommitters *int32 `json:"ci_visibility_test_committers,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CiPipelineIndexedSpans = all.CiPipelineIndexedSpans - o.CiTestIndexedSpans = all.CiTestIndexedSpans - o.CiVisibilityPipelineCommitters = all.CiVisibilityPipelineCommitters - o.CiVisibilityTestCommitters = all.CiVisibilityTestCommitters - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_ci_visibility_response.go b/api/v1/datadog/model_usage_ci_visibility_response.go deleted file mode 100644 index 9bc8dd7deb1..00000000000 --- a/api/v1/datadog/model_usage_ci_visibility_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCIVisibilityResponse CI visibility usage response -type UsageCIVisibilityResponse struct { - // Response containing CI visibility usage. - Usage []UsageCIVisibilityHour `json:"usage,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{} -} - -// NewUsageCIVisibilityResponse instantiates a new UsageCIVisibilityResponse 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 NewUsageCIVisibilityResponse() *UsageCIVisibilityResponse { - this := UsageCIVisibilityResponse{} - return &this -} - -// NewUsageCIVisibilityResponseWithDefaults instantiates a new UsageCIVisibilityResponse 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 NewUsageCIVisibilityResponseWithDefaults() *UsageCIVisibilityResponse { - this := UsageCIVisibilityResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageCIVisibilityResponse) GetUsage() []UsageCIVisibilityHour { - if o == nil || o.Usage == nil { - var ret []UsageCIVisibilityHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCIVisibilityResponse) GetUsageOk() (*[]UsageCIVisibilityHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageCIVisibilityResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageCIVisibilityHour and assigns it to the Usage field. -func (o *UsageCIVisibilityResponse) SetUsage(v []UsageCIVisibilityHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCIVisibilityResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCIVisibilityResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageCIVisibilityHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_cloud_security_posture_management_hour.go b/api/v1/datadog/model_usage_cloud_security_posture_management_hour.go deleted file mode 100644 index 4cb150323f2..00000000000 --- a/api/v1/datadog/model_usage_cloud_security_posture_management_hour.go +++ /dev/null @@ -1,437 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsageCloudSecurityPostureManagementHour Cloud Security Posture Management usage for a given organization for a given hour. -type UsageCloudSecurityPostureManagementHour struct { - // The number of Cloud Security Posture Management Azure app services hosts during a given hour. - AasHostCount common.NullableFloat64 `json:"aas_host_count,omitempty"` - // The number of Cloud Security Posture Management Azure hosts during a given hour. - AzureHostCount common.NullableFloat64 `json:"azure_host_count,omitempty"` - // The number of Cloud Security Posture Management hosts during a given hour. - ComplianceHostCount common.NullableFloat64 `json:"compliance_host_count,omitempty"` - // The total number of Cloud Security Posture Management containers during a given hour. - ContainerCount common.NullableFloat64 `json:"container_count,omitempty"` - // The total number of Cloud Security Posture Management hosts during a given hour. - HostCount common.NullableFloat64 `json:"host_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageCloudSecurityPostureManagementHour instantiates a new UsageCloudSecurityPostureManagementHour 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 NewUsageCloudSecurityPostureManagementHour() *UsageCloudSecurityPostureManagementHour { - this := UsageCloudSecurityPostureManagementHour{} - return &this -} - -// NewUsageCloudSecurityPostureManagementHourWithDefaults instantiates a new UsageCloudSecurityPostureManagementHour 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 NewUsageCloudSecurityPostureManagementHourWithDefaults() *UsageCloudSecurityPostureManagementHour { - this := UsageCloudSecurityPostureManagementHour{} - return &this -} - -// GetAasHostCount returns the AasHostCount field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageCloudSecurityPostureManagementHour) GetAasHostCount() float64 { - if o == nil || o.AasHostCount.Get() == nil { - var ret float64 - return ret - } - return *o.AasHostCount.Get() -} - -// GetAasHostCountOk returns a tuple with the AasHostCount 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 *UsageCloudSecurityPostureManagementHour) GetAasHostCountOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.AasHostCount.Get(), o.AasHostCount.IsSet() -} - -// HasAasHostCount returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasAasHostCount() bool { - if o != nil && o.AasHostCount.IsSet() { - return true - } - - return false -} - -// SetAasHostCount gets a reference to the given common.NullableFloat64 and assigns it to the AasHostCount field. -func (o *UsageCloudSecurityPostureManagementHour) SetAasHostCount(v float64) { - o.AasHostCount.Set(&v) -} - -// SetAasHostCountNil sets the value for AasHostCount to be an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) SetAasHostCountNil() { - o.AasHostCount.Set(nil) -} - -// UnsetAasHostCount ensures that no value is present for AasHostCount, not even an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) UnsetAasHostCount() { - o.AasHostCount.Unset() -} - -// GetAzureHostCount returns the AzureHostCount field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageCloudSecurityPostureManagementHour) GetAzureHostCount() float64 { - if o == nil || o.AzureHostCount.Get() == nil { - var ret float64 - return ret - } - return *o.AzureHostCount.Get() -} - -// GetAzureHostCountOk returns a tuple with the AzureHostCount 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 *UsageCloudSecurityPostureManagementHour) GetAzureHostCountOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.AzureHostCount.Get(), o.AzureHostCount.IsSet() -} - -// HasAzureHostCount returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasAzureHostCount() bool { - if o != nil && o.AzureHostCount.IsSet() { - return true - } - - return false -} - -// SetAzureHostCount gets a reference to the given common.NullableFloat64 and assigns it to the AzureHostCount field. -func (o *UsageCloudSecurityPostureManagementHour) SetAzureHostCount(v float64) { - o.AzureHostCount.Set(&v) -} - -// SetAzureHostCountNil sets the value for AzureHostCount to be an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) SetAzureHostCountNil() { - o.AzureHostCount.Set(nil) -} - -// UnsetAzureHostCount ensures that no value is present for AzureHostCount, not even an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) UnsetAzureHostCount() { - o.AzureHostCount.Unset() -} - -// GetComplianceHostCount returns the ComplianceHostCount field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageCloudSecurityPostureManagementHour) GetComplianceHostCount() float64 { - if o == nil || o.ComplianceHostCount.Get() == nil { - var ret float64 - return ret - } - return *o.ComplianceHostCount.Get() -} - -// GetComplianceHostCountOk returns a tuple with the ComplianceHostCount 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 *UsageCloudSecurityPostureManagementHour) GetComplianceHostCountOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.ComplianceHostCount.Get(), o.ComplianceHostCount.IsSet() -} - -// HasComplianceHostCount returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasComplianceHostCount() bool { - if o != nil && o.ComplianceHostCount.IsSet() { - return true - } - - return false -} - -// SetComplianceHostCount gets a reference to the given common.NullableFloat64 and assigns it to the ComplianceHostCount field. -func (o *UsageCloudSecurityPostureManagementHour) SetComplianceHostCount(v float64) { - o.ComplianceHostCount.Set(&v) -} - -// SetComplianceHostCountNil sets the value for ComplianceHostCount to be an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) SetComplianceHostCountNil() { - o.ComplianceHostCount.Set(nil) -} - -// UnsetComplianceHostCount ensures that no value is present for ComplianceHostCount, not even an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) UnsetComplianceHostCount() { - o.ComplianceHostCount.Unset() -} - -// GetContainerCount returns the ContainerCount field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageCloudSecurityPostureManagementHour) GetContainerCount() float64 { - if o == nil || o.ContainerCount.Get() == nil { - var ret float64 - return ret - } - return *o.ContainerCount.Get() -} - -// GetContainerCountOk returns a tuple with the ContainerCount 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 *UsageCloudSecurityPostureManagementHour) GetContainerCountOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.ContainerCount.Get(), o.ContainerCount.IsSet() -} - -// HasContainerCount returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasContainerCount() bool { - if o != nil && o.ContainerCount.IsSet() { - return true - } - - return false -} - -// SetContainerCount gets a reference to the given common.NullableFloat64 and assigns it to the ContainerCount field. -func (o *UsageCloudSecurityPostureManagementHour) SetContainerCount(v float64) { - o.ContainerCount.Set(&v) -} - -// SetContainerCountNil sets the value for ContainerCount to be an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) SetContainerCountNil() { - o.ContainerCount.Set(nil) -} - -// UnsetContainerCount ensures that no value is present for ContainerCount, not even an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) UnsetContainerCount() { - o.ContainerCount.Unset() -} - -// GetHostCount returns the HostCount field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageCloudSecurityPostureManagementHour) GetHostCount() float64 { - if o == nil || o.HostCount.Get() == nil { - var ret float64 - return ret - } - return *o.HostCount.Get() -} - -// GetHostCountOk returns a tuple with the HostCount 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 *UsageCloudSecurityPostureManagementHour) GetHostCountOk() (*float64, bool) { - if o == nil { - return nil, false - } - return o.HostCount.Get(), o.HostCount.IsSet() -} - -// HasHostCount returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasHostCount() bool { - if o != nil && o.HostCount.IsSet() { - return true - } - - return false -} - -// SetHostCount gets a reference to the given common.NullableFloat64 and assigns it to the HostCount field. -func (o *UsageCloudSecurityPostureManagementHour) SetHostCount(v float64) { - o.HostCount.Set(&v) -} - -// SetHostCountNil sets the value for HostCount to be an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) SetHostCountNil() { - o.HostCount.Set(nil) -} - -// UnsetHostCount ensures that no value is present for HostCount, not even an explicit nil. -func (o *UsageCloudSecurityPostureManagementHour) UnsetHostCount() { - o.HostCount.Unset() -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageCloudSecurityPostureManagementHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCloudSecurityPostureManagementHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageCloudSecurityPostureManagementHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageCloudSecurityPostureManagementHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCloudSecurityPostureManagementHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageCloudSecurityPostureManagementHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageCloudSecurityPostureManagementHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCloudSecurityPostureManagementHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageCloudSecurityPostureManagementHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCloudSecurityPostureManagementHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AasHostCount.IsSet() { - toSerialize["aas_host_count"] = o.AasHostCount.Get() - } - if o.AzureHostCount.IsSet() { - toSerialize["azure_host_count"] = o.AzureHostCount.Get() - } - if o.ComplianceHostCount.IsSet() { - toSerialize["compliance_host_count"] = o.ComplianceHostCount.Get() - } - if o.ContainerCount.IsSet() { - toSerialize["container_count"] = o.ContainerCount.Get() - } - if o.HostCount.IsSet() { - toSerialize["host_count"] = o.HostCount.Get() - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCloudSecurityPostureManagementHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AasHostCount common.NullableFloat64 `json:"aas_host_count,omitempty"` - AzureHostCount common.NullableFloat64 `json:"azure_host_count,omitempty"` - ComplianceHostCount common.NullableFloat64 `json:"compliance_host_count,omitempty"` - ContainerCount common.NullableFloat64 `json:"container_count,omitempty"` - HostCount common.NullableFloat64 `json:"host_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AasHostCount = all.AasHostCount - o.AzureHostCount = all.AzureHostCount - o.ComplianceHostCount = all.ComplianceHostCount - o.ContainerCount = all.ContainerCount - o.HostCount = all.HostCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_cloud_security_posture_management_response.go b/api/v1/datadog/model_usage_cloud_security_posture_management_response.go deleted file mode 100644 index 27358295874..00000000000 --- a/api/v1/datadog/model_usage_cloud_security_posture_management_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCloudSecurityPostureManagementResponse The response containing the Cloud Security Posture Management usage for each hour for a given organization. -type UsageCloudSecurityPostureManagementResponse struct { - // Get hourly usage for Cloud Security Posture Management. - Usage []UsageCloudSecurityPostureManagementHour `json:"usage,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{} -} - -// NewUsageCloudSecurityPostureManagementResponse instantiates a new UsageCloudSecurityPostureManagementResponse 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 NewUsageCloudSecurityPostureManagementResponse() *UsageCloudSecurityPostureManagementResponse { - this := UsageCloudSecurityPostureManagementResponse{} - return &this -} - -// NewUsageCloudSecurityPostureManagementResponseWithDefaults instantiates a new UsageCloudSecurityPostureManagementResponse 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 NewUsageCloudSecurityPostureManagementResponseWithDefaults() *UsageCloudSecurityPostureManagementResponse { - this := UsageCloudSecurityPostureManagementResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageCloudSecurityPostureManagementResponse) GetUsage() []UsageCloudSecurityPostureManagementHour { - if o == nil || o.Usage == nil { - var ret []UsageCloudSecurityPostureManagementHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCloudSecurityPostureManagementResponse) GetUsageOk() (*[]UsageCloudSecurityPostureManagementHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageCloudSecurityPostureManagementResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageCloudSecurityPostureManagementHour and assigns it to the Usage field. -func (o *UsageCloudSecurityPostureManagementResponse) SetUsage(v []UsageCloudSecurityPostureManagementHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCloudSecurityPostureManagementResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCloudSecurityPostureManagementResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageCloudSecurityPostureManagementHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_custom_reports_attributes.go b/api/v1/datadog/model_usage_custom_reports_attributes.go deleted file mode 100644 index f92fba8854a..00000000000 --- a/api/v1/datadog/model_usage_custom_reports_attributes.go +++ /dev/null @@ -1,258 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCustomReportsAttributes The response containing attributes for custom reports. -type UsageCustomReportsAttributes struct { - // The date the specified custom report was computed. - ComputedOn *string `json:"computed_on,omitempty"` - // The ending date of custom report. - EndDate *string `json:"end_date,omitempty"` - // size - Size *int64 `json:"size,omitempty"` - // The starting date of custom report. - StartDate *string `json:"start_date,omitempty"` - // A list of tags to apply to custom reports. - Tags []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{} -} - -// NewUsageCustomReportsAttributes instantiates a new UsageCustomReportsAttributes 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 NewUsageCustomReportsAttributes() *UsageCustomReportsAttributes { - this := UsageCustomReportsAttributes{} - return &this -} - -// NewUsageCustomReportsAttributesWithDefaults instantiates a new UsageCustomReportsAttributes 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 NewUsageCustomReportsAttributesWithDefaults() *UsageCustomReportsAttributes { - this := UsageCustomReportsAttributes{} - return &this -} - -// GetComputedOn returns the ComputedOn field value if set, zero value otherwise. -func (o *UsageCustomReportsAttributes) GetComputedOn() string { - if o == nil || o.ComputedOn == nil { - var ret string - return ret - } - return *o.ComputedOn -} - -// GetComputedOnOk returns a tuple with the ComputedOn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsAttributes) GetComputedOnOk() (*string, bool) { - if o == nil || o.ComputedOn == nil { - return nil, false - } - return o.ComputedOn, true -} - -// HasComputedOn returns a boolean if a field has been set. -func (o *UsageCustomReportsAttributes) HasComputedOn() bool { - if o != nil && o.ComputedOn != nil { - return true - } - - return false -} - -// SetComputedOn gets a reference to the given string and assigns it to the ComputedOn field. -func (o *UsageCustomReportsAttributes) SetComputedOn(v string) { - o.ComputedOn = &v -} - -// GetEndDate returns the EndDate field value if set, zero value otherwise. -func (o *UsageCustomReportsAttributes) GetEndDate() string { - if o == nil || o.EndDate == nil { - var ret string - return ret - } - return *o.EndDate -} - -// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsAttributes) GetEndDateOk() (*string, bool) { - if o == nil || o.EndDate == nil { - return nil, false - } - return o.EndDate, true -} - -// HasEndDate returns a boolean if a field has been set. -func (o *UsageCustomReportsAttributes) HasEndDate() bool { - if o != nil && o.EndDate != nil { - return true - } - - return false -} - -// SetEndDate gets a reference to the given string and assigns it to the EndDate field. -func (o *UsageCustomReportsAttributes) SetEndDate(v string) { - o.EndDate = &v -} - -// GetSize returns the Size field value if set, zero value otherwise. -func (o *UsageCustomReportsAttributes) GetSize() int64 { - if o == nil || o.Size == nil { - var ret int64 - return ret - } - return *o.Size -} - -// GetSizeOk returns a tuple with the Size field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsAttributes) GetSizeOk() (*int64, bool) { - if o == nil || o.Size == nil { - return nil, false - } - return o.Size, true -} - -// HasSize returns a boolean if a field has been set. -func (o *UsageCustomReportsAttributes) HasSize() bool { - if o != nil && o.Size != nil { - return true - } - - return false -} - -// SetSize gets a reference to the given int64 and assigns it to the Size field. -func (o *UsageCustomReportsAttributes) SetSize(v int64) { - o.Size = &v -} - -// GetStartDate returns the StartDate field value if set, zero value otherwise. -func (o *UsageCustomReportsAttributes) GetStartDate() string { - if o == nil || o.StartDate == nil { - var ret string - return ret - } - return *o.StartDate -} - -// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsAttributes) GetStartDateOk() (*string, bool) { - if o == nil || o.StartDate == nil { - return nil, false - } - return o.StartDate, true -} - -// HasStartDate returns a boolean if a field has been set. -func (o *UsageCustomReportsAttributes) HasStartDate() bool { - if o != nil && o.StartDate != nil { - return true - } - - return false -} - -// SetStartDate gets a reference to the given string and assigns it to the StartDate field. -func (o *UsageCustomReportsAttributes) SetStartDate(v string) { - o.StartDate = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *UsageCustomReportsAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *UsageCustomReportsAttributes) GetTagsOk() (*[]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 *UsageCustomReportsAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *UsageCustomReportsAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCustomReportsAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ComputedOn != nil { - toSerialize["computed_on"] = o.ComputedOn - } - if o.EndDate != nil { - toSerialize["end_date"] = o.EndDate - } - if o.Size != nil { - toSerialize["size"] = o.Size - } - if o.StartDate != nil { - toSerialize["start_date"] = o.StartDate - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ComputedOn *string `json:"computed_on,omitempty"` - EndDate *string `json:"end_date,omitempty"` - Size *int64 `json:"size,omitempty"` - StartDate *string `json:"start_date,omitempty"` - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ComputedOn = all.ComputedOn - o.EndDate = all.EndDate - o.Size = all.Size - o.StartDate = all.StartDate - o.Tags = all.Tags - return nil -} diff --git a/api/v1/datadog/model_usage_custom_reports_data.go b/api/v1/datadog/model_usage_custom_reports_data.go deleted file mode 100644 index 01008ccb4b4..00000000000 --- a/api/v1/datadog/model_usage_custom_reports_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCustomReportsData The response containing the date and type for custom reports. -type UsageCustomReportsData struct { - // The response containing attributes for custom reports. - Attributes *UsageCustomReportsAttributes `json:"attributes,omitempty"` - // The date for specified custom reports. - Id *string `json:"id,omitempty"` - // The type of reports. - Type *UsageReportsType `json:"type,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{} -} - -// NewUsageCustomReportsData instantiates a new UsageCustomReportsData 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 NewUsageCustomReportsData() *UsageCustomReportsData { - this := UsageCustomReportsData{} - var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS - this.Type = &typeVar - return &this -} - -// NewUsageCustomReportsDataWithDefaults instantiates a new UsageCustomReportsData 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 NewUsageCustomReportsDataWithDefaults() *UsageCustomReportsData { - this := UsageCustomReportsData{} - var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *UsageCustomReportsData) GetAttributes() UsageCustomReportsAttributes { - if o == nil || o.Attributes == nil { - var ret UsageCustomReportsAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsData) GetAttributesOk() (*UsageCustomReportsAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *UsageCustomReportsData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given UsageCustomReportsAttributes and assigns it to the Attributes field. -func (o *UsageCustomReportsData) SetAttributes(v UsageCustomReportsAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *UsageCustomReportsData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *UsageCustomReportsData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *UsageCustomReportsData) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *UsageCustomReportsData) GetType() UsageReportsType { - if o == nil || o.Type == nil { - var ret UsageReportsType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsData) GetTypeOk() (*UsageReportsType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *UsageCustomReportsData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given UsageReportsType and assigns it to the Type field. -func (o *UsageCustomReportsData) SetType(v UsageReportsType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCustomReportsData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *UsageCustomReportsAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *UsageReportsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_usage_custom_reports_meta.go b/api/v1/datadog/model_usage_custom_reports_meta.go deleted file mode 100644 index 14d017718b5..00000000000 --- a/api/v1/datadog/model_usage_custom_reports_meta.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCustomReportsMeta The object containing document metadata. -type UsageCustomReportsMeta struct { - // The object containing page total count. - Page *UsageCustomReportsPage `json:"page,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{} -} - -// NewUsageCustomReportsMeta instantiates a new UsageCustomReportsMeta 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 NewUsageCustomReportsMeta() *UsageCustomReportsMeta { - this := UsageCustomReportsMeta{} - return &this -} - -// NewUsageCustomReportsMetaWithDefaults instantiates a new UsageCustomReportsMeta 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 NewUsageCustomReportsMetaWithDefaults() *UsageCustomReportsMeta { - this := UsageCustomReportsMeta{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *UsageCustomReportsMeta) GetPage() UsageCustomReportsPage { - if o == nil || o.Page == nil { - var ret UsageCustomReportsPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsMeta) GetPageOk() (*UsageCustomReportsPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *UsageCustomReportsMeta) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given UsageCustomReportsPage and assigns it to the Page field. -func (o *UsageCustomReportsMeta) SetPage(v UsageCustomReportsPage) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCustomReportsMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *UsageCustomReportsPage `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v1/datadog/model_usage_custom_reports_page.go b/api/v1/datadog/model_usage_custom_reports_page.go deleted file mode 100644 index 7489c606b82..00000000000 --- a/api/v1/datadog/model_usage_custom_reports_page.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCustomReportsPage The object containing page total count. -type UsageCustomReportsPage struct { - // Total page count. - TotalCount *int64 `json:"total_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{} -} - -// NewUsageCustomReportsPage instantiates a new UsageCustomReportsPage 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 NewUsageCustomReportsPage() *UsageCustomReportsPage { - this := UsageCustomReportsPage{} - return &this -} - -// NewUsageCustomReportsPageWithDefaults instantiates a new UsageCustomReportsPage 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 NewUsageCustomReportsPageWithDefaults() *UsageCustomReportsPage { - this := UsageCustomReportsPage{} - return &this -} - -// GetTotalCount returns the TotalCount field value if set, zero value otherwise. -func (o *UsageCustomReportsPage) GetTotalCount() int64 { - if o == nil || o.TotalCount == nil { - var ret int64 - return ret - } - return *o.TotalCount -} - -// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsPage) GetTotalCountOk() (*int64, bool) { - if o == nil || o.TotalCount == nil { - return nil, false - } - return o.TotalCount, true -} - -// HasTotalCount returns a boolean if a field has been set. -func (o *UsageCustomReportsPage) HasTotalCount() bool { - if o != nil && o.TotalCount != nil { - return true - } - - return false -} - -// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. -func (o *UsageCustomReportsPage) SetTotalCount(v int64) { - o.TotalCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCustomReportsPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TotalCount != nil { - toSerialize["total_count"] = o.TotalCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TotalCount *int64 `json:"total_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TotalCount = all.TotalCount - return nil -} diff --git a/api/v1/datadog/model_usage_custom_reports_response.go b/api/v1/datadog/model_usage_custom_reports_response.go deleted file mode 100644 index 7491fad78b1..00000000000 --- a/api/v1/datadog/model_usage_custom_reports_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCustomReportsResponse Response containing available custom reports. -type UsageCustomReportsResponse struct { - // An array of available custom reports. - Data []UsageCustomReportsData `json:"data,omitempty"` - // The object containing document metadata. - Meta *UsageCustomReportsMeta `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{} -} - -// NewUsageCustomReportsResponse instantiates a new UsageCustomReportsResponse 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 NewUsageCustomReportsResponse() *UsageCustomReportsResponse { - this := UsageCustomReportsResponse{} - return &this -} - -// NewUsageCustomReportsResponseWithDefaults instantiates a new UsageCustomReportsResponse 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 NewUsageCustomReportsResponseWithDefaults() *UsageCustomReportsResponse { - this := UsageCustomReportsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UsageCustomReportsResponse) GetData() []UsageCustomReportsData { - if o == nil || o.Data == nil { - var ret []UsageCustomReportsData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCustomReportsResponse) GetDataOk() (*[]UsageCustomReportsData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UsageCustomReportsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []UsageCustomReportsData and assigns it to the Data field. -func (o *UsageCustomReportsResponse) SetData(v []UsageCustomReportsData) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *UsageCustomReportsResponse) GetMeta() UsageCustomReportsMeta { - if o == nil || o.Meta == nil { - var ret UsageCustomReportsMeta - 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 *UsageCustomReportsResponse) GetMetaOk() (*UsageCustomReportsMeta, 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 *UsageCustomReportsResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given UsageCustomReportsMeta and assigns it to the Meta field. -func (o *UsageCustomReportsResponse) SetMeta(v UsageCustomReportsMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCustomReportsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []UsageCustomReportsData `json:"data,omitempty"` - Meta *UsageCustomReportsMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v1/datadog/model_usage_cws_hour.go b/api/v1/datadog/model_usage_cws_hour.go deleted file mode 100644 index ec63b09f70f..00000000000 --- a/api/v1/datadog/model_usage_cws_hour.go +++ /dev/null @@ -1,263 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageCWSHour Cloud Workload Security usage for a given organization for a given hour. -type UsageCWSHour struct { - // The total number of Cloud Workload Security container hours from the start of the given hour’s month until the given hour. - CwsContainerCount *int64 `json:"cws_container_count,omitempty"` - // The total number of Cloud Workload Security host hours from the start of the given hour’s month until the given hour. - CwsHostCount *int64 `json:"cws_host_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageCWSHour instantiates a new UsageCWSHour 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 NewUsageCWSHour() *UsageCWSHour { - this := UsageCWSHour{} - return &this -} - -// NewUsageCWSHourWithDefaults instantiates a new UsageCWSHour 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 NewUsageCWSHourWithDefaults() *UsageCWSHour { - this := UsageCWSHour{} - return &this -} - -// GetCwsContainerCount returns the CwsContainerCount field value if set, zero value otherwise. -func (o *UsageCWSHour) GetCwsContainerCount() int64 { - if o == nil || o.CwsContainerCount == nil { - var ret int64 - return ret - } - return *o.CwsContainerCount -} - -// GetCwsContainerCountOk returns a tuple with the CwsContainerCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCWSHour) GetCwsContainerCountOk() (*int64, bool) { - if o == nil || o.CwsContainerCount == nil { - return nil, false - } - return o.CwsContainerCount, true -} - -// HasCwsContainerCount returns a boolean if a field has been set. -func (o *UsageCWSHour) HasCwsContainerCount() bool { - if o != nil && o.CwsContainerCount != nil { - return true - } - - return false -} - -// SetCwsContainerCount gets a reference to the given int64 and assigns it to the CwsContainerCount field. -func (o *UsageCWSHour) SetCwsContainerCount(v int64) { - o.CwsContainerCount = &v -} - -// GetCwsHostCount returns the CwsHostCount field value if set, zero value otherwise. -func (o *UsageCWSHour) GetCwsHostCount() int64 { - if o == nil || o.CwsHostCount == nil { - var ret int64 - return ret - } - return *o.CwsHostCount -} - -// GetCwsHostCountOk returns a tuple with the CwsHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCWSHour) GetCwsHostCountOk() (*int64, bool) { - if o == nil || o.CwsHostCount == nil { - return nil, false - } - return o.CwsHostCount, true -} - -// HasCwsHostCount returns a boolean if a field has been set. -func (o *UsageCWSHour) HasCwsHostCount() bool { - if o != nil && o.CwsHostCount != nil { - return true - } - - return false -} - -// SetCwsHostCount gets a reference to the given int64 and assigns it to the CwsHostCount field. -func (o *UsageCWSHour) SetCwsHostCount(v int64) { - o.CwsHostCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageCWSHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCWSHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageCWSHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageCWSHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageCWSHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCWSHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageCWSHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageCWSHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageCWSHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCWSHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageCWSHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageCWSHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCWSHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CwsContainerCount != nil { - toSerialize["cws_container_count"] = o.CwsContainerCount - } - if o.CwsHostCount != nil { - toSerialize["cws_host_count"] = o.CwsHostCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCWSHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CwsContainerCount *int64 `json:"cws_container_count,omitempty"` - CwsHostCount *int64 `json:"cws_host_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CwsContainerCount = all.CwsContainerCount - o.CwsHostCount = all.CwsHostCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_cws_response.go b/api/v1/datadog/model_usage_cws_response.go deleted file mode 100644 index 6df15c9e057..00000000000 --- a/api/v1/datadog/model_usage_cws_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageCWSResponse Response containing the Cloud Workload Security usage for each hour for a given organization. -type UsageCWSResponse struct { - // Get hourly usage for Cloud Workload Security. - Usage []UsageCWSHour `json:"usage,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{} -} - -// NewUsageCWSResponse instantiates a new UsageCWSResponse 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 NewUsageCWSResponse() *UsageCWSResponse { - this := UsageCWSResponse{} - return &this -} - -// NewUsageCWSResponseWithDefaults instantiates a new UsageCWSResponse 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 NewUsageCWSResponseWithDefaults() *UsageCWSResponse { - this := UsageCWSResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageCWSResponse) GetUsage() []UsageCWSHour { - if o == nil || o.Usage == nil { - var ret []UsageCWSHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageCWSResponse) GetUsageOk() (*[]UsageCWSHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageCWSResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageCWSHour and assigns it to the Usage field. -func (o *UsageCWSResponse) SetUsage(v []UsageCWSHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageCWSResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageCWSResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageCWSHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_dbm_hour.go b/api/v1/datadog/model_usage_dbm_hour.go deleted file mode 100644 index 8e0510d7862..00000000000 --- a/api/v1/datadog/model_usage_dbm_hour.go +++ /dev/null @@ -1,263 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageDBMHour Database Monitoring usage for a given organization for a given hour. -type UsageDBMHour struct { - // The total number of Database Monitoring host hours from the start of the given hour’s month until the given hour. - DbmHostCount *int64 `json:"dbm_host_count,omitempty"` - // The total number of normalized Database Monitoring queries from the start of the given hour’s month until the given hour. - DbmQueriesCount *int64 `json:"dbm_queries_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageDBMHour instantiates a new UsageDBMHour 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 NewUsageDBMHour() *UsageDBMHour { - this := UsageDBMHour{} - return &this -} - -// NewUsageDBMHourWithDefaults instantiates a new UsageDBMHour 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 NewUsageDBMHourWithDefaults() *UsageDBMHour { - this := UsageDBMHour{} - return &this -} - -// GetDbmHostCount returns the DbmHostCount field value if set, zero value otherwise. -func (o *UsageDBMHour) GetDbmHostCount() int64 { - if o == nil || o.DbmHostCount == nil { - var ret int64 - return ret - } - return *o.DbmHostCount -} - -// GetDbmHostCountOk returns a tuple with the DbmHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDBMHour) GetDbmHostCountOk() (*int64, bool) { - if o == nil || o.DbmHostCount == nil { - return nil, false - } - return o.DbmHostCount, true -} - -// HasDbmHostCount returns a boolean if a field has been set. -func (o *UsageDBMHour) HasDbmHostCount() bool { - if o != nil && o.DbmHostCount != nil { - return true - } - - return false -} - -// SetDbmHostCount gets a reference to the given int64 and assigns it to the DbmHostCount field. -func (o *UsageDBMHour) SetDbmHostCount(v int64) { - o.DbmHostCount = &v -} - -// GetDbmQueriesCount returns the DbmQueriesCount field value if set, zero value otherwise. -func (o *UsageDBMHour) GetDbmQueriesCount() int64 { - if o == nil || o.DbmQueriesCount == nil { - var ret int64 - return ret - } - return *o.DbmQueriesCount -} - -// GetDbmQueriesCountOk returns a tuple with the DbmQueriesCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDBMHour) GetDbmQueriesCountOk() (*int64, bool) { - if o == nil || o.DbmQueriesCount == nil { - return nil, false - } - return o.DbmQueriesCount, true -} - -// HasDbmQueriesCount returns a boolean if a field has been set. -func (o *UsageDBMHour) HasDbmQueriesCount() bool { - if o != nil && o.DbmQueriesCount != nil { - return true - } - - return false -} - -// SetDbmQueriesCount gets a reference to the given int64 and assigns it to the DbmQueriesCount field. -func (o *UsageDBMHour) SetDbmQueriesCount(v int64) { - o.DbmQueriesCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageDBMHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDBMHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageDBMHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageDBMHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageDBMHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDBMHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageDBMHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageDBMHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageDBMHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDBMHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageDBMHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageDBMHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageDBMHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DbmHostCount != nil { - toSerialize["dbm_host_count"] = o.DbmHostCount - } - if o.DbmQueriesCount != nil { - toSerialize["dbm_queries_count"] = o.DbmQueriesCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageDBMHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DbmHostCount *int64 `json:"dbm_host_count,omitempty"` - DbmQueriesCount *int64 `json:"dbm_queries_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DbmHostCount = all.DbmHostCount - o.DbmQueriesCount = all.DbmQueriesCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_dbm_response.go b/api/v1/datadog/model_usage_dbm_response.go deleted file mode 100644 index bb114dce8ca..00000000000 --- a/api/v1/datadog/model_usage_dbm_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageDBMResponse Response containing the Database Monitoring usage for each hour for a given organization. -type UsageDBMResponse struct { - // Get hourly usage for Database Monitoring - Usage []UsageDBMHour `json:"usage,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{} -} - -// NewUsageDBMResponse instantiates a new UsageDBMResponse 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 NewUsageDBMResponse() *UsageDBMResponse { - this := UsageDBMResponse{} - return &this -} - -// NewUsageDBMResponseWithDefaults instantiates a new UsageDBMResponse 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 NewUsageDBMResponseWithDefaults() *UsageDBMResponse { - this := UsageDBMResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageDBMResponse) GetUsage() []UsageDBMHour { - if o == nil || o.Usage == nil { - var ret []UsageDBMHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDBMResponse) GetUsageOk() (*[]UsageDBMHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageDBMResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageDBMHour and assigns it to the Usage field. -func (o *UsageDBMResponse) SetUsage(v []UsageDBMHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageDBMResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageDBMResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageDBMHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_fargate_hour.go b/api/v1/datadog/model_usage_fargate_hour.go deleted file mode 100644 index 1e9c3deb285..00000000000 --- a/api/v1/datadog/model_usage_fargate_hour.go +++ /dev/null @@ -1,263 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageFargateHour Number of Fargate tasks run and hourly usage. -type UsageFargateHour struct { - // The average profiled task count for Fargate Profiling. - AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The number of Fargate tasks run. - TasksCount *int64 `json:"tasks_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{} -} - -// NewUsageFargateHour instantiates a new UsageFargateHour 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 NewUsageFargateHour() *UsageFargateHour { - this := UsageFargateHour{} - return &this -} - -// NewUsageFargateHourWithDefaults instantiates a new UsageFargateHour 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 NewUsageFargateHourWithDefaults() *UsageFargateHour { - this := UsageFargateHour{} - return &this -} - -// GetAvgProfiledFargateTasks returns the AvgProfiledFargateTasks field value if set, zero value otherwise. -func (o *UsageFargateHour) GetAvgProfiledFargateTasks() int64 { - if o == nil || o.AvgProfiledFargateTasks == nil { - var ret int64 - return ret - } - return *o.AvgProfiledFargateTasks -} - -// GetAvgProfiledFargateTasksOk returns a tuple with the AvgProfiledFargateTasks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageFargateHour) GetAvgProfiledFargateTasksOk() (*int64, bool) { - if o == nil || o.AvgProfiledFargateTasks == nil { - return nil, false - } - return o.AvgProfiledFargateTasks, true -} - -// HasAvgProfiledFargateTasks returns a boolean if a field has been set. -func (o *UsageFargateHour) HasAvgProfiledFargateTasks() bool { - if o != nil && o.AvgProfiledFargateTasks != nil { - return true - } - - return false -} - -// SetAvgProfiledFargateTasks gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasks field. -func (o *UsageFargateHour) SetAvgProfiledFargateTasks(v int64) { - o.AvgProfiledFargateTasks = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageFargateHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageFargateHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageFargateHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageFargateHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageFargateHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageFargateHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageFargateHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageFargateHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageFargateHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageFargateHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageFargateHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageFargateHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetTasksCount returns the TasksCount field value if set, zero value otherwise. -func (o *UsageFargateHour) GetTasksCount() int64 { - if o == nil || o.TasksCount == nil { - var ret int64 - return ret - } - return *o.TasksCount -} - -// GetTasksCountOk returns a tuple with the TasksCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageFargateHour) GetTasksCountOk() (*int64, bool) { - if o == nil || o.TasksCount == nil { - return nil, false - } - return o.TasksCount, true -} - -// HasTasksCount returns a boolean if a field has been set. -func (o *UsageFargateHour) HasTasksCount() bool { - if o != nil && o.TasksCount != nil { - return true - } - - return false -} - -// SetTasksCount gets a reference to the given int64 and assigns it to the TasksCount field. -func (o *UsageFargateHour) SetTasksCount(v int64) { - o.TasksCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageFargateHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AvgProfiledFargateTasks != nil { - toSerialize["avg_profiled_fargate_tasks"] = o.AvgProfiledFargateTasks - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.TasksCount != nil { - toSerialize["tasks_count"] = o.TasksCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageFargateHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - TasksCount *int64 `json:"tasks_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AvgProfiledFargateTasks = all.AvgProfiledFargateTasks - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.TasksCount = all.TasksCount - return nil -} diff --git a/api/v1/datadog/model_usage_fargate_response.go b/api/v1/datadog/model_usage_fargate_response.go deleted file mode 100644 index 193b44df82a..00000000000 --- a/api/v1/datadog/model_usage_fargate_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageFargateResponse Response containing the number of Fargate tasks run and hourly usage. -type UsageFargateResponse struct { - // Array with the number of hourly Fargate tasks recorded for a given organization. - Usage []UsageFargateHour `json:"usage,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{} -} - -// NewUsageFargateResponse instantiates a new UsageFargateResponse 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 NewUsageFargateResponse() *UsageFargateResponse { - this := UsageFargateResponse{} - return &this -} - -// NewUsageFargateResponseWithDefaults instantiates a new UsageFargateResponse 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 NewUsageFargateResponseWithDefaults() *UsageFargateResponse { - this := UsageFargateResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageFargateResponse) GetUsage() []UsageFargateHour { - if o == nil || o.Usage == nil { - var ret []UsageFargateHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageFargateResponse) GetUsageOk() (*[]UsageFargateHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageFargateResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageFargateHour and assigns it to the Usage field. -func (o *UsageFargateResponse) SetUsage(v []UsageFargateHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageFargateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageFargateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageFargateHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_host_hour.go b/api/v1/datadog/model_usage_host_hour.go deleted file mode 100644 index f27f4eec993..00000000000 --- a/api/v1/datadog/model_usage_host_hour.go +++ /dev/null @@ -1,701 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageHostHour Number of hosts/containers recorded for each hour for a given organization. -type UsageHostHour struct { - // Contains the total number of infrastructure hosts reporting - // during a given hour that were running the Datadog Agent. - AgentHostCount *int64 `json:"agent_host_count,omitempty"` - // Contains the total number of hosts that reported through Alibaba integration - // (and were NOT running the Datadog Agent). - AlibabaHostCount *int64 `json:"alibaba_host_count,omitempty"` - // Contains the total number of Azure App Services hosts using APM. - ApmAzureAppServiceHostCount *int64 `json:"apm_azure_app_service_host_count,omitempty"` - // Shows the total number of hosts using APM during the hour, - // these are counted as billable (except during trial periods). - ApmHostCount *int64 `json:"apm_host_count,omitempty"` - // Contains the total number of hosts that reported through the AWS integration - // (and were NOT running the Datadog Agent). - AwsHostCount *int64 `json:"aws_host_count,omitempty"` - // Contains the total number of hosts that reported through Azure integration - // (and were NOT running the Datadog Agent). - AzureHostCount *int64 `json:"azure_host_count,omitempty"` - // Shows the total number of containers reported by the Docker integration during the hour. - ContainerCount *int64 `json:"container_count,omitempty"` - // Contains the total number of hosts that reported through the Google Cloud integration - // (and were NOT running the Datadog Agent). - GcpHostCount *int64 `json:"gcp_host_count,omitempty"` - // Contains the total number of Heroku dynos reported by the Datadog Agent. - HerokuHostCount *int64 `json:"heroku_host_count,omitempty"` - // Contains the total number of billable infrastructure hosts reporting during a given hour. - // This is the sum of `agent_host_count`, `aws_host_count`, and `gcp_host_count`. - HostCount *int64 `json:"host_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the total number of hosts that reported through the Azure App Services integration - // (and were NOT running the Datadog Agent). - InfraAzureAppService *int64 `json:"infra_azure_app_service,omitempty"` - // Contains the total number of hosts reported by Datadog exporter for the OpenTelemetry Collector. - OpentelemetryHostCount *int64 `json:"opentelemetry_host_count,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // Contains the total number of hosts that reported through vSphere integration - // (and were NOT running the Datadog Agent). - VsphereHostCount *int64 `json:"vsphere_host_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{} -} - -// NewUsageHostHour instantiates a new UsageHostHour 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 NewUsageHostHour() *UsageHostHour { - this := UsageHostHour{} - return &this -} - -// NewUsageHostHourWithDefaults instantiates a new UsageHostHour 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 NewUsageHostHourWithDefaults() *UsageHostHour { - this := UsageHostHour{} - return &this -} - -// GetAgentHostCount returns the AgentHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetAgentHostCount() int64 { - if o == nil || o.AgentHostCount == nil { - var ret int64 - return ret - } - return *o.AgentHostCount -} - -// GetAgentHostCountOk returns a tuple with the AgentHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetAgentHostCountOk() (*int64, bool) { - if o == nil || o.AgentHostCount == nil { - return nil, false - } - return o.AgentHostCount, true -} - -// HasAgentHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasAgentHostCount() bool { - if o != nil && o.AgentHostCount != nil { - return true - } - - return false -} - -// SetAgentHostCount gets a reference to the given int64 and assigns it to the AgentHostCount field. -func (o *UsageHostHour) SetAgentHostCount(v int64) { - o.AgentHostCount = &v -} - -// GetAlibabaHostCount returns the AlibabaHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetAlibabaHostCount() int64 { - if o == nil || o.AlibabaHostCount == nil { - var ret int64 - return ret - } - return *o.AlibabaHostCount -} - -// GetAlibabaHostCountOk returns a tuple with the AlibabaHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetAlibabaHostCountOk() (*int64, bool) { - if o == nil || o.AlibabaHostCount == nil { - return nil, false - } - return o.AlibabaHostCount, true -} - -// HasAlibabaHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasAlibabaHostCount() bool { - if o != nil && o.AlibabaHostCount != nil { - return true - } - - return false -} - -// SetAlibabaHostCount gets a reference to the given int64 and assigns it to the AlibabaHostCount field. -func (o *UsageHostHour) SetAlibabaHostCount(v int64) { - o.AlibabaHostCount = &v -} - -// GetApmAzureAppServiceHostCount returns the ApmAzureAppServiceHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetApmAzureAppServiceHostCount() int64 { - if o == nil || o.ApmAzureAppServiceHostCount == nil { - var ret int64 - return ret - } - return *o.ApmAzureAppServiceHostCount -} - -// GetApmAzureAppServiceHostCountOk returns a tuple with the ApmAzureAppServiceHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetApmAzureAppServiceHostCountOk() (*int64, bool) { - if o == nil || o.ApmAzureAppServiceHostCount == nil { - return nil, false - } - return o.ApmAzureAppServiceHostCount, true -} - -// HasApmAzureAppServiceHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasApmAzureAppServiceHostCount() bool { - if o != nil && o.ApmAzureAppServiceHostCount != nil { - return true - } - - return false -} - -// SetApmAzureAppServiceHostCount gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostCount field. -func (o *UsageHostHour) SetApmAzureAppServiceHostCount(v int64) { - o.ApmAzureAppServiceHostCount = &v -} - -// GetApmHostCount returns the ApmHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetApmHostCount() int64 { - if o == nil || o.ApmHostCount == nil { - var ret int64 - return ret - } - return *o.ApmHostCount -} - -// GetApmHostCountOk returns a tuple with the ApmHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetApmHostCountOk() (*int64, bool) { - if o == nil || o.ApmHostCount == nil { - return nil, false - } - return o.ApmHostCount, true -} - -// HasApmHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasApmHostCount() bool { - if o != nil && o.ApmHostCount != nil { - return true - } - - return false -} - -// SetApmHostCount gets a reference to the given int64 and assigns it to the ApmHostCount field. -func (o *UsageHostHour) SetApmHostCount(v int64) { - o.ApmHostCount = &v -} - -// GetAwsHostCount returns the AwsHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetAwsHostCount() int64 { - if o == nil || o.AwsHostCount == nil { - var ret int64 - return ret - } - return *o.AwsHostCount -} - -// GetAwsHostCountOk returns a tuple with the AwsHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetAwsHostCountOk() (*int64, bool) { - if o == nil || o.AwsHostCount == nil { - return nil, false - } - return o.AwsHostCount, true -} - -// HasAwsHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasAwsHostCount() bool { - if o != nil && o.AwsHostCount != nil { - return true - } - - return false -} - -// SetAwsHostCount gets a reference to the given int64 and assigns it to the AwsHostCount field. -func (o *UsageHostHour) SetAwsHostCount(v int64) { - o.AwsHostCount = &v -} - -// GetAzureHostCount returns the AzureHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetAzureHostCount() int64 { - if o == nil || o.AzureHostCount == nil { - var ret int64 - return ret - } - return *o.AzureHostCount -} - -// GetAzureHostCountOk returns a tuple with the AzureHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetAzureHostCountOk() (*int64, bool) { - if o == nil || o.AzureHostCount == nil { - return nil, false - } - return o.AzureHostCount, true -} - -// HasAzureHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasAzureHostCount() bool { - if o != nil && o.AzureHostCount != nil { - return true - } - - return false -} - -// SetAzureHostCount gets a reference to the given int64 and assigns it to the AzureHostCount field. -func (o *UsageHostHour) SetAzureHostCount(v int64) { - o.AzureHostCount = &v -} - -// GetContainerCount returns the ContainerCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetContainerCount() int64 { - if o == nil || o.ContainerCount == nil { - var ret int64 - return ret - } - return *o.ContainerCount -} - -// GetContainerCountOk returns a tuple with the ContainerCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetContainerCountOk() (*int64, bool) { - if o == nil || o.ContainerCount == nil { - return nil, false - } - return o.ContainerCount, true -} - -// HasContainerCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasContainerCount() bool { - if o != nil && o.ContainerCount != nil { - return true - } - - return false -} - -// SetContainerCount gets a reference to the given int64 and assigns it to the ContainerCount field. -func (o *UsageHostHour) SetContainerCount(v int64) { - o.ContainerCount = &v -} - -// GetGcpHostCount returns the GcpHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetGcpHostCount() int64 { - if o == nil || o.GcpHostCount == nil { - var ret int64 - return ret - } - return *o.GcpHostCount -} - -// GetGcpHostCountOk returns a tuple with the GcpHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetGcpHostCountOk() (*int64, bool) { - if o == nil || o.GcpHostCount == nil { - return nil, false - } - return o.GcpHostCount, true -} - -// HasGcpHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasGcpHostCount() bool { - if o != nil && o.GcpHostCount != nil { - return true - } - - return false -} - -// SetGcpHostCount gets a reference to the given int64 and assigns it to the GcpHostCount field. -func (o *UsageHostHour) SetGcpHostCount(v int64) { - o.GcpHostCount = &v -} - -// GetHerokuHostCount returns the HerokuHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetHerokuHostCount() int64 { - if o == nil || o.HerokuHostCount == nil { - var ret int64 - return ret - } - return *o.HerokuHostCount -} - -// GetHerokuHostCountOk returns a tuple with the HerokuHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetHerokuHostCountOk() (*int64, bool) { - if o == nil || o.HerokuHostCount == nil { - return nil, false - } - return o.HerokuHostCount, true -} - -// HasHerokuHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasHerokuHostCount() bool { - if o != nil && o.HerokuHostCount != nil { - return true - } - - return false -} - -// SetHerokuHostCount gets a reference to the given int64 and assigns it to the HerokuHostCount field. -func (o *UsageHostHour) SetHerokuHostCount(v int64) { - o.HerokuHostCount = &v -} - -// GetHostCount returns the HostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetHostCount() int64 { - if o == nil || o.HostCount == nil { - var ret int64 - return ret - } - return *o.HostCount -} - -// GetHostCountOk returns a tuple with the HostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetHostCountOk() (*int64, bool) { - if o == nil || o.HostCount == nil { - return nil, false - } - return o.HostCount, true -} - -// HasHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasHostCount() bool { - if o != nil && o.HostCount != nil { - return true - } - - return false -} - -// SetHostCount gets a reference to the given int64 and assigns it to the HostCount field. -func (o *UsageHostHour) SetHostCount(v int64) { - o.HostCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageHostHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageHostHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageHostHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetInfraAzureAppService returns the InfraAzureAppService field value if set, zero value otherwise. -func (o *UsageHostHour) GetInfraAzureAppService() int64 { - if o == nil || o.InfraAzureAppService == nil { - var ret int64 - return ret - } - return *o.InfraAzureAppService -} - -// GetInfraAzureAppServiceOk returns a tuple with the InfraAzureAppService field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetInfraAzureAppServiceOk() (*int64, bool) { - if o == nil || o.InfraAzureAppService == nil { - return nil, false - } - return o.InfraAzureAppService, true -} - -// HasInfraAzureAppService returns a boolean if a field has been set. -func (o *UsageHostHour) HasInfraAzureAppService() bool { - if o != nil && o.InfraAzureAppService != nil { - return true - } - - return false -} - -// SetInfraAzureAppService gets a reference to the given int64 and assigns it to the InfraAzureAppService field. -func (o *UsageHostHour) SetInfraAzureAppService(v int64) { - o.InfraAzureAppService = &v -} - -// GetOpentelemetryHostCount returns the OpentelemetryHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetOpentelemetryHostCount() int64 { - if o == nil || o.OpentelemetryHostCount == nil { - var ret int64 - return ret - } - return *o.OpentelemetryHostCount -} - -// GetOpentelemetryHostCountOk returns a tuple with the OpentelemetryHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetOpentelemetryHostCountOk() (*int64, bool) { - if o == nil || o.OpentelemetryHostCount == nil { - return nil, false - } - return o.OpentelemetryHostCount, true -} - -// HasOpentelemetryHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasOpentelemetryHostCount() bool { - if o != nil && o.OpentelemetryHostCount != nil { - return true - } - - return false -} - -// SetOpentelemetryHostCount gets a reference to the given int64 and assigns it to the OpentelemetryHostCount field. -func (o *UsageHostHour) SetOpentelemetryHostCount(v int64) { - o.OpentelemetryHostCount = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageHostHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageHostHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageHostHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageHostHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageHostHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageHostHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetVsphereHostCount returns the VsphereHostCount field value if set, zero value otherwise. -func (o *UsageHostHour) GetVsphereHostCount() int64 { - if o == nil || o.VsphereHostCount == nil { - var ret int64 - return ret - } - return *o.VsphereHostCount -} - -// GetVsphereHostCountOk returns a tuple with the VsphereHostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostHour) GetVsphereHostCountOk() (*int64, bool) { - if o == nil || o.VsphereHostCount == nil { - return nil, false - } - return o.VsphereHostCount, true -} - -// HasVsphereHostCount returns a boolean if a field has been set. -func (o *UsageHostHour) HasVsphereHostCount() bool { - if o != nil && o.VsphereHostCount != nil { - return true - } - - return false -} - -// SetVsphereHostCount gets a reference to the given int64 and assigns it to the VsphereHostCount field. -func (o *UsageHostHour) SetVsphereHostCount(v int64) { - o.VsphereHostCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageHostHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AgentHostCount != nil { - toSerialize["agent_host_count"] = o.AgentHostCount - } - if o.AlibabaHostCount != nil { - toSerialize["alibaba_host_count"] = o.AlibabaHostCount - } - if o.ApmAzureAppServiceHostCount != nil { - toSerialize["apm_azure_app_service_host_count"] = o.ApmAzureAppServiceHostCount - } - if o.ApmHostCount != nil { - toSerialize["apm_host_count"] = o.ApmHostCount - } - if o.AwsHostCount != nil { - toSerialize["aws_host_count"] = o.AwsHostCount - } - if o.AzureHostCount != nil { - toSerialize["azure_host_count"] = o.AzureHostCount - } - if o.ContainerCount != nil { - toSerialize["container_count"] = o.ContainerCount - } - if o.GcpHostCount != nil { - toSerialize["gcp_host_count"] = o.GcpHostCount - } - if o.HerokuHostCount != nil { - toSerialize["heroku_host_count"] = o.HerokuHostCount - } - if o.HostCount != nil { - toSerialize["host_count"] = o.HostCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.InfraAzureAppService != nil { - toSerialize["infra_azure_app_service"] = o.InfraAzureAppService - } - if o.OpentelemetryHostCount != nil { - toSerialize["opentelemetry_host_count"] = o.OpentelemetryHostCount - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.VsphereHostCount != nil { - toSerialize["vsphere_host_count"] = o.VsphereHostCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageHostHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AgentHostCount *int64 `json:"agent_host_count,omitempty"` - AlibabaHostCount *int64 `json:"alibaba_host_count,omitempty"` - ApmAzureAppServiceHostCount *int64 `json:"apm_azure_app_service_host_count,omitempty"` - ApmHostCount *int64 `json:"apm_host_count,omitempty"` - AwsHostCount *int64 `json:"aws_host_count,omitempty"` - AzureHostCount *int64 `json:"azure_host_count,omitempty"` - ContainerCount *int64 `json:"container_count,omitempty"` - GcpHostCount *int64 `json:"gcp_host_count,omitempty"` - HerokuHostCount *int64 `json:"heroku_host_count,omitempty"` - HostCount *int64 `json:"host_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - InfraAzureAppService *int64 `json:"infra_azure_app_service,omitempty"` - OpentelemetryHostCount *int64 `json:"opentelemetry_host_count,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - VsphereHostCount *int64 `json:"vsphere_host_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AgentHostCount = all.AgentHostCount - o.AlibabaHostCount = all.AlibabaHostCount - o.ApmAzureAppServiceHostCount = all.ApmAzureAppServiceHostCount - o.ApmHostCount = all.ApmHostCount - o.AwsHostCount = all.AwsHostCount - o.AzureHostCount = all.AzureHostCount - o.ContainerCount = all.ContainerCount - o.GcpHostCount = all.GcpHostCount - o.HerokuHostCount = all.HerokuHostCount - o.HostCount = all.HostCount - o.Hour = all.Hour - o.InfraAzureAppService = all.InfraAzureAppService - o.OpentelemetryHostCount = all.OpentelemetryHostCount - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.VsphereHostCount = all.VsphereHostCount - return nil -} diff --git a/api/v1/datadog/model_usage_hosts_response.go b/api/v1/datadog/model_usage_hosts_response.go deleted file mode 100644 index c3dbc4c2e83..00000000000 --- a/api/v1/datadog/model_usage_hosts_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageHostsResponse Host usage response. -type UsageHostsResponse struct { - // An array of objects related to host usage. - Usage []UsageHostHour `json:"usage,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{} -} - -// NewUsageHostsResponse instantiates a new UsageHostsResponse 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 NewUsageHostsResponse() *UsageHostsResponse { - this := UsageHostsResponse{} - return &this -} - -// NewUsageHostsResponseWithDefaults instantiates a new UsageHostsResponse 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 NewUsageHostsResponseWithDefaults() *UsageHostsResponse { - this := UsageHostsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageHostsResponse) GetUsage() []UsageHostHour { - if o == nil || o.Usage == nil { - var ret []UsageHostHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageHostsResponse) GetUsageOk() (*[]UsageHostHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageHostsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageHostHour and assigns it to the Usage field. -func (o *UsageHostsResponse) SetUsage(v []UsageHostHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageHostsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageHostsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageHostHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_incident_management_hour.go b/api/v1/datadog/model_usage_incident_management_hour.go deleted file mode 100644 index a8cf2d16f7d..00000000000 --- a/api/v1/datadog/model_usage_incident_management_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageIncidentManagementHour Incident management usage for a given organization for a given hour. -type UsageIncidentManagementHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the total number monthly active users from the start of the given hour's month until the given hour. - MonthlyActiveUsers *int64 `json:"monthly_active_users,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageIncidentManagementHour instantiates a new UsageIncidentManagementHour 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 NewUsageIncidentManagementHour() *UsageIncidentManagementHour { - this := UsageIncidentManagementHour{} - return &this -} - -// NewUsageIncidentManagementHourWithDefaults instantiates a new UsageIncidentManagementHour 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 NewUsageIncidentManagementHourWithDefaults() *UsageIncidentManagementHour { - this := UsageIncidentManagementHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageIncidentManagementHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIncidentManagementHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageIncidentManagementHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageIncidentManagementHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetMonthlyActiveUsers returns the MonthlyActiveUsers field value if set, zero value otherwise. -func (o *UsageIncidentManagementHour) GetMonthlyActiveUsers() int64 { - if o == nil || o.MonthlyActiveUsers == nil { - var ret int64 - return ret - } - return *o.MonthlyActiveUsers -} - -// GetMonthlyActiveUsersOk returns a tuple with the MonthlyActiveUsers field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIncidentManagementHour) GetMonthlyActiveUsersOk() (*int64, bool) { - if o == nil || o.MonthlyActiveUsers == nil { - return nil, false - } - return o.MonthlyActiveUsers, true -} - -// HasMonthlyActiveUsers returns a boolean if a field has been set. -func (o *UsageIncidentManagementHour) HasMonthlyActiveUsers() bool { - if o != nil && o.MonthlyActiveUsers != nil { - return true - } - - return false -} - -// SetMonthlyActiveUsers gets a reference to the given int64 and assigns it to the MonthlyActiveUsers field. -func (o *UsageIncidentManagementHour) SetMonthlyActiveUsers(v int64) { - o.MonthlyActiveUsers = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageIncidentManagementHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIncidentManagementHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageIncidentManagementHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageIncidentManagementHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageIncidentManagementHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIncidentManagementHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageIncidentManagementHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageIncidentManagementHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIncidentManagementHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.MonthlyActiveUsers != nil { - toSerialize["monthly_active_users"] = o.MonthlyActiveUsers - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIncidentManagementHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - MonthlyActiveUsers *int64 `json:"monthly_active_users,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.MonthlyActiveUsers = all.MonthlyActiveUsers - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_incident_management_response.go b/api/v1/datadog/model_usage_incident_management_response.go deleted file mode 100644 index cf3cbd097a2..00000000000 --- a/api/v1/datadog/model_usage_incident_management_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageIncidentManagementResponse Response containing the incident management usage for each hour for a given organization. -type UsageIncidentManagementResponse struct { - // Get hourly usage for incident management. - Usage []UsageIncidentManagementHour `json:"usage,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{} -} - -// NewUsageIncidentManagementResponse instantiates a new UsageIncidentManagementResponse 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 NewUsageIncidentManagementResponse() *UsageIncidentManagementResponse { - this := UsageIncidentManagementResponse{} - return &this -} - -// NewUsageIncidentManagementResponseWithDefaults instantiates a new UsageIncidentManagementResponse 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 NewUsageIncidentManagementResponseWithDefaults() *UsageIncidentManagementResponse { - this := UsageIncidentManagementResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageIncidentManagementResponse) GetUsage() []UsageIncidentManagementHour { - if o == nil || o.Usage == nil { - var ret []UsageIncidentManagementHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIncidentManagementResponse) GetUsageOk() (*[]UsageIncidentManagementHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageIncidentManagementResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageIncidentManagementHour and assigns it to the Usage field. -func (o *UsageIncidentManagementResponse) SetUsage(v []UsageIncidentManagementHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIncidentManagementResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIncidentManagementResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageIncidentManagementHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_indexed_spans_hour.go b/api/v1/datadog/model_usage_indexed_spans_hour.go deleted file mode 100644 index c1532ce407d..00000000000 --- a/api/v1/datadog/model_usage_indexed_spans_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageIndexedSpansHour The hours of indexed spans usage. -type UsageIndexedSpansHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the number of spans indexed. - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageIndexedSpansHour instantiates a new UsageIndexedSpansHour 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 NewUsageIndexedSpansHour() *UsageIndexedSpansHour { - this := UsageIndexedSpansHour{} - return &this -} - -// NewUsageIndexedSpansHourWithDefaults instantiates a new UsageIndexedSpansHour 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 NewUsageIndexedSpansHourWithDefaults() *UsageIndexedSpansHour { - this := UsageIndexedSpansHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageIndexedSpansHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIndexedSpansHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageIndexedSpansHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageIndexedSpansHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. -func (o *UsageIndexedSpansHour) GetIndexedEventsCount() int64 { - if o == nil || o.IndexedEventsCount == nil { - var ret int64 - return ret - } - return *o.IndexedEventsCount -} - -// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIndexedSpansHour) GetIndexedEventsCountOk() (*int64, bool) { - if o == nil || o.IndexedEventsCount == nil { - return nil, false - } - return o.IndexedEventsCount, true -} - -// HasIndexedEventsCount returns a boolean if a field has been set. -func (o *UsageIndexedSpansHour) HasIndexedEventsCount() bool { - if o != nil && o.IndexedEventsCount != nil { - return true - } - - return false -} - -// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. -func (o *UsageIndexedSpansHour) SetIndexedEventsCount(v int64) { - o.IndexedEventsCount = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageIndexedSpansHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIndexedSpansHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageIndexedSpansHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageIndexedSpansHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageIndexedSpansHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIndexedSpansHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageIndexedSpansHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageIndexedSpansHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIndexedSpansHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.IndexedEventsCount != nil { - toSerialize["indexed_events_count"] = o.IndexedEventsCount - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIndexedSpansHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.IndexedEventsCount = all.IndexedEventsCount - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_indexed_spans_response.go b/api/v1/datadog/model_usage_indexed_spans_response.go deleted file mode 100644 index e7146029784..00000000000 --- a/api/v1/datadog/model_usage_indexed_spans_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageIndexedSpansResponse A response containing indexed spans usage. -type UsageIndexedSpansResponse struct { - // Array with the number of hourly traces indexed for a given organization. - Usage []UsageIndexedSpansHour `json:"usage,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{} -} - -// NewUsageIndexedSpansResponse instantiates a new UsageIndexedSpansResponse 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 NewUsageIndexedSpansResponse() *UsageIndexedSpansResponse { - this := UsageIndexedSpansResponse{} - return &this -} - -// NewUsageIndexedSpansResponseWithDefaults instantiates a new UsageIndexedSpansResponse 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 NewUsageIndexedSpansResponseWithDefaults() *UsageIndexedSpansResponse { - this := UsageIndexedSpansResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageIndexedSpansResponse) GetUsage() []UsageIndexedSpansHour { - if o == nil || o.Usage == nil { - var ret []UsageIndexedSpansHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIndexedSpansResponse) GetUsageOk() (*[]UsageIndexedSpansHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageIndexedSpansResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageIndexedSpansHour and assigns it to the Usage field. -func (o *UsageIndexedSpansResponse) SetUsage(v []UsageIndexedSpansHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIndexedSpansResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIndexedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageIndexedSpansHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_ingested_spans_hour.go b/api/v1/datadog/model_usage_ingested_spans_hour.go deleted file mode 100644 index fc168232c23..00000000000 --- a/api/v1/datadog/model_usage_ingested_spans_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageIngestedSpansHour Ingested spans usage for a given organization for a given hour. -type UsageIngestedSpansHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the total number of bytes ingested for APM spans during a given hour. - IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageIngestedSpansHour instantiates a new UsageIngestedSpansHour 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 NewUsageIngestedSpansHour() *UsageIngestedSpansHour { - this := UsageIngestedSpansHour{} - return &this -} - -// NewUsageIngestedSpansHourWithDefaults instantiates a new UsageIngestedSpansHour 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 NewUsageIngestedSpansHourWithDefaults() *UsageIngestedSpansHour { - this := UsageIngestedSpansHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageIngestedSpansHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIngestedSpansHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageIngestedSpansHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageIngestedSpansHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetIngestedEventsBytes returns the IngestedEventsBytes field value if set, zero value otherwise. -func (o *UsageIngestedSpansHour) GetIngestedEventsBytes() int64 { - if o == nil || o.IngestedEventsBytes == nil { - var ret int64 - return ret - } - return *o.IngestedEventsBytes -} - -// GetIngestedEventsBytesOk returns a tuple with the IngestedEventsBytes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIngestedSpansHour) GetIngestedEventsBytesOk() (*int64, bool) { - if o == nil || o.IngestedEventsBytes == nil { - return nil, false - } - return o.IngestedEventsBytes, true -} - -// HasIngestedEventsBytes returns a boolean if a field has been set. -func (o *UsageIngestedSpansHour) HasIngestedEventsBytes() bool { - if o != nil && o.IngestedEventsBytes != nil { - return true - } - - return false -} - -// SetIngestedEventsBytes gets a reference to the given int64 and assigns it to the IngestedEventsBytes field. -func (o *UsageIngestedSpansHour) SetIngestedEventsBytes(v int64) { - o.IngestedEventsBytes = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageIngestedSpansHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIngestedSpansHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageIngestedSpansHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageIngestedSpansHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageIngestedSpansHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIngestedSpansHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageIngestedSpansHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageIngestedSpansHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIngestedSpansHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.IngestedEventsBytes != nil { - toSerialize["ingested_events_bytes"] = o.IngestedEventsBytes - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIngestedSpansHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.IngestedEventsBytes = all.IngestedEventsBytes - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_ingested_spans_response.go b/api/v1/datadog/model_usage_ingested_spans_response.go deleted file mode 100644 index 58e2878ee27..00000000000 --- a/api/v1/datadog/model_usage_ingested_spans_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageIngestedSpansResponse Response containing the ingested spans usage for each hour for a given organization. -type UsageIngestedSpansResponse struct { - // Get hourly usage for ingested spans. - Usage []UsageIngestedSpansHour `json:"usage,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{} -} - -// NewUsageIngestedSpansResponse instantiates a new UsageIngestedSpansResponse 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 NewUsageIngestedSpansResponse() *UsageIngestedSpansResponse { - this := UsageIngestedSpansResponse{} - return &this -} - -// NewUsageIngestedSpansResponseWithDefaults instantiates a new UsageIngestedSpansResponse 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 NewUsageIngestedSpansResponseWithDefaults() *UsageIngestedSpansResponse { - this := UsageIngestedSpansResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageIngestedSpansResponse) GetUsage() []UsageIngestedSpansHour { - if o == nil || o.Usage == nil { - var ret []UsageIngestedSpansHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIngestedSpansResponse) GetUsageOk() (*[]UsageIngestedSpansHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageIngestedSpansResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageIngestedSpansHour and assigns it to the Usage field. -func (o *UsageIngestedSpansResponse) SetUsage(v []UsageIngestedSpansHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIngestedSpansResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIngestedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageIngestedSpansHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_io_t_hour.go b/api/v1/datadog/model_usage_io_t_hour.go deleted file mode 100644 index b6f8eae0b8e..00000000000 --- a/api/v1/datadog/model_usage_io_t_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageIoTHour IoT usage for a given organization for a given hour. -type UsageIoTHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The total number of IoT devices during a given hour. - IotDeviceCount *int64 `json:"iot_device_count,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageIoTHour instantiates a new UsageIoTHour 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 NewUsageIoTHour() *UsageIoTHour { - this := UsageIoTHour{} - return &this -} - -// NewUsageIoTHourWithDefaults instantiates a new UsageIoTHour 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 NewUsageIoTHourWithDefaults() *UsageIoTHour { - this := UsageIoTHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageIoTHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIoTHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageIoTHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageIoTHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetIotDeviceCount returns the IotDeviceCount field value if set, zero value otherwise. -func (o *UsageIoTHour) GetIotDeviceCount() int64 { - if o == nil || o.IotDeviceCount == nil { - var ret int64 - return ret - } - return *o.IotDeviceCount -} - -// GetIotDeviceCountOk returns a tuple with the IotDeviceCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIoTHour) GetIotDeviceCountOk() (*int64, bool) { - if o == nil || o.IotDeviceCount == nil { - return nil, false - } - return o.IotDeviceCount, true -} - -// HasIotDeviceCount returns a boolean if a field has been set. -func (o *UsageIoTHour) HasIotDeviceCount() bool { - if o != nil && o.IotDeviceCount != nil { - return true - } - - return false -} - -// SetIotDeviceCount gets a reference to the given int64 and assigns it to the IotDeviceCount field. -func (o *UsageIoTHour) SetIotDeviceCount(v int64) { - o.IotDeviceCount = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageIoTHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIoTHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageIoTHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageIoTHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageIoTHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIoTHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageIoTHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageIoTHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIoTHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.IotDeviceCount != nil { - toSerialize["iot_device_count"] = o.IotDeviceCount - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIoTHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - IotDeviceCount *int64 `json:"iot_device_count,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.IotDeviceCount = all.IotDeviceCount - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_io_t_response.go b/api/v1/datadog/model_usage_io_t_response.go deleted file mode 100644 index 699d87d0d93..00000000000 --- a/api/v1/datadog/model_usage_io_t_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageIoTResponse Response containing the IoT usage for each hour for a given organization. -type UsageIoTResponse struct { - // Get hourly usage for IoT. - Usage []UsageIoTHour `json:"usage,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{} -} - -// NewUsageIoTResponse instantiates a new UsageIoTResponse 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 NewUsageIoTResponse() *UsageIoTResponse { - this := UsageIoTResponse{} - return &this -} - -// NewUsageIoTResponseWithDefaults instantiates a new UsageIoTResponse 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 NewUsageIoTResponseWithDefaults() *UsageIoTResponse { - this := UsageIoTResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageIoTResponse) GetUsage() []UsageIoTHour { - if o == nil || o.Usage == nil { - var ret []UsageIoTHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageIoTResponse) GetUsageOk() (*[]UsageIoTHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageIoTResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageIoTHour and assigns it to the Usage field. -func (o *UsageIoTResponse) SetUsage(v []UsageIoTHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageIoTResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageIoTResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageIoTHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_lambda_hour.go b/api/v1/datadog/model_usage_lambda_hour.go deleted file mode 100644 index 022846068d7..00000000000 --- a/api/v1/datadog/model_usage_lambda_hour.go +++ /dev/null @@ -1,264 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageLambdaHour Number of lambda functions and sum of the invocations of all lambda functions -// for each hour for a given organization. -type UsageLambdaHour struct { - // Contains the number of different functions for each region and AWS account. - FuncCount *int64 `json:"func_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the sum of invocations of all functions. - InvocationsSum *int64 `json:"invocations_sum,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageLambdaHour instantiates a new UsageLambdaHour 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 NewUsageLambdaHour() *UsageLambdaHour { - this := UsageLambdaHour{} - return &this -} - -// NewUsageLambdaHourWithDefaults instantiates a new UsageLambdaHour 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 NewUsageLambdaHourWithDefaults() *UsageLambdaHour { - this := UsageLambdaHour{} - return &this -} - -// GetFuncCount returns the FuncCount field value if set, zero value otherwise. -func (o *UsageLambdaHour) GetFuncCount() int64 { - if o == nil || o.FuncCount == nil { - var ret int64 - return ret - } - return *o.FuncCount -} - -// GetFuncCountOk returns a tuple with the FuncCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLambdaHour) GetFuncCountOk() (*int64, bool) { - if o == nil || o.FuncCount == nil { - return nil, false - } - return o.FuncCount, true -} - -// HasFuncCount returns a boolean if a field has been set. -func (o *UsageLambdaHour) HasFuncCount() bool { - if o != nil && o.FuncCount != nil { - return true - } - - return false -} - -// SetFuncCount gets a reference to the given int64 and assigns it to the FuncCount field. -func (o *UsageLambdaHour) SetFuncCount(v int64) { - o.FuncCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageLambdaHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLambdaHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageLambdaHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageLambdaHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetInvocationsSum returns the InvocationsSum field value if set, zero value otherwise. -func (o *UsageLambdaHour) GetInvocationsSum() int64 { - if o == nil || o.InvocationsSum == nil { - var ret int64 - return ret - } - return *o.InvocationsSum -} - -// GetInvocationsSumOk returns a tuple with the InvocationsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLambdaHour) GetInvocationsSumOk() (*int64, bool) { - if o == nil || o.InvocationsSum == nil { - return nil, false - } - return o.InvocationsSum, true -} - -// HasInvocationsSum returns a boolean if a field has been set. -func (o *UsageLambdaHour) HasInvocationsSum() bool { - if o != nil && o.InvocationsSum != nil { - return true - } - - return false -} - -// SetInvocationsSum gets a reference to the given int64 and assigns it to the InvocationsSum field. -func (o *UsageLambdaHour) SetInvocationsSum(v int64) { - o.InvocationsSum = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageLambdaHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLambdaHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageLambdaHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageLambdaHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageLambdaHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLambdaHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageLambdaHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageLambdaHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLambdaHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.FuncCount != nil { - toSerialize["func_count"] = o.FuncCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.InvocationsSum != nil { - toSerialize["invocations_sum"] = o.InvocationsSum - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLambdaHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - FuncCount *int64 `json:"func_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - InvocationsSum *int64 `json:"invocations_sum,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.FuncCount = all.FuncCount - o.Hour = all.Hour - o.InvocationsSum = all.InvocationsSum - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_lambda_response.go b/api/v1/datadog/model_usage_lambda_response.go deleted file mode 100644 index 8c8056b602b..00000000000 --- a/api/v1/datadog/model_usage_lambda_response.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageLambdaResponse Response containing the number of lambda functions and sum of the invocations of all lambda functions -// for each hour for a given organization. -type UsageLambdaResponse struct { - // Get hourly usage for Lambda. - Usage []UsageLambdaHour `json:"usage,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{} -} - -// NewUsageLambdaResponse instantiates a new UsageLambdaResponse 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 NewUsageLambdaResponse() *UsageLambdaResponse { - this := UsageLambdaResponse{} - return &this -} - -// NewUsageLambdaResponseWithDefaults instantiates a new UsageLambdaResponse 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 NewUsageLambdaResponseWithDefaults() *UsageLambdaResponse { - this := UsageLambdaResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageLambdaResponse) GetUsage() []UsageLambdaHour { - if o == nil || o.Usage == nil { - var ret []UsageLambdaHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLambdaResponse) GetUsageOk() (*[]UsageLambdaHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageLambdaResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageLambdaHour and assigns it to the Usage field. -func (o *UsageLambdaResponse) SetUsage(v []UsageLambdaHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLambdaResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLambdaResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageLambdaHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_logs_by_index_hour.go b/api/v1/datadog/model_usage_logs_by_index_hour.go deleted file mode 100644 index 33300bd71fe..00000000000 --- a/api/v1/datadog/model_usage_logs_by_index_hour.go +++ /dev/null @@ -1,341 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageLogsByIndexHour Number of indexed logs for each hour and index for a given organization. -type UsageLogsByIndexHour struct { - // The total number of indexed logs for the queried hour. - EventCount *int64 `json:"event_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The index ID for this usage. - IndexId *string `json:"index_id,omitempty"` - // The user specified name for this index ID. - IndexName *string `json:"index_name,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The retention period (in days) for this index ID. - Retention *int64 `json:"retention,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{} -} - -// NewUsageLogsByIndexHour instantiates a new UsageLogsByIndexHour 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 NewUsageLogsByIndexHour() *UsageLogsByIndexHour { - this := UsageLogsByIndexHour{} - return &this -} - -// NewUsageLogsByIndexHourWithDefaults instantiates a new UsageLogsByIndexHour 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 NewUsageLogsByIndexHourWithDefaults() *UsageLogsByIndexHour { - this := UsageLogsByIndexHour{} - return &this -} - -// GetEventCount returns the EventCount field value if set, zero value otherwise. -func (o *UsageLogsByIndexHour) GetEventCount() int64 { - if o == nil || o.EventCount == nil { - var ret int64 - return ret - } - return *o.EventCount -} - -// GetEventCountOk returns a tuple with the EventCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexHour) GetEventCountOk() (*int64, bool) { - if o == nil || o.EventCount == nil { - return nil, false - } - return o.EventCount, true -} - -// HasEventCount returns a boolean if a field has been set. -func (o *UsageLogsByIndexHour) HasEventCount() bool { - if o != nil && o.EventCount != nil { - return true - } - - return false -} - -// SetEventCount gets a reference to the given int64 and assigns it to the EventCount field. -func (o *UsageLogsByIndexHour) SetEventCount(v int64) { - o.EventCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageLogsByIndexHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageLogsByIndexHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageLogsByIndexHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetIndexId returns the IndexId field value if set, zero value otherwise. -func (o *UsageLogsByIndexHour) GetIndexId() string { - if o == nil || o.IndexId == nil { - var ret string - return ret - } - return *o.IndexId -} - -// GetIndexIdOk returns a tuple with the IndexId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexHour) GetIndexIdOk() (*string, bool) { - if o == nil || o.IndexId == nil { - return nil, false - } - return o.IndexId, true -} - -// HasIndexId returns a boolean if a field has been set. -func (o *UsageLogsByIndexHour) HasIndexId() bool { - if o != nil && o.IndexId != nil { - return true - } - - return false -} - -// SetIndexId gets a reference to the given string and assigns it to the IndexId field. -func (o *UsageLogsByIndexHour) SetIndexId(v string) { - o.IndexId = &v -} - -// GetIndexName returns the IndexName field value if set, zero value otherwise. -func (o *UsageLogsByIndexHour) GetIndexName() string { - if o == nil || o.IndexName == nil { - var ret string - return ret - } - return *o.IndexName -} - -// GetIndexNameOk returns a tuple with the IndexName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexHour) GetIndexNameOk() (*string, bool) { - if o == nil || o.IndexName == nil { - return nil, false - } - return o.IndexName, true -} - -// HasIndexName returns a boolean if a field has been set. -func (o *UsageLogsByIndexHour) HasIndexName() bool { - if o != nil && o.IndexName != nil { - return true - } - - return false -} - -// SetIndexName gets a reference to the given string and assigns it to the IndexName field. -func (o *UsageLogsByIndexHour) SetIndexName(v string) { - o.IndexName = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageLogsByIndexHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageLogsByIndexHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageLogsByIndexHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageLogsByIndexHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageLogsByIndexHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageLogsByIndexHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetRetention returns the Retention field value if set, zero value otherwise. -func (o *UsageLogsByIndexHour) GetRetention() int64 { - if o == nil || o.Retention == nil { - var ret int64 - return ret - } - return *o.Retention -} - -// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexHour) GetRetentionOk() (*int64, bool) { - if o == nil || o.Retention == nil { - return nil, false - } - return o.Retention, true -} - -// HasRetention returns a boolean if a field has been set. -func (o *UsageLogsByIndexHour) HasRetention() bool { - if o != nil && o.Retention != nil { - return true - } - - return false -} - -// SetRetention gets a reference to the given int64 and assigns it to the Retention field. -func (o *UsageLogsByIndexHour) SetRetention(v int64) { - o.Retention = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLogsByIndexHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.EventCount != nil { - toSerialize["event_count"] = o.EventCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.IndexId != nil { - toSerialize["index_id"] = o.IndexId - } - if o.IndexName != nil { - toSerialize["index_name"] = o.IndexName - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Retention != nil { - toSerialize["retention"] = o.Retention - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLogsByIndexHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - EventCount *int64 `json:"event_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - IndexId *string `json:"index_id,omitempty"` - IndexName *string `json:"index_name,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - Retention *int64 `json:"retention,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.EventCount = all.EventCount - o.Hour = all.Hour - o.IndexId = all.IndexId - o.IndexName = all.IndexName - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.Retention = all.Retention - return nil -} diff --git a/api/v1/datadog/model_usage_logs_by_index_response.go b/api/v1/datadog/model_usage_logs_by_index_response.go deleted file mode 100644 index e4ecb06f76a..00000000000 --- a/api/v1/datadog/model_usage_logs_by_index_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageLogsByIndexResponse Response containing the number of indexed logs for each hour and index for a given organization. -type UsageLogsByIndexResponse struct { - // An array of objects regarding hourly usage of logs by index response. - Usage []UsageLogsByIndexHour `json:"usage,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{} -} - -// NewUsageLogsByIndexResponse instantiates a new UsageLogsByIndexResponse 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 NewUsageLogsByIndexResponse() *UsageLogsByIndexResponse { - this := UsageLogsByIndexResponse{} - return &this -} - -// NewUsageLogsByIndexResponseWithDefaults instantiates a new UsageLogsByIndexResponse 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 NewUsageLogsByIndexResponseWithDefaults() *UsageLogsByIndexResponse { - this := UsageLogsByIndexResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageLogsByIndexResponse) GetUsage() []UsageLogsByIndexHour { - if o == nil || o.Usage == nil { - var ret []UsageLogsByIndexHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByIndexResponse) GetUsageOk() (*[]UsageLogsByIndexHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageLogsByIndexResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageLogsByIndexHour and assigns it to the Usage field. -func (o *UsageLogsByIndexResponse) SetUsage(v []UsageLogsByIndexHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLogsByIndexResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLogsByIndexResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageLogsByIndexHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_logs_by_retention_hour.go b/api/v1/datadog/model_usage_logs_by_retention_hour.go deleted file mode 100644 index 5d556073b5a..00000000000 --- a/api/v1/datadog/model_usage_logs_by_retention_hour.go +++ /dev/null @@ -1,297 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageLogsByRetentionHour The number of indexed logs for each hour for a given organization broken down by retention period. -type UsageLogsByRetentionHour struct { - // Total logs indexed with this retention period during a given hour. - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - // Live logs indexed with this retention period during a given hour. - LiveIndexedEventsCount *int64 `json:"live_indexed_events_count,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // Rehydrated logs indexed with this retention period during a given hour. - RehydratedIndexedEventsCount *int64 `json:"rehydrated_indexed_events_count,omitempty"` - // The retention period in days or "custom" for all custom retention usage. - Retention *string `json:"retention,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{} -} - -// NewUsageLogsByRetentionHour instantiates a new UsageLogsByRetentionHour 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 NewUsageLogsByRetentionHour() *UsageLogsByRetentionHour { - this := UsageLogsByRetentionHour{} - return &this -} - -// NewUsageLogsByRetentionHourWithDefaults instantiates a new UsageLogsByRetentionHour 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 NewUsageLogsByRetentionHourWithDefaults() *UsageLogsByRetentionHour { - this := UsageLogsByRetentionHour{} - return &this -} - -// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. -func (o *UsageLogsByRetentionHour) GetIndexedEventsCount() int64 { - if o == nil || o.IndexedEventsCount == nil { - var ret int64 - return ret - } - return *o.IndexedEventsCount -} - -// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByRetentionHour) GetIndexedEventsCountOk() (*int64, bool) { - if o == nil || o.IndexedEventsCount == nil { - return nil, false - } - return o.IndexedEventsCount, true -} - -// HasIndexedEventsCount returns a boolean if a field has been set. -func (o *UsageLogsByRetentionHour) HasIndexedEventsCount() bool { - if o != nil && o.IndexedEventsCount != nil { - return true - } - - return false -} - -// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. -func (o *UsageLogsByRetentionHour) SetIndexedEventsCount(v int64) { - o.IndexedEventsCount = &v -} - -// GetLiveIndexedEventsCount returns the LiveIndexedEventsCount field value if set, zero value otherwise. -func (o *UsageLogsByRetentionHour) GetLiveIndexedEventsCount() int64 { - if o == nil || o.LiveIndexedEventsCount == nil { - var ret int64 - return ret - } - return *o.LiveIndexedEventsCount -} - -// GetLiveIndexedEventsCountOk returns a tuple with the LiveIndexedEventsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByRetentionHour) GetLiveIndexedEventsCountOk() (*int64, bool) { - if o == nil || o.LiveIndexedEventsCount == nil { - return nil, false - } - return o.LiveIndexedEventsCount, true -} - -// HasLiveIndexedEventsCount returns a boolean if a field has been set. -func (o *UsageLogsByRetentionHour) HasLiveIndexedEventsCount() bool { - if o != nil && o.LiveIndexedEventsCount != nil { - return true - } - - return false -} - -// SetLiveIndexedEventsCount gets a reference to the given int64 and assigns it to the LiveIndexedEventsCount field. -func (o *UsageLogsByRetentionHour) SetLiveIndexedEventsCount(v int64) { - o.LiveIndexedEventsCount = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageLogsByRetentionHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByRetentionHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageLogsByRetentionHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageLogsByRetentionHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageLogsByRetentionHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByRetentionHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageLogsByRetentionHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageLogsByRetentionHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetRehydratedIndexedEventsCount returns the RehydratedIndexedEventsCount field value if set, zero value otherwise. -func (o *UsageLogsByRetentionHour) GetRehydratedIndexedEventsCount() int64 { - if o == nil || o.RehydratedIndexedEventsCount == nil { - var ret int64 - return ret - } - return *o.RehydratedIndexedEventsCount -} - -// GetRehydratedIndexedEventsCountOk returns a tuple with the RehydratedIndexedEventsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByRetentionHour) GetRehydratedIndexedEventsCountOk() (*int64, bool) { - if o == nil || o.RehydratedIndexedEventsCount == nil { - return nil, false - } - return o.RehydratedIndexedEventsCount, true -} - -// HasRehydratedIndexedEventsCount returns a boolean if a field has been set. -func (o *UsageLogsByRetentionHour) HasRehydratedIndexedEventsCount() bool { - if o != nil && o.RehydratedIndexedEventsCount != nil { - return true - } - - return false -} - -// SetRehydratedIndexedEventsCount gets a reference to the given int64 and assigns it to the RehydratedIndexedEventsCount field. -func (o *UsageLogsByRetentionHour) SetRehydratedIndexedEventsCount(v int64) { - o.RehydratedIndexedEventsCount = &v -} - -// GetRetention returns the Retention field value if set, zero value otherwise. -func (o *UsageLogsByRetentionHour) GetRetention() string { - if o == nil || o.Retention == nil { - var ret string - return ret - } - return *o.Retention -} - -// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByRetentionHour) GetRetentionOk() (*string, bool) { - if o == nil || o.Retention == nil { - return nil, false - } - return o.Retention, true -} - -// HasRetention returns a boolean if a field has been set. -func (o *UsageLogsByRetentionHour) HasRetention() bool { - if o != nil && o.Retention != nil { - return true - } - - return false -} - -// SetRetention gets a reference to the given string and assigns it to the Retention field. -func (o *UsageLogsByRetentionHour) SetRetention(v string) { - o.Retention = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLogsByRetentionHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IndexedEventsCount != nil { - toSerialize["indexed_events_count"] = o.IndexedEventsCount - } - if o.LiveIndexedEventsCount != nil { - toSerialize["live_indexed_events_count"] = o.LiveIndexedEventsCount - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.RehydratedIndexedEventsCount != nil { - toSerialize["rehydrated_indexed_events_count"] = o.RehydratedIndexedEventsCount - } - if o.Retention != nil { - toSerialize["retention"] = o.Retention - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLogsByRetentionHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - LiveIndexedEventsCount *int64 `json:"live_indexed_events_count,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - RehydratedIndexedEventsCount *int64 `json:"rehydrated_indexed_events_count,omitempty"` - Retention *string `json:"retention,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IndexedEventsCount = all.IndexedEventsCount - o.LiveIndexedEventsCount = all.LiveIndexedEventsCount - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.RehydratedIndexedEventsCount = all.RehydratedIndexedEventsCount - o.Retention = all.Retention - return nil -} diff --git a/api/v1/datadog/model_usage_logs_by_retention_response.go b/api/v1/datadog/model_usage_logs_by_retention_response.go deleted file mode 100644 index 42ab5bd6afc..00000000000 --- a/api/v1/datadog/model_usage_logs_by_retention_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageLogsByRetentionResponse Response containing the indexed logs usage broken down by retention period for an organization during a given hour. -type UsageLogsByRetentionResponse struct { - // Get hourly usage for indexed logs by retention period. - Usage []UsageLogsByRetentionHour `json:"usage,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{} -} - -// NewUsageLogsByRetentionResponse instantiates a new UsageLogsByRetentionResponse 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 NewUsageLogsByRetentionResponse() *UsageLogsByRetentionResponse { - this := UsageLogsByRetentionResponse{} - return &this -} - -// NewUsageLogsByRetentionResponseWithDefaults instantiates a new UsageLogsByRetentionResponse 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 NewUsageLogsByRetentionResponseWithDefaults() *UsageLogsByRetentionResponse { - this := UsageLogsByRetentionResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageLogsByRetentionResponse) GetUsage() []UsageLogsByRetentionHour { - if o == nil || o.Usage == nil { - var ret []UsageLogsByRetentionHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsByRetentionResponse) GetUsageOk() (*[]UsageLogsByRetentionHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageLogsByRetentionResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageLogsByRetentionHour and assigns it to the Usage field. -func (o *UsageLogsByRetentionResponse) SetUsage(v []UsageLogsByRetentionHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLogsByRetentionResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLogsByRetentionResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageLogsByRetentionHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_logs_hour.go b/api/v1/datadog/model_usage_logs_hour.go deleted file mode 100644 index bb86af1cf7c..00000000000 --- a/api/v1/datadog/model_usage_logs_hour.go +++ /dev/null @@ -1,458 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageLogsHour Hour usage for logs. -type UsageLogsHour struct { - // Contains the number of billable log bytes ingested. - BillableIngestedBytes *int64 `json:"billable_ingested_bytes,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the number of log events indexed. - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - // Contains the number of log bytes ingested. - IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` - // Contains the number of live log events indexed (data available as of December 1, 2020). - LogsLiveIndexedCount *int64 `json:"logs_live_indexed_count,omitempty"` - // Contains the number of live log bytes ingested (data available as of December 1, 2020). - LogsLiveIngestedBytes *int64 `json:"logs_live_ingested_bytes,omitempty"` - // Contains the number of rehydrated log events indexed (data available as of December 1, 2020). - LogsRehydratedIndexedCount *int64 `json:"logs_rehydrated_indexed_count,omitempty"` - // Contains the number of rehydrated log bytes ingested (data available as of December 1, 2020). - LogsRehydratedIngestedBytes *int64 `json:"logs_rehydrated_ingested_bytes,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageLogsHour instantiates a new UsageLogsHour 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 NewUsageLogsHour() *UsageLogsHour { - this := UsageLogsHour{} - return &this -} - -// NewUsageLogsHourWithDefaults instantiates a new UsageLogsHour 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 NewUsageLogsHourWithDefaults() *UsageLogsHour { - this := UsageLogsHour{} - return &this -} - -// GetBillableIngestedBytes returns the BillableIngestedBytes field value if set, zero value otherwise. -func (o *UsageLogsHour) GetBillableIngestedBytes() int64 { - if o == nil || o.BillableIngestedBytes == nil { - var ret int64 - return ret - } - return *o.BillableIngestedBytes -} - -// GetBillableIngestedBytesOk returns a tuple with the BillableIngestedBytes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetBillableIngestedBytesOk() (*int64, bool) { - if o == nil || o.BillableIngestedBytes == nil { - return nil, false - } - return o.BillableIngestedBytes, true -} - -// HasBillableIngestedBytes returns a boolean if a field has been set. -func (o *UsageLogsHour) HasBillableIngestedBytes() bool { - if o != nil && o.BillableIngestedBytes != nil { - return true - } - - return false -} - -// SetBillableIngestedBytes gets a reference to the given int64 and assigns it to the BillableIngestedBytes field. -func (o *UsageLogsHour) SetBillableIngestedBytes(v int64) { - o.BillableIngestedBytes = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageLogsHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageLogsHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageLogsHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. -func (o *UsageLogsHour) GetIndexedEventsCount() int64 { - if o == nil || o.IndexedEventsCount == nil { - var ret int64 - return ret - } - return *o.IndexedEventsCount -} - -// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetIndexedEventsCountOk() (*int64, bool) { - if o == nil || o.IndexedEventsCount == nil { - return nil, false - } - return o.IndexedEventsCount, true -} - -// HasIndexedEventsCount returns a boolean if a field has been set. -func (o *UsageLogsHour) HasIndexedEventsCount() bool { - if o != nil && o.IndexedEventsCount != nil { - return true - } - - return false -} - -// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. -func (o *UsageLogsHour) SetIndexedEventsCount(v int64) { - o.IndexedEventsCount = &v -} - -// GetIngestedEventsBytes returns the IngestedEventsBytes field value if set, zero value otherwise. -func (o *UsageLogsHour) GetIngestedEventsBytes() int64 { - if o == nil || o.IngestedEventsBytes == nil { - var ret int64 - return ret - } - return *o.IngestedEventsBytes -} - -// GetIngestedEventsBytesOk returns a tuple with the IngestedEventsBytes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetIngestedEventsBytesOk() (*int64, bool) { - if o == nil || o.IngestedEventsBytes == nil { - return nil, false - } - return o.IngestedEventsBytes, true -} - -// HasIngestedEventsBytes returns a boolean if a field has been set. -func (o *UsageLogsHour) HasIngestedEventsBytes() bool { - if o != nil && o.IngestedEventsBytes != nil { - return true - } - - return false -} - -// SetIngestedEventsBytes gets a reference to the given int64 and assigns it to the IngestedEventsBytes field. -func (o *UsageLogsHour) SetIngestedEventsBytes(v int64) { - o.IngestedEventsBytes = &v -} - -// GetLogsLiveIndexedCount returns the LogsLiveIndexedCount field value if set, zero value otherwise. -func (o *UsageLogsHour) GetLogsLiveIndexedCount() int64 { - if o == nil || o.LogsLiveIndexedCount == nil { - var ret int64 - return ret - } - return *o.LogsLiveIndexedCount -} - -// GetLogsLiveIndexedCountOk returns a tuple with the LogsLiveIndexedCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetLogsLiveIndexedCountOk() (*int64, bool) { - if o == nil || o.LogsLiveIndexedCount == nil { - return nil, false - } - return o.LogsLiveIndexedCount, true -} - -// HasLogsLiveIndexedCount returns a boolean if a field has been set. -func (o *UsageLogsHour) HasLogsLiveIndexedCount() bool { - if o != nil && o.LogsLiveIndexedCount != nil { - return true - } - - return false -} - -// SetLogsLiveIndexedCount gets a reference to the given int64 and assigns it to the LogsLiveIndexedCount field. -func (o *UsageLogsHour) SetLogsLiveIndexedCount(v int64) { - o.LogsLiveIndexedCount = &v -} - -// GetLogsLiveIngestedBytes returns the LogsLiveIngestedBytes field value if set, zero value otherwise. -func (o *UsageLogsHour) GetLogsLiveIngestedBytes() int64 { - if o == nil || o.LogsLiveIngestedBytes == nil { - var ret int64 - return ret - } - return *o.LogsLiveIngestedBytes -} - -// GetLogsLiveIngestedBytesOk returns a tuple with the LogsLiveIngestedBytes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetLogsLiveIngestedBytesOk() (*int64, bool) { - if o == nil || o.LogsLiveIngestedBytes == nil { - return nil, false - } - return o.LogsLiveIngestedBytes, true -} - -// HasLogsLiveIngestedBytes returns a boolean if a field has been set. -func (o *UsageLogsHour) HasLogsLiveIngestedBytes() bool { - if o != nil && o.LogsLiveIngestedBytes != nil { - return true - } - - return false -} - -// SetLogsLiveIngestedBytes gets a reference to the given int64 and assigns it to the LogsLiveIngestedBytes field. -func (o *UsageLogsHour) SetLogsLiveIngestedBytes(v int64) { - o.LogsLiveIngestedBytes = &v -} - -// GetLogsRehydratedIndexedCount returns the LogsRehydratedIndexedCount field value if set, zero value otherwise. -func (o *UsageLogsHour) GetLogsRehydratedIndexedCount() int64 { - if o == nil || o.LogsRehydratedIndexedCount == nil { - var ret int64 - return ret - } - return *o.LogsRehydratedIndexedCount -} - -// GetLogsRehydratedIndexedCountOk returns a tuple with the LogsRehydratedIndexedCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetLogsRehydratedIndexedCountOk() (*int64, bool) { - if o == nil || o.LogsRehydratedIndexedCount == nil { - return nil, false - } - return o.LogsRehydratedIndexedCount, true -} - -// HasLogsRehydratedIndexedCount returns a boolean if a field has been set. -func (o *UsageLogsHour) HasLogsRehydratedIndexedCount() bool { - if o != nil && o.LogsRehydratedIndexedCount != nil { - return true - } - - return false -} - -// SetLogsRehydratedIndexedCount gets a reference to the given int64 and assigns it to the LogsRehydratedIndexedCount field. -func (o *UsageLogsHour) SetLogsRehydratedIndexedCount(v int64) { - o.LogsRehydratedIndexedCount = &v -} - -// GetLogsRehydratedIngestedBytes returns the LogsRehydratedIngestedBytes field value if set, zero value otherwise. -func (o *UsageLogsHour) GetLogsRehydratedIngestedBytes() int64 { - if o == nil || o.LogsRehydratedIngestedBytes == nil { - var ret int64 - return ret - } - return *o.LogsRehydratedIngestedBytes -} - -// GetLogsRehydratedIngestedBytesOk returns a tuple with the LogsRehydratedIngestedBytes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetLogsRehydratedIngestedBytesOk() (*int64, bool) { - if o == nil || o.LogsRehydratedIngestedBytes == nil { - return nil, false - } - return o.LogsRehydratedIngestedBytes, true -} - -// HasLogsRehydratedIngestedBytes returns a boolean if a field has been set. -func (o *UsageLogsHour) HasLogsRehydratedIngestedBytes() bool { - if o != nil && o.LogsRehydratedIngestedBytes != nil { - return true - } - - return false -} - -// SetLogsRehydratedIngestedBytes gets a reference to the given int64 and assigns it to the LogsRehydratedIngestedBytes field. -func (o *UsageLogsHour) SetLogsRehydratedIngestedBytes(v int64) { - o.LogsRehydratedIngestedBytes = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageLogsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageLogsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageLogsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageLogsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageLogsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageLogsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLogsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BillableIngestedBytes != nil { - toSerialize["billable_ingested_bytes"] = o.BillableIngestedBytes - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.IndexedEventsCount != nil { - toSerialize["indexed_events_count"] = o.IndexedEventsCount - } - if o.IngestedEventsBytes != nil { - toSerialize["ingested_events_bytes"] = o.IngestedEventsBytes - } - if o.LogsLiveIndexedCount != nil { - toSerialize["logs_live_indexed_count"] = o.LogsLiveIndexedCount - } - if o.LogsLiveIngestedBytes != nil { - toSerialize["logs_live_ingested_bytes"] = o.LogsLiveIngestedBytes - } - if o.LogsRehydratedIndexedCount != nil { - toSerialize["logs_rehydrated_indexed_count"] = o.LogsRehydratedIndexedCount - } - if o.LogsRehydratedIngestedBytes != nil { - toSerialize["logs_rehydrated_ingested_bytes"] = o.LogsRehydratedIngestedBytes - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLogsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BillableIngestedBytes *int64 `json:"billable_ingested_bytes,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` - LogsLiveIndexedCount *int64 `json:"logs_live_indexed_count,omitempty"` - LogsLiveIngestedBytes *int64 `json:"logs_live_ingested_bytes,omitempty"` - LogsRehydratedIndexedCount *int64 `json:"logs_rehydrated_indexed_count,omitempty"` - LogsRehydratedIngestedBytes *int64 `json:"logs_rehydrated_ingested_bytes,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BillableIngestedBytes = all.BillableIngestedBytes - o.Hour = all.Hour - o.IndexedEventsCount = all.IndexedEventsCount - o.IngestedEventsBytes = all.IngestedEventsBytes - o.LogsLiveIndexedCount = all.LogsLiveIndexedCount - o.LogsLiveIngestedBytes = all.LogsLiveIngestedBytes - o.LogsRehydratedIndexedCount = all.LogsRehydratedIndexedCount - o.LogsRehydratedIngestedBytes = all.LogsRehydratedIngestedBytes - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_logs_response.go b/api/v1/datadog/model_usage_logs_response.go deleted file mode 100644 index 3262eec27cf..00000000000 --- a/api/v1/datadog/model_usage_logs_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageLogsResponse Response containing the number of logs for each hour. -type UsageLogsResponse struct { - // An array of objects regarding hourly usage of logs. - Usage []UsageLogsHour `json:"usage,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{} -} - -// NewUsageLogsResponse instantiates a new UsageLogsResponse 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 NewUsageLogsResponse() *UsageLogsResponse { - this := UsageLogsResponse{} - return &this -} - -// NewUsageLogsResponseWithDefaults instantiates a new UsageLogsResponse 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 NewUsageLogsResponseWithDefaults() *UsageLogsResponse { - this := UsageLogsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageLogsResponse) GetUsage() []UsageLogsHour { - if o == nil || o.Usage == nil { - var ret []UsageLogsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLogsResponse) GetUsageOk() (*[]UsageLogsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageLogsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageLogsHour and assigns it to the Usage field. -func (o *UsageLogsResponse) SetUsage(v []UsageLogsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLogsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLogsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageLogsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_metric_category.go b/api/v1/datadog/model_usage_metric_category.go deleted file mode 100644 index 3f122e0671d..00000000000 --- a/api/v1/datadog/model_usage_metric_category.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsageMetricCategory Contains the metric category. -type UsageMetricCategory string - -// List of UsageMetricCategory. -const ( - USAGEMETRICCATEGORY_STANDARD UsageMetricCategory = "standard" - USAGEMETRICCATEGORY_CUSTOM UsageMetricCategory = "custom" -) - -var allowedUsageMetricCategoryEnumValues = []UsageMetricCategory{ - USAGEMETRICCATEGORY_STANDARD, - USAGEMETRICCATEGORY_CUSTOM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsageMetricCategory) GetAllowedValues() []UsageMetricCategory { - return allowedUsageMetricCategoryEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsageMetricCategory) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsageMetricCategory(value) - return nil -} - -// NewUsageMetricCategoryFromValue returns a pointer to a valid UsageMetricCategory -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsageMetricCategoryFromValue(v string) (*UsageMetricCategory, error) { - ev := UsageMetricCategory(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsageMetricCategory: valid values are %v", v, allowedUsageMetricCategoryEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsageMetricCategory) IsValid() bool { - for _, existing := range allowedUsageMetricCategoryEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsageMetricCategory value. -func (v UsageMetricCategory) Ptr() *UsageMetricCategory { - return &v -} - -// NullableUsageMetricCategory handles when a null is used for UsageMetricCategory. -type NullableUsageMetricCategory struct { - value *UsageMetricCategory - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageMetricCategory) Get() *UsageMetricCategory { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageMetricCategory) Set(val *UsageMetricCategory) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageMetricCategory) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageMetricCategory) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageMetricCategory initializes the struct as if Set has been called. -func NewNullableUsageMetricCategory(val *UsageMetricCategory) *NullableUsageMetricCategory { - return &NullableUsageMetricCategory{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageMetricCategory) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageMetricCategory) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_usage_network_flows_hour.go b/api/v1/datadog/model_usage_network_flows_hour.go deleted file mode 100644 index 9491b4e1678..00000000000 --- a/api/v1/datadog/model_usage_network_flows_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageNetworkFlowsHour Number of netflow events indexed for each hour for a given organization. -type UsageNetworkFlowsHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the number of netflow events indexed. - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageNetworkFlowsHour instantiates a new UsageNetworkFlowsHour 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 NewUsageNetworkFlowsHour() *UsageNetworkFlowsHour { - this := UsageNetworkFlowsHour{} - return &this -} - -// NewUsageNetworkFlowsHourWithDefaults instantiates a new UsageNetworkFlowsHour 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 NewUsageNetworkFlowsHourWithDefaults() *UsageNetworkFlowsHour { - this := UsageNetworkFlowsHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageNetworkFlowsHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkFlowsHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageNetworkFlowsHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageNetworkFlowsHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. -func (o *UsageNetworkFlowsHour) GetIndexedEventsCount() int64 { - if o == nil || o.IndexedEventsCount == nil { - var ret int64 - return ret - } - return *o.IndexedEventsCount -} - -// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkFlowsHour) GetIndexedEventsCountOk() (*int64, bool) { - if o == nil || o.IndexedEventsCount == nil { - return nil, false - } - return o.IndexedEventsCount, true -} - -// HasIndexedEventsCount returns a boolean if a field has been set. -func (o *UsageNetworkFlowsHour) HasIndexedEventsCount() bool { - if o != nil && o.IndexedEventsCount != nil { - return true - } - - return false -} - -// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. -func (o *UsageNetworkFlowsHour) SetIndexedEventsCount(v int64) { - o.IndexedEventsCount = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageNetworkFlowsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkFlowsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageNetworkFlowsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageNetworkFlowsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageNetworkFlowsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkFlowsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageNetworkFlowsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageNetworkFlowsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageNetworkFlowsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.IndexedEventsCount != nil { - toSerialize["indexed_events_count"] = o.IndexedEventsCount - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageNetworkFlowsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.IndexedEventsCount = all.IndexedEventsCount - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_network_flows_response.go b/api/v1/datadog/model_usage_network_flows_response.go deleted file mode 100644 index 463d5fd8e95..00000000000 --- a/api/v1/datadog/model_usage_network_flows_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageNetworkFlowsResponse Response containing the number of netflow events indexed for each hour for a given organization. -type UsageNetworkFlowsResponse struct { - // Get hourly usage for Network Flows. - Usage []UsageNetworkFlowsHour `json:"usage,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{} -} - -// NewUsageNetworkFlowsResponse instantiates a new UsageNetworkFlowsResponse 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 NewUsageNetworkFlowsResponse() *UsageNetworkFlowsResponse { - this := UsageNetworkFlowsResponse{} - return &this -} - -// NewUsageNetworkFlowsResponseWithDefaults instantiates a new UsageNetworkFlowsResponse 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 NewUsageNetworkFlowsResponseWithDefaults() *UsageNetworkFlowsResponse { - this := UsageNetworkFlowsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageNetworkFlowsResponse) GetUsage() []UsageNetworkFlowsHour { - if o == nil || o.Usage == nil { - var ret []UsageNetworkFlowsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkFlowsResponse) GetUsageOk() (*[]UsageNetworkFlowsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageNetworkFlowsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageNetworkFlowsHour and assigns it to the Usage field. -func (o *UsageNetworkFlowsResponse) SetUsage(v []UsageNetworkFlowsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageNetworkFlowsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageNetworkFlowsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageNetworkFlowsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_network_hosts_hour.go b/api/v1/datadog/model_usage_network_hosts_hour.go deleted file mode 100644 index e79ed7f5eb0..00000000000 --- a/api/v1/datadog/model_usage_network_hosts_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageNetworkHostsHour Number of active NPM hosts for each hour for a given organization. -type UsageNetworkHostsHour struct { - // Contains the number of active NPM hosts. - HostCount *int64 `json:"host_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageNetworkHostsHour instantiates a new UsageNetworkHostsHour 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 NewUsageNetworkHostsHour() *UsageNetworkHostsHour { - this := UsageNetworkHostsHour{} - return &this -} - -// NewUsageNetworkHostsHourWithDefaults instantiates a new UsageNetworkHostsHour 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 NewUsageNetworkHostsHourWithDefaults() *UsageNetworkHostsHour { - this := UsageNetworkHostsHour{} - return &this -} - -// GetHostCount returns the HostCount field value if set, zero value otherwise. -func (o *UsageNetworkHostsHour) GetHostCount() int64 { - if o == nil || o.HostCount == nil { - var ret int64 - return ret - } - return *o.HostCount -} - -// GetHostCountOk returns a tuple with the HostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkHostsHour) GetHostCountOk() (*int64, bool) { - if o == nil || o.HostCount == nil { - return nil, false - } - return o.HostCount, true -} - -// HasHostCount returns a boolean if a field has been set. -func (o *UsageNetworkHostsHour) HasHostCount() bool { - if o != nil && o.HostCount != nil { - return true - } - - return false -} - -// SetHostCount gets a reference to the given int64 and assigns it to the HostCount field. -func (o *UsageNetworkHostsHour) SetHostCount(v int64) { - o.HostCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageNetworkHostsHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkHostsHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageNetworkHostsHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageNetworkHostsHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageNetworkHostsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkHostsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageNetworkHostsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageNetworkHostsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageNetworkHostsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkHostsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageNetworkHostsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageNetworkHostsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageNetworkHostsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.HostCount != nil { - toSerialize["host_count"] = o.HostCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageNetworkHostsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - HostCount *int64 `json:"host_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.HostCount = all.HostCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_network_hosts_response.go b/api/v1/datadog/model_usage_network_hosts_response.go deleted file mode 100644 index fe2919bc8a8..00000000000 --- a/api/v1/datadog/model_usage_network_hosts_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageNetworkHostsResponse Response containing the number of active NPM hosts for each hour for a given organization. -type UsageNetworkHostsResponse struct { - // Get hourly usage for NPM hosts. - Usage []UsageNetworkHostsHour `json:"usage,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{} -} - -// NewUsageNetworkHostsResponse instantiates a new UsageNetworkHostsResponse 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 NewUsageNetworkHostsResponse() *UsageNetworkHostsResponse { - this := UsageNetworkHostsResponse{} - return &this -} - -// NewUsageNetworkHostsResponseWithDefaults instantiates a new UsageNetworkHostsResponse 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 NewUsageNetworkHostsResponseWithDefaults() *UsageNetworkHostsResponse { - this := UsageNetworkHostsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageNetworkHostsResponse) GetUsage() []UsageNetworkHostsHour { - if o == nil || o.Usage == nil { - var ret []UsageNetworkHostsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageNetworkHostsResponse) GetUsageOk() (*[]UsageNetworkHostsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageNetworkHostsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageNetworkHostsHour and assigns it to the Usage field. -func (o *UsageNetworkHostsResponse) SetUsage(v []UsageNetworkHostsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageNetworkHostsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageNetworkHostsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageNetworkHostsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_online_archive_hour.go b/api/v1/datadog/model_usage_online_archive_hour.go deleted file mode 100644 index 5849b8578ae..00000000000 --- a/api/v1/datadog/model_usage_online_archive_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageOnlineArchiveHour Online Archive usage in a given hour. -type UsageOnlineArchiveHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Total count of online archived events within the hour. - OnlineArchiveEventsCount *int32 `json:"online_archive_events_count,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageOnlineArchiveHour instantiates a new UsageOnlineArchiveHour 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 NewUsageOnlineArchiveHour() *UsageOnlineArchiveHour { - this := UsageOnlineArchiveHour{} - return &this -} - -// NewUsageOnlineArchiveHourWithDefaults instantiates a new UsageOnlineArchiveHour 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 NewUsageOnlineArchiveHourWithDefaults() *UsageOnlineArchiveHour { - this := UsageOnlineArchiveHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageOnlineArchiveHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageOnlineArchiveHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageOnlineArchiveHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageOnlineArchiveHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOnlineArchiveEventsCount returns the OnlineArchiveEventsCount field value if set, zero value otherwise. -func (o *UsageOnlineArchiveHour) GetOnlineArchiveEventsCount() int32 { - if o == nil || o.OnlineArchiveEventsCount == nil { - var ret int32 - return ret - } - return *o.OnlineArchiveEventsCount -} - -// GetOnlineArchiveEventsCountOk returns a tuple with the OnlineArchiveEventsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageOnlineArchiveHour) GetOnlineArchiveEventsCountOk() (*int32, bool) { - if o == nil || o.OnlineArchiveEventsCount == nil { - return nil, false - } - return o.OnlineArchiveEventsCount, true -} - -// HasOnlineArchiveEventsCount returns a boolean if a field has been set. -func (o *UsageOnlineArchiveHour) HasOnlineArchiveEventsCount() bool { - if o != nil && o.OnlineArchiveEventsCount != nil { - return true - } - - return false -} - -// SetOnlineArchiveEventsCount gets a reference to the given int32 and assigns it to the OnlineArchiveEventsCount field. -func (o *UsageOnlineArchiveHour) SetOnlineArchiveEventsCount(v int32) { - o.OnlineArchiveEventsCount = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageOnlineArchiveHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageOnlineArchiveHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageOnlineArchiveHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageOnlineArchiveHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageOnlineArchiveHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageOnlineArchiveHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageOnlineArchiveHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageOnlineArchiveHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageOnlineArchiveHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OnlineArchiveEventsCount != nil { - toSerialize["online_archive_events_count"] = o.OnlineArchiveEventsCount - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageOnlineArchiveHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - OnlineArchiveEventsCount *int32 `json:"online_archive_events_count,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.OnlineArchiveEventsCount = all.OnlineArchiveEventsCount - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_online_archive_response.go b/api/v1/datadog/model_usage_online_archive_response.go deleted file mode 100644 index b0ff2a22c7d..00000000000 --- a/api/v1/datadog/model_usage_online_archive_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageOnlineArchiveResponse Online Archive usage response. -type UsageOnlineArchiveResponse struct { - // Response containing Online Archive usage. - Usage []UsageOnlineArchiveHour `json:"usage,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{} -} - -// NewUsageOnlineArchiveResponse instantiates a new UsageOnlineArchiveResponse 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 NewUsageOnlineArchiveResponse() *UsageOnlineArchiveResponse { - this := UsageOnlineArchiveResponse{} - return &this -} - -// NewUsageOnlineArchiveResponseWithDefaults instantiates a new UsageOnlineArchiveResponse 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 NewUsageOnlineArchiveResponseWithDefaults() *UsageOnlineArchiveResponse { - this := UsageOnlineArchiveResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageOnlineArchiveResponse) GetUsage() []UsageOnlineArchiveHour { - if o == nil || o.Usage == nil { - var ret []UsageOnlineArchiveHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageOnlineArchiveResponse) GetUsageOk() (*[]UsageOnlineArchiveHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageOnlineArchiveResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageOnlineArchiveHour and assigns it to the Usage field. -func (o *UsageOnlineArchiveResponse) SetUsage(v []UsageOnlineArchiveHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageOnlineArchiveResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageOnlineArchiveResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageOnlineArchiveHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_profiling_hour.go b/api/v1/datadog/model_usage_profiling_hour.go deleted file mode 100644 index 684540c0ce1..00000000000 --- a/api/v1/datadog/model_usage_profiling_hour.go +++ /dev/null @@ -1,263 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageProfilingHour The number of profiled hosts for each hour for a given organization. -type UsageProfilingHour struct { - // Get average number of container agents for that hour. - AvgContainerAgentCount *int64 `json:"avg_container_agent_count,omitempty"` - // Contains the total number of profiled hosts reporting during a given hour. - HostCount *int64 `json:"host_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageProfilingHour instantiates a new UsageProfilingHour 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 NewUsageProfilingHour() *UsageProfilingHour { - this := UsageProfilingHour{} - return &this -} - -// NewUsageProfilingHourWithDefaults instantiates a new UsageProfilingHour 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 NewUsageProfilingHourWithDefaults() *UsageProfilingHour { - this := UsageProfilingHour{} - return &this -} - -// GetAvgContainerAgentCount returns the AvgContainerAgentCount field value if set, zero value otherwise. -func (o *UsageProfilingHour) GetAvgContainerAgentCount() int64 { - if o == nil || o.AvgContainerAgentCount == nil { - var ret int64 - return ret - } - return *o.AvgContainerAgentCount -} - -// GetAvgContainerAgentCountOk returns a tuple with the AvgContainerAgentCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageProfilingHour) GetAvgContainerAgentCountOk() (*int64, bool) { - if o == nil || o.AvgContainerAgentCount == nil { - return nil, false - } - return o.AvgContainerAgentCount, true -} - -// HasAvgContainerAgentCount returns a boolean if a field has been set. -func (o *UsageProfilingHour) HasAvgContainerAgentCount() bool { - if o != nil && o.AvgContainerAgentCount != nil { - return true - } - - return false -} - -// SetAvgContainerAgentCount gets a reference to the given int64 and assigns it to the AvgContainerAgentCount field. -func (o *UsageProfilingHour) SetAvgContainerAgentCount(v int64) { - o.AvgContainerAgentCount = &v -} - -// GetHostCount returns the HostCount field value if set, zero value otherwise. -func (o *UsageProfilingHour) GetHostCount() int64 { - if o == nil || o.HostCount == nil { - var ret int64 - return ret - } - return *o.HostCount -} - -// GetHostCountOk returns a tuple with the HostCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageProfilingHour) GetHostCountOk() (*int64, bool) { - if o == nil || o.HostCount == nil { - return nil, false - } - return o.HostCount, true -} - -// HasHostCount returns a boolean if a field has been set. -func (o *UsageProfilingHour) HasHostCount() bool { - if o != nil && o.HostCount != nil { - return true - } - - return false -} - -// SetHostCount gets a reference to the given int64 and assigns it to the HostCount field. -func (o *UsageProfilingHour) SetHostCount(v int64) { - o.HostCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageProfilingHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageProfilingHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageProfilingHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageProfilingHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageProfilingHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageProfilingHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageProfilingHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageProfilingHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageProfilingHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageProfilingHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageProfilingHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageProfilingHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageProfilingHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AvgContainerAgentCount != nil { - toSerialize["avg_container_agent_count"] = o.AvgContainerAgentCount - } - if o.HostCount != nil { - toSerialize["host_count"] = o.HostCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageProfilingHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AvgContainerAgentCount *int64 `json:"avg_container_agent_count,omitempty"` - HostCount *int64 `json:"host_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AvgContainerAgentCount = all.AvgContainerAgentCount - o.HostCount = all.HostCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_profiling_response.go b/api/v1/datadog/model_usage_profiling_response.go deleted file mode 100644 index 4b909dde184..00000000000 --- a/api/v1/datadog/model_usage_profiling_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageProfilingResponse Response containing the number of profiled hosts for each hour for a given organization. -type UsageProfilingResponse struct { - // Get hourly usage for profiled hosts. - Usage []UsageProfilingHour `json:"usage,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{} -} - -// NewUsageProfilingResponse instantiates a new UsageProfilingResponse 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 NewUsageProfilingResponse() *UsageProfilingResponse { - this := UsageProfilingResponse{} - return &this -} - -// NewUsageProfilingResponseWithDefaults instantiates a new UsageProfilingResponse 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 NewUsageProfilingResponseWithDefaults() *UsageProfilingResponse { - this := UsageProfilingResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageProfilingResponse) GetUsage() []UsageProfilingHour { - if o == nil || o.Usage == nil { - var ret []UsageProfilingHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageProfilingResponse) GetUsageOk() (*[]UsageProfilingHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageProfilingResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageProfilingHour and assigns it to the Usage field. -func (o *UsageProfilingResponse) SetUsage(v []UsageProfilingHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageProfilingResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageProfilingResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageProfilingHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_reports_type.go b/api/v1/datadog/model_usage_reports_type.go deleted file mode 100644 index ff5040d04fa..00000000000 --- a/api/v1/datadog/model_usage_reports_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsageReportsType The type of reports. -type UsageReportsType string - -// List of UsageReportsType. -const ( - USAGEREPORTSTYPE_REPORTS UsageReportsType = "reports" -) - -var allowedUsageReportsTypeEnumValues = []UsageReportsType{ - USAGEREPORTSTYPE_REPORTS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsageReportsType) GetAllowedValues() []UsageReportsType { - return allowedUsageReportsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsageReportsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsageReportsType(value) - return nil -} - -// NewUsageReportsTypeFromValue returns a pointer to a valid UsageReportsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsageReportsTypeFromValue(v string) (*UsageReportsType, error) { - ev := UsageReportsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsageReportsType: valid values are %v", v, allowedUsageReportsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsageReportsType) IsValid() bool { - for _, existing := range allowedUsageReportsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsageReportsType value. -func (v UsageReportsType) Ptr() *UsageReportsType { - return &v -} - -// NullableUsageReportsType handles when a null is used for UsageReportsType. -type NullableUsageReportsType struct { - value *UsageReportsType - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageReportsType) Get() *UsageReportsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageReportsType) Set(val *UsageReportsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageReportsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageReportsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageReportsType initializes the struct as if Set has been called. -func NewNullableUsageReportsType(val *UsageReportsType) *NullableUsageReportsType { - return &NullableUsageReportsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageReportsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageReportsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_usage_rum_sessions_hour.go b/api/v1/datadog/model_usage_rum_sessions_hour.go deleted file mode 100644 index 955b3ea24a2..00000000000 --- a/api/v1/datadog/model_usage_rum_sessions_hour.go +++ /dev/null @@ -1,426 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsageRumSessionsHour Number of RUM Sessions recorded for each hour for a given organization. -type UsageRumSessionsHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // Contains the number of RUM Replay Sessions (data available beginning November 1, 2021). - ReplaySessionCount *int64 `json:"replay_session_count,omitempty"` - // Contains the number of browser RUM Lite Sessions. - SessionCount common.NullableInt64 `json:"session_count,omitempty"` - // Contains the number of mobile RUM Sessions on Android (data available beginning December 1, 2020). - SessionCountAndroid common.NullableInt64 `json:"session_count_android,omitempty"` - // Contains the number of mobile RUM Sessions on iOS (data available beginning December 1, 2020). - SessionCountIos common.NullableInt64 `json:"session_count_ios,omitempty"` - // Contains the number of mobile RUM Sessions on React Native (data available beginning May 1, 2022). - SessionCountReactnative common.NullableInt64 `json:"session_count_reactnative,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{} -} - -// NewUsageRumSessionsHour instantiates a new UsageRumSessionsHour 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 NewUsageRumSessionsHour() *UsageRumSessionsHour { - this := UsageRumSessionsHour{} - return &this -} - -// NewUsageRumSessionsHourWithDefaults instantiates a new UsageRumSessionsHour 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 NewUsageRumSessionsHourWithDefaults() *UsageRumSessionsHour { - this := UsageRumSessionsHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageRumSessionsHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumSessionsHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageRumSessionsHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageRumSessionsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumSessionsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageRumSessionsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageRumSessionsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumSessionsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageRumSessionsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetReplaySessionCount returns the ReplaySessionCount field value if set, zero value otherwise. -func (o *UsageRumSessionsHour) GetReplaySessionCount() int64 { - if o == nil || o.ReplaySessionCount == nil { - var ret int64 - return ret - } - return *o.ReplaySessionCount -} - -// GetReplaySessionCountOk returns a tuple with the ReplaySessionCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumSessionsHour) GetReplaySessionCountOk() (*int64, bool) { - if o == nil || o.ReplaySessionCount == nil { - return nil, false - } - return o.ReplaySessionCount, true -} - -// HasReplaySessionCount returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasReplaySessionCount() bool { - if o != nil && o.ReplaySessionCount != nil { - return true - } - - return false -} - -// SetReplaySessionCount gets a reference to the given int64 and assigns it to the ReplaySessionCount field. -func (o *UsageRumSessionsHour) SetReplaySessionCount(v int64) { - o.ReplaySessionCount = &v -} - -// GetSessionCount returns the SessionCount field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageRumSessionsHour) GetSessionCount() int64 { - if o == nil || o.SessionCount.Get() == nil { - var ret int64 - return ret - } - return *o.SessionCount.Get() -} - -// GetSessionCountOk returns a tuple with the SessionCount 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 *UsageRumSessionsHour) GetSessionCountOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.SessionCount.Get(), o.SessionCount.IsSet() -} - -// HasSessionCount returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasSessionCount() bool { - if o != nil && o.SessionCount.IsSet() { - return true - } - - return false -} - -// SetSessionCount gets a reference to the given common.NullableInt64 and assigns it to the SessionCount field. -func (o *UsageRumSessionsHour) SetSessionCount(v int64) { - o.SessionCount.Set(&v) -} - -// SetSessionCountNil sets the value for SessionCount to be an explicit nil. -func (o *UsageRumSessionsHour) SetSessionCountNil() { - o.SessionCount.Set(nil) -} - -// UnsetSessionCount ensures that no value is present for SessionCount, not even an explicit nil. -func (o *UsageRumSessionsHour) UnsetSessionCount() { - o.SessionCount.Unset() -} - -// GetSessionCountAndroid returns the SessionCountAndroid field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageRumSessionsHour) GetSessionCountAndroid() int64 { - if o == nil || o.SessionCountAndroid.Get() == nil { - var ret int64 - return ret - } - return *o.SessionCountAndroid.Get() -} - -// GetSessionCountAndroidOk returns a tuple with the SessionCountAndroid 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 *UsageRumSessionsHour) GetSessionCountAndroidOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.SessionCountAndroid.Get(), o.SessionCountAndroid.IsSet() -} - -// HasSessionCountAndroid returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasSessionCountAndroid() bool { - if o != nil && o.SessionCountAndroid.IsSet() { - return true - } - - return false -} - -// SetSessionCountAndroid gets a reference to the given common.NullableInt64 and assigns it to the SessionCountAndroid field. -func (o *UsageRumSessionsHour) SetSessionCountAndroid(v int64) { - o.SessionCountAndroid.Set(&v) -} - -// SetSessionCountAndroidNil sets the value for SessionCountAndroid to be an explicit nil. -func (o *UsageRumSessionsHour) SetSessionCountAndroidNil() { - o.SessionCountAndroid.Set(nil) -} - -// UnsetSessionCountAndroid ensures that no value is present for SessionCountAndroid, not even an explicit nil. -func (o *UsageRumSessionsHour) UnsetSessionCountAndroid() { - o.SessionCountAndroid.Unset() -} - -// GetSessionCountIos returns the SessionCountIos field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageRumSessionsHour) GetSessionCountIos() int64 { - if o == nil || o.SessionCountIos.Get() == nil { - var ret int64 - return ret - } - return *o.SessionCountIos.Get() -} - -// GetSessionCountIosOk returns a tuple with the SessionCountIos 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 *UsageRumSessionsHour) GetSessionCountIosOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.SessionCountIos.Get(), o.SessionCountIos.IsSet() -} - -// HasSessionCountIos returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasSessionCountIos() bool { - if o != nil && o.SessionCountIos.IsSet() { - return true - } - - return false -} - -// SetSessionCountIos gets a reference to the given common.NullableInt64 and assigns it to the SessionCountIos field. -func (o *UsageRumSessionsHour) SetSessionCountIos(v int64) { - o.SessionCountIos.Set(&v) -} - -// SetSessionCountIosNil sets the value for SessionCountIos to be an explicit nil. -func (o *UsageRumSessionsHour) SetSessionCountIosNil() { - o.SessionCountIos.Set(nil) -} - -// UnsetSessionCountIos ensures that no value is present for SessionCountIos, not even an explicit nil. -func (o *UsageRumSessionsHour) UnsetSessionCountIos() { - o.SessionCountIos.Unset() -} - -// GetSessionCountReactnative returns the SessionCountReactnative field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageRumSessionsHour) GetSessionCountReactnative() int64 { - if o == nil || o.SessionCountReactnative.Get() == nil { - var ret int64 - return ret - } - return *o.SessionCountReactnative.Get() -} - -// GetSessionCountReactnativeOk returns a tuple with the SessionCountReactnative 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 *UsageRumSessionsHour) GetSessionCountReactnativeOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.SessionCountReactnative.Get(), o.SessionCountReactnative.IsSet() -} - -// HasSessionCountReactnative returns a boolean if a field has been set. -func (o *UsageRumSessionsHour) HasSessionCountReactnative() bool { - if o != nil && o.SessionCountReactnative.IsSet() { - return true - } - - return false -} - -// SetSessionCountReactnative gets a reference to the given common.NullableInt64 and assigns it to the SessionCountReactnative field. -func (o *UsageRumSessionsHour) SetSessionCountReactnative(v int64) { - o.SessionCountReactnative.Set(&v) -} - -// SetSessionCountReactnativeNil sets the value for SessionCountReactnative to be an explicit nil. -func (o *UsageRumSessionsHour) SetSessionCountReactnativeNil() { - o.SessionCountReactnative.Set(nil) -} - -// UnsetSessionCountReactnative ensures that no value is present for SessionCountReactnative, not even an explicit nil. -func (o *UsageRumSessionsHour) UnsetSessionCountReactnative() { - o.SessionCountReactnative.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageRumSessionsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.ReplaySessionCount != nil { - toSerialize["replay_session_count"] = o.ReplaySessionCount - } - if o.SessionCount.IsSet() { - toSerialize["session_count"] = o.SessionCount.Get() - } - if o.SessionCountAndroid.IsSet() { - toSerialize["session_count_android"] = o.SessionCountAndroid.Get() - } - if o.SessionCountIos.IsSet() { - toSerialize["session_count_ios"] = o.SessionCountIos.Get() - } - if o.SessionCountReactnative.IsSet() { - toSerialize["session_count_reactnative"] = o.SessionCountReactnative.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageRumSessionsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - ReplaySessionCount *int64 `json:"replay_session_count,omitempty"` - SessionCount common.NullableInt64 `json:"session_count,omitempty"` - SessionCountAndroid common.NullableInt64 `json:"session_count_android,omitempty"` - SessionCountIos common.NullableInt64 `json:"session_count_ios,omitempty"` - SessionCountReactnative common.NullableInt64 `json:"session_count_reactnative,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.ReplaySessionCount = all.ReplaySessionCount - o.SessionCount = all.SessionCount - o.SessionCountAndroid = all.SessionCountAndroid - o.SessionCountIos = all.SessionCountIos - o.SessionCountReactnative = all.SessionCountReactnative - return nil -} diff --git a/api/v1/datadog/model_usage_rum_sessions_response.go b/api/v1/datadog/model_usage_rum_sessions_response.go deleted file mode 100644 index a56ab85d3a4..00000000000 --- a/api/v1/datadog/model_usage_rum_sessions_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageRumSessionsResponse Response containing the number of RUM Sessions for each hour for a given organization. -type UsageRumSessionsResponse struct { - // Get hourly usage for RUM Sessions. - Usage []UsageRumSessionsHour `json:"usage,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{} -} - -// NewUsageRumSessionsResponse instantiates a new UsageRumSessionsResponse 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 NewUsageRumSessionsResponse() *UsageRumSessionsResponse { - this := UsageRumSessionsResponse{} - return &this -} - -// NewUsageRumSessionsResponseWithDefaults instantiates a new UsageRumSessionsResponse 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 NewUsageRumSessionsResponseWithDefaults() *UsageRumSessionsResponse { - this := UsageRumSessionsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageRumSessionsResponse) GetUsage() []UsageRumSessionsHour { - if o == nil || o.Usage == nil { - var ret []UsageRumSessionsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumSessionsResponse) GetUsageOk() (*[]UsageRumSessionsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageRumSessionsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageRumSessionsHour and assigns it to the Usage field. -func (o *UsageRumSessionsResponse) SetUsage(v []UsageRumSessionsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageRumSessionsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageRumSessionsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageRumSessionsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_rum_units_hour.go b/api/v1/datadog/model_usage_rum_units_hour.go deleted file mode 100644 index 8aa0288f72c..00000000000 --- a/api/v1/datadog/model_usage_rum_units_hour.go +++ /dev/null @@ -1,271 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsageRumUnitsHour Number of RUM Units used for each hour for a given organization (data available as of November 1, 2021). -type UsageRumUnitsHour struct { - // The number of browser RUM units. - BrowserRumUnits *int64 `json:"browser_rum_units,omitempty"` - // The number of mobile RUM units. - MobileRumUnits *int64 `json:"mobile_rum_units,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // Total RUM units across mobile and browser RUM. - RumUnits common.NullableInt64 `json:"rum_units,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{} -} - -// NewUsageRumUnitsHour instantiates a new UsageRumUnitsHour 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 NewUsageRumUnitsHour() *UsageRumUnitsHour { - this := UsageRumUnitsHour{} - return &this -} - -// NewUsageRumUnitsHourWithDefaults instantiates a new UsageRumUnitsHour 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 NewUsageRumUnitsHourWithDefaults() *UsageRumUnitsHour { - this := UsageRumUnitsHour{} - return &this -} - -// GetBrowserRumUnits returns the BrowserRumUnits field value if set, zero value otherwise. -func (o *UsageRumUnitsHour) GetBrowserRumUnits() int64 { - if o == nil || o.BrowserRumUnits == nil { - var ret int64 - return ret - } - return *o.BrowserRumUnits -} - -// GetBrowserRumUnitsOk returns a tuple with the BrowserRumUnits field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumUnitsHour) GetBrowserRumUnitsOk() (*int64, bool) { - if o == nil || o.BrowserRumUnits == nil { - return nil, false - } - return o.BrowserRumUnits, true -} - -// HasBrowserRumUnits returns a boolean if a field has been set. -func (o *UsageRumUnitsHour) HasBrowserRumUnits() bool { - if o != nil && o.BrowserRumUnits != nil { - return true - } - - return false -} - -// SetBrowserRumUnits gets a reference to the given int64 and assigns it to the BrowserRumUnits field. -func (o *UsageRumUnitsHour) SetBrowserRumUnits(v int64) { - o.BrowserRumUnits = &v -} - -// GetMobileRumUnits returns the MobileRumUnits field value if set, zero value otherwise. -func (o *UsageRumUnitsHour) GetMobileRumUnits() int64 { - if o == nil || o.MobileRumUnits == nil { - var ret int64 - return ret - } - return *o.MobileRumUnits -} - -// GetMobileRumUnitsOk returns a tuple with the MobileRumUnits field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumUnitsHour) GetMobileRumUnitsOk() (*int64, bool) { - if o == nil || o.MobileRumUnits == nil { - return nil, false - } - return o.MobileRumUnits, true -} - -// HasMobileRumUnits returns a boolean if a field has been set. -func (o *UsageRumUnitsHour) HasMobileRumUnits() bool { - if o != nil && o.MobileRumUnits != nil { - return true - } - - return false -} - -// SetMobileRumUnits gets a reference to the given int64 and assigns it to the MobileRumUnits field. -func (o *UsageRumUnitsHour) SetMobileRumUnits(v int64) { - o.MobileRumUnits = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageRumUnitsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumUnitsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageRumUnitsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageRumUnitsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageRumUnitsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumUnitsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageRumUnitsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageRumUnitsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetRumUnits returns the RumUnits field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageRumUnitsHour) GetRumUnits() int64 { - if o == nil || o.RumUnits.Get() == nil { - var ret int64 - return ret - } - return *o.RumUnits.Get() -} - -// GetRumUnitsOk returns a tuple with the RumUnits 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 *UsageRumUnitsHour) GetRumUnitsOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.RumUnits.Get(), o.RumUnits.IsSet() -} - -// HasRumUnits returns a boolean if a field has been set. -func (o *UsageRumUnitsHour) HasRumUnits() bool { - if o != nil && o.RumUnits.IsSet() { - return true - } - - return false -} - -// SetRumUnits gets a reference to the given common.NullableInt64 and assigns it to the RumUnits field. -func (o *UsageRumUnitsHour) SetRumUnits(v int64) { - o.RumUnits.Set(&v) -} - -// SetRumUnitsNil sets the value for RumUnits to be an explicit nil. -func (o *UsageRumUnitsHour) SetRumUnitsNil() { - o.RumUnits.Set(nil) -} - -// UnsetRumUnits ensures that no value is present for RumUnits, not even an explicit nil. -func (o *UsageRumUnitsHour) UnsetRumUnits() { - o.RumUnits.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageRumUnitsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BrowserRumUnits != nil { - toSerialize["browser_rum_units"] = o.BrowserRumUnits - } - if o.MobileRumUnits != nil { - toSerialize["mobile_rum_units"] = o.MobileRumUnits - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.RumUnits.IsSet() { - toSerialize["rum_units"] = o.RumUnits.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageRumUnitsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BrowserRumUnits *int64 `json:"browser_rum_units,omitempty"` - MobileRumUnits *int64 `json:"mobile_rum_units,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - RumUnits common.NullableInt64 `json:"rum_units,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BrowserRumUnits = all.BrowserRumUnits - o.MobileRumUnits = all.MobileRumUnits - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.RumUnits = all.RumUnits - return nil -} diff --git a/api/v1/datadog/model_usage_rum_units_response.go b/api/v1/datadog/model_usage_rum_units_response.go deleted file mode 100644 index f44997b4242..00000000000 --- a/api/v1/datadog/model_usage_rum_units_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageRumUnitsResponse Response containing the number of RUM Units for each hour for a given organization. -type UsageRumUnitsResponse struct { - // Get hourly usage for RUM Units. - Usage []UsageRumUnitsHour `json:"usage,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{} -} - -// NewUsageRumUnitsResponse instantiates a new UsageRumUnitsResponse 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 NewUsageRumUnitsResponse() *UsageRumUnitsResponse { - this := UsageRumUnitsResponse{} - return &this -} - -// NewUsageRumUnitsResponseWithDefaults instantiates a new UsageRumUnitsResponse 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 NewUsageRumUnitsResponseWithDefaults() *UsageRumUnitsResponse { - this := UsageRumUnitsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageRumUnitsResponse) GetUsage() []UsageRumUnitsHour { - if o == nil || o.Usage == nil { - var ret []UsageRumUnitsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageRumUnitsResponse) GetUsageOk() (*[]UsageRumUnitsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageRumUnitsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageRumUnitsHour and assigns it to the Usage field. -func (o *UsageRumUnitsResponse) SetUsage(v []UsageRumUnitsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageRumUnitsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageRumUnitsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageRumUnitsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_sds_hour.go b/api/v1/datadog/model_usage_sds_hour.go deleted file mode 100644 index 50000f6267b..00000000000 --- a/api/v1/datadog/model_usage_sds_hour.go +++ /dev/null @@ -1,263 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageSDSHour Sensitive Data Scanner usage for a given organization for a given hour. -type UsageSDSHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The total number of bytes scanned of logs usage by the Sensitive Data Scanner from the start of the given hour’s month until the given hour. - LogsScannedBytes *int64 `json:"logs_scanned_bytes,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The total number of bytes scanned across all usage types by the Sensitive Data Scanner from the start of the given hour’s month until the given hour. - TotalScannedBytes *int64 `json:"total_scanned_bytes,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{} -} - -// NewUsageSDSHour instantiates a new UsageSDSHour 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 NewUsageSDSHour() *UsageSDSHour { - this := UsageSDSHour{} - return &this -} - -// NewUsageSDSHourWithDefaults instantiates a new UsageSDSHour 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 NewUsageSDSHourWithDefaults() *UsageSDSHour { - this := UsageSDSHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageSDSHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSDSHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageSDSHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageSDSHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetLogsScannedBytes returns the LogsScannedBytes field value if set, zero value otherwise. -func (o *UsageSDSHour) GetLogsScannedBytes() int64 { - if o == nil || o.LogsScannedBytes == nil { - var ret int64 - return ret - } - return *o.LogsScannedBytes -} - -// GetLogsScannedBytesOk returns a tuple with the LogsScannedBytes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSDSHour) GetLogsScannedBytesOk() (*int64, bool) { - if o == nil || o.LogsScannedBytes == nil { - return nil, false - } - return o.LogsScannedBytes, true -} - -// HasLogsScannedBytes returns a boolean if a field has been set. -func (o *UsageSDSHour) HasLogsScannedBytes() bool { - if o != nil && o.LogsScannedBytes != nil { - return true - } - - return false -} - -// SetLogsScannedBytes gets a reference to the given int64 and assigns it to the LogsScannedBytes field. -func (o *UsageSDSHour) SetLogsScannedBytes(v int64) { - o.LogsScannedBytes = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageSDSHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSDSHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageSDSHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageSDSHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageSDSHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSDSHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageSDSHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageSDSHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetTotalScannedBytes returns the TotalScannedBytes field value if set, zero value otherwise. -func (o *UsageSDSHour) GetTotalScannedBytes() int64 { - if o == nil || o.TotalScannedBytes == nil { - var ret int64 - return ret - } - return *o.TotalScannedBytes -} - -// GetTotalScannedBytesOk returns a tuple with the TotalScannedBytes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSDSHour) GetTotalScannedBytesOk() (*int64, bool) { - if o == nil || o.TotalScannedBytes == nil { - return nil, false - } - return o.TotalScannedBytes, true -} - -// HasTotalScannedBytes returns a boolean if a field has been set. -func (o *UsageSDSHour) HasTotalScannedBytes() bool { - if o != nil && o.TotalScannedBytes != nil { - return true - } - - return false -} - -// SetTotalScannedBytes gets a reference to the given int64 and assigns it to the TotalScannedBytes field. -func (o *UsageSDSHour) SetTotalScannedBytes(v int64) { - o.TotalScannedBytes = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSDSHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.LogsScannedBytes != nil { - toSerialize["logs_scanned_bytes"] = o.LogsScannedBytes - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.TotalScannedBytes != nil { - toSerialize["total_scanned_bytes"] = o.TotalScannedBytes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSDSHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - LogsScannedBytes *int64 `json:"logs_scanned_bytes,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - TotalScannedBytes *int64 `json:"total_scanned_bytes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.LogsScannedBytes = all.LogsScannedBytes - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.TotalScannedBytes = all.TotalScannedBytes - return nil -} diff --git a/api/v1/datadog/model_usage_sds_response.go b/api/v1/datadog/model_usage_sds_response.go deleted file mode 100644 index 9882f42178f..00000000000 --- a/api/v1/datadog/model_usage_sds_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSDSResponse Response containing the Sensitive Data Scanner usage for each hour for a given organization. -type UsageSDSResponse struct { - // Get hourly usage for Sensitive Data Scanner. - Usage []UsageSDSHour `json:"usage,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{} -} - -// NewUsageSDSResponse instantiates a new UsageSDSResponse 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 NewUsageSDSResponse() *UsageSDSResponse { - this := UsageSDSResponse{} - return &this -} - -// NewUsageSDSResponseWithDefaults instantiates a new UsageSDSResponse 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 NewUsageSDSResponseWithDefaults() *UsageSDSResponse { - this := UsageSDSResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageSDSResponse) GetUsage() []UsageSDSHour { - if o == nil || o.Usage == nil { - var ret []UsageSDSHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSDSResponse) GetUsageOk() (*[]UsageSDSHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageSDSResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageSDSHour and assigns it to the Usage field. -func (o *UsageSDSResponse) SetUsage(v []UsageSDSHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSDSResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSDSResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageSDSHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_snmp_hour.go b/api/v1/datadog/model_usage_snmp_hour.go deleted file mode 100644 index 61ed34450d5..00000000000 --- a/api/v1/datadog/model_usage_snmp_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageSNMPHour The number of SNMP devices for each hour for a given organization. -type UsageSNMPHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // Contains the number of SNMP devices. - SnmpDevices *int64 `json:"snmp_devices,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{} -} - -// NewUsageSNMPHour instantiates a new UsageSNMPHour 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 NewUsageSNMPHour() *UsageSNMPHour { - this := UsageSNMPHour{} - return &this -} - -// NewUsageSNMPHourWithDefaults instantiates a new UsageSNMPHour 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 NewUsageSNMPHourWithDefaults() *UsageSNMPHour { - this := UsageSNMPHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageSNMPHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSNMPHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageSNMPHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageSNMPHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageSNMPHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSNMPHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageSNMPHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageSNMPHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageSNMPHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSNMPHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageSNMPHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageSNMPHour) SetPublicId(v string) { - o.PublicId = &v -} - -// GetSnmpDevices returns the SnmpDevices field value if set, zero value otherwise. -func (o *UsageSNMPHour) GetSnmpDevices() int64 { - if o == nil || o.SnmpDevices == nil { - var ret int64 - return ret - } - return *o.SnmpDevices -} - -// GetSnmpDevicesOk returns a tuple with the SnmpDevices field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSNMPHour) GetSnmpDevicesOk() (*int64, bool) { - if o == nil || o.SnmpDevices == nil { - return nil, false - } - return o.SnmpDevices, true -} - -// HasSnmpDevices returns a boolean if a field has been set. -func (o *UsageSNMPHour) HasSnmpDevices() bool { - if o != nil && o.SnmpDevices != nil { - return true - } - - return false -} - -// SetSnmpDevices gets a reference to the given int64 and assigns it to the SnmpDevices field. -func (o *UsageSNMPHour) SetSnmpDevices(v int64) { - o.SnmpDevices = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSNMPHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.SnmpDevices != nil { - toSerialize["snmp_devices"] = o.SnmpDevices - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSNMPHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - SnmpDevices *int64 `json:"snmp_devices,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.SnmpDevices = all.SnmpDevices - return nil -} diff --git a/api/v1/datadog/model_usage_snmp_response.go b/api/v1/datadog/model_usage_snmp_response.go deleted file mode 100644 index 0910e32e9bd..00000000000 --- a/api/v1/datadog/model_usage_snmp_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSNMPResponse Response containing the number of SNMP devices for each hour for a given organization. -type UsageSNMPResponse struct { - // Get hourly usage for SNMP devices. - Usage []UsageSNMPHour `json:"usage,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{} -} - -// NewUsageSNMPResponse instantiates a new UsageSNMPResponse 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 NewUsageSNMPResponse() *UsageSNMPResponse { - this := UsageSNMPResponse{} - return &this -} - -// NewUsageSNMPResponseWithDefaults instantiates a new UsageSNMPResponse 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 NewUsageSNMPResponseWithDefaults() *UsageSNMPResponse { - this := UsageSNMPResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageSNMPResponse) GetUsage() []UsageSNMPHour { - if o == nil || o.Usage == nil { - var ret []UsageSNMPHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSNMPResponse) GetUsageOk() (*[]UsageSNMPHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageSNMPResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageSNMPHour and assigns it to the Usage field. -func (o *UsageSNMPResponse) SetUsage(v []UsageSNMPHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSNMPResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSNMPResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageSNMPHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_sort.go b/api/v1/datadog/model_usage_sort.go deleted file mode 100644 index ba9e4236bd0..00000000000 --- a/api/v1/datadog/model_usage_sort.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsageSort The field to sort by. -type UsageSort string - -// List of UsageSort. -const ( - USAGESORT_COMPUTED_ON UsageSort = "computed_on" - USAGESORT_SIZE UsageSort = "size" - USAGESORT_START_DATE UsageSort = "start_date" - USAGESORT_END_DATE UsageSort = "end_date" -) - -var allowedUsageSortEnumValues = []UsageSort{ - USAGESORT_COMPUTED_ON, - USAGESORT_SIZE, - USAGESORT_START_DATE, - USAGESORT_END_DATE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsageSort) GetAllowedValues() []UsageSort { - return allowedUsageSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsageSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsageSort(value) - return nil -} - -// NewUsageSortFromValue returns a pointer to a valid UsageSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsageSortFromValue(v string) (*UsageSort, error) { - ev := UsageSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsageSort: valid values are %v", v, allowedUsageSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsageSort) IsValid() bool { - for _, existing := range allowedUsageSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsageSort value. -func (v UsageSort) Ptr() *UsageSort { - return &v -} - -// NullableUsageSort handles when a null is used for UsageSort. -type NullableUsageSort struct { - value *UsageSort - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageSort) Get() *UsageSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageSort) Set(val *UsageSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageSort initializes the struct as if Set has been called. -func NewNullableUsageSort(val *UsageSort) *NullableUsageSort { - return &NullableUsageSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_usage_sort_direction.go b/api/v1/datadog/model_usage_sort_direction.go deleted file mode 100644 index 68e278b4a46..00000000000 --- a/api/v1/datadog/model_usage_sort_direction.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsageSortDirection The direction to sort by. -type UsageSortDirection string - -// List of UsageSortDirection. -const ( - USAGESORTDIRECTION_DESC UsageSortDirection = "desc" - USAGESORTDIRECTION_ASC UsageSortDirection = "asc" -) - -var allowedUsageSortDirectionEnumValues = []UsageSortDirection{ - USAGESORTDIRECTION_DESC, - USAGESORTDIRECTION_ASC, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsageSortDirection) GetAllowedValues() []UsageSortDirection { - return allowedUsageSortDirectionEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsageSortDirection) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsageSortDirection(value) - return nil -} - -// NewUsageSortDirectionFromValue returns a pointer to a valid UsageSortDirection -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsageSortDirectionFromValue(v string) (*UsageSortDirection, error) { - ev := UsageSortDirection(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsageSortDirection: valid values are %v", v, allowedUsageSortDirectionEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsageSortDirection) IsValid() bool { - for _, existing := range allowedUsageSortDirectionEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsageSortDirection value. -func (v UsageSortDirection) Ptr() *UsageSortDirection { - return &v -} - -// NullableUsageSortDirection handles when a null is used for UsageSortDirection. -type NullableUsageSortDirection struct { - value *UsageSortDirection - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageSortDirection) Get() *UsageSortDirection { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageSortDirection) Set(val *UsageSortDirection) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageSortDirection) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageSortDirection) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageSortDirection initializes the struct as if Set has been called. -func NewNullableUsageSortDirection(val *UsageSortDirection) *NullableUsageSortDirection { - return &NullableUsageSortDirection{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageSortDirection) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageSortDirection) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_attributes.go b/api/v1/datadog/model_usage_specified_custom_reports_attributes.go deleted file mode 100644 index 9a4ce2e7ff4..00000000000 --- a/api/v1/datadog/model_usage_specified_custom_reports_attributes.go +++ /dev/null @@ -1,297 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSpecifiedCustomReportsAttributes The response containing attributes for specified custom reports. -type UsageSpecifiedCustomReportsAttributes struct { - // The date the specified custom report was computed. - ComputedOn *string `json:"computed_on,omitempty"` - // The ending date of specified custom report. - EndDate *string `json:"end_date,omitempty"` - // A downloadable file for the specified custom reporting file. - Location *string `json:"location,omitempty"` - // size - Size *int64 `json:"size,omitempty"` - // The starting date of specified custom report. - StartDate *string `json:"start_date,omitempty"` - // A list of tags to apply to specified custom reports. - Tags []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{} -} - -// NewUsageSpecifiedCustomReportsAttributes instantiates a new UsageSpecifiedCustomReportsAttributes 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 NewUsageSpecifiedCustomReportsAttributes() *UsageSpecifiedCustomReportsAttributes { - this := UsageSpecifiedCustomReportsAttributes{} - return &this -} - -// NewUsageSpecifiedCustomReportsAttributesWithDefaults instantiates a new UsageSpecifiedCustomReportsAttributes 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 NewUsageSpecifiedCustomReportsAttributesWithDefaults() *UsageSpecifiedCustomReportsAttributes { - this := UsageSpecifiedCustomReportsAttributes{} - return &this -} - -// GetComputedOn returns the ComputedOn field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsAttributes) GetComputedOn() string { - if o == nil || o.ComputedOn == nil { - var ret string - return ret - } - return *o.ComputedOn -} - -// GetComputedOnOk returns a tuple with the ComputedOn field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsAttributes) GetComputedOnOk() (*string, bool) { - if o == nil || o.ComputedOn == nil { - return nil, false - } - return o.ComputedOn, true -} - -// HasComputedOn returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsAttributes) HasComputedOn() bool { - if o != nil && o.ComputedOn != nil { - return true - } - - return false -} - -// SetComputedOn gets a reference to the given string and assigns it to the ComputedOn field. -func (o *UsageSpecifiedCustomReportsAttributes) SetComputedOn(v string) { - o.ComputedOn = &v -} - -// GetEndDate returns the EndDate field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsAttributes) GetEndDate() string { - if o == nil || o.EndDate == nil { - var ret string - return ret - } - return *o.EndDate -} - -// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsAttributes) GetEndDateOk() (*string, bool) { - if o == nil || o.EndDate == nil { - return nil, false - } - return o.EndDate, true -} - -// HasEndDate returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsAttributes) HasEndDate() bool { - if o != nil && o.EndDate != nil { - return true - } - - return false -} - -// SetEndDate gets a reference to the given string and assigns it to the EndDate field. -func (o *UsageSpecifiedCustomReportsAttributes) SetEndDate(v string) { - o.EndDate = &v -} - -// GetLocation returns the Location field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsAttributes) GetLocation() string { - if o == nil || o.Location == nil { - var ret string - return ret - } - return *o.Location -} - -// GetLocationOk returns a tuple with the Location field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsAttributes) GetLocationOk() (*string, bool) { - if o == nil || o.Location == nil { - return nil, false - } - return o.Location, true -} - -// HasLocation returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsAttributes) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false -} - -// SetLocation gets a reference to the given string and assigns it to the Location field. -func (o *UsageSpecifiedCustomReportsAttributes) SetLocation(v string) { - o.Location = &v -} - -// GetSize returns the Size field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsAttributes) GetSize() int64 { - if o == nil || o.Size == nil { - var ret int64 - return ret - } - return *o.Size -} - -// GetSizeOk returns a tuple with the Size field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsAttributes) GetSizeOk() (*int64, bool) { - if o == nil || o.Size == nil { - return nil, false - } - return o.Size, true -} - -// HasSize returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsAttributes) HasSize() bool { - if o != nil && o.Size != nil { - return true - } - - return false -} - -// SetSize gets a reference to the given int64 and assigns it to the Size field. -func (o *UsageSpecifiedCustomReportsAttributes) SetSize(v int64) { - o.Size = &v -} - -// GetStartDate returns the StartDate field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsAttributes) GetStartDate() string { - if o == nil || o.StartDate == nil { - var ret string - return ret - } - return *o.StartDate -} - -// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsAttributes) GetStartDateOk() (*string, bool) { - if o == nil || o.StartDate == nil { - return nil, false - } - return o.StartDate, true -} - -// HasStartDate returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsAttributes) HasStartDate() bool { - if o != nil && o.StartDate != nil { - return true - } - - return false -} - -// SetStartDate gets a reference to the given string and assigns it to the StartDate field. -func (o *UsageSpecifiedCustomReportsAttributes) SetStartDate(v string) { - o.StartDate = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *UsageSpecifiedCustomReportsAttributes) GetTagsOk() (*[]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 *UsageSpecifiedCustomReportsAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *UsageSpecifiedCustomReportsAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSpecifiedCustomReportsAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ComputedOn != nil { - toSerialize["computed_on"] = o.ComputedOn - } - if o.EndDate != nil { - toSerialize["end_date"] = o.EndDate - } - if o.Location != nil { - toSerialize["location"] = o.Location - } - if o.Size != nil { - toSerialize["size"] = o.Size - } - if o.StartDate != nil { - toSerialize["start_date"] = o.StartDate - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSpecifiedCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ComputedOn *string `json:"computed_on,omitempty"` - EndDate *string `json:"end_date,omitempty"` - Location *string `json:"location,omitempty"` - Size *int64 `json:"size,omitempty"` - StartDate *string `json:"start_date,omitempty"` - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ComputedOn = all.ComputedOn - o.EndDate = all.EndDate - o.Location = all.Location - o.Size = all.Size - o.StartDate = all.StartDate - o.Tags = all.Tags - return nil -} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_data.go b/api/v1/datadog/model_usage_specified_custom_reports_data.go deleted file mode 100644 index 9fabf4fe55f..00000000000 --- a/api/v1/datadog/model_usage_specified_custom_reports_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSpecifiedCustomReportsData Response containing date and type for specified custom reports. -type UsageSpecifiedCustomReportsData struct { - // The response containing attributes for specified custom reports. - Attributes *UsageSpecifiedCustomReportsAttributes `json:"attributes,omitempty"` - // The date for specified custom reports. - Id *string `json:"id,omitempty"` - // The type of reports. - Type *UsageReportsType `json:"type,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{} -} - -// NewUsageSpecifiedCustomReportsData instantiates a new UsageSpecifiedCustomReportsData 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 NewUsageSpecifiedCustomReportsData() *UsageSpecifiedCustomReportsData { - this := UsageSpecifiedCustomReportsData{} - var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS - this.Type = &typeVar - return &this -} - -// NewUsageSpecifiedCustomReportsDataWithDefaults instantiates a new UsageSpecifiedCustomReportsData 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 NewUsageSpecifiedCustomReportsDataWithDefaults() *UsageSpecifiedCustomReportsData { - this := UsageSpecifiedCustomReportsData{} - var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsData) GetAttributes() UsageSpecifiedCustomReportsAttributes { - if o == nil || o.Attributes == nil { - var ret UsageSpecifiedCustomReportsAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsData) GetAttributesOk() (*UsageSpecifiedCustomReportsAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given UsageSpecifiedCustomReportsAttributes and assigns it to the Attributes field. -func (o *UsageSpecifiedCustomReportsData) SetAttributes(v UsageSpecifiedCustomReportsAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *UsageSpecifiedCustomReportsData) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsData) GetType() UsageReportsType { - if o == nil || o.Type == nil { - var ret UsageReportsType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsData) GetTypeOk() (*UsageReportsType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given UsageReportsType and assigns it to the Type field. -func (o *UsageSpecifiedCustomReportsData) SetType(v UsageReportsType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSpecifiedCustomReportsData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSpecifiedCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *UsageSpecifiedCustomReportsAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *UsageReportsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_meta.go b/api/v1/datadog/model_usage_specified_custom_reports_meta.go deleted file mode 100644 index e4e6d6ea741..00000000000 --- a/api/v1/datadog/model_usage_specified_custom_reports_meta.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSpecifiedCustomReportsMeta The object containing document metadata. -type UsageSpecifiedCustomReportsMeta struct { - // The object containing page total count for specified ID. - Page *UsageSpecifiedCustomReportsPage `json:"page,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{} -} - -// NewUsageSpecifiedCustomReportsMeta instantiates a new UsageSpecifiedCustomReportsMeta 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 NewUsageSpecifiedCustomReportsMeta() *UsageSpecifiedCustomReportsMeta { - this := UsageSpecifiedCustomReportsMeta{} - return &this -} - -// NewUsageSpecifiedCustomReportsMetaWithDefaults instantiates a new UsageSpecifiedCustomReportsMeta 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 NewUsageSpecifiedCustomReportsMetaWithDefaults() *UsageSpecifiedCustomReportsMeta { - this := UsageSpecifiedCustomReportsMeta{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsMeta) GetPage() UsageSpecifiedCustomReportsPage { - if o == nil || o.Page == nil { - var ret UsageSpecifiedCustomReportsPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsMeta) GetPageOk() (*UsageSpecifiedCustomReportsPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsMeta) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given UsageSpecifiedCustomReportsPage and assigns it to the Page field. -func (o *UsageSpecifiedCustomReportsMeta) SetPage(v UsageSpecifiedCustomReportsPage) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSpecifiedCustomReportsMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSpecifiedCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *UsageSpecifiedCustomReportsPage `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_page.go b/api/v1/datadog/model_usage_specified_custom_reports_page.go deleted file mode 100644 index c874f0ad9d8..00000000000 --- a/api/v1/datadog/model_usage_specified_custom_reports_page.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSpecifiedCustomReportsPage The object containing page total count for specified ID. -type UsageSpecifiedCustomReportsPage struct { - // Total page count. - TotalCount *int64 `json:"total_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{} -} - -// NewUsageSpecifiedCustomReportsPage instantiates a new UsageSpecifiedCustomReportsPage 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 NewUsageSpecifiedCustomReportsPage() *UsageSpecifiedCustomReportsPage { - this := UsageSpecifiedCustomReportsPage{} - return &this -} - -// NewUsageSpecifiedCustomReportsPageWithDefaults instantiates a new UsageSpecifiedCustomReportsPage 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 NewUsageSpecifiedCustomReportsPageWithDefaults() *UsageSpecifiedCustomReportsPage { - this := UsageSpecifiedCustomReportsPage{} - return &this -} - -// GetTotalCount returns the TotalCount field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsPage) GetTotalCount() int64 { - if o == nil || o.TotalCount == nil { - var ret int64 - return ret - } - return *o.TotalCount -} - -// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsPage) GetTotalCountOk() (*int64, bool) { - if o == nil || o.TotalCount == nil { - return nil, false - } - return o.TotalCount, true -} - -// HasTotalCount returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsPage) HasTotalCount() bool { - if o != nil && o.TotalCount != nil { - return true - } - - return false -} - -// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. -func (o *UsageSpecifiedCustomReportsPage) SetTotalCount(v int64) { - o.TotalCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSpecifiedCustomReportsPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TotalCount != nil { - toSerialize["total_count"] = o.TotalCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSpecifiedCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TotalCount *int64 `json:"total_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TotalCount = all.TotalCount - return nil -} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_response.go b/api/v1/datadog/model_usage_specified_custom_reports_response.go deleted file mode 100644 index 0e1ce2eda0f..00000000000 --- a/api/v1/datadog/model_usage_specified_custom_reports_response.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSpecifiedCustomReportsResponse Returns available specified custom reports. -type UsageSpecifiedCustomReportsResponse struct { - // Response containing date and type for specified custom reports. - Data *UsageSpecifiedCustomReportsData `json:"data,omitempty"` - // The object containing document metadata. - Meta *UsageSpecifiedCustomReportsMeta `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{} -} - -// NewUsageSpecifiedCustomReportsResponse instantiates a new UsageSpecifiedCustomReportsResponse 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 NewUsageSpecifiedCustomReportsResponse() *UsageSpecifiedCustomReportsResponse { - this := UsageSpecifiedCustomReportsResponse{} - return &this -} - -// NewUsageSpecifiedCustomReportsResponseWithDefaults instantiates a new UsageSpecifiedCustomReportsResponse 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 NewUsageSpecifiedCustomReportsResponseWithDefaults() *UsageSpecifiedCustomReportsResponse { - this := UsageSpecifiedCustomReportsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsResponse) GetData() UsageSpecifiedCustomReportsData { - if o == nil || o.Data == nil { - var ret UsageSpecifiedCustomReportsData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSpecifiedCustomReportsResponse) GetDataOk() (*UsageSpecifiedCustomReportsData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UsageSpecifiedCustomReportsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given UsageSpecifiedCustomReportsData and assigns it to the Data field. -func (o *UsageSpecifiedCustomReportsResponse) SetData(v UsageSpecifiedCustomReportsData) { - o.Data = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *UsageSpecifiedCustomReportsResponse) GetMeta() UsageSpecifiedCustomReportsMeta { - if o == nil || o.Meta == nil { - var ret UsageSpecifiedCustomReportsMeta - 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 *UsageSpecifiedCustomReportsResponse) GetMetaOk() (*UsageSpecifiedCustomReportsMeta, 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 *UsageSpecifiedCustomReportsResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given UsageSpecifiedCustomReportsMeta and assigns it to the Meta field. -func (o *UsageSpecifiedCustomReportsResponse) SetMeta(v UsageSpecifiedCustomReportsMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSpecifiedCustomReportsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSpecifiedCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *UsageSpecifiedCustomReportsData `json:"data,omitempty"` - Meta *UsageSpecifiedCustomReportsMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v1/datadog/model_usage_summary_date.go b/api/v1/datadog/model_usage_summary_date.go deleted file mode 100644 index 94b1789e4bb..00000000000 --- a/api/v1/datadog/model_usage_summary_date.go +++ /dev/null @@ -1,2564 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageSummaryDate Response with hourly report of all data billed by Datadog all organizations. -type UsageSummaryDate struct { - // Shows the 99th percentile of all agent hosts over all hours in the current date for all organizations. - AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` - // Shows the 99th percentile of all Azure app services using APM over all hours in the current date all organizations. - ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` - // Shows the 99th percentile of all distinct APM hosts over all hours in the current date for all organizations. - ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` - // Shows the sum of audit logs lines indexed over all hours in the current date for all organizations. - AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` - // The average profiled task count for Fargate Profiling. - AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` - // Shows the 99th percentile of all AWS hosts over all hours in the current date for all organizations. - AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` - // Shows the average of the number of functions that executed 1 or more times each hour in the current date for all organizations. - AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` - // Shows the sum of all AWS Lambda invocations over all hours in the current date for all organizations. - AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` - // Shows the 99th percentile of all Azure app services over all hours in the current date for all organizations. - AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` - // Shows the sum of all log bytes ingested over all hours in the current date for all organizations. - BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` - // Shows the sum of all browser lite sessions over all hours in the current date for all organizations. - BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` - // Shows the sum of all browser replay sessions over all hours in the current date for all organizations. - BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` - // Shows the sum of all browser RUM units over all hours in the current date for all organizations. - BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` - // Shows the sum of all CI pipeline indexed spans over all hours in the current month for all organizations. - CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` - // Shows the sum of all CI test indexed spans over all hours in the current month for all organizations. - CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` - // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current month for all organizations. - CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` - // Shows the high-water mark of all CI visibility test committers over all hours in the current month for all organizations. - CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` - // Shows the average of all distinct containers over all hours in the current date for all organizations. - ContainerAvg *int64 `json:"container_avg,omitempty"` - // Shows the high-water mark of all distinct containers over all hours in the current date for all organizations. - ContainerHwm *int64 `json:"container_hwm,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management Azure app services hosts over all hours in the current date for all organizations. - CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management Azure hosts over all hours in the current date for all organizations. - CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` - // Shows the average number of Cloud Security Posture Management containers over all hours in the current date for all organizations. - CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` - // Shows the high-water mark of Cloud Security Posture Management containers over all hours in the current date for all organizations. - CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management hosts over all hours in the current date for all organizations. - CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` - // Shows the average number of distinct custom metrics over all hours in the current date for all organizations. - CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` - // Shows the average of all distinct Cloud Workload Security containers over all hours in the current date for all organizations. - CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` - // Shows the 99th percentile of all Cloud Workload Security hosts over all hours in the current date for all organizations. - CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` - // The date for the usage. - Date *time.Time `json:"date,omitempty"` - // Shows the 99th percentile of all Database Monitoring hosts over all hours in the current date for all organizations. - DbmHostTop99p *int64 `json:"dbm_host_top99p,omitempty"` - // Shows the average of all normalized Database Monitoring queries over all hours in the current date for all organizations. - DbmQueriesCountAvg *int64 `json:"dbm_queries_count_avg,omitempty"` - // Shows the high-watermark of all Fargate tasks over all hours in the current date for all organizations. - FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` - // Shows the average of all Fargate tasks over all hours in the current date for all organizations. - FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` - // Shows the 99th percentile of all GCP hosts over all hours in the current date for all organizations. - GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` - // Shows the 99th percentile of all Heroku dynos over all hours in the current date for all organizations. - HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` - // Shows the high-water mark of incident management monthly active users over all hours in the current date for all organizations. - IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` - // Shows the sum of all log events indexed over all hours in the current date for all organizations. - IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` - // Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for all organizations. - InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` - // Shows the sum of all log bytes ingested over all hours in the current date for all organizations. - IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` - // Shows the sum of all IoT devices over all hours in the current date for all organizations. - IotDeviceSum *int64 `json:"iot_device_sum,omitempty"` - // Shows the 99th percentile of all IoT devices over all hours in the current date all organizations. - IotDeviceTop99p *int64 `json:"iot_device_top99p,omitempty"` - // Shows the sum of all mobile lite sessions over all hours in the current date for all organizations. - MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for all organizations. - MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for all organizations. - MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on React Native over all hours in the current date for all organizations. - MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions over all hours in the current date for all organizations - MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` - // Shows the sum of all mobile RUM units over all hours in the current date for all organizations. - MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` - // Shows the sum of all Network flows indexed over all hours in the current date for all organizations. - NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` - // Shows the 99th percentile of all distinct Networks hosts over all hours in the current date for all organizations. - NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` - // Sum of all observability pipelines bytes processed over all hours in the current date for the given org. - ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` - // Sum of all online archived events over all hours in the current date for all organizations. - OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` - // Shows the 99th percentile of all hosts reported by the Datadog exporter for the OpenTelemetry Collector over all hours in the current date for all organizations. - OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` - // Organizations associated with a user. - Orgs []UsageSummaryDateOrg `json:"orgs,omitempty"` - // Shows the 99th percentile of all profiled hosts over all hours in the current date for all organizations. - ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` - // Shows the sum of all mobile sessions and all browser lite and legacy sessions over all hours in the current month for all organizations. - RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` - // Shows the sum of all browser RUM Lite Sessions over all hours in the current date for all organizations - RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` - // Shows the sum of RUM Sessions (browser and mobile) over all hours in the current date for all organizations. - RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` - // Shows the sum of all browser and mobile RUM units over all hours in the current date for all organizations. - RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` - // Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for all organizations. - SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` - // Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for all organizations. - SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` - // Shows the sum of all Synthetic browser tests over all hours in the current date for all organizations. - SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` - // Shows the sum of all Synthetic API tests over all hours in the current date for all organizations. - SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` - // Shows the sum of all Indexed Spans indexed over all hours in the current date for all organizations. - TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` - // Shows the sum of all ingested APM span bytes over all hours in the current date for all organizations. - TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` - // Shows the 99th percentile of all vSphere hosts over all hours in the current date for all organizations. - VsphereHostTop99p *int64 `json:"vsphere_host_top99p,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{} -} - -// NewUsageSummaryDate instantiates a new UsageSummaryDate 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 NewUsageSummaryDate() *UsageSummaryDate { - this := UsageSummaryDate{} - return &this -} - -// NewUsageSummaryDateWithDefaults instantiates a new UsageSummaryDate 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 NewUsageSummaryDateWithDefaults() *UsageSummaryDate { - this := UsageSummaryDate{} - return &this -} - -// GetAgentHostTop99p returns the AgentHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetAgentHostTop99p() int64 { - if o == nil || o.AgentHostTop99p == nil { - var ret int64 - return ret - } - return *o.AgentHostTop99p -} - -// GetAgentHostTop99pOk returns a tuple with the AgentHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetAgentHostTop99pOk() (*int64, bool) { - if o == nil || o.AgentHostTop99p == nil { - return nil, false - } - return o.AgentHostTop99p, true -} - -// HasAgentHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasAgentHostTop99p() bool { - if o != nil && o.AgentHostTop99p != nil { - return true - } - - return false -} - -// SetAgentHostTop99p gets a reference to the given int64 and assigns it to the AgentHostTop99p field. -func (o *UsageSummaryDate) SetAgentHostTop99p(v int64) { - o.AgentHostTop99p = &v -} - -// GetApmAzureAppServiceHostTop99p returns the ApmAzureAppServiceHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetApmAzureAppServiceHostTop99p() int64 { - if o == nil || o.ApmAzureAppServiceHostTop99p == nil { - var ret int64 - return ret - } - return *o.ApmAzureAppServiceHostTop99p -} - -// GetApmAzureAppServiceHostTop99pOk returns a tuple with the ApmAzureAppServiceHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetApmAzureAppServiceHostTop99pOk() (*int64, bool) { - if o == nil || o.ApmAzureAppServiceHostTop99p == nil { - return nil, false - } - return o.ApmAzureAppServiceHostTop99p, true -} - -// HasApmAzureAppServiceHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasApmAzureAppServiceHostTop99p() bool { - if o != nil && o.ApmAzureAppServiceHostTop99p != nil { - return true - } - - return false -} - -// SetApmAzureAppServiceHostTop99p gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostTop99p field. -func (o *UsageSummaryDate) SetApmAzureAppServiceHostTop99p(v int64) { - o.ApmAzureAppServiceHostTop99p = &v -} - -// GetApmHostTop99p returns the ApmHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetApmHostTop99p() int64 { - if o == nil || o.ApmHostTop99p == nil { - var ret int64 - return ret - } - return *o.ApmHostTop99p -} - -// GetApmHostTop99pOk returns a tuple with the ApmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetApmHostTop99pOk() (*int64, bool) { - if o == nil || o.ApmHostTop99p == nil { - return nil, false - } - return o.ApmHostTop99p, true -} - -// HasApmHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasApmHostTop99p() bool { - if o != nil && o.ApmHostTop99p != nil { - return true - } - - return false -} - -// SetApmHostTop99p gets a reference to the given int64 and assigns it to the ApmHostTop99p field. -func (o *UsageSummaryDate) SetApmHostTop99p(v int64) { - o.ApmHostTop99p = &v -} - -// GetAuditLogsLinesIndexedSum returns the AuditLogsLinesIndexedSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetAuditLogsLinesIndexedSum() int64 { - if o == nil || o.AuditLogsLinesIndexedSum == nil { - var ret int64 - return ret - } - return *o.AuditLogsLinesIndexedSum -} - -// GetAuditLogsLinesIndexedSumOk returns a tuple with the AuditLogsLinesIndexedSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetAuditLogsLinesIndexedSumOk() (*int64, bool) { - if o == nil || o.AuditLogsLinesIndexedSum == nil { - return nil, false - } - return o.AuditLogsLinesIndexedSum, true -} - -// HasAuditLogsLinesIndexedSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasAuditLogsLinesIndexedSum() bool { - if o != nil && o.AuditLogsLinesIndexedSum != nil { - return true - } - - return false -} - -// SetAuditLogsLinesIndexedSum gets a reference to the given int64 and assigns it to the AuditLogsLinesIndexedSum field. -func (o *UsageSummaryDate) SetAuditLogsLinesIndexedSum(v int64) { - o.AuditLogsLinesIndexedSum = &v -} - -// GetAvgProfiledFargateTasks returns the AvgProfiledFargateTasks field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetAvgProfiledFargateTasks() int64 { - if o == nil || o.AvgProfiledFargateTasks == nil { - var ret int64 - return ret - } - return *o.AvgProfiledFargateTasks -} - -// GetAvgProfiledFargateTasksOk returns a tuple with the AvgProfiledFargateTasks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetAvgProfiledFargateTasksOk() (*int64, bool) { - if o == nil || o.AvgProfiledFargateTasks == nil { - return nil, false - } - return o.AvgProfiledFargateTasks, true -} - -// HasAvgProfiledFargateTasks returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasAvgProfiledFargateTasks() bool { - if o != nil && o.AvgProfiledFargateTasks != nil { - return true - } - - return false -} - -// SetAvgProfiledFargateTasks gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasks field. -func (o *UsageSummaryDate) SetAvgProfiledFargateTasks(v int64) { - o.AvgProfiledFargateTasks = &v -} - -// GetAwsHostTop99p returns the AwsHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetAwsHostTop99p() int64 { - if o == nil || o.AwsHostTop99p == nil { - var ret int64 - return ret - } - return *o.AwsHostTop99p -} - -// GetAwsHostTop99pOk returns a tuple with the AwsHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetAwsHostTop99pOk() (*int64, bool) { - if o == nil || o.AwsHostTop99p == nil { - return nil, false - } - return o.AwsHostTop99p, true -} - -// HasAwsHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasAwsHostTop99p() bool { - if o != nil && o.AwsHostTop99p != nil { - return true - } - - return false -} - -// SetAwsHostTop99p gets a reference to the given int64 and assigns it to the AwsHostTop99p field. -func (o *UsageSummaryDate) SetAwsHostTop99p(v int64) { - o.AwsHostTop99p = &v -} - -// GetAwsLambdaFuncCount returns the AwsLambdaFuncCount field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetAwsLambdaFuncCount() int64 { - if o == nil || o.AwsLambdaFuncCount == nil { - var ret int64 - return ret - } - return *o.AwsLambdaFuncCount -} - -// GetAwsLambdaFuncCountOk returns a tuple with the AwsLambdaFuncCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetAwsLambdaFuncCountOk() (*int64, bool) { - if o == nil || o.AwsLambdaFuncCount == nil { - return nil, false - } - return o.AwsLambdaFuncCount, true -} - -// HasAwsLambdaFuncCount returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasAwsLambdaFuncCount() bool { - if o != nil && o.AwsLambdaFuncCount != nil { - return true - } - - return false -} - -// SetAwsLambdaFuncCount gets a reference to the given int64 and assigns it to the AwsLambdaFuncCount field. -func (o *UsageSummaryDate) SetAwsLambdaFuncCount(v int64) { - o.AwsLambdaFuncCount = &v -} - -// GetAwsLambdaInvocationsSum returns the AwsLambdaInvocationsSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetAwsLambdaInvocationsSum() int64 { - if o == nil || o.AwsLambdaInvocationsSum == nil { - var ret int64 - return ret - } - return *o.AwsLambdaInvocationsSum -} - -// GetAwsLambdaInvocationsSumOk returns a tuple with the AwsLambdaInvocationsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetAwsLambdaInvocationsSumOk() (*int64, bool) { - if o == nil || o.AwsLambdaInvocationsSum == nil { - return nil, false - } - return o.AwsLambdaInvocationsSum, true -} - -// HasAwsLambdaInvocationsSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasAwsLambdaInvocationsSum() bool { - if o != nil && o.AwsLambdaInvocationsSum != nil { - return true - } - - return false -} - -// SetAwsLambdaInvocationsSum gets a reference to the given int64 and assigns it to the AwsLambdaInvocationsSum field. -func (o *UsageSummaryDate) SetAwsLambdaInvocationsSum(v int64) { - o.AwsLambdaInvocationsSum = &v -} - -// GetAzureAppServiceTop99p returns the AzureAppServiceTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetAzureAppServiceTop99p() int64 { - if o == nil || o.AzureAppServiceTop99p == nil { - var ret int64 - return ret - } - return *o.AzureAppServiceTop99p -} - -// GetAzureAppServiceTop99pOk returns a tuple with the AzureAppServiceTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetAzureAppServiceTop99pOk() (*int64, bool) { - if o == nil || o.AzureAppServiceTop99p == nil { - return nil, false - } - return o.AzureAppServiceTop99p, true -} - -// HasAzureAppServiceTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasAzureAppServiceTop99p() bool { - if o != nil && o.AzureAppServiceTop99p != nil { - return true - } - - return false -} - -// SetAzureAppServiceTop99p gets a reference to the given int64 and assigns it to the AzureAppServiceTop99p field. -func (o *UsageSummaryDate) SetAzureAppServiceTop99p(v int64) { - o.AzureAppServiceTop99p = &v -} - -// GetBillableIngestedBytesSum returns the BillableIngestedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetBillableIngestedBytesSum() int64 { - if o == nil || o.BillableIngestedBytesSum == nil { - var ret int64 - return ret - } - return *o.BillableIngestedBytesSum -} - -// GetBillableIngestedBytesSumOk returns a tuple with the BillableIngestedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetBillableIngestedBytesSumOk() (*int64, bool) { - if o == nil || o.BillableIngestedBytesSum == nil { - return nil, false - } - return o.BillableIngestedBytesSum, true -} - -// HasBillableIngestedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasBillableIngestedBytesSum() bool { - if o != nil && o.BillableIngestedBytesSum != nil { - return true - } - - return false -} - -// SetBillableIngestedBytesSum gets a reference to the given int64 and assigns it to the BillableIngestedBytesSum field. -func (o *UsageSummaryDate) SetBillableIngestedBytesSum(v int64) { - o.BillableIngestedBytesSum = &v -} - -// GetBrowserRumLiteSessionCountSum returns the BrowserRumLiteSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetBrowserRumLiteSessionCountSum() int64 { - if o == nil || o.BrowserRumLiteSessionCountSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumLiteSessionCountSum -} - -// GetBrowserRumLiteSessionCountSumOk returns a tuple with the BrowserRumLiteSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetBrowserRumLiteSessionCountSumOk() (*int64, bool) { - if o == nil || o.BrowserRumLiteSessionCountSum == nil { - return nil, false - } - return o.BrowserRumLiteSessionCountSum, true -} - -// HasBrowserRumLiteSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasBrowserRumLiteSessionCountSum() bool { - if o != nil && o.BrowserRumLiteSessionCountSum != nil { - return true - } - - return false -} - -// SetBrowserRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumLiteSessionCountSum field. -func (o *UsageSummaryDate) SetBrowserRumLiteSessionCountSum(v int64) { - o.BrowserRumLiteSessionCountSum = &v -} - -// GetBrowserRumReplaySessionCountSum returns the BrowserRumReplaySessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetBrowserRumReplaySessionCountSum() int64 { - if o == nil || o.BrowserRumReplaySessionCountSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumReplaySessionCountSum -} - -// GetBrowserRumReplaySessionCountSumOk returns a tuple with the BrowserRumReplaySessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetBrowserRumReplaySessionCountSumOk() (*int64, bool) { - if o == nil || o.BrowserRumReplaySessionCountSum == nil { - return nil, false - } - return o.BrowserRumReplaySessionCountSum, true -} - -// HasBrowserRumReplaySessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasBrowserRumReplaySessionCountSum() bool { - if o != nil && o.BrowserRumReplaySessionCountSum != nil { - return true - } - - return false -} - -// SetBrowserRumReplaySessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumReplaySessionCountSum field. -func (o *UsageSummaryDate) SetBrowserRumReplaySessionCountSum(v int64) { - o.BrowserRumReplaySessionCountSum = &v -} - -// GetBrowserRumUnitsSum returns the BrowserRumUnitsSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetBrowserRumUnitsSum() int64 { - if o == nil || o.BrowserRumUnitsSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumUnitsSum -} - -// GetBrowserRumUnitsSumOk returns a tuple with the BrowserRumUnitsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetBrowserRumUnitsSumOk() (*int64, bool) { - if o == nil || o.BrowserRumUnitsSum == nil { - return nil, false - } - return o.BrowserRumUnitsSum, true -} - -// HasBrowserRumUnitsSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasBrowserRumUnitsSum() bool { - if o != nil && o.BrowserRumUnitsSum != nil { - return true - } - - return false -} - -// SetBrowserRumUnitsSum gets a reference to the given int64 and assigns it to the BrowserRumUnitsSum field. -func (o *UsageSummaryDate) SetBrowserRumUnitsSum(v int64) { - o.BrowserRumUnitsSum = &v -} - -// GetCiPipelineIndexedSpansSum returns the CiPipelineIndexedSpansSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCiPipelineIndexedSpansSum() int64 { - if o == nil || o.CiPipelineIndexedSpansSum == nil { - var ret int64 - return ret - } - return *o.CiPipelineIndexedSpansSum -} - -// GetCiPipelineIndexedSpansSumOk returns a tuple with the CiPipelineIndexedSpansSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCiPipelineIndexedSpansSumOk() (*int64, bool) { - if o == nil || o.CiPipelineIndexedSpansSum == nil { - return nil, false - } - return o.CiPipelineIndexedSpansSum, true -} - -// HasCiPipelineIndexedSpansSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCiPipelineIndexedSpansSum() bool { - if o != nil && o.CiPipelineIndexedSpansSum != nil { - return true - } - - return false -} - -// SetCiPipelineIndexedSpansSum gets a reference to the given int64 and assigns it to the CiPipelineIndexedSpansSum field. -func (o *UsageSummaryDate) SetCiPipelineIndexedSpansSum(v int64) { - o.CiPipelineIndexedSpansSum = &v -} - -// GetCiTestIndexedSpansSum returns the CiTestIndexedSpansSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCiTestIndexedSpansSum() int64 { - if o == nil || o.CiTestIndexedSpansSum == nil { - var ret int64 - return ret - } - return *o.CiTestIndexedSpansSum -} - -// GetCiTestIndexedSpansSumOk returns a tuple with the CiTestIndexedSpansSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCiTestIndexedSpansSumOk() (*int64, bool) { - if o == nil || o.CiTestIndexedSpansSum == nil { - return nil, false - } - return o.CiTestIndexedSpansSum, true -} - -// HasCiTestIndexedSpansSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCiTestIndexedSpansSum() bool { - if o != nil && o.CiTestIndexedSpansSum != nil { - return true - } - - return false -} - -// SetCiTestIndexedSpansSum gets a reference to the given int64 and assigns it to the CiTestIndexedSpansSum field. -func (o *UsageSummaryDate) SetCiTestIndexedSpansSum(v int64) { - o.CiTestIndexedSpansSum = &v -} - -// GetCiVisibilityPipelineCommittersHwm returns the CiVisibilityPipelineCommittersHwm field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCiVisibilityPipelineCommittersHwm() int64 { - if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { - var ret int64 - return ret - } - return *o.CiVisibilityPipelineCommittersHwm -} - -// GetCiVisibilityPipelineCommittersHwmOk returns a tuple with the CiVisibilityPipelineCommittersHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCiVisibilityPipelineCommittersHwmOk() (*int64, bool) { - if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { - return nil, false - } - return o.CiVisibilityPipelineCommittersHwm, true -} - -// HasCiVisibilityPipelineCommittersHwm returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCiVisibilityPipelineCommittersHwm() bool { - if o != nil && o.CiVisibilityPipelineCommittersHwm != nil { - return true - } - - return false -} - -// SetCiVisibilityPipelineCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityPipelineCommittersHwm field. -func (o *UsageSummaryDate) SetCiVisibilityPipelineCommittersHwm(v int64) { - o.CiVisibilityPipelineCommittersHwm = &v -} - -// GetCiVisibilityTestCommittersHwm returns the CiVisibilityTestCommittersHwm field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCiVisibilityTestCommittersHwm() int64 { - if o == nil || o.CiVisibilityTestCommittersHwm == nil { - var ret int64 - return ret - } - return *o.CiVisibilityTestCommittersHwm -} - -// GetCiVisibilityTestCommittersHwmOk returns a tuple with the CiVisibilityTestCommittersHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCiVisibilityTestCommittersHwmOk() (*int64, bool) { - if o == nil || o.CiVisibilityTestCommittersHwm == nil { - return nil, false - } - return o.CiVisibilityTestCommittersHwm, true -} - -// HasCiVisibilityTestCommittersHwm returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCiVisibilityTestCommittersHwm() bool { - if o != nil && o.CiVisibilityTestCommittersHwm != nil { - return true - } - - return false -} - -// SetCiVisibilityTestCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityTestCommittersHwm field. -func (o *UsageSummaryDate) SetCiVisibilityTestCommittersHwm(v int64) { - o.CiVisibilityTestCommittersHwm = &v -} - -// GetContainerAvg returns the ContainerAvg field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetContainerAvg() int64 { - if o == nil || o.ContainerAvg == nil { - var ret int64 - return ret - } - return *o.ContainerAvg -} - -// GetContainerAvgOk returns a tuple with the ContainerAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetContainerAvgOk() (*int64, bool) { - if o == nil || o.ContainerAvg == nil { - return nil, false - } - return o.ContainerAvg, true -} - -// HasContainerAvg returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasContainerAvg() bool { - if o != nil && o.ContainerAvg != nil { - return true - } - - return false -} - -// SetContainerAvg gets a reference to the given int64 and assigns it to the ContainerAvg field. -func (o *UsageSummaryDate) SetContainerAvg(v int64) { - o.ContainerAvg = &v -} - -// GetContainerHwm returns the ContainerHwm field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetContainerHwm() int64 { - if o == nil || o.ContainerHwm == nil { - var ret int64 - return ret - } - return *o.ContainerHwm -} - -// GetContainerHwmOk returns a tuple with the ContainerHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetContainerHwmOk() (*int64, bool) { - if o == nil || o.ContainerHwm == nil { - return nil, false - } - return o.ContainerHwm, true -} - -// HasContainerHwm returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasContainerHwm() bool { - if o != nil && o.ContainerHwm != nil { - return true - } - - return false -} - -// SetContainerHwm gets a reference to the given int64 and assigns it to the ContainerHwm field. -func (o *UsageSummaryDate) SetContainerHwm(v int64) { - o.ContainerHwm = &v -} - -// GetCspmAasHostTop99p returns the CspmAasHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCspmAasHostTop99p() int64 { - if o == nil || o.CspmAasHostTop99p == nil { - var ret int64 - return ret - } - return *o.CspmAasHostTop99p -} - -// GetCspmAasHostTop99pOk returns a tuple with the CspmAasHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCspmAasHostTop99pOk() (*int64, bool) { - if o == nil || o.CspmAasHostTop99p == nil { - return nil, false - } - return o.CspmAasHostTop99p, true -} - -// HasCspmAasHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCspmAasHostTop99p() bool { - if o != nil && o.CspmAasHostTop99p != nil { - return true - } - - return false -} - -// SetCspmAasHostTop99p gets a reference to the given int64 and assigns it to the CspmAasHostTop99p field. -func (o *UsageSummaryDate) SetCspmAasHostTop99p(v int64) { - o.CspmAasHostTop99p = &v -} - -// GetCspmAzureHostTop99p returns the CspmAzureHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCspmAzureHostTop99p() int64 { - if o == nil || o.CspmAzureHostTop99p == nil { - var ret int64 - return ret - } - return *o.CspmAzureHostTop99p -} - -// GetCspmAzureHostTop99pOk returns a tuple with the CspmAzureHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCspmAzureHostTop99pOk() (*int64, bool) { - if o == nil || o.CspmAzureHostTop99p == nil { - return nil, false - } - return o.CspmAzureHostTop99p, true -} - -// HasCspmAzureHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCspmAzureHostTop99p() bool { - if o != nil && o.CspmAzureHostTop99p != nil { - return true - } - - return false -} - -// SetCspmAzureHostTop99p gets a reference to the given int64 and assigns it to the CspmAzureHostTop99p field. -func (o *UsageSummaryDate) SetCspmAzureHostTop99p(v int64) { - o.CspmAzureHostTop99p = &v -} - -// GetCspmContainerAvg returns the CspmContainerAvg field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCspmContainerAvg() int64 { - if o == nil || o.CspmContainerAvg == nil { - var ret int64 - return ret - } - return *o.CspmContainerAvg -} - -// GetCspmContainerAvgOk returns a tuple with the CspmContainerAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCspmContainerAvgOk() (*int64, bool) { - if o == nil || o.CspmContainerAvg == nil { - return nil, false - } - return o.CspmContainerAvg, true -} - -// HasCspmContainerAvg returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCspmContainerAvg() bool { - if o != nil && o.CspmContainerAvg != nil { - return true - } - - return false -} - -// SetCspmContainerAvg gets a reference to the given int64 and assigns it to the CspmContainerAvg field. -func (o *UsageSummaryDate) SetCspmContainerAvg(v int64) { - o.CspmContainerAvg = &v -} - -// GetCspmContainerHwm returns the CspmContainerHwm field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCspmContainerHwm() int64 { - if o == nil || o.CspmContainerHwm == nil { - var ret int64 - return ret - } - return *o.CspmContainerHwm -} - -// GetCspmContainerHwmOk returns a tuple with the CspmContainerHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCspmContainerHwmOk() (*int64, bool) { - if o == nil || o.CspmContainerHwm == nil { - return nil, false - } - return o.CspmContainerHwm, true -} - -// HasCspmContainerHwm returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCspmContainerHwm() bool { - if o != nil && o.CspmContainerHwm != nil { - return true - } - - return false -} - -// SetCspmContainerHwm gets a reference to the given int64 and assigns it to the CspmContainerHwm field. -func (o *UsageSummaryDate) SetCspmContainerHwm(v int64) { - o.CspmContainerHwm = &v -} - -// GetCspmHostTop99p returns the CspmHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCspmHostTop99p() int64 { - if o == nil || o.CspmHostTop99p == nil { - var ret int64 - return ret - } - return *o.CspmHostTop99p -} - -// GetCspmHostTop99pOk returns a tuple with the CspmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCspmHostTop99pOk() (*int64, bool) { - if o == nil || o.CspmHostTop99p == nil { - return nil, false - } - return o.CspmHostTop99p, true -} - -// HasCspmHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCspmHostTop99p() bool { - if o != nil && o.CspmHostTop99p != nil { - return true - } - - return false -} - -// SetCspmHostTop99p gets a reference to the given int64 and assigns it to the CspmHostTop99p field. -func (o *UsageSummaryDate) SetCspmHostTop99p(v int64) { - o.CspmHostTop99p = &v -} - -// GetCustomTsAvg returns the CustomTsAvg field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCustomTsAvg() int64 { - if o == nil || o.CustomTsAvg == nil { - var ret int64 - return ret - } - return *o.CustomTsAvg -} - -// GetCustomTsAvgOk returns a tuple with the CustomTsAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCustomTsAvgOk() (*int64, bool) { - if o == nil || o.CustomTsAvg == nil { - return nil, false - } - return o.CustomTsAvg, true -} - -// HasCustomTsAvg returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCustomTsAvg() bool { - if o != nil && o.CustomTsAvg != nil { - return true - } - - return false -} - -// SetCustomTsAvg gets a reference to the given int64 and assigns it to the CustomTsAvg field. -func (o *UsageSummaryDate) SetCustomTsAvg(v int64) { - o.CustomTsAvg = &v -} - -// GetCwsContainerCountAvg returns the CwsContainerCountAvg field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCwsContainerCountAvg() int64 { - if o == nil || o.CwsContainerCountAvg == nil { - var ret int64 - return ret - } - return *o.CwsContainerCountAvg -} - -// GetCwsContainerCountAvgOk returns a tuple with the CwsContainerCountAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCwsContainerCountAvgOk() (*int64, bool) { - if o == nil || o.CwsContainerCountAvg == nil { - return nil, false - } - return o.CwsContainerCountAvg, true -} - -// HasCwsContainerCountAvg returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCwsContainerCountAvg() bool { - if o != nil && o.CwsContainerCountAvg != nil { - return true - } - - return false -} - -// SetCwsContainerCountAvg gets a reference to the given int64 and assigns it to the CwsContainerCountAvg field. -func (o *UsageSummaryDate) SetCwsContainerCountAvg(v int64) { - o.CwsContainerCountAvg = &v -} - -// GetCwsHostTop99p returns the CwsHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetCwsHostTop99p() int64 { - if o == nil || o.CwsHostTop99p == nil { - var ret int64 - return ret - } - return *o.CwsHostTop99p -} - -// GetCwsHostTop99pOk returns a tuple with the CwsHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetCwsHostTop99pOk() (*int64, bool) { - if o == nil || o.CwsHostTop99p == nil { - return nil, false - } - return o.CwsHostTop99p, true -} - -// HasCwsHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasCwsHostTop99p() bool { - if o != nil && o.CwsHostTop99p != nil { - return true - } - - return false -} - -// SetCwsHostTop99p gets a reference to the given int64 and assigns it to the CwsHostTop99p field. -func (o *UsageSummaryDate) SetCwsHostTop99p(v int64) { - o.CwsHostTop99p = &v -} - -// GetDate returns the Date field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetDate() time.Time { - if o == nil || o.Date == nil { - var ret time.Time - return ret - } - return *o.Date -} - -// GetDateOk returns a tuple with the Date field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetDateOk() (*time.Time, bool) { - if o == nil || o.Date == nil { - return nil, false - } - return o.Date, true -} - -// HasDate returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasDate() bool { - if o != nil && o.Date != nil { - return true - } - - return false -} - -// SetDate gets a reference to the given time.Time and assigns it to the Date field. -func (o *UsageSummaryDate) SetDate(v time.Time) { - o.Date = &v -} - -// GetDbmHostTop99p returns the DbmHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetDbmHostTop99p() int64 { - if o == nil || o.DbmHostTop99p == nil { - var ret int64 - return ret - } - return *o.DbmHostTop99p -} - -// GetDbmHostTop99pOk returns a tuple with the DbmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetDbmHostTop99pOk() (*int64, bool) { - if o == nil || o.DbmHostTop99p == nil { - return nil, false - } - return o.DbmHostTop99p, true -} - -// HasDbmHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasDbmHostTop99p() bool { - if o != nil && o.DbmHostTop99p != nil { - return true - } - - return false -} - -// SetDbmHostTop99p gets a reference to the given int64 and assigns it to the DbmHostTop99p field. -func (o *UsageSummaryDate) SetDbmHostTop99p(v int64) { - o.DbmHostTop99p = &v -} - -// GetDbmQueriesCountAvg returns the DbmQueriesCountAvg field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetDbmQueriesCountAvg() int64 { - if o == nil || o.DbmQueriesCountAvg == nil { - var ret int64 - return ret - } - return *o.DbmQueriesCountAvg -} - -// GetDbmQueriesCountAvgOk returns a tuple with the DbmQueriesCountAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetDbmQueriesCountAvgOk() (*int64, bool) { - if o == nil || o.DbmQueriesCountAvg == nil { - return nil, false - } - return o.DbmQueriesCountAvg, true -} - -// HasDbmQueriesCountAvg returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasDbmQueriesCountAvg() bool { - if o != nil && o.DbmQueriesCountAvg != nil { - return true - } - - return false -} - -// SetDbmQueriesCountAvg gets a reference to the given int64 and assigns it to the DbmQueriesCountAvg field. -func (o *UsageSummaryDate) SetDbmQueriesCountAvg(v int64) { - o.DbmQueriesCountAvg = &v -} - -// GetFargateTasksCountAvg returns the FargateTasksCountAvg field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetFargateTasksCountAvg() int64 { - if o == nil || o.FargateTasksCountAvg == nil { - var ret int64 - return ret - } - return *o.FargateTasksCountAvg -} - -// GetFargateTasksCountAvgOk returns a tuple with the FargateTasksCountAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetFargateTasksCountAvgOk() (*int64, bool) { - if o == nil || o.FargateTasksCountAvg == nil { - return nil, false - } - return o.FargateTasksCountAvg, true -} - -// HasFargateTasksCountAvg returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasFargateTasksCountAvg() bool { - if o != nil && o.FargateTasksCountAvg != nil { - return true - } - - return false -} - -// SetFargateTasksCountAvg gets a reference to the given int64 and assigns it to the FargateTasksCountAvg field. -func (o *UsageSummaryDate) SetFargateTasksCountAvg(v int64) { - o.FargateTasksCountAvg = &v -} - -// GetFargateTasksCountHwm returns the FargateTasksCountHwm field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetFargateTasksCountHwm() int64 { - if o == nil || o.FargateTasksCountHwm == nil { - var ret int64 - return ret - } - return *o.FargateTasksCountHwm -} - -// GetFargateTasksCountHwmOk returns a tuple with the FargateTasksCountHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetFargateTasksCountHwmOk() (*int64, bool) { - if o == nil || o.FargateTasksCountHwm == nil { - return nil, false - } - return o.FargateTasksCountHwm, true -} - -// HasFargateTasksCountHwm returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasFargateTasksCountHwm() bool { - if o != nil && o.FargateTasksCountHwm != nil { - return true - } - - return false -} - -// SetFargateTasksCountHwm gets a reference to the given int64 and assigns it to the FargateTasksCountHwm field. -func (o *UsageSummaryDate) SetFargateTasksCountHwm(v int64) { - o.FargateTasksCountHwm = &v -} - -// GetGcpHostTop99p returns the GcpHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetGcpHostTop99p() int64 { - if o == nil || o.GcpHostTop99p == nil { - var ret int64 - return ret - } - return *o.GcpHostTop99p -} - -// GetGcpHostTop99pOk returns a tuple with the GcpHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetGcpHostTop99pOk() (*int64, bool) { - if o == nil || o.GcpHostTop99p == nil { - return nil, false - } - return o.GcpHostTop99p, true -} - -// HasGcpHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasGcpHostTop99p() bool { - if o != nil && o.GcpHostTop99p != nil { - return true - } - - return false -} - -// SetGcpHostTop99p gets a reference to the given int64 and assigns it to the GcpHostTop99p field. -func (o *UsageSummaryDate) SetGcpHostTop99p(v int64) { - o.GcpHostTop99p = &v -} - -// GetHerokuHostTop99p returns the HerokuHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetHerokuHostTop99p() int64 { - if o == nil || o.HerokuHostTop99p == nil { - var ret int64 - return ret - } - return *o.HerokuHostTop99p -} - -// GetHerokuHostTop99pOk returns a tuple with the HerokuHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetHerokuHostTop99pOk() (*int64, bool) { - if o == nil || o.HerokuHostTop99p == nil { - return nil, false - } - return o.HerokuHostTop99p, true -} - -// HasHerokuHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasHerokuHostTop99p() bool { - if o != nil && o.HerokuHostTop99p != nil { - return true - } - - return false -} - -// SetHerokuHostTop99p gets a reference to the given int64 and assigns it to the HerokuHostTop99p field. -func (o *UsageSummaryDate) SetHerokuHostTop99p(v int64) { - o.HerokuHostTop99p = &v -} - -// GetIncidentManagementMonthlyActiveUsersHwm returns the IncidentManagementMonthlyActiveUsersHwm field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetIncidentManagementMonthlyActiveUsersHwm() int64 { - if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { - var ret int64 - return ret - } - return *o.IncidentManagementMonthlyActiveUsersHwm -} - -// GetIncidentManagementMonthlyActiveUsersHwmOk returns a tuple with the IncidentManagementMonthlyActiveUsersHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetIncidentManagementMonthlyActiveUsersHwmOk() (*int64, bool) { - if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { - return nil, false - } - return o.IncidentManagementMonthlyActiveUsersHwm, true -} - -// HasIncidentManagementMonthlyActiveUsersHwm returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasIncidentManagementMonthlyActiveUsersHwm() bool { - if o != nil && o.IncidentManagementMonthlyActiveUsersHwm != nil { - return true - } - - return false -} - -// SetIncidentManagementMonthlyActiveUsersHwm gets a reference to the given int64 and assigns it to the IncidentManagementMonthlyActiveUsersHwm field. -func (o *UsageSummaryDate) SetIncidentManagementMonthlyActiveUsersHwm(v int64) { - o.IncidentManagementMonthlyActiveUsersHwm = &v -} - -// GetIndexedEventsCountSum returns the IndexedEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetIndexedEventsCountSum() int64 { - if o == nil || o.IndexedEventsCountSum == nil { - var ret int64 - return ret - } - return *o.IndexedEventsCountSum -} - -// GetIndexedEventsCountSumOk returns a tuple with the IndexedEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetIndexedEventsCountSumOk() (*int64, bool) { - if o == nil || o.IndexedEventsCountSum == nil { - return nil, false - } - return o.IndexedEventsCountSum, true -} - -// HasIndexedEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasIndexedEventsCountSum() bool { - if o != nil && o.IndexedEventsCountSum != nil { - return true - } - - return false -} - -// SetIndexedEventsCountSum gets a reference to the given int64 and assigns it to the IndexedEventsCountSum field. -func (o *UsageSummaryDate) SetIndexedEventsCountSum(v int64) { - o.IndexedEventsCountSum = &v -} - -// GetInfraHostTop99p returns the InfraHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetInfraHostTop99p() int64 { - if o == nil || o.InfraHostTop99p == nil { - var ret int64 - return ret - } - return *o.InfraHostTop99p -} - -// GetInfraHostTop99pOk returns a tuple with the InfraHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetInfraHostTop99pOk() (*int64, bool) { - if o == nil || o.InfraHostTop99p == nil { - return nil, false - } - return o.InfraHostTop99p, true -} - -// HasInfraHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasInfraHostTop99p() bool { - if o != nil && o.InfraHostTop99p != nil { - return true - } - - return false -} - -// SetInfraHostTop99p gets a reference to the given int64 and assigns it to the InfraHostTop99p field. -func (o *UsageSummaryDate) SetInfraHostTop99p(v int64) { - o.InfraHostTop99p = &v -} - -// GetIngestedEventsBytesSum returns the IngestedEventsBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetIngestedEventsBytesSum() int64 { - if o == nil || o.IngestedEventsBytesSum == nil { - var ret int64 - return ret - } - return *o.IngestedEventsBytesSum -} - -// GetIngestedEventsBytesSumOk returns a tuple with the IngestedEventsBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetIngestedEventsBytesSumOk() (*int64, bool) { - if o == nil || o.IngestedEventsBytesSum == nil { - return nil, false - } - return o.IngestedEventsBytesSum, true -} - -// HasIngestedEventsBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasIngestedEventsBytesSum() bool { - if o != nil && o.IngestedEventsBytesSum != nil { - return true - } - - return false -} - -// SetIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the IngestedEventsBytesSum field. -func (o *UsageSummaryDate) SetIngestedEventsBytesSum(v int64) { - o.IngestedEventsBytesSum = &v -} - -// GetIotDeviceSum returns the IotDeviceSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetIotDeviceSum() int64 { - if o == nil || o.IotDeviceSum == nil { - var ret int64 - return ret - } - return *o.IotDeviceSum -} - -// GetIotDeviceSumOk returns a tuple with the IotDeviceSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetIotDeviceSumOk() (*int64, bool) { - if o == nil || o.IotDeviceSum == nil { - return nil, false - } - return o.IotDeviceSum, true -} - -// HasIotDeviceSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasIotDeviceSum() bool { - if o != nil && o.IotDeviceSum != nil { - return true - } - - return false -} - -// SetIotDeviceSum gets a reference to the given int64 and assigns it to the IotDeviceSum field. -func (o *UsageSummaryDate) SetIotDeviceSum(v int64) { - o.IotDeviceSum = &v -} - -// GetIotDeviceTop99p returns the IotDeviceTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetIotDeviceTop99p() int64 { - if o == nil || o.IotDeviceTop99p == nil { - var ret int64 - return ret - } - return *o.IotDeviceTop99p -} - -// GetIotDeviceTop99pOk returns a tuple with the IotDeviceTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetIotDeviceTop99pOk() (*int64, bool) { - if o == nil || o.IotDeviceTop99p == nil { - return nil, false - } - return o.IotDeviceTop99p, true -} - -// HasIotDeviceTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasIotDeviceTop99p() bool { - if o != nil && o.IotDeviceTop99p != nil { - return true - } - - return false -} - -// SetIotDeviceTop99p gets a reference to the given int64 and assigns it to the IotDeviceTop99p field. -func (o *UsageSummaryDate) SetIotDeviceTop99p(v int64) { - o.IotDeviceTop99p = &v -} - -// GetMobileRumLiteSessionCountSum returns the MobileRumLiteSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetMobileRumLiteSessionCountSum() int64 { - if o == nil || o.MobileRumLiteSessionCountSum == nil { - var ret int64 - return ret - } - return *o.MobileRumLiteSessionCountSum -} - -// GetMobileRumLiteSessionCountSumOk returns a tuple with the MobileRumLiteSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetMobileRumLiteSessionCountSumOk() (*int64, bool) { - if o == nil || o.MobileRumLiteSessionCountSum == nil { - return nil, false - } - return o.MobileRumLiteSessionCountSum, true -} - -// HasMobileRumLiteSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasMobileRumLiteSessionCountSum() bool { - if o != nil && o.MobileRumLiteSessionCountSum != nil { - return true - } - - return false -} - -// SetMobileRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumLiteSessionCountSum field. -func (o *UsageSummaryDate) SetMobileRumLiteSessionCountSum(v int64) { - o.MobileRumLiteSessionCountSum = &v -} - -// GetMobileRumSessionCountAndroidSum returns the MobileRumSessionCountAndroidSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetMobileRumSessionCountAndroidSum() int64 { - if o == nil || o.MobileRumSessionCountAndroidSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountAndroidSum -} - -// GetMobileRumSessionCountAndroidSumOk returns a tuple with the MobileRumSessionCountAndroidSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetMobileRumSessionCountAndroidSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountAndroidSum == nil { - return nil, false - } - return o.MobileRumSessionCountAndroidSum, true -} - -// HasMobileRumSessionCountAndroidSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasMobileRumSessionCountAndroidSum() bool { - if o != nil && o.MobileRumSessionCountAndroidSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountAndroidSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAndroidSum field. -func (o *UsageSummaryDate) SetMobileRumSessionCountAndroidSum(v int64) { - o.MobileRumSessionCountAndroidSum = &v -} - -// GetMobileRumSessionCountIosSum returns the MobileRumSessionCountIosSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetMobileRumSessionCountIosSum() int64 { - if o == nil || o.MobileRumSessionCountIosSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountIosSum -} - -// GetMobileRumSessionCountIosSumOk returns a tuple with the MobileRumSessionCountIosSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetMobileRumSessionCountIosSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountIosSum == nil { - return nil, false - } - return o.MobileRumSessionCountIosSum, true -} - -// HasMobileRumSessionCountIosSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasMobileRumSessionCountIosSum() bool { - if o != nil && o.MobileRumSessionCountIosSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountIosSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountIosSum field. -func (o *UsageSummaryDate) SetMobileRumSessionCountIosSum(v int64) { - o.MobileRumSessionCountIosSum = &v -} - -// GetMobileRumSessionCountReactnativeSum returns the MobileRumSessionCountReactnativeSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetMobileRumSessionCountReactnativeSum() int64 { - if o == nil || o.MobileRumSessionCountReactnativeSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountReactnativeSum -} - -// GetMobileRumSessionCountReactnativeSumOk returns a tuple with the MobileRumSessionCountReactnativeSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetMobileRumSessionCountReactnativeSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountReactnativeSum == nil { - return nil, false - } - return o.MobileRumSessionCountReactnativeSum, true -} - -// HasMobileRumSessionCountReactnativeSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasMobileRumSessionCountReactnativeSum() bool { - if o != nil && o.MobileRumSessionCountReactnativeSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountReactnativeSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountReactnativeSum field. -func (o *UsageSummaryDate) SetMobileRumSessionCountReactnativeSum(v int64) { - o.MobileRumSessionCountReactnativeSum = &v -} - -// GetMobileRumSessionCountSum returns the MobileRumSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetMobileRumSessionCountSum() int64 { - if o == nil || o.MobileRumSessionCountSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountSum -} - -// GetMobileRumSessionCountSumOk returns a tuple with the MobileRumSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetMobileRumSessionCountSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountSum == nil { - return nil, false - } - return o.MobileRumSessionCountSum, true -} - -// HasMobileRumSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasMobileRumSessionCountSum() bool { - if o != nil && o.MobileRumSessionCountSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountSum field. -func (o *UsageSummaryDate) SetMobileRumSessionCountSum(v int64) { - o.MobileRumSessionCountSum = &v -} - -// GetMobileRumUnitsSum returns the MobileRumUnitsSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetMobileRumUnitsSum() int64 { - if o == nil || o.MobileRumUnitsSum == nil { - var ret int64 - return ret - } - return *o.MobileRumUnitsSum -} - -// GetMobileRumUnitsSumOk returns a tuple with the MobileRumUnitsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetMobileRumUnitsSumOk() (*int64, bool) { - if o == nil || o.MobileRumUnitsSum == nil { - return nil, false - } - return o.MobileRumUnitsSum, true -} - -// HasMobileRumUnitsSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasMobileRumUnitsSum() bool { - if o != nil && o.MobileRumUnitsSum != nil { - return true - } - - return false -} - -// SetMobileRumUnitsSum gets a reference to the given int64 and assigns it to the MobileRumUnitsSum field. -func (o *UsageSummaryDate) SetMobileRumUnitsSum(v int64) { - o.MobileRumUnitsSum = &v -} - -// GetNetflowIndexedEventsCountSum returns the NetflowIndexedEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetNetflowIndexedEventsCountSum() int64 { - if o == nil || o.NetflowIndexedEventsCountSum == nil { - var ret int64 - return ret - } - return *o.NetflowIndexedEventsCountSum -} - -// GetNetflowIndexedEventsCountSumOk returns a tuple with the NetflowIndexedEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetNetflowIndexedEventsCountSumOk() (*int64, bool) { - if o == nil || o.NetflowIndexedEventsCountSum == nil { - return nil, false - } - return o.NetflowIndexedEventsCountSum, true -} - -// HasNetflowIndexedEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasNetflowIndexedEventsCountSum() bool { - if o != nil && o.NetflowIndexedEventsCountSum != nil { - return true - } - - return false -} - -// SetNetflowIndexedEventsCountSum gets a reference to the given int64 and assigns it to the NetflowIndexedEventsCountSum field. -func (o *UsageSummaryDate) SetNetflowIndexedEventsCountSum(v int64) { - o.NetflowIndexedEventsCountSum = &v -} - -// GetNpmHostTop99p returns the NpmHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetNpmHostTop99p() int64 { - if o == nil || o.NpmHostTop99p == nil { - var ret int64 - return ret - } - return *o.NpmHostTop99p -} - -// GetNpmHostTop99pOk returns a tuple with the NpmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetNpmHostTop99pOk() (*int64, bool) { - if o == nil || o.NpmHostTop99p == nil { - return nil, false - } - return o.NpmHostTop99p, true -} - -// HasNpmHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasNpmHostTop99p() bool { - if o != nil && o.NpmHostTop99p != nil { - return true - } - - return false -} - -// SetNpmHostTop99p gets a reference to the given int64 and assigns it to the NpmHostTop99p field. -func (o *UsageSummaryDate) SetNpmHostTop99p(v int64) { - o.NpmHostTop99p = &v -} - -// GetObservabilityPipelinesBytesProcessedSum returns the ObservabilityPipelinesBytesProcessedSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetObservabilityPipelinesBytesProcessedSum() int64 { - if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { - var ret int64 - return ret - } - return *o.ObservabilityPipelinesBytesProcessedSum -} - -// GetObservabilityPipelinesBytesProcessedSumOk returns a tuple with the ObservabilityPipelinesBytesProcessedSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetObservabilityPipelinesBytesProcessedSumOk() (*int64, bool) { - if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { - return nil, false - } - return o.ObservabilityPipelinesBytesProcessedSum, true -} - -// HasObservabilityPipelinesBytesProcessedSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasObservabilityPipelinesBytesProcessedSum() bool { - if o != nil && o.ObservabilityPipelinesBytesProcessedSum != nil { - return true - } - - return false -} - -// SetObservabilityPipelinesBytesProcessedSum gets a reference to the given int64 and assigns it to the ObservabilityPipelinesBytesProcessedSum field. -func (o *UsageSummaryDate) SetObservabilityPipelinesBytesProcessedSum(v int64) { - o.ObservabilityPipelinesBytesProcessedSum = &v -} - -// GetOnlineArchiveEventsCountSum returns the OnlineArchiveEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetOnlineArchiveEventsCountSum() int64 { - if o == nil || o.OnlineArchiveEventsCountSum == nil { - var ret int64 - return ret - } - return *o.OnlineArchiveEventsCountSum -} - -// GetOnlineArchiveEventsCountSumOk returns a tuple with the OnlineArchiveEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetOnlineArchiveEventsCountSumOk() (*int64, bool) { - if o == nil || o.OnlineArchiveEventsCountSum == nil { - return nil, false - } - return o.OnlineArchiveEventsCountSum, true -} - -// HasOnlineArchiveEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasOnlineArchiveEventsCountSum() bool { - if o != nil && o.OnlineArchiveEventsCountSum != nil { - return true - } - - return false -} - -// SetOnlineArchiveEventsCountSum gets a reference to the given int64 and assigns it to the OnlineArchiveEventsCountSum field. -func (o *UsageSummaryDate) SetOnlineArchiveEventsCountSum(v int64) { - o.OnlineArchiveEventsCountSum = &v -} - -// GetOpentelemetryHostTop99p returns the OpentelemetryHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetOpentelemetryHostTop99p() int64 { - if o == nil || o.OpentelemetryHostTop99p == nil { - var ret int64 - return ret - } - return *o.OpentelemetryHostTop99p -} - -// GetOpentelemetryHostTop99pOk returns a tuple with the OpentelemetryHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetOpentelemetryHostTop99pOk() (*int64, bool) { - if o == nil || o.OpentelemetryHostTop99p == nil { - return nil, false - } - return o.OpentelemetryHostTop99p, true -} - -// HasOpentelemetryHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasOpentelemetryHostTop99p() bool { - if o != nil && o.OpentelemetryHostTop99p != nil { - return true - } - - return false -} - -// SetOpentelemetryHostTop99p gets a reference to the given int64 and assigns it to the OpentelemetryHostTop99p field. -func (o *UsageSummaryDate) SetOpentelemetryHostTop99p(v int64) { - o.OpentelemetryHostTop99p = &v -} - -// GetOrgs returns the Orgs field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetOrgs() []UsageSummaryDateOrg { - if o == nil || o.Orgs == nil { - var ret []UsageSummaryDateOrg - return ret - } - return o.Orgs -} - -// GetOrgsOk returns a tuple with the Orgs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetOrgsOk() (*[]UsageSummaryDateOrg, bool) { - if o == nil || o.Orgs == nil { - return nil, false - } - return &o.Orgs, true -} - -// HasOrgs returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasOrgs() bool { - if o != nil && o.Orgs != nil { - return true - } - - return false -} - -// SetOrgs gets a reference to the given []UsageSummaryDateOrg and assigns it to the Orgs field. -func (o *UsageSummaryDate) SetOrgs(v []UsageSummaryDateOrg) { - o.Orgs = v -} - -// GetProfilingHostTop99p returns the ProfilingHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetProfilingHostTop99p() int64 { - if o == nil || o.ProfilingHostTop99p == nil { - var ret int64 - return ret - } - return *o.ProfilingHostTop99p -} - -// GetProfilingHostTop99pOk returns a tuple with the ProfilingHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetProfilingHostTop99pOk() (*int64, bool) { - if o == nil || o.ProfilingHostTop99p == nil { - return nil, false - } - return o.ProfilingHostTop99p, true -} - -// HasProfilingHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasProfilingHostTop99p() bool { - if o != nil && o.ProfilingHostTop99p != nil { - return true - } - - return false -} - -// SetProfilingHostTop99p gets a reference to the given int64 and assigns it to the ProfilingHostTop99p field. -func (o *UsageSummaryDate) SetProfilingHostTop99p(v int64) { - o.ProfilingHostTop99p = &v -} - -// GetRumBrowserAndMobileSessionCount returns the RumBrowserAndMobileSessionCount field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetRumBrowserAndMobileSessionCount() int64 { - if o == nil || o.RumBrowserAndMobileSessionCount == nil { - var ret int64 - return ret - } - return *o.RumBrowserAndMobileSessionCount -} - -// GetRumBrowserAndMobileSessionCountOk returns a tuple with the RumBrowserAndMobileSessionCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetRumBrowserAndMobileSessionCountOk() (*int64, bool) { - if o == nil || o.RumBrowserAndMobileSessionCount == nil { - return nil, false - } - return o.RumBrowserAndMobileSessionCount, true -} - -// HasRumBrowserAndMobileSessionCount returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasRumBrowserAndMobileSessionCount() bool { - if o != nil && o.RumBrowserAndMobileSessionCount != nil { - return true - } - - return false -} - -// SetRumBrowserAndMobileSessionCount gets a reference to the given int64 and assigns it to the RumBrowserAndMobileSessionCount field. -func (o *UsageSummaryDate) SetRumBrowserAndMobileSessionCount(v int64) { - o.RumBrowserAndMobileSessionCount = &v -} - -// GetRumSessionCountSum returns the RumSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetRumSessionCountSum() int64 { - if o == nil || o.RumSessionCountSum == nil { - var ret int64 - return ret - } - return *o.RumSessionCountSum -} - -// GetRumSessionCountSumOk returns a tuple with the RumSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetRumSessionCountSumOk() (*int64, bool) { - if o == nil || o.RumSessionCountSum == nil { - return nil, false - } - return o.RumSessionCountSum, true -} - -// HasRumSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasRumSessionCountSum() bool { - if o != nil && o.RumSessionCountSum != nil { - return true - } - - return false -} - -// SetRumSessionCountSum gets a reference to the given int64 and assigns it to the RumSessionCountSum field. -func (o *UsageSummaryDate) SetRumSessionCountSum(v int64) { - o.RumSessionCountSum = &v -} - -// GetRumTotalSessionCountSum returns the RumTotalSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetRumTotalSessionCountSum() int64 { - if o == nil || o.RumTotalSessionCountSum == nil { - var ret int64 - return ret - } - return *o.RumTotalSessionCountSum -} - -// GetRumTotalSessionCountSumOk returns a tuple with the RumTotalSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetRumTotalSessionCountSumOk() (*int64, bool) { - if o == nil || o.RumTotalSessionCountSum == nil { - return nil, false - } - return o.RumTotalSessionCountSum, true -} - -// HasRumTotalSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasRumTotalSessionCountSum() bool { - if o != nil && o.RumTotalSessionCountSum != nil { - return true - } - - return false -} - -// SetRumTotalSessionCountSum gets a reference to the given int64 and assigns it to the RumTotalSessionCountSum field. -func (o *UsageSummaryDate) SetRumTotalSessionCountSum(v int64) { - o.RumTotalSessionCountSum = &v -} - -// GetRumUnitsSum returns the RumUnitsSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetRumUnitsSum() int64 { - if o == nil || o.RumUnitsSum == nil { - var ret int64 - return ret - } - return *o.RumUnitsSum -} - -// GetRumUnitsSumOk returns a tuple with the RumUnitsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetRumUnitsSumOk() (*int64, bool) { - if o == nil || o.RumUnitsSum == nil { - return nil, false - } - return o.RumUnitsSum, true -} - -// HasRumUnitsSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasRumUnitsSum() bool { - if o != nil && o.RumUnitsSum != nil { - return true - } - - return false -} - -// SetRumUnitsSum gets a reference to the given int64 and assigns it to the RumUnitsSum field. -func (o *UsageSummaryDate) SetRumUnitsSum(v int64) { - o.RumUnitsSum = &v -} - -// GetSdsLogsScannedBytesSum returns the SdsLogsScannedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetSdsLogsScannedBytesSum() int64 { - if o == nil || o.SdsLogsScannedBytesSum == nil { - var ret int64 - return ret - } - return *o.SdsLogsScannedBytesSum -} - -// GetSdsLogsScannedBytesSumOk returns a tuple with the SdsLogsScannedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetSdsLogsScannedBytesSumOk() (*int64, bool) { - if o == nil || o.SdsLogsScannedBytesSum == nil { - return nil, false - } - return o.SdsLogsScannedBytesSum, true -} - -// HasSdsLogsScannedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasSdsLogsScannedBytesSum() bool { - if o != nil && o.SdsLogsScannedBytesSum != nil { - return true - } - - return false -} - -// SetSdsLogsScannedBytesSum gets a reference to the given int64 and assigns it to the SdsLogsScannedBytesSum field. -func (o *UsageSummaryDate) SetSdsLogsScannedBytesSum(v int64) { - o.SdsLogsScannedBytesSum = &v -} - -// GetSdsTotalScannedBytesSum returns the SdsTotalScannedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetSdsTotalScannedBytesSum() int64 { - if o == nil || o.SdsTotalScannedBytesSum == nil { - var ret int64 - return ret - } - return *o.SdsTotalScannedBytesSum -} - -// GetSdsTotalScannedBytesSumOk returns a tuple with the SdsTotalScannedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetSdsTotalScannedBytesSumOk() (*int64, bool) { - if o == nil || o.SdsTotalScannedBytesSum == nil { - return nil, false - } - return o.SdsTotalScannedBytesSum, true -} - -// HasSdsTotalScannedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasSdsTotalScannedBytesSum() bool { - if o != nil && o.SdsTotalScannedBytesSum != nil { - return true - } - - return false -} - -// SetSdsTotalScannedBytesSum gets a reference to the given int64 and assigns it to the SdsTotalScannedBytesSum field. -func (o *UsageSummaryDate) SetSdsTotalScannedBytesSum(v int64) { - o.SdsTotalScannedBytesSum = &v -} - -// GetSyntheticsBrowserCheckCallsCountSum returns the SyntheticsBrowserCheckCallsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetSyntheticsBrowserCheckCallsCountSum() int64 { - if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { - var ret int64 - return ret - } - return *o.SyntheticsBrowserCheckCallsCountSum -} - -// GetSyntheticsBrowserCheckCallsCountSumOk returns a tuple with the SyntheticsBrowserCheckCallsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetSyntheticsBrowserCheckCallsCountSumOk() (*int64, bool) { - if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { - return nil, false - } - return o.SyntheticsBrowserCheckCallsCountSum, true -} - -// HasSyntheticsBrowserCheckCallsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasSyntheticsBrowserCheckCallsCountSum() bool { - if o != nil && o.SyntheticsBrowserCheckCallsCountSum != nil { - return true - } - - return false -} - -// SetSyntheticsBrowserCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsBrowserCheckCallsCountSum field. -func (o *UsageSummaryDate) SetSyntheticsBrowserCheckCallsCountSum(v int64) { - o.SyntheticsBrowserCheckCallsCountSum = &v -} - -// GetSyntheticsCheckCallsCountSum returns the SyntheticsCheckCallsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetSyntheticsCheckCallsCountSum() int64 { - if o == nil || o.SyntheticsCheckCallsCountSum == nil { - var ret int64 - return ret - } - return *o.SyntheticsCheckCallsCountSum -} - -// GetSyntheticsCheckCallsCountSumOk returns a tuple with the SyntheticsCheckCallsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetSyntheticsCheckCallsCountSumOk() (*int64, bool) { - if o == nil || o.SyntheticsCheckCallsCountSum == nil { - return nil, false - } - return o.SyntheticsCheckCallsCountSum, true -} - -// HasSyntheticsCheckCallsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasSyntheticsCheckCallsCountSum() bool { - if o != nil && o.SyntheticsCheckCallsCountSum != nil { - return true - } - - return false -} - -// SetSyntheticsCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsCheckCallsCountSum field. -func (o *UsageSummaryDate) SetSyntheticsCheckCallsCountSum(v int64) { - o.SyntheticsCheckCallsCountSum = &v -} - -// GetTraceSearchIndexedEventsCountSum returns the TraceSearchIndexedEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetTraceSearchIndexedEventsCountSum() int64 { - if o == nil || o.TraceSearchIndexedEventsCountSum == nil { - var ret int64 - return ret - } - return *o.TraceSearchIndexedEventsCountSum -} - -// GetTraceSearchIndexedEventsCountSumOk returns a tuple with the TraceSearchIndexedEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetTraceSearchIndexedEventsCountSumOk() (*int64, bool) { - if o == nil || o.TraceSearchIndexedEventsCountSum == nil { - return nil, false - } - return o.TraceSearchIndexedEventsCountSum, true -} - -// HasTraceSearchIndexedEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasTraceSearchIndexedEventsCountSum() bool { - if o != nil && o.TraceSearchIndexedEventsCountSum != nil { - return true - } - - return false -} - -// SetTraceSearchIndexedEventsCountSum gets a reference to the given int64 and assigns it to the TraceSearchIndexedEventsCountSum field. -func (o *UsageSummaryDate) SetTraceSearchIndexedEventsCountSum(v int64) { - o.TraceSearchIndexedEventsCountSum = &v -} - -// GetTwolIngestedEventsBytesSum returns the TwolIngestedEventsBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetTwolIngestedEventsBytesSum() int64 { - if o == nil || o.TwolIngestedEventsBytesSum == nil { - var ret int64 - return ret - } - return *o.TwolIngestedEventsBytesSum -} - -// GetTwolIngestedEventsBytesSumOk returns a tuple with the TwolIngestedEventsBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetTwolIngestedEventsBytesSumOk() (*int64, bool) { - if o == nil || o.TwolIngestedEventsBytesSum == nil { - return nil, false - } - return o.TwolIngestedEventsBytesSum, true -} - -// HasTwolIngestedEventsBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasTwolIngestedEventsBytesSum() bool { - if o != nil && o.TwolIngestedEventsBytesSum != nil { - return true - } - - return false -} - -// SetTwolIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the TwolIngestedEventsBytesSum field. -func (o *UsageSummaryDate) SetTwolIngestedEventsBytesSum(v int64) { - o.TwolIngestedEventsBytesSum = &v -} - -// GetVsphereHostTop99p returns the VsphereHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDate) GetVsphereHostTop99p() int64 { - if o == nil || o.VsphereHostTop99p == nil { - var ret int64 - return ret - } - return *o.VsphereHostTop99p -} - -// GetVsphereHostTop99pOk returns a tuple with the VsphereHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDate) GetVsphereHostTop99pOk() (*int64, bool) { - if o == nil || o.VsphereHostTop99p == nil { - return nil, false - } - return o.VsphereHostTop99p, true -} - -// HasVsphereHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDate) HasVsphereHostTop99p() bool { - if o != nil && o.VsphereHostTop99p != nil { - return true - } - - return false -} - -// SetVsphereHostTop99p gets a reference to the given int64 and assigns it to the VsphereHostTop99p field. -func (o *UsageSummaryDate) SetVsphereHostTop99p(v int64) { - o.VsphereHostTop99p = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSummaryDate) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AgentHostTop99p != nil { - toSerialize["agent_host_top99p"] = o.AgentHostTop99p - } - if o.ApmAzureAppServiceHostTop99p != nil { - toSerialize["apm_azure_app_service_host_top99p"] = o.ApmAzureAppServiceHostTop99p - } - if o.ApmHostTop99p != nil { - toSerialize["apm_host_top99p"] = o.ApmHostTop99p - } - if o.AuditLogsLinesIndexedSum != nil { - toSerialize["audit_logs_lines_indexed_sum"] = o.AuditLogsLinesIndexedSum - } - if o.AvgProfiledFargateTasks != nil { - toSerialize["avg_profiled_fargate_tasks"] = o.AvgProfiledFargateTasks - } - if o.AwsHostTop99p != nil { - toSerialize["aws_host_top99p"] = o.AwsHostTop99p - } - if o.AwsLambdaFuncCount != nil { - toSerialize["aws_lambda_func_count"] = o.AwsLambdaFuncCount - } - if o.AwsLambdaInvocationsSum != nil { - toSerialize["aws_lambda_invocations_sum"] = o.AwsLambdaInvocationsSum - } - if o.AzureAppServiceTop99p != nil { - toSerialize["azure_app_service_top99p"] = o.AzureAppServiceTop99p - } - if o.BillableIngestedBytesSum != nil { - toSerialize["billable_ingested_bytes_sum"] = o.BillableIngestedBytesSum - } - if o.BrowserRumLiteSessionCountSum != nil { - toSerialize["browser_rum_lite_session_count_sum"] = o.BrowserRumLiteSessionCountSum - } - if o.BrowserRumReplaySessionCountSum != nil { - toSerialize["browser_rum_replay_session_count_sum"] = o.BrowserRumReplaySessionCountSum - } - if o.BrowserRumUnitsSum != nil { - toSerialize["browser_rum_units_sum"] = o.BrowserRumUnitsSum - } - if o.CiPipelineIndexedSpansSum != nil { - toSerialize["ci_pipeline_indexed_spans_sum"] = o.CiPipelineIndexedSpansSum - } - if o.CiTestIndexedSpansSum != nil { - toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum - } - if o.CiVisibilityPipelineCommittersHwm != nil { - toSerialize["ci_visibility_pipeline_committers_hwm"] = o.CiVisibilityPipelineCommittersHwm - } - if o.CiVisibilityTestCommittersHwm != nil { - toSerialize["ci_visibility_test_committers_hwm"] = o.CiVisibilityTestCommittersHwm - } - if o.ContainerAvg != nil { - toSerialize["container_avg"] = o.ContainerAvg - } - if o.ContainerHwm != nil { - toSerialize["container_hwm"] = o.ContainerHwm - } - if o.CspmAasHostTop99p != nil { - toSerialize["cspm_aas_host_top99p"] = o.CspmAasHostTop99p - } - if o.CspmAzureHostTop99p != nil { - toSerialize["cspm_azure_host_top99p"] = o.CspmAzureHostTop99p - } - if o.CspmContainerAvg != nil { - toSerialize["cspm_container_avg"] = o.CspmContainerAvg - } - if o.CspmContainerHwm != nil { - toSerialize["cspm_container_hwm"] = o.CspmContainerHwm - } - if o.CspmHostTop99p != nil { - toSerialize["cspm_host_top99p"] = o.CspmHostTop99p - } - if o.CustomTsAvg != nil { - toSerialize["custom_ts_avg"] = o.CustomTsAvg - } - if o.CwsContainerCountAvg != nil { - toSerialize["cws_container_count_avg"] = o.CwsContainerCountAvg - } - if o.CwsHostTop99p != nil { - toSerialize["cws_host_top99p"] = o.CwsHostTop99p - } - if o.Date != nil { - if o.Date.Nanosecond() == 0 { - toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.DbmHostTop99p != nil { - toSerialize["dbm_host_top99p"] = o.DbmHostTop99p - } - if o.DbmQueriesCountAvg != nil { - toSerialize["dbm_queries_count_avg"] = o.DbmQueriesCountAvg - } - if o.FargateTasksCountAvg != nil { - toSerialize["fargate_tasks_count_avg"] = o.FargateTasksCountAvg - } - if o.FargateTasksCountHwm != nil { - toSerialize["fargate_tasks_count_hwm"] = o.FargateTasksCountHwm - } - if o.GcpHostTop99p != nil { - toSerialize["gcp_host_top99p"] = o.GcpHostTop99p - } - if o.HerokuHostTop99p != nil { - toSerialize["heroku_host_top99p"] = o.HerokuHostTop99p - } - if o.IncidentManagementMonthlyActiveUsersHwm != nil { - toSerialize["incident_management_monthly_active_users_hwm"] = o.IncidentManagementMonthlyActiveUsersHwm - } - if o.IndexedEventsCountSum != nil { - toSerialize["indexed_events_count_sum"] = o.IndexedEventsCountSum - } - if o.InfraHostTop99p != nil { - toSerialize["infra_host_top99p"] = o.InfraHostTop99p - } - if o.IngestedEventsBytesSum != nil { - toSerialize["ingested_events_bytes_sum"] = o.IngestedEventsBytesSum - } - if o.IotDeviceSum != nil { - toSerialize["iot_device_sum"] = o.IotDeviceSum - } - if o.IotDeviceTop99p != nil { - toSerialize["iot_device_top99p"] = o.IotDeviceTop99p - } - if o.MobileRumLiteSessionCountSum != nil { - toSerialize["mobile_rum_lite_session_count_sum"] = o.MobileRumLiteSessionCountSum - } - if o.MobileRumSessionCountAndroidSum != nil { - toSerialize["mobile_rum_session_count_android_sum"] = o.MobileRumSessionCountAndroidSum - } - if o.MobileRumSessionCountIosSum != nil { - toSerialize["mobile_rum_session_count_ios_sum"] = o.MobileRumSessionCountIosSum - } - if o.MobileRumSessionCountReactnativeSum != nil { - toSerialize["mobile_rum_session_count_reactnative_sum"] = o.MobileRumSessionCountReactnativeSum - } - if o.MobileRumSessionCountSum != nil { - toSerialize["mobile_rum_session_count_sum"] = o.MobileRumSessionCountSum - } - if o.MobileRumUnitsSum != nil { - toSerialize["mobile_rum_units_sum"] = o.MobileRumUnitsSum - } - if o.NetflowIndexedEventsCountSum != nil { - toSerialize["netflow_indexed_events_count_sum"] = o.NetflowIndexedEventsCountSum - } - if o.NpmHostTop99p != nil { - toSerialize["npm_host_top99p"] = o.NpmHostTop99p - } - if o.ObservabilityPipelinesBytesProcessedSum != nil { - toSerialize["observability_pipelines_bytes_processed_sum"] = o.ObservabilityPipelinesBytesProcessedSum - } - if o.OnlineArchiveEventsCountSum != nil { - toSerialize["online_archive_events_count_sum"] = o.OnlineArchiveEventsCountSum - } - if o.OpentelemetryHostTop99p != nil { - toSerialize["opentelemetry_host_top99p"] = o.OpentelemetryHostTop99p - } - if o.Orgs != nil { - toSerialize["orgs"] = o.Orgs - } - if o.ProfilingHostTop99p != nil { - toSerialize["profiling_host_top99p"] = o.ProfilingHostTop99p - } - if o.RumBrowserAndMobileSessionCount != nil { - toSerialize["rum_browser_and_mobile_session_count"] = o.RumBrowserAndMobileSessionCount - } - if o.RumSessionCountSum != nil { - toSerialize["rum_session_count_sum"] = o.RumSessionCountSum - } - if o.RumTotalSessionCountSum != nil { - toSerialize["rum_total_session_count_sum"] = o.RumTotalSessionCountSum - } - if o.RumUnitsSum != nil { - toSerialize["rum_units_sum"] = o.RumUnitsSum - } - if o.SdsLogsScannedBytesSum != nil { - toSerialize["sds_logs_scanned_bytes_sum"] = o.SdsLogsScannedBytesSum - } - if o.SdsTotalScannedBytesSum != nil { - toSerialize["sds_total_scanned_bytes_sum"] = o.SdsTotalScannedBytesSum - } - if o.SyntheticsBrowserCheckCallsCountSum != nil { - toSerialize["synthetics_browser_check_calls_count_sum"] = o.SyntheticsBrowserCheckCallsCountSum - } - if o.SyntheticsCheckCallsCountSum != nil { - toSerialize["synthetics_check_calls_count_sum"] = o.SyntheticsCheckCallsCountSum - } - if o.TraceSearchIndexedEventsCountSum != nil { - toSerialize["trace_search_indexed_events_count_sum"] = o.TraceSearchIndexedEventsCountSum - } - if o.TwolIngestedEventsBytesSum != nil { - toSerialize["twol_ingested_events_bytes_sum"] = o.TwolIngestedEventsBytesSum - } - if o.VsphereHostTop99p != nil { - toSerialize["vsphere_host_top99p"] = o.VsphereHostTop99p - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` - ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` - ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` - AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` - AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` - AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` - AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` - AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` - AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` - BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` - BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` - BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` - BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` - CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` - CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` - CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` - CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` - ContainerAvg *int64 `json:"container_avg,omitempty"` - ContainerHwm *int64 `json:"container_hwm,omitempty"` - CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` - CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` - CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` - CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` - CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` - CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` - CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` - CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` - Date *time.Time `json:"date,omitempty"` - DbmHostTop99p *int64 `json:"dbm_host_top99p,omitempty"` - DbmQueriesCountAvg *int64 `json:"dbm_queries_count_avg,omitempty"` - FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` - FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` - GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` - HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` - IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` - IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` - InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` - IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` - IotDeviceSum *int64 `json:"iot_device_sum,omitempty"` - IotDeviceTop99p *int64 `json:"iot_device_top99p,omitempty"` - MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` - MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` - MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` - MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` - MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` - MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` - NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` - NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` - ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` - OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` - OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` - Orgs []UsageSummaryDateOrg `json:"orgs,omitempty"` - ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` - RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` - RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` - RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` - RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` - SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` - SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` - SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` - SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` - TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` - TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` - VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AgentHostTop99p = all.AgentHostTop99p - o.ApmAzureAppServiceHostTop99p = all.ApmAzureAppServiceHostTop99p - o.ApmHostTop99p = all.ApmHostTop99p - o.AuditLogsLinesIndexedSum = all.AuditLogsLinesIndexedSum - o.AvgProfiledFargateTasks = all.AvgProfiledFargateTasks - o.AwsHostTop99p = all.AwsHostTop99p - o.AwsLambdaFuncCount = all.AwsLambdaFuncCount - o.AwsLambdaInvocationsSum = all.AwsLambdaInvocationsSum - o.AzureAppServiceTop99p = all.AzureAppServiceTop99p - o.BillableIngestedBytesSum = all.BillableIngestedBytesSum - o.BrowserRumLiteSessionCountSum = all.BrowserRumLiteSessionCountSum - o.BrowserRumReplaySessionCountSum = all.BrowserRumReplaySessionCountSum - o.BrowserRumUnitsSum = all.BrowserRumUnitsSum - o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum - o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum - o.CiVisibilityPipelineCommittersHwm = all.CiVisibilityPipelineCommittersHwm - o.CiVisibilityTestCommittersHwm = all.CiVisibilityTestCommittersHwm - o.ContainerAvg = all.ContainerAvg - o.ContainerHwm = all.ContainerHwm - o.CspmAasHostTop99p = all.CspmAasHostTop99p - o.CspmAzureHostTop99p = all.CspmAzureHostTop99p - o.CspmContainerAvg = all.CspmContainerAvg - o.CspmContainerHwm = all.CspmContainerHwm - o.CspmHostTop99p = all.CspmHostTop99p - o.CustomTsAvg = all.CustomTsAvg - o.CwsContainerCountAvg = all.CwsContainerCountAvg - o.CwsHostTop99p = all.CwsHostTop99p - o.Date = all.Date - o.DbmHostTop99p = all.DbmHostTop99p - o.DbmQueriesCountAvg = all.DbmQueriesCountAvg - o.FargateTasksCountAvg = all.FargateTasksCountAvg - o.FargateTasksCountHwm = all.FargateTasksCountHwm - o.GcpHostTop99p = all.GcpHostTop99p - o.HerokuHostTop99p = all.HerokuHostTop99p - o.IncidentManagementMonthlyActiveUsersHwm = all.IncidentManagementMonthlyActiveUsersHwm - o.IndexedEventsCountSum = all.IndexedEventsCountSum - o.InfraHostTop99p = all.InfraHostTop99p - o.IngestedEventsBytesSum = all.IngestedEventsBytesSum - o.IotDeviceSum = all.IotDeviceSum - o.IotDeviceTop99p = all.IotDeviceTop99p - o.MobileRumLiteSessionCountSum = all.MobileRumLiteSessionCountSum - o.MobileRumSessionCountAndroidSum = all.MobileRumSessionCountAndroidSum - o.MobileRumSessionCountIosSum = all.MobileRumSessionCountIosSum - o.MobileRumSessionCountReactnativeSum = all.MobileRumSessionCountReactnativeSum - o.MobileRumSessionCountSum = all.MobileRumSessionCountSum - o.MobileRumUnitsSum = all.MobileRumUnitsSum - o.NetflowIndexedEventsCountSum = all.NetflowIndexedEventsCountSum - o.NpmHostTop99p = all.NpmHostTop99p - o.ObservabilityPipelinesBytesProcessedSum = all.ObservabilityPipelinesBytesProcessedSum - o.OnlineArchiveEventsCountSum = all.OnlineArchiveEventsCountSum - o.OpentelemetryHostTop99p = all.OpentelemetryHostTop99p - o.Orgs = all.Orgs - o.ProfilingHostTop99p = all.ProfilingHostTop99p - o.RumBrowserAndMobileSessionCount = all.RumBrowserAndMobileSessionCount - o.RumSessionCountSum = all.RumSessionCountSum - o.RumTotalSessionCountSum = all.RumTotalSessionCountSum - o.RumUnitsSum = all.RumUnitsSum - o.SdsLogsScannedBytesSum = all.SdsLogsScannedBytesSum - o.SdsTotalScannedBytesSum = all.SdsTotalScannedBytesSum - o.SyntheticsBrowserCheckCallsCountSum = all.SyntheticsBrowserCheckCallsCountSum - o.SyntheticsCheckCallsCountSum = all.SyntheticsCheckCallsCountSum - o.TraceSearchIndexedEventsCountSum = all.TraceSearchIndexedEventsCountSum - o.TwolIngestedEventsBytesSum = all.TwolIngestedEventsBytesSum - o.VsphereHostTop99p = all.VsphereHostTop99p - return nil -} diff --git a/api/v1/datadog/model_usage_summary_date_org.go b/api/v1/datadog/model_usage_summary_date_org.go deleted file mode 100644 index 593418f3bb9..00000000000 --- a/api/v1/datadog/model_usage_summary_date_org.go +++ /dev/null @@ -1,2598 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSummaryDateOrg Global hourly report of all data billed by Datadog for a given organization. -type UsageSummaryDateOrg struct { - // Shows the 99th percentile of all agent hosts over all hours in the current date for the given org. - AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` - // Shows the 99th percentile of all Azure app services using APM over all hours in the current date for the given org. - ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` - // Shows the 99th percentile of all distinct APM hosts over all hours in the current date for the given org. - ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` - // Shows the sum of all audit logs lines indexed over all hours in the current date for the given org. - AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` - // The average profiled task count for Fargate Profiling. - AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` - // Shows the 99th percentile of all AWS hosts over all hours in the current date for the given org. - AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` - // Shows the sum of all AWS Lambda invocations over all hours in the current date for the given org. - AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` - // Shows the sum of all AWS Lambda invocations over all hours in the current date for the given org. - AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` - // Shows the 99th percentile of all Azure app services over all hours in the current date for the given org. - AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` - // Shows the sum of all log bytes ingested over all hours in the current date for the given org. - BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` - // Shows the sum of all browser lite sessions over all hours in the current date for the given org. - BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` - // Shows the sum of all browser replay sessions over all hours in the current date for the given org. - BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` - // Shows the sum of all browser RUM units over all hours in the current date for the given org. - BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` - // Shows the sum of all CI pipeline indexed spans over all hours in the current date for the given org. - CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` - // Shows the sum of all CI test indexed spans over all hours in the current date for the given org. - CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` - // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current date for the given org. - CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` - // Shows the high-water mark of all CI visibility test committers over all hours in the current date for the given org. - CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` - // Shows the average of all distinct containers over all hours in the current date for the given org. - ContainerAvg *int64 `json:"container_avg,omitempty"` - // Shows the high-water mark of all distinct containers over all hours in the current date for the given org. - ContainerHwm *int64 `json:"container_hwm,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management Azure app services hosts over all hours in the current date for the given org. - CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management Azure hosts over all hours in the current date for the given org. - CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` - // Shows the average number of Cloud Security Posture Management containers over all hours in the current date for the given org. - CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` - // Shows the high-water mark of Cloud Security Posture Management containers over all hours in the current date for the given org. - CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management hosts over all hours in the current date for the given org. - CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` - // Shows the average number of distinct custom metrics over all hours in the current date for the given org. - CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` - // Shows the average of all distinct Cloud Workload Security containers over all hours in the current date for the given org. - CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` - // Shows the 99th percentile of all Cloud Workload Security hosts over all hours in the current date for the given org. - CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` - // Shows the 99th percentile of all Database Monitoring hosts over all hours in the current month for the given org. - DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` - // Shows the average of all distinct Database Monitoring normalized queries over all hours in the current month for the given org. - DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` - // The average task count for Fargate. - FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` - // Shows the high-water mark of all Fargate tasks over all hours in the current date for the given org. - FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` - // Shows the 99th percentile of all GCP hosts over all hours in the current date for the given org. - GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` - // Shows the 99th percentile of all Heroku dynos over all hours in the current date for the given org. - HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` - // The organization id. - Id *string `json:"id,omitempty"` - // Shows the high-water mark of incident management monthly active users over all hours in the current date for the given org. - IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` - // Shows the sum of all log events indexed over all hours in the current date for the given org. - IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` - // Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for the given org. - InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` - // Shows the sum of all log bytes ingested over all hours in the current date for the given org. - IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` - // Shows the sum of all IoT devices over all hours in the current date for the given org. - IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` - // Shows the 99th percentile of all IoT devices over all hours in the current date for the given org. - IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` - // Shows the sum of all mobile lite sessions over all hours in the current date for the given org. - MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for the given org. - MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for the given org. - MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on React Native over all hours in the current date for the given org. - MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions over all hours in the current date for the given org. - MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` - // Shows the sum of all mobile RUM units over all hours in the current date for the given org. - MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` - // The organization name. - Name *string `json:"name,omitempty"` - // Shows the sum of all Network flows indexed over all hours in the current date for the given org. - NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` - // Shows the 99th percentile of all distinct Networks hosts over all hours in the current date for the given org. - NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` - // Sum of all observability pipelines bytes processed over all hours in the current date for the given org. - ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` - // Sum of all online archived events over all hours in the current date for the given org. - OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` - // Shows the 99th percentile of all hosts reported by the Datadog exporter for the OpenTelemetry Collector over all hours in the current date for the given org. - OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` - // Shows the 99th percentile of all profiled hosts over all hours in the current date for the given org. - ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` - // The organization public id. - PublicId *string `json:"public_id,omitempty"` - // Shows the sum of all mobile sessions and all browser lite and legacy sessions over all hours in the current date for the given org. - RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` - // Shows the sum of all browser RUM Lite Sessions over all hours in the current date for the given org. - RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` - // Shows the sum of RUM Sessions (browser and mobile) over all hours in the current date for the given org. - RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` - // Shows the sum of all browser and mobile RUM units over all hours in the current date for the given org. - RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` - // Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for the given org. - SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` - // Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for the given org. - SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` - // Shows the sum of all Synthetic browser tests over all hours in the current date for the given org. - SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` - // Shows the sum of all Synthetic API tests over all hours in the current date for the given org. - SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` - // Shows the sum of all Indexed Spans indexed over all hours in the current date for the given org. - TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` - // Shows the sum of all ingested APM span bytes over all hours in the current date for the given org. - TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` - // Shows the 99th percentile of all vSphere hosts over all hours in the current date for the given org. - VsphereHostTop99p *int64 `json:"vsphere_host_top99p,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{} -} - -// NewUsageSummaryDateOrg instantiates a new UsageSummaryDateOrg 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 NewUsageSummaryDateOrg() *UsageSummaryDateOrg { - this := UsageSummaryDateOrg{} - return &this -} - -// NewUsageSummaryDateOrgWithDefaults instantiates a new UsageSummaryDateOrg 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 NewUsageSummaryDateOrgWithDefaults() *UsageSummaryDateOrg { - this := UsageSummaryDateOrg{} - return &this -} - -// GetAgentHostTop99p returns the AgentHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetAgentHostTop99p() int64 { - if o == nil || o.AgentHostTop99p == nil { - var ret int64 - return ret - } - return *o.AgentHostTop99p -} - -// GetAgentHostTop99pOk returns a tuple with the AgentHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetAgentHostTop99pOk() (*int64, bool) { - if o == nil || o.AgentHostTop99p == nil { - return nil, false - } - return o.AgentHostTop99p, true -} - -// HasAgentHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasAgentHostTop99p() bool { - if o != nil && o.AgentHostTop99p != nil { - return true - } - - return false -} - -// SetAgentHostTop99p gets a reference to the given int64 and assigns it to the AgentHostTop99p field. -func (o *UsageSummaryDateOrg) SetAgentHostTop99p(v int64) { - o.AgentHostTop99p = &v -} - -// GetApmAzureAppServiceHostTop99p returns the ApmAzureAppServiceHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetApmAzureAppServiceHostTop99p() int64 { - if o == nil || o.ApmAzureAppServiceHostTop99p == nil { - var ret int64 - return ret - } - return *o.ApmAzureAppServiceHostTop99p -} - -// GetApmAzureAppServiceHostTop99pOk returns a tuple with the ApmAzureAppServiceHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetApmAzureAppServiceHostTop99pOk() (*int64, bool) { - if o == nil || o.ApmAzureAppServiceHostTop99p == nil { - return nil, false - } - return o.ApmAzureAppServiceHostTop99p, true -} - -// HasApmAzureAppServiceHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasApmAzureAppServiceHostTop99p() bool { - if o != nil && o.ApmAzureAppServiceHostTop99p != nil { - return true - } - - return false -} - -// SetApmAzureAppServiceHostTop99p gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostTop99p field. -func (o *UsageSummaryDateOrg) SetApmAzureAppServiceHostTop99p(v int64) { - o.ApmAzureAppServiceHostTop99p = &v -} - -// GetApmHostTop99p returns the ApmHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetApmHostTop99p() int64 { - if o == nil || o.ApmHostTop99p == nil { - var ret int64 - return ret - } - return *o.ApmHostTop99p -} - -// GetApmHostTop99pOk returns a tuple with the ApmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetApmHostTop99pOk() (*int64, bool) { - if o == nil || o.ApmHostTop99p == nil { - return nil, false - } - return o.ApmHostTop99p, true -} - -// HasApmHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasApmHostTop99p() bool { - if o != nil && o.ApmHostTop99p != nil { - return true - } - - return false -} - -// SetApmHostTop99p gets a reference to the given int64 and assigns it to the ApmHostTop99p field. -func (o *UsageSummaryDateOrg) SetApmHostTop99p(v int64) { - o.ApmHostTop99p = &v -} - -// GetAuditLogsLinesIndexedSum returns the AuditLogsLinesIndexedSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetAuditLogsLinesIndexedSum() int64 { - if o == nil || o.AuditLogsLinesIndexedSum == nil { - var ret int64 - return ret - } - return *o.AuditLogsLinesIndexedSum -} - -// GetAuditLogsLinesIndexedSumOk returns a tuple with the AuditLogsLinesIndexedSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetAuditLogsLinesIndexedSumOk() (*int64, bool) { - if o == nil || o.AuditLogsLinesIndexedSum == nil { - return nil, false - } - return o.AuditLogsLinesIndexedSum, true -} - -// HasAuditLogsLinesIndexedSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasAuditLogsLinesIndexedSum() bool { - if o != nil && o.AuditLogsLinesIndexedSum != nil { - return true - } - - return false -} - -// SetAuditLogsLinesIndexedSum gets a reference to the given int64 and assigns it to the AuditLogsLinesIndexedSum field. -func (o *UsageSummaryDateOrg) SetAuditLogsLinesIndexedSum(v int64) { - o.AuditLogsLinesIndexedSum = &v -} - -// GetAvgProfiledFargateTasks returns the AvgProfiledFargateTasks field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetAvgProfiledFargateTasks() int64 { - if o == nil || o.AvgProfiledFargateTasks == nil { - var ret int64 - return ret - } - return *o.AvgProfiledFargateTasks -} - -// GetAvgProfiledFargateTasksOk returns a tuple with the AvgProfiledFargateTasks field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetAvgProfiledFargateTasksOk() (*int64, bool) { - if o == nil || o.AvgProfiledFargateTasks == nil { - return nil, false - } - return o.AvgProfiledFargateTasks, true -} - -// HasAvgProfiledFargateTasks returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasAvgProfiledFargateTasks() bool { - if o != nil && o.AvgProfiledFargateTasks != nil { - return true - } - - return false -} - -// SetAvgProfiledFargateTasks gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasks field. -func (o *UsageSummaryDateOrg) SetAvgProfiledFargateTasks(v int64) { - o.AvgProfiledFargateTasks = &v -} - -// GetAwsHostTop99p returns the AwsHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetAwsHostTop99p() int64 { - if o == nil || o.AwsHostTop99p == nil { - var ret int64 - return ret - } - return *o.AwsHostTop99p -} - -// GetAwsHostTop99pOk returns a tuple with the AwsHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetAwsHostTop99pOk() (*int64, bool) { - if o == nil || o.AwsHostTop99p == nil { - return nil, false - } - return o.AwsHostTop99p, true -} - -// HasAwsHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasAwsHostTop99p() bool { - if o != nil && o.AwsHostTop99p != nil { - return true - } - - return false -} - -// SetAwsHostTop99p gets a reference to the given int64 and assigns it to the AwsHostTop99p field. -func (o *UsageSummaryDateOrg) SetAwsHostTop99p(v int64) { - o.AwsHostTop99p = &v -} - -// GetAwsLambdaFuncCount returns the AwsLambdaFuncCount field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetAwsLambdaFuncCount() int64 { - if o == nil || o.AwsLambdaFuncCount == nil { - var ret int64 - return ret - } - return *o.AwsLambdaFuncCount -} - -// GetAwsLambdaFuncCountOk returns a tuple with the AwsLambdaFuncCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetAwsLambdaFuncCountOk() (*int64, bool) { - if o == nil || o.AwsLambdaFuncCount == nil { - return nil, false - } - return o.AwsLambdaFuncCount, true -} - -// HasAwsLambdaFuncCount returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasAwsLambdaFuncCount() bool { - if o != nil && o.AwsLambdaFuncCount != nil { - return true - } - - return false -} - -// SetAwsLambdaFuncCount gets a reference to the given int64 and assigns it to the AwsLambdaFuncCount field. -func (o *UsageSummaryDateOrg) SetAwsLambdaFuncCount(v int64) { - o.AwsLambdaFuncCount = &v -} - -// GetAwsLambdaInvocationsSum returns the AwsLambdaInvocationsSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetAwsLambdaInvocationsSum() int64 { - if o == nil || o.AwsLambdaInvocationsSum == nil { - var ret int64 - return ret - } - return *o.AwsLambdaInvocationsSum -} - -// GetAwsLambdaInvocationsSumOk returns a tuple with the AwsLambdaInvocationsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetAwsLambdaInvocationsSumOk() (*int64, bool) { - if o == nil || o.AwsLambdaInvocationsSum == nil { - return nil, false - } - return o.AwsLambdaInvocationsSum, true -} - -// HasAwsLambdaInvocationsSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasAwsLambdaInvocationsSum() bool { - if o != nil && o.AwsLambdaInvocationsSum != nil { - return true - } - - return false -} - -// SetAwsLambdaInvocationsSum gets a reference to the given int64 and assigns it to the AwsLambdaInvocationsSum field. -func (o *UsageSummaryDateOrg) SetAwsLambdaInvocationsSum(v int64) { - o.AwsLambdaInvocationsSum = &v -} - -// GetAzureAppServiceTop99p returns the AzureAppServiceTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetAzureAppServiceTop99p() int64 { - if o == nil || o.AzureAppServiceTop99p == nil { - var ret int64 - return ret - } - return *o.AzureAppServiceTop99p -} - -// GetAzureAppServiceTop99pOk returns a tuple with the AzureAppServiceTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetAzureAppServiceTop99pOk() (*int64, bool) { - if o == nil || o.AzureAppServiceTop99p == nil { - return nil, false - } - return o.AzureAppServiceTop99p, true -} - -// HasAzureAppServiceTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasAzureAppServiceTop99p() bool { - if o != nil && o.AzureAppServiceTop99p != nil { - return true - } - - return false -} - -// SetAzureAppServiceTop99p gets a reference to the given int64 and assigns it to the AzureAppServiceTop99p field. -func (o *UsageSummaryDateOrg) SetAzureAppServiceTop99p(v int64) { - o.AzureAppServiceTop99p = &v -} - -// GetBillableIngestedBytesSum returns the BillableIngestedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetBillableIngestedBytesSum() int64 { - if o == nil || o.BillableIngestedBytesSum == nil { - var ret int64 - return ret - } - return *o.BillableIngestedBytesSum -} - -// GetBillableIngestedBytesSumOk returns a tuple with the BillableIngestedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetBillableIngestedBytesSumOk() (*int64, bool) { - if o == nil || o.BillableIngestedBytesSum == nil { - return nil, false - } - return o.BillableIngestedBytesSum, true -} - -// HasBillableIngestedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasBillableIngestedBytesSum() bool { - if o != nil && o.BillableIngestedBytesSum != nil { - return true - } - - return false -} - -// SetBillableIngestedBytesSum gets a reference to the given int64 and assigns it to the BillableIngestedBytesSum field. -func (o *UsageSummaryDateOrg) SetBillableIngestedBytesSum(v int64) { - o.BillableIngestedBytesSum = &v -} - -// GetBrowserRumLiteSessionCountSum returns the BrowserRumLiteSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetBrowserRumLiteSessionCountSum() int64 { - if o == nil || o.BrowserRumLiteSessionCountSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumLiteSessionCountSum -} - -// GetBrowserRumLiteSessionCountSumOk returns a tuple with the BrowserRumLiteSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetBrowserRumLiteSessionCountSumOk() (*int64, bool) { - if o == nil || o.BrowserRumLiteSessionCountSum == nil { - return nil, false - } - return o.BrowserRumLiteSessionCountSum, true -} - -// HasBrowserRumLiteSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasBrowserRumLiteSessionCountSum() bool { - if o != nil && o.BrowserRumLiteSessionCountSum != nil { - return true - } - - return false -} - -// SetBrowserRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumLiteSessionCountSum field. -func (o *UsageSummaryDateOrg) SetBrowserRumLiteSessionCountSum(v int64) { - o.BrowserRumLiteSessionCountSum = &v -} - -// GetBrowserRumReplaySessionCountSum returns the BrowserRumReplaySessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetBrowserRumReplaySessionCountSum() int64 { - if o == nil || o.BrowserRumReplaySessionCountSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumReplaySessionCountSum -} - -// GetBrowserRumReplaySessionCountSumOk returns a tuple with the BrowserRumReplaySessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetBrowserRumReplaySessionCountSumOk() (*int64, bool) { - if o == nil || o.BrowserRumReplaySessionCountSum == nil { - return nil, false - } - return o.BrowserRumReplaySessionCountSum, true -} - -// HasBrowserRumReplaySessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasBrowserRumReplaySessionCountSum() bool { - if o != nil && o.BrowserRumReplaySessionCountSum != nil { - return true - } - - return false -} - -// SetBrowserRumReplaySessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumReplaySessionCountSum field. -func (o *UsageSummaryDateOrg) SetBrowserRumReplaySessionCountSum(v int64) { - o.BrowserRumReplaySessionCountSum = &v -} - -// GetBrowserRumUnitsSum returns the BrowserRumUnitsSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetBrowserRumUnitsSum() int64 { - if o == nil || o.BrowserRumUnitsSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumUnitsSum -} - -// GetBrowserRumUnitsSumOk returns a tuple with the BrowserRumUnitsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetBrowserRumUnitsSumOk() (*int64, bool) { - if o == nil || o.BrowserRumUnitsSum == nil { - return nil, false - } - return o.BrowserRumUnitsSum, true -} - -// HasBrowserRumUnitsSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasBrowserRumUnitsSum() bool { - if o != nil && o.BrowserRumUnitsSum != nil { - return true - } - - return false -} - -// SetBrowserRumUnitsSum gets a reference to the given int64 and assigns it to the BrowserRumUnitsSum field. -func (o *UsageSummaryDateOrg) SetBrowserRumUnitsSum(v int64) { - o.BrowserRumUnitsSum = &v -} - -// GetCiPipelineIndexedSpansSum returns the CiPipelineIndexedSpansSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCiPipelineIndexedSpansSum() int64 { - if o == nil || o.CiPipelineIndexedSpansSum == nil { - var ret int64 - return ret - } - return *o.CiPipelineIndexedSpansSum -} - -// GetCiPipelineIndexedSpansSumOk returns a tuple with the CiPipelineIndexedSpansSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCiPipelineIndexedSpansSumOk() (*int64, bool) { - if o == nil || o.CiPipelineIndexedSpansSum == nil { - return nil, false - } - return o.CiPipelineIndexedSpansSum, true -} - -// HasCiPipelineIndexedSpansSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCiPipelineIndexedSpansSum() bool { - if o != nil && o.CiPipelineIndexedSpansSum != nil { - return true - } - - return false -} - -// SetCiPipelineIndexedSpansSum gets a reference to the given int64 and assigns it to the CiPipelineIndexedSpansSum field. -func (o *UsageSummaryDateOrg) SetCiPipelineIndexedSpansSum(v int64) { - o.CiPipelineIndexedSpansSum = &v -} - -// GetCiTestIndexedSpansSum returns the CiTestIndexedSpansSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCiTestIndexedSpansSum() int64 { - if o == nil || o.CiTestIndexedSpansSum == nil { - var ret int64 - return ret - } - return *o.CiTestIndexedSpansSum -} - -// GetCiTestIndexedSpansSumOk returns a tuple with the CiTestIndexedSpansSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCiTestIndexedSpansSumOk() (*int64, bool) { - if o == nil || o.CiTestIndexedSpansSum == nil { - return nil, false - } - return o.CiTestIndexedSpansSum, true -} - -// HasCiTestIndexedSpansSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCiTestIndexedSpansSum() bool { - if o != nil && o.CiTestIndexedSpansSum != nil { - return true - } - - return false -} - -// SetCiTestIndexedSpansSum gets a reference to the given int64 and assigns it to the CiTestIndexedSpansSum field. -func (o *UsageSummaryDateOrg) SetCiTestIndexedSpansSum(v int64) { - o.CiTestIndexedSpansSum = &v -} - -// GetCiVisibilityPipelineCommittersHwm returns the CiVisibilityPipelineCommittersHwm field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCiVisibilityPipelineCommittersHwm() int64 { - if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { - var ret int64 - return ret - } - return *o.CiVisibilityPipelineCommittersHwm -} - -// GetCiVisibilityPipelineCommittersHwmOk returns a tuple with the CiVisibilityPipelineCommittersHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCiVisibilityPipelineCommittersHwmOk() (*int64, bool) { - if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { - return nil, false - } - return o.CiVisibilityPipelineCommittersHwm, true -} - -// HasCiVisibilityPipelineCommittersHwm returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCiVisibilityPipelineCommittersHwm() bool { - if o != nil && o.CiVisibilityPipelineCommittersHwm != nil { - return true - } - - return false -} - -// SetCiVisibilityPipelineCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityPipelineCommittersHwm field. -func (o *UsageSummaryDateOrg) SetCiVisibilityPipelineCommittersHwm(v int64) { - o.CiVisibilityPipelineCommittersHwm = &v -} - -// GetCiVisibilityTestCommittersHwm returns the CiVisibilityTestCommittersHwm field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCiVisibilityTestCommittersHwm() int64 { - if o == nil || o.CiVisibilityTestCommittersHwm == nil { - var ret int64 - return ret - } - return *o.CiVisibilityTestCommittersHwm -} - -// GetCiVisibilityTestCommittersHwmOk returns a tuple with the CiVisibilityTestCommittersHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCiVisibilityTestCommittersHwmOk() (*int64, bool) { - if o == nil || o.CiVisibilityTestCommittersHwm == nil { - return nil, false - } - return o.CiVisibilityTestCommittersHwm, true -} - -// HasCiVisibilityTestCommittersHwm returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCiVisibilityTestCommittersHwm() bool { - if o != nil && o.CiVisibilityTestCommittersHwm != nil { - return true - } - - return false -} - -// SetCiVisibilityTestCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityTestCommittersHwm field. -func (o *UsageSummaryDateOrg) SetCiVisibilityTestCommittersHwm(v int64) { - o.CiVisibilityTestCommittersHwm = &v -} - -// GetContainerAvg returns the ContainerAvg field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetContainerAvg() int64 { - if o == nil || o.ContainerAvg == nil { - var ret int64 - return ret - } - return *o.ContainerAvg -} - -// GetContainerAvgOk returns a tuple with the ContainerAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetContainerAvgOk() (*int64, bool) { - if o == nil || o.ContainerAvg == nil { - return nil, false - } - return o.ContainerAvg, true -} - -// HasContainerAvg returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasContainerAvg() bool { - if o != nil && o.ContainerAvg != nil { - return true - } - - return false -} - -// SetContainerAvg gets a reference to the given int64 and assigns it to the ContainerAvg field. -func (o *UsageSummaryDateOrg) SetContainerAvg(v int64) { - o.ContainerAvg = &v -} - -// GetContainerHwm returns the ContainerHwm field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetContainerHwm() int64 { - if o == nil || o.ContainerHwm == nil { - var ret int64 - return ret - } - return *o.ContainerHwm -} - -// GetContainerHwmOk returns a tuple with the ContainerHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetContainerHwmOk() (*int64, bool) { - if o == nil || o.ContainerHwm == nil { - return nil, false - } - return o.ContainerHwm, true -} - -// HasContainerHwm returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasContainerHwm() bool { - if o != nil && o.ContainerHwm != nil { - return true - } - - return false -} - -// SetContainerHwm gets a reference to the given int64 and assigns it to the ContainerHwm field. -func (o *UsageSummaryDateOrg) SetContainerHwm(v int64) { - o.ContainerHwm = &v -} - -// GetCspmAasHostTop99p returns the CspmAasHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCspmAasHostTop99p() int64 { - if o == nil || o.CspmAasHostTop99p == nil { - var ret int64 - return ret - } - return *o.CspmAasHostTop99p -} - -// GetCspmAasHostTop99pOk returns a tuple with the CspmAasHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCspmAasHostTop99pOk() (*int64, bool) { - if o == nil || o.CspmAasHostTop99p == nil { - return nil, false - } - return o.CspmAasHostTop99p, true -} - -// HasCspmAasHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCspmAasHostTop99p() bool { - if o != nil && o.CspmAasHostTop99p != nil { - return true - } - - return false -} - -// SetCspmAasHostTop99p gets a reference to the given int64 and assigns it to the CspmAasHostTop99p field. -func (o *UsageSummaryDateOrg) SetCspmAasHostTop99p(v int64) { - o.CspmAasHostTop99p = &v -} - -// GetCspmAzureHostTop99p returns the CspmAzureHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCspmAzureHostTop99p() int64 { - if o == nil || o.CspmAzureHostTop99p == nil { - var ret int64 - return ret - } - return *o.CspmAzureHostTop99p -} - -// GetCspmAzureHostTop99pOk returns a tuple with the CspmAzureHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCspmAzureHostTop99pOk() (*int64, bool) { - if o == nil || o.CspmAzureHostTop99p == nil { - return nil, false - } - return o.CspmAzureHostTop99p, true -} - -// HasCspmAzureHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCspmAzureHostTop99p() bool { - if o != nil && o.CspmAzureHostTop99p != nil { - return true - } - - return false -} - -// SetCspmAzureHostTop99p gets a reference to the given int64 and assigns it to the CspmAzureHostTop99p field. -func (o *UsageSummaryDateOrg) SetCspmAzureHostTop99p(v int64) { - o.CspmAzureHostTop99p = &v -} - -// GetCspmContainerAvg returns the CspmContainerAvg field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCspmContainerAvg() int64 { - if o == nil || o.CspmContainerAvg == nil { - var ret int64 - return ret - } - return *o.CspmContainerAvg -} - -// GetCspmContainerAvgOk returns a tuple with the CspmContainerAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCspmContainerAvgOk() (*int64, bool) { - if o == nil || o.CspmContainerAvg == nil { - return nil, false - } - return o.CspmContainerAvg, true -} - -// HasCspmContainerAvg returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCspmContainerAvg() bool { - if o != nil && o.CspmContainerAvg != nil { - return true - } - - return false -} - -// SetCspmContainerAvg gets a reference to the given int64 and assigns it to the CspmContainerAvg field. -func (o *UsageSummaryDateOrg) SetCspmContainerAvg(v int64) { - o.CspmContainerAvg = &v -} - -// GetCspmContainerHwm returns the CspmContainerHwm field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCspmContainerHwm() int64 { - if o == nil || o.CspmContainerHwm == nil { - var ret int64 - return ret - } - return *o.CspmContainerHwm -} - -// GetCspmContainerHwmOk returns a tuple with the CspmContainerHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCspmContainerHwmOk() (*int64, bool) { - if o == nil || o.CspmContainerHwm == nil { - return nil, false - } - return o.CspmContainerHwm, true -} - -// HasCspmContainerHwm returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCspmContainerHwm() bool { - if o != nil && o.CspmContainerHwm != nil { - return true - } - - return false -} - -// SetCspmContainerHwm gets a reference to the given int64 and assigns it to the CspmContainerHwm field. -func (o *UsageSummaryDateOrg) SetCspmContainerHwm(v int64) { - o.CspmContainerHwm = &v -} - -// GetCspmHostTop99p returns the CspmHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCspmHostTop99p() int64 { - if o == nil || o.CspmHostTop99p == nil { - var ret int64 - return ret - } - return *o.CspmHostTop99p -} - -// GetCspmHostTop99pOk returns a tuple with the CspmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCspmHostTop99pOk() (*int64, bool) { - if o == nil || o.CspmHostTop99p == nil { - return nil, false - } - return o.CspmHostTop99p, true -} - -// HasCspmHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCspmHostTop99p() bool { - if o != nil && o.CspmHostTop99p != nil { - return true - } - - return false -} - -// SetCspmHostTop99p gets a reference to the given int64 and assigns it to the CspmHostTop99p field. -func (o *UsageSummaryDateOrg) SetCspmHostTop99p(v int64) { - o.CspmHostTop99p = &v -} - -// GetCustomTsAvg returns the CustomTsAvg field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCustomTsAvg() int64 { - if o == nil || o.CustomTsAvg == nil { - var ret int64 - return ret - } - return *o.CustomTsAvg -} - -// GetCustomTsAvgOk returns a tuple with the CustomTsAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCustomTsAvgOk() (*int64, bool) { - if o == nil || o.CustomTsAvg == nil { - return nil, false - } - return o.CustomTsAvg, true -} - -// HasCustomTsAvg returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCustomTsAvg() bool { - if o != nil && o.CustomTsAvg != nil { - return true - } - - return false -} - -// SetCustomTsAvg gets a reference to the given int64 and assigns it to the CustomTsAvg field. -func (o *UsageSummaryDateOrg) SetCustomTsAvg(v int64) { - o.CustomTsAvg = &v -} - -// GetCwsContainerCountAvg returns the CwsContainerCountAvg field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCwsContainerCountAvg() int64 { - if o == nil || o.CwsContainerCountAvg == nil { - var ret int64 - return ret - } - return *o.CwsContainerCountAvg -} - -// GetCwsContainerCountAvgOk returns a tuple with the CwsContainerCountAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCwsContainerCountAvgOk() (*int64, bool) { - if o == nil || o.CwsContainerCountAvg == nil { - return nil, false - } - return o.CwsContainerCountAvg, true -} - -// HasCwsContainerCountAvg returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCwsContainerCountAvg() bool { - if o != nil && o.CwsContainerCountAvg != nil { - return true - } - - return false -} - -// SetCwsContainerCountAvg gets a reference to the given int64 and assigns it to the CwsContainerCountAvg field. -func (o *UsageSummaryDateOrg) SetCwsContainerCountAvg(v int64) { - o.CwsContainerCountAvg = &v -} - -// GetCwsHostTop99p returns the CwsHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetCwsHostTop99p() int64 { - if o == nil || o.CwsHostTop99p == nil { - var ret int64 - return ret - } - return *o.CwsHostTop99p -} - -// GetCwsHostTop99pOk returns a tuple with the CwsHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetCwsHostTop99pOk() (*int64, bool) { - if o == nil || o.CwsHostTop99p == nil { - return nil, false - } - return o.CwsHostTop99p, true -} - -// HasCwsHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasCwsHostTop99p() bool { - if o != nil && o.CwsHostTop99p != nil { - return true - } - - return false -} - -// SetCwsHostTop99p gets a reference to the given int64 and assigns it to the CwsHostTop99p field. -func (o *UsageSummaryDateOrg) SetCwsHostTop99p(v int64) { - o.CwsHostTop99p = &v -} - -// GetDbmHostTop99pSum returns the DbmHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetDbmHostTop99pSum() int64 { - if o == nil || o.DbmHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.DbmHostTop99pSum -} - -// GetDbmHostTop99pSumOk returns a tuple with the DbmHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetDbmHostTop99pSumOk() (*int64, bool) { - if o == nil || o.DbmHostTop99pSum == nil { - return nil, false - } - return o.DbmHostTop99pSum, true -} - -// HasDbmHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasDbmHostTop99pSum() bool { - if o != nil && o.DbmHostTop99pSum != nil { - return true - } - - return false -} - -// SetDbmHostTop99pSum gets a reference to the given int64 and assigns it to the DbmHostTop99pSum field. -func (o *UsageSummaryDateOrg) SetDbmHostTop99pSum(v int64) { - o.DbmHostTop99pSum = &v -} - -// GetDbmQueriesAvgSum returns the DbmQueriesAvgSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetDbmQueriesAvgSum() int64 { - if o == nil || o.DbmQueriesAvgSum == nil { - var ret int64 - return ret - } - return *o.DbmQueriesAvgSum -} - -// GetDbmQueriesAvgSumOk returns a tuple with the DbmQueriesAvgSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetDbmQueriesAvgSumOk() (*int64, bool) { - if o == nil || o.DbmQueriesAvgSum == nil { - return nil, false - } - return o.DbmQueriesAvgSum, true -} - -// HasDbmQueriesAvgSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasDbmQueriesAvgSum() bool { - if o != nil && o.DbmQueriesAvgSum != nil { - return true - } - - return false -} - -// SetDbmQueriesAvgSum gets a reference to the given int64 and assigns it to the DbmQueriesAvgSum field. -func (o *UsageSummaryDateOrg) SetDbmQueriesAvgSum(v int64) { - o.DbmQueriesAvgSum = &v -} - -// GetFargateTasksCountAvg returns the FargateTasksCountAvg field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetFargateTasksCountAvg() int64 { - if o == nil || o.FargateTasksCountAvg == nil { - var ret int64 - return ret - } - return *o.FargateTasksCountAvg -} - -// GetFargateTasksCountAvgOk returns a tuple with the FargateTasksCountAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetFargateTasksCountAvgOk() (*int64, bool) { - if o == nil || o.FargateTasksCountAvg == nil { - return nil, false - } - return o.FargateTasksCountAvg, true -} - -// HasFargateTasksCountAvg returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasFargateTasksCountAvg() bool { - if o != nil && o.FargateTasksCountAvg != nil { - return true - } - - return false -} - -// SetFargateTasksCountAvg gets a reference to the given int64 and assigns it to the FargateTasksCountAvg field. -func (o *UsageSummaryDateOrg) SetFargateTasksCountAvg(v int64) { - o.FargateTasksCountAvg = &v -} - -// GetFargateTasksCountHwm returns the FargateTasksCountHwm field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetFargateTasksCountHwm() int64 { - if o == nil || o.FargateTasksCountHwm == nil { - var ret int64 - return ret - } - return *o.FargateTasksCountHwm -} - -// GetFargateTasksCountHwmOk returns a tuple with the FargateTasksCountHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetFargateTasksCountHwmOk() (*int64, bool) { - if o == nil || o.FargateTasksCountHwm == nil { - return nil, false - } - return o.FargateTasksCountHwm, true -} - -// HasFargateTasksCountHwm returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasFargateTasksCountHwm() bool { - if o != nil && o.FargateTasksCountHwm != nil { - return true - } - - return false -} - -// SetFargateTasksCountHwm gets a reference to the given int64 and assigns it to the FargateTasksCountHwm field. -func (o *UsageSummaryDateOrg) SetFargateTasksCountHwm(v int64) { - o.FargateTasksCountHwm = &v -} - -// GetGcpHostTop99p returns the GcpHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetGcpHostTop99p() int64 { - if o == nil || o.GcpHostTop99p == nil { - var ret int64 - return ret - } - return *o.GcpHostTop99p -} - -// GetGcpHostTop99pOk returns a tuple with the GcpHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetGcpHostTop99pOk() (*int64, bool) { - if o == nil || o.GcpHostTop99p == nil { - return nil, false - } - return o.GcpHostTop99p, true -} - -// HasGcpHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasGcpHostTop99p() bool { - if o != nil && o.GcpHostTop99p != nil { - return true - } - - return false -} - -// SetGcpHostTop99p gets a reference to the given int64 and assigns it to the GcpHostTop99p field. -func (o *UsageSummaryDateOrg) SetGcpHostTop99p(v int64) { - o.GcpHostTop99p = &v -} - -// GetHerokuHostTop99p returns the HerokuHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetHerokuHostTop99p() int64 { - if o == nil || o.HerokuHostTop99p == nil { - var ret int64 - return ret - } - return *o.HerokuHostTop99p -} - -// GetHerokuHostTop99pOk returns a tuple with the HerokuHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetHerokuHostTop99pOk() (*int64, bool) { - if o == nil || o.HerokuHostTop99p == nil { - return nil, false - } - return o.HerokuHostTop99p, true -} - -// HasHerokuHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasHerokuHostTop99p() bool { - if o != nil && o.HerokuHostTop99p != nil { - return true - } - - return false -} - -// SetHerokuHostTop99p gets a reference to the given int64 and assigns it to the HerokuHostTop99p field. -func (o *UsageSummaryDateOrg) SetHerokuHostTop99p(v int64) { - o.HerokuHostTop99p = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *UsageSummaryDateOrg) SetId(v string) { - o.Id = &v -} - -// GetIncidentManagementMonthlyActiveUsersHwm returns the IncidentManagementMonthlyActiveUsersHwm field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetIncidentManagementMonthlyActiveUsersHwm() int64 { - if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { - var ret int64 - return ret - } - return *o.IncidentManagementMonthlyActiveUsersHwm -} - -// GetIncidentManagementMonthlyActiveUsersHwmOk returns a tuple with the IncidentManagementMonthlyActiveUsersHwm field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetIncidentManagementMonthlyActiveUsersHwmOk() (*int64, bool) { - if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { - return nil, false - } - return o.IncidentManagementMonthlyActiveUsersHwm, true -} - -// HasIncidentManagementMonthlyActiveUsersHwm returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasIncidentManagementMonthlyActiveUsersHwm() bool { - if o != nil && o.IncidentManagementMonthlyActiveUsersHwm != nil { - return true - } - - return false -} - -// SetIncidentManagementMonthlyActiveUsersHwm gets a reference to the given int64 and assigns it to the IncidentManagementMonthlyActiveUsersHwm field. -func (o *UsageSummaryDateOrg) SetIncidentManagementMonthlyActiveUsersHwm(v int64) { - o.IncidentManagementMonthlyActiveUsersHwm = &v -} - -// GetIndexedEventsCountSum returns the IndexedEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetIndexedEventsCountSum() int64 { - if o == nil || o.IndexedEventsCountSum == nil { - var ret int64 - return ret - } - return *o.IndexedEventsCountSum -} - -// GetIndexedEventsCountSumOk returns a tuple with the IndexedEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetIndexedEventsCountSumOk() (*int64, bool) { - if o == nil || o.IndexedEventsCountSum == nil { - return nil, false - } - return o.IndexedEventsCountSum, true -} - -// HasIndexedEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasIndexedEventsCountSum() bool { - if o != nil && o.IndexedEventsCountSum != nil { - return true - } - - return false -} - -// SetIndexedEventsCountSum gets a reference to the given int64 and assigns it to the IndexedEventsCountSum field. -func (o *UsageSummaryDateOrg) SetIndexedEventsCountSum(v int64) { - o.IndexedEventsCountSum = &v -} - -// GetInfraHostTop99p returns the InfraHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetInfraHostTop99p() int64 { - if o == nil || o.InfraHostTop99p == nil { - var ret int64 - return ret - } - return *o.InfraHostTop99p -} - -// GetInfraHostTop99pOk returns a tuple with the InfraHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetInfraHostTop99pOk() (*int64, bool) { - if o == nil || o.InfraHostTop99p == nil { - return nil, false - } - return o.InfraHostTop99p, true -} - -// HasInfraHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasInfraHostTop99p() bool { - if o != nil && o.InfraHostTop99p != nil { - return true - } - - return false -} - -// SetInfraHostTop99p gets a reference to the given int64 and assigns it to the InfraHostTop99p field. -func (o *UsageSummaryDateOrg) SetInfraHostTop99p(v int64) { - o.InfraHostTop99p = &v -} - -// GetIngestedEventsBytesSum returns the IngestedEventsBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetIngestedEventsBytesSum() int64 { - if o == nil || o.IngestedEventsBytesSum == nil { - var ret int64 - return ret - } - return *o.IngestedEventsBytesSum -} - -// GetIngestedEventsBytesSumOk returns a tuple with the IngestedEventsBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetIngestedEventsBytesSumOk() (*int64, bool) { - if o == nil || o.IngestedEventsBytesSum == nil { - return nil, false - } - return o.IngestedEventsBytesSum, true -} - -// HasIngestedEventsBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasIngestedEventsBytesSum() bool { - if o != nil && o.IngestedEventsBytesSum != nil { - return true - } - - return false -} - -// SetIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the IngestedEventsBytesSum field. -func (o *UsageSummaryDateOrg) SetIngestedEventsBytesSum(v int64) { - o.IngestedEventsBytesSum = &v -} - -// GetIotDeviceAggSum returns the IotDeviceAggSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetIotDeviceAggSum() int64 { - if o == nil || o.IotDeviceAggSum == nil { - var ret int64 - return ret - } - return *o.IotDeviceAggSum -} - -// GetIotDeviceAggSumOk returns a tuple with the IotDeviceAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetIotDeviceAggSumOk() (*int64, bool) { - if o == nil || o.IotDeviceAggSum == nil { - return nil, false - } - return o.IotDeviceAggSum, true -} - -// HasIotDeviceAggSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasIotDeviceAggSum() bool { - if o != nil && o.IotDeviceAggSum != nil { - return true - } - - return false -} - -// SetIotDeviceAggSum gets a reference to the given int64 and assigns it to the IotDeviceAggSum field. -func (o *UsageSummaryDateOrg) SetIotDeviceAggSum(v int64) { - o.IotDeviceAggSum = &v -} - -// GetIotDeviceTop99pSum returns the IotDeviceTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetIotDeviceTop99pSum() int64 { - if o == nil || o.IotDeviceTop99pSum == nil { - var ret int64 - return ret - } - return *o.IotDeviceTop99pSum -} - -// GetIotDeviceTop99pSumOk returns a tuple with the IotDeviceTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetIotDeviceTop99pSumOk() (*int64, bool) { - if o == nil || o.IotDeviceTop99pSum == nil { - return nil, false - } - return o.IotDeviceTop99pSum, true -} - -// HasIotDeviceTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasIotDeviceTop99pSum() bool { - if o != nil && o.IotDeviceTop99pSum != nil { - return true - } - - return false -} - -// SetIotDeviceTop99pSum gets a reference to the given int64 and assigns it to the IotDeviceTop99pSum field. -func (o *UsageSummaryDateOrg) SetIotDeviceTop99pSum(v int64) { - o.IotDeviceTop99pSum = &v -} - -// GetMobileRumLiteSessionCountSum returns the MobileRumLiteSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetMobileRumLiteSessionCountSum() int64 { - if o == nil || o.MobileRumLiteSessionCountSum == nil { - var ret int64 - return ret - } - return *o.MobileRumLiteSessionCountSum -} - -// GetMobileRumLiteSessionCountSumOk returns a tuple with the MobileRumLiteSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetMobileRumLiteSessionCountSumOk() (*int64, bool) { - if o == nil || o.MobileRumLiteSessionCountSum == nil { - return nil, false - } - return o.MobileRumLiteSessionCountSum, true -} - -// HasMobileRumLiteSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasMobileRumLiteSessionCountSum() bool { - if o != nil && o.MobileRumLiteSessionCountSum != nil { - return true - } - - return false -} - -// SetMobileRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumLiteSessionCountSum field. -func (o *UsageSummaryDateOrg) SetMobileRumLiteSessionCountSum(v int64) { - o.MobileRumLiteSessionCountSum = &v -} - -// GetMobileRumSessionCountAndroidSum returns the MobileRumSessionCountAndroidSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountAndroidSum() int64 { - if o == nil || o.MobileRumSessionCountAndroidSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountAndroidSum -} - -// GetMobileRumSessionCountAndroidSumOk returns a tuple with the MobileRumSessionCountAndroidSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountAndroidSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountAndroidSum == nil { - return nil, false - } - return o.MobileRumSessionCountAndroidSum, true -} - -// HasMobileRumSessionCountAndroidSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasMobileRumSessionCountAndroidSum() bool { - if o != nil && o.MobileRumSessionCountAndroidSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountAndroidSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAndroidSum field. -func (o *UsageSummaryDateOrg) SetMobileRumSessionCountAndroidSum(v int64) { - o.MobileRumSessionCountAndroidSum = &v -} - -// GetMobileRumSessionCountIosSum returns the MobileRumSessionCountIosSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountIosSum() int64 { - if o == nil || o.MobileRumSessionCountIosSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountIosSum -} - -// GetMobileRumSessionCountIosSumOk returns a tuple with the MobileRumSessionCountIosSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountIosSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountIosSum == nil { - return nil, false - } - return o.MobileRumSessionCountIosSum, true -} - -// HasMobileRumSessionCountIosSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasMobileRumSessionCountIosSum() bool { - if o != nil && o.MobileRumSessionCountIosSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountIosSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountIosSum field. -func (o *UsageSummaryDateOrg) SetMobileRumSessionCountIosSum(v int64) { - o.MobileRumSessionCountIosSum = &v -} - -// GetMobileRumSessionCountReactnativeSum returns the MobileRumSessionCountReactnativeSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountReactnativeSum() int64 { - if o == nil || o.MobileRumSessionCountReactnativeSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountReactnativeSum -} - -// GetMobileRumSessionCountReactnativeSumOk returns a tuple with the MobileRumSessionCountReactnativeSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountReactnativeSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountReactnativeSum == nil { - return nil, false - } - return o.MobileRumSessionCountReactnativeSum, true -} - -// HasMobileRumSessionCountReactnativeSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasMobileRumSessionCountReactnativeSum() bool { - if o != nil && o.MobileRumSessionCountReactnativeSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountReactnativeSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountReactnativeSum field. -func (o *UsageSummaryDateOrg) SetMobileRumSessionCountReactnativeSum(v int64) { - o.MobileRumSessionCountReactnativeSum = &v -} - -// GetMobileRumSessionCountSum returns the MobileRumSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountSum() int64 { - if o == nil || o.MobileRumSessionCountSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountSum -} - -// GetMobileRumSessionCountSumOk returns a tuple with the MobileRumSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetMobileRumSessionCountSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountSum == nil { - return nil, false - } - return o.MobileRumSessionCountSum, true -} - -// HasMobileRumSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasMobileRumSessionCountSum() bool { - if o != nil && o.MobileRumSessionCountSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountSum field. -func (o *UsageSummaryDateOrg) SetMobileRumSessionCountSum(v int64) { - o.MobileRumSessionCountSum = &v -} - -// GetMobileRumUnitsSum returns the MobileRumUnitsSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetMobileRumUnitsSum() int64 { - if o == nil || o.MobileRumUnitsSum == nil { - var ret int64 - return ret - } - return *o.MobileRumUnitsSum -} - -// GetMobileRumUnitsSumOk returns a tuple with the MobileRumUnitsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetMobileRumUnitsSumOk() (*int64, bool) { - if o == nil || o.MobileRumUnitsSum == nil { - return nil, false - } - return o.MobileRumUnitsSum, true -} - -// HasMobileRumUnitsSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasMobileRumUnitsSum() bool { - if o != nil && o.MobileRumUnitsSum != nil { - return true - } - - return false -} - -// SetMobileRumUnitsSum gets a reference to the given int64 and assigns it to the MobileRumUnitsSum field. -func (o *UsageSummaryDateOrg) SetMobileRumUnitsSum(v int64) { - o.MobileRumUnitsSum = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *UsageSummaryDateOrg) SetName(v string) { - o.Name = &v -} - -// GetNetflowIndexedEventsCountSum returns the NetflowIndexedEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetNetflowIndexedEventsCountSum() int64 { - if o == nil || o.NetflowIndexedEventsCountSum == nil { - var ret int64 - return ret - } - return *o.NetflowIndexedEventsCountSum -} - -// GetNetflowIndexedEventsCountSumOk returns a tuple with the NetflowIndexedEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetNetflowIndexedEventsCountSumOk() (*int64, bool) { - if o == nil || o.NetflowIndexedEventsCountSum == nil { - return nil, false - } - return o.NetflowIndexedEventsCountSum, true -} - -// HasNetflowIndexedEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasNetflowIndexedEventsCountSum() bool { - if o != nil && o.NetflowIndexedEventsCountSum != nil { - return true - } - - return false -} - -// SetNetflowIndexedEventsCountSum gets a reference to the given int64 and assigns it to the NetflowIndexedEventsCountSum field. -func (o *UsageSummaryDateOrg) SetNetflowIndexedEventsCountSum(v int64) { - o.NetflowIndexedEventsCountSum = &v -} - -// GetNpmHostTop99p returns the NpmHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetNpmHostTop99p() int64 { - if o == nil || o.NpmHostTop99p == nil { - var ret int64 - return ret - } - return *o.NpmHostTop99p -} - -// GetNpmHostTop99pOk returns a tuple with the NpmHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetNpmHostTop99pOk() (*int64, bool) { - if o == nil || o.NpmHostTop99p == nil { - return nil, false - } - return o.NpmHostTop99p, true -} - -// HasNpmHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasNpmHostTop99p() bool { - if o != nil && o.NpmHostTop99p != nil { - return true - } - - return false -} - -// SetNpmHostTop99p gets a reference to the given int64 and assigns it to the NpmHostTop99p field. -func (o *UsageSummaryDateOrg) SetNpmHostTop99p(v int64) { - o.NpmHostTop99p = &v -} - -// GetObservabilityPipelinesBytesProcessedSum returns the ObservabilityPipelinesBytesProcessedSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetObservabilityPipelinesBytesProcessedSum() int64 { - if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { - var ret int64 - return ret - } - return *o.ObservabilityPipelinesBytesProcessedSum -} - -// GetObservabilityPipelinesBytesProcessedSumOk returns a tuple with the ObservabilityPipelinesBytesProcessedSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetObservabilityPipelinesBytesProcessedSumOk() (*int64, bool) { - if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { - return nil, false - } - return o.ObservabilityPipelinesBytesProcessedSum, true -} - -// HasObservabilityPipelinesBytesProcessedSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasObservabilityPipelinesBytesProcessedSum() bool { - if o != nil && o.ObservabilityPipelinesBytesProcessedSum != nil { - return true - } - - return false -} - -// SetObservabilityPipelinesBytesProcessedSum gets a reference to the given int64 and assigns it to the ObservabilityPipelinesBytesProcessedSum field. -func (o *UsageSummaryDateOrg) SetObservabilityPipelinesBytesProcessedSum(v int64) { - o.ObservabilityPipelinesBytesProcessedSum = &v -} - -// GetOnlineArchiveEventsCountSum returns the OnlineArchiveEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetOnlineArchiveEventsCountSum() int64 { - if o == nil || o.OnlineArchiveEventsCountSum == nil { - var ret int64 - return ret - } - return *o.OnlineArchiveEventsCountSum -} - -// GetOnlineArchiveEventsCountSumOk returns a tuple with the OnlineArchiveEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetOnlineArchiveEventsCountSumOk() (*int64, bool) { - if o == nil || o.OnlineArchiveEventsCountSum == nil { - return nil, false - } - return o.OnlineArchiveEventsCountSum, true -} - -// HasOnlineArchiveEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasOnlineArchiveEventsCountSum() bool { - if o != nil && o.OnlineArchiveEventsCountSum != nil { - return true - } - - return false -} - -// SetOnlineArchiveEventsCountSum gets a reference to the given int64 and assigns it to the OnlineArchiveEventsCountSum field. -func (o *UsageSummaryDateOrg) SetOnlineArchiveEventsCountSum(v int64) { - o.OnlineArchiveEventsCountSum = &v -} - -// GetOpentelemetryHostTop99p returns the OpentelemetryHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetOpentelemetryHostTop99p() int64 { - if o == nil || o.OpentelemetryHostTop99p == nil { - var ret int64 - return ret - } - return *o.OpentelemetryHostTop99p -} - -// GetOpentelemetryHostTop99pOk returns a tuple with the OpentelemetryHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetOpentelemetryHostTop99pOk() (*int64, bool) { - if o == nil || o.OpentelemetryHostTop99p == nil { - return nil, false - } - return o.OpentelemetryHostTop99p, true -} - -// HasOpentelemetryHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasOpentelemetryHostTop99p() bool { - if o != nil && o.OpentelemetryHostTop99p != nil { - return true - } - - return false -} - -// SetOpentelemetryHostTop99p gets a reference to the given int64 and assigns it to the OpentelemetryHostTop99p field. -func (o *UsageSummaryDateOrg) SetOpentelemetryHostTop99p(v int64) { - o.OpentelemetryHostTop99p = &v -} - -// GetProfilingHostTop99p returns the ProfilingHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetProfilingHostTop99p() int64 { - if o == nil || o.ProfilingHostTop99p == nil { - var ret int64 - return ret - } - return *o.ProfilingHostTop99p -} - -// GetProfilingHostTop99pOk returns a tuple with the ProfilingHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetProfilingHostTop99pOk() (*int64, bool) { - if o == nil || o.ProfilingHostTop99p == nil { - return nil, false - } - return o.ProfilingHostTop99p, true -} - -// HasProfilingHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasProfilingHostTop99p() bool { - if o != nil && o.ProfilingHostTop99p != nil { - return true - } - - return false -} - -// SetProfilingHostTop99p gets a reference to the given int64 and assigns it to the ProfilingHostTop99p field. -func (o *UsageSummaryDateOrg) SetProfilingHostTop99p(v int64) { - o.ProfilingHostTop99p = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageSummaryDateOrg) SetPublicId(v string) { - o.PublicId = &v -} - -// GetRumBrowserAndMobileSessionCount returns the RumBrowserAndMobileSessionCount field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetRumBrowserAndMobileSessionCount() int64 { - if o == nil || o.RumBrowserAndMobileSessionCount == nil { - var ret int64 - return ret - } - return *o.RumBrowserAndMobileSessionCount -} - -// GetRumBrowserAndMobileSessionCountOk returns a tuple with the RumBrowserAndMobileSessionCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetRumBrowserAndMobileSessionCountOk() (*int64, bool) { - if o == nil || o.RumBrowserAndMobileSessionCount == nil { - return nil, false - } - return o.RumBrowserAndMobileSessionCount, true -} - -// HasRumBrowserAndMobileSessionCount returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasRumBrowserAndMobileSessionCount() bool { - if o != nil && o.RumBrowserAndMobileSessionCount != nil { - return true - } - - return false -} - -// SetRumBrowserAndMobileSessionCount gets a reference to the given int64 and assigns it to the RumBrowserAndMobileSessionCount field. -func (o *UsageSummaryDateOrg) SetRumBrowserAndMobileSessionCount(v int64) { - o.RumBrowserAndMobileSessionCount = &v -} - -// GetRumSessionCountSum returns the RumSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetRumSessionCountSum() int64 { - if o == nil || o.RumSessionCountSum == nil { - var ret int64 - return ret - } - return *o.RumSessionCountSum -} - -// GetRumSessionCountSumOk returns a tuple with the RumSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetRumSessionCountSumOk() (*int64, bool) { - if o == nil || o.RumSessionCountSum == nil { - return nil, false - } - return o.RumSessionCountSum, true -} - -// HasRumSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasRumSessionCountSum() bool { - if o != nil && o.RumSessionCountSum != nil { - return true - } - - return false -} - -// SetRumSessionCountSum gets a reference to the given int64 and assigns it to the RumSessionCountSum field. -func (o *UsageSummaryDateOrg) SetRumSessionCountSum(v int64) { - o.RumSessionCountSum = &v -} - -// GetRumTotalSessionCountSum returns the RumTotalSessionCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetRumTotalSessionCountSum() int64 { - if o == nil || o.RumTotalSessionCountSum == nil { - var ret int64 - return ret - } - return *o.RumTotalSessionCountSum -} - -// GetRumTotalSessionCountSumOk returns a tuple with the RumTotalSessionCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetRumTotalSessionCountSumOk() (*int64, bool) { - if o == nil || o.RumTotalSessionCountSum == nil { - return nil, false - } - return o.RumTotalSessionCountSum, true -} - -// HasRumTotalSessionCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasRumTotalSessionCountSum() bool { - if o != nil && o.RumTotalSessionCountSum != nil { - return true - } - - return false -} - -// SetRumTotalSessionCountSum gets a reference to the given int64 and assigns it to the RumTotalSessionCountSum field. -func (o *UsageSummaryDateOrg) SetRumTotalSessionCountSum(v int64) { - o.RumTotalSessionCountSum = &v -} - -// GetRumUnitsSum returns the RumUnitsSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetRumUnitsSum() int64 { - if o == nil || o.RumUnitsSum == nil { - var ret int64 - return ret - } - return *o.RumUnitsSum -} - -// GetRumUnitsSumOk returns a tuple with the RumUnitsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetRumUnitsSumOk() (*int64, bool) { - if o == nil || o.RumUnitsSum == nil { - return nil, false - } - return o.RumUnitsSum, true -} - -// HasRumUnitsSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasRumUnitsSum() bool { - if o != nil && o.RumUnitsSum != nil { - return true - } - - return false -} - -// SetRumUnitsSum gets a reference to the given int64 and assigns it to the RumUnitsSum field. -func (o *UsageSummaryDateOrg) SetRumUnitsSum(v int64) { - o.RumUnitsSum = &v -} - -// GetSdsLogsScannedBytesSum returns the SdsLogsScannedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetSdsLogsScannedBytesSum() int64 { - if o == nil || o.SdsLogsScannedBytesSum == nil { - var ret int64 - return ret - } - return *o.SdsLogsScannedBytesSum -} - -// GetSdsLogsScannedBytesSumOk returns a tuple with the SdsLogsScannedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetSdsLogsScannedBytesSumOk() (*int64, bool) { - if o == nil || o.SdsLogsScannedBytesSum == nil { - return nil, false - } - return o.SdsLogsScannedBytesSum, true -} - -// HasSdsLogsScannedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasSdsLogsScannedBytesSum() bool { - if o != nil && o.SdsLogsScannedBytesSum != nil { - return true - } - - return false -} - -// SetSdsLogsScannedBytesSum gets a reference to the given int64 and assigns it to the SdsLogsScannedBytesSum field. -func (o *UsageSummaryDateOrg) SetSdsLogsScannedBytesSum(v int64) { - o.SdsLogsScannedBytesSum = &v -} - -// GetSdsTotalScannedBytesSum returns the SdsTotalScannedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetSdsTotalScannedBytesSum() int64 { - if o == nil || o.SdsTotalScannedBytesSum == nil { - var ret int64 - return ret - } - return *o.SdsTotalScannedBytesSum -} - -// GetSdsTotalScannedBytesSumOk returns a tuple with the SdsTotalScannedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetSdsTotalScannedBytesSumOk() (*int64, bool) { - if o == nil || o.SdsTotalScannedBytesSum == nil { - return nil, false - } - return o.SdsTotalScannedBytesSum, true -} - -// HasSdsTotalScannedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasSdsTotalScannedBytesSum() bool { - if o != nil && o.SdsTotalScannedBytesSum != nil { - return true - } - - return false -} - -// SetSdsTotalScannedBytesSum gets a reference to the given int64 and assigns it to the SdsTotalScannedBytesSum field. -func (o *UsageSummaryDateOrg) SetSdsTotalScannedBytesSum(v int64) { - o.SdsTotalScannedBytesSum = &v -} - -// GetSyntheticsBrowserCheckCallsCountSum returns the SyntheticsBrowserCheckCallsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetSyntheticsBrowserCheckCallsCountSum() int64 { - if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { - var ret int64 - return ret - } - return *o.SyntheticsBrowserCheckCallsCountSum -} - -// GetSyntheticsBrowserCheckCallsCountSumOk returns a tuple with the SyntheticsBrowserCheckCallsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetSyntheticsBrowserCheckCallsCountSumOk() (*int64, bool) { - if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { - return nil, false - } - return o.SyntheticsBrowserCheckCallsCountSum, true -} - -// HasSyntheticsBrowserCheckCallsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasSyntheticsBrowserCheckCallsCountSum() bool { - if o != nil && o.SyntheticsBrowserCheckCallsCountSum != nil { - return true - } - - return false -} - -// SetSyntheticsBrowserCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsBrowserCheckCallsCountSum field. -func (o *UsageSummaryDateOrg) SetSyntheticsBrowserCheckCallsCountSum(v int64) { - o.SyntheticsBrowserCheckCallsCountSum = &v -} - -// GetSyntheticsCheckCallsCountSum returns the SyntheticsCheckCallsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetSyntheticsCheckCallsCountSum() int64 { - if o == nil || o.SyntheticsCheckCallsCountSum == nil { - var ret int64 - return ret - } - return *o.SyntheticsCheckCallsCountSum -} - -// GetSyntheticsCheckCallsCountSumOk returns a tuple with the SyntheticsCheckCallsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetSyntheticsCheckCallsCountSumOk() (*int64, bool) { - if o == nil || o.SyntheticsCheckCallsCountSum == nil { - return nil, false - } - return o.SyntheticsCheckCallsCountSum, true -} - -// HasSyntheticsCheckCallsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasSyntheticsCheckCallsCountSum() bool { - if o != nil && o.SyntheticsCheckCallsCountSum != nil { - return true - } - - return false -} - -// SetSyntheticsCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsCheckCallsCountSum field. -func (o *UsageSummaryDateOrg) SetSyntheticsCheckCallsCountSum(v int64) { - o.SyntheticsCheckCallsCountSum = &v -} - -// GetTraceSearchIndexedEventsCountSum returns the TraceSearchIndexedEventsCountSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetTraceSearchIndexedEventsCountSum() int64 { - if o == nil || o.TraceSearchIndexedEventsCountSum == nil { - var ret int64 - return ret - } - return *o.TraceSearchIndexedEventsCountSum -} - -// GetTraceSearchIndexedEventsCountSumOk returns a tuple with the TraceSearchIndexedEventsCountSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetTraceSearchIndexedEventsCountSumOk() (*int64, bool) { - if o == nil || o.TraceSearchIndexedEventsCountSum == nil { - return nil, false - } - return o.TraceSearchIndexedEventsCountSum, true -} - -// HasTraceSearchIndexedEventsCountSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasTraceSearchIndexedEventsCountSum() bool { - if o != nil && o.TraceSearchIndexedEventsCountSum != nil { - return true - } - - return false -} - -// SetTraceSearchIndexedEventsCountSum gets a reference to the given int64 and assigns it to the TraceSearchIndexedEventsCountSum field. -func (o *UsageSummaryDateOrg) SetTraceSearchIndexedEventsCountSum(v int64) { - o.TraceSearchIndexedEventsCountSum = &v -} - -// GetTwolIngestedEventsBytesSum returns the TwolIngestedEventsBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetTwolIngestedEventsBytesSum() int64 { - if o == nil || o.TwolIngestedEventsBytesSum == nil { - var ret int64 - return ret - } - return *o.TwolIngestedEventsBytesSum -} - -// GetTwolIngestedEventsBytesSumOk returns a tuple with the TwolIngestedEventsBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetTwolIngestedEventsBytesSumOk() (*int64, bool) { - if o == nil || o.TwolIngestedEventsBytesSum == nil { - return nil, false - } - return o.TwolIngestedEventsBytesSum, true -} - -// HasTwolIngestedEventsBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasTwolIngestedEventsBytesSum() bool { - if o != nil && o.TwolIngestedEventsBytesSum != nil { - return true - } - - return false -} - -// SetTwolIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the TwolIngestedEventsBytesSum field. -func (o *UsageSummaryDateOrg) SetTwolIngestedEventsBytesSum(v int64) { - o.TwolIngestedEventsBytesSum = &v -} - -// GetVsphereHostTop99p returns the VsphereHostTop99p field value if set, zero value otherwise. -func (o *UsageSummaryDateOrg) GetVsphereHostTop99p() int64 { - if o == nil || o.VsphereHostTop99p == nil { - var ret int64 - return ret - } - return *o.VsphereHostTop99p -} - -// GetVsphereHostTop99pOk returns a tuple with the VsphereHostTop99p field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryDateOrg) GetVsphereHostTop99pOk() (*int64, bool) { - if o == nil || o.VsphereHostTop99p == nil { - return nil, false - } - return o.VsphereHostTop99p, true -} - -// HasVsphereHostTop99p returns a boolean if a field has been set. -func (o *UsageSummaryDateOrg) HasVsphereHostTop99p() bool { - if o != nil && o.VsphereHostTop99p != nil { - return true - } - - return false -} - -// SetVsphereHostTop99p gets a reference to the given int64 and assigns it to the VsphereHostTop99p field. -func (o *UsageSummaryDateOrg) SetVsphereHostTop99p(v int64) { - o.VsphereHostTop99p = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSummaryDateOrg) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AgentHostTop99p != nil { - toSerialize["agent_host_top99p"] = o.AgentHostTop99p - } - if o.ApmAzureAppServiceHostTop99p != nil { - toSerialize["apm_azure_app_service_host_top99p"] = o.ApmAzureAppServiceHostTop99p - } - if o.ApmHostTop99p != nil { - toSerialize["apm_host_top99p"] = o.ApmHostTop99p - } - if o.AuditLogsLinesIndexedSum != nil { - toSerialize["audit_logs_lines_indexed_sum"] = o.AuditLogsLinesIndexedSum - } - if o.AvgProfiledFargateTasks != nil { - toSerialize["avg_profiled_fargate_tasks"] = o.AvgProfiledFargateTasks - } - if o.AwsHostTop99p != nil { - toSerialize["aws_host_top99p"] = o.AwsHostTop99p - } - if o.AwsLambdaFuncCount != nil { - toSerialize["aws_lambda_func_count"] = o.AwsLambdaFuncCount - } - if o.AwsLambdaInvocationsSum != nil { - toSerialize["aws_lambda_invocations_sum"] = o.AwsLambdaInvocationsSum - } - if o.AzureAppServiceTop99p != nil { - toSerialize["azure_app_service_top99p"] = o.AzureAppServiceTop99p - } - if o.BillableIngestedBytesSum != nil { - toSerialize["billable_ingested_bytes_sum"] = o.BillableIngestedBytesSum - } - if o.BrowserRumLiteSessionCountSum != nil { - toSerialize["browser_rum_lite_session_count_sum"] = o.BrowserRumLiteSessionCountSum - } - if o.BrowserRumReplaySessionCountSum != nil { - toSerialize["browser_rum_replay_session_count_sum"] = o.BrowserRumReplaySessionCountSum - } - if o.BrowserRumUnitsSum != nil { - toSerialize["browser_rum_units_sum"] = o.BrowserRumUnitsSum - } - if o.CiPipelineIndexedSpansSum != nil { - toSerialize["ci_pipeline_indexed_spans_sum"] = o.CiPipelineIndexedSpansSum - } - if o.CiTestIndexedSpansSum != nil { - toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum - } - if o.CiVisibilityPipelineCommittersHwm != nil { - toSerialize["ci_visibility_pipeline_committers_hwm"] = o.CiVisibilityPipelineCommittersHwm - } - if o.CiVisibilityTestCommittersHwm != nil { - toSerialize["ci_visibility_test_committers_hwm"] = o.CiVisibilityTestCommittersHwm - } - if o.ContainerAvg != nil { - toSerialize["container_avg"] = o.ContainerAvg - } - if o.ContainerHwm != nil { - toSerialize["container_hwm"] = o.ContainerHwm - } - if o.CspmAasHostTop99p != nil { - toSerialize["cspm_aas_host_top99p"] = o.CspmAasHostTop99p - } - if o.CspmAzureHostTop99p != nil { - toSerialize["cspm_azure_host_top99p"] = o.CspmAzureHostTop99p - } - if o.CspmContainerAvg != nil { - toSerialize["cspm_container_avg"] = o.CspmContainerAvg - } - if o.CspmContainerHwm != nil { - toSerialize["cspm_container_hwm"] = o.CspmContainerHwm - } - if o.CspmHostTop99p != nil { - toSerialize["cspm_host_top99p"] = o.CspmHostTop99p - } - if o.CustomTsAvg != nil { - toSerialize["custom_ts_avg"] = o.CustomTsAvg - } - if o.CwsContainerCountAvg != nil { - toSerialize["cws_container_count_avg"] = o.CwsContainerCountAvg - } - if o.CwsHostTop99p != nil { - toSerialize["cws_host_top99p"] = o.CwsHostTop99p - } - if o.DbmHostTop99pSum != nil { - toSerialize["dbm_host_top99p_sum"] = o.DbmHostTop99pSum - } - if o.DbmQueriesAvgSum != nil { - toSerialize["dbm_queries_avg_sum"] = o.DbmQueriesAvgSum - } - if o.FargateTasksCountAvg != nil { - toSerialize["fargate_tasks_count_avg"] = o.FargateTasksCountAvg - } - if o.FargateTasksCountHwm != nil { - toSerialize["fargate_tasks_count_hwm"] = o.FargateTasksCountHwm - } - if o.GcpHostTop99p != nil { - toSerialize["gcp_host_top99p"] = o.GcpHostTop99p - } - if o.HerokuHostTop99p != nil { - toSerialize["heroku_host_top99p"] = o.HerokuHostTop99p - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IncidentManagementMonthlyActiveUsersHwm != nil { - toSerialize["incident_management_monthly_active_users_hwm"] = o.IncidentManagementMonthlyActiveUsersHwm - } - if o.IndexedEventsCountSum != nil { - toSerialize["indexed_events_count_sum"] = o.IndexedEventsCountSum - } - if o.InfraHostTop99p != nil { - toSerialize["infra_host_top99p"] = o.InfraHostTop99p - } - if o.IngestedEventsBytesSum != nil { - toSerialize["ingested_events_bytes_sum"] = o.IngestedEventsBytesSum - } - if o.IotDeviceAggSum != nil { - toSerialize["iot_device_agg_sum"] = o.IotDeviceAggSum - } - if o.IotDeviceTop99pSum != nil { - toSerialize["iot_device_top99p_sum"] = o.IotDeviceTop99pSum - } - if o.MobileRumLiteSessionCountSum != nil { - toSerialize["mobile_rum_lite_session_count_sum"] = o.MobileRumLiteSessionCountSum - } - if o.MobileRumSessionCountAndroidSum != nil { - toSerialize["mobile_rum_session_count_android_sum"] = o.MobileRumSessionCountAndroidSum - } - if o.MobileRumSessionCountIosSum != nil { - toSerialize["mobile_rum_session_count_ios_sum"] = o.MobileRumSessionCountIosSum - } - if o.MobileRumSessionCountReactnativeSum != nil { - toSerialize["mobile_rum_session_count_reactnative_sum"] = o.MobileRumSessionCountReactnativeSum - } - if o.MobileRumSessionCountSum != nil { - toSerialize["mobile_rum_session_count_sum"] = o.MobileRumSessionCountSum - } - if o.MobileRumUnitsSum != nil { - toSerialize["mobile_rum_units_sum"] = o.MobileRumUnitsSum - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.NetflowIndexedEventsCountSum != nil { - toSerialize["netflow_indexed_events_count_sum"] = o.NetflowIndexedEventsCountSum - } - if o.NpmHostTop99p != nil { - toSerialize["npm_host_top99p"] = o.NpmHostTop99p - } - if o.ObservabilityPipelinesBytesProcessedSum != nil { - toSerialize["observability_pipelines_bytes_processed_sum"] = o.ObservabilityPipelinesBytesProcessedSum - } - if o.OnlineArchiveEventsCountSum != nil { - toSerialize["online_archive_events_count_sum"] = o.OnlineArchiveEventsCountSum - } - if o.OpentelemetryHostTop99p != nil { - toSerialize["opentelemetry_host_top99p"] = o.OpentelemetryHostTop99p - } - if o.ProfilingHostTop99p != nil { - toSerialize["profiling_host_top99p"] = o.ProfilingHostTop99p - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.RumBrowserAndMobileSessionCount != nil { - toSerialize["rum_browser_and_mobile_session_count"] = o.RumBrowserAndMobileSessionCount - } - if o.RumSessionCountSum != nil { - toSerialize["rum_session_count_sum"] = o.RumSessionCountSum - } - if o.RumTotalSessionCountSum != nil { - toSerialize["rum_total_session_count_sum"] = o.RumTotalSessionCountSum - } - if o.RumUnitsSum != nil { - toSerialize["rum_units_sum"] = o.RumUnitsSum - } - if o.SdsLogsScannedBytesSum != nil { - toSerialize["sds_logs_scanned_bytes_sum"] = o.SdsLogsScannedBytesSum - } - if o.SdsTotalScannedBytesSum != nil { - toSerialize["sds_total_scanned_bytes_sum"] = o.SdsTotalScannedBytesSum - } - if o.SyntheticsBrowserCheckCallsCountSum != nil { - toSerialize["synthetics_browser_check_calls_count_sum"] = o.SyntheticsBrowserCheckCallsCountSum - } - if o.SyntheticsCheckCallsCountSum != nil { - toSerialize["synthetics_check_calls_count_sum"] = o.SyntheticsCheckCallsCountSum - } - if o.TraceSearchIndexedEventsCountSum != nil { - toSerialize["trace_search_indexed_events_count_sum"] = o.TraceSearchIndexedEventsCountSum - } - if o.TwolIngestedEventsBytesSum != nil { - toSerialize["twol_ingested_events_bytes_sum"] = o.TwolIngestedEventsBytesSum - } - if o.VsphereHostTop99p != nil { - toSerialize["vsphere_host_top99p"] = o.VsphereHostTop99p - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` - ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` - ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` - AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` - AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` - AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` - AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` - AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` - AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` - BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` - BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` - BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` - BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` - CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` - CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` - CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` - CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` - ContainerAvg *int64 `json:"container_avg,omitempty"` - ContainerHwm *int64 `json:"container_hwm,omitempty"` - CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` - CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` - CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` - CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` - CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` - CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` - CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` - CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` - DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` - DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` - FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` - FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` - GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` - HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` - Id *string `json:"id,omitempty"` - IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` - IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` - InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` - IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` - IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` - IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` - MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` - MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` - MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` - MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` - MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` - MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` - Name *string `json:"name,omitempty"` - NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` - NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` - ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` - OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` - OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` - ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` - PublicId *string `json:"public_id,omitempty"` - RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` - RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` - RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` - RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` - SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` - SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` - SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` - SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` - TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` - TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` - VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AgentHostTop99p = all.AgentHostTop99p - o.ApmAzureAppServiceHostTop99p = all.ApmAzureAppServiceHostTop99p - o.ApmHostTop99p = all.ApmHostTop99p - o.AuditLogsLinesIndexedSum = all.AuditLogsLinesIndexedSum - o.AvgProfiledFargateTasks = all.AvgProfiledFargateTasks - o.AwsHostTop99p = all.AwsHostTop99p - o.AwsLambdaFuncCount = all.AwsLambdaFuncCount - o.AwsLambdaInvocationsSum = all.AwsLambdaInvocationsSum - o.AzureAppServiceTop99p = all.AzureAppServiceTop99p - o.BillableIngestedBytesSum = all.BillableIngestedBytesSum - o.BrowserRumLiteSessionCountSum = all.BrowserRumLiteSessionCountSum - o.BrowserRumReplaySessionCountSum = all.BrowserRumReplaySessionCountSum - o.BrowserRumUnitsSum = all.BrowserRumUnitsSum - o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum - o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum - o.CiVisibilityPipelineCommittersHwm = all.CiVisibilityPipelineCommittersHwm - o.CiVisibilityTestCommittersHwm = all.CiVisibilityTestCommittersHwm - o.ContainerAvg = all.ContainerAvg - o.ContainerHwm = all.ContainerHwm - o.CspmAasHostTop99p = all.CspmAasHostTop99p - o.CspmAzureHostTop99p = all.CspmAzureHostTop99p - o.CspmContainerAvg = all.CspmContainerAvg - o.CspmContainerHwm = all.CspmContainerHwm - o.CspmHostTop99p = all.CspmHostTop99p - o.CustomTsAvg = all.CustomTsAvg - o.CwsContainerCountAvg = all.CwsContainerCountAvg - o.CwsHostTop99p = all.CwsHostTop99p - o.DbmHostTop99pSum = all.DbmHostTop99pSum - o.DbmQueriesAvgSum = all.DbmQueriesAvgSum - o.FargateTasksCountAvg = all.FargateTasksCountAvg - o.FargateTasksCountHwm = all.FargateTasksCountHwm - o.GcpHostTop99p = all.GcpHostTop99p - o.HerokuHostTop99p = all.HerokuHostTop99p - o.Id = all.Id - o.IncidentManagementMonthlyActiveUsersHwm = all.IncidentManagementMonthlyActiveUsersHwm - o.IndexedEventsCountSum = all.IndexedEventsCountSum - o.InfraHostTop99p = all.InfraHostTop99p - o.IngestedEventsBytesSum = all.IngestedEventsBytesSum - o.IotDeviceAggSum = all.IotDeviceAggSum - o.IotDeviceTop99pSum = all.IotDeviceTop99pSum - o.MobileRumLiteSessionCountSum = all.MobileRumLiteSessionCountSum - o.MobileRumSessionCountAndroidSum = all.MobileRumSessionCountAndroidSum - o.MobileRumSessionCountIosSum = all.MobileRumSessionCountIosSum - o.MobileRumSessionCountReactnativeSum = all.MobileRumSessionCountReactnativeSum - o.MobileRumSessionCountSum = all.MobileRumSessionCountSum - o.MobileRumUnitsSum = all.MobileRumUnitsSum - o.Name = all.Name - o.NetflowIndexedEventsCountSum = all.NetflowIndexedEventsCountSum - o.NpmHostTop99p = all.NpmHostTop99p - o.ObservabilityPipelinesBytesProcessedSum = all.ObservabilityPipelinesBytesProcessedSum - o.OnlineArchiveEventsCountSum = all.OnlineArchiveEventsCountSum - o.OpentelemetryHostTop99p = all.OpentelemetryHostTop99p - o.ProfilingHostTop99p = all.ProfilingHostTop99p - o.PublicId = all.PublicId - o.RumBrowserAndMobileSessionCount = all.RumBrowserAndMobileSessionCount - o.RumSessionCountSum = all.RumSessionCountSum - o.RumTotalSessionCountSum = all.RumTotalSessionCountSum - o.RumUnitsSum = all.RumUnitsSum - o.SdsLogsScannedBytesSum = all.SdsLogsScannedBytesSum - o.SdsTotalScannedBytesSum = all.SdsTotalScannedBytesSum - o.SyntheticsBrowserCheckCallsCountSum = all.SyntheticsBrowserCheckCallsCountSum - o.SyntheticsCheckCallsCountSum = all.SyntheticsCheckCallsCountSum - o.TraceSearchIndexedEventsCountSum = all.TraceSearchIndexedEventsCountSum - o.TwolIngestedEventsBytesSum = all.TwolIngestedEventsBytesSum - o.VsphereHostTop99p = all.VsphereHostTop99p - return nil -} diff --git a/api/v1/datadog/model_usage_summary_response.go b/api/v1/datadog/model_usage_summary_response.go deleted file mode 100644 index 8a784c1513f..00000000000 --- a/api/v1/datadog/model_usage_summary_response.go +++ /dev/null @@ -1,2930 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageSummaryResponse Response summarizing all usage aggregated across the months in the request for all organizations, and broken down by month and by organization. -type UsageSummaryResponse struct { - // Shows the 99th percentile of all agent hosts over all hours in the current months for all organizations. - AgentHostTop99pSum *int64 `json:"agent_host_top99p_sum,omitempty"` - // Shows the 99th percentile of all Azure app services using APM over all hours in the current months all organizations. - ApmAzureAppServiceHostTop99pSum *int64 `json:"apm_azure_app_service_host_top99p_sum,omitempty"` - // Shows the 99th percentile of all distinct APM hosts over all hours in the current months for all organizations. - ApmHostTop99pSum *int64 `json:"apm_host_top99p_sum,omitempty"` - // Shows the sum of all audit logs lines indexed over all hours in the current months for all organizations. - AuditLogsLinesIndexedAggSum *int64 `json:"audit_logs_lines_indexed_agg_sum,omitempty"` - // Shows the average of all profiled Fargate tasks over all hours in the current months for all organizations. - AvgProfiledFargateTasksSum *int64 `json:"avg_profiled_fargate_tasks_sum,omitempty"` - // Shows the 99th percentile of all AWS hosts over all hours in the current months for all organizations. - AwsHostTop99pSum *int64 `json:"aws_host_top99p_sum,omitempty"` - // Shows the average of the number of functions that executed 1 or more times each hour in the current months for all organizations. - AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` - // Shows the sum of all AWS Lambda invocations over all hours in the current months for all organizations. - AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` - // Shows the 99th percentile of all Azure app services over all hours in the current months for all organizations. - AzureAppServiceTop99pSum *int64 `json:"azure_app_service_top99p_sum,omitempty"` - // Shows the 99th percentile of all Azure hosts over all hours in the current months for all organizations. - AzureHostTop99pSum *int64 `json:"azure_host_top99p_sum,omitempty"` - // Shows the sum of all log bytes ingested over all hours in the current months for all organizations. - BillableIngestedBytesAggSum *int64 `json:"billable_ingested_bytes_agg_sum,omitempty"` - // Shows the sum of all browser lite sessions over all hours in the current months for all organizations. - BrowserRumLiteSessionCountAggSum *int64 `json:"browser_rum_lite_session_count_agg_sum,omitempty"` - // Shows the sum of all browser replay sessions over all hours in the current months for all organizations. - BrowserRumReplaySessionCountAggSum *int64 `json:"browser_rum_replay_session_count_agg_sum,omitempty"` - // Shows the sum of all browser RUM units over all hours in the current months for all organizations. - BrowserRumUnitsAggSum *int64 `json:"browser_rum_units_agg_sum,omitempty"` - // Shows the sum of all CI pipeline indexed spans over all hours in the current months for all organizations. - CiPipelineIndexedSpansAggSum *int64 `json:"ci_pipeline_indexed_spans_agg_sum,omitempty"` - // Shows the sum of all CI test indexed spans over all hours in the current months for all organizations. - CiTestIndexedSpansAggSum *int64 `json:"ci_test_indexed_spans_agg_sum,omitempty"` - // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current months for all organizations. - CiVisibilityPipelineCommittersHwmSum *int64 `json:"ci_visibility_pipeline_committers_hwm_sum,omitempty"` - // Shows the high-water mark of all CI visibility test committers over all hours in the current months for all organizations. - CiVisibilityTestCommittersHwmSum *int64 `json:"ci_visibility_test_committers_hwm_sum,omitempty"` - // Shows the average of all distinct containers over all hours in the current months for all organizations. - ContainerAvgSum *int64 `json:"container_avg_sum,omitempty"` - // Shows the sum of the high-water marks of all distinct containers over all hours in the current months for all organizations. - ContainerHwmSum *int64 `json:"container_hwm_sum,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management Azure app services hosts over all hours in the current months for all organizations. - CspmAasHostTop99pSum *int64 `json:"cspm_aas_host_top99p_sum,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management Azure hosts over all hours in the current months for all organizations. - CspmAzureHostTop99pSum *int64 `json:"cspm_azure_host_top99p_sum,omitempty"` - // Shows the average number of Cloud Security Posture Management containers over all hours in the current months for all organizations. - CspmContainerAvgSum *int64 `json:"cspm_container_avg_sum,omitempty"` - // Shows the sum of the the high-water marks of Cloud Security Posture Management containers over all hours in the current months for all organizations. - CspmContainerHwmSum *int64 `json:"cspm_container_hwm_sum,omitempty"` - // Shows the 99th percentile of all Cloud Security Posture Management hosts over all hours in the current months for all organizations. - CspmHostTop99pSum *int64 `json:"cspm_host_top99p_sum,omitempty"` - // Shows the average number of distinct custom metrics over all hours in the current months for all organizations. - CustomTsSum *int64 `json:"custom_ts_sum,omitempty"` - // Shows the average of all distinct Cloud Workload Security containers over all hours in the current months for all organizations. - CwsContainersAvgSum *int64 `json:"cws_containers_avg_sum,omitempty"` - // Shows the 99th percentile of all Cloud Workload Security hosts over all hours in the current months for all organizations. - CwsHostTop99pSum *int64 `json:"cws_host_top99p_sum,omitempty"` - // Shows the 99th percentile of all Database Monitoring hosts over all hours in the current month for all organizations. - DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` - // Shows the average of all distinct Database Monitoring Normalized Queries over all hours in the current month for all organizations. - DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` - // Shows the last date of usage in the current months for all organizations. - EndDate *time.Time `json:"end_date,omitempty"` - // Shows the average of all Fargate tasks over all hours in the current months for all organizations. - FargateTasksCountAvgSum *int64 `json:"fargate_tasks_count_avg_sum,omitempty"` - // Shows the sum of the high-water marks of all Fargate tasks over all hours in the current months for all organizations. - FargateTasksCountHwmSum *int64 `json:"fargate_tasks_count_hwm_sum,omitempty"` - // Shows the 99th percentile of all GCP hosts over all hours in the current months for all organizations. - GcpHostTop99pSum *int64 `json:"gcp_host_top99p_sum,omitempty"` - // Shows the 99th percentile of all Heroku dynos over all hours in the current months for all organizations. - HerokuHostTop99pSum *int64 `json:"heroku_host_top99p_sum,omitempty"` - // Shows sum of the the high-water marks of incident management monthly active users in the current months for all organizations. - IncidentManagementMonthlyActiveUsersHwmSum *int64 `json:"incident_management_monthly_active_users_hwm_sum,omitempty"` - // Shows the sum of all log events indexed over all hours in the current months for all organizations. - IndexedEventsCountAggSum *int64 `json:"indexed_events_count_agg_sum,omitempty"` - // Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current months for all organizations. - InfraHostTop99pSum *int64 `json:"infra_host_top99p_sum,omitempty"` - // Shows the sum of all log bytes ingested over all hours in the current months for all organizations. - IngestedEventsBytesAggSum *int64 `json:"ingested_events_bytes_agg_sum,omitempty"` - // Shows the sum of all IoT devices over all hours in the current months for all organizations. - IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` - // Shows the 99th percentile of all IoT devices over all hours in the current months of all organizations. - IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` - // Shows the the most recent hour in the current months for all organizations for which all usages were calculated. - LastUpdated *time.Time `json:"last_updated,omitempty"` - // Shows the sum of all live logs indexed over all hours in the current months for all organizations (data available as of December 1, 2020). - LiveIndexedEventsAggSum *int64 `json:"live_indexed_events_agg_sum,omitempty"` - // Shows the sum of all live logs bytes ingested over all hours in the current months for all organizations (data available as of December 1, 2020). - LiveIngestedBytesAggSum *int64 `json:"live_ingested_bytes_agg_sum,omitempty"` - // Object containing logs usage data broken down by retention period. - LogsByRetention *LogsByRetention `json:"logs_by_retention,omitempty"` - // Shows the sum of all mobile lite sessions over all hours in the current months for all organizations. - MobileRumLiteSessionCountAggSum *int64 `json:"mobile_rum_lite_session_count_agg_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions over all hours in the current months for all organizations. - MobileRumSessionCountAggSum *int64 `json:"mobile_rum_session_count_agg_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on Android over all hours in the current months for all organizations. - MobileRumSessionCountAndroidAggSum *int64 `json:"mobile_rum_session_count_android_agg_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on iOS over all hours in the current months for all organizations. - MobileRumSessionCountIosAggSum *int64 `json:"mobile_rum_session_count_ios_agg_sum,omitempty"` - // Shows the sum of all mobile RUM Sessions on React Native over all hours in the current months for all organizations. - MobileRumSessionCountReactnativeAggSum *int64 `json:"mobile_rum_session_count_reactnative_agg_sum,omitempty"` - // Shows the sum of all mobile RUM units over all hours in the current months for all organizations. - MobileRumUnitsAggSum *int64 `json:"mobile_rum_units_agg_sum,omitempty"` - // Shows the sum of all Network flows indexed over all hours in the current months for all organizations. - NetflowIndexedEventsCountAggSum *int64 `json:"netflow_indexed_events_count_agg_sum,omitempty"` - // Shows the 99th percentile of all distinct Networks hosts over all hours in the current months for all organizations. - NpmHostTop99pSum *int64 `json:"npm_host_top99p_sum,omitempty"` - // Sum of all observability pipelines bytes processed over all hours in the current months for all organizations. - ObservabilityPipelinesBytesProcessedAggSum *int64 `json:"observability_pipelines_bytes_processed_agg_sum,omitempty"` - // Sum of all online archived events over all hours in the current months for all organizations. - OnlineArchiveEventsCountAggSum *int64 `json:"online_archive_events_count_agg_sum,omitempty"` - // Shows the 99th percentile of all hosts reported by the Datadog exporter for the OpenTelemetry Collector over all hours in the current months for all organizations. - OpentelemetryHostTop99pSum *int64 `json:"opentelemetry_host_top99p_sum,omitempty"` - // Shows the average number of profiled containers over all hours in the current months for all organizations. - ProfilingContainerAgentCountAvg *int64 `json:"profiling_container_agent_count_avg,omitempty"` - // Shows the 99th percentile of all profiled hosts over all hours in the current months for all organizations. - ProfilingHostCountTop99pSum *int64 `json:"profiling_host_count_top99p_sum,omitempty"` - // Shows the sum of all rehydrated logs indexed over all hours in the current months for all organizations (data available as of December 1, 2020). - RehydratedIndexedEventsAggSum *int64 `json:"rehydrated_indexed_events_agg_sum,omitempty"` - // Shows the sum of all rehydrated logs bytes ingested over all hours in the current months for all organizations (data available as of December 1, 2020). - RehydratedIngestedBytesAggSum *int64 `json:"rehydrated_ingested_bytes_agg_sum,omitempty"` - // Shows the sum of all mobile sessions and all browser lite and legacy sessions over all hours in the current month for all organizations. - RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` - // Shows the sum of all browser RUM Lite Sessions over all hours in the current months for all organizations. - RumSessionCountAggSum *int64 `json:"rum_session_count_agg_sum,omitempty"` - // Shows the sum of RUM Sessions (browser and mobile) over all hours in the current months for all organizations. - RumTotalSessionCountAggSum *int64 `json:"rum_total_session_count_agg_sum,omitempty"` - // Shows the sum of all browser and mobile RUM units over all hours in the current months for all organizations. - RumUnitsAggSum *int64 `json:"rum_units_agg_sum,omitempty"` - // Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for all organizations. - SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` - // Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for all organizations. - SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` - // Shows the first date of usage in the current months for all organizations. - StartDate *time.Time `json:"start_date,omitempty"` - // Shows the sum of all Synthetic browser tests over all hours in the current months for all organizations. - SyntheticsBrowserCheckCallsCountAggSum *int64 `json:"synthetics_browser_check_calls_count_agg_sum,omitempty"` - // Shows the sum of all Synthetic API tests over all hours in the current months for all organizations. - SyntheticsCheckCallsCountAggSum *int64 `json:"synthetics_check_calls_count_agg_sum,omitempty"` - // Shows the sum of all Indexed Spans indexed over all hours in the current months for all organizations. - TraceSearchIndexedEventsCountAggSum *int64 `json:"trace_search_indexed_events_count_agg_sum,omitempty"` - // Shows the sum of all ingested APM span bytes over all hours in the current months for all organizations. - TwolIngestedEventsBytesAggSum *int64 `json:"twol_ingested_events_bytes_agg_sum,omitempty"` - // An array of objects regarding hourly usage. - Usage []UsageSummaryDate `json:"usage,omitempty"` - // Shows the 99th percentile of all vSphere hosts over all hours in the current months for all organizations. - VsphereHostTop99pSum *int64 `json:"vsphere_host_top99p_sum,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{} -} - -// NewUsageSummaryResponse instantiates a new UsageSummaryResponse 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 NewUsageSummaryResponse() *UsageSummaryResponse { - this := UsageSummaryResponse{} - return &this -} - -// NewUsageSummaryResponseWithDefaults instantiates a new UsageSummaryResponse 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 NewUsageSummaryResponseWithDefaults() *UsageSummaryResponse { - this := UsageSummaryResponse{} - return &this -} - -// GetAgentHostTop99pSum returns the AgentHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAgentHostTop99pSum() int64 { - if o == nil || o.AgentHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.AgentHostTop99pSum -} - -// GetAgentHostTop99pSumOk returns a tuple with the AgentHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAgentHostTop99pSumOk() (*int64, bool) { - if o == nil || o.AgentHostTop99pSum == nil { - return nil, false - } - return o.AgentHostTop99pSum, true -} - -// HasAgentHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAgentHostTop99pSum() bool { - if o != nil && o.AgentHostTop99pSum != nil { - return true - } - - return false -} - -// SetAgentHostTop99pSum gets a reference to the given int64 and assigns it to the AgentHostTop99pSum field. -func (o *UsageSummaryResponse) SetAgentHostTop99pSum(v int64) { - o.AgentHostTop99pSum = &v -} - -// GetApmAzureAppServiceHostTop99pSum returns the ApmAzureAppServiceHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetApmAzureAppServiceHostTop99pSum() int64 { - if o == nil || o.ApmAzureAppServiceHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.ApmAzureAppServiceHostTop99pSum -} - -// GetApmAzureAppServiceHostTop99pSumOk returns a tuple with the ApmAzureAppServiceHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetApmAzureAppServiceHostTop99pSumOk() (*int64, bool) { - if o == nil || o.ApmAzureAppServiceHostTop99pSum == nil { - return nil, false - } - return o.ApmAzureAppServiceHostTop99pSum, true -} - -// HasApmAzureAppServiceHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasApmAzureAppServiceHostTop99pSum() bool { - if o != nil && o.ApmAzureAppServiceHostTop99pSum != nil { - return true - } - - return false -} - -// SetApmAzureAppServiceHostTop99pSum gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostTop99pSum field. -func (o *UsageSummaryResponse) SetApmAzureAppServiceHostTop99pSum(v int64) { - o.ApmAzureAppServiceHostTop99pSum = &v -} - -// GetApmHostTop99pSum returns the ApmHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetApmHostTop99pSum() int64 { - if o == nil || o.ApmHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.ApmHostTop99pSum -} - -// GetApmHostTop99pSumOk returns a tuple with the ApmHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetApmHostTop99pSumOk() (*int64, bool) { - if o == nil || o.ApmHostTop99pSum == nil { - return nil, false - } - return o.ApmHostTop99pSum, true -} - -// HasApmHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasApmHostTop99pSum() bool { - if o != nil && o.ApmHostTop99pSum != nil { - return true - } - - return false -} - -// SetApmHostTop99pSum gets a reference to the given int64 and assigns it to the ApmHostTop99pSum field. -func (o *UsageSummaryResponse) SetApmHostTop99pSum(v int64) { - o.ApmHostTop99pSum = &v -} - -// GetAuditLogsLinesIndexedAggSum returns the AuditLogsLinesIndexedAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAuditLogsLinesIndexedAggSum() int64 { - if o == nil || o.AuditLogsLinesIndexedAggSum == nil { - var ret int64 - return ret - } - return *o.AuditLogsLinesIndexedAggSum -} - -// GetAuditLogsLinesIndexedAggSumOk returns a tuple with the AuditLogsLinesIndexedAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAuditLogsLinesIndexedAggSumOk() (*int64, bool) { - if o == nil || o.AuditLogsLinesIndexedAggSum == nil { - return nil, false - } - return o.AuditLogsLinesIndexedAggSum, true -} - -// HasAuditLogsLinesIndexedAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAuditLogsLinesIndexedAggSum() bool { - if o != nil && o.AuditLogsLinesIndexedAggSum != nil { - return true - } - - return false -} - -// SetAuditLogsLinesIndexedAggSum gets a reference to the given int64 and assigns it to the AuditLogsLinesIndexedAggSum field. -func (o *UsageSummaryResponse) SetAuditLogsLinesIndexedAggSum(v int64) { - o.AuditLogsLinesIndexedAggSum = &v -} - -// GetAvgProfiledFargateTasksSum returns the AvgProfiledFargateTasksSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAvgProfiledFargateTasksSum() int64 { - if o == nil || o.AvgProfiledFargateTasksSum == nil { - var ret int64 - return ret - } - return *o.AvgProfiledFargateTasksSum -} - -// GetAvgProfiledFargateTasksSumOk returns a tuple with the AvgProfiledFargateTasksSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAvgProfiledFargateTasksSumOk() (*int64, bool) { - if o == nil || o.AvgProfiledFargateTasksSum == nil { - return nil, false - } - return o.AvgProfiledFargateTasksSum, true -} - -// HasAvgProfiledFargateTasksSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAvgProfiledFargateTasksSum() bool { - if o != nil && o.AvgProfiledFargateTasksSum != nil { - return true - } - - return false -} - -// SetAvgProfiledFargateTasksSum gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasksSum field. -func (o *UsageSummaryResponse) SetAvgProfiledFargateTasksSum(v int64) { - o.AvgProfiledFargateTasksSum = &v -} - -// GetAwsHostTop99pSum returns the AwsHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAwsHostTop99pSum() int64 { - if o == nil || o.AwsHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.AwsHostTop99pSum -} - -// GetAwsHostTop99pSumOk returns a tuple with the AwsHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAwsHostTop99pSumOk() (*int64, bool) { - if o == nil || o.AwsHostTop99pSum == nil { - return nil, false - } - return o.AwsHostTop99pSum, true -} - -// HasAwsHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAwsHostTop99pSum() bool { - if o != nil && o.AwsHostTop99pSum != nil { - return true - } - - return false -} - -// SetAwsHostTop99pSum gets a reference to the given int64 and assigns it to the AwsHostTop99pSum field. -func (o *UsageSummaryResponse) SetAwsHostTop99pSum(v int64) { - o.AwsHostTop99pSum = &v -} - -// GetAwsLambdaFuncCount returns the AwsLambdaFuncCount field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAwsLambdaFuncCount() int64 { - if o == nil || o.AwsLambdaFuncCount == nil { - var ret int64 - return ret - } - return *o.AwsLambdaFuncCount -} - -// GetAwsLambdaFuncCountOk returns a tuple with the AwsLambdaFuncCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAwsLambdaFuncCountOk() (*int64, bool) { - if o == nil || o.AwsLambdaFuncCount == nil { - return nil, false - } - return o.AwsLambdaFuncCount, true -} - -// HasAwsLambdaFuncCount returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAwsLambdaFuncCount() bool { - if o != nil && o.AwsLambdaFuncCount != nil { - return true - } - - return false -} - -// SetAwsLambdaFuncCount gets a reference to the given int64 and assigns it to the AwsLambdaFuncCount field. -func (o *UsageSummaryResponse) SetAwsLambdaFuncCount(v int64) { - o.AwsLambdaFuncCount = &v -} - -// GetAwsLambdaInvocationsSum returns the AwsLambdaInvocationsSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAwsLambdaInvocationsSum() int64 { - if o == nil || o.AwsLambdaInvocationsSum == nil { - var ret int64 - return ret - } - return *o.AwsLambdaInvocationsSum -} - -// GetAwsLambdaInvocationsSumOk returns a tuple with the AwsLambdaInvocationsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAwsLambdaInvocationsSumOk() (*int64, bool) { - if o == nil || o.AwsLambdaInvocationsSum == nil { - return nil, false - } - return o.AwsLambdaInvocationsSum, true -} - -// HasAwsLambdaInvocationsSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAwsLambdaInvocationsSum() bool { - if o != nil && o.AwsLambdaInvocationsSum != nil { - return true - } - - return false -} - -// SetAwsLambdaInvocationsSum gets a reference to the given int64 and assigns it to the AwsLambdaInvocationsSum field. -func (o *UsageSummaryResponse) SetAwsLambdaInvocationsSum(v int64) { - o.AwsLambdaInvocationsSum = &v -} - -// GetAzureAppServiceTop99pSum returns the AzureAppServiceTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAzureAppServiceTop99pSum() int64 { - if o == nil || o.AzureAppServiceTop99pSum == nil { - var ret int64 - return ret - } - return *o.AzureAppServiceTop99pSum -} - -// GetAzureAppServiceTop99pSumOk returns a tuple with the AzureAppServiceTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAzureAppServiceTop99pSumOk() (*int64, bool) { - if o == nil || o.AzureAppServiceTop99pSum == nil { - return nil, false - } - return o.AzureAppServiceTop99pSum, true -} - -// HasAzureAppServiceTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAzureAppServiceTop99pSum() bool { - if o != nil && o.AzureAppServiceTop99pSum != nil { - return true - } - - return false -} - -// SetAzureAppServiceTop99pSum gets a reference to the given int64 and assigns it to the AzureAppServiceTop99pSum field. -func (o *UsageSummaryResponse) SetAzureAppServiceTop99pSum(v int64) { - o.AzureAppServiceTop99pSum = &v -} - -// GetAzureHostTop99pSum returns the AzureHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetAzureHostTop99pSum() int64 { - if o == nil || o.AzureHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.AzureHostTop99pSum -} - -// GetAzureHostTop99pSumOk returns a tuple with the AzureHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetAzureHostTop99pSumOk() (*int64, bool) { - if o == nil || o.AzureHostTop99pSum == nil { - return nil, false - } - return o.AzureHostTop99pSum, true -} - -// HasAzureHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasAzureHostTop99pSum() bool { - if o != nil && o.AzureHostTop99pSum != nil { - return true - } - - return false -} - -// SetAzureHostTop99pSum gets a reference to the given int64 and assigns it to the AzureHostTop99pSum field. -func (o *UsageSummaryResponse) SetAzureHostTop99pSum(v int64) { - o.AzureHostTop99pSum = &v -} - -// GetBillableIngestedBytesAggSum returns the BillableIngestedBytesAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetBillableIngestedBytesAggSum() int64 { - if o == nil || o.BillableIngestedBytesAggSum == nil { - var ret int64 - return ret - } - return *o.BillableIngestedBytesAggSum -} - -// GetBillableIngestedBytesAggSumOk returns a tuple with the BillableIngestedBytesAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetBillableIngestedBytesAggSumOk() (*int64, bool) { - if o == nil || o.BillableIngestedBytesAggSum == nil { - return nil, false - } - return o.BillableIngestedBytesAggSum, true -} - -// HasBillableIngestedBytesAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasBillableIngestedBytesAggSum() bool { - if o != nil && o.BillableIngestedBytesAggSum != nil { - return true - } - - return false -} - -// SetBillableIngestedBytesAggSum gets a reference to the given int64 and assigns it to the BillableIngestedBytesAggSum field. -func (o *UsageSummaryResponse) SetBillableIngestedBytesAggSum(v int64) { - o.BillableIngestedBytesAggSum = &v -} - -// GetBrowserRumLiteSessionCountAggSum returns the BrowserRumLiteSessionCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetBrowserRumLiteSessionCountAggSum() int64 { - if o == nil || o.BrowserRumLiteSessionCountAggSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumLiteSessionCountAggSum -} - -// GetBrowserRumLiteSessionCountAggSumOk returns a tuple with the BrowserRumLiteSessionCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetBrowserRumLiteSessionCountAggSumOk() (*int64, bool) { - if o == nil || o.BrowserRumLiteSessionCountAggSum == nil { - return nil, false - } - return o.BrowserRumLiteSessionCountAggSum, true -} - -// HasBrowserRumLiteSessionCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasBrowserRumLiteSessionCountAggSum() bool { - if o != nil && o.BrowserRumLiteSessionCountAggSum != nil { - return true - } - - return false -} - -// SetBrowserRumLiteSessionCountAggSum gets a reference to the given int64 and assigns it to the BrowserRumLiteSessionCountAggSum field. -func (o *UsageSummaryResponse) SetBrowserRumLiteSessionCountAggSum(v int64) { - o.BrowserRumLiteSessionCountAggSum = &v -} - -// GetBrowserRumReplaySessionCountAggSum returns the BrowserRumReplaySessionCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetBrowserRumReplaySessionCountAggSum() int64 { - if o == nil || o.BrowserRumReplaySessionCountAggSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumReplaySessionCountAggSum -} - -// GetBrowserRumReplaySessionCountAggSumOk returns a tuple with the BrowserRumReplaySessionCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetBrowserRumReplaySessionCountAggSumOk() (*int64, bool) { - if o == nil || o.BrowserRumReplaySessionCountAggSum == nil { - return nil, false - } - return o.BrowserRumReplaySessionCountAggSum, true -} - -// HasBrowserRumReplaySessionCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasBrowserRumReplaySessionCountAggSum() bool { - if o != nil && o.BrowserRumReplaySessionCountAggSum != nil { - return true - } - - return false -} - -// SetBrowserRumReplaySessionCountAggSum gets a reference to the given int64 and assigns it to the BrowserRumReplaySessionCountAggSum field. -func (o *UsageSummaryResponse) SetBrowserRumReplaySessionCountAggSum(v int64) { - o.BrowserRumReplaySessionCountAggSum = &v -} - -// GetBrowserRumUnitsAggSum returns the BrowserRumUnitsAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetBrowserRumUnitsAggSum() int64 { - if o == nil || o.BrowserRumUnitsAggSum == nil { - var ret int64 - return ret - } - return *o.BrowserRumUnitsAggSum -} - -// GetBrowserRumUnitsAggSumOk returns a tuple with the BrowserRumUnitsAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetBrowserRumUnitsAggSumOk() (*int64, bool) { - if o == nil || o.BrowserRumUnitsAggSum == nil { - return nil, false - } - return o.BrowserRumUnitsAggSum, true -} - -// HasBrowserRumUnitsAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasBrowserRumUnitsAggSum() bool { - if o != nil && o.BrowserRumUnitsAggSum != nil { - return true - } - - return false -} - -// SetBrowserRumUnitsAggSum gets a reference to the given int64 and assigns it to the BrowserRumUnitsAggSum field. -func (o *UsageSummaryResponse) SetBrowserRumUnitsAggSum(v int64) { - o.BrowserRumUnitsAggSum = &v -} - -// GetCiPipelineIndexedSpansAggSum returns the CiPipelineIndexedSpansAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCiPipelineIndexedSpansAggSum() int64 { - if o == nil || o.CiPipelineIndexedSpansAggSum == nil { - var ret int64 - return ret - } - return *o.CiPipelineIndexedSpansAggSum -} - -// GetCiPipelineIndexedSpansAggSumOk returns a tuple with the CiPipelineIndexedSpansAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCiPipelineIndexedSpansAggSumOk() (*int64, bool) { - if o == nil || o.CiPipelineIndexedSpansAggSum == nil { - return nil, false - } - return o.CiPipelineIndexedSpansAggSum, true -} - -// HasCiPipelineIndexedSpansAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCiPipelineIndexedSpansAggSum() bool { - if o != nil && o.CiPipelineIndexedSpansAggSum != nil { - return true - } - - return false -} - -// SetCiPipelineIndexedSpansAggSum gets a reference to the given int64 and assigns it to the CiPipelineIndexedSpansAggSum field. -func (o *UsageSummaryResponse) SetCiPipelineIndexedSpansAggSum(v int64) { - o.CiPipelineIndexedSpansAggSum = &v -} - -// GetCiTestIndexedSpansAggSum returns the CiTestIndexedSpansAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCiTestIndexedSpansAggSum() int64 { - if o == nil || o.CiTestIndexedSpansAggSum == nil { - var ret int64 - return ret - } - return *o.CiTestIndexedSpansAggSum -} - -// GetCiTestIndexedSpansAggSumOk returns a tuple with the CiTestIndexedSpansAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCiTestIndexedSpansAggSumOk() (*int64, bool) { - if o == nil || o.CiTestIndexedSpansAggSum == nil { - return nil, false - } - return o.CiTestIndexedSpansAggSum, true -} - -// HasCiTestIndexedSpansAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCiTestIndexedSpansAggSum() bool { - if o != nil && o.CiTestIndexedSpansAggSum != nil { - return true - } - - return false -} - -// SetCiTestIndexedSpansAggSum gets a reference to the given int64 and assigns it to the CiTestIndexedSpansAggSum field. -func (o *UsageSummaryResponse) SetCiTestIndexedSpansAggSum(v int64) { - o.CiTestIndexedSpansAggSum = &v -} - -// GetCiVisibilityPipelineCommittersHwmSum returns the CiVisibilityPipelineCommittersHwmSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCiVisibilityPipelineCommittersHwmSum() int64 { - if o == nil || o.CiVisibilityPipelineCommittersHwmSum == nil { - var ret int64 - return ret - } - return *o.CiVisibilityPipelineCommittersHwmSum -} - -// GetCiVisibilityPipelineCommittersHwmSumOk returns a tuple with the CiVisibilityPipelineCommittersHwmSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCiVisibilityPipelineCommittersHwmSumOk() (*int64, bool) { - if o == nil || o.CiVisibilityPipelineCommittersHwmSum == nil { - return nil, false - } - return o.CiVisibilityPipelineCommittersHwmSum, true -} - -// HasCiVisibilityPipelineCommittersHwmSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCiVisibilityPipelineCommittersHwmSum() bool { - if o != nil && o.CiVisibilityPipelineCommittersHwmSum != nil { - return true - } - - return false -} - -// SetCiVisibilityPipelineCommittersHwmSum gets a reference to the given int64 and assigns it to the CiVisibilityPipelineCommittersHwmSum field. -func (o *UsageSummaryResponse) SetCiVisibilityPipelineCommittersHwmSum(v int64) { - o.CiVisibilityPipelineCommittersHwmSum = &v -} - -// GetCiVisibilityTestCommittersHwmSum returns the CiVisibilityTestCommittersHwmSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCiVisibilityTestCommittersHwmSum() int64 { - if o == nil || o.CiVisibilityTestCommittersHwmSum == nil { - var ret int64 - return ret - } - return *o.CiVisibilityTestCommittersHwmSum -} - -// GetCiVisibilityTestCommittersHwmSumOk returns a tuple with the CiVisibilityTestCommittersHwmSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCiVisibilityTestCommittersHwmSumOk() (*int64, bool) { - if o == nil || o.CiVisibilityTestCommittersHwmSum == nil { - return nil, false - } - return o.CiVisibilityTestCommittersHwmSum, true -} - -// HasCiVisibilityTestCommittersHwmSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCiVisibilityTestCommittersHwmSum() bool { - if o != nil && o.CiVisibilityTestCommittersHwmSum != nil { - return true - } - - return false -} - -// SetCiVisibilityTestCommittersHwmSum gets a reference to the given int64 and assigns it to the CiVisibilityTestCommittersHwmSum field. -func (o *UsageSummaryResponse) SetCiVisibilityTestCommittersHwmSum(v int64) { - o.CiVisibilityTestCommittersHwmSum = &v -} - -// GetContainerAvgSum returns the ContainerAvgSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetContainerAvgSum() int64 { - if o == nil || o.ContainerAvgSum == nil { - var ret int64 - return ret - } - return *o.ContainerAvgSum -} - -// GetContainerAvgSumOk returns a tuple with the ContainerAvgSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetContainerAvgSumOk() (*int64, bool) { - if o == nil || o.ContainerAvgSum == nil { - return nil, false - } - return o.ContainerAvgSum, true -} - -// HasContainerAvgSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasContainerAvgSum() bool { - if o != nil && o.ContainerAvgSum != nil { - return true - } - - return false -} - -// SetContainerAvgSum gets a reference to the given int64 and assigns it to the ContainerAvgSum field. -func (o *UsageSummaryResponse) SetContainerAvgSum(v int64) { - o.ContainerAvgSum = &v -} - -// GetContainerHwmSum returns the ContainerHwmSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetContainerHwmSum() int64 { - if o == nil || o.ContainerHwmSum == nil { - var ret int64 - return ret - } - return *o.ContainerHwmSum -} - -// GetContainerHwmSumOk returns a tuple with the ContainerHwmSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetContainerHwmSumOk() (*int64, bool) { - if o == nil || o.ContainerHwmSum == nil { - return nil, false - } - return o.ContainerHwmSum, true -} - -// HasContainerHwmSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasContainerHwmSum() bool { - if o != nil && o.ContainerHwmSum != nil { - return true - } - - return false -} - -// SetContainerHwmSum gets a reference to the given int64 and assigns it to the ContainerHwmSum field. -func (o *UsageSummaryResponse) SetContainerHwmSum(v int64) { - o.ContainerHwmSum = &v -} - -// GetCspmAasHostTop99pSum returns the CspmAasHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCspmAasHostTop99pSum() int64 { - if o == nil || o.CspmAasHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.CspmAasHostTop99pSum -} - -// GetCspmAasHostTop99pSumOk returns a tuple with the CspmAasHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCspmAasHostTop99pSumOk() (*int64, bool) { - if o == nil || o.CspmAasHostTop99pSum == nil { - return nil, false - } - return o.CspmAasHostTop99pSum, true -} - -// HasCspmAasHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCspmAasHostTop99pSum() bool { - if o != nil && o.CspmAasHostTop99pSum != nil { - return true - } - - return false -} - -// SetCspmAasHostTop99pSum gets a reference to the given int64 and assigns it to the CspmAasHostTop99pSum field. -func (o *UsageSummaryResponse) SetCspmAasHostTop99pSum(v int64) { - o.CspmAasHostTop99pSum = &v -} - -// GetCspmAzureHostTop99pSum returns the CspmAzureHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCspmAzureHostTop99pSum() int64 { - if o == nil || o.CspmAzureHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.CspmAzureHostTop99pSum -} - -// GetCspmAzureHostTop99pSumOk returns a tuple with the CspmAzureHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCspmAzureHostTop99pSumOk() (*int64, bool) { - if o == nil || o.CspmAzureHostTop99pSum == nil { - return nil, false - } - return o.CspmAzureHostTop99pSum, true -} - -// HasCspmAzureHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCspmAzureHostTop99pSum() bool { - if o != nil && o.CspmAzureHostTop99pSum != nil { - return true - } - - return false -} - -// SetCspmAzureHostTop99pSum gets a reference to the given int64 and assigns it to the CspmAzureHostTop99pSum field. -func (o *UsageSummaryResponse) SetCspmAzureHostTop99pSum(v int64) { - o.CspmAzureHostTop99pSum = &v -} - -// GetCspmContainerAvgSum returns the CspmContainerAvgSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCspmContainerAvgSum() int64 { - if o == nil || o.CspmContainerAvgSum == nil { - var ret int64 - return ret - } - return *o.CspmContainerAvgSum -} - -// GetCspmContainerAvgSumOk returns a tuple with the CspmContainerAvgSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCspmContainerAvgSumOk() (*int64, bool) { - if o == nil || o.CspmContainerAvgSum == nil { - return nil, false - } - return o.CspmContainerAvgSum, true -} - -// HasCspmContainerAvgSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCspmContainerAvgSum() bool { - if o != nil && o.CspmContainerAvgSum != nil { - return true - } - - return false -} - -// SetCspmContainerAvgSum gets a reference to the given int64 and assigns it to the CspmContainerAvgSum field. -func (o *UsageSummaryResponse) SetCspmContainerAvgSum(v int64) { - o.CspmContainerAvgSum = &v -} - -// GetCspmContainerHwmSum returns the CspmContainerHwmSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCspmContainerHwmSum() int64 { - if o == nil || o.CspmContainerHwmSum == nil { - var ret int64 - return ret - } - return *o.CspmContainerHwmSum -} - -// GetCspmContainerHwmSumOk returns a tuple with the CspmContainerHwmSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCspmContainerHwmSumOk() (*int64, bool) { - if o == nil || o.CspmContainerHwmSum == nil { - return nil, false - } - return o.CspmContainerHwmSum, true -} - -// HasCspmContainerHwmSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCspmContainerHwmSum() bool { - if o != nil && o.CspmContainerHwmSum != nil { - return true - } - - return false -} - -// SetCspmContainerHwmSum gets a reference to the given int64 and assigns it to the CspmContainerHwmSum field. -func (o *UsageSummaryResponse) SetCspmContainerHwmSum(v int64) { - o.CspmContainerHwmSum = &v -} - -// GetCspmHostTop99pSum returns the CspmHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCspmHostTop99pSum() int64 { - if o == nil || o.CspmHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.CspmHostTop99pSum -} - -// GetCspmHostTop99pSumOk returns a tuple with the CspmHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCspmHostTop99pSumOk() (*int64, bool) { - if o == nil || o.CspmHostTop99pSum == nil { - return nil, false - } - return o.CspmHostTop99pSum, true -} - -// HasCspmHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCspmHostTop99pSum() bool { - if o != nil && o.CspmHostTop99pSum != nil { - return true - } - - return false -} - -// SetCspmHostTop99pSum gets a reference to the given int64 and assigns it to the CspmHostTop99pSum field. -func (o *UsageSummaryResponse) SetCspmHostTop99pSum(v int64) { - o.CspmHostTop99pSum = &v -} - -// GetCustomTsSum returns the CustomTsSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCustomTsSum() int64 { - if o == nil || o.CustomTsSum == nil { - var ret int64 - return ret - } - return *o.CustomTsSum -} - -// GetCustomTsSumOk returns a tuple with the CustomTsSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCustomTsSumOk() (*int64, bool) { - if o == nil || o.CustomTsSum == nil { - return nil, false - } - return o.CustomTsSum, true -} - -// HasCustomTsSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCustomTsSum() bool { - if o != nil && o.CustomTsSum != nil { - return true - } - - return false -} - -// SetCustomTsSum gets a reference to the given int64 and assigns it to the CustomTsSum field. -func (o *UsageSummaryResponse) SetCustomTsSum(v int64) { - o.CustomTsSum = &v -} - -// GetCwsContainersAvgSum returns the CwsContainersAvgSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCwsContainersAvgSum() int64 { - if o == nil || o.CwsContainersAvgSum == nil { - var ret int64 - return ret - } - return *o.CwsContainersAvgSum -} - -// GetCwsContainersAvgSumOk returns a tuple with the CwsContainersAvgSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCwsContainersAvgSumOk() (*int64, bool) { - if o == nil || o.CwsContainersAvgSum == nil { - return nil, false - } - return o.CwsContainersAvgSum, true -} - -// HasCwsContainersAvgSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCwsContainersAvgSum() bool { - if o != nil && o.CwsContainersAvgSum != nil { - return true - } - - return false -} - -// SetCwsContainersAvgSum gets a reference to the given int64 and assigns it to the CwsContainersAvgSum field. -func (o *UsageSummaryResponse) SetCwsContainersAvgSum(v int64) { - o.CwsContainersAvgSum = &v -} - -// GetCwsHostTop99pSum returns the CwsHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetCwsHostTop99pSum() int64 { - if o == nil || o.CwsHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.CwsHostTop99pSum -} - -// GetCwsHostTop99pSumOk returns a tuple with the CwsHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetCwsHostTop99pSumOk() (*int64, bool) { - if o == nil || o.CwsHostTop99pSum == nil { - return nil, false - } - return o.CwsHostTop99pSum, true -} - -// HasCwsHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasCwsHostTop99pSum() bool { - if o != nil && o.CwsHostTop99pSum != nil { - return true - } - - return false -} - -// SetCwsHostTop99pSum gets a reference to the given int64 and assigns it to the CwsHostTop99pSum field. -func (o *UsageSummaryResponse) SetCwsHostTop99pSum(v int64) { - o.CwsHostTop99pSum = &v -} - -// GetDbmHostTop99pSum returns the DbmHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetDbmHostTop99pSum() int64 { - if o == nil || o.DbmHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.DbmHostTop99pSum -} - -// GetDbmHostTop99pSumOk returns a tuple with the DbmHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetDbmHostTop99pSumOk() (*int64, bool) { - if o == nil || o.DbmHostTop99pSum == nil { - return nil, false - } - return o.DbmHostTop99pSum, true -} - -// HasDbmHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasDbmHostTop99pSum() bool { - if o != nil && o.DbmHostTop99pSum != nil { - return true - } - - return false -} - -// SetDbmHostTop99pSum gets a reference to the given int64 and assigns it to the DbmHostTop99pSum field. -func (o *UsageSummaryResponse) SetDbmHostTop99pSum(v int64) { - o.DbmHostTop99pSum = &v -} - -// GetDbmQueriesAvgSum returns the DbmQueriesAvgSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetDbmQueriesAvgSum() int64 { - if o == nil || o.DbmQueriesAvgSum == nil { - var ret int64 - return ret - } - return *o.DbmQueriesAvgSum -} - -// GetDbmQueriesAvgSumOk returns a tuple with the DbmQueriesAvgSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetDbmQueriesAvgSumOk() (*int64, bool) { - if o == nil || o.DbmQueriesAvgSum == nil { - return nil, false - } - return o.DbmQueriesAvgSum, true -} - -// HasDbmQueriesAvgSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasDbmQueriesAvgSum() bool { - if o != nil && o.DbmQueriesAvgSum != nil { - return true - } - - return false -} - -// SetDbmQueriesAvgSum gets a reference to the given int64 and assigns it to the DbmQueriesAvgSum field. -func (o *UsageSummaryResponse) SetDbmQueriesAvgSum(v int64) { - o.DbmQueriesAvgSum = &v -} - -// GetEndDate returns the EndDate field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetEndDate() time.Time { - if o == nil || o.EndDate == nil { - var ret time.Time - return ret - } - return *o.EndDate -} - -// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetEndDateOk() (*time.Time, bool) { - if o == nil || o.EndDate == nil { - return nil, false - } - return o.EndDate, true -} - -// HasEndDate returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasEndDate() bool { - if o != nil && o.EndDate != nil { - return true - } - - return false -} - -// SetEndDate gets a reference to the given time.Time and assigns it to the EndDate field. -func (o *UsageSummaryResponse) SetEndDate(v time.Time) { - o.EndDate = &v -} - -// GetFargateTasksCountAvgSum returns the FargateTasksCountAvgSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetFargateTasksCountAvgSum() int64 { - if o == nil || o.FargateTasksCountAvgSum == nil { - var ret int64 - return ret - } - return *o.FargateTasksCountAvgSum -} - -// GetFargateTasksCountAvgSumOk returns a tuple with the FargateTasksCountAvgSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetFargateTasksCountAvgSumOk() (*int64, bool) { - if o == nil || o.FargateTasksCountAvgSum == nil { - return nil, false - } - return o.FargateTasksCountAvgSum, true -} - -// HasFargateTasksCountAvgSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasFargateTasksCountAvgSum() bool { - if o != nil && o.FargateTasksCountAvgSum != nil { - return true - } - - return false -} - -// SetFargateTasksCountAvgSum gets a reference to the given int64 and assigns it to the FargateTasksCountAvgSum field. -func (o *UsageSummaryResponse) SetFargateTasksCountAvgSum(v int64) { - o.FargateTasksCountAvgSum = &v -} - -// GetFargateTasksCountHwmSum returns the FargateTasksCountHwmSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetFargateTasksCountHwmSum() int64 { - if o == nil || o.FargateTasksCountHwmSum == nil { - var ret int64 - return ret - } - return *o.FargateTasksCountHwmSum -} - -// GetFargateTasksCountHwmSumOk returns a tuple with the FargateTasksCountHwmSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetFargateTasksCountHwmSumOk() (*int64, bool) { - if o == nil || o.FargateTasksCountHwmSum == nil { - return nil, false - } - return o.FargateTasksCountHwmSum, true -} - -// HasFargateTasksCountHwmSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasFargateTasksCountHwmSum() bool { - if o != nil && o.FargateTasksCountHwmSum != nil { - return true - } - - return false -} - -// SetFargateTasksCountHwmSum gets a reference to the given int64 and assigns it to the FargateTasksCountHwmSum field. -func (o *UsageSummaryResponse) SetFargateTasksCountHwmSum(v int64) { - o.FargateTasksCountHwmSum = &v -} - -// GetGcpHostTop99pSum returns the GcpHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetGcpHostTop99pSum() int64 { - if o == nil || o.GcpHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.GcpHostTop99pSum -} - -// GetGcpHostTop99pSumOk returns a tuple with the GcpHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetGcpHostTop99pSumOk() (*int64, bool) { - if o == nil || o.GcpHostTop99pSum == nil { - return nil, false - } - return o.GcpHostTop99pSum, true -} - -// HasGcpHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasGcpHostTop99pSum() bool { - if o != nil && o.GcpHostTop99pSum != nil { - return true - } - - return false -} - -// SetGcpHostTop99pSum gets a reference to the given int64 and assigns it to the GcpHostTop99pSum field. -func (o *UsageSummaryResponse) SetGcpHostTop99pSum(v int64) { - o.GcpHostTop99pSum = &v -} - -// GetHerokuHostTop99pSum returns the HerokuHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetHerokuHostTop99pSum() int64 { - if o == nil || o.HerokuHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.HerokuHostTop99pSum -} - -// GetHerokuHostTop99pSumOk returns a tuple with the HerokuHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetHerokuHostTop99pSumOk() (*int64, bool) { - if o == nil || o.HerokuHostTop99pSum == nil { - return nil, false - } - return o.HerokuHostTop99pSum, true -} - -// HasHerokuHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasHerokuHostTop99pSum() bool { - if o != nil && o.HerokuHostTop99pSum != nil { - return true - } - - return false -} - -// SetHerokuHostTop99pSum gets a reference to the given int64 and assigns it to the HerokuHostTop99pSum field. -func (o *UsageSummaryResponse) SetHerokuHostTop99pSum(v int64) { - o.HerokuHostTop99pSum = &v -} - -// GetIncidentManagementMonthlyActiveUsersHwmSum returns the IncidentManagementMonthlyActiveUsersHwmSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetIncidentManagementMonthlyActiveUsersHwmSum() int64 { - if o == nil || o.IncidentManagementMonthlyActiveUsersHwmSum == nil { - var ret int64 - return ret - } - return *o.IncidentManagementMonthlyActiveUsersHwmSum -} - -// GetIncidentManagementMonthlyActiveUsersHwmSumOk returns a tuple with the IncidentManagementMonthlyActiveUsersHwmSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetIncidentManagementMonthlyActiveUsersHwmSumOk() (*int64, bool) { - if o == nil || o.IncidentManagementMonthlyActiveUsersHwmSum == nil { - return nil, false - } - return o.IncidentManagementMonthlyActiveUsersHwmSum, true -} - -// HasIncidentManagementMonthlyActiveUsersHwmSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasIncidentManagementMonthlyActiveUsersHwmSum() bool { - if o != nil && o.IncidentManagementMonthlyActiveUsersHwmSum != nil { - return true - } - - return false -} - -// SetIncidentManagementMonthlyActiveUsersHwmSum gets a reference to the given int64 and assigns it to the IncidentManagementMonthlyActiveUsersHwmSum field. -func (o *UsageSummaryResponse) SetIncidentManagementMonthlyActiveUsersHwmSum(v int64) { - o.IncidentManagementMonthlyActiveUsersHwmSum = &v -} - -// GetIndexedEventsCountAggSum returns the IndexedEventsCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetIndexedEventsCountAggSum() int64 { - if o == nil || o.IndexedEventsCountAggSum == nil { - var ret int64 - return ret - } - return *o.IndexedEventsCountAggSum -} - -// GetIndexedEventsCountAggSumOk returns a tuple with the IndexedEventsCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetIndexedEventsCountAggSumOk() (*int64, bool) { - if o == nil || o.IndexedEventsCountAggSum == nil { - return nil, false - } - return o.IndexedEventsCountAggSum, true -} - -// HasIndexedEventsCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasIndexedEventsCountAggSum() bool { - if o != nil && o.IndexedEventsCountAggSum != nil { - return true - } - - return false -} - -// SetIndexedEventsCountAggSum gets a reference to the given int64 and assigns it to the IndexedEventsCountAggSum field. -func (o *UsageSummaryResponse) SetIndexedEventsCountAggSum(v int64) { - o.IndexedEventsCountAggSum = &v -} - -// GetInfraHostTop99pSum returns the InfraHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetInfraHostTop99pSum() int64 { - if o == nil || o.InfraHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.InfraHostTop99pSum -} - -// GetInfraHostTop99pSumOk returns a tuple with the InfraHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetInfraHostTop99pSumOk() (*int64, bool) { - if o == nil || o.InfraHostTop99pSum == nil { - return nil, false - } - return o.InfraHostTop99pSum, true -} - -// HasInfraHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasInfraHostTop99pSum() bool { - if o != nil && o.InfraHostTop99pSum != nil { - return true - } - - return false -} - -// SetInfraHostTop99pSum gets a reference to the given int64 and assigns it to the InfraHostTop99pSum field. -func (o *UsageSummaryResponse) SetInfraHostTop99pSum(v int64) { - o.InfraHostTop99pSum = &v -} - -// GetIngestedEventsBytesAggSum returns the IngestedEventsBytesAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetIngestedEventsBytesAggSum() int64 { - if o == nil || o.IngestedEventsBytesAggSum == nil { - var ret int64 - return ret - } - return *o.IngestedEventsBytesAggSum -} - -// GetIngestedEventsBytesAggSumOk returns a tuple with the IngestedEventsBytesAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetIngestedEventsBytesAggSumOk() (*int64, bool) { - if o == nil || o.IngestedEventsBytesAggSum == nil { - return nil, false - } - return o.IngestedEventsBytesAggSum, true -} - -// HasIngestedEventsBytesAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasIngestedEventsBytesAggSum() bool { - if o != nil && o.IngestedEventsBytesAggSum != nil { - return true - } - - return false -} - -// SetIngestedEventsBytesAggSum gets a reference to the given int64 and assigns it to the IngestedEventsBytesAggSum field. -func (o *UsageSummaryResponse) SetIngestedEventsBytesAggSum(v int64) { - o.IngestedEventsBytesAggSum = &v -} - -// GetIotDeviceAggSum returns the IotDeviceAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetIotDeviceAggSum() int64 { - if o == nil || o.IotDeviceAggSum == nil { - var ret int64 - return ret - } - return *o.IotDeviceAggSum -} - -// GetIotDeviceAggSumOk returns a tuple with the IotDeviceAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetIotDeviceAggSumOk() (*int64, bool) { - if o == nil || o.IotDeviceAggSum == nil { - return nil, false - } - return o.IotDeviceAggSum, true -} - -// HasIotDeviceAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasIotDeviceAggSum() bool { - if o != nil && o.IotDeviceAggSum != nil { - return true - } - - return false -} - -// SetIotDeviceAggSum gets a reference to the given int64 and assigns it to the IotDeviceAggSum field. -func (o *UsageSummaryResponse) SetIotDeviceAggSum(v int64) { - o.IotDeviceAggSum = &v -} - -// GetIotDeviceTop99pSum returns the IotDeviceTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetIotDeviceTop99pSum() int64 { - if o == nil || o.IotDeviceTop99pSum == nil { - var ret int64 - return ret - } - return *o.IotDeviceTop99pSum -} - -// GetIotDeviceTop99pSumOk returns a tuple with the IotDeviceTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetIotDeviceTop99pSumOk() (*int64, bool) { - if o == nil || o.IotDeviceTop99pSum == nil { - return nil, false - } - return o.IotDeviceTop99pSum, true -} - -// HasIotDeviceTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasIotDeviceTop99pSum() bool { - if o != nil && o.IotDeviceTop99pSum != nil { - return true - } - - return false -} - -// SetIotDeviceTop99pSum gets a reference to the given int64 and assigns it to the IotDeviceTop99pSum field. -func (o *UsageSummaryResponse) SetIotDeviceTop99pSum(v int64) { - o.IotDeviceTop99pSum = &v -} - -// GetLastUpdated returns the LastUpdated field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetLastUpdated() time.Time { - if o == nil || o.LastUpdated == nil { - var ret time.Time - return ret - } - return *o.LastUpdated -} - -// GetLastUpdatedOk returns a tuple with the LastUpdated field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetLastUpdatedOk() (*time.Time, bool) { - if o == nil || o.LastUpdated == nil { - return nil, false - } - return o.LastUpdated, true -} - -// HasLastUpdated returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasLastUpdated() bool { - if o != nil && o.LastUpdated != nil { - return true - } - - return false -} - -// SetLastUpdated gets a reference to the given time.Time and assigns it to the LastUpdated field. -func (o *UsageSummaryResponse) SetLastUpdated(v time.Time) { - o.LastUpdated = &v -} - -// GetLiveIndexedEventsAggSum returns the LiveIndexedEventsAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetLiveIndexedEventsAggSum() int64 { - if o == nil || o.LiveIndexedEventsAggSum == nil { - var ret int64 - return ret - } - return *o.LiveIndexedEventsAggSum -} - -// GetLiveIndexedEventsAggSumOk returns a tuple with the LiveIndexedEventsAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetLiveIndexedEventsAggSumOk() (*int64, bool) { - if o == nil || o.LiveIndexedEventsAggSum == nil { - return nil, false - } - return o.LiveIndexedEventsAggSum, true -} - -// HasLiveIndexedEventsAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasLiveIndexedEventsAggSum() bool { - if o != nil && o.LiveIndexedEventsAggSum != nil { - return true - } - - return false -} - -// SetLiveIndexedEventsAggSum gets a reference to the given int64 and assigns it to the LiveIndexedEventsAggSum field. -func (o *UsageSummaryResponse) SetLiveIndexedEventsAggSum(v int64) { - o.LiveIndexedEventsAggSum = &v -} - -// GetLiveIngestedBytesAggSum returns the LiveIngestedBytesAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetLiveIngestedBytesAggSum() int64 { - if o == nil || o.LiveIngestedBytesAggSum == nil { - var ret int64 - return ret - } - return *o.LiveIngestedBytesAggSum -} - -// GetLiveIngestedBytesAggSumOk returns a tuple with the LiveIngestedBytesAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetLiveIngestedBytesAggSumOk() (*int64, bool) { - if o == nil || o.LiveIngestedBytesAggSum == nil { - return nil, false - } - return o.LiveIngestedBytesAggSum, true -} - -// HasLiveIngestedBytesAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasLiveIngestedBytesAggSum() bool { - if o != nil && o.LiveIngestedBytesAggSum != nil { - return true - } - - return false -} - -// SetLiveIngestedBytesAggSum gets a reference to the given int64 and assigns it to the LiveIngestedBytesAggSum field. -func (o *UsageSummaryResponse) SetLiveIngestedBytesAggSum(v int64) { - o.LiveIngestedBytesAggSum = &v -} - -// GetLogsByRetention returns the LogsByRetention field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetLogsByRetention() LogsByRetention { - if o == nil || o.LogsByRetention == nil { - var ret LogsByRetention - return ret - } - return *o.LogsByRetention -} - -// GetLogsByRetentionOk returns a tuple with the LogsByRetention field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetLogsByRetentionOk() (*LogsByRetention, bool) { - if o == nil || o.LogsByRetention == nil { - return nil, false - } - return o.LogsByRetention, true -} - -// HasLogsByRetention returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasLogsByRetention() bool { - if o != nil && o.LogsByRetention != nil { - return true - } - - return false -} - -// SetLogsByRetention gets a reference to the given LogsByRetention and assigns it to the LogsByRetention field. -func (o *UsageSummaryResponse) SetLogsByRetention(v LogsByRetention) { - o.LogsByRetention = &v -} - -// GetMobileRumLiteSessionCountAggSum returns the MobileRumLiteSessionCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetMobileRumLiteSessionCountAggSum() int64 { - if o == nil || o.MobileRumLiteSessionCountAggSum == nil { - var ret int64 - return ret - } - return *o.MobileRumLiteSessionCountAggSum -} - -// GetMobileRumLiteSessionCountAggSumOk returns a tuple with the MobileRumLiteSessionCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetMobileRumLiteSessionCountAggSumOk() (*int64, bool) { - if o == nil || o.MobileRumLiteSessionCountAggSum == nil { - return nil, false - } - return o.MobileRumLiteSessionCountAggSum, true -} - -// HasMobileRumLiteSessionCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasMobileRumLiteSessionCountAggSum() bool { - if o != nil && o.MobileRumLiteSessionCountAggSum != nil { - return true - } - - return false -} - -// SetMobileRumLiteSessionCountAggSum gets a reference to the given int64 and assigns it to the MobileRumLiteSessionCountAggSum field. -func (o *UsageSummaryResponse) SetMobileRumLiteSessionCountAggSum(v int64) { - o.MobileRumLiteSessionCountAggSum = &v -} - -// GetMobileRumSessionCountAggSum returns the MobileRumSessionCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetMobileRumSessionCountAggSum() int64 { - if o == nil || o.MobileRumSessionCountAggSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountAggSum -} - -// GetMobileRumSessionCountAggSumOk returns a tuple with the MobileRumSessionCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetMobileRumSessionCountAggSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountAggSum == nil { - return nil, false - } - return o.MobileRumSessionCountAggSum, true -} - -// HasMobileRumSessionCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasMobileRumSessionCountAggSum() bool { - if o != nil && o.MobileRumSessionCountAggSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAggSum field. -func (o *UsageSummaryResponse) SetMobileRumSessionCountAggSum(v int64) { - o.MobileRumSessionCountAggSum = &v -} - -// GetMobileRumSessionCountAndroidAggSum returns the MobileRumSessionCountAndroidAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetMobileRumSessionCountAndroidAggSum() int64 { - if o == nil || o.MobileRumSessionCountAndroidAggSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountAndroidAggSum -} - -// GetMobileRumSessionCountAndroidAggSumOk returns a tuple with the MobileRumSessionCountAndroidAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetMobileRumSessionCountAndroidAggSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountAndroidAggSum == nil { - return nil, false - } - return o.MobileRumSessionCountAndroidAggSum, true -} - -// HasMobileRumSessionCountAndroidAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasMobileRumSessionCountAndroidAggSum() bool { - if o != nil && o.MobileRumSessionCountAndroidAggSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountAndroidAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAndroidAggSum field. -func (o *UsageSummaryResponse) SetMobileRumSessionCountAndroidAggSum(v int64) { - o.MobileRumSessionCountAndroidAggSum = &v -} - -// GetMobileRumSessionCountIosAggSum returns the MobileRumSessionCountIosAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetMobileRumSessionCountIosAggSum() int64 { - if o == nil || o.MobileRumSessionCountIosAggSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountIosAggSum -} - -// GetMobileRumSessionCountIosAggSumOk returns a tuple with the MobileRumSessionCountIosAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetMobileRumSessionCountIosAggSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountIosAggSum == nil { - return nil, false - } - return o.MobileRumSessionCountIosAggSum, true -} - -// HasMobileRumSessionCountIosAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasMobileRumSessionCountIosAggSum() bool { - if o != nil && o.MobileRumSessionCountIosAggSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountIosAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountIosAggSum field. -func (o *UsageSummaryResponse) SetMobileRumSessionCountIosAggSum(v int64) { - o.MobileRumSessionCountIosAggSum = &v -} - -// GetMobileRumSessionCountReactnativeAggSum returns the MobileRumSessionCountReactnativeAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetMobileRumSessionCountReactnativeAggSum() int64 { - if o == nil || o.MobileRumSessionCountReactnativeAggSum == nil { - var ret int64 - return ret - } - return *o.MobileRumSessionCountReactnativeAggSum -} - -// GetMobileRumSessionCountReactnativeAggSumOk returns a tuple with the MobileRumSessionCountReactnativeAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetMobileRumSessionCountReactnativeAggSumOk() (*int64, bool) { - if o == nil || o.MobileRumSessionCountReactnativeAggSum == nil { - return nil, false - } - return o.MobileRumSessionCountReactnativeAggSum, true -} - -// HasMobileRumSessionCountReactnativeAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasMobileRumSessionCountReactnativeAggSum() bool { - if o != nil && o.MobileRumSessionCountReactnativeAggSum != nil { - return true - } - - return false -} - -// SetMobileRumSessionCountReactnativeAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountReactnativeAggSum field. -func (o *UsageSummaryResponse) SetMobileRumSessionCountReactnativeAggSum(v int64) { - o.MobileRumSessionCountReactnativeAggSum = &v -} - -// GetMobileRumUnitsAggSum returns the MobileRumUnitsAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetMobileRumUnitsAggSum() int64 { - if o == nil || o.MobileRumUnitsAggSum == nil { - var ret int64 - return ret - } - return *o.MobileRumUnitsAggSum -} - -// GetMobileRumUnitsAggSumOk returns a tuple with the MobileRumUnitsAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetMobileRumUnitsAggSumOk() (*int64, bool) { - if o == nil || o.MobileRumUnitsAggSum == nil { - return nil, false - } - return o.MobileRumUnitsAggSum, true -} - -// HasMobileRumUnitsAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasMobileRumUnitsAggSum() bool { - if o != nil && o.MobileRumUnitsAggSum != nil { - return true - } - - return false -} - -// SetMobileRumUnitsAggSum gets a reference to the given int64 and assigns it to the MobileRumUnitsAggSum field. -func (o *UsageSummaryResponse) SetMobileRumUnitsAggSum(v int64) { - o.MobileRumUnitsAggSum = &v -} - -// GetNetflowIndexedEventsCountAggSum returns the NetflowIndexedEventsCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetNetflowIndexedEventsCountAggSum() int64 { - if o == nil || o.NetflowIndexedEventsCountAggSum == nil { - var ret int64 - return ret - } - return *o.NetflowIndexedEventsCountAggSum -} - -// GetNetflowIndexedEventsCountAggSumOk returns a tuple with the NetflowIndexedEventsCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetNetflowIndexedEventsCountAggSumOk() (*int64, bool) { - if o == nil || o.NetflowIndexedEventsCountAggSum == nil { - return nil, false - } - return o.NetflowIndexedEventsCountAggSum, true -} - -// HasNetflowIndexedEventsCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasNetflowIndexedEventsCountAggSum() bool { - if o != nil && o.NetflowIndexedEventsCountAggSum != nil { - return true - } - - return false -} - -// SetNetflowIndexedEventsCountAggSum gets a reference to the given int64 and assigns it to the NetflowIndexedEventsCountAggSum field. -func (o *UsageSummaryResponse) SetNetflowIndexedEventsCountAggSum(v int64) { - o.NetflowIndexedEventsCountAggSum = &v -} - -// GetNpmHostTop99pSum returns the NpmHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetNpmHostTop99pSum() int64 { - if o == nil || o.NpmHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.NpmHostTop99pSum -} - -// GetNpmHostTop99pSumOk returns a tuple with the NpmHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetNpmHostTop99pSumOk() (*int64, bool) { - if o == nil || o.NpmHostTop99pSum == nil { - return nil, false - } - return o.NpmHostTop99pSum, true -} - -// HasNpmHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasNpmHostTop99pSum() bool { - if o != nil && o.NpmHostTop99pSum != nil { - return true - } - - return false -} - -// SetNpmHostTop99pSum gets a reference to the given int64 and assigns it to the NpmHostTop99pSum field. -func (o *UsageSummaryResponse) SetNpmHostTop99pSum(v int64) { - o.NpmHostTop99pSum = &v -} - -// GetObservabilityPipelinesBytesProcessedAggSum returns the ObservabilityPipelinesBytesProcessedAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetObservabilityPipelinesBytesProcessedAggSum() int64 { - if o == nil || o.ObservabilityPipelinesBytesProcessedAggSum == nil { - var ret int64 - return ret - } - return *o.ObservabilityPipelinesBytesProcessedAggSum -} - -// GetObservabilityPipelinesBytesProcessedAggSumOk returns a tuple with the ObservabilityPipelinesBytesProcessedAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetObservabilityPipelinesBytesProcessedAggSumOk() (*int64, bool) { - if o == nil || o.ObservabilityPipelinesBytesProcessedAggSum == nil { - return nil, false - } - return o.ObservabilityPipelinesBytesProcessedAggSum, true -} - -// HasObservabilityPipelinesBytesProcessedAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasObservabilityPipelinesBytesProcessedAggSum() bool { - if o != nil && o.ObservabilityPipelinesBytesProcessedAggSum != nil { - return true - } - - return false -} - -// SetObservabilityPipelinesBytesProcessedAggSum gets a reference to the given int64 and assigns it to the ObservabilityPipelinesBytesProcessedAggSum field. -func (o *UsageSummaryResponse) SetObservabilityPipelinesBytesProcessedAggSum(v int64) { - o.ObservabilityPipelinesBytesProcessedAggSum = &v -} - -// GetOnlineArchiveEventsCountAggSum returns the OnlineArchiveEventsCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetOnlineArchiveEventsCountAggSum() int64 { - if o == nil || o.OnlineArchiveEventsCountAggSum == nil { - var ret int64 - return ret - } - return *o.OnlineArchiveEventsCountAggSum -} - -// GetOnlineArchiveEventsCountAggSumOk returns a tuple with the OnlineArchiveEventsCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetOnlineArchiveEventsCountAggSumOk() (*int64, bool) { - if o == nil || o.OnlineArchiveEventsCountAggSum == nil { - return nil, false - } - return o.OnlineArchiveEventsCountAggSum, true -} - -// HasOnlineArchiveEventsCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasOnlineArchiveEventsCountAggSum() bool { - if o != nil && o.OnlineArchiveEventsCountAggSum != nil { - return true - } - - return false -} - -// SetOnlineArchiveEventsCountAggSum gets a reference to the given int64 and assigns it to the OnlineArchiveEventsCountAggSum field. -func (o *UsageSummaryResponse) SetOnlineArchiveEventsCountAggSum(v int64) { - o.OnlineArchiveEventsCountAggSum = &v -} - -// GetOpentelemetryHostTop99pSum returns the OpentelemetryHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetOpentelemetryHostTop99pSum() int64 { - if o == nil || o.OpentelemetryHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.OpentelemetryHostTop99pSum -} - -// GetOpentelemetryHostTop99pSumOk returns a tuple with the OpentelemetryHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetOpentelemetryHostTop99pSumOk() (*int64, bool) { - if o == nil || o.OpentelemetryHostTop99pSum == nil { - return nil, false - } - return o.OpentelemetryHostTop99pSum, true -} - -// HasOpentelemetryHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasOpentelemetryHostTop99pSum() bool { - if o != nil && o.OpentelemetryHostTop99pSum != nil { - return true - } - - return false -} - -// SetOpentelemetryHostTop99pSum gets a reference to the given int64 and assigns it to the OpentelemetryHostTop99pSum field. -func (o *UsageSummaryResponse) SetOpentelemetryHostTop99pSum(v int64) { - o.OpentelemetryHostTop99pSum = &v -} - -// GetProfilingContainerAgentCountAvg returns the ProfilingContainerAgentCountAvg field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetProfilingContainerAgentCountAvg() int64 { - if o == nil || o.ProfilingContainerAgentCountAvg == nil { - var ret int64 - return ret - } - return *o.ProfilingContainerAgentCountAvg -} - -// GetProfilingContainerAgentCountAvgOk returns a tuple with the ProfilingContainerAgentCountAvg field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetProfilingContainerAgentCountAvgOk() (*int64, bool) { - if o == nil || o.ProfilingContainerAgentCountAvg == nil { - return nil, false - } - return o.ProfilingContainerAgentCountAvg, true -} - -// HasProfilingContainerAgentCountAvg returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasProfilingContainerAgentCountAvg() bool { - if o != nil && o.ProfilingContainerAgentCountAvg != nil { - return true - } - - return false -} - -// SetProfilingContainerAgentCountAvg gets a reference to the given int64 and assigns it to the ProfilingContainerAgentCountAvg field. -func (o *UsageSummaryResponse) SetProfilingContainerAgentCountAvg(v int64) { - o.ProfilingContainerAgentCountAvg = &v -} - -// GetProfilingHostCountTop99pSum returns the ProfilingHostCountTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetProfilingHostCountTop99pSum() int64 { - if o == nil || o.ProfilingHostCountTop99pSum == nil { - var ret int64 - return ret - } - return *o.ProfilingHostCountTop99pSum -} - -// GetProfilingHostCountTop99pSumOk returns a tuple with the ProfilingHostCountTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetProfilingHostCountTop99pSumOk() (*int64, bool) { - if o == nil || o.ProfilingHostCountTop99pSum == nil { - return nil, false - } - return o.ProfilingHostCountTop99pSum, true -} - -// HasProfilingHostCountTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasProfilingHostCountTop99pSum() bool { - if o != nil && o.ProfilingHostCountTop99pSum != nil { - return true - } - - return false -} - -// SetProfilingHostCountTop99pSum gets a reference to the given int64 and assigns it to the ProfilingHostCountTop99pSum field. -func (o *UsageSummaryResponse) SetProfilingHostCountTop99pSum(v int64) { - o.ProfilingHostCountTop99pSum = &v -} - -// GetRehydratedIndexedEventsAggSum returns the RehydratedIndexedEventsAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetRehydratedIndexedEventsAggSum() int64 { - if o == nil || o.RehydratedIndexedEventsAggSum == nil { - var ret int64 - return ret - } - return *o.RehydratedIndexedEventsAggSum -} - -// GetRehydratedIndexedEventsAggSumOk returns a tuple with the RehydratedIndexedEventsAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetRehydratedIndexedEventsAggSumOk() (*int64, bool) { - if o == nil || o.RehydratedIndexedEventsAggSum == nil { - return nil, false - } - return o.RehydratedIndexedEventsAggSum, true -} - -// HasRehydratedIndexedEventsAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasRehydratedIndexedEventsAggSum() bool { - if o != nil && o.RehydratedIndexedEventsAggSum != nil { - return true - } - - return false -} - -// SetRehydratedIndexedEventsAggSum gets a reference to the given int64 and assigns it to the RehydratedIndexedEventsAggSum field. -func (o *UsageSummaryResponse) SetRehydratedIndexedEventsAggSum(v int64) { - o.RehydratedIndexedEventsAggSum = &v -} - -// GetRehydratedIngestedBytesAggSum returns the RehydratedIngestedBytesAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetRehydratedIngestedBytesAggSum() int64 { - if o == nil || o.RehydratedIngestedBytesAggSum == nil { - var ret int64 - return ret - } - return *o.RehydratedIngestedBytesAggSum -} - -// GetRehydratedIngestedBytesAggSumOk returns a tuple with the RehydratedIngestedBytesAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetRehydratedIngestedBytesAggSumOk() (*int64, bool) { - if o == nil || o.RehydratedIngestedBytesAggSum == nil { - return nil, false - } - return o.RehydratedIngestedBytesAggSum, true -} - -// HasRehydratedIngestedBytesAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasRehydratedIngestedBytesAggSum() bool { - if o != nil && o.RehydratedIngestedBytesAggSum != nil { - return true - } - - return false -} - -// SetRehydratedIngestedBytesAggSum gets a reference to the given int64 and assigns it to the RehydratedIngestedBytesAggSum field. -func (o *UsageSummaryResponse) SetRehydratedIngestedBytesAggSum(v int64) { - o.RehydratedIngestedBytesAggSum = &v -} - -// GetRumBrowserAndMobileSessionCount returns the RumBrowserAndMobileSessionCount field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetRumBrowserAndMobileSessionCount() int64 { - if o == nil || o.RumBrowserAndMobileSessionCount == nil { - var ret int64 - return ret - } - return *o.RumBrowserAndMobileSessionCount -} - -// GetRumBrowserAndMobileSessionCountOk returns a tuple with the RumBrowserAndMobileSessionCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetRumBrowserAndMobileSessionCountOk() (*int64, bool) { - if o == nil || o.RumBrowserAndMobileSessionCount == nil { - return nil, false - } - return o.RumBrowserAndMobileSessionCount, true -} - -// HasRumBrowserAndMobileSessionCount returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasRumBrowserAndMobileSessionCount() bool { - if o != nil && o.RumBrowserAndMobileSessionCount != nil { - return true - } - - return false -} - -// SetRumBrowserAndMobileSessionCount gets a reference to the given int64 and assigns it to the RumBrowserAndMobileSessionCount field. -func (o *UsageSummaryResponse) SetRumBrowserAndMobileSessionCount(v int64) { - o.RumBrowserAndMobileSessionCount = &v -} - -// GetRumSessionCountAggSum returns the RumSessionCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetRumSessionCountAggSum() int64 { - if o == nil || o.RumSessionCountAggSum == nil { - var ret int64 - return ret - } - return *o.RumSessionCountAggSum -} - -// GetRumSessionCountAggSumOk returns a tuple with the RumSessionCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetRumSessionCountAggSumOk() (*int64, bool) { - if o == nil || o.RumSessionCountAggSum == nil { - return nil, false - } - return o.RumSessionCountAggSum, true -} - -// HasRumSessionCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasRumSessionCountAggSum() bool { - if o != nil && o.RumSessionCountAggSum != nil { - return true - } - - return false -} - -// SetRumSessionCountAggSum gets a reference to the given int64 and assigns it to the RumSessionCountAggSum field. -func (o *UsageSummaryResponse) SetRumSessionCountAggSum(v int64) { - o.RumSessionCountAggSum = &v -} - -// GetRumTotalSessionCountAggSum returns the RumTotalSessionCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetRumTotalSessionCountAggSum() int64 { - if o == nil || o.RumTotalSessionCountAggSum == nil { - var ret int64 - return ret - } - return *o.RumTotalSessionCountAggSum -} - -// GetRumTotalSessionCountAggSumOk returns a tuple with the RumTotalSessionCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetRumTotalSessionCountAggSumOk() (*int64, bool) { - if o == nil || o.RumTotalSessionCountAggSum == nil { - return nil, false - } - return o.RumTotalSessionCountAggSum, true -} - -// HasRumTotalSessionCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasRumTotalSessionCountAggSum() bool { - if o != nil && o.RumTotalSessionCountAggSum != nil { - return true - } - - return false -} - -// SetRumTotalSessionCountAggSum gets a reference to the given int64 and assigns it to the RumTotalSessionCountAggSum field. -func (o *UsageSummaryResponse) SetRumTotalSessionCountAggSum(v int64) { - o.RumTotalSessionCountAggSum = &v -} - -// GetRumUnitsAggSum returns the RumUnitsAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetRumUnitsAggSum() int64 { - if o == nil || o.RumUnitsAggSum == nil { - var ret int64 - return ret - } - return *o.RumUnitsAggSum -} - -// GetRumUnitsAggSumOk returns a tuple with the RumUnitsAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetRumUnitsAggSumOk() (*int64, bool) { - if o == nil || o.RumUnitsAggSum == nil { - return nil, false - } - return o.RumUnitsAggSum, true -} - -// HasRumUnitsAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasRumUnitsAggSum() bool { - if o != nil && o.RumUnitsAggSum != nil { - return true - } - - return false -} - -// SetRumUnitsAggSum gets a reference to the given int64 and assigns it to the RumUnitsAggSum field. -func (o *UsageSummaryResponse) SetRumUnitsAggSum(v int64) { - o.RumUnitsAggSum = &v -} - -// GetSdsLogsScannedBytesSum returns the SdsLogsScannedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetSdsLogsScannedBytesSum() int64 { - if o == nil || o.SdsLogsScannedBytesSum == nil { - var ret int64 - return ret - } - return *o.SdsLogsScannedBytesSum -} - -// GetSdsLogsScannedBytesSumOk returns a tuple with the SdsLogsScannedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetSdsLogsScannedBytesSumOk() (*int64, bool) { - if o == nil || o.SdsLogsScannedBytesSum == nil { - return nil, false - } - return o.SdsLogsScannedBytesSum, true -} - -// HasSdsLogsScannedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasSdsLogsScannedBytesSum() bool { - if o != nil && o.SdsLogsScannedBytesSum != nil { - return true - } - - return false -} - -// SetSdsLogsScannedBytesSum gets a reference to the given int64 and assigns it to the SdsLogsScannedBytesSum field. -func (o *UsageSummaryResponse) SetSdsLogsScannedBytesSum(v int64) { - o.SdsLogsScannedBytesSum = &v -} - -// GetSdsTotalScannedBytesSum returns the SdsTotalScannedBytesSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetSdsTotalScannedBytesSum() int64 { - if o == nil || o.SdsTotalScannedBytesSum == nil { - var ret int64 - return ret - } - return *o.SdsTotalScannedBytesSum -} - -// GetSdsTotalScannedBytesSumOk returns a tuple with the SdsTotalScannedBytesSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetSdsTotalScannedBytesSumOk() (*int64, bool) { - if o == nil || o.SdsTotalScannedBytesSum == nil { - return nil, false - } - return o.SdsTotalScannedBytesSum, true -} - -// HasSdsTotalScannedBytesSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasSdsTotalScannedBytesSum() bool { - if o != nil && o.SdsTotalScannedBytesSum != nil { - return true - } - - return false -} - -// SetSdsTotalScannedBytesSum gets a reference to the given int64 and assigns it to the SdsTotalScannedBytesSum field. -func (o *UsageSummaryResponse) SetSdsTotalScannedBytesSum(v int64) { - o.SdsTotalScannedBytesSum = &v -} - -// GetStartDate returns the StartDate field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetStartDate() time.Time { - if o == nil || o.StartDate == nil { - var ret time.Time - return ret - } - return *o.StartDate -} - -// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetStartDateOk() (*time.Time, bool) { - if o == nil || o.StartDate == nil { - return nil, false - } - return o.StartDate, true -} - -// HasStartDate returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasStartDate() bool { - if o != nil && o.StartDate != nil { - return true - } - - return false -} - -// SetStartDate gets a reference to the given time.Time and assigns it to the StartDate field. -func (o *UsageSummaryResponse) SetStartDate(v time.Time) { - o.StartDate = &v -} - -// GetSyntheticsBrowserCheckCallsCountAggSum returns the SyntheticsBrowserCheckCallsCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetSyntheticsBrowserCheckCallsCountAggSum() int64 { - if o == nil || o.SyntheticsBrowserCheckCallsCountAggSum == nil { - var ret int64 - return ret - } - return *o.SyntheticsBrowserCheckCallsCountAggSum -} - -// GetSyntheticsBrowserCheckCallsCountAggSumOk returns a tuple with the SyntheticsBrowserCheckCallsCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetSyntheticsBrowserCheckCallsCountAggSumOk() (*int64, bool) { - if o == nil || o.SyntheticsBrowserCheckCallsCountAggSum == nil { - return nil, false - } - return o.SyntheticsBrowserCheckCallsCountAggSum, true -} - -// HasSyntheticsBrowserCheckCallsCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasSyntheticsBrowserCheckCallsCountAggSum() bool { - if o != nil && o.SyntheticsBrowserCheckCallsCountAggSum != nil { - return true - } - - return false -} - -// SetSyntheticsBrowserCheckCallsCountAggSum gets a reference to the given int64 and assigns it to the SyntheticsBrowserCheckCallsCountAggSum field. -func (o *UsageSummaryResponse) SetSyntheticsBrowserCheckCallsCountAggSum(v int64) { - o.SyntheticsBrowserCheckCallsCountAggSum = &v -} - -// GetSyntheticsCheckCallsCountAggSum returns the SyntheticsCheckCallsCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetSyntheticsCheckCallsCountAggSum() int64 { - if o == nil || o.SyntheticsCheckCallsCountAggSum == nil { - var ret int64 - return ret - } - return *o.SyntheticsCheckCallsCountAggSum -} - -// GetSyntheticsCheckCallsCountAggSumOk returns a tuple with the SyntheticsCheckCallsCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetSyntheticsCheckCallsCountAggSumOk() (*int64, bool) { - if o == nil || o.SyntheticsCheckCallsCountAggSum == nil { - return nil, false - } - return o.SyntheticsCheckCallsCountAggSum, true -} - -// HasSyntheticsCheckCallsCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasSyntheticsCheckCallsCountAggSum() bool { - if o != nil && o.SyntheticsCheckCallsCountAggSum != nil { - return true - } - - return false -} - -// SetSyntheticsCheckCallsCountAggSum gets a reference to the given int64 and assigns it to the SyntheticsCheckCallsCountAggSum field. -func (o *UsageSummaryResponse) SetSyntheticsCheckCallsCountAggSum(v int64) { - o.SyntheticsCheckCallsCountAggSum = &v -} - -// GetTraceSearchIndexedEventsCountAggSum returns the TraceSearchIndexedEventsCountAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetTraceSearchIndexedEventsCountAggSum() int64 { - if o == nil || o.TraceSearchIndexedEventsCountAggSum == nil { - var ret int64 - return ret - } - return *o.TraceSearchIndexedEventsCountAggSum -} - -// GetTraceSearchIndexedEventsCountAggSumOk returns a tuple with the TraceSearchIndexedEventsCountAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetTraceSearchIndexedEventsCountAggSumOk() (*int64, bool) { - if o == nil || o.TraceSearchIndexedEventsCountAggSum == nil { - return nil, false - } - return o.TraceSearchIndexedEventsCountAggSum, true -} - -// HasTraceSearchIndexedEventsCountAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasTraceSearchIndexedEventsCountAggSum() bool { - if o != nil && o.TraceSearchIndexedEventsCountAggSum != nil { - return true - } - - return false -} - -// SetTraceSearchIndexedEventsCountAggSum gets a reference to the given int64 and assigns it to the TraceSearchIndexedEventsCountAggSum field. -func (o *UsageSummaryResponse) SetTraceSearchIndexedEventsCountAggSum(v int64) { - o.TraceSearchIndexedEventsCountAggSum = &v -} - -// GetTwolIngestedEventsBytesAggSum returns the TwolIngestedEventsBytesAggSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetTwolIngestedEventsBytesAggSum() int64 { - if o == nil || o.TwolIngestedEventsBytesAggSum == nil { - var ret int64 - return ret - } - return *o.TwolIngestedEventsBytesAggSum -} - -// GetTwolIngestedEventsBytesAggSumOk returns a tuple with the TwolIngestedEventsBytesAggSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetTwolIngestedEventsBytesAggSumOk() (*int64, bool) { - if o == nil || o.TwolIngestedEventsBytesAggSum == nil { - return nil, false - } - return o.TwolIngestedEventsBytesAggSum, true -} - -// HasTwolIngestedEventsBytesAggSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasTwolIngestedEventsBytesAggSum() bool { - if o != nil && o.TwolIngestedEventsBytesAggSum != nil { - return true - } - - return false -} - -// SetTwolIngestedEventsBytesAggSum gets a reference to the given int64 and assigns it to the TwolIngestedEventsBytesAggSum field. -func (o *UsageSummaryResponse) SetTwolIngestedEventsBytesAggSum(v int64) { - o.TwolIngestedEventsBytesAggSum = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetUsage() []UsageSummaryDate { - if o == nil || o.Usage == nil { - var ret []UsageSummaryDate - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetUsageOk() (*[]UsageSummaryDate, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageSummaryDate and assigns it to the Usage field. -func (o *UsageSummaryResponse) SetUsage(v []UsageSummaryDate) { - o.Usage = v -} - -// GetVsphereHostTop99pSum returns the VsphereHostTop99pSum field value if set, zero value otherwise. -func (o *UsageSummaryResponse) GetVsphereHostTop99pSum() int64 { - if o == nil || o.VsphereHostTop99pSum == nil { - var ret int64 - return ret - } - return *o.VsphereHostTop99pSum -} - -// GetVsphereHostTop99pSumOk returns a tuple with the VsphereHostTop99pSum field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSummaryResponse) GetVsphereHostTop99pSumOk() (*int64, bool) { - if o == nil || o.VsphereHostTop99pSum == nil { - return nil, false - } - return o.VsphereHostTop99pSum, true -} - -// HasVsphereHostTop99pSum returns a boolean if a field has been set. -func (o *UsageSummaryResponse) HasVsphereHostTop99pSum() bool { - if o != nil && o.VsphereHostTop99pSum != nil { - return true - } - - return false -} - -// SetVsphereHostTop99pSum gets a reference to the given int64 and assigns it to the VsphereHostTop99pSum field. -func (o *UsageSummaryResponse) SetVsphereHostTop99pSum(v int64) { - o.VsphereHostTop99pSum = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSummaryResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AgentHostTop99pSum != nil { - toSerialize["agent_host_top99p_sum"] = o.AgentHostTop99pSum - } - if o.ApmAzureAppServiceHostTop99pSum != nil { - toSerialize["apm_azure_app_service_host_top99p_sum"] = o.ApmAzureAppServiceHostTop99pSum - } - if o.ApmHostTop99pSum != nil { - toSerialize["apm_host_top99p_sum"] = o.ApmHostTop99pSum - } - if o.AuditLogsLinesIndexedAggSum != nil { - toSerialize["audit_logs_lines_indexed_agg_sum"] = o.AuditLogsLinesIndexedAggSum - } - if o.AvgProfiledFargateTasksSum != nil { - toSerialize["avg_profiled_fargate_tasks_sum"] = o.AvgProfiledFargateTasksSum - } - if o.AwsHostTop99pSum != nil { - toSerialize["aws_host_top99p_sum"] = o.AwsHostTop99pSum - } - if o.AwsLambdaFuncCount != nil { - toSerialize["aws_lambda_func_count"] = o.AwsLambdaFuncCount - } - if o.AwsLambdaInvocationsSum != nil { - toSerialize["aws_lambda_invocations_sum"] = o.AwsLambdaInvocationsSum - } - if o.AzureAppServiceTop99pSum != nil { - toSerialize["azure_app_service_top99p_sum"] = o.AzureAppServiceTop99pSum - } - if o.AzureHostTop99pSum != nil { - toSerialize["azure_host_top99p_sum"] = o.AzureHostTop99pSum - } - if o.BillableIngestedBytesAggSum != nil { - toSerialize["billable_ingested_bytes_agg_sum"] = o.BillableIngestedBytesAggSum - } - if o.BrowserRumLiteSessionCountAggSum != nil { - toSerialize["browser_rum_lite_session_count_agg_sum"] = o.BrowserRumLiteSessionCountAggSum - } - if o.BrowserRumReplaySessionCountAggSum != nil { - toSerialize["browser_rum_replay_session_count_agg_sum"] = o.BrowserRumReplaySessionCountAggSum - } - if o.BrowserRumUnitsAggSum != nil { - toSerialize["browser_rum_units_agg_sum"] = o.BrowserRumUnitsAggSum - } - if o.CiPipelineIndexedSpansAggSum != nil { - toSerialize["ci_pipeline_indexed_spans_agg_sum"] = o.CiPipelineIndexedSpansAggSum - } - if o.CiTestIndexedSpansAggSum != nil { - toSerialize["ci_test_indexed_spans_agg_sum"] = o.CiTestIndexedSpansAggSum - } - if o.CiVisibilityPipelineCommittersHwmSum != nil { - toSerialize["ci_visibility_pipeline_committers_hwm_sum"] = o.CiVisibilityPipelineCommittersHwmSum - } - if o.CiVisibilityTestCommittersHwmSum != nil { - toSerialize["ci_visibility_test_committers_hwm_sum"] = o.CiVisibilityTestCommittersHwmSum - } - if o.ContainerAvgSum != nil { - toSerialize["container_avg_sum"] = o.ContainerAvgSum - } - if o.ContainerHwmSum != nil { - toSerialize["container_hwm_sum"] = o.ContainerHwmSum - } - if o.CspmAasHostTop99pSum != nil { - toSerialize["cspm_aas_host_top99p_sum"] = o.CspmAasHostTop99pSum - } - if o.CspmAzureHostTop99pSum != nil { - toSerialize["cspm_azure_host_top99p_sum"] = o.CspmAzureHostTop99pSum - } - if o.CspmContainerAvgSum != nil { - toSerialize["cspm_container_avg_sum"] = o.CspmContainerAvgSum - } - if o.CspmContainerHwmSum != nil { - toSerialize["cspm_container_hwm_sum"] = o.CspmContainerHwmSum - } - if o.CspmHostTop99pSum != nil { - toSerialize["cspm_host_top99p_sum"] = o.CspmHostTop99pSum - } - if o.CustomTsSum != nil { - toSerialize["custom_ts_sum"] = o.CustomTsSum - } - if o.CwsContainersAvgSum != nil { - toSerialize["cws_containers_avg_sum"] = o.CwsContainersAvgSum - } - if o.CwsHostTop99pSum != nil { - toSerialize["cws_host_top99p_sum"] = o.CwsHostTop99pSum - } - if o.DbmHostTop99pSum != nil { - toSerialize["dbm_host_top99p_sum"] = o.DbmHostTop99pSum - } - if o.DbmQueriesAvgSum != nil { - toSerialize["dbm_queries_avg_sum"] = o.DbmQueriesAvgSum - } - if o.EndDate != nil { - if o.EndDate.Nanosecond() == 0 { - toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.FargateTasksCountAvgSum != nil { - toSerialize["fargate_tasks_count_avg_sum"] = o.FargateTasksCountAvgSum - } - if o.FargateTasksCountHwmSum != nil { - toSerialize["fargate_tasks_count_hwm_sum"] = o.FargateTasksCountHwmSum - } - if o.GcpHostTop99pSum != nil { - toSerialize["gcp_host_top99p_sum"] = o.GcpHostTop99pSum - } - if o.HerokuHostTop99pSum != nil { - toSerialize["heroku_host_top99p_sum"] = o.HerokuHostTop99pSum - } - if o.IncidentManagementMonthlyActiveUsersHwmSum != nil { - toSerialize["incident_management_monthly_active_users_hwm_sum"] = o.IncidentManagementMonthlyActiveUsersHwmSum - } - if o.IndexedEventsCountAggSum != nil { - toSerialize["indexed_events_count_agg_sum"] = o.IndexedEventsCountAggSum - } - if o.InfraHostTop99pSum != nil { - toSerialize["infra_host_top99p_sum"] = o.InfraHostTop99pSum - } - if o.IngestedEventsBytesAggSum != nil { - toSerialize["ingested_events_bytes_agg_sum"] = o.IngestedEventsBytesAggSum - } - if o.IotDeviceAggSum != nil { - toSerialize["iot_device_agg_sum"] = o.IotDeviceAggSum - } - if o.IotDeviceTop99pSum != nil { - toSerialize["iot_device_top99p_sum"] = o.IotDeviceTop99pSum - } - if o.LastUpdated != nil { - if o.LastUpdated.Nanosecond() == 0 { - toSerialize["last_updated"] = o.LastUpdated.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["last_updated"] = o.LastUpdated.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.LiveIndexedEventsAggSum != nil { - toSerialize["live_indexed_events_agg_sum"] = o.LiveIndexedEventsAggSum - } - if o.LiveIngestedBytesAggSum != nil { - toSerialize["live_ingested_bytes_agg_sum"] = o.LiveIngestedBytesAggSum - } - if o.LogsByRetention != nil { - toSerialize["logs_by_retention"] = o.LogsByRetention - } - if o.MobileRumLiteSessionCountAggSum != nil { - toSerialize["mobile_rum_lite_session_count_agg_sum"] = o.MobileRumLiteSessionCountAggSum - } - if o.MobileRumSessionCountAggSum != nil { - toSerialize["mobile_rum_session_count_agg_sum"] = o.MobileRumSessionCountAggSum - } - if o.MobileRumSessionCountAndroidAggSum != nil { - toSerialize["mobile_rum_session_count_android_agg_sum"] = o.MobileRumSessionCountAndroidAggSum - } - if o.MobileRumSessionCountIosAggSum != nil { - toSerialize["mobile_rum_session_count_ios_agg_sum"] = o.MobileRumSessionCountIosAggSum - } - if o.MobileRumSessionCountReactnativeAggSum != nil { - toSerialize["mobile_rum_session_count_reactnative_agg_sum"] = o.MobileRumSessionCountReactnativeAggSum - } - if o.MobileRumUnitsAggSum != nil { - toSerialize["mobile_rum_units_agg_sum"] = o.MobileRumUnitsAggSum - } - if o.NetflowIndexedEventsCountAggSum != nil { - toSerialize["netflow_indexed_events_count_agg_sum"] = o.NetflowIndexedEventsCountAggSum - } - if o.NpmHostTop99pSum != nil { - toSerialize["npm_host_top99p_sum"] = o.NpmHostTop99pSum - } - if o.ObservabilityPipelinesBytesProcessedAggSum != nil { - toSerialize["observability_pipelines_bytes_processed_agg_sum"] = o.ObservabilityPipelinesBytesProcessedAggSum - } - if o.OnlineArchiveEventsCountAggSum != nil { - toSerialize["online_archive_events_count_agg_sum"] = o.OnlineArchiveEventsCountAggSum - } - if o.OpentelemetryHostTop99pSum != nil { - toSerialize["opentelemetry_host_top99p_sum"] = o.OpentelemetryHostTop99pSum - } - if o.ProfilingContainerAgentCountAvg != nil { - toSerialize["profiling_container_agent_count_avg"] = o.ProfilingContainerAgentCountAvg - } - if o.ProfilingHostCountTop99pSum != nil { - toSerialize["profiling_host_count_top99p_sum"] = o.ProfilingHostCountTop99pSum - } - if o.RehydratedIndexedEventsAggSum != nil { - toSerialize["rehydrated_indexed_events_agg_sum"] = o.RehydratedIndexedEventsAggSum - } - if o.RehydratedIngestedBytesAggSum != nil { - toSerialize["rehydrated_ingested_bytes_agg_sum"] = o.RehydratedIngestedBytesAggSum - } - if o.RumBrowserAndMobileSessionCount != nil { - toSerialize["rum_browser_and_mobile_session_count"] = o.RumBrowserAndMobileSessionCount - } - if o.RumSessionCountAggSum != nil { - toSerialize["rum_session_count_agg_sum"] = o.RumSessionCountAggSum - } - if o.RumTotalSessionCountAggSum != nil { - toSerialize["rum_total_session_count_agg_sum"] = o.RumTotalSessionCountAggSum - } - if o.RumUnitsAggSum != nil { - toSerialize["rum_units_agg_sum"] = o.RumUnitsAggSum - } - if o.SdsLogsScannedBytesSum != nil { - toSerialize["sds_logs_scanned_bytes_sum"] = o.SdsLogsScannedBytesSum - } - if o.SdsTotalScannedBytesSum != nil { - toSerialize["sds_total_scanned_bytes_sum"] = o.SdsTotalScannedBytesSum - } - if o.StartDate != nil { - if o.StartDate.Nanosecond() == 0 { - toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.SyntheticsBrowserCheckCallsCountAggSum != nil { - toSerialize["synthetics_browser_check_calls_count_agg_sum"] = o.SyntheticsBrowserCheckCallsCountAggSum - } - if o.SyntheticsCheckCallsCountAggSum != nil { - toSerialize["synthetics_check_calls_count_agg_sum"] = o.SyntheticsCheckCallsCountAggSum - } - if o.TraceSearchIndexedEventsCountAggSum != nil { - toSerialize["trace_search_indexed_events_count_agg_sum"] = o.TraceSearchIndexedEventsCountAggSum - } - if o.TwolIngestedEventsBytesAggSum != nil { - toSerialize["twol_ingested_events_bytes_agg_sum"] = o.TwolIngestedEventsBytesAggSum - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - if o.VsphereHostTop99pSum != nil { - toSerialize["vsphere_host_top99p_sum"] = o.VsphereHostTop99pSum - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AgentHostTop99pSum *int64 `json:"agent_host_top99p_sum,omitempty"` - ApmAzureAppServiceHostTop99pSum *int64 `json:"apm_azure_app_service_host_top99p_sum,omitempty"` - ApmHostTop99pSum *int64 `json:"apm_host_top99p_sum,omitempty"` - AuditLogsLinesIndexedAggSum *int64 `json:"audit_logs_lines_indexed_agg_sum,omitempty"` - AvgProfiledFargateTasksSum *int64 `json:"avg_profiled_fargate_tasks_sum,omitempty"` - AwsHostTop99pSum *int64 `json:"aws_host_top99p_sum,omitempty"` - AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` - AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` - AzureAppServiceTop99pSum *int64 `json:"azure_app_service_top99p_sum,omitempty"` - AzureHostTop99pSum *int64 `json:"azure_host_top99p_sum,omitempty"` - BillableIngestedBytesAggSum *int64 `json:"billable_ingested_bytes_agg_sum,omitempty"` - BrowserRumLiteSessionCountAggSum *int64 `json:"browser_rum_lite_session_count_agg_sum,omitempty"` - BrowserRumReplaySessionCountAggSum *int64 `json:"browser_rum_replay_session_count_agg_sum,omitempty"` - BrowserRumUnitsAggSum *int64 `json:"browser_rum_units_agg_sum,omitempty"` - CiPipelineIndexedSpansAggSum *int64 `json:"ci_pipeline_indexed_spans_agg_sum,omitempty"` - CiTestIndexedSpansAggSum *int64 `json:"ci_test_indexed_spans_agg_sum,omitempty"` - CiVisibilityPipelineCommittersHwmSum *int64 `json:"ci_visibility_pipeline_committers_hwm_sum,omitempty"` - CiVisibilityTestCommittersHwmSum *int64 `json:"ci_visibility_test_committers_hwm_sum,omitempty"` - ContainerAvgSum *int64 `json:"container_avg_sum,omitempty"` - ContainerHwmSum *int64 `json:"container_hwm_sum,omitempty"` - CspmAasHostTop99pSum *int64 `json:"cspm_aas_host_top99p_sum,omitempty"` - CspmAzureHostTop99pSum *int64 `json:"cspm_azure_host_top99p_sum,omitempty"` - CspmContainerAvgSum *int64 `json:"cspm_container_avg_sum,omitempty"` - CspmContainerHwmSum *int64 `json:"cspm_container_hwm_sum,omitempty"` - CspmHostTop99pSum *int64 `json:"cspm_host_top99p_sum,omitempty"` - CustomTsSum *int64 `json:"custom_ts_sum,omitempty"` - CwsContainersAvgSum *int64 `json:"cws_containers_avg_sum,omitempty"` - CwsHostTop99pSum *int64 `json:"cws_host_top99p_sum,omitempty"` - DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` - DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` - EndDate *time.Time `json:"end_date,omitempty"` - FargateTasksCountAvgSum *int64 `json:"fargate_tasks_count_avg_sum,omitempty"` - FargateTasksCountHwmSum *int64 `json:"fargate_tasks_count_hwm_sum,omitempty"` - GcpHostTop99pSum *int64 `json:"gcp_host_top99p_sum,omitempty"` - HerokuHostTop99pSum *int64 `json:"heroku_host_top99p_sum,omitempty"` - IncidentManagementMonthlyActiveUsersHwmSum *int64 `json:"incident_management_monthly_active_users_hwm_sum,omitempty"` - IndexedEventsCountAggSum *int64 `json:"indexed_events_count_agg_sum,omitempty"` - InfraHostTop99pSum *int64 `json:"infra_host_top99p_sum,omitempty"` - IngestedEventsBytesAggSum *int64 `json:"ingested_events_bytes_agg_sum,omitempty"` - IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` - IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` - LastUpdated *time.Time `json:"last_updated,omitempty"` - LiveIndexedEventsAggSum *int64 `json:"live_indexed_events_agg_sum,omitempty"` - LiveIngestedBytesAggSum *int64 `json:"live_ingested_bytes_agg_sum,omitempty"` - LogsByRetention *LogsByRetention `json:"logs_by_retention,omitempty"` - MobileRumLiteSessionCountAggSum *int64 `json:"mobile_rum_lite_session_count_agg_sum,omitempty"` - MobileRumSessionCountAggSum *int64 `json:"mobile_rum_session_count_agg_sum,omitempty"` - MobileRumSessionCountAndroidAggSum *int64 `json:"mobile_rum_session_count_android_agg_sum,omitempty"` - MobileRumSessionCountIosAggSum *int64 `json:"mobile_rum_session_count_ios_agg_sum,omitempty"` - MobileRumSessionCountReactnativeAggSum *int64 `json:"mobile_rum_session_count_reactnative_agg_sum,omitempty"` - MobileRumUnitsAggSum *int64 `json:"mobile_rum_units_agg_sum,omitempty"` - NetflowIndexedEventsCountAggSum *int64 `json:"netflow_indexed_events_count_agg_sum,omitempty"` - NpmHostTop99pSum *int64 `json:"npm_host_top99p_sum,omitempty"` - ObservabilityPipelinesBytesProcessedAggSum *int64 `json:"observability_pipelines_bytes_processed_agg_sum,omitempty"` - OnlineArchiveEventsCountAggSum *int64 `json:"online_archive_events_count_agg_sum,omitempty"` - OpentelemetryHostTop99pSum *int64 `json:"opentelemetry_host_top99p_sum,omitempty"` - ProfilingContainerAgentCountAvg *int64 `json:"profiling_container_agent_count_avg,omitempty"` - ProfilingHostCountTop99pSum *int64 `json:"profiling_host_count_top99p_sum,omitempty"` - RehydratedIndexedEventsAggSum *int64 `json:"rehydrated_indexed_events_agg_sum,omitempty"` - RehydratedIngestedBytesAggSum *int64 `json:"rehydrated_ingested_bytes_agg_sum,omitempty"` - RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` - RumSessionCountAggSum *int64 `json:"rum_session_count_agg_sum,omitempty"` - RumTotalSessionCountAggSum *int64 `json:"rum_total_session_count_agg_sum,omitempty"` - RumUnitsAggSum *int64 `json:"rum_units_agg_sum,omitempty"` - SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` - SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` - StartDate *time.Time `json:"start_date,omitempty"` - SyntheticsBrowserCheckCallsCountAggSum *int64 `json:"synthetics_browser_check_calls_count_agg_sum,omitempty"` - SyntheticsCheckCallsCountAggSum *int64 `json:"synthetics_check_calls_count_agg_sum,omitempty"` - TraceSearchIndexedEventsCountAggSum *int64 `json:"trace_search_indexed_events_count_agg_sum,omitempty"` - TwolIngestedEventsBytesAggSum *int64 `json:"twol_ingested_events_bytes_agg_sum,omitempty"` - Usage []UsageSummaryDate `json:"usage,omitempty"` - VsphereHostTop99pSum *int64 `json:"vsphere_host_top99p_sum,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AgentHostTop99pSum = all.AgentHostTop99pSum - o.ApmAzureAppServiceHostTop99pSum = all.ApmAzureAppServiceHostTop99pSum - o.ApmHostTop99pSum = all.ApmHostTop99pSum - o.AuditLogsLinesIndexedAggSum = all.AuditLogsLinesIndexedAggSum - o.AvgProfiledFargateTasksSum = all.AvgProfiledFargateTasksSum - o.AwsHostTop99pSum = all.AwsHostTop99pSum - o.AwsLambdaFuncCount = all.AwsLambdaFuncCount - o.AwsLambdaInvocationsSum = all.AwsLambdaInvocationsSum - o.AzureAppServiceTop99pSum = all.AzureAppServiceTop99pSum - o.AzureHostTop99pSum = all.AzureHostTop99pSum - o.BillableIngestedBytesAggSum = all.BillableIngestedBytesAggSum - o.BrowserRumLiteSessionCountAggSum = all.BrowserRumLiteSessionCountAggSum - o.BrowserRumReplaySessionCountAggSum = all.BrowserRumReplaySessionCountAggSum - o.BrowserRumUnitsAggSum = all.BrowserRumUnitsAggSum - o.CiPipelineIndexedSpansAggSum = all.CiPipelineIndexedSpansAggSum - o.CiTestIndexedSpansAggSum = all.CiTestIndexedSpansAggSum - o.CiVisibilityPipelineCommittersHwmSum = all.CiVisibilityPipelineCommittersHwmSum - o.CiVisibilityTestCommittersHwmSum = all.CiVisibilityTestCommittersHwmSum - o.ContainerAvgSum = all.ContainerAvgSum - o.ContainerHwmSum = all.ContainerHwmSum - o.CspmAasHostTop99pSum = all.CspmAasHostTop99pSum - o.CspmAzureHostTop99pSum = all.CspmAzureHostTop99pSum - o.CspmContainerAvgSum = all.CspmContainerAvgSum - o.CspmContainerHwmSum = all.CspmContainerHwmSum - o.CspmHostTop99pSum = all.CspmHostTop99pSum - o.CustomTsSum = all.CustomTsSum - o.CwsContainersAvgSum = all.CwsContainersAvgSum - o.CwsHostTop99pSum = all.CwsHostTop99pSum - o.DbmHostTop99pSum = all.DbmHostTop99pSum - o.DbmQueriesAvgSum = all.DbmQueriesAvgSum - o.EndDate = all.EndDate - o.FargateTasksCountAvgSum = all.FargateTasksCountAvgSum - o.FargateTasksCountHwmSum = all.FargateTasksCountHwmSum - o.GcpHostTop99pSum = all.GcpHostTop99pSum - o.HerokuHostTop99pSum = all.HerokuHostTop99pSum - o.IncidentManagementMonthlyActiveUsersHwmSum = all.IncidentManagementMonthlyActiveUsersHwmSum - o.IndexedEventsCountAggSum = all.IndexedEventsCountAggSum - o.InfraHostTop99pSum = all.InfraHostTop99pSum - o.IngestedEventsBytesAggSum = all.IngestedEventsBytesAggSum - o.IotDeviceAggSum = all.IotDeviceAggSum - o.IotDeviceTop99pSum = all.IotDeviceTop99pSum - o.LastUpdated = all.LastUpdated - o.LiveIndexedEventsAggSum = all.LiveIndexedEventsAggSum - o.LiveIngestedBytesAggSum = all.LiveIngestedBytesAggSum - if all.LogsByRetention != nil && all.LogsByRetention.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LogsByRetention = all.LogsByRetention - o.MobileRumLiteSessionCountAggSum = all.MobileRumLiteSessionCountAggSum - o.MobileRumSessionCountAggSum = all.MobileRumSessionCountAggSum - o.MobileRumSessionCountAndroidAggSum = all.MobileRumSessionCountAndroidAggSum - o.MobileRumSessionCountIosAggSum = all.MobileRumSessionCountIosAggSum - o.MobileRumSessionCountReactnativeAggSum = all.MobileRumSessionCountReactnativeAggSum - o.MobileRumUnitsAggSum = all.MobileRumUnitsAggSum - o.NetflowIndexedEventsCountAggSum = all.NetflowIndexedEventsCountAggSum - o.NpmHostTop99pSum = all.NpmHostTop99pSum - o.ObservabilityPipelinesBytesProcessedAggSum = all.ObservabilityPipelinesBytesProcessedAggSum - o.OnlineArchiveEventsCountAggSum = all.OnlineArchiveEventsCountAggSum - o.OpentelemetryHostTop99pSum = all.OpentelemetryHostTop99pSum - o.ProfilingContainerAgentCountAvg = all.ProfilingContainerAgentCountAvg - o.ProfilingHostCountTop99pSum = all.ProfilingHostCountTop99pSum - o.RehydratedIndexedEventsAggSum = all.RehydratedIndexedEventsAggSum - o.RehydratedIngestedBytesAggSum = all.RehydratedIngestedBytesAggSum - o.RumBrowserAndMobileSessionCount = all.RumBrowserAndMobileSessionCount - o.RumSessionCountAggSum = all.RumSessionCountAggSum - o.RumTotalSessionCountAggSum = all.RumTotalSessionCountAggSum - o.RumUnitsAggSum = all.RumUnitsAggSum - o.SdsLogsScannedBytesSum = all.SdsLogsScannedBytesSum - o.SdsTotalScannedBytesSum = all.SdsTotalScannedBytesSum - o.StartDate = all.StartDate - o.SyntheticsBrowserCheckCallsCountAggSum = all.SyntheticsBrowserCheckCallsCountAggSum - o.SyntheticsCheckCallsCountAggSum = all.SyntheticsCheckCallsCountAggSum - o.TraceSearchIndexedEventsCountAggSum = all.TraceSearchIndexedEventsCountAggSum - o.TwolIngestedEventsBytesAggSum = all.TwolIngestedEventsBytesAggSum - o.Usage = all.Usage - o.VsphereHostTop99pSum = all.VsphereHostTop99pSum - return nil -} diff --git a/api/v1/datadog/model_usage_synthetics_api_hour.go b/api/v1/datadog/model_usage_synthetics_api_hour.go deleted file mode 100644 index 17dfafdbc69..00000000000 --- a/api/v1/datadog/model_usage_synthetics_api_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageSyntheticsAPIHour Number of Synthetics API tests run for each hour for a given organization. -type UsageSyntheticsAPIHour struct { - // Contains the number of Synthetics API tests run. - CheckCallsCount *int64 `json:"check_calls_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageSyntheticsAPIHour instantiates a new UsageSyntheticsAPIHour 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 NewUsageSyntheticsAPIHour() *UsageSyntheticsAPIHour { - this := UsageSyntheticsAPIHour{} - return &this -} - -// NewUsageSyntheticsAPIHourWithDefaults instantiates a new UsageSyntheticsAPIHour 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 NewUsageSyntheticsAPIHourWithDefaults() *UsageSyntheticsAPIHour { - this := UsageSyntheticsAPIHour{} - return &this -} - -// GetCheckCallsCount returns the CheckCallsCount field value if set, zero value otherwise. -func (o *UsageSyntheticsAPIHour) GetCheckCallsCount() int64 { - if o == nil || o.CheckCallsCount == nil { - var ret int64 - return ret - } - return *o.CheckCallsCount -} - -// GetCheckCallsCountOk returns a tuple with the CheckCallsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsAPIHour) GetCheckCallsCountOk() (*int64, bool) { - if o == nil || o.CheckCallsCount == nil { - return nil, false - } - return o.CheckCallsCount, true -} - -// HasCheckCallsCount returns a boolean if a field has been set. -func (o *UsageSyntheticsAPIHour) HasCheckCallsCount() bool { - if o != nil && o.CheckCallsCount != nil { - return true - } - - return false -} - -// SetCheckCallsCount gets a reference to the given int64 and assigns it to the CheckCallsCount field. -func (o *UsageSyntheticsAPIHour) SetCheckCallsCount(v int64) { - o.CheckCallsCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageSyntheticsAPIHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsAPIHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageSyntheticsAPIHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageSyntheticsAPIHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageSyntheticsAPIHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsAPIHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageSyntheticsAPIHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageSyntheticsAPIHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageSyntheticsAPIHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsAPIHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageSyntheticsAPIHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageSyntheticsAPIHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSyntheticsAPIHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CheckCallsCount != nil { - toSerialize["check_calls_count"] = o.CheckCallsCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSyntheticsAPIHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CheckCallsCount *int64 `json:"check_calls_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CheckCallsCount = all.CheckCallsCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_synthetics_api_response.go b/api/v1/datadog/model_usage_synthetics_api_response.go deleted file mode 100644 index 5b125757397..00000000000 --- a/api/v1/datadog/model_usage_synthetics_api_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSyntheticsAPIResponse Response containing the number of Synthetics API tests run for each hour for a given organization. -type UsageSyntheticsAPIResponse struct { - // Get hourly usage for Synthetics API tests. - Usage []UsageSyntheticsAPIHour `json:"usage,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{} -} - -// NewUsageSyntheticsAPIResponse instantiates a new UsageSyntheticsAPIResponse 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 NewUsageSyntheticsAPIResponse() *UsageSyntheticsAPIResponse { - this := UsageSyntheticsAPIResponse{} - return &this -} - -// NewUsageSyntheticsAPIResponseWithDefaults instantiates a new UsageSyntheticsAPIResponse 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 NewUsageSyntheticsAPIResponseWithDefaults() *UsageSyntheticsAPIResponse { - this := UsageSyntheticsAPIResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageSyntheticsAPIResponse) GetUsage() []UsageSyntheticsAPIHour { - if o == nil || o.Usage == nil { - var ret []UsageSyntheticsAPIHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsAPIResponse) GetUsageOk() (*[]UsageSyntheticsAPIHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageSyntheticsAPIResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageSyntheticsAPIHour and assigns it to the Usage field. -func (o *UsageSyntheticsAPIResponse) SetUsage(v []UsageSyntheticsAPIHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSyntheticsAPIResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSyntheticsAPIResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageSyntheticsAPIHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_synthetics_browser_hour.go b/api/v1/datadog/model_usage_synthetics_browser_hour.go deleted file mode 100644 index 67820307e35..00000000000 --- a/api/v1/datadog/model_usage_synthetics_browser_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageSyntheticsBrowserHour Number of Synthetics Browser tests run for each hour for a given organization. -type UsageSyntheticsBrowserHour struct { - // Contains the number of Synthetics Browser tests run. - BrowserCheckCallsCount *int64 `json:"browser_check_calls_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageSyntheticsBrowserHour instantiates a new UsageSyntheticsBrowserHour 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 NewUsageSyntheticsBrowserHour() *UsageSyntheticsBrowserHour { - this := UsageSyntheticsBrowserHour{} - return &this -} - -// NewUsageSyntheticsBrowserHourWithDefaults instantiates a new UsageSyntheticsBrowserHour 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 NewUsageSyntheticsBrowserHourWithDefaults() *UsageSyntheticsBrowserHour { - this := UsageSyntheticsBrowserHour{} - return &this -} - -// GetBrowserCheckCallsCount returns the BrowserCheckCallsCount field value if set, zero value otherwise. -func (o *UsageSyntheticsBrowserHour) GetBrowserCheckCallsCount() int64 { - if o == nil || o.BrowserCheckCallsCount == nil { - var ret int64 - return ret - } - return *o.BrowserCheckCallsCount -} - -// GetBrowserCheckCallsCountOk returns a tuple with the BrowserCheckCallsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsBrowserHour) GetBrowserCheckCallsCountOk() (*int64, bool) { - if o == nil || o.BrowserCheckCallsCount == nil { - return nil, false - } - return o.BrowserCheckCallsCount, true -} - -// HasBrowserCheckCallsCount returns a boolean if a field has been set. -func (o *UsageSyntheticsBrowserHour) HasBrowserCheckCallsCount() bool { - if o != nil && o.BrowserCheckCallsCount != nil { - return true - } - - return false -} - -// SetBrowserCheckCallsCount gets a reference to the given int64 and assigns it to the BrowserCheckCallsCount field. -func (o *UsageSyntheticsBrowserHour) SetBrowserCheckCallsCount(v int64) { - o.BrowserCheckCallsCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageSyntheticsBrowserHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsBrowserHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageSyntheticsBrowserHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageSyntheticsBrowserHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageSyntheticsBrowserHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsBrowserHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageSyntheticsBrowserHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageSyntheticsBrowserHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageSyntheticsBrowserHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsBrowserHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageSyntheticsBrowserHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageSyntheticsBrowserHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSyntheticsBrowserHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BrowserCheckCallsCount != nil { - toSerialize["browser_check_calls_count"] = o.BrowserCheckCallsCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSyntheticsBrowserHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BrowserCheckCallsCount *int64 `json:"browser_check_calls_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BrowserCheckCallsCount = all.BrowserCheckCallsCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_synthetics_browser_response.go b/api/v1/datadog/model_usage_synthetics_browser_response.go deleted file mode 100644 index 3315a2c0892..00000000000 --- a/api/v1/datadog/model_usage_synthetics_browser_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSyntheticsBrowserResponse Response containing the number of Synthetics Browser tests run for each hour for a given organization. -type UsageSyntheticsBrowserResponse struct { - // Get hourly usage for Synthetics Browser tests. - Usage []UsageSyntheticsBrowserHour `json:"usage,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{} -} - -// NewUsageSyntheticsBrowserResponse instantiates a new UsageSyntheticsBrowserResponse 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 NewUsageSyntheticsBrowserResponse() *UsageSyntheticsBrowserResponse { - this := UsageSyntheticsBrowserResponse{} - return &this -} - -// NewUsageSyntheticsBrowserResponseWithDefaults instantiates a new UsageSyntheticsBrowserResponse 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 NewUsageSyntheticsBrowserResponseWithDefaults() *UsageSyntheticsBrowserResponse { - this := UsageSyntheticsBrowserResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageSyntheticsBrowserResponse) GetUsage() []UsageSyntheticsBrowserHour { - if o == nil || o.Usage == nil { - var ret []UsageSyntheticsBrowserHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsBrowserResponse) GetUsageOk() (*[]UsageSyntheticsBrowserHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageSyntheticsBrowserResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageSyntheticsBrowserHour and assigns it to the Usage field. -func (o *UsageSyntheticsBrowserResponse) SetUsage(v []UsageSyntheticsBrowserHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSyntheticsBrowserResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSyntheticsBrowserResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageSyntheticsBrowserHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_synthetics_hour.go b/api/v1/datadog/model_usage_synthetics_hour.go deleted file mode 100644 index c1da0709c14..00000000000 --- a/api/v1/datadog/model_usage_synthetics_hour.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageSyntheticsHour The number of synthetics tests run for each hour for a given organization. -type UsageSyntheticsHour struct { - // Contains the number of Synthetics API tests run. - CheckCallsCount *int64 `json:"check_calls_count,omitempty"` - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageSyntheticsHour instantiates a new UsageSyntheticsHour 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 NewUsageSyntheticsHour() *UsageSyntheticsHour { - this := UsageSyntheticsHour{} - return &this -} - -// NewUsageSyntheticsHourWithDefaults instantiates a new UsageSyntheticsHour 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 NewUsageSyntheticsHourWithDefaults() *UsageSyntheticsHour { - this := UsageSyntheticsHour{} - return &this -} - -// GetCheckCallsCount returns the CheckCallsCount field value if set, zero value otherwise. -func (o *UsageSyntheticsHour) GetCheckCallsCount() int64 { - if o == nil || o.CheckCallsCount == nil { - var ret int64 - return ret - } - return *o.CheckCallsCount -} - -// GetCheckCallsCountOk returns a tuple with the CheckCallsCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsHour) GetCheckCallsCountOk() (*int64, bool) { - if o == nil || o.CheckCallsCount == nil { - return nil, false - } - return o.CheckCallsCount, true -} - -// HasCheckCallsCount returns a boolean if a field has been set. -func (o *UsageSyntheticsHour) HasCheckCallsCount() bool { - if o != nil && o.CheckCallsCount != nil { - return true - } - - return false -} - -// SetCheckCallsCount gets a reference to the given int64 and assigns it to the CheckCallsCount field. -func (o *UsageSyntheticsHour) SetCheckCallsCount(v int64) { - o.CheckCallsCount = &v -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageSyntheticsHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageSyntheticsHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageSyntheticsHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageSyntheticsHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageSyntheticsHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageSyntheticsHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageSyntheticsHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageSyntheticsHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageSyntheticsHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSyntheticsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CheckCallsCount != nil { - toSerialize["check_calls_count"] = o.CheckCallsCount - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSyntheticsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CheckCallsCount *int64 `json:"check_calls_count,omitempty"` - Hour *time.Time `json:"hour,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CheckCallsCount = all.CheckCallsCount - o.Hour = all.Hour - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_synthetics_response.go b/api/v1/datadog/model_usage_synthetics_response.go deleted file mode 100644 index 6d9415bea39..00000000000 --- a/api/v1/datadog/model_usage_synthetics_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageSyntheticsResponse Response containing the number of Synthetics API tests run for each hour for a given organization. -type UsageSyntheticsResponse struct { - // Array with the number of hourly Synthetics test run for a given organization. - Usage []UsageSyntheticsHour `json:"usage,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{} -} - -// NewUsageSyntheticsResponse instantiates a new UsageSyntheticsResponse 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 NewUsageSyntheticsResponse() *UsageSyntheticsResponse { - this := UsageSyntheticsResponse{} - return &this -} - -// NewUsageSyntheticsResponseWithDefaults instantiates a new UsageSyntheticsResponse 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 NewUsageSyntheticsResponseWithDefaults() *UsageSyntheticsResponse { - this := UsageSyntheticsResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageSyntheticsResponse) GetUsage() []UsageSyntheticsHour { - if o == nil || o.Usage == nil { - var ret []UsageSyntheticsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageSyntheticsResponse) GetUsageOk() (*[]UsageSyntheticsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageSyntheticsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageSyntheticsHour and assigns it to the Usage field. -func (o *UsageSyntheticsResponse) SetUsage(v []UsageSyntheticsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageSyntheticsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageSyntheticsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageSyntheticsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_timeseries_hour.go b/api/v1/datadog/model_usage_timeseries_hour.go deleted file mode 100644 index a32d62de3e8..00000000000 --- a/api/v1/datadog/model_usage_timeseries_hour.go +++ /dev/null @@ -1,302 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageTimeseriesHour The hourly usage of timeseries. -type UsageTimeseriesHour struct { - // The hour for the usage. - Hour *time.Time `json:"hour,omitempty"` - // Contains the number of custom metrics that are inputs for aggregations (metric configured is custom). - NumCustomInputTimeseries *int64 `json:"num_custom_input_timeseries,omitempty"` - // Contains the number of custom metrics that are outputs for aggregations (metric configured is custom). - NumCustomOutputTimeseries *int64 `json:"num_custom_output_timeseries,omitempty"` - // Contains sum of non-aggregation custom metrics and custom metrics that are outputs for aggregations. - NumCustomTimeseries *int64 `json:"num_custom_timeseries,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,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{} -} - -// NewUsageTimeseriesHour instantiates a new UsageTimeseriesHour 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 NewUsageTimeseriesHour() *UsageTimeseriesHour { - this := UsageTimeseriesHour{} - return &this -} - -// NewUsageTimeseriesHourWithDefaults instantiates a new UsageTimeseriesHour 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 NewUsageTimeseriesHourWithDefaults() *UsageTimeseriesHour { - this := UsageTimeseriesHour{} - return &this -} - -// GetHour returns the Hour field value if set, zero value otherwise. -func (o *UsageTimeseriesHour) GetHour() time.Time { - if o == nil || o.Hour == nil { - var ret time.Time - return ret - } - return *o.Hour -} - -// GetHourOk returns a tuple with the Hour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeseriesHour) GetHourOk() (*time.Time, bool) { - if o == nil || o.Hour == nil { - return nil, false - } - return o.Hour, true -} - -// HasHour returns a boolean if a field has been set. -func (o *UsageTimeseriesHour) HasHour() bool { - if o != nil && o.Hour != nil { - return true - } - - return false -} - -// SetHour gets a reference to the given time.Time and assigns it to the Hour field. -func (o *UsageTimeseriesHour) SetHour(v time.Time) { - o.Hour = &v -} - -// GetNumCustomInputTimeseries returns the NumCustomInputTimeseries field value if set, zero value otherwise. -func (o *UsageTimeseriesHour) GetNumCustomInputTimeseries() int64 { - if o == nil || o.NumCustomInputTimeseries == nil { - var ret int64 - return ret - } - return *o.NumCustomInputTimeseries -} - -// GetNumCustomInputTimeseriesOk returns a tuple with the NumCustomInputTimeseries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeseriesHour) GetNumCustomInputTimeseriesOk() (*int64, bool) { - if o == nil || o.NumCustomInputTimeseries == nil { - return nil, false - } - return o.NumCustomInputTimeseries, true -} - -// HasNumCustomInputTimeseries returns a boolean if a field has been set. -func (o *UsageTimeseriesHour) HasNumCustomInputTimeseries() bool { - if o != nil && o.NumCustomInputTimeseries != nil { - return true - } - - return false -} - -// SetNumCustomInputTimeseries gets a reference to the given int64 and assigns it to the NumCustomInputTimeseries field. -func (o *UsageTimeseriesHour) SetNumCustomInputTimeseries(v int64) { - o.NumCustomInputTimeseries = &v -} - -// GetNumCustomOutputTimeseries returns the NumCustomOutputTimeseries field value if set, zero value otherwise. -func (o *UsageTimeseriesHour) GetNumCustomOutputTimeseries() int64 { - if o == nil || o.NumCustomOutputTimeseries == nil { - var ret int64 - return ret - } - return *o.NumCustomOutputTimeseries -} - -// GetNumCustomOutputTimeseriesOk returns a tuple with the NumCustomOutputTimeseries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeseriesHour) GetNumCustomOutputTimeseriesOk() (*int64, bool) { - if o == nil || o.NumCustomOutputTimeseries == nil { - return nil, false - } - return o.NumCustomOutputTimeseries, true -} - -// HasNumCustomOutputTimeseries returns a boolean if a field has been set. -func (o *UsageTimeseriesHour) HasNumCustomOutputTimeseries() bool { - if o != nil && o.NumCustomOutputTimeseries != nil { - return true - } - - return false -} - -// SetNumCustomOutputTimeseries gets a reference to the given int64 and assigns it to the NumCustomOutputTimeseries field. -func (o *UsageTimeseriesHour) SetNumCustomOutputTimeseries(v int64) { - o.NumCustomOutputTimeseries = &v -} - -// GetNumCustomTimeseries returns the NumCustomTimeseries field value if set, zero value otherwise. -func (o *UsageTimeseriesHour) GetNumCustomTimeseries() int64 { - if o == nil || o.NumCustomTimeseries == nil { - var ret int64 - return ret - } - return *o.NumCustomTimeseries -} - -// GetNumCustomTimeseriesOk returns a tuple with the NumCustomTimeseries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeseriesHour) GetNumCustomTimeseriesOk() (*int64, bool) { - if o == nil || o.NumCustomTimeseries == nil { - return nil, false - } - return o.NumCustomTimeseries, true -} - -// HasNumCustomTimeseries returns a boolean if a field has been set. -func (o *UsageTimeseriesHour) HasNumCustomTimeseries() bool { - if o != nil && o.NumCustomTimeseries != nil { - return true - } - - return false -} - -// SetNumCustomTimeseries gets a reference to the given int64 and assigns it to the NumCustomTimeseries field. -func (o *UsageTimeseriesHour) SetNumCustomTimeseries(v int64) { - o.NumCustomTimeseries = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageTimeseriesHour) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeseriesHour) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageTimeseriesHour) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageTimeseriesHour) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageTimeseriesHour) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeseriesHour) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageTimeseriesHour) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageTimeseriesHour) SetPublicId(v string) { - o.PublicId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageTimeseriesHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Hour != nil { - if o.Hour.Nanosecond() == 0 { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.NumCustomInputTimeseries != nil { - toSerialize["num_custom_input_timeseries"] = o.NumCustomInputTimeseries - } - if o.NumCustomOutputTimeseries != nil { - toSerialize["num_custom_output_timeseries"] = o.NumCustomOutputTimeseries - } - if o.NumCustomTimeseries != nil { - toSerialize["num_custom_timeseries"] = o.NumCustomTimeseries - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageTimeseriesHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Hour *time.Time `json:"hour,omitempty"` - NumCustomInputTimeseries *int64 `json:"num_custom_input_timeseries,omitempty"` - NumCustomOutputTimeseries *int64 `json:"num_custom_output_timeseries,omitempty"` - NumCustomTimeseries *int64 `json:"num_custom_timeseries,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Hour = all.Hour - o.NumCustomInputTimeseries = all.NumCustomInputTimeseries - o.NumCustomOutputTimeseries = all.NumCustomOutputTimeseries - o.NumCustomTimeseries = all.NumCustomTimeseries - o.OrgName = all.OrgName - o.PublicId = all.PublicId - return nil -} diff --git a/api/v1/datadog/model_usage_timeseries_response.go b/api/v1/datadog/model_usage_timeseries_response.go deleted file mode 100644 index 6619e410066..00000000000 --- a/api/v1/datadog/model_usage_timeseries_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageTimeseriesResponse Response containing hourly usage of timeseries. -type UsageTimeseriesResponse struct { - // An array of objects regarding hourly usage of timeseries. - Usage []UsageTimeseriesHour `json:"usage,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{} -} - -// NewUsageTimeseriesResponse instantiates a new UsageTimeseriesResponse 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 NewUsageTimeseriesResponse() *UsageTimeseriesResponse { - this := UsageTimeseriesResponse{} - return &this -} - -// NewUsageTimeseriesResponseWithDefaults instantiates a new UsageTimeseriesResponse 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 NewUsageTimeseriesResponseWithDefaults() *UsageTimeseriesResponse { - this := UsageTimeseriesResponse{} - return &this -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageTimeseriesResponse) GetUsage() []UsageTimeseriesHour { - if o == nil || o.Usage == nil { - var ret []UsageTimeseriesHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeseriesResponse) GetUsageOk() (*[]UsageTimeseriesHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageTimeseriesResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageTimeseriesHour and assigns it to the Usage field. -func (o *UsageTimeseriesResponse) SetUsage(v []UsageTimeseriesHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageTimeseriesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageTimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Usage []UsageTimeseriesHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_hour.go b/api/v1/datadog/model_usage_top_avg_metrics_hour.go deleted file mode 100644 index b2358e09f09..00000000000 --- a/api/v1/datadog/model_usage_top_avg_metrics_hour.go +++ /dev/null @@ -1,227 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageTopAvgMetricsHour Number of hourly recorded custom metrics for a given organization. -type UsageTopAvgMetricsHour struct { - // Average number of timeseries per hour in which the metric occurs. - AvgMetricHour *int64 `json:"avg_metric_hour,omitempty"` - // Maximum number of timeseries per hour in which the metric occurs. - MaxMetricHour *int64 `json:"max_metric_hour,omitempty"` - // Contains the metric category. - MetricCategory *UsageMetricCategory `json:"metric_category,omitempty"` - // Contains the custom metric name. - MetricName *string `json:"metric_name,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{} -} - -// NewUsageTopAvgMetricsHour instantiates a new UsageTopAvgMetricsHour 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 NewUsageTopAvgMetricsHour() *UsageTopAvgMetricsHour { - this := UsageTopAvgMetricsHour{} - return &this -} - -// NewUsageTopAvgMetricsHourWithDefaults instantiates a new UsageTopAvgMetricsHour 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 NewUsageTopAvgMetricsHourWithDefaults() *UsageTopAvgMetricsHour { - this := UsageTopAvgMetricsHour{} - return &this -} - -// GetAvgMetricHour returns the AvgMetricHour field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsHour) GetAvgMetricHour() int64 { - if o == nil || o.AvgMetricHour == nil { - var ret int64 - return ret - } - return *o.AvgMetricHour -} - -// GetAvgMetricHourOk returns a tuple with the AvgMetricHour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsHour) GetAvgMetricHourOk() (*int64, bool) { - if o == nil || o.AvgMetricHour == nil { - return nil, false - } - return o.AvgMetricHour, true -} - -// HasAvgMetricHour returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsHour) HasAvgMetricHour() bool { - if o != nil && o.AvgMetricHour != nil { - return true - } - - return false -} - -// SetAvgMetricHour gets a reference to the given int64 and assigns it to the AvgMetricHour field. -func (o *UsageTopAvgMetricsHour) SetAvgMetricHour(v int64) { - o.AvgMetricHour = &v -} - -// GetMaxMetricHour returns the MaxMetricHour field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsHour) GetMaxMetricHour() int64 { - if o == nil || o.MaxMetricHour == nil { - var ret int64 - return ret - } - return *o.MaxMetricHour -} - -// GetMaxMetricHourOk returns a tuple with the MaxMetricHour field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsHour) GetMaxMetricHourOk() (*int64, bool) { - if o == nil || o.MaxMetricHour == nil { - return nil, false - } - return o.MaxMetricHour, true -} - -// HasMaxMetricHour returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsHour) HasMaxMetricHour() bool { - if o != nil && o.MaxMetricHour != nil { - return true - } - - return false -} - -// SetMaxMetricHour gets a reference to the given int64 and assigns it to the MaxMetricHour field. -func (o *UsageTopAvgMetricsHour) SetMaxMetricHour(v int64) { - o.MaxMetricHour = &v -} - -// GetMetricCategory returns the MetricCategory field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsHour) GetMetricCategory() UsageMetricCategory { - if o == nil || o.MetricCategory == nil { - var ret UsageMetricCategory - return ret - } - return *o.MetricCategory -} - -// GetMetricCategoryOk returns a tuple with the MetricCategory field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsHour) GetMetricCategoryOk() (*UsageMetricCategory, bool) { - if o == nil || o.MetricCategory == nil { - return nil, false - } - return o.MetricCategory, true -} - -// HasMetricCategory returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsHour) HasMetricCategory() bool { - if o != nil && o.MetricCategory != nil { - return true - } - - return false -} - -// SetMetricCategory gets a reference to the given UsageMetricCategory and assigns it to the MetricCategory field. -func (o *UsageTopAvgMetricsHour) SetMetricCategory(v UsageMetricCategory) { - o.MetricCategory = &v -} - -// GetMetricName returns the MetricName field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsHour) GetMetricName() string { - if o == nil || o.MetricName == nil { - var ret string - return ret - } - return *o.MetricName -} - -// GetMetricNameOk returns a tuple with the MetricName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsHour) GetMetricNameOk() (*string, bool) { - if o == nil || o.MetricName == nil { - return nil, false - } - return o.MetricName, true -} - -// HasMetricName returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsHour) HasMetricName() bool { - if o != nil && o.MetricName != nil { - return true - } - - return false -} - -// SetMetricName gets a reference to the given string and assigns it to the MetricName field. -func (o *UsageTopAvgMetricsHour) SetMetricName(v string) { - o.MetricName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageTopAvgMetricsHour) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AvgMetricHour != nil { - toSerialize["avg_metric_hour"] = o.AvgMetricHour - } - if o.MaxMetricHour != nil { - toSerialize["max_metric_hour"] = o.MaxMetricHour - } - if o.MetricCategory != nil { - toSerialize["metric_category"] = o.MetricCategory - } - if o.MetricName != nil { - toSerialize["metric_name"] = o.MetricName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageTopAvgMetricsHour) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AvgMetricHour *int64 `json:"avg_metric_hour,omitempty"` - MaxMetricHour *int64 `json:"max_metric_hour,omitempty"` - MetricCategory *UsageMetricCategory `json:"metric_category,omitempty"` - MetricName *string `json:"metric_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.MetricCategory; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AvgMetricHour = all.AvgMetricHour - o.MaxMetricHour = all.MaxMetricHour - o.MetricCategory = all.MetricCategory - o.MetricName = all.MetricName - return nil -} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_metadata.go b/api/v1/datadog/model_usage_top_avg_metrics_metadata.go deleted file mode 100644 index 12710ec2291..00000000000 --- a/api/v1/datadog/model_usage_top_avg_metrics_metadata.go +++ /dev/null @@ -1,196 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UsageTopAvgMetricsMetadata The object containing document metadata. -type UsageTopAvgMetricsMetadata struct { - // The day value from the user request that contains the returned usage data. (If day was used the request) - Day *time.Time `json:"day,omitempty"` - // The month value from the user request that contains the returned usage data. (If month was used the request) - Month *time.Time `json:"month,omitempty"` - // The metadata for the current pagination. - Pagination *UsageTopAvgMetricsPagination `json:"pagination,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{} -} - -// NewUsageTopAvgMetricsMetadata instantiates a new UsageTopAvgMetricsMetadata 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 NewUsageTopAvgMetricsMetadata() *UsageTopAvgMetricsMetadata { - this := UsageTopAvgMetricsMetadata{} - return &this -} - -// NewUsageTopAvgMetricsMetadataWithDefaults instantiates a new UsageTopAvgMetricsMetadata 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 NewUsageTopAvgMetricsMetadataWithDefaults() *UsageTopAvgMetricsMetadata { - this := UsageTopAvgMetricsMetadata{} - return &this -} - -// GetDay returns the Day field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsMetadata) GetDay() time.Time { - if o == nil || o.Day == nil { - var ret time.Time - return ret - } - return *o.Day -} - -// GetDayOk returns a tuple with the Day field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsMetadata) GetDayOk() (*time.Time, bool) { - if o == nil || o.Day == nil { - return nil, false - } - return o.Day, true -} - -// HasDay returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsMetadata) HasDay() bool { - if o != nil && o.Day != nil { - return true - } - - return false -} - -// SetDay gets a reference to the given time.Time and assigns it to the Day field. -func (o *UsageTopAvgMetricsMetadata) SetDay(v time.Time) { - o.Day = &v -} - -// GetMonth returns the Month field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsMetadata) GetMonth() time.Time { - if o == nil || o.Month == nil { - var ret time.Time - return ret - } - return *o.Month -} - -// GetMonthOk returns a tuple with the Month field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsMetadata) GetMonthOk() (*time.Time, bool) { - if o == nil || o.Month == nil { - return nil, false - } - return o.Month, true -} - -// HasMonth returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsMetadata) HasMonth() bool { - if o != nil && o.Month != nil { - return true - } - - return false -} - -// SetMonth gets a reference to the given time.Time and assigns it to the Month field. -func (o *UsageTopAvgMetricsMetadata) SetMonth(v time.Time) { - o.Month = &v -} - -// GetPagination returns the Pagination field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsMetadata) GetPagination() UsageTopAvgMetricsPagination { - if o == nil || o.Pagination == nil { - var ret UsageTopAvgMetricsPagination - return ret - } - return *o.Pagination -} - -// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsMetadata) GetPaginationOk() (*UsageTopAvgMetricsPagination, bool) { - if o == nil || o.Pagination == nil { - return nil, false - } - return o.Pagination, true -} - -// HasPagination returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsMetadata) HasPagination() bool { - if o != nil && o.Pagination != nil { - return true - } - - return false -} - -// SetPagination gets a reference to the given UsageTopAvgMetricsPagination and assigns it to the Pagination field. -func (o *UsageTopAvgMetricsMetadata) SetPagination(v UsageTopAvgMetricsPagination) { - o.Pagination = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageTopAvgMetricsMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Day != nil { - if o.Day.Nanosecond() == 0 { - toSerialize["day"] = o.Day.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["day"] = o.Day.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Month != nil { - if o.Month.Nanosecond() == 0 { - toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Pagination != nil { - toSerialize["pagination"] = o.Pagination - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageTopAvgMetricsMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Day *time.Time `json:"day,omitempty"` - Month *time.Time `json:"month,omitempty"` - Pagination *UsageTopAvgMetricsPagination `json:"pagination,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Day = all.Day - o.Month = all.Month - if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pagination = all.Pagination - return nil -} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_pagination.go b/api/v1/datadog/model_usage_top_avg_metrics_pagination.go deleted file mode 100644 index cf69c9a6752..00000000000 --- a/api/v1/datadog/model_usage_top_avg_metrics_pagination.go +++ /dev/null @@ -1,193 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsageTopAvgMetricsPagination The metadata for the current pagination. -type UsageTopAvgMetricsPagination struct { - // Maximum amount of records to be returned. - Limit *int64 `json:"limit,omitempty"` - // The cursor to get the next results (if any). To make the next request, use the same parameters and add `next_record_id`. - NextRecordId common.NullableString `json:"next_record_id,omitempty"` - // Total number of records. - TotalNumberOfRecords *int64 `json:"total_number_of_records,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{} -} - -// NewUsageTopAvgMetricsPagination instantiates a new UsageTopAvgMetricsPagination 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 NewUsageTopAvgMetricsPagination() *UsageTopAvgMetricsPagination { - this := UsageTopAvgMetricsPagination{} - return &this -} - -// NewUsageTopAvgMetricsPaginationWithDefaults instantiates a new UsageTopAvgMetricsPagination 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 NewUsageTopAvgMetricsPaginationWithDefaults() *UsageTopAvgMetricsPagination { - this := UsageTopAvgMetricsPagination{} - return &this -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsPagination) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsPagination) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsPagination) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *UsageTopAvgMetricsPagination) SetLimit(v int64) { - o.Limit = &v -} - -// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageTopAvgMetricsPagination) GetNextRecordId() string { - if o == nil || o.NextRecordId.Get() == nil { - var ret string - return ret - } - return *o.NextRecordId.Get() -} - -// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *UsageTopAvgMetricsPagination) GetNextRecordIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.NextRecordId.Get(), o.NextRecordId.IsSet() -} - -// HasNextRecordId returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsPagination) HasNextRecordId() bool { - if o != nil && o.NextRecordId.IsSet() { - return true - } - - return false -} - -// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. -func (o *UsageTopAvgMetricsPagination) SetNextRecordId(v string) { - o.NextRecordId.Set(&v) -} - -// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. -func (o *UsageTopAvgMetricsPagination) SetNextRecordIdNil() { - o.NextRecordId.Set(nil) -} - -// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. -func (o *UsageTopAvgMetricsPagination) UnsetNextRecordId() { - o.NextRecordId.Unset() -} - -// GetTotalNumberOfRecords returns the TotalNumberOfRecords field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsPagination) GetTotalNumberOfRecords() int64 { - if o == nil || o.TotalNumberOfRecords == nil { - var ret int64 - return ret - } - return *o.TotalNumberOfRecords -} - -// GetTotalNumberOfRecordsOk returns a tuple with the TotalNumberOfRecords field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsPagination) GetTotalNumberOfRecordsOk() (*int64, bool) { - if o == nil || o.TotalNumberOfRecords == nil { - return nil, false - } - return o.TotalNumberOfRecords, true -} - -// HasTotalNumberOfRecords returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsPagination) HasTotalNumberOfRecords() bool { - if o != nil && o.TotalNumberOfRecords != nil { - return true - } - - return false -} - -// SetTotalNumberOfRecords gets a reference to the given int64 and assigns it to the TotalNumberOfRecords field. -func (o *UsageTopAvgMetricsPagination) SetTotalNumberOfRecords(v int64) { - o.TotalNumberOfRecords = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageTopAvgMetricsPagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.NextRecordId.IsSet() { - toSerialize["next_record_id"] = o.NextRecordId.Get() - } - if o.TotalNumberOfRecords != nil { - toSerialize["total_number_of_records"] = o.TotalNumberOfRecords - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageTopAvgMetricsPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Limit *int64 `json:"limit,omitempty"` - NextRecordId common.NullableString `json:"next_record_id,omitempty"` - TotalNumberOfRecords *int64 `json:"total_number_of_records,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Limit = all.Limit - o.NextRecordId = all.NextRecordId - o.TotalNumberOfRecords = all.TotalNumberOfRecords - return nil -} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_response.go b/api/v1/datadog/model_usage_top_avg_metrics_response.go deleted file mode 100644 index f2e87d301ae..00000000000 --- a/api/v1/datadog/model_usage_top_avg_metrics_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageTopAvgMetricsResponse Response containing the number of hourly recorded custom metrics for a given organization. -type UsageTopAvgMetricsResponse struct { - // The object containing document metadata. - Metadata *UsageTopAvgMetricsMetadata `json:"metadata,omitempty"` - // Number of hourly recorded custom metrics for a given organization. - Usage []UsageTopAvgMetricsHour `json:"usage,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{} -} - -// NewUsageTopAvgMetricsResponse instantiates a new UsageTopAvgMetricsResponse 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 NewUsageTopAvgMetricsResponse() *UsageTopAvgMetricsResponse { - this := UsageTopAvgMetricsResponse{} - return &this -} - -// NewUsageTopAvgMetricsResponseWithDefaults instantiates a new UsageTopAvgMetricsResponse 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 NewUsageTopAvgMetricsResponseWithDefaults() *UsageTopAvgMetricsResponse { - this := UsageTopAvgMetricsResponse{} - return &this -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsResponse) GetMetadata() UsageTopAvgMetricsMetadata { - if o == nil || o.Metadata == nil { - var ret UsageTopAvgMetricsMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsResponse) GetMetadataOk() (*UsageTopAvgMetricsMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsResponse) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given UsageTopAvgMetricsMetadata and assigns it to the Metadata field. -func (o *UsageTopAvgMetricsResponse) SetMetadata(v UsageTopAvgMetricsMetadata) { - o.Metadata = &v -} - -// GetUsage returns the Usage field value if set, zero value otherwise. -func (o *UsageTopAvgMetricsResponse) GetUsage() []UsageTopAvgMetricsHour { - if o == nil || o.Usage == nil { - var ret []UsageTopAvgMetricsHour - return ret - } - return o.Usage -} - -// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTopAvgMetricsResponse) GetUsageOk() (*[]UsageTopAvgMetricsHour, bool) { - if o == nil || o.Usage == nil { - return nil, false - } - return &o.Usage, true -} - -// HasUsage returns a boolean if a field has been set. -func (o *UsageTopAvgMetricsResponse) HasUsage() bool { - if o != nil && o.Usage != nil { - return true - } - - return false -} - -// SetUsage gets a reference to the given []UsageTopAvgMetricsHour and assigns it to the Usage field. -func (o *UsageTopAvgMetricsResponse) SetUsage(v []UsageTopAvgMetricsHour) { - o.Usage = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageTopAvgMetricsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - if o.Usage != nil { - toSerialize["usage"] = o.Usage - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageTopAvgMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Metadata *UsageTopAvgMetricsMetadata `json:"metadata,omitempty"` - Usage []UsageTopAvgMetricsHour `json:"usage,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Usage = all.Usage - return nil -} diff --git a/api/v1/datadog/model_user.go b/api/v1/datadog/model_user.go deleted file mode 100644 index eac80a9feae..00000000000 --- a/api/v1/datadog/model_user.go +++ /dev/null @@ -1,348 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// User Create, edit, and disable users. -type User struct { - // The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). - AccessRole *AccessRole `json:"access_role,omitempty"` - // The new disabled status of the user. - Disabled *bool `json:"disabled,omitempty"` - // The new email of the user. - Email *string `json:"email,omitempty"` - // The user handle, must be a valid email. - Handle *string `json:"handle,omitempty"` - // Gravatar icon associated to the user. - Icon *string `json:"icon,omitempty"` - // The name of the user. - Name *string `json:"name,omitempty"` - // Whether or not the user logged in Datadog at least once. - Verified *bool `json:"verified,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{} -} - -// NewUser instantiates a new User 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 NewUser() *User { - this := User{} - var accessRole AccessRole = ACCESSROLE_STANDARD - this.AccessRole = &accessRole - return &this -} - -// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User { - this := User{} - var accessRole AccessRole = ACCESSROLE_STANDARD - this.AccessRole = &accessRole - return &this -} - -// GetAccessRole returns the AccessRole field value if set, zero value otherwise. -func (o *User) GetAccessRole() AccessRole { - if o == nil || o.AccessRole == nil { - var ret AccessRole - return ret - } - return *o.AccessRole -} - -// GetAccessRoleOk returns a tuple with the AccessRole field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetAccessRoleOk() (*AccessRole, bool) { - if o == nil || o.AccessRole == nil { - return nil, false - } - return o.AccessRole, true -} - -// HasAccessRole returns a boolean if a field has been set. -func (o *User) HasAccessRole() bool { - if o != nil && o.AccessRole != nil { - return true - } - - return false -} - -// SetAccessRole gets a reference to the given AccessRole and assigns it to the AccessRole field. -func (o *User) SetAccessRole(v AccessRole) { - o.AccessRole = &v -} - -// GetDisabled returns the Disabled field value if set, zero value otherwise. -func (o *User) GetDisabled() bool { - if o == nil || o.Disabled == nil { - var ret bool - return ret - } - return *o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetDisabledOk() (*bool, bool) { - if o == nil || o.Disabled == nil { - return nil, false - } - return o.Disabled, true -} - -// HasDisabled returns a boolean if a field has been set. -func (o *User) HasDisabled() bool { - if o != nil && o.Disabled != nil { - return true - } - - return false -} - -// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. -func (o *User) SetDisabled(v bool) { - o.Disabled = &v -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *User) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *User) HasEmail() bool { - if o != nil && o.Email != nil { - return true - } - - return false -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *User) SetEmail(v string) { - o.Email = &v -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *User) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *User) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *User) SetHandle(v string) { - o.Handle = &v -} - -// GetIcon returns the Icon field value if set, zero value otherwise. -func (o *User) GetIcon() string { - if o == nil || o.Icon == nil { - var ret string - return ret - } - return *o.Icon -} - -// GetIconOk returns a tuple with the Icon field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetIconOk() (*string, bool) { - if o == nil || o.Icon == nil { - return nil, false - } - return o.Icon, true -} - -// HasIcon returns a boolean if a field has been set. -func (o *User) HasIcon() bool { - if o != nil && o.Icon != nil { - return true - } - - return false -} - -// SetIcon gets a reference to the given string and assigns it to the Icon field. -func (o *User) SetIcon(v string) { - o.Icon = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *User) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *User) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *User) SetName(v string) { - o.Name = &v -} - -// GetVerified returns the Verified field value if set, zero value otherwise. -func (o *User) GetVerified() bool { - if o == nil || o.Verified == nil { - var ret bool - return ret - } - return *o.Verified -} - -// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetVerifiedOk() (*bool, bool) { - if o == nil || o.Verified == nil { - return nil, false - } - return o.Verified, true -} - -// HasVerified returns a boolean if a field has been set. -func (o *User) HasVerified() bool { - if o != nil && o.Verified != nil { - return true - } - - return false -} - -// SetVerified gets a reference to the given bool and assigns it to the Verified field. -func (o *User) SetVerified(v bool) { - o.Verified = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o User) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AccessRole != nil { - toSerialize["access_role"] = o.AccessRole - } - if o.Disabled != nil { - toSerialize["disabled"] = o.Disabled - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Icon != nil { - toSerialize["icon"] = o.Icon - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Verified != nil { - toSerialize["verified"] = o.Verified - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *User) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AccessRole *AccessRole `json:"access_role,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - Email *string `json:"email,omitempty"` - Handle *string `json:"handle,omitempty"` - Icon *string `json:"icon,omitempty"` - Name *string `json:"name,omitempty"` - Verified *bool `json:"verified,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.AccessRole; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccessRole = all.AccessRole - o.Disabled = all.Disabled - o.Email = all.Email - o.Handle = all.Handle - o.Icon = all.Icon - o.Name = all.Name - o.Verified = all.Verified - return nil -} diff --git a/api/v1/datadog/model_user_disable_response.go b/api/v1/datadog/model_user_disable_response.go deleted file mode 100644 index e462c98dc60..00000000000 --- a/api/v1/datadog/model_user_disable_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserDisableResponse Array of user disabled for a given organization. -type UserDisableResponse struct { - // Information pertaining to a user disabled for a given organization. - Message *string `json:"message,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{} -} - -// NewUserDisableResponse instantiates a new UserDisableResponse 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 NewUserDisableResponse() *UserDisableResponse { - this := UserDisableResponse{} - return &this -} - -// NewUserDisableResponseWithDefaults instantiates a new UserDisableResponse 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 NewUserDisableResponseWithDefaults() *UserDisableResponse { - this := UserDisableResponse{} - return &this -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *UserDisableResponse) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserDisableResponse) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *UserDisableResponse) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *UserDisableResponse) SetMessage(v string) { - o.Message = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserDisableResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserDisableResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Message *string `json:"message,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Message = all.Message - return nil -} diff --git a/api/v1/datadog/model_user_list_response.go b/api/v1/datadog/model_user_list_response.go deleted file mode 100644 index 0213ff32c30..00000000000 --- a/api/v1/datadog/model_user_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserListResponse Array of Datadog users for a given organization. -type UserListResponse struct { - // Array of users. - Users []User `json:"users,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{} -} - -// NewUserListResponse instantiates a new UserListResponse 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 NewUserListResponse() *UserListResponse { - this := UserListResponse{} - return &this -} - -// NewUserListResponseWithDefaults instantiates a new UserListResponse 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 NewUserListResponseWithDefaults() *UserListResponse { - this := UserListResponse{} - return &this -} - -// GetUsers returns the Users field value if set, zero value otherwise. -func (o *UserListResponse) GetUsers() []User { - if o == nil || o.Users == nil { - var ret []User - return ret - } - return o.Users -} - -// GetUsersOk returns a tuple with the Users field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserListResponse) GetUsersOk() (*[]User, bool) { - if o == nil || o.Users == nil { - return nil, false - } - return &o.Users, true -} - -// HasUsers returns a boolean if a field has been set. -func (o *UserListResponse) HasUsers() bool { - if o != nil && o.Users != nil { - return true - } - - return false -} - -// SetUsers gets a reference to the given []User and assigns it to the Users field. -func (o *UserListResponse) SetUsers(v []User) { - o.Users = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Users != nil { - toSerialize["users"] = o.Users - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Users []User `json:"users,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Users = all.Users - return nil -} diff --git a/api/v1/datadog/model_user_response.go b/api/v1/datadog/model_user_response.go deleted file mode 100644 index 5badd8f8ed6..00000000000 --- a/api/v1/datadog/model_user_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserResponse A Datadog User. -type UserResponse struct { - // Create, edit, and disable users. - User *User `json:"user,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{} -} - -// NewUserResponse instantiates a new UserResponse 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 NewUserResponse() *UserResponse { - this := UserResponse{} - return &this -} - -// NewUserResponseWithDefaults instantiates a new UserResponse 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 NewUserResponseWithDefaults() *UserResponse { - this := UserResponse{} - return &this -} - -// GetUser returns the User field value if set, zero value otherwise. -func (o *UserResponse) GetUser() User { - if o == nil || o.User == nil { - var ret User - return ret - } - return *o.User -} - -// GetUserOk returns a tuple with the User field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserResponse) GetUserOk() (*User, bool) { - if o == nil || o.User == nil { - return nil, false - } - return o.User, true -} - -// HasUser returns a boolean if a field has been set. -func (o *UserResponse) HasUser() bool { - if o != nil && o.User != nil { - return true - } - - return false -} - -// SetUser gets a reference to the given User and assigns it to the User field. -func (o *UserResponse) SetUser(v User) { - o.User = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.User != nil { - toSerialize["user"] = o.User - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - User *User `json:"user,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.User = all.User - return nil -} diff --git a/api/v1/datadog/model_webhooks_integration.go b/api/v1/datadog/model_webhooks_integration.go deleted file mode 100644 index ab4e1928c85..00000000000 --- a/api/v1/datadog/model_webhooks_integration.go +++ /dev/null @@ -1,295 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// WebhooksIntegration Datadog-Webhooks integration. -type WebhooksIntegration struct { - // If `null`, uses no header. - // If given a JSON payload, these will be headers attached to your webhook. - CustomHeaders common.NullableString `json:"custom_headers,omitempty"` - // Encoding type. Can be given either `json` or `form`. - EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` - // The name of the webhook. It corresponds with ``. - // Learn more on how to use it in - // [monitor notifications](https://docs.datadoghq.com/monitors/notify). - Name string `json:"name"` - // If `null`, uses the default payload. - // If given a JSON payload, the webhook returns the payload - // specified by the given payload. - // [Webhooks variable usage](https://docs.datadoghq.com/integrations/webhooks/#usage). - Payload common.NullableString `json:"payload,omitempty"` - // URL of the webhook. - Url string `json:"url"` - // 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{} -} - -// NewWebhooksIntegration instantiates a new WebhooksIntegration 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 NewWebhooksIntegration(name string, url string) *WebhooksIntegration { - this := WebhooksIntegration{} - var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON - this.EncodeAs = &encodeAs - this.Name = name - this.Url = url - return &this -} - -// NewWebhooksIntegrationWithDefaults instantiates a new WebhooksIntegration 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 NewWebhooksIntegrationWithDefaults() *WebhooksIntegration { - this := WebhooksIntegration{} - var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON - this.EncodeAs = &encodeAs - return &this -} - -// GetCustomHeaders returns the CustomHeaders field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *WebhooksIntegration) GetCustomHeaders() string { - if o == nil || o.CustomHeaders.Get() == nil { - var ret string - return ret - } - return *o.CustomHeaders.Get() -} - -// GetCustomHeadersOk returns a tuple with the CustomHeaders 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 *WebhooksIntegration) GetCustomHeadersOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.CustomHeaders.Get(), o.CustomHeaders.IsSet() -} - -// HasCustomHeaders returns a boolean if a field has been set. -func (o *WebhooksIntegration) HasCustomHeaders() bool { - if o != nil && o.CustomHeaders.IsSet() { - return true - } - - return false -} - -// SetCustomHeaders gets a reference to the given common.NullableString and assigns it to the CustomHeaders field. -func (o *WebhooksIntegration) SetCustomHeaders(v string) { - o.CustomHeaders.Set(&v) -} - -// SetCustomHeadersNil sets the value for CustomHeaders to be an explicit nil. -func (o *WebhooksIntegration) SetCustomHeadersNil() { - o.CustomHeaders.Set(nil) -} - -// UnsetCustomHeaders ensures that no value is present for CustomHeaders, not even an explicit nil. -func (o *WebhooksIntegration) UnsetCustomHeaders() { - o.CustomHeaders.Unset() -} - -// GetEncodeAs returns the EncodeAs field value if set, zero value otherwise. -func (o *WebhooksIntegration) GetEncodeAs() WebhooksIntegrationEncoding { - if o == nil || o.EncodeAs == nil { - var ret WebhooksIntegrationEncoding - return ret - } - return *o.EncodeAs -} - -// GetEncodeAsOk returns a tuple with the EncodeAs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegration) GetEncodeAsOk() (*WebhooksIntegrationEncoding, bool) { - if o == nil || o.EncodeAs == nil { - return nil, false - } - return o.EncodeAs, true -} - -// HasEncodeAs returns a boolean if a field has been set. -func (o *WebhooksIntegration) HasEncodeAs() bool { - if o != nil && o.EncodeAs != nil { - return true - } - - return false -} - -// SetEncodeAs gets a reference to the given WebhooksIntegrationEncoding and assigns it to the EncodeAs field. -func (o *WebhooksIntegration) SetEncodeAs(v WebhooksIntegrationEncoding) { - o.EncodeAs = &v -} - -// GetName returns the Name field value. -func (o *WebhooksIntegration) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *WebhooksIntegration) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *WebhooksIntegration) SetName(v string) { - o.Name = v -} - -// GetPayload returns the Payload field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *WebhooksIntegration) GetPayload() string { - if o == nil || o.Payload.Get() == nil { - var ret string - return ret - } - return *o.Payload.Get() -} - -// GetPayloadOk returns a tuple with the Payload 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 *WebhooksIntegration) GetPayloadOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Payload.Get(), o.Payload.IsSet() -} - -// HasPayload returns a boolean if a field has been set. -func (o *WebhooksIntegration) HasPayload() bool { - if o != nil && o.Payload.IsSet() { - return true - } - - return false -} - -// SetPayload gets a reference to the given common.NullableString and assigns it to the Payload field. -func (o *WebhooksIntegration) SetPayload(v string) { - o.Payload.Set(&v) -} - -// SetPayloadNil sets the value for Payload to be an explicit nil. -func (o *WebhooksIntegration) SetPayloadNil() { - o.Payload.Set(nil) -} - -// UnsetPayload ensures that no value is present for Payload, not even an explicit nil. -func (o *WebhooksIntegration) UnsetPayload() { - o.Payload.Unset() -} - -// GetUrl returns the Url field value. -func (o *WebhooksIntegration) GetUrl() string { - if o == nil { - var ret string - return ret - } - return o.Url -} - -// GetUrlOk returns a tuple with the Url field value -// and a boolean to check if the value has been set. -func (o *WebhooksIntegration) GetUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Url, true -} - -// SetUrl sets field value. -func (o *WebhooksIntegration) SetUrl(v string) { - o.Url = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WebhooksIntegration) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomHeaders.IsSet() { - toSerialize["custom_headers"] = o.CustomHeaders.Get() - } - if o.EncodeAs != nil { - toSerialize["encode_as"] = o.EncodeAs - } - toSerialize["name"] = o.Name - if o.Payload.IsSet() { - toSerialize["payload"] = o.Payload.Get() - } - toSerialize["url"] = o.Url - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Url *string `json:"url"` - }{} - all := struct { - CustomHeaders common.NullableString `json:"custom_headers,omitempty"` - EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` - Name string `json:"name"` - Payload common.NullableString `json:"payload,omitempty"` - Url string `json:"url"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Url == nil { - return fmt.Errorf("Required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EncodeAs; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomHeaders = all.CustomHeaders - o.EncodeAs = all.EncodeAs - o.Name = all.Name - o.Payload = all.Payload - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_webhooks_integration_custom_variable.go b/api/v1/datadog/model_webhooks_integration_custom_variable.go deleted file mode 100644 index 9ae97cabbee..00000000000 --- a/api/v1/datadog/model_webhooks_integration_custom_variable.go +++ /dev/null @@ -1,170 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WebhooksIntegrationCustomVariable Custom variable for Webhook integration. -type WebhooksIntegrationCustomVariable struct { - // Make custom variable is secret or not. - // If the custom variable is secret, the value is not returned in the response payload. - IsSecret bool `json:"is_secret"` - // The name of the variable. It corresponds with ``. - Name string `json:"name"` - // Value of the custom variable. - Value string `json:"value"` - // 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{} -} - -// NewWebhooksIntegrationCustomVariable instantiates a new WebhooksIntegrationCustomVariable 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 NewWebhooksIntegrationCustomVariable(isSecret bool, name string, value string) *WebhooksIntegrationCustomVariable { - this := WebhooksIntegrationCustomVariable{} - this.IsSecret = isSecret - this.Name = name - this.Value = value - return &this -} - -// NewWebhooksIntegrationCustomVariableWithDefaults instantiates a new WebhooksIntegrationCustomVariable 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 NewWebhooksIntegrationCustomVariableWithDefaults() *WebhooksIntegrationCustomVariable { - this := WebhooksIntegrationCustomVariable{} - return &this -} - -// GetIsSecret returns the IsSecret field value. -func (o *WebhooksIntegrationCustomVariable) GetIsSecret() bool { - if o == nil { - var ret bool - return ret - } - return o.IsSecret -} - -// GetIsSecretOk returns a tuple with the IsSecret field value -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariable) GetIsSecretOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.IsSecret, true -} - -// SetIsSecret sets field value. -func (o *WebhooksIntegrationCustomVariable) SetIsSecret(v bool) { - o.IsSecret = v -} - -// GetName returns the Name field value. -func (o *WebhooksIntegrationCustomVariable) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariable) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *WebhooksIntegrationCustomVariable) SetName(v string) { - o.Name = v -} - -// GetValue returns the Value field value. -func (o *WebhooksIntegrationCustomVariable) GetValue() string { - if o == nil { - var ret string - return ret - } - return o.Value -} - -// GetValueOk returns a tuple with the Value field value -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariable) GetValueOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Value, true -} - -// SetValue sets field value. -func (o *WebhooksIntegrationCustomVariable) SetValue(v string) { - o.Value = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WebhooksIntegrationCustomVariable) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["is_secret"] = o.IsSecret - toSerialize["name"] = o.Name - toSerialize["value"] = o.Value - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WebhooksIntegrationCustomVariable) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - IsSecret *bool `json:"is_secret"` - Name *string `json:"name"` - Value *string `json:"value"` - }{} - all := struct { - IsSecret bool `json:"is_secret"` - Name string `json:"name"` - Value string `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IsSecret == nil { - return fmt.Errorf("Required field is_secret missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Value == nil { - return fmt.Errorf("Required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsSecret = all.IsSecret - o.Name = all.Name - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_webhooks_integration_custom_variable_response.go b/api/v1/datadog/model_webhooks_integration_custom_variable_response.go deleted file mode 100644 index 8c40ce5da5e..00000000000 --- a/api/v1/datadog/model_webhooks_integration_custom_variable_response.go +++ /dev/null @@ -1,176 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WebhooksIntegrationCustomVariableResponse Custom variable for Webhook integration. -type WebhooksIntegrationCustomVariableResponse struct { - // Make custom variable is secret or not. - // If the custom variable is secret, the value is not returned in the response payload. - IsSecret bool `json:"is_secret"` - // The name of the variable. It corresponds with ``. It must only contains upper-case characters, integers or underscores. - Name string `json:"name"` - // Value of the custom variable. It won't be returned if the variable is secret. - Value *string `json:"value,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{} -} - -// NewWebhooksIntegrationCustomVariableResponse instantiates a new WebhooksIntegrationCustomVariableResponse 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 NewWebhooksIntegrationCustomVariableResponse(isSecret bool, name string) *WebhooksIntegrationCustomVariableResponse { - this := WebhooksIntegrationCustomVariableResponse{} - this.IsSecret = isSecret - this.Name = name - return &this -} - -// NewWebhooksIntegrationCustomVariableResponseWithDefaults instantiates a new WebhooksIntegrationCustomVariableResponse 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 NewWebhooksIntegrationCustomVariableResponseWithDefaults() *WebhooksIntegrationCustomVariableResponse { - this := WebhooksIntegrationCustomVariableResponse{} - return &this -} - -// GetIsSecret returns the IsSecret field value. -func (o *WebhooksIntegrationCustomVariableResponse) GetIsSecret() bool { - if o == nil { - var ret bool - return ret - } - return o.IsSecret -} - -// GetIsSecretOk returns a tuple with the IsSecret field value -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariableResponse) GetIsSecretOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.IsSecret, true -} - -// SetIsSecret sets field value. -func (o *WebhooksIntegrationCustomVariableResponse) SetIsSecret(v bool) { - o.IsSecret = v -} - -// GetName returns the Name field value. -func (o *WebhooksIntegrationCustomVariableResponse) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariableResponse) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *WebhooksIntegrationCustomVariableResponse) SetName(v string) { - o.Name = v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *WebhooksIntegrationCustomVariableResponse) GetValue() string { - if o == nil || o.Value == nil { - var ret string - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariableResponse) GetValueOk() (*string, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *WebhooksIntegrationCustomVariableResponse) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given string and assigns it to the Value field. -func (o *WebhooksIntegrationCustomVariableResponse) SetValue(v string) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WebhooksIntegrationCustomVariableResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["is_secret"] = o.IsSecret - toSerialize["name"] = o.Name - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WebhooksIntegrationCustomVariableResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - IsSecret *bool `json:"is_secret"` - Name *string `json:"name"` - }{} - all := struct { - IsSecret bool `json:"is_secret"` - Name string `json:"name"` - Value *string `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IsSecret == nil { - return fmt.Errorf("Required field is_secret missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsSecret = all.IsSecret - o.Name = all.Name - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go b/api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go deleted file mode 100644 index 4038f967f23..00000000000 --- a/api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go +++ /dev/null @@ -1,183 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WebhooksIntegrationCustomVariableUpdateRequest Update request of a custom variable object. -// -// *All properties are optional.* -type WebhooksIntegrationCustomVariableUpdateRequest struct { - // Make custom variable is secret or not. - // If the custom variable is secret, the value is not returned in the response payload. - IsSecret *bool `json:"is_secret,omitempty"` - // The name of the variable. It corresponds with ``. It must only contains upper-case characters, integers or underscores. - Name *string `json:"name,omitempty"` - // Value of the custom variable. - Value *string `json:"value,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{} -} - -// NewWebhooksIntegrationCustomVariableUpdateRequest instantiates a new WebhooksIntegrationCustomVariableUpdateRequest 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 NewWebhooksIntegrationCustomVariableUpdateRequest() *WebhooksIntegrationCustomVariableUpdateRequest { - this := WebhooksIntegrationCustomVariableUpdateRequest{} - return &this -} - -// NewWebhooksIntegrationCustomVariableUpdateRequestWithDefaults instantiates a new WebhooksIntegrationCustomVariableUpdateRequest 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 NewWebhooksIntegrationCustomVariableUpdateRequestWithDefaults() *WebhooksIntegrationCustomVariableUpdateRequest { - this := WebhooksIntegrationCustomVariableUpdateRequest{} - return &this -} - -// GetIsSecret returns the IsSecret field value if set, zero value otherwise. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetIsSecret() bool { - if o == nil || o.IsSecret == nil { - var ret bool - return ret - } - return *o.IsSecret -} - -// GetIsSecretOk returns a tuple with the IsSecret field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetIsSecretOk() (*bool, bool) { - if o == nil || o.IsSecret == nil { - return nil, false - } - return o.IsSecret, true -} - -// HasIsSecret returns a boolean if a field has been set. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) HasIsSecret() bool { - if o != nil && o.IsSecret != nil { - return true - } - - return false -} - -// SetIsSecret gets a reference to the given bool and assigns it to the IsSecret field. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) SetIsSecret(v bool) { - o.IsSecret = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) SetName(v string) { - o.Name = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetValue() string { - if o == nil || o.Value == nil { - var ret string - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetValueOk() (*string, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given string and assigns it to the Value field. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) SetValue(v string) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WebhooksIntegrationCustomVariableUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsSecret != nil { - toSerialize["is_secret"] = o.IsSecret - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WebhooksIntegrationCustomVariableUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IsSecret *bool `json:"is_secret,omitempty"` - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsSecret = all.IsSecret - o.Name = all.Name - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_webhooks_integration_encoding.go b/api/v1/datadog/model_webhooks_integration_encoding.go deleted file mode 100644 index d99160e2236..00000000000 --- a/api/v1/datadog/model_webhooks_integration_encoding.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WebhooksIntegrationEncoding Encoding type. Can be given either `json` or `form`. -type WebhooksIntegrationEncoding string - -// List of WebhooksIntegrationEncoding. -const ( - WEBHOOKSINTEGRATIONENCODING_JSON WebhooksIntegrationEncoding = "json" - WEBHOOKSINTEGRATIONENCODING_FORM WebhooksIntegrationEncoding = "form" -) - -var allowedWebhooksIntegrationEncodingEnumValues = []WebhooksIntegrationEncoding{ - WEBHOOKSINTEGRATIONENCODING_JSON, - WEBHOOKSINTEGRATIONENCODING_FORM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WebhooksIntegrationEncoding) GetAllowedValues() []WebhooksIntegrationEncoding { - return allowedWebhooksIntegrationEncodingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WebhooksIntegrationEncoding) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WebhooksIntegrationEncoding(value) - return nil -} - -// NewWebhooksIntegrationEncodingFromValue returns a pointer to a valid WebhooksIntegrationEncoding -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWebhooksIntegrationEncodingFromValue(v string) (*WebhooksIntegrationEncoding, error) { - ev := WebhooksIntegrationEncoding(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WebhooksIntegrationEncoding: valid values are %v", v, allowedWebhooksIntegrationEncodingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WebhooksIntegrationEncoding) IsValid() bool { - for _, existing := range allowedWebhooksIntegrationEncodingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WebhooksIntegrationEncoding value. -func (v WebhooksIntegrationEncoding) Ptr() *WebhooksIntegrationEncoding { - return &v -} - -// NullableWebhooksIntegrationEncoding handles when a null is used for WebhooksIntegrationEncoding. -type NullableWebhooksIntegrationEncoding struct { - value *WebhooksIntegrationEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableWebhooksIntegrationEncoding) Get() *WebhooksIntegrationEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWebhooksIntegrationEncoding) Set(val *WebhooksIntegrationEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWebhooksIntegrationEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWebhooksIntegrationEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWebhooksIntegrationEncoding initializes the struct as if Set has been called. -func NewNullableWebhooksIntegrationEncoding(val *WebhooksIntegrationEncoding) *NullableWebhooksIntegrationEncoding { - return &NullableWebhooksIntegrationEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWebhooksIntegrationEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWebhooksIntegrationEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_webhooks_integration_update_request.go b/api/v1/datadog/model_webhooks_integration_update_request.go deleted file mode 100644 index 642592c00ba..00000000000 --- a/api/v1/datadog/model_webhooks_integration_update_request.go +++ /dev/null @@ -1,291 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// WebhooksIntegrationUpdateRequest Update request of a Webhooks integration object. -// -// *All properties are optional.* -type WebhooksIntegrationUpdateRequest struct { - // If `null`, uses no header. - // If given a JSON payload, these will be headers attached to your webhook. - CustomHeaders *string `json:"custom_headers,omitempty"` - // Encoding type. Can be given either `json` or `form`. - EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` - // The name of the webhook. It corresponds with ``. - // Learn more on how to use it in - // [monitor notifications](https://docs.datadoghq.com/monitors/notify). - Name *string `json:"name,omitempty"` - // If `null`, uses the default payload. - // If given a JSON payload, the webhook returns the payload - // specified by the given payload. - // [Webhooks variable usage](https://docs.datadoghq.com/integrations/webhooks/#usage). - Payload common.NullableString `json:"payload,omitempty"` - // URL of the webhook. - Url *string `json:"url,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{} -} - -// NewWebhooksIntegrationUpdateRequest instantiates a new WebhooksIntegrationUpdateRequest 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 NewWebhooksIntegrationUpdateRequest() *WebhooksIntegrationUpdateRequest { - this := WebhooksIntegrationUpdateRequest{} - var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON - this.EncodeAs = &encodeAs - return &this -} - -// NewWebhooksIntegrationUpdateRequestWithDefaults instantiates a new WebhooksIntegrationUpdateRequest 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 NewWebhooksIntegrationUpdateRequestWithDefaults() *WebhooksIntegrationUpdateRequest { - this := WebhooksIntegrationUpdateRequest{} - var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON - this.EncodeAs = &encodeAs - return &this -} - -// GetCustomHeaders returns the CustomHeaders field value if set, zero value otherwise. -func (o *WebhooksIntegrationUpdateRequest) GetCustomHeaders() string { - if o == nil || o.CustomHeaders == nil { - var ret string - return ret - } - return *o.CustomHeaders -} - -// GetCustomHeadersOk returns a tuple with the CustomHeaders field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationUpdateRequest) GetCustomHeadersOk() (*string, bool) { - if o == nil || o.CustomHeaders == nil { - return nil, false - } - return o.CustomHeaders, true -} - -// HasCustomHeaders returns a boolean if a field has been set. -func (o *WebhooksIntegrationUpdateRequest) HasCustomHeaders() bool { - if o != nil && o.CustomHeaders != nil { - return true - } - - return false -} - -// SetCustomHeaders gets a reference to the given string and assigns it to the CustomHeaders field. -func (o *WebhooksIntegrationUpdateRequest) SetCustomHeaders(v string) { - o.CustomHeaders = &v -} - -// GetEncodeAs returns the EncodeAs field value if set, zero value otherwise. -func (o *WebhooksIntegrationUpdateRequest) GetEncodeAs() WebhooksIntegrationEncoding { - if o == nil || o.EncodeAs == nil { - var ret WebhooksIntegrationEncoding - return ret - } - return *o.EncodeAs -} - -// GetEncodeAsOk returns a tuple with the EncodeAs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationUpdateRequest) GetEncodeAsOk() (*WebhooksIntegrationEncoding, bool) { - if o == nil || o.EncodeAs == nil { - return nil, false - } - return o.EncodeAs, true -} - -// HasEncodeAs returns a boolean if a field has been set. -func (o *WebhooksIntegrationUpdateRequest) HasEncodeAs() bool { - if o != nil && o.EncodeAs != nil { - return true - } - - return false -} - -// SetEncodeAs gets a reference to the given WebhooksIntegrationEncoding and assigns it to the EncodeAs field. -func (o *WebhooksIntegrationUpdateRequest) SetEncodeAs(v WebhooksIntegrationEncoding) { - o.EncodeAs = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *WebhooksIntegrationUpdateRequest) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationUpdateRequest) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *WebhooksIntegrationUpdateRequest) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *WebhooksIntegrationUpdateRequest) SetName(v string) { - o.Name = &v -} - -// GetPayload returns the Payload field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *WebhooksIntegrationUpdateRequest) GetPayload() string { - if o == nil || o.Payload.Get() == nil { - var ret string - return ret - } - return *o.Payload.Get() -} - -// GetPayloadOk returns a tuple with the Payload 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 *WebhooksIntegrationUpdateRequest) GetPayloadOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Payload.Get(), o.Payload.IsSet() -} - -// HasPayload returns a boolean if a field has been set. -func (o *WebhooksIntegrationUpdateRequest) HasPayload() bool { - if o != nil && o.Payload.IsSet() { - return true - } - - return false -} - -// SetPayload gets a reference to the given common.NullableString and assigns it to the Payload field. -func (o *WebhooksIntegrationUpdateRequest) SetPayload(v string) { - o.Payload.Set(&v) -} - -// SetPayloadNil sets the value for Payload to be an explicit nil. -func (o *WebhooksIntegrationUpdateRequest) SetPayloadNil() { - o.Payload.Set(nil) -} - -// UnsetPayload ensures that no value is present for Payload, not even an explicit nil. -func (o *WebhooksIntegrationUpdateRequest) UnsetPayload() { - o.Payload.Unset() -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *WebhooksIntegrationUpdateRequest) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WebhooksIntegrationUpdateRequest) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *WebhooksIntegrationUpdateRequest) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *WebhooksIntegrationUpdateRequest) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WebhooksIntegrationUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomHeaders != nil { - toSerialize["custom_headers"] = o.CustomHeaders - } - if o.EncodeAs != nil { - toSerialize["encode_as"] = o.EncodeAs - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Payload.IsSet() { - toSerialize["payload"] = o.Payload.Get() - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WebhooksIntegrationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CustomHeaders *string `json:"custom_headers,omitempty"` - EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` - Name *string `json:"name,omitempty"` - Payload common.NullableString `json:"payload,omitempty"` - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EncodeAs; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomHeaders = all.CustomHeaders - o.EncodeAs = all.EncodeAs - o.Name = all.Name - o.Payload = all.Payload - o.Url = all.Url - return nil -} diff --git a/api/v1/datadog/model_widget.go b/api/v1/datadog/model_widget.go deleted file mode 100644 index 0fe86daef55..00000000000 --- a/api/v1/datadog/model_widget.go +++ /dev/null @@ -1,193 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// Widget Information about widget. -// -// **Note**: The `layout` property is required for widgets in dashboards with `free` `layout_type`. -// For the **new dashboard layout**, the `layout` property depends on the `reflow_type` of the dashboard. -// - If `reflow_type` is `fixed`, `layout` is required. -// - If `reflow_type` is `auto`, `layout` should not be set. -type Widget struct { - // [Definition of the widget](https://docs.datadoghq.com/dashboards/widgets/). - Definition WidgetDefinition `json:"definition"` - // ID of the widget. - Id *int64 `json:"id,omitempty"` - // The layout for a widget on a `free` or **new dashboard layout** dashboard. - Layout *WidgetLayout `json:"layout,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{} -} - -// NewWidget instantiates a new Widget 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 NewWidget(definition WidgetDefinition) *Widget { - this := Widget{} - this.Definition = definition - return &this -} - -// NewWidgetWithDefaults instantiates a new Widget 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 NewWidgetWithDefaults() *Widget { - this := Widget{} - return &this -} - -// GetDefinition returns the Definition field value. -func (o *Widget) GetDefinition() WidgetDefinition { - if o == nil { - var ret WidgetDefinition - return ret - } - return o.Definition -} - -// GetDefinitionOk returns a tuple with the Definition field value -// and a boolean to check if the value has been set. -func (o *Widget) GetDefinitionOk() (*WidgetDefinition, bool) { - if o == nil { - return nil, false - } - return &o.Definition, true -} - -// SetDefinition sets field value. -func (o *Widget) SetDefinition(v WidgetDefinition) { - o.Definition = v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Widget) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Widget) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Widget) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *Widget) SetId(v int64) { - o.Id = &v -} - -// GetLayout returns the Layout field value if set, zero value otherwise. -func (o *Widget) GetLayout() WidgetLayout { - if o == nil || o.Layout == nil { - var ret WidgetLayout - return ret - } - return *o.Layout -} - -// GetLayoutOk returns a tuple with the Layout field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Widget) GetLayoutOk() (*WidgetLayout, bool) { - if o == nil || o.Layout == nil { - return nil, false - } - return o.Layout, true -} - -// HasLayout returns a boolean if a field has been set. -func (o *Widget) HasLayout() bool { - if o != nil && o.Layout != nil { - return true - } - - return false -} - -// SetLayout gets a reference to the given WidgetLayout and assigns it to the Layout field. -func (o *Widget) SetLayout(v WidgetLayout) { - o.Layout = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Widget) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["definition"] = o.Definition - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Layout != nil { - toSerialize["layout"] = o.Layout - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Widget) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Definition *WidgetDefinition `json:"definition"` - }{} - all := struct { - Definition WidgetDefinition `json:"definition"` - Id *int64 `json:"id,omitempty"` - Layout *WidgetLayout `json:"layout,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("Required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Definition = all.Definition - o.Id = all.Id - if all.Layout != nil && all.Layout.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Layout = all.Layout - return nil -} diff --git a/api/v1/datadog/model_widget_aggregator.go b/api/v1/datadog/model_widget_aggregator.go deleted file mode 100644 index 1b6d5d89b95..00000000000 --- a/api/v1/datadog/model_widget_aggregator.go +++ /dev/null @@ -1,117 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetAggregator Aggregator used for the request. -type WidgetAggregator string - -// List of WidgetAggregator. -const ( - WIDGETAGGREGATOR_AVERAGE WidgetAggregator = "avg" - WIDGETAGGREGATOR_LAST WidgetAggregator = "last" - WIDGETAGGREGATOR_MAXIMUM WidgetAggregator = "max" - WIDGETAGGREGATOR_MINIMUM WidgetAggregator = "min" - WIDGETAGGREGATOR_SUM WidgetAggregator = "sum" - WIDGETAGGREGATOR_PERCENTILE WidgetAggregator = "percentile" -) - -var allowedWidgetAggregatorEnumValues = []WidgetAggregator{ - WIDGETAGGREGATOR_AVERAGE, - WIDGETAGGREGATOR_LAST, - WIDGETAGGREGATOR_MAXIMUM, - WIDGETAGGREGATOR_MINIMUM, - WIDGETAGGREGATOR_SUM, - WIDGETAGGREGATOR_PERCENTILE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetAggregator) GetAllowedValues() []WidgetAggregator { - return allowedWidgetAggregatorEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetAggregator) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetAggregator(value) - return nil -} - -// NewWidgetAggregatorFromValue returns a pointer to a valid WidgetAggregator -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetAggregatorFromValue(v string) (*WidgetAggregator, error) { - ev := WidgetAggregator(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetAggregator: valid values are %v", v, allowedWidgetAggregatorEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetAggregator) IsValid() bool { - for _, existing := range allowedWidgetAggregatorEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetAggregator value. -func (v WidgetAggregator) Ptr() *WidgetAggregator { - return &v -} - -// NullableWidgetAggregator handles when a null is used for WidgetAggregator. -type NullableWidgetAggregator struct { - value *WidgetAggregator - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetAggregator) Get() *WidgetAggregator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetAggregator) Set(val *WidgetAggregator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetAggregator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetAggregator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetAggregator initializes the struct as if Set has been called. -func NewNullableWidgetAggregator(val *WidgetAggregator) *NullableWidgetAggregator { - return &NullableWidgetAggregator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetAggregator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetAggregator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_axis.go b/api/v1/datadog/model_widget_axis.go deleted file mode 100644 index ee59c9abd16..00000000000 --- a/api/v1/datadog/model_widget_axis.go +++ /dev/null @@ -1,270 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WidgetAxis Axis controls for the widget. -type WidgetAxis struct { - // True includes zero. - IncludeZero *bool `json:"include_zero,omitempty"` - // The label of the axis to display on the graph. - Label *string `json:"label,omitempty"` - // Specifies the maximum value to show on the y-axis. It takes a number, or auto for default behavior. - Max *string `json:"max,omitempty"` - // Specifies minimum value to show on the y-axis. It takes a number, or auto for default behavior. - Min *string `json:"min,omitempty"` - // Specifies the scale type. Possible values are `linear`, `log`, `sqrt`, `pow##` (for example `pow2`, `pow0.5` etc.). - Scale *string `json:"scale,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{} -} - -// NewWidgetAxis instantiates a new WidgetAxis 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 NewWidgetAxis() *WidgetAxis { - this := WidgetAxis{} - var max string = "auto" - this.Max = &max - var min string = "auto" - this.Min = &min - var scale string = "linear" - this.Scale = &scale - return &this -} - -// NewWidgetAxisWithDefaults instantiates a new WidgetAxis 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 NewWidgetAxisWithDefaults() *WidgetAxis { - this := WidgetAxis{} - var max string = "auto" - this.Max = &max - var min string = "auto" - this.Min = &min - var scale string = "linear" - this.Scale = &scale - return &this -} - -// GetIncludeZero returns the IncludeZero field value if set, zero value otherwise. -func (o *WidgetAxis) GetIncludeZero() bool { - if o == nil || o.IncludeZero == nil { - var ret bool - return ret - } - return *o.IncludeZero -} - -// GetIncludeZeroOk returns a tuple with the IncludeZero field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetAxis) GetIncludeZeroOk() (*bool, bool) { - if o == nil || o.IncludeZero == nil { - return nil, false - } - return o.IncludeZero, true -} - -// HasIncludeZero returns a boolean if a field has been set. -func (o *WidgetAxis) HasIncludeZero() bool { - if o != nil && o.IncludeZero != nil { - return true - } - - return false -} - -// SetIncludeZero gets a reference to the given bool and assigns it to the IncludeZero field. -func (o *WidgetAxis) SetIncludeZero(v bool) { - o.IncludeZero = &v -} - -// GetLabel returns the Label field value if set, zero value otherwise. -func (o *WidgetAxis) GetLabel() string { - if o == nil || o.Label == nil { - var ret string - return ret - } - return *o.Label -} - -// GetLabelOk returns a tuple with the Label field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetAxis) GetLabelOk() (*string, bool) { - if o == nil || o.Label == nil { - return nil, false - } - return o.Label, true -} - -// HasLabel returns a boolean if a field has been set. -func (o *WidgetAxis) HasLabel() bool { - if o != nil && o.Label != nil { - return true - } - - return false -} - -// SetLabel gets a reference to the given string and assigns it to the Label field. -func (o *WidgetAxis) SetLabel(v string) { - o.Label = &v -} - -// GetMax returns the Max field value if set, zero value otherwise. -func (o *WidgetAxis) GetMax() string { - if o == nil || o.Max == nil { - var ret string - return ret - } - return *o.Max -} - -// GetMaxOk returns a tuple with the Max field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetAxis) GetMaxOk() (*string, bool) { - if o == nil || o.Max == nil { - return nil, false - } - return o.Max, true -} - -// HasMax returns a boolean if a field has been set. -func (o *WidgetAxis) HasMax() bool { - if o != nil && o.Max != nil { - return true - } - - return false -} - -// SetMax gets a reference to the given string and assigns it to the Max field. -func (o *WidgetAxis) SetMax(v string) { - o.Max = &v -} - -// GetMin returns the Min field value if set, zero value otherwise. -func (o *WidgetAxis) GetMin() string { - if o == nil || o.Min == nil { - var ret string - return ret - } - return *o.Min -} - -// GetMinOk returns a tuple with the Min field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetAxis) GetMinOk() (*string, bool) { - if o == nil || o.Min == nil { - return nil, false - } - return o.Min, true -} - -// HasMin returns a boolean if a field has been set. -func (o *WidgetAxis) HasMin() bool { - if o != nil && o.Min != nil { - return true - } - - return false -} - -// SetMin gets a reference to the given string and assigns it to the Min field. -func (o *WidgetAxis) SetMin(v string) { - o.Min = &v -} - -// GetScale returns the Scale field value if set, zero value otherwise. -func (o *WidgetAxis) GetScale() string { - if o == nil || o.Scale == nil { - var ret string - return ret - } - return *o.Scale -} - -// GetScaleOk returns a tuple with the Scale field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetAxis) GetScaleOk() (*string, bool) { - if o == nil || o.Scale == nil { - return nil, false - } - return o.Scale, true -} - -// HasScale returns a boolean if a field has been set. -func (o *WidgetAxis) HasScale() bool { - if o != nil && o.Scale != nil { - return true - } - - return false -} - -// SetScale gets a reference to the given string and assigns it to the Scale field. -func (o *WidgetAxis) SetScale(v string) { - o.Scale = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetAxis) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IncludeZero != nil { - toSerialize["include_zero"] = o.IncludeZero - } - if o.Label != nil { - toSerialize["label"] = o.Label - } - if o.Max != nil { - toSerialize["max"] = o.Max - } - if o.Min != nil { - toSerialize["min"] = o.Min - } - if o.Scale != nil { - toSerialize["scale"] = o.Scale - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetAxis) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IncludeZero *bool `json:"include_zero,omitempty"` - Label *string `json:"label,omitempty"` - Max *string `json:"max,omitempty"` - Min *string `json:"min,omitempty"` - Scale *string `json:"scale,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IncludeZero = all.IncludeZero - o.Label = all.Label - o.Max = all.Max - o.Min = all.Min - o.Scale = all.Scale - return nil -} diff --git a/api/v1/datadog/model_widget_change_type.go b/api/v1/datadog/model_widget_change_type.go deleted file mode 100644 index b51dad151e4..00000000000 --- a/api/v1/datadog/model_widget_change_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetChangeType Show the absolute or the relative change. -type WidgetChangeType string - -// List of WidgetChangeType. -const ( - WIDGETCHANGETYPE_ABSOLUTE WidgetChangeType = "absolute" - WIDGETCHANGETYPE_RELATIVE WidgetChangeType = "relative" -) - -var allowedWidgetChangeTypeEnumValues = []WidgetChangeType{ - WIDGETCHANGETYPE_ABSOLUTE, - WIDGETCHANGETYPE_RELATIVE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetChangeType) GetAllowedValues() []WidgetChangeType { - return allowedWidgetChangeTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetChangeType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetChangeType(value) - return nil -} - -// NewWidgetChangeTypeFromValue returns a pointer to a valid WidgetChangeType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetChangeTypeFromValue(v string) (*WidgetChangeType, error) { - ev := WidgetChangeType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetChangeType: valid values are %v", v, allowedWidgetChangeTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetChangeType) IsValid() bool { - for _, existing := range allowedWidgetChangeTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetChangeType value. -func (v WidgetChangeType) Ptr() *WidgetChangeType { - return &v -} - -// NullableWidgetChangeType handles when a null is used for WidgetChangeType. -type NullableWidgetChangeType struct { - value *WidgetChangeType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetChangeType) Get() *WidgetChangeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetChangeType) Set(val *WidgetChangeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetChangeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetChangeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetChangeType initializes the struct as if Set has been called. -func NewNullableWidgetChangeType(val *WidgetChangeType) *NullableWidgetChangeType { - return &NullableWidgetChangeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetChangeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetChangeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_color_preference.go b/api/v1/datadog/model_widget_color_preference.go deleted file mode 100644 index 353510e0bfe..00000000000 --- a/api/v1/datadog/model_widget_color_preference.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetColorPreference Which color to use on the widget. -type WidgetColorPreference string - -// List of WidgetColorPreference. -const ( - WIDGETCOLORPREFERENCE_BACKGROUND WidgetColorPreference = "background" - WIDGETCOLORPREFERENCE_TEXT WidgetColorPreference = "text" -) - -var allowedWidgetColorPreferenceEnumValues = []WidgetColorPreference{ - WIDGETCOLORPREFERENCE_BACKGROUND, - WIDGETCOLORPREFERENCE_TEXT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetColorPreference) GetAllowedValues() []WidgetColorPreference { - return allowedWidgetColorPreferenceEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetColorPreference) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetColorPreference(value) - return nil -} - -// NewWidgetColorPreferenceFromValue returns a pointer to a valid WidgetColorPreference -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetColorPreferenceFromValue(v string) (*WidgetColorPreference, error) { - ev := WidgetColorPreference(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetColorPreference: valid values are %v", v, allowedWidgetColorPreferenceEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetColorPreference) IsValid() bool { - for _, existing := range allowedWidgetColorPreferenceEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetColorPreference value. -func (v WidgetColorPreference) Ptr() *WidgetColorPreference { - return &v -} - -// NullableWidgetColorPreference handles when a null is used for WidgetColorPreference. -type NullableWidgetColorPreference struct { - value *WidgetColorPreference - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetColorPreference) Get() *WidgetColorPreference { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetColorPreference) Set(val *WidgetColorPreference) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetColorPreference) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetColorPreference) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetColorPreference initializes the struct as if Set has been called. -func NewNullableWidgetColorPreference(val *WidgetColorPreference) *NullableWidgetColorPreference { - return &NullableWidgetColorPreference{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetColorPreference) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetColorPreference) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_comparator.go b/api/v1/datadog/model_widget_comparator.go deleted file mode 100644 index cc0510e1aae..00000000000 --- a/api/v1/datadog/model_widget_comparator.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetComparator Comparator to apply. -type WidgetComparator string - -// List of WidgetComparator. -const ( - WIDGETCOMPARATOR_GREATER_THAN WidgetComparator = ">" - WIDGETCOMPARATOR_GREATER_THAN_OR_EQUAL_TO WidgetComparator = ">=" - WIDGETCOMPARATOR_LESS_THAN WidgetComparator = "<" - WIDGETCOMPARATOR_LESS_THAN_OR_EQUAL_TO WidgetComparator = "<=" -) - -var allowedWidgetComparatorEnumValues = []WidgetComparator{ - WIDGETCOMPARATOR_GREATER_THAN, - WIDGETCOMPARATOR_GREATER_THAN_OR_EQUAL_TO, - WIDGETCOMPARATOR_LESS_THAN, - WIDGETCOMPARATOR_LESS_THAN_OR_EQUAL_TO, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetComparator) GetAllowedValues() []WidgetComparator { - return allowedWidgetComparatorEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetComparator) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetComparator(value) - return nil -} - -// NewWidgetComparatorFromValue returns a pointer to a valid WidgetComparator -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetComparatorFromValue(v string) (*WidgetComparator, error) { - ev := WidgetComparator(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetComparator: valid values are %v", v, allowedWidgetComparatorEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetComparator) IsValid() bool { - for _, existing := range allowedWidgetComparatorEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetComparator value. -func (v WidgetComparator) Ptr() *WidgetComparator { - return &v -} - -// NullableWidgetComparator handles when a null is used for WidgetComparator. -type NullableWidgetComparator struct { - value *WidgetComparator - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetComparator) Get() *WidgetComparator { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetComparator) Set(val *WidgetComparator) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetComparator) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetComparator) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetComparator initializes the struct as if Set has been called. -func NewNullableWidgetComparator(val *WidgetComparator) *NullableWidgetComparator { - return &NullableWidgetComparator{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetComparator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetComparator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_compare_to.go b/api/v1/datadog/model_widget_compare_to.go deleted file mode 100644 index 68613bbf674..00000000000 --- a/api/v1/datadog/model_widget_compare_to.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetCompareTo Timeframe used for the change comparison. -type WidgetCompareTo string - -// List of WidgetCompareTo. -const ( - WIDGETCOMPARETO_HOUR_BEFORE WidgetCompareTo = "hour_before" - WIDGETCOMPARETO_DAY_BEFORE WidgetCompareTo = "day_before" - WIDGETCOMPARETO_WEEK_BEFORE WidgetCompareTo = "week_before" - WIDGETCOMPARETO_MONTH_BEFORE WidgetCompareTo = "month_before" -) - -var allowedWidgetCompareToEnumValues = []WidgetCompareTo{ - WIDGETCOMPARETO_HOUR_BEFORE, - WIDGETCOMPARETO_DAY_BEFORE, - WIDGETCOMPARETO_WEEK_BEFORE, - WIDGETCOMPARETO_MONTH_BEFORE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetCompareTo) GetAllowedValues() []WidgetCompareTo { - return allowedWidgetCompareToEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetCompareTo) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetCompareTo(value) - return nil -} - -// NewWidgetCompareToFromValue returns a pointer to a valid WidgetCompareTo -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetCompareToFromValue(v string) (*WidgetCompareTo, error) { - ev := WidgetCompareTo(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetCompareTo: valid values are %v", v, allowedWidgetCompareToEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetCompareTo) IsValid() bool { - for _, existing := range allowedWidgetCompareToEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetCompareTo value. -func (v WidgetCompareTo) Ptr() *WidgetCompareTo { - return &v -} - -// NullableWidgetCompareTo handles when a null is used for WidgetCompareTo. -type NullableWidgetCompareTo struct { - value *WidgetCompareTo - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetCompareTo) Get() *WidgetCompareTo { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetCompareTo) Set(val *WidgetCompareTo) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetCompareTo) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetCompareTo) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetCompareTo initializes the struct as if Set has been called. -func NewNullableWidgetCompareTo(val *WidgetCompareTo) *NullableWidgetCompareTo { - return &NullableWidgetCompareTo{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetCompareTo) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetCompareTo) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_conditional_format.go b/api/v1/datadog/model_widget_conditional_format.go deleted file mode 100644 index a83b9d45a6a..00000000000 --- a/api/v1/datadog/model_widget_conditional_format.go +++ /dev/null @@ -1,419 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetConditionalFormat Define a conditional format for the widget. -type WidgetConditionalFormat struct { - // Comparator to apply. - Comparator WidgetComparator `json:"comparator"` - // Color palette to apply to the background, same values available as palette. - CustomBgColor *string `json:"custom_bg_color,omitempty"` - // Color palette to apply to the foreground, same values available as palette. - CustomFgColor *string `json:"custom_fg_color,omitempty"` - // True hides values. - HideValue *bool `json:"hide_value,omitempty"` - // Displays an image as the background. - ImageUrl *string `json:"image_url,omitempty"` - // Metric from the request to correlate this conditional format with. - Metric *string `json:"metric,omitempty"` - // Color palette to apply. - Palette WidgetPalette `json:"palette"` - // Defines the displayed timeframe. - Timeframe *string `json:"timeframe,omitempty"` - // Value for the comparator. - Value float64 `json:"value"` - // 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{} -} - -// NewWidgetConditionalFormat instantiates a new WidgetConditionalFormat 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 NewWidgetConditionalFormat(comparator WidgetComparator, palette WidgetPalette, value float64) *WidgetConditionalFormat { - this := WidgetConditionalFormat{} - this.Comparator = comparator - this.Palette = palette - this.Value = value - return &this -} - -// NewWidgetConditionalFormatWithDefaults instantiates a new WidgetConditionalFormat 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 NewWidgetConditionalFormatWithDefaults() *WidgetConditionalFormat { - this := WidgetConditionalFormat{} - return &this -} - -// GetComparator returns the Comparator field value. -func (o *WidgetConditionalFormat) GetComparator() WidgetComparator { - if o == nil { - var ret WidgetComparator - return ret - } - return o.Comparator -} - -// GetComparatorOk returns a tuple with the Comparator field value -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetComparatorOk() (*WidgetComparator, bool) { - if o == nil { - return nil, false - } - return &o.Comparator, true -} - -// SetComparator sets field value. -func (o *WidgetConditionalFormat) SetComparator(v WidgetComparator) { - o.Comparator = v -} - -// GetCustomBgColor returns the CustomBgColor field value if set, zero value otherwise. -func (o *WidgetConditionalFormat) GetCustomBgColor() string { - if o == nil || o.CustomBgColor == nil { - var ret string - return ret - } - return *o.CustomBgColor -} - -// GetCustomBgColorOk returns a tuple with the CustomBgColor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetCustomBgColorOk() (*string, bool) { - if o == nil || o.CustomBgColor == nil { - return nil, false - } - return o.CustomBgColor, true -} - -// HasCustomBgColor returns a boolean if a field has been set. -func (o *WidgetConditionalFormat) HasCustomBgColor() bool { - if o != nil && o.CustomBgColor != nil { - return true - } - - return false -} - -// SetCustomBgColor gets a reference to the given string and assigns it to the CustomBgColor field. -func (o *WidgetConditionalFormat) SetCustomBgColor(v string) { - o.CustomBgColor = &v -} - -// GetCustomFgColor returns the CustomFgColor field value if set, zero value otherwise. -func (o *WidgetConditionalFormat) GetCustomFgColor() string { - if o == nil || o.CustomFgColor == nil { - var ret string - return ret - } - return *o.CustomFgColor -} - -// GetCustomFgColorOk returns a tuple with the CustomFgColor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetCustomFgColorOk() (*string, bool) { - if o == nil || o.CustomFgColor == nil { - return nil, false - } - return o.CustomFgColor, true -} - -// HasCustomFgColor returns a boolean if a field has been set. -func (o *WidgetConditionalFormat) HasCustomFgColor() bool { - if o != nil && o.CustomFgColor != nil { - return true - } - - return false -} - -// SetCustomFgColor gets a reference to the given string and assigns it to the CustomFgColor field. -func (o *WidgetConditionalFormat) SetCustomFgColor(v string) { - o.CustomFgColor = &v -} - -// GetHideValue returns the HideValue field value if set, zero value otherwise. -func (o *WidgetConditionalFormat) GetHideValue() bool { - if o == nil || o.HideValue == nil { - var ret bool - return ret - } - return *o.HideValue -} - -// GetHideValueOk returns a tuple with the HideValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetHideValueOk() (*bool, bool) { - if o == nil || o.HideValue == nil { - return nil, false - } - return o.HideValue, true -} - -// HasHideValue returns a boolean if a field has been set. -func (o *WidgetConditionalFormat) HasHideValue() bool { - if o != nil && o.HideValue != nil { - return true - } - - return false -} - -// SetHideValue gets a reference to the given bool and assigns it to the HideValue field. -func (o *WidgetConditionalFormat) SetHideValue(v bool) { - o.HideValue = &v -} - -// GetImageUrl returns the ImageUrl field value if set, zero value otherwise. -func (o *WidgetConditionalFormat) GetImageUrl() string { - if o == nil || o.ImageUrl == nil { - var ret string - return ret - } - return *o.ImageUrl -} - -// GetImageUrlOk returns a tuple with the ImageUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetImageUrlOk() (*string, bool) { - if o == nil || o.ImageUrl == nil { - return nil, false - } - return o.ImageUrl, true -} - -// HasImageUrl returns a boolean if a field has been set. -func (o *WidgetConditionalFormat) HasImageUrl() bool { - if o != nil && o.ImageUrl != nil { - return true - } - - return false -} - -// SetImageUrl gets a reference to the given string and assigns it to the ImageUrl field. -func (o *WidgetConditionalFormat) SetImageUrl(v string) { - o.ImageUrl = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *WidgetConditionalFormat) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *WidgetConditionalFormat) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *WidgetConditionalFormat) SetMetric(v string) { - o.Metric = &v -} - -// GetPalette returns the Palette field value. -func (o *WidgetConditionalFormat) GetPalette() WidgetPalette { - if o == nil { - var ret WidgetPalette - return ret - } - return o.Palette -} - -// GetPaletteOk returns a tuple with the Palette field value -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetPaletteOk() (*WidgetPalette, bool) { - if o == nil { - return nil, false - } - return &o.Palette, true -} - -// SetPalette sets field value. -func (o *WidgetConditionalFormat) SetPalette(v WidgetPalette) { - o.Palette = v -} - -// GetTimeframe returns the Timeframe field value if set, zero value otherwise. -func (o *WidgetConditionalFormat) GetTimeframe() string { - if o == nil || o.Timeframe == nil { - var ret string - return ret - } - return *o.Timeframe -} - -// GetTimeframeOk returns a tuple with the Timeframe field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetTimeframeOk() (*string, bool) { - if o == nil || o.Timeframe == nil { - return nil, false - } - return o.Timeframe, true -} - -// HasTimeframe returns a boolean if a field has been set. -func (o *WidgetConditionalFormat) HasTimeframe() bool { - if o != nil && o.Timeframe != nil { - return true - } - - return false -} - -// SetTimeframe gets a reference to the given string and assigns it to the Timeframe field. -func (o *WidgetConditionalFormat) SetTimeframe(v string) { - o.Timeframe = &v -} - -// GetValue returns the Value field value. -func (o *WidgetConditionalFormat) GetValue() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Value -} - -// GetValueOk returns a tuple with the Value field value -// and a boolean to check if the value has been set. -func (o *WidgetConditionalFormat) GetValueOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Value, true -} - -// SetValue sets field value. -func (o *WidgetConditionalFormat) SetValue(v float64) { - o.Value = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetConditionalFormat) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["comparator"] = o.Comparator - if o.CustomBgColor != nil { - toSerialize["custom_bg_color"] = o.CustomBgColor - } - if o.CustomFgColor != nil { - toSerialize["custom_fg_color"] = o.CustomFgColor - } - if o.HideValue != nil { - toSerialize["hide_value"] = o.HideValue - } - if o.ImageUrl != nil { - toSerialize["image_url"] = o.ImageUrl - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - toSerialize["palette"] = o.Palette - if o.Timeframe != nil { - toSerialize["timeframe"] = o.Timeframe - } - toSerialize["value"] = o.Value - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Comparator *WidgetComparator `json:"comparator"` - Palette *WidgetPalette `json:"palette"` - Value *float64 `json:"value"` - }{} - all := struct { - Comparator WidgetComparator `json:"comparator"` - CustomBgColor *string `json:"custom_bg_color,omitempty"` - CustomFgColor *string `json:"custom_fg_color,omitempty"` - HideValue *bool `json:"hide_value,omitempty"` - ImageUrl *string `json:"image_url,omitempty"` - Metric *string `json:"metric,omitempty"` - Palette WidgetPalette `json:"palette"` - Timeframe *string `json:"timeframe,omitempty"` - Value float64 `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Comparator == nil { - return fmt.Errorf("Required field comparator missing") - } - if required.Palette == nil { - return fmt.Errorf("Required field palette missing") - } - if required.Value == nil { - return fmt.Errorf("Required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Comparator; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Palette; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Comparator = all.Comparator - o.CustomBgColor = all.CustomBgColor - o.CustomFgColor = all.CustomFgColor - o.HideValue = all.HideValue - o.ImageUrl = all.ImageUrl - o.Metric = all.Metric - o.Palette = all.Palette - o.Timeframe = all.Timeframe - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_widget_custom_link.go b/api/v1/datadog/model_widget_custom_link.go deleted file mode 100644 index 98c4c117c6e..00000000000 --- a/api/v1/datadog/model_widget_custom_link.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WidgetCustomLink Custom links help you connect a data value to a URL, like a Datadog page or your AWS console. -type WidgetCustomLink struct { - // The flag for toggling context menu link visibility. - IsHidden *bool `json:"is_hidden,omitempty"` - // The label for the custom link URL. Keep the label short and descriptive. Use metrics and tags as variables. - Label *string `json:"label,omitempty"` - // The URL of the custom link. URL must include `http` or `https`. A relative URL must start with `/`. - Link *string `json:"link,omitempty"` - // The label ID that refers to a context menu link. Can be `logs`, `hosts`, `traces`, `profiles`, `processes`, `containers`, or `rum`. - OverrideLabel *string `json:"override_label,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{} -} - -// NewWidgetCustomLink instantiates a new WidgetCustomLink 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 NewWidgetCustomLink() *WidgetCustomLink { - this := WidgetCustomLink{} - return &this -} - -// NewWidgetCustomLinkWithDefaults instantiates a new WidgetCustomLink 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 NewWidgetCustomLinkWithDefaults() *WidgetCustomLink { - this := WidgetCustomLink{} - return &this -} - -// GetIsHidden returns the IsHidden field value if set, zero value otherwise. -func (o *WidgetCustomLink) GetIsHidden() bool { - if o == nil || o.IsHidden == nil { - var ret bool - return ret - } - return *o.IsHidden -} - -// GetIsHiddenOk returns a tuple with the IsHidden field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetCustomLink) GetIsHiddenOk() (*bool, bool) { - if o == nil || o.IsHidden == nil { - return nil, false - } - return o.IsHidden, true -} - -// HasIsHidden returns a boolean if a field has been set. -func (o *WidgetCustomLink) HasIsHidden() bool { - if o != nil && o.IsHidden != nil { - return true - } - - return false -} - -// SetIsHidden gets a reference to the given bool and assigns it to the IsHidden field. -func (o *WidgetCustomLink) SetIsHidden(v bool) { - o.IsHidden = &v -} - -// GetLabel returns the Label field value if set, zero value otherwise. -func (o *WidgetCustomLink) GetLabel() string { - if o == nil || o.Label == nil { - var ret string - return ret - } - return *o.Label -} - -// GetLabelOk returns a tuple with the Label field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetCustomLink) GetLabelOk() (*string, bool) { - if o == nil || o.Label == nil { - return nil, false - } - return o.Label, true -} - -// HasLabel returns a boolean if a field has been set. -func (o *WidgetCustomLink) HasLabel() bool { - if o != nil && o.Label != nil { - return true - } - - return false -} - -// SetLabel gets a reference to the given string and assigns it to the Label field. -func (o *WidgetCustomLink) SetLabel(v string) { - o.Label = &v -} - -// GetLink returns the Link field value if set, zero value otherwise. -func (o *WidgetCustomLink) GetLink() string { - if o == nil || o.Link == nil { - var ret string - return ret - } - return *o.Link -} - -// GetLinkOk returns a tuple with the Link field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetCustomLink) GetLinkOk() (*string, bool) { - if o == nil || o.Link == nil { - return nil, false - } - return o.Link, true -} - -// HasLink returns a boolean if a field has been set. -func (o *WidgetCustomLink) HasLink() bool { - if o != nil && o.Link != nil { - return true - } - - return false -} - -// SetLink gets a reference to the given string and assigns it to the Link field. -func (o *WidgetCustomLink) SetLink(v string) { - o.Link = &v -} - -// GetOverrideLabel returns the OverrideLabel field value if set, zero value otherwise. -func (o *WidgetCustomLink) GetOverrideLabel() string { - if o == nil || o.OverrideLabel == nil { - var ret string - return ret - } - return *o.OverrideLabel -} - -// GetOverrideLabelOk returns a tuple with the OverrideLabel field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetCustomLink) GetOverrideLabelOk() (*string, bool) { - if o == nil || o.OverrideLabel == nil { - return nil, false - } - return o.OverrideLabel, true -} - -// HasOverrideLabel returns a boolean if a field has been set. -func (o *WidgetCustomLink) HasOverrideLabel() bool { - if o != nil && o.OverrideLabel != nil { - return true - } - - return false -} - -// SetOverrideLabel gets a reference to the given string and assigns it to the OverrideLabel field. -func (o *WidgetCustomLink) SetOverrideLabel(v string) { - o.OverrideLabel = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetCustomLink) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IsHidden != nil { - toSerialize["is_hidden"] = o.IsHidden - } - if o.Label != nil { - toSerialize["label"] = o.Label - } - if o.Link != nil { - toSerialize["link"] = o.Link - } - if o.OverrideLabel != nil { - toSerialize["override_label"] = o.OverrideLabel - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetCustomLink) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IsHidden *bool `json:"is_hidden,omitempty"` - Label *string `json:"label,omitempty"` - Link *string `json:"link,omitempty"` - OverrideLabel *string `json:"override_label,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IsHidden = all.IsHidden - o.Label = all.Label - o.Link = all.Link - o.OverrideLabel = all.OverrideLabel - return nil -} diff --git a/api/v1/datadog/model_widget_definition.go b/api/v1/datadog/model_widget_definition.go deleted file mode 100644 index cf655095ca5..00000000000 --- a/api/v1/datadog/model_widget_definition.go +++ /dev/null @@ -1,1019 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WidgetDefinition - [Definition of the widget](https://docs.datadoghq.com/dashboards/widgets/). -type WidgetDefinition struct { - AlertGraphWidgetDefinition *AlertGraphWidgetDefinition - AlertValueWidgetDefinition *AlertValueWidgetDefinition - ChangeWidgetDefinition *ChangeWidgetDefinition - CheckStatusWidgetDefinition *CheckStatusWidgetDefinition - DistributionWidgetDefinition *DistributionWidgetDefinition - EventStreamWidgetDefinition *EventStreamWidgetDefinition - EventTimelineWidgetDefinition *EventTimelineWidgetDefinition - FreeTextWidgetDefinition *FreeTextWidgetDefinition - GeomapWidgetDefinition *GeomapWidgetDefinition - GroupWidgetDefinition *GroupWidgetDefinition - HeatMapWidgetDefinition *HeatMapWidgetDefinition - HostMapWidgetDefinition *HostMapWidgetDefinition - IFrameWidgetDefinition *IFrameWidgetDefinition - ImageWidgetDefinition *ImageWidgetDefinition - LogStreamWidgetDefinition *LogStreamWidgetDefinition - MonitorSummaryWidgetDefinition *MonitorSummaryWidgetDefinition - NoteWidgetDefinition *NoteWidgetDefinition - QueryValueWidgetDefinition *QueryValueWidgetDefinition - ScatterPlotWidgetDefinition *ScatterPlotWidgetDefinition - SLOWidgetDefinition *SLOWidgetDefinition - ServiceMapWidgetDefinition *ServiceMapWidgetDefinition - ServiceSummaryWidgetDefinition *ServiceSummaryWidgetDefinition - SunburstWidgetDefinition *SunburstWidgetDefinition - TableWidgetDefinition *TableWidgetDefinition - TimeseriesWidgetDefinition *TimeseriesWidgetDefinition - ToplistWidgetDefinition *ToplistWidgetDefinition - TreeMapWidgetDefinition *TreeMapWidgetDefinition - ListStreamWidgetDefinition *ListStreamWidgetDefinition - FunnelWidgetDefinition *FunnelWidgetDefinition - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// AlertGraphWidgetDefinitionAsWidgetDefinition is a convenience function that returns AlertGraphWidgetDefinition wrapped in WidgetDefinition. -func AlertGraphWidgetDefinitionAsWidgetDefinition(v *AlertGraphWidgetDefinition) WidgetDefinition { - return WidgetDefinition{AlertGraphWidgetDefinition: v} -} - -// AlertValueWidgetDefinitionAsWidgetDefinition is a convenience function that returns AlertValueWidgetDefinition wrapped in WidgetDefinition. -func AlertValueWidgetDefinitionAsWidgetDefinition(v *AlertValueWidgetDefinition) WidgetDefinition { - return WidgetDefinition{AlertValueWidgetDefinition: v} -} - -// ChangeWidgetDefinitionAsWidgetDefinition is a convenience function that returns ChangeWidgetDefinition wrapped in WidgetDefinition. -func ChangeWidgetDefinitionAsWidgetDefinition(v *ChangeWidgetDefinition) WidgetDefinition { - return WidgetDefinition{ChangeWidgetDefinition: v} -} - -// CheckStatusWidgetDefinitionAsWidgetDefinition is a convenience function that returns CheckStatusWidgetDefinition wrapped in WidgetDefinition. -func CheckStatusWidgetDefinitionAsWidgetDefinition(v *CheckStatusWidgetDefinition) WidgetDefinition { - return WidgetDefinition{CheckStatusWidgetDefinition: v} -} - -// DistributionWidgetDefinitionAsWidgetDefinition is a convenience function that returns DistributionWidgetDefinition wrapped in WidgetDefinition. -func DistributionWidgetDefinitionAsWidgetDefinition(v *DistributionWidgetDefinition) WidgetDefinition { - return WidgetDefinition{DistributionWidgetDefinition: v} -} - -// EventStreamWidgetDefinitionAsWidgetDefinition is a convenience function that returns EventStreamWidgetDefinition wrapped in WidgetDefinition. -func EventStreamWidgetDefinitionAsWidgetDefinition(v *EventStreamWidgetDefinition) WidgetDefinition { - return WidgetDefinition{EventStreamWidgetDefinition: v} -} - -// EventTimelineWidgetDefinitionAsWidgetDefinition is a convenience function that returns EventTimelineWidgetDefinition wrapped in WidgetDefinition. -func EventTimelineWidgetDefinitionAsWidgetDefinition(v *EventTimelineWidgetDefinition) WidgetDefinition { - return WidgetDefinition{EventTimelineWidgetDefinition: v} -} - -// FreeTextWidgetDefinitionAsWidgetDefinition is a convenience function that returns FreeTextWidgetDefinition wrapped in WidgetDefinition. -func FreeTextWidgetDefinitionAsWidgetDefinition(v *FreeTextWidgetDefinition) WidgetDefinition { - return WidgetDefinition{FreeTextWidgetDefinition: v} -} - -// GeomapWidgetDefinitionAsWidgetDefinition is a convenience function that returns GeomapWidgetDefinition wrapped in WidgetDefinition. -func GeomapWidgetDefinitionAsWidgetDefinition(v *GeomapWidgetDefinition) WidgetDefinition { - return WidgetDefinition{GeomapWidgetDefinition: v} -} - -// GroupWidgetDefinitionAsWidgetDefinition is a convenience function that returns GroupWidgetDefinition wrapped in WidgetDefinition. -func GroupWidgetDefinitionAsWidgetDefinition(v *GroupWidgetDefinition) WidgetDefinition { - return WidgetDefinition{GroupWidgetDefinition: v} -} - -// HeatMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns HeatMapWidgetDefinition wrapped in WidgetDefinition. -func HeatMapWidgetDefinitionAsWidgetDefinition(v *HeatMapWidgetDefinition) WidgetDefinition { - return WidgetDefinition{HeatMapWidgetDefinition: v} -} - -// HostMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns HostMapWidgetDefinition wrapped in WidgetDefinition. -func HostMapWidgetDefinitionAsWidgetDefinition(v *HostMapWidgetDefinition) WidgetDefinition { - return WidgetDefinition{HostMapWidgetDefinition: v} -} - -// IFrameWidgetDefinitionAsWidgetDefinition is a convenience function that returns IFrameWidgetDefinition wrapped in WidgetDefinition. -func IFrameWidgetDefinitionAsWidgetDefinition(v *IFrameWidgetDefinition) WidgetDefinition { - return WidgetDefinition{IFrameWidgetDefinition: v} -} - -// ImageWidgetDefinitionAsWidgetDefinition is a convenience function that returns ImageWidgetDefinition wrapped in WidgetDefinition. -func ImageWidgetDefinitionAsWidgetDefinition(v *ImageWidgetDefinition) WidgetDefinition { - return WidgetDefinition{ImageWidgetDefinition: v} -} - -// LogStreamWidgetDefinitionAsWidgetDefinition is a convenience function that returns LogStreamWidgetDefinition wrapped in WidgetDefinition. -func LogStreamWidgetDefinitionAsWidgetDefinition(v *LogStreamWidgetDefinition) WidgetDefinition { - return WidgetDefinition{LogStreamWidgetDefinition: v} -} - -// MonitorSummaryWidgetDefinitionAsWidgetDefinition is a convenience function that returns MonitorSummaryWidgetDefinition wrapped in WidgetDefinition. -func MonitorSummaryWidgetDefinitionAsWidgetDefinition(v *MonitorSummaryWidgetDefinition) WidgetDefinition { - return WidgetDefinition{MonitorSummaryWidgetDefinition: v} -} - -// NoteWidgetDefinitionAsWidgetDefinition is a convenience function that returns NoteWidgetDefinition wrapped in WidgetDefinition. -func NoteWidgetDefinitionAsWidgetDefinition(v *NoteWidgetDefinition) WidgetDefinition { - return WidgetDefinition{NoteWidgetDefinition: v} -} - -// QueryValueWidgetDefinitionAsWidgetDefinition is a convenience function that returns QueryValueWidgetDefinition wrapped in WidgetDefinition. -func QueryValueWidgetDefinitionAsWidgetDefinition(v *QueryValueWidgetDefinition) WidgetDefinition { - return WidgetDefinition{QueryValueWidgetDefinition: v} -} - -// ScatterPlotWidgetDefinitionAsWidgetDefinition is a convenience function that returns ScatterPlotWidgetDefinition wrapped in WidgetDefinition. -func ScatterPlotWidgetDefinitionAsWidgetDefinition(v *ScatterPlotWidgetDefinition) WidgetDefinition { - return WidgetDefinition{ScatterPlotWidgetDefinition: v} -} - -// SLOWidgetDefinitionAsWidgetDefinition is a convenience function that returns SLOWidgetDefinition wrapped in WidgetDefinition. -func SLOWidgetDefinitionAsWidgetDefinition(v *SLOWidgetDefinition) WidgetDefinition { - return WidgetDefinition{SLOWidgetDefinition: v} -} - -// ServiceMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns ServiceMapWidgetDefinition wrapped in WidgetDefinition. -func ServiceMapWidgetDefinitionAsWidgetDefinition(v *ServiceMapWidgetDefinition) WidgetDefinition { - return WidgetDefinition{ServiceMapWidgetDefinition: v} -} - -// ServiceSummaryWidgetDefinitionAsWidgetDefinition is a convenience function that returns ServiceSummaryWidgetDefinition wrapped in WidgetDefinition. -func ServiceSummaryWidgetDefinitionAsWidgetDefinition(v *ServiceSummaryWidgetDefinition) WidgetDefinition { - return WidgetDefinition{ServiceSummaryWidgetDefinition: v} -} - -// SunburstWidgetDefinitionAsWidgetDefinition is a convenience function that returns SunburstWidgetDefinition wrapped in WidgetDefinition. -func SunburstWidgetDefinitionAsWidgetDefinition(v *SunburstWidgetDefinition) WidgetDefinition { - return WidgetDefinition{SunburstWidgetDefinition: v} -} - -// TableWidgetDefinitionAsWidgetDefinition is a convenience function that returns TableWidgetDefinition wrapped in WidgetDefinition. -func TableWidgetDefinitionAsWidgetDefinition(v *TableWidgetDefinition) WidgetDefinition { - return WidgetDefinition{TableWidgetDefinition: v} -} - -// TimeseriesWidgetDefinitionAsWidgetDefinition is a convenience function that returns TimeseriesWidgetDefinition wrapped in WidgetDefinition. -func TimeseriesWidgetDefinitionAsWidgetDefinition(v *TimeseriesWidgetDefinition) WidgetDefinition { - return WidgetDefinition{TimeseriesWidgetDefinition: v} -} - -// ToplistWidgetDefinitionAsWidgetDefinition is a convenience function that returns ToplistWidgetDefinition wrapped in WidgetDefinition. -func ToplistWidgetDefinitionAsWidgetDefinition(v *ToplistWidgetDefinition) WidgetDefinition { - return WidgetDefinition{ToplistWidgetDefinition: v} -} - -// TreeMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns TreeMapWidgetDefinition wrapped in WidgetDefinition. -func TreeMapWidgetDefinitionAsWidgetDefinition(v *TreeMapWidgetDefinition) WidgetDefinition { - return WidgetDefinition{TreeMapWidgetDefinition: v} -} - -// ListStreamWidgetDefinitionAsWidgetDefinition is a convenience function that returns ListStreamWidgetDefinition wrapped in WidgetDefinition. -func ListStreamWidgetDefinitionAsWidgetDefinition(v *ListStreamWidgetDefinition) WidgetDefinition { - return WidgetDefinition{ListStreamWidgetDefinition: v} -} - -// FunnelWidgetDefinitionAsWidgetDefinition is a convenience function that returns FunnelWidgetDefinition wrapped in WidgetDefinition. -func FunnelWidgetDefinitionAsWidgetDefinition(v *FunnelWidgetDefinition) WidgetDefinition { - return WidgetDefinition{FunnelWidgetDefinition: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *WidgetDefinition) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into AlertGraphWidgetDefinition - err = json.Unmarshal(data, &obj.AlertGraphWidgetDefinition) - if err == nil { - if obj.AlertGraphWidgetDefinition != nil && obj.AlertGraphWidgetDefinition.UnparsedObject == nil { - jsonAlertGraphWidgetDefinition, _ := json.Marshal(obj.AlertGraphWidgetDefinition) - if string(jsonAlertGraphWidgetDefinition) == "{}" { // empty struct - obj.AlertGraphWidgetDefinition = nil - } else { - match++ - } - } else { - obj.AlertGraphWidgetDefinition = nil - } - } else { - obj.AlertGraphWidgetDefinition = nil - } - - // try to unmarshal data into AlertValueWidgetDefinition - err = json.Unmarshal(data, &obj.AlertValueWidgetDefinition) - if err == nil { - if obj.AlertValueWidgetDefinition != nil && obj.AlertValueWidgetDefinition.UnparsedObject == nil { - jsonAlertValueWidgetDefinition, _ := json.Marshal(obj.AlertValueWidgetDefinition) - if string(jsonAlertValueWidgetDefinition) == "{}" { // empty struct - obj.AlertValueWidgetDefinition = nil - } else { - match++ - } - } else { - obj.AlertValueWidgetDefinition = nil - } - } else { - obj.AlertValueWidgetDefinition = nil - } - - // try to unmarshal data into ChangeWidgetDefinition - err = json.Unmarshal(data, &obj.ChangeWidgetDefinition) - if err == nil { - if obj.ChangeWidgetDefinition != nil && obj.ChangeWidgetDefinition.UnparsedObject == nil { - jsonChangeWidgetDefinition, _ := json.Marshal(obj.ChangeWidgetDefinition) - if string(jsonChangeWidgetDefinition) == "{}" { // empty struct - obj.ChangeWidgetDefinition = nil - } else { - match++ - } - } else { - obj.ChangeWidgetDefinition = nil - } - } else { - obj.ChangeWidgetDefinition = nil - } - - // try to unmarshal data into CheckStatusWidgetDefinition - err = json.Unmarshal(data, &obj.CheckStatusWidgetDefinition) - if err == nil { - if obj.CheckStatusWidgetDefinition != nil && obj.CheckStatusWidgetDefinition.UnparsedObject == nil { - jsonCheckStatusWidgetDefinition, _ := json.Marshal(obj.CheckStatusWidgetDefinition) - if string(jsonCheckStatusWidgetDefinition) == "{}" { // empty struct - obj.CheckStatusWidgetDefinition = nil - } else { - match++ - } - } else { - obj.CheckStatusWidgetDefinition = nil - } - } else { - obj.CheckStatusWidgetDefinition = nil - } - - // try to unmarshal data into DistributionWidgetDefinition - err = json.Unmarshal(data, &obj.DistributionWidgetDefinition) - if err == nil { - if obj.DistributionWidgetDefinition != nil && obj.DistributionWidgetDefinition.UnparsedObject == nil { - jsonDistributionWidgetDefinition, _ := json.Marshal(obj.DistributionWidgetDefinition) - if string(jsonDistributionWidgetDefinition) == "{}" { // empty struct - obj.DistributionWidgetDefinition = nil - } else { - match++ - } - } else { - obj.DistributionWidgetDefinition = nil - } - } else { - obj.DistributionWidgetDefinition = nil - } - - // try to unmarshal data into EventStreamWidgetDefinition - err = json.Unmarshal(data, &obj.EventStreamWidgetDefinition) - if err == nil { - if obj.EventStreamWidgetDefinition != nil && obj.EventStreamWidgetDefinition.UnparsedObject == nil { - jsonEventStreamWidgetDefinition, _ := json.Marshal(obj.EventStreamWidgetDefinition) - if string(jsonEventStreamWidgetDefinition) == "{}" { // empty struct - obj.EventStreamWidgetDefinition = nil - } else { - match++ - } - } else { - obj.EventStreamWidgetDefinition = nil - } - } else { - obj.EventStreamWidgetDefinition = nil - } - - // try to unmarshal data into EventTimelineWidgetDefinition - err = json.Unmarshal(data, &obj.EventTimelineWidgetDefinition) - if err == nil { - if obj.EventTimelineWidgetDefinition != nil && obj.EventTimelineWidgetDefinition.UnparsedObject == nil { - jsonEventTimelineWidgetDefinition, _ := json.Marshal(obj.EventTimelineWidgetDefinition) - if string(jsonEventTimelineWidgetDefinition) == "{}" { // empty struct - obj.EventTimelineWidgetDefinition = nil - } else { - match++ - } - } else { - obj.EventTimelineWidgetDefinition = nil - } - } else { - obj.EventTimelineWidgetDefinition = nil - } - - // try to unmarshal data into FreeTextWidgetDefinition - err = json.Unmarshal(data, &obj.FreeTextWidgetDefinition) - if err == nil { - if obj.FreeTextWidgetDefinition != nil && obj.FreeTextWidgetDefinition.UnparsedObject == nil { - jsonFreeTextWidgetDefinition, _ := json.Marshal(obj.FreeTextWidgetDefinition) - if string(jsonFreeTextWidgetDefinition) == "{}" { // empty struct - obj.FreeTextWidgetDefinition = nil - } else { - match++ - } - } else { - obj.FreeTextWidgetDefinition = nil - } - } else { - obj.FreeTextWidgetDefinition = nil - } - - // try to unmarshal data into GeomapWidgetDefinition - err = json.Unmarshal(data, &obj.GeomapWidgetDefinition) - if err == nil { - if obj.GeomapWidgetDefinition != nil && obj.GeomapWidgetDefinition.UnparsedObject == nil { - jsonGeomapWidgetDefinition, _ := json.Marshal(obj.GeomapWidgetDefinition) - if string(jsonGeomapWidgetDefinition) == "{}" { // empty struct - obj.GeomapWidgetDefinition = nil - } else { - match++ - } - } else { - obj.GeomapWidgetDefinition = nil - } - } else { - obj.GeomapWidgetDefinition = nil - } - - // try to unmarshal data into GroupWidgetDefinition - err = json.Unmarshal(data, &obj.GroupWidgetDefinition) - if err == nil { - if obj.GroupWidgetDefinition != nil && obj.GroupWidgetDefinition.UnparsedObject == nil { - jsonGroupWidgetDefinition, _ := json.Marshal(obj.GroupWidgetDefinition) - if string(jsonGroupWidgetDefinition) == "{}" { // empty struct - obj.GroupWidgetDefinition = nil - } else { - match++ - } - } else { - obj.GroupWidgetDefinition = nil - } - } else { - obj.GroupWidgetDefinition = nil - } - - // try to unmarshal data into HeatMapWidgetDefinition - err = json.Unmarshal(data, &obj.HeatMapWidgetDefinition) - if err == nil { - if obj.HeatMapWidgetDefinition != nil && obj.HeatMapWidgetDefinition.UnparsedObject == nil { - jsonHeatMapWidgetDefinition, _ := json.Marshal(obj.HeatMapWidgetDefinition) - if string(jsonHeatMapWidgetDefinition) == "{}" { // empty struct - obj.HeatMapWidgetDefinition = nil - } else { - match++ - } - } else { - obj.HeatMapWidgetDefinition = nil - } - } else { - obj.HeatMapWidgetDefinition = nil - } - - // try to unmarshal data into HostMapWidgetDefinition - err = json.Unmarshal(data, &obj.HostMapWidgetDefinition) - if err == nil { - if obj.HostMapWidgetDefinition != nil && obj.HostMapWidgetDefinition.UnparsedObject == nil { - jsonHostMapWidgetDefinition, _ := json.Marshal(obj.HostMapWidgetDefinition) - if string(jsonHostMapWidgetDefinition) == "{}" { // empty struct - obj.HostMapWidgetDefinition = nil - } else { - match++ - } - } else { - obj.HostMapWidgetDefinition = nil - } - } else { - obj.HostMapWidgetDefinition = nil - } - - // try to unmarshal data into IFrameWidgetDefinition - err = json.Unmarshal(data, &obj.IFrameWidgetDefinition) - if err == nil { - if obj.IFrameWidgetDefinition != nil && obj.IFrameWidgetDefinition.UnparsedObject == nil { - jsonIFrameWidgetDefinition, _ := json.Marshal(obj.IFrameWidgetDefinition) - if string(jsonIFrameWidgetDefinition) == "{}" { // empty struct - obj.IFrameWidgetDefinition = nil - } else { - match++ - } - } else { - obj.IFrameWidgetDefinition = nil - } - } else { - obj.IFrameWidgetDefinition = nil - } - - // try to unmarshal data into ImageWidgetDefinition - err = json.Unmarshal(data, &obj.ImageWidgetDefinition) - if err == nil { - if obj.ImageWidgetDefinition != nil && obj.ImageWidgetDefinition.UnparsedObject == nil { - jsonImageWidgetDefinition, _ := json.Marshal(obj.ImageWidgetDefinition) - if string(jsonImageWidgetDefinition) == "{}" { // empty struct - obj.ImageWidgetDefinition = nil - } else { - match++ - } - } else { - obj.ImageWidgetDefinition = nil - } - } else { - obj.ImageWidgetDefinition = nil - } - - // try to unmarshal data into LogStreamWidgetDefinition - err = json.Unmarshal(data, &obj.LogStreamWidgetDefinition) - if err == nil { - if obj.LogStreamWidgetDefinition != nil && obj.LogStreamWidgetDefinition.UnparsedObject == nil { - jsonLogStreamWidgetDefinition, _ := json.Marshal(obj.LogStreamWidgetDefinition) - if string(jsonLogStreamWidgetDefinition) == "{}" { // empty struct - obj.LogStreamWidgetDefinition = nil - } else { - match++ - } - } else { - obj.LogStreamWidgetDefinition = nil - } - } else { - obj.LogStreamWidgetDefinition = nil - } - - // try to unmarshal data into MonitorSummaryWidgetDefinition - err = json.Unmarshal(data, &obj.MonitorSummaryWidgetDefinition) - if err == nil { - if obj.MonitorSummaryWidgetDefinition != nil && obj.MonitorSummaryWidgetDefinition.UnparsedObject == nil { - jsonMonitorSummaryWidgetDefinition, _ := json.Marshal(obj.MonitorSummaryWidgetDefinition) - if string(jsonMonitorSummaryWidgetDefinition) == "{}" { // empty struct - obj.MonitorSummaryWidgetDefinition = nil - } else { - match++ - } - } else { - obj.MonitorSummaryWidgetDefinition = nil - } - } else { - obj.MonitorSummaryWidgetDefinition = nil - } - - // try to unmarshal data into NoteWidgetDefinition - err = json.Unmarshal(data, &obj.NoteWidgetDefinition) - if err == nil { - if obj.NoteWidgetDefinition != nil && obj.NoteWidgetDefinition.UnparsedObject == nil { - jsonNoteWidgetDefinition, _ := json.Marshal(obj.NoteWidgetDefinition) - if string(jsonNoteWidgetDefinition) == "{}" { // empty struct - obj.NoteWidgetDefinition = nil - } else { - match++ - } - } else { - obj.NoteWidgetDefinition = nil - } - } else { - obj.NoteWidgetDefinition = nil - } - - // try to unmarshal data into QueryValueWidgetDefinition - err = json.Unmarshal(data, &obj.QueryValueWidgetDefinition) - if err == nil { - if obj.QueryValueWidgetDefinition != nil && obj.QueryValueWidgetDefinition.UnparsedObject == nil { - jsonQueryValueWidgetDefinition, _ := json.Marshal(obj.QueryValueWidgetDefinition) - if string(jsonQueryValueWidgetDefinition) == "{}" { // empty struct - obj.QueryValueWidgetDefinition = nil - } else { - match++ - } - } else { - obj.QueryValueWidgetDefinition = nil - } - } else { - obj.QueryValueWidgetDefinition = nil - } - - // try to unmarshal data into ScatterPlotWidgetDefinition - err = json.Unmarshal(data, &obj.ScatterPlotWidgetDefinition) - if err == nil { - if obj.ScatterPlotWidgetDefinition != nil && obj.ScatterPlotWidgetDefinition.UnparsedObject == nil { - jsonScatterPlotWidgetDefinition, _ := json.Marshal(obj.ScatterPlotWidgetDefinition) - if string(jsonScatterPlotWidgetDefinition) == "{}" { // empty struct - obj.ScatterPlotWidgetDefinition = nil - } else { - match++ - } - } else { - obj.ScatterPlotWidgetDefinition = nil - } - } else { - obj.ScatterPlotWidgetDefinition = nil - } - - // try to unmarshal data into SLOWidgetDefinition - err = json.Unmarshal(data, &obj.SLOWidgetDefinition) - if err == nil { - if obj.SLOWidgetDefinition != nil && obj.SLOWidgetDefinition.UnparsedObject == nil { - jsonSLOWidgetDefinition, _ := json.Marshal(obj.SLOWidgetDefinition) - if string(jsonSLOWidgetDefinition) == "{}" { // empty struct - obj.SLOWidgetDefinition = nil - } else { - match++ - } - } else { - obj.SLOWidgetDefinition = nil - } - } else { - obj.SLOWidgetDefinition = nil - } - - // try to unmarshal data into ServiceMapWidgetDefinition - err = json.Unmarshal(data, &obj.ServiceMapWidgetDefinition) - if err == nil { - if obj.ServiceMapWidgetDefinition != nil && obj.ServiceMapWidgetDefinition.UnparsedObject == nil { - jsonServiceMapWidgetDefinition, _ := json.Marshal(obj.ServiceMapWidgetDefinition) - if string(jsonServiceMapWidgetDefinition) == "{}" { // empty struct - obj.ServiceMapWidgetDefinition = nil - } else { - match++ - } - } else { - obj.ServiceMapWidgetDefinition = nil - } - } else { - obj.ServiceMapWidgetDefinition = nil - } - - // try to unmarshal data into ServiceSummaryWidgetDefinition - err = json.Unmarshal(data, &obj.ServiceSummaryWidgetDefinition) - if err == nil { - if obj.ServiceSummaryWidgetDefinition != nil && obj.ServiceSummaryWidgetDefinition.UnparsedObject == nil { - jsonServiceSummaryWidgetDefinition, _ := json.Marshal(obj.ServiceSummaryWidgetDefinition) - if string(jsonServiceSummaryWidgetDefinition) == "{}" { // empty struct - obj.ServiceSummaryWidgetDefinition = nil - } else { - match++ - } - } else { - obj.ServiceSummaryWidgetDefinition = nil - } - } else { - obj.ServiceSummaryWidgetDefinition = nil - } - - // try to unmarshal data into SunburstWidgetDefinition - err = json.Unmarshal(data, &obj.SunburstWidgetDefinition) - if err == nil { - if obj.SunburstWidgetDefinition != nil && obj.SunburstWidgetDefinition.UnparsedObject == nil { - jsonSunburstWidgetDefinition, _ := json.Marshal(obj.SunburstWidgetDefinition) - if string(jsonSunburstWidgetDefinition) == "{}" { // empty struct - obj.SunburstWidgetDefinition = nil - } else { - match++ - } - } else { - obj.SunburstWidgetDefinition = nil - } - } else { - obj.SunburstWidgetDefinition = nil - } - - // try to unmarshal data into TableWidgetDefinition - err = json.Unmarshal(data, &obj.TableWidgetDefinition) - if err == nil { - if obj.TableWidgetDefinition != nil && obj.TableWidgetDefinition.UnparsedObject == nil { - jsonTableWidgetDefinition, _ := json.Marshal(obj.TableWidgetDefinition) - if string(jsonTableWidgetDefinition) == "{}" { // empty struct - obj.TableWidgetDefinition = nil - } else { - match++ - } - } else { - obj.TableWidgetDefinition = nil - } - } else { - obj.TableWidgetDefinition = nil - } - - // try to unmarshal data into TimeseriesWidgetDefinition - err = json.Unmarshal(data, &obj.TimeseriesWidgetDefinition) - if err == nil { - if obj.TimeseriesWidgetDefinition != nil && obj.TimeseriesWidgetDefinition.UnparsedObject == nil { - jsonTimeseriesWidgetDefinition, _ := json.Marshal(obj.TimeseriesWidgetDefinition) - if string(jsonTimeseriesWidgetDefinition) == "{}" { // empty struct - obj.TimeseriesWidgetDefinition = nil - } else { - match++ - } - } else { - obj.TimeseriesWidgetDefinition = nil - } - } else { - obj.TimeseriesWidgetDefinition = nil - } - - // try to unmarshal data into ToplistWidgetDefinition - err = json.Unmarshal(data, &obj.ToplistWidgetDefinition) - if err == nil { - if obj.ToplistWidgetDefinition != nil && obj.ToplistWidgetDefinition.UnparsedObject == nil { - jsonToplistWidgetDefinition, _ := json.Marshal(obj.ToplistWidgetDefinition) - if string(jsonToplistWidgetDefinition) == "{}" { // empty struct - obj.ToplistWidgetDefinition = nil - } else { - match++ - } - } else { - obj.ToplistWidgetDefinition = nil - } - } else { - obj.ToplistWidgetDefinition = nil - } - - // try to unmarshal data into TreeMapWidgetDefinition - err = json.Unmarshal(data, &obj.TreeMapWidgetDefinition) - if err == nil { - if obj.TreeMapWidgetDefinition != nil && obj.TreeMapWidgetDefinition.UnparsedObject == nil { - jsonTreeMapWidgetDefinition, _ := json.Marshal(obj.TreeMapWidgetDefinition) - if string(jsonTreeMapWidgetDefinition) == "{}" { // empty struct - obj.TreeMapWidgetDefinition = nil - } else { - match++ - } - } else { - obj.TreeMapWidgetDefinition = nil - } - } else { - obj.TreeMapWidgetDefinition = nil - } - - // try to unmarshal data into ListStreamWidgetDefinition - err = json.Unmarshal(data, &obj.ListStreamWidgetDefinition) - if err == nil { - if obj.ListStreamWidgetDefinition != nil && obj.ListStreamWidgetDefinition.UnparsedObject == nil { - jsonListStreamWidgetDefinition, _ := json.Marshal(obj.ListStreamWidgetDefinition) - if string(jsonListStreamWidgetDefinition) == "{}" { // empty struct - obj.ListStreamWidgetDefinition = nil - } else { - match++ - } - } else { - obj.ListStreamWidgetDefinition = nil - } - } else { - obj.ListStreamWidgetDefinition = nil - } - - // try to unmarshal data into FunnelWidgetDefinition - err = json.Unmarshal(data, &obj.FunnelWidgetDefinition) - if err == nil { - if obj.FunnelWidgetDefinition != nil && obj.FunnelWidgetDefinition.UnparsedObject == nil { - jsonFunnelWidgetDefinition, _ := json.Marshal(obj.FunnelWidgetDefinition) - if string(jsonFunnelWidgetDefinition) == "{}" { // empty struct - obj.FunnelWidgetDefinition = nil - } else { - match++ - } - } else { - obj.FunnelWidgetDefinition = nil - } - } else { - obj.FunnelWidgetDefinition = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.AlertGraphWidgetDefinition = nil - obj.AlertValueWidgetDefinition = nil - obj.ChangeWidgetDefinition = nil - obj.CheckStatusWidgetDefinition = nil - obj.DistributionWidgetDefinition = nil - obj.EventStreamWidgetDefinition = nil - obj.EventTimelineWidgetDefinition = nil - obj.FreeTextWidgetDefinition = nil - obj.GeomapWidgetDefinition = nil - obj.GroupWidgetDefinition = nil - obj.HeatMapWidgetDefinition = nil - obj.HostMapWidgetDefinition = nil - obj.IFrameWidgetDefinition = nil - obj.ImageWidgetDefinition = nil - obj.LogStreamWidgetDefinition = nil - obj.MonitorSummaryWidgetDefinition = nil - obj.NoteWidgetDefinition = nil - obj.QueryValueWidgetDefinition = nil - obj.ScatterPlotWidgetDefinition = nil - obj.SLOWidgetDefinition = nil - obj.ServiceMapWidgetDefinition = nil - obj.ServiceSummaryWidgetDefinition = nil - obj.SunburstWidgetDefinition = nil - obj.TableWidgetDefinition = nil - obj.TimeseriesWidgetDefinition = nil - obj.ToplistWidgetDefinition = nil - obj.TreeMapWidgetDefinition = nil - obj.ListStreamWidgetDefinition = nil - obj.FunnelWidgetDefinition = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj WidgetDefinition) MarshalJSON() ([]byte, error) { - if obj.AlertGraphWidgetDefinition != nil { - return json.Marshal(&obj.AlertGraphWidgetDefinition) - } - - if obj.AlertValueWidgetDefinition != nil { - return json.Marshal(&obj.AlertValueWidgetDefinition) - } - - if obj.ChangeWidgetDefinition != nil { - return json.Marshal(&obj.ChangeWidgetDefinition) - } - - if obj.CheckStatusWidgetDefinition != nil { - return json.Marshal(&obj.CheckStatusWidgetDefinition) - } - - if obj.DistributionWidgetDefinition != nil { - return json.Marshal(&obj.DistributionWidgetDefinition) - } - - if obj.EventStreamWidgetDefinition != nil { - return json.Marshal(&obj.EventStreamWidgetDefinition) - } - - if obj.EventTimelineWidgetDefinition != nil { - return json.Marshal(&obj.EventTimelineWidgetDefinition) - } - - if obj.FreeTextWidgetDefinition != nil { - return json.Marshal(&obj.FreeTextWidgetDefinition) - } - - if obj.GeomapWidgetDefinition != nil { - return json.Marshal(&obj.GeomapWidgetDefinition) - } - - if obj.GroupWidgetDefinition != nil { - return json.Marshal(&obj.GroupWidgetDefinition) - } - - if obj.HeatMapWidgetDefinition != nil { - return json.Marshal(&obj.HeatMapWidgetDefinition) - } - - if obj.HostMapWidgetDefinition != nil { - return json.Marshal(&obj.HostMapWidgetDefinition) - } - - if obj.IFrameWidgetDefinition != nil { - return json.Marshal(&obj.IFrameWidgetDefinition) - } - - if obj.ImageWidgetDefinition != nil { - return json.Marshal(&obj.ImageWidgetDefinition) - } - - if obj.LogStreamWidgetDefinition != nil { - return json.Marshal(&obj.LogStreamWidgetDefinition) - } - - if obj.MonitorSummaryWidgetDefinition != nil { - return json.Marshal(&obj.MonitorSummaryWidgetDefinition) - } - - if obj.NoteWidgetDefinition != nil { - return json.Marshal(&obj.NoteWidgetDefinition) - } - - if obj.QueryValueWidgetDefinition != nil { - return json.Marshal(&obj.QueryValueWidgetDefinition) - } - - if obj.ScatterPlotWidgetDefinition != nil { - return json.Marshal(&obj.ScatterPlotWidgetDefinition) - } - - if obj.SLOWidgetDefinition != nil { - return json.Marshal(&obj.SLOWidgetDefinition) - } - - if obj.ServiceMapWidgetDefinition != nil { - return json.Marshal(&obj.ServiceMapWidgetDefinition) - } - - if obj.ServiceSummaryWidgetDefinition != nil { - return json.Marshal(&obj.ServiceSummaryWidgetDefinition) - } - - if obj.SunburstWidgetDefinition != nil { - return json.Marshal(&obj.SunburstWidgetDefinition) - } - - if obj.TableWidgetDefinition != nil { - return json.Marshal(&obj.TableWidgetDefinition) - } - - if obj.TimeseriesWidgetDefinition != nil { - return json.Marshal(&obj.TimeseriesWidgetDefinition) - } - - if obj.ToplistWidgetDefinition != nil { - return json.Marshal(&obj.ToplistWidgetDefinition) - } - - if obj.TreeMapWidgetDefinition != nil { - return json.Marshal(&obj.TreeMapWidgetDefinition) - } - - if obj.ListStreamWidgetDefinition != nil { - return json.Marshal(&obj.ListStreamWidgetDefinition) - } - - if obj.FunnelWidgetDefinition != nil { - return json.Marshal(&obj.FunnelWidgetDefinition) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *WidgetDefinition) GetActualInstance() interface{} { - if obj.AlertGraphWidgetDefinition != nil { - return obj.AlertGraphWidgetDefinition - } - - if obj.AlertValueWidgetDefinition != nil { - return obj.AlertValueWidgetDefinition - } - - if obj.ChangeWidgetDefinition != nil { - return obj.ChangeWidgetDefinition - } - - if obj.CheckStatusWidgetDefinition != nil { - return obj.CheckStatusWidgetDefinition - } - - if obj.DistributionWidgetDefinition != nil { - return obj.DistributionWidgetDefinition - } - - if obj.EventStreamWidgetDefinition != nil { - return obj.EventStreamWidgetDefinition - } - - if obj.EventTimelineWidgetDefinition != nil { - return obj.EventTimelineWidgetDefinition - } - - if obj.FreeTextWidgetDefinition != nil { - return obj.FreeTextWidgetDefinition - } - - if obj.GeomapWidgetDefinition != nil { - return obj.GeomapWidgetDefinition - } - - if obj.GroupWidgetDefinition != nil { - return obj.GroupWidgetDefinition - } - - if obj.HeatMapWidgetDefinition != nil { - return obj.HeatMapWidgetDefinition - } - - if obj.HostMapWidgetDefinition != nil { - return obj.HostMapWidgetDefinition - } - - if obj.IFrameWidgetDefinition != nil { - return obj.IFrameWidgetDefinition - } - - if obj.ImageWidgetDefinition != nil { - return obj.ImageWidgetDefinition - } - - if obj.LogStreamWidgetDefinition != nil { - return obj.LogStreamWidgetDefinition - } - - if obj.MonitorSummaryWidgetDefinition != nil { - return obj.MonitorSummaryWidgetDefinition - } - - if obj.NoteWidgetDefinition != nil { - return obj.NoteWidgetDefinition - } - - if obj.QueryValueWidgetDefinition != nil { - return obj.QueryValueWidgetDefinition - } - - if obj.ScatterPlotWidgetDefinition != nil { - return obj.ScatterPlotWidgetDefinition - } - - if obj.SLOWidgetDefinition != nil { - return obj.SLOWidgetDefinition - } - - if obj.ServiceMapWidgetDefinition != nil { - return obj.ServiceMapWidgetDefinition - } - - if obj.ServiceSummaryWidgetDefinition != nil { - return obj.ServiceSummaryWidgetDefinition - } - - if obj.SunburstWidgetDefinition != nil { - return obj.SunburstWidgetDefinition - } - - if obj.TableWidgetDefinition != nil { - return obj.TableWidgetDefinition - } - - if obj.TimeseriesWidgetDefinition != nil { - return obj.TimeseriesWidgetDefinition - } - - if obj.ToplistWidgetDefinition != nil { - return obj.ToplistWidgetDefinition - } - - if obj.TreeMapWidgetDefinition != nil { - return obj.TreeMapWidgetDefinition - } - - if obj.ListStreamWidgetDefinition != nil { - return obj.ListStreamWidgetDefinition - } - - if obj.FunnelWidgetDefinition != nil { - return obj.FunnelWidgetDefinition - } - - // all schemas are nil - return nil -} - -// NullableWidgetDefinition handles when a null is used for WidgetDefinition. -type NullableWidgetDefinition struct { - value *WidgetDefinition - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetDefinition) Get() *WidgetDefinition { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetDefinition) Set(val *WidgetDefinition) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetDefinition) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableWidgetDefinition) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetDefinition initializes the struct as if Set has been called. -func NewNullableWidgetDefinition(val *WidgetDefinition) *NullableWidgetDefinition { - return &NullableWidgetDefinition{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetDefinition) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetDefinition) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_display_type.go b/api/v1/datadog/model_widget_display_type.go deleted file mode 100644 index f30e18d8a71..00000000000 --- a/api/v1/datadog/model_widget_display_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetDisplayType Type of display to use for the request. -type WidgetDisplayType string - -// List of WidgetDisplayType. -const ( - WIDGETDISPLAYTYPE_AREA WidgetDisplayType = "area" - WIDGETDISPLAYTYPE_BARS WidgetDisplayType = "bars" - WIDGETDISPLAYTYPE_LINE WidgetDisplayType = "line" -) - -var allowedWidgetDisplayTypeEnumValues = []WidgetDisplayType{ - WIDGETDISPLAYTYPE_AREA, - WIDGETDISPLAYTYPE_BARS, - WIDGETDISPLAYTYPE_LINE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetDisplayType) GetAllowedValues() []WidgetDisplayType { - return allowedWidgetDisplayTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetDisplayType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetDisplayType(value) - return nil -} - -// NewWidgetDisplayTypeFromValue returns a pointer to a valid WidgetDisplayType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetDisplayTypeFromValue(v string) (*WidgetDisplayType, error) { - ev := WidgetDisplayType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetDisplayType: valid values are %v", v, allowedWidgetDisplayTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetDisplayType) IsValid() bool { - for _, existing := range allowedWidgetDisplayTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetDisplayType value. -func (v WidgetDisplayType) Ptr() *WidgetDisplayType { - return &v -} - -// NullableWidgetDisplayType handles when a null is used for WidgetDisplayType. -type NullableWidgetDisplayType struct { - value *WidgetDisplayType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetDisplayType) Get() *WidgetDisplayType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetDisplayType) Set(val *WidgetDisplayType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetDisplayType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetDisplayType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetDisplayType initializes the struct as if Set has been called. -func NewNullableWidgetDisplayType(val *WidgetDisplayType) *NullableWidgetDisplayType { - return &NullableWidgetDisplayType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetDisplayType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetDisplayType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_event.go b/api/v1/datadog/model_widget_event.go deleted file mode 100644 index 641a2ce567e..00000000000 --- a/api/v1/datadog/model_widget_event.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetEvent Event overlay control options. -// -// See the dedicated [Events JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/widget_json/#events-schema) -// to learn how to build the ``. -type WidgetEvent struct { - // Query definition. - Q string `json:"q"` - // The execution method for multi-value filters. - TagsExecution *string `json:"tags_execution,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{} -} - -// NewWidgetEvent instantiates a new WidgetEvent 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 NewWidgetEvent(q string) *WidgetEvent { - this := WidgetEvent{} - this.Q = q - return &this -} - -// NewWidgetEventWithDefaults instantiates a new WidgetEvent 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 NewWidgetEventWithDefaults() *WidgetEvent { - this := WidgetEvent{} - return &this -} - -// GetQ returns the Q field value. -func (o *WidgetEvent) GetQ() string { - if o == nil { - var ret string - return ret - } - return o.Q -} - -// GetQOk returns a tuple with the Q field value -// and a boolean to check if the value has been set. -func (o *WidgetEvent) GetQOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Q, true -} - -// SetQ sets field value. -func (o *WidgetEvent) SetQ(v string) { - o.Q = v -} - -// GetTagsExecution returns the TagsExecution field value if set, zero value otherwise. -func (o *WidgetEvent) GetTagsExecution() string { - if o == nil || o.TagsExecution == nil { - var ret string - return ret - } - return *o.TagsExecution -} - -// GetTagsExecutionOk returns a tuple with the TagsExecution field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetEvent) GetTagsExecutionOk() (*string, bool) { - if o == nil || o.TagsExecution == nil { - return nil, false - } - return o.TagsExecution, true -} - -// HasTagsExecution returns a boolean if a field has been set. -func (o *WidgetEvent) HasTagsExecution() bool { - if o != nil && o.TagsExecution != nil { - return true - } - - return false -} - -// SetTagsExecution gets a reference to the given string and assigns it to the TagsExecution field. -func (o *WidgetEvent) SetTagsExecution(v string) { - o.TagsExecution = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetEvent) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["q"] = o.Q - if o.TagsExecution != nil { - toSerialize["tags_execution"] = o.TagsExecution - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Q *string `json:"q"` - }{} - all := struct { - Q string `json:"q"` - TagsExecution *string `json:"tags_execution,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Q == nil { - return fmt.Errorf("Required field q missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Q = all.Q - o.TagsExecution = all.TagsExecution - return nil -} diff --git a/api/v1/datadog/model_widget_event_size.go b/api/v1/datadog/model_widget_event_size.go deleted file mode 100644 index 6fb987ba7ff..00000000000 --- a/api/v1/datadog/model_widget_event_size.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetEventSize Size to use to display an event. -type WidgetEventSize string - -// List of WidgetEventSize. -const ( - WIDGETEVENTSIZE_SMALL WidgetEventSize = "s" - WIDGETEVENTSIZE_LARGE WidgetEventSize = "l" -) - -var allowedWidgetEventSizeEnumValues = []WidgetEventSize{ - WIDGETEVENTSIZE_SMALL, - WIDGETEVENTSIZE_LARGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetEventSize) GetAllowedValues() []WidgetEventSize { - return allowedWidgetEventSizeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetEventSize) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetEventSize(value) - return nil -} - -// NewWidgetEventSizeFromValue returns a pointer to a valid WidgetEventSize -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetEventSizeFromValue(v string) (*WidgetEventSize, error) { - ev := WidgetEventSize(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetEventSize: valid values are %v", v, allowedWidgetEventSizeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetEventSize) IsValid() bool { - for _, existing := range allowedWidgetEventSizeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetEventSize value. -func (v WidgetEventSize) Ptr() *WidgetEventSize { - return &v -} - -// NullableWidgetEventSize handles when a null is used for WidgetEventSize. -type NullableWidgetEventSize struct { - value *WidgetEventSize - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetEventSize) Get() *WidgetEventSize { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetEventSize) Set(val *WidgetEventSize) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetEventSize) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetEventSize) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetEventSize initializes the struct as if Set has been called. -func NewNullableWidgetEventSize(val *WidgetEventSize) *NullableWidgetEventSize { - return &NullableWidgetEventSize{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetEventSize) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetEventSize) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_field_sort.go b/api/v1/datadog/model_widget_field_sort.go deleted file mode 100644 index 6b3066b37b0..00000000000 --- a/api/v1/datadog/model_widget_field_sort.go +++ /dev/null @@ -1,144 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetFieldSort Which column and order to sort by -type WidgetFieldSort struct { - // Facet path for the column - Column string `json:"column"` - // Widget sorting methods. - Order WidgetSort `json:"order"` - // 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{} -} - -// NewWidgetFieldSort instantiates a new WidgetFieldSort 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 NewWidgetFieldSort(column string, order WidgetSort) *WidgetFieldSort { - this := WidgetFieldSort{} - this.Column = column - this.Order = order - return &this -} - -// NewWidgetFieldSortWithDefaults instantiates a new WidgetFieldSort 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 NewWidgetFieldSortWithDefaults() *WidgetFieldSort { - this := WidgetFieldSort{} - return &this -} - -// GetColumn returns the Column field value. -func (o *WidgetFieldSort) GetColumn() string { - if o == nil { - var ret string - return ret - } - return o.Column -} - -// GetColumnOk returns a tuple with the Column field value -// and a boolean to check if the value has been set. -func (o *WidgetFieldSort) GetColumnOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Column, true -} - -// SetColumn sets field value. -func (o *WidgetFieldSort) SetColumn(v string) { - o.Column = v -} - -// GetOrder returns the Order field value. -func (o *WidgetFieldSort) GetOrder() WidgetSort { - if o == nil { - var ret WidgetSort - return ret - } - return o.Order -} - -// GetOrderOk returns a tuple with the Order field value -// and a boolean to check if the value has been set. -func (o *WidgetFieldSort) GetOrderOk() (*WidgetSort, bool) { - if o == nil { - return nil, false - } - return &o.Order, true -} - -// SetOrder sets field value. -func (o *WidgetFieldSort) SetOrder(v WidgetSort) { - o.Order = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetFieldSort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["column"] = o.Column - toSerialize["order"] = o.Order - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetFieldSort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Column *string `json:"column"` - Order *WidgetSort `json:"order"` - }{} - all := struct { - Column string `json:"column"` - Order WidgetSort `json:"order"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Column == nil { - return fmt.Errorf("Required field column missing") - } - if required.Order == nil { - return fmt.Errorf("Required field order missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Column = all.Column - o.Order = all.Order - return nil -} diff --git a/api/v1/datadog/model_widget_formula.go b/api/v1/datadog/model_widget_formula.go deleted file mode 100644 index 8ddc2fef617..00000000000 --- a/api/v1/datadog/model_widget_formula.go +++ /dev/null @@ -1,274 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetFormula Formula to be used in a widget query. -type WidgetFormula struct { - // Expression alias. - Alias *string `json:"alias,omitempty"` - // Define a display mode for the table cell. - CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` - // List of conditional formats. - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - // String expression built from queries, formulas, and functions. - Formula string `json:"formula"` - // Options for limiting results returned. - Limit *WidgetFormulaLimit `json:"limit,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{} -} - -// NewWidgetFormula instantiates a new WidgetFormula 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 NewWidgetFormula(formula string) *WidgetFormula { - this := WidgetFormula{} - this.Formula = formula - return &this -} - -// NewWidgetFormulaWithDefaults instantiates a new WidgetFormula 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 NewWidgetFormulaWithDefaults() *WidgetFormula { - this := WidgetFormula{} - return &this -} - -// GetAlias returns the Alias field value if set, zero value otherwise. -func (o *WidgetFormula) GetAlias() string { - if o == nil || o.Alias == nil { - var ret string - return ret - } - return *o.Alias -} - -// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetFormula) GetAliasOk() (*string, bool) { - if o == nil || o.Alias == nil { - return nil, false - } - return o.Alias, true -} - -// HasAlias returns a boolean if a field has been set. -func (o *WidgetFormula) HasAlias() bool { - if o != nil && o.Alias != nil { - return true - } - - return false -} - -// SetAlias gets a reference to the given string and assigns it to the Alias field. -func (o *WidgetFormula) SetAlias(v string) { - o.Alias = &v -} - -// GetCellDisplayMode returns the CellDisplayMode field value if set, zero value otherwise. -func (o *WidgetFormula) GetCellDisplayMode() TableWidgetCellDisplayMode { - if o == nil || o.CellDisplayMode == nil { - var ret TableWidgetCellDisplayMode - return ret - } - return *o.CellDisplayMode -} - -// GetCellDisplayModeOk returns a tuple with the CellDisplayMode field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetFormula) GetCellDisplayModeOk() (*TableWidgetCellDisplayMode, bool) { - if o == nil || o.CellDisplayMode == nil { - return nil, false - } - return o.CellDisplayMode, true -} - -// HasCellDisplayMode returns a boolean if a field has been set. -func (o *WidgetFormula) HasCellDisplayMode() bool { - if o != nil && o.CellDisplayMode != nil { - return true - } - - return false -} - -// SetCellDisplayMode gets a reference to the given TableWidgetCellDisplayMode and assigns it to the CellDisplayMode field. -func (o *WidgetFormula) SetCellDisplayMode(v TableWidgetCellDisplayMode) { - o.CellDisplayMode = &v -} - -// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. -func (o *WidgetFormula) GetConditionalFormats() []WidgetConditionalFormat { - if o == nil || o.ConditionalFormats == nil { - var ret []WidgetConditionalFormat - return ret - } - return o.ConditionalFormats -} - -// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetFormula) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { - if o == nil || o.ConditionalFormats == nil { - return nil, false - } - return &o.ConditionalFormats, true -} - -// HasConditionalFormats returns a boolean if a field has been set. -func (o *WidgetFormula) HasConditionalFormats() bool { - if o != nil && o.ConditionalFormats != nil { - return true - } - - return false -} - -// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. -func (o *WidgetFormula) SetConditionalFormats(v []WidgetConditionalFormat) { - o.ConditionalFormats = v -} - -// GetFormula returns the Formula field value. -func (o *WidgetFormula) GetFormula() string { - if o == nil { - var ret string - return ret - } - return o.Formula -} - -// GetFormulaOk returns a tuple with the Formula field value -// and a boolean to check if the value has been set. -func (o *WidgetFormula) GetFormulaOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Formula, true -} - -// SetFormula sets field value. -func (o *WidgetFormula) SetFormula(v string) { - o.Formula = v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *WidgetFormula) GetLimit() WidgetFormulaLimit { - if o == nil || o.Limit == nil { - var ret WidgetFormulaLimit - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetFormula) GetLimitOk() (*WidgetFormulaLimit, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *WidgetFormula) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given WidgetFormulaLimit and assigns it to the Limit field. -func (o *WidgetFormula) SetLimit(v WidgetFormulaLimit) { - o.Limit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetFormula) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Alias != nil { - toSerialize["alias"] = o.Alias - } - if o.CellDisplayMode != nil { - toSerialize["cell_display_mode"] = o.CellDisplayMode - } - if o.ConditionalFormats != nil { - toSerialize["conditional_formats"] = o.ConditionalFormats - } - toSerialize["formula"] = o.Formula - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Formula *string `json:"formula"` - }{} - all := struct { - Alias *string `json:"alias,omitempty"` - CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` - ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - Formula string `json:"formula"` - Limit *WidgetFormulaLimit `json:"limit,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Formula == nil { - return fmt.Errorf("Required field formula missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.CellDisplayMode; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Alias = all.Alias - o.CellDisplayMode = all.CellDisplayMode - o.ConditionalFormats = all.ConditionalFormats - o.Formula = all.Formula - if all.Limit != nil && all.Limit.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Limit = all.Limit - return nil -} diff --git a/api/v1/datadog/model_widget_formula_limit.go b/api/v1/datadog/model_widget_formula_limit.go deleted file mode 100644 index 80f36c5ecc1..00000000000 --- a/api/v1/datadog/model_widget_formula_limit.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WidgetFormulaLimit Options for limiting results returned. -type WidgetFormulaLimit struct { - // Number of results to return. - Count *int64 `json:"count,omitempty"` - // Direction of sort. - Order *QuerySortOrder `json:"order,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{} -} - -// NewWidgetFormulaLimit instantiates a new WidgetFormulaLimit 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 NewWidgetFormulaLimit() *WidgetFormulaLimit { - this := WidgetFormulaLimit{} - var order QuerySortOrder = QUERYSORTORDER_DESC - this.Order = &order - return &this -} - -// NewWidgetFormulaLimitWithDefaults instantiates a new WidgetFormulaLimit 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 NewWidgetFormulaLimitWithDefaults() *WidgetFormulaLimit { - this := WidgetFormulaLimit{} - var order QuerySortOrder = QUERYSORTORDER_DESC - this.Order = &order - return &this -} - -// GetCount returns the Count field value if set, zero value otherwise. -func (o *WidgetFormulaLimit) GetCount() int64 { - if o == nil || o.Count == nil { - var ret int64 - return ret - } - return *o.Count -} - -// GetCountOk returns a tuple with the Count field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetFormulaLimit) GetCountOk() (*int64, bool) { - if o == nil || o.Count == nil { - return nil, false - } - return o.Count, true -} - -// HasCount returns a boolean if a field has been set. -func (o *WidgetFormulaLimit) HasCount() bool { - if o != nil && o.Count != nil { - return true - } - - return false -} - -// SetCount gets a reference to the given int64 and assigns it to the Count field. -func (o *WidgetFormulaLimit) SetCount(v int64) { - o.Count = &v -} - -// GetOrder returns the Order field value if set, zero value otherwise. -func (o *WidgetFormulaLimit) GetOrder() QuerySortOrder { - if o == nil || o.Order == nil { - var ret QuerySortOrder - return ret - } - return *o.Order -} - -// GetOrderOk returns a tuple with the Order field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetFormulaLimit) GetOrderOk() (*QuerySortOrder, bool) { - if o == nil || o.Order == nil { - return nil, false - } - return o.Order, true -} - -// HasOrder returns a boolean if a field has been set. -func (o *WidgetFormulaLimit) HasOrder() bool { - if o != nil && o.Order != nil { - return true - } - - return false -} - -// SetOrder gets a reference to the given QuerySortOrder and assigns it to the Order field. -func (o *WidgetFormulaLimit) SetOrder(v QuerySortOrder) { - o.Order = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetFormulaLimit) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Count != nil { - toSerialize["count"] = o.Count - } - if o.Order != nil { - toSerialize["order"] = o.Order - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetFormulaLimit) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Count *int64 `json:"count,omitempty"` - Order *QuerySortOrder `json:"order,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Count = all.Count - o.Order = all.Order - return nil -} diff --git a/api/v1/datadog/model_widget_grouping.go b/api/v1/datadog/model_widget_grouping.go deleted file mode 100644 index e55212d35d9..00000000000 --- a/api/v1/datadog/model_widget_grouping.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetGrouping The kind of grouping to use. -type WidgetGrouping string - -// List of WidgetGrouping. -const ( - WIDGETGROUPING_CHECK WidgetGrouping = "check" - WIDGETGROUPING_CLUSTER WidgetGrouping = "cluster" -) - -var allowedWidgetGroupingEnumValues = []WidgetGrouping{ - WIDGETGROUPING_CHECK, - WIDGETGROUPING_CLUSTER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetGrouping) GetAllowedValues() []WidgetGrouping { - return allowedWidgetGroupingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetGrouping) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetGrouping(value) - return nil -} - -// NewWidgetGroupingFromValue returns a pointer to a valid WidgetGrouping -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetGroupingFromValue(v string) (*WidgetGrouping, error) { - ev := WidgetGrouping(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetGrouping: valid values are %v", v, allowedWidgetGroupingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetGrouping) IsValid() bool { - for _, existing := range allowedWidgetGroupingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetGrouping value. -func (v WidgetGrouping) Ptr() *WidgetGrouping { - return &v -} - -// NullableWidgetGrouping handles when a null is used for WidgetGrouping. -type NullableWidgetGrouping struct { - value *WidgetGrouping - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetGrouping) Get() *WidgetGrouping { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetGrouping) Set(val *WidgetGrouping) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetGrouping) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetGrouping) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetGrouping initializes the struct as if Set has been called. -func NewNullableWidgetGrouping(val *WidgetGrouping) *NullableWidgetGrouping { - return &NullableWidgetGrouping{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetGrouping) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetGrouping) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_horizontal_align.go b/api/v1/datadog/model_widget_horizontal_align.go deleted file mode 100644 index 9e0bd5c1f0e..00000000000 --- a/api/v1/datadog/model_widget_horizontal_align.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetHorizontalAlign Horizontal alignment. -type WidgetHorizontalAlign string - -// List of WidgetHorizontalAlign. -const ( - WIDGETHORIZONTALALIGN_CENTER WidgetHorizontalAlign = "center" - WIDGETHORIZONTALALIGN_LEFT WidgetHorizontalAlign = "left" - WIDGETHORIZONTALALIGN_RIGHT WidgetHorizontalAlign = "right" -) - -var allowedWidgetHorizontalAlignEnumValues = []WidgetHorizontalAlign{ - WIDGETHORIZONTALALIGN_CENTER, - WIDGETHORIZONTALALIGN_LEFT, - WIDGETHORIZONTALALIGN_RIGHT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetHorizontalAlign) GetAllowedValues() []WidgetHorizontalAlign { - return allowedWidgetHorizontalAlignEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetHorizontalAlign) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetHorizontalAlign(value) - return nil -} - -// NewWidgetHorizontalAlignFromValue returns a pointer to a valid WidgetHorizontalAlign -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetHorizontalAlignFromValue(v string) (*WidgetHorizontalAlign, error) { - ev := WidgetHorizontalAlign(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetHorizontalAlign: valid values are %v", v, allowedWidgetHorizontalAlignEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetHorizontalAlign) IsValid() bool { - for _, existing := range allowedWidgetHorizontalAlignEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetHorizontalAlign value. -func (v WidgetHorizontalAlign) Ptr() *WidgetHorizontalAlign { - return &v -} - -// NullableWidgetHorizontalAlign handles when a null is used for WidgetHorizontalAlign. -type NullableWidgetHorizontalAlign struct { - value *WidgetHorizontalAlign - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetHorizontalAlign) Get() *WidgetHorizontalAlign { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetHorizontalAlign) Set(val *WidgetHorizontalAlign) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetHorizontalAlign) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetHorizontalAlign) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetHorizontalAlign initializes the struct as if Set has been called. -func NewNullableWidgetHorizontalAlign(val *WidgetHorizontalAlign) *NullableWidgetHorizontalAlign { - return &NullableWidgetHorizontalAlign{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetHorizontalAlign) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetHorizontalAlign) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_image_sizing.go b/api/v1/datadog/model_widget_image_sizing.go deleted file mode 100644 index 5bd7eb92f4c..00000000000 --- a/api/v1/datadog/model_widget_image_sizing.go +++ /dev/null @@ -1,122 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetImageSizing How to size the image on the widget. The values are based on the image `object-fit` CSS properties. -// **Note**: `zoom`, `fit` and `center` values are deprecated. -type WidgetImageSizing string - -// List of WidgetImageSizing. -const ( - WIDGETIMAGESIZING_FILL WidgetImageSizing = "fill" - WIDGETIMAGESIZING_CONTAIN WidgetImageSizing = "contain" - WIDGETIMAGESIZING_COVER WidgetImageSizing = "cover" - WIDGETIMAGESIZING_NONE WidgetImageSizing = "none" - WIDGETIMAGESIZING_SCALEDOWN WidgetImageSizing = "scale-down" - WIDGETIMAGESIZING_ZOOM WidgetImageSizing = "zoom" - WIDGETIMAGESIZING_FIT WidgetImageSizing = "fit" - WIDGETIMAGESIZING_CENTER WidgetImageSizing = "center" -) - -var allowedWidgetImageSizingEnumValues = []WidgetImageSizing{ - WIDGETIMAGESIZING_FILL, - WIDGETIMAGESIZING_CONTAIN, - WIDGETIMAGESIZING_COVER, - WIDGETIMAGESIZING_NONE, - WIDGETIMAGESIZING_SCALEDOWN, - WIDGETIMAGESIZING_ZOOM, - WIDGETIMAGESIZING_FIT, - WIDGETIMAGESIZING_CENTER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetImageSizing) GetAllowedValues() []WidgetImageSizing { - return allowedWidgetImageSizingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetImageSizing) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetImageSizing(value) - return nil -} - -// NewWidgetImageSizingFromValue returns a pointer to a valid WidgetImageSizing -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetImageSizingFromValue(v string) (*WidgetImageSizing, error) { - ev := WidgetImageSizing(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetImageSizing: valid values are %v", v, allowedWidgetImageSizingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetImageSizing) IsValid() bool { - for _, existing := range allowedWidgetImageSizingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetImageSizing value. -func (v WidgetImageSizing) Ptr() *WidgetImageSizing { - return &v -} - -// NullableWidgetImageSizing handles when a null is used for WidgetImageSizing. -type NullableWidgetImageSizing struct { - value *WidgetImageSizing - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetImageSizing) Get() *WidgetImageSizing { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetImageSizing) Set(val *WidgetImageSizing) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetImageSizing) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetImageSizing) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetImageSizing initializes the struct as if Set has been called. -func NewNullableWidgetImageSizing(val *WidgetImageSizing) *NullableWidgetImageSizing { - return &NullableWidgetImageSizing{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetImageSizing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetImageSizing) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_layout.go b/api/v1/datadog/model_widget_layout.go deleted file mode 100644 index 38369b8a64c..00000000000 --- a/api/v1/datadog/model_widget_layout.go +++ /dev/null @@ -1,242 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetLayout The layout for a widget on a `free` or **new dashboard layout** dashboard. -type WidgetLayout struct { - // The height of the widget. Should be a non-negative integer. - Height int64 `json:"height"` - // Whether the widget should be the first one on the second column in high density or not. - // **Note**: Only for the **new dashboard layout** and only one widget in the dashboard should have this property set to `true`. - IsColumnBreak *bool `json:"is_column_break,omitempty"` - // The width of the widget. Should be a non-negative integer. - Width int64 `json:"width"` - // The position of the widget on the x (horizontal) axis. Should be a non-negative integer. - X int64 `json:"x"` - // The position of the widget on the y (vertical) axis. Should be a non-negative integer. - Y int64 `json:"y"` - // 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{} -} - -// NewWidgetLayout instantiates a new WidgetLayout 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 NewWidgetLayout(height int64, width int64, x int64, y int64) *WidgetLayout { - this := WidgetLayout{} - this.Height = height - this.Width = width - this.X = x - this.Y = y - return &this -} - -// NewWidgetLayoutWithDefaults instantiates a new WidgetLayout 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 NewWidgetLayoutWithDefaults() *WidgetLayout { - this := WidgetLayout{} - return &this -} - -// GetHeight returns the Height field value. -func (o *WidgetLayout) GetHeight() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Height -} - -// GetHeightOk returns a tuple with the Height field value -// and a boolean to check if the value has been set. -func (o *WidgetLayout) GetHeightOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Height, true -} - -// SetHeight sets field value. -func (o *WidgetLayout) SetHeight(v int64) { - o.Height = v -} - -// GetIsColumnBreak returns the IsColumnBreak field value if set, zero value otherwise. -func (o *WidgetLayout) GetIsColumnBreak() bool { - if o == nil || o.IsColumnBreak == nil { - var ret bool - return ret - } - return *o.IsColumnBreak -} - -// GetIsColumnBreakOk returns a tuple with the IsColumnBreak field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetLayout) GetIsColumnBreakOk() (*bool, bool) { - if o == nil || o.IsColumnBreak == nil { - return nil, false - } - return o.IsColumnBreak, true -} - -// HasIsColumnBreak returns a boolean if a field has been set. -func (o *WidgetLayout) HasIsColumnBreak() bool { - if o != nil && o.IsColumnBreak != nil { - return true - } - - return false -} - -// SetIsColumnBreak gets a reference to the given bool and assigns it to the IsColumnBreak field. -func (o *WidgetLayout) SetIsColumnBreak(v bool) { - o.IsColumnBreak = &v -} - -// GetWidth returns the Width field value. -func (o *WidgetLayout) GetWidth() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Width -} - -// GetWidthOk returns a tuple with the Width field value -// and a boolean to check if the value has been set. -func (o *WidgetLayout) GetWidthOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Width, true -} - -// SetWidth sets field value. -func (o *WidgetLayout) SetWidth(v int64) { - o.Width = v -} - -// GetX returns the X field value. -func (o *WidgetLayout) GetX() int64 { - if o == nil { - var ret int64 - return ret - } - return o.X -} - -// GetXOk returns a tuple with the X field value -// and a boolean to check if the value has been set. -func (o *WidgetLayout) GetXOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.X, true -} - -// SetX sets field value. -func (o *WidgetLayout) SetX(v int64) { - o.X = v -} - -// GetY returns the Y field value. -func (o *WidgetLayout) GetY() int64 { - if o == nil { - var ret int64 - return ret - } - return o.Y -} - -// GetYOk returns a tuple with the Y field value -// and a boolean to check if the value has been set. -func (o *WidgetLayout) GetYOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Y, true -} - -// SetY sets field value. -func (o *WidgetLayout) SetY(v int64) { - o.Y = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetLayout) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["height"] = o.Height - if o.IsColumnBreak != nil { - toSerialize["is_column_break"] = o.IsColumnBreak - } - toSerialize["width"] = o.Width - toSerialize["x"] = o.X - toSerialize["y"] = o.Y - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetLayout) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Height *int64 `json:"height"` - Width *int64 `json:"width"` - X *int64 `json:"x"` - Y *int64 `json:"y"` - }{} - all := struct { - Height int64 `json:"height"` - IsColumnBreak *bool `json:"is_column_break,omitempty"` - Width int64 `json:"width"` - X int64 `json:"x"` - Y int64 `json:"y"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Height == nil { - return fmt.Errorf("Required field height missing") - } - if required.Width == nil { - return fmt.Errorf("Required field width missing") - } - if required.X == nil { - return fmt.Errorf("Required field x missing") - } - if required.Y == nil { - return fmt.Errorf("Required field y missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Height = all.Height - o.IsColumnBreak = all.IsColumnBreak - o.Width = all.Width - o.X = all.X - o.Y = all.Y - return nil -} diff --git a/api/v1/datadog/model_widget_layout_type.go b/api/v1/datadog/model_widget_layout_type.go deleted file mode 100644 index 6749c249c0c..00000000000 --- a/api/v1/datadog/model_widget_layout_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetLayoutType Layout type of the group. -type WidgetLayoutType string - -// List of WidgetLayoutType. -const ( - WIDGETLAYOUTTYPE_ORDERED WidgetLayoutType = "ordered" -) - -var allowedWidgetLayoutTypeEnumValues = []WidgetLayoutType{ - WIDGETLAYOUTTYPE_ORDERED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetLayoutType) GetAllowedValues() []WidgetLayoutType { - return allowedWidgetLayoutTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetLayoutType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetLayoutType(value) - return nil -} - -// NewWidgetLayoutTypeFromValue returns a pointer to a valid WidgetLayoutType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetLayoutTypeFromValue(v string) (*WidgetLayoutType, error) { - ev := WidgetLayoutType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetLayoutType: valid values are %v", v, allowedWidgetLayoutTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetLayoutType) IsValid() bool { - for _, existing := range allowedWidgetLayoutTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetLayoutType value. -func (v WidgetLayoutType) Ptr() *WidgetLayoutType { - return &v -} - -// NullableWidgetLayoutType handles when a null is used for WidgetLayoutType. -type NullableWidgetLayoutType struct { - value *WidgetLayoutType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLayoutType) Get() *WidgetLayoutType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLayoutType) Set(val *WidgetLayoutType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLayoutType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLayoutType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLayoutType initializes the struct as if Set has been called. -func NewNullableWidgetLayoutType(val *WidgetLayoutType) *NullableWidgetLayoutType { - return &NullableWidgetLayoutType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLayoutType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLayoutType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_line_type.go b/api/v1/datadog/model_widget_line_type.go deleted file mode 100644 index 2bc795659d6..00000000000 --- a/api/v1/datadog/model_widget_line_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetLineType Type of lines displayed. -type WidgetLineType string - -// List of WidgetLineType. -const ( - WIDGETLINETYPE_DASHED WidgetLineType = "dashed" - WIDGETLINETYPE_DOTTED WidgetLineType = "dotted" - WIDGETLINETYPE_SOLID WidgetLineType = "solid" -) - -var allowedWidgetLineTypeEnumValues = []WidgetLineType{ - WIDGETLINETYPE_DASHED, - WIDGETLINETYPE_DOTTED, - WIDGETLINETYPE_SOLID, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetLineType) GetAllowedValues() []WidgetLineType { - return allowedWidgetLineTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetLineType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetLineType(value) - return nil -} - -// NewWidgetLineTypeFromValue returns a pointer to a valid WidgetLineType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetLineTypeFromValue(v string) (*WidgetLineType, error) { - ev := WidgetLineType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetLineType: valid values are %v", v, allowedWidgetLineTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetLineType) IsValid() bool { - for _, existing := range allowedWidgetLineTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetLineType value. -func (v WidgetLineType) Ptr() *WidgetLineType { - return &v -} - -// NullableWidgetLineType handles when a null is used for WidgetLineType. -type NullableWidgetLineType struct { - value *WidgetLineType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLineType) Get() *WidgetLineType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLineType) Set(val *WidgetLineType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLineType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLineType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLineType initializes the struct as if Set has been called. -func NewNullableWidgetLineType(val *WidgetLineType) *NullableWidgetLineType { - return &NullableWidgetLineType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLineType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLineType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_line_width.go b/api/v1/datadog/model_widget_line_width.go deleted file mode 100644 index 2b98f1fbcc6..00000000000 --- a/api/v1/datadog/model_widget_line_width.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetLineWidth Width of line displayed. -type WidgetLineWidth string - -// List of WidgetLineWidth. -const ( - WIDGETLINEWIDTH_NORMAL WidgetLineWidth = "normal" - WIDGETLINEWIDTH_THICK WidgetLineWidth = "thick" - WIDGETLINEWIDTH_THIN WidgetLineWidth = "thin" -) - -var allowedWidgetLineWidthEnumValues = []WidgetLineWidth{ - WIDGETLINEWIDTH_NORMAL, - WIDGETLINEWIDTH_THICK, - WIDGETLINEWIDTH_THIN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetLineWidth) GetAllowedValues() []WidgetLineWidth { - return allowedWidgetLineWidthEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetLineWidth) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetLineWidth(value) - return nil -} - -// NewWidgetLineWidthFromValue returns a pointer to a valid WidgetLineWidth -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetLineWidthFromValue(v string) (*WidgetLineWidth, error) { - ev := WidgetLineWidth(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetLineWidth: valid values are %v", v, allowedWidgetLineWidthEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetLineWidth) IsValid() bool { - for _, existing := range allowedWidgetLineWidthEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetLineWidth value. -func (v WidgetLineWidth) Ptr() *WidgetLineWidth { - return &v -} - -// NullableWidgetLineWidth handles when a null is used for WidgetLineWidth. -type NullableWidgetLineWidth struct { - value *WidgetLineWidth - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLineWidth) Get() *WidgetLineWidth { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLineWidth) Set(val *WidgetLineWidth) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLineWidth) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLineWidth) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLineWidth initializes the struct as if Set has been called. -func NewNullableWidgetLineWidth(val *WidgetLineWidth) *NullableWidgetLineWidth { - return &NullableWidgetLineWidth{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLineWidth) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLineWidth) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_live_span.go b/api/v1/datadog/model_widget_live_span.go deleted file mode 100644 index c027024abac..00000000000 --- a/api/v1/datadog/model_widget_live_span.go +++ /dev/null @@ -1,135 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetLiveSpan The available timeframes depend on the widget you are using. -type WidgetLiveSpan string - -// List of WidgetLiveSpan. -const ( - WIDGETLIVESPAN_PAST_ONE_MINUTE WidgetLiveSpan = "1m" - WIDGETLIVESPAN_PAST_FIVE_MINUTES WidgetLiveSpan = "5m" - WIDGETLIVESPAN_PAST_TEN_MINUTES WidgetLiveSpan = "10m" - WIDGETLIVESPAN_PAST_FIFTEEN_MINUTES WidgetLiveSpan = "15m" - WIDGETLIVESPAN_PAST_THIRTY_MINUTES WidgetLiveSpan = "30m" - WIDGETLIVESPAN_PAST_ONE_HOUR WidgetLiveSpan = "1h" - WIDGETLIVESPAN_PAST_FOUR_HOURS WidgetLiveSpan = "4h" - WIDGETLIVESPAN_PAST_ONE_DAY WidgetLiveSpan = "1d" - WIDGETLIVESPAN_PAST_TWO_DAYS WidgetLiveSpan = "2d" - WIDGETLIVESPAN_PAST_ONE_WEEK WidgetLiveSpan = "1w" - WIDGETLIVESPAN_PAST_ONE_MONTH WidgetLiveSpan = "1mo" - WIDGETLIVESPAN_PAST_THREE_MONTHS WidgetLiveSpan = "3mo" - WIDGETLIVESPAN_PAST_SIX_MONTHS WidgetLiveSpan = "6mo" - WIDGETLIVESPAN_PAST_ONE_YEAR WidgetLiveSpan = "1y" - WIDGETLIVESPAN_ALERT WidgetLiveSpan = "alert" -) - -var allowedWidgetLiveSpanEnumValues = []WidgetLiveSpan{ - WIDGETLIVESPAN_PAST_ONE_MINUTE, - WIDGETLIVESPAN_PAST_FIVE_MINUTES, - WIDGETLIVESPAN_PAST_TEN_MINUTES, - WIDGETLIVESPAN_PAST_FIFTEEN_MINUTES, - WIDGETLIVESPAN_PAST_THIRTY_MINUTES, - WIDGETLIVESPAN_PAST_ONE_HOUR, - WIDGETLIVESPAN_PAST_FOUR_HOURS, - WIDGETLIVESPAN_PAST_ONE_DAY, - WIDGETLIVESPAN_PAST_TWO_DAYS, - WIDGETLIVESPAN_PAST_ONE_WEEK, - WIDGETLIVESPAN_PAST_ONE_MONTH, - WIDGETLIVESPAN_PAST_THREE_MONTHS, - WIDGETLIVESPAN_PAST_SIX_MONTHS, - WIDGETLIVESPAN_PAST_ONE_YEAR, - WIDGETLIVESPAN_ALERT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetLiveSpan) GetAllowedValues() []WidgetLiveSpan { - return allowedWidgetLiveSpanEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetLiveSpan) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetLiveSpan(value) - return nil -} - -// NewWidgetLiveSpanFromValue returns a pointer to a valid WidgetLiveSpan -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetLiveSpanFromValue(v string) (*WidgetLiveSpan, error) { - ev := WidgetLiveSpan(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetLiveSpan: valid values are %v", v, allowedWidgetLiveSpanEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetLiveSpan) IsValid() bool { - for _, existing := range allowedWidgetLiveSpanEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetLiveSpan value. -func (v WidgetLiveSpan) Ptr() *WidgetLiveSpan { - return &v -} - -// NullableWidgetLiveSpan handles when a null is used for WidgetLiveSpan. -type NullableWidgetLiveSpan struct { - value *WidgetLiveSpan - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetLiveSpan) Get() *WidgetLiveSpan { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetLiveSpan) Set(val *WidgetLiveSpan) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetLiveSpan) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetLiveSpan) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetLiveSpan initializes the struct as if Set has been called. -func NewNullableWidgetLiveSpan(val *WidgetLiveSpan) *NullableWidgetLiveSpan { - return &NullableWidgetLiveSpan{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetLiveSpan) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetLiveSpan) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_margin.go b/api/v1/datadog/model_widget_margin.go deleted file mode 100644 index 20f504f70f8..00000000000 --- a/api/v1/datadog/model_widget_margin.go +++ /dev/null @@ -1,116 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetMargin Size of the margins around the image. -// **Note**: `small` and `large` values are deprecated. -type WidgetMargin string - -// List of WidgetMargin. -const ( - WIDGETMARGIN_SM WidgetMargin = "sm" - WIDGETMARGIN_MD WidgetMargin = "md" - WIDGETMARGIN_LG WidgetMargin = "lg" - WIDGETMARGIN_SMALL WidgetMargin = "small" - WIDGETMARGIN_LARGE WidgetMargin = "large" -) - -var allowedWidgetMarginEnumValues = []WidgetMargin{ - WIDGETMARGIN_SM, - WIDGETMARGIN_MD, - WIDGETMARGIN_LG, - WIDGETMARGIN_SMALL, - WIDGETMARGIN_LARGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetMargin) GetAllowedValues() []WidgetMargin { - return allowedWidgetMarginEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetMargin) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetMargin(value) - return nil -} - -// NewWidgetMarginFromValue returns a pointer to a valid WidgetMargin -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetMarginFromValue(v string) (*WidgetMargin, error) { - ev := WidgetMargin(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetMargin: valid values are %v", v, allowedWidgetMarginEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetMargin) IsValid() bool { - for _, existing := range allowedWidgetMarginEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetMargin value. -func (v WidgetMargin) Ptr() *WidgetMargin { - return &v -} - -// NullableWidgetMargin handles when a null is used for WidgetMargin. -type NullableWidgetMargin struct { - value *WidgetMargin - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMargin) Get() *WidgetMargin { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMargin) Set(val *WidgetMargin) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMargin) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMargin) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMargin initializes the struct as if Set has been called. -func NewNullableWidgetMargin(val *WidgetMargin) *NullableWidgetMargin { - return &NullableWidgetMargin{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMargin) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMargin) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_marker.go b/api/v1/datadog/model_widget_marker.go deleted file mode 100644 index a70872e463b..00000000000 --- a/api/v1/datadog/model_widget_marker.go +++ /dev/null @@ -1,224 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetMarker Markers allow you to add visual conditional formatting for your graphs. -type WidgetMarker struct { - // Combination of: - // - A severity error, warning, ok, or info - // - A line type: dashed, solid, or bold - // In this case of a Distribution widget, this can be set to be `x_axis_percentile`. - // - DisplayType *string `json:"display_type,omitempty"` - // Label to display over the marker. - Label *string `json:"label,omitempty"` - // Timestamp for the widget. - Time *string `json:"time,omitempty"` - // Value to apply. Can be a single value y = 15 or a range of values 0 < y < 10. - Value string `json:"value"` - // 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{} -} - -// NewWidgetMarker instantiates a new WidgetMarker 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 NewWidgetMarker(value string) *WidgetMarker { - this := WidgetMarker{} - this.Value = value - return &this -} - -// NewWidgetMarkerWithDefaults instantiates a new WidgetMarker 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 NewWidgetMarkerWithDefaults() *WidgetMarker { - this := WidgetMarker{} - return &this -} - -// GetDisplayType returns the DisplayType field value if set, zero value otherwise. -func (o *WidgetMarker) GetDisplayType() string { - if o == nil || o.DisplayType == nil { - var ret string - return ret - } - return *o.DisplayType -} - -// GetDisplayTypeOk returns a tuple with the DisplayType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetMarker) GetDisplayTypeOk() (*string, bool) { - if o == nil || o.DisplayType == nil { - return nil, false - } - return o.DisplayType, true -} - -// HasDisplayType returns a boolean if a field has been set. -func (o *WidgetMarker) HasDisplayType() bool { - if o != nil && o.DisplayType != nil { - return true - } - - return false -} - -// SetDisplayType gets a reference to the given string and assigns it to the DisplayType field. -func (o *WidgetMarker) SetDisplayType(v string) { - o.DisplayType = &v -} - -// GetLabel returns the Label field value if set, zero value otherwise. -func (o *WidgetMarker) GetLabel() string { - if o == nil || o.Label == nil { - var ret string - return ret - } - return *o.Label -} - -// GetLabelOk returns a tuple with the Label field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetMarker) GetLabelOk() (*string, bool) { - if o == nil || o.Label == nil { - return nil, false - } - return o.Label, true -} - -// HasLabel returns a boolean if a field has been set. -func (o *WidgetMarker) HasLabel() bool { - if o != nil && o.Label != nil { - return true - } - - return false -} - -// SetLabel gets a reference to the given string and assigns it to the Label field. -func (o *WidgetMarker) SetLabel(v string) { - o.Label = &v -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *WidgetMarker) GetTime() string { - if o == nil || o.Time == nil { - var ret string - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetMarker) GetTimeOk() (*string, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *WidgetMarker) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given string and assigns it to the Time field. -func (o *WidgetMarker) SetTime(v string) { - o.Time = &v -} - -// GetValue returns the Value field value. -func (o *WidgetMarker) GetValue() string { - if o == nil { - var ret string - return ret - } - return o.Value -} - -// GetValueOk returns a tuple with the Value field value -// and a boolean to check if the value has been set. -func (o *WidgetMarker) GetValueOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Value, true -} - -// SetValue sets field value. -func (o *WidgetMarker) SetValue(v string) { - o.Value = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetMarker) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DisplayType != nil { - toSerialize["display_type"] = o.DisplayType - } - if o.Label != nil { - toSerialize["label"] = o.Label - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - toSerialize["value"] = o.Value - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Value *string `json:"value"` - }{} - all := struct { - DisplayType *string `json:"display_type,omitempty"` - Label *string `json:"label,omitempty"` - Time *string `json:"time,omitempty"` - Value string `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Value == nil { - return fmt.Errorf("Required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DisplayType = all.DisplayType - o.Label = all.Label - o.Time = all.Time - o.Value = all.Value - return nil -} diff --git a/api/v1/datadog/model_widget_message_display.go b/api/v1/datadog/model_widget_message_display.go deleted file mode 100644 index e5039100d3f..00000000000 --- a/api/v1/datadog/model_widget_message_display.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetMessageDisplay Amount of log lines to display -type WidgetMessageDisplay string - -// List of WidgetMessageDisplay. -const ( - WIDGETMESSAGEDISPLAY_INLINE WidgetMessageDisplay = "inline" - WIDGETMESSAGEDISPLAY_EXPANDED_MEDIUM WidgetMessageDisplay = "expanded-md" - WIDGETMESSAGEDISPLAY_EXPANDED_LARGE WidgetMessageDisplay = "expanded-lg" -) - -var allowedWidgetMessageDisplayEnumValues = []WidgetMessageDisplay{ - WIDGETMESSAGEDISPLAY_INLINE, - WIDGETMESSAGEDISPLAY_EXPANDED_MEDIUM, - WIDGETMESSAGEDISPLAY_EXPANDED_LARGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetMessageDisplay) GetAllowedValues() []WidgetMessageDisplay { - return allowedWidgetMessageDisplayEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetMessageDisplay) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetMessageDisplay(value) - return nil -} - -// NewWidgetMessageDisplayFromValue returns a pointer to a valid WidgetMessageDisplay -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetMessageDisplayFromValue(v string) (*WidgetMessageDisplay, error) { - ev := WidgetMessageDisplay(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetMessageDisplay: valid values are %v", v, allowedWidgetMessageDisplayEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetMessageDisplay) IsValid() bool { - for _, existing := range allowedWidgetMessageDisplayEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetMessageDisplay value. -func (v WidgetMessageDisplay) Ptr() *WidgetMessageDisplay { - return &v -} - -// NullableWidgetMessageDisplay handles when a null is used for WidgetMessageDisplay. -type NullableWidgetMessageDisplay struct { - value *WidgetMessageDisplay - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMessageDisplay) Get() *WidgetMessageDisplay { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMessageDisplay) Set(val *WidgetMessageDisplay) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMessageDisplay) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMessageDisplay) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMessageDisplay initializes the struct as if Set has been called. -func NewNullableWidgetMessageDisplay(val *WidgetMessageDisplay) *NullableWidgetMessageDisplay { - return &NullableWidgetMessageDisplay{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMessageDisplay) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMessageDisplay) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_monitor_summary_display_format.go b/api/v1/datadog/model_widget_monitor_summary_display_format.go deleted file mode 100644 index 83c8b0df82d..00000000000 --- a/api/v1/datadog/model_widget_monitor_summary_display_format.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetMonitorSummaryDisplayFormat What to display on the widget. -type WidgetMonitorSummaryDisplayFormat string - -// List of WidgetMonitorSummaryDisplayFormat. -const ( - WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS WidgetMonitorSummaryDisplayFormat = "counts" - WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS_AND_LIST WidgetMonitorSummaryDisplayFormat = "countsAndList" - WIDGETMONITORSUMMARYDISPLAYFORMAT_LIST WidgetMonitorSummaryDisplayFormat = "list" -) - -var allowedWidgetMonitorSummaryDisplayFormatEnumValues = []WidgetMonitorSummaryDisplayFormat{ - WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS, - WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS_AND_LIST, - WIDGETMONITORSUMMARYDISPLAYFORMAT_LIST, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetMonitorSummaryDisplayFormat) GetAllowedValues() []WidgetMonitorSummaryDisplayFormat { - return allowedWidgetMonitorSummaryDisplayFormatEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetMonitorSummaryDisplayFormat) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetMonitorSummaryDisplayFormat(value) - return nil -} - -// NewWidgetMonitorSummaryDisplayFormatFromValue returns a pointer to a valid WidgetMonitorSummaryDisplayFormat -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetMonitorSummaryDisplayFormatFromValue(v string) (*WidgetMonitorSummaryDisplayFormat, error) { - ev := WidgetMonitorSummaryDisplayFormat(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetMonitorSummaryDisplayFormat: valid values are %v", v, allowedWidgetMonitorSummaryDisplayFormatEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetMonitorSummaryDisplayFormat) IsValid() bool { - for _, existing := range allowedWidgetMonitorSummaryDisplayFormatEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetMonitorSummaryDisplayFormat value. -func (v WidgetMonitorSummaryDisplayFormat) Ptr() *WidgetMonitorSummaryDisplayFormat { - return &v -} - -// NullableWidgetMonitorSummaryDisplayFormat handles when a null is used for WidgetMonitorSummaryDisplayFormat. -type NullableWidgetMonitorSummaryDisplayFormat struct { - value *WidgetMonitorSummaryDisplayFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMonitorSummaryDisplayFormat) Get() *WidgetMonitorSummaryDisplayFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMonitorSummaryDisplayFormat) Set(val *WidgetMonitorSummaryDisplayFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMonitorSummaryDisplayFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMonitorSummaryDisplayFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMonitorSummaryDisplayFormat initializes the struct as if Set has been called. -func NewNullableWidgetMonitorSummaryDisplayFormat(val *WidgetMonitorSummaryDisplayFormat) *NullableWidgetMonitorSummaryDisplayFormat { - return &NullableWidgetMonitorSummaryDisplayFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMonitorSummaryDisplayFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMonitorSummaryDisplayFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_monitor_summary_sort.go b/api/v1/datadog/model_widget_monitor_summary_sort.go deleted file mode 100644 index 391c55983cb..00000000000 --- a/api/v1/datadog/model_widget_monitor_summary_sort.go +++ /dev/null @@ -1,135 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetMonitorSummarySort Widget sorting methods. -type WidgetMonitorSummarySort string - -// List of WidgetMonitorSummarySort. -const ( - WIDGETMONITORSUMMARYSORT_NAME WidgetMonitorSummarySort = "name" - WIDGETMONITORSUMMARYSORT_GROUP WidgetMonitorSummarySort = "group" - WIDGETMONITORSUMMARYSORT_STATUS WidgetMonitorSummarySort = "status" - WIDGETMONITORSUMMARYSORT_TAGS WidgetMonitorSummarySort = "tags" - WIDGETMONITORSUMMARYSORT_TRIGGERED WidgetMonitorSummarySort = "triggered" - WIDGETMONITORSUMMARYSORT_GROUP_ASCENDING WidgetMonitorSummarySort = "group,asc" - WIDGETMONITORSUMMARYSORT_GROUP_DESCENDING WidgetMonitorSummarySort = "group,desc" - WIDGETMONITORSUMMARYSORT_NAME_ASCENDING WidgetMonitorSummarySort = "name,asc" - WIDGETMONITORSUMMARYSORT_NAME_DESCENDING WidgetMonitorSummarySort = "name,desc" - WIDGETMONITORSUMMARYSORT_STATUS_ASCENDING WidgetMonitorSummarySort = "status,asc" - WIDGETMONITORSUMMARYSORT_STATUS_DESCENDING WidgetMonitorSummarySort = "status,desc" - WIDGETMONITORSUMMARYSORT_TAGS_ASCENDING WidgetMonitorSummarySort = "tags,asc" - WIDGETMONITORSUMMARYSORT_TAGS_DESCENDING WidgetMonitorSummarySort = "tags,desc" - WIDGETMONITORSUMMARYSORT_TRIGGERED_ASCENDING WidgetMonitorSummarySort = "triggered,asc" - WIDGETMONITORSUMMARYSORT_TRIGGERED_DESCENDING WidgetMonitorSummarySort = "triggered,desc" -) - -var allowedWidgetMonitorSummarySortEnumValues = []WidgetMonitorSummarySort{ - WIDGETMONITORSUMMARYSORT_NAME, - WIDGETMONITORSUMMARYSORT_GROUP, - WIDGETMONITORSUMMARYSORT_STATUS, - WIDGETMONITORSUMMARYSORT_TAGS, - WIDGETMONITORSUMMARYSORT_TRIGGERED, - WIDGETMONITORSUMMARYSORT_GROUP_ASCENDING, - WIDGETMONITORSUMMARYSORT_GROUP_DESCENDING, - WIDGETMONITORSUMMARYSORT_NAME_ASCENDING, - WIDGETMONITORSUMMARYSORT_NAME_DESCENDING, - WIDGETMONITORSUMMARYSORT_STATUS_ASCENDING, - WIDGETMONITORSUMMARYSORT_STATUS_DESCENDING, - WIDGETMONITORSUMMARYSORT_TAGS_ASCENDING, - WIDGETMONITORSUMMARYSORT_TAGS_DESCENDING, - WIDGETMONITORSUMMARYSORT_TRIGGERED_ASCENDING, - WIDGETMONITORSUMMARYSORT_TRIGGERED_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetMonitorSummarySort) GetAllowedValues() []WidgetMonitorSummarySort { - return allowedWidgetMonitorSummarySortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetMonitorSummarySort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetMonitorSummarySort(value) - return nil -} - -// NewWidgetMonitorSummarySortFromValue returns a pointer to a valid WidgetMonitorSummarySort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetMonitorSummarySortFromValue(v string) (*WidgetMonitorSummarySort, error) { - ev := WidgetMonitorSummarySort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetMonitorSummarySort: valid values are %v", v, allowedWidgetMonitorSummarySortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetMonitorSummarySort) IsValid() bool { - for _, existing := range allowedWidgetMonitorSummarySortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetMonitorSummarySort value. -func (v WidgetMonitorSummarySort) Ptr() *WidgetMonitorSummarySort { - return &v -} - -// NullableWidgetMonitorSummarySort handles when a null is used for WidgetMonitorSummarySort. -type NullableWidgetMonitorSummarySort struct { - value *WidgetMonitorSummarySort - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetMonitorSummarySort) Get() *WidgetMonitorSummarySort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetMonitorSummarySort) Set(val *WidgetMonitorSummarySort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetMonitorSummarySort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetMonitorSummarySort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetMonitorSummarySort initializes the struct as if Set has been called. -func NewNullableWidgetMonitorSummarySort(val *WidgetMonitorSummarySort) *NullableWidgetMonitorSummarySort { - return &NullableWidgetMonitorSummarySort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetMonitorSummarySort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetMonitorSummarySort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_node_type.go b/api/v1/datadog/model_widget_node_type.go deleted file mode 100644 index 2612ff674e9..00000000000 --- a/api/v1/datadog/model_widget_node_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetNodeType Which type of node to use in the map. -type WidgetNodeType string - -// List of WidgetNodeType. -const ( - WIDGETNODETYPE_HOST WidgetNodeType = "host" - WIDGETNODETYPE_CONTAINER WidgetNodeType = "container" -) - -var allowedWidgetNodeTypeEnumValues = []WidgetNodeType{ - WIDGETNODETYPE_HOST, - WIDGETNODETYPE_CONTAINER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetNodeType) GetAllowedValues() []WidgetNodeType { - return allowedWidgetNodeTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetNodeType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetNodeType(value) - return nil -} - -// NewWidgetNodeTypeFromValue returns a pointer to a valid WidgetNodeType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetNodeTypeFromValue(v string) (*WidgetNodeType, error) { - ev := WidgetNodeType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetNodeType: valid values are %v", v, allowedWidgetNodeTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetNodeType) IsValid() bool { - for _, existing := range allowedWidgetNodeTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetNodeType value. -func (v WidgetNodeType) Ptr() *WidgetNodeType { - return &v -} - -// NullableWidgetNodeType handles when a null is used for WidgetNodeType. -type NullableWidgetNodeType struct { - value *WidgetNodeType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetNodeType) Get() *WidgetNodeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetNodeType) Set(val *WidgetNodeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetNodeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetNodeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetNodeType initializes the struct as if Set has been called. -func NewNullableWidgetNodeType(val *WidgetNodeType) *NullableWidgetNodeType { - return &NullableWidgetNodeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetNodeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetNodeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_order_by.go b/api/v1/datadog/model_widget_order_by.go deleted file mode 100644 index 05001c1c5ef..00000000000 --- a/api/v1/datadog/model_widget_order_by.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetOrderBy What to order by. -type WidgetOrderBy string - -// List of WidgetOrderBy. -const ( - WIDGETORDERBY_CHANGE WidgetOrderBy = "change" - WIDGETORDERBY_NAME WidgetOrderBy = "name" - WIDGETORDERBY_PRESENT WidgetOrderBy = "present" - WIDGETORDERBY_PAST WidgetOrderBy = "past" -) - -var allowedWidgetOrderByEnumValues = []WidgetOrderBy{ - WIDGETORDERBY_CHANGE, - WIDGETORDERBY_NAME, - WIDGETORDERBY_PRESENT, - WIDGETORDERBY_PAST, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetOrderBy) GetAllowedValues() []WidgetOrderBy { - return allowedWidgetOrderByEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetOrderBy) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetOrderBy(value) - return nil -} - -// NewWidgetOrderByFromValue returns a pointer to a valid WidgetOrderBy -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetOrderByFromValue(v string) (*WidgetOrderBy, error) { - ev := WidgetOrderBy(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetOrderBy: valid values are %v", v, allowedWidgetOrderByEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetOrderBy) IsValid() bool { - for _, existing := range allowedWidgetOrderByEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetOrderBy value. -func (v WidgetOrderBy) Ptr() *WidgetOrderBy { - return &v -} - -// NullableWidgetOrderBy handles when a null is used for WidgetOrderBy. -type NullableWidgetOrderBy struct { - value *WidgetOrderBy - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetOrderBy) Get() *WidgetOrderBy { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetOrderBy) Set(val *WidgetOrderBy) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetOrderBy) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetOrderBy) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetOrderBy initializes the struct as if Set has been called. -func NewNullableWidgetOrderBy(val *WidgetOrderBy) *NullableWidgetOrderBy { - return &NullableWidgetOrderBy{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetOrderBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetOrderBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_palette.go b/api/v1/datadog/model_widget_palette.go deleted file mode 100644 index 447aa5da0d3..00000000000 --- a/api/v1/datadog/model_widget_palette.go +++ /dev/null @@ -1,143 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetPalette Color palette to apply. -type WidgetPalette string - -// List of WidgetPalette. -const ( - WIDGETPALETTE_BLUE WidgetPalette = "blue" - WIDGETPALETTE_CUSTOM_BACKGROUND WidgetPalette = "custom_bg" - WIDGETPALETTE_CUSTOM_IMAGE WidgetPalette = "custom_image" - WIDGETPALETTE_CUSTOM_TEXT WidgetPalette = "custom_text" - WIDGETPALETTE_GRAY_ON_WHITE WidgetPalette = "gray_on_white" - WIDGETPALETTE_GREY WidgetPalette = "grey" - WIDGETPALETTE_GREEN WidgetPalette = "green" - WIDGETPALETTE_ORANGE WidgetPalette = "orange" - WIDGETPALETTE_RED WidgetPalette = "red" - WIDGETPALETTE_RED_ON_WHITE WidgetPalette = "red_on_white" - WIDGETPALETTE_WHITE_ON_GRAY WidgetPalette = "white_on_gray" - WIDGETPALETTE_WHITE_ON_GREEN WidgetPalette = "white_on_green" - WIDGETPALETTE_GREEN_ON_WHITE WidgetPalette = "green_on_white" - WIDGETPALETTE_WHITE_ON_RED WidgetPalette = "white_on_red" - WIDGETPALETTE_WHITE_ON_YELLOW WidgetPalette = "white_on_yellow" - WIDGETPALETTE_YELLOW_ON_WHITE WidgetPalette = "yellow_on_white" - WIDGETPALETTE_BLACK_ON_LIGHT_YELLOW WidgetPalette = "black_on_light_yellow" - WIDGETPALETTE_BLACK_ON_LIGHT_GREEN WidgetPalette = "black_on_light_green" - WIDGETPALETTE_BLACK_ON_LIGHT_RED WidgetPalette = "black_on_light_red" -) - -var allowedWidgetPaletteEnumValues = []WidgetPalette{ - WIDGETPALETTE_BLUE, - WIDGETPALETTE_CUSTOM_BACKGROUND, - WIDGETPALETTE_CUSTOM_IMAGE, - WIDGETPALETTE_CUSTOM_TEXT, - WIDGETPALETTE_GRAY_ON_WHITE, - WIDGETPALETTE_GREY, - WIDGETPALETTE_GREEN, - WIDGETPALETTE_ORANGE, - WIDGETPALETTE_RED, - WIDGETPALETTE_RED_ON_WHITE, - WIDGETPALETTE_WHITE_ON_GRAY, - WIDGETPALETTE_WHITE_ON_GREEN, - WIDGETPALETTE_GREEN_ON_WHITE, - WIDGETPALETTE_WHITE_ON_RED, - WIDGETPALETTE_WHITE_ON_YELLOW, - WIDGETPALETTE_YELLOW_ON_WHITE, - WIDGETPALETTE_BLACK_ON_LIGHT_YELLOW, - WIDGETPALETTE_BLACK_ON_LIGHT_GREEN, - WIDGETPALETTE_BLACK_ON_LIGHT_RED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetPalette) GetAllowedValues() []WidgetPalette { - return allowedWidgetPaletteEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetPalette) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetPalette(value) - return nil -} - -// NewWidgetPaletteFromValue returns a pointer to a valid WidgetPalette -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetPaletteFromValue(v string) (*WidgetPalette, error) { - ev := WidgetPalette(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetPalette: valid values are %v", v, allowedWidgetPaletteEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetPalette) IsValid() bool { - for _, existing := range allowedWidgetPaletteEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetPalette value. -func (v WidgetPalette) Ptr() *WidgetPalette { - return &v -} - -// NullableWidgetPalette handles when a null is used for WidgetPalette. -type NullableWidgetPalette struct { - value *WidgetPalette - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetPalette) Get() *WidgetPalette { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetPalette) Set(val *WidgetPalette) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetPalette) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetPalette) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetPalette initializes the struct as if Set has been called. -func NewNullableWidgetPalette(val *WidgetPalette) *NullableWidgetPalette { - return &NullableWidgetPalette{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetPalette) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetPalette) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_request_style.go b/api/v1/datadog/model_widget_request_style.go deleted file mode 100644 index 94ff606c14f..00000000000 --- a/api/v1/datadog/model_widget_request_style.go +++ /dev/null @@ -1,196 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WidgetRequestStyle Define request widget style. -type WidgetRequestStyle struct { - // Type of lines displayed. - LineType *WidgetLineType `json:"line_type,omitempty"` - // Width of line displayed. - LineWidth *WidgetLineWidth `json:"line_width,omitempty"` - // Color palette to apply to the widget. - Palette *string `json:"palette,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{} -} - -// NewWidgetRequestStyle instantiates a new WidgetRequestStyle 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 NewWidgetRequestStyle() *WidgetRequestStyle { - this := WidgetRequestStyle{} - return &this -} - -// NewWidgetRequestStyleWithDefaults instantiates a new WidgetRequestStyle 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 NewWidgetRequestStyleWithDefaults() *WidgetRequestStyle { - this := WidgetRequestStyle{} - return &this -} - -// GetLineType returns the LineType field value if set, zero value otherwise. -func (o *WidgetRequestStyle) GetLineType() WidgetLineType { - if o == nil || o.LineType == nil { - var ret WidgetLineType - return ret - } - return *o.LineType -} - -// GetLineTypeOk returns a tuple with the LineType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetRequestStyle) GetLineTypeOk() (*WidgetLineType, bool) { - if o == nil || o.LineType == nil { - return nil, false - } - return o.LineType, true -} - -// HasLineType returns a boolean if a field has been set. -func (o *WidgetRequestStyle) HasLineType() bool { - if o != nil && o.LineType != nil { - return true - } - - return false -} - -// SetLineType gets a reference to the given WidgetLineType and assigns it to the LineType field. -func (o *WidgetRequestStyle) SetLineType(v WidgetLineType) { - o.LineType = &v -} - -// GetLineWidth returns the LineWidth field value if set, zero value otherwise. -func (o *WidgetRequestStyle) GetLineWidth() WidgetLineWidth { - if o == nil || o.LineWidth == nil { - var ret WidgetLineWidth - return ret - } - return *o.LineWidth -} - -// GetLineWidthOk returns a tuple with the LineWidth field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetRequestStyle) GetLineWidthOk() (*WidgetLineWidth, bool) { - if o == nil || o.LineWidth == nil { - return nil, false - } - return o.LineWidth, true -} - -// HasLineWidth returns a boolean if a field has been set. -func (o *WidgetRequestStyle) HasLineWidth() bool { - if o != nil && o.LineWidth != nil { - return true - } - - return false -} - -// SetLineWidth gets a reference to the given WidgetLineWidth and assigns it to the LineWidth field. -func (o *WidgetRequestStyle) SetLineWidth(v WidgetLineWidth) { - o.LineWidth = &v -} - -// GetPalette returns the Palette field value if set, zero value otherwise. -func (o *WidgetRequestStyle) GetPalette() string { - if o == nil || o.Palette == nil { - var ret string - return ret - } - return *o.Palette -} - -// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetRequestStyle) GetPaletteOk() (*string, bool) { - if o == nil || o.Palette == nil { - return nil, false - } - return o.Palette, true -} - -// HasPalette returns a boolean if a field has been set. -func (o *WidgetRequestStyle) HasPalette() bool { - if o != nil && o.Palette != nil { - return true - } - - return false -} - -// SetPalette gets a reference to the given string and assigns it to the Palette field. -func (o *WidgetRequestStyle) SetPalette(v string) { - o.Palette = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetRequestStyle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LineType != nil { - toSerialize["line_type"] = o.LineType - } - if o.LineWidth != nil { - toSerialize["line_width"] = o.LineWidth - } - if o.Palette != nil { - toSerialize["palette"] = o.Palette - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetRequestStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - LineType *WidgetLineType `json:"line_type,omitempty"` - LineWidth *WidgetLineWidth `json:"line_width,omitempty"` - Palette *string `json:"palette,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LineType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LineWidth; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LineType = all.LineType - o.LineWidth = all.LineWidth - o.Palette = all.Palette - return nil -} diff --git a/api/v1/datadog/model_widget_service_summary_display_format.go b/api/v1/datadog/model_widget_service_summary_display_format.go deleted file mode 100644 index 8e5bd7c3510..00000000000 --- a/api/v1/datadog/model_widget_service_summary_display_format.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetServiceSummaryDisplayFormat Number of columns to display. -type WidgetServiceSummaryDisplayFormat string - -// List of WidgetServiceSummaryDisplayFormat. -const ( - WIDGETSERVICESUMMARYDISPLAYFORMAT_ONE_COLUMN WidgetServiceSummaryDisplayFormat = "one_column" - WIDGETSERVICESUMMARYDISPLAYFORMAT_TWO_COLUMN WidgetServiceSummaryDisplayFormat = "two_column" - WIDGETSERVICESUMMARYDISPLAYFORMAT_THREE_COLUMN WidgetServiceSummaryDisplayFormat = "three_column" -) - -var allowedWidgetServiceSummaryDisplayFormatEnumValues = []WidgetServiceSummaryDisplayFormat{ - WIDGETSERVICESUMMARYDISPLAYFORMAT_ONE_COLUMN, - WIDGETSERVICESUMMARYDISPLAYFORMAT_TWO_COLUMN, - WIDGETSERVICESUMMARYDISPLAYFORMAT_THREE_COLUMN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetServiceSummaryDisplayFormat) GetAllowedValues() []WidgetServiceSummaryDisplayFormat { - return allowedWidgetServiceSummaryDisplayFormatEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetServiceSummaryDisplayFormat) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetServiceSummaryDisplayFormat(value) - return nil -} - -// NewWidgetServiceSummaryDisplayFormatFromValue returns a pointer to a valid WidgetServiceSummaryDisplayFormat -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetServiceSummaryDisplayFormatFromValue(v string) (*WidgetServiceSummaryDisplayFormat, error) { - ev := WidgetServiceSummaryDisplayFormat(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetServiceSummaryDisplayFormat: valid values are %v", v, allowedWidgetServiceSummaryDisplayFormatEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetServiceSummaryDisplayFormat) IsValid() bool { - for _, existing := range allowedWidgetServiceSummaryDisplayFormatEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetServiceSummaryDisplayFormat value. -func (v WidgetServiceSummaryDisplayFormat) Ptr() *WidgetServiceSummaryDisplayFormat { - return &v -} - -// NullableWidgetServiceSummaryDisplayFormat handles when a null is used for WidgetServiceSummaryDisplayFormat. -type NullableWidgetServiceSummaryDisplayFormat struct { - value *WidgetServiceSummaryDisplayFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetServiceSummaryDisplayFormat) Get() *WidgetServiceSummaryDisplayFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetServiceSummaryDisplayFormat) Set(val *WidgetServiceSummaryDisplayFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetServiceSummaryDisplayFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetServiceSummaryDisplayFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetServiceSummaryDisplayFormat initializes the struct as if Set has been called. -func NewNullableWidgetServiceSummaryDisplayFormat(val *WidgetServiceSummaryDisplayFormat) *NullableWidgetServiceSummaryDisplayFormat { - return &NullableWidgetServiceSummaryDisplayFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetServiceSummaryDisplayFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetServiceSummaryDisplayFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_size_format.go b/api/v1/datadog/model_widget_size_format.go deleted file mode 100644 index 3dd50566745..00000000000 --- a/api/v1/datadog/model_widget_size_format.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetSizeFormat Size of the widget. -type WidgetSizeFormat string - -// List of WidgetSizeFormat. -const ( - WIDGETSIZEFORMAT_SMALL WidgetSizeFormat = "small" - WIDGETSIZEFORMAT_MEDIUM WidgetSizeFormat = "medium" - WIDGETSIZEFORMAT_LARGE WidgetSizeFormat = "large" -) - -var allowedWidgetSizeFormatEnumValues = []WidgetSizeFormat{ - WIDGETSIZEFORMAT_SMALL, - WIDGETSIZEFORMAT_MEDIUM, - WIDGETSIZEFORMAT_LARGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetSizeFormat) GetAllowedValues() []WidgetSizeFormat { - return allowedWidgetSizeFormatEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetSizeFormat) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetSizeFormat(value) - return nil -} - -// NewWidgetSizeFormatFromValue returns a pointer to a valid WidgetSizeFormat -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetSizeFormatFromValue(v string) (*WidgetSizeFormat, error) { - ev := WidgetSizeFormat(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetSizeFormat: valid values are %v", v, allowedWidgetSizeFormatEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetSizeFormat) IsValid() bool { - for _, existing := range allowedWidgetSizeFormatEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetSizeFormat value. -func (v WidgetSizeFormat) Ptr() *WidgetSizeFormat { - return &v -} - -// NullableWidgetSizeFormat handles when a null is used for WidgetSizeFormat. -type NullableWidgetSizeFormat struct { - value *WidgetSizeFormat - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetSizeFormat) Get() *WidgetSizeFormat { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetSizeFormat) Set(val *WidgetSizeFormat) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetSizeFormat) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetSizeFormat) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetSizeFormat initializes the struct as if Set has been called. -func NewNullableWidgetSizeFormat(val *WidgetSizeFormat) *NullableWidgetSizeFormat { - return &NullableWidgetSizeFormat{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetSizeFormat) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetSizeFormat) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_sort.go b/api/v1/datadog/model_widget_sort.go deleted file mode 100644 index 90f941b2960..00000000000 --- a/api/v1/datadog/model_widget_sort.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetSort Widget sorting methods. -type WidgetSort string - -// List of WidgetSort. -const ( - WIDGETSORT_ASCENDING WidgetSort = "asc" - WIDGETSORT_DESCENDING WidgetSort = "desc" -) - -var allowedWidgetSortEnumValues = []WidgetSort{ - WIDGETSORT_ASCENDING, - WIDGETSORT_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetSort) GetAllowedValues() []WidgetSort { - return allowedWidgetSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetSort(value) - return nil -} - -// NewWidgetSortFromValue returns a pointer to a valid WidgetSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetSortFromValue(v string) (*WidgetSort, error) { - ev := WidgetSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetSort: valid values are %v", v, allowedWidgetSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetSort) IsValid() bool { - for _, existing := range allowedWidgetSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetSort value. -func (v WidgetSort) Ptr() *WidgetSort { - return &v -} - -// NullableWidgetSort handles when a null is used for WidgetSort. -type NullableWidgetSort struct { - value *WidgetSort - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetSort) Get() *WidgetSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetSort) Set(val *WidgetSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetSort initializes the struct as if Set has been called. -func NewNullableWidgetSort(val *WidgetSort) *NullableWidgetSort { - return &NullableWidgetSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_style.go b/api/v1/datadog/model_widget_style.go deleted file mode 100644 index bd21312eda4..00000000000 --- a/api/v1/datadog/model_widget_style.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WidgetStyle Widget style definition. -type WidgetStyle struct { - // Color palette to apply to the widget. - Palette *string `json:"palette,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{} -} - -// NewWidgetStyle instantiates a new WidgetStyle 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 NewWidgetStyle() *WidgetStyle { - this := WidgetStyle{} - return &this -} - -// NewWidgetStyleWithDefaults instantiates a new WidgetStyle 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 NewWidgetStyleWithDefaults() *WidgetStyle { - this := WidgetStyle{} - return &this -} - -// GetPalette returns the Palette field value if set, zero value otherwise. -func (o *WidgetStyle) GetPalette() string { - if o == nil || o.Palette == nil { - var ret string - return ret - } - return *o.Palette -} - -// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetStyle) GetPaletteOk() (*string, bool) { - if o == nil || o.Palette == nil { - return nil, false - } - return o.Palette, true -} - -// HasPalette returns a boolean if a field has been set. -func (o *WidgetStyle) HasPalette() bool { - if o != nil && o.Palette != nil { - return true - } - - return false -} - -// SetPalette gets a reference to the given string and assigns it to the Palette field. -func (o *WidgetStyle) SetPalette(v string) { - o.Palette = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetStyle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Palette != nil { - toSerialize["palette"] = o.Palette - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetStyle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Palette *string `json:"palette,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Palette = all.Palette - return nil -} diff --git a/api/v1/datadog/model_widget_summary_type.go b/api/v1/datadog/model_widget_summary_type.go deleted file mode 100644 index 7c98eec88ae..00000000000 --- a/api/v1/datadog/model_widget_summary_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetSummaryType Which summary type should be used. -type WidgetSummaryType string - -// List of WidgetSummaryType. -const ( - WIDGETSUMMARYTYPE_MONITORS WidgetSummaryType = "monitors" - WIDGETSUMMARYTYPE_GROUPS WidgetSummaryType = "groups" - WIDGETSUMMARYTYPE_COMBINED WidgetSummaryType = "combined" -) - -var allowedWidgetSummaryTypeEnumValues = []WidgetSummaryType{ - WIDGETSUMMARYTYPE_MONITORS, - WIDGETSUMMARYTYPE_GROUPS, - WIDGETSUMMARYTYPE_COMBINED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetSummaryType) GetAllowedValues() []WidgetSummaryType { - return allowedWidgetSummaryTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetSummaryType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetSummaryType(value) - return nil -} - -// NewWidgetSummaryTypeFromValue returns a pointer to a valid WidgetSummaryType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetSummaryTypeFromValue(v string) (*WidgetSummaryType, error) { - ev := WidgetSummaryType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetSummaryType: valid values are %v", v, allowedWidgetSummaryTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetSummaryType) IsValid() bool { - for _, existing := range allowedWidgetSummaryTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetSummaryType value. -func (v WidgetSummaryType) Ptr() *WidgetSummaryType { - return &v -} - -// NullableWidgetSummaryType handles when a null is used for WidgetSummaryType. -type NullableWidgetSummaryType struct { - value *WidgetSummaryType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetSummaryType) Get() *WidgetSummaryType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetSummaryType) Set(val *WidgetSummaryType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetSummaryType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetSummaryType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetSummaryType initializes the struct as if Set has been called. -func NewNullableWidgetSummaryType(val *WidgetSummaryType) *NullableWidgetSummaryType { - return &NullableWidgetSummaryType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetSummaryType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetSummaryType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_text_align.go b/api/v1/datadog/model_widget_text_align.go deleted file mode 100644 index 69ea8a68b7e..00000000000 --- a/api/v1/datadog/model_widget_text_align.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetTextAlign How to align the text on the widget. -type WidgetTextAlign string - -// List of WidgetTextAlign. -const ( - WIDGETTEXTALIGN_CENTER WidgetTextAlign = "center" - WIDGETTEXTALIGN_LEFT WidgetTextAlign = "left" - WIDGETTEXTALIGN_RIGHT WidgetTextAlign = "right" -) - -var allowedWidgetTextAlignEnumValues = []WidgetTextAlign{ - WIDGETTEXTALIGN_CENTER, - WIDGETTEXTALIGN_LEFT, - WIDGETTEXTALIGN_RIGHT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetTextAlign) GetAllowedValues() []WidgetTextAlign { - return allowedWidgetTextAlignEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetTextAlign) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetTextAlign(value) - return nil -} - -// NewWidgetTextAlignFromValue returns a pointer to a valid WidgetTextAlign -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetTextAlignFromValue(v string) (*WidgetTextAlign, error) { - ev := WidgetTextAlign(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetTextAlign: valid values are %v", v, allowedWidgetTextAlignEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetTextAlign) IsValid() bool { - for _, existing := range allowedWidgetTextAlignEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetTextAlign value. -func (v WidgetTextAlign) Ptr() *WidgetTextAlign { - return &v -} - -// NullableWidgetTextAlign handles when a null is used for WidgetTextAlign. -type NullableWidgetTextAlign struct { - value *WidgetTextAlign - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetTextAlign) Get() *WidgetTextAlign { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetTextAlign) Set(val *WidgetTextAlign) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetTextAlign) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetTextAlign) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetTextAlign initializes the struct as if Set has been called. -func NewNullableWidgetTextAlign(val *WidgetTextAlign) *NullableWidgetTextAlign { - return &NullableWidgetTextAlign{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetTextAlign) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetTextAlign) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_tick_edge.go b/api/v1/datadog/model_widget_tick_edge.go deleted file mode 100644 index ce513f41353..00000000000 --- a/api/v1/datadog/model_widget_tick_edge.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetTickEdge Define how you want to align the text on the widget. -type WidgetTickEdge string - -// List of WidgetTickEdge. -const ( - WIDGETTICKEDGE_BOTTOM WidgetTickEdge = "bottom" - WIDGETTICKEDGE_LEFT WidgetTickEdge = "left" - WIDGETTICKEDGE_RIGHT WidgetTickEdge = "right" - WIDGETTICKEDGE_TOP WidgetTickEdge = "top" -) - -var allowedWidgetTickEdgeEnumValues = []WidgetTickEdge{ - WIDGETTICKEDGE_BOTTOM, - WIDGETTICKEDGE_LEFT, - WIDGETTICKEDGE_RIGHT, - WIDGETTICKEDGE_TOP, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetTickEdge) GetAllowedValues() []WidgetTickEdge { - return allowedWidgetTickEdgeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetTickEdge) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetTickEdge(value) - return nil -} - -// NewWidgetTickEdgeFromValue returns a pointer to a valid WidgetTickEdge -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetTickEdgeFromValue(v string) (*WidgetTickEdge, error) { - ev := WidgetTickEdge(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetTickEdge: valid values are %v", v, allowedWidgetTickEdgeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetTickEdge) IsValid() bool { - for _, existing := range allowedWidgetTickEdgeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetTickEdge value. -func (v WidgetTickEdge) Ptr() *WidgetTickEdge { - return &v -} - -// NullableWidgetTickEdge handles when a null is used for WidgetTickEdge. -type NullableWidgetTickEdge struct { - value *WidgetTickEdge - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetTickEdge) Get() *WidgetTickEdge { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetTickEdge) Set(val *WidgetTickEdge) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetTickEdge) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetTickEdge) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetTickEdge initializes the struct as if Set has been called. -func NewNullableWidgetTickEdge(val *WidgetTickEdge) *NullableWidgetTickEdge { - return &NullableWidgetTickEdge{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetTickEdge) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetTickEdge) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_time.go b/api/v1/datadog/model_widget_time.go deleted file mode 100644 index f06443f0bd4..00000000000 --- a/api/v1/datadog/model_widget_time.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// WidgetTime Time setting for the widget. -type WidgetTime struct { - // The available timeframes depend on the widget you are using. - LiveSpan *WidgetLiveSpan `json:"live_span,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{} -} - -// NewWidgetTime instantiates a new WidgetTime 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 NewWidgetTime() *WidgetTime { - this := WidgetTime{} - return &this -} - -// NewWidgetTimeWithDefaults instantiates a new WidgetTime 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 NewWidgetTimeWithDefaults() *WidgetTime { - this := WidgetTime{} - return &this -} - -// GetLiveSpan returns the LiveSpan field value if set, zero value otherwise. -func (o *WidgetTime) GetLiveSpan() WidgetLiveSpan { - if o == nil || o.LiveSpan == nil { - var ret WidgetLiveSpan - return ret - } - return *o.LiveSpan -} - -// GetLiveSpanOk returns a tuple with the LiveSpan field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WidgetTime) GetLiveSpanOk() (*WidgetLiveSpan, bool) { - if o == nil || o.LiveSpan == nil { - return nil, false - } - return o.LiveSpan, true -} - -// HasLiveSpan returns a boolean if a field has been set. -func (o *WidgetTime) HasLiveSpan() bool { - if o != nil && o.LiveSpan != nil { - return true - } - - return false -} - -// SetLiveSpan gets a reference to the given WidgetLiveSpan and assigns it to the LiveSpan field. -func (o *WidgetTime) SetLiveSpan(v WidgetLiveSpan) { - o.LiveSpan = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o WidgetTime) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.LiveSpan != nil { - toSerialize["live_span"] = o.LiveSpan - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *WidgetTime) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - LiveSpan *WidgetLiveSpan `json:"live_span,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LiveSpan; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.LiveSpan = all.LiveSpan - return nil -} diff --git a/api/v1/datadog/model_widget_time_windows_.go b/api/v1/datadog/model_widget_time_windows_.go deleted file mode 100644 index 296b5f41853..00000000000 --- a/api/v1/datadog/model_widget_time_windows_.go +++ /dev/null @@ -1,121 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetTimeWindows Define a time window. -type WidgetTimeWindows string - -// List of WidgetTimeWindows. -const ( - WIDGETTIMEWINDOWS_SEVEN_DAYS WidgetTimeWindows = "7d" - WIDGETTIMEWINDOWS_THIRTY_DAYS WidgetTimeWindows = "30d" - WIDGETTIMEWINDOWS_NINETY_DAYS WidgetTimeWindows = "90d" - WIDGETTIMEWINDOWS_WEEK_TO_DATE WidgetTimeWindows = "week_to_date" - WIDGETTIMEWINDOWS_PREVIOUS_WEEK WidgetTimeWindows = "previous_week" - WIDGETTIMEWINDOWS_MONTH_TO_DATE WidgetTimeWindows = "month_to_date" - WIDGETTIMEWINDOWS_PREVIOUS_MONTH WidgetTimeWindows = "previous_month" - WIDGETTIMEWINDOWS_GLOBAL_TIME WidgetTimeWindows = "global_time" -) - -var allowedWidgetTimeWindowsEnumValues = []WidgetTimeWindows{ - WIDGETTIMEWINDOWS_SEVEN_DAYS, - WIDGETTIMEWINDOWS_THIRTY_DAYS, - WIDGETTIMEWINDOWS_NINETY_DAYS, - WIDGETTIMEWINDOWS_WEEK_TO_DATE, - WIDGETTIMEWINDOWS_PREVIOUS_WEEK, - WIDGETTIMEWINDOWS_MONTH_TO_DATE, - WIDGETTIMEWINDOWS_PREVIOUS_MONTH, - WIDGETTIMEWINDOWS_GLOBAL_TIME, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetTimeWindows) GetAllowedValues() []WidgetTimeWindows { - return allowedWidgetTimeWindowsEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetTimeWindows) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetTimeWindows(value) - return nil -} - -// NewWidgetTimeWindowsFromValue returns a pointer to a valid WidgetTimeWindows -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetTimeWindowsFromValue(v string) (*WidgetTimeWindows, error) { - ev := WidgetTimeWindows(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetTimeWindows: valid values are %v", v, allowedWidgetTimeWindowsEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetTimeWindows) IsValid() bool { - for _, existing := range allowedWidgetTimeWindowsEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetTimeWindows value. -func (v WidgetTimeWindows) Ptr() *WidgetTimeWindows { - return &v -} - -// NullableWidgetTimeWindows handles when a null is used for WidgetTimeWindows. -type NullableWidgetTimeWindows struct { - value *WidgetTimeWindows - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetTimeWindows) Get() *WidgetTimeWindows { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetTimeWindows) Set(val *WidgetTimeWindows) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetTimeWindows) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetTimeWindows) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetTimeWindows initializes the struct as if Set has been called. -func NewNullableWidgetTimeWindows(val *WidgetTimeWindows) *NullableWidgetTimeWindows { - return &NullableWidgetTimeWindows{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetTimeWindows) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetTimeWindows) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_vertical_align.go b/api/v1/datadog/model_widget_vertical_align.go deleted file mode 100644 index 98b2cd1366e..00000000000 --- a/api/v1/datadog/model_widget_vertical_align.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetVerticalAlign Vertical alignment. -type WidgetVerticalAlign string - -// List of WidgetVerticalAlign. -const ( - WIDGETVERTICALALIGN_CENTER WidgetVerticalAlign = "center" - WIDGETVERTICALALIGN_TOP WidgetVerticalAlign = "top" - WIDGETVERTICALALIGN_BOTTOM WidgetVerticalAlign = "bottom" -) - -var allowedWidgetVerticalAlignEnumValues = []WidgetVerticalAlign{ - WIDGETVERTICALALIGN_CENTER, - WIDGETVERTICALALIGN_TOP, - WIDGETVERTICALALIGN_BOTTOM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetVerticalAlign) GetAllowedValues() []WidgetVerticalAlign { - return allowedWidgetVerticalAlignEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetVerticalAlign) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetVerticalAlign(value) - return nil -} - -// NewWidgetVerticalAlignFromValue returns a pointer to a valid WidgetVerticalAlign -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetVerticalAlignFromValue(v string) (*WidgetVerticalAlign, error) { - ev := WidgetVerticalAlign(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetVerticalAlign: valid values are %v", v, allowedWidgetVerticalAlignEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetVerticalAlign) IsValid() bool { - for _, existing := range allowedWidgetVerticalAlignEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetVerticalAlign value. -func (v WidgetVerticalAlign) Ptr() *WidgetVerticalAlign { - return &v -} - -// NullableWidgetVerticalAlign handles when a null is used for WidgetVerticalAlign. -type NullableWidgetVerticalAlign struct { - value *WidgetVerticalAlign - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetVerticalAlign) Get() *WidgetVerticalAlign { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetVerticalAlign) Set(val *WidgetVerticalAlign) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetVerticalAlign) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetVerticalAlign) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetVerticalAlign initializes the struct as if Set has been called. -func NewNullableWidgetVerticalAlign(val *WidgetVerticalAlign) *NullableWidgetVerticalAlign { - return &NullableWidgetVerticalAlign{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetVerticalAlign) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetVerticalAlign) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_view_mode.go b/api/v1/datadog/model_widget_view_mode.go deleted file mode 100644 index ed2ea7d55f0..00000000000 --- a/api/v1/datadog/model_widget_view_mode.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetViewMode Define how you want the SLO to be displayed. -type WidgetViewMode string - -// List of WidgetViewMode. -const ( - WIDGETVIEWMODE_OVERALL WidgetViewMode = "overall" - WIDGETVIEWMODE_COMPONENT WidgetViewMode = "component" - WIDGETVIEWMODE_BOTH WidgetViewMode = "both" -) - -var allowedWidgetViewModeEnumValues = []WidgetViewMode{ - WIDGETVIEWMODE_OVERALL, - WIDGETVIEWMODE_COMPONENT, - WIDGETVIEWMODE_BOTH, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetViewMode) GetAllowedValues() []WidgetViewMode { - return allowedWidgetViewModeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetViewMode) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetViewMode(value) - return nil -} - -// NewWidgetViewModeFromValue returns a pointer to a valid WidgetViewMode -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetViewModeFromValue(v string) (*WidgetViewMode, error) { - ev := WidgetViewMode(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetViewMode: valid values are %v", v, allowedWidgetViewModeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetViewMode) IsValid() bool { - for _, existing := range allowedWidgetViewModeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetViewMode value. -func (v WidgetViewMode) Ptr() *WidgetViewMode { - return &v -} - -// NullableWidgetViewMode handles when a null is used for WidgetViewMode. -type NullableWidgetViewMode struct { - value *WidgetViewMode - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetViewMode) Get() *WidgetViewMode { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetViewMode) Set(val *WidgetViewMode) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetViewMode) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetViewMode) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetViewMode initializes the struct as if Set has been called. -func NewNullableWidgetViewMode(val *WidgetViewMode) *NullableWidgetViewMode { - return &NullableWidgetViewMode{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetViewMode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetViewMode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v1/datadog/model_widget_viz_type.go b/api/v1/datadog/model_widget_viz_type.go deleted file mode 100644 index 59790dbb107..00000000000 --- a/api/v1/datadog/model_widget_viz_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// WidgetVizType Whether to display the Alert Graph as a timeseries or a top list. -type WidgetVizType string - -// List of WidgetVizType. -const ( - WIDGETVIZTYPE_TIMESERIES WidgetVizType = "timeseries" - WIDGETVIZTYPE_TOPLIST WidgetVizType = "toplist" -) - -var allowedWidgetVizTypeEnumValues = []WidgetVizType{ - WIDGETVIZTYPE_TIMESERIES, - WIDGETVIZTYPE_TOPLIST, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *WidgetVizType) GetAllowedValues() []WidgetVizType { - return allowedWidgetVizTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *WidgetVizType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = WidgetVizType(value) - return nil -} - -// NewWidgetVizTypeFromValue returns a pointer to a valid WidgetVizType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewWidgetVizTypeFromValue(v string) (*WidgetVizType, error) { - ev := WidgetVizType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for WidgetVizType: valid values are %v", v, allowedWidgetVizTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v WidgetVizType) IsValid() bool { - for _, existing := range allowedWidgetVizTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to WidgetVizType value. -func (v WidgetVizType) Ptr() *WidgetVizType { - return &v -} - -// NullableWidgetVizType handles when a null is used for WidgetVizType. -type NullableWidgetVizType struct { - value *WidgetVizType - isSet bool -} - -// Get returns the associated value. -func (v NullableWidgetVizType) Get() *WidgetVizType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableWidgetVizType) Set(val *WidgetVizType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableWidgetVizType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableWidgetVizType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableWidgetVizType initializes the struct as if Set has been called. -func NewNullableWidgetVizType(val *WidgetVizType) *NullableWidgetVizType { - return &NullableWidgetVizType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableWidgetVizType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableWidgetVizType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/api_audit.go b/api/v2/datadog/api_audit.go deleted file mode 100644 index a230a370515..00000000000 --- a/api/v2/datadog/api_audit.go +++ /dev/null @@ -1,550 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// AuditApi service type -type AuditApi common.Service - -type apiListAuditLogsRequest struct { - ctx _context.Context - filterQuery *string - filterFrom *time.Time - filterTo *time.Time - sort *AuditLogsSort - pageCursor *string - pageLimit *int32 -} - -// ListAuditLogsOptionalParameters holds optional parameters for ListAuditLogs. -type ListAuditLogsOptionalParameters struct { - FilterQuery *string - FilterFrom *time.Time - FilterTo *time.Time - Sort *AuditLogsSort - PageCursor *string - PageLimit *int32 -} - -// NewListAuditLogsOptionalParameters creates an empty struct for parameters. -func NewListAuditLogsOptionalParameters() *ListAuditLogsOptionalParameters { - this := ListAuditLogsOptionalParameters{} - return &this -} - -// WithFilterQuery sets the corresponding parameter name and returns the struct. -func (r *ListAuditLogsOptionalParameters) WithFilterQuery(filterQuery string) *ListAuditLogsOptionalParameters { - r.FilterQuery = &filterQuery - return r -} - -// WithFilterFrom sets the corresponding parameter name and returns the struct. -func (r *ListAuditLogsOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListAuditLogsOptionalParameters { - r.FilterFrom = &filterFrom - return r -} - -// WithFilterTo sets the corresponding parameter name and returns the struct. -func (r *ListAuditLogsOptionalParameters) WithFilterTo(filterTo time.Time) *ListAuditLogsOptionalParameters { - r.FilterTo = &filterTo - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListAuditLogsOptionalParameters) WithSort(sort AuditLogsSort) *ListAuditLogsOptionalParameters { - r.Sort = &sort - return r -} - -// WithPageCursor sets the corresponding parameter name and returns the struct. -func (r *ListAuditLogsOptionalParameters) WithPageCursor(pageCursor string) *ListAuditLogsOptionalParameters { - r.PageCursor = &pageCursor - return r -} - -// WithPageLimit sets the corresponding parameter name and returns the struct. -func (r *ListAuditLogsOptionalParameters) WithPageLimit(pageLimit int32) *ListAuditLogsOptionalParameters { - r.PageLimit = &pageLimit - return r -} - -func (a *AuditApi) buildListAuditLogsRequest(ctx _context.Context, o ...ListAuditLogsOptionalParameters) (apiListAuditLogsRequest, error) { - req := apiListAuditLogsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListAuditLogsOptionalParameters is allowed") - } - - if o != nil { - req.filterQuery = o[0].FilterQuery - req.filterFrom = o[0].FilterFrom - req.filterTo = o[0].FilterTo - req.sort = o[0].Sort - req.pageCursor = o[0].PageCursor - req.pageLimit = o[0].PageLimit - } - return req, nil -} - -// ListAuditLogs Get a list of Audit Logs events. -// List endpoint returns events that match a Audit Logs search query. -// [Results are paginated][1]. -// -// Use this endpoint to see your latest Audit Logs events. -// -// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination -func (a *AuditApi) ListAuditLogs(ctx _context.Context, o ...ListAuditLogsOptionalParameters) (AuditLogsEventsResponse, *_nethttp.Response, error) { - req, err := a.buildListAuditLogsRequest(ctx, o...) - if err != nil { - var localVarReturnValue AuditLogsEventsResponse - return localVarReturnValue, nil, err - } - - return a.listAuditLogsExecute(req) -} - -// ListAuditLogsWithPagination provides a paginated version of ListAuditLogs returning a channel with all items. -func (a *AuditApi) ListAuditLogsWithPagination(ctx _context.Context, o ...ListAuditLogsOptionalParameters) (<-chan AuditLogsEvent, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, ListAuditLogsOptionalParameters{}) - } - if o[0].PageLimit != nil { - pageSize_ = *o[0].PageLimit - } - o[0].PageLimit = &pageSize_ - - items := make(chan AuditLogsEvent, pageSize_) - go func() { - for { - req, err := a.buildListAuditLogsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listAuditLogsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].PageCursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// listAuditLogsExecute executes the request. -func (a *AuditApi) listAuditLogsExecute(r apiListAuditLogsRequest) (AuditLogsEventsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue AuditLogsEventsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuditApi.ListAuditLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/audit/events" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterQuery != nil { - localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) - } - if r.filterFrom != nil { - localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) - } - if r.filterTo != nil { - localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.pageCursor != nil { - localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) - } - if r.pageLimit != nil { - localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSearchAuditLogsRequest struct { - ctx _context.Context - body *AuditLogsSearchEventsRequest -} - -// SearchAuditLogsOptionalParameters holds optional parameters for SearchAuditLogs. -type SearchAuditLogsOptionalParameters struct { - Body *AuditLogsSearchEventsRequest -} - -// NewSearchAuditLogsOptionalParameters creates an empty struct for parameters. -func NewSearchAuditLogsOptionalParameters() *SearchAuditLogsOptionalParameters { - this := SearchAuditLogsOptionalParameters{} - return &this -} - -// WithBody sets the corresponding parameter name and returns the struct. -func (r *SearchAuditLogsOptionalParameters) WithBody(body AuditLogsSearchEventsRequest) *SearchAuditLogsOptionalParameters { - r.Body = &body - return r -} - -func (a *AuditApi) buildSearchAuditLogsRequest(ctx _context.Context, o ...SearchAuditLogsOptionalParameters) (apiSearchAuditLogsRequest, error) { - req := apiSearchAuditLogsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SearchAuditLogsOptionalParameters is allowed") - } - - if o != nil { - req.body = o[0].Body - } - return req, nil -} - -// SearchAuditLogs Search Audit Logs events. -// List endpoint returns Audit Logs events that match an Audit search query. -// [Results are paginated][1]. -// -// Use this endpoint to build complex Audit Logs events filtering and search. -// -// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination -func (a *AuditApi) SearchAuditLogs(ctx _context.Context, o ...SearchAuditLogsOptionalParameters) (AuditLogsEventsResponse, *_nethttp.Response, error) { - req, err := a.buildSearchAuditLogsRequest(ctx, o...) - if err != nil { - var localVarReturnValue AuditLogsEventsResponse - return localVarReturnValue, nil, err - } - - return a.searchAuditLogsExecute(req) -} - -// SearchAuditLogsWithPagination provides a paginated version of SearchAuditLogs returning a channel with all items. -func (a *AuditApi) SearchAuditLogsWithPagination(ctx _context.Context, o ...SearchAuditLogsOptionalParameters) (<-chan AuditLogsEvent, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, SearchAuditLogsOptionalParameters{}) - } - if o[0].Body == nil { - o[0].Body = NewAuditLogsSearchEventsRequest() - } - if o[0].Body.Page == nil { - o[0].Body.Page = NewAuditLogsQueryPageOptions() - } - if o[0].Body.Page.Limit != nil { - pageSize_ = *o[0].Body.Page.Limit - } - o[0].Body.Page.Limit = &pageSize_ - - items := make(chan AuditLogsEvent, pageSize_) - go func() { - for { - req, err := a.buildSearchAuditLogsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.searchAuditLogsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].Body.Page.Cursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// searchAuditLogsExecute executes the request. -func (a *AuditApi) searchAuditLogsExecute(r apiSearchAuditLogsRequest) (AuditLogsEventsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue AuditLogsEventsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuditApi.SearchAuditLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/audit/events/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewAuditApi Returns NewAuditApi. -func NewAuditApi(client *common.APIClient) *AuditApi { - return &AuditApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_auth_n_mappings.go b/api/v2/datadog/api_auth_n_mappings.go deleted file mode 100644 index 6b804dd4967..00000000000 --- a/api/v2/datadog/api_auth_n_mappings.go +++ /dev/null @@ -1,802 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// AuthNMappingsApi service type -type AuthNMappingsApi common.Service - -type apiCreateAuthNMappingRequest struct { - ctx _context.Context - body *AuthNMappingCreateRequest -} - -func (a *AuthNMappingsApi) buildCreateAuthNMappingRequest(ctx _context.Context, body AuthNMappingCreateRequest) (apiCreateAuthNMappingRequest, error) { - req := apiCreateAuthNMappingRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateAuthNMapping Create an AuthN Mapping. -// Create an AuthN Mapping. -func (a *AuthNMappingsApi) CreateAuthNMapping(ctx _context.Context, body AuthNMappingCreateRequest) (AuthNMappingResponse, *_nethttp.Response, error) { - req, err := a.buildCreateAuthNMappingRequest(ctx, body) - if err != nil { - var localVarReturnValue AuthNMappingResponse - return localVarReturnValue, nil, err - } - - return a.createAuthNMappingExecute(req) -} - -// createAuthNMappingExecute executes the request. -func (a *AuthNMappingsApi) createAuthNMappingExecute(r apiCreateAuthNMappingRequest) (AuthNMappingResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue AuthNMappingResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.CreateAuthNMapping") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/authn_mappings" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteAuthNMappingRequest struct { - ctx _context.Context - authnMappingId string -} - -func (a *AuthNMappingsApi) buildDeleteAuthNMappingRequest(ctx _context.Context, authnMappingId string) (apiDeleteAuthNMappingRequest, error) { - req := apiDeleteAuthNMappingRequest{ - ctx: ctx, - authnMappingId: authnMappingId, - } - return req, nil -} - -// DeleteAuthNMapping Delete an AuthN Mapping. -// Delete an AuthN Mapping specified by AuthN Mapping UUID. -func (a *AuthNMappingsApi) DeleteAuthNMapping(ctx _context.Context, authnMappingId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteAuthNMappingRequest(ctx, authnMappingId) - if err != nil { - return nil, err - } - - return a.deleteAuthNMappingExecute(req) -} - -// deleteAuthNMappingExecute executes the request. -func (a *AuthNMappingsApi) deleteAuthNMappingExecute(r apiDeleteAuthNMappingRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.DeleteAuthNMapping") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/authn_mappings/{authn_mapping_id}" - localVarPath = strings.Replace(localVarPath, "{"+"authn_mapping_id"+"}", _neturl.PathEscape(common.ParameterToString(r.authnMappingId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetAuthNMappingRequest struct { - ctx _context.Context - authnMappingId string -} - -func (a *AuthNMappingsApi) buildGetAuthNMappingRequest(ctx _context.Context, authnMappingId string) (apiGetAuthNMappingRequest, error) { - req := apiGetAuthNMappingRequest{ - ctx: ctx, - authnMappingId: authnMappingId, - } - return req, nil -} - -// GetAuthNMapping Get an AuthN Mapping by UUID. -// Get an AuthN Mapping specified by the AuthN Mapping UUID. -func (a *AuthNMappingsApi) GetAuthNMapping(ctx _context.Context, authnMappingId string) (AuthNMappingResponse, *_nethttp.Response, error) { - req, err := a.buildGetAuthNMappingRequest(ctx, authnMappingId) - if err != nil { - var localVarReturnValue AuthNMappingResponse - return localVarReturnValue, nil, err - } - - return a.getAuthNMappingExecute(req) -} - -// getAuthNMappingExecute executes the request. -func (a *AuthNMappingsApi) getAuthNMappingExecute(r apiGetAuthNMappingRequest) (AuthNMappingResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue AuthNMappingResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.GetAuthNMapping") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/authn_mappings/{authn_mapping_id}" - localVarPath = strings.Replace(localVarPath, "{"+"authn_mapping_id"+"}", _neturl.PathEscape(common.ParameterToString(r.authnMappingId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAuthNMappingsRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sort *AuthNMappingsSort - filter *string -} - -// ListAuthNMappingsOptionalParameters holds optional parameters for ListAuthNMappings. -type ListAuthNMappingsOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *AuthNMappingsSort - Filter *string -} - -// NewListAuthNMappingsOptionalParameters creates an empty struct for parameters. -func NewListAuthNMappingsOptionalParameters() *ListAuthNMappingsOptionalParameters { - this := ListAuthNMappingsOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListAuthNMappingsOptionalParameters) WithPageSize(pageSize int64) *ListAuthNMappingsOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListAuthNMappingsOptionalParameters) WithPageNumber(pageNumber int64) *ListAuthNMappingsOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListAuthNMappingsOptionalParameters) WithSort(sort AuthNMappingsSort) *ListAuthNMappingsOptionalParameters { - r.Sort = &sort - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListAuthNMappingsOptionalParameters) WithFilter(filter string) *ListAuthNMappingsOptionalParameters { - r.Filter = &filter - return r -} - -func (a *AuthNMappingsApi) buildListAuthNMappingsRequest(ctx _context.Context, o ...ListAuthNMappingsOptionalParameters) (apiListAuthNMappingsRequest, error) { - req := apiListAuthNMappingsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListAuthNMappingsOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.filter = o[0].Filter - } - return req, nil -} - -// ListAuthNMappings List all AuthN Mappings. -// List all AuthN Mappings in the org. -func (a *AuthNMappingsApi) ListAuthNMappings(ctx _context.Context, o ...ListAuthNMappingsOptionalParameters) (AuthNMappingsResponse, *_nethttp.Response, error) { - req, err := a.buildListAuthNMappingsRequest(ctx, o...) - if err != nil { - var localVarReturnValue AuthNMappingsResponse - return localVarReturnValue, nil, err - } - - return a.listAuthNMappingsExecute(req) -} - -// listAuthNMappingsExecute executes the request. -func (a *AuthNMappingsApi) listAuthNMappingsExecute(r apiListAuthNMappingsRequest) (AuthNMappingsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue AuthNMappingsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.ListAuthNMappings") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/authn_mappings" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateAuthNMappingRequest struct { - ctx _context.Context - authnMappingId string - body *AuthNMappingUpdateRequest -} - -func (a *AuthNMappingsApi) buildUpdateAuthNMappingRequest(ctx _context.Context, authnMappingId string, body AuthNMappingUpdateRequest) (apiUpdateAuthNMappingRequest, error) { - req := apiUpdateAuthNMappingRequest{ - ctx: ctx, - authnMappingId: authnMappingId, - body: &body, - } - return req, nil -} - -// UpdateAuthNMapping Edit an AuthN Mapping. -// Edit an AuthN Mapping. -func (a *AuthNMappingsApi) UpdateAuthNMapping(ctx _context.Context, authnMappingId string, body AuthNMappingUpdateRequest) (AuthNMappingResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateAuthNMappingRequest(ctx, authnMappingId, body) - if err != nil { - var localVarReturnValue AuthNMappingResponse - return localVarReturnValue, nil, err - } - - return a.updateAuthNMappingExecute(req) -} - -// updateAuthNMappingExecute executes the request. -func (a *AuthNMappingsApi) updateAuthNMappingExecute(r apiUpdateAuthNMappingRequest) (AuthNMappingResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue AuthNMappingResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.UpdateAuthNMapping") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/authn_mappings/{authn_mapping_id}" - localVarPath = strings.Replace(localVarPath, "{"+"authn_mapping_id"+"}", _neturl.PathEscape(common.ParameterToString(r.authnMappingId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if localVarHTTPResponse.StatusCode == 422 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewAuthNMappingsApi Returns NewAuthNMappingsApi. -func NewAuthNMappingsApi(client *common.APIClient) *AuthNMappingsApi { - return &AuthNMappingsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_cloud_workload_security.go b/api/v2/datadog/api_cloud_workload_security.go deleted file mode 100644 index e863df85d6f..00000000000 --- a/api/v2/datadog/api_cloud_workload_security.go +++ /dev/null @@ -1,857 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "os" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// CloudWorkloadSecurityApi service type -type CloudWorkloadSecurityApi common.Service - -type apiCreateCloudWorkloadSecurityAgentRuleRequest struct { - ctx _context.Context - body *CloudWorkloadSecurityAgentRuleCreateRequest -} - -func (a *CloudWorkloadSecurityApi) buildCreateCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, body CloudWorkloadSecurityAgentRuleCreateRequest) (apiCreateCloudWorkloadSecurityAgentRuleRequest, error) { - req := apiCreateCloudWorkloadSecurityAgentRuleRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateCloudWorkloadSecurityAgentRule Create a Cloud Workload Security Agent rule. -// Create a new Agent rule with the given parameters. -func (a *CloudWorkloadSecurityApi) CreateCloudWorkloadSecurityAgentRule(ctx _context.Context, body CloudWorkloadSecurityAgentRuleCreateRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { - req, err := a.buildCreateCloudWorkloadSecurityAgentRuleRequest(ctx, body) - if err != nil { - var localVarReturnValue CloudWorkloadSecurityAgentRuleResponse - return localVarReturnValue, nil, err - } - - return a.createCloudWorkloadSecurityAgentRuleExecute(req) -} - -// createCloudWorkloadSecurityAgentRuleExecute executes the request. -func (a *CloudWorkloadSecurityApi) createCloudWorkloadSecurityAgentRuleExecute(r apiCreateCloudWorkloadSecurityAgentRuleRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue CloudWorkloadSecurityAgentRuleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.CreateCloudWorkloadSecurityAgentRule") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteCloudWorkloadSecurityAgentRuleRequest struct { - ctx _context.Context - agentRuleId string -} - -func (a *CloudWorkloadSecurityApi) buildDeleteCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, agentRuleId string) (apiDeleteCloudWorkloadSecurityAgentRuleRequest, error) { - req := apiDeleteCloudWorkloadSecurityAgentRuleRequest{ - ctx: ctx, - agentRuleId: agentRuleId, - } - return req, nil -} - -// DeleteCloudWorkloadSecurityAgentRule Delete a Cloud Workload Security Agent rule. -// Delete a specific Agent rule. -func (a *CloudWorkloadSecurityApi) DeleteCloudWorkloadSecurityAgentRule(ctx _context.Context, agentRuleId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteCloudWorkloadSecurityAgentRuleRequest(ctx, agentRuleId) - if err != nil { - return nil, err - } - - return a.deleteCloudWorkloadSecurityAgentRuleExecute(req) -} - -// deleteCloudWorkloadSecurityAgentRuleExecute executes the request. -func (a *CloudWorkloadSecurityApi) deleteCloudWorkloadSecurityAgentRuleExecute(r apiDeleteCloudWorkloadSecurityAgentRuleRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.DeleteCloudWorkloadSecurityAgentRule") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}" - localVarPath = strings.Replace(localVarPath, "{"+"agent_rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.agentRuleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiDownloadCloudWorkloadPolicyFileRequest struct { - ctx _context.Context -} - -func (a *CloudWorkloadSecurityApi) buildDownloadCloudWorkloadPolicyFileRequest(ctx _context.Context) (apiDownloadCloudWorkloadPolicyFileRequest, error) { - req := apiDownloadCloudWorkloadPolicyFileRequest{ - ctx: ctx, - } - return req, nil -} - -// DownloadCloudWorkloadPolicyFile Get the latest Cloud Workload Security policy. -// The download endpoint generates a Cloud Workload Security policy file from your currently active -// Cloud Workload Security rules, and downloads them as a .policy file. This file can then be deployed to -// your agents to update the policy running in your environment. -func (a *CloudWorkloadSecurityApi) DownloadCloudWorkloadPolicyFile(ctx _context.Context) (*os.File, *_nethttp.Response, error) { - req, err := a.buildDownloadCloudWorkloadPolicyFileRequest(ctx) - if err != nil { - var localVarReturnValue *os.File - return localVarReturnValue, nil, err - } - - return a.downloadCloudWorkloadPolicyFileExecute(req) -} - -// downloadCloudWorkloadPolicyFileExecute executes the request. -func (a *CloudWorkloadSecurityApi) downloadCloudWorkloadPolicyFileExecute(r apiDownloadCloudWorkloadPolicyFileRequest) (*os.File, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue *os.File - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.DownloadCloudWorkloadPolicyFile") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security/cloud_workload/policy/download" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetCloudWorkloadSecurityAgentRuleRequest struct { - ctx _context.Context - agentRuleId string -} - -func (a *CloudWorkloadSecurityApi) buildGetCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, agentRuleId string) (apiGetCloudWorkloadSecurityAgentRuleRequest, error) { - req := apiGetCloudWorkloadSecurityAgentRuleRequest{ - ctx: ctx, - agentRuleId: agentRuleId, - } - return req, nil -} - -// GetCloudWorkloadSecurityAgentRule Get a Cloud Workload Security Agent rule. -// Get the details of a specific Agent rule. -func (a *CloudWorkloadSecurityApi) GetCloudWorkloadSecurityAgentRule(ctx _context.Context, agentRuleId string) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { - req, err := a.buildGetCloudWorkloadSecurityAgentRuleRequest(ctx, agentRuleId) - if err != nil { - var localVarReturnValue CloudWorkloadSecurityAgentRuleResponse - return localVarReturnValue, nil, err - } - - return a.getCloudWorkloadSecurityAgentRuleExecute(req) -} - -// getCloudWorkloadSecurityAgentRuleExecute executes the request. -func (a *CloudWorkloadSecurityApi) getCloudWorkloadSecurityAgentRuleExecute(r apiGetCloudWorkloadSecurityAgentRuleRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue CloudWorkloadSecurityAgentRuleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.GetCloudWorkloadSecurityAgentRule") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}" - localVarPath = strings.Replace(localVarPath, "{"+"agent_rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.agentRuleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListCloudWorkloadSecurityAgentRulesRequest struct { - ctx _context.Context -} - -func (a *CloudWorkloadSecurityApi) buildListCloudWorkloadSecurityAgentRulesRequest(ctx _context.Context) (apiListCloudWorkloadSecurityAgentRulesRequest, error) { - req := apiListCloudWorkloadSecurityAgentRulesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListCloudWorkloadSecurityAgentRules Get all Cloud Workload Security Agent rules. -// Get the list of Agent rules. -func (a *CloudWorkloadSecurityApi) ListCloudWorkloadSecurityAgentRules(ctx _context.Context) (CloudWorkloadSecurityAgentRulesListResponse, *_nethttp.Response, error) { - req, err := a.buildListCloudWorkloadSecurityAgentRulesRequest(ctx) - if err != nil { - var localVarReturnValue CloudWorkloadSecurityAgentRulesListResponse - return localVarReturnValue, nil, err - } - - return a.listCloudWorkloadSecurityAgentRulesExecute(req) -} - -// listCloudWorkloadSecurityAgentRulesExecute executes the request. -func (a *CloudWorkloadSecurityApi) listCloudWorkloadSecurityAgentRulesExecute(r apiListCloudWorkloadSecurityAgentRulesRequest) (CloudWorkloadSecurityAgentRulesListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue CloudWorkloadSecurityAgentRulesListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.ListCloudWorkloadSecurityAgentRules") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateCloudWorkloadSecurityAgentRuleRequest struct { - ctx _context.Context - agentRuleId string - body *CloudWorkloadSecurityAgentRuleUpdateRequest -} - -func (a *CloudWorkloadSecurityApi) buildUpdateCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, agentRuleId string, body CloudWorkloadSecurityAgentRuleUpdateRequest) (apiUpdateCloudWorkloadSecurityAgentRuleRequest, error) { - req := apiUpdateCloudWorkloadSecurityAgentRuleRequest{ - ctx: ctx, - agentRuleId: agentRuleId, - body: &body, - } - return req, nil -} - -// UpdateCloudWorkloadSecurityAgentRule Update a Cloud Workload Security Agent rule. -// Update a specific Agent rule. -// Returns the Agent rule object when the request is successful. -func (a *CloudWorkloadSecurityApi) UpdateCloudWorkloadSecurityAgentRule(ctx _context.Context, agentRuleId string, body CloudWorkloadSecurityAgentRuleUpdateRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateCloudWorkloadSecurityAgentRuleRequest(ctx, agentRuleId, body) - if err != nil { - var localVarReturnValue CloudWorkloadSecurityAgentRuleResponse - return localVarReturnValue, nil, err - } - - return a.updateCloudWorkloadSecurityAgentRuleExecute(req) -} - -// updateCloudWorkloadSecurityAgentRuleExecute executes the request. -func (a *CloudWorkloadSecurityApi) updateCloudWorkloadSecurityAgentRuleExecute(r apiUpdateCloudWorkloadSecurityAgentRuleRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue CloudWorkloadSecurityAgentRuleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.UpdateCloudWorkloadSecurityAgentRule") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}" - localVarPath = strings.Replace(localVarPath, "{"+"agent_rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.agentRuleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewCloudWorkloadSecurityApi Returns NewCloudWorkloadSecurityApi. -func NewCloudWorkloadSecurityApi(client *common.APIClient) *CloudWorkloadSecurityApi { - return &CloudWorkloadSecurityApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_dashboard_lists.go b/api/v2/datadog/api_dashboard_lists.go deleted file mode 100644 index aadb66368f7..00000000000 --- a/api/v2/datadog/api_dashboard_lists.go +++ /dev/null @@ -1,625 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// DashboardListsApi service type -type DashboardListsApi common.Service - -type apiCreateDashboardListItemsRequest struct { - ctx _context.Context - dashboardListId int64 - body *DashboardListAddItemsRequest -} - -func (a *DashboardListsApi) buildCreateDashboardListItemsRequest(ctx _context.Context, dashboardListId int64, body DashboardListAddItemsRequest) (apiCreateDashboardListItemsRequest, error) { - req := apiCreateDashboardListItemsRequest{ - ctx: ctx, - dashboardListId: dashboardListId, - body: &body, - } - return req, nil -} - -// CreateDashboardListItems Add Items to a Dashboard List. -// Add dashboards to an existing dashboard list. -func (a *DashboardListsApi) CreateDashboardListItems(ctx _context.Context, dashboardListId int64, body DashboardListAddItemsRequest) (DashboardListAddItemsResponse, *_nethttp.Response, error) { - req, err := a.buildCreateDashboardListItemsRequest(ctx, dashboardListId, body) - if err != nil { - var localVarReturnValue DashboardListAddItemsResponse - return localVarReturnValue, nil, err - } - - return a.createDashboardListItemsExecute(req) -} - -// createDashboardListItemsExecute executes the request. -func (a *DashboardListsApi) createDashboardListItemsExecute(r apiCreateDashboardListItemsRequest) (DashboardListAddItemsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue DashboardListAddItemsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.CreateDashboardListItems") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" - localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteDashboardListItemsRequest struct { - ctx _context.Context - dashboardListId int64 - body *DashboardListDeleteItemsRequest -} - -func (a *DashboardListsApi) buildDeleteDashboardListItemsRequest(ctx _context.Context, dashboardListId int64, body DashboardListDeleteItemsRequest) (apiDeleteDashboardListItemsRequest, error) { - req := apiDeleteDashboardListItemsRequest{ - ctx: ctx, - dashboardListId: dashboardListId, - body: &body, - } - return req, nil -} - -// DeleteDashboardListItems Delete items from a dashboard list. -// Delete dashboards from an existing dashboard list. -func (a *DashboardListsApi) DeleteDashboardListItems(ctx _context.Context, dashboardListId int64, body DashboardListDeleteItemsRequest) (DashboardListDeleteItemsResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteDashboardListItemsRequest(ctx, dashboardListId, body) - if err != nil { - var localVarReturnValue DashboardListDeleteItemsResponse - return localVarReturnValue, nil, err - } - - return a.deleteDashboardListItemsExecute(req) -} - -// deleteDashboardListItemsExecute executes the request. -func (a *DashboardListsApi) deleteDashboardListItemsExecute(r apiDeleteDashboardListItemsRequest) (DashboardListDeleteItemsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue DashboardListDeleteItemsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.DeleteDashboardListItems") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" - localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetDashboardListItemsRequest struct { - ctx _context.Context - dashboardListId int64 -} - -func (a *DashboardListsApi) buildGetDashboardListItemsRequest(ctx _context.Context, dashboardListId int64) (apiGetDashboardListItemsRequest, error) { - req := apiGetDashboardListItemsRequest{ - ctx: ctx, - dashboardListId: dashboardListId, - } - return req, nil -} - -// GetDashboardListItems Get items of a Dashboard List. -// Fetch the dashboard list’s dashboard definitions. -func (a *DashboardListsApi) GetDashboardListItems(ctx _context.Context, dashboardListId int64) (DashboardListItems, *_nethttp.Response, error) { - req, err := a.buildGetDashboardListItemsRequest(ctx, dashboardListId) - if err != nil { - var localVarReturnValue DashboardListItems - return localVarReturnValue, nil, err - } - - return a.getDashboardListItemsExecute(req) -} - -// getDashboardListItemsExecute executes the request. -func (a *DashboardListsApi) getDashboardListItemsExecute(r apiGetDashboardListItemsRequest) (DashboardListItems, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue DashboardListItems - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.GetDashboardListItems") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" - localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateDashboardListItemsRequest struct { - ctx _context.Context - dashboardListId int64 - body *DashboardListUpdateItemsRequest -} - -func (a *DashboardListsApi) buildUpdateDashboardListItemsRequest(ctx _context.Context, dashboardListId int64, body DashboardListUpdateItemsRequest) (apiUpdateDashboardListItemsRequest, error) { - req := apiUpdateDashboardListItemsRequest{ - ctx: ctx, - dashboardListId: dashboardListId, - body: &body, - } - return req, nil -} - -// UpdateDashboardListItems Update items of a dashboard list. -// Update dashboards of an existing dashboard list. -func (a *DashboardListsApi) UpdateDashboardListItems(ctx _context.Context, dashboardListId int64, body DashboardListUpdateItemsRequest) (DashboardListUpdateItemsResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateDashboardListItemsRequest(ctx, dashboardListId, body) - if err != nil { - var localVarReturnValue DashboardListUpdateItemsResponse - return localVarReturnValue, nil, err - } - - return a.updateDashboardListItemsExecute(req) -} - -// updateDashboardListItemsExecute executes the request. -func (a *DashboardListsApi) updateDashboardListItemsExecute(r apiUpdateDashboardListItemsRequest) (DashboardListUpdateItemsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue DashboardListUpdateItemsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.UpdateDashboardListItems") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" - localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewDashboardListsApi Returns NewDashboardListsApi. -func NewDashboardListsApi(client *common.APIClient) *DashboardListsApi { - return &DashboardListsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_events.go b/api/v2/datadog/api_events.go deleted file mode 100644 index 52a7abf241e..00000000000 --- a/api/v2/datadog/api_events.go +++ /dev/null @@ -1,561 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _fmt "fmt" - _ioutil "io/ioutil" - _log "log" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// EventsApi service type -type EventsApi common.Service - -type apiListEventsRequest struct { - ctx _context.Context - filterQuery *string - filterFrom *string - filterTo *string - sort *EventsSort - pageCursor *string - pageLimit *int32 -} - -// ListEventsOptionalParameters holds optional parameters for ListEvents. -type ListEventsOptionalParameters struct { - FilterQuery *string - FilterFrom *string - FilterTo *string - Sort *EventsSort - PageCursor *string - PageLimit *int32 -} - -// NewListEventsOptionalParameters creates an empty struct for parameters. -func NewListEventsOptionalParameters() *ListEventsOptionalParameters { - this := ListEventsOptionalParameters{} - return &this -} - -// WithFilterQuery sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithFilterQuery(filterQuery string) *ListEventsOptionalParameters { - r.FilterQuery = &filterQuery - return r -} - -// WithFilterFrom sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithFilterFrom(filterFrom string) *ListEventsOptionalParameters { - r.FilterFrom = &filterFrom - return r -} - -// WithFilterTo sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithFilterTo(filterTo string) *ListEventsOptionalParameters { - r.FilterTo = &filterTo - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithSort(sort EventsSort) *ListEventsOptionalParameters { - r.Sort = &sort - return r -} - -// WithPageCursor sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithPageCursor(pageCursor string) *ListEventsOptionalParameters { - r.PageCursor = &pageCursor - return r -} - -// WithPageLimit sets the corresponding parameter name and returns the struct. -func (r *ListEventsOptionalParameters) WithPageLimit(pageLimit int32) *ListEventsOptionalParameters { - r.PageLimit = &pageLimit - return r -} - -func (a *EventsApi) buildListEventsRequest(ctx _context.Context, o ...ListEventsOptionalParameters) (apiListEventsRequest, error) { - req := apiListEventsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListEventsOptionalParameters is allowed") - } - - if o != nil { - req.filterQuery = o[0].FilterQuery - req.filterFrom = o[0].FilterFrom - req.filterTo = o[0].FilterTo - req.sort = o[0].Sort - req.pageCursor = o[0].PageCursor - req.pageLimit = o[0].PageLimit - } - return req, nil -} - -// ListEvents Get a list of events. -// List endpoint returns events that match an events search query. -// [Results are paginated similarly to logs](https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination). -// -// Use this endpoint to see your latest events. -func (a *EventsApi) ListEvents(ctx _context.Context, o ...ListEventsOptionalParameters) (EventsListResponse, *_nethttp.Response, error) { - req, err := a.buildListEventsRequest(ctx, o...) - if err != nil { - var localVarReturnValue EventsListResponse - return localVarReturnValue, nil, err - } - - return a.listEventsExecute(req) -} - -// ListEventsWithPagination provides a paginated version of ListEvents returning a channel with all items. -func (a *EventsApi) ListEventsWithPagination(ctx _context.Context, o ...ListEventsOptionalParameters) (<-chan EventResponse, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, ListEventsOptionalParameters{}) - } - if o[0].PageLimit != nil { - pageSize_ = *o[0].PageLimit - } - o[0].PageLimit = &pageSize_ - - items := make(chan EventResponse, pageSize_) - go func() { - for { - req, err := a.buildListEventsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listEventsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].PageCursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// listEventsExecute executes the request. -func (a *EventsApi) listEventsExecute(r apiListEventsRequest) (EventsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue EventsListResponse - ) - - operationId := "v2.ListEvents" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.EventsApi.ListEvents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/events" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterQuery != nil { - localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) - } - if r.filterFrom != nil { - localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) - } - if r.filterTo != nil { - localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.pageCursor != nil { - localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) - } - if r.pageLimit != nil { - localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSearchEventsRequest struct { - ctx _context.Context - body *EventsListRequest -} - -// SearchEventsOptionalParameters holds optional parameters for SearchEvents. -type SearchEventsOptionalParameters struct { - Body *EventsListRequest -} - -// NewSearchEventsOptionalParameters creates an empty struct for parameters. -func NewSearchEventsOptionalParameters() *SearchEventsOptionalParameters { - this := SearchEventsOptionalParameters{} - return &this -} - -// WithBody sets the corresponding parameter name and returns the struct. -func (r *SearchEventsOptionalParameters) WithBody(body EventsListRequest) *SearchEventsOptionalParameters { - r.Body = &body - return r -} - -func (a *EventsApi) buildSearchEventsRequest(ctx _context.Context, o ...SearchEventsOptionalParameters) (apiSearchEventsRequest, error) { - req := apiSearchEventsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SearchEventsOptionalParameters is allowed") - } - - if o != nil { - req.body = o[0].Body - } - return req, nil -} - -// SearchEvents Search events. -// List endpoint returns events that match an events search query. -// [Results are paginated similarly to logs](https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination). -// -// Use this endpoint to build complex events filtering and search. -func (a *EventsApi) SearchEvents(ctx _context.Context, o ...SearchEventsOptionalParameters) (EventsListResponse, *_nethttp.Response, error) { - req, err := a.buildSearchEventsRequest(ctx, o...) - if err != nil { - var localVarReturnValue EventsListResponse - return localVarReturnValue, nil, err - } - - return a.searchEventsExecute(req) -} - -// SearchEventsWithPagination provides a paginated version of SearchEvents returning a channel with all items. -func (a *EventsApi) SearchEventsWithPagination(ctx _context.Context, o ...SearchEventsOptionalParameters) (<-chan EventResponse, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, SearchEventsOptionalParameters{}) - } - if o[0].Body == nil { - o[0].Body = NewEventsListRequest() - } - if o[0].Body.Page == nil { - o[0].Body.Page = NewEventsRequestPage() - } - if o[0].Body.Page.Limit != nil { - pageSize_ = *o[0].Body.Page.Limit - } - o[0].Body.Page.Limit = &pageSize_ - - items := make(chan EventResponse, pageSize_) - go func() { - for { - req, err := a.buildSearchEventsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.searchEventsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].Body.Page.Cursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// searchEventsExecute executes the request. -func (a *EventsApi) searchEventsExecute(r apiSearchEventsRequest) (EventsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue EventsListResponse - ) - - operationId := "v2.SearchEvents" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.EventsApi.SearchEvents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/events/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewEventsApi Returns NewEventsApi. -func NewEventsApi(client *common.APIClient) *EventsApi { - return &EventsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_incident_services.go b/api/v2/datadog/api_incident_services.go deleted file mode 100644 index 90425b9d520..00000000000 --- a/api/v2/datadog/api_incident_services.go +++ /dev/null @@ -1,932 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _fmt "fmt" - _ioutil "io/ioutil" - _log "log" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// IncidentServicesApi service type -type IncidentServicesApi common.Service - -type apiCreateIncidentServiceRequest struct { - ctx _context.Context - body *IncidentServiceCreateRequest -} - -func (a *IncidentServicesApi) buildCreateIncidentServiceRequest(ctx _context.Context, body IncidentServiceCreateRequest) (apiCreateIncidentServiceRequest, error) { - req := apiCreateIncidentServiceRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateIncidentService Create a new incident service. -// Creates a new incident service. -func (a *IncidentServicesApi) CreateIncidentService(ctx _context.Context, body IncidentServiceCreateRequest) (IncidentServiceResponse, *_nethttp.Response, error) { - req, err := a.buildCreateIncidentServiceRequest(ctx, body) - if err != nil { - var localVarReturnValue IncidentServiceResponse - return localVarReturnValue, nil, err - } - - return a.createIncidentServiceExecute(req) -} - -// createIncidentServiceExecute executes the request. -func (a *IncidentServicesApi) createIncidentServiceExecute(r apiCreateIncidentServiceRequest) (IncidentServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IncidentServiceResponse - ) - - operationId := "v2.CreateIncidentService" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.CreateIncidentService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteIncidentServiceRequest struct { - ctx _context.Context - serviceId string -} - -func (a *IncidentServicesApi) buildDeleteIncidentServiceRequest(ctx _context.Context, serviceId string) (apiDeleteIncidentServiceRequest, error) { - req := apiDeleteIncidentServiceRequest{ - ctx: ctx, - serviceId: serviceId, - } - return req, nil -} - -// DeleteIncidentService Delete an existing incident service. -// Deletes an existing incident service. -func (a *IncidentServicesApi) DeleteIncidentService(ctx _context.Context, serviceId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteIncidentServiceRequest(ctx, serviceId) - if err != nil { - return nil, err - } - - return a.deleteIncidentServiceExecute(req) -} - -// deleteIncidentServiceExecute executes the request. -func (a *IncidentServicesApi) deleteIncidentServiceExecute(r apiDeleteIncidentServiceRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - operationId := "v2.DeleteIncidentService" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.DeleteIncidentService") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services/{service_id}" - localVarPath = strings.Replace(localVarPath, "{"+"service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetIncidentServiceRequest struct { - ctx _context.Context - serviceId string - include *IncidentRelatedObject -} - -// GetIncidentServiceOptionalParameters holds optional parameters for GetIncidentService. -type GetIncidentServiceOptionalParameters struct { - Include *IncidentRelatedObject -} - -// NewGetIncidentServiceOptionalParameters creates an empty struct for parameters. -func NewGetIncidentServiceOptionalParameters() *GetIncidentServiceOptionalParameters { - this := GetIncidentServiceOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetIncidentServiceOptionalParameters) WithInclude(include IncidentRelatedObject) *GetIncidentServiceOptionalParameters { - r.Include = &include - return r -} - -func (a *IncidentServicesApi) buildGetIncidentServiceRequest(ctx _context.Context, serviceId string, o ...GetIncidentServiceOptionalParameters) (apiGetIncidentServiceRequest, error) { - req := apiGetIncidentServiceRequest{ - ctx: ctx, - serviceId: serviceId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetIncidentServiceOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - } - return req, nil -} - -// GetIncidentService Get details of an incident service. -// Get details of an incident service. If the `include[users]` query parameter is provided, -// the included attribute will contain the users related to these incident services. -func (a *IncidentServicesApi) GetIncidentService(ctx _context.Context, serviceId string, o ...GetIncidentServiceOptionalParameters) (IncidentServiceResponse, *_nethttp.Response, error) { - req, err := a.buildGetIncidentServiceRequest(ctx, serviceId, o...) - if err != nil { - var localVarReturnValue IncidentServiceResponse - return localVarReturnValue, nil, err - } - - return a.getIncidentServiceExecute(req) -} - -// getIncidentServiceExecute executes the request. -func (a *IncidentServicesApi) getIncidentServiceExecute(r apiGetIncidentServiceRequest) (IncidentServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentServiceResponse - ) - - operationId := "v2.GetIncidentService" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.GetIncidentService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services/{service_id}" - localVarPath = strings.Replace(localVarPath, "{"+"service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListIncidentServicesRequest struct { - ctx _context.Context - include *IncidentRelatedObject - pageSize *int64 - pageOffset *int64 - filter *string -} - -// ListIncidentServicesOptionalParameters holds optional parameters for ListIncidentServices. -type ListIncidentServicesOptionalParameters struct { - Include *IncidentRelatedObject - PageSize *int64 - PageOffset *int64 - Filter *string -} - -// NewListIncidentServicesOptionalParameters creates an empty struct for parameters. -func NewListIncidentServicesOptionalParameters() *ListIncidentServicesOptionalParameters { - this := ListIncidentServicesOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithInclude(include IncidentRelatedObject) *ListIncidentServicesOptionalParameters { - r.Include = &include - return r -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithPageSize(pageSize int64) *ListIncidentServicesOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageOffset sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithPageOffset(pageOffset int64) *ListIncidentServicesOptionalParameters { - r.PageOffset = &pageOffset - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListIncidentServicesOptionalParameters) WithFilter(filter string) *ListIncidentServicesOptionalParameters { - r.Filter = &filter - return r -} - -func (a *IncidentServicesApi) buildListIncidentServicesRequest(ctx _context.Context, o ...ListIncidentServicesOptionalParameters) (apiListIncidentServicesRequest, error) { - req := apiListIncidentServicesRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListIncidentServicesOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - req.pageSize = o[0].PageSize - req.pageOffset = o[0].PageOffset - req.filter = o[0].Filter - } - return req, nil -} - -// ListIncidentServices Get a list of all incident services. -// Get all incident services uploaded for the requesting user's organization. If the `include[users]` query parameter is provided, the included attribute will contain the users related to these incident services. -func (a *IncidentServicesApi) ListIncidentServices(ctx _context.Context, o ...ListIncidentServicesOptionalParameters) (IncidentServicesResponse, *_nethttp.Response, error) { - req, err := a.buildListIncidentServicesRequest(ctx, o...) - if err != nil { - var localVarReturnValue IncidentServicesResponse - return localVarReturnValue, nil, err - } - - return a.listIncidentServicesExecute(req) -} - -// listIncidentServicesExecute executes the request. -func (a *IncidentServicesApi) listIncidentServicesExecute(r apiListIncidentServicesRequest) (IncidentServicesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentServicesResponse - ) - - operationId := "v2.ListIncidentServices" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.ListIncidentServices") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) - } - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageOffset != nil { - localVarQueryParams.Add("page[offset]", common.ParameterToString(*r.pageOffset, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateIncidentServiceRequest struct { - ctx _context.Context - serviceId string - body *IncidentServiceUpdateRequest -} - -func (a *IncidentServicesApi) buildUpdateIncidentServiceRequest(ctx _context.Context, serviceId string, body IncidentServiceUpdateRequest) (apiUpdateIncidentServiceRequest, error) { - req := apiUpdateIncidentServiceRequest{ - ctx: ctx, - serviceId: serviceId, - body: &body, - } - return req, nil -} - -// UpdateIncidentService Update an existing incident service. -// Updates an existing incident service. Only provide the attributes which should be updated as this request is a partial update. -func (a *IncidentServicesApi) UpdateIncidentService(ctx _context.Context, serviceId string, body IncidentServiceUpdateRequest) (IncidentServiceResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateIncidentServiceRequest(ctx, serviceId, body) - if err != nil { - var localVarReturnValue IncidentServiceResponse - return localVarReturnValue, nil, err - } - - return a.updateIncidentServiceExecute(req) -} - -// updateIncidentServiceExecute executes the request. -func (a *IncidentServicesApi) updateIncidentServiceExecute(r apiUpdateIncidentServiceRequest) (IncidentServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue IncidentServiceResponse - ) - - operationId := "v2.UpdateIncidentService" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.UpdateIncidentService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/services/{service_id}" - localVarPath = strings.Replace(localVarPath, "{"+"service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewIncidentServicesApi Returns NewIncidentServicesApi. -func NewIncidentServicesApi(client *common.APIClient) *IncidentServicesApi { - return &IncidentServicesApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_incident_teams.go b/api/v2/datadog/api_incident_teams.go deleted file mode 100644 index e8f13df5b36..00000000000 --- a/api/v2/datadog/api_incident_teams.go +++ /dev/null @@ -1,932 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _fmt "fmt" - _ioutil "io/ioutil" - _log "log" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// IncidentTeamsApi service type -type IncidentTeamsApi common.Service - -type apiCreateIncidentTeamRequest struct { - ctx _context.Context - body *IncidentTeamCreateRequest -} - -func (a *IncidentTeamsApi) buildCreateIncidentTeamRequest(ctx _context.Context, body IncidentTeamCreateRequest) (apiCreateIncidentTeamRequest, error) { - req := apiCreateIncidentTeamRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateIncidentTeam Create a new incident team. -// Creates a new incident team. -func (a *IncidentTeamsApi) CreateIncidentTeam(ctx _context.Context, body IncidentTeamCreateRequest) (IncidentTeamResponse, *_nethttp.Response, error) { - req, err := a.buildCreateIncidentTeamRequest(ctx, body) - if err != nil { - var localVarReturnValue IncidentTeamResponse - return localVarReturnValue, nil, err - } - - return a.createIncidentTeamExecute(req) -} - -// createIncidentTeamExecute executes the request. -func (a *IncidentTeamsApi) createIncidentTeamExecute(r apiCreateIncidentTeamRequest) (IncidentTeamResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IncidentTeamResponse - ) - - operationId := "v2.CreateIncidentTeam" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.CreateIncidentTeam") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/teams" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteIncidentTeamRequest struct { - ctx _context.Context - teamId string -} - -func (a *IncidentTeamsApi) buildDeleteIncidentTeamRequest(ctx _context.Context, teamId string) (apiDeleteIncidentTeamRequest, error) { - req := apiDeleteIncidentTeamRequest{ - ctx: ctx, - teamId: teamId, - } - return req, nil -} - -// DeleteIncidentTeam Delete an existing incident team. -// Deletes an existing incident team. -func (a *IncidentTeamsApi) DeleteIncidentTeam(ctx _context.Context, teamId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteIncidentTeamRequest(ctx, teamId) - if err != nil { - return nil, err - } - - return a.deleteIncidentTeamExecute(req) -} - -// deleteIncidentTeamExecute executes the request. -func (a *IncidentTeamsApi) deleteIncidentTeamExecute(r apiDeleteIncidentTeamRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - operationId := "v2.DeleteIncidentTeam" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.DeleteIncidentTeam") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/teams/{team_id}" - localVarPath = strings.Replace(localVarPath, "{"+"team_id"+"}", _neturl.PathEscape(common.ParameterToString(r.teamId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetIncidentTeamRequest struct { - ctx _context.Context - teamId string - include *IncidentRelatedObject -} - -// GetIncidentTeamOptionalParameters holds optional parameters for GetIncidentTeam. -type GetIncidentTeamOptionalParameters struct { - Include *IncidentRelatedObject -} - -// NewGetIncidentTeamOptionalParameters creates an empty struct for parameters. -func NewGetIncidentTeamOptionalParameters() *GetIncidentTeamOptionalParameters { - this := GetIncidentTeamOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetIncidentTeamOptionalParameters) WithInclude(include IncidentRelatedObject) *GetIncidentTeamOptionalParameters { - r.Include = &include - return r -} - -func (a *IncidentTeamsApi) buildGetIncidentTeamRequest(ctx _context.Context, teamId string, o ...GetIncidentTeamOptionalParameters) (apiGetIncidentTeamRequest, error) { - req := apiGetIncidentTeamRequest{ - ctx: ctx, - teamId: teamId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetIncidentTeamOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - } - return req, nil -} - -// GetIncidentTeam Get details of an incident team. -// Get details of an incident team. If the `include[users]` query parameter is provided, -// the included attribute will contain the users related to these incident teams. -func (a *IncidentTeamsApi) GetIncidentTeam(ctx _context.Context, teamId string, o ...GetIncidentTeamOptionalParameters) (IncidentTeamResponse, *_nethttp.Response, error) { - req, err := a.buildGetIncidentTeamRequest(ctx, teamId, o...) - if err != nil { - var localVarReturnValue IncidentTeamResponse - return localVarReturnValue, nil, err - } - - return a.getIncidentTeamExecute(req) -} - -// getIncidentTeamExecute executes the request. -func (a *IncidentTeamsApi) getIncidentTeamExecute(r apiGetIncidentTeamRequest) (IncidentTeamResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentTeamResponse - ) - - operationId := "v2.GetIncidentTeam" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.GetIncidentTeam") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/teams/{team_id}" - localVarPath = strings.Replace(localVarPath, "{"+"team_id"+"}", _neturl.PathEscape(common.ParameterToString(r.teamId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListIncidentTeamsRequest struct { - ctx _context.Context - include *IncidentRelatedObject - pageSize *int64 - pageOffset *int64 - filter *string -} - -// ListIncidentTeamsOptionalParameters holds optional parameters for ListIncidentTeams. -type ListIncidentTeamsOptionalParameters struct { - Include *IncidentRelatedObject - PageSize *int64 - PageOffset *int64 - Filter *string -} - -// NewListIncidentTeamsOptionalParameters creates an empty struct for parameters. -func NewListIncidentTeamsOptionalParameters() *ListIncidentTeamsOptionalParameters { - this := ListIncidentTeamsOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentTeamsOptionalParameters) WithInclude(include IncidentRelatedObject) *ListIncidentTeamsOptionalParameters { - r.Include = &include - return r -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListIncidentTeamsOptionalParameters) WithPageSize(pageSize int64) *ListIncidentTeamsOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageOffset sets the corresponding parameter name and returns the struct. -func (r *ListIncidentTeamsOptionalParameters) WithPageOffset(pageOffset int64) *ListIncidentTeamsOptionalParameters { - r.PageOffset = &pageOffset - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListIncidentTeamsOptionalParameters) WithFilter(filter string) *ListIncidentTeamsOptionalParameters { - r.Filter = &filter - return r -} - -func (a *IncidentTeamsApi) buildListIncidentTeamsRequest(ctx _context.Context, o ...ListIncidentTeamsOptionalParameters) (apiListIncidentTeamsRequest, error) { - req := apiListIncidentTeamsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListIncidentTeamsOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - req.pageSize = o[0].PageSize - req.pageOffset = o[0].PageOffset - req.filter = o[0].Filter - } - return req, nil -} - -// ListIncidentTeams Get a list of all incident teams. -// Get all incident teams for the requesting user's organization. If the `include[users]` query parameter is provided, the included attribute will contain the users related to these incident teams. -func (a *IncidentTeamsApi) ListIncidentTeams(ctx _context.Context, o ...ListIncidentTeamsOptionalParameters) (IncidentTeamsResponse, *_nethttp.Response, error) { - req, err := a.buildListIncidentTeamsRequest(ctx, o...) - if err != nil { - var localVarReturnValue IncidentTeamsResponse - return localVarReturnValue, nil, err - } - - return a.listIncidentTeamsExecute(req) -} - -// listIncidentTeamsExecute executes the request. -func (a *IncidentTeamsApi) listIncidentTeamsExecute(r apiListIncidentTeamsRequest) (IncidentTeamsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentTeamsResponse - ) - - operationId := "v2.ListIncidentTeams" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.ListIncidentTeams") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/teams" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) - } - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageOffset != nil { - localVarQueryParams.Add("page[offset]", common.ParameterToString(*r.pageOffset, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateIncidentTeamRequest struct { - ctx _context.Context - teamId string - body *IncidentTeamUpdateRequest -} - -func (a *IncidentTeamsApi) buildUpdateIncidentTeamRequest(ctx _context.Context, teamId string, body IncidentTeamUpdateRequest) (apiUpdateIncidentTeamRequest, error) { - req := apiUpdateIncidentTeamRequest{ - ctx: ctx, - teamId: teamId, - body: &body, - } - return req, nil -} - -// UpdateIncidentTeam Update an existing incident team. -// Updates an existing incident team. Only provide the attributes which should be updated as this request is a partial update. -func (a *IncidentTeamsApi) UpdateIncidentTeam(ctx _context.Context, teamId string, body IncidentTeamUpdateRequest) (IncidentTeamResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateIncidentTeamRequest(ctx, teamId, body) - if err != nil { - var localVarReturnValue IncidentTeamResponse - return localVarReturnValue, nil, err - } - - return a.updateIncidentTeamExecute(req) -} - -// updateIncidentTeamExecute executes the request. -func (a *IncidentTeamsApi) updateIncidentTeamExecute(r apiUpdateIncidentTeamRequest) (IncidentTeamResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue IncidentTeamResponse - ) - - operationId := "v2.UpdateIncidentTeam" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.UpdateIncidentTeam") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/teams/{team_id}" - localVarPath = strings.Replace(localVarPath, "{"+"team_id"+"}", _neturl.PathEscape(common.ParameterToString(r.teamId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewIncidentTeamsApi Returns NewIncidentTeamsApi. -func NewIncidentTeamsApi(client *common.APIClient) *IncidentTeamsApi { - return &IncidentTeamsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_incidents.go b/api/v2/datadog/api_incidents.go deleted file mode 100644 index bda99379898..00000000000 --- a/api/v2/datadog/api_incidents.go +++ /dev/null @@ -1,1001 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _fmt "fmt" - _ioutil "io/ioutil" - _log "log" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// IncidentsApi service type -type IncidentsApi common.Service - -type apiCreateIncidentRequest struct { - ctx _context.Context - body *IncidentCreateRequest -} - -func (a *IncidentsApi) buildCreateIncidentRequest(ctx _context.Context, body IncidentCreateRequest) (apiCreateIncidentRequest, error) { - req := apiCreateIncidentRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateIncident Create an incident. -// Create an incident. -func (a *IncidentsApi) CreateIncident(ctx _context.Context, body IncidentCreateRequest) (IncidentResponse, *_nethttp.Response, error) { - req, err := a.buildCreateIncidentRequest(ctx, body) - if err != nil { - var localVarReturnValue IncidentResponse - return localVarReturnValue, nil, err - } - - return a.createIncidentExecute(req) -} - -// createIncidentExecute executes the request. -func (a *IncidentsApi) createIncidentExecute(r apiCreateIncidentRequest) (IncidentResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IncidentResponse - ) - - operationId := "v2.CreateIncident" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.CreateIncident") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/incidents" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteIncidentRequest struct { - ctx _context.Context - incidentId string -} - -func (a *IncidentsApi) buildDeleteIncidentRequest(ctx _context.Context, incidentId string) (apiDeleteIncidentRequest, error) { - req := apiDeleteIncidentRequest{ - ctx: ctx, - incidentId: incidentId, - } - return req, nil -} - -// DeleteIncident Delete an existing incident. -// Deletes an existing incident from the users organization. -func (a *IncidentsApi) DeleteIncident(ctx _context.Context, incidentId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteIncidentRequest(ctx, incidentId) - if err != nil { - return nil, err - } - - return a.deleteIncidentExecute(req) -} - -// deleteIncidentExecute executes the request. -func (a *IncidentsApi) deleteIncidentExecute(r apiDeleteIncidentRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - operationId := "v2.DeleteIncident" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.DeleteIncident") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" - localVarPath = strings.Replace(localVarPath, "{"+"incident_id"+"}", _neturl.PathEscape(common.ParameterToString(r.incidentId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetIncidentRequest struct { - ctx _context.Context - incidentId string - include *[]IncidentRelatedObject -} - -// GetIncidentOptionalParameters holds optional parameters for GetIncident. -type GetIncidentOptionalParameters struct { - Include *[]IncidentRelatedObject -} - -// NewGetIncidentOptionalParameters creates an empty struct for parameters. -func NewGetIncidentOptionalParameters() *GetIncidentOptionalParameters { - this := GetIncidentOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetIncidentOptionalParameters) WithInclude(include []IncidentRelatedObject) *GetIncidentOptionalParameters { - r.Include = &include - return r -} - -func (a *IncidentsApi) buildGetIncidentRequest(ctx _context.Context, incidentId string, o ...GetIncidentOptionalParameters) (apiGetIncidentRequest, error) { - req := apiGetIncidentRequest{ - ctx: ctx, - incidentId: incidentId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetIncidentOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - } - return req, nil -} - -// GetIncident Get the details of an incident. -// Get the details of an incident by `incident_id`. -func (a *IncidentsApi) GetIncident(ctx _context.Context, incidentId string, o ...GetIncidentOptionalParameters) (IncidentResponse, *_nethttp.Response, error) { - req, err := a.buildGetIncidentRequest(ctx, incidentId, o...) - if err != nil { - var localVarReturnValue IncidentResponse - return localVarReturnValue, nil, err - } - - return a.getIncidentExecute(req) -} - -// getIncidentExecute executes the request. -func (a *IncidentsApi) getIncidentExecute(r apiGetIncidentRequest) (IncidentResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentResponse - ) - - operationId := "v2.GetIncident" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.GetIncident") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" - localVarPath = strings.Replace(localVarPath, "{"+"incident_id"+"}", _neturl.PathEscape(common.ParameterToString(r.incidentId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "csv")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListIncidentsRequest struct { - ctx _context.Context - include *[]IncidentRelatedObject - pageSize *int64 - pageOffset *int64 -} - -// ListIncidentsOptionalParameters holds optional parameters for ListIncidents. -type ListIncidentsOptionalParameters struct { - Include *[]IncidentRelatedObject - PageSize *int64 - PageOffset *int64 -} - -// NewListIncidentsOptionalParameters creates an empty struct for parameters. -func NewListIncidentsOptionalParameters() *ListIncidentsOptionalParameters { - this := ListIncidentsOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentsOptionalParameters) WithInclude(include []IncidentRelatedObject) *ListIncidentsOptionalParameters { - r.Include = &include - return r -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListIncidentsOptionalParameters) WithPageSize(pageSize int64) *ListIncidentsOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageOffset sets the corresponding parameter name and returns the struct. -func (r *ListIncidentsOptionalParameters) WithPageOffset(pageOffset int64) *ListIncidentsOptionalParameters { - r.PageOffset = &pageOffset - return r -} - -func (a *IncidentsApi) buildListIncidentsRequest(ctx _context.Context, o ...ListIncidentsOptionalParameters) (apiListIncidentsRequest, error) { - req := apiListIncidentsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListIncidentsOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - req.pageSize = o[0].PageSize - req.pageOffset = o[0].PageOffset - } - return req, nil -} - -// ListIncidents Get a list of incidents. -// Get all incidents for the user's organization. -func (a *IncidentsApi) ListIncidents(ctx _context.Context, o ...ListIncidentsOptionalParameters) (IncidentsResponse, *_nethttp.Response, error) { - req, err := a.buildListIncidentsRequest(ctx, o...) - if err != nil { - var localVarReturnValue IncidentsResponse - return localVarReturnValue, nil, err - } - - return a.listIncidentsExecute(req) -} - -// ListIncidentsWithPagination provides a paginated version of ListIncidents returning a channel with all items. -func (a *IncidentsApi) ListIncidentsWithPagination(ctx _context.Context, o ...ListIncidentsOptionalParameters) (<-chan IncidentResponseData, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int64(10) - if len(o) == 0 { - o = append(o, ListIncidentsOptionalParameters{}) - } - if o[0].PageSize != nil { - pageSize_ = *o[0].PageSize - } - o[0].PageSize = &pageSize_ - - items := make(chan IncidentResponseData, pageSize_) - go func() { - for { - req, err := a.buildListIncidentsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listIncidentsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - if o[0].PageOffset == nil { - o[0].PageOffset = &pageSize_ - } else { - pageOffset_ := *o[0].PageOffset + pageSize_ - o[0].PageOffset = &pageOffset_ - } - } - close(items) - }() - return items, cancel, nil -} - -// listIncidentsExecute executes the request. -func (a *IncidentsApi) listIncidentsExecute(r apiListIncidentsRequest) (IncidentsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentsResponse - ) - - operationId := "v2.ListIncidents" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.ListIncidents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/incidents" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "csv")) - } - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageOffset != nil { - localVarQueryParams.Add("page[offset]", common.ParameterToString(*r.pageOffset, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateIncidentRequest struct { - ctx _context.Context - incidentId string - body *IncidentUpdateRequest - include *[]IncidentRelatedObject -} - -// UpdateIncidentOptionalParameters holds optional parameters for UpdateIncident. -type UpdateIncidentOptionalParameters struct { - Include *[]IncidentRelatedObject -} - -// NewUpdateIncidentOptionalParameters creates an empty struct for parameters. -func NewUpdateIncidentOptionalParameters() *UpdateIncidentOptionalParameters { - this := UpdateIncidentOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *UpdateIncidentOptionalParameters) WithInclude(include []IncidentRelatedObject) *UpdateIncidentOptionalParameters { - r.Include = &include - return r -} - -func (a *IncidentsApi) buildUpdateIncidentRequest(ctx _context.Context, incidentId string, body IncidentUpdateRequest, o ...UpdateIncidentOptionalParameters) (apiUpdateIncidentRequest, error) { - req := apiUpdateIncidentRequest{ - ctx: ctx, - incidentId: incidentId, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type UpdateIncidentOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - } - return req, nil -} - -// UpdateIncident Update an existing incident. -// Updates an incident. Provide only the attributes that should be updated as this request is a partial update. -func (a *IncidentsApi) UpdateIncident(ctx _context.Context, incidentId string, body IncidentUpdateRequest, o ...UpdateIncidentOptionalParameters) (IncidentResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateIncidentRequest(ctx, incidentId, body, o...) - if err != nil { - var localVarReturnValue IncidentResponse - return localVarReturnValue, nil, err - } - - return a.updateIncidentExecute(req) -} - -// updateIncidentExecute executes the request. -func (a *IncidentsApi) updateIncidentExecute(r apiUpdateIncidentRequest) (IncidentResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue IncidentResponse - ) - - operationId := "v2.UpdateIncident" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.UpdateIncident") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" - localVarPath = strings.Replace(localVarPath, "{"+"incident_id"+"}", _neturl.PathEscape(common.ParameterToString(r.incidentId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "csv")) - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewIncidentsApi Returns NewIncidentsApi. -func NewIncidentsApi(client *common.APIClient) *IncidentsApi { - return &IncidentsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_key_management.go b/api/v2/datadog/api_key_management.go deleted file mode 100644 index ea1ca5fce55..00000000000 --- a/api/v2/datadog/api_key_management.go +++ /dev/null @@ -1,2351 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// KeyManagementApi service type -type KeyManagementApi common.Service - -type apiCreateAPIKeyRequest struct { - ctx _context.Context - body *APIKeyCreateRequest -} - -func (a *KeyManagementApi) buildCreateAPIKeyRequest(ctx _context.Context, body APIKeyCreateRequest) (apiCreateAPIKeyRequest, error) { - req := apiCreateAPIKeyRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateAPIKey Create an API key. -// Create an API key. -func (a *KeyManagementApi) CreateAPIKey(ctx _context.Context, body APIKeyCreateRequest) (APIKeyResponse, *_nethttp.Response, error) { - req, err := a.buildCreateAPIKeyRequest(ctx, body) - if err != nil { - var localVarReturnValue APIKeyResponse - return localVarReturnValue, nil, err - } - - return a.createAPIKeyExecute(req) -} - -// createAPIKeyExecute executes the request. -func (a *KeyManagementApi) createAPIKeyExecute(r apiCreateAPIKeyRequest) (APIKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue APIKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.CreateAPIKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/api_keys" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateCurrentUserApplicationKeyRequest struct { - ctx _context.Context - body *ApplicationKeyCreateRequest -} - -func (a *KeyManagementApi) buildCreateCurrentUserApplicationKeyRequest(ctx _context.Context, body ApplicationKeyCreateRequest) (apiCreateCurrentUserApplicationKeyRequest, error) { - req := apiCreateCurrentUserApplicationKeyRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateCurrentUserApplicationKey Create an application key for current user. -// Create an application key for current user -func (a *KeyManagementApi) CreateCurrentUserApplicationKey(ctx _context.Context, body ApplicationKeyCreateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildCreateCurrentUserApplicationKeyRequest(ctx, body) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.createCurrentUserApplicationKeyExecute(req) -} - -// createCurrentUserApplicationKeyExecute executes the request. -func (a *KeyManagementApi) createCurrentUserApplicationKeyExecute(r apiCreateCurrentUserApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.CreateCurrentUserApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/current_user/application_keys" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteAPIKeyRequest struct { - ctx _context.Context - apiKeyId string -} - -func (a *KeyManagementApi) buildDeleteAPIKeyRequest(ctx _context.Context, apiKeyId string) (apiDeleteAPIKeyRequest, error) { - req := apiDeleteAPIKeyRequest{ - ctx: ctx, - apiKeyId: apiKeyId, - } - return req, nil -} - -// DeleteAPIKey Delete an API key. -// Delete an API key. -func (a *KeyManagementApi) DeleteAPIKey(ctx _context.Context, apiKeyId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteAPIKeyRequest(ctx, apiKeyId) - if err != nil { - return nil, err - } - - return a.deleteAPIKeyExecute(req) -} - -// deleteAPIKeyExecute executes the request. -func (a *KeyManagementApi) deleteAPIKeyExecute(r apiDeleteAPIKeyRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.DeleteAPIKey") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/api_keys/{api_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"api_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.apiKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiDeleteApplicationKeyRequest struct { - ctx _context.Context - appKeyId string -} - -func (a *KeyManagementApi) buildDeleteApplicationKeyRequest(ctx _context.Context, appKeyId string) (apiDeleteApplicationKeyRequest, error) { - req := apiDeleteApplicationKeyRequest{ - ctx: ctx, - appKeyId: appKeyId, - } - return req, nil -} - -// DeleteApplicationKey Delete an application key. -// Delete an application key -func (a *KeyManagementApi) DeleteApplicationKey(ctx _context.Context, appKeyId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteApplicationKeyRequest(ctx, appKeyId) - if err != nil { - return nil, err - } - - return a.deleteApplicationKeyExecute(req) -} - -// deleteApplicationKeyExecute executes the request. -func (a *KeyManagementApi) deleteApplicationKeyExecute(r apiDeleteApplicationKeyRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.DeleteApplicationKey") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiDeleteCurrentUserApplicationKeyRequest struct { - ctx _context.Context - appKeyId string -} - -func (a *KeyManagementApi) buildDeleteCurrentUserApplicationKeyRequest(ctx _context.Context, appKeyId string) (apiDeleteCurrentUserApplicationKeyRequest, error) { - req := apiDeleteCurrentUserApplicationKeyRequest{ - ctx: ctx, - appKeyId: appKeyId, - } - return req, nil -} - -// DeleteCurrentUserApplicationKey Delete an application key owned by current user. -// Delete an application key owned by current user -func (a *KeyManagementApi) DeleteCurrentUserApplicationKey(ctx _context.Context, appKeyId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteCurrentUserApplicationKeyRequest(ctx, appKeyId) - if err != nil { - return nil, err - } - - return a.deleteCurrentUserApplicationKeyExecute(req) -} - -// deleteCurrentUserApplicationKeyExecute executes the request. -func (a *KeyManagementApi) deleteCurrentUserApplicationKeyExecute(r apiDeleteCurrentUserApplicationKeyRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.DeleteCurrentUserApplicationKey") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/current_user/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetAPIKeyRequest struct { - ctx _context.Context - apiKeyId string - include *string -} - -// GetAPIKeyOptionalParameters holds optional parameters for GetAPIKey. -type GetAPIKeyOptionalParameters struct { - Include *string -} - -// NewGetAPIKeyOptionalParameters creates an empty struct for parameters. -func NewGetAPIKeyOptionalParameters() *GetAPIKeyOptionalParameters { - this := GetAPIKeyOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetAPIKeyOptionalParameters) WithInclude(include string) *GetAPIKeyOptionalParameters { - r.Include = &include - return r -} - -func (a *KeyManagementApi) buildGetAPIKeyRequest(ctx _context.Context, apiKeyId string, o ...GetAPIKeyOptionalParameters) (apiGetAPIKeyRequest, error) { - req := apiGetAPIKeyRequest{ - ctx: ctx, - apiKeyId: apiKeyId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetAPIKeyOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - } - return req, nil -} - -// GetAPIKey Get API key. -// Get an API key. -func (a *KeyManagementApi) GetAPIKey(ctx _context.Context, apiKeyId string, o ...GetAPIKeyOptionalParameters) (APIKeyResponse, *_nethttp.Response, error) { - req, err := a.buildGetAPIKeyRequest(ctx, apiKeyId, o...) - if err != nil { - var localVarReturnValue APIKeyResponse - return localVarReturnValue, nil, err - } - - return a.getAPIKeyExecute(req) -} - -// getAPIKeyExecute executes the request. -func (a *KeyManagementApi) getAPIKeyExecute(r apiGetAPIKeyRequest) (APIKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue APIKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.GetAPIKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/api_keys/{api_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"api_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.apiKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetApplicationKeyRequest struct { - ctx _context.Context - appKeyId string - include *string -} - -// GetApplicationKeyOptionalParameters holds optional parameters for GetApplicationKey. -type GetApplicationKeyOptionalParameters struct { - Include *string -} - -// NewGetApplicationKeyOptionalParameters creates an empty struct for parameters. -func NewGetApplicationKeyOptionalParameters() *GetApplicationKeyOptionalParameters { - this := GetApplicationKeyOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetApplicationKeyOptionalParameters) WithInclude(include string) *GetApplicationKeyOptionalParameters { - r.Include = &include - return r -} - -func (a *KeyManagementApi) buildGetApplicationKeyRequest(ctx _context.Context, appKeyId string, o ...GetApplicationKeyOptionalParameters) (apiGetApplicationKeyRequest, error) { - req := apiGetApplicationKeyRequest{ - ctx: ctx, - appKeyId: appKeyId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetApplicationKeyOptionalParameters is allowed") - } - - if o != nil { - req.include = o[0].Include - } - return req, nil -} - -// GetApplicationKey Get an application key. -// Get an application key for your org. -func (a *KeyManagementApi) GetApplicationKey(ctx _context.Context, appKeyId string, o ...GetApplicationKeyOptionalParameters) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildGetApplicationKeyRequest(ctx, appKeyId, o...) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.getApplicationKeyExecute(req) -} - -// getApplicationKeyExecute executes the request. -func (a *KeyManagementApi) getApplicationKeyExecute(r apiGetApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.GetApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetCurrentUserApplicationKeyRequest struct { - ctx _context.Context - appKeyId string -} - -func (a *KeyManagementApi) buildGetCurrentUserApplicationKeyRequest(ctx _context.Context, appKeyId string) (apiGetCurrentUserApplicationKeyRequest, error) { - req := apiGetCurrentUserApplicationKeyRequest{ - ctx: ctx, - appKeyId: appKeyId, - } - return req, nil -} - -// GetCurrentUserApplicationKey Get one application key owned by current user. -// Get an application key owned by current user -func (a *KeyManagementApi) GetCurrentUserApplicationKey(ctx _context.Context, appKeyId string) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildGetCurrentUserApplicationKeyRequest(ctx, appKeyId) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.getCurrentUserApplicationKeyExecute(req) -} - -// getCurrentUserApplicationKeyExecute executes the request. -func (a *KeyManagementApi) getCurrentUserApplicationKeyExecute(r apiGetCurrentUserApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.GetCurrentUserApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/current_user/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListAPIKeysRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sort *APIKeysSort - filter *string - filterCreatedAtStart *string - filterCreatedAtEnd *string - filterModifiedAtStart *string - filterModifiedAtEnd *string - include *string -} - -// ListAPIKeysOptionalParameters holds optional parameters for ListAPIKeys. -type ListAPIKeysOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *APIKeysSort - Filter *string - FilterCreatedAtStart *string - FilterCreatedAtEnd *string - FilterModifiedAtStart *string - FilterModifiedAtEnd *string - Include *string -} - -// NewListAPIKeysOptionalParameters creates an empty struct for parameters. -func NewListAPIKeysOptionalParameters() *ListAPIKeysOptionalParameters { - this := ListAPIKeysOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithPageSize(pageSize int64) *ListAPIKeysOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListAPIKeysOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithSort(sort APIKeysSort) *ListAPIKeysOptionalParameters { - r.Sort = &sort - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithFilter(filter string) *ListAPIKeysOptionalParameters { - r.Filter = &filter - return r -} - -// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListAPIKeysOptionalParameters { - r.FilterCreatedAtStart = &filterCreatedAtStart - return r -} - -// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListAPIKeysOptionalParameters { - r.FilterCreatedAtEnd = &filterCreatedAtEnd - return r -} - -// WithFilterModifiedAtStart sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithFilterModifiedAtStart(filterModifiedAtStart string) *ListAPIKeysOptionalParameters { - r.FilterModifiedAtStart = &filterModifiedAtStart - return r -} - -// WithFilterModifiedAtEnd sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithFilterModifiedAtEnd(filterModifiedAtEnd string) *ListAPIKeysOptionalParameters { - r.FilterModifiedAtEnd = &filterModifiedAtEnd - return r -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListAPIKeysOptionalParameters) WithInclude(include string) *ListAPIKeysOptionalParameters { - r.Include = &include - return r -} - -func (a *KeyManagementApi) buildListAPIKeysRequest(ctx _context.Context, o ...ListAPIKeysOptionalParameters) (apiListAPIKeysRequest, error) { - req := apiListAPIKeysRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListAPIKeysOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.filter = o[0].Filter - req.filterCreatedAtStart = o[0].FilterCreatedAtStart - req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd - req.filterModifiedAtStart = o[0].FilterModifiedAtStart - req.filterModifiedAtEnd = o[0].FilterModifiedAtEnd - req.include = o[0].Include - } - return req, nil -} - -// ListAPIKeys Get all API keys. -// List all API keys available for your account. -func (a *KeyManagementApi) ListAPIKeys(ctx _context.Context, o ...ListAPIKeysOptionalParameters) (APIKeysResponse, *_nethttp.Response, error) { - req, err := a.buildListAPIKeysRequest(ctx, o...) - if err != nil { - var localVarReturnValue APIKeysResponse - return localVarReturnValue, nil, err - } - - return a.listAPIKeysExecute(req) -} - -// listAPIKeysExecute executes the request. -func (a *KeyManagementApi) listAPIKeysExecute(r apiListAPIKeysRequest) (APIKeysResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue APIKeysResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.ListAPIKeys") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/api_keys" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - if r.filterCreatedAtStart != nil { - localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) - } - if r.filterCreatedAtEnd != nil { - localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) - } - if r.filterModifiedAtStart != nil { - localVarQueryParams.Add("filter[modified_at][start]", common.ParameterToString(*r.filterModifiedAtStart, "")) - } - if r.filterModifiedAtEnd != nil { - localVarQueryParams.Add("filter[modified_at][end]", common.ParameterToString(*r.filterModifiedAtEnd, "")) - } - if r.include != nil { - localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListApplicationKeysRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sort *ApplicationKeysSort - filter *string - filterCreatedAtStart *string - filterCreatedAtEnd *string -} - -// ListApplicationKeysOptionalParameters holds optional parameters for ListApplicationKeys. -type ListApplicationKeysOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *ApplicationKeysSort - Filter *string - FilterCreatedAtStart *string - FilterCreatedAtEnd *string -} - -// NewListApplicationKeysOptionalParameters creates an empty struct for parameters. -func NewListApplicationKeysOptionalParameters() *ListApplicationKeysOptionalParameters { - this := ListApplicationKeysOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListApplicationKeysOptionalParameters) WithPageSize(pageSize int64) *ListApplicationKeysOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListApplicationKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListApplicationKeysOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListApplicationKeysOptionalParameters) WithSort(sort ApplicationKeysSort) *ListApplicationKeysOptionalParameters { - r.Sort = &sort - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListApplicationKeysOptionalParameters) WithFilter(filter string) *ListApplicationKeysOptionalParameters { - r.Filter = &filter - return r -} - -// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. -func (r *ListApplicationKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListApplicationKeysOptionalParameters { - r.FilterCreatedAtStart = &filterCreatedAtStart - return r -} - -// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. -func (r *ListApplicationKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListApplicationKeysOptionalParameters { - r.FilterCreatedAtEnd = &filterCreatedAtEnd - return r -} - -func (a *KeyManagementApi) buildListApplicationKeysRequest(ctx _context.Context, o ...ListApplicationKeysOptionalParameters) (apiListApplicationKeysRequest, error) { - req := apiListApplicationKeysRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListApplicationKeysOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.filter = o[0].Filter - req.filterCreatedAtStart = o[0].FilterCreatedAtStart - req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd - } - return req, nil -} - -// ListApplicationKeys Get all application keys. -// List all application keys available for your org -func (a *KeyManagementApi) ListApplicationKeys(ctx _context.Context, o ...ListApplicationKeysOptionalParameters) (ListApplicationKeysResponse, *_nethttp.Response, error) { - req, err := a.buildListApplicationKeysRequest(ctx, o...) - if err != nil { - var localVarReturnValue ListApplicationKeysResponse - return localVarReturnValue, nil, err - } - - return a.listApplicationKeysExecute(req) -} - -// listApplicationKeysExecute executes the request. -func (a *KeyManagementApi) listApplicationKeysExecute(r apiListApplicationKeysRequest) (ListApplicationKeysResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ListApplicationKeysResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.ListApplicationKeys") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/application_keys" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - if r.filterCreatedAtStart != nil { - localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) - } - if r.filterCreatedAtEnd != nil { - localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListCurrentUserApplicationKeysRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sort *ApplicationKeysSort - filter *string - filterCreatedAtStart *string - filterCreatedAtEnd *string -} - -// ListCurrentUserApplicationKeysOptionalParameters holds optional parameters for ListCurrentUserApplicationKeys. -type ListCurrentUserApplicationKeysOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *ApplicationKeysSort - Filter *string - FilterCreatedAtStart *string - FilterCreatedAtEnd *string -} - -// NewListCurrentUserApplicationKeysOptionalParameters creates an empty struct for parameters. -func NewListCurrentUserApplicationKeysOptionalParameters() *ListCurrentUserApplicationKeysOptionalParameters { - this := ListCurrentUserApplicationKeysOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListCurrentUserApplicationKeysOptionalParameters) WithPageSize(pageSize int64) *ListCurrentUserApplicationKeysOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListCurrentUserApplicationKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListCurrentUserApplicationKeysOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListCurrentUserApplicationKeysOptionalParameters) WithSort(sort ApplicationKeysSort) *ListCurrentUserApplicationKeysOptionalParameters { - r.Sort = &sort - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListCurrentUserApplicationKeysOptionalParameters) WithFilter(filter string) *ListCurrentUserApplicationKeysOptionalParameters { - r.Filter = &filter - return r -} - -// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. -func (r *ListCurrentUserApplicationKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListCurrentUserApplicationKeysOptionalParameters { - r.FilterCreatedAtStart = &filterCreatedAtStart - return r -} - -// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. -func (r *ListCurrentUserApplicationKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListCurrentUserApplicationKeysOptionalParameters { - r.FilterCreatedAtEnd = &filterCreatedAtEnd - return r -} - -func (a *KeyManagementApi) buildListCurrentUserApplicationKeysRequest(ctx _context.Context, o ...ListCurrentUserApplicationKeysOptionalParameters) (apiListCurrentUserApplicationKeysRequest, error) { - req := apiListCurrentUserApplicationKeysRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListCurrentUserApplicationKeysOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.filter = o[0].Filter - req.filterCreatedAtStart = o[0].FilterCreatedAtStart - req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd - } - return req, nil -} - -// ListCurrentUserApplicationKeys Get all application keys owned by current user. -// List all application keys available for current user -func (a *KeyManagementApi) ListCurrentUserApplicationKeys(ctx _context.Context, o ...ListCurrentUserApplicationKeysOptionalParameters) (ListApplicationKeysResponse, *_nethttp.Response, error) { - req, err := a.buildListCurrentUserApplicationKeysRequest(ctx, o...) - if err != nil { - var localVarReturnValue ListApplicationKeysResponse - return localVarReturnValue, nil, err - } - - return a.listCurrentUserApplicationKeysExecute(req) -} - -// listCurrentUserApplicationKeysExecute executes the request. -func (a *KeyManagementApi) listCurrentUserApplicationKeysExecute(r apiListCurrentUserApplicationKeysRequest) (ListApplicationKeysResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ListApplicationKeysResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.ListCurrentUserApplicationKeys") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/current_user/application_keys" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - if r.filterCreatedAtStart != nil { - localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) - } - if r.filterCreatedAtEnd != nil { - localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateAPIKeyRequest struct { - ctx _context.Context - apiKeyId string - body *APIKeyUpdateRequest -} - -func (a *KeyManagementApi) buildUpdateAPIKeyRequest(ctx _context.Context, apiKeyId string, body APIKeyUpdateRequest) (apiUpdateAPIKeyRequest, error) { - req := apiUpdateAPIKeyRequest{ - ctx: ctx, - apiKeyId: apiKeyId, - body: &body, - } - return req, nil -} - -// UpdateAPIKey Edit an API key. -// Update an API key. -func (a *KeyManagementApi) UpdateAPIKey(ctx _context.Context, apiKeyId string, body APIKeyUpdateRequest) (APIKeyResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateAPIKeyRequest(ctx, apiKeyId, body) - if err != nil { - var localVarReturnValue APIKeyResponse - return localVarReturnValue, nil, err - } - - return a.updateAPIKeyExecute(req) -} - -// updateAPIKeyExecute executes the request. -func (a *KeyManagementApi) updateAPIKeyExecute(r apiUpdateAPIKeyRequest) (APIKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue APIKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.UpdateAPIKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/api_keys/{api_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"api_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.apiKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateApplicationKeyRequest struct { - ctx _context.Context - appKeyId string - body *ApplicationKeyUpdateRequest -} - -func (a *KeyManagementApi) buildUpdateApplicationKeyRequest(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (apiUpdateApplicationKeyRequest, error) { - req := apiUpdateApplicationKeyRequest{ - ctx: ctx, - appKeyId: appKeyId, - body: &body, - } - return req, nil -} - -// UpdateApplicationKey Edit an application key. -// Edit an application key -func (a *KeyManagementApi) UpdateApplicationKey(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateApplicationKeyRequest(ctx, appKeyId, body) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.updateApplicationKeyExecute(req) -} - -// updateApplicationKeyExecute executes the request. -func (a *KeyManagementApi) updateApplicationKeyExecute(r apiUpdateApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.UpdateApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateCurrentUserApplicationKeyRequest struct { - ctx _context.Context - appKeyId string - body *ApplicationKeyUpdateRequest -} - -func (a *KeyManagementApi) buildUpdateCurrentUserApplicationKeyRequest(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (apiUpdateCurrentUserApplicationKeyRequest, error) { - req := apiUpdateCurrentUserApplicationKeyRequest{ - ctx: ctx, - appKeyId: appKeyId, - body: &body, - } - return req, nil -} - -// UpdateCurrentUserApplicationKey Edit an application key owned by current user. -// Edit an application key owned by current user -func (a *KeyManagementApi) UpdateCurrentUserApplicationKey(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateCurrentUserApplicationKeyRequest(ctx, appKeyId, body) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.updateCurrentUserApplicationKeyExecute(req) -} - -// updateCurrentUserApplicationKeyExecute executes the request. -func (a *KeyManagementApi) updateCurrentUserApplicationKeyExecute(r apiUpdateCurrentUserApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.UpdateCurrentUserApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/current_user/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewKeyManagementApi Returns NewKeyManagementApi. -func NewKeyManagementApi(client *common.APIClient) *KeyManagementApi { - return &KeyManagementApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_logs.go b/api/v2/datadog/api_logs.go deleted file mode 100644 index 879098673e9..00000000000 --- a/api/v2/datadog/api_logs.go +++ /dev/null @@ -1,951 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsApi service type -type LogsApi common.Service - -type apiAggregateLogsRequest struct { - ctx _context.Context - body *LogsAggregateRequest -} - -func (a *LogsApi) buildAggregateLogsRequest(ctx _context.Context, body LogsAggregateRequest) (apiAggregateLogsRequest, error) { - req := apiAggregateLogsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// AggregateLogs Aggregate events. -// The API endpoint to aggregate events into buckets and compute metrics and timeseries. -func (a *LogsApi) AggregateLogs(ctx _context.Context, body LogsAggregateRequest) (LogsAggregateResponse, *_nethttp.Response, error) { - req, err := a.buildAggregateLogsRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsAggregateResponse - return localVarReturnValue, nil, err - } - - return a.aggregateLogsExecute(req) -} - -// aggregateLogsExecute executes the request. -func (a *LogsApi) aggregateLogsExecute(r apiAggregateLogsRequest) (LogsAggregateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue LogsAggregateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.AggregateLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/analytics/aggregate" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListLogsRequest struct { - ctx _context.Context - body *LogsListRequest -} - -// ListLogsOptionalParameters holds optional parameters for ListLogs. -type ListLogsOptionalParameters struct { - Body *LogsListRequest -} - -// NewListLogsOptionalParameters creates an empty struct for parameters. -func NewListLogsOptionalParameters() *ListLogsOptionalParameters { - this := ListLogsOptionalParameters{} - return &this -} - -// WithBody sets the corresponding parameter name and returns the struct. -func (r *ListLogsOptionalParameters) WithBody(body LogsListRequest) *ListLogsOptionalParameters { - r.Body = &body - return r -} - -func (a *LogsApi) buildListLogsRequest(ctx _context.Context, o ...ListLogsOptionalParameters) (apiListLogsRequest, error) { - req := apiListLogsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListLogsOptionalParameters is allowed") - } - - if o != nil { - req.body = o[0].Body - } - return req, nil -} - -// ListLogs Search logs. -// List endpoint returns logs that match a log search query. -// [Results are paginated][1]. -// -// Use this endpoint to build complex logs filtering and search. -// -// **If you are considering archiving logs for your organization, -// consider use of the Datadog archive capabilities instead of the log list API. -// See [Datadog Logs Archive documentation][2].** -// -// [1]: /logs/guide/collect-multiple-logs-with-pagination -// [2]: https://docs.datadoghq.com/logs/archives -func (a *LogsApi) ListLogs(ctx _context.Context, o ...ListLogsOptionalParameters) (LogsListResponse, *_nethttp.Response, error) { - req, err := a.buildListLogsRequest(ctx, o...) - if err != nil { - var localVarReturnValue LogsListResponse - return localVarReturnValue, nil, err - } - - return a.listLogsExecute(req) -} - -// ListLogsWithPagination provides a paginated version of ListLogs returning a channel with all items. -func (a *LogsApi) ListLogsWithPagination(ctx _context.Context, o ...ListLogsOptionalParameters) (<-chan Log, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, ListLogsOptionalParameters{}) - } - if o[0].Body == nil { - o[0].Body = NewLogsListRequest() - } - if o[0].Body.Page == nil { - o[0].Body.Page = NewLogsListRequestPage() - } - if o[0].Body.Page.Limit != nil { - pageSize_ = *o[0].Body.Page.Limit - } - o[0].Body.Page.Limit = &pageSize_ - - items := make(chan Log, pageSize_) - go func() { - for { - req, err := a.buildListLogsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listLogsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].Body.Page.Cursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// listLogsExecute executes the request. -func (a *LogsApi) listLogsExecute(r apiListLogsRequest) (LogsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue LogsListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.ListLogs") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/events/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListLogsGetRequest struct { - ctx _context.Context - filterQuery *string - filterIndex *string - filterFrom *time.Time - filterTo *time.Time - sort *LogsSort - pageCursor *string - pageLimit *int32 -} - -// ListLogsGetOptionalParameters holds optional parameters for ListLogsGet. -type ListLogsGetOptionalParameters struct { - FilterQuery *string - FilterIndex *string - FilterFrom *time.Time - FilterTo *time.Time - Sort *LogsSort - PageCursor *string - PageLimit *int32 -} - -// NewListLogsGetOptionalParameters creates an empty struct for parameters. -func NewListLogsGetOptionalParameters() *ListLogsGetOptionalParameters { - this := ListLogsGetOptionalParameters{} - return &this -} - -// WithFilterQuery sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithFilterQuery(filterQuery string) *ListLogsGetOptionalParameters { - r.FilterQuery = &filterQuery - return r -} - -// WithFilterIndex sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithFilterIndex(filterIndex string) *ListLogsGetOptionalParameters { - r.FilterIndex = &filterIndex - return r -} - -// WithFilterFrom sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListLogsGetOptionalParameters { - r.FilterFrom = &filterFrom - return r -} - -// WithFilterTo sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithFilterTo(filterTo time.Time) *ListLogsGetOptionalParameters { - r.FilterTo = &filterTo - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithSort(sort LogsSort) *ListLogsGetOptionalParameters { - r.Sort = &sort - return r -} - -// WithPageCursor sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithPageCursor(pageCursor string) *ListLogsGetOptionalParameters { - r.PageCursor = &pageCursor - return r -} - -// WithPageLimit sets the corresponding parameter name and returns the struct. -func (r *ListLogsGetOptionalParameters) WithPageLimit(pageLimit int32) *ListLogsGetOptionalParameters { - r.PageLimit = &pageLimit - return r -} - -func (a *LogsApi) buildListLogsGetRequest(ctx _context.Context, o ...ListLogsGetOptionalParameters) (apiListLogsGetRequest, error) { - req := apiListLogsGetRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListLogsGetOptionalParameters is allowed") - } - - if o != nil { - req.filterQuery = o[0].FilterQuery - req.filterIndex = o[0].FilterIndex - req.filterFrom = o[0].FilterFrom - req.filterTo = o[0].FilterTo - req.sort = o[0].Sort - req.pageCursor = o[0].PageCursor - req.pageLimit = o[0].PageLimit - } - return req, nil -} - -// ListLogsGet Get a list of logs. -// List endpoint returns logs that match a log search query. -// [Results are paginated][1]. -// -// Use this endpoint to see your latest logs. -// -// **If you are considering archiving logs for your organization, -// consider use of the Datadog archive capabilities instead of the log list API. -// See [Datadog Logs Archive documentation][2].** -// -// [1]: /logs/guide/collect-multiple-logs-with-pagination -// [2]: https://docs.datadoghq.com/logs/archives -func (a *LogsApi) ListLogsGet(ctx _context.Context, o ...ListLogsGetOptionalParameters) (LogsListResponse, *_nethttp.Response, error) { - req, err := a.buildListLogsGetRequest(ctx, o...) - if err != nil { - var localVarReturnValue LogsListResponse - return localVarReturnValue, nil, err - } - - return a.listLogsGetExecute(req) -} - -// ListLogsGetWithPagination provides a paginated version of ListLogsGet returning a channel with all items. -func (a *LogsApi) ListLogsGetWithPagination(ctx _context.Context, o ...ListLogsGetOptionalParameters) (<-chan Log, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, ListLogsGetOptionalParameters{}) - } - if o[0].PageLimit != nil { - pageSize_ = *o[0].PageLimit - } - o[0].PageLimit = &pageSize_ - - items := make(chan Log, pageSize_) - go func() { - for { - req, err := a.buildListLogsGetRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listLogsGetExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].PageCursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// listLogsGetExecute executes the request. -func (a *LogsApi) listLogsGetExecute(r apiListLogsGetRequest) (LogsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.ListLogsGet") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/events" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterQuery != nil { - localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) - } - if r.filterIndex != nil { - localVarQueryParams.Add("filter[index]", common.ParameterToString(*r.filterIndex, "")) - } - if r.filterFrom != nil { - localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) - } - if r.filterTo != nil { - localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.pageCursor != nil { - localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) - } - if r.pageLimit != nil { - localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSubmitLogRequest struct { - ctx _context.Context - body *[]HTTPLogItem - contentEncoding *ContentEncoding - ddtags *string -} - -// SubmitLogOptionalParameters holds optional parameters for SubmitLog. -type SubmitLogOptionalParameters struct { - ContentEncoding *ContentEncoding - Ddtags *string -} - -// NewSubmitLogOptionalParameters creates an empty struct for parameters. -func NewSubmitLogOptionalParameters() *SubmitLogOptionalParameters { - this := SubmitLogOptionalParameters{} - return &this -} - -// WithContentEncoding sets the corresponding parameter name and returns the struct. -func (r *SubmitLogOptionalParameters) WithContentEncoding(contentEncoding ContentEncoding) *SubmitLogOptionalParameters { - r.ContentEncoding = &contentEncoding - return r -} - -// WithDdtags sets the corresponding parameter name and returns the struct. -func (r *SubmitLogOptionalParameters) WithDdtags(ddtags string) *SubmitLogOptionalParameters { - r.Ddtags = &ddtags - return r -} - -func (a *LogsApi) buildSubmitLogRequest(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (apiSubmitLogRequest, error) { - req := apiSubmitLogRequest{ - ctx: ctx, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SubmitLogOptionalParameters is allowed") - } - - if o != nil { - req.contentEncoding = o[0].ContentEncoding - req.ddtags = o[0].Ddtags - } - return req, nil -} - -// SubmitLog Send logs. -// Send your logs to your Datadog platform over HTTP. Limits per HTTP request are: -// -// - Maximum content size per payload (uncompressed): 5MB -// - Maximum size for a single log: 1MB -// - Maximum array size if sending multiple logs in an array: 1000 entries -// -// Any log exceeding 1MB is accepted and truncated by Datadog: -// - For a single log request, the API truncates the log at 1MB and returns a 2xx. -// - For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx. -// -// Datadog recommends sending your logs compressed. -// Add the `Content-Encoding: gzip` header to the request when sending compressed logs. -// -// The status codes answered by the HTTP API are: -// - 202: Accepted: the request has been accepted for processing -// - 400: Bad request (likely an issue in the payload formatting) -// - 401: Unauthorized (likely a missing API Key) -// - 403: Permission issue (likely using an invalid API Key) -// - 408: Request Timeout, request should be retried after some time -// - 413: Payload too large (batch is above 5MB uncompressed) -// - 429: Too Many Requests, request should be retried after some time -// - 500: Internal Server Error, the server encountered an unexpected condition that prevented it from fulfilling the request, request should be retried after some time -// - 503: Service Unavailable, the server is not ready to handle the request probably because it is overloaded, request should be retried after some time -func (a *LogsApi) SubmitLog(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (interface{}, *_nethttp.Response, error) { - req, err := a.buildSubmitLogRequest(ctx, body, o...) - if err != nil { - var localVarReturnValue interface{} - return localVarReturnValue, nil, err - } - - return a.submitLogExecute(req) -} - -// submitLogExecute executes the request. -func (a *LogsApi) submitLogExecute(r apiSubmitLogRequest) (interface{}, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.SubmitLog") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - if r.ddtags != nil { - localVarQueryParams.Add("ddtags", common.ParameterToString(*r.ddtags, "")) - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - if r.contentEncoding != nil { - localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") - } - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v HTTPLogErrors - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - var v HTTPLogErrors - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - var v HTTPLogErrors - 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 - } - if localVarHTTPResponse.StatusCode == 408 { - var v HTTPLogErrors - 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 - } - if localVarHTTPResponse.StatusCode == 413 { - var v HTTPLogErrors - 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 - } - if localVarHTTPResponse.StatusCode == 429 { - var v HTTPLogErrors - 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 - } - if localVarHTTPResponse.StatusCode == 500 { - var v HTTPLogErrors - 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 - } - if localVarHTTPResponse.StatusCode == 503 { - var v HTTPLogErrors - 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewLogsApi Returns NewLogsApi. -func NewLogsApi(client *common.APIClient) *LogsApi { - return &LogsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_logs_archives.go b/api/v2/datadog/api_logs_archives.go deleted file mode 100644 index e909533b3f8..00000000000 --- a/api/v2/datadog/api_logs_archives.go +++ /dev/null @@ -1,1444 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsArchivesApi service type -type LogsArchivesApi common.Service - -type apiAddReadRoleToArchiveRequest struct { - ctx _context.Context - archiveId string - body *RelationshipToRole -} - -func (a *LogsArchivesApi) buildAddReadRoleToArchiveRequest(ctx _context.Context, archiveId string, body RelationshipToRole) (apiAddReadRoleToArchiveRequest, error) { - req := apiAddReadRoleToArchiveRequest{ - ctx: ctx, - archiveId: archiveId, - body: &body, - } - return req, nil -} - -// AddReadRoleToArchive Grant role to an archive. -// Adds a read role to an archive. ([Roles API](https://docs.datadoghq.com/api/v2/roles/)) -func (a *LogsArchivesApi) AddReadRoleToArchive(ctx _context.Context, archiveId string, body RelationshipToRole) (*_nethttp.Response, error) { - req, err := a.buildAddReadRoleToArchiveRequest(ctx, archiveId, body) - if err != nil { - return nil, err - } - - return a.addReadRoleToArchiveExecute(req) -} - -// addReadRoleToArchiveExecute executes the request. -func (a *LogsArchivesApi) addReadRoleToArchiveExecute(r apiAddReadRoleToArchiveRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.AddReadRoleToArchive") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}/readers" - localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "*/*" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiCreateLogsArchiveRequest struct { - ctx _context.Context - body *LogsArchiveCreateRequest -} - -func (a *LogsArchivesApi) buildCreateLogsArchiveRequest(ctx _context.Context, body LogsArchiveCreateRequest) (apiCreateLogsArchiveRequest, error) { - req := apiCreateLogsArchiveRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateLogsArchive Create an archive. -// Create an archive in your organization. -func (a *LogsArchivesApi) CreateLogsArchive(ctx _context.Context, body LogsArchiveCreateRequest) (LogsArchive, *_nethttp.Response, error) { - req, err := a.buildCreateLogsArchiveRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsArchive - return localVarReturnValue, nil, err - } - - return a.createLogsArchiveExecute(req) -} - -// createLogsArchiveExecute executes the request. -func (a *LogsArchivesApi) createLogsArchiveExecute(r apiCreateLogsArchiveRequest) (LogsArchive, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue LogsArchive - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.CreateLogsArchive") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteLogsArchiveRequest struct { - ctx _context.Context - archiveId string -} - -func (a *LogsArchivesApi) buildDeleteLogsArchiveRequest(ctx _context.Context, archiveId string) (apiDeleteLogsArchiveRequest, error) { - req := apiDeleteLogsArchiveRequest{ - ctx: ctx, - archiveId: archiveId, - } - return req, nil -} - -// DeleteLogsArchive Delete an archive. -// Delete a given archive from your organization. -func (a *LogsArchivesApi) DeleteLogsArchive(ctx _context.Context, archiveId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteLogsArchiveRequest(ctx, archiveId) - if err != nil { - return nil, err - } - - return a.deleteLogsArchiveExecute(req) -} - -// deleteLogsArchiveExecute executes the request. -func (a *LogsArchivesApi) deleteLogsArchiveExecute(r apiDeleteLogsArchiveRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.DeleteLogsArchive") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}" - localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetLogsArchiveRequest struct { - ctx _context.Context - archiveId string -} - -func (a *LogsArchivesApi) buildGetLogsArchiveRequest(ctx _context.Context, archiveId string) (apiGetLogsArchiveRequest, error) { - req := apiGetLogsArchiveRequest{ - ctx: ctx, - archiveId: archiveId, - } - return req, nil -} - -// GetLogsArchive Get an archive. -// Get a specific archive from your organization. -func (a *LogsArchivesApi) GetLogsArchive(ctx _context.Context, archiveId string) (LogsArchive, *_nethttp.Response, error) { - req, err := a.buildGetLogsArchiveRequest(ctx, archiveId) - if err != nil { - var localVarReturnValue LogsArchive - return localVarReturnValue, nil, err - } - - return a.getLogsArchiveExecute(req) -} - -// getLogsArchiveExecute executes the request. -func (a *LogsArchivesApi) getLogsArchiveExecute(r apiGetLogsArchiveRequest) (LogsArchive, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsArchive - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.GetLogsArchive") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}" - localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetLogsArchiveOrderRequest struct { - ctx _context.Context -} - -func (a *LogsArchivesApi) buildGetLogsArchiveOrderRequest(ctx _context.Context) (apiGetLogsArchiveOrderRequest, error) { - req := apiGetLogsArchiveOrderRequest{ - ctx: ctx, - } - return req, nil -} - -// GetLogsArchiveOrder Get archive order. -// Get the current order of your archives. -// This endpoint takes no JSON arguments. -func (a *LogsArchivesApi) GetLogsArchiveOrder(ctx _context.Context) (LogsArchiveOrder, *_nethttp.Response, error) { - req, err := a.buildGetLogsArchiveOrderRequest(ctx) - if err != nil { - var localVarReturnValue LogsArchiveOrder - return localVarReturnValue, nil, err - } - - return a.getLogsArchiveOrderExecute(req) -} - -// getLogsArchiveOrderExecute executes the request. -func (a *LogsArchivesApi) getLogsArchiveOrderExecute(r apiGetLogsArchiveOrderRequest) (LogsArchiveOrder, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsArchiveOrder - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.GetLogsArchiveOrder") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archive-order" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListArchiveReadRolesRequest struct { - ctx _context.Context - archiveId string -} - -func (a *LogsArchivesApi) buildListArchiveReadRolesRequest(ctx _context.Context, archiveId string) (apiListArchiveReadRolesRequest, error) { - req := apiListArchiveReadRolesRequest{ - ctx: ctx, - archiveId: archiveId, - } - return req, nil -} - -// ListArchiveReadRoles List read roles for an archive. -// Returns all read roles a given archive is restricted to. -func (a *LogsArchivesApi) ListArchiveReadRoles(ctx _context.Context, archiveId string) (RolesResponse, *_nethttp.Response, error) { - req, err := a.buildListArchiveReadRolesRequest(ctx, archiveId) - if err != nil { - var localVarReturnValue RolesResponse - return localVarReturnValue, nil, err - } - - return a.listArchiveReadRolesExecute(req) -} - -// listArchiveReadRolesExecute executes the request. -func (a *LogsArchivesApi) listArchiveReadRolesExecute(r apiListArchiveReadRolesRequest) (RolesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue RolesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.ListArchiveReadRoles") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}/readers" - localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListLogsArchivesRequest struct { - ctx _context.Context -} - -func (a *LogsArchivesApi) buildListLogsArchivesRequest(ctx _context.Context) (apiListLogsArchivesRequest, error) { - req := apiListLogsArchivesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListLogsArchives Get all archives. -// Get the list of configured logs archives with their definitions. -func (a *LogsArchivesApi) ListLogsArchives(ctx _context.Context) (LogsArchives, *_nethttp.Response, error) { - req, err := a.buildListLogsArchivesRequest(ctx) - if err != nil { - var localVarReturnValue LogsArchives - return localVarReturnValue, nil, err - } - - return a.listLogsArchivesExecute(req) -} - -// listLogsArchivesExecute executes the request. -func (a *LogsArchivesApi) listLogsArchivesExecute(r apiListLogsArchivesRequest) (LogsArchives, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsArchives - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.ListLogsArchives") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiRemoveRoleFromArchiveRequest struct { - ctx _context.Context - archiveId string - body *RelationshipToRole -} - -func (a *LogsArchivesApi) buildRemoveRoleFromArchiveRequest(ctx _context.Context, archiveId string, body RelationshipToRole) (apiRemoveRoleFromArchiveRequest, error) { - req := apiRemoveRoleFromArchiveRequest{ - ctx: ctx, - archiveId: archiveId, - body: &body, - } - return req, nil -} - -// RemoveRoleFromArchive Revoke role from an archive. -// Removes a role from an archive. ([Roles API](https://docs.datadoghq.com/api/v2/roles/)) -func (a *LogsArchivesApi) RemoveRoleFromArchive(ctx _context.Context, archiveId string, body RelationshipToRole) (*_nethttp.Response, error) { - req, err := a.buildRemoveRoleFromArchiveRequest(ctx, archiveId, body) - if err != nil { - return nil, err - } - - return a.removeRoleFromArchiveExecute(req) -} - -// removeRoleFromArchiveExecute executes the request. -func (a *LogsArchivesApi) removeRoleFromArchiveExecute(r apiRemoveRoleFromArchiveRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.RemoveRoleFromArchive") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}/readers" - localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "*/*" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiUpdateLogsArchiveRequest struct { - ctx _context.Context - archiveId string - body *LogsArchiveCreateRequest -} - -func (a *LogsArchivesApi) buildUpdateLogsArchiveRequest(ctx _context.Context, archiveId string, body LogsArchiveCreateRequest) (apiUpdateLogsArchiveRequest, error) { - req := apiUpdateLogsArchiveRequest{ - ctx: ctx, - archiveId: archiveId, - body: &body, - } - return req, nil -} - -// UpdateLogsArchive Update an archive. -// Update a given archive configuration. -// -// **Note**: Using this method updates your archive configuration by **replacing** -// your current configuration with the new one sent to your Datadog organization. -func (a *LogsArchivesApi) UpdateLogsArchive(ctx _context.Context, archiveId string, body LogsArchiveCreateRequest) (LogsArchive, *_nethttp.Response, error) { - req, err := a.buildUpdateLogsArchiveRequest(ctx, archiveId, body) - if err != nil { - var localVarReturnValue LogsArchive - return localVarReturnValue, nil, err - } - - return a.updateLogsArchiveExecute(req) -} - -// updateLogsArchiveExecute executes the request. -func (a *LogsArchivesApi) updateLogsArchiveExecute(r apiUpdateLogsArchiveRequest) (LogsArchive, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue LogsArchive - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.UpdateLogsArchive") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}" - localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateLogsArchiveOrderRequest struct { - ctx _context.Context - body *LogsArchiveOrder -} - -func (a *LogsArchivesApi) buildUpdateLogsArchiveOrderRequest(ctx _context.Context, body LogsArchiveOrder) (apiUpdateLogsArchiveOrderRequest, error) { - req := apiUpdateLogsArchiveOrderRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// UpdateLogsArchiveOrder Update archive order. -// Update the order of your archives. Since logs are processed sequentially, reordering an archive may change -// the structure and content of the data processed by other archives. -// -// **Note**: Using the `PUT` method updates your archive's order by replacing the current order -// with the new one. -func (a *LogsArchivesApi) UpdateLogsArchiveOrder(ctx _context.Context, body LogsArchiveOrder) (LogsArchiveOrder, *_nethttp.Response, error) { - req, err := a.buildUpdateLogsArchiveOrderRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsArchiveOrder - return localVarReturnValue, nil, err - } - - return a.updateLogsArchiveOrderExecute(req) -} - -// updateLogsArchiveOrderExecute executes the request. -func (a *LogsArchivesApi) updateLogsArchiveOrderExecute(r apiUpdateLogsArchiveOrderRequest) (LogsArchiveOrder, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue LogsArchiveOrder - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.UpdateLogsArchiveOrder") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/archive-order" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 422 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewLogsArchivesApi Returns NewLogsArchivesApi. -func NewLogsArchivesApi(client *common.APIClient) *LogsArchivesApi { - return &LogsArchivesApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_logs_metrics.go b/api/v2/datadog/api_logs_metrics.go deleted file mode 100644 index 63544c60766..00000000000 --- a/api/v2/datadog/api_logs_metrics.go +++ /dev/null @@ -1,721 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsMetricsApi service type -type LogsMetricsApi common.Service - -type apiCreateLogsMetricRequest struct { - ctx _context.Context - body *LogsMetricCreateRequest -} - -func (a *LogsMetricsApi) buildCreateLogsMetricRequest(ctx _context.Context, body LogsMetricCreateRequest) (apiCreateLogsMetricRequest, error) { - req := apiCreateLogsMetricRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateLogsMetric Create a log-based metric. -// Create a metric based on your ingested logs in your organization. -// Returns the log-based metric object from the request body when the request is successful. -func (a *LogsMetricsApi) CreateLogsMetric(ctx _context.Context, body LogsMetricCreateRequest) (LogsMetricResponse, *_nethttp.Response, error) { - req, err := a.buildCreateLogsMetricRequest(ctx, body) - if err != nil { - var localVarReturnValue LogsMetricResponse - return localVarReturnValue, nil, err - } - - return a.createLogsMetricExecute(req) -} - -// createLogsMetricExecute executes the request. -func (a *LogsMetricsApi) createLogsMetricExecute(r apiCreateLogsMetricRequest) (LogsMetricResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue LogsMetricResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.CreateLogsMetric") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/metrics" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteLogsMetricRequest struct { - ctx _context.Context - metricId string -} - -func (a *LogsMetricsApi) buildDeleteLogsMetricRequest(ctx _context.Context, metricId string) (apiDeleteLogsMetricRequest, error) { - req := apiDeleteLogsMetricRequest{ - ctx: ctx, - metricId: metricId, - } - return req, nil -} - -// DeleteLogsMetric Delete a log-based metric. -// Delete a specific log-based metric from your organization. -func (a *LogsMetricsApi) DeleteLogsMetric(ctx _context.Context, metricId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteLogsMetricRequest(ctx, metricId) - if err != nil { - return nil, err - } - - return a.deleteLogsMetricExecute(req) -} - -// deleteLogsMetricExecute executes the request. -func (a *LogsMetricsApi) deleteLogsMetricExecute(r apiDeleteLogsMetricRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.DeleteLogsMetric") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/metrics/{metric_id}" - localVarPath = strings.Replace(localVarPath, "{"+"metric_id"+"}", _neturl.PathEscape(common.ParameterToString(r.metricId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetLogsMetricRequest struct { - ctx _context.Context - metricId string -} - -func (a *LogsMetricsApi) buildGetLogsMetricRequest(ctx _context.Context, metricId string) (apiGetLogsMetricRequest, error) { - req := apiGetLogsMetricRequest{ - ctx: ctx, - metricId: metricId, - } - return req, nil -} - -// GetLogsMetric Get a log-based metric. -// Get a specific log-based metric from your organization. -func (a *LogsMetricsApi) GetLogsMetric(ctx _context.Context, metricId string) (LogsMetricResponse, *_nethttp.Response, error) { - req, err := a.buildGetLogsMetricRequest(ctx, metricId) - if err != nil { - var localVarReturnValue LogsMetricResponse - return localVarReturnValue, nil, err - } - - return a.getLogsMetricExecute(req) -} - -// getLogsMetricExecute executes the request. -func (a *LogsMetricsApi) getLogsMetricExecute(r apiGetLogsMetricRequest) (LogsMetricResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsMetricResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.GetLogsMetric") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/metrics/{metric_id}" - localVarPath = strings.Replace(localVarPath, "{"+"metric_id"+"}", _neturl.PathEscape(common.ParameterToString(r.metricId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListLogsMetricsRequest struct { - ctx _context.Context -} - -func (a *LogsMetricsApi) buildListLogsMetricsRequest(ctx _context.Context) (apiListLogsMetricsRequest, error) { - req := apiListLogsMetricsRequest{ - ctx: ctx, - } - return req, nil -} - -// ListLogsMetrics Get all log-based metrics. -// Get the list of configured log-based metrics with their definitions. -func (a *LogsMetricsApi) ListLogsMetrics(ctx _context.Context) (LogsMetricsResponse, *_nethttp.Response, error) { - req, err := a.buildListLogsMetricsRequest(ctx) - if err != nil { - var localVarReturnValue LogsMetricsResponse - return localVarReturnValue, nil, err - } - - return a.listLogsMetricsExecute(req) -} - -// listLogsMetricsExecute executes the request. -func (a *LogsMetricsApi) listLogsMetricsExecute(r apiListLogsMetricsRequest) (LogsMetricsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue LogsMetricsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.ListLogsMetrics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/metrics" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateLogsMetricRequest struct { - ctx _context.Context - metricId string - body *LogsMetricUpdateRequest -} - -func (a *LogsMetricsApi) buildUpdateLogsMetricRequest(ctx _context.Context, metricId string, body LogsMetricUpdateRequest) (apiUpdateLogsMetricRequest, error) { - req := apiUpdateLogsMetricRequest{ - ctx: ctx, - metricId: metricId, - body: &body, - } - return req, nil -} - -// UpdateLogsMetric Update a log-based metric. -// Update a specific log-based metric from your organization. -// Returns the log-based metric object from the request body when the request is successful. -func (a *LogsMetricsApi) UpdateLogsMetric(ctx _context.Context, metricId string, body LogsMetricUpdateRequest) (LogsMetricResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateLogsMetricRequest(ctx, metricId, body) - if err != nil { - var localVarReturnValue LogsMetricResponse - return localVarReturnValue, nil, err - } - - return a.updateLogsMetricExecute(req) -} - -// updateLogsMetricExecute executes the request. -func (a *LogsMetricsApi) updateLogsMetricExecute(r apiUpdateLogsMetricRequest) (LogsMetricResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue LogsMetricResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.UpdateLogsMetric") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/logs/config/metrics/{metric_id}" - localVarPath = strings.Replace(localVarPath, "{"+"metric_id"+"}", _neturl.PathEscape(common.ParameterToString(r.metricId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewLogsMetricsApi Returns NewLogsMetricsApi. -func NewLogsMetricsApi(client *common.APIClient) *LogsMetricsApi { - return &LogsMetricsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_metrics.go b/api/v2/datadog/api_metrics.go deleted file mode 100644 index 804b7b90b66..00000000000 --- a/api/v2/datadog/api_metrics.go +++ /dev/null @@ -1,1841 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// MetricsApi service type -type MetricsApi common.Service - -type apiCreateBulkTagsMetricsConfigurationRequest struct { - ctx _context.Context - body *MetricBulkTagConfigCreateRequest -} - -func (a *MetricsApi) buildCreateBulkTagsMetricsConfigurationRequest(ctx _context.Context, body MetricBulkTagConfigCreateRequest) (apiCreateBulkTagsMetricsConfigurationRequest, error) { - req := apiCreateBulkTagsMetricsConfigurationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateBulkTagsMetricsConfiguration Configure tags for multiple metrics. -// Create and define a list of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. -// Metrics are selected by passing a metric name prefix. Use the Delete method of this API path to remove tag configurations. -// Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. -// If multiple calls include the same metric, the last configuration applied (not by submit order) is used, do not -// expect deterministic ordering of concurrent calls. -// Can only be used with application keys of users with the `Manage Tags for Metrics` permission. -func (a *MetricsApi) CreateBulkTagsMetricsConfiguration(ctx _context.Context, body MetricBulkTagConfigCreateRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { - req, err := a.buildCreateBulkTagsMetricsConfigurationRequest(ctx, body) - if err != nil { - var localVarReturnValue MetricBulkTagConfigResponse - return localVarReturnValue, nil, err - } - - return a.createBulkTagsMetricsConfigurationExecute(req) -} - -// createBulkTagsMetricsConfigurationExecute executes the request. -func (a *MetricsApi) createBulkTagsMetricsConfigurationExecute(r apiCreateBulkTagsMetricsConfigurationRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue MetricBulkTagConfigResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.CreateBulkTagsMetricsConfiguration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/config/bulk-tags" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateTagConfigurationRequest struct { - ctx _context.Context - metricName string - body *MetricTagConfigurationCreateRequest -} - -func (a *MetricsApi) buildCreateTagConfigurationRequest(ctx _context.Context, metricName string, body MetricTagConfigurationCreateRequest) (apiCreateTagConfigurationRequest, error) { - req := apiCreateTagConfigurationRequest{ - ctx: ctx, - metricName: metricName, - body: &body, - } - return req, nil -} - -// CreateTagConfiguration Create a tag configuration. -// Create and define a list of queryable tag keys for an existing count/gauge/rate/distribution metric. -// Optionally, include percentile aggregations on any distribution metric or configure custom aggregations -// on any count, rate, or gauge metric. -// Can only be used with application keys of users with the `Manage Tags for Metrics` permission. -func (a *MetricsApi) CreateTagConfiguration(ctx _context.Context, metricName string, body MetricTagConfigurationCreateRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { - req, err := a.buildCreateTagConfigurationRequest(ctx, metricName, body) - if err != nil { - var localVarReturnValue MetricTagConfigurationResponse - return localVarReturnValue, nil, err - } - - return a.createTagConfigurationExecute(req) -} - -// createTagConfigurationExecute executes the request. -func (a *MetricsApi) createTagConfigurationExecute(r apiCreateTagConfigurationRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue MetricTagConfigurationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.CreateTagConfiguration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteBulkTagsMetricsConfigurationRequest struct { - ctx _context.Context - body *MetricBulkTagConfigDeleteRequest -} - -func (a *MetricsApi) buildDeleteBulkTagsMetricsConfigurationRequest(ctx _context.Context, body MetricBulkTagConfigDeleteRequest) (apiDeleteBulkTagsMetricsConfigurationRequest, error) { - req := apiDeleteBulkTagsMetricsConfigurationRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// DeleteBulkTagsMetricsConfiguration Configure tags for multiple metrics. -// Delete all custom lists of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. -// Metrics are selected by passing a metric name prefix. -// Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. -// Can only be used with application keys of users with the `Manage Tags for Metrics` permission. -func (a *MetricsApi) DeleteBulkTagsMetricsConfiguration(ctx _context.Context, body MetricBulkTagConfigDeleteRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { - req, err := a.buildDeleteBulkTagsMetricsConfigurationRequest(ctx, body) - if err != nil { - var localVarReturnValue MetricBulkTagConfigResponse - return localVarReturnValue, nil, err - } - - return a.deleteBulkTagsMetricsConfigurationExecute(req) -} - -// deleteBulkTagsMetricsConfigurationExecute executes the request. -func (a *MetricsApi) deleteBulkTagsMetricsConfigurationExecute(r apiDeleteBulkTagsMetricsConfigurationRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue MetricBulkTagConfigResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.DeleteBulkTagsMetricsConfiguration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/config/bulk-tags" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteTagConfigurationRequest struct { - ctx _context.Context - metricName string -} - -func (a *MetricsApi) buildDeleteTagConfigurationRequest(ctx _context.Context, metricName string) (apiDeleteTagConfigurationRequest, error) { - req := apiDeleteTagConfigurationRequest{ - ctx: ctx, - metricName: metricName, - } - return req, nil -} - -// DeleteTagConfiguration Delete a tag configuration. -// Deletes a metric's tag configuration. Can only be used with application -// keys from users with the `Manage Tags for Metrics` permission. -func (a *MetricsApi) DeleteTagConfiguration(ctx _context.Context, metricName string) (*_nethttp.Response, error) { - req, err := a.buildDeleteTagConfigurationRequest(ctx, metricName) - if err != nil { - return nil, err - } - - return a.deleteTagConfigurationExecute(req) -} - -// deleteTagConfigurationExecute executes the request. -func (a *MetricsApi) deleteTagConfigurationExecute(r apiDeleteTagConfigurationRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.DeleteTagConfiguration") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiEstimateMetricsOutputSeriesRequest struct { - ctx _context.Context - metricName string - filterGroups *string - filterHoursAgo *int32 - filterNumAggregations *int32 - filterPct *bool - filterTimespanH *int32 -} - -// EstimateMetricsOutputSeriesOptionalParameters holds optional parameters for EstimateMetricsOutputSeries. -type EstimateMetricsOutputSeriesOptionalParameters struct { - FilterGroups *string - FilterHoursAgo *int32 - FilterNumAggregations *int32 - FilterPct *bool - FilterTimespanH *int32 -} - -// NewEstimateMetricsOutputSeriesOptionalParameters creates an empty struct for parameters. -func NewEstimateMetricsOutputSeriesOptionalParameters() *EstimateMetricsOutputSeriesOptionalParameters { - this := EstimateMetricsOutputSeriesOptionalParameters{} - return &this -} - -// WithFilterGroups sets the corresponding parameter name and returns the struct. -func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterGroups(filterGroups string) *EstimateMetricsOutputSeriesOptionalParameters { - r.FilterGroups = &filterGroups - return r -} - -// WithFilterHoursAgo sets the corresponding parameter name and returns the struct. -func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterHoursAgo(filterHoursAgo int32) *EstimateMetricsOutputSeriesOptionalParameters { - r.FilterHoursAgo = &filterHoursAgo - return r -} - -// WithFilterNumAggregations sets the corresponding parameter name and returns the struct. -func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterNumAggregations(filterNumAggregations int32) *EstimateMetricsOutputSeriesOptionalParameters { - r.FilterNumAggregations = &filterNumAggregations - return r -} - -// WithFilterPct sets the corresponding parameter name and returns the struct. -func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterPct(filterPct bool) *EstimateMetricsOutputSeriesOptionalParameters { - r.FilterPct = &filterPct - return r -} - -// WithFilterTimespanH sets the corresponding parameter name and returns the struct. -func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterTimespanH(filterTimespanH int32) *EstimateMetricsOutputSeriesOptionalParameters { - r.FilterTimespanH = &filterTimespanH - return r -} - -func (a *MetricsApi) buildEstimateMetricsOutputSeriesRequest(ctx _context.Context, metricName string, o ...EstimateMetricsOutputSeriesOptionalParameters) (apiEstimateMetricsOutputSeriesRequest, error) { - req := apiEstimateMetricsOutputSeriesRequest{ - ctx: ctx, - metricName: metricName, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type EstimateMetricsOutputSeriesOptionalParameters is allowed") - } - - if o != nil { - req.filterGroups = o[0].FilterGroups - req.filterHoursAgo = o[0].FilterHoursAgo - req.filterNumAggregations = o[0].FilterNumAggregations - req.filterPct = o[0].FilterPct - req.filterTimespanH = o[0].FilterTimespanH - } - return req, nil -} - -// EstimateMetricsOutputSeries Tag Configuration Cardinality Estimator. -// Returns the estimated cardinality for a metric with a given tag, percentile and number of aggregations configuration using Metrics without Limits™. -func (a *MetricsApi) EstimateMetricsOutputSeries(ctx _context.Context, metricName string, o ...EstimateMetricsOutputSeriesOptionalParameters) (MetricEstimateResponse, *_nethttp.Response, error) { - req, err := a.buildEstimateMetricsOutputSeriesRequest(ctx, metricName, o...) - if err != nil { - var localVarReturnValue MetricEstimateResponse - return localVarReturnValue, nil, err - } - - return a.estimateMetricsOutputSeriesExecute(req) -} - -// estimateMetricsOutputSeriesExecute executes the request. -func (a *MetricsApi) estimateMetricsOutputSeriesExecute(r apiEstimateMetricsOutputSeriesRequest) (MetricEstimateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricEstimateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.EstimateMetricsOutputSeries") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/estimate" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterGroups != nil { - localVarQueryParams.Add("filter[groups]", common.ParameterToString(*r.filterGroups, "")) - } - if r.filterHoursAgo != nil { - localVarQueryParams.Add("filter[hours_ago]", common.ParameterToString(*r.filterHoursAgo, "")) - } - if r.filterNumAggregations != nil { - localVarQueryParams.Add("filter[num_aggregations]", common.ParameterToString(*r.filterNumAggregations, "")) - } - if r.filterPct != nil { - localVarQueryParams.Add("filter[pct]", common.ParameterToString(*r.filterPct, "")) - } - if r.filterTimespanH != nil { - localVarQueryParams.Add("filter[timespan_h]", common.ParameterToString(*r.filterTimespanH, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListTagConfigurationByNameRequest struct { - ctx _context.Context - metricName string -} - -func (a *MetricsApi) buildListTagConfigurationByNameRequest(ctx _context.Context, metricName string) (apiListTagConfigurationByNameRequest, error) { - req := apiListTagConfigurationByNameRequest{ - ctx: ctx, - metricName: metricName, - } - return req, nil -} - -// ListTagConfigurationByName List tag configuration by name. -// Returns the tag configuration for the given metric name. -func (a *MetricsApi) ListTagConfigurationByName(ctx _context.Context, metricName string) (MetricTagConfigurationResponse, *_nethttp.Response, error) { - req, err := a.buildListTagConfigurationByNameRequest(ctx, metricName) - if err != nil { - var localVarReturnValue MetricTagConfigurationResponse - return localVarReturnValue, nil, err - } - - return a.listTagConfigurationByNameExecute(req) -} - -// listTagConfigurationByNameExecute executes the request. -func (a *MetricsApi) listTagConfigurationByNameExecute(r apiListTagConfigurationByNameRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricTagConfigurationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListTagConfigurationByName") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListTagConfigurationsRequest struct { - ctx _context.Context - filterConfigured *bool - filterTagsConfigured *string - filterMetricType *MetricTagConfigurationMetricTypes - filterIncludePercentiles *bool - filterTags *string - windowSeconds *int64 -} - -// ListTagConfigurationsOptionalParameters holds optional parameters for ListTagConfigurations. -type ListTagConfigurationsOptionalParameters struct { - FilterConfigured *bool - FilterTagsConfigured *string - FilterMetricType *MetricTagConfigurationMetricTypes - FilterIncludePercentiles *bool - FilterTags *string - WindowSeconds *int64 -} - -// NewListTagConfigurationsOptionalParameters creates an empty struct for parameters. -func NewListTagConfigurationsOptionalParameters() *ListTagConfigurationsOptionalParameters { - this := ListTagConfigurationsOptionalParameters{} - return &this -} - -// WithFilterConfigured sets the corresponding parameter name and returns the struct. -func (r *ListTagConfigurationsOptionalParameters) WithFilterConfigured(filterConfigured bool) *ListTagConfigurationsOptionalParameters { - r.FilterConfigured = &filterConfigured - return r -} - -// WithFilterTagsConfigured sets the corresponding parameter name and returns the struct. -func (r *ListTagConfigurationsOptionalParameters) WithFilterTagsConfigured(filterTagsConfigured string) *ListTagConfigurationsOptionalParameters { - r.FilterTagsConfigured = &filterTagsConfigured - return r -} - -// WithFilterMetricType sets the corresponding parameter name and returns the struct. -func (r *ListTagConfigurationsOptionalParameters) WithFilterMetricType(filterMetricType MetricTagConfigurationMetricTypes) *ListTagConfigurationsOptionalParameters { - r.FilterMetricType = &filterMetricType - return r -} - -// WithFilterIncludePercentiles sets the corresponding parameter name and returns the struct. -func (r *ListTagConfigurationsOptionalParameters) WithFilterIncludePercentiles(filterIncludePercentiles bool) *ListTagConfigurationsOptionalParameters { - r.FilterIncludePercentiles = &filterIncludePercentiles - return r -} - -// WithFilterTags sets the corresponding parameter name and returns the struct. -func (r *ListTagConfigurationsOptionalParameters) WithFilterTags(filterTags string) *ListTagConfigurationsOptionalParameters { - r.FilterTags = &filterTags - return r -} - -// WithWindowSeconds sets the corresponding parameter name and returns the struct. -func (r *ListTagConfigurationsOptionalParameters) WithWindowSeconds(windowSeconds int64) *ListTagConfigurationsOptionalParameters { - r.WindowSeconds = &windowSeconds - return r -} - -func (a *MetricsApi) buildListTagConfigurationsRequest(ctx _context.Context, o ...ListTagConfigurationsOptionalParameters) (apiListTagConfigurationsRequest, error) { - req := apiListTagConfigurationsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListTagConfigurationsOptionalParameters is allowed") - } - - if o != nil { - req.filterConfigured = o[0].FilterConfigured - req.filterTagsConfigured = o[0].FilterTagsConfigured - req.filterMetricType = o[0].FilterMetricType - req.filterIncludePercentiles = o[0].FilterIncludePercentiles - req.filterTags = o[0].FilterTags - req.windowSeconds = o[0].WindowSeconds - } - return req, nil -} - -// ListTagConfigurations List tag configurations. -// Returns all configured count/gauge/rate/distribution metric names -// (with additional filters if specified). -func (a *MetricsApi) ListTagConfigurations(ctx _context.Context, o ...ListTagConfigurationsOptionalParameters) (MetricsAndMetricTagConfigurationsResponse, *_nethttp.Response, error) { - req, err := a.buildListTagConfigurationsRequest(ctx, o...) - if err != nil { - var localVarReturnValue MetricsAndMetricTagConfigurationsResponse - return localVarReturnValue, nil, err - } - - return a.listTagConfigurationsExecute(req) -} - -// listTagConfigurationsExecute executes the request. -func (a *MetricsApi) listTagConfigurationsExecute(r apiListTagConfigurationsRequest) (MetricsAndMetricTagConfigurationsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricsAndMetricTagConfigurationsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListTagConfigurations") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterConfigured != nil { - localVarQueryParams.Add("filter[configured]", common.ParameterToString(*r.filterConfigured, "")) - } - if r.filterTagsConfigured != nil { - localVarQueryParams.Add("filter[tags_configured]", common.ParameterToString(*r.filterTagsConfigured, "")) - } - if r.filterMetricType != nil { - localVarQueryParams.Add("filter[metric_type]", common.ParameterToString(*r.filterMetricType, "")) - } - if r.filterIncludePercentiles != nil { - localVarQueryParams.Add("filter[include_percentiles]", common.ParameterToString(*r.filterIncludePercentiles, "")) - } - if r.filterTags != nil { - localVarQueryParams.Add("filter[tags]", common.ParameterToString(*r.filterTags, "")) - } - if r.windowSeconds != nil { - localVarQueryParams.Add("window[seconds]", common.ParameterToString(*r.windowSeconds, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListTagsByMetricNameRequest struct { - ctx _context.Context - metricName string -} - -func (a *MetricsApi) buildListTagsByMetricNameRequest(ctx _context.Context, metricName string) (apiListTagsByMetricNameRequest, error) { - req := apiListTagsByMetricNameRequest{ - ctx: ctx, - metricName: metricName, - } - return req, nil -} - -// ListTagsByMetricName List tags by metric name. -// View indexed tag key-value pairs for a given metric name. -func (a *MetricsApi) ListTagsByMetricName(ctx _context.Context, metricName string) (MetricAllTagsResponse, *_nethttp.Response, error) { - req, err := a.buildListTagsByMetricNameRequest(ctx, metricName) - if err != nil { - var localVarReturnValue MetricAllTagsResponse - return localVarReturnValue, nil, err - } - - return a.listTagsByMetricNameExecute(req) -} - -// listTagsByMetricNameExecute executes the request. -func (a *MetricsApi) listTagsByMetricNameExecute(r apiListTagsByMetricNameRequest) (MetricAllTagsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricAllTagsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListTagsByMetricName") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/all-tags" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListVolumesByMetricNameRequest struct { - ctx _context.Context - metricName string -} - -func (a *MetricsApi) buildListVolumesByMetricNameRequest(ctx _context.Context, metricName string) (apiListVolumesByMetricNameRequest, error) { - req := apiListVolumesByMetricNameRequest{ - ctx: ctx, - metricName: metricName, - } - return req, nil -} - -// ListVolumesByMetricName List distinct metric volumes by metric name. -// View distinct metrics volumes for the given metric name. -// -// Custom metrics generated in-app from other products will return `null` for ingested volumes. -func (a *MetricsApi) ListVolumesByMetricName(ctx _context.Context, metricName string) (MetricVolumesResponse, *_nethttp.Response, error) { - req, err := a.buildListVolumesByMetricNameRequest(ctx, metricName) - if err != nil { - var localVarReturnValue MetricVolumesResponse - return localVarReturnValue, nil, err - } - - return a.listVolumesByMetricNameExecute(req) -} - -// listVolumesByMetricNameExecute executes the request. -func (a *MetricsApi) listVolumesByMetricNameExecute(r apiListVolumesByMetricNameRequest) (MetricVolumesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue MetricVolumesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListVolumesByMetricName") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/volumes" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSubmitMetricsRequest struct { - ctx _context.Context - body *MetricPayload - contentEncoding *MetricContentEncoding -} - -// SubmitMetricsOptionalParameters holds optional parameters for SubmitMetrics. -type SubmitMetricsOptionalParameters struct { - ContentEncoding *MetricContentEncoding -} - -// NewSubmitMetricsOptionalParameters creates an empty struct for parameters. -func NewSubmitMetricsOptionalParameters() *SubmitMetricsOptionalParameters { - this := SubmitMetricsOptionalParameters{} - return &this -} - -// WithContentEncoding sets the corresponding parameter name and returns the struct. -func (r *SubmitMetricsOptionalParameters) WithContentEncoding(contentEncoding MetricContentEncoding) *SubmitMetricsOptionalParameters { - r.ContentEncoding = &contentEncoding - return r -} - -func (a *MetricsApi) buildSubmitMetricsRequest(ctx _context.Context, body MetricPayload, o ...SubmitMetricsOptionalParameters) (apiSubmitMetricsRequest, error) { - req := apiSubmitMetricsRequest{ - ctx: ctx, - body: &body, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SubmitMetricsOptionalParameters is allowed") - } - - if o != nil { - req.contentEncoding = o[0].ContentEncoding - } - return req, nil -} - -// SubmitMetrics Submit metrics. -// The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. -// The maximum payload size is 500 kilobytes (512000 bytes). Compressed payloads must have a decompressed size of less than 5 megabytes (5242880 bytes). -// -// If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect: -// -// - 64 bits for the timestamp -// - 64 bits for the value -// - 20 bytes for the metric names -// - 50 bytes for the timeseries -// - The full payload is approximately 100 bytes. -// -// Host name is one of the resources in the Resources field. -func (a *MetricsApi) SubmitMetrics(ctx _context.Context, body MetricPayload, o ...SubmitMetricsOptionalParameters) (IntakePayloadAccepted, *_nethttp.Response, error) { - req, err := a.buildSubmitMetricsRequest(ctx, body, o...) - if err != nil { - var localVarReturnValue IntakePayloadAccepted - return localVarReturnValue, nil, err - } - - return a.submitMetricsExecute(req) -} - -// submitMetricsExecute executes the request. -func (a *MetricsApi) submitMetricsExecute(r apiSubmitMetricsRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue IntakePayloadAccepted - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.SubmitMetrics") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/series" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - if r.contentEncoding != nil { - localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") - } - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 408 { - 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 - } - if localVarHTTPResponse.StatusCode == 413 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateTagConfigurationRequest struct { - ctx _context.Context - metricName string - body *MetricTagConfigurationUpdateRequest -} - -func (a *MetricsApi) buildUpdateTagConfigurationRequest(ctx _context.Context, metricName string, body MetricTagConfigurationUpdateRequest) (apiUpdateTagConfigurationRequest, error) { - req := apiUpdateTagConfigurationRequest{ - ctx: ctx, - metricName: metricName, - body: &body, - } - return req, nil -} - -// UpdateTagConfiguration Update a tag configuration. -// Update the tag configuration of a metric or percentile aggregations of a distribution metric or custom aggregations -// of a count, rate, or gauge metric. -// Can only be used with application keys from users with the `Manage Tags for Metrics` permission. -func (a *MetricsApi) UpdateTagConfiguration(ctx _context.Context, metricName string, body MetricTagConfigurationUpdateRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateTagConfigurationRequest(ctx, metricName, body) - if err != nil { - var localVarReturnValue MetricTagConfigurationResponse - return localVarReturnValue, nil, err - } - - return a.updateTagConfigurationExecute(req) -} - -// updateTagConfigurationExecute executes the request. -func (a *MetricsApi) updateTagConfigurationExecute(r apiUpdateTagConfigurationRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue MetricTagConfigurationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.UpdateTagConfiguration") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" - localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 422 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewMetricsApi Returns NewMetricsApi. -func NewMetricsApi(client *common.APIClient) *MetricsApi { - return &MetricsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_opsgenie_integration.go b/api/v2/datadog/api_opsgenie_integration.go deleted file mode 100644 index 307940b7638..00000000000 --- a/api/v2/datadog/api_opsgenie_integration.go +++ /dev/null @@ -1,755 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// OpsgenieIntegrationApi service type -type OpsgenieIntegrationApi common.Service - -type apiCreateOpsgenieServiceRequest struct { - ctx _context.Context - body *OpsgenieServiceCreateRequest -} - -func (a *OpsgenieIntegrationApi) buildCreateOpsgenieServiceRequest(ctx _context.Context, body OpsgenieServiceCreateRequest) (apiCreateOpsgenieServiceRequest, error) { - req := apiCreateOpsgenieServiceRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateOpsgenieService Create a new service object. -// Create a new service object in the Opsgenie integration. -func (a *OpsgenieIntegrationApi) CreateOpsgenieService(ctx _context.Context, body OpsgenieServiceCreateRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { - req, err := a.buildCreateOpsgenieServiceRequest(ctx, body) - if err != nil { - var localVarReturnValue OpsgenieServiceResponse - return localVarReturnValue, nil, err - } - - return a.createOpsgenieServiceExecute(req) -} - -// createOpsgenieServiceExecute executes the request. -func (a *OpsgenieIntegrationApi) createOpsgenieServiceExecute(r apiCreateOpsgenieServiceRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue OpsgenieServiceResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.CreateOpsgenieService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/integration/opsgenie/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteOpsgenieServiceRequest struct { - ctx _context.Context - integrationServiceId string -} - -func (a *OpsgenieIntegrationApi) buildDeleteOpsgenieServiceRequest(ctx _context.Context, integrationServiceId string) (apiDeleteOpsgenieServiceRequest, error) { - req := apiDeleteOpsgenieServiceRequest{ - ctx: ctx, - integrationServiceId: integrationServiceId, - } - return req, nil -} - -// DeleteOpsgenieService Delete a single service object. -// Delete a single service object in the Datadog Opsgenie integration. -func (a *OpsgenieIntegrationApi) DeleteOpsgenieService(ctx _context.Context, integrationServiceId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteOpsgenieServiceRequest(ctx, integrationServiceId) - if err != nil { - return nil, err - } - - return a.deleteOpsgenieServiceExecute(req) -} - -// deleteOpsgenieServiceExecute executes the request. -func (a *OpsgenieIntegrationApi) deleteOpsgenieServiceExecute(r apiDeleteOpsgenieServiceRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.DeleteOpsgenieService") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/integration/opsgenie/services/{integration_service_id}" - localVarPath = strings.Replace(localVarPath, "{"+"integration_service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.integrationServiceId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetOpsgenieServiceRequest struct { - ctx _context.Context - integrationServiceId string -} - -func (a *OpsgenieIntegrationApi) buildGetOpsgenieServiceRequest(ctx _context.Context, integrationServiceId string) (apiGetOpsgenieServiceRequest, error) { - req := apiGetOpsgenieServiceRequest{ - ctx: ctx, - integrationServiceId: integrationServiceId, - } - return req, nil -} - -// GetOpsgenieService Get a single service object. -// Get a single service from the Datadog Opsgenie integration. -func (a *OpsgenieIntegrationApi) GetOpsgenieService(ctx _context.Context, integrationServiceId string) (OpsgenieServiceResponse, *_nethttp.Response, error) { - req, err := a.buildGetOpsgenieServiceRequest(ctx, integrationServiceId) - if err != nil { - var localVarReturnValue OpsgenieServiceResponse - return localVarReturnValue, nil, err - } - - return a.getOpsgenieServiceExecute(req) -} - -// getOpsgenieServiceExecute executes the request. -func (a *OpsgenieIntegrationApi) getOpsgenieServiceExecute(r apiGetOpsgenieServiceRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue OpsgenieServiceResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.GetOpsgenieService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/integration/opsgenie/services/{integration_service_id}" - localVarPath = strings.Replace(localVarPath, "{"+"integration_service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.integrationServiceId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListOpsgenieServicesRequest struct { - ctx _context.Context -} - -func (a *OpsgenieIntegrationApi) buildListOpsgenieServicesRequest(ctx _context.Context) (apiListOpsgenieServicesRequest, error) { - req := apiListOpsgenieServicesRequest{ - ctx: ctx, - } - return req, nil -} - -// ListOpsgenieServices Get all service objects. -// Get a list of all services from the Datadog Opsgenie integration. -func (a *OpsgenieIntegrationApi) ListOpsgenieServices(ctx _context.Context) (OpsgenieServicesResponse, *_nethttp.Response, error) { - req, err := a.buildListOpsgenieServicesRequest(ctx) - if err != nil { - var localVarReturnValue OpsgenieServicesResponse - return localVarReturnValue, nil, err - } - - return a.listOpsgenieServicesExecute(req) -} - -// listOpsgenieServicesExecute executes the request. -func (a *OpsgenieIntegrationApi) listOpsgenieServicesExecute(r apiListOpsgenieServicesRequest) (OpsgenieServicesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue OpsgenieServicesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.ListOpsgenieServices") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/integration/opsgenie/services" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateOpsgenieServiceRequest struct { - ctx _context.Context - integrationServiceId string - body *OpsgenieServiceUpdateRequest -} - -func (a *OpsgenieIntegrationApi) buildUpdateOpsgenieServiceRequest(ctx _context.Context, integrationServiceId string, body OpsgenieServiceUpdateRequest) (apiUpdateOpsgenieServiceRequest, error) { - req := apiUpdateOpsgenieServiceRequest{ - ctx: ctx, - integrationServiceId: integrationServiceId, - body: &body, - } - return req, nil -} - -// UpdateOpsgenieService Update a single service object. -// Update a single service object in the Datadog Opsgenie integration. -func (a *OpsgenieIntegrationApi) UpdateOpsgenieService(ctx _context.Context, integrationServiceId string, body OpsgenieServiceUpdateRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateOpsgenieServiceRequest(ctx, integrationServiceId, body) - if err != nil { - var localVarReturnValue OpsgenieServiceResponse - return localVarReturnValue, nil, err - } - - return a.updateOpsgenieServiceExecute(req) -} - -// updateOpsgenieServiceExecute executes the request. -func (a *OpsgenieIntegrationApi) updateOpsgenieServiceExecute(r apiUpdateOpsgenieServiceRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue OpsgenieServiceResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.UpdateOpsgenieService") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/integration/opsgenie/services/{integration_service_id}" - localVarPath = strings.Replace(localVarPath, "{"+"integration_service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.integrationServiceId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewOpsgenieIntegrationApi Returns NewOpsgenieIntegrationApi. -func NewOpsgenieIntegrationApi(client *common.APIClient) *OpsgenieIntegrationApi { - return &OpsgenieIntegrationApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_organizations.go b/api/v2/datadog/api_organizations.go deleted file mode 100644 index e9ff7708fe4..00000000000 --- a/api/v2/datadog/api_organizations.go +++ /dev/null @@ -1,190 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "os" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// OrganizationsApi service type -type OrganizationsApi common.Service - -type apiUploadIdPMetadataRequest struct { - ctx _context.Context - idpFile **os.File -} - -// UploadIdPMetadataOptionalParameters holds optional parameters for UploadIdPMetadata. -type UploadIdPMetadataOptionalParameters struct { - IdpFile **os.File -} - -// NewUploadIdPMetadataOptionalParameters creates an empty struct for parameters. -func NewUploadIdPMetadataOptionalParameters() *UploadIdPMetadataOptionalParameters { - this := UploadIdPMetadataOptionalParameters{} - return &this -} - -// WithIdpFile sets the corresponding parameter name and returns the struct. -func (r *UploadIdPMetadataOptionalParameters) WithIdpFile(idpFile *os.File) *UploadIdPMetadataOptionalParameters { - r.IdpFile = &idpFile - return r -} - -func (a *OrganizationsApi) buildUploadIdPMetadataRequest(ctx _context.Context, o ...UploadIdPMetadataOptionalParameters) (apiUploadIdPMetadataRequest, error) { - req := apiUploadIdPMetadataRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type UploadIdPMetadataOptionalParameters is allowed") - } - - if o != nil { - req.idpFile = o[0].IdpFile - } - return req, nil -} - -// UploadIdPMetadata Upload IdP metadata. -// Endpoint for uploading IdP metadata for SAML setup. -// -// Use this endpoint to upload or replace IdP metadata for SAML login configuration. -func (a *OrganizationsApi) UploadIdPMetadata(ctx _context.Context, o ...UploadIdPMetadataOptionalParameters) (*_nethttp.Response, error) { - req, err := a.buildUploadIdPMetadataRequest(ctx, o...) - if err != nil { - return nil, err - } - - return a.uploadIdPMetadataExecute(req) -} - -// uploadIdPMetadataExecute executes the request. -func (a *OrganizationsApi) uploadIdPMetadataExecute(r apiUploadIdPMetadataRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OrganizationsApi.UploadIdPMetadata") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/saml_configurations/idp_metadata" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Content-Type"] = "multipart/form-data" - localVarHeaderParams["Accept"] = "*/*" - - formFile := common.FormFile{} - formFile.FormFileName = "idp_file" - var localVarFile *os.File - if r.idpFile != nil { - localVarFile = *r.idpFile - } - if localVarFile != nil { - fbs, _ := _ioutil.ReadAll(localVarFile) - formFile.FileBytes = fbs - formFile.FileName = localVarFile.Name() - localVarFile.Close() - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, &formFile) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -// NewOrganizationsApi Returns NewOrganizationsApi. -func NewOrganizationsApi(client *common.APIClient) *OrganizationsApi { - return &OrganizationsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_processes.go b/api/v2/datadog/api_processes.go deleted file mode 100644 index 99c0a9f21c4..00000000000 --- a/api/v2/datadog/api_processes.go +++ /dev/null @@ -1,309 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// ProcessesApi service type -type ProcessesApi common.Service - -type apiListProcessesRequest struct { - ctx _context.Context - search *string - tags *string - from *int64 - to *int64 - pageLimit *int32 - pageCursor *string -} - -// ListProcessesOptionalParameters holds optional parameters for ListProcesses. -type ListProcessesOptionalParameters struct { - Search *string - Tags *string - From *int64 - To *int64 - PageLimit *int32 - PageCursor *string -} - -// NewListProcessesOptionalParameters creates an empty struct for parameters. -func NewListProcessesOptionalParameters() *ListProcessesOptionalParameters { - this := ListProcessesOptionalParameters{} - return &this -} - -// WithSearch sets the corresponding parameter name and returns the struct. -func (r *ListProcessesOptionalParameters) WithSearch(search string) *ListProcessesOptionalParameters { - r.Search = &search - return r -} - -// WithTags sets the corresponding parameter name and returns the struct. -func (r *ListProcessesOptionalParameters) WithTags(tags string) *ListProcessesOptionalParameters { - r.Tags = &tags - return r -} - -// WithFrom sets the corresponding parameter name and returns the struct. -func (r *ListProcessesOptionalParameters) WithFrom(from int64) *ListProcessesOptionalParameters { - r.From = &from - return r -} - -// WithTo sets the corresponding parameter name and returns the struct. -func (r *ListProcessesOptionalParameters) WithTo(to int64) *ListProcessesOptionalParameters { - r.To = &to - return r -} - -// WithPageLimit sets the corresponding parameter name and returns the struct. -func (r *ListProcessesOptionalParameters) WithPageLimit(pageLimit int32) *ListProcessesOptionalParameters { - r.PageLimit = &pageLimit - return r -} - -// WithPageCursor sets the corresponding parameter name and returns the struct. -func (r *ListProcessesOptionalParameters) WithPageCursor(pageCursor string) *ListProcessesOptionalParameters { - r.PageCursor = &pageCursor - return r -} - -func (a *ProcessesApi) buildListProcessesRequest(ctx _context.Context, o ...ListProcessesOptionalParameters) (apiListProcessesRequest, error) { - req := apiListProcessesRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListProcessesOptionalParameters is allowed") - } - - if o != nil { - req.search = o[0].Search - req.tags = o[0].Tags - req.from = o[0].From - req.to = o[0].To - req.pageLimit = o[0].PageLimit - req.pageCursor = o[0].PageCursor - } - return req, nil -} - -// ListProcesses Get all processes. -// Get all processes for your organization. -func (a *ProcessesApi) ListProcesses(ctx _context.Context, o ...ListProcessesOptionalParameters) (ProcessSummariesResponse, *_nethttp.Response, error) { - req, err := a.buildListProcessesRequest(ctx, o...) - if err != nil { - var localVarReturnValue ProcessSummariesResponse - return localVarReturnValue, nil, err - } - - return a.listProcessesExecute(req) -} - -// ListProcessesWithPagination provides a paginated version of ListProcesses returning a channel with all items. -func (a *ProcessesApi) ListProcessesWithPagination(ctx _context.Context, o ...ListProcessesOptionalParameters) (<-chan ProcessSummary, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(1000) - if len(o) == 0 { - o = append(o, ListProcessesOptionalParameters{}) - } - if o[0].PageLimit != nil { - pageSize_ = *o[0].PageLimit - } - o[0].PageLimit = &pageSize_ - - items := make(chan ProcessSummary, pageSize_) - go func() { - for { - req, err := a.buildListProcessesRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listProcessesExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].PageCursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// listProcessesExecute executes the request. -func (a *ProcessesApi) listProcessesExecute(r apiListProcessesRequest) (ProcessSummariesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ProcessSummariesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ProcessesApi.ListProcesses") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/processes" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.search != nil { - localVarQueryParams.Add("search", common.ParameterToString(*r.search, "")) - } - if r.tags != nil { - localVarQueryParams.Add("tags", common.ParameterToString(*r.tags, "")) - } - if r.from != nil { - localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) - } - if r.to != nil { - localVarQueryParams.Add("to", common.ParameterToString(*r.to, "")) - } - if r.pageLimit != nil { - localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) - } - if r.pageCursor != nil { - localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewProcessesApi Returns NewProcessesApi. -func NewProcessesApi(client *common.APIClient) *ProcessesApi { - return &ProcessesApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_roles.go b/api/v2/datadog/api_roles.go deleted file mode 100644 index f907327db28..00000000000 --- a/api/v2/datadog/api_roles.go +++ /dev/null @@ -1,2036 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// RolesApi service type -type RolesApi common.Service - -type apiAddPermissionToRoleRequest struct { - ctx _context.Context - roleId string - body *RelationshipToPermission -} - -func (a *RolesApi) buildAddPermissionToRoleRequest(ctx _context.Context, roleId string, body RelationshipToPermission) (apiAddPermissionToRoleRequest, error) { - req := apiAddPermissionToRoleRequest{ - ctx: ctx, - roleId: roleId, - body: &body, - } - return req, nil -} - -// AddPermissionToRole Grant permission to a role. -// Adds a permission to a role. -func (a *RolesApi) AddPermissionToRole(ctx _context.Context, roleId string, body RelationshipToPermission) (PermissionsResponse, *_nethttp.Response, error) { - req, err := a.buildAddPermissionToRoleRequest(ctx, roleId, body) - if err != nil { - var localVarReturnValue PermissionsResponse - return localVarReturnValue, nil, err - } - - return a.addPermissionToRoleExecute(req) -} - -// addPermissionToRoleExecute executes the request. -func (a *RolesApi) addPermissionToRoleExecute(r apiAddPermissionToRoleRequest) (PermissionsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue PermissionsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.AddPermissionToRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}/permissions" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiAddUserToRoleRequest struct { - ctx _context.Context - roleId string - body *RelationshipToUser -} - -func (a *RolesApi) buildAddUserToRoleRequest(ctx _context.Context, roleId string, body RelationshipToUser) (apiAddUserToRoleRequest, error) { - req := apiAddUserToRoleRequest{ - ctx: ctx, - roleId: roleId, - body: &body, - } - return req, nil -} - -// AddUserToRole Add a user to a role. -// Adds a user to a role. -func (a *RolesApi) AddUserToRole(ctx _context.Context, roleId string, body RelationshipToUser) (UsersResponse, *_nethttp.Response, error) { - req, err := a.buildAddUserToRoleRequest(ctx, roleId, body) - if err != nil { - var localVarReturnValue UsersResponse - return localVarReturnValue, nil, err - } - - return a.addUserToRoleExecute(req) -} - -// addUserToRoleExecute executes the request. -func (a *RolesApi) addUserToRoleExecute(r apiAddUserToRoleRequest) (UsersResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue UsersResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.AddUserToRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}/users" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCloneRoleRequest struct { - ctx _context.Context - roleId string - body *RoleCloneRequest -} - -func (a *RolesApi) buildCloneRoleRequest(ctx _context.Context, roleId string, body RoleCloneRequest) (apiCloneRoleRequest, error) { - req := apiCloneRoleRequest{ - ctx: ctx, - roleId: roleId, - body: &body, - } - return req, nil -} - -// CloneRole Create a new role by cloning an existing role. -// Clone an existing role -func (a *RolesApi) CloneRole(ctx _context.Context, roleId string, body RoleCloneRequest) (RoleResponse, *_nethttp.Response, error) { - req, err := a.buildCloneRoleRequest(ctx, roleId, body) - if err != nil { - var localVarReturnValue RoleResponse - return localVarReturnValue, nil, err - } - - return a.cloneRoleExecute(req) -} - -// cloneRoleExecute executes the request. -func (a *RolesApi) cloneRoleExecute(r apiCloneRoleRequest) (RoleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue RoleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.CloneRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}/clone" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateRoleRequest struct { - ctx _context.Context - body *RoleCreateRequest -} - -func (a *RolesApi) buildCreateRoleRequest(ctx _context.Context, body RoleCreateRequest) (apiCreateRoleRequest, error) { - req := apiCreateRoleRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateRole Create role. -// Create a new role for your organization. -func (a *RolesApi) CreateRole(ctx _context.Context, body RoleCreateRequest) (RoleCreateResponse, *_nethttp.Response, error) { - req, err := a.buildCreateRoleRequest(ctx, body) - if err != nil { - var localVarReturnValue RoleCreateResponse - return localVarReturnValue, nil, err - } - - return a.createRoleExecute(req) -} - -// createRoleExecute executes the request. -func (a *RolesApi) createRoleExecute(r apiCreateRoleRequest) (RoleCreateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue RoleCreateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.CreateRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteRoleRequest struct { - ctx _context.Context - roleId string -} - -func (a *RolesApi) buildDeleteRoleRequest(ctx _context.Context, roleId string) (apiDeleteRoleRequest, error) { - req := apiDeleteRoleRequest{ - ctx: ctx, - roleId: roleId, - } - return req, nil -} - -// DeleteRole Delete role. -// Disables a role. -func (a *RolesApi) DeleteRole(ctx _context.Context, roleId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteRoleRequest(ctx, roleId) - if err != nil { - return nil, err - } - - return a.deleteRoleExecute(req) -} - -// deleteRoleExecute executes the request. -func (a *RolesApi) deleteRoleExecute(r apiDeleteRoleRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.DeleteRole") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetRoleRequest struct { - ctx _context.Context - roleId string -} - -func (a *RolesApi) buildGetRoleRequest(ctx _context.Context, roleId string) (apiGetRoleRequest, error) { - req := apiGetRoleRequest{ - ctx: ctx, - roleId: roleId, - } - return req, nil -} - -// GetRole Get a role. -// Get a role in the organization specified by the role’s `role_id`. -func (a *RolesApi) GetRole(ctx _context.Context, roleId string) (RoleResponse, *_nethttp.Response, error) { - req, err := a.buildGetRoleRequest(ctx, roleId) - if err != nil { - var localVarReturnValue RoleResponse - return localVarReturnValue, nil, err - } - - return a.getRoleExecute(req) -} - -// getRoleExecute executes the request. -func (a *RolesApi) getRoleExecute(r apiGetRoleRequest) (RoleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue RoleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.GetRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListPermissionsRequest struct { - ctx _context.Context -} - -func (a *RolesApi) buildListPermissionsRequest(ctx _context.Context) (apiListPermissionsRequest, error) { - req := apiListPermissionsRequest{ - ctx: ctx, - } - return req, nil -} - -// ListPermissions List permissions. -// Returns a list of all permissions, including name, description, and ID. -func (a *RolesApi) ListPermissions(ctx _context.Context) (PermissionsResponse, *_nethttp.Response, error) { - req, err := a.buildListPermissionsRequest(ctx) - if err != nil { - var localVarReturnValue PermissionsResponse - return localVarReturnValue, nil, err - } - - return a.listPermissionsExecute(req) -} - -// listPermissionsExecute executes the request. -func (a *RolesApi) listPermissionsExecute(r apiListPermissionsRequest) (PermissionsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue PermissionsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListPermissions") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/permissions" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListRolePermissionsRequest struct { - ctx _context.Context - roleId string -} - -func (a *RolesApi) buildListRolePermissionsRequest(ctx _context.Context, roleId string) (apiListRolePermissionsRequest, error) { - req := apiListRolePermissionsRequest{ - ctx: ctx, - roleId: roleId, - } - return req, nil -} - -// ListRolePermissions List permissions for a role. -// Returns a list of all permissions for a single role. -func (a *RolesApi) ListRolePermissions(ctx _context.Context, roleId string) (PermissionsResponse, *_nethttp.Response, error) { - req, err := a.buildListRolePermissionsRequest(ctx, roleId) - if err != nil { - var localVarReturnValue PermissionsResponse - return localVarReturnValue, nil, err - } - - return a.listRolePermissionsExecute(req) -} - -// listRolePermissionsExecute executes the request. -func (a *RolesApi) listRolePermissionsExecute(r apiListRolePermissionsRequest) (PermissionsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue PermissionsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListRolePermissions") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}/permissions" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListRoleUsersRequest struct { - ctx _context.Context - roleId string - pageSize *int64 - pageNumber *int64 - sort *string - filter *string -} - -// ListRoleUsersOptionalParameters holds optional parameters for ListRoleUsers. -type ListRoleUsersOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *string - Filter *string -} - -// NewListRoleUsersOptionalParameters creates an empty struct for parameters. -func NewListRoleUsersOptionalParameters() *ListRoleUsersOptionalParameters { - this := ListRoleUsersOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListRoleUsersOptionalParameters) WithPageSize(pageSize int64) *ListRoleUsersOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListRoleUsersOptionalParameters) WithPageNumber(pageNumber int64) *ListRoleUsersOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListRoleUsersOptionalParameters) WithSort(sort string) *ListRoleUsersOptionalParameters { - r.Sort = &sort - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListRoleUsersOptionalParameters) WithFilter(filter string) *ListRoleUsersOptionalParameters { - r.Filter = &filter - return r -} - -func (a *RolesApi) buildListRoleUsersRequest(ctx _context.Context, roleId string, o ...ListRoleUsersOptionalParameters) (apiListRoleUsersRequest, error) { - req := apiListRoleUsersRequest{ - ctx: ctx, - roleId: roleId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListRoleUsersOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.filter = o[0].Filter - } - return req, nil -} - -// ListRoleUsers Get all users of a role. -// Gets all users of a role. -func (a *RolesApi) ListRoleUsers(ctx _context.Context, roleId string, o ...ListRoleUsersOptionalParameters) (UsersResponse, *_nethttp.Response, error) { - req, err := a.buildListRoleUsersRequest(ctx, roleId, o...) - if err != nil { - var localVarReturnValue UsersResponse - return localVarReturnValue, nil, err - } - - return a.listRoleUsersExecute(req) -} - -// listRoleUsersExecute executes the request. -func (a *RolesApi) listRoleUsersExecute(r apiListRoleUsersRequest) (UsersResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsersResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListRoleUsers") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}/users" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListRolesRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sort *RolesSort - filter *string -} - -// ListRolesOptionalParameters holds optional parameters for ListRoles. -type ListRolesOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *RolesSort - Filter *string -} - -// NewListRolesOptionalParameters creates an empty struct for parameters. -func NewListRolesOptionalParameters() *ListRolesOptionalParameters { - this := ListRolesOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListRolesOptionalParameters) WithPageSize(pageSize int64) *ListRolesOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListRolesOptionalParameters) WithPageNumber(pageNumber int64) *ListRolesOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListRolesOptionalParameters) WithSort(sort RolesSort) *ListRolesOptionalParameters { - r.Sort = &sort - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListRolesOptionalParameters) WithFilter(filter string) *ListRolesOptionalParameters { - r.Filter = &filter - return r -} - -func (a *RolesApi) buildListRolesRequest(ctx _context.Context, o ...ListRolesOptionalParameters) (apiListRolesRequest, error) { - req := apiListRolesRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListRolesOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.filter = o[0].Filter - } - return req, nil -} - -// ListRoles List roles. -// Returns all roles, including their names and their unique identifiers. -func (a *RolesApi) ListRoles(ctx _context.Context, o ...ListRolesOptionalParameters) (RolesResponse, *_nethttp.Response, error) { - req, err := a.buildListRolesRequest(ctx, o...) - if err != nil { - var localVarReturnValue RolesResponse - return localVarReturnValue, nil, err - } - - return a.listRolesExecute(req) -} - -// listRolesExecute executes the request. -func (a *RolesApi) listRolesExecute(r apiListRolesRequest) (RolesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue RolesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListRoles") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiRemovePermissionFromRoleRequest struct { - ctx _context.Context - roleId string - body *RelationshipToPermission -} - -func (a *RolesApi) buildRemovePermissionFromRoleRequest(ctx _context.Context, roleId string, body RelationshipToPermission) (apiRemovePermissionFromRoleRequest, error) { - req := apiRemovePermissionFromRoleRequest{ - ctx: ctx, - roleId: roleId, - body: &body, - } - return req, nil -} - -// RemovePermissionFromRole Revoke permission. -// Removes a permission from a role. -func (a *RolesApi) RemovePermissionFromRole(ctx _context.Context, roleId string, body RelationshipToPermission) (PermissionsResponse, *_nethttp.Response, error) { - req, err := a.buildRemovePermissionFromRoleRequest(ctx, roleId, body) - if err != nil { - var localVarReturnValue PermissionsResponse - return localVarReturnValue, nil, err - } - - return a.removePermissionFromRoleExecute(req) -} - -// removePermissionFromRoleExecute executes the request. -func (a *RolesApi) removePermissionFromRoleExecute(r apiRemovePermissionFromRoleRequest) (PermissionsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue PermissionsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.RemovePermissionFromRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}/permissions" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiRemoveUserFromRoleRequest struct { - ctx _context.Context - roleId string - body *RelationshipToUser -} - -func (a *RolesApi) buildRemoveUserFromRoleRequest(ctx _context.Context, roleId string, body RelationshipToUser) (apiRemoveUserFromRoleRequest, error) { - req := apiRemoveUserFromRoleRequest{ - ctx: ctx, - roleId: roleId, - body: &body, - } - return req, nil -} - -// RemoveUserFromRole Remove a user from a role. -// Removes a user from a role. -func (a *RolesApi) RemoveUserFromRole(ctx _context.Context, roleId string, body RelationshipToUser) (UsersResponse, *_nethttp.Response, error) { - req, err := a.buildRemoveUserFromRoleRequest(ctx, roleId, body) - if err != nil { - var localVarReturnValue UsersResponse - return localVarReturnValue, nil, err - } - - return a.removeUserFromRoleExecute(req) -} - -// removeUserFromRoleExecute executes the request. -func (a *RolesApi) removeUserFromRoleExecute(r apiRemoveUserFromRoleRequest) (UsersResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - localVarReturnValue UsersResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.RemoveUserFromRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}/users" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateRoleRequest struct { - ctx _context.Context - roleId string - body *RoleUpdateRequest -} - -func (a *RolesApi) buildUpdateRoleRequest(ctx _context.Context, roleId string, body RoleUpdateRequest) (apiUpdateRoleRequest, error) { - req := apiUpdateRoleRequest{ - ctx: ctx, - roleId: roleId, - body: &body, - } - return req, nil -} - -// UpdateRole Update a role. -// Edit a role. Can only be used with application keys belonging to administrators. -func (a *RolesApi) UpdateRole(ctx _context.Context, roleId string, body RoleUpdateRequest) (RoleUpdateResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateRoleRequest(ctx, roleId, body) - if err != nil { - var localVarReturnValue RoleUpdateResponse - return localVarReturnValue, nil, err - } - - return a.updateRoleExecute(req) -} - -// updateRoleExecute executes the request. -func (a *RolesApi) updateRoleExecute(r apiUpdateRoleRequest) (RoleUpdateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue RoleUpdateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.UpdateRole") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/roles/{role_id}" - localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 422 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewRolesApi Returns NewRolesApi. -func NewRolesApi(client *common.APIClient) *RolesApi { - return &RolesApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_rum.go b/api/v2/datadog/api_rum.go deleted file mode 100644 index 0748f63cd19..00000000000 --- a/api/v2/datadog/api_rum.go +++ /dev/null @@ -1,667 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// RUMApi service type -type RUMApi common.Service - -type apiAggregateRUMEventsRequest struct { - ctx _context.Context - body *RUMAggregateRequest -} - -func (a *RUMApi) buildAggregateRUMEventsRequest(ctx _context.Context, body RUMAggregateRequest) (apiAggregateRUMEventsRequest, error) { - req := apiAggregateRUMEventsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// AggregateRUMEvents Aggregate RUM events. -// The API endpoint to aggregate RUM events into buckets of computed metrics and timeseries. -func (a *RUMApi) AggregateRUMEvents(ctx _context.Context, body RUMAggregateRequest) (RUMAnalyticsAggregateResponse, *_nethttp.Response, error) { - req, err := a.buildAggregateRUMEventsRequest(ctx, body) - if err != nil { - var localVarReturnValue RUMAnalyticsAggregateResponse - return localVarReturnValue, nil, err - } - - return a.aggregateRUMEventsExecute(req) -} - -// aggregateRUMEventsExecute executes the request. -func (a *RUMApi) aggregateRUMEventsExecute(r apiAggregateRUMEventsRequest) (RUMAnalyticsAggregateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue RUMAnalyticsAggregateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RUMApi.AggregateRUMEvents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/rum/analytics/aggregate" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListRUMEventsRequest struct { - ctx _context.Context - filterQuery *string - filterFrom *time.Time - filterTo *time.Time - sort *RUMSort - pageCursor *string - pageLimit *int32 -} - -// ListRUMEventsOptionalParameters holds optional parameters for ListRUMEvents. -type ListRUMEventsOptionalParameters struct { - FilterQuery *string - FilterFrom *time.Time - FilterTo *time.Time - Sort *RUMSort - PageCursor *string - PageLimit *int32 -} - -// NewListRUMEventsOptionalParameters creates an empty struct for parameters. -func NewListRUMEventsOptionalParameters() *ListRUMEventsOptionalParameters { - this := ListRUMEventsOptionalParameters{} - return &this -} - -// WithFilterQuery sets the corresponding parameter name and returns the struct. -func (r *ListRUMEventsOptionalParameters) WithFilterQuery(filterQuery string) *ListRUMEventsOptionalParameters { - r.FilterQuery = &filterQuery - return r -} - -// WithFilterFrom sets the corresponding parameter name and returns the struct. -func (r *ListRUMEventsOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListRUMEventsOptionalParameters { - r.FilterFrom = &filterFrom - return r -} - -// WithFilterTo sets the corresponding parameter name and returns the struct. -func (r *ListRUMEventsOptionalParameters) WithFilterTo(filterTo time.Time) *ListRUMEventsOptionalParameters { - r.FilterTo = &filterTo - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListRUMEventsOptionalParameters) WithSort(sort RUMSort) *ListRUMEventsOptionalParameters { - r.Sort = &sort - return r -} - -// WithPageCursor sets the corresponding parameter name and returns the struct. -func (r *ListRUMEventsOptionalParameters) WithPageCursor(pageCursor string) *ListRUMEventsOptionalParameters { - r.PageCursor = &pageCursor - return r -} - -// WithPageLimit sets the corresponding parameter name and returns the struct. -func (r *ListRUMEventsOptionalParameters) WithPageLimit(pageLimit int32) *ListRUMEventsOptionalParameters { - r.PageLimit = &pageLimit - return r -} - -func (a *RUMApi) buildListRUMEventsRequest(ctx _context.Context, o ...ListRUMEventsOptionalParameters) (apiListRUMEventsRequest, error) { - req := apiListRUMEventsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListRUMEventsOptionalParameters is allowed") - } - - if o != nil { - req.filterQuery = o[0].FilterQuery - req.filterFrom = o[0].FilterFrom - req.filterTo = o[0].FilterTo - req.sort = o[0].Sort - req.pageCursor = o[0].PageCursor - req.pageLimit = o[0].PageLimit - } - return req, nil -} - -// ListRUMEvents Get a list of RUM events. -// List endpoint returns events that match a RUM search query. -// [Results are paginated][1]. -// -// Use this endpoint to see your latest RUM events. -// -// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination -func (a *RUMApi) ListRUMEvents(ctx _context.Context, o ...ListRUMEventsOptionalParameters) (RUMEventsResponse, *_nethttp.Response, error) { - req, err := a.buildListRUMEventsRequest(ctx, o...) - if err != nil { - var localVarReturnValue RUMEventsResponse - return localVarReturnValue, nil, err - } - - return a.listRUMEventsExecute(req) -} - -// ListRUMEventsWithPagination provides a paginated version of ListRUMEvents returning a channel with all items. -func (a *RUMApi) ListRUMEventsWithPagination(ctx _context.Context, o ...ListRUMEventsOptionalParameters) (<-chan RUMEvent, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, ListRUMEventsOptionalParameters{}) - } - if o[0].PageLimit != nil { - pageSize_ = *o[0].PageLimit - } - o[0].PageLimit = &pageSize_ - - items := make(chan RUMEvent, pageSize_) - go func() { - for { - req, err := a.buildListRUMEventsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listRUMEventsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].PageCursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// listRUMEventsExecute executes the request. -func (a *RUMApi) listRUMEventsExecute(r apiListRUMEventsRequest) (RUMEventsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue RUMEventsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RUMApi.ListRUMEvents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/rum/events" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterQuery != nil { - localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) - } - if r.filterFrom != nil { - localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) - } - if r.filterTo != nil { - localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.pageCursor != nil { - localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) - } - if r.pageLimit != nil { - localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSearchRUMEventsRequest struct { - ctx _context.Context - body *RUMSearchEventsRequest -} - -func (a *RUMApi) buildSearchRUMEventsRequest(ctx _context.Context, body RUMSearchEventsRequest) (apiSearchRUMEventsRequest, error) { - req := apiSearchRUMEventsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// SearchRUMEvents Search RUM events. -// List endpoint returns RUM events that match a RUM search query. -// [Results are paginated][1]. -// -// Use this endpoint to build complex RUM events filtering and search. -// -// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination -func (a *RUMApi) SearchRUMEvents(ctx _context.Context, body RUMSearchEventsRequest) (RUMEventsResponse, *_nethttp.Response, error) { - req, err := a.buildSearchRUMEventsRequest(ctx, body) - if err != nil { - var localVarReturnValue RUMEventsResponse - return localVarReturnValue, nil, err - } - - return a.searchRUMEventsExecute(req) -} - -// SearchRUMEventsWithPagination provides a paginated version of SearchRUMEvents returning a channel with all items. -func (a *RUMApi) SearchRUMEventsWithPagination(ctx _context.Context, body RUMSearchEventsRequest) (<-chan RUMEvent, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if body.Page == nil { - body.Page = NewRUMQueryPageOptions() - } - if body.Page.Limit == nil { - // int32 - body.Page.Limit = &pageSize_ - } else { - pageSize_ = *body.Page.Limit - } - - items := make(chan RUMEvent, pageSize_) - go func() { - for { - req, err := a.buildSearchRUMEventsRequest(ctx, body) - if err != nil { - break - } - - resp, _, err := a.searchRUMEventsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - body.Page.Cursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// searchRUMEventsExecute executes the request. -func (a *RUMApi) searchRUMEventsExecute(r apiSearchRUMEventsRequest) (RUMEventsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue RUMEventsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RUMApi.SearchRUMEvents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/rum/events/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewRUMApi Returns NewRUMApi. -func NewRUMApi(client *common.APIClient) *RUMApi { - return &RUMApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_security_monitoring.go b/api/v2/datadog/api_security_monitoring.go deleted file mode 100644 index af58e6d4196..00000000000 --- a/api/v2/datadog/api_security_monitoring.go +++ /dev/null @@ -1,2443 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// SecurityMonitoringApi service type -type SecurityMonitoringApi common.Service - -type apiCreateSecurityFilterRequest struct { - ctx _context.Context - body *SecurityFilterCreateRequest -} - -func (a *SecurityMonitoringApi) buildCreateSecurityFilterRequest(ctx _context.Context, body SecurityFilterCreateRequest) (apiCreateSecurityFilterRequest, error) { - req := apiCreateSecurityFilterRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateSecurityFilter Create a security filter. -// Create a security filter. -// -// See the [security filter guide](https://docs.datadoghq.com/security_platform/guide/how-to-setup-security-filters-using-security-monitoring-api/) -// for more examples. -func (a *SecurityMonitoringApi) CreateSecurityFilter(ctx _context.Context, body SecurityFilterCreateRequest) (SecurityFilterResponse, *_nethttp.Response, error) { - req, err := a.buildCreateSecurityFilterRequest(ctx, body) - if err != nil { - var localVarReturnValue SecurityFilterResponse - return localVarReturnValue, nil, err - } - - return a.createSecurityFilterExecute(req) -} - -// createSecurityFilterExecute executes the request. -func (a *SecurityMonitoringApi) createSecurityFilterExecute(r apiCreateSecurityFilterRequest) (SecurityFilterResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SecurityFilterResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.CreateSecurityFilter") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateSecurityMonitoringRuleRequest struct { - ctx _context.Context - body *SecurityMonitoringRuleCreatePayload -} - -func (a *SecurityMonitoringApi) buildCreateSecurityMonitoringRuleRequest(ctx _context.Context, body SecurityMonitoringRuleCreatePayload) (apiCreateSecurityMonitoringRuleRequest, error) { - req := apiCreateSecurityMonitoringRuleRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateSecurityMonitoringRule Create a detection rule. -// Create a detection rule. -func (a *SecurityMonitoringApi) CreateSecurityMonitoringRule(ctx _context.Context, body SecurityMonitoringRuleCreatePayload) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { - req, err := a.buildCreateSecurityMonitoringRuleRequest(ctx, body) - if err != nil { - var localVarReturnValue SecurityMonitoringRuleResponse - return localVarReturnValue, nil, err - } - - return a.createSecurityMonitoringRuleExecute(req) -} - -// createSecurityMonitoringRuleExecute executes the request. -func (a *SecurityMonitoringApi) createSecurityMonitoringRuleExecute(r apiCreateSecurityMonitoringRuleRequest) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringRuleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.CreateSecurityMonitoringRule") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/rules" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteSecurityFilterRequest struct { - ctx _context.Context - securityFilterId string -} - -func (a *SecurityMonitoringApi) buildDeleteSecurityFilterRequest(ctx _context.Context, securityFilterId string) (apiDeleteSecurityFilterRequest, error) { - req := apiDeleteSecurityFilterRequest{ - ctx: ctx, - securityFilterId: securityFilterId, - } - return req, nil -} - -// DeleteSecurityFilter Delete a security filter. -// Delete a specific security filter. -func (a *SecurityMonitoringApi) DeleteSecurityFilter(ctx _context.Context, securityFilterId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteSecurityFilterRequest(ctx, securityFilterId) - if err != nil { - return nil, err - } - - return a.deleteSecurityFilterExecute(req) -} - -// deleteSecurityFilterExecute executes the request. -func (a *SecurityMonitoringApi) deleteSecurityFilterExecute(r apiDeleteSecurityFilterRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.DeleteSecurityFilter") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}" - localVarPath = strings.Replace(localVarPath, "{"+"security_filter_id"+"}", _neturl.PathEscape(common.ParameterToString(r.securityFilterId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiDeleteSecurityMonitoringRuleRequest struct { - ctx _context.Context - ruleId string -} - -func (a *SecurityMonitoringApi) buildDeleteSecurityMonitoringRuleRequest(ctx _context.Context, ruleId string) (apiDeleteSecurityMonitoringRuleRequest, error) { - req := apiDeleteSecurityMonitoringRuleRequest{ - ctx: ctx, - ruleId: ruleId, - } - return req, nil -} - -// DeleteSecurityMonitoringRule Delete an existing rule. -// Delete an existing rule. Default rules cannot be deleted. -func (a *SecurityMonitoringApi) DeleteSecurityMonitoringRule(ctx _context.Context, ruleId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteSecurityMonitoringRuleRequest(ctx, ruleId) - if err != nil { - return nil, err - } - - return a.deleteSecurityMonitoringRuleExecute(req) -} - -// deleteSecurityMonitoringRuleExecute executes the request. -func (a *SecurityMonitoringApi) deleteSecurityMonitoringRuleExecute(r apiDeleteSecurityMonitoringRuleRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.DeleteSecurityMonitoringRule") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/rules/{rule_id}" - localVarPath = strings.Replace(localVarPath, "{"+"rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.ruleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiEditSecurityMonitoringSignalAssigneeRequest struct { - ctx _context.Context - signalId string - body *SecurityMonitoringSignalAssigneeUpdateRequest -} - -func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalAssigneeRequest(ctx _context.Context, signalId string, body SecurityMonitoringSignalAssigneeUpdateRequest) (apiEditSecurityMonitoringSignalAssigneeRequest, error) { - req := apiEditSecurityMonitoringSignalAssigneeRequest{ - ctx: ctx, - signalId: signalId, - body: &body, - } - return req, nil -} - -// EditSecurityMonitoringSignalAssignee Modify the triage assignee of a security signal. -// Modify the triage assignee of a security signal. -func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalAssignee(ctx _context.Context, signalId string, body SecurityMonitoringSignalAssigneeUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { - req, err := a.buildEditSecurityMonitoringSignalAssigneeRequest(ctx, signalId, body) - if err != nil { - var localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse - return localVarReturnValue, nil, err - } - - return a.editSecurityMonitoringSignalAssigneeExecute(req) -} - -// editSecurityMonitoringSignalAssigneeExecute executes the request. -func (a *SecurityMonitoringApi) editSecurityMonitoringSignalAssigneeExecute(r apiEditSecurityMonitoringSignalAssigneeRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/signals/{signal_id}/assignee" - localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiEditSecurityMonitoringSignalIncidentsRequest struct { - ctx _context.Context - signalId string - body *SecurityMonitoringSignalIncidentsUpdateRequest -} - -func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalIncidentsRequest(ctx _context.Context, signalId string, body SecurityMonitoringSignalIncidentsUpdateRequest) (apiEditSecurityMonitoringSignalIncidentsRequest, error) { - req := apiEditSecurityMonitoringSignalIncidentsRequest{ - ctx: ctx, - signalId: signalId, - body: &body, - } - return req, nil -} - -// EditSecurityMonitoringSignalIncidents Change the related incidents of a security signal. -// Change the related incidents for a security signal. -func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalIncidents(ctx _context.Context, signalId string, body SecurityMonitoringSignalIncidentsUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { - req, err := a.buildEditSecurityMonitoringSignalIncidentsRequest(ctx, signalId, body) - if err != nil { - var localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse - return localVarReturnValue, nil, err - } - - return a.editSecurityMonitoringSignalIncidentsExecute(req) -} - -// editSecurityMonitoringSignalIncidentsExecute executes the request. -func (a *SecurityMonitoringApi) editSecurityMonitoringSignalIncidentsExecute(r apiEditSecurityMonitoringSignalIncidentsRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/signals/{signal_id}/incidents" - localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiEditSecurityMonitoringSignalStateRequest struct { - ctx _context.Context - signalId string - body *SecurityMonitoringSignalStateUpdateRequest -} - -func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalStateRequest(ctx _context.Context, signalId string, body SecurityMonitoringSignalStateUpdateRequest) (apiEditSecurityMonitoringSignalStateRequest, error) { - req := apiEditSecurityMonitoringSignalStateRequest{ - ctx: ctx, - signalId: signalId, - body: &body, - } - return req, nil -} - -// EditSecurityMonitoringSignalState Change the triage state of a security signal. -// Change the triage state of a security signal. -func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalState(ctx _context.Context, signalId string, body SecurityMonitoringSignalStateUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { - req, err := a.buildEditSecurityMonitoringSignalStateRequest(ctx, signalId, body) - if err != nil { - var localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse - return localVarReturnValue, nil, err - } - - return a.editSecurityMonitoringSignalStateExecute(req) -} - -// editSecurityMonitoringSignalStateExecute executes the request. -func (a *SecurityMonitoringApi) editSecurityMonitoringSignalStateExecute(r apiEditSecurityMonitoringSignalStateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.EditSecurityMonitoringSignalState") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/signals/{signal_id}/state" - localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSecurityFilterRequest struct { - ctx _context.Context - securityFilterId string -} - -func (a *SecurityMonitoringApi) buildGetSecurityFilterRequest(ctx _context.Context, securityFilterId string) (apiGetSecurityFilterRequest, error) { - req := apiGetSecurityFilterRequest{ - ctx: ctx, - securityFilterId: securityFilterId, - } - return req, nil -} - -// GetSecurityFilter Get a security filter. -// Get the details of a specific security filter. -// -// See the [security filter guide](https://docs.datadoghq.com/security_platform/guide/how-to-setup-security-filters-using-security-monitoring-api/) -// for more examples. -func (a *SecurityMonitoringApi) GetSecurityFilter(ctx _context.Context, securityFilterId string) (SecurityFilterResponse, *_nethttp.Response, error) { - req, err := a.buildGetSecurityFilterRequest(ctx, securityFilterId) - if err != nil { - var localVarReturnValue SecurityFilterResponse - return localVarReturnValue, nil, err - } - - return a.getSecurityFilterExecute(req) -} - -// getSecurityFilterExecute executes the request. -func (a *SecurityMonitoringApi) getSecurityFilterExecute(r apiGetSecurityFilterRequest) (SecurityFilterResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SecurityFilterResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.GetSecurityFilter") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}" - localVarPath = strings.Replace(localVarPath, "{"+"security_filter_id"+"}", _neturl.PathEscape(common.ParameterToString(r.securityFilterId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetSecurityMonitoringRuleRequest struct { - ctx _context.Context - ruleId string -} - -func (a *SecurityMonitoringApi) buildGetSecurityMonitoringRuleRequest(ctx _context.Context, ruleId string) (apiGetSecurityMonitoringRuleRequest, error) { - req := apiGetSecurityMonitoringRuleRequest{ - ctx: ctx, - ruleId: ruleId, - } - return req, nil -} - -// GetSecurityMonitoringRule Get a rule's details. -// Get a rule's details. -func (a *SecurityMonitoringApi) GetSecurityMonitoringRule(ctx _context.Context, ruleId string) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { - req, err := a.buildGetSecurityMonitoringRuleRequest(ctx, ruleId) - if err != nil { - var localVarReturnValue SecurityMonitoringRuleResponse - return localVarReturnValue, nil, err - } - - return a.getSecurityMonitoringRuleExecute(req) -} - -// getSecurityMonitoringRuleExecute executes the request. -func (a *SecurityMonitoringApi) getSecurityMonitoringRuleExecute(r apiGetSecurityMonitoringRuleRequest) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringRuleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.GetSecurityMonitoringRule") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/rules/{rule_id}" - localVarPath = strings.Replace(localVarPath, "{"+"rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.ruleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListSecurityFiltersRequest struct { - ctx _context.Context -} - -func (a *SecurityMonitoringApi) buildListSecurityFiltersRequest(ctx _context.Context) (apiListSecurityFiltersRequest, error) { - req := apiListSecurityFiltersRequest{ - ctx: ctx, - } - return req, nil -} - -// ListSecurityFilters Get all security filters. -// Get the list of configured security filters with their definitions. -func (a *SecurityMonitoringApi) ListSecurityFilters(ctx _context.Context) (SecurityFiltersResponse, *_nethttp.Response, error) { - req, err := a.buildListSecurityFiltersRequest(ctx) - if err != nil { - var localVarReturnValue SecurityFiltersResponse - return localVarReturnValue, nil, err - } - - return a.listSecurityFiltersExecute(req) -} - -// listSecurityFiltersExecute executes the request. -func (a *SecurityMonitoringApi) listSecurityFiltersExecute(r apiListSecurityFiltersRequest) (SecurityFiltersResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SecurityFiltersResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.ListSecurityFilters") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListSecurityMonitoringRulesRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 -} - -// ListSecurityMonitoringRulesOptionalParameters holds optional parameters for ListSecurityMonitoringRules. -type ListSecurityMonitoringRulesOptionalParameters struct { - PageSize *int64 - PageNumber *int64 -} - -// NewListSecurityMonitoringRulesOptionalParameters creates an empty struct for parameters. -func NewListSecurityMonitoringRulesOptionalParameters() *ListSecurityMonitoringRulesOptionalParameters { - this := ListSecurityMonitoringRulesOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringRulesOptionalParameters) WithPageSize(pageSize int64) *ListSecurityMonitoringRulesOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringRulesOptionalParameters) WithPageNumber(pageNumber int64) *ListSecurityMonitoringRulesOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -func (a *SecurityMonitoringApi) buildListSecurityMonitoringRulesRequest(ctx _context.Context, o ...ListSecurityMonitoringRulesOptionalParameters) (apiListSecurityMonitoringRulesRequest, error) { - req := apiListSecurityMonitoringRulesRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListSecurityMonitoringRulesOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - } - return req, nil -} - -// ListSecurityMonitoringRules List rules. -// List rules. -func (a *SecurityMonitoringApi) ListSecurityMonitoringRules(ctx _context.Context, o ...ListSecurityMonitoringRulesOptionalParameters) (SecurityMonitoringListRulesResponse, *_nethttp.Response, error) { - req, err := a.buildListSecurityMonitoringRulesRequest(ctx, o...) - if err != nil { - var localVarReturnValue SecurityMonitoringListRulesResponse - return localVarReturnValue, nil, err - } - - return a.listSecurityMonitoringRulesExecute(req) -} - -// listSecurityMonitoringRulesExecute executes the request. -func (a *SecurityMonitoringApi) listSecurityMonitoringRulesExecute(r apiListSecurityMonitoringRulesRequest) (SecurityMonitoringListRulesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringListRulesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.ListSecurityMonitoringRules") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/rules" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListSecurityMonitoringSignalsRequest struct { - ctx _context.Context - filterQuery *string - filterFrom *time.Time - filterTo *time.Time - sort *SecurityMonitoringSignalsSort - pageCursor *string - pageLimit *int32 -} - -// ListSecurityMonitoringSignalsOptionalParameters holds optional parameters for ListSecurityMonitoringSignals. -type ListSecurityMonitoringSignalsOptionalParameters struct { - FilterQuery *string - FilterFrom *time.Time - FilterTo *time.Time - Sort *SecurityMonitoringSignalsSort - PageCursor *string - PageLimit *int32 -} - -// NewListSecurityMonitoringSignalsOptionalParameters creates an empty struct for parameters. -func NewListSecurityMonitoringSignalsOptionalParameters() *ListSecurityMonitoringSignalsOptionalParameters { - this := ListSecurityMonitoringSignalsOptionalParameters{} - return &this -} - -// WithFilterQuery sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringSignalsOptionalParameters) WithFilterQuery(filterQuery string) *ListSecurityMonitoringSignalsOptionalParameters { - r.FilterQuery = &filterQuery - return r -} - -// WithFilterFrom sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringSignalsOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListSecurityMonitoringSignalsOptionalParameters { - r.FilterFrom = &filterFrom - return r -} - -// WithFilterTo sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringSignalsOptionalParameters) WithFilterTo(filterTo time.Time) *ListSecurityMonitoringSignalsOptionalParameters { - r.FilterTo = &filterTo - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringSignalsOptionalParameters) WithSort(sort SecurityMonitoringSignalsSort) *ListSecurityMonitoringSignalsOptionalParameters { - r.Sort = &sort - return r -} - -// WithPageCursor sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringSignalsOptionalParameters) WithPageCursor(pageCursor string) *ListSecurityMonitoringSignalsOptionalParameters { - r.PageCursor = &pageCursor - return r -} - -// WithPageLimit sets the corresponding parameter name and returns the struct. -func (r *ListSecurityMonitoringSignalsOptionalParameters) WithPageLimit(pageLimit int32) *ListSecurityMonitoringSignalsOptionalParameters { - r.PageLimit = &pageLimit - return r -} - -func (a *SecurityMonitoringApi) buildListSecurityMonitoringSignalsRequest(ctx _context.Context, o ...ListSecurityMonitoringSignalsOptionalParameters) (apiListSecurityMonitoringSignalsRequest, error) { - req := apiListSecurityMonitoringSignalsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListSecurityMonitoringSignalsOptionalParameters is allowed") - } - - if o != nil { - req.filterQuery = o[0].FilterQuery - req.filterFrom = o[0].FilterFrom - req.filterTo = o[0].FilterTo - req.sort = o[0].Sort - req.pageCursor = o[0].PageCursor - req.pageLimit = o[0].PageLimit - } - return req, nil -} - -// ListSecurityMonitoringSignals Get a quick list of security signals. -// The list endpoint returns security signals that match a search query. -// Both this endpoint and the POST endpoint can be used interchangeably when listing -// security signals. -func (a *SecurityMonitoringApi) ListSecurityMonitoringSignals(ctx _context.Context, o ...ListSecurityMonitoringSignalsOptionalParameters) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { - req, err := a.buildListSecurityMonitoringSignalsRequest(ctx, o...) - if err != nil { - var localVarReturnValue SecurityMonitoringSignalsListResponse - return localVarReturnValue, nil, err - } - - return a.listSecurityMonitoringSignalsExecute(req) -} - -// ListSecurityMonitoringSignalsWithPagination provides a paginated version of ListSecurityMonitoringSignals returning a channel with all items. -func (a *SecurityMonitoringApi) ListSecurityMonitoringSignalsWithPagination(ctx _context.Context, o ...ListSecurityMonitoringSignalsOptionalParameters) (<-chan SecurityMonitoringSignal, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, ListSecurityMonitoringSignalsOptionalParameters{}) - } - if o[0].PageLimit != nil { - pageSize_ = *o[0].PageLimit - } - o[0].PageLimit = &pageSize_ - - items := make(chan SecurityMonitoringSignal, pageSize_) - go func() { - for { - req, err := a.buildListSecurityMonitoringSignalsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.listSecurityMonitoringSignalsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].PageCursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// listSecurityMonitoringSignalsExecute executes the request. -func (a *SecurityMonitoringApi) listSecurityMonitoringSignalsExecute(r apiListSecurityMonitoringSignalsRequest) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringSignalsListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.ListSecurityMonitoringSignals") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/signals" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterQuery != nil { - localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) - } - if r.filterFrom != nil { - localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) - } - if r.filterTo != nil { - localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.pageCursor != nil { - localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) - } - if r.pageLimit != nil { - localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSearchSecurityMonitoringSignalsRequest struct { - ctx _context.Context - body *SecurityMonitoringSignalListRequest -} - -// SearchSecurityMonitoringSignalsOptionalParameters holds optional parameters for SearchSecurityMonitoringSignals. -type SearchSecurityMonitoringSignalsOptionalParameters struct { - Body *SecurityMonitoringSignalListRequest -} - -// NewSearchSecurityMonitoringSignalsOptionalParameters creates an empty struct for parameters. -func NewSearchSecurityMonitoringSignalsOptionalParameters() *SearchSecurityMonitoringSignalsOptionalParameters { - this := SearchSecurityMonitoringSignalsOptionalParameters{} - return &this -} - -// WithBody sets the corresponding parameter name and returns the struct. -func (r *SearchSecurityMonitoringSignalsOptionalParameters) WithBody(body SecurityMonitoringSignalListRequest) *SearchSecurityMonitoringSignalsOptionalParameters { - r.Body = &body - return r -} - -func (a *SecurityMonitoringApi) buildSearchSecurityMonitoringSignalsRequest(ctx _context.Context, o ...SearchSecurityMonitoringSignalsOptionalParameters) (apiSearchSecurityMonitoringSignalsRequest, error) { - req := apiSearchSecurityMonitoringSignalsRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type SearchSecurityMonitoringSignalsOptionalParameters is allowed") - } - - if o != nil { - req.body = o[0].Body - } - return req, nil -} - -// SearchSecurityMonitoringSignals Get a list of security signals. -// Returns security signals that match a search query. -// Both this endpoint and the GET endpoint can be used interchangeably for listing -// security signals. -func (a *SecurityMonitoringApi) SearchSecurityMonitoringSignals(ctx _context.Context, o ...SearchSecurityMonitoringSignalsOptionalParameters) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { - req, err := a.buildSearchSecurityMonitoringSignalsRequest(ctx, o...) - if err != nil { - var localVarReturnValue SecurityMonitoringSignalsListResponse - return localVarReturnValue, nil, err - } - - return a.searchSecurityMonitoringSignalsExecute(req) -} - -// SearchSecurityMonitoringSignalsWithPagination provides a paginated version of SearchSecurityMonitoringSignals returning a channel with all items. -func (a *SecurityMonitoringApi) SearchSecurityMonitoringSignalsWithPagination(ctx _context.Context, o ...SearchSecurityMonitoringSignalsOptionalParameters) (<-chan SecurityMonitoringSignal, func(), error) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int32(10) - if len(o) == 0 { - o = append(o, SearchSecurityMonitoringSignalsOptionalParameters{}) - } - if o[0].Body == nil { - o[0].Body = NewSecurityMonitoringSignalListRequest() - } - if o[0].Body.Page == nil { - o[0].Body.Page = NewSecurityMonitoringSignalListRequestPage() - } - if o[0].Body.Page.Limit != nil { - pageSize_ = *o[0].Body.Page.Limit - } - o[0].Body.Page.Limit = &pageSize_ - - items := make(chan SecurityMonitoringSignal, pageSize_) - go func() { - for { - req, err := a.buildSearchSecurityMonitoringSignalsRequest(ctx, o...) - if err != nil { - break - } - - resp, _, err := a.searchSecurityMonitoringSignalsExecute(req) - if err != nil { - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- item: - case <-ctx.Done(): - close(items) - return - } - } - if len(results) < int(pageSize_) { - break - } - cursorMeta, ok := resp.GetMetaOk() - if !ok { - break - } - cursorMetaPage, ok := cursorMeta.GetPageOk() - if !ok { - break - } - cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() - if !ok { - break - } - - o[0].Body.Page.Cursor = cursorMetaPageAfter - } - close(items) - }() - return items, cancel, nil -} - -// searchSecurityMonitoringSignalsExecute executes the request. -func (a *SecurityMonitoringApi) searchSecurityMonitoringSignalsExecute(r apiSearchSecurityMonitoringSignalsRequest) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringSignalsListResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.SearchSecurityMonitoringSignals") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/signals/search" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateSecurityFilterRequest struct { - ctx _context.Context - securityFilterId string - body *SecurityFilterUpdateRequest -} - -func (a *SecurityMonitoringApi) buildUpdateSecurityFilterRequest(ctx _context.Context, securityFilterId string, body SecurityFilterUpdateRequest) (apiUpdateSecurityFilterRequest, error) { - req := apiUpdateSecurityFilterRequest{ - ctx: ctx, - securityFilterId: securityFilterId, - body: &body, - } - return req, nil -} - -// UpdateSecurityFilter Update a security filter. -// Update a specific security filter. -// Returns the security filter object when the request is successful. -func (a *SecurityMonitoringApi) UpdateSecurityFilter(ctx _context.Context, securityFilterId string, body SecurityFilterUpdateRequest) (SecurityFilterResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateSecurityFilterRequest(ctx, securityFilterId, body) - if err != nil { - var localVarReturnValue SecurityFilterResponse - return localVarReturnValue, nil, err - } - - return a.updateSecurityFilterExecute(req) -} - -// updateSecurityFilterExecute executes the request. -func (a *SecurityMonitoringApi) updateSecurityFilterExecute(r apiUpdateSecurityFilterRequest) (SecurityFilterResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue SecurityFilterResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.UpdateSecurityFilter") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}" - localVarPath = strings.Replace(localVarPath, "{"+"security_filter_id"+"}", _neturl.PathEscape(common.ParameterToString(r.securityFilterId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 409 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateSecurityMonitoringRuleRequest struct { - ctx _context.Context - ruleId string - body *SecurityMonitoringRuleUpdatePayload -} - -func (a *SecurityMonitoringApi) buildUpdateSecurityMonitoringRuleRequest(ctx _context.Context, ruleId string, body SecurityMonitoringRuleUpdatePayload) (apiUpdateSecurityMonitoringRuleRequest, error) { - req := apiUpdateSecurityMonitoringRuleRequest{ - ctx: ctx, - ruleId: ruleId, - body: &body, - } - return req, nil -} - -// UpdateSecurityMonitoringRule Update an existing rule. -// Update an existing rule. When updating `cases`, `queries` or `options`, the whole field -// must be included. For example, when modifying a query all queries must be included. -// Default rules can only be updated to be enabled and to change notifications. -func (a *SecurityMonitoringApi) UpdateSecurityMonitoringRule(ctx _context.Context, ruleId string, body SecurityMonitoringRuleUpdatePayload) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateSecurityMonitoringRuleRequest(ctx, ruleId, body) - if err != nil { - var localVarReturnValue SecurityMonitoringRuleResponse - return localVarReturnValue, nil, err - } - - return a.updateSecurityMonitoringRuleExecute(req) -} - -// updateSecurityMonitoringRuleExecute executes the request. -func (a *SecurityMonitoringApi) updateSecurityMonitoringRuleExecute(r apiUpdateSecurityMonitoringRuleRequest) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPut - localVarPostBody interface{} - localVarReturnValue SecurityMonitoringRuleResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.UpdateSecurityMonitoringRule") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/security_monitoring/rules/{rule_id}" - localVarPath = strings.Replace(localVarPath, "{"+"rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.ruleId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 401 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewSecurityMonitoringApi Returns NewSecurityMonitoringApi. -func NewSecurityMonitoringApi(client *common.APIClient) *SecurityMonitoringApi { - return &SecurityMonitoringApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_service_accounts.go b/api/v2/datadog/api_service_accounts.go deleted file mode 100644 index 3ba741a5041..00000000000 --- a/api/v2/datadog/api_service_accounts.go +++ /dev/null @@ -1,832 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// ServiceAccountsApi service type -type ServiceAccountsApi common.Service - -type apiCreateServiceAccountApplicationKeyRequest struct { - ctx _context.Context - serviceAccountId string - body *ApplicationKeyCreateRequest -} - -func (a *ServiceAccountsApi) buildCreateServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, body ApplicationKeyCreateRequest) (apiCreateServiceAccountApplicationKeyRequest, error) { - req := apiCreateServiceAccountApplicationKeyRequest{ - ctx: ctx, - serviceAccountId: serviceAccountId, - body: &body, - } - return req, nil -} - -// CreateServiceAccountApplicationKey Create an application key for this service account. -// Create an application key for this service account. -func (a *ServiceAccountsApi) CreateServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, body ApplicationKeyCreateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildCreateServiceAccountApplicationKeyRequest(ctx, serviceAccountId, body) - if err != nil { - var localVarReturnValue ApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.createServiceAccountApplicationKeyExecute(req) -} - -// createServiceAccountApplicationKeyExecute executes the request. -func (a *ServiceAccountsApi) createServiceAccountApplicationKeyExecute(r apiCreateServiceAccountApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue ApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.CreateServiceAccountApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys" - localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDeleteServiceAccountApplicationKeyRequest struct { - ctx _context.Context - serviceAccountId string - appKeyId string -} - -func (a *ServiceAccountsApi) buildDeleteServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, appKeyId string) (apiDeleteServiceAccountApplicationKeyRequest, error) { - req := apiDeleteServiceAccountApplicationKeyRequest{ - ctx: ctx, - serviceAccountId: serviceAccountId, - appKeyId: appKeyId, - } - return req, nil -} - -// DeleteServiceAccountApplicationKey Delete an application key for this service account. -// Delete an application key owned by this service account. -func (a *ServiceAccountsApi) DeleteServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, appKeyId string) (*_nethttp.Response, error) { - req, err := a.buildDeleteServiceAccountApplicationKeyRequest(ctx, serviceAccountId, appKeyId) - if err != nil { - return nil, err - } - - return a.deleteServiceAccountApplicationKeyExecute(req) -} - -// deleteServiceAccountApplicationKeyExecute executes the request. -func (a *ServiceAccountsApi) deleteServiceAccountApplicationKeyExecute(r apiDeleteServiceAccountApplicationKeyRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.DeleteServiceAccountApplicationKey") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetServiceAccountApplicationKeyRequest struct { - ctx _context.Context - serviceAccountId string - appKeyId string -} - -func (a *ServiceAccountsApi) buildGetServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, appKeyId string) (apiGetServiceAccountApplicationKeyRequest, error) { - req := apiGetServiceAccountApplicationKeyRequest{ - ctx: ctx, - serviceAccountId: serviceAccountId, - appKeyId: appKeyId, - } - return req, nil -} - -// GetServiceAccountApplicationKey Get one application key for this service account. -// Get an application key owned by this service account. -func (a *ServiceAccountsApi) GetServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, appKeyId string) (PartialApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildGetServiceAccountApplicationKeyRequest(ctx, serviceAccountId, appKeyId) - if err != nil { - var localVarReturnValue PartialApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.getServiceAccountApplicationKeyExecute(req) -} - -// getServiceAccountApplicationKeyExecute executes the request. -func (a *ServiceAccountsApi) getServiceAccountApplicationKeyExecute(r apiGetServiceAccountApplicationKeyRequest) (PartialApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue PartialApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.GetServiceAccountApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListServiceAccountApplicationKeysRequest struct { - ctx _context.Context - serviceAccountId string - pageSize *int64 - pageNumber *int64 - sort *ApplicationKeysSort - filter *string - filterCreatedAtStart *string - filterCreatedAtEnd *string -} - -// ListServiceAccountApplicationKeysOptionalParameters holds optional parameters for ListServiceAccountApplicationKeys. -type ListServiceAccountApplicationKeysOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *ApplicationKeysSort - Filter *string - FilterCreatedAtStart *string - FilterCreatedAtEnd *string -} - -// NewListServiceAccountApplicationKeysOptionalParameters creates an empty struct for parameters. -func NewListServiceAccountApplicationKeysOptionalParameters() *ListServiceAccountApplicationKeysOptionalParameters { - this := ListServiceAccountApplicationKeysOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListServiceAccountApplicationKeysOptionalParameters) WithPageSize(pageSize int64) *ListServiceAccountApplicationKeysOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListServiceAccountApplicationKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListServiceAccountApplicationKeysOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListServiceAccountApplicationKeysOptionalParameters) WithSort(sort ApplicationKeysSort) *ListServiceAccountApplicationKeysOptionalParameters { - r.Sort = &sort - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListServiceAccountApplicationKeysOptionalParameters) WithFilter(filter string) *ListServiceAccountApplicationKeysOptionalParameters { - r.Filter = &filter - return r -} - -// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. -func (r *ListServiceAccountApplicationKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListServiceAccountApplicationKeysOptionalParameters { - r.FilterCreatedAtStart = &filterCreatedAtStart - return r -} - -// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. -func (r *ListServiceAccountApplicationKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListServiceAccountApplicationKeysOptionalParameters { - r.FilterCreatedAtEnd = &filterCreatedAtEnd - return r -} - -func (a *ServiceAccountsApi) buildListServiceAccountApplicationKeysRequest(ctx _context.Context, serviceAccountId string, o ...ListServiceAccountApplicationKeysOptionalParameters) (apiListServiceAccountApplicationKeysRequest, error) { - req := apiListServiceAccountApplicationKeysRequest{ - ctx: ctx, - serviceAccountId: serviceAccountId, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListServiceAccountApplicationKeysOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.filter = o[0].Filter - req.filterCreatedAtStart = o[0].FilterCreatedAtStart - req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd - } - return req, nil -} - -// ListServiceAccountApplicationKeys List application keys for this service account. -// List all application keys available for this service account. -func (a *ServiceAccountsApi) ListServiceAccountApplicationKeys(ctx _context.Context, serviceAccountId string, o ...ListServiceAccountApplicationKeysOptionalParameters) (ListApplicationKeysResponse, *_nethttp.Response, error) { - req, err := a.buildListServiceAccountApplicationKeysRequest(ctx, serviceAccountId, o...) - if err != nil { - var localVarReturnValue ListApplicationKeysResponse - return localVarReturnValue, nil, err - } - - return a.listServiceAccountApplicationKeysExecute(req) -} - -// listServiceAccountApplicationKeysExecute executes the request. -func (a *ServiceAccountsApi) listServiceAccountApplicationKeysExecute(r apiListServiceAccountApplicationKeysRequest) (ListApplicationKeysResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue ListApplicationKeysResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.ListServiceAccountApplicationKeys") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys" - localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - if r.filterCreatedAtStart != nil { - localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) - } - if r.filterCreatedAtEnd != nil { - localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateServiceAccountApplicationKeyRequest struct { - ctx _context.Context - serviceAccountId string - appKeyId string - body *ApplicationKeyUpdateRequest -} - -func (a *ServiceAccountsApi) buildUpdateServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, appKeyId string, body ApplicationKeyUpdateRequest) (apiUpdateServiceAccountApplicationKeyRequest, error) { - req := apiUpdateServiceAccountApplicationKeyRequest{ - ctx: ctx, - serviceAccountId: serviceAccountId, - appKeyId: appKeyId, - body: &body, - } - return req, nil -} - -// UpdateServiceAccountApplicationKey Edit an application key for this service account. -// Edit an application key owned by this service account. -func (a *ServiceAccountsApi) UpdateServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, appKeyId string, body ApplicationKeyUpdateRequest) (PartialApplicationKeyResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateServiceAccountApplicationKeyRequest(ctx, serviceAccountId, appKeyId, body) - if err != nil { - var localVarReturnValue PartialApplicationKeyResponse - return localVarReturnValue, nil, err - } - - return a.updateServiceAccountApplicationKeyExecute(req) -} - -// updateServiceAccountApplicationKeyExecute executes the request. -func (a *ServiceAccountsApi) updateServiceAccountApplicationKeyExecute(r apiUpdateServiceAccountApplicationKeyRequest) (PartialApplicationKeyResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue PartialApplicationKeyResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.UpdateServiceAccountApplicationKey") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" - localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewServiceAccountsApi Returns NewServiceAccountsApi. -func NewServiceAccountsApi(client *common.APIClient) *ServiceAccountsApi { - return &ServiceAccountsApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_usage_metering.go b/api/v2/datadog/api_usage_metering.go deleted file mode 100644 index 84be8da2560..00000000000 --- a/api/v2/datadog/api_usage_metering.go +++ /dev/null @@ -1,1143 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _fmt "fmt" - _ioutil "io/ioutil" - _log "log" - _nethttp "net/http" - _neturl "net/url" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsageMeteringApi service type -type UsageMeteringApi common.Service - -type apiGetCostByOrgRequest struct { - ctx _context.Context - startMonth *time.Time - endMonth *time.Time -} - -// GetCostByOrgOptionalParameters holds optional parameters for GetCostByOrg. -type GetCostByOrgOptionalParameters struct { - EndMonth *time.Time -} - -// NewGetCostByOrgOptionalParameters creates an empty struct for parameters. -func NewGetCostByOrgOptionalParameters() *GetCostByOrgOptionalParameters { - this := GetCostByOrgOptionalParameters{} - return &this -} - -// WithEndMonth sets the corresponding parameter name and returns the struct. -func (r *GetCostByOrgOptionalParameters) WithEndMonth(endMonth time.Time) *GetCostByOrgOptionalParameters { - r.EndMonth = &endMonth - return r -} - -func (a *UsageMeteringApi) buildGetCostByOrgRequest(ctx _context.Context, startMonth time.Time, o ...GetCostByOrgOptionalParameters) (apiGetCostByOrgRequest, error) { - req := apiGetCostByOrgRequest{ - ctx: ctx, - startMonth: &startMonth, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetCostByOrgOptionalParameters is allowed") - } - - if o != nil { - req.endMonth = o[0].EndMonth - } - return req, nil -} - -// GetCostByOrg Get cost across multi-org account. -// Get cost across multi-org account. Cost by org data for a given month becomes available no later than the 16th of the following month. -func (a *UsageMeteringApi) GetCostByOrg(ctx _context.Context, startMonth time.Time, o ...GetCostByOrgOptionalParameters) (CostByOrgResponse, *_nethttp.Response, error) { - req, err := a.buildGetCostByOrgRequest(ctx, startMonth, o...) - if err != nil { - var localVarReturnValue CostByOrgResponse - return localVarReturnValue, nil, err - } - - return a.getCostByOrgExecute(req) -} - -// getCostByOrgExecute executes the request. -func (a *UsageMeteringApi) getCostByOrgExecute(r apiGetCostByOrgRequest) (CostByOrgResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue CostByOrgResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetCostByOrg") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/usage/cost_by_org" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startMonth == nil { - return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") - } - localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) - if r.endMonth != nil { - localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetEstimatedCostByOrgRequest struct { - ctx _context.Context - view *string - startMonth *time.Time - endMonth *time.Time - startDate *time.Time - endDate *time.Time -} - -// GetEstimatedCostByOrgOptionalParameters holds optional parameters for GetEstimatedCostByOrg. -type GetEstimatedCostByOrgOptionalParameters struct { - StartMonth *time.Time - EndMonth *time.Time - StartDate *time.Time - EndDate *time.Time -} - -// NewGetEstimatedCostByOrgOptionalParameters creates an empty struct for parameters. -func NewGetEstimatedCostByOrgOptionalParameters() *GetEstimatedCostByOrgOptionalParameters { - this := GetEstimatedCostByOrgOptionalParameters{} - return &this -} - -// WithStartMonth sets the corresponding parameter name and returns the struct. -func (r *GetEstimatedCostByOrgOptionalParameters) WithStartMonth(startMonth time.Time) *GetEstimatedCostByOrgOptionalParameters { - r.StartMonth = &startMonth - return r -} - -// WithEndMonth sets the corresponding parameter name and returns the struct. -func (r *GetEstimatedCostByOrgOptionalParameters) WithEndMonth(endMonth time.Time) *GetEstimatedCostByOrgOptionalParameters { - r.EndMonth = &endMonth - return r -} - -// WithStartDate sets the corresponding parameter name and returns the struct. -func (r *GetEstimatedCostByOrgOptionalParameters) WithStartDate(startDate time.Time) *GetEstimatedCostByOrgOptionalParameters { - r.StartDate = &startDate - return r -} - -// WithEndDate sets the corresponding parameter name and returns the struct. -func (r *GetEstimatedCostByOrgOptionalParameters) WithEndDate(endDate time.Time) *GetEstimatedCostByOrgOptionalParameters { - r.EndDate = &endDate - return r -} - -func (a *UsageMeteringApi) buildGetEstimatedCostByOrgRequest(ctx _context.Context, view string, o ...GetEstimatedCostByOrgOptionalParameters) (apiGetEstimatedCostByOrgRequest, error) { - req := apiGetEstimatedCostByOrgRequest{ - ctx: ctx, - view: &view, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetEstimatedCostByOrgOptionalParameters is allowed") - } - - if o != nil { - req.startMonth = o[0].StartMonth - req.endMonth = o[0].EndMonth - req.startDate = o[0].StartDate - req.endDate = o[0].EndDate - } - return req, nil -} - -// GetEstimatedCostByOrg Get estimated cost across your account. -// Get estimated cost across multi-org and single root-org accounts. -// Estimated cost data is only available for the current month and previous month. To access historical costs prior to this, use the /cost_by_org endpoint. -func (a *UsageMeteringApi) GetEstimatedCostByOrg(ctx _context.Context, view string, o ...GetEstimatedCostByOrgOptionalParameters) (CostByOrgResponse, *_nethttp.Response, error) { - req, err := a.buildGetEstimatedCostByOrgRequest(ctx, view, o...) - if err != nil { - var localVarReturnValue CostByOrgResponse - return localVarReturnValue, nil, err - } - - return a.getEstimatedCostByOrgExecute(req) -} - -// getEstimatedCostByOrgExecute executes the request. -func (a *UsageMeteringApi) getEstimatedCostByOrgExecute(r apiGetEstimatedCostByOrgRequest) (CostByOrgResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue CostByOrgResponse - ) - - operationId := "v2.GetEstimatedCostByOrg" - if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } else { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetEstimatedCostByOrg") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/usage/estimated_cost" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.view == nil { - return localVarReturnValue, nil, common.ReportError("view is required and must be specified") - } - localVarQueryParams.Add("view", common.ParameterToString(*r.view, "")) - if r.startMonth != nil { - localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) - } - if r.endMonth != nil { - localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) - } - if r.startDate != nil { - localVarQueryParams.Add("start_date", common.ParameterToString(*r.startDate, "")) - } - if r.endDate != nil { - localVarQueryParams.Add("end_date", common.ParameterToString(*r.endDate, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetHourlyUsageRequest struct { - ctx _context.Context - filterTimestampStart *time.Time - filterProductFamilies *string - filterTimestampEnd *time.Time - filterIncludeDescendants *bool - filterVersions *string - pageLimit *int32 - pageNextRecordId *string -} - -// GetHourlyUsageOptionalParameters holds optional parameters for GetHourlyUsage. -type GetHourlyUsageOptionalParameters struct { - FilterTimestampEnd *time.Time - FilterIncludeDescendants *bool - FilterVersions *string - PageLimit *int32 - PageNextRecordId *string -} - -// NewGetHourlyUsageOptionalParameters creates an empty struct for parameters. -func NewGetHourlyUsageOptionalParameters() *GetHourlyUsageOptionalParameters { - this := GetHourlyUsageOptionalParameters{} - return &this -} - -// WithFilterTimestampEnd sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageOptionalParameters) WithFilterTimestampEnd(filterTimestampEnd time.Time) *GetHourlyUsageOptionalParameters { - r.FilterTimestampEnd = &filterTimestampEnd - return r -} - -// WithFilterIncludeDescendants sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageOptionalParameters) WithFilterIncludeDescendants(filterIncludeDescendants bool) *GetHourlyUsageOptionalParameters { - r.FilterIncludeDescendants = &filterIncludeDescendants - return r -} - -// WithFilterVersions sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageOptionalParameters) WithFilterVersions(filterVersions string) *GetHourlyUsageOptionalParameters { - r.FilterVersions = &filterVersions - return r -} - -// WithPageLimit sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageOptionalParameters) WithPageLimit(pageLimit int32) *GetHourlyUsageOptionalParameters { - r.PageLimit = &pageLimit - return r -} - -// WithPageNextRecordId sets the corresponding parameter name and returns the struct. -func (r *GetHourlyUsageOptionalParameters) WithPageNextRecordId(pageNextRecordId string) *GetHourlyUsageOptionalParameters { - r.PageNextRecordId = &pageNextRecordId - return r -} - -func (a *UsageMeteringApi) buildGetHourlyUsageRequest(ctx _context.Context, filterTimestampStart time.Time, filterProductFamilies string, o ...GetHourlyUsageOptionalParameters) (apiGetHourlyUsageRequest, error) { - req := apiGetHourlyUsageRequest{ - ctx: ctx, - filterTimestampStart: &filterTimestampStart, - filterProductFamilies: &filterProductFamilies, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetHourlyUsageOptionalParameters is allowed") - } - - if o != nil { - req.filterTimestampEnd = o[0].FilterTimestampEnd - req.filterIncludeDescendants = o[0].FilterIncludeDescendants - req.filterVersions = o[0].FilterVersions - req.pageLimit = o[0].PageLimit - req.pageNextRecordId = o[0].PageNextRecordId - } - return req, nil -} - -// GetHourlyUsage Get hourly usage by product family. -// Get hourly usage by product family -func (a *UsageMeteringApi) GetHourlyUsage(ctx _context.Context, filterTimestampStart time.Time, filterProductFamilies string, o ...GetHourlyUsageOptionalParameters) (HourlyUsageResponse, *_nethttp.Response, error) { - req, err := a.buildGetHourlyUsageRequest(ctx, filterTimestampStart, filterProductFamilies, o...) - if err != nil { - var localVarReturnValue HourlyUsageResponse - return localVarReturnValue, nil, err - } - - return a.getHourlyUsageExecute(req) -} - -// getHourlyUsageExecute executes the request. -func (a *UsageMeteringApi) getHourlyUsageExecute(r apiGetHourlyUsageRequest) (HourlyUsageResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue HourlyUsageResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetHourlyUsage") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/usage/hourly_usage" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.filterTimestampStart == nil { - return localVarReturnValue, nil, common.ReportError("filterTimestampStart is required and must be specified") - } - if r.filterProductFamilies == nil { - return localVarReturnValue, nil, common.ReportError("filterProductFamilies is required and must be specified") - } - localVarQueryParams.Add("filter[timestamp][start]", common.ParameterToString(*r.filterTimestampStart, "")) - localVarQueryParams.Add("filter[product_families]", common.ParameterToString(*r.filterProductFamilies, "")) - if r.filterTimestampEnd != nil { - localVarQueryParams.Add("filter[timestamp][end]", common.ParameterToString(*r.filterTimestampEnd, "")) - } - if r.filterIncludeDescendants != nil { - localVarQueryParams.Add("filter[include_descendants]", common.ParameterToString(*r.filterIncludeDescendants, "")) - } - if r.filterVersions != nil { - localVarQueryParams.Add("filter[versions]", common.ParameterToString(*r.filterVersions, "")) - } - if r.pageLimit != nil { - localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) - } - if r.pageNextRecordId != nil { - localVarQueryParams.Add("page[next_record_id]", common.ParameterToString(*r.pageNextRecordId, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageApplicationSecurityMonitoringRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageApplicationSecurityMonitoringOptionalParameters holds optional parameters for GetUsageApplicationSecurityMonitoring. -type GetUsageApplicationSecurityMonitoringOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageApplicationSecurityMonitoringOptionalParameters creates an empty struct for parameters. -func NewGetUsageApplicationSecurityMonitoringOptionalParameters() *GetUsageApplicationSecurityMonitoringOptionalParameters { - this := GetUsageApplicationSecurityMonitoringOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageApplicationSecurityMonitoringOptionalParameters) WithEndHr(endHr time.Time) *GetUsageApplicationSecurityMonitoringOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageApplicationSecurityMonitoringRequest(ctx _context.Context, startHr time.Time, o ...GetUsageApplicationSecurityMonitoringOptionalParameters) (apiGetUsageApplicationSecurityMonitoringRequest, error) { - req := apiGetUsageApplicationSecurityMonitoringRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageApplicationSecurityMonitoringOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageApplicationSecurityMonitoring Get hourly usage for application security. -// Get hourly usage for application security . -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family) -func (a *UsageMeteringApi) GetUsageApplicationSecurityMonitoring(ctx _context.Context, startHr time.Time, o ...GetUsageApplicationSecurityMonitoringOptionalParameters) (UsageApplicationSecurityMonitoringResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageApplicationSecurityMonitoringRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageApplicationSecurityMonitoringResponse - return localVarReturnValue, nil, err - } - - return a.getUsageApplicationSecurityMonitoringExecute(req) -} - -// getUsageApplicationSecurityMonitoringExecute executes the request. -func (a *UsageMeteringApi) getUsageApplicationSecurityMonitoringExecute(r apiGetUsageApplicationSecurityMonitoringRequest) (UsageApplicationSecurityMonitoringResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageApplicationSecurityMonitoringResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetUsageApplicationSecurityMonitoring") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/usage/application_security" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageLambdaTracedInvocationsRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageLambdaTracedInvocationsOptionalParameters holds optional parameters for GetUsageLambdaTracedInvocations. -type GetUsageLambdaTracedInvocationsOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageLambdaTracedInvocationsOptionalParameters creates an empty struct for parameters. -func NewGetUsageLambdaTracedInvocationsOptionalParameters() *GetUsageLambdaTracedInvocationsOptionalParameters { - this := GetUsageLambdaTracedInvocationsOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageLambdaTracedInvocationsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLambdaTracedInvocationsOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageLambdaTracedInvocationsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaTracedInvocationsOptionalParameters) (apiGetUsageLambdaTracedInvocationsRequest, error) { - req := apiGetUsageLambdaTracedInvocationsRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageLambdaTracedInvocationsOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageLambdaTracedInvocations Get hourly usage for lambda traced invocations. -// Get hourly usage for lambda traced invocations. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family) -func (a *UsageMeteringApi) GetUsageLambdaTracedInvocations(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaTracedInvocationsOptionalParameters) (UsageLambdaTracedInvocationsResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageLambdaTracedInvocationsRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageLambdaTracedInvocationsResponse - return localVarReturnValue, nil, err - } - - return a.getUsageLambdaTracedInvocationsExecute(req) -} - -// getUsageLambdaTracedInvocationsExecute executes the request. -func (a *UsageMeteringApi) getUsageLambdaTracedInvocationsExecute(r apiGetUsageLambdaTracedInvocationsRequest) (UsageLambdaTracedInvocationsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageLambdaTracedInvocationsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetUsageLambdaTracedInvocations") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/usage/lambda_traced_invocations" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUsageObservabilityPipelinesRequest struct { - ctx _context.Context - startHr *time.Time - endHr *time.Time -} - -// GetUsageObservabilityPipelinesOptionalParameters holds optional parameters for GetUsageObservabilityPipelines. -type GetUsageObservabilityPipelinesOptionalParameters struct { - EndHr *time.Time -} - -// NewGetUsageObservabilityPipelinesOptionalParameters creates an empty struct for parameters. -func NewGetUsageObservabilityPipelinesOptionalParameters() *GetUsageObservabilityPipelinesOptionalParameters { - this := GetUsageObservabilityPipelinesOptionalParameters{} - return &this -} - -// WithEndHr sets the corresponding parameter name and returns the struct. -func (r *GetUsageObservabilityPipelinesOptionalParameters) WithEndHr(endHr time.Time) *GetUsageObservabilityPipelinesOptionalParameters { - r.EndHr = &endHr - return r -} - -func (a *UsageMeteringApi) buildGetUsageObservabilityPipelinesRequest(ctx _context.Context, startHr time.Time, o ...GetUsageObservabilityPipelinesOptionalParameters) (apiGetUsageObservabilityPipelinesRequest, error) { - req := apiGetUsageObservabilityPipelinesRequest{ - ctx: ctx, - startHr: &startHr, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type GetUsageObservabilityPipelinesOptionalParameters is allowed") - } - - if o != nil { - req.endHr = o[0].EndHr - } - return req, nil -} - -// GetUsageObservabilityPipelines Get hourly usage for observability pipelines. -// Get hourly usage for observability pipelines. -// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family) -func (a *UsageMeteringApi) GetUsageObservabilityPipelines(ctx _context.Context, startHr time.Time, o ...GetUsageObservabilityPipelinesOptionalParameters) (UsageObservabilityPipelinesResponse, *_nethttp.Response, error) { - req, err := a.buildGetUsageObservabilityPipelinesRequest(ctx, startHr, o...) - if err != nil { - var localVarReturnValue UsageObservabilityPipelinesResponse - return localVarReturnValue, nil, err - } - - return a.getUsageObservabilityPipelinesExecute(req) -} - -// getUsageObservabilityPipelinesExecute executes the request. -func (a *UsageMeteringApi) getUsageObservabilityPipelinesExecute(r apiGetUsageObservabilityPipelinesRequest) (UsageObservabilityPipelinesResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsageObservabilityPipelinesResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetUsageObservabilityPipelines") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/usage/observability_pipelines" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.startHr == nil { - return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") - } - localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) - if r.endHr != nil { - localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) - } - localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewUsageMeteringApi Returns NewUsageMeteringApi. -func NewUsageMeteringApi(client *common.APIClient) *UsageMeteringApi { - return &UsageMeteringApi{ - Client: client, - } -} diff --git a/api/v2/datadog/api_users.go b/api/v2/datadog/api_users.go deleted file mode 100644 index 15fd1c4f7ee..00000000000 --- a/api/v2/datadog/api_users.go +++ /dev/null @@ -1,1517 +0,0 @@ -// 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 datadog - -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" - "strings" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsersApi service type -type UsersApi common.Service - -type apiCreateServiceAccountRequest struct { - ctx _context.Context - body *ServiceAccountCreateRequest -} - -func (a *UsersApi) buildCreateServiceAccountRequest(ctx _context.Context, body ServiceAccountCreateRequest) (apiCreateServiceAccountRequest, error) { - req := apiCreateServiceAccountRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateServiceAccount Create a service account. -// Create a service account for your organization. -func (a *UsersApi) CreateServiceAccount(ctx _context.Context, body ServiceAccountCreateRequest) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildCreateServiceAccountRequest(ctx, body) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.createServiceAccountExecute(req) -} - -// createServiceAccountExecute executes the request. -func (a *UsersApi) createServiceAccountExecute(r apiCreateServiceAccountRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.CreateServiceAccount") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/service_accounts" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiCreateUserRequest struct { - ctx _context.Context - body *UserCreateRequest -} - -func (a *UsersApi) buildCreateUserRequest(ctx _context.Context, body UserCreateRequest) (apiCreateUserRequest, error) { - req := apiCreateUserRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// CreateUser Create a user. -// Create a user for your organization. -func (a *UsersApi) CreateUser(ctx _context.Context, body UserCreateRequest) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildCreateUserRequest(ctx, body) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.createUserExecute(req) -} - -// createUserExecute executes the request. -func (a *UsersApi) createUserExecute(r apiCreateUserRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.CreateUser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/users" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiDisableUserRequest struct { - ctx _context.Context - userId string -} - -func (a *UsersApi) buildDisableUserRequest(ctx _context.Context, userId string) (apiDisableUserRequest, error) { - req := apiDisableUserRequest{ - ctx: ctx, - userId: userId, - } - return req, nil -} - -// DisableUser Disable a user. -// Disable a user. Can only be used with an application key belonging -// to an administrator user. -func (a *UsersApi) DisableUser(ctx _context.Context, userId string) (*_nethttp.Response, error) { - req, err := a.buildDisableUserRequest(ctx, userId) - if err != nil { - return nil, err - } - - return a.disableUserExecute(req) -} - -// disableUserExecute executes the request. -func (a *UsersApi) disableUserExecute(r apiDisableUserRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.DisableUser") - if err != nil { - return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/users/{user_id}" - localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type apiGetInvitationRequest struct { - ctx _context.Context - userInvitationUuid string -} - -func (a *UsersApi) buildGetInvitationRequest(ctx _context.Context, userInvitationUuid string) (apiGetInvitationRequest, error) { - req := apiGetInvitationRequest{ - ctx: ctx, - userInvitationUuid: userInvitationUuid, - } - return req, nil -} - -// GetInvitation Get a user invitation. -// Returns a single user invitation by its UUID. -func (a *UsersApi) GetInvitation(ctx _context.Context, userInvitationUuid string) (UserInvitationResponse, *_nethttp.Response, error) { - req, err := a.buildGetInvitationRequest(ctx, userInvitationUuid) - if err != nil { - var localVarReturnValue UserInvitationResponse - return localVarReturnValue, nil, err - } - - return a.getInvitationExecute(req) -} - -// getInvitationExecute executes the request. -func (a *UsersApi) getInvitationExecute(r apiGetInvitationRequest) (UserInvitationResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UserInvitationResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.GetInvitation") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/user_invitations/{user_invitation_uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"user_invitation_uuid"+"}", _neturl.PathEscape(common.ParameterToString(r.userInvitationUuid, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiGetUserRequest struct { - ctx _context.Context - userId string -} - -func (a *UsersApi) buildGetUserRequest(ctx _context.Context, userId string) (apiGetUserRequest, error) { - req := apiGetUserRequest{ - ctx: ctx, - userId: userId, - } - return req, nil -} - -// GetUser Get user details. -// Get a user in the organization specified by the user’s `user_id`. -func (a *UsersApi) GetUser(ctx _context.Context, userId string) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildGetUserRequest(ctx, userId) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.getUserExecute(req) -} - -// getUserExecute executes the request. -func (a *UsersApi) getUserExecute(r apiGetUserRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.GetUser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/users/{user_id}" - localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListUserOrganizationsRequest struct { - ctx _context.Context - userId string -} - -func (a *UsersApi) buildListUserOrganizationsRequest(ctx _context.Context, userId string) (apiListUserOrganizationsRequest, error) { - req := apiListUserOrganizationsRequest{ - ctx: ctx, - userId: userId, - } - return req, nil -} - -// ListUserOrganizations Get a user organization. -// Get a user organization. Returns the user information and all organizations -// joined by this user. -func (a *UsersApi) ListUserOrganizations(ctx _context.Context, userId string) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildListUserOrganizationsRequest(ctx, userId) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.listUserOrganizationsExecute(req) -} - -// listUserOrganizationsExecute executes the request. -func (a *UsersApi) listUserOrganizationsExecute(r apiListUserOrganizationsRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.ListUserOrganizations") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/users/{user_id}/orgs" - localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListUserPermissionsRequest struct { - ctx _context.Context - userId string -} - -func (a *UsersApi) buildListUserPermissionsRequest(ctx _context.Context, userId string) (apiListUserPermissionsRequest, error) { - req := apiListUserPermissionsRequest{ - ctx: ctx, - userId: userId, - } - return req, nil -} - -// ListUserPermissions Get a user permissions. -// Get a user permission set. Returns a list of the user’s permissions -// granted by the associated user's roles. -func (a *UsersApi) ListUserPermissions(ctx _context.Context, userId string) (PermissionsResponse, *_nethttp.Response, error) { - req, err := a.buildListUserPermissionsRequest(ctx, userId) - if err != nil { - var localVarReturnValue PermissionsResponse - return localVarReturnValue, nil, err - } - - return a.listUserPermissionsExecute(req) -} - -// listUserPermissionsExecute executes the request. -func (a *UsersApi) listUserPermissionsExecute(r apiListUserPermissionsRequest) (PermissionsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue PermissionsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.ListUserPermissions") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/users/{user_id}/permissions" - localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiListUsersRequest struct { - ctx _context.Context - pageSize *int64 - pageNumber *int64 - sort *string - sortDir *QuerySortOrder - filter *string - filterStatus *string -} - -// ListUsersOptionalParameters holds optional parameters for ListUsers. -type ListUsersOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - Sort *string - SortDir *QuerySortOrder - Filter *string - FilterStatus *string -} - -// NewListUsersOptionalParameters creates an empty struct for parameters. -func NewListUsersOptionalParameters() *ListUsersOptionalParameters { - this := ListUsersOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListUsersOptionalParameters) WithPageSize(pageSize int64) *ListUsersOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListUsersOptionalParameters) WithPageNumber(pageNumber int64) *ListUsersOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithSort sets the corresponding parameter name and returns the struct. -func (r *ListUsersOptionalParameters) WithSort(sort string) *ListUsersOptionalParameters { - r.Sort = &sort - return r -} - -// WithSortDir sets the corresponding parameter name and returns the struct. -func (r *ListUsersOptionalParameters) WithSortDir(sortDir QuerySortOrder) *ListUsersOptionalParameters { - r.SortDir = &sortDir - return r -} - -// WithFilter sets the corresponding parameter name and returns the struct. -func (r *ListUsersOptionalParameters) WithFilter(filter string) *ListUsersOptionalParameters { - r.Filter = &filter - return r -} - -// WithFilterStatus sets the corresponding parameter name and returns the struct. -func (r *ListUsersOptionalParameters) WithFilterStatus(filterStatus string) *ListUsersOptionalParameters { - r.FilterStatus = &filterStatus - return r -} - -func (a *UsersApi) buildListUsersRequest(ctx _context.Context, o ...ListUsersOptionalParameters) (apiListUsersRequest, error) { - req := apiListUsersRequest{ - ctx: ctx, - } - - if len(o) > 1 { - return req, common.ReportError("only one argument of type ListUsersOptionalParameters is allowed") - } - - if o != nil { - req.pageSize = o[0].PageSize - req.pageNumber = o[0].PageNumber - req.sort = o[0].Sort - req.sortDir = o[0].SortDir - req.filter = o[0].Filter - req.filterStatus = o[0].FilterStatus - } - return req, nil -} - -// ListUsers List all users. -// Get the list of all users in the organization. This list includes -// all users even if they are deactivated or unverified. -func (a *UsersApi) ListUsers(ctx _context.Context, o ...ListUsersOptionalParameters) (UsersResponse, *_nethttp.Response, error) { - req, err := a.buildListUsersRequest(ctx, o...) - if err != nil { - var localVarReturnValue UsersResponse - return localVarReturnValue, nil, err - } - - return a.listUsersExecute(req) -} - -// listUsersExecute executes the request. -func (a *UsersApi) listUsersExecute(r apiListUsersRequest) (UsersResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue UsersResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.ListUsers") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/users" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.pageSize != nil { - localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) - } - if r.pageNumber != nil { - localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) - } - if r.sort != nil { - localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) - } - if r.sortDir != nil { - localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) - } - if r.filter != nil { - localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) - } - if r.filterStatus != nil { - localVarQueryParams.Add("filter[status]", common.ParameterToString(*r.filterStatus, "")) - } - localVarHeaderParams["Accept"] = "application/json" - - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiSendInvitationsRequest struct { - ctx _context.Context - body *UserInvitationsRequest -} - -func (a *UsersApi) buildSendInvitationsRequest(ctx _context.Context, body UserInvitationsRequest) (apiSendInvitationsRequest, error) { - req := apiSendInvitationsRequest{ - ctx: ctx, - body: &body, - } - return req, nil -} - -// SendInvitations Send invitation emails. -// Sends emails to one or more users inviting them to join the organization. -func (a *UsersApi) SendInvitations(ctx _context.Context, body UserInvitationsRequest) (UserInvitationsResponse, *_nethttp.Response, error) { - req, err := a.buildSendInvitationsRequest(ctx, body) - if err != nil { - var localVarReturnValue UserInvitationsResponse - return localVarReturnValue, nil, err - } - - return a.sendInvitationsExecute(req) -} - -// sendInvitationsExecute executes the request. -func (a *UsersApi) sendInvitationsExecute(r apiSendInvitationsRequest) (UserInvitationsResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue UserInvitationsResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.SendInvitations") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/user_invitations" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type apiUpdateUserRequest struct { - ctx _context.Context - userId string - body *UserUpdateRequest -} - -func (a *UsersApi) buildUpdateUserRequest(ctx _context.Context, userId string, body UserUpdateRequest) (apiUpdateUserRequest, error) { - req := apiUpdateUserRequest{ - ctx: ctx, - userId: userId, - body: &body, - } - return req, nil -} - -// UpdateUser Update a user. -// Edit a user. Can only be used with an application key belonging -// to an administrator user. -func (a *UsersApi) UpdateUser(ctx _context.Context, userId string, body UserUpdateRequest) (UserResponse, *_nethttp.Response, error) { - req, err := a.buildUpdateUserRequest(ctx, userId, body) - if err != nil { - var localVarReturnValue UserResponse - return localVarReturnValue, nil, err - } - - return a.updateUserExecute(req) -} - -// updateUserExecute executes the request. -func (a *UsersApi) updateUserExecute(r apiUpdateUserRequest) (UserResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue UserResponse - ) - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.UpdateUser") - if err != nil { - return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/users/{user_id}" - localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, common.ReportError("body is required and must be specified") - } - localVarHeaderParams["Content-Type"] = "application/json" - localVarHeaderParams["Accept"] = "application/json" - - // body params - localVarPostBody = r.body - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-API-KEY"] = key - } - } - } - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { - if apiKey, ok := auth["appKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["DD-APPLICATION-KEY"] = key - } - } - } - req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - 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 - } - if localVarHTTPResponse.StatusCode == 403 { - 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 - } - if localVarHTTPResponse.StatusCode == 404 { - 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 - } - if localVarHTTPResponse.StatusCode == 422 { - 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 - } - if 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 := common.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// NewUsersApi Returns NewUsersApi. -func NewUsersApi(client *common.APIClient) *UsersApi { - return &UsersApi{ - Client: client, - } -} diff --git a/api/v2/datadog/model_api_error_response.go b/api/v2/datadog/model_api_error_response.go deleted file mode 100644 index 54bd4181d1c..00000000000 --- a/api/v2/datadog/model_api_error_response.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIErrorResponse API error response. -type APIErrorResponse struct { - // A list of errors. - Errors []string `json:"errors"` - // 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{} -} - -// NewAPIErrorResponse instantiates a new APIErrorResponse 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 NewAPIErrorResponse(errors []string) *APIErrorResponse { - this := APIErrorResponse{} - this.Errors = errors - return &this -} - -// NewAPIErrorResponseWithDefaults instantiates a new APIErrorResponse 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 NewAPIErrorResponseWithDefaults() *APIErrorResponse { - this := APIErrorResponse{} - return &this -} - -// GetErrors returns the Errors field value. -func (o *APIErrorResponse) GetErrors() []string { - if o == nil { - var ret []string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value -// and a boolean to check if the value has been set. -func (o *APIErrorResponse) GetErrorsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Errors, true -} - -// SetErrors sets field value. -func (o *APIErrorResponse) SetErrors(v []string) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIErrorResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["errors"] = o.Errors - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Errors *[]string `json:"errors"` - }{} - all := struct { - Errors []string `json:"errors"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Errors == nil { - return fmt.Errorf("Required field errors missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Errors = all.Errors - return nil -} diff --git a/api/v2/datadog/model_api_key_create_attributes.go b/api/v2/datadog/model_api_key_create_attributes.go deleted file mode 100644 index 620395cd5e5..00000000000 --- a/api/v2/datadog/model_api_key_create_attributes.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeyCreateAttributes Attributes used to create an API Key. -type APIKeyCreateAttributes struct { - // Name of the API key. - Name string `json:"name"` - // 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{} -} - -// NewAPIKeyCreateAttributes instantiates a new APIKeyCreateAttributes 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 NewAPIKeyCreateAttributes(name string) *APIKeyCreateAttributes { - this := APIKeyCreateAttributes{} - this.Name = name - return &this -} - -// NewAPIKeyCreateAttributesWithDefaults instantiates a new APIKeyCreateAttributes 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 NewAPIKeyCreateAttributesWithDefaults() *APIKeyCreateAttributes { - this := APIKeyCreateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *APIKeyCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *APIKeyCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *APIKeyCreateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_api_key_create_data.go b/api/v2/datadog/model_api_key_create_data.go deleted file mode 100644 index f7adba36b05..00000000000 --- a/api/v2/datadog/model_api_key_create_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeyCreateData Object used to create an API key. -type APIKeyCreateData struct { - // Attributes used to create an API Key. - Attributes APIKeyCreateAttributes `json:"attributes"` - // API Keys resource type. - Type APIKeysType `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{} -} - -// NewAPIKeyCreateData instantiates a new APIKeyCreateData 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 NewAPIKeyCreateData(attributes APIKeyCreateAttributes, typeVar APIKeysType) *APIKeyCreateData { - this := APIKeyCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewAPIKeyCreateDataWithDefaults instantiates a new APIKeyCreateData 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 NewAPIKeyCreateDataWithDefaults() *APIKeyCreateData { - this := APIKeyCreateData{} - var typeVar APIKeysType = APIKEYSTYPE_API_KEYS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *APIKeyCreateData) GetAttributes() APIKeyCreateAttributes { - if o == nil { - var ret APIKeyCreateAttributes - 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 *APIKeyCreateData) GetAttributesOk() (*APIKeyCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *APIKeyCreateData) SetAttributes(v APIKeyCreateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *APIKeyCreateData) GetType() APIKeysType { - if o == nil { - var ret APIKeysType - 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 *APIKeyCreateData) GetTypeOk() (*APIKeysType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *APIKeyCreateData) SetType(v APIKeysType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *APIKeyCreateAttributes `json:"attributes"` - Type *APIKeysType `json:"type"` - }{} - all := struct { - Attributes APIKeyCreateAttributes `json:"attributes"` - Type APIKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_api_key_create_request.go b/api/v2/datadog/model_api_key_create_request.go deleted file mode 100644 index f9f014f9dfa..00000000000 --- a/api/v2/datadog/model_api_key_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeyCreateRequest Request used to create an API key. -type APIKeyCreateRequest struct { - // Object used to create an API key. - Data APIKeyCreateData `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{} -} - -// NewAPIKeyCreateRequest instantiates a new APIKeyCreateRequest 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 NewAPIKeyCreateRequest(data APIKeyCreateData) *APIKeyCreateRequest { - this := APIKeyCreateRequest{} - this.Data = data - return &this -} - -// NewAPIKeyCreateRequestWithDefaults instantiates a new APIKeyCreateRequest 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 NewAPIKeyCreateRequestWithDefaults() *APIKeyCreateRequest { - this := APIKeyCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *APIKeyCreateRequest) GetData() APIKeyCreateData { - if o == nil { - var ret APIKeyCreateData - 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 *APIKeyCreateRequest) GetDataOk() (*APIKeyCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *APIKeyCreateRequest) SetData(v APIKeyCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *APIKeyCreateData `json:"data"` - }{} - all := struct { - Data APIKeyCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_api_key_relationships.go b/api/v2/datadog/model_api_key_relationships.go deleted file mode 100644 index ba243d0295e..00000000000 --- a/api/v2/datadog/model_api_key_relationships.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// APIKeyRelationships Resources related to the API key. -type APIKeyRelationships struct { - // Relationship to user. - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - // Relationship to user. - ModifiedBy *RelationshipToUser `json:"modified_by,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{} -} - -// NewAPIKeyRelationships instantiates a new APIKeyRelationships 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 NewAPIKeyRelationships() *APIKeyRelationships { - this := APIKeyRelationships{} - return &this -} - -// NewAPIKeyRelationshipsWithDefaults instantiates a new APIKeyRelationships 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 NewAPIKeyRelationshipsWithDefaults() *APIKeyRelationships { - this := APIKeyRelationships{} - return &this -} - -// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. -func (o *APIKeyRelationships) GetCreatedBy() RelationshipToUser { - if o == nil || o.CreatedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.CreatedBy -} - -// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *APIKeyRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { - if o == nil || o.CreatedBy == nil { - return nil, false - } - return o.CreatedBy, true -} - -// HasCreatedBy returns a boolean if a field has been set. -func (o *APIKeyRelationships) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { - return true - } - - return false -} - -// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. -func (o *APIKeyRelationships) SetCreatedBy(v RelationshipToUser) { - o.CreatedBy = &v -} - -// GetModifiedBy returns the ModifiedBy field value if set, zero value otherwise. -func (o *APIKeyRelationships) GetModifiedBy() RelationshipToUser { - if o == nil || o.ModifiedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.ModifiedBy -} - -// GetModifiedByOk returns a tuple with the ModifiedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *APIKeyRelationships) GetModifiedByOk() (*RelationshipToUser, bool) { - if o == nil || o.ModifiedBy == nil { - return nil, false - } - return o.ModifiedBy, true -} - -// HasModifiedBy returns a boolean if a field has been set. -func (o *APIKeyRelationships) HasModifiedBy() bool { - if o != nil && o.ModifiedBy != nil { - return true - } - - return false -} - -// SetModifiedBy gets a reference to the given RelationshipToUser and assigns it to the ModifiedBy field. -func (o *APIKeyRelationships) SetModifiedBy(v RelationshipToUser) { - o.ModifiedBy = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedBy != nil { - toSerialize["created_by"] = o.CreatedBy - } - if o.ModifiedBy != nil { - toSerialize["modified_by"] = o.ModifiedBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - ModifiedBy *RelationshipToUser `json:"modified_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CreatedBy = all.CreatedBy - if all.ModifiedBy != nil && all.ModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ModifiedBy = all.ModifiedBy - return nil -} diff --git a/api/v2/datadog/model_api_key_response.go b/api/v2/datadog/model_api_key_response.go deleted file mode 100644 index 4c960c53103..00000000000 --- a/api/v2/datadog/model_api_key_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// APIKeyResponse Response for retrieving an API key. -type APIKeyResponse struct { - // Datadog API key. - Data *FullAPIKey `json:"data,omitempty"` - // Array of objects related to the API key. - Included []APIKeyResponseIncludedItem `json:"included,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{} -} - -// NewAPIKeyResponse instantiates a new APIKeyResponse 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 NewAPIKeyResponse() *APIKeyResponse { - this := APIKeyResponse{} - return &this -} - -// NewAPIKeyResponseWithDefaults instantiates a new APIKeyResponse 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 NewAPIKeyResponseWithDefaults() *APIKeyResponse { - this := APIKeyResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *APIKeyResponse) GetData() FullAPIKey { - if o == nil || o.Data == nil { - var ret FullAPIKey - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *APIKeyResponse) GetDataOk() (*FullAPIKey, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *APIKeyResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given FullAPIKey and assigns it to the Data field. -func (o *APIKeyResponse) SetData(v FullAPIKey) { - o.Data = &v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *APIKeyResponse) GetIncluded() []APIKeyResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []APIKeyResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *APIKeyResponse) GetIncludedOk() (*[]APIKeyResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *APIKeyResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []APIKeyResponseIncludedItem and assigns it to the Included field. -func (o *APIKeyResponse) SetIncluded(v []APIKeyResponseIncludedItem) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *FullAPIKey `json:"data,omitempty"` - Included []APIKeyResponseIncludedItem `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_api_key_response_included_item.go b/api/v2/datadog/model_api_key_response_included_item.go deleted file mode 100644 index 9b46f8ec954..00000000000 --- a/api/v2/datadog/model_api_key_response_included_item.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// APIKeyResponseIncludedItem - An object related to an API key. -type APIKeyResponseIncludedItem struct { - User *User - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// UserAsAPIKeyResponseIncludedItem is a convenience function that returns User wrapped in APIKeyResponseIncludedItem. -func UserAsAPIKeyResponseIncludedItem(v *User) APIKeyResponseIncludedItem { - return APIKeyResponseIncludedItem{User: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *APIKeyResponseIncludedItem) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into User - err = json.Unmarshal(data, &obj.User) - if err == nil { - if obj.User != nil && obj.User.UnparsedObject == nil { - jsonUser, _ := json.Marshal(obj.User) - if string(jsonUser) == "{}" { // empty struct - obj.User = nil - } else { - match++ - } - } else { - obj.User = nil - } - } else { - obj.User = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.User = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj APIKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { - if obj.User != nil { - return json.Marshal(&obj.User) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *APIKeyResponseIncludedItem) GetActualInstance() interface{} { - if obj.User != nil { - return obj.User - } - - // all schemas are nil - return nil -} - -// NullableAPIKeyResponseIncludedItem handles when a null is used for APIKeyResponseIncludedItem. -type NullableAPIKeyResponseIncludedItem struct { - value *APIKeyResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableAPIKeyResponseIncludedItem) Get() *APIKeyResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAPIKeyResponseIncludedItem) Set(val *APIKeyResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAPIKeyResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableAPIKeyResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAPIKeyResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableAPIKeyResponseIncludedItem(val *APIKeyResponseIncludedItem) *NullableAPIKeyResponseIncludedItem { - return &NullableAPIKeyResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAPIKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAPIKeyResponseIncludedItem) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_api_key_update_attributes.go b/api/v2/datadog/model_api_key_update_attributes.go deleted file mode 100644 index 60cda5bbce6..00000000000 --- a/api/v2/datadog/model_api_key_update_attributes.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeyUpdateAttributes Attributes used to update an API Key. -type APIKeyUpdateAttributes struct { - // Name of the API key. - Name string `json:"name"` - // 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{} -} - -// NewAPIKeyUpdateAttributes instantiates a new APIKeyUpdateAttributes 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 NewAPIKeyUpdateAttributes(name string) *APIKeyUpdateAttributes { - this := APIKeyUpdateAttributes{} - this.Name = name - return &this -} - -// NewAPIKeyUpdateAttributesWithDefaults instantiates a new APIKeyUpdateAttributes 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 NewAPIKeyUpdateAttributesWithDefaults() *APIKeyUpdateAttributes { - this := APIKeyUpdateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *APIKeyUpdateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *APIKeyUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *APIKeyUpdateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_api_key_update_data.go b/api/v2/datadog/model_api_key_update_data.go deleted file mode 100644 index beb2ef122de..00000000000 --- a/api/v2/datadog/model_api_key_update_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeyUpdateData Object used to update an API key. -type APIKeyUpdateData struct { - // Attributes used to update an API Key. - Attributes APIKeyUpdateAttributes `json:"attributes"` - // ID of the API key. - Id string `json:"id"` - // API Keys resource type. - Type APIKeysType `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{} -} - -// NewAPIKeyUpdateData instantiates a new APIKeyUpdateData 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 NewAPIKeyUpdateData(attributes APIKeyUpdateAttributes, id string, typeVar APIKeysType) *APIKeyUpdateData { - this := APIKeyUpdateData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewAPIKeyUpdateDataWithDefaults instantiates a new APIKeyUpdateData 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 NewAPIKeyUpdateDataWithDefaults() *APIKeyUpdateData { - this := APIKeyUpdateData{} - var typeVar APIKeysType = APIKEYSTYPE_API_KEYS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *APIKeyUpdateData) GetAttributes() APIKeyUpdateAttributes { - if o == nil { - var ret APIKeyUpdateAttributes - 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 *APIKeyUpdateData) GetAttributesOk() (*APIKeyUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *APIKeyUpdateData) SetAttributes(v APIKeyUpdateAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *APIKeyUpdateData) 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 *APIKeyUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *APIKeyUpdateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *APIKeyUpdateData) GetType() APIKeysType { - if o == nil { - var ret APIKeysType - 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 *APIKeyUpdateData) GetTypeOk() (*APIKeysType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *APIKeyUpdateData) SetType(v APIKeysType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *APIKeyUpdateAttributes `json:"attributes"` - Id *string `json:"id"` - Type *APIKeysType `json:"type"` - }{} - all := struct { - Attributes APIKeyUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type APIKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_api_key_update_request.go b/api/v2/datadog/model_api_key_update_request.go deleted file mode 100644 index 11267375397..00000000000 --- a/api/v2/datadog/model_api_key_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeyUpdateRequest Request used to update an API key. -type APIKeyUpdateRequest struct { - // Object used to update an API key. - Data APIKeyUpdateData `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{} -} - -// NewAPIKeyUpdateRequest instantiates a new APIKeyUpdateRequest 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 NewAPIKeyUpdateRequest(data APIKeyUpdateData) *APIKeyUpdateRequest { - this := APIKeyUpdateRequest{} - this.Data = data - return &this -} - -// NewAPIKeyUpdateRequestWithDefaults instantiates a new APIKeyUpdateRequest 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 NewAPIKeyUpdateRequestWithDefaults() *APIKeyUpdateRequest { - this := APIKeyUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *APIKeyUpdateRequest) GetData() APIKeyUpdateData { - if o == nil { - var ret APIKeyUpdateData - 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 *APIKeyUpdateRequest) GetDataOk() (*APIKeyUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *APIKeyUpdateRequest) SetData(v APIKeyUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeyUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *APIKeyUpdateData `json:"data"` - }{} - all := struct { - Data APIKeyUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_api_keys_response.go b/api/v2/datadog/model_api_keys_response.go deleted file mode 100644 index e73de489cd8..00000000000 --- a/api/v2/datadog/model_api_keys_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// APIKeysResponse Response for a list of API keys. -type APIKeysResponse struct { - // Array of API keys. - Data []PartialAPIKey `json:"data,omitempty"` - // Array of objects related to the API key. - Included []APIKeyResponseIncludedItem `json:"included,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{} -} - -// NewAPIKeysResponse instantiates a new APIKeysResponse 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 NewAPIKeysResponse() *APIKeysResponse { - this := APIKeysResponse{} - return &this -} - -// NewAPIKeysResponseWithDefaults instantiates a new APIKeysResponse 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 NewAPIKeysResponseWithDefaults() *APIKeysResponse { - this := APIKeysResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *APIKeysResponse) GetData() []PartialAPIKey { - if o == nil || o.Data == nil { - var ret []PartialAPIKey - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *APIKeysResponse) GetDataOk() (*[]PartialAPIKey, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *APIKeysResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []PartialAPIKey and assigns it to the Data field. -func (o *APIKeysResponse) SetData(v []PartialAPIKey) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *APIKeysResponse) GetIncluded() []APIKeyResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []APIKeyResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *APIKeysResponse) GetIncludedOk() (*[]APIKeyResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *APIKeysResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []APIKeyResponseIncludedItem and assigns it to the Included field. -func (o *APIKeysResponse) SetIncluded(v []APIKeyResponseIncludedItem) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o APIKeysResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *APIKeysResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []PartialAPIKey `json:"data,omitempty"` - Included []APIKeyResponseIncludedItem `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_api_keys_sort.go b/api/v2/datadog/model_api_keys_sort.go deleted file mode 100644 index c63a04fc70e..00000000000 --- a/api/v2/datadog/model_api_keys_sort.go +++ /dev/null @@ -1,121 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeysSort Sorting options -type APIKeysSort string - -// List of APIKeysSort. -const ( - APIKEYSSORT_CREATED_AT_ASCENDING APIKeysSort = "created_at" - APIKEYSSORT_CREATED_AT_DESCENDING APIKeysSort = "-created_at" - APIKEYSSORT_LAST4_ASCENDING APIKeysSort = "last4" - APIKEYSSORT_LAST4_DESCENDING APIKeysSort = "-last4" - APIKEYSSORT_MODIFIED_AT_ASCENDING APIKeysSort = "modified_at" - APIKEYSSORT_MODIFIED_AT_DESCENDING APIKeysSort = "-modified_at" - APIKEYSSORT_NAME_ASCENDING APIKeysSort = "name" - APIKEYSSORT_NAME_DESCENDING APIKeysSort = "-name" -) - -var allowedAPIKeysSortEnumValues = []APIKeysSort{ - APIKEYSSORT_CREATED_AT_ASCENDING, - APIKEYSSORT_CREATED_AT_DESCENDING, - APIKEYSSORT_LAST4_ASCENDING, - APIKEYSSORT_LAST4_DESCENDING, - APIKEYSSORT_MODIFIED_AT_ASCENDING, - APIKEYSSORT_MODIFIED_AT_DESCENDING, - APIKEYSSORT_NAME_ASCENDING, - APIKEYSSORT_NAME_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *APIKeysSort) GetAllowedValues() []APIKeysSort { - return allowedAPIKeysSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *APIKeysSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = APIKeysSort(value) - return nil -} - -// NewAPIKeysSortFromValue returns a pointer to a valid APIKeysSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAPIKeysSortFromValue(v string) (*APIKeysSort, error) { - ev := APIKeysSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for APIKeysSort: valid values are %v", v, allowedAPIKeysSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v APIKeysSort) IsValid() bool { - for _, existing := range allowedAPIKeysSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to APIKeysSort value. -func (v APIKeysSort) Ptr() *APIKeysSort { - return &v -} - -// NullableAPIKeysSort handles when a null is used for APIKeysSort. -type NullableAPIKeysSort struct { - value *APIKeysSort - isSet bool -} - -// Get returns the associated value. -func (v NullableAPIKeysSort) Get() *APIKeysSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAPIKeysSort) Set(val *APIKeysSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAPIKeysSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAPIKeysSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAPIKeysSort initializes the struct as if Set has been called. -func NewNullableAPIKeysSort(val *APIKeysSort) *NullableAPIKeysSort { - return &NullableAPIKeysSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAPIKeysSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAPIKeysSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_api_keys_type.go b/api/v2/datadog/model_api_keys_type.go deleted file mode 100644 index 7a48448c7f3..00000000000 --- a/api/v2/datadog/model_api_keys_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// APIKeysType API Keys resource type. -type APIKeysType string - -// List of APIKeysType. -const ( - APIKEYSTYPE_API_KEYS APIKeysType = "api_keys" -) - -var allowedAPIKeysTypeEnumValues = []APIKeysType{ - APIKEYSTYPE_API_KEYS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *APIKeysType) GetAllowedValues() []APIKeysType { - return allowedAPIKeysTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *APIKeysType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = APIKeysType(value) - return nil -} - -// NewAPIKeysTypeFromValue returns a pointer to a valid APIKeysType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAPIKeysTypeFromValue(v string) (*APIKeysType, error) { - ev := APIKeysType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for APIKeysType: valid values are %v", v, allowedAPIKeysTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v APIKeysType) IsValid() bool { - for _, existing := range allowedAPIKeysTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to APIKeysType value. -func (v APIKeysType) Ptr() *APIKeysType { - return &v -} - -// NullableAPIKeysType handles when a null is used for APIKeysType. -type NullableAPIKeysType struct { - value *APIKeysType - isSet bool -} - -// Get returns the associated value. -func (v NullableAPIKeysType) Get() *APIKeysType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAPIKeysType) Set(val *APIKeysType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAPIKeysType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAPIKeysType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAPIKeysType initializes the struct as if Set has been called. -func NewNullableAPIKeysType(val *APIKeysType) *NullableAPIKeysType { - return &NullableAPIKeysType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAPIKeysType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAPIKeysType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_application_key_create_attributes.go b/api/v2/datadog/model_application_key_create_attributes.go deleted file mode 100644 index d5b3cc4f80d..00000000000 --- a/api/v2/datadog/model_application_key_create_attributes.go +++ /dev/null @@ -1,143 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApplicationKeyCreateAttributes Attributes used to create an application Key. -type ApplicationKeyCreateAttributes struct { - // Name of the application key. - Name string `json:"name"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. - Scopes []string `json:"scopes,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{} -} - -// NewApplicationKeyCreateAttributes instantiates a new ApplicationKeyCreateAttributes 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 NewApplicationKeyCreateAttributes(name string) *ApplicationKeyCreateAttributes { - this := ApplicationKeyCreateAttributes{} - this.Name = name - return &this -} - -// NewApplicationKeyCreateAttributesWithDefaults instantiates a new ApplicationKeyCreateAttributes 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 NewApplicationKeyCreateAttributesWithDefaults() *ApplicationKeyCreateAttributes { - this := ApplicationKeyCreateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *ApplicationKeyCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *ApplicationKeyCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *ApplicationKeyCreateAttributes) SetName(v string) { - o.Name = v -} - -// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *ApplicationKeyCreateAttributes) GetScopes() []string { - if o == nil { - var ret []string - return ret - } - return o.Scopes -} - -// GetScopesOk returns a tuple with the Scopes 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 *ApplicationKeyCreateAttributes) GetScopesOk() (*[]string, bool) { - if o == nil || o.Scopes == nil { - return nil, false - } - return &o.Scopes, true -} - -// HasScopes returns a boolean if a field has been set. -func (o *ApplicationKeyCreateAttributes) HasScopes() bool { - if o != nil && o.Scopes != nil { - return true - } - - return false -} - -// SetScopes gets a reference to the given []string and assigns it to the Scopes field. -func (o *ApplicationKeyCreateAttributes) SetScopes(v []string) { - o.Scopes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - if o.Scopes != nil { - toSerialize["scopes"] = o.Scopes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - Scopes []string `json:"scopes,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - o.Scopes = all.Scopes - return nil -} diff --git a/api/v2/datadog/model_application_key_create_data.go b/api/v2/datadog/model_application_key_create_data.go deleted file mode 100644 index d5d3f0341d7..00000000000 --- a/api/v2/datadog/model_application_key_create_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApplicationKeyCreateData Object used to create an application key. -type ApplicationKeyCreateData struct { - // Attributes used to create an application Key. - Attributes ApplicationKeyCreateAttributes `json:"attributes"` - // Application Keys resource type. - Type ApplicationKeysType `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{} -} - -// NewApplicationKeyCreateData instantiates a new ApplicationKeyCreateData 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 NewApplicationKeyCreateData(attributes ApplicationKeyCreateAttributes, typeVar ApplicationKeysType) *ApplicationKeyCreateData { - this := ApplicationKeyCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewApplicationKeyCreateDataWithDefaults instantiates a new ApplicationKeyCreateData 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 NewApplicationKeyCreateDataWithDefaults() *ApplicationKeyCreateData { - this := ApplicationKeyCreateData{} - var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *ApplicationKeyCreateData) GetAttributes() ApplicationKeyCreateAttributes { - if o == nil { - var ret ApplicationKeyCreateAttributes - 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 *ApplicationKeyCreateData) GetAttributesOk() (*ApplicationKeyCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *ApplicationKeyCreateData) SetAttributes(v ApplicationKeyCreateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *ApplicationKeyCreateData) GetType() ApplicationKeysType { - if o == nil { - var ret ApplicationKeysType - 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 *ApplicationKeyCreateData) GetTypeOk() (*ApplicationKeysType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ApplicationKeyCreateData) SetType(v ApplicationKeysType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *ApplicationKeyCreateAttributes `json:"attributes"` - Type *ApplicationKeysType `json:"type"` - }{} - all := struct { - Attributes ApplicationKeyCreateAttributes `json:"attributes"` - Type ApplicationKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_application_key_create_request.go b/api/v2/datadog/model_application_key_create_request.go deleted file mode 100644 index c0c7f5638c4..00000000000 --- a/api/v2/datadog/model_application_key_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApplicationKeyCreateRequest Request used to create an application key. -type ApplicationKeyCreateRequest struct { - // Object used to create an application key. - Data ApplicationKeyCreateData `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{} -} - -// NewApplicationKeyCreateRequest instantiates a new ApplicationKeyCreateRequest 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 NewApplicationKeyCreateRequest(data ApplicationKeyCreateData) *ApplicationKeyCreateRequest { - this := ApplicationKeyCreateRequest{} - this.Data = data - return &this -} - -// NewApplicationKeyCreateRequestWithDefaults instantiates a new ApplicationKeyCreateRequest 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 NewApplicationKeyCreateRequestWithDefaults() *ApplicationKeyCreateRequest { - this := ApplicationKeyCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *ApplicationKeyCreateRequest) GetData() ApplicationKeyCreateData { - if o == nil { - var ret ApplicationKeyCreateData - 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 *ApplicationKeyCreateRequest) GetDataOk() (*ApplicationKeyCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *ApplicationKeyCreateRequest) SetData(v ApplicationKeyCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *ApplicationKeyCreateData `json:"data"` - }{} - all := struct { - Data ApplicationKeyCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_application_key_relationships.go b/api/v2/datadog/model_application_key_relationships.go deleted file mode 100644 index 9132ac6cee5..00000000000 --- a/api/v2/datadog/model_application_key_relationships.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApplicationKeyRelationships Resources related to the application key. -type ApplicationKeyRelationships struct { - // Relationship to user. - OwnedBy *RelationshipToUser `json:"owned_by,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{} -} - -// NewApplicationKeyRelationships instantiates a new ApplicationKeyRelationships 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 NewApplicationKeyRelationships() *ApplicationKeyRelationships { - this := ApplicationKeyRelationships{} - return &this -} - -// NewApplicationKeyRelationshipsWithDefaults instantiates a new ApplicationKeyRelationships 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 NewApplicationKeyRelationshipsWithDefaults() *ApplicationKeyRelationships { - this := ApplicationKeyRelationships{} - return &this -} - -// GetOwnedBy returns the OwnedBy field value if set, zero value otherwise. -func (o *ApplicationKeyRelationships) GetOwnedBy() RelationshipToUser { - if o == nil || o.OwnedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.OwnedBy -} - -// GetOwnedByOk returns a tuple with the OwnedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKeyRelationships) GetOwnedByOk() (*RelationshipToUser, bool) { - if o == nil || o.OwnedBy == nil { - return nil, false - } - return o.OwnedBy, true -} - -// HasOwnedBy returns a boolean if a field has been set. -func (o *ApplicationKeyRelationships) HasOwnedBy() bool { - if o != nil && o.OwnedBy != nil { - return true - } - - return false -} - -// SetOwnedBy gets a reference to the given RelationshipToUser and assigns it to the OwnedBy field. -func (o *ApplicationKeyRelationships) SetOwnedBy(v RelationshipToUser) { - o.OwnedBy = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.OwnedBy != nil { - toSerialize["owned_by"] = o.OwnedBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - OwnedBy *RelationshipToUser `json:"owned_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.OwnedBy != nil && all.OwnedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.OwnedBy = all.OwnedBy - return nil -} diff --git a/api/v2/datadog/model_application_key_response.go b/api/v2/datadog/model_application_key_response.go deleted file mode 100644 index 33da8526116..00000000000 --- a/api/v2/datadog/model_application_key_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApplicationKeyResponse Response for retrieving an application key. -type ApplicationKeyResponse struct { - // Datadog application key. - Data *FullApplicationKey `json:"data,omitempty"` - // Array of objects related to the application key. - Included []ApplicationKeyResponseIncludedItem `json:"included,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{} -} - -// NewApplicationKeyResponse instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponse() *ApplicationKeyResponse { - this := ApplicationKeyResponse{} - return &this -} - -// NewApplicationKeyResponseWithDefaults instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponseWithDefaults() *ApplicationKeyResponse { - this := ApplicationKeyResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *ApplicationKeyResponse) GetData() FullApplicationKey { - if o == nil || o.Data == nil { - var ret FullApplicationKey - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKeyResponse) GetDataOk() (*FullApplicationKey, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *ApplicationKeyResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given FullApplicationKey and assigns it to the Data field. -func (o *ApplicationKeyResponse) SetData(v FullApplicationKey) { - o.Data = &v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *ApplicationKeyResponse) GetIncluded() []ApplicationKeyResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []ApplicationKeyResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKeyResponse) GetIncludedOk() (*[]ApplicationKeyResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *ApplicationKeyResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []ApplicationKeyResponseIncludedItem and assigns it to the Included field. -func (o *ApplicationKeyResponse) SetIncluded(v []ApplicationKeyResponseIncludedItem) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *FullApplicationKey `json:"data,omitempty"` - Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_application_key_response_included_item.go b/api/v2/datadog/model_application_key_response_included_item.go deleted file mode 100644 index f5bc1c84af0..00000000000 --- a/api/v2/datadog/model_application_key_response_included_item.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApplicationKeyResponseIncludedItem - An object related to an application key. -type ApplicationKeyResponseIncludedItem struct { - User *User - Role *Role - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// UserAsApplicationKeyResponseIncludedItem is a convenience function that returns User wrapped in ApplicationKeyResponseIncludedItem. -func UserAsApplicationKeyResponseIncludedItem(v *User) ApplicationKeyResponseIncludedItem { - return ApplicationKeyResponseIncludedItem{User: v} -} - -// RoleAsApplicationKeyResponseIncludedItem is a convenience function that returns Role wrapped in ApplicationKeyResponseIncludedItem. -func RoleAsApplicationKeyResponseIncludedItem(v *Role) ApplicationKeyResponseIncludedItem { - return ApplicationKeyResponseIncludedItem{Role: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *ApplicationKeyResponseIncludedItem) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into User - err = json.Unmarshal(data, &obj.User) - if err == nil { - if obj.User != nil && obj.User.UnparsedObject == nil { - jsonUser, _ := json.Marshal(obj.User) - if string(jsonUser) == "{}" { // empty struct - obj.User = nil - } else { - match++ - } - } else { - obj.User = nil - } - } else { - obj.User = nil - } - - // try to unmarshal data into Role - err = json.Unmarshal(data, &obj.Role) - if err == nil { - if obj.Role != nil && obj.Role.UnparsedObject == nil { - jsonRole, _ := json.Marshal(obj.Role) - if string(jsonRole) == "{}" { // empty struct - obj.Role = nil - } else { - match++ - } - } else { - obj.Role = nil - } - } else { - obj.Role = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.User = nil - obj.Role = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj ApplicationKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { - if obj.User != nil { - return json.Marshal(&obj.User) - } - - if obj.Role != nil { - return json.Marshal(&obj.Role) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *ApplicationKeyResponseIncludedItem) GetActualInstance() interface{} { - if obj.User != nil { - return obj.User - } - - if obj.Role != nil { - return obj.Role - } - - // all schemas are nil - return nil -} - -// NullableApplicationKeyResponseIncludedItem handles when a null is used for ApplicationKeyResponseIncludedItem. -type NullableApplicationKeyResponseIncludedItem struct { - value *ApplicationKeyResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableApplicationKeyResponseIncludedItem) Get() *ApplicationKeyResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApplicationKeyResponseIncludedItem) Set(val *ApplicationKeyResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApplicationKeyResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableApplicationKeyResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApplicationKeyResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableApplicationKeyResponseIncludedItem(val *ApplicationKeyResponseIncludedItem) *NullableApplicationKeyResponseIncludedItem { - return &NullableApplicationKeyResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApplicationKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApplicationKeyResponseIncludedItem) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_application_key_update_attributes.go b/api/v2/datadog/model_application_key_update_attributes.go deleted file mode 100644 index fdbb286c135..00000000000 --- a/api/v2/datadog/model_application_key_update_attributes.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ApplicationKeyUpdateAttributes Attributes used to update an application Key. -type ApplicationKeyUpdateAttributes struct { - // Name of the application key. - Name *string `json:"name,omitempty"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. - Scopes []string `json:"scopes,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{} -} - -// NewApplicationKeyUpdateAttributes instantiates a new ApplicationKeyUpdateAttributes 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 NewApplicationKeyUpdateAttributes() *ApplicationKeyUpdateAttributes { - this := ApplicationKeyUpdateAttributes{} - return &this -} - -// NewApplicationKeyUpdateAttributesWithDefaults instantiates a new ApplicationKeyUpdateAttributes 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 NewApplicationKeyUpdateAttributesWithDefaults() *ApplicationKeyUpdateAttributes { - this := ApplicationKeyUpdateAttributes{} - return &this -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *ApplicationKeyUpdateAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ApplicationKeyUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *ApplicationKeyUpdateAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *ApplicationKeyUpdateAttributes) SetName(v string) { - o.Name = &v -} - -// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *ApplicationKeyUpdateAttributes) GetScopes() []string { - if o == nil { - var ret []string - return ret - } - return o.Scopes -} - -// GetScopesOk returns a tuple with the Scopes 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 *ApplicationKeyUpdateAttributes) GetScopesOk() (*[]string, bool) { - if o == nil || o.Scopes == nil { - return nil, false - } - return &o.Scopes, true -} - -// HasScopes returns a boolean if a field has been set. -func (o *ApplicationKeyUpdateAttributes) HasScopes() bool { - if o != nil && o.Scopes != nil { - return true - } - - return false -} - -// SetScopes gets a reference to the given []string and assigns it to the Scopes field. -func (o *ApplicationKeyUpdateAttributes) SetScopes(v []string) { - o.Scopes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Scopes != nil { - toSerialize["scopes"] = o.Scopes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Name *string `json:"name,omitempty"` - Scopes []string `json:"scopes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - o.Scopes = all.Scopes - return nil -} diff --git a/api/v2/datadog/model_application_key_update_data.go b/api/v2/datadog/model_application_key_update_data.go deleted file mode 100644 index 7c5f2ef66ea..00000000000 --- a/api/v2/datadog/model_application_key_update_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApplicationKeyUpdateData Object used to update an application key. -type ApplicationKeyUpdateData struct { - // Attributes used to update an application Key. - Attributes ApplicationKeyUpdateAttributes `json:"attributes"` - // ID of the application key. - Id string `json:"id"` - // Application Keys resource type. - Type ApplicationKeysType `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{} -} - -// NewApplicationKeyUpdateData instantiates a new ApplicationKeyUpdateData 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 NewApplicationKeyUpdateData(attributes ApplicationKeyUpdateAttributes, id string, typeVar ApplicationKeysType) *ApplicationKeyUpdateData { - this := ApplicationKeyUpdateData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewApplicationKeyUpdateDataWithDefaults instantiates a new ApplicationKeyUpdateData 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 NewApplicationKeyUpdateDataWithDefaults() *ApplicationKeyUpdateData { - this := ApplicationKeyUpdateData{} - var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *ApplicationKeyUpdateData) GetAttributes() ApplicationKeyUpdateAttributes { - if o == nil { - var ret ApplicationKeyUpdateAttributes - 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 *ApplicationKeyUpdateData) GetAttributesOk() (*ApplicationKeyUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *ApplicationKeyUpdateData) SetAttributes(v ApplicationKeyUpdateAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *ApplicationKeyUpdateData) 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 *ApplicationKeyUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *ApplicationKeyUpdateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *ApplicationKeyUpdateData) GetType() ApplicationKeysType { - if o == nil { - var ret ApplicationKeysType - 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 *ApplicationKeyUpdateData) GetTypeOk() (*ApplicationKeysType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ApplicationKeyUpdateData) SetType(v ApplicationKeysType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *ApplicationKeyUpdateAttributes `json:"attributes"` - Id *string `json:"id"` - Type *ApplicationKeysType `json:"type"` - }{} - all := struct { - Attributes ApplicationKeyUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type ApplicationKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_application_key_update_request.go b/api/v2/datadog/model_application_key_update_request.go deleted file mode 100644 index e323417f7a4..00000000000 --- a/api/v2/datadog/model_application_key_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApplicationKeyUpdateRequest Request used to update an application key. -type ApplicationKeyUpdateRequest struct { - // Object used to update an application key. - Data ApplicationKeyUpdateData `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{} -} - -// NewApplicationKeyUpdateRequest instantiates a new ApplicationKeyUpdateRequest 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 NewApplicationKeyUpdateRequest(data ApplicationKeyUpdateData) *ApplicationKeyUpdateRequest { - this := ApplicationKeyUpdateRequest{} - this.Data = data - return &this -} - -// NewApplicationKeyUpdateRequestWithDefaults instantiates a new ApplicationKeyUpdateRequest 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 NewApplicationKeyUpdateRequestWithDefaults() *ApplicationKeyUpdateRequest { - this := ApplicationKeyUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *ApplicationKeyUpdateRequest) GetData() ApplicationKeyUpdateData { - if o == nil { - var ret ApplicationKeyUpdateData - 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 *ApplicationKeyUpdateRequest) GetDataOk() (*ApplicationKeyUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *ApplicationKeyUpdateRequest) SetData(v ApplicationKeyUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ApplicationKeyUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ApplicationKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *ApplicationKeyUpdateData `json:"data"` - }{} - all := struct { - Data ApplicationKeyUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_application_keys_sort.go b/api/v2/datadog/model_application_keys_sort.go deleted file mode 100644 index 1a711a1df49..00000000000 --- a/api/v2/datadog/model_application_keys_sort.go +++ /dev/null @@ -1,117 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApplicationKeysSort Sorting options -type ApplicationKeysSort string - -// List of ApplicationKeysSort. -const ( - APPLICATIONKEYSSORT_CREATED_AT_ASCENDING ApplicationKeysSort = "created_at" - APPLICATIONKEYSSORT_CREATED_AT_DESCENDING ApplicationKeysSort = "-created_at" - APPLICATIONKEYSSORT_LAST4_ASCENDING ApplicationKeysSort = "last4" - APPLICATIONKEYSSORT_LAST4_DESCENDING ApplicationKeysSort = "-last4" - APPLICATIONKEYSSORT_NAME_ASCENDING ApplicationKeysSort = "name" - APPLICATIONKEYSSORT_NAME_DESCENDING ApplicationKeysSort = "-name" -) - -var allowedApplicationKeysSortEnumValues = []ApplicationKeysSort{ - APPLICATIONKEYSSORT_CREATED_AT_ASCENDING, - APPLICATIONKEYSSORT_CREATED_AT_DESCENDING, - APPLICATIONKEYSSORT_LAST4_ASCENDING, - APPLICATIONKEYSSORT_LAST4_DESCENDING, - APPLICATIONKEYSSORT_NAME_ASCENDING, - APPLICATIONKEYSSORT_NAME_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ApplicationKeysSort) GetAllowedValues() []ApplicationKeysSort { - return allowedApplicationKeysSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ApplicationKeysSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ApplicationKeysSort(value) - return nil -} - -// NewApplicationKeysSortFromValue returns a pointer to a valid ApplicationKeysSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewApplicationKeysSortFromValue(v string) (*ApplicationKeysSort, error) { - ev := ApplicationKeysSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ApplicationKeysSort: valid values are %v", v, allowedApplicationKeysSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ApplicationKeysSort) IsValid() bool { - for _, existing := range allowedApplicationKeysSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ApplicationKeysSort value. -func (v ApplicationKeysSort) Ptr() *ApplicationKeysSort { - return &v -} - -// NullableApplicationKeysSort handles when a null is used for ApplicationKeysSort. -type NullableApplicationKeysSort struct { - value *ApplicationKeysSort - isSet bool -} - -// Get returns the associated value. -func (v NullableApplicationKeysSort) Get() *ApplicationKeysSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApplicationKeysSort) Set(val *ApplicationKeysSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApplicationKeysSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableApplicationKeysSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApplicationKeysSort initializes the struct as if Set has been called. -func NewNullableApplicationKeysSort(val *ApplicationKeysSort) *NullableApplicationKeysSort { - return &NullableApplicationKeysSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApplicationKeysSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApplicationKeysSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_application_keys_type.go b/api/v2/datadog/model_application_keys_type.go deleted file mode 100644 index bffcc6be8fb..00000000000 --- a/api/v2/datadog/model_application_keys_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ApplicationKeysType Application Keys resource type. -type ApplicationKeysType string - -// List of ApplicationKeysType. -const ( - APPLICATIONKEYSTYPE_APPLICATION_KEYS ApplicationKeysType = "application_keys" -) - -var allowedApplicationKeysTypeEnumValues = []ApplicationKeysType{ - APPLICATIONKEYSTYPE_APPLICATION_KEYS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ApplicationKeysType) GetAllowedValues() []ApplicationKeysType { - return allowedApplicationKeysTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ApplicationKeysType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ApplicationKeysType(value) - return nil -} - -// NewApplicationKeysTypeFromValue returns a pointer to a valid ApplicationKeysType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewApplicationKeysTypeFromValue(v string) (*ApplicationKeysType, error) { - ev := ApplicationKeysType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ApplicationKeysType: valid values are %v", v, allowedApplicationKeysTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ApplicationKeysType) IsValid() bool { - for _, existing := range allowedApplicationKeysTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ApplicationKeysType value. -func (v ApplicationKeysType) Ptr() *ApplicationKeysType { - return &v -} - -// NullableApplicationKeysType handles when a null is used for ApplicationKeysType. -type NullableApplicationKeysType struct { - value *ApplicationKeysType - isSet bool -} - -// Get returns the associated value. -func (v NullableApplicationKeysType) Get() *ApplicationKeysType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableApplicationKeysType) Set(val *ApplicationKeysType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableApplicationKeysType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableApplicationKeysType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableApplicationKeysType initializes the struct as if Set has been called. -func NewNullableApplicationKeysType(val *ApplicationKeysType) *NullableApplicationKeysType { - return &NullableApplicationKeysType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableApplicationKeysType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableApplicationKeysType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_audit_logs_event.go b/api/v2/datadog/model_audit_logs_event.go deleted file mode 100644 index ce0509b695d..00000000000 --- a/api/v2/datadog/model_audit_logs_event.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsEvent Object description of an Audit Logs event after it is processed and stored by Datadog. -type AuditLogsEvent struct { - // JSON object containing all event attributes and their associated values. - Attributes *AuditLogsEventAttributes `json:"attributes,omitempty"` - // Unique ID of the event. - Id *string `json:"id,omitempty"` - // Type of the event. - Type *AuditLogsEventType `json:"type,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{} -} - -// NewAuditLogsEvent instantiates a new AuditLogsEvent 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 NewAuditLogsEvent() *AuditLogsEvent { - this := AuditLogsEvent{} - var typeVar AuditLogsEventType = AUDITLOGSEVENTTYPE_Audit - this.Type = &typeVar - return &this -} - -// NewAuditLogsEventWithDefaults instantiates a new AuditLogsEvent 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 NewAuditLogsEventWithDefaults() *AuditLogsEvent { - this := AuditLogsEvent{} - var typeVar AuditLogsEventType = AUDITLOGSEVENTTYPE_Audit - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *AuditLogsEvent) GetAttributes() AuditLogsEventAttributes { - if o == nil || o.Attributes == nil { - var ret AuditLogsEventAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsEvent) GetAttributesOk() (*AuditLogsEventAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *AuditLogsEvent) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given AuditLogsEventAttributes and assigns it to the Attributes field. -func (o *AuditLogsEvent) SetAttributes(v AuditLogsEventAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *AuditLogsEvent) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsEvent) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *AuditLogsEvent) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *AuditLogsEvent) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *AuditLogsEvent) GetType() AuditLogsEventType { - if o == nil || o.Type == nil { - var ret AuditLogsEventType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsEvent) GetTypeOk() (*AuditLogsEventType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *AuditLogsEvent) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given AuditLogsEventType and assigns it to the Type field. -func (o *AuditLogsEvent) SetType(v AuditLogsEventType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsEvent) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *AuditLogsEventAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *AuditLogsEventType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_audit_logs_event_attributes.go b/api/v2/datadog/model_audit_logs_event_attributes.go deleted file mode 100644 index 83e11f22f1c..00000000000 --- a/api/v2/datadog/model_audit_logs_event_attributes.go +++ /dev/null @@ -1,226 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// AuditLogsEventAttributes JSON object containing all event attributes and their associated values. -type AuditLogsEventAttributes struct { - // JSON object of attributes from Audit Logs events. - Attributes map[string]interface{} `json:"attributes,omitempty"` - // Name of the application or service generating Audit Logs events. - // This name is used to correlate Audit Logs to APM, so make sure you specify the same - // value when you use both products. - Service *string `json:"service,omitempty"` - // Array of tags associated with your event. - Tags []string `json:"tags,omitempty"` - // Timestamp of your event. - Timestamp *time.Time `json:"timestamp,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{} -} - -// NewAuditLogsEventAttributes instantiates a new AuditLogsEventAttributes 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 NewAuditLogsEventAttributes() *AuditLogsEventAttributes { - this := AuditLogsEventAttributes{} - return &this -} - -// NewAuditLogsEventAttributesWithDefaults instantiates a new AuditLogsEventAttributes 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 NewAuditLogsEventAttributesWithDefaults() *AuditLogsEventAttributes { - this := AuditLogsEventAttributes{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *AuditLogsEventAttributes) GetAttributes() map[string]interface{} { - if o == nil || o.Attributes == nil { - var ret map[string]interface{} - return ret - } - return o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsEventAttributes) GetAttributesOk() (*map[string]interface{}, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return &o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *AuditLogsEventAttributes) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. -func (o *AuditLogsEventAttributes) SetAttributes(v map[string]interface{}) { - o.Attributes = v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *AuditLogsEventAttributes) 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 *AuditLogsEventAttributes) 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 *AuditLogsEventAttributes) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *AuditLogsEventAttributes) SetService(v string) { - o.Service = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *AuditLogsEventAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *AuditLogsEventAttributes) GetTagsOk() (*[]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 *AuditLogsEventAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *AuditLogsEventAttributes) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *AuditLogsEventAttributes) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsEventAttributes) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *AuditLogsEventAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *AuditLogsEventAttributes) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsEventAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Service != nil { - toSerialize["service"] = o.Service - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsEventAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes map[string]interface{} `json:"attributes,omitempty"` - Service *string `json:"service,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Service = all.Service - o.Tags = all.Tags - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v2/datadog/model_audit_logs_event_type.go b/api/v2/datadog/model_audit_logs_event_type.go deleted file mode 100644 index 3f033a6973a..00000000000 --- a/api/v2/datadog/model_audit_logs_event_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuditLogsEventType Type of the event. -type AuditLogsEventType string - -// List of AuditLogsEventType. -const ( - AUDITLOGSEVENTTYPE_Audit AuditLogsEventType = "audit" -) - -var allowedAuditLogsEventTypeEnumValues = []AuditLogsEventType{ - AUDITLOGSEVENTTYPE_Audit, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AuditLogsEventType) GetAllowedValues() []AuditLogsEventType { - return allowedAuditLogsEventTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AuditLogsEventType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AuditLogsEventType(value) - return nil -} - -// NewAuditLogsEventTypeFromValue returns a pointer to a valid AuditLogsEventType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAuditLogsEventTypeFromValue(v string) (*AuditLogsEventType, error) { - ev := AuditLogsEventType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AuditLogsEventType: valid values are %v", v, allowedAuditLogsEventTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AuditLogsEventType) IsValid() bool { - for _, existing := range allowedAuditLogsEventTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AuditLogsEventType value. -func (v AuditLogsEventType) Ptr() *AuditLogsEventType { - return &v -} - -// NullableAuditLogsEventType handles when a null is used for AuditLogsEventType. -type NullableAuditLogsEventType struct { - value *AuditLogsEventType - isSet bool -} - -// Get returns the associated value. -func (v NullableAuditLogsEventType) Get() *AuditLogsEventType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuditLogsEventType) Set(val *AuditLogsEventType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuditLogsEventType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuditLogsEventType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuditLogsEventType initializes the struct as if Set has been called. -func NewNullableAuditLogsEventType(val *AuditLogsEventType) *NullableAuditLogsEventType { - return &NullableAuditLogsEventType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuditLogsEventType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuditLogsEventType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_audit_logs_events_response.go b/api/v2/datadog/model_audit_logs_events_response.go deleted file mode 100644 index 21827458c9c..00000000000 --- a/api/v2/datadog/model_audit_logs_events_response.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsEventsResponse Response object with all events matching the request and pagination information. -type AuditLogsEventsResponse struct { - // Array of events matching the request. - Data []AuditLogsEvent `json:"data,omitempty"` - // Links attributes. - Links *AuditLogsResponseLinks `json:"links,omitempty"` - // The metadata associated with a request. - Meta *AuditLogsResponseMetadata `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{} -} - -// NewAuditLogsEventsResponse instantiates a new AuditLogsEventsResponse 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 NewAuditLogsEventsResponse() *AuditLogsEventsResponse { - this := AuditLogsEventsResponse{} - return &this -} - -// NewAuditLogsEventsResponseWithDefaults instantiates a new AuditLogsEventsResponse 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 NewAuditLogsEventsResponseWithDefaults() *AuditLogsEventsResponse { - this := AuditLogsEventsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *AuditLogsEventsResponse) GetData() []AuditLogsEvent { - if o == nil || o.Data == nil { - var ret []AuditLogsEvent - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsEventsResponse) GetDataOk() (*[]AuditLogsEvent, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *AuditLogsEventsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []AuditLogsEvent and assigns it to the Data field. -func (o *AuditLogsEventsResponse) SetData(v []AuditLogsEvent) { - o.Data = v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *AuditLogsEventsResponse) GetLinks() AuditLogsResponseLinks { - if o == nil || o.Links == nil { - var ret AuditLogsResponseLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsEventsResponse) GetLinksOk() (*AuditLogsResponseLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *AuditLogsEventsResponse) HasLinks() bool { - if o != nil && o.Links != nil { - return true - } - - return false -} - -// SetLinks gets a reference to the given AuditLogsResponseLinks and assigns it to the Links field. -func (o *AuditLogsEventsResponse) SetLinks(v AuditLogsResponseLinks) { - o.Links = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *AuditLogsEventsResponse) GetMeta() AuditLogsResponseMetadata { - if o == nil || o.Meta == nil { - var ret AuditLogsResponseMetadata - 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 *AuditLogsEventsResponse) GetMetaOk() (*AuditLogsResponseMetadata, 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 *AuditLogsEventsResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given AuditLogsResponseMetadata and assigns it to the Meta field. -func (o *AuditLogsEventsResponse) SetMeta(v AuditLogsResponseMetadata) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsEventsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsEventsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []AuditLogsEvent `json:"data,omitempty"` - Links *AuditLogsResponseLinks `json:"links,omitempty"` - Meta *AuditLogsResponseMetadata `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Links = all.Links - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_audit_logs_query_filter.go b/api/v2/datadog/model_audit_logs_query_filter.go deleted file mode 100644 index 4a41a641de8..00000000000 --- a/api/v2/datadog/model_audit_logs_query_filter.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsQueryFilter Search and filter query settings. -type AuditLogsQueryFilter struct { - // Minimum time for the requested events. Supports date, math, and regular timestamps (in milliseconds). - From *string `json:"from,omitempty"` - // Search query following the Audit Logs search syntax. - Query *string `json:"query,omitempty"` - // Maximum time for the requested events. Supports date, math, and regular timestamps (in milliseconds). - To *string `json:"to,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{} -} - -// NewAuditLogsQueryFilter instantiates a new AuditLogsQueryFilter 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 NewAuditLogsQueryFilter() *AuditLogsQueryFilter { - this := AuditLogsQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// NewAuditLogsQueryFilterWithDefaults instantiates a new AuditLogsQueryFilter 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 NewAuditLogsQueryFilterWithDefaults() *AuditLogsQueryFilter { - this := AuditLogsQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// GetFrom returns the From field value if set, zero value otherwise. -func (o *AuditLogsQueryFilter) GetFrom() string { - if o == nil || o.From == nil { - var ret string - return ret - } - return *o.From -} - -// GetFromOk returns a tuple with the From field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsQueryFilter) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { - return nil, false - } - return o.From, true -} - -// HasFrom returns a boolean if a field has been set. -func (o *AuditLogsQueryFilter) HasFrom() bool { - if o != nil && o.From != nil { - return true - } - - return false -} - -// SetFrom gets a reference to the given string and assigns it to the From field. -func (o *AuditLogsQueryFilter) SetFrom(v string) { - o.From = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *AuditLogsQueryFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsQueryFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *AuditLogsQueryFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *AuditLogsQueryFilter) SetQuery(v string) { - o.Query = &v -} - -// GetTo returns the To field value if set, zero value otherwise. -func (o *AuditLogsQueryFilter) GetTo() string { - if o == nil || o.To == nil { - var ret string - return ret - } - return *o.To -} - -// GetToOk returns a tuple with the To field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsQueryFilter) GetToOk() (*string, bool) { - if o == nil || o.To == nil { - return nil, false - } - return o.To, true -} - -// HasTo returns a boolean if a field has been set. -func (o *AuditLogsQueryFilter) HasTo() bool { - if o != nil && o.To != nil { - return true - } - - return false -} - -// SetTo gets a reference to the given string and assigns it to the To field. -func (o *AuditLogsQueryFilter) SetTo(v string) { - o.To = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsQueryFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.From != nil { - toSerialize["from"] = o.From - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.To != nil { - toSerialize["to"] = o.To - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - From *string `json:"from,omitempty"` - Query *string `json:"query,omitempty"` - To *string `json:"to,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.From = all.From - o.Query = all.Query - o.To = all.To - return nil -} diff --git a/api/v2/datadog/model_audit_logs_query_options.go b/api/v2/datadog/model_audit_logs_query_options.go deleted file mode 100644 index 254040d859c..00000000000 --- a/api/v2/datadog/model_audit_logs_query_options.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsQueryOptions Global query options that are used during the query. -// Note: Specify either timezone or time offset, not both. Otherwise, the query fails. -type AuditLogsQueryOptions struct { - // Time offset (in seconds) to apply to the query. - TimeOffset *int64 `json:"time_offset,omitempty"` - // Timezone code. Can be specified as an offset, for example: "UTC+03:00". - Timezone *string `json:"timezone,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{} -} - -// NewAuditLogsQueryOptions instantiates a new AuditLogsQueryOptions 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 NewAuditLogsQueryOptions() *AuditLogsQueryOptions { - this := AuditLogsQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// NewAuditLogsQueryOptionsWithDefaults instantiates a new AuditLogsQueryOptions 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 NewAuditLogsQueryOptionsWithDefaults() *AuditLogsQueryOptions { - this := AuditLogsQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. -func (o *AuditLogsQueryOptions) GetTimeOffset() int64 { - if o == nil || o.TimeOffset == nil { - var ret int64 - return ret - } - return *o.TimeOffset -} - -// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsQueryOptions) GetTimeOffsetOk() (*int64, bool) { - if o == nil || o.TimeOffset == nil { - return nil, false - } - return o.TimeOffset, true -} - -// HasTimeOffset returns a boolean if a field has been set. -func (o *AuditLogsQueryOptions) HasTimeOffset() bool { - if o != nil && o.TimeOffset != nil { - return true - } - - return false -} - -// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. -func (o *AuditLogsQueryOptions) SetTimeOffset(v int64) { - o.TimeOffset = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *AuditLogsQueryOptions) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsQueryOptions) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *AuditLogsQueryOptions) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *AuditLogsQueryOptions) SetTimezone(v string) { - o.Timezone = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsQueryOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TimeOffset != nil { - toSerialize["time_offset"] = o.TimeOffset - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TimeOffset *int64 `json:"time_offset,omitempty"` - Timezone *string `json:"timezone,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TimeOffset = all.TimeOffset - o.Timezone = all.Timezone - return nil -} diff --git a/api/v2/datadog/model_audit_logs_query_page_options.go b/api/v2/datadog/model_audit_logs_query_page_options.go deleted file mode 100644 index 6737782e72d..00000000000 --- a/api/v2/datadog/model_audit_logs_query_page_options.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsQueryPageOptions Paging attributes for listing events. -type AuditLogsQueryPageOptions struct { - // List following results with a cursor provided in the previous query. - Cursor *string `json:"cursor,omitempty"` - // Maximum number of events in the response. - Limit *int32 `json:"limit,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{} -} - -// NewAuditLogsQueryPageOptions instantiates a new AuditLogsQueryPageOptions 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 NewAuditLogsQueryPageOptions() *AuditLogsQueryPageOptions { - this := AuditLogsQueryPageOptions{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// NewAuditLogsQueryPageOptionsWithDefaults instantiates a new AuditLogsQueryPageOptions 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 NewAuditLogsQueryPageOptionsWithDefaults() *AuditLogsQueryPageOptions { - this := AuditLogsQueryPageOptions{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// GetCursor returns the Cursor field value if set, zero value otherwise. -func (o *AuditLogsQueryPageOptions) GetCursor() string { - if o == nil || o.Cursor == nil { - var ret string - return ret - } - return *o.Cursor -} - -// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsQueryPageOptions) GetCursorOk() (*string, bool) { - if o == nil || o.Cursor == nil { - return nil, false - } - return o.Cursor, true -} - -// HasCursor returns a boolean if a field has been set. -func (o *AuditLogsQueryPageOptions) HasCursor() bool { - if o != nil && o.Cursor != nil { - return true - } - - return false -} - -// SetCursor gets a reference to the given string and assigns it to the Cursor field. -func (o *AuditLogsQueryPageOptions) SetCursor(v string) { - o.Cursor = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *AuditLogsQueryPageOptions) GetLimit() int32 { - if o == nil || o.Limit == nil { - var ret int32 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsQueryPageOptions) GetLimitOk() (*int32, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *AuditLogsQueryPageOptions) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int32 and assigns it to the Limit field. -func (o *AuditLogsQueryPageOptions) SetLimit(v int32) { - o.Limit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsQueryPageOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cursor != nil { - toSerialize["cursor"] = o.Cursor - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cursor *string `json:"cursor,omitempty"` - Limit *int32 `json:"limit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cursor = all.Cursor - o.Limit = all.Limit - return nil -} diff --git a/api/v2/datadog/model_audit_logs_response_links.go b/api/v2/datadog/model_audit_logs_response_links.go deleted file mode 100644 index fcff6df9300..00000000000 --- a/api/v2/datadog/model_audit_logs_response_links.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsResponseLinks Links attributes. -type AuditLogsResponseLinks struct { - // Link for the next set of results. Note that the request can also be made using the - // POST endpoint. - Next *string `json:"next,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{} -} - -// NewAuditLogsResponseLinks instantiates a new AuditLogsResponseLinks 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 NewAuditLogsResponseLinks() *AuditLogsResponseLinks { - this := AuditLogsResponseLinks{} - return &this -} - -// NewAuditLogsResponseLinksWithDefaults instantiates a new AuditLogsResponseLinks 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 NewAuditLogsResponseLinksWithDefaults() *AuditLogsResponseLinks { - this := AuditLogsResponseLinks{} - return &this -} - -// GetNext returns the Next field value if set, zero value otherwise. -func (o *AuditLogsResponseLinks) GetNext() string { - if o == nil || o.Next == nil { - var ret string - return ret - } - return *o.Next -} - -// GetNextOk returns a tuple with the Next field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsResponseLinks) GetNextOk() (*string, bool) { - if o == nil || o.Next == nil { - return nil, false - } - return o.Next, true -} - -// HasNext returns a boolean if a field has been set. -func (o *AuditLogsResponseLinks) HasNext() bool { - if o != nil && o.Next != nil { - return true - } - - return false -} - -// SetNext gets a reference to the given string and assigns it to the Next field. -func (o *AuditLogsResponseLinks) SetNext(v string) { - o.Next = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsResponseLinks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Next != nil { - toSerialize["next"] = o.Next - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Next *string `json:"next,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Next = all.Next - return nil -} diff --git a/api/v2/datadog/model_audit_logs_response_metadata.go b/api/v2/datadog/model_audit_logs_response_metadata.go deleted file mode 100644 index c6efbd6bae5..00000000000 --- a/api/v2/datadog/model_audit_logs_response_metadata.go +++ /dev/null @@ -1,274 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsResponseMetadata The metadata associated with a request. -type AuditLogsResponseMetadata struct { - // Time elapsed in milliseconds. - Elapsed *int64 `json:"elapsed,omitempty"` - // Paging attributes. - Page *AuditLogsResponsePage `json:"page,omitempty"` - // The identifier of the request. - RequestId *string `json:"request_id,omitempty"` - // The status of the response. - Status *AuditLogsResponseStatus `json:"status,omitempty"` - // A list of warnings (non-fatal errors) encountered. Partial results may return if - // warnings are present in the response. - Warnings []AuditLogsWarning `json:"warnings,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{} -} - -// NewAuditLogsResponseMetadata instantiates a new AuditLogsResponseMetadata 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 NewAuditLogsResponseMetadata() *AuditLogsResponseMetadata { - this := AuditLogsResponseMetadata{} - return &this -} - -// NewAuditLogsResponseMetadataWithDefaults instantiates a new AuditLogsResponseMetadata 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 NewAuditLogsResponseMetadataWithDefaults() *AuditLogsResponseMetadata { - this := AuditLogsResponseMetadata{} - return &this -} - -// GetElapsed returns the Elapsed field value if set, zero value otherwise. -func (o *AuditLogsResponseMetadata) GetElapsed() int64 { - if o == nil || o.Elapsed == nil { - var ret int64 - return ret - } - return *o.Elapsed -} - -// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsResponseMetadata) GetElapsedOk() (*int64, bool) { - if o == nil || o.Elapsed == nil { - return nil, false - } - return o.Elapsed, true -} - -// HasElapsed returns a boolean if a field has been set. -func (o *AuditLogsResponseMetadata) HasElapsed() bool { - if o != nil && o.Elapsed != nil { - return true - } - - return false -} - -// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. -func (o *AuditLogsResponseMetadata) SetElapsed(v int64) { - o.Elapsed = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *AuditLogsResponseMetadata) GetPage() AuditLogsResponsePage { - if o == nil || o.Page == nil { - var ret AuditLogsResponsePage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsResponseMetadata) GetPageOk() (*AuditLogsResponsePage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *AuditLogsResponseMetadata) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given AuditLogsResponsePage and assigns it to the Page field. -func (o *AuditLogsResponseMetadata) SetPage(v AuditLogsResponsePage) { - o.Page = &v -} - -// GetRequestId returns the RequestId field value if set, zero value otherwise. -func (o *AuditLogsResponseMetadata) GetRequestId() string { - if o == nil || o.RequestId == nil { - var ret string - return ret - } - return *o.RequestId -} - -// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsResponseMetadata) GetRequestIdOk() (*string, bool) { - if o == nil || o.RequestId == nil { - return nil, false - } - return o.RequestId, true -} - -// HasRequestId returns a boolean if a field has been set. -func (o *AuditLogsResponseMetadata) HasRequestId() bool { - if o != nil && o.RequestId != nil { - return true - } - - return false -} - -// SetRequestId gets a reference to the given string and assigns it to the RequestId field. -func (o *AuditLogsResponseMetadata) SetRequestId(v string) { - o.RequestId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *AuditLogsResponseMetadata) GetStatus() AuditLogsResponseStatus { - if o == nil || o.Status == nil { - var ret AuditLogsResponseStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsResponseMetadata) GetStatusOk() (*AuditLogsResponseStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *AuditLogsResponseMetadata) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given AuditLogsResponseStatus and assigns it to the Status field. -func (o *AuditLogsResponseMetadata) SetStatus(v AuditLogsResponseStatus) { - o.Status = &v -} - -// GetWarnings returns the Warnings field value if set, zero value otherwise. -func (o *AuditLogsResponseMetadata) GetWarnings() []AuditLogsWarning { - if o == nil || o.Warnings == nil { - var ret []AuditLogsWarning - return ret - } - return o.Warnings -} - -// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsResponseMetadata) GetWarningsOk() (*[]AuditLogsWarning, bool) { - if o == nil || o.Warnings == nil { - return nil, false - } - return &o.Warnings, true -} - -// HasWarnings returns a boolean if a field has been set. -func (o *AuditLogsResponseMetadata) HasWarnings() bool { - if o != nil && o.Warnings != nil { - return true - } - - return false -} - -// SetWarnings gets a reference to the given []AuditLogsWarning and assigns it to the Warnings field. -func (o *AuditLogsResponseMetadata) SetWarnings(v []AuditLogsWarning) { - o.Warnings = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsResponseMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Elapsed != nil { - toSerialize["elapsed"] = o.Elapsed - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.RequestId != nil { - toSerialize["request_id"] = o.RequestId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Warnings != nil { - toSerialize["warnings"] = o.Warnings - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Elapsed *int64 `json:"elapsed,omitempty"` - Page *AuditLogsResponsePage `json:"page,omitempty"` - RequestId *string `json:"request_id,omitempty"` - Status *AuditLogsResponseStatus `json:"status,omitempty"` - Warnings []AuditLogsWarning `json:"warnings,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Elapsed = all.Elapsed - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.RequestId = all.RequestId - o.Status = all.Status - o.Warnings = all.Warnings - return nil -} diff --git a/api/v2/datadog/model_audit_logs_response_page.go b/api/v2/datadog/model_audit_logs_response_page.go deleted file mode 100644 index 0297e70856f..00000000000 --- a/api/v2/datadog/model_audit_logs_response_page.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsResponsePage Paging attributes. -type AuditLogsResponsePage struct { - // The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of `page[cursor]`. - After *string `json:"after,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{} -} - -// NewAuditLogsResponsePage instantiates a new AuditLogsResponsePage 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 NewAuditLogsResponsePage() *AuditLogsResponsePage { - this := AuditLogsResponsePage{} - return &this -} - -// NewAuditLogsResponsePageWithDefaults instantiates a new AuditLogsResponsePage 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 NewAuditLogsResponsePageWithDefaults() *AuditLogsResponsePage { - this := AuditLogsResponsePage{} - return &this -} - -// GetAfter returns the After field value if set, zero value otherwise. -func (o *AuditLogsResponsePage) GetAfter() string { - if o == nil || o.After == nil { - var ret string - return ret - } - return *o.After -} - -// GetAfterOk returns a tuple with the After field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsResponsePage) GetAfterOk() (*string, bool) { - if o == nil || o.After == nil { - return nil, false - } - return o.After, true -} - -// HasAfter returns a boolean if a field has been set. -func (o *AuditLogsResponsePage) HasAfter() bool { - if o != nil && o.After != nil { - return true - } - - return false -} - -// SetAfter gets a reference to the given string and assigns it to the After field. -func (o *AuditLogsResponsePage) SetAfter(v string) { - o.After = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsResponsePage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.After != nil { - toSerialize["after"] = o.After - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsResponsePage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - After *string `json:"after,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.After = all.After - return nil -} diff --git a/api/v2/datadog/model_audit_logs_response_status.go b/api/v2/datadog/model_audit_logs_response_status.go deleted file mode 100644 index acdfce587e6..00000000000 --- a/api/v2/datadog/model_audit_logs_response_status.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuditLogsResponseStatus The status of the response. -type AuditLogsResponseStatus string - -// List of AuditLogsResponseStatus. -const ( - AUDITLOGSRESPONSESTATUS_DONE AuditLogsResponseStatus = "done" - AUDITLOGSRESPONSESTATUS_TIMEOUT AuditLogsResponseStatus = "timeout" -) - -var allowedAuditLogsResponseStatusEnumValues = []AuditLogsResponseStatus{ - AUDITLOGSRESPONSESTATUS_DONE, - AUDITLOGSRESPONSESTATUS_TIMEOUT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AuditLogsResponseStatus) GetAllowedValues() []AuditLogsResponseStatus { - return allowedAuditLogsResponseStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AuditLogsResponseStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AuditLogsResponseStatus(value) - return nil -} - -// NewAuditLogsResponseStatusFromValue returns a pointer to a valid AuditLogsResponseStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAuditLogsResponseStatusFromValue(v string) (*AuditLogsResponseStatus, error) { - ev := AuditLogsResponseStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AuditLogsResponseStatus: valid values are %v", v, allowedAuditLogsResponseStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AuditLogsResponseStatus) IsValid() bool { - for _, existing := range allowedAuditLogsResponseStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AuditLogsResponseStatus value. -func (v AuditLogsResponseStatus) Ptr() *AuditLogsResponseStatus { - return &v -} - -// NullableAuditLogsResponseStatus handles when a null is used for AuditLogsResponseStatus. -type NullableAuditLogsResponseStatus struct { - value *AuditLogsResponseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableAuditLogsResponseStatus) Get() *AuditLogsResponseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuditLogsResponseStatus) Set(val *AuditLogsResponseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuditLogsResponseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuditLogsResponseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuditLogsResponseStatus initializes the struct as if Set has been called. -func NewNullableAuditLogsResponseStatus(val *AuditLogsResponseStatus) *NullableAuditLogsResponseStatus { - return &NullableAuditLogsResponseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuditLogsResponseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuditLogsResponseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_audit_logs_search_events_request.go b/api/v2/datadog/model_audit_logs_search_events_request.go deleted file mode 100644 index 6fede6ae845..00000000000 --- a/api/v2/datadog/model_audit_logs_search_events_request.go +++ /dev/null @@ -1,249 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsSearchEventsRequest The request for a Audit Logs events list. -type AuditLogsSearchEventsRequest struct { - // Search and filter query settings. - Filter *AuditLogsQueryFilter `json:"filter,omitempty"` - // Global query options that are used during the query. - // Note: Specify either timezone or time offset, not both. Otherwise, the query fails. - Options *AuditLogsQueryOptions `json:"options,omitempty"` - // Paging attributes for listing events. - Page *AuditLogsQueryPageOptions `json:"page,omitempty"` - // Sort parameters when querying events. - Sort *AuditLogsSort `json:"sort,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{} -} - -// NewAuditLogsSearchEventsRequest instantiates a new AuditLogsSearchEventsRequest 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 NewAuditLogsSearchEventsRequest() *AuditLogsSearchEventsRequest { - this := AuditLogsSearchEventsRequest{} - return &this -} - -// NewAuditLogsSearchEventsRequestWithDefaults instantiates a new AuditLogsSearchEventsRequest 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 NewAuditLogsSearchEventsRequestWithDefaults() *AuditLogsSearchEventsRequest { - this := AuditLogsSearchEventsRequest{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *AuditLogsSearchEventsRequest) GetFilter() AuditLogsQueryFilter { - if o == nil || o.Filter == nil { - var ret AuditLogsQueryFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsSearchEventsRequest) GetFilterOk() (*AuditLogsQueryFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *AuditLogsSearchEventsRequest) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given AuditLogsQueryFilter and assigns it to the Filter field. -func (o *AuditLogsSearchEventsRequest) SetFilter(v AuditLogsQueryFilter) { - o.Filter = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *AuditLogsSearchEventsRequest) GetOptions() AuditLogsQueryOptions { - if o == nil || o.Options == nil { - var ret AuditLogsQueryOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsSearchEventsRequest) GetOptionsOk() (*AuditLogsQueryOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *AuditLogsSearchEventsRequest) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given AuditLogsQueryOptions and assigns it to the Options field. -func (o *AuditLogsSearchEventsRequest) SetOptions(v AuditLogsQueryOptions) { - o.Options = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *AuditLogsSearchEventsRequest) GetPage() AuditLogsQueryPageOptions { - if o == nil || o.Page == nil { - var ret AuditLogsQueryPageOptions - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsSearchEventsRequest) GetPageOk() (*AuditLogsQueryPageOptions, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *AuditLogsSearchEventsRequest) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given AuditLogsQueryPageOptions and assigns it to the Page field. -func (o *AuditLogsSearchEventsRequest) SetPage(v AuditLogsQueryPageOptions) { - o.Page = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *AuditLogsSearchEventsRequest) GetSort() AuditLogsSort { - if o == nil || o.Sort == nil { - var ret AuditLogsSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsSearchEventsRequest) GetSortOk() (*AuditLogsSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *AuditLogsSearchEventsRequest) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given AuditLogsSort and assigns it to the Sort field. -func (o *AuditLogsSearchEventsRequest) SetSort(v AuditLogsSort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsSearchEventsRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filter *AuditLogsQueryFilter `json:"filter,omitempty"` - Options *AuditLogsQueryOptions `json:"options,omitempty"` - Page *AuditLogsQueryPageOptions `json:"page,omitempty"` - Sort *AuditLogsSort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.Sort = all.Sort - return nil -} diff --git a/api/v2/datadog/model_audit_logs_sort.go b/api/v2/datadog/model_audit_logs_sort.go deleted file mode 100644 index e3c6b5544f3..00000000000 --- a/api/v2/datadog/model_audit_logs_sort.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuditLogsSort Sort parameters when querying events. -type AuditLogsSort string - -// List of AuditLogsSort. -const ( - AUDITLOGSSORT_TIMESTAMP_ASCENDING AuditLogsSort = "timestamp" - AUDITLOGSSORT_TIMESTAMP_DESCENDING AuditLogsSort = "-timestamp" -) - -var allowedAuditLogsSortEnumValues = []AuditLogsSort{ - AUDITLOGSSORT_TIMESTAMP_ASCENDING, - AUDITLOGSSORT_TIMESTAMP_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AuditLogsSort) GetAllowedValues() []AuditLogsSort { - return allowedAuditLogsSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AuditLogsSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AuditLogsSort(value) - return nil -} - -// NewAuditLogsSortFromValue returns a pointer to a valid AuditLogsSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAuditLogsSortFromValue(v string) (*AuditLogsSort, error) { - ev := AuditLogsSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AuditLogsSort: valid values are %v", v, allowedAuditLogsSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AuditLogsSort) IsValid() bool { - for _, existing := range allowedAuditLogsSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AuditLogsSort value. -func (v AuditLogsSort) Ptr() *AuditLogsSort { - return &v -} - -// NullableAuditLogsSort handles when a null is used for AuditLogsSort. -type NullableAuditLogsSort struct { - value *AuditLogsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableAuditLogsSort) Get() *AuditLogsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuditLogsSort) Set(val *AuditLogsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuditLogsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuditLogsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuditLogsSort initializes the struct as if Set has been called. -func NewNullableAuditLogsSort(val *AuditLogsSort) *NullableAuditLogsSort { - return &NullableAuditLogsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuditLogsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuditLogsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_audit_logs_warning.go b/api/v2/datadog/model_audit_logs_warning.go deleted file mode 100644 index 4c13b686989..00000000000 --- a/api/v2/datadog/model_audit_logs_warning.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuditLogsWarning Warning message indicating something that went wrong with the query. -type AuditLogsWarning struct { - // Unique code for this type of warning. - Code *string `json:"code,omitempty"` - // Detailed explanation of this specific warning. - Detail *string `json:"detail,omitempty"` - // Short human-readable summary of the warning. - Title *string `json:"title,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{} -} - -// NewAuditLogsWarning instantiates a new AuditLogsWarning 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 NewAuditLogsWarning() *AuditLogsWarning { - this := AuditLogsWarning{} - return &this -} - -// NewAuditLogsWarningWithDefaults instantiates a new AuditLogsWarning 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 NewAuditLogsWarningWithDefaults() *AuditLogsWarning { - this := AuditLogsWarning{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *AuditLogsWarning) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsWarning) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *AuditLogsWarning) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *AuditLogsWarning) SetCode(v string) { - o.Code = &v -} - -// GetDetail returns the Detail field value if set, zero value otherwise. -func (o *AuditLogsWarning) GetDetail() string { - if o == nil || o.Detail == nil { - var ret string - return ret - } - return *o.Detail -} - -// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsWarning) GetDetailOk() (*string, bool) { - if o == nil || o.Detail == nil { - return nil, false - } - return o.Detail, true -} - -// HasDetail returns a boolean if a field has been set. -func (o *AuditLogsWarning) HasDetail() bool { - if o != nil && o.Detail != nil { - return true - } - - return false -} - -// SetDetail gets a reference to the given string and assigns it to the Detail field. -func (o *AuditLogsWarning) SetDetail(v string) { - o.Detail = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *AuditLogsWarning) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuditLogsWarning) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *AuditLogsWarning) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *AuditLogsWarning) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuditLogsWarning) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Detail != nil { - toSerialize["detail"] = o.Detail - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuditLogsWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *string `json:"code,omitempty"` - Detail *string `json:"detail,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Detail = all.Detail - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping.go b/api/v2/datadog/model_auth_n_mapping.go deleted file mode 100644 index 6d9ba35d857..00000000000 --- a/api/v2/datadog/model_auth_n_mapping.go +++ /dev/null @@ -1,238 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuthNMapping The AuthN Mapping object returned by API. -type AuthNMapping struct { - // Attributes of AuthN Mapping. - Attributes *AuthNMappingAttributes `json:"attributes,omitempty"` - // ID of the AuthN Mapping. - Id string `json:"id"` - // All relationships associated with AuthN Mapping. - Relationships *AuthNMappingRelationships `json:"relationships,omitempty"` - // AuthN Mappings resource type. - Type AuthNMappingsType `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{} -} - -// NewAuthNMapping instantiates a new AuthNMapping 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 NewAuthNMapping(id string, typeVar AuthNMappingsType) *AuthNMapping { - this := AuthNMapping{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewAuthNMappingWithDefaults instantiates a new AuthNMapping 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 NewAuthNMappingWithDefaults() *AuthNMapping { - this := AuthNMapping{} - var typeVar AuthNMappingsType = AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *AuthNMapping) GetAttributes() AuthNMappingAttributes { - if o == nil || o.Attributes == nil { - var ret AuthNMappingAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMapping) GetAttributesOk() (*AuthNMappingAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *AuthNMapping) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given AuthNMappingAttributes and assigns it to the Attributes field. -func (o *AuthNMapping) SetAttributes(v AuthNMappingAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *AuthNMapping) 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 *AuthNMapping) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *AuthNMapping) SetId(v string) { - o.Id = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *AuthNMapping) GetRelationships() AuthNMappingRelationships { - if o == nil || o.Relationships == nil { - var ret AuthNMappingRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMapping) GetRelationshipsOk() (*AuthNMappingRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *AuthNMapping) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given AuthNMappingRelationships and assigns it to the Relationships field. -func (o *AuthNMapping) SetRelationships(v AuthNMappingRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *AuthNMapping) GetType() AuthNMappingsType { - if o == nil { - var ret AuthNMappingsType - 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 *AuthNMapping) GetTypeOk() (*AuthNMappingsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *AuthNMapping) SetType(v AuthNMappingsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMapping) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *AuthNMappingsType `json:"type"` - }{} - all := struct { - Attributes *AuthNMappingAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Relationships *AuthNMappingRelationships `json:"relationships,omitempty"` - Type AuthNMappingsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_attributes.go b/api/v2/datadog/model_auth_n_mapping_attributes.go deleted file mode 100644 index 35c9283c982..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_attributes.go +++ /dev/null @@ -1,267 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// AuthNMappingAttributes Attributes of AuthN Mapping. -type AuthNMappingAttributes struct { - // Key portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeKey *string `json:"attribute_key,omitempty"` - // Value portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeValue *string `json:"attribute_value,omitempty"` - // Creation time of the AuthN Mapping. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Time of last AuthN Mapping modification. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // The ID of the SAML assertion attribute. - SamlAssertionAttributeId *string `json:"saml_assertion_attribute_id,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{} -} - -// NewAuthNMappingAttributes instantiates a new AuthNMappingAttributes 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 NewAuthNMappingAttributes() *AuthNMappingAttributes { - this := AuthNMappingAttributes{} - return &this -} - -// NewAuthNMappingAttributesWithDefaults instantiates a new AuthNMappingAttributes 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 NewAuthNMappingAttributesWithDefaults() *AuthNMappingAttributes { - this := AuthNMappingAttributes{} - return &this -} - -// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. -func (o *AuthNMappingAttributes) GetAttributeKey() string { - if o == nil || o.AttributeKey == nil { - var ret string - return ret - } - return *o.AttributeKey -} - -// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingAttributes) GetAttributeKeyOk() (*string, bool) { - if o == nil || o.AttributeKey == nil { - return nil, false - } - return o.AttributeKey, true -} - -// HasAttributeKey returns a boolean if a field has been set. -func (o *AuthNMappingAttributes) HasAttributeKey() bool { - if o != nil && o.AttributeKey != nil { - return true - } - - return false -} - -// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. -func (o *AuthNMappingAttributes) SetAttributeKey(v string) { - o.AttributeKey = &v -} - -// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. -func (o *AuthNMappingAttributes) GetAttributeValue() string { - if o == nil || o.AttributeValue == nil { - var ret string - return ret - } - return *o.AttributeValue -} - -// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingAttributes) GetAttributeValueOk() (*string, bool) { - if o == nil || o.AttributeValue == nil { - return nil, false - } - return o.AttributeValue, true -} - -// HasAttributeValue returns a boolean if a field has been set. -func (o *AuthNMappingAttributes) HasAttributeValue() bool { - if o != nil && o.AttributeValue != nil { - return true - } - - return false -} - -// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. -func (o *AuthNMappingAttributes) SetAttributeValue(v string) { - o.AttributeValue = &v -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *AuthNMappingAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *AuthNMappingAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *AuthNMappingAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *AuthNMappingAttributes) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingAttributes) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *AuthNMappingAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *AuthNMappingAttributes) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetSamlAssertionAttributeId returns the SamlAssertionAttributeId field value if set, zero value otherwise. -func (o *AuthNMappingAttributes) GetSamlAssertionAttributeId() string { - if o == nil || o.SamlAssertionAttributeId == nil { - var ret string - return ret - } - return *o.SamlAssertionAttributeId -} - -// GetSamlAssertionAttributeIdOk returns a tuple with the SamlAssertionAttributeId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingAttributes) GetSamlAssertionAttributeIdOk() (*string, bool) { - if o == nil || o.SamlAssertionAttributeId == nil { - return nil, false - } - return o.SamlAssertionAttributeId, true -} - -// HasSamlAssertionAttributeId returns a boolean if a field has been set. -func (o *AuthNMappingAttributes) HasSamlAssertionAttributeId() bool { - if o != nil && o.SamlAssertionAttributeId != nil { - return true - } - - return false -} - -// SetSamlAssertionAttributeId gets a reference to the given string and assigns it to the SamlAssertionAttributeId field. -func (o *AuthNMappingAttributes) SetSamlAssertionAttributeId(v string) { - o.SamlAssertionAttributeId = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AttributeKey != nil { - toSerialize["attribute_key"] = o.AttributeKey - } - if o.AttributeValue != nil { - toSerialize["attribute_value"] = o.AttributeValue - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.SamlAssertionAttributeId != nil { - toSerialize["saml_assertion_attribute_id"] = o.SamlAssertionAttributeId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AttributeKey *string `json:"attribute_key,omitempty"` - AttributeValue *string `json:"attribute_value,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - SamlAssertionAttributeId *string `json:"saml_assertion_attribute_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AttributeKey = all.AttributeKey - o.AttributeValue = all.AttributeValue - o.CreatedAt = all.CreatedAt - o.ModifiedAt = all.ModifiedAt - o.SamlAssertionAttributeId = all.SamlAssertionAttributeId - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_create_attributes.go b/api/v2/datadog/model_auth_n_mapping_create_attributes.go deleted file mode 100644 index 59dfd1beb1c..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_create_attributes.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingCreateAttributes Key/Value pair of attributes used for create request. -type AuthNMappingCreateAttributes struct { - // Key portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeKey *string `json:"attribute_key,omitempty"` - // Value portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeValue *string `json:"attribute_value,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{} -} - -// NewAuthNMappingCreateAttributes instantiates a new AuthNMappingCreateAttributes 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 NewAuthNMappingCreateAttributes() *AuthNMappingCreateAttributes { - this := AuthNMappingCreateAttributes{} - return &this -} - -// NewAuthNMappingCreateAttributesWithDefaults instantiates a new AuthNMappingCreateAttributes 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 NewAuthNMappingCreateAttributesWithDefaults() *AuthNMappingCreateAttributes { - this := AuthNMappingCreateAttributes{} - return &this -} - -// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. -func (o *AuthNMappingCreateAttributes) GetAttributeKey() string { - if o == nil || o.AttributeKey == nil { - var ret string - return ret - } - return *o.AttributeKey -} - -// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingCreateAttributes) GetAttributeKeyOk() (*string, bool) { - if o == nil || o.AttributeKey == nil { - return nil, false - } - return o.AttributeKey, true -} - -// HasAttributeKey returns a boolean if a field has been set. -func (o *AuthNMappingCreateAttributes) HasAttributeKey() bool { - if o != nil && o.AttributeKey != nil { - return true - } - - return false -} - -// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. -func (o *AuthNMappingCreateAttributes) SetAttributeKey(v string) { - o.AttributeKey = &v -} - -// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. -func (o *AuthNMappingCreateAttributes) GetAttributeValue() string { - if o == nil || o.AttributeValue == nil { - var ret string - return ret - } - return *o.AttributeValue -} - -// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingCreateAttributes) GetAttributeValueOk() (*string, bool) { - if o == nil || o.AttributeValue == nil { - return nil, false - } - return o.AttributeValue, true -} - -// HasAttributeValue returns a boolean if a field has been set. -func (o *AuthNMappingCreateAttributes) HasAttributeValue() bool { - if o != nil && o.AttributeValue != nil { - return true - } - - return false -} - -// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. -func (o *AuthNMappingCreateAttributes) SetAttributeValue(v string) { - o.AttributeValue = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AttributeKey != nil { - toSerialize["attribute_key"] = o.AttributeKey - } - if o.AttributeValue != nil { - toSerialize["attribute_value"] = o.AttributeValue - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AttributeKey *string `json:"attribute_key,omitempty"` - AttributeValue *string `json:"attribute_value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AttributeKey = all.AttributeKey - o.AttributeValue = all.AttributeValue - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_create_data.go b/api/v2/datadog/model_auth_n_mapping_create_data.go deleted file mode 100644 index 51b145169b2..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_create_data.go +++ /dev/null @@ -1,205 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuthNMappingCreateData Data for creating an AuthN Mapping. -type AuthNMappingCreateData struct { - // Key/Value pair of attributes used for create request. - Attributes *AuthNMappingCreateAttributes `json:"attributes,omitempty"` - // Relationship of AuthN Mapping create object to Role. - Relationships *AuthNMappingCreateRelationships `json:"relationships,omitempty"` - // AuthN Mappings resource type. - Type AuthNMappingsType `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{} -} - -// NewAuthNMappingCreateData instantiates a new AuthNMappingCreateData 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 NewAuthNMappingCreateData(typeVar AuthNMappingsType) *AuthNMappingCreateData { - this := AuthNMappingCreateData{} - this.Type = typeVar - return &this -} - -// NewAuthNMappingCreateDataWithDefaults instantiates a new AuthNMappingCreateData 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 NewAuthNMappingCreateDataWithDefaults() *AuthNMappingCreateData { - this := AuthNMappingCreateData{} - var typeVar AuthNMappingsType = AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *AuthNMappingCreateData) GetAttributes() AuthNMappingCreateAttributes { - if o == nil || o.Attributes == nil { - var ret AuthNMappingCreateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingCreateData) GetAttributesOk() (*AuthNMappingCreateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *AuthNMappingCreateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given AuthNMappingCreateAttributes and assigns it to the Attributes field. -func (o *AuthNMappingCreateData) SetAttributes(v AuthNMappingCreateAttributes) { - o.Attributes = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *AuthNMappingCreateData) GetRelationships() AuthNMappingCreateRelationships { - if o == nil || o.Relationships == nil { - var ret AuthNMappingCreateRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingCreateData) GetRelationshipsOk() (*AuthNMappingCreateRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *AuthNMappingCreateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given AuthNMappingCreateRelationships and assigns it to the Relationships field. -func (o *AuthNMappingCreateData) SetRelationships(v AuthNMappingCreateRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *AuthNMappingCreateData) GetType() AuthNMappingsType { - if o == nil { - var ret AuthNMappingsType - 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 *AuthNMappingCreateData) GetTypeOk() (*AuthNMappingsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *AuthNMappingCreateData) SetType(v AuthNMappingsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *AuthNMappingsType `json:"type"` - }{} - all := struct { - Attributes *AuthNMappingCreateAttributes `json:"attributes,omitempty"` - Relationships *AuthNMappingCreateRelationships `json:"relationships,omitempty"` - Type AuthNMappingsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_create_relationships.go b/api/v2/datadog/model_auth_n_mapping_create_relationships.go deleted file mode 100644 index 9def57522d8..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_create_relationships.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingCreateRelationships Relationship of AuthN Mapping create object to Role. -type AuthNMappingCreateRelationships struct { - // Relationship to role. - Role *RelationshipToRole `json:"role,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{} -} - -// NewAuthNMappingCreateRelationships instantiates a new AuthNMappingCreateRelationships 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 NewAuthNMappingCreateRelationships() *AuthNMappingCreateRelationships { - this := AuthNMappingCreateRelationships{} - return &this -} - -// NewAuthNMappingCreateRelationshipsWithDefaults instantiates a new AuthNMappingCreateRelationships 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 NewAuthNMappingCreateRelationshipsWithDefaults() *AuthNMappingCreateRelationships { - this := AuthNMappingCreateRelationships{} - return &this -} - -// GetRole returns the Role field value if set, zero value otherwise. -func (o *AuthNMappingCreateRelationships) GetRole() RelationshipToRole { - if o == nil || o.Role == nil { - var ret RelationshipToRole - return ret - } - return *o.Role -} - -// GetRoleOk returns a tuple with the Role field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingCreateRelationships) GetRoleOk() (*RelationshipToRole, bool) { - if o == nil || o.Role == nil { - return nil, false - } - return o.Role, true -} - -// HasRole returns a boolean if a field has been set. -func (o *AuthNMappingCreateRelationships) HasRole() bool { - if o != nil && o.Role != nil { - return true - } - - return false -} - -// SetRole gets a reference to the given RelationshipToRole and assigns it to the Role field. -func (o *AuthNMappingCreateRelationships) SetRole(v RelationshipToRole) { - o.Role = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingCreateRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Role != nil { - toSerialize["role"] = o.Role - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Role *RelationshipToRole `json:"role,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Role = all.Role - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_create_request.go b/api/v2/datadog/model_auth_n_mapping_create_request.go deleted file mode 100644 index f8ccb2f178e..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuthNMappingCreateRequest Request for creating an AuthN Mapping. -type AuthNMappingCreateRequest struct { - // Data for creating an AuthN Mapping. - Data AuthNMappingCreateData `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{} -} - -// NewAuthNMappingCreateRequest instantiates a new AuthNMappingCreateRequest 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 NewAuthNMappingCreateRequest(data AuthNMappingCreateData) *AuthNMappingCreateRequest { - this := AuthNMappingCreateRequest{} - this.Data = data - return &this -} - -// NewAuthNMappingCreateRequestWithDefaults instantiates a new AuthNMappingCreateRequest 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 NewAuthNMappingCreateRequestWithDefaults() *AuthNMappingCreateRequest { - this := AuthNMappingCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *AuthNMappingCreateRequest) GetData() AuthNMappingCreateData { - if o == nil { - var ret AuthNMappingCreateData - 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 *AuthNMappingCreateRequest) GetDataOk() (*AuthNMappingCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *AuthNMappingCreateRequest) SetData(v AuthNMappingCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *AuthNMappingCreateData `json:"data"` - }{} - all := struct { - Data AuthNMappingCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_included.go b/api/v2/datadog/model_auth_n_mapping_included.go deleted file mode 100644 index 0558fa1629e..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_included.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingIncluded - Included data in the AuthN Mapping response. -type AuthNMappingIncluded struct { - SAMLAssertionAttribute *SAMLAssertionAttribute - Role *Role - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// SAMLAssertionAttributeAsAuthNMappingIncluded is a convenience function that returns SAMLAssertionAttribute wrapped in AuthNMappingIncluded. -func SAMLAssertionAttributeAsAuthNMappingIncluded(v *SAMLAssertionAttribute) AuthNMappingIncluded { - return AuthNMappingIncluded{SAMLAssertionAttribute: v} -} - -// RoleAsAuthNMappingIncluded is a convenience function that returns Role wrapped in AuthNMappingIncluded. -func RoleAsAuthNMappingIncluded(v *Role) AuthNMappingIncluded { - return AuthNMappingIncluded{Role: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *AuthNMappingIncluded) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into SAMLAssertionAttribute - err = json.Unmarshal(data, &obj.SAMLAssertionAttribute) - if err == nil { - if obj.SAMLAssertionAttribute != nil && obj.SAMLAssertionAttribute.UnparsedObject == nil { - jsonSAMLAssertionAttribute, _ := json.Marshal(obj.SAMLAssertionAttribute) - if string(jsonSAMLAssertionAttribute) == "{}" { // empty struct - obj.SAMLAssertionAttribute = nil - } else { - match++ - } - } else { - obj.SAMLAssertionAttribute = nil - } - } else { - obj.SAMLAssertionAttribute = nil - } - - // try to unmarshal data into Role - err = json.Unmarshal(data, &obj.Role) - if err == nil { - if obj.Role != nil && obj.Role.UnparsedObject == nil { - jsonRole, _ := json.Marshal(obj.Role) - if string(jsonRole) == "{}" { // empty struct - obj.Role = nil - } else { - match++ - } - } else { - obj.Role = nil - } - } else { - obj.Role = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.SAMLAssertionAttribute = nil - obj.Role = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj AuthNMappingIncluded) MarshalJSON() ([]byte, error) { - if obj.SAMLAssertionAttribute != nil { - return json.Marshal(&obj.SAMLAssertionAttribute) - } - - if obj.Role != nil { - return json.Marshal(&obj.Role) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *AuthNMappingIncluded) GetActualInstance() interface{} { - if obj.SAMLAssertionAttribute != nil { - return obj.SAMLAssertionAttribute - } - - if obj.Role != nil { - return obj.Role - } - - // all schemas are nil - return nil -} - -// NullableAuthNMappingIncluded handles when a null is used for AuthNMappingIncluded. -type NullableAuthNMappingIncluded struct { - value *AuthNMappingIncluded - isSet bool -} - -// Get returns the associated value. -func (v NullableAuthNMappingIncluded) Get() *AuthNMappingIncluded { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuthNMappingIncluded) Set(val *AuthNMappingIncluded) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuthNMappingIncluded) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableAuthNMappingIncluded) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuthNMappingIncluded initializes the struct as if Set has been called. -func NewNullableAuthNMappingIncluded(val *AuthNMappingIncluded) *NullableAuthNMappingIncluded { - return &NullableAuthNMappingIncluded{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuthNMappingIncluded) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuthNMappingIncluded) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_auth_n_mapping_relationships.go b/api/v2/datadog/model_auth_n_mapping_relationships.go deleted file mode 100644 index e7ca71a40c2..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_relationships.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingRelationships All relationships associated with AuthN Mapping. -type AuthNMappingRelationships struct { - // Relationship to role. - Role *RelationshipToRole `json:"role,omitempty"` - // AuthN Mapping relationship to SAML Assertion Attribute. - SamlAssertionAttribute *RelationshipToSAMLAssertionAttribute `json:"saml_assertion_attribute,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{} -} - -// NewAuthNMappingRelationships instantiates a new AuthNMappingRelationships 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 NewAuthNMappingRelationships() *AuthNMappingRelationships { - this := AuthNMappingRelationships{} - return &this -} - -// NewAuthNMappingRelationshipsWithDefaults instantiates a new AuthNMappingRelationships 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 NewAuthNMappingRelationshipsWithDefaults() *AuthNMappingRelationships { - this := AuthNMappingRelationships{} - return &this -} - -// GetRole returns the Role field value if set, zero value otherwise. -func (o *AuthNMappingRelationships) GetRole() RelationshipToRole { - if o == nil || o.Role == nil { - var ret RelationshipToRole - return ret - } - return *o.Role -} - -// GetRoleOk returns a tuple with the Role field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingRelationships) GetRoleOk() (*RelationshipToRole, bool) { - if o == nil || o.Role == nil { - return nil, false - } - return o.Role, true -} - -// HasRole returns a boolean if a field has been set. -func (o *AuthNMappingRelationships) HasRole() bool { - if o != nil && o.Role != nil { - return true - } - - return false -} - -// SetRole gets a reference to the given RelationshipToRole and assigns it to the Role field. -func (o *AuthNMappingRelationships) SetRole(v RelationshipToRole) { - o.Role = &v -} - -// GetSamlAssertionAttribute returns the SamlAssertionAttribute field value if set, zero value otherwise. -func (o *AuthNMappingRelationships) GetSamlAssertionAttribute() RelationshipToSAMLAssertionAttribute { - if o == nil || o.SamlAssertionAttribute == nil { - var ret RelationshipToSAMLAssertionAttribute - return ret - } - return *o.SamlAssertionAttribute -} - -// GetSamlAssertionAttributeOk returns a tuple with the SamlAssertionAttribute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingRelationships) GetSamlAssertionAttributeOk() (*RelationshipToSAMLAssertionAttribute, bool) { - if o == nil || o.SamlAssertionAttribute == nil { - return nil, false - } - return o.SamlAssertionAttribute, true -} - -// HasSamlAssertionAttribute returns a boolean if a field has been set. -func (o *AuthNMappingRelationships) HasSamlAssertionAttribute() bool { - if o != nil && o.SamlAssertionAttribute != nil { - return true - } - - return false -} - -// SetSamlAssertionAttribute gets a reference to the given RelationshipToSAMLAssertionAttribute and assigns it to the SamlAssertionAttribute field. -func (o *AuthNMappingRelationships) SetSamlAssertionAttribute(v RelationshipToSAMLAssertionAttribute) { - o.SamlAssertionAttribute = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Role != nil { - toSerialize["role"] = o.Role - } - if o.SamlAssertionAttribute != nil { - toSerialize["saml_assertion_attribute"] = o.SamlAssertionAttribute - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Role *RelationshipToRole `json:"role,omitempty"` - SamlAssertionAttribute *RelationshipToSAMLAssertionAttribute `json:"saml_assertion_attribute,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Role = all.Role - if all.SamlAssertionAttribute != nil && all.SamlAssertionAttribute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.SamlAssertionAttribute = all.SamlAssertionAttribute - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_response.go b/api/v2/datadog/model_auth_n_mapping_response.go deleted file mode 100644 index 0f7bff080cd..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingResponse AuthN Mapping response from the API. -type AuthNMappingResponse struct { - // The AuthN Mapping object returned by API. - Data *AuthNMapping `json:"data,omitempty"` - // Included data in the AuthN Mapping response. - Included []AuthNMappingIncluded `json:"included,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{} -} - -// NewAuthNMappingResponse instantiates a new AuthNMappingResponse 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 NewAuthNMappingResponse() *AuthNMappingResponse { - this := AuthNMappingResponse{} - return &this -} - -// NewAuthNMappingResponseWithDefaults instantiates a new AuthNMappingResponse 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 NewAuthNMappingResponseWithDefaults() *AuthNMappingResponse { - this := AuthNMappingResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *AuthNMappingResponse) GetData() AuthNMapping { - if o == nil || o.Data == nil { - var ret AuthNMapping - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingResponse) GetDataOk() (*AuthNMapping, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *AuthNMappingResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given AuthNMapping and assigns it to the Data field. -func (o *AuthNMappingResponse) SetData(v AuthNMapping) { - o.Data = &v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *AuthNMappingResponse) GetIncluded() []AuthNMappingIncluded { - if o == nil || o.Included == nil { - var ret []AuthNMappingIncluded - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingResponse) GetIncludedOk() (*[]AuthNMappingIncluded, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *AuthNMappingResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []AuthNMappingIncluded and assigns it to the Included field. -func (o *AuthNMappingResponse) SetIncluded(v []AuthNMappingIncluded) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *AuthNMapping `json:"data,omitempty"` - Included []AuthNMappingIncluded `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_update_attributes.go b/api/v2/datadog/model_auth_n_mapping_update_attributes.go deleted file mode 100644 index a9ef3a59740..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_update_attributes.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingUpdateAttributes Key/Value pair of attributes used for update request. -type AuthNMappingUpdateAttributes struct { - // Key portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeKey *string `json:"attribute_key,omitempty"` - // Value portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeValue *string `json:"attribute_value,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{} -} - -// NewAuthNMappingUpdateAttributes instantiates a new AuthNMappingUpdateAttributes 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 NewAuthNMappingUpdateAttributes() *AuthNMappingUpdateAttributes { - this := AuthNMappingUpdateAttributes{} - return &this -} - -// NewAuthNMappingUpdateAttributesWithDefaults instantiates a new AuthNMappingUpdateAttributes 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 NewAuthNMappingUpdateAttributesWithDefaults() *AuthNMappingUpdateAttributes { - this := AuthNMappingUpdateAttributes{} - return &this -} - -// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. -func (o *AuthNMappingUpdateAttributes) GetAttributeKey() string { - if o == nil || o.AttributeKey == nil { - var ret string - return ret - } - return *o.AttributeKey -} - -// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingUpdateAttributes) GetAttributeKeyOk() (*string, bool) { - if o == nil || o.AttributeKey == nil { - return nil, false - } - return o.AttributeKey, true -} - -// HasAttributeKey returns a boolean if a field has been set. -func (o *AuthNMappingUpdateAttributes) HasAttributeKey() bool { - if o != nil && o.AttributeKey != nil { - return true - } - - return false -} - -// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. -func (o *AuthNMappingUpdateAttributes) SetAttributeKey(v string) { - o.AttributeKey = &v -} - -// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. -func (o *AuthNMappingUpdateAttributes) GetAttributeValue() string { - if o == nil || o.AttributeValue == nil { - var ret string - return ret - } - return *o.AttributeValue -} - -// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingUpdateAttributes) GetAttributeValueOk() (*string, bool) { - if o == nil || o.AttributeValue == nil { - return nil, false - } - return o.AttributeValue, true -} - -// HasAttributeValue returns a boolean if a field has been set. -func (o *AuthNMappingUpdateAttributes) HasAttributeValue() bool { - if o != nil && o.AttributeValue != nil { - return true - } - - return false -} - -// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. -func (o *AuthNMappingUpdateAttributes) SetAttributeValue(v string) { - o.AttributeValue = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AttributeKey != nil { - toSerialize["attribute_key"] = o.AttributeKey - } - if o.AttributeValue != nil { - toSerialize["attribute_value"] = o.AttributeValue - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AttributeKey *string `json:"attribute_key,omitempty"` - AttributeValue *string `json:"attribute_value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AttributeKey = all.AttributeKey - o.AttributeValue = all.AttributeValue - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_update_data.go b/api/v2/datadog/model_auth_n_mapping_update_data.go deleted file mode 100644 index 16b8ec41e47..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_update_data.go +++ /dev/null @@ -1,238 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuthNMappingUpdateData Data for updating an AuthN Mapping. -type AuthNMappingUpdateData struct { - // Key/Value pair of attributes used for update request. - Attributes *AuthNMappingUpdateAttributes `json:"attributes,omitempty"` - // ID of the AuthN Mapping. - Id string `json:"id"` - // Relationship of AuthN Mapping update object to Role. - Relationships *AuthNMappingUpdateRelationships `json:"relationships,omitempty"` - // AuthN Mappings resource type. - Type AuthNMappingsType `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{} -} - -// NewAuthNMappingUpdateData instantiates a new AuthNMappingUpdateData 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 NewAuthNMappingUpdateData(id string, typeVar AuthNMappingsType) *AuthNMappingUpdateData { - this := AuthNMappingUpdateData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewAuthNMappingUpdateDataWithDefaults instantiates a new AuthNMappingUpdateData 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 NewAuthNMappingUpdateDataWithDefaults() *AuthNMappingUpdateData { - this := AuthNMappingUpdateData{} - var typeVar AuthNMappingsType = AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *AuthNMappingUpdateData) GetAttributes() AuthNMappingUpdateAttributes { - if o == nil || o.Attributes == nil { - var ret AuthNMappingUpdateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingUpdateData) GetAttributesOk() (*AuthNMappingUpdateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *AuthNMappingUpdateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given AuthNMappingUpdateAttributes and assigns it to the Attributes field. -func (o *AuthNMappingUpdateData) SetAttributes(v AuthNMappingUpdateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *AuthNMappingUpdateData) 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 *AuthNMappingUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *AuthNMappingUpdateData) SetId(v string) { - o.Id = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *AuthNMappingUpdateData) GetRelationships() AuthNMappingUpdateRelationships { - if o == nil || o.Relationships == nil { - var ret AuthNMappingUpdateRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingUpdateData) GetRelationshipsOk() (*AuthNMappingUpdateRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *AuthNMappingUpdateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given AuthNMappingUpdateRelationships and assigns it to the Relationships field. -func (o *AuthNMappingUpdateData) SetRelationships(v AuthNMappingUpdateRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *AuthNMappingUpdateData) GetType() AuthNMappingsType { - if o == nil { - var ret AuthNMappingsType - 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 *AuthNMappingUpdateData) GetTypeOk() (*AuthNMappingsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *AuthNMappingUpdateData) SetType(v AuthNMappingsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *AuthNMappingsType `json:"type"` - }{} - all := struct { - Attributes *AuthNMappingUpdateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Relationships *AuthNMappingUpdateRelationships `json:"relationships,omitempty"` - Type AuthNMappingsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_update_relationships.go b/api/v2/datadog/model_auth_n_mapping_update_relationships.go deleted file mode 100644 index 33849d11018..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_update_relationships.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingUpdateRelationships Relationship of AuthN Mapping update object to Role. -type AuthNMappingUpdateRelationships struct { - // Relationship to role. - Role *RelationshipToRole `json:"role,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{} -} - -// NewAuthNMappingUpdateRelationships instantiates a new AuthNMappingUpdateRelationships 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 NewAuthNMappingUpdateRelationships() *AuthNMappingUpdateRelationships { - this := AuthNMappingUpdateRelationships{} - return &this -} - -// NewAuthNMappingUpdateRelationshipsWithDefaults instantiates a new AuthNMappingUpdateRelationships 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 NewAuthNMappingUpdateRelationshipsWithDefaults() *AuthNMappingUpdateRelationships { - this := AuthNMappingUpdateRelationships{} - return &this -} - -// GetRole returns the Role field value if set, zero value otherwise. -func (o *AuthNMappingUpdateRelationships) GetRole() RelationshipToRole { - if o == nil || o.Role == nil { - var ret RelationshipToRole - return ret - } - return *o.Role -} - -// GetRoleOk returns a tuple with the Role field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingUpdateRelationships) GetRoleOk() (*RelationshipToRole, bool) { - if o == nil || o.Role == nil { - return nil, false - } - return o.Role, true -} - -// HasRole returns a boolean if a field has been set. -func (o *AuthNMappingUpdateRelationships) HasRole() bool { - if o != nil && o.Role != nil { - return true - } - - return false -} - -// SetRole gets a reference to the given RelationshipToRole and assigns it to the Role field. -func (o *AuthNMappingUpdateRelationships) SetRole(v RelationshipToRole) { - o.Role = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingUpdateRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Role != nil { - toSerialize["role"] = o.Role - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Role *RelationshipToRole `json:"role,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Role = all.Role - return nil -} diff --git a/api/v2/datadog/model_auth_n_mapping_update_request.go b/api/v2/datadog/model_auth_n_mapping_update_request.go deleted file mode 100644 index 7dbf5215d3d..00000000000 --- a/api/v2/datadog/model_auth_n_mapping_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuthNMappingUpdateRequest Request to update an AuthN Mapping. -type AuthNMappingUpdateRequest struct { - // Data for updating an AuthN Mapping. - Data AuthNMappingUpdateData `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{} -} - -// NewAuthNMappingUpdateRequest instantiates a new AuthNMappingUpdateRequest 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 NewAuthNMappingUpdateRequest(data AuthNMappingUpdateData) *AuthNMappingUpdateRequest { - this := AuthNMappingUpdateRequest{} - this.Data = data - return &this -} - -// NewAuthNMappingUpdateRequestWithDefaults instantiates a new AuthNMappingUpdateRequest 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 NewAuthNMappingUpdateRequestWithDefaults() *AuthNMappingUpdateRequest { - this := AuthNMappingUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *AuthNMappingUpdateRequest) GetData() AuthNMappingUpdateData { - if o == nil { - var ret AuthNMappingUpdateData - 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 *AuthNMappingUpdateRequest) GetDataOk() (*AuthNMappingUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *AuthNMappingUpdateRequest) SetData(v AuthNMappingUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *AuthNMappingUpdateData `json:"data"` - }{} - all := struct { - Data AuthNMappingUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_auth_n_mappings_response.go b/api/v2/datadog/model_auth_n_mappings_response.go deleted file mode 100644 index 07c93c5650d..00000000000 --- a/api/v2/datadog/model_auth_n_mappings_response.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// AuthNMappingsResponse Array of AuthN Mappings response. -type AuthNMappingsResponse struct { - // Array of returned AuthN Mappings. - Data []AuthNMapping `json:"data,omitempty"` - // Included data in the AuthN Mapping response. - Included []AuthNMappingIncluded `json:"included,omitempty"` - // Object describing meta attributes of response. - Meta *ResponseMetaAttributes `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{} -} - -// NewAuthNMappingsResponse instantiates a new AuthNMappingsResponse 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 NewAuthNMappingsResponse() *AuthNMappingsResponse { - this := AuthNMappingsResponse{} - return &this -} - -// NewAuthNMappingsResponseWithDefaults instantiates a new AuthNMappingsResponse 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 NewAuthNMappingsResponseWithDefaults() *AuthNMappingsResponse { - this := AuthNMappingsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *AuthNMappingsResponse) GetData() []AuthNMapping { - if o == nil || o.Data == nil { - var ret []AuthNMapping - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingsResponse) GetDataOk() (*[]AuthNMapping, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *AuthNMappingsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []AuthNMapping and assigns it to the Data field. -func (o *AuthNMappingsResponse) SetData(v []AuthNMapping) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *AuthNMappingsResponse) GetIncluded() []AuthNMappingIncluded { - if o == nil || o.Included == nil { - var ret []AuthNMappingIncluded - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AuthNMappingsResponse) GetIncludedOk() (*[]AuthNMappingIncluded, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *AuthNMappingsResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []AuthNMappingIncluded and assigns it to the Included field. -func (o *AuthNMappingsResponse) SetIncluded(v []AuthNMappingIncluded) { - o.Included = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *AuthNMappingsResponse) GetMeta() ResponseMetaAttributes { - if o == nil || o.Meta == nil { - var ret ResponseMetaAttributes - 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 *AuthNMappingsResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *AuthNMappingsResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. -func (o *AuthNMappingsResponse) SetMeta(v ResponseMetaAttributes) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AuthNMappingsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AuthNMappingsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []AuthNMapping `json:"data,omitempty"` - Included []AuthNMappingIncluded `json:"included,omitempty"` - Meta *ResponseMetaAttributes `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Included = all.Included - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_auth_n_mappings_sort.go b/api/v2/datadog/model_auth_n_mappings_sort.go deleted file mode 100644 index 1bcffc89b2f..00000000000 --- a/api/v2/datadog/model_auth_n_mappings_sort.go +++ /dev/null @@ -1,129 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuthNMappingsSort Sorting options for AuthN Mappings. -type AuthNMappingsSort string - -// List of AuthNMappingsSort. -const ( - AUTHNMAPPINGSSORT_CREATED_AT_ASCENDING AuthNMappingsSort = "created_at" - AUTHNMAPPINGSSORT_CREATED_AT_DESCENDING AuthNMappingsSort = "-created_at" - AUTHNMAPPINGSSORT_ROLE_ID_ASCENDING AuthNMappingsSort = "role_id" - AUTHNMAPPINGSSORT_ROLE_ID_DESCENDING AuthNMappingsSort = "-role_id" - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_ASCENDING AuthNMappingsSort = "saml_assertion_attribute_id" - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_DESCENDING AuthNMappingsSort = "-saml_assertion_attribute_id" - AUTHNMAPPINGSSORT_ROLE_NAME_ASCENDING AuthNMappingsSort = "role.name" - AUTHNMAPPINGSSORT_ROLE_NAME_DESCENDING AuthNMappingsSort = "-role.name" - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_ASCENDING AuthNMappingsSort = "saml_assertion_attribute.attribute_key" - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_DESCENDING AuthNMappingsSort = "-saml_assertion_attribute.attribute_key" - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_ASCENDING AuthNMappingsSort = "saml_assertion_attribute.attribute_value" - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_DESCENDING AuthNMappingsSort = "-saml_assertion_attribute.attribute_value" -) - -var allowedAuthNMappingsSortEnumValues = []AuthNMappingsSort{ - AUTHNMAPPINGSSORT_CREATED_AT_ASCENDING, - AUTHNMAPPINGSSORT_CREATED_AT_DESCENDING, - AUTHNMAPPINGSSORT_ROLE_ID_ASCENDING, - AUTHNMAPPINGSSORT_ROLE_ID_DESCENDING, - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_ASCENDING, - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_DESCENDING, - AUTHNMAPPINGSSORT_ROLE_NAME_ASCENDING, - AUTHNMAPPINGSSORT_ROLE_NAME_DESCENDING, - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_ASCENDING, - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_DESCENDING, - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_ASCENDING, - AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AuthNMappingsSort) GetAllowedValues() []AuthNMappingsSort { - return allowedAuthNMappingsSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AuthNMappingsSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AuthNMappingsSort(value) - return nil -} - -// NewAuthNMappingsSortFromValue returns a pointer to a valid AuthNMappingsSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAuthNMappingsSortFromValue(v string) (*AuthNMappingsSort, error) { - ev := AuthNMappingsSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AuthNMappingsSort: valid values are %v", v, allowedAuthNMappingsSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AuthNMappingsSort) IsValid() bool { - for _, existing := range allowedAuthNMappingsSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AuthNMappingsSort value. -func (v AuthNMappingsSort) Ptr() *AuthNMappingsSort { - return &v -} - -// NullableAuthNMappingsSort handles when a null is used for AuthNMappingsSort. -type NullableAuthNMappingsSort struct { - value *AuthNMappingsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableAuthNMappingsSort) Get() *AuthNMappingsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuthNMappingsSort) Set(val *AuthNMappingsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuthNMappingsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuthNMappingsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuthNMappingsSort initializes the struct as if Set has been called. -func NewNullableAuthNMappingsSort(val *AuthNMappingsSort) *NullableAuthNMappingsSort { - return &NullableAuthNMappingsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuthNMappingsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuthNMappingsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_auth_n_mappings_type.go b/api/v2/datadog/model_auth_n_mappings_type.go deleted file mode 100644 index 2b1d39786e4..00000000000 --- a/api/v2/datadog/model_auth_n_mappings_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// AuthNMappingsType AuthN Mappings resource type. -type AuthNMappingsType string - -// List of AuthNMappingsType. -const ( - AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS AuthNMappingsType = "authn_mappings" -) - -var allowedAuthNMappingsTypeEnumValues = []AuthNMappingsType{ - AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AuthNMappingsType) GetAllowedValues() []AuthNMappingsType { - return allowedAuthNMappingsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AuthNMappingsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AuthNMappingsType(value) - return nil -} - -// NewAuthNMappingsTypeFromValue returns a pointer to a valid AuthNMappingsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAuthNMappingsTypeFromValue(v string) (*AuthNMappingsType, error) { - ev := AuthNMappingsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AuthNMappingsType: valid values are %v", v, allowedAuthNMappingsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AuthNMappingsType) IsValid() bool { - for _, existing := range allowedAuthNMappingsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AuthNMappingsType value. -func (v AuthNMappingsType) Ptr() *AuthNMappingsType { - return &v -} - -// NullableAuthNMappingsType handles when a null is used for AuthNMappingsType. -type NullableAuthNMappingsType struct { - value *AuthNMappingsType - isSet bool -} - -// Get returns the associated value. -func (v NullableAuthNMappingsType) Get() *AuthNMappingsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableAuthNMappingsType) Set(val *AuthNMappingsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableAuthNMappingsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableAuthNMappingsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableAuthNMappingsType initializes the struct as if Set has been called. -func NewNullableAuthNMappingsType(val *AuthNMappingsType) *NullableAuthNMappingsType { - return &NullableAuthNMappingsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableAuthNMappingsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableAuthNMappingsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_chargeback_breakdown.go b/api/v2/datadog/model_chargeback_breakdown.go deleted file mode 100644 index bc88fd17acb..00000000000 --- a/api/v2/datadog/model_chargeback_breakdown.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ChargebackBreakdown Charges breakdown. -type ChargebackBreakdown struct { - // The type of charge for a particular product. - ChargeType *string `json:"charge_type,omitempty"` - // The cost for a particular product and charge type during a given month. - Cost *float64 `json:"cost,omitempty"` - // The product for which cost is being reported. - ProductName *string `json:"product_name,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{} -} - -// NewChargebackBreakdown instantiates a new ChargebackBreakdown 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 NewChargebackBreakdown() *ChargebackBreakdown { - this := ChargebackBreakdown{} - return &this -} - -// NewChargebackBreakdownWithDefaults instantiates a new ChargebackBreakdown 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 NewChargebackBreakdownWithDefaults() *ChargebackBreakdown { - this := ChargebackBreakdown{} - return &this -} - -// GetChargeType returns the ChargeType field value if set, zero value otherwise. -func (o *ChargebackBreakdown) GetChargeType() string { - if o == nil || o.ChargeType == nil { - var ret string - return ret - } - return *o.ChargeType -} - -// GetChargeTypeOk returns a tuple with the ChargeType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChargebackBreakdown) GetChargeTypeOk() (*string, bool) { - if o == nil || o.ChargeType == nil { - return nil, false - } - return o.ChargeType, true -} - -// HasChargeType returns a boolean if a field has been set. -func (o *ChargebackBreakdown) HasChargeType() bool { - if o != nil && o.ChargeType != nil { - return true - } - - return false -} - -// SetChargeType gets a reference to the given string and assigns it to the ChargeType field. -func (o *ChargebackBreakdown) SetChargeType(v string) { - o.ChargeType = &v -} - -// GetCost returns the Cost field value if set, zero value otherwise. -func (o *ChargebackBreakdown) GetCost() float64 { - if o == nil || o.Cost == nil { - var ret float64 - return ret - } - return *o.Cost -} - -// GetCostOk returns a tuple with the Cost field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChargebackBreakdown) GetCostOk() (*float64, bool) { - if o == nil || o.Cost == nil { - return nil, false - } - return o.Cost, true -} - -// HasCost returns a boolean if a field has been set. -func (o *ChargebackBreakdown) HasCost() bool { - if o != nil && o.Cost != nil { - return true - } - - return false -} - -// SetCost gets a reference to the given float64 and assigns it to the Cost field. -func (o *ChargebackBreakdown) SetCost(v float64) { - o.Cost = &v -} - -// GetProductName returns the ProductName field value if set, zero value otherwise. -func (o *ChargebackBreakdown) GetProductName() string { - if o == nil || o.ProductName == nil { - var ret string - return ret - } - return *o.ProductName -} - -// GetProductNameOk returns a tuple with the ProductName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ChargebackBreakdown) GetProductNameOk() (*string, bool) { - if o == nil || o.ProductName == nil { - return nil, false - } - return o.ProductName, true -} - -// HasProductName returns a boolean if a field has been set. -func (o *ChargebackBreakdown) HasProductName() bool { - if o != nil && o.ProductName != nil { - return true - } - - return false -} - -// SetProductName gets a reference to the given string and assigns it to the ProductName field. -func (o *ChargebackBreakdown) SetProductName(v string) { - o.ProductName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ChargebackBreakdown) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ChargeType != nil { - toSerialize["charge_type"] = o.ChargeType - } - if o.Cost != nil { - toSerialize["cost"] = o.Cost - } - if o.ProductName != nil { - toSerialize["product_name"] = o.ProductName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ChargebackBreakdown) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ChargeType *string `json:"charge_type,omitempty"` - Cost *float64 `json:"cost,omitempty"` - ProductName *string `json:"product_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ChargeType = all.ChargeType - o.Cost = all.Cost - o.ProductName = all.ProductName - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go deleted file mode 100644 index 3331dc2f5dd..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go +++ /dev/null @@ -1,506 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CloudWorkloadSecurityAgentRuleAttributes A Cloud Workload Security Agent rule returned by the API. -type CloudWorkloadSecurityAgentRuleAttributes struct { - // The category of the Agent rule. - Category *string `json:"category,omitempty"` - // When the Agent rule was created, timestamp in milliseconds. - CreationDate *int64 `json:"creationDate,omitempty"` - // The attributes of the user who created the Agent rule. - Creator *CloudWorkloadSecurityAgentRuleCreatorAttributes `json:"creator,omitempty"` - // Whether the rule is included by default. - DefaultRule *bool `json:"defaultRule,omitempty"` - // The description of the Agent rule. - Description *string `json:"description,omitempty"` - // Whether the Agent rule is enabled. - Enabled *bool `json:"enabled,omitempty"` - // The SECL expression of the Agent rule. - Expression *string `json:"expression,omitempty"` - // The name of the Agent rule. - Name *string `json:"name,omitempty"` - // When the Agent rule was last updated, timestamp in milliseconds. - UpdatedAt *int64 `json:"updatedAt,omitempty"` - // The attributes of the user who last updated the Agent rule. - Updater *CloudWorkloadSecurityAgentRuleUpdaterAttributes `json:"updater,omitempty"` - // The version of the Agent rule. - Version *int64 `json:"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{} -} - -// NewCloudWorkloadSecurityAgentRuleAttributes instantiates a new CloudWorkloadSecurityAgentRuleAttributes 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 NewCloudWorkloadSecurityAgentRuleAttributes() *CloudWorkloadSecurityAgentRuleAttributes { - this := CloudWorkloadSecurityAgentRuleAttributes{} - return &this -} - -// NewCloudWorkloadSecurityAgentRuleAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleAttributes 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 NewCloudWorkloadSecurityAgentRuleAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleAttributes { - this := CloudWorkloadSecurityAgentRuleAttributes{} - return &this -} - -// GetCategory returns the Category field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCategory() string { - if o == nil || o.Category == nil { - var ret string - return ret - } - return *o.Category -} - -// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCategoryOk() (*string, bool) { - if o == nil || o.Category == nil { - return nil, false - } - return o.Category, true -} - -// HasCategory returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCategory() bool { - if o != nil && o.Category != nil { - return true - } - - return false -} - -// SetCategory gets a reference to the given string and assigns it to the Category field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCategory(v string) { - o.Category = &v -} - -// GetCreationDate returns the CreationDate field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreationDate() int64 { - if o == nil || o.CreationDate == nil { - var ret int64 - return ret - } - return *o.CreationDate -} - -// GetCreationDateOk returns a tuple with the CreationDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreationDateOk() (*int64, bool) { - if o == nil || o.CreationDate == nil { - return nil, false - } - return o.CreationDate, true -} - -// HasCreationDate returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCreationDate() bool { - if o != nil && o.CreationDate != nil { - return true - } - - return false -} - -// SetCreationDate gets a reference to the given int64 and assigns it to the CreationDate field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCreationDate(v int64) { - o.CreationDate = &v -} - -// GetCreator returns the Creator field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreator() CloudWorkloadSecurityAgentRuleCreatorAttributes { - if o == nil || o.Creator == nil { - var ret CloudWorkloadSecurityAgentRuleCreatorAttributes - return ret - } - return *o.Creator -} - -// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreatorOk() (*CloudWorkloadSecurityAgentRuleCreatorAttributes, bool) { - if o == nil || o.Creator == nil { - return nil, false - } - return o.Creator, true -} - -// HasCreator returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCreator() bool { - if o != nil && o.Creator != nil { - return true - } - - return false -} - -// SetCreator gets a reference to the given CloudWorkloadSecurityAgentRuleCreatorAttributes and assigns it to the Creator field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCreator(v CloudWorkloadSecurityAgentRuleCreatorAttributes) { - o.Creator = &v -} - -// GetDefaultRule returns the DefaultRule field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDefaultRule() bool { - if o == nil || o.DefaultRule == nil { - var ret bool - return ret - } - return *o.DefaultRule -} - -// GetDefaultRuleOk returns a tuple with the DefaultRule field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDefaultRuleOk() (*bool, bool) { - if o == nil || o.DefaultRule == nil { - return nil, false - } - return o.DefaultRule, true -} - -// HasDefaultRule returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasDefaultRule() bool { - if o != nil && o.DefaultRule != nil { - return true - } - - return false -} - -// SetDefaultRule gets a reference to the given bool and assigns it to the DefaultRule field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetDefaultRule(v bool) { - o.DefaultRule = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetEnabled() bool { - if o == nil || o.Enabled == nil { - var ret bool - return ret - } - return *o.Enabled -} - -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetEnabledOk() (*bool, bool) { - if o == nil || o.Enabled == nil { - return nil, false - } - return o.Enabled, true -} - -// HasEnabled returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasEnabled() bool { - if o != nil && o.Enabled != nil { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetEnabled(v bool) { - o.Enabled = &v -} - -// GetExpression returns the Expression field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetExpression() string { - if o == nil || o.Expression == nil { - var ret string - return ret - } - return *o.Expression -} - -// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetExpressionOk() (*string, bool) { - if o == nil || o.Expression == nil { - return nil, false - } - return o.Expression, true -} - -// HasExpression returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasExpression() bool { - if o != nil && o.Expression != nil { - return true - } - - return false -} - -// SetExpression gets a reference to the given string and assigns it to the Expression field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetExpression(v string) { - o.Expression = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetName(v string) { - o.Name = &v -} - -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdatedAt() int64 { - if o == nil || o.UpdatedAt == nil { - var ret int64 - return ret - } - return *o.UpdatedAt -} - -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdatedAtOk() (*int64, bool) { - if o == nil || o.UpdatedAt == nil { - return nil, false - } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false -} - -// SetUpdatedAt gets a reference to the given int64 and assigns it to the UpdatedAt field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetUpdatedAt(v int64) { - o.UpdatedAt = &v -} - -// GetUpdater returns the Updater field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdater() CloudWorkloadSecurityAgentRuleUpdaterAttributes { - if o == nil || o.Updater == nil { - var ret CloudWorkloadSecurityAgentRuleUpdaterAttributes - return ret - } - return *o.Updater -} - -// GetUpdaterOk returns a tuple with the Updater field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdaterOk() (*CloudWorkloadSecurityAgentRuleUpdaterAttributes, bool) { - if o == nil || o.Updater == nil { - return nil, false - } - return o.Updater, true -} - -// HasUpdater returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasUpdater() bool { - if o != nil && o.Updater != nil { - return true - } - - return false -} - -// SetUpdater gets a reference to the given CloudWorkloadSecurityAgentRuleUpdaterAttributes and assigns it to the Updater field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetUpdater(v CloudWorkloadSecurityAgentRuleUpdaterAttributes) { - o.Updater = &v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleAttributes) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *CloudWorkloadSecurityAgentRuleAttributes) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Category != nil { - toSerialize["category"] = o.Category - } - if o.CreationDate != nil { - toSerialize["creationDate"] = o.CreationDate - } - if o.Creator != nil { - toSerialize["creator"] = o.Creator - } - if o.DefaultRule != nil { - toSerialize["defaultRule"] = o.DefaultRule - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Enabled != nil { - toSerialize["enabled"] = o.Enabled - } - if o.Expression != nil { - toSerialize["expression"] = o.Expression - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.UpdatedAt != nil { - toSerialize["updatedAt"] = o.UpdatedAt - } - if o.Updater != nil { - toSerialize["updater"] = o.Updater - } - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Category *string `json:"category,omitempty"` - CreationDate *int64 `json:"creationDate,omitempty"` - Creator *CloudWorkloadSecurityAgentRuleCreatorAttributes `json:"creator,omitempty"` - DefaultRule *bool `json:"defaultRule,omitempty"` - Description *string `json:"description,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Expression *string `json:"expression,omitempty"` - Name *string `json:"name,omitempty"` - UpdatedAt *int64 `json:"updatedAt,omitempty"` - Updater *CloudWorkloadSecurityAgentRuleUpdaterAttributes `json:"updater,omitempty"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Category = all.Category - o.CreationDate = all.CreationDate - if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Creator = all.Creator - o.DefaultRule = all.DefaultRule - o.Description = all.Description - o.Enabled = all.Enabled - o.Expression = all.Expression - o.Name = all.Name - o.UpdatedAt = all.UpdatedAt - if all.Updater != nil && all.Updater.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Updater = all.Updater - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go deleted file mode 100644 index 81d7c741703..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go +++ /dev/null @@ -1,214 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CloudWorkloadSecurityAgentRuleCreateAttributes Create a new Cloud Workload Security Agent rule. -type CloudWorkloadSecurityAgentRuleCreateAttributes struct { - // The description of the Agent rule. - Description *string `json:"description,omitempty"` - // Whether the Agent rule is enabled. - Enabled *bool `json:"enabled,omitempty"` - // The SECL expression of the Agent rule. - Expression string `json:"expression"` - // The name of the Agent rule. - Name string `json:"name"` - // 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{} -} - -// NewCloudWorkloadSecurityAgentRuleCreateAttributes instantiates a new CloudWorkloadSecurityAgentRuleCreateAttributes 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 NewCloudWorkloadSecurityAgentRuleCreateAttributes(expression string, name string) *CloudWorkloadSecurityAgentRuleCreateAttributes { - this := CloudWorkloadSecurityAgentRuleCreateAttributes{} - this.Expression = expression - this.Name = name - return &this -} - -// NewCloudWorkloadSecurityAgentRuleCreateAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreateAttributes 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 NewCloudWorkloadSecurityAgentRuleCreateAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleCreateAttributes { - this := CloudWorkloadSecurityAgentRuleCreateAttributes{} - return &this -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetEnabled() bool { - if o == nil || o.Enabled == nil { - var ret bool - return ret - } - return *o.Enabled -} - -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetEnabledOk() (*bool, bool) { - if o == nil || o.Enabled == nil { - return nil, false - } - return o.Enabled, true -} - -// HasEnabled returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) HasEnabled() bool { - if o != nil && o.Enabled != nil { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetEnabled(v bool) { - o.Enabled = &v -} - -// GetExpression returns the Expression field value. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetExpression() string { - if o == nil { - var ret string - return ret - } - return o.Expression -} - -// GetExpressionOk returns a tuple with the Expression field value -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetExpressionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Expression, true -} - -// SetExpression sets field value. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetExpression(v string) { - o.Expression = v -} - -// GetName returns the Name field value. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Enabled != nil { - toSerialize["enabled"] = o.Enabled - } - toSerialize["expression"] = o.Expression - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Expression *string `json:"expression"` - Name *string `json:"name"` - }{} - all := struct { - Description *string `json:"description,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Expression string `json:"expression"` - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Expression == nil { - return fmt.Errorf("Required field expression missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Description = all.Description - o.Enabled = all.Enabled - o.Expression = all.Expression - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go deleted file mode 100644 index 42752ccdc25..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CloudWorkloadSecurityAgentRuleCreateData Object for a single Agent rule. -type CloudWorkloadSecurityAgentRuleCreateData struct { - // Create a new Cloud Workload Security Agent rule. - Attributes CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` - // The type of the resource. The value should always be `agent_rule`. - Type CloudWorkloadSecurityAgentRuleType `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{} -} - -// NewCloudWorkloadSecurityAgentRuleCreateData instantiates a new CloudWorkloadSecurityAgentRuleCreateData 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 NewCloudWorkloadSecurityAgentRuleCreateData(attributes CloudWorkloadSecurityAgentRuleCreateAttributes, typeVar CloudWorkloadSecurityAgentRuleType) *CloudWorkloadSecurityAgentRuleCreateData { - this := CloudWorkloadSecurityAgentRuleCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewCloudWorkloadSecurityAgentRuleCreateDataWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreateData 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 NewCloudWorkloadSecurityAgentRuleCreateDataWithDefaults() *CloudWorkloadSecurityAgentRuleCreateData { - this := CloudWorkloadSecurityAgentRuleCreateData{} - var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *CloudWorkloadSecurityAgentRuleCreateData) GetAttributes() CloudWorkloadSecurityAgentRuleCreateAttributes { - if o == nil { - var ret CloudWorkloadSecurityAgentRuleCreateAttributes - 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 *CloudWorkloadSecurityAgentRuleCreateData) GetAttributesOk() (*CloudWorkloadSecurityAgentRuleCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *CloudWorkloadSecurityAgentRuleCreateData) SetAttributes(v CloudWorkloadSecurityAgentRuleCreateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *CloudWorkloadSecurityAgentRuleCreateData) GetType() CloudWorkloadSecurityAgentRuleType { - if o == nil { - var ret CloudWorkloadSecurityAgentRuleType - 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 *CloudWorkloadSecurityAgentRuleCreateData) GetTypeOk() (*CloudWorkloadSecurityAgentRuleType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *CloudWorkloadSecurityAgentRuleCreateData) SetType(v CloudWorkloadSecurityAgentRuleType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` - Type *CloudWorkloadSecurityAgentRuleType `json:"type"` - }{} - all := struct { - Attributes CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` - Type CloudWorkloadSecurityAgentRuleType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.go deleted file mode 100644 index b6183945ff0..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CloudWorkloadSecurityAgentRuleCreateRequest Request object that includes the Agent rule to create. -type CloudWorkloadSecurityAgentRuleCreateRequest struct { - // Object for a single Agent rule. - Data CloudWorkloadSecurityAgentRuleCreateData `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{} -} - -// NewCloudWorkloadSecurityAgentRuleCreateRequest instantiates a new CloudWorkloadSecurityAgentRuleCreateRequest 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 NewCloudWorkloadSecurityAgentRuleCreateRequest(data CloudWorkloadSecurityAgentRuleCreateData) *CloudWorkloadSecurityAgentRuleCreateRequest { - this := CloudWorkloadSecurityAgentRuleCreateRequest{} - this.Data = data - return &this -} - -// NewCloudWorkloadSecurityAgentRuleCreateRequestWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreateRequest 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 NewCloudWorkloadSecurityAgentRuleCreateRequestWithDefaults() *CloudWorkloadSecurityAgentRuleCreateRequest { - this := CloudWorkloadSecurityAgentRuleCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *CloudWorkloadSecurityAgentRuleCreateRequest) GetData() CloudWorkloadSecurityAgentRuleCreateData { - if o == nil { - var ret CloudWorkloadSecurityAgentRuleCreateData - 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 *CloudWorkloadSecurityAgentRuleCreateRequest) GetDataOk() (*CloudWorkloadSecurityAgentRuleCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *CloudWorkloadSecurityAgentRuleCreateRequest) SetData(v CloudWorkloadSecurityAgentRuleCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *CloudWorkloadSecurityAgentRuleCreateData `json:"data"` - }{} - all := struct { - Data CloudWorkloadSecurityAgentRuleCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go deleted file mode 100644 index 7791537dd63..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CloudWorkloadSecurityAgentRuleCreatorAttributes The attributes of the user who created the Agent rule. -type CloudWorkloadSecurityAgentRuleCreatorAttributes struct { - // The handle of the user. - Handle *string `json:"handle,omitempty"` - // The name of the user. - Name *string `json:"name,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{} -} - -// NewCloudWorkloadSecurityAgentRuleCreatorAttributes instantiates a new CloudWorkloadSecurityAgentRuleCreatorAttributes 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 NewCloudWorkloadSecurityAgentRuleCreatorAttributes() *CloudWorkloadSecurityAgentRuleCreatorAttributes { - this := CloudWorkloadSecurityAgentRuleCreatorAttributes{} - return &this -} - -// NewCloudWorkloadSecurityAgentRuleCreatorAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreatorAttributes 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 NewCloudWorkloadSecurityAgentRuleCreatorAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleCreatorAttributes { - this := CloudWorkloadSecurityAgentRuleCreatorAttributes{} - return &this -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) SetHandle(v string) { - o.Handle = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleCreatorAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Handle *string `json:"handle,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Handle = all.Handle - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_data.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_data.go deleted file mode 100644 index e90834fff00..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CloudWorkloadSecurityAgentRuleData Object for a single Agent rule. -type CloudWorkloadSecurityAgentRuleData struct { - // A Cloud Workload Security Agent rule returned by the API. - Attributes *CloudWorkloadSecurityAgentRuleAttributes `json:"attributes,omitempty"` - // The ID of the Agent rule. - Id *string `json:"id,omitempty"` - // The type of the resource. The value should always be `agent_rule`. - Type *CloudWorkloadSecurityAgentRuleType `json:"type,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{} -} - -// NewCloudWorkloadSecurityAgentRuleData instantiates a new CloudWorkloadSecurityAgentRuleData 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 NewCloudWorkloadSecurityAgentRuleData() *CloudWorkloadSecurityAgentRuleData { - this := CloudWorkloadSecurityAgentRuleData{} - var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE - this.Type = &typeVar - return &this -} - -// NewCloudWorkloadSecurityAgentRuleDataWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleData 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 NewCloudWorkloadSecurityAgentRuleDataWithDefaults() *CloudWorkloadSecurityAgentRuleData { - this := CloudWorkloadSecurityAgentRuleData{} - var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleData) GetAttributes() CloudWorkloadSecurityAgentRuleAttributes { - if o == nil || o.Attributes == nil { - var ret CloudWorkloadSecurityAgentRuleAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleData) GetAttributesOk() (*CloudWorkloadSecurityAgentRuleAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given CloudWorkloadSecurityAgentRuleAttributes and assigns it to the Attributes field. -func (o *CloudWorkloadSecurityAgentRuleData) SetAttributes(v CloudWorkloadSecurityAgentRuleAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *CloudWorkloadSecurityAgentRuleData) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleData) GetType() CloudWorkloadSecurityAgentRuleType { - if o == nil || o.Type == nil { - var ret CloudWorkloadSecurityAgentRuleType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleData) GetTypeOk() (*CloudWorkloadSecurityAgentRuleType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given CloudWorkloadSecurityAgentRuleType and assigns it to the Type field. -func (o *CloudWorkloadSecurityAgentRuleData) SetType(v CloudWorkloadSecurityAgentRuleType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *CloudWorkloadSecurityAgentRuleAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *CloudWorkloadSecurityAgentRuleType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_response.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_response.go deleted file mode 100644 index 2c3f43448b8..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CloudWorkloadSecurityAgentRuleResponse Response object that includes an Agent rule. -type CloudWorkloadSecurityAgentRuleResponse struct { - // Object for a single Agent rule. - Data *CloudWorkloadSecurityAgentRuleData `json:"data,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{} -} - -// NewCloudWorkloadSecurityAgentRuleResponse instantiates a new CloudWorkloadSecurityAgentRuleResponse 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 NewCloudWorkloadSecurityAgentRuleResponse() *CloudWorkloadSecurityAgentRuleResponse { - this := CloudWorkloadSecurityAgentRuleResponse{} - return &this -} - -// NewCloudWorkloadSecurityAgentRuleResponseWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleResponse 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 NewCloudWorkloadSecurityAgentRuleResponseWithDefaults() *CloudWorkloadSecurityAgentRuleResponse { - this := CloudWorkloadSecurityAgentRuleResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleResponse) GetData() CloudWorkloadSecurityAgentRuleData { - if o == nil || o.Data == nil { - var ret CloudWorkloadSecurityAgentRuleData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleResponse) GetDataOk() (*CloudWorkloadSecurityAgentRuleData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given CloudWorkloadSecurityAgentRuleData and assigns it to the Data field. -func (o *CloudWorkloadSecurityAgentRuleResponse) SetData(v CloudWorkloadSecurityAgentRuleData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_type.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_type.go deleted file mode 100644 index 6315c24c77d..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CloudWorkloadSecurityAgentRuleType The type of the resource. The value should always be `agent_rule`. -type CloudWorkloadSecurityAgentRuleType string - -// List of CloudWorkloadSecurityAgentRuleType. -const ( - CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE CloudWorkloadSecurityAgentRuleType = "agent_rule" -) - -var allowedCloudWorkloadSecurityAgentRuleTypeEnumValues = []CloudWorkloadSecurityAgentRuleType{ - CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *CloudWorkloadSecurityAgentRuleType) GetAllowedValues() []CloudWorkloadSecurityAgentRuleType { - return allowedCloudWorkloadSecurityAgentRuleTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *CloudWorkloadSecurityAgentRuleType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = CloudWorkloadSecurityAgentRuleType(value) - return nil -} - -// NewCloudWorkloadSecurityAgentRuleTypeFromValue returns a pointer to a valid CloudWorkloadSecurityAgentRuleType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewCloudWorkloadSecurityAgentRuleTypeFromValue(v string) (*CloudWorkloadSecurityAgentRuleType, error) { - ev := CloudWorkloadSecurityAgentRuleType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for CloudWorkloadSecurityAgentRuleType: valid values are %v", v, allowedCloudWorkloadSecurityAgentRuleTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v CloudWorkloadSecurityAgentRuleType) IsValid() bool { - for _, existing := range allowedCloudWorkloadSecurityAgentRuleTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to CloudWorkloadSecurityAgentRuleType value. -func (v CloudWorkloadSecurityAgentRuleType) Ptr() *CloudWorkloadSecurityAgentRuleType { - return &v -} - -// NullableCloudWorkloadSecurityAgentRuleType handles when a null is used for CloudWorkloadSecurityAgentRuleType. -type NullableCloudWorkloadSecurityAgentRuleType struct { - value *CloudWorkloadSecurityAgentRuleType - isSet bool -} - -// Get returns the associated value. -func (v NullableCloudWorkloadSecurityAgentRuleType) Get() *CloudWorkloadSecurityAgentRuleType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCloudWorkloadSecurityAgentRuleType) Set(val *CloudWorkloadSecurityAgentRuleType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCloudWorkloadSecurityAgentRuleType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCloudWorkloadSecurityAgentRuleType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCloudWorkloadSecurityAgentRuleType initializes the struct as if Set has been called. -func NewNullableCloudWorkloadSecurityAgentRuleType(val *CloudWorkloadSecurityAgentRuleType) *NullableCloudWorkloadSecurityAgentRuleType { - return &NullableCloudWorkloadSecurityAgentRuleType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCloudWorkloadSecurityAgentRuleType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCloudWorkloadSecurityAgentRuleType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go deleted file mode 100644 index e7e2f0a7104..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CloudWorkloadSecurityAgentRuleUpdateAttributes Update an existing Cloud Workload Security Agent rule. -type CloudWorkloadSecurityAgentRuleUpdateAttributes struct { - // The description of the Agent rule. - Description *string `json:"description,omitempty"` - // Whether the Agent rule is enabled. - Enabled *bool `json:"enabled,omitempty"` - // The SECL expression of the Agent rule. - Expression *string `json:"expression,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{} -} - -// NewCloudWorkloadSecurityAgentRuleUpdateAttributes instantiates a new CloudWorkloadSecurityAgentRuleUpdateAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdateAttributes() *CloudWorkloadSecurityAgentRuleUpdateAttributes { - this := CloudWorkloadSecurityAgentRuleUpdateAttributes{} - return &this -} - -// NewCloudWorkloadSecurityAgentRuleUpdateAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdateAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdateAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleUpdateAttributes { - this := CloudWorkloadSecurityAgentRuleUpdateAttributes{} - return &this -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetEnabled() bool { - if o == nil || o.Enabled == nil { - var ret bool - return ret - } - return *o.Enabled -} - -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetEnabledOk() (*bool, bool) { - if o == nil || o.Enabled == nil { - return nil, false - } - return o.Enabled, true -} - -// HasEnabled returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) HasEnabled() bool { - if o != nil && o.Enabled != nil { - return true - } - - return false -} - -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) SetEnabled(v bool) { - o.Enabled = &v -} - -// GetExpression returns the Expression field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetExpression() string { - if o == nil || o.Expression == nil { - var ret string - return ret - } - return *o.Expression -} - -// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetExpressionOk() (*string, bool) { - if o == nil || o.Expression == nil { - return nil, false - } - return o.Expression, true -} - -// HasExpression returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) HasExpression() bool { - if o != nil && o.Expression != nil { - return true - } - - return false -} - -// SetExpression gets a reference to the given string and assigns it to the Expression field. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) SetExpression(v string) { - o.Expression = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Enabled != nil { - toSerialize["enabled"] = o.Enabled - } - if o.Expression != nil { - toSerialize["expression"] = o.Expression - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Description *string `json:"description,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Expression *string `json:"expression,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Description = all.Description - o.Enabled = all.Enabled - o.Expression = all.Expression - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go deleted file mode 100644 index ef1bb5b7b2f..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CloudWorkloadSecurityAgentRuleUpdateData Object for a single Agent rule. -type CloudWorkloadSecurityAgentRuleUpdateData struct { - // Update an existing Cloud Workload Security Agent rule. - Attributes CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` - // The type of the resource. The value should always be `agent_rule`. - Type CloudWorkloadSecurityAgentRuleType `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{} -} - -// NewCloudWorkloadSecurityAgentRuleUpdateData instantiates a new CloudWorkloadSecurityAgentRuleUpdateData 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 NewCloudWorkloadSecurityAgentRuleUpdateData(attributes CloudWorkloadSecurityAgentRuleUpdateAttributes, typeVar CloudWorkloadSecurityAgentRuleType) *CloudWorkloadSecurityAgentRuleUpdateData { - this := CloudWorkloadSecurityAgentRuleUpdateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewCloudWorkloadSecurityAgentRuleUpdateDataWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdateData 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 NewCloudWorkloadSecurityAgentRuleUpdateDataWithDefaults() *CloudWorkloadSecurityAgentRuleUpdateData { - this := CloudWorkloadSecurityAgentRuleUpdateData{} - var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *CloudWorkloadSecurityAgentRuleUpdateData) GetAttributes() CloudWorkloadSecurityAgentRuleUpdateAttributes { - if o == nil { - var ret CloudWorkloadSecurityAgentRuleUpdateAttributes - 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 *CloudWorkloadSecurityAgentRuleUpdateData) GetAttributesOk() (*CloudWorkloadSecurityAgentRuleUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *CloudWorkloadSecurityAgentRuleUpdateData) SetAttributes(v CloudWorkloadSecurityAgentRuleUpdateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *CloudWorkloadSecurityAgentRuleUpdateData) GetType() CloudWorkloadSecurityAgentRuleType { - if o == nil { - var ret CloudWorkloadSecurityAgentRuleType - 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 *CloudWorkloadSecurityAgentRuleUpdateData) GetTypeOk() (*CloudWorkloadSecurityAgentRuleType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *CloudWorkloadSecurityAgentRuleUpdateData) SetType(v CloudWorkloadSecurityAgentRuleType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` - Type *CloudWorkloadSecurityAgentRuleType `json:"type"` - }{} - all := struct { - Attributes CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` - Type CloudWorkloadSecurityAgentRuleType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.go deleted file mode 100644 index 4a0205b65f1..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CloudWorkloadSecurityAgentRuleUpdateRequest Request object that includes the Agent rule with the attributes to update. -type CloudWorkloadSecurityAgentRuleUpdateRequest struct { - // Object for a single Agent rule. - Data CloudWorkloadSecurityAgentRuleUpdateData `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{} -} - -// NewCloudWorkloadSecurityAgentRuleUpdateRequest instantiates a new CloudWorkloadSecurityAgentRuleUpdateRequest 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 NewCloudWorkloadSecurityAgentRuleUpdateRequest(data CloudWorkloadSecurityAgentRuleUpdateData) *CloudWorkloadSecurityAgentRuleUpdateRequest { - this := CloudWorkloadSecurityAgentRuleUpdateRequest{} - this.Data = data - return &this -} - -// NewCloudWorkloadSecurityAgentRuleUpdateRequestWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdateRequest 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 NewCloudWorkloadSecurityAgentRuleUpdateRequestWithDefaults() *CloudWorkloadSecurityAgentRuleUpdateRequest { - this := CloudWorkloadSecurityAgentRuleUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) GetData() CloudWorkloadSecurityAgentRuleUpdateData { - if o == nil { - var ret CloudWorkloadSecurityAgentRuleUpdateData - 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 *CloudWorkloadSecurityAgentRuleUpdateRequest) GetDataOk() (*CloudWorkloadSecurityAgentRuleUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) SetData(v CloudWorkloadSecurityAgentRuleUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` - }{} - all := struct { - Data CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go deleted file mode 100644 index 61ee3f6c626..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CloudWorkloadSecurityAgentRuleUpdaterAttributes The attributes of the user who last updated the Agent rule. -type CloudWorkloadSecurityAgentRuleUpdaterAttributes struct { - // The handle of the user. - Handle *string `json:"handle,omitempty"` - // The name of the user. - Name *string `json:"name,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{} -} - -// NewCloudWorkloadSecurityAgentRuleUpdaterAttributes instantiates a new CloudWorkloadSecurityAgentRuleUpdaterAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdaterAttributes() *CloudWorkloadSecurityAgentRuleUpdaterAttributes { - this := CloudWorkloadSecurityAgentRuleUpdaterAttributes{} - return &this -} - -// NewCloudWorkloadSecurityAgentRuleUpdaterAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdaterAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdaterAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleUpdaterAttributes { - this := CloudWorkloadSecurityAgentRuleUpdaterAttributes{} - return &this -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) SetHandle(v string) { - o.Handle = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRuleUpdaterAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Handle *string `json:"handle,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Handle = all.Handle - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.go b/api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.go deleted file mode 100644 index 5460689af3a..00000000000 --- a/api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CloudWorkloadSecurityAgentRulesListResponse Response object that includes a list of Agent rule. -type CloudWorkloadSecurityAgentRulesListResponse struct { - // A list of Agent rules objects. - Data []CloudWorkloadSecurityAgentRuleData `json:"data,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{} -} - -// NewCloudWorkloadSecurityAgentRulesListResponse instantiates a new CloudWorkloadSecurityAgentRulesListResponse 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 NewCloudWorkloadSecurityAgentRulesListResponse() *CloudWorkloadSecurityAgentRulesListResponse { - this := CloudWorkloadSecurityAgentRulesListResponse{} - return &this -} - -// NewCloudWorkloadSecurityAgentRulesListResponseWithDefaults instantiates a new CloudWorkloadSecurityAgentRulesListResponse 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 NewCloudWorkloadSecurityAgentRulesListResponseWithDefaults() *CloudWorkloadSecurityAgentRulesListResponse { - this := CloudWorkloadSecurityAgentRulesListResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *CloudWorkloadSecurityAgentRulesListResponse) GetData() []CloudWorkloadSecurityAgentRuleData { - if o == nil || o.Data == nil { - var ret []CloudWorkloadSecurityAgentRuleData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CloudWorkloadSecurityAgentRulesListResponse) GetDataOk() (*[]CloudWorkloadSecurityAgentRuleData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *CloudWorkloadSecurityAgentRulesListResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []CloudWorkloadSecurityAgentRuleData and assigns it to the Data field. -func (o *CloudWorkloadSecurityAgentRulesListResponse) SetData(v []CloudWorkloadSecurityAgentRuleData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CloudWorkloadSecurityAgentRulesListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CloudWorkloadSecurityAgentRulesListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_content_encoding.go b/api/v2/datadog/model_content_encoding.go deleted file mode 100644 index 96c002db1df..00000000000 --- a/api/v2/datadog/model_content_encoding.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ContentEncoding HTTP header used to compress the media-type. -type ContentEncoding string - -// List of ContentEncoding. -const ( - CONTENTENCODING_GZIP ContentEncoding = "gzip" - CONTENTENCODING_DEFLATE ContentEncoding = "deflate" -) - -var allowedContentEncodingEnumValues = []ContentEncoding{ - CONTENTENCODING_GZIP, - CONTENTENCODING_DEFLATE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ContentEncoding) GetAllowedValues() []ContentEncoding { - return allowedContentEncodingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ContentEncoding) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ContentEncoding(value) - return nil -} - -// NewContentEncodingFromValue returns a pointer to a valid ContentEncoding -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewContentEncodingFromValue(v string) (*ContentEncoding, error) { - ev := ContentEncoding(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ContentEncoding: valid values are %v", v, allowedContentEncodingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ContentEncoding) IsValid() bool { - for _, existing := range allowedContentEncodingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ContentEncoding value. -func (v ContentEncoding) Ptr() *ContentEncoding { - return &v -} - -// NullableContentEncoding handles when a null is used for ContentEncoding. -type NullableContentEncoding struct { - value *ContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableContentEncoding) Get() *ContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableContentEncoding) Set(val *ContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableContentEncoding initializes the struct as if Set has been called. -func NewNullableContentEncoding(val *ContentEncoding) *NullableContentEncoding { - return &NullableContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_cost_by_org.go b/api/v2/datadog/model_cost_by_org.go deleted file mode 100644 index 5ef547548fb..00000000000 --- a/api/v2/datadog/model_cost_by_org.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CostByOrg Cost data. -type CostByOrg struct { - // Cost attributes data. - Attributes *CostByOrgAttributes `json:"attributes,omitempty"` - // Unique ID of the response. - Id *string `json:"id,omitempty"` - // Type of cost data. - Type *CostByOrgType `json:"type,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{} -} - -// NewCostByOrg instantiates a new CostByOrg 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 NewCostByOrg() *CostByOrg { - this := CostByOrg{} - var typeVar CostByOrgType = COSTBYORGTYPE_COST_BY_ORG - this.Type = &typeVar - return &this -} - -// NewCostByOrgWithDefaults instantiates a new CostByOrg 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 NewCostByOrgWithDefaults() *CostByOrg { - this := CostByOrg{} - var typeVar CostByOrgType = COSTBYORGTYPE_COST_BY_ORG - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *CostByOrg) GetAttributes() CostByOrgAttributes { - if o == nil || o.Attributes == nil { - var ret CostByOrgAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrg) GetAttributesOk() (*CostByOrgAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *CostByOrg) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given CostByOrgAttributes and assigns it to the Attributes field. -func (o *CostByOrg) SetAttributes(v CostByOrgAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *CostByOrg) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrg) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *CostByOrg) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *CostByOrg) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *CostByOrg) GetType() CostByOrgType { - if o == nil || o.Type == nil { - var ret CostByOrgType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrg) GetTypeOk() (*CostByOrgType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *CostByOrg) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given CostByOrgType and assigns it to the Type field. -func (o *CostByOrg) SetType(v CostByOrgType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CostByOrg) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CostByOrg) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *CostByOrgAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *CostByOrgType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_cost_by_org_attributes.go b/api/v2/datadog/model_cost_by_org_attributes.go deleted file mode 100644 index cea0b0d1166..00000000000 --- a/api/v2/datadog/model_cost_by_org_attributes.go +++ /dev/null @@ -1,263 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// CostByOrgAttributes Cost attributes data. -type CostByOrgAttributes struct { - // List of charges data reported for the requested month. - Charges []ChargebackBreakdown `json:"charges,omitempty"` - // The month requested. - Date *time.Time `json:"date,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The total cost of products for the month. - TotalCost *float64 `json:"total_cost,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{} -} - -// NewCostByOrgAttributes instantiates a new CostByOrgAttributes 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 NewCostByOrgAttributes() *CostByOrgAttributes { - this := CostByOrgAttributes{} - return &this -} - -// NewCostByOrgAttributesWithDefaults instantiates a new CostByOrgAttributes 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 NewCostByOrgAttributesWithDefaults() *CostByOrgAttributes { - this := CostByOrgAttributes{} - return &this -} - -// GetCharges returns the Charges field value if set, zero value otherwise. -func (o *CostByOrgAttributes) GetCharges() []ChargebackBreakdown { - if o == nil || o.Charges == nil { - var ret []ChargebackBreakdown - return ret - } - return o.Charges -} - -// GetChargesOk returns a tuple with the Charges field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrgAttributes) GetChargesOk() (*[]ChargebackBreakdown, bool) { - if o == nil || o.Charges == nil { - return nil, false - } - return &o.Charges, true -} - -// HasCharges returns a boolean if a field has been set. -func (o *CostByOrgAttributes) HasCharges() bool { - if o != nil && o.Charges != nil { - return true - } - - return false -} - -// SetCharges gets a reference to the given []ChargebackBreakdown and assigns it to the Charges field. -func (o *CostByOrgAttributes) SetCharges(v []ChargebackBreakdown) { - o.Charges = v -} - -// GetDate returns the Date field value if set, zero value otherwise. -func (o *CostByOrgAttributes) GetDate() time.Time { - if o == nil || o.Date == nil { - var ret time.Time - return ret - } - return *o.Date -} - -// GetDateOk returns a tuple with the Date field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrgAttributes) GetDateOk() (*time.Time, bool) { - if o == nil || o.Date == nil { - return nil, false - } - return o.Date, true -} - -// HasDate returns a boolean if a field has been set. -func (o *CostByOrgAttributes) HasDate() bool { - if o != nil && o.Date != nil { - return true - } - - return false -} - -// SetDate gets a reference to the given time.Time and assigns it to the Date field. -func (o *CostByOrgAttributes) SetDate(v time.Time) { - o.Date = &v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *CostByOrgAttributes) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrgAttributes) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *CostByOrgAttributes) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *CostByOrgAttributes) SetOrgName(v string) { - o.OrgName = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *CostByOrgAttributes) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrgAttributes) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *CostByOrgAttributes) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *CostByOrgAttributes) SetPublicId(v string) { - o.PublicId = &v -} - -// GetTotalCost returns the TotalCost field value if set, zero value otherwise. -func (o *CostByOrgAttributes) GetTotalCost() float64 { - if o == nil || o.TotalCost == nil { - var ret float64 - return ret - } - return *o.TotalCost -} - -// GetTotalCostOk returns a tuple with the TotalCost field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrgAttributes) GetTotalCostOk() (*float64, bool) { - if o == nil || o.TotalCost == nil { - return nil, false - } - return o.TotalCost, true -} - -// HasTotalCost returns a boolean if a field has been set. -func (o *CostByOrgAttributes) HasTotalCost() bool { - if o != nil && o.TotalCost != nil { - return true - } - - return false -} - -// SetTotalCost gets a reference to the given float64 and assigns it to the TotalCost field. -func (o *CostByOrgAttributes) SetTotalCost(v float64) { - o.TotalCost = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CostByOrgAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Charges != nil { - toSerialize["charges"] = o.Charges - } - if o.Date != nil { - if o.Date.Nanosecond() == 0 { - toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.TotalCost != nil { - toSerialize["total_cost"] = o.TotalCost - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CostByOrgAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Charges []ChargebackBreakdown `json:"charges,omitempty"` - Date *time.Time `json:"date,omitempty"` - OrgName *string `json:"org_name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - TotalCost *float64 `json:"total_cost,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Charges = all.Charges - o.Date = all.Date - o.OrgName = all.OrgName - o.PublicId = all.PublicId - o.TotalCost = all.TotalCost - return nil -} diff --git a/api/v2/datadog/model_cost_by_org_response.go b/api/v2/datadog/model_cost_by_org_response.go deleted file mode 100644 index 19cc6d64a0e..00000000000 --- a/api/v2/datadog/model_cost_by_org_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// CostByOrgResponse Chargeback Summary response. -type CostByOrgResponse struct { - // Response containing Chargeback Summary. - Data []CostByOrg `json:"data,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{} -} - -// NewCostByOrgResponse instantiates a new CostByOrgResponse 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 NewCostByOrgResponse() *CostByOrgResponse { - this := CostByOrgResponse{} - return &this -} - -// NewCostByOrgResponseWithDefaults instantiates a new CostByOrgResponse 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 NewCostByOrgResponseWithDefaults() *CostByOrgResponse { - this := CostByOrgResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *CostByOrgResponse) GetData() []CostByOrg { - if o == nil || o.Data == nil { - var ret []CostByOrg - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CostByOrgResponse) GetDataOk() (*[]CostByOrg, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *CostByOrgResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []CostByOrg and assigns it to the Data field. -func (o *CostByOrgResponse) SetData(v []CostByOrg) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CostByOrgResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CostByOrgResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []CostByOrg `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_cost_by_org_type.go b/api/v2/datadog/model_cost_by_org_type.go deleted file mode 100644 index 2d0ba68ffb6..00000000000 --- a/api/v2/datadog/model_cost_by_org_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// CostByOrgType Type of cost data. -type CostByOrgType string - -// List of CostByOrgType. -const ( - COSTBYORGTYPE_COST_BY_ORG CostByOrgType = "cost_by_org" -) - -var allowedCostByOrgTypeEnumValues = []CostByOrgType{ - COSTBYORGTYPE_COST_BY_ORG, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *CostByOrgType) GetAllowedValues() []CostByOrgType { - return allowedCostByOrgTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *CostByOrgType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = CostByOrgType(value) - return nil -} - -// NewCostByOrgTypeFromValue returns a pointer to a valid CostByOrgType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewCostByOrgTypeFromValue(v string) (*CostByOrgType, error) { - ev := CostByOrgType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for CostByOrgType: valid values are %v", v, allowedCostByOrgTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v CostByOrgType) IsValid() bool { - for _, existing := range allowedCostByOrgTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to CostByOrgType value. -func (v CostByOrgType) Ptr() *CostByOrgType { - return &v -} - -// NullableCostByOrgType handles when a null is used for CostByOrgType. -type NullableCostByOrgType struct { - value *CostByOrgType - isSet bool -} - -// Get returns the associated value. -func (v NullableCostByOrgType) Get() *CostByOrgType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCostByOrgType) Set(val *CostByOrgType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCostByOrgType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableCostByOrgType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCostByOrgType initializes the struct as if Set has been called. -func NewNullableCostByOrgType(val *CostByOrgType) *NullableCostByOrgType { - return &NullableCostByOrgType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCostByOrgType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCostByOrgType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_creator.go b/api/v2/datadog/model_creator.go deleted file mode 100644 index 315313e5ec5..00000000000 --- a/api/v2/datadog/model_creator.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Creator Creator of the object. -type Creator struct { - // Email of the creator. - Email *string `json:"email,omitempty"` - // Handle of the creator. - Handle *string `json:"handle,omitempty"` - // Name of the creator. - Name *string `json:"name,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{} -} - -// NewCreator instantiates a new Creator 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 NewCreator() *Creator { - this := Creator{} - return &this -} - -// NewCreatorWithDefaults instantiates a new Creator 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 NewCreatorWithDefaults() *Creator { - this := Creator{} - return &this -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *Creator) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Creator) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *Creator) HasEmail() bool { - if o != nil && o.Email != nil { - return true - } - - return false -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *Creator) SetEmail(v string) { - o.Email = &v -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *Creator) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Creator) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *Creator) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *Creator) SetHandle(v string) { - o.Handle = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *Creator) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Creator) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *Creator) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *Creator) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Creator) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Email *string `json:"email,omitempty"` - Handle *string `json:"handle,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Email = all.Email - o.Handle = all.Handle - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_add_items_request.go b/api/v2/datadog/model_dashboard_list_add_items_request.go deleted file mode 100644 index d43fdc9c2e5..00000000000 --- a/api/v2/datadog/model_dashboard_list_add_items_request.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListAddItemsRequest Request containing a list of dashboards to add. -type DashboardListAddItemsRequest struct { - // List of dashboards to add the dashboard list. - Dashboards []DashboardListItemRequest `json:"dashboards,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{} -} - -// NewDashboardListAddItemsRequest instantiates a new DashboardListAddItemsRequest 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 NewDashboardListAddItemsRequest() *DashboardListAddItemsRequest { - this := DashboardListAddItemsRequest{} - return &this -} - -// NewDashboardListAddItemsRequestWithDefaults instantiates a new DashboardListAddItemsRequest 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 NewDashboardListAddItemsRequestWithDefaults() *DashboardListAddItemsRequest { - this := DashboardListAddItemsRequest{} - return &this -} - -// GetDashboards returns the Dashboards field value if set, zero value otherwise. -func (o *DashboardListAddItemsRequest) GetDashboards() []DashboardListItemRequest { - if o == nil || o.Dashboards == nil { - var ret []DashboardListItemRequest - return ret - } - return o.Dashboards -} - -// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListAddItemsRequest) GetDashboardsOk() (*[]DashboardListItemRequest, bool) { - if o == nil || o.Dashboards == nil { - return nil, false - } - return &o.Dashboards, true -} - -// HasDashboards returns a boolean if a field has been set. -func (o *DashboardListAddItemsRequest) HasDashboards() bool { - if o != nil && o.Dashboards != nil { - return true - } - - return false -} - -// SetDashboards gets a reference to the given []DashboardListItemRequest and assigns it to the Dashboards field. -func (o *DashboardListAddItemsRequest) SetDashboards(v []DashboardListItemRequest) { - o.Dashboards = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListAddItemsRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Dashboards != nil { - toSerialize["dashboards"] = o.Dashboards - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListAddItemsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Dashboards = all.Dashboards - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_add_items_response.go b/api/v2/datadog/model_dashboard_list_add_items_response.go deleted file mode 100644 index 841a062d1b9..00000000000 --- a/api/v2/datadog/model_dashboard_list_add_items_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListAddItemsResponse Response containing a list of added dashboards. -type DashboardListAddItemsResponse struct { - // List of dashboards added to the dashboard list. - AddedDashboardsToList []DashboardListItemResponse `json:"added_dashboards_to_list,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{} -} - -// NewDashboardListAddItemsResponse instantiates a new DashboardListAddItemsResponse 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 NewDashboardListAddItemsResponse() *DashboardListAddItemsResponse { - this := DashboardListAddItemsResponse{} - return &this -} - -// NewDashboardListAddItemsResponseWithDefaults instantiates a new DashboardListAddItemsResponse 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 NewDashboardListAddItemsResponseWithDefaults() *DashboardListAddItemsResponse { - this := DashboardListAddItemsResponse{} - return &this -} - -// GetAddedDashboardsToList returns the AddedDashboardsToList field value if set, zero value otherwise. -func (o *DashboardListAddItemsResponse) GetAddedDashboardsToList() []DashboardListItemResponse { - if o == nil || o.AddedDashboardsToList == nil { - var ret []DashboardListItemResponse - return ret - } - return o.AddedDashboardsToList -} - -// GetAddedDashboardsToListOk returns a tuple with the AddedDashboardsToList field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListAddItemsResponse) GetAddedDashboardsToListOk() (*[]DashboardListItemResponse, bool) { - if o == nil || o.AddedDashboardsToList == nil { - return nil, false - } - return &o.AddedDashboardsToList, true -} - -// HasAddedDashboardsToList returns a boolean if a field has been set. -func (o *DashboardListAddItemsResponse) HasAddedDashboardsToList() bool { - if o != nil && o.AddedDashboardsToList != nil { - return true - } - - return false -} - -// SetAddedDashboardsToList gets a reference to the given []DashboardListItemResponse and assigns it to the AddedDashboardsToList field. -func (o *DashboardListAddItemsResponse) SetAddedDashboardsToList(v []DashboardListItemResponse) { - o.AddedDashboardsToList = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListAddItemsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AddedDashboardsToList != nil { - toSerialize["added_dashboards_to_list"] = o.AddedDashboardsToList - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListAddItemsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AddedDashboardsToList []DashboardListItemResponse `json:"added_dashboards_to_list,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AddedDashboardsToList = all.AddedDashboardsToList - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_delete_items_request.go b/api/v2/datadog/model_dashboard_list_delete_items_request.go deleted file mode 100644 index 0993ac16a2e..00000000000 --- a/api/v2/datadog/model_dashboard_list_delete_items_request.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListDeleteItemsRequest Request containing a list of dashboards to delete. -type DashboardListDeleteItemsRequest struct { - // List of dashboards to delete from the dashboard list. - Dashboards []DashboardListItemRequest `json:"dashboards,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{} -} - -// NewDashboardListDeleteItemsRequest instantiates a new DashboardListDeleteItemsRequest 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 NewDashboardListDeleteItemsRequest() *DashboardListDeleteItemsRequest { - this := DashboardListDeleteItemsRequest{} - return &this -} - -// NewDashboardListDeleteItemsRequestWithDefaults instantiates a new DashboardListDeleteItemsRequest 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 NewDashboardListDeleteItemsRequestWithDefaults() *DashboardListDeleteItemsRequest { - this := DashboardListDeleteItemsRequest{} - return &this -} - -// GetDashboards returns the Dashboards field value if set, zero value otherwise. -func (o *DashboardListDeleteItemsRequest) GetDashboards() []DashboardListItemRequest { - if o == nil || o.Dashboards == nil { - var ret []DashboardListItemRequest - return ret - } - return o.Dashboards -} - -// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListDeleteItemsRequest) GetDashboardsOk() (*[]DashboardListItemRequest, bool) { - if o == nil || o.Dashboards == nil { - return nil, false - } - return &o.Dashboards, true -} - -// HasDashboards returns a boolean if a field has been set. -func (o *DashboardListDeleteItemsRequest) HasDashboards() bool { - if o != nil && o.Dashboards != nil { - return true - } - - return false -} - -// SetDashboards gets a reference to the given []DashboardListItemRequest and assigns it to the Dashboards field. -func (o *DashboardListDeleteItemsRequest) SetDashboards(v []DashboardListItemRequest) { - o.Dashboards = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListDeleteItemsRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Dashboards != nil { - toSerialize["dashboards"] = o.Dashboards - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListDeleteItemsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Dashboards = all.Dashboards - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_delete_items_response.go b/api/v2/datadog/model_dashboard_list_delete_items_response.go deleted file mode 100644 index c30570d3896..00000000000 --- a/api/v2/datadog/model_dashboard_list_delete_items_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListDeleteItemsResponse Response containing a list of deleted dashboards. -type DashboardListDeleteItemsResponse struct { - // List of dashboards deleted from the dashboard list. - DeletedDashboardsFromList []DashboardListItemResponse `json:"deleted_dashboards_from_list,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{} -} - -// NewDashboardListDeleteItemsResponse instantiates a new DashboardListDeleteItemsResponse 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 NewDashboardListDeleteItemsResponse() *DashboardListDeleteItemsResponse { - this := DashboardListDeleteItemsResponse{} - return &this -} - -// NewDashboardListDeleteItemsResponseWithDefaults instantiates a new DashboardListDeleteItemsResponse 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 NewDashboardListDeleteItemsResponseWithDefaults() *DashboardListDeleteItemsResponse { - this := DashboardListDeleteItemsResponse{} - return &this -} - -// GetDeletedDashboardsFromList returns the DeletedDashboardsFromList field value if set, zero value otherwise. -func (o *DashboardListDeleteItemsResponse) GetDeletedDashboardsFromList() []DashboardListItemResponse { - if o == nil || o.DeletedDashboardsFromList == nil { - var ret []DashboardListItemResponse - return ret - } - return o.DeletedDashboardsFromList -} - -// GetDeletedDashboardsFromListOk returns a tuple with the DeletedDashboardsFromList field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListDeleteItemsResponse) GetDeletedDashboardsFromListOk() (*[]DashboardListItemResponse, bool) { - if o == nil || o.DeletedDashboardsFromList == nil { - return nil, false - } - return &o.DeletedDashboardsFromList, true -} - -// HasDeletedDashboardsFromList returns a boolean if a field has been set. -func (o *DashboardListDeleteItemsResponse) HasDeletedDashboardsFromList() bool { - if o != nil && o.DeletedDashboardsFromList != nil { - return true - } - - return false -} - -// SetDeletedDashboardsFromList gets a reference to the given []DashboardListItemResponse and assigns it to the DeletedDashboardsFromList field. -func (o *DashboardListDeleteItemsResponse) SetDeletedDashboardsFromList(v []DashboardListItemResponse) { - o.DeletedDashboardsFromList = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListDeleteItemsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DeletedDashboardsFromList != nil { - toSerialize["deleted_dashboards_from_list"] = o.DeletedDashboardsFromList - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListDeleteItemsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DeletedDashboardsFromList []DashboardListItemResponse `json:"deleted_dashboards_from_list,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DeletedDashboardsFromList = all.DeletedDashboardsFromList - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_item.go b/api/v2/datadog/model_dashboard_list_item.go deleted file mode 100644 index 4e4b6eb8874..00000000000 --- a/api/v2/datadog/model_dashboard_list_item.go +++ /dev/null @@ -1,550 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" -) - -// DashboardListItem A dashboard within a list. -type DashboardListItem struct { - // Creator of the object. - Author *Creator `json:"author,omitempty"` - // Date of creation of the dashboard. - Created *time.Time `json:"created,omitempty"` - // URL to the icon of the dashboard. - Icon *string `json:"icon,omitempty"` - // ID of the dashboard. - Id string `json:"id"` - // Whether or not the dashboard is in the favorites. - IsFavorite *bool `json:"is_favorite,omitempty"` - // Whether or not the dashboard is read only. - IsReadOnly *bool `json:"is_read_only,omitempty"` - // Whether the dashboard is publicly shared or not. - IsShared *bool `json:"is_shared,omitempty"` - // Date of last edition of the dashboard. - Modified *time.Time `json:"modified,omitempty"` - // Popularity of the dashboard. - Popularity *int32 `json:"popularity,omitempty"` - // Title of the dashboard. - Title *string `json:"title,omitempty"` - // The type of the dashboard. - Type DashboardType `json:"type"` - // URL path to the dashboard. - Url *string `json:"url,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{} -} - -// NewDashboardListItem instantiates a new DashboardListItem 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 NewDashboardListItem(id string, typeVar DashboardType) *DashboardListItem { - this := DashboardListItem{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewDashboardListItemWithDefaults instantiates a new DashboardListItem 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 NewDashboardListItemWithDefaults() *DashboardListItem { - this := DashboardListItem{} - return &this -} - -// GetAuthor returns the Author field value if set, zero value otherwise. -func (o *DashboardListItem) GetAuthor() Creator { - if o == nil || o.Author == nil { - var ret Creator - return ret - } - return *o.Author -} - -// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetAuthorOk() (*Creator, bool) { - if o == nil || o.Author == nil { - return nil, false - } - return o.Author, true -} - -// HasAuthor returns a boolean if a field has been set. -func (o *DashboardListItem) HasAuthor() bool { - if o != nil && o.Author != nil { - return true - } - - return false -} - -// SetAuthor gets a reference to the given Creator and assigns it to the Author field. -func (o *DashboardListItem) SetAuthor(v Creator) { - o.Author = &v -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *DashboardListItem) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *DashboardListItem) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *DashboardListItem) SetCreated(v time.Time) { - o.Created = &v -} - -// GetIcon returns the Icon field value if set, zero value otherwise. -func (o *DashboardListItem) GetIcon() string { - if o == nil || o.Icon == nil { - var ret string - return ret - } - return *o.Icon -} - -// GetIconOk returns a tuple with the Icon field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetIconOk() (*string, bool) { - if o == nil || o.Icon == nil { - return nil, false - } - return o.Icon, true -} - -// HasIcon returns a boolean if a field has been set. -func (o *DashboardListItem) HasIcon() bool { - if o != nil && o.Icon != nil { - return true - } - - return false -} - -// SetIcon gets a reference to the given string and assigns it to the Icon field. -func (o *DashboardListItem) SetIcon(v string) { - o.Icon = &v -} - -// GetId returns the Id field value. -func (o *DashboardListItem) 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 *DashboardListItem) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *DashboardListItem) SetId(v string) { - o.Id = v -} - -// GetIsFavorite returns the IsFavorite field value if set, zero value otherwise. -func (o *DashboardListItem) GetIsFavorite() bool { - if o == nil || o.IsFavorite == nil { - var ret bool - return ret - } - return *o.IsFavorite -} - -// GetIsFavoriteOk returns a tuple with the IsFavorite field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetIsFavoriteOk() (*bool, bool) { - if o == nil || o.IsFavorite == nil { - return nil, false - } - return o.IsFavorite, true -} - -// HasIsFavorite returns a boolean if a field has been set. -func (o *DashboardListItem) HasIsFavorite() bool { - if o != nil && o.IsFavorite != nil { - return true - } - - return false -} - -// SetIsFavorite gets a reference to the given bool and assigns it to the IsFavorite field. -func (o *DashboardListItem) SetIsFavorite(v bool) { - o.IsFavorite = &v -} - -// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. -func (o *DashboardListItem) GetIsReadOnly() bool { - if o == nil || o.IsReadOnly == nil { - var ret bool - return ret - } - return *o.IsReadOnly -} - -// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetIsReadOnlyOk() (*bool, bool) { - if o == nil || o.IsReadOnly == nil { - return nil, false - } - return o.IsReadOnly, true -} - -// HasIsReadOnly returns a boolean if a field has been set. -func (o *DashboardListItem) HasIsReadOnly() bool { - if o != nil && o.IsReadOnly != nil { - return true - } - - return false -} - -// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. -func (o *DashboardListItem) SetIsReadOnly(v bool) { - o.IsReadOnly = &v -} - -// GetIsShared returns the IsShared field value if set, zero value otherwise. -func (o *DashboardListItem) GetIsShared() bool { - if o == nil || o.IsShared == nil { - var ret bool - return ret - } - return *o.IsShared -} - -// GetIsSharedOk returns a tuple with the IsShared field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetIsSharedOk() (*bool, bool) { - if o == nil || o.IsShared == nil { - return nil, false - } - return o.IsShared, true -} - -// HasIsShared returns a boolean if a field has been set. -func (o *DashboardListItem) HasIsShared() bool { - if o != nil && o.IsShared != nil { - return true - } - - return false -} - -// SetIsShared gets a reference to the given bool and assigns it to the IsShared field. -func (o *DashboardListItem) SetIsShared(v bool) { - o.IsShared = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *DashboardListItem) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *DashboardListItem) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *DashboardListItem) SetModified(v time.Time) { - o.Modified = &v -} - -// GetPopularity returns the Popularity field value if set, zero value otherwise. -func (o *DashboardListItem) GetPopularity() int32 { - if o == nil || o.Popularity == nil { - var ret int32 - return ret - } - return *o.Popularity -} - -// GetPopularityOk returns a tuple with the Popularity field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetPopularityOk() (*int32, bool) { - if o == nil || o.Popularity == nil { - return nil, false - } - return o.Popularity, true -} - -// HasPopularity returns a boolean if a field has been set. -func (o *DashboardListItem) HasPopularity() bool { - if o != nil && o.Popularity != nil { - return true - } - - return false -} - -// SetPopularity gets a reference to the given int32 and assigns it to the Popularity field. -func (o *DashboardListItem) SetPopularity(v int32) { - o.Popularity = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *DashboardListItem) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *DashboardListItem) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *DashboardListItem) SetTitle(v string) { - o.Title = &v -} - -// GetType returns the Type field value. -func (o *DashboardListItem) GetType() DashboardType { - if o == nil { - var ret DashboardType - 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 *DashboardListItem) GetTypeOk() (*DashboardType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *DashboardListItem) SetType(v DashboardType) { - o.Type = v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *DashboardListItem) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItem) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *DashboardListItem) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *DashboardListItem) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListItem) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Author != nil { - toSerialize["author"] = o.Author - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Icon != nil { - toSerialize["icon"] = o.Icon - } - toSerialize["id"] = o.Id - if o.IsFavorite != nil { - toSerialize["is_favorite"] = o.IsFavorite - } - if o.IsReadOnly != nil { - toSerialize["is_read_only"] = o.IsReadOnly - } - if o.IsShared != nil { - toSerialize["is_shared"] = o.IsShared - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Popularity != nil { - toSerialize["popularity"] = o.Popularity - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - toSerialize["type"] = o.Type - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *DashboardType `json:"type"` - }{} - all := struct { - Author *Creator `json:"author,omitempty"` - Created *time.Time `json:"created,omitempty"` - Icon *string `json:"icon,omitempty"` - Id string `json:"id"` - IsFavorite *bool `json:"is_favorite,omitempty"` - IsReadOnly *bool `json:"is_read_only,omitempty"` - IsShared *bool `json:"is_shared,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Popularity *int32 `json:"popularity,omitempty"` - Title *string `json:"title,omitempty"` - Type DashboardType `json:"type"` - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Author = all.Author - o.Created = all.Created - o.Icon = all.Icon - o.Id = all.Id - o.IsFavorite = all.IsFavorite - o.IsReadOnly = all.IsReadOnly - o.IsShared = all.IsShared - o.Modified = all.Modified - o.Popularity = all.Popularity - o.Title = all.Title - o.Type = all.Type - o.Url = all.Url - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_item_request.go b/api/v2/datadog/model_dashboard_list_item_request.go deleted file mode 100644 index 2c801c68c62..00000000000 --- a/api/v2/datadog/model_dashboard_list_item_request.go +++ /dev/null @@ -1,144 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardListItemRequest A dashboard within a list. -type DashboardListItemRequest struct { - // ID of the dashboard. - Id string `json:"id"` - // The type of the dashboard. - Type DashboardType `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{} -} - -// NewDashboardListItemRequest instantiates a new DashboardListItemRequest 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 NewDashboardListItemRequest(id string, typeVar DashboardType) *DashboardListItemRequest { - this := DashboardListItemRequest{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewDashboardListItemRequestWithDefaults instantiates a new DashboardListItemRequest 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 NewDashboardListItemRequestWithDefaults() *DashboardListItemRequest { - this := DashboardListItemRequest{} - return &this -} - -// GetId returns the Id field value. -func (o *DashboardListItemRequest) 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 *DashboardListItemRequest) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *DashboardListItemRequest) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *DashboardListItemRequest) GetType() DashboardType { - if o == nil { - var ret DashboardType - 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 *DashboardListItemRequest) GetTypeOk() (*DashboardType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *DashboardListItemRequest) SetType(v DashboardType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListItemRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListItemRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *DashboardType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type DashboardType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_item_response.go b/api/v2/datadog/model_dashboard_list_item_response.go deleted file mode 100644 index f6f0b5afe18..00000000000 --- a/api/v2/datadog/model_dashboard_list_item_response.go +++ /dev/null @@ -1,144 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardListItemResponse A dashboard within a list. -type DashboardListItemResponse struct { - // ID of the dashboard. - Id string `json:"id"` - // The type of the dashboard. - Type DashboardType `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{} -} - -// NewDashboardListItemResponse instantiates a new DashboardListItemResponse 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 NewDashboardListItemResponse(id string, typeVar DashboardType) *DashboardListItemResponse { - this := DashboardListItemResponse{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewDashboardListItemResponseWithDefaults instantiates a new DashboardListItemResponse 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 NewDashboardListItemResponseWithDefaults() *DashboardListItemResponse { - this := DashboardListItemResponse{} - return &this -} - -// GetId returns the Id field value. -func (o *DashboardListItemResponse) 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 *DashboardListItemResponse) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *DashboardListItemResponse) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *DashboardListItemResponse) GetType() DashboardType { - if o == nil { - var ret DashboardType - 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 *DashboardListItemResponse) GetTypeOk() (*DashboardType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *DashboardListItemResponse) SetType(v DashboardType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListItemResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListItemResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *DashboardType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type DashboardType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_items.go b/api/v2/datadog/model_dashboard_list_items.go deleted file mode 100644 index 23ff5215d29..00000000000 --- a/api/v2/datadog/model_dashboard_list_items.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardListItems Dashboards within a list. -type DashboardListItems struct { - // List of dashboards in the dashboard list. - Dashboards []DashboardListItem `json:"dashboards"` - // Number of dashboards in the dashboard list. - Total *int64 `json:"total,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{} -} - -// NewDashboardListItems instantiates a new DashboardListItems 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 NewDashboardListItems(dashboards []DashboardListItem) *DashboardListItems { - this := DashboardListItems{} - this.Dashboards = dashboards - return &this -} - -// NewDashboardListItemsWithDefaults instantiates a new DashboardListItems 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 NewDashboardListItemsWithDefaults() *DashboardListItems { - this := DashboardListItems{} - return &this -} - -// GetDashboards returns the Dashboards field value. -func (o *DashboardListItems) GetDashboards() []DashboardListItem { - if o == nil { - var ret []DashboardListItem - return ret - } - return o.Dashboards -} - -// GetDashboardsOk returns a tuple with the Dashboards field value -// and a boolean to check if the value has been set. -func (o *DashboardListItems) GetDashboardsOk() (*[]DashboardListItem, bool) { - if o == nil { - return nil, false - } - return &o.Dashboards, true -} - -// SetDashboards sets field value. -func (o *DashboardListItems) SetDashboards(v []DashboardListItem) { - o.Dashboards = v -} - -// GetTotal returns the Total field value if set, zero value otherwise. -func (o *DashboardListItems) GetTotal() int64 { - if o == nil || o.Total == nil { - var ret int64 - return ret - } - return *o.Total -} - -// GetTotalOk returns a tuple with the Total field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListItems) GetTotalOk() (*int64, bool) { - if o == nil || o.Total == nil { - return nil, false - } - return o.Total, true -} - -// HasTotal returns a boolean if a field has been set. -func (o *DashboardListItems) HasTotal() bool { - if o != nil && o.Total != nil { - return true - } - - return false -} - -// SetTotal gets a reference to the given int64 and assigns it to the Total field. -func (o *DashboardListItems) SetTotal(v int64) { - o.Total = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListItems) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["dashboards"] = o.Dashboards - if o.Total != nil { - toSerialize["total"] = o.Total - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListItems) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Dashboards *[]DashboardListItem `json:"dashboards"` - }{} - all := struct { - Dashboards []DashboardListItem `json:"dashboards"` - Total *int64 `json:"total,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Dashboards == nil { - return fmt.Errorf("Required field dashboards missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Dashboards = all.Dashboards - o.Total = all.Total - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_update_items_request.go b/api/v2/datadog/model_dashboard_list_update_items_request.go deleted file mode 100644 index 6e719d903cd..00000000000 --- a/api/v2/datadog/model_dashboard_list_update_items_request.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListUpdateItemsRequest Request containing the list of dashboards to update to. -type DashboardListUpdateItemsRequest struct { - // List of dashboards to update the dashboard list to. - Dashboards []DashboardListItemRequest `json:"dashboards,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{} -} - -// NewDashboardListUpdateItemsRequest instantiates a new DashboardListUpdateItemsRequest 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 NewDashboardListUpdateItemsRequest() *DashboardListUpdateItemsRequest { - this := DashboardListUpdateItemsRequest{} - return &this -} - -// NewDashboardListUpdateItemsRequestWithDefaults instantiates a new DashboardListUpdateItemsRequest 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 NewDashboardListUpdateItemsRequestWithDefaults() *DashboardListUpdateItemsRequest { - this := DashboardListUpdateItemsRequest{} - return &this -} - -// GetDashboards returns the Dashboards field value if set, zero value otherwise. -func (o *DashboardListUpdateItemsRequest) GetDashboards() []DashboardListItemRequest { - if o == nil || o.Dashboards == nil { - var ret []DashboardListItemRequest - return ret - } - return o.Dashboards -} - -// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListUpdateItemsRequest) GetDashboardsOk() (*[]DashboardListItemRequest, bool) { - if o == nil || o.Dashboards == nil { - return nil, false - } - return &o.Dashboards, true -} - -// HasDashboards returns a boolean if a field has been set. -func (o *DashboardListUpdateItemsRequest) HasDashboards() bool { - if o != nil && o.Dashboards != nil { - return true - } - - return false -} - -// SetDashboards gets a reference to the given []DashboardListItemRequest and assigns it to the Dashboards field. -func (o *DashboardListUpdateItemsRequest) SetDashboards(v []DashboardListItemRequest) { - o.Dashboards = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListUpdateItemsRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Dashboards != nil { - toSerialize["dashboards"] = o.Dashboards - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListUpdateItemsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Dashboards = all.Dashboards - return nil -} diff --git a/api/v2/datadog/model_dashboard_list_update_items_response.go b/api/v2/datadog/model_dashboard_list_update_items_response.go deleted file mode 100644 index 69346e7deaa..00000000000 --- a/api/v2/datadog/model_dashboard_list_update_items_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// DashboardListUpdateItemsResponse Response containing a list of updated dashboards. -type DashboardListUpdateItemsResponse struct { - // List of dashboards in the dashboard list. - Dashboards []DashboardListItemResponse `json:"dashboards,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{} -} - -// NewDashboardListUpdateItemsResponse instantiates a new DashboardListUpdateItemsResponse 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 NewDashboardListUpdateItemsResponse() *DashboardListUpdateItemsResponse { - this := DashboardListUpdateItemsResponse{} - return &this -} - -// NewDashboardListUpdateItemsResponseWithDefaults instantiates a new DashboardListUpdateItemsResponse 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 NewDashboardListUpdateItemsResponseWithDefaults() *DashboardListUpdateItemsResponse { - this := DashboardListUpdateItemsResponse{} - return &this -} - -// GetDashboards returns the Dashboards field value if set, zero value otherwise. -func (o *DashboardListUpdateItemsResponse) GetDashboards() []DashboardListItemResponse { - if o == nil || o.Dashboards == nil { - var ret []DashboardListItemResponse - return ret - } - return o.Dashboards -} - -// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DashboardListUpdateItemsResponse) GetDashboardsOk() (*[]DashboardListItemResponse, bool) { - if o == nil || o.Dashboards == nil { - return nil, false - } - return &o.Dashboards, true -} - -// HasDashboards returns a boolean if a field has been set. -func (o *DashboardListUpdateItemsResponse) HasDashboards() bool { - if o != nil && o.Dashboards != nil { - return true - } - - return false -} - -// SetDashboards gets a reference to the given []DashboardListItemResponse and assigns it to the Dashboards field. -func (o *DashboardListUpdateItemsResponse) SetDashboards(v []DashboardListItemResponse) { - o.Dashboards = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o DashboardListUpdateItemsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Dashboards != nil { - toSerialize["dashboards"] = o.Dashboards - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *DashboardListUpdateItemsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Dashboards []DashboardListItemResponse `json:"dashboards,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Dashboards = all.Dashboards - return nil -} diff --git a/api/v2/datadog/model_dashboard_type.go b/api/v2/datadog/model_dashboard_type.go deleted file mode 100644 index 2d74daf3660..00000000000 --- a/api/v2/datadog/model_dashboard_type.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// DashboardType The type of the dashboard. -type DashboardType string - -// List of DashboardType. -const ( - DASHBOARDTYPE_CUSTOM_TIMEBOARD DashboardType = "custom_timeboard" - DASHBOARDTYPE_CUSTOM_SCREENBOARD DashboardType = "custom_screenboard" - DASHBOARDTYPE_INTEGRATION_SCREENBOARD DashboardType = "integration_screenboard" - DASHBOARDTYPE_INTEGRATION_TIMEBOARD DashboardType = "integration_timeboard" - DASHBOARDTYPE_HOST_TIMEBOARD DashboardType = "host_timeboard" -) - -var allowedDashboardTypeEnumValues = []DashboardType{ - DASHBOARDTYPE_CUSTOM_TIMEBOARD, - DASHBOARDTYPE_CUSTOM_SCREENBOARD, - DASHBOARDTYPE_INTEGRATION_SCREENBOARD, - DASHBOARDTYPE_INTEGRATION_TIMEBOARD, - DASHBOARDTYPE_HOST_TIMEBOARD, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *DashboardType) GetAllowedValues() []DashboardType { - return allowedDashboardTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *DashboardType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = DashboardType(value) - return nil -} - -// NewDashboardTypeFromValue returns a pointer to a valid DashboardType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDashboardTypeFromValue(v string) (*DashboardType, error) { - ev := DashboardType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for DashboardType: valid values are %v", v, allowedDashboardTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DashboardType) IsValid() bool { - for _, existing := range allowedDashboardTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DashboardType value. -func (v DashboardType) Ptr() *DashboardType { - return &v -} - -// NullableDashboardType handles when a null is used for DashboardType. -type NullableDashboardType struct { - value *DashboardType - isSet bool -} - -// Get returns the associated value. -func (v NullableDashboardType) Get() *DashboardType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableDashboardType) Set(val *DashboardType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableDashboardType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableDashboardType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableDashboardType initializes the struct as if Set has been called. -func NewNullableDashboardType(val *DashboardType) *NullableDashboardType { - return &NullableDashboardType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableDashboardType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableDashboardType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_event.go b/api/v2/datadog/model_event.go deleted file mode 100644 index cffc4f19fc1..00000000000 --- a/api/v2/datadog/model_event.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Event The metadata associated with a request. -type Event struct { - // Event ID. - Id *string `json:"id,omitempty"` - // The event name. - Name *string `json:"name,omitempty"` - // Event source ID. - SourceId *int32 `json:"source_id,omitempty"` - // Event type. - Type *string `json:"type,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{} -} - -// NewEvent instantiates a new Event 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 NewEvent() *Event { - this := Event{} - return &this -} - -// NewEventWithDefaults instantiates a new Event 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 NewEventWithDefaults() *Event { - this := Event{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Event) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Event) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Event) SetId(v string) { - o.Id = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *Event) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *Event) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *Event) SetName(v string) { - o.Name = &v -} - -// GetSourceId returns the SourceId field value if set, zero value otherwise. -func (o *Event) GetSourceId() int32 { - if o == nil || o.SourceId == nil { - var ret int32 - return ret - } - return *o.SourceId -} - -// GetSourceIdOk returns a tuple with the SourceId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetSourceIdOk() (*int32, bool) { - if o == nil || o.SourceId == nil { - return nil, false - } - return o.SourceId, true -} - -// HasSourceId returns a boolean if a field has been set. -func (o *Event) HasSourceId() bool { - if o != nil && o.SourceId != nil { - return true - } - - return false -} - -// SetSourceId gets a reference to the given int32 and assigns it to the SourceId field. -func (o *Event) SetSourceId(v int32) { - o.SourceId = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *Event) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Event) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *Event) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *Event) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Event) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.SourceId != nil { - toSerialize["source_id"] = o.SourceId - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Event) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - SourceId *int32 `json:"source_id,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Name = all.Name - o.SourceId = all.SourceId - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_event_attributes.go b/api/v2/datadog/model_event_attributes.go deleted file mode 100644 index 49768ea1ff2..00000000000 --- a/api/v2/datadog/model_event_attributes.go +++ /dev/null @@ -1,869 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// EventAttributes Object description of attributes from your event. -type EventAttributes struct { - // Aggregation key of the event. - AggregationKey *string `json:"aggregation_key,omitempty"` - // POSIX timestamp of the event. Must be sent as an integer (no quotation marks). - // Limited to events no older than 18 hours. - DateHappened *int64 `json:"date_happened,omitempty"` - // A device name. - DeviceName *string `json:"device_name,omitempty"` - // The duration between the triggering of the event and its recovery in nanoseconds. - Duration *int64 `json:"duration,omitempty"` - // The event title. - EventObject *string `json:"event_object,omitempty"` - // The metadata associated with a request. - Evt *Event `json:"evt,omitempty"` - // Host name to associate with the event. - // Any tags associated with the host are also applied to this event. - Hostname *string `json:"hostname,omitempty"` - // Attributes from the monitor that triggered the event. - Monitor NullableMonitorType `json:"monitor,omitempty"` - // List of groups referred to in the event. - MonitorGroups []string `json:"monitor_groups,omitempty"` - // ID of the monitor that triggered the event. When an event isn't related to a monitor, this field is empty. - MonitorId common.NullableInt32 `json:"monitor_id,omitempty"` - // The priority of the event's monitor. For example, `normal` or `low`. - Priority NullableEventPriority `json:"priority,omitempty"` - // Related event ID. - RelatedEventId *int32 `json:"related_event_id,omitempty"` - // Service that triggered the event. - Service *string `json:"service,omitempty"` - // The type of event being posted. - // For example, `nagios`, `hudson`, `jenkins`, `my_apps`, `chef`, `puppet`, `git` or `bitbucket`. - // The list of standard source attribute values is [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). - SourceTypeName *string `json:"source_type_name,omitempty"` - // Identifier for the source of the event, such as a monitor alert, an externally-submitted event, or an integration. - Sourcecategory *string `json:"sourcecategory,omitempty"` - // If an alert event is enabled, its status is one of the following: - // `failure`, `error`, `warning`, `info`, `success`, `user_update`, - // `recommendation`, or `snapshot`. - Status *EventStatusType `json:"status,omitempty"` - // A list of tags to apply to the event. - Tags []string `json:"tags,omitempty"` - // POSIX timestamp of your event in milliseconds. - Timestamp *int64 `json:"timestamp,omitempty"` - // The event title. - Title *string `json:"title,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{} -} - -// NewEventAttributes instantiates a new EventAttributes 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 NewEventAttributes() *EventAttributes { - this := EventAttributes{} - return &this -} - -// NewEventAttributesWithDefaults instantiates a new EventAttributes 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 NewEventAttributesWithDefaults() *EventAttributes { - this := EventAttributes{} - return &this -} - -// GetAggregationKey returns the AggregationKey field value if set, zero value otherwise. -func (o *EventAttributes) GetAggregationKey() string { - if o == nil || o.AggregationKey == nil { - var ret string - return ret - } - return *o.AggregationKey -} - -// GetAggregationKeyOk returns a tuple with the AggregationKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetAggregationKeyOk() (*string, bool) { - if o == nil || o.AggregationKey == nil { - return nil, false - } - return o.AggregationKey, true -} - -// HasAggregationKey returns a boolean if a field has been set. -func (o *EventAttributes) HasAggregationKey() bool { - if o != nil && o.AggregationKey != nil { - return true - } - - return false -} - -// SetAggregationKey gets a reference to the given string and assigns it to the AggregationKey field. -func (o *EventAttributes) SetAggregationKey(v string) { - o.AggregationKey = &v -} - -// GetDateHappened returns the DateHappened field value if set, zero value otherwise. -func (o *EventAttributes) GetDateHappened() int64 { - if o == nil || o.DateHappened == nil { - var ret int64 - return ret - } - return *o.DateHappened -} - -// GetDateHappenedOk returns a tuple with the DateHappened field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetDateHappenedOk() (*int64, bool) { - if o == nil || o.DateHappened == nil { - return nil, false - } - return o.DateHappened, true -} - -// HasDateHappened returns a boolean if a field has been set. -func (o *EventAttributes) HasDateHappened() bool { - if o != nil && o.DateHappened != nil { - return true - } - - return false -} - -// SetDateHappened gets a reference to the given int64 and assigns it to the DateHappened field. -func (o *EventAttributes) SetDateHappened(v int64) { - o.DateHappened = &v -} - -// GetDeviceName returns the DeviceName field value if set, zero value otherwise. -func (o *EventAttributes) GetDeviceName() string { - if o == nil || o.DeviceName == nil { - var ret string - return ret - } - return *o.DeviceName -} - -// GetDeviceNameOk returns a tuple with the DeviceName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetDeviceNameOk() (*string, bool) { - if o == nil || o.DeviceName == nil { - return nil, false - } - return o.DeviceName, true -} - -// HasDeviceName returns a boolean if a field has been set. -func (o *EventAttributes) HasDeviceName() bool { - if o != nil && o.DeviceName != nil { - return true - } - - return false -} - -// SetDeviceName gets a reference to the given string and assigns it to the DeviceName field. -func (o *EventAttributes) SetDeviceName(v string) { - o.DeviceName = &v -} - -// GetDuration returns the Duration field value if set, zero value otherwise. -func (o *EventAttributes) GetDuration() int64 { - if o == nil || o.Duration == nil { - var ret int64 - return ret - } - return *o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetDurationOk() (*int64, bool) { - if o == nil || o.Duration == nil { - return nil, false - } - return o.Duration, true -} - -// HasDuration returns a boolean if a field has been set. -func (o *EventAttributes) HasDuration() bool { - if o != nil && o.Duration != nil { - return true - } - - return false -} - -// SetDuration gets a reference to the given int64 and assigns it to the Duration field. -func (o *EventAttributes) SetDuration(v int64) { - o.Duration = &v -} - -// GetEventObject returns the EventObject field value if set, zero value otherwise. -func (o *EventAttributes) GetEventObject() string { - if o == nil || o.EventObject == nil { - var ret string - return ret - } - return *o.EventObject -} - -// GetEventObjectOk returns a tuple with the EventObject field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetEventObjectOk() (*string, bool) { - if o == nil || o.EventObject == nil { - return nil, false - } - return o.EventObject, true -} - -// HasEventObject returns a boolean if a field has been set. -func (o *EventAttributes) HasEventObject() bool { - if o != nil && o.EventObject != nil { - return true - } - - return false -} - -// SetEventObject gets a reference to the given string and assigns it to the EventObject field. -func (o *EventAttributes) SetEventObject(v string) { - o.EventObject = &v -} - -// GetEvt returns the Evt field value if set, zero value otherwise. -func (o *EventAttributes) GetEvt() Event { - if o == nil || o.Evt == nil { - var ret Event - return ret - } - return *o.Evt -} - -// GetEvtOk returns a tuple with the Evt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetEvtOk() (*Event, bool) { - if o == nil || o.Evt == nil { - return nil, false - } - return o.Evt, true -} - -// HasEvt returns a boolean if a field has been set. -func (o *EventAttributes) HasEvt() bool { - if o != nil && o.Evt != nil { - return true - } - - return false -} - -// SetEvt gets a reference to the given Event and assigns it to the Evt field. -func (o *EventAttributes) SetEvt(v Event) { - o.Evt = &v -} - -// GetHostname returns the Hostname field value if set, zero value otherwise. -func (o *EventAttributes) 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 *EventAttributes) 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 *EventAttributes) HasHostname() bool { - if o != nil && o.Hostname != nil { - return true - } - - return false -} - -// SetHostname gets a reference to the given string and assigns it to the Hostname field. -func (o *EventAttributes) SetHostname(v string) { - o.Hostname = &v -} - -// GetMonitor returns the Monitor field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *EventAttributes) GetMonitor() MonitorType { - if o == nil || o.Monitor.Get() == nil { - var ret MonitorType - return ret - } - return *o.Monitor.Get() -} - -// GetMonitorOk returns a tuple with the Monitor 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 *EventAttributes) GetMonitorOk() (*MonitorType, bool) { - if o == nil { - return nil, false - } - return o.Monitor.Get(), o.Monitor.IsSet() -} - -// HasMonitor returns a boolean if a field has been set. -func (o *EventAttributes) HasMonitor() bool { - if o != nil && o.Monitor.IsSet() { - return true - } - - return false -} - -// SetMonitor gets a reference to the given NullableMonitorType and assigns it to the Monitor field. -func (o *EventAttributes) SetMonitor(v MonitorType) { - o.Monitor.Set(&v) -} - -// SetMonitorNil sets the value for Monitor to be an explicit nil. -func (o *EventAttributes) SetMonitorNil() { - o.Monitor.Set(nil) -} - -// UnsetMonitor ensures that no value is present for Monitor, not even an explicit nil. -func (o *EventAttributes) UnsetMonitor() { - o.Monitor.Unset() -} - -// GetMonitorGroups returns the MonitorGroups field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *EventAttributes) GetMonitorGroups() []string { - if o == nil { - var ret []string - return ret - } - return o.MonitorGroups -} - -// GetMonitorGroupsOk returns a tuple with the MonitorGroups 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 *EventAttributes) GetMonitorGroupsOk() (*[]string, bool) { - if o == nil || o.MonitorGroups == nil { - return nil, false - } - return &o.MonitorGroups, true -} - -// HasMonitorGroups returns a boolean if a field has been set. -func (o *EventAttributes) HasMonitorGroups() bool { - if o != nil && o.MonitorGroups != nil { - return true - } - - return false -} - -// SetMonitorGroups gets a reference to the given []string and assigns it to the MonitorGroups field. -func (o *EventAttributes) SetMonitorGroups(v []string) { - o.MonitorGroups = v -} - -// GetMonitorId returns the MonitorId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *EventAttributes) GetMonitorId() int32 { - if o == nil || o.MonitorId.Get() == nil { - var ret int32 - return ret - } - return *o.MonitorId.Get() -} - -// GetMonitorIdOk returns a tuple with the MonitorId 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 *EventAttributes) GetMonitorIdOk() (*int32, bool) { - if o == nil { - return nil, false - } - return o.MonitorId.Get(), o.MonitorId.IsSet() -} - -// HasMonitorId returns a boolean if a field has been set. -func (o *EventAttributes) HasMonitorId() bool { - if o != nil && o.MonitorId.IsSet() { - return true - } - - return false -} - -// SetMonitorId gets a reference to the given common.NullableInt32 and assigns it to the MonitorId field. -func (o *EventAttributes) SetMonitorId(v int32) { - o.MonitorId.Set(&v) -} - -// SetMonitorIdNil sets the value for MonitorId to be an explicit nil. -func (o *EventAttributes) SetMonitorIdNil() { - o.MonitorId.Set(nil) -} - -// UnsetMonitorId ensures that no value is present for MonitorId, not even an explicit nil. -func (o *EventAttributes) UnsetMonitorId() { - o.MonitorId.Unset() -} - -// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *EventAttributes) GetPriority() EventPriority { - if o == nil || o.Priority.Get() == nil { - var ret EventPriority - return ret - } - return *o.Priority.Get() -} - -// GetPriorityOk returns a tuple with the Priority 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 *EventAttributes) GetPriorityOk() (*EventPriority, bool) { - if o == nil { - return nil, false - } - return o.Priority.Get(), o.Priority.IsSet() -} - -// HasPriority returns a boolean if a field has been set. -func (o *EventAttributes) HasPriority() bool { - if o != nil && o.Priority.IsSet() { - return true - } - - return false -} - -// SetPriority gets a reference to the given NullableEventPriority and assigns it to the Priority field. -func (o *EventAttributes) SetPriority(v EventPriority) { - o.Priority.Set(&v) -} - -// SetPriorityNil sets the value for Priority to be an explicit nil. -func (o *EventAttributes) SetPriorityNil() { - o.Priority.Set(nil) -} - -// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. -func (o *EventAttributes) UnsetPriority() { - o.Priority.Unset() -} - -// GetRelatedEventId returns the RelatedEventId field value if set, zero value otherwise. -func (o *EventAttributes) GetRelatedEventId() int32 { - if o == nil || o.RelatedEventId == nil { - var ret int32 - return ret - } - return *o.RelatedEventId -} - -// GetRelatedEventIdOk returns a tuple with the RelatedEventId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetRelatedEventIdOk() (*int32, bool) { - if o == nil || o.RelatedEventId == nil { - return nil, false - } - return o.RelatedEventId, true -} - -// HasRelatedEventId returns a boolean if a field has been set. -func (o *EventAttributes) HasRelatedEventId() bool { - if o != nil && o.RelatedEventId != nil { - return true - } - - return false -} - -// SetRelatedEventId gets a reference to the given int32 and assigns it to the RelatedEventId field. -func (o *EventAttributes) SetRelatedEventId(v int32) { - o.RelatedEventId = &v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *EventAttributes) 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 *EventAttributes) 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 *EventAttributes) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *EventAttributes) SetService(v string) { - o.Service = &v -} - -// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. -func (o *EventAttributes) GetSourceTypeName() string { - if o == nil || o.SourceTypeName == nil { - var ret string - return ret - } - return *o.SourceTypeName -} - -// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetSourceTypeNameOk() (*string, bool) { - if o == nil || o.SourceTypeName == nil { - return nil, false - } - return o.SourceTypeName, true -} - -// HasSourceTypeName returns a boolean if a field has been set. -func (o *EventAttributes) HasSourceTypeName() bool { - if o != nil && o.SourceTypeName != nil { - return true - } - - return false -} - -// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. -func (o *EventAttributes) SetSourceTypeName(v string) { - o.SourceTypeName = &v -} - -// GetSourcecategory returns the Sourcecategory field value if set, zero value otherwise. -func (o *EventAttributes) GetSourcecategory() string { - if o == nil || o.Sourcecategory == nil { - var ret string - return ret - } - return *o.Sourcecategory -} - -// GetSourcecategoryOk returns a tuple with the Sourcecategory field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetSourcecategoryOk() (*string, bool) { - if o == nil || o.Sourcecategory == nil { - return nil, false - } - return o.Sourcecategory, true -} - -// HasSourcecategory returns a boolean if a field has been set. -func (o *EventAttributes) HasSourcecategory() bool { - if o != nil && o.Sourcecategory != nil { - return true - } - - return false -} - -// SetSourcecategory gets a reference to the given string and assigns it to the Sourcecategory field. -func (o *EventAttributes) SetSourcecategory(v string) { - o.Sourcecategory = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *EventAttributes) GetStatus() EventStatusType { - if o == nil || o.Status == nil { - var ret EventStatusType - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetStatusOk() (*EventStatusType, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *EventAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given EventStatusType and assigns it to the Status field. -func (o *EventAttributes) SetStatus(v EventStatusType) { - o.Status = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *EventAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *EventAttributes) GetTagsOk() (*[]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 *EventAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *EventAttributes) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *EventAttributes) GetTimestamp() int64 { - if o == nil || o.Timestamp == nil { - var ret int64 - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetTimestampOk() (*int64, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *EventAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. -func (o *EventAttributes) SetTimestamp(v int64) { - o.Timestamp = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *EventAttributes) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventAttributes) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *EventAttributes) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *EventAttributes) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AggregationKey != nil { - toSerialize["aggregation_key"] = o.AggregationKey - } - if o.DateHappened != nil { - toSerialize["date_happened"] = o.DateHappened - } - if o.DeviceName != nil { - toSerialize["device_name"] = o.DeviceName - } - if o.Duration != nil { - toSerialize["duration"] = o.Duration - } - if o.EventObject != nil { - toSerialize["event_object"] = o.EventObject - } - if o.Evt != nil { - toSerialize["evt"] = o.Evt - } - if o.Hostname != nil { - toSerialize["hostname"] = o.Hostname - } - if o.Monitor.IsSet() { - toSerialize["monitor"] = o.Monitor.Get() - } - if o.MonitorGroups != nil { - toSerialize["monitor_groups"] = o.MonitorGroups - } - if o.MonitorId.IsSet() { - toSerialize["monitor_id"] = o.MonitorId.Get() - } - if o.Priority.IsSet() { - toSerialize["priority"] = o.Priority.Get() - } - if o.RelatedEventId != nil { - toSerialize["related_event_id"] = o.RelatedEventId - } - if o.Service != nil { - toSerialize["service"] = o.Service - } - if o.SourceTypeName != nil { - toSerialize["source_type_name"] = o.SourceTypeName - } - if o.Sourcecategory != nil { - toSerialize["sourcecategory"] = o.Sourcecategory - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - toSerialize["timestamp"] = o.Timestamp - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AggregationKey *string `json:"aggregation_key,omitempty"` - DateHappened *int64 `json:"date_happened,omitempty"` - DeviceName *string `json:"device_name,omitempty"` - Duration *int64 `json:"duration,omitempty"` - EventObject *string `json:"event_object,omitempty"` - Evt *Event `json:"evt,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Monitor NullableMonitorType `json:"monitor,omitempty"` - MonitorGroups []string `json:"monitor_groups,omitempty"` - MonitorId common.NullableInt32 `json:"monitor_id,omitempty"` - Priority NullableEventPriority `json:"priority,omitempty"` - RelatedEventId *int32 `json:"related_event_id,omitempty"` - Service *string `json:"service,omitempty"` - SourceTypeName *string `json:"source_type_name,omitempty"` - Sourcecategory *string `json:"sourcecategory,omitempty"` - Status *EventStatusType `json:"status,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *int64 `json:"timestamp,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AggregationKey = all.AggregationKey - o.DateHappened = all.DateHappened - o.DeviceName = all.DeviceName - o.Duration = all.Duration - o.EventObject = all.EventObject - if all.Evt != nil && all.Evt.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Evt = all.Evt - o.Hostname = all.Hostname - o.Monitor = all.Monitor - o.MonitorGroups = all.MonitorGroups - o.MonitorId = all.MonitorId - o.Priority = all.Priority - o.RelatedEventId = all.RelatedEventId - o.Service = all.Service - o.SourceTypeName = all.SourceTypeName - o.Sourcecategory = all.Sourcecategory - o.Status = all.Status - o.Tags = all.Tags - o.Timestamp = all.Timestamp - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_event_priority.go b/api/v2/datadog/model_event_priority.go deleted file mode 100644 index d9ee443b662..00000000000 --- a/api/v2/datadog/model_event_priority.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventPriority The priority of the event's monitor. For example, `normal` or `low`. -type EventPriority string - -// List of EventPriority. -const ( - EVENTPRIORITY_NORMAL EventPriority = "normal" - EVENTPRIORITY_LOW EventPriority = "low" -) - -var allowedEventPriorityEnumValues = []EventPriority{ - EVENTPRIORITY_NORMAL, - EVENTPRIORITY_LOW, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventPriority) GetAllowedValues() []EventPriority { - return allowedEventPriorityEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventPriority) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventPriority(value) - return nil -} - -// NewEventPriorityFromValue returns a pointer to a valid EventPriority -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventPriorityFromValue(v string) (*EventPriority, error) { - ev := EventPriority(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventPriority: valid values are %v", v, allowedEventPriorityEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventPriority) IsValid() bool { - for _, existing := range allowedEventPriorityEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventPriority value. -func (v EventPriority) Ptr() *EventPriority { - return &v -} - -// NullableEventPriority handles when a null is used for EventPriority. -type NullableEventPriority struct { - value *EventPriority - isSet bool -} - -// Get returns the associated value. -func (v NullableEventPriority) Get() *EventPriority { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventPriority) Set(val *EventPriority) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventPriority) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventPriority) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventPriority initializes the struct as if Set has been called. -func NewNullableEventPriority(val *EventPriority) *NullableEventPriority { - return &NullableEventPriority{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventPriority) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventPriority) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_event_response.go b/api/v2/datadog/model_event_response.go deleted file mode 100644 index 97d7a0ee4d0..00000000000 --- a/api/v2/datadog/model_event_response.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventResponse The object description of an event after being processed and stored by Datadog. -type EventResponse struct { - // The object description of an event response attribute. - Attributes *EventResponseAttributes `json:"attributes,omitempty"` - // the unique ID of the event. - Id *string `json:"id,omitempty"` - // Type of the event. - Type *EventType `json:"type,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{} -} - -// NewEventResponse instantiates a new EventResponse 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 NewEventResponse() *EventResponse { - this := EventResponse{} - var typeVar EventType = EVENTTYPE_EVENT - this.Type = &typeVar - return &this -} - -// NewEventResponseWithDefaults instantiates a new EventResponse 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 NewEventResponseWithDefaults() *EventResponse { - this := EventResponse{} - var typeVar EventType = EVENTTYPE_EVENT - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *EventResponse) GetAttributes() EventResponseAttributes { - if o == nil || o.Attributes == nil { - var ret EventResponseAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventResponse) GetAttributesOk() (*EventResponseAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *EventResponse) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given EventResponseAttributes and assigns it to the Attributes field. -func (o *EventResponse) SetAttributes(v EventResponseAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *EventResponse) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventResponse) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *EventResponse) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *EventResponse) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *EventResponse) GetType() EventType { - if o == nil || o.Type == nil { - var ret EventType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventResponse) GetTypeOk() (*EventType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *EventResponse) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given EventType and assigns it to the Type field. -func (o *EventResponse) SetType(v EventType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *EventResponseAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *EventType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_event_response_attributes.go b/api/v2/datadog/model_event_response_attributes.go deleted file mode 100644 index a23e896d8b4..00000000000 --- a/api/v2/datadog/model_event_response_attributes.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// EventResponseAttributes The object description of an event response attribute. -type EventResponseAttributes struct { - // Object description of attributes from your event. - Attributes *EventAttributes `json:"attributes,omitempty"` - // An array of tags associated with the event. - Tags []string `json:"tags,omitempty"` - // The timestamp of the event. - Timestamp *time.Time `json:"timestamp,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{} -} - -// NewEventResponseAttributes instantiates a new EventResponseAttributes 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 NewEventResponseAttributes() *EventResponseAttributes { - this := EventResponseAttributes{} - return &this -} - -// NewEventResponseAttributesWithDefaults instantiates a new EventResponseAttributes 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 NewEventResponseAttributesWithDefaults() *EventResponseAttributes { - this := EventResponseAttributes{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *EventResponseAttributes) GetAttributes() EventAttributes { - if o == nil || o.Attributes == nil { - var ret EventAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventResponseAttributes) GetAttributesOk() (*EventAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *EventResponseAttributes) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given EventAttributes and assigns it to the Attributes field. -func (o *EventResponseAttributes) SetAttributes(v EventAttributes) { - o.Attributes = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *EventResponseAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *EventResponseAttributes) GetTagsOk() (*[]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 *EventResponseAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *EventResponseAttributes) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *EventResponseAttributes) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventResponseAttributes) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *EventResponseAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *EventResponseAttributes) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *EventAttributes `json:"attributes,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Tags = all.Tags - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v2/datadog/model_event_status_type.go b/api/v2/datadog/model_event_status_type.go deleted file mode 100644 index 4006b253b59..00000000000 --- a/api/v2/datadog/model_event_status_type.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventStatusType If an alert event is enabled, its status is one of the following: -// `failure`, `error`, `warning`, `info`, `success`, `user_update`, -// `recommendation`, or `snapshot`. -type EventStatusType string - -// List of EventStatusType. -const ( - EVENTSTATUSTYPE_FAILURE EventStatusType = "failure" - EVENTSTATUSTYPE_ERROR EventStatusType = "error" - EVENTSTATUSTYPE_WARNING EventStatusType = "warning" - EVENTSTATUSTYPE_INFO EventStatusType = "info" - EVENTSTATUSTYPE_SUCCESS EventStatusType = "success" - EVENTSTATUSTYPE_USER_UPDATE EventStatusType = "user_update" - EVENTSTATUSTYPE_RECOMMENDATION EventStatusType = "recommendation" - EVENTSTATUSTYPE_SNAPSHOT EventStatusType = "snapshot" -) - -var allowedEventStatusTypeEnumValues = []EventStatusType{ - EVENTSTATUSTYPE_FAILURE, - EVENTSTATUSTYPE_ERROR, - EVENTSTATUSTYPE_WARNING, - EVENTSTATUSTYPE_INFO, - EVENTSTATUSTYPE_SUCCESS, - EVENTSTATUSTYPE_USER_UPDATE, - EVENTSTATUSTYPE_RECOMMENDATION, - EVENTSTATUSTYPE_SNAPSHOT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventStatusType) GetAllowedValues() []EventStatusType { - return allowedEventStatusTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventStatusType(value) - return nil -} - -// NewEventStatusTypeFromValue returns a pointer to a valid EventStatusType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventStatusTypeFromValue(v string) (*EventStatusType, error) { - ev := EventStatusType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventStatusType: valid values are %v", v, allowedEventStatusTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventStatusType) IsValid() bool { - for _, existing := range allowedEventStatusTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventStatusType value. -func (v EventStatusType) Ptr() *EventStatusType { - return &v -} - -// NullableEventStatusType handles when a null is used for EventStatusType. -type NullableEventStatusType struct { - value *EventStatusType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventStatusType) Get() *EventStatusType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventStatusType) Set(val *EventStatusType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventStatusType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventStatusType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventStatusType initializes the struct as if Set has been called. -func NewNullableEventStatusType(val *EventStatusType) *NullableEventStatusType { - return &NullableEventStatusType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventStatusType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventStatusType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_event_type.go b/api/v2/datadog/model_event_type.go deleted file mode 100644 index 817a3e4df64..00000000000 --- a/api/v2/datadog/model_event_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventType Type of the event. -type EventType string - -// List of EventType. -const ( - EVENTTYPE_EVENT EventType = "event" -) - -var allowedEventTypeEnumValues = []EventType{ - EVENTTYPE_EVENT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventType) GetAllowedValues() []EventType { - return allowedEventTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventType(value) - return nil -} - -// NewEventTypeFromValue returns a pointer to a valid EventType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventTypeFromValue(v string) (*EventType, error) { - ev := EventType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventType: valid values are %v", v, allowedEventTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventType) IsValid() bool { - for _, existing := range allowedEventTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventType value. -func (v EventType) Ptr() *EventType { - return &v -} - -// NullableEventType handles when a null is used for EventType. -type NullableEventType struct { - value *EventType - isSet bool -} - -// Get returns the associated value. -func (v NullableEventType) Get() *EventType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventType) Set(val *EventType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventType initializes the struct as if Set has been called. -func NewNullableEventType(val *EventType) *NullableEventType { - return &NullableEventType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_events_list_request.go b/api/v2/datadog/model_events_list_request.go deleted file mode 100644 index 8e5dc84a4ff..00000000000 --- a/api/v2/datadog/model_events_list_request.go +++ /dev/null @@ -1,249 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsListRequest The object sent with the request to retrieve a list of events from your organization. -type EventsListRequest struct { - // The search and filter query settings. - Filter *EventsQueryFilter `json:"filter,omitempty"` - // The global query options that are used. Either provide a timezone or a time offset but not both, - // otherwise the query fails. - Options *EventsQueryOptions `json:"options,omitempty"` - // Pagination settings. - Page *EventsRequestPage `json:"page,omitempty"` - // The sort parameters when querying events. - Sort *EventsSort `json:"sort,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{} -} - -// NewEventsListRequest instantiates a new EventsListRequest 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 NewEventsListRequest() *EventsListRequest { - this := EventsListRequest{} - return &this -} - -// NewEventsListRequestWithDefaults instantiates a new EventsListRequest 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 NewEventsListRequestWithDefaults() *EventsListRequest { - this := EventsListRequest{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *EventsListRequest) GetFilter() EventsQueryFilter { - if o == nil || o.Filter == nil { - var ret EventsQueryFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsListRequest) GetFilterOk() (*EventsQueryFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *EventsListRequest) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given EventsQueryFilter and assigns it to the Filter field. -func (o *EventsListRequest) SetFilter(v EventsQueryFilter) { - o.Filter = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *EventsListRequest) GetOptions() EventsQueryOptions { - if o == nil || o.Options == nil { - var ret EventsQueryOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsListRequest) GetOptionsOk() (*EventsQueryOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *EventsListRequest) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given EventsQueryOptions and assigns it to the Options field. -func (o *EventsListRequest) SetOptions(v EventsQueryOptions) { - o.Options = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *EventsListRequest) GetPage() EventsRequestPage { - if o == nil || o.Page == nil { - var ret EventsRequestPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsListRequest) GetPageOk() (*EventsRequestPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *EventsListRequest) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given EventsRequestPage and assigns it to the Page field. -func (o *EventsListRequest) SetPage(v EventsRequestPage) { - o.Page = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *EventsListRequest) GetSort() EventsSort { - if o == nil || o.Sort == nil { - var ret EventsSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsListRequest) GetSortOk() (*EventsSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *EventsListRequest) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given EventsSort and assigns it to the Sort field. -func (o *EventsListRequest) SetSort(v EventsSort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsListRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filter *EventsQueryFilter `json:"filter,omitempty"` - Options *EventsQueryOptions `json:"options,omitempty"` - Page *EventsRequestPage `json:"page,omitempty"` - Sort *EventsSort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.Sort = all.Sort - return nil -} diff --git a/api/v2/datadog/model_events_list_response.go b/api/v2/datadog/model_events_list_response.go deleted file mode 100644 index 2475e161efe..00000000000 --- a/api/v2/datadog/model_events_list_response.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsListResponse The response object with all events matching the request and pagination information. -type EventsListResponse struct { - // An array of events matching the request. - Data []EventResponse `json:"data,omitempty"` - // Links attributes. - Links *EventsListResponseLinks `json:"links,omitempty"` - // The metadata associated with a request. - Meta *EventsResponseMetadata `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{} -} - -// NewEventsListResponse instantiates a new EventsListResponse 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 NewEventsListResponse() *EventsListResponse { - this := EventsListResponse{} - return &this -} - -// NewEventsListResponseWithDefaults instantiates a new EventsListResponse 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 NewEventsListResponseWithDefaults() *EventsListResponse { - this := EventsListResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *EventsListResponse) GetData() []EventResponse { - if o == nil || o.Data == nil { - var ret []EventResponse - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsListResponse) GetDataOk() (*[]EventResponse, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *EventsListResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []EventResponse and assigns it to the Data field. -func (o *EventsListResponse) SetData(v []EventResponse) { - o.Data = v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *EventsListResponse) GetLinks() EventsListResponseLinks { - if o == nil || o.Links == nil { - var ret EventsListResponseLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsListResponse) GetLinksOk() (*EventsListResponseLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *EventsListResponse) HasLinks() bool { - if o != nil && o.Links != nil { - return true - } - - return false -} - -// SetLinks gets a reference to the given EventsListResponseLinks and assigns it to the Links field. -func (o *EventsListResponse) SetLinks(v EventsListResponseLinks) { - o.Links = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *EventsListResponse) GetMeta() EventsResponseMetadata { - if o == nil || o.Meta == nil { - var ret EventsResponseMetadata - 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 *EventsListResponse) GetMetaOk() (*EventsResponseMetadata, 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 *EventsListResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given EventsResponseMetadata and assigns it to the Meta field. -func (o *EventsListResponse) SetMeta(v EventsResponseMetadata) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []EventResponse `json:"data,omitempty"` - Links *EventsListResponseLinks `json:"links,omitempty"` - Meta *EventsResponseMetadata `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Links = all.Links - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_events_list_response_links.go b/api/v2/datadog/model_events_list_response_links.go deleted file mode 100644 index ca0ba4ce6c1..00000000000 --- a/api/v2/datadog/model_events_list_response_links.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsListResponseLinks Links attributes. -type EventsListResponseLinks struct { - // Link for the next set of results. Note that the request can also be made using the - // POST endpoint. - Next *string `json:"next,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{} -} - -// NewEventsListResponseLinks instantiates a new EventsListResponseLinks 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 NewEventsListResponseLinks() *EventsListResponseLinks { - this := EventsListResponseLinks{} - return &this -} - -// NewEventsListResponseLinksWithDefaults instantiates a new EventsListResponseLinks 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 NewEventsListResponseLinksWithDefaults() *EventsListResponseLinks { - this := EventsListResponseLinks{} - return &this -} - -// GetNext returns the Next field value if set, zero value otherwise. -func (o *EventsListResponseLinks) GetNext() string { - if o == nil || o.Next == nil { - var ret string - return ret - } - return *o.Next -} - -// GetNextOk returns a tuple with the Next field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsListResponseLinks) GetNextOk() (*string, bool) { - if o == nil || o.Next == nil { - return nil, false - } - return o.Next, true -} - -// HasNext returns a boolean if a field has been set. -func (o *EventsListResponseLinks) HasNext() bool { - if o != nil && o.Next != nil { - return true - } - - return false -} - -// SetNext gets a reference to the given string and assigns it to the Next field. -func (o *EventsListResponseLinks) SetNext(v string) { - o.Next = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsListResponseLinks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Next != nil { - toSerialize["next"] = o.Next - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Next *string `json:"next,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Next = all.Next - return nil -} diff --git a/api/v2/datadog/model_events_query_filter.go b/api/v2/datadog/model_events_query_filter.go deleted file mode 100644 index 10b30802a48..00000000000 --- a/api/v2/datadog/model_events_query_filter.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsQueryFilter The search and filter query settings. -type EventsQueryFilter struct { - // The minimum time for the requested events. Supports date math and regular timestamps in milliseconds. - From *string `json:"from,omitempty"` - // The search query following the event search syntax. - Query *string `json:"query,omitempty"` - // The maximum time for the requested events. Supports date math and regular timestamps in milliseconds. - To *string `json:"to,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{} -} - -// NewEventsQueryFilter instantiates a new EventsQueryFilter 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 NewEventsQueryFilter() *EventsQueryFilter { - this := EventsQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// NewEventsQueryFilterWithDefaults instantiates a new EventsQueryFilter 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 NewEventsQueryFilterWithDefaults() *EventsQueryFilter { - this := EventsQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// GetFrom returns the From field value if set, zero value otherwise. -func (o *EventsQueryFilter) GetFrom() string { - if o == nil || o.From == nil { - var ret string - return ret - } - return *o.From -} - -// GetFromOk returns a tuple with the From field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsQueryFilter) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { - return nil, false - } - return o.From, true -} - -// HasFrom returns a boolean if a field has been set. -func (o *EventsQueryFilter) HasFrom() bool { - if o != nil && o.From != nil { - return true - } - - return false -} - -// SetFrom gets a reference to the given string and assigns it to the From field. -func (o *EventsQueryFilter) SetFrom(v string) { - o.From = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *EventsQueryFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsQueryFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *EventsQueryFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *EventsQueryFilter) SetQuery(v string) { - o.Query = &v -} - -// GetTo returns the To field value if set, zero value otherwise. -func (o *EventsQueryFilter) GetTo() string { - if o == nil || o.To == nil { - var ret string - return ret - } - return *o.To -} - -// GetToOk returns a tuple with the To field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsQueryFilter) GetToOk() (*string, bool) { - if o == nil || o.To == nil { - return nil, false - } - return o.To, true -} - -// HasTo returns a boolean if a field has been set. -func (o *EventsQueryFilter) HasTo() bool { - if o != nil && o.To != nil { - return true - } - - return false -} - -// SetTo gets a reference to the given string and assigns it to the To field. -func (o *EventsQueryFilter) SetTo(v string) { - o.To = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsQueryFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.From != nil { - toSerialize["from"] = o.From - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.To != nil { - toSerialize["to"] = o.To - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - From *string `json:"from,omitempty"` - Query *string `json:"query,omitempty"` - To *string `json:"to,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.From = all.From - o.Query = all.Query - o.To = all.To - return nil -} diff --git a/api/v2/datadog/model_events_query_options.go b/api/v2/datadog/model_events_query_options.go deleted file mode 100644 index 609877e74d0..00000000000 --- a/api/v2/datadog/model_events_query_options.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsQueryOptions The global query options that are used. Either provide a timezone or a time offset but not both, -// otherwise the query fails. -type EventsQueryOptions struct { - // The time offset to apply to the query in seconds. - TimeOffset *int64 `json:"timeOffset,omitempty"` - // The timezone can be specified as an offset, for example: `UTC+03:00`. - Timezone *string `json:"timezone,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{} -} - -// NewEventsQueryOptions instantiates a new EventsQueryOptions 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 NewEventsQueryOptions() *EventsQueryOptions { - this := EventsQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// NewEventsQueryOptionsWithDefaults instantiates a new EventsQueryOptions 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 NewEventsQueryOptionsWithDefaults() *EventsQueryOptions { - this := EventsQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. -func (o *EventsQueryOptions) GetTimeOffset() int64 { - if o == nil || o.TimeOffset == nil { - var ret int64 - return ret - } - return *o.TimeOffset -} - -// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsQueryOptions) GetTimeOffsetOk() (*int64, bool) { - if o == nil || o.TimeOffset == nil { - return nil, false - } - return o.TimeOffset, true -} - -// HasTimeOffset returns a boolean if a field has been set. -func (o *EventsQueryOptions) HasTimeOffset() bool { - if o != nil && o.TimeOffset != nil { - return true - } - - return false -} - -// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. -func (o *EventsQueryOptions) SetTimeOffset(v int64) { - o.TimeOffset = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *EventsQueryOptions) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsQueryOptions) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *EventsQueryOptions) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *EventsQueryOptions) SetTimezone(v string) { - o.Timezone = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsQueryOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TimeOffset != nil { - toSerialize["timeOffset"] = o.TimeOffset - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TimeOffset *int64 `json:"timeOffset,omitempty"` - Timezone *string `json:"timezone,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TimeOffset = all.TimeOffset - o.Timezone = all.Timezone - return nil -} diff --git a/api/v2/datadog/model_events_request_page.go b/api/v2/datadog/model_events_request_page.go deleted file mode 100644 index 7e077a6edce..00000000000 --- a/api/v2/datadog/model_events_request_page.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsRequestPage Pagination settings. -type EventsRequestPage struct { - // The returned paging point to use to get the next results. - Cursor *string `json:"cursor,omitempty"` - // The maximum number of logs in the response. - Limit *int32 `json:"limit,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{} -} - -// NewEventsRequestPage instantiates a new EventsRequestPage 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 NewEventsRequestPage() *EventsRequestPage { - this := EventsRequestPage{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// NewEventsRequestPageWithDefaults instantiates a new EventsRequestPage 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 NewEventsRequestPageWithDefaults() *EventsRequestPage { - this := EventsRequestPage{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// GetCursor returns the Cursor field value if set, zero value otherwise. -func (o *EventsRequestPage) GetCursor() string { - if o == nil || o.Cursor == nil { - var ret string - return ret - } - return *o.Cursor -} - -// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsRequestPage) GetCursorOk() (*string, bool) { - if o == nil || o.Cursor == nil { - return nil, false - } - return o.Cursor, true -} - -// HasCursor returns a boolean if a field has been set. -func (o *EventsRequestPage) HasCursor() bool { - if o != nil && o.Cursor != nil { - return true - } - - return false -} - -// SetCursor gets a reference to the given string and assigns it to the Cursor field. -func (o *EventsRequestPage) SetCursor(v string) { - o.Cursor = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *EventsRequestPage) GetLimit() int32 { - if o == nil || o.Limit == nil { - var ret int32 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsRequestPage) GetLimitOk() (*int32, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *EventsRequestPage) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int32 and assigns it to the Limit field. -func (o *EventsRequestPage) SetLimit(v int32) { - o.Limit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsRequestPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cursor != nil { - toSerialize["cursor"] = o.Cursor - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cursor *string `json:"cursor,omitempty"` - Limit *int32 `json:"limit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cursor = all.Cursor - o.Limit = all.Limit - return nil -} diff --git a/api/v2/datadog/model_events_response_metadata.go b/api/v2/datadog/model_events_response_metadata.go deleted file mode 100644 index 955fff31dd0..00000000000 --- a/api/v2/datadog/model_events_response_metadata.go +++ /dev/null @@ -1,227 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsResponseMetadata The metadata associated with a request. -type EventsResponseMetadata struct { - // The time elapsed in milliseconds. - Elapsed *int64 `json:"elapsed,omitempty"` - // Pagination attributes. - Page *EventsResponseMetadataPage `json:"page,omitempty"` - // The identifier of the request. - RequestId *string `json:"request_id,omitempty"` - // A list of warnings (non-fatal errors) encountered. Partial results might be returned if - // warnings are present in the response. - Warnings []EventsWarning `json:"warnings,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{} -} - -// NewEventsResponseMetadata instantiates a new EventsResponseMetadata 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 NewEventsResponseMetadata() *EventsResponseMetadata { - this := EventsResponseMetadata{} - return &this -} - -// NewEventsResponseMetadataWithDefaults instantiates a new EventsResponseMetadata 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 NewEventsResponseMetadataWithDefaults() *EventsResponseMetadata { - this := EventsResponseMetadata{} - return &this -} - -// GetElapsed returns the Elapsed field value if set, zero value otherwise. -func (o *EventsResponseMetadata) GetElapsed() int64 { - if o == nil || o.Elapsed == nil { - var ret int64 - return ret - } - return *o.Elapsed -} - -// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsResponseMetadata) GetElapsedOk() (*int64, bool) { - if o == nil || o.Elapsed == nil { - return nil, false - } - return o.Elapsed, true -} - -// HasElapsed returns a boolean if a field has been set. -func (o *EventsResponseMetadata) HasElapsed() bool { - if o != nil && o.Elapsed != nil { - return true - } - - return false -} - -// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. -func (o *EventsResponseMetadata) SetElapsed(v int64) { - o.Elapsed = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *EventsResponseMetadata) GetPage() EventsResponseMetadataPage { - if o == nil || o.Page == nil { - var ret EventsResponseMetadataPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsResponseMetadata) GetPageOk() (*EventsResponseMetadataPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *EventsResponseMetadata) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given EventsResponseMetadataPage and assigns it to the Page field. -func (o *EventsResponseMetadata) SetPage(v EventsResponseMetadataPage) { - o.Page = &v -} - -// GetRequestId returns the RequestId field value if set, zero value otherwise. -func (o *EventsResponseMetadata) GetRequestId() string { - if o == nil || o.RequestId == nil { - var ret string - return ret - } - return *o.RequestId -} - -// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsResponseMetadata) GetRequestIdOk() (*string, bool) { - if o == nil || o.RequestId == nil { - return nil, false - } - return o.RequestId, true -} - -// HasRequestId returns a boolean if a field has been set. -func (o *EventsResponseMetadata) HasRequestId() bool { - if o != nil && o.RequestId != nil { - return true - } - - return false -} - -// SetRequestId gets a reference to the given string and assigns it to the RequestId field. -func (o *EventsResponseMetadata) SetRequestId(v string) { - o.RequestId = &v -} - -// GetWarnings returns the Warnings field value if set, zero value otherwise. -func (o *EventsResponseMetadata) GetWarnings() []EventsWarning { - if o == nil || o.Warnings == nil { - var ret []EventsWarning - return ret - } - return o.Warnings -} - -// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsResponseMetadata) GetWarningsOk() (*[]EventsWarning, bool) { - if o == nil || o.Warnings == nil { - return nil, false - } - return &o.Warnings, true -} - -// HasWarnings returns a boolean if a field has been set. -func (o *EventsResponseMetadata) HasWarnings() bool { - if o != nil && o.Warnings != nil { - return true - } - - return false -} - -// SetWarnings gets a reference to the given []EventsWarning and assigns it to the Warnings field. -func (o *EventsResponseMetadata) SetWarnings(v []EventsWarning) { - o.Warnings = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsResponseMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Elapsed != nil { - toSerialize["elapsed"] = o.Elapsed - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.RequestId != nil { - toSerialize["request_id"] = o.RequestId - } - if o.Warnings != nil { - toSerialize["warnings"] = o.Warnings - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Elapsed *int64 `json:"elapsed,omitempty"` - Page *EventsResponseMetadataPage `json:"page,omitempty"` - RequestId *string `json:"request_id,omitempty"` - Warnings []EventsWarning `json:"warnings,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Elapsed = all.Elapsed - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.RequestId = all.RequestId - o.Warnings = all.Warnings - return nil -} diff --git a/api/v2/datadog/model_events_response_metadata_page.go b/api/v2/datadog/model_events_response_metadata_page.go deleted file mode 100644 index a9ffce6f39b..00000000000 --- a/api/v2/datadog/model_events_response_metadata_page.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsResponseMetadataPage Pagination attributes. -type EventsResponseMetadataPage struct { - // The cursor to use to get the next results, if any. To make the next request, use the same - // parameters with the addition of the `page[cursor]`. - After *string `json:"after,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{} -} - -// NewEventsResponseMetadataPage instantiates a new EventsResponseMetadataPage 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 NewEventsResponseMetadataPage() *EventsResponseMetadataPage { - this := EventsResponseMetadataPage{} - return &this -} - -// NewEventsResponseMetadataPageWithDefaults instantiates a new EventsResponseMetadataPage 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 NewEventsResponseMetadataPageWithDefaults() *EventsResponseMetadataPage { - this := EventsResponseMetadataPage{} - return &this -} - -// GetAfter returns the After field value if set, zero value otherwise. -func (o *EventsResponseMetadataPage) GetAfter() string { - if o == nil || o.After == nil { - var ret string - return ret - } - return *o.After -} - -// GetAfterOk returns a tuple with the After field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsResponseMetadataPage) GetAfterOk() (*string, bool) { - if o == nil || o.After == nil { - return nil, false - } - return o.After, true -} - -// HasAfter returns a boolean if a field has been set. -func (o *EventsResponseMetadataPage) HasAfter() bool { - if o != nil && o.After != nil { - return true - } - - return false -} - -// SetAfter gets a reference to the given string and assigns it to the After field. -func (o *EventsResponseMetadataPage) SetAfter(v string) { - o.After = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsResponseMetadataPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.After != nil { - toSerialize["after"] = o.After - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - After *string `json:"after,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.After = all.After - return nil -} diff --git a/api/v2/datadog/model_events_sort.go b/api/v2/datadog/model_events_sort.go deleted file mode 100644 index 434bbb1b06c..00000000000 --- a/api/v2/datadog/model_events_sort.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// EventsSort The sort parameters when querying events. -type EventsSort string - -// List of EventsSort. -const ( - EVENTSSORT_TIMESTAMP_ASCENDING EventsSort = "timestamp" - EVENTSSORT_TIMESTAMP_DESCENDING EventsSort = "-timestamp" -) - -var allowedEventsSortEnumValues = []EventsSort{ - EVENTSSORT_TIMESTAMP_ASCENDING, - EVENTSSORT_TIMESTAMP_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventsSort) GetAllowedValues() []EventsSort { - return allowedEventsSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventsSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventsSort(value) - return nil -} - -// NewEventsSortFromValue returns a pointer to a valid EventsSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventsSortFromValue(v string) (*EventsSort, error) { - ev := EventsSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventsSort: valid values are %v", v, allowedEventsSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventsSort) IsValid() bool { - for _, existing := range allowedEventsSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventsSort value. -func (v EventsSort) Ptr() *EventsSort { - return &v -} - -// NullableEventsSort handles when a null is used for EventsSort. -type NullableEventsSort struct { - value *EventsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableEventsSort) Get() *EventsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableEventsSort) Set(val *EventsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableEventsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableEventsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableEventsSort initializes the struct as if Set has been called. -func NewNullableEventsSort(val *EventsSort) *NullableEventsSort { - return &NullableEventsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableEventsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableEventsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_events_warning.go b/api/v2/datadog/model_events_warning.go deleted file mode 100644 index 213be6c724b..00000000000 --- a/api/v2/datadog/model_events_warning.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// EventsWarning A warning message indicating something is wrong with the query. -type EventsWarning struct { - // A unique code for this type of warning. - Code *string `json:"code,omitempty"` - // A detailed explanation of this specific warning. - Detail *string `json:"detail,omitempty"` - // A short human-readable summary of the warning. - Title *string `json:"title,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{} -} - -// NewEventsWarning instantiates a new EventsWarning 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 NewEventsWarning() *EventsWarning { - this := EventsWarning{} - return &this -} - -// NewEventsWarningWithDefaults instantiates a new EventsWarning 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 NewEventsWarningWithDefaults() *EventsWarning { - this := EventsWarning{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *EventsWarning) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsWarning) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *EventsWarning) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *EventsWarning) SetCode(v string) { - o.Code = &v -} - -// GetDetail returns the Detail field value if set, zero value otherwise. -func (o *EventsWarning) GetDetail() string { - if o == nil || o.Detail == nil { - var ret string - return ret - } - return *o.Detail -} - -// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsWarning) GetDetailOk() (*string, bool) { - if o == nil || o.Detail == nil { - return nil, false - } - return o.Detail, true -} - -// HasDetail returns a boolean if a field has been set. -func (o *EventsWarning) HasDetail() bool { - if o != nil && o.Detail != nil { - return true - } - - return false -} - -// SetDetail gets a reference to the given string and assigns it to the Detail field. -func (o *EventsWarning) SetDetail(v string) { - o.Detail = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *EventsWarning) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventsWarning) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *EventsWarning) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *EventsWarning) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventsWarning) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Detail != nil { - toSerialize["detail"] = o.Detail - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventsWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *string `json:"code,omitempty"` - Detail *string `json:"detail,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Detail = all.Detail - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_full_api_key.go b/api/v2/datadog/model_full_api_key.go deleted file mode 100644 index 8c07ff3449b..00000000000 --- a/api/v2/datadog/model_full_api_key.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// FullAPIKey Datadog API key. -type FullAPIKey struct { - // Attributes of a full API key. - Attributes *FullAPIKeyAttributes `json:"attributes,omitempty"` - // ID of the API key. - Id *string `json:"id,omitempty"` - // Resources related to the API key. - Relationships *APIKeyRelationships `json:"relationships,omitempty"` - // API Keys resource type. - Type *APIKeysType `json:"type,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{} -} - -// NewFullAPIKey instantiates a new FullAPIKey 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 NewFullAPIKey() *FullAPIKey { - this := FullAPIKey{} - var typeVar APIKeysType = APIKEYSTYPE_API_KEYS - this.Type = &typeVar - return &this -} - -// NewFullAPIKeyWithDefaults instantiates a new FullAPIKey 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 NewFullAPIKeyWithDefaults() *FullAPIKey { - this := FullAPIKey{} - var typeVar APIKeysType = APIKEYSTYPE_API_KEYS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *FullAPIKey) GetAttributes() FullAPIKeyAttributes { - if o == nil || o.Attributes == nil { - var ret FullAPIKeyAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKey) GetAttributesOk() (*FullAPIKeyAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *FullAPIKey) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given FullAPIKeyAttributes and assigns it to the Attributes field. -func (o *FullAPIKey) SetAttributes(v FullAPIKeyAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *FullAPIKey) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKey) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *FullAPIKey) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *FullAPIKey) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *FullAPIKey) GetRelationships() APIKeyRelationships { - if o == nil || o.Relationships == nil { - var ret APIKeyRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKey) GetRelationshipsOk() (*APIKeyRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *FullAPIKey) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given APIKeyRelationships and assigns it to the Relationships field. -func (o *FullAPIKey) SetRelationships(v APIKeyRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *FullAPIKey) GetType() APIKeysType { - if o == nil || o.Type == nil { - var ret APIKeysType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKey) GetTypeOk() (*APIKeysType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *FullAPIKey) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given APIKeysType and assigns it to the Type field. -func (o *FullAPIKey) SetType(v APIKeysType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FullAPIKey) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FullAPIKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *FullAPIKeyAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *APIKeyRelationships `json:"relationships,omitempty"` - Type *APIKeysType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_full_api_key_attributes.go b/api/v2/datadog/model_full_api_key_attributes.go deleted file mode 100644 index 070e339875f..00000000000 --- a/api/v2/datadog/model_full_api_key_attributes.go +++ /dev/null @@ -1,258 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// FullAPIKeyAttributes Attributes of a full API key. -type FullAPIKeyAttributes struct { - // Creation date of the API key. - CreatedAt *string `json:"created_at,omitempty"` - // The API key. - Key *string `json:"key,omitempty"` - // The last four characters of the API key. - Last4 *string `json:"last4,omitempty"` - // Date the API key was last modified. - ModifiedAt *string `json:"modified_at,omitempty"` - // Name of the API key. - Name *string `json:"name,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{} -} - -// NewFullAPIKeyAttributes instantiates a new FullAPIKeyAttributes 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 NewFullAPIKeyAttributes() *FullAPIKeyAttributes { - this := FullAPIKeyAttributes{} - return &this -} - -// NewFullAPIKeyAttributesWithDefaults instantiates a new FullAPIKeyAttributes 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 NewFullAPIKeyAttributesWithDefaults() *FullAPIKeyAttributes { - this := FullAPIKeyAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *FullAPIKeyAttributes) GetCreatedAt() string { - if o == nil || o.CreatedAt == nil { - var ret string - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKeyAttributes) GetCreatedAtOk() (*string, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *FullAPIKeyAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. -func (o *FullAPIKeyAttributes) SetCreatedAt(v string) { - o.CreatedAt = &v -} - -// GetKey returns the Key field value if set, zero value otherwise. -func (o *FullAPIKeyAttributes) GetKey() string { - if o == nil || o.Key == nil { - var ret string - return ret - } - return *o.Key -} - -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKeyAttributes) GetKeyOk() (*string, bool) { - if o == nil || o.Key == nil { - return nil, false - } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *FullAPIKeyAttributes) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false -} - -// SetKey gets a reference to the given string and assigns it to the Key field. -func (o *FullAPIKeyAttributes) SetKey(v string) { - o.Key = &v -} - -// GetLast4 returns the Last4 field value if set, zero value otherwise. -func (o *FullAPIKeyAttributes) GetLast4() string { - if o == nil || o.Last4 == nil { - var ret string - return ret - } - return *o.Last4 -} - -// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKeyAttributes) GetLast4Ok() (*string, bool) { - if o == nil || o.Last4 == nil { - return nil, false - } - return o.Last4, true -} - -// HasLast4 returns a boolean if a field has been set. -func (o *FullAPIKeyAttributes) HasLast4() bool { - if o != nil && o.Last4 != nil { - return true - } - - return false -} - -// SetLast4 gets a reference to the given string and assigns it to the Last4 field. -func (o *FullAPIKeyAttributes) SetLast4(v string) { - o.Last4 = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *FullAPIKeyAttributes) GetModifiedAt() string { - if o == nil || o.ModifiedAt == nil { - var ret string - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKeyAttributes) GetModifiedAtOk() (*string, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *FullAPIKeyAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given string and assigns it to the ModifiedAt field. -func (o *FullAPIKeyAttributes) SetModifiedAt(v string) { - o.ModifiedAt = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *FullAPIKeyAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullAPIKeyAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *FullAPIKeyAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *FullAPIKeyAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FullAPIKeyAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.Key != nil { - toSerialize["key"] = o.Key - } - if o.Last4 != nil { - toSerialize["last4"] = o.Last4 - } - if o.ModifiedAt != nil { - toSerialize["modified_at"] = o.ModifiedAt - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FullAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *string `json:"created_at,omitempty"` - Key *string `json:"key,omitempty"` - Last4 *string `json:"last4,omitempty"` - ModifiedAt *string `json:"modified_at,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.Key = all.Key - o.Last4 = all.Last4 - o.ModifiedAt = all.ModifiedAt - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_full_application_key.go b/api/v2/datadog/model_full_application_key.go deleted file mode 100644 index e7e5c50123a..00000000000 --- a/api/v2/datadog/model_full_application_key.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// FullApplicationKey Datadog application key. -type FullApplicationKey struct { - // Attributes of a full application key. - Attributes *FullApplicationKeyAttributes `json:"attributes,omitempty"` - // ID of the application key. - Id *string `json:"id,omitempty"` - // Resources related to the application key. - Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` - // Application Keys resource type. - Type *ApplicationKeysType `json:"type,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{} -} - -// NewFullApplicationKey instantiates a new FullApplicationKey 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 NewFullApplicationKey() *FullApplicationKey { - this := FullApplicationKey{} - var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS - this.Type = &typeVar - return &this -} - -// NewFullApplicationKeyWithDefaults instantiates a new FullApplicationKey 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 NewFullApplicationKeyWithDefaults() *FullApplicationKey { - this := FullApplicationKey{} - var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *FullApplicationKey) GetAttributes() FullApplicationKeyAttributes { - if o == nil || o.Attributes == nil { - var ret FullApplicationKeyAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKey) GetAttributesOk() (*FullApplicationKeyAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *FullApplicationKey) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given FullApplicationKeyAttributes and assigns it to the Attributes field. -func (o *FullApplicationKey) SetAttributes(v FullApplicationKeyAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *FullApplicationKey) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKey) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *FullApplicationKey) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *FullApplicationKey) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *FullApplicationKey) GetRelationships() ApplicationKeyRelationships { - if o == nil || o.Relationships == nil { - var ret ApplicationKeyRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKey) GetRelationshipsOk() (*ApplicationKeyRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *FullApplicationKey) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given ApplicationKeyRelationships and assigns it to the Relationships field. -func (o *FullApplicationKey) SetRelationships(v ApplicationKeyRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *FullApplicationKey) GetType() ApplicationKeysType { - if o == nil || o.Type == nil { - var ret ApplicationKeysType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKey) GetTypeOk() (*ApplicationKeysType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *FullApplicationKey) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given ApplicationKeysType and assigns it to the Type field. -func (o *FullApplicationKey) SetType(v ApplicationKeysType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FullApplicationKey) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FullApplicationKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *FullApplicationKeyAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` - Type *ApplicationKeysType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_full_application_key_attributes.go b/api/v2/datadog/model_full_application_key_attributes.go deleted file mode 100644 index 742a45e0dcd..00000000000 --- a/api/v2/datadog/model_full_application_key_attributes.go +++ /dev/null @@ -1,259 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// FullApplicationKeyAttributes Attributes of a full application key. -type FullApplicationKeyAttributes struct { - // Creation date of the application key. - CreatedAt *string `json:"created_at,omitempty"` - // The application key. - Key *string `json:"key,omitempty"` - // The last four characters of the application key. - Last4 *string `json:"last4,omitempty"` - // Name of the application key. - Name *string `json:"name,omitempty"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. - Scopes []string `json:"scopes,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{} -} - -// NewFullApplicationKeyAttributes instantiates a new FullApplicationKeyAttributes 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 NewFullApplicationKeyAttributes() *FullApplicationKeyAttributes { - this := FullApplicationKeyAttributes{} - return &this -} - -// NewFullApplicationKeyAttributesWithDefaults instantiates a new FullApplicationKeyAttributes 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 NewFullApplicationKeyAttributesWithDefaults() *FullApplicationKeyAttributes { - this := FullApplicationKeyAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *FullApplicationKeyAttributes) GetCreatedAt() string { - if o == nil || o.CreatedAt == nil { - var ret string - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKeyAttributes) GetCreatedAtOk() (*string, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *FullApplicationKeyAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. -func (o *FullApplicationKeyAttributes) SetCreatedAt(v string) { - o.CreatedAt = &v -} - -// GetKey returns the Key field value if set, zero value otherwise. -func (o *FullApplicationKeyAttributes) GetKey() string { - if o == nil || o.Key == nil { - var ret string - return ret - } - return *o.Key -} - -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKeyAttributes) GetKeyOk() (*string, bool) { - if o == nil || o.Key == nil { - return nil, false - } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *FullApplicationKeyAttributes) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false -} - -// SetKey gets a reference to the given string and assigns it to the Key field. -func (o *FullApplicationKeyAttributes) SetKey(v string) { - o.Key = &v -} - -// GetLast4 returns the Last4 field value if set, zero value otherwise. -func (o *FullApplicationKeyAttributes) GetLast4() string { - if o == nil || o.Last4 == nil { - var ret string - return ret - } - return *o.Last4 -} - -// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKeyAttributes) GetLast4Ok() (*string, bool) { - if o == nil || o.Last4 == nil { - return nil, false - } - return o.Last4, true -} - -// HasLast4 returns a boolean if a field has been set. -func (o *FullApplicationKeyAttributes) HasLast4() bool { - if o != nil && o.Last4 != nil { - return true - } - - return false -} - -// SetLast4 gets a reference to the given string and assigns it to the Last4 field. -func (o *FullApplicationKeyAttributes) SetLast4(v string) { - o.Last4 = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *FullApplicationKeyAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FullApplicationKeyAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *FullApplicationKeyAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *FullApplicationKeyAttributes) SetName(v string) { - o.Name = &v -} - -// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *FullApplicationKeyAttributes) GetScopes() []string { - if o == nil { - var ret []string - return ret - } - return o.Scopes -} - -// GetScopesOk returns a tuple with the Scopes 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 *FullApplicationKeyAttributes) GetScopesOk() (*[]string, bool) { - if o == nil || o.Scopes == nil { - return nil, false - } - return &o.Scopes, true -} - -// HasScopes returns a boolean if a field has been set. -func (o *FullApplicationKeyAttributes) HasScopes() bool { - if o != nil && o.Scopes != nil { - return true - } - - return false -} - -// SetScopes gets a reference to the given []string and assigns it to the Scopes field. -func (o *FullApplicationKeyAttributes) SetScopes(v []string) { - o.Scopes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o FullApplicationKeyAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.Key != nil { - toSerialize["key"] = o.Key - } - if o.Last4 != nil { - toSerialize["last4"] = o.Last4 - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Scopes != nil { - toSerialize["scopes"] = o.Scopes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *string `json:"created_at,omitempty"` - Key *string `json:"key,omitempty"` - Last4 *string `json:"last4,omitempty"` - Name *string `json:"name,omitempty"` - Scopes []string `json:"scopes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.Key = all.Key - o.Last4 = all.Last4 - o.Name = all.Name - o.Scopes = all.Scopes - return nil -} diff --git a/api/v2/datadog/model_hourly_usage.go b/api/v2/datadog/model_hourly_usage.go deleted file mode 100644 index 95e09a671ae..00000000000 --- a/api/v2/datadog/model_hourly_usage.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HourlyUsage Hourly usage for a product family for an org. -type HourlyUsage struct { - // Attributes of hourly usage for a product family for an org for a time period. - Attributes *HourlyUsageAttributes `json:"attributes,omitempty"` - // Unique ID of the response. - Id *string `json:"id,omitempty"` - // Type of usage data. - Type *UsageTimeSeriesType `json:"type,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{} -} - -// NewHourlyUsage instantiates a new HourlyUsage 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 NewHourlyUsage() *HourlyUsage { - this := HourlyUsage{} - var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES - this.Type = &typeVar - return &this -} - -// NewHourlyUsageWithDefaults instantiates a new HourlyUsage 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 NewHourlyUsageWithDefaults() *HourlyUsage { - this := HourlyUsage{} - var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *HourlyUsage) GetAttributes() HourlyUsageAttributes { - if o == nil || o.Attributes == nil { - var ret HourlyUsageAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsage) GetAttributesOk() (*HourlyUsageAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *HourlyUsage) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given HourlyUsageAttributes and assigns it to the Attributes field. -func (o *HourlyUsage) SetAttributes(v HourlyUsageAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *HourlyUsage) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsage) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *HourlyUsage) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *HourlyUsage) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *HourlyUsage) GetType() UsageTimeSeriesType { - if o == nil || o.Type == nil { - var ret UsageTimeSeriesType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsage) GetTypeOk() (*UsageTimeSeriesType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *HourlyUsage) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given UsageTimeSeriesType and assigns it to the Type field. -func (o *HourlyUsage) SetType(v UsageTimeSeriesType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *HourlyUsageAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *UsageTimeSeriesType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_hourly_usage_attributes.go b/api/v2/datadog/model_hourly_usage_attributes.go deleted file mode 100644 index ed9fc11c52c..00000000000 --- a/api/v2/datadog/model_hourly_usage_attributes.go +++ /dev/null @@ -1,302 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// HourlyUsageAttributes Attributes of hourly usage for a product family for an org for a time period. -type HourlyUsageAttributes struct { - // List of the measured usage values for the product family for the org for the time period. - Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"` - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The product for which usage is being reported. - ProductFamily *string `json:"product_family,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // The region of the Datadog instance that the organization belongs to. - Region *string `json:"region,omitempty"` - // Datetime in ISO-8601 format, UTC. The hour for the usage. - Timestamp *time.Time `json:"timestamp,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{} -} - -// NewHourlyUsageAttributes instantiates a new HourlyUsageAttributes 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 NewHourlyUsageAttributes() *HourlyUsageAttributes { - this := HourlyUsageAttributes{} - return &this -} - -// NewHourlyUsageAttributesWithDefaults instantiates a new HourlyUsageAttributes 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 NewHourlyUsageAttributesWithDefaults() *HourlyUsageAttributes { - this := HourlyUsageAttributes{} - return &this -} - -// GetMeasurements returns the Measurements field value if set, zero value otherwise. -func (o *HourlyUsageAttributes) GetMeasurements() []HourlyUsageMeasurement { - if o == nil || o.Measurements == nil { - var ret []HourlyUsageMeasurement - return ret - } - return o.Measurements -} - -// GetMeasurementsOk returns a tuple with the Measurements field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributes) GetMeasurementsOk() (*[]HourlyUsageMeasurement, bool) { - if o == nil || o.Measurements == nil { - return nil, false - } - return &o.Measurements, true -} - -// HasMeasurements returns a boolean if a field has been set. -func (o *HourlyUsageAttributes) HasMeasurements() bool { - if o != nil && o.Measurements != nil { - return true - } - - return false -} - -// SetMeasurements gets a reference to the given []HourlyUsageMeasurement and assigns it to the Measurements field. -func (o *HourlyUsageAttributes) SetMeasurements(v []HourlyUsageMeasurement) { - o.Measurements = v -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *HourlyUsageAttributes) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributes) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *HourlyUsageAttributes) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *HourlyUsageAttributes) SetOrgName(v string) { - o.OrgName = &v -} - -// GetProductFamily returns the ProductFamily field value if set, zero value otherwise. -func (o *HourlyUsageAttributes) GetProductFamily() string { - if o == nil || o.ProductFamily == nil { - var ret string - return ret - } - return *o.ProductFamily -} - -// GetProductFamilyOk returns a tuple with the ProductFamily field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributes) GetProductFamilyOk() (*string, bool) { - if o == nil || o.ProductFamily == nil { - return nil, false - } - return o.ProductFamily, true -} - -// HasProductFamily returns a boolean if a field has been set. -func (o *HourlyUsageAttributes) HasProductFamily() bool { - if o != nil && o.ProductFamily != nil { - return true - } - - return false -} - -// SetProductFamily gets a reference to the given string and assigns it to the ProductFamily field. -func (o *HourlyUsageAttributes) SetProductFamily(v string) { - o.ProductFamily = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *HourlyUsageAttributes) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributes) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *HourlyUsageAttributes) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *HourlyUsageAttributes) SetPublicId(v string) { - o.PublicId = &v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *HourlyUsageAttributes) GetRegion() string { - if o == nil || o.Region == nil { - var ret string - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributes) GetRegionOk() (*string, bool) { - if o == nil || o.Region == nil { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *HourlyUsageAttributes) HasRegion() bool { - if o != nil && o.Region != nil { - return true - } - - return false -} - -// SetRegion gets a reference to the given string and assigns it to the Region field. -func (o *HourlyUsageAttributes) SetRegion(v string) { - o.Region = &v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *HourlyUsageAttributes) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageAttributes) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *HourlyUsageAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *HourlyUsageAttributes) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Measurements != nil { - toSerialize["measurements"] = o.Measurements - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.ProductFamily != nil { - toSerialize["product_family"] = o.ProductFamily - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Region != nil { - toSerialize["region"] = o.Region - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"` - OrgName *string `json:"org_name,omitempty"` - ProductFamily *string `json:"product_family,omitempty"` - PublicId *string `json:"public_id,omitempty"` - Region *string `json:"region,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Measurements = all.Measurements - o.OrgName = all.OrgName - o.ProductFamily = all.ProductFamily - o.PublicId = all.PublicId - o.Region = all.Region - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v2/datadog/model_hourly_usage_measurement.go b/api/v2/datadog/model_hourly_usage_measurement.go deleted file mode 100644 index c0ba872b114..00000000000 --- a/api/v2/datadog/model_hourly_usage_measurement.go +++ /dev/null @@ -1,154 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// HourlyUsageMeasurement Usage amount for a given usage type. -type HourlyUsageMeasurement struct { - // Type of usage. - UsageType *string `json:"usage_type,omitempty"` - // Contains the number measured for the given usage_type during the hour. - Value common.NullableInt64 `json:"value,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{} -} - -// NewHourlyUsageMeasurement instantiates a new HourlyUsageMeasurement 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 NewHourlyUsageMeasurement() *HourlyUsageMeasurement { - this := HourlyUsageMeasurement{} - return &this -} - -// NewHourlyUsageMeasurementWithDefaults instantiates a new HourlyUsageMeasurement 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 NewHourlyUsageMeasurementWithDefaults() *HourlyUsageMeasurement { - this := HourlyUsageMeasurement{} - return &this -} - -// GetUsageType returns the UsageType field value if set, zero value otherwise. -func (o *HourlyUsageMeasurement) GetUsageType() string { - if o == nil || o.UsageType == nil { - var ret string - return ret - } - return *o.UsageType -} - -// GetUsageTypeOk returns a tuple with the UsageType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageMeasurement) GetUsageTypeOk() (*string, bool) { - if o == nil || o.UsageType == nil { - return nil, false - } - return o.UsageType, true -} - -// HasUsageType returns a boolean if a field has been set. -func (o *HourlyUsageMeasurement) HasUsageType() bool { - if o != nil && o.UsageType != nil { - return true - } - - return false -} - -// SetUsageType gets a reference to the given string and assigns it to the UsageType field. -func (o *HourlyUsageMeasurement) SetUsageType(v string) { - o.UsageType = &v -} - -// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *HourlyUsageMeasurement) GetValue() int64 { - if o == nil || o.Value.Get() == nil { - var ret int64 - return ret - } - return *o.Value.Get() -} - -// GetValueOk returns a tuple with the Value 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 *HourlyUsageMeasurement) GetValueOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Value.Get(), o.Value.IsSet() -} - -// HasValue returns a boolean if a field has been set. -func (o *HourlyUsageMeasurement) HasValue() bool { - if o != nil && o.Value.IsSet() { - return true - } - - return false -} - -// SetValue gets a reference to the given common.NullableInt64 and assigns it to the Value field. -func (o *HourlyUsageMeasurement) SetValue(v int64) { - o.Value.Set(&v) -} - -// SetValueNil sets the value for Value to be an explicit nil. -func (o *HourlyUsageMeasurement) SetValueNil() { - o.Value.Set(nil) -} - -// UnsetValue ensures that no value is present for Value, not even an explicit nil. -func (o *HourlyUsageMeasurement) UnsetValue() { - o.Value.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageMeasurement) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.UsageType != nil { - toSerialize["usage_type"] = o.UsageType - } - if o.Value.IsSet() { - toSerialize["value"] = o.Value.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageMeasurement) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - UsageType *string `json:"usage_type,omitempty"` - Value common.NullableInt64 `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.UsageType = all.UsageType - o.Value = all.Value - return nil -} diff --git a/api/v2/datadog/model_hourly_usage_metadata.go b/api/v2/datadog/model_hourly_usage_metadata.go deleted file mode 100644 index e6b987bd2cd..00000000000 --- a/api/v2/datadog/model_hourly_usage_metadata.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HourlyUsageMetadata The object containing document metadata. -type HourlyUsageMetadata struct { - // The metadata for the current pagination. - Pagination *HourlyUsagePagination `json:"pagination,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{} -} - -// NewHourlyUsageMetadata instantiates a new HourlyUsageMetadata 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 NewHourlyUsageMetadata() *HourlyUsageMetadata { - this := HourlyUsageMetadata{} - return &this -} - -// NewHourlyUsageMetadataWithDefaults instantiates a new HourlyUsageMetadata 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 NewHourlyUsageMetadataWithDefaults() *HourlyUsageMetadata { - this := HourlyUsageMetadata{} - return &this -} - -// GetPagination returns the Pagination field value if set, zero value otherwise. -func (o *HourlyUsageMetadata) GetPagination() HourlyUsagePagination { - if o == nil || o.Pagination == nil { - var ret HourlyUsagePagination - return ret - } - return *o.Pagination -} - -// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageMetadata) GetPaginationOk() (*HourlyUsagePagination, bool) { - if o == nil || o.Pagination == nil { - return nil, false - } - return o.Pagination, true -} - -// HasPagination returns a boolean if a field has been set. -func (o *HourlyUsageMetadata) HasPagination() bool { - if o != nil && o.Pagination != nil { - return true - } - - return false -} - -// SetPagination gets a reference to the given HourlyUsagePagination and assigns it to the Pagination field. -func (o *HourlyUsageMetadata) SetPagination(v HourlyUsagePagination) { - o.Pagination = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Pagination != nil { - toSerialize["pagination"] = o.Pagination - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Pagination *HourlyUsagePagination `json:"pagination,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pagination = all.Pagination - return nil -} diff --git a/api/v2/datadog/model_hourly_usage_pagination.go b/api/v2/datadog/model_hourly_usage_pagination.go deleted file mode 100644 index 837bafe6340..00000000000 --- a/api/v2/datadog/model_hourly_usage_pagination.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// HourlyUsagePagination The metadata for the current pagination. -type HourlyUsagePagination struct { - // The cursor to get the next results (if any). To make the next request, use the same parameters and add `next_record_id`. - NextRecordId common.NullableString `json:"next_record_id,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{} -} - -// NewHourlyUsagePagination instantiates a new HourlyUsagePagination 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 NewHourlyUsagePagination() *HourlyUsagePagination { - this := HourlyUsagePagination{} - return &this -} - -// NewHourlyUsagePaginationWithDefaults instantiates a new HourlyUsagePagination 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 NewHourlyUsagePaginationWithDefaults() *HourlyUsagePagination { - this := HourlyUsagePagination{} - return &this -} - -// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *HourlyUsagePagination) GetNextRecordId() string { - if o == nil || o.NextRecordId.Get() == nil { - var ret string - return ret - } - return *o.NextRecordId.Get() -} - -// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *HourlyUsagePagination) GetNextRecordIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.NextRecordId.Get(), o.NextRecordId.IsSet() -} - -// HasNextRecordId returns a boolean if a field has been set. -func (o *HourlyUsagePagination) HasNextRecordId() bool { - if o != nil && o.NextRecordId.IsSet() { - return true - } - - return false -} - -// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. -func (o *HourlyUsagePagination) SetNextRecordId(v string) { - o.NextRecordId.Set(&v) -} - -// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. -func (o *HourlyUsagePagination) SetNextRecordIdNil() { - o.NextRecordId.Set(nil) -} - -// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. -func (o *HourlyUsagePagination) UnsetNextRecordId() { - o.NextRecordId.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsagePagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.NextRecordId.IsSet() { - toSerialize["next_record_id"] = o.NextRecordId.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsagePagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - NextRecordId common.NullableString `json:"next_record_id,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.NextRecordId = all.NextRecordId - return nil -} diff --git a/api/v2/datadog/model_hourly_usage_response.go b/api/v2/datadog/model_hourly_usage_response.go deleted file mode 100644 index 25f62e077a2..00000000000 --- a/api/v2/datadog/model_hourly_usage_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HourlyUsageResponse Hourly usage response. -type HourlyUsageResponse struct { - // Response containing hourly usage. - Data []HourlyUsage `json:"data,omitempty"` - // The object containing document metadata. - Meta *HourlyUsageMetadata `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{} -} - -// NewHourlyUsageResponse instantiates a new HourlyUsageResponse 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 NewHourlyUsageResponse() *HourlyUsageResponse { - this := HourlyUsageResponse{} - return &this -} - -// NewHourlyUsageResponseWithDefaults instantiates a new HourlyUsageResponse 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 NewHourlyUsageResponseWithDefaults() *HourlyUsageResponse { - this := HourlyUsageResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *HourlyUsageResponse) GetData() []HourlyUsage { - if o == nil || o.Data == nil { - var ret []HourlyUsage - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HourlyUsageResponse) GetDataOk() (*[]HourlyUsage, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *HourlyUsageResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []HourlyUsage and assigns it to the Data field. -func (o *HourlyUsageResponse) SetData(v []HourlyUsage) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *HourlyUsageResponse) GetMeta() HourlyUsageMetadata { - if o == nil || o.Meta == nil { - var ret HourlyUsageMetadata - 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 *HourlyUsageResponse) GetMetaOk() (*HourlyUsageMetadata, 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 *HourlyUsageResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given HourlyUsageMetadata and assigns it to the Meta field. -func (o *HourlyUsageResponse) SetMeta(v HourlyUsageMetadata) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HourlyUsageResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HourlyUsageResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []HourlyUsage `json:"data,omitempty"` - Meta *HourlyUsageMetadata `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_hourly_usage_type.go b/api/v2/datadog/model_hourly_usage_type.go deleted file mode 100644 index 0602f384e42..00000000000 --- a/api/v2/datadog/model_hourly_usage_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HourlyUsageType Usage type that is being measured. -type HourlyUsageType string - -// List of HourlyUsageType. -const ( - HOURLYUSAGETYPE_APP_SEC_HOST_COUNT HourlyUsageType = "app_sec_host_count" - HOURLYUSAGETYPE_OBSERVABILITY_PIPELINES_BYTES_PROCESSSED HourlyUsageType = "observability_pipelines_bytes_processed" - HOURLYUSAGETYPE_LAMBDA_TRACED_INVOCATIONS_COUNT HourlyUsageType = "lambda_traced_invocations_count" -) - -var allowedHourlyUsageTypeEnumValues = []HourlyUsageType{ - HOURLYUSAGETYPE_APP_SEC_HOST_COUNT, - HOURLYUSAGETYPE_OBSERVABILITY_PIPELINES_BYTES_PROCESSSED, - HOURLYUSAGETYPE_LAMBDA_TRACED_INVOCATIONS_COUNT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *HourlyUsageType) GetAllowedValues() []HourlyUsageType { - return allowedHourlyUsageTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *HourlyUsageType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = HourlyUsageType(value) - return nil -} - -// NewHourlyUsageTypeFromValue returns a pointer to a valid HourlyUsageType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewHourlyUsageTypeFromValue(v string) (*HourlyUsageType, error) { - ev := HourlyUsageType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for HourlyUsageType: valid values are %v", v, allowedHourlyUsageTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v HourlyUsageType) IsValid() bool { - for _, existing := range allowedHourlyUsageTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to HourlyUsageType value. -func (v HourlyUsageType) Ptr() *HourlyUsageType { - return &v -} - -// NullableHourlyUsageType handles when a null is used for HourlyUsageType. -type NullableHourlyUsageType struct { - value *HourlyUsageType - isSet bool -} - -// Get returns the associated value. -func (v NullableHourlyUsageType) Get() *HourlyUsageType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableHourlyUsageType) Set(val *HourlyUsageType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableHourlyUsageType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableHourlyUsageType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableHourlyUsageType initializes the struct as if Set has been called. -func NewNullableHourlyUsageType(val *HourlyUsageType) *NullableHourlyUsageType { - return &NullableHourlyUsageType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableHourlyUsageType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableHourlyUsageType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_http_log_error.go b/api/v2/datadog/model_http_log_error.go deleted file mode 100644 index 6c5ba1e1c9b..00000000000 --- a/api/v2/datadog/model_http_log_error.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HTTPLogError List of errors. -type HTTPLogError struct { - // Error message. - Detail *string `json:"detail,omitempty"` - // Error code. - Status *string `json:"status,omitempty"` - // Error title. - Title *string `json:"title,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{} -} - -// NewHTTPLogError instantiates a new HTTPLogError 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 NewHTTPLogError() *HTTPLogError { - this := HTTPLogError{} - return &this -} - -// NewHTTPLogErrorWithDefaults instantiates a new HTTPLogError 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 NewHTTPLogErrorWithDefaults() *HTTPLogError { - this := HTTPLogError{} - return &this -} - -// GetDetail returns the Detail field value if set, zero value otherwise. -func (o *HTTPLogError) GetDetail() string { - if o == nil || o.Detail == nil { - var ret string - return ret - } - return *o.Detail -} - -// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogError) GetDetailOk() (*string, bool) { - if o == nil || o.Detail == nil { - return nil, false - } - return o.Detail, true -} - -// HasDetail returns a boolean if a field has been set. -func (o *HTTPLogError) HasDetail() bool { - if o != nil && o.Detail != nil { - return true - } - - return false -} - -// SetDetail gets a reference to the given string and assigns it to the Detail field. -func (o *HTTPLogError) SetDetail(v string) { - o.Detail = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *HTTPLogError) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogError) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *HTTPLogError) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *HTTPLogError) SetStatus(v string) { - o.Status = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *HTTPLogError) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogError) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *HTTPLogError) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *HTTPLogError) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HTTPLogError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Detail != nil { - toSerialize["detail"] = o.Detail - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Detail *string `json:"detail,omitempty"` - Status *string `json:"status,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Detail = all.Detail - o.Status = all.Status - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_http_log_errors.go b/api/v2/datadog/model_http_log_errors.go deleted file mode 100644 index 93e9553fab4..00000000000 --- a/api/v2/datadog/model_http_log_errors.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// HTTPLogErrors Invalid query performed. -type HTTPLogErrors struct { - // Structured errors. - Errors []HTTPLogError `json:"errors,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{} -} - -// NewHTTPLogErrors instantiates a new HTTPLogErrors 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 NewHTTPLogErrors() *HTTPLogErrors { - this := HTTPLogErrors{} - return &this -} - -// NewHTTPLogErrorsWithDefaults instantiates a new HTTPLogErrors 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 NewHTTPLogErrorsWithDefaults() *HTTPLogErrors { - this := HTTPLogErrors{} - return &this -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *HTTPLogErrors) GetErrors() []HTTPLogError { - if o == nil || o.Errors == nil { - var ret []HTTPLogError - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogErrors) GetErrorsOk() (*[]HTTPLogError, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *HTTPLogErrors) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []HTTPLogError and assigns it to the Errors field. -func (o *HTTPLogErrors) SetErrors(v []HTTPLogError) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HTTPLogErrors) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HTTPLogErrors) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Errors []HTTPLogError `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Errors = all.Errors - return nil -} diff --git a/api/v2/datadog/model_http_log_item.go b/api/v2/datadog/model_http_log_item.go deleted file mode 100644 index e0a9b9d7679..00000000000 --- a/api/v2/datadog/model_http_log_item.go +++ /dev/null @@ -1,265 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// HTTPLogItem Logs that are sent over HTTP. -type HTTPLogItem struct { - // The integration name associated with your log: the technology from which the log originated. - // When it matches an integration name, Datadog automatically installs the corresponding parsers and facets. - // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). - Ddsource *string `json:"ddsource,omitempty"` - // Tags associated with your logs. - Ddtags *string `json:"ddtags,omitempty"` - // The name of the originating host of the log. - Hostname *string `json:"hostname,omitempty"` - // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) - // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. - // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. - Message string `json:"message"` - // The name of the application or service generating the log events. - // It is used to switch from Logs to APM, so make sure you define the same value when you use both products. - // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). - Service *string `json:"service,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]string -} - -// NewHTTPLogItem instantiates a new HTTPLogItem 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 NewHTTPLogItem(message string) *HTTPLogItem { - this := HTTPLogItem{} - this.Message = message - return &this -} - -// NewHTTPLogItemWithDefaults instantiates a new HTTPLogItem 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 NewHTTPLogItemWithDefaults() *HTTPLogItem { - this := HTTPLogItem{} - return &this -} - -// GetDdsource returns the Ddsource field value if set, zero value otherwise. -func (o *HTTPLogItem) GetDdsource() string { - if o == nil || o.Ddsource == nil { - var ret string - return ret - } - return *o.Ddsource -} - -// GetDdsourceOk returns a tuple with the Ddsource field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogItem) GetDdsourceOk() (*string, bool) { - if o == nil || o.Ddsource == nil { - return nil, false - } - return o.Ddsource, true -} - -// HasDdsource returns a boolean if a field has been set. -func (o *HTTPLogItem) HasDdsource() bool { - if o != nil && o.Ddsource != nil { - return true - } - - return false -} - -// SetDdsource gets a reference to the given string and assigns it to the Ddsource field. -func (o *HTTPLogItem) SetDdsource(v string) { - o.Ddsource = &v -} - -// GetDdtags returns the Ddtags field value if set, zero value otherwise. -func (o *HTTPLogItem) GetDdtags() string { - if o == nil || o.Ddtags == nil { - var ret string - return ret - } - return *o.Ddtags -} - -// GetDdtagsOk returns a tuple with the Ddtags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *HTTPLogItem) GetDdtagsOk() (*string, bool) { - if o == nil || o.Ddtags == nil { - return nil, false - } - return o.Ddtags, true -} - -// HasDdtags returns a boolean if a field has been set. -func (o *HTTPLogItem) HasDdtags() bool { - if o != nil && o.Ddtags != nil { - return true - } - - return false -} - -// SetDdtags gets a reference to the given string and assigns it to the Ddtags field. -func (o *HTTPLogItem) SetDdtags(v string) { - o.Ddtags = &v -} - -// GetHostname returns the Hostname field value if set, zero value otherwise. -func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasHostname() bool { - if o != nil && o.Hostname != nil { - return true - } - - return false -} - -// SetHostname gets a reference to the given string and assigns it to the Hostname field. -func (o *HTTPLogItem) SetHostname(v string) { - o.Hostname = &v -} - -// GetMessage returns the Message field value. -func (o *HTTPLogItem) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *HTTPLogItem) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *HTTPLogItem) SetMessage(v string) { - o.Message = v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *HTTPLogItem) SetService(v string) { - o.Service = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o HTTPLogItem) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Ddsource != nil { - toSerialize["ddsource"] = o.Ddsource - } - if o.Ddtags != nil { - toSerialize["ddtags"] = o.Ddtags - } - if o.Hostname != nil { - toSerialize["hostname"] = o.Hostname - } - toSerialize["message"] = o.Message - if o.Service != nil { - toSerialize["service"] = o.Service - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Message *string `json:"message"` - }{} - all := struct { - Ddsource *string `json:"ddsource,omitempty"` - Ddtags *string `json:"ddtags,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Message string `json:"message"` - Service *string `json:"service,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Ddsource = all.Ddsource - o.Ddtags = all.Ddtags - o.Hostname = all.Hostname - o.Message = all.Message - o.Service = all.Service - return nil -} diff --git a/api/v2/datadog/model_id_p_metadata_form_data.go b/api/v2/datadog/model_id_p_metadata_form_data.go deleted file mode 100644 index 934a6c17489..00000000000 --- a/api/v2/datadog/model_id_p_metadata_form_data.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "os" -) - -// IdPMetadataFormData The form data submitted to upload IdP metadata -type IdPMetadataFormData struct { - // The IdP metadata XML file - IdpFile **os.File `json:"idp_file,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{} -} - -// NewIdPMetadataFormData instantiates a new IdPMetadataFormData 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 NewIdPMetadataFormData() *IdPMetadataFormData { - this := IdPMetadataFormData{} - return &this -} - -// NewIdPMetadataFormDataWithDefaults instantiates a new IdPMetadataFormData 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 NewIdPMetadataFormDataWithDefaults() *IdPMetadataFormData { - this := IdPMetadataFormData{} - return &this -} - -// GetIdpFile returns the IdpFile field value if set, zero value otherwise. -func (o *IdPMetadataFormData) GetIdpFile() *os.File { - if o == nil || o.IdpFile == nil { - var ret *os.File - return ret - } - return *o.IdpFile -} - -// GetIdpFileOk returns a tuple with the IdpFile field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IdPMetadataFormData) GetIdpFileOk() (**os.File, bool) { - if o == nil || o.IdpFile == nil { - return nil, false - } - return o.IdpFile, true -} - -// HasIdpFile returns a boolean if a field has been set. -func (o *IdPMetadataFormData) HasIdpFile() bool { - if o != nil && o.IdpFile != nil { - return true - } - - return false -} - -// SetIdpFile gets a reference to the given *os.File and assigns it to the IdpFile field. -func (o *IdPMetadataFormData) SetIdpFile(v *os.File) { - o.IdpFile = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IdPMetadataFormData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IdpFile != nil { - toSerialize["idp_file"] = o.IdpFile - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IdPMetadataFormData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IdpFile **os.File `json:"idp_file,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IdpFile = all.IdpFile - return nil -} diff --git a/api/v2/datadog/model_incident_create_attributes.go b/api/v2/datadog/model_incident_create_attributes.go deleted file mode 100644 index f58692919c3..00000000000 --- a/api/v2/datadog/model_incident_create_attributes.go +++ /dev/null @@ -1,253 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentCreateAttributes The incident's attributes for a create request. -type IncidentCreateAttributes struct { - // A flag indicating whether the incident caused customer impact. - CustomerImpacted bool `json:"customer_impacted"` - // A condensed view of the user-defined fields for which to create initial selections. - Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` - // An array of initial timeline cells to be placed at the beginning of the incident timeline. - InitialCells []IncidentTimelineCellCreateAttributes `json:"initial_cells,omitempty"` - // Notification handles that will be notified of the incident at creation. - NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` - // The title of the incident, which summarizes what happened. - Title string `json:"title"` - // 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{} -} - -// NewIncidentCreateAttributes instantiates a new IncidentCreateAttributes 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 NewIncidentCreateAttributes(customerImpacted bool, title string) *IncidentCreateAttributes { - this := IncidentCreateAttributes{} - this.CustomerImpacted = customerImpacted - this.Title = title - return &this -} - -// NewIncidentCreateAttributesWithDefaults instantiates a new IncidentCreateAttributes 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 NewIncidentCreateAttributesWithDefaults() *IncidentCreateAttributes { - this := IncidentCreateAttributes{} - return &this -} - -// GetCustomerImpacted returns the CustomerImpacted field value. -func (o *IncidentCreateAttributes) GetCustomerImpacted() bool { - if o == nil { - var ret bool - return ret - } - return o.CustomerImpacted -} - -// GetCustomerImpactedOk returns a tuple with the CustomerImpacted field value -// and a boolean to check if the value has been set. -func (o *IncidentCreateAttributes) GetCustomerImpactedOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.CustomerImpacted, true -} - -// SetCustomerImpacted sets field value. -func (o *IncidentCreateAttributes) SetCustomerImpacted(v bool) { - o.CustomerImpacted = v -} - -// GetFields returns the Fields field value if set, zero value otherwise. -func (o *IncidentCreateAttributes) GetFields() map[string]IncidentFieldAttributes { - if o == nil || o.Fields == nil { - var ret map[string]IncidentFieldAttributes - return ret - } - return o.Fields -} - -// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentCreateAttributes) GetFieldsOk() (*map[string]IncidentFieldAttributes, bool) { - if o == nil || o.Fields == nil { - return nil, false - } - return &o.Fields, true -} - -// HasFields returns a boolean if a field has been set. -func (o *IncidentCreateAttributes) HasFields() bool { - if o != nil && o.Fields != nil { - return true - } - - return false -} - -// SetFields gets a reference to the given map[string]IncidentFieldAttributes and assigns it to the Fields field. -func (o *IncidentCreateAttributes) SetFields(v map[string]IncidentFieldAttributes) { - o.Fields = v -} - -// GetInitialCells returns the InitialCells field value if set, zero value otherwise. -func (o *IncidentCreateAttributes) GetInitialCells() []IncidentTimelineCellCreateAttributes { - if o == nil || o.InitialCells == nil { - var ret []IncidentTimelineCellCreateAttributes - return ret - } - return o.InitialCells -} - -// GetInitialCellsOk returns a tuple with the InitialCells field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentCreateAttributes) GetInitialCellsOk() (*[]IncidentTimelineCellCreateAttributes, bool) { - if o == nil || o.InitialCells == nil { - return nil, false - } - return &o.InitialCells, true -} - -// HasInitialCells returns a boolean if a field has been set. -func (o *IncidentCreateAttributes) HasInitialCells() bool { - if o != nil && o.InitialCells != nil { - return true - } - - return false -} - -// SetInitialCells gets a reference to the given []IncidentTimelineCellCreateAttributes and assigns it to the InitialCells field. -func (o *IncidentCreateAttributes) SetInitialCells(v []IncidentTimelineCellCreateAttributes) { - o.InitialCells = v -} - -// GetNotificationHandles returns the NotificationHandles field value if set, zero value otherwise. -func (o *IncidentCreateAttributes) GetNotificationHandles() []IncidentNotificationHandle { - if o == nil || o.NotificationHandles == nil { - var ret []IncidentNotificationHandle - return ret - } - return o.NotificationHandles -} - -// GetNotificationHandlesOk returns a tuple with the NotificationHandles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentCreateAttributes) GetNotificationHandlesOk() (*[]IncidentNotificationHandle, bool) { - if o == nil || o.NotificationHandles == nil { - return nil, false - } - return &o.NotificationHandles, true -} - -// HasNotificationHandles returns a boolean if a field has been set. -func (o *IncidentCreateAttributes) HasNotificationHandles() bool { - if o != nil && o.NotificationHandles != nil { - return true - } - - return false -} - -// SetNotificationHandles gets a reference to the given []IncidentNotificationHandle and assigns it to the NotificationHandles field. -func (o *IncidentCreateAttributes) SetNotificationHandles(v []IncidentNotificationHandle) { - o.NotificationHandles = v -} - -// GetTitle returns the Title field value. -func (o *IncidentCreateAttributes) GetTitle() string { - if o == nil { - var ret string - return ret - } - return o.Title -} - -// GetTitleOk returns a tuple with the Title field value -// and a boolean to check if the value has been set. -func (o *IncidentCreateAttributes) GetTitleOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Title, true -} - -// SetTitle sets field value. -func (o *IncidentCreateAttributes) SetTitle(v string) { - o.Title = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["customer_impacted"] = o.CustomerImpacted - if o.Fields != nil { - toSerialize["fields"] = o.Fields - } - if o.InitialCells != nil { - toSerialize["initial_cells"] = o.InitialCells - } - if o.NotificationHandles != nil { - toSerialize["notification_handles"] = o.NotificationHandles - } - toSerialize["title"] = o.Title - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - CustomerImpacted *bool `json:"customer_impacted"` - Title *string `json:"title"` - }{} - all := struct { - CustomerImpacted bool `json:"customer_impacted"` - Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` - InitialCells []IncidentTimelineCellCreateAttributes `json:"initial_cells,omitempty"` - NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` - Title string `json:"title"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.CustomerImpacted == nil { - return fmt.Errorf("Required field customer_impacted missing") - } - if required.Title == nil { - return fmt.Errorf("Required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomerImpacted = all.CustomerImpacted - o.Fields = all.Fields - o.InitialCells = all.InitialCells - o.NotificationHandles = all.NotificationHandles - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_incident_create_data.go b/api/v2/datadog/model_incident_create_data.go deleted file mode 100644 index a16d791a375..00000000000 --- a/api/v2/datadog/model_incident_create_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentCreateData Incident data for a create request. -type IncidentCreateData struct { - // The incident's attributes for a create request. - Attributes IncidentCreateAttributes `json:"attributes"` - // The relationships the incident will have with other resources once created. - Relationships *IncidentCreateRelationships `json:"relationships,omitempty"` - // Incident resource type. - Type IncidentType `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{} -} - -// NewIncidentCreateData instantiates a new IncidentCreateData 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 NewIncidentCreateData(attributes IncidentCreateAttributes, typeVar IncidentType) *IncidentCreateData { - this := IncidentCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewIncidentCreateDataWithDefaults instantiates a new IncidentCreateData 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 NewIncidentCreateDataWithDefaults() *IncidentCreateData { - this := IncidentCreateData{} - var typeVar IncidentType = INCIDENTTYPE_INCIDENTS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *IncidentCreateData) GetAttributes() IncidentCreateAttributes { - if o == nil { - var ret IncidentCreateAttributes - 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 *IncidentCreateData) GetAttributesOk() (*IncidentCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *IncidentCreateData) SetAttributes(v IncidentCreateAttributes) { - o.Attributes = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentCreateData) GetRelationships() IncidentCreateRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentCreateRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentCreateData) GetRelationshipsOk() (*IncidentCreateRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentCreateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentCreateRelationships and assigns it to the Relationships field. -func (o *IncidentCreateData) SetRelationships(v IncidentCreateRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentCreateData) GetType() IncidentType { - if o == nil { - var ret IncidentType - 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 *IncidentCreateData) GetTypeOk() (*IncidentType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentCreateData) SetType(v IncidentType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *IncidentCreateAttributes `json:"attributes"` - Type *IncidentType `json:"type"` - }{} - all := struct { - Attributes IncidentCreateAttributes `json:"attributes"` - Relationships *IncidentCreateRelationships `json:"relationships,omitempty"` - Type IncidentType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_create_relationships.go b/api/v2/datadog/model_incident_create_relationships.go deleted file mode 100644 index bf0d8cbd047..00000000000 --- a/api/v2/datadog/model_incident_create_relationships.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentCreateRelationships The relationships the incident will have with other resources once created. -type IncidentCreateRelationships struct { - // Relationship to user. - CommanderUser NullableRelationshipToUser `json:"commander_user"` - // 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{} -} - -// NewIncidentCreateRelationships instantiates a new IncidentCreateRelationships 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 NewIncidentCreateRelationships(commanderUser NullableRelationshipToUser) *IncidentCreateRelationships { - this := IncidentCreateRelationships{} - this.CommanderUser = commanderUser - return &this -} - -// NewIncidentCreateRelationshipsWithDefaults instantiates a new IncidentCreateRelationships 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 NewIncidentCreateRelationshipsWithDefaults() *IncidentCreateRelationships { - this := IncidentCreateRelationships{} - return &this -} - -// GetCommanderUser returns the CommanderUser field value. -func (o *IncidentCreateRelationships) GetCommanderUser() NullableRelationshipToUser { - if o == nil { - var ret NullableRelationshipToUser - return ret - } - return o.CommanderUser -} - -// GetCommanderUserOk returns a tuple with the CommanderUser field value -// and a boolean to check if the value has been set. -func (o *IncidentCreateRelationships) GetCommanderUserOk() (*NullableRelationshipToUser, bool) { - if o == nil { - return nil, false - } - return &o.CommanderUser, true -} - -// SetCommanderUser sets field value. -func (o *IncidentCreateRelationships) SetCommanderUser(v NullableRelationshipToUser) { - o.CommanderUser = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentCreateRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["commander_user"] = o.CommanderUser - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - CommanderUser *NullableRelationshipToUser `json:"commander_user"` - }{} - all := struct { - CommanderUser NullableRelationshipToUser `json:"commander_user"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.CommanderUser == nil { - return fmt.Errorf("Required field commander_user missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CommanderUser = all.CommanderUser - return nil -} diff --git a/api/v2/datadog/model_incident_create_request.go b/api/v2/datadog/model_incident_create_request.go deleted file mode 100644 index 16d188a692e..00000000000 --- a/api/v2/datadog/model_incident_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentCreateRequest Create request for an incident. -type IncidentCreateRequest struct { - // Incident data for a create request. - Data IncidentCreateData `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{} -} - -// NewIncidentCreateRequest instantiates a new IncidentCreateRequest 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 NewIncidentCreateRequest(data IncidentCreateData) *IncidentCreateRequest { - this := IncidentCreateRequest{} - this.Data = data - return &this -} - -// NewIncidentCreateRequestWithDefaults instantiates a new IncidentCreateRequest 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 NewIncidentCreateRequestWithDefaults() *IncidentCreateRequest { - this := IncidentCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentCreateRequest) GetData() IncidentCreateData { - if o == nil { - var ret IncidentCreateData - 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 *IncidentCreateRequest) GetDataOk() (*IncidentCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentCreateRequest) SetData(v IncidentCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentCreateData `json:"data"` - }{} - all := struct { - Data IncidentCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_incident_field_attributes.go b/api/v2/datadog/model_incident_field_attributes.go deleted file mode 100644 index 21d106c2717..00000000000 --- a/api/v2/datadog/model_incident_field_attributes.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentFieldAttributes - Dynamic fields for which selections can be made, with field names as keys. -type IncidentFieldAttributes struct { - IncidentFieldAttributesSingleValue *IncidentFieldAttributesSingleValue - IncidentFieldAttributesMultipleValue *IncidentFieldAttributesMultipleValue - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// IncidentFieldAttributesSingleValueAsIncidentFieldAttributes is a convenience function that returns IncidentFieldAttributesSingleValue wrapped in IncidentFieldAttributes. -func IncidentFieldAttributesSingleValueAsIncidentFieldAttributes(v *IncidentFieldAttributesSingleValue) IncidentFieldAttributes { - return IncidentFieldAttributes{IncidentFieldAttributesSingleValue: v} -} - -// IncidentFieldAttributesMultipleValueAsIncidentFieldAttributes is a convenience function that returns IncidentFieldAttributesMultipleValue wrapped in IncidentFieldAttributes. -func IncidentFieldAttributesMultipleValueAsIncidentFieldAttributes(v *IncidentFieldAttributesMultipleValue) IncidentFieldAttributes { - return IncidentFieldAttributes{IncidentFieldAttributesMultipleValue: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *IncidentFieldAttributes) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into IncidentFieldAttributesSingleValue - err = json.Unmarshal(data, &obj.IncidentFieldAttributesSingleValue) - if err == nil { - if obj.IncidentFieldAttributesSingleValue != nil && obj.IncidentFieldAttributesSingleValue.UnparsedObject == nil { - jsonIncidentFieldAttributesSingleValue, _ := json.Marshal(obj.IncidentFieldAttributesSingleValue) - if string(jsonIncidentFieldAttributesSingleValue) == "{}" { // empty struct - obj.IncidentFieldAttributesSingleValue = nil - } else { - match++ - } - } else { - obj.IncidentFieldAttributesSingleValue = nil - } - } else { - obj.IncidentFieldAttributesSingleValue = nil - } - - // try to unmarshal data into IncidentFieldAttributesMultipleValue - err = json.Unmarshal(data, &obj.IncidentFieldAttributesMultipleValue) - if err == nil { - if obj.IncidentFieldAttributesMultipleValue != nil && obj.IncidentFieldAttributesMultipleValue.UnparsedObject == nil { - jsonIncidentFieldAttributesMultipleValue, _ := json.Marshal(obj.IncidentFieldAttributesMultipleValue) - if string(jsonIncidentFieldAttributesMultipleValue) == "{}" { // empty struct - obj.IncidentFieldAttributesMultipleValue = nil - } else { - match++ - } - } else { - obj.IncidentFieldAttributesMultipleValue = nil - } - } else { - obj.IncidentFieldAttributesMultipleValue = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.IncidentFieldAttributesSingleValue = nil - obj.IncidentFieldAttributesMultipleValue = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj IncidentFieldAttributes) MarshalJSON() ([]byte, error) { - if obj.IncidentFieldAttributesSingleValue != nil { - return json.Marshal(&obj.IncidentFieldAttributesSingleValue) - } - - if obj.IncidentFieldAttributesMultipleValue != nil { - return json.Marshal(&obj.IncidentFieldAttributesMultipleValue) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *IncidentFieldAttributes) GetActualInstance() interface{} { - if obj.IncidentFieldAttributesSingleValue != nil { - return obj.IncidentFieldAttributesSingleValue - } - - if obj.IncidentFieldAttributesMultipleValue != nil { - return obj.IncidentFieldAttributesMultipleValue - } - - // all schemas are nil - return nil -} - -// NullableIncidentFieldAttributes handles when a null is used for IncidentFieldAttributes. -type NullableIncidentFieldAttributes struct { - value *IncidentFieldAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentFieldAttributes) Get() *IncidentFieldAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentFieldAttributes) Set(val *IncidentFieldAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentFieldAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentFieldAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentFieldAttributes initializes the struct as if Set has been called. -func NewNullableIncidentFieldAttributes(val *IncidentFieldAttributes) *NullableIncidentFieldAttributes { - return &NullableIncidentFieldAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentFieldAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentFieldAttributes) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_field_attributes_multiple_value.go b/api/v2/datadog/model_incident_field_attributes_multiple_value.go deleted file mode 100644 index 086cc6e3bcd..00000000000 --- a/api/v2/datadog/model_incident_field_attributes_multiple_value.go +++ /dev/null @@ -1,154 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentFieldAttributesMultipleValue A field with potentially multiple values selected. -type IncidentFieldAttributesMultipleValue struct { - // Type of the multiple value field definitions. - Type *IncidentFieldAttributesValueType `json:"type,omitempty"` - // The multiple values selected for this field. - Value []string `json:"value,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{} -} - -// NewIncidentFieldAttributesMultipleValue instantiates a new IncidentFieldAttributesMultipleValue 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 NewIncidentFieldAttributesMultipleValue() *IncidentFieldAttributesMultipleValue { - this := IncidentFieldAttributesMultipleValue{} - var typeVar IncidentFieldAttributesValueType = INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT - this.Type = &typeVar - return &this -} - -// NewIncidentFieldAttributesMultipleValueWithDefaults instantiates a new IncidentFieldAttributesMultipleValue 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 NewIncidentFieldAttributesMultipleValueWithDefaults() *IncidentFieldAttributesMultipleValue { - this := IncidentFieldAttributesMultipleValue{} - var typeVar IncidentFieldAttributesValueType = INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT - this.Type = &typeVar - return &this -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *IncidentFieldAttributesMultipleValue) GetType() IncidentFieldAttributesValueType { - if o == nil || o.Type == nil { - var ret IncidentFieldAttributesValueType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentFieldAttributesMultipleValue) GetTypeOk() (*IncidentFieldAttributesValueType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *IncidentFieldAttributesMultipleValue) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given IncidentFieldAttributesValueType and assigns it to the Type field. -func (o *IncidentFieldAttributesMultipleValue) SetType(v IncidentFieldAttributesValueType) { - o.Type = &v -} - -// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentFieldAttributesMultipleValue) GetValue() []string { - if o == nil { - var ret []string - return ret - } - return o.Value -} - -// GetValueOk returns a tuple with the Value 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 *IncidentFieldAttributesMultipleValue) GetValueOk() (*[]string, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return &o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *IncidentFieldAttributesMultipleValue) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given []string and assigns it to the Value field. -func (o *IncidentFieldAttributesMultipleValue) SetValue(v []string) { - o.Value = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentFieldAttributesMultipleValue) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentFieldAttributesMultipleValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Type *IncidentFieldAttributesValueType `json:"type,omitempty"` - Value []string `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - o.Value = all.Value - return nil -} diff --git a/api/v2/datadog/model_incident_field_attributes_single_value.go b/api/v2/datadog/model_incident_field_attributes_single_value.go deleted file mode 100644 index 74a8b8f5290..00000000000 --- a/api/v2/datadog/model_incident_field_attributes_single_value.go +++ /dev/null @@ -1,166 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// IncidentFieldAttributesSingleValue A field with a single value selected. -type IncidentFieldAttributesSingleValue struct { - // Type of the single value field definitions. - Type *IncidentFieldAttributesSingleValueType `json:"type,omitempty"` - // The single value selected for this field. - Value common.NullableString `json:"value,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{} -} - -// NewIncidentFieldAttributesSingleValue instantiates a new IncidentFieldAttributesSingleValue 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 NewIncidentFieldAttributesSingleValue() *IncidentFieldAttributesSingleValue { - this := IncidentFieldAttributesSingleValue{} - var typeVar IncidentFieldAttributesSingleValueType = INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN - this.Type = &typeVar - return &this -} - -// NewIncidentFieldAttributesSingleValueWithDefaults instantiates a new IncidentFieldAttributesSingleValue 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 NewIncidentFieldAttributesSingleValueWithDefaults() *IncidentFieldAttributesSingleValue { - this := IncidentFieldAttributesSingleValue{} - var typeVar IncidentFieldAttributesSingleValueType = INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN - this.Type = &typeVar - return &this -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *IncidentFieldAttributesSingleValue) GetType() IncidentFieldAttributesSingleValueType { - if o == nil || o.Type == nil { - var ret IncidentFieldAttributesSingleValueType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentFieldAttributesSingleValue) GetTypeOk() (*IncidentFieldAttributesSingleValueType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *IncidentFieldAttributesSingleValue) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given IncidentFieldAttributesSingleValueType and assigns it to the Type field. -func (o *IncidentFieldAttributesSingleValue) SetType(v IncidentFieldAttributesSingleValueType) { - o.Type = &v -} - -// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentFieldAttributesSingleValue) GetValue() string { - if o == nil || o.Value.Get() == nil { - var ret string - return ret - } - return *o.Value.Get() -} - -// GetValueOk returns a tuple with the Value 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 *IncidentFieldAttributesSingleValue) GetValueOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Value.Get(), o.Value.IsSet() -} - -// HasValue returns a boolean if a field has been set. -func (o *IncidentFieldAttributesSingleValue) HasValue() bool { - if o != nil && o.Value.IsSet() { - return true - } - - return false -} - -// SetValue gets a reference to the given common.NullableString and assigns it to the Value field. -func (o *IncidentFieldAttributesSingleValue) SetValue(v string) { - o.Value.Set(&v) -} - -// SetValueNil sets the value for Value to be an explicit nil. -func (o *IncidentFieldAttributesSingleValue) SetValueNil() { - o.Value.Set(nil) -} - -// UnsetValue ensures that no value is present for Value, not even an explicit nil. -func (o *IncidentFieldAttributesSingleValue) UnsetValue() { - o.Value.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentFieldAttributesSingleValue) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.Value.IsSet() { - toSerialize["value"] = o.Value.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentFieldAttributesSingleValue) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Type *IncidentFieldAttributesSingleValueType `json:"type,omitempty"` - Value common.NullableString `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Type = all.Type - o.Value = all.Value - return nil -} diff --git a/api/v2/datadog/model_incident_field_attributes_single_value_type.go b/api/v2/datadog/model_incident_field_attributes_single_value_type.go deleted file mode 100644 index d0b9aed4a60..00000000000 --- a/api/v2/datadog/model_incident_field_attributes_single_value_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentFieldAttributesSingleValueType Type of the single value field definitions. -type IncidentFieldAttributesSingleValueType string - -// List of IncidentFieldAttributesSingleValueType. -const ( - INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN IncidentFieldAttributesSingleValueType = "dropdown" - INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_TEXTBOX IncidentFieldAttributesSingleValueType = "textbox" -) - -var allowedIncidentFieldAttributesSingleValueTypeEnumValues = []IncidentFieldAttributesSingleValueType{ - INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN, - INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_TEXTBOX, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentFieldAttributesSingleValueType) GetAllowedValues() []IncidentFieldAttributesSingleValueType { - return allowedIncidentFieldAttributesSingleValueTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentFieldAttributesSingleValueType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentFieldAttributesSingleValueType(value) - return nil -} - -// NewIncidentFieldAttributesSingleValueTypeFromValue returns a pointer to a valid IncidentFieldAttributesSingleValueType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentFieldAttributesSingleValueTypeFromValue(v string) (*IncidentFieldAttributesSingleValueType, error) { - ev := IncidentFieldAttributesSingleValueType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentFieldAttributesSingleValueType: valid values are %v", v, allowedIncidentFieldAttributesSingleValueTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentFieldAttributesSingleValueType) IsValid() bool { - for _, existing := range allowedIncidentFieldAttributesSingleValueTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentFieldAttributesSingleValueType value. -func (v IncidentFieldAttributesSingleValueType) Ptr() *IncidentFieldAttributesSingleValueType { - return &v -} - -// NullableIncidentFieldAttributesSingleValueType handles when a null is used for IncidentFieldAttributesSingleValueType. -type NullableIncidentFieldAttributesSingleValueType struct { - value *IncidentFieldAttributesSingleValueType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentFieldAttributesSingleValueType) Get() *IncidentFieldAttributesSingleValueType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentFieldAttributesSingleValueType) Set(val *IncidentFieldAttributesSingleValueType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentFieldAttributesSingleValueType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentFieldAttributesSingleValueType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentFieldAttributesSingleValueType initializes the struct as if Set has been called. -func NewNullableIncidentFieldAttributesSingleValueType(val *IncidentFieldAttributesSingleValueType) *NullableIncidentFieldAttributesSingleValueType { - return &NullableIncidentFieldAttributesSingleValueType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentFieldAttributesSingleValueType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentFieldAttributesSingleValueType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_field_attributes_value_type.go b/api/v2/datadog/model_incident_field_attributes_value_type.go deleted file mode 100644 index ccc09b52ae4..00000000000 --- a/api/v2/datadog/model_incident_field_attributes_value_type.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentFieldAttributesValueType Type of the multiple value field definitions. -type IncidentFieldAttributesValueType string - -// List of IncidentFieldAttributesValueType. -const ( - INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT IncidentFieldAttributesValueType = "multiselect" - INCIDENTFIELDATTRIBUTESVALUETYPE_TEXTARRAY IncidentFieldAttributesValueType = "textarray" - INCIDENTFIELDATTRIBUTESVALUETYPE_METRICTAG IncidentFieldAttributesValueType = "metrictag" - INCIDENTFIELDATTRIBUTESVALUETYPE_AUTOCOMPLETE IncidentFieldAttributesValueType = "autocomplete" -) - -var allowedIncidentFieldAttributesValueTypeEnumValues = []IncidentFieldAttributesValueType{ - INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT, - INCIDENTFIELDATTRIBUTESVALUETYPE_TEXTARRAY, - INCIDENTFIELDATTRIBUTESVALUETYPE_METRICTAG, - INCIDENTFIELDATTRIBUTESVALUETYPE_AUTOCOMPLETE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentFieldAttributesValueType) GetAllowedValues() []IncidentFieldAttributesValueType { - return allowedIncidentFieldAttributesValueTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentFieldAttributesValueType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentFieldAttributesValueType(value) - return nil -} - -// NewIncidentFieldAttributesValueTypeFromValue returns a pointer to a valid IncidentFieldAttributesValueType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentFieldAttributesValueTypeFromValue(v string) (*IncidentFieldAttributesValueType, error) { - ev := IncidentFieldAttributesValueType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentFieldAttributesValueType: valid values are %v", v, allowedIncidentFieldAttributesValueTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentFieldAttributesValueType) IsValid() bool { - for _, existing := range allowedIncidentFieldAttributesValueTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentFieldAttributesValueType value. -func (v IncidentFieldAttributesValueType) Ptr() *IncidentFieldAttributesValueType { - return &v -} - -// NullableIncidentFieldAttributesValueType handles when a null is used for IncidentFieldAttributesValueType. -type NullableIncidentFieldAttributesValueType struct { - value *IncidentFieldAttributesValueType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentFieldAttributesValueType) Get() *IncidentFieldAttributesValueType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentFieldAttributesValueType) Set(val *IncidentFieldAttributesValueType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentFieldAttributesValueType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentFieldAttributesValueType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentFieldAttributesValueType initializes the struct as if Set has been called. -func NewNullableIncidentFieldAttributesValueType(val *IncidentFieldAttributesValueType) *NullableIncidentFieldAttributesValueType { - return &NullableIncidentFieldAttributesValueType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentFieldAttributesValueType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentFieldAttributesValueType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_integration_metadata_type.go b/api/v2/datadog/model_incident_integration_metadata_type.go deleted file mode 100644 index 49a06cd3fef..00000000000 --- a/api/v2/datadog/model_incident_integration_metadata_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentIntegrationMetadataType Integration metadata resource type. -type IncidentIntegrationMetadataType string - -// List of IncidentIntegrationMetadataType. -const ( - INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS IncidentIntegrationMetadataType = "incident_integrations" -) - -var allowedIncidentIntegrationMetadataTypeEnumValues = []IncidentIntegrationMetadataType{ - INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentIntegrationMetadataType) GetAllowedValues() []IncidentIntegrationMetadataType { - return allowedIncidentIntegrationMetadataTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentIntegrationMetadataType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentIntegrationMetadataType(value) - return nil -} - -// NewIncidentIntegrationMetadataTypeFromValue returns a pointer to a valid IncidentIntegrationMetadataType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentIntegrationMetadataTypeFromValue(v string) (*IncidentIntegrationMetadataType, error) { - ev := IncidentIntegrationMetadataType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentIntegrationMetadataType: valid values are %v", v, allowedIncidentIntegrationMetadataTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentIntegrationMetadataType) IsValid() bool { - for _, existing := range allowedIncidentIntegrationMetadataTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentIntegrationMetadataType value. -func (v IncidentIntegrationMetadataType) Ptr() *IncidentIntegrationMetadataType { - return &v -} - -// NullableIncidentIntegrationMetadataType handles when a null is used for IncidentIntegrationMetadataType. -type NullableIncidentIntegrationMetadataType struct { - value *IncidentIntegrationMetadataType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentIntegrationMetadataType) Get() *IncidentIntegrationMetadataType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentIntegrationMetadataType) Set(val *IncidentIntegrationMetadataType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentIntegrationMetadataType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentIntegrationMetadataType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentIntegrationMetadataType initializes the struct as if Set has been called. -func NewNullableIncidentIntegrationMetadataType(val *IncidentIntegrationMetadataType) *NullableIncidentIntegrationMetadataType { - return &NullableIncidentIntegrationMetadataType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentIntegrationMetadataType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentIntegrationMetadataType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_notification_handle.go b/api/v2/datadog/model_incident_notification_handle.go deleted file mode 100644 index a943b0a64b1..00000000000 --- a/api/v2/datadog/model_incident_notification_handle.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentNotificationHandle A notification handle that will be notified at incident creation. -type IncidentNotificationHandle struct { - // The name of the notified handle. - DisplayName *string `json:"display_name,omitempty"` - // The email address used for the notification. - Handle *string `json:"handle,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{} -} - -// NewIncidentNotificationHandle instantiates a new IncidentNotificationHandle 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 NewIncidentNotificationHandle() *IncidentNotificationHandle { - this := IncidentNotificationHandle{} - return &this -} - -// NewIncidentNotificationHandleWithDefaults instantiates a new IncidentNotificationHandle 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 NewIncidentNotificationHandleWithDefaults() *IncidentNotificationHandle { - this := IncidentNotificationHandle{} - return &this -} - -// GetDisplayName returns the DisplayName field value if set, zero value otherwise. -func (o *IncidentNotificationHandle) GetDisplayName() string { - if o == nil || o.DisplayName == nil { - var ret string - return ret - } - return *o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentNotificationHandle) GetDisplayNameOk() (*string, bool) { - if o == nil || o.DisplayName == nil { - return nil, false - } - return o.DisplayName, true -} - -// HasDisplayName returns a boolean if a field has been set. -func (o *IncidentNotificationHandle) HasDisplayName() bool { - if o != nil && o.DisplayName != nil { - return true - } - - return false -} - -// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. -func (o *IncidentNotificationHandle) SetDisplayName(v string) { - o.DisplayName = &v -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *IncidentNotificationHandle) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentNotificationHandle) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *IncidentNotificationHandle) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *IncidentNotificationHandle) SetHandle(v string) { - o.Handle = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentNotificationHandle) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DisplayName != nil { - toSerialize["display_name"] = o.DisplayName - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentNotificationHandle) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DisplayName *string `json:"display_name,omitempty"` - Handle *string `json:"handle,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DisplayName = all.DisplayName - o.Handle = all.Handle - return nil -} diff --git a/api/v2/datadog/model_incident_postmortem_type.go b/api/v2/datadog/model_incident_postmortem_type.go deleted file mode 100644 index 45cf229bced..00000000000 --- a/api/v2/datadog/model_incident_postmortem_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentPostmortemType Incident postmortem resource type. -type IncidentPostmortemType string - -// List of IncidentPostmortemType. -const ( - INCIDENTPOSTMORTEMTYPE_INCIDENT_POSTMORTEMS IncidentPostmortemType = "incident_postmortems" -) - -var allowedIncidentPostmortemTypeEnumValues = []IncidentPostmortemType{ - INCIDENTPOSTMORTEMTYPE_INCIDENT_POSTMORTEMS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentPostmortemType) GetAllowedValues() []IncidentPostmortemType { - return allowedIncidentPostmortemTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentPostmortemType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentPostmortemType(value) - return nil -} - -// NewIncidentPostmortemTypeFromValue returns a pointer to a valid IncidentPostmortemType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentPostmortemTypeFromValue(v string) (*IncidentPostmortemType, error) { - ev := IncidentPostmortemType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentPostmortemType: valid values are %v", v, allowedIncidentPostmortemTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentPostmortemType) IsValid() bool { - for _, existing := range allowedIncidentPostmortemTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentPostmortemType value. -func (v IncidentPostmortemType) Ptr() *IncidentPostmortemType { - return &v -} - -// NullableIncidentPostmortemType handles when a null is used for IncidentPostmortemType. -type NullableIncidentPostmortemType struct { - value *IncidentPostmortemType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentPostmortemType) Get() *IncidentPostmortemType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentPostmortemType) Set(val *IncidentPostmortemType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentPostmortemType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentPostmortemType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentPostmortemType initializes the struct as if Set has been called. -func NewNullableIncidentPostmortemType(val *IncidentPostmortemType) *NullableIncidentPostmortemType { - return &NullableIncidentPostmortemType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentPostmortemType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentPostmortemType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_related_object.go b/api/v2/datadog/model_incident_related_object.go deleted file mode 100644 index 485c3072de6..00000000000 --- a/api/v2/datadog/model_incident_related_object.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentRelatedObject Object related to an incident. -type IncidentRelatedObject string - -// List of IncidentRelatedObject. -const ( - INCIDENTRELATEDOBJECT_USERS IncidentRelatedObject = "users" -) - -var allowedIncidentRelatedObjectEnumValues = []IncidentRelatedObject{ - INCIDENTRELATEDOBJECT_USERS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentRelatedObject) GetAllowedValues() []IncidentRelatedObject { - return allowedIncidentRelatedObjectEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentRelatedObject) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentRelatedObject(value) - return nil -} - -// NewIncidentRelatedObjectFromValue returns a pointer to a valid IncidentRelatedObject -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentRelatedObjectFromValue(v string) (*IncidentRelatedObject, error) { - ev := IncidentRelatedObject(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentRelatedObject: valid values are %v", v, allowedIncidentRelatedObjectEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentRelatedObject) IsValid() bool { - for _, existing := range allowedIncidentRelatedObjectEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentRelatedObject value. -func (v IncidentRelatedObject) Ptr() *IncidentRelatedObject { - return &v -} - -// NullableIncidentRelatedObject handles when a null is used for IncidentRelatedObject. -type NullableIncidentRelatedObject struct { - value *IncidentRelatedObject - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentRelatedObject) Get() *IncidentRelatedObject { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentRelatedObject) Set(val *IncidentRelatedObject) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentRelatedObject) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentRelatedObject) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentRelatedObject initializes the struct as if Set has been called. -func NewNullableIncidentRelatedObject(val *IncidentRelatedObject) *NullableIncidentRelatedObject { - return &NullableIncidentRelatedObject{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentRelatedObject) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentRelatedObject) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_response.go b/api/v2/datadog/model_incident_response.go deleted file mode 100644 index 7ce94f64a5f..00000000000 --- a/api/v2/datadog/model_incident_response.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentResponse Response with an incident. -type IncidentResponse struct { - // Incident data from a response. - Data IncidentResponseData `json:"data"` - // Included related resources that the user requested. - Included []IncidentResponseIncludedItem `json:"included,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{} -} - -// NewIncidentResponse instantiates a new IncidentResponse 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 NewIncidentResponse(data IncidentResponseData) *IncidentResponse { - this := IncidentResponse{} - this.Data = data - return &this -} - -// NewIncidentResponseWithDefaults instantiates a new IncidentResponse 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 NewIncidentResponseWithDefaults() *IncidentResponse { - this := IncidentResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentResponse) GetData() IncidentResponseData { - if o == nil { - var ret IncidentResponseData - 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 *IncidentResponse) GetDataOk() (*IncidentResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentResponse) SetData(v IncidentResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentResponse) GetIncluded() []IncidentResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []IncidentResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponse) GetIncludedOk() (*[]IncidentResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []IncidentResponseIncludedItem and assigns it to the Included field. -func (o *IncidentResponse) SetIncluded(v []IncidentResponseIncludedItem) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentResponseData `json:"data"` - }{} - all := struct { - Data IncidentResponseData `json:"data"` - Included []IncidentResponseIncludedItem `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_incident_response_attributes.go b/api/v2/datadog/model_incident_response_attributes.go deleted file mode 100644 index 5f4641c1168..00000000000 --- a/api/v2/datadog/model_incident_response_attributes.go +++ /dev/null @@ -1,835 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// IncidentResponseAttributes The incident's attributes from a response. -type IncidentResponseAttributes struct { - // Timestamp when the incident was created. - Created *time.Time `json:"created,omitempty"` - // Length of the incident's customer impact in seconds. - // Equals the difference between `customer_impact_start` and `customer_impact_end`. - CustomerImpactDuration *int64 `json:"customer_impact_duration,omitempty"` - // Timestamp when customers were no longer impacted by the incident. - CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` - // A summary of the impact customers experienced during the incident. - CustomerImpactScope common.NullableString `json:"customer_impact_scope,omitempty"` - // Timestamp when customers began being impacted by the incident. - CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` - // A flag indicating whether the incident caused customer impact. - CustomerImpacted *bool `json:"customer_impacted,omitempty"` - // Timestamp when the incident was detected. - Detected common.NullableTime `json:"detected,omitempty"` - // A condensed view of the user-defined fields attached to incidents. - Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` - // Timestamp when the incident was last modified. - Modified *time.Time `json:"modified,omitempty"` - // Notification handles that will be notified of the incident during update. - NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` - // The UUID of the postmortem object attached to the incident. - PostmortemId *string `json:"postmortem_id,omitempty"` - // The monotonically increasing integer ID for the incident. - PublicId *int64 `json:"public_id,omitempty"` - // Timestamp when the incident's state was set to resolved. - Resolved common.NullableTime `json:"resolved,omitempty"` - // The amount of time in seconds to detect the incident. - // Equals the difference between `customer_impact_start` and `detected`. - TimeToDetect *int64 `json:"time_to_detect,omitempty"` - // The amount of time in seconds to call incident after detection. Equals the difference of `detected` and `created`. - TimeToInternalResponse *int64 `json:"time_to_internal_response,omitempty"` - // The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between `customer_impact_end` and `detected`. - TimeToRepair *int64 `json:"time_to_repair,omitempty"` - // The amount of time in seconds to resolve the incident after it was created. Equals the difference between `created` and `resolved`. - TimeToResolve *int64 `json:"time_to_resolve,omitempty"` - // The title of the incident, which summarizes what happened. - Title string `json:"title"` - // 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{} -} - -// NewIncidentResponseAttributes instantiates a new IncidentResponseAttributes 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 NewIncidentResponseAttributes(title string) *IncidentResponseAttributes { - this := IncidentResponseAttributes{} - this.Title = title - return &this -} - -// NewIncidentResponseAttributesWithDefaults instantiates a new IncidentResponseAttributes 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 NewIncidentResponseAttributesWithDefaults() *IncidentResponseAttributes { - this := IncidentResponseAttributes{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *IncidentResponseAttributes) SetCreated(v time.Time) { - o.Created = &v -} - -// GetCustomerImpactDuration returns the CustomerImpactDuration field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetCustomerImpactDuration() int64 { - if o == nil || o.CustomerImpactDuration == nil { - var ret int64 - return ret - } - return *o.CustomerImpactDuration -} - -// GetCustomerImpactDurationOk returns a tuple with the CustomerImpactDuration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetCustomerImpactDurationOk() (*int64, bool) { - if o == nil || o.CustomerImpactDuration == nil { - return nil, false - } - return o.CustomerImpactDuration, true -} - -// HasCustomerImpactDuration returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasCustomerImpactDuration() bool { - if o != nil && o.CustomerImpactDuration != nil { - return true - } - - return false -} - -// SetCustomerImpactDuration gets a reference to the given int64 and assigns it to the CustomerImpactDuration field. -func (o *IncidentResponseAttributes) SetCustomerImpactDuration(v int64) { - o.CustomerImpactDuration = &v -} - -// GetCustomerImpactEnd returns the CustomerImpactEnd field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentResponseAttributes) GetCustomerImpactEnd() time.Time { - if o == nil || o.CustomerImpactEnd.Get() == nil { - var ret time.Time - return ret - } - return *o.CustomerImpactEnd.Get() -} - -// GetCustomerImpactEndOk returns a tuple with the CustomerImpactEnd 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 *IncidentResponseAttributes) GetCustomerImpactEndOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.CustomerImpactEnd.Get(), o.CustomerImpactEnd.IsSet() -} - -// HasCustomerImpactEnd returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasCustomerImpactEnd() bool { - if o != nil && o.CustomerImpactEnd.IsSet() { - return true - } - - return false -} - -// SetCustomerImpactEnd gets a reference to the given common.NullableTime and assigns it to the CustomerImpactEnd field. -func (o *IncidentResponseAttributes) SetCustomerImpactEnd(v time.Time) { - o.CustomerImpactEnd.Set(&v) -} - -// SetCustomerImpactEndNil sets the value for CustomerImpactEnd to be an explicit nil. -func (o *IncidentResponseAttributes) SetCustomerImpactEndNil() { - o.CustomerImpactEnd.Set(nil) -} - -// UnsetCustomerImpactEnd ensures that no value is present for CustomerImpactEnd, not even an explicit nil. -func (o *IncidentResponseAttributes) UnsetCustomerImpactEnd() { - o.CustomerImpactEnd.Unset() -} - -// GetCustomerImpactScope returns the CustomerImpactScope field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentResponseAttributes) GetCustomerImpactScope() string { - if o == nil || o.CustomerImpactScope.Get() == nil { - var ret string - return ret - } - return *o.CustomerImpactScope.Get() -} - -// GetCustomerImpactScopeOk returns a tuple with the CustomerImpactScope 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 *IncidentResponseAttributes) GetCustomerImpactScopeOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.CustomerImpactScope.Get(), o.CustomerImpactScope.IsSet() -} - -// HasCustomerImpactScope returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasCustomerImpactScope() bool { - if o != nil && o.CustomerImpactScope.IsSet() { - return true - } - - return false -} - -// SetCustomerImpactScope gets a reference to the given common.NullableString and assigns it to the CustomerImpactScope field. -func (o *IncidentResponseAttributes) SetCustomerImpactScope(v string) { - o.CustomerImpactScope.Set(&v) -} - -// SetCustomerImpactScopeNil sets the value for CustomerImpactScope to be an explicit nil. -func (o *IncidentResponseAttributes) SetCustomerImpactScopeNil() { - o.CustomerImpactScope.Set(nil) -} - -// UnsetCustomerImpactScope ensures that no value is present for CustomerImpactScope, not even an explicit nil. -func (o *IncidentResponseAttributes) UnsetCustomerImpactScope() { - o.CustomerImpactScope.Unset() -} - -// GetCustomerImpactStart returns the CustomerImpactStart field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentResponseAttributes) GetCustomerImpactStart() time.Time { - if o == nil || o.CustomerImpactStart.Get() == nil { - var ret time.Time - return ret - } - return *o.CustomerImpactStart.Get() -} - -// GetCustomerImpactStartOk returns a tuple with the CustomerImpactStart 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 *IncidentResponseAttributes) GetCustomerImpactStartOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.CustomerImpactStart.Get(), o.CustomerImpactStart.IsSet() -} - -// HasCustomerImpactStart returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasCustomerImpactStart() bool { - if o != nil && o.CustomerImpactStart.IsSet() { - return true - } - - return false -} - -// SetCustomerImpactStart gets a reference to the given common.NullableTime and assigns it to the CustomerImpactStart field. -func (o *IncidentResponseAttributes) SetCustomerImpactStart(v time.Time) { - o.CustomerImpactStart.Set(&v) -} - -// SetCustomerImpactStartNil sets the value for CustomerImpactStart to be an explicit nil. -func (o *IncidentResponseAttributes) SetCustomerImpactStartNil() { - o.CustomerImpactStart.Set(nil) -} - -// UnsetCustomerImpactStart ensures that no value is present for CustomerImpactStart, not even an explicit nil. -func (o *IncidentResponseAttributes) UnsetCustomerImpactStart() { - o.CustomerImpactStart.Unset() -} - -// GetCustomerImpacted returns the CustomerImpacted field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetCustomerImpacted() bool { - if o == nil || o.CustomerImpacted == nil { - var ret bool - return ret - } - return *o.CustomerImpacted -} - -// GetCustomerImpactedOk returns a tuple with the CustomerImpacted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetCustomerImpactedOk() (*bool, bool) { - if o == nil || o.CustomerImpacted == nil { - return nil, false - } - return o.CustomerImpacted, true -} - -// HasCustomerImpacted returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasCustomerImpacted() bool { - if o != nil && o.CustomerImpacted != nil { - return true - } - - return false -} - -// SetCustomerImpacted gets a reference to the given bool and assigns it to the CustomerImpacted field. -func (o *IncidentResponseAttributes) SetCustomerImpacted(v bool) { - o.CustomerImpacted = &v -} - -// GetDetected returns the Detected field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentResponseAttributes) GetDetected() time.Time { - if o == nil || o.Detected.Get() == nil { - var ret time.Time - return ret - } - return *o.Detected.Get() -} - -// GetDetectedOk returns a tuple with the Detected 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 *IncidentResponseAttributes) GetDetectedOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.Detected.Get(), o.Detected.IsSet() -} - -// HasDetected returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasDetected() bool { - if o != nil && o.Detected.IsSet() { - return true - } - - return false -} - -// SetDetected gets a reference to the given common.NullableTime and assigns it to the Detected field. -func (o *IncidentResponseAttributes) SetDetected(v time.Time) { - o.Detected.Set(&v) -} - -// SetDetectedNil sets the value for Detected to be an explicit nil. -func (o *IncidentResponseAttributes) SetDetectedNil() { - o.Detected.Set(nil) -} - -// UnsetDetected ensures that no value is present for Detected, not even an explicit nil. -func (o *IncidentResponseAttributes) UnsetDetected() { - o.Detected.Unset() -} - -// GetFields returns the Fields field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetFields() map[string]IncidentFieldAttributes { - if o == nil || o.Fields == nil { - var ret map[string]IncidentFieldAttributes - return ret - } - return o.Fields -} - -// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetFieldsOk() (*map[string]IncidentFieldAttributes, bool) { - if o == nil || o.Fields == nil { - return nil, false - } - return &o.Fields, true -} - -// HasFields returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasFields() bool { - if o != nil && o.Fields != nil { - return true - } - - return false -} - -// SetFields gets a reference to the given map[string]IncidentFieldAttributes and assigns it to the Fields field. -func (o *IncidentResponseAttributes) SetFields(v map[string]IncidentFieldAttributes) { - o.Fields = v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *IncidentResponseAttributes) SetModified(v time.Time) { - o.Modified = &v -} - -// GetNotificationHandles returns the NotificationHandles field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentResponseAttributes) GetNotificationHandles() []IncidentNotificationHandle { - if o == nil { - var ret []IncidentNotificationHandle - return ret - } - return o.NotificationHandles -} - -// GetNotificationHandlesOk returns a tuple with the NotificationHandles 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 *IncidentResponseAttributes) GetNotificationHandlesOk() (*[]IncidentNotificationHandle, bool) { - if o == nil || o.NotificationHandles == nil { - return nil, false - } - return &o.NotificationHandles, true -} - -// HasNotificationHandles returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasNotificationHandles() bool { - if o != nil && o.NotificationHandles != nil { - return true - } - - return false -} - -// SetNotificationHandles gets a reference to the given []IncidentNotificationHandle and assigns it to the NotificationHandles field. -func (o *IncidentResponseAttributes) SetNotificationHandles(v []IncidentNotificationHandle) { - o.NotificationHandles = v -} - -// GetPostmortemId returns the PostmortemId field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetPostmortemId() string { - if o == nil || o.PostmortemId == nil { - var ret string - return ret - } - return *o.PostmortemId -} - -// GetPostmortemIdOk returns a tuple with the PostmortemId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetPostmortemIdOk() (*string, bool) { - if o == nil || o.PostmortemId == nil { - return nil, false - } - return o.PostmortemId, true -} - -// HasPostmortemId returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasPostmortemId() bool { - if o != nil && o.PostmortemId != nil { - return true - } - - return false -} - -// SetPostmortemId gets a reference to the given string and assigns it to the PostmortemId field. -func (o *IncidentResponseAttributes) SetPostmortemId(v string) { - o.PostmortemId = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetPublicId() int64 { - if o == nil || o.PublicId == nil { - var ret int64 - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetPublicIdOk() (*int64, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given int64 and assigns it to the PublicId field. -func (o *IncidentResponseAttributes) SetPublicId(v int64) { - o.PublicId = &v -} - -// GetResolved returns the Resolved field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentResponseAttributes) GetResolved() time.Time { - if o == nil || o.Resolved.Get() == nil { - var ret time.Time - return ret - } - return *o.Resolved.Get() -} - -// GetResolvedOk returns a tuple with the Resolved 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 *IncidentResponseAttributes) GetResolvedOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.Resolved.Get(), o.Resolved.IsSet() -} - -// HasResolved returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasResolved() bool { - if o != nil && o.Resolved.IsSet() { - return true - } - - return false -} - -// SetResolved gets a reference to the given common.NullableTime and assigns it to the Resolved field. -func (o *IncidentResponseAttributes) SetResolved(v time.Time) { - o.Resolved.Set(&v) -} - -// SetResolvedNil sets the value for Resolved to be an explicit nil. -func (o *IncidentResponseAttributes) SetResolvedNil() { - o.Resolved.Set(nil) -} - -// UnsetResolved ensures that no value is present for Resolved, not even an explicit nil. -func (o *IncidentResponseAttributes) UnsetResolved() { - o.Resolved.Unset() -} - -// GetTimeToDetect returns the TimeToDetect field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetTimeToDetect() int64 { - if o == nil || o.TimeToDetect == nil { - var ret int64 - return ret - } - return *o.TimeToDetect -} - -// GetTimeToDetectOk returns a tuple with the TimeToDetect field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetTimeToDetectOk() (*int64, bool) { - if o == nil || o.TimeToDetect == nil { - return nil, false - } - return o.TimeToDetect, true -} - -// HasTimeToDetect returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasTimeToDetect() bool { - if o != nil && o.TimeToDetect != nil { - return true - } - - return false -} - -// SetTimeToDetect gets a reference to the given int64 and assigns it to the TimeToDetect field. -func (o *IncidentResponseAttributes) SetTimeToDetect(v int64) { - o.TimeToDetect = &v -} - -// GetTimeToInternalResponse returns the TimeToInternalResponse field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetTimeToInternalResponse() int64 { - if o == nil || o.TimeToInternalResponse == nil { - var ret int64 - return ret - } - return *o.TimeToInternalResponse -} - -// GetTimeToInternalResponseOk returns a tuple with the TimeToInternalResponse field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetTimeToInternalResponseOk() (*int64, bool) { - if o == nil || o.TimeToInternalResponse == nil { - return nil, false - } - return o.TimeToInternalResponse, true -} - -// HasTimeToInternalResponse returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasTimeToInternalResponse() bool { - if o != nil && o.TimeToInternalResponse != nil { - return true - } - - return false -} - -// SetTimeToInternalResponse gets a reference to the given int64 and assigns it to the TimeToInternalResponse field. -func (o *IncidentResponseAttributes) SetTimeToInternalResponse(v int64) { - o.TimeToInternalResponse = &v -} - -// GetTimeToRepair returns the TimeToRepair field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetTimeToRepair() int64 { - if o == nil || o.TimeToRepair == nil { - var ret int64 - return ret - } - return *o.TimeToRepair -} - -// GetTimeToRepairOk returns a tuple with the TimeToRepair field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetTimeToRepairOk() (*int64, bool) { - if o == nil || o.TimeToRepair == nil { - return nil, false - } - return o.TimeToRepair, true -} - -// HasTimeToRepair returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasTimeToRepair() bool { - if o != nil && o.TimeToRepair != nil { - return true - } - - return false -} - -// SetTimeToRepair gets a reference to the given int64 and assigns it to the TimeToRepair field. -func (o *IncidentResponseAttributes) SetTimeToRepair(v int64) { - o.TimeToRepair = &v -} - -// GetTimeToResolve returns the TimeToResolve field value if set, zero value otherwise. -func (o *IncidentResponseAttributes) GetTimeToResolve() int64 { - if o == nil || o.TimeToResolve == nil { - var ret int64 - return ret - } - return *o.TimeToResolve -} - -// GetTimeToResolveOk returns a tuple with the TimeToResolve field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetTimeToResolveOk() (*int64, bool) { - if o == nil || o.TimeToResolve == nil { - return nil, false - } - return o.TimeToResolve, true -} - -// HasTimeToResolve returns a boolean if a field has been set. -func (o *IncidentResponseAttributes) HasTimeToResolve() bool { - if o != nil && o.TimeToResolve != nil { - return true - } - - return false -} - -// SetTimeToResolve gets a reference to the given int64 and assigns it to the TimeToResolve field. -func (o *IncidentResponseAttributes) SetTimeToResolve(v int64) { - o.TimeToResolve = &v -} - -// GetTitle returns the Title field value. -func (o *IncidentResponseAttributes) GetTitle() string { - if o == nil { - var ret string - return ret - } - return o.Title -} - -// GetTitleOk returns a tuple with the Title field value -// and a boolean to check if the value has been set. -func (o *IncidentResponseAttributes) GetTitleOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Title, true -} - -// SetTitle sets field value. -func (o *IncidentResponseAttributes) SetTitle(v string) { - o.Title = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.CustomerImpactDuration != nil { - toSerialize["customer_impact_duration"] = o.CustomerImpactDuration - } - if o.CustomerImpactEnd.IsSet() { - toSerialize["customer_impact_end"] = o.CustomerImpactEnd.Get() - } - if o.CustomerImpactScope.IsSet() { - toSerialize["customer_impact_scope"] = o.CustomerImpactScope.Get() - } - if o.CustomerImpactStart.IsSet() { - toSerialize["customer_impact_start"] = o.CustomerImpactStart.Get() - } - if o.CustomerImpacted != nil { - toSerialize["customer_impacted"] = o.CustomerImpacted - } - if o.Detected.IsSet() { - toSerialize["detected"] = o.Detected.Get() - } - if o.Fields != nil { - toSerialize["fields"] = o.Fields - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.NotificationHandles != nil { - toSerialize["notification_handles"] = o.NotificationHandles - } - if o.PostmortemId != nil { - toSerialize["postmortem_id"] = o.PostmortemId - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Resolved.IsSet() { - toSerialize["resolved"] = o.Resolved.Get() - } - if o.TimeToDetect != nil { - toSerialize["time_to_detect"] = o.TimeToDetect - } - if o.TimeToInternalResponse != nil { - toSerialize["time_to_internal_response"] = o.TimeToInternalResponse - } - if o.TimeToRepair != nil { - toSerialize["time_to_repair"] = o.TimeToRepair - } - if o.TimeToResolve != nil { - toSerialize["time_to_resolve"] = o.TimeToResolve - } - toSerialize["title"] = o.Title - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Title *string `json:"title"` - }{} - all := struct { - Created *time.Time `json:"created,omitempty"` - CustomerImpactDuration *int64 `json:"customer_impact_duration,omitempty"` - CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` - CustomerImpactScope common.NullableString `json:"customer_impact_scope,omitempty"` - CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` - CustomerImpacted *bool `json:"customer_impacted,omitempty"` - Detected common.NullableTime `json:"detected,omitempty"` - Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` - PostmortemId *string `json:"postmortem_id,omitempty"` - PublicId *int64 `json:"public_id,omitempty"` - Resolved common.NullableTime `json:"resolved,omitempty"` - TimeToDetect *int64 `json:"time_to_detect,omitempty"` - TimeToInternalResponse *int64 `json:"time_to_internal_response,omitempty"` - TimeToRepair *int64 `json:"time_to_repair,omitempty"` - TimeToResolve *int64 `json:"time_to_resolve,omitempty"` - Title string `json:"title"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Title == nil { - return fmt.Errorf("Required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Created = all.Created - o.CustomerImpactDuration = all.CustomerImpactDuration - o.CustomerImpactEnd = all.CustomerImpactEnd - o.CustomerImpactScope = all.CustomerImpactScope - o.CustomerImpactStart = all.CustomerImpactStart - o.CustomerImpacted = all.CustomerImpacted - o.Detected = all.Detected - o.Fields = all.Fields - o.Modified = all.Modified - o.NotificationHandles = all.NotificationHandles - o.PostmortemId = all.PostmortemId - o.PublicId = all.PublicId - o.Resolved = all.Resolved - o.TimeToDetect = all.TimeToDetect - o.TimeToInternalResponse = all.TimeToInternalResponse - o.TimeToRepair = all.TimeToRepair - o.TimeToResolve = all.TimeToResolve - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_incident_response_data.go b/api/v2/datadog/model_incident_response_data.go deleted file mode 100644 index bb75a52531c..00000000000 --- a/api/v2/datadog/model_incident_response_data.go +++ /dev/null @@ -1,238 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentResponseData Incident data from a response. -type IncidentResponseData struct { - // The incident's attributes from a response. - Attributes *IncidentResponseAttributes `json:"attributes,omitempty"` - // The incident's ID. - Id string `json:"id"` - // The incident's relationships from a response. - Relationships *IncidentResponseRelationships `json:"relationships,omitempty"` - // Incident resource type. - Type IncidentType `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{} -} - -// NewIncidentResponseData instantiates a new IncidentResponseData 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 NewIncidentResponseData(id string, typeVar IncidentType) *IncidentResponseData { - this := IncidentResponseData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewIncidentResponseDataWithDefaults instantiates a new IncidentResponseData 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 NewIncidentResponseDataWithDefaults() *IncidentResponseData { - this := IncidentResponseData{} - var typeVar IncidentType = INCIDENTTYPE_INCIDENTS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentResponseData) GetAttributes() IncidentResponseAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentResponseAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseData) GetAttributesOk() (*IncidentResponseAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentResponseAttributes and assigns it to the Attributes field. -func (o *IncidentResponseData) SetAttributes(v IncidentResponseAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *IncidentResponseData) 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 *IncidentResponseData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *IncidentResponseData) SetId(v string) { - o.Id = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentResponseData) GetRelationships() IncidentResponseRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentResponseRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseData) GetRelationshipsOk() (*IncidentResponseRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentResponseData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentResponseRelationships and assigns it to the Relationships field. -func (o *IncidentResponseData) SetRelationships(v IncidentResponseRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentResponseData) GetType() IncidentType { - if o == nil { - var ret IncidentType - 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 *IncidentResponseData) GetTypeOk() (*IncidentType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentResponseData) SetType(v IncidentType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentType `json:"type"` - }{} - all := struct { - Attributes *IncidentResponseAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Relationships *IncidentResponseRelationships `json:"relationships,omitempty"` - Type IncidentType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_response_included_item.go b/api/v2/datadog/model_incident_response_included_item.go deleted file mode 100644 index 269f454bd07..00000000000 --- a/api/v2/datadog/model_incident_response_included_item.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentResponseIncludedItem - An object related to an incident that is included in the response. -type IncidentResponseIncludedItem struct { - User *User - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// UserAsIncidentResponseIncludedItem is a convenience function that returns User wrapped in IncidentResponseIncludedItem. -func UserAsIncidentResponseIncludedItem(v *User) IncidentResponseIncludedItem { - return IncidentResponseIncludedItem{User: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *IncidentResponseIncludedItem) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into User - err = json.Unmarshal(data, &obj.User) - if err == nil { - if obj.User != nil && obj.User.UnparsedObject == nil { - jsonUser, _ := json.Marshal(obj.User) - if string(jsonUser) == "{}" { // empty struct - obj.User = nil - } else { - match++ - } - } else { - obj.User = nil - } - } else { - obj.User = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.User = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj IncidentResponseIncludedItem) MarshalJSON() ([]byte, error) { - if obj.User != nil { - return json.Marshal(&obj.User) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *IncidentResponseIncludedItem) GetActualInstance() interface{} { - if obj.User != nil { - return obj.User - } - - // all schemas are nil - return nil -} - -// NullableIncidentResponseIncludedItem handles when a null is used for IncidentResponseIncludedItem. -type NullableIncidentResponseIncludedItem struct { - value *IncidentResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentResponseIncludedItem) Get() *IncidentResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentResponseIncludedItem) Set(val *IncidentResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableIncidentResponseIncludedItem(val *IncidentResponseIncludedItem) *NullableIncidentResponseIncludedItem { - return &NullableIncidentResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentResponseIncludedItem) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_response_meta.go b/api/v2/datadog/model_incident_response_meta.go deleted file mode 100644 index bd394d1060e..00000000000 --- a/api/v2/datadog/model_incident_response_meta.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentResponseMeta The metadata object containing pagination metadata. -type IncidentResponseMeta struct { - // Pagination properties. - Pagination *IncidentResponseMetaPagination `json:"pagination,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{} -} - -// NewIncidentResponseMeta instantiates a new IncidentResponseMeta 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 NewIncidentResponseMeta() *IncidentResponseMeta { - this := IncidentResponseMeta{} - return &this -} - -// NewIncidentResponseMetaWithDefaults instantiates a new IncidentResponseMeta 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 NewIncidentResponseMetaWithDefaults() *IncidentResponseMeta { - this := IncidentResponseMeta{} - return &this -} - -// GetPagination returns the Pagination field value if set, zero value otherwise. -func (o *IncidentResponseMeta) GetPagination() IncidentResponseMetaPagination { - if o == nil || o.Pagination == nil { - var ret IncidentResponseMetaPagination - return ret - } - return *o.Pagination -} - -// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseMeta) GetPaginationOk() (*IncidentResponseMetaPagination, bool) { - if o == nil || o.Pagination == nil { - return nil, false - } - return o.Pagination, true -} - -// HasPagination returns a boolean if a field has been set. -func (o *IncidentResponseMeta) HasPagination() bool { - if o != nil && o.Pagination != nil { - return true - } - - return false -} - -// SetPagination gets a reference to the given IncidentResponseMetaPagination and assigns it to the Pagination field. -func (o *IncidentResponseMeta) SetPagination(v IncidentResponseMetaPagination) { - o.Pagination = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentResponseMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Pagination != nil { - toSerialize["pagination"] = o.Pagination - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Pagination *IncidentResponseMetaPagination `json:"pagination,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Pagination = all.Pagination - return nil -} diff --git a/api/v2/datadog/model_incident_response_meta_pagination.go b/api/v2/datadog/model_incident_response_meta_pagination.go deleted file mode 100644 index 065cd99d92a..00000000000 --- a/api/v2/datadog/model_incident_response_meta_pagination.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentResponseMetaPagination Pagination properties. -type IncidentResponseMetaPagination struct { - // The index of the first element in the next page of results. Equal to page size added to the current offset. - NextOffset *int64 `json:"next_offset,omitempty"` - // The index of the first element in the results. - Offset *int64 `json:"offset,omitempty"` - // Maximum size of pages to return. - Size *int64 `json:"size,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{} -} - -// NewIncidentResponseMetaPagination instantiates a new IncidentResponseMetaPagination 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 NewIncidentResponseMetaPagination() *IncidentResponseMetaPagination { - this := IncidentResponseMetaPagination{} - return &this -} - -// NewIncidentResponseMetaPaginationWithDefaults instantiates a new IncidentResponseMetaPagination 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 NewIncidentResponseMetaPaginationWithDefaults() *IncidentResponseMetaPagination { - this := IncidentResponseMetaPagination{} - return &this -} - -// GetNextOffset returns the NextOffset field value if set, zero value otherwise. -func (o *IncidentResponseMetaPagination) GetNextOffset() int64 { - if o == nil || o.NextOffset == nil { - var ret int64 - return ret - } - return *o.NextOffset -} - -// GetNextOffsetOk returns a tuple with the NextOffset field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseMetaPagination) GetNextOffsetOk() (*int64, bool) { - if o == nil || o.NextOffset == nil { - return nil, false - } - return o.NextOffset, true -} - -// HasNextOffset returns a boolean if a field has been set. -func (o *IncidentResponseMetaPagination) HasNextOffset() bool { - if o != nil && o.NextOffset != nil { - return true - } - - return false -} - -// SetNextOffset gets a reference to the given int64 and assigns it to the NextOffset field. -func (o *IncidentResponseMetaPagination) SetNextOffset(v int64) { - o.NextOffset = &v -} - -// GetOffset returns the Offset field value if set, zero value otherwise. -func (o *IncidentResponseMetaPagination) GetOffset() int64 { - if o == nil || o.Offset == nil { - var ret int64 - return ret - } - return *o.Offset -} - -// GetOffsetOk returns a tuple with the Offset field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseMetaPagination) GetOffsetOk() (*int64, bool) { - if o == nil || o.Offset == nil { - return nil, false - } - return o.Offset, true -} - -// HasOffset returns a boolean if a field has been set. -func (o *IncidentResponseMetaPagination) HasOffset() bool { - if o != nil && o.Offset != nil { - return true - } - - return false -} - -// SetOffset gets a reference to the given int64 and assigns it to the Offset field. -func (o *IncidentResponseMetaPagination) SetOffset(v int64) { - o.Offset = &v -} - -// GetSize returns the Size field value if set, zero value otherwise. -func (o *IncidentResponseMetaPagination) GetSize() int64 { - if o == nil || o.Size == nil { - var ret int64 - return ret - } - return *o.Size -} - -// GetSizeOk returns a tuple with the Size field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseMetaPagination) GetSizeOk() (*int64, bool) { - if o == nil || o.Size == nil { - return nil, false - } - return o.Size, true -} - -// HasSize returns a boolean if a field has been set. -func (o *IncidentResponseMetaPagination) HasSize() bool { - if o != nil && o.Size != nil { - return true - } - - return false -} - -// SetSize gets a reference to the given int64 and assigns it to the Size field. -func (o *IncidentResponseMetaPagination) SetSize(v int64) { - o.Size = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentResponseMetaPagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.NextOffset != nil { - toSerialize["next_offset"] = o.NextOffset - } - if o.Offset != nil { - toSerialize["offset"] = o.Offset - } - if o.Size != nil { - toSerialize["size"] = o.Size - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentResponseMetaPagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - NextOffset *int64 `json:"next_offset,omitempty"` - Offset *int64 `json:"offset,omitempty"` - Size *int64 `json:"size,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.NextOffset = all.NextOffset - o.Offset = all.Offset - o.Size = all.Size - return nil -} diff --git a/api/v2/datadog/model_incident_response_relationships.go b/api/v2/datadog/model_incident_response_relationships.go deleted file mode 100644 index 67274f7ad0e..00000000000 --- a/api/v2/datadog/model_incident_response_relationships.go +++ /dev/null @@ -1,293 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentResponseRelationships The incident's relationships from a response. -type IncidentResponseRelationships struct { - // Relationship to user. - CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` - // Relationship to user. - CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` - // A relationship reference for multiple integration metadata objects. - Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` - // Relationship to user. - LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` - // A relationship reference for postmortems. - Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,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{} -} - -// NewIncidentResponseRelationships instantiates a new IncidentResponseRelationships 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 NewIncidentResponseRelationships() *IncidentResponseRelationships { - this := IncidentResponseRelationships{} - return &this -} - -// NewIncidentResponseRelationshipsWithDefaults instantiates a new IncidentResponseRelationships 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 NewIncidentResponseRelationshipsWithDefaults() *IncidentResponseRelationships { - this := IncidentResponseRelationships{} - return &this -} - -// GetCommanderUser returns the CommanderUser field value if set, zero value otherwise. -func (o *IncidentResponseRelationships) GetCommanderUser() NullableRelationshipToUser { - if o == nil || o.CommanderUser == nil { - var ret NullableRelationshipToUser - return ret - } - return *o.CommanderUser -} - -// GetCommanderUserOk returns a tuple with the CommanderUser field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseRelationships) GetCommanderUserOk() (*NullableRelationshipToUser, bool) { - if o == nil || o.CommanderUser == nil { - return nil, false - } - return o.CommanderUser, true -} - -// HasCommanderUser returns a boolean if a field has been set. -func (o *IncidentResponseRelationships) HasCommanderUser() bool { - if o != nil && o.CommanderUser != nil { - return true - } - - return false -} - -// SetCommanderUser gets a reference to the given NullableRelationshipToUser and assigns it to the CommanderUser field. -func (o *IncidentResponseRelationships) SetCommanderUser(v NullableRelationshipToUser) { - o.CommanderUser = &v -} - -// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. -func (o *IncidentResponseRelationships) GetCreatedByUser() RelationshipToUser { - if o == nil || o.CreatedByUser == nil { - var ret RelationshipToUser - return ret - } - return *o.CreatedByUser -} - -// GetCreatedByUserOk returns a tuple with the CreatedByUser field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseRelationships) GetCreatedByUserOk() (*RelationshipToUser, bool) { - if o == nil || o.CreatedByUser == nil { - return nil, false - } - return o.CreatedByUser, true -} - -// HasCreatedByUser returns a boolean if a field has been set. -func (o *IncidentResponseRelationships) HasCreatedByUser() bool { - if o != nil && o.CreatedByUser != nil { - return true - } - - return false -} - -// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. -func (o *IncidentResponseRelationships) SetCreatedByUser(v RelationshipToUser) { - o.CreatedByUser = &v -} - -// GetIntegrations returns the Integrations field value if set, zero value otherwise. -func (o *IncidentResponseRelationships) GetIntegrations() RelationshipToIncidentIntegrationMetadatas { - if o == nil || o.Integrations == nil { - var ret RelationshipToIncidentIntegrationMetadatas - return ret - } - return *o.Integrations -} - -// GetIntegrationsOk returns a tuple with the Integrations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseRelationships) GetIntegrationsOk() (*RelationshipToIncidentIntegrationMetadatas, bool) { - if o == nil || o.Integrations == nil { - return nil, false - } - return o.Integrations, true -} - -// HasIntegrations returns a boolean if a field has been set. -func (o *IncidentResponseRelationships) HasIntegrations() bool { - if o != nil && o.Integrations != nil { - return true - } - - return false -} - -// SetIntegrations gets a reference to the given RelationshipToIncidentIntegrationMetadatas and assigns it to the Integrations field. -func (o *IncidentResponseRelationships) SetIntegrations(v RelationshipToIncidentIntegrationMetadatas) { - o.Integrations = &v -} - -// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. -func (o *IncidentResponseRelationships) GetLastModifiedByUser() RelationshipToUser { - if o == nil || o.LastModifiedByUser == nil { - var ret RelationshipToUser - return ret - } - return *o.LastModifiedByUser -} - -// GetLastModifiedByUserOk returns a tuple with the LastModifiedByUser field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseRelationships) GetLastModifiedByUserOk() (*RelationshipToUser, bool) { - if o == nil || o.LastModifiedByUser == nil { - return nil, false - } - return o.LastModifiedByUser, true -} - -// HasLastModifiedByUser returns a boolean if a field has been set. -func (o *IncidentResponseRelationships) HasLastModifiedByUser() bool { - if o != nil && o.LastModifiedByUser != nil { - return true - } - - return false -} - -// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. -func (o *IncidentResponseRelationships) SetLastModifiedByUser(v RelationshipToUser) { - o.LastModifiedByUser = &v -} - -// GetPostmortem returns the Postmortem field value if set, zero value otherwise. -func (o *IncidentResponseRelationships) GetPostmortem() RelationshipToIncidentPostmortem { - if o == nil || o.Postmortem == nil { - var ret RelationshipToIncidentPostmortem - return ret - } - return *o.Postmortem -} - -// GetPostmortemOk returns a tuple with the Postmortem field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentResponseRelationships) GetPostmortemOk() (*RelationshipToIncidentPostmortem, bool) { - if o == nil || o.Postmortem == nil { - return nil, false - } - return o.Postmortem, true -} - -// HasPostmortem returns a boolean if a field has been set. -func (o *IncidentResponseRelationships) HasPostmortem() bool { - if o != nil && o.Postmortem != nil { - return true - } - - return false -} - -// SetPostmortem gets a reference to the given RelationshipToIncidentPostmortem and assigns it to the Postmortem field. -func (o *IncidentResponseRelationships) SetPostmortem(v RelationshipToIncidentPostmortem) { - o.Postmortem = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentResponseRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CommanderUser != nil { - toSerialize["commander_user"] = o.CommanderUser - } - if o.CreatedByUser != nil { - toSerialize["created_by_user"] = o.CreatedByUser - } - if o.Integrations != nil { - toSerialize["integrations"] = o.Integrations - } - if o.LastModifiedByUser != nil { - toSerialize["last_modified_by_user"] = o.LastModifiedByUser - } - if o.Postmortem != nil { - toSerialize["postmortem"] = o.Postmortem - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` - CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` - Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` - LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` - Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.CommanderUser != nil && all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CommanderUser = all.CommanderUser - if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CreatedByUser = all.CreatedByUser - if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Integrations = all.Integrations - if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LastModifiedByUser = all.LastModifiedByUser - if all.Postmortem != nil && all.Postmortem.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Postmortem = all.Postmortem - return nil -} diff --git a/api/v2/datadog/model_incident_service_create_attributes.go b/api/v2/datadog/model_incident_service_create_attributes.go deleted file mode 100644 index fd0b23f748e..00000000000 --- a/api/v2/datadog/model_incident_service_create_attributes.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceCreateAttributes The incident service's attributes for a create request. -type IncidentServiceCreateAttributes struct { - // Name of the incident service. - Name string `json:"name"` - // 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{} -} - -// NewIncidentServiceCreateAttributes instantiates a new IncidentServiceCreateAttributes 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 NewIncidentServiceCreateAttributes(name string) *IncidentServiceCreateAttributes { - this := IncidentServiceCreateAttributes{} - this.Name = name - return &this -} - -// NewIncidentServiceCreateAttributesWithDefaults instantiates a new IncidentServiceCreateAttributes 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 NewIncidentServiceCreateAttributesWithDefaults() *IncidentServiceCreateAttributes { - this := IncidentServiceCreateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *IncidentServiceCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *IncidentServiceCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *IncidentServiceCreateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_incident_service_create_data.go b/api/v2/datadog/model_incident_service_create_data.go deleted file mode 100644 index 54b9d33ca45..00000000000 --- a/api/v2/datadog/model_incident_service_create_data.go +++ /dev/null @@ -1,205 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceCreateData Incident Service payload for create requests. -type IncidentServiceCreateData struct { - // The incident service's attributes for a create request. - Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` - // The incident service's relationships. - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - // Incident service resource type. - Type IncidentServiceType `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{} -} - -// NewIncidentServiceCreateData instantiates a new IncidentServiceCreateData 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 NewIncidentServiceCreateData(typeVar IncidentServiceType) *IncidentServiceCreateData { - this := IncidentServiceCreateData{} - this.Type = typeVar - return &this -} - -// NewIncidentServiceCreateDataWithDefaults instantiates a new IncidentServiceCreateData 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 NewIncidentServiceCreateDataWithDefaults() *IncidentServiceCreateData { - this := IncidentServiceCreateData{} - var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentServiceCreateData) GetAttributes() IncidentServiceCreateAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentServiceCreateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceCreateData) GetAttributesOk() (*IncidentServiceCreateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentServiceCreateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentServiceCreateAttributes and assigns it to the Attributes field. -func (o *IncidentServiceCreateData) SetAttributes(v IncidentServiceCreateAttributes) { - o.Attributes = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentServiceCreateData) GetRelationships() IncidentServiceRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentServiceRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceCreateData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentServiceCreateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. -func (o *IncidentServiceCreateData) SetRelationships(v IncidentServiceRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentServiceCreateData) GetType() IncidentServiceType { - if o == nil { - var ret IncidentServiceType - 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 *IncidentServiceCreateData) GetTypeOk() (*IncidentServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentServiceCreateData) SetType(v IncidentServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *IncidentServiceType `json:"type"` - }{} - all := struct { - Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type IncidentServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_service_create_request.go b/api/v2/datadog/model_incident_service_create_request.go deleted file mode 100644 index 210c35064d7..00000000000 --- a/api/v2/datadog/model_incident_service_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceCreateRequest Create request with an incident service payload. -type IncidentServiceCreateRequest struct { - // Incident Service payload for create requests. - Data IncidentServiceCreateData `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{} -} - -// NewIncidentServiceCreateRequest instantiates a new IncidentServiceCreateRequest 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 NewIncidentServiceCreateRequest(data IncidentServiceCreateData) *IncidentServiceCreateRequest { - this := IncidentServiceCreateRequest{} - this.Data = data - return &this -} - -// NewIncidentServiceCreateRequestWithDefaults instantiates a new IncidentServiceCreateRequest 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 NewIncidentServiceCreateRequestWithDefaults() *IncidentServiceCreateRequest { - this := IncidentServiceCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServiceCreateRequest) GetData() IncidentServiceCreateData { - if o == nil { - var ret IncidentServiceCreateData - 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 *IncidentServiceCreateRequest) GetDataOk() (*IncidentServiceCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServiceCreateRequest) SetData(v IncidentServiceCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentServiceCreateData `json:"data"` - }{} - all := struct { - Data IncidentServiceCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_incident_service_included_items.go b/api/v2/datadog/model_incident_service_included_items.go deleted file mode 100644 index 06bd44c5d8a..00000000000 --- a/api/v2/datadog/model_incident_service_included_items.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentServiceIncludedItems - An object related to an incident service which is present in the included payload. -type IncidentServiceIncludedItems struct { - User *User - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// UserAsIncidentServiceIncludedItems is a convenience function that returns User wrapped in IncidentServiceIncludedItems. -func UserAsIncidentServiceIncludedItems(v *User) IncidentServiceIncludedItems { - return IncidentServiceIncludedItems{User: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *IncidentServiceIncludedItems) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into User - err = json.Unmarshal(data, &obj.User) - if err == nil { - if obj.User != nil && obj.User.UnparsedObject == nil { - jsonUser, _ := json.Marshal(obj.User) - if string(jsonUser) == "{}" { // empty struct - obj.User = nil - } else { - match++ - } - } else { - obj.User = nil - } - } else { - obj.User = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.User = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj IncidentServiceIncludedItems) MarshalJSON() ([]byte, error) { - if obj.User != nil { - return json.Marshal(&obj.User) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *IncidentServiceIncludedItems) GetActualInstance() interface{} { - if obj.User != nil { - return obj.User - } - - // all schemas are nil - return nil -} - -// NullableIncidentServiceIncludedItems handles when a null is used for IncidentServiceIncludedItems. -type NullableIncidentServiceIncludedItems struct { - value *IncidentServiceIncludedItems - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentServiceIncludedItems) Get() *IncidentServiceIncludedItems { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentServiceIncludedItems) Set(val *IncidentServiceIncludedItems) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentServiceIncludedItems) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentServiceIncludedItems) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentServiceIncludedItems initializes the struct as if Set has been called. -func NewNullableIncidentServiceIncludedItems(val *IncidentServiceIncludedItems) *NullableIncidentServiceIncludedItems { - return &NullableIncidentServiceIncludedItems{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentServiceIncludedItems) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentServiceIncludedItems) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_service_relationships.go b/api/v2/datadog/model_incident_service_relationships.go deleted file mode 100644 index 09e7e3c2bc9..00000000000 --- a/api/v2/datadog/model_incident_service_relationships.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentServiceRelationships The incident service's relationships. -type IncidentServiceRelationships struct { - // Relationship to user. - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - // Relationship to user. - LastModifiedBy *RelationshipToUser `json:"last_modified_by,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{} -} - -// NewIncidentServiceRelationships instantiates a new IncidentServiceRelationships 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 NewIncidentServiceRelationships() *IncidentServiceRelationships { - this := IncidentServiceRelationships{} - return &this -} - -// NewIncidentServiceRelationshipsWithDefaults instantiates a new IncidentServiceRelationships 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 NewIncidentServiceRelationshipsWithDefaults() *IncidentServiceRelationships { - this := IncidentServiceRelationships{} - return &this -} - -// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. -func (o *IncidentServiceRelationships) GetCreatedBy() RelationshipToUser { - if o == nil || o.CreatedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.CreatedBy -} - -// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { - if o == nil || o.CreatedBy == nil { - return nil, false - } - return o.CreatedBy, true -} - -// HasCreatedBy returns a boolean if a field has been set. -func (o *IncidentServiceRelationships) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { - return true - } - - return false -} - -// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. -func (o *IncidentServiceRelationships) SetCreatedBy(v RelationshipToUser) { - o.CreatedBy = &v -} - -// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. -func (o *IncidentServiceRelationships) GetLastModifiedBy() RelationshipToUser { - if o == nil || o.LastModifiedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.LastModifiedBy -} - -// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceRelationships) GetLastModifiedByOk() (*RelationshipToUser, bool) { - if o == nil || o.LastModifiedBy == nil { - return nil, false - } - return o.LastModifiedBy, true -} - -// HasLastModifiedBy returns a boolean if a field has been set. -func (o *IncidentServiceRelationships) HasLastModifiedBy() bool { - if o != nil && o.LastModifiedBy != nil { - return true - } - - return false -} - -// SetLastModifiedBy gets a reference to the given RelationshipToUser and assigns it to the LastModifiedBy field. -func (o *IncidentServiceRelationships) SetLastModifiedBy(v RelationshipToUser) { - o.LastModifiedBy = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedBy != nil { - toSerialize["created_by"] = o.CreatedBy - } - if o.LastModifiedBy != nil { - toSerialize["last_modified_by"] = o.LastModifiedBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CreatedBy = all.CreatedBy - if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LastModifiedBy = all.LastModifiedBy - return nil -} diff --git a/api/v2/datadog/model_incident_service_response.go b/api/v2/datadog/model_incident_service_response.go deleted file mode 100644 index af6ea8b5780..00000000000 --- a/api/v2/datadog/model_incident_service_response.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceResponse Response with an incident service payload. -type IncidentServiceResponse struct { - // Incident Service data from responses. - Data IncidentServiceResponseData `json:"data"` - // Included objects from relationships. - Included []IncidentServiceIncludedItems `json:"included,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{} -} - -// NewIncidentServiceResponse instantiates a new IncidentServiceResponse 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 NewIncidentServiceResponse(data IncidentServiceResponseData) *IncidentServiceResponse { - this := IncidentServiceResponse{} - this.Data = data - return &this -} - -// NewIncidentServiceResponseWithDefaults instantiates a new IncidentServiceResponse 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 NewIncidentServiceResponseWithDefaults() *IncidentServiceResponse { - this := IncidentServiceResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServiceResponse) GetData() IncidentServiceResponseData { - if o == nil { - var ret IncidentServiceResponseData - 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 *IncidentServiceResponse) GetDataOk() (*IncidentServiceResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServiceResponse) SetData(v IncidentServiceResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentServiceResponse) GetIncluded() []IncidentServiceIncludedItems { - if o == nil || o.Included == nil { - var ret []IncidentServiceIncludedItems - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponse) GetIncludedOk() (*[]IncidentServiceIncludedItems, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentServiceResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []IncidentServiceIncludedItems and assigns it to the Included field. -func (o *IncidentServiceResponse) SetIncluded(v []IncidentServiceIncludedItems) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentServiceResponseData `json:"data"` - }{} - all := struct { - Data IncidentServiceResponseData `json:"data"` - Included []IncidentServiceIncludedItems `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_incident_service_response_attributes.go b/api/v2/datadog/model_incident_service_response_attributes.go deleted file mode 100644 index f5a0a0ece44..00000000000 --- a/api/v2/datadog/model_incident_service_response_attributes.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// IncidentServiceResponseAttributes The incident service's attributes from a response. -type IncidentServiceResponseAttributes struct { - // Timestamp of when the incident service was created. - Created *time.Time `json:"created,omitempty"` - // Timestamp of when the incident service was modified. - Modified *time.Time `json:"modified,omitempty"` - // Name of the incident service. - Name *string `json:"name,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{} -} - -// NewIncidentServiceResponseAttributes instantiates a new IncidentServiceResponseAttributes 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 NewIncidentServiceResponseAttributes() *IncidentServiceResponseAttributes { - this := IncidentServiceResponseAttributes{} - return &this -} - -// NewIncidentServiceResponseAttributesWithDefaults instantiates a new IncidentServiceResponseAttributes 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 NewIncidentServiceResponseAttributesWithDefaults() *IncidentServiceResponseAttributes { - this := IncidentServiceResponseAttributes{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *IncidentServiceResponseAttributes) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseAttributes) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *IncidentServiceResponseAttributes) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *IncidentServiceResponseAttributes) SetCreated(v time.Time) { - o.Created = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *IncidentServiceResponseAttributes) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseAttributes) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *IncidentServiceResponseAttributes) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *IncidentServiceResponseAttributes) SetModified(v time.Time) { - o.Modified = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *IncidentServiceResponseAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *IncidentServiceResponseAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *IncidentServiceResponseAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Created *time.Time `json:"created,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Created = all.Created - o.Modified = all.Modified - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_incident_service_response_data.go b/api/v2/datadog/model_incident_service_response_data.go deleted file mode 100644 index 24ba11ef559..00000000000 --- a/api/v2/datadog/model_incident_service_response_data.go +++ /dev/null @@ -1,238 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceResponseData Incident Service data from responses. -type IncidentServiceResponseData struct { - // The incident service's attributes from a response. - Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` - // The incident service's ID. - Id string `json:"id"` - // The incident service's relationships. - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - // Incident service resource type. - Type IncidentServiceType `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{} -} - -// NewIncidentServiceResponseData instantiates a new IncidentServiceResponseData 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 NewIncidentServiceResponseData(id string, typeVar IncidentServiceType) *IncidentServiceResponseData { - this := IncidentServiceResponseData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewIncidentServiceResponseDataWithDefaults instantiates a new IncidentServiceResponseData 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 NewIncidentServiceResponseDataWithDefaults() *IncidentServiceResponseData { - this := IncidentServiceResponseData{} - var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentServiceResponseData) GetAttributes() IncidentServiceResponseAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentServiceResponseAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseData) GetAttributesOk() (*IncidentServiceResponseAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentServiceResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentServiceResponseAttributes and assigns it to the Attributes field. -func (o *IncidentServiceResponseData) SetAttributes(v IncidentServiceResponseAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *IncidentServiceResponseData) 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 *IncidentServiceResponseData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *IncidentServiceResponseData) SetId(v string) { - o.Id = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentServiceResponseData) GetRelationships() IncidentServiceRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentServiceRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceResponseData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentServiceResponseData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. -func (o *IncidentServiceResponseData) SetRelationships(v IncidentServiceRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentServiceResponseData) GetType() IncidentServiceType { - if o == nil { - var ret IncidentServiceType - 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 *IncidentServiceResponseData) GetTypeOk() (*IncidentServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentServiceResponseData) SetType(v IncidentServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentServiceType `json:"type"` - }{} - all := struct { - Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type IncidentServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_service_type.go b/api/v2/datadog/model_incident_service_type.go deleted file mode 100644 index d68f45d0ca7..00000000000 --- a/api/v2/datadog/model_incident_service_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceType Incident service resource type. -type IncidentServiceType string - -// List of IncidentServiceType. -const ( - INCIDENTSERVICETYPE_SERVICES IncidentServiceType = "services" -) - -var allowedIncidentServiceTypeEnumValues = []IncidentServiceType{ - INCIDENTSERVICETYPE_SERVICES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentServiceType) GetAllowedValues() []IncidentServiceType { - return allowedIncidentServiceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentServiceType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentServiceType(value) - return nil -} - -// NewIncidentServiceTypeFromValue returns a pointer to a valid IncidentServiceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentServiceTypeFromValue(v string) (*IncidentServiceType, error) { - ev := IncidentServiceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentServiceType: valid values are %v", v, allowedIncidentServiceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentServiceType) IsValid() bool { - for _, existing := range allowedIncidentServiceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentServiceType value. -func (v IncidentServiceType) Ptr() *IncidentServiceType { - return &v -} - -// NullableIncidentServiceType handles when a null is used for IncidentServiceType. -type NullableIncidentServiceType struct { - value *IncidentServiceType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentServiceType) Get() *IncidentServiceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentServiceType) Set(val *IncidentServiceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentServiceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentServiceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentServiceType initializes the struct as if Set has been called. -func NewNullableIncidentServiceType(val *IncidentServiceType) *NullableIncidentServiceType { - return &NullableIncidentServiceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentServiceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentServiceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_service_update_attributes.go b/api/v2/datadog/model_incident_service_update_attributes.go deleted file mode 100644 index d58f996c20e..00000000000 --- a/api/v2/datadog/model_incident_service_update_attributes.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceUpdateAttributes The incident service's attributes for an update request. -type IncidentServiceUpdateAttributes struct { - // Name of the incident service. - Name string `json:"name"` - // 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{} -} - -// NewIncidentServiceUpdateAttributes instantiates a new IncidentServiceUpdateAttributes 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 NewIncidentServiceUpdateAttributes(name string) *IncidentServiceUpdateAttributes { - this := IncidentServiceUpdateAttributes{} - this.Name = name - return &this -} - -// NewIncidentServiceUpdateAttributesWithDefaults instantiates a new IncidentServiceUpdateAttributes 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 NewIncidentServiceUpdateAttributesWithDefaults() *IncidentServiceUpdateAttributes { - this := IncidentServiceUpdateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *IncidentServiceUpdateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *IncidentServiceUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *IncidentServiceUpdateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_incident_service_update_data.go b/api/v2/datadog/model_incident_service_update_data.go deleted file mode 100644 index d22a48d1347..00000000000 --- a/api/v2/datadog/model_incident_service_update_data.go +++ /dev/null @@ -1,244 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceUpdateData Incident Service payload for update requests. -type IncidentServiceUpdateData struct { - // The incident service's attributes for an update request. - Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` - // The incident service's ID. - Id *string `json:"id,omitempty"` - // The incident service's relationships. - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - // Incident service resource type. - Type IncidentServiceType `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{} -} - -// NewIncidentServiceUpdateData instantiates a new IncidentServiceUpdateData 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 NewIncidentServiceUpdateData(typeVar IncidentServiceType) *IncidentServiceUpdateData { - this := IncidentServiceUpdateData{} - this.Type = typeVar - return &this -} - -// NewIncidentServiceUpdateDataWithDefaults instantiates a new IncidentServiceUpdateData 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 NewIncidentServiceUpdateDataWithDefaults() *IncidentServiceUpdateData { - this := IncidentServiceUpdateData{} - var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentServiceUpdateData) GetAttributes() IncidentServiceUpdateAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentServiceUpdateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceUpdateData) GetAttributesOk() (*IncidentServiceUpdateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentServiceUpdateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentServiceUpdateAttributes and assigns it to the Attributes field. -func (o *IncidentServiceUpdateData) SetAttributes(v IncidentServiceUpdateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *IncidentServiceUpdateData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceUpdateData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *IncidentServiceUpdateData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *IncidentServiceUpdateData) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentServiceUpdateData) GetRelationships() IncidentServiceRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentServiceRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServiceUpdateData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentServiceUpdateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. -func (o *IncidentServiceUpdateData) SetRelationships(v IncidentServiceRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentServiceUpdateData) GetType() IncidentServiceType { - if o == nil { - var ret IncidentServiceType - 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 *IncidentServiceUpdateData) GetTypeOk() (*IncidentServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentServiceUpdateData) SetType(v IncidentServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *IncidentServiceType `json:"type"` - }{} - all := struct { - Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type IncidentServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_service_update_request.go b/api/v2/datadog/model_incident_service_update_request.go deleted file mode 100644 index 0300f16b4ba..00000000000 --- a/api/v2/datadog/model_incident_service_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServiceUpdateRequest Update request with an incident service payload. -type IncidentServiceUpdateRequest struct { - // Incident Service payload for update requests. - Data IncidentServiceUpdateData `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{} -} - -// NewIncidentServiceUpdateRequest instantiates a new IncidentServiceUpdateRequest 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 NewIncidentServiceUpdateRequest(data IncidentServiceUpdateData) *IncidentServiceUpdateRequest { - this := IncidentServiceUpdateRequest{} - this.Data = data - return &this -} - -// NewIncidentServiceUpdateRequestWithDefaults instantiates a new IncidentServiceUpdateRequest 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 NewIncidentServiceUpdateRequestWithDefaults() *IncidentServiceUpdateRequest { - this := IncidentServiceUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServiceUpdateRequest) GetData() IncidentServiceUpdateData { - if o == nil { - var ret IncidentServiceUpdateData - 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 *IncidentServiceUpdateRequest) GetDataOk() (*IncidentServiceUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServiceUpdateRequest) SetData(v IncidentServiceUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServiceUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentServiceUpdateData `json:"data"` - }{} - all := struct { - Data IncidentServiceUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_incident_services_response.go b/api/v2/datadog/model_incident_services_response.go deleted file mode 100644 index 10766419975..00000000000 --- a/api/v2/datadog/model_incident_services_response.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentServicesResponse Response with a list of incident service payloads. -type IncidentServicesResponse struct { - // An array of incident services. - Data []IncidentServiceResponseData `json:"data"` - // Included related resources which the user requested. - Included []IncidentServiceIncludedItems `json:"included,omitempty"` - // The metadata object containing pagination metadata. - Meta *IncidentResponseMeta `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{} -} - -// NewIncidentServicesResponse instantiates a new IncidentServicesResponse 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 NewIncidentServicesResponse(data []IncidentServiceResponseData) *IncidentServicesResponse { - this := IncidentServicesResponse{} - this.Data = data - return &this -} - -// NewIncidentServicesResponseWithDefaults instantiates a new IncidentServicesResponse 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 NewIncidentServicesResponseWithDefaults() *IncidentServicesResponse { - this := IncidentServicesResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentServicesResponse) GetData() []IncidentServiceResponseData { - if o == nil { - var ret []IncidentServiceResponseData - 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 *IncidentServicesResponse) GetDataOk() (*[]IncidentServiceResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentServicesResponse) SetData(v []IncidentServiceResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentServicesResponse) GetIncluded() []IncidentServiceIncludedItems { - if o == nil || o.Included == nil { - var ret []IncidentServiceIncludedItems - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentServicesResponse) GetIncludedOk() (*[]IncidentServiceIncludedItems, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentServicesResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []IncidentServiceIncludedItems and assigns it to the Included field. -func (o *IncidentServicesResponse) SetIncluded(v []IncidentServiceIncludedItems) { - o.Included = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *IncidentServicesResponse) GetMeta() IncidentResponseMeta { - if o == nil || o.Meta == nil { - var ret IncidentResponseMeta - 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 *IncidentServicesResponse) GetMetaOk() (*IncidentResponseMeta, 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 *IncidentServicesResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given IncidentResponseMeta and assigns it to the Meta field. -func (o *IncidentServicesResponse) SetMeta(v IncidentResponseMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentServicesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]IncidentServiceResponseData `json:"data"` - }{} - all := struct { - Data []IncidentServiceResponseData `json:"data"` - Included []IncidentServiceIncludedItems `json:"included,omitempty"` - Meta *IncidentResponseMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Included = all.Included - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_incident_team_create_attributes.go b/api/v2/datadog/model_incident_team_create_attributes.go deleted file mode 100644 index caa27103081..00000000000 --- a/api/v2/datadog/model_incident_team_create_attributes.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamCreateAttributes The incident team's attributes for a create request. -type IncidentTeamCreateAttributes struct { - // Name of the incident team. - Name string `json:"name"` - // 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{} -} - -// NewIncidentTeamCreateAttributes instantiates a new IncidentTeamCreateAttributes 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 NewIncidentTeamCreateAttributes(name string) *IncidentTeamCreateAttributes { - this := IncidentTeamCreateAttributes{} - this.Name = name - return &this -} - -// NewIncidentTeamCreateAttributesWithDefaults instantiates a new IncidentTeamCreateAttributes 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 NewIncidentTeamCreateAttributesWithDefaults() *IncidentTeamCreateAttributes { - this := IncidentTeamCreateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *IncidentTeamCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *IncidentTeamCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *IncidentTeamCreateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_incident_team_create_data.go b/api/v2/datadog/model_incident_team_create_data.go deleted file mode 100644 index e8e5e2cda50..00000000000 --- a/api/v2/datadog/model_incident_team_create_data.go +++ /dev/null @@ -1,205 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamCreateData Incident Team data for a create request. -type IncidentTeamCreateData struct { - // The incident team's attributes for a create request. - Attributes *IncidentTeamCreateAttributes `json:"attributes,omitempty"` - // The incident team's relationships. - Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - // Incident Team resource type. - Type IncidentTeamType `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{} -} - -// NewIncidentTeamCreateData instantiates a new IncidentTeamCreateData 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 NewIncidentTeamCreateData(typeVar IncidentTeamType) *IncidentTeamCreateData { - this := IncidentTeamCreateData{} - this.Type = typeVar - return &this -} - -// NewIncidentTeamCreateDataWithDefaults instantiates a new IncidentTeamCreateData 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 NewIncidentTeamCreateDataWithDefaults() *IncidentTeamCreateData { - this := IncidentTeamCreateData{} - var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentTeamCreateData) GetAttributes() IncidentTeamCreateAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentTeamCreateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamCreateData) GetAttributesOk() (*IncidentTeamCreateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentTeamCreateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentTeamCreateAttributes and assigns it to the Attributes field. -func (o *IncidentTeamCreateData) SetAttributes(v IncidentTeamCreateAttributes) { - o.Attributes = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentTeamCreateData) GetRelationships() IncidentTeamRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentTeamRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamCreateData) GetRelationshipsOk() (*IncidentTeamRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentTeamCreateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentTeamRelationships and assigns it to the Relationships field. -func (o *IncidentTeamCreateData) SetRelationships(v IncidentTeamRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentTeamCreateData) GetType() IncidentTeamType { - if o == nil { - var ret IncidentTeamType - 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 *IncidentTeamCreateData) GetTypeOk() (*IncidentTeamType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentTeamCreateData) SetType(v IncidentTeamType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *IncidentTeamType `json:"type"` - }{} - all := struct { - Attributes *IncidentTeamCreateAttributes `json:"attributes,omitempty"` - Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - Type IncidentTeamType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_team_create_request.go b/api/v2/datadog/model_incident_team_create_request.go deleted file mode 100644 index 0362d2cdf85..00000000000 --- a/api/v2/datadog/model_incident_team_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamCreateRequest Create request with an incident team payload. -type IncidentTeamCreateRequest struct { - // Incident Team data for a create request. - Data IncidentTeamCreateData `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{} -} - -// NewIncidentTeamCreateRequest instantiates a new IncidentTeamCreateRequest 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 NewIncidentTeamCreateRequest(data IncidentTeamCreateData) *IncidentTeamCreateRequest { - this := IncidentTeamCreateRequest{} - this.Data = data - return &this -} - -// NewIncidentTeamCreateRequestWithDefaults instantiates a new IncidentTeamCreateRequest 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 NewIncidentTeamCreateRequestWithDefaults() *IncidentTeamCreateRequest { - this := IncidentTeamCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentTeamCreateRequest) GetData() IncidentTeamCreateData { - if o == nil { - var ret IncidentTeamCreateData - 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 *IncidentTeamCreateRequest) GetDataOk() (*IncidentTeamCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentTeamCreateRequest) SetData(v IncidentTeamCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentTeamCreateData `json:"data"` - }{} - all := struct { - Data IncidentTeamCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_incident_team_included_items.go b/api/v2/datadog/model_incident_team_included_items.go deleted file mode 100644 index 33f5de81b35..00000000000 --- a/api/v2/datadog/model_incident_team_included_items.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentTeamIncludedItems - An object related to an incident team which is present in the included payload. -type IncidentTeamIncludedItems struct { - User *User - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// UserAsIncidentTeamIncludedItems is a convenience function that returns User wrapped in IncidentTeamIncludedItems. -func UserAsIncidentTeamIncludedItems(v *User) IncidentTeamIncludedItems { - return IncidentTeamIncludedItems{User: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *IncidentTeamIncludedItems) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into User - err = json.Unmarshal(data, &obj.User) - if err == nil { - if obj.User != nil && obj.User.UnparsedObject == nil { - jsonUser, _ := json.Marshal(obj.User) - if string(jsonUser) == "{}" { // empty struct - obj.User = nil - } else { - match++ - } - } else { - obj.User = nil - } - } else { - obj.User = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.User = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj IncidentTeamIncludedItems) MarshalJSON() ([]byte, error) { - if obj.User != nil { - return json.Marshal(&obj.User) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *IncidentTeamIncludedItems) GetActualInstance() interface{} { - if obj.User != nil { - return obj.User - } - - // all schemas are nil - return nil -} - -// NullableIncidentTeamIncludedItems handles when a null is used for IncidentTeamIncludedItems. -type NullableIncidentTeamIncludedItems struct { - value *IncidentTeamIncludedItems - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTeamIncludedItems) Get() *IncidentTeamIncludedItems { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTeamIncludedItems) Set(val *IncidentTeamIncludedItems) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTeamIncludedItems) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentTeamIncludedItems) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTeamIncludedItems initializes the struct as if Set has been called. -func NewNullableIncidentTeamIncludedItems(val *IncidentTeamIncludedItems) *NullableIncidentTeamIncludedItems { - return &NullableIncidentTeamIncludedItems{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTeamIncludedItems) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTeamIncludedItems) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_team_relationships.go b/api/v2/datadog/model_incident_team_relationships.go deleted file mode 100644 index c4235c9e7d3..00000000000 --- a/api/v2/datadog/model_incident_team_relationships.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentTeamRelationships The incident team's relationships. -type IncidentTeamRelationships struct { - // Relationship to user. - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - // Relationship to user. - LastModifiedBy *RelationshipToUser `json:"last_modified_by,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{} -} - -// NewIncidentTeamRelationships instantiates a new IncidentTeamRelationships 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 NewIncidentTeamRelationships() *IncidentTeamRelationships { - this := IncidentTeamRelationships{} - return &this -} - -// NewIncidentTeamRelationshipsWithDefaults instantiates a new IncidentTeamRelationships 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 NewIncidentTeamRelationshipsWithDefaults() *IncidentTeamRelationships { - this := IncidentTeamRelationships{} - return &this -} - -// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. -func (o *IncidentTeamRelationships) GetCreatedBy() RelationshipToUser { - if o == nil || o.CreatedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.CreatedBy -} - -// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { - if o == nil || o.CreatedBy == nil { - return nil, false - } - return o.CreatedBy, true -} - -// HasCreatedBy returns a boolean if a field has been set. -func (o *IncidentTeamRelationships) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { - return true - } - - return false -} - -// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. -func (o *IncidentTeamRelationships) SetCreatedBy(v RelationshipToUser) { - o.CreatedBy = &v -} - -// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. -func (o *IncidentTeamRelationships) GetLastModifiedBy() RelationshipToUser { - if o == nil || o.LastModifiedBy == nil { - var ret RelationshipToUser - return ret - } - return *o.LastModifiedBy -} - -// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamRelationships) GetLastModifiedByOk() (*RelationshipToUser, bool) { - if o == nil || o.LastModifiedBy == nil { - return nil, false - } - return o.LastModifiedBy, true -} - -// HasLastModifiedBy returns a boolean if a field has been set. -func (o *IncidentTeamRelationships) HasLastModifiedBy() bool { - if o != nil && o.LastModifiedBy != nil { - return true - } - - return false -} - -// SetLastModifiedBy gets a reference to the given RelationshipToUser and assigns it to the LastModifiedBy field. -func (o *IncidentTeamRelationships) SetLastModifiedBy(v RelationshipToUser) { - o.LastModifiedBy = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedBy != nil { - toSerialize["created_by"] = o.CreatedBy - } - if o.LastModifiedBy != nil { - toSerialize["last_modified_by"] = o.LastModifiedBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedBy *RelationshipToUser `json:"created_by,omitempty"` - LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CreatedBy = all.CreatedBy - if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.LastModifiedBy = all.LastModifiedBy - return nil -} diff --git a/api/v2/datadog/model_incident_team_response.go b/api/v2/datadog/model_incident_team_response.go deleted file mode 100644 index 2584786ac4a..00000000000 --- a/api/v2/datadog/model_incident_team_response.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamResponse Response with an incident team payload. -type IncidentTeamResponse struct { - // Incident Team data from a response. - Data IncidentTeamResponseData `json:"data"` - // Included objects from relationships. - Included []IncidentTeamIncludedItems `json:"included,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{} -} - -// NewIncidentTeamResponse instantiates a new IncidentTeamResponse 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 NewIncidentTeamResponse(data IncidentTeamResponseData) *IncidentTeamResponse { - this := IncidentTeamResponse{} - this.Data = data - return &this -} - -// NewIncidentTeamResponseWithDefaults instantiates a new IncidentTeamResponse 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 NewIncidentTeamResponseWithDefaults() *IncidentTeamResponse { - this := IncidentTeamResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentTeamResponse) GetData() IncidentTeamResponseData { - if o == nil { - var ret IncidentTeamResponseData - 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 *IncidentTeamResponse) GetDataOk() (*IncidentTeamResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentTeamResponse) SetData(v IncidentTeamResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentTeamResponse) GetIncluded() []IncidentTeamIncludedItems { - if o == nil || o.Included == nil { - var ret []IncidentTeamIncludedItems - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponse) GetIncludedOk() (*[]IncidentTeamIncludedItems, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentTeamResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []IncidentTeamIncludedItems and assigns it to the Included field. -func (o *IncidentTeamResponse) SetIncluded(v []IncidentTeamIncludedItems) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentTeamResponseData `json:"data"` - }{} - all := struct { - Data IncidentTeamResponseData `json:"data"` - Included []IncidentTeamIncludedItems `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_incident_team_response_attributes.go b/api/v2/datadog/model_incident_team_response_attributes.go deleted file mode 100644 index e09e197af5a..00000000000 --- a/api/v2/datadog/model_incident_team_response_attributes.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// IncidentTeamResponseAttributes The incident team's attributes from a response. -type IncidentTeamResponseAttributes struct { - // Timestamp of when the incident team was created. - Created *time.Time `json:"created,omitempty"` - // Timestamp of when the incident team was modified. - Modified *time.Time `json:"modified,omitempty"` - // Name of the incident team. - Name *string `json:"name,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{} -} - -// NewIncidentTeamResponseAttributes instantiates a new IncidentTeamResponseAttributes 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 NewIncidentTeamResponseAttributes() *IncidentTeamResponseAttributes { - this := IncidentTeamResponseAttributes{} - return &this -} - -// NewIncidentTeamResponseAttributesWithDefaults instantiates a new IncidentTeamResponseAttributes 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 NewIncidentTeamResponseAttributesWithDefaults() *IncidentTeamResponseAttributes { - this := IncidentTeamResponseAttributes{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *IncidentTeamResponseAttributes) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponseAttributes) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *IncidentTeamResponseAttributes) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *IncidentTeamResponseAttributes) SetCreated(v time.Time) { - o.Created = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *IncidentTeamResponseAttributes) GetModified() time.Time { - if o == nil || o.Modified == nil { - var ret time.Time - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponseAttributes) GetModifiedOk() (*time.Time, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *IncidentTeamResponseAttributes) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given time.Time and assigns it to the Modified field. -func (o *IncidentTeamResponseAttributes) SetModified(v time.Time) { - o.Modified = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *IncidentTeamResponseAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponseAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *IncidentTeamResponseAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *IncidentTeamResponseAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Modified != nil { - if o.Modified.Nanosecond() == 0 { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Created *time.Time `json:"created,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Created = all.Created - o.Modified = all.Modified - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_incident_team_response_data.go b/api/v2/datadog/model_incident_team_response_data.go deleted file mode 100644 index 4c15a3ea4d2..00000000000 --- a/api/v2/datadog/model_incident_team_response_data.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentTeamResponseData Incident Team data from a response. -type IncidentTeamResponseData struct { - // The incident team's attributes from a response. - Attributes *IncidentTeamResponseAttributes `json:"attributes,omitempty"` - // The incident team's ID. - Id *string `json:"id,omitempty"` - // The incident team's relationships. - Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - // Incident Team resource type. - Type *IncidentTeamType `json:"type,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{} -} - -// NewIncidentTeamResponseData instantiates a new IncidentTeamResponseData 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 NewIncidentTeamResponseData() *IncidentTeamResponseData { - this := IncidentTeamResponseData{} - var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS - this.Type = &typeVar - return &this -} - -// NewIncidentTeamResponseDataWithDefaults instantiates a new IncidentTeamResponseData 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 NewIncidentTeamResponseDataWithDefaults() *IncidentTeamResponseData { - this := IncidentTeamResponseData{} - var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentTeamResponseData) GetAttributes() IncidentTeamResponseAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentTeamResponseAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponseData) GetAttributesOk() (*IncidentTeamResponseAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentTeamResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentTeamResponseAttributes and assigns it to the Attributes field. -func (o *IncidentTeamResponseData) SetAttributes(v IncidentTeamResponseAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *IncidentTeamResponseData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponseData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *IncidentTeamResponseData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *IncidentTeamResponseData) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentTeamResponseData) GetRelationships() IncidentTeamRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentTeamRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponseData) GetRelationshipsOk() (*IncidentTeamRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentTeamResponseData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentTeamRelationships and assigns it to the Relationships field. -func (o *IncidentTeamResponseData) SetRelationships(v IncidentTeamRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *IncidentTeamResponseData) GetType() IncidentTeamType { - if o == nil || o.Type == nil { - var ret IncidentTeamType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamResponseData) GetTypeOk() (*IncidentTeamType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *IncidentTeamResponseData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given IncidentTeamType and assigns it to the Type field. -func (o *IncidentTeamResponseData) SetType(v IncidentTeamType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *IncidentTeamResponseAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - Type *IncidentTeamType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_team_type.go b/api/v2/datadog/model_incident_team_type.go deleted file mode 100644 index ea35b94dbd6..00000000000 --- a/api/v2/datadog/model_incident_team_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamType Incident Team resource type. -type IncidentTeamType string - -// List of IncidentTeamType. -const ( - INCIDENTTEAMTYPE_TEAMS IncidentTeamType = "teams" -) - -var allowedIncidentTeamTypeEnumValues = []IncidentTeamType{ - INCIDENTTEAMTYPE_TEAMS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentTeamType) GetAllowedValues() []IncidentTeamType { - return allowedIncidentTeamTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentTeamType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentTeamType(value) - return nil -} - -// NewIncidentTeamTypeFromValue returns a pointer to a valid IncidentTeamType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentTeamTypeFromValue(v string) (*IncidentTeamType, error) { - ev := IncidentTeamType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentTeamType: valid values are %v", v, allowedIncidentTeamTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentTeamType) IsValid() bool { - for _, existing := range allowedIncidentTeamTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentTeamType value. -func (v IncidentTeamType) Ptr() *IncidentTeamType { - return &v -} - -// NullableIncidentTeamType handles when a null is used for IncidentTeamType. -type NullableIncidentTeamType struct { - value *IncidentTeamType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTeamType) Get() *IncidentTeamType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTeamType) Set(val *IncidentTeamType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTeamType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentTeamType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTeamType initializes the struct as if Set has been called. -func NewNullableIncidentTeamType(val *IncidentTeamType) *NullableIncidentTeamType { - return &NullableIncidentTeamType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTeamType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTeamType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_team_update_attributes.go b/api/v2/datadog/model_incident_team_update_attributes.go deleted file mode 100644 index 46b5951e22b..00000000000 --- a/api/v2/datadog/model_incident_team_update_attributes.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamUpdateAttributes The incident team's attributes for an update request. -type IncidentTeamUpdateAttributes struct { - // Name of the incident team. - Name string `json:"name"` - // 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{} -} - -// NewIncidentTeamUpdateAttributes instantiates a new IncidentTeamUpdateAttributes 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 NewIncidentTeamUpdateAttributes(name string) *IncidentTeamUpdateAttributes { - this := IncidentTeamUpdateAttributes{} - this.Name = name - return &this -} - -// NewIncidentTeamUpdateAttributesWithDefaults instantiates a new IncidentTeamUpdateAttributes 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 NewIncidentTeamUpdateAttributesWithDefaults() *IncidentTeamUpdateAttributes { - this := IncidentTeamUpdateAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *IncidentTeamUpdateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *IncidentTeamUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *IncidentTeamUpdateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_incident_team_update_data.go b/api/v2/datadog/model_incident_team_update_data.go deleted file mode 100644 index 15541d76c59..00000000000 --- a/api/v2/datadog/model_incident_team_update_data.go +++ /dev/null @@ -1,244 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamUpdateData Incident Team data for an update request. -type IncidentTeamUpdateData struct { - // The incident team's attributes for an update request. - Attributes *IncidentTeamUpdateAttributes `json:"attributes,omitempty"` - // The incident team's ID. - Id *string `json:"id,omitempty"` - // The incident team's relationships. - Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - // Incident Team resource type. - Type IncidentTeamType `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{} -} - -// NewIncidentTeamUpdateData instantiates a new IncidentTeamUpdateData 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 NewIncidentTeamUpdateData(typeVar IncidentTeamType) *IncidentTeamUpdateData { - this := IncidentTeamUpdateData{} - this.Type = typeVar - return &this -} - -// NewIncidentTeamUpdateDataWithDefaults instantiates a new IncidentTeamUpdateData 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 NewIncidentTeamUpdateDataWithDefaults() *IncidentTeamUpdateData { - this := IncidentTeamUpdateData{} - var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentTeamUpdateData) GetAttributes() IncidentTeamUpdateAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentTeamUpdateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamUpdateData) GetAttributesOk() (*IncidentTeamUpdateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentTeamUpdateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentTeamUpdateAttributes and assigns it to the Attributes field. -func (o *IncidentTeamUpdateData) SetAttributes(v IncidentTeamUpdateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *IncidentTeamUpdateData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamUpdateData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *IncidentTeamUpdateData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *IncidentTeamUpdateData) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentTeamUpdateData) GetRelationships() IncidentTeamRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentTeamRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamUpdateData) GetRelationshipsOk() (*IncidentTeamRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentTeamUpdateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentTeamRelationships and assigns it to the Relationships field. -func (o *IncidentTeamUpdateData) SetRelationships(v IncidentTeamRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentTeamUpdateData) GetType() IncidentTeamType { - if o == nil { - var ret IncidentTeamType - 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 *IncidentTeamUpdateData) GetTypeOk() (*IncidentTeamType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentTeamUpdateData) SetType(v IncidentTeamType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *IncidentTeamType `json:"type"` - }{} - all := struct { - Attributes *IncidentTeamUpdateAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - Type IncidentTeamType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_team_update_request.go b/api/v2/datadog/model_incident_team_update_request.go deleted file mode 100644 index 176158ac4bb..00000000000 --- a/api/v2/datadog/model_incident_team_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamUpdateRequest Update request with an incident team payload. -type IncidentTeamUpdateRequest struct { - // Incident Team data for an update request. - Data IncidentTeamUpdateData `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{} -} - -// NewIncidentTeamUpdateRequest instantiates a new IncidentTeamUpdateRequest 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 NewIncidentTeamUpdateRequest(data IncidentTeamUpdateData) *IncidentTeamUpdateRequest { - this := IncidentTeamUpdateRequest{} - this.Data = data - return &this -} - -// NewIncidentTeamUpdateRequestWithDefaults instantiates a new IncidentTeamUpdateRequest 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 NewIncidentTeamUpdateRequestWithDefaults() *IncidentTeamUpdateRequest { - this := IncidentTeamUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentTeamUpdateRequest) GetData() IncidentTeamUpdateData { - if o == nil { - var ret IncidentTeamUpdateData - 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 *IncidentTeamUpdateRequest) GetDataOk() (*IncidentTeamUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentTeamUpdateRequest) SetData(v IncidentTeamUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentTeamUpdateData `json:"data"` - }{} - all := struct { - Data IncidentTeamUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_incident_teams_response.go b/api/v2/datadog/model_incident_teams_response.go deleted file mode 100644 index 1e6e2917009..00000000000 --- a/api/v2/datadog/model_incident_teams_response.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTeamsResponse Response with a list of incident team payloads. -type IncidentTeamsResponse struct { - // An array of incident teams. - Data []IncidentTeamResponseData `json:"data"` - // Included related resources which the user requested. - Included []IncidentTeamIncludedItems `json:"included,omitempty"` - // The metadata object containing pagination metadata. - Meta *IncidentResponseMeta `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{} -} - -// NewIncidentTeamsResponse instantiates a new IncidentTeamsResponse 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 NewIncidentTeamsResponse(data []IncidentTeamResponseData) *IncidentTeamsResponse { - this := IncidentTeamsResponse{} - this.Data = data - return &this -} - -// NewIncidentTeamsResponseWithDefaults instantiates a new IncidentTeamsResponse 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 NewIncidentTeamsResponseWithDefaults() *IncidentTeamsResponse { - this := IncidentTeamsResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentTeamsResponse) GetData() []IncidentTeamResponseData { - if o == nil { - var ret []IncidentTeamResponseData - 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 *IncidentTeamsResponse) GetDataOk() (*[]IncidentTeamResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentTeamsResponse) SetData(v []IncidentTeamResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentTeamsResponse) GetIncluded() []IncidentTeamIncludedItems { - if o == nil || o.Included == nil { - var ret []IncidentTeamIncludedItems - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTeamsResponse) GetIncludedOk() (*[]IncidentTeamIncludedItems, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentTeamsResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []IncidentTeamIncludedItems and assigns it to the Included field. -func (o *IncidentTeamsResponse) SetIncluded(v []IncidentTeamIncludedItems) { - o.Included = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *IncidentTeamsResponse) GetMeta() IncidentResponseMeta { - if o == nil || o.Meta == nil { - var ret IncidentResponseMeta - 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 *IncidentTeamsResponse) GetMetaOk() (*IncidentResponseMeta, 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 *IncidentTeamsResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given IncidentResponseMeta and assigns it to the Meta field. -func (o *IncidentTeamsResponse) SetMeta(v IncidentResponseMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTeamsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]IncidentTeamResponseData `json:"data"` - }{} - all := struct { - Data []IncidentTeamResponseData `json:"data"` - Included []IncidentTeamIncludedItems `json:"included,omitempty"` - Meta *IncidentResponseMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Included = all.Included - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_incident_timeline_cell_create_attributes.go b/api/v2/datadog/model_incident_timeline_cell_create_attributes.go deleted file mode 100644 index 07de51d99be..00000000000 --- a/api/v2/datadog/model_incident_timeline_cell_create_attributes.go +++ /dev/null @@ -1,123 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentTimelineCellCreateAttributes - The timeline cell's attributes for a create request. -type IncidentTimelineCellCreateAttributes struct { - IncidentTimelineCellMarkdownCreateAttributes *IncidentTimelineCellMarkdownCreateAttributes - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// IncidentTimelineCellMarkdownCreateAttributesAsIncidentTimelineCellCreateAttributes is a convenience function that returns IncidentTimelineCellMarkdownCreateAttributes wrapped in IncidentTimelineCellCreateAttributes. -func IncidentTimelineCellMarkdownCreateAttributesAsIncidentTimelineCellCreateAttributes(v *IncidentTimelineCellMarkdownCreateAttributes) IncidentTimelineCellCreateAttributes { - return IncidentTimelineCellCreateAttributes{IncidentTimelineCellMarkdownCreateAttributes: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *IncidentTimelineCellCreateAttributes) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into IncidentTimelineCellMarkdownCreateAttributes - err = json.Unmarshal(data, &obj.IncidentTimelineCellMarkdownCreateAttributes) - if err == nil { - if obj.IncidentTimelineCellMarkdownCreateAttributes != nil && obj.IncidentTimelineCellMarkdownCreateAttributes.UnparsedObject == nil { - jsonIncidentTimelineCellMarkdownCreateAttributes, _ := json.Marshal(obj.IncidentTimelineCellMarkdownCreateAttributes) - if string(jsonIncidentTimelineCellMarkdownCreateAttributes) == "{}" { // empty struct - obj.IncidentTimelineCellMarkdownCreateAttributes = nil - } else { - match++ - } - } else { - obj.IncidentTimelineCellMarkdownCreateAttributes = nil - } - } else { - obj.IncidentTimelineCellMarkdownCreateAttributes = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.IncidentTimelineCellMarkdownCreateAttributes = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj IncidentTimelineCellCreateAttributes) MarshalJSON() ([]byte, error) { - if obj.IncidentTimelineCellMarkdownCreateAttributes != nil { - return json.Marshal(&obj.IncidentTimelineCellMarkdownCreateAttributes) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *IncidentTimelineCellCreateAttributes) GetActualInstance() interface{} { - if obj.IncidentTimelineCellMarkdownCreateAttributes != nil { - return obj.IncidentTimelineCellMarkdownCreateAttributes - } - - // all schemas are nil - return nil -} - -// NullableIncidentTimelineCellCreateAttributes handles when a null is used for IncidentTimelineCellCreateAttributes. -type NullableIncidentTimelineCellCreateAttributes struct { - value *IncidentTimelineCellCreateAttributes - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTimelineCellCreateAttributes) Get() *IncidentTimelineCellCreateAttributes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTimelineCellCreateAttributes) Set(val *IncidentTimelineCellCreateAttributes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTimelineCellCreateAttributes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableIncidentTimelineCellCreateAttributes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTimelineCellCreateAttributes initializes the struct as if Set has been called. -func NewNullableIncidentTimelineCellCreateAttributes(val *IncidentTimelineCellCreateAttributes) *NullableIncidentTimelineCellCreateAttributes { - return &NullableIncidentTimelineCellCreateAttributes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTimelineCellCreateAttributes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTimelineCellCreateAttributes) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go b/api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go deleted file mode 100644 index edf66394ab0..00000000000 --- a/api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTimelineCellMarkdownContentType Type of the Markdown timeline cell. -type IncidentTimelineCellMarkdownContentType string - -// List of IncidentTimelineCellMarkdownContentType. -const ( - INCIDENTTIMELINECELLMARKDOWNCONTENTTYPE_MARKDOWN IncidentTimelineCellMarkdownContentType = "markdown" -) - -var allowedIncidentTimelineCellMarkdownContentTypeEnumValues = []IncidentTimelineCellMarkdownContentType{ - INCIDENTTIMELINECELLMARKDOWNCONTENTTYPE_MARKDOWN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentTimelineCellMarkdownContentType) GetAllowedValues() []IncidentTimelineCellMarkdownContentType { - return allowedIncidentTimelineCellMarkdownContentTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentTimelineCellMarkdownContentType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentTimelineCellMarkdownContentType(value) - return nil -} - -// NewIncidentTimelineCellMarkdownContentTypeFromValue returns a pointer to a valid IncidentTimelineCellMarkdownContentType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentTimelineCellMarkdownContentTypeFromValue(v string) (*IncidentTimelineCellMarkdownContentType, error) { - ev := IncidentTimelineCellMarkdownContentType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentTimelineCellMarkdownContentType: valid values are %v", v, allowedIncidentTimelineCellMarkdownContentTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentTimelineCellMarkdownContentType) IsValid() bool { - for _, existing := range allowedIncidentTimelineCellMarkdownContentTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentTimelineCellMarkdownContentType value. -func (v IncidentTimelineCellMarkdownContentType) Ptr() *IncidentTimelineCellMarkdownContentType { - return &v -} - -// NullableIncidentTimelineCellMarkdownContentType handles when a null is used for IncidentTimelineCellMarkdownContentType. -type NullableIncidentTimelineCellMarkdownContentType struct { - value *IncidentTimelineCellMarkdownContentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentTimelineCellMarkdownContentType) Get() *IncidentTimelineCellMarkdownContentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentTimelineCellMarkdownContentType) Set(val *IncidentTimelineCellMarkdownContentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentTimelineCellMarkdownContentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentTimelineCellMarkdownContentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentTimelineCellMarkdownContentType initializes the struct as if Set has been called. -func NewNullableIncidentTimelineCellMarkdownContentType(val *IncidentTimelineCellMarkdownContentType) *NullableIncidentTimelineCellMarkdownContentType { - return &NullableIncidentTimelineCellMarkdownContentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentTimelineCellMarkdownContentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentTimelineCellMarkdownContentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go b/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go deleted file mode 100644 index 374572c3016..00000000000 --- a/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go +++ /dev/null @@ -1,196 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentTimelineCellMarkdownCreateAttributes Timeline cell data for Markdown timeline cells for a create request. -type IncidentTimelineCellMarkdownCreateAttributes struct { - // Type of the Markdown timeline cell. - CellType IncidentTimelineCellMarkdownContentType `json:"cell_type"` - // The Markdown timeline cell contents. - Content IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` - // A flag indicating whether the timeline cell is important and should be highlighted. - Important *bool `json:"important,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{} -} - -// NewIncidentTimelineCellMarkdownCreateAttributes instantiates a new IncidentTimelineCellMarkdownCreateAttributes 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 NewIncidentTimelineCellMarkdownCreateAttributes(cellType IncidentTimelineCellMarkdownContentType, content IncidentTimelineCellMarkdownCreateAttributesContent) *IncidentTimelineCellMarkdownCreateAttributes { - this := IncidentTimelineCellMarkdownCreateAttributes{} - this.CellType = cellType - this.Content = content - var important bool = false - this.Important = &important - return &this -} - -// NewIncidentTimelineCellMarkdownCreateAttributesWithDefaults instantiates a new IncidentTimelineCellMarkdownCreateAttributes 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 NewIncidentTimelineCellMarkdownCreateAttributesWithDefaults() *IncidentTimelineCellMarkdownCreateAttributes { - this := IncidentTimelineCellMarkdownCreateAttributes{} - var cellType IncidentTimelineCellMarkdownContentType = INCIDENTTIMELINECELLMARKDOWNCONTENTTYPE_MARKDOWN - this.CellType = cellType - var important bool = false - this.Important = &important - return &this -} - -// GetCellType returns the CellType field value. -func (o *IncidentTimelineCellMarkdownCreateAttributes) GetCellType() IncidentTimelineCellMarkdownContentType { - if o == nil { - var ret IncidentTimelineCellMarkdownContentType - return ret - } - return o.CellType -} - -// GetCellTypeOk returns a tuple with the CellType field value -// and a boolean to check if the value has been set. -func (o *IncidentTimelineCellMarkdownCreateAttributes) GetCellTypeOk() (*IncidentTimelineCellMarkdownContentType, bool) { - if o == nil { - return nil, false - } - return &o.CellType, true -} - -// SetCellType sets field value. -func (o *IncidentTimelineCellMarkdownCreateAttributes) SetCellType(v IncidentTimelineCellMarkdownContentType) { - o.CellType = v -} - -// GetContent returns the Content field value. -func (o *IncidentTimelineCellMarkdownCreateAttributes) GetContent() IncidentTimelineCellMarkdownCreateAttributesContent { - if o == nil { - var ret IncidentTimelineCellMarkdownCreateAttributesContent - return ret - } - return o.Content -} - -// GetContentOk returns a tuple with the Content field value -// and a boolean to check if the value has been set. -func (o *IncidentTimelineCellMarkdownCreateAttributes) GetContentOk() (*IncidentTimelineCellMarkdownCreateAttributesContent, bool) { - if o == nil { - return nil, false - } - return &o.Content, true -} - -// SetContent sets field value. -func (o *IncidentTimelineCellMarkdownCreateAttributes) SetContent(v IncidentTimelineCellMarkdownCreateAttributesContent) { - o.Content = v -} - -// GetImportant returns the Important field value if set, zero value otherwise. -func (o *IncidentTimelineCellMarkdownCreateAttributes) GetImportant() bool { - if o == nil || o.Important == nil { - var ret bool - return ret - } - return *o.Important -} - -// GetImportantOk returns a tuple with the Important field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTimelineCellMarkdownCreateAttributes) GetImportantOk() (*bool, bool) { - if o == nil || o.Important == nil { - return nil, false - } - return o.Important, true -} - -// HasImportant returns a boolean if a field has been set. -func (o *IncidentTimelineCellMarkdownCreateAttributes) HasImportant() bool { - if o != nil && o.Important != nil { - return true - } - - return false -} - -// SetImportant gets a reference to the given bool and assigns it to the Important field. -func (o *IncidentTimelineCellMarkdownCreateAttributes) SetImportant(v bool) { - o.Important = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTimelineCellMarkdownCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["cell_type"] = o.CellType - toSerialize["content"] = o.Content - if o.Important != nil { - toSerialize["important"] = o.Important - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - CellType *IncidentTimelineCellMarkdownContentType `json:"cell_type"` - Content *IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` - }{} - all := struct { - CellType IncidentTimelineCellMarkdownContentType `json:"cell_type"` - Content IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` - Important *bool `json:"important,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.CellType == nil { - return fmt.Errorf("Required field cell_type missing") - } - if required.Content == nil { - return fmt.Errorf("Required field content missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.CellType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CellType = all.CellType - if all.Content.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Content = all.Content - o.Important = all.Important - return nil -} diff --git a/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.go b/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.go deleted file mode 100644 index ffd958b3095..00000000000 --- a/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentTimelineCellMarkdownCreateAttributesContent The Markdown timeline cell contents. -type IncidentTimelineCellMarkdownCreateAttributesContent struct { - // The Markdown content of the cell. - Content *string `json:"content,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{} -} - -// NewIncidentTimelineCellMarkdownCreateAttributesContent instantiates a new IncidentTimelineCellMarkdownCreateAttributesContent 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 NewIncidentTimelineCellMarkdownCreateAttributesContent() *IncidentTimelineCellMarkdownCreateAttributesContent { - this := IncidentTimelineCellMarkdownCreateAttributesContent{} - return &this -} - -// NewIncidentTimelineCellMarkdownCreateAttributesContentWithDefaults instantiates a new IncidentTimelineCellMarkdownCreateAttributesContent 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 NewIncidentTimelineCellMarkdownCreateAttributesContentWithDefaults() *IncidentTimelineCellMarkdownCreateAttributesContent { - this := IncidentTimelineCellMarkdownCreateAttributesContent{} - return &this -} - -// GetContent returns the Content field value if set, zero value otherwise. -func (o *IncidentTimelineCellMarkdownCreateAttributesContent) GetContent() string { - if o == nil || o.Content == nil { - var ret string - return ret - } - return *o.Content -} - -// GetContentOk returns a tuple with the Content field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentTimelineCellMarkdownCreateAttributesContent) GetContentOk() (*string, bool) { - if o == nil || o.Content == nil { - return nil, false - } - return o.Content, true -} - -// HasContent returns a boolean if a field has been set. -func (o *IncidentTimelineCellMarkdownCreateAttributesContent) HasContent() bool { - if o != nil && o.Content != nil { - return true - } - - return false -} - -// SetContent gets a reference to the given string and assigns it to the Content field. -func (o *IncidentTimelineCellMarkdownCreateAttributesContent) SetContent(v string) { - o.Content = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentTimelineCellMarkdownCreateAttributesContent) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Content != nil { - toSerialize["content"] = o.Content - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentTimelineCellMarkdownCreateAttributesContent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Content *string `json:"content,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Content = all.Content - return nil -} diff --git a/api/v2/datadog/model_incident_type.go b/api/v2/datadog/model_incident_type.go deleted file mode 100644 index bda6eeb3e40..00000000000 --- a/api/v2/datadog/model_incident_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentType Incident resource type. -type IncidentType string - -// List of IncidentType. -const ( - INCIDENTTYPE_INCIDENTS IncidentType = "incidents" -) - -var allowedIncidentTypeEnumValues = []IncidentType{ - INCIDENTTYPE_INCIDENTS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentType) GetAllowedValues() []IncidentType { - return allowedIncidentTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentType(value) - return nil -} - -// NewIncidentTypeFromValue returns a pointer to a valid IncidentType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentTypeFromValue(v string) (*IncidentType, error) { - ev := IncidentType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentType: valid values are %v", v, allowedIncidentTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentType) IsValid() bool { - for _, existing := range allowedIncidentTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentType value. -func (v IncidentType) Ptr() *IncidentType { - return &v -} - -// NullableIncidentType handles when a null is used for IncidentType. -type NullableIncidentType struct { - value *IncidentType - isSet bool -} - -// Get returns the associated value. -func (v NullableIncidentType) Get() *IncidentType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableIncidentType) Set(val *IncidentType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableIncidentType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableIncidentType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableIncidentType initializes the struct as if Set has been called. -func NewNullableIncidentType(val *IncidentType) *NullableIncidentType { - return &NullableIncidentType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableIncidentType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableIncidentType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_incident_update_attributes.go b/api/v2/datadog/model_incident_update_attributes.go deleted file mode 100644 index 93ae02f4503..00000000000 --- a/api/v2/datadog/model_incident_update_attributes.go +++ /dev/null @@ -1,461 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// IncidentUpdateAttributes The incident's attributes for an update request. -type IncidentUpdateAttributes struct { - // Timestamp when customers were no longer impacted by the incident. - CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` - // A summary of the impact customers experienced during the incident. - CustomerImpactScope *string `json:"customer_impact_scope,omitempty"` - // Timestamp when customers began being impacted by the incident. - CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` - // A flag indicating whether the incident caused customer impact. - CustomerImpacted *bool `json:"customer_impacted,omitempty"` - // Timestamp when the incident was detected. - Detected common.NullableTime `json:"detected,omitempty"` - // A condensed view of the user-defined fields for which to update selections. - Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` - // Notification handles that will be notified of the incident during update. - NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` - // Timestamp when the incident's state was set to resolved. - Resolved common.NullableTime `json:"resolved,omitempty"` - // The title of the incident, which summarizes what happened. - Title *string `json:"title,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{} -} - -// NewIncidentUpdateAttributes instantiates a new IncidentUpdateAttributes 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 NewIncidentUpdateAttributes() *IncidentUpdateAttributes { - this := IncidentUpdateAttributes{} - return &this -} - -// NewIncidentUpdateAttributesWithDefaults instantiates a new IncidentUpdateAttributes 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 NewIncidentUpdateAttributesWithDefaults() *IncidentUpdateAttributes { - this := IncidentUpdateAttributes{} - return &this -} - -// GetCustomerImpactEnd returns the CustomerImpactEnd field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentUpdateAttributes) GetCustomerImpactEnd() time.Time { - if o == nil || o.CustomerImpactEnd.Get() == nil { - var ret time.Time - return ret - } - return *o.CustomerImpactEnd.Get() -} - -// GetCustomerImpactEndOk returns a tuple with the CustomerImpactEnd 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 *IncidentUpdateAttributes) GetCustomerImpactEndOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.CustomerImpactEnd.Get(), o.CustomerImpactEnd.IsSet() -} - -// HasCustomerImpactEnd returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasCustomerImpactEnd() bool { - if o != nil && o.CustomerImpactEnd.IsSet() { - return true - } - - return false -} - -// SetCustomerImpactEnd gets a reference to the given common.NullableTime and assigns it to the CustomerImpactEnd field. -func (o *IncidentUpdateAttributes) SetCustomerImpactEnd(v time.Time) { - o.CustomerImpactEnd.Set(&v) -} - -// SetCustomerImpactEndNil sets the value for CustomerImpactEnd to be an explicit nil. -func (o *IncidentUpdateAttributes) SetCustomerImpactEndNil() { - o.CustomerImpactEnd.Set(nil) -} - -// UnsetCustomerImpactEnd ensures that no value is present for CustomerImpactEnd, not even an explicit nil. -func (o *IncidentUpdateAttributes) UnsetCustomerImpactEnd() { - o.CustomerImpactEnd.Unset() -} - -// GetCustomerImpactScope returns the CustomerImpactScope field value if set, zero value otherwise. -func (o *IncidentUpdateAttributes) GetCustomerImpactScope() string { - if o == nil || o.CustomerImpactScope == nil { - var ret string - return ret - } - return *o.CustomerImpactScope -} - -// GetCustomerImpactScopeOk returns a tuple with the CustomerImpactScope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateAttributes) GetCustomerImpactScopeOk() (*string, bool) { - if o == nil || o.CustomerImpactScope == nil { - return nil, false - } - return o.CustomerImpactScope, true -} - -// HasCustomerImpactScope returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasCustomerImpactScope() bool { - if o != nil && o.CustomerImpactScope != nil { - return true - } - - return false -} - -// SetCustomerImpactScope gets a reference to the given string and assigns it to the CustomerImpactScope field. -func (o *IncidentUpdateAttributes) SetCustomerImpactScope(v string) { - o.CustomerImpactScope = &v -} - -// GetCustomerImpactStart returns the CustomerImpactStart field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentUpdateAttributes) GetCustomerImpactStart() time.Time { - if o == nil || o.CustomerImpactStart.Get() == nil { - var ret time.Time - return ret - } - return *o.CustomerImpactStart.Get() -} - -// GetCustomerImpactStartOk returns a tuple with the CustomerImpactStart 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 *IncidentUpdateAttributes) GetCustomerImpactStartOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.CustomerImpactStart.Get(), o.CustomerImpactStart.IsSet() -} - -// HasCustomerImpactStart returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasCustomerImpactStart() bool { - if o != nil && o.CustomerImpactStart.IsSet() { - return true - } - - return false -} - -// SetCustomerImpactStart gets a reference to the given common.NullableTime and assigns it to the CustomerImpactStart field. -func (o *IncidentUpdateAttributes) SetCustomerImpactStart(v time.Time) { - o.CustomerImpactStart.Set(&v) -} - -// SetCustomerImpactStartNil sets the value for CustomerImpactStart to be an explicit nil. -func (o *IncidentUpdateAttributes) SetCustomerImpactStartNil() { - o.CustomerImpactStart.Set(nil) -} - -// UnsetCustomerImpactStart ensures that no value is present for CustomerImpactStart, not even an explicit nil. -func (o *IncidentUpdateAttributes) UnsetCustomerImpactStart() { - o.CustomerImpactStart.Unset() -} - -// GetCustomerImpacted returns the CustomerImpacted field value if set, zero value otherwise. -func (o *IncidentUpdateAttributes) GetCustomerImpacted() bool { - if o == nil || o.CustomerImpacted == nil { - var ret bool - return ret - } - return *o.CustomerImpacted -} - -// GetCustomerImpactedOk returns a tuple with the CustomerImpacted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateAttributes) GetCustomerImpactedOk() (*bool, bool) { - if o == nil || o.CustomerImpacted == nil { - return nil, false - } - return o.CustomerImpacted, true -} - -// HasCustomerImpacted returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasCustomerImpacted() bool { - if o != nil && o.CustomerImpacted != nil { - return true - } - - return false -} - -// SetCustomerImpacted gets a reference to the given bool and assigns it to the CustomerImpacted field. -func (o *IncidentUpdateAttributes) SetCustomerImpacted(v bool) { - o.CustomerImpacted = &v -} - -// GetDetected returns the Detected field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentUpdateAttributes) GetDetected() time.Time { - if o == nil || o.Detected.Get() == nil { - var ret time.Time - return ret - } - return *o.Detected.Get() -} - -// GetDetectedOk returns a tuple with the Detected 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 *IncidentUpdateAttributes) GetDetectedOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.Detected.Get(), o.Detected.IsSet() -} - -// HasDetected returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasDetected() bool { - if o != nil && o.Detected.IsSet() { - return true - } - - return false -} - -// SetDetected gets a reference to the given common.NullableTime and assigns it to the Detected field. -func (o *IncidentUpdateAttributes) SetDetected(v time.Time) { - o.Detected.Set(&v) -} - -// SetDetectedNil sets the value for Detected to be an explicit nil. -func (o *IncidentUpdateAttributes) SetDetectedNil() { - o.Detected.Set(nil) -} - -// UnsetDetected ensures that no value is present for Detected, not even an explicit nil. -func (o *IncidentUpdateAttributes) UnsetDetected() { - o.Detected.Unset() -} - -// GetFields returns the Fields field value if set, zero value otherwise. -func (o *IncidentUpdateAttributes) GetFields() map[string]IncidentFieldAttributes { - if o == nil || o.Fields == nil { - var ret map[string]IncidentFieldAttributes - return ret - } - return o.Fields -} - -// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateAttributes) GetFieldsOk() (*map[string]IncidentFieldAttributes, bool) { - if o == nil || o.Fields == nil { - return nil, false - } - return &o.Fields, true -} - -// HasFields returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasFields() bool { - if o != nil && o.Fields != nil { - return true - } - - return false -} - -// SetFields gets a reference to the given map[string]IncidentFieldAttributes and assigns it to the Fields field. -func (o *IncidentUpdateAttributes) SetFields(v map[string]IncidentFieldAttributes) { - o.Fields = v -} - -// GetNotificationHandles returns the NotificationHandles field value if set, zero value otherwise. -func (o *IncidentUpdateAttributes) GetNotificationHandles() []IncidentNotificationHandle { - if o == nil || o.NotificationHandles == nil { - var ret []IncidentNotificationHandle - return ret - } - return o.NotificationHandles -} - -// GetNotificationHandlesOk returns a tuple with the NotificationHandles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateAttributes) GetNotificationHandlesOk() (*[]IncidentNotificationHandle, bool) { - if o == nil || o.NotificationHandles == nil { - return nil, false - } - return &o.NotificationHandles, true -} - -// HasNotificationHandles returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasNotificationHandles() bool { - if o != nil && o.NotificationHandles != nil { - return true - } - - return false -} - -// SetNotificationHandles gets a reference to the given []IncidentNotificationHandle and assigns it to the NotificationHandles field. -func (o *IncidentUpdateAttributes) SetNotificationHandles(v []IncidentNotificationHandle) { - o.NotificationHandles = v -} - -// GetResolved returns the Resolved field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *IncidentUpdateAttributes) GetResolved() time.Time { - if o == nil || o.Resolved.Get() == nil { - var ret time.Time - return ret - } - return *o.Resolved.Get() -} - -// GetResolvedOk returns a tuple with the Resolved 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 *IncidentUpdateAttributes) GetResolvedOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return o.Resolved.Get(), o.Resolved.IsSet() -} - -// HasResolved returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasResolved() bool { - if o != nil && o.Resolved.IsSet() { - return true - } - - return false -} - -// SetResolved gets a reference to the given common.NullableTime and assigns it to the Resolved field. -func (o *IncidentUpdateAttributes) SetResolved(v time.Time) { - o.Resolved.Set(&v) -} - -// SetResolvedNil sets the value for Resolved to be an explicit nil. -func (o *IncidentUpdateAttributes) SetResolvedNil() { - o.Resolved.Set(nil) -} - -// UnsetResolved ensures that no value is present for Resolved, not even an explicit nil. -func (o *IncidentUpdateAttributes) UnsetResolved() { - o.Resolved.Unset() -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *IncidentUpdateAttributes) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateAttributes) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *IncidentUpdateAttributes) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *IncidentUpdateAttributes) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomerImpactEnd.IsSet() { - toSerialize["customer_impact_end"] = o.CustomerImpactEnd.Get() - } - if o.CustomerImpactScope != nil { - toSerialize["customer_impact_scope"] = o.CustomerImpactScope - } - if o.CustomerImpactStart.IsSet() { - toSerialize["customer_impact_start"] = o.CustomerImpactStart.Get() - } - if o.CustomerImpacted != nil { - toSerialize["customer_impacted"] = o.CustomerImpacted - } - if o.Detected.IsSet() { - toSerialize["detected"] = o.Detected.Get() - } - if o.Fields != nil { - toSerialize["fields"] = o.Fields - } - if o.NotificationHandles != nil { - toSerialize["notification_handles"] = o.NotificationHandles - } - if o.Resolved.IsSet() { - toSerialize["resolved"] = o.Resolved.Get() - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` - CustomerImpactScope *string `json:"customer_impact_scope,omitempty"` - CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` - CustomerImpacted *bool `json:"customer_impacted,omitempty"` - Detected common.NullableTime `json:"detected,omitempty"` - Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` - NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` - Resolved common.NullableTime `json:"resolved,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomerImpactEnd = all.CustomerImpactEnd - o.CustomerImpactScope = all.CustomerImpactScope - o.CustomerImpactStart = all.CustomerImpactStart - o.CustomerImpacted = all.CustomerImpacted - o.Detected = all.Detected - o.Fields = all.Fields - o.NotificationHandles = all.NotificationHandles - o.Resolved = all.Resolved - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_incident_update_data.go b/api/v2/datadog/model_incident_update_data.go deleted file mode 100644 index 7f75861989f..00000000000 --- a/api/v2/datadog/model_incident_update_data.go +++ /dev/null @@ -1,238 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentUpdateData Incident data for an update request. -type IncidentUpdateData struct { - // The incident's attributes for an update request. - Attributes *IncidentUpdateAttributes `json:"attributes,omitempty"` - // The team's ID. - Id string `json:"id"` - // The incident's relationships for an update request. - Relationships *IncidentUpdateRelationships `json:"relationships,omitempty"` - // Incident resource type. - Type IncidentType `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{} -} - -// NewIncidentUpdateData instantiates a new IncidentUpdateData 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 NewIncidentUpdateData(id string, typeVar IncidentType) *IncidentUpdateData { - this := IncidentUpdateData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewIncidentUpdateDataWithDefaults instantiates a new IncidentUpdateData 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 NewIncidentUpdateDataWithDefaults() *IncidentUpdateData { - this := IncidentUpdateData{} - var typeVar IncidentType = INCIDENTTYPE_INCIDENTS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *IncidentUpdateData) GetAttributes() IncidentUpdateAttributes { - if o == nil || o.Attributes == nil { - var ret IncidentUpdateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateData) GetAttributesOk() (*IncidentUpdateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *IncidentUpdateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given IncidentUpdateAttributes and assigns it to the Attributes field. -func (o *IncidentUpdateData) SetAttributes(v IncidentUpdateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *IncidentUpdateData) 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 *IncidentUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *IncidentUpdateData) SetId(v string) { - o.Id = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *IncidentUpdateData) GetRelationships() IncidentUpdateRelationships { - if o == nil || o.Relationships == nil { - var ret IncidentUpdateRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateData) GetRelationshipsOk() (*IncidentUpdateRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *IncidentUpdateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given IncidentUpdateRelationships and assigns it to the Relationships field. -func (o *IncidentUpdateData) SetRelationships(v IncidentUpdateRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *IncidentUpdateData) GetType() IncidentType { - if o == nil { - var ret IncidentType - 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 *IncidentUpdateData) GetTypeOk() (*IncidentType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentUpdateData) SetType(v IncidentType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentType `json:"type"` - }{} - all := struct { - Attributes *IncidentUpdateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Relationships *IncidentUpdateRelationships `json:"relationships,omitempty"` - Type IncidentType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_incident_update_relationships.go b/api/v2/datadog/model_incident_update_relationships.go deleted file mode 100644 index e4a350f21b4..00000000000 --- a/api/v2/datadog/model_incident_update_relationships.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IncidentUpdateRelationships The incident's relationships for an update request. -type IncidentUpdateRelationships struct { - // Relationship to user. - CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` - // A relationship reference for multiple integration metadata objects. - Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` - // A relationship reference for postmortems. - Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,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{} -} - -// NewIncidentUpdateRelationships instantiates a new IncidentUpdateRelationships 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 NewIncidentUpdateRelationships() *IncidentUpdateRelationships { - this := IncidentUpdateRelationships{} - return &this -} - -// NewIncidentUpdateRelationshipsWithDefaults instantiates a new IncidentUpdateRelationships 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 NewIncidentUpdateRelationshipsWithDefaults() *IncidentUpdateRelationships { - this := IncidentUpdateRelationships{} - return &this -} - -// GetCommanderUser returns the CommanderUser field value if set, zero value otherwise. -func (o *IncidentUpdateRelationships) GetCommanderUser() NullableRelationshipToUser { - if o == nil || o.CommanderUser == nil { - var ret NullableRelationshipToUser - return ret - } - return *o.CommanderUser -} - -// GetCommanderUserOk returns a tuple with the CommanderUser field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateRelationships) GetCommanderUserOk() (*NullableRelationshipToUser, bool) { - if o == nil || o.CommanderUser == nil { - return nil, false - } - return o.CommanderUser, true -} - -// HasCommanderUser returns a boolean if a field has been set. -func (o *IncidentUpdateRelationships) HasCommanderUser() bool { - if o != nil && o.CommanderUser != nil { - return true - } - - return false -} - -// SetCommanderUser gets a reference to the given NullableRelationshipToUser and assigns it to the CommanderUser field. -func (o *IncidentUpdateRelationships) SetCommanderUser(v NullableRelationshipToUser) { - o.CommanderUser = &v -} - -// GetIntegrations returns the Integrations field value if set, zero value otherwise. -func (o *IncidentUpdateRelationships) GetIntegrations() RelationshipToIncidentIntegrationMetadatas { - if o == nil || o.Integrations == nil { - var ret RelationshipToIncidentIntegrationMetadatas - return ret - } - return *o.Integrations -} - -// GetIntegrationsOk returns a tuple with the Integrations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateRelationships) GetIntegrationsOk() (*RelationshipToIncidentIntegrationMetadatas, bool) { - if o == nil || o.Integrations == nil { - return nil, false - } - return o.Integrations, true -} - -// HasIntegrations returns a boolean if a field has been set. -func (o *IncidentUpdateRelationships) HasIntegrations() bool { - if o != nil && o.Integrations != nil { - return true - } - - return false -} - -// SetIntegrations gets a reference to the given RelationshipToIncidentIntegrationMetadatas and assigns it to the Integrations field. -func (o *IncidentUpdateRelationships) SetIntegrations(v RelationshipToIncidentIntegrationMetadatas) { - o.Integrations = &v -} - -// GetPostmortem returns the Postmortem field value if set, zero value otherwise. -func (o *IncidentUpdateRelationships) GetPostmortem() RelationshipToIncidentPostmortem { - if o == nil || o.Postmortem == nil { - var ret RelationshipToIncidentPostmortem - return ret - } - return *o.Postmortem -} - -// GetPostmortemOk returns a tuple with the Postmortem field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentUpdateRelationships) GetPostmortemOk() (*RelationshipToIncidentPostmortem, bool) { - if o == nil || o.Postmortem == nil { - return nil, false - } - return o.Postmortem, true -} - -// HasPostmortem returns a boolean if a field has been set. -func (o *IncidentUpdateRelationships) HasPostmortem() bool { - if o != nil && o.Postmortem != nil { - return true - } - - return false -} - -// SetPostmortem gets a reference to the given RelationshipToIncidentPostmortem and assigns it to the Postmortem field. -func (o *IncidentUpdateRelationships) SetPostmortem(v RelationshipToIncidentPostmortem) { - o.Postmortem = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentUpdateRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CommanderUser != nil { - toSerialize["commander_user"] = o.CommanderUser - } - if o.Integrations != nil { - toSerialize["integrations"] = o.Integrations - } - if o.Postmortem != nil { - toSerialize["postmortem"] = o.Postmortem - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` - Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` - Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.CommanderUser != nil && all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.CommanderUser = all.CommanderUser - if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Integrations = all.Integrations - if all.Postmortem != nil && all.Postmortem.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Postmortem = all.Postmortem - return nil -} diff --git a/api/v2/datadog/model_incident_update_request.go b/api/v2/datadog/model_incident_update_request.go deleted file mode 100644 index a6153c222fc..00000000000 --- a/api/v2/datadog/model_incident_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentUpdateRequest Update request for an incident. -type IncidentUpdateRequest struct { - // Incident data for an update request. - Data IncidentUpdateData `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{} -} - -// NewIncidentUpdateRequest instantiates a new IncidentUpdateRequest 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 NewIncidentUpdateRequest(data IncidentUpdateData) *IncidentUpdateRequest { - this := IncidentUpdateRequest{} - this.Data = data - return &this -} - -// NewIncidentUpdateRequestWithDefaults instantiates a new IncidentUpdateRequest 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 NewIncidentUpdateRequestWithDefaults() *IncidentUpdateRequest { - this := IncidentUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentUpdateRequest) GetData() IncidentUpdateData { - if o == nil { - var ret IncidentUpdateData - 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 *IncidentUpdateRequest) GetDataOk() (*IncidentUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentUpdateRequest) SetData(v IncidentUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *IncidentUpdateData `json:"data"` - }{} - all := struct { - Data IncidentUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_incidents_response.go b/api/v2/datadog/model_incidents_response.go deleted file mode 100644 index 46beae8a4fb..00000000000 --- a/api/v2/datadog/model_incidents_response.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// IncidentsResponse Response with a list of incidents. -type IncidentsResponse struct { - // An array of incidents. - Data []IncidentResponseData `json:"data"` - // Included related resources that the user requested. - Included []IncidentResponseIncludedItem `json:"included,omitempty"` - // The metadata object containing pagination metadata. - Meta *IncidentResponseMeta `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{} -} - -// NewIncidentsResponse instantiates a new IncidentsResponse 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 NewIncidentsResponse(data []IncidentResponseData) *IncidentsResponse { - this := IncidentsResponse{} - this.Data = data - return &this -} - -// NewIncidentsResponseWithDefaults instantiates a new IncidentsResponse 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 NewIncidentsResponseWithDefaults() *IncidentsResponse { - this := IncidentsResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *IncidentsResponse) GetData() []IncidentResponseData { - if o == nil { - var ret []IncidentResponseData - 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 *IncidentsResponse) GetDataOk() (*[]IncidentResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *IncidentsResponse) SetData(v []IncidentResponseData) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *IncidentsResponse) GetIncluded() []IncidentResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []IncidentResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IncidentsResponse) GetIncludedOk() (*[]IncidentResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *IncidentsResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []IncidentResponseIncludedItem and assigns it to the Included field. -func (o *IncidentsResponse) SetIncluded(v []IncidentResponseIncludedItem) { - o.Included = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *IncidentsResponse) GetMeta() IncidentResponseMeta { - if o == nil || o.Meta == nil { - var ret IncidentResponseMeta - 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 *IncidentsResponse) GetMetaOk() (*IncidentResponseMeta, 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 *IncidentsResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given IncidentResponseMeta and assigns it to the Meta field. -func (o *IncidentsResponse) SetMeta(v IncidentResponseMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - if o.Included != nil { - toSerialize["included"] = o.Included - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IncidentsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]IncidentResponseData `json:"data"` - }{} - all := struct { - Data []IncidentResponseData `json:"data"` - Included []IncidentResponseIncludedItem `json:"included,omitempty"` - Meta *IncidentResponseMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Included = all.Included - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_intake_payload_accepted.go b/api/v2/datadog/model_intake_payload_accepted.go deleted file mode 100644 index 38ac06e6d75..00000000000 --- a/api/v2/datadog/model_intake_payload_accepted.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// IntakePayloadAccepted The payload accepted for intake. -type IntakePayloadAccepted struct { - // A list of errors. - Errors []string `json:"errors,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{} -} - -// NewIntakePayloadAccepted instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAccepted() *IntakePayloadAccepted { - this := IntakePayloadAccepted{} - return &this -} - -// NewIntakePayloadAcceptedWithDefaults instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAcceptedWithDefaults() *IntakePayloadAccepted { - this := IntakePayloadAccepted{} - return &this -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *IntakePayloadAccepted) GetErrors() []string { - if o == nil || o.Errors == nil { - var ret []string - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IntakePayloadAccepted) GetErrorsOk() (*[]string, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return &o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *IntakePayloadAccepted) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []string and assigns it to the Errors field. -func (o *IntakePayloadAccepted) SetErrors(v []string) { - o.Errors = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IntakePayloadAccepted) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Errors []string `json:"errors,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Errors = all.Errors - return nil -} diff --git a/api/v2/datadog/model_list_application_keys_response.go b/api/v2/datadog/model_list_application_keys_response.go deleted file mode 100644 index e2fb294e705..00000000000 --- a/api/v2/datadog/model_list_application_keys_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ListApplicationKeysResponse Response for a list of application keys. -type ListApplicationKeysResponse struct { - // Array of application keys. - Data []PartialApplicationKey `json:"data,omitempty"` - // Array of objects related to the application key. - Included []ApplicationKeyResponseIncludedItem `json:"included,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{} -} - -// NewListApplicationKeysResponse instantiates a new ListApplicationKeysResponse 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 NewListApplicationKeysResponse() *ListApplicationKeysResponse { - this := ListApplicationKeysResponse{} - return &this -} - -// NewListApplicationKeysResponseWithDefaults instantiates a new ListApplicationKeysResponse 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 NewListApplicationKeysResponseWithDefaults() *ListApplicationKeysResponse { - this := ListApplicationKeysResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *ListApplicationKeysResponse) GetData() []PartialApplicationKey { - if o == nil || o.Data == nil { - var ret []PartialApplicationKey - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListApplicationKeysResponse) GetDataOk() (*[]PartialApplicationKey, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *ListApplicationKeysResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []PartialApplicationKey and assigns it to the Data field. -func (o *ListApplicationKeysResponse) SetData(v []PartialApplicationKey) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *ListApplicationKeysResponse) GetIncluded() []ApplicationKeyResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []ApplicationKeyResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListApplicationKeysResponse) GetIncludedOk() (*[]ApplicationKeyResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *ListApplicationKeysResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []ApplicationKeyResponseIncludedItem and assigns it to the Included field. -func (o *ListApplicationKeysResponse) SetIncluded(v []ApplicationKeyResponseIncludedItem) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ListApplicationKeysResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ListApplicationKeysResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []PartialApplicationKey `json:"data,omitempty"` - Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_log.go b/api/v2/datadog/model_log.go deleted file mode 100644 index 26aa94093cf..00000000000 --- a/api/v2/datadog/model_log.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Log Object description of a log after being processed and stored by Datadog. -type Log struct { - // JSON object containing all log attributes and their associated values. - Attributes *LogAttributes `json:"attributes,omitempty"` - // Unique ID of the Log. - Id *string `json:"id,omitempty"` - // Type of the event. - Type *LogType `json:"type,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{} -} - -// NewLog instantiates a new Log 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 NewLog() *Log { - this := Log{} - var typeVar LogType = LOGTYPE_LOG - this.Type = &typeVar - return &this -} - -// NewLogWithDefaults instantiates a new Log 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 NewLogWithDefaults() *Log { - this := Log{} - var typeVar LogType = LOGTYPE_LOG - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *Log) GetAttributes() LogAttributes { - if o == nil || o.Attributes == nil { - var ret LogAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Log) GetAttributesOk() (*LogAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *Log) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given LogAttributes and assigns it to the Attributes field. -func (o *Log) SetAttributes(v LogAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Log) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Log) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Log) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Log) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *Log) GetType() LogType { - if o == nil || o.Type == nil { - var ret LogType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Log) GetTypeOk() (*LogType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *Log) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given LogType and assigns it to the Type field. -func (o *Log) SetType(v LogType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Log) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Log) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *LogAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *LogType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_log_attributes.go b/api/v2/datadog/model_log_attributes.go deleted file mode 100644 index edda111d5b3..00000000000 --- a/api/v2/datadog/model_log_attributes.go +++ /dev/null @@ -1,345 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// LogAttributes JSON object containing all log attributes and their associated values. -type LogAttributes struct { - // JSON object of attributes from your log. - Attributes map[string]interface{} `json:"attributes,omitempty"` - // Name of the machine from where the logs are being sent. - Host *string `json:"host,omitempty"` - // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) - // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. - // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. - Message *string `json:"message,omitempty"` - // The name of the application or service generating the log events. - // It is used to switch from Logs to APM, so make sure you define the same - // value when you use both products. - Service *string `json:"service,omitempty"` - // Status of the message associated with your log. - Status *string `json:"status,omitempty"` - // Array of tags associated with your log. - Tags []string `json:"tags,omitempty"` - // Timestamp of your log. - Timestamp *time.Time `json:"timestamp,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{} -} - -// NewLogAttributes instantiates a new LogAttributes 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 NewLogAttributes() *LogAttributes { - this := LogAttributes{} - return &this -} - -// NewLogAttributesWithDefaults instantiates a new LogAttributes 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 NewLogAttributesWithDefaults() *LogAttributes { - this := LogAttributes{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *LogAttributes) GetAttributes() map[string]interface{} { - if o == nil || o.Attributes == nil { - var ret map[string]interface{} - return ret - } - return o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogAttributes) GetAttributesOk() (*map[string]interface{}, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return &o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *LogAttributes) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. -func (o *LogAttributes) SetAttributes(v map[string]interface{}) { - o.Attributes = v -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *LogAttributes) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogAttributes) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *LogAttributes) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *LogAttributes) SetHost(v string) { - o.Host = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *LogAttributes) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogAttributes) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *LogAttributes) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *LogAttributes) SetMessage(v string) { - o.Message = &v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *LogAttributes) 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 *LogAttributes) 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 *LogAttributes) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *LogAttributes) SetService(v string) { - o.Service = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *LogAttributes) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogAttributes) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *LogAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *LogAttributes) SetStatus(v string) { - o.Status = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *LogAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *LogAttributes) GetTagsOk() (*[]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 *LogAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *LogAttributes) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *LogAttributes) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogAttributes) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *LogAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *LogAttributes) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Service != nil { - toSerialize["service"] = o.Service - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes map[string]interface{} `json:"attributes,omitempty"` - Host *string `json:"host,omitempty"` - Message *string `json:"message,omitempty"` - Service *string `json:"service,omitempty"` - Status *string `json:"status,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Host = all.Host - o.Message = all.Message - o.Service = all.Service - o.Status = all.Status - o.Tags = all.Tags - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v2/datadog/model_log_type.go b/api/v2/datadog/model_log_type.go deleted file mode 100644 index c5033ed890f..00000000000 --- a/api/v2/datadog/model_log_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogType Type of the event. -type LogType string - -// List of LogType. -const ( - LOGTYPE_LOG LogType = "log" -) - -var allowedLogTypeEnumValues = []LogType{ - LOGTYPE_LOG, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogType) GetAllowedValues() []LogType { - return allowedLogTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogType(value) - return nil -} - -// NewLogTypeFromValue returns a pointer to a valid LogType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogTypeFromValue(v string) (*LogType, error) { - ev := LogType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogType: valid values are %v", v, allowedLogTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogType) IsValid() bool { - for _, existing := range allowedLogTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogType value. -func (v LogType) Ptr() *LogType { - return &v -} - -// NullableLogType handles when a null is used for LogType. -type NullableLogType struct { - value *LogType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogType) Get() *LogType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogType) Set(val *LogType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogType initializes the struct as if Set has been called. -func NewNullableLogType(val *LogType) *NullableLogType { - return &NullableLogType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_aggregate_bucket.go b/api/v2/datadog/model_logs_aggregate_bucket.go deleted file mode 100644 index 0f5706aaa35..00000000000 --- a/api/v2/datadog/model_logs_aggregate_bucket.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateBucket A bucket values -type LogsAggregateBucket struct { - // The key, value pairs for each group by - By map[string]string `json:"by,omitempty"` - // A map of the metric name -> value for regular compute or list of values for a timeseries - Computes map[string]LogsAggregateBucketValue `json:"computes,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{} -} - -// NewLogsAggregateBucket instantiates a new LogsAggregateBucket 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 NewLogsAggregateBucket() *LogsAggregateBucket { - this := LogsAggregateBucket{} - return &this -} - -// NewLogsAggregateBucketWithDefaults instantiates a new LogsAggregateBucket 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 NewLogsAggregateBucketWithDefaults() *LogsAggregateBucket { - this := LogsAggregateBucket{} - return &this -} - -// GetBy returns the By field value if set, zero value otherwise. -func (o *LogsAggregateBucket) GetBy() map[string]string { - if o == nil || o.By == nil { - var ret map[string]string - return ret - } - return o.By -} - -// GetByOk returns a tuple with the By field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateBucket) GetByOk() (*map[string]string, bool) { - if o == nil || o.By == nil { - return nil, false - } - return &o.By, true -} - -// HasBy returns a boolean if a field has been set. -func (o *LogsAggregateBucket) HasBy() bool { - if o != nil && o.By != nil { - return true - } - - return false -} - -// SetBy gets a reference to the given map[string]string and assigns it to the By field. -func (o *LogsAggregateBucket) SetBy(v map[string]string) { - o.By = v -} - -// GetComputes returns the Computes field value if set, zero value otherwise. -func (o *LogsAggregateBucket) GetComputes() map[string]LogsAggregateBucketValue { - if o == nil || o.Computes == nil { - var ret map[string]LogsAggregateBucketValue - return ret - } - return o.Computes -} - -// GetComputesOk returns a tuple with the Computes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateBucket) GetComputesOk() (*map[string]LogsAggregateBucketValue, bool) { - if o == nil || o.Computes == nil { - return nil, false - } - return &o.Computes, true -} - -// HasComputes returns a boolean if a field has been set. -func (o *LogsAggregateBucket) HasComputes() bool { - if o != nil && o.Computes != nil { - return true - } - - return false -} - -// SetComputes gets a reference to the given map[string]LogsAggregateBucketValue and assigns it to the Computes field. -func (o *LogsAggregateBucket) SetComputes(v map[string]LogsAggregateBucketValue) { - o.Computes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateBucket) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.By != nil { - toSerialize["by"] = o.By - } - if o.Computes != nil { - toSerialize["computes"] = o.Computes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateBucket) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - By map[string]string `json:"by,omitempty"` - Computes map[string]LogsAggregateBucketValue `json:"computes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.By = all.By - o.Computes = all.Computes - return nil -} diff --git a/api/v2/datadog/model_logs_aggregate_bucket_value.go b/api/v2/datadog/model_logs_aggregate_bucket_value.go deleted file mode 100644 index e25bd57f126..00000000000 --- a/api/v2/datadog/model_logs_aggregate_bucket_value.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateBucketValue - A bucket value, can be either a timeseries or a single value -type LogsAggregateBucketValue struct { - LogsAggregateBucketValueSingleString *string - LogsAggregateBucketValueSingleNumber *float64 - LogsAggregateBucketValueTimeseries *LogsAggregateBucketValueTimeseries - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// LogsAggregateBucketValueSingleStringAsLogsAggregateBucketValue is a convenience function that returns string wrapped in LogsAggregateBucketValue. -func LogsAggregateBucketValueSingleStringAsLogsAggregateBucketValue(v *string) LogsAggregateBucketValue { - return LogsAggregateBucketValue{LogsAggregateBucketValueSingleString: v} -} - -// LogsAggregateBucketValueSingleNumberAsLogsAggregateBucketValue is a convenience function that returns float64 wrapped in LogsAggregateBucketValue. -func LogsAggregateBucketValueSingleNumberAsLogsAggregateBucketValue(v *float64) LogsAggregateBucketValue { - return LogsAggregateBucketValue{LogsAggregateBucketValueSingleNumber: v} -} - -// LogsAggregateBucketValueTimeseriesAsLogsAggregateBucketValue is a convenience function that returns LogsAggregateBucketValueTimeseries wrapped in LogsAggregateBucketValue. -func LogsAggregateBucketValueTimeseriesAsLogsAggregateBucketValue(v *LogsAggregateBucketValueTimeseries) LogsAggregateBucketValue { - return LogsAggregateBucketValue{LogsAggregateBucketValueTimeseries: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *LogsAggregateBucketValue) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into LogsAggregateBucketValueSingleString - err = json.Unmarshal(data, &obj.LogsAggregateBucketValueSingleString) - if err == nil { - if obj.LogsAggregateBucketValueSingleString != nil { - jsonLogsAggregateBucketValueSingleString, _ := json.Marshal(obj.LogsAggregateBucketValueSingleString) - if string(jsonLogsAggregateBucketValueSingleString) == "{}" { // empty struct - obj.LogsAggregateBucketValueSingleString = nil - } else { - match++ - } - } else { - obj.LogsAggregateBucketValueSingleString = nil - } - } else { - obj.LogsAggregateBucketValueSingleString = nil - } - - // try to unmarshal data into LogsAggregateBucketValueSingleNumber - err = json.Unmarshal(data, &obj.LogsAggregateBucketValueSingleNumber) - if err == nil { - if obj.LogsAggregateBucketValueSingleNumber != nil { - jsonLogsAggregateBucketValueSingleNumber, _ := json.Marshal(obj.LogsAggregateBucketValueSingleNumber) - if string(jsonLogsAggregateBucketValueSingleNumber) == "{}" { // empty struct - obj.LogsAggregateBucketValueSingleNumber = nil - } else { - match++ - } - } else { - obj.LogsAggregateBucketValueSingleNumber = nil - } - } else { - obj.LogsAggregateBucketValueSingleNumber = nil - } - - // try to unmarshal data into LogsAggregateBucketValueTimeseries - err = json.Unmarshal(data, &obj.LogsAggregateBucketValueTimeseries) - if err == nil { - if obj.LogsAggregateBucketValueTimeseries != nil { - jsonLogsAggregateBucketValueTimeseries, _ := json.Marshal(obj.LogsAggregateBucketValueTimeseries) - if string(jsonLogsAggregateBucketValueTimeseries) == "{}" { // empty struct - obj.LogsAggregateBucketValueTimeseries = nil - } else { - match++ - } - } else { - obj.LogsAggregateBucketValueTimeseries = nil - } - } else { - obj.LogsAggregateBucketValueTimeseries = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.LogsAggregateBucketValueSingleString = nil - obj.LogsAggregateBucketValueSingleNumber = nil - obj.LogsAggregateBucketValueTimeseries = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj LogsAggregateBucketValue) MarshalJSON() ([]byte, error) { - if obj.LogsAggregateBucketValueSingleString != nil { - return json.Marshal(&obj.LogsAggregateBucketValueSingleString) - } - - if obj.LogsAggregateBucketValueSingleNumber != nil { - return json.Marshal(&obj.LogsAggregateBucketValueSingleNumber) - } - - if obj.LogsAggregateBucketValueTimeseries != nil { - return json.Marshal(&obj.LogsAggregateBucketValueTimeseries) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *LogsAggregateBucketValue) GetActualInstance() interface{} { - if obj.LogsAggregateBucketValueSingleString != nil { - return obj.LogsAggregateBucketValueSingleString - } - - if obj.LogsAggregateBucketValueSingleNumber != nil { - return obj.LogsAggregateBucketValueSingleNumber - } - - if obj.LogsAggregateBucketValueTimeseries != nil { - return obj.LogsAggregateBucketValueTimeseries - } - - // all schemas are nil - return nil -} - -// NullableLogsAggregateBucketValue handles when a null is used for LogsAggregateBucketValue. -type NullableLogsAggregateBucketValue struct { - value *LogsAggregateBucketValue - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregateBucketValue) Get() *LogsAggregateBucketValue { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregateBucketValue) Set(val *LogsAggregateBucketValue) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregateBucketValue) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsAggregateBucketValue) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregateBucketValue initializes the struct as if Set has been called. -func NewNullableLogsAggregateBucketValue(val *LogsAggregateBucketValue) *NullableLogsAggregateBucketValue { - return &NullableLogsAggregateBucketValue{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregateBucketValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregateBucketValue) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go b/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go deleted file mode 100644 index a81b67f1d16..00000000000 --- a/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go +++ /dev/null @@ -1,51 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateBucketValueTimeseries A timeseries array -type LogsAggregateBucketValueTimeseries struct { - Items []LogsAggregateBucketValueTimeseriesPoint - - // UnparsedObject contains the raw value of the array if there was an error when deserializing into the struct - UnparsedObject []interface{} `json:-` -} - -// NewLogsAggregateBucketValueTimeseries instantiates a new LogsAggregateBucketValueTimeseries 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 NewLogsAggregateBucketValueTimeseries() *LogsAggregateBucketValueTimeseries { - this := LogsAggregateBucketValueTimeseries{} - return &this -} - -// NewLogsAggregateBucketValueTimeseriesWithDefaults instantiates a new LogsAggregateBucketValueTimeseries 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 NewLogsAggregateBucketValueTimeseriesWithDefaults() *LogsAggregateBucketValueTimeseries { - this := LogsAggregateBucketValueTimeseries{} - return &this -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { - toSerialize := make([]interface{}, len(o.Items)) - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - for i, item := range o.Items { - toSerialize[i] = item - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { - return json.Unmarshal(bytes, &o.Items) -} diff --git a/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go b/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go deleted file mode 100644 index 4fa5450c2de..00000000000 --- a/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateBucketValueTimeseriesPoint A timeseries point -type LogsAggregateBucketValueTimeseriesPoint struct { - // The time value for this point - Time *string `json:"time,omitempty"` - // The value for this point - Value *float64 `json:"value,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{} -} - -// NewLogsAggregateBucketValueTimeseriesPoint instantiates a new LogsAggregateBucketValueTimeseriesPoint 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 NewLogsAggregateBucketValueTimeseriesPoint() *LogsAggregateBucketValueTimeseriesPoint { - this := LogsAggregateBucketValueTimeseriesPoint{} - return &this -} - -// NewLogsAggregateBucketValueTimeseriesPointWithDefaults instantiates a new LogsAggregateBucketValueTimeseriesPoint 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 NewLogsAggregateBucketValueTimeseriesPointWithDefaults() *LogsAggregateBucketValueTimeseriesPoint { - this := LogsAggregateBucketValueTimeseriesPoint{} - return &this -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *LogsAggregateBucketValueTimeseriesPoint) GetTime() string { - if o == nil || o.Time == nil { - var ret string - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateBucketValueTimeseriesPoint) GetTimeOk() (*string, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *LogsAggregateBucketValueTimeseriesPoint) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given string and assigns it to the Time field. -func (o *LogsAggregateBucketValueTimeseriesPoint) SetTime(v string) { - o.Time = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *LogsAggregateBucketValueTimeseriesPoint) GetValue() float64 { - if o == nil || o.Value == nil { - var ret float64 - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateBucketValueTimeseriesPoint) GetValueOk() (*float64, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *LogsAggregateBucketValueTimeseriesPoint) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given float64 and assigns it to the Value field. -func (o *LogsAggregateBucketValueTimeseriesPoint) SetValue(v float64) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Time != nil { - toSerialize["time"] = o.Time - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Time *string `json:"time,omitempty"` - Value *float64 `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Time = all.Time - o.Value = all.Value - return nil -} diff --git a/api/v2/datadog/model_logs_aggregate_request.go b/api/v2/datadog/model_logs_aggregate_request.go deleted file mode 100644 index 88fb087efc2..00000000000 --- a/api/v2/datadog/model_logs_aggregate_request.go +++ /dev/null @@ -1,280 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateRequest The object sent with the request to retrieve a list of logs from your organization. -type LogsAggregateRequest struct { - // The list of metrics or timeseries to compute for the retrieved buckets. - Compute []LogsCompute `json:"compute,omitempty"` - // The search and filter query settings - Filter *LogsQueryFilter `json:"filter,omitempty"` - // The rules for the group by - GroupBy []LogsGroupBy `json:"group_by,omitempty"` - // Global query options that are used during the query. - // Note: You should only supply timezone or time offset but not both otherwise the query will fail. - Options *LogsQueryOptions `json:"options,omitempty"` - // Paging settings - Page *LogsAggregateRequestPage `json:"page,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{} -} - -// NewLogsAggregateRequest instantiates a new LogsAggregateRequest 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 NewLogsAggregateRequest() *LogsAggregateRequest { - this := LogsAggregateRequest{} - return &this -} - -// NewLogsAggregateRequestWithDefaults instantiates a new LogsAggregateRequest 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 NewLogsAggregateRequestWithDefaults() *LogsAggregateRequest { - this := LogsAggregateRequest{} - return &this -} - -// GetCompute returns the Compute field value if set, zero value otherwise. -func (o *LogsAggregateRequest) GetCompute() []LogsCompute { - if o == nil || o.Compute == nil { - var ret []LogsCompute - return ret - } - return o.Compute -} - -// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateRequest) GetComputeOk() (*[]LogsCompute, bool) { - if o == nil || o.Compute == nil { - return nil, false - } - return &o.Compute, true -} - -// HasCompute returns a boolean if a field has been set. -func (o *LogsAggregateRequest) HasCompute() bool { - if o != nil && o.Compute != nil { - return true - } - - return false -} - -// SetCompute gets a reference to the given []LogsCompute and assigns it to the Compute field. -func (o *LogsAggregateRequest) SetCompute(v []LogsCompute) { - o.Compute = v -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsAggregateRequest) GetFilter() LogsQueryFilter { - if o == nil || o.Filter == nil { - var ret LogsQueryFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateRequest) GetFilterOk() (*LogsQueryFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsAggregateRequest) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsQueryFilter and assigns it to the Filter field. -func (o *LogsAggregateRequest) SetFilter(v LogsQueryFilter) { - o.Filter = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *LogsAggregateRequest) GetGroupBy() []LogsGroupBy { - if o == nil || o.GroupBy == nil { - var ret []LogsGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateRequest) GetGroupByOk() (*[]LogsGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *LogsAggregateRequest) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []LogsGroupBy and assigns it to the GroupBy field. -func (o *LogsAggregateRequest) SetGroupBy(v []LogsGroupBy) { - o.GroupBy = v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *LogsAggregateRequest) GetOptions() LogsQueryOptions { - if o == nil || o.Options == nil { - var ret LogsQueryOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateRequest) GetOptionsOk() (*LogsQueryOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *LogsAggregateRequest) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given LogsQueryOptions and assigns it to the Options field. -func (o *LogsAggregateRequest) SetOptions(v LogsQueryOptions) { - o.Options = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *LogsAggregateRequest) GetPage() LogsAggregateRequestPage { - if o == nil || o.Page == nil { - var ret LogsAggregateRequestPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateRequest) GetPageOk() (*LogsAggregateRequestPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *LogsAggregateRequest) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given LogsAggregateRequestPage and assigns it to the Page field. -func (o *LogsAggregateRequest) SetPage(v LogsAggregateRequestPage) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Compute != nil { - toSerialize["compute"] = o.Compute - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Compute []LogsCompute `json:"compute,omitempty"` - Filter *LogsQueryFilter `json:"filter,omitempty"` - GroupBy []LogsGroupBy `json:"group_by,omitempty"` - Options *LogsQueryOptions `json:"options,omitempty"` - Page *LogsAggregateRequestPage `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Compute = all.Compute - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.GroupBy = all.GroupBy - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v2/datadog/model_logs_aggregate_request_page.go b/api/v2/datadog/model_logs_aggregate_request_page.go deleted file mode 100644 index babf5dc3535..00000000000 --- a/api/v2/datadog/model_logs_aggregate_request_page.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateRequestPage Paging settings -type LogsAggregateRequestPage struct { - // The returned paging point to use to get the next results - Cursor *string `json:"cursor,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{} -} - -// NewLogsAggregateRequestPage instantiates a new LogsAggregateRequestPage 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 NewLogsAggregateRequestPage() *LogsAggregateRequestPage { - this := LogsAggregateRequestPage{} - return &this -} - -// NewLogsAggregateRequestPageWithDefaults instantiates a new LogsAggregateRequestPage 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 NewLogsAggregateRequestPageWithDefaults() *LogsAggregateRequestPage { - this := LogsAggregateRequestPage{} - return &this -} - -// GetCursor returns the Cursor field value if set, zero value otherwise. -func (o *LogsAggregateRequestPage) GetCursor() string { - if o == nil || o.Cursor == nil { - var ret string - return ret - } - return *o.Cursor -} - -// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateRequestPage) GetCursorOk() (*string, bool) { - if o == nil || o.Cursor == nil { - return nil, false - } - return o.Cursor, true -} - -// HasCursor returns a boolean if a field has been set. -func (o *LogsAggregateRequestPage) HasCursor() bool { - if o != nil && o.Cursor != nil { - return true - } - - return false -} - -// SetCursor gets a reference to the given string and assigns it to the Cursor field. -func (o *LogsAggregateRequestPage) SetCursor(v string) { - o.Cursor = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateRequestPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cursor != nil { - toSerialize["cursor"] = o.Cursor - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cursor *string `json:"cursor,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cursor = all.Cursor - return nil -} diff --git a/api/v2/datadog/model_logs_aggregate_response.go b/api/v2/datadog/model_logs_aggregate_response.go deleted file mode 100644 index 53b005d7b4a..00000000000 --- a/api/v2/datadog/model_logs_aggregate_response.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateResponse The response object for the logs aggregate API endpoint -type LogsAggregateResponse struct { - // The query results - Data *LogsAggregateResponseData `json:"data,omitempty"` - // The metadata associated with a request - Meta *LogsResponseMetadata `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{} -} - -// NewLogsAggregateResponse instantiates a new LogsAggregateResponse 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 NewLogsAggregateResponse() *LogsAggregateResponse { - this := LogsAggregateResponse{} - return &this -} - -// NewLogsAggregateResponseWithDefaults instantiates a new LogsAggregateResponse 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 NewLogsAggregateResponseWithDefaults() *LogsAggregateResponse { - this := LogsAggregateResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsAggregateResponse) GetData() LogsAggregateResponseData { - if o == nil || o.Data == nil { - var ret LogsAggregateResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateResponse) GetDataOk() (*LogsAggregateResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsAggregateResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given LogsAggregateResponseData and assigns it to the Data field. -func (o *LogsAggregateResponse) SetData(v LogsAggregateResponseData) { - o.Data = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *LogsAggregateResponse) GetMeta() LogsResponseMetadata { - if o == nil || o.Meta == nil { - var ret LogsResponseMetadata - 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 *LogsAggregateResponse) GetMetaOk() (*LogsResponseMetadata, 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 *LogsAggregateResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given LogsResponseMetadata and assigns it to the Meta field. -func (o *LogsAggregateResponse) SetMeta(v LogsResponseMetadata) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *LogsAggregateResponseData `json:"data,omitempty"` - Meta *LogsResponseMetadata `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_logs_aggregate_response_data.go b/api/v2/datadog/model_logs_aggregate_response_data.go deleted file mode 100644 index 2faf0815cd1..00000000000 --- a/api/v2/datadog/model_logs_aggregate_response_data.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateResponseData The query results -type LogsAggregateResponseData struct { - // The list of matching buckets, one item per bucket - Buckets []LogsAggregateBucket `json:"buckets,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{} -} - -// NewLogsAggregateResponseData instantiates a new LogsAggregateResponseData 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 NewLogsAggregateResponseData() *LogsAggregateResponseData { - this := LogsAggregateResponseData{} - return &this -} - -// NewLogsAggregateResponseDataWithDefaults instantiates a new LogsAggregateResponseData 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 NewLogsAggregateResponseDataWithDefaults() *LogsAggregateResponseData { - this := LogsAggregateResponseData{} - return &this -} - -// GetBuckets returns the Buckets field value if set, zero value otherwise. -func (o *LogsAggregateResponseData) GetBuckets() []LogsAggregateBucket { - if o == nil || o.Buckets == nil { - var ret []LogsAggregateBucket - return ret - } - return o.Buckets -} - -// GetBucketsOk returns a tuple with the Buckets field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateResponseData) GetBucketsOk() (*[]LogsAggregateBucket, bool) { - if o == nil || o.Buckets == nil { - return nil, false - } - return &o.Buckets, true -} - -// HasBuckets returns a boolean if a field has been set. -func (o *LogsAggregateResponseData) HasBuckets() bool { - if o != nil && o.Buckets != nil { - return true - } - - return false -} - -// SetBuckets gets a reference to the given []LogsAggregateBucket and assigns it to the Buckets field. -func (o *LogsAggregateResponseData) SetBuckets(v []LogsAggregateBucket) { - o.Buckets = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Buckets != nil { - toSerialize["buckets"] = o.Buckets - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Buckets []LogsAggregateBucket `json:"buckets,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Buckets = all.Buckets - return nil -} diff --git a/api/v2/datadog/model_logs_aggregate_response_status.go b/api/v2/datadog/model_logs_aggregate_response_status.go deleted file mode 100644 index 8f3e86e7100..00000000000 --- a/api/v2/datadog/model_logs_aggregate_response_status.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsAggregateResponseStatus The status of the response -type LogsAggregateResponseStatus string - -// List of LogsAggregateResponseStatus. -const ( - LOGSAGGREGATERESPONSESTATUS_DONE LogsAggregateResponseStatus = "done" - LOGSAGGREGATERESPONSESTATUS_TIMEOUT LogsAggregateResponseStatus = "timeout" -) - -var allowedLogsAggregateResponseStatusEnumValues = []LogsAggregateResponseStatus{ - LOGSAGGREGATERESPONSESTATUS_DONE, - LOGSAGGREGATERESPONSESTATUS_TIMEOUT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsAggregateResponseStatus) GetAllowedValues() []LogsAggregateResponseStatus { - return allowedLogsAggregateResponseStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsAggregateResponseStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsAggregateResponseStatus(value) - return nil -} - -// NewLogsAggregateResponseStatusFromValue returns a pointer to a valid LogsAggregateResponseStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsAggregateResponseStatusFromValue(v string) (*LogsAggregateResponseStatus, error) { - ev := LogsAggregateResponseStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsAggregateResponseStatus: valid values are %v", v, allowedLogsAggregateResponseStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsAggregateResponseStatus) IsValid() bool { - for _, existing := range allowedLogsAggregateResponseStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsAggregateResponseStatus value. -func (v LogsAggregateResponseStatus) Ptr() *LogsAggregateResponseStatus { - return &v -} - -// NullableLogsAggregateResponseStatus handles when a null is used for LogsAggregateResponseStatus. -type NullableLogsAggregateResponseStatus struct { - value *LogsAggregateResponseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregateResponseStatus) Get() *LogsAggregateResponseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregateResponseStatus) Set(val *LogsAggregateResponseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregateResponseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAggregateResponseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregateResponseStatus initializes the struct as if Set has been called. -func NewNullableLogsAggregateResponseStatus(val *LogsAggregateResponseStatus) *NullableLogsAggregateResponseStatus { - return &NullableLogsAggregateResponseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregateResponseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregateResponseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_aggregate_sort.go b/api/v2/datadog/model_logs_aggregate_sort.go deleted file mode 100644 index a01e8ce63a6..00000000000 --- a/api/v2/datadog/model_logs_aggregate_sort.go +++ /dev/null @@ -1,247 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsAggregateSort A sort rule -type LogsAggregateSort struct { - // An aggregation function - Aggregation *LogsAggregationFunction `json:"aggregation,omitempty"` - // The metric to sort by (only used for `type=measure`) - Metric *string `json:"metric,omitempty"` - // The order to use, ascending or descending - Order *LogsSortOrder `json:"order,omitempty"` - // The type of sorting algorithm - Type *LogsAggregateSortType `json:"type,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{} -} - -// NewLogsAggregateSort instantiates a new LogsAggregateSort 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 NewLogsAggregateSort() *LogsAggregateSort { - this := LogsAggregateSort{} - var typeVar LogsAggregateSortType = LOGSAGGREGATESORTTYPE_ALPHABETICAL - this.Type = &typeVar - return &this -} - -// NewLogsAggregateSortWithDefaults instantiates a new LogsAggregateSort 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 NewLogsAggregateSortWithDefaults() *LogsAggregateSort { - this := LogsAggregateSort{} - var typeVar LogsAggregateSortType = LOGSAGGREGATESORTTYPE_ALPHABETICAL - this.Type = &typeVar - return &this -} - -// GetAggregation returns the Aggregation field value if set, zero value otherwise. -func (o *LogsAggregateSort) GetAggregation() LogsAggregationFunction { - if o == nil || o.Aggregation == nil { - var ret LogsAggregationFunction - return ret - } - return *o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateSort) GetAggregationOk() (*LogsAggregationFunction, bool) { - if o == nil || o.Aggregation == nil { - return nil, false - } - return o.Aggregation, true -} - -// HasAggregation returns a boolean if a field has been set. -func (o *LogsAggregateSort) HasAggregation() bool { - if o != nil && o.Aggregation != nil { - return true - } - - return false -} - -// SetAggregation gets a reference to the given LogsAggregationFunction and assigns it to the Aggregation field. -func (o *LogsAggregateSort) SetAggregation(v LogsAggregationFunction) { - o.Aggregation = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *LogsAggregateSort) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateSort) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *LogsAggregateSort) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *LogsAggregateSort) SetMetric(v string) { - o.Metric = &v -} - -// GetOrder returns the Order field value if set, zero value otherwise. -func (o *LogsAggregateSort) GetOrder() LogsSortOrder { - if o == nil || o.Order == nil { - var ret LogsSortOrder - return ret - } - return *o.Order -} - -// GetOrderOk returns a tuple with the Order field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateSort) GetOrderOk() (*LogsSortOrder, bool) { - if o == nil || o.Order == nil { - return nil, false - } - return o.Order, true -} - -// HasOrder returns a boolean if a field has been set. -func (o *LogsAggregateSort) HasOrder() bool { - if o != nil && o.Order != nil { - return true - } - - return false -} - -// SetOrder gets a reference to the given LogsSortOrder and assigns it to the Order field. -func (o *LogsAggregateSort) SetOrder(v LogsSortOrder) { - o.Order = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *LogsAggregateSort) GetType() LogsAggregateSortType { - if o == nil || o.Type == nil { - var ret LogsAggregateSortType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsAggregateSort) GetTypeOk() (*LogsAggregateSortType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *LogsAggregateSort) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given LogsAggregateSortType and assigns it to the Type field. -func (o *LogsAggregateSort) SetType(v LogsAggregateSortType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsAggregateSort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregation != nil { - toSerialize["aggregation"] = o.Aggregation - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Order != nil { - toSerialize["order"] = o.Order - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsAggregateSort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregation *LogsAggregationFunction `json:"aggregation,omitempty"` - Metric *string `json:"metric,omitempty"` - Order *LogsSortOrder `json:"order,omitempty"` - Type *LogsAggregateSortType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Metric = all.Metric - o.Order = all.Order - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_aggregate_sort_type.go b/api/v2/datadog/model_logs_aggregate_sort_type.go deleted file mode 100644 index 769a96d0602..00000000000 --- a/api/v2/datadog/model_logs_aggregate_sort_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsAggregateSortType The type of sorting algorithm -type LogsAggregateSortType string - -// List of LogsAggregateSortType. -const ( - LOGSAGGREGATESORTTYPE_ALPHABETICAL LogsAggregateSortType = "alphabetical" - LOGSAGGREGATESORTTYPE_MEASURE LogsAggregateSortType = "measure" -) - -var allowedLogsAggregateSortTypeEnumValues = []LogsAggregateSortType{ - LOGSAGGREGATESORTTYPE_ALPHABETICAL, - LOGSAGGREGATESORTTYPE_MEASURE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsAggregateSortType) GetAllowedValues() []LogsAggregateSortType { - return allowedLogsAggregateSortTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsAggregateSortType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsAggregateSortType(value) - return nil -} - -// NewLogsAggregateSortTypeFromValue returns a pointer to a valid LogsAggregateSortType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsAggregateSortTypeFromValue(v string) (*LogsAggregateSortType, error) { - ev := LogsAggregateSortType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsAggregateSortType: valid values are %v", v, allowedLogsAggregateSortTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsAggregateSortType) IsValid() bool { - for _, existing := range allowedLogsAggregateSortTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsAggregateSortType value. -func (v LogsAggregateSortType) Ptr() *LogsAggregateSortType { - return &v -} - -// NullableLogsAggregateSortType handles when a null is used for LogsAggregateSortType. -type NullableLogsAggregateSortType struct { - value *LogsAggregateSortType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregateSortType) Get() *LogsAggregateSortType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregateSortType) Set(val *LogsAggregateSortType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregateSortType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAggregateSortType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregateSortType initializes the struct as if Set has been called. -func NewNullableLogsAggregateSortType(val *LogsAggregateSortType) *NullableLogsAggregateSortType { - return &NullableLogsAggregateSortType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregateSortType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregateSortType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_aggregation_function.go b/api/v2/datadog/model_logs_aggregation_function.go deleted file mode 100644 index f602242f4b7..00000000000 --- a/api/v2/datadog/model_logs_aggregation_function.go +++ /dev/null @@ -1,129 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsAggregationFunction An aggregation function -type LogsAggregationFunction string - -// List of LogsAggregationFunction. -const ( - LOGSAGGREGATIONFUNCTION_COUNT LogsAggregationFunction = "count" - LOGSAGGREGATIONFUNCTION_CARDINALITY LogsAggregationFunction = "cardinality" - LOGSAGGREGATIONFUNCTION_PERCENTILE_75 LogsAggregationFunction = "pc75" - LOGSAGGREGATIONFUNCTION_PERCENTILE_90 LogsAggregationFunction = "pc90" - LOGSAGGREGATIONFUNCTION_PERCENTILE_95 LogsAggregationFunction = "pc95" - LOGSAGGREGATIONFUNCTION_PERCENTILE_98 LogsAggregationFunction = "pc98" - LOGSAGGREGATIONFUNCTION_PERCENTILE_99 LogsAggregationFunction = "pc99" - LOGSAGGREGATIONFUNCTION_SUM LogsAggregationFunction = "sum" - LOGSAGGREGATIONFUNCTION_MIN LogsAggregationFunction = "min" - LOGSAGGREGATIONFUNCTION_MAX LogsAggregationFunction = "max" - LOGSAGGREGATIONFUNCTION_AVG LogsAggregationFunction = "avg" - LOGSAGGREGATIONFUNCTION_MEDIAN LogsAggregationFunction = "median" -) - -var allowedLogsAggregationFunctionEnumValues = []LogsAggregationFunction{ - LOGSAGGREGATIONFUNCTION_COUNT, - LOGSAGGREGATIONFUNCTION_CARDINALITY, - LOGSAGGREGATIONFUNCTION_PERCENTILE_75, - LOGSAGGREGATIONFUNCTION_PERCENTILE_90, - LOGSAGGREGATIONFUNCTION_PERCENTILE_95, - LOGSAGGREGATIONFUNCTION_PERCENTILE_98, - LOGSAGGREGATIONFUNCTION_PERCENTILE_99, - LOGSAGGREGATIONFUNCTION_SUM, - LOGSAGGREGATIONFUNCTION_MIN, - LOGSAGGREGATIONFUNCTION_MAX, - LOGSAGGREGATIONFUNCTION_AVG, - LOGSAGGREGATIONFUNCTION_MEDIAN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsAggregationFunction) GetAllowedValues() []LogsAggregationFunction { - return allowedLogsAggregationFunctionEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsAggregationFunction) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsAggregationFunction(value) - return nil -} - -// NewLogsAggregationFunctionFromValue returns a pointer to a valid LogsAggregationFunction -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsAggregationFunctionFromValue(v string) (*LogsAggregationFunction, error) { - ev := LogsAggregationFunction(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsAggregationFunction: valid values are %v", v, allowedLogsAggregationFunctionEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsAggregationFunction) IsValid() bool { - for _, existing := range allowedLogsAggregationFunctionEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsAggregationFunction value. -func (v LogsAggregationFunction) Ptr() *LogsAggregationFunction { - return &v -} - -// NullableLogsAggregationFunction handles when a null is used for LogsAggregationFunction. -type NullableLogsAggregationFunction struct { - value *LogsAggregationFunction - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsAggregationFunction) Get() *LogsAggregationFunction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsAggregationFunction) Set(val *LogsAggregationFunction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsAggregationFunction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsAggregationFunction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsAggregationFunction initializes the struct as if Set has been called. -func NewNullableLogsAggregationFunction(val *LogsAggregationFunction) *NullableLogsAggregationFunction { - return &NullableLogsAggregationFunction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsAggregationFunction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsAggregationFunction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archive.go b/api/v2/datadog/model_logs_archive.go deleted file mode 100644 index 53aafcd7cd5..00000000000 --- a/api/v2/datadog/model_logs_archive.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsArchive The logs archive. -type LogsArchive struct { - // The definition of an archive. - Data *LogsArchiveDefinition `json:"data,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{} -} - -// NewLogsArchive instantiates a new LogsArchive 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 NewLogsArchive() *LogsArchive { - this := LogsArchive{} - return &this -} - -// NewLogsArchiveWithDefaults instantiates a new LogsArchive 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 NewLogsArchiveWithDefaults() *LogsArchive { - this := LogsArchive{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsArchive) GetData() LogsArchiveDefinition { - if o == nil || o.Data == nil { - var ret LogsArchiveDefinition - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchive) GetDataOk() (*LogsArchiveDefinition, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsArchive) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given LogsArchiveDefinition and assigns it to the Data field. -func (o *LogsArchive) SetData(v LogsArchiveDefinition) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchive) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchive) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *LogsArchiveDefinition `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_archive_attributes.go b/api/v2/datadog/model_logs_archive_attributes.go deleted file mode 100644 index 03ec96fc7c9..00000000000 --- a/api/v2/datadog/model_logs_archive_attributes.go +++ /dev/null @@ -1,353 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsArchiveAttributes The attributes associated with the archive. -type LogsArchiveAttributes struct { - // An archive's destination. - Destination NullableLogsArchiveDestination `json:"destination"` - // To store the tags in the archive, set the value "true". - // If it is set to "false", the tags will be deleted when the logs are sent to the archive. - IncludeTags *bool `json:"include_tags,omitempty"` - // The archive name. - Name string `json:"name"` - // The archive query/filter. Logs matching this query are included in the archive. - Query string `json:"query"` - // Maximum scan size for rehydration from this archive. - RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` - // An array of tags to add to rehydrated logs from an archive. - RehydrationTags []string `json:"rehydration_tags,omitempty"` - // The state of the archive. - State *LogsArchiveState `json:"state,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{} -} - -// NewLogsArchiveAttributes instantiates a new LogsArchiveAttributes 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 NewLogsArchiveAttributes(destination NullableLogsArchiveDestination, name string, query string) *LogsArchiveAttributes { - this := LogsArchiveAttributes{} - this.Destination = destination - var includeTags bool = false - this.IncludeTags = &includeTags - this.Name = name - this.Query = query - return &this -} - -// NewLogsArchiveAttributesWithDefaults instantiates a new LogsArchiveAttributes 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 NewLogsArchiveAttributesWithDefaults() *LogsArchiveAttributes { - this := LogsArchiveAttributes{} - var includeTags bool = false - this.IncludeTags = &includeTags - return &this -} - -// GetDestination returns the Destination field value. -// If the value is explicit nil, the zero value for LogsArchiveDestination will be returned. -func (o *LogsArchiveAttributes) GetDestination() LogsArchiveDestination { - if o == nil || o.Destination.Get() == nil { - var ret LogsArchiveDestination - return ret - } - return *o.Destination.Get() -} - -// GetDestinationOk returns a tuple with the Destination field value -// 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 *LogsArchiveAttributes) GetDestinationOk() (*LogsArchiveDestination, bool) { - if o == nil { - return nil, false - } - return o.Destination.Get(), o.Destination.IsSet() -} - -// SetDestination sets field value. -func (o *LogsArchiveAttributes) SetDestination(v LogsArchiveDestination) { - o.Destination.Set(&v) -} - -// GetIncludeTags returns the IncludeTags field value if set, zero value otherwise. -func (o *LogsArchiveAttributes) GetIncludeTags() bool { - if o == nil || o.IncludeTags == nil { - var ret bool - return ret - } - return *o.IncludeTags -} - -// GetIncludeTagsOk returns a tuple with the IncludeTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveAttributes) GetIncludeTagsOk() (*bool, bool) { - if o == nil || o.IncludeTags == nil { - return nil, false - } - return o.IncludeTags, true -} - -// HasIncludeTags returns a boolean if a field has been set. -func (o *LogsArchiveAttributes) HasIncludeTags() bool { - if o != nil && o.IncludeTags != nil { - return true - } - - return false -} - -// SetIncludeTags gets a reference to the given bool and assigns it to the IncludeTags field. -func (o *LogsArchiveAttributes) SetIncludeTags(v bool) { - o.IncludeTags = &v -} - -// GetName returns the Name field value. -func (o *LogsArchiveAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *LogsArchiveAttributes) SetName(v string) { - o.Name = v -} - -// GetQuery returns the Query field value. -func (o *LogsArchiveAttributes) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveAttributes) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *LogsArchiveAttributes) SetQuery(v string) { - o.Query = v -} - -// GetRehydrationMaxScanSizeInGb returns the RehydrationMaxScanSizeInGb field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *LogsArchiveAttributes) GetRehydrationMaxScanSizeInGb() int64 { - if o == nil || o.RehydrationMaxScanSizeInGb.Get() == nil { - var ret int64 - return ret - } - return *o.RehydrationMaxScanSizeInGb.Get() -} - -// GetRehydrationMaxScanSizeInGbOk returns a tuple with the RehydrationMaxScanSizeInGb 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 *LogsArchiveAttributes) GetRehydrationMaxScanSizeInGbOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.RehydrationMaxScanSizeInGb.Get(), o.RehydrationMaxScanSizeInGb.IsSet() -} - -// HasRehydrationMaxScanSizeInGb returns a boolean if a field has been set. -func (o *LogsArchiveAttributes) HasRehydrationMaxScanSizeInGb() bool { - if o != nil && o.RehydrationMaxScanSizeInGb.IsSet() { - return true - } - - return false -} - -// SetRehydrationMaxScanSizeInGb gets a reference to the given common.NullableInt64 and assigns it to the RehydrationMaxScanSizeInGb field. -func (o *LogsArchiveAttributes) SetRehydrationMaxScanSizeInGb(v int64) { - o.RehydrationMaxScanSizeInGb.Set(&v) -} - -// SetRehydrationMaxScanSizeInGbNil sets the value for RehydrationMaxScanSizeInGb to be an explicit nil. -func (o *LogsArchiveAttributes) SetRehydrationMaxScanSizeInGbNil() { - o.RehydrationMaxScanSizeInGb.Set(nil) -} - -// UnsetRehydrationMaxScanSizeInGb ensures that no value is present for RehydrationMaxScanSizeInGb, not even an explicit nil. -func (o *LogsArchiveAttributes) UnsetRehydrationMaxScanSizeInGb() { - o.RehydrationMaxScanSizeInGb.Unset() -} - -// GetRehydrationTags returns the RehydrationTags field value if set, zero value otherwise. -func (o *LogsArchiveAttributes) GetRehydrationTags() []string { - if o == nil || o.RehydrationTags == nil { - var ret []string - return ret - } - return o.RehydrationTags -} - -// GetRehydrationTagsOk returns a tuple with the RehydrationTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveAttributes) GetRehydrationTagsOk() (*[]string, bool) { - if o == nil || o.RehydrationTags == nil { - return nil, false - } - return &o.RehydrationTags, true -} - -// HasRehydrationTags returns a boolean if a field has been set. -func (o *LogsArchiveAttributes) HasRehydrationTags() bool { - if o != nil && o.RehydrationTags != nil { - return true - } - - return false -} - -// SetRehydrationTags gets a reference to the given []string and assigns it to the RehydrationTags field. -func (o *LogsArchiveAttributes) SetRehydrationTags(v []string) { - o.RehydrationTags = v -} - -// GetState returns the State field value if set, zero value otherwise. -func (o *LogsArchiveAttributes) GetState() LogsArchiveState { - if o == nil || o.State == nil { - var ret LogsArchiveState - return ret - } - return *o.State -} - -// GetStateOk returns a tuple with the State field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveAttributes) GetStateOk() (*LogsArchiveState, bool) { - if o == nil || o.State == nil { - return nil, false - } - return o.State, true -} - -// HasState returns a boolean if a field has been set. -func (o *LogsArchiveAttributes) HasState() bool { - if o != nil && o.State != nil { - return true - } - - return false -} - -// SetState gets a reference to the given LogsArchiveState and assigns it to the State field. -func (o *LogsArchiveAttributes) SetState(v LogsArchiveState) { - o.State = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["destination"] = o.Destination.Get() - if o.IncludeTags != nil { - toSerialize["include_tags"] = o.IncludeTags - } - toSerialize["name"] = o.Name - toSerialize["query"] = o.Query - if o.RehydrationMaxScanSizeInGb.IsSet() { - toSerialize["rehydration_max_scan_size_in_gb"] = o.RehydrationMaxScanSizeInGb.Get() - } - if o.RehydrationTags != nil { - toSerialize["rehydration_tags"] = o.RehydrationTags - } - if o.State != nil { - toSerialize["state"] = o.State - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Destination NullableLogsArchiveDestination `json:"destination"` - Name *string `json:"name"` - Query *string `json:"query"` - }{} - all := struct { - Destination NullableLogsArchiveDestination `json:"destination"` - IncludeTags *bool `json:"include_tags,omitempty"` - Name string `json:"name"` - Query string `json:"query"` - RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` - RehydrationTags []string `json:"rehydration_tags,omitempty"` - State *LogsArchiveState `json:"state,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if !required.Destination.IsSet() { - return fmt.Errorf("Required field destination missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.State; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Destination = all.Destination - o.IncludeTags = all.IncludeTags - o.Name = all.Name - o.Query = all.Query - o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb - o.RehydrationTags = all.RehydrationTags - o.State = all.State - return nil -} diff --git a/api/v2/datadog/model_logs_archive_create_request.go b/api/v2/datadog/model_logs_archive_create_request.go deleted file mode 100644 index 66a7a8b4437..00000000000 --- a/api/v2/datadog/model_logs_archive_create_request.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsArchiveCreateRequest The logs archive. -type LogsArchiveCreateRequest struct { - // The definition of an archive. - Data *LogsArchiveCreateRequestDefinition `json:"data,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{} -} - -// NewLogsArchiveCreateRequest instantiates a new LogsArchiveCreateRequest 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 NewLogsArchiveCreateRequest() *LogsArchiveCreateRequest { - this := LogsArchiveCreateRequest{} - return &this -} - -// NewLogsArchiveCreateRequestWithDefaults instantiates a new LogsArchiveCreateRequest 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 NewLogsArchiveCreateRequestWithDefaults() *LogsArchiveCreateRequest { - this := LogsArchiveCreateRequest{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsArchiveCreateRequest) GetData() LogsArchiveCreateRequestDefinition { - if o == nil || o.Data == nil { - var ret LogsArchiveCreateRequestDefinition - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveCreateRequest) GetDataOk() (*LogsArchiveCreateRequestDefinition, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsArchiveCreateRequest) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given LogsArchiveCreateRequestDefinition and assigns it to the Data field. -func (o *LogsArchiveCreateRequest) SetData(v LogsArchiveCreateRequestDefinition) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *LogsArchiveCreateRequestDefinition `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_archive_create_request_attributes.go b/api/v2/datadog/model_logs_archive_create_request_attributes.go deleted file mode 100644 index 38fb344104d..00000000000 --- a/api/v2/datadog/model_logs_archive_create_request_attributes.go +++ /dev/null @@ -1,304 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// LogsArchiveCreateRequestAttributes The attributes associated with the archive. -type LogsArchiveCreateRequestAttributes struct { - // An archive's destination. - Destination LogsArchiveCreateRequestDestination `json:"destination"` - // To store the tags in the archive, set the value "true". - // If it is set to "false", the tags will be deleted when the logs are sent to the archive. - IncludeTags *bool `json:"include_tags,omitempty"` - // The archive name. - Name string `json:"name"` - // The archive query/filter. Logs matching this query are included in the archive. - Query string `json:"query"` - // Maximum scan size for rehydration from this archive. - RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` - // An array of tags to add to rehydrated logs from an archive. - RehydrationTags []string `json:"rehydration_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{} -} - -// NewLogsArchiveCreateRequestAttributes instantiates a new LogsArchiveCreateRequestAttributes 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 NewLogsArchiveCreateRequestAttributes(destination LogsArchiveCreateRequestDestination, name string, query string) *LogsArchiveCreateRequestAttributes { - this := LogsArchiveCreateRequestAttributes{} - this.Destination = destination - var includeTags bool = false - this.IncludeTags = &includeTags - this.Name = name - this.Query = query - return &this -} - -// NewLogsArchiveCreateRequestAttributesWithDefaults instantiates a new LogsArchiveCreateRequestAttributes 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 NewLogsArchiveCreateRequestAttributesWithDefaults() *LogsArchiveCreateRequestAttributes { - this := LogsArchiveCreateRequestAttributes{} - var includeTags bool = false - this.IncludeTags = &includeTags - return &this -} - -// GetDestination returns the Destination field value. -func (o *LogsArchiveCreateRequestAttributes) GetDestination() LogsArchiveCreateRequestDestination { - if o == nil { - var ret LogsArchiveCreateRequestDestination - return ret - } - return o.Destination -} - -// GetDestinationOk returns a tuple with the Destination field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveCreateRequestAttributes) GetDestinationOk() (*LogsArchiveCreateRequestDestination, bool) { - if o == nil { - return nil, false - } - return &o.Destination, true -} - -// SetDestination sets field value. -func (o *LogsArchiveCreateRequestAttributes) SetDestination(v LogsArchiveCreateRequestDestination) { - o.Destination = v -} - -// GetIncludeTags returns the IncludeTags field value if set, zero value otherwise. -func (o *LogsArchiveCreateRequestAttributes) GetIncludeTags() bool { - if o == nil || o.IncludeTags == nil { - var ret bool - return ret - } - return *o.IncludeTags -} - -// GetIncludeTagsOk returns a tuple with the IncludeTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveCreateRequestAttributes) GetIncludeTagsOk() (*bool, bool) { - if o == nil || o.IncludeTags == nil { - return nil, false - } - return o.IncludeTags, true -} - -// HasIncludeTags returns a boolean if a field has been set. -func (o *LogsArchiveCreateRequestAttributes) HasIncludeTags() bool { - if o != nil && o.IncludeTags != nil { - return true - } - - return false -} - -// SetIncludeTags gets a reference to the given bool and assigns it to the IncludeTags field. -func (o *LogsArchiveCreateRequestAttributes) SetIncludeTags(v bool) { - o.IncludeTags = &v -} - -// GetName returns the Name field value. -func (o *LogsArchiveCreateRequestAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveCreateRequestAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *LogsArchiveCreateRequestAttributes) SetName(v string) { - o.Name = v -} - -// GetQuery returns the Query field value. -func (o *LogsArchiveCreateRequestAttributes) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveCreateRequestAttributes) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *LogsArchiveCreateRequestAttributes) SetQuery(v string) { - o.Query = v -} - -// GetRehydrationMaxScanSizeInGb returns the RehydrationMaxScanSizeInGb field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *LogsArchiveCreateRequestAttributes) GetRehydrationMaxScanSizeInGb() int64 { - if o == nil || o.RehydrationMaxScanSizeInGb.Get() == nil { - var ret int64 - return ret - } - return *o.RehydrationMaxScanSizeInGb.Get() -} - -// GetRehydrationMaxScanSizeInGbOk returns a tuple with the RehydrationMaxScanSizeInGb 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 *LogsArchiveCreateRequestAttributes) GetRehydrationMaxScanSizeInGbOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.RehydrationMaxScanSizeInGb.Get(), o.RehydrationMaxScanSizeInGb.IsSet() -} - -// HasRehydrationMaxScanSizeInGb returns a boolean if a field has been set. -func (o *LogsArchiveCreateRequestAttributes) HasRehydrationMaxScanSizeInGb() bool { - if o != nil && o.RehydrationMaxScanSizeInGb.IsSet() { - return true - } - - return false -} - -// SetRehydrationMaxScanSizeInGb gets a reference to the given common.NullableInt64 and assigns it to the RehydrationMaxScanSizeInGb field. -func (o *LogsArchiveCreateRequestAttributes) SetRehydrationMaxScanSizeInGb(v int64) { - o.RehydrationMaxScanSizeInGb.Set(&v) -} - -// SetRehydrationMaxScanSizeInGbNil sets the value for RehydrationMaxScanSizeInGb to be an explicit nil. -func (o *LogsArchiveCreateRequestAttributes) SetRehydrationMaxScanSizeInGbNil() { - o.RehydrationMaxScanSizeInGb.Set(nil) -} - -// UnsetRehydrationMaxScanSizeInGb ensures that no value is present for RehydrationMaxScanSizeInGb, not even an explicit nil. -func (o *LogsArchiveCreateRequestAttributes) UnsetRehydrationMaxScanSizeInGb() { - o.RehydrationMaxScanSizeInGb.Unset() -} - -// GetRehydrationTags returns the RehydrationTags field value if set, zero value otherwise. -func (o *LogsArchiveCreateRequestAttributes) GetRehydrationTags() []string { - if o == nil || o.RehydrationTags == nil { - var ret []string - return ret - } - return o.RehydrationTags -} - -// GetRehydrationTagsOk returns a tuple with the RehydrationTags field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveCreateRequestAttributes) GetRehydrationTagsOk() (*[]string, bool) { - if o == nil || o.RehydrationTags == nil { - return nil, false - } - return &o.RehydrationTags, true -} - -// HasRehydrationTags returns a boolean if a field has been set. -func (o *LogsArchiveCreateRequestAttributes) HasRehydrationTags() bool { - if o != nil && o.RehydrationTags != nil { - return true - } - - return false -} - -// SetRehydrationTags gets a reference to the given []string and assigns it to the RehydrationTags field. -func (o *LogsArchiveCreateRequestAttributes) SetRehydrationTags(v []string) { - o.RehydrationTags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["destination"] = o.Destination - if o.IncludeTags != nil { - toSerialize["include_tags"] = o.IncludeTags - } - toSerialize["name"] = o.Name - toSerialize["query"] = o.Query - if o.RehydrationMaxScanSizeInGb.IsSet() { - toSerialize["rehydration_max_scan_size_in_gb"] = o.RehydrationMaxScanSizeInGb.Get() - } - if o.RehydrationTags != nil { - toSerialize["rehydration_tags"] = o.RehydrationTags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Destination *LogsArchiveCreateRequestDestination `json:"destination"` - Name *string `json:"name"` - Query *string `json:"query"` - }{} - all := struct { - Destination LogsArchiveCreateRequestDestination `json:"destination"` - IncludeTags *bool `json:"include_tags,omitempty"` - Name string `json:"name"` - Query string `json:"query"` - RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` - RehydrationTags []string `json:"rehydration_tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Destination == nil { - return fmt.Errorf("Required field destination missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Destination = all.Destination - o.IncludeTags = all.IncludeTags - o.Name = all.Name - o.Query = all.Query - o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb - o.RehydrationTags = all.RehydrationTags - return nil -} diff --git a/api/v2/datadog/model_logs_archive_create_request_definition.go b/api/v2/datadog/model_logs_archive_create_request_definition.go deleted file mode 100644 index be92fa5c16b..00000000000 --- a/api/v2/datadog/model_logs_archive_create_request_definition.go +++ /dev/null @@ -1,151 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveCreateRequestDefinition The definition of an archive. -type LogsArchiveCreateRequestDefinition struct { - // The attributes associated with the archive. - Attributes *LogsArchiveCreateRequestAttributes `json:"attributes,omitempty"` - // The type of the resource. The value should always be archives. - 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{} -} - -// NewLogsArchiveCreateRequestDefinition instantiates a new LogsArchiveCreateRequestDefinition 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 NewLogsArchiveCreateRequestDefinition(typeVar string) *LogsArchiveCreateRequestDefinition { - this := LogsArchiveCreateRequestDefinition{} - this.Type = typeVar - return &this -} - -// NewLogsArchiveCreateRequestDefinitionWithDefaults instantiates a new LogsArchiveCreateRequestDefinition 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 NewLogsArchiveCreateRequestDefinitionWithDefaults() *LogsArchiveCreateRequestDefinition { - this := LogsArchiveCreateRequestDefinition{} - var typeVar string = "archives" - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *LogsArchiveCreateRequestDefinition) GetAttributes() LogsArchiveCreateRequestAttributes { - if o == nil || o.Attributes == nil { - var ret LogsArchiveCreateRequestAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveCreateRequestDefinition) GetAttributesOk() (*LogsArchiveCreateRequestAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *LogsArchiveCreateRequestDefinition) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given LogsArchiveCreateRequestAttributes and assigns it to the Attributes field. -func (o *LogsArchiveCreateRequestDefinition) SetAttributes(v LogsArchiveCreateRequestAttributes) { - o.Attributes = &v -} - -// GetType returns the Type field value. -func (o *LogsArchiveCreateRequestDefinition) 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 *LogsArchiveCreateRequestDefinition) GetTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsArchiveCreateRequestDefinition) SetType(v string) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveCreateRequestDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveCreateRequestDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *string `json:"type"` - }{} - all := struct { - Attributes *LogsArchiveCreateRequestAttributes `json:"attributes,omitempty"` - Type string `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_archive_create_request_destination.go b/api/v2/datadog/model_logs_archive_create_request_destination.go deleted file mode 100644 index e46e1ff9f2a..00000000000 --- a/api/v2/datadog/model_logs_archive_create_request_destination.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsArchiveCreateRequestDestination - An archive's destination. -type LogsArchiveCreateRequestDestination struct { - LogsArchiveDestinationAzure *LogsArchiveDestinationAzure - LogsArchiveDestinationGCS *LogsArchiveDestinationGCS - LogsArchiveDestinationS3 *LogsArchiveDestinationS3 - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// LogsArchiveDestinationAzureAsLogsArchiveCreateRequestDestination is a convenience function that returns LogsArchiveDestinationAzure wrapped in LogsArchiveCreateRequestDestination. -func LogsArchiveDestinationAzureAsLogsArchiveCreateRequestDestination(v *LogsArchiveDestinationAzure) LogsArchiveCreateRequestDestination { - return LogsArchiveCreateRequestDestination{LogsArchiveDestinationAzure: v} -} - -// LogsArchiveDestinationGCSAsLogsArchiveCreateRequestDestination is a convenience function that returns LogsArchiveDestinationGCS wrapped in LogsArchiveCreateRequestDestination. -func LogsArchiveDestinationGCSAsLogsArchiveCreateRequestDestination(v *LogsArchiveDestinationGCS) LogsArchiveCreateRequestDestination { - return LogsArchiveCreateRequestDestination{LogsArchiveDestinationGCS: v} -} - -// LogsArchiveDestinationS3AsLogsArchiveCreateRequestDestination is a convenience function that returns LogsArchiveDestinationS3 wrapped in LogsArchiveCreateRequestDestination. -func LogsArchiveDestinationS3AsLogsArchiveCreateRequestDestination(v *LogsArchiveDestinationS3) LogsArchiveCreateRequestDestination { - return LogsArchiveCreateRequestDestination{LogsArchiveDestinationS3: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *LogsArchiveCreateRequestDestination) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into LogsArchiveDestinationAzure - err = json.Unmarshal(data, &obj.LogsArchiveDestinationAzure) - if err == nil { - if obj.LogsArchiveDestinationAzure != nil && obj.LogsArchiveDestinationAzure.UnparsedObject == nil { - jsonLogsArchiveDestinationAzure, _ := json.Marshal(obj.LogsArchiveDestinationAzure) - if string(jsonLogsArchiveDestinationAzure) == "{}" { // empty struct - obj.LogsArchiveDestinationAzure = nil - } else { - match++ - } - } else { - obj.LogsArchiveDestinationAzure = nil - } - } else { - obj.LogsArchiveDestinationAzure = nil - } - - // try to unmarshal data into LogsArchiveDestinationGCS - err = json.Unmarshal(data, &obj.LogsArchiveDestinationGCS) - if err == nil { - if obj.LogsArchiveDestinationGCS != nil && obj.LogsArchiveDestinationGCS.UnparsedObject == nil { - jsonLogsArchiveDestinationGCS, _ := json.Marshal(obj.LogsArchiveDestinationGCS) - if string(jsonLogsArchiveDestinationGCS) == "{}" { // empty struct - obj.LogsArchiveDestinationGCS = nil - } else { - match++ - } - } else { - obj.LogsArchiveDestinationGCS = nil - } - } else { - obj.LogsArchiveDestinationGCS = nil - } - - // try to unmarshal data into LogsArchiveDestinationS3 - err = json.Unmarshal(data, &obj.LogsArchiveDestinationS3) - if err == nil { - if obj.LogsArchiveDestinationS3 != nil && obj.LogsArchiveDestinationS3.UnparsedObject == nil { - jsonLogsArchiveDestinationS3, _ := json.Marshal(obj.LogsArchiveDestinationS3) - if string(jsonLogsArchiveDestinationS3) == "{}" { // empty struct - obj.LogsArchiveDestinationS3 = nil - } else { - match++ - } - } else { - obj.LogsArchiveDestinationS3 = nil - } - } else { - obj.LogsArchiveDestinationS3 = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.LogsArchiveDestinationAzure = nil - obj.LogsArchiveDestinationGCS = nil - obj.LogsArchiveDestinationS3 = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj LogsArchiveCreateRequestDestination) MarshalJSON() ([]byte, error) { - if obj.LogsArchiveDestinationAzure != nil { - return json.Marshal(&obj.LogsArchiveDestinationAzure) - } - - if obj.LogsArchiveDestinationGCS != nil { - return json.Marshal(&obj.LogsArchiveDestinationGCS) - } - - if obj.LogsArchiveDestinationS3 != nil { - return json.Marshal(&obj.LogsArchiveDestinationS3) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *LogsArchiveCreateRequestDestination) GetActualInstance() interface{} { - if obj.LogsArchiveDestinationAzure != nil { - return obj.LogsArchiveDestinationAzure - } - - if obj.LogsArchiveDestinationGCS != nil { - return obj.LogsArchiveDestinationGCS - } - - if obj.LogsArchiveDestinationS3 != nil { - return obj.LogsArchiveDestinationS3 - } - - // all schemas are nil - return nil -} - -// NullableLogsArchiveCreateRequestDestination handles when a null is used for LogsArchiveCreateRequestDestination. -type NullableLogsArchiveCreateRequestDestination struct { - value *LogsArchiveCreateRequestDestination - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveCreateRequestDestination) Get() *LogsArchiveCreateRequestDestination { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveCreateRequestDestination) Set(val *LogsArchiveCreateRequestDestination) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveCreateRequestDestination) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsArchiveCreateRequestDestination) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveCreateRequestDestination initializes the struct as if Set has been called. -func NewNullableLogsArchiveCreateRequestDestination(val *LogsArchiveCreateRequestDestination) *NullableLogsArchiveCreateRequestDestination { - return &NullableLogsArchiveCreateRequestDestination{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveCreateRequestDestination) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveCreateRequestDestination) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archive_definition.go b/api/v2/datadog/model_logs_archive_definition.go deleted file mode 100644 index 65680c1f08e..00000000000 --- a/api/v2/datadog/model_logs_archive_definition.go +++ /dev/null @@ -1,188 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveDefinition The definition of an archive. -type LogsArchiveDefinition struct { - // The attributes associated with the archive. - Attributes *LogsArchiveAttributes `json:"attributes,omitempty"` - // The archive ID. - Id *string `json:"id,omitempty"` - // The type of the resource. The value should always be archives. - 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{} -} - -// NewLogsArchiveDefinition instantiates a new LogsArchiveDefinition 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 NewLogsArchiveDefinition(typeVar string) *LogsArchiveDefinition { - this := LogsArchiveDefinition{} - this.Type = typeVar - return &this -} - -// NewLogsArchiveDefinitionWithDefaults instantiates a new LogsArchiveDefinition 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 NewLogsArchiveDefinitionWithDefaults() *LogsArchiveDefinition { - this := LogsArchiveDefinition{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *LogsArchiveDefinition) GetAttributes() LogsArchiveAttributes { - if o == nil || o.Attributes == nil { - var ret LogsArchiveAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveDefinition) GetAttributesOk() (*LogsArchiveAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *LogsArchiveDefinition) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given LogsArchiveAttributes and assigns it to the Attributes field. -func (o *LogsArchiveDefinition) SetAttributes(v LogsArchiveAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *LogsArchiveDefinition) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveDefinition) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *LogsArchiveDefinition) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *LogsArchiveDefinition) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value. -func (o *LogsArchiveDefinition) 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 *LogsArchiveDefinition) GetTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsArchiveDefinition) SetType(v string) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *string `json:"type"` - }{} - all := struct { - Attributes *LogsArchiveAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type string `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_archive_destination.go b/api/v2/datadog/model_logs_archive_destination.go deleted file mode 100644 index e4cbdfe521d..00000000000 --- a/api/v2/datadog/model_logs_archive_destination.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsArchiveDestination - An archive's destination. -type LogsArchiveDestination struct { - LogsArchiveDestinationAzure *LogsArchiveDestinationAzure - LogsArchiveDestinationGCS *LogsArchiveDestinationGCS - LogsArchiveDestinationS3 *LogsArchiveDestinationS3 - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// LogsArchiveDestinationAzureAsLogsArchiveDestination is a convenience function that returns LogsArchiveDestinationAzure wrapped in LogsArchiveDestination. -func LogsArchiveDestinationAzureAsLogsArchiveDestination(v *LogsArchiveDestinationAzure) LogsArchiveDestination { - return LogsArchiveDestination{LogsArchiveDestinationAzure: v} -} - -// LogsArchiveDestinationGCSAsLogsArchiveDestination is a convenience function that returns LogsArchiveDestinationGCS wrapped in LogsArchiveDestination. -func LogsArchiveDestinationGCSAsLogsArchiveDestination(v *LogsArchiveDestinationGCS) LogsArchiveDestination { - return LogsArchiveDestination{LogsArchiveDestinationGCS: v} -} - -// LogsArchiveDestinationS3AsLogsArchiveDestination is a convenience function that returns LogsArchiveDestinationS3 wrapped in LogsArchiveDestination. -func LogsArchiveDestinationS3AsLogsArchiveDestination(v *LogsArchiveDestinationS3) LogsArchiveDestination { - return LogsArchiveDestination{LogsArchiveDestinationS3: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *LogsArchiveDestination) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into LogsArchiveDestinationAzure - err = json.Unmarshal(data, &obj.LogsArchiveDestinationAzure) - if err == nil { - if obj.LogsArchiveDestinationAzure != nil && obj.LogsArchiveDestinationAzure.UnparsedObject == nil { - jsonLogsArchiveDestinationAzure, _ := json.Marshal(obj.LogsArchiveDestinationAzure) - if string(jsonLogsArchiveDestinationAzure) == "{}" { // empty struct - obj.LogsArchiveDestinationAzure = nil - } else { - match++ - } - } else { - obj.LogsArchiveDestinationAzure = nil - } - } else { - obj.LogsArchiveDestinationAzure = nil - } - - // try to unmarshal data into LogsArchiveDestinationGCS - err = json.Unmarshal(data, &obj.LogsArchiveDestinationGCS) - if err == nil { - if obj.LogsArchiveDestinationGCS != nil && obj.LogsArchiveDestinationGCS.UnparsedObject == nil { - jsonLogsArchiveDestinationGCS, _ := json.Marshal(obj.LogsArchiveDestinationGCS) - if string(jsonLogsArchiveDestinationGCS) == "{}" { // empty struct - obj.LogsArchiveDestinationGCS = nil - } else { - match++ - } - } else { - obj.LogsArchiveDestinationGCS = nil - } - } else { - obj.LogsArchiveDestinationGCS = nil - } - - // try to unmarshal data into LogsArchiveDestinationS3 - err = json.Unmarshal(data, &obj.LogsArchiveDestinationS3) - if err == nil { - if obj.LogsArchiveDestinationS3 != nil && obj.LogsArchiveDestinationS3.UnparsedObject == nil { - jsonLogsArchiveDestinationS3, _ := json.Marshal(obj.LogsArchiveDestinationS3) - if string(jsonLogsArchiveDestinationS3) == "{}" { // empty struct - obj.LogsArchiveDestinationS3 = nil - } else { - match++ - } - } else { - obj.LogsArchiveDestinationS3 = nil - } - } else { - obj.LogsArchiveDestinationS3 = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.LogsArchiveDestinationAzure = nil - obj.LogsArchiveDestinationGCS = nil - obj.LogsArchiveDestinationS3 = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj LogsArchiveDestination) MarshalJSON() ([]byte, error) { - if obj.LogsArchiveDestinationAzure != nil { - return json.Marshal(&obj.LogsArchiveDestinationAzure) - } - - if obj.LogsArchiveDestinationGCS != nil { - return json.Marshal(&obj.LogsArchiveDestinationGCS) - } - - if obj.LogsArchiveDestinationS3 != nil { - return json.Marshal(&obj.LogsArchiveDestinationS3) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *LogsArchiveDestination) GetActualInstance() interface{} { - if obj.LogsArchiveDestinationAzure != nil { - return obj.LogsArchiveDestinationAzure - } - - if obj.LogsArchiveDestinationGCS != nil { - return obj.LogsArchiveDestinationGCS - } - - if obj.LogsArchiveDestinationS3 != nil { - return obj.LogsArchiveDestinationS3 - } - - // all schemas are nil - return nil -} - -// NullableLogsArchiveDestination handles when a null is used for LogsArchiveDestination. -type NullableLogsArchiveDestination struct { - value *LogsArchiveDestination - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveDestination) Get() *LogsArchiveDestination { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveDestination) Set(val *LogsArchiveDestination) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveDestination) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsArchiveDestination) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveDestination initializes the struct as if Set has been called. -func NewNullableLogsArchiveDestination(val *LogsArchiveDestination) *NullableLogsArchiveDestination { - return &NullableLogsArchiveDestination{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveDestination) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveDestination) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archive_destination_azure.go b/api/v2/datadog/model_logs_archive_destination_azure.go deleted file mode 100644 index 4d4be9c203d..00000000000 --- a/api/v2/datadog/model_logs_archive_destination_azure.go +++ /dev/null @@ -1,297 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveDestinationAzure The Azure archive destination. -type LogsArchiveDestinationAzure struct { - // The container where the archive will be stored. - Container string `json:"container"` - // The Azure archive's integration destination. - Integration LogsArchiveIntegrationAzure `json:"integration"` - // The archive path. - Path *string `json:"path,omitempty"` - // The region where the archive will be stored. - Region *string `json:"region,omitempty"` - // The associated storage account. - StorageAccount string `json:"storage_account"` - // Type of the Azure archive destination. - Type LogsArchiveDestinationAzureType `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{} -} - -// NewLogsArchiveDestinationAzure instantiates a new LogsArchiveDestinationAzure 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 NewLogsArchiveDestinationAzure(container string, integration LogsArchiveIntegrationAzure, storageAccount string, typeVar LogsArchiveDestinationAzureType) *LogsArchiveDestinationAzure { - this := LogsArchiveDestinationAzure{} - this.Container = container - this.Integration = integration - this.StorageAccount = storageAccount - this.Type = typeVar - return &this -} - -// NewLogsArchiveDestinationAzureWithDefaults instantiates a new LogsArchiveDestinationAzure 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 NewLogsArchiveDestinationAzureWithDefaults() *LogsArchiveDestinationAzure { - this := LogsArchiveDestinationAzure{} - var typeVar LogsArchiveDestinationAzureType = LOGSARCHIVEDESTINATIONAZURETYPE_AZURE - this.Type = typeVar - return &this -} - -// GetContainer returns the Container field value. -func (o *LogsArchiveDestinationAzure) GetContainer() string { - if o == nil { - var ret string - return ret - } - return o.Container -} - -// GetContainerOk returns a tuple with the Container field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationAzure) GetContainerOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Container, true -} - -// SetContainer sets field value. -func (o *LogsArchiveDestinationAzure) SetContainer(v string) { - o.Container = v -} - -// GetIntegration returns the Integration field value. -func (o *LogsArchiveDestinationAzure) GetIntegration() LogsArchiveIntegrationAzure { - if o == nil { - var ret LogsArchiveIntegrationAzure - return ret - } - return o.Integration -} - -// GetIntegrationOk returns a tuple with the Integration field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationAzure) GetIntegrationOk() (*LogsArchiveIntegrationAzure, bool) { - if o == nil { - return nil, false - } - return &o.Integration, true -} - -// SetIntegration sets field value. -func (o *LogsArchiveDestinationAzure) SetIntegration(v LogsArchiveIntegrationAzure) { - o.Integration = v -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *LogsArchiveDestinationAzure) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationAzure) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *LogsArchiveDestinationAzure) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *LogsArchiveDestinationAzure) SetPath(v string) { - o.Path = &v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *LogsArchiveDestinationAzure) GetRegion() string { - if o == nil || o.Region == nil { - var ret string - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationAzure) GetRegionOk() (*string, bool) { - if o == nil || o.Region == nil { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *LogsArchiveDestinationAzure) HasRegion() bool { - if o != nil && o.Region != nil { - return true - } - - return false -} - -// SetRegion gets a reference to the given string and assigns it to the Region field. -func (o *LogsArchiveDestinationAzure) SetRegion(v string) { - o.Region = &v -} - -// GetStorageAccount returns the StorageAccount field value. -func (o *LogsArchiveDestinationAzure) GetStorageAccount() string { - if o == nil { - var ret string - return ret - } - return o.StorageAccount -} - -// GetStorageAccountOk returns a tuple with the StorageAccount field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationAzure) GetStorageAccountOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.StorageAccount, true -} - -// SetStorageAccount sets field value. -func (o *LogsArchiveDestinationAzure) SetStorageAccount(v string) { - o.StorageAccount = v -} - -// GetType returns the Type field value. -func (o *LogsArchiveDestinationAzure) GetType() LogsArchiveDestinationAzureType { - if o == nil { - var ret LogsArchiveDestinationAzureType - 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 *LogsArchiveDestinationAzure) GetTypeOk() (*LogsArchiveDestinationAzureType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsArchiveDestinationAzure) SetType(v LogsArchiveDestinationAzureType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveDestinationAzure) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["container"] = o.Container - toSerialize["integration"] = o.Integration - if o.Path != nil { - toSerialize["path"] = o.Path - } - if o.Region != nil { - toSerialize["region"] = o.Region - } - toSerialize["storage_account"] = o.StorageAccount - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Container *string `json:"container"` - Integration *LogsArchiveIntegrationAzure `json:"integration"` - StorageAccount *string `json:"storage_account"` - Type *LogsArchiveDestinationAzureType `json:"type"` - }{} - all := struct { - Container string `json:"container"` - Integration LogsArchiveIntegrationAzure `json:"integration"` - Path *string `json:"path,omitempty"` - Region *string `json:"region,omitempty"` - StorageAccount string `json:"storage_account"` - Type LogsArchiveDestinationAzureType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Container == nil { - return fmt.Errorf("Required field container missing") - } - if required.Integration == nil { - return fmt.Errorf("Required field integration missing") - } - if required.StorageAccount == nil { - return fmt.Errorf("Required field storage_account missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Container = all.Container - if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Integration = all.Integration - o.Path = all.Path - o.Region = all.Region - o.StorageAccount = all.StorageAccount - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_archive_destination_azure_type.go b/api/v2/datadog/model_logs_archive_destination_azure_type.go deleted file mode 100644 index a9a80cd2677..00000000000 --- a/api/v2/datadog/model_logs_archive_destination_azure_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveDestinationAzureType Type of the Azure archive destination. -type LogsArchiveDestinationAzureType string - -// List of LogsArchiveDestinationAzureType. -const ( - LOGSARCHIVEDESTINATIONAZURETYPE_AZURE LogsArchiveDestinationAzureType = "azure" -) - -var allowedLogsArchiveDestinationAzureTypeEnumValues = []LogsArchiveDestinationAzureType{ - LOGSARCHIVEDESTINATIONAZURETYPE_AZURE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsArchiveDestinationAzureType) GetAllowedValues() []LogsArchiveDestinationAzureType { - return allowedLogsArchiveDestinationAzureTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsArchiveDestinationAzureType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsArchiveDestinationAzureType(value) - return nil -} - -// NewLogsArchiveDestinationAzureTypeFromValue returns a pointer to a valid LogsArchiveDestinationAzureType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsArchiveDestinationAzureTypeFromValue(v string) (*LogsArchiveDestinationAzureType, error) { - ev := LogsArchiveDestinationAzureType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsArchiveDestinationAzureType: valid values are %v", v, allowedLogsArchiveDestinationAzureTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsArchiveDestinationAzureType) IsValid() bool { - for _, existing := range allowedLogsArchiveDestinationAzureTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsArchiveDestinationAzureType value. -func (v LogsArchiveDestinationAzureType) Ptr() *LogsArchiveDestinationAzureType { - return &v -} - -// NullableLogsArchiveDestinationAzureType handles when a null is used for LogsArchiveDestinationAzureType. -type NullableLogsArchiveDestinationAzureType struct { - value *LogsArchiveDestinationAzureType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveDestinationAzureType) Get() *LogsArchiveDestinationAzureType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveDestinationAzureType) Set(val *LogsArchiveDestinationAzureType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveDestinationAzureType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveDestinationAzureType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveDestinationAzureType initializes the struct as if Set has been called. -func NewNullableLogsArchiveDestinationAzureType(val *LogsArchiveDestinationAzureType) *NullableLogsArchiveDestinationAzureType { - return &NullableLogsArchiveDestinationAzureType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveDestinationAzureType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveDestinationAzureType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archive_destination_gcs.go b/api/v2/datadog/model_logs_archive_destination_gcs.go deleted file mode 100644 index 2422a5334d3..00000000000 --- a/api/v2/datadog/model_logs_archive_destination_gcs.go +++ /dev/null @@ -1,225 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveDestinationGCS The GCS archive destination. -type LogsArchiveDestinationGCS struct { - // The bucket where the archive will be stored. - Bucket string `json:"bucket"` - // The GCS archive's integration destination. - Integration LogsArchiveIntegrationGCS `json:"integration"` - // The archive path. - Path *string `json:"path,omitempty"` - // Type of the GCS archive destination. - Type LogsArchiveDestinationGCSType `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{} -} - -// NewLogsArchiveDestinationGCS instantiates a new LogsArchiveDestinationGCS 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 NewLogsArchiveDestinationGCS(bucket string, integration LogsArchiveIntegrationGCS, typeVar LogsArchiveDestinationGCSType) *LogsArchiveDestinationGCS { - this := LogsArchiveDestinationGCS{} - this.Bucket = bucket - this.Integration = integration - this.Type = typeVar - return &this -} - -// NewLogsArchiveDestinationGCSWithDefaults instantiates a new LogsArchiveDestinationGCS 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 NewLogsArchiveDestinationGCSWithDefaults() *LogsArchiveDestinationGCS { - this := LogsArchiveDestinationGCS{} - var typeVar LogsArchiveDestinationGCSType = LOGSARCHIVEDESTINATIONGCSTYPE_GCS - this.Type = typeVar - return &this -} - -// GetBucket returns the Bucket field value. -func (o *LogsArchiveDestinationGCS) GetBucket() string { - if o == nil { - var ret string - return ret - } - return o.Bucket -} - -// GetBucketOk returns a tuple with the Bucket field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationGCS) GetBucketOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Bucket, true -} - -// SetBucket sets field value. -func (o *LogsArchiveDestinationGCS) SetBucket(v string) { - o.Bucket = v -} - -// GetIntegration returns the Integration field value. -func (o *LogsArchiveDestinationGCS) GetIntegration() LogsArchiveIntegrationGCS { - if o == nil { - var ret LogsArchiveIntegrationGCS - return ret - } - return o.Integration -} - -// GetIntegrationOk returns a tuple with the Integration field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationGCS) GetIntegrationOk() (*LogsArchiveIntegrationGCS, bool) { - if o == nil { - return nil, false - } - return &o.Integration, true -} - -// SetIntegration sets field value. -func (o *LogsArchiveDestinationGCS) SetIntegration(v LogsArchiveIntegrationGCS) { - o.Integration = v -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *LogsArchiveDestinationGCS) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationGCS) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *LogsArchiveDestinationGCS) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *LogsArchiveDestinationGCS) SetPath(v string) { - o.Path = &v -} - -// GetType returns the Type field value. -func (o *LogsArchiveDestinationGCS) GetType() LogsArchiveDestinationGCSType { - if o == nil { - var ret LogsArchiveDestinationGCSType - 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 *LogsArchiveDestinationGCS) GetTypeOk() (*LogsArchiveDestinationGCSType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsArchiveDestinationGCS) SetType(v LogsArchiveDestinationGCSType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveDestinationGCS) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["bucket"] = o.Bucket - toSerialize["integration"] = o.Integration - if o.Path != nil { - toSerialize["path"] = o.Path - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Bucket *string `json:"bucket"` - Integration *LogsArchiveIntegrationGCS `json:"integration"` - Type *LogsArchiveDestinationGCSType `json:"type"` - }{} - all := struct { - Bucket string `json:"bucket"` - Integration LogsArchiveIntegrationGCS `json:"integration"` - Path *string `json:"path,omitempty"` - Type LogsArchiveDestinationGCSType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Bucket == nil { - return fmt.Errorf("Required field bucket missing") - } - if required.Integration == nil { - return fmt.Errorf("Required field integration missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Bucket = all.Bucket - if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Integration = all.Integration - o.Path = all.Path - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_archive_destination_gcs_type.go b/api/v2/datadog/model_logs_archive_destination_gcs_type.go deleted file mode 100644 index fda9da3717e..00000000000 --- a/api/v2/datadog/model_logs_archive_destination_gcs_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveDestinationGCSType Type of the GCS archive destination. -type LogsArchiveDestinationGCSType string - -// List of LogsArchiveDestinationGCSType. -const ( - LOGSARCHIVEDESTINATIONGCSTYPE_GCS LogsArchiveDestinationGCSType = "gcs" -) - -var allowedLogsArchiveDestinationGCSTypeEnumValues = []LogsArchiveDestinationGCSType{ - LOGSARCHIVEDESTINATIONGCSTYPE_GCS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsArchiveDestinationGCSType) GetAllowedValues() []LogsArchiveDestinationGCSType { - return allowedLogsArchiveDestinationGCSTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsArchiveDestinationGCSType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsArchiveDestinationGCSType(value) - return nil -} - -// NewLogsArchiveDestinationGCSTypeFromValue returns a pointer to a valid LogsArchiveDestinationGCSType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsArchiveDestinationGCSTypeFromValue(v string) (*LogsArchiveDestinationGCSType, error) { - ev := LogsArchiveDestinationGCSType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsArchiveDestinationGCSType: valid values are %v", v, allowedLogsArchiveDestinationGCSTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsArchiveDestinationGCSType) IsValid() bool { - for _, existing := range allowedLogsArchiveDestinationGCSTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsArchiveDestinationGCSType value. -func (v LogsArchiveDestinationGCSType) Ptr() *LogsArchiveDestinationGCSType { - return &v -} - -// NullableLogsArchiveDestinationGCSType handles when a null is used for LogsArchiveDestinationGCSType. -type NullableLogsArchiveDestinationGCSType struct { - value *LogsArchiveDestinationGCSType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveDestinationGCSType) Get() *LogsArchiveDestinationGCSType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveDestinationGCSType) Set(val *LogsArchiveDestinationGCSType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveDestinationGCSType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveDestinationGCSType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveDestinationGCSType initializes the struct as if Set has been called. -func NewNullableLogsArchiveDestinationGCSType(val *LogsArchiveDestinationGCSType) *NullableLogsArchiveDestinationGCSType { - return &NullableLogsArchiveDestinationGCSType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveDestinationGCSType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveDestinationGCSType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archive_destination_s3.go b/api/v2/datadog/model_logs_archive_destination_s3.go deleted file mode 100644 index 60cce5475ff..00000000000 --- a/api/v2/datadog/model_logs_archive_destination_s3.go +++ /dev/null @@ -1,225 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveDestinationS3 The S3 archive destination. -type LogsArchiveDestinationS3 struct { - // The bucket where the archive will be stored. - Bucket string `json:"bucket"` - // The S3 Archive's integration destination. - Integration LogsArchiveIntegrationS3 `json:"integration"` - // The archive path. - Path *string `json:"path,omitempty"` - // Type of the S3 archive destination. - Type LogsArchiveDestinationS3Type `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{} -} - -// NewLogsArchiveDestinationS3 instantiates a new LogsArchiveDestinationS3 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 NewLogsArchiveDestinationS3(bucket string, integration LogsArchiveIntegrationS3, typeVar LogsArchiveDestinationS3Type) *LogsArchiveDestinationS3 { - this := LogsArchiveDestinationS3{} - this.Bucket = bucket - this.Integration = integration - this.Type = typeVar - return &this -} - -// NewLogsArchiveDestinationS3WithDefaults instantiates a new LogsArchiveDestinationS3 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 NewLogsArchiveDestinationS3WithDefaults() *LogsArchiveDestinationS3 { - this := LogsArchiveDestinationS3{} - var typeVar LogsArchiveDestinationS3Type = LOGSARCHIVEDESTINATIONS3TYPE_S3 - this.Type = typeVar - return &this -} - -// GetBucket returns the Bucket field value. -func (o *LogsArchiveDestinationS3) GetBucket() string { - if o == nil { - var ret string - return ret - } - return o.Bucket -} - -// GetBucketOk returns a tuple with the Bucket field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationS3) GetBucketOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Bucket, true -} - -// SetBucket sets field value. -func (o *LogsArchiveDestinationS3) SetBucket(v string) { - o.Bucket = v -} - -// GetIntegration returns the Integration field value. -func (o *LogsArchiveDestinationS3) GetIntegration() LogsArchiveIntegrationS3 { - if o == nil { - var ret LogsArchiveIntegrationS3 - return ret - } - return o.Integration -} - -// GetIntegrationOk returns a tuple with the Integration field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationS3) GetIntegrationOk() (*LogsArchiveIntegrationS3, bool) { - if o == nil { - return nil, false - } - return &o.Integration, true -} - -// SetIntegration sets field value. -func (o *LogsArchiveDestinationS3) SetIntegration(v LogsArchiveIntegrationS3) { - o.Integration = v -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *LogsArchiveDestinationS3) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveDestinationS3) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *LogsArchiveDestinationS3) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *LogsArchiveDestinationS3) SetPath(v string) { - o.Path = &v -} - -// GetType returns the Type field value. -func (o *LogsArchiveDestinationS3) GetType() LogsArchiveDestinationS3Type { - if o == nil { - var ret LogsArchiveDestinationS3Type - 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 *LogsArchiveDestinationS3) GetTypeOk() (*LogsArchiveDestinationS3Type, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsArchiveDestinationS3) SetType(v LogsArchiveDestinationS3Type) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveDestinationS3) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["bucket"] = o.Bucket - toSerialize["integration"] = o.Integration - if o.Path != nil { - toSerialize["path"] = o.Path - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Bucket *string `json:"bucket"` - Integration *LogsArchiveIntegrationS3 `json:"integration"` - Type *LogsArchiveDestinationS3Type `json:"type"` - }{} - all := struct { - Bucket string `json:"bucket"` - Integration LogsArchiveIntegrationS3 `json:"integration"` - Path *string `json:"path,omitempty"` - Type LogsArchiveDestinationS3Type `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Bucket == nil { - return fmt.Errorf("Required field bucket missing") - } - if required.Integration == nil { - return fmt.Errorf("Required field integration missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Bucket = all.Bucket - if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Integration = all.Integration - o.Path = all.Path - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_archive_destination_s3_type.go b/api/v2/datadog/model_logs_archive_destination_s3_type.go deleted file mode 100644 index 140b65c646c..00000000000 --- a/api/v2/datadog/model_logs_archive_destination_s3_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveDestinationS3Type Type of the S3 archive destination. -type LogsArchiveDestinationS3Type string - -// List of LogsArchiveDestinationS3Type. -const ( - LOGSARCHIVEDESTINATIONS3TYPE_S3 LogsArchiveDestinationS3Type = "s3" -) - -var allowedLogsArchiveDestinationS3TypeEnumValues = []LogsArchiveDestinationS3Type{ - LOGSARCHIVEDESTINATIONS3TYPE_S3, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsArchiveDestinationS3Type) GetAllowedValues() []LogsArchiveDestinationS3Type { - return allowedLogsArchiveDestinationS3TypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsArchiveDestinationS3Type) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsArchiveDestinationS3Type(value) - return nil -} - -// NewLogsArchiveDestinationS3TypeFromValue returns a pointer to a valid LogsArchiveDestinationS3Type -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsArchiveDestinationS3TypeFromValue(v string) (*LogsArchiveDestinationS3Type, error) { - ev := LogsArchiveDestinationS3Type(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsArchiveDestinationS3Type: valid values are %v", v, allowedLogsArchiveDestinationS3TypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsArchiveDestinationS3Type) IsValid() bool { - for _, existing := range allowedLogsArchiveDestinationS3TypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsArchiveDestinationS3Type value. -func (v LogsArchiveDestinationS3Type) Ptr() *LogsArchiveDestinationS3Type { - return &v -} - -// NullableLogsArchiveDestinationS3Type handles when a null is used for LogsArchiveDestinationS3Type. -type NullableLogsArchiveDestinationS3Type struct { - value *LogsArchiveDestinationS3Type - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveDestinationS3Type) Get() *LogsArchiveDestinationS3Type { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveDestinationS3Type) Set(val *LogsArchiveDestinationS3Type) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveDestinationS3Type) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveDestinationS3Type) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveDestinationS3Type initializes the struct as if Set has been called. -func NewNullableLogsArchiveDestinationS3Type(val *LogsArchiveDestinationS3Type) *NullableLogsArchiveDestinationS3Type { - return &NullableLogsArchiveDestinationS3Type{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveDestinationS3Type) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveDestinationS3Type) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archive_integration_azure.go b/api/v2/datadog/model_logs_archive_integration_azure.go deleted file mode 100644 index 989efc42a01..00000000000 --- a/api/v2/datadog/model_logs_archive_integration_azure.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveIntegrationAzure The Azure archive's integration destination. -type LogsArchiveIntegrationAzure struct { - // A client ID. - ClientId string `json:"client_id"` - // A tenant ID. - TenantId string `json:"tenant_id"` - // 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{} -} - -// NewLogsArchiveIntegrationAzure instantiates a new LogsArchiveIntegrationAzure 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 NewLogsArchiveIntegrationAzure(clientId string, tenantId string) *LogsArchiveIntegrationAzure { - this := LogsArchiveIntegrationAzure{} - this.ClientId = clientId - this.TenantId = tenantId - return &this -} - -// NewLogsArchiveIntegrationAzureWithDefaults instantiates a new LogsArchiveIntegrationAzure 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 NewLogsArchiveIntegrationAzureWithDefaults() *LogsArchiveIntegrationAzure { - this := LogsArchiveIntegrationAzure{} - return &this -} - -// GetClientId returns the ClientId field value. -func (o *LogsArchiveIntegrationAzure) GetClientId() string { - if o == nil { - var ret string - return ret - } - return o.ClientId -} - -// GetClientIdOk returns a tuple with the ClientId field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveIntegrationAzure) GetClientIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ClientId, true -} - -// SetClientId sets field value. -func (o *LogsArchiveIntegrationAzure) SetClientId(v string) { - o.ClientId = v -} - -// GetTenantId returns the TenantId field value. -func (o *LogsArchiveIntegrationAzure) GetTenantId() string { - if o == nil { - var ret string - return ret - } - return o.TenantId -} - -// GetTenantIdOk returns a tuple with the TenantId field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveIntegrationAzure) GetTenantIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.TenantId, true -} - -// SetTenantId sets field value. -func (o *LogsArchiveIntegrationAzure) SetTenantId(v string) { - o.TenantId = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveIntegrationAzure) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["client_id"] = o.ClientId - toSerialize["tenant_id"] = o.TenantId - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveIntegrationAzure) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ClientId *string `json:"client_id"` - TenantId *string `json:"tenant_id"` - }{} - all := struct { - ClientId string `json:"client_id"` - TenantId string `json:"tenant_id"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ClientId == nil { - return fmt.Errorf("Required field client_id missing") - } - if required.TenantId == nil { - return fmt.Errorf("Required field tenant_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ClientId = all.ClientId - o.TenantId = all.TenantId - return nil -} diff --git a/api/v2/datadog/model_logs_archive_integration_gcs.go b/api/v2/datadog/model_logs_archive_integration_gcs.go deleted file mode 100644 index a738b9fa97e..00000000000 --- a/api/v2/datadog/model_logs_archive_integration_gcs.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveIntegrationGCS The GCS archive's integration destination. -type LogsArchiveIntegrationGCS struct { - // A client email. - ClientEmail string `json:"client_email"` - // A project ID. - ProjectId string `json:"project_id"` - // 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{} -} - -// NewLogsArchiveIntegrationGCS instantiates a new LogsArchiveIntegrationGCS 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 NewLogsArchiveIntegrationGCS(clientEmail string, projectId string) *LogsArchiveIntegrationGCS { - this := LogsArchiveIntegrationGCS{} - this.ClientEmail = clientEmail - this.ProjectId = projectId - return &this -} - -// NewLogsArchiveIntegrationGCSWithDefaults instantiates a new LogsArchiveIntegrationGCS 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 NewLogsArchiveIntegrationGCSWithDefaults() *LogsArchiveIntegrationGCS { - this := LogsArchiveIntegrationGCS{} - return &this -} - -// GetClientEmail returns the ClientEmail field value. -func (o *LogsArchiveIntegrationGCS) GetClientEmail() string { - if o == nil { - var ret string - return ret - } - return o.ClientEmail -} - -// GetClientEmailOk returns a tuple with the ClientEmail field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveIntegrationGCS) GetClientEmailOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ClientEmail, true -} - -// SetClientEmail sets field value. -func (o *LogsArchiveIntegrationGCS) SetClientEmail(v string) { - o.ClientEmail = v -} - -// GetProjectId returns the ProjectId field value. -func (o *LogsArchiveIntegrationGCS) GetProjectId() string { - if o == nil { - var ret string - return ret - } - return o.ProjectId -} - -// GetProjectIdOk returns a tuple with the ProjectId field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveIntegrationGCS) GetProjectIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ProjectId, true -} - -// SetProjectId sets field value. -func (o *LogsArchiveIntegrationGCS) SetProjectId(v string) { - o.ProjectId = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveIntegrationGCS) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["client_email"] = o.ClientEmail - toSerialize["project_id"] = o.ProjectId - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveIntegrationGCS) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ClientEmail *string `json:"client_email"` - ProjectId *string `json:"project_id"` - }{} - all := struct { - ClientEmail string `json:"client_email"` - ProjectId string `json:"project_id"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ClientEmail == nil { - return fmt.Errorf("Required field client_email missing") - } - if required.ProjectId == nil { - return fmt.Errorf("Required field project_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ClientEmail = all.ClientEmail - o.ProjectId = all.ProjectId - return nil -} diff --git a/api/v2/datadog/model_logs_archive_integration_s3.go b/api/v2/datadog/model_logs_archive_integration_s3.go deleted file mode 100644 index 2dc1b59dbaa..00000000000 --- a/api/v2/datadog/model_logs_archive_integration_s3.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveIntegrationS3 The S3 Archive's integration destination. -type LogsArchiveIntegrationS3 struct { - // The account ID for the integration. - AccountId string `json:"account_id"` - // The path of the integration. - RoleName string `json:"role_name"` - // 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{} -} - -// NewLogsArchiveIntegrationS3 instantiates a new LogsArchiveIntegrationS3 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 NewLogsArchiveIntegrationS3(accountId string, roleName string) *LogsArchiveIntegrationS3 { - this := LogsArchiveIntegrationS3{} - this.AccountId = accountId - this.RoleName = roleName - return &this -} - -// NewLogsArchiveIntegrationS3WithDefaults instantiates a new LogsArchiveIntegrationS3 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 NewLogsArchiveIntegrationS3WithDefaults() *LogsArchiveIntegrationS3 { - this := LogsArchiveIntegrationS3{} - return &this -} - -// GetAccountId returns the AccountId field value. -func (o *LogsArchiveIntegrationS3) GetAccountId() string { - if o == nil { - var ret string - return ret - } - return o.AccountId -} - -// GetAccountIdOk returns a tuple with the AccountId field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveIntegrationS3) GetAccountIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.AccountId, true -} - -// SetAccountId sets field value. -func (o *LogsArchiveIntegrationS3) SetAccountId(v string) { - o.AccountId = v -} - -// GetRoleName returns the RoleName field value. -func (o *LogsArchiveIntegrationS3) GetRoleName() string { - if o == nil { - var ret string - return ret - } - return o.RoleName -} - -// GetRoleNameOk returns a tuple with the RoleName field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveIntegrationS3) GetRoleNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.RoleName, true -} - -// SetRoleName sets field value. -func (o *LogsArchiveIntegrationS3) SetRoleName(v string) { - o.RoleName = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveIntegrationS3) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["account_id"] = o.AccountId - toSerialize["role_name"] = o.RoleName - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveIntegrationS3) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - AccountId *string `json:"account_id"` - RoleName *string `json:"role_name"` - }{} - all := struct { - AccountId string `json:"account_id"` - RoleName string `json:"role_name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccountId == nil { - return fmt.Errorf("Required field account_id missing") - } - if required.RoleName == nil { - return fmt.Errorf("Required field role_name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AccountId = all.AccountId - o.RoleName = all.RoleName - return nil -} diff --git a/api/v2/datadog/model_logs_archive_order.go b/api/v2/datadog/model_logs_archive_order.go deleted file mode 100644 index 9555760dbae..00000000000 --- a/api/v2/datadog/model_logs_archive_order.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsArchiveOrder A ordered list of archive IDs. -type LogsArchiveOrder struct { - // The definition of an archive order. - Data *LogsArchiveOrderDefinition `json:"data,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{} -} - -// NewLogsArchiveOrder instantiates a new LogsArchiveOrder 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 NewLogsArchiveOrder() *LogsArchiveOrder { - this := LogsArchiveOrder{} - return &this -} - -// NewLogsArchiveOrderWithDefaults instantiates a new LogsArchiveOrder 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 NewLogsArchiveOrderWithDefaults() *LogsArchiveOrder { - this := LogsArchiveOrder{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsArchiveOrder) GetData() LogsArchiveOrderDefinition { - if o == nil || o.Data == nil { - var ret LogsArchiveOrderDefinition - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchiveOrder) GetDataOk() (*LogsArchiveOrderDefinition, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsArchiveOrder) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given LogsArchiveOrderDefinition and assigns it to the Data field. -func (o *LogsArchiveOrder) SetData(v LogsArchiveOrderDefinition) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveOrder) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveOrder) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *LogsArchiveOrderDefinition `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_archive_order_attributes.go b/api/v2/datadog/model_logs_archive_order_attributes.go deleted file mode 100644 index 9d5dca49f72..00000000000 --- a/api/v2/datadog/model_logs_archive_order_attributes.go +++ /dev/null @@ -1,104 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveOrderAttributes The attributes associated with the archive order. -type LogsArchiveOrderAttributes struct { - // An ordered array of `` strings, the order of archive IDs in the array - // define the overall archives order for Datadog. - ArchiveIds []string `json:"archive_ids"` - // 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{} -} - -// NewLogsArchiveOrderAttributes instantiates a new LogsArchiveOrderAttributes 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 NewLogsArchiveOrderAttributes(archiveIds []string) *LogsArchiveOrderAttributes { - this := LogsArchiveOrderAttributes{} - this.ArchiveIds = archiveIds - return &this -} - -// NewLogsArchiveOrderAttributesWithDefaults instantiates a new LogsArchiveOrderAttributes 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 NewLogsArchiveOrderAttributesWithDefaults() *LogsArchiveOrderAttributes { - this := LogsArchiveOrderAttributes{} - return &this -} - -// GetArchiveIds returns the ArchiveIds field value. -func (o *LogsArchiveOrderAttributes) GetArchiveIds() []string { - if o == nil { - var ret []string - return ret - } - return o.ArchiveIds -} - -// GetArchiveIdsOk returns a tuple with the ArchiveIds field value -// and a boolean to check if the value has been set. -func (o *LogsArchiveOrderAttributes) GetArchiveIdsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.ArchiveIds, true -} - -// SetArchiveIds sets field value. -func (o *LogsArchiveOrderAttributes) SetArchiveIds(v []string) { - o.ArchiveIds = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveOrderAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["archive_ids"] = o.ArchiveIds - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveOrderAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ArchiveIds *[]string `json:"archive_ids"` - }{} - all := struct { - ArchiveIds []string `json:"archive_ids"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ArchiveIds == nil { - return fmt.Errorf("Required field archive_ids missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ArchiveIds = all.ArchiveIds - return nil -} diff --git a/api/v2/datadog/model_logs_archive_order_definition.go b/api/v2/datadog/model_logs_archive_order_definition.go deleted file mode 100644 index 20fdbb6a6e3..00000000000 --- a/api/v2/datadog/model_logs_archive_order_definition.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveOrderDefinition The definition of an archive order. -type LogsArchiveOrderDefinition struct { - // The attributes associated with the archive order. - Attributes LogsArchiveOrderAttributes `json:"attributes"` - // Type of the archive order definition. - Type LogsArchiveOrderDefinitionType `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{} -} - -// NewLogsArchiveOrderDefinition instantiates a new LogsArchiveOrderDefinition 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 NewLogsArchiveOrderDefinition(attributes LogsArchiveOrderAttributes, typeVar LogsArchiveOrderDefinitionType) *LogsArchiveOrderDefinition { - this := LogsArchiveOrderDefinition{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewLogsArchiveOrderDefinitionWithDefaults instantiates a new LogsArchiveOrderDefinition 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 NewLogsArchiveOrderDefinitionWithDefaults() *LogsArchiveOrderDefinition { - this := LogsArchiveOrderDefinition{} - var typeVar LogsArchiveOrderDefinitionType = LOGSARCHIVEORDERDEFINITIONTYPE_ARCHIVE_ORDER - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *LogsArchiveOrderDefinition) GetAttributes() LogsArchiveOrderAttributes { - if o == nil { - var ret LogsArchiveOrderAttributes - 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 *LogsArchiveOrderDefinition) GetAttributesOk() (*LogsArchiveOrderAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *LogsArchiveOrderDefinition) SetAttributes(v LogsArchiveOrderAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *LogsArchiveOrderDefinition) GetType() LogsArchiveOrderDefinitionType { - if o == nil { - var ret LogsArchiveOrderDefinitionType - 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 *LogsArchiveOrderDefinition) GetTypeOk() (*LogsArchiveOrderDefinitionType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsArchiveOrderDefinition) SetType(v LogsArchiveOrderDefinitionType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchiveOrderDefinition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchiveOrderDefinition) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *LogsArchiveOrderAttributes `json:"attributes"` - Type *LogsArchiveOrderDefinitionType `json:"type"` - }{} - all := struct { - Attributes LogsArchiveOrderAttributes `json:"attributes"` - Type LogsArchiveOrderDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_archive_order_definition_type.go b/api/v2/datadog/model_logs_archive_order_definition_type.go deleted file mode 100644 index 30d1d8f555a..00000000000 --- a/api/v2/datadog/model_logs_archive_order_definition_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveOrderDefinitionType Type of the archive order definition. -type LogsArchiveOrderDefinitionType string - -// List of LogsArchiveOrderDefinitionType. -const ( - LOGSARCHIVEORDERDEFINITIONTYPE_ARCHIVE_ORDER LogsArchiveOrderDefinitionType = "archive_order" -) - -var allowedLogsArchiveOrderDefinitionTypeEnumValues = []LogsArchiveOrderDefinitionType{ - LOGSARCHIVEORDERDEFINITIONTYPE_ARCHIVE_ORDER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsArchiveOrderDefinitionType) GetAllowedValues() []LogsArchiveOrderDefinitionType { - return allowedLogsArchiveOrderDefinitionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsArchiveOrderDefinitionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsArchiveOrderDefinitionType(value) - return nil -} - -// NewLogsArchiveOrderDefinitionTypeFromValue returns a pointer to a valid LogsArchiveOrderDefinitionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsArchiveOrderDefinitionTypeFromValue(v string) (*LogsArchiveOrderDefinitionType, error) { - ev := LogsArchiveOrderDefinitionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsArchiveOrderDefinitionType: valid values are %v", v, allowedLogsArchiveOrderDefinitionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsArchiveOrderDefinitionType) IsValid() bool { - for _, existing := range allowedLogsArchiveOrderDefinitionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsArchiveOrderDefinitionType value. -func (v LogsArchiveOrderDefinitionType) Ptr() *LogsArchiveOrderDefinitionType { - return &v -} - -// NullableLogsArchiveOrderDefinitionType handles when a null is used for LogsArchiveOrderDefinitionType. -type NullableLogsArchiveOrderDefinitionType struct { - value *LogsArchiveOrderDefinitionType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveOrderDefinitionType) Get() *LogsArchiveOrderDefinitionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveOrderDefinitionType) Set(val *LogsArchiveOrderDefinitionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveOrderDefinitionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveOrderDefinitionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveOrderDefinitionType initializes the struct as if Set has been called. -func NewNullableLogsArchiveOrderDefinitionType(val *LogsArchiveOrderDefinitionType) *NullableLogsArchiveOrderDefinitionType { - return &NullableLogsArchiveOrderDefinitionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveOrderDefinitionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveOrderDefinitionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archive_state.go b/api/v2/datadog/model_logs_archive_state.go deleted file mode 100644 index 28cac94a1fe..00000000000 --- a/api/v2/datadog/model_logs_archive_state.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsArchiveState The state of the archive. -type LogsArchiveState string - -// List of LogsArchiveState. -const ( - LOGSARCHIVESTATE_UNKNOWN LogsArchiveState = "UNKNOWN" - LOGSARCHIVESTATE_WORKING LogsArchiveState = "WORKING" - LOGSARCHIVESTATE_FAILING LogsArchiveState = "FAILING" - LOGSARCHIVESTATE_WORKING_AUTH_LEGACY LogsArchiveState = "WORKING_AUTH_LEGACY" -) - -var allowedLogsArchiveStateEnumValues = []LogsArchiveState{ - LOGSARCHIVESTATE_UNKNOWN, - LOGSARCHIVESTATE_WORKING, - LOGSARCHIVESTATE_FAILING, - LOGSARCHIVESTATE_WORKING_AUTH_LEGACY, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsArchiveState) GetAllowedValues() []LogsArchiveState { - return allowedLogsArchiveStateEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsArchiveState) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsArchiveState(value) - return nil -} - -// NewLogsArchiveStateFromValue returns a pointer to a valid LogsArchiveState -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsArchiveStateFromValue(v string) (*LogsArchiveState, error) { - ev := LogsArchiveState(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsArchiveState: valid values are %v", v, allowedLogsArchiveStateEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsArchiveState) IsValid() bool { - for _, existing := range allowedLogsArchiveStateEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsArchiveState value. -func (v LogsArchiveState) Ptr() *LogsArchiveState { - return &v -} - -// NullableLogsArchiveState handles when a null is used for LogsArchiveState. -type NullableLogsArchiveState struct { - value *LogsArchiveState - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsArchiveState) Get() *LogsArchiveState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsArchiveState) Set(val *LogsArchiveState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsArchiveState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsArchiveState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsArchiveState initializes the struct as if Set has been called. -func NewNullableLogsArchiveState(val *LogsArchiveState) *NullableLogsArchiveState { - return &NullableLogsArchiveState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsArchiveState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsArchiveState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_archives.go b/api/v2/datadog/model_logs_archives.go deleted file mode 100644 index 9878317c3f9..00000000000 --- a/api/v2/datadog/model_logs_archives.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsArchives The available archives. -type LogsArchives struct { - // A list of archives. - Data []LogsArchiveDefinition `json:"data,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{} -} - -// NewLogsArchives instantiates a new LogsArchives 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 NewLogsArchives() *LogsArchives { - this := LogsArchives{} - return &this -} - -// NewLogsArchivesWithDefaults instantiates a new LogsArchives 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 NewLogsArchivesWithDefaults() *LogsArchives { - this := LogsArchives{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsArchives) GetData() []LogsArchiveDefinition { - if o == nil || o.Data == nil { - var ret []LogsArchiveDefinition - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsArchives) GetDataOk() (*[]LogsArchiveDefinition, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsArchives) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []LogsArchiveDefinition and assigns it to the Data field. -func (o *LogsArchives) SetData(v []LogsArchiveDefinition) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsArchives) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsArchives) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []LogsArchiveDefinition `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_compute.go b/api/v2/datadog/model_logs_compute.go deleted file mode 100644 index 2dcada64fc2..00000000000 --- a/api/v2/datadog/model_logs_compute.go +++ /dev/null @@ -1,241 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsCompute A compute rule to compute metrics or timeseries -type LogsCompute struct { - // An aggregation function - Aggregation LogsAggregationFunction `json:"aggregation"` - // The time buckets' size (only used for type=timeseries) - // Defaults to a resolution of 150 points - Interval *string `json:"interval,omitempty"` - // The metric to use - Metric *string `json:"metric,omitempty"` - // The type of compute - Type *LogsComputeType `json:"type,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{} -} - -// NewLogsCompute instantiates a new LogsCompute 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 NewLogsCompute(aggregation LogsAggregationFunction) *LogsCompute { - this := LogsCompute{} - this.Aggregation = aggregation - var typeVar LogsComputeType = LOGSCOMPUTETYPE_TOTAL - this.Type = &typeVar - return &this -} - -// NewLogsComputeWithDefaults instantiates a new LogsCompute 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 NewLogsComputeWithDefaults() *LogsCompute { - this := LogsCompute{} - var typeVar LogsComputeType = LOGSCOMPUTETYPE_TOTAL - this.Type = &typeVar - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *LogsCompute) GetAggregation() LogsAggregationFunction { - if o == nil { - var ret LogsAggregationFunction - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *LogsCompute) GetAggregationOk() (*LogsAggregationFunction, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *LogsCompute) SetAggregation(v LogsAggregationFunction) { - o.Aggregation = v -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *LogsCompute) GetInterval() string { - if o == nil || o.Interval == nil { - var ret string - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsCompute) GetIntervalOk() (*string, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *LogsCompute) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given string and assigns it to the Interval field. -func (o *LogsCompute) SetInterval(v string) { - o.Interval = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *LogsCompute) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsCompute) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *LogsCompute) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *LogsCompute) SetMetric(v string) { - o.Metric = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *LogsCompute) GetType() LogsComputeType { - if o == nil || o.Type == nil { - var ret LogsComputeType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsCompute) GetTypeOk() (*LogsComputeType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *LogsCompute) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given LogsComputeType and assigns it to the Type field. -func (o *LogsCompute) SetType(v LogsComputeType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsCompute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *LogsAggregationFunction `json:"aggregation"` - }{} - all := struct { - Aggregation LogsAggregationFunction `json:"aggregation"` - Interval *string `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` - Type *LogsComputeType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Interval = all.Interval - o.Metric = all.Metric - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_compute_type.go b/api/v2/datadog/model_logs_compute_type.go deleted file mode 100644 index 5628de4f0a3..00000000000 --- a/api/v2/datadog/model_logs_compute_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsComputeType The type of compute -type LogsComputeType string - -// List of LogsComputeType. -const ( - LOGSCOMPUTETYPE_TIMESERIES LogsComputeType = "timeseries" - LOGSCOMPUTETYPE_TOTAL LogsComputeType = "total" -) - -var allowedLogsComputeTypeEnumValues = []LogsComputeType{ - LOGSCOMPUTETYPE_TIMESERIES, - LOGSCOMPUTETYPE_TOTAL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsComputeType) GetAllowedValues() []LogsComputeType { - return allowedLogsComputeTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsComputeType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsComputeType(value) - return nil -} - -// NewLogsComputeTypeFromValue returns a pointer to a valid LogsComputeType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsComputeTypeFromValue(v string) (*LogsComputeType, error) { - ev := LogsComputeType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsComputeType: valid values are %v", v, allowedLogsComputeTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsComputeType) IsValid() bool { - for _, existing := range allowedLogsComputeTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsComputeType value. -func (v LogsComputeType) Ptr() *LogsComputeType { - return &v -} - -// NullableLogsComputeType handles when a null is used for LogsComputeType. -type NullableLogsComputeType struct { - value *LogsComputeType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsComputeType) Get() *LogsComputeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsComputeType) Set(val *LogsComputeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsComputeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsComputeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsComputeType initializes the struct as if Set has been called. -func NewNullableLogsComputeType(val *LogsComputeType) *NullableLogsComputeType { - return &NullableLogsComputeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsComputeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsComputeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_group_by.go b/api/v2/datadog/model_logs_group_by.go deleted file mode 100644 index 3b7e8ec0251..00000000000 --- a/api/v2/datadog/model_logs_group_by.go +++ /dev/null @@ -1,317 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsGroupBy A group by rule -type LogsGroupBy struct { - // The name of the facet to use (required) - Facet string `json:"facet"` - // Used to perform a histogram computation (only for measure facets). - // Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. - Histogram *LogsGroupByHistogram `json:"histogram,omitempty"` - // The maximum buckets to return for this group by - Limit *int64 `json:"limit,omitempty"` - // The value to use for logs that don't have the facet used to group by - Missing *LogsGroupByMissing `json:"missing,omitempty"` - // A sort rule - Sort *LogsAggregateSort `json:"sort,omitempty"` - // A resulting object to put the given computes in over all the matching records. - Total *LogsGroupByTotal `json:"total,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{} -} - -// NewLogsGroupBy instantiates a new LogsGroupBy 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 NewLogsGroupBy(facet string) *LogsGroupBy { - this := LogsGroupBy{} - this.Facet = facet - var limit int64 = 10 - this.Limit = &limit - return &this -} - -// NewLogsGroupByWithDefaults instantiates a new LogsGroupBy 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 NewLogsGroupByWithDefaults() *LogsGroupBy { - this := LogsGroupBy{} - var limit int64 = 10 - this.Limit = &limit - return &this -} - -// GetFacet returns the Facet field value. -func (o *LogsGroupBy) GetFacet() string { - if o == nil { - var ret string - return ret - } - return o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value -// and a boolean to check if the value has been set. -func (o *LogsGroupBy) GetFacetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Facet, true -} - -// SetFacet sets field value. -func (o *LogsGroupBy) SetFacet(v string) { - o.Facet = v -} - -// GetHistogram returns the Histogram field value if set, zero value otherwise. -func (o *LogsGroupBy) GetHistogram() LogsGroupByHistogram { - if o == nil || o.Histogram == nil { - var ret LogsGroupByHistogram - return ret - } - return *o.Histogram -} - -// GetHistogramOk returns a tuple with the Histogram field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGroupBy) GetHistogramOk() (*LogsGroupByHistogram, bool) { - if o == nil || o.Histogram == nil { - return nil, false - } - return o.Histogram, true -} - -// HasHistogram returns a boolean if a field has been set. -func (o *LogsGroupBy) HasHistogram() bool { - if o != nil && o.Histogram != nil { - return true - } - - return false -} - -// SetHistogram gets a reference to the given LogsGroupByHistogram and assigns it to the Histogram field. -func (o *LogsGroupBy) SetHistogram(v LogsGroupByHistogram) { - o.Histogram = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *LogsGroupBy) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGroupBy) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *LogsGroupBy) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *LogsGroupBy) SetLimit(v int64) { - o.Limit = &v -} - -// GetMissing returns the Missing field value if set, zero value otherwise. -func (o *LogsGroupBy) GetMissing() LogsGroupByMissing { - if o == nil || o.Missing == nil { - var ret LogsGroupByMissing - return ret - } - return *o.Missing -} - -// GetMissingOk returns a tuple with the Missing field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGroupBy) GetMissingOk() (*LogsGroupByMissing, bool) { - if o == nil || o.Missing == nil { - return nil, false - } - return o.Missing, true -} - -// HasMissing returns a boolean if a field has been set. -func (o *LogsGroupBy) HasMissing() bool { - if o != nil && o.Missing != nil { - return true - } - - return false -} - -// SetMissing gets a reference to the given LogsGroupByMissing and assigns it to the Missing field. -func (o *LogsGroupBy) SetMissing(v LogsGroupByMissing) { - o.Missing = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *LogsGroupBy) GetSort() LogsAggregateSort { - if o == nil || o.Sort == nil { - var ret LogsAggregateSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGroupBy) GetSortOk() (*LogsAggregateSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *LogsGroupBy) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given LogsAggregateSort and assigns it to the Sort field. -func (o *LogsGroupBy) SetSort(v LogsAggregateSort) { - o.Sort = &v -} - -// GetTotal returns the Total field value if set, zero value otherwise. -func (o *LogsGroupBy) GetTotal() LogsGroupByTotal { - if o == nil || o.Total == nil { - var ret LogsGroupByTotal - return ret - } - return *o.Total -} - -// GetTotalOk returns a tuple with the Total field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsGroupBy) GetTotalOk() (*LogsGroupByTotal, bool) { - if o == nil || o.Total == nil { - return nil, false - } - return o.Total, true -} - -// HasTotal returns a boolean if a field has been set. -func (o *LogsGroupBy) HasTotal() bool { - if o != nil && o.Total != nil { - return true - } - - return false -} - -// SetTotal gets a reference to the given LogsGroupByTotal and assigns it to the Total field. -func (o *LogsGroupBy) SetTotal(v LogsGroupByTotal) { - o.Total = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsGroupBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["facet"] = o.Facet - if o.Histogram != nil { - toSerialize["histogram"] = o.Histogram - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.Missing != nil { - toSerialize["missing"] = o.Missing - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - if o.Total != nil { - toSerialize["total"] = o.Total - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} - all := struct { - Facet string `json:"facet"` - Histogram *LogsGroupByHistogram `json:"histogram,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Missing *LogsGroupByMissing `json:"missing,omitempty"` - Sort *LogsAggregateSort `json:"sort,omitempty"` - Total *LogsGroupByTotal `json:"total,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("Required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Facet = all.Facet - if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Histogram = all.Histogram - o.Limit = all.Limit - o.Missing = all.Missing - if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Sort = all.Sort - o.Total = all.Total - return nil -} diff --git a/api/v2/datadog/model_logs_group_by_histogram.go b/api/v2/datadog/model_logs_group_by_histogram.go deleted file mode 100644 index f777cce9702..00000000000 --- a/api/v2/datadog/model_logs_group_by_histogram.go +++ /dev/null @@ -1,172 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsGroupByHistogram Used to perform a histogram computation (only for measure facets). -// Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. -type LogsGroupByHistogram struct { - // The bin size of the histogram buckets - Interval float64 `json:"interval"` - // The maximum value for the measure used in the histogram - // (values greater than this one are filtered out) - Max float64 `json:"max"` - // The minimum value for the measure used in the histogram - // (values smaller than this one are filtered out) - Min float64 `json:"min"` - // 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{} -} - -// NewLogsGroupByHistogram instantiates a new LogsGroupByHistogram 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 NewLogsGroupByHistogram(interval float64, max float64, min float64) *LogsGroupByHistogram { - this := LogsGroupByHistogram{} - this.Interval = interval - this.Max = max - this.Min = min - return &this -} - -// NewLogsGroupByHistogramWithDefaults instantiates a new LogsGroupByHistogram 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 NewLogsGroupByHistogramWithDefaults() *LogsGroupByHistogram { - this := LogsGroupByHistogram{} - return &this -} - -// GetInterval returns the Interval field value. -func (o *LogsGroupByHistogram) GetInterval() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value -// and a boolean to check if the value has been set. -func (o *LogsGroupByHistogram) GetIntervalOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Interval, true -} - -// SetInterval sets field value. -func (o *LogsGroupByHistogram) SetInterval(v float64) { - o.Interval = v -} - -// GetMax returns the Max field value. -func (o *LogsGroupByHistogram) GetMax() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Max -} - -// GetMaxOk returns a tuple with the Max field value -// and a boolean to check if the value has been set. -func (o *LogsGroupByHistogram) GetMaxOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Max, true -} - -// SetMax sets field value. -func (o *LogsGroupByHistogram) SetMax(v float64) { - o.Max = v -} - -// GetMin returns the Min field value. -func (o *LogsGroupByHistogram) GetMin() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Min -} - -// GetMinOk returns a tuple with the Min field value -// and a boolean to check if the value has been set. -func (o *LogsGroupByHistogram) GetMinOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Min, true -} - -// SetMin sets field value. -func (o *LogsGroupByHistogram) SetMin(v float64) { - o.Min = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsGroupByHistogram) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["interval"] = o.Interval - toSerialize["max"] = o.Max - toSerialize["min"] = o.Min - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Interval *float64 `json:"interval"` - Max *float64 `json:"max"` - Min *float64 `json:"min"` - }{} - all := struct { - Interval float64 `json:"interval"` - Max float64 `json:"max"` - Min float64 `json:"min"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Interval == nil { - return fmt.Errorf("Required field interval missing") - } - if required.Max == nil { - return fmt.Errorf("Required field max missing") - } - if required.Min == nil { - return fmt.Errorf("Required field min missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Interval = all.Interval - o.Max = all.Max - o.Min = all.Min - return nil -} diff --git a/api/v2/datadog/model_logs_group_by_missing.go b/api/v2/datadog/model_logs_group_by_missing.go deleted file mode 100644 index 1d4f3356348..00000000000 --- a/api/v2/datadog/model_logs_group_by_missing.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsGroupByMissing - The value to use for logs that don't have the facet used to group by -type LogsGroupByMissing struct { - LogsGroupByMissingString *string - LogsGroupByMissingNumber *float64 - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// LogsGroupByMissingStringAsLogsGroupByMissing is a convenience function that returns string wrapped in LogsGroupByMissing. -func LogsGroupByMissingStringAsLogsGroupByMissing(v *string) LogsGroupByMissing { - return LogsGroupByMissing{LogsGroupByMissingString: v} -} - -// LogsGroupByMissingNumberAsLogsGroupByMissing is a convenience function that returns float64 wrapped in LogsGroupByMissing. -func LogsGroupByMissingNumberAsLogsGroupByMissing(v *float64) LogsGroupByMissing { - return LogsGroupByMissing{LogsGroupByMissingNumber: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *LogsGroupByMissing) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into LogsGroupByMissingString - err = json.Unmarshal(data, &obj.LogsGroupByMissingString) - if err == nil { - if obj.LogsGroupByMissingString != nil { - jsonLogsGroupByMissingString, _ := json.Marshal(obj.LogsGroupByMissingString) - if string(jsonLogsGroupByMissingString) == "{}" { // empty struct - obj.LogsGroupByMissingString = nil - } else { - match++ - } - } else { - obj.LogsGroupByMissingString = nil - } - } else { - obj.LogsGroupByMissingString = nil - } - - // try to unmarshal data into LogsGroupByMissingNumber - err = json.Unmarshal(data, &obj.LogsGroupByMissingNumber) - if err == nil { - if obj.LogsGroupByMissingNumber != nil { - jsonLogsGroupByMissingNumber, _ := json.Marshal(obj.LogsGroupByMissingNumber) - if string(jsonLogsGroupByMissingNumber) == "{}" { // empty struct - obj.LogsGroupByMissingNumber = nil - } else { - match++ - } - } else { - obj.LogsGroupByMissingNumber = nil - } - } else { - obj.LogsGroupByMissingNumber = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.LogsGroupByMissingString = nil - obj.LogsGroupByMissingNumber = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj LogsGroupByMissing) MarshalJSON() ([]byte, error) { - if obj.LogsGroupByMissingString != nil { - return json.Marshal(&obj.LogsGroupByMissingString) - } - - if obj.LogsGroupByMissingNumber != nil { - return json.Marshal(&obj.LogsGroupByMissingNumber) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *LogsGroupByMissing) GetActualInstance() interface{} { - if obj.LogsGroupByMissingString != nil { - return obj.LogsGroupByMissingString - } - - if obj.LogsGroupByMissingNumber != nil { - return obj.LogsGroupByMissingNumber - } - - // all schemas are nil - return nil -} - -// NullableLogsGroupByMissing handles when a null is used for LogsGroupByMissing. -type NullableLogsGroupByMissing struct { - value *LogsGroupByMissing - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGroupByMissing) Get() *LogsGroupByMissing { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGroupByMissing) Set(val *LogsGroupByMissing) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGroupByMissing) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsGroupByMissing) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGroupByMissing initializes the struct as if Set has been called. -func NewNullableLogsGroupByMissing(val *LogsGroupByMissing) *NullableLogsGroupByMissing { - return &NullableLogsGroupByMissing{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGroupByMissing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGroupByMissing) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_group_by_total.go b/api/v2/datadog/model_logs_group_by_total.go deleted file mode 100644 index 1da8dd34af8..00000000000 --- a/api/v2/datadog/model_logs_group_by_total.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsGroupByTotal - A resulting object to put the given computes in over all the matching records. -type LogsGroupByTotal struct { - LogsGroupByTotalBoolean *bool - LogsGroupByTotalString *string - LogsGroupByTotalNumber *float64 - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// LogsGroupByTotalBooleanAsLogsGroupByTotal is a convenience function that returns bool wrapped in LogsGroupByTotal. -func LogsGroupByTotalBooleanAsLogsGroupByTotal(v *bool) LogsGroupByTotal { - return LogsGroupByTotal{LogsGroupByTotalBoolean: v} -} - -// LogsGroupByTotalStringAsLogsGroupByTotal is a convenience function that returns string wrapped in LogsGroupByTotal. -func LogsGroupByTotalStringAsLogsGroupByTotal(v *string) LogsGroupByTotal { - return LogsGroupByTotal{LogsGroupByTotalString: v} -} - -// LogsGroupByTotalNumberAsLogsGroupByTotal is a convenience function that returns float64 wrapped in LogsGroupByTotal. -func LogsGroupByTotalNumberAsLogsGroupByTotal(v *float64) LogsGroupByTotal { - return LogsGroupByTotal{LogsGroupByTotalNumber: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *LogsGroupByTotal) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into LogsGroupByTotalBoolean - err = json.Unmarshal(data, &obj.LogsGroupByTotalBoolean) - if err == nil { - if obj.LogsGroupByTotalBoolean != nil { - jsonLogsGroupByTotalBoolean, _ := json.Marshal(obj.LogsGroupByTotalBoolean) - if string(jsonLogsGroupByTotalBoolean) == "{}" { // empty struct - obj.LogsGroupByTotalBoolean = nil - } else { - match++ - } - } else { - obj.LogsGroupByTotalBoolean = nil - } - } else { - obj.LogsGroupByTotalBoolean = nil - } - - // try to unmarshal data into LogsGroupByTotalString - err = json.Unmarshal(data, &obj.LogsGroupByTotalString) - if err == nil { - if obj.LogsGroupByTotalString != nil { - jsonLogsGroupByTotalString, _ := json.Marshal(obj.LogsGroupByTotalString) - if string(jsonLogsGroupByTotalString) == "{}" { // empty struct - obj.LogsGroupByTotalString = nil - } else { - match++ - } - } else { - obj.LogsGroupByTotalString = nil - } - } else { - obj.LogsGroupByTotalString = nil - } - - // try to unmarshal data into LogsGroupByTotalNumber - err = json.Unmarshal(data, &obj.LogsGroupByTotalNumber) - if err == nil { - if obj.LogsGroupByTotalNumber != nil { - jsonLogsGroupByTotalNumber, _ := json.Marshal(obj.LogsGroupByTotalNumber) - if string(jsonLogsGroupByTotalNumber) == "{}" { // empty struct - obj.LogsGroupByTotalNumber = nil - } else { - match++ - } - } else { - obj.LogsGroupByTotalNumber = nil - } - } else { - obj.LogsGroupByTotalNumber = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.LogsGroupByTotalBoolean = nil - obj.LogsGroupByTotalString = nil - obj.LogsGroupByTotalNumber = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj LogsGroupByTotal) MarshalJSON() ([]byte, error) { - if obj.LogsGroupByTotalBoolean != nil { - return json.Marshal(&obj.LogsGroupByTotalBoolean) - } - - if obj.LogsGroupByTotalString != nil { - return json.Marshal(&obj.LogsGroupByTotalString) - } - - if obj.LogsGroupByTotalNumber != nil { - return json.Marshal(&obj.LogsGroupByTotalNumber) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *LogsGroupByTotal) GetActualInstance() interface{} { - if obj.LogsGroupByTotalBoolean != nil { - return obj.LogsGroupByTotalBoolean - } - - if obj.LogsGroupByTotalString != nil { - return obj.LogsGroupByTotalString - } - - if obj.LogsGroupByTotalNumber != nil { - return obj.LogsGroupByTotalNumber - } - - // all schemas are nil - return nil -} - -// NullableLogsGroupByTotal handles when a null is used for LogsGroupByTotal. -type NullableLogsGroupByTotal struct { - value *LogsGroupByTotal - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsGroupByTotal) Get() *LogsGroupByTotal { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsGroupByTotal) Set(val *LogsGroupByTotal) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsGroupByTotal) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableLogsGroupByTotal) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsGroupByTotal initializes the struct as if Set has been called. -func NewNullableLogsGroupByTotal(val *LogsGroupByTotal) *NullableLogsGroupByTotal { - return &NullableLogsGroupByTotal{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsGroupByTotal) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsGroupByTotal) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_list_request.go b/api/v2/datadog/model_logs_list_request.go deleted file mode 100644 index adbb6711e09..00000000000 --- a/api/v2/datadog/model_logs_list_request.go +++ /dev/null @@ -1,249 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsListRequest The request for a logs list. -type LogsListRequest struct { - // The search and filter query settings - Filter *LogsQueryFilter `json:"filter,omitempty"` - // Global query options that are used during the query. - // Note: You should only supply timezone or time offset but not both otherwise the query will fail. - Options *LogsQueryOptions `json:"options,omitempty"` - // Paging attributes for listing logs. - Page *LogsListRequestPage `json:"page,omitempty"` - // Sort parameters when querying logs. - Sort *LogsSort `json:"sort,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{} -} - -// NewLogsListRequest instantiates a new LogsListRequest 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 NewLogsListRequest() *LogsListRequest { - this := LogsListRequest{} - return &this -} - -// NewLogsListRequestWithDefaults instantiates a new LogsListRequest 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 NewLogsListRequestWithDefaults() *LogsListRequest { - this := LogsListRequest{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsListRequest) GetFilter() LogsQueryFilter { - if o == nil || o.Filter == nil { - var ret LogsQueryFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetFilterOk() (*LogsQueryFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsListRequest) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsQueryFilter and assigns it to the Filter field. -func (o *LogsListRequest) SetFilter(v LogsQueryFilter) { - o.Filter = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *LogsListRequest) GetOptions() LogsQueryOptions { - if o == nil || o.Options == nil { - var ret LogsQueryOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetOptionsOk() (*LogsQueryOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *LogsListRequest) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given LogsQueryOptions and assigns it to the Options field. -func (o *LogsListRequest) SetOptions(v LogsQueryOptions) { - o.Options = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *LogsListRequest) GetPage() LogsListRequestPage { - if o == nil || o.Page == nil { - var ret LogsListRequestPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetPageOk() (*LogsListRequestPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *LogsListRequest) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given LogsListRequestPage and assigns it to the Page field. -func (o *LogsListRequest) SetPage(v LogsListRequestPage) { - o.Page = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *LogsListRequest) GetSort() LogsSort { - if o == nil || o.Sort == nil { - var ret LogsSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequest) GetSortOk() (*LogsSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *LogsListRequest) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given LogsSort and assigns it to the Sort field. -func (o *LogsListRequest) SetSort(v LogsSort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsListRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filter *LogsQueryFilter `json:"filter,omitempty"` - Options *LogsQueryOptions `json:"options,omitempty"` - Page *LogsListRequestPage `json:"page,omitempty"` - Sort *LogsSort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.Sort = all.Sort - return nil -} diff --git a/api/v2/datadog/model_logs_list_request_page.go b/api/v2/datadog/model_logs_list_request_page.go deleted file mode 100644 index 862c8281ea6..00000000000 --- a/api/v2/datadog/model_logs_list_request_page.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsListRequestPage Paging attributes for listing logs. -type LogsListRequestPage struct { - // List following results with a cursor provided in the previous query. - Cursor *string `json:"cursor,omitempty"` - // Maximum number of logs in the response. - Limit *int32 `json:"limit,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{} -} - -// NewLogsListRequestPage instantiates a new LogsListRequestPage 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 NewLogsListRequestPage() *LogsListRequestPage { - this := LogsListRequestPage{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// NewLogsListRequestPageWithDefaults instantiates a new LogsListRequestPage 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 NewLogsListRequestPageWithDefaults() *LogsListRequestPage { - this := LogsListRequestPage{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// GetCursor returns the Cursor field value if set, zero value otherwise. -func (o *LogsListRequestPage) GetCursor() string { - if o == nil || o.Cursor == nil { - var ret string - return ret - } - return *o.Cursor -} - -// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequestPage) GetCursorOk() (*string, bool) { - if o == nil || o.Cursor == nil { - return nil, false - } - return o.Cursor, true -} - -// HasCursor returns a boolean if a field has been set. -func (o *LogsListRequestPage) HasCursor() bool { - if o != nil && o.Cursor != nil { - return true - } - - return false -} - -// SetCursor gets a reference to the given string and assigns it to the Cursor field. -func (o *LogsListRequestPage) SetCursor(v string) { - o.Cursor = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *LogsListRequestPage) GetLimit() int32 { - if o == nil || o.Limit == nil { - var ret int32 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListRequestPage) GetLimitOk() (*int32, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *LogsListRequestPage) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int32 and assigns it to the Limit field. -func (o *LogsListRequestPage) SetLimit(v int32) { - o.Limit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsListRequestPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cursor != nil { - toSerialize["cursor"] = o.Cursor - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsListRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cursor *string `json:"cursor,omitempty"` - Limit *int32 `json:"limit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cursor = all.Cursor - o.Limit = all.Limit - return nil -} diff --git a/api/v2/datadog/model_logs_list_response.go b/api/v2/datadog/model_logs_list_response.go deleted file mode 100644 index b7f80e060b5..00000000000 --- a/api/v2/datadog/model_logs_list_response.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsListResponse Response object with all logs matching the request and pagination information. -type LogsListResponse struct { - // Array of logs matching the request. - Data []Log `json:"data,omitempty"` - // Links attributes. - Links *LogsListResponseLinks `json:"links,omitempty"` - // The metadata associated with a request - Meta *LogsResponseMetadata `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{} -} - -// NewLogsListResponse instantiates a new LogsListResponse 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 NewLogsListResponse() *LogsListResponse { - this := LogsListResponse{} - return &this -} - -// NewLogsListResponseWithDefaults instantiates a new LogsListResponse 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 NewLogsListResponseWithDefaults() *LogsListResponse { - this := LogsListResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsListResponse) GetData() []Log { - if o == nil || o.Data == nil { - var ret []Log - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListResponse) GetDataOk() (*[]Log, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsListResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []Log and assigns it to the Data field. -func (o *LogsListResponse) SetData(v []Log) { - o.Data = v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *LogsListResponse) GetLinks() LogsListResponseLinks { - if o == nil || o.Links == nil { - var ret LogsListResponseLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListResponse) GetLinksOk() (*LogsListResponseLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *LogsListResponse) HasLinks() bool { - if o != nil && o.Links != nil { - return true - } - - return false -} - -// SetLinks gets a reference to the given LogsListResponseLinks and assigns it to the Links field. -func (o *LogsListResponse) SetLinks(v LogsListResponseLinks) { - o.Links = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *LogsListResponse) GetMeta() LogsResponseMetadata { - if o == nil || o.Meta == nil { - var ret LogsResponseMetadata - 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 *LogsListResponse) GetMetaOk() (*LogsResponseMetadata, 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 *LogsListResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given LogsResponseMetadata and assigns it to the Meta field. -func (o *LogsListResponse) SetMeta(v LogsResponseMetadata) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []Log `json:"data,omitempty"` - Links *LogsListResponseLinks `json:"links,omitempty"` - Meta *LogsResponseMetadata `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Links = all.Links - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_logs_list_response_links.go b/api/v2/datadog/model_logs_list_response_links.go deleted file mode 100644 index 636248a8d19..00000000000 --- a/api/v2/datadog/model_logs_list_response_links.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsListResponseLinks Links attributes. -type LogsListResponseLinks struct { - // Link for the next set of results. Note that the request can also be made using the - // POST endpoint. - Next *string `json:"next,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{} -} - -// NewLogsListResponseLinks instantiates a new LogsListResponseLinks 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 NewLogsListResponseLinks() *LogsListResponseLinks { - this := LogsListResponseLinks{} - return &this -} - -// NewLogsListResponseLinksWithDefaults instantiates a new LogsListResponseLinks 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 NewLogsListResponseLinksWithDefaults() *LogsListResponseLinks { - this := LogsListResponseLinks{} - return &this -} - -// GetNext returns the Next field value if set, zero value otherwise. -func (o *LogsListResponseLinks) GetNext() string { - if o == nil || o.Next == nil { - var ret string - return ret - } - return *o.Next -} - -// GetNextOk returns a tuple with the Next field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsListResponseLinks) GetNextOk() (*string, bool) { - if o == nil || o.Next == nil { - return nil, false - } - return o.Next, true -} - -// HasNext returns a boolean if a field has been set. -func (o *LogsListResponseLinks) HasNext() bool { - if o != nil && o.Next != nil { - return true - } - - return false -} - -// SetNext gets a reference to the given string and assigns it to the Next field. -func (o *LogsListResponseLinks) SetNext(v string) { - o.Next = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsListResponseLinks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Next != nil { - toSerialize["next"] = o.Next - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Next *string `json:"next,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Next = all.Next - return nil -} diff --git a/api/v2/datadog/model_logs_metric_compute.go b/api/v2/datadog/model_logs_metric_compute.go deleted file mode 100644 index 1b48d9092e9..00000000000 --- a/api/v2/datadog/model_logs_metric_compute.go +++ /dev/null @@ -1,150 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricCompute The compute rule to compute the log-based metric. -type LogsMetricCompute struct { - // The type of aggregation to use. - AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"` - // The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution"). - Path *string `json:"path,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{} -} - -// NewLogsMetricCompute instantiates a new LogsMetricCompute 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 NewLogsMetricCompute(aggregationType LogsMetricComputeAggregationType) *LogsMetricCompute { - this := LogsMetricCompute{} - this.AggregationType = aggregationType - return &this -} - -// NewLogsMetricComputeWithDefaults instantiates a new LogsMetricCompute 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 NewLogsMetricComputeWithDefaults() *LogsMetricCompute { - this := LogsMetricCompute{} - return &this -} - -// GetAggregationType returns the AggregationType field value. -func (o *LogsMetricCompute) GetAggregationType() LogsMetricComputeAggregationType { - if o == nil { - var ret LogsMetricComputeAggregationType - return ret - } - return o.AggregationType -} - -// GetAggregationTypeOk returns a tuple with the AggregationType field value -// and a boolean to check if the value has been set. -func (o *LogsMetricCompute) GetAggregationTypeOk() (*LogsMetricComputeAggregationType, bool) { - if o == nil { - return nil, false - } - return &o.AggregationType, true -} - -// SetAggregationType sets field value. -func (o *LogsMetricCompute) SetAggregationType(v LogsMetricComputeAggregationType) { - o.AggregationType = v -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *LogsMetricCompute) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricCompute) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *LogsMetricCompute) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *LogsMetricCompute) SetPath(v string) { - o.Path = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricCompute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation_type"] = o.AggregationType - if o.Path != nil { - toSerialize["path"] = o.Path - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - AggregationType *LogsMetricComputeAggregationType `json:"aggregation_type"` - }{} - all := struct { - AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"` - Path *string `json:"path,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AggregationType == nil { - return fmt.Errorf("Required field aggregation_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.AggregationType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AggregationType = all.AggregationType - o.Path = all.Path - return nil -} diff --git a/api/v2/datadog/model_logs_metric_compute_aggregation_type.go b/api/v2/datadog/model_logs_metric_compute_aggregation_type.go deleted file mode 100644 index fa374be51fa..00000000000 --- a/api/v2/datadog/model_logs_metric_compute_aggregation_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricComputeAggregationType The type of aggregation to use. -type LogsMetricComputeAggregationType string - -// List of LogsMetricComputeAggregationType. -const ( - LOGSMETRICCOMPUTEAGGREGATIONTYPE_COUNT LogsMetricComputeAggregationType = "count" - LOGSMETRICCOMPUTEAGGREGATIONTYPE_DISTRIBUTION LogsMetricComputeAggregationType = "distribution" -) - -var allowedLogsMetricComputeAggregationTypeEnumValues = []LogsMetricComputeAggregationType{ - LOGSMETRICCOMPUTEAGGREGATIONTYPE_COUNT, - LOGSMETRICCOMPUTEAGGREGATIONTYPE_DISTRIBUTION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsMetricComputeAggregationType) GetAllowedValues() []LogsMetricComputeAggregationType { - return allowedLogsMetricComputeAggregationTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsMetricComputeAggregationType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsMetricComputeAggregationType(value) - return nil -} - -// NewLogsMetricComputeAggregationTypeFromValue returns a pointer to a valid LogsMetricComputeAggregationType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsMetricComputeAggregationTypeFromValue(v string) (*LogsMetricComputeAggregationType, error) { - ev := LogsMetricComputeAggregationType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsMetricComputeAggregationType: valid values are %v", v, allowedLogsMetricComputeAggregationTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsMetricComputeAggregationType) IsValid() bool { - for _, existing := range allowedLogsMetricComputeAggregationTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsMetricComputeAggregationType value. -func (v LogsMetricComputeAggregationType) Ptr() *LogsMetricComputeAggregationType { - return &v -} - -// NullableLogsMetricComputeAggregationType handles when a null is used for LogsMetricComputeAggregationType. -type NullableLogsMetricComputeAggregationType struct { - value *LogsMetricComputeAggregationType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMetricComputeAggregationType) Get() *LogsMetricComputeAggregationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMetricComputeAggregationType) Set(val *LogsMetricComputeAggregationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMetricComputeAggregationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMetricComputeAggregationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMetricComputeAggregationType initializes the struct as if Set has been called. -func NewNullableLogsMetricComputeAggregationType(val *LogsMetricComputeAggregationType) *NullableLogsMetricComputeAggregationType { - return &NullableLogsMetricComputeAggregationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMetricComputeAggregationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMetricComputeAggregationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_metric_create_attributes.go b/api/v2/datadog/model_logs_metric_create_attributes.go deleted file mode 100644 index 20e02a65ec6..00000000000 --- a/api/v2/datadog/model_logs_metric_create_attributes.go +++ /dev/null @@ -1,195 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricCreateAttributes The object describing the Datadog log-based metric to create. -type LogsMetricCreateAttributes struct { - // The compute rule to compute the log-based metric. - Compute LogsMetricCompute `json:"compute"` - // The log-based metric filter. Logs matching this filter will be aggregated in this metric. - Filter *LogsMetricFilter `json:"filter,omitempty"` - // The rules for the group by. - GroupBy []LogsMetricGroupBy `json:"group_by,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{} -} - -// NewLogsMetricCreateAttributes instantiates a new LogsMetricCreateAttributes 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 NewLogsMetricCreateAttributes(compute LogsMetricCompute) *LogsMetricCreateAttributes { - this := LogsMetricCreateAttributes{} - this.Compute = compute - return &this -} - -// NewLogsMetricCreateAttributesWithDefaults instantiates a new LogsMetricCreateAttributes 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 NewLogsMetricCreateAttributesWithDefaults() *LogsMetricCreateAttributes { - this := LogsMetricCreateAttributes{} - return &this -} - -// GetCompute returns the Compute field value. -func (o *LogsMetricCreateAttributes) GetCompute() LogsMetricCompute { - if o == nil { - var ret LogsMetricCompute - return ret - } - return o.Compute -} - -// GetComputeOk returns a tuple with the Compute field value -// and a boolean to check if the value has been set. -func (o *LogsMetricCreateAttributes) GetComputeOk() (*LogsMetricCompute, bool) { - if o == nil { - return nil, false - } - return &o.Compute, true -} - -// SetCompute sets field value. -func (o *LogsMetricCreateAttributes) SetCompute(v LogsMetricCompute) { - o.Compute = v -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsMetricCreateAttributes) GetFilter() LogsMetricFilter { - if o == nil || o.Filter == nil { - var ret LogsMetricFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricCreateAttributes) GetFilterOk() (*LogsMetricFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsMetricCreateAttributes) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsMetricFilter and assigns it to the Filter field. -func (o *LogsMetricCreateAttributes) SetFilter(v LogsMetricFilter) { - o.Filter = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *LogsMetricCreateAttributes) GetGroupBy() []LogsMetricGroupBy { - if o == nil || o.GroupBy == nil { - var ret []LogsMetricGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricCreateAttributes) GetGroupByOk() (*[]LogsMetricGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *LogsMetricCreateAttributes) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []LogsMetricGroupBy and assigns it to the GroupBy field. -func (o *LogsMetricCreateAttributes) SetGroupBy(v []LogsMetricGroupBy) { - o.GroupBy = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["compute"] = o.Compute - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Compute *LogsMetricCompute `json:"compute"` - }{} - all := struct { - Compute LogsMetricCompute `json:"compute"` - Filter *LogsMetricFilter `json:"filter,omitempty"` - GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("Required field compute missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Compute = all.Compute - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.GroupBy = all.GroupBy - return nil -} diff --git a/api/v2/datadog/model_logs_metric_create_data.go b/api/v2/datadog/model_logs_metric_create_data.go deleted file mode 100644 index 959b39a597d..00000000000 --- a/api/v2/datadog/model_logs_metric_create_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricCreateData The new log-based metric properties. -type LogsMetricCreateData struct { - // The object describing the Datadog log-based metric to create. - Attributes LogsMetricCreateAttributes `json:"attributes"` - // The name of the log-based metric. - Id string `json:"id"` - // The type of the resource. The value should always be logs_metrics. - Type LogsMetricType `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{} -} - -// NewLogsMetricCreateData instantiates a new LogsMetricCreateData 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 NewLogsMetricCreateData(attributes LogsMetricCreateAttributes, id string, typeVar LogsMetricType) *LogsMetricCreateData { - this := LogsMetricCreateData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewLogsMetricCreateDataWithDefaults instantiates a new LogsMetricCreateData 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 NewLogsMetricCreateDataWithDefaults() *LogsMetricCreateData { - this := LogsMetricCreateData{} - var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *LogsMetricCreateData) GetAttributes() LogsMetricCreateAttributes { - if o == nil { - var ret LogsMetricCreateAttributes - 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 *LogsMetricCreateData) GetAttributesOk() (*LogsMetricCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *LogsMetricCreateData) SetAttributes(v LogsMetricCreateAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *LogsMetricCreateData) 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 *LogsMetricCreateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *LogsMetricCreateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *LogsMetricCreateData) GetType() LogsMetricType { - if o == nil { - var ret LogsMetricType - 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 *LogsMetricCreateData) GetTypeOk() (*LogsMetricType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsMetricCreateData) SetType(v LogsMetricType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *LogsMetricCreateAttributes `json:"attributes"` - Id *string `json:"id"` - Type *LogsMetricType `json:"type"` - }{} - all := struct { - Attributes LogsMetricCreateAttributes `json:"attributes"` - Id string `json:"id"` - Type LogsMetricType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_metric_create_request.go b/api/v2/datadog/model_logs_metric_create_request.go deleted file mode 100644 index 66c774553a4..00000000000 --- a/api/v2/datadog/model_logs_metric_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricCreateRequest The new log-based metric body. -type LogsMetricCreateRequest struct { - // The new log-based metric properties. - Data LogsMetricCreateData `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{} -} - -// NewLogsMetricCreateRequest instantiates a new LogsMetricCreateRequest 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 NewLogsMetricCreateRequest(data LogsMetricCreateData) *LogsMetricCreateRequest { - this := LogsMetricCreateRequest{} - this.Data = data - return &this -} - -// NewLogsMetricCreateRequestWithDefaults instantiates a new LogsMetricCreateRequest 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 NewLogsMetricCreateRequestWithDefaults() *LogsMetricCreateRequest { - this := LogsMetricCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *LogsMetricCreateRequest) GetData() LogsMetricCreateData { - if o == nil { - var ret LogsMetricCreateData - 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 *LogsMetricCreateRequest) GetDataOk() (*LogsMetricCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *LogsMetricCreateRequest) SetData(v LogsMetricCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *LogsMetricCreateData `json:"data"` - }{} - all := struct { - Data LogsMetricCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_metric_filter.go b/api/v2/datadog/model_logs_metric_filter.go deleted file mode 100644 index 4d02bf62e0e..00000000000 --- a/api/v2/datadog/model_logs_metric_filter.go +++ /dev/null @@ -1,106 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricFilter The log-based metric filter. Logs matching this filter will be aggregated in this metric. -type LogsMetricFilter struct { - // The search query - following the log search syntax. - Query *string `json:"query,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{} -} - -// NewLogsMetricFilter instantiates a new LogsMetricFilter 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 NewLogsMetricFilter() *LogsMetricFilter { - this := LogsMetricFilter{} - var query string = "*" - this.Query = &query - return &this -} - -// NewLogsMetricFilterWithDefaults instantiates a new LogsMetricFilter 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 NewLogsMetricFilterWithDefaults() *LogsMetricFilter { - this := LogsMetricFilter{} - var query string = "*" - this.Query = &query - return &this -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *LogsMetricFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *LogsMetricFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *LogsMetricFilter) SetQuery(v string) { - o.Query = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Query *string `json:"query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_logs_metric_group_by.go b/api/v2/datadog/model_logs_metric_group_by.go deleted file mode 100644 index 075f3fda147..00000000000 --- a/api/v2/datadog/model_logs_metric_group_by.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricGroupBy A group by rule. -type LogsMetricGroupBy struct { - // The path to the value the log-based metric will be aggregated over. - Path string `json:"path"` - // Eventual name of the tag that gets created. By default, the path attribute is used as the tag name. - TagName *string `json:"tag_name,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{} -} - -// NewLogsMetricGroupBy instantiates a new LogsMetricGroupBy 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 NewLogsMetricGroupBy(path string) *LogsMetricGroupBy { - this := LogsMetricGroupBy{} - this.Path = path - return &this -} - -// NewLogsMetricGroupByWithDefaults instantiates a new LogsMetricGroupBy 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 NewLogsMetricGroupByWithDefaults() *LogsMetricGroupBy { - this := LogsMetricGroupBy{} - return &this -} - -// GetPath returns the Path field value. -func (o *LogsMetricGroupBy) GetPath() string { - if o == nil { - var ret string - return ret - } - return o.Path -} - -// GetPathOk returns a tuple with the Path field value -// and a boolean to check if the value has been set. -func (o *LogsMetricGroupBy) GetPathOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Path, true -} - -// SetPath sets field value. -func (o *LogsMetricGroupBy) SetPath(v string) { - o.Path = v -} - -// GetTagName returns the TagName field value if set, zero value otherwise. -func (o *LogsMetricGroupBy) GetTagName() string { - if o == nil || o.TagName == nil { - var ret string - return ret - } - return *o.TagName -} - -// GetTagNameOk returns a tuple with the TagName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricGroupBy) GetTagNameOk() (*string, bool) { - if o == nil || o.TagName == nil { - return nil, false - } - return o.TagName, true -} - -// HasTagName returns a boolean if a field has been set. -func (o *LogsMetricGroupBy) HasTagName() bool { - if o != nil && o.TagName != nil { - return true - } - - return false -} - -// SetTagName gets a reference to the given string and assigns it to the TagName field. -func (o *LogsMetricGroupBy) SetTagName(v string) { - o.TagName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricGroupBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["path"] = o.Path - if o.TagName != nil { - toSerialize["tag_name"] = o.TagName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Path *string `json:"path"` - }{} - all := struct { - Path string `json:"path"` - TagName *string `json:"tag_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Path == nil { - return fmt.Errorf("Required field path missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Path = all.Path - o.TagName = all.TagName - return nil -} diff --git a/api/v2/datadog/model_logs_metric_response.go b/api/v2/datadog/model_logs_metric_response.go deleted file mode 100644 index dec5b21c202..00000000000 --- a/api/v2/datadog/model_logs_metric_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricResponse The log-based metric object. -type LogsMetricResponse struct { - // The log-based metric properties. - Data *LogsMetricResponseData `json:"data,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{} -} - -// NewLogsMetricResponse instantiates a new LogsMetricResponse 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 NewLogsMetricResponse() *LogsMetricResponse { - this := LogsMetricResponse{} - return &this -} - -// NewLogsMetricResponseWithDefaults instantiates a new LogsMetricResponse 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 NewLogsMetricResponseWithDefaults() *LogsMetricResponse { - this := LogsMetricResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsMetricResponse) GetData() LogsMetricResponseData { - if o == nil || o.Data == nil { - var ret LogsMetricResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponse) GetDataOk() (*LogsMetricResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsMetricResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given LogsMetricResponseData and assigns it to the Data field. -func (o *LogsMetricResponse) SetData(v LogsMetricResponseData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *LogsMetricResponseData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_metric_response_attributes.go b/api/v2/datadog/model_logs_metric_response_attributes.go deleted file mode 100644 index 55ffb3857a5..00000000000 --- a/api/v2/datadog/model_logs_metric_response_attributes.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricResponseAttributes The object describing a Datadog log-based metric. -type LogsMetricResponseAttributes struct { - // The compute rule to compute the log-based metric. - Compute *LogsMetricResponseCompute `json:"compute,omitempty"` - // The log-based metric filter. Logs matching this filter will be aggregated in this metric. - Filter *LogsMetricResponseFilter `json:"filter,omitempty"` - // The rules for the group by. - GroupBy []LogsMetricResponseGroupBy `json:"group_by,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{} -} - -// NewLogsMetricResponseAttributes instantiates a new LogsMetricResponseAttributes 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 NewLogsMetricResponseAttributes() *LogsMetricResponseAttributes { - this := LogsMetricResponseAttributes{} - return &this -} - -// NewLogsMetricResponseAttributesWithDefaults instantiates a new LogsMetricResponseAttributes 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 NewLogsMetricResponseAttributesWithDefaults() *LogsMetricResponseAttributes { - this := LogsMetricResponseAttributes{} - return &this -} - -// GetCompute returns the Compute field value if set, zero value otherwise. -func (o *LogsMetricResponseAttributes) GetCompute() LogsMetricResponseCompute { - if o == nil || o.Compute == nil { - var ret LogsMetricResponseCompute - return ret - } - return *o.Compute -} - -// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseAttributes) GetComputeOk() (*LogsMetricResponseCompute, bool) { - if o == nil || o.Compute == nil { - return nil, false - } - return o.Compute, true -} - -// HasCompute returns a boolean if a field has been set. -func (o *LogsMetricResponseAttributes) HasCompute() bool { - if o != nil && o.Compute != nil { - return true - } - - return false -} - -// SetCompute gets a reference to the given LogsMetricResponseCompute and assigns it to the Compute field. -func (o *LogsMetricResponseAttributes) SetCompute(v LogsMetricResponseCompute) { - o.Compute = &v -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsMetricResponseAttributes) GetFilter() LogsMetricResponseFilter { - if o == nil || o.Filter == nil { - var ret LogsMetricResponseFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseAttributes) GetFilterOk() (*LogsMetricResponseFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsMetricResponseAttributes) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsMetricResponseFilter and assigns it to the Filter field. -func (o *LogsMetricResponseAttributes) SetFilter(v LogsMetricResponseFilter) { - o.Filter = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *LogsMetricResponseAttributes) GetGroupBy() []LogsMetricResponseGroupBy { - if o == nil || o.GroupBy == nil { - var ret []LogsMetricResponseGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseAttributes) GetGroupByOk() (*[]LogsMetricResponseGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *LogsMetricResponseAttributes) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []LogsMetricResponseGroupBy and assigns it to the GroupBy field. -func (o *LogsMetricResponseAttributes) SetGroupBy(v []LogsMetricResponseGroupBy) { - o.GroupBy = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Compute != nil { - toSerialize["compute"] = o.Compute - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Compute *LogsMetricResponseCompute `json:"compute,omitempty"` - Filter *LogsMetricResponseFilter `json:"filter,omitempty"` - GroupBy []LogsMetricResponseGroupBy `json:"group_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Compute = all.Compute - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.GroupBy = all.GroupBy - return nil -} diff --git a/api/v2/datadog/model_logs_metric_response_compute.go b/api/v2/datadog/model_logs_metric_response_compute.go deleted file mode 100644 index 7cb0674d1f9..00000000000 --- a/api/v2/datadog/model_logs_metric_response_compute.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricResponseCompute The compute rule to compute the log-based metric. -type LogsMetricResponseCompute struct { - // The type of aggregation to use. - AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"` - // The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution"). - Path *string `json:"path,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{} -} - -// NewLogsMetricResponseCompute instantiates a new LogsMetricResponseCompute 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 NewLogsMetricResponseCompute() *LogsMetricResponseCompute { - this := LogsMetricResponseCompute{} - return &this -} - -// NewLogsMetricResponseComputeWithDefaults instantiates a new LogsMetricResponseCompute 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 NewLogsMetricResponseComputeWithDefaults() *LogsMetricResponseCompute { - this := LogsMetricResponseCompute{} - return &this -} - -// GetAggregationType returns the AggregationType field value if set, zero value otherwise. -func (o *LogsMetricResponseCompute) GetAggregationType() LogsMetricResponseComputeAggregationType { - if o == nil || o.AggregationType == nil { - var ret LogsMetricResponseComputeAggregationType - return ret - } - return *o.AggregationType -} - -// GetAggregationTypeOk returns a tuple with the AggregationType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseCompute) GetAggregationTypeOk() (*LogsMetricResponseComputeAggregationType, bool) { - if o == nil || o.AggregationType == nil { - return nil, false - } - return o.AggregationType, true -} - -// HasAggregationType returns a boolean if a field has been set. -func (o *LogsMetricResponseCompute) HasAggregationType() bool { - if o != nil && o.AggregationType != nil { - return true - } - - return false -} - -// SetAggregationType gets a reference to the given LogsMetricResponseComputeAggregationType and assigns it to the AggregationType field. -func (o *LogsMetricResponseCompute) SetAggregationType(v LogsMetricResponseComputeAggregationType) { - o.AggregationType = &v -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *LogsMetricResponseCompute) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseCompute) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *LogsMetricResponseCompute) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *LogsMetricResponseCompute) SetPath(v string) { - o.Path = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricResponseCompute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AggregationType != nil { - toSerialize["aggregation_type"] = o.AggregationType - } - if o.Path != nil { - toSerialize["path"] = o.Path - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"` - Path *string `json:"path,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.AggregationType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AggregationType = all.AggregationType - o.Path = all.Path - return nil -} diff --git a/api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go b/api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go deleted file mode 100644 index 8686dfebd83..00000000000 --- a/api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricResponseComputeAggregationType The type of aggregation to use. -type LogsMetricResponseComputeAggregationType string - -// List of LogsMetricResponseComputeAggregationType. -const ( - LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_COUNT LogsMetricResponseComputeAggregationType = "count" - LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_DISTRIBUTION LogsMetricResponseComputeAggregationType = "distribution" -) - -var allowedLogsMetricResponseComputeAggregationTypeEnumValues = []LogsMetricResponseComputeAggregationType{ - LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_COUNT, - LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_DISTRIBUTION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsMetricResponseComputeAggregationType) GetAllowedValues() []LogsMetricResponseComputeAggregationType { - return allowedLogsMetricResponseComputeAggregationTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsMetricResponseComputeAggregationType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsMetricResponseComputeAggregationType(value) - return nil -} - -// NewLogsMetricResponseComputeAggregationTypeFromValue returns a pointer to a valid LogsMetricResponseComputeAggregationType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsMetricResponseComputeAggregationTypeFromValue(v string) (*LogsMetricResponseComputeAggregationType, error) { - ev := LogsMetricResponseComputeAggregationType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsMetricResponseComputeAggregationType: valid values are %v", v, allowedLogsMetricResponseComputeAggregationTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsMetricResponseComputeAggregationType) IsValid() bool { - for _, existing := range allowedLogsMetricResponseComputeAggregationTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsMetricResponseComputeAggregationType value. -func (v LogsMetricResponseComputeAggregationType) Ptr() *LogsMetricResponseComputeAggregationType { - return &v -} - -// NullableLogsMetricResponseComputeAggregationType handles when a null is used for LogsMetricResponseComputeAggregationType. -type NullableLogsMetricResponseComputeAggregationType struct { - value *LogsMetricResponseComputeAggregationType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMetricResponseComputeAggregationType) Get() *LogsMetricResponseComputeAggregationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMetricResponseComputeAggregationType) Set(val *LogsMetricResponseComputeAggregationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMetricResponseComputeAggregationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMetricResponseComputeAggregationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMetricResponseComputeAggregationType initializes the struct as if Set has been called. -func NewNullableLogsMetricResponseComputeAggregationType(val *LogsMetricResponseComputeAggregationType) *NullableLogsMetricResponseComputeAggregationType { - return &NullableLogsMetricResponseComputeAggregationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMetricResponseComputeAggregationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMetricResponseComputeAggregationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_metric_response_data.go b/api/v2/datadog/model_logs_metric_response_data.go deleted file mode 100644 index 647b45c7ab6..00000000000 --- a/api/v2/datadog/model_logs_metric_response_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricResponseData The log-based metric properties. -type LogsMetricResponseData struct { - // The object describing a Datadog log-based metric. - Attributes *LogsMetricResponseAttributes `json:"attributes,omitempty"` - // The name of the log-based metric. - Id *string `json:"id,omitempty"` - // The type of the resource. The value should always be logs_metrics. - Type *LogsMetricType `json:"type,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{} -} - -// NewLogsMetricResponseData instantiates a new LogsMetricResponseData 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 NewLogsMetricResponseData() *LogsMetricResponseData { - this := LogsMetricResponseData{} - var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS - this.Type = &typeVar - return &this -} - -// NewLogsMetricResponseDataWithDefaults instantiates a new LogsMetricResponseData 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 NewLogsMetricResponseDataWithDefaults() *LogsMetricResponseData { - this := LogsMetricResponseData{} - var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *LogsMetricResponseData) GetAttributes() LogsMetricResponseAttributes { - if o == nil || o.Attributes == nil { - var ret LogsMetricResponseAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseData) GetAttributesOk() (*LogsMetricResponseAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *LogsMetricResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given LogsMetricResponseAttributes and assigns it to the Attributes field. -func (o *LogsMetricResponseData) SetAttributes(v LogsMetricResponseAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *LogsMetricResponseData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *LogsMetricResponseData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *LogsMetricResponseData) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *LogsMetricResponseData) GetType() LogsMetricType { - if o == nil || o.Type == nil { - var ret LogsMetricType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseData) GetTypeOk() (*LogsMetricType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *LogsMetricResponseData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given LogsMetricType and assigns it to the Type field. -func (o *LogsMetricResponseData) SetType(v LogsMetricType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *LogsMetricResponseAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *LogsMetricType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_metric_response_filter.go b/api/v2/datadog/model_logs_metric_response_filter.go deleted file mode 100644 index 8a7b783cc77..00000000000 --- a/api/v2/datadog/model_logs_metric_response_filter.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricResponseFilter The log-based metric filter. Logs matching this filter will be aggregated in this metric. -type LogsMetricResponseFilter struct { - // The search query - following the log search syntax. - Query *string `json:"query,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{} -} - -// NewLogsMetricResponseFilter instantiates a new LogsMetricResponseFilter 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 NewLogsMetricResponseFilter() *LogsMetricResponseFilter { - this := LogsMetricResponseFilter{} - return &this -} - -// NewLogsMetricResponseFilterWithDefaults instantiates a new LogsMetricResponseFilter 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 NewLogsMetricResponseFilterWithDefaults() *LogsMetricResponseFilter { - this := LogsMetricResponseFilter{} - return &this -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *LogsMetricResponseFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *LogsMetricResponseFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *LogsMetricResponseFilter) SetQuery(v string) { - o.Query = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricResponseFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Query *string `json:"query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_logs_metric_response_group_by.go b/api/v2/datadog/model_logs_metric_response_group_by.go deleted file mode 100644 index d861b819bbb..00000000000 --- a/api/v2/datadog/model_logs_metric_response_group_by.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricResponseGroupBy A group by rule. -type LogsMetricResponseGroupBy struct { - // The path to the value the log-based metric will be aggregated over. - Path *string `json:"path,omitempty"` - // Eventual name of the tag that gets created. By default, the path attribute is used as the tag name. - TagName *string `json:"tag_name,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{} -} - -// NewLogsMetricResponseGroupBy instantiates a new LogsMetricResponseGroupBy 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 NewLogsMetricResponseGroupBy() *LogsMetricResponseGroupBy { - this := LogsMetricResponseGroupBy{} - return &this -} - -// NewLogsMetricResponseGroupByWithDefaults instantiates a new LogsMetricResponseGroupBy 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 NewLogsMetricResponseGroupByWithDefaults() *LogsMetricResponseGroupBy { - this := LogsMetricResponseGroupBy{} - return &this -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *LogsMetricResponseGroupBy) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseGroupBy) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *LogsMetricResponseGroupBy) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *LogsMetricResponseGroupBy) SetPath(v string) { - o.Path = &v -} - -// GetTagName returns the TagName field value if set, zero value otherwise. -func (o *LogsMetricResponseGroupBy) GetTagName() string { - if o == nil || o.TagName == nil { - var ret string - return ret - } - return *o.TagName -} - -// GetTagNameOk returns a tuple with the TagName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricResponseGroupBy) GetTagNameOk() (*string, bool) { - if o == nil || o.TagName == nil { - return nil, false - } - return o.TagName, true -} - -// HasTagName returns a boolean if a field has been set. -func (o *LogsMetricResponseGroupBy) HasTagName() bool { - if o != nil && o.TagName != nil { - return true - } - - return false -} - -// SetTagName gets a reference to the given string and assigns it to the TagName field. -func (o *LogsMetricResponseGroupBy) SetTagName(v string) { - o.TagName = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricResponseGroupBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Path != nil { - toSerialize["path"] = o.Path - } - if o.TagName != nil { - toSerialize["tag_name"] = o.TagName - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Path *string `json:"path,omitempty"` - TagName *string `json:"tag_name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Path = all.Path - o.TagName = all.TagName - return nil -} diff --git a/api/v2/datadog/model_logs_metric_type.go b/api/v2/datadog/model_logs_metric_type.go deleted file mode 100644 index f8f41c600b7..00000000000 --- a/api/v2/datadog/model_logs_metric_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricType The type of the resource. The value should always be logs_metrics. -type LogsMetricType string - -// List of LogsMetricType. -const ( - LOGSMETRICTYPE_LOGS_METRICS LogsMetricType = "logs_metrics" -) - -var allowedLogsMetricTypeEnumValues = []LogsMetricType{ - LOGSMETRICTYPE_LOGS_METRICS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsMetricType) GetAllowedValues() []LogsMetricType { - return allowedLogsMetricTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsMetricType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsMetricType(value) - return nil -} - -// NewLogsMetricTypeFromValue returns a pointer to a valid LogsMetricType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsMetricTypeFromValue(v string) (*LogsMetricType, error) { - ev := LogsMetricType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsMetricType: valid values are %v", v, allowedLogsMetricTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsMetricType) IsValid() bool { - for _, existing := range allowedLogsMetricTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsMetricType value. -func (v LogsMetricType) Ptr() *LogsMetricType { - return &v -} - -// NullableLogsMetricType handles when a null is used for LogsMetricType. -type NullableLogsMetricType struct { - value *LogsMetricType - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsMetricType) Get() *LogsMetricType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsMetricType) Set(val *LogsMetricType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsMetricType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsMetricType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsMetricType initializes the struct as if Set has been called. -func NewNullableLogsMetricType(val *LogsMetricType) *NullableLogsMetricType { - return &NullableLogsMetricType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsMetricType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsMetricType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_metric_update_attributes.go b/api/v2/datadog/model_logs_metric_update_attributes.go deleted file mode 100644 index 4b7629a2f0a..00000000000 --- a/api/v2/datadog/model_logs_metric_update_attributes.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricUpdateAttributes The log-based metric properties that will be updated. -type LogsMetricUpdateAttributes struct { - // The log-based metric filter. Logs matching this filter will be aggregated in this metric. - Filter *LogsMetricFilter `json:"filter,omitempty"` - // The rules for the group by. - GroupBy []LogsMetricGroupBy `json:"group_by,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{} -} - -// NewLogsMetricUpdateAttributes instantiates a new LogsMetricUpdateAttributes 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 NewLogsMetricUpdateAttributes() *LogsMetricUpdateAttributes { - this := LogsMetricUpdateAttributes{} - return &this -} - -// NewLogsMetricUpdateAttributesWithDefaults instantiates a new LogsMetricUpdateAttributes 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 NewLogsMetricUpdateAttributesWithDefaults() *LogsMetricUpdateAttributes { - this := LogsMetricUpdateAttributes{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *LogsMetricUpdateAttributes) GetFilter() LogsMetricFilter { - if o == nil || o.Filter == nil { - var ret LogsMetricFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricUpdateAttributes) GetFilterOk() (*LogsMetricFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *LogsMetricUpdateAttributes) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given LogsMetricFilter and assigns it to the Filter field. -func (o *LogsMetricUpdateAttributes) SetFilter(v LogsMetricFilter) { - o.Filter = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *LogsMetricUpdateAttributes) GetGroupBy() []LogsMetricGroupBy { - if o == nil || o.GroupBy == nil { - var ret []LogsMetricGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricUpdateAttributes) GetGroupByOk() (*[]LogsMetricGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *LogsMetricUpdateAttributes) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []LogsMetricGroupBy and assigns it to the GroupBy field. -func (o *LogsMetricUpdateAttributes) SetGroupBy(v []LogsMetricGroupBy) { - o.GroupBy = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filter *LogsMetricFilter `json:"filter,omitempty"` - GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.GroupBy = all.GroupBy - return nil -} diff --git a/api/v2/datadog/model_logs_metric_update_data.go b/api/v2/datadog/model_logs_metric_update_data.go deleted file mode 100644 index 4079afab378..00000000000 --- a/api/v2/datadog/model_logs_metric_update_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricUpdateData The new log-based metric properties. -type LogsMetricUpdateData struct { - // The log-based metric properties that will be updated. - Attributes LogsMetricUpdateAttributes `json:"attributes"` - // The type of the resource. The value should always be logs_metrics. - Type LogsMetricType `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{} -} - -// NewLogsMetricUpdateData instantiates a new LogsMetricUpdateData 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 NewLogsMetricUpdateData(attributes LogsMetricUpdateAttributes, typeVar LogsMetricType) *LogsMetricUpdateData { - this := LogsMetricUpdateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewLogsMetricUpdateDataWithDefaults instantiates a new LogsMetricUpdateData 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 NewLogsMetricUpdateDataWithDefaults() *LogsMetricUpdateData { - this := LogsMetricUpdateData{} - var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *LogsMetricUpdateData) GetAttributes() LogsMetricUpdateAttributes { - if o == nil { - var ret LogsMetricUpdateAttributes - 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 *LogsMetricUpdateData) GetAttributesOk() (*LogsMetricUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *LogsMetricUpdateData) SetAttributes(v LogsMetricUpdateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *LogsMetricUpdateData) GetType() LogsMetricType { - if o == nil { - var ret LogsMetricType - 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 *LogsMetricUpdateData) GetTypeOk() (*LogsMetricType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *LogsMetricUpdateData) SetType(v LogsMetricType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *LogsMetricUpdateAttributes `json:"attributes"` - Type *LogsMetricType `json:"type"` - }{} - all := struct { - Attributes LogsMetricUpdateAttributes `json:"attributes"` - Type LogsMetricType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_logs_metric_update_request.go b/api/v2/datadog/model_logs_metric_update_request.go deleted file mode 100644 index fd790af1b7b..00000000000 --- a/api/v2/datadog/model_logs_metric_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsMetricUpdateRequest The new log-based metric body. -type LogsMetricUpdateRequest struct { - // The new log-based metric properties. - Data LogsMetricUpdateData `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{} -} - -// NewLogsMetricUpdateRequest instantiates a new LogsMetricUpdateRequest 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 NewLogsMetricUpdateRequest(data LogsMetricUpdateData) *LogsMetricUpdateRequest { - this := LogsMetricUpdateRequest{} - this.Data = data - return &this -} - -// NewLogsMetricUpdateRequestWithDefaults instantiates a new LogsMetricUpdateRequest 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 NewLogsMetricUpdateRequestWithDefaults() *LogsMetricUpdateRequest { - this := LogsMetricUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *LogsMetricUpdateRequest) GetData() LogsMetricUpdateData { - if o == nil { - var ret LogsMetricUpdateData - 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 *LogsMetricUpdateRequest) GetDataOk() (*LogsMetricUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *LogsMetricUpdateRequest) SetData(v LogsMetricUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *LogsMetricUpdateData `json:"data"` - }{} - all := struct { - Data LogsMetricUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_metrics_response.go b/api/v2/datadog/model_logs_metrics_response.go deleted file mode 100644 index 1a2e168d656..00000000000 --- a/api/v2/datadog/model_logs_metrics_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsMetricsResponse All the available log-based metric objects. -type LogsMetricsResponse struct { - // A list of log-based metric objects. - Data []LogsMetricResponseData `json:"data,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{} -} - -// NewLogsMetricsResponse instantiates a new LogsMetricsResponse 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 NewLogsMetricsResponse() *LogsMetricsResponse { - this := LogsMetricsResponse{} - return &this -} - -// NewLogsMetricsResponseWithDefaults instantiates a new LogsMetricsResponse 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 NewLogsMetricsResponseWithDefaults() *LogsMetricsResponse { - this := LogsMetricsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *LogsMetricsResponse) GetData() []LogsMetricResponseData { - if o == nil || o.Data == nil { - var ret []LogsMetricResponseData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsMetricsResponse) GetDataOk() (*[]LogsMetricResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *LogsMetricsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []LogsMetricResponseData and assigns it to the Data field. -func (o *LogsMetricsResponse) SetData(v []LogsMetricResponseData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsMetricsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []LogsMetricResponseData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_logs_query_filter.go b/api/v2/datadog/model_logs_query_filter.go deleted file mode 100644 index 32b8a26d39f..00000000000 --- a/api/v2/datadog/model_logs_query_filter.go +++ /dev/null @@ -1,231 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsQueryFilter The search and filter query settings -type LogsQueryFilter struct { - // The minimum time for the requested logs, supports date math and regular timestamps (milliseconds). - From *string `json:"from,omitempty"` - // For customers with multiple indexes, the indexes to search. Defaults to ['*'] which means all indexes. - Indexes []string `json:"indexes,omitempty"` - // The search query - following the log search syntax. - Query *string `json:"query,omitempty"` - // The maximum time for the requested logs, supports date math and regular timestamps (milliseconds). - To *string `json:"to,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{} -} - -// NewLogsQueryFilter instantiates a new LogsQueryFilter 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 NewLogsQueryFilter() *LogsQueryFilter { - this := LogsQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// NewLogsQueryFilterWithDefaults instantiates a new LogsQueryFilter 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 NewLogsQueryFilterWithDefaults() *LogsQueryFilter { - this := LogsQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// GetFrom returns the From field value if set, zero value otherwise. -func (o *LogsQueryFilter) GetFrom() string { - if o == nil || o.From == nil { - var ret string - return ret - } - return *o.From -} - -// GetFromOk returns a tuple with the From field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryFilter) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { - return nil, false - } - return o.From, true -} - -// HasFrom returns a boolean if a field has been set. -func (o *LogsQueryFilter) HasFrom() bool { - if o != nil && o.From != nil { - return true - } - - return false -} - -// SetFrom gets a reference to the given string and assigns it to the From field. -func (o *LogsQueryFilter) SetFrom(v string) { - o.From = &v -} - -// GetIndexes returns the Indexes field value if set, zero value otherwise. -func (o *LogsQueryFilter) GetIndexes() []string { - if o == nil || o.Indexes == nil { - var ret []string - return ret - } - return o.Indexes -} - -// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryFilter) GetIndexesOk() (*[]string, bool) { - if o == nil || o.Indexes == nil { - return nil, false - } - return &o.Indexes, true -} - -// HasIndexes returns a boolean if a field has been set. -func (o *LogsQueryFilter) HasIndexes() bool { - if o != nil && o.Indexes != nil { - return true - } - - return false -} - -// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. -func (o *LogsQueryFilter) SetIndexes(v []string) { - o.Indexes = v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *LogsQueryFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *LogsQueryFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *LogsQueryFilter) SetQuery(v string) { - o.Query = &v -} - -// GetTo returns the To field value if set, zero value otherwise. -func (o *LogsQueryFilter) GetTo() string { - if o == nil || o.To == nil { - var ret string - return ret - } - return *o.To -} - -// GetToOk returns a tuple with the To field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryFilter) GetToOk() (*string, bool) { - if o == nil || o.To == nil { - return nil, false - } - return o.To, true -} - -// HasTo returns a boolean if a field has been set. -func (o *LogsQueryFilter) HasTo() bool { - if o != nil && o.To != nil { - return true - } - - return false -} - -// SetTo gets a reference to the given string and assigns it to the To field. -func (o *LogsQueryFilter) SetTo(v string) { - o.To = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsQueryFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.From != nil { - toSerialize["from"] = o.From - } - if o.Indexes != nil { - toSerialize["indexes"] = o.Indexes - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.To != nil { - toSerialize["to"] = o.To - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - From *string `json:"from,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Query *string `json:"query,omitempty"` - To *string `json:"to,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.From = all.From - o.Indexes = all.Indexes - o.Query = all.Query - o.To = all.To - return nil -} diff --git a/api/v2/datadog/model_logs_query_options.go b/api/v2/datadog/model_logs_query_options.go deleted file mode 100644 index 8df56d2a05f..00000000000 --- a/api/v2/datadog/model_logs_query_options.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsQueryOptions Global query options that are used during the query. -// Note: You should only supply timezone or time offset but not both otherwise the query will fail. -type LogsQueryOptions struct { - // The time offset (in seconds) to apply to the query. - TimeOffset *int64 `json:"timeOffset,omitempty"` - // The timezone can be specified both as an offset, for example: "UTC+03:00". - Timezone *string `json:"timezone,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{} -} - -// NewLogsQueryOptions instantiates a new LogsQueryOptions 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 NewLogsQueryOptions() *LogsQueryOptions { - this := LogsQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// NewLogsQueryOptionsWithDefaults instantiates a new LogsQueryOptions 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 NewLogsQueryOptionsWithDefaults() *LogsQueryOptions { - this := LogsQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. -func (o *LogsQueryOptions) GetTimeOffset() int64 { - if o == nil || o.TimeOffset == nil { - var ret int64 - return ret - } - return *o.TimeOffset -} - -// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryOptions) GetTimeOffsetOk() (*int64, bool) { - if o == nil || o.TimeOffset == nil { - return nil, false - } - return o.TimeOffset, true -} - -// HasTimeOffset returns a boolean if a field has been set. -func (o *LogsQueryOptions) HasTimeOffset() bool { - if o != nil && o.TimeOffset != nil { - return true - } - - return false -} - -// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. -func (o *LogsQueryOptions) SetTimeOffset(v int64) { - o.TimeOffset = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *LogsQueryOptions) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsQueryOptions) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *LogsQueryOptions) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *LogsQueryOptions) SetTimezone(v string) { - o.Timezone = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsQueryOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TimeOffset != nil { - toSerialize["timeOffset"] = o.TimeOffset - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TimeOffset *int64 `json:"timeOffset,omitempty"` - Timezone *string `json:"timezone,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TimeOffset = all.TimeOffset - o.Timezone = all.Timezone - return nil -} diff --git a/api/v2/datadog/model_logs_response_metadata.go b/api/v2/datadog/model_logs_response_metadata.go deleted file mode 100644 index 16a023a82b4..00000000000 --- a/api/v2/datadog/model_logs_response_metadata.go +++ /dev/null @@ -1,274 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsResponseMetadata The metadata associated with a request -type LogsResponseMetadata struct { - // The time elapsed in milliseconds - Elapsed *int64 `json:"elapsed,omitempty"` - // Paging attributes. - Page *LogsResponseMetadataPage `json:"page,omitempty"` - // The identifier of the request - RequestId *string `json:"request_id,omitempty"` - // The status of the response - Status *LogsAggregateResponseStatus `json:"status,omitempty"` - // A list of warnings (non fatal errors) encountered, partial results might be returned if - // warnings are present in the response. - Warnings []LogsWarning `json:"warnings,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{} -} - -// NewLogsResponseMetadata instantiates a new LogsResponseMetadata 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 NewLogsResponseMetadata() *LogsResponseMetadata { - this := LogsResponseMetadata{} - return &this -} - -// NewLogsResponseMetadataWithDefaults instantiates a new LogsResponseMetadata 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 NewLogsResponseMetadataWithDefaults() *LogsResponseMetadata { - this := LogsResponseMetadata{} - return &this -} - -// GetElapsed returns the Elapsed field value if set, zero value otherwise. -func (o *LogsResponseMetadata) GetElapsed() int64 { - if o == nil || o.Elapsed == nil { - var ret int64 - return ret - } - return *o.Elapsed -} - -// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsResponseMetadata) GetElapsedOk() (*int64, bool) { - if o == nil || o.Elapsed == nil { - return nil, false - } - return o.Elapsed, true -} - -// HasElapsed returns a boolean if a field has been set. -func (o *LogsResponseMetadata) HasElapsed() bool { - if o != nil && o.Elapsed != nil { - return true - } - - return false -} - -// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. -func (o *LogsResponseMetadata) SetElapsed(v int64) { - o.Elapsed = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *LogsResponseMetadata) GetPage() LogsResponseMetadataPage { - if o == nil || o.Page == nil { - var ret LogsResponseMetadataPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsResponseMetadata) GetPageOk() (*LogsResponseMetadataPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *LogsResponseMetadata) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given LogsResponseMetadataPage and assigns it to the Page field. -func (o *LogsResponseMetadata) SetPage(v LogsResponseMetadataPage) { - o.Page = &v -} - -// GetRequestId returns the RequestId field value if set, zero value otherwise. -func (o *LogsResponseMetadata) GetRequestId() string { - if o == nil || o.RequestId == nil { - var ret string - return ret - } - return *o.RequestId -} - -// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsResponseMetadata) GetRequestIdOk() (*string, bool) { - if o == nil || o.RequestId == nil { - return nil, false - } - return o.RequestId, true -} - -// HasRequestId returns a boolean if a field has been set. -func (o *LogsResponseMetadata) HasRequestId() bool { - if o != nil && o.RequestId != nil { - return true - } - - return false -} - -// SetRequestId gets a reference to the given string and assigns it to the RequestId field. -func (o *LogsResponseMetadata) SetRequestId(v string) { - o.RequestId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *LogsResponseMetadata) GetStatus() LogsAggregateResponseStatus { - if o == nil || o.Status == nil { - var ret LogsAggregateResponseStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsResponseMetadata) GetStatusOk() (*LogsAggregateResponseStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *LogsResponseMetadata) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given LogsAggregateResponseStatus and assigns it to the Status field. -func (o *LogsResponseMetadata) SetStatus(v LogsAggregateResponseStatus) { - o.Status = &v -} - -// GetWarnings returns the Warnings field value if set, zero value otherwise. -func (o *LogsResponseMetadata) GetWarnings() []LogsWarning { - if o == nil || o.Warnings == nil { - var ret []LogsWarning - return ret - } - return o.Warnings -} - -// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsResponseMetadata) GetWarningsOk() (*[]LogsWarning, bool) { - if o == nil || o.Warnings == nil { - return nil, false - } - return &o.Warnings, true -} - -// HasWarnings returns a boolean if a field has been set. -func (o *LogsResponseMetadata) HasWarnings() bool { - if o != nil && o.Warnings != nil { - return true - } - - return false -} - -// SetWarnings gets a reference to the given []LogsWarning and assigns it to the Warnings field. -func (o *LogsResponseMetadata) SetWarnings(v []LogsWarning) { - o.Warnings = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsResponseMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Elapsed != nil { - toSerialize["elapsed"] = o.Elapsed - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.RequestId != nil { - toSerialize["request_id"] = o.RequestId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Warnings != nil { - toSerialize["warnings"] = o.Warnings - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Elapsed *int64 `json:"elapsed,omitempty"` - Page *LogsResponseMetadataPage `json:"page,omitempty"` - RequestId *string `json:"request_id,omitempty"` - Status *LogsAggregateResponseStatus `json:"status,omitempty"` - Warnings []LogsWarning `json:"warnings,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Elapsed = all.Elapsed - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.RequestId = all.RequestId - o.Status = all.Status - o.Warnings = all.Warnings - return nil -} diff --git a/api/v2/datadog/model_logs_response_metadata_page.go b/api/v2/datadog/model_logs_response_metadata_page.go deleted file mode 100644 index ffcdf388e76..00000000000 --- a/api/v2/datadog/model_logs_response_metadata_page.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsResponseMetadataPage Paging attributes. -type LogsResponseMetadataPage struct { - // The cursor to use to get the next results, if any. To make the next request, use the same. - // parameters with the addition of the `page[cursor]`. - After *string `json:"after,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{} -} - -// NewLogsResponseMetadataPage instantiates a new LogsResponseMetadataPage 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 NewLogsResponseMetadataPage() *LogsResponseMetadataPage { - this := LogsResponseMetadataPage{} - return &this -} - -// NewLogsResponseMetadataPageWithDefaults instantiates a new LogsResponseMetadataPage 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 NewLogsResponseMetadataPageWithDefaults() *LogsResponseMetadataPage { - this := LogsResponseMetadataPage{} - return &this -} - -// GetAfter returns the After field value if set, zero value otherwise. -func (o *LogsResponseMetadataPage) GetAfter() string { - if o == nil || o.After == nil { - var ret string - return ret - } - return *o.After -} - -// GetAfterOk returns a tuple with the After field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsResponseMetadataPage) GetAfterOk() (*string, bool) { - if o == nil || o.After == nil { - return nil, false - } - return o.After, true -} - -// HasAfter returns a boolean if a field has been set. -func (o *LogsResponseMetadataPage) HasAfter() bool { - if o != nil && o.After != nil { - return true - } - - return false -} - -// SetAfter gets a reference to the given string and assigns it to the After field. -func (o *LogsResponseMetadataPage) SetAfter(v string) { - o.After = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsResponseMetadataPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.After != nil { - toSerialize["after"] = o.After - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - After *string `json:"after,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.After = all.After - return nil -} diff --git a/api/v2/datadog/model_logs_sort.go b/api/v2/datadog/model_logs_sort.go deleted file mode 100644 index 27dd5bd2c7d..00000000000 --- a/api/v2/datadog/model_logs_sort.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsSort Sort parameters when querying logs. -type LogsSort string - -// List of LogsSort. -const ( - LOGSSORT_TIMESTAMP_ASCENDING LogsSort = "timestamp" - LOGSSORT_TIMESTAMP_DESCENDING LogsSort = "-timestamp" -) - -var allowedLogsSortEnumValues = []LogsSort{ - LOGSSORT_TIMESTAMP_ASCENDING, - LOGSSORT_TIMESTAMP_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsSort) GetAllowedValues() []LogsSort { - return allowedLogsSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsSort(value) - return nil -} - -// NewLogsSortFromValue returns a pointer to a valid LogsSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsSortFromValue(v string) (*LogsSort, error) { - ev := LogsSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsSort: valid values are %v", v, allowedLogsSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsSort) IsValid() bool { - for _, existing := range allowedLogsSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsSort value. -func (v LogsSort) Ptr() *LogsSort { - return &v -} - -// NullableLogsSort handles when a null is used for LogsSort. -type NullableLogsSort struct { - value *LogsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsSort) Get() *LogsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsSort) Set(val *LogsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsSort initializes the struct as if Set has been called. -func NewNullableLogsSort(val *LogsSort) *NullableLogsSort { - return &NullableLogsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_sort_order.go b/api/v2/datadog/model_logs_sort_order.go deleted file mode 100644 index c574550dfc9..00000000000 --- a/api/v2/datadog/model_logs_sort_order.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// LogsSortOrder The order to use, ascending or descending -type LogsSortOrder string - -// List of LogsSortOrder. -const ( - LOGSSORTORDER_ASCENDING LogsSortOrder = "asc" - LOGSSORTORDER_DESCENDING LogsSortOrder = "desc" -) - -var allowedLogsSortOrderEnumValues = []LogsSortOrder{ - LOGSSORTORDER_ASCENDING, - LOGSSORTORDER_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *LogsSortOrder) GetAllowedValues() []LogsSortOrder { - return allowedLogsSortOrderEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *LogsSortOrder) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = LogsSortOrder(value) - return nil -} - -// NewLogsSortOrderFromValue returns a pointer to a valid LogsSortOrder -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewLogsSortOrderFromValue(v string) (*LogsSortOrder, error) { - ev := LogsSortOrder(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for LogsSortOrder: valid values are %v", v, allowedLogsSortOrderEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v LogsSortOrder) IsValid() bool { - for _, existing := range allowedLogsSortOrderEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to LogsSortOrder value. -func (v LogsSortOrder) Ptr() *LogsSortOrder { - return &v -} - -// NullableLogsSortOrder handles when a null is used for LogsSortOrder. -type NullableLogsSortOrder struct { - value *LogsSortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableLogsSortOrder) Get() *LogsSortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableLogsSortOrder) Set(val *LogsSortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableLogsSortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableLogsSortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableLogsSortOrder initializes the struct as if Set has been called. -func NewNullableLogsSortOrder(val *LogsSortOrder) *NullableLogsSortOrder { - return &NullableLogsSortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableLogsSortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableLogsSortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_logs_warning.go b/api/v2/datadog/model_logs_warning.go deleted file mode 100644 index 41750f78eac..00000000000 --- a/api/v2/datadog/model_logs_warning.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// LogsWarning A warning message indicating something that went wrong with the query -type LogsWarning struct { - // A unique code for this type of warning - Code *string `json:"code,omitempty"` - // A detailed explanation of this specific warning - Detail *string `json:"detail,omitempty"` - // A short human-readable summary of the warning - Title *string `json:"title,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{} -} - -// NewLogsWarning instantiates a new LogsWarning 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 NewLogsWarning() *LogsWarning { - this := LogsWarning{} - return &this -} - -// NewLogsWarningWithDefaults instantiates a new LogsWarning 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 NewLogsWarningWithDefaults() *LogsWarning { - this := LogsWarning{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *LogsWarning) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsWarning) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *LogsWarning) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *LogsWarning) SetCode(v string) { - o.Code = &v -} - -// GetDetail returns the Detail field value if set, zero value otherwise. -func (o *LogsWarning) GetDetail() string { - if o == nil || o.Detail == nil { - var ret string - return ret - } - return *o.Detail -} - -// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsWarning) GetDetailOk() (*string, bool) { - if o == nil || o.Detail == nil { - return nil, false - } - return o.Detail, true -} - -// HasDetail returns a boolean if a field has been set. -func (o *LogsWarning) HasDetail() bool { - if o != nil && o.Detail != nil { - return true - } - - return false -} - -// SetDetail gets a reference to the given string and assigns it to the Detail field. -func (o *LogsWarning) SetDetail(v string) { - o.Detail = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *LogsWarning) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LogsWarning) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *LogsWarning) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *LogsWarning) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o LogsWarning) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Detail != nil { - toSerialize["detail"] = o.Detail - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *LogsWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *string `json:"code,omitempty"` - Detail *string `json:"detail,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Detail = all.Detail - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_metric.go b/api/v2/datadog/model_metric.go deleted file mode 100644 index 9013231343e..00000000000 --- a/api/v2/datadog/model_metric.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Metric Object for a single metric tag configuration. -type Metric struct { - // The metric name for this resource. - Id *string `json:"id,omitempty"` - // The metric resource type. - Type *MetricType `json:"type,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{} -} - -// NewMetric instantiates a new Metric 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 NewMetric() *Metric { - this := Metric{} - var typeVar MetricType = METRICTYPE_METRICS - this.Type = &typeVar - return &this -} - -// NewMetricWithDefaults instantiates a new Metric 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 NewMetricWithDefaults() *Metric { - this := Metric{} - var typeVar MetricType = METRICTYPE_METRICS - this.Type = &typeVar - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Metric) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Metric) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Metric) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Metric) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *Metric) GetType() MetricType { - if o == nil || o.Type == nil { - var ret MetricType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Metric) GetTypeOk() (*MetricType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *Metric) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MetricType and assigns it to the Type field. -func (o *Metric) SetType(v MetricType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Metric) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Metric) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Type *MetricType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_all_tags.go b/api/v2/datadog/model_metric_all_tags.go deleted file mode 100644 index 94a9cafd94f..00000000000 --- a/api/v2/datadog/model_metric_all_tags.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricAllTags Object for a single metric's indexed tags. -type MetricAllTags struct { - // Object containing the definition of a metric's tags. - Attributes *MetricAllTagsAttributes `json:"attributes,omitempty"` - // The metric name for this resource. - Id *string `json:"id,omitempty"` - // The metric resource type. - Type *MetricType `json:"type,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{} -} - -// NewMetricAllTags instantiates a new MetricAllTags 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 NewMetricAllTags() *MetricAllTags { - this := MetricAllTags{} - var typeVar MetricType = METRICTYPE_METRICS - this.Type = &typeVar - return &this -} - -// NewMetricAllTagsWithDefaults instantiates a new MetricAllTags 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 NewMetricAllTagsWithDefaults() *MetricAllTags { - this := MetricAllTags{} - var typeVar MetricType = METRICTYPE_METRICS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricAllTags) GetAttributes() MetricAllTagsAttributes { - if o == nil || o.Attributes == nil { - var ret MetricAllTagsAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricAllTags) GetAttributesOk() (*MetricAllTagsAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricAllTags) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricAllTagsAttributes and assigns it to the Attributes field. -func (o *MetricAllTags) SetAttributes(v MetricAllTagsAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MetricAllTags) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricAllTags) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MetricAllTags) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *MetricAllTags) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricAllTags) GetType() MetricType { - if o == nil || o.Type == nil { - var ret MetricType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricAllTags) GetTypeOk() (*MetricType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricAllTags) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MetricType and assigns it to the Type field. -func (o *MetricAllTags) SetType(v MetricType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricAllTags) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricAllTags) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *MetricAllTagsAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *MetricType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_all_tags_attributes.go b/api/v2/datadog/model_metric_all_tags_attributes.go deleted file mode 100644 index e2a7da9c3df..00000000000 --- a/api/v2/datadog/model_metric_all_tags_attributes.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricAllTagsAttributes Object containing the definition of a metric's tags. -type MetricAllTagsAttributes struct { - // List of indexed tag value pairs. - Tags []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{} -} - -// NewMetricAllTagsAttributes instantiates a new MetricAllTagsAttributes 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 NewMetricAllTagsAttributes() *MetricAllTagsAttributes { - this := MetricAllTagsAttributes{} - return &this -} - -// NewMetricAllTagsAttributesWithDefaults instantiates a new MetricAllTagsAttributes 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 NewMetricAllTagsAttributesWithDefaults() *MetricAllTagsAttributes { - this := MetricAllTagsAttributes{} - return &this -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MetricAllTagsAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MetricAllTagsAttributes) GetTagsOk() (*[]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 *MetricAllTagsAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MetricAllTagsAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricAllTagsAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricAllTagsAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Tags = all.Tags - return nil -} diff --git a/api/v2/datadog/model_metric_all_tags_response.go b/api/v2/datadog/model_metric_all_tags_response.go deleted file mode 100644 index 0523dfaf244..00000000000 --- a/api/v2/datadog/model_metric_all_tags_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricAllTagsResponse Response object that includes a single metric's indexed tags. -type MetricAllTagsResponse struct { - // Object for a single metric's indexed tags. - Data *MetricAllTags `json:"data,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{} -} - -// NewMetricAllTagsResponse instantiates a new MetricAllTagsResponse 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 NewMetricAllTagsResponse() *MetricAllTagsResponse { - this := MetricAllTagsResponse{} - return &this -} - -// NewMetricAllTagsResponseWithDefaults instantiates a new MetricAllTagsResponse 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 NewMetricAllTagsResponseWithDefaults() *MetricAllTagsResponse { - this := MetricAllTagsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *MetricAllTagsResponse) GetData() MetricAllTags { - if o == nil || o.Data == nil { - var ret MetricAllTags - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricAllTagsResponse) GetDataOk() (*MetricAllTags, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *MetricAllTagsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given MetricAllTags and assigns it to the Data field. -func (o *MetricAllTagsResponse) SetData(v MetricAllTags) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricAllTagsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricAllTagsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *MetricAllTags `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_configure_tags_type.go b/api/v2/datadog/model_metric_bulk_configure_tags_type.go deleted file mode 100644 index 01ea3bb6eb7..00000000000 --- a/api/v2/datadog/model_metric_bulk_configure_tags_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricBulkConfigureTagsType The metric bulk configure tags resource. -type MetricBulkConfigureTagsType string - -// List of MetricBulkConfigureTagsType. -const ( - METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS MetricBulkConfigureTagsType = "metric_bulk_configure_tags" -) - -var allowedMetricBulkConfigureTagsTypeEnumValues = []MetricBulkConfigureTagsType{ - METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricBulkConfigureTagsType) GetAllowedValues() []MetricBulkConfigureTagsType { - return allowedMetricBulkConfigureTagsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricBulkConfigureTagsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricBulkConfigureTagsType(value) - return nil -} - -// NewMetricBulkConfigureTagsTypeFromValue returns a pointer to a valid MetricBulkConfigureTagsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricBulkConfigureTagsTypeFromValue(v string) (*MetricBulkConfigureTagsType, error) { - ev := MetricBulkConfigureTagsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricBulkConfigureTagsType: valid values are %v", v, allowedMetricBulkConfigureTagsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricBulkConfigureTagsType) IsValid() bool { - for _, existing := range allowedMetricBulkConfigureTagsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricBulkConfigureTagsType value. -func (v MetricBulkConfigureTagsType) Ptr() *MetricBulkConfigureTagsType { - return &v -} - -// NullableMetricBulkConfigureTagsType handles when a null is used for MetricBulkConfigureTagsType. -type NullableMetricBulkConfigureTagsType struct { - value *MetricBulkConfigureTagsType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricBulkConfigureTagsType) Get() *MetricBulkConfigureTagsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricBulkConfigureTagsType) Set(val *MetricBulkConfigureTagsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricBulkConfigureTagsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricBulkConfigureTagsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricBulkConfigureTagsType initializes the struct as if Set has been called. -func NewNullableMetricBulkConfigureTagsType(val *MetricBulkConfigureTagsType) *NullableMetricBulkConfigureTagsType { - return &NullableMetricBulkConfigureTagsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricBulkConfigureTagsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricBulkConfigureTagsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_create.go b/api/v2/datadog/model_metric_bulk_tag_config_create.go deleted file mode 100644 index 2b9c2120ecb..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_create.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricBulkTagConfigCreate Request object to bulk configure tags for metrics matching the given prefix. -type MetricBulkTagConfigCreate struct { - // Optional parameters for bulk creating metric tag configurations. - Attributes *MetricBulkTagConfigCreateAttributes `json:"attributes,omitempty"` - // A text prefix to match against metric names. - Id string `json:"id"` - // The metric bulk configure tags resource. - Type MetricBulkConfigureTagsType `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{} -} - -// NewMetricBulkTagConfigCreate instantiates a new MetricBulkTagConfigCreate 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 NewMetricBulkTagConfigCreate(id string, typeVar MetricBulkConfigureTagsType) *MetricBulkTagConfigCreate { - this := MetricBulkTagConfigCreate{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewMetricBulkTagConfigCreateWithDefaults instantiates a new MetricBulkTagConfigCreate 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 NewMetricBulkTagConfigCreateWithDefaults() *MetricBulkTagConfigCreate { - this := MetricBulkTagConfigCreate{} - var typeVar MetricBulkConfigureTagsType = METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricBulkTagConfigCreate) GetAttributes() MetricBulkTagConfigCreateAttributes { - if o == nil || o.Attributes == nil { - var ret MetricBulkTagConfigCreateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigCreate) GetAttributesOk() (*MetricBulkTagConfigCreateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricBulkTagConfigCreate) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricBulkTagConfigCreateAttributes and assigns it to the Attributes field. -func (o *MetricBulkTagConfigCreate) SetAttributes(v MetricBulkTagConfigCreateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *MetricBulkTagConfigCreate) 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 *MetricBulkTagConfigCreate) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *MetricBulkTagConfigCreate) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *MetricBulkTagConfigCreate) GetType() MetricBulkConfigureTagsType { - if o == nil { - var ret MetricBulkConfigureTagsType - 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 *MetricBulkTagConfigCreate) GetTypeOk() (*MetricBulkConfigureTagsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *MetricBulkTagConfigCreate) SetType(v MetricBulkConfigureTagsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigCreate) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricBulkConfigureTagsType `json:"type"` - }{} - all := struct { - Attributes *MetricBulkTagConfigCreateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricBulkConfigureTagsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go b/api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go deleted file mode 100644 index 89641e9ca28..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricBulkTagConfigCreateAttributes Optional parameters for bulk creating metric tag configurations. -type MetricBulkTagConfigCreateAttributes struct { - // A list of account emails to notify when the configuration is applied. - Emails []string `json:"emails,omitempty"` - // A list of tag names to apply to the configuration. - Tags []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{} -} - -// NewMetricBulkTagConfigCreateAttributes instantiates a new MetricBulkTagConfigCreateAttributes 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 NewMetricBulkTagConfigCreateAttributes() *MetricBulkTagConfigCreateAttributes { - this := MetricBulkTagConfigCreateAttributes{} - return &this -} - -// NewMetricBulkTagConfigCreateAttributesWithDefaults instantiates a new MetricBulkTagConfigCreateAttributes 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 NewMetricBulkTagConfigCreateAttributesWithDefaults() *MetricBulkTagConfigCreateAttributes { - this := MetricBulkTagConfigCreateAttributes{} - return &this -} - -// GetEmails returns the Emails field value if set, zero value otherwise. -func (o *MetricBulkTagConfigCreateAttributes) GetEmails() []string { - if o == nil || o.Emails == nil { - var ret []string - return ret - } - return o.Emails -} - -// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigCreateAttributes) GetEmailsOk() (*[]string, bool) { - if o == nil || o.Emails == nil { - return nil, false - } - return &o.Emails, true -} - -// HasEmails returns a boolean if a field has been set. -func (o *MetricBulkTagConfigCreateAttributes) HasEmails() bool { - if o != nil && o.Emails != nil { - return true - } - - return false -} - -// SetEmails gets a reference to the given []string and assigns it to the Emails field. -func (o *MetricBulkTagConfigCreateAttributes) SetEmails(v []string) { - o.Emails = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MetricBulkTagConfigCreateAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MetricBulkTagConfigCreateAttributes) GetTagsOk() (*[]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 *MetricBulkTagConfigCreateAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MetricBulkTagConfigCreateAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Emails != nil { - toSerialize["emails"] = o.Emails - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Emails []string `json:"emails,omitempty"` - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Emails = all.Emails - o.Tags = all.Tags - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_create_request.go b/api/v2/datadog/model_metric_bulk_tag_config_create_request.go deleted file mode 100644 index c5d21b0242f..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricBulkTagConfigCreateRequest Wrapper object for a single bulk tag configuration request. -type MetricBulkTagConfigCreateRequest struct { - // Request object to bulk configure tags for metrics matching the given prefix. - Data MetricBulkTagConfigCreate `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{} -} - -// NewMetricBulkTagConfigCreateRequest instantiates a new MetricBulkTagConfigCreateRequest 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 NewMetricBulkTagConfigCreateRequest(data MetricBulkTagConfigCreate) *MetricBulkTagConfigCreateRequest { - this := MetricBulkTagConfigCreateRequest{} - this.Data = data - return &this -} - -// NewMetricBulkTagConfigCreateRequestWithDefaults instantiates a new MetricBulkTagConfigCreateRequest 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 NewMetricBulkTagConfigCreateRequestWithDefaults() *MetricBulkTagConfigCreateRequest { - this := MetricBulkTagConfigCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *MetricBulkTagConfigCreateRequest) GetData() MetricBulkTagConfigCreate { - if o == nil { - var ret MetricBulkTagConfigCreate - 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 *MetricBulkTagConfigCreateRequest) GetDataOk() (*MetricBulkTagConfigCreate, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *MetricBulkTagConfigCreateRequest) SetData(v MetricBulkTagConfigCreate) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *MetricBulkTagConfigCreate `json:"data"` - }{} - all := struct { - Data MetricBulkTagConfigCreate `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_delete.go b/api/v2/datadog/model_metric_bulk_tag_config_delete.go deleted file mode 100644 index 54223440cc8..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_delete.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricBulkTagConfigDelete Request object to bulk delete all tag configurations for metrics matching the given prefix. -type MetricBulkTagConfigDelete struct { - // Optional parameters for bulk deleting metric tag configurations. - Attributes *MetricBulkTagConfigDeleteAttributes `json:"attributes,omitempty"` - // A text prefix to match against metric names. - Id string `json:"id"` - // The metric bulk configure tags resource. - Type MetricBulkConfigureTagsType `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{} -} - -// NewMetricBulkTagConfigDelete instantiates a new MetricBulkTagConfigDelete 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 NewMetricBulkTagConfigDelete(id string, typeVar MetricBulkConfigureTagsType) *MetricBulkTagConfigDelete { - this := MetricBulkTagConfigDelete{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewMetricBulkTagConfigDeleteWithDefaults instantiates a new MetricBulkTagConfigDelete 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 NewMetricBulkTagConfigDeleteWithDefaults() *MetricBulkTagConfigDelete { - this := MetricBulkTagConfigDelete{} - var typeVar MetricBulkConfigureTagsType = METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricBulkTagConfigDelete) GetAttributes() MetricBulkTagConfigDeleteAttributes { - if o == nil || o.Attributes == nil { - var ret MetricBulkTagConfigDeleteAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigDelete) GetAttributesOk() (*MetricBulkTagConfigDeleteAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricBulkTagConfigDelete) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricBulkTagConfigDeleteAttributes and assigns it to the Attributes field. -func (o *MetricBulkTagConfigDelete) SetAttributes(v MetricBulkTagConfigDeleteAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *MetricBulkTagConfigDelete) 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 *MetricBulkTagConfigDelete) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *MetricBulkTagConfigDelete) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *MetricBulkTagConfigDelete) GetType() MetricBulkConfigureTagsType { - if o == nil { - var ret MetricBulkConfigureTagsType - 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 *MetricBulkTagConfigDelete) GetTypeOk() (*MetricBulkConfigureTagsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *MetricBulkTagConfigDelete) SetType(v MetricBulkConfigureTagsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigDelete) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigDelete) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricBulkConfigureTagsType `json:"type"` - }{} - all := struct { - Attributes *MetricBulkTagConfigDeleteAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricBulkConfigureTagsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_delete_attributes.go b/api/v2/datadog/model_metric_bulk_tag_config_delete_attributes.go deleted file mode 100644 index c0ff7576f56..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_delete_attributes.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricBulkTagConfigDeleteAttributes Optional parameters for bulk deleting metric tag configurations. -type MetricBulkTagConfigDeleteAttributes struct { - // A list of account emails to notify when the configuration is applied. - Emails []string `json:"emails,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{} -} - -// NewMetricBulkTagConfigDeleteAttributes instantiates a new MetricBulkTagConfigDeleteAttributes 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 NewMetricBulkTagConfigDeleteAttributes() *MetricBulkTagConfigDeleteAttributes { - this := MetricBulkTagConfigDeleteAttributes{} - return &this -} - -// NewMetricBulkTagConfigDeleteAttributesWithDefaults instantiates a new MetricBulkTagConfigDeleteAttributes 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 NewMetricBulkTagConfigDeleteAttributesWithDefaults() *MetricBulkTagConfigDeleteAttributes { - this := MetricBulkTagConfigDeleteAttributes{} - return &this -} - -// GetEmails returns the Emails field value if set, zero value otherwise. -func (o *MetricBulkTagConfigDeleteAttributes) GetEmails() []string { - if o == nil || o.Emails == nil { - var ret []string - return ret - } - return o.Emails -} - -// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigDeleteAttributes) GetEmailsOk() (*[]string, bool) { - if o == nil || o.Emails == nil { - return nil, false - } - return &o.Emails, true -} - -// HasEmails returns a boolean if a field has been set. -func (o *MetricBulkTagConfigDeleteAttributes) HasEmails() bool { - if o != nil && o.Emails != nil { - return true - } - - return false -} - -// SetEmails gets a reference to the given []string and assigns it to the Emails field. -func (o *MetricBulkTagConfigDeleteAttributes) SetEmails(v []string) { - o.Emails = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigDeleteAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Emails != nil { - toSerialize["emails"] = o.Emails - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigDeleteAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Emails []string `json:"emails,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Emails = all.Emails - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_delete_request.go b/api/v2/datadog/model_metric_bulk_tag_config_delete_request.go deleted file mode 100644 index 6d3b70c1c9e..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_delete_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricBulkTagConfigDeleteRequest Wrapper object for a single bulk tag deletion request. -type MetricBulkTagConfigDeleteRequest struct { - // Request object to bulk delete all tag configurations for metrics matching the given prefix. - Data MetricBulkTagConfigDelete `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{} -} - -// NewMetricBulkTagConfigDeleteRequest instantiates a new MetricBulkTagConfigDeleteRequest 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 NewMetricBulkTagConfigDeleteRequest(data MetricBulkTagConfigDelete) *MetricBulkTagConfigDeleteRequest { - this := MetricBulkTagConfigDeleteRequest{} - this.Data = data - return &this -} - -// NewMetricBulkTagConfigDeleteRequestWithDefaults instantiates a new MetricBulkTagConfigDeleteRequest 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 NewMetricBulkTagConfigDeleteRequestWithDefaults() *MetricBulkTagConfigDeleteRequest { - this := MetricBulkTagConfigDeleteRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *MetricBulkTagConfigDeleteRequest) GetData() MetricBulkTagConfigDelete { - if o == nil { - var ret MetricBulkTagConfigDelete - 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 *MetricBulkTagConfigDeleteRequest) GetDataOk() (*MetricBulkTagConfigDelete, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *MetricBulkTagConfigDeleteRequest) SetData(v MetricBulkTagConfigDelete) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigDeleteRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *MetricBulkTagConfigDelete `json:"data"` - }{} - all := struct { - Data MetricBulkTagConfigDelete `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_response.go b/api/v2/datadog/model_metric_bulk_tag_config_response.go deleted file mode 100644 index 5b42b64f72f..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_response.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricBulkTagConfigResponse Wrapper for a single bulk tag configuration status response. -type MetricBulkTagConfigResponse struct { - // The status of a request to bulk configure metric tags. - // It contains the fields from the original request for reference. - Data *MetricBulkTagConfigStatus `json:"data,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{} -} - -// NewMetricBulkTagConfigResponse instantiates a new MetricBulkTagConfigResponse 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 NewMetricBulkTagConfigResponse() *MetricBulkTagConfigResponse { - this := MetricBulkTagConfigResponse{} - return &this -} - -// NewMetricBulkTagConfigResponseWithDefaults instantiates a new MetricBulkTagConfigResponse 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 NewMetricBulkTagConfigResponseWithDefaults() *MetricBulkTagConfigResponse { - this := MetricBulkTagConfigResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *MetricBulkTagConfigResponse) GetData() MetricBulkTagConfigStatus { - if o == nil || o.Data == nil { - var ret MetricBulkTagConfigStatus - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigResponse) GetDataOk() (*MetricBulkTagConfigStatus, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *MetricBulkTagConfigResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given MetricBulkTagConfigStatus and assigns it to the Data field. -func (o *MetricBulkTagConfigResponse) SetData(v MetricBulkTagConfigStatus) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *MetricBulkTagConfigStatus `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_status.go b/api/v2/datadog/model_metric_bulk_tag_config_status.go deleted file mode 100644 index c8d37845d50..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_status.go +++ /dev/null @@ -1,193 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricBulkTagConfigStatus The status of a request to bulk configure metric tags. -// It contains the fields from the original request for reference. -type MetricBulkTagConfigStatus struct { - // Optional attributes for the status of a bulk tag configuration request. - Attributes *MetricBulkTagConfigStatusAttributes `json:"attributes,omitempty"` - // A text prefix to match against metric names. - Id string `json:"id"` - // The metric bulk configure tags resource. - Type MetricBulkConfigureTagsType `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{} -} - -// NewMetricBulkTagConfigStatus instantiates a new MetricBulkTagConfigStatus 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 NewMetricBulkTagConfigStatus(id string, typeVar MetricBulkConfigureTagsType) *MetricBulkTagConfigStatus { - this := MetricBulkTagConfigStatus{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewMetricBulkTagConfigStatusWithDefaults instantiates a new MetricBulkTagConfigStatus 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 NewMetricBulkTagConfigStatusWithDefaults() *MetricBulkTagConfigStatus { - this := MetricBulkTagConfigStatus{} - var typeVar MetricBulkConfigureTagsType = METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricBulkTagConfigStatus) GetAttributes() MetricBulkTagConfigStatusAttributes { - if o == nil || o.Attributes == nil { - var ret MetricBulkTagConfigStatusAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigStatus) GetAttributesOk() (*MetricBulkTagConfigStatusAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricBulkTagConfigStatus) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricBulkTagConfigStatusAttributes and assigns it to the Attributes field. -func (o *MetricBulkTagConfigStatus) SetAttributes(v MetricBulkTagConfigStatusAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *MetricBulkTagConfigStatus) 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 *MetricBulkTagConfigStatus) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *MetricBulkTagConfigStatus) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *MetricBulkTagConfigStatus) GetType() MetricBulkConfigureTagsType { - if o == nil { - var ret MetricBulkConfigureTagsType - 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 *MetricBulkTagConfigStatus) GetTypeOk() (*MetricBulkConfigureTagsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *MetricBulkTagConfigStatus) SetType(v MetricBulkConfigureTagsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigStatus) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigStatus) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricBulkConfigureTagsType `json:"type"` - }{} - all := struct { - Attributes *MetricBulkTagConfigStatusAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricBulkConfigureTagsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go b/api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go deleted file mode 100644 index a34bc189aa5..00000000000 --- a/api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricBulkTagConfigStatusAttributes Optional attributes for the status of a bulk tag configuration request. -type MetricBulkTagConfigStatusAttributes struct { - // A list of account emails to notify when the configuration is applied. - Emails []string `json:"emails,omitempty"` - // The status of the request. - Status *string `json:"status,omitempty"` - // A list of tag names to apply to the configuration. - Tags []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{} -} - -// NewMetricBulkTagConfigStatusAttributes instantiates a new MetricBulkTagConfigStatusAttributes 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 NewMetricBulkTagConfigStatusAttributes() *MetricBulkTagConfigStatusAttributes { - this := MetricBulkTagConfigStatusAttributes{} - return &this -} - -// NewMetricBulkTagConfigStatusAttributesWithDefaults instantiates a new MetricBulkTagConfigStatusAttributes 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 NewMetricBulkTagConfigStatusAttributesWithDefaults() *MetricBulkTagConfigStatusAttributes { - this := MetricBulkTagConfigStatusAttributes{} - return &this -} - -// GetEmails returns the Emails field value if set, zero value otherwise. -func (o *MetricBulkTagConfigStatusAttributes) GetEmails() []string { - if o == nil || o.Emails == nil { - var ret []string - return ret - } - return o.Emails -} - -// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigStatusAttributes) GetEmailsOk() (*[]string, bool) { - if o == nil || o.Emails == nil { - return nil, false - } - return &o.Emails, true -} - -// HasEmails returns a boolean if a field has been set. -func (o *MetricBulkTagConfigStatusAttributes) HasEmails() bool { - if o != nil && o.Emails != nil { - return true - } - - return false -} - -// SetEmails gets a reference to the given []string and assigns it to the Emails field. -func (o *MetricBulkTagConfigStatusAttributes) SetEmails(v []string) { - o.Emails = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *MetricBulkTagConfigStatusAttributes) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricBulkTagConfigStatusAttributes) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *MetricBulkTagConfigStatusAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *MetricBulkTagConfigStatusAttributes) SetStatus(v string) { - o.Status = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MetricBulkTagConfigStatusAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MetricBulkTagConfigStatusAttributes) GetTagsOk() (*[]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 *MetricBulkTagConfigStatusAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MetricBulkTagConfigStatusAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricBulkTagConfigStatusAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Emails != nil { - toSerialize["emails"] = o.Emails - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricBulkTagConfigStatusAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Emails []string `json:"emails,omitempty"` - Status *string `json:"status,omitempty"` - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Emails = all.Emails - o.Status = all.Status - o.Tags = all.Tags - return nil -} diff --git a/api/v2/datadog/model_metric_content_encoding.go b/api/v2/datadog/model_metric_content_encoding.go deleted file mode 100644 index 05dc8ba28e3..00000000000 --- a/api/v2/datadog/model_metric_content_encoding.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricContentEncoding HTTP header used to compress the media-type. -type MetricContentEncoding string - -// List of MetricContentEncoding. -const ( - METRICCONTENTENCODING_DEFLATE MetricContentEncoding = "deflate" -) - -var allowedMetricContentEncodingEnumValues = []MetricContentEncoding{ - METRICCONTENTENCODING_DEFLATE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricContentEncoding) GetAllowedValues() []MetricContentEncoding { - return allowedMetricContentEncodingEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricContentEncoding) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricContentEncoding(value) - return nil -} - -// NewMetricContentEncodingFromValue returns a pointer to a valid MetricContentEncoding -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricContentEncodingFromValue(v string) (*MetricContentEncoding, error) { - ev := MetricContentEncoding(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricContentEncoding: valid values are %v", v, allowedMetricContentEncodingEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricContentEncoding) IsValid() bool { - for _, existing := range allowedMetricContentEncodingEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricContentEncoding value. -func (v MetricContentEncoding) Ptr() *MetricContentEncoding { - return &v -} - -// NullableMetricContentEncoding handles when a null is used for MetricContentEncoding. -type NullableMetricContentEncoding struct { - value *MetricContentEncoding - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricContentEncoding) Get() *MetricContentEncoding { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricContentEncoding) Set(val *MetricContentEncoding) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricContentEncoding) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricContentEncoding) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricContentEncoding initializes the struct as if Set has been called. -func NewNullableMetricContentEncoding(val *MetricContentEncoding) *NullableMetricContentEncoding { - return &NullableMetricContentEncoding{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricContentEncoding) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricContentEncoding) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_custom_aggregation.go b/api/v2/datadog/model_metric_custom_aggregation.go deleted file mode 100644 index 3455cf7f25c..00000000000 --- a/api/v2/datadog/model_metric_custom_aggregation.go +++ /dev/null @@ -1,152 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricCustomAggregation A time and space aggregation combination for use in query. -type MetricCustomAggregation struct { - // A space aggregation for use in query. - Space MetricCustomSpaceAggregation `json:"space"` - // A time aggregation for use in query. - Time MetricCustomTimeAggregation `json:"time"` - // 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{} -} - -// NewMetricCustomAggregation instantiates a new MetricCustomAggregation 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 NewMetricCustomAggregation(space MetricCustomSpaceAggregation, time MetricCustomTimeAggregation) *MetricCustomAggregation { - this := MetricCustomAggregation{} - this.Space = space - this.Time = time - return &this -} - -// NewMetricCustomAggregationWithDefaults instantiates a new MetricCustomAggregation 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 NewMetricCustomAggregationWithDefaults() *MetricCustomAggregation { - this := MetricCustomAggregation{} - return &this -} - -// GetSpace returns the Space field value. -func (o *MetricCustomAggregation) GetSpace() MetricCustomSpaceAggregation { - if o == nil { - var ret MetricCustomSpaceAggregation - return ret - } - return o.Space -} - -// GetSpaceOk returns a tuple with the Space field value -// and a boolean to check if the value has been set. -func (o *MetricCustomAggregation) GetSpaceOk() (*MetricCustomSpaceAggregation, bool) { - if o == nil { - return nil, false - } - return &o.Space, true -} - -// SetSpace sets field value. -func (o *MetricCustomAggregation) SetSpace(v MetricCustomSpaceAggregation) { - o.Space = v -} - -// GetTime returns the Time field value. -func (o *MetricCustomAggregation) GetTime() MetricCustomTimeAggregation { - if o == nil { - var ret MetricCustomTimeAggregation - return ret - } - return o.Time -} - -// GetTimeOk returns a tuple with the Time field value -// and a boolean to check if the value has been set. -func (o *MetricCustomAggregation) GetTimeOk() (*MetricCustomTimeAggregation, bool) { - if o == nil { - return nil, false - } - return &o.Time, true -} - -// SetTime sets field value. -func (o *MetricCustomAggregation) SetTime(v MetricCustomTimeAggregation) { - o.Time = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricCustomAggregation) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["space"] = o.Space - toSerialize["time"] = o.Time - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricCustomAggregation) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Space *MetricCustomSpaceAggregation `json:"space"` - Time *MetricCustomTimeAggregation `json:"time"` - }{} - all := struct { - Space MetricCustomSpaceAggregation `json:"space"` - Time MetricCustomTimeAggregation `json:"time"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Space == nil { - return fmt.Errorf("Required field space missing") - } - if required.Time == nil { - return fmt.Errorf("Required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Space; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Time; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Space = all.Space - o.Time = all.Time - return nil -} diff --git a/api/v2/datadog/model_metric_custom_space_aggregation.go b/api/v2/datadog/model_metric_custom_space_aggregation.go deleted file mode 100644 index c7e0d478bc4..00000000000 --- a/api/v2/datadog/model_metric_custom_space_aggregation.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricCustomSpaceAggregation A space aggregation for use in query. -type MetricCustomSpaceAggregation string - -// List of MetricCustomSpaceAggregation. -const ( - METRICCUSTOMSPACEAGGREGATION_AVG MetricCustomSpaceAggregation = "avg" - METRICCUSTOMSPACEAGGREGATION_MAX MetricCustomSpaceAggregation = "max" - METRICCUSTOMSPACEAGGREGATION_MIN MetricCustomSpaceAggregation = "min" - METRICCUSTOMSPACEAGGREGATION_SUM MetricCustomSpaceAggregation = "sum" -) - -var allowedMetricCustomSpaceAggregationEnumValues = []MetricCustomSpaceAggregation{ - METRICCUSTOMSPACEAGGREGATION_AVG, - METRICCUSTOMSPACEAGGREGATION_MAX, - METRICCUSTOMSPACEAGGREGATION_MIN, - METRICCUSTOMSPACEAGGREGATION_SUM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricCustomSpaceAggregation) GetAllowedValues() []MetricCustomSpaceAggregation { - return allowedMetricCustomSpaceAggregationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricCustomSpaceAggregation) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricCustomSpaceAggregation(value) - return nil -} - -// NewMetricCustomSpaceAggregationFromValue returns a pointer to a valid MetricCustomSpaceAggregation -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricCustomSpaceAggregationFromValue(v string) (*MetricCustomSpaceAggregation, error) { - ev := MetricCustomSpaceAggregation(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricCustomSpaceAggregation: valid values are %v", v, allowedMetricCustomSpaceAggregationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricCustomSpaceAggregation) IsValid() bool { - for _, existing := range allowedMetricCustomSpaceAggregationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricCustomSpaceAggregation value. -func (v MetricCustomSpaceAggregation) Ptr() *MetricCustomSpaceAggregation { - return &v -} - -// NullableMetricCustomSpaceAggregation handles when a null is used for MetricCustomSpaceAggregation. -type NullableMetricCustomSpaceAggregation struct { - value *MetricCustomSpaceAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricCustomSpaceAggregation) Get() *MetricCustomSpaceAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricCustomSpaceAggregation) Set(val *MetricCustomSpaceAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricCustomSpaceAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricCustomSpaceAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricCustomSpaceAggregation initializes the struct as if Set has been called. -func NewNullableMetricCustomSpaceAggregation(val *MetricCustomSpaceAggregation) *NullableMetricCustomSpaceAggregation { - return &NullableMetricCustomSpaceAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricCustomSpaceAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricCustomSpaceAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_custom_time_aggregation.go b/api/v2/datadog/model_metric_custom_time_aggregation.go deleted file mode 100644 index da824c7b649..00000000000 --- a/api/v2/datadog/model_metric_custom_time_aggregation.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricCustomTimeAggregation A time aggregation for use in query. -type MetricCustomTimeAggregation string - -// List of MetricCustomTimeAggregation. -const ( - METRICCUSTOMTIMEAGGREGATION_AVG MetricCustomTimeAggregation = "avg" - METRICCUSTOMTIMEAGGREGATION_COUNT MetricCustomTimeAggregation = "count" - METRICCUSTOMTIMEAGGREGATION_MAX MetricCustomTimeAggregation = "max" - METRICCUSTOMTIMEAGGREGATION_MIN MetricCustomTimeAggregation = "min" - METRICCUSTOMTIMEAGGREGATION_SUM MetricCustomTimeAggregation = "sum" -) - -var allowedMetricCustomTimeAggregationEnumValues = []MetricCustomTimeAggregation{ - METRICCUSTOMTIMEAGGREGATION_AVG, - METRICCUSTOMTIMEAGGREGATION_COUNT, - METRICCUSTOMTIMEAGGREGATION_MAX, - METRICCUSTOMTIMEAGGREGATION_MIN, - METRICCUSTOMTIMEAGGREGATION_SUM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricCustomTimeAggregation) GetAllowedValues() []MetricCustomTimeAggregation { - return allowedMetricCustomTimeAggregationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricCustomTimeAggregation) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricCustomTimeAggregation(value) - return nil -} - -// NewMetricCustomTimeAggregationFromValue returns a pointer to a valid MetricCustomTimeAggregation -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricCustomTimeAggregationFromValue(v string) (*MetricCustomTimeAggregation, error) { - ev := MetricCustomTimeAggregation(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricCustomTimeAggregation: valid values are %v", v, allowedMetricCustomTimeAggregationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricCustomTimeAggregation) IsValid() bool { - for _, existing := range allowedMetricCustomTimeAggregationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricCustomTimeAggregation value. -func (v MetricCustomTimeAggregation) Ptr() *MetricCustomTimeAggregation { - return &v -} - -// NullableMetricCustomTimeAggregation handles when a null is used for MetricCustomTimeAggregation. -type NullableMetricCustomTimeAggregation struct { - value *MetricCustomTimeAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricCustomTimeAggregation) Get() *MetricCustomTimeAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricCustomTimeAggregation) Set(val *MetricCustomTimeAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricCustomTimeAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricCustomTimeAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricCustomTimeAggregation initializes the struct as if Set has been called. -func NewNullableMetricCustomTimeAggregation(val *MetricCustomTimeAggregation) *NullableMetricCustomTimeAggregation { - return &NullableMetricCustomTimeAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricCustomTimeAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricCustomTimeAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_distinct_volume.go b/api/v2/datadog/model_metric_distinct_volume.go deleted file mode 100644 index 264bf7d4337..00000000000 --- a/api/v2/datadog/model_metric_distinct_volume.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricDistinctVolume Object for a single metric's distinct volume. -type MetricDistinctVolume struct { - // Object containing the definition of a metric's distinct volume. - Attributes *MetricDistinctVolumeAttributes `json:"attributes,omitempty"` - // The metric name for this resource. - Id *string `json:"id,omitempty"` - // The metric distinct volume type. - Type *MetricDistinctVolumeType `json:"type,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{} -} - -// NewMetricDistinctVolume instantiates a new MetricDistinctVolume 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 NewMetricDistinctVolume() *MetricDistinctVolume { - this := MetricDistinctVolume{} - var typeVar MetricDistinctVolumeType = METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES - this.Type = &typeVar - return &this -} - -// NewMetricDistinctVolumeWithDefaults instantiates a new MetricDistinctVolume 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 NewMetricDistinctVolumeWithDefaults() *MetricDistinctVolume { - this := MetricDistinctVolume{} - var typeVar MetricDistinctVolumeType = METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricDistinctVolume) GetAttributes() MetricDistinctVolumeAttributes { - if o == nil || o.Attributes == nil { - var ret MetricDistinctVolumeAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricDistinctVolume) GetAttributesOk() (*MetricDistinctVolumeAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricDistinctVolume) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricDistinctVolumeAttributes and assigns it to the Attributes field. -func (o *MetricDistinctVolume) SetAttributes(v MetricDistinctVolumeAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MetricDistinctVolume) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricDistinctVolume) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MetricDistinctVolume) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *MetricDistinctVolume) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricDistinctVolume) GetType() MetricDistinctVolumeType { - if o == nil || o.Type == nil { - var ret MetricDistinctVolumeType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricDistinctVolume) GetTypeOk() (*MetricDistinctVolumeType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricDistinctVolume) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MetricDistinctVolumeType and assigns it to the Type field. -func (o *MetricDistinctVolume) SetType(v MetricDistinctVolumeType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricDistinctVolume) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricDistinctVolume) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *MetricDistinctVolumeAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *MetricDistinctVolumeType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_distinct_volume_attributes.go b/api/v2/datadog/model_metric_distinct_volume_attributes.go deleted file mode 100644 index 74b27b9b5ff..00000000000 --- a/api/v2/datadog/model_metric_distinct_volume_attributes.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricDistinctVolumeAttributes Object containing the definition of a metric's distinct volume. -type MetricDistinctVolumeAttributes struct { - // Distinct volume for the given metric. - DistinctVolume *int64 `json:"distinct_volume,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{} -} - -// NewMetricDistinctVolumeAttributes instantiates a new MetricDistinctVolumeAttributes 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 NewMetricDistinctVolumeAttributes() *MetricDistinctVolumeAttributes { - this := MetricDistinctVolumeAttributes{} - return &this -} - -// NewMetricDistinctVolumeAttributesWithDefaults instantiates a new MetricDistinctVolumeAttributes 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 NewMetricDistinctVolumeAttributesWithDefaults() *MetricDistinctVolumeAttributes { - this := MetricDistinctVolumeAttributes{} - return &this -} - -// GetDistinctVolume returns the DistinctVolume field value if set, zero value otherwise. -func (o *MetricDistinctVolumeAttributes) GetDistinctVolume() int64 { - if o == nil || o.DistinctVolume == nil { - var ret int64 - return ret - } - return *o.DistinctVolume -} - -// GetDistinctVolumeOk returns a tuple with the DistinctVolume field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricDistinctVolumeAttributes) GetDistinctVolumeOk() (*int64, bool) { - if o == nil || o.DistinctVolume == nil { - return nil, false - } - return o.DistinctVolume, true -} - -// HasDistinctVolume returns a boolean if a field has been set. -func (o *MetricDistinctVolumeAttributes) HasDistinctVolume() bool { - if o != nil && o.DistinctVolume != nil { - return true - } - - return false -} - -// SetDistinctVolume gets a reference to the given int64 and assigns it to the DistinctVolume field. -func (o *MetricDistinctVolumeAttributes) SetDistinctVolume(v int64) { - o.DistinctVolume = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricDistinctVolumeAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DistinctVolume != nil { - toSerialize["distinct_volume"] = o.DistinctVolume - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricDistinctVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DistinctVolume *int64 `json:"distinct_volume,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DistinctVolume = all.DistinctVolume - return nil -} diff --git a/api/v2/datadog/model_metric_distinct_volume_type.go b/api/v2/datadog/model_metric_distinct_volume_type.go deleted file mode 100644 index e419329e99b..00000000000 --- a/api/v2/datadog/model_metric_distinct_volume_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricDistinctVolumeType The metric distinct volume type. -type MetricDistinctVolumeType string - -// List of MetricDistinctVolumeType. -const ( - METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES MetricDistinctVolumeType = "distinct_metric_volumes" -) - -var allowedMetricDistinctVolumeTypeEnumValues = []MetricDistinctVolumeType{ - METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricDistinctVolumeType) GetAllowedValues() []MetricDistinctVolumeType { - return allowedMetricDistinctVolumeTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricDistinctVolumeType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricDistinctVolumeType(value) - return nil -} - -// NewMetricDistinctVolumeTypeFromValue returns a pointer to a valid MetricDistinctVolumeType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricDistinctVolumeTypeFromValue(v string) (*MetricDistinctVolumeType, error) { - ev := MetricDistinctVolumeType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricDistinctVolumeType: valid values are %v", v, allowedMetricDistinctVolumeTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricDistinctVolumeType) IsValid() bool { - for _, existing := range allowedMetricDistinctVolumeTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricDistinctVolumeType value. -func (v MetricDistinctVolumeType) Ptr() *MetricDistinctVolumeType { - return &v -} - -// NullableMetricDistinctVolumeType handles when a null is used for MetricDistinctVolumeType. -type NullableMetricDistinctVolumeType struct { - value *MetricDistinctVolumeType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricDistinctVolumeType) Get() *MetricDistinctVolumeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricDistinctVolumeType) Set(val *MetricDistinctVolumeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricDistinctVolumeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricDistinctVolumeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricDistinctVolumeType initializes the struct as if Set has been called. -func NewNullableMetricDistinctVolumeType(val *MetricDistinctVolumeType) *NullableMetricDistinctVolumeType { - return &NullableMetricDistinctVolumeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricDistinctVolumeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricDistinctVolumeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_estimate.go b/api/v2/datadog/model_metric_estimate.go deleted file mode 100644 index fecb153c660..00000000000 --- a/api/v2/datadog/model_metric_estimate.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricEstimate Object for a metric cardinality estimate. -type MetricEstimate struct { - // Object containing the definition of a metric estimate attribute. - Attributes *MetricEstimateAttributes `json:"attributes,omitempty"` - // The metric name for this resource. - Id *string `json:"id,omitempty"` - // The metric estimate resource type. - Type *MetricEstimateResourceType `json:"type,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{} -} - -// NewMetricEstimate instantiates a new MetricEstimate 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 NewMetricEstimate() *MetricEstimate { - this := MetricEstimate{} - var typeVar MetricEstimateResourceType = METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE - this.Type = &typeVar - return &this -} - -// NewMetricEstimateWithDefaults instantiates a new MetricEstimate 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 NewMetricEstimateWithDefaults() *MetricEstimate { - this := MetricEstimate{} - var typeVar MetricEstimateResourceType = METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricEstimate) GetAttributes() MetricEstimateAttributes { - if o == nil || o.Attributes == nil { - var ret MetricEstimateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricEstimate) GetAttributesOk() (*MetricEstimateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricEstimate) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricEstimateAttributes and assigns it to the Attributes field. -func (o *MetricEstimate) SetAttributes(v MetricEstimateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MetricEstimate) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricEstimate) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MetricEstimate) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *MetricEstimate) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricEstimate) GetType() MetricEstimateResourceType { - if o == nil || o.Type == nil { - var ret MetricEstimateResourceType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricEstimate) GetTypeOk() (*MetricEstimateResourceType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricEstimate) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MetricEstimateResourceType and assigns it to the Type field. -func (o *MetricEstimate) SetType(v MetricEstimateResourceType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricEstimate) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricEstimate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *MetricEstimateAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *MetricEstimateResourceType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_estimate_attributes.go b/api/v2/datadog/model_metric_estimate_attributes.go deleted file mode 100644 index 27b8f6e1a74..00000000000 --- a/api/v2/datadog/model_metric_estimate_attributes.go +++ /dev/null @@ -1,197 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// MetricEstimateAttributes Object containing the definition of a metric estimate attribute. -type MetricEstimateAttributes struct { - // Estimate type based on the queried configuration. By default, `count_or_gauge` is returned. `distribution` is returned for distribution metrics without percentiles enabled. Lastly, `percentile` is returned if `filter[pct]=true` is queried with a distribution metric. - EstimateType *MetricEstimateType `json:"estimate_type,omitempty"` - // Timestamp when the cardinality estimate was requested. - EstimatedAt *time.Time `json:"estimated_at,omitempty"` - // Estimated cardinality of the metric based on the queried configuration. - EstimatedOutputSeries *int64 `json:"estimated_output_series,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{} -} - -// NewMetricEstimateAttributes instantiates a new MetricEstimateAttributes 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 NewMetricEstimateAttributes() *MetricEstimateAttributes { - this := MetricEstimateAttributes{} - var estimateType MetricEstimateType = METRICESTIMATETYPE_COUNT_OR_GAUGE - this.EstimateType = &estimateType - return &this -} - -// NewMetricEstimateAttributesWithDefaults instantiates a new MetricEstimateAttributes 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 NewMetricEstimateAttributesWithDefaults() *MetricEstimateAttributes { - this := MetricEstimateAttributes{} - var estimateType MetricEstimateType = METRICESTIMATETYPE_COUNT_OR_GAUGE - this.EstimateType = &estimateType - return &this -} - -// GetEstimateType returns the EstimateType field value if set, zero value otherwise. -func (o *MetricEstimateAttributes) GetEstimateType() MetricEstimateType { - if o == nil || o.EstimateType == nil { - var ret MetricEstimateType - return ret - } - return *o.EstimateType -} - -// GetEstimateTypeOk returns a tuple with the EstimateType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricEstimateAttributes) GetEstimateTypeOk() (*MetricEstimateType, bool) { - if o == nil || o.EstimateType == nil { - return nil, false - } - return o.EstimateType, true -} - -// HasEstimateType returns a boolean if a field has been set. -func (o *MetricEstimateAttributes) HasEstimateType() bool { - if o != nil && o.EstimateType != nil { - return true - } - - return false -} - -// SetEstimateType gets a reference to the given MetricEstimateType and assigns it to the EstimateType field. -func (o *MetricEstimateAttributes) SetEstimateType(v MetricEstimateType) { - o.EstimateType = &v -} - -// GetEstimatedAt returns the EstimatedAt field value if set, zero value otherwise. -func (o *MetricEstimateAttributes) GetEstimatedAt() time.Time { - if o == nil || o.EstimatedAt == nil { - var ret time.Time - return ret - } - return *o.EstimatedAt -} - -// GetEstimatedAtOk returns a tuple with the EstimatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricEstimateAttributes) GetEstimatedAtOk() (*time.Time, bool) { - if o == nil || o.EstimatedAt == nil { - return nil, false - } - return o.EstimatedAt, true -} - -// HasEstimatedAt returns a boolean if a field has been set. -func (o *MetricEstimateAttributes) HasEstimatedAt() bool { - if o != nil && o.EstimatedAt != nil { - return true - } - - return false -} - -// SetEstimatedAt gets a reference to the given time.Time and assigns it to the EstimatedAt field. -func (o *MetricEstimateAttributes) SetEstimatedAt(v time.Time) { - o.EstimatedAt = &v -} - -// GetEstimatedOutputSeries returns the EstimatedOutputSeries field value if set, zero value otherwise. -func (o *MetricEstimateAttributes) GetEstimatedOutputSeries() int64 { - if o == nil || o.EstimatedOutputSeries == nil { - var ret int64 - return ret - } - return *o.EstimatedOutputSeries -} - -// GetEstimatedOutputSeriesOk returns a tuple with the EstimatedOutputSeries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricEstimateAttributes) GetEstimatedOutputSeriesOk() (*int64, bool) { - if o == nil || o.EstimatedOutputSeries == nil { - return nil, false - } - return o.EstimatedOutputSeries, true -} - -// HasEstimatedOutputSeries returns a boolean if a field has been set. -func (o *MetricEstimateAttributes) HasEstimatedOutputSeries() bool { - if o != nil && o.EstimatedOutputSeries != nil { - return true - } - - return false -} - -// SetEstimatedOutputSeries gets a reference to the given int64 and assigns it to the EstimatedOutputSeries field. -func (o *MetricEstimateAttributes) SetEstimatedOutputSeries(v int64) { - o.EstimatedOutputSeries = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricEstimateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.EstimateType != nil { - toSerialize["estimate_type"] = o.EstimateType - } - if o.EstimatedAt != nil { - if o.EstimatedAt.Nanosecond() == 0 { - toSerialize["estimated_at"] = o.EstimatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["estimated_at"] = o.EstimatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.EstimatedOutputSeries != nil { - toSerialize["estimated_output_series"] = o.EstimatedOutputSeries - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricEstimateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - EstimateType *MetricEstimateType `json:"estimate_type,omitempty"` - EstimatedAt *time.Time `json:"estimated_at,omitempty"` - EstimatedOutputSeries *int64 `json:"estimated_output_series,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EstimateType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.EstimateType = all.EstimateType - o.EstimatedAt = all.EstimatedAt - o.EstimatedOutputSeries = all.EstimatedOutputSeries - return nil -} diff --git a/api/v2/datadog/model_metric_estimate_resource_type.go b/api/v2/datadog/model_metric_estimate_resource_type.go deleted file mode 100644 index e03b9cc1306..00000000000 --- a/api/v2/datadog/model_metric_estimate_resource_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricEstimateResourceType The metric estimate resource type. -type MetricEstimateResourceType string - -// List of MetricEstimateResourceType. -const ( - METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE MetricEstimateResourceType = "metric_cardinality_estimate" -) - -var allowedMetricEstimateResourceTypeEnumValues = []MetricEstimateResourceType{ - METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricEstimateResourceType) GetAllowedValues() []MetricEstimateResourceType { - return allowedMetricEstimateResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricEstimateResourceType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricEstimateResourceType(value) - return nil -} - -// NewMetricEstimateResourceTypeFromValue returns a pointer to a valid MetricEstimateResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricEstimateResourceTypeFromValue(v string) (*MetricEstimateResourceType, error) { - ev := MetricEstimateResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricEstimateResourceType: valid values are %v", v, allowedMetricEstimateResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricEstimateResourceType) IsValid() bool { - for _, existing := range allowedMetricEstimateResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricEstimateResourceType value. -func (v MetricEstimateResourceType) Ptr() *MetricEstimateResourceType { - return &v -} - -// NullableMetricEstimateResourceType handles when a null is used for MetricEstimateResourceType. -type NullableMetricEstimateResourceType struct { - value *MetricEstimateResourceType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricEstimateResourceType) Get() *MetricEstimateResourceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricEstimateResourceType) Set(val *MetricEstimateResourceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricEstimateResourceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricEstimateResourceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricEstimateResourceType initializes the struct as if Set has been called. -func NewNullableMetricEstimateResourceType(val *MetricEstimateResourceType) *NullableMetricEstimateResourceType { - return &NullableMetricEstimateResourceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricEstimateResourceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricEstimateResourceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_estimate_response.go b/api/v2/datadog/model_metric_estimate_response.go deleted file mode 100644 index 3a85492c638..00000000000 --- a/api/v2/datadog/model_metric_estimate_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricEstimateResponse Response object that includes metric cardinality estimates. -type MetricEstimateResponse struct { - // Object for a metric cardinality estimate. - Data *MetricEstimate `json:"data,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{} -} - -// NewMetricEstimateResponse instantiates a new MetricEstimateResponse 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 NewMetricEstimateResponse() *MetricEstimateResponse { - this := MetricEstimateResponse{} - return &this -} - -// NewMetricEstimateResponseWithDefaults instantiates a new MetricEstimateResponse 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 NewMetricEstimateResponseWithDefaults() *MetricEstimateResponse { - this := MetricEstimateResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *MetricEstimateResponse) GetData() MetricEstimate { - if o == nil || o.Data == nil { - var ret MetricEstimate - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricEstimateResponse) GetDataOk() (*MetricEstimate, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *MetricEstimateResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given MetricEstimate and assigns it to the Data field. -func (o *MetricEstimateResponse) SetData(v MetricEstimate) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricEstimateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricEstimateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *MetricEstimate `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_estimate_type.go b/api/v2/datadog/model_metric_estimate_type.go deleted file mode 100644 index 09a870cbc9b..00000000000 --- a/api/v2/datadog/model_metric_estimate_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricEstimateType Estimate type based on the queried configuration. By default, `count_or_gauge` is returned. `distribution` is returned for distribution metrics without percentiles enabled. Lastly, `percentile` is returned if `filter[pct]=true` is queried with a distribution metric. -type MetricEstimateType string - -// List of MetricEstimateType. -const ( - METRICESTIMATETYPE_COUNT_OR_GAUGE MetricEstimateType = "count_or_gauge" - METRICESTIMATETYPE_DISTRIBUTION MetricEstimateType = "distribution" - METRICESTIMATETYPE_PERCENTILE MetricEstimateType = "percentile" -) - -var allowedMetricEstimateTypeEnumValues = []MetricEstimateType{ - METRICESTIMATETYPE_COUNT_OR_GAUGE, - METRICESTIMATETYPE_DISTRIBUTION, - METRICESTIMATETYPE_PERCENTILE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricEstimateType) GetAllowedValues() []MetricEstimateType { - return allowedMetricEstimateTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricEstimateType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricEstimateType(value) - return nil -} - -// NewMetricEstimateTypeFromValue returns a pointer to a valid MetricEstimateType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricEstimateTypeFromValue(v string) (*MetricEstimateType, error) { - ev := MetricEstimateType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricEstimateType: valid values are %v", v, allowedMetricEstimateTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricEstimateType) IsValid() bool { - for _, existing := range allowedMetricEstimateTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricEstimateType value. -func (v MetricEstimateType) Ptr() *MetricEstimateType { - return &v -} - -// NullableMetricEstimateType handles when a null is used for MetricEstimateType. -type NullableMetricEstimateType struct { - value *MetricEstimateType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricEstimateType) Get() *MetricEstimateType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricEstimateType) Set(val *MetricEstimateType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricEstimateType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricEstimateType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricEstimateType initializes the struct as if Set has been called. -func NewNullableMetricEstimateType(val *MetricEstimateType) *NullableMetricEstimateType { - return &NullableMetricEstimateType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricEstimateType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricEstimateType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_ingested_indexed_volume.go b/api/v2/datadog/model_metric_ingested_indexed_volume.go deleted file mode 100644 index 1c6fd646696..00000000000 --- a/api/v2/datadog/model_metric_ingested_indexed_volume.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricIngestedIndexedVolume Object for a single metric's ingested and indexed volume. -type MetricIngestedIndexedVolume struct { - // Object containing the definition of a metric's ingested and indexed volume. - Attributes *MetricIngestedIndexedVolumeAttributes `json:"attributes,omitempty"` - // The metric name for this resource. - Id *string `json:"id,omitempty"` - // The metric ingested and indexed volume type. - Type *MetricIngestedIndexedVolumeType `json:"type,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{} -} - -// NewMetricIngestedIndexedVolume instantiates a new MetricIngestedIndexedVolume 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 NewMetricIngestedIndexedVolume() *MetricIngestedIndexedVolume { - this := MetricIngestedIndexedVolume{} - var typeVar MetricIngestedIndexedVolumeType = METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES - this.Type = &typeVar - return &this -} - -// NewMetricIngestedIndexedVolumeWithDefaults instantiates a new MetricIngestedIndexedVolume 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 NewMetricIngestedIndexedVolumeWithDefaults() *MetricIngestedIndexedVolume { - this := MetricIngestedIndexedVolume{} - var typeVar MetricIngestedIndexedVolumeType = METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricIngestedIndexedVolume) GetAttributes() MetricIngestedIndexedVolumeAttributes { - if o == nil || o.Attributes == nil { - var ret MetricIngestedIndexedVolumeAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricIngestedIndexedVolume) GetAttributesOk() (*MetricIngestedIndexedVolumeAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricIngestedIndexedVolume) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricIngestedIndexedVolumeAttributes and assigns it to the Attributes field. -func (o *MetricIngestedIndexedVolume) SetAttributes(v MetricIngestedIndexedVolumeAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MetricIngestedIndexedVolume) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricIngestedIndexedVolume) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MetricIngestedIndexedVolume) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *MetricIngestedIndexedVolume) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricIngestedIndexedVolume) GetType() MetricIngestedIndexedVolumeType { - if o == nil || o.Type == nil { - var ret MetricIngestedIndexedVolumeType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricIngestedIndexedVolume) GetTypeOk() (*MetricIngestedIndexedVolumeType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricIngestedIndexedVolume) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MetricIngestedIndexedVolumeType and assigns it to the Type field. -func (o *MetricIngestedIndexedVolume) SetType(v MetricIngestedIndexedVolumeType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricIngestedIndexedVolume) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricIngestedIndexedVolume) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *MetricIngestedIndexedVolumeAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *MetricIngestedIndexedVolumeType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go b/api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go deleted file mode 100644 index 52173182280..00000000000 --- a/api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricIngestedIndexedVolumeAttributes Object containing the definition of a metric's ingested and indexed volume. -type MetricIngestedIndexedVolumeAttributes struct { - // Indexed volume for the given metric. - IndexedVolume *int64 `json:"indexed_volume,omitempty"` - // Ingested volume for the given metric. - IngestedVolume *int64 `json:"ingested_volume,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{} -} - -// NewMetricIngestedIndexedVolumeAttributes instantiates a new MetricIngestedIndexedVolumeAttributes 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 NewMetricIngestedIndexedVolumeAttributes() *MetricIngestedIndexedVolumeAttributes { - this := MetricIngestedIndexedVolumeAttributes{} - return &this -} - -// NewMetricIngestedIndexedVolumeAttributesWithDefaults instantiates a new MetricIngestedIndexedVolumeAttributes 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 NewMetricIngestedIndexedVolumeAttributesWithDefaults() *MetricIngestedIndexedVolumeAttributes { - this := MetricIngestedIndexedVolumeAttributes{} - return &this -} - -// GetIndexedVolume returns the IndexedVolume field value if set, zero value otherwise. -func (o *MetricIngestedIndexedVolumeAttributes) GetIndexedVolume() int64 { - if o == nil || o.IndexedVolume == nil { - var ret int64 - return ret - } - return *o.IndexedVolume -} - -// GetIndexedVolumeOk returns a tuple with the IndexedVolume field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricIngestedIndexedVolumeAttributes) GetIndexedVolumeOk() (*int64, bool) { - if o == nil || o.IndexedVolume == nil { - return nil, false - } - return o.IndexedVolume, true -} - -// HasIndexedVolume returns a boolean if a field has been set. -func (o *MetricIngestedIndexedVolumeAttributes) HasIndexedVolume() bool { - if o != nil && o.IndexedVolume != nil { - return true - } - - return false -} - -// SetIndexedVolume gets a reference to the given int64 and assigns it to the IndexedVolume field. -func (o *MetricIngestedIndexedVolumeAttributes) SetIndexedVolume(v int64) { - o.IndexedVolume = &v -} - -// GetIngestedVolume returns the IngestedVolume field value if set, zero value otherwise. -func (o *MetricIngestedIndexedVolumeAttributes) GetIngestedVolume() int64 { - if o == nil || o.IngestedVolume == nil { - var ret int64 - return ret - } - return *o.IngestedVolume -} - -// GetIngestedVolumeOk returns a tuple with the IngestedVolume field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricIngestedIndexedVolumeAttributes) GetIngestedVolumeOk() (*int64, bool) { - if o == nil || o.IngestedVolume == nil { - return nil, false - } - return o.IngestedVolume, true -} - -// HasIngestedVolume returns a boolean if a field has been set. -func (o *MetricIngestedIndexedVolumeAttributes) HasIngestedVolume() bool { - if o != nil && o.IngestedVolume != nil { - return true - } - - return false -} - -// SetIngestedVolume gets a reference to the given int64 and assigns it to the IngestedVolume field. -func (o *MetricIngestedIndexedVolumeAttributes) SetIngestedVolume(v int64) { - o.IngestedVolume = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricIngestedIndexedVolumeAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.IndexedVolume != nil { - toSerialize["indexed_volume"] = o.IndexedVolume - } - if o.IngestedVolume != nil { - toSerialize["ingested_volume"] = o.IngestedVolume - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricIngestedIndexedVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - IndexedVolume *int64 `json:"indexed_volume,omitempty"` - IngestedVolume *int64 `json:"ingested_volume,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IndexedVolume = all.IndexedVolume - o.IngestedVolume = all.IngestedVolume - return nil -} diff --git a/api/v2/datadog/model_metric_ingested_indexed_volume_type.go b/api/v2/datadog/model_metric_ingested_indexed_volume_type.go deleted file mode 100644 index 6d401a94765..00000000000 --- a/api/v2/datadog/model_metric_ingested_indexed_volume_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricIngestedIndexedVolumeType The metric ingested and indexed volume type. -type MetricIngestedIndexedVolumeType string - -// List of MetricIngestedIndexedVolumeType. -const ( - METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES MetricIngestedIndexedVolumeType = "metric_volumes" -) - -var allowedMetricIngestedIndexedVolumeTypeEnumValues = []MetricIngestedIndexedVolumeType{ - METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricIngestedIndexedVolumeType) GetAllowedValues() []MetricIngestedIndexedVolumeType { - return allowedMetricIngestedIndexedVolumeTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricIngestedIndexedVolumeType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricIngestedIndexedVolumeType(value) - return nil -} - -// NewMetricIngestedIndexedVolumeTypeFromValue returns a pointer to a valid MetricIngestedIndexedVolumeType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricIngestedIndexedVolumeTypeFromValue(v string) (*MetricIngestedIndexedVolumeType, error) { - ev := MetricIngestedIndexedVolumeType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricIngestedIndexedVolumeType: valid values are %v", v, allowedMetricIngestedIndexedVolumeTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricIngestedIndexedVolumeType) IsValid() bool { - for _, existing := range allowedMetricIngestedIndexedVolumeTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricIngestedIndexedVolumeType value. -func (v MetricIngestedIndexedVolumeType) Ptr() *MetricIngestedIndexedVolumeType { - return &v -} - -// NullableMetricIngestedIndexedVolumeType handles when a null is used for MetricIngestedIndexedVolumeType. -type NullableMetricIngestedIndexedVolumeType struct { - value *MetricIngestedIndexedVolumeType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricIngestedIndexedVolumeType) Get() *MetricIngestedIndexedVolumeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricIngestedIndexedVolumeType) Set(val *MetricIngestedIndexedVolumeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricIngestedIndexedVolumeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricIngestedIndexedVolumeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricIngestedIndexedVolumeType initializes the struct as if Set has been called. -func NewNullableMetricIngestedIndexedVolumeType(val *MetricIngestedIndexedVolumeType) *NullableMetricIngestedIndexedVolumeType { - return &NullableMetricIngestedIndexedVolumeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricIngestedIndexedVolumeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricIngestedIndexedVolumeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_intake_type.go b/api/v2/datadog/model_metric_intake_type.go deleted file mode 100644 index 1393e03f252..00000000000 --- a/api/v2/datadog/model_metric_intake_type.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricIntakeType The type of metric. The available types are `0` (unspecified), `1` (count), `2` (rate), and `3` (gauge). -type MetricIntakeType int32 - -// List of MetricIntakeType. -const ( - METRICINTAKETYPE_UNSPECIFIED MetricIntakeType = 0 - METRICINTAKETYPE_COUNT MetricIntakeType = 1 - METRICINTAKETYPE_RATE MetricIntakeType = 2 - METRICINTAKETYPE_GAUGE MetricIntakeType = 3 -) - -var allowedMetricIntakeTypeEnumValues = []MetricIntakeType{ - METRICINTAKETYPE_UNSPECIFIED, - METRICINTAKETYPE_COUNT, - METRICINTAKETYPE_RATE, - METRICINTAKETYPE_GAUGE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricIntakeType) GetAllowedValues() []MetricIntakeType { - return allowedMetricIntakeTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricIntakeType) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricIntakeType(value) - return nil -} - -// NewMetricIntakeTypeFromValue returns a pointer to a valid MetricIntakeType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricIntakeTypeFromValue(v int32) (*MetricIntakeType, error) { - ev := MetricIntakeType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricIntakeType: valid values are %v", v, allowedMetricIntakeTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricIntakeType) IsValid() bool { - for _, existing := range allowedMetricIntakeTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricIntakeType value. -func (v MetricIntakeType) Ptr() *MetricIntakeType { - return &v -} - -// NullableMetricIntakeType handles when a null is used for MetricIntakeType. -type NullableMetricIntakeType struct { - value *MetricIntakeType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricIntakeType) Get() *MetricIntakeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricIntakeType) Set(val *MetricIntakeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricIntakeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricIntakeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricIntakeType initializes the struct as if Set has been called. -func NewNullableMetricIntakeType(val *MetricIntakeType) *NullableMetricIntakeType { - return &NullableMetricIntakeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricIntakeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricIntakeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_metadata.go b/api/v2/datadog/model_metric_metadata.go deleted file mode 100644 index 6f89aec372a..00000000000 --- a/api/v2/datadog/model_metric_metadata.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricMetadata Metadata for the metric. -type MetricMetadata struct { - // Metric origin information. - Origin *MetricOrigin `json:"origin,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{} -} - -// NewMetricMetadata instantiates a new MetricMetadata 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 NewMetricMetadata() *MetricMetadata { - this := MetricMetadata{} - return &this -} - -// NewMetricMetadataWithDefaults instantiates a new MetricMetadata 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 NewMetricMetadataWithDefaults() *MetricMetadata { - this := MetricMetadata{} - return &this -} - -// GetOrigin returns the Origin field value if set, zero value otherwise. -func (o *MetricMetadata) GetOrigin() MetricOrigin { - if o == nil || o.Origin == nil { - var ret MetricOrigin - return ret - } - return *o.Origin -} - -// GetOriginOk returns a tuple with the Origin field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricMetadata) GetOriginOk() (*MetricOrigin, bool) { - if o == nil || o.Origin == nil { - return nil, false - } - return o.Origin, true -} - -// HasOrigin returns a boolean if a field has been set. -func (o *MetricMetadata) HasOrigin() bool { - if o != nil && o.Origin != nil { - return true - } - - return false -} - -// SetOrigin gets a reference to the given MetricOrigin and assigns it to the Origin field. -func (o *MetricMetadata) SetOrigin(v MetricOrigin) { - o.Origin = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Origin != nil { - toSerialize["origin"] = o.Origin - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Origin *MetricOrigin `json:"origin,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Origin != nil && all.Origin.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Origin = all.Origin - return nil -} diff --git a/api/v2/datadog/model_metric_origin.go b/api/v2/datadog/model_metric_origin.go deleted file mode 100644 index 00e21b3c45e..00000000000 --- a/api/v2/datadog/model_metric_origin.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricOrigin Metric origin information. -type MetricOrigin struct { - // The origin metric type code - MetricType *int32 `json:"metric_type,omitempty"` - // The origin product code - Product *int32 `json:"product,omitempty"` - // The origin service code - Service *int32 `json:"service,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{} -} - -// NewMetricOrigin instantiates a new MetricOrigin 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 NewMetricOrigin() *MetricOrigin { - this := MetricOrigin{} - var metricType int32 = 0 - this.MetricType = &metricType - var product int32 = 0 - this.Product = &product - var service int32 = 0 - this.Service = &service - return &this -} - -// NewMetricOriginWithDefaults instantiates a new MetricOrigin 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 NewMetricOriginWithDefaults() *MetricOrigin { - this := MetricOrigin{} - var metricType int32 = 0 - this.MetricType = &metricType - var product int32 = 0 - this.Product = &product - var service int32 = 0 - this.Service = &service - return &this -} - -// GetMetricType returns the MetricType field value if set, zero value otherwise. -func (o *MetricOrigin) GetMetricType() int32 { - if o == nil || o.MetricType == nil { - var ret int32 - return ret - } - return *o.MetricType -} - -// GetMetricTypeOk returns a tuple with the MetricType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricOrigin) GetMetricTypeOk() (*int32, bool) { - if o == nil || o.MetricType == nil { - return nil, false - } - return o.MetricType, true -} - -// HasMetricType returns a boolean if a field has been set. -func (o *MetricOrigin) HasMetricType() bool { - if o != nil && o.MetricType != nil { - return true - } - - return false -} - -// SetMetricType gets a reference to the given int32 and assigns it to the MetricType field. -func (o *MetricOrigin) SetMetricType(v int32) { - o.MetricType = &v -} - -// GetProduct returns the Product field value if set, zero value otherwise. -func (o *MetricOrigin) GetProduct() int32 { - if o == nil || o.Product == nil { - var ret int32 - return ret - } - return *o.Product -} - -// GetProductOk returns a tuple with the Product field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricOrigin) GetProductOk() (*int32, bool) { - if o == nil || o.Product == nil { - return nil, false - } - return o.Product, true -} - -// HasProduct returns a boolean if a field has been set. -func (o *MetricOrigin) HasProduct() bool { - if o != nil && o.Product != nil { - return true - } - - return false -} - -// SetProduct gets a reference to the given int32 and assigns it to the Product field. -func (o *MetricOrigin) SetProduct(v int32) { - o.Product = &v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *MetricOrigin) GetService() int32 { - if o == nil || o.Service == nil { - var ret int32 - 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 *MetricOrigin) GetServiceOk() (*int32, 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 *MetricOrigin) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given int32 and assigns it to the Service field. -func (o *MetricOrigin) SetService(v int32) { - o.Service = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricOrigin) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.MetricType != nil { - toSerialize["metric_type"] = o.MetricType - } - if o.Product != nil { - toSerialize["product"] = o.Product - } - if o.Service != nil { - toSerialize["service"] = o.Service - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricOrigin) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - MetricType *int32 `json:"metric_type,omitempty"` - Product *int32 `json:"product,omitempty"` - Service *int32 `json:"service,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.MetricType = all.MetricType - o.Product = all.Product - o.Service = all.Service - return nil -} diff --git a/api/v2/datadog/model_metric_payload.go b/api/v2/datadog/model_metric_payload.go deleted file mode 100644 index f4dac520a01..00000000000 --- a/api/v2/datadog/model_metric_payload.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricPayload The metrics' payload. -type MetricPayload struct { - // A list of time series to submit to Datadog. - Series []MetricSeries `json:"series"` - // 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{} -} - -// NewMetricPayload instantiates a new MetricPayload 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 NewMetricPayload(series []MetricSeries) *MetricPayload { - this := MetricPayload{} - this.Series = series - return &this -} - -// NewMetricPayloadWithDefaults instantiates a new MetricPayload 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 NewMetricPayloadWithDefaults() *MetricPayload { - this := MetricPayload{} - return &this -} - -// GetSeries returns the Series field value. -func (o *MetricPayload) GetSeries() []MetricSeries { - if o == nil { - var ret []MetricSeries - return ret - } - return o.Series -} - -// GetSeriesOk returns a tuple with the Series field value -// and a boolean to check if the value has been set. -func (o *MetricPayload) GetSeriesOk() (*[]MetricSeries, bool) { - if o == nil { - return nil, false - } - return &o.Series, true -} - -// SetSeries sets field value. -func (o *MetricPayload) SetSeries(v []MetricSeries) { - o.Series = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricPayload) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["series"] = o.Series - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricPayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Series *[]MetricSeries `json:"series"` - }{} - all := struct { - Series []MetricSeries `json:"series"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Series == nil { - return fmt.Errorf("Required field series missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Series = all.Series - return nil -} diff --git a/api/v2/datadog/model_metric_point.go b/api/v2/datadog/model_metric_point.go deleted file mode 100644 index 8fd1893799e..00000000000 --- a/api/v2/datadog/model_metric_point.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricPoint A point object is of the form `{POSIX_timestamp, numeric_value}`. -type MetricPoint struct { - // The timestamp should be in seconds and current. - // Current is defined as not more than 10 minutes in the future or more than 1 hour in the past. - Timestamp *int64 `json:"timestamp,omitempty"` - // The numeric value format should be a 64bit float gauge-type value. - Value *float64 `json:"value,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{} -} - -// NewMetricPoint instantiates a new MetricPoint 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 NewMetricPoint() *MetricPoint { - this := MetricPoint{} - return &this -} - -// NewMetricPointWithDefaults instantiates a new MetricPoint 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 NewMetricPointWithDefaults() *MetricPoint { - this := MetricPoint{} - return &this -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *MetricPoint) GetTimestamp() int64 { - if o == nil || o.Timestamp == nil { - var ret int64 - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricPoint) GetTimestampOk() (*int64, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *MetricPoint) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. -func (o *MetricPoint) SetTimestamp(v int64) { - o.Timestamp = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *MetricPoint) GetValue() float64 { - if o == nil || o.Value == nil { - var ret float64 - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricPoint) GetValueOk() (*float64, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *MetricPoint) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given float64 and assigns it to the Value field. -func (o *MetricPoint) SetValue(v float64) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricPoint) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Timestamp != nil { - toSerialize["timestamp"] = o.Timestamp - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricPoint) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Timestamp *int64 `json:"timestamp,omitempty"` - Value *float64 `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Timestamp = all.Timestamp - o.Value = all.Value - return nil -} diff --git a/api/v2/datadog/model_metric_resource.go b/api/v2/datadog/model_metric_resource.go deleted file mode 100644 index e6155a78f64..00000000000 --- a/api/v2/datadog/model_metric_resource.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricResource Metric resource. -type MetricResource struct { - // The name of the resource. - Name *string `json:"name,omitempty"` - // The type of the resource. - Type *string `json:"type,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{} -} - -// NewMetricResource instantiates a new MetricResource 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 NewMetricResource() *MetricResource { - this := MetricResource{} - return &this -} - -// NewMetricResourceWithDefaults instantiates a new MetricResource 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 NewMetricResourceWithDefaults() *MetricResource { - this := MetricResource{} - return &this -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MetricResource) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricResource) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MetricResource) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *MetricResource) SetName(v string) { - o.Name = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricResource) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricResource) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricResource) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *MetricResource) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricResource) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricResource) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_series.go b/api/v2/datadog/model_metric_series.go deleted file mode 100644 index cdf13fc9866..00000000000 --- a/api/v2/datadog/model_metric_series.go +++ /dev/null @@ -1,425 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricSeries A metric to submit to Datadog. -// See [Datadog metrics](https://docs.datadoghq.com/developers/metrics/#custom-metrics-properties). -type MetricSeries struct { - // If the type of the metric is rate or count, define the corresponding interval. - Interval *int64 `json:"interval,omitempty"` - // Metadata for the metric. - Metadata *MetricMetadata `json:"metadata,omitempty"` - // The name of the timeseries. - Metric string `json:"metric"` - // Points relating to a metric. All points must be objects with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past. - Points []MetricPoint `json:"points"` - // A list of resources to associate with this metric. - Resources []MetricResource `json:"resources,omitempty"` - // The source type name. - SourceTypeName *string `json:"source_type_name,omitempty"` - // A list of tags associated with the metric. - Tags []string `json:"tags,omitempty"` - // The type of metric. The available types are `0` (unspecified), `1` (count), `2` (rate), and `3` (gauge). - Type *MetricIntakeType `json:"type,omitempty"` - // The unit of point value. - Unit *string `json:"unit,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{} -} - -// NewMetricSeries instantiates a new MetricSeries 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 NewMetricSeries(metric string, points []MetricPoint) *MetricSeries { - this := MetricSeries{} - this.Metric = metric - this.Points = points - return &this -} - -// NewMetricSeriesWithDefaults instantiates a new MetricSeries 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 NewMetricSeriesWithDefaults() *MetricSeries { - this := MetricSeries{} - return &this -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *MetricSeries) GetInterval() int64 { - if o == nil || o.Interval == nil { - var ret int64 - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetIntervalOk() (*int64, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *MetricSeries) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given int64 and assigns it to the Interval field. -func (o *MetricSeries) SetInterval(v int64) { - o.Interval = &v -} - -// GetMetadata returns the Metadata field value if set, zero value otherwise. -func (o *MetricSeries) GetMetadata() MetricMetadata { - if o == nil || o.Metadata == nil { - var ret MetricMetadata - return ret - } - return *o.Metadata -} - -// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetMetadataOk() (*MetricMetadata, bool) { - if o == nil || o.Metadata == nil { - return nil, false - } - return o.Metadata, true -} - -// HasMetadata returns a boolean if a field has been set. -func (o *MetricSeries) HasMetadata() bool { - if o != nil && o.Metadata != nil { - return true - } - - return false -} - -// SetMetadata gets a reference to the given MetricMetadata and assigns it to the Metadata field. -func (o *MetricSeries) SetMetadata(v MetricMetadata) { - o.Metadata = &v -} - -// GetMetric returns the Metric field value. -func (o *MetricSeries) GetMetric() string { - if o == nil { - var ret string - return ret - } - return o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetMetricOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Metric, true -} - -// SetMetric sets field value. -func (o *MetricSeries) SetMetric(v string) { - o.Metric = v -} - -// GetPoints returns the Points field value. -func (o *MetricSeries) GetPoints() []MetricPoint { - if o == nil { - var ret []MetricPoint - return ret - } - return o.Points -} - -// GetPointsOk returns a tuple with the Points field value -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetPointsOk() (*[]MetricPoint, bool) { - if o == nil { - return nil, false - } - return &o.Points, true -} - -// SetPoints sets field value. -func (o *MetricSeries) SetPoints(v []MetricPoint) { - o.Points = v -} - -// GetResources returns the Resources field value if set, zero value otherwise. -func (o *MetricSeries) GetResources() []MetricResource { - if o == nil || o.Resources == nil { - var ret []MetricResource - return ret - } - return o.Resources -} - -// GetResourcesOk returns a tuple with the Resources field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetResourcesOk() (*[]MetricResource, bool) { - if o == nil || o.Resources == nil { - return nil, false - } - return &o.Resources, true -} - -// HasResources returns a boolean if a field has been set. -func (o *MetricSeries) HasResources() bool { - if o != nil && o.Resources != nil { - return true - } - - return false -} - -// SetResources gets a reference to the given []MetricResource and assigns it to the Resources field. -func (o *MetricSeries) SetResources(v []MetricResource) { - o.Resources = v -} - -// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. -func (o *MetricSeries) GetSourceTypeName() string { - if o == nil || o.SourceTypeName == nil { - var ret string - return ret - } - return *o.SourceTypeName -} - -// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetSourceTypeNameOk() (*string, bool) { - if o == nil || o.SourceTypeName == nil { - return nil, false - } - return o.SourceTypeName, true -} - -// HasSourceTypeName returns a boolean if a field has been set. -func (o *MetricSeries) HasSourceTypeName() bool { - if o != nil && o.SourceTypeName != nil { - return true - } - - return false -} - -// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. -func (o *MetricSeries) SetSourceTypeName(v string) { - o.SourceTypeName = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MetricSeries) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MetricSeries) GetTagsOk() (*[]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 *MetricSeries) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MetricSeries) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricSeries) GetType() MetricIntakeType { - if o == nil || o.Type == nil { - var ret MetricIntakeType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetTypeOk() (*MetricIntakeType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricSeries) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MetricIntakeType and assigns it to the Type field. -func (o *MetricSeries) SetType(v MetricIntakeType) { - o.Type = &v -} - -// GetUnit returns the Unit field value if set, zero value otherwise. -func (o *MetricSeries) GetUnit() string { - if o == nil || o.Unit == nil { - var ret string - return ret - } - return *o.Unit -} - -// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricSeries) GetUnitOk() (*string, bool) { - if o == nil || o.Unit == nil { - return nil, false - } - return o.Unit, true -} - -// HasUnit returns a boolean if a field has been set. -func (o *MetricSeries) HasUnit() bool { - if o != nil && o.Unit != nil { - return true - } - - return false -} - -// SetUnit gets a reference to the given string and assigns it to the Unit field. -func (o *MetricSeries) SetUnit(v string) { - o.Unit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricSeries) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata - } - toSerialize["metric"] = o.Metric - toSerialize["points"] = o.Points - if o.Resources != nil { - toSerialize["resources"] = o.Resources - } - if o.SourceTypeName != nil { - toSerialize["source_type_name"] = o.SourceTypeName - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.Unit != nil { - toSerialize["unit"] = o.Unit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Metric *string `json:"metric"` - Points *[]MetricPoint `json:"points"` - }{} - all := struct { - Interval *int64 `json:"interval,omitempty"` - Metadata *MetricMetadata `json:"metadata,omitempty"` - Metric string `json:"metric"` - Points []MetricPoint `json:"points"` - Resources []MetricResource `json:"resources,omitempty"` - SourceTypeName *string `json:"source_type_name,omitempty"` - Tags []string `json:"tags,omitempty"` - Type *MetricIntakeType `json:"type,omitempty"` - Unit *string `json:"unit,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("Required field metric missing") - } - if required.Points == nil { - return fmt.Errorf("Required field points missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Interval = all.Interval - if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Metadata = all.Metadata - o.Metric = all.Metric - o.Points = all.Points - o.Resources = all.Resources - o.SourceTypeName = all.SourceTypeName - o.Tags = all.Tags - o.Type = all.Type - o.Unit = all.Unit - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration.go b/api/v2/datadog/model_metric_tag_configuration.go deleted file mode 100644 index 0f08e9a4290..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricTagConfiguration Object for a single metric tag configuration. -type MetricTagConfiguration struct { - // Object containing the definition of a metric tag configuration attributes. - Attributes *MetricTagConfigurationAttributes `json:"attributes,omitempty"` - // The metric name for this resource. - Id *string `json:"id,omitempty"` - // The metric tag configuration resource type. - Type *MetricTagConfigurationType `json:"type,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{} -} - -// NewMetricTagConfiguration instantiates a new MetricTagConfiguration 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 NewMetricTagConfiguration() *MetricTagConfiguration { - this := MetricTagConfiguration{} - var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS - this.Type = &typeVar - return &this -} - -// NewMetricTagConfigurationWithDefaults instantiates a new MetricTagConfiguration 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 NewMetricTagConfigurationWithDefaults() *MetricTagConfiguration { - this := MetricTagConfiguration{} - var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricTagConfiguration) GetAttributes() MetricTagConfigurationAttributes { - if o == nil || o.Attributes == nil { - var ret MetricTagConfigurationAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfiguration) GetAttributesOk() (*MetricTagConfigurationAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricTagConfiguration) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricTagConfigurationAttributes and assigns it to the Attributes field. -func (o *MetricTagConfiguration) SetAttributes(v MetricTagConfigurationAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MetricTagConfiguration) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfiguration) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MetricTagConfiguration) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *MetricTagConfiguration) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MetricTagConfiguration) GetType() MetricTagConfigurationType { - if o == nil || o.Type == nil { - var ret MetricTagConfigurationType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfiguration) GetTypeOk() (*MetricTagConfigurationType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MetricTagConfiguration) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given MetricTagConfigurationType and assigns it to the Type field. -func (o *MetricTagConfiguration) SetType(v MetricTagConfigurationType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfiguration) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfiguration) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *MetricTagConfigurationAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *MetricTagConfigurationType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_attributes.go b/api/v2/datadog/model_metric_tag_configuration_attributes.go deleted file mode 100644 index 44166e74a36..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_attributes.go +++ /dev/null @@ -1,334 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// MetricTagConfigurationAttributes Object containing the definition of a metric tag configuration attributes. -type MetricTagConfigurationAttributes struct { - // A list of queryable aggregation combinations for a count, rate, or gauge metric. - // By default, count and rate metrics require the (time: sum, space: sum) aggregation and - // Gauge metrics require the (time: avg, space: avg) aggregation. - // Additional time & space combinations are also available: - // - // - time: avg, space: avg - // - time: avg, space: max - // - time: avg, space: min - // - time: avg, space: sum - // - time: count, space: sum - // - time: max, space: max - // - time: min, space: min - // - time: sum, space: avg - // - time: sum, space: sum - // - // Can only be applied to metrics that have a `metric_type` of `count`, `rate`, or `gauge`. - Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` - // Timestamp when the tag configuration was created. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Toggle to turn on/off percentile aggregations for distribution metrics. - // Only present when the `metric_type` is `distribution`. - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - // The metric's type. - MetricType *MetricTagConfigurationMetricTypes `json:"metric_type,omitempty"` - // Timestamp when the tag configuration was last modified. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // List of tag keys on which to group. - Tags []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{} -} - -// NewMetricTagConfigurationAttributes instantiates a new MetricTagConfigurationAttributes 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 NewMetricTagConfigurationAttributes() *MetricTagConfigurationAttributes { - this := MetricTagConfigurationAttributes{} - var metricType MetricTagConfigurationMetricTypes = METRICTAGCONFIGURATIONMETRICTYPES_GAUGE - this.MetricType = &metricType - return &this -} - -// NewMetricTagConfigurationAttributesWithDefaults instantiates a new MetricTagConfigurationAttributes 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 NewMetricTagConfigurationAttributesWithDefaults() *MetricTagConfigurationAttributes { - this := MetricTagConfigurationAttributes{} - var metricType MetricTagConfigurationMetricTypes = METRICTAGCONFIGURATIONMETRICTYPES_GAUGE - this.MetricType = &metricType - return &this -} - -// GetAggregations returns the Aggregations field value if set, zero value otherwise. -func (o *MetricTagConfigurationAttributes) GetAggregations() []MetricCustomAggregation { - if o == nil || o.Aggregations == nil { - var ret []MetricCustomAggregation - return ret - } - return o.Aggregations -} - -// GetAggregationsOk returns a tuple with the Aggregations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationAttributes) GetAggregationsOk() (*[]MetricCustomAggregation, bool) { - if o == nil || o.Aggregations == nil { - return nil, false - } - return &o.Aggregations, true -} - -// HasAggregations returns a boolean if a field has been set. -func (o *MetricTagConfigurationAttributes) HasAggregations() bool { - if o != nil && o.Aggregations != nil { - return true - } - - return false -} - -// SetAggregations gets a reference to the given []MetricCustomAggregation and assigns it to the Aggregations field. -func (o *MetricTagConfigurationAttributes) SetAggregations(v []MetricCustomAggregation) { - o.Aggregations = v -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *MetricTagConfigurationAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *MetricTagConfigurationAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *MetricTagConfigurationAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise. -func (o *MetricTagConfigurationAttributes) GetIncludePercentiles() bool { - if o == nil || o.IncludePercentiles == nil { - var ret bool - return ret - } - return *o.IncludePercentiles -} - -// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationAttributes) GetIncludePercentilesOk() (*bool, bool) { - if o == nil || o.IncludePercentiles == nil { - return nil, false - } - return o.IncludePercentiles, true -} - -// HasIncludePercentiles returns a boolean if a field has been set. -func (o *MetricTagConfigurationAttributes) HasIncludePercentiles() bool { - if o != nil && o.IncludePercentiles != nil { - return true - } - - return false -} - -// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field. -func (o *MetricTagConfigurationAttributes) SetIncludePercentiles(v bool) { - o.IncludePercentiles = &v -} - -// GetMetricType returns the MetricType field value if set, zero value otherwise. -func (o *MetricTagConfigurationAttributes) GetMetricType() MetricTagConfigurationMetricTypes { - if o == nil || o.MetricType == nil { - var ret MetricTagConfigurationMetricTypes - return ret - } - return *o.MetricType -} - -// GetMetricTypeOk returns a tuple with the MetricType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationAttributes) GetMetricTypeOk() (*MetricTagConfigurationMetricTypes, bool) { - if o == nil || o.MetricType == nil { - return nil, false - } - return o.MetricType, true -} - -// HasMetricType returns a boolean if a field has been set. -func (o *MetricTagConfigurationAttributes) HasMetricType() bool { - if o != nil && o.MetricType != nil { - return true - } - - return false -} - -// SetMetricType gets a reference to the given MetricTagConfigurationMetricTypes and assigns it to the MetricType field. -func (o *MetricTagConfigurationAttributes) SetMetricType(v MetricTagConfigurationMetricTypes) { - o.MetricType = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *MetricTagConfigurationAttributes) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationAttributes) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *MetricTagConfigurationAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *MetricTagConfigurationAttributes) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MetricTagConfigurationAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MetricTagConfigurationAttributes) GetTagsOk() (*[]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 *MetricTagConfigurationAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MetricTagConfigurationAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregations != nil { - toSerialize["aggregations"] = o.Aggregations - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.IncludePercentiles != nil { - toSerialize["include_percentiles"] = o.IncludePercentiles - } - if o.MetricType != nil { - toSerialize["metric_type"] = o.MetricType - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - MetricType *MetricTagConfigurationMetricTypes `json:"metric_type,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.MetricType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregations = all.Aggregations - o.CreatedAt = all.CreatedAt - o.IncludePercentiles = all.IncludePercentiles - o.MetricType = all.MetricType - o.ModifiedAt = all.ModifiedAt - o.Tags = all.Tags - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_create_attributes.go b/api/v2/datadog/model_metric_tag_configuration_create_attributes.go deleted file mode 100644 index 2707fece35b..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_create_attributes.go +++ /dev/null @@ -1,240 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricTagConfigurationCreateAttributes Object containing the definition of a metric tag configuration to be created. -type MetricTagConfigurationCreateAttributes struct { - // A list of queryable aggregation combinations for a count, rate, or gauge metric. - // By default, count and rate metrics require the (time: sum, space: sum) aggregation and - // Gauge metrics require the (time: avg, space: avg) aggregation. - // Additional time & space combinations are also available: - // - // - time: avg, space: avg - // - time: avg, space: max - // - time: avg, space: min - // - time: avg, space: sum - // - time: count, space: sum - // - time: max, space: max - // - time: min, space: min - // - time: sum, space: avg - // - time: sum, space: sum - // - // Can only be applied to metrics that have a `metric_type` of `count`, `rate`, or `gauge`. - Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` - // Toggle to include/exclude percentiles for a distribution metric. - // Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - // The metric's type. - MetricType MetricTagConfigurationMetricTypes `json:"metric_type"` - // A list of tag keys that will be queryable for your metric. - Tags []string `json:"tags"` - // 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{} -} - -// NewMetricTagConfigurationCreateAttributes instantiates a new MetricTagConfigurationCreateAttributes 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 NewMetricTagConfigurationCreateAttributes(metricType MetricTagConfigurationMetricTypes, tags []string) *MetricTagConfigurationCreateAttributes { - this := MetricTagConfigurationCreateAttributes{} - this.MetricType = metricType - this.Tags = tags - return &this -} - -// NewMetricTagConfigurationCreateAttributesWithDefaults instantiates a new MetricTagConfigurationCreateAttributes 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 NewMetricTagConfigurationCreateAttributesWithDefaults() *MetricTagConfigurationCreateAttributes { - this := MetricTagConfigurationCreateAttributes{} - var metricType MetricTagConfigurationMetricTypes = METRICTAGCONFIGURATIONMETRICTYPES_GAUGE - this.MetricType = metricType - return &this -} - -// GetAggregations returns the Aggregations field value if set, zero value otherwise. -func (o *MetricTagConfigurationCreateAttributes) GetAggregations() []MetricCustomAggregation { - if o == nil || o.Aggregations == nil { - var ret []MetricCustomAggregation - return ret - } - return o.Aggregations -} - -// GetAggregationsOk returns a tuple with the Aggregations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationCreateAttributes) GetAggregationsOk() (*[]MetricCustomAggregation, bool) { - if o == nil || o.Aggregations == nil { - return nil, false - } - return &o.Aggregations, true -} - -// HasAggregations returns a boolean if a field has been set. -func (o *MetricTagConfigurationCreateAttributes) HasAggregations() bool { - if o != nil && o.Aggregations != nil { - return true - } - - return false -} - -// SetAggregations gets a reference to the given []MetricCustomAggregation and assigns it to the Aggregations field. -func (o *MetricTagConfigurationCreateAttributes) SetAggregations(v []MetricCustomAggregation) { - o.Aggregations = v -} - -// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise. -func (o *MetricTagConfigurationCreateAttributes) GetIncludePercentiles() bool { - if o == nil || o.IncludePercentiles == nil { - var ret bool - return ret - } - return *o.IncludePercentiles -} - -// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationCreateAttributes) GetIncludePercentilesOk() (*bool, bool) { - if o == nil || o.IncludePercentiles == nil { - return nil, false - } - return o.IncludePercentiles, true -} - -// HasIncludePercentiles returns a boolean if a field has been set. -func (o *MetricTagConfigurationCreateAttributes) HasIncludePercentiles() bool { - if o != nil && o.IncludePercentiles != nil { - return true - } - - return false -} - -// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field. -func (o *MetricTagConfigurationCreateAttributes) SetIncludePercentiles(v bool) { - o.IncludePercentiles = &v -} - -// GetMetricType returns the MetricType field value. -func (o *MetricTagConfigurationCreateAttributes) GetMetricType() MetricTagConfigurationMetricTypes { - if o == nil { - var ret MetricTagConfigurationMetricTypes - return ret - } - return o.MetricType -} - -// GetMetricTypeOk returns a tuple with the MetricType field value -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationCreateAttributes) GetMetricTypeOk() (*MetricTagConfigurationMetricTypes, bool) { - if o == nil { - return nil, false - } - return &o.MetricType, true -} - -// SetMetricType sets field value. -func (o *MetricTagConfigurationCreateAttributes) SetMetricType(v MetricTagConfigurationMetricTypes) { - o.MetricType = v -} - -// GetTags returns the Tags field value. -func (o *MetricTagConfigurationCreateAttributes) GetTags() []string { - if o == nil { - var ret []string - return ret - } - return o.Tags -} - -// GetTagsOk returns a tuple with the Tags field value -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationCreateAttributes) GetTagsOk() (*[]string, bool) { - if o == nil { - return nil, false - } - return &o.Tags, true -} - -// SetTags sets field value. -func (o *MetricTagConfigurationCreateAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregations != nil { - toSerialize["aggregations"] = o.Aggregations - } - if o.IncludePercentiles != nil { - toSerialize["include_percentiles"] = o.IncludePercentiles - } - toSerialize["metric_type"] = o.MetricType - toSerialize["tags"] = o.Tags - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - MetricType *MetricTagConfigurationMetricTypes `json:"metric_type"` - Tags *[]string `json:"tags"` - }{} - all := struct { - Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - MetricType MetricTagConfigurationMetricTypes `json:"metric_type"` - Tags []string `json:"tags"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.MetricType == nil { - return fmt.Errorf("Required field metric_type missing") - } - if required.Tags == nil { - return fmt.Errorf("Required field tags missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.MetricType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregations = all.Aggregations - o.IncludePercentiles = all.IncludePercentiles - o.MetricType = all.MetricType - o.Tags = all.Tags - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_create_data.go b/api/v2/datadog/model_metric_tag_configuration_create_data.go deleted file mode 100644 index a616a39fb58..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_create_data.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricTagConfigurationCreateData Object for a single metric to be configure tags on. -type MetricTagConfigurationCreateData struct { - // Object containing the definition of a metric tag configuration to be created. - Attributes *MetricTagConfigurationCreateAttributes `json:"attributes,omitempty"` - // The metric name for this resource. - Id string `json:"id"` - // The metric tag configuration resource type. - Type MetricTagConfigurationType `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{} -} - -// NewMetricTagConfigurationCreateData instantiates a new MetricTagConfigurationCreateData 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 NewMetricTagConfigurationCreateData(id string, typeVar MetricTagConfigurationType) *MetricTagConfigurationCreateData { - this := MetricTagConfigurationCreateData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewMetricTagConfigurationCreateDataWithDefaults instantiates a new MetricTagConfigurationCreateData 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 NewMetricTagConfigurationCreateDataWithDefaults() *MetricTagConfigurationCreateData { - this := MetricTagConfigurationCreateData{} - var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricTagConfigurationCreateData) GetAttributes() MetricTagConfigurationCreateAttributes { - if o == nil || o.Attributes == nil { - var ret MetricTagConfigurationCreateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationCreateData) GetAttributesOk() (*MetricTagConfigurationCreateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricTagConfigurationCreateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricTagConfigurationCreateAttributes and assigns it to the Attributes field. -func (o *MetricTagConfigurationCreateData) SetAttributes(v MetricTagConfigurationCreateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *MetricTagConfigurationCreateData) 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 *MetricTagConfigurationCreateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *MetricTagConfigurationCreateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *MetricTagConfigurationCreateData) GetType() MetricTagConfigurationType { - if o == nil { - var ret MetricTagConfigurationType - 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 *MetricTagConfigurationCreateData) GetTypeOk() (*MetricTagConfigurationType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *MetricTagConfigurationCreateData) SetType(v MetricTagConfigurationType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricTagConfigurationType `json:"type"` - }{} - all := struct { - Attributes *MetricTagConfigurationCreateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricTagConfigurationType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_create_request.go b/api/v2/datadog/model_metric_tag_configuration_create_request.go deleted file mode 100644 index 35c19f979d6..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricTagConfigurationCreateRequest Request object that includes the metric that you would like to configure tags for. -type MetricTagConfigurationCreateRequest struct { - // Object for a single metric to be configure tags on. - Data MetricTagConfigurationCreateData `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{} -} - -// NewMetricTagConfigurationCreateRequest instantiates a new MetricTagConfigurationCreateRequest 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 NewMetricTagConfigurationCreateRequest(data MetricTagConfigurationCreateData) *MetricTagConfigurationCreateRequest { - this := MetricTagConfigurationCreateRequest{} - this.Data = data - return &this -} - -// NewMetricTagConfigurationCreateRequestWithDefaults instantiates a new MetricTagConfigurationCreateRequest 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 NewMetricTagConfigurationCreateRequestWithDefaults() *MetricTagConfigurationCreateRequest { - this := MetricTagConfigurationCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *MetricTagConfigurationCreateRequest) GetData() MetricTagConfigurationCreateData { - if o == nil { - var ret MetricTagConfigurationCreateData - 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 *MetricTagConfigurationCreateRequest) GetDataOk() (*MetricTagConfigurationCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *MetricTagConfigurationCreateRequest) SetData(v MetricTagConfigurationCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *MetricTagConfigurationCreateData `json:"data"` - }{} - all := struct { - Data MetricTagConfigurationCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_metric_types.go b/api/v2/datadog/model_metric_tag_configuration_metric_types.go deleted file mode 100644 index e0d956a4a3f..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_metric_types.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricTagConfigurationMetricTypes The metric's type. -type MetricTagConfigurationMetricTypes string - -// List of MetricTagConfigurationMetricTypes. -const ( - METRICTAGCONFIGURATIONMETRICTYPES_GAUGE MetricTagConfigurationMetricTypes = "gauge" - METRICTAGCONFIGURATIONMETRICTYPES_COUNT MetricTagConfigurationMetricTypes = "count" - METRICTAGCONFIGURATIONMETRICTYPES_RATE MetricTagConfigurationMetricTypes = "rate" - METRICTAGCONFIGURATIONMETRICTYPES_DISTRIBUTION MetricTagConfigurationMetricTypes = "distribution" -) - -var allowedMetricTagConfigurationMetricTypesEnumValues = []MetricTagConfigurationMetricTypes{ - METRICTAGCONFIGURATIONMETRICTYPES_GAUGE, - METRICTAGCONFIGURATIONMETRICTYPES_COUNT, - METRICTAGCONFIGURATIONMETRICTYPES_RATE, - METRICTAGCONFIGURATIONMETRICTYPES_DISTRIBUTION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricTagConfigurationMetricTypes) GetAllowedValues() []MetricTagConfigurationMetricTypes { - return allowedMetricTagConfigurationMetricTypesEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricTagConfigurationMetricTypes) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricTagConfigurationMetricTypes(value) - return nil -} - -// NewMetricTagConfigurationMetricTypesFromValue returns a pointer to a valid MetricTagConfigurationMetricTypes -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricTagConfigurationMetricTypesFromValue(v string) (*MetricTagConfigurationMetricTypes, error) { - ev := MetricTagConfigurationMetricTypes(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricTagConfigurationMetricTypes: valid values are %v", v, allowedMetricTagConfigurationMetricTypesEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricTagConfigurationMetricTypes) IsValid() bool { - for _, existing := range allowedMetricTagConfigurationMetricTypesEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricTagConfigurationMetricTypes value. -func (v MetricTagConfigurationMetricTypes) Ptr() *MetricTagConfigurationMetricTypes { - return &v -} - -// NullableMetricTagConfigurationMetricTypes handles when a null is used for MetricTagConfigurationMetricTypes. -type NullableMetricTagConfigurationMetricTypes struct { - value *MetricTagConfigurationMetricTypes - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricTagConfigurationMetricTypes) Get() *MetricTagConfigurationMetricTypes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricTagConfigurationMetricTypes) Set(val *MetricTagConfigurationMetricTypes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricTagConfigurationMetricTypes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricTagConfigurationMetricTypes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricTagConfigurationMetricTypes initializes the struct as if Set has been called. -func NewNullableMetricTagConfigurationMetricTypes(val *MetricTagConfigurationMetricTypes) *NullableMetricTagConfigurationMetricTypes { - return &NullableMetricTagConfigurationMetricTypes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricTagConfigurationMetricTypes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricTagConfigurationMetricTypes) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_tag_configuration_response.go b/api/v2/datadog/model_metric_tag_configuration_response.go deleted file mode 100644 index 2c11cd98b58..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricTagConfigurationResponse Response object which includes a single metric's tag configuration. -type MetricTagConfigurationResponse struct { - // Object for a single metric tag configuration. - Data *MetricTagConfiguration `json:"data,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{} -} - -// NewMetricTagConfigurationResponse instantiates a new MetricTagConfigurationResponse 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 NewMetricTagConfigurationResponse() *MetricTagConfigurationResponse { - this := MetricTagConfigurationResponse{} - return &this -} - -// NewMetricTagConfigurationResponseWithDefaults instantiates a new MetricTagConfigurationResponse 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 NewMetricTagConfigurationResponseWithDefaults() *MetricTagConfigurationResponse { - this := MetricTagConfigurationResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *MetricTagConfigurationResponse) GetData() MetricTagConfiguration { - if o == nil || o.Data == nil { - var ret MetricTagConfiguration - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationResponse) GetDataOk() (*MetricTagConfiguration, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *MetricTagConfigurationResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given MetricTagConfiguration and assigns it to the Data field. -func (o *MetricTagConfigurationResponse) SetData(v MetricTagConfiguration) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *MetricTagConfiguration `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_type.go b/api/v2/datadog/model_metric_tag_configuration_type.go deleted file mode 100644 index 2d9ccf6f1ce..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricTagConfigurationType The metric tag configuration resource type. -type MetricTagConfigurationType string - -// List of MetricTagConfigurationType. -const ( - METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS MetricTagConfigurationType = "manage_tags" -) - -var allowedMetricTagConfigurationTypeEnumValues = []MetricTagConfigurationType{ - METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricTagConfigurationType) GetAllowedValues() []MetricTagConfigurationType { - return allowedMetricTagConfigurationTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricTagConfigurationType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricTagConfigurationType(value) - return nil -} - -// NewMetricTagConfigurationTypeFromValue returns a pointer to a valid MetricTagConfigurationType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricTagConfigurationTypeFromValue(v string) (*MetricTagConfigurationType, error) { - ev := MetricTagConfigurationType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricTagConfigurationType: valid values are %v", v, allowedMetricTagConfigurationTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricTagConfigurationType) IsValid() bool { - for _, existing := range allowedMetricTagConfigurationTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricTagConfigurationType value. -func (v MetricTagConfigurationType) Ptr() *MetricTagConfigurationType { - return &v -} - -// NullableMetricTagConfigurationType handles when a null is used for MetricTagConfigurationType. -type NullableMetricTagConfigurationType struct { - value *MetricTagConfigurationType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricTagConfigurationType) Get() *MetricTagConfigurationType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricTagConfigurationType) Set(val *MetricTagConfigurationType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricTagConfigurationType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricTagConfigurationType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricTagConfigurationType initializes the struct as if Set has been called. -func NewNullableMetricTagConfigurationType(val *MetricTagConfigurationType) *NullableMetricTagConfigurationType { - return &NullableMetricTagConfigurationType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricTagConfigurationType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricTagConfigurationType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_tag_configuration_update_attributes.go b/api/v2/datadog/model_metric_tag_configuration_update_attributes.go deleted file mode 100644 index b3c19db3197..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_update_attributes.go +++ /dev/null @@ -1,196 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricTagConfigurationUpdateAttributes Object containing the definition of a metric tag configuration to be updated. -type MetricTagConfigurationUpdateAttributes struct { - // A list of queryable aggregation combinations for a count, rate, or gauge metric. - // By default, count and rate metrics require the (time: sum, space: sum) aggregation and - // Gauge metrics require the (time: avg, space: avg) aggregation. - // Additional time & space combinations are also available: - // - // - time: avg, space: avg - // - time: avg, space: max - // - time: avg, space: min - // - time: avg, space: sum - // - time: count, space: sum - // - time: max, space: max - // - time: min, space: min - // - time: sum, space: avg - // - time: sum, space: sum - // - // Can only be applied to metrics that have a `metric_type` of `count`, `rate`, or `gauge`. - Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` - // Toggle to include/exclude percentiles for a distribution metric. - // Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - // A list of tag keys that will be queryable for your metric. - Tags []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{} -} - -// NewMetricTagConfigurationUpdateAttributes instantiates a new MetricTagConfigurationUpdateAttributes 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 NewMetricTagConfigurationUpdateAttributes() *MetricTagConfigurationUpdateAttributes { - this := MetricTagConfigurationUpdateAttributes{} - return &this -} - -// NewMetricTagConfigurationUpdateAttributesWithDefaults instantiates a new MetricTagConfigurationUpdateAttributes 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 NewMetricTagConfigurationUpdateAttributesWithDefaults() *MetricTagConfigurationUpdateAttributes { - this := MetricTagConfigurationUpdateAttributes{} - return &this -} - -// GetAggregations returns the Aggregations field value if set, zero value otherwise. -func (o *MetricTagConfigurationUpdateAttributes) GetAggregations() []MetricCustomAggregation { - if o == nil || o.Aggregations == nil { - var ret []MetricCustomAggregation - return ret - } - return o.Aggregations -} - -// GetAggregationsOk returns a tuple with the Aggregations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationUpdateAttributes) GetAggregationsOk() (*[]MetricCustomAggregation, bool) { - if o == nil || o.Aggregations == nil { - return nil, false - } - return &o.Aggregations, true -} - -// HasAggregations returns a boolean if a field has been set. -func (o *MetricTagConfigurationUpdateAttributes) HasAggregations() bool { - if o != nil && o.Aggregations != nil { - return true - } - - return false -} - -// SetAggregations gets a reference to the given []MetricCustomAggregation and assigns it to the Aggregations field. -func (o *MetricTagConfigurationUpdateAttributes) SetAggregations(v []MetricCustomAggregation) { - o.Aggregations = v -} - -// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise. -func (o *MetricTagConfigurationUpdateAttributes) GetIncludePercentiles() bool { - if o == nil || o.IncludePercentiles == nil { - var ret bool - return ret - } - return *o.IncludePercentiles -} - -// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationUpdateAttributes) GetIncludePercentilesOk() (*bool, bool) { - if o == nil || o.IncludePercentiles == nil { - return nil, false - } - return o.IncludePercentiles, true -} - -// HasIncludePercentiles returns a boolean if a field has been set. -func (o *MetricTagConfigurationUpdateAttributes) HasIncludePercentiles() bool { - if o != nil && o.IncludePercentiles != nil { - return true - } - - return false -} - -// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field. -func (o *MetricTagConfigurationUpdateAttributes) SetIncludePercentiles(v bool) { - o.IncludePercentiles = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MetricTagConfigurationUpdateAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MetricTagConfigurationUpdateAttributes) GetTagsOk() (*[]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 *MetricTagConfigurationUpdateAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MetricTagConfigurationUpdateAttributes) SetTags(v []string) { - o.Tags = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregations != nil { - toSerialize["aggregations"] = o.Aggregations - } - if o.IncludePercentiles != nil { - toSerialize["include_percentiles"] = o.IncludePercentiles - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - Tags []string `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregations = all.Aggregations - o.IncludePercentiles = all.IncludePercentiles - o.Tags = all.Tags - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_update_data.go b/api/v2/datadog/model_metric_tag_configuration_update_data.go deleted file mode 100644 index 82afe902735..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_update_data.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricTagConfigurationUpdateData Object for a single tag configuration to be edited. -type MetricTagConfigurationUpdateData struct { - // Object containing the definition of a metric tag configuration to be updated. - Attributes *MetricTagConfigurationUpdateAttributes `json:"attributes,omitempty"` - // The metric name for this resource. - Id string `json:"id"` - // The metric tag configuration resource type. - Type MetricTagConfigurationType `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{} -} - -// NewMetricTagConfigurationUpdateData instantiates a new MetricTagConfigurationUpdateData 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 NewMetricTagConfigurationUpdateData(id string, typeVar MetricTagConfigurationType) *MetricTagConfigurationUpdateData { - this := MetricTagConfigurationUpdateData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewMetricTagConfigurationUpdateDataWithDefaults instantiates a new MetricTagConfigurationUpdateData 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 NewMetricTagConfigurationUpdateDataWithDefaults() *MetricTagConfigurationUpdateData { - this := MetricTagConfigurationUpdateData{} - var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *MetricTagConfigurationUpdateData) GetAttributes() MetricTagConfigurationUpdateAttributes { - if o == nil || o.Attributes == nil { - var ret MetricTagConfigurationUpdateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricTagConfigurationUpdateData) GetAttributesOk() (*MetricTagConfigurationUpdateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *MetricTagConfigurationUpdateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given MetricTagConfigurationUpdateAttributes and assigns it to the Attributes field. -func (o *MetricTagConfigurationUpdateData) SetAttributes(v MetricTagConfigurationUpdateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *MetricTagConfigurationUpdateData) 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 *MetricTagConfigurationUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *MetricTagConfigurationUpdateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *MetricTagConfigurationUpdateData) GetType() MetricTagConfigurationType { - if o == nil { - var ret MetricTagConfigurationType - 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 *MetricTagConfigurationUpdateData) GetTypeOk() (*MetricTagConfigurationType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *MetricTagConfigurationUpdateData) SetType(v MetricTagConfigurationType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricTagConfigurationType `json:"type"` - }{} - all := struct { - Attributes *MetricTagConfigurationUpdateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricTagConfigurationType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_metric_tag_configuration_update_request.go b/api/v2/datadog/model_metric_tag_configuration_update_request.go deleted file mode 100644 index e344ea1e4c5..00000000000 --- a/api/v2/datadog/model_metric_tag_configuration_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricTagConfigurationUpdateRequest Request object that includes the metric that you would like to edit the tag configuration on. -type MetricTagConfigurationUpdateRequest struct { - // Object for a single tag configuration to be edited. - Data MetricTagConfigurationUpdateData `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{} -} - -// NewMetricTagConfigurationUpdateRequest instantiates a new MetricTagConfigurationUpdateRequest 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 NewMetricTagConfigurationUpdateRequest(data MetricTagConfigurationUpdateData) *MetricTagConfigurationUpdateRequest { - this := MetricTagConfigurationUpdateRequest{} - this.Data = data - return &this -} - -// NewMetricTagConfigurationUpdateRequestWithDefaults instantiates a new MetricTagConfigurationUpdateRequest 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 NewMetricTagConfigurationUpdateRequestWithDefaults() *MetricTagConfigurationUpdateRequest { - this := MetricTagConfigurationUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *MetricTagConfigurationUpdateRequest) GetData() MetricTagConfigurationUpdateData { - if o == nil { - var ret MetricTagConfigurationUpdateData - 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 *MetricTagConfigurationUpdateRequest) GetDataOk() (*MetricTagConfigurationUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *MetricTagConfigurationUpdateRequest) SetData(v MetricTagConfigurationUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricTagConfigurationUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricTagConfigurationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *MetricTagConfigurationUpdateData `json:"data"` - }{} - all := struct { - Data MetricTagConfigurationUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metric_type.go b/api/v2/datadog/model_metric_type.go deleted file mode 100644 index e9b410d123c..00000000000 --- a/api/v2/datadog/model_metric_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// MetricType The metric resource type. -type MetricType string - -// List of MetricType. -const ( - METRICTYPE_METRICS MetricType = "metrics" -) - -var allowedMetricTypeEnumValues = []MetricType{ - METRICTYPE_METRICS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *MetricType) GetAllowedValues() []MetricType { - return allowedMetricTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *MetricType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = MetricType(value) - return nil -} - -// NewMetricTypeFromValue returns a pointer to a valid MetricType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewMetricTypeFromValue(v string) (*MetricType, error) { - ev := MetricType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for MetricType: valid values are %v", v, allowedMetricTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v MetricType) IsValid() bool { - for _, existing := range allowedMetricTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to MetricType value. -func (v MetricType) Ptr() *MetricType { - return &v -} - -// NullableMetricType handles when a null is used for MetricType. -type NullableMetricType struct { - value *MetricType - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricType) Get() *MetricType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricType) Set(val *MetricType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableMetricType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricType initializes the struct as if Set has been called. -func NewNullableMetricType(val *MetricType) *NullableMetricType { - return &NullableMetricType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_volumes.go b/api/v2/datadog/model_metric_volumes.go deleted file mode 100644 index 67ea5dada31..00000000000 --- a/api/v2/datadog/model_metric_volumes.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricVolumes - Possible response objects for a metric's volume. -type MetricVolumes struct { - MetricDistinctVolume *MetricDistinctVolume - MetricIngestedIndexedVolume *MetricIngestedIndexedVolume - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// MetricDistinctVolumeAsMetricVolumes is a convenience function that returns MetricDistinctVolume wrapped in MetricVolumes. -func MetricDistinctVolumeAsMetricVolumes(v *MetricDistinctVolume) MetricVolumes { - return MetricVolumes{MetricDistinctVolume: v} -} - -// MetricIngestedIndexedVolumeAsMetricVolumes is a convenience function that returns MetricIngestedIndexedVolume wrapped in MetricVolumes. -func MetricIngestedIndexedVolumeAsMetricVolumes(v *MetricIngestedIndexedVolume) MetricVolumes { - return MetricVolumes{MetricIngestedIndexedVolume: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *MetricVolumes) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into MetricDistinctVolume - err = json.Unmarshal(data, &obj.MetricDistinctVolume) - if err == nil { - if obj.MetricDistinctVolume != nil && obj.MetricDistinctVolume.UnparsedObject == nil { - jsonMetricDistinctVolume, _ := json.Marshal(obj.MetricDistinctVolume) - if string(jsonMetricDistinctVolume) == "{}" { // empty struct - obj.MetricDistinctVolume = nil - } else { - match++ - } - } else { - obj.MetricDistinctVolume = nil - } - } else { - obj.MetricDistinctVolume = nil - } - - // try to unmarshal data into MetricIngestedIndexedVolume - err = json.Unmarshal(data, &obj.MetricIngestedIndexedVolume) - if err == nil { - if obj.MetricIngestedIndexedVolume != nil && obj.MetricIngestedIndexedVolume.UnparsedObject == nil { - jsonMetricIngestedIndexedVolume, _ := json.Marshal(obj.MetricIngestedIndexedVolume) - if string(jsonMetricIngestedIndexedVolume) == "{}" { // empty struct - obj.MetricIngestedIndexedVolume = nil - } else { - match++ - } - } else { - obj.MetricIngestedIndexedVolume = nil - } - } else { - obj.MetricIngestedIndexedVolume = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.MetricDistinctVolume = nil - obj.MetricIngestedIndexedVolume = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj MetricVolumes) MarshalJSON() ([]byte, error) { - if obj.MetricDistinctVolume != nil { - return json.Marshal(&obj.MetricDistinctVolume) - } - - if obj.MetricIngestedIndexedVolume != nil { - return json.Marshal(&obj.MetricIngestedIndexedVolume) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *MetricVolumes) GetActualInstance() interface{} { - if obj.MetricDistinctVolume != nil { - return obj.MetricDistinctVolume - } - - if obj.MetricIngestedIndexedVolume != nil { - return obj.MetricIngestedIndexedVolume - } - - // all schemas are nil - return nil -} - -// NullableMetricVolumes handles when a null is used for MetricVolumes. -type NullableMetricVolumes struct { - value *MetricVolumes - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricVolumes) Get() *MetricVolumes { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricVolumes) Set(val *MetricVolumes) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricVolumes) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMetricVolumes) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricVolumes initializes the struct as if Set has been called. -func NewNullableMetricVolumes(val *MetricVolumes) *NullableMetricVolumes { - return &NullableMetricVolumes{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricVolumes) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricVolumes) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metric_volumes_response.go b/api/v2/datadog/model_metric_volumes_response.go deleted file mode 100644 index fe5f51192d9..00000000000 --- a/api/v2/datadog/model_metric_volumes_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricVolumesResponse Response object which includes a single metric's volume. -type MetricVolumesResponse struct { - // Possible response objects for a metric's volume. - Data *MetricVolumes `json:"data,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{} -} - -// NewMetricVolumesResponse instantiates a new MetricVolumesResponse 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 NewMetricVolumesResponse() *MetricVolumesResponse { - this := MetricVolumesResponse{} - return &this -} - -// NewMetricVolumesResponseWithDefaults instantiates a new MetricVolumesResponse 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 NewMetricVolumesResponseWithDefaults() *MetricVolumesResponse { - this := MetricVolumesResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *MetricVolumesResponse) GetData() MetricVolumes { - if o == nil || o.Data == nil { - var ret MetricVolumes - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricVolumesResponse) GetDataOk() (*MetricVolumes, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *MetricVolumesResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given MetricVolumes and assigns it to the Data field. -func (o *MetricVolumesResponse) SetData(v MetricVolumes) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricVolumesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricVolumesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *MetricVolumes `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_metrics_and_metric_tag_configurations.go b/api/v2/datadog/model_metrics_and_metric_tag_configurations.go deleted file mode 100644 index 7d370f944fd..00000000000 --- a/api/v2/datadog/model_metrics_and_metric_tag_configurations.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricsAndMetricTagConfigurations - Object for a metrics and metric tag configurations. -type MetricsAndMetricTagConfigurations struct { - Metric *Metric - MetricTagConfiguration *MetricTagConfiguration - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// MetricAsMetricsAndMetricTagConfigurations is a convenience function that returns Metric wrapped in MetricsAndMetricTagConfigurations. -func MetricAsMetricsAndMetricTagConfigurations(v *Metric) MetricsAndMetricTagConfigurations { - return MetricsAndMetricTagConfigurations{Metric: v} -} - -// MetricTagConfigurationAsMetricsAndMetricTagConfigurations is a convenience function that returns MetricTagConfiguration wrapped in MetricsAndMetricTagConfigurations. -func MetricTagConfigurationAsMetricsAndMetricTagConfigurations(v *MetricTagConfiguration) MetricsAndMetricTagConfigurations { - return MetricsAndMetricTagConfigurations{MetricTagConfiguration: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *MetricsAndMetricTagConfigurations) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into Metric - err = json.Unmarshal(data, &obj.Metric) - if err == nil { - if obj.Metric != nil && obj.Metric.UnparsedObject == nil { - jsonMetric, _ := json.Marshal(obj.Metric) - if string(jsonMetric) == "{}" { // empty struct - obj.Metric = nil - } else { - match++ - } - } else { - obj.Metric = nil - } - } else { - obj.Metric = nil - } - - // try to unmarshal data into MetricTagConfiguration - err = json.Unmarshal(data, &obj.MetricTagConfiguration) - if err == nil { - if obj.MetricTagConfiguration != nil && obj.MetricTagConfiguration.UnparsedObject == nil { - jsonMetricTagConfiguration, _ := json.Marshal(obj.MetricTagConfiguration) - if string(jsonMetricTagConfiguration) == "{}" { // empty struct - obj.MetricTagConfiguration = nil - } else { - match++ - } - } else { - obj.MetricTagConfiguration = nil - } - } else { - obj.MetricTagConfiguration = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.Metric = nil - obj.MetricTagConfiguration = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj MetricsAndMetricTagConfigurations) MarshalJSON() ([]byte, error) { - if obj.Metric != nil { - return json.Marshal(&obj.Metric) - } - - if obj.MetricTagConfiguration != nil { - return json.Marshal(&obj.MetricTagConfiguration) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *MetricsAndMetricTagConfigurations) GetActualInstance() interface{} { - if obj.Metric != nil { - return obj.Metric - } - - if obj.MetricTagConfiguration != nil { - return obj.MetricTagConfiguration - } - - // all schemas are nil - return nil -} - -// NullableMetricsAndMetricTagConfigurations handles when a null is used for MetricsAndMetricTagConfigurations. -type NullableMetricsAndMetricTagConfigurations struct { - value *MetricsAndMetricTagConfigurations - isSet bool -} - -// Get returns the associated value. -func (v NullableMetricsAndMetricTagConfigurations) Get() *MetricsAndMetricTagConfigurations { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMetricsAndMetricTagConfigurations) Set(val *MetricsAndMetricTagConfigurations) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMetricsAndMetricTagConfigurations) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMetricsAndMetricTagConfigurations) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMetricsAndMetricTagConfigurations initializes the struct as if Set has been called. -func NewNullableMetricsAndMetricTagConfigurations(val *MetricsAndMetricTagConfigurations) *NullableMetricsAndMetricTagConfigurations { - return &NullableMetricsAndMetricTagConfigurations{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMetricsAndMetricTagConfigurations) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMetricsAndMetricTagConfigurations) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_metrics_and_metric_tag_configurations_response.go b/api/v2/datadog/model_metrics_and_metric_tag_configurations_response.go deleted file mode 100644 index db8204f5a4f..00000000000 --- a/api/v2/datadog/model_metrics_and_metric_tag_configurations_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MetricsAndMetricTagConfigurationsResponse Response object that includes metrics and metric tag configurations. -type MetricsAndMetricTagConfigurationsResponse struct { - // Array of metrics and metric tag configurations. - Data []MetricsAndMetricTagConfigurations `json:"data,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{} -} - -// NewMetricsAndMetricTagConfigurationsResponse instantiates a new MetricsAndMetricTagConfigurationsResponse 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 NewMetricsAndMetricTagConfigurationsResponse() *MetricsAndMetricTagConfigurationsResponse { - this := MetricsAndMetricTagConfigurationsResponse{} - return &this -} - -// NewMetricsAndMetricTagConfigurationsResponseWithDefaults instantiates a new MetricsAndMetricTagConfigurationsResponse 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 NewMetricsAndMetricTagConfigurationsResponseWithDefaults() *MetricsAndMetricTagConfigurationsResponse { - this := MetricsAndMetricTagConfigurationsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *MetricsAndMetricTagConfigurationsResponse) GetData() []MetricsAndMetricTagConfigurations { - if o == nil || o.Data == nil { - var ret []MetricsAndMetricTagConfigurations - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricsAndMetricTagConfigurationsResponse) GetDataOk() (*[]MetricsAndMetricTagConfigurations, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *MetricsAndMetricTagConfigurationsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []MetricsAndMetricTagConfigurations and assigns it to the Data field. -func (o *MetricsAndMetricTagConfigurationsResponse) SetData(v []MetricsAndMetricTagConfigurations) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MetricsAndMetricTagConfigurationsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MetricsAndMetricTagConfigurationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []MetricsAndMetricTagConfigurations `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_monitor_type.go b/api/v2/datadog/model_monitor_type.go deleted file mode 100644 index 76b407af12a..00000000000 --- a/api/v2/datadog/model_monitor_type.go +++ /dev/null @@ -1,542 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// MonitorType Attributes from the monitor that triggered the event. -type MonitorType struct { - // The POSIX timestamp of the monitor's creation in nanoseconds. - CreatedAt *int32 `json:"created_at,omitempty"` - // Monitor group status used when there is no `result_groups`. - GroupStatus *int32 `json:"group_status,omitempty"` - // Groups to which the monitor belongs. - Groups []string `json:"groups,omitempty"` - // The monitor ID. - Id *int32 `json:"id,omitempty"` - // The monitor message. - Message *string `json:"message,omitempty"` - // The monitor's last-modified timestamp. - Modified *int32 `json:"modified,omitempty"` - // The monitor name. - Name *string `json:"name,omitempty"` - // The query that triggers the alert. - Query *string `json:"query,omitempty"` - // A list of tags attached to the monitor. - Tags []string `json:"tags,omitempty"` - // The templated name of the monitor before resolving any template variables. - TemplatedName *string `json:"templated_name,omitempty"` - // The monitor type. - Type *string `json:"type,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{} -} - -// NewMonitorType instantiates a new MonitorType 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 NewMonitorType() *MonitorType { - this := MonitorType{} - return &this -} - -// NewMonitorTypeWithDefaults instantiates a new MonitorType 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 NewMonitorTypeWithDefaults() *MonitorType { - this := MonitorType{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *MonitorType) GetCreatedAt() int32 { - if o == nil || o.CreatedAt == nil { - var ret int32 - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetCreatedAtOk() (*int32, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *MonitorType) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given int32 and assigns it to the CreatedAt field. -func (o *MonitorType) SetCreatedAt(v int32) { - o.CreatedAt = &v -} - -// GetGroupStatus returns the GroupStatus field value if set, zero value otherwise. -func (o *MonitorType) GetGroupStatus() int32 { - if o == nil || o.GroupStatus == nil { - var ret int32 - return ret - } - return *o.GroupStatus -} - -// GetGroupStatusOk returns a tuple with the GroupStatus field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetGroupStatusOk() (*int32, bool) { - if o == nil || o.GroupStatus == nil { - return nil, false - } - return o.GroupStatus, true -} - -// HasGroupStatus returns a boolean if a field has been set. -func (o *MonitorType) HasGroupStatus() bool { - if o != nil && o.GroupStatus != nil { - return true - } - - return false -} - -// SetGroupStatus gets a reference to the given int32 and assigns it to the GroupStatus field. -func (o *MonitorType) SetGroupStatus(v int32) { - o.GroupStatus = &v -} - -// GetGroups returns the Groups field value if set, zero value otherwise. -func (o *MonitorType) GetGroups() []string { - if o == nil || o.Groups == nil { - var ret []string - 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 *MonitorType) GetGroupsOk() (*[]string, 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 *MonitorType) HasGroups() bool { - if o != nil && o.Groups != nil { - return true - } - - return false -} - -// SetGroups gets a reference to the given []string and assigns it to the Groups field. -func (o *MonitorType) SetGroups(v []string) { - o.Groups = v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *MonitorType) GetId() int32 { - if o == nil || o.Id == nil { - var ret int32 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetIdOk() (*int32, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *MonitorType) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int32 and assigns it to the Id field. -func (o *MonitorType) SetId(v int32) { - o.Id = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *MonitorType) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *MonitorType) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *MonitorType) SetMessage(v string) { - o.Message = &v -} - -// GetModified returns the Modified field value if set, zero value otherwise. -func (o *MonitorType) GetModified() int32 { - if o == nil || o.Modified == nil { - var ret int32 - return ret - } - return *o.Modified -} - -// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetModifiedOk() (*int32, bool) { - if o == nil || o.Modified == nil { - return nil, false - } - return o.Modified, true -} - -// HasModified returns a boolean if a field has been set. -func (o *MonitorType) HasModified() bool { - if o != nil && o.Modified != nil { - return true - } - - return false -} - -// SetModified gets a reference to the given int32 and assigns it to the Modified field. -func (o *MonitorType) SetModified(v int32) { - o.Modified = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *MonitorType) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *MonitorType) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *MonitorType) SetName(v string) { - o.Name = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *MonitorType) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *MonitorType) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *MonitorType) SetQuery(v string) { - o.Query = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *MonitorType) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *MonitorType) GetTagsOk() (*[]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 *MonitorType) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *MonitorType) SetTags(v []string) { - o.Tags = v -} - -// GetTemplatedName returns the TemplatedName field value if set, zero value otherwise. -func (o *MonitorType) GetTemplatedName() string { - if o == nil || o.TemplatedName == nil { - var ret string - return ret - } - return *o.TemplatedName -} - -// GetTemplatedNameOk returns a tuple with the TemplatedName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetTemplatedNameOk() (*string, bool) { - if o == nil || o.TemplatedName == nil { - return nil, false - } - return o.TemplatedName, true -} - -// HasTemplatedName returns a boolean if a field has been set. -func (o *MonitorType) HasTemplatedName() bool { - if o != nil && o.TemplatedName != nil { - return true - } - - return false -} - -// SetTemplatedName gets a reference to the given string and assigns it to the TemplatedName field. -func (o *MonitorType) SetTemplatedName(v string) { - o.TemplatedName = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *MonitorType) GetType() string { - if o == nil || o.Type == nil { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MonitorType) GetTypeOk() (*string, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *MonitorType) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *MonitorType) SetType(v string) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o MonitorType) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.GroupStatus != nil { - toSerialize["group_status"] = o.GroupStatus - } - if o.Groups != nil { - toSerialize["groups"] = o.Groups - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Modified != nil { - toSerialize["modified"] = o.Modified - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.TemplatedName != nil { - toSerialize["templated_name"] = o.TemplatedName - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *MonitorType) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *int32 `json:"created_at,omitempty"` - GroupStatus *int32 `json:"group_status,omitempty"` - Groups []string `json:"groups,omitempty"` - Id *int32 `json:"id,omitempty"` - Message *string `json:"message,omitempty"` - Modified *int32 `json:"modified,omitempty"` - Name *string `json:"name,omitempty"` - Query *string `json:"query,omitempty"` - Tags []string `json:"tags,omitempty"` - TemplatedName *string `json:"templated_name,omitempty"` - Type *string `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.GroupStatus = all.GroupStatus - o.Groups = all.Groups - o.Id = all.Id - o.Message = all.Message - o.Modified = all.Modified - o.Name = all.Name - o.Query = all.Query - o.Tags = all.Tags - o.TemplatedName = all.TemplatedName - o.Type = all.Type - return nil -} - -// NullableMonitorType handles when a null is used for MonitorType. -type NullableMonitorType struct { - value *MonitorType - isSet bool -} - -// Get returns the associated value. -func (v NullableMonitorType) Get() *MonitorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableMonitorType) Set(val *MonitorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableMonitorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableMonitorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableMonitorType initializes the struct as if Set has been called. -func NewNullableMonitorType(val *MonitorType) *NullableMonitorType { - return &NullableMonitorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableMonitorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableMonitorType) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_nullable_relationship_to_user.go b/api/v2/datadog/model_nullable_relationship_to_user.go deleted file mode 100644 index 16359626482..00000000000 --- a/api/v2/datadog/model_nullable_relationship_to_user.go +++ /dev/null @@ -1,105 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NullableRelationshipToUser Relationship to user. -type NullableRelationshipToUser struct { - // Relationship to user object. - Data NullableNullableRelationshipToUserData `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{} -} - -// NewNullableRelationshipToUser instantiates a new NullableRelationshipToUser 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 NewNullableRelationshipToUser(data NullableNullableRelationshipToUserData) *NullableRelationshipToUser { - this := NullableRelationshipToUser{} - this.Data = data - return &this -} - -// NewNullableRelationshipToUserWithDefaults instantiates a new NullableRelationshipToUser 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 NewNullableRelationshipToUserWithDefaults() *NullableRelationshipToUser { - this := NullableRelationshipToUser{} - return &this -} - -// GetData returns the Data field value. -// If the value is explicit nil, the zero value for NullableRelationshipToUserData will be returned. -func (o *NullableRelationshipToUser) GetData() NullableRelationshipToUserData { - if o == nil || o.Data.Get() == nil { - var ret NullableRelationshipToUserData - return ret - } - return *o.Data.Get() -} - -// GetDataOk returns a tuple with the Data field value -// 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 *NullableRelationshipToUser) GetDataOk() (*NullableRelationshipToUserData, bool) { - if o == nil { - return nil, false - } - return o.Data.Get(), o.Data.IsSet() -} - -// SetData sets field value. -func (o *NullableRelationshipToUser) SetData(v NullableRelationshipToUserData) { - o.Data.Set(&v) -} - -// MarshalJSON serializes the struct using spec logic. -func (o NullableRelationshipToUser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data.Get() - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NullableRelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data NullableNullableRelationshipToUserData `json:"data"` - }{} - all := struct { - Data NullableNullableRelationshipToUserData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if !required.Data.IsSet() { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_nullable_relationship_to_user_data.go b/api/v2/datadog/model_nullable_relationship_to_user_data.go deleted file mode 100644 index e5cbd09d960..00000000000 --- a/api/v2/datadog/model_nullable_relationship_to_user_data.go +++ /dev/null @@ -1,196 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// NullableRelationshipToUserData Relationship to user object. -type NullableRelationshipToUserData struct { - // A unique identifier that represents the user. - Id string `json:"id"` - // Users resource type. - Type UsersType `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{} -} - -// NewNullableRelationshipToUserData instantiates a new NullableRelationshipToUserData 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 NewNullableRelationshipToUserData(id string, typeVar UsersType) *NullableRelationshipToUserData { - this := NullableRelationshipToUserData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewNullableRelationshipToUserDataWithDefaults instantiates a new NullableRelationshipToUserData 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 NewNullableRelationshipToUserDataWithDefaults() *NullableRelationshipToUserData { - this := NullableRelationshipToUserData{} - var typeVar UsersType = USERSTYPE_USERS - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *NullableRelationshipToUserData) 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 *NullableRelationshipToUserData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *NullableRelationshipToUserData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *NullableRelationshipToUserData) GetType() UsersType { - if o == nil { - var ret UsersType - 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 *NullableRelationshipToUserData) GetTypeOk() (*UsersType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NullableRelationshipToUserData) SetType(v UsersType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NullableRelationshipToUserData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NullableRelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *UsersType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} - -// NullableNullableRelationshipToUserData handles when a null is used for NullableRelationshipToUserData. -type NullableNullableRelationshipToUserData struct { - value *NullableRelationshipToUserData - isSet bool -} - -// Get returns the associated value. -func (v NullableNullableRelationshipToUserData) Get() *NullableRelationshipToUserData { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableNullableRelationshipToUserData) Set(val *NullableRelationshipToUserData) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableNullableRelationshipToUserData) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableNullableRelationshipToUserData) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableNullableRelationshipToUserData initializes the struct as if Set has been called. -func NewNullableNullableRelationshipToUserData(val *NullableRelationshipToUserData) *NullableNullableRelationshipToUserData { - return &NullableNullableRelationshipToUserData{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableNullableRelationshipToUserData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableNullableRelationshipToUserData) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_opsgenie_service_create_attributes.go b/api/v2/datadog/model_opsgenie_service_create_attributes.go deleted file mode 100644 index f6048d7d478..00000000000 --- a/api/v2/datadog/model_opsgenie_service_create_attributes.go +++ /dev/null @@ -1,216 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceCreateAttributes The Opsgenie service attributes for a create request. -type OpsgenieServiceCreateAttributes struct { - // The custom URL for a custom region. - CustomUrl *string `json:"custom_url,omitempty"` - // The name for the Opsgenie service. - Name string `json:"name"` - // The Opsgenie API key for your Opsgenie service. - OpsgenieApiKey string `json:"opsgenie_api_key"` - // The region for the Opsgenie service. - Region OpsgenieServiceRegionType `json:"region"` - // 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{} -} - -// NewOpsgenieServiceCreateAttributes instantiates a new OpsgenieServiceCreateAttributes 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 NewOpsgenieServiceCreateAttributes(name string, opsgenieApiKey string, region OpsgenieServiceRegionType) *OpsgenieServiceCreateAttributes { - this := OpsgenieServiceCreateAttributes{} - this.Name = name - this.OpsgenieApiKey = opsgenieApiKey - this.Region = region - return &this -} - -// NewOpsgenieServiceCreateAttributesWithDefaults instantiates a new OpsgenieServiceCreateAttributes 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 NewOpsgenieServiceCreateAttributesWithDefaults() *OpsgenieServiceCreateAttributes { - this := OpsgenieServiceCreateAttributes{} - return &this -} - -// GetCustomUrl returns the CustomUrl field value if set, zero value otherwise. -func (o *OpsgenieServiceCreateAttributes) GetCustomUrl() string { - if o == nil || o.CustomUrl == nil { - var ret string - return ret - } - return *o.CustomUrl -} - -// GetCustomUrlOk returns a tuple with the CustomUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceCreateAttributes) GetCustomUrlOk() (*string, bool) { - if o == nil || o.CustomUrl == nil { - return nil, false - } - return o.CustomUrl, true -} - -// HasCustomUrl returns a boolean if a field has been set. -func (o *OpsgenieServiceCreateAttributes) HasCustomUrl() bool { - if o != nil && o.CustomUrl != nil { - return true - } - - return false -} - -// SetCustomUrl gets a reference to the given string and assigns it to the CustomUrl field. -func (o *OpsgenieServiceCreateAttributes) SetCustomUrl(v string) { - o.CustomUrl = &v -} - -// GetName returns the Name field value. -func (o *OpsgenieServiceCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *OpsgenieServiceCreateAttributes) SetName(v string) { - o.Name = v -} - -// GetOpsgenieApiKey returns the OpsgenieApiKey field value. -func (o *OpsgenieServiceCreateAttributes) GetOpsgenieApiKey() string { - if o == nil { - var ret string - return ret - } - return o.OpsgenieApiKey -} - -// GetOpsgenieApiKeyOk returns a tuple with the OpsgenieApiKey field value -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceCreateAttributes) GetOpsgenieApiKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.OpsgenieApiKey, true -} - -// SetOpsgenieApiKey sets field value. -func (o *OpsgenieServiceCreateAttributes) SetOpsgenieApiKey(v string) { - o.OpsgenieApiKey = v -} - -// GetRegion returns the Region field value. -func (o *OpsgenieServiceCreateAttributes) GetRegion() OpsgenieServiceRegionType { - if o == nil { - var ret OpsgenieServiceRegionType - return ret - } - return o.Region -} - -// GetRegionOk returns a tuple with the Region field value -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceCreateAttributes) GetRegionOk() (*OpsgenieServiceRegionType, bool) { - if o == nil { - return nil, false - } - return &o.Region, true -} - -// SetRegion sets field value. -func (o *OpsgenieServiceCreateAttributes) SetRegion(v OpsgenieServiceRegionType) { - o.Region = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomUrl != nil { - toSerialize["custom_url"] = o.CustomUrl - } - toSerialize["name"] = o.Name - toSerialize["opsgenie_api_key"] = o.OpsgenieApiKey - toSerialize["region"] = o.Region - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - OpsgenieApiKey *string `json:"opsgenie_api_key"` - Region *OpsgenieServiceRegionType `json:"region"` - }{} - all := struct { - CustomUrl *string `json:"custom_url,omitempty"` - Name string `json:"name"` - OpsgenieApiKey string `json:"opsgenie_api_key"` - Region OpsgenieServiceRegionType `json:"region"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.OpsgenieApiKey == nil { - return fmt.Errorf("Required field opsgenie_api_key missing") - } - if required.Region == nil { - return fmt.Errorf("Required field region missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Region; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomUrl = all.CustomUrl - o.Name = all.Name - o.OpsgenieApiKey = all.OpsgenieApiKey - o.Region = all.Region - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_create_data.go b/api/v2/datadog/model_opsgenie_service_create_data.go deleted file mode 100644 index 19908a950ff..00000000000 --- a/api/v2/datadog/model_opsgenie_service_create_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceCreateData Opsgenie service data for a create request. -type OpsgenieServiceCreateData struct { - // The Opsgenie service attributes for a create request. - Attributes OpsgenieServiceCreateAttributes `json:"attributes"` - // Opsgenie service resource type. - Type OpsgenieServiceType `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{} -} - -// NewOpsgenieServiceCreateData instantiates a new OpsgenieServiceCreateData 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 NewOpsgenieServiceCreateData(attributes OpsgenieServiceCreateAttributes, typeVar OpsgenieServiceType) *OpsgenieServiceCreateData { - this := OpsgenieServiceCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewOpsgenieServiceCreateDataWithDefaults instantiates a new OpsgenieServiceCreateData 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 NewOpsgenieServiceCreateDataWithDefaults() *OpsgenieServiceCreateData { - this := OpsgenieServiceCreateData{} - var typeVar OpsgenieServiceType = OPSGENIESERVICETYPE_OPSGENIE_SERVICE - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *OpsgenieServiceCreateData) GetAttributes() OpsgenieServiceCreateAttributes { - if o == nil { - var ret OpsgenieServiceCreateAttributes - 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 *OpsgenieServiceCreateData) GetAttributesOk() (*OpsgenieServiceCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *OpsgenieServiceCreateData) SetAttributes(v OpsgenieServiceCreateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *OpsgenieServiceCreateData) GetType() OpsgenieServiceType { - if o == nil { - var ret OpsgenieServiceType - 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 *OpsgenieServiceCreateData) GetTypeOk() (*OpsgenieServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *OpsgenieServiceCreateData) SetType(v OpsgenieServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *OpsgenieServiceCreateAttributes `json:"attributes"` - Type *OpsgenieServiceType `json:"type"` - }{} - all := struct { - Attributes OpsgenieServiceCreateAttributes `json:"attributes"` - Type OpsgenieServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_create_request.go b/api/v2/datadog/model_opsgenie_service_create_request.go deleted file mode 100644 index 208ee0bb388..00000000000 --- a/api/v2/datadog/model_opsgenie_service_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceCreateRequest Create request for an Opsgenie service. -type OpsgenieServiceCreateRequest struct { - // Opsgenie service data for a create request. - Data OpsgenieServiceCreateData `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{} -} - -// NewOpsgenieServiceCreateRequest instantiates a new OpsgenieServiceCreateRequest 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 NewOpsgenieServiceCreateRequest(data OpsgenieServiceCreateData) *OpsgenieServiceCreateRequest { - this := OpsgenieServiceCreateRequest{} - this.Data = data - return &this -} - -// NewOpsgenieServiceCreateRequestWithDefaults instantiates a new OpsgenieServiceCreateRequest 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 NewOpsgenieServiceCreateRequestWithDefaults() *OpsgenieServiceCreateRequest { - this := OpsgenieServiceCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *OpsgenieServiceCreateRequest) GetData() OpsgenieServiceCreateData { - if o == nil { - var ret OpsgenieServiceCreateData - 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 *OpsgenieServiceCreateRequest) GetDataOk() (*OpsgenieServiceCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *OpsgenieServiceCreateRequest) SetData(v OpsgenieServiceCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *OpsgenieServiceCreateData `json:"data"` - }{} - all := struct { - Data OpsgenieServiceCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_region_type.go b/api/v2/datadog/model_opsgenie_service_region_type.go deleted file mode 100644 index dfd7db57d9c..00000000000 --- a/api/v2/datadog/model_opsgenie_service_region_type.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceRegionType The region for the Opsgenie service. -type OpsgenieServiceRegionType string - -// List of OpsgenieServiceRegionType. -const ( - OPSGENIESERVICEREGIONTYPE_US OpsgenieServiceRegionType = "us" - OPSGENIESERVICEREGIONTYPE_EU OpsgenieServiceRegionType = "eu" - OPSGENIESERVICEREGIONTYPE_CUSTOM OpsgenieServiceRegionType = "custom" -) - -var allowedOpsgenieServiceRegionTypeEnumValues = []OpsgenieServiceRegionType{ - OPSGENIESERVICEREGIONTYPE_US, - OPSGENIESERVICEREGIONTYPE_EU, - OPSGENIESERVICEREGIONTYPE_CUSTOM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *OpsgenieServiceRegionType) GetAllowedValues() []OpsgenieServiceRegionType { - return allowedOpsgenieServiceRegionTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *OpsgenieServiceRegionType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = OpsgenieServiceRegionType(value) - return nil -} - -// NewOpsgenieServiceRegionTypeFromValue returns a pointer to a valid OpsgenieServiceRegionType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewOpsgenieServiceRegionTypeFromValue(v string) (*OpsgenieServiceRegionType, error) { - ev := OpsgenieServiceRegionType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for OpsgenieServiceRegionType: valid values are %v", v, allowedOpsgenieServiceRegionTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v OpsgenieServiceRegionType) IsValid() bool { - for _, existing := range allowedOpsgenieServiceRegionTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to OpsgenieServiceRegionType value. -func (v OpsgenieServiceRegionType) Ptr() *OpsgenieServiceRegionType { - return &v -} - -// NullableOpsgenieServiceRegionType handles when a null is used for OpsgenieServiceRegionType. -type NullableOpsgenieServiceRegionType struct { - value *OpsgenieServiceRegionType - isSet bool -} - -// Get returns the associated value. -func (v NullableOpsgenieServiceRegionType) Get() *OpsgenieServiceRegionType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableOpsgenieServiceRegionType) Set(val *OpsgenieServiceRegionType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableOpsgenieServiceRegionType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableOpsgenieServiceRegionType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableOpsgenieServiceRegionType initializes the struct as if Set has been called. -func NewNullableOpsgenieServiceRegionType(val *OpsgenieServiceRegionType) *NullableOpsgenieServiceRegionType { - return &NullableOpsgenieServiceRegionType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableOpsgenieServiceRegionType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableOpsgenieServiceRegionType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_opsgenie_service_response.go b/api/v2/datadog/model_opsgenie_service_response.go deleted file mode 100644 index 3d94b5a6421..00000000000 --- a/api/v2/datadog/model_opsgenie_service_response.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceResponse Response of an Opsgenie service. -type OpsgenieServiceResponse struct { - // Opsgenie service data from a response. - Data OpsgenieServiceResponseData `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{} -} - -// NewOpsgenieServiceResponse instantiates a new OpsgenieServiceResponse 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 NewOpsgenieServiceResponse(data OpsgenieServiceResponseData) *OpsgenieServiceResponse { - this := OpsgenieServiceResponse{} - this.Data = data - return &this -} - -// NewOpsgenieServiceResponseWithDefaults instantiates a new OpsgenieServiceResponse 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 NewOpsgenieServiceResponseWithDefaults() *OpsgenieServiceResponse { - this := OpsgenieServiceResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *OpsgenieServiceResponse) GetData() OpsgenieServiceResponseData { - if o == nil { - var ret OpsgenieServiceResponseData - 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 *OpsgenieServiceResponse) GetDataOk() (*OpsgenieServiceResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *OpsgenieServiceResponse) SetData(v OpsgenieServiceResponseData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *OpsgenieServiceResponseData `json:"data"` - }{} - all := struct { - Data OpsgenieServiceResponseData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_response_attributes.go b/api/v2/datadog/model_opsgenie_service_response_attributes.go deleted file mode 100644 index 8675085df7d..00000000000 --- a/api/v2/datadog/model_opsgenie_service_response_attributes.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// OpsgenieServiceResponseAttributes The attributes from an Opsgenie service response. -type OpsgenieServiceResponseAttributes struct { - // The custom URL for a custom region. - CustomUrl common.NullableString `json:"custom_url,omitempty"` - // The name for the Opsgenie service. - Name *string `json:"name,omitempty"` - // The region for the Opsgenie service. - Region *OpsgenieServiceRegionType `json:"region,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{} -} - -// NewOpsgenieServiceResponseAttributes instantiates a new OpsgenieServiceResponseAttributes 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 NewOpsgenieServiceResponseAttributes() *OpsgenieServiceResponseAttributes { - this := OpsgenieServiceResponseAttributes{} - return &this -} - -// NewOpsgenieServiceResponseAttributesWithDefaults instantiates a new OpsgenieServiceResponseAttributes 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 NewOpsgenieServiceResponseAttributesWithDefaults() *OpsgenieServiceResponseAttributes { - this := OpsgenieServiceResponseAttributes{} - return &this -} - -// GetCustomUrl returns the CustomUrl field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *OpsgenieServiceResponseAttributes) GetCustomUrl() string { - if o == nil || o.CustomUrl.Get() == nil { - var ret string - return ret - } - return *o.CustomUrl.Get() -} - -// GetCustomUrlOk returns a tuple with the CustomUrl 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 *OpsgenieServiceResponseAttributes) GetCustomUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.CustomUrl.Get(), o.CustomUrl.IsSet() -} - -// HasCustomUrl returns a boolean if a field has been set. -func (o *OpsgenieServiceResponseAttributes) HasCustomUrl() bool { - if o != nil && o.CustomUrl.IsSet() { - return true - } - - return false -} - -// SetCustomUrl gets a reference to the given common.NullableString and assigns it to the CustomUrl field. -func (o *OpsgenieServiceResponseAttributes) SetCustomUrl(v string) { - o.CustomUrl.Set(&v) -} - -// SetCustomUrlNil sets the value for CustomUrl to be an explicit nil. -func (o *OpsgenieServiceResponseAttributes) SetCustomUrlNil() { - o.CustomUrl.Set(nil) -} - -// UnsetCustomUrl ensures that no value is present for CustomUrl, not even an explicit nil. -func (o *OpsgenieServiceResponseAttributes) UnsetCustomUrl() { - o.CustomUrl.Unset() -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *OpsgenieServiceResponseAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceResponseAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *OpsgenieServiceResponseAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *OpsgenieServiceResponseAttributes) SetName(v string) { - o.Name = &v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *OpsgenieServiceResponseAttributes) GetRegion() OpsgenieServiceRegionType { - if o == nil || o.Region == nil { - var ret OpsgenieServiceRegionType - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceResponseAttributes) GetRegionOk() (*OpsgenieServiceRegionType, bool) { - if o == nil || o.Region == nil { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *OpsgenieServiceResponseAttributes) HasRegion() bool { - if o != nil && o.Region != nil { - return true - } - - return false -} - -// SetRegion gets a reference to the given OpsgenieServiceRegionType and assigns it to the Region field. -func (o *OpsgenieServiceResponseAttributes) SetRegion(v OpsgenieServiceRegionType) { - o.Region = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceResponseAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomUrl.IsSet() { - toSerialize["custom_url"] = o.CustomUrl.Get() - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Region != nil { - toSerialize["region"] = o.Region - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CustomUrl common.NullableString `json:"custom_url,omitempty"` - Name *string `json:"name,omitempty"` - Region *OpsgenieServiceRegionType `json:"region,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Region; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomUrl = all.CustomUrl - o.Name = all.Name - o.Region = all.Region - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_response_data.go b/api/v2/datadog/model_opsgenie_service_response_data.go deleted file mode 100644 index f44165d2b7d..00000000000 --- a/api/v2/datadog/model_opsgenie_service_response_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceResponseData Opsgenie service data from a response. -type OpsgenieServiceResponseData struct { - // The attributes from an Opsgenie service response. - Attributes OpsgenieServiceResponseAttributes `json:"attributes"` - // The ID of the Opsgenie service. - Id string `json:"id"` - // Opsgenie service resource type. - Type OpsgenieServiceType `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{} -} - -// NewOpsgenieServiceResponseData instantiates a new OpsgenieServiceResponseData 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 NewOpsgenieServiceResponseData(attributes OpsgenieServiceResponseAttributes, id string, typeVar OpsgenieServiceType) *OpsgenieServiceResponseData { - this := OpsgenieServiceResponseData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewOpsgenieServiceResponseDataWithDefaults instantiates a new OpsgenieServiceResponseData 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 NewOpsgenieServiceResponseDataWithDefaults() *OpsgenieServiceResponseData { - this := OpsgenieServiceResponseData{} - var typeVar OpsgenieServiceType = OPSGENIESERVICETYPE_OPSGENIE_SERVICE - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *OpsgenieServiceResponseData) GetAttributes() OpsgenieServiceResponseAttributes { - if o == nil { - var ret OpsgenieServiceResponseAttributes - 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 *OpsgenieServiceResponseData) GetAttributesOk() (*OpsgenieServiceResponseAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *OpsgenieServiceResponseData) SetAttributes(v OpsgenieServiceResponseAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *OpsgenieServiceResponseData) 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 *OpsgenieServiceResponseData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *OpsgenieServiceResponseData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *OpsgenieServiceResponseData) GetType() OpsgenieServiceType { - if o == nil { - var ret OpsgenieServiceType - 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 *OpsgenieServiceResponseData) GetTypeOk() (*OpsgenieServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *OpsgenieServiceResponseData) SetType(v OpsgenieServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *OpsgenieServiceResponseAttributes `json:"attributes"` - Id *string `json:"id"` - Type *OpsgenieServiceType `json:"type"` - }{} - all := struct { - Attributes OpsgenieServiceResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type OpsgenieServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_type.go b/api/v2/datadog/model_opsgenie_service_type.go deleted file mode 100644 index 457177cc582..00000000000 --- a/api/v2/datadog/model_opsgenie_service_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceType Opsgenie service resource type. -type OpsgenieServiceType string - -// List of OpsgenieServiceType. -const ( - OPSGENIESERVICETYPE_OPSGENIE_SERVICE OpsgenieServiceType = "opsgenie-service" -) - -var allowedOpsgenieServiceTypeEnumValues = []OpsgenieServiceType{ - OPSGENIESERVICETYPE_OPSGENIE_SERVICE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *OpsgenieServiceType) GetAllowedValues() []OpsgenieServiceType { - return allowedOpsgenieServiceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *OpsgenieServiceType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = OpsgenieServiceType(value) - return nil -} - -// NewOpsgenieServiceTypeFromValue returns a pointer to a valid OpsgenieServiceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewOpsgenieServiceTypeFromValue(v string) (*OpsgenieServiceType, error) { - ev := OpsgenieServiceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for OpsgenieServiceType: valid values are %v", v, allowedOpsgenieServiceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v OpsgenieServiceType) IsValid() bool { - for _, existing := range allowedOpsgenieServiceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to OpsgenieServiceType value. -func (v OpsgenieServiceType) Ptr() *OpsgenieServiceType { - return &v -} - -// NullableOpsgenieServiceType handles when a null is used for OpsgenieServiceType. -type NullableOpsgenieServiceType struct { - value *OpsgenieServiceType - isSet bool -} - -// Get returns the associated value. -func (v NullableOpsgenieServiceType) Get() *OpsgenieServiceType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableOpsgenieServiceType) Set(val *OpsgenieServiceType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableOpsgenieServiceType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableOpsgenieServiceType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableOpsgenieServiceType initializes the struct as if Set has been called. -func NewNullableOpsgenieServiceType(val *OpsgenieServiceType) *NullableOpsgenieServiceType { - return &NullableOpsgenieServiceType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableOpsgenieServiceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableOpsgenieServiceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_opsgenie_service_update_attributes.go b/api/v2/datadog/model_opsgenie_service_update_attributes.go deleted file mode 100644 index 54476609e4e..00000000000 --- a/api/v2/datadog/model_opsgenie_service_update_attributes.go +++ /dev/null @@ -1,240 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// OpsgenieServiceUpdateAttributes The Opsgenie service attributes for an update request. -type OpsgenieServiceUpdateAttributes struct { - // The custom URL for a custom region. - CustomUrl common.NullableString `json:"custom_url,omitempty"` - // The name for the Opsgenie service. - Name *string `json:"name,omitempty"` - // The Opsgenie API key for your Opsgenie service. - OpsgenieApiKey *string `json:"opsgenie_api_key,omitempty"` - // The region for the Opsgenie service. - Region *OpsgenieServiceRegionType `json:"region,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{} -} - -// NewOpsgenieServiceUpdateAttributes instantiates a new OpsgenieServiceUpdateAttributes 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 NewOpsgenieServiceUpdateAttributes() *OpsgenieServiceUpdateAttributes { - this := OpsgenieServiceUpdateAttributes{} - return &this -} - -// NewOpsgenieServiceUpdateAttributesWithDefaults instantiates a new OpsgenieServiceUpdateAttributes 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 NewOpsgenieServiceUpdateAttributesWithDefaults() *OpsgenieServiceUpdateAttributes { - this := OpsgenieServiceUpdateAttributes{} - return &this -} - -// GetCustomUrl returns the CustomUrl field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *OpsgenieServiceUpdateAttributes) GetCustomUrl() string { - if o == nil || o.CustomUrl.Get() == nil { - var ret string - return ret - } - return *o.CustomUrl.Get() -} - -// GetCustomUrlOk returns a tuple with the CustomUrl 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 *OpsgenieServiceUpdateAttributes) GetCustomUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.CustomUrl.Get(), o.CustomUrl.IsSet() -} - -// HasCustomUrl returns a boolean if a field has been set. -func (o *OpsgenieServiceUpdateAttributes) HasCustomUrl() bool { - if o != nil && o.CustomUrl.IsSet() { - return true - } - - return false -} - -// SetCustomUrl gets a reference to the given common.NullableString and assigns it to the CustomUrl field. -func (o *OpsgenieServiceUpdateAttributes) SetCustomUrl(v string) { - o.CustomUrl.Set(&v) -} - -// SetCustomUrlNil sets the value for CustomUrl to be an explicit nil. -func (o *OpsgenieServiceUpdateAttributes) SetCustomUrlNil() { - o.CustomUrl.Set(nil) -} - -// UnsetCustomUrl ensures that no value is present for CustomUrl, not even an explicit nil. -func (o *OpsgenieServiceUpdateAttributes) UnsetCustomUrl() { - o.CustomUrl.Unset() -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *OpsgenieServiceUpdateAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *OpsgenieServiceUpdateAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *OpsgenieServiceUpdateAttributes) SetName(v string) { - o.Name = &v -} - -// GetOpsgenieApiKey returns the OpsgenieApiKey field value if set, zero value otherwise. -func (o *OpsgenieServiceUpdateAttributes) GetOpsgenieApiKey() string { - if o == nil || o.OpsgenieApiKey == nil { - var ret string - return ret - } - return *o.OpsgenieApiKey -} - -// GetOpsgenieApiKeyOk returns a tuple with the OpsgenieApiKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceUpdateAttributes) GetOpsgenieApiKeyOk() (*string, bool) { - if o == nil || o.OpsgenieApiKey == nil { - return nil, false - } - return o.OpsgenieApiKey, true -} - -// HasOpsgenieApiKey returns a boolean if a field has been set. -func (o *OpsgenieServiceUpdateAttributes) HasOpsgenieApiKey() bool { - if o != nil && o.OpsgenieApiKey != nil { - return true - } - - return false -} - -// SetOpsgenieApiKey gets a reference to the given string and assigns it to the OpsgenieApiKey field. -func (o *OpsgenieServiceUpdateAttributes) SetOpsgenieApiKey(v string) { - o.OpsgenieApiKey = &v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *OpsgenieServiceUpdateAttributes) GetRegion() OpsgenieServiceRegionType { - if o == nil || o.Region == nil { - var ret OpsgenieServiceRegionType - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OpsgenieServiceUpdateAttributes) GetRegionOk() (*OpsgenieServiceRegionType, bool) { - if o == nil || o.Region == nil { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *OpsgenieServiceUpdateAttributes) HasRegion() bool { - if o != nil && o.Region != nil { - return true - } - - return false -} - -// SetRegion gets a reference to the given OpsgenieServiceRegionType and assigns it to the Region field. -func (o *OpsgenieServiceUpdateAttributes) SetRegion(v OpsgenieServiceRegionType) { - o.Region = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CustomUrl.IsSet() { - toSerialize["custom_url"] = o.CustomUrl.Get() - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.OpsgenieApiKey != nil { - toSerialize["opsgenie_api_key"] = o.OpsgenieApiKey - } - if o.Region != nil { - toSerialize["region"] = o.Region - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CustomUrl common.NullableString `json:"custom_url,omitempty"` - Name *string `json:"name,omitempty"` - OpsgenieApiKey *string `json:"opsgenie_api_key,omitempty"` - Region *OpsgenieServiceRegionType `json:"region,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Region; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CustomUrl = all.CustomUrl - o.Name = all.Name - o.OpsgenieApiKey = all.OpsgenieApiKey - o.Region = all.Region - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_update_data.go b/api/v2/datadog/model_opsgenie_service_update_data.go deleted file mode 100644 index 455e81d528a..00000000000 --- a/api/v2/datadog/model_opsgenie_service_update_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceUpdateData Opsgenie service for an update request. -type OpsgenieServiceUpdateData struct { - // The Opsgenie service attributes for an update request. - Attributes OpsgenieServiceUpdateAttributes `json:"attributes"` - // The ID of the Opsgenie service. - Id string `json:"id"` - // Opsgenie service resource type. - Type OpsgenieServiceType `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{} -} - -// NewOpsgenieServiceUpdateData instantiates a new OpsgenieServiceUpdateData 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 NewOpsgenieServiceUpdateData(attributes OpsgenieServiceUpdateAttributes, id string, typeVar OpsgenieServiceType) *OpsgenieServiceUpdateData { - this := OpsgenieServiceUpdateData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewOpsgenieServiceUpdateDataWithDefaults instantiates a new OpsgenieServiceUpdateData 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 NewOpsgenieServiceUpdateDataWithDefaults() *OpsgenieServiceUpdateData { - this := OpsgenieServiceUpdateData{} - var typeVar OpsgenieServiceType = OPSGENIESERVICETYPE_OPSGENIE_SERVICE - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *OpsgenieServiceUpdateData) GetAttributes() OpsgenieServiceUpdateAttributes { - if o == nil { - var ret OpsgenieServiceUpdateAttributes - 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 *OpsgenieServiceUpdateData) GetAttributesOk() (*OpsgenieServiceUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *OpsgenieServiceUpdateData) SetAttributes(v OpsgenieServiceUpdateAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *OpsgenieServiceUpdateData) 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 *OpsgenieServiceUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *OpsgenieServiceUpdateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *OpsgenieServiceUpdateData) GetType() OpsgenieServiceType { - if o == nil { - var ret OpsgenieServiceType - 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 *OpsgenieServiceUpdateData) GetTypeOk() (*OpsgenieServiceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *OpsgenieServiceUpdateData) SetType(v OpsgenieServiceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *OpsgenieServiceUpdateAttributes `json:"attributes"` - Id *string `json:"id"` - Type *OpsgenieServiceType `json:"type"` - }{} - all := struct { - Attributes OpsgenieServiceUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type OpsgenieServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_opsgenie_service_update_request.go b/api/v2/datadog/model_opsgenie_service_update_request.go deleted file mode 100644 index 9690b551813..00000000000 --- a/api/v2/datadog/model_opsgenie_service_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServiceUpdateRequest Update request for an Opsgenie service. -type OpsgenieServiceUpdateRequest struct { - // Opsgenie service for an update request. - Data OpsgenieServiceUpdateData `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{} -} - -// NewOpsgenieServiceUpdateRequest instantiates a new OpsgenieServiceUpdateRequest 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 NewOpsgenieServiceUpdateRequest(data OpsgenieServiceUpdateData) *OpsgenieServiceUpdateRequest { - this := OpsgenieServiceUpdateRequest{} - this.Data = data - return &this -} - -// NewOpsgenieServiceUpdateRequestWithDefaults instantiates a new OpsgenieServiceUpdateRequest 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 NewOpsgenieServiceUpdateRequestWithDefaults() *OpsgenieServiceUpdateRequest { - this := OpsgenieServiceUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *OpsgenieServiceUpdateRequest) GetData() OpsgenieServiceUpdateData { - if o == nil { - var ret OpsgenieServiceUpdateData - 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 *OpsgenieServiceUpdateRequest) GetDataOk() (*OpsgenieServiceUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *OpsgenieServiceUpdateRequest) SetData(v OpsgenieServiceUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServiceUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *OpsgenieServiceUpdateData `json:"data"` - }{} - all := struct { - Data OpsgenieServiceUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_opsgenie_services_response.go b/api/v2/datadog/model_opsgenie_services_response.go deleted file mode 100644 index 6de00e4b122..00000000000 --- a/api/v2/datadog/model_opsgenie_services_response.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OpsgenieServicesResponse Response with a list of Opsgenie services. -type OpsgenieServicesResponse struct { - // An array of Opsgenie services. - Data []OpsgenieServiceResponseData `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{} -} - -// NewOpsgenieServicesResponse instantiates a new OpsgenieServicesResponse 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 NewOpsgenieServicesResponse(data []OpsgenieServiceResponseData) *OpsgenieServicesResponse { - this := OpsgenieServicesResponse{} - this.Data = data - return &this -} - -// NewOpsgenieServicesResponseWithDefaults instantiates a new OpsgenieServicesResponse 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 NewOpsgenieServicesResponseWithDefaults() *OpsgenieServicesResponse { - this := OpsgenieServicesResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *OpsgenieServicesResponse) GetData() []OpsgenieServiceResponseData { - if o == nil { - var ret []OpsgenieServiceResponseData - 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 *OpsgenieServicesResponse) GetDataOk() (*[]OpsgenieServiceResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *OpsgenieServicesResponse) SetData(v []OpsgenieServiceResponseData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OpsgenieServicesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OpsgenieServicesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]OpsgenieServiceResponseData `json:"data"` - }{} - all := struct { - Data []OpsgenieServiceResponseData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_organization.go b/api/v2/datadog/model_organization.go deleted file mode 100644 index 335ccea0f97..00000000000 --- a/api/v2/datadog/model_organization.go +++ /dev/null @@ -1,198 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// Organization Organization object. -type Organization struct { - // Attributes of the organization. - Attributes *OrganizationAttributes `json:"attributes,omitempty"` - // ID of the organization. - Id *string `json:"id,omitempty"` - // Organizations resource type. - Type OrganizationsType `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{} -} - -// NewOrganization instantiates a new Organization 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 NewOrganization(typeVar OrganizationsType) *Organization { - this := Organization{} - this.Type = typeVar - return &this -} - -// NewOrganizationWithDefaults instantiates a new Organization 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 NewOrganizationWithDefaults() *Organization { - this := Organization{} - var typeVar OrganizationsType = ORGANIZATIONSTYPE_ORGS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *Organization) GetAttributes() OrganizationAttributes { - if o == nil || o.Attributes == nil { - var ret OrganizationAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetAttributesOk() (*OrganizationAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *Organization) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given OrganizationAttributes and assigns it to the Attributes field. -func (o *Organization) SetAttributes(v OrganizationAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Organization) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Organization) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Organization) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Organization) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value. -func (o *Organization) GetType() OrganizationsType { - if o == nil { - var ret OrganizationsType - 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 *Organization) GetTypeOk() (*OrganizationsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *Organization) SetType(v OrganizationsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Organization) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *OrganizationsType `json:"type"` - }{} - all := struct { - Attributes *OrganizationAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type OrganizationsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_organization_attributes.go b/api/v2/datadog/model_organization_attributes.go deleted file mode 100644 index 586514d147b..00000000000 --- a/api/v2/datadog/model_organization_attributes.go +++ /dev/null @@ -1,384 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// OrganizationAttributes Attributes of the organization. -type OrganizationAttributes struct { - // Creation time of the organization. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Description of the organization. - Description *string `json:"description,omitempty"` - // Whether or not the organization is disabled. - Disabled *bool `json:"disabled,omitempty"` - // Time of last organization modification. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // Name of the organization. - Name *string `json:"name,omitempty"` - // Public ID of the organization. - PublicId *string `json:"public_id,omitempty"` - // Sharing type of the organization. - Sharing *string `json:"sharing,omitempty"` - // URL of the site that this organization exists at. - Url *string `json:"url,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{} -} - -// NewOrganizationAttributes instantiates a new OrganizationAttributes 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 NewOrganizationAttributes() *OrganizationAttributes { - this := OrganizationAttributes{} - return &this -} - -// NewOrganizationAttributesWithDefaults instantiates a new OrganizationAttributes 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 NewOrganizationAttributesWithDefaults() *OrganizationAttributes { - this := OrganizationAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *OrganizationAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *OrganizationAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetDisabled returns the Disabled field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetDisabled() bool { - if o == nil || o.Disabled == nil { - var ret bool - return ret - } - return *o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetDisabledOk() (*bool, bool) { - if o == nil || o.Disabled == nil { - return nil, false - } - return o.Disabled, true -} - -// HasDisabled returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasDisabled() bool { - if o != nil && o.Disabled != nil { - return true - } - - return false -} - -// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. -func (o *OrganizationAttributes) SetDisabled(v bool) { - o.Disabled = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *OrganizationAttributes) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *OrganizationAttributes) SetName(v string) { - o.Name = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *OrganizationAttributes) SetPublicId(v string) { - o.PublicId = &v -} - -// GetSharing returns the Sharing field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetSharing() string { - if o == nil || o.Sharing == nil { - var ret string - return ret - } - return *o.Sharing -} - -// GetSharingOk returns a tuple with the Sharing field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetSharingOk() (*string, bool) { - if o == nil || o.Sharing == nil { - return nil, false - } - return o.Sharing, true -} - -// HasSharing returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasSharing() bool { - if o != nil && o.Sharing != nil { - return true - } - - return false -} - -// SetSharing gets a reference to the given string and assigns it to the Sharing field. -func (o *OrganizationAttributes) SetSharing(v string) { - o.Sharing = &v -} - -// GetUrl returns the Url field value if set, zero value otherwise. -func (o *OrganizationAttributes) GetUrl() string { - if o == nil || o.Url == nil { - var ret string - return ret - } - return *o.Url -} - -// GetUrlOk returns a tuple with the Url field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *OrganizationAttributes) GetUrlOk() (*string, bool) { - if o == nil || o.Url == nil { - return nil, false - } - return o.Url, true -} - -// HasUrl returns a boolean if a field has been set. -func (o *OrganizationAttributes) HasUrl() bool { - if o != nil && o.Url != nil { - return true - } - - return false -} - -// SetUrl gets a reference to the given string and assigns it to the Url field. -func (o *OrganizationAttributes) SetUrl(v string) { - o.Url = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o OrganizationAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.Disabled != nil { - toSerialize["disabled"] = o.Disabled - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Sharing != nil { - toSerialize["sharing"] = o.Sharing - } - if o.Url != nil { - toSerialize["url"] = o.Url - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *OrganizationAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - Description *string `json:"description,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name *string `json:"name,omitempty"` - PublicId *string `json:"public_id,omitempty"` - Sharing *string `json:"sharing,omitempty"` - Url *string `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.Description = all.Description - o.Disabled = all.Disabled - o.ModifiedAt = all.ModifiedAt - o.Name = all.Name - o.PublicId = all.PublicId - o.Sharing = all.Sharing - o.Url = all.Url - return nil -} diff --git a/api/v2/datadog/model_organizations_type.go b/api/v2/datadog/model_organizations_type.go deleted file mode 100644 index fbe74f68a70..00000000000 --- a/api/v2/datadog/model_organizations_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// OrganizationsType Organizations resource type. -type OrganizationsType string - -// List of OrganizationsType. -const ( - ORGANIZATIONSTYPE_ORGS OrganizationsType = "orgs" -) - -var allowedOrganizationsTypeEnumValues = []OrganizationsType{ - ORGANIZATIONSTYPE_ORGS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *OrganizationsType) GetAllowedValues() []OrganizationsType { - return allowedOrganizationsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *OrganizationsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = OrganizationsType(value) - return nil -} - -// NewOrganizationsTypeFromValue returns a pointer to a valid OrganizationsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewOrganizationsTypeFromValue(v string) (*OrganizationsType, error) { - ev := OrganizationsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for OrganizationsType: valid values are %v", v, allowedOrganizationsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v OrganizationsType) IsValid() bool { - for _, existing := range allowedOrganizationsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to OrganizationsType value. -func (v OrganizationsType) Ptr() *OrganizationsType { - return &v -} - -// NullableOrganizationsType handles when a null is used for OrganizationsType. -type NullableOrganizationsType struct { - value *OrganizationsType - isSet bool -} - -// Get returns the associated value. -func (v NullableOrganizationsType) Get() *OrganizationsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableOrganizationsType) Set(val *OrganizationsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableOrganizationsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableOrganizationsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableOrganizationsType initializes the struct as if Set has been called. -func NewNullableOrganizationsType(val *OrganizationsType) *NullableOrganizationsType { - return &NullableOrganizationsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableOrganizationsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableOrganizationsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_pagination.go b/api/v2/datadog/model_pagination.go deleted file mode 100644 index 8993857c687..00000000000 --- a/api/v2/datadog/model_pagination.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// Pagination Pagination object. -type Pagination struct { - // Total count. - TotalCount *int64 `json:"total_count,omitempty"` - // Total count of elements matched by the filter. - 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{} -} - -// NewPagination instantiates a new Pagination 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 NewPagination() *Pagination { - this := Pagination{} - return &this -} - -// NewPaginationWithDefaults instantiates a new Pagination 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 NewPaginationWithDefaults() *Pagination { - this := Pagination{} - return &this -} - -// GetTotalCount returns the TotalCount field value if set, zero value otherwise. -func (o *Pagination) GetTotalCount() int64 { - if o == nil || o.TotalCount == nil { - var ret int64 - return ret - } - return *o.TotalCount -} - -// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Pagination) GetTotalCountOk() (*int64, bool) { - if o == nil || o.TotalCount == nil { - return nil, false - } - return o.TotalCount, true -} - -// HasTotalCount returns a boolean if a field has been set. -func (o *Pagination) HasTotalCount() bool { - if o != nil && o.TotalCount != nil { - return true - } - - return false -} - -// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. -func (o *Pagination) SetTotalCount(v int64) { - o.TotalCount = &v -} - -// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. -func (o *Pagination) 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 *Pagination) 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 *Pagination) HasTotalFilteredCount() bool { - if o != nil && o.TotalFilteredCount != nil { - return true - } - - return false -} - -// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. -func (o *Pagination) SetTotalFilteredCount(v int64) { - o.TotalFilteredCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Pagination) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TotalCount != nil { - toSerialize["total_count"] = o.TotalCount - } - if o.TotalFilteredCount != nil { - toSerialize["total_filtered_count"] = o.TotalFilteredCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TotalCount *int64 `json:"total_count,omitempty"` - TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TotalCount = all.TotalCount - o.TotalFilteredCount = all.TotalFilteredCount - return nil -} diff --git a/api/v2/datadog/model_partial_api_key.go b/api/v2/datadog/model_partial_api_key.go deleted file mode 100644 index f7c1adf8694..00000000000 --- a/api/v2/datadog/model_partial_api_key.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// PartialAPIKey Partial Datadog API key. -type PartialAPIKey struct { - // Attributes of a partial API key. - Attributes *PartialAPIKeyAttributes `json:"attributes,omitempty"` - // ID of the API key. - Id *string `json:"id,omitempty"` - // Resources related to the API key. - Relationships *APIKeyRelationships `json:"relationships,omitempty"` - // API Keys resource type. - Type *APIKeysType `json:"type,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{} -} - -// NewPartialAPIKey instantiates a new PartialAPIKey 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 NewPartialAPIKey() *PartialAPIKey { - this := PartialAPIKey{} - var typeVar APIKeysType = APIKEYSTYPE_API_KEYS - this.Type = &typeVar - return &this -} - -// NewPartialAPIKeyWithDefaults instantiates a new PartialAPIKey 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 NewPartialAPIKeyWithDefaults() *PartialAPIKey { - this := PartialAPIKey{} - var typeVar APIKeysType = APIKEYSTYPE_API_KEYS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *PartialAPIKey) GetAttributes() PartialAPIKeyAttributes { - if o == nil || o.Attributes == nil { - var ret PartialAPIKeyAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKey) GetAttributesOk() (*PartialAPIKeyAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *PartialAPIKey) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given PartialAPIKeyAttributes and assigns it to the Attributes field. -func (o *PartialAPIKey) SetAttributes(v PartialAPIKeyAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *PartialAPIKey) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKey) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *PartialAPIKey) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *PartialAPIKey) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *PartialAPIKey) GetRelationships() APIKeyRelationships { - if o == nil || o.Relationships == nil { - var ret APIKeyRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKey) GetRelationshipsOk() (*APIKeyRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *PartialAPIKey) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given APIKeyRelationships and assigns it to the Relationships field. -func (o *PartialAPIKey) SetRelationships(v APIKeyRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *PartialAPIKey) GetType() APIKeysType { - if o == nil || o.Type == nil { - var ret APIKeysType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKey) GetTypeOk() (*APIKeysType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *PartialAPIKey) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given APIKeysType and assigns it to the Type field. -func (o *PartialAPIKey) SetType(v APIKeysType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PartialAPIKey) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PartialAPIKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *PartialAPIKeyAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *APIKeyRelationships `json:"relationships,omitempty"` - Type *APIKeysType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_partial_api_key_attributes.go b/api/v2/datadog/model_partial_api_key_attributes.go deleted file mode 100644 index aede8b85ab0..00000000000 --- a/api/v2/datadog/model_partial_api_key_attributes.go +++ /dev/null @@ -1,219 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// PartialAPIKeyAttributes Attributes of a partial API key. -type PartialAPIKeyAttributes struct { - // Creation date of the API key. - CreatedAt *string `json:"created_at,omitempty"` - // The last four characters of the API key. - Last4 *string `json:"last4,omitempty"` - // Date the API key was last modified. - ModifiedAt *string `json:"modified_at,omitempty"` - // Name of the API key. - Name *string `json:"name,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{} -} - -// NewPartialAPIKeyAttributes instantiates a new PartialAPIKeyAttributes 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 NewPartialAPIKeyAttributes() *PartialAPIKeyAttributes { - this := PartialAPIKeyAttributes{} - return &this -} - -// NewPartialAPIKeyAttributesWithDefaults instantiates a new PartialAPIKeyAttributes 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 NewPartialAPIKeyAttributesWithDefaults() *PartialAPIKeyAttributes { - this := PartialAPIKeyAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *PartialAPIKeyAttributes) GetCreatedAt() string { - if o == nil || o.CreatedAt == nil { - var ret string - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKeyAttributes) GetCreatedAtOk() (*string, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *PartialAPIKeyAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. -func (o *PartialAPIKeyAttributes) SetCreatedAt(v string) { - o.CreatedAt = &v -} - -// GetLast4 returns the Last4 field value if set, zero value otherwise. -func (o *PartialAPIKeyAttributes) GetLast4() string { - if o == nil || o.Last4 == nil { - var ret string - return ret - } - return *o.Last4 -} - -// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKeyAttributes) GetLast4Ok() (*string, bool) { - if o == nil || o.Last4 == nil { - return nil, false - } - return o.Last4, true -} - -// HasLast4 returns a boolean if a field has been set. -func (o *PartialAPIKeyAttributes) HasLast4() bool { - if o != nil && o.Last4 != nil { - return true - } - - return false -} - -// SetLast4 gets a reference to the given string and assigns it to the Last4 field. -func (o *PartialAPIKeyAttributes) SetLast4(v string) { - o.Last4 = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *PartialAPIKeyAttributes) GetModifiedAt() string { - if o == nil || o.ModifiedAt == nil { - var ret string - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKeyAttributes) GetModifiedAtOk() (*string, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *PartialAPIKeyAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given string and assigns it to the ModifiedAt field. -func (o *PartialAPIKeyAttributes) SetModifiedAt(v string) { - o.ModifiedAt = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *PartialAPIKeyAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialAPIKeyAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *PartialAPIKeyAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *PartialAPIKeyAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PartialAPIKeyAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.Last4 != nil { - toSerialize["last4"] = o.Last4 - } - if o.ModifiedAt != nil { - toSerialize["modified_at"] = o.ModifiedAt - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PartialAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *string `json:"created_at,omitempty"` - Last4 *string `json:"last4,omitempty"` - ModifiedAt *string `json:"modified_at,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.Last4 = all.Last4 - o.ModifiedAt = all.ModifiedAt - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_partial_application_key.go b/api/v2/datadog/model_partial_application_key.go deleted file mode 100644 index 308f05296f4..00000000000 --- a/api/v2/datadog/model_partial_application_key.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// PartialApplicationKey Partial Datadog application key. -type PartialApplicationKey struct { - // Attributes of a partial application key. - Attributes *PartialApplicationKeyAttributes `json:"attributes,omitempty"` - // ID of the application key. - Id *string `json:"id,omitempty"` - // Resources related to the application key. - Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` - // Application Keys resource type. - Type *ApplicationKeysType `json:"type,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{} -} - -// NewPartialApplicationKey instantiates a new PartialApplicationKey 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 NewPartialApplicationKey() *PartialApplicationKey { - this := PartialApplicationKey{} - var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS - this.Type = &typeVar - return &this -} - -// NewPartialApplicationKeyWithDefaults instantiates a new PartialApplicationKey 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 NewPartialApplicationKeyWithDefaults() *PartialApplicationKey { - this := PartialApplicationKey{} - var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *PartialApplicationKey) GetAttributes() PartialApplicationKeyAttributes { - if o == nil || o.Attributes == nil { - var ret PartialApplicationKeyAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKey) GetAttributesOk() (*PartialApplicationKeyAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *PartialApplicationKey) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given PartialApplicationKeyAttributes and assigns it to the Attributes field. -func (o *PartialApplicationKey) SetAttributes(v PartialApplicationKeyAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *PartialApplicationKey) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKey) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *PartialApplicationKey) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *PartialApplicationKey) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *PartialApplicationKey) GetRelationships() ApplicationKeyRelationships { - if o == nil || o.Relationships == nil { - var ret ApplicationKeyRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKey) GetRelationshipsOk() (*ApplicationKeyRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *PartialApplicationKey) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given ApplicationKeyRelationships and assigns it to the Relationships field. -func (o *PartialApplicationKey) SetRelationships(v ApplicationKeyRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *PartialApplicationKey) GetType() ApplicationKeysType { - if o == nil || o.Type == nil { - var ret ApplicationKeysType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKey) GetTypeOk() (*ApplicationKeysType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *PartialApplicationKey) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given ApplicationKeysType and assigns it to the Type field. -func (o *PartialApplicationKey) SetType(v ApplicationKeysType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PartialApplicationKey) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PartialApplicationKey) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *PartialApplicationKeyAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` - Type *ApplicationKeysType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_partial_application_key_attributes.go b/api/v2/datadog/model_partial_application_key_attributes.go deleted file mode 100644 index d7210f69f64..00000000000 --- a/api/v2/datadog/model_partial_application_key_attributes.go +++ /dev/null @@ -1,220 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// PartialApplicationKeyAttributes Attributes of a partial application key. -type PartialApplicationKeyAttributes struct { - // Creation date of the application key. - CreatedAt *string `json:"created_at,omitempty"` - // The last four characters of the application key. - Last4 *string `json:"last4,omitempty"` - // Name of the application key. - Name *string `json:"name,omitempty"` - // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. - Scopes []string `json:"scopes,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{} -} - -// NewPartialApplicationKeyAttributes instantiates a new PartialApplicationKeyAttributes 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 NewPartialApplicationKeyAttributes() *PartialApplicationKeyAttributes { - this := PartialApplicationKeyAttributes{} - return &this -} - -// NewPartialApplicationKeyAttributesWithDefaults instantiates a new PartialApplicationKeyAttributes 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 NewPartialApplicationKeyAttributesWithDefaults() *PartialApplicationKeyAttributes { - this := PartialApplicationKeyAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *PartialApplicationKeyAttributes) GetCreatedAt() string { - if o == nil || o.CreatedAt == nil { - var ret string - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKeyAttributes) GetCreatedAtOk() (*string, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *PartialApplicationKeyAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. -func (o *PartialApplicationKeyAttributes) SetCreatedAt(v string) { - o.CreatedAt = &v -} - -// GetLast4 returns the Last4 field value if set, zero value otherwise. -func (o *PartialApplicationKeyAttributes) GetLast4() string { - if o == nil || o.Last4 == nil { - var ret string - return ret - } - return *o.Last4 -} - -// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKeyAttributes) GetLast4Ok() (*string, bool) { - if o == nil || o.Last4 == nil { - return nil, false - } - return o.Last4, true -} - -// HasLast4 returns a boolean if a field has been set. -func (o *PartialApplicationKeyAttributes) HasLast4() bool { - if o != nil && o.Last4 != nil { - return true - } - - return false -} - -// SetLast4 gets a reference to the given string and assigns it to the Last4 field. -func (o *PartialApplicationKeyAttributes) SetLast4(v string) { - o.Last4 = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *PartialApplicationKeyAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKeyAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *PartialApplicationKeyAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *PartialApplicationKeyAttributes) SetName(v string) { - o.Name = &v -} - -// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *PartialApplicationKeyAttributes) GetScopes() []string { - if o == nil { - var ret []string - return ret - } - return o.Scopes -} - -// GetScopesOk returns a tuple with the Scopes 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 *PartialApplicationKeyAttributes) GetScopesOk() (*[]string, bool) { - if o == nil || o.Scopes == nil { - return nil, false - } - return &o.Scopes, true -} - -// HasScopes returns a boolean if a field has been set. -func (o *PartialApplicationKeyAttributes) HasScopes() bool { - if o != nil && o.Scopes != nil { - return true - } - - return false -} - -// SetScopes gets a reference to the given []string and assigns it to the Scopes field. -func (o *PartialApplicationKeyAttributes) SetScopes(v []string) { - o.Scopes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PartialApplicationKeyAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.Last4 != nil { - toSerialize["last4"] = o.Last4 - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Scopes != nil { - toSerialize["scopes"] = o.Scopes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PartialApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *string `json:"created_at,omitempty"` - Last4 *string `json:"last4,omitempty"` - Name *string `json:"name,omitempty"` - Scopes []string `json:"scopes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.Last4 = all.Last4 - o.Name = all.Name - o.Scopes = all.Scopes - return nil -} diff --git a/api/v2/datadog/model_partial_application_key_response.go b/api/v2/datadog/model_partial_application_key_response.go deleted file mode 100644 index 3690c2698eb..00000000000 --- a/api/v2/datadog/model_partial_application_key_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// PartialApplicationKeyResponse Response for retrieving a partial application key. -type PartialApplicationKeyResponse struct { - // Partial Datadog application key. - Data *PartialApplicationKey `json:"data,omitempty"` - // Array of objects related to the application key. - Included []ApplicationKeyResponseIncludedItem `json:"included,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{} -} - -// NewPartialApplicationKeyResponse instantiates a new PartialApplicationKeyResponse 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 NewPartialApplicationKeyResponse() *PartialApplicationKeyResponse { - this := PartialApplicationKeyResponse{} - return &this -} - -// NewPartialApplicationKeyResponseWithDefaults instantiates a new PartialApplicationKeyResponse 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 NewPartialApplicationKeyResponseWithDefaults() *PartialApplicationKeyResponse { - this := PartialApplicationKeyResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *PartialApplicationKeyResponse) GetData() PartialApplicationKey { - if o == nil || o.Data == nil { - var ret PartialApplicationKey - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKeyResponse) GetDataOk() (*PartialApplicationKey, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *PartialApplicationKeyResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given PartialApplicationKey and assigns it to the Data field. -func (o *PartialApplicationKeyResponse) SetData(v PartialApplicationKey) { - o.Data = &v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *PartialApplicationKeyResponse) GetIncluded() []ApplicationKeyResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []ApplicationKeyResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PartialApplicationKeyResponse) GetIncludedOk() (*[]ApplicationKeyResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *PartialApplicationKeyResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []ApplicationKeyResponseIncludedItem and assigns it to the Included field. -func (o *PartialApplicationKeyResponse) SetIncluded(v []ApplicationKeyResponseIncludedItem) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PartialApplicationKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PartialApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *PartialApplicationKey `json:"data,omitempty"` - Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_permission.go b/api/v2/datadog/model_permission.go deleted file mode 100644 index d86328add47..00000000000 --- a/api/v2/datadog/model_permission.go +++ /dev/null @@ -1,198 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// Permission Permission object. -type Permission struct { - // Attributes of a permission. - Attributes *PermissionAttributes `json:"attributes,omitempty"` - // ID of the permission. - Id *string `json:"id,omitempty"` - // Permissions resource type. - Type PermissionsType `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{} -} - -// NewPermission instantiates a new Permission 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 NewPermission(typeVar PermissionsType) *Permission { - this := Permission{} - this.Type = typeVar - return &this -} - -// NewPermissionWithDefaults instantiates a new Permission 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 NewPermissionWithDefaults() *Permission { - this := Permission{} - var typeVar PermissionsType = PERMISSIONSTYPE_PERMISSIONS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *Permission) GetAttributes() PermissionAttributes { - if o == nil || o.Attributes == nil { - var ret PermissionAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Permission) GetAttributesOk() (*PermissionAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *Permission) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given PermissionAttributes and assigns it to the Attributes field. -func (o *Permission) SetAttributes(v PermissionAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Permission) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Permission) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Permission) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Permission) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value. -func (o *Permission) GetType() PermissionsType { - if o == nil { - var ret PermissionsType - 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 *Permission) GetTypeOk() (*PermissionsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *Permission) SetType(v PermissionsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Permission) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Permission) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *PermissionsType `json:"type"` - }{} - all := struct { - Attributes *PermissionAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type PermissionsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_permission_attributes.go b/api/v2/datadog/model_permission_attributes.go deleted file mode 100644 index d28f2c0d501..00000000000 --- a/api/v2/datadog/model_permission_attributes.go +++ /dev/null @@ -1,341 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// PermissionAttributes Attributes of a permission. -type PermissionAttributes struct { - // Creation time of the permission. - Created *time.Time `json:"created,omitempty"` - // Description of the permission. - Description *string `json:"description,omitempty"` - // Displayed name for the permission. - DisplayName *string `json:"display_name,omitempty"` - // Display type. - DisplayType *string `json:"display_type,omitempty"` - // Name of the permission group. - GroupName *string `json:"group_name,omitempty"` - // Name of the permission. - Name *string `json:"name,omitempty"` - // Whether or not the permission is restricted. - Restricted *bool `json:"restricted,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{} -} - -// NewPermissionAttributes instantiates a new PermissionAttributes 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 NewPermissionAttributes() *PermissionAttributes { - this := PermissionAttributes{} - return &this -} - -// NewPermissionAttributesWithDefaults instantiates a new PermissionAttributes 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 NewPermissionAttributesWithDefaults() *PermissionAttributes { - this := PermissionAttributes{} - return &this -} - -// GetCreated returns the Created field value if set, zero value otherwise. -func (o *PermissionAttributes) GetCreated() time.Time { - if o == nil || o.Created == nil { - var ret time.Time - return ret - } - return *o.Created -} - -// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionAttributes) GetCreatedOk() (*time.Time, bool) { - if o == nil || o.Created == nil { - return nil, false - } - return o.Created, true -} - -// HasCreated returns a boolean if a field has been set. -func (o *PermissionAttributes) HasCreated() bool { - if o != nil && o.Created != nil { - return true - } - - return false -} - -// SetCreated gets a reference to the given time.Time and assigns it to the Created field. -func (o *PermissionAttributes) SetCreated(v time.Time) { - o.Created = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *PermissionAttributes) GetDescription() string { - if o == nil || o.Description == nil { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionAttributes) GetDescriptionOk() (*string, bool) { - if o == nil || o.Description == nil { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *PermissionAttributes) HasDescription() bool { - if o != nil && o.Description != nil { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *PermissionAttributes) SetDescription(v string) { - o.Description = &v -} - -// GetDisplayName returns the DisplayName field value if set, zero value otherwise. -func (o *PermissionAttributes) GetDisplayName() string { - if o == nil || o.DisplayName == nil { - var ret string - return ret - } - return *o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionAttributes) GetDisplayNameOk() (*string, bool) { - if o == nil || o.DisplayName == nil { - return nil, false - } - return o.DisplayName, true -} - -// HasDisplayName returns a boolean if a field has been set. -func (o *PermissionAttributes) HasDisplayName() bool { - if o != nil && o.DisplayName != nil { - return true - } - - return false -} - -// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. -func (o *PermissionAttributes) SetDisplayName(v string) { - o.DisplayName = &v -} - -// GetDisplayType returns the DisplayType field value if set, zero value otherwise. -func (o *PermissionAttributes) GetDisplayType() string { - if o == nil || o.DisplayType == nil { - var ret string - return ret - } - return *o.DisplayType -} - -// GetDisplayTypeOk returns a tuple with the DisplayType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionAttributes) GetDisplayTypeOk() (*string, bool) { - if o == nil || o.DisplayType == nil { - return nil, false - } - return o.DisplayType, true -} - -// HasDisplayType returns a boolean if a field has been set. -func (o *PermissionAttributes) HasDisplayType() bool { - if o != nil && o.DisplayType != nil { - return true - } - - return false -} - -// SetDisplayType gets a reference to the given string and assigns it to the DisplayType field. -func (o *PermissionAttributes) SetDisplayType(v string) { - o.DisplayType = &v -} - -// GetGroupName returns the GroupName field value if set, zero value otherwise. -func (o *PermissionAttributes) GetGroupName() string { - if o == nil || o.GroupName == nil { - var ret string - return ret - } - return *o.GroupName -} - -// GetGroupNameOk returns a tuple with the GroupName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionAttributes) GetGroupNameOk() (*string, bool) { - if o == nil || o.GroupName == nil { - return nil, false - } - return o.GroupName, true -} - -// HasGroupName returns a boolean if a field has been set. -func (o *PermissionAttributes) HasGroupName() bool { - if o != nil && o.GroupName != nil { - return true - } - - return false -} - -// SetGroupName gets a reference to the given string and assigns it to the GroupName field. -func (o *PermissionAttributes) SetGroupName(v string) { - o.GroupName = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *PermissionAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *PermissionAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *PermissionAttributes) SetName(v string) { - o.Name = &v -} - -// GetRestricted returns the Restricted field value if set, zero value otherwise. -func (o *PermissionAttributes) GetRestricted() bool { - if o == nil || o.Restricted == nil { - var ret bool - return ret - } - return *o.Restricted -} - -// GetRestrictedOk returns a tuple with the Restricted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionAttributes) GetRestrictedOk() (*bool, bool) { - if o == nil || o.Restricted == nil { - return nil, false - } - return o.Restricted, true -} - -// HasRestricted returns a boolean if a field has been set. -func (o *PermissionAttributes) HasRestricted() bool { - if o != nil && o.Restricted != nil { - return true - } - - return false -} - -// SetRestricted gets a reference to the given bool and assigns it to the Restricted field. -func (o *PermissionAttributes) SetRestricted(v bool) { - o.Restricted = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PermissionAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Created != nil { - if o.Created.Nanosecond() == 0 { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Description != nil { - toSerialize["description"] = o.Description - } - if o.DisplayName != nil { - toSerialize["display_name"] = o.DisplayName - } - if o.DisplayType != nil { - toSerialize["display_type"] = o.DisplayType - } - if o.GroupName != nil { - toSerialize["group_name"] = o.GroupName - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Restricted != nil { - toSerialize["restricted"] = o.Restricted - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Created *time.Time `json:"created,omitempty"` - Description *string `json:"description,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - DisplayType *string `json:"display_type,omitempty"` - GroupName *string `json:"group_name,omitempty"` - Name *string `json:"name,omitempty"` - Restricted *bool `json:"restricted,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Created = all.Created - o.Description = all.Description - o.DisplayName = all.DisplayName - o.DisplayType = all.DisplayType - o.GroupName = all.GroupName - o.Name = all.Name - o.Restricted = all.Restricted - return nil -} diff --git a/api/v2/datadog/model_permissions_response.go b/api/v2/datadog/model_permissions_response.go deleted file mode 100644 index aa397f00e2b..00000000000 --- a/api/v2/datadog/model_permissions_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// PermissionsResponse Payload with API-returned permissions. -type PermissionsResponse struct { - // Array of permissions. - Data []Permission `json:"data,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{} -} - -// NewPermissionsResponse instantiates a new PermissionsResponse 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 NewPermissionsResponse() *PermissionsResponse { - this := PermissionsResponse{} - return &this -} - -// NewPermissionsResponseWithDefaults instantiates a new PermissionsResponse 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 NewPermissionsResponseWithDefaults() *PermissionsResponse { - this := PermissionsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *PermissionsResponse) GetData() []Permission { - if o == nil || o.Data == nil { - var ret []Permission - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *PermissionsResponse) GetDataOk() (*[]Permission, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *PermissionsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []Permission and assigns it to the Data field. -func (o *PermissionsResponse) SetData(v []Permission) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o PermissionsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *PermissionsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []Permission `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_permissions_type.go b/api/v2/datadog/model_permissions_type.go deleted file mode 100644 index d8597ce8384..00000000000 --- a/api/v2/datadog/model_permissions_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// PermissionsType Permissions resource type. -type PermissionsType string - -// List of PermissionsType. -const ( - PERMISSIONSTYPE_PERMISSIONS PermissionsType = "permissions" -) - -var allowedPermissionsTypeEnumValues = []PermissionsType{ - PERMISSIONSTYPE_PERMISSIONS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *PermissionsType) GetAllowedValues() []PermissionsType { - return allowedPermissionsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *PermissionsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = PermissionsType(value) - return nil -} - -// NewPermissionsTypeFromValue returns a pointer to a valid PermissionsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewPermissionsTypeFromValue(v string) (*PermissionsType, error) { - ev := PermissionsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for PermissionsType: valid values are %v", v, allowedPermissionsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v PermissionsType) IsValid() bool { - for _, existing := range allowedPermissionsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to PermissionsType value. -func (v PermissionsType) Ptr() *PermissionsType { - return &v -} - -// NullablePermissionsType handles when a null is used for PermissionsType. -type NullablePermissionsType struct { - value *PermissionsType - isSet bool -} - -// Get returns the associated value. -func (v NullablePermissionsType) Get() *PermissionsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullablePermissionsType) Set(val *PermissionsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullablePermissionsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullablePermissionsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullablePermissionsType initializes the struct as if Set has been called. -func NewNullablePermissionsType(val *PermissionsType) *NullablePermissionsType { - return &NullablePermissionsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullablePermissionsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullablePermissionsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_process_summaries_meta.go b/api/v2/datadog/model_process_summaries_meta.go deleted file mode 100644 index 07880b46b11..00000000000 --- a/api/v2/datadog/model_process_summaries_meta.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ProcessSummariesMeta Response metadata object. -type ProcessSummariesMeta struct { - // Paging attributes. - Page *ProcessSummariesMetaPage `json:"page,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{} -} - -// NewProcessSummariesMeta instantiates a new ProcessSummariesMeta 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 NewProcessSummariesMeta() *ProcessSummariesMeta { - this := ProcessSummariesMeta{} - return &this -} - -// NewProcessSummariesMetaWithDefaults instantiates a new ProcessSummariesMeta 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 NewProcessSummariesMetaWithDefaults() *ProcessSummariesMeta { - this := ProcessSummariesMeta{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *ProcessSummariesMeta) GetPage() ProcessSummariesMetaPage { - if o == nil || o.Page == nil { - var ret ProcessSummariesMetaPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummariesMeta) GetPageOk() (*ProcessSummariesMetaPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *ProcessSummariesMeta) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given ProcessSummariesMetaPage and assigns it to the Page field. -func (o *ProcessSummariesMeta) SetPage(v ProcessSummariesMetaPage) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ProcessSummariesMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ProcessSummariesMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *ProcessSummariesMetaPage `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v2/datadog/model_process_summaries_meta_page.go b/api/v2/datadog/model_process_summaries_meta_page.go deleted file mode 100644 index 5c578bd9118..00000000000 --- a/api/v2/datadog/model_process_summaries_meta_page.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ProcessSummariesMetaPage Paging attributes. -type ProcessSummariesMetaPage struct { - // The cursor used to get the next results, if any. To make the next request, use the same - // parameters with the addition of the `page[cursor]`. - After *string `json:"after,omitempty"` - // Number of results returned. - Size *int32 `json:"size,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{} -} - -// NewProcessSummariesMetaPage instantiates a new ProcessSummariesMetaPage 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 NewProcessSummariesMetaPage() *ProcessSummariesMetaPage { - this := ProcessSummariesMetaPage{} - return &this -} - -// NewProcessSummariesMetaPageWithDefaults instantiates a new ProcessSummariesMetaPage 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 NewProcessSummariesMetaPageWithDefaults() *ProcessSummariesMetaPage { - this := ProcessSummariesMetaPage{} - return &this -} - -// GetAfter returns the After field value if set, zero value otherwise. -func (o *ProcessSummariesMetaPage) GetAfter() string { - if o == nil || o.After == nil { - var ret string - return ret - } - return *o.After -} - -// GetAfterOk returns a tuple with the After field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummariesMetaPage) GetAfterOk() (*string, bool) { - if o == nil || o.After == nil { - return nil, false - } - return o.After, true -} - -// HasAfter returns a boolean if a field has been set. -func (o *ProcessSummariesMetaPage) HasAfter() bool { - if o != nil && o.After != nil { - return true - } - - return false -} - -// SetAfter gets a reference to the given string and assigns it to the After field. -func (o *ProcessSummariesMetaPage) SetAfter(v string) { - o.After = &v -} - -// GetSize returns the Size field value if set, zero value otherwise. -func (o *ProcessSummariesMetaPage) GetSize() int32 { - if o == nil || o.Size == nil { - var ret int32 - return ret - } - return *o.Size -} - -// GetSizeOk returns a tuple with the Size field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummariesMetaPage) GetSizeOk() (*int32, bool) { - if o == nil || o.Size == nil { - return nil, false - } - return o.Size, true -} - -// HasSize returns a boolean if a field has been set. -func (o *ProcessSummariesMetaPage) HasSize() bool { - if o != nil && o.Size != nil { - return true - } - - return false -} - -// SetSize gets a reference to the given int32 and assigns it to the Size field. -func (o *ProcessSummariesMetaPage) SetSize(v int32) { - o.Size = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ProcessSummariesMetaPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.After != nil { - toSerialize["after"] = o.After - } - if o.Size != nil { - toSerialize["size"] = o.Size - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ProcessSummariesMetaPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - After *string `json:"after,omitempty"` - Size *int32 `json:"size,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.After = all.After - o.Size = all.Size - return nil -} diff --git a/api/v2/datadog/model_process_summaries_response.go b/api/v2/datadog/model_process_summaries_response.go deleted file mode 100644 index 29e8543c316..00000000000 --- a/api/v2/datadog/model_process_summaries_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ProcessSummariesResponse List of process summaries. -type ProcessSummariesResponse struct { - // Array of process summary objects. - Data []ProcessSummary `json:"data,omitempty"` - // Response metadata object. - Meta *ProcessSummariesMeta `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{} -} - -// NewProcessSummariesResponse instantiates a new ProcessSummariesResponse 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 NewProcessSummariesResponse() *ProcessSummariesResponse { - this := ProcessSummariesResponse{} - return &this -} - -// NewProcessSummariesResponseWithDefaults instantiates a new ProcessSummariesResponse 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 NewProcessSummariesResponseWithDefaults() *ProcessSummariesResponse { - this := ProcessSummariesResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *ProcessSummariesResponse) GetData() []ProcessSummary { - if o == nil || o.Data == nil { - var ret []ProcessSummary - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummariesResponse) GetDataOk() (*[]ProcessSummary, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *ProcessSummariesResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []ProcessSummary and assigns it to the Data field. -func (o *ProcessSummariesResponse) SetData(v []ProcessSummary) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *ProcessSummariesResponse) GetMeta() ProcessSummariesMeta { - if o == nil || o.Meta == nil { - var ret ProcessSummariesMeta - 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 *ProcessSummariesResponse) GetMetaOk() (*ProcessSummariesMeta, 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 *ProcessSummariesResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given ProcessSummariesMeta and assigns it to the Meta field. -func (o *ProcessSummariesResponse) SetMeta(v ProcessSummariesMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ProcessSummariesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ProcessSummariesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []ProcessSummary `json:"data,omitempty"` - Meta *ProcessSummariesMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_process_summary.go b/api/v2/datadog/model_process_summary.go deleted file mode 100644 index d7ff4c56b25..00000000000 --- a/api/v2/datadog/model_process_summary.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ProcessSummary Process summary object. -type ProcessSummary struct { - // Attributes for a process summary. - Attributes *ProcessSummaryAttributes `json:"attributes,omitempty"` - // Process ID. - Id *string `json:"id,omitempty"` - // Type of process summary. - Type *ProcessSummaryType `json:"type,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{} -} - -// NewProcessSummary instantiates a new ProcessSummary 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 NewProcessSummary() *ProcessSummary { - this := ProcessSummary{} - var typeVar ProcessSummaryType = PROCESSSUMMARYTYPE_PROCESS - this.Type = &typeVar - return &this -} - -// NewProcessSummaryWithDefaults instantiates a new ProcessSummary 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 NewProcessSummaryWithDefaults() *ProcessSummary { - this := ProcessSummary{} - var typeVar ProcessSummaryType = PROCESSSUMMARYTYPE_PROCESS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *ProcessSummary) GetAttributes() ProcessSummaryAttributes { - if o == nil || o.Attributes == nil { - var ret ProcessSummaryAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummary) GetAttributesOk() (*ProcessSummaryAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *ProcessSummary) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given ProcessSummaryAttributes and assigns it to the Attributes field. -func (o *ProcessSummary) SetAttributes(v ProcessSummaryAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *ProcessSummary) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummary) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *ProcessSummary) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *ProcessSummary) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *ProcessSummary) GetType() ProcessSummaryType { - if o == nil || o.Type == nil { - var ret ProcessSummaryType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummary) GetTypeOk() (*ProcessSummaryType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *ProcessSummary) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given ProcessSummaryType and assigns it to the Type field. -func (o *ProcessSummary) SetType(v ProcessSummaryType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ProcessSummary) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ProcessSummary) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *ProcessSummaryAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *ProcessSummaryType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_process_summary_attributes.go b/api/v2/datadog/model_process_summary_attributes.go deleted file mode 100644 index de2819cb1c7..00000000000 --- a/api/v2/datadog/model_process_summary_attributes.go +++ /dev/null @@ -1,375 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ProcessSummaryAttributes Attributes for a process summary. -type ProcessSummaryAttributes struct { - // Process command line. - Cmdline *string `json:"cmdline,omitempty"` - // Host running the process. - Host *string `json:"host,omitempty"` - // Process ID. - Pid *int64 `json:"pid,omitempty"` - // Parent process ID. - Ppid *int64 `json:"ppid,omitempty"` - // Time the process was started. - Start *string `json:"start,omitempty"` - // List of tags associated with the process. - Tags []string `json:"tags,omitempty"` - // Time the process was seen. - Timestamp *string `json:"timestamp,omitempty"` - // Process owner. - User *string `json:"user,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{} -} - -// NewProcessSummaryAttributes instantiates a new ProcessSummaryAttributes 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 NewProcessSummaryAttributes() *ProcessSummaryAttributes { - this := ProcessSummaryAttributes{} - return &this -} - -// NewProcessSummaryAttributesWithDefaults instantiates a new ProcessSummaryAttributes 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 NewProcessSummaryAttributesWithDefaults() *ProcessSummaryAttributes { - this := ProcessSummaryAttributes{} - return &this -} - -// GetCmdline returns the Cmdline field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetCmdline() string { - if o == nil || o.Cmdline == nil { - var ret string - return ret - } - return *o.Cmdline -} - -// GetCmdlineOk returns a tuple with the Cmdline field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummaryAttributes) GetCmdlineOk() (*string, bool) { - if o == nil || o.Cmdline == nil { - return nil, false - } - return o.Cmdline, true -} - -// HasCmdline returns a boolean if a field has been set. -func (o *ProcessSummaryAttributes) HasCmdline() bool { - if o != nil && o.Cmdline != nil { - return true - } - - return false -} - -// SetCmdline gets a reference to the given string and assigns it to the Cmdline field. -func (o *ProcessSummaryAttributes) SetCmdline(v string) { - o.Cmdline = &v -} - -// GetHost returns the Host field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetHost() string { - if o == nil || o.Host == nil { - var ret string - return ret - } - return *o.Host -} - -// GetHostOk returns a tuple with the Host field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummaryAttributes) GetHostOk() (*string, bool) { - if o == nil || o.Host == nil { - return nil, false - } - return o.Host, true -} - -// HasHost returns a boolean if a field has been set. -func (o *ProcessSummaryAttributes) HasHost() bool { - if o != nil && o.Host != nil { - return true - } - - return false -} - -// SetHost gets a reference to the given string and assigns it to the Host field. -func (o *ProcessSummaryAttributes) SetHost(v string) { - o.Host = &v -} - -// GetPid returns the Pid field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetPid() int64 { - if o == nil || o.Pid == nil { - var ret int64 - return ret - } - return *o.Pid -} - -// GetPidOk returns a tuple with the Pid field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummaryAttributes) GetPidOk() (*int64, bool) { - if o == nil || o.Pid == nil { - return nil, false - } - return o.Pid, true -} - -// HasPid returns a boolean if a field has been set. -func (o *ProcessSummaryAttributes) HasPid() bool { - if o != nil && o.Pid != nil { - return true - } - - return false -} - -// SetPid gets a reference to the given int64 and assigns it to the Pid field. -func (o *ProcessSummaryAttributes) SetPid(v int64) { - o.Pid = &v -} - -// GetPpid returns the Ppid field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetPpid() int64 { - if o == nil || o.Ppid == nil { - var ret int64 - return ret - } - return *o.Ppid -} - -// GetPpidOk returns a tuple with the Ppid field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummaryAttributes) GetPpidOk() (*int64, bool) { - if o == nil || o.Ppid == nil { - return nil, false - } - return o.Ppid, true -} - -// HasPpid returns a boolean if a field has been set. -func (o *ProcessSummaryAttributes) HasPpid() bool { - if o != nil && o.Ppid != nil { - return true - } - - return false -} - -// SetPpid gets a reference to the given int64 and assigns it to the Ppid field. -func (o *ProcessSummaryAttributes) SetPpid(v int64) { - o.Ppid = &v -} - -// GetStart returns the Start field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetStart() string { - if o == nil || o.Start == nil { - var ret string - return ret - } - return *o.Start -} - -// GetStartOk returns a tuple with the Start field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummaryAttributes) GetStartOk() (*string, bool) { - if o == nil || o.Start == nil { - return nil, false - } - return o.Start, true -} - -// HasStart returns a boolean if a field has been set. -func (o *ProcessSummaryAttributes) HasStart() bool { - if o != nil && o.Start != nil { - return true - } - - return false -} - -// SetStart gets a reference to the given string and assigns it to the Start field. -func (o *ProcessSummaryAttributes) SetStart(v string) { - o.Start = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *ProcessSummaryAttributes) GetTagsOk() (*[]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 *ProcessSummaryAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *ProcessSummaryAttributes) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetTimestamp() string { - if o == nil || o.Timestamp == nil { - var ret string - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummaryAttributes) GetTimestampOk() (*string, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *ProcessSummaryAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given string and assigns it to the Timestamp field. -func (o *ProcessSummaryAttributes) SetTimestamp(v string) { - o.Timestamp = &v -} - -// GetUser returns the User field value if set, zero value otherwise. -func (o *ProcessSummaryAttributes) GetUser() string { - if o == nil || o.User == nil { - var ret string - return ret - } - return *o.User -} - -// GetUserOk returns a tuple with the User field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProcessSummaryAttributes) GetUserOk() (*string, bool) { - if o == nil || o.User == nil { - return nil, false - } - return o.User, true -} - -// HasUser returns a boolean if a field has been set. -func (o *ProcessSummaryAttributes) HasUser() bool { - if o != nil && o.User != nil { - return true - } - - return false -} - -// SetUser gets a reference to the given string and assigns it to the User field. -func (o *ProcessSummaryAttributes) SetUser(v string) { - o.User = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ProcessSummaryAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cmdline != nil { - toSerialize["cmdline"] = o.Cmdline - } - if o.Host != nil { - toSerialize["host"] = o.Host - } - if o.Pid != nil { - toSerialize["pid"] = o.Pid - } - if o.Ppid != nil { - toSerialize["ppid"] = o.Ppid - } - if o.Start != nil { - toSerialize["start"] = o.Start - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - toSerialize["timestamp"] = o.Timestamp - } - if o.User != nil { - toSerialize["user"] = o.User - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ProcessSummaryAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cmdline *string `json:"cmdline,omitempty"` - Host *string `json:"host,omitempty"` - Pid *int64 `json:"pid,omitempty"` - Ppid *int64 `json:"ppid,omitempty"` - Start *string `json:"start,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *string `json:"timestamp,omitempty"` - User *string `json:"user,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cmdline = all.Cmdline - o.Host = all.Host - o.Pid = all.Pid - o.Ppid = all.Ppid - o.Start = all.Start - o.Tags = all.Tags - o.Timestamp = all.Timestamp - o.User = all.User - return nil -} diff --git a/api/v2/datadog/model_process_summary_type.go b/api/v2/datadog/model_process_summary_type.go deleted file mode 100644 index e85741a2a65..00000000000 --- a/api/v2/datadog/model_process_summary_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ProcessSummaryType Type of process summary. -type ProcessSummaryType string - -// List of ProcessSummaryType. -const ( - PROCESSSUMMARYTYPE_PROCESS ProcessSummaryType = "process" -) - -var allowedProcessSummaryTypeEnumValues = []ProcessSummaryType{ - PROCESSSUMMARYTYPE_PROCESS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ProcessSummaryType) GetAllowedValues() []ProcessSummaryType { - return allowedProcessSummaryTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ProcessSummaryType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ProcessSummaryType(value) - return nil -} - -// NewProcessSummaryTypeFromValue returns a pointer to a valid ProcessSummaryType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewProcessSummaryTypeFromValue(v string) (*ProcessSummaryType, error) { - ev := ProcessSummaryType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ProcessSummaryType: valid values are %v", v, allowedProcessSummaryTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ProcessSummaryType) IsValid() bool { - for _, existing := range allowedProcessSummaryTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ProcessSummaryType value. -func (v ProcessSummaryType) Ptr() *ProcessSummaryType { - return &v -} - -// NullableProcessSummaryType handles when a null is used for ProcessSummaryType. -type NullableProcessSummaryType struct { - value *ProcessSummaryType - isSet bool -} - -// Get returns the associated value. -func (v NullableProcessSummaryType) Get() *ProcessSummaryType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableProcessSummaryType) Set(val *ProcessSummaryType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableProcessSummaryType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableProcessSummaryType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableProcessSummaryType initializes the struct as if Set has been called. -func NewNullableProcessSummaryType(val *ProcessSummaryType) *NullableProcessSummaryType { - return &NullableProcessSummaryType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableProcessSummaryType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableProcessSummaryType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_query_sort_order.go b/api/v2/datadog/model_query_sort_order.go deleted file mode 100644 index 8074bfd22e3..00000000000 --- a/api/v2/datadog/model_query_sort_order.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// QuerySortOrder Direction of sort. -type QuerySortOrder string - -// List of QuerySortOrder. -const ( - QUERYSORTORDER_ASC QuerySortOrder = "asc" - QUERYSORTORDER_DESC QuerySortOrder = "desc" -) - -var allowedQuerySortOrderEnumValues = []QuerySortOrder{ - QUERYSORTORDER_ASC, - QUERYSORTORDER_DESC, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *QuerySortOrder) GetAllowedValues() []QuerySortOrder { - return allowedQuerySortOrderEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *QuerySortOrder) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = QuerySortOrder(value) - return nil -} - -// NewQuerySortOrderFromValue returns a pointer to a valid QuerySortOrder -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewQuerySortOrderFromValue(v string) (*QuerySortOrder, error) { - ev := QuerySortOrder(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for QuerySortOrder: valid values are %v", v, allowedQuerySortOrderEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v QuerySortOrder) IsValid() bool { - for _, existing := range allowedQuerySortOrderEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to QuerySortOrder value. -func (v QuerySortOrder) Ptr() *QuerySortOrder { - return &v -} - -// NullableQuerySortOrder handles when a null is used for QuerySortOrder. -type NullableQuerySortOrder struct { - value *QuerySortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableQuerySortOrder) Get() *QuerySortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableQuerySortOrder) Set(val *QuerySortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableQuerySortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableQuerySortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableQuerySortOrder initializes the struct as if Set has been called. -func NewNullableQuerySortOrder(val *QuerySortOrder) *NullableQuerySortOrder { - return &NullableQuerySortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableQuerySortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableQuerySortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go b/api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go deleted file mode 100644 index 09c833d030e..00000000000 --- a/api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToIncidentIntegrationMetadataData A relationship reference for an integration metadata object. -type RelationshipToIncidentIntegrationMetadataData struct { - // A unique identifier that represents the integration metadata. - Id string `json:"id"` - // Integration metadata resource type. - Type IncidentIntegrationMetadataType `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{} -} - -// NewRelationshipToIncidentIntegrationMetadataData instantiates a new RelationshipToIncidentIntegrationMetadataData 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 NewRelationshipToIncidentIntegrationMetadataData(id string, typeVar IncidentIntegrationMetadataType) *RelationshipToIncidentIntegrationMetadataData { - this := RelationshipToIncidentIntegrationMetadataData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewRelationshipToIncidentIntegrationMetadataDataWithDefaults instantiates a new RelationshipToIncidentIntegrationMetadataData 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 NewRelationshipToIncidentIntegrationMetadataDataWithDefaults() *RelationshipToIncidentIntegrationMetadataData { - this := RelationshipToIncidentIntegrationMetadataData{} - var typeVar IncidentIntegrationMetadataType = INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *RelationshipToIncidentIntegrationMetadataData) 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 *RelationshipToIncidentIntegrationMetadataData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *RelationshipToIncidentIntegrationMetadataData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *RelationshipToIncidentIntegrationMetadataData) GetType() IncidentIntegrationMetadataType { - if o == nil { - var ret IncidentIntegrationMetadataType - 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 *RelationshipToIncidentIntegrationMetadataData) GetTypeOk() (*IncidentIntegrationMetadataType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RelationshipToIncidentIntegrationMetadataData) SetType(v IncidentIntegrationMetadataType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToIncidentIntegrationMetadataData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToIncidentIntegrationMetadataData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentIntegrationMetadataType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type IncidentIntegrationMetadataType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_relationship_to_incident_integration_metadatas.go b/api/v2/datadog/model_relationship_to_incident_integration_metadatas.go deleted file mode 100644 index f75fc89bd6b..00000000000 --- a/api/v2/datadog/model_relationship_to_incident_integration_metadatas.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToIncidentIntegrationMetadatas A relationship reference for multiple integration metadata objects. -type RelationshipToIncidentIntegrationMetadatas struct { - // The integration metadata relationship array - Data []RelationshipToIncidentIntegrationMetadataData `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{} -} - -// NewRelationshipToIncidentIntegrationMetadatas instantiates a new RelationshipToIncidentIntegrationMetadatas 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 NewRelationshipToIncidentIntegrationMetadatas(data []RelationshipToIncidentIntegrationMetadataData) *RelationshipToIncidentIntegrationMetadatas { - this := RelationshipToIncidentIntegrationMetadatas{} - this.Data = data - return &this -} - -// NewRelationshipToIncidentIntegrationMetadatasWithDefaults instantiates a new RelationshipToIncidentIntegrationMetadatas 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 NewRelationshipToIncidentIntegrationMetadatasWithDefaults() *RelationshipToIncidentIntegrationMetadatas { - this := RelationshipToIncidentIntegrationMetadatas{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToIncidentIntegrationMetadatas) GetData() []RelationshipToIncidentIntegrationMetadataData { - if o == nil { - var ret []RelationshipToIncidentIntegrationMetadataData - 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 *RelationshipToIncidentIntegrationMetadatas) GetDataOk() (*[]RelationshipToIncidentIntegrationMetadataData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToIncidentIntegrationMetadatas) SetData(v []RelationshipToIncidentIntegrationMetadataData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToIncidentIntegrationMetadatas) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToIncidentIntegrationMetadatas) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]RelationshipToIncidentIntegrationMetadataData `json:"data"` - }{} - all := struct { - Data []RelationshipToIncidentIntegrationMetadataData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_incident_postmortem.go b/api/v2/datadog/model_relationship_to_incident_postmortem.go deleted file mode 100644 index 350cb80249d..00000000000 --- a/api/v2/datadog/model_relationship_to_incident_postmortem.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToIncidentPostmortem A relationship reference for postmortems. -type RelationshipToIncidentPostmortem struct { - // The postmortem relationship data. - Data RelationshipToIncidentPostmortemData `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{} -} - -// NewRelationshipToIncidentPostmortem instantiates a new RelationshipToIncidentPostmortem 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 NewRelationshipToIncidentPostmortem(data RelationshipToIncidentPostmortemData) *RelationshipToIncidentPostmortem { - this := RelationshipToIncidentPostmortem{} - this.Data = data - return &this -} - -// NewRelationshipToIncidentPostmortemWithDefaults instantiates a new RelationshipToIncidentPostmortem 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 NewRelationshipToIncidentPostmortemWithDefaults() *RelationshipToIncidentPostmortem { - this := RelationshipToIncidentPostmortem{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToIncidentPostmortem) GetData() RelationshipToIncidentPostmortemData { - if o == nil { - var ret RelationshipToIncidentPostmortemData - 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 *RelationshipToIncidentPostmortem) GetDataOk() (*RelationshipToIncidentPostmortemData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToIncidentPostmortem) SetData(v RelationshipToIncidentPostmortemData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToIncidentPostmortem) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToIncidentPostmortem) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *RelationshipToIncidentPostmortemData `json:"data"` - }{} - all := struct { - Data RelationshipToIncidentPostmortemData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_incident_postmortem_data.go b/api/v2/datadog/model_relationship_to_incident_postmortem_data.go deleted file mode 100644 index c02d86f7dc3..00000000000 --- a/api/v2/datadog/model_relationship_to_incident_postmortem_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToIncidentPostmortemData The postmortem relationship data. -type RelationshipToIncidentPostmortemData struct { - // A unique identifier that represents the postmortem. - Id string `json:"id"` - // Incident postmortem resource type. - Type IncidentPostmortemType `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{} -} - -// NewRelationshipToIncidentPostmortemData instantiates a new RelationshipToIncidentPostmortemData 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 NewRelationshipToIncidentPostmortemData(id string, typeVar IncidentPostmortemType) *RelationshipToIncidentPostmortemData { - this := RelationshipToIncidentPostmortemData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewRelationshipToIncidentPostmortemDataWithDefaults instantiates a new RelationshipToIncidentPostmortemData 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 NewRelationshipToIncidentPostmortemDataWithDefaults() *RelationshipToIncidentPostmortemData { - this := RelationshipToIncidentPostmortemData{} - var typeVar IncidentPostmortemType = INCIDENTPOSTMORTEMTYPE_INCIDENT_POSTMORTEMS - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *RelationshipToIncidentPostmortemData) 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 *RelationshipToIncidentPostmortemData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *RelationshipToIncidentPostmortemData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *RelationshipToIncidentPostmortemData) GetType() IncidentPostmortemType { - if o == nil { - var ret IncidentPostmortemType - 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 *RelationshipToIncidentPostmortemData) GetTypeOk() (*IncidentPostmortemType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RelationshipToIncidentPostmortemData) SetType(v IncidentPostmortemType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToIncidentPostmortemData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToIncidentPostmortemData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentPostmortemType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type IncidentPostmortemType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_relationship_to_organization.go b/api/v2/datadog/model_relationship_to_organization.go deleted file mode 100644 index ffa10d2f39f..00000000000 --- a/api/v2/datadog/model_relationship_to_organization.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToOrganization Relationship to an organization. -type RelationshipToOrganization struct { - // Relationship to organization object. - Data RelationshipToOrganizationData `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{} -} - -// NewRelationshipToOrganization instantiates a new RelationshipToOrganization 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 NewRelationshipToOrganization(data RelationshipToOrganizationData) *RelationshipToOrganization { - this := RelationshipToOrganization{} - this.Data = data - return &this -} - -// NewRelationshipToOrganizationWithDefaults instantiates a new RelationshipToOrganization 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 NewRelationshipToOrganizationWithDefaults() *RelationshipToOrganization { - this := RelationshipToOrganization{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToOrganization) GetData() RelationshipToOrganizationData { - if o == nil { - var ret RelationshipToOrganizationData - 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 *RelationshipToOrganization) GetDataOk() (*RelationshipToOrganizationData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToOrganization) SetData(v RelationshipToOrganizationData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToOrganization) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToOrganization) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *RelationshipToOrganizationData `json:"data"` - }{} - all := struct { - Data RelationshipToOrganizationData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_organization_data.go b/api/v2/datadog/model_relationship_to_organization_data.go deleted file mode 100644 index c29160e4a9c..00000000000 --- a/api/v2/datadog/model_relationship_to_organization_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToOrganizationData Relationship to organization object. -type RelationshipToOrganizationData struct { - // ID of the organization. - Id string `json:"id"` - // Organizations resource type. - Type OrganizationsType `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{} -} - -// NewRelationshipToOrganizationData instantiates a new RelationshipToOrganizationData 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 NewRelationshipToOrganizationData(id string, typeVar OrganizationsType) *RelationshipToOrganizationData { - this := RelationshipToOrganizationData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewRelationshipToOrganizationDataWithDefaults instantiates a new RelationshipToOrganizationData 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 NewRelationshipToOrganizationDataWithDefaults() *RelationshipToOrganizationData { - this := RelationshipToOrganizationData{} - var typeVar OrganizationsType = ORGANIZATIONSTYPE_ORGS - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *RelationshipToOrganizationData) 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 *RelationshipToOrganizationData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *RelationshipToOrganizationData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *RelationshipToOrganizationData) GetType() OrganizationsType { - if o == nil { - var ret OrganizationsType - 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 *RelationshipToOrganizationData) GetTypeOk() (*OrganizationsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RelationshipToOrganizationData) SetType(v OrganizationsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToOrganizationData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToOrganizationData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *OrganizationsType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type OrganizationsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_relationship_to_organizations.go b/api/v2/datadog/model_relationship_to_organizations.go deleted file mode 100644 index c40cda6bb70..00000000000 --- a/api/v2/datadog/model_relationship_to_organizations.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToOrganizations Relationship to organizations. -type RelationshipToOrganizations struct { - // Relationships to organization objects. - Data []RelationshipToOrganizationData `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{} -} - -// NewRelationshipToOrganizations instantiates a new RelationshipToOrganizations 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 NewRelationshipToOrganizations(data []RelationshipToOrganizationData) *RelationshipToOrganizations { - this := RelationshipToOrganizations{} - this.Data = data - return &this -} - -// NewRelationshipToOrganizationsWithDefaults instantiates a new RelationshipToOrganizations 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 NewRelationshipToOrganizationsWithDefaults() *RelationshipToOrganizations { - this := RelationshipToOrganizations{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToOrganizations) GetData() []RelationshipToOrganizationData { - if o == nil { - var ret []RelationshipToOrganizationData - 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 *RelationshipToOrganizations) GetDataOk() (*[]RelationshipToOrganizationData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToOrganizations) SetData(v []RelationshipToOrganizationData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToOrganizations) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToOrganizations) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]RelationshipToOrganizationData `json:"data"` - }{} - all := struct { - Data []RelationshipToOrganizationData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_permission.go b/api/v2/datadog/model_relationship_to_permission.go deleted file mode 100644 index e0b02e62342..00000000000 --- a/api/v2/datadog/model_relationship_to_permission.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RelationshipToPermission Relationship to a permissions object. -type RelationshipToPermission struct { - // Relationship to permission object. - Data *RelationshipToPermissionData `json:"data,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{} -} - -// NewRelationshipToPermission instantiates a new RelationshipToPermission 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 NewRelationshipToPermission() *RelationshipToPermission { - this := RelationshipToPermission{} - return &this -} - -// NewRelationshipToPermissionWithDefaults instantiates a new RelationshipToPermission 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 NewRelationshipToPermissionWithDefaults() *RelationshipToPermission { - this := RelationshipToPermission{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RelationshipToPermission) GetData() RelationshipToPermissionData { - if o == nil || o.Data == nil { - var ret RelationshipToPermissionData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToPermission) GetDataOk() (*RelationshipToPermissionData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RelationshipToPermission) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given RelationshipToPermissionData and assigns it to the Data field. -func (o *RelationshipToPermission) SetData(v RelationshipToPermissionData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToPermission) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToPermission) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *RelationshipToPermissionData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_permission_data.go b/api/v2/datadog/model_relationship_to_permission_data.go deleted file mode 100644 index 274efea31fc..00000000000 --- a/api/v2/datadog/model_relationship_to_permission_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RelationshipToPermissionData Relationship to permission object. -type RelationshipToPermissionData struct { - // ID of the permission. - Id *string `json:"id,omitempty"` - // Permissions resource type. - Type *PermissionsType `json:"type,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{} -} - -// NewRelationshipToPermissionData instantiates a new RelationshipToPermissionData 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 NewRelationshipToPermissionData() *RelationshipToPermissionData { - this := RelationshipToPermissionData{} - var typeVar PermissionsType = PERMISSIONSTYPE_PERMISSIONS - this.Type = &typeVar - return &this -} - -// NewRelationshipToPermissionDataWithDefaults instantiates a new RelationshipToPermissionData 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 NewRelationshipToPermissionDataWithDefaults() *RelationshipToPermissionData { - this := RelationshipToPermissionData{} - var typeVar PermissionsType = PERMISSIONSTYPE_PERMISSIONS - this.Type = &typeVar - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *RelationshipToPermissionData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToPermissionData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *RelationshipToPermissionData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *RelationshipToPermissionData) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *RelationshipToPermissionData) GetType() PermissionsType { - if o == nil || o.Type == nil { - var ret PermissionsType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToPermissionData) GetTypeOk() (*PermissionsType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *RelationshipToPermissionData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given PermissionsType and assigns it to the Type field. -func (o *RelationshipToPermissionData) SetType(v PermissionsType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToPermissionData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToPermissionData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Type *PermissionsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_relationship_to_permissions.go b/api/v2/datadog/model_relationship_to_permissions.go deleted file mode 100644 index cd37f41cf32..00000000000 --- a/api/v2/datadog/model_relationship_to_permissions.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RelationshipToPermissions Relationship to multiple permissions objects. -type RelationshipToPermissions struct { - // Relationships to permission objects. - Data []RelationshipToPermissionData `json:"data,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{} -} - -// NewRelationshipToPermissions instantiates a new RelationshipToPermissions 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 NewRelationshipToPermissions() *RelationshipToPermissions { - this := RelationshipToPermissions{} - return &this -} - -// NewRelationshipToPermissionsWithDefaults instantiates a new RelationshipToPermissions 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 NewRelationshipToPermissionsWithDefaults() *RelationshipToPermissions { - this := RelationshipToPermissions{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RelationshipToPermissions) GetData() []RelationshipToPermissionData { - if o == nil || o.Data == nil { - var ret []RelationshipToPermissionData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToPermissions) GetDataOk() (*[]RelationshipToPermissionData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RelationshipToPermissions) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []RelationshipToPermissionData and assigns it to the Data field. -func (o *RelationshipToPermissions) SetData(v []RelationshipToPermissionData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToPermissions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToPermissions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []RelationshipToPermissionData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_role.go b/api/v2/datadog/model_relationship_to_role.go deleted file mode 100644 index edf52227898..00000000000 --- a/api/v2/datadog/model_relationship_to_role.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RelationshipToRole Relationship to role. -type RelationshipToRole struct { - // Relationship to role object. - Data *RelationshipToRoleData `json:"data,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{} -} - -// NewRelationshipToRole instantiates a new RelationshipToRole 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 NewRelationshipToRole() *RelationshipToRole { - this := RelationshipToRole{} - return &this -} - -// NewRelationshipToRoleWithDefaults instantiates a new RelationshipToRole 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 NewRelationshipToRoleWithDefaults() *RelationshipToRole { - this := RelationshipToRole{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RelationshipToRole) GetData() RelationshipToRoleData { - if o == nil || o.Data == nil { - var ret RelationshipToRoleData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToRole) GetDataOk() (*RelationshipToRoleData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RelationshipToRole) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given RelationshipToRoleData and assigns it to the Data field. -func (o *RelationshipToRole) SetData(v RelationshipToRoleData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToRole) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToRole) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *RelationshipToRoleData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_role_data.go b/api/v2/datadog/model_relationship_to_role_data.go deleted file mode 100644 index 5b1843f352a..00000000000 --- a/api/v2/datadog/model_relationship_to_role_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RelationshipToRoleData Relationship to role object. -type RelationshipToRoleData struct { - // The unique identifier of the role. - Id *string `json:"id,omitempty"` - // Roles type. - Type *RolesType `json:"type,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{} -} - -// NewRelationshipToRoleData instantiates a new RelationshipToRoleData 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 NewRelationshipToRoleData() *RelationshipToRoleData { - this := RelationshipToRoleData{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = &typeVar - return &this -} - -// NewRelationshipToRoleDataWithDefaults instantiates a new RelationshipToRoleData 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 NewRelationshipToRoleDataWithDefaults() *RelationshipToRoleData { - this := RelationshipToRoleData{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = &typeVar - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *RelationshipToRoleData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToRoleData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *RelationshipToRoleData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *RelationshipToRoleData) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *RelationshipToRoleData) GetType() RolesType { - if o == nil || o.Type == nil { - var ret RolesType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToRoleData) GetTypeOk() (*RolesType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *RelationshipToRoleData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given RolesType and assigns it to the Type field. -func (o *RelationshipToRoleData) SetType(v RolesType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToRoleData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToRoleData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Id *string `json:"id,omitempty"` - Type *RolesType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_relationship_to_roles.go b/api/v2/datadog/model_relationship_to_roles.go deleted file mode 100644 index 5b8ee2470bf..00000000000 --- a/api/v2/datadog/model_relationship_to_roles.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RelationshipToRoles Relationship to roles. -type RelationshipToRoles struct { - // An array containing type and the unique identifier of a role. - Data []RelationshipToRoleData `json:"data,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{} -} - -// NewRelationshipToRoles instantiates a new RelationshipToRoles 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 NewRelationshipToRoles() *RelationshipToRoles { - this := RelationshipToRoles{} - return &this -} - -// NewRelationshipToRolesWithDefaults instantiates a new RelationshipToRoles 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 NewRelationshipToRolesWithDefaults() *RelationshipToRoles { - this := RelationshipToRoles{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RelationshipToRoles) GetData() []RelationshipToRoleData { - if o == nil || o.Data == nil { - var ret []RelationshipToRoleData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RelationshipToRoles) GetDataOk() (*[]RelationshipToRoleData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RelationshipToRoles) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []RelationshipToRoleData and assigns it to the Data field. -func (o *RelationshipToRoles) SetData(v []RelationshipToRoleData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToRoles) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToRoles) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []RelationshipToRoleData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_saml_assertion_attribute.go b/api/v2/datadog/model_relationship_to_saml_assertion_attribute.go deleted file mode 100644 index 3d57665bf6f..00000000000 --- a/api/v2/datadog/model_relationship_to_saml_assertion_attribute.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToSAMLAssertionAttribute AuthN Mapping relationship to SAML Assertion Attribute. -type RelationshipToSAMLAssertionAttribute struct { - // Data of AuthN Mapping relationship to SAML Assertion Attribute. - Data RelationshipToSAMLAssertionAttributeData `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{} -} - -// NewRelationshipToSAMLAssertionAttribute instantiates a new RelationshipToSAMLAssertionAttribute 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 NewRelationshipToSAMLAssertionAttribute(data RelationshipToSAMLAssertionAttributeData) *RelationshipToSAMLAssertionAttribute { - this := RelationshipToSAMLAssertionAttribute{} - this.Data = data - return &this -} - -// NewRelationshipToSAMLAssertionAttributeWithDefaults instantiates a new RelationshipToSAMLAssertionAttribute 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 NewRelationshipToSAMLAssertionAttributeWithDefaults() *RelationshipToSAMLAssertionAttribute { - this := RelationshipToSAMLAssertionAttribute{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToSAMLAssertionAttribute) GetData() RelationshipToSAMLAssertionAttributeData { - if o == nil { - var ret RelationshipToSAMLAssertionAttributeData - 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 *RelationshipToSAMLAssertionAttribute) GetDataOk() (*RelationshipToSAMLAssertionAttributeData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToSAMLAssertionAttribute) SetData(v RelationshipToSAMLAssertionAttributeData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToSAMLAssertionAttribute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToSAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *RelationshipToSAMLAssertionAttributeData `json:"data"` - }{} - all := struct { - Data RelationshipToSAMLAssertionAttributeData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go b/api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go deleted file mode 100644 index 534cac4d83e..00000000000 --- a/api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToSAMLAssertionAttributeData Data of AuthN Mapping relationship to SAML Assertion Attribute. -type RelationshipToSAMLAssertionAttributeData struct { - // The ID of the SAML assertion attribute. - Id string `json:"id"` - // SAML assertion attributes resource type. - Type SAMLAssertionAttributesType `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{} -} - -// NewRelationshipToSAMLAssertionAttributeData instantiates a new RelationshipToSAMLAssertionAttributeData 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 NewRelationshipToSAMLAssertionAttributeData(id string, typeVar SAMLAssertionAttributesType) *RelationshipToSAMLAssertionAttributeData { - this := RelationshipToSAMLAssertionAttributeData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewRelationshipToSAMLAssertionAttributeDataWithDefaults instantiates a new RelationshipToSAMLAssertionAttributeData 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 NewRelationshipToSAMLAssertionAttributeDataWithDefaults() *RelationshipToSAMLAssertionAttributeData { - this := RelationshipToSAMLAssertionAttributeData{} - var typeVar SAMLAssertionAttributesType = SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *RelationshipToSAMLAssertionAttributeData) 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 *RelationshipToSAMLAssertionAttributeData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *RelationshipToSAMLAssertionAttributeData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *RelationshipToSAMLAssertionAttributeData) GetType() SAMLAssertionAttributesType { - if o == nil { - var ret SAMLAssertionAttributesType - 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 *RelationshipToSAMLAssertionAttributeData) GetTypeOk() (*SAMLAssertionAttributesType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RelationshipToSAMLAssertionAttributeData) SetType(v SAMLAssertionAttributesType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToSAMLAssertionAttributeData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToSAMLAssertionAttributeData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *SAMLAssertionAttributesType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type SAMLAssertionAttributesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_relationship_to_user.go b/api/v2/datadog/model_relationship_to_user.go deleted file mode 100644 index 8273b47787d..00000000000 --- a/api/v2/datadog/model_relationship_to_user.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToUser Relationship to user. -type RelationshipToUser struct { - // Relationship to user object. - Data RelationshipToUserData `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{} -} - -// NewRelationshipToUser instantiates a new RelationshipToUser 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 NewRelationshipToUser(data RelationshipToUserData) *RelationshipToUser { - this := RelationshipToUser{} - this.Data = data - return &this -} - -// NewRelationshipToUserWithDefaults instantiates a new RelationshipToUser 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 NewRelationshipToUserWithDefaults() *RelationshipToUser { - this := RelationshipToUser{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToUser) GetData() RelationshipToUserData { - if o == nil { - var ret RelationshipToUserData - 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 *RelationshipToUser) GetDataOk() (*RelationshipToUserData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToUser) SetData(v RelationshipToUserData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToUser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *RelationshipToUserData `json:"data"` - }{} - all := struct { - Data RelationshipToUserData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_relationship_to_user_data.go b/api/v2/datadog/model_relationship_to_user_data.go deleted file mode 100644 index c3b9bc5e091..00000000000 --- a/api/v2/datadog/model_relationship_to_user_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToUserData Relationship to user object. -type RelationshipToUserData struct { - // A unique identifier that represents the user. - Id string `json:"id"` - // Users resource type. - Type UsersType `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{} -} - -// NewRelationshipToUserData instantiates a new RelationshipToUserData 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 NewRelationshipToUserData(id string, typeVar UsersType) *RelationshipToUserData { - this := RelationshipToUserData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewRelationshipToUserDataWithDefaults instantiates a new RelationshipToUserData 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 NewRelationshipToUserDataWithDefaults() *RelationshipToUserData { - this := RelationshipToUserData{} - var typeVar UsersType = USERSTYPE_USERS - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *RelationshipToUserData) 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 *RelationshipToUserData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *RelationshipToUserData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *RelationshipToUserData) GetType() UsersType { - if o == nil { - var ret UsersType - 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 *RelationshipToUserData) GetTypeOk() (*UsersType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RelationshipToUserData) SetType(v UsersType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToUserData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *UsersType `json:"type"` - }{} - all := struct { - Id string `json:"id"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_relationship_to_users.go b/api/v2/datadog/model_relationship_to_users.go deleted file mode 100644 index e7ba1610fdc..00000000000 --- a/api/v2/datadog/model_relationship_to_users.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RelationshipToUsers Relationship to users. -type RelationshipToUsers struct { - // Relationships to user objects. - Data []RelationshipToUserData `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{} -} - -// NewRelationshipToUsers instantiates a new RelationshipToUsers 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 NewRelationshipToUsers(data []RelationshipToUserData) *RelationshipToUsers { - this := RelationshipToUsers{} - this.Data = data - return &this -} - -// NewRelationshipToUsersWithDefaults instantiates a new RelationshipToUsers 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 NewRelationshipToUsersWithDefaults() *RelationshipToUsers { - this := RelationshipToUsers{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToUsers) GetData() []RelationshipToUserData { - if o == nil { - var ret []RelationshipToUserData - 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 *RelationshipToUsers) GetDataOk() (*[]RelationshipToUserData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToUsers) SetData(v []RelationshipToUserData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToUsers) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToUsers) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]RelationshipToUserData `json:"data"` - }{} - all := struct { - Data []RelationshipToUserData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_response_meta_attributes.go b/api/v2/datadog/model_response_meta_attributes.go deleted file mode 100644 index 40cc83c63a6..00000000000 --- a/api/v2/datadog/model_response_meta_attributes.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// ResponseMetaAttributes Object describing meta attributes of response. -type ResponseMetaAttributes struct { - // Pagination object. - Page *Pagination `json:"page,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{} -} - -// NewResponseMetaAttributes instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributes() *ResponseMetaAttributes { - this := ResponseMetaAttributes{} - return &this -} - -// NewResponseMetaAttributesWithDefaults instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributesWithDefaults() *ResponseMetaAttributes { - this := ResponseMetaAttributes{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *ResponseMetaAttributes) GetPage() Pagination { - if o == nil || o.Page == nil { - var ret Pagination - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ResponseMetaAttributes) GetPageOk() (*Pagination, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *ResponseMetaAttributes) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given Pagination and assigns it to the Page field. -func (o *ResponseMetaAttributes) SetPage(v Pagination) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ResponseMetaAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *Pagination `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v2/datadog/model_role.go b/api/v2/datadog/model_role.go deleted file mode 100644 index 2e79b1ea0a6..00000000000 --- a/api/v2/datadog/model_role.go +++ /dev/null @@ -1,244 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// Role Role object returned by the API. -type Role struct { - // Attributes of the role. - Attributes *RoleAttributes `json:"attributes,omitempty"` - // The unique identifier of the role. - Id *string `json:"id,omitempty"` - // Relationships of the role object returned by the API. - Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - // Roles type. - Type RolesType `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{} -} - -// NewRole instantiates a new Role 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 NewRole(typeVar RolesType) *Role { - this := Role{} - this.Type = typeVar - return &this -} - -// NewRoleWithDefaults instantiates a new Role 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 NewRoleWithDefaults() *Role { - this := Role{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *Role) GetAttributes() RoleAttributes { - if o == nil || o.Attributes == nil { - var ret RoleAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Role) GetAttributesOk() (*RoleAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *Role) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given RoleAttributes and assigns it to the Attributes field. -func (o *Role) SetAttributes(v RoleAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *Role) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Role) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Role) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *Role) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *Role) GetRelationships() RoleResponseRelationships { - if o == nil || o.Relationships == nil { - var ret RoleResponseRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Role) GetRelationshipsOk() (*RoleResponseRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *Role) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given RoleResponseRelationships and assigns it to the Relationships field. -func (o *Role) SetRelationships(v RoleResponseRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *Role) GetType() RolesType { - if o == nil { - var ret RolesType - 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 *Role) GetTypeOk() (*RolesType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *Role) SetType(v RolesType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o Role) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *Role) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *RolesType `json:"type"` - }{} - all := struct { - Attributes *RoleAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - Type RolesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_role_attributes.go b/api/v2/datadog/model_role_attributes.go deleted file mode 100644 index 687df251a3a..00000000000 --- a/api/v2/datadog/model_role_attributes.go +++ /dev/null @@ -1,228 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// RoleAttributes Attributes of the role. -type RoleAttributes struct { - // Creation time of the role. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Time of last role modification. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // The name of the role. The name is neither unique nor a stable identifier of the role. - Name *string `json:"name,omitempty"` - // Number of users with that role. - UserCount *int64 `json:"user_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{} -} - -// NewRoleAttributes instantiates a new RoleAttributes 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 NewRoleAttributes() *RoleAttributes { - this := RoleAttributes{} - return &this -} - -// NewRoleAttributesWithDefaults instantiates a new RoleAttributes 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 NewRoleAttributesWithDefaults() *RoleAttributes { - this := RoleAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *RoleAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *RoleAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *RoleAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *RoleAttributes) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleAttributes) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *RoleAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *RoleAttributes) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *RoleAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *RoleAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *RoleAttributes) SetName(v string) { - o.Name = &v -} - -// GetUserCount returns the UserCount field value if set, zero value otherwise. -func (o *RoleAttributes) GetUserCount() int64 { - if o == nil || o.UserCount == nil { - var ret int64 - return ret - } - return *o.UserCount -} - -// GetUserCountOk returns a tuple with the UserCount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleAttributes) GetUserCountOk() (*int64, bool) { - if o == nil || o.UserCount == nil { - return nil, false - } - return o.UserCount, true -} - -// HasUserCount returns a boolean if a field has been set. -func (o *RoleAttributes) HasUserCount() bool { - if o != nil && o.UserCount != nil { - return true - } - - return false -} - -// SetUserCount gets a reference to the given int64 and assigns it to the UserCount field. -func (o *RoleAttributes) SetUserCount(v int64) { - o.UserCount = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.UserCount != nil { - toSerialize["user_count"] = o.UserCount - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name *string `json:"name,omitempty"` - UserCount *int64 `json:"user_count,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.ModifiedAt = all.ModifiedAt - o.Name = all.Name - o.UserCount = all.UserCount - return nil -} diff --git a/api/v2/datadog/model_role_clone.go b/api/v2/datadog/model_role_clone.go deleted file mode 100644 index b5a55b1a753..00000000000 --- a/api/v2/datadog/model_role_clone.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleClone Data for the clone role request. -type RoleClone struct { - // Attributes required to create a new role by cloning an existing one. - Attributes RoleCloneAttributes `json:"attributes"` - // Roles type. - Type RolesType `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{} -} - -// NewRoleClone instantiates a new RoleClone 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 NewRoleClone(attributes RoleCloneAttributes, typeVar RolesType) *RoleClone { - this := RoleClone{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewRoleCloneWithDefaults instantiates a new RoleClone 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 NewRoleCloneWithDefaults() *RoleClone { - this := RoleClone{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *RoleClone) GetAttributes() RoleCloneAttributes { - if o == nil { - var ret RoleCloneAttributes - 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 *RoleClone) GetAttributesOk() (*RoleCloneAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *RoleClone) SetAttributes(v RoleCloneAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *RoleClone) GetType() RolesType { - if o == nil { - var ret RolesType - 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 *RoleClone) GetTypeOk() (*RolesType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RoleClone) SetType(v RolesType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleClone) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleClone) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *RoleCloneAttributes `json:"attributes"` - Type *RolesType `json:"type"` - }{} - all := struct { - Attributes RoleCloneAttributes `json:"attributes"` - Type RolesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_role_clone_attributes.go b/api/v2/datadog/model_role_clone_attributes.go deleted file mode 100644 index 285ed01606b..00000000000 --- a/api/v2/datadog/model_role_clone_attributes.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleCloneAttributes Attributes required to create a new role by cloning an existing one. -type RoleCloneAttributes struct { - // Name of the new role that is cloned. - Name string `json:"name"` - // 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{} -} - -// NewRoleCloneAttributes instantiates a new RoleCloneAttributes 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 NewRoleCloneAttributes(name string) *RoleCloneAttributes { - this := RoleCloneAttributes{} - this.Name = name - return &this -} - -// NewRoleCloneAttributesWithDefaults instantiates a new RoleCloneAttributes 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 NewRoleCloneAttributesWithDefaults() *RoleCloneAttributes { - this := RoleCloneAttributes{} - return &this -} - -// GetName returns the Name field value. -func (o *RoleCloneAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *RoleCloneAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *RoleCloneAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleCloneAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_role_clone_request.go b/api/v2/datadog/model_role_clone_request.go deleted file mode 100644 index 386472a120b..00000000000 --- a/api/v2/datadog/model_role_clone_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleCloneRequest Request to create a role by cloning an existing role. -type RoleCloneRequest struct { - // Data for the clone role request. - Data RoleClone `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{} -} - -// NewRoleCloneRequest instantiates a new RoleCloneRequest 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 NewRoleCloneRequest(data RoleClone) *RoleCloneRequest { - this := RoleCloneRequest{} - this.Data = data - return &this -} - -// NewRoleCloneRequestWithDefaults instantiates a new RoleCloneRequest 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 NewRoleCloneRequestWithDefaults() *RoleCloneRequest { - this := RoleCloneRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *RoleCloneRequest) GetData() RoleClone { - if o == nil { - var ret RoleClone - 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 *RoleCloneRequest) GetDataOk() (*RoleClone, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RoleCloneRequest) SetData(v RoleClone) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleCloneRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleCloneRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *RoleClone `json:"data"` - }{} - all := struct { - Data RoleClone `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_role_create_attributes.go b/api/v2/datadog/model_role_create_attributes.go deleted file mode 100644 index 37e5911269c..00000000000 --- a/api/v2/datadog/model_role_create_attributes.go +++ /dev/null @@ -1,190 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" - "time" -) - -// RoleCreateAttributes Attributes of the created role. -type RoleCreateAttributes struct { - // Creation time of the role. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Time of last role modification. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // Name of the role. - Name string `json:"name"` - // 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{} -} - -// NewRoleCreateAttributes instantiates a new RoleCreateAttributes 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 NewRoleCreateAttributes(name string) *RoleCreateAttributes { - this := RoleCreateAttributes{} - this.Name = name - return &this -} - -// NewRoleCreateAttributesWithDefaults instantiates a new RoleCreateAttributes 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 NewRoleCreateAttributesWithDefaults() *RoleCreateAttributes { - this := RoleCreateAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *RoleCreateAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *RoleCreateAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *RoleCreateAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *RoleCreateAttributes) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateAttributes) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *RoleCreateAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *RoleCreateAttributes) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetName returns the Name field value. -func (o *RoleCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *RoleCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *RoleCreateAttributes) SetName(v string) { - o.Name = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - toSerialize["name"] = o.Name - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} - all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.ModifiedAt = all.ModifiedAt - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_role_create_data.go b/api/v2/datadog/model_role_create_data.go deleted file mode 100644 index ab7b20381bc..00000000000 --- a/api/v2/datadog/model_role_create_data.go +++ /dev/null @@ -1,207 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleCreateData Data related to the creation of a role. -type RoleCreateData struct { - // Attributes of the created role. - Attributes RoleCreateAttributes `json:"attributes"` - // Relationships of the role object. - Relationships *RoleRelationships `json:"relationships,omitempty"` - // Roles type. - Type *RolesType `json:"type,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{} -} - -// NewRoleCreateData instantiates a new RoleCreateData 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 NewRoleCreateData(attributes RoleCreateAttributes) *RoleCreateData { - this := RoleCreateData{} - this.Attributes = attributes - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = &typeVar - return &this -} - -// NewRoleCreateDataWithDefaults instantiates a new RoleCreateData 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 NewRoleCreateDataWithDefaults() *RoleCreateData { - this := RoleCreateData{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *RoleCreateData) GetAttributes() RoleCreateAttributes { - if o == nil { - var ret RoleCreateAttributes - 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 *RoleCreateData) GetAttributesOk() (*RoleCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *RoleCreateData) SetAttributes(v RoleCreateAttributes) { - o.Attributes = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *RoleCreateData) GetRelationships() RoleRelationships { - if o == nil || o.Relationships == nil { - var ret RoleRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateData) GetRelationshipsOk() (*RoleRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *RoleCreateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given RoleRelationships and assigns it to the Relationships field. -func (o *RoleCreateData) SetRelationships(v RoleRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *RoleCreateData) GetType() RolesType { - if o == nil || o.Type == nil { - var ret RolesType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateData) GetTypeOk() (*RolesType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *RoleCreateData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given RolesType and assigns it to the Type field. -func (o *RoleCreateData) SetType(v RolesType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *RoleCreateAttributes `json:"attributes"` - }{} - all := struct { - Attributes RoleCreateAttributes `json:"attributes"` - Relationships *RoleRelationships `json:"relationships,omitempty"` - Type *RolesType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_role_create_request.go b/api/v2/datadog/model_role_create_request.go deleted file mode 100644 index 270049d619b..00000000000 --- a/api/v2/datadog/model_role_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleCreateRequest Create a role. -type RoleCreateRequest struct { - // Data related to the creation of a role. - Data RoleCreateData `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{} -} - -// NewRoleCreateRequest instantiates a new RoleCreateRequest 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 NewRoleCreateRequest(data RoleCreateData) *RoleCreateRequest { - this := RoleCreateRequest{} - this.Data = data - return &this -} - -// NewRoleCreateRequestWithDefaults instantiates a new RoleCreateRequest 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 NewRoleCreateRequestWithDefaults() *RoleCreateRequest { - this := RoleCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *RoleCreateRequest) GetData() RoleCreateData { - if o == nil { - var ret RoleCreateData - 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 *RoleCreateRequest) GetDataOk() (*RoleCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RoleCreateRequest) SetData(v RoleCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *RoleCreateData `json:"data"` - }{} - all := struct { - Data RoleCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_role_create_response.go b/api/v2/datadog/model_role_create_response.go deleted file mode 100644 index dec56e76344..00000000000 --- a/api/v2/datadog/model_role_create_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RoleCreateResponse Response containing information about a created role. -type RoleCreateResponse struct { - // Role object returned by the API. - Data *RoleCreateResponseData `json:"data,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{} -} - -// NewRoleCreateResponse instantiates a new RoleCreateResponse 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 NewRoleCreateResponse() *RoleCreateResponse { - this := RoleCreateResponse{} - return &this -} - -// NewRoleCreateResponseWithDefaults instantiates a new RoleCreateResponse 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 NewRoleCreateResponseWithDefaults() *RoleCreateResponse { - this := RoleCreateResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RoleCreateResponse) GetData() RoleCreateResponseData { - if o == nil || o.Data == nil { - var ret RoleCreateResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateResponse) GetDataOk() (*RoleCreateResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RoleCreateResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given RoleCreateResponseData and assigns it to the Data field. -func (o *RoleCreateResponse) SetData(v RoleCreateResponseData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleCreateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleCreateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *RoleCreateResponseData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_role_create_response_data.go b/api/v2/datadog/model_role_create_response_data.go deleted file mode 100644 index a35d302351a..00000000000 --- a/api/v2/datadog/model_role_create_response_data.go +++ /dev/null @@ -1,244 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleCreateResponseData Role object returned by the API. -type RoleCreateResponseData struct { - // Attributes of the created role. - Attributes *RoleCreateAttributes `json:"attributes,omitempty"` - // The unique identifier of the role. - Id *string `json:"id,omitempty"` - // Relationships of the role object returned by the API. - Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - // Roles type. - Type RolesType `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{} -} - -// NewRoleCreateResponseData instantiates a new RoleCreateResponseData 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 NewRoleCreateResponseData(typeVar RolesType) *RoleCreateResponseData { - this := RoleCreateResponseData{} - this.Type = typeVar - return &this -} - -// NewRoleCreateResponseDataWithDefaults instantiates a new RoleCreateResponseData 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 NewRoleCreateResponseDataWithDefaults() *RoleCreateResponseData { - this := RoleCreateResponseData{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *RoleCreateResponseData) GetAttributes() RoleCreateAttributes { - if o == nil || o.Attributes == nil { - var ret RoleCreateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateResponseData) GetAttributesOk() (*RoleCreateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *RoleCreateResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given RoleCreateAttributes and assigns it to the Attributes field. -func (o *RoleCreateResponseData) SetAttributes(v RoleCreateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *RoleCreateResponseData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateResponseData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *RoleCreateResponseData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *RoleCreateResponseData) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *RoleCreateResponseData) GetRelationships() RoleResponseRelationships { - if o == nil || o.Relationships == nil { - var ret RoleResponseRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleCreateResponseData) GetRelationshipsOk() (*RoleResponseRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *RoleCreateResponseData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given RoleResponseRelationships and assigns it to the Relationships field. -func (o *RoleCreateResponseData) SetRelationships(v RoleResponseRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *RoleCreateResponseData) GetType() RolesType { - if o == nil { - var ret RolesType - 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 *RoleCreateResponseData) GetTypeOk() (*RolesType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RoleCreateResponseData) SetType(v RolesType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleCreateResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *RolesType `json:"type"` - }{} - all := struct { - Attributes *RoleCreateAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - Type RolesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_role_relationships.go b/api/v2/datadog/model_role_relationships.go deleted file mode 100644 index e406f726930..00000000000 --- a/api/v2/datadog/model_role_relationships.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RoleRelationships Relationships of the role object. -type RoleRelationships struct { - // Relationship to multiple permissions objects. - Permissions *RelationshipToPermissions `json:"permissions,omitempty"` - // Relationship to users. - Users *RelationshipToUsers `json:"users,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{} -} - -// NewRoleRelationships instantiates a new RoleRelationships 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 NewRoleRelationships() *RoleRelationships { - this := RoleRelationships{} - return &this -} - -// NewRoleRelationshipsWithDefaults instantiates a new RoleRelationships 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 NewRoleRelationshipsWithDefaults() *RoleRelationships { - this := RoleRelationships{} - return &this -} - -// GetPermissions returns the Permissions field value if set, zero value otherwise. -func (o *RoleRelationships) GetPermissions() RelationshipToPermissions { - if o == nil || o.Permissions == nil { - var ret RelationshipToPermissions - return ret - } - return *o.Permissions -} - -// GetPermissionsOk returns a tuple with the Permissions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleRelationships) GetPermissionsOk() (*RelationshipToPermissions, bool) { - if o == nil || o.Permissions == nil { - return nil, false - } - return o.Permissions, true -} - -// HasPermissions returns a boolean if a field has been set. -func (o *RoleRelationships) HasPermissions() bool { - if o != nil && o.Permissions != nil { - return true - } - - return false -} - -// SetPermissions gets a reference to the given RelationshipToPermissions and assigns it to the Permissions field. -func (o *RoleRelationships) SetPermissions(v RelationshipToPermissions) { - o.Permissions = &v -} - -// GetUsers returns the Users field value if set, zero value otherwise. -func (o *RoleRelationships) GetUsers() RelationshipToUsers { - if o == nil || o.Users == nil { - var ret RelationshipToUsers - return ret - } - return *o.Users -} - -// GetUsersOk returns a tuple with the Users field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleRelationships) GetUsersOk() (*RelationshipToUsers, bool) { - if o == nil || o.Users == nil { - return nil, false - } - return o.Users, true -} - -// HasUsers returns a boolean if a field has been set. -func (o *RoleRelationships) HasUsers() bool { - if o != nil && o.Users != nil { - return true - } - - return false -} - -// SetUsers gets a reference to the given RelationshipToUsers and assigns it to the Users field. -func (o *RoleRelationships) SetUsers(v RelationshipToUsers) { - o.Users = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Permissions != nil { - toSerialize["permissions"] = o.Permissions - } - if o.Users != nil { - toSerialize["users"] = o.Users - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Permissions *RelationshipToPermissions `json:"permissions,omitempty"` - Users *RelationshipToUsers `json:"users,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Permissions != nil && all.Permissions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Permissions = all.Permissions - if all.Users != nil && all.Users.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Users = all.Users - return nil -} diff --git a/api/v2/datadog/model_role_response.go b/api/v2/datadog/model_role_response.go deleted file mode 100644 index 0e54a41968b..00000000000 --- a/api/v2/datadog/model_role_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RoleResponse Response containing information about a single role. -type RoleResponse struct { - // Role object returned by the API. - Data *Role `json:"data,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{} -} - -// NewRoleResponse instantiates a new RoleResponse 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 NewRoleResponse() *RoleResponse { - this := RoleResponse{} - return &this -} - -// NewRoleResponseWithDefaults instantiates a new RoleResponse 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 NewRoleResponseWithDefaults() *RoleResponse { - this := RoleResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RoleResponse) GetData() Role { - if o == nil || o.Data == nil { - var ret Role - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleResponse) GetDataOk() (*Role, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RoleResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given Role and assigns it to the Data field. -func (o *RoleResponse) SetData(v Role) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *Role `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_role_response_relationships.go b/api/v2/datadog/model_role_response_relationships.go deleted file mode 100644 index 9a78b0bfa4a..00000000000 --- a/api/v2/datadog/model_role_response_relationships.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RoleResponseRelationships Relationships of the role object returned by the API. -type RoleResponseRelationships struct { - // Relationship to multiple permissions objects. - Permissions *RelationshipToPermissions `json:"permissions,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{} -} - -// NewRoleResponseRelationships instantiates a new RoleResponseRelationships 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 NewRoleResponseRelationships() *RoleResponseRelationships { - this := RoleResponseRelationships{} - return &this -} - -// NewRoleResponseRelationshipsWithDefaults instantiates a new RoleResponseRelationships 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 NewRoleResponseRelationshipsWithDefaults() *RoleResponseRelationships { - this := RoleResponseRelationships{} - return &this -} - -// GetPermissions returns the Permissions field value if set, zero value otherwise. -func (o *RoleResponseRelationships) GetPermissions() RelationshipToPermissions { - if o == nil || o.Permissions == nil { - var ret RelationshipToPermissions - return ret - } - return *o.Permissions -} - -// GetPermissionsOk returns a tuple with the Permissions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleResponseRelationships) GetPermissionsOk() (*RelationshipToPermissions, bool) { - if o == nil || o.Permissions == nil { - return nil, false - } - return o.Permissions, true -} - -// HasPermissions returns a boolean if a field has been set. -func (o *RoleResponseRelationships) HasPermissions() bool { - if o != nil && o.Permissions != nil { - return true - } - - return false -} - -// SetPermissions gets a reference to the given RelationshipToPermissions and assigns it to the Permissions field. -func (o *RoleResponseRelationships) SetPermissions(v RelationshipToPermissions) { - o.Permissions = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleResponseRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Permissions != nil { - toSerialize["permissions"] = o.Permissions - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Permissions *RelationshipToPermissions `json:"permissions,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Permissions != nil && all.Permissions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Permissions = all.Permissions - return nil -} diff --git a/api/v2/datadog/model_role_update_attributes.go b/api/v2/datadog/model_role_update_attributes.go deleted file mode 100644 index bde7c9959b0..00000000000 --- a/api/v2/datadog/model_role_update_attributes.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// RoleUpdateAttributes Attributes of the role. -type RoleUpdateAttributes struct { - // Creation time of the role. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Time of last role modification. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // Name of the role. - Name *string `json:"name,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{} -} - -// NewRoleUpdateAttributes instantiates a new RoleUpdateAttributes 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 NewRoleUpdateAttributes() *RoleUpdateAttributes { - this := RoleUpdateAttributes{} - return &this -} - -// NewRoleUpdateAttributesWithDefaults instantiates a new RoleUpdateAttributes 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 NewRoleUpdateAttributesWithDefaults() *RoleUpdateAttributes { - this := RoleUpdateAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *RoleUpdateAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleUpdateAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *RoleUpdateAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *RoleUpdateAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *RoleUpdateAttributes) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleUpdateAttributes) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *RoleUpdateAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *RoleUpdateAttributes) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *RoleUpdateAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *RoleUpdateAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *RoleUpdateAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.ModifiedAt = all.ModifiedAt - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_role_update_data.go b/api/v2/datadog/model_role_update_data.go deleted file mode 100644 index 9af2d0808cb..00000000000 --- a/api/v2/datadog/model_role_update_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleUpdateData Data related to the update of a role. -type RoleUpdateData struct { - // Attributes of the role. - Attributes RoleUpdateAttributes `json:"attributes"` - // The unique identifier of the role. - Id string `json:"id"` - // Roles type. - Type RolesType `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{} -} - -// NewRoleUpdateData instantiates a new RoleUpdateData 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 NewRoleUpdateData(attributes RoleUpdateAttributes, id string, typeVar RolesType) *RoleUpdateData { - this := RoleUpdateData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewRoleUpdateDataWithDefaults instantiates a new RoleUpdateData 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 NewRoleUpdateDataWithDefaults() *RoleUpdateData { - this := RoleUpdateData{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *RoleUpdateData) GetAttributes() RoleUpdateAttributes { - if o == nil { - var ret RoleUpdateAttributes - 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 *RoleUpdateData) GetAttributesOk() (*RoleUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *RoleUpdateData) SetAttributes(v RoleUpdateAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *RoleUpdateData) 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 *RoleUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *RoleUpdateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *RoleUpdateData) GetType() RolesType { - if o == nil { - var ret RolesType - 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 *RoleUpdateData) GetTypeOk() (*RolesType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RoleUpdateData) SetType(v RolesType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *RoleUpdateAttributes `json:"attributes"` - Id *string `json:"id"` - Type *RolesType `json:"type"` - }{} - all := struct { - Attributes RoleUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type RolesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_role_update_request.go b/api/v2/datadog/model_role_update_request.go deleted file mode 100644 index efd22b877f1..00000000000 --- a/api/v2/datadog/model_role_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleUpdateRequest Update a role. -type RoleUpdateRequest struct { - // Data related to the update of a role. - Data RoleUpdateData `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{} -} - -// NewRoleUpdateRequest instantiates a new RoleUpdateRequest 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 NewRoleUpdateRequest(data RoleUpdateData) *RoleUpdateRequest { - this := RoleUpdateRequest{} - this.Data = data - return &this -} - -// NewRoleUpdateRequestWithDefaults instantiates a new RoleUpdateRequest 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 NewRoleUpdateRequestWithDefaults() *RoleUpdateRequest { - this := RoleUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *RoleUpdateRequest) GetData() RoleUpdateData { - if o == nil { - var ret RoleUpdateData - 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 *RoleUpdateRequest) GetDataOk() (*RoleUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RoleUpdateRequest) SetData(v RoleUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *RoleUpdateData `json:"data"` - }{} - all := struct { - Data RoleUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_role_update_response.go b/api/v2/datadog/model_role_update_response.go deleted file mode 100644 index 5e06041aac8..00000000000 --- a/api/v2/datadog/model_role_update_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RoleUpdateResponse Response containing information about an updated role. -type RoleUpdateResponse struct { - // Role object returned by the API. - Data *RoleUpdateResponseData `json:"data,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{} -} - -// NewRoleUpdateResponse instantiates a new RoleUpdateResponse 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 NewRoleUpdateResponse() *RoleUpdateResponse { - this := RoleUpdateResponse{} - return &this -} - -// NewRoleUpdateResponseWithDefaults instantiates a new RoleUpdateResponse 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 NewRoleUpdateResponseWithDefaults() *RoleUpdateResponse { - this := RoleUpdateResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RoleUpdateResponse) GetData() RoleUpdateResponseData { - if o == nil || o.Data == nil { - var ret RoleUpdateResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleUpdateResponse) GetDataOk() (*RoleUpdateResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RoleUpdateResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given RoleUpdateResponseData and assigns it to the Data field. -func (o *RoleUpdateResponse) SetData(v RoleUpdateResponseData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleUpdateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *RoleUpdateResponseData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_role_update_response_data.go b/api/v2/datadog/model_role_update_response_data.go deleted file mode 100644 index 666fc605569..00000000000 --- a/api/v2/datadog/model_role_update_response_data.go +++ /dev/null @@ -1,244 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RoleUpdateResponseData Role object returned by the API. -type RoleUpdateResponseData struct { - // Attributes of the role. - Attributes *RoleUpdateAttributes `json:"attributes,omitempty"` - // The unique identifier of the role. - Id *string `json:"id,omitempty"` - // Relationships of the role object returned by the API. - Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - // Roles type. - Type RolesType `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{} -} - -// NewRoleUpdateResponseData instantiates a new RoleUpdateResponseData 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 NewRoleUpdateResponseData(typeVar RolesType) *RoleUpdateResponseData { - this := RoleUpdateResponseData{} - this.Type = typeVar - return &this -} - -// NewRoleUpdateResponseDataWithDefaults instantiates a new RoleUpdateResponseData 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 NewRoleUpdateResponseDataWithDefaults() *RoleUpdateResponseData { - this := RoleUpdateResponseData{} - var typeVar RolesType = ROLESTYPE_ROLES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *RoleUpdateResponseData) GetAttributes() RoleUpdateAttributes { - if o == nil || o.Attributes == nil { - var ret RoleUpdateAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleUpdateResponseData) GetAttributesOk() (*RoleUpdateAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *RoleUpdateResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given RoleUpdateAttributes and assigns it to the Attributes field. -func (o *RoleUpdateResponseData) SetAttributes(v RoleUpdateAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *RoleUpdateResponseData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleUpdateResponseData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *RoleUpdateResponseData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *RoleUpdateResponseData) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *RoleUpdateResponseData) GetRelationships() RoleResponseRelationships { - if o == nil || o.Relationships == nil { - var ret RoleResponseRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleUpdateResponseData) GetRelationshipsOk() (*RoleResponseRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *RoleUpdateResponseData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given RoleResponseRelationships and assigns it to the Relationships field. -func (o *RoleUpdateResponseData) SetRelationships(v RoleResponseRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *RoleUpdateResponseData) GetType() RolesType { - if o == nil { - var ret RolesType - 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 *RoleUpdateResponseData) GetTypeOk() (*RolesType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RoleUpdateResponseData) SetType(v RolesType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RoleUpdateResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Type *RolesType `json:"type"` - }{} - all := struct { - Attributes *RoleUpdateAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - Type RolesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_roles_response.go b/api/v2/datadog/model_roles_response.go deleted file mode 100644 index bb901f98c5c..00000000000 --- a/api/v2/datadog/model_roles_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RolesResponse Response containing information about multiple roles. -type RolesResponse struct { - // Array of returned roles. - Data []Role `json:"data,omitempty"` - // Object describing meta attributes of response. - Meta *ResponseMetaAttributes `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{} -} - -// NewRolesResponse instantiates a new RolesResponse 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 NewRolesResponse() *RolesResponse { - this := RolesResponse{} - return &this -} - -// NewRolesResponseWithDefaults instantiates a new RolesResponse 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 NewRolesResponseWithDefaults() *RolesResponse { - this := RolesResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RolesResponse) GetData() []Role { - if o == nil || o.Data == nil { - var ret []Role - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RolesResponse) GetDataOk() (*[]Role, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RolesResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []Role and assigns it to the Data field. -func (o *RolesResponse) SetData(v []Role) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *RolesResponse) GetMeta() ResponseMetaAttributes { - if o == nil || o.Meta == nil { - var ret ResponseMetaAttributes - 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 *RolesResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *RolesResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. -func (o *RolesResponse) SetMeta(v ResponseMetaAttributes) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RolesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RolesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []Role `json:"data,omitempty"` - Meta *ResponseMetaAttributes `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_roles_sort.go b/api/v2/datadog/model_roles_sort.go deleted file mode 100644 index 44c78b29014..00000000000 --- a/api/v2/datadog/model_roles_sort.go +++ /dev/null @@ -1,117 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RolesSort Sorting options for roles. -type RolesSort string - -// List of RolesSort. -const ( - ROLESSORT_NAME_ASCENDING RolesSort = "name" - ROLESSORT_NAME_DESCENDING RolesSort = "-name" - ROLESSORT_MODIFIED_AT_ASCENDING RolesSort = "modified_at" - ROLESSORT_MODIFIED_AT_DESCENDING RolesSort = "-modified_at" - ROLESSORT_USER_COUNT_ASCENDING RolesSort = "user_count" - ROLESSORT_USER_COUNT_DESCENDING RolesSort = "-user_count" -) - -var allowedRolesSortEnumValues = []RolesSort{ - ROLESSORT_NAME_ASCENDING, - ROLESSORT_NAME_DESCENDING, - ROLESSORT_MODIFIED_AT_ASCENDING, - ROLESSORT_MODIFIED_AT_DESCENDING, - ROLESSORT_USER_COUNT_ASCENDING, - ROLESSORT_USER_COUNT_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RolesSort) GetAllowedValues() []RolesSort { - return allowedRolesSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RolesSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RolesSort(value) - return nil -} - -// NewRolesSortFromValue returns a pointer to a valid RolesSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRolesSortFromValue(v string) (*RolesSort, error) { - ev := RolesSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RolesSort: valid values are %v", v, allowedRolesSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RolesSort) IsValid() bool { - for _, existing := range allowedRolesSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RolesSort value. -func (v RolesSort) Ptr() *RolesSort { - return &v -} - -// NullableRolesSort handles when a null is used for RolesSort. -type NullableRolesSort struct { - value *RolesSort - isSet bool -} - -// Get returns the associated value. -func (v NullableRolesSort) Get() *RolesSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRolesSort) Set(val *RolesSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRolesSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRolesSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRolesSort initializes the struct as if Set has been called. -func NewNullableRolesSort(val *RolesSort) *NullableRolesSort { - return &NullableRolesSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRolesSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRolesSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_roles_type.go b/api/v2/datadog/model_roles_type.go deleted file mode 100644 index 9733b5927f7..00000000000 --- a/api/v2/datadog/model_roles_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RolesType Roles type. -type RolesType string - -// List of RolesType. -const ( - ROLESTYPE_ROLES RolesType = "roles" -) - -var allowedRolesTypeEnumValues = []RolesType{ - ROLESTYPE_ROLES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RolesType) GetAllowedValues() []RolesType { - return allowedRolesTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RolesType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RolesType(value) - return nil -} - -// NewRolesTypeFromValue returns a pointer to a valid RolesType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRolesTypeFromValue(v string) (*RolesType, error) { - ev := RolesType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RolesType: valid values are %v", v, allowedRolesTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RolesType) IsValid() bool { - for _, existing := range allowedRolesTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RolesType value. -func (v RolesType) Ptr() *RolesType { - return &v -} - -// NullableRolesType handles when a null is used for RolesType. -type NullableRolesType struct { - value *RolesType - isSet bool -} - -// Get returns the associated value. -func (v NullableRolesType) Get() *RolesType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRolesType) Set(val *RolesType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRolesType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRolesType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRolesType initializes the struct as if Set has been called. -func NewNullableRolesType(val *RolesType) *NullableRolesType { - return &NullableRolesType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRolesType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRolesType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_aggregate_bucket_value.go b/api/v2/datadog/model_rum_aggregate_bucket_value.go deleted file mode 100644 index 73c13fee9fe..00000000000 --- a/api/v2/datadog/model_rum_aggregate_bucket_value.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMAggregateBucketValue - A bucket value, can be either a timeseries or a single value. -type RUMAggregateBucketValue struct { - RUMAggregateBucketValueSingleString *string - RUMAggregateBucketValueSingleNumber *float64 - RUMAggregateBucketValueTimeseries *RUMAggregateBucketValueTimeseries - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// RUMAggregateBucketValueSingleStringAsRUMAggregateBucketValue is a convenience function that returns string wrapped in RUMAggregateBucketValue. -func RUMAggregateBucketValueSingleStringAsRUMAggregateBucketValue(v *string) RUMAggregateBucketValue { - return RUMAggregateBucketValue{RUMAggregateBucketValueSingleString: v} -} - -// RUMAggregateBucketValueSingleNumberAsRUMAggregateBucketValue is a convenience function that returns float64 wrapped in RUMAggregateBucketValue. -func RUMAggregateBucketValueSingleNumberAsRUMAggregateBucketValue(v *float64) RUMAggregateBucketValue { - return RUMAggregateBucketValue{RUMAggregateBucketValueSingleNumber: v} -} - -// RUMAggregateBucketValueTimeseriesAsRUMAggregateBucketValue is a convenience function that returns RUMAggregateBucketValueTimeseries wrapped in RUMAggregateBucketValue. -func RUMAggregateBucketValueTimeseriesAsRUMAggregateBucketValue(v *RUMAggregateBucketValueTimeseries) RUMAggregateBucketValue { - return RUMAggregateBucketValue{RUMAggregateBucketValueTimeseries: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *RUMAggregateBucketValue) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into RUMAggregateBucketValueSingleString - err = json.Unmarshal(data, &obj.RUMAggregateBucketValueSingleString) - if err == nil { - if obj.RUMAggregateBucketValueSingleString != nil { - jsonRUMAggregateBucketValueSingleString, _ := json.Marshal(obj.RUMAggregateBucketValueSingleString) - if string(jsonRUMAggregateBucketValueSingleString) == "{}" { // empty struct - obj.RUMAggregateBucketValueSingleString = nil - } else { - match++ - } - } else { - obj.RUMAggregateBucketValueSingleString = nil - } - } else { - obj.RUMAggregateBucketValueSingleString = nil - } - - // try to unmarshal data into RUMAggregateBucketValueSingleNumber - err = json.Unmarshal(data, &obj.RUMAggregateBucketValueSingleNumber) - if err == nil { - if obj.RUMAggregateBucketValueSingleNumber != nil { - jsonRUMAggregateBucketValueSingleNumber, _ := json.Marshal(obj.RUMAggregateBucketValueSingleNumber) - if string(jsonRUMAggregateBucketValueSingleNumber) == "{}" { // empty struct - obj.RUMAggregateBucketValueSingleNumber = nil - } else { - match++ - } - } else { - obj.RUMAggregateBucketValueSingleNumber = nil - } - } else { - obj.RUMAggregateBucketValueSingleNumber = nil - } - - // try to unmarshal data into RUMAggregateBucketValueTimeseries - err = json.Unmarshal(data, &obj.RUMAggregateBucketValueTimeseries) - if err == nil { - if obj.RUMAggregateBucketValueTimeseries != nil { - jsonRUMAggregateBucketValueTimeseries, _ := json.Marshal(obj.RUMAggregateBucketValueTimeseries) - if string(jsonRUMAggregateBucketValueTimeseries) == "{}" { // empty struct - obj.RUMAggregateBucketValueTimeseries = nil - } else { - match++ - } - } else { - obj.RUMAggregateBucketValueTimeseries = nil - } - } else { - obj.RUMAggregateBucketValueTimeseries = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.RUMAggregateBucketValueSingleString = nil - obj.RUMAggregateBucketValueSingleNumber = nil - obj.RUMAggregateBucketValueTimeseries = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj RUMAggregateBucketValue) MarshalJSON() ([]byte, error) { - if obj.RUMAggregateBucketValueSingleString != nil { - return json.Marshal(&obj.RUMAggregateBucketValueSingleString) - } - - if obj.RUMAggregateBucketValueSingleNumber != nil { - return json.Marshal(&obj.RUMAggregateBucketValueSingleNumber) - } - - if obj.RUMAggregateBucketValueTimeseries != nil { - return json.Marshal(&obj.RUMAggregateBucketValueTimeseries) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *RUMAggregateBucketValue) GetActualInstance() interface{} { - if obj.RUMAggregateBucketValueSingleString != nil { - return obj.RUMAggregateBucketValueSingleString - } - - if obj.RUMAggregateBucketValueSingleNumber != nil { - return obj.RUMAggregateBucketValueSingleNumber - } - - if obj.RUMAggregateBucketValueTimeseries != nil { - return obj.RUMAggregateBucketValueTimeseries - } - - // all schemas are nil - return nil -} - -// NullableRUMAggregateBucketValue handles when a null is used for RUMAggregateBucketValue. -type NullableRUMAggregateBucketValue struct { - value *RUMAggregateBucketValue - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMAggregateBucketValue) Get() *RUMAggregateBucketValue { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMAggregateBucketValue) Set(val *RUMAggregateBucketValue) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMAggregateBucketValue) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableRUMAggregateBucketValue) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMAggregateBucketValue initializes the struct as if Set has been called. -func NewNullableRUMAggregateBucketValue(val *RUMAggregateBucketValue) *NullableRUMAggregateBucketValue { - return &NullableRUMAggregateBucketValue{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMAggregateBucketValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMAggregateBucketValue) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go b/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go deleted file mode 100644 index fa8bee3d0a3..00000000000 --- a/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go +++ /dev/null @@ -1,51 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMAggregateBucketValueTimeseries A timeseries array. -type RUMAggregateBucketValueTimeseries struct { - Items []RUMAggregateBucketValueTimeseriesPoint - - // UnparsedObject contains the raw value of the array if there was an error when deserializing into the struct - UnparsedObject []interface{} `json:-` -} - -// NewRUMAggregateBucketValueTimeseries instantiates a new RUMAggregateBucketValueTimeseries 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 NewRUMAggregateBucketValueTimeseries() *RUMAggregateBucketValueTimeseries { - this := RUMAggregateBucketValueTimeseries{} - return &this -} - -// NewRUMAggregateBucketValueTimeseriesWithDefaults instantiates a new RUMAggregateBucketValueTimeseries 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 NewRUMAggregateBucketValueTimeseriesWithDefaults() *RUMAggregateBucketValueTimeseries { - this := RUMAggregateBucketValueTimeseries{} - return &this -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { - toSerialize := make([]interface{}, len(o.Items)) - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - for i, item := range o.Items { - toSerialize[i] = item - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { - return json.Unmarshal(bytes, &o.Items) -} diff --git a/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go b/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go deleted file mode 100644 index c19f9a1970f..00000000000 --- a/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// RUMAggregateBucketValueTimeseriesPoint A timeseries point. -type RUMAggregateBucketValueTimeseriesPoint struct { - // The time value for this point. - Time *time.Time `json:"time,omitempty"` - // The value for this point. - Value *float64 `json:"value,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{} -} - -// NewRUMAggregateBucketValueTimeseriesPoint instantiates a new RUMAggregateBucketValueTimeseriesPoint 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 NewRUMAggregateBucketValueTimeseriesPoint() *RUMAggregateBucketValueTimeseriesPoint { - this := RUMAggregateBucketValueTimeseriesPoint{} - return &this -} - -// NewRUMAggregateBucketValueTimeseriesPointWithDefaults instantiates a new RUMAggregateBucketValueTimeseriesPoint 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 NewRUMAggregateBucketValueTimeseriesPointWithDefaults() *RUMAggregateBucketValueTimeseriesPoint { - this := RUMAggregateBucketValueTimeseriesPoint{} - return &this -} - -// GetTime returns the Time field value if set, zero value otherwise. -func (o *RUMAggregateBucketValueTimeseriesPoint) GetTime() time.Time { - if o == nil || o.Time == nil { - var ret time.Time - return ret - } - return *o.Time -} - -// GetTimeOk returns a tuple with the Time field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateBucketValueTimeseriesPoint) GetTimeOk() (*time.Time, bool) { - if o == nil || o.Time == nil { - return nil, false - } - return o.Time, true -} - -// HasTime returns a boolean if a field has been set. -func (o *RUMAggregateBucketValueTimeseriesPoint) HasTime() bool { - if o != nil && o.Time != nil { - return true - } - - return false -} - -// SetTime gets a reference to the given time.Time and assigns it to the Time field. -func (o *RUMAggregateBucketValueTimeseriesPoint) SetTime(v time.Time) { - o.Time = &v -} - -// GetValue returns the Value field value if set, zero value otherwise. -func (o *RUMAggregateBucketValueTimeseriesPoint) GetValue() float64 { - if o == nil || o.Value == nil { - var ret float64 - return ret - } - return *o.Value -} - -// GetValueOk returns a tuple with the Value field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateBucketValueTimeseriesPoint) GetValueOk() (*float64, bool) { - if o == nil || o.Value == nil { - return nil, false - } - return o.Value, true -} - -// HasValue returns a boolean if a field has been set. -func (o *RUMAggregateBucketValueTimeseriesPoint) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given float64 and assigns it to the Value field. -func (o *RUMAggregateBucketValueTimeseriesPoint) SetValue(v float64) { - o.Value = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Time != nil { - if o.Time.Nanosecond() == 0 { - toSerialize["time"] = o.Time.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["time"] = o.Time.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Value != nil { - toSerialize["value"] = o.Value - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Time *time.Time `json:"time,omitempty"` - Value *float64 `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Time = all.Time - o.Value = all.Value - return nil -} diff --git a/api/v2/datadog/model_rum_aggregate_request.go b/api/v2/datadog/model_rum_aggregate_request.go deleted file mode 100644 index ff3580a7cc5..00000000000 --- a/api/v2/datadog/model_rum_aggregate_request.go +++ /dev/null @@ -1,280 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMAggregateRequest The object sent with the request to retrieve aggregation buckets of RUM events from your organization. -type RUMAggregateRequest struct { - // The list of metrics or timeseries to compute for the retrieved buckets. - Compute []RUMCompute `json:"compute,omitempty"` - // The search and filter query settings. - Filter *RUMQueryFilter `json:"filter,omitempty"` - // The rules for the group by. - GroupBy []RUMGroupBy `json:"group_by,omitempty"` - // Global query options that are used during the query. - // Note: Only supply timezone or time offset, not both. Otherwise, the query fails. - Options *RUMQueryOptions `json:"options,omitempty"` - // Paging attributes for listing events. - Page *RUMQueryPageOptions `json:"page,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{} -} - -// NewRUMAggregateRequest instantiates a new RUMAggregateRequest 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 NewRUMAggregateRequest() *RUMAggregateRequest { - this := RUMAggregateRequest{} - return &this -} - -// NewRUMAggregateRequestWithDefaults instantiates a new RUMAggregateRequest 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 NewRUMAggregateRequestWithDefaults() *RUMAggregateRequest { - this := RUMAggregateRequest{} - return &this -} - -// GetCompute returns the Compute field value if set, zero value otherwise. -func (o *RUMAggregateRequest) GetCompute() []RUMCompute { - if o == nil || o.Compute == nil { - var ret []RUMCompute - return ret - } - return o.Compute -} - -// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateRequest) GetComputeOk() (*[]RUMCompute, bool) { - if o == nil || o.Compute == nil { - return nil, false - } - return &o.Compute, true -} - -// HasCompute returns a boolean if a field has been set. -func (o *RUMAggregateRequest) HasCompute() bool { - if o != nil && o.Compute != nil { - return true - } - - return false -} - -// SetCompute gets a reference to the given []RUMCompute and assigns it to the Compute field. -func (o *RUMAggregateRequest) SetCompute(v []RUMCompute) { - o.Compute = v -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *RUMAggregateRequest) GetFilter() RUMQueryFilter { - if o == nil || o.Filter == nil { - var ret RUMQueryFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateRequest) GetFilterOk() (*RUMQueryFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *RUMAggregateRequest) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given RUMQueryFilter and assigns it to the Filter field. -func (o *RUMAggregateRequest) SetFilter(v RUMQueryFilter) { - o.Filter = &v -} - -// GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *RUMAggregateRequest) GetGroupBy() []RUMGroupBy { - if o == nil || o.GroupBy == nil { - var ret []RUMGroupBy - return ret - } - return o.GroupBy -} - -// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateRequest) GetGroupByOk() (*[]RUMGroupBy, bool) { - if o == nil || o.GroupBy == nil { - return nil, false - } - return &o.GroupBy, true -} - -// HasGroupBy returns a boolean if a field has been set. -func (o *RUMAggregateRequest) HasGroupBy() bool { - if o != nil && o.GroupBy != nil { - return true - } - - return false -} - -// SetGroupBy gets a reference to the given []RUMGroupBy and assigns it to the GroupBy field. -func (o *RUMAggregateRequest) SetGroupBy(v []RUMGroupBy) { - o.GroupBy = v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *RUMAggregateRequest) GetOptions() RUMQueryOptions { - if o == nil || o.Options == nil { - var ret RUMQueryOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateRequest) GetOptionsOk() (*RUMQueryOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *RUMAggregateRequest) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given RUMQueryOptions and assigns it to the Options field. -func (o *RUMAggregateRequest) SetOptions(v RUMQueryOptions) { - o.Options = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *RUMAggregateRequest) GetPage() RUMQueryPageOptions { - if o == nil || o.Page == nil { - var ret RUMQueryPageOptions - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateRequest) GetPageOk() (*RUMQueryPageOptions, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *RUMAggregateRequest) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given RUMQueryPageOptions and assigns it to the Page field. -func (o *RUMAggregateRequest) SetPage(v RUMQueryPageOptions) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMAggregateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Compute != nil { - toSerialize["compute"] = o.Compute - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.GroupBy != nil { - toSerialize["group_by"] = o.GroupBy - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Compute []RUMCompute `json:"compute,omitempty"` - Filter *RUMQueryFilter `json:"filter,omitempty"` - GroupBy []RUMGroupBy `json:"group_by,omitempty"` - Options *RUMQueryOptions `json:"options,omitempty"` - Page *RUMQueryPageOptions `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Compute = all.Compute - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - o.GroupBy = all.GroupBy - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v2/datadog/model_rum_aggregate_sort.go b/api/v2/datadog/model_rum_aggregate_sort.go deleted file mode 100644 index 2b3bb88883b..00000000000 --- a/api/v2/datadog/model_rum_aggregate_sort.go +++ /dev/null @@ -1,247 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMAggregateSort A sort rule. -type RUMAggregateSort struct { - // An aggregation function. - Aggregation *RUMAggregationFunction `json:"aggregation,omitempty"` - // The metric to sort by (only used for `type=measure`). - Metric *string `json:"metric,omitempty"` - // The order to use, ascending or descending. - Order *RUMSortOrder `json:"order,omitempty"` - // The type of sorting algorithm. - Type *RUMAggregateSortType `json:"type,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{} -} - -// NewRUMAggregateSort instantiates a new RUMAggregateSort 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 NewRUMAggregateSort() *RUMAggregateSort { - this := RUMAggregateSort{} - var typeVar RUMAggregateSortType = RUMAGGREGATESORTTYPE_ALPHABETICAL - this.Type = &typeVar - return &this -} - -// NewRUMAggregateSortWithDefaults instantiates a new RUMAggregateSort 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 NewRUMAggregateSortWithDefaults() *RUMAggregateSort { - this := RUMAggregateSort{} - var typeVar RUMAggregateSortType = RUMAGGREGATESORTTYPE_ALPHABETICAL - this.Type = &typeVar - return &this -} - -// GetAggregation returns the Aggregation field value if set, zero value otherwise. -func (o *RUMAggregateSort) GetAggregation() RUMAggregationFunction { - if o == nil || o.Aggregation == nil { - var ret RUMAggregationFunction - return ret - } - return *o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateSort) GetAggregationOk() (*RUMAggregationFunction, bool) { - if o == nil || o.Aggregation == nil { - return nil, false - } - return o.Aggregation, true -} - -// HasAggregation returns a boolean if a field has been set. -func (o *RUMAggregateSort) HasAggregation() bool { - if o != nil && o.Aggregation != nil { - return true - } - - return false -} - -// SetAggregation gets a reference to the given RUMAggregationFunction and assigns it to the Aggregation field. -func (o *RUMAggregateSort) SetAggregation(v RUMAggregationFunction) { - o.Aggregation = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *RUMAggregateSort) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateSort) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *RUMAggregateSort) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *RUMAggregateSort) SetMetric(v string) { - o.Metric = &v -} - -// GetOrder returns the Order field value if set, zero value otherwise. -func (o *RUMAggregateSort) GetOrder() RUMSortOrder { - if o == nil || o.Order == nil { - var ret RUMSortOrder - return ret - } - return *o.Order -} - -// GetOrderOk returns a tuple with the Order field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateSort) GetOrderOk() (*RUMSortOrder, bool) { - if o == nil || o.Order == nil { - return nil, false - } - return o.Order, true -} - -// HasOrder returns a boolean if a field has been set. -func (o *RUMAggregateSort) HasOrder() bool { - if o != nil && o.Order != nil { - return true - } - - return false -} - -// SetOrder gets a reference to the given RUMSortOrder and assigns it to the Order field. -func (o *RUMAggregateSort) SetOrder(v RUMSortOrder) { - o.Order = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *RUMAggregateSort) GetType() RUMAggregateSortType { - if o == nil || o.Type == nil { - var ret RUMAggregateSortType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregateSort) GetTypeOk() (*RUMAggregateSortType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *RUMAggregateSort) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given RUMAggregateSortType and assigns it to the Type field. -func (o *RUMAggregateSort) SetType(v RUMAggregateSortType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMAggregateSort) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregation != nil { - toSerialize["aggregation"] = o.Aggregation - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Order != nil { - toSerialize["order"] = o.Order - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMAggregateSort) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregation *RUMAggregationFunction `json:"aggregation,omitempty"` - Metric *string `json:"metric,omitempty"` - Order *RUMSortOrder `json:"order,omitempty"` - Type *RUMAggregateSortType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Order; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Metric = all.Metric - o.Order = all.Order - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_rum_aggregate_sort_type.go b/api/v2/datadog/model_rum_aggregate_sort_type.go deleted file mode 100644 index dda387f2fc9..00000000000 --- a/api/v2/datadog/model_rum_aggregate_sort_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMAggregateSortType The type of sorting algorithm. -type RUMAggregateSortType string - -// List of RUMAggregateSortType. -const ( - RUMAGGREGATESORTTYPE_ALPHABETICAL RUMAggregateSortType = "alphabetical" - RUMAGGREGATESORTTYPE_MEASURE RUMAggregateSortType = "measure" -) - -var allowedRUMAggregateSortTypeEnumValues = []RUMAggregateSortType{ - RUMAGGREGATESORTTYPE_ALPHABETICAL, - RUMAGGREGATESORTTYPE_MEASURE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RUMAggregateSortType) GetAllowedValues() []RUMAggregateSortType { - return allowedRUMAggregateSortTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RUMAggregateSortType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RUMAggregateSortType(value) - return nil -} - -// NewRUMAggregateSortTypeFromValue returns a pointer to a valid RUMAggregateSortType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRUMAggregateSortTypeFromValue(v string) (*RUMAggregateSortType, error) { - ev := RUMAggregateSortType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RUMAggregateSortType: valid values are %v", v, allowedRUMAggregateSortTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RUMAggregateSortType) IsValid() bool { - for _, existing := range allowedRUMAggregateSortTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RUMAggregateSortType value. -func (v RUMAggregateSortType) Ptr() *RUMAggregateSortType { - return &v -} - -// NullableRUMAggregateSortType handles when a null is used for RUMAggregateSortType. -type NullableRUMAggregateSortType struct { - value *RUMAggregateSortType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMAggregateSortType) Get() *RUMAggregateSortType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMAggregateSortType) Set(val *RUMAggregateSortType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMAggregateSortType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMAggregateSortType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMAggregateSortType initializes the struct as if Set has been called. -func NewNullableRUMAggregateSortType(val *RUMAggregateSortType) *NullableRUMAggregateSortType { - return &NullableRUMAggregateSortType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMAggregateSortType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMAggregateSortType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_aggregation_buckets_response.go b/api/v2/datadog/model_rum_aggregation_buckets_response.go deleted file mode 100644 index 36a1699f5bf..00000000000 --- a/api/v2/datadog/model_rum_aggregation_buckets_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMAggregationBucketsResponse The query results. -type RUMAggregationBucketsResponse struct { - // The list of matching buckets, one item per bucket. - Buckets []RUMBucketResponse `json:"buckets,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{} -} - -// NewRUMAggregationBucketsResponse instantiates a new RUMAggregationBucketsResponse 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 NewRUMAggregationBucketsResponse() *RUMAggregationBucketsResponse { - this := RUMAggregationBucketsResponse{} - return &this -} - -// NewRUMAggregationBucketsResponseWithDefaults instantiates a new RUMAggregationBucketsResponse 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 NewRUMAggregationBucketsResponseWithDefaults() *RUMAggregationBucketsResponse { - this := RUMAggregationBucketsResponse{} - return &this -} - -// GetBuckets returns the Buckets field value if set, zero value otherwise. -func (o *RUMAggregationBucketsResponse) GetBuckets() []RUMBucketResponse { - if o == nil || o.Buckets == nil { - var ret []RUMBucketResponse - return ret - } - return o.Buckets -} - -// GetBucketsOk returns a tuple with the Buckets field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAggregationBucketsResponse) GetBucketsOk() (*[]RUMBucketResponse, bool) { - if o == nil || o.Buckets == nil { - return nil, false - } - return &o.Buckets, true -} - -// HasBuckets returns a boolean if a field has been set. -func (o *RUMAggregationBucketsResponse) HasBuckets() bool { - if o != nil && o.Buckets != nil { - return true - } - - return false -} - -// SetBuckets gets a reference to the given []RUMBucketResponse and assigns it to the Buckets field. -func (o *RUMAggregationBucketsResponse) SetBuckets(v []RUMBucketResponse) { - o.Buckets = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMAggregationBucketsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Buckets != nil { - toSerialize["buckets"] = o.Buckets - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Buckets []RUMBucketResponse `json:"buckets,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Buckets = all.Buckets - return nil -} diff --git a/api/v2/datadog/model_rum_aggregation_function.go b/api/v2/datadog/model_rum_aggregation_function.go deleted file mode 100644 index 6b1eb75bcf8..00000000000 --- a/api/v2/datadog/model_rum_aggregation_function.go +++ /dev/null @@ -1,129 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMAggregationFunction An aggregation function. -type RUMAggregationFunction string - -// List of RUMAggregationFunction. -const ( - RUMAGGREGATIONFUNCTION_COUNT RUMAggregationFunction = "count" - RUMAGGREGATIONFUNCTION_CARDINALITY RUMAggregationFunction = "cardinality" - RUMAGGREGATIONFUNCTION_PERCENTILE_75 RUMAggregationFunction = "pc75" - RUMAGGREGATIONFUNCTION_PERCENTILE_90 RUMAggregationFunction = "pc90" - RUMAGGREGATIONFUNCTION_PERCENTILE_95 RUMAggregationFunction = "pc95" - RUMAGGREGATIONFUNCTION_PERCENTILE_98 RUMAggregationFunction = "pc98" - RUMAGGREGATIONFUNCTION_PERCENTILE_99 RUMAggregationFunction = "pc99" - RUMAGGREGATIONFUNCTION_SUM RUMAggregationFunction = "sum" - RUMAGGREGATIONFUNCTION_MIN RUMAggregationFunction = "min" - RUMAGGREGATIONFUNCTION_MAX RUMAggregationFunction = "max" - RUMAGGREGATIONFUNCTION_AVG RUMAggregationFunction = "avg" - RUMAGGREGATIONFUNCTION_MEDIAN RUMAggregationFunction = "median" -) - -var allowedRUMAggregationFunctionEnumValues = []RUMAggregationFunction{ - RUMAGGREGATIONFUNCTION_COUNT, - RUMAGGREGATIONFUNCTION_CARDINALITY, - RUMAGGREGATIONFUNCTION_PERCENTILE_75, - RUMAGGREGATIONFUNCTION_PERCENTILE_90, - RUMAGGREGATIONFUNCTION_PERCENTILE_95, - RUMAGGREGATIONFUNCTION_PERCENTILE_98, - RUMAGGREGATIONFUNCTION_PERCENTILE_99, - RUMAGGREGATIONFUNCTION_SUM, - RUMAGGREGATIONFUNCTION_MIN, - RUMAGGREGATIONFUNCTION_MAX, - RUMAGGREGATIONFUNCTION_AVG, - RUMAGGREGATIONFUNCTION_MEDIAN, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RUMAggregationFunction) GetAllowedValues() []RUMAggregationFunction { - return allowedRUMAggregationFunctionEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RUMAggregationFunction) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RUMAggregationFunction(value) - return nil -} - -// NewRUMAggregationFunctionFromValue returns a pointer to a valid RUMAggregationFunction -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRUMAggregationFunctionFromValue(v string) (*RUMAggregationFunction, error) { - ev := RUMAggregationFunction(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RUMAggregationFunction: valid values are %v", v, allowedRUMAggregationFunctionEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RUMAggregationFunction) IsValid() bool { - for _, existing := range allowedRUMAggregationFunctionEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RUMAggregationFunction value. -func (v RUMAggregationFunction) Ptr() *RUMAggregationFunction { - return &v -} - -// NullableRUMAggregationFunction handles when a null is used for RUMAggregationFunction. -type NullableRUMAggregationFunction struct { - value *RUMAggregationFunction - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMAggregationFunction) Get() *RUMAggregationFunction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMAggregationFunction) Set(val *RUMAggregationFunction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMAggregationFunction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMAggregationFunction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMAggregationFunction initializes the struct as if Set has been called. -func NewNullableRUMAggregationFunction(val *RUMAggregationFunction) *NullableRUMAggregationFunction { - return &NullableRUMAggregationFunction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMAggregationFunction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMAggregationFunction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_analytics_aggregate_response.go b/api/v2/datadog/model_rum_analytics_aggregate_response.go deleted file mode 100644 index e1f1beb02dc..00000000000 --- a/api/v2/datadog/model_rum_analytics_aggregate_response.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMAnalyticsAggregateResponse The response object for the RUM events aggregate API endpoint. -type RUMAnalyticsAggregateResponse struct { - // The query results. - Data *RUMAggregationBucketsResponse `json:"data,omitempty"` - // Links attributes. - Links *RUMResponseLinks `json:"links,omitempty"` - // The metadata associated with a request. - Meta *RUMResponseMetadata `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{} -} - -// NewRUMAnalyticsAggregateResponse instantiates a new RUMAnalyticsAggregateResponse 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 NewRUMAnalyticsAggregateResponse() *RUMAnalyticsAggregateResponse { - this := RUMAnalyticsAggregateResponse{} - return &this -} - -// NewRUMAnalyticsAggregateResponseWithDefaults instantiates a new RUMAnalyticsAggregateResponse 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 NewRUMAnalyticsAggregateResponseWithDefaults() *RUMAnalyticsAggregateResponse { - this := RUMAnalyticsAggregateResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RUMAnalyticsAggregateResponse) GetData() RUMAggregationBucketsResponse { - if o == nil || o.Data == nil { - var ret RUMAggregationBucketsResponse - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAnalyticsAggregateResponse) GetDataOk() (*RUMAggregationBucketsResponse, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RUMAnalyticsAggregateResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given RUMAggregationBucketsResponse and assigns it to the Data field. -func (o *RUMAnalyticsAggregateResponse) SetData(v RUMAggregationBucketsResponse) { - o.Data = &v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *RUMAnalyticsAggregateResponse) GetLinks() RUMResponseLinks { - if o == nil || o.Links == nil { - var ret RUMResponseLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMAnalyticsAggregateResponse) GetLinksOk() (*RUMResponseLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *RUMAnalyticsAggregateResponse) HasLinks() bool { - if o != nil && o.Links != nil { - return true - } - - return false -} - -// SetLinks gets a reference to the given RUMResponseLinks and assigns it to the Links field. -func (o *RUMAnalyticsAggregateResponse) SetLinks(v RUMResponseLinks) { - o.Links = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *RUMAnalyticsAggregateResponse) GetMeta() RUMResponseMetadata { - if o == nil || o.Meta == nil { - var ret RUMResponseMetadata - 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 *RUMAnalyticsAggregateResponse) GetMetaOk() (*RUMResponseMetadata, 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 *RUMAnalyticsAggregateResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given RUMResponseMetadata and assigns it to the Meta field. -func (o *RUMAnalyticsAggregateResponse) SetMeta(v RUMResponseMetadata) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMAnalyticsAggregateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *RUMAggregationBucketsResponse `json:"data,omitempty"` - Links *RUMResponseLinks `json:"links,omitempty"` - Meta *RUMResponseMetadata `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Links = all.Links - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_rum_bucket_response.go b/api/v2/datadog/model_rum_bucket_response.go deleted file mode 100644 index 8147efbc7de..00000000000 --- a/api/v2/datadog/model_rum_bucket_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMBucketResponse Bucket values. -type RUMBucketResponse struct { - // The key-value pairs for each group-by. - By map[string]string `json:"by,omitempty"` - // A map of the metric name to value for regular compute, or a list of values for a timeseries. - Computes map[string]RUMAggregateBucketValue `json:"computes,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{} -} - -// NewRUMBucketResponse instantiates a new RUMBucketResponse 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 NewRUMBucketResponse() *RUMBucketResponse { - this := RUMBucketResponse{} - return &this -} - -// NewRUMBucketResponseWithDefaults instantiates a new RUMBucketResponse 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 NewRUMBucketResponseWithDefaults() *RUMBucketResponse { - this := RUMBucketResponse{} - return &this -} - -// GetBy returns the By field value if set, zero value otherwise. -func (o *RUMBucketResponse) GetBy() map[string]string { - if o == nil || o.By == nil { - var ret map[string]string - return ret - } - return o.By -} - -// GetByOk returns a tuple with the By field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMBucketResponse) GetByOk() (*map[string]string, bool) { - if o == nil || o.By == nil { - return nil, false - } - return &o.By, true -} - -// HasBy returns a boolean if a field has been set. -func (o *RUMBucketResponse) HasBy() bool { - if o != nil && o.By != nil { - return true - } - - return false -} - -// SetBy gets a reference to the given map[string]string and assigns it to the By field. -func (o *RUMBucketResponse) SetBy(v map[string]string) { - o.By = v -} - -// GetComputes returns the Computes field value if set, zero value otherwise. -func (o *RUMBucketResponse) GetComputes() map[string]RUMAggregateBucketValue { - if o == nil || o.Computes == nil { - var ret map[string]RUMAggregateBucketValue - return ret - } - return o.Computes -} - -// GetComputesOk returns a tuple with the Computes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMBucketResponse) GetComputesOk() (*map[string]RUMAggregateBucketValue, bool) { - if o == nil || o.Computes == nil { - return nil, false - } - return &o.Computes, true -} - -// HasComputes returns a boolean if a field has been set. -func (o *RUMBucketResponse) HasComputes() bool { - if o != nil && o.Computes != nil { - return true - } - - return false -} - -// SetComputes gets a reference to the given map[string]RUMAggregateBucketValue and assigns it to the Computes field. -func (o *RUMBucketResponse) SetComputes(v map[string]RUMAggregateBucketValue) { - o.Computes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMBucketResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.By != nil { - toSerialize["by"] = o.By - } - if o.Computes != nil { - toSerialize["computes"] = o.Computes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMBucketResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - By map[string]string `json:"by,omitempty"` - Computes map[string]RUMAggregateBucketValue `json:"computes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.By = all.By - o.Computes = all.Computes - return nil -} diff --git a/api/v2/datadog/model_rum_compute.go b/api/v2/datadog/model_rum_compute.go deleted file mode 100644 index 8be6a04551b..00000000000 --- a/api/v2/datadog/model_rum_compute.go +++ /dev/null @@ -1,241 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMCompute A compute rule to compute metrics or timeseries. -type RUMCompute struct { - // An aggregation function. - Aggregation RUMAggregationFunction `json:"aggregation"` - // The time buckets' size (only used for type=timeseries) - // Defaults to a resolution of 150 points. - Interval *string `json:"interval,omitempty"` - // The metric to use. - Metric *string `json:"metric,omitempty"` - // The type of compute. - Type *RUMComputeType `json:"type,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{} -} - -// NewRUMCompute instantiates a new RUMCompute 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 NewRUMCompute(aggregation RUMAggregationFunction) *RUMCompute { - this := RUMCompute{} - this.Aggregation = aggregation - var typeVar RUMComputeType = RUMCOMPUTETYPE_TOTAL - this.Type = &typeVar - return &this -} - -// NewRUMComputeWithDefaults instantiates a new RUMCompute 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 NewRUMComputeWithDefaults() *RUMCompute { - this := RUMCompute{} - var typeVar RUMComputeType = RUMCOMPUTETYPE_TOTAL - this.Type = &typeVar - return &this -} - -// GetAggregation returns the Aggregation field value. -func (o *RUMCompute) GetAggregation() RUMAggregationFunction { - if o == nil { - var ret RUMAggregationFunction - return ret - } - return o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value -// and a boolean to check if the value has been set. -func (o *RUMCompute) GetAggregationOk() (*RUMAggregationFunction, bool) { - if o == nil { - return nil, false - } - return &o.Aggregation, true -} - -// SetAggregation sets field value. -func (o *RUMCompute) SetAggregation(v RUMAggregationFunction) { - o.Aggregation = v -} - -// GetInterval returns the Interval field value if set, zero value otherwise. -func (o *RUMCompute) GetInterval() string { - if o == nil || o.Interval == nil { - var ret string - return ret - } - return *o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMCompute) GetIntervalOk() (*string, bool) { - if o == nil || o.Interval == nil { - return nil, false - } - return o.Interval, true -} - -// HasInterval returns a boolean if a field has been set. -func (o *RUMCompute) HasInterval() bool { - if o != nil && o.Interval != nil { - return true - } - - return false -} - -// SetInterval gets a reference to the given string and assigns it to the Interval field. -func (o *RUMCompute) SetInterval(v string) { - o.Interval = &v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *RUMCompute) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMCompute) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *RUMCompute) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *RUMCompute) SetMetric(v string) { - o.Metric = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *RUMCompute) GetType() RUMComputeType { - if o == nil || o.Type == nil { - var ret RUMComputeType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMCompute) GetTypeOk() (*RUMComputeType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *RUMCompute) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given RUMComputeType and assigns it to the Type field. -func (o *RUMCompute) SetType(v RUMComputeType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMCompute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["aggregation"] = o.Aggregation - if o.Interval != nil { - toSerialize["interval"] = o.Interval - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Aggregation *RUMAggregationFunction `json:"aggregation"` - }{} - all := struct { - Aggregation RUMAggregationFunction `json:"aggregation"` - Interval *string `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` - Type *RUMComputeType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("Required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.Interval = all.Interval - o.Metric = all.Metric - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_rum_compute_type.go b/api/v2/datadog/model_rum_compute_type.go deleted file mode 100644 index 54457b96467..00000000000 --- a/api/v2/datadog/model_rum_compute_type.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMComputeType The type of compute. -type RUMComputeType string - -// List of RUMComputeType. -const ( - RUMCOMPUTETYPE_TIMESERIES RUMComputeType = "timeseries" - RUMCOMPUTETYPE_TOTAL RUMComputeType = "total" -) - -var allowedRUMComputeTypeEnumValues = []RUMComputeType{ - RUMCOMPUTETYPE_TIMESERIES, - RUMCOMPUTETYPE_TOTAL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RUMComputeType) GetAllowedValues() []RUMComputeType { - return allowedRUMComputeTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RUMComputeType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RUMComputeType(value) - return nil -} - -// NewRUMComputeTypeFromValue returns a pointer to a valid RUMComputeType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRUMComputeTypeFromValue(v string) (*RUMComputeType, error) { - ev := RUMComputeType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RUMComputeType: valid values are %v", v, allowedRUMComputeTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RUMComputeType) IsValid() bool { - for _, existing := range allowedRUMComputeTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RUMComputeType value. -func (v RUMComputeType) Ptr() *RUMComputeType { - return &v -} - -// NullableRUMComputeType handles when a null is used for RUMComputeType. -type NullableRUMComputeType struct { - value *RUMComputeType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMComputeType) Get() *RUMComputeType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMComputeType) Set(val *RUMComputeType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMComputeType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMComputeType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMComputeType initializes the struct as if Set has been called. -func NewNullableRUMComputeType(val *RUMComputeType) *NullableRUMComputeType { - return &NullableRUMComputeType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMComputeType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMComputeType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_event.go b/api/v2/datadog/model_rum_event.go deleted file mode 100644 index f2191e0ced9..00000000000 --- a/api/v2/datadog/model_rum_event.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMEvent Object description of a RUM event after being processed and stored by Datadog. -type RUMEvent struct { - // JSON object containing all event attributes and their associated values. - Attributes *RUMEventAttributes `json:"attributes,omitempty"` - // Unique ID of the event. - Id *string `json:"id,omitempty"` - // Type of the event. - Type *RUMEventType `json:"type,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{} -} - -// NewRUMEvent instantiates a new RUMEvent 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 NewRUMEvent() *RUMEvent { - this := RUMEvent{} - var typeVar RUMEventType = RUMEVENTTYPE_RUM - this.Type = &typeVar - return &this -} - -// NewRUMEventWithDefaults instantiates a new RUMEvent 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 NewRUMEventWithDefaults() *RUMEvent { - this := RUMEvent{} - var typeVar RUMEventType = RUMEVENTTYPE_RUM - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *RUMEvent) GetAttributes() RUMEventAttributes { - if o == nil || o.Attributes == nil { - var ret RUMEventAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMEvent) GetAttributesOk() (*RUMEventAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *RUMEvent) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given RUMEventAttributes and assigns it to the Attributes field. -func (o *RUMEvent) SetAttributes(v RUMEventAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *RUMEvent) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMEvent) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *RUMEvent) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *RUMEvent) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *RUMEvent) GetType() RUMEventType { - if o == nil || o.Type == nil { - var ret RUMEventType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMEvent) GetTypeOk() (*RUMEventType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *RUMEvent) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given RUMEventType and assigns it to the Type field. -func (o *RUMEvent) SetType(v RUMEventType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMEvent) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMEvent) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *RUMEventAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *RUMEventType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_rum_event_attributes.go b/api/v2/datadog/model_rum_event_attributes.go deleted file mode 100644 index b2fa6f049e7..00000000000 --- a/api/v2/datadog/model_rum_event_attributes.go +++ /dev/null @@ -1,226 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// RUMEventAttributes JSON object containing all event attributes and their associated values. -type RUMEventAttributes struct { - // JSON object of attributes from RUM events. - Attributes map[string]interface{} `json:"attributes,omitempty"` - // The name of the application or service generating RUM events. - // It is used to switch from RUM to APM, so make sure you define the same - // value when you use both products. - Service *string `json:"service,omitempty"` - // Array of tags associated with your event. - Tags []string `json:"tags,omitempty"` - // Timestamp of your event. - Timestamp *time.Time `json:"timestamp,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{} -} - -// NewRUMEventAttributes instantiates a new RUMEventAttributes 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 NewRUMEventAttributes() *RUMEventAttributes { - this := RUMEventAttributes{} - return &this -} - -// NewRUMEventAttributesWithDefaults instantiates a new RUMEventAttributes 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 NewRUMEventAttributesWithDefaults() *RUMEventAttributes { - this := RUMEventAttributes{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *RUMEventAttributes) GetAttributes() map[string]interface{} { - if o == nil || o.Attributes == nil { - var ret map[string]interface{} - return ret - } - return o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMEventAttributes) GetAttributesOk() (*map[string]interface{}, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return &o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *RUMEventAttributes) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. -func (o *RUMEventAttributes) SetAttributes(v map[string]interface{}) { - o.Attributes = v -} - -// GetService returns the Service field value if set, zero value otherwise. -func (o *RUMEventAttributes) 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 *RUMEventAttributes) 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 *RUMEventAttributes) HasService() bool { - if o != nil && o.Service != nil { - return true - } - - return false -} - -// SetService gets a reference to the given string and assigns it to the Service field. -func (o *RUMEventAttributes) SetService(v string) { - o.Service = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *RUMEventAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *RUMEventAttributes) GetTagsOk() (*[]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 *RUMEventAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *RUMEventAttributes) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *RUMEventAttributes) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMEventAttributes) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *RUMEventAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *RUMEventAttributes) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMEventAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Service != nil { - toSerialize["service"] = o.Service - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMEventAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes map[string]interface{} `json:"attributes,omitempty"` - Service *string `json:"service,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Service = all.Service - o.Tags = all.Tags - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v2/datadog/model_rum_event_type.go b/api/v2/datadog/model_rum_event_type.go deleted file mode 100644 index e609632b3ca..00000000000 --- a/api/v2/datadog/model_rum_event_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMEventType Type of the event. -type RUMEventType string - -// List of RUMEventType. -const ( - RUMEVENTTYPE_RUM RUMEventType = "rum" -) - -var allowedRUMEventTypeEnumValues = []RUMEventType{ - RUMEVENTTYPE_RUM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RUMEventType) GetAllowedValues() []RUMEventType { - return allowedRUMEventTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RUMEventType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RUMEventType(value) - return nil -} - -// NewRUMEventTypeFromValue returns a pointer to a valid RUMEventType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRUMEventTypeFromValue(v string) (*RUMEventType, error) { - ev := RUMEventType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RUMEventType: valid values are %v", v, allowedRUMEventTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RUMEventType) IsValid() bool { - for _, existing := range allowedRUMEventTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RUMEventType value. -func (v RUMEventType) Ptr() *RUMEventType { - return &v -} - -// NullableRUMEventType handles when a null is used for RUMEventType. -type NullableRUMEventType struct { - value *RUMEventType - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMEventType) Get() *RUMEventType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMEventType) Set(val *RUMEventType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMEventType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMEventType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMEventType initializes the struct as if Set has been called. -func NewNullableRUMEventType(val *RUMEventType) *NullableRUMEventType { - return &NullableRUMEventType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMEventType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMEventType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_events_response.go b/api/v2/datadog/model_rum_events_response.go deleted file mode 100644 index 2816c543e8f..00000000000 --- a/api/v2/datadog/model_rum_events_response.go +++ /dev/null @@ -1,194 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMEventsResponse Response object with all events matching the request and pagination information. -type RUMEventsResponse struct { - // Array of events matching the request. - Data []RUMEvent `json:"data,omitempty"` - // Links attributes. - Links *RUMResponseLinks `json:"links,omitempty"` - // The metadata associated with a request. - Meta *RUMResponseMetadata `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{} -} - -// NewRUMEventsResponse instantiates a new RUMEventsResponse 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 NewRUMEventsResponse() *RUMEventsResponse { - this := RUMEventsResponse{} - return &this -} - -// NewRUMEventsResponseWithDefaults instantiates a new RUMEventsResponse 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 NewRUMEventsResponseWithDefaults() *RUMEventsResponse { - this := RUMEventsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *RUMEventsResponse) GetData() []RUMEvent { - if o == nil || o.Data == nil { - var ret []RUMEvent - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMEventsResponse) GetDataOk() (*[]RUMEvent, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *RUMEventsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []RUMEvent and assigns it to the Data field. -func (o *RUMEventsResponse) SetData(v []RUMEvent) { - o.Data = v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *RUMEventsResponse) GetLinks() RUMResponseLinks { - if o == nil || o.Links == nil { - var ret RUMResponseLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMEventsResponse) GetLinksOk() (*RUMResponseLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *RUMEventsResponse) HasLinks() bool { - if o != nil && o.Links != nil { - return true - } - - return false -} - -// SetLinks gets a reference to the given RUMResponseLinks and assigns it to the Links field. -func (o *RUMEventsResponse) SetLinks(v RUMResponseLinks) { - o.Links = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *RUMEventsResponse) GetMeta() RUMResponseMetadata { - if o == nil || o.Meta == nil { - var ret RUMResponseMetadata - 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 *RUMEventsResponse) GetMetaOk() (*RUMResponseMetadata, 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 *RUMEventsResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given RUMResponseMetadata and assigns it to the Meta field. -func (o *RUMEventsResponse) SetMeta(v RUMResponseMetadata) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMEventsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMEventsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []RUMEvent `json:"data,omitempty"` - Links *RUMResponseLinks `json:"links,omitempty"` - Meta *RUMResponseMetadata `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Links = all.Links - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_rum_group_by.go b/api/v2/datadog/model_rum_group_by.go deleted file mode 100644 index b59c93f2409..00000000000 --- a/api/v2/datadog/model_rum_group_by.go +++ /dev/null @@ -1,317 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMGroupBy A group-by rule. -type RUMGroupBy struct { - // The name of the facet to use (required). - Facet string `json:"facet"` - // Used to perform a histogram computation (only for measure facets). - // Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. - Histogram *RUMGroupByHistogram `json:"histogram,omitempty"` - // The maximum buckets to return for this group-by. - Limit *int64 `json:"limit,omitempty"` - // The value to use for logs that don't have the facet used to group by. - Missing *RUMGroupByMissing `json:"missing,omitempty"` - // A sort rule. - Sort *RUMAggregateSort `json:"sort,omitempty"` - // A resulting object to put the given computes in over all the matching records. - Total *RUMGroupByTotal `json:"total,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{} -} - -// NewRUMGroupBy instantiates a new RUMGroupBy 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 NewRUMGroupBy(facet string) *RUMGroupBy { - this := RUMGroupBy{} - this.Facet = facet - var limit int64 = 10 - this.Limit = &limit - return &this -} - -// NewRUMGroupByWithDefaults instantiates a new RUMGroupBy 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 NewRUMGroupByWithDefaults() *RUMGroupBy { - this := RUMGroupBy{} - var limit int64 = 10 - this.Limit = &limit - return &this -} - -// GetFacet returns the Facet field value. -func (o *RUMGroupBy) GetFacet() string { - if o == nil { - var ret string - return ret - } - return o.Facet -} - -// GetFacetOk returns a tuple with the Facet field value -// and a boolean to check if the value has been set. -func (o *RUMGroupBy) GetFacetOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Facet, true -} - -// SetFacet sets field value. -func (o *RUMGroupBy) SetFacet(v string) { - o.Facet = v -} - -// GetHistogram returns the Histogram field value if set, zero value otherwise. -func (o *RUMGroupBy) GetHistogram() RUMGroupByHistogram { - if o == nil || o.Histogram == nil { - var ret RUMGroupByHistogram - return ret - } - return *o.Histogram -} - -// GetHistogramOk returns a tuple with the Histogram field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMGroupBy) GetHistogramOk() (*RUMGroupByHistogram, bool) { - if o == nil || o.Histogram == nil { - return nil, false - } - return o.Histogram, true -} - -// HasHistogram returns a boolean if a field has been set. -func (o *RUMGroupBy) HasHistogram() bool { - if o != nil && o.Histogram != nil { - return true - } - - return false -} - -// SetHistogram gets a reference to the given RUMGroupByHistogram and assigns it to the Histogram field. -func (o *RUMGroupBy) SetHistogram(v RUMGroupByHistogram) { - o.Histogram = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *RUMGroupBy) GetLimit() int64 { - if o == nil || o.Limit == nil { - var ret int64 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMGroupBy) GetLimitOk() (*int64, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *RUMGroupBy) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int64 and assigns it to the Limit field. -func (o *RUMGroupBy) SetLimit(v int64) { - o.Limit = &v -} - -// GetMissing returns the Missing field value if set, zero value otherwise. -func (o *RUMGroupBy) GetMissing() RUMGroupByMissing { - if o == nil || o.Missing == nil { - var ret RUMGroupByMissing - return ret - } - return *o.Missing -} - -// GetMissingOk returns a tuple with the Missing field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMGroupBy) GetMissingOk() (*RUMGroupByMissing, bool) { - if o == nil || o.Missing == nil { - return nil, false - } - return o.Missing, true -} - -// HasMissing returns a boolean if a field has been set. -func (o *RUMGroupBy) HasMissing() bool { - if o != nil && o.Missing != nil { - return true - } - - return false -} - -// SetMissing gets a reference to the given RUMGroupByMissing and assigns it to the Missing field. -func (o *RUMGroupBy) SetMissing(v RUMGroupByMissing) { - o.Missing = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *RUMGroupBy) GetSort() RUMAggregateSort { - if o == nil || o.Sort == nil { - var ret RUMAggregateSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMGroupBy) GetSortOk() (*RUMAggregateSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *RUMGroupBy) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given RUMAggregateSort and assigns it to the Sort field. -func (o *RUMGroupBy) SetSort(v RUMAggregateSort) { - o.Sort = &v -} - -// GetTotal returns the Total field value if set, zero value otherwise. -func (o *RUMGroupBy) GetTotal() RUMGroupByTotal { - if o == nil || o.Total == nil { - var ret RUMGroupByTotal - return ret - } - return *o.Total -} - -// GetTotalOk returns a tuple with the Total field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMGroupBy) GetTotalOk() (*RUMGroupByTotal, bool) { - if o == nil || o.Total == nil { - return nil, false - } - return o.Total, true -} - -// HasTotal returns a boolean if a field has been set. -func (o *RUMGroupBy) HasTotal() bool { - if o != nil && o.Total != nil { - return true - } - - return false -} - -// SetTotal gets a reference to the given RUMGroupByTotal and assigns it to the Total field. -func (o *RUMGroupBy) SetTotal(v RUMGroupByTotal) { - o.Total = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMGroupBy) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["facet"] = o.Facet - if o.Histogram != nil { - toSerialize["histogram"] = o.Histogram - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - if o.Missing != nil { - toSerialize["missing"] = o.Missing - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - if o.Total != nil { - toSerialize["total"] = o.Total - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMGroupBy) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} - all := struct { - Facet string `json:"facet"` - Histogram *RUMGroupByHistogram `json:"histogram,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Missing *RUMGroupByMissing `json:"missing,omitempty"` - Sort *RUMAggregateSort `json:"sort,omitempty"` - Total *RUMGroupByTotal `json:"total,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("Required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Facet = all.Facet - if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Histogram = all.Histogram - o.Limit = all.Limit - o.Missing = all.Missing - if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Sort = all.Sort - o.Total = all.Total - return nil -} diff --git a/api/v2/datadog/model_rum_group_by_histogram.go b/api/v2/datadog/model_rum_group_by_histogram.go deleted file mode 100644 index c08217f550b..00000000000 --- a/api/v2/datadog/model_rum_group_by_histogram.go +++ /dev/null @@ -1,172 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMGroupByHistogram Used to perform a histogram computation (only for measure facets). -// Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. -type RUMGroupByHistogram struct { - // The bin size of the histogram buckets. - Interval float64 `json:"interval"` - // The maximum value for the measure used in the histogram - // (values greater than this one are filtered out). - Max float64 `json:"max"` - // The minimum value for the measure used in the histogram - // (values smaller than this one are filtered out). - Min float64 `json:"min"` - // 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{} -} - -// NewRUMGroupByHistogram instantiates a new RUMGroupByHistogram 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 NewRUMGroupByHistogram(interval float64, max float64, min float64) *RUMGroupByHistogram { - this := RUMGroupByHistogram{} - this.Interval = interval - this.Max = max - this.Min = min - return &this -} - -// NewRUMGroupByHistogramWithDefaults instantiates a new RUMGroupByHistogram 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 NewRUMGroupByHistogramWithDefaults() *RUMGroupByHistogram { - this := RUMGroupByHistogram{} - return &this -} - -// GetInterval returns the Interval field value. -func (o *RUMGroupByHistogram) GetInterval() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Interval -} - -// GetIntervalOk returns a tuple with the Interval field value -// and a boolean to check if the value has been set. -func (o *RUMGroupByHistogram) GetIntervalOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Interval, true -} - -// SetInterval sets field value. -func (o *RUMGroupByHistogram) SetInterval(v float64) { - o.Interval = v -} - -// GetMax returns the Max field value. -func (o *RUMGroupByHistogram) GetMax() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Max -} - -// GetMaxOk returns a tuple with the Max field value -// and a boolean to check if the value has been set. -func (o *RUMGroupByHistogram) GetMaxOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Max, true -} - -// SetMax sets field value. -func (o *RUMGroupByHistogram) SetMax(v float64) { - o.Max = v -} - -// GetMin returns the Min field value. -func (o *RUMGroupByHistogram) GetMin() float64 { - if o == nil { - var ret float64 - return ret - } - return o.Min -} - -// GetMinOk returns a tuple with the Min field value -// and a boolean to check if the value has been set. -func (o *RUMGroupByHistogram) GetMinOk() (*float64, bool) { - if o == nil { - return nil, false - } - return &o.Min, true -} - -// SetMin sets field value. -func (o *RUMGroupByHistogram) SetMin(v float64) { - o.Min = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMGroupByHistogram) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["interval"] = o.Interval - toSerialize["max"] = o.Max - toSerialize["min"] = o.Min - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Interval *float64 `json:"interval"` - Max *float64 `json:"max"` - Min *float64 `json:"min"` - }{} - all := struct { - Interval float64 `json:"interval"` - Max float64 `json:"max"` - Min float64 `json:"min"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Interval == nil { - return fmt.Errorf("Required field interval missing") - } - if required.Max == nil { - return fmt.Errorf("Required field max missing") - } - if required.Min == nil { - return fmt.Errorf("Required field min missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Interval = all.Interval - o.Max = all.Max - o.Min = all.Min - return nil -} diff --git a/api/v2/datadog/model_rum_group_by_missing.go b/api/v2/datadog/model_rum_group_by_missing.go deleted file mode 100644 index 9f6b2b26503..00000000000 --- a/api/v2/datadog/model_rum_group_by_missing.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMGroupByMissing - The value to use for logs that don't have the facet used to group by. -type RUMGroupByMissing struct { - RUMGroupByMissingString *string - RUMGroupByMissingNumber *float64 - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// RUMGroupByMissingStringAsRUMGroupByMissing is a convenience function that returns string wrapped in RUMGroupByMissing. -func RUMGroupByMissingStringAsRUMGroupByMissing(v *string) RUMGroupByMissing { - return RUMGroupByMissing{RUMGroupByMissingString: v} -} - -// RUMGroupByMissingNumberAsRUMGroupByMissing is a convenience function that returns float64 wrapped in RUMGroupByMissing. -func RUMGroupByMissingNumberAsRUMGroupByMissing(v *float64) RUMGroupByMissing { - return RUMGroupByMissing{RUMGroupByMissingNumber: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *RUMGroupByMissing) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into RUMGroupByMissingString - err = json.Unmarshal(data, &obj.RUMGroupByMissingString) - if err == nil { - if obj.RUMGroupByMissingString != nil { - jsonRUMGroupByMissingString, _ := json.Marshal(obj.RUMGroupByMissingString) - if string(jsonRUMGroupByMissingString) == "{}" { // empty struct - obj.RUMGroupByMissingString = nil - } else { - match++ - } - } else { - obj.RUMGroupByMissingString = nil - } - } else { - obj.RUMGroupByMissingString = nil - } - - // try to unmarshal data into RUMGroupByMissingNumber - err = json.Unmarshal(data, &obj.RUMGroupByMissingNumber) - if err == nil { - if obj.RUMGroupByMissingNumber != nil { - jsonRUMGroupByMissingNumber, _ := json.Marshal(obj.RUMGroupByMissingNumber) - if string(jsonRUMGroupByMissingNumber) == "{}" { // empty struct - obj.RUMGroupByMissingNumber = nil - } else { - match++ - } - } else { - obj.RUMGroupByMissingNumber = nil - } - } else { - obj.RUMGroupByMissingNumber = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.RUMGroupByMissingString = nil - obj.RUMGroupByMissingNumber = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj RUMGroupByMissing) MarshalJSON() ([]byte, error) { - if obj.RUMGroupByMissingString != nil { - return json.Marshal(&obj.RUMGroupByMissingString) - } - - if obj.RUMGroupByMissingNumber != nil { - return json.Marshal(&obj.RUMGroupByMissingNumber) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *RUMGroupByMissing) GetActualInstance() interface{} { - if obj.RUMGroupByMissingString != nil { - return obj.RUMGroupByMissingString - } - - if obj.RUMGroupByMissingNumber != nil { - return obj.RUMGroupByMissingNumber - } - - // all schemas are nil - return nil -} - -// NullableRUMGroupByMissing handles when a null is used for RUMGroupByMissing. -type NullableRUMGroupByMissing struct { - value *RUMGroupByMissing - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMGroupByMissing) Get() *RUMGroupByMissing { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMGroupByMissing) Set(val *RUMGroupByMissing) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMGroupByMissing) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableRUMGroupByMissing) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMGroupByMissing initializes the struct as if Set has been called. -func NewNullableRUMGroupByMissing(val *RUMGroupByMissing) *NullableRUMGroupByMissing { - return &NullableRUMGroupByMissing{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMGroupByMissing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMGroupByMissing) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_group_by_total.go b/api/v2/datadog/model_rum_group_by_total.go deleted file mode 100644 index 4cab76bd47e..00000000000 --- a/api/v2/datadog/model_rum_group_by_total.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMGroupByTotal - A resulting object to put the given computes in over all the matching records. -type RUMGroupByTotal struct { - RUMGroupByTotalBoolean *bool - RUMGroupByTotalString *string - RUMGroupByTotalNumber *float64 - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// RUMGroupByTotalBooleanAsRUMGroupByTotal is a convenience function that returns bool wrapped in RUMGroupByTotal. -func RUMGroupByTotalBooleanAsRUMGroupByTotal(v *bool) RUMGroupByTotal { - return RUMGroupByTotal{RUMGroupByTotalBoolean: v} -} - -// RUMGroupByTotalStringAsRUMGroupByTotal is a convenience function that returns string wrapped in RUMGroupByTotal. -func RUMGroupByTotalStringAsRUMGroupByTotal(v *string) RUMGroupByTotal { - return RUMGroupByTotal{RUMGroupByTotalString: v} -} - -// RUMGroupByTotalNumberAsRUMGroupByTotal is a convenience function that returns float64 wrapped in RUMGroupByTotal. -func RUMGroupByTotalNumberAsRUMGroupByTotal(v *float64) RUMGroupByTotal { - return RUMGroupByTotal{RUMGroupByTotalNumber: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *RUMGroupByTotal) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into RUMGroupByTotalBoolean - err = json.Unmarshal(data, &obj.RUMGroupByTotalBoolean) - if err == nil { - if obj.RUMGroupByTotalBoolean != nil { - jsonRUMGroupByTotalBoolean, _ := json.Marshal(obj.RUMGroupByTotalBoolean) - if string(jsonRUMGroupByTotalBoolean) == "{}" { // empty struct - obj.RUMGroupByTotalBoolean = nil - } else { - match++ - } - } else { - obj.RUMGroupByTotalBoolean = nil - } - } else { - obj.RUMGroupByTotalBoolean = nil - } - - // try to unmarshal data into RUMGroupByTotalString - err = json.Unmarshal(data, &obj.RUMGroupByTotalString) - if err == nil { - if obj.RUMGroupByTotalString != nil { - jsonRUMGroupByTotalString, _ := json.Marshal(obj.RUMGroupByTotalString) - if string(jsonRUMGroupByTotalString) == "{}" { // empty struct - obj.RUMGroupByTotalString = nil - } else { - match++ - } - } else { - obj.RUMGroupByTotalString = nil - } - } else { - obj.RUMGroupByTotalString = nil - } - - // try to unmarshal data into RUMGroupByTotalNumber - err = json.Unmarshal(data, &obj.RUMGroupByTotalNumber) - if err == nil { - if obj.RUMGroupByTotalNumber != nil { - jsonRUMGroupByTotalNumber, _ := json.Marshal(obj.RUMGroupByTotalNumber) - if string(jsonRUMGroupByTotalNumber) == "{}" { // empty struct - obj.RUMGroupByTotalNumber = nil - } else { - match++ - } - } else { - obj.RUMGroupByTotalNumber = nil - } - } else { - obj.RUMGroupByTotalNumber = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.RUMGroupByTotalBoolean = nil - obj.RUMGroupByTotalString = nil - obj.RUMGroupByTotalNumber = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj RUMGroupByTotal) MarshalJSON() ([]byte, error) { - if obj.RUMGroupByTotalBoolean != nil { - return json.Marshal(&obj.RUMGroupByTotalBoolean) - } - - if obj.RUMGroupByTotalString != nil { - return json.Marshal(&obj.RUMGroupByTotalString) - } - - if obj.RUMGroupByTotalNumber != nil { - return json.Marshal(&obj.RUMGroupByTotalNumber) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *RUMGroupByTotal) GetActualInstance() interface{} { - if obj.RUMGroupByTotalBoolean != nil { - return obj.RUMGroupByTotalBoolean - } - - if obj.RUMGroupByTotalString != nil { - return obj.RUMGroupByTotalString - } - - if obj.RUMGroupByTotalNumber != nil { - return obj.RUMGroupByTotalNumber - } - - // all schemas are nil - return nil -} - -// NullableRUMGroupByTotal handles when a null is used for RUMGroupByTotal. -type NullableRUMGroupByTotal struct { - value *RUMGroupByTotal - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMGroupByTotal) Get() *RUMGroupByTotal { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMGroupByTotal) Set(val *RUMGroupByTotal) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMGroupByTotal) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableRUMGroupByTotal) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMGroupByTotal initializes the struct as if Set has been called. -func NewNullableRUMGroupByTotal(val *RUMGroupByTotal) *NullableRUMGroupByTotal { - return &NullableRUMGroupByTotal{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMGroupByTotal) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMGroupByTotal) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_query_filter.go b/api/v2/datadog/model_rum_query_filter.go deleted file mode 100644 index e9849361ee2..00000000000 --- a/api/v2/datadog/model_rum_query_filter.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMQueryFilter The search and filter query settings. -type RUMQueryFilter struct { - // The minimum time for the requested events; supports date, math, and regular timestamps (in milliseconds). - From *string `json:"from,omitempty"` - // The search query following the RUM search syntax. - Query *string `json:"query,omitempty"` - // The maximum time for the requested events; supports date, math, and regular timestamps (in milliseconds). - To *string `json:"to,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{} -} - -// NewRUMQueryFilter instantiates a new RUMQueryFilter 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 NewRUMQueryFilter() *RUMQueryFilter { - this := RUMQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// NewRUMQueryFilterWithDefaults instantiates a new RUMQueryFilter 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 NewRUMQueryFilterWithDefaults() *RUMQueryFilter { - this := RUMQueryFilter{} - var from string = "now-15m" - this.From = &from - var query string = "*" - this.Query = &query - var to string = "now" - this.To = &to - return &this -} - -// GetFrom returns the From field value if set, zero value otherwise. -func (o *RUMQueryFilter) GetFrom() string { - if o == nil || o.From == nil { - var ret string - return ret - } - return *o.From -} - -// GetFromOk returns a tuple with the From field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMQueryFilter) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { - return nil, false - } - return o.From, true -} - -// HasFrom returns a boolean if a field has been set. -func (o *RUMQueryFilter) HasFrom() bool { - if o != nil && o.From != nil { - return true - } - - return false -} - -// SetFrom gets a reference to the given string and assigns it to the From field. -func (o *RUMQueryFilter) SetFrom(v string) { - o.From = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *RUMQueryFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMQueryFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *RUMQueryFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *RUMQueryFilter) SetQuery(v string) { - o.Query = &v -} - -// GetTo returns the To field value if set, zero value otherwise. -func (o *RUMQueryFilter) GetTo() string { - if o == nil || o.To == nil { - var ret string - return ret - } - return *o.To -} - -// GetToOk returns a tuple with the To field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMQueryFilter) GetToOk() (*string, bool) { - if o == nil || o.To == nil { - return nil, false - } - return o.To, true -} - -// HasTo returns a boolean if a field has been set. -func (o *RUMQueryFilter) HasTo() bool { - if o != nil && o.To != nil { - return true - } - - return false -} - -// SetTo gets a reference to the given string and assigns it to the To field. -func (o *RUMQueryFilter) SetTo(v string) { - o.To = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMQueryFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.From != nil { - toSerialize["from"] = o.From - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.To != nil { - toSerialize["to"] = o.To - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMQueryFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - From *string `json:"from,omitempty"` - Query *string `json:"query,omitempty"` - To *string `json:"to,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.From = all.From - o.Query = all.Query - o.To = all.To - return nil -} diff --git a/api/v2/datadog/model_rum_query_options.go b/api/v2/datadog/model_rum_query_options.go deleted file mode 100644 index 4bab79e2194..00000000000 --- a/api/v2/datadog/model_rum_query_options.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMQueryOptions Global query options that are used during the query. -// Note: Only supply timezone or time offset, not both. Otherwise, the query fails. -type RUMQueryOptions struct { - // The time offset (in seconds) to apply to the query. - TimeOffset *int64 `json:"time_offset,omitempty"` - // The timezone can be specified both as an offset, for example: "UTC+03:00". - Timezone *string `json:"timezone,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{} -} - -// NewRUMQueryOptions instantiates a new RUMQueryOptions 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 NewRUMQueryOptions() *RUMQueryOptions { - this := RUMQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// NewRUMQueryOptionsWithDefaults instantiates a new RUMQueryOptions 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 NewRUMQueryOptionsWithDefaults() *RUMQueryOptions { - this := RUMQueryOptions{} - var timezone string = "UTC" - this.Timezone = &timezone - return &this -} - -// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. -func (o *RUMQueryOptions) GetTimeOffset() int64 { - if o == nil || o.TimeOffset == nil { - var ret int64 - return ret - } - return *o.TimeOffset -} - -// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMQueryOptions) GetTimeOffsetOk() (*int64, bool) { - if o == nil || o.TimeOffset == nil { - return nil, false - } - return o.TimeOffset, true -} - -// HasTimeOffset returns a boolean if a field has been set. -func (o *RUMQueryOptions) HasTimeOffset() bool { - if o != nil && o.TimeOffset != nil { - return true - } - - return false -} - -// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. -func (o *RUMQueryOptions) SetTimeOffset(v int64) { - o.TimeOffset = &v -} - -// GetTimezone returns the Timezone field value if set, zero value otherwise. -func (o *RUMQueryOptions) GetTimezone() string { - if o == nil || o.Timezone == nil { - var ret string - return ret - } - return *o.Timezone -} - -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMQueryOptions) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { - return nil, false - } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *RUMQueryOptions) HasTimezone() bool { - if o != nil && o.Timezone != nil { - return true - } - - return false -} - -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. -func (o *RUMQueryOptions) SetTimezone(v string) { - o.Timezone = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMQueryOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.TimeOffset != nil { - toSerialize["time_offset"] = o.TimeOffset - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMQueryOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - TimeOffset *int64 `json:"time_offset,omitempty"` - Timezone *string `json:"timezone,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.TimeOffset = all.TimeOffset - o.Timezone = all.Timezone - return nil -} diff --git a/api/v2/datadog/model_rum_query_page_options.go b/api/v2/datadog/model_rum_query_page_options.go deleted file mode 100644 index 18fb5bbb377..00000000000 --- a/api/v2/datadog/model_rum_query_page_options.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMQueryPageOptions Paging attributes for listing events. -type RUMQueryPageOptions struct { - // List following results with a cursor provided in the previous query. - Cursor *string `json:"cursor,omitempty"` - // Maximum number of events in the response. - Limit *int32 `json:"limit,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{} -} - -// NewRUMQueryPageOptions instantiates a new RUMQueryPageOptions 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 NewRUMQueryPageOptions() *RUMQueryPageOptions { - this := RUMQueryPageOptions{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// NewRUMQueryPageOptionsWithDefaults instantiates a new RUMQueryPageOptions 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 NewRUMQueryPageOptionsWithDefaults() *RUMQueryPageOptions { - this := RUMQueryPageOptions{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// GetCursor returns the Cursor field value if set, zero value otherwise. -func (o *RUMQueryPageOptions) GetCursor() string { - if o == nil || o.Cursor == nil { - var ret string - return ret - } - return *o.Cursor -} - -// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMQueryPageOptions) GetCursorOk() (*string, bool) { - if o == nil || o.Cursor == nil { - return nil, false - } - return o.Cursor, true -} - -// HasCursor returns a boolean if a field has been set. -func (o *RUMQueryPageOptions) HasCursor() bool { - if o != nil && o.Cursor != nil { - return true - } - - return false -} - -// SetCursor gets a reference to the given string and assigns it to the Cursor field. -func (o *RUMQueryPageOptions) SetCursor(v string) { - o.Cursor = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *RUMQueryPageOptions) GetLimit() int32 { - if o == nil || o.Limit == nil { - var ret int32 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMQueryPageOptions) GetLimitOk() (*int32, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *RUMQueryPageOptions) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int32 and assigns it to the Limit field. -func (o *RUMQueryPageOptions) SetLimit(v int32) { - o.Limit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMQueryPageOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cursor != nil { - toSerialize["cursor"] = o.Cursor - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cursor *string `json:"cursor,omitempty"` - Limit *int32 `json:"limit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cursor = all.Cursor - o.Limit = all.Limit - return nil -} diff --git a/api/v2/datadog/model_rum_response_links.go b/api/v2/datadog/model_rum_response_links.go deleted file mode 100644 index bbc3396033e..00000000000 --- a/api/v2/datadog/model_rum_response_links.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMResponseLinks Links attributes. -type RUMResponseLinks struct { - // Link for the next set of results. Note that the request can also be made using the - // POST endpoint. - Next *string `json:"next,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{} -} - -// NewRUMResponseLinks instantiates a new RUMResponseLinks 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 NewRUMResponseLinks() *RUMResponseLinks { - this := RUMResponseLinks{} - return &this -} - -// NewRUMResponseLinksWithDefaults instantiates a new RUMResponseLinks 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 NewRUMResponseLinksWithDefaults() *RUMResponseLinks { - this := RUMResponseLinks{} - return &this -} - -// GetNext returns the Next field value if set, zero value otherwise. -func (o *RUMResponseLinks) GetNext() string { - if o == nil || o.Next == nil { - var ret string - return ret - } - return *o.Next -} - -// GetNextOk returns a tuple with the Next field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMResponseLinks) GetNextOk() (*string, bool) { - if o == nil || o.Next == nil { - return nil, false - } - return o.Next, true -} - -// HasNext returns a boolean if a field has been set. -func (o *RUMResponseLinks) HasNext() bool { - if o != nil && o.Next != nil { - return true - } - - return false -} - -// SetNext gets a reference to the given string and assigns it to the Next field. -func (o *RUMResponseLinks) SetNext(v string) { - o.Next = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMResponseLinks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Next != nil { - toSerialize["next"] = o.Next - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Next *string `json:"next,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Next = all.Next - return nil -} diff --git a/api/v2/datadog/model_rum_response_metadata.go b/api/v2/datadog/model_rum_response_metadata.go deleted file mode 100644 index c470b9587bd..00000000000 --- a/api/v2/datadog/model_rum_response_metadata.go +++ /dev/null @@ -1,274 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMResponseMetadata The metadata associated with a request. -type RUMResponseMetadata struct { - // The time elapsed in milliseconds. - Elapsed *int64 `json:"elapsed,omitempty"` - // Paging attributes. - Page *RUMResponsePage `json:"page,omitempty"` - // The identifier of the request. - RequestId *string `json:"request_id,omitempty"` - // The status of the response. - Status *RUMResponseStatus `json:"status,omitempty"` - // A list of warnings (non-fatal errors) encountered. Partial results may return if - // warnings are present in the response. - Warnings []RUMWarning `json:"warnings,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{} -} - -// NewRUMResponseMetadata instantiates a new RUMResponseMetadata 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 NewRUMResponseMetadata() *RUMResponseMetadata { - this := RUMResponseMetadata{} - return &this -} - -// NewRUMResponseMetadataWithDefaults instantiates a new RUMResponseMetadata 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 NewRUMResponseMetadataWithDefaults() *RUMResponseMetadata { - this := RUMResponseMetadata{} - return &this -} - -// GetElapsed returns the Elapsed field value if set, zero value otherwise. -func (o *RUMResponseMetadata) GetElapsed() int64 { - if o == nil || o.Elapsed == nil { - var ret int64 - return ret - } - return *o.Elapsed -} - -// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMResponseMetadata) GetElapsedOk() (*int64, bool) { - if o == nil || o.Elapsed == nil { - return nil, false - } - return o.Elapsed, true -} - -// HasElapsed returns a boolean if a field has been set. -func (o *RUMResponseMetadata) HasElapsed() bool { - if o != nil && o.Elapsed != nil { - return true - } - - return false -} - -// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. -func (o *RUMResponseMetadata) SetElapsed(v int64) { - o.Elapsed = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *RUMResponseMetadata) GetPage() RUMResponsePage { - if o == nil || o.Page == nil { - var ret RUMResponsePage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMResponseMetadata) GetPageOk() (*RUMResponsePage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *RUMResponseMetadata) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given RUMResponsePage and assigns it to the Page field. -func (o *RUMResponseMetadata) SetPage(v RUMResponsePage) { - o.Page = &v -} - -// GetRequestId returns the RequestId field value if set, zero value otherwise. -func (o *RUMResponseMetadata) GetRequestId() string { - if o == nil || o.RequestId == nil { - var ret string - return ret - } - return *o.RequestId -} - -// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMResponseMetadata) GetRequestIdOk() (*string, bool) { - if o == nil || o.RequestId == nil { - return nil, false - } - return o.RequestId, true -} - -// HasRequestId returns a boolean if a field has been set. -func (o *RUMResponseMetadata) HasRequestId() bool { - if o != nil && o.RequestId != nil { - return true - } - - return false -} - -// SetRequestId gets a reference to the given string and assigns it to the RequestId field. -func (o *RUMResponseMetadata) SetRequestId(v string) { - o.RequestId = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *RUMResponseMetadata) GetStatus() RUMResponseStatus { - if o == nil || o.Status == nil { - var ret RUMResponseStatus - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMResponseMetadata) GetStatusOk() (*RUMResponseStatus, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *RUMResponseMetadata) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given RUMResponseStatus and assigns it to the Status field. -func (o *RUMResponseMetadata) SetStatus(v RUMResponseStatus) { - o.Status = &v -} - -// GetWarnings returns the Warnings field value if set, zero value otherwise. -func (o *RUMResponseMetadata) GetWarnings() []RUMWarning { - if o == nil || o.Warnings == nil { - var ret []RUMWarning - return ret - } - return o.Warnings -} - -// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMResponseMetadata) GetWarningsOk() (*[]RUMWarning, bool) { - if o == nil || o.Warnings == nil { - return nil, false - } - return &o.Warnings, true -} - -// HasWarnings returns a boolean if a field has been set. -func (o *RUMResponseMetadata) HasWarnings() bool { - if o != nil && o.Warnings != nil { - return true - } - - return false -} - -// SetWarnings gets a reference to the given []RUMWarning and assigns it to the Warnings field. -func (o *RUMResponseMetadata) SetWarnings(v []RUMWarning) { - o.Warnings = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMResponseMetadata) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Elapsed != nil { - toSerialize["elapsed"] = o.Elapsed - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.RequestId != nil { - toSerialize["request_id"] = o.RequestId - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Warnings != nil { - toSerialize["warnings"] = o.Warnings - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Elapsed *int64 `json:"elapsed,omitempty"` - Page *RUMResponsePage `json:"page,omitempty"` - RequestId *string `json:"request_id,omitempty"` - Status *RUMResponseStatus `json:"status,omitempty"` - Warnings []RUMWarning `json:"warnings,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Elapsed = all.Elapsed - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.RequestId = all.RequestId - o.Status = all.Status - o.Warnings = all.Warnings - return nil -} diff --git a/api/v2/datadog/model_rum_response_page.go b/api/v2/datadog/model_rum_response_page.go deleted file mode 100644 index def1148eaa7..00000000000 --- a/api/v2/datadog/model_rum_response_page.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMResponsePage Paging attributes. -type RUMResponsePage struct { - // The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of `page[cursor]`. - After *string `json:"after,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{} -} - -// NewRUMResponsePage instantiates a new RUMResponsePage 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 NewRUMResponsePage() *RUMResponsePage { - this := RUMResponsePage{} - return &this -} - -// NewRUMResponsePageWithDefaults instantiates a new RUMResponsePage 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 NewRUMResponsePageWithDefaults() *RUMResponsePage { - this := RUMResponsePage{} - return &this -} - -// GetAfter returns the After field value if set, zero value otherwise. -func (o *RUMResponsePage) GetAfter() string { - if o == nil || o.After == nil { - var ret string - return ret - } - return *o.After -} - -// GetAfterOk returns a tuple with the After field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMResponsePage) GetAfterOk() (*string, bool) { - if o == nil || o.After == nil { - return nil, false - } - return o.After, true -} - -// HasAfter returns a boolean if a field has been set. -func (o *RUMResponsePage) HasAfter() bool { - if o != nil && o.After != nil { - return true - } - - return false -} - -// SetAfter gets a reference to the given string and assigns it to the After field. -func (o *RUMResponsePage) SetAfter(v string) { - o.After = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMResponsePage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.After != nil { - toSerialize["after"] = o.After - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMResponsePage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - After *string `json:"after,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.After = all.After - return nil -} diff --git a/api/v2/datadog/model_rum_response_status.go b/api/v2/datadog/model_rum_response_status.go deleted file mode 100644 index 512b30bcfb5..00000000000 --- a/api/v2/datadog/model_rum_response_status.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMResponseStatus The status of the response. -type RUMResponseStatus string - -// List of RUMResponseStatus. -const ( - RUMRESPONSESTATUS_DONE RUMResponseStatus = "done" - RUMRESPONSESTATUS_TIMEOUT RUMResponseStatus = "timeout" -) - -var allowedRUMResponseStatusEnumValues = []RUMResponseStatus{ - RUMRESPONSESTATUS_DONE, - RUMRESPONSESTATUS_TIMEOUT, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RUMResponseStatus) GetAllowedValues() []RUMResponseStatus { - return allowedRUMResponseStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RUMResponseStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RUMResponseStatus(value) - return nil -} - -// NewRUMResponseStatusFromValue returns a pointer to a valid RUMResponseStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRUMResponseStatusFromValue(v string) (*RUMResponseStatus, error) { - ev := RUMResponseStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RUMResponseStatus: valid values are %v", v, allowedRUMResponseStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RUMResponseStatus) IsValid() bool { - for _, existing := range allowedRUMResponseStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RUMResponseStatus value. -func (v RUMResponseStatus) Ptr() *RUMResponseStatus { - return &v -} - -// NullableRUMResponseStatus handles when a null is used for RUMResponseStatus. -type NullableRUMResponseStatus struct { - value *RUMResponseStatus - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMResponseStatus) Get() *RUMResponseStatus { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMResponseStatus) Set(val *RUMResponseStatus) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMResponseStatus) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMResponseStatus) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMResponseStatus initializes the struct as if Set has been called. -func NewNullableRUMResponseStatus(val *RUMResponseStatus) *NullableRUMResponseStatus { - return &NullableRUMResponseStatus{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMResponseStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMResponseStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_search_events_request.go b/api/v2/datadog/model_rum_search_events_request.go deleted file mode 100644 index f025e6da5bc..00000000000 --- a/api/v2/datadog/model_rum_search_events_request.go +++ /dev/null @@ -1,249 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMSearchEventsRequest The request for a RUM events list. -type RUMSearchEventsRequest struct { - // The search and filter query settings. - Filter *RUMQueryFilter `json:"filter,omitempty"` - // Global query options that are used during the query. - // Note: Only supply timezone or time offset, not both. Otherwise, the query fails. - Options *RUMQueryOptions `json:"options,omitempty"` - // Paging attributes for listing events. - Page *RUMQueryPageOptions `json:"page,omitempty"` - // Sort parameters when querying events. - Sort *RUMSort `json:"sort,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{} -} - -// NewRUMSearchEventsRequest instantiates a new RUMSearchEventsRequest 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 NewRUMSearchEventsRequest() *RUMSearchEventsRequest { - this := RUMSearchEventsRequest{} - return &this -} - -// NewRUMSearchEventsRequestWithDefaults instantiates a new RUMSearchEventsRequest 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 NewRUMSearchEventsRequestWithDefaults() *RUMSearchEventsRequest { - this := RUMSearchEventsRequest{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *RUMSearchEventsRequest) GetFilter() RUMQueryFilter { - if o == nil || o.Filter == nil { - var ret RUMQueryFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMSearchEventsRequest) GetFilterOk() (*RUMQueryFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *RUMSearchEventsRequest) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given RUMQueryFilter and assigns it to the Filter field. -func (o *RUMSearchEventsRequest) SetFilter(v RUMQueryFilter) { - o.Filter = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *RUMSearchEventsRequest) GetOptions() RUMQueryOptions { - if o == nil || o.Options == nil { - var ret RUMQueryOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMSearchEventsRequest) GetOptionsOk() (*RUMQueryOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *RUMSearchEventsRequest) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given RUMQueryOptions and assigns it to the Options field. -func (o *RUMSearchEventsRequest) SetOptions(v RUMQueryOptions) { - o.Options = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *RUMSearchEventsRequest) GetPage() RUMQueryPageOptions { - if o == nil || o.Page == nil { - var ret RUMQueryPageOptions - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMSearchEventsRequest) GetPageOk() (*RUMQueryPageOptions, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *RUMSearchEventsRequest) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given RUMQueryPageOptions and assigns it to the Page field. -func (o *RUMSearchEventsRequest) SetPage(v RUMQueryPageOptions) { - o.Page = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *RUMSearchEventsRequest) GetSort() RUMSort { - if o == nil || o.Sort == nil { - var ret RUMSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMSearchEventsRequest) GetSortOk() (*RUMSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *RUMSearchEventsRequest) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given RUMSort and assigns it to the Sort field. -func (o *RUMSearchEventsRequest) SetSort(v RUMSort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMSearchEventsRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filter *RUMQueryFilter `json:"filter,omitempty"` - Options *RUMQueryOptions `json:"options,omitempty"` - Page *RUMQueryPageOptions `json:"page,omitempty"` - Sort *RUMSort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.Sort = all.Sort - return nil -} diff --git a/api/v2/datadog/model_rum_sort.go b/api/v2/datadog/model_rum_sort.go deleted file mode 100644 index 33a3fa8537f..00000000000 --- a/api/v2/datadog/model_rum_sort.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMSort Sort parameters when querying events. -type RUMSort string - -// List of RUMSort. -const ( - RUMSORT_TIMESTAMP_ASCENDING RUMSort = "timestamp" - RUMSORT_TIMESTAMP_DESCENDING RUMSort = "-timestamp" -) - -var allowedRUMSortEnumValues = []RUMSort{ - RUMSORT_TIMESTAMP_ASCENDING, - RUMSORT_TIMESTAMP_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RUMSort) GetAllowedValues() []RUMSort { - return allowedRUMSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RUMSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RUMSort(value) - return nil -} - -// NewRUMSortFromValue returns a pointer to a valid RUMSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRUMSortFromValue(v string) (*RUMSort, error) { - ev := RUMSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RUMSort: valid values are %v", v, allowedRUMSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RUMSort) IsValid() bool { - for _, existing := range allowedRUMSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RUMSort value. -func (v RUMSort) Ptr() *RUMSort { - return &v -} - -// NullableRUMSort handles when a null is used for RUMSort. -type NullableRUMSort struct { - value *RUMSort - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMSort) Get() *RUMSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMSort) Set(val *RUMSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMSort initializes the struct as if Set has been called. -func NewNullableRUMSort(val *RUMSort) *NullableRUMSort { - return &NullableRUMSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_sort_order.go b/api/v2/datadog/model_rum_sort_order.go deleted file mode 100644 index a3ef4b8196b..00000000000 --- a/api/v2/datadog/model_rum_sort_order.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// RUMSortOrder The order to use, ascending or descending. -type RUMSortOrder string - -// List of RUMSortOrder. -const ( - RUMSORTORDER_ASCENDING RUMSortOrder = "asc" - RUMSORTORDER_DESCENDING RUMSortOrder = "desc" -) - -var allowedRUMSortOrderEnumValues = []RUMSortOrder{ - RUMSORTORDER_ASCENDING, - RUMSORTORDER_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *RUMSortOrder) GetAllowedValues() []RUMSortOrder { - return allowedRUMSortOrderEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *RUMSortOrder) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = RUMSortOrder(value) - return nil -} - -// NewRUMSortOrderFromValue returns a pointer to a valid RUMSortOrder -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewRUMSortOrderFromValue(v string) (*RUMSortOrder, error) { - ev := RUMSortOrder(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for RUMSortOrder: valid values are %v", v, allowedRUMSortOrderEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v RUMSortOrder) IsValid() bool { - for _, existing := range allowedRUMSortOrderEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to RUMSortOrder value. -func (v RUMSortOrder) Ptr() *RUMSortOrder { - return &v -} - -// NullableRUMSortOrder handles when a null is used for RUMSortOrder. -type NullableRUMSortOrder struct { - value *RUMSortOrder - isSet bool -} - -// Get returns the associated value. -func (v NullableRUMSortOrder) Get() *RUMSortOrder { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableRUMSortOrder) Set(val *RUMSortOrder) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableRUMSortOrder) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableRUMSortOrder) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableRUMSortOrder initializes the struct as if Set has been called. -func NewNullableRUMSortOrder(val *RUMSortOrder) *NullableRUMSortOrder { - return &NullableRUMSortOrder{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableRUMSortOrder) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableRUMSortOrder) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_rum_warning.go b/api/v2/datadog/model_rum_warning.go deleted file mode 100644 index 5278e807d12..00000000000 --- a/api/v2/datadog/model_rum_warning.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// RUMWarning A warning message indicating something that went wrong with the query. -type RUMWarning struct { - // A unique code for this type of warning. - Code *string `json:"code,omitempty"` - // A detailed explanation of this specific warning. - Detail *string `json:"detail,omitempty"` - // A short human-readable summary of the warning. - Title *string `json:"title,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{} -} - -// NewRUMWarning instantiates a new RUMWarning 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 NewRUMWarning() *RUMWarning { - this := RUMWarning{} - return &this -} - -// NewRUMWarningWithDefaults instantiates a new RUMWarning 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 NewRUMWarningWithDefaults() *RUMWarning { - this := RUMWarning{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *RUMWarning) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMWarning) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *RUMWarning) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *RUMWarning) SetCode(v string) { - o.Code = &v -} - -// GetDetail returns the Detail field value if set, zero value otherwise. -func (o *RUMWarning) GetDetail() string { - if o == nil || o.Detail == nil { - var ret string - return ret - } - return *o.Detail -} - -// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMWarning) GetDetailOk() (*string, bool) { - if o == nil || o.Detail == nil { - return nil, false - } - return o.Detail, true -} - -// HasDetail returns a boolean if a field has been set. -func (o *RUMWarning) HasDetail() bool { - if o != nil && o.Detail != nil { - return true - } - - return false -} - -// SetDetail gets a reference to the given string and assigns it to the Detail field. -func (o *RUMWarning) SetDetail(v string) { - o.Detail = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *RUMWarning) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RUMWarning) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *RUMWarning) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *RUMWarning) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RUMWarning) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Detail != nil { - toSerialize["detail"] = o.Detail - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RUMWarning) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Code *string `json:"code,omitempty"` - Detail *string `json:"detail,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Code = all.Code - o.Detail = all.Detail - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_saml_assertion_attribute.go b/api/v2/datadog/model_saml_assertion_attribute.go deleted file mode 100644 index 562be272c5d..00000000000 --- a/api/v2/datadog/model_saml_assertion_attribute.go +++ /dev/null @@ -1,192 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SAMLAssertionAttribute SAML assertion attribute. -type SAMLAssertionAttribute struct { - // Key/Value pair of attributes used in SAML assertion attributes. - Attributes *SAMLAssertionAttributeAttributes `json:"attributes,omitempty"` - // The ID of the SAML assertion attribute. - Id string `json:"id"` - // SAML assertion attributes resource type. - Type SAMLAssertionAttributesType `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{} -} - -// NewSAMLAssertionAttribute instantiates a new SAMLAssertionAttribute 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 NewSAMLAssertionAttribute(id string, typeVar SAMLAssertionAttributesType) *SAMLAssertionAttribute { - this := SAMLAssertionAttribute{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewSAMLAssertionAttributeWithDefaults instantiates a new SAMLAssertionAttribute 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 NewSAMLAssertionAttributeWithDefaults() *SAMLAssertionAttribute { - this := SAMLAssertionAttribute{} - var typeVar SAMLAssertionAttributesType = SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SAMLAssertionAttribute) GetAttributes() SAMLAssertionAttributeAttributes { - if o == nil || o.Attributes == nil { - var ret SAMLAssertionAttributeAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SAMLAssertionAttribute) GetAttributesOk() (*SAMLAssertionAttributeAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SAMLAssertionAttribute) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SAMLAssertionAttributeAttributes and assigns it to the Attributes field. -func (o *SAMLAssertionAttribute) SetAttributes(v SAMLAssertionAttributeAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value. -func (o *SAMLAssertionAttribute) 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 *SAMLAssertionAttribute) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *SAMLAssertionAttribute) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *SAMLAssertionAttribute) GetType() SAMLAssertionAttributesType { - if o == nil { - var ret SAMLAssertionAttributesType - 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 *SAMLAssertionAttribute) GetTypeOk() (*SAMLAssertionAttributesType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SAMLAssertionAttribute) SetType(v SAMLAssertionAttributesType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SAMLAssertionAttribute) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - toSerialize["id"] = o.Id - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *SAMLAssertionAttributesType `json:"type"` - }{} - all := struct { - Attributes *SAMLAssertionAttributeAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type SAMLAssertionAttributesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_saml_assertion_attribute_attributes.go b/api/v2/datadog/model_saml_assertion_attribute_attributes.go deleted file mode 100644 index 9120822aa77..00000000000 --- a/api/v2/datadog/model_saml_assertion_attribute_attributes.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SAMLAssertionAttributeAttributes Key/Value pair of attributes used in SAML assertion attributes. -type SAMLAssertionAttributeAttributes struct { - // Key portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeKey *string `json:"attribute_key,omitempty"` - // Value portion of a key/value pair of the attribute sent from the Identity Provider. - AttributeValue *string `json:"attribute_value,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{} -} - -// NewSAMLAssertionAttributeAttributes instantiates a new SAMLAssertionAttributeAttributes 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 NewSAMLAssertionAttributeAttributes() *SAMLAssertionAttributeAttributes { - this := SAMLAssertionAttributeAttributes{} - return &this -} - -// NewSAMLAssertionAttributeAttributesWithDefaults instantiates a new SAMLAssertionAttributeAttributes 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 NewSAMLAssertionAttributeAttributesWithDefaults() *SAMLAssertionAttributeAttributes { - this := SAMLAssertionAttributeAttributes{} - return &this -} - -// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. -func (o *SAMLAssertionAttributeAttributes) GetAttributeKey() string { - if o == nil || o.AttributeKey == nil { - var ret string - return ret - } - return *o.AttributeKey -} - -// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SAMLAssertionAttributeAttributes) GetAttributeKeyOk() (*string, bool) { - if o == nil || o.AttributeKey == nil { - return nil, false - } - return o.AttributeKey, true -} - -// HasAttributeKey returns a boolean if a field has been set. -func (o *SAMLAssertionAttributeAttributes) HasAttributeKey() bool { - if o != nil && o.AttributeKey != nil { - return true - } - - return false -} - -// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. -func (o *SAMLAssertionAttributeAttributes) SetAttributeKey(v string) { - o.AttributeKey = &v -} - -// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. -func (o *SAMLAssertionAttributeAttributes) GetAttributeValue() string { - if o == nil || o.AttributeValue == nil { - var ret string - return ret - } - return *o.AttributeValue -} - -// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SAMLAssertionAttributeAttributes) GetAttributeValueOk() (*string, bool) { - if o == nil || o.AttributeValue == nil { - return nil, false - } - return o.AttributeValue, true -} - -// HasAttributeValue returns a boolean if a field has been set. -func (o *SAMLAssertionAttributeAttributes) HasAttributeValue() bool { - if o != nil && o.AttributeValue != nil { - return true - } - - return false -} - -// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. -func (o *SAMLAssertionAttributeAttributes) SetAttributeValue(v string) { - o.AttributeValue = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SAMLAssertionAttributeAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.AttributeKey != nil { - toSerialize["attribute_key"] = o.AttributeKey - } - if o.AttributeValue != nil { - toSerialize["attribute_value"] = o.AttributeValue - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SAMLAssertionAttributeAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - AttributeKey *string `json:"attribute_key,omitempty"` - AttributeValue *string `json:"attribute_value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.AttributeKey = all.AttributeKey - o.AttributeValue = all.AttributeValue - return nil -} diff --git a/api/v2/datadog/model_saml_assertion_attributes_type.go b/api/v2/datadog/model_saml_assertion_attributes_type.go deleted file mode 100644 index 4dfc7c99553..00000000000 --- a/api/v2/datadog/model_saml_assertion_attributes_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SAMLAssertionAttributesType SAML assertion attributes resource type. -type SAMLAssertionAttributesType string - -// List of SAMLAssertionAttributesType. -const ( - SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES SAMLAssertionAttributesType = "saml_assertion_attributes" -) - -var allowedSAMLAssertionAttributesTypeEnumValues = []SAMLAssertionAttributesType{ - SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SAMLAssertionAttributesType) GetAllowedValues() []SAMLAssertionAttributesType { - return allowedSAMLAssertionAttributesTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SAMLAssertionAttributesType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SAMLAssertionAttributesType(value) - return nil -} - -// NewSAMLAssertionAttributesTypeFromValue returns a pointer to a valid SAMLAssertionAttributesType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSAMLAssertionAttributesTypeFromValue(v string) (*SAMLAssertionAttributesType, error) { - ev := SAMLAssertionAttributesType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SAMLAssertionAttributesType: valid values are %v", v, allowedSAMLAssertionAttributesTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SAMLAssertionAttributesType) IsValid() bool { - for _, existing := range allowedSAMLAssertionAttributesTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SAMLAssertionAttributesType value. -func (v SAMLAssertionAttributesType) Ptr() *SAMLAssertionAttributesType { - return &v -} - -// NullableSAMLAssertionAttributesType handles when a null is used for SAMLAssertionAttributesType. -type NullableSAMLAssertionAttributesType struct { - value *SAMLAssertionAttributesType - isSet bool -} - -// Get returns the associated value. -func (v NullableSAMLAssertionAttributesType) Get() *SAMLAssertionAttributesType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSAMLAssertionAttributesType) Set(val *SAMLAssertionAttributesType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSAMLAssertionAttributesType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSAMLAssertionAttributesType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSAMLAssertionAttributesType initializes the struct as if Set has been called. -func NewNullableSAMLAssertionAttributesType(val *SAMLAssertionAttributesType) *NullableSAMLAssertionAttributesType { - return &NullableSAMLAssertionAttributesType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSAMLAssertionAttributesType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSAMLAssertionAttributesType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_filter.go b/api/v2/datadog/model_security_filter.go deleted file mode 100644 index d1dd515c9ce..00000000000 --- a/api/v2/datadog/model_security_filter.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityFilter The security filter's properties. -type SecurityFilter struct { - // The object describing a security filter. - Attributes *SecurityFilterAttributes `json:"attributes,omitempty"` - // The ID of the security filter. - Id *string `json:"id,omitempty"` - // The type of the resource. The value should always be `security_filters`. - Type *SecurityFilterType `json:"type,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{} -} - -// NewSecurityFilter instantiates a new SecurityFilter 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 NewSecurityFilter() *SecurityFilter { - this := SecurityFilter{} - var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS - this.Type = &typeVar - return &this -} - -// NewSecurityFilterWithDefaults instantiates a new SecurityFilter 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 NewSecurityFilterWithDefaults() *SecurityFilter { - this := SecurityFilter{} - var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SecurityFilter) GetAttributes() SecurityFilterAttributes { - if o == nil || o.Attributes == nil { - var ret SecurityFilterAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilter) GetAttributesOk() (*SecurityFilterAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SecurityFilter) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SecurityFilterAttributes and assigns it to the Attributes field. -func (o *SecurityFilter) SetAttributes(v SecurityFilterAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SecurityFilter) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilter) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SecurityFilter) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SecurityFilter) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SecurityFilter) GetType() SecurityFilterType { - if o == nil || o.Type == nil { - var ret SecurityFilterType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilter) GetTypeOk() (*SecurityFilterType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SecurityFilter) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SecurityFilterType and assigns it to the Type field. -func (o *SecurityFilter) SetType(v SecurityFilterType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *SecurityFilterAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *SecurityFilterType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_security_filter_attributes.go b/api/v2/datadog/model_security_filter_attributes.go deleted file mode 100644 index 60f7a857a3e..00000000000 --- a/api/v2/datadog/model_security_filter_attributes.go +++ /dev/null @@ -1,344 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityFilterAttributes The object describing a security filter. -type SecurityFilterAttributes struct { - // The list of exclusion filters applied in this security filter. - ExclusionFilters []SecurityFilterExclusionFilterResponse `json:"exclusion_filters,omitempty"` - // The filtered data type. - FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` - // Whether the security filter is the built-in filter. - IsBuiltin *bool `json:"is_builtin,omitempty"` - // Whether the security filter is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // The security filter name. - Name *string `json:"name,omitempty"` - // The security filter query. Logs accepted by this query will be accepted by this filter. - Query *string `json:"query,omitempty"` - // The version of the security filter. - Version *int32 `json:"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{} -} - -// NewSecurityFilterAttributes instantiates a new SecurityFilterAttributes 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 NewSecurityFilterAttributes() *SecurityFilterAttributes { - this := SecurityFilterAttributes{} - return &this -} - -// NewSecurityFilterAttributesWithDefaults instantiates a new SecurityFilterAttributes 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 NewSecurityFilterAttributesWithDefaults() *SecurityFilterAttributes { - this := SecurityFilterAttributes{} - return &this -} - -// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. -func (o *SecurityFilterAttributes) GetExclusionFilters() []SecurityFilterExclusionFilterResponse { - if o == nil || o.ExclusionFilters == nil { - var ret []SecurityFilterExclusionFilterResponse - return ret - } - return o.ExclusionFilters -} - -// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterAttributes) GetExclusionFiltersOk() (*[]SecurityFilterExclusionFilterResponse, bool) { - if o == nil || o.ExclusionFilters == nil { - return nil, false - } - return &o.ExclusionFilters, true -} - -// HasExclusionFilters returns a boolean if a field has been set. -func (o *SecurityFilterAttributes) HasExclusionFilters() bool { - if o != nil && o.ExclusionFilters != nil { - return true - } - - return false -} - -// SetExclusionFilters gets a reference to the given []SecurityFilterExclusionFilterResponse and assigns it to the ExclusionFilters field. -func (o *SecurityFilterAttributes) SetExclusionFilters(v []SecurityFilterExclusionFilterResponse) { - o.ExclusionFilters = v -} - -// GetFilteredDataType returns the FilteredDataType field value if set, zero value otherwise. -func (o *SecurityFilterAttributes) GetFilteredDataType() SecurityFilterFilteredDataType { - if o == nil || o.FilteredDataType == nil { - var ret SecurityFilterFilteredDataType - return ret - } - return *o.FilteredDataType -} - -// GetFilteredDataTypeOk returns a tuple with the FilteredDataType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterAttributes) GetFilteredDataTypeOk() (*SecurityFilterFilteredDataType, bool) { - if o == nil || o.FilteredDataType == nil { - return nil, false - } - return o.FilteredDataType, true -} - -// HasFilteredDataType returns a boolean if a field has been set. -func (o *SecurityFilterAttributes) HasFilteredDataType() bool { - if o != nil && o.FilteredDataType != nil { - return true - } - - return false -} - -// SetFilteredDataType gets a reference to the given SecurityFilterFilteredDataType and assigns it to the FilteredDataType field. -func (o *SecurityFilterAttributes) SetFilteredDataType(v SecurityFilterFilteredDataType) { - o.FilteredDataType = &v -} - -// GetIsBuiltin returns the IsBuiltin field value if set, zero value otherwise. -func (o *SecurityFilterAttributes) GetIsBuiltin() bool { - if o == nil || o.IsBuiltin == nil { - var ret bool - return ret - } - return *o.IsBuiltin -} - -// GetIsBuiltinOk returns a tuple with the IsBuiltin field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterAttributes) GetIsBuiltinOk() (*bool, bool) { - if o == nil || o.IsBuiltin == nil { - return nil, false - } - return o.IsBuiltin, true -} - -// HasIsBuiltin returns a boolean if a field has been set. -func (o *SecurityFilterAttributes) HasIsBuiltin() bool { - if o != nil && o.IsBuiltin != nil { - return true - } - - return false -} - -// SetIsBuiltin gets a reference to the given bool and assigns it to the IsBuiltin field. -func (o *SecurityFilterAttributes) SetIsBuiltin(v bool) { - o.IsBuiltin = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *SecurityFilterAttributes) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterAttributes) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *SecurityFilterAttributes) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *SecurityFilterAttributes) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityFilterAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityFilterAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityFilterAttributes) SetName(v string) { - o.Name = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SecurityFilterAttributes) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterAttributes) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SecurityFilterAttributes) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *SecurityFilterAttributes) SetQuery(v string) { - o.Query = &v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SecurityFilterAttributes) GetVersion() int32 { - if o == nil || o.Version == nil { - var ret int32 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterAttributes) GetVersionOk() (*int32, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SecurityFilterAttributes) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int32 and assigns it to the Version field. -func (o *SecurityFilterAttributes) SetVersion(v int32) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ExclusionFilters != nil { - toSerialize["exclusion_filters"] = o.ExclusionFilters - } - if o.FilteredDataType != nil { - toSerialize["filtered_data_type"] = o.FilteredDataType - } - if o.IsBuiltin != nil { - toSerialize["is_builtin"] = o.IsBuiltin - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ExclusionFilters []SecurityFilterExclusionFilterResponse `json:"exclusion_filters,omitempty"` - FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` - IsBuiltin *bool `json:"is_builtin,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Query *string `json:"query,omitempty"` - Version *int32 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.FilteredDataType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ExclusionFilters = all.ExclusionFilters - o.FilteredDataType = all.FilteredDataType - o.IsBuiltin = all.IsBuiltin - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Query = all.Query - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_security_filter_create_attributes.go b/api/v2/datadog/model_security_filter_create_attributes.go deleted file mode 100644 index 068ae891c83..00000000000 --- a/api/v2/datadog/model_security_filter_create_attributes.go +++ /dev/null @@ -1,243 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterCreateAttributes Object containing the attributes of the security filter to be created. -type SecurityFilterCreateAttributes struct { - // Exclusion filters to exclude some logs from the security filter. - ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters"` - // The filtered data type. - FilteredDataType SecurityFilterFilteredDataType `json:"filtered_data_type"` - // Whether the security filter is enabled. - IsEnabled bool `json:"is_enabled"` - // The name of the security filter. - Name string `json:"name"` - // The query of the security filter. - Query string `json:"query"` - // 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{} -} - -// NewSecurityFilterCreateAttributes instantiates a new SecurityFilterCreateAttributes 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 NewSecurityFilterCreateAttributes(exclusionFilters []SecurityFilterExclusionFilter, filteredDataType SecurityFilterFilteredDataType, isEnabled bool, name string, query string) *SecurityFilterCreateAttributes { - this := SecurityFilterCreateAttributes{} - this.ExclusionFilters = exclusionFilters - this.FilteredDataType = filteredDataType - this.IsEnabled = isEnabled - this.Name = name - this.Query = query - return &this -} - -// NewSecurityFilterCreateAttributesWithDefaults instantiates a new SecurityFilterCreateAttributes 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 NewSecurityFilterCreateAttributesWithDefaults() *SecurityFilterCreateAttributes { - this := SecurityFilterCreateAttributes{} - return &this -} - -// GetExclusionFilters returns the ExclusionFilters field value. -func (o *SecurityFilterCreateAttributes) GetExclusionFilters() []SecurityFilterExclusionFilter { - if o == nil { - var ret []SecurityFilterExclusionFilter - return ret - } - return o.ExclusionFilters -} - -// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value -// and a boolean to check if the value has been set. -func (o *SecurityFilterCreateAttributes) GetExclusionFiltersOk() (*[]SecurityFilterExclusionFilter, bool) { - if o == nil { - return nil, false - } - return &o.ExclusionFilters, true -} - -// SetExclusionFilters sets field value. -func (o *SecurityFilterCreateAttributes) SetExclusionFilters(v []SecurityFilterExclusionFilter) { - o.ExclusionFilters = v -} - -// GetFilteredDataType returns the FilteredDataType field value. -func (o *SecurityFilterCreateAttributes) GetFilteredDataType() SecurityFilterFilteredDataType { - if o == nil { - var ret SecurityFilterFilteredDataType - return ret - } - return o.FilteredDataType -} - -// GetFilteredDataTypeOk returns a tuple with the FilteredDataType field value -// and a boolean to check if the value has been set. -func (o *SecurityFilterCreateAttributes) GetFilteredDataTypeOk() (*SecurityFilterFilteredDataType, bool) { - if o == nil { - return nil, false - } - return &o.FilteredDataType, true -} - -// SetFilteredDataType sets field value. -func (o *SecurityFilterCreateAttributes) SetFilteredDataType(v SecurityFilterFilteredDataType) { - o.FilteredDataType = v -} - -// GetIsEnabled returns the IsEnabled field value. -func (o *SecurityFilterCreateAttributes) GetIsEnabled() bool { - if o == nil { - var ret bool - return ret - } - return o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value -// and a boolean to check if the value has been set. -func (o *SecurityFilterCreateAttributes) GetIsEnabledOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.IsEnabled, true -} - -// SetIsEnabled sets field value. -func (o *SecurityFilterCreateAttributes) SetIsEnabled(v bool) { - o.IsEnabled = v -} - -// GetName returns the Name field value. -func (o *SecurityFilterCreateAttributes) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SecurityFilterCreateAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SecurityFilterCreateAttributes) SetName(v string) { - o.Name = v -} - -// GetQuery returns the Query field value. -func (o *SecurityFilterCreateAttributes) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *SecurityFilterCreateAttributes) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *SecurityFilterCreateAttributes) SetQuery(v string) { - o.Query = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["exclusion_filters"] = o.ExclusionFilters - toSerialize["filtered_data_type"] = o.FilteredDataType - toSerialize["is_enabled"] = o.IsEnabled - toSerialize["name"] = o.Name - toSerialize["query"] = o.Query - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - ExclusionFilters *[]SecurityFilterExclusionFilter `json:"exclusion_filters"` - FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type"` - IsEnabled *bool `json:"is_enabled"` - Name *string `json:"name"` - Query *string `json:"query"` - }{} - all := struct { - ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters"` - FilteredDataType SecurityFilterFilteredDataType `json:"filtered_data_type"` - IsEnabled bool `json:"is_enabled"` - Name string `json:"name"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ExclusionFilters == nil { - return fmt.Errorf("Required field exclusion_filters missing") - } - if required.FilteredDataType == nil { - return fmt.Errorf("Required field filtered_data_type missing") - } - if required.IsEnabled == nil { - return fmt.Errorf("Required field is_enabled missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.FilteredDataType; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ExclusionFilters = all.ExclusionFilters - o.FilteredDataType = all.FilteredDataType - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_security_filter_create_data.go b/api/v2/datadog/model_security_filter_create_data.go deleted file mode 100644 index 59aa8ce333e..00000000000 --- a/api/v2/datadog/model_security_filter_create_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterCreateData Object for a single security filter. -type SecurityFilterCreateData struct { - // Object containing the attributes of the security filter to be created. - Attributes SecurityFilterCreateAttributes `json:"attributes"` - // The type of the resource. The value should always be `security_filters`. - Type SecurityFilterType `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{} -} - -// NewSecurityFilterCreateData instantiates a new SecurityFilterCreateData 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 NewSecurityFilterCreateData(attributes SecurityFilterCreateAttributes, typeVar SecurityFilterType) *SecurityFilterCreateData { - this := SecurityFilterCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewSecurityFilterCreateDataWithDefaults instantiates a new SecurityFilterCreateData 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 NewSecurityFilterCreateDataWithDefaults() *SecurityFilterCreateData { - this := SecurityFilterCreateData{} - var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *SecurityFilterCreateData) GetAttributes() SecurityFilterCreateAttributes { - if o == nil { - var ret SecurityFilterCreateAttributes - 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 *SecurityFilterCreateData) GetAttributesOk() (*SecurityFilterCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *SecurityFilterCreateData) SetAttributes(v SecurityFilterCreateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *SecurityFilterCreateData) GetType() SecurityFilterType { - if o == nil { - var ret SecurityFilterType - 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 *SecurityFilterCreateData) GetTypeOk() (*SecurityFilterType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SecurityFilterCreateData) SetType(v SecurityFilterType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *SecurityFilterCreateAttributes `json:"attributes"` - Type *SecurityFilterType `json:"type"` - }{} - all := struct { - Attributes SecurityFilterCreateAttributes `json:"attributes"` - Type SecurityFilterType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_security_filter_create_request.go b/api/v2/datadog/model_security_filter_create_request.go deleted file mode 100644 index 794a023503a..00000000000 --- a/api/v2/datadog/model_security_filter_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterCreateRequest Request object that includes the security filter that you would like to create. -type SecurityFilterCreateRequest struct { - // Object for a single security filter. - Data SecurityFilterCreateData `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{} -} - -// NewSecurityFilterCreateRequest instantiates a new SecurityFilterCreateRequest 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 NewSecurityFilterCreateRequest(data SecurityFilterCreateData) *SecurityFilterCreateRequest { - this := SecurityFilterCreateRequest{} - this.Data = data - return &this -} - -// NewSecurityFilterCreateRequestWithDefaults instantiates a new SecurityFilterCreateRequest 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 NewSecurityFilterCreateRequestWithDefaults() *SecurityFilterCreateRequest { - this := SecurityFilterCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *SecurityFilterCreateRequest) GetData() SecurityFilterCreateData { - if o == nil { - var ret SecurityFilterCreateData - 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 *SecurityFilterCreateRequest) GetDataOk() (*SecurityFilterCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *SecurityFilterCreateRequest) SetData(v SecurityFilterCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *SecurityFilterCreateData `json:"data"` - }{} - all := struct { - Data SecurityFilterCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_security_filter_exclusion_filter.go b/api/v2/datadog/model_security_filter_exclusion_filter.go deleted file mode 100644 index 992fdf2db53..00000000000 --- a/api/v2/datadog/model_security_filter_exclusion_filter.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterExclusionFilter Exclusion filter for the security filter. -type SecurityFilterExclusionFilter struct { - // Exclusion filter name. - Name string `json:"name"` - // Exclusion filter query. Logs that match this query are excluded from the security filter. - Query string `json:"query"` - // 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{} -} - -// NewSecurityFilterExclusionFilter instantiates a new SecurityFilterExclusionFilter 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 NewSecurityFilterExclusionFilter(name string, query string) *SecurityFilterExclusionFilter { - this := SecurityFilterExclusionFilter{} - this.Name = name - this.Query = query - return &this -} - -// NewSecurityFilterExclusionFilterWithDefaults instantiates a new SecurityFilterExclusionFilter 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 NewSecurityFilterExclusionFilterWithDefaults() *SecurityFilterExclusionFilter { - this := SecurityFilterExclusionFilter{} - return &this -} - -// GetName returns the Name field value. -func (o *SecurityFilterExclusionFilter) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SecurityFilterExclusionFilter) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SecurityFilterExclusionFilter) SetName(v string) { - o.Name = v -} - -// GetQuery returns the Query field value. -func (o *SecurityFilterExclusionFilter) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *SecurityFilterExclusionFilter) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *SecurityFilterExclusionFilter) SetQuery(v string) { - o.Query = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterExclusionFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["name"] = o.Name - toSerialize["query"] = o.Query - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Query *string `json:"query"` - }{} - all := struct { - Name string `json:"name"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_security_filter_exclusion_filter_response.go b/api/v2/datadog/model_security_filter_exclusion_filter_response.go deleted file mode 100644 index 408a275bff5..00000000000 --- a/api/v2/datadog/model_security_filter_exclusion_filter_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityFilterExclusionFilterResponse A single exclusion filter. -type SecurityFilterExclusionFilterResponse struct { - // The exclusion filter name. - Name *string `json:"name,omitempty"` - // The exclusion filter query. - Query *string `json:"query,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{} -} - -// NewSecurityFilterExclusionFilterResponse instantiates a new SecurityFilterExclusionFilterResponse 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 NewSecurityFilterExclusionFilterResponse() *SecurityFilterExclusionFilterResponse { - this := SecurityFilterExclusionFilterResponse{} - return &this -} - -// NewSecurityFilterExclusionFilterResponseWithDefaults instantiates a new SecurityFilterExclusionFilterResponse 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 NewSecurityFilterExclusionFilterResponseWithDefaults() *SecurityFilterExclusionFilterResponse { - this := SecurityFilterExclusionFilterResponse{} - return &this -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityFilterExclusionFilterResponse) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterExclusionFilterResponse) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityFilterExclusionFilterResponse) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityFilterExclusionFilterResponse) SetName(v string) { - o.Name = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SecurityFilterExclusionFilterResponse) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterExclusionFilterResponse) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SecurityFilterExclusionFilterResponse) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *SecurityFilterExclusionFilterResponse) SetQuery(v string) { - o.Query = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterExclusionFilterResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterExclusionFilterResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Name *string `json:"name,omitempty"` - Query *string `json:"query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Name = all.Name - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_security_filter_filtered_data_type.go b/api/v2/datadog/model_security_filter_filtered_data_type.go deleted file mode 100644 index 8a746eab8ea..00000000000 --- a/api/v2/datadog/model_security_filter_filtered_data_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterFilteredDataType The filtered data type. -type SecurityFilterFilteredDataType string - -// List of SecurityFilterFilteredDataType. -const ( - SECURITYFILTERFILTEREDDATATYPE_LOGS SecurityFilterFilteredDataType = "logs" -) - -var allowedSecurityFilterFilteredDataTypeEnumValues = []SecurityFilterFilteredDataType{ - SECURITYFILTERFILTEREDDATATYPE_LOGS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityFilterFilteredDataType) GetAllowedValues() []SecurityFilterFilteredDataType { - return allowedSecurityFilterFilteredDataTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityFilterFilteredDataType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityFilterFilteredDataType(value) - return nil -} - -// NewSecurityFilterFilteredDataTypeFromValue returns a pointer to a valid SecurityFilterFilteredDataType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityFilterFilteredDataTypeFromValue(v string) (*SecurityFilterFilteredDataType, error) { - ev := SecurityFilterFilteredDataType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityFilterFilteredDataType: valid values are %v", v, allowedSecurityFilterFilteredDataTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityFilterFilteredDataType) IsValid() bool { - for _, existing := range allowedSecurityFilterFilteredDataTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityFilterFilteredDataType value. -func (v SecurityFilterFilteredDataType) Ptr() *SecurityFilterFilteredDataType { - return &v -} - -// NullableSecurityFilterFilteredDataType handles when a null is used for SecurityFilterFilteredDataType. -type NullableSecurityFilterFilteredDataType struct { - value *SecurityFilterFilteredDataType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityFilterFilteredDataType) Get() *SecurityFilterFilteredDataType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityFilterFilteredDataType) Set(val *SecurityFilterFilteredDataType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityFilterFilteredDataType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityFilterFilteredDataType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityFilterFilteredDataType initializes the struct as if Set has been called. -func NewNullableSecurityFilterFilteredDataType(val *SecurityFilterFilteredDataType) *NullableSecurityFilterFilteredDataType { - return &NullableSecurityFilterFilteredDataType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityFilterFilteredDataType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityFilterFilteredDataType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_filter_meta.go b/api/v2/datadog/model_security_filter_meta.go deleted file mode 100644 index 1234910e0f4..00000000000 --- a/api/v2/datadog/model_security_filter_meta.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityFilterMeta Optional metadata associated to the response. -type SecurityFilterMeta struct { - // A warning message. - Warning *string `json:"warning,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{} -} - -// NewSecurityFilterMeta instantiates a new SecurityFilterMeta 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 NewSecurityFilterMeta() *SecurityFilterMeta { - this := SecurityFilterMeta{} - return &this -} - -// NewSecurityFilterMetaWithDefaults instantiates a new SecurityFilterMeta 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 NewSecurityFilterMetaWithDefaults() *SecurityFilterMeta { - this := SecurityFilterMeta{} - return &this -} - -// GetWarning returns the Warning field value if set, zero value otherwise. -func (o *SecurityFilterMeta) GetWarning() string { - if o == nil || o.Warning == nil { - var ret string - return ret - } - return *o.Warning -} - -// GetWarningOk returns a tuple with the Warning field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterMeta) GetWarningOk() (*string, bool) { - if o == nil || o.Warning == nil { - return nil, false - } - return o.Warning, true -} - -// HasWarning returns a boolean if a field has been set. -func (o *SecurityFilterMeta) HasWarning() bool { - if o != nil && o.Warning != nil { - return true - } - - return false -} - -// SetWarning gets a reference to the given string and assigns it to the Warning field. -func (o *SecurityFilterMeta) SetWarning(v string) { - o.Warning = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Warning != nil { - toSerialize["warning"] = o.Warning - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Warning *string `json:"warning,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Warning = all.Warning - return nil -} diff --git a/api/v2/datadog/model_security_filter_response.go b/api/v2/datadog/model_security_filter_response.go deleted file mode 100644 index a7ac08c0d42..00000000000 --- a/api/v2/datadog/model_security_filter_response.go +++ /dev/null @@ -1,155 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityFilterResponse Response object which includes a single security filter. -type SecurityFilterResponse struct { - // The security filter's properties. - Data *SecurityFilter `json:"data,omitempty"` - // Optional metadata associated to the response. - Meta *SecurityFilterMeta `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{} -} - -// NewSecurityFilterResponse instantiates a new SecurityFilterResponse 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 NewSecurityFilterResponse() *SecurityFilterResponse { - this := SecurityFilterResponse{} - return &this -} - -// NewSecurityFilterResponseWithDefaults instantiates a new SecurityFilterResponse 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 NewSecurityFilterResponseWithDefaults() *SecurityFilterResponse { - this := SecurityFilterResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SecurityFilterResponse) GetData() SecurityFilter { - if o == nil || o.Data == nil { - var ret SecurityFilter - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterResponse) GetDataOk() (*SecurityFilter, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SecurityFilterResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given SecurityFilter and assigns it to the Data field. -func (o *SecurityFilterResponse) SetData(v SecurityFilter) { - o.Data = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *SecurityFilterResponse) GetMeta() SecurityFilterMeta { - if o == nil || o.Meta == nil { - var ret SecurityFilterMeta - 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 *SecurityFilterResponse) GetMetaOk() (*SecurityFilterMeta, 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 *SecurityFilterResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given SecurityFilterMeta and assigns it to the Meta field. -func (o *SecurityFilterResponse) SetMeta(v SecurityFilterMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *SecurityFilter `json:"data,omitempty"` - Meta *SecurityFilterMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_security_filter_type.go b/api/v2/datadog/model_security_filter_type.go deleted file mode 100644 index 05d0d22d727..00000000000 --- a/api/v2/datadog/model_security_filter_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterType The type of the resource. The value should always be `security_filters`. -type SecurityFilterType string - -// List of SecurityFilterType. -const ( - SECURITYFILTERTYPE_SECURITY_FILTERS SecurityFilterType = "security_filters" -) - -var allowedSecurityFilterTypeEnumValues = []SecurityFilterType{ - SECURITYFILTERTYPE_SECURITY_FILTERS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityFilterType) GetAllowedValues() []SecurityFilterType { - return allowedSecurityFilterTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityFilterType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityFilterType(value) - return nil -} - -// NewSecurityFilterTypeFromValue returns a pointer to a valid SecurityFilterType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityFilterTypeFromValue(v string) (*SecurityFilterType, error) { - ev := SecurityFilterType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityFilterType: valid values are %v", v, allowedSecurityFilterTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityFilterType) IsValid() bool { - for _, existing := range allowedSecurityFilterTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityFilterType value. -func (v SecurityFilterType) Ptr() *SecurityFilterType { - return &v -} - -// NullableSecurityFilterType handles when a null is used for SecurityFilterType. -type NullableSecurityFilterType struct { - value *SecurityFilterType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityFilterType) Get() *SecurityFilterType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityFilterType) Set(val *SecurityFilterType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityFilterType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityFilterType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityFilterType initializes the struct as if Set has been called. -func NewNullableSecurityFilterType(val *SecurityFilterType) *NullableSecurityFilterType { - return &NullableSecurityFilterType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityFilterType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityFilterType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_filter_update_attributes.go b/api/v2/datadog/model_security_filter_update_attributes.go deleted file mode 100644 index 8642b9c872c..00000000000 --- a/api/v2/datadog/model_security_filter_update_attributes.go +++ /dev/null @@ -1,305 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityFilterUpdateAttributes The security filters properties to be updated. -type SecurityFilterUpdateAttributes struct { - // Exclusion filters to exclude some logs from the security filter. - ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters,omitempty"` - // The filtered data type. - FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` - // Whether the security filter is enabled. - IsEnabled *bool `json:"is_enabled,omitempty"` - // The name of the security filter. - Name *string `json:"name,omitempty"` - // The query of the security filter. - Query *string `json:"query,omitempty"` - // The version of the security filter to update. - Version *int32 `json:"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{} -} - -// NewSecurityFilterUpdateAttributes instantiates a new SecurityFilterUpdateAttributes 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 NewSecurityFilterUpdateAttributes() *SecurityFilterUpdateAttributes { - this := SecurityFilterUpdateAttributes{} - return &this -} - -// NewSecurityFilterUpdateAttributesWithDefaults instantiates a new SecurityFilterUpdateAttributes 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 NewSecurityFilterUpdateAttributesWithDefaults() *SecurityFilterUpdateAttributes { - this := SecurityFilterUpdateAttributes{} - return &this -} - -// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. -func (o *SecurityFilterUpdateAttributes) GetExclusionFilters() []SecurityFilterExclusionFilter { - if o == nil || o.ExclusionFilters == nil { - var ret []SecurityFilterExclusionFilter - return ret - } - return o.ExclusionFilters -} - -// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterUpdateAttributes) GetExclusionFiltersOk() (*[]SecurityFilterExclusionFilter, bool) { - if o == nil || o.ExclusionFilters == nil { - return nil, false - } - return &o.ExclusionFilters, true -} - -// HasExclusionFilters returns a boolean if a field has been set. -func (o *SecurityFilterUpdateAttributes) HasExclusionFilters() bool { - if o != nil && o.ExclusionFilters != nil { - return true - } - - return false -} - -// SetExclusionFilters gets a reference to the given []SecurityFilterExclusionFilter and assigns it to the ExclusionFilters field. -func (o *SecurityFilterUpdateAttributes) SetExclusionFilters(v []SecurityFilterExclusionFilter) { - o.ExclusionFilters = v -} - -// GetFilteredDataType returns the FilteredDataType field value if set, zero value otherwise. -func (o *SecurityFilterUpdateAttributes) GetFilteredDataType() SecurityFilterFilteredDataType { - if o == nil || o.FilteredDataType == nil { - var ret SecurityFilterFilteredDataType - return ret - } - return *o.FilteredDataType -} - -// GetFilteredDataTypeOk returns a tuple with the FilteredDataType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterUpdateAttributes) GetFilteredDataTypeOk() (*SecurityFilterFilteredDataType, bool) { - if o == nil || o.FilteredDataType == nil { - return nil, false - } - return o.FilteredDataType, true -} - -// HasFilteredDataType returns a boolean if a field has been set. -func (o *SecurityFilterUpdateAttributes) HasFilteredDataType() bool { - if o != nil && o.FilteredDataType != nil { - return true - } - - return false -} - -// SetFilteredDataType gets a reference to the given SecurityFilterFilteredDataType and assigns it to the FilteredDataType field. -func (o *SecurityFilterUpdateAttributes) SetFilteredDataType(v SecurityFilterFilteredDataType) { - o.FilteredDataType = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *SecurityFilterUpdateAttributes) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterUpdateAttributes) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *SecurityFilterUpdateAttributes) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *SecurityFilterUpdateAttributes) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityFilterUpdateAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityFilterUpdateAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityFilterUpdateAttributes) SetName(v string) { - o.Name = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SecurityFilterUpdateAttributes) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterUpdateAttributes) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SecurityFilterUpdateAttributes) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *SecurityFilterUpdateAttributes) SetQuery(v string) { - o.Query = &v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SecurityFilterUpdateAttributes) GetVersion() int32 { - if o == nil || o.Version == nil { - var ret int32 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFilterUpdateAttributes) GetVersionOk() (*int32, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SecurityFilterUpdateAttributes) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int32 and assigns it to the Version field. -func (o *SecurityFilterUpdateAttributes) SetVersion(v int32) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ExclusionFilters != nil { - toSerialize["exclusion_filters"] = o.ExclusionFilters - } - if o.FilteredDataType != nil { - toSerialize["filtered_data_type"] = o.FilteredDataType - } - if o.IsEnabled != nil { - toSerialize["is_enabled"] = o.IsEnabled - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters,omitempty"` - FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Query *string `json:"query,omitempty"` - Version *int32 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.FilteredDataType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ExclusionFilters = all.ExclusionFilters - o.FilteredDataType = all.FilteredDataType - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Query = all.Query - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_security_filter_update_data.go b/api/v2/datadog/model_security_filter_update_data.go deleted file mode 100644 index 8cf4f7c842b..00000000000 --- a/api/v2/datadog/model_security_filter_update_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterUpdateData The new security filter properties. -type SecurityFilterUpdateData struct { - // The security filters properties to be updated. - Attributes SecurityFilterUpdateAttributes `json:"attributes"` - // The type of the resource. The value should always be `security_filters`. - Type SecurityFilterType `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{} -} - -// NewSecurityFilterUpdateData instantiates a new SecurityFilterUpdateData 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 NewSecurityFilterUpdateData(attributes SecurityFilterUpdateAttributes, typeVar SecurityFilterType) *SecurityFilterUpdateData { - this := SecurityFilterUpdateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewSecurityFilterUpdateDataWithDefaults instantiates a new SecurityFilterUpdateData 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 NewSecurityFilterUpdateDataWithDefaults() *SecurityFilterUpdateData { - this := SecurityFilterUpdateData{} - var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *SecurityFilterUpdateData) GetAttributes() SecurityFilterUpdateAttributes { - if o == nil { - var ret SecurityFilterUpdateAttributes - 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 *SecurityFilterUpdateData) GetAttributesOk() (*SecurityFilterUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *SecurityFilterUpdateData) SetAttributes(v SecurityFilterUpdateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *SecurityFilterUpdateData) GetType() SecurityFilterType { - if o == nil { - var ret SecurityFilterType - 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 *SecurityFilterUpdateData) GetTypeOk() (*SecurityFilterType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *SecurityFilterUpdateData) SetType(v SecurityFilterType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *SecurityFilterUpdateAttributes `json:"attributes"` - Type *SecurityFilterType `json:"type"` - }{} - all := struct { - Attributes SecurityFilterUpdateAttributes `json:"attributes"` - Type SecurityFilterType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_security_filter_update_request.go b/api/v2/datadog/model_security_filter_update_request.go deleted file mode 100644 index 2a9c306f39b..00000000000 --- a/api/v2/datadog/model_security_filter_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityFilterUpdateRequest The new security filter body. -type SecurityFilterUpdateRequest struct { - // The new security filter properties. - Data SecurityFilterUpdateData `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{} -} - -// NewSecurityFilterUpdateRequest instantiates a new SecurityFilterUpdateRequest 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 NewSecurityFilterUpdateRequest(data SecurityFilterUpdateData) *SecurityFilterUpdateRequest { - this := SecurityFilterUpdateRequest{} - this.Data = data - return &this -} - -// NewSecurityFilterUpdateRequestWithDefaults instantiates a new SecurityFilterUpdateRequest 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 NewSecurityFilterUpdateRequestWithDefaults() *SecurityFilterUpdateRequest { - this := SecurityFilterUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *SecurityFilterUpdateRequest) GetData() SecurityFilterUpdateData { - if o == nil { - var ret SecurityFilterUpdateData - 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 *SecurityFilterUpdateRequest) GetDataOk() (*SecurityFilterUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *SecurityFilterUpdateRequest) SetData(v SecurityFilterUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFilterUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFilterUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *SecurityFilterUpdateData `json:"data"` - }{} - all := struct { - Data SecurityFilterUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_security_filters_response.go b/api/v2/datadog/model_security_filters_response.go deleted file mode 100644 index 921268c99f1..00000000000 --- a/api/v2/datadog/model_security_filters_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityFiltersResponse All the available security filters objects. -type SecurityFiltersResponse struct { - // A list of security filters objects. - Data []SecurityFilter `json:"data,omitempty"` - // Optional metadata associated to the response. - Meta *SecurityFilterMeta `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{} -} - -// NewSecurityFiltersResponse instantiates a new SecurityFiltersResponse 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 NewSecurityFiltersResponse() *SecurityFiltersResponse { - this := SecurityFiltersResponse{} - return &this -} - -// NewSecurityFiltersResponseWithDefaults instantiates a new SecurityFiltersResponse 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 NewSecurityFiltersResponseWithDefaults() *SecurityFiltersResponse { - this := SecurityFiltersResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SecurityFiltersResponse) GetData() []SecurityFilter { - if o == nil || o.Data == nil { - var ret []SecurityFilter - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityFiltersResponse) GetDataOk() (*[]SecurityFilter, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SecurityFiltersResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []SecurityFilter and assigns it to the Data field. -func (o *SecurityFiltersResponse) SetData(v []SecurityFilter) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *SecurityFiltersResponse) GetMeta() SecurityFilterMeta { - if o == nil || o.Meta == nil { - var ret SecurityFilterMeta - 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 *SecurityFiltersResponse) GetMetaOk() (*SecurityFilterMeta, 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 *SecurityFiltersResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given SecurityFilterMeta and assigns it to the Meta field. -func (o *SecurityFiltersResponse) SetMeta(v SecurityFilterMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityFiltersResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityFiltersResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []SecurityFilter `json:"data,omitempty"` - Meta *SecurityFilterMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_filter.go b/api/v2/datadog/model_security_monitoring_filter.go deleted file mode 100644 index 5df344fbbd4..00000000000 --- a/api/v2/datadog/model_security_monitoring_filter.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringFilter The rule's suppression filter. -type SecurityMonitoringFilter struct { - // The type of filtering action. - Action *SecurityMonitoringFilterAction `json:"action,omitempty"` - // Query for selecting logs to apply the filtering action. - Query *string `json:"query,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{} -} - -// NewSecurityMonitoringFilter instantiates a new SecurityMonitoringFilter 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 NewSecurityMonitoringFilter() *SecurityMonitoringFilter { - this := SecurityMonitoringFilter{} - return &this -} - -// NewSecurityMonitoringFilterWithDefaults instantiates a new SecurityMonitoringFilter 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 NewSecurityMonitoringFilterWithDefaults() *SecurityMonitoringFilter { - this := SecurityMonitoringFilter{} - return &this -} - -// GetAction returns the Action field value if set, zero value otherwise. -func (o *SecurityMonitoringFilter) GetAction() SecurityMonitoringFilterAction { - if o == nil || o.Action == nil { - var ret SecurityMonitoringFilterAction - return ret - } - return *o.Action -} - -// GetActionOk returns a tuple with the Action field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringFilter) GetActionOk() (*SecurityMonitoringFilterAction, bool) { - if o == nil || o.Action == nil { - return nil, false - } - return o.Action, true -} - -// HasAction returns a boolean if a field has been set. -func (o *SecurityMonitoringFilter) HasAction() bool { - if o != nil && o.Action != nil { - return true - } - - return false -} - -// SetAction gets a reference to the given SecurityMonitoringFilterAction and assigns it to the Action field. -func (o *SecurityMonitoringFilter) SetAction(v SecurityMonitoringFilterAction) { - o.Action = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SecurityMonitoringFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SecurityMonitoringFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *SecurityMonitoringFilter) SetQuery(v string) { - o.Query = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Action != nil { - toSerialize["action"] = o.Action - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Action *SecurityMonitoringFilterAction `json:"action,omitempty"` - Query *string `json:"query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Action; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Action = all.Action - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_filter_action.go b/api/v2/datadog/model_security_monitoring_filter_action.go deleted file mode 100644 index 353173b97ff..00000000000 --- a/api/v2/datadog/model_security_monitoring_filter_action.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringFilterAction The type of filtering action. -type SecurityMonitoringFilterAction string - -// List of SecurityMonitoringFilterAction. -const ( - SECURITYMONITORINGFILTERACTION_REQUIRE SecurityMonitoringFilterAction = "require" - SECURITYMONITORINGFILTERACTION_SUPPRESS SecurityMonitoringFilterAction = "suppress" -) - -var allowedSecurityMonitoringFilterActionEnumValues = []SecurityMonitoringFilterAction{ - SECURITYMONITORINGFILTERACTION_REQUIRE, - SECURITYMONITORINGFILTERACTION_SUPPRESS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringFilterAction) GetAllowedValues() []SecurityMonitoringFilterAction { - return allowedSecurityMonitoringFilterActionEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringFilterAction) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringFilterAction(value) - return nil -} - -// NewSecurityMonitoringFilterActionFromValue returns a pointer to a valid SecurityMonitoringFilterAction -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringFilterActionFromValue(v string) (*SecurityMonitoringFilterAction, error) { - ev := SecurityMonitoringFilterAction(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringFilterAction: valid values are %v", v, allowedSecurityMonitoringFilterActionEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringFilterAction) IsValid() bool { - for _, existing := range allowedSecurityMonitoringFilterActionEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringFilterAction value. -func (v SecurityMonitoringFilterAction) Ptr() *SecurityMonitoringFilterAction { - return &v -} - -// NullableSecurityMonitoringFilterAction handles when a null is used for SecurityMonitoringFilterAction. -type NullableSecurityMonitoringFilterAction struct { - value *SecurityMonitoringFilterAction - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringFilterAction) Get() *SecurityMonitoringFilterAction { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringFilterAction) Set(val *SecurityMonitoringFilterAction) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringFilterAction) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringFilterAction) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringFilterAction initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringFilterAction(val *SecurityMonitoringFilterAction) *NullableSecurityMonitoringFilterAction { - return &NullableSecurityMonitoringFilterAction{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringFilterAction) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringFilterAction) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_list_rules_response.go b/api/v2/datadog/model_security_monitoring_list_rules_response.go deleted file mode 100644 index 4802bb80dd1..00000000000 --- a/api/v2/datadog/model_security_monitoring_list_rules_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringListRulesResponse List of rules. -type SecurityMonitoringListRulesResponse struct { - // Array containing the list of rules. - Data []SecurityMonitoringRuleResponse `json:"data,omitempty"` - // Object describing meta attributes of response. - Meta *ResponseMetaAttributes `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{} -} - -// NewSecurityMonitoringListRulesResponse instantiates a new SecurityMonitoringListRulesResponse 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 NewSecurityMonitoringListRulesResponse() *SecurityMonitoringListRulesResponse { - this := SecurityMonitoringListRulesResponse{} - return &this -} - -// NewSecurityMonitoringListRulesResponseWithDefaults instantiates a new SecurityMonitoringListRulesResponse 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 NewSecurityMonitoringListRulesResponseWithDefaults() *SecurityMonitoringListRulesResponse { - this := SecurityMonitoringListRulesResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SecurityMonitoringListRulesResponse) GetData() []SecurityMonitoringRuleResponse { - if o == nil || o.Data == nil { - var ret []SecurityMonitoringRuleResponse - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringListRulesResponse) GetDataOk() (*[]SecurityMonitoringRuleResponse, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SecurityMonitoringListRulesResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []SecurityMonitoringRuleResponse and assigns it to the Data field. -func (o *SecurityMonitoringListRulesResponse) SetData(v []SecurityMonitoringRuleResponse) { - o.Data = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *SecurityMonitoringListRulesResponse) GetMeta() ResponseMetaAttributes { - if o == nil || o.Meta == nil { - var ret ResponseMetaAttributes - 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 *SecurityMonitoringListRulesResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *SecurityMonitoringListRulesResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. -func (o *SecurityMonitoringListRulesResponse) SetMeta(v ResponseMetaAttributes) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringListRulesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringListRulesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []SecurityMonitoringRuleResponse `json:"data,omitempty"` - Meta *ResponseMetaAttributes `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_case.go b/api/v2/datadog/model_security_monitoring_rule_case.go deleted file mode 100644 index 7961d664de4..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_case.go +++ /dev/null @@ -1,228 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringRuleCase Case when signal is generated. -type SecurityMonitoringRuleCase struct { - // A rule case contains logical operations (`>`,`>=`, `&&`, `||`) to determine if a signal should be generated - // based on the event counts in the previously defined queries. - Condition *string `json:"condition,omitempty"` - // Name of the case. - Name *string `json:"name,omitempty"` - // Notification targets for each rule case. - Notifications []string `json:"notifications,omitempty"` - // Severity of the Security Signal. - Status *SecurityMonitoringRuleSeverity `json:"status,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{} -} - -// NewSecurityMonitoringRuleCase instantiates a new SecurityMonitoringRuleCase 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 NewSecurityMonitoringRuleCase() *SecurityMonitoringRuleCase { - this := SecurityMonitoringRuleCase{} - return &this -} - -// NewSecurityMonitoringRuleCaseWithDefaults instantiates a new SecurityMonitoringRuleCase 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 NewSecurityMonitoringRuleCaseWithDefaults() *SecurityMonitoringRuleCase { - this := SecurityMonitoringRuleCase{} - return &this -} - -// GetCondition returns the Condition field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCase) GetCondition() string { - if o == nil || o.Condition == nil { - var ret string - return ret - } - return *o.Condition -} - -// GetConditionOk returns a tuple with the Condition field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCase) GetConditionOk() (*string, bool) { - if o == nil || o.Condition == nil { - return nil, false - } - return o.Condition, true -} - -// HasCondition returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCase) HasCondition() bool { - if o != nil && o.Condition != nil { - return true - } - - return false -} - -// SetCondition gets a reference to the given string and assigns it to the Condition field. -func (o *SecurityMonitoringRuleCase) SetCondition(v string) { - o.Condition = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCase) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCase) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCase) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityMonitoringRuleCase) SetName(v string) { - o.Name = &v -} - -// GetNotifications returns the Notifications field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCase) GetNotifications() []string { - if o == nil || o.Notifications == nil { - var ret []string - return ret - } - return o.Notifications -} - -// GetNotificationsOk returns a tuple with the Notifications field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCase) GetNotificationsOk() (*[]string, bool) { - if o == nil || o.Notifications == nil { - return nil, false - } - return &o.Notifications, true -} - -// HasNotifications returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCase) HasNotifications() bool { - if o != nil && o.Notifications != nil { - return true - } - - return false -} - -// SetNotifications gets a reference to the given []string and assigns it to the Notifications field. -func (o *SecurityMonitoringRuleCase) SetNotifications(v []string) { - o.Notifications = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCase) GetStatus() SecurityMonitoringRuleSeverity { - if o == nil || o.Status == nil { - var ret SecurityMonitoringRuleSeverity - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCase) GetStatusOk() (*SecurityMonitoringRuleSeverity, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCase) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given SecurityMonitoringRuleSeverity and assigns it to the Status field. -func (o *SecurityMonitoringRuleCase) SetStatus(v SecurityMonitoringRuleSeverity) { - o.Status = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleCase) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Condition != nil { - toSerialize["condition"] = o.Condition - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Notifications != nil { - toSerialize["notifications"] = o.Notifications - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleCase) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Condition *string `json:"condition,omitempty"` - Name *string `json:"name,omitempty"` - Notifications []string `json:"notifications,omitempty"` - Status *SecurityMonitoringRuleSeverity `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Condition = all.Condition - o.Name = all.Name - o.Notifications = all.Notifications - o.Status = all.Status - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_case_create.go b/api/v2/datadog/model_security_monitoring_rule_case_create.go deleted file mode 100644 index 5776b6affc9..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_case_create.go +++ /dev/null @@ -1,229 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleCaseCreate Case when signal is generated. -type SecurityMonitoringRuleCaseCreate struct { - // A rule case contains logical operations (`>`,`>=`, `&&`, `||`) to determine if a signal should be generated - // based on the event counts in the previously defined queries. - Condition *string `json:"condition,omitempty"` - // Name of the case. - Name *string `json:"name,omitempty"` - // Notification targets for each rule case. - Notifications []string `json:"notifications,omitempty"` - // Severity of the Security Signal. - Status SecurityMonitoringRuleSeverity `json:"status"` - // 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{} -} - -// NewSecurityMonitoringRuleCaseCreate instantiates a new SecurityMonitoringRuleCaseCreate 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 NewSecurityMonitoringRuleCaseCreate(status SecurityMonitoringRuleSeverity) *SecurityMonitoringRuleCaseCreate { - this := SecurityMonitoringRuleCaseCreate{} - this.Status = status - return &this -} - -// NewSecurityMonitoringRuleCaseCreateWithDefaults instantiates a new SecurityMonitoringRuleCaseCreate 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 NewSecurityMonitoringRuleCaseCreateWithDefaults() *SecurityMonitoringRuleCaseCreate { - this := SecurityMonitoringRuleCaseCreate{} - return &this -} - -// GetCondition returns the Condition field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCaseCreate) GetCondition() string { - if o == nil || o.Condition == nil { - var ret string - return ret - } - return *o.Condition -} - -// GetConditionOk returns a tuple with the Condition field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCaseCreate) GetConditionOk() (*string, bool) { - if o == nil || o.Condition == nil { - return nil, false - } - return o.Condition, true -} - -// HasCondition returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCaseCreate) HasCondition() bool { - if o != nil && o.Condition != nil { - return true - } - - return false -} - -// SetCondition gets a reference to the given string and assigns it to the Condition field. -func (o *SecurityMonitoringRuleCaseCreate) SetCondition(v string) { - o.Condition = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCaseCreate) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCaseCreate) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCaseCreate) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityMonitoringRuleCaseCreate) SetName(v string) { - o.Name = &v -} - -// GetNotifications returns the Notifications field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCaseCreate) GetNotifications() []string { - if o == nil || o.Notifications == nil { - var ret []string - return ret - } - return o.Notifications -} - -// GetNotificationsOk returns a tuple with the Notifications field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCaseCreate) GetNotificationsOk() (*[]string, bool) { - if o == nil || o.Notifications == nil { - return nil, false - } - return &o.Notifications, true -} - -// HasNotifications returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCaseCreate) HasNotifications() bool { - if o != nil && o.Notifications != nil { - return true - } - - return false -} - -// SetNotifications gets a reference to the given []string and assigns it to the Notifications field. -func (o *SecurityMonitoringRuleCaseCreate) SetNotifications(v []string) { - o.Notifications = v -} - -// GetStatus returns the Status field value. -func (o *SecurityMonitoringRuleCaseCreate) GetStatus() SecurityMonitoringRuleSeverity { - if o == nil { - var ret SecurityMonitoringRuleSeverity - return ret - } - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCaseCreate) GetStatusOk() (*SecurityMonitoringRuleSeverity, bool) { - if o == nil { - return nil, false - } - return &o.Status, true -} - -// SetStatus sets field value. -func (o *SecurityMonitoringRuleCaseCreate) SetStatus(v SecurityMonitoringRuleSeverity) { - o.Status = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleCaseCreate) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Condition != nil { - toSerialize["condition"] = o.Condition - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Notifications != nil { - toSerialize["notifications"] = o.Notifications - } - toSerialize["status"] = o.Status - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Status *SecurityMonitoringRuleSeverity `json:"status"` - }{} - all := struct { - Condition *string `json:"condition,omitempty"` - Name *string `json:"name,omitempty"` - Notifications []string `json:"notifications,omitempty"` - Status SecurityMonitoringRuleSeverity `json:"status"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Status == nil { - return fmt.Errorf("Required field status missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Status; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Condition = all.Condition - o.Name = all.Name - o.Notifications = all.Notifications - o.Status = all.Status - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_create_payload.go b/api/v2/datadog/model_security_monitoring_rule_create_payload.go deleted file mode 100644 index 818391d42d3..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_create_payload.go +++ /dev/null @@ -1,439 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleCreatePayload Create a new rule. -type SecurityMonitoringRuleCreatePayload struct { - // Cases for generating signals. - Cases []SecurityMonitoringRuleCaseCreate `json:"cases"` - // Additional queries to filter matched events before they are processed. - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - // Whether the notifications include the triggering group-by values in their title. - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - // Whether the rule is enabled. - IsEnabled bool `json:"isEnabled"` - // Message for generated signals. - Message string `json:"message"` - // The name of the rule. - Name string `json:"name"` - // Options on rules. - Options SecurityMonitoringRuleOptions `json:"options"` - // Queries for selecting logs which are part of the rule. - Queries []SecurityMonitoringRuleQueryCreate `json:"queries"` - // Tags for generated signals. - Tags []string `json:"tags,omitempty"` - // The rule type. - Type *SecurityMonitoringRuleTypeCreate `json:"type,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{} -} - -// NewSecurityMonitoringRuleCreatePayload instantiates a new SecurityMonitoringRuleCreatePayload 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 NewSecurityMonitoringRuleCreatePayload(cases []SecurityMonitoringRuleCaseCreate, isEnabled bool, message string, name string, options SecurityMonitoringRuleOptions, queries []SecurityMonitoringRuleQueryCreate) *SecurityMonitoringRuleCreatePayload { - this := SecurityMonitoringRuleCreatePayload{} - this.Cases = cases - this.IsEnabled = isEnabled - this.Message = message - this.Name = name - this.Options = options - this.Queries = queries - return &this -} - -// NewSecurityMonitoringRuleCreatePayloadWithDefaults instantiates a new SecurityMonitoringRuleCreatePayload 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 NewSecurityMonitoringRuleCreatePayloadWithDefaults() *SecurityMonitoringRuleCreatePayload { - this := SecurityMonitoringRuleCreatePayload{} - return &this -} - -// GetCases returns the Cases field value. -func (o *SecurityMonitoringRuleCreatePayload) GetCases() []SecurityMonitoringRuleCaseCreate { - if o == nil { - var ret []SecurityMonitoringRuleCaseCreate - return ret - } - return o.Cases -} - -// GetCasesOk returns a tuple with the Cases field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetCasesOk() (*[]SecurityMonitoringRuleCaseCreate, bool) { - if o == nil { - return nil, false - } - return &o.Cases, true -} - -// SetCases sets field value. -func (o *SecurityMonitoringRuleCreatePayload) SetCases(v []SecurityMonitoringRuleCaseCreate) { - o.Cases = v -} - -// GetFilters returns the Filters field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCreatePayload) GetFilters() []SecurityMonitoringFilter { - if o == nil || o.Filters == nil { - var ret []SecurityMonitoringFilter - return ret - } - return o.Filters -} - -// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetFiltersOk() (*[]SecurityMonitoringFilter, bool) { - if o == nil || o.Filters == nil { - return nil, false - } - return &o.Filters, true -} - -// HasFilters returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCreatePayload) HasFilters() bool { - if o != nil && o.Filters != nil { - return true - } - - return false -} - -// SetFilters gets a reference to the given []SecurityMonitoringFilter and assigns it to the Filters field. -func (o *SecurityMonitoringRuleCreatePayload) SetFilters(v []SecurityMonitoringFilter) { - o.Filters = v -} - -// GetHasExtendedTitle returns the HasExtendedTitle field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCreatePayload) GetHasExtendedTitle() bool { - if o == nil || o.HasExtendedTitle == nil { - var ret bool - return ret - } - return *o.HasExtendedTitle -} - -// GetHasExtendedTitleOk returns a tuple with the HasExtendedTitle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetHasExtendedTitleOk() (*bool, bool) { - if o == nil || o.HasExtendedTitle == nil { - return nil, false - } - return o.HasExtendedTitle, true -} - -// HasHasExtendedTitle returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCreatePayload) HasHasExtendedTitle() bool { - if o != nil && o.HasExtendedTitle != nil { - return true - } - - return false -} - -// SetHasExtendedTitle gets a reference to the given bool and assigns it to the HasExtendedTitle field. -func (o *SecurityMonitoringRuleCreatePayload) SetHasExtendedTitle(v bool) { - o.HasExtendedTitle = &v -} - -// GetIsEnabled returns the IsEnabled field value. -func (o *SecurityMonitoringRuleCreatePayload) GetIsEnabled() bool { - if o == nil { - var ret bool - return ret - } - return o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetIsEnabledOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.IsEnabled, true -} - -// SetIsEnabled sets field value. -func (o *SecurityMonitoringRuleCreatePayload) SetIsEnabled(v bool) { - o.IsEnabled = v -} - -// GetMessage returns the Message field value. -func (o *SecurityMonitoringRuleCreatePayload) GetMessage() string { - if o == nil { - var ret string - return ret - } - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *SecurityMonitoringRuleCreatePayload) SetMessage(v string) { - o.Message = v -} - -// GetName returns the Name field value. -func (o *SecurityMonitoringRuleCreatePayload) GetName() string { - if o == nil { - var ret string - return ret - } - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value. -func (o *SecurityMonitoringRuleCreatePayload) SetName(v string) { - o.Name = v -} - -// GetOptions returns the Options field value. -func (o *SecurityMonitoringRuleCreatePayload) GetOptions() SecurityMonitoringRuleOptions { - if o == nil { - var ret SecurityMonitoringRuleOptions - return ret - } - return o.Options -} - -// GetOptionsOk returns a tuple with the Options field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetOptionsOk() (*SecurityMonitoringRuleOptions, bool) { - if o == nil { - return nil, false - } - return &o.Options, true -} - -// SetOptions sets field value. -func (o *SecurityMonitoringRuleCreatePayload) SetOptions(v SecurityMonitoringRuleOptions) { - o.Options = v -} - -// GetQueries returns the Queries field value. -func (o *SecurityMonitoringRuleCreatePayload) GetQueries() []SecurityMonitoringRuleQueryCreate { - if o == nil { - var ret []SecurityMonitoringRuleQueryCreate - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetQueriesOk() (*[]SecurityMonitoringRuleQueryCreate, bool) { - if o == nil { - return nil, false - } - return &o.Queries, true -} - -// SetQueries sets field value. -func (o *SecurityMonitoringRuleCreatePayload) SetQueries(v []SecurityMonitoringRuleQueryCreate) { - o.Queries = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCreatePayload) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SecurityMonitoringRuleCreatePayload) GetTagsOk() (*[]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 *SecurityMonitoringRuleCreatePayload) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SecurityMonitoringRuleCreatePayload) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleCreatePayload) GetType() SecurityMonitoringRuleTypeCreate { - if o == nil || o.Type == nil { - var ret SecurityMonitoringRuleTypeCreate - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleCreatePayload) GetTypeOk() (*SecurityMonitoringRuleTypeCreate, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleCreatePayload) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SecurityMonitoringRuleTypeCreate and assigns it to the Type field. -func (o *SecurityMonitoringRuleCreatePayload) SetType(v SecurityMonitoringRuleTypeCreate) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleCreatePayload) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["cases"] = o.Cases - if o.Filters != nil { - toSerialize["filters"] = o.Filters - } - if o.HasExtendedTitle != nil { - toSerialize["hasExtendedTitle"] = o.HasExtendedTitle - } - toSerialize["isEnabled"] = o.IsEnabled - toSerialize["message"] = o.Message - toSerialize["name"] = o.Name - toSerialize["options"] = o.Options - toSerialize["queries"] = o.Queries - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` - IsEnabled *bool `json:"isEnabled"` - Message *string `json:"message"` - Name *string `json:"name"` - Options *SecurityMonitoringRuleOptions `json:"options"` - Queries *[]SecurityMonitoringRuleQueryCreate `json:"queries"` - }{} - all := struct { - Cases []SecurityMonitoringRuleCaseCreate `json:"cases"` - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - IsEnabled bool `json:"isEnabled"` - Message string `json:"message"` - Name string `json:"name"` - Options SecurityMonitoringRuleOptions `json:"options"` - Queries []SecurityMonitoringRuleQueryCreate `json:"queries"` - Tags []string `json:"tags,omitempty"` - Type *SecurityMonitoringRuleTypeCreate `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Cases == nil { - return fmt.Errorf("Required field cases missing") - } - if required.IsEnabled == nil { - return fmt.Errorf("Required field isEnabled missing") - } - if required.Message == nil { - return fmt.Errorf("Required field message missing") - } - if required.Name == nil { - return fmt.Errorf("Required field name missing") - } - if required.Options == nil { - return fmt.Errorf("Required field options missing") - } - if required.Queries == nil { - return fmt.Errorf("Required field queries missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cases = all.Cases - o.Filters = all.Filters - o.HasExtendedTitle = all.HasExtendedTitle - o.IsEnabled = all.IsEnabled - o.Message = all.Message - o.Name = all.Name - if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.Queries = all.Queries - o.Tags = all.Tags - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_detection_method.go b/api/v2/datadog/model_security_monitoring_rule_detection_method.go deleted file mode 100644 index e9a6727647d..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_detection_method.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleDetectionMethod The detection method. -type SecurityMonitoringRuleDetectionMethod string - -// List of SecurityMonitoringRuleDetectionMethod. -const ( - SECURITYMONITORINGRULEDETECTIONMETHOD_THRESHOLD SecurityMonitoringRuleDetectionMethod = "threshold" - SECURITYMONITORINGRULEDETECTIONMETHOD_NEW_VALUE SecurityMonitoringRuleDetectionMethod = "new_value" - SECURITYMONITORINGRULEDETECTIONMETHOD_ANOMALY_DETECTION SecurityMonitoringRuleDetectionMethod = "anomaly_detection" - SECURITYMONITORINGRULEDETECTIONMETHOD_IMPOSSIBLE_TRAVEL SecurityMonitoringRuleDetectionMethod = "impossible_travel" - SECURITYMONITORINGRULEDETECTIONMETHOD_HARDCODED SecurityMonitoringRuleDetectionMethod = "hardcoded" -) - -var allowedSecurityMonitoringRuleDetectionMethodEnumValues = []SecurityMonitoringRuleDetectionMethod{ - SECURITYMONITORINGRULEDETECTIONMETHOD_THRESHOLD, - SECURITYMONITORINGRULEDETECTIONMETHOD_NEW_VALUE, - SECURITYMONITORINGRULEDETECTIONMETHOD_ANOMALY_DETECTION, - SECURITYMONITORINGRULEDETECTIONMETHOD_IMPOSSIBLE_TRAVEL, - SECURITYMONITORINGRULEDETECTIONMETHOD_HARDCODED, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleDetectionMethod) GetAllowedValues() []SecurityMonitoringRuleDetectionMethod { - return allowedSecurityMonitoringRuleDetectionMethodEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleDetectionMethod) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleDetectionMethod(value) - return nil -} - -// NewSecurityMonitoringRuleDetectionMethodFromValue returns a pointer to a valid SecurityMonitoringRuleDetectionMethod -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleDetectionMethodFromValue(v string) (*SecurityMonitoringRuleDetectionMethod, error) { - ev := SecurityMonitoringRuleDetectionMethod(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleDetectionMethod: valid values are %v", v, allowedSecurityMonitoringRuleDetectionMethodEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleDetectionMethod) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleDetectionMethodEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleDetectionMethod value. -func (v SecurityMonitoringRuleDetectionMethod) Ptr() *SecurityMonitoringRuleDetectionMethod { - return &v -} - -// NullableSecurityMonitoringRuleDetectionMethod handles when a null is used for SecurityMonitoringRuleDetectionMethod. -type NullableSecurityMonitoringRuleDetectionMethod struct { - value *SecurityMonitoringRuleDetectionMethod - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleDetectionMethod) Get() *SecurityMonitoringRuleDetectionMethod { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleDetectionMethod) Set(val *SecurityMonitoringRuleDetectionMethod) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleDetectionMethod) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleDetectionMethod) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleDetectionMethod initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleDetectionMethod(val *SecurityMonitoringRuleDetectionMethod) *NullableSecurityMonitoringRuleDetectionMethod { - return &NullableSecurityMonitoringRuleDetectionMethod{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleDetectionMethod) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleDetectionMethod) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_evaluation_window.go b/api/v2/datadog/model_security_monitoring_rule_evaluation_window.go deleted file mode 100644 index 39bd6c70fe6..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_evaluation_window.go +++ /dev/null @@ -1,122 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleEvaluationWindow A time window is specified to match when at least one of the cases matches true. This is a sliding window -// and evaluates in real time. -type SecurityMonitoringRuleEvaluationWindow int32 - -// List of SecurityMonitoringRuleEvaluationWindow. -const ( - SECURITYMONITORINGRULEEVALUATIONWINDOW_ZERO_MINUTES SecurityMonitoringRuleEvaluationWindow = 0 - SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_MINUTE SecurityMonitoringRuleEvaluationWindow = 60 - SECURITYMONITORINGRULEEVALUATIONWINDOW_FIVE_MINUTES SecurityMonitoringRuleEvaluationWindow = 300 - SECURITYMONITORINGRULEEVALUATIONWINDOW_TEN_MINUTES SecurityMonitoringRuleEvaluationWindow = 600 - SECURITYMONITORINGRULEEVALUATIONWINDOW_FIFTEEN_MINUTES SecurityMonitoringRuleEvaluationWindow = 900 - SECURITYMONITORINGRULEEVALUATIONWINDOW_THIRTY_MINUTES SecurityMonitoringRuleEvaluationWindow = 1800 - SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_HOUR SecurityMonitoringRuleEvaluationWindow = 3600 - SECURITYMONITORINGRULEEVALUATIONWINDOW_TWO_HOURS SecurityMonitoringRuleEvaluationWindow = 7200 -) - -var allowedSecurityMonitoringRuleEvaluationWindowEnumValues = []SecurityMonitoringRuleEvaluationWindow{ - SECURITYMONITORINGRULEEVALUATIONWINDOW_ZERO_MINUTES, - SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_MINUTE, - SECURITYMONITORINGRULEEVALUATIONWINDOW_FIVE_MINUTES, - SECURITYMONITORINGRULEEVALUATIONWINDOW_TEN_MINUTES, - SECURITYMONITORINGRULEEVALUATIONWINDOW_FIFTEEN_MINUTES, - SECURITYMONITORINGRULEEVALUATIONWINDOW_THIRTY_MINUTES, - SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_HOUR, - SECURITYMONITORINGRULEEVALUATIONWINDOW_TWO_HOURS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleEvaluationWindow) GetAllowedValues() []SecurityMonitoringRuleEvaluationWindow { - return allowedSecurityMonitoringRuleEvaluationWindowEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleEvaluationWindow) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleEvaluationWindow(value) - return nil -} - -// NewSecurityMonitoringRuleEvaluationWindowFromValue returns a pointer to a valid SecurityMonitoringRuleEvaluationWindow -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleEvaluationWindowFromValue(v int32) (*SecurityMonitoringRuleEvaluationWindow, error) { - ev := SecurityMonitoringRuleEvaluationWindow(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleEvaluationWindow: valid values are %v", v, allowedSecurityMonitoringRuleEvaluationWindowEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleEvaluationWindow) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleEvaluationWindowEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleEvaluationWindow value. -func (v SecurityMonitoringRuleEvaluationWindow) Ptr() *SecurityMonitoringRuleEvaluationWindow { - return &v -} - -// NullableSecurityMonitoringRuleEvaluationWindow handles when a null is used for SecurityMonitoringRuleEvaluationWindow. -type NullableSecurityMonitoringRuleEvaluationWindow struct { - value *SecurityMonitoringRuleEvaluationWindow - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleEvaluationWindow) Get() *SecurityMonitoringRuleEvaluationWindow { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleEvaluationWindow) Set(val *SecurityMonitoringRuleEvaluationWindow) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleEvaluationWindow) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleEvaluationWindow) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleEvaluationWindow initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleEvaluationWindow(val *SecurityMonitoringRuleEvaluationWindow) *NullableSecurityMonitoringRuleEvaluationWindow { - return &NullableSecurityMonitoringRuleEvaluationWindow{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleEvaluationWindow) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleEvaluationWindow) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go b/api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go deleted file mode 100644 index 8d85c415cb5..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleHardcodedEvaluatorType Hardcoded evaluator type. -type SecurityMonitoringRuleHardcodedEvaluatorType string - -// List of SecurityMonitoringRuleHardcodedEvaluatorType. -const ( - SECURITYMONITORINGRULEHARDCODEDEVALUATORTYPE_LOG4SHELL SecurityMonitoringRuleHardcodedEvaluatorType = "log4shell" -) - -var allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues = []SecurityMonitoringRuleHardcodedEvaluatorType{ - SECURITYMONITORINGRULEHARDCODEDEVALUATORTYPE_LOG4SHELL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleHardcodedEvaluatorType) GetAllowedValues() []SecurityMonitoringRuleHardcodedEvaluatorType { - return allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleHardcodedEvaluatorType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleHardcodedEvaluatorType(value) - return nil -} - -// NewSecurityMonitoringRuleHardcodedEvaluatorTypeFromValue returns a pointer to a valid SecurityMonitoringRuleHardcodedEvaluatorType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleHardcodedEvaluatorTypeFromValue(v string) (*SecurityMonitoringRuleHardcodedEvaluatorType, error) { - ev := SecurityMonitoringRuleHardcodedEvaluatorType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleHardcodedEvaluatorType: valid values are %v", v, allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleHardcodedEvaluatorType) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleHardcodedEvaluatorType value. -func (v SecurityMonitoringRuleHardcodedEvaluatorType) Ptr() *SecurityMonitoringRuleHardcodedEvaluatorType { - return &v -} - -// NullableSecurityMonitoringRuleHardcodedEvaluatorType handles when a null is used for SecurityMonitoringRuleHardcodedEvaluatorType. -type NullableSecurityMonitoringRuleHardcodedEvaluatorType struct { - value *SecurityMonitoringRuleHardcodedEvaluatorType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) Get() *SecurityMonitoringRuleHardcodedEvaluatorType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) Set(val *SecurityMonitoringRuleHardcodedEvaluatorType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleHardcodedEvaluatorType initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleHardcodedEvaluatorType(val *SecurityMonitoringRuleHardcodedEvaluatorType) *NullableSecurityMonitoringRuleHardcodedEvaluatorType { - return &NullableSecurityMonitoringRuleHardcodedEvaluatorType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go b/api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go deleted file mode 100644 index bff4987bf79..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringRuleImpossibleTravelOptions Options on impossible travel rules. -type SecurityMonitoringRuleImpossibleTravelOptions struct { - // If true, signals are suppressed for the first 24 hours. In that time, Datadog learns the user's regular - // access locations. This can be helpful to reduce noise and infer VPN usage or credentialed API access. - BaselineUserLocations *bool `json:"baselineUserLocations,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{} -} - -// NewSecurityMonitoringRuleImpossibleTravelOptions instantiates a new SecurityMonitoringRuleImpossibleTravelOptions 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 NewSecurityMonitoringRuleImpossibleTravelOptions() *SecurityMonitoringRuleImpossibleTravelOptions { - this := SecurityMonitoringRuleImpossibleTravelOptions{} - return &this -} - -// NewSecurityMonitoringRuleImpossibleTravelOptionsWithDefaults instantiates a new SecurityMonitoringRuleImpossibleTravelOptions 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 NewSecurityMonitoringRuleImpossibleTravelOptionsWithDefaults() *SecurityMonitoringRuleImpossibleTravelOptions { - this := SecurityMonitoringRuleImpossibleTravelOptions{} - return &this -} - -// GetBaselineUserLocations returns the BaselineUserLocations field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleImpossibleTravelOptions) GetBaselineUserLocations() bool { - if o == nil || o.BaselineUserLocations == nil { - var ret bool - return ret - } - return *o.BaselineUserLocations -} - -// GetBaselineUserLocationsOk returns a tuple with the BaselineUserLocations field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleImpossibleTravelOptions) GetBaselineUserLocationsOk() (*bool, bool) { - if o == nil || o.BaselineUserLocations == nil { - return nil, false - } - return o.BaselineUserLocations, true -} - -// HasBaselineUserLocations returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleImpossibleTravelOptions) HasBaselineUserLocations() bool { - if o != nil && o.BaselineUserLocations != nil { - return true - } - - return false -} - -// SetBaselineUserLocations gets a reference to the given bool and assigns it to the BaselineUserLocations field. -func (o *SecurityMonitoringRuleImpossibleTravelOptions) SetBaselineUserLocations(v bool) { - o.BaselineUserLocations = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleImpossibleTravelOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.BaselineUserLocations != nil { - toSerialize["baselineUserLocations"] = o.BaselineUserLocations - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleImpossibleTravelOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - BaselineUserLocations *bool `json:"baselineUserLocations,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.BaselineUserLocations = all.BaselineUserLocations - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_keep_alive.go b/api/v2/datadog/model_security_monitoring_rule_keep_alive.go deleted file mode 100644 index 1d5425ca631..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_keep_alive.go +++ /dev/null @@ -1,126 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleKeepAlive Once a signal is generated, the signal will remain “open” if a case is matched at least once within -// this keep alive window. -type SecurityMonitoringRuleKeepAlive int32 - -// List of SecurityMonitoringRuleKeepAlive. -const ( - SECURITYMONITORINGRULEKEEPALIVE_ZERO_MINUTES SecurityMonitoringRuleKeepAlive = 0 - SECURITYMONITORINGRULEKEEPALIVE_ONE_MINUTE SecurityMonitoringRuleKeepAlive = 60 - SECURITYMONITORINGRULEKEEPALIVE_FIVE_MINUTES SecurityMonitoringRuleKeepAlive = 300 - SECURITYMONITORINGRULEKEEPALIVE_TEN_MINUTES SecurityMonitoringRuleKeepAlive = 600 - SECURITYMONITORINGRULEKEEPALIVE_FIFTEEN_MINUTES SecurityMonitoringRuleKeepAlive = 900 - SECURITYMONITORINGRULEKEEPALIVE_THIRTY_MINUTES SecurityMonitoringRuleKeepAlive = 1800 - SECURITYMONITORINGRULEKEEPALIVE_ONE_HOUR SecurityMonitoringRuleKeepAlive = 3600 - SECURITYMONITORINGRULEKEEPALIVE_TWO_HOURS SecurityMonitoringRuleKeepAlive = 7200 - SECURITYMONITORINGRULEKEEPALIVE_THREE_HOURS SecurityMonitoringRuleKeepAlive = 10800 - SECURITYMONITORINGRULEKEEPALIVE_SIX_HOURS SecurityMonitoringRuleKeepAlive = 21600 -) - -var allowedSecurityMonitoringRuleKeepAliveEnumValues = []SecurityMonitoringRuleKeepAlive{ - SECURITYMONITORINGRULEKEEPALIVE_ZERO_MINUTES, - SECURITYMONITORINGRULEKEEPALIVE_ONE_MINUTE, - SECURITYMONITORINGRULEKEEPALIVE_FIVE_MINUTES, - SECURITYMONITORINGRULEKEEPALIVE_TEN_MINUTES, - SECURITYMONITORINGRULEKEEPALIVE_FIFTEEN_MINUTES, - SECURITYMONITORINGRULEKEEPALIVE_THIRTY_MINUTES, - SECURITYMONITORINGRULEKEEPALIVE_ONE_HOUR, - SECURITYMONITORINGRULEKEEPALIVE_TWO_HOURS, - SECURITYMONITORINGRULEKEEPALIVE_THREE_HOURS, - SECURITYMONITORINGRULEKEEPALIVE_SIX_HOURS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleKeepAlive) GetAllowedValues() []SecurityMonitoringRuleKeepAlive { - return allowedSecurityMonitoringRuleKeepAliveEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleKeepAlive) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleKeepAlive(value) - return nil -} - -// NewSecurityMonitoringRuleKeepAliveFromValue returns a pointer to a valid SecurityMonitoringRuleKeepAlive -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleKeepAliveFromValue(v int32) (*SecurityMonitoringRuleKeepAlive, error) { - ev := SecurityMonitoringRuleKeepAlive(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleKeepAlive: valid values are %v", v, allowedSecurityMonitoringRuleKeepAliveEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleKeepAlive) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleKeepAliveEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleKeepAlive value. -func (v SecurityMonitoringRuleKeepAlive) Ptr() *SecurityMonitoringRuleKeepAlive { - return &v -} - -// NullableSecurityMonitoringRuleKeepAlive handles when a null is used for SecurityMonitoringRuleKeepAlive. -type NullableSecurityMonitoringRuleKeepAlive struct { - value *SecurityMonitoringRuleKeepAlive - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleKeepAlive) Get() *SecurityMonitoringRuleKeepAlive { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleKeepAlive) Set(val *SecurityMonitoringRuleKeepAlive) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleKeepAlive) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleKeepAlive) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleKeepAlive initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleKeepAlive(val *SecurityMonitoringRuleKeepAlive) *NullableSecurityMonitoringRuleKeepAlive { - return &NullableSecurityMonitoringRuleKeepAlive{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleKeepAlive) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleKeepAlive) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go b/api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go deleted file mode 100644 index a4a0869f7e8..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go +++ /dev/null @@ -1,130 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleMaxSignalDuration A signal will “close” regardless of the query being matched once the time exceeds the maximum duration. -// This time is calculated from the first seen timestamp. -type SecurityMonitoringRuleMaxSignalDuration int32 - -// List of SecurityMonitoringRuleMaxSignalDuration. -const ( - SECURITYMONITORINGRULEMAXSIGNALDURATION_ZERO_MINUTES SecurityMonitoringRuleMaxSignalDuration = 0 - SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_MINUTE SecurityMonitoringRuleMaxSignalDuration = 60 - SECURITYMONITORINGRULEMAXSIGNALDURATION_FIVE_MINUTES SecurityMonitoringRuleMaxSignalDuration = 300 - SECURITYMONITORINGRULEMAXSIGNALDURATION_TEN_MINUTES SecurityMonitoringRuleMaxSignalDuration = 600 - SECURITYMONITORINGRULEMAXSIGNALDURATION_FIFTEEN_MINUTES SecurityMonitoringRuleMaxSignalDuration = 900 - SECURITYMONITORINGRULEMAXSIGNALDURATION_THIRTY_MINUTES SecurityMonitoringRuleMaxSignalDuration = 1800 - SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_HOUR SecurityMonitoringRuleMaxSignalDuration = 3600 - SECURITYMONITORINGRULEMAXSIGNALDURATION_TWO_HOURS SecurityMonitoringRuleMaxSignalDuration = 7200 - SECURITYMONITORINGRULEMAXSIGNALDURATION_THREE_HOURS SecurityMonitoringRuleMaxSignalDuration = 10800 - SECURITYMONITORINGRULEMAXSIGNALDURATION_SIX_HOURS SecurityMonitoringRuleMaxSignalDuration = 21600 - SECURITYMONITORINGRULEMAXSIGNALDURATION_TWELVE_HOURS SecurityMonitoringRuleMaxSignalDuration = 43200 - SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_DAY SecurityMonitoringRuleMaxSignalDuration = 86400 -) - -var allowedSecurityMonitoringRuleMaxSignalDurationEnumValues = []SecurityMonitoringRuleMaxSignalDuration{ - SECURITYMONITORINGRULEMAXSIGNALDURATION_ZERO_MINUTES, - SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_MINUTE, - SECURITYMONITORINGRULEMAXSIGNALDURATION_FIVE_MINUTES, - SECURITYMONITORINGRULEMAXSIGNALDURATION_TEN_MINUTES, - SECURITYMONITORINGRULEMAXSIGNALDURATION_FIFTEEN_MINUTES, - SECURITYMONITORINGRULEMAXSIGNALDURATION_THIRTY_MINUTES, - SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_HOUR, - SECURITYMONITORINGRULEMAXSIGNALDURATION_TWO_HOURS, - SECURITYMONITORINGRULEMAXSIGNALDURATION_THREE_HOURS, - SECURITYMONITORINGRULEMAXSIGNALDURATION_SIX_HOURS, - SECURITYMONITORINGRULEMAXSIGNALDURATION_TWELVE_HOURS, - SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_DAY, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleMaxSignalDuration) GetAllowedValues() []SecurityMonitoringRuleMaxSignalDuration { - return allowedSecurityMonitoringRuleMaxSignalDurationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleMaxSignalDuration) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleMaxSignalDuration(value) - return nil -} - -// NewSecurityMonitoringRuleMaxSignalDurationFromValue returns a pointer to a valid SecurityMonitoringRuleMaxSignalDuration -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleMaxSignalDurationFromValue(v int32) (*SecurityMonitoringRuleMaxSignalDuration, error) { - ev := SecurityMonitoringRuleMaxSignalDuration(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleMaxSignalDuration: valid values are %v", v, allowedSecurityMonitoringRuleMaxSignalDurationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleMaxSignalDuration) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleMaxSignalDurationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleMaxSignalDuration value. -func (v SecurityMonitoringRuleMaxSignalDuration) Ptr() *SecurityMonitoringRuleMaxSignalDuration { - return &v -} - -// NullableSecurityMonitoringRuleMaxSignalDuration handles when a null is used for SecurityMonitoringRuleMaxSignalDuration. -type NullableSecurityMonitoringRuleMaxSignalDuration struct { - value *SecurityMonitoringRuleMaxSignalDuration - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleMaxSignalDuration) Get() *SecurityMonitoringRuleMaxSignalDuration { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleMaxSignalDuration) Set(val *SecurityMonitoringRuleMaxSignalDuration) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleMaxSignalDuration) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleMaxSignalDuration) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleMaxSignalDuration initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleMaxSignalDuration(val *SecurityMonitoringRuleMaxSignalDuration) *NullableSecurityMonitoringRuleMaxSignalDuration { - return &NullableSecurityMonitoringRuleMaxSignalDuration{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleMaxSignalDuration) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleMaxSignalDuration) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options.go deleted file mode 100644 index 57a0bd55702..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_new_value_options.go +++ /dev/null @@ -1,264 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringRuleNewValueOptions Options on new value rules. -type SecurityMonitoringRuleNewValueOptions struct { - // The duration in days after which a learned value is forgotten. - ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"` - // The duration in days during which values are learned, and after which signals will be generated for values that - // weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned. - LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` - // The learning method used to determine when signals should be generated for values that weren't learned. - LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"` - // A number of occurrences after which signals will be generated for values that weren't learned. - LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,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{} -} - -// NewSecurityMonitoringRuleNewValueOptions instantiates a new SecurityMonitoringRuleNewValueOptions 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 NewSecurityMonitoringRuleNewValueOptions() *SecurityMonitoringRuleNewValueOptions { - this := SecurityMonitoringRuleNewValueOptions{} - var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS - this.LearningDuration = &learningDuration - var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION - this.LearningMethod = &learningMethod - var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES - this.LearningThreshold = &learningThreshold - return &this -} - -// NewSecurityMonitoringRuleNewValueOptionsWithDefaults instantiates a new SecurityMonitoringRuleNewValueOptions 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 NewSecurityMonitoringRuleNewValueOptionsWithDefaults() *SecurityMonitoringRuleNewValueOptions { - this := SecurityMonitoringRuleNewValueOptions{} - var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS - this.LearningDuration = &learningDuration - var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION - this.LearningMethod = &learningMethod - var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES - this.LearningThreshold = &learningThreshold - return &this -} - -// GetForgetAfter returns the ForgetAfter field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleNewValueOptions) GetForgetAfter() SecurityMonitoringRuleNewValueOptionsForgetAfter { - if o == nil || o.ForgetAfter == nil { - var ret SecurityMonitoringRuleNewValueOptionsForgetAfter - return ret - } - return *o.ForgetAfter -} - -// GetForgetAfterOk returns a tuple with the ForgetAfter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleNewValueOptions) GetForgetAfterOk() (*SecurityMonitoringRuleNewValueOptionsForgetAfter, bool) { - if o == nil || o.ForgetAfter == nil { - return nil, false - } - return o.ForgetAfter, true -} - -// HasForgetAfter returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleNewValueOptions) HasForgetAfter() bool { - if o != nil && o.ForgetAfter != nil { - return true - } - - return false -} - -// SetForgetAfter gets a reference to the given SecurityMonitoringRuleNewValueOptionsForgetAfter and assigns it to the ForgetAfter field. -func (o *SecurityMonitoringRuleNewValueOptions) SetForgetAfter(v SecurityMonitoringRuleNewValueOptionsForgetAfter) { - o.ForgetAfter = &v -} - -// GetLearningDuration returns the LearningDuration field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleNewValueOptions) GetLearningDuration() SecurityMonitoringRuleNewValueOptionsLearningDuration { - if o == nil || o.LearningDuration == nil { - var ret SecurityMonitoringRuleNewValueOptionsLearningDuration - return ret - } - return *o.LearningDuration -} - -// GetLearningDurationOk returns a tuple with the LearningDuration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleNewValueOptions) GetLearningDurationOk() (*SecurityMonitoringRuleNewValueOptionsLearningDuration, bool) { - if o == nil || o.LearningDuration == nil { - return nil, false - } - return o.LearningDuration, true -} - -// HasLearningDuration returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleNewValueOptions) HasLearningDuration() bool { - if o != nil && o.LearningDuration != nil { - return true - } - - return false -} - -// SetLearningDuration gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningDuration and assigns it to the LearningDuration field. -func (o *SecurityMonitoringRuleNewValueOptions) SetLearningDuration(v SecurityMonitoringRuleNewValueOptionsLearningDuration) { - o.LearningDuration = &v -} - -// GetLearningMethod returns the LearningMethod field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethod() SecurityMonitoringRuleNewValueOptionsLearningMethod { - if o == nil || o.LearningMethod == nil { - var ret SecurityMonitoringRuleNewValueOptionsLearningMethod - return ret - } - return *o.LearningMethod -} - -// GetLearningMethodOk returns a tuple with the LearningMethod field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethodOk() (*SecurityMonitoringRuleNewValueOptionsLearningMethod, bool) { - if o == nil || o.LearningMethod == nil { - return nil, false - } - return o.LearningMethod, true -} - -// HasLearningMethod returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleNewValueOptions) HasLearningMethod() bool { - if o != nil && o.LearningMethod != nil { - return true - } - - return false -} - -// SetLearningMethod gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningMethod and assigns it to the LearningMethod field. -func (o *SecurityMonitoringRuleNewValueOptions) SetLearningMethod(v SecurityMonitoringRuleNewValueOptionsLearningMethod) { - o.LearningMethod = &v -} - -// GetLearningThreshold returns the LearningThreshold field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThreshold() SecurityMonitoringRuleNewValueOptionsLearningThreshold { - if o == nil || o.LearningThreshold == nil { - var ret SecurityMonitoringRuleNewValueOptionsLearningThreshold - return ret - } - return *o.LearningThreshold -} - -// GetLearningThresholdOk returns a tuple with the LearningThreshold field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThresholdOk() (*SecurityMonitoringRuleNewValueOptionsLearningThreshold, bool) { - if o == nil || o.LearningThreshold == nil { - return nil, false - } - return o.LearningThreshold, true -} - -// HasLearningThreshold returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleNewValueOptions) HasLearningThreshold() bool { - if o != nil && o.LearningThreshold != nil { - return true - } - - return false -} - -// SetLearningThreshold gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningThreshold and assigns it to the LearningThreshold field. -func (o *SecurityMonitoringRuleNewValueOptions) SetLearningThreshold(v SecurityMonitoringRuleNewValueOptionsLearningThreshold) { - o.LearningThreshold = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ForgetAfter != nil { - toSerialize["forgetAfter"] = o.ForgetAfter - } - if o.LearningDuration != nil { - toSerialize["learningDuration"] = o.LearningDuration - } - if o.LearningMethod != nil { - toSerialize["learningMethod"] = o.LearningMethod - } - if o.LearningThreshold != nil { - toSerialize["learningThreshold"] = o.LearningThreshold - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"` - LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` - LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"` - LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ForgetAfter; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LearningDuration; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LearningMethod; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.LearningThreshold; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ForgetAfter = all.ForgetAfter - o.LearningDuration = all.LearningDuration - o.LearningMethod = all.LearningMethod - o.LearningThreshold = all.LearningThreshold - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go deleted file mode 100644 index 71c2e84585b..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go +++ /dev/null @@ -1,117 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleNewValueOptionsForgetAfter The duration in days after which a learned value is forgotten. -type SecurityMonitoringRuleNewValueOptionsForgetAfter int32 - -// List of SecurityMonitoringRuleNewValueOptionsForgetAfter. -const ( - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_DAY SecurityMonitoringRuleNewValueOptionsForgetAfter = 1 - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_DAYS SecurityMonitoringRuleNewValueOptionsForgetAfter = 2 - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_WEEK SecurityMonitoringRuleNewValueOptionsForgetAfter = 7 - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_WEEKS SecurityMonitoringRuleNewValueOptionsForgetAfter = 14 - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_THREE_WEEKS SecurityMonitoringRuleNewValueOptionsForgetAfter = 21 - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_FOUR_WEEKS SecurityMonitoringRuleNewValueOptionsForgetAfter = 28 -) - -var allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues = []SecurityMonitoringRuleNewValueOptionsForgetAfter{ - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_DAY, - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_DAYS, - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_WEEK, - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_WEEKS, - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_THREE_WEEKS, - SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_FOUR_WEEKS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleNewValueOptionsForgetAfter) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsForgetAfter { - return allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleNewValueOptionsForgetAfter) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleNewValueOptionsForgetAfter(value) - return nil -} - -// NewSecurityMonitoringRuleNewValueOptionsForgetAfterFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsForgetAfter -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleNewValueOptionsForgetAfterFromValue(v int32) (*SecurityMonitoringRuleNewValueOptionsForgetAfter, error) { - ev := SecurityMonitoringRuleNewValueOptionsForgetAfter(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsForgetAfter: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleNewValueOptionsForgetAfter) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsForgetAfter value. -func (v SecurityMonitoringRuleNewValueOptionsForgetAfter) Ptr() *SecurityMonitoringRuleNewValueOptionsForgetAfter { - return &v -} - -// NullableSecurityMonitoringRuleNewValueOptionsForgetAfter handles when a null is used for SecurityMonitoringRuleNewValueOptionsForgetAfter. -type NullableSecurityMonitoringRuleNewValueOptionsForgetAfter struct { - value *SecurityMonitoringRuleNewValueOptionsForgetAfter - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Get() *SecurityMonitoringRuleNewValueOptionsForgetAfter { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Set(val *SecurityMonitoringRuleNewValueOptionsForgetAfter) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsForgetAfter initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsForgetAfter(val *SecurityMonitoringRuleNewValueOptionsForgetAfter) *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter { - return &NullableSecurityMonitoringRuleNewValueOptionsForgetAfter{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go deleted file mode 100644 index a58876ad4e6..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go +++ /dev/null @@ -1,112 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleNewValueOptionsLearningDuration The duration in days during which values are learned, and after which signals will be generated for values that -// weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned. -type SecurityMonitoringRuleNewValueOptionsLearningDuration int32 - -// List of SecurityMonitoringRuleNewValueOptionsLearningDuration. -const ( - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS SecurityMonitoringRuleNewValueOptionsLearningDuration = 0 - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ONE_DAY SecurityMonitoringRuleNewValueOptionsLearningDuration = 1 - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_SEVEN_DAYS SecurityMonitoringRuleNewValueOptionsLearningDuration = 7 -) - -var allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningDuration{ - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS, - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ONE_DAY, - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_SEVEN_DAYS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleNewValueOptionsLearningDuration) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningDuration { - return allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleNewValueOptionsLearningDuration) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleNewValueOptionsLearningDuration(value) - return nil -} - -// NewSecurityMonitoringRuleNewValueOptionsLearningDurationFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningDuration -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleNewValueOptionsLearningDurationFromValue(v int32) (*SecurityMonitoringRuleNewValueOptionsLearningDuration, error) { - ev := SecurityMonitoringRuleNewValueOptionsLearningDuration(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningDuration: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleNewValueOptionsLearningDuration) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningDuration value. -func (v SecurityMonitoringRuleNewValueOptionsLearningDuration) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningDuration { - return &v -} - -// NullableSecurityMonitoringRuleNewValueOptionsLearningDuration handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningDuration. -type NullableSecurityMonitoringRuleNewValueOptionsLearningDuration struct { - value *SecurityMonitoringRuleNewValueOptionsLearningDuration - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Get() *SecurityMonitoringRuleNewValueOptionsLearningDuration { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Set(val *SecurityMonitoringRuleNewValueOptionsLearningDuration) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsLearningDuration initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsLearningDuration(val *SecurityMonitoringRuleNewValueOptionsLearningDuration) *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration { - return &NullableSecurityMonitoringRuleNewValueOptionsLearningDuration{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go deleted file mode 100644 index 74a73006307..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleNewValueOptionsLearningMethod The learning method used to determine when signals should be generated for values that weren't learned. -type SecurityMonitoringRuleNewValueOptionsLearningMethod string - -// List of SecurityMonitoringRuleNewValueOptionsLearningMethod. -const ( - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION SecurityMonitoringRuleNewValueOptionsLearningMethod = "duration" - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD SecurityMonitoringRuleNewValueOptionsLearningMethod = "threshold" -) - -var allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningMethod{ - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION, - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningMethod { - return allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleNewValueOptionsLearningMethod(value) - return nil -} - -// NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningMethod -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue(v string) (*SecurityMonitoringRuleNewValueOptionsLearningMethod, error) { - ev := SecurityMonitoringRuleNewValueOptionsLearningMethod(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningMethod: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningMethod value. -func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningMethod { - return &v -} - -// NullableSecurityMonitoringRuleNewValueOptionsLearningMethod handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningMethod. -type NullableSecurityMonitoringRuleNewValueOptionsLearningMethod struct { - value *SecurityMonitoringRuleNewValueOptionsLearningMethod - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Get() *SecurityMonitoringRuleNewValueOptionsLearningMethod { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Set(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod { - return &NullableSecurityMonitoringRuleNewValueOptionsLearningMethod{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go deleted file mode 100644 index 9eac735356d..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleNewValueOptionsLearningThreshold A number of occurrences after which signals will be generated for values that weren't learned. -type SecurityMonitoringRuleNewValueOptionsLearningThreshold int32 - -// List of SecurityMonitoringRuleNewValueOptionsLearningThreshold. -const ( - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES SecurityMonitoringRuleNewValueOptionsLearningThreshold = 0 - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ONE_OCCURRENCE SecurityMonitoringRuleNewValueOptionsLearningThreshold = 1 -) - -var allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningThreshold{ - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES, - SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ONE_OCCURRENCE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleNewValueOptionsLearningThreshold) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningThreshold { - return allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleNewValueOptionsLearningThreshold) UnmarshalJSON(src []byte) error { - var value int32 - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleNewValueOptionsLearningThreshold(value) - return nil -} - -// NewSecurityMonitoringRuleNewValueOptionsLearningThresholdFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningThreshold -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleNewValueOptionsLearningThresholdFromValue(v int32) (*SecurityMonitoringRuleNewValueOptionsLearningThreshold, error) { - ev := SecurityMonitoringRuleNewValueOptionsLearningThreshold(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningThreshold: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningThreshold value. -func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { - return &v -} - -// NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningThreshold. -type NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold struct { - value *SecurityMonitoringRuleNewValueOptionsLearningThreshold - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Get() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Set(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold { - return &NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_options.go b/api/v2/datadog/model_security_monitoring_rule_options.go deleted file mode 100644 index 28a0f0a5514..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_options.go +++ /dev/null @@ -1,434 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringRuleOptions Options on rules. -type SecurityMonitoringRuleOptions struct { - // If true, signals in non-production environments have a lower severity than what is defined by the rule case, which can reduce signal noise. - // The severity is decreased by one level: `CRITICAL` in production becomes `HIGH` in non-production, `HIGH` becomes `MEDIUM` and so on. `INFO` remains `INFO`. - // The decrement is applied when the environment tag of the signal starts with `staging`, `test` or `dev`. - DecreaseCriticalityBasedOnEnv *bool `json:"decreaseCriticalityBasedOnEnv,omitempty"` - // The detection method. - DetectionMethod *SecurityMonitoringRuleDetectionMethod `json:"detectionMethod,omitempty"` - // A time window is specified to match when at least one of the cases matches true. This is a sliding window - // and evaluates in real time. - EvaluationWindow *SecurityMonitoringRuleEvaluationWindow `json:"evaluationWindow,omitempty"` - // Hardcoded evaluator type. - HardcodedEvaluatorType *SecurityMonitoringRuleHardcodedEvaluatorType `json:"hardcodedEvaluatorType,omitempty"` - // Options on impossible travel rules. - ImpossibleTravelOptions *SecurityMonitoringRuleImpossibleTravelOptions `json:"impossibleTravelOptions,omitempty"` - // Once a signal is generated, the signal will remain “open” if a case is matched at least once within - // this keep alive window. - KeepAlive *SecurityMonitoringRuleKeepAlive `json:"keepAlive,omitempty"` - // A signal will “close” regardless of the query being matched once the time exceeds the maximum duration. - // This time is calculated from the first seen timestamp. - MaxSignalDuration *SecurityMonitoringRuleMaxSignalDuration `json:"maxSignalDuration,omitempty"` - // Options on new value rules. - NewValueOptions *SecurityMonitoringRuleNewValueOptions `json:"newValueOptions,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{} -} - -// NewSecurityMonitoringRuleOptions instantiates a new SecurityMonitoringRuleOptions 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 NewSecurityMonitoringRuleOptions() *SecurityMonitoringRuleOptions { - this := SecurityMonitoringRuleOptions{} - return &this -} - -// NewSecurityMonitoringRuleOptionsWithDefaults instantiates a new SecurityMonitoringRuleOptions 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 NewSecurityMonitoringRuleOptionsWithDefaults() *SecurityMonitoringRuleOptions { - this := SecurityMonitoringRuleOptions{} - return &this -} - -// GetDecreaseCriticalityBasedOnEnv returns the DecreaseCriticalityBasedOnEnv field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetDecreaseCriticalityBasedOnEnv() bool { - if o == nil || o.DecreaseCriticalityBasedOnEnv == nil { - var ret bool - return ret - } - return *o.DecreaseCriticalityBasedOnEnv -} - -// GetDecreaseCriticalityBasedOnEnvOk returns a tuple with the DecreaseCriticalityBasedOnEnv field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetDecreaseCriticalityBasedOnEnvOk() (*bool, bool) { - if o == nil || o.DecreaseCriticalityBasedOnEnv == nil { - return nil, false - } - return o.DecreaseCriticalityBasedOnEnv, true -} - -// HasDecreaseCriticalityBasedOnEnv returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasDecreaseCriticalityBasedOnEnv() bool { - if o != nil && o.DecreaseCriticalityBasedOnEnv != nil { - return true - } - - return false -} - -// SetDecreaseCriticalityBasedOnEnv gets a reference to the given bool and assigns it to the DecreaseCriticalityBasedOnEnv field. -func (o *SecurityMonitoringRuleOptions) SetDecreaseCriticalityBasedOnEnv(v bool) { - o.DecreaseCriticalityBasedOnEnv = &v -} - -// GetDetectionMethod returns the DetectionMethod field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetDetectionMethod() SecurityMonitoringRuleDetectionMethod { - if o == nil || o.DetectionMethod == nil { - var ret SecurityMonitoringRuleDetectionMethod - return ret - } - return *o.DetectionMethod -} - -// GetDetectionMethodOk returns a tuple with the DetectionMethod field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetDetectionMethodOk() (*SecurityMonitoringRuleDetectionMethod, bool) { - if o == nil || o.DetectionMethod == nil { - return nil, false - } - return o.DetectionMethod, true -} - -// HasDetectionMethod returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasDetectionMethod() bool { - if o != nil && o.DetectionMethod != nil { - return true - } - - return false -} - -// SetDetectionMethod gets a reference to the given SecurityMonitoringRuleDetectionMethod and assigns it to the DetectionMethod field. -func (o *SecurityMonitoringRuleOptions) SetDetectionMethod(v SecurityMonitoringRuleDetectionMethod) { - o.DetectionMethod = &v -} - -// GetEvaluationWindow returns the EvaluationWindow field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetEvaluationWindow() SecurityMonitoringRuleEvaluationWindow { - if o == nil || o.EvaluationWindow == nil { - var ret SecurityMonitoringRuleEvaluationWindow - return ret - } - return *o.EvaluationWindow -} - -// GetEvaluationWindowOk returns a tuple with the EvaluationWindow field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetEvaluationWindowOk() (*SecurityMonitoringRuleEvaluationWindow, bool) { - if o == nil || o.EvaluationWindow == nil { - return nil, false - } - return o.EvaluationWindow, true -} - -// HasEvaluationWindow returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasEvaluationWindow() bool { - if o != nil && o.EvaluationWindow != nil { - return true - } - - return false -} - -// SetEvaluationWindow gets a reference to the given SecurityMonitoringRuleEvaluationWindow and assigns it to the EvaluationWindow field. -func (o *SecurityMonitoringRuleOptions) SetEvaluationWindow(v SecurityMonitoringRuleEvaluationWindow) { - o.EvaluationWindow = &v -} - -// GetHardcodedEvaluatorType returns the HardcodedEvaluatorType field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetHardcodedEvaluatorType() SecurityMonitoringRuleHardcodedEvaluatorType { - if o == nil || o.HardcodedEvaluatorType == nil { - var ret SecurityMonitoringRuleHardcodedEvaluatorType - return ret - } - return *o.HardcodedEvaluatorType -} - -// GetHardcodedEvaluatorTypeOk returns a tuple with the HardcodedEvaluatorType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetHardcodedEvaluatorTypeOk() (*SecurityMonitoringRuleHardcodedEvaluatorType, bool) { - if o == nil || o.HardcodedEvaluatorType == nil { - return nil, false - } - return o.HardcodedEvaluatorType, true -} - -// HasHardcodedEvaluatorType returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasHardcodedEvaluatorType() bool { - if o != nil && o.HardcodedEvaluatorType != nil { - return true - } - - return false -} - -// SetHardcodedEvaluatorType gets a reference to the given SecurityMonitoringRuleHardcodedEvaluatorType and assigns it to the HardcodedEvaluatorType field. -func (o *SecurityMonitoringRuleOptions) SetHardcodedEvaluatorType(v SecurityMonitoringRuleHardcodedEvaluatorType) { - o.HardcodedEvaluatorType = &v -} - -// GetImpossibleTravelOptions returns the ImpossibleTravelOptions field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetImpossibleTravelOptions() SecurityMonitoringRuleImpossibleTravelOptions { - if o == nil || o.ImpossibleTravelOptions == nil { - var ret SecurityMonitoringRuleImpossibleTravelOptions - return ret - } - return *o.ImpossibleTravelOptions -} - -// GetImpossibleTravelOptionsOk returns a tuple with the ImpossibleTravelOptions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetImpossibleTravelOptionsOk() (*SecurityMonitoringRuleImpossibleTravelOptions, bool) { - if o == nil || o.ImpossibleTravelOptions == nil { - return nil, false - } - return o.ImpossibleTravelOptions, true -} - -// HasImpossibleTravelOptions returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasImpossibleTravelOptions() bool { - if o != nil && o.ImpossibleTravelOptions != nil { - return true - } - - return false -} - -// SetImpossibleTravelOptions gets a reference to the given SecurityMonitoringRuleImpossibleTravelOptions and assigns it to the ImpossibleTravelOptions field. -func (o *SecurityMonitoringRuleOptions) SetImpossibleTravelOptions(v SecurityMonitoringRuleImpossibleTravelOptions) { - o.ImpossibleTravelOptions = &v -} - -// GetKeepAlive returns the KeepAlive field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetKeepAlive() SecurityMonitoringRuleKeepAlive { - if o == nil || o.KeepAlive == nil { - var ret SecurityMonitoringRuleKeepAlive - return ret - } - return *o.KeepAlive -} - -// GetKeepAliveOk returns a tuple with the KeepAlive field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetKeepAliveOk() (*SecurityMonitoringRuleKeepAlive, bool) { - if o == nil || o.KeepAlive == nil { - return nil, false - } - return o.KeepAlive, true -} - -// HasKeepAlive returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasKeepAlive() bool { - if o != nil && o.KeepAlive != nil { - return true - } - - return false -} - -// SetKeepAlive gets a reference to the given SecurityMonitoringRuleKeepAlive and assigns it to the KeepAlive field. -func (o *SecurityMonitoringRuleOptions) SetKeepAlive(v SecurityMonitoringRuleKeepAlive) { - o.KeepAlive = &v -} - -// GetMaxSignalDuration returns the MaxSignalDuration field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetMaxSignalDuration() SecurityMonitoringRuleMaxSignalDuration { - if o == nil || o.MaxSignalDuration == nil { - var ret SecurityMonitoringRuleMaxSignalDuration - return ret - } - return *o.MaxSignalDuration -} - -// GetMaxSignalDurationOk returns a tuple with the MaxSignalDuration field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetMaxSignalDurationOk() (*SecurityMonitoringRuleMaxSignalDuration, bool) { - if o == nil || o.MaxSignalDuration == nil { - return nil, false - } - return o.MaxSignalDuration, true -} - -// HasMaxSignalDuration returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasMaxSignalDuration() bool { - if o != nil && o.MaxSignalDuration != nil { - return true - } - - return false -} - -// SetMaxSignalDuration gets a reference to the given SecurityMonitoringRuleMaxSignalDuration and assigns it to the MaxSignalDuration field. -func (o *SecurityMonitoringRuleOptions) SetMaxSignalDuration(v SecurityMonitoringRuleMaxSignalDuration) { - o.MaxSignalDuration = &v -} - -// GetNewValueOptions returns the NewValueOptions field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleOptions) GetNewValueOptions() SecurityMonitoringRuleNewValueOptions { - if o == nil || o.NewValueOptions == nil { - var ret SecurityMonitoringRuleNewValueOptions - return ret - } - return *o.NewValueOptions -} - -// GetNewValueOptionsOk returns a tuple with the NewValueOptions field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleOptions) GetNewValueOptionsOk() (*SecurityMonitoringRuleNewValueOptions, bool) { - if o == nil || o.NewValueOptions == nil { - return nil, false - } - return o.NewValueOptions, true -} - -// HasNewValueOptions returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleOptions) HasNewValueOptions() bool { - if o != nil && o.NewValueOptions != nil { - return true - } - - return false -} - -// SetNewValueOptions gets a reference to the given SecurityMonitoringRuleNewValueOptions and assigns it to the NewValueOptions field. -func (o *SecurityMonitoringRuleOptions) SetNewValueOptions(v SecurityMonitoringRuleNewValueOptions) { - o.NewValueOptions = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.DecreaseCriticalityBasedOnEnv != nil { - toSerialize["decreaseCriticalityBasedOnEnv"] = o.DecreaseCriticalityBasedOnEnv - } - if o.DetectionMethod != nil { - toSerialize["detectionMethod"] = o.DetectionMethod - } - if o.EvaluationWindow != nil { - toSerialize["evaluationWindow"] = o.EvaluationWindow - } - if o.HardcodedEvaluatorType != nil { - toSerialize["hardcodedEvaluatorType"] = o.HardcodedEvaluatorType - } - if o.ImpossibleTravelOptions != nil { - toSerialize["impossibleTravelOptions"] = o.ImpossibleTravelOptions - } - if o.KeepAlive != nil { - toSerialize["keepAlive"] = o.KeepAlive - } - if o.MaxSignalDuration != nil { - toSerialize["maxSignalDuration"] = o.MaxSignalDuration - } - if o.NewValueOptions != nil { - toSerialize["newValueOptions"] = o.NewValueOptions - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleOptions) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - DecreaseCriticalityBasedOnEnv *bool `json:"decreaseCriticalityBasedOnEnv,omitempty"` - DetectionMethod *SecurityMonitoringRuleDetectionMethod `json:"detectionMethod,omitempty"` - EvaluationWindow *SecurityMonitoringRuleEvaluationWindow `json:"evaluationWindow,omitempty"` - HardcodedEvaluatorType *SecurityMonitoringRuleHardcodedEvaluatorType `json:"hardcodedEvaluatorType,omitempty"` - ImpossibleTravelOptions *SecurityMonitoringRuleImpossibleTravelOptions `json:"impossibleTravelOptions,omitempty"` - KeepAlive *SecurityMonitoringRuleKeepAlive `json:"keepAlive,omitempty"` - MaxSignalDuration *SecurityMonitoringRuleMaxSignalDuration `json:"maxSignalDuration,omitempty"` - NewValueOptions *SecurityMonitoringRuleNewValueOptions `json:"newValueOptions,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.DetectionMethod; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.EvaluationWindow; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.HardcodedEvaluatorType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.KeepAlive; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.MaxSignalDuration; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.DecreaseCriticalityBasedOnEnv = all.DecreaseCriticalityBasedOnEnv - o.DetectionMethod = all.DetectionMethod - o.EvaluationWindow = all.EvaluationWindow - o.HardcodedEvaluatorType = all.HardcodedEvaluatorType - if all.ImpossibleTravelOptions != nil && all.ImpossibleTravelOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ImpossibleTravelOptions = all.ImpossibleTravelOptions - o.KeepAlive = all.KeepAlive - o.MaxSignalDuration = all.MaxSignalDuration - if all.NewValueOptions != nil && all.NewValueOptions.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.NewValueOptions = all.NewValueOptions - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_query.go b/api/v2/datadog/model_security_monitoring_rule_query.go deleted file mode 100644 index 218d8a28f47..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_query.go +++ /dev/null @@ -1,345 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringRuleQuery Query for matching rule. -type SecurityMonitoringRuleQuery struct { - // The aggregation type. - Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` - // Field for which the cardinality is measured. Sent as an array. - DistinctFields []string `json:"distinctFields,omitempty"` - // Fields to group by. - GroupByFields []string `json:"groupByFields,omitempty"` - // The target field to aggregate over when using the sum or max - // aggregations. - Metric *string `json:"metric,omitempty"` - // Group of target fields to aggregate over when using the new value aggregations. - Metrics []string `json:"metrics,omitempty"` - // Name of the query. - Name *string `json:"name,omitempty"` - // Query to run on logs. - Query *string `json:"query,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{} -} - -// NewSecurityMonitoringRuleQuery instantiates a new SecurityMonitoringRuleQuery 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 NewSecurityMonitoringRuleQuery() *SecurityMonitoringRuleQuery { - this := SecurityMonitoringRuleQuery{} - return &this -} - -// NewSecurityMonitoringRuleQueryWithDefaults instantiates a new SecurityMonitoringRuleQuery 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 NewSecurityMonitoringRuleQueryWithDefaults() *SecurityMonitoringRuleQuery { - this := SecurityMonitoringRuleQuery{} - return &this -} - -// GetAggregation returns the Aggregation field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQuery) GetAggregation() SecurityMonitoringRuleQueryAggregation { - if o == nil || o.Aggregation == nil { - var ret SecurityMonitoringRuleQueryAggregation - return ret - } - return *o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQuery) GetAggregationOk() (*SecurityMonitoringRuleQueryAggregation, bool) { - if o == nil || o.Aggregation == nil { - return nil, false - } - return o.Aggregation, true -} - -// HasAggregation returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQuery) HasAggregation() bool { - if o != nil && o.Aggregation != nil { - return true - } - - return false -} - -// SetAggregation gets a reference to the given SecurityMonitoringRuleQueryAggregation and assigns it to the Aggregation field. -func (o *SecurityMonitoringRuleQuery) SetAggregation(v SecurityMonitoringRuleQueryAggregation) { - o.Aggregation = &v -} - -// GetDistinctFields returns the DistinctFields field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQuery) GetDistinctFields() []string { - if o == nil || o.DistinctFields == nil { - var ret []string - return ret - } - return o.DistinctFields -} - -// GetDistinctFieldsOk returns a tuple with the DistinctFields field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQuery) GetDistinctFieldsOk() (*[]string, bool) { - if o == nil || o.DistinctFields == nil { - return nil, false - } - return &o.DistinctFields, true -} - -// HasDistinctFields returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQuery) HasDistinctFields() bool { - if o != nil && o.DistinctFields != nil { - return true - } - - return false -} - -// SetDistinctFields gets a reference to the given []string and assigns it to the DistinctFields field. -func (o *SecurityMonitoringRuleQuery) SetDistinctFields(v []string) { - o.DistinctFields = v -} - -// GetGroupByFields returns the GroupByFields field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQuery) GetGroupByFields() []string { - if o == nil || o.GroupByFields == nil { - var ret []string - return ret - } - return o.GroupByFields -} - -// GetGroupByFieldsOk returns a tuple with the GroupByFields field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQuery) GetGroupByFieldsOk() (*[]string, bool) { - if o == nil || o.GroupByFields == nil { - return nil, false - } - return &o.GroupByFields, true -} - -// HasGroupByFields returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQuery) HasGroupByFields() bool { - if o != nil && o.GroupByFields != nil { - return true - } - - return false -} - -// SetGroupByFields gets a reference to the given []string and assigns it to the GroupByFields field. -func (o *SecurityMonitoringRuleQuery) SetGroupByFields(v []string) { - o.GroupByFields = v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQuery) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQuery) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQuery) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *SecurityMonitoringRuleQuery) SetMetric(v string) { - o.Metric = &v -} - -// GetMetrics returns the Metrics field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQuery) GetMetrics() []string { - if o == nil || o.Metrics == nil { - var ret []string - return ret - } - return o.Metrics -} - -// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQuery) GetMetricsOk() (*[]string, bool) { - if o == nil || o.Metrics == nil { - return nil, false - } - return &o.Metrics, true -} - -// HasMetrics returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQuery) HasMetrics() bool { - if o != nil && o.Metrics != nil { - return true - } - - return false -} - -// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. -func (o *SecurityMonitoringRuleQuery) SetMetrics(v []string) { - o.Metrics = v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQuery) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQuery) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQuery) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityMonitoringRuleQuery) SetName(v string) { - o.Name = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQuery) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQuery) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQuery) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *SecurityMonitoringRuleQuery) SetQuery(v string) { - o.Query = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleQuery) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregation != nil { - toSerialize["aggregation"] = o.Aggregation - } - if o.DistinctFields != nil { - toSerialize["distinctFields"] = o.DistinctFields - } - if o.GroupByFields != nil { - toSerialize["groupByFields"] = o.GroupByFields - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Metrics != nil { - toSerialize["metrics"] = o.Metrics - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleQuery) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` - DistinctFields []string `json:"distinctFields,omitempty"` - GroupByFields []string `json:"groupByFields,omitempty"` - Metric *string `json:"metric,omitempty"` - Metrics []string `json:"metrics,omitempty"` - Name *string `json:"name,omitempty"` - Query *string `json:"query,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.DistinctFields = all.DistinctFields - o.GroupByFields = all.GroupByFields - o.Metric = all.Metric - o.Metrics = all.Metrics - o.Name = all.Name - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_query_aggregation.go b/api/v2/datadog/model_security_monitoring_rule_query_aggregation.go deleted file mode 100644 index d6323cf9bb1..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_query_aggregation.go +++ /dev/null @@ -1,117 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleQueryAggregation The aggregation type. -type SecurityMonitoringRuleQueryAggregation string - -// List of SecurityMonitoringRuleQueryAggregation. -const ( - SECURITYMONITORINGRULEQUERYAGGREGATION_COUNT SecurityMonitoringRuleQueryAggregation = "count" - SECURITYMONITORINGRULEQUERYAGGREGATION_CARDINALITY SecurityMonitoringRuleQueryAggregation = "cardinality" - SECURITYMONITORINGRULEQUERYAGGREGATION_SUM SecurityMonitoringRuleQueryAggregation = "sum" - SECURITYMONITORINGRULEQUERYAGGREGATION_MAX SecurityMonitoringRuleQueryAggregation = "max" - SECURITYMONITORINGRULEQUERYAGGREGATION_NEW_VALUE SecurityMonitoringRuleQueryAggregation = "new_value" - SECURITYMONITORINGRULEQUERYAGGREGATION_GEO_DATA SecurityMonitoringRuleQueryAggregation = "geo_data" -) - -var allowedSecurityMonitoringRuleQueryAggregationEnumValues = []SecurityMonitoringRuleQueryAggregation{ - SECURITYMONITORINGRULEQUERYAGGREGATION_COUNT, - SECURITYMONITORINGRULEQUERYAGGREGATION_CARDINALITY, - SECURITYMONITORINGRULEQUERYAGGREGATION_SUM, - SECURITYMONITORINGRULEQUERYAGGREGATION_MAX, - SECURITYMONITORINGRULEQUERYAGGREGATION_NEW_VALUE, - SECURITYMONITORINGRULEQUERYAGGREGATION_GEO_DATA, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleQueryAggregation) GetAllowedValues() []SecurityMonitoringRuleQueryAggregation { - return allowedSecurityMonitoringRuleQueryAggregationEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleQueryAggregation) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleQueryAggregation(value) - return nil -} - -// NewSecurityMonitoringRuleQueryAggregationFromValue returns a pointer to a valid SecurityMonitoringRuleQueryAggregation -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleQueryAggregationFromValue(v string) (*SecurityMonitoringRuleQueryAggregation, error) { - ev := SecurityMonitoringRuleQueryAggregation(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleQueryAggregation: valid values are %v", v, allowedSecurityMonitoringRuleQueryAggregationEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleQueryAggregation) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleQueryAggregationEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleQueryAggregation value. -func (v SecurityMonitoringRuleQueryAggregation) Ptr() *SecurityMonitoringRuleQueryAggregation { - return &v -} - -// NullableSecurityMonitoringRuleQueryAggregation handles when a null is used for SecurityMonitoringRuleQueryAggregation. -type NullableSecurityMonitoringRuleQueryAggregation struct { - value *SecurityMonitoringRuleQueryAggregation - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleQueryAggregation) Get() *SecurityMonitoringRuleQueryAggregation { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleQueryAggregation) Set(val *SecurityMonitoringRuleQueryAggregation) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleQueryAggregation) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleQueryAggregation) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleQueryAggregation initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleQueryAggregation(val *SecurityMonitoringRuleQueryAggregation) *NullableSecurityMonitoringRuleQueryAggregation { - return &NullableSecurityMonitoringRuleQueryAggregation{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleQueryAggregation) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleQueryAggregation) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_query_create.go b/api/v2/datadog/model_security_monitoring_rule_query_create.go deleted file mode 100644 index 2a89c57cbd9..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_query_create.go +++ /dev/null @@ -1,346 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleQueryCreate Query for matching rule. -type SecurityMonitoringRuleQueryCreate struct { - // The aggregation type. - Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` - // Field for which the cardinality is measured. Sent as an array. - DistinctFields []string `json:"distinctFields,omitempty"` - // Fields to group by. - GroupByFields []string `json:"groupByFields,omitempty"` - // The target field to aggregate over when using the sum or max - // aggregations. - Metric *string `json:"metric,omitempty"` - // Group of target fields to aggregate over when using the new value aggregations. - Metrics []string `json:"metrics,omitempty"` - // Name of the query. - Name *string `json:"name,omitempty"` - // Query to run on logs. - Query string `json:"query"` - // 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{} -} - -// NewSecurityMonitoringRuleQueryCreate instantiates a new SecurityMonitoringRuleQueryCreate 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 NewSecurityMonitoringRuleQueryCreate(query string) *SecurityMonitoringRuleQueryCreate { - this := SecurityMonitoringRuleQueryCreate{} - this.Query = query - return &this -} - -// NewSecurityMonitoringRuleQueryCreateWithDefaults instantiates a new SecurityMonitoringRuleQueryCreate 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 NewSecurityMonitoringRuleQueryCreateWithDefaults() *SecurityMonitoringRuleQueryCreate { - this := SecurityMonitoringRuleQueryCreate{} - return &this -} - -// GetAggregation returns the Aggregation field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQueryCreate) GetAggregation() SecurityMonitoringRuleQueryAggregation { - if o == nil || o.Aggregation == nil { - var ret SecurityMonitoringRuleQueryAggregation - return ret - } - return *o.Aggregation -} - -// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQueryCreate) GetAggregationOk() (*SecurityMonitoringRuleQueryAggregation, bool) { - if o == nil || o.Aggregation == nil { - return nil, false - } - return o.Aggregation, true -} - -// HasAggregation returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQueryCreate) HasAggregation() bool { - if o != nil && o.Aggregation != nil { - return true - } - - return false -} - -// SetAggregation gets a reference to the given SecurityMonitoringRuleQueryAggregation and assigns it to the Aggregation field. -func (o *SecurityMonitoringRuleQueryCreate) SetAggregation(v SecurityMonitoringRuleQueryAggregation) { - o.Aggregation = &v -} - -// GetDistinctFields returns the DistinctFields field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQueryCreate) GetDistinctFields() []string { - if o == nil || o.DistinctFields == nil { - var ret []string - return ret - } - return o.DistinctFields -} - -// GetDistinctFieldsOk returns a tuple with the DistinctFields field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQueryCreate) GetDistinctFieldsOk() (*[]string, bool) { - if o == nil || o.DistinctFields == nil { - return nil, false - } - return &o.DistinctFields, true -} - -// HasDistinctFields returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQueryCreate) HasDistinctFields() bool { - if o != nil && o.DistinctFields != nil { - return true - } - - return false -} - -// SetDistinctFields gets a reference to the given []string and assigns it to the DistinctFields field. -func (o *SecurityMonitoringRuleQueryCreate) SetDistinctFields(v []string) { - o.DistinctFields = v -} - -// GetGroupByFields returns the GroupByFields field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQueryCreate) GetGroupByFields() []string { - if o == nil || o.GroupByFields == nil { - var ret []string - return ret - } - return o.GroupByFields -} - -// GetGroupByFieldsOk returns a tuple with the GroupByFields field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQueryCreate) GetGroupByFieldsOk() (*[]string, bool) { - if o == nil || o.GroupByFields == nil { - return nil, false - } - return &o.GroupByFields, true -} - -// HasGroupByFields returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQueryCreate) HasGroupByFields() bool { - if o != nil && o.GroupByFields != nil { - return true - } - - return false -} - -// SetGroupByFields gets a reference to the given []string and assigns it to the GroupByFields field. -func (o *SecurityMonitoringRuleQueryCreate) SetGroupByFields(v []string) { - o.GroupByFields = v -} - -// GetMetric returns the Metric field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQueryCreate) GetMetric() string { - if o == nil || o.Metric == nil { - var ret string - return ret - } - return *o.Metric -} - -// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQueryCreate) GetMetricOk() (*string, bool) { - if o == nil || o.Metric == nil { - return nil, false - } - return o.Metric, true -} - -// HasMetric returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQueryCreate) HasMetric() bool { - if o != nil && o.Metric != nil { - return true - } - - return false -} - -// SetMetric gets a reference to the given string and assigns it to the Metric field. -func (o *SecurityMonitoringRuleQueryCreate) SetMetric(v string) { - o.Metric = &v -} - -// GetMetrics returns the Metrics field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQueryCreate) GetMetrics() []string { - if o == nil || o.Metrics == nil { - var ret []string - return ret - } - return o.Metrics -} - -// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQueryCreate) GetMetricsOk() (*[]string, bool) { - if o == nil || o.Metrics == nil { - return nil, false - } - return &o.Metrics, true -} - -// HasMetrics returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQueryCreate) HasMetrics() bool { - if o != nil && o.Metrics != nil { - return true - } - - return false -} - -// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. -func (o *SecurityMonitoringRuleQueryCreate) SetMetrics(v []string) { - o.Metrics = v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleQueryCreate) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQueryCreate) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleQueryCreate) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityMonitoringRuleQueryCreate) SetName(v string) { - o.Name = &v -} - -// GetQuery returns the Query field value. -func (o *SecurityMonitoringRuleQueryCreate) GetQuery() string { - if o == nil { - var ret string - return ret - } - return o.Query -} - -// GetQueryOk returns a tuple with the Query field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleQueryCreate) GetQueryOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Query, true -} - -// SetQuery sets field value. -func (o *SecurityMonitoringRuleQueryCreate) SetQuery(v string) { - o.Query = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleQueryCreate) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Aggregation != nil { - toSerialize["aggregation"] = o.Aggregation - } - if o.DistinctFields != nil { - toSerialize["distinctFields"] = o.DistinctFields - } - if o.GroupByFields != nil { - toSerialize["groupByFields"] = o.GroupByFields - } - if o.Metric != nil { - toSerialize["metric"] = o.Metric - } - if o.Metrics != nil { - toSerialize["metrics"] = o.Metrics - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["query"] = o.Query - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleQueryCreate) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} - all := struct { - Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` - DistinctFields []string `json:"distinctFields,omitempty"` - GroupByFields []string `json:"groupByFields,omitempty"` - Metric *string `json:"metric,omitempty"` - Metrics []string `json:"metrics,omitempty"` - Name *string `json:"name,omitempty"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("Required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Aggregation; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Aggregation = all.Aggregation - o.DistinctFields = all.DistinctFields - o.GroupByFields = all.GroupByFields - o.Metric = all.Metric - o.Metrics = all.Metrics - o.Name = all.Name - o.Query = all.Query - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_response.go b/api/v2/datadog/model_security_monitoring_rule_response.go deleted file mode 100644 index f18b4a67ac2..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_response.go +++ /dev/null @@ -1,741 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringRuleResponse Rule. -type SecurityMonitoringRuleResponse struct { - // Cases for generating signals. - Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` - // When the rule was created, timestamp in milliseconds. - CreatedAt *int64 `json:"createdAt,omitempty"` - // User ID of the user who created the rule. - CreationAuthorId *int64 `json:"creationAuthorId,omitempty"` - // Additional queries to filter matched events before they are processed. - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - // Whether the notifications include the triggering group-by values in their title. - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - // The ID of the rule. - Id *string `json:"id,omitempty"` - // Whether the rule is included by default. - IsDefault *bool `json:"isDefault,omitempty"` - // Whether the rule has been deleted. - IsDeleted *bool `json:"isDeleted,omitempty"` - // Whether the rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Message for generated signals. - Message *string `json:"message,omitempty"` - // The name of the rule. - Name *string `json:"name,omitempty"` - // Options on rules. - Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` - // Queries for selecting logs which are part of the rule. - Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` - // Tags for generated signals. - Tags []string `json:"tags,omitempty"` - // The rule type. - Type *SecurityMonitoringRuleTypeRead `json:"type,omitempty"` - // User ID of the user who updated the rule. - UpdateAuthorId *int64 `json:"updateAuthorId,omitempty"` - // The version of the rule. - Version *int64 `json:"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{} -} - -// NewSecurityMonitoringRuleResponse instantiates a new SecurityMonitoringRuleResponse 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 NewSecurityMonitoringRuleResponse() *SecurityMonitoringRuleResponse { - this := SecurityMonitoringRuleResponse{} - return &this -} - -// NewSecurityMonitoringRuleResponseWithDefaults instantiates a new SecurityMonitoringRuleResponse 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 NewSecurityMonitoringRuleResponseWithDefaults() *SecurityMonitoringRuleResponse { - this := SecurityMonitoringRuleResponse{} - return &this -} - -// GetCases returns the Cases field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetCases() []SecurityMonitoringRuleCase { - if o == nil || o.Cases == nil { - var ret []SecurityMonitoringRuleCase - return ret - } - return o.Cases -} - -// GetCasesOk returns a tuple with the Cases field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetCasesOk() (*[]SecurityMonitoringRuleCase, bool) { - if o == nil || o.Cases == nil { - return nil, false - } - return &o.Cases, true -} - -// HasCases returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasCases() bool { - if o != nil && o.Cases != nil { - return true - } - - return false -} - -// SetCases gets a reference to the given []SecurityMonitoringRuleCase and assigns it to the Cases field. -func (o *SecurityMonitoringRuleResponse) SetCases(v []SecurityMonitoringRuleCase) { - o.Cases = v -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetCreatedAt() int64 { - if o == nil || o.CreatedAt == nil { - var ret int64 - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetCreatedAtOk() (*int64, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. -func (o *SecurityMonitoringRuleResponse) SetCreatedAt(v int64) { - o.CreatedAt = &v -} - -// GetCreationAuthorId returns the CreationAuthorId field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetCreationAuthorId() int64 { - if o == nil || o.CreationAuthorId == nil { - var ret int64 - return ret - } - return *o.CreationAuthorId -} - -// GetCreationAuthorIdOk returns a tuple with the CreationAuthorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetCreationAuthorIdOk() (*int64, bool) { - if o == nil || o.CreationAuthorId == nil { - return nil, false - } - return o.CreationAuthorId, true -} - -// HasCreationAuthorId returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasCreationAuthorId() bool { - if o != nil && o.CreationAuthorId != nil { - return true - } - - return false -} - -// SetCreationAuthorId gets a reference to the given int64 and assigns it to the CreationAuthorId field. -func (o *SecurityMonitoringRuleResponse) SetCreationAuthorId(v int64) { - o.CreationAuthorId = &v -} - -// GetFilters returns the Filters field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetFilters() []SecurityMonitoringFilter { - if o == nil || o.Filters == nil { - var ret []SecurityMonitoringFilter - return ret - } - return o.Filters -} - -// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetFiltersOk() (*[]SecurityMonitoringFilter, bool) { - if o == nil || o.Filters == nil { - return nil, false - } - return &o.Filters, true -} - -// HasFilters returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasFilters() bool { - if o != nil && o.Filters != nil { - return true - } - - return false -} - -// SetFilters gets a reference to the given []SecurityMonitoringFilter and assigns it to the Filters field. -func (o *SecurityMonitoringRuleResponse) SetFilters(v []SecurityMonitoringFilter) { - o.Filters = v -} - -// GetHasExtendedTitle returns the HasExtendedTitle field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetHasExtendedTitle() bool { - if o == nil || o.HasExtendedTitle == nil { - var ret bool - return ret - } - return *o.HasExtendedTitle -} - -// GetHasExtendedTitleOk returns a tuple with the HasExtendedTitle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetHasExtendedTitleOk() (*bool, bool) { - if o == nil || o.HasExtendedTitle == nil { - return nil, false - } - return o.HasExtendedTitle, true -} - -// HasHasExtendedTitle returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasHasExtendedTitle() bool { - if o != nil && o.HasExtendedTitle != nil { - return true - } - - return false -} - -// SetHasExtendedTitle gets a reference to the given bool and assigns it to the HasExtendedTitle field. -func (o *SecurityMonitoringRuleResponse) SetHasExtendedTitle(v bool) { - o.HasExtendedTitle = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SecurityMonitoringRuleResponse) SetId(v string) { - o.Id = &v -} - -// GetIsDefault returns the IsDefault field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetIsDefault() bool { - if o == nil || o.IsDefault == nil { - var ret bool - return ret - } - return *o.IsDefault -} - -// GetIsDefaultOk returns a tuple with the IsDefault field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetIsDefaultOk() (*bool, bool) { - if o == nil || o.IsDefault == nil { - return nil, false - } - return o.IsDefault, true -} - -// HasIsDefault returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasIsDefault() bool { - if o != nil && o.IsDefault != nil { - return true - } - - return false -} - -// SetIsDefault gets a reference to the given bool and assigns it to the IsDefault field. -func (o *SecurityMonitoringRuleResponse) SetIsDefault(v bool) { - o.IsDefault = &v -} - -// GetIsDeleted returns the IsDeleted field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetIsDeleted() bool { - if o == nil || o.IsDeleted == nil { - var ret bool - return ret - } - return *o.IsDeleted -} - -// GetIsDeletedOk returns a tuple with the IsDeleted field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetIsDeletedOk() (*bool, bool) { - if o == nil || o.IsDeleted == nil { - return nil, false - } - return o.IsDeleted, true -} - -// HasIsDeleted returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasIsDeleted() bool { - if o != nil && o.IsDeleted != nil { - return true - } - - return false -} - -// SetIsDeleted gets a reference to the given bool and assigns it to the IsDeleted field. -func (o *SecurityMonitoringRuleResponse) SetIsDeleted(v bool) { - o.IsDeleted = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *SecurityMonitoringRuleResponse) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SecurityMonitoringRuleResponse) SetMessage(v string) { - o.Message = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityMonitoringRuleResponse) SetName(v string) { - o.Name = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetOptions() SecurityMonitoringRuleOptions { - if o == nil || o.Options == nil { - var ret SecurityMonitoringRuleOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetOptionsOk() (*SecurityMonitoringRuleOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given SecurityMonitoringRuleOptions and assigns it to the Options field. -func (o *SecurityMonitoringRuleResponse) SetOptions(v SecurityMonitoringRuleOptions) { - o.Options = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetQueries() []SecurityMonitoringRuleQuery { - if o == nil || o.Queries == nil { - var ret []SecurityMonitoringRuleQuery - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetQueriesOk() (*[]SecurityMonitoringRuleQuery, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []SecurityMonitoringRuleQuery and assigns it to the Queries field. -func (o *SecurityMonitoringRuleResponse) SetQueries(v []SecurityMonitoringRuleQuery) { - o.Queries = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SecurityMonitoringRuleResponse) GetTagsOk() (*[]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 *SecurityMonitoringRuleResponse) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SecurityMonitoringRuleResponse) SetTags(v []string) { - o.Tags = v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetType() SecurityMonitoringRuleTypeRead { - if o == nil || o.Type == nil { - var ret SecurityMonitoringRuleTypeRead - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetTypeOk() (*SecurityMonitoringRuleTypeRead, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SecurityMonitoringRuleTypeRead and assigns it to the Type field. -func (o *SecurityMonitoringRuleResponse) SetType(v SecurityMonitoringRuleTypeRead) { - o.Type = &v -} - -// GetUpdateAuthorId returns the UpdateAuthorId field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetUpdateAuthorId() int64 { - if o == nil || o.UpdateAuthorId == nil { - var ret int64 - return ret - } - return *o.UpdateAuthorId -} - -// GetUpdateAuthorIdOk returns a tuple with the UpdateAuthorId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetUpdateAuthorIdOk() (*int64, bool) { - if o == nil || o.UpdateAuthorId == nil { - return nil, false - } - return o.UpdateAuthorId, true -} - -// HasUpdateAuthorId returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasUpdateAuthorId() bool { - if o != nil && o.UpdateAuthorId != nil { - return true - } - - return false -} - -// SetUpdateAuthorId gets a reference to the given int64 and assigns it to the UpdateAuthorId field. -func (o *SecurityMonitoringRuleResponse) SetUpdateAuthorId(v int64) { - o.UpdateAuthorId = &v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleResponse) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleResponse) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleResponse) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *SecurityMonitoringRuleResponse) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cases != nil { - toSerialize["cases"] = o.Cases - } - if o.CreatedAt != nil { - toSerialize["createdAt"] = o.CreatedAt - } - if o.CreationAuthorId != nil { - toSerialize["creationAuthorId"] = o.CreationAuthorId - } - if o.Filters != nil { - toSerialize["filters"] = o.Filters - } - if o.HasExtendedTitle != nil { - toSerialize["hasExtendedTitle"] = o.HasExtendedTitle - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.IsDefault != nil { - toSerialize["isDefault"] = o.IsDefault - } - if o.IsDeleted != nil { - toSerialize["isDeleted"] = o.IsDeleted - } - if o.IsEnabled != nil { - toSerialize["isEnabled"] = o.IsEnabled - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - if o.UpdateAuthorId != nil { - toSerialize["updateAuthorId"] = o.UpdateAuthorId - } - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` - CreatedAt *int64 `json:"createdAt,omitempty"` - CreationAuthorId *int64 `json:"creationAuthorId,omitempty"` - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - Id *string `json:"id,omitempty"` - IsDefault *bool `json:"isDefault,omitempty"` - IsDeleted *bool `json:"isDeleted,omitempty"` - IsEnabled *bool `json:"isEnabled,omitempty"` - Message *string `json:"message,omitempty"` - Name *string `json:"name,omitempty"` - Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` - Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` - Tags []string `json:"tags,omitempty"` - Type *SecurityMonitoringRuleTypeRead `json:"type,omitempty"` - UpdateAuthorId *int64 `json:"updateAuthorId,omitempty"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cases = all.Cases - o.CreatedAt = all.CreatedAt - o.CreationAuthorId = all.CreationAuthorId - o.Filters = all.Filters - o.HasExtendedTitle = all.HasExtendedTitle - o.Id = all.Id - o.IsDefault = all.IsDefault - o.IsDeleted = all.IsDeleted - o.IsEnabled = all.IsEnabled - o.Message = all.Message - o.Name = all.Name - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.Queries = all.Queries - o.Tags = all.Tags - o.Type = all.Type - o.UpdateAuthorId = all.UpdateAuthorId - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_rule_severity.go b/api/v2/datadog/model_security_monitoring_rule_severity.go deleted file mode 100644 index 202af6616d9..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_severity.go +++ /dev/null @@ -1,115 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleSeverity Severity of the Security Signal. -type SecurityMonitoringRuleSeverity string - -// List of SecurityMonitoringRuleSeverity. -const ( - SECURITYMONITORINGRULESEVERITY_INFO SecurityMonitoringRuleSeverity = "info" - SECURITYMONITORINGRULESEVERITY_LOW SecurityMonitoringRuleSeverity = "low" - SECURITYMONITORINGRULESEVERITY_MEDIUM SecurityMonitoringRuleSeverity = "medium" - SECURITYMONITORINGRULESEVERITY_HIGH SecurityMonitoringRuleSeverity = "high" - SECURITYMONITORINGRULESEVERITY_CRITICAL SecurityMonitoringRuleSeverity = "critical" -) - -var allowedSecurityMonitoringRuleSeverityEnumValues = []SecurityMonitoringRuleSeverity{ - SECURITYMONITORINGRULESEVERITY_INFO, - SECURITYMONITORINGRULESEVERITY_LOW, - SECURITYMONITORINGRULESEVERITY_MEDIUM, - SECURITYMONITORINGRULESEVERITY_HIGH, - SECURITYMONITORINGRULESEVERITY_CRITICAL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleSeverity) GetAllowedValues() []SecurityMonitoringRuleSeverity { - return allowedSecurityMonitoringRuleSeverityEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleSeverity) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleSeverity(value) - return nil -} - -// NewSecurityMonitoringRuleSeverityFromValue returns a pointer to a valid SecurityMonitoringRuleSeverity -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleSeverityFromValue(v string) (*SecurityMonitoringRuleSeverity, error) { - ev := SecurityMonitoringRuleSeverity(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleSeverity: valid values are %v", v, allowedSecurityMonitoringRuleSeverityEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleSeverity) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleSeverityEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleSeverity value. -func (v SecurityMonitoringRuleSeverity) Ptr() *SecurityMonitoringRuleSeverity { - return &v -} - -// NullableSecurityMonitoringRuleSeverity handles when a null is used for SecurityMonitoringRuleSeverity. -type NullableSecurityMonitoringRuleSeverity struct { - value *SecurityMonitoringRuleSeverity - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleSeverity) Get() *SecurityMonitoringRuleSeverity { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleSeverity) Set(val *SecurityMonitoringRuleSeverity) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleSeverity) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleSeverity) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleSeverity initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleSeverity(val *SecurityMonitoringRuleSeverity) *NullableSecurityMonitoringRuleSeverity { - return &NullableSecurityMonitoringRuleSeverity{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleSeverity) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleSeverity) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_type_create.go b/api/v2/datadog/model_security_monitoring_rule_type_create.go deleted file mode 100644 index 2519439913b..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_type_create.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleTypeCreate The rule type. -type SecurityMonitoringRuleTypeCreate string - -// List of SecurityMonitoringRuleTypeCreate. -const ( - SECURITYMONITORINGRULETYPECREATE_LOG_DETECTION SecurityMonitoringRuleTypeCreate = "log_detection" - SECURITYMONITORINGRULETYPECREATE_WORKLOAD_SECURITY SecurityMonitoringRuleTypeCreate = "workload_security" -) - -var allowedSecurityMonitoringRuleTypeCreateEnumValues = []SecurityMonitoringRuleTypeCreate{ - SECURITYMONITORINGRULETYPECREATE_LOG_DETECTION, - SECURITYMONITORINGRULETYPECREATE_WORKLOAD_SECURITY, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleTypeCreate) GetAllowedValues() []SecurityMonitoringRuleTypeCreate { - return allowedSecurityMonitoringRuleTypeCreateEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleTypeCreate) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleTypeCreate(value) - return nil -} - -// NewSecurityMonitoringRuleTypeCreateFromValue returns a pointer to a valid SecurityMonitoringRuleTypeCreate -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleTypeCreateFromValue(v string) (*SecurityMonitoringRuleTypeCreate, error) { - ev := SecurityMonitoringRuleTypeCreate(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleTypeCreate: valid values are %v", v, allowedSecurityMonitoringRuleTypeCreateEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleTypeCreate) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleTypeCreateEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleTypeCreate value. -func (v SecurityMonitoringRuleTypeCreate) Ptr() *SecurityMonitoringRuleTypeCreate { - return &v -} - -// NullableSecurityMonitoringRuleTypeCreate handles when a null is used for SecurityMonitoringRuleTypeCreate. -type NullableSecurityMonitoringRuleTypeCreate struct { - value *SecurityMonitoringRuleTypeCreate - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleTypeCreate) Get() *SecurityMonitoringRuleTypeCreate { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleTypeCreate) Set(val *SecurityMonitoringRuleTypeCreate) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleTypeCreate) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleTypeCreate) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleTypeCreate initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleTypeCreate(val *SecurityMonitoringRuleTypeCreate) *NullableSecurityMonitoringRuleTypeCreate { - return &NullableSecurityMonitoringRuleTypeCreate{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleTypeCreate) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleTypeCreate) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_type_read.go b/api/v2/datadog/model_security_monitoring_rule_type_read.go deleted file mode 100644 index 19bc0bd7700..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_type_read.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringRuleTypeRead The rule type. -type SecurityMonitoringRuleTypeRead string - -// List of SecurityMonitoringRuleTypeRead. -const ( - SECURITYMONITORINGRULETYPEREAD_LOG_DETECTION SecurityMonitoringRuleTypeRead = "log_detection" - SECURITYMONITORINGRULETYPEREAD_INFRASTRUCTURE_CONFIGURATION SecurityMonitoringRuleTypeRead = "infrastructure_configuration" - SECURITYMONITORINGRULETYPEREAD_WORKLOAD_SECURITY SecurityMonitoringRuleTypeRead = "workload_security" - SECURITYMONITORINGRULETYPEREAD_CLOUD_CONFIGURATION SecurityMonitoringRuleTypeRead = "cloud_configuration" -) - -var allowedSecurityMonitoringRuleTypeReadEnumValues = []SecurityMonitoringRuleTypeRead{ - SECURITYMONITORINGRULETYPEREAD_LOG_DETECTION, - SECURITYMONITORINGRULETYPEREAD_INFRASTRUCTURE_CONFIGURATION, - SECURITYMONITORINGRULETYPEREAD_WORKLOAD_SECURITY, - SECURITYMONITORINGRULETYPEREAD_CLOUD_CONFIGURATION, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringRuleTypeRead) GetAllowedValues() []SecurityMonitoringRuleTypeRead { - return allowedSecurityMonitoringRuleTypeReadEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringRuleTypeRead) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringRuleTypeRead(value) - return nil -} - -// NewSecurityMonitoringRuleTypeReadFromValue returns a pointer to a valid SecurityMonitoringRuleTypeRead -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringRuleTypeReadFromValue(v string) (*SecurityMonitoringRuleTypeRead, error) { - ev := SecurityMonitoringRuleTypeRead(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleTypeRead: valid values are %v", v, allowedSecurityMonitoringRuleTypeReadEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringRuleTypeRead) IsValid() bool { - for _, existing := range allowedSecurityMonitoringRuleTypeReadEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringRuleTypeRead value. -func (v SecurityMonitoringRuleTypeRead) Ptr() *SecurityMonitoringRuleTypeRead { - return &v -} - -// NullableSecurityMonitoringRuleTypeRead handles when a null is used for SecurityMonitoringRuleTypeRead. -type NullableSecurityMonitoringRuleTypeRead struct { - value *SecurityMonitoringRuleTypeRead - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringRuleTypeRead) Get() *SecurityMonitoringRuleTypeRead { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringRuleTypeRead) Set(val *SecurityMonitoringRuleTypeRead) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringRuleTypeRead) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringRuleTypeRead) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringRuleTypeRead initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringRuleTypeRead(val *SecurityMonitoringRuleTypeRead) *NullableSecurityMonitoringRuleTypeRead { - return &NullableSecurityMonitoringRuleTypeRead{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringRuleTypeRead) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringRuleTypeRead) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_rule_update_payload.go b/api/v2/datadog/model_security_monitoring_rule_update_payload.go deleted file mode 100644 index 526443af3e3..00000000000 --- a/api/v2/datadog/model_security_monitoring_rule_update_payload.go +++ /dev/null @@ -1,460 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringRuleUpdatePayload Update an existing rule. -type SecurityMonitoringRuleUpdatePayload struct { - // Cases for generating signals. - Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` - // Additional queries to filter matched events before they are processed. - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - // Whether the notifications include the triggering group-by values in their title. - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - // Whether the rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Message for generated signals. - Message *string `json:"message,omitempty"` - // Name of the rule. - Name *string `json:"name,omitempty"` - // Options on rules. - Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` - // Queries for selecting logs which are part of the rule. - Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` - // Tags for generated signals. - Tags []string `json:"tags,omitempty"` - // The version of the rule being updated. - Version *int32 `json:"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{} -} - -// NewSecurityMonitoringRuleUpdatePayload instantiates a new SecurityMonitoringRuleUpdatePayload 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 NewSecurityMonitoringRuleUpdatePayload() *SecurityMonitoringRuleUpdatePayload { - this := SecurityMonitoringRuleUpdatePayload{} - return &this -} - -// NewSecurityMonitoringRuleUpdatePayloadWithDefaults instantiates a new SecurityMonitoringRuleUpdatePayload 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 NewSecurityMonitoringRuleUpdatePayloadWithDefaults() *SecurityMonitoringRuleUpdatePayload { - this := SecurityMonitoringRuleUpdatePayload{} - return &this -} - -// GetCases returns the Cases field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetCases() []SecurityMonitoringRuleCase { - if o == nil || o.Cases == nil { - var ret []SecurityMonitoringRuleCase - return ret - } - return o.Cases -} - -// GetCasesOk returns a tuple with the Cases field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetCasesOk() (*[]SecurityMonitoringRuleCase, bool) { - if o == nil || o.Cases == nil { - return nil, false - } - return &o.Cases, true -} - -// HasCases returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasCases() bool { - if o != nil && o.Cases != nil { - return true - } - - return false -} - -// SetCases gets a reference to the given []SecurityMonitoringRuleCase and assigns it to the Cases field. -func (o *SecurityMonitoringRuleUpdatePayload) SetCases(v []SecurityMonitoringRuleCase) { - o.Cases = v -} - -// GetFilters returns the Filters field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetFilters() []SecurityMonitoringFilter { - if o == nil || o.Filters == nil { - var ret []SecurityMonitoringFilter - return ret - } - return o.Filters -} - -// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetFiltersOk() (*[]SecurityMonitoringFilter, bool) { - if o == nil || o.Filters == nil { - return nil, false - } - return &o.Filters, true -} - -// HasFilters returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasFilters() bool { - if o != nil && o.Filters != nil { - return true - } - - return false -} - -// SetFilters gets a reference to the given []SecurityMonitoringFilter and assigns it to the Filters field. -func (o *SecurityMonitoringRuleUpdatePayload) SetFilters(v []SecurityMonitoringFilter) { - o.Filters = v -} - -// GetHasExtendedTitle returns the HasExtendedTitle field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetHasExtendedTitle() bool { - if o == nil || o.HasExtendedTitle == nil { - var ret bool - return ret - } - return *o.HasExtendedTitle -} - -// GetHasExtendedTitleOk returns a tuple with the HasExtendedTitle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetHasExtendedTitleOk() (*bool, bool) { - if o == nil || o.HasExtendedTitle == nil { - return nil, false - } - return o.HasExtendedTitle, true -} - -// HasHasExtendedTitle returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasHasExtendedTitle() bool { - if o != nil && o.HasExtendedTitle != nil { - return true - } - - return false -} - -// SetHasExtendedTitle gets a reference to the given bool and assigns it to the HasExtendedTitle field. -func (o *SecurityMonitoringRuleUpdatePayload) SetHasExtendedTitle(v bool) { - o.HasExtendedTitle = &v -} - -// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetIsEnabled() bool { - if o == nil || o.IsEnabled == nil { - var ret bool - return ret - } - return *o.IsEnabled -} - -// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetIsEnabledOk() (*bool, bool) { - if o == nil || o.IsEnabled == nil { - return nil, false - } - return o.IsEnabled, true -} - -// HasIsEnabled returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasIsEnabled() bool { - if o != nil && o.IsEnabled != nil { - return true - } - - return false -} - -// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. -func (o *SecurityMonitoringRuleUpdatePayload) SetIsEnabled(v bool) { - o.IsEnabled = &v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SecurityMonitoringRuleUpdatePayload) SetMessage(v string) { - o.Message = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityMonitoringRuleUpdatePayload) SetName(v string) { - o.Name = &v -} - -// GetOptions returns the Options field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetOptions() SecurityMonitoringRuleOptions { - if o == nil || o.Options == nil { - var ret SecurityMonitoringRuleOptions - return ret - } - return *o.Options -} - -// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetOptionsOk() (*SecurityMonitoringRuleOptions, bool) { - if o == nil || o.Options == nil { - return nil, false - } - return o.Options, true -} - -// HasOptions returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasOptions() bool { - if o != nil && o.Options != nil { - return true - } - - return false -} - -// SetOptions gets a reference to the given SecurityMonitoringRuleOptions and assigns it to the Options field. -func (o *SecurityMonitoringRuleUpdatePayload) SetOptions(v SecurityMonitoringRuleOptions) { - o.Options = &v -} - -// GetQueries returns the Queries field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetQueries() []SecurityMonitoringRuleQuery { - if o == nil || o.Queries == nil { - var ret []SecurityMonitoringRuleQuery - return ret - } - return o.Queries -} - -// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetQueriesOk() (*[]SecurityMonitoringRuleQuery, bool) { - if o == nil || o.Queries == nil { - return nil, false - } - return &o.Queries, true -} - -// HasQueries returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasQueries() bool { - if o != nil && o.Queries != nil { - return true - } - - return false -} - -// SetQueries gets a reference to the given []SecurityMonitoringRuleQuery and assigns it to the Queries field. -func (o *SecurityMonitoringRuleUpdatePayload) SetQueries(v []SecurityMonitoringRuleQuery) { - o.Queries = v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SecurityMonitoringRuleUpdatePayload) GetTagsOk() (*[]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 *SecurityMonitoringRuleUpdatePayload) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SecurityMonitoringRuleUpdatePayload) SetTags(v []string) { - o.Tags = v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SecurityMonitoringRuleUpdatePayload) GetVersion() int32 { - if o == nil || o.Version == nil { - var ret int32 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringRuleUpdatePayload) GetVersionOk() (*int32, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SecurityMonitoringRuleUpdatePayload) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int32 and assigns it to the Version field. -func (o *SecurityMonitoringRuleUpdatePayload) SetVersion(v int32) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringRuleUpdatePayload) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cases != nil { - toSerialize["cases"] = o.Cases - } - if o.Filters != nil { - toSerialize["filters"] = o.Filters - } - if o.HasExtendedTitle != nil { - toSerialize["hasExtendedTitle"] = o.HasExtendedTitle - } - if o.IsEnabled != nil { - toSerialize["isEnabled"] = o.IsEnabled - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Options != nil { - toSerialize["options"] = o.Options - } - if o.Queries != nil { - toSerialize["queries"] = o.Queries - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - IsEnabled *bool `json:"isEnabled,omitempty"` - Message *string `json:"message,omitempty"` - Name *string `json:"name,omitempty"` - Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` - Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` - Tags []string `json:"tags,omitempty"` - Version *int32 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cases = all.Cases - o.Filters = all.Filters - o.HasExtendedTitle = all.HasExtendedTitle - o.IsEnabled = all.IsEnabled - o.Message = all.Message - o.Name = all.Name - if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Options = all.Options - o.Queries = all.Queries - o.Tags = all.Tags - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal.go b/api/v2/datadog/model_security_monitoring_signal.go deleted file mode 100644 index dc8da312af0..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal.go +++ /dev/null @@ -1,200 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignal Object description of a security signal. -type SecurityMonitoringSignal struct { - // The object containing all signal attributes and their - // associated values. - Attributes *SecurityMonitoringSignalAttributes `json:"attributes,omitempty"` - // The unique ID of the security signal. - Id *string `json:"id,omitempty"` - // The type of event. - Type *SecurityMonitoringSignalType `json:"type,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{} -} - -// NewSecurityMonitoringSignal instantiates a new SecurityMonitoringSignal 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 NewSecurityMonitoringSignal() *SecurityMonitoringSignal { - this := SecurityMonitoringSignal{} - var typeVar SecurityMonitoringSignalType = SECURITYMONITORINGSIGNALTYPE_SIGNAL - this.Type = &typeVar - return &this -} - -// NewSecurityMonitoringSignalWithDefaults instantiates a new SecurityMonitoringSignal 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 NewSecurityMonitoringSignalWithDefaults() *SecurityMonitoringSignal { - this := SecurityMonitoringSignal{} - var typeVar SecurityMonitoringSignalType = SECURITYMONITORINGSIGNALTYPE_SIGNAL - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SecurityMonitoringSignal) GetAttributes() SecurityMonitoringSignalAttributes { - if o == nil || o.Attributes == nil { - var ret SecurityMonitoringSignalAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignal) GetAttributesOk() (*SecurityMonitoringSignalAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SecurityMonitoringSignal) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SecurityMonitoringSignalAttributes and assigns it to the Attributes field. -func (o *SecurityMonitoringSignal) SetAttributes(v SecurityMonitoringSignalAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SecurityMonitoringSignal) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignal) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SecurityMonitoringSignal) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *SecurityMonitoringSignal) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *SecurityMonitoringSignal) GetType() SecurityMonitoringSignalType { - if o == nil || o.Type == nil { - var ret SecurityMonitoringSignalType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignal) GetTypeOk() (*SecurityMonitoringSignalType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SecurityMonitoringSignal) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given SecurityMonitoringSignalType and assigns it to the Type field. -func (o *SecurityMonitoringSignal) SetType(v SecurityMonitoringSignalType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignal) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignal) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *SecurityMonitoringSignalAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *SecurityMonitoringSignalType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_archive_reason.go b/api/v2/datadog/model_security_monitoring_signal_archive_reason.go deleted file mode 100644 index 085f7b7d3c3..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_archive_reason.go +++ /dev/null @@ -1,113 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalArchiveReason Reason a signal is archived. -type SecurityMonitoringSignalArchiveReason string - -// List of SecurityMonitoringSignalArchiveReason. -const ( - SECURITYMONITORINGSIGNALARCHIVEREASON_NONE SecurityMonitoringSignalArchiveReason = "none" - SECURITYMONITORINGSIGNALARCHIVEREASON_FALSE_POSITIVE SecurityMonitoringSignalArchiveReason = "false_positive" - SECURITYMONITORINGSIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE SecurityMonitoringSignalArchiveReason = "testing_or_maintenance" - SECURITYMONITORINGSIGNALARCHIVEREASON_OTHER SecurityMonitoringSignalArchiveReason = "other" -) - -var allowedSecurityMonitoringSignalArchiveReasonEnumValues = []SecurityMonitoringSignalArchiveReason{ - SECURITYMONITORINGSIGNALARCHIVEREASON_NONE, - SECURITYMONITORINGSIGNALARCHIVEREASON_FALSE_POSITIVE, - SECURITYMONITORINGSIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE, - SECURITYMONITORINGSIGNALARCHIVEREASON_OTHER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringSignalArchiveReason) GetAllowedValues() []SecurityMonitoringSignalArchiveReason { - return allowedSecurityMonitoringSignalArchiveReasonEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringSignalArchiveReason) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringSignalArchiveReason(value) - return nil -} - -// NewSecurityMonitoringSignalArchiveReasonFromValue returns a pointer to a valid SecurityMonitoringSignalArchiveReason -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringSignalArchiveReasonFromValue(v string) (*SecurityMonitoringSignalArchiveReason, error) { - ev := SecurityMonitoringSignalArchiveReason(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalArchiveReason: valid values are %v", v, allowedSecurityMonitoringSignalArchiveReasonEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringSignalArchiveReason) IsValid() bool { - for _, existing := range allowedSecurityMonitoringSignalArchiveReasonEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringSignalArchiveReason value. -func (v SecurityMonitoringSignalArchiveReason) Ptr() *SecurityMonitoringSignalArchiveReason { - return &v -} - -// NullableSecurityMonitoringSignalArchiveReason handles when a null is used for SecurityMonitoringSignalArchiveReason. -type NullableSecurityMonitoringSignalArchiveReason struct { - value *SecurityMonitoringSignalArchiveReason - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalArchiveReason) Get() *SecurityMonitoringSignalArchiveReason { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalArchiveReason) Set(val *SecurityMonitoringSignalArchiveReason) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalArchiveReason) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalArchiveReason) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalArchiveReason initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalArchiveReason(val *SecurityMonitoringSignalArchiveReason) *NullableSecurityMonitoringSignalArchiveReason { - return &NullableSecurityMonitoringSignalArchiveReason{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalArchiveReason) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalArchiveReason) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go b/api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go deleted file mode 100644 index eaba84d7dbf..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go +++ /dev/null @@ -1,149 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalAssigneeUpdateAttributes Attributes describing the new assignee of a security signal. -type SecurityMonitoringSignalAssigneeUpdateAttributes struct { - // Object representing a given user entity. - Assignee SecurityMonitoringTriageUser `json:"assignee"` - // Version of the updated signal. If server side version is higher, update will be rejected. - Version *int64 `json:"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{} -} - -// NewSecurityMonitoringSignalAssigneeUpdateAttributes instantiates a new SecurityMonitoringSignalAssigneeUpdateAttributes 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 NewSecurityMonitoringSignalAssigneeUpdateAttributes(assignee SecurityMonitoringTriageUser) *SecurityMonitoringSignalAssigneeUpdateAttributes { - this := SecurityMonitoringSignalAssigneeUpdateAttributes{} - this.Assignee = assignee - return &this -} - -// NewSecurityMonitoringSignalAssigneeUpdateAttributesWithDefaults instantiates a new SecurityMonitoringSignalAssigneeUpdateAttributes 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 NewSecurityMonitoringSignalAssigneeUpdateAttributesWithDefaults() *SecurityMonitoringSignalAssigneeUpdateAttributes { - this := SecurityMonitoringSignalAssigneeUpdateAttributes{} - return &this -} - -// GetAssignee returns the Assignee field value. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetAssignee() SecurityMonitoringTriageUser { - if o == nil { - var ret SecurityMonitoringTriageUser - return ret - } - return o.Assignee -} - -// GetAssigneeOk returns a tuple with the Assignee field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetAssigneeOk() (*SecurityMonitoringTriageUser, bool) { - if o == nil { - return nil, false - } - return &o.Assignee, true -} - -// SetAssignee sets field value. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) SetAssignee(v SecurityMonitoringTriageUser) { - o.Assignee = v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalAssigneeUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["assignee"] = o.Assignee - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Assignee *SecurityMonitoringTriageUser `json:"assignee"` - }{} - all := struct { - Assignee SecurityMonitoringTriageUser `json:"assignee"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assignee == nil { - return fmt.Errorf("Required field assignee missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Assignee = all.Assignee - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_assignee_update_data.go b/api/v2/datadog/model_security_monitoring_signal_assignee_update_data.go deleted file mode 100644 index ffa4bfb38f6..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_assignee_update_data.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalAssigneeUpdateData Data containing the patch for changing the assignee of a signal. -type SecurityMonitoringSignalAssigneeUpdateData struct { - // Attributes describing the new assignee of a security signal. - Attributes SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` - // 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{} -} - -// NewSecurityMonitoringSignalAssigneeUpdateData instantiates a new SecurityMonitoringSignalAssigneeUpdateData 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 NewSecurityMonitoringSignalAssigneeUpdateData(attributes SecurityMonitoringSignalAssigneeUpdateAttributes) *SecurityMonitoringSignalAssigneeUpdateData { - this := SecurityMonitoringSignalAssigneeUpdateData{} - this.Attributes = attributes - return &this -} - -// NewSecurityMonitoringSignalAssigneeUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalAssigneeUpdateData 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 NewSecurityMonitoringSignalAssigneeUpdateDataWithDefaults() *SecurityMonitoringSignalAssigneeUpdateData { - this := SecurityMonitoringSignalAssigneeUpdateData{} - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *SecurityMonitoringSignalAssigneeUpdateData) GetAttributes() SecurityMonitoringSignalAssigneeUpdateAttributes { - if o == nil { - var ret SecurityMonitoringSignalAssigneeUpdateAttributes - 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 *SecurityMonitoringSignalAssigneeUpdateData) GetAttributesOk() (*SecurityMonitoringSignalAssigneeUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *SecurityMonitoringSignalAssigneeUpdateData) SetAttributes(v SecurityMonitoringSignalAssigneeUpdateAttributes) { - o.Attributes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalAssigneeUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalAssigneeUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` - }{} - all := struct { - Attributes SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_assignee_update_request.go b/api/v2/datadog/model_security_monitoring_signal_assignee_update_request.go deleted file mode 100644 index 3e57cd71347..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_assignee_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalAssigneeUpdateRequest Request body for changing the assignee of a given security monitoring signal. -type SecurityMonitoringSignalAssigneeUpdateRequest struct { - // Data containing the patch for changing the assignee of a signal. - Data SecurityMonitoringSignalAssigneeUpdateData `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{} -} - -// NewSecurityMonitoringSignalAssigneeUpdateRequest instantiates a new SecurityMonitoringSignalAssigneeUpdateRequest 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 NewSecurityMonitoringSignalAssigneeUpdateRequest(data SecurityMonitoringSignalAssigneeUpdateData) *SecurityMonitoringSignalAssigneeUpdateRequest { - this := SecurityMonitoringSignalAssigneeUpdateRequest{} - this.Data = data - return &this -} - -// NewSecurityMonitoringSignalAssigneeUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalAssigneeUpdateRequest 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 NewSecurityMonitoringSignalAssigneeUpdateRequestWithDefaults() *SecurityMonitoringSignalAssigneeUpdateRequest { - this := SecurityMonitoringSignalAssigneeUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *SecurityMonitoringSignalAssigneeUpdateRequest) GetData() SecurityMonitoringSignalAssigneeUpdateData { - if o == nil { - var ret SecurityMonitoringSignalAssigneeUpdateData - 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 *SecurityMonitoringSignalAssigneeUpdateRequest) GetDataOk() (*SecurityMonitoringSignalAssigneeUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *SecurityMonitoringSignalAssigneeUpdateRequest) SetData(v SecurityMonitoringSignalAssigneeUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalAssigneeUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalAssigneeUpdateData `json:"data"` - }{} - all := struct { - Data SecurityMonitoringSignalAssigneeUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_attributes.go b/api/v2/datadog/model_security_monitoring_signal_attributes.go deleted file mode 100644 index 042368fd30f..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_attributes.go +++ /dev/null @@ -1,225 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// SecurityMonitoringSignalAttributes The object containing all signal attributes and their -// associated values. -type SecurityMonitoringSignalAttributes struct { - // A JSON object of attributes in the security signal. - Attributes map[string]interface{} `json:"attributes,omitempty"` - // The message in the security signal defined by the rule that generated the signal. - Message *string `json:"message,omitempty"` - // An array of tags associated with the security signal. - Tags []string `json:"tags,omitempty"` - // The timestamp of the security signal. - Timestamp *time.Time `json:"timestamp,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{} -} - -// NewSecurityMonitoringSignalAttributes instantiates a new SecurityMonitoringSignalAttributes 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 NewSecurityMonitoringSignalAttributes() *SecurityMonitoringSignalAttributes { - this := SecurityMonitoringSignalAttributes{} - return &this -} - -// NewSecurityMonitoringSignalAttributesWithDefaults instantiates a new SecurityMonitoringSignalAttributes 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 NewSecurityMonitoringSignalAttributesWithDefaults() *SecurityMonitoringSignalAttributes { - this := SecurityMonitoringSignalAttributes{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalAttributes) GetAttributes() map[string]interface{} { - if o == nil || o.Attributes == nil { - var ret map[string]interface{} - return ret - } - return o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalAttributes) GetAttributesOk() (*map[string]interface{}, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return &o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalAttributes) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. -func (o *SecurityMonitoringSignalAttributes) SetAttributes(v map[string]interface{}) { - o.Attributes = v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalAttributes) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalAttributes) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalAttributes) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *SecurityMonitoringSignalAttributes) SetMessage(v string) { - o.Message = &v -} - -// GetTags returns the Tags field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalAttributes) GetTags() []string { - if o == nil || o.Tags == nil { - var ret []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 *SecurityMonitoringSignalAttributes) GetTagsOk() (*[]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 *SecurityMonitoringSignalAttributes) HasTags() bool { - if o != nil && o.Tags != nil { - return true - } - - return false -} - -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *SecurityMonitoringSignalAttributes) SetTags(v []string) { - o.Tags = v -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalAttributes) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalAttributes) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalAttributes) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *SecurityMonitoringSignalAttributes) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Tags != nil { - toSerialize["tags"] = o.Tags - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes map[string]interface{} `json:"attributes,omitempty"` - Message *string `json:"message,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Attributes = all.Attributes - o.Message = all.Message - o.Tags = all.Tags - o.Timestamp = all.Timestamp - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go b/api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go deleted file mode 100644 index fa04ae23fb3..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go +++ /dev/null @@ -1,142 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalIncidentsUpdateAttributes Attributes describing the new list of related signals for a security signal. -type SecurityMonitoringSignalIncidentsUpdateAttributes struct { - // Array of incidents that are associated with this signal. - IncidentIds []int64 `json:"incident_ids"` - // Version of the updated signal. If server side version is higher, update will be rejected. - Version *int64 `json:"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{} -} - -// NewSecurityMonitoringSignalIncidentsUpdateAttributes instantiates a new SecurityMonitoringSignalIncidentsUpdateAttributes 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 NewSecurityMonitoringSignalIncidentsUpdateAttributes(incidentIds []int64) *SecurityMonitoringSignalIncidentsUpdateAttributes { - this := SecurityMonitoringSignalIncidentsUpdateAttributes{} - this.IncidentIds = incidentIds - return &this -} - -// NewSecurityMonitoringSignalIncidentsUpdateAttributesWithDefaults instantiates a new SecurityMonitoringSignalIncidentsUpdateAttributes 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 NewSecurityMonitoringSignalIncidentsUpdateAttributesWithDefaults() *SecurityMonitoringSignalIncidentsUpdateAttributes { - this := SecurityMonitoringSignalIncidentsUpdateAttributes{} - return &this -} - -// GetIncidentIds returns the IncidentIds field value. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetIncidentIds() []int64 { - if o == nil { - var ret []int64 - return ret - } - return o.IncidentIds -} - -// GetIncidentIdsOk returns a tuple with the IncidentIds field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetIncidentIdsOk() (*[]int64, bool) { - if o == nil { - return nil, false - } - return &o.IncidentIds, true -} - -// SetIncidentIds sets field value. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) SetIncidentIds(v []int64) { - o.IncidentIds = v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalIncidentsUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["incident_ids"] = o.IncidentIds - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - IncidentIds *[]int64 `json:"incident_ids"` - }{} - all := struct { - IncidentIds []int64 `json:"incident_ids"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IncidentIds == nil { - return fmt.Errorf("Required field incident_ids missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.IncidentIds = all.IncidentIds - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_incidents_update_data.go b/api/v2/datadog/model_security_monitoring_signal_incidents_update_data.go deleted file mode 100644 index e6c8fb855a0..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_incidents_update_data.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalIncidentsUpdateData Data containing the patch for changing the related incidents of a signal. -type SecurityMonitoringSignalIncidentsUpdateData struct { - // Attributes describing the new list of related signals for a security signal. - Attributes SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` - // 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{} -} - -// NewSecurityMonitoringSignalIncidentsUpdateData instantiates a new SecurityMonitoringSignalIncidentsUpdateData 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 NewSecurityMonitoringSignalIncidentsUpdateData(attributes SecurityMonitoringSignalIncidentsUpdateAttributes) *SecurityMonitoringSignalIncidentsUpdateData { - this := SecurityMonitoringSignalIncidentsUpdateData{} - this.Attributes = attributes - return &this -} - -// NewSecurityMonitoringSignalIncidentsUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalIncidentsUpdateData 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 NewSecurityMonitoringSignalIncidentsUpdateDataWithDefaults() *SecurityMonitoringSignalIncidentsUpdateData { - this := SecurityMonitoringSignalIncidentsUpdateData{} - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *SecurityMonitoringSignalIncidentsUpdateData) GetAttributes() SecurityMonitoringSignalIncidentsUpdateAttributes { - if o == nil { - var ret SecurityMonitoringSignalIncidentsUpdateAttributes - 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 *SecurityMonitoringSignalIncidentsUpdateData) GetAttributesOk() (*SecurityMonitoringSignalIncidentsUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *SecurityMonitoringSignalIncidentsUpdateData) SetAttributes(v SecurityMonitoringSignalIncidentsUpdateAttributes) { - o.Attributes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalIncidentsUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalIncidentsUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` - }{} - all := struct { - Attributes SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_incidents_update_request.go b/api/v2/datadog/model_security_monitoring_signal_incidents_update_request.go deleted file mode 100644 index e21b9b62971..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_incidents_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalIncidentsUpdateRequest Request body for changing the related incidents of a given security monitoring signal. -type SecurityMonitoringSignalIncidentsUpdateRequest struct { - // Data containing the patch for changing the related incidents of a signal. - Data SecurityMonitoringSignalIncidentsUpdateData `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{} -} - -// NewSecurityMonitoringSignalIncidentsUpdateRequest instantiates a new SecurityMonitoringSignalIncidentsUpdateRequest 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 NewSecurityMonitoringSignalIncidentsUpdateRequest(data SecurityMonitoringSignalIncidentsUpdateData) *SecurityMonitoringSignalIncidentsUpdateRequest { - this := SecurityMonitoringSignalIncidentsUpdateRequest{} - this.Data = data - return &this -} - -// NewSecurityMonitoringSignalIncidentsUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalIncidentsUpdateRequest 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 NewSecurityMonitoringSignalIncidentsUpdateRequestWithDefaults() *SecurityMonitoringSignalIncidentsUpdateRequest { - this := SecurityMonitoringSignalIncidentsUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *SecurityMonitoringSignalIncidentsUpdateRequest) GetData() SecurityMonitoringSignalIncidentsUpdateData { - if o == nil { - var ret SecurityMonitoringSignalIncidentsUpdateData - 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 *SecurityMonitoringSignalIncidentsUpdateRequest) GetDataOk() (*SecurityMonitoringSignalIncidentsUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *SecurityMonitoringSignalIncidentsUpdateRequest) SetData(v SecurityMonitoringSignalIncidentsUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalIncidentsUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalIncidentsUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalIncidentsUpdateData `json:"data"` - }{} - all := struct { - Data SecurityMonitoringSignalIncidentsUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_list_request.go b/api/v2/datadog/model_security_monitoring_signal_list_request.go deleted file mode 100644 index 544b7c68701..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_list_request.go +++ /dev/null @@ -1,202 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignalListRequest The request for a security signal list. -type SecurityMonitoringSignalListRequest struct { - // Search filters for listing security signals. - Filter *SecurityMonitoringSignalListRequestFilter `json:"filter,omitempty"` - // The paging attributes for listing security signals. - Page *SecurityMonitoringSignalListRequestPage `json:"page,omitempty"` - // The sort parameters used for querying security signals. - Sort *SecurityMonitoringSignalsSort `json:"sort,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{} -} - -// NewSecurityMonitoringSignalListRequest instantiates a new SecurityMonitoringSignalListRequest 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 NewSecurityMonitoringSignalListRequest() *SecurityMonitoringSignalListRequest { - this := SecurityMonitoringSignalListRequest{} - return &this -} - -// NewSecurityMonitoringSignalListRequestWithDefaults instantiates a new SecurityMonitoringSignalListRequest 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 NewSecurityMonitoringSignalListRequestWithDefaults() *SecurityMonitoringSignalListRequest { - this := SecurityMonitoringSignalListRequest{} - return &this -} - -// GetFilter returns the Filter field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequest) GetFilter() SecurityMonitoringSignalListRequestFilter { - if o == nil || o.Filter == nil { - var ret SecurityMonitoringSignalListRequestFilter - return ret - } - return *o.Filter -} - -// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequest) GetFilterOk() (*SecurityMonitoringSignalListRequestFilter, bool) { - if o == nil || o.Filter == nil { - return nil, false - } - return o.Filter, true -} - -// HasFilter returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequest) HasFilter() bool { - if o != nil && o.Filter != nil { - return true - } - - return false -} - -// SetFilter gets a reference to the given SecurityMonitoringSignalListRequestFilter and assigns it to the Filter field. -func (o *SecurityMonitoringSignalListRequest) SetFilter(v SecurityMonitoringSignalListRequestFilter) { - o.Filter = &v -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequest) GetPage() SecurityMonitoringSignalListRequestPage { - if o == nil || o.Page == nil { - var ret SecurityMonitoringSignalListRequestPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequest) GetPageOk() (*SecurityMonitoringSignalListRequestPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequest) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given SecurityMonitoringSignalListRequestPage and assigns it to the Page field. -func (o *SecurityMonitoringSignalListRequest) SetPage(v SecurityMonitoringSignalListRequestPage) { - o.Page = &v -} - -// GetSort returns the Sort field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequest) GetSort() SecurityMonitoringSignalsSort { - if o == nil || o.Sort == nil { - var ret SecurityMonitoringSignalsSort - return ret - } - return *o.Sort -} - -// GetSortOk returns a tuple with the Sort field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequest) GetSortOk() (*SecurityMonitoringSignalsSort, bool) { - if o == nil || o.Sort == nil { - return nil, false - } - return o.Sort, true -} - -// HasSort returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequest) HasSort() bool { - if o != nil && o.Sort != nil { - return true - } - - return false -} - -// SetSort gets a reference to the given SecurityMonitoringSignalsSort and assigns it to the Sort field. -func (o *SecurityMonitoringSignalListRequest) SetSort(v SecurityMonitoringSignalsSort) { - o.Sort = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalListRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Filter != nil { - toSerialize["filter"] = o.Filter - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - if o.Sort != nil { - toSerialize["sort"] = o.Sort - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalListRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Filter *SecurityMonitoringSignalListRequestFilter `json:"filter,omitempty"` - Page *SecurityMonitoringSignalListRequestPage `json:"page,omitempty"` - Sort *SecurityMonitoringSignalsSort `json:"sort,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Sort; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Filter = all.Filter - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - o.Sort = all.Sort - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_list_request_filter.go b/api/v2/datadog/model_security_monitoring_signal_list_request_filter.go deleted file mode 100644 index 766e3928b52..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_list_request_filter.go +++ /dev/null @@ -1,189 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// SecurityMonitoringSignalListRequestFilter Search filters for listing security signals. -type SecurityMonitoringSignalListRequestFilter struct { - // The minimum timestamp for requested security signals. - From *time.Time `json:"from,omitempty"` - // Search query for listing security signals. - Query *string `json:"query,omitempty"` - // The maximum timestamp for requested security signals. - To *time.Time `json:"to,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{} -} - -// NewSecurityMonitoringSignalListRequestFilter instantiates a new SecurityMonitoringSignalListRequestFilter 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 NewSecurityMonitoringSignalListRequestFilter() *SecurityMonitoringSignalListRequestFilter { - this := SecurityMonitoringSignalListRequestFilter{} - return &this -} - -// NewSecurityMonitoringSignalListRequestFilterWithDefaults instantiates a new SecurityMonitoringSignalListRequestFilter 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 NewSecurityMonitoringSignalListRequestFilterWithDefaults() *SecurityMonitoringSignalListRequestFilter { - this := SecurityMonitoringSignalListRequestFilter{} - return &this -} - -// GetFrom returns the From field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequestFilter) GetFrom() time.Time { - if o == nil || o.From == nil { - var ret time.Time - return ret - } - return *o.From -} - -// GetFromOk returns a tuple with the From field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequestFilter) GetFromOk() (*time.Time, bool) { - if o == nil || o.From == nil { - return nil, false - } - return o.From, true -} - -// HasFrom returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequestFilter) HasFrom() bool { - if o != nil && o.From != nil { - return true - } - - return false -} - -// SetFrom gets a reference to the given time.Time and assigns it to the From field. -func (o *SecurityMonitoringSignalListRequestFilter) SetFrom(v time.Time) { - o.From = &v -} - -// GetQuery returns the Query field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequestFilter) GetQuery() string { - if o == nil || o.Query == nil { - var ret string - return ret - } - return *o.Query -} - -// GetQueryOk returns a tuple with the Query field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequestFilter) GetQueryOk() (*string, bool) { - if o == nil || o.Query == nil { - return nil, false - } - return o.Query, true -} - -// HasQuery returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequestFilter) HasQuery() bool { - if o != nil && o.Query != nil { - return true - } - - return false -} - -// SetQuery gets a reference to the given string and assigns it to the Query field. -func (o *SecurityMonitoringSignalListRequestFilter) SetQuery(v string) { - o.Query = &v -} - -// GetTo returns the To field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequestFilter) GetTo() time.Time { - if o == nil || o.To == nil { - var ret time.Time - return ret - } - return *o.To -} - -// GetToOk returns a tuple with the To field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequestFilter) GetToOk() (*time.Time, bool) { - if o == nil || o.To == nil { - return nil, false - } - return o.To, true -} - -// HasTo returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequestFilter) HasTo() bool { - if o != nil && o.To != nil { - return true - } - - return false -} - -// SetTo gets a reference to the given time.Time and assigns it to the To field. -func (o *SecurityMonitoringSignalListRequestFilter) SetTo(v time.Time) { - o.To = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalListRequestFilter) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.From != nil { - if o.From.Nanosecond() == 0 { - toSerialize["from"] = o.From.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["from"] = o.From.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Query != nil { - toSerialize["query"] = o.Query - } - if o.To != nil { - if o.To.Nanosecond() == 0 { - toSerialize["to"] = o.To.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["to"] = o.To.Format("2006-01-02T15:04:05.000Z07:00") - } - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalListRequestFilter) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - From *time.Time `json:"from,omitempty"` - Query *string `json:"query,omitempty"` - To *time.Time `json:"to,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.From = all.From - o.Query = all.Query - o.To = all.To - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_list_request_page.go b/api/v2/datadog/model_security_monitoring_signal_list_request_page.go deleted file mode 100644 index befb257bdb3..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_list_request_page.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignalListRequestPage The paging attributes for listing security signals. -type SecurityMonitoringSignalListRequestPage struct { - // A list of results using the cursor provided in the previous query. - Cursor *string `json:"cursor,omitempty"` - // The maximum number of security signals in the response. - Limit *int32 `json:"limit,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{} -} - -// NewSecurityMonitoringSignalListRequestPage instantiates a new SecurityMonitoringSignalListRequestPage 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 NewSecurityMonitoringSignalListRequestPage() *SecurityMonitoringSignalListRequestPage { - this := SecurityMonitoringSignalListRequestPage{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// NewSecurityMonitoringSignalListRequestPageWithDefaults instantiates a new SecurityMonitoringSignalListRequestPage 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 NewSecurityMonitoringSignalListRequestPageWithDefaults() *SecurityMonitoringSignalListRequestPage { - this := SecurityMonitoringSignalListRequestPage{} - var limit int32 = 10 - this.Limit = &limit - return &this -} - -// GetCursor returns the Cursor field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequestPage) GetCursor() string { - if o == nil || o.Cursor == nil { - var ret string - return ret - } - return *o.Cursor -} - -// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequestPage) GetCursorOk() (*string, bool) { - if o == nil || o.Cursor == nil { - return nil, false - } - return o.Cursor, true -} - -// HasCursor returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequestPage) HasCursor() bool { - if o != nil && o.Cursor != nil { - return true - } - - return false -} - -// SetCursor gets a reference to the given string and assigns it to the Cursor field. -func (o *SecurityMonitoringSignalListRequestPage) SetCursor(v string) { - o.Cursor = &v -} - -// GetLimit returns the Limit field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalListRequestPage) GetLimit() int32 { - if o == nil || o.Limit == nil { - var ret int32 - return ret - } - return *o.Limit -} - -// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalListRequestPage) GetLimitOk() (*int32, bool) { - if o == nil || o.Limit == nil { - return nil, false - } - return o.Limit, true -} - -// HasLimit returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalListRequestPage) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false -} - -// SetLimit gets a reference to the given int32 and assigns it to the Limit field. -func (o *SecurityMonitoringSignalListRequestPage) SetLimit(v int32) { - o.Limit = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalListRequestPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Cursor != nil { - toSerialize["cursor"] = o.Cursor - } - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalListRequestPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Cursor *string `json:"cursor,omitempty"` - Limit *int32 `json:"limit,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Cursor = all.Cursor - o.Limit = all.Limit - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_state.go b/api/v2/datadog/model_security_monitoring_signal_state.go deleted file mode 100644 index 223f4d7ec9f..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_state.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalState The new triage state of the signal. -type SecurityMonitoringSignalState string - -// List of SecurityMonitoringSignalState. -const ( - SECURITYMONITORINGSIGNALSTATE_OPEN SecurityMonitoringSignalState = "open" - SECURITYMONITORINGSIGNALSTATE_ARCHIVED SecurityMonitoringSignalState = "archived" - SECURITYMONITORINGSIGNALSTATE_UNDER_REVIEW SecurityMonitoringSignalState = "under_review" -) - -var allowedSecurityMonitoringSignalStateEnumValues = []SecurityMonitoringSignalState{ - SECURITYMONITORINGSIGNALSTATE_OPEN, - SECURITYMONITORINGSIGNALSTATE_ARCHIVED, - SECURITYMONITORINGSIGNALSTATE_UNDER_REVIEW, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringSignalState) GetAllowedValues() []SecurityMonitoringSignalState { - return allowedSecurityMonitoringSignalStateEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringSignalState) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringSignalState(value) - return nil -} - -// NewSecurityMonitoringSignalStateFromValue returns a pointer to a valid SecurityMonitoringSignalState -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringSignalStateFromValue(v string) (*SecurityMonitoringSignalState, error) { - ev := SecurityMonitoringSignalState(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalState: valid values are %v", v, allowedSecurityMonitoringSignalStateEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringSignalState) IsValid() bool { - for _, existing := range allowedSecurityMonitoringSignalStateEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringSignalState value. -func (v SecurityMonitoringSignalState) Ptr() *SecurityMonitoringSignalState { - return &v -} - -// NullableSecurityMonitoringSignalState handles when a null is used for SecurityMonitoringSignalState. -type NullableSecurityMonitoringSignalState struct { - value *SecurityMonitoringSignalState - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalState) Get() *SecurityMonitoringSignalState { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalState) Set(val *SecurityMonitoringSignalState) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalState) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalState) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalState initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalState(val *SecurityMonitoringSignalState) *NullableSecurityMonitoringSignalState { - return &NullableSecurityMonitoringSignalState{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go b/api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go deleted file mode 100644 index 94a332aa3fb..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go +++ /dev/null @@ -1,236 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalStateUpdateAttributes Attributes describing the change of state of a security signal. -type SecurityMonitoringSignalStateUpdateAttributes struct { - // Optional comment to display on archived signals. - ArchiveComment *string `json:"archive_comment,omitempty"` - // Reason a signal is archived. - ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` - // The new triage state of the signal. - State SecurityMonitoringSignalState `json:"state"` - // Version of the updated signal. If server side version is higher, update will be rejected. - Version *int64 `json:"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{} -} - -// NewSecurityMonitoringSignalStateUpdateAttributes instantiates a new SecurityMonitoringSignalStateUpdateAttributes 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 NewSecurityMonitoringSignalStateUpdateAttributes(state SecurityMonitoringSignalState) *SecurityMonitoringSignalStateUpdateAttributes { - this := SecurityMonitoringSignalStateUpdateAttributes{} - this.State = state - return &this -} - -// NewSecurityMonitoringSignalStateUpdateAttributesWithDefaults instantiates a new SecurityMonitoringSignalStateUpdateAttributes 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 NewSecurityMonitoringSignalStateUpdateAttributesWithDefaults() *SecurityMonitoringSignalStateUpdateAttributes { - this := SecurityMonitoringSignalStateUpdateAttributes{} - return &this -} - -// GetArchiveComment returns the ArchiveComment field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveComment() string { - if o == nil || o.ArchiveComment == nil { - var ret string - return ret - } - return *o.ArchiveComment -} - -// GetArchiveCommentOk returns a tuple with the ArchiveComment field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveCommentOk() (*string, bool) { - if o == nil || o.ArchiveComment == nil { - return nil, false - } - return o.ArchiveComment, true -} - -// HasArchiveComment returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalStateUpdateAttributes) HasArchiveComment() bool { - if o != nil && o.ArchiveComment != nil { - return true - } - - return false -} - -// SetArchiveComment gets a reference to the given string and assigns it to the ArchiveComment field. -func (o *SecurityMonitoringSignalStateUpdateAttributes) SetArchiveComment(v string) { - o.ArchiveComment = &v -} - -// GetArchiveReason returns the ArchiveReason field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveReason() SecurityMonitoringSignalArchiveReason { - if o == nil || o.ArchiveReason == nil { - var ret SecurityMonitoringSignalArchiveReason - return ret - } - return *o.ArchiveReason -} - -// GetArchiveReasonOk returns a tuple with the ArchiveReason field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveReasonOk() (*SecurityMonitoringSignalArchiveReason, bool) { - if o == nil || o.ArchiveReason == nil { - return nil, false - } - return o.ArchiveReason, true -} - -// HasArchiveReason returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalStateUpdateAttributes) HasArchiveReason() bool { - if o != nil && o.ArchiveReason != nil { - return true - } - - return false -} - -// SetArchiveReason gets a reference to the given SecurityMonitoringSignalArchiveReason and assigns it to the ArchiveReason field. -func (o *SecurityMonitoringSignalStateUpdateAttributes) SetArchiveReason(v SecurityMonitoringSignalArchiveReason) { - o.ArchiveReason = &v -} - -// GetState returns the State field value. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetState() SecurityMonitoringSignalState { - if o == nil { - var ret SecurityMonitoringSignalState - return ret - } - return o.State -} - -// GetStateOk returns a tuple with the State field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetStateOk() (*SecurityMonitoringSignalState, bool) { - if o == nil { - return nil, false - } - return &o.State, true -} - -// SetState sets field value. -func (o *SecurityMonitoringSignalStateUpdateAttributes) SetState(v SecurityMonitoringSignalState) { - o.State = v -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetVersion() int64 { - if o == nil || o.Version == nil { - var ret int64 - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalStateUpdateAttributes) GetVersionOk() (*int64, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalStateUpdateAttributes) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given int64 and assigns it to the Version field. -func (o *SecurityMonitoringSignalStateUpdateAttributes) SetVersion(v int64) { - o.Version = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalStateUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ArchiveComment != nil { - toSerialize["archive_comment"] = o.ArchiveComment - } - if o.ArchiveReason != nil { - toSerialize["archive_reason"] = o.ArchiveReason - } - toSerialize["state"] = o.State - if o.Version != nil { - toSerialize["version"] = o.Version - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - State *SecurityMonitoringSignalState `json:"state"` - }{} - all := struct { - ArchiveComment *string `json:"archive_comment,omitempty"` - ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` - State SecurityMonitoringSignalState `json:"state"` - Version *int64 `json:"version,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.State == nil { - return fmt.Errorf("Required field state missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ArchiveReason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.State; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ArchiveComment = all.ArchiveComment - o.ArchiveReason = all.ArchiveReason - o.State = all.State - o.Version = all.Version - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_state_update_data.go b/api/v2/datadog/model_security_monitoring_signal_state_update_data.go deleted file mode 100644 index c947aefcbf2..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_state_update_data.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalStateUpdateData Data containing the patch for changing the state of a signal. -type SecurityMonitoringSignalStateUpdateData struct { - // Attributes describing the change of state of a security signal. - Attributes SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` - // 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{} -} - -// NewSecurityMonitoringSignalStateUpdateData instantiates a new SecurityMonitoringSignalStateUpdateData 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 NewSecurityMonitoringSignalStateUpdateData(attributes SecurityMonitoringSignalStateUpdateAttributes) *SecurityMonitoringSignalStateUpdateData { - this := SecurityMonitoringSignalStateUpdateData{} - this.Attributes = attributes - return &this -} - -// NewSecurityMonitoringSignalStateUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalStateUpdateData 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 NewSecurityMonitoringSignalStateUpdateDataWithDefaults() *SecurityMonitoringSignalStateUpdateData { - this := SecurityMonitoringSignalStateUpdateData{} - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *SecurityMonitoringSignalStateUpdateData) GetAttributes() SecurityMonitoringSignalStateUpdateAttributes { - if o == nil { - var ret SecurityMonitoringSignalStateUpdateAttributes - 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 *SecurityMonitoringSignalStateUpdateData) GetAttributesOk() (*SecurityMonitoringSignalStateUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *SecurityMonitoringSignalStateUpdateData) SetAttributes(v SecurityMonitoringSignalStateUpdateAttributes) { - o.Attributes = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalStateUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalStateUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` - }{} - all := struct { - Attributes SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_state_update_request.go b/api/v2/datadog/model_security_monitoring_signal_state_update_request.go deleted file mode 100644 index 21f52323600..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_state_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalStateUpdateRequest Request body for changing the state of a given security monitoring signal. -type SecurityMonitoringSignalStateUpdateRequest struct { - // Data containing the patch for changing the state of a signal. - Data SecurityMonitoringSignalStateUpdateData `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{} -} - -// NewSecurityMonitoringSignalStateUpdateRequest instantiates a new SecurityMonitoringSignalStateUpdateRequest 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 NewSecurityMonitoringSignalStateUpdateRequest(data SecurityMonitoringSignalStateUpdateData) *SecurityMonitoringSignalStateUpdateRequest { - this := SecurityMonitoringSignalStateUpdateRequest{} - this.Data = data - return &this -} - -// NewSecurityMonitoringSignalStateUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalStateUpdateRequest 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 NewSecurityMonitoringSignalStateUpdateRequestWithDefaults() *SecurityMonitoringSignalStateUpdateRequest { - this := SecurityMonitoringSignalStateUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *SecurityMonitoringSignalStateUpdateRequest) GetData() SecurityMonitoringSignalStateUpdateData { - if o == nil { - var ret SecurityMonitoringSignalStateUpdateData - 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 *SecurityMonitoringSignalStateUpdateRequest) GetDataOk() (*SecurityMonitoringSignalStateUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *SecurityMonitoringSignalStateUpdateRequest) SetData(v SecurityMonitoringSignalStateUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalStateUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalStateUpdateData `json:"data"` - }{} - all := struct { - Data SecurityMonitoringSignalStateUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_triage_attributes.go b/api/v2/datadog/model_security_monitoring_signal_triage_attributes.go deleted file mode 100644 index 8bc311e0e8a..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_triage_attributes.go +++ /dev/null @@ -1,440 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalTriageAttributes Attributes describing a triage state update operation over a security signal. -type SecurityMonitoringSignalTriageAttributes struct { - // Optional comment to display on archived signals. - ArchiveComment *string `json:"archive_comment,omitempty"` - // Timestamp of the last edit to the comment. - ArchiveCommentTimestamp *int64 `json:"archive_comment_timestamp,omitempty"` - // Object representing a given user entity. - ArchiveCommentUser *SecurityMonitoringTriageUser `json:"archive_comment_user,omitempty"` - // Reason a signal is archived. - ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` - // Object representing a given user entity. - Assignee SecurityMonitoringTriageUser `json:"assignee"` - // Array of incidents that are associated with this signal. - IncidentIds []int64 `json:"incident_ids"` - // The new triage state of the signal. - State SecurityMonitoringSignalState `json:"state"` - // Timestamp of the last update to the signal state. - StateUpdateTimestamp *int64 `json:"state_update_timestamp,omitempty"` - // Object representing a given user entity. - StateUpdateUser *SecurityMonitoringTriageUser `json:"state_update_user,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{} -} - -// NewSecurityMonitoringSignalTriageAttributes instantiates a new SecurityMonitoringSignalTriageAttributes 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 NewSecurityMonitoringSignalTriageAttributes(assignee SecurityMonitoringTriageUser, incidentIds []int64, state SecurityMonitoringSignalState) *SecurityMonitoringSignalTriageAttributes { - this := SecurityMonitoringSignalTriageAttributes{} - this.Assignee = assignee - this.IncidentIds = incidentIds - this.State = state - return &this -} - -// NewSecurityMonitoringSignalTriageAttributesWithDefaults instantiates a new SecurityMonitoringSignalTriageAttributes 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 NewSecurityMonitoringSignalTriageAttributesWithDefaults() *SecurityMonitoringSignalTriageAttributes { - this := SecurityMonitoringSignalTriageAttributes{} - return &this -} - -// GetArchiveComment returns the ArchiveComment field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveComment() string { - if o == nil || o.ArchiveComment == nil { - var ret string - return ret - } - return *o.ArchiveComment -} - -// GetArchiveCommentOk returns a tuple with the ArchiveComment field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentOk() (*string, bool) { - if o == nil || o.ArchiveComment == nil { - return nil, false - } - return o.ArchiveComment, true -} - -// HasArchiveComment returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveComment() bool { - if o != nil && o.ArchiveComment != nil { - return true - } - - return false -} - -// SetArchiveComment gets a reference to the given string and assigns it to the ArchiveComment field. -func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveComment(v string) { - o.ArchiveComment = &v -} - -// GetArchiveCommentTimestamp returns the ArchiveCommentTimestamp field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentTimestamp() int64 { - if o == nil || o.ArchiveCommentTimestamp == nil { - var ret int64 - return ret - } - return *o.ArchiveCommentTimestamp -} - -// GetArchiveCommentTimestampOk returns a tuple with the ArchiveCommentTimestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentTimestampOk() (*int64, bool) { - if o == nil || o.ArchiveCommentTimestamp == nil { - return nil, false - } - return o.ArchiveCommentTimestamp, true -} - -// HasArchiveCommentTimestamp returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveCommentTimestamp() bool { - if o != nil && o.ArchiveCommentTimestamp != nil { - return true - } - - return false -} - -// SetArchiveCommentTimestamp gets a reference to the given int64 and assigns it to the ArchiveCommentTimestamp field. -func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveCommentTimestamp(v int64) { - o.ArchiveCommentTimestamp = &v -} - -// GetArchiveCommentUser returns the ArchiveCommentUser field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentUser() SecurityMonitoringTriageUser { - if o == nil || o.ArchiveCommentUser == nil { - var ret SecurityMonitoringTriageUser - return ret - } - return *o.ArchiveCommentUser -} - -// GetArchiveCommentUserOk returns a tuple with the ArchiveCommentUser field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentUserOk() (*SecurityMonitoringTriageUser, bool) { - if o == nil || o.ArchiveCommentUser == nil { - return nil, false - } - return o.ArchiveCommentUser, true -} - -// HasArchiveCommentUser returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveCommentUser() bool { - if o != nil && o.ArchiveCommentUser != nil { - return true - } - - return false -} - -// SetArchiveCommentUser gets a reference to the given SecurityMonitoringTriageUser and assigns it to the ArchiveCommentUser field. -func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveCommentUser(v SecurityMonitoringTriageUser) { - o.ArchiveCommentUser = &v -} - -// GetArchiveReason returns the ArchiveReason field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveReason() SecurityMonitoringSignalArchiveReason { - if o == nil || o.ArchiveReason == nil { - var ret SecurityMonitoringSignalArchiveReason - return ret - } - return *o.ArchiveReason -} - -// GetArchiveReasonOk returns a tuple with the ArchiveReason field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveReasonOk() (*SecurityMonitoringSignalArchiveReason, bool) { - if o == nil || o.ArchiveReason == nil { - return nil, false - } - return o.ArchiveReason, true -} - -// HasArchiveReason returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveReason() bool { - if o != nil && o.ArchiveReason != nil { - return true - } - - return false -} - -// SetArchiveReason gets a reference to the given SecurityMonitoringSignalArchiveReason and assigns it to the ArchiveReason field. -func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveReason(v SecurityMonitoringSignalArchiveReason) { - o.ArchiveReason = &v -} - -// GetAssignee returns the Assignee field value. -func (o *SecurityMonitoringSignalTriageAttributes) GetAssignee() SecurityMonitoringTriageUser { - if o == nil { - var ret SecurityMonitoringTriageUser - return ret - } - return o.Assignee -} - -// GetAssigneeOk returns a tuple with the Assignee field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetAssigneeOk() (*SecurityMonitoringTriageUser, bool) { - if o == nil { - return nil, false - } - return &o.Assignee, true -} - -// SetAssignee sets field value. -func (o *SecurityMonitoringSignalTriageAttributes) SetAssignee(v SecurityMonitoringTriageUser) { - o.Assignee = v -} - -// GetIncidentIds returns the IncidentIds field value. -func (o *SecurityMonitoringSignalTriageAttributes) GetIncidentIds() []int64 { - if o == nil { - var ret []int64 - return ret - } - return o.IncidentIds -} - -// GetIncidentIdsOk returns a tuple with the IncidentIds field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetIncidentIdsOk() (*[]int64, bool) { - if o == nil { - return nil, false - } - return &o.IncidentIds, true -} - -// SetIncidentIds sets field value. -func (o *SecurityMonitoringSignalTriageAttributes) SetIncidentIds(v []int64) { - o.IncidentIds = v -} - -// GetState returns the State field value. -func (o *SecurityMonitoringSignalTriageAttributes) GetState() SecurityMonitoringSignalState { - if o == nil { - var ret SecurityMonitoringSignalState - return ret - } - return o.State -} - -// GetStateOk returns a tuple with the State field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetStateOk() (*SecurityMonitoringSignalState, bool) { - if o == nil { - return nil, false - } - return &o.State, true -} - -// SetState sets field value. -func (o *SecurityMonitoringSignalTriageAttributes) SetState(v SecurityMonitoringSignalState) { - o.State = v -} - -// GetStateUpdateTimestamp returns the StateUpdateTimestamp field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateTimestamp() int64 { - if o == nil || o.StateUpdateTimestamp == nil { - var ret int64 - return ret - } - return *o.StateUpdateTimestamp -} - -// GetStateUpdateTimestampOk returns a tuple with the StateUpdateTimestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateTimestampOk() (*int64, bool) { - if o == nil || o.StateUpdateTimestamp == nil { - return nil, false - } - return o.StateUpdateTimestamp, true -} - -// HasStateUpdateTimestamp returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalTriageAttributes) HasStateUpdateTimestamp() bool { - if o != nil && o.StateUpdateTimestamp != nil { - return true - } - - return false -} - -// SetStateUpdateTimestamp gets a reference to the given int64 and assigns it to the StateUpdateTimestamp field. -func (o *SecurityMonitoringSignalTriageAttributes) SetStateUpdateTimestamp(v int64) { - o.StateUpdateTimestamp = &v -} - -// GetStateUpdateUser returns the StateUpdateUser field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateUser() SecurityMonitoringTriageUser { - if o == nil || o.StateUpdateUser == nil { - var ret SecurityMonitoringTriageUser - return ret - } - return *o.StateUpdateUser -} - -// GetStateUpdateUserOk returns a tuple with the StateUpdateUser field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateUserOk() (*SecurityMonitoringTriageUser, bool) { - if o == nil || o.StateUpdateUser == nil { - return nil, false - } - return o.StateUpdateUser, true -} - -// HasStateUpdateUser returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalTriageAttributes) HasStateUpdateUser() bool { - if o != nil && o.StateUpdateUser != nil { - return true - } - - return false -} - -// SetStateUpdateUser gets a reference to the given SecurityMonitoringTriageUser and assigns it to the StateUpdateUser field. -func (o *SecurityMonitoringSignalTriageAttributes) SetStateUpdateUser(v SecurityMonitoringTriageUser) { - o.StateUpdateUser = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalTriageAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.ArchiveComment != nil { - toSerialize["archive_comment"] = o.ArchiveComment - } - if o.ArchiveCommentTimestamp != nil { - toSerialize["archive_comment_timestamp"] = o.ArchiveCommentTimestamp - } - if o.ArchiveCommentUser != nil { - toSerialize["archive_comment_user"] = o.ArchiveCommentUser - } - if o.ArchiveReason != nil { - toSerialize["archive_reason"] = o.ArchiveReason - } - toSerialize["assignee"] = o.Assignee - toSerialize["incident_ids"] = o.IncidentIds - toSerialize["state"] = o.State - if o.StateUpdateTimestamp != nil { - toSerialize["state_update_timestamp"] = o.StateUpdateTimestamp - } - if o.StateUpdateUser != nil { - toSerialize["state_update_user"] = o.StateUpdateUser - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Assignee *SecurityMonitoringTriageUser `json:"assignee"` - IncidentIds *[]int64 `json:"incident_ids"` - State *SecurityMonitoringSignalState `json:"state"` - }{} - all := struct { - ArchiveComment *string `json:"archive_comment,omitempty"` - ArchiveCommentTimestamp *int64 `json:"archive_comment_timestamp,omitempty"` - ArchiveCommentUser *SecurityMonitoringTriageUser `json:"archive_comment_user,omitempty"` - ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` - Assignee SecurityMonitoringTriageUser `json:"assignee"` - IncidentIds []int64 `json:"incident_ids"` - State SecurityMonitoringSignalState `json:"state"` - StateUpdateTimestamp *int64 `json:"state_update_timestamp,omitempty"` - StateUpdateUser *SecurityMonitoringTriageUser `json:"state_update_user,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assignee == nil { - return fmt.Errorf("Required field assignee missing") - } - if required.IncidentIds == nil { - return fmt.Errorf("Required field incident_ids missing") - } - if required.State == nil { - return fmt.Errorf("Required field state missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.ArchiveReason; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.State; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.ArchiveComment = all.ArchiveComment - o.ArchiveCommentTimestamp = all.ArchiveCommentTimestamp - if all.ArchiveCommentUser != nil && all.ArchiveCommentUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.ArchiveCommentUser = all.ArchiveCommentUser - o.ArchiveReason = all.ArchiveReason - if all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Assignee = all.Assignee - o.IncidentIds = all.IncidentIds - o.State = all.State - o.StateUpdateTimestamp = all.StateUpdateTimestamp - if all.StateUpdateUser != nil && all.StateUpdateUser.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.StateUpdateUser = all.StateUpdateUser - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_triage_update_data.go b/api/v2/datadog/model_security_monitoring_signal_triage_update_data.go deleted file mode 100644 index fd14dac57b1..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_triage_update_data.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignalTriageUpdateData Data containing the updated triage attributes of the signal. -type SecurityMonitoringSignalTriageUpdateData struct { - // Attributes describing a triage state update operation over a security signal. - Attributes *SecurityMonitoringSignalTriageAttributes `json:"attributes,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{} -} - -// NewSecurityMonitoringSignalTriageUpdateData instantiates a new SecurityMonitoringSignalTriageUpdateData 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 NewSecurityMonitoringSignalTriageUpdateData() *SecurityMonitoringSignalTriageUpdateData { - this := SecurityMonitoringSignalTriageUpdateData{} - return &this -} - -// NewSecurityMonitoringSignalTriageUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalTriageUpdateData 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 NewSecurityMonitoringSignalTriageUpdateDataWithDefaults() *SecurityMonitoringSignalTriageUpdateData { - this := SecurityMonitoringSignalTriageUpdateData{} - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalTriageUpdateData) GetAttributes() SecurityMonitoringSignalTriageAttributes { - if o == nil || o.Attributes == nil { - var ret SecurityMonitoringSignalTriageAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalTriageUpdateData) GetAttributesOk() (*SecurityMonitoringSignalTriageAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalTriageUpdateData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given SecurityMonitoringSignalTriageAttributes and assigns it to the Attributes field. -func (o *SecurityMonitoringSignalTriageUpdateData) SetAttributes(v SecurityMonitoringSignalTriageAttributes) { - o.Attributes = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalTriageUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalTriageUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *SecurityMonitoringSignalTriageAttributes `json:"attributes,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_triage_update_response.go b/api/v2/datadog/model_security_monitoring_signal_triage_update_response.go deleted file mode 100644 index 457c4fe54da..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_triage_update_response.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalTriageUpdateResponse The response returned after all triage operations, containing the updated signal triage data. -type SecurityMonitoringSignalTriageUpdateResponse struct { - // Data containing the updated triage attributes of the signal. - Data SecurityMonitoringSignalTriageUpdateData `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{} -} - -// NewSecurityMonitoringSignalTriageUpdateResponse instantiates a new SecurityMonitoringSignalTriageUpdateResponse 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 NewSecurityMonitoringSignalTriageUpdateResponse(data SecurityMonitoringSignalTriageUpdateData) *SecurityMonitoringSignalTriageUpdateResponse { - this := SecurityMonitoringSignalTriageUpdateResponse{} - this.Data = data - return &this -} - -// NewSecurityMonitoringSignalTriageUpdateResponseWithDefaults instantiates a new SecurityMonitoringSignalTriageUpdateResponse 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 NewSecurityMonitoringSignalTriageUpdateResponseWithDefaults() *SecurityMonitoringSignalTriageUpdateResponse { - this := SecurityMonitoringSignalTriageUpdateResponse{} - return &this -} - -// GetData returns the Data field value. -func (o *SecurityMonitoringSignalTriageUpdateResponse) GetData() SecurityMonitoringSignalTriageUpdateData { - if o == nil { - var ret SecurityMonitoringSignalTriageUpdateData - 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 *SecurityMonitoringSignalTriageUpdateResponse) GetDataOk() (*SecurityMonitoringSignalTriageUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *SecurityMonitoringSignalTriageUpdateResponse) SetData(v SecurityMonitoringSignalTriageUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalTriageUpdateResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalTriageUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalTriageUpdateData `json:"data"` - }{} - all := struct { - Data SecurityMonitoringSignalTriageUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signal_type.go b/api/v2/datadog/model_security_monitoring_signal_type.go deleted file mode 100644 index 7ccd9440f8b..00000000000 --- a/api/v2/datadog/model_security_monitoring_signal_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalType The type of event. -type SecurityMonitoringSignalType string - -// List of SecurityMonitoringSignalType. -const ( - SECURITYMONITORINGSIGNALTYPE_SIGNAL SecurityMonitoringSignalType = "signal" -) - -var allowedSecurityMonitoringSignalTypeEnumValues = []SecurityMonitoringSignalType{ - SECURITYMONITORINGSIGNALTYPE_SIGNAL, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringSignalType) GetAllowedValues() []SecurityMonitoringSignalType { - return allowedSecurityMonitoringSignalTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringSignalType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringSignalType(value) - return nil -} - -// NewSecurityMonitoringSignalTypeFromValue returns a pointer to a valid SecurityMonitoringSignalType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringSignalTypeFromValue(v string) (*SecurityMonitoringSignalType, error) { - ev := SecurityMonitoringSignalType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalType: valid values are %v", v, allowedSecurityMonitoringSignalTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringSignalType) IsValid() bool { - for _, existing := range allowedSecurityMonitoringSignalTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringSignalType value. -func (v SecurityMonitoringSignalType) Ptr() *SecurityMonitoringSignalType { - return &v -} - -// NullableSecurityMonitoringSignalType handles when a null is used for SecurityMonitoringSignalType. -type NullableSecurityMonitoringSignalType struct { - value *SecurityMonitoringSignalType - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalType) Get() *SecurityMonitoringSignalType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalType) Set(val *SecurityMonitoringSignalType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalType initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalType(val *SecurityMonitoringSignalType) *NullableSecurityMonitoringSignalType { - return &NullableSecurityMonitoringSignalType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response.go b/api/v2/datadog/model_security_monitoring_signals_list_response.go deleted file mode 100644 index 7416d52615a..00000000000 --- a/api/v2/datadog/model_security_monitoring_signals_list_response.go +++ /dev/null @@ -1,195 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignalsListResponse The response object with all security signals matching the request -// and pagination information. -type SecurityMonitoringSignalsListResponse struct { - // An array of security signals matching the request. - Data []SecurityMonitoringSignal `json:"data,omitempty"` - // Links attributes. - Links *SecurityMonitoringSignalsListResponseLinks `json:"links,omitempty"` - // Meta attributes. - Meta *SecurityMonitoringSignalsListResponseMeta `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{} -} - -// NewSecurityMonitoringSignalsListResponse instantiates a new SecurityMonitoringSignalsListResponse 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 NewSecurityMonitoringSignalsListResponse() *SecurityMonitoringSignalsListResponse { - this := SecurityMonitoringSignalsListResponse{} - return &this -} - -// NewSecurityMonitoringSignalsListResponseWithDefaults instantiates a new SecurityMonitoringSignalsListResponse 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 NewSecurityMonitoringSignalsListResponseWithDefaults() *SecurityMonitoringSignalsListResponse { - this := SecurityMonitoringSignalsListResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalsListResponse) GetData() []SecurityMonitoringSignal { - if o == nil || o.Data == nil { - var ret []SecurityMonitoringSignal - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalsListResponse) GetDataOk() (*[]SecurityMonitoringSignal, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalsListResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []SecurityMonitoringSignal and assigns it to the Data field. -func (o *SecurityMonitoringSignalsListResponse) SetData(v []SecurityMonitoringSignal) { - o.Data = v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalsListResponse) GetLinks() SecurityMonitoringSignalsListResponseLinks { - if o == nil || o.Links == nil { - var ret SecurityMonitoringSignalsListResponseLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalsListResponse) GetLinksOk() (*SecurityMonitoringSignalsListResponseLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalsListResponse) HasLinks() bool { - if o != nil && o.Links != nil { - return true - } - - return false -} - -// SetLinks gets a reference to the given SecurityMonitoringSignalsListResponseLinks and assigns it to the Links field. -func (o *SecurityMonitoringSignalsListResponse) SetLinks(v SecurityMonitoringSignalsListResponseLinks) { - o.Links = &v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalsListResponse) GetMeta() SecurityMonitoringSignalsListResponseMeta { - if o == nil || o.Meta == nil { - var ret SecurityMonitoringSignalsListResponseMeta - 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 *SecurityMonitoringSignalsListResponse) GetMetaOk() (*SecurityMonitoringSignalsListResponseMeta, 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 *SecurityMonitoringSignalsListResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given SecurityMonitoringSignalsListResponseMeta and assigns it to the Meta field. -func (o *SecurityMonitoringSignalsListResponse) SetMeta(v SecurityMonitoringSignalsListResponseMeta) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalsListResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalsListResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []SecurityMonitoringSignal `json:"data,omitempty"` - Links *SecurityMonitoringSignalsListResponseLinks `json:"links,omitempty"` - Meta *SecurityMonitoringSignalsListResponseMeta `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Links = all.Links - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response_links.go b/api/v2/datadog/model_security_monitoring_signals_list_response_links.go deleted file mode 100644 index cb75ce25a64..00000000000 --- a/api/v2/datadog/model_security_monitoring_signals_list_response_links.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignalsListResponseLinks Links attributes. -type SecurityMonitoringSignalsListResponseLinks struct { - // The link for the next set of results. **Note**: The request can also be made using the - // POST endpoint. - Next *string `json:"next,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{} -} - -// NewSecurityMonitoringSignalsListResponseLinks instantiates a new SecurityMonitoringSignalsListResponseLinks 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 NewSecurityMonitoringSignalsListResponseLinks() *SecurityMonitoringSignalsListResponseLinks { - this := SecurityMonitoringSignalsListResponseLinks{} - return &this -} - -// NewSecurityMonitoringSignalsListResponseLinksWithDefaults instantiates a new SecurityMonitoringSignalsListResponseLinks 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 NewSecurityMonitoringSignalsListResponseLinksWithDefaults() *SecurityMonitoringSignalsListResponseLinks { - this := SecurityMonitoringSignalsListResponseLinks{} - return &this -} - -// GetNext returns the Next field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalsListResponseLinks) GetNext() string { - if o == nil || o.Next == nil { - var ret string - return ret - } - return *o.Next -} - -// GetNextOk returns a tuple with the Next field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalsListResponseLinks) GetNextOk() (*string, bool) { - if o == nil || o.Next == nil { - return nil, false - } - return o.Next, true -} - -// HasNext returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalsListResponseLinks) HasNext() bool { - if o != nil && o.Next != nil { - return true - } - - return false -} - -// SetNext gets a reference to the given string and assigns it to the Next field. -func (o *SecurityMonitoringSignalsListResponseLinks) SetNext(v string) { - o.Next = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalsListResponseLinks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Next != nil { - toSerialize["next"] = o.Next - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Next *string `json:"next,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Next = all.Next - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response_meta.go b/api/v2/datadog/model_security_monitoring_signals_list_response_meta.go deleted file mode 100644 index cda9da82b9d..00000000000 --- a/api/v2/datadog/model_security_monitoring_signals_list_response_meta.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignalsListResponseMeta Meta attributes. -type SecurityMonitoringSignalsListResponseMeta struct { - // Paging attributes. - Page *SecurityMonitoringSignalsListResponseMetaPage `json:"page,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{} -} - -// NewSecurityMonitoringSignalsListResponseMeta instantiates a new SecurityMonitoringSignalsListResponseMeta 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 NewSecurityMonitoringSignalsListResponseMeta() *SecurityMonitoringSignalsListResponseMeta { - this := SecurityMonitoringSignalsListResponseMeta{} - return &this -} - -// NewSecurityMonitoringSignalsListResponseMetaWithDefaults instantiates a new SecurityMonitoringSignalsListResponseMeta 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 NewSecurityMonitoringSignalsListResponseMetaWithDefaults() *SecurityMonitoringSignalsListResponseMeta { - this := SecurityMonitoringSignalsListResponseMeta{} - return &this -} - -// GetPage returns the Page field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalsListResponseMeta) GetPage() SecurityMonitoringSignalsListResponseMetaPage { - if o == nil || o.Page == nil { - var ret SecurityMonitoringSignalsListResponseMetaPage - return ret - } - return *o.Page -} - -// GetPageOk returns a tuple with the Page field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalsListResponseMeta) GetPageOk() (*SecurityMonitoringSignalsListResponseMetaPage, bool) { - if o == nil || o.Page == nil { - return nil, false - } - return o.Page, true -} - -// HasPage returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalsListResponseMeta) HasPage() bool { - if o != nil && o.Page != nil { - return true - } - - return false -} - -// SetPage gets a reference to the given SecurityMonitoringSignalsListResponseMetaPage and assigns it to the Page field. -func (o *SecurityMonitoringSignalsListResponseMeta) SetPage(v SecurityMonitoringSignalsListResponseMetaPage) { - o.Page = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalsListResponseMeta) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Page != nil { - toSerialize["page"] = o.Page - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalsListResponseMeta) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Page *SecurityMonitoringSignalsListResponseMetaPage `json:"page,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Page = all.Page - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go b/api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go deleted file mode 100644 index 5fafbee499b..00000000000 --- a/api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// SecurityMonitoringSignalsListResponseMetaPage Paging attributes. -type SecurityMonitoringSignalsListResponseMetaPage struct { - // The cursor used to get the next results, if any. To make the next request, use the same - // parameters with the addition of the `page[cursor]`. - After *string `json:"after,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{} -} - -// NewSecurityMonitoringSignalsListResponseMetaPage instantiates a new SecurityMonitoringSignalsListResponseMetaPage 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 NewSecurityMonitoringSignalsListResponseMetaPage() *SecurityMonitoringSignalsListResponseMetaPage { - this := SecurityMonitoringSignalsListResponseMetaPage{} - return &this -} - -// NewSecurityMonitoringSignalsListResponseMetaPageWithDefaults instantiates a new SecurityMonitoringSignalsListResponseMetaPage 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 NewSecurityMonitoringSignalsListResponseMetaPageWithDefaults() *SecurityMonitoringSignalsListResponseMetaPage { - this := SecurityMonitoringSignalsListResponseMetaPage{} - return &this -} - -// GetAfter returns the After field value if set, zero value otherwise. -func (o *SecurityMonitoringSignalsListResponseMetaPage) GetAfter() string { - if o == nil || o.After == nil { - var ret string - return ret - } - return *o.After -} - -// GetAfterOk returns a tuple with the After field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringSignalsListResponseMetaPage) GetAfterOk() (*string, bool) { - if o == nil || o.After == nil { - return nil, false - } - return o.After, true -} - -// HasAfter returns a boolean if a field has been set. -func (o *SecurityMonitoringSignalsListResponseMetaPage) HasAfter() bool { - if o != nil && o.After != nil { - return true - } - - return false -} - -// SetAfter gets a reference to the given string and assigns it to the After field. -func (o *SecurityMonitoringSignalsListResponseMetaPage) SetAfter(v string) { - o.After = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringSignalsListResponseMetaPage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.After != nil { - toSerialize["after"] = o.After - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringSignalsListResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - After *string `json:"after,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.After = all.After - return nil -} diff --git a/api/v2/datadog/model_security_monitoring_signals_sort.go b/api/v2/datadog/model_security_monitoring_signals_sort.go deleted file mode 100644 index cea5097ae32..00000000000 --- a/api/v2/datadog/model_security_monitoring_signals_sort.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringSignalsSort The sort parameters used for querying security signals. -type SecurityMonitoringSignalsSort string - -// List of SecurityMonitoringSignalsSort. -const ( - SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_ASCENDING SecurityMonitoringSignalsSort = "timestamp" - SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_DESCENDING SecurityMonitoringSignalsSort = "-timestamp" -) - -var allowedSecurityMonitoringSignalsSortEnumValues = []SecurityMonitoringSignalsSort{ - SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_ASCENDING, - SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_DESCENDING, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SecurityMonitoringSignalsSort) GetAllowedValues() []SecurityMonitoringSignalsSort { - return allowedSecurityMonitoringSignalsSortEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SecurityMonitoringSignalsSort) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SecurityMonitoringSignalsSort(value) - return nil -} - -// NewSecurityMonitoringSignalsSortFromValue returns a pointer to a valid SecurityMonitoringSignalsSort -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSecurityMonitoringSignalsSortFromValue(v string) (*SecurityMonitoringSignalsSort, error) { - ev := SecurityMonitoringSignalsSort(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalsSort: valid values are %v", v, allowedSecurityMonitoringSignalsSortEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SecurityMonitoringSignalsSort) IsValid() bool { - for _, existing := range allowedSecurityMonitoringSignalsSortEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SecurityMonitoringSignalsSort value. -func (v SecurityMonitoringSignalsSort) Ptr() *SecurityMonitoringSignalsSort { - return &v -} - -// NullableSecurityMonitoringSignalsSort handles when a null is used for SecurityMonitoringSignalsSort. -type NullableSecurityMonitoringSignalsSort struct { - value *SecurityMonitoringSignalsSort - isSet bool -} - -// Get returns the associated value. -func (v NullableSecurityMonitoringSignalsSort) Get() *SecurityMonitoringSignalsSort { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableSecurityMonitoringSignalsSort) Set(val *SecurityMonitoringSignalsSort) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableSecurityMonitoringSignalsSort) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableSecurityMonitoringSignalsSort) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableSecurityMonitoringSignalsSort initializes the struct as if Set has been called. -func NewNullableSecurityMonitoringSignalsSort(val *SecurityMonitoringSignalsSort) *NullableSecurityMonitoringSignalsSort { - return &NullableSecurityMonitoringSignalsSort{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableSecurityMonitoringSignalsSort) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableSecurityMonitoringSignalsSort) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_security_monitoring_triage_user.go b/api/v2/datadog/model_security_monitoring_triage_user.go deleted file mode 100644 index bca84ef197a..00000000000 --- a/api/v2/datadog/model_security_monitoring_triage_user.go +++ /dev/null @@ -1,220 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// SecurityMonitoringTriageUser Object representing a given user entity. -type SecurityMonitoringTriageUser struct { - // The handle for this user account. - Handle *string `json:"handle,omitempty"` - // Numerical ID assigned by Datadog to this user account. - Id *int64 `json:"id,omitempty"` - // The name for this user account. - Name *string `json:"name,omitempty"` - // UUID assigned by Datadog to this user account. - Uuid string `json:"uuid"` - // 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{} -} - -// NewSecurityMonitoringTriageUser instantiates a new SecurityMonitoringTriageUser 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 NewSecurityMonitoringTriageUser(uuid string) *SecurityMonitoringTriageUser { - this := SecurityMonitoringTriageUser{} - this.Uuid = uuid - return &this -} - -// NewSecurityMonitoringTriageUserWithDefaults instantiates a new SecurityMonitoringTriageUser 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 NewSecurityMonitoringTriageUserWithDefaults() *SecurityMonitoringTriageUser { - this := SecurityMonitoringTriageUser{} - return &this -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *SecurityMonitoringTriageUser) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringTriageUser) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *SecurityMonitoringTriageUser) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *SecurityMonitoringTriageUser) SetHandle(v string) { - o.Handle = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *SecurityMonitoringTriageUser) GetId() int64 { - if o == nil || o.Id == nil { - var ret int64 - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringTriageUser) GetIdOk() (*int64, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SecurityMonitoringTriageUser) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given int64 and assigns it to the Id field. -func (o *SecurityMonitoringTriageUser) SetId(v int64) { - o.Id = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *SecurityMonitoringTriageUser) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringTriageUser) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityMonitoringTriageUser) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *SecurityMonitoringTriageUser) SetName(v string) { - o.Name = &v -} - -// GetUuid returns the Uuid field value. -func (o *SecurityMonitoringTriageUser) GetUuid() string { - if o == nil { - var ret string - return ret - } - return o.Uuid -} - -// GetUuidOk returns a tuple with the Uuid field value -// and a boolean to check if the value has been set. -func (o *SecurityMonitoringTriageUser) GetUuidOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Uuid, true -} - -// SetUuid sets field value. -func (o *SecurityMonitoringTriageUser) SetUuid(v string) { - o.Uuid = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SecurityMonitoringTriageUser) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["uuid"] = o.Uuid - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SecurityMonitoringTriageUser) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Uuid *string `json:"uuid"` - }{} - all := struct { - Handle *string `json:"handle,omitempty"` - Id *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Uuid string `json:"uuid"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Uuid == nil { - return fmt.Errorf("Required field uuid missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Handle = all.Handle - o.Id = all.Id - o.Name = all.Name - o.Uuid = all.Uuid - return nil -} diff --git a/api/v2/datadog/model_service_account_create_attributes.go b/api/v2/datadog/model_service_account_create_attributes.go deleted file mode 100644 index 793547816ba..00000000000 --- a/api/v2/datadog/model_service_account_create_attributes.go +++ /dev/null @@ -1,214 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceAccountCreateAttributes Attributes of the created user. -type ServiceAccountCreateAttributes struct { - // The email of the user. - Email string `json:"email"` - // The name of the user. - Name *string `json:"name,omitempty"` - // Whether the user is a service account. Must be true. - ServiceAccount bool `json:"service_account"` - // The title of the user. - Title *string `json:"title,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{} -} - -// NewServiceAccountCreateAttributes instantiates a new ServiceAccountCreateAttributes 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 NewServiceAccountCreateAttributes(email string, serviceAccount bool) *ServiceAccountCreateAttributes { - this := ServiceAccountCreateAttributes{} - this.Email = email - this.ServiceAccount = serviceAccount - return &this -} - -// NewServiceAccountCreateAttributesWithDefaults instantiates a new ServiceAccountCreateAttributes 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 NewServiceAccountCreateAttributesWithDefaults() *ServiceAccountCreateAttributes { - this := ServiceAccountCreateAttributes{} - return &this -} - -// GetEmail returns the Email field value. -func (o *ServiceAccountCreateAttributes) GetEmail() string { - if o == nil { - var ret string - return ret - } - return o.Email -} - -// GetEmailOk returns a tuple with the Email field value -// and a boolean to check if the value has been set. -func (o *ServiceAccountCreateAttributes) GetEmailOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Email, true -} - -// SetEmail sets field value. -func (o *ServiceAccountCreateAttributes) SetEmail(v string) { - o.Email = v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *ServiceAccountCreateAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceAccountCreateAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *ServiceAccountCreateAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *ServiceAccountCreateAttributes) SetName(v string) { - o.Name = &v -} - -// GetServiceAccount returns the ServiceAccount field value. -func (o *ServiceAccountCreateAttributes) GetServiceAccount() bool { - if o == nil { - var ret bool - return ret - } - return o.ServiceAccount -} - -// GetServiceAccountOk returns a tuple with the ServiceAccount field value -// and a boolean to check if the value has been set. -func (o *ServiceAccountCreateAttributes) GetServiceAccountOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.ServiceAccount, true -} - -// SetServiceAccount sets field value. -func (o *ServiceAccountCreateAttributes) SetServiceAccount(v bool) { - o.ServiceAccount = v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *ServiceAccountCreateAttributes) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceAccountCreateAttributes) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *ServiceAccountCreateAttributes) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *ServiceAccountCreateAttributes) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceAccountCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["email"] = o.Email - if o.Name != nil { - toSerialize["name"] = o.Name - } - toSerialize["service_account"] = o.ServiceAccount - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceAccountCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Email *string `json:"email"` - ServiceAccount *bool `json:"service_account"` - }{} - all := struct { - Email string `json:"email"` - Name *string `json:"name,omitempty"` - ServiceAccount bool `json:"service_account"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Email == nil { - return fmt.Errorf("Required field email missing") - } - if required.ServiceAccount == nil { - return fmt.Errorf("Required field service_account missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Email = all.Email - o.Name = all.Name - o.ServiceAccount = all.ServiceAccount - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_service_account_create_data.go b/api/v2/datadog/model_service_account_create_data.go deleted file mode 100644 index 9f966329de4..00000000000 --- a/api/v2/datadog/model_service_account_create_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceAccountCreateData Object to create a service account User. -type ServiceAccountCreateData struct { - // Attributes of the created user. - Attributes ServiceAccountCreateAttributes `json:"attributes"` - // Relationships of the user object. - Relationships *UserRelationships `json:"relationships,omitempty"` - // Users resource type. - Type UsersType `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{} -} - -// NewServiceAccountCreateData instantiates a new ServiceAccountCreateData 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 NewServiceAccountCreateData(attributes ServiceAccountCreateAttributes, typeVar UsersType) *ServiceAccountCreateData { - this := ServiceAccountCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewServiceAccountCreateDataWithDefaults instantiates a new ServiceAccountCreateData 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 NewServiceAccountCreateDataWithDefaults() *ServiceAccountCreateData { - this := ServiceAccountCreateData{} - var typeVar UsersType = USERSTYPE_USERS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *ServiceAccountCreateData) GetAttributes() ServiceAccountCreateAttributes { - if o == nil { - var ret ServiceAccountCreateAttributes - 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 *ServiceAccountCreateData) GetAttributesOk() (*ServiceAccountCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *ServiceAccountCreateData) SetAttributes(v ServiceAccountCreateAttributes) { - o.Attributes = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *ServiceAccountCreateData) GetRelationships() UserRelationships { - if o == nil || o.Relationships == nil { - var ret UserRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceAccountCreateData) GetRelationshipsOk() (*UserRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *ServiceAccountCreateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given UserRelationships and assigns it to the Relationships field. -func (o *ServiceAccountCreateData) SetRelationships(v UserRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *ServiceAccountCreateData) GetType() UsersType { - if o == nil { - var ret UsersType - 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 *ServiceAccountCreateData) GetTypeOk() (*UsersType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ServiceAccountCreateData) SetType(v UsersType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceAccountCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *ServiceAccountCreateAttributes `json:"attributes"` - Type *UsersType `json:"type"` - }{} - all := struct { - Attributes ServiceAccountCreateAttributes `json:"attributes"` - Relationships *UserRelationships `json:"relationships,omitempty"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_service_account_create_request.go b/api/v2/datadog/model_service_account_create_request.go deleted file mode 100644 index d113f08eca5..00000000000 --- a/api/v2/datadog/model_service_account_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// ServiceAccountCreateRequest Create a service account. -type ServiceAccountCreateRequest struct { - // Object to create a service account User. - Data ServiceAccountCreateData `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{} -} - -// NewServiceAccountCreateRequest instantiates a new ServiceAccountCreateRequest 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 NewServiceAccountCreateRequest(data ServiceAccountCreateData) *ServiceAccountCreateRequest { - this := ServiceAccountCreateRequest{} - this.Data = data - return &this -} - -// NewServiceAccountCreateRequestWithDefaults instantiates a new ServiceAccountCreateRequest 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 NewServiceAccountCreateRequestWithDefaults() *ServiceAccountCreateRequest { - this := ServiceAccountCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *ServiceAccountCreateRequest) GetData() ServiceAccountCreateData { - if o == nil { - var ret ServiceAccountCreateData - 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 *ServiceAccountCreateRequest) GetDataOk() (*ServiceAccountCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *ServiceAccountCreateRequest) SetData(v ServiceAccountCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceAccountCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *ServiceAccountCreateData `json:"data"` - }{} - all := struct { - Data ServiceAccountCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_usage_application_security_monitoring_response.go b/api/v2/datadog/model_usage_application_security_monitoring_response.go deleted file mode 100644 index cf96900fef1..00000000000 --- a/api/v2/datadog/model_usage_application_security_monitoring_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageApplicationSecurityMonitoringResponse Application Security Monitoring usage response. -type UsageApplicationSecurityMonitoringResponse struct { - // Response containing Application Security Monitoring usage. - Data []UsageDataObject `json:"data,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{} -} - -// NewUsageApplicationSecurityMonitoringResponse instantiates a new UsageApplicationSecurityMonitoringResponse 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 NewUsageApplicationSecurityMonitoringResponse() *UsageApplicationSecurityMonitoringResponse { - this := UsageApplicationSecurityMonitoringResponse{} - return &this -} - -// NewUsageApplicationSecurityMonitoringResponseWithDefaults instantiates a new UsageApplicationSecurityMonitoringResponse 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 NewUsageApplicationSecurityMonitoringResponseWithDefaults() *UsageApplicationSecurityMonitoringResponse { - this := UsageApplicationSecurityMonitoringResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UsageApplicationSecurityMonitoringResponse) GetData() []UsageDataObject { - if o == nil || o.Data == nil { - var ret []UsageDataObject - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageApplicationSecurityMonitoringResponse) GetDataOk() (*[]UsageDataObject, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UsageApplicationSecurityMonitoringResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []UsageDataObject and assigns it to the Data field. -func (o *UsageApplicationSecurityMonitoringResponse) SetData(v []UsageDataObject) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageApplicationSecurityMonitoringResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageApplicationSecurityMonitoringResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []UsageDataObject `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_usage_attributes_object.go b/api/v2/datadog/model_usage_attributes_object.go deleted file mode 100644 index 8c5c86aba91..00000000000 --- a/api/v2/datadog/model_usage_attributes_object.go +++ /dev/null @@ -1,266 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageAttributesObject Usage attributes data. -type UsageAttributesObject struct { - // The organization name. - OrgName *string `json:"org_name,omitempty"` - // The product for which usage is being reported. - ProductFamily *string `json:"product_family,omitempty"` - // The organization public ID. - PublicId *string `json:"public_id,omitempty"` - // List of usage data reported for each requested hour. - Timeseries []UsageTimeSeriesObject `json:"timeseries,omitempty"` - // Usage type that is being measured. - UsageType *HourlyUsageType `json:"usage_type,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{} -} - -// NewUsageAttributesObject instantiates a new UsageAttributesObject 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 NewUsageAttributesObject() *UsageAttributesObject { - this := UsageAttributesObject{} - return &this -} - -// NewUsageAttributesObjectWithDefaults instantiates a new UsageAttributesObject 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 NewUsageAttributesObjectWithDefaults() *UsageAttributesObject { - this := UsageAttributesObject{} - return &this -} - -// GetOrgName returns the OrgName field value if set, zero value otherwise. -func (o *UsageAttributesObject) GetOrgName() string { - if o == nil || o.OrgName == nil { - var ret string - return ret - } - return *o.OrgName -} - -// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributesObject) GetOrgNameOk() (*string, bool) { - if o == nil || o.OrgName == nil { - return nil, false - } - return o.OrgName, true -} - -// HasOrgName returns a boolean if a field has been set. -func (o *UsageAttributesObject) HasOrgName() bool { - if o != nil && o.OrgName != nil { - return true - } - - return false -} - -// SetOrgName gets a reference to the given string and assigns it to the OrgName field. -func (o *UsageAttributesObject) SetOrgName(v string) { - o.OrgName = &v -} - -// GetProductFamily returns the ProductFamily field value if set, zero value otherwise. -func (o *UsageAttributesObject) GetProductFamily() string { - if o == nil || o.ProductFamily == nil { - var ret string - return ret - } - return *o.ProductFamily -} - -// GetProductFamilyOk returns a tuple with the ProductFamily field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributesObject) GetProductFamilyOk() (*string, bool) { - if o == nil || o.ProductFamily == nil { - return nil, false - } - return o.ProductFamily, true -} - -// HasProductFamily returns a boolean if a field has been set. -func (o *UsageAttributesObject) HasProductFamily() bool { - if o != nil && o.ProductFamily != nil { - return true - } - - return false -} - -// SetProductFamily gets a reference to the given string and assigns it to the ProductFamily field. -func (o *UsageAttributesObject) SetProductFamily(v string) { - o.ProductFamily = &v -} - -// GetPublicId returns the PublicId field value if set, zero value otherwise. -func (o *UsageAttributesObject) GetPublicId() string { - if o == nil || o.PublicId == nil { - var ret string - return ret - } - return *o.PublicId -} - -// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributesObject) GetPublicIdOk() (*string, bool) { - if o == nil || o.PublicId == nil { - return nil, false - } - return o.PublicId, true -} - -// HasPublicId returns a boolean if a field has been set. -func (o *UsageAttributesObject) HasPublicId() bool { - if o != nil && o.PublicId != nil { - return true - } - - return false -} - -// SetPublicId gets a reference to the given string and assigns it to the PublicId field. -func (o *UsageAttributesObject) SetPublicId(v string) { - o.PublicId = &v -} - -// GetTimeseries returns the Timeseries field value if set, zero value otherwise. -func (o *UsageAttributesObject) GetTimeseries() []UsageTimeSeriesObject { - if o == nil || o.Timeseries == nil { - var ret []UsageTimeSeriesObject - return ret - } - return o.Timeseries -} - -// GetTimeseriesOk returns a tuple with the Timeseries field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributesObject) GetTimeseriesOk() (*[]UsageTimeSeriesObject, bool) { - if o == nil || o.Timeseries == nil { - return nil, false - } - return &o.Timeseries, true -} - -// HasTimeseries returns a boolean if a field has been set. -func (o *UsageAttributesObject) HasTimeseries() bool { - if o != nil && o.Timeseries != nil { - return true - } - - return false -} - -// SetTimeseries gets a reference to the given []UsageTimeSeriesObject and assigns it to the Timeseries field. -func (o *UsageAttributesObject) SetTimeseries(v []UsageTimeSeriesObject) { - o.Timeseries = v -} - -// GetUsageType returns the UsageType field value if set, zero value otherwise. -func (o *UsageAttributesObject) GetUsageType() HourlyUsageType { - if o == nil || o.UsageType == nil { - var ret HourlyUsageType - return ret - } - return *o.UsageType -} - -// GetUsageTypeOk returns a tuple with the UsageType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageAttributesObject) GetUsageTypeOk() (*HourlyUsageType, bool) { - if o == nil || o.UsageType == nil { - return nil, false - } - return o.UsageType, true -} - -// HasUsageType returns a boolean if a field has been set. -func (o *UsageAttributesObject) HasUsageType() bool { - if o != nil && o.UsageType != nil { - return true - } - - return false -} - -// SetUsageType gets a reference to the given HourlyUsageType and assigns it to the UsageType field. -func (o *UsageAttributesObject) SetUsageType(v HourlyUsageType) { - o.UsageType = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageAttributesObject) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.OrgName != nil { - toSerialize["org_name"] = o.OrgName - } - if o.ProductFamily != nil { - toSerialize["product_family"] = o.ProductFamily - } - if o.PublicId != nil { - toSerialize["public_id"] = o.PublicId - } - if o.Timeseries != nil { - toSerialize["timeseries"] = o.Timeseries - } - if o.UsageType != nil { - toSerialize["usage_type"] = o.UsageType - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageAttributesObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - OrgName *string `json:"org_name,omitempty"` - ProductFamily *string `json:"product_family,omitempty"` - PublicId *string `json:"public_id,omitempty"` - Timeseries []UsageTimeSeriesObject `json:"timeseries,omitempty"` - UsageType *HourlyUsageType `json:"usage_type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.UsageType; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.OrgName = all.OrgName - o.ProductFamily = all.ProductFamily - o.PublicId = all.PublicId - o.Timeseries = all.Timeseries - o.UsageType = all.UsageType - return nil -} diff --git a/api/v2/datadog/model_usage_data_object.go b/api/v2/datadog/model_usage_data_object.go deleted file mode 100644 index 631eb949d6d..00000000000 --- a/api/v2/datadog/model_usage_data_object.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageDataObject Usage data. -type UsageDataObject struct { - // Usage attributes data. - Attributes *UsageAttributesObject `json:"attributes,omitempty"` - // Unique ID of the response. - Id *string `json:"id,omitempty"` - // Type of usage data. - Type *UsageTimeSeriesType `json:"type,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{} -} - -// NewUsageDataObject instantiates a new UsageDataObject 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 NewUsageDataObject() *UsageDataObject { - this := UsageDataObject{} - var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES - this.Type = &typeVar - return &this -} - -// NewUsageDataObjectWithDefaults instantiates a new UsageDataObject 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 NewUsageDataObjectWithDefaults() *UsageDataObject { - this := UsageDataObject{} - var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *UsageDataObject) GetAttributes() UsageAttributesObject { - if o == nil || o.Attributes == nil { - var ret UsageAttributesObject - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDataObject) GetAttributesOk() (*UsageAttributesObject, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *UsageDataObject) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given UsageAttributesObject and assigns it to the Attributes field. -func (o *UsageDataObject) SetAttributes(v UsageAttributesObject) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *UsageDataObject) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDataObject) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *UsageDataObject) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *UsageDataObject) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *UsageDataObject) GetType() UsageTimeSeriesType { - if o == nil || o.Type == nil { - var ret UsageTimeSeriesType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageDataObject) GetTypeOk() (*UsageTimeSeriesType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *UsageDataObject) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given UsageTimeSeriesType and assigns it to the Type field. -func (o *UsageDataObject) SetType(v UsageTimeSeriesType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageDataObject) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageDataObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *UsageAttributesObject `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *UsageTimeSeriesType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_usage_lambda_traced_invocations_response.go b/api/v2/datadog/model_usage_lambda_traced_invocations_response.go deleted file mode 100644 index 9bfb7eea4c3..00000000000 --- a/api/v2/datadog/model_usage_lambda_traced_invocations_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageLambdaTracedInvocationsResponse Lambda Traced Invocations usage response. -type UsageLambdaTracedInvocationsResponse struct { - // Response containing Lambda Traced Invocations usage. - Data []UsageDataObject `json:"data,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{} -} - -// NewUsageLambdaTracedInvocationsResponse instantiates a new UsageLambdaTracedInvocationsResponse 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 NewUsageLambdaTracedInvocationsResponse() *UsageLambdaTracedInvocationsResponse { - this := UsageLambdaTracedInvocationsResponse{} - return &this -} - -// NewUsageLambdaTracedInvocationsResponseWithDefaults instantiates a new UsageLambdaTracedInvocationsResponse 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 NewUsageLambdaTracedInvocationsResponseWithDefaults() *UsageLambdaTracedInvocationsResponse { - this := UsageLambdaTracedInvocationsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UsageLambdaTracedInvocationsResponse) GetData() []UsageDataObject { - if o == nil || o.Data == nil { - var ret []UsageDataObject - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageLambdaTracedInvocationsResponse) GetDataOk() (*[]UsageDataObject, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UsageLambdaTracedInvocationsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []UsageDataObject and assigns it to the Data field. -func (o *UsageLambdaTracedInvocationsResponse) SetData(v []UsageDataObject) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageLambdaTracedInvocationsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageLambdaTracedInvocationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []UsageDataObject `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_usage_observability_pipelines_response.go b/api/v2/datadog/model_usage_observability_pipelines_response.go deleted file mode 100644 index 268c64a172c..00000000000 --- a/api/v2/datadog/model_usage_observability_pipelines_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsageObservabilityPipelinesResponse Observability Pipelines usage response. -type UsageObservabilityPipelinesResponse struct { - // Response containing Observability Pipelines usage. - Data []UsageDataObject `json:"data,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{} -} - -// NewUsageObservabilityPipelinesResponse instantiates a new UsageObservabilityPipelinesResponse 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 NewUsageObservabilityPipelinesResponse() *UsageObservabilityPipelinesResponse { - this := UsageObservabilityPipelinesResponse{} - return &this -} - -// NewUsageObservabilityPipelinesResponseWithDefaults instantiates a new UsageObservabilityPipelinesResponse 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 NewUsageObservabilityPipelinesResponseWithDefaults() *UsageObservabilityPipelinesResponse { - this := UsageObservabilityPipelinesResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UsageObservabilityPipelinesResponse) GetData() []UsageDataObject { - if o == nil || o.Data == nil { - var ret []UsageDataObject - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageObservabilityPipelinesResponse) GetDataOk() (*[]UsageDataObject, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UsageObservabilityPipelinesResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []UsageDataObject and assigns it to the Data field. -func (o *UsageObservabilityPipelinesResponse) SetData(v []UsageDataObject) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageObservabilityPipelinesResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageObservabilityPipelinesResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []UsageDataObject `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_usage_time_series_object.go b/api/v2/datadog/model_usage_time_series_object.go deleted file mode 100644 index 97c3d25ea57..00000000000 --- a/api/v2/datadog/model_usage_time_series_object.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UsageTimeSeriesObject Usage timeseries data. -type UsageTimeSeriesObject struct { - // Datetime in ISO-8601 format, UTC. The hour for the usage. - Timestamp *time.Time `json:"timestamp,omitempty"` - // Contains the number measured for the given usage_type during the hour. - Value common.NullableInt64 `json:"value,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{} -} - -// NewUsageTimeSeriesObject instantiates a new UsageTimeSeriesObject 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 NewUsageTimeSeriesObject() *UsageTimeSeriesObject { - this := UsageTimeSeriesObject{} - return &this -} - -// NewUsageTimeSeriesObjectWithDefaults instantiates a new UsageTimeSeriesObject 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 NewUsageTimeSeriesObjectWithDefaults() *UsageTimeSeriesObject { - this := UsageTimeSeriesObject{} - return &this -} - -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. -func (o *UsageTimeSeriesObject) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { - var ret time.Time - return ret - } - return *o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsageTimeSeriesObject) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { - return nil, false - } - return o.Timestamp, true -} - -// HasTimestamp returns a boolean if a field has been set. -func (o *UsageTimeSeriesObject) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. -func (o *UsageTimeSeriesObject) SetTimestamp(v time.Time) { - o.Timestamp = &v -} - -// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UsageTimeSeriesObject) GetValue() int64 { - if o == nil || o.Value.Get() == nil { - var ret int64 - return ret - } - return *o.Value.Get() -} - -// GetValueOk returns a tuple with the Value 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 *UsageTimeSeriesObject) GetValueOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Value.Get(), o.Value.IsSet() -} - -// HasValue returns a boolean if a field has been set. -func (o *UsageTimeSeriesObject) HasValue() bool { - if o != nil && o.Value.IsSet() { - return true - } - - return false -} - -// SetValue gets a reference to the given common.NullableInt64 and assigns it to the Value field. -func (o *UsageTimeSeriesObject) SetValue(v int64) { - o.Value.Set(&v) -} - -// SetValueNil sets the value for Value to be an explicit nil. -func (o *UsageTimeSeriesObject) SetValueNil() { - o.Value.Set(nil) -} - -// UnsetValue ensures that no value is present for Value, not even an explicit nil. -func (o *UsageTimeSeriesObject) UnsetValue() { - o.Value.Unset() -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsageTimeSeriesObject) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Timestamp != nil { - if o.Timestamp.Nanosecond() == 0 { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Value.IsSet() { - toSerialize["value"] = o.Value.Get() - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsageTimeSeriesObject) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Timestamp *time.Time `json:"timestamp,omitempty"` - Value common.NullableInt64 `json:"value,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Timestamp = all.Timestamp - o.Value = all.Value - return nil -} diff --git a/api/v2/datadog/model_usage_time_series_type.go b/api/v2/datadog/model_usage_time_series_type.go deleted file mode 100644 index 92f08bf663c..00000000000 --- a/api/v2/datadog/model_usage_time_series_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsageTimeSeriesType Type of usage data. -type UsageTimeSeriesType string - -// List of UsageTimeSeriesType. -const ( - USAGETIMESERIESTYPE_USAGE_TIMESERIES UsageTimeSeriesType = "usage_timeseries" -) - -var allowedUsageTimeSeriesTypeEnumValues = []UsageTimeSeriesType{ - USAGETIMESERIESTYPE_USAGE_TIMESERIES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsageTimeSeriesType) GetAllowedValues() []UsageTimeSeriesType { - return allowedUsageTimeSeriesTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsageTimeSeriesType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsageTimeSeriesType(value) - return nil -} - -// NewUsageTimeSeriesTypeFromValue returns a pointer to a valid UsageTimeSeriesType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsageTimeSeriesTypeFromValue(v string) (*UsageTimeSeriesType, error) { - ev := UsageTimeSeriesType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsageTimeSeriesType: valid values are %v", v, allowedUsageTimeSeriesTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsageTimeSeriesType) IsValid() bool { - for _, existing := range allowedUsageTimeSeriesTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsageTimeSeriesType value. -func (v UsageTimeSeriesType) Ptr() *UsageTimeSeriesType { - return &v -} - -// NullableUsageTimeSeriesType handles when a null is used for UsageTimeSeriesType. -type NullableUsageTimeSeriesType struct { - value *UsageTimeSeriesType - isSet bool -} - -// Get returns the associated value. -func (v NullableUsageTimeSeriesType) Get() *UsageTimeSeriesType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsageTimeSeriesType) Set(val *UsageTimeSeriesType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsageTimeSeriesType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsageTimeSeriesType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsageTimeSeriesType initializes the struct as if Set has been called. -func NewNullableUsageTimeSeriesType(val *UsageTimeSeriesType) *NullableUsageTimeSeriesType { - return &NullableUsageTimeSeriesType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsageTimeSeriesType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsageTimeSeriesType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_user.go b/api/v2/datadog/model_user.go deleted file mode 100644 index 5fb9287a00b..00000000000 --- a/api/v2/datadog/model_user.go +++ /dev/null @@ -1,245 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// User User object returned by the API. -type User struct { - // Attributes of user object returned by the API. - Attributes *UserAttributes `json:"attributes,omitempty"` - // ID of the user. - Id *string `json:"id,omitempty"` - // Relationships of the user object returned by the API. - Relationships *UserResponseRelationships `json:"relationships,omitempty"` - // Users resource type. - Type *UsersType `json:"type,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{} -} - -// NewUser instantiates a new User 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 NewUser() *User { - this := User{} - var typeVar UsersType = USERSTYPE_USERS - this.Type = &typeVar - return &this -} - -// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User { - this := User{} - var typeVar UsersType = USERSTYPE_USERS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *User) GetAttributes() UserAttributes { - if o == nil || o.Attributes == nil { - var ret UserAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetAttributesOk() (*UserAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *User) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given UserAttributes and assigns it to the Attributes field. -func (o *User) SetAttributes(v UserAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *User) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *User) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *User) SetId(v string) { - o.Id = &v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *User) GetRelationships() UserResponseRelationships { - if o == nil || o.Relationships == nil { - var ret UserResponseRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetRelationshipsOk() (*UserResponseRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *User) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given UserResponseRelationships and assigns it to the Relationships field. -func (o *User) SetRelationships(v UserResponseRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *User) GetType() UsersType { - if o == nil || o.Type == nil { - var ret UsersType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetTypeOk() (*UsersType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *User) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given UsersType and assigns it to the Type field. -func (o *User) SetType(v UsersType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o User) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *User) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *UserAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Relationships *UserResponseRelationships `json:"relationships,omitempty"` - Type *UsersType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_user_attributes.go b/api/v2/datadog/model_user_attributes.go deleted file mode 100644 index 899e3db6cd6..00000000000 --- a/api/v2/datadog/model_user_attributes.go +++ /dev/null @@ -1,525 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" - - "github.com/DataDog/datadog-api-client-go/v2/api/common" -) - -// UserAttributes Attributes of user object returned by the API. -type UserAttributes struct { - // Creation time of the user. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Whether the user is disabled. - Disabled *bool `json:"disabled,omitempty"` - // Email of the user. - Email *string `json:"email,omitempty"` - // Handle of the user. - Handle *string `json:"handle,omitempty"` - // URL of the user's icon. - Icon *string `json:"icon,omitempty"` - // Time that the user was last modified. - ModifiedAt *time.Time `json:"modified_at,omitempty"` - // Name of the user. - Name common.NullableString `json:"name,omitempty"` - // Whether the user is a service account. - ServiceAccount *bool `json:"service_account,omitempty"` - // Status of the user. - Status *string `json:"status,omitempty"` - // Title of the user. - Title common.NullableString `json:"title,omitempty"` - // Whether the user is verified. - Verified *bool `json:"verified,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{} -} - -// NewUserAttributes instantiates a new UserAttributes 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 NewUserAttributes() *UserAttributes { - this := UserAttributes{} - return &this -} - -// NewUserAttributesWithDefaults instantiates a new UserAttributes 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 NewUserAttributesWithDefaults() *UserAttributes { - this := UserAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *UserAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *UserAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *UserAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetDisabled returns the Disabled field value if set, zero value otherwise. -func (o *UserAttributes) GetDisabled() bool { - if o == nil || o.Disabled == nil { - var ret bool - return ret - } - return *o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetDisabledOk() (*bool, bool) { - if o == nil || o.Disabled == nil { - return nil, false - } - return o.Disabled, true -} - -// HasDisabled returns a boolean if a field has been set. -func (o *UserAttributes) HasDisabled() bool { - if o != nil && o.Disabled != nil { - return true - } - - return false -} - -// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. -func (o *UserAttributes) SetDisabled(v bool) { - o.Disabled = &v -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *UserAttributes) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *UserAttributes) HasEmail() bool { - if o != nil && o.Email != nil { - return true - } - - return false -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *UserAttributes) SetEmail(v string) { - o.Email = &v -} - -// GetHandle returns the Handle field value if set, zero value otherwise. -func (o *UserAttributes) GetHandle() string { - if o == nil || o.Handle == nil { - var ret string - return ret - } - return *o.Handle -} - -// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetHandleOk() (*string, bool) { - if o == nil || o.Handle == nil { - return nil, false - } - return o.Handle, true -} - -// HasHandle returns a boolean if a field has been set. -func (o *UserAttributes) HasHandle() bool { - if o != nil && o.Handle != nil { - return true - } - - return false -} - -// SetHandle gets a reference to the given string and assigns it to the Handle field. -func (o *UserAttributes) SetHandle(v string) { - o.Handle = &v -} - -// GetIcon returns the Icon field value if set, zero value otherwise. -func (o *UserAttributes) GetIcon() string { - if o == nil || o.Icon == nil { - var ret string - return ret - } - return *o.Icon -} - -// GetIconOk returns a tuple with the Icon field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetIconOk() (*string, bool) { - if o == nil || o.Icon == nil { - return nil, false - } - return o.Icon, true -} - -// HasIcon returns a boolean if a field has been set. -func (o *UserAttributes) HasIcon() bool { - if o != nil && o.Icon != nil { - return true - } - - return false -} - -// SetIcon gets a reference to the given string and assigns it to the Icon field. -func (o *UserAttributes) SetIcon(v string) { - o.Icon = &v -} - -// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. -func (o *UserAttributes) GetModifiedAt() time.Time { - if o == nil || o.ModifiedAt == nil { - var ret time.Time - return ret - } - return *o.ModifiedAt -} - -// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetModifiedAtOk() (*time.Time, bool) { - if o == nil || o.ModifiedAt == nil { - return nil, false - } - return o.ModifiedAt, true -} - -// HasModifiedAt returns a boolean if a field has been set. -func (o *UserAttributes) HasModifiedAt() bool { - if o != nil && o.ModifiedAt != nil { - return true - } - - return false -} - -// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. -func (o *UserAttributes) SetModifiedAt(v time.Time) { - o.ModifiedAt = &v -} - -// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UserAttributes) GetName() string { - if o == nil || o.Name.Get() == nil { - var ret string - return ret - } - return *o.Name.Get() -} - -// GetNameOk returns a tuple with the Name 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 *UserAttributes) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name.Get(), o.Name.IsSet() -} - -// HasName returns a boolean if a field has been set. -func (o *UserAttributes) HasName() bool { - if o != nil && o.Name.IsSet() { - return true - } - - return false -} - -// SetName gets a reference to the given common.NullableString and assigns it to the Name field. -func (o *UserAttributes) SetName(v string) { - o.Name.Set(&v) -} - -// SetNameNil sets the value for Name to be an explicit nil. -func (o *UserAttributes) SetNameNil() { - o.Name.Set(nil) -} - -// UnsetName ensures that no value is present for Name, not even an explicit nil. -func (o *UserAttributes) UnsetName() { - o.Name.Unset() -} - -// GetServiceAccount returns the ServiceAccount field value if set, zero value otherwise. -func (o *UserAttributes) GetServiceAccount() bool { - if o == nil || o.ServiceAccount == nil { - var ret bool - return ret - } - return *o.ServiceAccount -} - -// GetServiceAccountOk returns a tuple with the ServiceAccount field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetServiceAccountOk() (*bool, bool) { - if o == nil || o.ServiceAccount == nil { - return nil, false - } - return o.ServiceAccount, true -} - -// HasServiceAccount returns a boolean if a field has been set. -func (o *UserAttributes) HasServiceAccount() bool { - if o != nil && o.ServiceAccount != nil { - return true - } - - return false -} - -// SetServiceAccount gets a reference to the given bool and assigns it to the ServiceAccount field. -func (o *UserAttributes) SetServiceAccount(v bool) { - o.ServiceAccount = &v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *UserAttributes) GetStatus() string { - if o == nil || o.Status == nil { - var ret string - return ret - } - return *o.Status -} - -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetStatusOk() (*string, bool) { - if o == nil || o.Status == nil { - return nil, false - } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *UserAttributes) HasStatus() bool { - if o != nil && o.Status != nil { - return true - } - - return false -} - -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *UserAttributes) SetStatus(v string) { - o.Status = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UserAttributes) GetTitle() string { - if o == nil || o.Title.Get() == nil { - var ret string - return ret - } - return *o.Title.Get() -} - -// GetTitleOk returns a tuple with the Title 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 *UserAttributes) GetTitleOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Title.Get(), o.Title.IsSet() -} - -// HasTitle returns a boolean if a field has been set. -func (o *UserAttributes) HasTitle() bool { - if o != nil && o.Title.IsSet() { - return true - } - - return false -} - -// SetTitle gets a reference to the given common.NullableString and assigns it to the Title field. -func (o *UserAttributes) SetTitle(v string) { - o.Title.Set(&v) -} - -// SetTitleNil sets the value for Title to be an explicit nil. -func (o *UserAttributes) SetTitleNil() { - o.Title.Set(nil) -} - -// UnsetTitle ensures that no value is present for Title, not even an explicit nil. -func (o *UserAttributes) UnsetTitle() { - o.Title.Unset() -} - -// GetVerified returns the Verified field value if set, zero value otherwise. -func (o *UserAttributes) GetVerified() bool { - if o == nil || o.Verified == nil { - var ret bool - return ret - } - return *o.Verified -} - -// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserAttributes) GetVerifiedOk() (*bool, bool) { - if o == nil || o.Verified == nil { - return nil, false - } - return o.Verified, true -} - -// HasVerified returns a boolean if a field has been set. -func (o *UserAttributes) HasVerified() bool { - if o != nil && o.Verified != nil { - return true - } - - return false -} - -// SetVerified gets a reference to the given bool and assigns it to the Verified field. -func (o *UserAttributes) SetVerified(v bool) { - o.Verified = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Disabled != nil { - toSerialize["disabled"] = o.Disabled - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Handle != nil { - toSerialize["handle"] = o.Handle - } - if o.Icon != nil { - toSerialize["icon"] = o.Icon - } - if o.ModifiedAt != nil { - if o.ModifiedAt.Nanosecond() == 0 { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.Name.IsSet() { - toSerialize["name"] = o.Name.Get() - } - if o.ServiceAccount != nil { - toSerialize["service_account"] = o.ServiceAccount - } - if o.Status != nil { - toSerialize["status"] = o.Status - } - if o.Title.IsSet() { - toSerialize["title"] = o.Title.Get() - } - if o.Verified != nil { - toSerialize["verified"] = o.Verified - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - Email *string `json:"email,omitempty"` - Handle *string `json:"handle,omitempty"` - Icon *string `json:"icon,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name common.NullableString `json:"name,omitempty"` - ServiceAccount *bool `json:"service_account,omitempty"` - Status *string `json:"status,omitempty"` - Title common.NullableString `json:"title,omitempty"` - Verified *bool `json:"verified,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.Disabled = all.Disabled - o.Email = all.Email - o.Handle = all.Handle - o.Icon = all.Icon - o.ModifiedAt = all.ModifiedAt - o.Name = all.Name - o.ServiceAccount = all.ServiceAccount - o.Status = all.Status - o.Title = all.Title - o.Verified = all.Verified - return nil -} diff --git a/api/v2/datadog/model_user_create_attributes.go b/api/v2/datadog/model_user_create_attributes.go deleted file mode 100644 index f0a225065eb..00000000000 --- a/api/v2/datadog/model_user_create_attributes.go +++ /dev/null @@ -1,181 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserCreateAttributes Attributes of the created user. -type UserCreateAttributes struct { - // The email of the user. - Email string `json:"email"` - // The name of the user. - Name *string `json:"name,omitempty"` - // The title of the user. - Title *string `json:"title,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{} -} - -// NewUserCreateAttributes instantiates a new UserCreateAttributes 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 NewUserCreateAttributes(email string) *UserCreateAttributes { - this := UserCreateAttributes{} - this.Email = email - return &this -} - -// NewUserCreateAttributesWithDefaults instantiates a new UserCreateAttributes 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 NewUserCreateAttributesWithDefaults() *UserCreateAttributes { - this := UserCreateAttributes{} - return &this -} - -// GetEmail returns the Email field value. -func (o *UserCreateAttributes) GetEmail() string { - if o == nil { - var ret string - return ret - } - return o.Email -} - -// GetEmailOk returns a tuple with the Email field value -// and a boolean to check if the value has been set. -func (o *UserCreateAttributes) GetEmailOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Email, true -} - -// SetEmail sets field value. -func (o *UserCreateAttributes) SetEmail(v string) { - o.Email = v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *UserCreateAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserCreateAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *UserCreateAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *UserCreateAttributes) SetName(v string) { - o.Name = &v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *UserCreateAttributes) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserCreateAttributes) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *UserCreateAttributes) HasTitle() bool { - if o != nil && o.Title != nil { - return true - } - - return false -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *UserCreateAttributes) SetTitle(v string) { - o.Title = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["email"] = o.Email - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.Title != nil { - toSerialize["title"] = o.Title - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Email *string `json:"email"` - }{} - all := struct { - Email string `json:"email"` - Name *string `json:"name,omitempty"` - Title *string `json:"title,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Email == nil { - return fmt.Errorf("Required field email missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Email = all.Email - o.Name = all.Name - o.Title = all.Title - return nil -} diff --git a/api/v2/datadog/model_user_create_data.go b/api/v2/datadog/model_user_create_data.go deleted file mode 100644 index cf9299d8998..00000000000 --- a/api/v2/datadog/model_user_create_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserCreateData Object to create a user. -type UserCreateData struct { - // Attributes of the created user. - Attributes UserCreateAttributes `json:"attributes"` - // Relationships of the user object. - Relationships *UserRelationships `json:"relationships,omitempty"` - // Users resource type. - Type UsersType `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{} -} - -// NewUserCreateData instantiates a new UserCreateData 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 NewUserCreateData(attributes UserCreateAttributes, typeVar UsersType) *UserCreateData { - this := UserCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewUserCreateDataWithDefaults instantiates a new UserCreateData 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 NewUserCreateDataWithDefaults() *UserCreateData { - this := UserCreateData{} - var typeVar UsersType = USERSTYPE_USERS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *UserCreateData) GetAttributes() UserCreateAttributes { - if o == nil { - var ret UserCreateAttributes - 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 *UserCreateData) GetAttributesOk() (*UserCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *UserCreateData) SetAttributes(v UserCreateAttributes) { - o.Attributes = v -} - -// GetRelationships returns the Relationships field value if set, zero value otherwise. -func (o *UserCreateData) GetRelationships() UserRelationships { - if o == nil || o.Relationships == nil { - var ret UserRelationships - return ret - } - return *o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserCreateData) GetRelationshipsOk() (*UserRelationships, bool) { - if o == nil || o.Relationships == nil { - return nil, false - } - return o.Relationships, true -} - -// HasRelationships returns a boolean if a field has been set. -func (o *UserCreateData) HasRelationships() bool { - if o != nil && o.Relationships != nil { - return true - } - - return false -} - -// SetRelationships gets a reference to the given UserRelationships and assigns it to the Relationships field. -func (o *UserCreateData) SetRelationships(v UserRelationships) { - o.Relationships = &v -} - -// GetType returns the Type field value. -func (o *UserCreateData) GetType() UsersType { - if o == nil { - var ret UsersType - 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 *UserCreateData) GetTypeOk() (*UsersType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *UserCreateData) SetType(v UsersType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - if o.Relationships != nil { - toSerialize["relationships"] = o.Relationships - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *UserCreateAttributes `json:"attributes"` - Type *UsersType `json:"type"` - }{} - all := struct { - Attributes UserCreateAttributes `json:"attributes"` - Relationships *UserRelationships `json:"relationships,omitempty"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_user_create_request.go b/api/v2/datadog/model_user_create_request.go deleted file mode 100644 index 449b8a737e4..00000000000 --- a/api/v2/datadog/model_user_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserCreateRequest Create a user. -type UserCreateRequest struct { - // Object to create a user. - Data UserCreateData `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{} -} - -// NewUserCreateRequest instantiates a new UserCreateRequest 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 NewUserCreateRequest(data UserCreateData) *UserCreateRequest { - this := UserCreateRequest{} - this.Data = data - return &this -} - -// NewUserCreateRequestWithDefaults instantiates a new UserCreateRequest 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 NewUserCreateRequestWithDefaults() *UserCreateRequest { - this := UserCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *UserCreateRequest) GetData() UserCreateData { - if o == nil { - var ret UserCreateData - 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 *UserCreateRequest) GetDataOk() (*UserCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *UserCreateRequest) SetData(v UserCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserCreateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *UserCreateData `json:"data"` - }{} - all := struct { - Data UserCreateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_user_invitation_data.go b/api/v2/datadog/model_user_invitation_data.go deleted file mode 100644 index 6c11b28ed1e..00000000000 --- a/api/v2/datadog/model_user_invitation_data.go +++ /dev/null @@ -1,153 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserInvitationData Object to create a user invitation. -type UserInvitationData struct { - // Relationships data for user invitation. - Relationships UserInvitationRelationships `json:"relationships"` - // User invitations type. - Type UserInvitationsType `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{} -} - -// NewUserInvitationData instantiates a new UserInvitationData 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 NewUserInvitationData(relationships UserInvitationRelationships, typeVar UserInvitationsType) *UserInvitationData { - this := UserInvitationData{} - this.Relationships = relationships - this.Type = typeVar - return &this -} - -// NewUserInvitationDataWithDefaults instantiates a new UserInvitationData 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 NewUserInvitationDataWithDefaults() *UserInvitationData { - this := UserInvitationData{} - var typeVar UserInvitationsType = USERINVITATIONSTYPE_USER_INVITATIONS - this.Type = typeVar - return &this -} - -// GetRelationships returns the Relationships field value. -func (o *UserInvitationData) GetRelationships() UserInvitationRelationships { - if o == nil { - var ret UserInvitationRelationships - return ret - } - return o.Relationships -} - -// GetRelationshipsOk returns a tuple with the Relationships field value -// and a boolean to check if the value has been set. -func (o *UserInvitationData) GetRelationshipsOk() (*UserInvitationRelationships, bool) { - if o == nil { - return nil, false - } - return &o.Relationships, true -} - -// SetRelationships sets field value. -func (o *UserInvitationData) SetRelationships(v UserInvitationRelationships) { - o.Relationships = v -} - -// GetType returns the Type field value. -func (o *UserInvitationData) GetType() UserInvitationsType { - if o == nil { - var ret UserInvitationsType - 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 *UserInvitationData) GetTypeOk() (*UserInvitationsType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *UserInvitationData) SetType(v UserInvitationsType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserInvitationData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["relationships"] = o.Relationships - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserInvitationData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Relationships *UserInvitationRelationships `json:"relationships"` - Type *UserInvitationsType `json:"type"` - }{} - all := struct { - Relationships UserInvitationRelationships `json:"relationships"` - Type UserInvitationsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Relationships == nil { - return fmt.Errorf("Required field relationships missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Relationships = all.Relationships - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_user_invitation_data_attributes.go b/api/v2/datadog/model_user_invitation_data_attributes.go deleted file mode 100644 index dffc281f3ff..00000000000 --- a/api/v2/datadog/model_user_invitation_data_attributes.go +++ /dev/null @@ -1,228 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "time" -) - -// UserInvitationDataAttributes Attributes of a user invitation. -type UserInvitationDataAttributes struct { - // Creation time of the user invitation. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Time of invitation expiration. - ExpiresAt *time.Time `json:"expires_at,omitempty"` - // Type of invitation. - InviteType *string `json:"invite_type,omitempty"` - // UUID of the user invitation. - Uuid *string `json:"uuid,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{} -} - -// NewUserInvitationDataAttributes instantiates a new UserInvitationDataAttributes 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 NewUserInvitationDataAttributes() *UserInvitationDataAttributes { - this := UserInvitationDataAttributes{} - return &this -} - -// NewUserInvitationDataAttributesWithDefaults instantiates a new UserInvitationDataAttributes 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 NewUserInvitationDataAttributesWithDefaults() *UserInvitationDataAttributes { - this := UserInvitationDataAttributes{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *UserInvitationDataAttributes) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { - var ret time.Time - return ret - } - return *o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationDataAttributes) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { - return nil, false - } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *UserInvitationDataAttributes) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false -} - -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *UserInvitationDataAttributes) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. -func (o *UserInvitationDataAttributes) GetExpiresAt() time.Time { - if o == nil || o.ExpiresAt == nil { - var ret time.Time - return ret - } - return *o.ExpiresAt -} - -// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationDataAttributes) GetExpiresAtOk() (*time.Time, bool) { - if o == nil || o.ExpiresAt == nil { - return nil, false - } - return o.ExpiresAt, true -} - -// HasExpiresAt returns a boolean if a field has been set. -func (o *UserInvitationDataAttributes) HasExpiresAt() bool { - if o != nil && o.ExpiresAt != nil { - return true - } - - return false -} - -// SetExpiresAt gets a reference to the given time.Time and assigns it to the ExpiresAt field. -func (o *UserInvitationDataAttributes) SetExpiresAt(v time.Time) { - o.ExpiresAt = &v -} - -// GetInviteType returns the InviteType field value if set, zero value otherwise. -func (o *UserInvitationDataAttributes) GetInviteType() string { - if o == nil || o.InviteType == nil { - var ret string - return ret - } - return *o.InviteType -} - -// GetInviteTypeOk returns a tuple with the InviteType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationDataAttributes) GetInviteTypeOk() (*string, bool) { - if o == nil || o.InviteType == nil { - return nil, false - } - return o.InviteType, true -} - -// HasInviteType returns a boolean if a field has been set. -func (o *UserInvitationDataAttributes) HasInviteType() bool { - if o != nil && o.InviteType != nil { - return true - } - - return false -} - -// SetInviteType gets a reference to the given string and assigns it to the InviteType field. -func (o *UserInvitationDataAttributes) SetInviteType(v string) { - o.InviteType = &v -} - -// GetUuid returns the Uuid field value if set, zero value otherwise. -func (o *UserInvitationDataAttributes) GetUuid() string { - if o == nil || o.Uuid == nil { - var ret string - return ret - } - return *o.Uuid -} - -// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationDataAttributes) GetUuidOk() (*string, bool) { - if o == nil || o.Uuid == nil { - return nil, false - } - return o.Uuid, true -} - -// HasUuid returns a boolean if a field has been set. -func (o *UserInvitationDataAttributes) HasUuid() bool { - if o != nil && o.Uuid != nil { - return true - } - - return false -} - -// SetUuid gets a reference to the given string and assigns it to the Uuid field. -func (o *UserInvitationDataAttributes) SetUuid(v string) { - o.Uuid = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserInvitationDataAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.ExpiresAt != nil { - if o.ExpiresAt.Nanosecond() == 0 { - toSerialize["expires_at"] = o.ExpiresAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["expires_at"] = o.ExpiresAt.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.InviteType != nil { - toSerialize["invite_type"] = o.InviteType - } - if o.Uuid != nil { - toSerialize["uuid"] = o.Uuid - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserInvitationDataAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - ExpiresAt *time.Time `json:"expires_at,omitempty"` - InviteType *string `json:"invite_type,omitempty"` - Uuid *string `json:"uuid,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.CreatedAt = all.CreatedAt - o.ExpiresAt = all.ExpiresAt - o.InviteType = all.InviteType - o.Uuid = all.Uuid - return nil -} diff --git a/api/v2/datadog/model_user_invitation_relationships.go b/api/v2/datadog/model_user_invitation_relationships.go deleted file mode 100644 index 4efc868e724..00000000000 --- a/api/v2/datadog/model_user_invitation_relationships.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserInvitationRelationships Relationships data for user invitation. -type UserInvitationRelationships struct { - // Relationship to user. - User RelationshipToUser `json:"user"` - // 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{} -} - -// NewUserInvitationRelationships instantiates a new UserInvitationRelationships 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 NewUserInvitationRelationships(user RelationshipToUser) *UserInvitationRelationships { - this := UserInvitationRelationships{} - this.User = user - return &this -} - -// NewUserInvitationRelationshipsWithDefaults instantiates a new UserInvitationRelationships 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 NewUserInvitationRelationshipsWithDefaults() *UserInvitationRelationships { - this := UserInvitationRelationships{} - return &this -} - -// GetUser returns the User field value. -func (o *UserInvitationRelationships) GetUser() RelationshipToUser { - if o == nil { - var ret RelationshipToUser - return ret - } - return o.User -} - -// GetUserOk returns a tuple with the User field value -// and a boolean to check if the value has been set. -func (o *UserInvitationRelationships) GetUserOk() (*RelationshipToUser, bool) { - if o == nil { - return nil, false - } - return &o.User, true -} - -// SetUser sets field value. -func (o *UserInvitationRelationships) SetUser(v RelationshipToUser) { - o.User = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserInvitationRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["user"] = o.User - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserInvitationRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - User *RelationshipToUser `json:"user"` - }{} - all := struct { - User RelationshipToUser `json:"user"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.User == nil { - return fmt.Errorf("Required field user missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.User.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.User = all.User - return nil -} diff --git a/api/v2/datadog/model_user_invitation_response.go b/api/v2/datadog/model_user_invitation_response.go deleted file mode 100644 index d20922b1591..00000000000 --- a/api/v2/datadog/model_user_invitation_response.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserInvitationResponse User invitation as returned by the API. -type UserInvitationResponse struct { - // Object of a user invitation returned by the API. - Data *UserInvitationResponseData `json:"data,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{} -} - -// NewUserInvitationResponse instantiates a new UserInvitationResponse 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 NewUserInvitationResponse() *UserInvitationResponse { - this := UserInvitationResponse{} - return &this -} - -// NewUserInvitationResponseWithDefaults instantiates a new UserInvitationResponse 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 NewUserInvitationResponseWithDefaults() *UserInvitationResponse { - this := UserInvitationResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UserInvitationResponse) GetData() UserInvitationResponseData { - if o == nil || o.Data == nil { - var ret UserInvitationResponseData - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationResponse) GetDataOk() (*UserInvitationResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UserInvitationResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given UserInvitationResponseData and assigns it to the Data field. -func (o *UserInvitationResponse) SetData(v UserInvitationResponseData) { - o.Data = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserInvitationResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserInvitationResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *UserInvitationResponseData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_user_invitation_response_data.go b/api/v2/datadog/model_user_invitation_response_data.go deleted file mode 100644 index ef52b24ea55..00000000000 --- a/api/v2/datadog/model_user_invitation_response_data.go +++ /dev/null @@ -1,199 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserInvitationResponseData Object of a user invitation returned by the API. -type UserInvitationResponseData struct { - // Attributes of a user invitation. - Attributes *UserInvitationDataAttributes `json:"attributes,omitempty"` - // ID of the user invitation. - Id *string `json:"id,omitempty"` - // User invitations type. - Type *UserInvitationsType `json:"type,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{} -} - -// NewUserInvitationResponseData instantiates a new UserInvitationResponseData 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 NewUserInvitationResponseData() *UserInvitationResponseData { - this := UserInvitationResponseData{} - var typeVar UserInvitationsType = USERINVITATIONSTYPE_USER_INVITATIONS - this.Type = &typeVar - return &this -} - -// NewUserInvitationResponseDataWithDefaults instantiates a new UserInvitationResponseData 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 NewUserInvitationResponseDataWithDefaults() *UserInvitationResponseData { - this := UserInvitationResponseData{} - var typeVar UserInvitationsType = USERINVITATIONSTYPE_USER_INVITATIONS - this.Type = &typeVar - return &this -} - -// GetAttributes returns the Attributes field value if set, zero value otherwise. -func (o *UserInvitationResponseData) GetAttributes() UserInvitationDataAttributes { - if o == nil || o.Attributes == nil { - var ret UserInvitationDataAttributes - return ret - } - return *o.Attributes -} - -// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationResponseData) GetAttributesOk() (*UserInvitationDataAttributes, bool) { - if o == nil || o.Attributes == nil { - return nil, false - } - return o.Attributes, true -} - -// HasAttributes returns a boolean if a field has been set. -func (o *UserInvitationResponseData) HasAttributes() bool { - if o != nil && o.Attributes != nil { - return true - } - - return false -} - -// SetAttributes gets a reference to the given UserInvitationDataAttributes and assigns it to the Attributes field. -func (o *UserInvitationResponseData) SetAttributes(v UserInvitationDataAttributes) { - o.Attributes = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *UserInvitationResponseData) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationResponseData) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *UserInvitationResponseData) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *UserInvitationResponseData) SetId(v string) { - o.Id = &v -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *UserInvitationResponseData) GetType() UserInvitationsType { - if o == nil || o.Type == nil { - var ret UserInvitationsType - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationResponseData) GetTypeOk() (*UserInvitationsType, bool) { - if o == nil || o.Type == nil { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *UserInvitationResponseData) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false -} - -// SetType gets a reference to the given UserInvitationsType and assigns it to the Type field. -func (o *UserInvitationResponseData) SetType(v UserInvitationsType) { - o.Type = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserInvitationResponseData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Attributes != nil { - toSerialize["attributes"] = o.Attributes - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Type != nil { - toSerialize["type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserInvitationResponseData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Attributes *UserInvitationDataAttributes `json:"attributes,omitempty"` - Id *string `json:"id,omitempty"` - Type *UserInvitationsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; v != nil && !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_user_invitations_request.go b/api/v2/datadog/model_user_invitations_request.go deleted file mode 100644 index 40f738a52fe..00000000000 --- a/api/v2/datadog/model_user_invitations_request.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserInvitationsRequest Object to invite users to join the organization. -type UserInvitationsRequest struct { - // List of user invitations. - Data []UserInvitationData `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{} -} - -// NewUserInvitationsRequest instantiates a new UserInvitationsRequest 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 NewUserInvitationsRequest(data []UserInvitationData) *UserInvitationsRequest { - this := UserInvitationsRequest{} - this.Data = data - return &this -} - -// NewUserInvitationsRequestWithDefaults instantiates a new UserInvitationsRequest 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 NewUserInvitationsRequestWithDefaults() *UserInvitationsRequest { - this := UserInvitationsRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *UserInvitationsRequest) GetData() []UserInvitationData { - if o == nil { - var ret []UserInvitationData - 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 *UserInvitationsRequest) GetDataOk() (*[]UserInvitationData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *UserInvitationsRequest) SetData(v []UserInvitationData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserInvitationsRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserInvitationsRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *[]UserInvitationData `json:"data"` - }{} - all := struct { - Data []UserInvitationData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_user_invitations_response.go b/api/v2/datadog/model_user_invitations_response.go deleted file mode 100644 index 837aaf90aa7..00000000000 --- a/api/v2/datadog/model_user_invitations_response.go +++ /dev/null @@ -1,102 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserInvitationsResponse User invitations as returned by the API. -type UserInvitationsResponse struct { - // Array of user invitations. - Data []UserInvitationResponseData `json:"data,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{} -} - -// NewUserInvitationsResponse instantiates a new UserInvitationsResponse 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 NewUserInvitationsResponse() *UserInvitationsResponse { - this := UserInvitationsResponse{} - return &this -} - -// NewUserInvitationsResponseWithDefaults instantiates a new UserInvitationsResponse 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 NewUserInvitationsResponseWithDefaults() *UserInvitationsResponse { - this := UserInvitationsResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UserInvitationsResponse) GetData() []UserInvitationResponseData { - if o == nil || o.Data == nil { - var ret []UserInvitationResponseData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserInvitationsResponse) GetDataOk() (*[]UserInvitationResponseData, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UserInvitationsResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []UserInvitationResponseData and assigns it to the Data field. -func (o *UserInvitationsResponse) SetData(v []UserInvitationResponseData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserInvitationsResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserInvitationsResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []UserInvitationResponseData `json:"data,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_user_invitations_type.go b/api/v2/datadog/model_user_invitations_type.go deleted file mode 100644 index db3360f59e1..00000000000 --- a/api/v2/datadog/model_user_invitations_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserInvitationsType User invitations type. -type UserInvitationsType string - -// List of UserInvitationsType. -const ( - USERINVITATIONSTYPE_USER_INVITATIONS UserInvitationsType = "user_invitations" -) - -var allowedUserInvitationsTypeEnumValues = []UserInvitationsType{ - USERINVITATIONSTYPE_USER_INVITATIONS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UserInvitationsType) GetAllowedValues() []UserInvitationsType { - return allowedUserInvitationsTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UserInvitationsType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UserInvitationsType(value) - return nil -} - -// NewUserInvitationsTypeFromValue returns a pointer to a valid UserInvitationsType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUserInvitationsTypeFromValue(v string) (*UserInvitationsType, error) { - ev := UserInvitationsType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UserInvitationsType: valid values are %v", v, allowedUserInvitationsTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UserInvitationsType) IsValid() bool { - for _, existing := range allowedUserInvitationsTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UserInvitationsType value. -func (v UserInvitationsType) Ptr() *UserInvitationsType { - return &v -} - -// NullableUserInvitationsType handles when a null is used for UserInvitationsType. -type NullableUserInvitationsType struct { - value *UserInvitationsType - isSet bool -} - -// Get returns the associated value. -func (v NullableUserInvitationsType) Get() *UserInvitationsType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUserInvitationsType) Set(val *UserInvitationsType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUserInvitationsType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUserInvitationsType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUserInvitationsType initializes the struct as if Set has been called. -func NewNullableUserInvitationsType(val *UserInvitationsType) *NullableUserInvitationsType { - return &NullableUserInvitationsType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUserInvitationsType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUserInvitationsType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_user_relationships.go b/api/v2/datadog/model_user_relationships.go deleted file mode 100644 index cc3d04a6f52..00000000000 --- a/api/v2/datadog/model_user_relationships.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserRelationships Relationships of the user object. -type UserRelationships struct { - // Relationship to roles. - Roles *RelationshipToRoles `json:"roles,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{} -} - -// NewUserRelationships instantiates a new UserRelationships 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 NewUserRelationships() *UserRelationships { - this := UserRelationships{} - return &this -} - -// NewUserRelationshipsWithDefaults instantiates a new UserRelationships 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 NewUserRelationshipsWithDefaults() *UserRelationships { - this := UserRelationships{} - return &this -} - -// GetRoles returns the Roles field value if set, zero value otherwise. -func (o *UserRelationships) GetRoles() RelationshipToRoles { - if o == nil || o.Roles == nil { - var ret RelationshipToRoles - return ret - } - return *o.Roles -} - -// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserRelationships) GetRolesOk() (*RelationshipToRoles, bool) { - if o == nil || o.Roles == nil { - return nil, false - } - return o.Roles, true -} - -// HasRoles returns a boolean if a field has been set. -func (o *UserRelationships) HasRoles() bool { - if o != nil && o.Roles != nil { - return true - } - - return false -} - -// SetRoles gets a reference to the given RelationshipToRoles and assigns it to the Roles field. -func (o *UserRelationships) SetRoles(v RelationshipToRoles) { - o.Roles = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Roles != nil { - toSerialize["roles"] = o.Roles - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Roles *RelationshipToRoles `json:"roles,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Roles != nil && all.Roles.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Roles = all.Roles - return nil -} diff --git a/api/v2/datadog/model_user_response.go b/api/v2/datadog/model_user_response.go deleted file mode 100644 index 2189a4245f5..00000000000 --- a/api/v2/datadog/model_user_response.go +++ /dev/null @@ -1,148 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserResponse Response containing information about a single user. -type UserResponse struct { - // User object returned by the API. - Data *User `json:"data,omitempty"` - // Array of objects related to the user. - Included []UserResponseIncludedItem `json:"included,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{} -} - -// NewUserResponse instantiates a new UserResponse 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 NewUserResponse() *UserResponse { - this := UserResponse{} - return &this -} - -// NewUserResponseWithDefaults instantiates a new UserResponse 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 NewUserResponseWithDefaults() *UserResponse { - this := UserResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UserResponse) GetData() User { - if o == nil || o.Data == nil { - var ret User - return ret - } - return *o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserResponse) GetDataOk() (*User, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UserResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given User and assigns it to the Data field. -func (o *UserResponse) SetData(v User) { - o.Data = &v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *UserResponse) GetIncluded() []UserResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []UserResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserResponse) GetIncludedOk() (*[]UserResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *UserResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []UserResponseIncludedItem and assigns it to the Included field. -func (o *UserResponse) SetIncluded(v []UserResponseIncludedItem) { - o.Included = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data *User `json:"data,omitempty"` - Included []UserResponseIncludedItem `json:"included,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - o.Included = all.Included - return nil -} diff --git a/api/v2/datadog/model_user_response_included_item.go b/api/v2/datadog/model_user_response_included_item.go deleted file mode 100644 index db4ed2e379b..00000000000 --- a/api/v2/datadog/model_user_response_included_item.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserResponseIncludedItem - An object related to a user. -type UserResponseIncludedItem struct { - Organization *Organization - Permission *Permission - Role *Role - - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject interface{} -} - -// OrganizationAsUserResponseIncludedItem is a convenience function that returns Organization wrapped in UserResponseIncludedItem. -func OrganizationAsUserResponseIncludedItem(v *Organization) UserResponseIncludedItem { - return UserResponseIncludedItem{Organization: v} -} - -// PermissionAsUserResponseIncludedItem is a convenience function that returns Permission wrapped in UserResponseIncludedItem. -func PermissionAsUserResponseIncludedItem(v *Permission) UserResponseIncludedItem { - return UserResponseIncludedItem{Permission: v} -} - -// RoleAsUserResponseIncludedItem is a convenience function that returns Role wrapped in UserResponseIncludedItem. -func RoleAsUserResponseIncludedItem(v *Role) UserResponseIncludedItem { - return UserResponseIncludedItem{Role: v} -} - -// UnmarshalJSON turns data into one of the pointers in the struct. -func (obj *UserResponseIncludedItem) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into Organization - err = json.Unmarshal(data, &obj.Organization) - if err == nil { - if obj.Organization != nil && obj.Organization.UnparsedObject == nil { - jsonOrganization, _ := json.Marshal(obj.Organization) - if string(jsonOrganization) == "{}" { // empty struct - obj.Organization = nil - } else { - match++ - } - } else { - obj.Organization = nil - } - } else { - obj.Organization = nil - } - - // try to unmarshal data into Permission - err = json.Unmarshal(data, &obj.Permission) - if err == nil { - if obj.Permission != nil && obj.Permission.UnparsedObject == nil { - jsonPermission, _ := json.Marshal(obj.Permission) - if string(jsonPermission) == "{}" { // empty struct - obj.Permission = nil - } else { - match++ - } - } else { - obj.Permission = nil - } - } else { - obj.Permission = nil - } - - // try to unmarshal data into Role - err = json.Unmarshal(data, &obj.Role) - if err == nil { - if obj.Role != nil && obj.Role.UnparsedObject == nil { - jsonRole, _ := json.Marshal(obj.Role) - if string(jsonRole) == "{}" { // empty struct - obj.Role = nil - } else { - match++ - } - } else { - obj.Role = nil - } - } else { - obj.Role = nil - } - - if match != 1 { // more than 1 match - // reset to nil - obj.Organization = nil - obj.Permission = nil - obj.Role = nil - return json.Unmarshal(data, &obj.UnparsedObject) - } - return nil // exactly one match -} - -// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. -func (obj UserResponseIncludedItem) MarshalJSON() ([]byte, error) { - if obj.Organization != nil { - return json.Marshal(&obj.Organization) - } - - if obj.Permission != nil { - return json.Marshal(&obj.Permission) - } - - if obj.Role != nil { - return json.Marshal(&obj.Role) - } - - if obj.UnparsedObject != nil { - return json.Marshal(obj.UnparsedObject) - } - return nil, nil // no data in oneOf schemas -} - -// GetActualInstance returns the actual instance. -func (obj *UserResponseIncludedItem) GetActualInstance() interface{} { - if obj.Organization != nil { - return obj.Organization - } - - if obj.Permission != nil { - return obj.Permission - } - - if obj.Role != nil { - return obj.Role - } - - // all schemas are nil - return nil -} - -// NullableUserResponseIncludedItem handles when a null is used for UserResponseIncludedItem. -type NullableUserResponseIncludedItem struct { - value *UserResponseIncludedItem - isSet bool -} - -// Get returns the associated value. -func (v NullableUserResponseIncludedItem) Get() *UserResponseIncludedItem { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUserResponseIncludedItem) Set(val *UserResponseIncludedItem) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUserResponseIncludedItem) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableUserResponseIncludedItem) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUserResponseIncludedItem initializes the struct as if Set has been called. -func NewNullableUserResponseIncludedItem(val *UserResponseIncludedItem) *NullableUserResponseIncludedItem { - return &NullableUserResponseIncludedItem{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUserResponseIncludedItem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUserResponseIncludedItem) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -} diff --git a/api/v2/datadog/model_user_response_relationships.go b/api/v2/datadog/model_user_response_relationships.go deleted file mode 100644 index 307355dfce1..00000000000 --- a/api/v2/datadog/model_user_response_relationships.go +++ /dev/null @@ -1,247 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserResponseRelationships Relationships of the user object returned by the API. -type UserResponseRelationships struct { - // Relationship to an organization. - Org *RelationshipToOrganization `json:"org,omitempty"` - // Relationship to organizations. - OtherOrgs *RelationshipToOrganizations `json:"other_orgs,omitempty"` - // Relationship to users. - OtherUsers *RelationshipToUsers `json:"other_users,omitempty"` - // Relationship to roles. - Roles *RelationshipToRoles `json:"roles,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{} -} - -// NewUserResponseRelationships instantiates a new UserResponseRelationships 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 NewUserResponseRelationships() *UserResponseRelationships { - this := UserResponseRelationships{} - return &this -} - -// NewUserResponseRelationshipsWithDefaults instantiates a new UserResponseRelationships 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 NewUserResponseRelationshipsWithDefaults() *UserResponseRelationships { - this := UserResponseRelationships{} - return &this -} - -// GetOrg returns the Org field value if set, zero value otherwise. -func (o *UserResponseRelationships) GetOrg() RelationshipToOrganization { - if o == nil || o.Org == nil { - var ret RelationshipToOrganization - return ret - } - return *o.Org -} - -// GetOrgOk returns a tuple with the Org field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserResponseRelationships) GetOrgOk() (*RelationshipToOrganization, bool) { - if o == nil || o.Org == nil { - return nil, false - } - return o.Org, true -} - -// HasOrg returns a boolean if a field has been set. -func (o *UserResponseRelationships) HasOrg() bool { - if o != nil && o.Org != nil { - return true - } - - return false -} - -// SetOrg gets a reference to the given RelationshipToOrganization and assigns it to the Org field. -func (o *UserResponseRelationships) SetOrg(v RelationshipToOrganization) { - o.Org = &v -} - -// GetOtherOrgs returns the OtherOrgs field value if set, zero value otherwise. -func (o *UserResponseRelationships) GetOtherOrgs() RelationshipToOrganizations { - if o == nil || o.OtherOrgs == nil { - var ret RelationshipToOrganizations - return ret - } - return *o.OtherOrgs -} - -// GetOtherOrgsOk returns a tuple with the OtherOrgs field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserResponseRelationships) GetOtherOrgsOk() (*RelationshipToOrganizations, bool) { - if o == nil || o.OtherOrgs == nil { - return nil, false - } - return o.OtherOrgs, true -} - -// HasOtherOrgs returns a boolean if a field has been set. -func (o *UserResponseRelationships) HasOtherOrgs() bool { - if o != nil && o.OtherOrgs != nil { - return true - } - - return false -} - -// SetOtherOrgs gets a reference to the given RelationshipToOrganizations and assigns it to the OtherOrgs field. -func (o *UserResponseRelationships) SetOtherOrgs(v RelationshipToOrganizations) { - o.OtherOrgs = &v -} - -// GetOtherUsers returns the OtherUsers field value if set, zero value otherwise. -func (o *UserResponseRelationships) GetOtherUsers() RelationshipToUsers { - if o == nil || o.OtherUsers == nil { - var ret RelationshipToUsers - return ret - } - return *o.OtherUsers -} - -// GetOtherUsersOk returns a tuple with the OtherUsers field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserResponseRelationships) GetOtherUsersOk() (*RelationshipToUsers, bool) { - if o == nil || o.OtherUsers == nil { - return nil, false - } - return o.OtherUsers, true -} - -// HasOtherUsers returns a boolean if a field has been set. -func (o *UserResponseRelationships) HasOtherUsers() bool { - if o != nil && o.OtherUsers != nil { - return true - } - - return false -} - -// SetOtherUsers gets a reference to the given RelationshipToUsers and assigns it to the OtherUsers field. -func (o *UserResponseRelationships) SetOtherUsers(v RelationshipToUsers) { - o.OtherUsers = &v -} - -// GetRoles returns the Roles field value if set, zero value otherwise. -func (o *UserResponseRelationships) GetRoles() RelationshipToRoles { - if o == nil || o.Roles == nil { - var ret RelationshipToRoles - return ret - } - return *o.Roles -} - -// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserResponseRelationships) GetRolesOk() (*RelationshipToRoles, bool) { - if o == nil || o.Roles == nil { - return nil, false - } - return o.Roles, true -} - -// HasRoles returns a boolean if a field has been set. -func (o *UserResponseRelationships) HasRoles() bool { - if o != nil && o.Roles != nil { - return true - } - - return false -} - -// SetRoles gets a reference to the given RelationshipToRoles and assigns it to the Roles field. -func (o *UserResponseRelationships) SetRoles(v RelationshipToRoles) { - o.Roles = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserResponseRelationships) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Org != nil { - toSerialize["org"] = o.Org - } - if o.OtherOrgs != nil { - toSerialize["other_orgs"] = o.OtherOrgs - } - if o.OtherUsers != nil { - toSerialize["other_users"] = o.OtherUsers - } - if o.Roles != nil { - toSerialize["roles"] = o.Roles - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Org *RelationshipToOrganization `json:"org,omitempty"` - OtherOrgs *RelationshipToOrganizations `json:"other_orgs,omitempty"` - OtherUsers *RelationshipToUsers `json:"other_users,omitempty"` - Roles *RelationshipToRoles `json:"roles,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Org = all.Org - if all.OtherOrgs != nil && all.OtherOrgs.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.OtherOrgs = all.OtherOrgs - if all.OtherUsers != nil && all.OtherUsers.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.OtherUsers = all.OtherUsers - if all.Roles != nil && all.Roles.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Roles = all.Roles - return nil -} diff --git a/api/v2/datadog/model_user_update_attributes.go b/api/v2/datadog/model_user_update_attributes.go deleted file mode 100644 index f3b6588d0a4..00000000000 --- a/api/v2/datadog/model_user_update_attributes.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UserUpdateAttributes Attributes of the edited user. -type UserUpdateAttributes struct { - // If the user is enabled or disabled. - Disabled *bool `json:"disabled,omitempty"` - // The email of the user. - Email *string `json:"email,omitempty"` - // The name of the user. - Name *string `json:"name,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{} -} - -// NewUserUpdateAttributes instantiates a new UserUpdateAttributes 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 NewUserUpdateAttributes() *UserUpdateAttributes { - this := UserUpdateAttributes{} - return &this -} - -// NewUserUpdateAttributesWithDefaults instantiates a new UserUpdateAttributes 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 NewUserUpdateAttributesWithDefaults() *UserUpdateAttributes { - this := UserUpdateAttributes{} - return &this -} - -// GetDisabled returns the Disabled field value if set, zero value otherwise. -func (o *UserUpdateAttributes) GetDisabled() bool { - if o == nil || o.Disabled == nil { - var ret bool - return ret - } - return *o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserUpdateAttributes) GetDisabledOk() (*bool, bool) { - if o == nil || o.Disabled == nil { - return nil, false - } - return o.Disabled, true -} - -// HasDisabled returns a boolean if a field has been set. -func (o *UserUpdateAttributes) HasDisabled() bool { - if o != nil && o.Disabled != nil { - return true - } - - return false -} - -// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. -func (o *UserUpdateAttributes) SetDisabled(v bool) { - o.Disabled = &v -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *UserUpdateAttributes) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserUpdateAttributes) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *UserUpdateAttributes) HasEmail() bool { - if o != nil && o.Email != nil { - return true - } - - return false -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *UserUpdateAttributes) SetEmail(v string) { - o.Email = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *UserUpdateAttributes) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserUpdateAttributes) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *UserUpdateAttributes) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *UserUpdateAttributes) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Disabled != nil { - toSerialize["disabled"] = o.Disabled - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Disabled *bool `json:"disabled,omitempty"` - Email *string `json:"email,omitempty"` - Name *string `json:"name,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Disabled = all.Disabled - o.Email = all.Email - o.Name = all.Name - return nil -} diff --git a/api/v2/datadog/model_user_update_data.go b/api/v2/datadog/model_user_update_data.go deleted file mode 100644 index c9660e41860..00000000000 --- a/api/v2/datadog/model_user_update_data.go +++ /dev/null @@ -1,186 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserUpdateData Object to update a user. -type UserUpdateData struct { - // Attributes of the edited user. - Attributes UserUpdateAttributes `json:"attributes"` - // ID of the user. - Id string `json:"id"` - // Users resource type. - Type UsersType `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{} -} - -// NewUserUpdateData instantiates a new UserUpdateData 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 NewUserUpdateData(attributes UserUpdateAttributes, id string, typeVar UsersType) *UserUpdateData { - this := UserUpdateData{} - this.Attributes = attributes - this.Id = id - this.Type = typeVar - return &this -} - -// NewUserUpdateDataWithDefaults instantiates a new UserUpdateData 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 NewUserUpdateDataWithDefaults() *UserUpdateData { - this := UserUpdateData{} - var typeVar UsersType = USERSTYPE_USERS - this.Type = typeVar - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *UserUpdateData) GetAttributes() UserUpdateAttributes { - if o == nil { - var ret UserUpdateAttributes - 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 *UserUpdateData) GetAttributesOk() (*UserUpdateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *UserUpdateData) SetAttributes(v UserUpdateAttributes) { - o.Attributes = v -} - -// GetId returns the Id field value. -func (o *UserUpdateData) 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 *UserUpdateData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *UserUpdateData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *UserUpdateData) GetType() UsersType { - if o == nil { - var ret UsersType - 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 *UserUpdateData) GetTypeOk() (*UsersType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *UserUpdateData) SetType(v UsersType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserUpdateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.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 json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserUpdateData) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Attributes *UserUpdateAttributes `json:"attributes"` - Id *string `json:"id"` - Type *UsersType `json:"type"` - }{} - all := struct { - Attributes UserUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("Required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("Required field id missing") - } - if required.Type == nil { - return fmt.Errorf("Required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if v := all.Type; !v.IsValid() { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type - return nil -} diff --git a/api/v2/datadog/model_user_update_request.go b/api/v2/datadog/model_user_update_request.go deleted file mode 100644 index b5a14d5d483..00000000000 --- a/api/v2/datadog/model_user_update_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UserUpdateRequest Update a user. -type UserUpdateRequest struct { - // Object to update a user. - Data UserUpdateData `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{} -} - -// NewUserUpdateRequest instantiates a new UserUpdateRequest 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 NewUserUpdateRequest(data UserUpdateData) *UserUpdateRequest { - this := UserUpdateRequest{} - this.Data = data - return &this -} - -// NewUserUpdateRequestWithDefaults instantiates a new UserUpdateRequest 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 NewUserUpdateRequestWithDefaults() *UserUpdateRequest { - this := UserUpdateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *UserUpdateRequest) GetData() UserUpdateData { - if o == nil { - var ret UserUpdateData - 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 *UserUpdateRequest) GetDataOk() (*UserUpdateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *UserUpdateRequest) SetData(v UserUpdateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UserUpdateRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UserUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - required := struct { - Data *UserUpdateData `json:"data"` - }{} - all := struct { - Data UserUpdateData `json:"data"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("Required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Data = all.Data - return nil -} diff --git a/api/v2/datadog/model_users_response.go b/api/v2/datadog/model_users_response.go deleted file mode 100644 index 0acc716b14b..00000000000 --- a/api/v2/datadog/model_users_response.go +++ /dev/null @@ -1,187 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" -) - -// UsersResponse Response containing information about multiple users. -type UsersResponse struct { - // Array of returned users. - Data []User `json:"data,omitempty"` - // Array of objects related to the users. - Included []UserResponseIncludedItem `json:"included,omitempty"` - // Object describing meta attributes of response. - Meta *ResponseMetaAttributes `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{} -} - -// NewUsersResponse instantiates a new UsersResponse 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 NewUsersResponse() *UsersResponse { - this := UsersResponse{} - return &this -} - -// NewUsersResponseWithDefaults instantiates a new UsersResponse 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 NewUsersResponseWithDefaults() *UsersResponse { - this := UsersResponse{} - return &this -} - -// GetData returns the Data field value if set, zero value otherwise. -func (o *UsersResponse) GetData() []User { - if o == nil || o.Data == nil { - var ret []User - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsersResponse) GetDataOk() (*[]User, bool) { - if o == nil || o.Data == nil { - return nil, false - } - return &o.Data, true -} - -// HasData returns a boolean if a field has been set. -func (o *UsersResponse) HasData() bool { - if o != nil && o.Data != nil { - return true - } - - return false -} - -// SetData gets a reference to the given []User and assigns it to the Data field. -func (o *UsersResponse) SetData(v []User) { - o.Data = v -} - -// GetIncluded returns the Included field value if set, zero value otherwise. -func (o *UsersResponse) GetIncluded() []UserResponseIncludedItem { - if o == nil || o.Included == nil { - var ret []UserResponseIncludedItem - return ret - } - return o.Included -} - -// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UsersResponse) GetIncludedOk() (*[]UserResponseIncludedItem, bool) { - if o == nil || o.Included == nil { - return nil, false - } - return &o.Included, true -} - -// HasIncluded returns a boolean if a field has been set. -func (o *UsersResponse) HasIncluded() bool { - if o != nil && o.Included != nil { - return true - } - - return false -} - -// SetIncluded gets a reference to the given []UserResponseIncludedItem and assigns it to the Included field. -func (o *UsersResponse) SetIncluded(v []UserResponseIncludedItem) { - o.Included = v -} - -// GetMeta returns the Meta field value if set, zero value otherwise. -func (o *UsersResponse) GetMeta() ResponseMetaAttributes { - if o == nil || o.Meta == nil { - var ret ResponseMetaAttributes - 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 *UsersResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *UsersResponse) HasMeta() bool { - if o != nil && o.Meta != nil { - return true - } - - return false -} - -// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. -func (o *UsersResponse) SetMeta(v ResponseMetaAttributes) { - o.Meta = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o UsersResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Data != nil { - toSerialize["data"] = o.Data - } - if o.Included != nil { - toSerialize["included"] = o.Included - } - if o.Meta != nil { - toSerialize["meta"] = o.Meta - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *UsersResponse) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Data []User `json:"data,omitempty"` - Included []UserResponseIncludedItem `json:"included,omitempty"` - Meta *ResponseMetaAttributes `json:"meta,omitempty"` - }{} - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - o.Data = all.Data - o.Included = all.Included - if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - } - o.Meta = all.Meta - return nil -} diff --git a/api/v2/datadog/model_users_type.go b/api/v2/datadog/model_users_type.go deleted file mode 100644 index 16187ee4798..00000000000 --- a/api/v2/datadog/model_users_type.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 datadog - -import ( - "encoding/json" - "fmt" -) - -// UsersType Users resource type. -type UsersType string - -// List of UsersType. -const ( - USERSTYPE_USERS UsersType = "users" -) - -var allowedUsersTypeEnumValues = []UsersType{ - USERSTYPE_USERS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UsersType) GetAllowedValues() []UsersType { - return allowedUsersTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UsersType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UsersType(value) - return nil -} - -// NewUsersTypeFromValue returns a pointer to a valid UsersType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUsersTypeFromValue(v string) (*UsersType, error) { - ev := UsersType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UsersType: valid values are %v", v, allowedUsersTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UsersType) IsValid() bool { - for _, existing := range allowedUsersTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UsersType value. -func (v UsersType) Ptr() *UsersType { - return &v -} - -// NullableUsersType handles when a null is used for UsersType. -type NullableUsersType struct { - value *UsersType - isSet bool -} - -// Get returns the associated value. -func (v NullableUsersType) Get() *UsersType { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableUsersType) Set(val *UsersType) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableUsersType) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag. -func (v *NullableUsersType) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableUsersType initializes the struct as if Set has been called. -func NewNullableUsersType(val *UsersType) *NullableUsersType { - return &NullableUsersType{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableUsersType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableUsersType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} From d0a2ecaf4e26e2b425fdcaa90fb364db15228a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Thu, 4 Aug 2022 17:06:57 +0200 Subject: [PATCH 3/3] Regenerate --- api/common/client.go | 492 ++ api/common/configuration.go | 582 ++ api/common/no_zstd.go | 16 + api/common/utils.go | 437 ++ api/common/zstd.go | 25 + api/v1/datadog/api_authentication.go | 136 + api/v1/datadog/api_aws_integration.go | 1412 ++++ api/v1/datadog/api_aws_logs_integration.go | 1010 +++ api/v1/datadog/api_azure_integration.go | 735 ++ api/v1/datadog/api_dashboard_lists.go | 721 ++ api/v1/datadog/api_dashboards.go | 1046 +++ api/v1/datadog/api_downtimes.go | 1027 +++ api/v1/datadog/api_events.go | 529 ++ api/v1/datadog/api_gcp_integration.go | 588 ++ api/v1/datadog/api_hosts.go | 722 ++ api/v1/datadog/api_ip_ranges.go | 113 + api/v1/datadog/api_key_management.go | 1443 ++++ api/v1/datadog/api_logs.go | 354 + api/v1/datadog/api_logs_indexes.go | 848 +++ api/v1/datadog/api_logs_pipelines.go | 988 +++ api/v1/datadog/api_metrics.go | 1152 +++ api/v1/datadog/api_monitors.go | 1953 +++++ api/v1/datadog/api_notebooks.go | 884 +++ api/v1/datadog/api_organizations.go | 888 +++ api/v1/datadog/api_pager_duty_integration.go | 574 ++ api/v1/datadog/api_security_monitoring.go | 488 ++ api/v1/datadog/api_service_checks.go | 175 + ...api_service_level_objective_corrections.go | 719 ++ .../datadog/api_service_level_objectives.go | 1749 +++++ api/v1/datadog/api_slack_integration.go | 770 ++ api/v1/datadog/api_snapshots.go | 261 + api/v1/datadog/api_synthetics.go | 3883 ++++++++++ api/v1/datadog/api_tags.go | 861 +++ api/v1/datadog/api_usage_metering.go | 6764 +++++++++++++++++ api/v1/datadog/api_users.go | 747 ++ api/v1/datadog/api_webhooks_integration.go | 1165 +++ api/v1/datadog/model_access_role.go | 113 + .../model_add_signal_to_incident_request.go | 181 + .../model_alert_graph_widget_definition.go | 358 + ...odel_alert_graph_widget_definition_type.go | 107 + .../model_alert_value_widget_definition.go | 396 + ...odel_alert_value_widget_definition_type.go | 107 + api/v1/datadog/model_api_error_response.go | 103 + api/v1/datadog/model_api_key.go | 219 + api/v1/datadog/model_api_key_list_response.go | 102 + api/v1/datadog/model_api_key_response.go | 109 + .../model_apm_stats_query_column_type.go | 236 + .../model_apm_stats_query_definition.go | 321 + .../datadog/model_apm_stats_query_row_type.go | 111 + api/v1/datadog/model_application_key.go | 180 + .../model_application_key_list_response.go | 102 + .../datadog/model_application_key_response.go | 109 + ...odel_authentication_validation_response.go | 102 + api/v1/datadog/model_aws_account.go | 512 ++ .../model_aws_account_and_lambda_request.go | 136 + .../model_aws_account_create_response.go | 102 + .../model_aws_account_delete_request.go | 180 + .../model_aws_account_list_response.go | 102 + api/v1/datadog/model_aws_logs_async_error.go | 141 + .../datadog/model_aws_logs_async_response.go | 141 + api/v1/datadog/model_aws_logs_lambda.go | 102 + .../datadog/model_aws_logs_list_response.go | 180 + .../model_aws_logs_list_services_response.go | 141 + .../model_aws_logs_services_request.go | 136 + api/v1/datadog/model_aws_namespace.go | 119 + api/v1/datadog/model_aws_tag_filter.go | 149 + .../model_aws_tag_filter_create_request.go | 188 + .../model_aws_tag_filter_delete_request.go | 149 + .../model_aws_tag_filter_list_response.go | 102 + api/v1/datadog/model_azure_account.go | 376 + ...model_cancel_downtimes_by_scope_request.go | 105 + .../datadog/model_canceled_downtimes_ids.go | 102 + .../datadog/model_change_widget_definition.go | 359 + .../model_change_widget_definition_type.go | 107 + api/v1/datadog/model_change_widget_request.go | 861 +++ ...model_check_can_delete_monitor_response.go | 149 + ..._check_can_delete_monitor_response_data.go | 102 + .../model_check_can_delete_slo_response.go | 148 + ...odel_check_can_delete_slo_response_data.go | 102 + .../model_check_status_widget_definition.go | 475 ++ ...del_check_status_widget_definition_type.go | 107 + api/v1/datadog/model_content_encoding.go | 109 + api/v1/datadog/model_creator.go | 193 + api/v1/datadog/model_dashboard.go | 739 ++ .../model_dashboard_bulk_action_data.go | 146 + .../model_dashboard_bulk_delete_request.go | 103 + .../model_dashboard_delete_response.go | 102 + api/v1/datadog/model_dashboard_layout_type.go | 109 + api/v1/datadog/model_dashboard_list.go | 392 + .../model_dashboard_list_delete_response.go | 102 + .../model_dashboard_list_list_response.go | 102 + api/v1/datadog/model_dashboard_reflow_type.go | 111 + .../datadog/model_dashboard_resource_type.go | 107 + .../model_dashboard_restore_request.go | 103 + api/v1/datadog/model_dashboard_summary.go | 102 + .../model_dashboard_summary_definition.go | 444 ++ .../model_dashboard_template_variable.go | 245 + ...odel_dashboard_template_variable_preset.go | 141 + ...ashboard_template_variable_preset_value.go | 141 + api/v1/datadog/model_deleted_monitor.go | 102 + .../datadog/model_distribution_point_item.go | 155 + ...el_distribution_points_content_encoding.go | 107 + .../model_distribution_points_payload.go | 103 + .../model_distribution_points_series.go | 265 + .../datadog/model_distribution_points_type.go | 107 + .../model_distribution_widget_definition.go | 539 ++ ...del_distribution_widget_definition_type.go | 107 + ...ribution_widget_histogram_request_query.go | 187 + ...tribution_widget_histogram_request_type.go | 107 + .../model_distribution_widget_request.go | 648 ++ .../model_distribution_widget_x_axis.go | 231 + .../model_distribution_widget_y_axis.go | 270 + api/v1/datadog/model_downtime.go | 859 +++ api/v1/datadog/model_downtime_child.go | 856 +++ api/v1/datadog/model_downtime_recurrence.go | 381 + api/v1/datadog/model_event.go | 605 ++ api/v1/datadog/model_event_alert_type.go | 121 + api/v1/datadog/model_event_create_request.go | 522 ++ api/v1/datadog/model_event_create_response.go | 148 + api/v1/datadog/model_event_list_response.go | 141 + api/v1/datadog/model_event_priority.go | 109 + .../datadog/model_event_query_definition.go | 136 + api/v1/datadog/model_event_response.go | 148 + .../model_event_stream_widget_definition.go | 404 + ...del_event_stream_widget_definition_type.go | 107 + .../model_event_timeline_widget_definition.go | 356 + ...l_event_timeline_widget_definition_type.go | 107 + ...a_and_function_apm_dependency_stat_name.go | 119 + ...nction_apm_dependency_stats_data_source.go | 107 + ...n_apm_dependency_stats_query_definition.go | 434 ++ ...ula_and_function_apm_resource_stat_name.go | 127 + ...function_apm_resource_stats_data_source.go | 107 + ...ion_apm_resource_stats_query_definition.go | 446 ++ ..._formula_and_function_event_aggregation.go | 129 + ...ula_and_function_event_query_definition.go | 308 + ...function_event_query_definition_compute.go | 189 + ..._function_event_query_definition_search.go | 103 + ...rmula_and_function_event_query_group_by.go | 188 + ..._and_function_event_query_group_by_sort.go | 201 + ...formula_and_function_events_data_source.go | 121 + ...formula_and_function_metric_aggregation.go | 121 + ...formula_and_function_metric_data_source.go | 107 + ...la_and_function_metric_query_definition.go | 224 + ..._and_function_process_query_data_source.go | 109 + ...a_and_function_process_query_definition.go | 431 ++ ...l_formula_and_function_query_definition.go | 251 + ...el_formula_and_function_response_format.go | 109 + .../model_free_text_widget_definition.go | 271 + .../model_free_text_widget_definition_type.go | 107 + api/v1/datadog/model_funnel_query.go | 179 + api/v1/datadog/model_funnel_request_type.go | 107 + api/v1/datadog/model_funnel_source.go | 107 + api/v1/datadog/model_funnel_step.go | 136 + .../datadog/model_funnel_widget_definition.go | 318 + .../model_funnel_widget_definition_type.go | 107 + api/v1/datadog/model_funnel_widget_request.go | 151 + api/v1/datadog/model_gcp_account.go | 572 ++ .../datadog/model_geomap_widget_definition.go | 439 ++ .../model_geomap_widget_definition_style.go | 136 + .../model_geomap_widget_definition_type.go | 107 + .../model_geomap_widget_definition_view.go | 103 + api/v1/datadog/model_geomap_widget_request.go | 365 + api/v1/datadog/model_graph_snapshot.go | 182 + .../datadog/model_group_widget_definition.go | 394 + .../model_group_widget_definition_type.go | 107 + .../model_heat_map_widget_definition.go | 519 ++ .../model_heat_map_widget_definition_type.go | 107 + .../datadog/model_heat_map_widget_request.go | 516 ++ api/v1/datadog/model_host.go | 623 ++ api/v1/datadog/model_host_list_response.go | 180 + api/v1/datadog/model_host_map_request.go | 470 ++ .../model_host_map_widget_definition.go | 605 ++ ...del_host_map_widget_definition_requests.go | 155 + .../model_host_map_widget_definition_style.go | 219 + .../model_host_map_widget_definition_type.go | 107 + api/v1/datadog/model_host_meta.go | 655 ++ .../datadog/model_host_meta_install_method.go | 180 + api/v1/datadog/model_host_metrics.go | 180 + api/v1/datadog/model_host_mute_response.go | 219 + api/v1/datadog/model_host_mute_settings.go | 180 + api/v1/datadog/model_host_tags.go | 141 + api/v1/datadog/model_host_totals.go | 141 + .../model_hourly_usage_attribution_body.go | 392 + ...model_hourly_usage_attribution_metadata.go | 109 + ...del_hourly_usage_attribution_pagination.go | 115 + ...model_hourly_usage_attribution_response.go | 148 + ...del_hourly_usage_attribution_usage_type.go | 153 + api/v1/datadog/model_http_log_error.go | 136 + api/v1/datadog/model_http_log_item.go | 265 + api/v1/datadog/model_http_method.go | 119 + .../model_i_frame_widget_definition.go | 146 + .../model_i_frame_widget_definition_type.go | 107 + api/v1/datadog/model_idp_form_data.go | 104 + api/v1/datadog/model_idp_response.go | 103 + .../datadog/model_image_widget_definition.go | 461 ++ .../model_image_widget_definition_type.go | 107 + .../datadog/model_intake_payload_accepted.go | 102 + api/v1/datadog/model_ip_prefixes_agents.go | 141 + api/v1/datadog/model_ip_prefixes_api.go | 141 + api/v1/datadog/model_ip_prefixes_apm.go | 141 + api/v1/datadog/model_ip_prefixes_logs.go | 141 + api/v1/datadog/model_ip_prefixes_process.go | 141 + .../datadog/model_ip_prefixes_synthetics.go | 219 + ...p_prefixes_synthetics_private_locations.go | 141 + api/v1/datadog/model_ip_prefixes_webhooks.go | 141 + api/v1/datadog/model_ip_ranges.go | 509 ++ api/v1/datadog/model_list_stream_column.go | 144 + .../datadog/model_list_stream_column_width.go | 111 + api/v1/datadog/model_list_stream_query.go | 185 + .../model_list_stream_response_format.go | 107 + api/v1/datadog/model_list_stream_source.go | 113 + .../model_list_stream_widget_definition.go | 397 + ...odel_list_stream_widget_definition_type.go | 107 + .../model_list_stream_widget_request.go | 184 + api/v1/datadog/model_log.go | 148 + api/v1/datadog/model_log_content.go | 306 + api/v1/datadog/model_log_query_definition.go | 272 + .../model_log_query_definition_group_by.go | 188 + ...odel_log_query_definition_group_by_sort.go | 183 + .../model_log_query_definition_search.go | 103 + .../model_log_stream_widget_definition.go | 615 ++ ...model_log_stream_widget_definition_type.go | 107 + api/v1/datadog/model_logs_api_error.go | 180 + .../datadog/model_logs_api_error_response.go | 109 + .../model_logs_arithmetic_processor.go | 325 + .../model_logs_arithmetic_processor_type.go | 107 + .../datadog/model_logs_attribute_remapper.go | 484 ++ .../model_logs_attribute_remapper_type.go | 107 + api/v1/datadog/model_logs_by_retention.go | 194 + .../model_logs_by_retention_monthly_usage.go | 146 + .../model_logs_by_retention_org_usage.go | 102 + .../datadog/model_logs_by_retention_orgs.go | 102 + .../datadog/model_logs_category_processor.go | 274 + .../model_logs_category_processor_category.go | 148 + .../model_logs_category_processor_type.go | 107 + api/v1/datadog/model_logs_date_remapper.go | 246 + .../datadog/model_logs_date_remapper_type.go | 107 + api/v1/datadog/model_logs_exclusion.go | 188 + api/v1/datadog/model_logs_exclusion_filter.go | 144 + api/v1/datadog/model_logs_filter.go | 102 + api/v1/datadog/model_logs_geo_ip_parser.go | 264 + .../datadog/model_logs_geo_ip_parser_type.go | 107 + api/v1/datadog/model_logs_grok_parser.go | 310 + .../datadog/model_logs_grok_parser_rules.go | 146 + api/v1/datadog/model_logs_grok_parser_type.go | 107 + api/v1/datadog/model_logs_index.go | 303 + .../datadog/model_logs_index_list_response.go | 102 + .../model_logs_index_update_request.go | 274 + api/v1/datadog/model_logs_indexes_order.go | 105 + api/v1/datadog/model_logs_list_request.go | 318 + .../datadog/model_logs_list_request_time.go | 185 + api/v1/datadog/model_logs_list_response.go | 181 + api/v1/datadog/model_logs_lookup_processor.go | 340 + .../model_logs_lookup_processor_type.go | 107 + api/v1/datadog/model_logs_message_remapper.go | 233 + .../model_logs_message_remapper_type.go | 107 + api/v1/datadog/model_logs_pipeline.go | 348 + .../datadog/model_logs_pipeline_processor.go | 284 + .../model_logs_pipeline_processor_type.go | 107 + api/v1/datadog/model_logs_pipelines_order.go | 104 + api/v1/datadog/model_logs_processor.go | 571 ++ api/v1/datadog/model_logs_query_compute.go | 181 + .../model_logs_retention_agg_sum_usage.go | 219 + .../datadog/model_logs_retention_sum_usage.go | 219 + api/v1/datadog/model_logs_service_remapper.go | 231 + .../model_logs_service_remapper_type.go | 107 + api/v1/datadog/model_logs_sort.go | 109 + api/v1/datadog/model_logs_status_remapper.go | 245 + .../model_logs_status_remapper_type.go | 107 + .../model_logs_string_builder_processor.go | 317 + ...odel_logs_string_builder_processor_type.go | 107 + api/v1/datadog/model_logs_trace_remapper.go | 239 + .../datadog/model_logs_trace_remapper_type.go | 107 + api/v1/datadog/model_logs_url_parser.go | 319 + api/v1/datadog/model_logs_url_parser_type.go | 107 + .../datadog/model_logs_user_agent_parser.go | 307 + .../model_logs_user_agent_parser_type.go | 107 + .../datadog/model_metric_content_encoding.go | 107 + api/v1/datadog/model_metric_metadata.go | 336 + .../datadog/model_metric_search_response.go | 109 + .../model_metric_search_response_results.go | 102 + api/v1/datadog/model_metrics_list_response.go | 141 + api/v1/datadog/model_metrics_payload.go | 103 + .../datadog/model_metrics_query_metadata.go | 585 ++ .../datadog/model_metrics_query_response.go | 414 + api/v1/datadog/model_metrics_query_unit.go | 308 + api/v1/datadog/model_monitor.go | 753 ++ api/v1/datadog/model_monitor_device_id.go | 123 + ..._formula_and_function_event_aggregation.go | 129 + ...ula_and_function_event_query_definition.go | 308 + ...function_event_query_definition_compute.go | 189 + ..._function_event_query_definition_search.go | 103 + ...rmula_and_function_event_query_group_by.go | 188 + ..._and_function_event_query_group_by_sort.go | 201 + ...formula_and_function_events_data_source.go | 111 + ...r_formula_and_function_query_definition.go | 123 + .../model_monitor_group_search_response.go | 194 + ...el_monitor_group_search_response_counts.go | 141 + .../model_monitor_group_search_result.go | 357 + api/v1/datadog/model_monitor_options.go | 1248 +++ .../model_monitor_options_aggregation.go | 180 + .../datadog/model_monitor_overall_states.go | 119 + .../model_monitor_renotify_status_type.go | 111 + .../model_monitor_search_count_item.go | 141 + .../datadog/model_monitor_search_response.go | 194 + .../model_monitor_search_response_counts.go | 219 + .../model_monitor_search_response_metadata.go | 219 + api/v1/datadog/model_monitor_search_result.go | 609 ++ ...odel_monitor_search_result_notification.go | 141 + api/v1/datadog/model_monitor_state.go | 103 + api/v1/datadog/model_monitor_state_group.go | 305 + ...model_monitor_summary_widget_definition.go | 623 ++ ..._monitor_summary_widget_definition_type.go | 107 + .../model_monitor_threshold_window_options.go | 165 + api/v1/datadog/model_monitor_thresholds.go | 354 + api/v1/datadog/model_monitor_type.go | 137 + .../datadog/model_monitor_update_request.go | 746 ++ .../model_monthly_usage_attribution_body.go | 356 + ...odel_monthly_usage_attribution_metadata.go | 148 + ...el_monthly_usage_attribution_pagination.go | 115 + ...odel_monthly_usage_attribution_response.go | 148 + ...hly_usage_attribution_supported_metrics.go | 203 + .../model_monthly_usage_attribution_values.go | 1467 ++++ .../datadog/model_note_widget_definition.go | 486 ++ .../model_note_widget_definition_type.go | 107 + .../datadog/model_notebook_absolute_time.go | 184 + api/v1/datadog/model_notebook_author.go | 443 ++ .../model_notebook_cell_create_request.go | 142 + ...notebook_cell_create_request_attributes.go | 284 + .../model_notebook_cell_resource_type.go | 107 + .../datadog/model_notebook_cell_response.go | 180 + ...model_notebook_cell_response_attributes.go | 284 + api/v1/datadog/model_notebook_cell_time.go | 155 + .../model_notebook_cell_update_request.go | 180 + ...notebook_cell_update_request_attributes.go | 284 + api/v1/datadog/model_notebook_create_data.go | 153 + .../model_notebook_create_data_attributes.go | 266 + .../datadog/model_notebook_create_request.go | 110 + ...l_notebook_distribution_cell_attributes.go | 255 + api/v1/datadog/model_notebook_global_time.go | 155 + api/v1/datadog/model_notebook_graph_size.go | 115 + ...model_notebook_heat_map_cell_attributes.go | 253 + ...del_notebook_log_stream_cell_attributes.go | 207 + ...model_notebook_markdown_cell_attributes.go | 110 + ...model_notebook_markdown_cell_definition.go | 146 + ..._notebook_markdown_cell_definition_type.go | 107 + api/v1/datadog/model_notebook_metadata.go | 207 + .../datadog/model_notebook_metadata_type.go | 115 + .../datadog/model_notebook_relative_time.go | 161 + .../datadog/model_notebook_resource_type.go | 107 + api/v1/datadog/model_notebook_response.go | 109 + .../datadog/model_notebook_response_data.go | 186 + ...model_notebook_response_data_attributes.go | 399 + api/v1/datadog/model_notebook_split_by.go | 136 + api/v1/datadog/model_notebook_status.go | 107 + ...del_notebook_timeseries_cell_attributes.go | 253 + .../model_notebook_toplist_cell_attributes.go | 253 + api/v1/datadog/model_notebook_update_cell.go | 156 + api/v1/datadog/model_notebook_update_data.go | 153 + .../model_notebook_update_data_attributes.go | 266 + .../datadog/model_notebook_update_request.go | 110 + api/v1/datadog/model_notebooks_response.go | 148 + .../datadog/model_notebooks_response_data.go | 186 + ...odel_notebooks_response_data_attributes.go | 411 + .../datadog/model_notebooks_response_meta.go | 109 + .../datadog/model_notebooks_response_page.go | 141 + .../datadog/model_org_downgraded_response.go | 102 + api/v1/datadog/model_organization.go | 404 + api/v1/datadog/model_organization_billing.go | 102 + .../datadog/model_organization_create_body.go | 203 + .../model_organization_create_response.go | 247 + .../model_organization_list_response.go | 102 + api/v1/datadog/model_organization_response.go | 109 + api/v1/datadog/model_organization_settings.go | 494 ++ .../model_organization_settings_saml.go | 103 + ..._settings_saml_autocreate_users_domains.go | 141 + ...ation_settings_saml_idp_initiated_login.go | 103 + ..._organization_settings_saml_strict_mode.go | 103 + .../model_organization_subscription.go | 102 + api/v1/datadog/model_pager_duty_service.go | 136 + .../datadog/model_pager_duty_service_key.go | 103 + .../datadog/model_pager_duty_service_name.go | 103 + api/v1/datadog/model_pagination.go | 141 + .../datadog/model_process_query_definition.go | 220 + api/v1/datadog/model_query_sort_order.go | 109 + .../model_query_value_widget_definition.go | 566 ++ ...odel_query_value_widget_definition_type.go | 107 + .../model_query_value_widget_request.go | 727 ++ .../datadog/model_response_meta_attributes.go | 109 + api/v1/datadog/model_scatter_plot_request.go | 517 ++ .../model_scatter_plot_widget_definition.go | 494 ++ ...scatter_plot_widget_definition_requests.go | 201 + ...del_scatter_plot_widget_definition_type.go | 107 + api/v1/datadog/model_scatterplot_dimension.go | 113 + .../model_scatterplot_table_request.go | 188 + .../model_scatterplot_widget_aggregator.go | 115 + .../model_scatterplot_widget_formula.go | 183 + api/v1/datadog/model_search_slo_response.go | 201 + .../datadog/model_search_slo_response_data.go | 148 + ...del_search_slo_response_data_attributes.go | 148 + ...rch_slo_response_data_attributes_facets.go | 375 + ...ponse_data_attributes_facets_object_int.go | 141 + ...se_data_attributes_facets_object_string.go | 141 + .../model_search_slo_response_links.go | 258 + .../datadog/model_search_slo_response_meta.go | 109 + .../model_search_slo_response_meta_page.go | 375 + api/v1/datadog/model_series.go | 312 + api/v1/datadog/model_service_check.go | 288 + api/v1/datadog/model_service_check_status.go | 113 + .../datadog/model_service_level_objective.go | 619 ++ .../model_service_level_objective_query.go | 138 + .../model_service_level_objective_request.go | 406 + .../model_service_map_widget_definition.go | 343 + ...odel_service_map_widget_definition_type.go | 107 + ...model_service_summary_widget_definition.go | 711 ++ ..._service_summary_widget_definition_type.go | 107 + api/v1/datadog/model_signal_archive_reason.go | 113 + .../model_signal_assignee_update_request.go | 142 + .../model_signal_state_update_request.go | 236 + api/v1/datadog/model_signal_triage_state.go | 111 + .../model_slack_integration_channel.go | 148 + ...model_slack_integration_channel_display.go | 235 + api/v1/datadog/model_slo_bulk_delete_error.go | 179 + .../datadog/model_slo_bulk_delete_response.go | 153 + .../model_slo_bulk_delete_response_data.go | 144 + api/v1/datadog/model_slo_correction.go | 199 + .../datadog/model_slo_correction_category.go | 113 + .../model_slo_correction_create_data.go | 159 + .../model_slo_correction_create_request.go | 109 + ...lo_correction_create_request_attributes.go | 373 + .../model_slo_correction_list_response.go | 148 + .../datadog/model_slo_correction_response.go | 109 + ...odel_slo_correction_response_attributes.go | 582 ++ ...correction_response_attributes_modifier.go | 230 + api/v1/datadog/model_slo_correction_type.go | 107 + .../model_slo_correction_update_data.go | 160 + .../model_slo_correction_update_request.go | 109 + ...lo_correction_update_request_attributes.go | 345 + api/v1/datadog/model_slo_delete_response.go | 141 + api/v1/datadog/model_slo_error_timeframe.go | 114 + api/v1/datadog/model_slo_history_metrics.go | 358 + .../model_slo_history_metrics_series.go | 216 + ...del_slo_history_metrics_series_metadata.go | 300 + ...lo_history_metrics_series_metadata_unit.go | 371 + api/v1/datadog/model_slo_history_monitor.go | 541 ++ api/v1/datadog/model_slo_history_response.go | 148 + .../model_slo_history_response_data.go | 494 ++ .../model_slo_history_response_error.go | 102 + ...el_slo_history_response_error_with_type.go | 136 + api/v1/datadog/model_slo_history_sli_data.go | 537 ++ api/v1/datadog/model_slo_list_response.go | 188 + .../model_slo_list_response_metadata.go | 109 + .../model_slo_list_response_metadata_page.go | 141 + api/v1/datadog/model_slo_response.go | 150 + api/v1/datadog/model_slo_response_data.go | 669 ++ api/v1/datadog/model_slo_threshold.go | 270 + api/v1/datadog/model_slo_timeframe.go | 113 + api/v1/datadog/model_slo_type.go | 109 + api/v1/datadog/model_slo_type_numeric.go | 111 + api/v1/datadog/model_slo_widget_definition.go | 476 ++ .../model_slo_widget_definition_type.go | 107 + ...model_successful_signal_update_response.go | 102 + .../model_sunburst_widget_definition.go | 434 ++ .../model_sunburst_widget_definition_type.go | 107 + .../datadog/model_sunburst_widget_legend.go | 155 + ...sunburst_widget_legend_inline_automatic.go | 189 + ...rst_widget_legend_inline_automatic_type.go | 109 + .../model_sunburst_widget_legend_table.go | 111 + ...model_sunburst_widget_legend_table_type.go | 109 + .../datadog/model_sunburst_widget_request.go | 641 ++ api/v1/datadog/model_synthetics_api_step.go | 381 + .../model_synthetics_api_step_subtype.go | 107 + api/v1/datadog/model_synthetics_api_test_.go | 505 ++ .../model_synthetics_api_test_config.go | 226 + .../model_synthetics_api_test_failure_code.go | 157 + .../model_synthetics_api_test_result_data.go | 444 ++ ...odel_synthetics_api_test_result_failure.go | 149 + .../model_synthetics_api_test_result_full.go | 361 + ...l_synthetics_api_test_result_full_check.go | 110 + .../model_synthetics_api_test_result_short.go | 276 + ...synthetics_api_test_result_short_result.go | 149 + .../datadog/model_synthetics_api_test_type.go | 107 + api/v1/datadog/model_synthetics_assertion.go | 156 + ...synthetics_assertion_json_path_operator.go | 107 + ...l_synthetics_assertion_json_path_target.go | 237 + ...etics_assertion_json_path_target_target.go | 180 + .../model_synthetics_assertion_operator.go | 131 + .../model_synthetics_assertion_target.go | 224 + .../model_synthetics_assertion_type.go | 139 + api/v1/datadog/model_synthetics_basic_auth.go | 219 + .../model_synthetics_basic_auth_digest.go | 187 + ...model_synthetics_basic_auth_digest_type.go | 107 + .../model_synthetics_basic_auth_ntlm.go | 269 + .../model_synthetics_basic_auth_ntlm_type.go | 107 + .../model_synthetics_basic_auth_sigv4.go | 296 + .../model_synthetics_basic_auth_sigv4_type.go | 107 + .../model_synthetics_basic_auth_web.go | 187 + .../model_synthetics_basic_auth_web_type.go | 107 + .../datadog/model_synthetics_batch_details.go | 109 + .../model_synthetics_batch_details_data.go | 195 + .../datadog/model_synthetics_batch_result.go | 485 ++ .../datadog/model_synthetics_browser_error.go | 216 + .../model_synthetics_browser_error_type.go | 109 + .../datadog/model_synthetics_browser_test_.go | 496 ++ .../model_synthetics_browser_test_config.go | 260 + ...el_synthetics_browser_test_failure_code.go | 171 + ...del_synthetics_browser_test_result_data.go | 546 ++ ..._synthetics_browser_test_result_failure.go | 149 + ...del_synthetics_browser_test_result_full.go | 361 + ...nthetics_browser_test_result_full_check.go | 110 + ...el_synthetics_browser_test_result_short.go | 276 + ...hetics_browser_test_result_short_result.go | 265 + ...el_synthetics_browser_test_rum_settings.go | 191 + .../model_synthetics_browser_test_type.go | 107 + .../model_synthetics_browser_variable.go | 262 + .../model_synthetics_browser_variable_type.go | 115 + api/v1/datadog/model_synthetics_check_type.go | 133 + .../model_synthetics_ci_batch_metadata.go | 155 + .../model_synthetics_ci_batch_metadata_ci.go | 155 + .../model_synthetics_ci_batch_metadata_git.go | 141 + ...l_synthetics_ci_batch_metadata_pipeline.go | 102 + ...l_synthetics_ci_batch_metadata_provider.go | 102 + api/v1/datadog/model_synthetics_ci_test_.go | 624 ++ .../datadog/model_synthetics_ci_test_body.go | 102 + .../model_synthetics_config_variable.go | 261 + .../model_synthetics_config_variable_type.go | 109 + .../model_synthetics_core_web_vitals.go | 180 + .../model_synthetics_delete_tests_payload.go | 103 + .../model_synthetics_delete_tests_response.go | 103 + .../datadog/model_synthetics_deleted_test_.go | 147 + api/v1/datadog/model_synthetics_device.go | 249 + api/v1/datadog/model_synthetics_device_id.go | 129 + ...cs_get_api_test_latest_results_response.go | 141 + ...et_browser_test_latest_results_response.go | 141 + .../model_synthetics_global_variable.go | 379 + ...l_synthetics_global_variable_attributes.go | 102 + ...tics_global_variable_parse_test_options.go | 190 + ...global_variable_parse_test_options_type.go | 109 + ..._synthetics_global_variable_parser_type.go | 113 + .../model_synthetics_global_variable_value.go | 142 + ...nthetics_list_global_variables_response.go | 102 + .../model_synthetics_list_tests_response.go | 102 + api/v1/datadog/model_synthetics_location.go | 142 + api/v1/datadog/model_synthetics_locations.go | 102 + .../model_synthetics_parsing_options.go | 234 + .../datadog/model_synthetics_playing_tab.go | 115 + .../model_synthetics_private_location.go | 300 + ...tics_private_location_creation_response.go | 194 + ...ion_creation_response_result_encryption.go | 141 + ...el_synthetics_private_location_metadata.go | 102 + ...del_synthetics_private_location_secrets.go | 155 + ...private_location_secrets_authentication.go | 141 + ...vate_location_secrets_config_decryption.go | 102 + .../model_synthetics_ssl_certificate.go | 554 ++ ...model_synthetics_ssl_certificate_issuer.go | 297 + ...odel_synthetics_ssl_certificate_subject.go | 336 + api/v1/datadog/model_synthetics_status.go | 111 + api/v1/datadog/model_synthetics_step.go | 305 + .../datadog/model_synthetics_step_detail.go | 751 ++ .../model_synthetics_step_detail_warning.go | 144 + api/v1/datadog/model_synthetics_step_type.go | 155 + .../model_synthetics_test_ci_options.go | 110 + .../datadog/model_synthetics_test_config.go | 226 + .../datadog/model_synthetics_test_details.go | 617 ++ .../model_synthetics_test_details_sub_type.go | 124 + .../model_synthetics_test_details_type.go | 109 + .../model_synthetics_test_execution_rule.go | 111 + .../model_synthetics_test_monitor_status.go | 114 + .../datadog/model_synthetics_test_options.go | 767 ++ ...synthetics_test_options_monitor_options.go | 104 + .../model_synthetics_test_options_retry.go | 143 + .../model_synthetics_test_pause_status.go | 110 + .../model_synthetics_test_process_status.go | 115 + .../datadog/model_synthetics_test_request.go | 945 +++ ...del_synthetics_test_request_certificate.go | 155 + ...ynthetics_test_request_certificate_item.go | 180 + .../model_synthetics_test_request_proxy.go | 142 + api/v1/datadog/model_synthetics_timing.go | 415 + .../datadog/model_synthetics_trigger_body.go | 103 + ...del_synthetics_trigger_ci_test_location.go | 141 + ...l_synthetics_trigger_ci_test_run_result.go | 227 + ...el_synthetics_trigger_ci_tests_response.go | 232 + .../datadog/model_synthetics_trigger_test_.go | 149 + ...hetics_update_test_pause_status_payload.go | 111 + .../model_synthetics_variable_parser.go | 150 + .../datadog/model_synthetics_warning_type.go | 107 + .../model_table_widget_cell_display_mode.go | 109 + .../datadog/model_table_widget_definition.go | 403 + .../model_table_widget_definition_type.go | 107 + .../model_table_widget_has_search_bar.go | 111 + api/v1/datadog/model_table_widget_request.go | 891 +++ api/v1/datadog/model_tag_to_hosts.go | 102 + api/v1/datadog/model_target_format_type.go | 115 + api/v1/datadog/model_timeseries_background.go | 159 + .../model_timeseries_background_type.go | 109 + .../model_timeseries_widget_definition.go | 690 ++ ...model_timeseries_widget_definition_type.go | 107 + ...odel_timeseries_widget_expression_alias.go | 142 + .../model_timeseries_widget_legend_column.go | 115 + .../model_timeseries_widget_legend_layout.go | 111 + .../model_timeseries_widget_request.go | 812 ++ .../model_toplist_widget_definition.go | 356 + .../model_toplist_widget_definition_type.go | 107 + .../datadog/model_toplist_widget_request.go | 726 ++ api/v1/datadog/model_tree_map_color_by.go | 107 + api/v1/datadog/model_tree_map_group_by.go | 111 + api/v1/datadog/model_tree_map_size_by.go | 109 + .../model_tree_map_widget_definition.go | 427 ++ .../model_tree_map_widget_definition_type.go | 107 + .../datadog/model_tree_map_widget_request.go | 227 + .../datadog/model_usage_analyzed_logs_hour.go | 224 + .../model_usage_analyzed_logs_response.go | 102 + ...model_usage_attribution_aggregates_body.go | 180 + .../datadog/model_usage_attribution_body.go | 352 + .../model_usage_attribution_metadata.go | 148 + .../model_usage_attribution_pagination.go | 258 + .../model_usage_attribution_response.go | 148 + .../datadog/model_usage_attribution_sort.go | 161 + ...del_usage_attribution_supported_metrics.go | 183 + .../datadog/model_usage_attribution_values.go | 1779 +++++ api/v1/datadog/model_usage_audit_logs_hour.go | 224 + .../model_usage_audit_logs_response.go | 102 + .../model_usage_billable_summary_body.go | 345 + .../model_usage_billable_summary_hour.go | 391 + .../model_usage_billable_summary_keys.go | 3697 +++++++++ .../model_usage_billable_summary_response.go | 102 + .../datadog/model_usage_ci_visibility_hour.go | 297 + .../model_usage_ci_visibility_response.go | 102 + ..._cloud_security_posture_management_hour.go | 437 ++ ...ud_security_posture_management_response.go | 102 + .../model_usage_custom_reports_attributes.go | 258 + .../model_usage_custom_reports_data.go | 199 + .../model_usage_custom_reports_meta.go | 109 + .../model_usage_custom_reports_page.go | 102 + .../model_usage_custom_reports_response.go | 148 + api/v1/datadog/model_usage_cws_hour.go | 263 + api/v1/datadog/model_usage_cws_response.go | 102 + api/v1/datadog/model_usage_dbm_hour.go | 263 + api/v1/datadog/model_usage_dbm_response.go | 102 + api/v1/datadog/model_usage_fargate_hour.go | 263 + .../datadog/model_usage_fargate_response.go | 102 + api/v1/datadog/model_usage_host_hour.go | 701 ++ api/v1/datadog/model_usage_hosts_response.go | 102 + .../model_usage_incident_management_hour.go | 224 + ...odel_usage_incident_management_response.go | 102 + .../datadog/model_usage_indexed_spans_hour.go | 224 + .../model_usage_indexed_spans_response.go | 102 + .../model_usage_ingested_spans_hour.go | 224 + .../model_usage_ingested_spans_response.go | 102 + api/v1/datadog/model_usage_io_t_hour.go | 224 + api/v1/datadog/model_usage_io_t_response.go | 102 + api/v1/datadog/model_usage_lambda_hour.go | 264 + api/v1/datadog/model_usage_lambda_response.go | 103 + .../datadog/model_usage_logs_by_index_hour.go | 341 + .../model_usage_logs_by_index_response.go | 102 + .../model_usage_logs_by_retention_hour.go | 297 + .../model_usage_logs_by_retention_response.go | 102 + api/v1/datadog/model_usage_logs_hour.go | 458 ++ api/v1/datadog/model_usage_logs_response.go | 102 + api/v1/datadog/model_usage_metric_category.go | 109 + .../datadog/model_usage_network_flows_hour.go | 224 + .../model_usage_network_flows_response.go | 102 + .../datadog/model_usage_network_hosts_hour.go | 224 + .../model_usage_network_hosts_response.go | 102 + .../model_usage_online_archive_hour.go | 224 + .../model_usage_online_archive_response.go | 102 + api/v1/datadog/model_usage_profiling_hour.go | 263 + .../datadog/model_usage_profiling_response.go | 102 + api/v1/datadog/model_usage_reports_type.go | 107 + .../datadog/model_usage_rum_sessions_hour.go | 426 ++ .../model_usage_rum_sessions_response.go | 102 + api/v1/datadog/model_usage_rum_units_hour.go | 271 + .../datadog/model_usage_rum_units_response.go | 102 + api/v1/datadog/model_usage_sds_hour.go | 263 + api/v1/datadog/model_usage_sds_response.go | 102 + api/v1/datadog/model_usage_snmp_hour.go | 224 + api/v1/datadog/model_usage_snmp_response.go | 102 + api/v1/datadog/model_usage_sort.go | 113 + api/v1/datadog/model_usage_sort_direction.go | 109 + ...age_specified_custom_reports_attributes.go | 297 + ...del_usage_specified_custom_reports_data.go | 199 + ...del_usage_specified_custom_reports_meta.go | 109 + ...del_usage_specified_custom_reports_page.go | 102 + ...usage_specified_custom_reports_response.go | 155 + api/v1/datadog/model_usage_summary_date.go | 2564 +++++++ .../datadog/model_usage_summary_date_org.go | 2598 +++++++ .../datadog/model_usage_summary_response.go | 2930 +++++++ .../model_usage_synthetics_api_hour.go | 224 + .../model_usage_synthetics_api_response.go | 102 + .../model_usage_synthetics_browser_hour.go | 224 + ...model_usage_synthetics_browser_response.go | 102 + api/v1/datadog/model_usage_synthetics_hour.go | 224 + .../model_usage_synthetics_response.go | 102 + api/v1/datadog/model_usage_timeseries_hour.go | 302 + .../model_usage_timeseries_response.go | 102 + .../model_usage_top_avg_metrics_hour.go | 227 + .../model_usage_top_avg_metrics_metadata.go | 196 + .../model_usage_top_avg_metrics_pagination.go | 193 + .../model_usage_top_avg_metrics_response.go | 148 + api/v1/datadog/model_user.go | 348 + api/v1/datadog/model_user_disable_response.go | 102 + api/v1/datadog/model_user_list_response.go | 102 + api/v1/datadog/model_user_response.go | 109 + api/v1/datadog/model_webhooks_integration.go | 295 + ...el_webhooks_integration_custom_variable.go | 170 + ...ks_integration_custom_variable_response.go | 176 + ...egration_custom_variable_update_request.go | 183 + .../model_webhooks_integration_encoding.go | 109 + ...del_webhooks_integration_update_request.go | 291 + api/v1/datadog/model_widget.go | 193 + api/v1/datadog/model_widget_aggregator.go | 117 + api/v1/datadog/model_widget_axis.go | 270 + api/v1/datadog/model_widget_change_type.go | 109 + .../datadog/model_widget_color_preference.go | 109 + api/v1/datadog/model_widget_comparator.go | 113 + api/v1/datadog/model_widget_compare_to.go | 113 + .../model_widget_conditional_format.go | 419 + api/v1/datadog/model_widget_custom_link.go | 219 + api/v1/datadog/model_widget_definition.go | 1019 +++ api/v1/datadog/model_widget_display_type.go | 111 + api/v1/datadog/model_widget_event.go | 145 + api/v1/datadog/model_widget_event_size.go | 109 + api/v1/datadog/model_widget_field_sort.go | 144 + api/v1/datadog/model_widget_formula.go | 274 + api/v1/datadog/model_widget_formula_limit.go | 153 + api/v1/datadog/model_widget_grouping.go | 109 + .../datadog/model_widget_horizontal_align.go | 111 + api/v1/datadog/model_widget_image_sizing.go | 122 + api/v1/datadog/model_widget_layout.go | 242 + api/v1/datadog/model_widget_layout_type.go | 107 + api/v1/datadog/model_widget_line_type.go | 111 + api/v1/datadog/model_widget_line_width.go | 111 + api/v1/datadog/model_widget_live_span.go | 135 + api/v1/datadog/model_widget_margin.go | 116 + api/v1/datadog/model_widget_marker.go | 224 + .../datadog/model_widget_message_display.go | 111 + ...l_widget_monitor_summary_display_format.go | 111 + .../model_widget_monitor_summary_sort.go | 135 + api/v1/datadog/model_widget_node_type.go | 109 + api/v1/datadog/model_widget_order_by.go | 113 + api/v1/datadog/model_widget_palette.go | 143 + api/v1/datadog/model_widget_request_style.go | 196 + ...l_widget_service_summary_display_format.go | 111 + api/v1/datadog/model_widget_size_format.go | 111 + api/v1/datadog/model_widget_sort.go | 109 + api/v1/datadog/model_widget_style.go | 102 + api/v1/datadog/model_widget_summary_type.go | 111 + api/v1/datadog/model_widget_text_align.go | 111 + api/v1/datadog/model_widget_tick_edge.go | 113 + api/v1/datadog/model_widget_time.go | 110 + api/v1/datadog/model_widget_time_windows_.go | 121 + api/v1/datadog/model_widget_vertical_align.go | 111 + api/v1/datadog/model_widget_view_mode.go | 111 + api/v1/datadog/model_widget_viz_type.go | 109 + api/v2/datadog/api_audit.go | 550 ++ api/v2/datadog/api_auth_n_mappings.go | 802 ++ api/v2/datadog/api_cloud_workload_security.go | 857 +++ api/v2/datadog/api_dashboard_lists.go | 625 ++ api/v2/datadog/api_events.go | 561 ++ api/v2/datadog/api_incident_services.go | 932 +++ api/v2/datadog/api_incident_teams.go | 932 +++ api/v2/datadog/api_incidents.go | 1001 +++ api/v2/datadog/api_key_management.go | 2351 ++++++ api/v2/datadog/api_logs.go | 951 +++ api/v2/datadog/api_logs_archives.go | 1444 ++++ api/v2/datadog/api_logs_metrics.go | 721 ++ api/v2/datadog/api_metrics.go | 1841 +++++ api/v2/datadog/api_opsgenie_integration.go | 755 ++ api/v2/datadog/api_organizations.go | 190 + api/v2/datadog/api_processes.go | 309 + api/v2/datadog/api_roles.go | 2036 +++++ api/v2/datadog/api_rum.go | 667 ++ api/v2/datadog/api_security_monitoring.go | 2443 ++++++ api/v2/datadog/api_service_accounts.go | 832 ++ api/v2/datadog/api_usage_metering.go | 1143 +++ api/v2/datadog/api_users.go | 1517 ++++ api/v2/datadog/model_api_error_response.go | 103 + .../model_api_key_create_attributes.go | 103 + api/v2/datadog/model_api_key_create_data.go | 153 + .../datadog/model_api_key_create_request.go | 110 + api/v2/datadog/model_api_key_relationships.go | 155 + api/v2/datadog/model_api_key_response.go | 148 + .../model_api_key_response_included_item.go | 123 + .../model_api_key_update_attributes.go | 103 + api/v2/datadog/model_api_key_update_data.go | 186 + .../datadog/model_api_key_update_request.go | 110 + api/v2/datadog/model_api_keys_response.go | 141 + api/v2/datadog/model_api_keys_sort.go | 121 + api/v2/datadog/model_api_keys_type.go | 107 + ...model_application_key_create_attributes.go | 143 + .../model_application_key_create_data.go | 153 + .../model_application_key_create_request.go | 110 + .../model_application_key_relationships.go | 109 + .../datadog/model_application_key_response.go | 148 + ..._application_key_response_included_item.go | 155 + ...model_application_key_update_attributes.go | 142 + .../model_application_key_update_data.go | 186 + .../model_application_key_update_request.go | 110 + api/v2/datadog/model_application_keys_sort.go | 117 + api/v2/datadog/model_application_keys_type.go | 107 + api/v2/datadog/model_audit_logs_event.go | 199 + .../model_audit_logs_event_attributes.go | 226 + api/v2/datadog/model_audit_logs_event_type.go | 107 + .../model_audit_logs_events_response.go | 194 + .../datadog/model_audit_logs_query_filter.go | 192 + .../datadog/model_audit_logs_query_options.go | 146 + .../model_audit_logs_query_page_options.go | 145 + .../model_audit_logs_response_links.go | 103 + .../model_audit_logs_response_metadata.go | 274 + .../datadog/model_audit_logs_response_page.go | 102 + .../model_audit_logs_response_status.go | 109 + .../model_audit_logs_search_events_request.go | 249 + api/v2/datadog/model_audit_logs_sort.go | 109 + api/v2/datadog/model_audit_logs_warning.go | 180 + api/v2/datadog/model_auth_n_mapping.go | 238 + .../model_auth_n_mapping_attributes.go | 267 + .../model_auth_n_mapping_create_attributes.go | 141 + .../model_auth_n_mapping_create_data.go | 205 + ...del_auth_n_mapping_create_relationships.go | 109 + .../model_auth_n_mapping_create_request.go | 110 + .../datadog/model_auth_n_mapping_included.go | 155 + .../model_auth_n_mapping_relationships.go | 155 + .../datadog/model_auth_n_mapping_response.go | 148 + .../model_auth_n_mapping_update_attributes.go | 141 + .../model_auth_n_mapping_update_data.go | 238 + ...del_auth_n_mapping_update_relationships.go | 109 + .../model_auth_n_mapping_update_request.go | 110 + .../datadog/model_auth_n_mappings_response.go | 187 + api/v2/datadog/model_auth_n_mappings_sort.go | 129 + api/v2/datadog/model_auth_n_mappings_type.go | 107 + api/v2/datadog/model_chargeback_breakdown.go | 180 + ...workload_security_agent_rule_attributes.go | 506 ++ ...d_security_agent_rule_create_attributes.go | 214 + ...orkload_security_agent_rule_create_data.go | 153 + ...load_security_agent_rule_create_request.go | 110 + ..._security_agent_rule_creator_attributes.go | 141 + ...cloud_workload_security_agent_rule_data.go | 199 + ...d_workload_security_agent_rule_response.go | 109 + ...cloud_workload_security_agent_rule_type.go | 107 + ...d_security_agent_rule_update_attributes.go | 180 + ...orkload_security_agent_rule_update_data.go | 153 + ...load_security_agent_rule_update_request.go | 110 + ..._security_agent_rule_updater_attributes.go | 141 + ...load_security_agent_rules_list_response.go | 102 + api/v2/datadog/model_content_encoding.go | 109 + api/v2/datadog/model_cost_by_org.go | 199 + .../datadog/model_cost_by_org_attributes.go | 263 + api/v2/datadog/model_cost_by_org_response.go | 102 + api/v2/datadog/model_cost_by_org_type.go | 107 + api/v2/datadog/model_creator.go | 180 + .../model_dashboard_list_add_items_request.go | 102 + ...model_dashboard_list_add_items_response.go | 102 + ...del_dashboard_list_delete_items_request.go | 102 + ...el_dashboard_list_delete_items_response.go | 102 + api/v2/datadog/model_dashboard_list_item.go | 550 ++ .../model_dashboard_list_item_request.go | 144 + .../model_dashboard_list_item_response.go | 144 + api/v2/datadog/model_dashboard_list_items.go | 142 + ...del_dashboard_list_update_items_request.go | 102 + ...el_dashboard_list_update_items_response.go | 102 + api/v2/datadog/model_dashboard_type.go | 115 + api/v2/datadog/model_event.go | 219 + api/v2/datadog/model_event_attributes.go | 869 +++ api/v2/datadog/model_event_priority.go | 109 + api/v2/datadog/model_event_response.go | 199 + .../model_event_response_attributes.go | 192 + api/v2/datadog/model_event_status_type.go | 123 + api/v2/datadog/model_event_type.go | 107 + api/v2/datadog/model_events_list_request.go | 249 + api/v2/datadog/model_events_list_response.go | 194 + .../model_events_list_response_links.go | 103 + api/v2/datadog/model_events_query_filter.go | 192 + api/v2/datadog/model_events_query_options.go | 146 + api/v2/datadog/model_events_request_page.go | 145 + .../datadog/model_events_response_metadata.go | 227 + .../model_events_response_metadata_page.go | 103 + api/v2/datadog/model_events_sort.go | 109 + api/v2/datadog/model_events_warning.go | 180 + api/v2/datadog/model_full_api_key.go | 245 + .../datadog/model_full_api_key_attributes.go | 258 + api/v2/datadog/model_full_application_key.go | 245 + .../model_full_application_key_attributes.go | 259 + api/v2/datadog/model_hourly_usage.go | 199 + .../datadog/model_hourly_usage_attributes.go | 302 + .../datadog/model_hourly_usage_measurement.go | 154 + api/v2/datadog/model_hourly_usage_metadata.go | 109 + .../datadog/model_hourly_usage_pagination.go | 115 + api/v2/datadog/model_hourly_usage_response.go | 148 + api/v2/datadog/model_hourly_usage_type.go | 111 + api/v2/datadog/model_http_log_error.go | 180 + api/v2/datadog/model_http_log_errors.go | 102 + api/v2/datadog/model_http_log_item.go | 265 + .../datadog/model_id_p_metadata_form_data.go | 103 + .../model_incident_create_attributes.go | 253 + api/v2/datadog/model_incident_create_data.go | 199 + .../model_incident_create_relationships.go | 110 + .../datadog/model_incident_create_request.go | 110 + .../model_incident_field_attributes.go | 155 + ...ncident_field_attributes_multiple_value.go | 154 + ..._incident_field_attributes_single_value.go | 166 + ...dent_field_attributes_single_value_type.go | 109 + ...el_incident_field_attributes_value_type.go | 113 + ...odel_incident_integration_metadata_type.go | 107 + .../model_incident_notification_handle.go | 141 + .../datadog/model_incident_postmortem_type.go | 107 + .../datadog/model_incident_related_object.go | 107 + api/v2/datadog/model_incident_response.go | 149 + .../model_incident_response_attributes.go | 835 ++ .../datadog/model_incident_response_data.go | 238 + .../model_incident_response_included_item.go | 123 + .../datadog/model_incident_response_meta.go | 109 + ...model_incident_response_meta_pagination.go | 180 + .../model_incident_response_relationships.go | 293 + ...odel_incident_service_create_attributes.go | 103 + .../model_incident_service_create_data.go | 205 + .../model_incident_service_create_request.go | 110 + .../model_incident_service_included_items.go | 123 + .../model_incident_service_relationships.go | 155 + .../model_incident_service_response.go | 149 + ...el_incident_service_response_attributes.go | 189 + .../model_incident_service_response_data.go | 238 + api/v2/datadog/model_incident_service_type.go | 107 + ...odel_incident_service_update_attributes.go | 103 + .../model_incident_service_update_data.go | 244 + .../model_incident_service_update_request.go | 110 + .../model_incident_services_response.go | 188 + .../model_incident_team_create_attributes.go | 103 + .../model_incident_team_create_data.go | 205 + .../model_incident_team_create_request.go | 110 + .../model_incident_team_included_items.go | 123 + .../model_incident_team_relationships.go | 155 + .../datadog/model_incident_team_response.go | 149 + ...model_incident_team_response_attributes.go | 189 + .../model_incident_team_response_data.go | 245 + api/v2/datadog/model_incident_team_type.go | 107 + .../model_incident_team_update_attributes.go | 103 + .../model_incident_team_update_data.go | 244 + .../model_incident_team_update_request.go | 110 + .../datadog/model_incident_teams_response.go | 188 + ...ncident_timeline_cell_create_attributes.go | 123 + ...ent_timeline_cell_markdown_content_type.go | 107 + ...imeline_cell_markdown_create_attributes.go | 196 + ...cell_markdown_create_attributes_content.go | 102 + api/v2/datadog/model_incident_type.go | 107 + .../model_incident_update_attributes.go | 461 ++ api/v2/datadog/model_incident_update_data.go | 238 + .../model_incident_update_relationships.go | 201 + .../datadog/model_incident_update_request.go | 110 + api/v2/datadog/model_incidents_response.go | 188 + .../datadog/model_intake_payload_accepted.go | 102 + .../model_list_application_keys_response.go | 141 + api/v2/datadog/model_log.go | 199 + api/v2/datadog/model_log_attributes.go | 345 + api/v2/datadog/model_log_type.go | 107 + api/v2/datadog/model_logs_aggregate_bucket.go | 141 + .../model_logs_aggregate_bucket_value.go | 187 + ..._logs_aggregate_bucket_value_timeseries.go | 51 + ...aggregate_bucket_value_timeseries_point.go | 141 + .../datadog/model_logs_aggregate_request.go | 280 + .../model_logs_aggregate_request_page.go | 102 + .../datadog/model_logs_aggregate_response.go | 155 + .../model_logs_aggregate_response_data.go | 102 + .../model_logs_aggregate_response_status.go | 109 + api/v2/datadog/model_logs_aggregate_sort.go | 247 + .../datadog/model_logs_aggregate_sort_type.go | 109 + .../model_logs_aggregation_function.go | 129 + api/v2/datadog/model_logs_archive.go | 109 + .../datadog/model_logs_archive_attributes.go | 353 + .../model_logs_archive_create_request.go | 109 + ..._logs_archive_create_request_attributes.go | 304 + ..._logs_archive_create_request_definition.go | 151 + ...logs_archive_create_request_destination.go | 187 + .../datadog/model_logs_archive_definition.go | 188 + .../datadog/model_logs_archive_destination.go | 187 + .../model_logs_archive_destination_azure.go | 297 + ...del_logs_archive_destination_azure_type.go | 107 + .../model_logs_archive_destination_gcs.go | 225 + ...model_logs_archive_destination_gcs_type.go | 107 + .../model_logs_archive_destination_s3.go | 225 + .../model_logs_archive_destination_s3_type.go | 107 + .../model_logs_archive_integration_azure.go | 136 + .../model_logs_archive_integration_gcs.go | 136 + .../model_logs_archive_integration_s3.go | 136 + api/v2/datadog/model_logs_archive_order.go | 109 + .../model_logs_archive_order_attributes.go | 104 + .../model_logs_archive_order_definition.go | 153 + ...odel_logs_archive_order_definition_type.go | 107 + api/v2/datadog/model_logs_archive_state.go | 113 + api/v2/datadog/model_logs_archives.go | 102 + api/v2/datadog/model_logs_compute.go | 241 + api/v2/datadog/model_logs_compute_type.go | 109 + api/v2/datadog/model_logs_group_by.go | 317 + .../datadog/model_logs_group_by_histogram.go | 172 + api/v2/datadog/model_logs_group_by_missing.go | 155 + api/v2/datadog/model_logs_group_by_total.go | 187 + api/v2/datadog/model_logs_list_request.go | 249 + .../datadog/model_logs_list_request_page.go | 145 + api/v2/datadog/model_logs_list_response.go | 194 + .../datadog/model_logs_list_response_links.go | 103 + api/v2/datadog/model_logs_metric_compute.go | 150 + ...el_logs_metric_compute_aggregation_type.go | 109 + .../model_logs_metric_create_attributes.go | 195 + .../datadog/model_logs_metric_create_data.go | 186 + .../model_logs_metric_create_request.go | 110 + api/v2/datadog/model_logs_metric_filter.go | 106 + api/v2/datadog/model_logs_metric_group_by.go | 142 + api/v2/datadog/model_logs_metric_response.go | 109 + .../model_logs_metric_response_attributes.go | 194 + .../model_logs_metric_response_compute.go | 149 + ...etric_response_compute_aggregation_type.go | 109 + .../model_logs_metric_response_data.go | 199 + .../model_logs_metric_response_filter.go | 102 + .../model_logs_metric_response_group_by.go | 141 + api/v2/datadog/model_logs_metric_type.go | 107 + .../model_logs_metric_update_attributes.go | 148 + .../datadog/model_logs_metric_update_data.go | 153 + .../model_logs_metric_update_request.go | 110 + api/v2/datadog/model_logs_metrics_response.go | 102 + api/v2/datadog/model_logs_query_filter.go | 231 + api/v2/datadog/model_logs_query_options.go | 146 + .../datadog/model_logs_response_metadata.go | 274 + .../model_logs_response_metadata_page.go | 103 + api/v2/datadog/model_logs_sort.go | 109 + api/v2/datadog/model_logs_sort_order.go | 109 + api/v2/datadog/model_logs_warning.go | 180 + api/v2/datadog/model_metric.go | 153 + api/v2/datadog/model_metric_all_tags.go | 199 + .../model_metric_all_tags_attributes.go | 102 + .../datadog/model_metric_all_tags_response.go | 109 + .../model_metric_bulk_configure_tags_type.go | 107 + .../model_metric_bulk_tag_config_create.go | 192 + ...etric_bulk_tag_config_create_attributes.go | 141 + ...l_metric_bulk_tag_config_create_request.go | 110 + .../model_metric_bulk_tag_config_delete.go | 192 + ...etric_bulk_tag_config_delete_attributes.go | 102 + ...l_metric_bulk_tag_config_delete_request.go | 110 + .../model_metric_bulk_tag_config_response.go | 110 + .../model_metric_bulk_tag_config_status.go | 193 + ...etric_bulk_tag_config_status_attributes.go | 180 + .../datadog/model_metric_content_encoding.go | 107 + .../model_metric_custom_aggregation.go | 152 + .../model_metric_custom_space_aggregation.go | 113 + .../model_metric_custom_time_aggregation.go | 115 + .../datadog/model_metric_distinct_volume.go | 199 + ...model_metric_distinct_volume_attributes.go | 102 + .../model_metric_distinct_volume_type.go | 107 + api/v2/datadog/model_metric_estimate.go | 199 + .../model_metric_estimate_attributes.go | 197 + .../model_metric_estimate_resource_type.go | 107 + .../datadog/model_metric_estimate_response.go | 109 + api/v2/datadog/model_metric_estimate_type.go | 111 + .../model_metric_ingested_indexed_volume.go | 199 + ...tric_ingested_indexed_volume_attributes.go | 141 + ...del_metric_ingested_indexed_volume_type.go | 107 + api/v2/datadog/model_metric_intake_type.go | 113 + api/v2/datadog/model_metric_metadata.go | 109 + api/v2/datadog/model_metric_origin.go | 192 + api/v2/datadog/model_metric_payload.go | 103 + api/v2/datadog/model_metric_point.go | 142 + api/v2/datadog/model_metric_resource.go | 141 + api/v2/datadog/model_metric_series.go | 425 ++ .../datadog/model_metric_tag_configuration.go | 199 + ...del_metric_tag_configuration_attributes.go | 334 + ...ric_tag_configuration_create_attributes.go | 240 + ...el_metric_tag_configuration_create_data.go | 192 + ...metric_tag_configuration_create_request.go | 110 + ...l_metric_tag_configuration_metric_types.go | 113 + ...model_metric_tag_configuration_response.go | 109 + .../model_metric_tag_configuration_type.go | 107 + ...ric_tag_configuration_update_attributes.go | 196 + ...el_metric_tag_configuration_update_data.go | 192 + ...metric_tag_configuration_update_request.go | 110 + api/v2/datadog/model_metric_type.go | 107 + api/v2/datadog/model_metric_volumes.go | 155 + .../datadog/model_metric_volumes_response.go | 102 + ...l_metrics_and_metric_tag_configurations.go | 155 + ..._and_metric_tag_configurations_response.go | 102 + api/v2/datadog/model_monitor_type.go | 542 ++ .../model_nullable_relationship_to_user.go | 105 + ...odel_nullable_relationship_to_user_data.go | 196 + ...odel_opsgenie_service_create_attributes.go | 216 + .../model_opsgenie_service_create_data.go | 153 + .../model_opsgenie_service_create_request.go | 110 + .../model_opsgenie_service_region_type.go | 111 + .../model_opsgenie_service_response.go | 110 + ...el_opsgenie_service_response_attributes.go | 201 + .../model_opsgenie_service_response_data.go | 186 + api/v2/datadog/model_opsgenie_service_type.go | 107 + ...odel_opsgenie_service_update_attributes.go | 240 + .../model_opsgenie_service_update_data.go | 186 + .../model_opsgenie_service_update_request.go | 110 + .../model_opsgenie_services_response.go | 103 + api/v2/datadog/model_organization.go | 198 + .../datadog/model_organization_attributes.go | 384 + api/v2/datadog/model_organizations_type.go | 107 + api/v2/datadog/model_pagination.go | 141 + api/v2/datadog/model_partial_api_key.go | 245 + .../model_partial_api_key_attributes.go | 219 + .../datadog/model_partial_application_key.go | 245 + ...odel_partial_application_key_attributes.go | 220 + .../model_partial_application_key_response.go | 148 + api/v2/datadog/model_permission.go | 198 + api/v2/datadog/model_permission_attributes.go | 341 + api/v2/datadog/model_permissions_response.go | 102 + api/v2/datadog/model_permissions_type.go | 107 + .../datadog/model_process_summaries_meta.go | 109 + .../model_process_summaries_meta_page.go | 142 + .../model_process_summaries_response.go | 148 + api/v2/datadog/model_process_summary.go | 199 + .../model_process_summary_attributes.go | 375 + api/v2/datadog/model_process_summary_type.go | 107 + api/v2/datadog/model_query_sort_order.go | 109 + ...p_to_incident_integration_metadata_data.go | 146 + ...nship_to_incident_integration_metadatas.go | 103 + ...del_relationship_to_incident_postmortem.go | 110 + ...elationship_to_incident_postmortem_data.go | 146 + .../model_relationship_to_organization.go | 110 + ...model_relationship_to_organization_data.go | 146 + .../model_relationship_to_organizations.go | 103 + .../model_relationship_to_permission.go | 109 + .../model_relationship_to_permission_data.go | 153 + .../model_relationship_to_permissions.go | 102 + api/v2/datadog/model_relationship_to_role.go | 109 + .../model_relationship_to_role_data.go | 153 + api/v2/datadog/model_relationship_to_roles.go | 102 + ...elationship_to_saml_assertion_attribute.go | 110 + ...onship_to_saml_assertion_attribute_data.go | 146 + api/v2/datadog/model_relationship_to_user.go | 110 + .../model_relationship_to_user_data.go | 146 + api/v2/datadog/model_relationship_to_users.go | 103 + .../datadog/model_response_meta_attributes.go | 109 + api/v2/datadog/model_role.go | 244 + api/v2/datadog/model_role_attributes.go | 228 + api/v2/datadog/model_role_clone.go | 153 + api/v2/datadog/model_role_clone_attributes.go | 103 + api/v2/datadog/model_role_clone_request.go | 110 + .../datadog/model_role_create_attributes.go | 190 + api/v2/datadog/model_role_create_data.go | 207 + api/v2/datadog/model_role_create_request.go | 110 + api/v2/datadog/model_role_create_response.go | 109 + .../model_role_create_response_data.go | 244 + api/v2/datadog/model_role_relationships.go | 155 + api/v2/datadog/model_role_response.go | 109 + .../model_role_response_relationships.go | 109 + .../datadog/model_role_update_attributes.go | 189 + api/v2/datadog/model_role_update_data.go | 186 + api/v2/datadog/model_role_update_request.go | 110 + api/v2/datadog/model_role_update_response.go | 109 + .../model_role_update_response_data.go | 244 + api/v2/datadog/model_roles_response.go | 148 + api/v2/datadog/model_roles_sort.go | 117 + api/v2/datadog/model_roles_type.go | 107 + .../model_rum_aggregate_bucket_value.go | 187 + ...l_rum_aggregate_bucket_value_timeseries.go | 51 + ...aggregate_bucket_value_timeseries_point.go | 146 + api/v2/datadog/model_rum_aggregate_request.go | 280 + api/v2/datadog/model_rum_aggregate_sort.go | 247 + .../datadog/model_rum_aggregate_sort_type.go | 109 + .../model_rum_aggregation_buckets_response.go | 102 + .../datadog/model_rum_aggregation_function.go | 129 + .../model_rum_analytics_aggregate_response.go | 201 + api/v2/datadog/model_rum_bucket_response.go | 141 + api/v2/datadog/model_rum_compute.go | 241 + api/v2/datadog/model_rum_compute_type.go | 109 + api/v2/datadog/model_rum_event.go | 199 + api/v2/datadog/model_rum_event_attributes.go | 226 + api/v2/datadog/model_rum_event_type.go | 107 + api/v2/datadog/model_rum_events_response.go | 194 + api/v2/datadog/model_rum_group_by.go | 317 + .../datadog/model_rum_group_by_histogram.go | 172 + api/v2/datadog/model_rum_group_by_missing.go | 155 + api/v2/datadog/model_rum_group_by_total.go | 187 + api/v2/datadog/model_rum_query_filter.go | 192 + api/v2/datadog/model_rum_query_options.go | 146 + .../datadog/model_rum_query_page_options.go | 145 + api/v2/datadog/model_rum_response_links.go | 103 + api/v2/datadog/model_rum_response_metadata.go | 274 + api/v2/datadog/model_rum_response_page.go | 102 + api/v2/datadog/model_rum_response_status.go | 109 + .../model_rum_search_events_request.go | 249 + api/v2/datadog/model_rum_sort.go | 109 + api/v2/datadog/model_rum_sort_order.go | 109 + api/v2/datadog/model_rum_warning.go | 180 + .../datadog/model_saml_assertion_attribute.go | 192 + ...del_saml_assertion_attribute_attributes.go | 141 + .../model_saml_assertion_attributes_type.go | 107 + api/v2/datadog/model_security_filter.go | 199 + .../model_security_filter_attributes.go | 344 + ...model_security_filter_create_attributes.go | 243 + .../model_security_filter_create_data.go | 153 + .../model_security_filter_create_request.go | 110 + .../model_security_filter_exclusion_filter.go | 136 + ...curity_filter_exclusion_filter_response.go | 141 + ...odel_security_filter_filtered_data_type.go | 107 + api/v2/datadog/model_security_filter_meta.go | 102 + .../datadog/model_security_filter_response.go | 155 + api/v2/datadog/model_security_filter_type.go | 107 + ...model_security_filter_update_attributes.go | 305 + .../model_security_filter_update_data.go | 153 + .../model_security_filter_update_request.go | 110 + .../model_security_filters_response.go | 148 + .../model_security_monitoring_filter.go | 149 + ...model_security_monitoring_filter_action.go | 109 + ...security_monitoring_list_rules_response.go | 148 + .../model_security_monitoring_rule_case.go | 228 + ...el_security_monitoring_rule_case_create.go | 229 + ...security_monitoring_rule_create_payload.go | 439 ++ ...curity_monitoring_rule_detection_method.go | 115 + ...urity_monitoring_rule_evaluation_window.go | 122 + ...onitoring_rule_hardcoded_evaluator_type.go | 107 + ...nitoring_rule_impossible_travel_options.go | 103 + ...del_security_monitoring_rule_keep_alive.go | 126 + ...ity_monitoring_rule_max_signal_duration.go | 130 + ...urity_monitoring_rule_new_value_options.go | 264 + ...ing_rule_new_value_options_forget_after.go | 117 + ...ule_new_value_options_learning_duration.go | 112 + ..._rule_new_value_options_learning_method.go | 109 + ...le_new_value_options_learning_threshold.go | 109 + .../model_security_monitoring_rule_options.go | 434 ++ .../model_security_monitoring_rule_query.go | 345 + ...urity_monitoring_rule_query_aggregation.go | 117 + ...l_security_monitoring_rule_query_create.go | 346 + ...model_security_monitoring_rule_response.go | 741 ++ ...model_security_monitoring_rule_severity.go | 115 + ...el_security_monitoring_rule_type_create.go | 109 + ...odel_security_monitoring_rule_type_read.go | 113 + ...security_monitoring_rule_update_payload.go | 460 ++ .../model_security_monitoring_signal.go | 200 + ...curity_monitoring_signal_archive_reason.go | 113 + ...oring_signal_assignee_update_attributes.go | 149 + ..._monitoring_signal_assignee_update_data.go | 110 + ...nitoring_signal_assignee_update_request.go | 110 + ...l_security_monitoring_signal_attributes.go | 225 + ...ring_signal_incidents_update_attributes.go | 142 + ...monitoring_signal_incidents_update_data.go | 110 + ...itoring_signal_incidents_update_request.go | 110 + ...security_monitoring_signal_list_request.go | 202 + ...y_monitoring_signal_list_request_filter.go | 189 + ...ity_monitoring_signal_list_request_page.go | 145 + .../model_security_monitoring_signal_state.go | 111 + ...nitoring_signal_state_update_attributes.go | 236 + ...ity_monitoring_signal_state_update_data.go | 110 + ..._monitoring_signal_state_update_request.go | 110 + ...ity_monitoring_signal_triage_attributes.go | 440 ++ ...ty_monitoring_signal_triage_update_data.go | 109 + ...onitoring_signal_triage_update_response.go | 110 + .../model_security_monitoring_signal_type.go | 107 + ...curity_monitoring_signals_list_response.go | 195 + ..._monitoring_signals_list_response_links.go | 103 + ...y_monitoring_signals_list_response_meta.go | 109 + ...itoring_signals_list_response_meta_page.go | 103 + .../model_security_monitoring_signals_sort.go | 109 + .../model_security_monitoring_triage_user.go | 220 + ...model_service_account_create_attributes.go | 214 + .../model_service_account_create_data.go | 199 + .../model_service_account_create_request.go | 110 + ...pplication_security_monitoring_response.go | 102 + .../datadog/model_usage_attributes_object.go | 266 + api/v2/datadog/model_usage_data_object.go | 199 + ...sage_lambda_traced_invocations_response.go | 102 + ..._usage_observability_pipelines_response.go | 102 + .../datadog/model_usage_time_series_object.go | 159 + .../datadog/model_usage_time_series_type.go | 107 + api/v2/datadog/model_user.go | 245 + api/v2/datadog/model_user_attributes.go | 525 ++ .../datadog/model_user_create_attributes.go | 181 + api/v2/datadog/model_user_create_data.go | 199 + api/v2/datadog/model_user_create_request.go | 110 + api/v2/datadog/model_user_invitation_data.go | 153 + .../model_user_invitation_data_attributes.go | 228 + .../model_user_invitation_relationships.go | 110 + .../datadog/model_user_invitation_response.go | 109 + .../model_user_invitation_response_data.go | 199 + .../datadog/model_user_invitations_request.go | 103 + .../model_user_invitations_response.go | 102 + api/v2/datadog/model_user_invitations_type.go | 107 + api/v2/datadog/model_user_relationships.go | 109 + api/v2/datadog/model_user_response.go | 148 + .../model_user_response_included_item.go | 187 + .../model_user_response_relationships.go | 247 + .../datadog/model_user_update_attributes.go | 180 + api/v2/datadog/model_user_update_data.go | 186 + api/v2/datadog/model_user_update_request.go | 110 + api/v2/datadog/model_users_response.go | 187 + api/v2/datadog/model_users_type.go | 107 + 1285 files changed, 310068 insertions(+) create mode 100644 api/common/client.go create mode 100644 api/common/configuration.go create mode 100644 api/common/no_zstd.go create mode 100644 api/common/utils.go create mode 100644 api/common/zstd.go create mode 100644 api/v1/datadog/api_authentication.go create mode 100644 api/v1/datadog/api_aws_integration.go create mode 100644 api/v1/datadog/api_aws_logs_integration.go create mode 100644 api/v1/datadog/api_azure_integration.go create mode 100644 api/v1/datadog/api_dashboard_lists.go create mode 100644 api/v1/datadog/api_dashboards.go create mode 100644 api/v1/datadog/api_downtimes.go create mode 100644 api/v1/datadog/api_events.go create mode 100644 api/v1/datadog/api_gcp_integration.go create mode 100644 api/v1/datadog/api_hosts.go create mode 100644 api/v1/datadog/api_ip_ranges.go create mode 100644 api/v1/datadog/api_key_management.go create mode 100644 api/v1/datadog/api_logs.go create mode 100644 api/v1/datadog/api_logs_indexes.go create mode 100644 api/v1/datadog/api_logs_pipelines.go create mode 100644 api/v1/datadog/api_metrics.go create mode 100644 api/v1/datadog/api_monitors.go create mode 100644 api/v1/datadog/api_notebooks.go create mode 100644 api/v1/datadog/api_organizations.go create mode 100644 api/v1/datadog/api_pager_duty_integration.go create mode 100644 api/v1/datadog/api_security_monitoring.go create mode 100644 api/v1/datadog/api_service_checks.go create mode 100644 api/v1/datadog/api_service_level_objective_corrections.go create mode 100644 api/v1/datadog/api_service_level_objectives.go create mode 100644 api/v1/datadog/api_slack_integration.go create mode 100644 api/v1/datadog/api_snapshots.go create mode 100644 api/v1/datadog/api_synthetics.go create mode 100644 api/v1/datadog/api_tags.go create mode 100644 api/v1/datadog/api_usage_metering.go create mode 100644 api/v1/datadog/api_users.go create mode 100644 api/v1/datadog/api_webhooks_integration.go create mode 100644 api/v1/datadog/model_access_role.go create mode 100644 api/v1/datadog/model_add_signal_to_incident_request.go create mode 100644 api/v1/datadog/model_alert_graph_widget_definition.go create mode 100644 api/v1/datadog/model_alert_graph_widget_definition_type.go create mode 100644 api/v1/datadog/model_alert_value_widget_definition.go create mode 100644 api/v1/datadog/model_alert_value_widget_definition_type.go create mode 100644 api/v1/datadog/model_api_error_response.go create mode 100644 api/v1/datadog/model_api_key.go create mode 100644 api/v1/datadog/model_api_key_list_response.go create mode 100644 api/v1/datadog/model_api_key_response.go create mode 100644 api/v1/datadog/model_apm_stats_query_column_type.go create mode 100644 api/v1/datadog/model_apm_stats_query_definition.go create mode 100644 api/v1/datadog/model_apm_stats_query_row_type.go create mode 100644 api/v1/datadog/model_application_key.go create mode 100644 api/v1/datadog/model_application_key_list_response.go create mode 100644 api/v1/datadog/model_application_key_response.go create mode 100644 api/v1/datadog/model_authentication_validation_response.go create mode 100644 api/v1/datadog/model_aws_account.go create mode 100644 api/v1/datadog/model_aws_account_and_lambda_request.go create mode 100644 api/v1/datadog/model_aws_account_create_response.go create mode 100644 api/v1/datadog/model_aws_account_delete_request.go create mode 100644 api/v1/datadog/model_aws_account_list_response.go create mode 100644 api/v1/datadog/model_aws_logs_async_error.go create mode 100644 api/v1/datadog/model_aws_logs_async_response.go create mode 100644 api/v1/datadog/model_aws_logs_lambda.go create mode 100644 api/v1/datadog/model_aws_logs_list_response.go create mode 100644 api/v1/datadog/model_aws_logs_list_services_response.go create mode 100644 api/v1/datadog/model_aws_logs_services_request.go create mode 100644 api/v1/datadog/model_aws_namespace.go create mode 100644 api/v1/datadog/model_aws_tag_filter.go create mode 100644 api/v1/datadog/model_aws_tag_filter_create_request.go create mode 100644 api/v1/datadog/model_aws_tag_filter_delete_request.go create mode 100644 api/v1/datadog/model_aws_tag_filter_list_response.go create mode 100644 api/v1/datadog/model_azure_account.go create mode 100644 api/v1/datadog/model_cancel_downtimes_by_scope_request.go create mode 100644 api/v1/datadog/model_canceled_downtimes_ids.go create mode 100644 api/v1/datadog/model_change_widget_definition.go create mode 100644 api/v1/datadog/model_change_widget_definition_type.go create mode 100644 api/v1/datadog/model_change_widget_request.go create mode 100644 api/v1/datadog/model_check_can_delete_monitor_response.go create mode 100644 api/v1/datadog/model_check_can_delete_monitor_response_data.go create mode 100644 api/v1/datadog/model_check_can_delete_slo_response.go create mode 100644 api/v1/datadog/model_check_can_delete_slo_response_data.go create mode 100644 api/v1/datadog/model_check_status_widget_definition.go create mode 100644 api/v1/datadog/model_check_status_widget_definition_type.go create mode 100644 api/v1/datadog/model_content_encoding.go create mode 100644 api/v1/datadog/model_creator.go create mode 100644 api/v1/datadog/model_dashboard.go create mode 100644 api/v1/datadog/model_dashboard_bulk_action_data.go create mode 100644 api/v1/datadog/model_dashboard_bulk_delete_request.go create mode 100644 api/v1/datadog/model_dashboard_delete_response.go create mode 100644 api/v1/datadog/model_dashboard_layout_type.go create mode 100644 api/v1/datadog/model_dashboard_list.go create mode 100644 api/v1/datadog/model_dashboard_list_delete_response.go create mode 100644 api/v1/datadog/model_dashboard_list_list_response.go create mode 100644 api/v1/datadog/model_dashboard_reflow_type.go create mode 100644 api/v1/datadog/model_dashboard_resource_type.go create mode 100644 api/v1/datadog/model_dashboard_restore_request.go create mode 100644 api/v1/datadog/model_dashboard_summary.go create mode 100644 api/v1/datadog/model_dashboard_summary_definition.go create mode 100644 api/v1/datadog/model_dashboard_template_variable.go create mode 100644 api/v1/datadog/model_dashboard_template_variable_preset.go create mode 100644 api/v1/datadog/model_dashboard_template_variable_preset_value.go create mode 100644 api/v1/datadog/model_deleted_monitor.go create mode 100644 api/v1/datadog/model_distribution_point_item.go create mode 100644 api/v1/datadog/model_distribution_points_content_encoding.go create mode 100644 api/v1/datadog/model_distribution_points_payload.go create mode 100644 api/v1/datadog/model_distribution_points_series.go create mode 100644 api/v1/datadog/model_distribution_points_type.go create mode 100644 api/v1/datadog/model_distribution_widget_definition.go create mode 100644 api/v1/datadog/model_distribution_widget_definition_type.go create mode 100644 api/v1/datadog/model_distribution_widget_histogram_request_query.go create mode 100644 api/v1/datadog/model_distribution_widget_histogram_request_type.go create mode 100644 api/v1/datadog/model_distribution_widget_request.go create mode 100644 api/v1/datadog/model_distribution_widget_x_axis.go create mode 100644 api/v1/datadog/model_distribution_widget_y_axis.go create mode 100644 api/v1/datadog/model_downtime.go create mode 100644 api/v1/datadog/model_downtime_child.go create mode 100644 api/v1/datadog/model_downtime_recurrence.go create mode 100644 api/v1/datadog/model_event.go create mode 100644 api/v1/datadog/model_event_alert_type.go create mode 100644 api/v1/datadog/model_event_create_request.go create mode 100644 api/v1/datadog/model_event_create_response.go create mode 100644 api/v1/datadog/model_event_list_response.go create mode 100644 api/v1/datadog/model_event_priority.go create mode 100644 api/v1/datadog/model_event_query_definition.go create mode 100644 api/v1/datadog/model_event_response.go create mode 100644 api/v1/datadog/model_event_stream_widget_definition.go create mode 100644 api/v1/datadog/model_event_stream_widget_definition_type.go create mode 100644 api/v1/datadog/model_event_timeline_widget_definition.go create mode 100644 api/v1/datadog/model_event_timeline_widget_definition_type.go create mode 100644 api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go create mode 100644 api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go create mode 100644 api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go create mode 100644 api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go create mode 100644 api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go create mode 100644 api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go create mode 100644 api/v1/datadog/model_formula_and_function_event_aggregation.go create mode 100644 api/v1/datadog/model_formula_and_function_event_query_definition.go create mode 100644 api/v1/datadog/model_formula_and_function_event_query_definition_compute.go create mode 100644 api/v1/datadog/model_formula_and_function_event_query_definition_search.go create mode 100644 api/v1/datadog/model_formula_and_function_event_query_group_by.go create mode 100644 api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go create mode 100644 api/v1/datadog/model_formula_and_function_events_data_source.go create mode 100644 api/v1/datadog/model_formula_and_function_metric_aggregation.go create mode 100644 api/v1/datadog/model_formula_and_function_metric_data_source.go create mode 100644 api/v1/datadog/model_formula_and_function_metric_query_definition.go create mode 100644 api/v1/datadog/model_formula_and_function_process_query_data_source.go create mode 100644 api/v1/datadog/model_formula_and_function_process_query_definition.go create mode 100644 api/v1/datadog/model_formula_and_function_query_definition.go create mode 100644 api/v1/datadog/model_formula_and_function_response_format.go create mode 100644 api/v1/datadog/model_free_text_widget_definition.go create mode 100644 api/v1/datadog/model_free_text_widget_definition_type.go create mode 100644 api/v1/datadog/model_funnel_query.go create mode 100644 api/v1/datadog/model_funnel_request_type.go create mode 100644 api/v1/datadog/model_funnel_source.go create mode 100644 api/v1/datadog/model_funnel_step.go create mode 100644 api/v1/datadog/model_funnel_widget_definition.go create mode 100644 api/v1/datadog/model_funnel_widget_definition_type.go create mode 100644 api/v1/datadog/model_funnel_widget_request.go create mode 100644 api/v1/datadog/model_gcp_account.go create mode 100644 api/v1/datadog/model_geomap_widget_definition.go create mode 100644 api/v1/datadog/model_geomap_widget_definition_style.go create mode 100644 api/v1/datadog/model_geomap_widget_definition_type.go create mode 100644 api/v1/datadog/model_geomap_widget_definition_view.go create mode 100644 api/v1/datadog/model_geomap_widget_request.go create mode 100644 api/v1/datadog/model_graph_snapshot.go create mode 100644 api/v1/datadog/model_group_widget_definition.go create mode 100644 api/v1/datadog/model_group_widget_definition_type.go create mode 100644 api/v1/datadog/model_heat_map_widget_definition.go create mode 100644 api/v1/datadog/model_heat_map_widget_definition_type.go create mode 100644 api/v1/datadog/model_heat_map_widget_request.go create mode 100644 api/v1/datadog/model_host.go create mode 100644 api/v1/datadog/model_host_list_response.go create mode 100644 api/v1/datadog/model_host_map_request.go create mode 100644 api/v1/datadog/model_host_map_widget_definition.go create mode 100644 api/v1/datadog/model_host_map_widget_definition_requests.go create mode 100644 api/v1/datadog/model_host_map_widget_definition_style.go create mode 100644 api/v1/datadog/model_host_map_widget_definition_type.go create mode 100644 api/v1/datadog/model_host_meta.go create mode 100644 api/v1/datadog/model_host_meta_install_method.go create mode 100644 api/v1/datadog/model_host_metrics.go create mode 100644 api/v1/datadog/model_host_mute_response.go create mode 100644 api/v1/datadog/model_host_mute_settings.go create mode 100644 api/v1/datadog/model_host_tags.go create mode 100644 api/v1/datadog/model_host_totals.go create mode 100644 api/v1/datadog/model_hourly_usage_attribution_body.go create mode 100644 api/v1/datadog/model_hourly_usage_attribution_metadata.go create mode 100644 api/v1/datadog/model_hourly_usage_attribution_pagination.go create mode 100644 api/v1/datadog/model_hourly_usage_attribution_response.go create mode 100644 api/v1/datadog/model_hourly_usage_attribution_usage_type.go create mode 100644 api/v1/datadog/model_http_log_error.go create mode 100644 api/v1/datadog/model_http_log_item.go create mode 100644 api/v1/datadog/model_http_method.go create mode 100644 api/v1/datadog/model_i_frame_widget_definition.go create mode 100644 api/v1/datadog/model_i_frame_widget_definition_type.go create mode 100644 api/v1/datadog/model_idp_form_data.go create mode 100644 api/v1/datadog/model_idp_response.go create mode 100644 api/v1/datadog/model_image_widget_definition.go create mode 100644 api/v1/datadog/model_image_widget_definition_type.go create mode 100644 api/v1/datadog/model_intake_payload_accepted.go create mode 100644 api/v1/datadog/model_ip_prefixes_agents.go create mode 100644 api/v1/datadog/model_ip_prefixes_api.go create mode 100644 api/v1/datadog/model_ip_prefixes_apm.go create mode 100644 api/v1/datadog/model_ip_prefixes_logs.go create mode 100644 api/v1/datadog/model_ip_prefixes_process.go create mode 100644 api/v1/datadog/model_ip_prefixes_synthetics.go create mode 100644 api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go create mode 100644 api/v1/datadog/model_ip_prefixes_webhooks.go create mode 100644 api/v1/datadog/model_ip_ranges.go create mode 100644 api/v1/datadog/model_list_stream_column.go create mode 100644 api/v1/datadog/model_list_stream_column_width.go create mode 100644 api/v1/datadog/model_list_stream_query.go create mode 100644 api/v1/datadog/model_list_stream_response_format.go create mode 100644 api/v1/datadog/model_list_stream_source.go create mode 100644 api/v1/datadog/model_list_stream_widget_definition.go create mode 100644 api/v1/datadog/model_list_stream_widget_definition_type.go create mode 100644 api/v1/datadog/model_list_stream_widget_request.go create mode 100644 api/v1/datadog/model_log.go create mode 100644 api/v1/datadog/model_log_content.go create mode 100644 api/v1/datadog/model_log_query_definition.go create mode 100644 api/v1/datadog/model_log_query_definition_group_by.go create mode 100644 api/v1/datadog/model_log_query_definition_group_by_sort.go create mode 100644 api/v1/datadog/model_log_query_definition_search.go create mode 100644 api/v1/datadog/model_log_stream_widget_definition.go create mode 100644 api/v1/datadog/model_log_stream_widget_definition_type.go create mode 100644 api/v1/datadog/model_logs_api_error.go create mode 100644 api/v1/datadog/model_logs_api_error_response.go create mode 100644 api/v1/datadog/model_logs_arithmetic_processor.go create mode 100644 api/v1/datadog/model_logs_arithmetic_processor_type.go create mode 100644 api/v1/datadog/model_logs_attribute_remapper.go create mode 100644 api/v1/datadog/model_logs_attribute_remapper_type.go create mode 100644 api/v1/datadog/model_logs_by_retention.go create mode 100644 api/v1/datadog/model_logs_by_retention_monthly_usage.go create mode 100644 api/v1/datadog/model_logs_by_retention_org_usage.go create mode 100644 api/v1/datadog/model_logs_by_retention_orgs.go create mode 100644 api/v1/datadog/model_logs_category_processor.go create mode 100644 api/v1/datadog/model_logs_category_processor_category.go create mode 100644 api/v1/datadog/model_logs_category_processor_type.go create mode 100644 api/v1/datadog/model_logs_date_remapper.go create mode 100644 api/v1/datadog/model_logs_date_remapper_type.go create mode 100644 api/v1/datadog/model_logs_exclusion.go create mode 100644 api/v1/datadog/model_logs_exclusion_filter.go create mode 100644 api/v1/datadog/model_logs_filter.go create mode 100644 api/v1/datadog/model_logs_geo_ip_parser.go create mode 100644 api/v1/datadog/model_logs_geo_ip_parser_type.go create mode 100644 api/v1/datadog/model_logs_grok_parser.go create mode 100644 api/v1/datadog/model_logs_grok_parser_rules.go create mode 100644 api/v1/datadog/model_logs_grok_parser_type.go create mode 100644 api/v1/datadog/model_logs_index.go create mode 100644 api/v1/datadog/model_logs_index_list_response.go create mode 100644 api/v1/datadog/model_logs_index_update_request.go create mode 100644 api/v1/datadog/model_logs_indexes_order.go create mode 100644 api/v1/datadog/model_logs_list_request.go create mode 100644 api/v1/datadog/model_logs_list_request_time.go create mode 100644 api/v1/datadog/model_logs_list_response.go create mode 100644 api/v1/datadog/model_logs_lookup_processor.go create mode 100644 api/v1/datadog/model_logs_lookup_processor_type.go create mode 100644 api/v1/datadog/model_logs_message_remapper.go create mode 100644 api/v1/datadog/model_logs_message_remapper_type.go create mode 100644 api/v1/datadog/model_logs_pipeline.go create mode 100644 api/v1/datadog/model_logs_pipeline_processor.go create mode 100644 api/v1/datadog/model_logs_pipeline_processor_type.go create mode 100644 api/v1/datadog/model_logs_pipelines_order.go create mode 100644 api/v1/datadog/model_logs_processor.go create mode 100644 api/v1/datadog/model_logs_query_compute.go create mode 100644 api/v1/datadog/model_logs_retention_agg_sum_usage.go create mode 100644 api/v1/datadog/model_logs_retention_sum_usage.go create mode 100644 api/v1/datadog/model_logs_service_remapper.go create mode 100644 api/v1/datadog/model_logs_service_remapper_type.go create mode 100644 api/v1/datadog/model_logs_sort.go create mode 100644 api/v1/datadog/model_logs_status_remapper.go create mode 100644 api/v1/datadog/model_logs_status_remapper_type.go create mode 100644 api/v1/datadog/model_logs_string_builder_processor.go create mode 100644 api/v1/datadog/model_logs_string_builder_processor_type.go create mode 100644 api/v1/datadog/model_logs_trace_remapper.go create mode 100644 api/v1/datadog/model_logs_trace_remapper_type.go create mode 100644 api/v1/datadog/model_logs_url_parser.go create mode 100644 api/v1/datadog/model_logs_url_parser_type.go create mode 100644 api/v1/datadog/model_logs_user_agent_parser.go create mode 100644 api/v1/datadog/model_logs_user_agent_parser_type.go create mode 100644 api/v1/datadog/model_metric_content_encoding.go create mode 100644 api/v1/datadog/model_metric_metadata.go create mode 100644 api/v1/datadog/model_metric_search_response.go create mode 100644 api/v1/datadog/model_metric_search_response_results.go create mode 100644 api/v1/datadog/model_metrics_list_response.go create mode 100644 api/v1/datadog/model_metrics_payload.go create mode 100644 api/v1/datadog/model_metrics_query_metadata.go create mode 100644 api/v1/datadog/model_metrics_query_response.go create mode 100644 api/v1/datadog/model_metrics_query_unit.go create mode 100644 api/v1/datadog/model_monitor.go create mode 100644 api/v1/datadog/model_monitor_device_id.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_events_data_source.go create mode 100644 api/v1/datadog/model_monitor_formula_and_function_query_definition.go create mode 100644 api/v1/datadog/model_monitor_group_search_response.go create mode 100644 api/v1/datadog/model_monitor_group_search_response_counts.go create mode 100644 api/v1/datadog/model_monitor_group_search_result.go create mode 100644 api/v1/datadog/model_monitor_options.go create mode 100644 api/v1/datadog/model_monitor_options_aggregation.go create mode 100644 api/v1/datadog/model_monitor_overall_states.go create mode 100644 api/v1/datadog/model_monitor_renotify_status_type.go create mode 100644 api/v1/datadog/model_monitor_search_count_item.go create mode 100644 api/v1/datadog/model_monitor_search_response.go create mode 100644 api/v1/datadog/model_monitor_search_response_counts.go create mode 100644 api/v1/datadog/model_monitor_search_response_metadata.go create mode 100644 api/v1/datadog/model_monitor_search_result.go create mode 100644 api/v1/datadog/model_monitor_search_result_notification.go create mode 100644 api/v1/datadog/model_monitor_state.go create mode 100644 api/v1/datadog/model_monitor_state_group.go create mode 100644 api/v1/datadog/model_monitor_summary_widget_definition.go create mode 100644 api/v1/datadog/model_monitor_summary_widget_definition_type.go create mode 100644 api/v1/datadog/model_monitor_threshold_window_options.go create mode 100644 api/v1/datadog/model_monitor_thresholds.go create mode 100644 api/v1/datadog/model_monitor_type.go create mode 100644 api/v1/datadog/model_monitor_update_request.go create mode 100644 api/v1/datadog/model_monthly_usage_attribution_body.go create mode 100644 api/v1/datadog/model_monthly_usage_attribution_metadata.go create mode 100644 api/v1/datadog/model_monthly_usage_attribution_pagination.go create mode 100644 api/v1/datadog/model_monthly_usage_attribution_response.go create mode 100644 api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go create mode 100644 api/v1/datadog/model_monthly_usage_attribution_values.go create mode 100644 api/v1/datadog/model_note_widget_definition.go create mode 100644 api/v1/datadog/model_note_widget_definition_type.go create mode 100644 api/v1/datadog/model_notebook_absolute_time.go create mode 100644 api/v1/datadog/model_notebook_author.go create mode 100644 api/v1/datadog/model_notebook_cell_create_request.go create mode 100644 api/v1/datadog/model_notebook_cell_create_request_attributes.go create mode 100644 api/v1/datadog/model_notebook_cell_resource_type.go create mode 100644 api/v1/datadog/model_notebook_cell_response.go create mode 100644 api/v1/datadog/model_notebook_cell_response_attributes.go create mode 100644 api/v1/datadog/model_notebook_cell_time.go create mode 100644 api/v1/datadog/model_notebook_cell_update_request.go create mode 100644 api/v1/datadog/model_notebook_cell_update_request_attributes.go create mode 100644 api/v1/datadog/model_notebook_create_data.go create mode 100644 api/v1/datadog/model_notebook_create_data_attributes.go create mode 100644 api/v1/datadog/model_notebook_create_request.go create mode 100644 api/v1/datadog/model_notebook_distribution_cell_attributes.go create mode 100644 api/v1/datadog/model_notebook_global_time.go create mode 100644 api/v1/datadog/model_notebook_graph_size.go create mode 100644 api/v1/datadog/model_notebook_heat_map_cell_attributes.go create mode 100644 api/v1/datadog/model_notebook_log_stream_cell_attributes.go create mode 100644 api/v1/datadog/model_notebook_markdown_cell_attributes.go create mode 100644 api/v1/datadog/model_notebook_markdown_cell_definition.go create mode 100644 api/v1/datadog/model_notebook_markdown_cell_definition_type.go create mode 100644 api/v1/datadog/model_notebook_metadata.go create mode 100644 api/v1/datadog/model_notebook_metadata_type.go create mode 100644 api/v1/datadog/model_notebook_relative_time.go create mode 100644 api/v1/datadog/model_notebook_resource_type.go create mode 100644 api/v1/datadog/model_notebook_response.go create mode 100644 api/v1/datadog/model_notebook_response_data.go create mode 100644 api/v1/datadog/model_notebook_response_data_attributes.go create mode 100644 api/v1/datadog/model_notebook_split_by.go create mode 100644 api/v1/datadog/model_notebook_status.go create mode 100644 api/v1/datadog/model_notebook_timeseries_cell_attributes.go create mode 100644 api/v1/datadog/model_notebook_toplist_cell_attributes.go create mode 100644 api/v1/datadog/model_notebook_update_cell.go create mode 100644 api/v1/datadog/model_notebook_update_data.go create mode 100644 api/v1/datadog/model_notebook_update_data_attributes.go create mode 100644 api/v1/datadog/model_notebook_update_request.go create mode 100644 api/v1/datadog/model_notebooks_response.go create mode 100644 api/v1/datadog/model_notebooks_response_data.go create mode 100644 api/v1/datadog/model_notebooks_response_data_attributes.go create mode 100644 api/v1/datadog/model_notebooks_response_meta.go create mode 100644 api/v1/datadog/model_notebooks_response_page.go create mode 100644 api/v1/datadog/model_org_downgraded_response.go create mode 100644 api/v1/datadog/model_organization.go create mode 100644 api/v1/datadog/model_organization_billing.go create mode 100644 api/v1/datadog/model_organization_create_body.go create mode 100644 api/v1/datadog/model_organization_create_response.go create mode 100644 api/v1/datadog/model_organization_list_response.go create mode 100644 api/v1/datadog/model_organization_response.go create mode 100644 api/v1/datadog/model_organization_settings.go create mode 100644 api/v1/datadog/model_organization_settings_saml.go create mode 100644 api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go create mode 100644 api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go create mode 100644 api/v1/datadog/model_organization_settings_saml_strict_mode.go create mode 100644 api/v1/datadog/model_organization_subscription.go create mode 100644 api/v1/datadog/model_pager_duty_service.go create mode 100644 api/v1/datadog/model_pager_duty_service_key.go create mode 100644 api/v1/datadog/model_pager_duty_service_name.go create mode 100644 api/v1/datadog/model_pagination.go create mode 100644 api/v1/datadog/model_process_query_definition.go create mode 100644 api/v1/datadog/model_query_sort_order.go create mode 100644 api/v1/datadog/model_query_value_widget_definition.go create mode 100644 api/v1/datadog/model_query_value_widget_definition_type.go create mode 100644 api/v1/datadog/model_query_value_widget_request.go create mode 100644 api/v1/datadog/model_response_meta_attributes.go create mode 100644 api/v1/datadog/model_scatter_plot_request.go create mode 100644 api/v1/datadog/model_scatter_plot_widget_definition.go create mode 100644 api/v1/datadog/model_scatter_plot_widget_definition_requests.go create mode 100644 api/v1/datadog/model_scatter_plot_widget_definition_type.go create mode 100644 api/v1/datadog/model_scatterplot_dimension.go create mode 100644 api/v1/datadog/model_scatterplot_table_request.go create mode 100644 api/v1/datadog/model_scatterplot_widget_aggregator.go create mode 100644 api/v1/datadog/model_scatterplot_widget_formula.go create mode 100644 api/v1/datadog/model_search_slo_response.go create mode 100644 api/v1/datadog/model_search_slo_response_data.go create mode 100644 api/v1/datadog/model_search_slo_response_data_attributes.go create mode 100644 api/v1/datadog/model_search_slo_response_data_attributes_facets.go create mode 100644 api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go create mode 100644 api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go create mode 100644 api/v1/datadog/model_search_slo_response_links.go create mode 100644 api/v1/datadog/model_search_slo_response_meta.go create mode 100644 api/v1/datadog/model_search_slo_response_meta_page.go create mode 100644 api/v1/datadog/model_series.go create mode 100644 api/v1/datadog/model_service_check.go create mode 100644 api/v1/datadog/model_service_check_status.go create mode 100644 api/v1/datadog/model_service_level_objective.go create mode 100644 api/v1/datadog/model_service_level_objective_query.go create mode 100644 api/v1/datadog/model_service_level_objective_request.go create mode 100644 api/v1/datadog/model_service_map_widget_definition.go create mode 100644 api/v1/datadog/model_service_map_widget_definition_type.go create mode 100644 api/v1/datadog/model_service_summary_widget_definition.go create mode 100644 api/v1/datadog/model_service_summary_widget_definition_type.go create mode 100644 api/v1/datadog/model_signal_archive_reason.go create mode 100644 api/v1/datadog/model_signal_assignee_update_request.go create mode 100644 api/v1/datadog/model_signal_state_update_request.go create mode 100644 api/v1/datadog/model_signal_triage_state.go create mode 100644 api/v1/datadog/model_slack_integration_channel.go create mode 100644 api/v1/datadog/model_slack_integration_channel_display.go create mode 100644 api/v1/datadog/model_slo_bulk_delete_error.go create mode 100644 api/v1/datadog/model_slo_bulk_delete_response.go create mode 100644 api/v1/datadog/model_slo_bulk_delete_response_data.go create mode 100644 api/v1/datadog/model_slo_correction.go create mode 100644 api/v1/datadog/model_slo_correction_category.go create mode 100644 api/v1/datadog/model_slo_correction_create_data.go create mode 100644 api/v1/datadog/model_slo_correction_create_request.go create mode 100644 api/v1/datadog/model_slo_correction_create_request_attributes.go create mode 100644 api/v1/datadog/model_slo_correction_list_response.go create mode 100644 api/v1/datadog/model_slo_correction_response.go create mode 100644 api/v1/datadog/model_slo_correction_response_attributes.go create mode 100644 api/v1/datadog/model_slo_correction_response_attributes_modifier.go create mode 100644 api/v1/datadog/model_slo_correction_type.go create mode 100644 api/v1/datadog/model_slo_correction_update_data.go create mode 100644 api/v1/datadog/model_slo_correction_update_request.go create mode 100644 api/v1/datadog/model_slo_correction_update_request_attributes.go create mode 100644 api/v1/datadog/model_slo_delete_response.go create mode 100644 api/v1/datadog/model_slo_error_timeframe.go create mode 100644 api/v1/datadog/model_slo_history_metrics.go create mode 100644 api/v1/datadog/model_slo_history_metrics_series.go create mode 100644 api/v1/datadog/model_slo_history_metrics_series_metadata.go create mode 100644 api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go create mode 100644 api/v1/datadog/model_slo_history_monitor.go create mode 100644 api/v1/datadog/model_slo_history_response.go create mode 100644 api/v1/datadog/model_slo_history_response_data.go create mode 100644 api/v1/datadog/model_slo_history_response_error.go create mode 100644 api/v1/datadog/model_slo_history_response_error_with_type.go create mode 100644 api/v1/datadog/model_slo_history_sli_data.go create mode 100644 api/v1/datadog/model_slo_list_response.go create mode 100644 api/v1/datadog/model_slo_list_response_metadata.go create mode 100644 api/v1/datadog/model_slo_list_response_metadata_page.go create mode 100644 api/v1/datadog/model_slo_response.go create mode 100644 api/v1/datadog/model_slo_response_data.go create mode 100644 api/v1/datadog/model_slo_threshold.go create mode 100644 api/v1/datadog/model_slo_timeframe.go create mode 100644 api/v1/datadog/model_slo_type.go create mode 100644 api/v1/datadog/model_slo_type_numeric.go create mode 100644 api/v1/datadog/model_slo_widget_definition.go create mode 100644 api/v1/datadog/model_slo_widget_definition_type.go create mode 100644 api/v1/datadog/model_successful_signal_update_response.go create mode 100644 api/v1/datadog/model_sunburst_widget_definition.go create mode 100644 api/v1/datadog/model_sunburst_widget_definition_type.go create mode 100644 api/v1/datadog/model_sunburst_widget_legend.go create mode 100644 api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go create mode 100644 api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go create mode 100644 api/v1/datadog/model_sunburst_widget_legend_table.go create mode 100644 api/v1/datadog/model_sunburst_widget_legend_table_type.go create mode 100644 api/v1/datadog/model_sunburst_widget_request.go create mode 100644 api/v1/datadog/model_synthetics_api_step.go create mode 100644 api/v1/datadog/model_synthetics_api_step_subtype.go create mode 100644 api/v1/datadog/model_synthetics_api_test_.go create mode 100644 api/v1/datadog/model_synthetics_api_test_config.go create mode 100644 api/v1/datadog/model_synthetics_api_test_failure_code.go create mode 100644 api/v1/datadog/model_synthetics_api_test_result_data.go create mode 100644 api/v1/datadog/model_synthetics_api_test_result_failure.go create mode 100644 api/v1/datadog/model_synthetics_api_test_result_full.go create mode 100644 api/v1/datadog/model_synthetics_api_test_result_full_check.go create mode 100644 api/v1/datadog/model_synthetics_api_test_result_short.go create mode 100644 api/v1/datadog/model_synthetics_api_test_result_short_result.go create mode 100644 api/v1/datadog/model_synthetics_api_test_type.go create mode 100644 api/v1/datadog/model_synthetics_assertion.go create mode 100644 api/v1/datadog/model_synthetics_assertion_json_path_operator.go create mode 100644 api/v1/datadog/model_synthetics_assertion_json_path_target.go create mode 100644 api/v1/datadog/model_synthetics_assertion_json_path_target_target.go create mode 100644 api/v1/datadog/model_synthetics_assertion_operator.go create mode 100644 api/v1/datadog/model_synthetics_assertion_target.go create mode 100644 api/v1/datadog/model_synthetics_assertion_type.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_digest.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_digest_type.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_ntlm.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_sigv4.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_web.go create mode 100644 api/v1/datadog/model_synthetics_basic_auth_web_type.go create mode 100644 api/v1/datadog/model_synthetics_batch_details.go create mode 100644 api/v1/datadog/model_synthetics_batch_details_data.go create mode 100644 api/v1/datadog/model_synthetics_batch_result.go create mode 100644 api/v1/datadog/model_synthetics_browser_error.go create mode 100644 api/v1/datadog/model_synthetics_browser_error_type.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_config.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_failure_code.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_result_data.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_result_failure.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_result_full.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_result_full_check.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_result_short.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_result_short_result.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_rum_settings.go create mode 100644 api/v1/datadog/model_synthetics_browser_test_type.go create mode 100644 api/v1/datadog/model_synthetics_browser_variable.go create mode 100644 api/v1/datadog/model_synthetics_browser_variable_type.go create mode 100644 api/v1/datadog/model_synthetics_check_type.go create mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata.go create mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go create mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_git.go create mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.go create mode 100644 api/v1/datadog/model_synthetics_ci_batch_metadata_provider.go create mode 100644 api/v1/datadog/model_synthetics_ci_test_.go create mode 100644 api/v1/datadog/model_synthetics_ci_test_body.go create mode 100644 api/v1/datadog/model_synthetics_config_variable.go create mode 100644 api/v1/datadog/model_synthetics_config_variable_type.go create mode 100644 api/v1/datadog/model_synthetics_core_web_vitals.go create mode 100644 api/v1/datadog/model_synthetics_delete_tests_payload.go create mode 100644 api/v1/datadog/model_synthetics_delete_tests_response.go create mode 100644 api/v1/datadog/model_synthetics_deleted_test_.go create mode 100644 api/v1/datadog/model_synthetics_device.go create mode 100644 api/v1/datadog/model_synthetics_device_id.go create mode 100644 api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go create mode 100644 api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go create mode 100644 api/v1/datadog/model_synthetics_global_variable.go create mode 100644 api/v1/datadog/model_synthetics_global_variable_attributes.go create mode 100644 api/v1/datadog/model_synthetics_global_variable_parse_test_options.go create mode 100644 api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go create mode 100644 api/v1/datadog/model_synthetics_global_variable_parser_type.go create mode 100644 api/v1/datadog/model_synthetics_global_variable_value.go create mode 100644 api/v1/datadog/model_synthetics_list_global_variables_response.go create mode 100644 api/v1/datadog/model_synthetics_list_tests_response.go create mode 100644 api/v1/datadog/model_synthetics_location.go create mode 100644 api/v1/datadog/model_synthetics_locations.go create mode 100644 api/v1/datadog/model_synthetics_parsing_options.go create mode 100644 api/v1/datadog/model_synthetics_playing_tab.go create mode 100644 api/v1/datadog/model_synthetics_private_location.go create mode 100644 api/v1/datadog/model_synthetics_private_location_creation_response.go create mode 100644 api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go create mode 100644 api/v1/datadog/model_synthetics_private_location_metadata.go create mode 100644 api/v1/datadog/model_synthetics_private_location_secrets.go create mode 100644 api/v1/datadog/model_synthetics_private_location_secrets_authentication.go create mode 100644 api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.go create mode 100644 api/v1/datadog/model_synthetics_ssl_certificate.go create mode 100644 api/v1/datadog/model_synthetics_ssl_certificate_issuer.go create mode 100644 api/v1/datadog/model_synthetics_ssl_certificate_subject.go create mode 100644 api/v1/datadog/model_synthetics_status.go create mode 100644 api/v1/datadog/model_synthetics_step.go create mode 100644 api/v1/datadog/model_synthetics_step_detail.go create mode 100644 api/v1/datadog/model_synthetics_step_detail_warning.go create mode 100644 api/v1/datadog/model_synthetics_step_type.go create mode 100644 api/v1/datadog/model_synthetics_test_ci_options.go create mode 100644 api/v1/datadog/model_synthetics_test_config.go create mode 100644 api/v1/datadog/model_synthetics_test_details.go create mode 100644 api/v1/datadog/model_synthetics_test_details_sub_type.go create mode 100644 api/v1/datadog/model_synthetics_test_details_type.go create mode 100644 api/v1/datadog/model_synthetics_test_execution_rule.go create mode 100644 api/v1/datadog/model_synthetics_test_monitor_status.go create mode 100644 api/v1/datadog/model_synthetics_test_options.go create mode 100644 api/v1/datadog/model_synthetics_test_options_monitor_options.go create mode 100644 api/v1/datadog/model_synthetics_test_options_retry.go create mode 100644 api/v1/datadog/model_synthetics_test_pause_status.go create mode 100644 api/v1/datadog/model_synthetics_test_process_status.go create mode 100644 api/v1/datadog/model_synthetics_test_request.go create mode 100644 api/v1/datadog/model_synthetics_test_request_certificate.go create mode 100644 api/v1/datadog/model_synthetics_test_request_certificate_item.go create mode 100644 api/v1/datadog/model_synthetics_test_request_proxy.go create mode 100644 api/v1/datadog/model_synthetics_timing.go create mode 100644 api/v1/datadog/model_synthetics_trigger_body.go create mode 100644 api/v1/datadog/model_synthetics_trigger_ci_test_location.go create mode 100644 api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go create mode 100644 api/v1/datadog/model_synthetics_trigger_ci_tests_response.go create mode 100644 api/v1/datadog/model_synthetics_trigger_test_.go create mode 100644 api/v1/datadog/model_synthetics_update_test_pause_status_payload.go create mode 100644 api/v1/datadog/model_synthetics_variable_parser.go create mode 100644 api/v1/datadog/model_synthetics_warning_type.go create mode 100644 api/v1/datadog/model_table_widget_cell_display_mode.go create mode 100644 api/v1/datadog/model_table_widget_definition.go create mode 100644 api/v1/datadog/model_table_widget_definition_type.go create mode 100644 api/v1/datadog/model_table_widget_has_search_bar.go create mode 100644 api/v1/datadog/model_table_widget_request.go create mode 100644 api/v1/datadog/model_tag_to_hosts.go create mode 100644 api/v1/datadog/model_target_format_type.go create mode 100644 api/v1/datadog/model_timeseries_background.go create mode 100644 api/v1/datadog/model_timeseries_background_type.go create mode 100644 api/v1/datadog/model_timeseries_widget_definition.go create mode 100644 api/v1/datadog/model_timeseries_widget_definition_type.go create mode 100644 api/v1/datadog/model_timeseries_widget_expression_alias.go create mode 100644 api/v1/datadog/model_timeseries_widget_legend_column.go create mode 100644 api/v1/datadog/model_timeseries_widget_legend_layout.go create mode 100644 api/v1/datadog/model_timeseries_widget_request.go create mode 100644 api/v1/datadog/model_toplist_widget_definition.go create mode 100644 api/v1/datadog/model_toplist_widget_definition_type.go create mode 100644 api/v1/datadog/model_toplist_widget_request.go create mode 100644 api/v1/datadog/model_tree_map_color_by.go create mode 100644 api/v1/datadog/model_tree_map_group_by.go create mode 100644 api/v1/datadog/model_tree_map_size_by.go create mode 100644 api/v1/datadog/model_tree_map_widget_definition.go create mode 100644 api/v1/datadog/model_tree_map_widget_definition_type.go create mode 100644 api/v1/datadog/model_tree_map_widget_request.go create mode 100644 api/v1/datadog/model_usage_analyzed_logs_hour.go create mode 100644 api/v1/datadog/model_usage_analyzed_logs_response.go create mode 100644 api/v1/datadog/model_usage_attribution_aggregates_body.go create mode 100644 api/v1/datadog/model_usage_attribution_body.go create mode 100644 api/v1/datadog/model_usage_attribution_metadata.go create mode 100644 api/v1/datadog/model_usage_attribution_pagination.go create mode 100644 api/v1/datadog/model_usage_attribution_response.go create mode 100644 api/v1/datadog/model_usage_attribution_sort.go create mode 100644 api/v1/datadog/model_usage_attribution_supported_metrics.go create mode 100644 api/v1/datadog/model_usage_attribution_values.go create mode 100644 api/v1/datadog/model_usage_audit_logs_hour.go create mode 100644 api/v1/datadog/model_usage_audit_logs_response.go create mode 100644 api/v1/datadog/model_usage_billable_summary_body.go create mode 100644 api/v1/datadog/model_usage_billable_summary_hour.go create mode 100644 api/v1/datadog/model_usage_billable_summary_keys.go create mode 100644 api/v1/datadog/model_usage_billable_summary_response.go create mode 100644 api/v1/datadog/model_usage_ci_visibility_hour.go create mode 100644 api/v1/datadog/model_usage_ci_visibility_response.go create mode 100644 api/v1/datadog/model_usage_cloud_security_posture_management_hour.go create mode 100644 api/v1/datadog/model_usage_cloud_security_posture_management_response.go create mode 100644 api/v1/datadog/model_usage_custom_reports_attributes.go create mode 100644 api/v1/datadog/model_usage_custom_reports_data.go create mode 100644 api/v1/datadog/model_usage_custom_reports_meta.go create mode 100644 api/v1/datadog/model_usage_custom_reports_page.go create mode 100644 api/v1/datadog/model_usage_custom_reports_response.go create mode 100644 api/v1/datadog/model_usage_cws_hour.go create mode 100644 api/v1/datadog/model_usage_cws_response.go create mode 100644 api/v1/datadog/model_usage_dbm_hour.go create mode 100644 api/v1/datadog/model_usage_dbm_response.go create mode 100644 api/v1/datadog/model_usage_fargate_hour.go create mode 100644 api/v1/datadog/model_usage_fargate_response.go create mode 100644 api/v1/datadog/model_usage_host_hour.go create mode 100644 api/v1/datadog/model_usage_hosts_response.go create mode 100644 api/v1/datadog/model_usage_incident_management_hour.go create mode 100644 api/v1/datadog/model_usage_incident_management_response.go create mode 100644 api/v1/datadog/model_usage_indexed_spans_hour.go create mode 100644 api/v1/datadog/model_usage_indexed_spans_response.go create mode 100644 api/v1/datadog/model_usage_ingested_spans_hour.go create mode 100644 api/v1/datadog/model_usage_ingested_spans_response.go create mode 100644 api/v1/datadog/model_usage_io_t_hour.go create mode 100644 api/v1/datadog/model_usage_io_t_response.go create mode 100644 api/v1/datadog/model_usage_lambda_hour.go create mode 100644 api/v1/datadog/model_usage_lambda_response.go create mode 100644 api/v1/datadog/model_usage_logs_by_index_hour.go create mode 100644 api/v1/datadog/model_usage_logs_by_index_response.go create mode 100644 api/v1/datadog/model_usage_logs_by_retention_hour.go create mode 100644 api/v1/datadog/model_usage_logs_by_retention_response.go create mode 100644 api/v1/datadog/model_usage_logs_hour.go create mode 100644 api/v1/datadog/model_usage_logs_response.go create mode 100644 api/v1/datadog/model_usage_metric_category.go create mode 100644 api/v1/datadog/model_usage_network_flows_hour.go create mode 100644 api/v1/datadog/model_usage_network_flows_response.go create mode 100644 api/v1/datadog/model_usage_network_hosts_hour.go create mode 100644 api/v1/datadog/model_usage_network_hosts_response.go create mode 100644 api/v1/datadog/model_usage_online_archive_hour.go create mode 100644 api/v1/datadog/model_usage_online_archive_response.go create mode 100644 api/v1/datadog/model_usage_profiling_hour.go create mode 100644 api/v1/datadog/model_usage_profiling_response.go create mode 100644 api/v1/datadog/model_usage_reports_type.go create mode 100644 api/v1/datadog/model_usage_rum_sessions_hour.go create mode 100644 api/v1/datadog/model_usage_rum_sessions_response.go create mode 100644 api/v1/datadog/model_usage_rum_units_hour.go create mode 100644 api/v1/datadog/model_usage_rum_units_response.go create mode 100644 api/v1/datadog/model_usage_sds_hour.go create mode 100644 api/v1/datadog/model_usage_sds_response.go create mode 100644 api/v1/datadog/model_usage_snmp_hour.go create mode 100644 api/v1/datadog/model_usage_snmp_response.go create mode 100644 api/v1/datadog/model_usage_sort.go create mode 100644 api/v1/datadog/model_usage_sort_direction.go create mode 100644 api/v1/datadog/model_usage_specified_custom_reports_attributes.go create mode 100644 api/v1/datadog/model_usage_specified_custom_reports_data.go create mode 100644 api/v1/datadog/model_usage_specified_custom_reports_meta.go create mode 100644 api/v1/datadog/model_usage_specified_custom_reports_page.go create mode 100644 api/v1/datadog/model_usage_specified_custom_reports_response.go create mode 100644 api/v1/datadog/model_usage_summary_date.go create mode 100644 api/v1/datadog/model_usage_summary_date_org.go create mode 100644 api/v1/datadog/model_usage_summary_response.go create mode 100644 api/v1/datadog/model_usage_synthetics_api_hour.go create mode 100644 api/v1/datadog/model_usage_synthetics_api_response.go create mode 100644 api/v1/datadog/model_usage_synthetics_browser_hour.go create mode 100644 api/v1/datadog/model_usage_synthetics_browser_response.go create mode 100644 api/v1/datadog/model_usage_synthetics_hour.go create mode 100644 api/v1/datadog/model_usage_synthetics_response.go create mode 100644 api/v1/datadog/model_usage_timeseries_hour.go create mode 100644 api/v1/datadog/model_usage_timeseries_response.go create mode 100644 api/v1/datadog/model_usage_top_avg_metrics_hour.go create mode 100644 api/v1/datadog/model_usage_top_avg_metrics_metadata.go create mode 100644 api/v1/datadog/model_usage_top_avg_metrics_pagination.go create mode 100644 api/v1/datadog/model_usage_top_avg_metrics_response.go create mode 100644 api/v1/datadog/model_user.go create mode 100644 api/v1/datadog/model_user_disable_response.go create mode 100644 api/v1/datadog/model_user_list_response.go create mode 100644 api/v1/datadog/model_user_response.go create mode 100644 api/v1/datadog/model_webhooks_integration.go create mode 100644 api/v1/datadog/model_webhooks_integration_custom_variable.go create mode 100644 api/v1/datadog/model_webhooks_integration_custom_variable_response.go create mode 100644 api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go create mode 100644 api/v1/datadog/model_webhooks_integration_encoding.go create mode 100644 api/v1/datadog/model_webhooks_integration_update_request.go create mode 100644 api/v1/datadog/model_widget.go create mode 100644 api/v1/datadog/model_widget_aggregator.go create mode 100644 api/v1/datadog/model_widget_axis.go create mode 100644 api/v1/datadog/model_widget_change_type.go create mode 100644 api/v1/datadog/model_widget_color_preference.go create mode 100644 api/v1/datadog/model_widget_comparator.go create mode 100644 api/v1/datadog/model_widget_compare_to.go create mode 100644 api/v1/datadog/model_widget_conditional_format.go create mode 100644 api/v1/datadog/model_widget_custom_link.go create mode 100644 api/v1/datadog/model_widget_definition.go create mode 100644 api/v1/datadog/model_widget_display_type.go create mode 100644 api/v1/datadog/model_widget_event.go create mode 100644 api/v1/datadog/model_widget_event_size.go create mode 100644 api/v1/datadog/model_widget_field_sort.go create mode 100644 api/v1/datadog/model_widget_formula.go create mode 100644 api/v1/datadog/model_widget_formula_limit.go create mode 100644 api/v1/datadog/model_widget_grouping.go create mode 100644 api/v1/datadog/model_widget_horizontal_align.go create mode 100644 api/v1/datadog/model_widget_image_sizing.go create mode 100644 api/v1/datadog/model_widget_layout.go create mode 100644 api/v1/datadog/model_widget_layout_type.go create mode 100644 api/v1/datadog/model_widget_line_type.go create mode 100644 api/v1/datadog/model_widget_line_width.go create mode 100644 api/v1/datadog/model_widget_live_span.go create mode 100644 api/v1/datadog/model_widget_margin.go create mode 100644 api/v1/datadog/model_widget_marker.go create mode 100644 api/v1/datadog/model_widget_message_display.go create mode 100644 api/v1/datadog/model_widget_monitor_summary_display_format.go create mode 100644 api/v1/datadog/model_widget_monitor_summary_sort.go create mode 100644 api/v1/datadog/model_widget_node_type.go create mode 100644 api/v1/datadog/model_widget_order_by.go create mode 100644 api/v1/datadog/model_widget_palette.go create mode 100644 api/v1/datadog/model_widget_request_style.go create mode 100644 api/v1/datadog/model_widget_service_summary_display_format.go create mode 100644 api/v1/datadog/model_widget_size_format.go create mode 100644 api/v1/datadog/model_widget_sort.go create mode 100644 api/v1/datadog/model_widget_style.go create mode 100644 api/v1/datadog/model_widget_summary_type.go create mode 100644 api/v1/datadog/model_widget_text_align.go create mode 100644 api/v1/datadog/model_widget_tick_edge.go create mode 100644 api/v1/datadog/model_widget_time.go create mode 100644 api/v1/datadog/model_widget_time_windows_.go create mode 100644 api/v1/datadog/model_widget_vertical_align.go create mode 100644 api/v1/datadog/model_widget_view_mode.go create mode 100644 api/v1/datadog/model_widget_viz_type.go create mode 100644 api/v2/datadog/api_audit.go create mode 100644 api/v2/datadog/api_auth_n_mappings.go create mode 100644 api/v2/datadog/api_cloud_workload_security.go create mode 100644 api/v2/datadog/api_dashboard_lists.go create mode 100644 api/v2/datadog/api_events.go create mode 100644 api/v2/datadog/api_incident_services.go create mode 100644 api/v2/datadog/api_incident_teams.go create mode 100644 api/v2/datadog/api_incidents.go create mode 100644 api/v2/datadog/api_key_management.go create mode 100644 api/v2/datadog/api_logs.go create mode 100644 api/v2/datadog/api_logs_archives.go create mode 100644 api/v2/datadog/api_logs_metrics.go create mode 100644 api/v2/datadog/api_metrics.go create mode 100644 api/v2/datadog/api_opsgenie_integration.go create mode 100644 api/v2/datadog/api_organizations.go create mode 100644 api/v2/datadog/api_processes.go create mode 100644 api/v2/datadog/api_roles.go create mode 100644 api/v2/datadog/api_rum.go create mode 100644 api/v2/datadog/api_security_monitoring.go create mode 100644 api/v2/datadog/api_service_accounts.go create mode 100644 api/v2/datadog/api_usage_metering.go create mode 100644 api/v2/datadog/api_users.go create mode 100644 api/v2/datadog/model_api_error_response.go create mode 100644 api/v2/datadog/model_api_key_create_attributes.go create mode 100644 api/v2/datadog/model_api_key_create_data.go create mode 100644 api/v2/datadog/model_api_key_create_request.go create mode 100644 api/v2/datadog/model_api_key_relationships.go create mode 100644 api/v2/datadog/model_api_key_response.go create mode 100644 api/v2/datadog/model_api_key_response_included_item.go create mode 100644 api/v2/datadog/model_api_key_update_attributes.go create mode 100644 api/v2/datadog/model_api_key_update_data.go create mode 100644 api/v2/datadog/model_api_key_update_request.go create mode 100644 api/v2/datadog/model_api_keys_response.go create mode 100644 api/v2/datadog/model_api_keys_sort.go create mode 100644 api/v2/datadog/model_api_keys_type.go create mode 100644 api/v2/datadog/model_application_key_create_attributes.go create mode 100644 api/v2/datadog/model_application_key_create_data.go create mode 100644 api/v2/datadog/model_application_key_create_request.go create mode 100644 api/v2/datadog/model_application_key_relationships.go create mode 100644 api/v2/datadog/model_application_key_response.go create mode 100644 api/v2/datadog/model_application_key_response_included_item.go create mode 100644 api/v2/datadog/model_application_key_update_attributes.go create mode 100644 api/v2/datadog/model_application_key_update_data.go create mode 100644 api/v2/datadog/model_application_key_update_request.go create mode 100644 api/v2/datadog/model_application_keys_sort.go create mode 100644 api/v2/datadog/model_application_keys_type.go create mode 100644 api/v2/datadog/model_audit_logs_event.go create mode 100644 api/v2/datadog/model_audit_logs_event_attributes.go create mode 100644 api/v2/datadog/model_audit_logs_event_type.go create mode 100644 api/v2/datadog/model_audit_logs_events_response.go create mode 100644 api/v2/datadog/model_audit_logs_query_filter.go create mode 100644 api/v2/datadog/model_audit_logs_query_options.go create mode 100644 api/v2/datadog/model_audit_logs_query_page_options.go create mode 100644 api/v2/datadog/model_audit_logs_response_links.go create mode 100644 api/v2/datadog/model_audit_logs_response_metadata.go create mode 100644 api/v2/datadog/model_audit_logs_response_page.go create mode 100644 api/v2/datadog/model_audit_logs_response_status.go create mode 100644 api/v2/datadog/model_audit_logs_search_events_request.go create mode 100644 api/v2/datadog/model_audit_logs_sort.go create mode 100644 api/v2/datadog/model_audit_logs_warning.go create mode 100644 api/v2/datadog/model_auth_n_mapping.go create mode 100644 api/v2/datadog/model_auth_n_mapping_attributes.go create mode 100644 api/v2/datadog/model_auth_n_mapping_create_attributes.go create mode 100644 api/v2/datadog/model_auth_n_mapping_create_data.go create mode 100644 api/v2/datadog/model_auth_n_mapping_create_relationships.go create mode 100644 api/v2/datadog/model_auth_n_mapping_create_request.go create mode 100644 api/v2/datadog/model_auth_n_mapping_included.go create mode 100644 api/v2/datadog/model_auth_n_mapping_relationships.go create mode 100644 api/v2/datadog/model_auth_n_mapping_response.go create mode 100644 api/v2/datadog/model_auth_n_mapping_update_attributes.go create mode 100644 api/v2/datadog/model_auth_n_mapping_update_data.go create mode 100644 api/v2/datadog/model_auth_n_mapping_update_relationships.go create mode 100644 api/v2/datadog/model_auth_n_mapping_update_request.go create mode 100644 api/v2/datadog/model_auth_n_mappings_response.go create mode 100644 api/v2/datadog/model_auth_n_mappings_sort.go create mode 100644 api/v2/datadog/model_auth_n_mappings_type.go create mode 100644 api/v2/datadog/model_chargeback_breakdown.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_data.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_response.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_type.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go create mode 100644 api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.go create mode 100644 api/v2/datadog/model_content_encoding.go create mode 100644 api/v2/datadog/model_cost_by_org.go create mode 100644 api/v2/datadog/model_cost_by_org_attributes.go create mode 100644 api/v2/datadog/model_cost_by_org_response.go create mode 100644 api/v2/datadog/model_cost_by_org_type.go create mode 100644 api/v2/datadog/model_creator.go create mode 100644 api/v2/datadog/model_dashboard_list_add_items_request.go create mode 100644 api/v2/datadog/model_dashboard_list_add_items_response.go create mode 100644 api/v2/datadog/model_dashboard_list_delete_items_request.go create mode 100644 api/v2/datadog/model_dashboard_list_delete_items_response.go create mode 100644 api/v2/datadog/model_dashboard_list_item.go create mode 100644 api/v2/datadog/model_dashboard_list_item_request.go create mode 100644 api/v2/datadog/model_dashboard_list_item_response.go create mode 100644 api/v2/datadog/model_dashboard_list_items.go create mode 100644 api/v2/datadog/model_dashboard_list_update_items_request.go create mode 100644 api/v2/datadog/model_dashboard_list_update_items_response.go create mode 100644 api/v2/datadog/model_dashboard_type.go create mode 100644 api/v2/datadog/model_event.go create mode 100644 api/v2/datadog/model_event_attributes.go create mode 100644 api/v2/datadog/model_event_priority.go create mode 100644 api/v2/datadog/model_event_response.go create mode 100644 api/v2/datadog/model_event_response_attributes.go create mode 100644 api/v2/datadog/model_event_status_type.go create mode 100644 api/v2/datadog/model_event_type.go create mode 100644 api/v2/datadog/model_events_list_request.go create mode 100644 api/v2/datadog/model_events_list_response.go create mode 100644 api/v2/datadog/model_events_list_response_links.go create mode 100644 api/v2/datadog/model_events_query_filter.go create mode 100644 api/v2/datadog/model_events_query_options.go create mode 100644 api/v2/datadog/model_events_request_page.go create mode 100644 api/v2/datadog/model_events_response_metadata.go create mode 100644 api/v2/datadog/model_events_response_metadata_page.go create mode 100644 api/v2/datadog/model_events_sort.go create mode 100644 api/v2/datadog/model_events_warning.go create mode 100644 api/v2/datadog/model_full_api_key.go create mode 100644 api/v2/datadog/model_full_api_key_attributes.go create mode 100644 api/v2/datadog/model_full_application_key.go create mode 100644 api/v2/datadog/model_full_application_key_attributes.go create mode 100644 api/v2/datadog/model_hourly_usage.go create mode 100644 api/v2/datadog/model_hourly_usage_attributes.go create mode 100644 api/v2/datadog/model_hourly_usage_measurement.go create mode 100644 api/v2/datadog/model_hourly_usage_metadata.go create mode 100644 api/v2/datadog/model_hourly_usage_pagination.go create mode 100644 api/v2/datadog/model_hourly_usage_response.go create mode 100644 api/v2/datadog/model_hourly_usage_type.go create mode 100644 api/v2/datadog/model_http_log_error.go create mode 100644 api/v2/datadog/model_http_log_errors.go create mode 100644 api/v2/datadog/model_http_log_item.go create mode 100644 api/v2/datadog/model_id_p_metadata_form_data.go create mode 100644 api/v2/datadog/model_incident_create_attributes.go create mode 100644 api/v2/datadog/model_incident_create_data.go create mode 100644 api/v2/datadog/model_incident_create_relationships.go create mode 100644 api/v2/datadog/model_incident_create_request.go create mode 100644 api/v2/datadog/model_incident_field_attributes.go create mode 100644 api/v2/datadog/model_incident_field_attributes_multiple_value.go create mode 100644 api/v2/datadog/model_incident_field_attributes_single_value.go create mode 100644 api/v2/datadog/model_incident_field_attributes_single_value_type.go create mode 100644 api/v2/datadog/model_incident_field_attributes_value_type.go create mode 100644 api/v2/datadog/model_incident_integration_metadata_type.go create mode 100644 api/v2/datadog/model_incident_notification_handle.go create mode 100644 api/v2/datadog/model_incident_postmortem_type.go create mode 100644 api/v2/datadog/model_incident_related_object.go create mode 100644 api/v2/datadog/model_incident_response.go create mode 100644 api/v2/datadog/model_incident_response_attributes.go create mode 100644 api/v2/datadog/model_incident_response_data.go create mode 100644 api/v2/datadog/model_incident_response_included_item.go create mode 100644 api/v2/datadog/model_incident_response_meta.go create mode 100644 api/v2/datadog/model_incident_response_meta_pagination.go create mode 100644 api/v2/datadog/model_incident_response_relationships.go create mode 100644 api/v2/datadog/model_incident_service_create_attributes.go create mode 100644 api/v2/datadog/model_incident_service_create_data.go create mode 100644 api/v2/datadog/model_incident_service_create_request.go create mode 100644 api/v2/datadog/model_incident_service_included_items.go create mode 100644 api/v2/datadog/model_incident_service_relationships.go create mode 100644 api/v2/datadog/model_incident_service_response.go create mode 100644 api/v2/datadog/model_incident_service_response_attributes.go create mode 100644 api/v2/datadog/model_incident_service_response_data.go create mode 100644 api/v2/datadog/model_incident_service_type.go create mode 100644 api/v2/datadog/model_incident_service_update_attributes.go create mode 100644 api/v2/datadog/model_incident_service_update_data.go create mode 100644 api/v2/datadog/model_incident_service_update_request.go create mode 100644 api/v2/datadog/model_incident_services_response.go create mode 100644 api/v2/datadog/model_incident_team_create_attributes.go create mode 100644 api/v2/datadog/model_incident_team_create_data.go create mode 100644 api/v2/datadog/model_incident_team_create_request.go create mode 100644 api/v2/datadog/model_incident_team_included_items.go create mode 100644 api/v2/datadog/model_incident_team_relationships.go create mode 100644 api/v2/datadog/model_incident_team_response.go create mode 100644 api/v2/datadog/model_incident_team_response_attributes.go create mode 100644 api/v2/datadog/model_incident_team_response_data.go create mode 100644 api/v2/datadog/model_incident_team_type.go create mode 100644 api/v2/datadog/model_incident_team_update_attributes.go create mode 100644 api/v2/datadog/model_incident_team_update_data.go create mode 100644 api/v2/datadog/model_incident_team_update_request.go create mode 100644 api/v2/datadog/model_incident_teams_response.go create mode 100644 api/v2/datadog/model_incident_timeline_cell_create_attributes.go create mode 100644 api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go create mode 100644 api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go create mode 100644 api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.go create mode 100644 api/v2/datadog/model_incident_type.go create mode 100644 api/v2/datadog/model_incident_update_attributes.go create mode 100644 api/v2/datadog/model_incident_update_data.go create mode 100644 api/v2/datadog/model_incident_update_relationships.go create mode 100644 api/v2/datadog/model_incident_update_request.go create mode 100644 api/v2/datadog/model_incidents_response.go create mode 100644 api/v2/datadog/model_intake_payload_accepted.go create mode 100644 api/v2/datadog/model_list_application_keys_response.go create mode 100644 api/v2/datadog/model_log.go create mode 100644 api/v2/datadog/model_log_attributes.go create mode 100644 api/v2/datadog/model_log_type.go create mode 100644 api/v2/datadog/model_logs_aggregate_bucket.go create mode 100644 api/v2/datadog/model_logs_aggregate_bucket_value.go create mode 100644 api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go create mode 100644 api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go create mode 100644 api/v2/datadog/model_logs_aggregate_request.go create mode 100644 api/v2/datadog/model_logs_aggregate_request_page.go create mode 100644 api/v2/datadog/model_logs_aggregate_response.go create mode 100644 api/v2/datadog/model_logs_aggregate_response_data.go create mode 100644 api/v2/datadog/model_logs_aggregate_response_status.go create mode 100644 api/v2/datadog/model_logs_aggregate_sort.go create mode 100644 api/v2/datadog/model_logs_aggregate_sort_type.go create mode 100644 api/v2/datadog/model_logs_aggregation_function.go create mode 100644 api/v2/datadog/model_logs_archive.go create mode 100644 api/v2/datadog/model_logs_archive_attributes.go create mode 100644 api/v2/datadog/model_logs_archive_create_request.go create mode 100644 api/v2/datadog/model_logs_archive_create_request_attributes.go create mode 100644 api/v2/datadog/model_logs_archive_create_request_definition.go create mode 100644 api/v2/datadog/model_logs_archive_create_request_destination.go create mode 100644 api/v2/datadog/model_logs_archive_definition.go create mode 100644 api/v2/datadog/model_logs_archive_destination.go create mode 100644 api/v2/datadog/model_logs_archive_destination_azure.go create mode 100644 api/v2/datadog/model_logs_archive_destination_azure_type.go create mode 100644 api/v2/datadog/model_logs_archive_destination_gcs.go create mode 100644 api/v2/datadog/model_logs_archive_destination_gcs_type.go create mode 100644 api/v2/datadog/model_logs_archive_destination_s3.go create mode 100644 api/v2/datadog/model_logs_archive_destination_s3_type.go create mode 100644 api/v2/datadog/model_logs_archive_integration_azure.go create mode 100644 api/v2/datadog/model_logs_archive_integration_gcs.go create mode 100644 api/v2/datadog/model_logs_archive_integration_s3.go create mode 100644 api/v2/datadog/model_logs_archive_order.go create mode 100644 api/v2/datadog/model_logs_archive_order_attributes.go create mode 100644 api/v2/datadog/model_logs_archive_order_definition.go create mode 100644 api/v2/datadog/model_logs_archive_order_definition_type.go create mode 100644 api/v2/datadog/model_logs_archive_state.go create mode 100644 api/v2/datadog/model_logs_archives.go create mode 100644 api/v2/datadog/model_logs_compute.go create mode 100644 api/v2/datadog/model_logs_compute_type.go create mode 100644 api/v2/datadog/model_logs_group_by.go create mode 100644 api/v2/datadog/model_logs_group_by_histogram.go create mode 100644 api/v2/datadog/model_logs_group_by_missing.go create mode 100644 api/v2/datadog/model_logs_group_by_total.go create mode 100644 api/v2/datadog/model_logs_list_request.go create mode 100644 api/v2/datadog/model_logs_list_request_page.go create mode 100644 api/v2/datadog/model_logs_list_response.go create mode 100644 api/v2/datadog/model_logs_list_response_links.go create mode 100644 api/v2/datadog/model_logs_metric_compute.go create mode 100644 api/v2/datadog/model_logs_metric_compute_aggregation_type.go create mode 100644 api/v2/datadog/model_logs_metric_create_attributes.go create mode 100644 api/v2/datadog/model_logs_metric_create_data.go create mode 100644 api/v2/datadog/model_logs_metric_create_request.go create mode 100644 api/v2/datadog/model_logs_metric_filter.go create mode 100644 api/v2/datadog/model_logs_metric_group_by.go create mode 100644 api/v2/datadog/model_logs_metric_response.go create mode 100644 api/v2/datadog/model_logs_metric_response_attributes.go create mode 100644 api/v2/datadog/model_logs_metric_response_compute.go create mode 100644 api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go create mode 100644 api/v2/datadog/model_logs_metric_response_data.go create mode 100644 api/v2/datadog/model_logs_metric_response_filter.go create mode 100644 api/v2/datadog/model_logs_metric_response_group_by.go create mode 100644 api/v2/datadog/model_logs_metric_type.go create mode 100644 api/v2/datadog/model_logs_metric_update_attributes.go create mode 100644 api/v2/datadog/model_logs_metric_update_data.go create mode 100644 api/v2/datadog/model_logs_metric_update_request.go create mode 100644 api/v2/datadog/model_logs_metrics_response.go create mode 100644 api/v2/datadog/model_logs_query_filter.go create mode 100644 api/v2/datadog/model_logs_query_options.go create mode 100644 api/v2/datadog/model_logs_response_metadata.go create mode 100644 api/v2/datadog/model_logs_response_metadata_page.go create mode 100644 api/v2/datadog/model_logs_sort.go create mode 100644 api/v2/datadog/model_logs_sort_order.go create mode 100644 api/v2/datadog/model_logs_warning.go create mode 100644 api/v2/datadog/model_metric.go create mode 100644 api/v2/datadog/model_metric_all_tags.go create mode 100644 api/v2/datadog/model_metric_all_tags_attributes.go create mode 100644 api/v2/datadog/model_metric_all_tags_response.go create mode 100644 api/v2/datadog/model_metric_bulk_configure_tags_type.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_create.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_create_request.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_delete.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_delete_attributes.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_delete_request.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_response.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_status.go create mode 100644 api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go create mode 100644 api/v2/datadog/model_metric_content_encoding.go create mode 100644 api/v2/datadog/model_metric_custom_aggregation.go create mode 100644 api/v2/datadog/model_metric_custom_space_aggregation.go create mode 100644 api/v2/datadog/model_metric_custom_time_aggregation.go create mode 100644 api/v2/datadog/model_metric_distinct_volume.go create mode 100644 api/v2/datadog/model_metric_distinct_volume_attributes.go create mode 100644 api/v2/datadog/model_metric_distinct_volume_type.go create mode 100644 api/v2/datadog/model_metric_estimate.go create mode 100644 api/v2/datadog/model_metric_estimate_attributes.go create mode 100644 api/v2/datadog/model_metric_estimate_resource_type.go create mode 100644 api/v2/datadog/model_metric_estimate_response.go create mode 100644 api/v2/datadog/model_metric_estimate_type.go create mode 100644 api/v2/datadog/model_metric_ingested_indexed_volume.go create mode 100644 api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go create mode 100644 api/v2/datadog/model_metric_ingested_indexed_volume_type.go create mode 100644 api/v2/datadog/model_metric_intake_type.go create mode 100644 api/v2/datadog/model_metric_metadata.go create mode 100644 api/v2/datadog/model_metric_origin.go create mode 100644 api/v2/datadog/model_metric_payload.go create mode 100644 api/v2/datadog/model_metric_point.go create mode 100644 api/v2/datadog/model_metric_resource.go create mode 100644 api/v2/datadog/model_metric_series.go create mode 100644 api/v2/datadog/model_metric_tag_configuration.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_attributes.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_create_attributes.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_create_data.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_create_request.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_metric_types.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_response.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_type.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_update_attributes.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_update_data.go create mode 100644 api/v2/datadog/model_metric_tag_configuration_update_request.go create mode 100644 api/v2/datadog/model_metric_type.go create mode 100644 api/v2/datadog/model_metric_volumes.go create mode 100644 api/v2/datadog/model_metric_volumes_response.go create mode 100644 api/v2/datadog/model_metrics_and_metric_tag_configurations.go create mode 100644 api/v2/datadog/model_metrics_and_metric_tag_configurations_response.go create mode 100644 api/v2/datadog/model_monitor_type.go create mode 100644 api/v2/datadog/model_nullable_relationship_to_user.go create mode 100644 api/v2/datadog/model_nullable_relationship_to_user_data.go create mode 100644 api/v2/datadog/model_opsgenie_service_create_attributes.go create mode 100644 api/v2/datadog/model_opsgenie_service_create_data.go create mode 100644 api/v2/datadog/model_opsgenie_service_create_request.go create mode 100644 api/v2/datadog/model_opsgenie_service_region_type.go create mode 100644 api/v2/datadog/model_opsgenie_service_response.go create mode 100644 api/v2/datadog/model_opsgenie_service_response_attributes.go create mode 100644 api/v2/datadog/model_opsgenie_service_response_data.go create mode 100644 api/v2/datadog/model_opsgenie_service_type.go create mode 100644 api/v2/datadog/model_opsgenie_service_update_attributes.go create mode 100644 api/v2/datadog/model_opsgenie_service_update_data.go create mode 100644 api/v2/datadog/model_opsgenie_service_update_request.go create mode 100644 api/v2/datadog/model_opsgenie_services_response.go create mode 100644 api/v2/datadog/model_organization.go create mode 100644 api/v2/datadog/model_organization_attributes.go create mode 100644 api/v2/datadog/model_organizations_type.go create mode 100644 api/v2/datadog/model_pagination.go create mode 100644 api/v2/datadog/model_partial_api_key.go create mode 100644 api/v2/datadog/model_partial_api_key_attributes.go create mode 100644 api/v2/datadog/model_partial_application_key.go create mode 100644 api/v2/datadog/model_partial_application_key_attributes.go create mode 100644 api/v2/datadog/model_partial_application_key_response.go create mode 100644 api/v2/datadog/model_permission.go create mode 100644 api/v2/datadog/model_permission_attributes.go create mode 100644 api/v2/datadog/model_permissions_response.go create mode 100644 api/v2/datadog/model_permissions_type.go create mode 100644 api/v2/datadog/model_process_summaries_meta.go create mode 100644 api/v2/datadog/model_process_summaries_meta_page.go create mode 100644 api/v2/datadog/model_process_summaries_response.go create mode 100644 api/v2/datadog/model_process_summary.go create mode 100644 api/v2/datadog/model_process_summary_attributes.go create mode 100644 api/v2/datadog/model_process_summary_type.go create mode 100644 api/v2/datadog/model_query_sort_order.go create mode 100644 api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go create mode 100644 api/v2/datadog/model_relationship_to_incident_integration_metadatas.go create mode 100644 api/v2/datadog/model_relationship_to_incident_postmortem.go create mode 100644 api/v2/datadog/model_relationship_to_incident_postmortem_data.go create mode 100644 api/v2/datadog/model_relationship_to_organization.go create mode 100644 api/v2/datadog/model_relationship_to_organization_data.go create mode 100644 api/v2/datadog/model_relationship_to_organizations.go create mode 100644 api/v2/datadog/model_relationship_to_permission.go create mode 100644 api/v2/datadog/model_relationship_to_permission_data.go create mode 100644 api/v2/datadog/model_relationship_to_permissions.go create mode 100644 api/v2/datadog/model_relationship_to_role.go create mode 100644 api/v2/datadog/model_relationship_to_role_data.go create mode 100644 api/v2/datadog/model_relationship_to_roles.go create mode 100644 api/v2/datadog/model_relationship_to_saml_assertion_attribute.go create mode 100644 api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go create mode 100644 api/v2/datadog/model_relationship_to_user.go create mode 100644 api/v2/datadog/model_relationship_to_user_data.go create mode 100644 api/v2/datadog/model_relationship_to_users.go create mode 100644 api/v2/datadog/model_response_meta_attributes.go create mode 100644 api/v2/datadog/model_role.go create mode 100644 api/v2/datadog/model_role_attributes.go create mode 100644 api/v2/datadog/model_role_clone.go create mode 100644 api/v2/datadog/model_role_clone_attributes.go create mode 100644 api/v2/datadog/model_role_clone_request.go create mode 100644 api/v2/datadog/model_role_create_attributes.go create mode 100644 api/v2/datadog/model_role_create_data.go create mode 100644 api/v2/datadog/model_role_create_request.go create mode 100644 api/v2/datadog/model_role_create_response.go create mode 100644 api/v2/datadog/model_role_create_response_data.go create mode 100644 api/v2/datadog/model_role_relationships.go create mode 100644 api/v2/datadog/model_role_response.go create mode 100644 api/v2/datadog/model_role_response_relationships.go create mode 100644 api/v2/datadog/model_role_update_attributes.go create mode 100644 api/v2/datadog/model_role_update_data.go create mode 100644 api/v2/datadog/model_role_update_request.go create mode 100644 api/v2/datadog/model_role_update_response.go create mode 100644 api/v2/datadog/model_role_update_response_data.go create mode 100644 api/v2/datadog/model_roles_response.go create mode 100644 api/v2/datadog/model_roles_sort.go create mode 100644 api/v2/datadog/model_roles_type.go create mode 100644 api/v2/datadog/model_rum_aggregate_bucket_value.go create mode 100644 api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go create mode 100644 api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go create mode 100644 api/v2/datadog/model_rum_aggregate_request.go create mode 100644 api/v2/datadog/model_rum_aggregate_sort.go create mode 100644 api/v2/datadog/model_rum_aggregate_sort_type.go create mode 100644 api/v2/datadog/model_rum_aggregation_buckets_response.go create mode 100644 api/v2/datadog/model_rum_aggregation_function.go create mode 100644 api/v2/datadog/model_rum_analytics_aggregate_response.go create mode 100644 api/v2/datadog/model_rum_bucket_response.go create mode 100644 api/v2/datadog/model_rum_compute.go create mode 100644 api/v2/datadog/model_rum_compute_type.go create mode 100644 api/v2/datadog/model_rum_event.go create mode 100644 api/v2/datadog/model_rum_event_attributes.go create mode 100644 api/v2/datadog/model_rum_event_type.go create mode 100644 api/v2/datadog/model_rum_events_response.go create mode 100644 api/v2/datadog/model_rum_group_by.go create mode 100644 api/v2/datadog/model_rum_group_by_histogram.go create mode 100644 api/v2/datadog/model_rum_group_by_missing.go create mode 100644 api/v2/datadog/model_rum_group_by_total.go create mode 100644 api/v2/datadog/model_rum_query_filter.go create mode 100644 api/v2/datadog/model_rum_query_options.go create mode 100644 api/v2/datadog/model_rum_query_page_options.go create mode 100644 api/v2/datadog/model_rum_response_links.go create mode 100644 api/v2/datadog/model_rum_response_metadata.go create mode 100644 api/v2/datadog/model_rum_response_page.go create mode 100644 api/v2/datadog/model_rum_response_status.go create mode 100644 api/v2/datadog/model_rum_search_events_request.go create mode 100644 api/v2/datadog/model_rum_sort.go create mode 100644 api/v2/datadog/model_rum_sort_order.go create mode 100644 api/v2/datadog/model_rum_warning.go create mode 100644 api/v2/datadog/model_saml_assertion_attribute.go create mode 100644 api/v2/datadog/model_saml_assertion_attribute_attributes.go create mode 100644 api/v2/datadog/model_saml_assertion_attributes_type.go create mode 100644 api/v2/datadog/model_security_filter.go create mode 100644 api/v2/datadog/model_security_filter_attributes.go create mode 100644 api/v2/datadog/model_security_filter_create_attributes.go create mode 100644 api/v2/datadog/model_security_filter_create_data.go create mode 100644 api/v2/datadog/model_security_filter_create_request.go create mode 100644 api/v2/datadog/model_security_filter_exclusion_filter.go create mode 100644 api/v2/datadog/model_security_filter_exclusion_filter_response.go create mode 100644 api/v2/datadog/model_security_filter_filtered_data_type.go create mode 100644 api/v2/datadog/model_security_filter_meta.go create mode 100644 api/v2/datadog/model_security_filter_response.go create mode 100644 api/v2/datadog/model_security_filter_type.go create mode 100644 api/v2/datadog/model_security_filter_update_attributes.go create mode 100644 api/v2/datadog/model_security_filter_update_data.go create mode 100644 api/v2/datadog/model_security_filter_update_request.go create mode 100644 api/v2/datadog/model_security_filters_response.go create mode 100644 api/v2/datadog/model_security_monitoring_filter.go create mode 100644 api/v2/datadog/model_security_monitoring_filter_action.go create mode 100644 api/v2/datadog/model_security_monitoring_list_rules_response.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_case.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_case_create.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_create_payload.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_detection_method.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_evaluation_window.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_keep_alive.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_options.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_query.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_query_aggregation.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_query_create.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_response.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_severity.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_type_create.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_type_read.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_update_payload.go create mode 100644 api/v2/datadog/model_security_monitoring_signal.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_archive_reason.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_assignee_update_data.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_assignee_update_request.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_attributes.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_incidents_update_data.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_incidents_update_request.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_list_request.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_list_request_filter.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_list_request_page.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_state.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_state_update_data.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_state_update_request.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_triage_attributes.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_triage_update_data.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_triage_update_response.go create mode 100644 api/v2/datadog/model_security_monitoring_signal_type.go create mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response.go create mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response_links.go create mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response_meta.go create mode 100644 api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go create mode 100644 api/v2/datadog/model_security_monitoring_signals_sort.go create mode 100644 api/v2/datadog/model_security_monitoring_triage_user.go create mode 100644 api/v2/datadog/model_service_account_create_attributes.go create mode 100644 api/v2/datadog/model_service_account_create_data.go create mode 100644 api/v2/datadog/model_service_account_create_request.go create mode 100644 api/v2/datadog/model_usage_application_security_monitoring_response.go create mode 100644 api/v2/datadog/model_usage_attributes_object.go create mode 100644 api/v2/datadog/model_usage_data_object.go create mode 100644 api/v2/datadog/model_usage_lambda_traced_invocations_response.go create mode 100644 api/v2/datadog/model_usage_observability_pipelines_response.go create mode 100644 api/v2/datadog/model_usage_time_series_object.go create mode 100644 api/v2/datadog/model_usage_time_series_type.go create mode 100644 api/v2/datadog/model_user.go create mode 100644 api/v2/datadog/model_user_attributes.go create mode 100644 api/v2/datadog/model_user_create_attributes.go create mode 100644 api/v2/datadog/model_user_create_data.go create mode 100644 api/v2/datadog/model_user_create_request.go create mode 100644 api/v2/datadog/model_user_invitation_data.go create mode 100644 api/v2/datadog/model_user_invitation_data_attributes.go create mode 100644 api/v2/datadog/model_user_invitation_relationships.go create mode 100644 api/v2/datadog/model_user_invitation_response.go create mode 100644 api/v2/datadog/model_user_invitation_response_data.go create mode 100644 api/v2/datadog/model_user_invitations_request.go create mode 100644 api/v2/datadog/model_user_invitations_response.go create mode 100644 api/v2/datadog/model_user_invitations_type.go create mode 100644 api/v2/datadog/model_user_relationships.go create mode 100644 api/v2/datadog/model_user_response.go create mode 100644 api/v2/datadog/model_user_response_included_item.go create mode 100644 api/v2/datadog/model_user_response_relationships.go create mode 100644 api/v2/datadog/model_user_update_attributes.go create mode 100644 api/v2/datadog/model_user_update_data.go create mode 100644 api/v2/datadog/model_user_update_request.go create mode 100644 api/v2/datadog/model_users_response.go create mode 100644 api/v2/datadog/model_users_type.go diff --git a/api/common/client.go b/api/common/client.go new file mode 100644 index 00000000000..1779ca92192 --- /dev/null +++ b/api/common/client.go @@ -0,0 +1,492 @@ +// 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 common + +import ( + "bytes" + "compress/gzip" + "compress/zlib" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the Datadog API V2 Collection API v1.0. +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + Cfg *Configuration +} + +// FormFile holds parameters for a file in multipart/form-data request. +type FormFile struct { + FormFileName string + FileName string + FileBytes []byte +} + +// Service holds APIClient +type Service struct { + Client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.Cfg = cfg + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// contains is a case insensitive match, finding needle in a haystack. +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type.? +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// ParameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func ParameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + if t.Nanosecond() == 0 { + return t.Format("2006-01-02T15:04:05Z07:00") + } + return t.Format("2006-01-02T15:04:05.000Z07:00") + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings. +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// CallAPI do the request. +func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error) { + if c.Cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + // Strip any api keys from the response being logged + keys, ok := request.Context().Value(ContextAPIKeys).(map[string]APIKey) + if keys != nil && ok { + for _, apiKey := range keys { + valueRegex := regexp.MustCompile(fmt.Sprintf("(?m)%s", apiKey.Key)) + dump = valueRegex.ReplaceAll(dump, []byte("REDACTED")) + } + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.Cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.Cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// GetConfig allows modification of underlying config for alternate implementations and testing. +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior. +func (c *APIClient) GetConfig() *Configuration { + return c.Cfg +} + +// PrepareRequest build the request. +func (c *APIClient) PrepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFile *FormFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || formFile != nil { + if body != nil { + return nil, errors.New("cannot specify postBody and multipart form at the same time") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if formFile != nil { + w.Boundary() + part, err := w.CreateFormFile(formFile.FormFileName, filepath.Base(formFile.FileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.FileBytes) + if err != nil { + return nil, err + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("cannot specify postBody and x-www-form-urlencoded form at the same time") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.Cfg.Host != "" { + url.Host = c.Cfg.Host + } + + // Override request scheme, if applicable + if c.Cfg.Scheme != "" { + url.Scheme = c.Cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + if headerParams["Content-Encoding"] == "gzip" { + var buf bytes.Buffer + compressor := gzip.NewWriter(&buf) + if _, err = compressor.Write(body.Bytes()); err != nil { + return nil, err + } + if err = compressor.Close(); err != nil { + return nil, err + } + body = &buf + + } else if headerParams["Content-Encoding"] == "deflate" { + var buf bytes.Buffer + compressor := zlib.NewWriter(&buf) + if _, err = compressor.Write(body.Bytes()); err != nil { + return nil, err + } + if err = compressor.Close(); err != nil { + return nil, err + } + body = &buf + } else if headerParams["Content-Encoding"] == "zstd1" { + body, err = compressZstd(body.Bytes()) + if err != nil { + return nil, err + } + } + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.Cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.Cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + if !c.Cfg.Compress { + // gzip is on by default, so disable it by setting encoding to identity + localVarRequest.Header.Add("Accept-Encoding", "identity") + } + return localVarRequest, nil +} + +// Decode unmarshal bytes into an interface +func (c *APIClient) Decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil +} + +// Add a file to the multipart request. +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// ReportError Prevent trying to import "fmt". +func ReportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{}. +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if reflect.ValueOf(body).IsNil() { + return nil, nil + } + + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(**os.File); ok { + _, err = bodyBuf.ReadFrom(*fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + return nil, fmt.Errorf("invalid body type %s", contentType) + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header. +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + ErrorBody []byte + ErrorMessage string + ErrorModel interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.ErrorMessage +} + +// Body returns the raw bytes of the response. +func (e GenericOpenAPIError) Body() []byte { + return e.ErrorBody +} + +// Model returns the unpacked model of the error. +func (e GenericOpenAPIError) Model() interface{} { + return e.ErrorModel +} diff --git a/api/common/configuration.go b/api/common/configuration.go new file mode 100644 index 00000000000..29885c0a1e4 --- /dev/null +++ b/api/common/configuration.go @@ -0,0 +1,582 @@ +// 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 common + +import ( + "context" + "fmt" + "log" + "net/http" + "os" + "runtime" + "strings" + + client "github.com/DataDog/datadog-api-client-go/v2" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth. +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey. +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable. +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server. +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items. +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Compress bool `json:"compress,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client + unstableOperations map[string]bool +} + +// NewConfiguration returns a new Configuration object. +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: getUserAgent(), + Debug: false, + Compress: true, + Servers: ServerConfigurations{ + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "The regional site for Datadog customers.", + DefaultValue: "datadoghq.com", + EnumValues: []string{ + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "datadoghq.eu", + "ddog-gov.com", + }, + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "api", + }, + }, + }, + { + URL: "{protocol}://{name}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "name": { + Description: "Full site DNS name.", + DefaultValue: "api.datadoghq.com", + }, + "protocol": { + Description: "The protocol for accessing the API.", + DefaultValue: "https", + }, + }, + }, + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "Any Datadog deployment.", + DefaultValue: "datadoghq.com", + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "api", + }, + }, + }, + }, + OperationServers: map[string]ServerConfigurations{ + "v1.IPRangesApi.GetIPRanges": { + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "The regional site for Datadog customers.", + DefaultValue: "datadoghq.com", + EnumValues: []string{ + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "datadoghq.eu", + "ddog-gov.com", + }, + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "ip-ranges", + }, + }, + }, + { + URL: "{protocol}://{name}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "name": { + Description: "Full site DNS name.", + DefaultValue: "ip-ranges.datadoghq.com", + }, + "protocol": { + Description: "The protocol for accessing the API.", + DefaultValue: "https", + }, + }, + }, + { + URL: "https://{subdomain}.datadoghq.com", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "ip-ranges", + }, + }, + }, + }, + "v1.ServiceLevelObjectivesApi.SearchSLO": { + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "The regional site for Datadog customers.", + DefaultValue: "datadoghq.com", + EnumValues: []string{ + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "ddog-gov.com", + }, + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "api", + }, + }, + }, + { + URL: "{protocol}://{name}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "name": { + Description: "Full site DNS name.", + DefaultValue: "api.datadoghq.com", + }, + "protocol": { + Description: "The protocol for accessing the API.", + DefaultValue: "https", + }, + }, + }, + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "Any Datadog deployment.", + DefaultValue: "datadoghq.com", + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "api", + }, + }, + }, + }, + "v1.LogsApi.SubmitLog": { + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "The regional site for Datadog customers.", + DefaultValue: "datadoghq.com", + EnumValues: []string{ + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "datadoghq.eu", + "ddog-gov.com", + }, + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "http-intake.logs", + }, + }, + }, + { + URL: "{protocol}://{name}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "name": { + Description: "Full site DNS name.", + DefaultValue: "http-intake.logs.datadoghq.com", + }, + "protocol": { + Description: "The protocol for accessing the API.", + DefaultValue: "https", + }, + }, + }, + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "Any Datadog deployment.", + DefaultValue: "datadoghq.com", + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "http-intake.logs", + }, + }, + }, + }, + "v2.LogsApi.SubmitLog": { + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "The regional site for customers.", + DefaultValue: "datadoghq.com", + EnumValues: []string{ + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "datadoghq.eu", + "ddog-gov.com", + }, + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "http-intake.logs", + }, + }, + }, + { + URL: "{protocol}://{name}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "name": { + Description: "Full site DNS name.", + DefaultValue: "http-intake.logs.datadoghq.com", + }, + "protocol": { + Description: "The protocol for accessing the API.", + DefaultValue: "https", + }, + }, + }, + { + URL: "https://{subdomain}.{site}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "site": { + Description: "Any Datadog deployment.", + DefaultValue: "datadoghq.com", + }, + "subdomain": { + Description: "The subdomain where the API is deployed.", + DefaultValue: "http-intake.logs", + }, + }, + }, + }, + }, + unstableOperations: map[string]bool{ + "v1.GetDailyCustomReports": false, + "v1.GetMonthlyCustomReports": false, + "v1.GetSpecifiedDailyCustomReports": false, + "v1.GetSpecifiedMonthlyCustomReports": false, + "v1.GetUsageAttribution": false, + "v1.GetSLOHistory": false, + "v1.SearchSLO": false, + "v2.ListEvents": false, + "v2.SearchEvents": false, + "v2.CreateIncident": false, + "v2.DeleteIncident": false, + "v2.GetIncident": false, + "v2.ListIncidents": false, + "v2.UpdateIncident": false, + "v2.CreateIncidentService": false, + "v2.DeleteIncidentService": false, + "v2.GetIncidentService": false, + "v2.ListIncidentServices": false, + "v2.UpdateIncidentService": false, + "v2.CreateIncidentTeam": false, + "v2.DeleteIncidentTeam": false, + "v2.GetIncidentTeam": false, + "v2.ListIncidentTeams": false, + "v2.UpdateIncidentTeam": false, + "v2.GetEstimatedCostByOrg": false, + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request. +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables. +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings. +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, ReportError("invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + operationIndices, ok := osi.(map[string]int) + if !ok { + return 0, ReportError("invalid type %T should be map[string]int", osi) + } + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, ReportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + operationVariables, ok := osv.(map[string]map[string]string) + if !ok { + return nil, ReportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint. +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} + +// GetUnstableOperations returns a slice with all unstable operation Ids. +func (c *Configuration) GetUnstableOperations() []string { + ids := make([]string, len(c.unstableOperations)) + for id := range c.unstableOperations { + ids = append(ids, id) + } + return ids +} + +// SetUnstableOperationEnabled sets an unstable operation as enabled (true) or disabled (false). +// This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" +// Returns true if the operation is marked as unstable and thus was enabled/disabled, false otherwise. +func (c *Configuration) SetUnstableOperationEnabled(operation string, enabled bool) bool { + if _, ok := c.unstableOperations[operation]; ok { + c.unstableOperations[operation] = enabled + return true + } + log.Printf("WARNING: '%s' is not an unstable operation, can't enable/disable", operation) + return false +} + +// IsUnstableOperation determines whether an operation is an unstable operation. +// This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo". +func (c *Configuration) IsUnstableOperation(operation string) bool { + _, present := c.unstableOperations[operation] + return present +} + +// IsUnstableOperationEnabled determines whether an unstable operation is enabled. +// This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" +// Returns true if the operation is unstable and it is enabled, false otherwise. +func (c *Configuration) IsUnstableOperationEnabled(operation string) bool { + if enabled, present := c.unstableOperations[operation]; present { + return enabled + } + log.Printf("WARNING: '%s' is not an unstable operation, is always enabled", operation) + return false +} + +func getUserAgent() string { + return fmt.Sprintf( + "datadog-api-client-go/%s (go %s; os %s; arch %s)", + client.Version, + runtime.Version(), + runtime.GOOS, + runtime.GOARCH, + ) +} + +// NewDefaultContext returns a new context setup with environment variables. +func NewDefaultContext(ctx context.Context) context.Context { + if ctx == nil { + ctx = context.Background() + } + + if site, ok := os.LookupEnv("DD_SITE"); ok { + ctx = context.WithValue( + ctx, + ContextServerVariables, + map[string]string{"site": site}, + ) + } + + keys := make(map[string]APIKey) + if apiKey, ok := os.LookupEnv("DD_API_KEY"); ok { + keys["apiKeyAuth"] = APIKey{Key: apiKey} + } + if apiKey, ok := os.LookupEnv("DD_APP_KEY"); ok { + keys["appKeyAuth"] = APIKey{Key: apiKey} + } + ctx = context.WithValue( + ctx, + ContextAPIKeys, + keys, + ) + + return ctx +} diff --git a/api/common/no_zstd.go b/api/common/no_zstd.go new file mode 100644 index 00000000000..12da6f8c4af --- /dev/null +++ b/api/common/no_zstd.go @@ -0,0 +1,16 @@ +// 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. + +//go:build !cgo + +package common + +import ( + "bytes" + "errors" +) + +func compressZstd(body []byte) (*bytes.Buffer, error) { + return nil, errors.New("zstd not supported") +} diff --git a/api/common/utils.go b/api/common/utils.go new file mode 100644 index 00000000000..9702b528730 --- /dev/null +++ b/api/common/utils.go @@ -0,0 +1,437 @@ +// 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 common + +import ( + "encoding/json" + "reflect" + "strings" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +// NullableBool is a struct to hold a nullable boolean value. +type NullableBool struct { + value *bool + isSet bool +} + +// Get returns the value associated with the nullable bool. +func (v NullableBool) Get() *bool { + return v.value +} + +// Set sets the value associated with the nullable bool. +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableBool) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable bool. +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableBool instantiates a new nullable bool. +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// NullableInt is a struct to hold a nullable int value. +type NullableInt struct { + value *int + isSet bool +} + +// Get returns the value associated with the nullable int. +func (v NullableInt) Get() *int { + return v.value +} + +// Set sets the value associated with the nullable int. +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableInt) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable int. +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableInt instantiates a new nullable int. +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// NullableInt32 is a struct to hold a nullable int32 value. +type NullableInt32 struct { + value *int32 + isSet bool +} + +// Get returns the value associated with the nullable int32. +func (v NullableInt32) Get() *int32 { + return v.value +} + +// Set sets the value associated with the nullable int32. +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable int32. +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableInt32 instantiates a new nullable int32. +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// NullableInt64 is a struct to hold a nullable int64 value. +type NullableInt64 struct { + value *int64 + isSet bool +} + +// Get returns the value associated with the nullable int64. +func (v NullableInt64) Get() *int64 { + return v.value +} + +// Set sets the value associated with the nullable int64. +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable int64. +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableInt64 instantiates a new nullable int64. +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// NullableFloat32 is a struct to hold a nullable float32 value. +type NullableFloat32 struct { + value *float32 + isSet bool +} + +// Get returns the value associated with the nullable float32. +func (v NullableFloat32) Get() *float32 { + return v.value +} + +// Set sets the value associated with the nullable float32. +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable float32. +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFloat32 instantiates a new nullable float32. +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// NullableFloat64 is a struct to hold a nullable float64 value. +type NullableFloat64 struct { + value *float64 + isSet bool +} + +// Get returns the value associated with the nullable float64. +func (v NullableFloat64) Get() *float64 { + return v.value +} + +// Set sets the value associated with the nullable float64. +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable float64. +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFloat64 instantiates a new nullable float64. +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// NullableString is a struct to hold a nullable string value. +type NullableString struct { + value *string + isSet bool +} + +// Get returns the value associated with the nullable string. +func (v NullableString) Get() *string { + return v.value +} + +// Set sets the value associated with the nullable string. +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableString) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable string. +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableString instantiates a new nullable string. +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// NullableTime is a struct to hold a nullable Time value. +type NullableTime struct { + value *time.Time + isSet bool +} + +// Get returns the value associated with the nullable Time. +func (v NullableTime) Get() *time.Time { + return v.value +} + +// Set sets the value associated with the nullable Time. +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +// IsSet returns true if the value has been set. +func (v NullableTime) IsSet() bool { + return v.isSet +} + +// Unset resets fields of the nullable Time. +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTime instantiates a new nullable Time. +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +// UnmarshalJSON deserializes to the associated value. +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// ContainsUnparsedObject returns true if the given data contains an unparsed object from the API. +func ContainsUnparsedObject(i interface{}) (bool, interface{}) { + v := reflect.ValueOf(i) + switch v.Kind() { + case reflect.Array, reflect.Slice: + for i := 0; i < v.Len(); i++ { + if n, m := ContainsUnparsedObject(v.Index(i).Interface()); n { + return n, m + } + } + case reflect.Map: + for _, k := range v.MapKeys() { + if n, m := ContainsUnparsedObject(v.MapIndex(k).Interface()); n { + return n, m + } + } + case reflect.Struct: + if u := v.FieldByName("UnparsedObject"); u.IsValid() && !u.IsNil() { + return true, u.Interface() + } + for i := 0; i < v.NumField(); i++ { + if fn := v.Type().Field(i).Name; string(fn[0]) == strings.ToUpper(string(fn[0])) && fn != "UnparsedObject" { + if n, m := ContainsUnparsedObject(v.Field(i).Interface()); n { + return n, m + } + } else if fn == "value" { // Special case for Nullables + if get := v.MethodByName("Get"); get.IsValid() { + if n, m := ContainsUnparsedObject(get.Call([]reflect.Value{})[0].Interface()); n { + return n, m + } + } + } + } + case reflect.Interface, reflect.Ptr: + if !v.IsNil() { + return ContainsUnparsedObject(v.Elem().Interface()) + } + default: + if v.IsValid() { + if m := v.MethodByName("IsValid"); m.IsValid() { + if !m.Call([]reflect.Value{})[0].Bool() { + return true, v.Interface() + } + } + } + } + return false, nil +} diff --git a/api/common/zstd.go b/api/common/zstd.go new file mode 100644 index 00000000000..f1b9043d623 --- /dev/null +++ b/api/common/zstd.go @@ -0,0 +1,25 @@ +// 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. + +//go:build cgo + +package common + +import ( + "bytes" + + "github.com/DataDog/zstd" +) + +func compressZstd(body []byte) (*bytes.Buffer, error) { + var buf bytes.Buffer + compressor := zstd.NewWriter(&buf) + if _, err := compressor.Write(body); err != nil { + return nil, err + } + if err := compressor.Close(); err != nil { + return nil, err + } + return &buf, nil +} diff --git a/api/v1/datadog/api_authentication.go b/api/v1/datadog/api_authentication.go new file mode 100644 index 00000000000..8f721409ecd --- /dev/null +++ b/api/v1/datadog/api_authentication.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// AuthenticationApi service type +type AuthenticationApi common.Service + +type apiValidateRequest struct { + ctx _context.Context +} + +func (a *AuthenticationApi) buildValidateRequest(ctx _context.Context) (apiValidateRequest, error) { + req := apiValidateRequest{ + ctx: ctx, + } + return req, nil +} + +// Validate Validate API key. +// Check if the API key (not the APP key) is valid. If invalid, a 403 is returned. +func (a *AuthenticationApi) Validate(ctx _context.Context) (AuthenticationValidationResponse, *_nethttp.Response, error) { + req, err := a.buildValidateRequest(ctx) + if err != nil { + var localVarReturnValue AuthenticationValidationResponse + return localVarReturnValue, nil, err + } + + return a.validateExecute(req) +} + +// validateExecute executes the request. +func (a *AuthenticationApi) validateExecute(r apiValidateRequest) (AuthenticationValidationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AuthenticationValidationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AuthenticationApi.Validate") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/validate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAuthenticationApi Returns NewAuthenticationApi. +func NewAuthenticationApi(client *common.APIClient) *AuthenticationApi { + return &AuthenticationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_aws_integration.go b/api/v1/datadog/api_aws_integration.go new file mode 100644 index 00000000000..79847ee3fd0 --- /dev/null +++ b/api/v1/datadog/api_aws_integration.go @@ -0,0 +1,1412 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// AWSIntegrationApi service type +type AWSIntegrationApi common.Service + +type apiCreateAWSAccountRequest struct { + ctx _context.Context + body *AWSAccount +} + +func (a *AWSIntegrationApi) buildCreateAWSAccountRequest(ctx _context.Context, body AWSAccount) (apiCreateAWSAccountRequest, error) { + req := apiCreateAWSAccountRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateAWSAccount Create an AWS integration. +// Create a Datadog-Amazon Web Services integration. +// Using the `POST` method updates your integration configuration +// by adding your new configuration to the existing one in your Datadog organization. +// A unique AWS Account ID for role based authentication. +func (a *AWSIntegrationApi) CreateAWSAccount(ctx _context.Context, body AWSAccount) (AWSAccountCreateResponse, *_nethttp.Response, error) { + req, err := a.buildCreateAWSAccountRequest(ctx, body) + if err != nil { + var localVarReturnValue AWSAccountCreateResponse + return localVarReturnValue, nil, err + } + + return a.createAWSAccountExecute(req) +} + +// createAWSAccountExecute executes the request. +func (a *AWSIntegrationApi) createAWSAccountExecute(r apiCreateAWSAccountRequest) (AWSAccountCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AWSAccountCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.CreateAWSAccount") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateAWSTagFilterRequest struct { + ctx _context.Context + body *AWSTagFilterCreateRequest +} + +func (a *AWSIntegrationApi) buildCreateAWSTagFilterRequest(ctx _context.Context, body AWSTagFilterCreateRequest) (apiCreateAWSTagFilterRequest, error) { + req := apiCreateAWSTagFilterRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateAWSTagFilter Set an AWS tag filter. +// Set an AWS tag filter. +func (a *AWSIntegrationApi) CreateAWSTagFilter(ctx _context.Context, body AWSTagFilterCreateRequest) (interface{}, *_nethttp.Response, error) { + req, err := a.buildCreateAWSTagFilterRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.createAWSTagFilterExecute(req) +} + +// createAWSTagFilterExecute executes the request. +func (a *AWSIntegrationApi) createAWSTagFilterExecute(r apiCreateAWSTagFilterRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.CreateAWSTagFilter") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/filtering" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateNewAWSExternalIDRequest struct { + ctx _context.Context + body *AWSAccount +} + +func (a *AWSIntegrationApi) buildCreateNewAWSExternalIDRequest(ctx _context.Context, body AWSAccount) (apiCreateNewAWSExternalIDRequest, error) { + req := apiCreateNewAWSExternalIDRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateNewAWSExternalID Generate a new external ID. +// Generate a new AWS external ID for a given AWS account ID and role name pair. +func (a *AWSIntegrationApi) CreateNewAWSExternalID(ctx _context.Context, body AWSAccount) (AWSAccountCreateResponse, *_nethttp.Response, error) { + req, err := a.buildCreateNewAWSExternalIDRequest(ctx, body) + if err != nil { + var localVarReturnValue AWSAccountCreateResponse + return localVarReturnValue, nil, err + } + + return a.createNewAWSExternalIDExecute(req) +} + +// createNewAWSExternalIDExecute executes the request. +func (a *AWSIntegrationApi) createNewAWSExternalIDExecute(r apiCreateNewAWSExternalIDRequest) (AWSAccountCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue AWSAccountCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.CreateNewAWSExternalID") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/generate_new_external_id" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteAWSAccountRequest struct { + ctx _context.Context + body *AWSAccountDeleteRequest +} + +func (a *AWSIntegrationApi) buildDeleteAWSAccountRequest(ctx _context.Context, body AWSAccountDeleteRequest) (apiDeleteAWSAccountRequest, error) { + req := apiDeleteAWSAccountRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteAWSAccount Delete an AWS integration. +// Delete a Datadog-AWS integration matching the specified `account_id` and `role_name parameters`. +func (a *AWSIntegrationApi) DeleteAWSAccount(ctx _context.Context, body AWSAccountDeleteRequest) (interface{}, *_nethttp.Response, error) { + req, err := a.buildDeleteAWSAccountRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.deleteAWSAccountExecute(req) +} + +// deleteAWSAccountExecute executes the request. +func (a *AWSIntegrationApi) deleteAWSAccountExecute(r apiDeleteAWSAccountRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.DeleteAWSAccount") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteAWSTagFilterRequest struct { + ctx _context.Context + body *AWSTagFilterDeleteRequest +} + +func (a *AWSIntegrationApi) buildDeleteAWSTagFilterRequest(ctx _context.Context, body AWSTagFilterDeleteRequest) (apiDeleteAWSTagFilterRequest, error) { + req := apiDeleteAWSTagFilterRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteAWSTagFilter Delete a tag filtering entry. +// Delete a tag filtering entry. +func (a *AWSIntegrationApi) DeleteAWSTagFilter(ctx _context.Context, body AWSTagFilterDeleteRequest) (interface{}, *_nethttp.Response, error) { + req, err := a.buildDeleteAWSTagFilterRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.deleteAWSTagFilterExecute(req) +} + +// deleteAWSTagFilterExecute executes the request. +func (a *AWSIntegrationApi) deleteAWSTagFilterExecute(r apiDeleteAWSTagFilterRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.DeleteAWSTagFilter") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/filtering" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAWSAccountsRequest struct { + ctx _context.Context + accountId *string + roleName *string + accessKeyId *string +} + +// ListAWSAccountsOptionalParameters holds optional parameters for ListAWSAccounts. +type ListAWSAccountsOptionalParameters struct { + AccountId *string + RoleName *string + AccessKeyId *string +} + +// NewListAWSAccountsOptionalParameters creates an empty struct for parameters. +func NewListAWSAccountsOptionalParameters() *ListAWSAccountsOptionalParameters { + this := ListAWSAccountsOptionalParameters{} + return &this +} + +// WithAccountId sets the corresponding parameter name and returns the struct. +func (r *ListAWSAccountsOptionalParameters) WithAccountId(accountId string) *ListAWSAccountsOptionalParameters { + r.AccountId = &accountId + return r +} + +// WithRoleName sets the corresponding parameter name and returns the struct. +func (r *ListAWSAccountsOptionalParameters) WithRoleName(roleName string) *ListAWSAccountsOptionalParameters { + r.RoleName = &roleName + return r +} + +// WithAccessKeyId sets the corresponding parameter name and returns the struct. +func (r *ListAWSAccountsOptionalParameters) WithAccessKeyId(accessKeyId string) *ListAWSAccountsOptionalParameters { + r.AccessKeyId = &accessKeyId + return r +} + +func (a *AWSIntegrationApi) buildListAWSAccountsRequest(ctx _context.Context, o ...ListAWSAccountsOptionalParameters) (apiListAWSAccountsRequest, error) { + req := apiListAWSAccountsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListAWSAccountsOptionalParameters is allowed") + } + + if o != nil { + req.accountId = o[0].AccountId + req.roleName = o[0].RoleName + req.accessKeyId = o[0].AccessKeyId + } + return req, nil +} + +// ListAWSAccounts List all AWS integrations. +// List all Datadog-AWS integrations available in your Datadog organization. +func (a *AWSIntegrationApi) ListAWSAccounts(ctx _context.Context, o ...ListAWSAccountsOptionalParameters) (AWSAccountListResponse, *_nethttp.Response, error) { + req, err := a.buildListAWSAccountsRequest(ctx, o...) + if err != nil { + var localVarReturnValue AWSAccountListResponse + return localVarReturnValue, nil, err + } + + return a.listAWSAccountsExecute(req) +} + +// listAWSAccountsExecute executes the request. +func (a *AWSIntegrationApi) listAWSAccountsExecute(r apiListAWSAccountsRequest) (AWSAccountListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSAccountListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.ListAWSAccounts") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.accountId != nil { + localVarQueryParams.Add("account_id", common.ParameterToString(*r.accountId, "")) + } + if r.roleName != nil { + localVarQueryParams.Add("role_name", common.ParameterToString(*r.roleName, "")) + } + if r.accessKeyId != nil { + localVarQueryParams.Add("access_key_id", common.ParameterToString(*r.accessKeyId, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAWSTagFiltersRequest struct { + ctx _context.Context + accountId *string +} + +func (a *AWSIntegrationApi) buildListAWSTagFiltersRequest(ctx _context.Context, accountId string) (apiListAWSTagFiltersRequest, error) { + req := apiListAWSTagFiltersRequest{ + ctx: ctx, + accountId: &accountId, + } + return req, nil +} + +// ListAWSTagFilters Get all AWS tag filters. +// Get all AWS tag filters. +func (a *AWSIntegrationApi) ListAWSTagFilters(ctx _context.Context, accountId string) (AWSTagFilterListResponse, *_nethttp.Response, error) { + req, err := a.buildListAWSTagFiltersRequest(ctx, accountId) + if err != nil { + var localVarReturnValue AWSTagFilterListResponse + return localVarReturnValue, nil, err + } + + return a.listAWSTagFiltersExecute(req) +} + +// listAWSTagFiltersExecute executes the request. +func (a *AWSIntegrationApi) listAWSTagFiltersExecute(r apiListAWSTagFiltersRequest) (AWSTagFilterListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSTagFilterListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.ListAWSTagFilters") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/filtering" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.accountId == nil { + return localVarReturnValue, nil, common.ReportError("accountId is required and must be specified") + } + localVarQueryParams.Add("account_id", common.ParameterToString(*r.accountId, "")) + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAvailableAWSNamespacesRequest struct { + ctx _context.Context +} + +func (a *AWSIntegrationApi) buildListAvailableAWSNamespacesRequest(ctx _context.Context) (apiListAvailableAWSNamespacesRequest, error) { + req := apiListAvailableAWSNamespacesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListAvailableAWSNamespaces List namespace rules. +// List all namespace rules for a given Datadog-AWS integration. This endpoint takes no arguments. +func (a *AWSIntegrationApi) ListAvailableAWSNamespaces(ctx _context.Context) ([]string, *_nethttp.Response, error) { + req, err := a.buildListAvailableAWSNamespacesRequest(ctx) + if err != nil { + var localVarReturnValue []string + return localVarReturnValue, nil, err + } + + return a.listAvailableAWSNamespacesExecute(req) +} + +// listAvailableAWSNamespacesExecute executes the request. +func (a *AWSIntegrationApi) listAvailableAWSNamespacesExecute(r apiListAvailableAWSNamespacesRequest) ([]string, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []string + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.ListAvailableAWSNamespaces") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/available_namespace_rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateAWSAccountRequest struct { + ctx _context.Context + body *AWSAccount + accountId *string + roleName *string + accessKeyId *string +} + +// UpdateAWSAccountOptionalParameters holds optional parameters for UpdateAWSAccount. +type UpdateAWSAccountOptionalParameters struct { + AccountId *string + RoleName *string + AccessKeyId *string +} + +// NewUpdateAWSAccountOptionalParameters creates an empty struct for parameters. +func NewUpdateAWSAccountOptionalParameters() *UpdateAWSAccountOptionalParameters { + this := UpdateAWSAccountOptionalParameters{} + return &this +} + +// WithAccountId sets the corresponding parameter name and returns the struct. +func (r *UpdateAWSAccountOptionalParameters) WithAccountId(accountId string) *UpdateAWSAccountOptionalParameters { + r.AccountId = &accountId + return r +} + +// WithRoleName sets the corresponding parameter name and returns the struct. +func (r *UpdateAWSAccountOptionalParameters) WithRoleName(roleName string) *UpdateAWSAccountOptionalParameters { + r.RoleName = &roleName + return r +} + +// WithAccessKeyId sets the corresponding parameter name and returns the struct. +func (r *UpdateAWSAccountOptionalParameters) WithAccessKeyId(accessKeyId string) *UpdateAWSAccountOptionalParameters { + r.AccessKeyId = &accessKeyId + return r +} + +func (a *AWSIntegrationApi) buildUpdateAWSAccountRequest(ctx _context.Context, body AWSAccount, o ...UpdateAWSAccountOptionalParameters) (apiUpdateAWSAccountRequest, error) { + req := apiUpdateAWSAccountRequest{ + ctx: ctx, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type UpdateAWSAccountOptionalParameters is allowed") + } + + if o != nil { + req.accountId = o[0].AccountId + req.roleName = o[0].RoleName + req.accessKeyId = o[0].AccessKeyId + } + return req, nil +} + +// UpdateAWSAccount Update an AWS integration. +// Update a Datadog-Amazon Web Services integration. +func (a *AWSIntegrationApi) UpdateAWSAccount(ctx _context.Context, body AWSAccount, o ...UpdateAWSAccountOptionalParameters) (interface{}, *_nethttp.Response, error) { + req, err := a.buildUpdateAWSAccountRequest(ctx, body, o...) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.updateAWSAccountExecute(req) +} + +// updateAWSAccountExecute executes the request. +func (a *AWSIntegrationApi) updateAWSAccountExecute(r apiUpdateAWSAccountRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSIntegrationApi.UpdateAWSAccount") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + if r.accountId != nil { + localVarQueryParams.Add("account_id", common.ParameterToString(*r.accountId, "")) + } + if r.roleName != nil { + localVarQueryParams.Add("role_name", common.ParameterToString(*r.roleName, "")) + } + if r.accessKeyId != nil { + localVarQueryParams.Add("access_key_id", common.ParameterToString(*r.accessKeyId, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAWSIntegrationApi Returns NewAWSIntegrationApi. +func NewAWSIntegrationApi(client *common.APIClient) *AWSIntegrationApi { + return &AWSIntegrationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_aws_logs_integration.go b/api/v1/datadog/api_aws_logs_integration.go new file mode 100644 index 00000000000..26c700f1ea7 --- /dev/null +++ b/api/v1/datadog/api_aws_logs_integration.go @@ -0,0 +1,1010 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// AWSLogsIntegrationApi service type +type AWSLogsIntegrationApi common.Service + +type apiCheckAWSLogsLambdaAsyncRequest struct { + ctx _context.Context + body *AWSAccountAndLambdaRequest +} + +func (a *AWSLogsIntegrationApi) buildCheckAWSLogsLambdaAsyncRequest(ctx _context.Context, body AWSAccountAndLambdaRequest) (apiCheckAWSLogsLambdaAsyncRequest, error) { + req := apiCheckAWSLogsLambdaAsyncRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CheckAWSLogsLambdaAsync Check that an AWS Lambda Function exists. +// Test if permissions are present to add a log-forwarding triggers for the given services and AWS account. The input +// is the same as for Enable an AWS service log collection. Subsequent requests will always repeat the above, so this +// endpoint can be polled intermittently instead of blocking. +// +// - Returns a status of 'created' when it's checking if the Lambda exists in the account. +// - Returns a status of 'waiting' while checking. +// - Returns a status of 'checked and ok' if the Lambda exists. +// - Returns a status of 'error' if the Lambda does not exist. +func (a *AWSLogsIntegrationApi) CheckAWSLogsLambdaAsync(ctx _context.Context, body AWSAccountAndLambdaRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { + req, err := a.buildCheckAWSLogsLambdaAsyncRequest(ctx, body) + if err != nil { + var localVarReturnValue AWSLogsAsyncResponse + return localVarReturnValue, nil, err + } + + return a.checkAWSLogsLambdaAsyncExecute(req) +} + +// checkAWSLogsLambdaAsyncExecute executes the request. +func (a *AWSLogsIntegrationApi) checkAWSLogsLambdaAsyncExecute(r apiCheckAWSLogsLambdaAsyncRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AWSLogsAsyncResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.CheckAWSLogsLambdaAsync") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/logs/check_async" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCheckAWSLogsServicesAsyncRequest struct { + ctx _context.Context + body *AWSLogsServicesRequest +} + +func (a *AWSLogsIntegrationApi) buildCheckAWSLogsServicesAsyncRequest(ctx _context.Context, body AWSLogsServicesRequest) (apiCheckAWSLogsServicesAsyncRequest, error) { + req := apiCheckAWSLogsServicesAsyncRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CheckAWSLogsServicesAsync Check permissions for log services. +// Test if permissions are present to add log-forwarding triggers for the +// given services and AWS account. Input is the same as for `EnableAWSLogServices`. +// Done async, so can be repeatedly polled in a non-blocking fashion until +// the async request completes. +// +// - Returns a status of `created` when it's checking if the permissions exists +// in the AWS account. +// - Returns a status of `waiting` while checking. +// - Returns a status of `checked and ok` if the Lambda exists. +// - Returns a status of `error` if the Lambda does not exist. +func (a *AWSLogsIntegrationApi) CheckAWSLogsServicesAsync(ctx _context.Context, body AWSLogsServicesRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { + req, err := a.buildCheckAWSLogsServicesAsyncRequest(ctx, body) + if err != nil { + var localVarReturnValue AWSLogsAsyncResponse + return localVarReturnValue, nil, err + } + + return a.checkAWSLogsServicesAsyncExecute(req) +} + +// checkAWSLogsServicesAsyncExecute executes the request. +func (a *AWSLogsIntegrationApi) checkAWSLogsServicesAsyncExecute(r apiCheckAWSLogsServicesAsyncRequest) (AWSLogsAsyncResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AWSLogsAsyncResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.CheckAWSLogsServicesAsync") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/logs/services_async" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateAWSLambdaARNRequest struct { + ctx _context.Context + body *AWSAccountAndLambdaRequest +} + +func (a *AWSLogsIntegrationApi) buildCreateAWSLambdaARNRequest(ctx _context.Context, body AWSAccountAndLambdaRequest) (apiCreateAWSLambdaARNRequest, error) { + req := apiCreateAWSLambdaARNRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateAWSLambdaARN Add AWS Log Lambda ARN. +// Attach the Lambda ARN of the Lambda created for the Datadog-AWS log collection to your AWS account ID to enable log collection. +func (a *AWSLogsIntegrationApi) CreateAWSLambdaARN(ctx _context.Context, body AWSAccountAndLambdaRequest) (interface{}, *_nethttp.Response, error) { + req, err := a.buildCreateAWSLambdaARNRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.createAWSLambdaARNExecute(req) +} + +// createAWSLambdaARNExecute executes the request. +func (a *AWSLogsIntegrationApi) createAWSLambdaARNExecute(r apiCreateAWSLambdaARNRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.CreateAWSLambdaARN") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/logs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteAWSLambdaARNRequest struct { + ctx _context.Context + body *AWSAccountAndLambdaRequest +} + +func (a *AWSLogsIntegrationApi) buildDeleteAWSLambdaARNRequest(ctx _context.Context, body AWSAccountAndLambdaRequest) (apiDeleteAWSLambdaARNRequest, error) { + req := apiDeleteAWSLambdaARNRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteAWSLambdaARN Delete an AWS Logs integration. +// Delete a Datadog-AWS logs configuration by removing the specific Lambda ARN associated with a given AWS account. +func (a *AWSLogsIntegrationApi) DeleteAWSLambdaARN(ctx _context.Context, body AWSAccountAndLambdaRequest) (interface{}, *_nethttp.Response, error) { + req, err := a.buildDeleteAWSLambdaARNRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.deleteAWSLambdaARNExecute(req) +} + +// deleteAWSLambdaARNExecute executes the request. +func (a *AWSLogsIntegrationApi) deleteAWSLambdaARNExecute(r apiDeleteAWSLambdaARNRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.DeleteAWSLambdaARN") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/logs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiEnableAWSLogServicesRequest struct { + ctx _context.Context + body *AWSLogsServicesRequest +} + +func (a *AWSLogsIntegrationApi) buildEnableAWSLogServicesRequest(ctx _context.Context, body AWSLogsServicesRequest) (apiEnableAWSLogServicesRequest, error) { + req := apiEnableAWSLogServicesRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// EnableAWSLogServices Enable an AWS Logs integration. +// Enable automatic log collection for a list of services. This should be run after running `CreateAWSLambdaARN` to save the configuration. +func (a *AWSLogsIntegrationApi) EnableAWSLogServices(ctx _context.Context, body AWSLogsServicesRequest) (interface{}, *_nethttp.Response, error) { + req, err := a.buildEnableAWSLogServicesRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.enableAWSLogServicesExecute(req) +} + +// enableAWSLogServicesExecute executes the request. +func (a *AWSLogsIntegrationApi) enableAWSLogServicesExecute(r apiEnableAWSLogServicesRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.EnableAWSLogServices") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/logs/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAWSLogsIntegrationsRequest struct { + ctx _context.Context +} + +func (a *AWSLogsIntegrationApi) buildListAWSLogsIntegrationsRequest(ctx _context.Context) (apiListAWSLogsIntegrationsRequest, error) { + req := apiListAWSLogsIntegrationsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListAWSLogsIntegrations List all AWS Logs integrations. +// List all Datadog-AWS Logs integrations configured in your Datadog account. +func (a *AWSLogsIntegrationApi) ListAWSLogsIntegrations(ctx _context.Context) ([]AWSLogsListResponse, *_nethttp.Response, error) { + req, err := a.buildListAWSLogsIntegrationsRequest(ctx) + if err != nil { + var localVarReturnValue []AWSLogsListResponse + return localVarReturnValue, nil, err + } + + return a.listAWSLogsIntegrationsExecute(req) +} + +// listAWSLogsIntegrationsExecute executes the request. +func (a *AWSLogsIntegrationApi) listAWSLogsIntegrationsExecute(r apiListAWSLogsIntegrationsRequest) ([]AWSLogsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []AWSLogsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.ListAWSLogsIntegrations") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/logs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAWSLogsServicesRequest struct { + ctx _context.Context +} + +func (a *AWSLogsIntegrationApi) buildListAWSLogsServicesRequest(ctx _context.Context) (apiListAWSLogsServicesRequest, error) { + req := apiListAWSLogsServicesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListAWSLogsServices Get list of AWS log ready services. +// Get the list of current AWS services that Datadog offers automatic log collection. Use returned service IDs with the services parameter for the Enable an AWS service log collection API endpoint. +func (a *AWSLogsIntegrationApi) ListAWSLogsServices(ctx _context.Context) ([]AWSLogsListServicesResponse, *_nethttp.Response, error) { + req, err := a.buildListAWSLogsServicesRequest(ctx) + if err != nil { + var localVarReturnValue []AWSLogsListServicesResponse + return localVarReturnValue, nil, err + } + + return a.listAWSLogsServicesExecute(req) +} + +// listAWSLogsServicesExecute executes the request. +func (a *AWSLogsIntegrationApi) listAWSLogsServicesExecute(r apiListAWSLogsServicesRequest) ([]AWSLogsListServicesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []AWSLogsListServicesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AWSLogsIntegrationApi.ListAWSLogsServices") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/aws/logs/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAWSLogsIntegrationApi Returns NewAWSLogsIntegrationApi. +func NewAWSLogsIntegrationApi(client *common.APIClient) *AWSLogsIntegrationApi { + return &AWSLogsIntegrationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_azure_integration.go b/api/v1/datadog/api_azure_integration.go new file mode 100644 index 00000000000..d34a5ad69df --- /dev/null +++ b/api/v1/datadog/api_azure_integration.go @@ -0,0 +1,735 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// AzureIntegrationApi service type +type AzureIntegrationApi common.Service + +type apiCreateAzureIntegrationRequest struct { + ctx _context.Context + body *AzureAccount +} + +func (a *AzureIntegrationApi) buildCreateAzureIntegrationRequest(ctx _context.Context, body AzureAccount) (apiCreateAzureIntegrationRequest, error) { + req := apiCreateAzureIntegrationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateAzureIntegration Create an Azure integration. +// Create a Datadog-Azure integration. +// +// Using the `POST` method updates your integration configuration by adding your new +// configuration to the existing one in your Datadog organization. +// +// Using the `PUT` method updates your integration configuration by replacing your +// current configuration with the new one sent to your Datadog organization. +func (a *AzureIntegrationApi) CreateAzureIntegration(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { + req, err := a.buildCreateAzureIntegrationRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.createAzureIntegrationExecute(req) +} + +// createAzureIntegrationExecute executes the request. +func (a *AzureIntegrationApi) createAzureIntegrationExecute(r apiCreateAzureIntegrationRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.CreateAzureIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/azure" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteAzureIntegrationRequest struct { + ctx _context.Context + body *AzureAccount +} + +func (a *AzureIntegrationApi) buildDeleteAzureIntegrationRequest(ctx _context.Context, body AzureAccount) (apiDeleteAzureIntegrationRequest, error) { + req := apiDeleteAzureIntegrationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteAzureIntegration Delete an Azure integration. +// Delete a given Datadog-Azure integration from your Datadog account. +func (a *AzureIntegrationApi) DeleteAzureIntegration(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { + req, err := a.buildDeleteAzureIntegrationRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.deleteAzureIntegrationExecute(req) +} + +// deleteAzureIntegrationExecute executes the request. +func (a *AzureIntegrationApi) deleteAzureIntegrationExecute(r apiDeleteAzureIntegrationRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.DeleteAzureIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/azure" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAzureIntegrationRequest struct { + ctx _context.Context +} + +func (a *AzureIntegrationApi) buildListAzureIntegrationRequest(ctx _context.Context) (apiListAzureIntegrationRequest, error) { + req := apiListAzureIntegrationRequest{ + ctx: ctx, + } + return req, nil +} + +// ListAzureIntegration List all Azure integrations. +// List all Datadog-Azure integrations configured in your Datadog account. +func (a *AzureIntegrationApi) ListAzureIntegration(ctx _context.Context) ([]AzureAccount, *_nethttp.Response, error) { + req, err := a.buildListAzureIntegrationRequest(ctx) + if err != nil { + var localVarReturnValue []AzureAccount + return localVarReturnValue, nil, err + } + + return a.listAzureIntegrationExecute(req) +} + +// listAzureIntegrationExecute executes the request. +func (a *AzureIntegrationApi) listAzureIntegrationExecute(r apiListAzureIntegrationRequest) ([]AzureAccount, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []AzureAccount + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.ListAzureIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/azure" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateAzureHostFiltersRequest struct { + ctx _context.Context + body *AzureAccount +} + +func (a *AzureIntegrationApi) buildUpdateAzureHostFiltersRequest(ctx _context.Context, body AzureAccount) (apiUpdateAzureHostFiltersRequest, error) { + req := apiUpdateAzureHostFiltersRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// UpdateAzureHostFilters Update Azure integration host filters. +// Update the defined list of host filters for a given Datadog-Azure integration. +func (a *AzureIntegrationApi) UpdateAzureHostFilters(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { + req, err := a.buildUpdateAzureHostFiltersRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.updateAzureHostFiltersExecute(req) +} + +// updateAzureHostFiltersExecute executes the request. +func (a *AzureIntegrationApi) updateAzureHostFiltersExecute(r apiUpdateAzureHostFiltersRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.UpdateAzureHostFilters") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/azure/host_filters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateAzureIntegrationRequest struct { + ctx _context.Context + body *AzureAccount +} + +func (a *AzureIntegrationApi) buildUpdateAzureIntegrationRequest(ctx _context.Context, body AzureAccount) (apiUpdateAzureIntegrationRequest, error) { + req := apiUpdateAzureIntegrationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// UpdateAzureIntegration Update an Azure integration. +// Update a Datadog-Azure integration. Requires an existing `tenant_name` and `client_id`. +// Any other fields supplied will overwrite existing values. To overwrite `tenant_name` or `client_id`, +// use `new_tenant_name` and `new_client_id`. To leave a field unchanged, do not supply that field in the payload. +func (a *AzureIntegrationApi) UpdateAzureIntegration(ctx _context.Context, body AzureAccount) (interface{}, *_nethttp.Response, error) { + req, err := a.buildUpdateAzureIntegrationRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.updateAzureIntegrationExecute(req) +} + +// updateAzureIntegrationExecute executes the request. +func (a *AzureIntegrationApi) updateAzureIntegrationExecute(r apiUpdateAzureIntegrationRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.AzureIntegrationApi.UpdateAzureIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/azure" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAzureIntegrationApi Returns NewAzureIntegrationApi. +func NewAzureIntegrationApi(client *common.APIClient) *AzureIntegrationApi { + return &AzureIntegrationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_dashboard_lists.go b/api/v1/datadog/api_dashboard_lists.go new file mode 100644 index 00000000000..937ebcb7863 --- /dev/null +++ b/api/v1/datadog/api_dashboard_lists.go @@ -0,0 +1,721 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DashboardListsApi service type +type DashboardListsApi common.Service + +type apiCreateDashboardListRequest struct { + ctx _context.Context + body *DashboardList +} + +func (a *DashboardListsApi) buildCreateDashboardListRequest(ctx _context.Context, body DashboardList) (apiCreateDashboardListRequest, error) { + req := apiCreateDashboardListRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateDashboardList Create a dashboard list. +// Create an empty dashboard list. +func (a *DashboardListsApi) CreateDashboardList(ctx _context.Context, body DashboardList) (DashboardList, *_nethttp.Response, error) { + req, err := a.buildCreateDashboardListRequest(ctx, body) + if err != nil { + var localVarReturnValue DashboardList + return localVarReturnValue, nil, err + } + + return a.createDashboardListExecute(req) +} + +// createDashboardListExecute executes the request. +func (a *DashboardListsApi) createDashboardListExecute(r apiCreateDashboardListRequest) (DashboardList, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue DashboardList + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.CreateDashboardList") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/lists/manual" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteDashboardListRequest struct { + ctx _context.Context + listId int64 +} + +func (a *DashboardListsApi) buildDeleteDashboardListRequest(ctx _context.Context, listId int64) (apiDeleteDashboardListRequest, error) { + req := apiDeleteDashboardListRequest{ + ctx: ctx, + listId: listId, + } + return req, nil +} + +// DeleteDashboardList Delete a dashboard list. +// Delete a dashboard list. +func (a *DashboardListsApi) DeleteDashboardList(ctx _context.Context, listId int64) (DashboardListDeleteResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteDashboardListRequest(ctx, listId) + if err != nil { + var localVarReturnValue DashboardListDeleteResponse + return localVarReturnValue, nil, err + } + + return a.deleteDashboardListExecute(req) +} + +// deleteDashboardListExecute executes the request. +func (a *DashboardListsApi) deleteDashboardListExecute(r apiDeleteDashboardListRequest) (DashboardListDeleteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue DashboardListDeleteResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.DeleteDashboardList") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/lists/manual/{list_id}" + localVarPath = strings.Replace(localVarPath, "{"+"list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.listId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetDashboardListRequest struct { + ctx _context.Context + listId int64 +} + +func (a *DashboardListsApi) buildGetDashboardListRequest(ctx _context.Context, listId int64) (apiGetDashboardListRequest, error) { + req := apiGetDashboardListRequest{ + ctx: ctx, + listId: listId, + } + return req, nil +} + +// GetDashboardList Get a dashboard list. +// Fetch an existing dashboard list's definition. +func (a *DashboardListsApi) GetDashboardList(ctx _context.Context, listId int64) (DashboardList, *_nethttp.Response, error) { + req, err := a.buildGetDashboardListRequest(ctx, listId) + if err != nil { + var localVarReturnValue DashboardList + return localVarReturnValue, nil, err + } + + return a.getDashboardListExecute(req) +} + +// getDashboardListExecute executes the request. +func (a *DashboardListsApi) getDashboardListExecute(r apiGetDashboardListRequest) (DashboardList, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DashboardList + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.GetDashboardList") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/lists/manual/{list_id}" + localVarPath = strings.Replace(localVarPath, "{"+"list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.listId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListDashboardListsRequest struct { + ctx _context.Context +} + +func (a *DashboardListsApi) buildListDashboardListsRequest(ctx _context.Context) (apiListDashboardListsRequest, error) { + req := apiListDashboardListsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListDashboardLists Get all dashboard lists. +// Fetch all of your existing dashboard list definitions. +func (a *DashboardListsApi) ListDashboardLists(ctx _context.Context) (DashboardListListResponse, *_nethttp.Response, error) { + req, err := a.buildListDashboardListsRequest(ctx) + if err != nil { + var localVarReturnValue DashboardListListResponse + return localVarReturnValue, nil, err + } + + return a.listDashboardListsExecute(req) +} + +// listDashboardListsExecute executes the request. +func (a *DashboardListsApi) listDashboardListsExecute(r apiListDashboardListsRequest) (DashboardListListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DashboardListListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.ListDashboardLists") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/lists/manual" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateDashboardListRequest struct { + ctx _context.Context + listId int64 + body *DashboardList +} + +func (a *DashboardListsApi) buildUpdateDashboardListRequest(ctx _context.Context, listId int64, body DashboardList) (apiUpdateDashboardListRequest, error) { + req := apiUpdateDashboardListRequest{ + ctx: ctx, + listId: listId, + body: &body, + } + return req, nil +} + +// UpdateDashboardList Update a dashboard list. +// Update the name of a dashboard list. +func (a *DashboardListsApi) UpdateDashboardList(ctx _context.Context, listId int64, body DashboardList) (DashboardList, *_nethttp.Response, error) { + req, err := a.buildUpdateDashboardListRequest(ctx, listId, body) + if err != nil { + var localVarReturnValue DashboardList + return localVarReturnValue, nil, err + } + + return a.updateDashboardListExecute(req) +} + +// updateDashboardListExecute executes the request. +func (a *DashboardListsApi) updateDashboardListExecute(r apiUpdateDashboardListRequest) (DashboardList, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue DashboardList + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardListsApi.UpdateDashboardList") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/lists/manual/{list_id}" + localVarPath = strings.Replace(localVarPath, "{"+"list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.listId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewDashboardListsApi Returns NewDashboardListsApi. +func NewDashboardListsApi(client *common.APIClient) *DashboardListsApi { + return &DashboardListsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_dashboards.go b/api/v1/datadog/api_dashboards.go new file mode 100644 index 00000000000..5598c85ce6d --- /dev/null +++ b/api/v1/datadog/api_dashboards.go @@ -0,0 +1,1046 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DashboardsApi service type +type DashboardsApi common.Service + +type apiCreateDashboardRequest struct { + ctx _context.Context + body *Dashboard +} + +func (a *DashboardsApi) buildCreateDashboardRequest(ctx _context.Context, body Dashboard) (apiCreateDashboardRequest, error) { + req := apiCreateDashboardRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateDashboard Create a new dashboard. +// Create a dashboard using the specified options. When defining queries in your widgets, take note of which queries should have the `as_count()` or `as_rate()` modifiers appended. +// Refer to the following [documentation](https://docs.datadoghq.com/developers/metrics/type_modifiers/?tab=count#in-application-modifiers) for more information on these modifiers. +func (a *DashboardsApi) CreateDashboard(ctx _context.Context, body Dashboard) (Dashboard, *_nethttp.Response, error) { + req, err := a.buildCreateDashboardRequest(ctx, body) + if err != nil { + var localVarReturnValue Dashboard + return localVarReturnValue, nil, err + } + + return a.createDashboardExecute(req) +} + +// createDashboardExecute executes the request. +func (a *DashboardsApi) createDashboardExecute(r apiCreateDashboardRequest) (Dashboard, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue Dashboard + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.CreateDashboard") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteDashboardRequest struct { + ctx _context.Context + dashboardId string +} + +func (a *DashboardsApi) buildDeleteDashboardRequest(ctx _context.Context, dashboardId string) (apiDeleteDashboardRequest, error) { + req := apiDeleteDashboardRequest{ + ctx: ctx, + dashboardId: dashboardId, + } + return req, nil +} + +// DeleteDashboard Delete a dashboard. +// Delete a dashboard using the specified ID. +func (a *DashboardsApi) DeleteDashboard(ctx _context.Context, dashboardId string) (DashboardDeleteResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteDashboardRequest(ctx, dashboardId) + if err != nil { + var localVarReturnValue DashboardDeleteResponse + return localVarReturnValue, nil, err + } + + return a.deleteDashboardExecute(req) +} + +// deleteDashboardExecute executes the request. +func (a *DashboardsApi) deleteDashboardExecute(r apiDeleteDashboardRequest) (DashboardDeleteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue DashboardDeleteResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.DeleteDashboard") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/{dashboard_id}" + localVarPath = strings.Replace(localVarPath, "{"+"dashboard_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteDashboardsRequest struct { + ctx _context.Context + body *DashboardBulkDeleteRequest +} + +func (a *DashboardsApi) buildDeleteDashboardsRequest(ctx _context.Context, body DashboardBulkDeleteRequest) (apiDeleteDashboardsRequest, error) { + req := apiDeleteDashboardsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteDashboards Delete dashboards. +// Delete dashboards using the specified IDs. If there are any failures, no dashboards will be deleted (partial success is not allowed). +func (a *DashboardsApi) DeleteDashboards(ctx _context.Context, body DashboardBulkDeleteRequest) (*_nethttp.Response, error) { + req, err := a.buildDeleteDashboardsRequest(ctx, body) + if err != nil { + return nil, err + } + + return a.deleteDashboardsExecute(req) +} + +// deleteDashboardsExecute executes the request. +func (a *DashboardsApi) deleteDashboardsExecute(r apiDeleteDashboardsRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.DeleteDashboards") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetDashboardRequest struct { + ctx _context.Context + dashboardId string +} + +func (a *DashboardsApi) buildGetDashboardRequest(ctx _context.Context, dashboardId string) (apiGetDashboardRequest, error) { + req := apiGetDashboardRequest{ + ctx: ctx, + dashboardId: dashboardId, + } + return req, nil +} + +// GetDashboard Get a dashboard. +// Get a dashboard using the specified ID. +func (a *DashboardsApi) GetDashboard(ctx _context.Context, dashboardId string) (Dashboard, *_nethttp.Response, error) { + req, err := a.buildGetDashboardRequest(ctx, dashboardId) + if err != nil { + var localVarReturnValue Dashboard + return localVarReturnValue, nil, err + } + + return a.getDashboardExecute(req) +} + +// getDashboardExecute executes the request. +func (a *DashboardsApi) getDashboardExecute(r apiGetDashboardRequest) (Dashboard, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue Dashboard + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.GetDashboard") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/{dashboard_id}" + localVarPath = strings.Replace(localVarPath, "{"+"dashboard_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListDashboardsRequest struct { + ctx _context.Context + filterShared *bool + filterDeleted *bool +} + +// ListDashboardsOptionalParameters holds optional parameters for ListDashboards. +type ListDashboardsOptionalParameters struct { + FilterShared *bool + FilterDeleted *bool +} + +// NewListDashboardsOptionalParameters creates an empty struct for parameters. +func NewListDashboardsOptionalParameters() *ListDashboardsOptionalParameters { + this := ListDashboardsOptionalParameters{} + return &this +} + +// WithFilterShared sets the corresponding parameter name and returns the struct. +func (r *ListDashboardsOptionalParameters) WithFilterShared(filterShared bool) *ListDashboardsOptionalParameters { + r.FilterShared = &filterShared + return r +} + +// WithFilterDeleted sets the corresponding parameter name and returns the struct. +func (r *ListDashboardsOptionalParameters) WithFilterDeleted(filterDeleted bool) *ListDashboardsOptionalParameters { + r.FilterDeleted = &filterDeleted + return r +} + +func (a *DashboardsApi) buildListDashboardsRequest(ctx _context.Context, o ...ListDashboardsOptionalParameters) (apiListDashboardsRequest, error) { + req := apiListDashboardsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListDashboardsOptionalParameters is allowed") + } + + if o != nil { + req.filterShared = o[0].FilterShared + req.filterDeleted = o[0].FilterDeleted + } + return req, nil +} + +// ListDashboards Get all dashboards. +// Get all dashboards. +// +// **Note**: This query will only return custom created or cloned dashboards. +// This query will not return preset dashboards. +func (a *DashboardsApi) ListDashboards(ctx _context.Context, o ...ListDashboardsOptionalParameters) (DashboardSummary, *_nethttp.Response, error) { + req, err := a.buildListDashboardsRequest(ctx, o...) + if err != nil { + var localVarReturnValue DashboardSummary + return localVarReturnValue, nil, err + } + + return a.listDashboardsExecute(req) +} + +// listDashboardsExecute executes the request. +func (a *DashboardsApi) listDashboardsExecute(r apiListDashboardsRequest) (DashboardSummary, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DashboardSummary + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.ListDashboards") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterShared != nil { + localVarQueryParams.Add("filter[shared]", common.ParameterToString(*r.filterShared, "")) + } + if r.filterDeleted != nil { + localVarQueryParams.Add("filter[deleted]", common.ParameterToString(*r.filterDeleted, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiRestoreDashboardsRequest struct { + ctx _context.Context + body *DashboardRestoreRequest +} + +func (a *DashboardsApi) buildRestoreDashboardsRequest(ctx _context.Context, body DashboardRestoreRequest) (apiRestoreDashboardsRequest, error) { + req := apiRestoreDashboardsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// RestoreDashboards Restore deleted dashboards. +// Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed). +func (a *DashboardsApi) RestoreDashboards(ctx _context.Context, body DashboardRestoreRequest) (*_nethttp.Response, error) { + req, err := a.buildRestoreDashboardsRequest(ctx, body) + if err != nil { + return nil, err + } + + return a.restoreDashboardsExecute(req) +} + +// restoreDashboardsExecute executes the request. +func (a *DashboardsApi) restoreDashboardsExecute(r apiRestoreDashboardsRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.RestoreDashboards") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiUpdateDashboardRequest struct { + ctx _context.Context + dashboardId string + body *Dashboard +} + +func (a *DashboardsApi) buildUpdateDashboardRequest(ctx _context.Context, dashboardId string, body Dashboard) (apiUpdateDashboardRequest, error) { + req := apiUpdateDashboardRequest{ + ctx: ctx, + dashboardId: dashboardId, + body: &body, + } + return req, nil +} + +// UpdateDashboard Update a dashboard. +// Update a dashboard using the specified ID. +func (a *DashboardsApi) UpdateDashboard(ctx _context.Context, dashboardId string, body Dashboard) (Dashboard, *_nethttp.Response, error) { + req, err := a.buildUpdateDashboardRequest(ctx, dashboardId, body) + if err != nil { + var localVarReturnValue Dashboard + return localVarReturnValue, nil, err + } + + return a.updateDashboardExecute(req) +} + +// updateDashboardExecute executes the request. +func (a *DashboardsApi) updateDashboardExecute(r apiUpdateDashboardRequest) (Dashboard, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue Dashboard + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DashboardsApi.UpdateDashboard") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/dashboard/{dashboard_id}" + localVarPath = strings.Replace(localVarPath, "{"+"dashboard_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewDashboardsApi Returns NewDashboardsApi. +func NewDashboardsApi(client *common.APIClient) *DashboardsApi { + return &DashboardsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_downtimes.go b/api/v1/datadog/api_downtimes.go new file mode 100644 index 00000000000..66e49b50eb3 --- /dev/null +++ b/api/v1/datadog/api_downtimes.go @@ -0,0 +1,1027 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DowntimesApi service type +type DowntimesApi common.Service + +type apiCancelDowntimeRequest struct { + ctx _context.Context + downtimeId int64 +} + +func (a *DowntimesApi) buildCancelDowntimeRequest(ctx _context.Context, downtimeId int64) (apiCancelDowntimeRequest, error) { + req := apiCancelDowntimeRequest{ + ctx: ctx, + downtimeId: downtimeId, + } + return req, nil +} + +// CancelDowntime Cancel a downtime. +// Cancel a downtime. +func (a *DowntimesApi) CancelDowntime(ctx _context.Context, downtimeId int64) (*_nethttp.Response, error) { + req, err := a.buildCancelDowntimeRequest(ctx, downtimeId) + if err != nil { + return nil, err + } + + return a.cancelDowntimeExecute(req) +} + +// cancelDowntimeExecute executes the request. +func (a *DowntimesApi) cancelDowntimeExecute(r apiCancelDowntimeRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.CancelDowntime") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/downtime/{downtime_id}" + localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(common.ParameterToString(r.downtimeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiCancelDowntimesByScopeRequest struct { + ctx _context.Context + body *CancelDowntimesByScopeRequest +} + +func (a *DowntimesApi) buildCancelDowntimesByScopeRequest(ctx _context.Context, body CancelDowntimesByScopeRequest) (apiCancelDowntimesByScopeRequest, error) { + req := apiCancelDowntimesByScopeRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CancelDowntimesByScope Cancel downtimes by scope. +// Delete all downtimes that match the scope of `X`. +func (a *DowntimesApi) CancelDowntimesByScope(ctx _context.Context, body CancelDowntimesByScopeRequest) (CanceledDowntimesIds, *_nethttp.Response, error) { + req, err := a.buildCancelDowntimesByScopeRequest(ctx, body) + if err != nil { + var localVarReturnValue CanceledDowntimesIds + return localVarReturnValue, nil, err + } + + return a.cancelDowntimesByScopeExecute(req) +} + +// cancelDowntimesByScopeExecute executes the request. +func (a *DowntimesApi) cancelDowntimesByScopeExecute(r apiCancelDowntimesByScopeRequest) (CanceledDowntimesIds, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue CanceledDowntimesIds + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.CancelDowntimesByScope") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/downtime/cancel/by_scope" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateDowntimeRequest struct { + ctx _context.Context + body *Downtime +} + +func (a *DowntimesApi) buildCreateDowntimeRequest(ctx _context.Context, body Downtime) (apiCreateDowntimeRequest, error) { + req := apiCreateDowntimeRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateDowntime Schedule a downtime. +// Schedule a downtime. +func (a *DowntimesApi) CreateDowntime(ctx _context.Context, body Downtime) (Downtime, *_nethttp.Response, error) { + req, err := a.buildCreateDowntimeRequest(ctx, body) + if err != nil { + var localVarReturnValue Downtime + return localVarReturnValue, nil, err + } + + return a.createDowntimeExecute(req) +} + +// createDowntimeExecute executes the request. +func (a *DowntimesApi) createDowntimeExecute(r apiCreateDowntimeRequest) (Downtime, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue Downtime + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.CreateDowntime") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/downtime" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetDowntimeRequest struct { + ctx _context.Context + downtimeId int64 +} + +func (a *DowntimesApi) buildGetDowntimeRequest(ctx _context.Context, downtimeId int64) (apiGetDowntimeRequest, error) { + req := apiGetDowntimeRequest{ + ctx: ctx, + downtimeId: downtimeId, + } + return req, nil +} + +// GetDowntime Get a downtime. +// Get downtime detail by `downtime_id`. +func (a *DowntimesApi) GetDowntime(ctx _context.Context, downtimeId int64) (Downtime, *_nethttp.Response, error) { + req, err := a.buildGetDowntimeRequest(ctx, downtimeId) + if err != nil { + var localVarReturnValue Downtime + return localVarReturnValue, nil, err + } + + return a.getDowntimeExecute(req) +} + +// getDowntimeExecute executes the request. +func (a *DowntimesApi) getDowntimeExecute(r apiGetDowntimeRequest) (Downtime, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue Downtime + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.GetDowntime") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/downtime/{downtime_id}" + localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(common.ParameterToString(r.downtimeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListDowntimesRequest struct { + ctx _context.Context + currentOnly *bool +} + +// ListDowntimesOptionalParameters holds optional parameters for ListDowntimes. +type ListDowntimesOptionalParameters struct { + CurrentOnly *bool +} + +// NewListDowntimesOptionalParameters creates an empty struct for parameters. +func NewListDowntimesOptionalParameters() *ListDowntimesOptionalParameters { + this := ListDowntimesOptionalParameters{} + return &this +} + +// WithCurrentOnly sets the corresponding parameter name and returns the struct. +func (r *ListDowntimesOptionalParameters) WithCurrentOnly(currentOnly bool) *ListDowntimesOptionalParameters { + r.CurrentOnly = ¤tOnly + return r +} + +func (a *DowntimesApi) buildListDowntimesRequest(ctx _context.Context, o ...ListDowntimesOptionalParameters) (apiListDowntimesRequest, error) { + req := apiListDowntimesRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListDowntimesOptionalParameters is allowed") + } + + if o != nil { + req.currentOnly = o[0].CurrentOnly + } + return req, nil +} + +// ListDowntimes Get all downtimes. +// Get all scheduled downtimes. +func (a *DowntimesApi) ListDowntimes(ctx _context.Context, o ...ListDowntimesOptionalParameters) ([]Downtime, *_nethttp.Response, error) { + req, err := a.buildListDowntimesRequest(ctx, o...) + if err != nil { + var localVarReturnValue []Downtime + return localVarReturnValue, nil, err + } + + return a.listDowntimesExecute(req) +} + +// listDowntimesExecute executes the request. +func (a *DowntimesApi) listDowntimesExecute(r apiListDowntimesRequest) ([]Downtime, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []Downtime + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.ListDowntimes") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/downtime" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.currentOnly != nil { + localVarQueryParams.Add("current_only", common.ParameterToString(*r.currentOnly, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListMonitorDowntimesRequest struct { + ctx _context.Context + monitorId int64 +} + +func (a *DowntimesApi) buildListMonitorDowntimesRequest(ctx _context.Context, monitorId int64) (apiListMonitorDowntimesRequest, error) { + req := apiListMonitorDowntimesRequest{ + ctx: ctx, + monitorId: monitorId, + } + return req, nil +} + +// ListMonitorDowntimes Get all downtimes for a monitor. +// Get all active downtimes for the specified monitor. +func (a *DowntimesApi) ListMonitorDowntimes(ctx _context.Context, monitorId int64) ([]Downtime, *_nethttp.Response, error) { + req, err := a.buildListMonitorDowntimesRequest(ctx, monitorId) + if err != nil { + var localVarReturnValue []Downtime + return localVarReturnValue, nil, err + } + + return a.listMonitorDowntimesExecute(req) +} + +// listMonitorDowntimesExecute executes the request. +func (a *DowntimesApi) listMonitorDowntimesExecute(r apiListMonitorDowntimesRequest) ([]Downtime, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []Downtime + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.ListMonitorDowntimes") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}/downtimes" + localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateDowntimeRequest struct { + ctx _context.Context + downtimeId int64 + body *Downtime +} + +func (a *DowntimesApi) buildUpdateDowntimeRequest(ctx _context.Context, downtimeId int64, body Downtime) (apiUpdateDowntimeRequest, error) { + req := apiUpdateDowntimeRequest{ + ctx: ctx, + downtimeId: downtimeId, + body: &body, + } + return req, nil +} + +// UpdateDowntime Update a downtime. +// Update a single downtime by `downtime_id`. +func (a *DowntimesApi) UpdateDowntime(ctx _context.Context, downtimeId int64, body Downtime) (Downtime, *_nethttp.Response, error) { + req, err := a.buildUpdateDowntimeRequest(ctx, downtimeId, body) + if err != nil { + var localVarReturnValue Downtime + return localVarReturnValue, nil, err + } + + return a.updateDowntimeExecute(req) +} + +// updateDowntimeExecute executes the request. +func (a *DowntimesApi) updateDowntimeExecute(r apiUpdateDowntimeRequest) (Downtime, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue Downtime + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.DowntimesApi.UpdateDowntime") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/downtime/{downtime_id}" + localVarPath = strings.Replace(localVarPath, "{"+"downtime_id"+"}", _neturl.PathEscape(common.ParameterToString(r.downtimeId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewDowntimesApi Returns NewDowntimesApi. +func NewDowntimesApi(client *common.APIClient) *DowntimesApi { + return &DowntimesApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_events.go b/api/v1/datadog/api_events.go new file mode 100644 index 00000000000..739fe6bbf7a --- /dev/null +++ b/api/v1/datadog/api_events.go @@ -0,0 +1,529 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// EventsApi service type +type EventsApi common.Service + +type apiCreateEventRequest struct { + ctx _context.Context + body *EventCreateRequest +} + +func (a *EventsApi) buildCreateEventRequest(ctx _context.Context, body EventCreateRequest) (apiCreateEventRequest, error) { + req := apiCreateEventRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateEvent Post an event. +// This endpoint allows you to post events to the stream. +// Tag them, set priority and event aggregate them with other events. +func (a *EventsApi) CreateEvent(ctx _context.Context, body EventCreateRequest) (EventCreateResponse, *_nethttp.Response, error) { + req, err := a.buildCreateEventRequest(ctx, body) + if err != nil { + var localVarReturnValue EventCreateResponse + return localVarReturnValue, nil, err + } + + return a.createEventExecute(req) +} + +// createEventExecute executes the request. +func (a *EventsApi) createEventExecute(r apiCreateEventRequest) (EventCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue EventCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.EventsApi.CreateEvent") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetEventRequest struct { + ctx _context.Context + eventId int64 +} + +func (a *EventsApi) buildGetEventRequest(ctx _context.Context, eventId int64) (apiGetEventRequest, error) { + req := apiGetEventRequest{ + ctx: ctx, + eventId: eventId, + } + return req, nil +} + +// GetEvent Get an event. +// This endpoint allows you to query for event details. +// +// **Note**: If the event you’re querying contains markdown formatting of any kind, +// you may see characters such as `%`,`\`,`n` in your output. +func (a *EventsApi) GetEvent(ctx _context.Context, eventId int64) (EventResponse, *_nethttp.Response, error) { + req, err := a.buildGetEventRequest(ctx, eventId) + if err != nil { + var localVarReturnValue EventResponse + return localVarReturnValue, nil, err + } + + return a.getEventExecute(req) +} + +// getEventExecute executes the request. +func (a *EventsApi) getEventExecute(r apiGetEventRequest) (EventResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue EventResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.EventsApi.GetEvent") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/events/{event_id}" + localVarPath = strings.Replace(localVarPath, "{"+"event_id"+"}", _neturl.PathEscape(common.ParameterToString(r.eventId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListEventsRequest struct { + ctx _context.Context + start *int64 + end *int64 + priority *EventPriority + sources *string + tags *string + unaggregated *bool + excludeAggregate *bool + page *int32 +} + +// ListEventsOptionalParameters holds optional parameters for ListEvents. +type ListEventsOptionalParameters struct { + Priority *EventPriority + Sources *string + Tags *string + Unaggregated *bool + ExcludeAggregate *bool + Page *int32 +} + +// NewListEventsOptionalParameters creates an empty struct for parameters. +func NewListEventsOptionalParameters() *ListEventsOptionalParameters { + this := ListEventsOptionalParameters{} + return &this +} + +// WithPriority sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithPriority(priority EventPriority) *ListEventsOptionalParameters { + r.Priority = &priority + return r +} + +// WithSources sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithSources(sources string) *ListEventsOptionalParameters { + r.Sources = &sources + return r +} + +// WithTags sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithTags(tags string) *ListEventsOptionalParameters { + r.Tags = &tags + return r +} + +// WithUnaggregated sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithUnaggregated(unaggregated bool) *ListEventsOptionalParameters { + r.Unaggregated = &unaggregated + return r +} + +// WithExcludeAggregate sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithExcludeAggregate(excludeAggregate bool) *ListEventsOptionalParameters { + r.ExcludeAggregate = &excludeAggregate + return r +} + +// WithPage sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithPage(page int32) *ListEventsOptionalParameters { + r.Page = &page + return r +} + +func (a *EventsApi) buildListEventsRequest(ctx _context.Context, start int64, end int64, o ...ListEventsOptionalParameters) (apiListEventsRequest, error) { + req := apiListEventsRequest{ + ctx: ctx, + start: &start, + end: &end, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListEventsOptionalParameters is allowed") + } + + if o != nil { + req.priority = o[0].Priority + req.sources = o[0].Sources + req.tags = o[0].Tags + req.unaggregated = o[0].Unaggregated + req.excludeAggregate = o[0].ExcludeAggregate + req.page = o[0].Page + } + return req, nil +} + +// ListEvents Get a list of events. +// The event stream can be queried and filtered by time, priority, sources and tags. +// +// **Notes**: +// - If the event you’re querying contains markdown formatting of any kind, +// you may see characters such as `%`,`\`,`n` in your output. +// +// - This endpoint returns a maximum of `1000` most recent results. To return additional results, +// identify the last timestamp of the last result and set that as the `end` query time to +// paginate the results. You can also use the page parameter to specify which set of `1000` results to return. +func (a *EventsApi) ListEvents(ctx _context.Context, start int64, end int64, o ...ListEventsOptionalParameters) (EventListResponse, *_nethttp.Response, error) { + req, err := a.buildListEventsRequest(ctx, start, end, o...) + if err != nil { + var localVarReturnValue EventListResponse + return localVarReturnValue, nil, err + } + + return a.listEventsExecute(req) +} + +// listEventsExecute executes the request. +func (a *EventsApi) listEventsExecute(r apiListEventsRequest) (EventListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue EventListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.EventsApi.ListEvents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.start == nil { + return localVarReturnValue, nil, common.ReportError("start is required and must be specified") + } + if r.end == nil { + return localVarReturnValue, nil, common.ReportError("end is required and must be specified") + } + localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) + localVarQueryParams.Add("end", common.ParameterToString(*r.end, "")) + if r.priority != nil { + localVarQueryParams.Add("priority", common.ParameterToString(*r.priority, "")) + } + if r.sources != nil { + localVarQueryParams.Add("sources", common.ParameterToString(*r.sources, "")) + } + if r.tags != nil { + localVarQueryParams.Add("tags", common.ParameterToString(*r.tags, "")) + } + if r.unaggregated != nil { + localVarQueryParams.Add("unaggregated", common.ParameterToString(*r.unaggregated, "")) + } + if r.excludeAggregate != nil { + localVarQueryParams.Add("exclude_aggregate", common.ParameterToString(*r.excludeAggregate, "")) + } + if r.page != nil { + localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewEventsApi Returns NewEventsApi. +func NewEventsApi(client *common.APIClient) *EventsApi { + return &EventsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_gcp_integration.go b/api/v1/datadog/api_gcp_integration.go new file mode 100644 index 00000000000..70b6e7e0e6a --- /dev/null +++ b/api/v1/datadog/api_gcp_integration.go @@ -0,0 +1,588 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// GCPIntegrationApi service type +type GCPIntegrationApi common.Service + +type apiCreateGCPIntegrationRequest struct { + ctx _context.Context + body *GCPAccount +} + +func (a *GCPIntegrationApi) buildCreateGCPIntegrationRequest(ctx _context.Context, body GCPAccount) (apiCreateGCPIntegrationRequest, error) { + req := apiCreateGCPIntegrationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateGCPIntegration Create a GCP integration. +// Create a Datadog-GCP integration. +func (a *GCPIntegrationApi) CreateGCPIntegration(ctx _context.Context, body GCPAccount) (interface{}, *_nethttp.Response, error) { + req, err := a.buildCreateGCPIntegrationRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.createGCPIntegrationExecute(req) +} + +// createGCPIntegrationExecute executes the request. +func (a *GCPIntegrationApi) createGCPIntegrationExecute(r apiCreateGCPIntegrationRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.CreateGCPIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/gcp" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteGCPIntegrationRequest struct { + ctx _context.Context + body *GCPAccount +} + +func (a *GCPIntegrationApi) buildDeleteGCPIntegrationRequest(ctx _context.Context, body GCPAccount) (apiDeleteGCPIntegrationRequest, error) { + req := apiDeleteGCPIntegrationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteGCPIntegration Delete a GCP integration. +// Delete a given Datadog-GCP integration. +func (a *GCPIntegrationApi) DeleteGCPIntegration(ctx _context.Context, body GCPAccount) (interface{}, *_nethttp.Response, error) { + req, err := a.buildDeleteGCPIntegrationRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.deleteGCPIntegrationExecute(req) +} + +// deleteGCPIntegrationExecute executes the request. +func (a *GCPIntegrationApi) deleteGCPIntegrationExecute(r apiDeleteGCPIntegrationRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.DeleteGCPIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/gcp" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListGCPIntegrationRequest struct { + ctx _context.Context +} + +func (a *GCPIntegrationApi) buildListGCPIntegrationRequest(ctx _context.Context) (apiListGCPIntegrationRequest, error) { + req := apiListGCPIntegrationRequest{ + ctx: ctx, + } + return req, nil +} + +// ListGCPIntegration List all GCP integrations. +// List all Datadog-GCP integrations configured in your Datadog account. +func (a *GCPIntegrationApi) ListGCPIntegration(ctx _context.Context) ([]GCPAccount, *_nethttp.Response, error) { + req, err := a.buildListGCPIntegrationRequest(ctx) + if err != nil { + var localVarReturnValue []GCPAccount + return localVarReturnValue, nil, err + } + + return a.listGCPIntegrationExecute(req) +} + +// listGCPIntegrationExecute executes the request. +func (a *GCPIntegrationApi) listGCPIntegrationExecute(r apiListGCPIntegrationRequest) ([]GCPAccount, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []GCPAccount + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.ListGCPIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/gcp" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateGCPIntegrationRequest struct { + ctx _context.Context + body *GCPAccount +} + +func (a *GCPIntegrationApi) buildUpdateGCPIntegrationRequest(ctx _context.Context, body GCPAccount) (apiUpdateGCPIntegrationRequest, error) { + req := apiUpdateGCPIntegrationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// UpdateGCPIntegration Update a GCP integration. +// Update a Datadog-GCP integrations host_filters and/or auto-mute. +// Requires a `project_id` and `client_email`, however these fields cannot be updated. +// If you need to update these fields, delete and use the create (`POST`) endpoint. +// The unspecified fields will keep their original values. +func (a *GCPIntegrationApi) UpdateGCPIntegration(ctx _context.Context, body GCPAccount) (interface{}, *_nethttp.Response, error) { + req, err := a.buildUpdateGCPIntegrationRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.updateGCPIntegrationExecute(req) +} + +// updateGCPIntegrationExecute executes the request. +func (a *GCPIntegrationApi) updateGCPIntegrationExecute(r apiUpdateGCPIntegrationRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.GCPIntegrationApi.UpdateGCPIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/gcp" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewGCPIntegrationApi Returns NewGCPIntegrationApi. +func NewGCPIntegrationApi(client *common.APIClient) *GCPIntegrationApi { + return &GCPIntegrationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_hosts.go b/api/v1/datadog/api_hosts.go new file mode 100644 index 00000000000..ca8c9c33f07 --- /dev/null +++ b/api/v1/datadog/api_hosts.go @@ -0,0 +1,722 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// HostsApi service type +type HostsApi common.Service + +type apiGetHostTotalsRequest struct { + ctx _context.Context + from *int64 +} + +// GetHostTotalsOptionalParameters holds optional parameters for GetHostTotals. +type GetHostTotalsOptionalParameters struct { + From *int64 +} + +// NewGetHostTotalsOptionalParameters creates an empty struct for parameters. +func NewGetHostTotalsOptionalParameters() *GetHostTotalsOptionalParameters { + this := GetHostTotalsOptionalParameters{} + return &this +} + +// WithFrom sets the corresponding parameter name and returns the struct. +func (r *GetHostTotalsOptionalParameters) WithFrom(from int64) *GetHostTotalsOptionalParameters { + r.From = &from + return r +} + +func (a *HostsApi) buildGetHostTotalsRequest(ctx _context.Context, o ...GetHostTotalsOptionalParameters) (apiGetHostTotalsRequest, error) { + req := apiGetHostTotalsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetHostTotalsOptionalParameters is allowed") + } + + if o != nil { + req.from = o[0].From + } + return req, nil +} + +// GetHostTotals Get the total number of active hosts. +// This endpoint returns the total number of active and up hosts in your Datadog account. +// Active means the host has reported in the past hour, and up means it has reported in the past two hours. +func (a *HostsApi) GetHostTotals(ctx _context.Context, o ...GetHostTotalsOptionalParameters) (HostTotals, *_nethttp.Response, error) { + req, err := a.buildGetHostTotalsRequest(ctx, o...) + if err != nil { + var localVarReturnValue HostTotals + return localVarReturnValue, nil, err + } + + return a.getHostTotalsExecute(req) +} + +// getHostTotalsExecute executes the request. +func (a *HostsApi) getHostTotalsExecute(r apiGetHostTotalsRequest) (HostTotals, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue HostTotals + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.GetHostTotals") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/hosts/totals" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.from != nil { + localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListHostsRequest struct { + ctx _context.Context + filter *string + sortField *string + sortDir *string + start *int64 + count *int64 + from *int64 + includeMutedHostsData *bool + includeHostsMetadata *bool +} + +// ListHostsOptionalParameters holds optional parameters for ListHosts. +type ListHostsOptionalParameters struct { + Filter *string + SortField *string + SortDir *string + Start *int64 + Count *int64 + From *int64 + IncludeMutedHostsData *bool + IncludeHostsMetadata *bool +} + +// NewListHostsOptionalParameters creates an empty struct for parameters. +func NewListHostsOptionalParameters() *ListHostsOptionalParameters { + this := ListHostsOptionalParameters{} + return &this +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithFilter(filter string) *ListHostsOptionalParameters { + r.Filter = &filter + return r +} + +// WithSortField sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithSortField(sortField string) *ListHostsOptionalParameters { + r.SortField = &sortField + return r +} + +// WithSortDir sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithSortDir(sortDir string) *ListHostsOptionalParameters { + r.SortDir = &sortDir + return r +} + +// WithStart sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithStart(start int64) *ListHostsOptionalParameters { + r.Start = &start + return r +} + +// WithCount sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithCount(count int64) *ListHostsOptionalParameters { + r.Count = &count + return r +} + +// WithFrom sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithFrom(from int64) *ListHostsOptionalParameters { + r.From = &from + return r +} + +// WithIncludeMutedHostsData sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithIncludeMutedHostsData(includeMutedHostsData bool) *ListHostsOptionalParameters { + r.IncludeMutedHostsData = &includeMutedHostsData + return r +} + +// WithIncludeHostsMetadata sets the corresponding parameter name and returns the struct. +func (r *ListHostsOptionalParameters) WithIncludeHostsMetadata(includeHostsMetadata bool) *ListHostsOptionalParameters { + r.IncludeHostsMetadata = &includeHostsMetadata + return r +} + +func (a *HostsApi) buildListHostsRequest(ctx _context.Context, o ...ListHostsOptionalParameters) (apiListHostsRequest, error) { + req := apiListHostsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListHostsOptionalParameters is allowed") + } + + if o != nil { + req.filter = o[0].Filter + req.sortField = o[0].SortField + req.sortDir = o[0].SortDir + req.start = o[0].Start + req.count = o[0].Count + req.from = o[0].From + req.includeMutedHostsData = o[0].IncludeMutedHostsData + req.includeHostsMetadata = o[0].IncludeHostsMetadata + } + return req, nil +} + +// ListHosts Get all hosts for your organization. +// This endpoint allows searching for hosts by name, alias, or tag. +// Hosts live within the past 3 hours are included by default. +// Retention is 7 days. +// Results are paginated with a max of 1000 results at a time. +func (a *HostsApi) ListHosts(ctx _context.Context, o ...ListHostsOptionalParameters) (HostListResponse, *_nethttp.Response, error) { + req, err := a.buildListHostsRequest(ctx, o...) + if err != nil { + var localVarReturnValue HostListResponse + return localVarReturnValue, nil, err + } + + return a.listHostsExecute(req) +} + +// listHostsExecute executes the request. +func (a *HostsApi) listHostsExecute(r apiListHostsRequest) (HostListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue HostListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.ListHosts") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/hosts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + if r.sortField != nil { + localVarQueryParams.Add("sort_field", common.ParameterToString(*r.sortField, "")) + } + if r.sortDir != nil { + localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) + } + if r.start != nil { + localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) + } + if r.count != nil { + localVarQueryParams.Add("count", common.ParameterToString(*r.count, "")) + } + if r.from != nil { + localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) + } + if r.includeMutedHostsData != nil { + localVarQueryParams.Add("include_muted_hosts_data", common.ParameterToString(*r.includeMutedHostsData, "")) + } + if r.includeHostsMetadata != nil { + localVarQueryParams.Add("include_hosts_metadata", common.ParameterToString(*r.includeHostsMetadata, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiMuteHostRequest struct { + ctx _context.Context + hostName string + body *HostMuteSettings +} + +func (a *HostsApi) buildMuteHostRequest(ctx _context.Context, hostName string, body HostMuteSettings) (apiMuteHostRequest, error) { + req := apiMuteHostRequest{ + ctx: ctx, + hostName: hostName, + body: &body, + } + return req, nil +} + +// MuteHost Mute a host. +// Mute a host. +func (a *HostsApi) MuteHost(ctx _context.Context, hostName string, body HostMuteSettings) (HostMuteResponse, *_nethttp.Response, error) { + req, err := a.buildMuteHostRequest(ctx, hostName, body) + if err != nil { + var localVarReturnValue HostMuteResponse + return localVarReturnValue, nil, err + } + + return a.muteHostExecute(req) +} + +// muteHostExecute executes the request. +func (a *HostsApi) muteHostExecute(r apiMuteHostRequest) (HostMuteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue HostMuteResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.MuteHost") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/host/{host_name}/mute" + localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUnmuteHostRequest struct { + ctx _context.Context + hostName string +} + +func (a *HostsApi) buildUnmuteHostRequest(ctx _context.Context, hostName string) (apiUnmuteHostRequest, error) { + req := apiUnmuteHostRequest{ + ctx: ctx, + hostName: hostName, + } + return req, nil +} + +// UnmuteHost Unmute a host. +// Unmutes a host. This endpoint takes no JSON arguments. +func (a *HostsApi) UnmuteHost(ctx _context.Context, hostName string) (HostMuteResponse, *_nethttp.Response, error) { + req, err := a.buildUnmuteHostRequest(ctx, hostName) + if err != nil { + var localVarReturnValue HostMuteResponse + return localVarReturnValue, nil, err + } + + return a.unmuteHostExecute(req) +} + +// unmuteHostExecute executes the request. +func (a *HostsApi) unmuteHostExecute(r apiUnmuteHostRequest) (HostMuteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue HostMuteResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.HostsApi.UnmuteHost") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/host/{host_name}/unmute" + localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewHostsApi Returns NewHostsApi. +func NewHostsApi(client *common.APIClient) *HostsApi { + return &HostsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_ip_ranges.go b/api/v1/datadog/api_ip_ranges.go new file mode 100644 index 00000000000..5e6f5c563f6 --- /dev/null +++ b/api/v1/datadog/api_ip_ranges.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// IPRangesApi service type +type IPRangesApi common.Service + +type apiGetIPRangesRequest struct { + ctx _context.Context +} + +func (a *IPRangesApi) buildGetIPRangesRequest(ctx _context.Context) (apiGetIPRangesRequest, error) { + req := apiGetIPRangesRequest{ + ctx: ctx, + } + return req, nil +} + +// GetIPRanges List IP Ranges. +// Get information about Datadog IP ranges. +func (a *IPRangesApi) GetIPRanges(ctx _context.Context) (IPRanges, *_nethttp.Response, error) { + req, err := a.buildGetIPRangesRequest(ctx) + if err != nil { + var localVarReturnValue IPRanges + return localVarReturnValue, nil, err + } + + return a.getIPRangesExecute(req) +} + +// getIPRangesExecute executes the request. +func (a *IPRangesApi) getIPRangesExecute(r apiGetIPRangesRequest) (IPRanges, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IPRanges + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.IPRangesApi.GetIPRanges") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewIPRangesApi Returns NewIPRangesApi. +func NewIPRangesApi(client *common.APIClient) *IPRangesApi { + return &IPRangesApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_key_management.go b/api/v1/datadog/api_key_management.go new file mode 100644 index 00000000000..9052cfa9092 --- /dev/null +++ b/api/v1/datadog/api_key_management.go @@ -0,0 +1,1443 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// KeyManagementApi service type +type KeyManagementApi common.Service + +type apiCreateAPIKeyRequest struct { + ctx _context.Context + body *ApiKey +} + +func (a *KeyManagementApi) buildCreateAPIKeyRequest(ctx _context.Context, body ApiKey) (apiCreateAPIKeyRequest, error) { + req := apiCreateAPIKeyRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateAPIKey Create an API key. +// Creates an API key with a given name. +func (a *KeyManagementApi) CreateAPIKey(ctx _context.Context, body ApiKey) (ApiKeyResponse, *_nethttp.Response, error) { + req, err := a.buildCreateAPIKeyRequest(ctx, body) + if err != nil { + var localVarReturnValue ApiKeyResponse + return localVarReturnValue, nil, err + } + + return a.createAPIKeyExecute(req) +} + +// createAPIKeyExecute executes the request. +func (a *KeyManagementApi) createAPIKeyExecute(r apiCreateAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue ApiKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.CreateAPIKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/api_key" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateApplicationKeyRequest struct { + ctx _context.Context + body *ApplicationKey +} + +func (a *KeyManagementApi) buildCreateApplicationKeyRequest(ctx _context.Context, body ApplicationKey) (apiCreateApplicationKeyRequest, error) { + req := apiCreateApplicationKeyRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateApplicationKey Create an application key. +// Create an application key with a given name. +func (a *KeyManagementApi) CreateApplicationKey(ctx _context.Context, body ApplicationKey) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildCreateApplicationKeyRequest(ctx, body) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.createApplicationKeyExecute(req) +} + +// createApplicationKeyExecute executes the request. +func (a *KeyManagementApi) createApplicationKeyExecute(r apiCreateApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.CreateApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/application_key" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteAPIKeyRequest struct { + ctx _context.Context + key string +} + +func (a *KeyManagementApi) buildDeleteAPIKeyRequest(ctx _context.Context, key string) (apiDeleteAPIKeyRequest, error) { + req := apiDeleteAPIKeyRequest{ + ctx: ctx, + key: key, + } + return req, nil +} + +// DeleteAPIKey Delete an API key. +// Delete a given API key. +func (a *KeyManagementApi) DeleteAPIKey(ctx _context.Context, key string) (ApiKeyResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteAPIKeyRequest(ctx, key) + if err != nil { + var localVarReturnValue ApiKeyResponse + return localVarReturnValue, nil, err + } + + return a.deleteAPIKeyExecute(req) +} + +// deleteAPIKeyExecute executes the request. +func (a *KeyManagementApi) deleteAPIKeyExecute(r apiDeleteAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue ApiKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.DeleteAPIKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/api_key/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteApplicationKeyRequest struct { + ctx _context.Context + key string +} + +func (a *KeyManagementApi) buildDeleteApplicationKeyRequest(ctx _context.Context, key string) (apiDeleteApplicationKeyRequest, error) { + req := apiDeleteApplicationKeyRequest{ + ctx: ctx, + key: key, + } + return req, nil +} + +// DeleteApplicationKey Delete an application key. +// Delete a given application key. +func (a *KeyManagementApi) DeleteApplicationKey(ctx _context.Context, key string) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteApplicationKeyRequest(ctx, key) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.deleteApplicationKeyExecute(req) +} + +// deleteApplicationKeyExecute executes the request. +func (a *KeyManagementApi) deleteApplicationKeyExecute(r apiDeleteApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.DeleteApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/application_key/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetAPIKeyRequest struct { + ctx _context.Context + key string +} + +func (a *KeyManagementApi) buildGetAPIKeyRequest(ctx _context.Context, key string) (apiGetAPIKeyRequest, error) { + req := apiGetAPIKeyRequest{ + ctx: ctx, + key: key, + } + return req, nil +} + +// GetAPIKey Get API key. +// Get a given API key. +func (a *KeyManagementApi) GetAPIKey(ctx _context.Context, key string) (ApiKeyResponse, *_nethttp.Response, error) { + req, err := a.buildGetAPIKeyRequest(ctx, key) + if err != nil { + var localVarReturnValue ApiKeyResponse + return localVarReturnValue, nil, err + } + + return a.getAPIKeyExecute(req) +} + +// getAPIKeyExecute executes the request. +func (a *KeyManagementApi) getAPIKeyExecute(r apiGetAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ApiKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.GetAPIKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/api_key/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetApplicationKeyRequest struct { + ctx _context.Context + key string +} + +func (a *KeyManagementApi) buildGetApplicationKeyRequest(ctx _context.Context, key string) (apiGetApplicationKeyRequest, error) { + req := apiGetApplicationKeyRequest{ + ctx: ctx, + key: key, + } + return req, nil +} + +// GetApplicationKey Get an application key. +// Get a given application key. +func (a *KeyManagementApi) GetApplicationKey(ctx _context.Context, key string) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildGetApplicationKeyRequest(ctx, key) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.getApplicationKeyExecute(req) +} + +// getApplicationKeyExecute executes the request. +func (a *KeyManagementApi) getApplicationKeyExecute(r apiGetApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.GetApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/application_key/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAPIKeysRequest struct { + ctx _context.Context +} + +func (a *KeyManagementApi) buildListAPIKeysRequest(ctx _context.Context) (apiListAPIKeysRequest, error) { + req := apiListAPIKeysRequest{ + ctx: ctx, + } + return req, nil +} + +// ListAPIKeys Get all API keys. +// Get all API keys available for your account. +func (a *KeyManagementApi) ListAPIKeys(ctx _context.Context) (ApiKeyListResponse, *_nethttp.Response, error) { + req, err := a.buildListAPIKeysRequest(ctx) + if err != nil { + var localVarReturnValue ApiKeyListResponse + return localVarReturnValue, nil, err + } + + return a.listAPIKeysExecute(req) +} + +// listAPIKeysExecute executes the request. +func (a *KeyManagementApi) listAPIKeysExecute(r apiListAPIKeysRequest) (ApiKeyListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ApiKeyListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.ListAPIKeys") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/api_key" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListApplicationKeysRequest struct { + ctx _context.Context +} + +func (a *KeyManagementApi) buildListApplicationKeysRequest(ctx _context.Context) (apiListApplicationKeysRequest, error) { + req := apiListApplicationKeysRequest{ + ctx: ctx, + } + return req, nil +} + +// ListApplicationKeys Get all application keys. +// Get all application keys available for your Datadog account. +func (a *KeyManagementApi) ListApplicationKeys(ctx _context.Context) (ApplicationKeyListResponse, *_nethttp.Response, error) { + req, err := a.buildListApplicationKeysRequest(ctx) + if err != nil { + var localVarReturnValue ApplicationKeyListResponse + return localVarReturnValue, nil, err + } + + return a.listApplicationKeysExecute(req) +} + +// listApplicationKeysExecute executes the request. +func (a *KeyManagementApi) listApplicationKeysExecute(r apiListApplicationKeysRequest) (ApplicationKeyListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ApplicationKeyListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.ListApplicationKeys") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/application_key" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateAPIKeyRequest struct { + ctx _context.Context + key string + body *ApiKey +} + +func (a *KeyManagementApi) buildUpdateAPIKeyRequest(ctx _context.Context, key string, body ApiKey) (apiUpdateAPIKeyRequest, error) { + req := apiUpdateAPIKeyRequest{ + ctx: ctx, + key: key, + body: &body, + } + return req, nil +} + +// UpdateAPIKey Edit an API key. +// Edit an API key name. +func (a *KeyManagementApi) UpdateAPIKey(ctx _context.Context, key string, body ApiKey) (ApiKeyResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateAPIKeyRequest(ctx, key, body) + if err != nil { + var localVarReturnValue ApiKeyResponse + return localVarReturnValue, nil, err + } + + return a.updateAPIKeyExecute(req) +} + +// updateAPIKeyExecute executes the request. +func (a *KeyManagementApi) updateAPIKeyExecute(r apiUpdateAPIKeyRequest) (ApiKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue ApiKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.UpdateAPIKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/api_key/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateApplicationKeyRequest struct { + ctx _context.Context + key string + body *ApplicationKey +} + +func (a *KeyManagementApi) buildUpdateApplicationKeyRequest(ctx _context.Context, key string, body ApplicationKey) (apiUpdateApplicationKeyRequest, error) { + req := apiUpdateApplicationKeyRequest{ + ctx: ctx, + key: key, + body: &body, + } + return req, nil +} + +// UpdateApplicationKey Edit an application key. +// Edit an application key name. +func (a *KeyManagementApi) UpdateApplicationKey(ctx _context.Context, key string, body ApplicationKey) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateApplicationKeyRequest(ctx, key, body) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.updateApplicationKeyExecute(req) +} + +// updateApplicationKeyExecute executes the request. +func (a *KeyManagementApi) updateApplicationKeyExecute(r apiUpdateApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.KeyManagementApi.UpdateApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/application_key/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(common.ParameterToString(r.key, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewKeyManagementApi Returns NewKeyManagementApi. +func NewKeyManagementApi(client *common.APIClient) *KeyManagementApi { + return &KeyManagementApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_logs.go b/api/v1/datadog/api_logs.go new file mode 100644 index 00000000000..9d608353187 --- /dev/null +++ b/api/v1/datadog/api_logs.go @@ -0,0 +1,354 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsApi service type +type LogsApi common.Service + +type apiListLogsRequest struct { + ctx _context.Context + body *LogsListRequest +} + +func (a *LogsApi) buildListLogsRequest(ctx _context.Context, body LogsListRequest) (apiListLogsRequest, error) { + req := apiListLogsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// ListLogs Search logs. +// List endpoint returns logs that match a log search query. +// [Results are paginated][1]. +// +// **If you are considering archiving logs for your organization, +// consider use of the Datadog archive capabilities instead of the log list API. +// See [Datadog Logs Archive documentation][2].** +// +// [1]: /logs/guide/collect-multiple-logs-with-pagination +// [2]: https://docs.datadoghq.com/logs/archives +func (a *LogsApi) ListLogs(ctx _context.Context, body LogsListRequest) (LogsListResponse, *_nethttp.Response, error) { + req, err := a.buildListLogsRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsListResponse + return localVarReturnValue, nil, err + } + + return a.listLogsExecute(req) +} + +// listLogsExecute executes the request. +func (a *LogsApi) listLogsExecute(r apiListLogsRequest) (LogsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue LogsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsApi.ListLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs-queries/list" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSubmitLogRequest struct { + ctx _context.Context + body *[]HTTPLogItem + contentEncoding *ContentEncoding + ddtags *string +} + +// SubmitLogOptionalParameters holds optional parameters for SubmitLog. +type SubmitLogOptionalParameters struct { + ContentEncoding *ContentEncoding + Ddtags *string +} + +// NewSubmitLogOptionalParameters creates an empty struct for parameters. +func NewSubmitLogOptionalParameters() *SubmitLogOptionalParameters { + this := SubmitLogOptionalParameters{} + return &this +} + +// WithContentEncoding sets the corresponding parameter name and returns the struct. +func (r *SubmitLogOptionalParameters) WithContentEncoding(contentEncoding ContentEncoding) *SubmitLogOptionalParameters { + r.ContentEncoding = &contentEncoding + return r +} + +// WithDdtags sets the corresponding parameter name and returns the struct. +func (r *SubmitLogOptionalParameters) WithDdtags(ddtags string) *SubmitLogOptionalParameters { + r.Ddtags = &ddtags + return r +} + +func (a *LogsApi) buildSubmitLogRequest(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (apiSubmitLogRequest, error) { + req := apiSubmitLogRequest{ + ctx: ctx, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SubmitLogOptionalParameters is allowed") + } + + if o != nil { + req.contentEncoding = o[0].ContentEncoding + req.ddtags = o[0].Ddtags + } + return req, nil +} + +// SubmitLog Send logs. +// Send your logs to your Datadog platform over HTTP. Limits per HTTP request are: +// +// - Maximum content size per payload (uncompressed): 5MB +// - Maximum size for a single log: 1MB +// - Maximum array size if sending multiple logs in an array: 1000 entries +// +// Any log exceeding 1MB is accepted and truncated by Datadog: +// - For a single log request, the API truncates the log at 1MB and returns a 2xx. +// - For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx. +// +// Datadog recommends sending your logs compressed. +// Add the `Content-Encoding: gzip` header to the request when sending compressed logs. +// +// The status codes answered by the HTTP API are: +// - 200: OK +// - 400: Bad request (likely an issue in the payload formatting) +// - 403: Permission issue (likely using an invalid API Key) +// - 413: Payload too large (batch is above 5MB uncompressed) +// - 5xx: Internal error, request should be retried after some time +func (a *LogsApi) SubmitLog(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (interface{}, *_nethttp.Response, error) { + req, err := a.buildSubmitLogRequest(ctx, body, o...) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.submitLogExecute(req) +} + +// submitLogExecute executes the request. +func (a *LogsApi) submitLogExecute(r apiSubmitLogRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsApi.SubmitLog") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/input" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + if r.ddtags != nil { + localVarQueryParams.Add("ddtags", common.ParameterToString(*r.ddtags, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + if r.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") + } + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HTTPLogError + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewLogsApi Returns NewLogsApi. +func NewLogsApi(client *common.APIClient) *LogsApi { + return &LogsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_logs_indexes.go b/api/v1/datadog/api_logs_indexes.go new file mode 100644 index 00000000000..efc99536328 --- /dev/null +++ b/api/v1/datadog/api_logs_indexes.go @@ -0,0 +1,848 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsIndexesApi service type +type LogsIndexesApi common.Service + +type apiCreateLogsIndexRequest struct { + ctx _context.Context + body *LogsIndex +} + +func (a *LogsIndexesApi) buildCreateLogsIndexRequest(ctx _context.Context, body LogsIndex) (apiCreateLogsIndexRequest, error) { + req := apiCreateLogsIndexRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateLogsIndex Create an index. +// Creates a new index. Returns the Index object passed in the request body when the request is successful. +func (a *LogsIndexesApi) CreateLogsIndex(ctx _context.Context, body LogsIndex) (LogsIndex, *_nethttp.Response, error) { + req, err := a.buildCreateLogsIndexRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsIndex + return localVarReturnValue, nil, err + } + + return a.createLogsIndexExecute(req) +} + +// createLogsIndexExecute executes the request. +func (a *LogsIndexesApi) createLogsIndexExecute(r apiCreateLogsIndexRequest) (LogsIndex, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue LogsIndex + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.CreateLogsIndex") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/indexes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetLogsIndexRequest struct { + ctx _context.Context + name string +} + +func (a *LogsIndexesApi) buildGetLogsIndexRequest(ctx _context.Context, name string) (apiGetLogsIndexRequest, error) { + req := apiGetLogsIndexRequest{ + ctx: ctx, + name: name, + } + return req, nil +} + +// GetLogsIndex Get an index. +// Get one log index from your organization. This endpoint takes no JSON arguments. +func (a *LogsIndexesApi) GetLogsIndex(ctx _context.Context, name string) (LogsIndex, *_nethttp.Response, error) { + req, err := a.buildGetLogsIndexRequest(ctx, name) + if err != nil { + var localVarReturnValue LogsIndex + return localVarReturnValue, nil, err + } + + return a.getLogsIndexExecute(req) +} + +// getLogsIndexExecute executes the request. +func (a *LogsIndexesApi) getLogsIndexExecute(r apiGetLogsIndexRequest) (LogsIndex, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsIndex + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.GetLogsIndex") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/indexes/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", _neturl.PathEscape(common.ParameterToString(r.name, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v LogsAPIErrorResponse + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetLogsIndexOrderRequest struct { + ctx _context.Context +} + +func (a *LogsIndexesApi) buildGetLogsIndexOrderRequest(ctx _context.Context) (apiGetLogsIndexOrderRequest, error) { + req := apiGetLogsIndexOrderRequest{ + ctx: ctx, + } + return req, nil +} + +// GetLogsIndexOrder Get indexes order. +// Get the current order of your log indexes. This endpoint takes no JSON arguments. +func (a *LogsIndexesApi) GetLogsIndexOrder(ctx _context.Context) (LogsIndexesOrder, *_nethttp.Response, error) { + req, err := a.buildGetLogsIndexOrderRequest(ctx) + if err != nil { + var localVarReturnValue LogsIndexesOrder + return localVarReturnValue, nil, err + } + + return a.getLogsIndexOrderExecute(req) +} + +// getLogsIndexOrderExecute executes the request. +func (a *LogsIndexesApi) getLogsIndexOrderExecute(r apiGetLogsIndexOrderRequest) (LogsIndexesOrder, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsIndexesOrder + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.GetLogsIndexOrder") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/index-order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListLogIndexesRequest struct { + ctx _context.Context +} + +func (a *LogsIndexesApi) buildListLogIndexesRequest(ctx _context.Context) (apiListLogIndexesRequest, error) { + req := apiListLogIndexesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListLogIndexes Get all indexes. +// The Index object describes the configuration of a log index. +// This endpoint returns an array of the `LogIndex` objects of your organization. +func (a *LogsIndexesApi) ListLogIndexes(ctx _context.Context) (LogsIndexListResponse, *_nethttp.Response, error) { + req, err := a.buildListLogIndexesRequest(ctx) + if err != nil { + var localVarReturnValue LogsIndexListResponse + return localVarReturnValue, nil, err + } + + return a.listLogIndexesExecute(req) +} + +// listLogIndexesExecute executes the request. +func (a *LogsIndexesApi) listLogIndexesExecute(r apiListLogIndexesRequest) (LogsIndexListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsIndexListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.ListLogIndexes") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/indexes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateLogsIndexRequest struct { + ctx _context.Context + name string + body *LogsIndexUpdateRequest +} + +func (a *LogsIndexesApi) buildUpdateLogsIndexRequest(ctx _context.Context, name string, body LogsIndexUpdateRequest) (apiUpdateLogsIndexRequest, error) { + req := apiUpdateLogsIndexRequest{ + ctx: ctx, + name: name, + body: &body, + } + return req, nil +} + +// UpdateLogsIndex Update an index. +// Update an index as identified by its name. +// Returns the Index object passed in the request body when the request is successful. +// +// Using the `PUT` method updates your index’s configuration by **replacing** +// your current configuration with the new one sent to your Datadog organization. +func (a *LogsIndexesApi) UpdateLogsIndex(ctx _context.Context, name string, body LogsIndexUpdateRequest) (LogsIndex, *_nethttp.Response, error) { + req, err := a.buildUpdateLogsIndexRequest(ctx, name, body) + if err != nil { + var localVarReturnValue LogsIndex + return localVarReturnValue, nil, err + } + + return a.updateLogsIndexExecute(req) +} + +// updateLogsIndexExecute executes the request. +func (a *LogsIndexesApi) updateLogsIndexExecute(r apiUpdateLogsIndexRequest) (LogsIndex, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue LogsIndex + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.UpdateLogsIndex") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/indexes/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", _neturl.PathEscape(common.ParameterToString(r.name, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + var v LogsAPIErrorResponse + 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateLogsIndexOrderRequest struct { + ctx _context.Context + body *LogsIndexesOrder +} + +func (a *LogsIndexesApi) buildUpdateLogsIndexOrderRequest(ctx _context.Context, body LogsIndexesOrder) (apiUpdateLogsIndexOrderRequest, error) { + req := apiUpdateLogsIndexOrderRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// UpdateLogsIndexOrder Update indexes order. +// This endpoint updates the index order of your organization. +// It returns the index order object passed in the request body when the request is successful. +func (a *LogsIndexesApi) UpdateLogsIndexOrder(ctx _context.Context, body LogsIndexesOrder) (LogsIndexesOrder, *_nethttp.Response, error) { + req, err := a.buildUpdateLogsIndexOrderRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsIndexesOrder + return localVarReturnValue, nil, err + } + + return a.updateLogsIndexOrderExecute(req) +} + +// updateLogsIndexOrderExecute executes the request. +func (a *LogsIndexesApi) updateLogsIndexOrderExecute(r apiUpdateLogsIndexOrderRequest) (LogsIndexesOrder, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue LogsIndexesOrder + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsIndexesApi.UpdateLogsIndexOrder") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/index-order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewLogsIndexesApi Returns NewLogsIndexesApi. +func NewLogsIndexesApi(client *common.APIClient) *LogsIndexesApi { + return &LogsIndexesApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_logs_pipelines.go b/api/v1/datadog/api_logs_pipelines.go new file mode 100644 index 00000000000..80682e0c95d --- /dev/null +++ b/api/v1/datadog/api_logs_pipelines.go @@ -0,0 +1,988 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsPipelinesApi service type +type LogsPipelinesApi common.Service + +type apiCreateLogsPipelineRequest struct { + ctx _context.Context + body *LogsPipeline +} + +func (a *LogsPipelinesApi) buildCreateLogsPipelineRequest(ctx _context.Context, body LogsPipeline) (apiCreateLogsPipelineRequest, error) { + req := apiCreateLogsPipelineRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateLogsPipeline Create a pipeline. +// Create a pipeline in your organization. +func (a *LogsPipelinesApi) CreateLogsPipeline(ctx _context.Context, body LogsPipeline) (LogsPipeline, *_nethttp.Response, error) { + req, err := a.buildCreateLogsPipelineRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsPipeline + return localVarReturnValue, nil, err + } + + return a.createLogsPipelineExecute(req) +} + +// createLogsPipelineExecute executes the request. +func (a *LogsPipelinesApi) createLogsPipelineExecute(r apiCreateLogsPipelineRequest) (LogsPipeline, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue LogsPipeline + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.CreateLogsPipeline") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/pipelines" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteLogsPipelineRequest struct { + ctx _context.Context + pipelineId string +} + +func (a *LogsPipelinesApi) buildDeleteLogsPipelineRequest(ctx _context.Context, pipelineId string) (apiDeleteLogsPipelineRequest, error) { + req := apiDeleteLogsPipelineRequest{ + ctx: ctx, + pipelineId: pipelineId, + } + return req, nil +} + +// DeleteLogsPipeline Delete a pipeline. +// Delete a given pipeline from your organization. +// This endpoint takes no JSON arguments. +func (a *LogsPipelinesApi) DeleteLogsPipeline(ctx _context.Context, pipelineId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteLogsPipelineRequest(ctx, pipelineId) + if err != nil { + return nil, err + } + + return a.deleteLogsPipelineExecute(req) +} + +// deleteLogsPipelineExecute executes the request. +func (a *LogsPipelinesApi) deleteLogsPipelineExecute(r apiDeleteLogsPipelineRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.DeleteLogsPipeline") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/pipelines/{pipeline_id}" + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_id"+"}", _neturl.PathEscape(common.ParameterToString(r.pipelineId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetLogsPipelineRequest struct { + ctx _context.Context + pipelineId string +} + +func (a *LogsPipelinesApi) buildGetLogsPipelineRequest(ctx _context.Context, pipelineId string) (apiGetLogsPipelineRequest, error) { + req := apiGetLogsPipelineRequest{ + ctx: ctx, + pipelineId: pipelineId, + } + return req, nil +} + +// GetLogsPipeline Get a pipeline. +// Get a specific pipeline from your organization. +// This endpoint takes no JSON arguments. +func (a *LogsPipelinesApi) GetLogsPipeline(ctx _context.Context, pipelineId string) (LogsPipeline, *_nethttp.Response, error) { + req, err := a.buildGetLogsPipelineRequest(ctx, pipelineId) + if err != nil { + var localVarReturnValue LogsPipeline + return localVarReturnValue, nil, err + } + + return a.getLogsPipelineExecute(req) +} + +// getLogsPipelineExecute executes the request. +func (a *LogsPipelinesApi) getLogsPipelineExecute(r apiGetLogsPipelineRequest) (LogsPipeline, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsPipeline + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.GetLogsPipeline") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/pipelines/{pipeline_id}" + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_id"+"}", _neturl.PathEscape(common.ParameterToString(r.pipelineId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetLogsPipelineOrderRequest struct { + ctx _context.Context +} + +func (a *LogsPipelinesApi) buildGetLogsPipelineOrderRequest(ctx _context.Context) (apiGetLogsPipelineOrderRequest, error) { + req := apiGetLogsPipelineOrderRequest{ + ctx: ctx, + } + return req, nil +} + +// GetLogsPipelineOrder Get pipeline order. +// Get the current order of your pipelines. +// This endpoint takes no JSON arguments. +func (a *LogsPipelinesApi) GetLogsPipelineOrder(ctx _context.Context) (LogsPipelinesOrder, *_nethttp.Response, error) { + req, err := a.buildGetLogsPipelineOrderRequest(ctx) + if err != nil { + var localVarReturnValue LogsPipelinesOrder + return localVarReturnValue, nil, err + } + + return a.getLogsPipelineOrderExecute(req) +} + +// getLogsPipelineOrderExecute executes the request. +func (a *LogsPipelinesApi) getLogsPipelineOrderExecute(r apiGetLogsPipelineOrderRequest) (LogsPipelinesOrder, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsPipelinesOrder + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.GetLogsPipelineOrder") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/pipeline-order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListLogsPipelinesRequest struct { + ctx _context.Context +} + +func (a *LogsPipelinesApi) buildListLogsPipelinesRequest(ctx _context.Context) (apiListLogsPipelinesRequest, error) { + req := apiListLogsPipelinesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListLogsPipelines Get all pipelines. +// Get all pipelines from your organization. +// This endpoint takes no JSON arguments. +func (a *LogsPipelinesApi) ListLogsPipelines(ctx _context.Context) ([]LogsPipeline, *_nethttp.Response, error) { + req, err := a.buildListLogsPipelinesRequest(ctx) + if err != nil { + var localVarReturnValue []LogsPipeline + return localVarReturnValue, nil, err + } + + return a.listLogsPipelinesExecute(req) +} + +// listLogsPipelinesExecute executes the request. +func (a *LogsPipelinesApi) listLogsPipelinesExecute(r apiListLogsPipelinesRequest) ([]LogsPipeline, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []LogsPipeline + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.ListLogsPipelines") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/pipelines" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateLogsPipelineRequest struct { + ctx _context.Context + pipelineId string + body *LogsPipeline +} + +func (a *LogsPipelinesApi) buildUpdateLogsPipelineRequest(ctx _context.Context, pipelineId string, body LogsPipeline) (apiUpdateLogsPipelineRequest, error) { + req := apiUpdateLogsPipelineRequest{ + ctx: ctx, + pipelineId: pipelineId, + body: &body, + } + return req, nil +} + +// UpdateLogsPipeline Update a pipeline. +// Update a given pipeline configuration to change it’s processors or their order. +// +// **Note**: Using this method updates your pipeline configuration by **replacing** +// your current configuration with the new one sent to your Datadog organization. +func (a *LogsPipelinesApi) UpdateLogsPipeline(ctx _context.Context, pipelineId string, body LogsPipeline) (LogsPipeline, *_nethttp.Response, error) { + req, err := a.buildUpdateLogsPipelineRequest(ctx, pipelineId, body) + if err != nil { + var localVarReturnValue LogsPipeline + return localVarReturnValue, nil, err + } + + return a.updateLogsPipelineExecute(req) +} + +// updateLogsPipelineExecute executes the request. +func (a *LogsPipelinesApi) updateLogsPipelineExecute(r apiUpdateLogsPipelineRequest) (LogsPipeline, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue LogsPipeline + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.UpdateLogsPipeline") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/pipelines/{pipeline_id}" + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_id"+"}", _neturl.PathEscape(common.ParameterToString(r.pipelineId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateLogsPipelineOrderRequest struct { + ctx _context.Context + body *LogsPipelinesOrder +} + +func (a *LogsPipelinesApi) buildUpdateLogsPipelineOrderRequest(ctx _context.Context, body LogsPipelinesOrder) (apiUpdateLogsPipelineOrderRequest, error) { + req := apiUpdateLogsPipelineOrderRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// UpdateLogsPipelineOrder Update pipeline order. +// Update the order of your pipelines. Since logs are processed sequentially, reordering a pipeline may change +// the structure and content of the data processed by other pipelines and their processors. +// +// **Note**: Using the `PUT` method updates your pipeline order by replacing your current order +// with the new one sent to your Datadog organization. +func (a *LogsPipelinesApi) UpdateLogsPipelineOrder(ctx _context.Context, body LogsPipelinesOrder) (LogsPipelinesOrder, *_nethttp.Response, error) { + req, err := a.buildUpdateLogsPipelineOrderRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsPipelinesOrder + return localVarReturnValue, nil, err + } + + return a.updateLogsPipelineOrderExecute(req) +} + +// updateLogsPipelineOrderExecute executes the request. +func (a *LogsPipelinesApi) updateLogsPipelineOrderExecute(r apiUpdateLogsPipelineOrderRequest) (LogsPipelinesOrder, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue LogsPipelinesOrder + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.LogsPipelinesApi.UpdateLogsPipelineOrder") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/logs/config/pipeline-order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v LogsAPIErrorResponse + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 422 { + var v LogsAPIErrorResponse + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewLogsPipelinesApi Returns NewLogsPipelinesApi. +func NewLogsPipelinesApi(client *common.APIClient) *LogsPipelinesApi { + return &LogsPipelinesApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_metrics.go b/api/v1/datadog/api_metrics.go new file mode 100644 index 00000000000..720f46c6549 --- /dev/null +++ b/api/v1/datadog/api_metrics.go @@ -0,0 +1,1152 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MetricsApi service type +type MetricsApi common.Service + +type apiGetMetricMetadataRequest struct { + ctx _context.Context + metricName string +} + +func (a *MetricsApi) buildGetMetricMetadataRequest(ctx _context.Context, metricName string) (apiGetMetricMetadataRequest, error) { + req := apiGetMetricMetadataRequest{ + ctx: ctx, + metricName: metricName, + } + return req, nil +} + +// GetMetricMetadata Get metric metadata. +// Get metadata about a specific metric. +func (a *MetricsApi) GetMetricMetadata(ctx _context.Context, metricName string) (MetricMetadata, *_nethttp.Response, error) { + req, err := a.buildGetMetricMetadataRequest(ctx, metricName) + if err != nil { + var localVarReturnValue MetricMetadata + return localVarReturnValue, nil, err + } + + return a.getMetricMetadataExecute(req) +} + +// getMetricMetadataExecute executes the request. +func (a *MetricsApi) getMetricMetadataExecute(r apiGetMetricMetadataRequest) (MetricMetadata, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricMetadata + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.GetMetricMetadata") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/metrics/{metric_name}" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListActiveMetricsRequest struct { + ctx _context.Context + from *int64 + host *string + tagFilter *string +} + +// ListActiveMetricsOptionalParameters holds optional parameters for ListActiveMetrics. +type ListActiveMetricsOptionalParameters struct { + Host *string + TagFilter *string +} + +// NewListActiveMetricsOptionalParameters creates an empty struct for parameters. +func NewListActiveMetricsOptionalParameters() *ListActiveMetricsOptionalParameters { + this := ListActiveMetricsOptionalParameters{} + return &this +} + +// WithHost sets the corresponding parameter name and returns the struct. +func (r *ListActiveMetricsOptionalParameters) WithHost(host string) *ListActiveMetricsOptionalParameters { + r.Host = &host + return r +} + +// WithTagFilter sets the corresponding parameter name and returns the struct. +func (r *ListActiveMetricsOptionalParameters) WithTagFilter(tagFilter string) *ListActiveMetricsOptionalParameters { + r.TagFilter = &tagFilter + return r +} + +func (a *MetricsApi) buildListActiveMetricsRequest(ctx _context.Context, from int64, o ...ListActiveMetricsOptionalParameters) (apiListActiveMetricsRequest, error) { + req := apiListActiveMetricsRequest{ + ctx: ctx, + from: &from, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListActiveMetricsOptionalParameters is allowed") + } + + if o != nil { + req.host = o[0].Host + req.tagFilter = o[0].TagFilter + } + return req, nil +} + +// ListActiveMetrics Get active metrics list. +// Get the list of actively reporting metrics from a given time until now. +func (a *MetricsApi) ListActiveMetrics(ctx _context.Context, from int64, o ...ListActiveMetricsOptionalParameters) (MetricsListResponse, *_nethttp.Response, error) { + req, err := a.buildListActiveMetricsRequest(ctx, from, o...) + if err != nil { + var localVarReturnValue MetricsListResponse + return localVarReturnValue, nil, err + } + + return a.listActiveMetricsExecute(req) +} + +// listActiveMetricsExecute executes the request. +func (a *MetricsApi) listActiveMetricsExecute(r apiListActiveMetricsRequest) (MetricsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.ListActiveMetrics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/metrics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.from == nil { + return localVarReturnValue, nil, common.ReportError("from is required and must be specified") + } + localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) + if r.host != nil { + localVarQueryParams.Add("host", common.ParameterToString(*r.host, "")) + } + if r.tagFilter != nil { + localVarQueryParams.Add("tag_filter", common.ParameterToString(*r.tagFilter, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListMetricsRequest struct { + ctx _context.Context + q *string +} + +func (a *MetricsApi) buildListMetricsRequest(ctx _context.Context, q string) (apiListMetricsRequest, error) { + req := apiListMetricsRequest{ + ctx: ctx, + q: &q, + } + return req, nil +} + +// ListMetrics Search metrics. +// Search for metrics from the last 24 hours in Datadog. +func (a *MetricsApi) ListMetrics(ctx _context.Context, q string) (MetricSearchResponse, *_nethttp.Response, error) { + req, err := a.buildListMetricsRequest(ctx, q) + if err != nil { + var localVarReturnValue MetricSearchResponse + return localVarReturnValue, nil, err + } + + return a.listMetricsExecute(req) +} + +// listMetricsExecute executes the request. +func (a *MetricsApi) listMetricsExecute(r apiListMetricsRequest) (MetricSearchResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricSearchResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.ListMetrics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.q == nil { + return localVarReturnValue, nil, common.ReportError("q is required and must be specified") + } + localVarQueryParams.Add("q", common.ParameterToString(*r.q, "")) + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiQueryMetricsRequest struct { + ctx _context.Context + from *int64 + to *int64 + query *string +} + +func (a *MetricsApi) buildQueryMetricsRequest(ctx _context.Context, from int64, to int64, query string) (apiQueryMetricsRequest, error) { + req := apiQueryMetricsRequest{ + ctx: ctx, + from: &from, + to: &to, + query: &query, + } + return req, nil +} + +// QueryMetrics Query timeseries points. +// Query timeseries points. +func (a *MetricsApi) QueryMetrics(ctx _context.Context, from int64, to int64, query string) (MetricsQueryResponse, *_nethttp.Response, error) { + req, err := a.buildQueryMetricsRequest(ctx, from, to, query) + if err != nil { + var localVarReturnValue MetricsQueryResponse + return localVarReturnValue, nil, err + } + + return a.queryMetricsExecute(req) +} + +// queryMetricsExecute executes the request. +func (a *MetricsApi) queryMetricsExecute(r apiQueryMetricsRequest) (MetricsQueryResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricsQueryResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.QueryMetrics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/query" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.from == nil { + return localVarReturnValue, nil, common.ReportError("from is required and must be specified") + } + if r.to == nil { + return localVarReturnValue, nil, common.ReportError("to is required and must be specified") + } + if r.query == nil { + return localVarReturnValue, nil, common.ReportError("query is required and must be specified") + } + localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) + localVarQueryParams.Add("to", common.ParameterToString(*r.to, "")) + localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSubmitDistributionPointsRequest struct { + ctx _context.Context + body *DistributionPointsPayload + contentEncoding *DistributionPointsContentEncoding +} + +// SubmitDistributionPointsOptionalParameters holds optional parameters for SubmitDistributionPoints. +type SubmitDistributionPointsOptionalParameters struct { + ContentEncoding *DistributionPointsContentEncoding +} + +// NewSubmitDistributionPointsOptionalParameters creates an empty struct for parameters. +func NewSubmitDistributionPointsOptionalParameters() *SubmitDistributionPointsOptionalParameters { + this := SubmitDistributionPointsOptionalParameters{} + return &this +} + +// WithContentEncoding sets the corresponding parameter name and returns the struct. +func (r *SubmitDistributionPointsOptionalParameters) WithContentEncoding(contentEncoding DistributionPointsContentEncoding) *SubmitDistributionPointsOptionalParameters { + r.ContentEncoding = &contentEncoding + return r +} + +func (a *MetricsApi) buildSubmitDistributionPointsRequest(ctx _context.Context, body DistributionPointsPayload, o ...SubmitDistributionPointsOptionalParameters) (apiSubmitDistributionPointsRequest, error) { + req := apiSubmitDistributionPointsRequest{ + ctx: ctx, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SubmitDistributionPointsOptionalParameters is allowed") + } + + if o != nil { + req.contentEncoding = o[0].ContentEncoding + } + return req, nil +} + +// SubmitDistributionPoints Submit distribution points. +// The distribution points end-point allows you to post distribution data that can be graphed on Datadog’s dashboards. +func (a *MetricsApi) SubmitDistributionPoints(ctx _context.Context, body DistributionPointsPayload, o ...SubmitDistributionPointsOptionalParameters) (IntakePayloadAccepted, *_nethttp.Response, error) { + req, err := a.buildSubmitDistributionPointsRequest(ctx, body, o...) + if err != nil { + var localVarReturnValue IntakePayloadAccepted + return localVarReturnValue, nil, err + } + + return a.submitDistributionPointsExecute(req) +} + +// submitDistributionPointsExecute executes the request. +func (a *MetricsApi) submitDistributionPointsExecute(r apiSubmitDistributionPointsRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IntakePayloadAccepted + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.SubmitDistributionPoints") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/distribution_points" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "text/json" + localVarHeaderParams["Accept"] = "application/json" + + if r.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") + } + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 408 { + 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 + } + if localVarHTTPResponse.StatusCode == 413 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSubmitMetricsRequest struct { + ctx _context.Context + body *MetricsPayload + contentEncoding *MetricContentEncoding +} + +// SubmitMetricsOptionalParameters holds optional parameters for SubmitMetrics. +type SubmitMetricsOptionalParameters struct { + ContentEncoding *MetricContentEncoding +} + +// NewSubmitMetricsOptionalParameters creates an empty struct for parameters. +func NewSubmitMetricsOptionalParameters() *SubmitMetricsOptionalParameters { + this := SubmitMetricsOptionalParameters{} + return &this +} + +// WithContentEncoding sets the corresponding parameter name and returns the struct. +func (r *SubmitMetricsOptionalParameters) WithContentEncoding(contentEncoding MetricContentEncoding) *SubmitMetricsOptionalParameters { + r.ContentEncoding = &contentEncoding + return r +} + +func (a *MetricsApi) buildSubmitMetricsRequest(ctx _context.Context, body MetricsPayload, o ...SubmitMetricsOptionalParameters) (apiSubmitMetricsRequest, error) { + req := apiSubmitMetricsRequest{ + ctx: ctx, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SubmitMetricsOptionalParameters is allowed") + } + + if o != nil { + req.contentEncoding = o[0].ContentEncoding + } + return req, nil +} + +// SubmitMetrics Submit metrics. +// The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. +// The maximum payload size is 3.2 megabytes (3200000 bytes). Compressed payloads must have a decompressed size of less than 62 megabytes (62914560 bytes). +// +// If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect: +// +// - 64 bits for the timestamp +// - 64 bits for the value +// - 40 bytes for the metric names +// - 50 bytes for the timeseries +// - The full payload is approximately 100 bytes. However, with the DogStatsD API, +// compression is applied, which reduces the payload size. +func (a *MetricsApi) SubmitMetrics(ctx _context.Context, body MetricsPayload, o ...SubmitMetricsOptionalParameters) (IntakePayloadAccepted, *_nethttp.Response, error) { + req, err := a.buildSubmitMetricsRequest(ctx, body, o...) + if err != nil { + var localVarReturnValue IntakePayloadAccepted + return localVarReturnValue, nil, err + } + + return a.submitMetricsExecute(req) +} + +// submitMetricsExecute executes the request. +func (a *MetricsApi) submitMetricsExecute(r apiSubmitMetricsRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IntakePayloadAccepted + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.SubmitMetrics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/series" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "text/json" + localVarHeaderParams["Accept"] = "application/json" + + if r.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") + } + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 408 { + 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 + } + if localVarHTTPResponse.StatusCode == 413 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateMetricMetadataRequest struct { + ctx _context.Context + metricName string + body *MetricMetadata +} + +func (a *MetricsApi) buildUpdateMetricMetadataRequest(ctx _context.Context, metricName string, body MetricMetadata) (apiUpdateMetricMetadataRequest, error) { + req := apiUpdateMetricMetadataRequest{ + ctx: ctx, + metricName: metricName, + body: &body, + } + return req, nil +} + +// UpdateMetricMetadata Edit metric metadata. +// Edit metadata of a specific metric. Find out more about [supported types](https://docs.datadoghq.com/developers/metrics). +func (a *MetricsApi) UpdateMetricMetadata(ctx _context.Context, metricName string, body MetricMetadata) (MetricMetadata, *_nethttp.Response, error) { + req, err := a.buildUpdateMetricMetadataRequest(ctx, metricName, body) + if err != nil { + var localVarReturnValue MetricMetadata + return localVarReturnValue, nil, err + } + + return a.updateMetricMetadataExecute(req) +} + +// updateMetricMetadataExecute executes the request. +func (a *MetricsApi) updateMetricMetadataExecute(r apiUpdateMetricMetadataRequest) (MetricMetadata, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue MetricMetadata + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MetricsApi.UpdateMetricMetadata") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/metrics/{metric_name}" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewMetricsApi Returns NewMetricsApi. +func NewMetricsApi(client *common.APIClient) *MetricsApi { + return &MetricsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_monitors.go b/api/v1/datadog/api_monitors.go new file mode 100644 index 00000000000..c4124710d72 --- /dev/null +++ b/api/v1/datadog/api_monitors.go @@ -0,0 +1,1953 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonitorsApi service type +type MonitorsApi common.Service + +type apiCheckCanDeleteMonitorRequest struct { + ctx _context.Context + monitorIds *[]int64 +} + +func (a *MonitorsApi) buildCheckCanDeleteMonitorRequest(ctx _context.Context, monitorIds []int64) (apiCheckCanDeleteMonitorRequest, error) { + req := apiCheckCanDeleteMonitorRequest{ + ctx: ctx, + monitorIds: &monitorIds, + } + return req, nil +} + +// CheckCanDeleteMonitor Check if a monitor can be deleted. +// Check if the given monitors can be deleted. +func (a *MonitorsApi) CheckCanDeleteMonitor(ctx _context.Context, monitorIds []int64) (CheckCanDeleteMonitorResponse, *_nethttp.Response, error) { + req, err := a.buildCheckCanDeleteMonitorRequest(ctx, monitorIds) + if err != nil { + var localVarReturnValue CheckCanDeleteMonitorResponse + return localVarReturnValue, nil, err + } + + return a.checkCanDeleteMonitorExecute(req) +} + +// checkCanDeleteMonitorExecute executes the request. +func (a *MonitorsApi) checkCanDeleteMonitorExecute(r apiCheckCanDeleteMonitorRequest) (CheckCanDeleteMonitorResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CheckCanDeleteMonitorResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.CheckCanDeleteMonitor") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/can_delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.monitorIds == nil { + return localVarReturnValue, nil, common.ReportError("monitorIds is required and must be specified") + } + localVarQueryParams.Add("monitor_ids", common.ParameterToString(*r.monitorIds, "csv")) + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v CheckCanDeleteMonitorResponse + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateMonitorRequest struct { + ctx _context.Context + body *Monitor +} + +func (a *MonitorsApi) buildCreateMonitorRequest(ctx _context.Context, body Monitor) (apiCreateMonitorRequest, error) { + req := apiCreateMonitorRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateMonitor Create a monitor. +// Create a monitor using the specified options. +// +// #### Monitor Types +// +// The type of monitor chosen from: +// +// - anomaly: `query alert` +// - APM: `query alert` or `trace-analytics alert` +// - composite: `composite` +// - custom: `service check` +// - event: `event alert` +// - forecast: `query alert` +// - host: `service check` +// - integration: `query alert` or `service check` +// - live process: `process alert` +// - logs: `log alert` +// - metric: `query alert` +// - network: `service check` +// - outlier: `query alert` +// - process: `service check` +// - rum: `rum alert` +// - SLO: `slo alert` +// - watchdog: `event alert` +// - event-v2: `event-v2 alert` +// - audit: `audit alert` +// - error-tracking: `error-tracking alert` +// +// #### Query Types +// +// **Metric Alert Query** +// +// Example: `time_aggr(time_window):space_aggr:metric{tags} [by {key}] operator #` +// +// - `time_aggr`: avg, sum, max, min, change, or pct_change +// - `time_window`: `last_#m` (with `#` between 1 and 10080 depending on the monitor type) or `last_#h`(with `#` between 1 and 168 depending on the monitor type) or `last_1d`, or `last_1w` +// - `space_aggr`: avg, sum, min, or max +// - `tags`: one or more tags (comma-separated), or * +// - `key`: a 'key' in key:value tag syntax; defines a separate alert for each tag in the group (multi-alert) +// - `operator`: <, <=, >, >=, ==, or != +// - `#`: an integer or decimal number used to set the threshold +// +// If you are using the `_change_` or `_pct_change_` time aggregator, instead use `change_aggr(time_aggr(time_window), +// timeshift):space_aggr:metric{tags} [by {key}] operator #` with: +// +// - `change_aggr` change, pct_change +// - `time_aggr` avg, sum, max, min [Learn more](https://docs.datadoghq.com/monitors/create/types/#define-the-conditions) +// - `time_window` last\_#m (between 1 and 2880 depending on the monitor type), last\_#h (between 1 and 48 depending on the monitor type), or last_#d (1 or 2) +// - `timeshift` #m_ago (5, 10, 15, or 30), #h_ago (1, 2, or 4), or 1d_ago +// +// Use this to create an outlier monitor using the following query: +// `avg(last_30m):outliers(avg:system.cpu.user{role:es-events-data} by {host}, 'dbscan', 7) > 0` +// +// **Service Check Query** +// +// Example: `"check".over(tags).last(count).by(group).count_by_status()` +// +// - `check` name of the check, for example `datadog.agent.up` +// - `tags` one or more quoted tags (comma-separated), or "*". for example: `.over("env:prod", "role:db")`; `over` cannot be blank. +// - `count` must be at greater than or equal to your max threshold (defined in the `options`). It is limited to 100. +// For example, if you've specified to notify on 1 critical, 3 ok, and 2 warn statuses, `count` should be at least 3. +// - `group` must be specified for check monitors. Per-check grouping is already explicitly known for some service checks. +// For example, Postgres integration monitors are tagged by `db`, `host`, and `port`, and Network monitors by `host`, `instance`, and `url`. See [Service Checks](https://docs.datadoghq.com/api/latest/service-checks/) documentation for more information. +// +// **Event Alert Query** +// +// Example: `events('sources:nagios status:error,warning priority:normal tags: "string query"').rollup("count").last("1h")"` +// +// - `event`, the event query string: +// - `string_query` free text query to match against event title and text. +// - `sources` event sources (comma-separated). +// - `status` event statuses (comma-separated). Valid options: error, warn, and info. +// - `priority` event priorities (comma-separated). Valid options: low, normal, all. +// - `host` event reporting host (comma-separated). +// - `tags` event tags (comma-separated). +// - `excluded_tags` excluded event tags (comma-separated). +// - `rollup` the stats roll-up method. `count` is the only supported method now. +// - `last` the timeframe to roll up the counts. Examples: 45m, 4h. Supported timeframes: m, h and d. This value should not exceed 48 hours. +// +// **NOTE** The Event Alert Query is being deprecated and replaced by the Event V2 Alert Query. For more information, see the [Event Migration guide](https://docs.datadoghq.com/events/guides/migrating_to_new_events_features/). +// +// **Event V2 Alert Query** +// +// Example: `events(query).rollup(rollup_method[, measure]).last(time_window) operator #` +// +// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). +// - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. +// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. +// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). +// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. +// - `#` an integer or decimal number used to set the threshold. +// +// **Process Alert Query** +// +// Example: `processes(search).over(tags).rollup('count').last(timeframe) operator #` +// +// - `search` free text search string for querying processes. +// Matching processes match results on the [Live Processes](https://docs.datadoghq.com/infrastructure/process/?tab=linuxwindows) page. +// - `tags` one or more tags (comma-separated) +// - `timeframe` the timeframe to roll up the counts. Examples: 10m, 4h. Supported timeframes: s, m, h and d +// - `operator` <, <=, >, >=, ==, or != +// - `#` an integer or decimal number used to set the threshold +// +// **Logs Alert Query** +// +// Example: `logs(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #` +// +// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). +// - `index_name` For multi-index organizations, the log index in which the request is performed. +// - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. +// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. +// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). +// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. +// - `#` an integer or decimal number used to set the threshold. +// +// **Composite Query** +// +// Example: `12345 && 67890`, where `12345` and `67890` are the IDs of non-composite monitors +// +// * `name` [*required*, *default* = **dynamic, based on query**]: The name of the alert. +// * `message` [*required*, *default* = **dynamic, based on query**]: A message to include with notifications for this monitor. +// Email notifications can be sent to specific users by using the same '@username' notation as events. +// * `tags` [*optional*, *default* = **empty list**]: A list of tags to associate with your monitor. +// When getting all monitor details via the API, use the `monitor_tags` argument to filter results by these tags. +// It is only available via the API and isn't visible or editable in the Datadog UI. +// +// **SLO Alert Query** +// +// Example: `error_budget("slo_id").over("time_window") operator #` +// +// - `slo_id`: The alphanumeric SLO ID of the SLO you are configuring the alert for. +// - `time_window`: The time window of the SLO target you wish to alert on. Valid options: `7d`, `30d`, `90d`. +// - `operator`: `>=` or `>` +// +// **Audit Alert Query** +// +// Example: `audits(query).rollup(rollup_method[, measure]).last(time_window) operator #` +// +// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). +// - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. +// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. +// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). +// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. +// - `#` an integer or decimal number used to set the threshold. +// +// **NOTE** Only available on US1-FED and in closed beta on US1, EU, US3, and US5. +// +// **CI Pipelines Alert Query** +// +// Example: `ci-pipelines(query).rollup(rollup_method[, measure]).last(time_window) operator #` +// +// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). +// - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. +// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. +// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). +// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. +// - `#` an integer or decimal number used to set the threshold. +// +// **NOTE** CI Pipeline monitors are in alpha on US1, EU, US3 and US5. +// +// **CI Tests Alert Query** +// +// Example: `ci-tests(query).rollup(rollup_method[, measure]).last(time_window) operator #` +// +// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). +// - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. +// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. +// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). +// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. +// - `#` an integer or decimal number used to set the threshold. +// +// **NOTE** CI Test monitors are available only in closed beta on US1, EU, US3 and US5. +// +// **Error Tracking Alert Query** +// +// Example(RUM): `error-tracking-rum(query).rollup(rollup_method[, measure]).last(time_window) operator #` +// Example(APM Traces): `error-tracking-traces(query).rollup(rollup_method[, measure]).last(time_window) operator #` +// +// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). +// - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. +// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. +// - `time_window` #m (between 1 and 2880), #h (between 1 and 48). +// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. +// - `#` an integer or decimal number used to set the threshold. +func (a *MonitorsApi) CreateMonitor(ctx _context.Context, body Monitor) (Monitor, *_nethttp.Response, error) { + req, err := a.buildCreateMonitorRequest(ctx, body) + if err != nil { + var localVarReturnValue Monitor + return localVarReturnValue, nil, err + } + + return a.createMonitorExecute(req) +} + +// createMonitorExecute executes the request. +func (a *MonitorsApi) createMonitorExecute(r apiCreateMonitorRequest) (Monitor, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue Monitor + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.CreateMonitor") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteMonitorRequest struct { + ctx _context.Context + monitorId int64 + force *string +} + +// DeleteMonitorOptionalParameters holds optional parameters for DeleteMonitor. +type DeleteMonitorOptionalParameters struct { + Force *string +} + +// NewDeleteMonitorOptionalParameters creates an empty struct for parameters. +func NewDeleteMonitorOptionalParameters() *DeleteMonitorOptionalParameters { + this := DeleteMonitorOptionalParameters{} + return &this +} + +// WithForce sets the corresponding parameter name and returns the struct. +func (r *DeleteMonitorOptionalParameters) WithForce(force string) *DeleteMonitorOptionalParameters { + r.Force = &force + return r +} + +func (a *MonitorsApi) buildDeleteMonitorRequest(ctx _context.Context, monitorId int64, o ...DeleteMonitorOptionalParameters) (apiDeleteMonitorRequest, error) { + req := apiDeleteMonitorRequest{ + ctx: ctx, + monitorId: monitorId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type DeleteMonitorOptionalParameters is allowed") + } + + if o != nil { + req.force = o[0].Force + } + return req, nil +} + +// DeleteMonitor Delete a monitor. +// Delete the specified monitor +func (a *MonitorsApi) DeleteMonitor(ctx _context.Context, monitorId int64, o ...DeleteMonitorOptionalParameters) (DeletedMonitor, *_nethttp.Response, error) { + req, err := a.buildDeleteMonitorRequest(ctx, monitorId, o...) + if err != nil { + var localVarReturnValue DeletedMonitor + return localVarReturnValue, nil, err + } + + return a.deleteMonitorExecute(req) +} + +// deleteMonitorExecute executes the request. +func (a *MonitorsApi) deleteMonitorExecute(r apiDeleteMonitorRequest) (DeletedMonitor, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue DeletedMonitor + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.DeleteMonitor") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" + localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.force != nil { + localVarQueryParams.Add("force", common.ParameterToString(*r.force, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetMonitorRequest struct { + ctx _context.Context + monitorId int64 + groupStates *string +} + +// GetMonitorOptionalParameters holds optional parameters for GetMonitor. +type GetMonitorOptionalParameters struct { + GroupStates *string +} + +// NewGetMonitorOptionalParameters creates an empty struct for parameters. +func NewGetMonitorOptionalParameters() *GetMonitorOptionalParameters { + this := GetMonitorOptionalParameters{} + return &this +} + +// WithGroupStates sets the corresponding parameter name and returns the struct. +func (r *GetMonitorOptionalParameters) WithGroupStates(groupStates string) *GetMonitorOptionalParameters { + r.GroupStates = &groupStates + return r +} + +func (a *MonitorsApi) buildGetMonitorRequest(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (apiGetMonitorRequest, error) { + req := apiGetMonitorRequest{ + ctx: ctx, + monitorId: monitorId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetMonitorOptionalParameters is allowed") + } + + if o != nil { + req.groupStates = o[0].GroupStates + } + return req, nil +} + +// GetMonitor Get a monitor's details. +// Get details about the specified monitor from your organization. +func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (Monitor, *_nethttp.Response, error) { + req, err := a.buildGetMonitorRequest(ctx, monitorId, o...) + if err != nil { + var localVarReturnValue Monitor + return localVarReturnValue, nil, err + } + + return a.getMonitorExecute(req) +} + +// getMonitorExecute executes the request. +func (a *MonitorsApi) getMonitorExecute(r apiGetMonitorRequest) (Monitor, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue Monitor + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.GetMonitor") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" + localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.groupStates != nil { + localVarQueryParams.Add("group_states", common.ParameterToString(*r.groupStates, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListMonitorsRequest struct { + ctx _context.Context + groupStates *string + name *string + tags *string + monitorTags *string + withDowntimes *bool + idOffset *int64 + page *int64 + pageSize *int32 +} + +// ListMonitorsOptionalParameters holds optional parameters for ListMonitors. +type ListMonitorsOptionalParameters struct { + GroupStates *string + Name *string + Tags *string + MonitorTags *string + WithDowntimes *bool + IdOffset *int64 + Page *int64 + PageSize *int32 +} + +// NewListMonitorsOptionalParameters creates an empty struct for parameters. +func NewListMonitorsOptionalParameters() *ListMonitorsOptionalParameters { + this := ListMonitorsOptionalParameters{} + return &this +} + +// WithGroupStates sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithGroupStates(groupStates string) *ListMonitorsOptionalParameters { + r.GroupStates = &groupStates + return r +} + +// WithName sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithName(name string) *ListMonitorsOptionalParameters { + r.Name = &name + return r +} + +// WithTags sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithTags(tags string) *ListMonitorsOptionalParameters { + r.Tags = &tags + return r +} + +// WithMonitorTags sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithMonitorTags(monitorTags string) *ListMonitorsOptionalParameters { + r.MonitorTags = &monitorTags + return r +} + +// WithWithDowntimes sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithWithDowntimes(withDowntimes bool) *ListMonitorsOptionalParameters { + r.WithDowntimes = &withDowntimes + return r +} + +// WithIdOffset sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithIdOffset(idOffset int64) *ListMonitorsOptionalParameters { + r.IdOffset = &idOffset + return r +} + +// WithPage sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithPage(page int64) *ListMonitorsOptionalParameters { + r.Page = &page + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListMonitorsOptionalParameters) WithPageSize(pageSize int32) *ListMonitorsOptionalParameters { + r.PageSize = &pageSize + return r +} + +func (a *MonitorsApi) buildListMonitorsRequest(ctx _context.Context, o ...ListMonitorsOptionalParameters) (apiListMonitorsRequest, error) { + req := apiListMonitorsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListMonitorsOptionalParameters is allowed") + } + + if o != nil { + req.groupStates = o[0].GroupStates + req.name = o[0].Name + req.tags = o[0].Tags + req.monitorTags = o[0].MonitorTags + req.withDowntimes = o[0].WithDowntimes + req.idOffset = o[0].IdOffset + req.page = o[0].Page + req.pageSize = o[0].PageSize + } + return req, nil +} + +// ListMonitors Get all monitor details. +// Get details about the specified monitor from your organization. +func (a *MonitorsApi) ListMonitors(ctx _context.Context, o ...ListMonitorsOptionalParameters) ([]Monitor, *_nethttp.Response, error) { + req, err := a.buildListMonitorsRequest(ctx, o...) + if err != nil { + var localVarReturnValue []Monitor + return localVarReturnValue, nil, err + } + + return a.listMonitorsExecute(req) +} + +// listMonitorsExecute executes the request. +func (a *MonitorsApi) listMonitorsExecute(r apiListMonitorsRequest) ([]Monitor, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []Monitor + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.ListMonitors") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.groupStates != nil { + localVarQueryParams.Add("group_states", common.ParameterToString(*r.groupStates, "")) + } + if r.name != nil { + localVarQueryParams.Add("name", common.ParameterToString(*r.name, "")) + } + if r.tags != nil { + localVarQueryParams.Add("tags", common.ParameterToString(*r.tags, "")) + } + if r.monitorTags != nil { + localVarQueryParams.Add("monitor_tags", common.ParameterToString(*r.monitorTags, "")) + } + if r.withDowntimes != nil { + localVarQueryParams.Add("with_downtimes", common.ParameterToString(*r.withDowntimes, "")) + } + if r.idOffset != nil { + localVarQueryParams.Add("id_offset", common.ParameterToString(*r.idOffset, "")) + } + if r.page != nil { + localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) + } + if r.pageSize != nil { + localVarQueryParams.Add("page_size", common.ParameterToString(*r.pageSize, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSearchMonitorGroupsRequest struct { + ctx _context.Context + query *string + page *int64 + perPage *int64 + sort *string +} + +// SearchMonitorGroupsOptionalParameters holds optional parameters for SearchMonitorGroups. +type SearchMonitorGroupsOptionalParameters struct { + Query *string + Page *int64 + PerPage *int64 + Sort *string +} + +// NewSearchMonitorGroupsOptionalParameters creates an empty struct for parameters. +func NewSearchMonitorGroupsOptionalParameters() *SearchMonitorGroupsOptionalParameters { + this := SearchMonitorGroupsOptionalParameters{} + return &this +} + +// WithQuery sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorGroupsOptionalParameters) WithQuery(query string) *SearchMonitorGroupsOptionalParameters { + r.Query = &query + return r +} + +// WithPage sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorGroupsOptionalParameters) WithPage(page int64) *SearchMonitorGroupsOptionalParameters { + r.Page = &page + return r +} + +// WithPerPage sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorGroupsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorGroupsOptionalParameters { + r.PerPage = &perPage + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorGroupsOptionalParameters) WithSort(sort string) *SearchMonitorGroupsOptionalParameters { + r.Sort = &sort + return r +} + +func (a *MonitorsApi) buildSearchMonitorGroupsRequest(ctx _context.Context, o ...SearchMonitorGroupsOptionalParameters) (apiSearchMonitorGroupsRequest, error) { + req := apiSearchMonitorGroupsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SearchMonitorGroupsOptionalParameters is allowed") + } + + if o != nil { + req.query = o[0].Query + req.page = o[0].Page + req.perPage = o[0].PerPage + req.sort = o[0].Sort + } + return req, nil +} + +// SearchMonitorGroups Monitors group search. +// Search and filter your monitor groups details. +func (a *MonitorsApi) SearchMonitorGroups(ctx _context.Context, o ...SearchMonitorGroupsOptionalParameters) (MonitorGroupSearchResponse, *_nethttp.Response, error) { + req, err := a.buildSearchMonitorGroupsRequest(ctx, o...) + if err != nil { + var localVarReturnValue MonitorGroupSearchResponse + return localVarReturnValue, nil, err + } + + return a.searchMonitorGroupsExecute(req) +} + +// searchMonitorGroupsExecute executes the request. +func (a *MonitorsApi) searchMonitorGroupsExecute(r apiSearchMonitorGroupsRequest) (MonitorGroupSearchResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MonitorGroupSearchResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.SearchMonitorGroups") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/groups/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.query != nil { + localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) + } + if r.page != nil { + localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) + } + if r.perPage != nil { + localVarQueryParams.Add("per_page", common.ParameterToString(*r.perPage, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSearchMonitorsRequest struct { + ctx _context.Context + query *string + page *int64 + perPage *int64 + sort *string +} + +// SearchMonitorsOptionalParameters holds optional parameters for SearchMonitors. +type SearchMonitorsOptionalParameters struct { + Query *string + Page *int64 + PerPage *int64 + Sort *string +} + +// NewSearchMonitorsOptionalParameters creates an empty struct for parameters. +func NewSearchMonitorsOptionalParameters() *SearchMonitorsOptionalParameters { + this := SearchMonitorsOptionalParameters{} + return &this +} + +// WithQuery sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorsOptionalParameters) WithQuery(query string) *SearchMonitorsOptionalParameters { + r.Query = &query + return r +} + +// WithPage sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorsOptionalParameters) WithPage(page int64) *SearchMonitorsOptionalParameters { + r.Page = &page + return r +} + +// WithPerPage sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorsOptionalParameters) WithPerPage(perPage int64) *SearchMonitorsOptionalParameters { + r.PerPage = &perPage + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *SearchMonitorsOptionalParameters) WithSort(sort string) *SearchMonitorsOptionalParameters { + r.Sort = &sort + return r +} + +func (a *MonitorsApi) buildSearchMonitorsRequest(ctx _context.Context, o ...SearchMonitorsOptionalParameters) (apiSearchMonitorsRequest, error) { + req := apiSearchMonitorsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SearchMonitorsOptionalParameters is allowed") + } + + if o != nil { + req.query = o[0].Query + req.page = o[0].Page + req.perPage = o[0].PerPage + req.sort = o[0].Sort + } + return req, nil +} + +// SearchMonitors Monitors search. +// Search and filter your monitors details. +func (a *MonitorsApi) SearchMonitors(ctx _context.Context, o ...SearchMonitorsOptionalParameters) (MonitorSearchResponse, *_nethttp.Response, error) { + req, err := a.buildSearchMonitorsRequest(ctx, o...) + if err != nil { + var localVarReturnValue MonitorSearchResponse + return localVarReturnValue, nil, err + } + + return a.searchMonitorsExecute(req) +} + +// searchMonitorsExecute executes the request. +func (a *MonitorsApi) searchMonitorsExecute(r apiSearchMonitorsRequest) (MonitorSearchResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MonitorSearchResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.SearchMonitors") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.query != nil { + localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) + } + if r.page != nil { + localVarQueryParams.Add("page", common.ParameterToString(*r.page, "")) + } + if r.perPage != nil { + localVarQueryParams.Add("per_page", common.ParameterToString(*r.perPage, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateMonitorRequest struct { + ctx _context.Context + monitorId int64 + body *MonitorUpdateRequest +} + +func (a *MonitorsApi) buildUpdateMonitorRequest(ctx _context.Context, monitorId int64, body MonitorUpdateRequest) (apiUpdateMonitorRequest, error) { + req := apiUpdateMonitorRequest{ + ctx: ctx, + monitorId: monitorId, + body: &body, + } + return req, nil +} + +// UpdateMonitor Edit a monitor. +// Edit the specified monitor. +func (a *MonitorsApi) UpdateMonitor(ctx _context.Context, monitorId int64, body MonitorUpdateRequest) (Monitor, *_nethttp.Response, error) { + req, err := a.buildUpdateMonitorRequest(ctx, monitorId, body) + if err != nil { + var localVarReturnValue Monitor + return localVarReturnValue, nil, err + } + + return a.updateMonitorExecute(req) +} + +// updateMonitorExecute executes the request. +func (a *MonitorsApi) updateMonitorExecute(r apiUpdateMonitorRequest) (Monitor, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue Monitor + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.UpdateMonitor") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}" + localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiValidateExistingMonitorRequest struct { + ctx _context.Context + monitorId int64 + body *Monitor +} + +func (a *MonitorsApi) buildValidateExistingMonitorRequest(ctx _context.Context, monitorId int64, body Monitor) (apiValidateExistingMonitorRequest, error) { + req := apiValidateExistingMonitorRequest{ + ctx: ctx, + monitorId: monitorId, + body: &body, + } + return req, nil +} + +// ValidateExistingMonitor Validate an existing monitor. +// Validate the monitor provided in the request. +func (a *MonitorsApi) ValidateExistingMonitor(ctx _context.Context, monitorId int64, body Monitor) (interface{}, *_nethttp.Response, error) { + req, err := a.buildValidateExistingMonitorRequest(ctx, monitorId, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.validateExistingMonitorExecute(req) +} + +// validateExistingMonitorExecute executes the request. +func (a *MonitorsApi) validateExistingMonitorExecute(r apiValidateExistingMonitorRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.ValidateExistingMonitor") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}/validate" + localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(common.ParameterToString(r.monitorId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiValidateMonitorRequest struct { + ctx _context.Context + body *Monitor +} + +func (a *MonitorsApi) buildValidateMonitorRequest(ctx _context.Context, body Monitor) (apiValidateMonitorRequest, error) { + req := apiValidateMonitorRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// ValidateMonitor Validate a monitor. +// Validate the monitor provided in the request. +func (a *MonitorsApi) ValidateMonitor(ctx _context.Context, body Monitor) (interface{}, *_nethttp.Response, error) { + req, err := a.buildValidateMonitorRequest(ctx, body) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.validateMonitorExecute(req) +} + +// validateMonitorExecute executes the request. +func (a *MonitorsApi) validateMonitorExecute(r apiValidateMonitorRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.MonitorsApi.ValidateMonitor") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/validate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewMonitorsApi Returns NewMonitorsApi. +func NewMonitorsApi(client *common.APIClient) *MonitorsApi { + return &MonitorsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_notebooks.go b/api/v1/datadog/api_notebooks.go new file mode 100644 index 00000000000..085aa59fe6f --- /dev/null +++ b/api/v1/datadog/api_notebooks.go @@ -0,0 +1,884 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// NotebooksApi service type +type NotebooksApi common.Service + +type apiCreateNotebookRequest struct { + ctx _context.Context + body *NotebookCreateRequest +} + +func (a *NotebooksApi) buildCreateNotebookRequest(ctx _context.Context, body NotebookCreateRequest) (apiCreateNotebookRequest, error) { + req := apiCreateNotebookRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateNotebook Create a notebook. +// Create a notebook using the specified options. +func (a *NotebooksApi) CreateNotebook(ctx _context.Context, body NotebookCreateRequest) (NotebookResponse, *_nethttp.Response, error) { + req, err := a.buildCreateNotebookRequest(ctx, body) + if err != nil { + var localVarReturnValue NotebookResponse + return localVarReturnValue, nil, err + } + + return a.createNotebookExecute(req) +} + +// createNotebookExecute executes the request. +func (a *NotebooksApi) createNotebookExecute(r apiCreateNotebookRequest) (NotebookResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue NotebookResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.CreateNotebook") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/notebooks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteNotebookRequest struct { + ctx _context.Context + notebookId int64 +} + +func (a *NotebooksApi) buildDeleteNotebookRequest(ctx _context.Context, notebookId int64) (apiDeleteNotebookRequest, error) { + req := apiDeleteNotebookRequest{ + ctx: ctx, + notebookId: notebookId, + } + return req, nil +} + +// DeleteNotebook Delete a notebook. +// Delete a notebook using the specified ID. +func (a *NotebooksApi) DeleteNotebook(ctx _context.Context, notebookId int64) (*_nethttp.Response, error) { + req, err := a.buildDeleteNotebookRequest(ctx, notebookId) + if err != nil { + return nil, err + } + + return a.deleteNotebookExecute(req) +} + +// deleteNotebookExecute executes the request. +func (a *NotebooksApi) deleteNotebookExecute(r apiDeleteNotebookRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.DeleteNotebook") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/notebooks/{notebook_id}" + localVarPath = strings.Replace(localVarPath, "{"+"notebook_id"+"}", _neturl.PathEscape(common.ParameterToString(r.notebookId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetNotebookRequest struct { + ctx _context.Context + notebookId int64 +} + +func (a *NotebooksApi) buildGetNotebookRequest(ctx _context.Context, notebookId int64) (apiGetNotebookRequest, error) { + req := apiGetNotebookRequest{ + ctx: ctx, + notebookId: notebookId, + } + return req, nil +} + +// GetNotebook Get a notebook. +// Get a notebook using the specified notebook ID. +func (a *NotebooksApi) GetNotebook(ctx _context.Context, notebookId int64) (NotebookResponse, *_nethttp.Response, error) { + req, err := a.buildGetNotebookRequest(ctx, notebookId) + if err != nil { + var localVarReturnValue NotebookResponse + return localVarReturnValue, nil, err + } + + return a.getNotebookExecute(req) +} + +// getNotebookExecute executes the request. +func (a *NotebooksApi) getNotebookExecute(r apiGetNotebookRequest) (NotebookResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue NotebookResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.GetNotebook") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/notebooks/{notebook_id}" + localVarPath = strings.Replace(localVarPath, "{"+"notebook_id"+"}", _neturl.PathEscape(common.ParameterToString(r.notebookId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListNotebooksRequest struct { + ctx _context.Context + authorHandle *string + excludeAuthorHandle *string + start *int64 + count *int64 + sortField *string + sortDir *string + query *string + includeCells *bool + isTemplate *bool + typeVar *string +} + +// ListNotebooksOptionalParameters holds optional parameters for ListNotebooks. +type ListNotebooksOptionalParameters struct { + AuthorHandle *string + ExcludeAuthorHandle *string + Start *int64 + Count *int64 + SortField *string + SortDir *string + Query *string + IncludeCells *bool + IsTemplate *bool + Type *string +} + +// NewListNotebooksOptionalParameters creates an empty struct for parameters. +func NewListNotebooksOptionalParameters() *ListNotebooksOptionalParameters { + this := ListNotebooksOptionalParameters{} + return &this +} + +// WithAuthorHandle sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithAuthorHandle(authorHandle string) *ListNotebooksOptionalParameters { + r.AuthorHandle = &authorHandle + return r +} + +// WithExcludeAuthorHandle sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithExcludeAuthorHandle(excludeAuthorHandle string) *ListNotebooksOptionalParameters { + r.ExcludeAuthorHandle = &excludeAuthorHandle + return r +} + +// WithStart sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithStart(start int64) *ListNotebooksOptionalParameters { + r.Start = &start + return r +} + +// WithCount sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithCount(count int64) *ListNotebooksOptionalParameters { + r.Count = &count + return r +} + +// WithSortField sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithSortField(sortField string) *ListNotebooksOptionalParameters { + r.SortField = &sortField + return r +} + +// WithSortDir sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithSortDir(sortDir string) *ListNotebooksOptionalParameters { + r.SortDir = &sortDir + return r +} + +// WithQuery sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithQuery(query string) *ListNotebooksOptionalParameters { + r.Query = &query + return r +} + +// WithIncludeCells sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithIncludeCells(includeCells bool) *ListNotebooksOptionalParameters { + r.IncludeCells = &includeCells + return r +} + +// WithIsTemplate sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithIsTemplate(isTemplate bool) *ListNotebooksOptionalParameters { + r.IsTemplate = &isTemplate + return r +} + +// WithType sets the corresponding parameter name and returns the struct. +func (r *ListNotebooksOptionalParameters) WithType(typeVar string) *ListNotebooksOptionalParameters { + r.Type = &typeVar + return r +} + +func (a *NotebooksApi) buildListNotebooksRequest(ctx _context.Context, o ...ListNotebooksOptionalParameters) (apiListNotebooksRequest, error) { + req := apiListNotebooksRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListNotebooksOptionalParameters is allowed") + } + + if o != nil { + req.authorHandle = o[0].AuthorHandle + req.excludeAuthorHandle = o[0].ExcludeAuthorHandle + req.start = o[0].Start + req.count = o[0].Count + req.sortField = o[0].SortField + req.sortDir = o[0].SortDir + req.query = o[0].Query + req.includeCells = o[0].IncludeCells + req.isTemplate = o[0].IsTemplate + req.typeVar = o[0].Type + } + return req, nil +} + +// ListNotebooks Get all notebooks. +// Get all notebooks. This can also be used to search for notebooks with a particular `query` in the notebook +// `name` or author `handle`. +func (a *NotebooksApi) ListNotebooks(ctx _context.Context, o ...ListNotebooksOptionalParameters) (NotebooksResponse, *_nethttp.Response, error) { + req, err := a.buildListNotebooksRequest(ctx, o...) + if err != nil { + var localVarReturnValue NotebooksResponse + return localVarReturnValue, nil, err + } + + return a.listNotebooksExecute(req) +} + +// listNotebooksExecute executes the request. +func (a *NotebooksApi) listNotebooksExecute(r apiListNotebooksRequest) (NotebooksResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue NotebooksResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.ListNotebooks") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/notebooks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.authorHandle != nil { + localVarQueryParams.Add("author_handle", common.ParameterToString(*r.authorHandle, "")) + } + if r.excludeAuthorHandle != nil { + localVarQueryParams.Add("exclude_author_handle", common.ParameterToString(*r.excludeAuthorHandle, "")) + } + if r.start != nil { + localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) + } + if r.count != nil { + localVarQueryParams.Add("count", common.ParameterToString(*r.count, "")) + } + if r.sortField != nil { + localVarQueryParams.Add("sort_field", common.ParameterToString(*r.sortField, "")) + } + if r.sortDir != nil { + localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) + } + if r.query != nil { + localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) + } + if r.includeCells != nil { + localVarQueryParams.Add("include_cells", common.ParameterToString(*r.includeCells, "")) + } + if r.isTemplate != nil { + localVarQueryParams.Add("is_template", common.ParameterToString(*r.isTemplate, "")) + } + if r.typeVar != nil { + localVarQueryParams.Add("type", common.ParameterToString(*r.typeVar, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateNotebookRequest struct { + ctx _context.Context + notebookId int64 + body *NotebookUpdateRequest +} + +func (a *NotebooksApi) buildUpdateNotebookRequest(ctx _context.Context, notebookId int64, body NotebookUpdateRequest) (apiUpdateNotebookRequest, error) { + req := apiUpdateNotebookRequest{ + ctx: ctx, + notebookId: notebookId, + body: &body, + } + return req, nil +} + +// UpdateNotebook Update a notebook. +// Update a notebook using the specified ID. +func (a *NotebooksApi) UpdateNotebook(ctx _context.Context, notebookId int64, body NotebookUpdateRequest) (NotebookResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateNotebookRequest(ctx, notebookId, body) + if err != nil { + var localVarReturnValue NotebookResponse + return localVarReturnValue, nil, err + } + + return a.updateNotebookExecute(req) +} + +// updateNotebookExecute executes the request. +func (a *NotebooksApi) updateNotebookExecute(r apiUpdateNotebookRequest) (NotebookResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue NotebookResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.NotebooksApi.UpdateNotebook") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/notebooks/{notebook_id}" + localVarPath = strings.Replace(localVarPath, "{"+"notebook_id"+"}", _neturl.PathEscape(common.ParameterToString(r.notebookId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewNotebooksApi Returns NewNotebooksApi. +func NewNotebooksApi(client *common.APIClient) *NotebooksApi { + return &NotebooksApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_organizations.go b/api/v1/datadog/api_organizations.go new file mode 100644 index 00000000000..888932450d8 --- /dev/null +++ b/api/v1/datadog/api_organizations.go @@ -0,0 +1,888 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "os" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// OrganizationsApi service type +type OrganizationsApi common.Service + +type apiCreateChildOrgRequest struct { + ctx _context.Context + body *OrganizationCreateBody +} + +func (a *OrganizationsApi) buildCreateChildOrgRequest(ctx _context.Context, body OrganizationCreateBody) (apiCreateChildOrgRequest, error) { + req := apiCreateChildOrgRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateChildOrg Create a child organization. +// Create a child organization. +// +// This endpoint requires the +// [multi-organization account](https://docs.datadoghq.com/account_management/multi_organization/) +// feature and must be enabled by +// [contacting support](https://docs.datadoghq.com/help/). +// +// Once a new child organization is created, you can interact with it +// by using the `org.public_id`, `api_key.key`, and +// `application_key.hash` provided in the response. +func (a *OrganizationsApi) CreateChildOrg(ctx _context.Context, body OrganizationCreateBody) (OrganizationCreateResponse, *_nethttp.Response, error) { + req, err := a.buildCreateChildOrgRequest(ctx, body) + if err != nil { + var localVarReturnValue OrganizationCreateResponse + return localVarReturnValue, nil, err + } + + return a.createChildOrgExecute(req) +} + +// createChildOrgExecute executes the request. +func (a *OrganizationsApi) createChildOrgExecute(r apiCreateChildOrgRequest) (OrganizationCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue OrganizationCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.CreateChildOrg") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/org" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDowngradeOrgRequest struct { + ctx _context.Context + publicId string +} + +func (a *OrganizationsApi) buildDowngradeOrgRequest(ctx _context.Context, publicId string) (apiDowngradeOrgRequest, error) { + req := apiDowngradeOrgRequest{ + ctx: ctx, + publicId: publicId, + } + return req, nil +} + +// DowngradeOrg Spin-off Child Organization. +// Only available for MSP customers. Removes a child organization from the hierarchy of the master organization and places the child organization on a 30-day trial. +func (a *OrganizationsApi) DowngradeOrg(ctx _context.Context, publicId string) (OrgDowngradedResponse, *_nethttp.Response, error) { + req, err := a.buildDowngradeOrgRequest(ctx, publicId) + if err != nil { + var localVarReturnValue OrgDowngradedResponse + return localVarReturnValue, nil, err + } + + return a.downgradeOrgExecute(req) +} + +// downgradeOrgExecute executes the request. +func (a *OrganizationsApi) downgradeOrgExecute(r apiDowngradeOrgRequest) (OrgDowngradedResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue OrgDowngradedResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.DowngradeOrg") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/org/{public_id}/downgrade" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetOrgRequest struct { + ctx _context.Context + publicId string +} + +func (a *OrganizationsApi) buildGetOrgRequest(ctx _context.Context, publicId string) (apiGetOrgRequest, error) { + req := apiGetOrgRequest{ + ctx: ctx, + publicId: publicId, + } + return req, nil +} + +// GetOrg Get organization information. +// Get organization information. +func (a *OrganizationsApi) GetOrg(ctx _context.Context, publicId string) (OrganizationResponse, *_nethttp.Response, error) { + req, err := a.buildGetOrgRequest(ctx, publicId) + if err != nil { + var localVarReturnValue OrganizationResponse + return localVarReturnValue, nil, err + } + + return a.getOrgExecute(req) +} + +// getOrgExecute executes the request. +func (a *OrganizationsApi) getOrgExecute(r apiGetOrgRequest) (OrganizationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OrganizationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.GetOrg") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/org/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListOrgsRequest struct { + ctx _context.Context +} + +func (a *OrganizationsApi) buildListOrgsRequest(ctx _context.Context) (apiListOrgsRequest, error) { + req := apiListOrgsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListOrgs List your managed organizations. +// This endpoint returns data on your top-level organization. +func (a *OrganizationsApi) ListOrgs(ctx _context.Context) (OrganizationListResponse, *_nethttp.Response, error) { + req, err := a.buildListOrgsRequest(ctx) + if err != nil { + var localVarReturnValue OrganizationListResponse + return localVarReturnValue, nil, err + } + + return a.listOrgsExecute(req) +} + +// listOrgsExecute executes the request. +func (a *OrganizationsApi) listOrgsExecute(r apiListOrgsRequest) (OrganizationListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OrganizationListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.ListOrgs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/org" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateOrgRequest struct { + ctx _context.Context + publicId string + body *Organization +} + +func (a *OrganizationsApi) buildUpdateOrgRequest(ctx _context.Context, publicId string, body Organization) (apiUpdateOrgRequest, error) { + req := apiUpdateOrgRequest{ + ctx: ctx, + publicId: publicId, + body: &body, + } + return req, nil +} + +// UpdateOrg Update your organization. +// Update your organization. +func (a *OrganizationsApi) UpdateOrg(ctx _context.Context, publicId string, body Organization) (OrganizationResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateOrgRequest(ctx, publicId, body) + if err != nil { + var localVarReturnValue OrganizationResponse + return localVarReturnValue, nil, err + } + + return a.updateOrgExecute(req) +} + +// updateOrgExecute executes the request. +func (a *OrganizationsApi) updateOrgExecute(r apiUpdateOrgRequest) (OrganizationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue OrganizationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.UpdateOrg") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/org/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUploadIdPForOrgRequest struct { + ctx _context.Context + publicId string + idpFile **os.File +} + +func (a *OrganizationsApi) buildUploadIdPForOrgRequest(ctx _context.Context, publicId string, idpFile *os.File) (apiUploadIdPForOrgRequest, error) { + req := apiUploadIdPForOrgRequest{ + ctx: ctx, + publicId: publicId, + idpFile: &idpFile, + } + return req, nil +} + +// UploadIdPForOrg Upload IdP metadata. +// There are a couple of options for updating the Identity Provider (IdP) +// metadata from your SAML IdP. +// +// * **Multipart Form-Data**: Post the IdP metadata file using a form post. +// +// * **XML Body:** Post the IdP metadata file as the body of the request. +func (a *OrganizationsApi) UploadIdPForOrg(ctx _context.Context, publicId string, idpFile *os.File) (IdpResponse, *_nethttp.Response, error) { + req, err := a.buildUploadIdPForOrgRequest(ctx, publicId, idpFile) + if err != nil { + var localVarReturnValue IdpResponse + return localVarReturnValue, nil, err + } + + return a.uploadIdPForOrgExecute(req) +} + +// uploadIdPForOrgExecute executes the request. +func (a *OrganizationsApi) uploadIdPForOrgExecute(r apiUploadIdPForOrgRequest) (IdpResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IdpResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.OrganizationsApi.UploadIdPForOrg") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/org/{public_id}/idp_metadata" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.idpFile == nil { + return localVarReturnValue, nil, common.ReportError("idpFile is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "multipart/form-data" + localVarHeaderParams["Accept"] = "application/json" + + formFile := common.FormFile{} + formFile.FormFileName = "idp_file" + localVarFile := *r.idpFile + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + formFile.FileBytes = fbs + formFile.FileName = localVarFile.Name() + localVarFile.Close() + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, &formFile) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 415 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewOrganizationsApi Returns NewOrganizationsApi. +func NewOrganizationsApi(client *common.APIClient) *OrganizationsApi { + return &OrganizationsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_pager_duty_integration.go b/api/v1/datadog/api_pager_duty_integration.go new file mode 100644 index 00000000000..ca0f2851cce --- /dev/null +++ b/api/v1/datadog/api_pager_duty_integration.go @@ -0,0 +1,574 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// PagerDutyIntegrationApi service type +type PagerDutyIntegrationApi common.Service + +type apiCreatePagerDutyIntegrationServiceRequest struct { + ctx _context.Context + body *PagerDutyService +} + +func (a *PagerDutyIntegrationApi) buildCreatePagerDutyIntegrationServiceRequest(ctx _context.Context, body PagerDutyService) (apiCreatePagerDutyIntegrationServiceRequest, error) { + req := apiCreatePagerDutyIntegrationServiceRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreatePagerDutyIntegrationService Create a new service object. +// Create a new service object in the PagerDuty integration. +func (a *PagerDutyIntegrationApi) CreatePagerDutyIntegrationService(ctx _context.Context, body PagerDutyService) (PagerDutyServiceName, *_nethttp.Response, error) { + req, err := a.buildCreatePagerDutyIntegrationServiceRequest(ctx, body) + if err != nil { + var localVarReturnValue PagerDutyServiceName + return localVarReturnValue, nil, err + } + + return a.createPagerDutyIntegrationServiceExecute(req) +} + +// createPagerDutyIntegrationServiceExecute executes the request. +func (a *PagerDutyIntegrationApi) createPagerDutyIntegrationServiceExecute(r apiCreatePagerDutyIntegrationServiceRequest) (PagerDutyServiceName, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue PagerDutyServiceName + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.CreatePagerDutyIntegrationService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeletePagerDutyIntegrationServiceRequest struct { + ctx _context.Context + serviceName string +} + +func (a *PagerDutyIntegrationApi) buildDeletePagerDutyIntegrationServiceRequest(ctx _context.Context, serviceName string) (apiDeletePagerDutyIntegrationServiceRequest, error) { + req := apiDeletePagerDutyIntegrationServiceRequest{ + ctx: ctx, + serviceName: serviceName, + } + return req, nil +} + +// DeletePagerDutyIntegrationService Delete a single service object. +// Delete a single service object in the Datadog-PagerDuty integration. +func (a *PagerDutyIntegrationApi) DeletePagerDutyIntegrationService(ctx _context.Context, serviceName string) (*_nethttp.Response, error) { + req, err := a.buildDeletePagerDutyIntegrationServiceRequest(ctx, serviceName) + if err != nil { + return nil, err + } + + return a.deletePagerDutyIntegrationServiceExecute(req) +} + +// deletePagerDutyIntegrationServiceExecute executes the request. +func (a *PagerDutyIntegrationApi) deletePagerDutyIntegrationServiceExecute(r apiDeletePagerDutyIntegrationServiceRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.DeletePagerDutyIntegrationService") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services/{service_name}" + localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetPagerDutyIntegrationServiceRequest struct { + ctx _context.Context + serviceName string +} + +func (a *PagerDutyIntegrationApi) buildGetPagerDutyIntegrationServiceRequest(ctx _context.Context, serviceName string) (apiGetPagerDutyIntegrationServiceRequest, error) { + req := apiGetPagerDutyIntegrationServiceRequest{ + ctx: ctx, + serviceName: serviceName, + } + return req, nil +} + +// GetPagerDutyIntegrationService Get a single service object. +// Get service name in the Datadog-PagerDuty integration. +func (a *PagerDutyIntegrationApi) GetPagerDutyIntegrationService(ctx _context.Context, serviceName string) (PagerDutyServiceName, *_nethttp.Response, error) { + req, err := a.buildGetPagerDutyIntegrationServiceRequest(ctx, serviceName) + if err != nil { + var localVarReturnValue PagerDutyServiceName + return localVarReturnValue, nil, err + } + + return a.getPagerDutyIntegrationServiceExecute(req) +} + +// getPagerDutyIntegrationServiceExecute executes the request. +func (a *PagerDutyIntegrationApi) getPagerDutyIntegrationServiceExecute(r apiGetPagerDutyIntegrationServiceRequest) (PagerDutyServiceName, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue PagerDutyServiceName + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.GetPagerDutyIntegrationService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services/{service_name}" + localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdatePagerDutyIntegrationServiceRequest struct { + ctx _context.Context + serviceName string + body *PagerDutyServiceKey +} + +func (a *PagerDutyIntegrationApi) buildUpdatePagerDutyIntegrationServiceRequest(ctx _context.Context, serviceName string, body PagerDutyServiceKey) (apiUpdatePagerDutyIntegrationServiceRequest, error) { + req := apiUpdatePagerDutyIntegrationServiceRequest{ + ctx: ctx, + serviceName: serviceName, + body: &body, + } + return req, nil +} + +// UpdatePagerDutyIntegrationService Update a single service object. +// Update a single service object in the Datadog-PagerDuty integration. +func (a *PagerDutyIntegrationApi) UpdatePagerDutyIntegrationService(ctx _context.Context, serviceName string, body PagerDutyServiceKey) (*_nethttp.Response, error) { + req, err := a.buildUpdatePagerDutyIntegrationServiceRequest(ctx, serviceName, body) + if err != nil { + return nil, err + } + + return a.updatePagerDutyIntegrationServiceExecute(req) +} + +// updatePagerDutyIntegrationServiceExecute executes the request. +func (a *PagerDutyIntegrationApi) updatePagerDutyIntegrationServiceExecute(r apiUpdatePagerDutyIntegrationServiceRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.PagerDutyIntegrationApi.UpdatePagerDutyIntegrationService") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/pagerduty/configuration/services/{service_name}" + localVarPath = strings.Replace(localVarPath, "{"+"service_name"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// NewPagerDutyIntegrationApi Returns NewPagerDutyIntegrationApi. +func NewPagerDutyIntegrationApi(client *common.APIClient) *PagerDutyIntegrationApi { + return &PagerDutyIntegrationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_security_monitoring.go b/api/v1/datadog/api_security_monitoring.go new file mode 100644 index 00000000000..190aab4f5c5 --- /dev/null +++ b/api/v1/datadog/api_security_monitoring.go @@ -0,0 +1,488 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SecurityMonitoringApi service type +type SecurityMonitoringApi common.Service + +type apiAddSecurityMonitoringSignalToIncidentRequest struct { + ctx _context.Context + signalId string + body *AddSignalToIncidentRequest +} + +func (a *SecurityMonitoringApi) buildAddSecurityMonitoringSignalToIncidentRequest(ctx _context.Context, signalId string, body AddSignalToIncidentRequest) (apiAddSecurityMonitoringSignalToIncidentRequest, error) { + req := apiAddSecurityMonitoringSignalToIncidentRequest{ + ctx: ctx, + signalId: signalId, + body: &body, + } + return req, nil +} + +// AddSecurityMonitoringSignalToIncident Add a security signal to an incident. +// Add a security signal to an incident. This makes it possible to search for signals by incident within the signal explorer and to view the signals on the incident timeline. +func (a *SecurityMonitoringApi) AddSecurityMonitoringSignalToIncident(ctx _context.Context, signalId string, body AddSignalToIncidentRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { + req, err := a.buildAddSecurityMonitoringSignalToIncidentRequest(ctx, signalId, body) + if err != nil { + var localVarReturnValue SuccessfulSignalUpdateResponse + return localVarReturnValue, nil, err + } + + return a.addSecurityMonitoringSignalToIncidentExecute(req) +} + +// addSecurityMonitoringSignalToIncidentExecute executes the request. +func (a *SecurityMonitoringApi) addSecurityMonitoringSignalToIncidentExecute(r apiAddSecurityMonitoringSignalToIncidentRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SuccessfulSignalUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SecurityMonitoringApi.AddSecurityMonitoringSignalToIncident") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/security_analytics/signals/{signal_id}/add_to_incident" + localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiEditSecurityMonitoringSignalAssigneeRequest struct { + ctx _context.Context + signalId string + body *SignalAssigneeUpdateRequest +} + +func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalAssigneeRequest(ctx _context.Context, signalId string, body SignalAssigneeUpdateRequest) (apiEditSecurityMonitoringSignalAssigneeRequest, error) { + req := apiEditSecurityMonitoringSignalAssigneeRequest{ + ctx: ctx, + signalId: signalId, + body: &body, + } + return req, nil +} + +// EditSecurityMonitoringSignalAssignee Modify the triage assignee of a security signal. +// Modify the triage assignee of a security signal. +func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalAssignee(ctx _context.Context, signalId string, body SignalAssigneeUpdateRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { + req, err := a.buildEditSecurityMonitoringSignalAssigneeRequest(ctx, signalId, body) + if err != nil { + var localVarReturnValue SuccessfulSignalUpdateResponse + return localVarReturnValue, nil, err + } + + return a.editSecurityMonitoringSignalAssigneeExecute(req) +} + +// editSecurityMonitoringSignalAssigneeExecute executes the request. +func (a *SecurityMonitoringApi) editSecurityMonitoringSignalAssigneeExecute(r apiEditSecurityMonitoringSignalAssigneeRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SuccessfulSignalUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/security_analytics/signals/{signal_id}/assignee" + localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiEditSecurityMonitoringSignalStateRequest struct { + ctx _context.Context + signalId string + body *SignalStateUpdateRequest +} + +func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalStateRequest(ctx _context.Context, signalId string, body SignalStateUpdateRequest) (apiEditSecurityMonitoringSignalStateRequest, error) { + req := apiEditSecurityMonitoringSignalStateRequest{ + ctx: ctx, + signalId: signalId, + body: &body, + } + return req, nil +} + +// EditSecurityMonitoringSignalState Change the triage state of a security signal. +// Change the triage state of a security signal. +func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalState(ctx _context.Context, signalId string, body SignalStateUpdateRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { + req, err := a.buildEditSecurityMonitoringSignalStateRequest(ctx, signalId, body) + if err != nil { + var localVarReturnValue SuccessfulSignalUpdateResponse + return localVarReturnValue, nil, err + } + + return a.editSecurityMonitoringSignalStateExecute(req) +} + +// editSecurityMonitoringSignalStateExecute executes the request. +func (a *SecurityMonitoringApi) editSecurityMonitoringSignalStateExecute(r apiEditSecurityMonitoringSignalStateRequest) (SuccessfulSignalUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SuccessfulSignalUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SecurityMonitoringApi.EditSecurityMonitoringSignalState") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/security_analytics/signals/{signal_id}/state" + localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewSecurityMonitoringApi Returns NewSecurityMonitoringApi. +func NewSecurityMonitoringApi(client *common.APIClient) *SecurityMonitoringApi { + return &SecurityMonitoringApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_service_checks.go b/api/v1/datadog/api_service_checks.go new file mode 100644 index 00000000000..8c8aeaa762e --- /dev/null +++ b/api/v1/datadog/api_service_checks.go @@ -0,0 +1,175 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// ServiceChecksApi service type +type ServiceChecksApi common.Service + +type apiSubmitServiceCheckRequest struct { + ctx _context.Context + body *[]ServiceCheck +} + +func (a *ServiceChecksApi) buildSubmitServiceCheckRequest(ctx _context.Context, body []ServiceCheck) (apiSubmitServiceCheckRequest, error) { + req := apiSubmitServiceCheckRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// SubmitServiceCheck Submit a Service Check. +// Submit a list of Service Checks. +// +// **Notes**: +// - A valid API key is required. +// - Service checks can be submitted up to 10 minutes in the past. +func (a *ServiceChecksApi) SubmitServiceCheck(ctx _context.Context, body []ServiceCheck) (IntakePayloadAccepted, *_nethttp.Response, error) { + req, err := a.buildSubmitServiceCheckRequest(ctx, body) + if err != nil { + var localVarReturnValue IntakePayloadAccepted + return localVarReturnValue, nil, err + } + + return a.submitServiceCheckExecute(req) +} + +// submitServiceCheckExecute executes the request. +func (a *ServiceChecksApi) submitServiceCheckExecute(r apiSubmitServiceCheckRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IntakePayloadAccepted + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceChecksApi.SubmitServiceCheck") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/check_run" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 408 { + 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 + } + if localVarHTTPResponse.StatusCode == 413 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewServiceChecksApi Returns NewServiceChecksApi. +func NewServiceChecksApi(client *common.APIClient) *ServiceChecksApi { + return &ServiceChecksApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_service_level_objective_corrections.go b/api/v1/datadog/api_service_level_objective_corrections.go new file mode 100644 index 00000000000..a58799a5a57 --- /dev/null +++ b/api/v1/datadog/api_service_level_objective_corrections.go @@ -0,0 +1,719 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// ServiceLevelObjectiveCorrectionsApi service type +type ServiceLevelObjectiveCorrectionsApi common.Service + +type apiCreateSLOCorrectionRequest struct { + ctx _context.Context + body *SLOCorrectionCreateRequest +} + +func (a *ServiceLevelObjectiveCorrectionsApi) buildCreateSLOCorrectionRequest(ctx _context.Context, body SLOCorrectionCreateRequest) (apiCreateSLOCorrectionRequest, error) { + req := apiCreateSLOCorrectionRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateSLOCorrection Create an SLO correction. +// Create an SLO Correction. +func (a *ServiceLevelObjectiveCorrectionsApi) CreateSLOCorrection(ctx _context.Context, body SLOCorrectionCreateRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { + req, err := a.buildCreateSLOCorrectionRequest(ctx, body) + if err != nil { + var localVarReturnValue SLOCorrectionResponse + return localVarReturnValue, nil, err + } + + return a.createSLOCorrectionExecute(req) +} + +// createSLOCorrectionExecute executes the request. +func (a *ServiceLevelObjectiveCorrectionsApi) createSLOCorrectionExecute(r apiCreateSLOCorrectionRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SLOCorrectionResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.CreateSLOCorrection") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/correction" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteSLOCorrectionRequest struct { + ctx _context.Context + sloCorrectionId string +} + +func (a *ServiceLevelObjectiveCorrectionsApi) buildDeleteSLOCorrectionRequest(ctx _context.Context, sloCorrectionId string) (apiDeleteSLOCorrectionRequest, error) { + req := apiDeleteSLOCorrectionRequest{ + ctx: ctx, + sloCorrectionId: sloCorrectionId, + } + return req, nil +} + +// DeleteSLOCorrection Delete an SLO correction. +// Permanently delete the specified SLO correction object. +func (a *ServiceLevelObjectiveCorrectionsApi) DeleteSLOCorrection(ctx _context.Context, sloCorrectionId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteSLOCorrectionRequest(ctx, sloCorrectionId) + if err != nil { + return nil, err + } + + return a.deleteSLOCorrectionExecute(req) +} + +// deleteSLOCorrectionExecute executes the request. +func (a *ServiceLevelObjectiveCorrectionsApi) deleteSLOCorrectionExecute(r apiDeleteSLOCorrectionRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.DeleteSLOCorrection") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/correction/{slo_correction_id}" + localVarPath = strings.Replace(localVarPath, "{"+"slo_correction_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloCorrectionId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetSLOCorrectionRequest struct { + ctx _context.Context + sloCorrectionId string +} + +func (a *ServiceLevelObjectiveCorrectionsApi) buildGetSLOCorrectionRequest(ctx _context.Context, sloCorrectionId string) (apiGetSLOCorrectionRequest, error) { + req := apiGetSLOCorrectionRequest{ + ctx: ctx, + sloCorrectionId: sloCorrectionId, + } + return req, nil +} + +// GetSLOCorrection Get an SLO correction for an SLO. +// Get an SLO correction. +func (a *ServiceLevelObjectiveCorrectionsApi) GetSLOCorrection(ctx _context.Context, sloCorrectionId string) (SLOCorrectionResponse, *_nethttp.Response, error) { + req, err := a.buildGetSLOCorrectionRequest(ctx, sloCorrectionId) + if err != nil { + var localVarReturnValue SLOCorrectionResponse + return localVarReturnValue, nil, err + } + + return a.getSLOCorrectionExecute(req) +} + +// getSLOCorrectionExecute executes the request. +func (a *ServiceLevelObjectiveCorrectionsApi) getSLOCorrectionExecute(r apiGetSLOCorrectionRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SLOCorrectionResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.GetSLOCorrection") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/correction/{slo_correction_id}" + localVarPath = strings.Replace(localVarPath, "{"+"slo_correction_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloCorrectionId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListSLOCorrectionRequest struct { + ctx _context.Context +} + +func (a *ServiceLevelObjectiveCorrectionsApi) buildListSLOCorrectionRequest(ctx _context.Context) (apiListSLOCorrectionRequest, error) { + req := apiListSLOCorrectionRequest{ + ctx: ctx, + } + return req, nil +} + +// ListSLOCorrection Get all SLO corrections. +// Get all Service Level Objective corrections. +func (a *ServiceLevelObjectiveCorrectionsApi) ListSLOCorrection(ctx _context.Context) (SLOCorrectionListResponse, *_nethttp.Response, error) { + req, err := a.buildListSLOCorrectionRequest(ctx) + if err != nil { + var localVarReturnValue SLOCorrectionListResponse + return localVarReturnValue, nil, err + } + + return a.listSLOCorrectionExecute(req) +} + +// listSLOCorrectionExecute executes the request. +func (a *ServiceLevelObjectiveCorrectionsApi) listSLOCorrectionExecute(r apiListSLOCorrectionRequest) (SLOCorrectionListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SLOCorrectionListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.ListSLOCorrection") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/correction" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateSLOCorrectionRequest struct { + ctx _context.Context + sloCorrectionId string + body *SLOCorrectionUpdateRequest +} + +func (a *ServiceLevelObjectiveCorrectionsApi) buildUpdateSLOCorrectionRequest(ctx _context.Context, sloCorrectionId string, body SLOCorrectionUpdateRequest) (apiUpdateSLOCorrectionRequest, error) { + req := apiUpdateSLOCorrectionRequest{ + ctx: ctx, + sloCorrectionId: sloCorrectionId, + body: &body, + } + return req, nil +} + +// UpdateSLOCorrection Update an SLO correction. +// Update the specified SLO correction object. +func (a *ServiceLevelObjectiveCorrectionsApi) UpdateSLOCorrection(ctx _context.Context, sloCorrectionId string, body SLOCorrectionUpdateRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateSLOCorrectionRequest(ctx, sloCorrectionId, body) + if err != nil { + var localVarReturnValue SLOCorrectionResponse + return localVarReturnValue, nil, err + } + + return a.updateSLOCorrectionExecute(req) +} + +// updateSLOCorrectionExecute executes the request. +func (a *ServiceLevelObjectiveCorrectionsApi) updateSLOCorrectionExecute(r apiUpdateSLOCorrectionRequest) (SLOCorrectionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SLOCorrectionResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectiveCorrectionsApi.UpdateSLOCorrection") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/correction/{slo_correction_id}" + localVarPath = strings.Replace(localVarPath, "{"+"slo_correction_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloCorrectionId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewServiceLevelObjectiveCorrectionsApi Returns NewServiceLevelObjectiveCorrectionsApi. +func NewServiceLevelObjectiveCorrectionsApi(client *common.APIClient) *ServiceLevelObjectiveCorrectionsApi { + return &ServiceLevelObjectiveCorrectionsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_service_level_objectives.go b/api/v1/datadog/api_service_level_objectives.go new file mode 100644 index 00000000000..bf20d83fd0f --- /dev/null +++ b/api/v1/datadog/api_service_level_objectives.go @@ -0,0 +1,1749 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _fmt "fmt" + _ioutil "io/ioutil" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// ServiceLevelObjectivesApi service type +type ServiceLevelObjectivesApi common.Service + +type apiCheckCanDeleteSLORequest struct { + ctx _context.Context + ids *string +} + +func (a *ServiceLevelObjectivesApi) buildCheckCanDeleteSLORequest(ctx _context.Context, ids string) (apiCheckCanDeleteSLORequest, error) { + req := apiCheckCanDeleteSLORequest{ + ctx: ctx, + ids: &ids, + } + return req, nil +} + +// CheckCanDeleteSLO Check if SLOs can be safely deleted. +// Check if an SLO can be safely deleted. For example, +// assure an SLO can be deleted without disrupting a dashboard. +func (a *ServiceLevelObjectivesApi) CheckCanDeleteSLO(ctx _context.Context, ids string) (CheckCanDeleteSLOResponse, *_nethttp.Response, error) { + req, err := a.buildCheckCanDeleteSLORequest(ctx, ids) + if err != nil { + var localVarReturnValue CheckCanDeleteSLOResponse + return localVarReturnValue, nil, err + } + + return a.checkCanDeleteSLOExecute(req) +} + +// checkCanDeleteSLOExecute executes the request. +func (a *ServiceLevelObjectivesApi) checkCanDeleteSLOExecute(r apiCheckCanDeleteSLORequest) (CheckCanDeleteSLOResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CheckCanDeleteSLOResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.CheckCanDeleteSLO") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/can_delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.ids == nil { + return localVarReturnValue, nil, common.ReportError("ids is required and must be specified") + } + localVarQueryParams.Add("ids", common.ParameterToString(*r.ids, "")) + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v CheckCanDeleteSLOResponse + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateSLORequest struct { + ctx _context.Context + body *ServiceLevelObjectiveRequest +} + +func (a *ServiceLevelObjectivesApi) buildCreateSLORequest(ctx _context.Context, body ServiceLevelObjectiveRequest) (apiCreateSLORequest, error) { + req := apiCreateSLORequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateSLO Create an SLO object. +// Create a service level objective object. +func (a *ServiceLevelObjectivesApi) CreateSLO(ctx _context.Context, body ServiceLevelObjectiveRequest) (SLOListResponse, *_nethttp.Response, error) { + req, err := a.buildCreateSLORequest(ctx, body) + if err != nil { + var localVarReturnValue SLOListResponse + return localVarReturnValue, nil, err + } + + return a.createSLOExecute(req) +} + +// createSLOExecute executes the request. +func (a *ServiceLevelObjectivesApi) createSLOExecute(r apiCreateSLORequest) (SLOListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SLOListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.CreateSLO") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteSLORequest struct { + ctx _context.Context + sloId string + force *string +} + +// DeleteSLOOptionalParameters holds optional parameters for DeleteSLO. +type DeleteSLOOptionalParameters struct { + Force *string +} + +// NewDeleteSLOOptionalParameters creates an empty struct for parameters. +func NewDeleteSLOOptionalParameters() *DeleteSLOOptionalParameters { + this := DeleteSLOOptionalParameters{} + return &this +} + +// WithForce sets the corresponding parameter name and returns the struct. +func (r *DeleteSLOOptionalParameters) WithForce(force string) *DeleteSLOOptionalParameters { + r.Force = &force + return r +} + +func (a *ServiceLevelObjectivesApi) buildDeleteSLORequest(ctx _context.Context, sloId string, o ...DeleteSLOOptionalParameters) (apiDeleteSLORequest, error) { + req := apiDeleteSLORequest{ + ctx: ctx, + sloId: sloId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type DeleteSLOOptionalParameters is allowed") + } + + if o != nil { + req.force = o[0].Force + } + return req, nil +} + +// DeleteSLO Delete an SLO. +// Permanently delete the specified service level objective object. +// +// If an SLO is used in a dashboard, the `DELETE /v1/slo/` endpoint returns +// a 409 conflict error because the SLO is referenced in a dashboard. +func (a *ServiceLevelObjectivesApi) DeleteSLO(ctx _context.Context, sloId string, o ...DeleteSLOOptionalParameters) (SLODeleteResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteSLORequest(ctx, sloId, o...) + if err != nil { + var localVarReturnValue SLODeleteResponse + return localVarReturnValue, nil, err + } + + return a.deleteSLOExecute(req) +} + +// deleteSLOExecute executes the request. +func (a *ServiceLevelObjectivesApi) deleteSLOExecute(r apiDeleteSLORequest) (SLODeleteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue SLODeleteResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.DeleteSLO") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/{slo_id}" + localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.force != nil { + localVarQueryParams.Add("force", common.ParameterToString(*r.force, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v SLODeleteResponse + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteSLOTimeframeInBulkRequest struct { + ctx _context.Context + body *map[string][]SLOTimeframe +} + +func (a *ServiceLevelObjectivesApi) buildDeleteSLOTimeframeInBulkRequest(ctx _context.Context, body map[string][]SLOTimeframe) (apiDeleteSLOTimeframeInBulkRequest, error) { + req := apiDeleteSLOTimeframeInBulkRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteSLOTimeframeInBulk Bulk Delete SLO Timeframes. +// Delete (or partially delete) multiple service level objective objects. +// +// This endpoint facilitates deletion of one or more thresholds for one or more +// service level objective objects. If all thresholds are deleted, the service level +// objective object is deleted as well. +func (a *ServiceLevelObjectivesApi) DeleteSLOTimeframeInBulk(ctx _context.Context, body map[string][]SLOTimeframe) (SLOBulkDeleteResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteSLOTimeframeInBulkRequest(ctx, body) + if err != nil { + var localVarReturnValue SLOBulkDeleteResponse + return localVarReturnValue, nil, err + } + + return a.deleteSLOTimeframeInBulkExecute(req) +} + +// deleteSLOTimeframeInBulkExecute executes the request. +func (a *ServiceLevelObjectivesApi) deleteSLOTimeframeInBulkExecute(r apiDeleteSLOTimeframeInBulkRequest) (SLOBulkDeleteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SLOBulkDeleteResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.DeleteSLOTimeframeInBulk") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/bulk_delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSLORequest struct { + ctx _context.Context + sloId string + withConfiguredAlertIds *bool +} + +// GetSLOOptionalParameters holds optional parameters for GetSLO. +type GetSLOOptionalParameters struct { + WithConfiguredAlertIds *bool +} + +// NewGetSLOOptionalParameters creates an empty struct for parameters. +func NewGetSLOOptionalParameters() *GetSLOOptionalParameters { + this := GetSLOOptionalParameters{} + return &this +} + +// WithWithConfiguredAlertIds sets the corresponding parameter name and returns the struct. +func (r *GetSLOOptionalParameters) WithWithConfiguredAlertIds(withConfiguredAlertIds bool) *GetSLOOptionalParameters { + r.WithConfiguredAlertIds = &withConfiguredAlertIds + return r +} + +func (a *ServiceLevelObjectivesApi) buildGetSLORequest(ctx _context.Context, sloId string, o ...GetSLOOptionalParameters) (apiGetSLORequest, error) { + req := apiGetSLORequest{ + ctx: ctx, + sloId: sloId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetSLOOptionalParameters is allowed") + } + + if o != nil { + req.withConfiguredAlertIds = o[0].WithConfiguredAlertIds + } + return req, nil +} + +// GetSLO Get an SLO's details. +// Get a service level objective object. +func (a *ServiceLevelObjectivesApi) GetSLO(ctx _context.Context, sloId string, o ...GetSLOOptionalParameters) (SLOResponse, *_nethttp.Response, error) { + req, err := a.buildGetSLORequest(ctx, sloId, o...) + if err != nil { + var localVarReturnValue SLOResponse + return localVarReturnValue, nil, err + } + + return a.getSLOExecute(req) +} + +// getSLOExecute executes the request. +func (a *ServiceLevelObjectivesApi) getSLOExecute(r apiGetSLORequest) (SLOResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SLOResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.GetSLO") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/{slo_id}" + localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.withConfiguredAlertIds != nil { + localVarQueryParams.Add("with_configured_alert_ids", common.ParameterToString(*r.withConfiguredAlertIds, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSLOCorrectionsRequest struct { + ctx _context.Context + sloId string +} + +func (a *ServiceLevelObjectivesApi) buildGetSLOCorrectionsRequest(ctx _context.Context, sloId string) (apiGetSLOCorrectionsRequest, error) { + req := apiGetSLOCorrectionsRequest{ + ctx: ctx, + sloId: sloId, + } + return req, nil +} + +// GetSLOCorrections Get Corrections For an SLO. +// Get corrections applied to an SLO +func (a *ServiceLevelObjectivesApi) GetSLOCorrections(ctx _context.Context, sloId string) (SLOCorrectionListResponse, *_nethttp.Response, error) { + req, err := a.buildGetSLOCorrectionsRequest(ctx, sloId) + if err != nil { + var localVarReturnValue SLOCorrectionListResponse + return localVarReturnValue, nil, err + } + + return a.getSLOCorrectionsExecute(req) +} + +// getSLOCorrectionsExecute executes the request. +func (a *ServiceLevelObjectivesApi) getSLOCorrectionsExecute(r apiGetSLOCorrectionsRequest) (SLOCorrectionListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SLOCorrectionListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.GetSLOCorrections") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/{slo_id}/corrections" + localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSLOHistoryRequest struct { + ctx _context.Context + sloId string + fromTs *int64 + toTs *int64 + target *float64 + applyCorrection *bool +} + +// GetSLOHistoryOptionalParameters holds optional parameters for GetSLOHistory. +type GetSLOHistoryOptionalParameters struct { + Target *float64 + ApplyCorrection *bool +} + +// NewGetSLOHistoryOptionalParameters creates an empty struct for parameters. +func NewGetSLOHistoryOptionalParameters() *GetSLOHistoryOptionalParameters { + this := GetSLOHistoryOptionalParameters{} + return &this +} + +// WithTarget sets the corresponding parameter name and returns the struct. +func (r *GetSLOHistoryOptionalParameters) WithTarget(target float64) *GetSLOHistoryOptionalParameters { + r.Target = &target + return r +} + +// WithApplyCorrection sets the corresponding parameter name and returns the struct. +func (r *GetSLOHistoryOptionalParameters) WithApplyCorrection(applyCorrection bool) *GetSLOHistoryOptionalParameters { + r.ApplyCorrection = &applyCorrection + return r +} + +func (a *ServiceLevelObjectivesApi) buildGetSLOHistoryRequest(ctx _context.Context, sloId string, fromTs int64, toTs int64, o ...GetSLOHistoryOptionalParameters) (apiGetSLOHistoryRequest, error) { + req := apiGetSLOHistoryRequest{ + ctx: ctx, + sloId: sloId, + fromTs: &fromTs, + toTs: &toTs, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetSLOHistoryOptionalParameters is allowed") + } + + if o != nil { + req.target = o[0].Target + req.applyCorrection = o[0].ApplyCorrection + } + return req, nil +} + +// GetSLOHistory Get an SLO's history. +// Get a specific SLO’s history, regardless of its SLO type. +// +// The detailed history data is structured according to the source data type. +// For example, metric data is included for event SLOs that use +// the metric source, and monitor SLO types include the monitor transition history. +// +// **Note:** There are different response formats for event based and time based SLOs. +// Examples of both are shown. +func (a *ServiceLevelObjectivesApi) GetSLOHistory(ctx _context.Context, sloId string, fromTs int64, toTs int64, o ...GetSLOHistoryOptionalParameters) (SLOHistoryResponse, *_nethttp.Response, error) { + req, err := a.buildGetSLOHistoryRequest(ctx, sloId, fromTs, toTs, o...) + if err != nil { + var localVarReturnValue SLOHistoryResponse + return localVarReturnValue, nil, err + } + + return a.getSLOHistoryExecute(req) +} + +// getSLOHistoryExecute executes the request. +func (a *ServiceLevelObjectivesApi) getSLOHistoryExecute(r apiGetSLOHistoryRequest) (SLOHistoryResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SLOHistoryResponse + ) + + operationId := "v1.GetSLOHistory" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.GetSLOHistory") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/{slo_id}/history" + localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.fromTs == nil { + return localVarReturnValue, nil, common.ReportError("fromTs is required and must be specified") + } + if r.toTs == nil { + return localVarReturnValue, nil, common.ReportError("toTs is required and must be specified") + } + localVarQueryParams.Add("from_ts", common.ParameterToString(*r.fromTs, "")) + localVarQueryParams.Add("to_ts", common.ParameterToString(*r.toTs, "")) + if r.target != nil { + localVarQueryParams.Add("target", common.ParameterToString(*r.target, "")) + } + if r.applyCorrection != nil { + localVarQueryParams.Add("apply_correction", common.ParameterToString(*r.applyCorrection, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListSLOsRequest struct { + ctx _context.Context + ids *string + query *string + tagsQuery *string + metricsQuery *string + limit *int64 + offset *int64 +} + +// ListSLOsOptionalParameters holds optional parameters for ListSLOs. +type ListSLOsOptionalParameters struct { + Ids *string + Query *string + TagsQuery *string + MetricsQuery *string + Limit *int64 + Offset *int64 +} + +// NewListSLOsOptionalParameters creates an empty struct for parameters. +func NewListSLOsOptionalParameters() *ListSLOsOptionalParameters { + this := ListSLOsOptionalParameters{} + return &this +} + +// WithIds sets the corresponding parameter name and returns the struct. +func (r *ListSLOsOptionalParameters) WithIds(ids string) *ListSLOsOptionalParameters { + r.Ids = &ids + return r +} + +// WithQuery sets the corresponding parameter name and returns the struct. +func (r *ListSLOsOptionalParameters) WithQuery(query string) *ListSLOsOptionalParameters { + r.Query = &query + return r +} + +// WithTagsQuery sets the corresponding parameter name and returns the struct. +func (r *ListSLOsOptionalParameters) WithTagsQuery(tagsQuery string) *ListSLOsOptionalParameters { + r.TagsQuery = &tagsQuery + return r +} + +// WithMetricsQuery sets the corresponding parameter name and returns the struct. +func (r *ListSLOsOptionalParameters) WithMetricsQuery(metricsQuery string) *ListSLOsOptionalParameters { + r.MetricsQuery = &metricsQuery + return r +} + +// WithLimit sets the corresponding parameter name and returns the struct. +func (r *ListSLOsOptionalParameters) WithLimit(limit int64) *ListSLOsOptionalParameters { + r.Limit = &limit + return r +} + +// WithOffset sets the corresponding parameter name and returns the struct. +func (r *ListSLOsOptionalParameters) WithOffset(offset int64) *ListSLOsOptionalParameters { + r.Offset = &offset + return r +} + +func (a *ServiceLevelObjectivesApi) buildListSLOsRequest(ctx _context.Context, o ...ListSLOsOptionalParameters) (apiListSLOsRequest, error) { + req := apiListSLOsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListSLOsOptionalParameters is allowed") + } + + if o != nil { + req.ids = o[0].Ids + req.query = o[0].Query + req.tagsQuery = o[0].TagsQuery + req.metricsQuery = o[0].MetricsQuery + req.limit = o[0].Limit + req.offset = o[0].Offset + } + return req, nil +} + +// ListSLOs Get all SLOs. +// Get a list of service level objective objects for your organization. +func (a *ServiceLevelObjectivesApi) ListSLOs(ctx _context.Context, o ...ListSLOsOptionalParameters) (SLOListResponse, *_nethttp.Response, error) { + req, err := a.buildListSLOsRequest(ctx, o...) + if err != nil { + var localVarReturnValue SLOListResponse + return localVarReturnValue, nil, err + } + + return a.listSLOsExecute(req) +} + +// listSLOsExecute executes the request. +func (a *ServiceLevelObjectivesApi) listSLOsExecute(r apiListSLOsRequest) (SLOListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SLOListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.ListSLOs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.ids != nil { + localVarQueryParams.Add("ids", common.ParameterToString(*r.ids, "")) + } + if r.query != nil { + localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) + } + if r.tagsQuery != nil { + localVarQueryParams.Add("tags_query", common.ParameterToString(*r.tagsQuery, "")) + } + if r.metricsQuery != nil { + localVarQueryParams.Add("metrics_query", common.ParameterToString(*r.metricsQuery, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", common.ParameterToString(*r.limit, "")) + } + if r.offset != nil { + localVarQueryParams.Add("offset", common.ParameterToString(*r.offset, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSearchSLORequest struct { + ctx _context.Context + query *string + pageSize *int64 + pageNumber *int64 +} + +// SearchSLOOptionalParameters holds optional parameters for SearchSLO. +type SearchSLOOptionalParameters struct { + Query *string + PageSize *int64 + PageNumber *int64 +} + +// NewSearchSLOOptionalParameters creates an empty struct for parameters. +func NewSearchSLOOptionalParameters() *SearchSLOOptionalParameters { + this := SearchSLOOptionalParameters{} + return &this +} + +// WithQuery sets the corresponding parameter name and returns the struct. +func (r *SearchSLOOptionalParameters) WithQuery(query string) *SearchSLOOptionalParameters { + r.Query = &query + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *SearchSLOOptionalParameters) WithPageSize(pageSize int64) *SearchSLOOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *SearchSLOOptionalParameters) WithPageNumber(pageNumber int64) *SearchSLOOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +func (a *ServiceLevelObjectivesApi) buildSearchSLORequest(ctx _context.Context, o ...SearchSLOOptionalParameters) (apiSearchSLORequest, error) { + req := apiSearchSLORequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SearchSLOOptionalParameters is allowed") + } + + if o != nil { + req.query = o[0].Query + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + } + return req, nil +} + +// SearchSLO Search for SLOs. +// Get a list of service level objective objects for your organization. +func (a *ServiceLevelObjectivesApi) SearchSLO(ctx _context.Context, o ...SearchSLOOptionalParameters) (SearchSLOResponse, *_nethttp.Response, error) { + req, err := a.buildSearchSLORequest(ctx, o...) + if err != nil { + var localVarReturnValue SearchSLOResponse + return localVarReturnValue, nil, err + } + + return a.searchSLOExecute(req) +} + +// searchSLOExecute executes the request. +func (a *ServiceLevelObjectivesApi) searchSLOExecute(r apiSearchSLORequest) (SearchSLOResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SearchSLOResponse + ) + + operationId := "v1.SearchSLO" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.SearchSLO") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.query != nil { + localVarQueryParams.Add("query", common.ParameterToString(*r.query, "")) + } + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateSLORequest struct { + ctx _context.Context + sloId string + body *ServiceLevelObjective +} + +func (a *ServiceLevelObjectivesApi) buildUpdateSLORequest(ctx _context.Context, sloId string, body ServiceLevelObjective) (apiUpdateSLORequest, error) { + req := apiUpdateSLORequest{ + ctx: ctx, + sloId: sloId, + body: &body, + } + return req, nil +} + +// UpdateSLO Update an SLO. +// Update the specified service level objective object. +func (a *ServiceLevelObjectivesApi) UpdateSLO(ctx _context.Context, sloId string, body ServiceLevelObjective) (SLOListResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateSLORequest(ctx, sloId, body) + if err != nil { + var localVarReturnValue SLOListResponse + return localVarReturnValue, nil, err + } + + return a.updateSLOExecute(req) +} + +// updateSLOExecute executes the request. +func (a *ServiceLevelObjectivesApi) updateSLOExecute(r apiUpdateSLORequest) (SLOListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue SLOListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.ServiceLevelObjectivesApi.UpdateSLO") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/slo/{slo_id}" + localVarPath = strings.Replace(localVarPath, "{"+"slo_id"+"}", _neturl.PathEscape(common.ParameterToString(r.sloId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewServiceLevelObjectivesApi Returns NewServiceLevelObjectivesApi. +func NewServiceLevelObjectivesApi(client *common.APIClient) *ServiceLevelObjectivesApi { + return &ServiceLevelObjectivesApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_slack_integration.go b/api/v1/datadog/api_slack_integration.go new file mode 100644 index 00000000000..476f6d8a5f0 --- /dev/null +++ b/api/v1/datadog/api_slack_integration.go @@ -0,0 +1,770 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SlackIntegrationApi service type +type SlackIntegrationApi common.Service + +type apiCreateSlackIntegrationChannelRequest struct { + ctx _context.Context + accountName string + body *SlackIntegrationChannel +} + +func (a *SlackIntegrationApi) buildCreateSlackIntegrationChannelRequest(ctx _context.Context, accountName string, body SlackIntegrationChannel) (apiCreateSlackIntegrationChannelRequest, error) { + req := apiCreateSlackIntegrationChannelRequest{ + ctx: ctx, + accountName: accountName, + body: &body, + } + return req, nil +} + +// CreateSlackIntegrationChannel Create a Slack integration channel. +// Add a channel to your Datadog-Slack integration. +func (a *SlackIntegrationApi) CreateSlackIntegrationChannel(ctx _context.Context, accountName string, body SlackIntegrationChannel) (SlackIntegrationChannel, *_nethttp.Response, error) { + req, err := a.buildCreateSlackIntegrationChannelRequest(ctx, accountName, body) + if err != nil { + var localVarReturnValue SlackIntegrationChannel + return localVarReturnValue, nil, err + } + + return a.createSlackIntegrationChannelExecute(req) +} + +// createSlackIntegrationChannelExecute executes the request. +func (a *SlackIntegrationApi) createSlackIntegrationChannelExecute(r apiCreateSlackIntegrationChannelRequest) (SlackIntegrationChannel, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SlackIntegrationChannel + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.CreateSlackIntegrationChannel") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels" + localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSlackIntegrationChannelRequest struct { + ctx _context.Context + accountName string + channelName string +} + +func (a *SlackIntegrationApi) buildGetSlackIntegrationChannelRequest(ctx _context.Context, accountName string, channelName string) (apiGetSlackIntegrationChannelRequest, error) { + req := apiGetSlackIntegrationChannelRequest{ + ctx: ctx, + accountName: accountName, + channelName: channelName, + } + return req, nil +} + +// GetSlackIntegrationChannel Get a Slack integration channel. +// Get a channel configured for your Datadog-Slack integration. +func (a *SlackIntegrationApi) GetSlackIntegrationChannel(ctx _context.Context, accountName string, channelName string) (SlackIntegrationChannel, *_nethttp.Response, error) { + req, err := a.buildGetSlackIntegrationChannelRequest(ctx, accountName, channelName) + if err != nil { + var localVarReturnValue SlackIntegrationChannel + return localVarReturnValue, nil, err + } + + return a.getSlackIntegrationChannelExecute(req) +} + +// getSlackIntegrationChannelExecute executes the request. +func (a *SlackIntegrationApi) getSlackIntegrationChannelExecute(r apiGetSlackIntegrationChannelRequest) (SlackIntegrationChannel, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SlackIntegrationChannel + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.GetSlackIntegrationChannel") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}" + localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"channel_name"+"}", _neturl.PathEscape(common.ParameterToString(r.channelName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSlackIntegrationChannelsRequest struct { + ctx _context.Context + accountName string +} + +func (a *SlackIntegrationApi) buildGetSlackIntegrationChannelsRequest(ctx _context.Context, accountName string) (apiGetSlackIntegrationChannelsRequest, error) { + req := apiGetSlackIntegrationChannelsRequest{ + ctx: ctx, + accountName: accountName, + } + return req, nil +} + +// GetSlackIntegrationChannels Get all channels in a Slack integration. +// Get a list of all channels configured for your Datadog-Slack integration. +func (a *SlackIntegrationApi) GetSlackIntegrationChannels(ctx _context.Context, accountName string) ([]SlackIntegrationChannel, *_nethttp.Response, error) { + req, err := a.buildGetSlackIntegrationChannelsRequest(ctx, accountName) + if err != nil { + var localVarReturnValue []SlackIntegrationChannel + return localVarReturnValue, nil, err + } + + return a.getSlackIntegrationChannelsExecute(req) +} + +// getSlackIntegrationChannelsExecute executes the request. +func (a *SlackIntegrationApi) getSlackIntegrationChannelsExecute(r apiGetSlackIntegrationChannelsRequest) ([]SlackIntegrationChannel, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue []SlackIntegrationChannel + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.GetSlackIntegrationChannels") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels" + localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiRemoveSlackIntegrationChannelRequest struct { + ctx _context.Context + accountName string + channelName string +} + +func (a *SlackIntegrationApi) buildRemoveSlackIntegrationChannelRequest(ctx _context.Context, accountName string, channelName string) (apiRemoveSlackIntegrationChannelRequest, error) { + req := apiRemoveSlackIntegrationChannelRequest{ + ctx: ctx, + accountName: accountName, + channelName: channelName, + } + return req, nil +} + +// RemoveSlackIntegrationChannel Remove a Slack integration channel. +// Remove a channel from your Datadog-Slack integration. +func (a *SlackIntegrationApi) RemoveSlackIntegrationChannel(ctx _context.Context, accountName string, channelName string) (*_nethttp.Response, error) { + req, err := a.buildRemoveSlackIntegrationChannelRequest(ctx, accountName, channelName) + if err != nil { + return nil, err + } + + return a.removeSlackIntegrationChannelExecute(req) +} + +// removeSlackIntegrationChannelExecute executes the request. +func (a *SlackIntegrationApi) removeSlackIntegrationChannelExecute(r apiRemoveSlackIntegrationChannelRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.RemoveSlackIntegrationChannel") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}" + localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"channel_name"+"}", _neturl.PathEscape(common.ParameterToString(r.channelName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiUpdateSlackIntegrationChannelRequest struct { + ctx _context.Context + accountName string + channelName string + body *SlackIntegrationChannel +} + +func (a *SlackIntegrationApi) buildUpdateSlackIntegrationChannelRequest(ctx _context.Context, accountName string, channelName string, body SlackIntegrationChannel) (apiUpdateSlackIntegrationChannelRequest, error) { + req := apiUpdateSlackIntegrationChannelRequest{ + ctx: ctx, + accountName: accountName, + channelName: channelName, + body: &body, + } + return req, nil +} + +// UpdateSlackIntegrationChannel Update a Slack integration channel. +// Update a channel used in your Datadog-Slack integration. +func (a *SlackIntegrationApi) UpdateSlackIntegrationChannel(ctx _context.Context, accountName string, channelName string, body SlackIntegrationChannel) (SlackIntegrationChannel, *_nethttp.Response, error) { + req, err := a.buildUpdateSlackIntegrationChannelRequest(ctx, accountName, channelName, body) + if err != nil { + var localVarReturnValue SlackIntegrationChannel + return localVarReturnValue, nil, err + } + + return a.updateSlackIntegrationChannelExecute(req) +} + +// updateSlackIntegrationChannelExecute executes the request. +func (a *SlackIntegrationApi) updateSlackIntegrationChannelExecute(r apiUpdateSlackIntegrationChannelRequest) (SlackIntegrationChannel, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SlackIntegrationChannel + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SlackIntegrationApi.UpdateSlackIntegrationChannel") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}" + localVarPath = strings.Replace(localVarPath, "{"+"account_name"+"}", _neturl.PathEscape(common.ParameterToString(r.accountName, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"channel_name"+"}", _neturl.PathEscape(common.ParameterToString(r.channelName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewSlackIntegrationApi Returns NewSlackIntegrationApi. +func NewSlackIntegrationApi(client *common.APIClient) *SlackIntegrationApi { + return &SlackIntegrationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_snapshots.go b/api/v1/datadog/api_snapshots.go new file mode 100644 index 00000000000..abcb545e428 --- /dev/null +++ b/api/v1/datadog/api_snapshots.go @@ -0,0 +1,261 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SnapshotsApi service type +type SnapshotsApi common.Service + +type apiGetGraphSnapshotRequest struct { + ctx _context.Context + start *int64 + end *int64 + metricQuery *string + eventQuery *string + graphDef *string + title *string + height *int64 + width *int64 +} + +// GetGraphSnapshotOptionalParameters holds optional parameters for GetGraphSnapshot. +type GetGraphSnapshotOptionalParameters struct { + MetricQuery *string + EventQuery *string + GraphDef *string + Title *string + Height *int64 + Width *int64 +} + +// NewGetGraphSnapshotOptionalParameters creates an empty struct for parameters. +func NewGetGraphSnapshotOptionalParameters() *GetGraphSnapshotOptionalParameters { + this := GetGraphSnapshotOptionalParameters{} + return &this +} + +// WithMetricQuery sets the corresponding parameter name and returns the struct. +func (r *GetGraphSnapshotOptionalParameters) WithMetricQuery(metricQuery string) *GetGraphSnapshotOptionalParameters { + r.MetricQuery = &metricQuery + return r +} + +// WithEventQuery sets the corresponding parameter name and returns the struct. +func (r *GetGraphSnapshotOptionalParameters) WithEventQuery(eventQuery string) *GetGraphSnapshotOptionalParameters { + r.EventQuery = &eventQuery + return r +} + +// WithGraphDef sets the corresponding parameter name and returns the struct. +func (r *GetGraphSnapshotOptionalParameters) WithGraphDef(graphDef string) *GetGraphSnapshotOptionalParameters { + r.GraphDef = &graphDef + return r +} + +// WithTitle sets the corresponding parameter name and returns the struct. +func (r *GetGraphSnapshotOptionalParameters) WithTitle(title string) *GetGraphSnapshotOptionalParameters { + r.Title = &title + return r +} + +// WithHeight sets the corresponding parameter name and returns the struct. +func (r *GetGraphSnapshotOptionalParameters) WithHeight(height int64) *GetGraphSnapshotOptionalParameters { + r.Height = &height + return r +} + +// WithWidth sets the corresponding parameter name and returns the struct. +func (r *GetGraphSnapshotOptionalParameters) WithWidth(width int64) *GetGraphSnapshotOptionalParameters { + r.Width = &width + return r +} + +func (a *SnapshotsApi) buildGetGraphSnapshotRequest(ctx _context.Context, start int64, end int64, o ...GetGraphSnapshotOptionalParameters) (apiGetGraphSnapshotRequest, error) { + req := apiGetGraphSnapshotRequest{ + ctx: ctx, + start: &start, + end: &end, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetGraphSnapshotOptionalParameters is allowed") + } + + if o != nil { + req.metricQuery = o[0].MetricQuery + req.eventQuery = o[0].EventQuery + req.graphDef = o[0].GraphDef + req.title = o[0].Title + req.height = o[0].Height + req.width = o[0].Width + } + return req, nil +} + +// GetGraphSnapshot Take graph snapshots. +// Take graph snapshots. +// **Note**: When a snapshot is created, there is some delay before it is available. +func (a *SnapshotsApi) GetGraphSnapshot(ctx _context.Context, start int64, end int64, o ...GetGraphSnapshotOptionalParameters) (GraphSnapshot, *_nethttp.Response, error) { + req, err := a.buildGetGraphSnapshotRequest(ctx, start, end, o...) + if err != nil { + var localVarReturnValue GraphSnapshot + return localVarReturnValue, nil, err + } + + return a.getGraphSnapshotExecute(req) +} + +// getGraphSnapshotExecute executes the request. +func (a *SnapshotsApi) getGraphSnapshotExecute(r apiGetGraphSnapshotRequest) (GraphSnapshot, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue GraphSnapshot + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SnapshotsApi.GetGraphSnapshot") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/graph/snapshot" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.start == nil { + return localVarReturnValue, nil, common.ReportError("start is required and must be specified") + } + if r.end == nil { + return localVarReturnValue, nil, common.ReportError("end is required and must be specified") + } + localVarQueryParams.Add("start", common.ParameterToString(*r.start, "")) + localVarQueryParams.Add("end", common.ParameterToString(*r.end, "")) + if r.metricQuery != nil { + localVarQueryParams.Add("metric_query", common.ParameterToString(*r.metricQuery, "")) + } + if r.eventQuery != nil { + localVarQueryParams.Add("event_query", common.ParameterToString(*r.eventQuery, "")) + } + if r.graphDef != nil { + localVarQueryParams.Add("graph_def", common.ParameterToString(*r.graphDef, "")) + } + if r.title != nil { + localVarQueryParams.Add("title", common.ParameterToString(*r.title, "")) + } + if r.height != nil { + localVarQueryParams.Add("height", common.ParameterToString(*r.height, "")) + } + if r.width != nil { + localVarQueryParams.Add("width", common.ParameterToString(*r.width, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewSnapshotsApi Returns NewSnapshotsApi. +func NewSnapshotsApi(client *common.APIClient) *SnapshotsApi { + return &SnapshotsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_synthetics.go b/api/v1/datadog/api_synthetics.go new file mode 100644 index 00000000000..0332646926d --- /dev/null +++ b/api/v1/datadog/api_synthetics.go @@ -0,0 +1,3883 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "reflect" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SyntheticsApi service type +type SyntheticsApi common.Service + +type apiCreateGlobalVariableRequest struct { + ctx _context.Context + body *SyntheticsGlobalVariable +} + +func (a *SyntheticsApi) buildCreateGlobalVariableRequest(ctx _context.Context, body SyntheticsGlobalVariable) (apiCreateGlobalVariableRequest, error) { + req := apiCreateGlobalVariableRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateGlobalVariable Create a global variable. +// Create a Synthetics global variable. +func (a *SyntheticsApi) CreateGlobalVariable(ctx _context.Context, body SyntheticsGlobalVariable) (SyntheticsGlobalVariable, *_nethttp.Response, error) { + req, err := a.buildCreateGlobalVariableRequest(ctx, body) + if err != nil { + var localVarReturnValue SyntheticsGlobalVariable + return localVarReturnValue, nil, err + } + + return a.createGlobalVariableExecute(req) +} + +// createGlobalVariableExecute executes the request. +func (a *SyntheticsApi) createGlobalVariableExecute(r apiCreateGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SyntheticsGlobalVariable + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreateGlobalVariable") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/variables" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreatePrivateLocationRequest struct { + ctx _context.Context + body *SyntheticsPrivateLocation +} + +func (a *SyntheticsApi) buildCreatePrivateLocationRequest(ctx _context.Context, body SyntheticsPrivateLocation) (apiCreatePrivateLocationRequest, error) { + req := apiCreatePrivateLocationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreatePrivateLocation Create a private location. +// Create a new Synthetics private location. +func (a *SyntheticsApi) CreatePrivateLocation(ctx _context.Context, body SyntheticsPrivateLocation) (SyntheticsPrivateLocationCreationResponse, *_nethttp.Response, error) { + req, err := a.buildCreatePrivateLocationRequest(ctx, body) + if err != nil { + var localVarReturnValue SyntheticsPrivateLocationCreationResponse + return localVarReturnValue, nil, err + } + + return a.createPrivateLocationExecute(req) +} + +// createPrivateLocationExecute executes the request. +func (a *SyntheticsApi) createPrivateLocationExecute(r apiCreatePrivateLocationRequest) (SyntheticsPrivateLocationCreationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SyntheticsPrivateLocationCreationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreatePrivateLocation") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/private-locations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 402 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateSyntheticsAPITestRequest struct { + ctx _context.Context + body *SyntheticsAPITest +} + +func (a *SyntheticsApi) buildCreateSyntheticsAPITestRequest(ctx _context.Context, body SyntheticsAPITest) (apiCreateSyntheticsAPITestRequest, error) { + req := apiCreateSyntheticsAPITestRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateSyntheticsAPITest Create an API test. +// Create a Synthetic API test. +func (a *SyntheticsApi) CreateSyntheticsAPITest(ctx _context.Context, body SyntheticsAPITest) (SyntheticsAPITest, *_nethttp.Response, error) { + req, err := a.buildCreateSyntheticsAPITestRequest(ctx, body) + if err != nil { + var localVarReturnValue SyntheticsAPITest + return localVarReturnValue, nil, err + } + + return a.createSyntheticsAPITestExecute(req) +} + +// createSyntheticsAPITestExecute executes the request. +func (a *SyntheticsApi) createSyntheticsAPITestExecute(r apiCreateSyntheticsAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SyntheticsAPITest + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreateSyntheticsAPITest") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/api" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 402 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateSyntheticsBrowserTestRequest struct { + ctx _context.Context + body *SyntheticsBrowserTest +} + +func (a *SyntheticsApi) buildCreateSyntheticsBrowserTestRequest(ctx _context.Context, body SyntheticsBrowserTest) (apiCreateSyntheticsBrowserTestRequest, error) { + req := apiCreateSyntheticsBrowserTestRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateSyntheticsBrowserTest Create a browser test. +// Create a Synthetic browser test. +func (a *SyntheticsApi) CreateSyntheticsBrowserTest(ctx _context.Context, body SyntheticsBrowserTest) (SyntheticsBrowserTest, *_nethttp.Response, error) { + req, err := a.buildCreateSyntheticsBrowserTestRequest(ctx, body) + if err != nil { + var localVarReturnValue SyntheticsBrowserTest + return localVarReturnValue, nil, err + } + + return a.createSyntheticsBrowserTestExecute(req) +} + +// createSyntheticsBrowserTestExecute executes the request. +func (a *SyntheticsApi) createSyntheticsBrowserTestExecute(r apiCreateSyntheticsBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SyntheticsBrowserTest + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.CreateSyntheticsBrowserTest") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 402 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteGlobalVariableRequest struct { + ctx _context.Context + variableId string +} + +func (a *SyntheticsApi) buildDeleteGlobalVariableRequest(ctx _context.Context, variableId string) (apiDeleteGlobalVariableRequest, error) { + req := apiDeleteGlobalVariableRequest{ + ctx: ctx, + variableId: variableId, + } + return req, nil +} + +// DeleteGlobalVariable Delete a global variable. +// Delete a Synthetics global variable. +func (a *SyntheticsApi) DeleteGlobalVariable(ctx _context.Context, variableId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteGlobalVariableRequest(ctx, variableId) + if err != nil { + return nil, err + } + + return a.deleteGlobalVariableExecute(req) +} + +// deleteGlobalVariableExecute executes the request. +func (a *SyntheticsApi) deleteGlobalVariableExecute(r apiDeleteGlobalVariableRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.DeleteGlobalVariable") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" + localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(common.ParameterToString(r.variableId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiDeletePrivateLocationRequest struct { + ctx _context.Context + locationId string +} + +func (a *SyntheticsApi) buildDeletePrivateLocationRequest(ctx _context.Context, locationId string) (apiDeletePrivateLocationRequest, error) { + req := apiDeletePrivateLocationRequest{ + ctx: ctx, + locationId: locationId, + } + return req, nil +} + +// DeletePrivateLocation Delete a private location. +// Delete a Synthetics private location. +func (a *SyntheticsApi) DeletePrivateLocation(ctx _context.Context, locationId string) (*_nethttp.Response, error) { + req, err := a.buildDeletePrivateLocationRequest(ctx, locationId) + if err != nil { + return nil, err + } + + return a.deletePrivateLocationExecute(req) +} + +// deletePrivateLocationExecute executes the request. +func (a *SyntheticsApi) deletePrivateLocationExecute(r apiDeletePrivateLocationRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.DeletePrivateLocation") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" + localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(common.ParameterToString(r.locationId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiDeleteTestsRequest struct { + ctx _context.Context + body *SyntheticsDeleteTestsPayload +} + +func (a *SyntheticsApi) buildDeleteTestsRequest(ctx _context.Context, body SyntheticsDeleteTestsPayload) (apiDeleteTestsRequest, error) { + req := apiDeleteTestsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteTests Delete tests. +// Delete multiple Synthetic tests by ID. +func (a *SyntheticsApi) DeleteTests(ctx _context.Context, body SyntheticsDeleteTestsPayload) (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteTestsRequest(ctx, body) + if err != nil { + var localVarReturnValue SyntheticsDeleteTestsResponse + return localVarReturnValue, nil, err + } + + return a.deleteTestsExecute(req) +} + +// deleteTestsExecute executes the request. +func (a *SyntheticsApi) deleteTestsExecute(r apiDeleteTestsRequest) (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SyntheticsDeleteTestsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.DeleteTests") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiEditGlobalVariableRequest struct { + ctx _context.Context + variableId string + body *SyntheticsGlobalVariable +} + +func (a *SyntheticsApi) buildEditGlobalVariableRequest(ctx _context.Context, variableId string, body SyntheticsGlobalVariable) (apiEditGlobalVariableRequest, error) { + req := apiEditGlobalVariableRequest{ + ctx: ctx, + variableId: variableId, + body: &body, + } + return req, nil +} + +// EditGlobalVariable Edit a global variable. +// Edit a Synthetics global variable. +func (a *SyntheticsApi) EditGlobalVariable(ctx _context.Context, variableId string, body SyntheticsGlobalVariable) (SyntheticsGlobalVariable, *_nethttp.Response, error) { + req, err := a.buildEditGlobalVariableRequest(ctx, variableId, body) + if err != nil { + var localVarReturnValue SyntheticsGlobalVariable + return localVarReturnValue, nil, err + } + + return a.editGlobalVariableExecute(req) +} + +// editGlobalVariableExecute executes the request. +func (a *SyntheticsApi) editGlobalVariableExecute(r apiEditGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue SyntheticsGlobalVariable + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.EditGlobalVariable") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" + localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(common.ParameterToString(r.variableId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetAPITestRequest struct { + ctx _context.Context + publicId string +} + +func (a *SyntheticsApi) buildGetAPITestRequest(ctx _context.Context, publicId string) (apiGetAPITestRequest, error) { + req := apiGetAPITestRequest{ + ctx: ctx, + publicId: publicId, + } + return req, nil +} + +// GetAPITest Get an API test. +// Get the detailed configuration associated with +// a Synthetic API test. +func (a *SyntheticsApi) GetAPITest(ctx _context.Context, publicId string) (SyntheticsAPITest, *_nethttp.Response, error) { + req, err := a.buildGetAPITestRequest(ctx, publicId) + if err != nil { + var localVarReturnValue SyntheticsAPITest + return localVarReturnValue, nil, err + } + + return a.getAPITestExecute(req) +} + +// getAPITestExecute executes the request. +func (a *SyntheticsApi) getAPITestExecute(r apiGetAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsAPITest + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetAPITest") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/api/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetAPITestLatestResultsRequest struct { + ctx _context.Context + publicId string + fromTs *int64 + toTs *int64 + probeDc *[]string +} + +// GetAPITestLatestResultsOptionalParameters holds optional parameters for GetAPITestLatestResults. +type GetAPITestLatestResultsOptionalParameters struct { + FromTs *int64 + ToTs *int64 + ProbeDc *[]string +} + +// NewGetAPITestLatestResultsOptionalParameters creates an empty struct for parameters. +func NewGetAPITestLatestResultsOptionalParameters() *GetAPITestLatestResultsOptionalParameters { + this := GetAPITestLatestResultsOptionalParameters{} + return &this +} + +// WithFromTs sets the corresponding parameter name and returns the struct. +func (r *GetAPITestLatestResultsOptionalParameters) WithFromTs(fromTs int64) *GetAPITestLatestResultsOptionalParameters { + r.FromTs = &fromTs + return r +} + +// WithToTs sets the corresponding parameter name and returns the struct. +func (r *GetAPITestLatestResultsOptionalParameters) WithToTs(toTs int64) *GetAPITestLatestResultsOptionalParameters { + r.ToTs = &toTs + return r +} + +// WithProbeDc sets the corresponding parameter name and returns the struct. +func (r *GetAPITestLatestResultsOptionalParameters) WithProbeDc(probeDc []string) *GetAPITestLatestResultsOptionalParameters { + r.ProbeDc = &probeDc + return r +} + +func (a *SyntheticsApi) buildGetAPITestLatestResultsRequest(ctx _context.Context, publicId string, o ...GetAPITestLatestResultsOptionalParameters) (apiGetAPITestLatestResultsRequest, error) { + req := apiGetAPITestLatestResultsRequest{ + ctx: ctx, + publicId: publicId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetAPITestLatestResultsOptionalParameters is allowed") + } + + if o != nil { + req.fromTs = o[0].FromTs + req.toTs = o[0].ToTs + req.probeDc = o[0].ProbeDc + } + return req, nil +} + +// GetAPITestLatestResults Get an API test's latest results summaries. +// Get the last 50 test results summaries for a given Synthetics API test. +func (a *SyntheticsApi) GetAPITestLatestResults(ctx _context.Context, publicId string, o ...GetAPITestLatestResultsOptionalParameters) (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { + req, err := a.buildGetAPITestLatestResultsRequest(ctx, publicId, o...) + if err != nil { + var localVarReturnValue SyntheticsGetAPITestLatestResultsResponse + return localVarReturnValue, nil, err + } + + return a.getAPITestLatestResultsExecute(req) +} + +// getAPITestLatestResultsExecute executes the request. +func (a *SyntheticsApi) getAPITestLatestResultsExecute(r apiGetAPITestLatestResultsRequest) (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsGetAPITestLatestResultsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetAPITestLatestResults") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.fromTs != nil { + localVarQueryParams.Add("from_ts", common.ParameterToString(*r.fromTs, "")) + } + if r.toTs != nil { + localVarQueryParams.Add("to_ts", common.ParameterToString(*r.toTs, "")) + } + if r.probeDc != nil { + t := *r.probeDc + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("probe_dc", common.ParameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("probe_dc", common.ParameterToString(t, "multi")) + } + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetAPITestResultRequest struct { + ctx _context.Context + publicId string + resultId string +} + +func (a *SyntheticsApi) buildGetAPITestResultRequest(ctx _context.Context, publicId string, resultId string) (apiGetAPITestResultRequest, error) { + req := apiGetAPITestResultRequest{ + ctx: ctx, + publicId: publicId, + resultId: resultId, + } + return req, nil +} + +// GetAPITestResult Get an API test result. +// Get a specific full result from a given (API) Synthetic test. +func (a *SyntheticsApi) GetAPITestResult(ctx _context.Context, publicId string, resultId string) (SyntheticsAPITestResultFull, *_nethttp.Response, error) { + req, err := a.buildGetAPITestResultRequest(ctx, publicId, resultId) + if err != nil { + var localVarReturnValue SyntheticsAPITestResultFull + return localVarReturnValue, nil, err + } + + return a.getAPITestResultExecute(req) +} + +// getAPITestResultExecute executes the request. +func (a *SyntheticsApi) getAPITestResultExecute(r apiGetAPITestResultRequest) (SyntheticsAPITestResultFull, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsAPITestResultFull + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetAPITestResult") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results/{result_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(common.ParameterToString(r.resultId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetBrowserTestRequest struct { + ctx _context.Context + publicId string +} + +func (a *SyntheticsApi) buildGetBrowserTestRequest(ctx _context.Context, publicId string) (apiGetBrowserTestRequest, error) { + req := apiGetBrowserTestRequest{ + ctx: ctx, + publicId: publicId, + } + return req, nil +} + +// GetBrowserTest Get a browser test. +// Get the detailed configuration (including steps) associated with +// a Synthetic browser test. +func (a *SyntheticsApi) GetBrowserTest(ctx _context.Context, publicId string) (SyntheticsBrowserTest, *_nethttp.Response, error) { + req, err := a.buildGetBrowserTestRequest(ctx, publicId) + if err != nil { + var localVarReturnValue SyntheticsBrowserTest + return localVarReturnValue, nil, err + } + + return a.getBrowserTestExecute(req) +} + +// getBrowserTestExecute executes the request. +func (a *SyntheticsApi) getBrowserTestExecute(r apiGetBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsBrowserTest + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetBrowserTest") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetBrowserTestLatestResultsRequest struct { + ctx _context.Context + publicId string + fromTs *int64 + toTs *int64 + probeDc *[]string +} + +// GetBrowserTestLatestResultsOptionalParameters holds optional parameters for GetBrowserTestLatestResults. +type GetBrowserTestLatestResultsOptionalParameters struct { + FromTs *int64 + ToTs *int64 + ProbeDc *[]string +} + +// NewGetBrowserTestLatestResultsOptionalParameters creates an empty struct for parameters. +func NewGetBrowserTestLatestResultsOptionalParameters() *GetBrowserTestLatestResultsOptionalParameters { + this := GetBrowserTestLatestResultsOptionalParameters{} + return &this +} + +// WithFromTs sets the corresponding parameter name and returns the struct. +func (r *GetBrowserTestLatestResultsOptionalParameters) WithFromTs(fromTs int64) *GetBrowserTestLatestResultsOptionalParameters { + r.FromTs = &fromTs + return r +} + +// WithToTs sets the corresponding parameter name and returns the struct. +func (r *GetBrowserTestLatestResultsOptionalParameters) WithToTs(toTs int64) *GetBrowserTestLatestResultsOptionalParameters { + r.ToTs = &toTs + return r +} + +// WithProbeDc sets the corresponding parameter name and returns the struct. +func (r *GetBrowserTestLatestResultsOptionalParameters) WithProbeDc(probeDc []string) *GetBrowserTestLatestResultsOptionalParameters { + r.ProbeDc = &probeDc + return r +} + +func (a *SyntheticsApi) buildGetBrowserTestLatestResultsRequest(ctx _context.Context, publicId string, o ...GetBrowserTestLatestResultsOptionalParameters) (apiGetBrowserTestLatestResultsRequest, error) { + req := apiGetBrowserTestLatestResultsRequest{ + ctx: ctx, + publicId: publicId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetBrowserTestLatestResultsOptionalParameters is allowed") + } + + if o != nil { + req.fromTs = o[0].FromTs + req.toTs = o[0].ToTs + req.probeDc = o[0].ProbeDc + } + return req, nil +} + +// GetBrowserTestLatestResults Get a browser test's latest results summaries. +// Get the last 50 test results summaries for a given Synthetics Browser test. +func (a *SyntheticsApi) GetBrowserTestLatestResults(ctx _context.Context, publicId string, o ...GetBrowserTestLatestResultsOptionalParameters) (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { + req, err := a.buildGetBrowserTestLatestResultsRequest(ctx, publicId, o...) + if err != nil { + var localVarReturnValue SyntheticsGetBrowserTestLatestResultsResponse + return localVarReturnValue, nil, err + } + + return a.getBrowserTestLatestResultsExecute(req) +} + +// getBrowserTestLatestResultsExecute executes the request. +func (a *SyntheticsApi) getBrowserTestLatestResultsExecute(r apiGetBrowserTestLatestResultsRequest) (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsGetBrowserTestLatestResultsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetBrowserTestLatestResults") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.fromTs != nil { + localVarQueryParams.Add("from_ts", common.ParameterToString(*r.fromTs, "")) + } + if r.toTs != nil { + localVarQueryParams.Add("to_ts", common.ParameterToString(*r.toTs, "")) + } + if r.probeDc != nil { + t := *r.probeDc + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("probe_dc", common.ParameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("probe_dc", common.ParameterToString(t, "multi")) + } + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetBrowserTestResultRequest struct { + ctx _context.Context + publicId string + resultId string +} + +func (a *SyntheticsApi) buildGetBrowserTestResultRequest(ctx _context.Context, publicId string, resultId string) (apiGetBrowserTestResultRequest, error) { + req := apiGetBrowserTestResultRequest{ + ctx: ctx, + publicId: publicId, + resultId: resultId, + } + return req, nil +} + +// GetBrowserTestResult Get a browser test result. +// Get a specific full result from a given (browser) Synthetic test. +func (a *SyntheticsApi) GetBrowserTestResult(ctx _context.Context, publicId string, resultId string) (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { + req, err := a.buildGetBrowserTestResultRequest(ctx, publicId, resultId) + if err != nil { + var localVarReturnValue SyntheticsBrowserTestResultFull + return localVarReturnValue, nil, err + } + + return a.getBrowserTestResultExecute(req) +} + +// getBrowserTestResultExecute executes the request. +func (a *SyntheticsApi) getBrowserTestResultExecute(r apiGetBrowserTestResultRequest) (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsBrowserTestResultFull + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetBrowserTestResult") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(common.ParameterToString(r.resultId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetGlobalVariableRequest struct { + ctx _context.Context + variableId string +} + +func (a *SyntheticsApi) buildGetGlobalVariableRequest(ctx _context.Context, variableId string) (apiGetGlobalVariableRequest, error) { + req := apiGetGlobalVariableRequest{ + ctx: ctx, + variableId: variableId, + } + return req, nil +} + +// GetGlobalVariable Get a global variable. +// Get the detailed configuration of a global variable. +func (a *SyntheticsApi) GetGlobalVariable(ctx _context.Context, variableId string) (SyntheticsGlobalVariable, *_nethttp.Response, error) { + req, err := a.buildGetGlobalVariableRequest(ctx, variableId) + if err != nil { + var localVarReturnValue SyntheticsGlobalVariable + return localVarReturnValue, nil, err + } + + return a.getGlobalVariableExecute(req) +} + +// getGlobalVariableExecute executes the request. +func (a *SyntheticsApi) getGlobalVariableExecute(r apiGetGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsGlobalVariable + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetGlobalVariable") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" + localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(common.ParameterToString(r.variableId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetPrivateLocationRequest struct { + ctx _context.Context + locationId string +} + +func (a *SyntheticsApi) buildGetPrivateLocationRequest(ctx _context.Context, locationId string) (apiGetPrivateLocationRequest, error) { + req := apiGetPrivateLocationRequest{ + ctx: ctx, + locationId: locationId, + } + return req, nil +} + +// GetPrivateLocation Get a private location. +// Get a Synthetics private location. +func (a *SyntheticsApi) GetPrivateLocation(ctx _context.Context, locationId string) (SyntheticsPrivateLocation, *_nethttp.Response, error) { + req, err := a.buildGetPrivateLocationRequest(ctx, locationId) + if err != nil { + var localVarReturnValue SyntheticsPrivateLocation + return localVarReturnValue, nil, err + } + + return a.getPrivateLocationExecute(req) +} + +// getPrivateLocationExecute executes the request. +func (a *SyntheticsApi) getPrivateLocationExecute(r apiGetPrivateLocationRequest) (SyntheticsPrivateLocation, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsPrivateLocation + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetPrivateLocation") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" + localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(common.ParameterToString(r.locationId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSyntheticsCIBatchRequest struct { + ctx _context.Context + batchId string +} + +func (a *SyntheticsApi) buildGetSyntheticsCIBatchRequest(ctx _context.Context, batchId string) (apiGetSyntheticsCIBatchRequest, error) { + req := apiGetSyntheticsCIBatchRequest{ + ctx: ctx, + batchId: batchId, + } + return req, nil +} + +// GetSyntheticsCIBatch Get details of batch. +// Get a batch's updated details. +func (a *SyntheticsApi) GetSyntheticsCIBatch(ctx _context.Context, batchId string) (SyntheticsBatchDetails, *_nethttp.Response, error) { + req, err := a.buildGetSyntheticsCIBatchRequest(ctx, batchId) + if err != nil { + var localVarReturnValue SyntheticsBatchDetails + return localVarReturnValue, nil, err + } + + return a.getSyntheticsCIBatchExecute(req) +} + +// getSyntheticsCIBatchExecute executes the request. +func (a *SyntheticsApi) getSyntheticsCIBatchExecute(r apiGetSyntheticsCIBatchRequest) (SyntheticsBatchDetails, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsBatchDetails + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetSyntheticsCIBatch") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/ci/batch/{batch_id}" + localVarPath = strings.Replace(localVarPath, "{"+"batch_id"+"}", _neturl.PathEscape(common.ParameterToString(r.batchId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetTestRequest struct { + ctx _context.Context + publicId string +} + +func (a *SyntheticsApi) buildGetTestRequest(ctx _context.Context, publicId string) (apiGetTestRequest, error) { + req := apiGetTestRequest{ + ctx: ctx, + publicId: publicId, + } + return req, nil +} + +// GetTest Get a test configuration. +// Get the detailed configuration associated with a Synthetics test. +func (a *SyntheticsApi) GetTest(ctx _context.Context, publicId string) (SyntheticsTestDetails, *_nethttp.Response, error) { + req, err := a.buildGetTestRequest(ctx, publicId) + if err != nil { + var localVarReturnValue SyntheticsTestDetails + return localVarReturnValue, nil, err + } + + return a.getTestExecute(req) +} + +// getTestExecute executes the request. +func (a *SyntheticsApi) getTestExecute(r apiGetTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsTestDetails + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.GetTest") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListGlobalVariablesRequest struct { + ctx _context.Context +} + +func (a *SyntheticsApi) buildListGlobalVariablesRequest(ctx _context.Context) (apiListGlobalVariablesRequest, error) { + req := apiListGlobalVariablesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListGlobalVariables Get all global variables. +// Get the list of all Synthetics global variables. +func (a *SyntheticsApi) ListGlobalVariables(ctx _context.Context) (SyntheticsListGlobalVariablesResponse, *_nethttp.Response, error) { + req, err := a.buildListGlobalVariablesRequest(ctx) + if err != nil { + var localVarReturnValue SyntheticsListGlobalVariablesResponse + return localVarReturnValue, nil, err + } + + return a.listGlobalVariablesExecute(req) +} + +// listGlobalVariablesExecute executes the request. +func (a *SyntheticsApi) listGlobalVariablesExecute(r apiListGlobalVariablesRequest) (SyntheticsListGlobalVariablesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsListGlobalVariablesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.ListGlobalVariables") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/variables" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListLocationsRequest struct { + ctx _context.Context +} + +func (a *SyntheticsApi) buildListLocationsRequest(ctx _context.Context) (apiListLocationsRequest, error) { + req := apiListLocationsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListLocations Get all locations (public and private). +// Get the list of public and private locations available for Synthetic +// tests. No arguments required. +func (a *SyntheticsApi) ListLocations(ctx _context.Context) (SyntheticsLocations, *_nethttp.Response, error) { + req, err := a.buildListLocationsRequest(ctx) + if err != nil { + var localVarReturnValue SyntheticsLocations + return localVarReturnValue, nil, err + } + + return a.listLocationsExecute(req) +} + +// listLocationsExecute executes the request. +func (a *SyntheticsApi) listLocationsExecute(r apiListLocationsRequest) (SyntheticsLocations, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsLocations + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.ListLocations") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/locations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListTestsRequest struct { + ctx _context.Context +} + +func (a *SyntheticsApi) buildListTestsRequest(ctx _context.Context) (apiListTestsRequest, error) { + req := apiListTestsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListTests Get the list of all tests. +// Get the list of all Synthetic tests. +func (a *SyntheticsApi) ListTests(ctx _context.Context) (SyntheticsListTestsResponse, *_nethttp.Response, error) { + req, err := a.buildListTestsRequest(ctx) + if err != nil { + var localVarReturnValue SyntheticsListTestsResponse + return localVarReturnValue, nil, err + } + + return a.listTestsExecute(req) +} + +// listTestsExecute executes the request. +func (a *SyntheticsApi) listTestsExecute(r apiListTestsRequest) (SyntheticsListTestsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SyntheticsListTestsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.ListTests") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiTriggerCITestsRequest struct { + ctx _context.Context + body *SyntheticsCITestBody +} + +func (a *SyntheticsApi) buildTriggerCITestsRequest(ctx _context.Context, body SyntheticsCITestBody) (apiTriggerCITestsRequest, error) { + req := apiTriggerCITestsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// TriggerCITests Trigger tests from CI/CD pipelines. +// Trigger a set of Synthetics tests for continuous integration. +func (a *SyntheticsApi) TriggerCITests(ctx _context.Context, body SyntheticsCITestBody) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { + req, err := a.buildTriggerCITestsRequest(ctx, body) + if err != nil { + var localVarReturnValue SyntheticsTriggerCITestsResponse + return localVarReturnValue, nil, err + } + + return a.triggerCITestsExecute(req) +} + +// triggerCITestsExecute executes the request. +func (a *SyntheticsApi) triggerCITestsExecute(r apiTriggerCITestsRequest) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SyntheticsTriggerCITestsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.TriggerCITests") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/trigger/ci" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiTriggerTestsRequest struct { + ctx _context.Context + body *SyntheticsTriggerBody +} + +func (a *SyntheticsApi) buildTriggerTestsRequest(ctx _context.Context, body SyntheticsTriggerBody) (apiTriggerTestsRequest, error) { + req := apiTriggerTestsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// TriggerTests Trigger Synthetics tests. +// Trigger a set of Synthetics tests. +func (a *SyntheticsApi) TriggerTests(ctx _context.Context, body SyntheticsTriggerBody) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { + req, err := a.buildTriggerTestsRequest(ctx, body) + if err != nil { + var localVarReturnValue SyntheticsTriggerCITestsResponse + return localVarReturnValue, nil, err + } + + return a.triggerTestsExecute(req) +} + +// triggerTestsExecute executes the request. +func (a *SyntheticsApi) triggerTestsExecute(r apiTriggerTestsRequest) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SyntheticsTriggerCITestsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.TriggerTests") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/trigger" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateAPITestRequest struct { + ctx _context.Context + publicId string + body *SyntheticsAPITest +} + +func (a *SyntheticsApi) buildUpdateAPITestRequest(ctx _context.Context, publicId string, body SyntheticsAPITest) (apiUpdateAPITestRequest, error) { + req := apiUpdateAPITestRequest{ + ctx: ctx, + publicId: publicId, + body: &body, + } + return req, nil +} + +// UpdateAPITest Edit an API test. +// Edit the configuration of a Synthetic API test. +func (a *SyntheticsApi) UpdateAPITest(ctx _context.Context, publicId string, body SyntheticsAPITest) (SyntheticsAPITest, *_nethttp.Response, error) { + req, err := a.buildUpdateAPITestRequest(ctx, publicId, body) + if err != nil { + var localVarReturnValue SyntheticsAPITest + return localVarReturnValue, nil, err + } + + return a.updateAPITestExecute(req) +} + +// updateAPITestExecute executes the request. +func (a *SyntheticsApi) updateAPITestExecute(r apiUpdateAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue SyntheticsAPITest + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdateAPITest") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/api/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateBrowserTestRequest struct { + ctx _context.Context + publicId string + body *SyntheticsBrowserTest +} + +func (a *SyntheticsApi) buildUpdateBrowserTestRequest(ctx _context.Context, publicId string, body SyntheticsBrowserTest) (apiUpdateBrowserTestRequest, error) { + req := apiUpdateBrowserTestRequest{ + ctx: ctx, + publicId: publicId, + body: &body, + } + return req, nil +} + +// UpdateBrowserTest Edit a browser test. +// Edit the configuration of a Synthetic browser test. +func (a *SyntheticsApi) UpdateBrowserTest(ctx _context.Context, publicId string, body SyntheticsBrowserTest) (SyntheticsBrowserTest, *_nethttp.Response, error) { + req, err := a.buildUpdateBrowserTestRequest(ctx, publicId, body) + if err != nil { + var localVarReturnValue SyntheticsBrowserTest + return localVarReturnValue, nil, err + } + + return a.updateBrowserTestExecute(req) +} + +// updateBrowserTestExecute executes the request. +func (a *SyntheticsApi) updateBrowserTestExecute(r apiUpdateBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue SyntheticsBrowserTest + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdateBrowserTest") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdatePrivateLocationRequest struct { + ctx _context.Context + locationId string + body *SyntheticsPrivateLocation +} + +func (a *SyntheticsApi) buildUpdatePrivateLocationRequest(ctx _context.Context, locationId string, body SyntheticsPrivateLocation) (apiUpdatePrivateLocationRequest, error) { + req := apiUpdatePrivateLocationRequest{ + ctx: ctx, + locationId: locationId, + body: &body, + } + return req, nil +} + +// UpdatePrivateLocation Edit a private location. +// Edit a Synthetics private location. +func (a *SyntheticsApi) UpdatePrivateLocation(ctx _context.Context, locationId string, body SyntheticsPrivateLocation) (SyntheticsPrivateLocation, *_nethttp.Response, error) { + req, err := a.buildUpdatePrivateLocationRequest(ctx, locationId, body) + if err != nil { + var localVarReturnValue SyntheticsPrivateLocation + return localVarReturnValue, nil, err + } + + return a.updatePrivateLocationExecute(req) +} + +// updatePrivateLocationExecute executes the request. +func (a *SyntheticsApi) updatePrivateLocationExecute(r apiUpdatePrivateLocationRequest) (SyntheticsPrivateLocation, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue SyntheticsPrivateLocation + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdatePrivateLocation") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" + localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(common.ParameterToString(r.locationId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateTestPauseStatusRequest struct { + ctx _context.Context + publicId string + body *SyntheticsUpdateTestPauseStatusPayload +} + +func (a *SyntheticsApi) buildUpdateTestPauseStatusRequest(ctx _context.Context, publicId string, body SyntheticsUpdateTestPauseStatusPayload) (apiUpdateTestPauseStatusRequest, error) { + req := apiUpdateTestPauseStatusRequest{ + ctx: ctx, + publicId: publicId, + body: &body, + } + return req, nil +} + +// UpdateTestPauseStatus Pause or start a test. +// Pause or start a Synthetics test by changing the status. +func (a *SyntheticsApi) UpdateTestPauseStatus(ctx _context.Context, publicId string, body SyntheticsUpdateTestPauseStatusPayload) (bool, *_nethttp.Response, error) { + req, err := a.buildUpdateTestPauseStatusRequest(ctx, publicId, body) + if err != nil { + var localVarReturnValue bool + return localVarReturnValue, nil, err + } + + return a.updateTestPauseStatusExecute(req) +} + +// updateTestPauseStatusExecute executes the request. +func (a *SyntheticsApi) updateTestPauseStatusExecute(r apiUpdateTestPauseStatusRequest) (bool, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue bool + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.SyntheticsApi.UpdateTestPauseStatus") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/status" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(common.ParameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewSyntheticsApi Returns NewSyntheticsApi. +func NewSyntheticsApi(client *common.APIClient) *SyntheticsApi { + return &SyntheticsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_tags.go b/api/v1/datadog/api_tags.go new file mode 100644 index 00000000000..bd70f5982bd --- /dev/null +++ b/api/v1/datadog/api_tags.go @@ -0,0 +1,861 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// TagsApi service type +type TagsApi common.Service + +type apiCreateHostTagsRequest struct { + ctx _context.Context + hostName string + body *HostTags + source *string +} + +// CreateHostTagsOptionalParameters holds optional parameters for CreateHostTags. +type CreateHostTagsOptionalParameters struct { + Source *string +} + +// NewCreateHostTagsOptionalParameters creates an empty struct for parameters. +func NewCreateHostTagsOptionalParameters() *CreateHostTagsOptionalParameters { + this := CreateHostTagsOptionalParameters{} + return &this +} + +// WithSource sets the corresponding parameter name and returns the struct. +func (r *CreateHostTagsOptionalParameters) WithSource(source string) *CreateHostTagsOptionalParameters { + r.Source = &source + return r +} + +func (a *TagsApi) buildCreateHostTagsRequest(ctx _context.Context, hostName string, body HostTags, o ...CreateHostTagsOptionalParameters) (apiCreateHostTagsRequest, error) { + req := apiCreateHostTagsRequest{ + ctx: ctx, + hostName: hostName, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type CreateHostTagsOptionalParameters is allowed") + } + + if o != nil { + req.source = o[0].Source + } + return req, nil +} + +// CreateHostTags Add tags to a host. +// This endpoint allows you to add new tags to a host, +// optionally specifying where these tags come from. +func (a *TagsApi) CreateHostTags(ctx _context.Context, hostName string, body HostTags, o ...CreateHostTagsOptionalParameters) (HostTags, *_nethttp.Response, error) { + req, err := a.buildCreateHostTagsRequest(ctx, hostName, body, o...) + if err != nil { + var localVarReturnValue HostTags + return localVarReturnValue, nil, err + } + + return a.createHostTagsExecute(req) +} + +// createHostTagsExecute executes the request. +func (a *TagsApi) createHostTagsExecute(r apiCreateHostTagsRequest) (HostTags, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue HostTags + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.CreateHostTags") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" + localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + if r.source != nil { + localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteHostTagsRequest struct { + ctx _context.Context + hostName string + source *string +} + +// DeleteHostTagsOptionalParameters holds optional parameters for DeleteHostTags. +type DeleteHostTagsOptionalParameters struct { + Source *string +} + +// NewDeleteHostTagsOptionalParameters creates an empty struct for parameters. +func NewDeleteHostTagsOptionalParameters() *DeleteHostTagsOptionalParameters { + this := DeleteHostTagsOptionalParameters{} + return &this +} + +// WithSource sets the corresponding parameter name and returns the struct. +func (r *DeleteHostTagsOptionalParameters) WithSource(source string) *DeleteHostTagsOptionalParameters { + r.Source = &source + return r +} + +func (a *TagsApi) buildDeleteHostTagsRequest(ctx _context.Context, hostName string, o ...DeleteHostTagsOptionalParameters) (apiDeleteHostTagsRequest, error) { + req := apiDeleteHostTagsRequest{ + ctx: ctx, + hostName: hostName, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type DeleteHostTagsOptionalParameters is allowed") + } + + if o != nil { + req.source = o[0].Source + } + return req, nil +} + +// DeleteHostTags Remove host tags. +// This endpoint allows you to remove all user-assigned tags +// for a single host. +func (a *TagsApi) DeleteHostTags(ctx _context.Context, hostName string, o ...DeleteHostTagsOptionalParameters) (*_nethttp.Response, error) { + req, err := a.buildDeleteHostTagsRequest(ctx, hostName, o...) + if err != nil { + return nil, err + } + + return a.deleteHostTagsExecute(req) +} + +// deleteHostTagsExecute executes the request. +func (a *TagsApi) deleteHostTagsExecute(r apiDeleteHostTagsRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.DeleteHostTags") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" + localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.source != nil { + localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) + } + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetHostTagsRequest struct { + ctx _context.Context + hostName string + source *string +} + +// GetHostTagsOptionalParameters holds optional parameters for GetHostTags. +type GetHostTagsOptionalParameters struct { + Source *string +} + +// NewGetHostTagsOptionalParameters creates an empty struct for parameters. +func NewGetHostTagsOptionalParameters() *GetHostTagsOptionalParameters { + this := GetHostTagsOptionalParameters{} + return &this +} + +// WithSource sets the corresponding parameter name and returns the struct. +func (r *GetHostTagsOptionalParameters) WithSource(source string) *GetHostTagsOptionalParameters { + r.Source = &source + return r +} + +func (a *TagsApi) buildGetHostTagsRequest(ctx _context.Context, hostName string, o ...GetHostTagsOptionalParameters) (apiGetHostTagsRequest, error) { + req := apiGetHostTagsRequest{ + ctx: ctx, + hostName: hostName, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetHostTagsOptionalParameters is allowed") + } + + if o != nil { + req.source = o[0].Source + } + return req, nil +} + +// GetHostTags Get host tags. +// Return the list of tags that apply to a given host. +func (a *TagsApi) GetHostTags(ctx _context.Context, hostName string, o ...GetHostTagsOptionalParameters) (HostTags, *_nethttp.Response, error) { + req, err := a.buildGetHostTagsRequest(ctx, hostName, o...) + if err != nil { + var localVarReturnValue HostTags + return localVarReturnValue, nil, err + } + + return a.getHostTagsExecute(req) +} + +// getHostTagsExecute executes the request. +func (a *TagsApi) getHostTagsExecute(r apiGetHostTagsRequest) (HostTags, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue HostTags + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.GetHostTags") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" + localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.source != nil { + localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListHostTagsRequest struct { + ctx _context.Context + source *string +} + +// ListHostTagsOptionalParameters holds optional parameters for ListHostTags. +type ListHostTagsOptionalParameters struct { + Source *string +} + +// NewListHostTagsOptionalParameters creates an empty struct for parameters. +func NewListHostTagsOptionalParameters() *ListHostTagsOptionalParameters { + this := ListHostTagsOptionalParameters{} + return &this +} + +// WithSource sets the corresponding parameter name and returns the struct. +func (r *ListHostTagsOptionalParameters) WithSource(source string) *ListHostTagsOptionalParameters { + r.Source = &source + return r +} + +func (a *TagsApi) buildListHostTagsRequest(ctx _context.Context, o ...ListHostTagsOptionalParameters) (apiListHostTagsRequest, error) { + req := apiListHostTagsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListHostTagsOptionalParameters is allowed") + } + + if o != nil { + req.source = o[0].Source + } + return req, nil +} + +// ListHostTags Get Tags. +// Return a mapping of tags to hosts for your whole infrastructure. +func (a *TagsApi) ListHostTags(ctx _context.Context, o ...ListHostTagsOptionalParameters) (TagToHosts, *_nethttp.Response, error) { + req, err := a.buildListHostTagsRequest(ctx, o...) + if err != nil { + var localVarReturnValue TagToHosts + return localVarReturnValue, nil, err + } + + return a.listHostTagsExecute(req) +} + +// listHostTagsExecute executes the request. +func (a *TagsApi) listHostTagsExecute(r apiListHostTagsRequest) (TagToHosts, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TagToHosts + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.ListHostTags") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/tags/hosts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.source != nil { + localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateHostTagsRequest struct { + ctx _context.Context + hostName string + body *HostTags + source *string +} + +// UpdateHostTagsOptionalParameters holds optional parameters for UpdateHostTags. +type UpdateHostTagsOptionalParameters struct { + Source *string +} + +// NewUpdateHostTagsOptionalParameters creates an empty struct for parameters. +func NewUpdateHostTagsOptionalParameters() *UpdateHostTagsOptionalParameters { + this := UpdateHostTagsOptionalParameters{} + return &this +} + +// WithSource sets the corresponding parameter name and returns the struct. +func (r *UpdateHostTagsOptionalParameters) WithSource(source string) *UpdateHostTagsOptionalParameters { + r.Source = &source + return r +} + +func (a *TagsApi) buildUpdateHostTagsRequest(ctx _context.Context, hostName string, body HostTags, o ...UpdateHostTagsOptionalParameters) (apiUpdateHostTagsRequest, error) { + req := apiUpdateHostTagsRequest{ + ctx: ctx, + hostName: hostName, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type UpdateHostTagsOptionalParameters is allowed") + } + + if o != nil { + req.source = o[0].Source + } + return req, nil +} + +// UpdateHostTags Update host tags. +// This endpoint allows you to update/replace all tags in +// an integration source with those supplied in the request. +func (a *TagsApi) UpdateHostTags(ctx _context.Context, hostName string, body HostTags, o ...UpdateHostTagsOptionalParameters) (HostTags, *_nethttp.Response, error) { + req, err := a.buildUpdateHostTagsRequest(ctx, hostName, body, o...) + if err != nil { + var localVarReturnValue HostTags + return localVarReturnValue, nil, err + } + + return a.updateHostTagsExecute(req) +} + +// updateHostTagsExecute executes the request. +func (a *TagsApi) updateHostTagsExecute(r apiUpdateHostTagsRequest) (HostTags, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue HostTags + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.TagsApi.UpdateHostTags") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/tags/hosts/{host_name}" + localVarPath = strings.Replace(localVarPath, "{"+"host_name"+"}", _neturl.PathEscape(common.ParameterToString(r.hostName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + if r.source != nil { + localVarQueryParams.Add("source", common.ParameterToString(*r.source, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewTagsApi Returns NewTagsApi. +func NewTagsApi(client *common.APIClient) *TagsApi { + return &TagsApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_usage_metering.go b/api/v1/datadog/api_usage_metering.go new file mode 100644 index 00000000000..9ade55f4792 --- /dev/null +++ b/api/v1/datadog/api_usage_metering.go @@ -0,0 +1,6764 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _fmt "fmt" + _ioutil "io/ioutil" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "reflect" + "strings" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsageMeteringApi service type +type UsageMeteringApi common.Service + +type apiGetDailyCustomReportsRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sortDir *UsageSortDirection + sort *UsageSort +} + +// GetDailyCustomReportsOptionalParameters holds optional parameters for GetDailyCustomReports. +type GetDailyCustomReportsOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + SortDir *UsageSortDirection + Sort *UsageSort +} + +// NewGetDailyCustomReportsOptionalParameters creates an empty struct for parameters. +func NewGetDailyCustomReportsOptionalParameters() *GetDailyCustomReportsOptionalParameters { + this := GetDailyCustomReportsOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *GetDailyCustomReportsOptionalParameters) WithPageSize(pageSize int64) *GetDailyCustomReportsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *GetDailyCustomReportsOptionalParameters) WithPageNumber(pageNumber int64) *GetDailyCustomReportsOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSortDir sets the corresponding parameter name and returns the struct. +func (r *GetDailyCustomReportsOptionalParameters) WithSortDir(sortDir UsageSortDirection) *GetDailyCustomReportsOptionalParameters { + r.SortDir = &sortDir + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *GetDailyCustomReportsOptionalParameters) WithSort(sort UsageSort) *GetDailyCustomReportsOptionalParameters { + r.Sort = &sort + return r +} + +func (a *UsageMeteringApi) buildGetDailyCustomReportsRequest(ctx _context.Context, o ...GetDailyCustomReportsOptionalParameters) (apiGetDailyCustomReportsRequest, error) { + req := apiGetDailyCustomReportsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetDailyCustomReportsOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sortDir = o[0].SortDir + req.sort = o[0].Sort + } + return req, nil +} + +// GetDailyCustomReports Get the list of available daily custom reports. +// Get daily custom reports. +func (a *UsageMeteringApi) GetDailyCustomReports(ctx _context.Context, o ...GetDailyCustomReportsOptionalParameters) (UsageCustomReportsResponse, *_nethttp.Response, error) { + req, err := a.buildGetDailyCustomReportsRequest(ctx, o...) + if err != nil { + var localVarReturnValue UsageCustomReportsResponse + return localVarReturnValue, nil, err + } + + return a.getDailyCustomReportsExecute(req) +} + +// getDailyCustomReportsExecute executes the request. +func (a *UsageMeteringApi) getDailyCustomReportsExecute(r apiGetDailyCustomReportsRequest) (UsageCustomReportsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageCustomReportsResponse + ) + + operationId := "v1.GetDailyCustomReports" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetDailyCustomReports") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/daily_custom_reports" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sortDir != nil { + localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetHourlyUsageAttributionRequest struct { + ctx _context.Context + startHr *time.Time + usageType *HourlyUsageAttributionUsageType + endHr *time.Time + nextRecordId *string + tagBreakdownKeys *string + includeDescendants *bool +} + +// GetHourlyUsageAttributionOptionalParameters holds optional parameters for GetHourlyUsageAttribution. +type GetHourlyUsageAttributionOptionalParameters struct { + EndHr *time.Time + NextRecordId *string + TagBreakdownKeys *string + IncludeDescendants *bool +} + +// NewGetHourlyUsageAttributionOptionalParameters creates an empty struct for parameters. +func NewGetHourlyUsageAttributionOptionalParameters() *GetHourlyUsageAttributionOptionalParameters { + this := GetHourlyUsageAttributionOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageAttributionOptionalParameters) WithEndHr(endHr time.Time) *GetHourlyUsageAttributionOptionalParameters { + r.EndHr = &endHr + return r +} + +// WithNextRecordId sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageAttributionOptionalParameters) WithNextRecordId(nextRecordId string) *GetHourlyUsageAttributionOptionalParameters { + r.NextRecordId = &nextRecordId + return r +} + +// WithTagBreakdownKeys sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageAttributionOptionalParameters) WithTagBreakdownKeys(tagBreakdownKeys string) *GetHourlyUsageAttributionOptionalParameters { + r.TagBreakdownKeys = &tagBreakdownKeys + return r +} + +// WithIncludeDescendants sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageAttributionOptionalParameters) WithIncludeDescendants(includeDescendants bool) *GetHourlyUsageAttributionOptionalParameters { + r.IncludeDescendants = &includeDescendants + return r +} + +func (a *UsageMeteringApi) buildGetHourlyUsageAttributionRequest(ctx _context.Context, startHr time.Time, usageType HourlyUsageAttributionUsageType, o ...GetHourlyUsageAttributionOptionalParameters) (apiGetHourlyUsageAttributionRequest, error) { + req := apiGetHourlyUsageAttributionRequest{ + ctx: ctx, + startHr: &startHr, + usageType: &usageType, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetHourlyUsageAttributionOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + req.nextRecordId = o[0].NextRecordId + req.tagBreakdownKeys = o[0].TagBreakdownKeys + req.includeDescendants = o[0].IncludeDescendants + } + return req, nil +} + +// GetHourlyUsageAttribution Get hourly usage attribution. +// Get hourly usage attribution. +// +// This API endpoint is paginated. To make sure you receive all records, check if the value of `next_record_id` is +// set in the response. If it is, make another request and pass `next_record_id` as a parameter. +// Pseudo code example: +// +// ``` +// response := GetHourlyUsageAttribution(start_month) +// cursor := response.metadata.pagination.next_record_id +// WHILE cursor != null BEGIN +// sleep(5 seconds) # Avoid running into rate limit +// response := GetHourlyUsageAttribution(start_month, next_record_id=cursor) +// cursor := response.metadata.pagination.next_record_id +// END +// ``` +func (a *UsageMeteringApi) GetHourlyUsageAttribution(ctx _context.Context, startHr time.Time, usageType HourlyUsageAttributionUsageType, o ...GetHourlyUsageAttributionOptionalParameters) (HourlyUsageAttributionResponse, *_nethttp.Response, error) { + req, err := a.buildGetHourlyUsageAttributionRequest(ctx, startHr, usageType, o...) + if err != nil { + var localVarReturnValue HourlyUsageAttributionResponse + return localVarReturnValue, nil, err + } + + return a.getHourlyUsageAttributionExecute(req) +} + +// getHourlyUsageAttributionExecute executes the request. +func (a *UsageMeteringApi) getHourlyUsageAttributionExecute(r apiGetHourlyUsageAttributionRequest) (HourlyUsageAttributionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue HourlyUsageAttributionResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetHourlyUsageAttribution") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/hourly-attribution" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + if r.usageType == nil { + return localVarReturnValue, nil, common.ReportError("usageType is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + localVarQueryParams.Add("usage_type", common.ParameterToString(*r.usageType, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + if r.nextRecordId != nil { + localVarQueryParams.Add("next_record_id", common.ParameterToString(*r.nextRecordId, "")) + } + if r.tagBreakdownKeys != nil { + localVarQueryParams.Add("tag_breakdown_keys", common.ParameterToString(*r.tagBreakdownKeys, "")) + } + if r.includeDescendants != nil { + localVarQueryParams.Add("include_descendants", common.ParameterToString(*r.includeDescendants, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetIncidentManagementRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetIncidentManagementOptionalParameters holds optional parameters for GetIncidentManagement. +type GetIncidentManagementOptionalParameters struct { + EndHr *time.Time +} + +// NewGetIncidentManagementOptionalParameters creates an empty struct for parameters. +func NewGetIncidentManagementOptionalParameters() *GetIncidentManagementOptionalParameters { + this := GetIncidentManagementOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetIncidentManagementOptionalParameters) WithEndHr(endHr time.Time) *GetIncidentManagementOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetIncidentManagementRequest(ctx _context.Context, startHr time.Time, o ...GetIncidentManagementOptionalParameters) (apiGetIncidentManagementRequest, error) { + req := apiGetIncidentManagementRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetIncidentManagementOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetIncidentManagement Get hourly usage for incident management. +// Get hourly usage for incident management. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetIncidentManagement(ctx _context.Context, startHr time.Time, o ...GetIncidentManagementOptionalParameters) (UsageIncidentManagementResponse, *_nethttp.Response, error) { + req, err := a.buildGetIncidentManagementRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageIncidentManagementResponse + return localVarReturnValue, nil, err + } + + return a.getIncidentManagementExecute(req) +} + +// getIncidentManagementExecute executes the request. +func (a *UsageMeteringApi) getIncidentManagementExecute(r apiGetIncidentManagementRequest) (UsageIncidentManagementResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageIncidentManagementResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetIncidentManagement") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/incident-management" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetIngestedSpansRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetIngestedSpansOptionalParameters holds optional parameters for GetIngestedSpans. +type GetIngestedSpansOptionalParameters struct { + EndHr *time.Time +} + +// NewGetIngestedSpansOptionalParameters creates an empty struct for parameters. +func NewGetIngestedSpansOptionalParameters() *GetIngestedSpansOptionalParameters { + this := GetIngestedSpansOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetIngestedSpansOptionalParameters) WithEndHr(endHr time.Time) *GetIngestedSpansOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetIngestedSpansRequest(ctx _context.Context, startHr time.Time, o ...GetIngestedSpansOptionalParameters) (apiGetIngestedSpansRequest, error) { + req := apiGetIngestedSpansRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetIngestedSpansOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetIngestedSpans Get hourly usage for ingested spans. +// Get hourly usage for ingested spans. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetIngestedSpans(ctx _context.Context, startHr time.Time, o ...GetIngestedSpansOptionalParameters) (UsageIngestedSpansResponse, *_nethttp.Response, error) { + req, err := a.buildGetIngestedSpansRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageIngestedSpansResponse + return localVarReturnValue, nil, err + } + + return a.getIngestedSpansExecute(req) +} + +// getIngestedSpansExecute executes the request. +func (a *UsageMeteringApi) getIngestedSpansExecute(r apiGetIngestedSpansRequest) (UsageIngestedSpansResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageIngestedSpansResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetIngestedSpans") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/ingested-spans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetMonthlyCustomReportsRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sortDir *UsageSortDirection + sort *UsageSort +} + +// GetMonthlyCustomReportsOptionalParameters holds optional parameters for GetMonthlyCustomReports. +type GetMonthlyCustomReportsOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + SortDir *UsageSortDirection + Sort *UsageSort +} + +// NewGetMonthlyCustomReportsOptionalParameters creates an empty struct for parameters. +func NewGetMonthlyCustomReportsOptionalParameters() *GetMonthlyCustomReportsOptionalParameters { + this := GetMonthlyCustomReportsOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyCustomReportsOptionalParameters) WithPageSize(pageSize int64) *GetMonthlyCustomReportsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyCustomReportsOptionalParameters) WithPageNumber(pageNumber int64) *GetMonthlyCustomReportsOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSortDir sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyCustomReportsOptionalParameters) WithSortDir(sortDir UsageSortDirection) *GetMonthlyCustomReportsOptionalParameters { + r.SortDir = &sortDir + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyCustomReportsOptionalParameters) WithSort(sort UsageSort) *GetMonthlyCustomReportsOptionalParameters { + r.Sort = &sort + return r +} + +func (a *UsageMeteringApi) buildGetMonthlyCustomReportsRequest(ctx _context.Context, o ...GetMonthlyCustomReportsOptionalParameters) (apiGetMonthlyCustomReportsRequest, error) { + req := apiGetMonthlyCustomReportsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetMonthlyCustomReportsOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sortDir = o[0].SortDir + req.sort = o[0].Sort + } + return req, nil +} + +// GetMonthlyCustomReports Get the list of available monthly custom reports. +// Get monthly custom reports. +func (a *UsageMeteringApi) GetMonthlyCustomReports(ctx _context.Context, o ...GetMonthlyCustomReportsOptionalParameters) (UsageCustomReportsResponse, *_nethttp.Response, error) { + req, err := a.buildGetMonthlyCustomReportsRequest(ctx, o...) + if err != nil { + var localVarReturnValue UsageCustomReportsResponse + return localVarReturnValue, nil, err + } + + return a.getMonthlyCustomReportsExecute(req) +} + +// getMonthlyCustomReportsExecute executes the request. +func (a *UsageMeteringApi) getMonthlyCustomReportsExecute(r apiGetMonthlyCustomReportsRequest) (UsageCustomReportsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageCustomReportsResponse + ) + + operationId := "v1.GetMonthlyCustomReports" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetMonthlyCustomReports") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monthly_custom_reports" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sortDir != nil { + localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetMonthlyUsageAttributionRequest struct { + ctx _context.Context + startMonth *time.Time + fields *MonthlyUsageAttributionSupportedMetrics + endMonth *time.Time + sortDirection *UsageSortDirection + sortName *MonthlyUsageAttributionSupportedMetrics + tagBreakdownKeys *string + nextRecordId *string + includeDescendants *bool +} + +// GetMonthlyUsageAttributionOptionalParameters holds optional parameters for GetMonthlyUsageAttribution. +type GetMonthlyUsageAttributionOptionalParameters struct { + EndMonth *time.Time + SortDirection *UsageSortDirection + SortName *MonthlyUsageAttributionSupportedMetrics + TagBreakdownKeys *string + NextRecordId *string + IncludeDescendants *bool +} + +// NewGetMonthlyUsageAttributionOptionalParameters creates an empty struct for parameters. +func NewGetMonthlyUsageAttributionOptionalParameters() *GetMonthlyUsageAttributionOptionalParameters { + this := GetMonthlyUsageAttributionOptionalParameters{} + return &this +} + +// WithEndMonth sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyUsageAttributionOptionalParameters) WithEndMonth(endMonth time.Time) *GetMonthlyUsageAttributionOptionalParameters { + r.EndMonth = &endMonth + return r +} + +// WithSortDirection sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyUsageAttributionOptionalParameters) WithSortDirection(sortDirection UsageSortDirection) *GetMonthlyUsageAttributionOptionalParameters { + r.SortDirection = &sortDirection + return r +} + +// WithSortName sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyUsageAttributionOptionalParameters) WithSortName(sortName MonthlyUsageAttributionSupportedMetrics) *GetMonthlyUsageAttributionOptionalParameters { + r.SortName = &sortName + return r +} + +// WithTagBreakdownKeys sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyUsageAttributionOptionalParameters) WithTagBreakdownKeys(tagBreakdownKeys string) *GetMonthlyUsageAttributionOptionalParameters { + r.TagBreakdownKeys = &tagBreakdownKeys + return r +} + +// WithNextRecordId sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyUsageAttributionOptionalParameters) WithNextRecordId(nextRecordId string) *GetMonthlyUsageAttributionOptionalParameters { + r.NextRecordId = &nextRecordId + return r +} + +// WithIncludeDescendants sets the corresponding parameter name and returns the struct. +func (r *GetMonthlyUsageAttributionOptionalParameters) WithIncludeDescendants(includeDescendants bool) *GetMonthlyUsageAttributionOptionalParameters { + r.IncludeDescendants = &includeDescendants + return r +} + +func (a *UsageMeteringApi) buildGetMonthlyUsageAttributionRequest(ctx _context.Context, startMonth time.Time, fields MonthlyUsageAttributionSupportedMetrics, o ...GetMonthlyUsageAttributionOptionalParameters) (apiGetMonthlyUsageAttributionRequest, error) { + req := apiGetMonthlyUsageAttributionRequest{ + ctx: ctx, + startMonth: &startMonth, + fields: &fields, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetMonthlyUsageAttributionOptionalParameters is allowed") + } + + if o != nil { + req.endMonth = o[0].EndMonth + req.sortDirection = o[0].SortDirection + req.sortName = o[0].SortName + req.tagBreakdownKeys = o[0].TagBreakdownKeys + req.nextRecordId = o[0].NextRecordId + req.includeDescendants = o[0].IncludeDescendants + } + return req, nil +} + +// GetMonthlyUsageAttribution Get monthly usage attribution. +// Get monthly usage attribution. +// +// This API endpoint is paginated. To make sure you receive all records, check if the value of `next_record_id` is +// set in the response. If it is, make another request and pass `next_record_id` as a parameter. +// Pseudo code example: +// +// ``` +// response := GetMonthlyUsageAttribution(start_month) +// cursor := response.metadata.pagination.next_record_id +// WHILE cursor != null BEGIN +// sleep(5 seconds) # Avoid running into rate limit +// response := GetMonthlyUsageAttribution(start_month, next_record_id=cursor) +// cursor := response.metadata.pagination.next_record_id +// END +// ``` +func (a *UsageMeteringApi) GetMonthlyUsageAttribution(ctx _context.Context, startMonth time.Time, fields MonthlyUsageAttributionSupportedMetrics, o ...GetMonthlyUsageAttributionOptionalParameters) (MonthlyUsageAttributionResponse, *_nethttp.Response, error) { + req, err := a.buildGetMonthlyUsageAttributionRequest(ctx, startMonth, fields, o...) + if err != nil { + var localVarReturnValue MonthlyUsageAttributionResponse + return localVarReturnValue, nil, err + } + + return a.getMonthlyUsageAttributionExecute(req) +} + +// getMonthlyUsageAttributionExecute executes the request. +func (a *UsageMeteringApi) getMonthlyUsageAttributionExecute(r apiGetMonthlyUsageAttributionRequest) (MonthlyUsageAttributionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MonthlyUsageAttributionResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetMonthlyUsageAttribution") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/monthly-attribution" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startMonth == nil { + return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") + } + if r.fields == nil { + return localVarReturnValue, nil, common.ReportError("fields is required and must be specified") + } + localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) + localVarQueryParams.Add("fields", common.ParameterToString(*r.fields, "")) + if r.endMonth != nil { + localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) + } + if r.sortDirection != nil { + localVarQueryParams.Add("sort_direction", common.ParameterToString(*r.sortDirection, "")) + } + if r.sortName != nil { + localVarQueryParams.Add("sort_name", common.ParameterToString(*r.sortName, "")) + } + if r.tagBreakdownKeys != nil { + localVarQueryParams.Add("tag_breakdown_keys", common.ParameterToString(*r.tagBreakdownKeys, "")) + } + if r.nextRecordId != nil { + localVarQueryParams.Add("next_record_id", common.ParameterToString(*r.nextRecordId, "")) + } + if r.includeDescendants != nil { + localVarQueryParams.Add("include_descendants", common.ParameterToString(*r.includeDescendants, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSpecifiedDailyCustomReportsRequest struct { + ctx _context.Context + reportId string +} + +func (a *UsageMeteringApi) buildGetSpecifiedDailyCustomReportsRequest(ctx _context.Context, reportId string) (apiGetSpecifiedDailyCustomReportsRequest, error) { + req := apiGetSpecifiedDailyCustomReportsRequest{ + ctx: ctx, + reportId: reportId, + } + return req, nil +} + +// GetSpecifiedDailyCustomReports Get specified daily custom reports. +// Get specified daily custom reports. +func (a *UsageMeteringApi) GetSpecifiedDailyCustomReports(ctx _context.Context, reportId string) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { + req, err := a.buildGetSpecifiedDailyCustomReportsRequest(ctx, reportId) + if err != nil { + var localVarReturnValue UsageSpecifiedCustomReportsResponse + return localVarReturnValue, nil, err + } + + return a.getSpecifiedDailyCustomReportsExecute(req) +} + +// getSpecifiedDailyCustomReportsExecute executes the request. +func (a *UsageMeteringApi) getSpecifiedDailyCustomReportsExecute(r apiGetSpecifiedDailyCustomReportsRequest) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSpecifiedCustomReportsResponse + ) + + operationId := "v1.GetSpecifiedDailyCustomReports" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetSpecifiedDailyCustomReports") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/daily_custom_reports/{report_id}" + localVarPath = strings.Replace(localVarPath, "{"+"report_id"+"}", _neturl.PathEscape(common.ParameterToString(r.reportId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSpecifiedMonthlyCustomReportsRequest struct { + ctx _context.Context + reportId string +} + +func (a *UsageMeteringApi) buildGetSpecifiedMonthlyCustomReportsRequest(ctx _context.Context, reportId string) (apiGetSpecifiedMonthlyCustomReportsRequest, error) { + req := apiGetSpecifiedMonthlyCustomReportsRequest{ + ctx: ctx, + reportId: reportId, + } + return req, nil +} + +// GetSpecifiedMonthlyCustomReports Get specified monthly custom reports. +// Get specified monthly custom reports. +func (a *UsageMeteringApi) GetSpecifiedMonthlyCustomReports(ctx _context.Context, reportId string) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { + req, err := a.buildGetSpecifiedMonthlyCustomReportsRequest(ctx, reportId) + if err != nil { + var localVarReturnValue UsageSpecifiedCustomReportsResponse + return localVarReturnValue, nil, err + } + + return a.getSpecifiedMonthlyCustomReportsExecute(req) +} + +// getSpecifiedMonthlyCustomReportsExecute executes the request. +func (a *UsageMeteringApi) getSpecifiedMonthlyCustomReportsExecute(r apiGetSpecifiedMonthlyCustomReportsRequest) (UsageSpecifiedCustomReportsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSpecifiedCustomReportsResponse + ) + + operationId := "v1.GetSpecifiedMonthlyCustomReports" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetSpecifiedMonthlyCustomReports") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monthly_custom_reports/{report_id}" + localVarPath = strings.Replace(localVarPath, "{"+"report_id"+"}", _neturl.PathEscape(common.ParameterToString(r.reportId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageAnalyzedLogsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageAnalyzedLogsOptionalParameters holds optional parameters for GetUsageAnalyzedLogs. +type GetUsageAnalyzedLogsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageAnalyzedLogsOptionalParameters creates an empty struct for parameters. +func NewGetUsageAnalyzedLogsOptionalParameters() *GetUsageAnalyzedLogsOptionalParameters { + this := GetUsageAnalyzedLogsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageAnalyzedLogsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageAnalyzedLogsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageAnalyzedLogsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageAnalyzedLogsOptionalParameters) (apiGetUsageAnalyzedLogsRequest, error) { + req := apiGetUsageAnalyzedLogsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageAnalyzedLogsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageAnalyzedLogs Get hourly usage for analyzed logs. +// Get hourly usage for analyzed logs (Security Monitoring). +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageAnalyzedLogs(ctx _context.Context, startHr time.Time, o ...GetUsageAnalyzedLogsOptionalParameters) (UsageAnalyzedLogsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageAnalyzedLogsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageAnalyzedLogsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageAnalyzedLogsExecute(req) +} + +// getUsageAnalyzedLogsExecute executes the request. +func (a *UsageMeteringApi) getUsageAnalyzedLogsExecute(r apiGetUsageAnalyzedLogsRequest) (UsageAnalyzedLogsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageAnalyzedLogsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageAnalyzedLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/analyzed_logs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageAttributionRequest struct { + ctx _context.Context + startMonth *time.Time + fields *UsageAttributionSupportedMetrics + endMonth *time.Time + sortDirection *UsageSortDirection + sortName *UsageAttributionSort + includeDescendants *bool + offset *int64 + limit *int64 +} + +// GetUsageAttributionOptionalParameters holds optional parameters for GetUsageAttribution. +type GetUsageAttributionOptionalParameters struct { + EndMonth *time.Time + SortDirection *UsageSortDirection + SortName *UsageAttributionSort + IncludeDescendants *bool + Offset *int64 + Limit *int64 +} + +// NewGetUsageAttributionOptionalParameters creates an empty struct for parameters. +func NewGetUsageAttributionOptionalParameters() *GetUsageAttributionOptionalParameters { + this := GetUsageAttributionOptionalParameters{} + return &this +} + +// WithEndMonth sets the corresponding parameter name and returns the struct. +func (r *GetUsageAttributionOptionalParameters) WithEndMonth(endMonth time.Time) *GetUsageAttributionOptionalParameters { + r.EndMonth = &endMonth + return r +} + +// WithSortDirection sets the corresponding parameter name and returns the struct. +func (r *GetUsageAttributionOptionalParameters) WithSortDirection(sortDirection UsageSortDirection) *GetUsageAttributionOptionalParameters { + r.SortDirection = &sortDirection + return r +} + +// WithSortName sets the corresponding parameter name and returns the struct. +func (r *GetUsageAttributionOptionalParameters) WithSortName(sortName UsageAttributionSort) *GetUsageAttributionOptionalParameters { + r.SortName = &sortName + return r +} + +// WithIncludeDescendants sets the corresponding parameter name and returns the struct. +func (r *GetUsageAttributionOptionalParameters) WithIncludeDescendants(includeDescendants bool) *GetUsageAttributionOptionalParameters { + r.IncludeDescendants = &includeDescendants + return r +} + +// WithOffset sets the corresponding parameter name and returns the struct. +func (r *GetUsageAttributionOptionalParameters) WithOffset(offset int64) *GetUsageAttributionOptionalParameters { + r.Offset = &offset + return r +} + +// WithLimit sets the corresponding parameter name and returns the struct. +func (r *GetUsageAttributionOptionalParameters) WithLimit(limit int64) *GetUsageAttributionOptionalParameters { + r.Limit = &limit + return r +} + +func (a *UsageMeteringApi) buildGetUsageAttributionRequest(ctx _context.Context, startMonth time.Time, fields UsageAttributionSupportedMetrics, o ...GetUsageAttributionOptionalParameters) (apiGetUsageAttributionRequest, error) { + req := apiGetUsageAttributionRequest{ + ctx: ctx, + startMonth: &startMonth, + fields: &fields, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageAttributionOptionalParameters is allowed") + } + + if o != nil { + req.endMonth = o[0].EndMonth + req.sortDirection = o[0].SortDirection + req.sortName = o[0].SortName + req.includeDescendants = o[0].IncludeDescendants + req.offset = o[0].Offset + req.limit = o[0].Limit + } + return req, nil +} + +// GetUsageAttribution Get usage attribution. +// Get usage attribution. +func (a *UsageMeteringApi) GetUsageAttribution(ctx _context.Context, startMonth time.Time, fields UsageAttributionSupportedMetrics, o ...GetUsageAttributionOptionalParameters) (UsageAttributionResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageAttributionRequest(ctx, startMonth, fields, o...) + if err != nil { + var localVarReturnValue UsageAttributionResponse + return localVarReturnValue, nil, err + } + + return a.getUsageAttributionExecute(req) +} + +// getUsageAttributionExecute executes the request. +func (a *UsageMeteringApi) getUsageAttributionExecute(r apiGetUsageAttributionRequest) (UsageAttributionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageAttributionResponse + ) + + operationId := "v1.GetUsageAttribution" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageAttribution") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/attribution" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startMonth == nil { + return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") + } + if r.fields == nil { + return localVarReturnValue, nil, common.ReportError("fields is required and must be specified") + } + localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) + localVarQueryParams.Add("fields", common.ParameterToString(*r.fields, "")) + if r.endMonth != nil { + localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) + } + if r.sortDirection != nil { + localVarQueryParams.Add("sort_direction", common.ParameterToString(*r.sortDirection, "")) + } + if r.sortName != nil { + localVarQueryParams.Add("sort_name", common.ParameterToString(*r.sortName, "")) + } + if r.includeDescendants != nil { + localVarQueryParams.Add("include_descendants", common.ParameterToString(*r.includeDescendants, "")) + } + if r.offset != nil { + localVarQueryParams.Add("offset", common.ParameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", common.ParameterToString(*r.limit, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageAuditLogsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageAuditLogsOptionalParameters holds optional parameters for GetUsageAuditLogs. +type GetUsageAuditLogsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageAuditLogsOptionalParameters creates an empty struct for parameters. +func NewGetUsageAuditLogsOptionalParameters() *GetUsageAuditLogsOptionalParameters { + this := GetUsageAuditLogsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageAuditLogsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageAuditLogsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageAuditLogsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageAuditLogsOptionalParameters) (apiGetUsageAuditLogsRequest, error) { + req := apiGetUsageAuditLogsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageAuditLogsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageAuditLogs Get hourly usage for audit logs. +// Get hourly usage for audit logs. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageAuditLogs(ctx _context.Context, startHr time.Time, o ...GetUsageAuditLogsOptionalParameters) (UsageAuditLogsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageAuditLogsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageAuditLogsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageAuditLogsExecute(req) +} + +// getUsageAuditLogsExecute executes the request. +func (a *UsageMeteringApi) getUsageAuditLogsExecute(r apiGetUsageAuditLogsRequest) (UsageAuditLogsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageAuditLogsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageAuditLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/audit_logs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageBillableSummaryRequest struct { + ctx _context.Context + month *time.Time +} + +// GetUsageBillableSummaryOptionalParameters holds optional parameters for GetUsageBillableSummary. +type GetUsageBillableSummaryOptionalParameters struct { + Month *time.Time +} + +// NewGetUsageBillableSummaryOptionalParameters creates an empty struct for parameters. +func NewGetUsageBillableSummaryOptionalParameters() *GetUsageBillableSummaryOptionalParameters { + this := GetUsageBillableSummaryOptionalParameters{} + return &this +} + +// WithMonth sets the corresponding parameter name and returns the struct. +func (r *GetUsageBillableSummaryOptionalParameters) WithMonth(month time.Time) *GetUsageBillableSummaryOptionalParameters { + r.Month = &month + return r +} + +func (a *UsageMeteringApi) buildGetUsageBillableSummaryRequest(ctx _context.Context, o ...GetUsageBillableSummaryOptionalParameters) (apiGetUsageBillableSummaryRequest, error) { + req := apiGetUsageBillableSummaryRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageBillableSummaryOptionalParameters is allowed") + } + + if o != nil { + req.month = o[0].Month + } + return req, nil +} + +// GetUsageBillableSummary Get billable usage across your account. +// Get billable usage across your account. +func (a *UsageMeteringApi) GetUsageBillableSummary(ctx _context.Context, o ...GetUsageBillableSummaryOptionalParameters) (UsageBillableSummaryResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageBillableSummaryRequest(ctx, o...) + if err != nil { + var localVarReturnValue UsageBillableSummaryResponse + return localVarReturnValue, nil, err + } + + return a.getUsageBillableSummaryExecute(req) +} + +// getUsageBillableSummaryExecute executes the request. +func (a *UsageMeteringApi) getUsageBillableSummaryExecute(r apiGetUsageBillableSummaryRequest) (UsageBillableSummaryResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageBillableSummaryResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageBillableSummary") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/billable-summary" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.month != nil { + localVarQueryParams.Add("month", common.ParameterToString(*r.month, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageCIAppRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageCIAppOptionalParameters holds optional parameters for GetUsageCIApp. +type GetUsageCIAppOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageCIAppOptionalParameters creates an empty struct for parameters. +func NewGetUsageCIAppOptionalParameters() *GetUsageCIAppOptionalParameters { + this := GetUsageCIAppOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageCIAppOptionalParameters) WithEndHr(endHr time.Time) *GetUsageCIAppOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageCIAppRequest(ctx _context.Context, startHr time.Time, o ...GetUsageCIAppOptionalParameters) (apiGetUsageCIAppRequest, error) { + req := apiGetUsageCIAppRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageCIAppOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageCIApp Get hourly usage for CI visibility. +// Get hourly usage for CI visibility (tests, pipeline, and spans). +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageCIApp(ctx _context.Context, startHr time.Time, o ...GetUsageCIAppOptionalParameters) (UsageCIVisibilityResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageCIAppRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageCIVisibilityResponse + return localVarReturnValue, nil, err + } + + return a.getUsageCIAppExecute(req) +} + +// getUsageCIAppExecute executes the request. +func (a *UsageMeteringApi) getUsageCIAppExecute(r apiGetUsageCIAppRequest) (UsageCIVisibilityResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageCIVisibilityResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageCIApp") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/ci-app" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageCWSRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageCWSOptionalParameters holds optional parameters for GetUsageCWS. +type GetUsageCWSOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageCWSOptionalParameters creates an empty struct for parameters. +func NewGetUsageCWSOptionalParameters() *GetUsageCWSOptionalParameters { + this := GetUsageCWSOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageCWSOptionalParameters) WithEndHr(endHr time.Time) *GetUsageCWSOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageCWSRequest(ctx _context.Context, startHr time.Time, o ...GetUsageCWSOptionalParameters) (apiGetUsageCWSRequest, error) { + req := apiGetUsageCWSRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageCWSOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageCWS Get hourly usage for cloud workload security. +// Get hourly usage for cloud workload security. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageCWS(ctx _context.Context, startHr time.Time, o ...GetUsageCWSOptionalParameters) (UsageCWSResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageCWSRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageCWSResponse + return localVarReturnValue, nil, err + } + + return a.getUsageCWSExecute(req) +} + +// getUsageCWSExecute executes the request. +func (a *UsageMeteringApi) getUsageCWSExecute(r apiGetUsageCWSRequest) (UsageCWSResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageCWSResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageCWS") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/cws" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageCloudSecurityPostureManagementRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageCloudSecurityPostureManagementOptionalParameters holds optional parameters for GetUsageCloudSecurityPostureManagement. +type GetUsageCloudSecurityPostureManagementOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageCloudSecurityPostureManagementOptionalParameters creates an empty struct for parameters. +func NewGetUsageCloudSecurityPostureManagementOptionalParameters() *GetUsageCloudSecurityPostureManagementOptionalParameters { + this := GetUsageCloudSecurityPostureManagementOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageCloudSecurityPostureManagementOptionalParameters) WithEndHr(endHr time.Time) *GetUsageCloudSecurityPostureManagementOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageCloudSecurityPostureManagementRequest(ctx _context.Context, startHr time.Time, o ...GetUsageCloudSecurityPostureManagementOptionalParameters) (apiGetUsageCloudSecurityPostureManagementRequest, error) { + req := apiGetUsageCloudSecurityPostureManagementRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageCloudSecurityPostureManagementOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageCloudSecurityPostureManagement Get hourly usage for CSPM. +// Get hourly usage for cloud security posture management (CSPM). +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageCloudSecurityPostureManagement(ctx _context.Context, startHr time.Time, o ...GetUsageCloudSecurityPostureManagementOptionalParameters) (UsageCloudSecurityPostureManagementResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageCloudSecurityPostureManagementRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageCloudSecurityPostureManagementResponse + return localVarReturnValue, nil, err + } + + return a.getUsageCloudSecurityPostureManagementExecute(req) +} + +// getUsageCloudSecurityPostureManagementExecute executes the request. +func (a *UsageMeteringApi) getUsageCloudSecurityPostureManagementExecute(r apiGetUsageCloudSecurityPostureManagementRequest) (UsageCloudSecurityPostureManagementResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageCloudSecurityPostureManagementResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageCloudSecurityPostureManagement") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/cspm" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageDBMRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageDBMOptionalParameters holds optional parameters for GetUsageDBM. +type GetUsageDBMOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageDBMOptionalParameters creates an empty struct for parameters. +func NewGetUsageDBMOptionalParameters() *GetUsageDBMOptionalParameters { + this := GetUsageDBMOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageDBMOptionalParameters) WithEndHr(endHr time.Time) *GetUsageDBMOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageDBMRequest(ctx _context.Context, startHr time.Time, o ...GetUsageDBMOptionalParameters) (apiGetUsageDBMRequest, error) { + req := apiGetUsageDBMRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageDBMOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageDBM Get hourly usage for database monitoring. +// Get hourly usage for database monitoring +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageDBM(ctx _context.Context, startHr time.Time, o ...GetUsageDBMOptionalParameters) (UsageDBMResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageDBMRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageDBMResponse + return localVarReturnValue, nil, err + } + + return a.getUsageDBMExecute(req) +} + +// getUsageDBMExecute executes the request. +func (a *UsageMeteringApi) getUsageDBMExecute(r apiGetUsageDBMRequest) (UsageDBMResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageDBMResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageDBM") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/dbm" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageFargateRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageFargateOptionalParameters holds optional parameters for GetUsageFargate. +type GetUsageFargateOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageFargateOptionalParameters creates an empty struct for parameters. +func NewGetUsageFargateOptionalParameters() *GetUsageFargateOptionalParameters { + this := GetUsageFargateOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageFargateOptionalParameters) WithEndHr(endHr time.Time) *GetUsageFargateOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageFargateRequest(ctx _context.Context, startHr time.Time, o ...GetUsageFargateOptionalParameters) (apiGetUsageFargateRequest, error) { + req := apiGetUsageFargateRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageFargateOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageFargate Get hourly usage for Fargate. +// Get hourly usage for [Fargate](https://docs.datadoghq.com/integrations/ecs_fargate/). +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageFargate(ctx _context.Context, startHr time.Time, o ...GetUsageFargateOptionalParameters) (UsageFargateResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageFargateRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageFargateResponse + return localVarReturnValue, nil, err + } + + return a.getUsageFargateExecute(req) +} + +// getUsageFargateExecute executes the request. +func (a *UsageMeteringApi) getUsageFargateExecute(r apiGetUsageFargateRequest) (UsageFargateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageFargateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageFargate") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/fargate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageHostsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageHostsOptionalParameters holds optional parameters for GetUsageHosts. +type GetUsageHostsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageHostsOptionalParameters creates an empty struct for parameters. +func NewGetUsageHostsOptionalParameters() *GetUsageHostsOptionalParameters { + this := GetUsageHostsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageHostsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageHostsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageHostsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageHostsOptionalParameters) (apiGetUsageHostsRequest, error) { + req := apiGetUsageHostsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageHostsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageHosts Get hourly usage for hosts and containers. +// Get hourly usage for hosts and containers. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageHosts(ctx _context.Context, startHr time.Time, o ...GetUsageHostsOptionalParameters) (UsageHostsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageHostsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageHostsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageHostsExecute(req) +} + +// getUsageHostsExecute executes the request. +func (a *UsageMeteringApi) getUsageHostsExecute(r apiGetUsageHostsRequest) (UsageHostsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageHostsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageHosts") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/hosts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageIndexedSpansRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageIndexedSpansOptionalParameters holds optional parameters for GetUsageIndexedSpans. +type GetUsageIndexedSpansOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageIndexedSpansOptionalParameters creates an empty struct for parameters. +func NewGetUsageIndexedSpansOptionalParameters() *GetUsageIndexedSpansOptionalParameters { + this := GetUsageIndexedSpansOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageIndexedSpansOptionalParameters) WithEndHr(endHr time.Time) *GetUsageIndexedSpansOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageIndexedSpansRequest(ctx _context.Context, startHr time.Time, o ...GetUsageIndexedSpansOptionalParameters) (apiGetUsageIndexedSpansRequest, error) { + req := apiGetUsageIndexedSpansRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageIndexedSpansOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageIndexedSpans Get hourly usage for indexed spans. +// Get hourly usage for indexed spans. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageIndexedSpans(ctx _context.Context, startHr time.Time, o ...GetUsageIndexedSpansOptionalParameters) (UsageIndexedSpansResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageIndexedSpansRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageIndexedSpansResponse + return localVarReturnValue, nil, err + } + + return a.getUsageIndexedSpansExecute(req) +} + +// getUsageIndexedSpansExecute executes the request. +func (a *UsageMeteringApi) getUsageIndexedSpansExecute(r apiGetUsageIndexedSpansRequest) (UsageIndexedSpansResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageIndexedSpansResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageIndexedSpans") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/indexed-spans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageInternetOfThingsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageInternetOfThingsOptionalParameters holds optional parameters for GetUsageInternetOfThings. +type GetUsageInternetOfThingsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageInternetOfThingsOptionalParameters creates an empty struct for parameters. +func NewGetUsageInternetOfThingsOptionalParameters() *GetUsageInternetOfThingsOptionalParameters { + this := GetUsageInternetOfThingsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageInternetOfThingsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageInternetOfThingsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageInternetOfThingsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageInternetOfThingsOptionalParameters) (apiGetUsageInternetOfThingsRequest, error) { + req := apiGetUsageInternetOfThingsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageInternetOfThingsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageInternetOfThings Get hourly usage for IoT. +// Get hourly usage for IoT. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageInternetOfThings(ctx _context.Context, startHr time.Time, o ...GetUsageInternetOfThingsOptionalParameters) (UsageIoTResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageInternetOfThingsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageIoTResponse + return localVarReturnValue, nil, err + } + + return a.getUsageInternetOfThingsExecute(req) +} + +// getUsageInternetOfThingsExecute executes the request. +func (a *UsageMeteringApi) getUsageInternetOfThingsExecute(r apiGetUsageInternetOfThingsRequest) (UsageIoTResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageIoTResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageInternetOfThings") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/iot" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageLambdaRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageLambdaOptionalParameters holds optional parameters for GetUsageLambda. +type GetUsageLambdaOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageLambdaOptionalParameters creates an empty struct for parameters. +func NewGetUsageLambdaOptionalParameters() *GetUsageLambdaOptionalParameters { + this := GetUsageLambdaOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageLambdaOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLambdaOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageLambdaRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaOptionalParameters) (apiGetUsageLambdaRequest, error) { + req := apiGetUsageLambdaRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageLambdaOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageLambda Get hourly usage for lambda. +// Get hourly usage for lambda. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageLambda(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaOptionalParameters) (UsageLambdaResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageLambdaRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageLambdaResponse + return localVarReturnValue, nil, err + } + + return a.getUsageLambdaExecute(req) +} + +// getUsageLambdaExecute executes the request. +func (a *UsageMeteringApi) getUsageLambdaExecute(r apiGetUsageLambdaRequest) (UsageLambdaResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageLambdaResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLambda") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/aws_lambda" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageLogsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageLogsOptionalParameters holds optional parameters for GetUsageLogs. +type GetUsageLogsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageLogsOptionalParameters creates an empty struct for parameters. +func NewGetUsageLogsOptionalParameters() *GetUsageLogsOptionalParameters { + this := GetUsageLogsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageLogsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLogsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageLogsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLogsOptionalParameters) (apiGetUsageLogsRequest, error) { + req := apiGetUsageLogsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageLogsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageLogs Get hourly usage for logs. +// Get hourly usage for logs. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageLogs(ctx _context.Context, startHr time.Time, o ...GetUsageLogsOptionalParameters) (UsageLogsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageLogsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageLogsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageLogsExecute(req) +} + +// getUsageLogsExecute executes the request. +func (a *UsageMeteringApi) getUsageLogsExecute(r apiGetUsageLogsRequest) (UsageLogsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageLogsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/logs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageLogsByIndexRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time + indexName *[]string +} + +// GetUsageLogsByIndexOptionalParameters holds optional parameters for GetUsageLogsByIndex. +type GetUsageLogsByIndexOptionalParameters struct { + EndHr *time.Time + IndexName *[]string +} + +// NewGetUsageLogsByIndexOptionalParameters creates an empty struct for parameters. +func NewGetUsageLogsByIndexOptionalParameters() *GetUsageLogsByIndexOptionalParameters { + this := GetUsageLogsByIndexOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageLogsByIndexOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLogsByIndexOptionalParameters { + r.EndHr = &endHr + return r +} + +// WithIndexName sets the corresponding parameter name and returns the struct. +func (r *GetUsageLogsByIndexOptionalParameters) WithIndexName(indexName []string) *GetUsageLogsByIndexOptionalParameters { + r.IndexName = &indexName + return r +} + +func (a *UsageMeteringApi) buildGetUsageLogsByIndexRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByIndexOptionalParameters) (apiGetUsageLogsByIndexRequest, error) { + req := apiGetUsageLogsByIndexRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageLogsByIndexOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + req.indexName = o[0].IndexName + } + return req, nil +} + +// GetUsageLogsByIndex Get hourly usage for logs by index. +// Get hourly usage for logs by index. +func (a *UsageMeteringApi) GetUsageLogsByIndex(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByIndexOptionalParameters) (UsageLogsByIndexResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageLogsByIndexRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageLogsByIndexResponse + return localVarReturnValue, nil, err + } + + return a.getUsageLogsByIndexExecute(req) +} + +// getUsageLogsByIndexExecute executes the request. +func (a *UsageMeteringApi) getUsageLogsByIndexExecute(r apiGetUsageLogsByIndexRequest) (UsageLogsByIndexResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageLogsByIndexResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLogsByIndex") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/logs_by_index" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + if r.indexName != nil { + t := *r.indexName + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("index_name", common.ParameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("index_name", common.ParameterToString(t, "multi")) + } + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageLogsByRetentionRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageLogsByRetentionOptionalParameters holds optional parameters for GetUsageLogsByRetention. +type GetUsageLogsByRetentionOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageLogsByRetentionOptionalParameters creates an empty struct for parameters. +func NewGetUsageLogsByRetentionOptionalParameters() *GetUsageLogsByRetentionOptionalParameters { + this := GetUsageLogsByRetentionOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageLogsByRetentionOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLogsByRetentionOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageLogsByRetentionRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByRetentionOptionalParameters) (apiGetUsageLogsByRetentionRequest, error) { + req := apiGetUsageLogsByRetentionRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageLogsByRetentionOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageLogsByRetention Get hourly logs usage by retention. +// Get hourly usage for indexed logs by retention period. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageLogsByRetention(ctx _context.Context, startHr time.Time, o ...GetUsageLogsByRetentionOptionalParameters) (UsageLogsByRetentionResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageLogsByRetentionRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageLogsByRetentionResponse + return localVarReturnValue, nil, err + } + + return a.getUsageLogsByRetentionExecute(req) +} + +// getUsageLogsByRetentionExecute executes the request. +func (a *UsageMeteringApi) getUsageLogsByRetentionExecute(r apiGetUsageLogsByRetentionRequest) (UsageLogsByRetentionResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageLogsByRetentionResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageLogsByRetention") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/logs-by-retention" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageNetworkFlowsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageNetworkFlowsOptionalParameters holds optional parameters for GetUsageNetworkFlows. +type GetUsageNetworkFlowsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageNetworkFlowsOptionalParameters creates an empty struct for parameters. +func NewGetUsageNetworkFlowsOptionalParameters() *GetUsageNetworkFlowsOptionalParameters { + this := GetUsageNetworkFlowsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageNetworkFlowsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageNetworkFlowsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageNetworkFlowsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkFlowsOptionalParameters) (apiGetUsageNetworkFlowsRequest, error) { + req := apiGetUsageNetworkFlowsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageNetworkFlowsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageNetworkFlows get hourly usage for network flows. +// Get hourly usage for network flows. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageNetworkFlows(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkFlowsOptionalParameters) (UsageNetworkFlowsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageNetworkFlowsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageNetworkFlowsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageNetworkFlowsExecute(req) +} + +// getUsageNetworkFlowsExecute executes the request. +func (a *UsageMeteringApi) getUsageNetworkFlowsExecute(r apiGetUsageNetworkFlowsRequest) (UsageNetworkFlowsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageNetworkFlowsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageNetworkFlows") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/network_flows" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageNetworkHostsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageNetworkHostsOptionalParameters holds optional parameters for GetUsageNetworkHosts. +type GetUsageNetworkHostsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageNetworkHostsOptionalParameters creates an empty struct for parameters. +func NewGetUsageNetworkHostsOptionalParameters() *GetUsageNetworkHostsOptionalParameters { + this := GetUsageNetworkHostsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageNetworkHostsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageNetworkHostsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageNetworkHostsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkHostsOptionalParameters) (apiGetUsageNetworkHostsRequest, error) { + req := apiGetUsageNetworkHostsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageNetworkHostsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageNetworkHosts Get hourly usage for network hosts. +// Get hourly usage for network hosts. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageNetworkHosts(ctx _context.Context, startHr time.Time, o ...GetUsageNetworkHostsOptionalParameters) (UsageNetworkHostsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageNetworkHostsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageNetworkHostsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageNetworkHostsExecute(req) +} + +// getUsageNetworkHostsExecute executes the request. +func (a *UsageMeteringApi) getUsageNetworkHostsExecute(r apiGetUsageNetworkHostsRequest) (UsageNetworkHostsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageNetworkHostsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageNetworkHosts") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/network_hosts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageOnlineArchiveRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageOnlineArchiveOptionalParameters holds optional parameters for GetUsageOnlineArchive. +type GetUsageOnlineArchiveOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageOnlineArchiveOptionalParameters creates an empty struct for parameters. +func NewGetUsageOnlineArchiveOptionalParameters() *GetUsageOnlineArchiveOptionalParameters { + this := GetUsageOnlineArchiveOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageOnlineArchiveOptionalParameters) WithEndHr(endHr time.Time) *GetUsageOnlineArchiveOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageOnlineArchiveRequest(ctx _context.Context, startHr time.Time, o ...GetUsageOnlineArchiveOptionalParameters) (apiGetUsageOnlineArchiveRequest, error) { + req := apiGetUsageOnlineArchiveRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageOnlineArchiveOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageOnlineArchive Get hourly usage for online archive. +// Get hourly usage for online archive. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageOnlineArchive(ctx _context.Context, startHr time.Time, o ...GetUsageOnlineArchiveOptionalParameters) (UsageOnlineArchiveResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageOnlineArchiveRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageOnlineArchiveResponse + return localVarReturnValue, nil, err + } + + return a.getUsageOnlineArchiveExecute(req) +} + +// getUsageOnlineArchiveExecute executes the request. +func (a *UsageMeteringApi) getUsageOnlineArchiveExecute(r apiGetUsageOnlineArchiveRequest) (UsageOnlineArchiveResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageOnlineArchiveResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageOnlineArchive") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/online-archive" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageProfilingRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageProfilingOptionalParameters holds optional parameters for GetUsageProfiling. +type GetUsageProfilingOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageProfilingOptionalParameters creates an empty struct for parameters. +func NewGetUsageProfilingOptionalParameters() *GetUsageProfilingOptionalParameters { + this := GetUsageProfilingOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageProfilingOptionalParameters) WithEndHr(endHr time.Time) *GetUsageProfilingOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageProfilingRequest(ctx _context.Context, startHr time.Time, o ...GetUsageProfilingOptionalParameters) (apiGetUsageProfilingRequest, error) { + req := apiGetUsageProfilingRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageProfilingOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageProfiling Get hourly usage for profiled hosts. +// Get hourly usage for profiled hosts. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageProfiling(ctx _context.Context, startHr time.Time, o ...GetUsageProfilingOptionalParameters) (UsageProfilingResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageProfilingRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageProfilingResponse + return localVarReturnValue, nil, err + } + + return a.getUsageProfilingExecute(req) +} + +// getUsageProfilingExecute executes the request. +func (a *UsageMeteringApi) getUsageProfilingExecute(r apiGetUsageProfilingRequest) (UsageProfilingResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageProfilingResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageProfiling") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/profiling" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageRumSessionsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time + typeVar *string +} + +// GetUsageRumSessionsOptionalParameters holds optional parameters for GetUsageRumSessions. +type GetUsageRumSessionsOptionalParameters struct { + EndHr *time.Time + Type *string +} + +// NewGetUsageRumSessionsOptionalParameters creates an empty struct for parameters. +func NewGetUsageRumSessionsOptionalParameters() *GetUsageRumSessionsOptionalParameters { + this := GetUsageRumSessionsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageRumSessionsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageRumSessionsOptionalParameters { + r.EndHr = &endHr + return r +} + +// WithType sets the corresponding parameter name and returns the struct. +func (r *GetUsageRumSessionsOptionalParameters) WithType(typeVar string) *GetUsageRumSessionsOptionalParameters { + r.Type = &typeVar + return r +} + +func (a *UsageMeteringApi) buildGetUsageRumSessionsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageRumSessionsOptionalParameters) (apiGetUsageRumSessionsRequest, error) { + req := apiGetUsageRumSessionsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageRumSessionsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + req.typeVar = o[0].Type + } + return req, nil +} + +// GetUsageRumSessions Get hourly usage for RUM sessions. +// Get hourly usage for [RUM](https://docs.datadoghq.com/real_user_monitoring/) Sessions. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageRumSessions(ctx _context.Context, startHr time.Time, o ...GetUsageRumSessionsOptionalParameters) (UsageRumSessionsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageRumSessionsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageRumSessionsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageRumSessionsExecute(req) +} + +// getUsageRumSessionsExecute executes the request. +func (a *UsageMeteringApi) getUsageRumSessionsExecute(r apiGetUsageRumSessionsRequest) (UsageRumSessionsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageRumSessionsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageRumSessions") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/rum_sessions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + if r.typeVar != nil { + localVarQueryParams.Add("type", common.ParameterToString(*r.typeVar, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageRumUnitsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageRumUnitsOptionalParameters holds optional parameters for GetUsageRumUnits. +type GetUsageRumUnitsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageRumUnitsOptionalParameters creates an empty struct for parameters. +func NewGetUsageRumUnitsOptionalParameters() *GetUsageRumUnitsOptionalParameters { + this := GetUsageRumUnitsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageRumUnitsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageRumUnitsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageRumUnitsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageRumUnitsOptionalParameters) (apiGetUsageRumUnitsRequest, error) { + req := apiGetUsageRumUnitsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageRumUnitsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageRumUnits Get hourly usage for RUM units. +// Get hourly usage for [RUM](https://docs.datadoghq.com/real_user_monitoring/) Units. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageRumUnits(ctx _context.Context, startHr time.Time, o ...GetUsageRumUnitsOptionalParameters) (UsageRumUnitsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageRumUnitsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageRumUnitsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageRumUnitsExecute(req) +} + +// getUsageRumUnitsExecute executes the request. +func (a *UsageMeteringApi) getUsageRumUnitsExecute(r apiGetUsageRumUnitsRequest) (UsageRumUnitsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageRumUnitsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageRumUnits") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/rum" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageSDSRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageSDSOptionalParameters holds optional parameters for GetUsageSDS. +type GetUsageSDSOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageSDSOptionalParameters creates an empty struct for parameters. +func NewGetUsageSDSOptionalParameters() *GetUsageSDSOptionalParameters { + this := GetUsageSDSOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageSDSOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSDSOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageSDSRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSDSOptionalParameters) (apiGetUsageSDSRequest, error) { + req := apiGetUsageSDSRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageSDSOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageSDS Get hourly usage for sensitive data scanner. +// Get hourly usage for sensitive data scanner. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageSDS(ctx _context.Context, startHr time.Time, o ...GetUsageSDSOptionalParameters) (UsageSDSResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageSDSRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageSDSResponse + return localVarReturnValue, nil, err + } + + return a.getUsageSDSExecute(req) +} + +// getUsageSDSExecute executes the request. +func (a *UsageMeteringApi) getUsageSDSExecute(r apiGetUsageSDSRequest) (UsageSDSResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSDSResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSDS") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/sds" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageSNMPRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageSNMPOptionalParameters holds optional parameters for GetUsageSNMP. +type GetUsageSNMPOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageSNMPOptionalParameters creates an empty struct for parameters. +func NewGetUsageSNMPOptionalParameters() *GetUsageSNMPOptionalParameters { + this := GetUsageSNMPOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageSNMPOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSNMPOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageSNMPRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSNMPOptionalParameters) (apiGetUsageSNMPRequest, error) { + req := apiGetUsageSNMPRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageSNMPOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageSNMP Get hourly usage for SNMP devices. +// Get hourly usage for SNMP devices. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageSNMP(ctx _context.Context, startHr time.Time, o ...GetUsageSNMPOptionalParameters) (UsageSNMPResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageSNMPRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageSNMPResponse + return localVarReturnValue, nil, err + } + + return a.getUsageSNMPExecute(req) +} + +// getUsageSNMPExecute executes the request. +func (a *UsageMeteringApi) getUsageSNMPExecute(r apiGetUsageSNMPRequest) (UsageSNMPResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSNMPResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSNMP") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/snmp" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageSummaryRequest struct { + ctx _context.Context + startMonth *time.Time + endMonth *time.Time + includeOrgDetails *bool +} + +// GetUsageSummaryOptionalParameters holds optional parameters for GetUsageSummary. +type GetUsageSummaryOptionalParameters struct { + EndMonth *time.Time + IncludeOrgDetails *bool +} + +// NewGetUsageSummaryOptionalParameters creates an empty struct for parameters. +func NewGetUsageSummaryOptionalParameters() *GetUsageSummaryOptionalParameters { + this := GetUsageSummaryOptionalParameters{} + return &this +} + +// WithEndMonth sets the corresponding parameter name and returns the struct. +func (r *GetUsageSummaryOptionalParameters) WithEndMonth(endMonth time.Time) *GetUsageSummaryOptionalParameters { + r.EndMonth = &endMonth + return r +} + +// WithIncludeOrgDetails sets the corresponding parameter name and returns the struct. +func (r *GetUsageSummaryOptionalParameters) WithIncludeOrgDetails(includeOrgDetails bool) *GetUsageSummaryOptionalParameters { + r.IncludeOrgDetails = &includeOrgDetails + return r +} + +func (a *UsageMeteringApi) buildGetUsageSummaryRequest(ctx _context.Context, startMonth time.Time, o ...GetUsageSummaryOptionalParameters) (apiGetUsageSummaryRequest, error) { + req := apiGetUsageSummaryRequest{ + ctx: ctx, + startMonth: &startMonth, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageSummaryOptionalParameters is allowed") + } + + if o != nil { + req.endMonth = o[0].EndMonth + req.includeOrgDetails = o[0].IncludeOrgDetails + } + return req, nil +} + +// GetUsageSummary Get usage across your multi-org account. +// Get usage across your multi-org account. You must have the multi-org feature enabled. +func (a *UsageMeteringApi) GetUsageSummary(ctx _context.Context, startMonth time.Time, o ...GetUsageSummaryOptionalParameters) (UsageSummaryResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageSummaryRequest(ctx, startMonth, o...) + if err != nil { + var localVarReturnValue UsageSummaryResponse + return localVarReturnValue, nil, err + } + + return a.getUsageSummaryExecute(req) +} + +// getUsageSummaryExecute executes the request. +func (a *UsageMeteringApi) getUsageSummaryExecute(r apiGetUsageSummaryRequest) (UsageSummaryResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSummaryResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSummary") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/summary" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startMonth == nil { + return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") + } + localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) + if r.endMonth != nil { + localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) + } + if r.includeOrgDetails != nil { + localVarQueryParams.Add("include_org_details", common.ParameterToString(*r.includeOrgDetails, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageSyntheticsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageSyntheticsOptionalParameters holds optional parameters for GetUsageSynthetics. +type GetUsageSyntheticsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageSyntheticsOptionalParameters creates an empty struct for parameters. +func NewGetUsageSyntheticsOptionalParameters() *GetUsageSyntheticsOptionalParameters { + this := GetUsageSyntheticsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageSyntheticsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSyntheticsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageSyntheticsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsOptionalParameters) (apiGetUsageSyntheticsRequest, error) { + req := apiGetUsageSyntheticsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageSyntheticsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageSynthetics Get hourly usage for synthetics checks. +// Get hourly usage for [synthetics checks](https://docs.datadoghq.com/synthetics/). +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageSynthetics(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsOptionalParameters) (UsageSyntheticsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageSyntheticsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageSyntheticsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageSyntheticsExecute(req) +} + +// getUsageSyntheticsExecute executes the request. +func (a *UsageMeteringApi) getUsageSyntheticsExecute(r apiGetUsageSyntheticsRequest) (UsageSyntheticsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSyntheticsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSynthetics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/synthetics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageSyntheticsAPIRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageSyntheticsAPIOptionalParameters holds optional parameters for GetUsageSyntheticsAPI. +type GetUsageSyntheticsAPIOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageSyntheticsAPIOptionalParameters creates an empty struct for parameters. +func NewGetUsageSyntheticsAPIOptionalParameters() *GetUsageSyntheticsAPIOptionalParameters { + this := GetUsageSyntheticsAPIOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageSyntheticsAPIOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSyntheticsAPIOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageSyntheticsAPIRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsAPIOptionalParameters) (apiGetUsageSyntheticsAPIRequest, error) { + req := apiGetUsageSyntheticsAPIRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageSyntheticsAPIOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageSyntheticsAPI Get hourly usage for synthetics API checks. +// Get hourly usage for [synthetics API checks](https://docs.datadoghq.com/synthetics/). +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageSyntheticsAPI(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsAPIOptionalParameters) (UsageSyntheticsAPIResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageSyntheticsAPIRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageSyntheticsAPIResponse + return localVarReturnValue, nil, err + } + + return a.getUsageSyntheticsAPIExecute(req) +} + +// getUsageSyntheticsAPIExecute executes the request. +func (a *UsageMeteringApi) getUsageSyntheticsAPIExecute(r apiGetUsageSyntheticsAPIRequest) (UsageSyntheticsAPIResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSyntheticsAPIResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSyntheticsAPI") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/synthetics_api" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageSyntheticsBrowserRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageSyntheticsBrowserOptionalParameters holds optional parameters for GetUsageSyntheticsBrowser. +type GetUsageSyntheticsBrowserOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageSyntheticsBrowserOptionalParameters creates an empty struct for parameters. +func NewGetUsageSyntheticsBrowserOptionalParameters() *GetUsageSyntheticsBrowserOptionalParameters { + this := GetUsageSyntheticsBrowserOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageSyntheticsBrowserOptionalParameters) WithEndHr(endHr time.Time) *GetUsageSyntheticsBrowserOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageSyntheticsBrowserRequest(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsBrowserOptionalParameters) (apiGetUsageSyntheticsBrowserRequest, error) { + req := apiGetUsageSyntheticsBrowserRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageSyntheticsBrowserOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageSyntheticsBrowser Get hourly usage for synthetics browser checks. +// Get hourly usage for synthetics browser checks. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageSyntheticsBrowser(ctx _context.Context, startHr time.Time, o ...GetUsageSyntheticsBrowserOptionalParameters) (UsageSyntheticsBrowserResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageSyntheticsBrowserRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageSyntheticsBrowserResponse + return localVarReturnValue, nil, err + } + + return a.getUsageSyntheticsBrowserExecute(req) +} + +// getUsageSyntheticsBrowserExecute executes the request. +func (a *UsageMeteringApi) getUsageSyntheticsBrowserExecute(r apiGetUsageSyntheticsBrowserRequest) (UsageSyntheticsBrowserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageSyntheticsBrowserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageSyntheticsBrowser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/synthetics_browser" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageTimeseriesRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageTimeseriesOptionalParameters holds optional parameters for GetUsageTimeseries. +type GetUsageTimeseriesOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageTimeseriesOptionalParameters creates an empty struct for parameters. +func NewGetUsageTimeseriesOptionalParameters() *GetUsageTimeseriesOptionalParameters { + this := GetUsageTimeseriesOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageTimeseriesOptionalParameters) WithEndHr(endHr time.Time) *GetUsageTimeseriesOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageTimeseriesRequest(ctx _context.Context, startHr time.Time, o ...GetUsageTimeseriesOptionalParameters) (apiGetUsageTimeseriesRequest, error) { + req := apiGetUsageTimeseriesRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageTimeseriesOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageTimeseries Get hourly usage for custom metrics. +// Get hourly usage for [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/). +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide. +func (a *UsageMeteringApi) GetUsageTimeseries(ctx _context.Context, startHr time.Time, o ...GetUsageTimeseriesOptionalParameters) (UsageTimeseriesResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageTimeseriesRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageTimeseriesResponse + return localVarReturnValue, nil, err + } + + return a.getUsageTimeseriesExecute(req) +} + +// getUsageTimeseriesExecute executes the request. +func (a *UsageMeteringApi) getUsageTimeseriesExecute(r apiGetUsageTimeseriesRequest) (UsageTimeseriesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageTimeseriesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageTimeseries") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/timeseries" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageTopAvgMetricsRequest struct { + ctx _context.Context + month *time.Time + day *time.Time + names *[]string + limit *int32 + nextRecordId *string +} + +// GetUsageTopAvgMetricsOptionalParameters holds optional parameters for GetUsageTopAvgMetrics. +type GetUsageTopAvgMetricsOptionalParameters struct { + Month *time.Time + Day *time.Time + Names *[]string + Limit *int32 + NextRecordId *string +} + +// NewGetUsageTopAvgMetricsOptionalParameters creates an empty struct for parameters. +func NewGetUsageTopAvgMetricsOptionalParameters() *GetUsageTopAvgMetricsOptionalParameters { + this := GetUsageTopAvgMetricsOptionalParameters{} + return &this +} + +// WithMonth sets the corresponding parameter name and returns the struct. +func (r *GetUsageTopAvgMetricsOptionalParameters) WithMonth(month time.Time) *GetUsageTopAvgMetricsOptionalParameters { + r.Month = &month + return r +} + +// WithDay sets the corresponding parameter name and returns the struct. +func (r *GetUsageTopAvgMetricsOptionalParameters) WithDay(day time.Time) *GetUsageTopAvgMetricsOptionalParameters { + r.Day = &day + return r +} + +// WithNames sets the corresponding parameter name and returns the struct. +func (r *GetUsageTopAvgMetricsOptionalParameters) WithNames(names []string) *GetUsageTopAvgMetricsOptionalParameters { + r.Names = &names + return r +} + +// WithLimit sets the corresponding parameter name and returns the struct. +func (r *GetUsageTopAvgMetricsOptionalParameters) WithLimit(limit int32) *GetUsageTopAvgMetricsOptionalParameters { + r.Limit = &limit + return r +} + +// WithNextRecordId sets the corresponding parameter name and returns the struct. +func (r *GetUsageTopAvgMetricsOptionalParameters) WithNextRecordId(nextRecordId string) *GetUsageTopAvgMetricsOptionalParameters { + r.NextRecordId = &nextRecordId + return r +} + +func (a *UsageMeteringApi) buildGetUsageTopAvgMetricsRequest(ctx _context.Context, o ...GetUsageTopAvgMetricsOptionalParameters) (apiGetUsageTopAvgMetricsRequest, error) { + req := apiGetUsageTopAvgMetricsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageTopAvgMetricsOptionalParameters is allowed") + } + + if o != nil { + req.month = o[0].Month + req.day = o[0].Day + req.names = o[0].Names + req.limit = o[0].Limit + req.nextRecordId = o[0].NextRecordId + } + return req, nil +} + +// GetUsageTopAvgMetrics Get all custom metrics by hourly average. +// Get all [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/) by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed. +func (a *UsageMeteringApi) GetUsageTopAvgMetrics(ctx _context.Context, o ...GetUsageTopAvgMetricsOptionalParameters) (UsageTopAvgMetricsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageTopAvgMetricsRequest(ctx, o...) + if err != nil { + var localVarReturnValue UsageTopAvgMetricsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageTopAvgMetricsExecute(req) +} + +// getUsageTopAvgMetricsExecute executes the request. +func (a *UsageMeteringApi) getUsageTopAvgMetricsExecute(r apiGetUsageTopAvgMetricsRequest) (UsageTopAvgMetricsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageTopAvgMetricsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsageMeteringApi.GetUsageTopAvgMetrics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/usage/top_avg_metrics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.month != nil { + localVarQueryParams.Add("month", common.ParameterToString(*r.month, "")) + } + if r.day != nil { + localVarQueryParams.Add("day", common.ParameterToString(*r.day, "")) + } + if r.names != nil { + t := *r.names + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("names", common.ParameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("names", common.ParameterToString(t, "multi")) + } + } + if r.limit != nil { + localVarQueryParams.Add("limit", common.ParameterToString(*r.limit, "")) + } + if r.nextRecordId != nil { + localVarQueryParams.Add("next_record_id", common.ParameterToString(*r.nextRecordId, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewUsageMeteringApi Returns NewUsageMeteringApi. +func NewUsageMeteringApi(client *common.APIClient) *UsageMeteringApi { + return &UsageMeteringApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_users.go b/api/v1/datadog/api_users.go new file mode 100644 index 00000000000..1cea2836a6b --- /dev/null +++ b/api/v1/datadog/api_users.go @@ -0,0 +1,747 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsersApi service type +type UsersApi common.Service + +type apiCreateUserRequest struct { + ctx _context.Context + body *User +} + +func (a *UsersApi) buildCreateUserRequest(ctx _context.Context, body User) (apiCreateUserRequest, error) { + req := apiCreateUserRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateUser Create a user. +// Create a user for your organization. +// +// **Note**: Users can only be created with the admin access role +// if application keys belong to administrators. +func (a *UsersApi) CreateUser(ctx _context.Context, body User) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildCreateUserRequest(ctx, body) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.createUserExecute(req) +} + +// createUserExecute executes the request. +func (a *UsersApi) createUserExecute(r apiCreateUserRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.CreateUser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDisableUserRequest struct { + ctx _context.Context + userHandle string +} + +func (a *UsersApi) buildDisableUserRequest(ctx _context.Context, userHandle string) (apiDisableUserRequest, error) { + req := apiDisableUserRequest{ + ctx: ctx, + userHandle: userHandle, + } + return req, nil +} + +// DisableUser Disable a user. +// Delete a user from an organization. +// +// **Note**: This endpoint can only be used with application keys belonging to +// administrators. +func (a *UsersApi) DisableUser(ctx _context.Context, userHandle string) (UserDisableResponse, *_nethttp.Response, error) { + req, err := a.buildDisableUserRequest(ctx, userHandle) + if err != nil { + var localVarReturnValue UserDisableResponse + return localVarReturnValue, nil, err + } + + return a.disableUserExecute(req) +} + +// disableUserExecute executes the request. +func (a *UsersApi) disableUserExecute(r apiDisableUserRequest) (UserDisableResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue UserDisableResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.DisableUser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/user/{user_handle}" + localVarPath = strings.Replace(localVarPath, "{"+"user_handle"+"}", _neturl.PathEscape(common.ParameterToString(r.userHandle, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUserRequest struct { + ctx _context.Context + userHandle string +} + +func (a *UsersApi) buildGetUserRequest(ctx _context.Context, userHandle string) (apiGetUserRequest, error) { + req := apiGetUserRequest{ + ctx: ctx, + userHandle: userHandle, + } + return req, nil +} + +// GetUser Get user details. +// Get a user's details. +func (a *UsersApi) GetUser(ctx _context.Context, userHandle string) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildGetUserRequest(ctx, userHandle) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.getUserExecute(req) +} + +// getUserExecute executes the request. +func (a *UsersApi) getUserExecute(r apiGetUserRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.GetUser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/user/{user_handle}" + localVarPath = strings.Replace(localVarPath, "{"+"user_handle"+"}", _neturl.PathEscape(common.ParameterToString(r.userHandle, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListUsersRequest struct { + ctx _context.Context +} + +func (a *UsersApi) buildListUsersRequest(ctx _context.Context) (apiListUsersRequest, error) { + req := apiListUsersRequest{ + ctx: ctx, + } + return req, nil +} + +// ListUsers List all users. +// List all users for your organization. +func (a *UsersApi) ListUsers(ctx _context.Context) (UserListResponse, *_nethttp.Response, error) { + req, err := a.buildListUsersRequest(ctx) + if err != nil { + var localVarReturnValue UserListResponse + return localVarReturnValue, nil, err + } + + return a.listUsersExecute(req) +} + +// listUsersExecute executes the request. +func (a *UsersApi) listUsersExecute(r apiListUsersRequest) (UserListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UserListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.ListUsers") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateUserRequest struct { + ctx _context.Context + userHandle string + body *User +} + +func (a *UsersApi) buildUpdateUserRequest(ctx _context.Context, userHandle string, body User) (apiUpdateUserRequest, error) { + req := apiUpdateUserRequest{ + ctx: ctx, + userHandle: userHandle, + body: &body, + } + return req, nil +} + +// UpdateUser Update a user. +// Update a user information. +// +// **Note**: It can only be used with application keys belonging to administrators. +func (a *UsersApi) UpdateUser(ctx _context.Context, userHandle string, body User) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateUserRequest(ctx, userHandle, body) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.updateUserExecute(req) +} + +// updateUserExecute executes the request. +func (a *UsersApi) updateUserExecute(r apiUpdateUserRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.UsersApi.UpdateUser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/user/{user_handle}" + localVarPath = strings.Replace(localVarPath, "{"+"user_handle"+"}", _neturl.PathEscape(common.ParameterToString(r.userHandle, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewUsersApi Returns NewUsersApi. +func NewUsersApi(client *common.APIClient) *UsersApi { + return &UsersApi{ + Client: client, + } +} diff --git a/api/v1/datadog/api_webhooks_integration.go b/api/v1/datadog/api_webhooks_integration.go new file mode 100644 index 00000000000..fc0e4a13000 --- /dev/null +++ b/api/v1/datadog/api_webhooks_integration.go @@ -0,0 +1,1165 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// WebhooksIntegrationApi service type +type WebhooksIntegrationApi common.Service + +type apiCreateWebhooksIntegrationRequest struct { + ctx _context.Context + body *WebhooksIntegration +} + +func (a *WebhooksIntegrationApi) buildCreateWebhooksIntegrationRequest(ctx _context.Context, body WebhooksIntegration) (apiCreateWebhooksIntegrationRequest, error) { + req := apiCreateWebhooksIntegrationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateWebhooksIntegration Create a webhooks integration. +// Creates an endpoint with the name ``. +func (a *WebhooksIntegrationApi) CreateWebhooksIntegration(ctx _context.Context, body WebhooksIntegration) (WebhooksIntegration, *_nethttp.Response, error) { + req, err := a.buildCreateWebhooksIntegrationRequest(ctx, body) + if err != nil { + var localVarReturnValue WebhooksIntegration + return localVarReturnValue, nil, err + } + + return a.createWebhooksIntegrationExecute(req) +} + +// createWebhooksIntegrationExecute executes the request. +func (a *WebhooksIntegrationApi) createWebhooksIntegrationExecute(r apiCreateWebhooksIntegrationRequest) (WebhooksIntegration, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue WebhooksIntegration + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.CreateWebhooksIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateWebhooksIntegrationCustomVariableRequest struct { + ctx _context.Context + body *WebhooksIntegrationCustomVariable +} + +func (a *WebhooksIntegrationApi) buildCreateWebhooksIntegrationCustomVariableRequest(ctx _context.Context, body WebhooksIntegrationCustomVariable) (apiCreateWebhooksIntegrationCustomVariableRequest, error) { + req := apiCreateWebhooksIntegrationCustomVariableRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateWebhooksIntegrationCustomVariable Create a custom variable. +// Creates an endpoint with the name ``. +func (a *WebhooksIntegrationApi) CreateWebhooksIntegrationCustomVariable(ctx _context.Context, body WebhooksIntegrationCustomVariable) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { + req, err := a.buildCreateWebhooksIntegrationCustomVariableRequest(ctx, body) + if err != nil { + var localVarReturnValue WebhooksIntegrationCustomVariableResponse + return localVarReturnValue, nil, err + } + + return a.createWebhooksIntegrationCustomVariableExecute(req) +} + +// createWebhooksIntegrationCustomVariableExecute executes the request. +func (a *WebhooksIntegrationApi) createWebhooksIntegrationCustomVariableExecute(r apiCreateWebhooksIntegrationCustomVariableRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue WebhooksIntegrationCustomVariableResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.CreateWebhooksIntegrationCustomVariable") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteWebhooksIntegrationRequest struct { + ctx _context.Context + webhookName string +} + +func (a *WebhooksIntegrationApi) buildDeleteWebhooksIntegrationRequest(ctx _context.Context, webhookName string) (apiDeleteWebhooksIntegrationRequest, error) { + req := apiDeleteWebhooksIntegrationRequest{ + ctx: ctx, + webhookName: webhookName, + } + return req, nil +} + +// DeleteWebhooksIntegration Delete a webhook. +// Deletes the endpoint with the name ``. +func (a *WebhooksIntegrationApi) DeleteWebhooksIntegration(ctx _context.Context, webhookName string) (*_nethttp.Response, error) { + req, err := a.buildDeleteWebhooksIntegrationRequest(ctx, webhookName) + if err != nil { + return nil, err + } + + return a.deleteWebhooksIntegrationExecute(req) +} + +// deleteWebhooksIntegrationExecute executes the request. +func (a *WebhooksIntegrationApi) deleteWebhooksIntegrationExecute(r apiDeleteWebhooksIntegrationRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.DeleteWebhooksIntegration") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}" + localVarPath = strings.Replace(localVarPath, "{"+"webhook_name"+"}", _neturl.PathEscape(common.ParameterToString(r.webhookName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiDeleteWebhooksIntegrationCustomVariableRequest struct { + ctx _context.Context + customVariableName string +} + +func (a *WebhooksIntegrationApi) buildDeleteWebhooksIntegrationCustomVariableRequest(ctx _context.Context, customVariableName string) (apiDeleteWebhooksIntegrationCustomVariableRequest, error) { + req := apiDeleteWebhooksIntegrationCustomVariableRequest{ + ctx: ctx, + customVariableName: customVariableName, + } + return req, nil +} + +// DeleteWebhooksIntegrationCustomVariable Delete a custom variable. +// Deletes the endpoint with the name ``. +func (a *WebhooksIntegrationApi) DeleteWebhooksIntegrationCustomVariable(ctx _context.Context, customVariableName string) (*_nethttp.Response, error) { + req, err := a.buildDeleteWebhooksIntegrationCustomVariableRequest(ctx, customVariableName) + if err != nil { + return nil, err + } + + return a.deleteWebhooksIntegrationCustomVariableExecute(req) +} + +// deleteWebhooksIntegrationCustomVariableExecute executes the request. +func (a *WebhooksIntegrationApi) deleteWebhooksIntegrationCustomVariableExecute(r apiDeleteWebhooksIntegrationCustomVariableRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.DeleteWebhooksIntegrationCustomVariable") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}" + localVarPath = strings.Replace(localVarPath, "{"+"custom_variable_name"+"}", _neturl.PathEscape(common.ParameterToString(r.customVariableName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetWebhooksIntegrationRequest struct { + ctx _context.Context + webhookName string +} + +func (a *WebhooksIntegrationApi) buildGetWebhooksIntegrationRequest(ctx _context.Context, webhookName string) (apiGetWebhooksIntegrationRequest, error) { + req := apiGetWebhooksIntegrationRequest{ + ctx: ctx, + webhookName: webhookName, + } + return req, nil +} + +// GetWebhooksIntegration Get a webhook integration. +// Gets the content of the webhook with the name ``. +func (a *WebhooksIntegrationApi) GetWebhooksIntegration(ctx _context.Context, webhookName string) (WebhooksIntegration, *_nethttp.Response, error) { + req, err := a.buildGetWebhooksIntegrationRequest(ctx, webhookName) + if err != nil { + var localVarReturnValue WebhooksIntegration + return localVarReturnValue, nil, err + } + + return a.getWebhooksIntegrationExecute(req) +} + +// getWebhooksIntegrationExecute executes the request. +func (a *WebhooksIntegrationApi) getWebhooksIntegrationExecute(r apiGetWebhooksIntegrationRequest) (WebhooksIntegration, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue WebhooksIntegration + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.GetWebhooksIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}" + localVarPath = strings.Replace(localVarPath, "{"+"webhook_name"+"}", _neturl.PathEscape(common.ParameterToString(r.webhookName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetWebhooksIntegrationCustomVariableRequest struct { + ctx _context.Context + customVariableName string +} + +func (a *WebhooksIntegrationApi) buildGetWebhooksIntegrationCustomVariableRequest(ctx _context.Context, customVariableName string) (apiGetWebhooksIntegrationCustomVariableRequest, error) { + req := apiGetWebhooksIntegrationCustomVariableRequest{ + ctx: ctx, + customVariableName: customVariableName, + } + return req, nil +} + +// GetWebhooksIntegrationCustomVariable Get a custom variable. +// Shows the content of the custom variable with the name ``. +// +// If the custom variable is secret, the value does not return in the +// response payload. +func (a *WebhooksIntegrationApi) GetWebhooksIntegrationCustomVariable(ctx _context.Context, customVariableName string) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { + req, err := a.buildGetWebhooksIntegrationCustomVariableRequest(ctx, customVariableName) + if err != nil { + var localVarReturnValue WebhooksIntegrationCustomVariableResponse + return localVarReturnValue, nil, err + } + + return a.getWebhooksIntegrationCustomVariableExecute(req) +} + +// getWebhooksIntegrationCustomVariableExecute executes the request. +func (a *WebhooksIntegrationApi) getWebhooksIntegrationCustomVariableExecute(r apiGetWebhooksIntegrationCustomVariableRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue WebhooksIntegrationCustomVariableResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.GetWebhooksIntegrationCustomVariable") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}" + localVarPath = strings.Replace(localVarPath, "{"+"custom_variable_name"+"}", _neturl.PathEscape(common.ParameterToString(r.customVariableName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateWebhooksIntegrationRequest struct { + ctx _context.Context + webhookName string + body *WebhooksIntegrationUpdateRequest +} + +func (a *WebhooksIntegrationApi) buildUpdateWebhooksIntegrationRequest(ctx _context.Context, webhookName string, body WebhooksIntegrationUpdateRequest) (apiUpdateWebhooksIntegrationRequest, error) { + req := apiUpdateWebhooksIntegrationRequest{ + ctx: ctx, + webhookName: webhookName, + body: &body, + } + return req, nil +} + +// UpdateWebhooksIntegration Update a webhook. +// Updates the endpoint with the name ``. +func (a *WebhooksIntegrationApi) UpdateWebhooksIntegration(ctx _context.Context, webhookName string, body WebhooksIntegrationUpdateRequest) (WebhooksIntegration, *_nethttp.Response, error) { + req, err := a.buildUpdateWebhooksIntegrationRequest(ctx, webhookName, body) + if err != nil { + var localVarReturnValue WebhooksIntegration + return localVarReturnValue, nil, err + } + + return a.updateWebhooksIntegrationExecute(req) +} + +// updateWebhooksIntegrationExecute executes the request. +func (a *WebhooksIntegrationApi) updateWebhooksIntegrationExecute(r apiUpdateWebhooksIntegrationRequest) (WebhooksIntegration, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue WebhooksIntegration + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.UpdateWebhooksIntegration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}" + localVarPath = strings.Replace(localVarPath, "{"+"webhook_name"+"}", _neturl.PathEscape(common.ParameterToString(r.webhookName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateWebhooksIntegrationCustomVariableRequest struct { + ctx _context.Context + customVariableName string + body *WebhooksIntegrationCustomVariableUpdateRequest +} + +func (a *WebhooksIntegrationApi) buildUpdateWebhooksIntegrationCustomVariableRequest(ctx _context.Context, customVariableName string, body WebhooksIntegrationCustomVariableUpdateRequest) (apiUpdateWebhooksIntegrationCustomVariableRequest, error) { + req := apiUpdateWebhooksIntegrationCustomVariableRequest{ + ctx: ctx, + customVariableName: customVariableName, + body: &body, + } + return req, nil +} + +// UpdateWebhooksIntegrationCustomVariable Update a custom variable. +// Updates the endpoint with the name ``. +func (a *WebhooksIntegrationApi) UpdateWebhooksIntegrationCustomVariable(ctx _context.Context, customVariableName string, body WebhooksIntegrationCustomVariableUpdateRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateWebhooksIntegrationCustomVariableRequest(ctx, customVariableName, body) + if err != nil { + var localVarReturnValue WebhooksIntegrationCustomVariableResponse + return localVarReturnValue, nil, err + } + + return a.updateWebhooksIntegrationCustomVariableExecute(req) +} + +// updateWebhooksIntegrationCustomVariableExecute executes the request. +func (a *WebhooksIntegrationApi) updateWebhooksIntegrationCustomVariableExecute(r apiUpdateWebhooksIntegrationCustomVariableRequest) (WebhooksIntegrationCustomVariableResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue WebhooksIntegrationCustomVariableResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v1.WebhooksIntegrationApi.UpdateWebhooksIntegrationCustomVariable") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}" + localVarPath = strings.Replace(localVarPath, "{"+"custom_variable_name"+"}", _neturl.PathEscape(common.ParameterToString(r.customVariableName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewWebhooksIntegrationApi Returns NewWebhooksIntegrationApi. +func NewWebhooksIntegrationApi(client *common.APIClient) *WebhooksIntegrationApi { + return &WebhooksIntegrationApi{ + Client: client, + } +} diff --git a/api/v1/datadog/model_access_role.go b/api/v1/datadog/model_access_role.go new file mode 100644 index 00000000000..4cca97c9417 --- /dev/null +++ b/api/v1/datadog/model_access_role.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AccessRole The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). +type AccessRole string + +// List of AccessRole. +const ( + ACCESSROLE_STANDARD AccessRole = "st" + ACCESSROLE_ADMIN AccessRole = "adm" + ACCESSROLE_READ_ONLY AccessRole = "ro" + ACCESSROLE_ERROR AccessRole = "ERROR" +) + +var allowedAccessRoleEnumValues = []AccessRole{ + ACCESSROLE_STANDARD, + ACCESSROLE_ADMIN, + ACCESSROLE_READ_ONLY, + ACCESSROLE_ERROR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AccessRole) GetAllowedValues() []AccessRole { + return allowedAccessRoleEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AccessRole) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AccessRole(value) + return nil +} + +// NewAccessRoleFromValue returns a pointer to a valid AccessRole +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAccessRoleFromValue(v string) (*AccessRole, error) { + ev := AccessRole(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AccessRole: valid values are %v", v, allowedAccessRoleEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AccessRole) IsValid() bool { + for _, existing := range allowedAccessRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AccessRole value. +func (v AccessRole) Ptr() *AccessRole { + return &v +} + +// NullableAccessRole handles when a null is used for AccessRole. +type NullableAccessRole struct { + value *AccessRole + isSet bool +} + +// Get returns the associated value. +func (v NullableAccessRole) Get() *AccessRole { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAccessRole) Set(val *AccessRole) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAccessRole) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAccessRole) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAccessRole initializes the struct as if Set has been called. +func NewNullableAccessRole(val *AccessRole) *NullableAccessRole { + return &NullableAccessRole{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAccessRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAccessRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_add_signal_to_incident_request.go b/api/v1/datadog/model_add_signal_to_incident_request.go new file mode 100644 index 00000000000..31e77c04d50 --- /dev/null +++ b/api/v1/datadog/model_add_signal_to_incident_request.go @@ -0,0 +1,181 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AddSignalToIncidentRequest Attributes describing which incident to add the signal to. +type AddSignalToIncidentRequest struct { + // Whether to post the signal on the incident timeline. + AddToSignalTimeline *bool `json:"add_to_signal_timeline,omitempty"` + // Public ID attribute of the incident to which the signal will be added. + IncidentId int64 `json:"incident_id"` + // Version of the updated signal. If server side version is higher, update will be rejected. + Version *int64 `json:"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{} +} + +// NewAddSignalToIncidentRequest instantiates a new AddSignalToIncidentRequest 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 NewAddSignalToIncidentRequest(incidentId int64) *AddSignalToIncidentRequest { + this := AddSignalToIncidentRequest{} + this.IncidentId = incidentId + return &this +} + +// NewAddSignalToIncidentRequestWithDefaults instantiates a new AddSignalToIncidentRequest 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 NewAddSignalToIncidentRequestWithDefaults() *AddSignalToIncidentRequest { + this := AddSignalToIncidentRequest{} + return &this +} + +// GetAddToSignalTimeline returns the AddToSignalTimeline field value if set, zero value otherwise. +func (o *AddSignalToIncidentRequest) GetAddToSignalTimeline() bool { + if o == nil || o.AddToSignalTimeline == nil { + var ret bool + return ret + } + return *o.AddToSignalTimeline +} + +// GetAddToSignalTimelineOk returns a tuple with the AddToSignalTimeline field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddSignalToIncidentRequest) GetAddToSignalTimelineOk() (*bool, bool) { + if o == nil || o.AddToSignalTimeline == nil { + return nil, false + } + return o.AddToSignalTimeline, true +} + +// HasAddToSignalTimeline returns a boolean if a field has been set. +func (o *AddSignalToIncidentRequest) HasAddToSignalTimeline() bool { + if o != nil && o.AddToSignalTimeline != nil { + return true + } + + return false +} + +// SetAddToSignalTimeline gets a reference to the given bool and assigns it to the AddToSignalTimeline field. +func (o *AddSignalToIncidentRequest) SetAddToSignalTimeline(v bool) { + o.AddToSignalTimeline = &v +} + +// GetIncidentId returns the IncidentId field value. +func (o *AddSignalToIncidentRequest) GetIncidentId() int64 { + if o == nil { + var ret int64 + return ret + } + return o.IncidentId +} + +// GetIncidentIdOk returns a tuple with the IncidentId field value +// and a boolean to check if the value has been set. +func (o *AddSignalToIncidentRequest) GetIncidentIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.IncidentId, true +} + +// SetIncidentId sets field value. +func (o *AddSignalToIncidentRequest) SetIncidentId(v int64) { + o.IncidentId = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *AddSignalToIncidentRequest) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddSignalToIncidentRequest) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *AddSignalToIncidentRequest) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *AddSignalToIncidentRequest) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AddSignalToIncidentRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AddToSignalTimeline != nil { + toSerialize["add_to_signal_timeline"] = o.AddToSignalTimeline + } + toSerialize["incident_id"] = o.IncidentId + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AddSignalToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + IncidentId *int64 `json:"incident_id"` + }{} + all := struct { + AddToSignalTimeline *bool `json:"add_to_signal_timeline,omitempty"` + IncidentId int64 `json:"incident_id"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.IncidentId == nil { + return fmt.Errorf("Required field incident_id missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AddToSignalTimeline = all.AddToSignalTimeline + o.IncidentId = all.IncidentId + o.Version = all.Version + return nil +} diff --git a/api/v1/datadog/model_alert_graph_widget_definition.go b/api/v1/datadog/model_alert_graph_widget_definition.go new file mode 100644 index 00000000000..3d8d319b2eb --- /dev/null +++ b/api/v1/datadog/model_alert_graph_widget_definition.go @@ -0,0 +1,358 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AlertGraphWidgetDefinition Alert graphs are timeseries graphs showing the current status of any monitor defined on your system. +type AlertGraphWidgetDefinition struct { + // ID of the alert to use in the widget. + AlertId string `json:"alert_id"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // The title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the alert graph widget. + Type AlertGraphWidgetDefinitionType `json:"type"` + // Whether to display the Alert Graph as a timeseries or a top list. + VizType WidgetVizType `json:"viz_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{} +} + +// NewAlertGraphWidgetDefinition instantiates a new AlertGraphWidgetDefinition 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 NewAlertGraphWidgetDefinition(alertId string, typeVar AlertGraphWidgetDefinitionType, vizType WidgetVizType) *AlertGraphWidgetDefinition { + this := AlertGraphWidgetDefinition{} + this.AlertId = alertId + this.Type = typeVar + this.VizType = vizType + return &this +} + +// NewAlertGraphWidgetDefinitionWithDefaults instantiates a new AlertGraphWidgetDefinition 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 NewAlertGraphWidgetDefinitionWithDefaults() *AlertGraphWidgetDefinition { + this := AlertGraphWidgetDefinition{} + var typeVar AlertGraphWidgetDefinitionType = ALERTGRAPHWIDGETDEFINITIONTYPE_ALERT_GRAPH + this.Type = typeVar + return &this +} + +// GetAlertId returns the AlertId field value. +func (o *AlertGraphWidgetDefinition) GetAlertId() string { + if o == nil { + var ret string + return ret + } + return o.AlertId +} + +// GetAlertIdOk returns a tuple with the AlertId field value +// and a boolean to check if the value has been set. +func (o *AlertGraphWidgetDefinition) GetAlertIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AlertId, true +} + +// SetAlertId sets field value. +func (o *AlertGraphWidgetDefinition) SetAlertId(v string) { + o.AlertId = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *AlertGraphWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertGraphWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *AlertGraphWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *AlertGraphWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *AlertGraphWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertGraphWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *AlertGraphWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *AlertGraphWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *AlertGraphWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertGraphWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *AlertGraphWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *AlertGraphWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *AlertGraphWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertGraphWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *AlertGraphWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *AlertGraphWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *AlertGraphWidgetDefinition) GetType() AlertGraphWidgetDefinitionType { + if o == nil { + var ret AlertGraphWidgetDefinitionType + 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 *AlertGraphWidgetDefinition) GetTypeOk() (*AlertGraphWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AlertGraphWidgetDefinition) SetType(v AlertGraphWidgetDefinitionType) { + o.Type = v +} + +// GetVizType returns the VizType field value. +func (o *AlertGraphWidgetDefinition) GetVizType() WidgetVizType { + if o == nil { + var ret WidgetVizType + return ret + } + return o.VizType +} + +// GetVizTypeOk returns a tuple with the VizType field value +// and a boolean to check if the value has been set. +func (o *AlertGraphWidgetDefinition) GetVizTypeOk() (*WidgetVizType, bool) { + if o == nil { + return nil, false + } + return &o.VizType, true +} + +// SetVizType sets field value. +func (o *AlertGraphWidgetDefinition) SetVizType(v WidgetVizType) { + o.VizType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AlertGraphWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["alert_id"] = o.AlertId + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + toSerialize["viz_type"] = o.VizType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + AlertId *string `json:"alert_id"` + Type *AlertGraphWidgetDefinitionType `json:"type"` + VizType *WidgetVizType `json:"viz_type"` + }{} + all := struct { + AlertId string `json:"alert_id"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type AlertGraphWidgetDefinitionType `json:"type"` + VizType WidgetVizType `json:"viz_type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.AlertId == nil { + return fmt.Errorf("Required field alert_id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + if required.VizType == nil { + return fmt.Errorf("Required field viz_type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.VizType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AlertId = all.AlertId + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + o.VizType = all.VizType + return nil +} diff --git a/api/v1/datadog/model_alert_graph_widget_definition_type.go b/api/v1/datadog/model_alert_graph_widget_definition_type.go new file mode 100644 index 00000000000..c0d56c7520a --- /dev/null +++ b/api/v1/datadog/model_alert_graph_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AlertGraphWidgetDefinitionType Type of the alert graph widget. +type AlertGraphWidgetDefinitionType string + +// List of AlertGraphWidgetDefinitionType. +const ( + ALERTGRAPHWIDGETDEFINITIONTYPE_ALERT_GRAPH AlertGraphWidgetDefinitionType = "alert_graph" +) + +var allowedAlertGraphWidgetDefinitionTypeEnumValues = []AlertGraphWidgetDefinitionType{ + ALERTGRAPHWIDGETDEFINITIONTYPE_ALERT_GRAPH, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AlertGraphWidgetDefinitionType) GetAllowedValues() []AlertGraphWidgetDefinitionType { + return allowedAlertGraphWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AlertGraphWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AlertGraphWidgetDefinitionType(value) + return nil +} + +// NewAlertGraphWidgetDefinitionTypeFromValue returns a pointer to a valid AlertGraphWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAlertGraphWidgetDefinitionTypeFromValue(v string) (*AlertGraphWidgetDefinitionType, error) { + ev := AlertGraphWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AlertGraphWidgetDefinitionType: valid values are %v", v, allowedAlertGraphWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AlertGraphWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedAlertGraphWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AlertGraphWidgetDefinitionType value. +func (v AlertGraphWidgetDefinitionType) Ptr() *AlertGraphWidgetDefinitionType { + return &v +} + +// NullableAlertGraphWidgetDefinitionType handles when a null is used for AlertGraphWidgetDefinitionType. +type NullableAlertGraphWidgetDefinitionType struct { + value *AlertGraphWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableAlertGraphWidgetDefinitionType) Get() *AlertGraphWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAlertGraphWidgetDefinitionType) Set(val *AlertGraphWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAlertGraphWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAlertGraphWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAlertGraphWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableAlertGraphWidgetDefinitionType(val *AlertGraphWidgetDefinitionType) *NullableAlertGraphWidgetDefinitionType { + return &NullableAlertGraphWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAlertGraphWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAlertGraphWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_alert_value_widget_definition.go b/api/v1/datadog/model_alert_value_widget_definition.go new file mode 100644 index 00000000000..2f183c01b27 --- /dev/null +++ b/api/v1/datadog/model_alert_value_widget_definition.go @@ -0,0 +1,396 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AlertValueWidgetDefinition Alert values are query values showing the current value of the metric in any monitor defined on your system. +type AlertValueWidgetDefinition struct { + // ID of the alert to use in the widget. + AlertId string `json:"alert_id"` + // Number of decimal to show. If not defined, will use the raw value. + Precision *int64 `json:"precision,omitempty"` + // How to align the text on the widget. + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of value in the widget. + TitleSize *string `json:"title_size,omitempty"` + // Type of the alert value widget. + Type AlertValueWidgetDefinitionType `json:"type"` + // Unit to display with the value. + Unit *string `json:"unit,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{} +} + +// NewAlertValueWidgetDefinition instantiates a new AlertValueWidgetDefinition 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 NewAlertValueWidgetDefinition(alertId string, typeVar AlertValueWidgetDefinitionType) *AlertValueWidgetDefinition { + this := AlertValueWidgetDefinition{} + this.AlertId = alertId + this.Type = typeVar + return &this +} + +// NewAlertValueWidgetDefinitionWithDefaults instantiates a new AlertValueWidgetDefinition 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 NewAlertValueWidgetDefinitionWithDefaults() *AlertValueWidgetDefinition { + this := AlertValueWidgetDefinition{} + var typeVar AlertValueWidgetDefinitionType = ALERTVALUEWIDGETDEFINITIONTYPE_ALERT_VALUE + this.Type = typeVar + return &this +} + +// GetAlertId returns the AlertId field value. +func (o *AlertValueWidgetDefinition) GetAlertId() string { + if o == nil { + var ret string + return ret + } + return o.AlertId +} + +// GetAlertIdOk returns a tuple with the AlertId field value +// and a boolean to check if the value has been set. +func (o *AlertValueWidgetDefinition) GetAlertIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AlertId, true +} + +// SetAlertId sets field value. +func (o *AlertValueWidgetDefinition) SetAlertId(v string) { + o.AlertId = v +} + +// GetPrecision returns the Precision field value if set, zero value otherwise. +func (o *AlertValueWidgetDefinition) GetPrecision() int64 { + if o == nil || o.Precision == nil { + var ret int64 + return ret + } + return *o.Precision +} + +// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertValueWidgetDefinition) GetPrecisionOk() (*int64, bool) { + if o == nil || o.Precision == nil { + return nil, false + } + return o.Precision, true +} + +// HasPrecision returns a boolean if a field has been set. +func (o *AlertValueWidgetDefinition) HasPrecision() bool { + if o != nil && o.Precision != nil { + return true + } + + return false +} + +// SetPrecision gets a reference to the given int64 and assigns it to the Precision field. +func (o *AlertValueWidgetDefinition) SetPrecision(v int64) { + o.Precision = &v +} + +// GetTextAlign returns the TextAlign field value if set, zero value otherwise. +func (o *AlertValueWidgetDefinition) GetTextAlign() WidgetTextAlign { + if o == nil || o.TextAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TextAlign +} + +// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertValueWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TextAlign == nil { + return nil, false + } + return o.TextAlign, true +} + +// HasTextAlign returns a boolean if a field has been set. +func (o *AlertValueWidgetDefinition) HasTextAlign() bool { + if o != nil && o.TextAlign != nil { + return true + } + + return false +} + +// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. +func (o *AlertValueWidgetDefinition) SetTextAlign(v WidgetTextAlign) { + o.TextAlign = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *AlertValueWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertValueWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *AlertValueWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *AlertValueWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *AlertValueWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertValueWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *AlertValueWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *AlertValueWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *AlertValueWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertValueWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *AlertValueWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *AlertValueWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *AlertValueWidgetDefinition) GetType() AlertValueWidgetDefinitionType { + if o == nil { + var ret AlertValueWidgetDefinitionType + 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 *AlertValueWidgetDefinition) GetTypeOk() (*AlertValueWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AlertValueWidgetDefinition) SetType(v AlertValueWidgetDefinitionType) { + o.Type = v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *AlertValueWidgetDefinition) GetUnit() string { + if o == nil || o.Unit == nil { + var ret string + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertValueWidgetDefinition) GetUnitOk() (*string, bool) { + if o == nil || o.Unit == nil { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *AlertValueWidgetDefinition) HasUnit() bool { + if o != nil && o.Unit != nil { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *AlertValueWidgetDefinition) SetUnit(v string) { + o.Unit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AlertValueWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["alert_id"] = o.AlertId + if o.Precision != nil { + toSerialize["precision"] = o.Precision + } + if o.TextAlign != nil { + toSerialize["text_align"] = o.TextAlign + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + if o.Unit != nil { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + AlertId *string `json:"alert_id"` + Type *AlertValueWidgetDefinitionType `json:"type"` + }{} + all := struct { + AlertId string `json:"alert_id"` + Precision *int64 `json:"precision,omitempty"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type AlertValueWidgetDefinitionType `json:"type"` + Unit *string `json:"unit,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.AlertId == nil { + return fmt.Errorf("Required field alert_id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TextAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AlertId = all.AlertId + o.Precision = all.Precision + o.TextAlign = all.TextAlign + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + o.Unit = all.Unit + return nil +} diff --git a/api/v1/datadog/model_alert_value_widget_definition_type.go b/api/v1/datadog/model_alert_value_widget_definition_type.go new file mode 100644 index 00000000000..141199b1612 --- /dev/null +++ b/api/v1/datadog/model_alert_value_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AlertValueWidgetDefinitionType Type of the alert value widget. +type AlertValueWidgetDefinitionType string + +// List of AlertValueWidgetDefinitionType. +const ( + ALERTVALUEWIDGETDEFINITIONTYPE_ALERT_VALUE AlertValueWidgetDefinitionType = "alert_value" +) + +var allowedAlertValueWidgetDefinitionTypeEnumValues = []AlertValueWidgetDefinitionType{ + ALERTVALUEWIDGETDEFINITIONTYPE_ALERT_VALUE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AlertValueWidgetDefinitionType) GetAllowedValues() []AlertValueWidgetDefinitionType { + return allowedAlertValueWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AlertValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AlertValueWidgetDefinitionType(value) + return nil +} + +// NewAlertValueWidgetDefinitionTypeFromValue returns a pointer to a valid AlertValueWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAlertValueWidgetDefinitionTypeFromValue(v string) (*AlertValueWidgetDefinitionType, error) { + ev := AlertValueWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AlertValueWidgetDefinitionType: valid values are %v", v, allowedAlertValueWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AlertValueWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedAlertValueWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AlertValueWidgetDefinitionType value. +func (v AlertValueWidgetDefinitionType) Ptr() *AlertValueWidgetDefinitionType { + return &v +} + +// NullableAlertValueWidgetDefinitionType handles when a null is used for AlertValueWidgetDefinitionType. +type NullableAlertValueWidgetDefinitionType struct { + value *AlertValueWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableAlertValueWidgetDefinitionType) Get() *AlertValueWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAlertValueWidgetDefinitionType) Set(val *AlertValueWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAlertValueWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAlertValueWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAlertValueWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableAlertValueWidgetDefinitionType(val *AlertValueWidgetDefinitionType) *NullableAlertValueWidgetDefinitionType { + return &NullableAlertValueWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAlertValueWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAlertValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_api_error_response.go b/api/v1/datadog/model_api_error_response.go new file mode 100644 index 00000000000..4c7fac22dbd --- /dev/null +++ b/api/v1/datadog/model_api_error_response.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIErrorResponse Error response object. +type APIErrorResponse struct { + // Array of errors returned by the API. + Errors []string `json:"errors"` + // 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{} +} + +// NewAPIErrorResponse instantiates a new APIErrorResponse 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 NewAPIErrorResponse(errors []string) *APIErrorResponse { + this := APIErrorResponse{} + this.Errors = errors + return &this +} + +// NewAPIErrorResponseWithDefaults instantiates a new APIErrorResponse 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 NewAPIErrorResponseWithDefaults() *APIErrorResponse { + this := APIErrorResponse{} + return &this +} + +// GetErrors returns the Errors field value. +func (o *APIErrorResponse) GetErrors() []string { + if o == nil { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value +// and a boolean to check if the value has been set. +func (o *APIErrorResponse) GetErrorsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Errors, true +} + +// SetErrors sets field value. +func (o *APIErrorResponse) SetErrors(v []string) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["errors"] = o.Errors + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Errors *[]string `json:"errors"` + }{} + all := struct { + Errors []string `json:"errors"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Errors == nil { + return fmt.Errorf("Required field errors missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Errors = all.Errors + return nil +} diff --git a/api/v1/datadog/model_api_key.go b/api/v1/datadog/model_api_key.go new file mode 100644 index 00000000000..da50a520eb8 --- /dev/null +++ b/api/v1/datadog/model_api_key.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ApiKey Datadog API key. +type ApiKey struct { + // Date of creation of the API key. + Created *string `json:"created,omitempty"` + // Datadog user handle that created the API key. + CreatedBy *string `json:"created_by,omitempty"` + // API key. + Key *string `json:"key,omitempty"` + // Name of your API key. + Name *string `json:"name,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{} +} + +// NewApiKey instantiates a new ApiKey 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 NewApiKey() *ApiKey { + this := ApiKey{} + return &this +} + +// NewApiKeyWithDefaults instantiates a new ApiKey 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 NewApiKeyWithDefaults() *ApiKey { + this := ApiKey{} + return &this +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *ApiKey) GetCreated() string { + if o == nil || o.Created == nil { + var ret string + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiKey) GetCreatedOk() (*string, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *ApiKey) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given string and assigns it to the Created field. +func (o *ApiKey) SetCreated(v string) { + o.Created = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *ApiKey) GetCreatedBy() string { + if o == nil || o.CreatedBy == nil { + var ret string + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiKey) GetCreatedByOk() (*string, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *ApiKey) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *ApiKey) SetCreatedBy(v string) { + o.CreatedBy = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *ApiKey) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiKey) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *ApiKey) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *ApiKey) SetKey(v string) { + o.Key = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ApiKey) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiKey) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ApiKey) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ApiKey) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApiKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Created != nil { + toSerialize["created"] = o.Created + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApiKey) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Created *string `json:"created,omitempty"` + CreatedBy *string `json:"created_by,omitempty"` + Key *string `json:"key,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Created = all.Created + o.CreatedBy = all.CreatedBy + o.Key = all.Key + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_api_key_list_response.go b/api/v1/datadog/model_api_key_list_response.go new file mode 100644 index 00000000000..16d9f98705c --- /dev/null +++ b/api/v1/datadog/model_api_key_list_response.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 datadog + +import ( + "encoding/json" +) + +// ApiKeyListResponse List of API and application keys available for a given organization. +type ApiKeyListResponse struct { + // Array of API keys. + ApiKeys []ApiKey `json:"api_keys,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{} +} + +// NewApiKeyListResponse instantiates a new ApiKeyListResponse 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 NewApiKeyListResponse() *ApiKeyListResponse { + this := ApiKeyListResponse{} + return &this +} + +// NewApiKeyListResponseWithDefaults instantiates a new ApiKeyListResponse 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 NewApiKeyListResponseWithDefaults() *ApiKeyListResponse { + this := ApiKeyListResponse{} + return &this +} + +// GetApiKeys returns the ApiKeys field value if set, zero value otherwise. +func (o *ApiKeyListResponse) GetApiKeys() []ApiKey { + if o == nil || o.ApiKeys == nil { + var ret []ApiKey + return ret + } + return o.ApiKeys +} + +// GetApiKeysOk returns a tuple with the ApiKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiKeyListResponse) GetApiKeysOk() (*[]ApiKey, bool) { + if o == nil || o.ApiKeys == nil { + return nil, false + } + return &o.ApiKeys, true +} + +// HasApiKeys returns a boolean if a field has been set. +func (o *ApiKeyListResponse) HasApiKeys() bool { + if o != nil && o.ApiKeys != nil { + return true + } + + return false +} + +// SetApiKeys gets a reference to the given []ApiKey and assigns it to the ApiKeys field. +func (o *ApiKeyListResponse) SetApiKeys(v []ApiKey) { + o.ApiKeys = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApiKeyListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApiKeys != nil { + toSerialize["api_keys"] = o.ApiKeys + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApiKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApiKeys []ApiKey `json:"api_keys,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ApiKeys = all.ApiKeys + return nil +} diff --git a/api/v1/datadog/model_api_key_response.go b/api/v1/datadog/model_api_key_response.go new file mode 100644 index 00000000000..a6adb164eb8 --- /dev/null +++ b/api/v1/datadog/model_api_key_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ApiKeyResponse An API key with its associated metadata. +type ApiKeyResponse struct { + // Datadog API key. + ApiKey *ApiKey `json:"api_key,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{} +} + +// NewApiKeyResponse instantiates a new ApiKeyResponse 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 NewApiKeyResponse() *ApiKeyResponse { + this := ApiKeyResponse{} + return &this +} + +// NewApiKeyResponseWithDefaults instantiates a new ApiKeyResponse 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 NewApiKeyResponseWithDefaults() *ApiKeyResponse { + this := ApiKeyResponse{} + return &this +} + +// GetApiKey returns the ApiKey field value if set, zero value otherwise. +func (o *ApiKeyResponse) GetApiKey() ApiKey { + if o == nil || o.ApiKey == nil { + var ret ApiKey + return ret + } + return *o.ApiKey +} + +// GetApiKeyOk returns a tuple with the ApiKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiKeyResponse) GetApiKeyOk() (*ApiKey, bool) { + if o == nil || o.ApiKey == nil { + return nil, false + } + return o.ApiKey, true +} + +// HasApiKey returns a boolean if a field has been set. +func (o *ApiKeyResponse) HasApiKey() bool { + if o != nil && o.ApiKey != nil { + return true + } + + return false +} + +// SetApiKey gets a reference to the given ApiKey and assigns it to the ApiKey field. +func (o *ApiKeyResponse) SetApiKey(v ApiKey) { + o.ApiKey = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApiKeyResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApiKey != nil { + toSerialize["api_key"] = o.ApiKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApiKeyResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApiKey *ApiKey `json:"api_key,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApiKey != nil && all.ApiKey.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApiKey = all.ApiKey + return nil +} diff --git a/api/v1/datadog/model_apm_stats_query_column_type.go b/api/v1/datadog/model_apm_stats_query_column_type.go new file mode 100644 index 00000000000..5a0634923af --- /dev/null +++ b/api/v1/datadog/model_apm_stats_query_column_type.go @@ -0,0 +1,236 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApmStatsQueryColumnType Column properties. +type ApmStatsQueryColumnType struct { + // A user-assigned alias for the column. + Alias *string `json:"alias,omitempty"` + // Define a display mode for the table cell. + CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` + // Column name. + Name string `json:"name"` + // Widget sorting methods. + Order *WidgetSort `json:"order,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{} +} + +// NewApmStatsQueryColumnType instantiates a new ApmStatsQueryColumnType 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 NewApmStatsQueryColumnType(name string) *ApmStatsQueryColumnType { + this := ApmStatsQueryColumnType{} + this.Name = name + return &this +} + +// NewApmStatsQueryColumnTypeWithDefaults instantiates a new ApmStatsQueryColumnType 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 NewApmStatsQueryColumnTypeWithDefaults() *ApmStatsQueryColumnType { + this := ApmStatsQueryColumnType{} + return &this +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *ApmStatsQueryColumnType) GetAlias() string { + if o == nil || o.Alias == nil { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryColumnType) GetAliasOk() (*string, bool) { + if o == nil || o.Alias == nil { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *ApmStatsQueryColumnType) HasAlias() bool { + if o != nil && o.Alias != nil { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *ApmStatsQueryColumnType) SetAlias(v string) { + o.Alias = &v +} + +// GetCellDisplayMode returns the CellDisplayMode field value if set, zero value otherwise. +func (o *ApmStatsQueryColumnType) GetCellDisplayMode() TableWidgetCellDisplayMode { + if o == nil || o.CellDisplayMode == nil { + var ret TableWidgetCellDisplayMode + return ret + } + return *o.CellDisplayMode +} + +// GetCellDisplayModeOk returns a tuple with the CellDisplayMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryColumnType) GetCellDisplayModeOk() (*TableWidgetCellDisplayMode, bool) { + if o == nil || o.CellDisplayMode == nil { + return nil, false + } + return o.CellDisplayMode, true +} + +// HasCellDisplayMode returns a boolean if a field has been set. +func (o *ApmStatsQueryColumnType) HasCellDisplayMode() bool { + if o != nil && o.CellDisplayMode != nil { + return true + } + + return false +} + +// SetCellDisplayMode gets a reference to the given TableWidgetCellDisplayMode and assigns it to the CellDisplayMode field. +func (o *ApmStatsQueryColumnType) SetCellDisplayMode(v TableWidgetCellDisplayMode) { + o.CellDisplayMode = &v +} + +// GetName returns the Name field value. +func (o *ApmStatsQueryColumnType) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryColumnType) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ApmStatsQueryColumnType) SetName(v string) { + o.Name = v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *ApmStatsQueryColumnType) GetOrder() WidgetSort { + if o == nil || o.Order == nil { + var ret WidgetSort + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryColumnType) GetOrderOk() (*WidgetSort, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *ApmStatsQueryColumnType) HasOrder() bool { + if o != nil && o.Order != nil { + return true + } + + return false +} + +// SetOrder gets a reference to the given WidgetSort and assigns it to the Order field. +func (o *ApmStatsQueryColumnType) SetOrder(v WidgetSort) { + o.Order = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApmStatsQueryColumnType) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Alias != nil { + toSerialize["alias"] = o.Alias + } + if o.CellDisplayMode != nil { + toSerialize["cell_display_mode"] = o.CellDisplayMode + } + toSerialize["name"] = o.Name + if o.Order != nil { + toSerialize["order"] = o.Order + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Alias *string `json:"alias,omitempty"` + CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` + Name string `json:"name"` + Order *WidgetSort `json:"order,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.CellDisplayMode; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Alias = all.Alias + o.CellDisplayMode = all.CellDisplayMode + o.Name = all.Name + o.Order = all.Order + return nil +} diff --git a/api/v1/datadog/model_apm_stats_query_definition.go b/api/v1/datadog/model_apm_stats_query_definition.go new file mode 100644 index 00000000000..45996bbe03d --- /dev/null +++ b/api/v1/datadog/model_apm_stats_query_definition.go @@ -0,0 +1,321 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApmStatsQueryDefinition The APM stats query for table and distributions widgets. +type ApmStatsQueryDefinition struct { + // Column properties used by the front end for display. + Columns []ApmStatsQueryColumnType `json:"columns,omitempty"` + // Environment name. + Env string `json:"env"` + // Operation name associated with service. + Name string `json:"name"` + // The organization's host group name and value. + PrimaryTag string `json:"primary_tag"` + // Resource name. + Resource *string `json:"resource,omitempty"` + // The level of detail for the request. + RowType ApmStatsQueryRowType `json:"row_type"` + // Service name. + Service string `json:"service"` + // 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{} +} + +// NewApmStatsQueryDefinition instantiates a new ApmStatsQueryDefinition 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 NewApmStatsQueryDefinition(env string, name string, primaryTag string, rowType ApmStatsQueryRowType, service string) *ApmStatsQueryDefinition { + this := ApmStatsQueryDefinition{} + this.Env = env + this.Name = name + this.PrimaryTag = primaryTag + this.RowType = rowType + this.Service = service + return &this +} + +// NewApmStatsQueryDefinitionWithDefaults instantiates a new ApmStatsQueryDefinition 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 NewApmStatsQueryDefinitionWithDefaults() *ApmStatsQueryDefinition { + this := ApmStatsQueryDefinition{} + return &this +} + +// GetColumns returns the Columns field value if set, zero value otherwise. +func (o *ApmStatsQueryDefinition) GetColumns() []ApmStatsQueryColumnType { + if o == nil || o.Columns == nil { + var ret []ApmStatsQueryColumnType + return ret + } + return o.Columns +} + +// GetColumnsOk returns a tuple with the Columns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryDefinition) GetColumnsOk() (*[]ApmStatsQueryColumnType, bool) { + if o == nil || o.Columns == nil { + return nil, false + } + return &o.Columns, true +} + +// HasColumns returns a boolean if a field has been set. +func (o *ApmStatsQueryDefinition) HasColumns() bool { + if o != nil && o.Columns != nil { + return true + } + + return false +} + +// SetColumns gets a reference to the given []ApmStatsQueryColumnType and assigns it to the Columns field. +func (o *ApmStatsQueryDefinition) SetColumns(v []ApmStatsQueryColumnType) { + o.Columns = v +} + +// GetEnv returns the Env field value. +func (o *ApmStatsQueryDefinition) GetEnv() string { + if o == nil { + var ret string + return ret + } + return o.Env +} + +// GetEnvOk returns a tuple with the Env field value +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryDefinition) GetEnvOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Env, true +} + +// SetEnv sets field value. +func (o *ApmStatsQueryDefinition) SetEnv(v string) { + o.Env = v +} + +// GetName returns the Name field value. +func (o *ApmStatsQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ApmStatsQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetPrimaryTag returns the PrimaryTag field value. +func (o *ApmStatsQueryDefinition) GetPrimaryTag() string { + if o == nil { + var ret string + return ret + } + return o.PrimaryTag +} + +// GetPrimaryTagOk returns a tuple with the PrimaryTag field value +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryDefinition) GetPrimaryTagOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PrimaryTag, true +} + +// SetPrimaryTag sets field value. +func (o *ApmStatsQueryDefinition) SetPrimaryTag(v string) { + o.PrimaryTag = v +} + +// GetResource returns the Resource field value if set, zero value otherwise. +func (o *ApmStatsQueryDefinition) GetResource() string { + if o == nil || o.Resource == nil { + var ret string + return ret + } + return *o.Resource +} + +// GetResourceOk returns a tuple with the Resource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryDefinition) GetResourceOk() (*string, bool) { + if o == nil || o.Resource == nil { + return nil, false + } + return o.Resource, true +} + +// HasResource returns a boolean if a field has been set. +func (o *ApmStatsQueryDefinition) HasResource() bool { + if o != nil && o.Resource != nil { + return true + } + + return false +} + +// SetResource gets a reference to the given string and assigns it to the Resource field. +func (o *ApmStatsQueryDefinition) SetResource(v string) { + o.Resource = &v +} + +// GetRowType returns the RowType field value. +func (o *ApmStatsQueryDefinition) GetRowType() ApmStatsQueryRowType { + if o == nil { + var ret ApmStatsQueryRowType + return ret + } + return o.RowType +} + +// GetRowTypeOk returns a tuple with the RowType field value +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryDefinition) GetRowTypeOk() (*ApmStatsQueryRowType, bool) { + if o == nil { + return nil, false + } + return &o.RowType, true +} + +// SetRowType sets field value. +func (o *ApmStatsQueryDefinition) SetRowType(v ApmStatsQueryRowType) { + o.RowType = v +} + +// GetService returns the Service field value. +func (o *ApmStatsQueryDefinition) GetService() string { + if o == nil { + var ret string + return ret + } + return o.Service +} + +// GetServiceOk returns a tuple with the Service field value +// and a boolean to check if the value has been set. +func (o *ApmStatsQueryDefinition) GetServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Service, true +} + +// SetService sets field value. +func (o *ApmStatsQueryDefinition) SetService(v string) { + o.Service = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApmStatsQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Columns != nil { + toSerialize["columns"] = o.Columns + } + toSerialize["env"] = o.Env + toSerialize["name"] = o.Name + toSerialize["primary_tag"] = o.PrimaryTag + if o.Resource != nil { + toSerialize["resource"] = o.Resource + } + toSerialize["row_type"] = o.RowType + toSerialize["service"] = o.Service + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApmStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Env *string `json:"env"` + Name *string `json:"name"` + PrimaryTag *string `json:"primary_tag"` + RowType *ApmStatsQueryRowType `json:"row_type"` + Service *string `json:"service"` + }{} + all := struct { + Columns []ApmStatsQueryColumnType `json:"columns,omitempty"` + Env string `json:"env"` + Name string `json:"name"` + PrimaryTag string `json:"primary_tag"` + Resource *string `json:"resource,omitempty"` + RowType ApmStatsQueryRowType `json:"row_type"` + Service string `json:"service"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Env == nil { + return fmt.Errorf("Required field env missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.PrimaryTag == nil { + return fmt.Errorf("Required field primary_tag missing") + } + if required.RowType == nil { + return fmt.Errorf("Required field row_type missing") + } + if required.Service == nil { + return fmt.Errorf("Required field service missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.RowType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Columns = all.Columns + o.Env = all.Env + o.Name = all.Name + o.PrimaryTag = all.PrimaryTag + o.Resource = all.Resource + o.RowType = all.RowType + o.Service = all.Service + return nil +} diff --git a/api/v1/datadog/model_apm_stats_query_row_type.go b/api/v1/datadog/model_apm_stats_query_row_type.go new file mode 100644 index 00000000000..b94bce937b0 --- /dev/null +++ b/api/v1/datadog/model_apm_stats_query_row_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApmStatsQueryRowType The level of detail for the request. +type ApmStatsQueryRowType string + +// List of ApmStatsQueryRowType. +const ( + APMSTATSQUERYROWTYPE_SERVICE ApmStatsQueryRowType = "service" + APMSTATSQUERYROWTYPE_RESOURCE ApmStatsQueryRowType = "resource" + APMSTATSQUERYROWTYPE_SPAN ApmStatsQueryRowType = "span" +) + +var allowedApmStatsQueryRowTypeEnumValues = []ApmStatsQueryRowType{ + APMSTATSQUERYROWTYPE_SERVICE, + APMSTATSQUERYROWTYPE_RESOURCE, + APMSTATSQUERYROWTYPE_SPAN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ApmStatsQueryRowType) GetAllowedValues() []ApmStatsQueryRowType { + return allowedApmStatsQueryRowTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ApmStatsQueryRowType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ApmStatsQueryRowType(value) + return nil +} + +// NewApmStatsQueryRowTypeFromValue returns a pointer to a valid ApmStatsQueryRowType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewApmStatsQueryRowTypeFromValue(v string) (*ApmStatsQueryRowType, error) { + ev := ApmStatsQueryRowType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ApmStatsQueryRowType: valid values are %v", v, allowedApmStatsQueryRowTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ApmStatsQueryRowType) IsValid() bool { + for _, existing := range allowedApmStatsQueryRowTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ApmStatsQueryRowType value. +func (v ApmStatsQueryRowType) Ptr() *ApmStatsQueryRowType { + return &v +} + +// NullableApmStatsQueryRowType handles when a null is used for ApmStatsQueryRowType. +type NullableApmStatsQueryRowType struct { + value *ApmStatsQueryRowType + isSet bool +} + +// Get returns the associated value. +func (v NullableApmStatsQueryRowType) Get() *ApmStatsQueryRowType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableApmStatsQueryRowType) Set(val *ApmStatsQueryRowType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableApmStatsQueryRowType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableApmStatsQueryRowType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableApmStatsQueryRowType initializes the struct as if Set has been called. +func NewNullableApmStatsQueryRowType(val *ApmStatsQueryRowType) *NullableApmStatsQueryRowType { + return &NullableApmStatsQueryRowType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableApmStatsQueryRowType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableApmStatsQueryRowType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_application_key.go b/api/v1/datadog/model_application_key.go new file mode 100644 index 00000000000..56c8219b90a --- /dev/null +++ b/api/v1/datadog/model_application_key.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ApplicationKey An application key with its associated metadata. +type ApplicationKey struct { + // Hash of an application key. + Hash *string `json:"hash,omitempty"` + // Name of an application key. + Name *string `json:"name,omitempty"` + // Owner of an application key. + Owner *string `json:"owner,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{} +} + +// NewApplicationKey instantiates a new ApplicationKey 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 NewApplicationKey() *ApplicationKey { + this := ApplicationKey{} + return &this +} + +// NewApplicationKeyWithDefaults instantiates a new ApplicationKey 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 NewApplicationKeyWithDefaults() *ApplicationKey { + this := ApplicationKey{} + return &this +} + +// GetHash returns the Hash field value if set, zero value otherwise. +func (o *ApplicationKey) GetHash() string { + if o == nil || o.Hash == nil { + var ret string + return ret + } + return *o.Hash +} + +// GetHashOk returns a tuple with the Hash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKey) GetHashOk() (*string, bool) { + if o == nil || o.Hash == nil { + return nil, false + } + return o.Hash, true +} + +// HasHash returns a boolean if a field has been set. +func (o *ApplicationKey) HasHash() bool { + if o != nil && o.Hash != nil { + return true + } + + return false +} + +// SetHash gets a reference to the given string and assigns it to the Hash field. +func (o *ApplicationKey) SetHash(v string) { + o.Hash = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ApplicationKey) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKey) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ApplicationKey) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ApplicationKey) SetName(v string) { + o.Name = &v +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *ApplicationKey) GetOwner() string { + if o == nil || o.Owner == nil { + var ret string + return ret + } + return *o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKey) GetOwnerOk() (*string, bool) { + if o == nil || o.Owner == nil { + return nil, false + } + return o.Owner, true +} + +// HasOwner returns a boolean if a field has been set. +func (o *ApplicationKey) HasOwner() bool { + if o != nil && o.Owner != nil { + return true + } + + return false +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *ApplicationKey) SetOwner(v string) { + o.Owner = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hash != nil { + toSerialize["hash"] = o.Hash + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Owner != nil { + toSerialize["owner"] = o.Owner + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKey) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hash *string `json:"hash,omitempty"` + Name *string `json:"name,omitempty"` + Owner *string `json:"owner,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hash = all.Hash + o.Name = all.Name + o.Owner = all.Owner + return nil +} diff --git a/api/v1/datadog/model_application_key_list_response.go b/api/v1/datadog/model_application_key_list_response.go new file mode 100644 index 00000000000..66a9776c13f --- /dev/null +++ b/api/v1/datadog/model_application_key_list_response.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 datadog + +import ( + "encoding/json" +) + +// ApplicationKeyListResponse An application key response. +type ApplicationKeyListResponse struct { + // Array of application keys. + ApplicationKeys []ApplicationKey `json:"application_keys,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{} +} + +// NewApplicationKeyListResponse instantiates a new ApplicationKeyListResponse 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 NewApplicationKeyListResponse() *ApplicationKeyListResponse { + this := ApplicationKeyListResponse{} + return &this +} + +// NewApplicationKeyListResponseWithDefaults instantiates a new ApplicationKeyListResponse 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 NewApplicationKeyListResponseWithDefaults() *ApplicationKeyListResponse { + this := ApplicationKeyListResponse{} + return &this +} + +// GetApplicationKeys returns the ApplicationKeys field value if set, zero value otherwise. +func (o *ApplicationKeyListResponse) GetApplicationKeys() []ApplicationKey { + if o == nil || o.ApplicationKeys == nil { + var ret []ApplicationKey + return ret + } + return o.ApplicationKeys +} + +// GetApplicationKeysOk returns a tuple with the ApplicationKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKeyListResponse) GetApplicationKeysOk() (*[]ApplicationKey, bool) { + if o == nil || o.ApplicationKeys == nil { + return nil, false + } + return &o.ApplicationKeys, true +} + +// HasApplicationKeys returns a boolean if a field has been set. +func (o *ApplicationKeyListResponse) HasApplicationKeys() bool { + if o != nil && o.ApplicationKeys != nil { + return true + } + + return false +} + +// SetApplicationKeys gets a reference to the given []ApplicationKey and assigns it to the ApplicationKeys field. +func (o *ApplicationKeyListResponse) SetApplicationKeys(v []ApplicationKey) { + o.ApplicationKeys = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApplicationKeys != nil { + toSerialize["application_keys"] = o.ApplicationKeys + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApplicationKeys []ApplicationKey `json:"application_keys,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ApplicationKeys = all.ApplicationKeys + return nil +} diff --git a/api/v1/datadog/model_application_key_response.go b/api/v1/datadog/model_application_key_response.go new file mode 100644 index 00000000000..75fcb54a465 --- /dev/null +++ b/api/v1/datadog/model_application_key_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ApplicationKeyResponse An application key response. +type ApplicationKeyResponse struct { + // An application key with its associated metadata. + ApplicationKey *ApplicationKey `json:"application_key,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{} +} + +// NewApplicationKeyResponse instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponse() *ApplicationKeyResponse { + this := ApplicationKeyResponse{} + return &this +} + +// NewApplicationKeyResponseWithDefaults instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponseWithDefaults() *ApplicationKeyResponse { + this := ApplicationKeyResponse{} + return &this +} + +// GetApplicationKey returns the ApplicationKey field value if set, zero value otherwise. +func (o *ApplicationKeyResponse) GetApplicationKey() ApplicationKey { + if o == nil || o.ApplicationKey == nil { + var ret ApplicationKey + return ret + } + return *o.ApplicationKey +} + +// GetApplicationKeyOk returns a tuple with the ApplicationKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKeyResponse) GetApplicationKeyOk() (*ApplicationKey, bool) { + if o == nil || o.ApplicationKey == nil { + return nil, false + } + return o.ApplicationKey, true +} + +// HasApplicationKey returns a boolean if a field has been set. +func (o *ApplicationKeyResponse) HasApplicationKey() bool { + if o != nil && o.ApplicationKey != nil { + return true + } + + return false +} + +// SetApplicationKey gets a reference to the given ApplicationKey and assigns it to the ApplicationKey field. +func (o *ApplicationKeyResponse) SetApplicationKey(v ApplicationKey) { + o.ApplicationKey = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApplicationKey != nil { + toSerialize["application_key"] = o.ApplicationKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApplicationKey *ApplicationKey `json:"application_key,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApplicationKey != nil && all.ApplicationKey.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApplicationKey = all.ApplicationKey + return nil +} diff --git a/api/v1/datadog/model_authentication_validation_response.go b/api/v1/datadog/model_authentication_validation_response.go new file mode 100644 index 00000000000..0a46542f31a --- /dev/null +++ b/api/v1/datadog/model_authentication_validation_response.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 datadog + +import ( + "encoding/json" +) + +// AuthenticationValidationResponse Represent validation endpoint responses. +type AuthenticationValidationResponse struct { + // Return `true` if the authentication response is valid. + Valid *bool `json:"valid,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{} +} + +// NewAuthenticationValidationResponse instantiates a new AuthenticationValidationResponse 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 NewAuthenticationValidationResponse() *AuthenticationValidationResponse { + this := AuthenticationValidationResponse{} + return &this +} + +// NewAuthenticationValidationResponseWithDefaults instantiates a new AuthenticationValidationResponse 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 NewAuthenticationValidationResponseWithDefaults() *AuthenticationValidationResponse { + this := AuthenticationValidationResponse{} + return &this +} + +// GetValid returns the Valid field value if set, zero value otherwise. +func (o *AuthenticationValidationResponse) GetValid() bool { + if o == nil || o.Valid == nil { + var ret bool + return ret + } + return *o.Valid +} + +// GetValidOk returns a tuple with the Valid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthenticationValidationResponse) GetValidOk() (*bool, bool) { + if o == nil || o.Valid == nil { + return nil, false + } + return o.Valid, true +} + +// HasValid returns a boolean if a field has been set. +func (o *AuthenticationValidationResponse) HasValid() bool { + if o != nil && o.Valid != nil { + return true + } + + return false +} + +// SetValid gets a reference to the given bool and assigns it to the Valid field. +func (o *AuthenticationValidationResponse) SetValid(v bool) { + o.Valid = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthenticationValidationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Valid != nil { + toSerialize["valid"] = o.Valid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthenticationValidationResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Valid *bool `json:"valid,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Valid = all.Valid + return nil +} diff --git a/api/v1/datadog/model_aws_account.go b/api/v1/datadog/model_aws_account.go new file mode 100644 index 00000000000..86154f541ee --- /dev/null +++ b/api/v1/datadog/model_aws_account.go @@ -0,0 +1,512 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSAccount Returns the AWS account associated with this integration. +type AWSAccount struct { + // Your AWS access key ID. Only required if your AWS account is a GovCloud or China account. + AccessKeyId *string `json:"access_key_id,omitempty"` + // Your AWS Account ID without dashes. + AccountId *string `json:"account_id,omitempty"` + // An object, (in the form `{"namespace1":true/false, "namespace2":true/false}`), + // that enables or disables metric collection for specific AWS namespaces for this + // AWS account only. + AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"` + // Whether Datadog collects cloud security posture management resources from your AWS account. This includes additional resources not covered under the general `resource_collection`. + CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"` + // An array of AWS regions to exclude from metrics collection. + ExcludedRegions []string `json:"excluded_regions,omitempty"` + // The array of EC2 tags (in the form `key:value`) defines a filter that Datadog uses when collecting metrics from EC2. + // Wildcards, such as `?` (for single characters) and `*` (for multiple characters) can also be used. + // Only hosts that match one of the defined tags + // will be imported into Datadog. The rest will be ignored. + // Host matching a given tag can also be excluded by adding `!` before the tag. + // For example, `env:production,instance-type:c1.*,!region:us-east-1` + FilterTags []string `json:"filter_tags,omitempty"` + // Array of tags (in the form `key:value`) to add to all hosts + // and metrics reporting through this integration. + HostTags []string `json:"host_tags,omitempty"` + // Whether Datadog collects metrics for this AWS account. + MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"` + // Whether Datadog collects a standard set of resources from your AWS account. + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + // Your Datadog role delegation name. + RoleName *string `json:"role_name,omitempty"` + // Your AWS secret access key. Only required if your AWS account is a GovCloud or China account. + SecretAccessKey *string `json:"secret_access_key,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{} +} + +// NewAWSAccount instantiates a new AWSAccount 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 NewAWSAccount() *AWSAccount { + this := AWSAccount{} + var cspmResourceCollectionEnabled bool = false + this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled + var metricsCollectionEnabled bool = true + this.MetricsCollectionEnabled = &metricsCollectionEnabled + var resourceCollectionEnabled bool = false + this.ResourceCollectionEnabled = &resourceCollectionEnabled + return &this +} + +// NewAWSAccountWithDefaults instantiates a new AWSAccount 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 NewAWSAccountWithDefaults() *AWSAccount { + this := AWSAccount{} + var cspmResourceCollectionEnabled bool = false + this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled + var metricsCollectionEnabled bool = true + this.MetricsCollectionEnabled = &metricsCollectionEnabled + var resourceCollectionEnabled bool = false + this.ResourceCollectionEnabled = &resourceCollectionEnabled + return &this +} + +// GetAccessKeyId returns the AccessKeyId field value if set, zero value otherwise. +func (o *AWSAccount) GetAccessKeyId() string { + if o == nil || o.AccessKeyId == nil { + var ret string + return ret + } + return *o.AccessKeyId +} + +// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetAccessKeyIdOk() (*string, bool) { + if o == nil || o.AccessKeyId == nil { + return nil, false + } + return o.AccessKeyId, true +} + +// HasAccessKeyId returns a boolean if a field has been set. +func (o *AWSAccount) HasAccessKeyId() bool { + if o != nil && o.AccessKeyId != nil { + return true + } + + return false +} + +// SetAccessKeyId gets a reference to the given string and assigns it to the AccessKeyId field. +func (o *AWSAccount) SetAccessKeyId(v string) { + o.AccessKeyId = &v +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *AWSAccount) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *AWSAccount) HasAccountId() bool { + if o != nil && o.AccountId != nil { + return true + } + + return false +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *AWSAccount) SetAccountId(v string) { + o.AccountId = &v +} + +// GetAccountSpecificNamespaceRules returns the AccountSpecificNamespaceRules field value if set, zero value otherwise. +func (o *AWSAccount) GetAccountSpecificNamespaceRules() map[string]bool { + if o == nil || o.AccountSpecificNamespaceRules == nil { + var ret map[string]bool + return ret + } + return o.AccountSpecificNamespaceRules +} + +// GetAccountSpecificNamespaceRulesOk returns a tuple with the AccountSpecificNamespaceRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetAccountSpecificNamespaceRulesOk() (*map[string]bool, bool) { + if o == nil || o.AccountSpecificNamespaceRules == nil { + return nil, false + } + return &o.AccountSpecificNamespaceRules, true +} + +// HasAccountSpecificNamespaceRules returns a boolean if a field has been set. +func (o *AWSAccount) HasAccountSpecificNamespaceRules() bool { + if o != nil && o.AccountSpecificNamespaceRules != nil { + return true + } + + return false +} + +// SetAccountSpecificNamespaceRules gets a reference to the given map[string]bool and assigns it to the AccountSpecificNamespaceRules field. +func (o *AWSAccount) SetAccountSpecificNamespaceRules(v map[string]bool) { + o.AccountSpecificNamespaceRules = v +} + +// GetCspmResourceCollectionEnabled returns the CspmResourceCollectionEnabled field value if set, zero value otherwise. +func (o *AWSAccount) GetCspmResourceCollectionEnabled() bool { + if o == nil || o.CspmResourceCollectionEnabled == nil { + var ret bool + return ret + } + return *o.CspmResourceCollectionEnabled +} + +// GetCspmResourceCollectionEnabledOk returns a tuple with the CspmResourceCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetCspmResourceCollectionEnabledOk() (*bool, bool) { + if o == nil || o.CspmResourceCollectionEnabled == nil { + return nil, false + } + return o.CspmResourceCollectionEnabled, true +} + +// HasCspmResourceCollectionEnabled returns a boolean if a field has been set. +func (o *AWSAccount) HasCspmResourceCollectionEnabled() bool { + if o != nil && o.CspmResourceCollectionEnabled != nil { + return true + } + + return false +} + +// SetCspmResourceCollectionEnabled gets a reference to the given bool and assigns it to the CspmResourceCollectionEnabled field. +func (o *AWSAccount) SetCspmResourceCollectionEnabled(v bool) { + o.CspmResourceCollectionEnabled = &v +} + +// GetExcludedRegions returns the ExcludedRegions field value if set, zero value otherwise. +func (o *AWSAccount) GetExcludedRegions() []string { + if o == nil || o.ExcludedRegions == nil { + var ret []string + return ret + } + return o.ExcludedRegions +} + +// GetExcludedRegionsOk returns a tuple with the ExcludedRegions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetExcludedRegionsOk() (*[]string, bool) { + if o == nil || o.ExcludedRegions == nil { + return nil, false + } + return &o.ExcludedRegions, true +} + +// HasExcludedRegions returns a boolean if a field has been set. +func (o *AWSAccount) HasExcludedRegions() bool { + if o != nil && o.ExcludedRegions != nil { + return true + } + + return false +} + +// SetExcludedRegions gets a reference to the given []string and assigns it to the ExcludedRegions field. +func (o *AWSAccount) SetExcludedRegions(v []string) { + o.ExcludedRegions = v +} + +// GetFilterTags returns the FilterTags field value if set, zero value otherwise. +func (o *AWSAccount) GetFilterTags() []string { + if o == nil || o.FilterTags == nil { + var ret []string + return ret + } + return o.FilterTags +} + +// GetFilterTagsOk returns a tuple with the FilterTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetFilterTagsOk() (*[]string, bool) { + if o == nil || o.FilterTags == nil { + return nil, false + } + return &o.FilterTags, true +} + +// HasFilterTags returns a boolean if a field has been set. +func (o *AWSAccount) HasFilterTags() bool { + if o != nil && o.FilterTags != nil { + return true + } + + return false +} + +// SetFilterTags gets a reference to the given []string and assigns it to the FilterTags field. +func (o *AWSAccount) SetFilterTags(v []string) { + o.FilterTags = v +} + +// GetHostTags returns the HostTags field value if set, zero value otherwise. +func (o *AWSAccount) GetHostTags() []string { + if o == nil || o.HostTags == nil { + var ret []string + return ret + } + return o.HostTags +} + +// GetHostTagsOk returns a tuple with the HostTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetHostTagsOk() (*[]string, bool) { + if o == nil || o.HostTags == nil { + return nil, false + } + return &o.HostTags, true +} + +// HasHostTags returns a boolean if a field has been set. +func (o *AWSAccount) HasHostTags() bool { + if o != nil && o.HostTags != nil { + return true + } + + return false +} + +// SetHostTags gets a reference to the given []string and assigns it to the HostTags field. +func (o *AWSAccount) SetHostTags(v []string) { + o.HostTags = v +} + +// GetMetricsCollectionEnabled returns the MetricsCollectionEnabled field value if set, zero value otherwise. +func (o *AWSAccount) GetMetricsCollectionEnabled() bool { + if o == nil || o.MetricsCollectionEnabled == nil { + var ret bool + return ret + } + return *o.MetricsCollectionEnabled +} + +// GetMetricsCollectionEnabledOk returns a tuple with the MetricsCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetMetricsCollectionEnabledOk() (*bool, bool) { + if o == nil || o.MetricsCollectionEnabled == nil { + return nil, false + } + return o.MetricsCollectionEnabled, true +} + +// HasMetricsCollectionEnabled returns a boolean if a field has been set. +func (o *AWSAccount) HasMetricsCollectionEnabled() bool { + if o != nil && o.MetricsCollectionEnabled != nil { + return true + } + + return false +} + +// SetMetricsCollectionEnabled gets a reference to the given bool and assigns it to the MetricsCollectionEnabled field. +func (o *AWSAccount) SetMetricsCollectionEnabled(v bool) { + o.MetricsCollectionEnabled = &v +} + +// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise. +func (o *AWSAccount) GetResourceCollectionEnabled() bool { + if o == nil || o.ResourceCollectionEnabled == nil { + var ret bool + return ret + } + return *o.ResourceCollectionEnabled +} + +// GetResourceCollectionEnabledOk returns a tuple with the ResourceCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetResourceCollectionEnabledOk() (*bool, bool) { + if o == nil || o.ResourceCollectionEnabled == nil { + return nil, false + } + return o.ResourceCollectionEnabled, true +} + +// HasResourceCollectionEnabled returns a boolean if a field has been set. +func (o *AWSAccount) HasResourceCollectionEnabled() bool { + if o != nil && o.ResourceCollectionEnabled != nil { + return true + } + + return false +} + +// SetResourceCollectionEnabled gets a reference to the given bool and assigns it to the ResourceCollectionEnabled field. +func (o *AWSAccount) SetResourceCollectionEnabled(v bool) { + o.ResourceCollectionEnabled = &v +} + +// GetRoleName returns the RoleName field value if set, zero value otherwise. +func (o *AWSAccount) GetRoleName() string { + if o == nil || o.RoleName == nil { + var ret string + return ret + } + return *o.RoleName +} + +// GetRoleNameOk returns a tuple with the RoleName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetRoleNameOk() (*string, bool) { + if o == nil || o.RoleName == nil { + return nil, false + } + return o.RoleName, true +} + +// HasRoleName returns a boolean if a field has been set. +func (o *AWSAccount) HasRoleName() bool { + if o != nil && o.RoleName != nil { + return true + } + + return false +} + +// SetRoleName gets a reference to the given string and assigns it to the RoleName field. +func (o *AWSAccount) SetRoleName(v string) { + o.RoleName = &v +} + +// GetSecretAccessKey returns the SecretAccessKey field value if set, zero value otherwise. +func (o *AWSAccount) GetSecretAccessKey() string { + if o == nil || o.SecretAccessKey == nil { + var ret string + return ret + } + return *o.SecretAccessKey +} + +// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetSecretAccessKeyOk() (*string, bool) { + if o == nil || o.SecretAccessKey == nil { + return nil, false + } + return o.SecretAccessKey, true +} + +// HasSecretAccessKey returns a boolean if a field has been set. +func (o *AWSAccount) HasSecretAccessKey() bool { + if o != nil && o.SecretAccessKey != nil { + return true + } + + return false +} + +// SetSecretAccessKey gets a reference to the given string and assigns it to the SecretAccessKey field. +func (o *AWSAccount) SetSecretAccessKey(v string) { + o.SecretAccessKey = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccount) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AccessKeyId != nil { + toSerialize["access_key_id"] = o.AccessKeyId + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.AccountSpecificNamespaceRules != nil { + toSerialize["account_specific_namespace_rules"] = o.AccountSpecificNamespaceRules + } + if o.CspmResourceCollectionEnabled != nil { + toSerialize["cspm_resource_collection_enabled"] = o.CspmResourceCollectionEnabled + } + if o.ExcludedRegions != nil { + toSerialize["excluded_regions"] = o.ExcludedRegions + } + if o.FilterTags != nil { + toSerialize["filter_tags"] = o.FilterTags + } + if o.HostTags != nil { + toSerialize["host_tags"] = o.HostTags + } + if o.MetricsCollectionEnabled != nil { + toSerialize["metrics_collection_enabled"] = o.MetricsCollectionEnabled + } + if o.ResourceCollectionEnabled != nil { + toSerialize["resource_collection_enabled"] = o.ResourceCollectionEnabled + } + if o.RoleName != nil { + toSerialize["role_name"] = o.RoleName + } + if o.SecretAccessKey != nil { + toSerialize["secret_access_key"] = o.SecretAccessKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AccessKeyId *string `json:"access_key_id,omitempty"` + AccountId *string `json:"account_id,omitempty"` + AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"` + CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"` + ExcludedRegions []string `json:"excluded_regions,omitempty"` + FilterTags []string `json:"filter_tags,omitempty"` + HostTags []string `json:"host_tags,omitempty"` + MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"` + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + RoleName *string `json:"role_name,omitempty"` + SecretAccessKey *string `json:"secret_access_key,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccessKeyId = all.AccessKeyId + o.AccountId = all.AccountId + o.AccountSpecificNamespaceRules = all.AccountSpecificNamespaceRules + o.CspmResourceCollectionEnabled = all.CspmResourceCollectionEnabled + o.ExcludedRegions = all.ExcludedRegions + o.FilterTags = all.FilterTags + o.HostTags = all.HostTags + o.MetricsCollectionEnabled = all.MetricsCollectionEnabled + o.ResourceCollectionEnabled = all.ResourceCollectionEnabled + o.RoleName = all.RoleName + o.SecretAccessKey = all.SecretAccessKey + return nil +} diff --git a/api/v1/datadog/model_aws_account_and_lambda_request.go b/api/v1/datadog/model_aws_account_and_lambda_request.go new file mode 100644 index 00000000000..9314400e7bd --- /dev/null +++ b/api/v1/datadog/model_aws_account_and_lambda_request.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AWSAccountAndLambdaRequest AWS account ID and Lambda ARN. +type AWSAccountAndLambdaRequest struct { + // Your AWS Account ID without dashes. + AccountId string `json:"account_id"` + // ARN of the Datadog Lambda created during the Datadog-Amazon Web services Log collection setup. + LambdaArn string `json:"lambda_arn"` + // 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{} +} + +// NewAWSAccountAndLambdaRequest instantiates a new AWSAccountAndLambdaRequest 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 NewAWSAccountAndLambdaRequest(accountId string, lambdaArn string) *AWSAccountAndLambdaRequest { + this := AWSAccountAndLambdaRequest{} + this.AccountId = accountId + this.LambdaArn = lambdaArn + return &this +} + +// NewAWSAccountAndLambdaRequestWithDefaults instantiates a new AWSAccountAndLambdaRequest 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 NewAWSAccountAndLambdaRequestWithDefaults() *AWSAccountAndLambdaRequest { + this := AWSAccountAndLambdaRequest{} + return &this +} + +// GetAccountId returns the AccountId field value. +func (o *AWSAccountAndLambdaRequest) GetAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value +// and a boolean to check if the value has been set. +func (o *AWSAccountAndLambdaRequest) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccountId, true +} + +// SetAccountId sets field value. +func (o *AWSAccountAndLambdaRequest) SetAccountId(v string) { + o.AccountId = v +} + +// GetLambdaArn returns the LambdaArn field value. +func (o *AWSAccountAndLambdaRequest) GetLambdaArn() string { + if o == nil { + var ret string + return ret + } + return o.LambdaArn +} + +// GetLambdaArnOk returns a tuple with the LambdaArn field value +// and a boolean to check if the value has been set. +func (o *AWSAccountAndLambdaRequest) GetLambdaArnOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.LambdaArn, true +} + +// SetLambdaArn sets field value. +func (o *AWSAccountAndLambdaRequest) SetLambdaArn(v string) { + o.LambdaArn = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountAndLambdaRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["account_id"] = o.AccountId + toSerialize["lambda_arn"] = o.LambdaArn + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountAndLambdaRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + AccountId *string `json:"account_id"` + LambdaArn *string `json:"lambda_arn"` + }{} + all := struct { + AccountId string `json:"account_id"` + LambdaArn string `json:"lambda_arn"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.AccountId == nil { + return fmt.Errorf("Required field account_id missing") + } + if required.LambdaArn == nil { + return fmt.Errorf("Required field lambda_arn missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccountId = all.AccountId + o.LambdaArn = all.LambdaArn + return nil +} diff --git a/api/v1/datadog/model_aws_account_create_response.go b/api/v1/datadog/model_aws_account_create_response.go new file mode 100644 index 00000000000..4fb560c03b6 --- /dev/null +++ b/api/v1/datadog/model_aws_account_create_response.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 datadog + +import ( + "encoding/json" +) + +// AWSAccountCreateResponse The Response returned by the AWS Create Account call. +type AWSAccountCreateResponse struct { + // AWS external_id. + ExternalId *string `json:"external_id,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{} +} + +// NewAWSAccountCreateResponse instantiates a new AWSAccountCreateResponse 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 NewAWSAccountCreateResponse() *AWSAccountCreateResponse { + this := AWSAccountCreateResponse{} + return &this +} + +// NewAWSAccountCreateResponseWithDefaults instantiates a new AWSAccountCreateResponse 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 NewAWSAccountCreateResponseWithDefaults() *AWSAccountCreateResponse { + this := AWSAccountCreateResponse{} + return &this +} + +// GetExternalId returns the ExternalId field value if set, zero value otherwise. +func (o *AWSAccountCreateResponse) GetExternalId() string { + if o == nil || o.ExternalId == nil { + var ret string + return ret + } + return *o.ExternalId +} + +// GetExternalIdOk returns a tuple with the ExternalId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateResponse) GetExternalIdOk() (*string, bool) { + if o == nil || o.ExternalId == nil { + return nil, false + } + return o.ExternalId, true +} + +// HasExternalId returns a boolean if a field has been set. +func (o *AWSAccountCreateResponse) HasExternalId() bool { + if o != nil && o.ExternalId != nil { + return true + } + + return false +} + +// SetExternalId gets a reference to the given string and assigns it to the ExternalId field. +func (o *AWSAccountCreateResponse) SetExternalId(v string) { + o.ExternalId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ExternalId != nil { + toSerialize["external_id"] = o.ExternalId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountCreateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ExternalId *string `json:"external_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ExternalId = all.ExternalId + return nil +} diff --git a/api/v1/datadog/model_aws_account_delete_request.go b/api/v1/datadog/model_aws_account_delete_request.go new file mode 100644 index 00000000000..8928b0c1253 --- /dev/null +++ b/api/v1/datadog/model_aws_account_delete_request.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSAccountDeleteRequest List of AWS accounts to delete. +type AWSAccountDeleteRequest struct { + // Your AWS access key ID. Only required if your AWS account is a GovCloud or China account. + AccessKeyId *string `json:"access_key_id,omitempty"` + // Your AWS Account ID without dashes. + AccountId *string `json:"account_id,omitempty"` + // Your Datadog role delegation name. + RoleName *string `json:"role_name,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{} +} + +// NewAWSAccountDeleteRequest instantiates a new AWSAccountDeleteRequest 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 NewAWSAccountDeleteRequest() *AWSAccountDeleteRequest { + this := AWSAccountDeleteRequest{} + return &this +} + +// NewAWSAccountDeleteRequestWithDefaults instantiates a new AWSAccountDeleteRequest 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 NewAWSAccountDeleteRequestWithDefaults() *AWSAccountDeleteRequest { + this := AWSAccountDeleteRequest{} + return &this +} + +// GetAccessKeyId returns the AccessKeyId field value if set, zero value otherwise. +func (o *AWSAccountDeleteRequest) GetAccessKeyId() string { + if o == nil || o.AccessKeyId == nil { + var ret string + return ret + } + return *o.AccessKeyId +} + +// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountDeleteRequest) GetAccessKeyIdOk() (*string, bool) { + if o == nil || o.AccessKeyId == nil { + return nil, false + } + return o.AccessKeyId, true +} + +// HasAccessKeyId returns a boolean if a field has been set. +func (o *AWSAccountDeleteRequest) HasAccessKeyId() bool { + if o != nil && o.AccessKeyId != nil { + return true + } + + return false +} + +// SetAccessKeyId gets a reference to the given string and assigns it to the AccessKeyId field. +func (o *AWSAccountDeleteRequest) SetAccessKeyId(v string) { + o.AccessKeyId = &v +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *AWSAccountDeleteRequest) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountDeleteRequest) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *AWSAccountDeleteRequest) HasAccountId() bool { + if o != nil && o.AccountId != nil { + return true + } + + return false +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *AWSAccountDeleteRequest) SetAccountId(v string) { + o.AccountId = &v +} + +// GetRoleName returns the RoleName field value if set, zero value otherwise. +func (o *AWSAccountDeleteRequest) GetRoleName() string { + if o == nil || o.RoleName == nil { + var ret string + return ret + } + return *o.RoleName +} + +// GetRoleNameOk returns a tuple with the RoleName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountDeleteRequest) GetRoleNameOk() (*string, bool) { + if o == nil || o.RoleName == nil { + return nil, false + } + return o.RoleName, true +} + +// HasRoleName returns a boolean if a field has been set. +func (o *AWSAccountDeleteRequest) HasRoleName() bool { + if o != nil && o.RoleName != nil { + return true + } + + return false +} + +// SetRoleName gets a reference to the given string and assigns it to the RoleName field. +func (o *AWSAccountDeleteRequest) SetRoleName(v string) { + o.RoleName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountDeleteRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AccessKeyId != nil { + toSerialize["access_key_id"] = o.AccessKeyId + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.RoleName != nil { + toSerialize["role_name"] = o.RoleName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AccessKeyId *string `json:"access_key_id,omitempty"` + AccountId *string `json:"account_id,omitempty"` + RoleName *string `json:"role_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccessKeyId = all.AccessKeyId + o.AccountId = all.AccountId + o.RoleName = all.RoleName + return nil +} diff --git a/api/v1/datadog/model_aws_account_list_response.go b/api/v1/datadog/model_aws_account_list_response.go new file mode 100644 index 00000000000..65bd7c06618 --- /dev/null +++ b/api/v1/datadog/model_aws_account_list_response.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 datadog + +import ( + "encoding/json" +) + +// AWSAccountListResponse List of enabled AWS accounts. +type AWSAccountListResponse struct { + // List of enabled AWS accounts. + Accounts []AWSAccount `json:"accounts,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{} +} + +// NewAWSAccountListResponse instantiates a new AWSAccountListResponse 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 NewAWSAccountListResponse() *AWSAccountListResponse { + this := AWSAccountListResponse{} + return &this +} + +// NewAWSAccountListResponseWithDefaults instantiates a new AWSAccountListResponse 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 NewAWSAccountListResponseWithDefaults() *AWSAccountListResponse { + this := AWSAccountListResponse{} + return &this +} + +// GetAccounts returns the Accounts field value if set, zero value otherwise. +func (o *AWSAccountListResponse) GetAccounts() []AWSAccount { + if o == nil || o.Accounts == nil { + var ret []AWSAccount + return ret + } + return o.Accounts +} + +// GetAccountsOk returns a tuple with the Accounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountListResponse) GetAccountsOk() (*[]AWSAccount, bool) { + if o == nil || o.Accounts == nil { + return nil, false + } + return &o.Accounts, true +} + +// HasAccounts returns a boolean if a field has been set. +func (o *AWSAccountListResponse) HasAccounts() bool { + if o != nil && o.Accounts != nil { + return true + } + + return false +} + +// SetAccounts gets a reference to the given []AWSAccount and assigns it to the Accounts field. +func (o *AWSAccountListResponse) SetAccounts(v []AWSAccount) { + o.Accounts = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Accounts != nil { + toSerialize["accounts"] = o.Accounts + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Accounts []AWSAccount `json:"accounts,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Accounts = all.Accounts + return nil +} diff --git a/api/v1/datadog/model_aws_logs_async_error.go b/api/v1/datadog/model_aws_logs_async_error.go new file mode 100644 index 00000000000..e766a09f7f1 --- /dev/null +++ b/api/v1/datadog/model_aws_logs_async_error.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSLogsAsyncError Description of errors. +type AWSLogsAsyncError struct { + // Code properties + Code *string `json:"code,omitempty"` + // Message content. + Message *string `json:"message,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{} +} + +// NewAWSLogsAsyncError instantiates a new AWSLogsAsyncError 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 NewAWSLogsAsyncError() *AWSLogsAsyncError { + this := AWSLogsAsyncError{} + return &this +} + +// NewAWSLogsAsyncErrorWithDefaults instantiates a new AWSLogsAsyncError 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 NewAWSLogsAsyncErrorWithDefaults() *AWSLogsAsyncError { + this := AWSLogsAsyncError{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *AWSLogsAsyncError) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsAsyncError) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *AWSLogsAsyncError) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *AWSLogsAsyncError) SetCode(v string) { + o.Code = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *AWSLogsAsyncError) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsAsyncError) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *AWSLogsAsyncError) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *AWSLogsAsyncError) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsAsyncError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsAsyncError) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_aws_logs_async_response.go b/api/v1/datadog/model_aws_logs_async_response.go new file mode 100644 index 00000000000..df6090401b0 --- /dev/null +++ b/api/v1/datadog/model_aws_logs_async_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSLogsAsyncResponse A list of all Datadog-AWS logs integrations available in your Datadog organization. +type AWSLogsAsyncResponse struct { + // List of errors. + Errors []AWSLogsAsyncError `json:"errors,omitempty"` + // Status of the properties. + Status *string `json:"status,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{} +} + +// NewAWSLogsAsyncResponse instantiates a new AWSLogsAsyncResponse 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 NewAWSLogsAsyncResponse() *AWSLogsAsyncResponse { + this := AWSLogsAsyncResponse{} + return &this +} + +// NewAWSLogsAsyncResponseWithDefaults instantiates a new AWSLogsAsyncResponse 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 NewAWSLogsAsyncResponseWithDefaults() *AWSLogsAsyncResponse { + this := AWSLogsAsyncResponse{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *AWSLogsAsyncResponse) GetErrors() []AWSLogsAsyncError { + if o == nil || o.Errors == nil { + var ret []AWSLogsAsyncError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsAsyncResponse) GetErrorsOk() (*[]AWSLogsAsyncError, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *AWSLogsAsyncResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []AWSLogsAsyncError and assigns it to the Errors field. +func (o *AWSLogsAsyncResponse) SetErrors(v []AWSLogsAsyncError) { + o.Errors = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *AWSLogsAsyncResponse) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsAsyncResponse) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *AWSLogsAsyncResponse) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *AWSLogsAsyncResponse) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsAsyncResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsAsyncResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Errors []AWSLogsAsyncError `json:"errors,omitempty"` + Status *string `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Errors = all.Errors + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_aws_logs_lambda.go b/api/v1/datadog/model_aws_logs_lambda.go new file mode 100644 index 00000000000..dc81fed7218 --- /dev/null +++ b/api/v1/datadog/model_aws_logs_lambda.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 datadog + +import ( + "encoding/json" +) + +// AWSLogsLambda Description of the Lambdas. +type AWSLogsLambda struct { + // Available ARN IDs. + Arn *string `json:"arn,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{} +} + +// NewAWSLogsLambda instantiates a new AWSLogsLambda 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 NewAWSLogsLambda() *AWSLogsLambda { + this := AWSLogsLambda{} + return &this +} + +// NewAWSLogsLambdaWithDefaults instantiates a new AWSLogsLambda 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 NewAWSLogsLambdaWithDefaults() *AWSLogsLambda { + this := AWSLogsLambda{} + return &this +} + +// GetArn returns the Arn field value if set, zero value otherwise. +func (o *AWSLogsLambda) GetArn() string { + if o == nil || o.Arn == nil { + var ret string + return ret + } + return *o.Arn +} + +// GetArnOk returns a tuple with the Arn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsLambda) GetArnOk() (*string, bool) { + if o == nil || o.Arn == nil { + return nil, false + } + return o.Arn, true +} + +// HasArn returns a boolean if a field has been set. +func (o *AWSLogsLambda) HasArn() bool { + if o != nil && o.Arn != nil { + return true + } + + return false +} + +// SetArn gets a reference to the given string and assigns it to the Arn field. +func (o *AWSLogsLambda) SetArn(v string) { + o.Arn = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsLambda) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Arn != nil { + toSerialize["arn"] = o.Arn + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsLambda) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Arn *string `json:"arn,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Arn = all.Arn + return nil +} diff --git a/api/v1/datadog/model_aws_logs_list_response.go b/api/v1/datadog/model_aws_logs_list_response.go new file mode 100644 index 00000000000..f763afea567 --- /dev/null +++ b/api/v1/datadog/model_aws_logs_list_response.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSLogsListResponse A list of all Datadog-AWS logs integrations available in your Datadog organization. +type AWSLogsListResponse struct { + // Your AWS Account ID without dashes. + AccountId *string `json:"account_id,omitempty"` + // List of ARNs configured in your Datadog account. + Lambdas []AWSLogsLambda `json:"lambdas,omitempty"` + // Array of services IDs. + Services []string `json:"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{} +} + +// NewAWSLogsListResponse instantiates a new AWSLogsListResponse 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 NewAWSLogsListResponse() *AWSLogsListResponse { + this := AWSLogsListResponse{} + return &this +} + +// NewAWSLogsListResponseWithDefaults instantiates a new AWSLogsListResponse 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 NewAWSLogsListResponseWithDefaults() *AWSLogsListResponse { + this := AWSLogsListResponse{} + return &this +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *AWSLogsListResponse) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsListResponse) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *AWSLogsListResponse) HasAccountId() bool { + if o != nil && o.AccountId != nil { + return true + } + + return false +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *AWSLogsListResponse) SetAccountId(v string) { + o.AccountId = &v +} + +// GetLambdas returns the Lambdas field value if set, zero value otherwise. +func (o *AWSLogsListResponse) GetLambdas() []AWSLogsLambda { + if o == nil || o.Lambdas == nil { + var ret []AWSLogsLambda + return ret + } + return o.Lambdas +} + +// GetLambdasOk returns a tuple with the Lambdas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsListResponse) GetLambdasOk() (*[]AWSLogsLambda, bool) { + if o == nil || o.Lambdas == nil { + return nil, false + } + return &o.Lambdas, true +} + +// HasLambdas returns a boolean if a field has been set. +func (o *AWSLogsListResponse) HasLambdas() bool { + if o != nil && o.Lambdas != nil { + return true + } + + return false +} + +// SetLambdas gets a reference to the given []AWSLogsLambda and assigns it to the Lambdas field. +func (o *AWSLogsListResponse) SetLambdas(v []AWSLogsLambda) { + o.Lambdas = v +} + +// GetServices returns the Services field value if set, zero value otherwise. +func (o *AWSLogsListResponse) 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 *AWSLogsListResponse) 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 *AWSLogsListResponse) HasServices() bool { + if o != nil && o.Services != nil { + return true + } + + return false +} + +// SetServices gets a reference to the given []string and assigns it to the Services field. +func (o *AWSLogsListResponse) SetServices(v []string) { + o.Services = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.Lambdas != nil { + toSerialize["lambdas"] = o.Lambdas + } + if o.Services != nil { + toSerialize["services"] = o.Services + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AccountId *string `json:"account_id,omitempty"` + Lambdas []AWSLogsLambda `json:"lambdas,omitempty"` + Services []string `json:"services,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccountId = all.AccountId + o.Lambdas = all.Lambdas + o.Services = all.Services + return nil +} diff --git a/api/v1/datadog/model_aws_logs_list_services_response.go b/api/v1/datadog/model_aws_logs_list_services_response.go new file mode 100644 index 00000000000..8583788ee71 --- /dev/null +++ b/api/v1/datadog/model_aws_logs_list_services_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSLogsListServicesResponse The list of current AWS services for which Datadog offers automatic log collection. +type AWSLogsListServicesResponse struct { + // Key value in returned object. + Id *string `json:"id,omitempty"` + // Name of service available for configuration with Datadog logs. + Label *string `json:"label,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{} +} + +// NewAWSLogsListServicesResponse instantiates a new AWSLogsListServicesResponse 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 NewAWSLogsListServicesResponse() *AWSLogsListServicesResponse { + this := AWSLogsListServicesResponse{} + return &this +} + +// NewAWSLogsListServicesResponseWithDefaults instantiates a new AWSLogsListServicesResponse 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 NewAWSLogsListServicesResponseWithDefaults() *AWSLogsListServicesResponse { + this := AWSLogsListServicesResponse{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSLogsListServicesResponse) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsListServicesResponse) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AWSLogsListServicesResponse) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AWSLogsListServicesResponse) SetId(v string) { + o.Id = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *AWSLogsListServicesResponse) GetLabel() string { + if o == nil || o.Label == nil { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsListServicesResponse) GetLabelOk() (*string, bool) { + if o == nil || o.Label == nil { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *AWSLogsListServicesResponse) HasLabel() bool { + if o != nil && o.Label != nil { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *AWSLogsListServicesResponse) SetLabel(v string) { + o.Label = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsListServicesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Label != nil { + toSerialize["label"] = o.Label + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsListServicesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Label *string `json:"label,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Label = all.Label + return nil +} diff --git a/api/v1/datadog/model_aws_logs_services_request.go b/api/v1/datadog/model_aws_logs_services_request.go new file mode 100644 index 00000000000..afb2e655728 --- /dev/null +++ b/api/v1/datadog/model_aws_logs_services_request.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AWSLogsServicesRequest A list of current AWS services for which Datadog offers automatic log collection. +type AWSLogsServicesRequest struct { + // Your AWS Account ID without dashes. + AccountId string `json:"account_id"` + // Array of services IDs set to enable automatic log collection. Discover the list of available services with the get list of AWS log ready services API endpoint. + Services []string `json:"services"` + // 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{} +} + +// NewAWSLogsServicesRequest instantiates a new AWSLogsServicesRequest 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 NewAWSLogsServicesRequest(accountId string, services []string) *AWSLogsServicesRequest { + this := AWSLogsServicesRequest{} + this.AccountId = accountId + this.Services = services + return &this +} + +// NewAWSLogsServicesRequestWithDefaults instantiates a new AWSLogsServicesRequest 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 NewAWSLogsServicesRequestWithDefaults() *AWSLogsServicesRequest { + this := AWSLogsServicesRequest{} + return &this +} + +// GetAccountId returns the AccountId field value. +func (o *AWSLogsServicesRequest) GetAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value +// and a boolean to check if the value has been set. +func (o *AWSLogsServicesRequest) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccountId, true +} + +// SetAccountId sets field value. +func (o *AWSLogsServicesRequest) SetAccountId(v string) { + o.AccountId = v +} + +// GetServices returns the Services field value. +func (o *AWSLogsServicesRequest) GetServices() []string { + if o == nil { + var ret []string + return ret + } + return o.Services +} + +// GetServicesOk returns a tuple with the Services field value +// and a boolean to check if the value has been set. +func (o *AWSLogsServicesRequest) GetServicesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Services, true +} + +// SetServices sets field value. +func (o *AWSLogsServicesRequest) SetServices(v []string) { + o.Services = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsServicesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["account_id"] = o.AccountId + toSerialize["services"] = o.Services + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsServicesRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + AccountId *string `json:"account_id"` + Services *[]string `json:"services"` + }{} + all := struct { + AccountId string `json:"account_id"` + Services []string `json:"services"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.AccountId == nil { + return fmt.Errorf("Required field account_id missing") + } + if required.Services == nil { + return fmt.Errorf("Required field services missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccountId = all.AccountId + o.Services = all.Services + return nil +} diff --git a/api/v1/datadog/model_aws_namespace.go b/api/v1/datadog/model_aws_namespace.go new file mode 100644 index 00000000000..7c7f2296693 --- /dev/null +++ b/api/v1/datadog/model_aws_namespace.go @@ -0,0 +1,119 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AWSNamespace The namespace associated with the tag filter entry. +type AWSNamespace string + +// List of AWSNamespace. +const ( + AWSNAMESPACE_ELB AWSNamespace = "elb" + AWSNAMESPACE_APPLICATION_ELB AWSNamespace = "application_elb" + AWSNAMESPACE_SQS AWSNamespace = "sqs" + AWSNAMESPACE_RDS AWSNamespace = "rds" + AWSNAMESPACE_CUSTOM AWSNamespace = "custom" + AWSNAMESPACE_NETWORK_ELB AWSNamespace = "network_elb" + AWSNAMESPACE_LAMBDA AWSNamespace = "lambda" +) + +var allowedAWSNamespaceEnumValues = []AWSNamespace{ + AWSNAMESPACE_ELB, + AWSNAMESPACE_APPLICATION_ELB, + AWSNAMESPACE_SQS, + AWSNAMESPACE_RDS, + AWSNAMESPACE_CUSTOM, + AWSNAMESPACE_NETWORK_ELB, + AWSNAMESPACE_LAMBDA, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSNamespace) GetAllowedValues() []AWSNamespace { + return allowedAWSNamespaceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSNamespace) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSNamespace(value) + return nil +} + +// NewAWSNamespaceFromValue returns a pointer to a valid AWSNamespace +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSNamespaceFromValue(v string) (*AWSNamespace, error) { + ev := AWSNamespace(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSNamespace: valid values are %v", v, allowedAWSNamespaceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSNamespace) IsValid() bool { + for _, existing := range allowedAWSNamespaceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSNamespace value. +func (v AWSNamespace) Ptr() *AWSNamespace { + return &v +} + +// NullableAWSNamespace handles when a null is used for AWSNamespace. +type NullableAWSNamespace struct { + value *AWSNamespace + isSet bool +} + +// Get returns the associated value. +func (v NullableAWSNamespace) Get() *AWSNamespace { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAWSNamespace) Set(val *AWSNamespace) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAWSNamespace) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAWSNamespace) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAWSNamespace initializes the struct as if Set has been called. +func NewNullableAWSNamespace(val *AWSNamespace) *NullableAWSNamespace { + return &NullableAWSNamespace{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAWSNamespace) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAWSNamespace) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_aws_tag_filter.go b/api/v1/datadog/model_aws_tag_filter.go new file mode 100644 index 00000000000..4eda5ed3bdb --- /dev/null +++ b/api/v1/datadog/model_aws_tag_filter.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSTagFilter A tag filter. +type AWSTagFilter struct { + // The namespace associated with the tag filter entry. + Namespace *AWSNamespace `json:"namespace,omitempty"` + // The tag filter string. + TagFilterStr *string `json:"tag_filter_str,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{} +} + +// NewAWSTagFilter instantiates a new AWSTagFilter 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 NewAWSTagFilter() *AWSTagFilter { + this := AWSTagFilter{} + return &this +} + +// NewAWSTagFilterWithDefaults instantiates a new AWSTagFilter 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 NewAWSTagFilterWithDefaults() *AWSTagFilter { + this := AWSTagFilter{} + return &this +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *AWSTagFilter) GetNamespace() AWSNamespace { + if o == nil || o.Namespace == nil { + var ret AWSNamespace + 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 *AWSTagFilter) GetNamespaceOk() (*AWSNamespace, 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 *AWSTagFilter) HasNamespace() bool { + if o != nil && o.Namespace != nil { + return true + } + + return false +} + +// SetNamespace gets a reference to the given AWSNamespace and assigns it to the Namespace field. +func (o *AWSTagFilter) SetNamespace(v AWSNamespace) { + o.Namespace = &v +} + +// GetTagFilterStr returns the TagFilterStr field value if set, zero value otherwise. +func (o *AWSTagFilter) GetTagFilterStr() string { + if o == nil || o.TagFilterStr == nil { + var ret string + return ret + } + return *o.TagFilterStr +} + +// GetTagFilterStrOk returns a tuple with the TagFilterStr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSTagFilter) GetTagFilterStrOk() (*string, bool) { + if o == nil || o.TagFilterStr == nil { + return nil, false + } + return o.TagFilterStr, true +} + +// HasTagFilterStr returns a boolean if a field has been set. +func (o *AWSTagFilter) HasTagFilterStr() bool { + if o != nil && o.TagFilterStr != nil { + return true + } + + return false +} + +// SetTagFilterStr gets a reference to the given string and assigns it to the TagFilterStr field. +func (o *AWSTagFilter) SetTagFilterStr(v string) { + o.TagFilterStr = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSTagFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + if o.TagFilterStr != nil { + toSerialize["tag_filter_str"] = o.TagFilterStr + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSTagFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Namespace *AWSNamespace `json:"namespace,omitempty"` + TagFilterStr *string `json:"tag_filter_str,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Namespace; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Namespace = all.Namespace + o.TagFilterStr = all.TagFilterStr + return nil +} diff --git a/api/v1/datadog/model_aws_tag_filter_create_request.go b/api/v1/datadog/model_aws_tag_filter_create_request.go new file mode 100644 index 00000000000..f82776ae695 --- /dev/null +++ b/api/v1/datadog/model_aws_tag_filter_create_request.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSTagFilterCreateRequest The objects used to set an AWS tag filter. +type AWSTagFilterCreateRequest struct { + // Your AWS Account ID without dashes. + AccountId *string `json:"account_id,omitempty"` + // The namespace associated with the tag filter entry. + Namespace *AWSNamespace `json:"namespace,omitempty"` + // The tag filter string. + TagFilterStr *string `json:"tag_filter_str,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{} +} + +// NewAWSTagFilterCreateRequest instantiates a new AWSTagFilterCreateRequest 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 NewAWSTagFilterCreateRequest() *AWSTagFilterCreateRequest { + this := AWSTagFilterCreateRequest{} + return &this +} + +// NewAWSTagFilterCreateRequestWithDefaults instantiates a new AWSTagFilterCreateRequest 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 NewAWSTagFilterCreateRequestWithDefaults() *AWSTagFilterCreateRequest { + this := AWSTagFilterCreateRequest{} + return &this +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *AWSTagFilterCreateRequest) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSTagFilterCreateRequest) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *AWSTagFilterCreateRequest) HasAccountId() bool { + if o != nil && o.AccountId != nil { + return true + } + + return false +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *AWSTagFilterCreateRequest) SetAccountId(v string) { + o.AccountId = &v +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *AWSTagFilterCreateRequest) GetNamespace() AWSNamespace { + if o == nil || o.Namespace == nil { + var ret AWSNamespace + 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 *AWSTagFilterCreateRequest) GetNamespaceOk() (*AWSNamespace, 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 *AWSTagFilterCreateRequest) HasNamespace() bool { + if o != nil && o.Namespace != nil { + return true + } + + return false +} + +// SetNamespace gets a reference to the given AWSNamespace and assigns it to the Namespace field. +func (o *AWSTagFilterCreateRequest) SetNamespace(v AWSNamespace) { + o.Namespace = &v +} + +// GetTagFilterStr returns the TagFilterStr field value if set, zero value otherwise. +func (o *AWSTagFilterCreateRequest) GetTagFilterStr() string { + if o == nil || o.TagFilterStr == nil { + var ret string + return ret + } + return *o.TagFilterStr +} + +// GetTagFilterStrOk returns a tuple with the TagFilterStr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSTagFilterCreateRequest) GetTagFilterStrOk() (*string, bool) { + if o == nil || o.TagFilterStr == nil { + return nil, false + } + return o.TagFilterStr, true +} + +// HasTagFilterStr returns a boolean if a field has been set. +func (o *AWSTagFilterCreateRequest) HasTagFilterStr() bool { + if o != nil && o.TagFilterStr != nil { + return true + } + + return false +} + +// SetTagFilterStr gets a reference to the given string and assigns it to the TagFilterStr field. +func (o *AWSTagFilterCreateRequest) SetTagFilterStr(v string) { + o.TagFilterStr = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSTagFilterCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + if o.TagFilterStr != nil { + toSerialize["tag_filter_str"] = o.TagFilterStr + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSTagFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AccountId *string `json:"account_id,omitempty"` + Namespace *AWSNamespace `json:"namespace,omitempty"` + TagFilterStr *string `json:"tag_filter_str,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Namespace; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccountId = all.AccountId + o.Namespace = all.Namespace + o.TagFilterStr = all.TagFilterStr + return nil +} diff --git a/api/v1/datadog/model_aws_tag_filter_delete_request.go b/api/v1/datadog/model_aws_tag_filter_delete_request.go new file mode 100644 index 00000000000..b69d463d48c --- /dev/null +++ b/api/v1/datadog/model_aws_tag_filter_delete_request.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AWSTagFilterDeleteRequest The objects used to delete an AWS tag filter entry. +type AWSTagFilterDeleteRequest struct { + // The unique identifier of your AWS account. + AccountId *string `json:"account_id,omitempty"` + // The namespace associated with the tag filter entry. + Namespace *AWSNamespace `json:"namespace,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{} +} + +// NewAWSTagFilterDeleteRequest instantiates a new AWSTagFilterDeleteRequest 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 NewAWSTagFilterDeleteRequest() *AWSTagFilterDeleteRequest { + this := AWSTagFilterDeleteRequest{} + return &this +} + +// NewAWSTagFilterDeleteRequestWithDefaults instantiates a new AWSTagFilterDeleteRequest 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 NewAWSTagFilterDeleteRequestWithDefaults() *AWSTagFilterDeleteRequest { + this := AWSTagFilterDeleteRequest{} + return &this +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *AWSTagFilterDeleteRequest) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSTagFilterDeleteRequest) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *AWSTagFilterDeleteRequest) HasAccountId() bool { + if o != nil && o.AccountId != nil { + return true + } + + return false +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *AWSTagFilterDeleteRequest) SetAccountId(v string) { + o.AccountId = &v +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *AWSTagFilterDeleteRequest) GetNamespace() AWSNamespace { + if o == nil || o.Namespace == nil { + var ret AWSNamespace + 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 *AWSTagFilterDeleteRequest) GetNamespaceOk() (*AWSNamespace, 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 *AWSTagFilterDeleteRequest) HasNamespace() bool { + if o != nil && o.Namespace != nil { + return true + } + + return false +} + +// SetNamespace gets a reference to the given AWSNamespace and assigns it to the Namespace field. +func (o *AWSTagFilterDeleteRequest) SetNamespace(v AWSNamespace) { + o.Namespace = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSTagFilterDeleteRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSTagFilterDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AccountId *string `json:"account_id,omitempty"` + Namespace *AWSNamespace `json:"namespace,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Namespace; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccountId = all.AccountId + o.Namespace = all.Namespace + return nil +} diff --git a/api/v1/datadog/model_aws_tag_filter_list_response.go b/api/v1/datadog/model_aws_tag_filter_list_response.go new file mode 100644 index 00000000000..4a632db9ce2 --- /dev/null +++ b/api/v1/datadog/model_aws_tag_filter_list_response.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 datadog + +import ( + "encoding/json" +) + +// AWSTagFilterListResponse An array of tag filter rules by `namespace` and tag filter string. +type AWSTagFilterListResponse struct { + // An array of tag filters. + Filters []AWSTagFilter `json:"filters,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{} +} + +// NewAWSTagFilterListResponse instantiates a new AWSTagFilterListResponse 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 NewAWSTagFilterListResponse() *AWSTagFilterListResponse { + this := AWSTagFilterListResponse{} + return &this +} + +// NewAWSTagFilterListResponseWithDefaults instantiates a new AWSTagFilterListResponse 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 NewAWSTagFilterListResponseWithDefaults() *AWSTagFilterListResponse { + this := AWSTagFilterListResponse{} + return &this +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *AWSTagFilterListResponse) GetFilters() []AWSTagFilter { + if o == nil || o.Filters == nil { + var ret []AWSTagFilter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSTagFilterListResponse) GetFiltersOk() (*[]AWSTagFilter, bool) { + if o == nil || o.Filters == nil { + return nil, false + } + return &o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *AWSTagFilterListResponse) HasFilters() bool { + if o != nil && o.Filters != nil { + return true + } + + return false +} + +// SetFilters gets a reference to the given []AWSTagFilter and assigns it to the Filters field. +func (o *AWSTagFilterListResponse) SetFilters(v []AWSTagFilter) { + o.Filters = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSTagFilterListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filters != nil { + toSerialize["filters"] = o.Filters + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSTagFilterListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filters []AWSTagFilter `json:"filters,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Filters = all.Filters + return nil +} diff --git a/api/v1/datadog/model_azure_account.go b/api/v1/datadog/model_azure_account.go new file mode 100644 index 00000000000..79d4a37eb67 --- /dev/null +++ b/api/v1/datadog/model_azure_account.go @@ -0,0 +1,376 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AzureAccount Datadog-Azure integrations configured for your organization. +type AzureAccount struct { + // Silence monitors for expected Azure VM shutdowns. + Automute *bool `json:"automute,omitempty"` + // Your Azure web application ID. + ClientId *string `json:"client_id,omitempty"` + // Your Azure web application secret key. + ClientSecret *string `json:"client_secret,omitempty"` + // Errors in your configuration. + Errors []string `json:"errors,omitempty"` + // Limit the Azure instances that are pulled into Datadog by using tags. + // Only hosts that match one of the defined tags are imported into Datadog. + HostFilters *string `json:"host_filters,omitempty"` + // Your New Azure web application ID. + NewClientId *string `json:"new_client_id,omitempty"` + // Your New Azure Active Directory ID. + NewTenantName *string `json:"new_tenant_name,omitempty"` + // Your Azure Active Directory ID. + TenantName *string `json:"tenant_name,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{} +} + +// NewAzureAccount instantiates a new AzureAccount 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 NewAzureAccount() *AzureAccount { + this := AzureAccount{} + return &this +} + +// NewAzureAccountWithDefaults instantiates a new AzureAccount 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 NewAzureAccountWithDefaults() *AzureAccount { + this := AzureAccount{} + return &this +} + +// GetAutomute returns the Automute field value if set, zero value otherwise. +func (o *AzureAccount) GetAutomute() bool { + if o == nil || o.Automute == nil { + var ret bool + return ret + } + return *o.Automute +} + +// GetAutomuteOk returns a tuple with the Automute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetAutomuteOk() (*bool, bool) { + if o == nil || o.Automute == nil { + return nil, false + } + return o.Automute, true +} + +// HasAutomute returns a boolean if a field has been set. +func (o *AzureAccount) HasAutomute() bool { + if o != nil && o.Automute != nil { + return true + } + + return false +} + +// SetAutomute gets a reference to the given bool and assigns it to the Automute field. +func (o *AzureAccount) SetAutomute(v bool) { + o.Automute = &v +} + +// GetClientId returns the ClientId field value if set, zero value otherwise. +func (o *AzureAccount) GetClientId() string { + if o == nil || o.ClientId == nil { + var ret string + return ret + } + return *o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetClientIdOk() (*string, bool) { + if o == nil || o.ClientId == nil { + return nil, false + } + return o.ClientId, true +} + +// HasClientId returns a boolean if a field has been set. +func (o *AzureAccount) HasClientId() bool { + if o != nil && o.ClientId != nil { + return true + } + + return false +} + +// SetClientId gets a reference to the given string and assigns it to the ClientId field. +func (o *AzureAccount) SetClientId(v string) { + o.ClientId = &v +} + +// GetClientSecret returns the ClientSecret field value if set, zero value otherwise. +func (o *AzureAccount) GetClientSecret() string { + if o == nil || o.ClientSecret == nil { + var ret string + return ret + } + return *o.ClientSecret +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetClientSecretOk() (*string, bool) { + if o == nil || o.ClientSecret == nil { + return nil, false + } + return o.ClientSecret, true +} + +// HasClientSecret returns a boolean if a field has been set. +func (o *AzureAccount) HasClientSecret() bool { + if o != nil && o.ClientSecret != nil { + return true + } + + return false +} + +// SetClientSecret gets a reference to the given string and assigns it to the ClientSecret field. +func (o *AzureAccount) SetClientSecret(v string) { + o.ClientSecret = &v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *AzureAccount) GetErrors() []string { + if o == nil || o.Errors == nil { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetErrorsOk() (*[]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *AzureAccount) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []string and assigns it to the Errors field. +func (o *AzureAccount) SetErrors(v []string) { + o.Errors = v +} + +// GetHostFilters returns the HostFilters field value if set, zero value otherwise. +func (o *AzureAccount) GetHostFilters() string { + if o == nil || o.HostFilters == nil { + var ret string + return ret + } + return *o.HostFilters +} + +// GetHostFiltersOk returns a tuple with the HostFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetHostFiltersOk() (*string, bool) { + if o == nil || o.HostFilters == nil { + return nil, false + } + return o.HostFilters, true +} + +// HasHostFilters returns a boolean if a field has been set. +func (o *AzureAccount) HasHostFilters() bool { + if o != nil && o.HostFilters != nil { + return true + } + + return false +} + +// SetHostFilters gets a reference to the given string and assigns it to the HostFilters field. +func (o *AzureAccount) SetHostFilters(v string) { + o.HostFilters = &v +} + +// GetNewClientId returns the NewClientId field value if set, zero value otherwise. +func (o *AzureAccount) GetNewClientId() string { + if o == nil || o.NewClientId == nil { + var ret string + return ret + } + return *o.NewClientId +} + +// GetNewClientIdOk returns a tuple with the NewClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetNewClientIdOk() (*string, bool) { + if o == nil || o.NewClientId == nil { + return nil, false + } + return o.NewClientId, true +} + +// HasNewClientId returns a boolean if a field has been set. +func (o *AzureAccount) HasNewClientId() bool { + if o != nil && o.NewClientId != nil { + return true + } + + return false +} + +// SetNewClientId gets a reference to the given string and assigns it to the NewClientId field. +func (o *AzureAccount) SetNewClientId(v string) { + o.NewClientId = &v +} + +// GetNewTenantName returns the NewTenantName field value if set, zero value otherwise. +func (o *AzureAccount) GetNewTenantName() string { + if o == nil || o.NewTenantName == nil { + var ret string + return ret + } + return *o.NewTenantName +} + +// GetNewTenantNameOk returns a tuple with the NewTenantName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetNewTenantNameOk() (*string, bool) { + if o == nil || o.NewTenantName == nil { + return nil, false + } + return o.NewTenantName, true +} + +// HasNewTenantName returns a boolean if a field has been set. +func (o *AzureAccount) HasNewTenantName() bool { + if o != nil && o.NewTenantName != nil { + return true + } + + return false +} + +// SetNewTenantName gets a reference to the given string and assigns it to the NewTenantName field. +func (o *AzureAccount) SetNewTenantName(v string) { + o.NewTenantName = &v +} + +// GetTenantName returns the TenantName field value if set, zero value otherwise. +func (o *AzureAccount) GetTenantName() string { + if o == nil || o.TenantName == nil { + var ret string + return ret + } + return *o.TenantName +} + +// GetTenantNameOk returns a tuple with the TenantName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AzureAccount) GetTenantNameOk() (*string, bool) { + if o == nil || o.TenantName == nil { + return nil, false + } + return o.TenantName, true +} + +// HasTenantName returns a boolean if a field has been set. +func (o *AzureAccount) HasTenantName() bool { + if o != nil && o.TenantName != nil { + return true + } + + return false +} + +// SetTenantName gets a reference to the given string and assigns it to the TenantName field. +func (o *AzureAccount) SetTenantName(v string) { + o.TenantName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AzureAccount) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Automute != nil { + toSerialize["automute"] = o.Automute + } + if o.ClientId != nil { + toSerialize["client_id"] = o.ClientId + } + if o.ClientSecret != nil { + toSerialize["client_secret"] = o.ClientSecret + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + if o.HostFilters != nil { + toSerialize["host_filters"] = o.HostFilters + } + if o.NewClientId != nil { + toSerialize["new_client_id"] = o.NewClientId + } + if o.NewTenantName != nil { + toSerialize["new_tenant_name"] = o.NewTenantName + } + if o.TenantName != nil { + toSerialize["tenant_name"] = o.TenantName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AzureAccount) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Automute *bool `json:"automute,omitempty"` + ClientId *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + Errors []string `json:"errors,omitempty"` + HostFilters *string `json:"host_filters,omitempty"` + NewClientId *string `json:"new_client_id,omitempty"` + NewTenantName *string `json:"new_tenant_name,omitempty"` + TenantName *string `json:"tenant_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Automute = all.Automute + o.ClientId = all.ClientId + o.ClientSecret = all.ClientSecret + o.Errors = all.Errors + o.HostFilters = all.HostFilters + o.NewClientId = all.NewClientId + o.NewTenantName = all.NewTenantName + o.TenantName = all.TenantName + return nil +} diff --git a/api/v1/datadog/model_cancel_downtimes_by_scope_request.go b/api/v1/datadog/model_cancel_downtimes_by_scope_request.go new file mode 100644 index 00000000000..c45b0a4340b --- /dev/null +++ b/api/v1/datadog/model_cancel_downtimes_by_scope_request.go @@ -0,0 +1,105 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CancelDowntimesByScopeRequest Cancel downtimes according to scope. +type CancelDowntimesByScopeRequest struct { + // The scope(s) to which the downtime applies. For example, `host:app2`. + // Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. + // The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`). + Scope string `json:"scope"` + // 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{} +} + +// NewCancelDowntimesByScopeRequest instantiates a new CancelDowntimesByScopeRequest 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 NewCancelDowntimesByScopeRequest(scope string) *CancelDowntimesByScopeRequest { + this := CancelDowntimesByScopeRequest{} + this.Scope = scope + return &this +} + +// NewCancelDowntimesByScopeRequestWithDefaults instantiates a new CancelDowntimesByScopeRequest 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 NewCancelDowntimesByScopeRequestWithDefaults() *CancelDowntimesByScopeRequest { + this := CancelDowntimesByScopeRequest{} + return &this +} + +// GetScope returns the Scope field value. +func (o *CancelDowntimesByScopeRequest) GetScope() string { + if o == nil { + var ret string + return ret + } + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value +// and a boolean to check if the value has been set. +func (o *CancelDowntimesByScopeRequest) GetScopeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Scope, true +} + +// SetScope sets field value. +func (o *CancelDowntimesByScopeRequest) SetScope(v string) { + o.Scope = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CancelDowntimesByScopeRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["scope"] = o.Scope + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CancelDowntimesByScopeRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Scope *string `json:"scope"` + }{} + all := struct { + Scope string `json:"scope"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Scope == nil { + return fmt.Errorf("Required field scope missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Scope = all.Scope + return nil +} diff --git a/api/v1/datadog/model_canceled_downtimes_ids.go b/api/v1/datadog/model_canceled_downtimes_ids.go new file mode 100644 index 00000000000..e95ce9baa4b --- /dev/null +++ b/api/v1/datadog/model_canceled_downtimes_ids.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 datadog + +import ( + "encoding/json" +) + +// CanceledDowntimesIds Object containing array of IDs of canceled downtimes. +type CanceledDowntimesIds struct { + // ID of downtimes that were canceled. + CancelledIds []int64 `json:"cancelled_ids,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{} +} + +// NewCanceledDowntimesIds instantiates a new CanceledDowntimesIds 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 NewCanceledDowntimesIds() *CanceledDowntimesIds { + this := CanceledDowntimesIds{} + return &this +} + +// NewCanceledDowntimesIdsWithDefaults instantiates a new CanceledDowntimesIds 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 NewCanceledDowntimesIdsWithDefaults() *CanceledDowntimesIds { + this := CanceledDowntimesIds{} + return &this +} + +// GetCancelledIds returns the CancelledIds field value if set, zero value otherwise. +func (o *CanceledDowntimesIds) GetCancelledIds() []int64 { + if o == nil || o.CancelledIds == nil { + var ret []int64 + return ret + } + return o.CancelledIds +} + +// GetCancelledIdsOk returns a tuple with the CancelledIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CanceledDowntimesIds) GetCancelledIdsOk() (*[]int64, bool) { + if o == nil || o.CancelledIds == nil { + return nil, false + } + return &o.CancelledIds, true +} + +// HasCancelledIds returns a boolean if a field has been set. +func (o *CanceledDowntimesIds) HasCancelledIds() bool { + if o != nil && o.CancelledIds != nil { + return true + } + + return false +} + +// SetCancelledIds gets a reference to the given []int64 and assigns it to the CancelledIds field. +func (o *CanceledDowntimesIds) SetCancelledIds(v []int64) { + o.CancelledIds = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CanceledDowntimesIds) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CancelledIds != nil { + toSerialize["cancelled_ids"] = o.CancelledIds + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CanceledDowntimesIds) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CancelledIds []int64 `json:"cancelled_ids,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CancelledIds = all.CancelledIds + return nil +} diff --git a/api/v1/datadog/model_change_widget_definition.go b/api/v1/datadog/model_change_widget_definition.go new file mode 100644 index 00000000000..dc16bcb6cc0 --- /dev/null +++ b/api/v1/datadog/model_change_widget_definition.go @@ -0,0 +1,359 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ChangeWidgetDefinition The Change graph shows you the change in a value over the time period chosen. +type ChangeWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // Array of one request object to display in the widget. + // + // See the dedicated [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json) + // to learn how to build the `REQUEST_SCHEMA`. + Requests []ChangeWidgetRequest `json:"requests"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the change widget. + Type ChangeWidgetDefinitionType `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{} +} + +// NewChangeWidgetDefinition instantiates a new ChangeWidgetDefinition 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 NewChangeWidgetDefinition(requests []ChangeWidgetRequest, typeVar ChangeWidgetDefinitionType) *ChangeWidgetDefinition { + this := ChangeWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewChangeWidgetDefinitionWithDefaults instantiates a new ChangeWidgetDefinition 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 NewChangeWidgetDefinitionWithDefaults() *ChangeWidgetDefinition { + this := ChangeWidgetDefinition{} + var typeVar ChangeWidgetDefinitionType = CHANGEWIDGETDEFINITIONTYPE_CHANGE + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *ChangeWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *ChangeWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *ChangeWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetRequests returns the Requests field value. +func (o *ChangeWidgetDefinition) GetRequests() []ChangeWidgetRequest { + if o == nil { + var ret []ChangeWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *ChangeWidgetDefinition) GetRequestsOk() (*[]ChangeWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *ChangeWidgetDefinition) SetRequests(v []ChangeWidgetRequest) { + o.Requests = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *ChangeWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *ChangeWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *ChangeWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *ChangeWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *ChangeWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *ChangeWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *ChangeWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *ChangeWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *ChangeWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *ChangeWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *ChangeWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *ChangeWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *ChangeWidgetDefinition) GetType() ChangeWidgetDefinitionType { + if o == nil { + var ret ChangeWidgetDefinitionType + 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 *ChangeWidgetDefinition) GetTypeOk() (*ChangeWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ChangeWidgetDefinition) SetType(v ChangeWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ChangeWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + toSerialize["requests"] = o.Requests + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]ChangeWidgetRequest `json:"requests"` + Type *ChangeWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests []ChangeWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type ChangeWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.Requests = all.Requests + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_change_widget_definition_type.go b/api/v1/datadog/model_change_widget_definition_type.go new file mode 100644 index 00000000000..1c1af8f17f9 --- /dev/null +++ b/api/v1/datadog/model_change_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ChangeWidgetDefinitionType Type of the change widget. +type ChangeWidgetDefinitionType string + +// List of ChangeWidgetDefinitionType. +const ( + CHANGEWIDGETDEFINITIONTYPE_CHANGE ChangeWidgetDefinitionType = "change" +) + +var allowedChangeWidgetDefinitionTypeEnumValues = []ChangeWidgetDefinitionType{ + CHANGEWIDGETDEFINITIONTYPE_CHANGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ChangeWidgetDefinitionType) GetAllowedValues() []ChangeWidgetDefinitionType { + return allowedChangeWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ChangeWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ChangeWidgetDefinitionType(value) + return nil +} + +// NewChangeWidgetDefinitionTypeFromValue returns a pointer to a valid ChangeWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewChangeWidgetDefinitionTypeFromValue(v string) (*ChangeWidgetDefinitionType, error) { + ev := ChangeWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ChangeWidgetDefinitionType: valid values are %v", v, allowedChangeWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ChangeWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedChangeWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ChangeWidgetDefinitionType value. +func (v ChangeWidgetDefinitionType) Ptr() *ChangeWidgetDefinitionType { + return &v +} + +// NullableChangeWidgetDefinitionType handles when a null is used for ChangeWidgetDefinitionType. +type NullableChangeWidgetDefinitionType struct { + value *ChangeWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableChangeWidgetDefinitionType) Get() *ChangeWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableChangeWidgetDefinitionType) Set(val *ChangeWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableChangeWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableChangeWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableChangeWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableChangeWidgetDefinitionType(val *ChangeWidgetDefinitionType) *NullableChangeWidgetDefinitionType { + return &NullableChangeWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableChangeWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableChangeWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_change_widget_request.go b/api/v1/datadog/model_change_widget_request.go new file mode 100644 index 00000000000..68f6bd6c7f1 --- /dev/null +++ b/api/v1/datadog/model_change_widget_request.go @@ -0,0 +1,861 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ChangeWidgetRequest Updated change widget. +type ChangeWidgetRequest struct { + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // Show the absolute or the relative change. + ChangeType *WidgetChangeType `json:"change_type,omitempty"` + // Timeframe used for the change comparison. + CompareTo *WidgetCompareTo `json:"compare_to,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // Whether to show increase as good. + IncreaseGood *bool `json:"increase_good,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // What to order by. + OrderBy *WidgetOrderBy `json:"order_by,omitempty"` + // Widget sorting methods. + OrderDir *WidgetSort `json:"order_dir,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Query definition. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + // Whether to show the present value. + ShowPresent *bool `json:"show_present,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{} +} + +// NewChangeWidgetRequest instantiates a new ChangeWidgetRequest 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 NewChangeWidgetRequest() *ChangeWidgetRequest { + this := ChangeWidgetRequest{} + return &this +} + +// NewChangeWidgetRequestWithDefaults instantiates a new ChangeWidgetRequest 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 NewChangeWidgetRequestWithDefaults() *ChangeWidgetRequest { + this := ChangeWidgetRequest{} + return &this +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *ChangeWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetChangeType returns the ChangeType field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetChangeType() WidgetChangeType { + if o == nil || o.ChangeType == nil { + var ret WidgetChangeType + return ret + } + return *o.ChangeType +} + +// GetChangeTypeOk returns a tuple with the ChangeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetChangeTypeOk() (*WidgetChangeType, bool) { + if o == nil || o.ChangeType == nil { + return nil, false + } + return o.ChangeType, true +} + +// HasChangeType returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasChangeType() bool { + if o != nil && o.ChangeType != nil { + return true + } + + return false +} + +// SetChangeType gets a reference to the given WidgetChangeType and assigns it to the ChangeType field. +func (o *ChangeWidgetRequest) SetChangeType(v WidgetChangeType) { + o.ChangeType = &v +} + +// GetCompareTo returns the CompareTo field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetCompareTo() WidgetCompareTo { + if o == nil || o.CompareTo == nil { + var ret WidgetCompareTo + return ret + } + return *o.CompareTo +} + +// GetCompareToOk returns a tuple with the CompareTo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetCompareToOk() (*WidgetCompareTo, bool) { + if o == nil || o.CompareTo == nil { + return nil, false + } + return o.CompareTo, true +} + +// HasCompareTo returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasCompareTo() bool { + if o != nil && o.CompareTo != nil { + return true + } + + return false +} + +// SetCompareTo gets a reference to the given WidgetCompareTo and assigns it to the CompareTo field. +func (o *ChangeWidgetRequest) SetCompareTo(v WidgetCompareTo) { + o.CompareTo = &v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *ChangeWidgetRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *ChangeWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetIncreaseGood returns the IncreaseGood field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetIncreaseGood() bool { + if o == nil || o.IncreaseGood == nil { + var ret bool + return ret + } + return *o.IncreaseGood +} + +// GetIncreaseGoodOk returns a tuple with the IncreaseGood field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetIncreaseGoodOk() (*bool, bool) { + if o == nil || o.IncreaseGood == nil { + return nil, false + } + return o.IncreaseGood, true +} + +// HasIncreaseGood returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasIncreaseGood() bool { + if o != nil && o.IncreaseGood != nil { + return true + } + + return false +} + +// SetIncreaseGood gets a reference to the given bool and assigns it to the IncreaseGood field. +func (o *ChangeWidgetRequest) SetIncreaseGood(v bool) { + o.IncreaseGood = &v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *ChangeWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *ChangeWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetOrderBy returns the OrderBy field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetOrderBy() WidgetOrderBy { + if o == nil || o.OrderBy == nil { + var ret WidgetOrderBy + return ret + } + return *o.OrderBy +} + +// GetOrderByOk returns a tuple with the OrderBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetOrderByOk() (*WidgetOrderBy, bool) { + if o == nil || o.OrderBy == nil { + return nil, false + } + return o.OrderBy, true +} + +// HasOrderBy returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasOrderBy() bool { + if o != nil && o.OrderBy != nil { + return true + } + + return false +} + +// SetOrderBy gets a reference to the given WidgetOrderBy and assigns it to the OrderBy field. +func (o *ChangeWidgetRequest) SetOrderBy(v WidgetOrderBy) { + o.OrderBy = &v +} + +// GetOrderDir returns the OrderDir field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetOrderDir() WidgetSort { + if o == nil || o.OrderDir == nil { + var ret WidgetSort + return ret + } + return *o.OrderDir +} + +// GetOrderDirOk returns a tuple with the OrderDir field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetOrderDirOk() (*WidgetSort, bool) { + if o == nil || o.OrderDir == nil { + return nil, false + } + return o.OrderDir, true +} + +// HasOrderDir returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasOrderDir() bool { + if o != nil && o.OrderDir != nil { + return true + } + + return false +} + +// SetOrderDir gets a reference to the given WidgetSort and assigns it to the OrderDir field. +func (o *ChangeWidgetRequest) SetOrderDir(v WidgetSort) { + o.OrderDir = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *ChangeWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *ChangeWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *ChangeWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *ChangeWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *ChangeWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *ChangeWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *ChangeWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// GetShowPresent returns the ShowPresent field value if set, zero value otherwise. +func (o *ChangeWidgetRequest) GetShowPresent() bool { + if o == nil || o.ShowPresent == nil { + var ret bool + return ret + } + return *o.ShowPresent +} + +// GetShowPresentOk returns a tuple with the ShowPresent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChangeWidgetRequest) GetShowPresentOk() (*bool, bool) { + if o == nil || o.ShowPresent == nil { + return nil, false + } + return o.ShowPresent, true +} + +// HasShowPresent returns a boolean if a field has been set. +func (o *ChangeWidgetRequest) HasShowPresent() bool { + if o != nil && o.ShowPresent != nil { + return true + } + + return false +} + +// SetShowPresent gets a reference to the given bool and assigns it to the ShowPresent field. +func (o *ChangeWidgetRequest) SetShowPresent(v bool) { + o.ShowPresent = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ChangeWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.ChangeType != nil { + toSerialize["change_type"] = o.ChangeType + } + if o.CompareTo != nil { + toSerialize["compare_to"] = o.CompareTo + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.IncreaseGood != nil { + toSerialize["increase_good"] = o.IncreaseGood + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.OrderBy != nil { + toSerialize["order_by"] = o.OrderBy + } + if o.OrderDir != nil { + toSerialize["order_dir"] = o.OrderDir + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + if o.ShowPresent != nil { + toSerialize["show_present"] = o.ShowPresent + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ChangeWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + ChangeType *WidgetChangeType `json:"change_type,omitempty"` + CompareTo *WidgetCompareTo `json:"compare_to,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` + IncreaseGood *bool `json:"increase_good,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + OrderBy *WidgetOrderBy `json:"order_by,omitempty"` + OrderDir *WidgetSort `json:"order_dir,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + ShowPresent *bool `json:"show_present,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ChangeType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.CompareTo; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.OrderBy; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.OrderDir; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + o.ChangeType = all.ChangeType + o.CompareTo = all.CompareTo + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + o.Formulas = all.Formulas + o.IncreaseGood = all.IncreaseGood + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + o.OrderBy = all.OrderBy + o.OrderDir = all.OrderDir + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + o.ShowPresent = all.ShowPresent + return nil +} diff --git a/api/v1/datadog/model_check_can_delete_monitor_response.go b/api/v1/datadog/model_check_can_delete_monitor_response.go new file mode 100644 index 00000000000..f4d699b15b9 --- /dev/null +++ b/api/v1/datadog/model_check_can_delete_monitor_response.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CheckCanDeleteMonitorResponse Response of monitor IDs that can or can't be safely deleted. +type CheckCanDeleteMonitorResponse struct { + // Wrapper object with the list of monitor IDs. + Data CheckCanDeleteMonitorResponseData `json:"data"` + // A mapping of Monitor ID to strings denoting where it's used. + Errors map[string][]string `json:"errors,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{} +} + +// NewCheckCanDeleteMonitorResponse instantiates a new CheckCanDeleteMonitorResponse 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 NewCheckCanDeleteMonitorResponse(data CheckCanDeleteMonitorResponseData) *CheckCanDeleteMonitorResponse { + this := CheckCanDeleteMonitorResponse{} + this.Data = data + return &this +} + +// NewCheckCanDeleteMonitorResponseWithDefaults instantiates a new CheckCanDeleteMonitorResponse 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 NewCheckCanDeleteMonitorResponseWithDefaults() *CheckCanDeleteMonitorResponse { + this := CheckCanDeleteMonitorResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *CheckCanDeleteMonitorResponse) GetData() CheckCanDeleteMonitorResponseData { + if o == nil { + var ret CheckCanDeleteMonitorResponseData + 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 *CheckCanDeleteMonitorResponse) GetDataOk() (*CheckCanDeleteMonitorResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CheckCanDeleteMonitorResponse) SetData(v CheckCanDeleteMonitorResponseData) { + o.Data = v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *CheckCanDeleteMonitorResponse) GetErrors() map[string][]string { + if o == nil || o.Errors == nil { + var ret map[string][]string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckCanDeleteMonitorResponse) GetErrorsOk() (*map[string][]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *CheckCanDeleteMonitorResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given map[string][]string and assigns it to the Errors field. +func (o *CheckCanDeleteMonitorResponse) SetErrors(v map[string][]string) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CheckCanDeleteMonitorResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CheckCanDeleteMonitorResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *CheckCanDeleteMonitorResponseData `json:"data"` + }{} + all := struct { + Data CheckCanDeleteMonitorResponseData `json:"data"` + Errors map[string][]string `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Errors = all.Errors + return nil +} diff --git a/api/v1/datadog/model_check_can_delete_monitor_response_data.go b/api/v1/datadog/model_check_can_delete_monitor_response_data.go new file mode 100644 index 00000000000..3077013a2b8 --- /dev/null +++ b/api/v1/datadog/model_check_can_delete_monitor_response_data.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 datadog + +import ( + "encoding/json" +) + +// CheckCanDeleteMonitorResponseData Wrapper object with the list of monitor IDs. +type CheckCanDeleteMonitorResponseData struct { + // An array of of Monitor IDs that can be safely deleted. + Ok []int64 `json:"ok,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{} +} + +// NewCheckCanDeleteMonitorResponseData instantiates a new CheckCanDeleteMonitorResponseData 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 NewCheckCanDeleteMonitorResponseData() *CheckCanDeleteMonitorResponseData { + this := CheckCanDeleteMonitorResponseData{} + return &this +} + +// NewCheckCanDeleteMonitorResponseDataWithDefaults instantiates a new CheckCanDeleteMonitorResponseData 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 NewCheckCanDeleteMonitorResponseDataWithDefaults() *CheckCanDeleteMonitorResponseData { + this := CheckCanDeleteMonitorResponseData{} + return &this +} + +// GetOk returns the Ok field value if set, zero value otherwise. +func (o *CheckCanDeleteMonitorResponseData) GetOk() []int64 { + if o == nil || o.Ok == nil { + var ret []int64 + return ret + } + return o.Ok +} + +// GetOkOk returns a tuple with the Ok field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckCanDeleteMonitorResponseData) GetOkOk() (*[]int64, bool) { + if o == nil || o.Ok == nil { + return nil, false + } + return &o.Ok, true +} + +// HasOk returns a boolean if a field has been set. +func (o *CheckCanDeleteMonitorResponseData) HasOk() bool { + if o != nil && o.Ok != nil { + return true + } + + return false +} + +// SetOk gets a reference to the given []int64 and assigns it to the Ok field. +func (o *CheckCanDeleteMonitorResponseData) SetOk(v []int64) { + o.Ok = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CheckCanDeleteMonitorResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Ok != nil { + toSerialize["ok"] = o.Ok + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CheckCanDeleteMonitorResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Ok []int64 `json:"ok,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Ok = all.Ok + return nil +} diff --git a/api/v1/datadog/model_check_can_delete_slo_response.go b/api/v1/datadog/model_check_can_delete_slo_response.go new file mode 100644 index 00000000000..1db481b8e6e --- /dev/null +++ b/api/v1/datadog/model_check_can_delete_slo_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 datadog + +import ( + "encoding/json" +) + +// CheckCanDeleteSLOResponse A service level objective response containing the requested object. +type CheckCanDeleteSLOResponse struct { + // An array of service level objective objects. + Data *CheckCanDeleteSLOResponseData `json:"data,omitempty"` + // A mapping of SLO id to it's current usages. + Errors map[string]string `json:"errors,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{} +} + +// NewCheckCanDeleteSLOResponse instantiates a new CheckCanDeleteSLOResponse 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 NewCheckCanDeleteSLOResponse() *CheckCanDeleteSLOResponse { + this := CheckCanDeleteSLOResponse{} + return &this +} + +// NewCheckCanDeleteSLOResponseWithDefaults instantiates a new CheckCanDeleteSLOResponse 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 NewCheckCanDeleteSLOResponseWithDefaults() *CheckCanDeleteSLOResponse { + this := CheckCanDeleteSLOResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CheckCanDeleteSLOResponse) GetData() CheckCanDeleteSLOResponseData { + if o == nil || o.Data == nil { + var ret CheckCanDeleteSLOResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckCanDeleteSLOResponse) GetDataOk() (*CheckCanDeleteSLOResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CheckCanDeleteSLOResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given CheckCanDeleteSLOResponseData and assigns it to the Data field. +func (o *CheckCanDeleteSLOResponse) SetData(v CheckCanDeleteSLOResponseData) { + o.Data = &v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *CheckCanDeleteSLOResponse) GetErrors() map[string]string { + if o == nil || o.Errors == nil { + var ret map[string]string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckCanDeleteSLOResponse) GetErrorsOk() (*map[string]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *CheckCanDeleteSLOResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given map[string]string and assigns it to the Errors field. +func (o *CheckCanDeleteSLOResponse) SetErrors(v map[string]string) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CheckCanDeleteSLOResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CheckCanDeleteSLOResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *CheckCanDeleteSLOResponseData `json:"data,omitempty"` + Errors map[string]string `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Errors = all.Errors + return nil +} diff --git a/api/v1/datadog/model_check_can_delete_slo_response_data.go b/api/v1/datadog/model_check_can_delete_slo_response_data.go new file mode 100644 index 00000000000..5ed74f61890 --- /dev/null +++ b/api/v1/datadog/model_check_can_delete_slo_response_data.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 datadog + +import ( + "encoding/json" +) + +// CheckCanDeleteSLOResponseData An array of service level objective objects. +type CheckCanDeleteSLOResponseData struct { + // An array of of SLO IDs that can be safely deleted. + Ok []string `json:"ok,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{} +} + +// NewCheckCanDeleteSLOResponseData instantiates a new CheckCanDeleteSLOResponseData 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 NewCheckCanDeleteSLOResponseData() *CheckCanDeleteSLOResponseData { + this := CheckCanDeleteSLOResponseData{} + return &this +} + +// NewCheckCanDeleteSLOResponseDataWithDefaults instantiates a new CheckCanDeleteSLOResponseData 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 NewCheckCanDeleteSLOResponseDataWithDefaults() *CheckCanDeleteSLOResponseData { + this := CheckCanDeleteSLOResponseData{} + return &this +} + +// GetOk returns the Ok field value if set, zero value otherwise. +func (o *CheckCanDeleteSLOResponseData) GetOk() []string { + if o == nil || o.Ok == nil { + var ret []string + return ret + } + return o.Ok +} + +// GetOkOk returns a tuple with the Ok field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckCanDeleteSLOResponseData) GetOkOk() (*[]string, bool) { + if o == nil || o.Ok == nil { + return nil, false + } + return &o.Ok, true +} + +// HasOk returns a boolean if a field has been set. +func (o *CheckCanDeleteSLOResponseData) HasOk() bool { + if o != nil && o.Ok != nil { + return true + } + + return false +} + +// SetOk gets a reference to the given []string and assigns it to the Ok field. +func (o *CheckCanDeleteSLOResponseData) SetOk(v []string) { + o.Ok = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CheckCanDeleteSLOResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Ok != nil { + toSerialize["ok"] = o.Ok + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CheckCanDeleteSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Ok []string `json:"ok,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Ok = all.Ok + return nil +} diff --git a/api/v1/datadog/model_check_status_widget_definition.go b/api/v1/datadog/model_check_status_widget_definition.go new file mode 100644 index 00000000000..f8056530dd5 --- /dev/null +++ b/api/v1/datadog/model_check_status_widget_definition.go @@ -0,0 +1,475 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CheckStatusWidgetDefinition Check status shows the current status or number of results for any check performed. +type CheckStatusWidgetDefinition struct { + // Name of the check to use in the widget. + Check string `json:"check"` + // Group reporting a single check. + Group *string `json:"group,omitempty"` + // List of tag prefixes to group by in the case of a cluster check. + GroupBy []string `json:"group_by,omitempty"` + // The kind of grouping to use. + Grouping WidgetGrouping `json:"grouping"` + // List of tags used to filter the groups reporting a cluster check. + Tags []string `json:"tags,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the check status widget. + Type CheckStatusWidgetDefinitionType `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{} +} + +// NewCheckStatusWidgetDefinition instantiates a new CheckStatusWidgetDefinition 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 NewCheckStatusWidgetDefinition(check string, grouping WidgetGrouping, typeVar CheckStatusWidgetDefinitionType) *CheckStatusWidgetDefinition { + this := CheckStatusWidgetDefinition{} + this.Check = check + this.Grouping = grouping + this.Type = typeVar + return &this +} + +// NewCheckStatusWidgetDefinitionWithDefaults instantiates a new CheckStatusWidgetDefinition 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 NewCheckStatusWidgetDefinitionWithDefaults() *CheckStatusWidgetDefinition { + this := CheckStatusWidgetDefinition{} + var typeVar CheckStatusWidgetDefinitionType = CHECKSTATUSWIDGETDEFINITIONTYPE_CHECK_STATUS + this.Type = typeVar + return &this +} + +// GetCheck returns the Check field value. +func (o *CheckStatusWidgetDefinition) GetCheck() string { + if o == nil { + var ret string + return ret + } + return o.Check +} + +// GetCheckOk returns a tuple with the Check field value +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetCheckOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Check, true +} + +// SetCheck sets field value. +func (o *CheckStatusWidgetDefinition) SetCheck(v string) { + o.Check = v +} + +// GetGroup returns the Group field value if set, zero value otherwise. +func (o *CheckStatusWidgetDefinition) GetGroup() string { + if o == nil || o.Group == nil { + var ret string + return ret + } + return *o.Group +} + +// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetGroupOk() (*string, bool) { + if o == nil || o.Group == nil { + return nil, false + } + return o.Group, true +} + +// HasGroup returns a boolean if a field has been set. +func (o *CheckStatusWidgetDefinition) HasGroup() bool { + if o != nil && o.Group != nil { + return true + } + + return false +} + +// SetGroup gets a reference to the given string and assigns it to the Group field. +func (o *CheckStatusWidgetDefinition) SetGroup(v string) { + o.Group = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *CheckStatusWidgetDefinition) GetGroupBy() []string { + if o == nil || o.GroupBy == nil { + var ret []string + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetGroupByOk() (*[]string, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *CheckStatusWidgetDefinition) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. +func (o *CheckStatusWidgetDefinition) SetGroupBy(v []string) { + o.GroupBy = v +} + +// GetGrouping returns the Grouping field value. +func (o *CheckStatusWidgetDefinition) GetGrouping() WidgetGrouping { + if o == nil { + var ret WidgetGrouping + return ret + } + return o.Grouping +} + +// GetGroupingOk returns a tuple with the Grouping field value +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetGroupingOk() (*WidgetGrouping, bool) { + if o == nil { + return nil, false + } + return &o.Grouping, true +} + +// SetGrouping sets field value. +func (o *CheckStatusWidgetDefinition) SetGrouping(v WidgetGrouping) { + o.Grouping = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *CheckStatusWidgetDefinition) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *CheckStatusWidgetDefinition) GetTagsOk() (*[]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 *CheckStatusWidgetDefinition) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *CheckStatusWidgetDefinition) SetTags(v []string) { + o.Tags = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *CheckStatusWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *CheckStatusWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *CheckStatusWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CheckStatusWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CheckStatusWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CheckStatusWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *CheckStatusWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *CheckStatusWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *CheckStatusWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *CheckStatusWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckStatusWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *CheckStatusWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *CheckStatusWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *CheckStatusWidgetDefinition) GetType() CheckStatusWidgetDefinitionType { + if o == nil { + var ret CheckStatusWidgetDefinitionType + 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 *CheckStatusWidgetDefinition) GetTypeOk() (*CheckStatusWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CheckStatusWidgetDefinition) SetType(v CheckStatusWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CheckStatusWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["check"] = o.Check + if o.Group != nil { + toSerialize["group"] = o.Group + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + toSerialize["grouping"] = o.Grouping + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Check *string `json:"check"` + Grouping *WidgetGrouping `json:"grouping"` + Type *CheckStatusWidgetDefinitionType `json:"type"` + }{} + all := struct { + Check string `json:"check"` + Group *string `json:"group,omitempty"` + GroupBy []string `json:"group_by,omitempty"` + Grouping WidgetGrouping `json:"grouping"` + Tags []string `json:"tags,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type CheckStatusWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Check == nil { + return fmt.Errorf("Required field check missing") + } + if required.Grouping == nil { + return fmt.Errorf("Required field grouping missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Grouping; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Check = all.Check + o.Group = all.Group + o.GroupBy = all.GroupBy + o.Grouping = all.Grouping + o.Tags = all.Tags + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_check_status_widget_definition_type.go b/api/v1/datadog/model_check_status_widget_definition_type.go new file mode 100644 index 00000000000..f54da27b8ff --- /dev/null +++ b/api/v1/datadog/model_check_status_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CheckStatusWidgetDefinitionType Type of the check status widget. +type CheckStatusWidgetDefinitionType string + +// List of CheckStatusWidgetDefinitionType. +const ( + CHECKSTATUSWIDGETDEFINITIONTYPE_CHECK_STATUS CheckStatusWidgetDefinitionType = "check_status" +) + +var allowedCheckStatusWidgetDefinitionTypeEnumValues = []CheckStatusWidgetDefinitionType{ + CHECKSTATUSWIDGETDEFINITIONTYPE_CHECK_STATUS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CheckStatusWidgetDefinitionType) GetAllowedValues() []CheckStatusWidgetDefinitionType { + return allowedCheckStatusWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CheckStatusWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CheckStatusWidgetDefinitionType(value) + return nil +} + +// NewCheckStatusWidgetDefinitionTypeFromValue returns a pointer to a valid CheckStatusWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCheckStatusWidgetDefinitionTypeFromValue(v string) (*CheckStatusWidgetDefinitionType, error) { + ev := CheckStatusWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CheckStatusWidgetDefinitionType: valid values are %v", v, allowedCheckStatusWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CheckStatusWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedCheckStatusWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CheckStatusWidgetDefinitionType value. +func (v CheckStatusWidgetDefinitionType) Ptr() *CheckStatusWidgetDefinitionType { + return &v +} + +// NullableCheckStatusWidgetDefinitionType handles when a null is used for CheckStatusWidgetDefinitionType. +type NullableCheckStatusWidgetDefinitionType struct { + value *CheckStatusWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableCheckStatusWidgetDefinitionType) Get() *CheckStatusWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableCheckStatusWidgetDefinitionType) Set(val *CheckStatusWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableCheckStatusWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableCheckStatusWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableCheckStatusWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableCheckStatusWidgetDefinitionType(val *CheckStatusWidgetDefinitionType) *NullableCheckStatusWidgetDefinitionType { + return &NullableCheckStatusWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableCheckStatusWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableCheckStatusWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_content_encoding.go b/api/v1/datadog/model_content_encoding.go new file mode 100644 index 00000000000..96c002db1df --- /dev/null +++ b/api/v1/datadog/model_content_encoding.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ContentEncoding HTTP header used to compress the media-type. +type ContentEncoding string + +// List of ContentEncoding. +const ( + CONTENTENCODING_GZIP ContentEncoding = "gzip" + CONTENTENCODING_DEFLATE ContentEncoding = "deflate" +) + +var allowedContentEncodingEnumValues = []ContentEncoding{ + CONTENTENCODING_GZIP, + CONTENTENCODING_DEFLATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ContentEncoding) GetAllowedValues() []ContentEncoding { + return allowedContentEncodingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ContentEncoding) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ContentEncoding(value) + return nil +} + +// NewContentEncodingFromValue returns a pointer to a valid ContentEncoding +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewContentEncodingFromValue(v string) (*ContentEncoding, error) { + ev := ContentEncoding(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ContentEncoding: valid values are %v", v, allowedContentEncodingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ContentEncoding) IsValid() bool { + for _, existing := range allowedContentEncodingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ContentEncoding value. +func (v ContentEncoding) Ptr() *ContentEncoding { + return &v +} + +// NullableContentEncoding handles when a null is used for ContentEncoding. +type NullableContentEncoding struct { + value *ContentEncoding + isSet bool +} + +// Get returns the associated value. +func (v NullableContentEncoding) Get() *ContentEncoding { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableContentEncoding) Set(val *ContentEncoding) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableContentEncoding) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableContentEncoding) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableContentEncoding initializes the struct as if Set has been called. +func NewNullableContentEncoding(val *ContentEncoding) *NullableContentEncoding { + return &NullableContentEncoding{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableContentEncoding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableContentEncoding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_creator.go b/api/v1/datadog/model_creator.go new file mode 100644 index 00000000000..36727914b60 --- /dev/null +++ b/api/v1/datadog/model_creator.go @@ -0,0 +1,193 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// Creator Object describing the creator of the shared element. +type Creator struct { + // Email of the creator. + Email *string `json:"email,omitempty"` + // Handle of the creator. + Handle *string `json:"handle,omitempty"` + // Name of the creator. + Name common.NullableString `json:"name,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{} +} + +// NewCreator instantiates a new Creator 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 NewCreator() *Creator { + this := Creator{} + return &this +} + +// NewCreatorWithDefaults instantiates a new Creator 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 NewCreatorWithDefaults() *Creator { + this := Creator{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *Creator) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Creator) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *Creator) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *Creator) SetEmail(v string) { + o.Email = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *Creator) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Creator) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *Creator) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *Creator) SetHandle(v string) { + o.Handle = &v +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Creator) GetName() string { + if o == nil || o.Name.Get() == nil { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *Creator) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *Creator) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given common.NullableString and assigns it to the Name field. +func (o *Creator) SetName(v string) { + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil. +func (o *Creator) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil. +func (o *Creator) UnsetName() { + o.Name.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o Creator) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Name common.NullableString `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Email = all.Email + o.Handle = all.Handle + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_dashboard.go b/api/v1/datadog/model_dashboard.go new file mode 100644 index 00000000000..9743306c2a0 --- /dev/null +++ b/api/v1/datadog/model_dashboard.go @@ -0,0 +1,739 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// Dashboard A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying +// key performance metrics, which enable you to monitor the health of your infrastructure. +type Dashboard struct { + // Identifier of the dashboard author. + AuthorHandle *string `json:"author_handle,omitempty"` + // Name of the dashboard author. + AuthorName common.NullableString `json:"author_name,omitempty"` + // Creation date of the dashboard. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Description of the dashboard. + Description common.NullableString `json:"description,omitempty"` + // ID of the dashboard. + Id *string `json:"id,omitempty"` + // Whether this dashboard is read-only. If True, only the author and admins can make changes to it. Prefer using `restricted_roles` to manage write authorization. + // Deprecated + IsReadOnly *bool `json:"is_read_only,omitempty"` + // Layout type of the dashboard. + LayoutType DashboardLayoutType `json:"layout_type"` + // Modification date of the dashboard. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // List of handles of users to notify when changes are made to this dashboard. + NotifyList []string `json:"notify_list,omitempty"` + // Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'. + // If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto', + // widgets should not have layouts. + ReflowType *DashboardReflowType `json:"reflow_type,omitempty"` + // A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard. + RestrictedRoles []string `json:"restricted_roles,omitempty"` + // Array of template variables saved views. + TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"` + // List of template variables for this dashboard. + TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"` + // Title of the dashboard. + Title string `json:"title"` + // The URL of the dashboard. + Url *string `json:"url,omitempty"` + // List of widgets to display on the dashboard. + Widgets []Widget `json:"widgets"` + // 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{} +} + +// NewDashboard instantiates a new Dashboard 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 NewDashboard(layoutType DashboardLayoutType, title string, widgets []Widget) *Dashboard { + this := Dashboard{} + var isReadOnly bool = false + this.IsReadOnly = &isReadOnly + this.LayoutType = layoutType + this.Title = title + this.Widgets = widgets + return &this +} + +// NewDashboardWithDefaults instantiates a new Dashboard 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 NewDashboardWithDefaults() *Dashboard { + this := Dashboard{} + var isReadOnly bool = false + this.IsReadOnly = &isReadOnly + return &this +} + +// GetAuthorHandle returns the AuthorHandle field value if set, zero value otherwise. +func (o *Dashboard) GetAuthorHandle() string { + if o == nil || o.AuthorHandle == nil { + var ret string + return ret + } + return *o.AuthorHandle +} + +// GetAuthorHandleOk returns a tuple with the AuthorHandle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dashboard) GetAuthorHandleOk() (*string, bool) { + if o == nil || o.AuthorHandle == nil { + return nil, false + } + return o.AuthorHandle, true +} + +// HasAuthorHandle returns a boolean if a field has been set. +func (o *Dashboard) HasAuthorHandle() bool { + if o != nil && o.AuthorHandle != nil { + return true + } + + return false +} + +// SetAuthorHandle gets a reference to the given string and assigns it to the AuthorHandle field. +func (o *Dashboard) SetAuthorHandle(v string) { + o.AuthorHandle = &v +} + +// GetAuthorName returns the AuthorName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Dashboard) GetAuthorName() string { + if o == nil || o.AuthorName.Get() == nil { + var ret string + return ret + } + return *o.AuthorName.Get() +} + +// GetAuthorNameOk returns a tuple with the AuthorName 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 *Dashboard) GetAuthorNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AuthorName.Get(), o.AuthorName.IsSet() +} + +// HasAuthorName returns a boolean if a field has been set. +func (o *Dashboard) HasAuthorName() bool { + if o != nil && o.AuthorName.IsSet() { + return true + } + + return false +} + +// SetAuthorName gets a reference to the given common.NullableString and assigns it to the AuthorName field. +func (o *Dashboard) SetAuthorName(v string) { + o.AuthorName.Set(&v) +} + +// SetAuthorNameNil sets the value for AuthorName to be an explicit nil. +func (o *Dashboard) SetAuthorNameNil() { + o.AuthorName.Set(nil) +} + +// UnsetAuthorName ensures that no value is present for AuthorName, not even an explicit nil. +func (o *Dashboard) UnsetAuthorName() { + o.AuthorName.Unset() +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Dashboard) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dashboard) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Dashboard) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Dashboard) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Dashboard) GetDescription() string { + if o == nil || o.Description.Get() == nil { + var ret string + return ret + } + return *o.Description.Get() +} + +// GetDescriptionOk returns a tuple with the Description 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 *Dashboard) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description.Get(), o.Description.IsSet() +} + +// HasDescription returns a boolean if a field has been set. +func (o *Dashboard) HasDescription() bool { + if o != nil && o.Description.IsSet() { + return true + } + + return false +} + +// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. +func (o *Dashboard) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *Dashboard) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *Dashboard) UnsetDescription() { + o.Description.Unset() +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Dashboard) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dashboard) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Dashboard) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Dashboard) SetId(v string) { + o.Id = &v +} + +// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. +// Deprecated +func (o *Dashboard) GetIsReadOnly() bool { + if o == nil || o.IsReadOnly == nil { + var ret bool + return ret + } + return *o.IsReadOnly +} + +// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *Dashboard) GetIsReadOnlyOk() (*bool, bool) { + if o == nil || o.IsReadOnly == nil { + return nil, false + } + return o.IsReadOnly, true +} + +// HasIsReadOnly returns a boolean if a field has been set. +func (o *Dashboard) HasIsReadOnly() bool { + if o != nil && o.IsReadOnly != nil { + return true + } + + return false +} + +// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. +// Deprecated +func (o *Dashboard) SetIsReadOnly(v bool) { + o.IsReadOnly = &v +} + +// GetLayoutType returns the LayoutType field value. +func (o *Dashboard) GetLayoutType() DashboardLayoutType { + if o == nil { + var ret DashboardLayoutType + return ret + } + return o.LayoutType +} + +// GetLayoutTypeOk returns a tuple with the LayoutType field value +// and a boolean to check if the value has been set. +func (o *Dashboard) GetLayoutTypeOk() (*DashboardLayoutType, bool) { + if o == nil { + return nil, false + } + return &o.LayoutType, true +} + +// SetLayoutType sets field value. +func (o *Dashboard) SetLayoutType(v DashboardLayoutType) { + o.LayoutType = v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *Dashboard) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dashboard) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *Dashboard) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *Dashboard) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetNotifyList returns the NotifyList field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Dashboard) GetNotifyList() []string { + if o == nil { + var ret []string + return ret + } + return o.NotifyList +} + +// GetNotifyListOk returns a tuple with the NotifyList 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 *Dashboard) GetNotifyListOk() (*[]string, bool) { + if o == nil || o.NotifyList == nil { + return nil, false + } + return &o.NotifyList, true +} + +// HasNotifyList returns a boolean if a field has been set. +func (o *Dashboard) HasNotifyList() bool { + if o != nil && o.NotifyList != nil { + return true + } + + return false +} + +// SetNotifyList gets a reference to the given []string and assigns it to the NotifyList field. +func (o *Dashboard) SetNotifyList(v []string) { + o.NotifyList = v +} + +// GetReflowType returns the ReflowType field value if set, zero value otherwise. +func (o *Dashboard) GetReflowType() DashboardReflowType { + if o == nil || o.ReflowType == nil { + var ret DashboardReflowType + return ret + } + return *o.ReflowType +} + +// GetReflowTypeOk returns a tuple with the ReflowType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dashboard) GetReflowTypeOk() (*DashboardReflowType, bool) { + if o == nil || o.ReflowType == nil { + return nil, false + } + return o.ReflowType, true +} + +// HasReflowType returns a boolean if a field has been set. +func (o *Dashboard) HasReflowType() bool { + if o != nil && o.ReflowType != nil { + return true + } + + return false +} + +// SetReflowType gets a reference to the given DashboardReflowType and assigns it to the ReflowType field. +func (o *Dashboard) SetReflowType(v DashboardReflowType) { + o.ReflowType = &v +} + +// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. +func (o *Dashboard) GetRestrictedRoles() []string { + if o == nil || o.RestrictedRoles == nil { + var ret []string + return ret + } + return o.RestrictedRoles +} + +// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dashboard) GetRestrictedRolesOk() (*[]string, bool) { + if o == nil || o.RestrictedRoles == nil { + return nil, false + } + return &o.RestrictedRoles, true +} + +// HasRestrictedRoles returns a boolean if a field has been set. +func (o *Dashboard) HasRestrictedRoles() bool { + if o != nil && o.RestrictedRoles != nil { + return true + } + + return false +} + +// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. +func (o *Dashboard) SetRestrictedRoles(v []string) { + o.RestrictedRoles = v +} + +// GetTemplateVariablePresets returns the TemplateVariablePresets field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Dashboard) GetTemplateVariablePresets() []DashboardTemplateVariablePreset { + if o == nil { + var ret []DashboardTemplateVariablePreset + return ret + } + return o.TemplateVariablePresets +} + +// GetTemplateVariablePresetsOk returns a tuple with the TemplateVariablePresets 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 *Dashboard) GetTemplateVariablePresetsOk() (*[]DashboardTemplateVariablePreset, bool) { + if o == nil || o.TemplateVariablePresets == nil { + return nil, false + } + return &o.TemplateVariablePresets, true +} + +// HasTemplateVariablePresets returns a boolean if a field has been set. +func (o *Dashboard) HasTemplateVariablePresets() bool { + if o != nil && o.TemplateVariablePresets != nil { + return true + } + + return false +} + +// SetTemplateVariablePresets gets a reference to the given []DashboardTemplateVariablePreset and assigns it to the TemplateVariablePresets field. +func (o *Dashboard) SetTemplateVariablePresets(v []DashboardTemplateVariablePreset) { + o.TemplateVariablePresets = v +} + +// GetTemplateVariables returns the TemplateVariables field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Dashboard) GetTemplateVariables() []DashboardTemplateVariable { + if o == nil { + var ret []DashboardTemplateVariable + return ret + } + return o.TemplateVariables +} + +// GetTemplateVariablesOk returns a tuple with the TemplateVariables 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 *Dashboard) GetTemplateVariablesOk() (*[]DashboardTemplateVariable, bool) { + if o == nil || o.TemplateVariables == nil { + return nil, false + } + return &o.TemplateVariables, true +} + +// HasTemplateVariables returns a boolean if a field has been set. +func (o *Dashboard) HasTemplateVariables() bool { + if o != nil && o.TemplateVariables != nil { + return true + } + + return false +} + +// SetTemplateVariables gets a reference to the given []DashboardTemplateVariable and assigns it to the TemplateVariables field. +func (o *Dashboard) SetTemplateVariables(v []DashboardTemplateVariable) { + o.TemplateVariables = v +} + +// GetTitle returns the Title field value. +func (o *Dashboard) GetTitle() string { + if o == nil { + var ret string + return ret + } + return o.Title +} + +// GetTitleOk returns a tuple with the Title field value +// and a boolean to check if the value has been set. +func (o *Dashboard) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Title, true +} + +// SetTitle sets field value. +func (o *Dashboard) SetTitle(v string) { + o.Title = v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *Dashboard) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dashboard) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *Dashboard) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *Dashboard) SetUrl(v string) { + o.Url = &v +} + +// GetWidgets returns the Widgets field value. +func (o *Dashboard) GetWidgets() []Widget { + if o == nil { + var ret []Widget + return ret + } + return o.Widgets +} + +// GetWidgetsOk returns a tuple with the Widgets field value +// and a boolean to check if the value has been set. +func (o *Dashboard) GetWidgetsOk() (*[]Widget, bool) { + if o == nil { + return nil, false + } + return &o.Widgets, true +} + +// SetWidgets sets field value. +func (o *Dashboard) SetWidgets(v []Widget) { + o.Widgets = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Dashboard) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AuthorHandle != nil { + toSerialize["author_handle"] = o.AuthorHandle + } + if o.AuthorName.IsSet() { + toSerialize["author_name"] = o.AuthorName.Get() + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IsReadOnly != nil { + toSerialize["is_read_only"] = o.IsReadOnly + } + toSerialize["layout_type"] = o.LayoutType + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.NotifyList != nil { + toSerialize["notify_list"] = o.NotifyList + } + if o.ReflowType != nil { + toSerialize["reflow_type"] = o.ReflowType + } + if o.RestrictedRoles != nil { + toSerialize["restricted_roles"] = o.RestrictedRoles + } + if o.TemplateVariablePresets != nil { + toSerialize["template_variable_presets"] = o.TemplateVariablePresets + } + if o.TemplateVariables != nil { + toSerialize["template_variables"] = o.TemplateVariables + } + toSerialize["title"] = o.Title + if o.Url != nil { + toSerialize["url"] = o.Url + } + toSerialize["widgets"] = o.Widgets + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + LayoutType *DashboardLayoutType `json:"layout_type"` + Title *string `json:"title"` + Widgets *[]Widget `json:"widgets"` + }{} + all := struct { + AuthorHandle *string `json:"author_handle,omitempty"` + AuthorName common.NullableString `json:"author_name,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Description common.NullableString `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + IsReadOnly *bool `json:"is_read_only,omitempty"` + LayoutType DashboardLayoutType `json:"layout_type"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + NotifyList []string `json:"notify_list,omitempty"` + ReflowType *DashboardReflowType `json:"reflow_type,omitempty"` + RestrictedRoles []string `json:"restricted_roles,omitempty"` + TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"` + TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"` + Title string `json:"title"` + Url *string `json:"url,omitempty"` + Widgets []Widget `json:"widgets"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.LayoutType == nil { + return fmt.Errorf("Required field layout_type missing") + } + if required.Title == nil { + return fmt.Errorf("Required field title missing") + } + if required.Widgets == nil { + return fmt.Errorf("Required field widgets missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LayoutType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ReflowType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AuthorHandle = all.AuthorHandle + o.AuthorName = all.AuthorName + o.CreatedAt = all.CreatedAt + o.Description = all.Description + o.Id = all.Id + o.IsReadOnly = all.IsReadOnly + o.LayoutType = all.LayoutType + o.ModifiedAt = all.ModifiedAt + o.NotifyList = all.NotifyList + o.ReflowType = all.ReflowType + o.RestrictedRoles = all.RestrictedRoles + o.TemplateVariablePresets = all.TemplateVariablePresets + o.TemplateVariables = all.TemplateVariables + o.Title = all.Title + o.Url = all.Url + o.Widgets = all.Widgets + return nil +} diff --git a/api/v1/datadog/model_dashboard_bulk_action_data.go b/api/v1/datadog/model_dashboard_bulk_action_data.go new file mode 100644 index 00000000000..454e541aea6 --- /dev/null +++ b/api/v1/datadog/model_dashboard_bulk_action_data.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardBulkActionData Dashboard bulk action request data. +type DashboardBulkActionData struct { + // Dashboard resource ID. + Id string `json:"id"` + // Dashboard resource type. + Type DashboardResourceType `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{} +} + +// NewDashboardBulkActionData instantiates a new DashboardBulkActionData 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 NewDashboardBulkActionData(id string, typeVar DashboardResourceType) *DashboardBulkActionData { + this := DashboardBulkActionData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewDashboardBulkActionDataWithDefaults instantiates a new DashboardBulkActionData 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 NewDashboardBulkActionDataWithDefaults() *DashboardBulkActionData { + this := DashboardBulkActionData{} + var typeVar DashboardResourceType = DASHBOARDRESOURCETYPE_DASHBOARD + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *DashboardBulkActionData) 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 *DashboardBulkActionData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DashboardBulkActionData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *DashboardBulkActionData) GetType() DashboardResourceType { + if o == nil { + var ret DashboardResourceType + 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 *DashboardBulkActionData) GetTypeOk() (*DashboardResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DashboardBulkActionData) SetType(v DashboardResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardBulkActionData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardBulkActionData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *DashboardResourceType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type DashboardResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_dashboard_bulk_delete_request.go b/api/v1/datadog/model_dashboard_bulk_delete_request.go new file mode 100644 index 00000000000..d5567b23ddb --- /dev/null +++ b/api/v1/datadog/model_dashboard_bulk_delete_request.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardBulkDeleteRequest Dashboard bulk delete request body. +type DashboardBulkDeleteRequest struct { + // List of dashboard bulk action request data objects. + Data []DashboardBulkActionData `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{} +} + +// NewDashboardBulkDeleteRequest instantiates a new DashboardBulkDeleteRequest 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 NewDashboardBulkDeleteRequest(data []DashboardBulkActionData) *DashboardBulkDeleteRequest { + this := DashboardBulkDeleteRequest{} + this.Data = data + return &this +} + +// NewDashboardBulkDeleteRequestWithDefaults instantiates a new DashboardBulkDeleteRequest 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 NewDashboardBulkDeleteRequestWithDefaults() *DashboardBulkDeleteRequest { + this := DashboardBulkDeleteRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *DashboardBulkDeleteRequest) GetData() []DashboardBulkActionData { + if o == nil { + var ret []DashboardBulkActionData + 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 *DashboardBulkDeleteRequest) GetDataOk() (*[]DashboardBulkActionData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *DashboardBulkDeleteRequest) SetData(v []DashboardBulkActionData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardBulkDeleteRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardBulkDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]DashboardBulkActionData `json:"data"` + }{} + all := struct { + Data []DashboardBulkActionData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_dashboard_delete_response.go b/api/v1/datadog/model_dashboard_delete_response.go new file mode 100644 index 00000000000..ba632231fb0 --- /dev/null +++ b/api/v1/datadog/model_dashboard_delete_response.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 datadog + +import ( + "encoding/json" +) + +// DashboardDeleteResponse Response from the delete dashboard call. +type DashboardDeleteResponse struct { + // ID of the deleted dashboard. + DeletedDashboardId *string `json:"deleted_dashboard_id,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{} +} + +// NewDashboardDeleteResponse instantiates a new DashboardDeleteResponse 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 NewDashboardDeleteResponse() *DashboardDeleteResponse { + this := DashboardDeleteResponse{} + return &this +} + +// NewDashboardDeleteResponseWithDefaults instantiates a new DashboardDeleteResponse 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 NewDashboardDeleteResponseWithDefaults() *DashboardDeleteResponse { + this := DashboardDeleteResponse{} + return &this +} + +// GetDeletedDashboardId returns the DeletedDashboardId field value if set, zero value otherwise. +func (o *DashboardDeleteResponse) GetDeletedDashboardId() string { + if o == nil || o.DeletedDashboardId == nil { + var ret string + return ret + } + return *o.DeletedDashboardId +} + +// GetDeletedDashboardIdOk returns a tuple with the DeletedDashboardId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardDeleteResponse) GetDeletedDashboardIdOk() (*string, bool) { + if o == nil || o.DeletedDashboardId == nil { + return nil, false + } + return o.DeletedDashboardId, true +} + +// HasDeletedDashboardId returns a boolean if a field has been set. +func (o *DashboardDeleteResponse) HasDeletedDashboardId() bool { + if o != nil && o.DeletedDashboardId != nil { + return true + } + + return false +} + +// SetDeletedDashboardId gets a reference to the given string and assigns it to the DeletedDashboardId field. +func (o *DashboardDeleteResponse) SetDeletedDashboardId(v string) { + o.DeletedDashboardId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardDeleteResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DeletedDashboardId != nil { + toSerialize["deleted_dashboard_id"] = o.DeletedDashboardId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DeletedDashboardId *string `json:"deleted_dashboard_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DeletedDashboardId = all.DeletedDashboardId + return nil +} diff --git a/api/v1/datadog/model_dashboard_layout_type.go b/api/v1/datadog/model_dashboard_layout_type.go new file mode 100644 index 00000000000..d9e9b2d8b63 --- /dev/null +++ b/api/v1/datadog/model_dashboard_layout_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardLayoutType Layout type of the dashboard. +type DashboardLayoutType string + +// List of DashboardLayoutType. +const ( + DASHBOARDLAYOUTTYPE_ORDERED DashboardLayoutType = "ordered" + DASHBOARDLAYOUTTYPE_FREE DashboardLayoutType = "free" +) + +var allowedDashboardLayoutTypeEnumValues = []DashboardLayoutType{ + DASHBOARDLAYOUTTYPE_ORDERED, + DASHBOARDLAYOUTTYPE_FREE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DashboardLayoutType) GetAllowedValues() []DashboardLayoutType { + return allowedDashboardLayoutTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DashboardLayoutType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DashboardLayoutType(value) + return nil +} + +// NewDashboardLayoutTypeFromValue returns a pointer to a valid DashboardLayoutType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDashboardLayoutTypeFromValue(v string) (*DashboardLayoutType, error) { + ev := DashboardLayoutType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DashboardLayoutType: valid values are %v", v, allowedDashboardLayoutTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DashboardLayoutType) IsValid() bool { + for _, existing := range allowedDashboardLayoutTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DashboardLayoutType value. +func (v DashboardLayoutType) Ptr() *DashboardLayoutType { + return &v +} + +// NullableDashboardLayoutType handles when a null is used for DashboardLayoutType. +type NullableDashboardLayoutType struct { + value *DashboardLayoutType + isSet bool +} + +// Get returns the associated value. +func (v NullableDashboardLayoutType) Get() *DashboardLayoutType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDashboardLayoutType) Set(val *DashboardLayoutType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDashboardLayoutType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDashboardLayoutType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDashboardLayoutType initializes the struct as if Set has been called. +func NewNullableDashboardLayoutType(val *DashboardLayoutType) *NullableDashboardLayoutType { + return &NullableDashboardLayoutType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDashboardLayoutType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDashboardLayoutType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_dashboard_list.go b/api/v1/datadog/model_dashboard_list.go new file mode 100644 index 00000000000..d55c8b7c076 --- /dev/null +++ b/api/v1/datadog/model_dashboard_list.go @@ -0,0 +1,392 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" +) + +// DashboardList Your Datadog Dashboards. +type DashboardList struct { + // Object describing the creator of the shared element. + Author *Creator `json:"author,omitempty"` + // Date of creation of the dashboard list. + Created *time.Time `json:"created,omitempty"` + // The number of dashboards in the list. + DashboardCount *int64 `json:"dashboard_count,omitempty"` + // The ID of the dashboard list. + Id *int64 `json:"id,omitempty"` + // Whether or not the list is in the favorites. + IsFavorite *bool `json:"is_favorite,omitempty"` + // Date of last edition of the dashboard list. + Modified *time.Time `json:"modified,omitempty"` + // The name of the dashboard list. + Name string `json:"name"` + // The type of dashboard list. + Type *string `json:"type,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{} +} + +// NewDashboardList instantiates a new DashboardList 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 NewDashboardList(name string) *DashboardList { + this := DashboardList{} + this.Name = name + return &this +} + +// NewDashboardListWithDefaults instantiates a new DashboardList 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 NewDashboardListWithDefaults() *DashboardList { + this := DashboardList{} + return &this +} + +// GetAuthor returns the Author field value if set, zero value otherwise. +func (o *DashboardList) GetAuthor() Creator { + if o == nil || o.Author == nil { + var ret Creator + return ret + } + return *o.Author +} + +// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardList) GetAuthorOk() (*Creator, bool) { + if o == nil || o.Author == nil { + return nil, false + } + return o.Author, true +} + +// HasAuthor returns a boolean if a field has been set. +func (o *DashboardList) HasAuthor() bool { + if o != nil && o.Author != nil { + return true + } + + return false +} + +// SetAuthor gets a reference to the given Creator and assigns it to the Author field. +func (o *DashboardList) SetAuthor(v Creator) { + o.Author = &v +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *DashboardList) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardList) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *DashboardList) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *DashboardList) SetCreated(v time.Time) { + o.Created = &v +} + +// GetDashboardCount returns the DashboardCount field value if set, zero value otherwise. +func (o *DashboardList) GetDashboardCount() int64 { + if o == nil || o.DashboardCount == nil { + var ret int64 + return ret + } + return *o.DashboardCount +} + +// GetDashboardCountOk returns a tuple with the DashboardCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardList) GetDashboardCountOk() (*int64, bool) { + if o == nil || o.DashboardCount == nil { + return nil, false + } + return o.DashboardCount, true +} + +// HasDashboardCount returns a boolean if a field has been set. +func (o *DashboardList) HasDashboardCount() bool { + if o != nil && o.DashboardCount != nil { + return true + } + + return false +} + +// SetDashboardCount gets a reference to the given int64 and assigns it to the DashboardCount field. +func (o *DashboardList) SetDashboardCount(v int64) { + o.DashboardCount = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DashboardList) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardList) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DashboardList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *DashboardList) SetId(v int64) { + o.Id = &v +} + +// GetIsFavorite returns the IsFavorite field value if set, zero value otherwise. +func (o *DashboardList) GetIsFavorite() bool { + if o == nil || o.IsFavorite == nil { + var ret bool + return ret + } + return *o.IsFavorite +} + +// GetIsFavoriteOk returns a tuple with the IsFavorite field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardList) GetIsFavoriteOk() (*bool, bool) { + if o == nil || o.IsFavorite == nil { + return nil, false + } + return o.IsFavorite, true +} + +// HasIsFavorite returns a boolean if a field has been set. +func (o *DashboardList) HasIsFavorite() bool { + if o != nil && o.IsFavorite != nil { + return true + } + + return false +} + +// SetIsFavorite gets a reference to the given bool and assigns it to the IsFavorite field. +func (o *DashboardList) SetIsFavorite(v bool) { + o.IsFavorite = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *DashboardList) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardList) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *DashboardList) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *DashboardList) SetModified(v time.Time) { + o.Modified = &v +} + +// GetName returns the Name field value. +func (o *DashboardList) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *DashboardList) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *DashboardList) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DashboardList) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardList) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DashboardList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DashboardList) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Author != nil { + toSerialize["author"] = o.Author + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.DashboardCount != nil { + toSerialize["dashboard_count"] = o.DashboardCount + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IsFavorite != nil { + toSerialize["is_favorite"] = o.IsFavorite + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + toSerialize["name"] = o.Name + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Author *Creator `json:"author,omitempty"` + Created *time.Time `json:"created,omitempty"` + DashboardCount *int64 `json:"dashboard_count,omitempty"` + Id *int64 `json:"id,omitempty"` + IsFavorite *bool `json:"is_favorite,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Name string `json:"name"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Author = all.Author + o.Created = all.Created + o.DashboardCount = all.DashboardCount + o.Id = all.Id + o.IsFavorite = all.IsFavorite + o.Modified = all.Modified + o.Name = all.Name + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_dashboard_list_delete_response.go b/api/v1/datadog/model_dashboard_list_delete_response.go new file mode 100644 index 00000000000..8ebd8c0cd26 --- /dev/null +++ b/api/v1/datadog/model_dashboard_list_delete_response.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 datadog + +import ( + "encoding/json" +) + +// DashboardListDeleteResponse Deleted dashboard details. +type DashboardListDeleteResponse struct { + // ID of the deleted dashboard list. + DeletedDashboardListId *int64 `json:"deleted_dashboard_list_id,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{} +} + +// NewDashboardListDeleteResponse instantiates a new DashboardListDeleteResponse 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 NewDashboardListDeleteResponse() *DashboardListDeleteResponse { + this := DashboardListDeleteResponse{} + return &this +} + +// NewDashboardListDeleteResponseWithDefaults instantiates a new DashboardListDeleteResponse 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 NewDashboardListDeleteResponseWithDefaults() *DashboardListDeleteResponse { + this := DashboardListDeleteResponse{} + return &this +} + +// GetDeletedDashboardListId returns the DeletedDashboardListId field value if set, zero value otherwise. +func (o *DashboardListDeleteResponse) GetDeletedDashboardListId() int64 { + if o == nil || o.DeletedDashboardListId == nil { + var ret int64 + return ret + } + return *o.DeletedDashboardListId +} + +// GetDeletedDashboardListIdOk returns a tuple with the DeletedDashboardListId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListDeleteResponse) GetDeletedDashboardListIdOk() (*int64, bool) { + if o == nil || o.DeletedDashboardListId == nil { + return nil, false + } + return o.DeletedDashboardListId, true +} + +// HasDeletedDashboardListId returns a boolean if a field has been set. +func (o *DashboardListDeleteResponse) HasDeletedDashboardListId() bool { + if o != nil && o.DeletedDashboardListId != nil { + return true + } + + return false +} + +// SetDeletedDashboardListId gets a reference to the given int64 and assigns it to the DeletedDashboardListId field. +func (o *DashboardListDeleteResponse) SetDeletedDashboardListId(v int64) { + o.DeletedDashboardListId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListDeleteResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DeletedDashboardListId != nil { + toSerialize["deleted_dashboard_list_id"] = o.DeletedDashboardListId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DeletedDashboardListId *int64 `json:"deleted_dashboard_list_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DeletedDashboardListId = all.DeletedDashboardListId + return nil +} diff --git a/api/v1/datadog/model_dashboard_list_list_response.go b/api/v1/datadog/model_dashboard_list_list_response.go new file mode 100644 index 00000000000..78b08d820f3 --- /dev/null +++ b/api/v1/datadog/model_dashboard_list_list_response.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 datadog + +import ( + "encoding/json" +) + +// DashboardListListResponse Information on your dashboard lists. +type DashboardListListResponse struct { + // List of all your dashboard lists. + DashboardLists []DashboardList `json:"dashboard_lists,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{} +} + +// NewDashboardListListResponse instantiates a new DashboardListListResponse 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 NewDashboardListListResponse() *DashboardListListResponse { + this := DashboardListListResponse{} + return &this +} + +// NewDashboardListListResponseWithDefaults instantiates a new DashboardListListResponse 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 NewDashboardListListResponseWithDefaults() *DashboardListListResponse { + this := DashboardListListResponse{} + return &this +} + +// GetDashboardLists returns the DashboardLists field value if set, zero value otherwise. +func (o *DashboardListListResponse) GetDashboardLists() []DashboardList { + if o == nil || o.DashboardLists == nil { + var ret []DashboardList + return ret + } + return o.DashboardLists +} + +// GetDashboardListsOk returns a tuple with the DashboardLists field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListListResponse) GetDashboardListsOk() (*[]DashboardList, bool) { + if o == nil || o.DashboardLists == nil { + return nil, false + } + return &o.DashboardLists, true +} + +// HasDashboardLists returns a boolean if a field has been set. +func (o *DashboardListListResponse) HasDashboardLists() bool { + if o != nil && o.DashboardLists != nil { + return true + } + + return false +} + +// SetDashboardLists gets a reference to the given []DashboardList and assigns it to the DashboardLists field. +func (o *DashboardListListResponse) SetDashboardLists(v []DashboardList) { + o.DashboardLists = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DashboardLists != nil { + toSerialize["dashboard_lists"] = o.DashboardLists + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DashboardLists []DashboardList `json:"dashboard_lists,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DashboardLists = all.DashboardLists + return nil +} diff --git a/api/v1/datadog/model_dashboard_reflow_type.go b/api/v1/datadog/model_dashboard_reflow_type.go new file mode 100644 index 00000000000..5d03b2dc73a --- /dev/null +++ b/api/v1/datadog/model_dashboard_reflow_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardReflowType Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'. +// If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto', +// widgets should not have layouts. +type DashboardReflowType string + +// List of DashboardReflowType. +const ( + DASHBOARDREFLOWTYPE_AUTO DashboardReflowType = "auto" + DASHBOARDREFLOWTYPE_FIXED DashboardReflowType = "fixed" +) + +var allowedDashboardReflowTypeEnumValues = []DashboardReflowType{ + DASHBOARDREFLOWTYPE_AUTO, + DASHBOARDREFLOWTYPE_FIXED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DashboardReflowType) GetAllowedValues() []DashboardReflowType { + return allowedDashboardReflowTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DashboardReflowType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DashboardReflowType(value) + return nil +} + +// NewDashboardReflowTypeFromValue returns a pointer to a valid DashboardReflowType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDashboardReflowTypeFromValue(v string) (*DashboardReflowType, error) { + ev := DashboardReflowType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DashboardReflowType: valid values are %v", v, allowedDashboardReflowTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DashboardReflowType) IsValid() bool { + for _, existing := range allowedDashboardReflowTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DashboardReflowType value. +func (v DashboardReflowType) Ptr() *DashboardReflowType { + return &v +} + +// NullableDashboardReflowType handles when a null is used for DashboardReflowType. +type NullableDashboardReflowType struct { + value *DashboardReflowType + isSet bool +} + +// Get returns the associated value. +func (v NullableDashboardReflowType) Get() *DashboardReflowType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDashboardReflowType) Set(val *DashboardReflowType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDashboardReflowType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDashboardReflowType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDashboardReflowType initializes the struct as if Set has been called. +func NewNullableDashboardReflowType(val *DashboardReflowType) *NullableDashboardReflowType { + return &NullableDashboardReflowType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDashboardReflowType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDashboardReflowType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_dashboard_resource_type.go b/api/v1/datadog/model_dashboard_resource_type.go new file mode 100644 index 00000000000..48a4b1eb2be --- /dev/null +++ b/api/v1/datadog/model_dashboard_resource_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardResourceType Dashboard resource type. +type DashboardResourceType string + +// List of DashboardResourceType. +const ( + DASHBOARDRESOURCETYPE_DASHBOARD DashboardResourceType = "dashboard" +) + +var allowedDashboardResourceTypeEnumValues = []DashboardResourceType{ + DASHBOARDRESOURCETYPE_DASHBOARD, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DashboardResourceType) GetAllowedValues() []DashboardResourceType { + return allowedDashboardResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DashboardResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DashboardResourceType(value) + return nil +} + +// NewDashboardResourceTypeFromValue returns a pointer to a valid DashboardResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDashboardResourceTypeFromValue(v string) (*DashboardResourceType, error) { + ev := DashboardResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DashboardResourceType: valid values are %v", v, allowedDashboardResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DashboardResourceType) IsValid() bool { + for _, existing := range allowedDashboardResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DashboardResourceType value. +func (v DashboardResourceType) Ptr() *DashboardResourceType { + return &v +} + +// NullableDashboardResourceType handles when a null is used for DashboardResourceType. +type NullableDashboardResourceType struct { + value *DashboardResourceType + isSet bool +} + +// Get returns the associated value. +func (v NullableDashboardResourceType) Get() *DashboardResourceType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDashboardResourceType) Set(val *DashboardResourceType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDashboardResourceType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDashboardResourceType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDashboardResourceType initializes the struct as if Set has been called. +func NewNullableDashboardResourceType(val *DashboardResourceType) *NullableDashboardResourceType { + return &NullableDashboardResourceType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDashboardResourceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDashboardResourceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_dashboard_restore_request.go b/api/v1/datadog/model_dashboard_restore_request.go new file mode 100644 index 00000000000..329bda2791e --- /dev/null +++ b/api/v1/datadog/model_dashboard_restore_request.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardRestoreRequest Dashboard restore request body. +type DashboardRestoreRequest struct { + // List of dashboard bulk action request data objects. + Data []DashboardBulkActionData `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{} +} + +// NewDashboardRestoreRequest instantiates a new DashboardRestoreRequest 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 NewDashboardRestoreRequest(data []DashboardBulkActionData) *DashboardRestoreRequest { + this := DashboardRestoreRequest{} + this.Data = data + return &this +} + +// NewDashboardRestoreRequestWithDefaults instantiates a new DashboardRestoreRequest 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 NewDashboardRestoreRequestWithDefaults() *DashboardRestoreRequest { + this := DashboardRestoreRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *DashboardRestoreRequest) GetData() []DashboardBulkActionData { + if o == nil { + var ret []DashboardBulkActionData + 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 *DashboardRestoreRequest) GetDataOk() (*[]DashboardBulkActionData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *DashboardRestoreRequest) SetData(v []DashboardBulkActionData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardRestoreRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardRestoreRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]DashboardBulkActionData `json:"data"` + }{} + all := struct { + Data []DashboardBulkActionData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_dashboard_summary.go b/api/v1/datadog/model_dashboard_summary.go new file mode 100644 index 00000000000..ced1626f741 --- /dev/null +++ b/api/v1/datadog/model_dashboard_summary.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 datadog + +import ( + "encoding/json" +) + +// DashboardSummary Dashboard summary response. +type DashboardSummary struct { + // List of dashboard definitions. + Dashboards []DashboardSummaryDefinition `json:"dashboards,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{} +} + +// NewDashboardSummary instantiates a new DashboardSummary 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 NewDashboardSummary() *DashboardSummary { + this := DashboardSummary{} + return &this +} + +// NewDashboardSummaryWithDefaults instantiates a new DashboardSummary 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 NewDashboardSummaryWithDefaults() *DashboardSummary { + this := DashboardSummary{} + return &this +} + +// GetDashboards returns the Dashboards field value if set, zero value otherwise. +func (o *DashboardSummary) GetDashboards() []DashboardSummaryDefinition { + if o == nil || o.Dashboards == nil { + var ret []DashboardSummaryDefinition + return ret + } + return o.Dashboards +} + +// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummary) GetDashboardsOk() (*[]DashboardSummaryDefinition, bool) { + if o == nil || o.Dashboards == nil { + return nil, false + } + return &o.Dashboards, true +} + +// HasDashboards returns a boolean if a field has been set. +func (o *DashboardSummary) HasDashboards() bool { + if o != nil && o.Dashboards != nil { + return true + } + + return false +} + +// SetDashboards gets a reference to the given []DashboardSummaryDefinition and assigns it to the Dashboards field. +func (o *DashboardSummary) SetDashboards(v []DashboardSummaryDefinition) { + o.Dashboards = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardSummary) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Dashboards != nil { + toSerialize["dashboards"] = o.Dashboards + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardSummary) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Dashboards []DashboardSummaryDefinition `json:"dashboards,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Dashboards = all.Dashboards + return nil +} diff --git a/api/v1/datadog/model_dashboard_summary_definition.go b/api/v1/datadog/model_dashboard_summary_definition.go new file mode 100644 index 00000000000..d4c81fe70be --- /dev/null +++ b/api/v1/datadog/model_dashboard_summary_definition.go @@ -0,0 +1,444 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DashboardSummaryDefinition Dashboard definition. +type DashboardSummaryDefinition struct { + // Identifier of the dashboard author. + AuthorHandle *string `json:"author_handle,omitempty"` + // Creation date of the dashboard. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Description of the dashboard. + Description common.NullableString `json:"description,omitempty"` + // Dashboard identifier. + Id *string `json:"id,omitempty"` + // Whether this dashboard is read-only. If True, only the author and admins can make changes to it. + IsReadOnly *bool `json:"is_read_only,omitempty"` + // Layout type of the dashboard. + LayoutType *DashboardLayoutType `json:"layout_type,omitempty"` + // Modification date of the dashboard. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // Title of the dashboard. + Title *string `json:"title,omitempty"` + // URL of the dashboard. + Url *string `json:"url,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{} +} + +// NewDashboardSummaryDefinition instantiates a new DashboardSummaryDefinition 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 NewDashboardSummaryDefinition() *DashboardSummaryDefinition { + this := DashboardSummaryDefinition{} + return &this +} + +// NewDashboardSummaryDefinitionWithDefaults instantiates a new DashboardSummaryDefinition 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 NewDashboardSummaryDefinitionWithDefaults() *DashboardSummaryDefinition { + this := DashboardSummaryDefinition{} + return &this +} + +// GetAuthorHandle returns the AuthorHandle field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetAuthorHandle() string { + if o == nil || o.AuthorHandle == nil { + var ret string + return ret + } + return *o.AuthorHandle +} + +// GetAuthorHandleOk returns a tuple with the AuthorHandle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetAuthorHandleOk() (*string, bool) { + if o == nil || o.AuthorHandle == nil { + return nil, false + } + return o.AuthorHandle, true +} + +// HasAuthorHandle returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasAuthorHandle() bool { + if o != nil && o.AuthorHandle != nil { + return true + } + + return false +} + +// SetAuthorHandle gets a reference to the given string and assigns it to the AuthorHandle field. +func (o *DashboardSummaryDefinition) SetAuthorHandle(v string) { + o.AuthorHandle = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *DashboardSummaryDefinition) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DashboardSummaryDefinition) GetDescription() string { + if o == nil || o.Description.Get() == nil { + var ret string + return ret + } + return *o.Description.Get() +} + +// GetDescriptionOk returns a tuple with the Description 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 *DashboardSummaryDefinition) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description.Get(), o.Description.IsSet() +} + +// HasDescription returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasDescription() bool { + if o != nil && o.Description.IsSet() { + return true + } + + return false +} + +// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. +func (o *DashboardSummaryDefinition) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *DashboardSummaryDefinition) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *DashboardSummaryDefinition) UnsetDescription() { + o.Description.Unset() +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *DashboardSummaryDefinition) SetId(v string) { + o.Id = &v +} + +// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetIsReadOnly() bool { + if o == nil || o.IsReadOnly == nil { + var ret bool + return ret + } + return *o.IsReadOnly +} + +// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetIsReadOnlyOk() (*bool, bool) { + if o == nil || o.IsReadOnly == nil { + return nil, false + } + return o.IsReadOnly, true +} + +// HasIsReadOnly returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasIsReadOnly() bool { + if o != nil && o.IsReadOnly != nil { + return true + } + + return false +} + +// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. +func (o *DashboardSummaryDefinition) SetIsReadOnly(v bool) { + o.IsReadOnly = &v +} + +// GetLayoutType returns the LayoutType field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetLayoutType() DashboardLayoutType { + if o == nil || o.LayoutType == nil { + var ret DashboardLayoutType + return ret + } + return *o.LayoutType +} + +// GetLayoutTypeOk returns a tuple with the LayoutType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetLayoutTypeOk() (*DashboardLayoutType, bool) { + if o == nil || o.LayoutType == nil { + return nil, false + } + return o.LayoutType, true +} + +// HasLayoutType returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasLayoutType() bool { + if o != nil && o.LayoutType != nil { + return true + } + + return false +} + +// SetLayoutType gets a reference to the given DashboardLayoutType and assigns it to the LayoutType field. +func (o *DashboardSummaryDefinition) SetLayoutType(v DashboardLayoutType) { + o.LayoutType = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *DashboardSummaryDefinition) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *DashboardSummaryDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *DashboardSummaryDefinition) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardSummaryDefinition) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *DashboardSummaryDefinition) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *DashboardSummaryDefinition) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardSummaryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AuthorHandle != nil { + toSerialize["author_handle"] = o.AuthorHandle + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IsReadOnly != nil { + toSerialize["is_read_only"] = o.IsReadOnly + } + if o.LayoutType != nil { + toSerialize["layout_type"] = o.LayoutType + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardSummaryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AuthorHandle *string `json:"author_handle,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Description common.NullableString `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + IsReadOnly *bool `json:"is_read_only,omitempty"` + LayoutType *DashboardLayoutType `json:"layout_type,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Title *string `json:"title,omitempty"` + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LayoutType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AuthorHandle = all.AuthorHandle + o.CreatedAt = all.CreatedAt + o.Description = all.Description + o.Id = all.Id + o.IsReadOnly = all.IsReadOnly + o.LayoutType = all.LayoutType + o.ModifiedAt = all.ModifiedAt + o.Title = all.Title + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_dashboard_template_variable.go b/api/v1/datadog/model_dashboard_template_variable.go new file mode 100644 index 00000000000..6ce40d1c720 --- /dev/null +++ b/api/v1/datadog/model_dashboard_template_variable.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DashboardTemplateVariable Template variable. +type DashboardTemplateVariable struct { + // The list of values that the template variable drop-down is limited to. + AvailableValues []string `json:"available_values,omitempty"` + // The default value for the template variable on dashboard load. + Default common.NullableString `json:"default,omitempty"` + // The name of the variable. + Name string `json:"name"` + // The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down. + Prefix common.NullableString `json:"prefix,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{} +} + +// NewDashboardTemplateVariable instantiates a new DashboardTemplateVariable 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 NewDashboardTemplateVariable(name string) *DashboardTemplateVariable { + this := DashboardTemplateVariable{} + this.Name = name + return &this +} + +// NewDashboardTemplateVariableWithDefaults instantiates a new DashboardTemplateVariable 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 NewDashboardTemplateVariableWithDefaults() *DashboardTemplateVariable { + this := DashboardTemplateVariable{} + return &this +} + +// GetAvailableValues returns the AvailableValues field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DashboardTemplateVariable) GetAvailableValues() []string { + if o == nil { + var ret []string + return ret + } + return o.AvailableValues +} + +// GetAvailableValuesOk returns a tuple with the AvailableValues 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 *DashboardTemplateVariable) GetAvailableValuesOk() (*[]string, bool) { + if o == nil || o.AvailableValues == nil { + return nil, false + } + return &o.AvailableValues, true +} + +// HasAvailableValues returns a boolean if a field has been set. +func (o *DashboardTemplateVariable) HasAvailableValues() bool { + if o != nil && o.AvailableValues != nil { + return true + } + + return false +} + +// SetAvailableValues gets a reference to the given []string and assigns it to the AvailableValues field. +func (o *DashboardTemplateVariable) SetAvailableValues(v []string) { + o.AvailableValues = v +} + +// GetDefault returns the Default field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DashboardTemplateVariable) GetDefault() string { + if o == nil || o.Default.Get() == nil { + var ret string + return ret + } + return *o.Default.Get() +} + +// GetDefaultOk returns a tuple with the Default 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 *DashboardTemplateVariable) GetDefaultOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Default.Get(), o.Default.IsSet() +} + +// HasDefault returns a boolean if a field has been set. +func (o *DashboardTemplateVariable) HasDefault() bool { + if o != nil && o.Default.IsSet() { + return true + } + + return false +} + +// SetDefault gets a reference to the given common.NullableString and assigns it to the Default field. +func (o *DashboardTemplateVariable) SetDefault(v string) { + o.Default.Set(&v) +} + +// SetDefaultNil sets the value for Default to be an explicit nil. +func (o *DashboardTemplateVariable) SetDefaultNil() { + o.Default.Set(nil) +} + +// UnsetDefault ensures that no value is present for Default, not even an explicit nil. +func (o *DashboardTemplateVariable) UnsetDefault() { + o.Default.Unset() +} + +// GetName returns the Name field value. +func (o *DashboardTemplateVariable) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *DashboardTemplateVariable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *DashboardTemplateVariable) SetName(v string) { + o.Name = v +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DashboardTemplateVariable) GetPrefix() string { + if o == nil || o.Prefix.Get() == nil { + var ret string + return ret + } + return *o.Prefix.Get() +} + +// GetPrefixOk returns a tuple with the Prefix 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 *DashboardTemplateVariable) GetPrefixOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Prefix.Get(), o.Prefix.IsSet() +} + +// HasPrefix returns a boolean if a field has been set. +func (o *DashboardTemplateVariable) HasPrefix() bool { + if o != nil && o.Prefix.IsSet() { + return true + } + + return false +} + +// SetPrefix gets a reference to the given common.NullableString and assigns it to the Prefix field. +func (o *DashboardTemplateVariable) SetPrefix(v string) { + o.Prefix.Set(&v) +} + +// SetPrefixNil sets the value for Prefix to be an explicit nil. +func (o *DashboardTemplateVariable) SetPrefixNil() { + o.Prefix.Set(nil) +} + +// UnsetPrefix ensures that no value is present for Prefix, not even an explicit nil. +func (o *DashboardTemplateVariable) UnsetPrefix() { + o.Prefix.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardTemplateVariable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AvailableValues != nil { + toSerialize["available_values"] = o.AvailableValues + } + if o.Default.IsSet() { + toSerialize["default"] = o.Default.Get() + } + toSerialize["name"] = o.Name + if o.Prefix.IsSet() { + toSerialize["prefix"] = o.Prefix.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + AvailableValues []string `json:"available_values,omitempty"` + Default common.NullableString `json:"default,omitempty"` + Name string `json:"name"` + Prefix common.NullableString `json:"prefix,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AvailableValues = all.AvailableValues + o.Default = all.Default + o.Name = all.Name + o.Prefix = all.Prefix + return nil +} diff --git a/api/v1/datadog/model_dashboard_template_variable_preset.go b/api/v1/datadog/model_dashboard_template_variable_preset.go new file mode 100644 index 00000000000..0b286022367 --- /dev/null +++ b/api/v1/datadog/model_dashboard_template_variable_preset.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// DashboardTemplateVariablePreset Template variables saved views. +type DashboardTemplateVariablePreset struct { + // The name of the variable. + Name *string `json:"name,omitempty"` + // List of variables. + TemplateVariables []DashboardTemplateVariablePresetValue `json:"template_variables,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{} +} + +// NewDashboardTemplateVariablePreset instantiates a new DashboardTemplateVariablePreset 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 NewDashboardTemplateVariablePreset() *DashboardTemplateVariablePreset { + this := DashboardTemplateVariablePreset{} + return &this +} + +// NewDashboardTemplateVariablePresetWithDefaults instantiates a new DashboardTemplateVariablePreset 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 NewDashboardTemplateVariablePresetWithDefaults() *DashboardTemplateVariablePreset { + this := DashboardTemplateVariablePreset{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DashboardTemplateVariablePreset) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardTemplateVariablePreset) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DashboardTemplateVariablePreset) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DashboardTemplateVariablePreset) SetName(v string) { + o.Name = &v +} + +// GetTemplateVariables returns the TemplateVariables field value if set, zero value otherwise. +func (o *DashboardTemplateVariablePreset) GetTemplateVariables() []DashboardTemplateVariablePresetValue { + if o == nil || o.TemplateVariables == nil { + var ret []DashboardTemplateVariablePresetValue + return ret + } + return o.TemplateVariables +} + +// GetTemplateVariablesOk returns a tuple with the TemplateVariables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardTemplateVariablePreset) GetTemplateVariablesOk() (*[]DashboardTemplateVariablePresetValue, bool) { + if o == nil || o.TemplateVariables == nil { + return nil, false + } + return &o.TemplateVariables, true +} + +// HasTemplateVariables returns a boolean if a field has been set. +func (o *DashboardTemplateVariablePreset) HasTemplateVariables() bool { + if o != nil && o.TemplateVariables != nil { + return true + } + + return false +} + +// SetTemplateVariables gets a reference to the given []DashboardTemplateVariablePresetValue and assigns it to the TemplateVariables field. +func (o *DashboardTemplateVariablePreset) SetTemplateVariables(v []DashboardTemplateVariablePresetValue) { + o.TemplateVariables = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardTemplateVariablePreset) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.TemplateVariables != nil { + toSerialize["template_variables"] = o.TemplateVariables + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardTemplateVariablePreset) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Name *string `json:"name,omitempty"` + TemplateVariables []DashboardTemplateVariablePresetValue `json:"template_variables,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.TemplateVariables = all.TemplateVariables + return nil +} diff --git a/api/v1/datadog/model_dashboard_template_variable_preset_value.go b/api/v1/datadog/model_dashboard_template_variable_preset_value.go new file mode 100644 index 00000000000..d27a57fab9b --- /dev/null +++ b/api/v1/datadog/model_dashboard_template_variable_preset_value.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// DashboardTemplateVariablePresetValue Template variables saved views. +type DashboardTemplateVariablePresetValue struct { + // The name of the variable. + Name *string `json:"name,omitempty"` + // The value of the template variable within the saved view. + Value *string `json:"value,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{} +} + +// NewDashboardTemplateVariablePresetValue instantiates a new DashboardTemplateVariablePresetValue 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 NewDashboardTemplateVariablePresetValue() *DashboardTemplateVariablePresetValue { + this := DashboardTemplateVariablePresetValue{} + return &this +} + +// NewDashboardTemplateVariablePresetValueWithDefaults instantiates a new DashboardTemplateVariablePresetValue 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 NewDashboardTemplateVariablePresetValueWithDefaults() *DashboardTemplateVariablePresetValue { + this := DashboardTemplateVariablePresetValue{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DashboardTemplateVariablePresetValue) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardTemplateVariablePresetValue) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DashboardTemplateVariablePresetValue) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DashboardTemplateVariablePresetValue) SetName(v string) { + o.Name = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *DashboardTemplateVariablePresetValue) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardTemplateVariablePresetValue) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *DashboardTemplateVariablePresetValue) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *DashboardTemplateVariablePresetValue) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardTemplateVariablePresetValue) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardTemplateVariablePresetValue) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_deleted_monitor.go b/api/v1/datadog/model_deleted_monitor.go new file mode 100644 index 00000000000..86a32af8f69 --- /dev/null +++ b/api/v1/datadog/model_deleted_monitor.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 datadog + +import ( + "encoding/json" +) + +// DeletedMonitor Response from the delete monitor call. +type DeletedMonitor struct { + // ID of the deleted monitor. + DeletedMonitorId *int64 `json:"deleted_monitor_id,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{} +} + +// NewDeletedMonitor instantiates a new DeletedMonitor 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 NewDeletedMonitor() *DeletedMonitor { + this := DeletedMonitor{} + return &this +} + +// NewDeletedMonitorWithDefaults instantiates a new DeletedMonitor 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 NewDeletedMonitorWithDefaults() *DeletedMonitor { + this := DeletedMonitor{} + return &this +} + +// GetDeletedMonitorId returns the DeletedMonitorId field value if set, zero value otherwise. +func (o *DeletedMonitor) GetDeletedMonitorId() int64 { + if o == nil || o.DeletedMonitorId == nil { + var ret int64 + return ret + } + return *o.DeletedMonitorId +} + +// GetDeletedMonitorIdOk returns a tuple with the DeletedMonitorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeletedMonitor) GetDeletedMonitorIdOk() (*int64, bool) { + if o == nil || o.DeletedMonitorId == nil { + return nil, false + } + return o.DeletedMonitorId, true +} + +// HasDeletedMonitorId returns a boolean if a field has been set. +func (o *DeletedMonitor) HasDeletedMonitorId() bool { + if o != nil && o.DeletedMonitorId != nil { + return true + } + + return false +} + +// SetDeletedMonitorId gets a reference to the given int64 and assigns it to the DeletedMonitorId field. +func (o *DeletedMonitor) SetDeletedMonitorId(v int64) { + o.DeletedMonitorId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeletedMonitor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DeletedMonitorId != nil { + toSerialize["deleted_monitor_id"] = o.DeletedMonitorId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DeletedMonitor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DeletedMonitorId *int64 `json:"deleted_monitor_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DeletedMonitorId = all.DeletedMonitorId + return nil +} diff --git a/api/v1/datadog/model_distribution_point_item.go b/api/v1/datadog/model_distribution_point_item.go new file mode 100644 index 00000000000..c33484d5f3a --- /dev/null +++ b/api/v1/datadog/model_distribution_point_item.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// DistributionPointItem - List of distribution point. +type DistributionPointItem struct { + DistributionPointTimestamp *float64 + DistributionPointData *[]float64 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// DistributionPointTimestampAsDistributionPointItem is a convenience function that returns float64 wrapped in DistributionPointItem. +func DistributionPointTimestampAsDistributionPointItem(v *float64) DistributionPointItem { + return DistributionPointItem{DistributionPointTimestamp: v} +} + +// DistributionPointDataAsDistributionPointItem is a convenience function that returns []float64 wrapped in DistributionPointItem. +func DistributionPointDataAsDistributionPointItem(v *[]float64) DistributionPointItem { + return DistributionPointItem{DistributionPointData: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DistributionPointItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DistributionPointTimestamp + err = json.Unmarshal(data, &obj.DistributionPointTimestamp) + if err == nil { + if obj.DistributionPointTimestamp != nil { + jsonDistributionPointTimestamp, _ := json.Marshal(obj.DistributionPointTimestamp) + if string(jsonDistributionPointTimestamp) == "{}" { // empty struct + obj.DistributionPointTimestamp = nil + } else { + match++ + } + } else { + obj.DistributionPointTimestamp = nil + } + } else { + obj.DistributionPointTimestamp = nil + } + + // try to unmarshal data into DistributionPointData + err = json.Unmarshal(data, &obj.DistributionPointData) + if err == nil { + if obj.DistributionPointData != nil { + jsonDistributionPointData, _ := json.Marshal(obj.DistributionPointData) + if string(jsonDistributionPointData) == "{}" { // empty struct + obj.DistributionPointData = nil + } else { + match++ + } + } else { + obj.DistributionPointData = nil + } + } else { + obj.DistributionPointData = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.DistributionPointTimestamp = nil + obj.DistributionPointData = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DistributionPointItem) MarshalJSON() ([]byte, error) { + if obj.DistributionPointTimestamp != nil { + return json.Marshal(&obj.DistributionPointTimestamp) + } + + if obj.DistributionPointData != nil { + return json.Marshal(&obj.DistributionPointData) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DistributionPointItem) GetActualInstance() interface{} { + if obj.DistributionPointTimestamp != nil { + return obj.DistributionPointTimestamp + } + + if obj.DistributionPointData != nil { + return obj.DistributionPointData + } + + // all schemas are nil + return nil +} + +// NullableDistributionPointItem handles when a null is used for DistributionPointItem. +type NullableDistributionPointItem struct { + value *DistributionPointItem + isSet bool +} + +// Get returns the associated value. +func (v NullableDistributionPointItem) Get() *DistributionPointItem { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDistributionPointItem) Set(val *DistributionPointItem) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDistributionPointItem) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableDistributionPointItem) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDistributionPointItem initializes the struct as if Set has been called. +func NewNullableDistributionPointItem(val *DistributionPointItem) *NullableDistributionPointItem { + return &NullableDistributionPointItem{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDistributionPointItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDistributionPointItem) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_distribution_points_content_encoding.go b/api/v1/datadog/model_distribution_points_content_encoding.go new file mode 100644 index 00000000000..8b770b886ca --- /dev/null +++ b/api/v1/datadog/model_distribution_points_content_encoding.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DistributionPointsContentEncoding HTTP header used to compress the media-type. +type DistributionPointsContentEncoding string + +// List of DistributionPointsContentEncoding. +const ( + DISTRIBUTIONPOINTSCONTENTENCODING_DEFLATE DistributionPointsContentEncoding = "deflate" +) + +var allowedDistributionPointsContentEncodingEnumValues = []DistributionPointsContentEncoding{ + DISTRIBUTIONPOINTSCONTENTENCODING_DEFLATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DistributionPointsContentEncoding) GetAllowedValues() []DistributionPointsContentEncoding { + return allowedDistributionPointsContentEncodingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DistributionPointsContentEncoding) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DistributionPointsContentEncoding(value) + return nil +} + +// NewDistributionPointsContentEncodingFromValue returns a pointer to a valid DistributionPointsContentEncoding +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDistributionPointsContentEncodingFromValue(v string) (*DistributionPointsContentEncoding, error) { + ev := DistributionPointsContentEncoding(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DistributionPointsContentEncoding: valid values are %v", v, allowedDistributionPointsContentEncodingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DistributionPointsContentEncoding) IsValid() bool { + for _, existing := range allowedDistributionPointsContentEncodingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DistributionPointsContentEncoding value. +func (v DistributionPointsContentEncoding) Ptr() *DistributionPointsContentEncoding { + return &v +} + +// NullableDistributionPointsContentEncoding handles when a null is used for DistributionPointsContentEncoding. +type NullableDistributionPointsContentEncoding struct { + value *DistributionPointsContentEncoding + isSet bool +} + +// Get returns the associated value. +func (v NullableDistributionPointsContentEncoding) Get() *DistributionPointsContentEncoding { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDistributionPointsContentEncoding) Set(val *DistributionPointsContentEncoding) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDistributionPointsContentEncoding) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDistributionPointsContentEncoding) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDistributionPointsContentEncoding initializes the struct as if Set has been called. +func NewNullableDistributionPointsContentEncoding(val *DistributionPointsContentEncoding) *NullableDistributionPointsContentEncoding { + return &NullableDistributionPointsContentEncoding{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDistributionPointsContentEncoding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDistributionPointsContentEncoding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_distribution_points_payload.go b/api/v1/datadog/model_distribution_points_payload.go new file mode 100644 index 00000000000..5264e294702 --- /dev/null +++ b/api/v1/datadog/model_distribution_points_payload.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DistributionPointsPayload The distribution points payload. +type DistributionPointsPayload struct { + // A list of distribution points series to submit to Datadog. + Series []DistributionPointsSeries `json:"series"` + // 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{} +} + +// NewDistributionPointsPayload instantiates a new DistributionPointsPayload 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 NewDistributionPointsPayload(series []DistributionPointsSeries) *DistributionPointsPayload { + this := DistributionPointsPayload{} + this.Series = series + return &this +} + +// NewDistributionPointsPayloadWithDefaults instantiates a new DistributionPointsPayload 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 NewDistributionPointsPayloadWithDefaults() *DistributionPointsPayload { + this := DistributionPointsPayload{} + return &this +} + +// GetSeries returns the Series field value. +func (o *DistributionPointsPayload) GetSeries() []DistributionPointsSeries { + if o == nil { + var ret []DistributionPointsSeries + return ret + } + return o.Series +} + +// GetSeriesOk returns a tuple with the Series field value +// and a boolean to check if the value has been set. +func (o *DistributionPointsPayload) GetSeriesOk() (*[]DistributionPointsSeries, bool) { + if o == nil { + return nil, false + } + return &o.Series, true +} + +// SetSeries sets field value. +func (o *DistributionPointsPayload) SetSeries(v []DistributionPointsSeries) { + o.Series = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DistributionPointsPayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["series"] = o.Series + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DistributionPointsPayload) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Series *[]DistributionPointsSeries `json:"series"` + }{} + all := struct { + Series []DistributionPointsSeries `json:"series"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Series == nil { + return fmt.Errorf("Required field series missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Series = all.Series + return nil +} diff --git a/api/v1/datadog/model_distribution_points_series.go b/api/v1/datadog/model_distribution_points_series.go new file mode 100644 index 00000000000..4874ff8e599 --- /dev/null +++ b/api/v1/datadog/model_distribution_points_series.go @@ -0,0 +1,265 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DistributionPointsSeries A distribution points metric to submit to Datadog. +type DistributionPointsSeries struct { + // The name of the host that produced the distribution point metric. + Host *string `json:"host,omitempty"` + // The name of the distribution points metric. + Metric string `json:"metric"` + // Points relating to the distribution point metric. All points must be tuples with timestamp and a list of values (cannot be a string). Timestamps should be in POSIX time in seconds. + Points [][]DistributionPointItem `json:"points"` + // A list of tags associated with the distribution point metric. + Tags []string `json:"tags,omitempty"` + // The type of the distribution point. + Type *DistributionPointsType `json:"type,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{} +} + +// NewDistributionPointsSeries instantiates a new DistributionPointsSeries 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 NewDistributionPointsSeries(metric string, points [][]DistributionPointItem) *DistributionPointsSeries { + this := DistributionPointsSeries{} + this.Metric = metric + this.Points = points + var typeVar DistributionPointsType = DISTRIBUTIONPOINTSTYPE_DISTRIBUTION + this.Type = &typeVar + return &this +} + +// NewDistributionPointsSeriesWithDefaults instantiates a new DistributionPointsSeries 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 NewDistributionPointsSeriesWithDefaults() *DistributionPointsSeries { + this := DistributionPointsSeries{} + var typeVar DistributionPointsType = DISTRIBUTIONPOINTSTYPE_DISTRIBUTION + this.Type = &typeVar + return &this +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *DistributionPointsSeries) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionPointsSeries) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *DistributionPointsSeries) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *DistributionPointsSeries) SetHost(v string) { + o.Host = &v +} + +// GetMetric returns the Metric field value. +func (o *DistributionPointsSeries) GetMetric() string { + if o == nil { + var ret string + return ret + } + return o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value +// and a boolean to check if the value has been set. +func (o *DistributionPointsSeries) GetMetricOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metric, true +} + +// SetMetric sets field value. +func (o *DistributionPointsSeries) SetMetric(v string) { + o.Metric = v +} + +// GetPoints returns the Points field value. +func (o *DistributionPointsSeries) GetPoints() [][]DistributionPointItem { + if o == nil { + var ret [][]DistributionPointItem + return ret + } + return o.Points +} + +// GetPointsOk returns a tuple with the Points field value +// and a boolean to check if the value has been set. +func (o *DistributionPointsSeries) GetPointsOk() (*[][]DistributionPointItem, bool) { + if o == nil { + return nil, false + } + return &o.Points, true +} + +// SetPoints sets field value. +func (o *DistributionPointsSeries) SetPoints(v [][]DistributionPointItem) { + o.Points = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DistributionPointsSeries) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *DistributionPointsSeries) GetTagsOk() (*[]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 *DistributionPointsSeries) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *DistributionPointsSeries) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DistributionPointsSeries) GetType() DistributionPointsType { + if o == nil || o.Type == nil { + var ret DistributionPointsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionPointsSeries) GetTypeOk() (*DistributionPointsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DistributionPointsSeries) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given DistributionPointsType and assigns it to the Type field. +func (o *DistributionPointsSeries) SetType(v DistributionPointsType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DistributionPointsSeries) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + toSerialize["metric"] = o.Metric + toSerialize["points"] = o.Points + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Metric *string `json:"metric"` + Points *[][]DistributionPointItem `json:"points"` + }{} + all := struct { + Host *string `json:"host,omitempty"` + Metric string `json:"metric"` + Points [][]DistributionPointItem `json:"points"` + Tags []string `json:"tags,omitempty"` + Type *DistributionPointsType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Metric == nil { + return fmt.Errorf("Required field metric missing") + } + if required.Points == nil { + return fmt.Errorf("Required field points missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Host = all.Host + o.Metric = all.Metric + o.Points = all.Points + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_distribution_points_type.go b/api/v1/datadog/model_distribution_points_type.go new file mode 100644 index 00000000000..08ed0979b9d --- /dev/null +++ b/api/v1/datadog/model_distribution_points_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DistributionPointsType The type of the distribution point. +type DistributionPointsType string + +// List of DistributionPointsType. +const ( + DISTRIBUTIONPOINTSTYPE_DISTRIBUTION DistributionPointsType = "distribution" +) + +var allowedDistributionPointsTypeEnumValues = []DistributionPointsType{ + DISTRIBUTIONPOINTSTYPE_DISTRIBUTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DistributionPointsType) GetAllowedValues() []DistributionPointsType { + return allowedDistributionPointsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DistributionPointsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DistributionPointsType(value) + return nil +} + +// NewDistributionPointsTypeFromValue returns a pointer to a valid DistributionPointsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDistributionPointsTypeFromValue(v string) (*DistributionPointsType, error) { + ev := DistributionPointsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DistributionPointsType: valid values are %v", v, allowedDistributionPointsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DistributionPointsType) IsValid() bool { + for _, existing := range allowedDistributionPointsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DistributionPointsType value. +func (v DistributionPointsType) Ptr() *DistributionPointsType { + return &v +} + +// NullableDistributionPointsType handles when a null is used for DistributionPointsType. +type NullableDistributionPointsType struct { + value *DistributionPointsType + isSet bool +} + +// Get returns the associated value. +func (v NullableDistributionPointsType) Get() *DistributionPointsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDistributionPointsType) Set(val *DistributionPointsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDistributionPointsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDistributionPointsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDistributionPointsType initializes the struct as if Set has been called. +func NewNullableDistributionPointsType(val *DistributionPointsType) *NullableDistributionPointsType { + return &NullableDistributionPointsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDistributionPointsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDistributionPointsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_distribution_widget_definition.go b/api/v1/datadog/model_distribution_widget_definition.go new file mode 100644 index 00000000000..cc71850961d --- /dev/null +++ b/api/v1/datadog/model_distribution_widget_definition.go @@ -0,0 +1,539 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DistributionWidgetDefinition The Distribution visualization is another way of showing metrics +// aggregated across one or several tags, such as hosts. +// Unlike the heat map, a distribution graph’s x-axis is quantity rather than time. +type DistributionWidgetDefinition struct { + // (Deprecated) The widget legend was replaced by a tooltip and sidebar. + // Deprecated + LegendSize *string `json:"legend_size,omitempty"` + // List of markers. + Markers []WidgetMarker `json:"markers,omitempty"` + // Array of one request object to display in the widget. + // + // See the dedicated [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json) + // to learn how to build the `REQUEST_SCHEMA`. + Requests []DistributionWidgetRequest `json:"requests"` + // (Deprecated) The widget legend was replaced by a tooltip and sidebar. + // Deprecated + ShowLegend *bool `json:"show_legend,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the distribution widget. + Type DistributionWidgetDefinitionType `json:"type"` + // X Axis controls for the distribution widget. + Xaxis *DistributionWidgetXAxis `json:"xaxis,omitempty"` + // Y Axis controls for the distribution widget. + Yaxis *DistributionWidgetYAxis `json:"yaxis,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{} +} + +// NewDistributionWidgetDefinition instantiates a new DistributionWidgetDefinition 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 NewDistributionWidgetDefinition(requests []DistributionWidgetRequest, typeVar DistributionWidgetDefinitionType) *DistributionWidgetDefinition { + this := DistributionWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewDistributionWidgetDefinitionWithDefaults instantiates a new DistributionWidgetDefinition 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 NewDistributionWidgetDefinitionWithDefaults() *DistributionWidgetDefinition { + this := DistributionWidgetDefinition{} + var typeVar DistributionWidgetDefinitionType = DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION + this.Type = typeVar + return &this +} + +// GetLegendSize returns the LegendSize field value if set, zero value otherwise. +// Deprecated +func (o *DistributionWidgetDefinition) GetLegendSize() string { + if o == nil || o.LegendSize == nil { + var ret string + return ret + } + return *o.LegendSize +} + +// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *DistributionWidgetDefinition) GetLegendSizeOk() (*string, bool) { + if o == nil || o.LegendSize == nil { + return nil, false + } + return o.LegendSize, true +} + +// HasLegendSize returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasLegendSize() bool { + if o != nil && o.LegendSize != nil { + return true + } + + return false +} + +// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. +// Deprecated +func (o *DistributionWidgetDefinition) SetLegendSize(v string) { + o.LegendSize = &v +} + +// GetMarkers returns the Markers field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetMarkers() []WidgetMarker { + if o == nil || o.Markers == nil { + var ret []WidgetMarker + return ret + } + return o.Markers +} + +// GetMarkersOk returns a tuple with the Markers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetMarkersOk() (*[]WidgetMarker, bool) { + if o == nil || o.Markers == nil { + return nil, false + } + return &o.Markers, true +} + +// HasMarkers returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasMarkers() bool { + if o != nil && o.Markers != nil { + return true + } + + return false +} + +// SetMarkers gets a reference to the given []WidgetMarker and assigns it to the Markers field. +func (o *DistributionWidgetDefinition) SetMarkers(v []WidgetMarker) { + o.Markers = v +} + +// GetRequests returns the Requests field value. +func (o *DistributionWidgetDefinition) GetRequests() []DistributionWidgetRequest { + if o == nil { + var ret []DistributionWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetRequestsOk() (*[]DistributionWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *DistributionWidgetDefinition) SetRequests(v []DistributionWidgetRequest) { + o.Requests = v +} + +// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. +// Deprecated +func (o *DistributionWidgetDefinition) GetShowLegend() bool { + if o == nil || o.ShowLegend == nil { + var ret bool + return ret + } + return *o.ShowLegend +} + +// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *DistributionWidgetDefinition) GetShowLegendOk() (*bool, bool) { + if o == nil || o.ShowLegend == nil { + return nil, false + } + return o.ShowLegend, true +} + +// HasShowLegend returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasShowLegend() bool { + if o != nil && o.ShowLegend != nil { + return true + } + + return false +} + +// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. +// Deprecated +func (o *DistributionWidgetDefinition) SetShowLegend(v bool) { + o.ShowLegend = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *DistributionWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *DistributionWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *DistributionWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *DistributionWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *DistributionWidgetDefinition) GetType() DistributionWidgetDefinitionType { + if o == nil { + var ret DistributionWidgetDefinitionType + 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 *DistributionWidgetDefinition) GetTypeOk() (*DistributionWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DistributionWidgetDefinition) SetType(v DistributionWidgetDefinitionType) { + o.Type = v +} + +// GetXaxis returns the Xaxis field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetXaxis() DistributionWidgetXAxis { + if o == nil || o.Xaxis == nil { + var ret DistributionWidgetXAxis + return ret + } + return *o.Xaxis +} + +// GetXaxisOk returns a tuple with the Xaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetXaxisOk() (*DistributionWidgetXAxis, bool) { + if o == nil || o.Xaxis == nil { + return nil, false + } + return o.Xaxis, true +} + +// HasXaxis returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasXaxis() bool { + if o != nil && o.Xaxis != nil { + return true + } + + return false +} + +// SetXaxis gets a reference to the given DistributionWidgetXAxis and assigns it to the Xaxis field. +func (o *DistributionWidgetDefinition) SetXaxis(v DistributionWidgetXAxis) { + o.Xaxis = &v +} + +// GetYaxis returns the Yaxis field value if set, zero value otherwise. +func (o *DistributionWidgetDefinition) GetYaxis() DistributionWidgetYAxis { + if o == nil || o.Yaxis == nil { + var ret DistributionWidgetYAxis + return ret + } + return *o.Yaxis +} + +// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetDefinition) GetYaxisOk() (*DistributionWidgetYAxis, bool) { + if o == nil || o.Yaxis == nil { + return nil, false + } + return o.Yaxis, true +} + +// HasYaxis returns a boolean if a field has been set. +func (o *DistributionWidgetDefinition) HasYaxis() bool { + if o != nil && o.Yaxis != nil { + return true + } + + return false +} + +// SetYaxis gets a reference to the given DistributionWidgetYAxis and assigns it to the Yaxis field. +func (o *DistributionWidgetDefinition) SetYaxis(v DistributionWidgetYAxis) { + o.Yaxis = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DistributionWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LegendSize != nil { + toSerialize["legend_size"] = o.LegendSize + } + if o.Markers != nil { + toSerialize["markers"] = o.Markers + } + toSerialize["requests"] = o.Requests + if o.ShowLegend != nil { + toSerialize["show_legend"] = o.ShowLegend + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + if o.Xaxis != nil { + toSerialize["xaxis"] = o.Xaxis + } + if o.Yaxis != nil { + toSerialize["yaxis"] = o.Yaxis + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]DistributionWidgetRequest `json:"requests"` + Type *DistributionWidgetDefinitionType `json:"type"` + }{} + all := struct { + LegendSize *string `json:"legend_size,omitempty"` + Markers []WidgetMarker `json:"markers,omitempty"` + Requests []DistributionWidgetRequest `json:"requests"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type DistributionWidgetDefinitionType `json:"type"` + Xaxis *DistributionWidgetXAxis `json:"xaxis,omitempty"` + Yaxis *DistributionWidgetYAxis `json:"yaxis,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LegendSize = all.LegendSize + o.Markers = all.Markers + o.Requests = all.Requests + o.ShowLegend = all.ShowLegend + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Xaxis = all.Xaxis + if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Yaxis = all.Yaxis + return nil +} diff --git a/api/v1/datadog/model_distribution_widget_definition_type.go b/api/v1/datadog/model_distribution_widget_definition_type.go new file mode 100644 index 00000000000..b1052ca6ef3 --- /dev/null +++ b/api/v1/datadog/model_distribution_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DistributionWidgetDefinitionType Type of the distribution widget. +type DistributionWidgetDefinitionType string + +// List of DistributionWidgetDefinitionType. +const ( + DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION DistributionWidgetDefinitionType = "distribution" +) + +var allowedDistributionWidgetDefinitionTypeEnumValues = []DistributionWidgetDefinitionType{ + DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DistributionWidgetDefinitionType) GetAllowedValues() []DistributionWidgetDefinitionType { + return allowedDistributionWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DistributionWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DistributionWidgetDefinitionType(value) + return nil +} + +// NewDistributionWidgetDefinitionTypeFromValue returns a pointer to a valid DistributionWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDistributionWidgetDefinitionTypeFromValue(v string) (*DistributionWidgetDefinitionType, error) { + ev := DistributionWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DistributionWidgetDefinitionType: valid values are %v", v, allowedDistributionWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DistributionWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedDistributionWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DistributionWidgetDefinitionType value. +func (v DistributionWidgetDefinitionType) Ptr() *DistributionWidgetDefinitionType { + return &v +} + +// NullableDistributionWidgetDefinitionType handles when a null is used for DistributionWidgetDefinitionType. +type NullableDistributionWidgetDefinitionType struct { + value *DistributionWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableDistributionWidgetDefinitionType) Get() *DistributionWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDistributionWidgetDefinitionType) Set(val *DistributionWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDistributionWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDistributionWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDistributionWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableDistributionWidgetDefinitionType(val *DistributionWidgetDefinitionType) *NullableDistributionWidgetDefinitionType { + return &NullableDistributionWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDistributionWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDistributionWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_distribution_widget_histogram_request_query.go b/api/v1/datadog/model_distribution_widget_histogram_request_query.go new file mode 100644 index 00000000000..b781bf109c0 --- /dev/null +++ b/api/v1/datadog/model_distribution_widget_histogram_request_query.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// DistributionWidgetHistogramRequestQuery - Query definition for Distribution Widget Histogram Request +type DistributionWidgetHistogramRequestQuery struct { + FormulaAndFunctionMetricQueryDefinition *FormulaAndFunctionMetricQueryDefinition + FormulaAndFunctionEventQueryDefinition *FormulaAndFunctionEventQueryDefinition + FormulaAndFunctionApmResourceStatsQueryDefinition *FormulaAndFunctionApmResourceStatsQueryDefinition + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// FormulaAndFunctionMetricQueryDefinitionAsDistributionWidgetHistogramRequestQuery is a convenience function that returns FormulaAndFunctionMetricQueryDefinition wrapped in DistributionWidgetHistogramRequestQuery. +func FormulaAndFunctionMetricQueryDefinitionAsDistributionWidgetHistogramRequestQuery(v *FormulaAndFunctionMetricQueryDefinition) DistributionWidgetHistogramRequestQuery { + return DistributionWidgetHistogramRequestQuery{FormulaAndFunctionMetricQueryDefinition: v} +} + +// FormulaAndFunctionEventQueryDefinitionAsDistributionWidgetHistogramRequestQuery is a convenience function that returns FormulaAndFunctionEventQueryDefinition wrapped in DistributionWidgetHistogramRequestQuery. +func FormulaAndFunctionEventQueryDefinitionAsDistributionWidgetHistogramRequestQuery(v *FormulaAndFunctionEventQueryDefinition) DistributionWidgetHistogramRequestQuery { + return DistributionWidgetHistogramRequestQuery{FormulaAndFunctionEventQueryDefinition: v} +} + +// FormulaAndFunctionApmResourceStatsQueryDefinitionAsDistributionWidgetHistogramRequestQuery is a convenience function that returns FormulaAndFunctionApmResourceStatsQueryDefinition wrapped in DistributionWidgetHistogramRequestQuery. +func FormulaAndFunctionApmResourceStatsQueryDefinitionAsDistributionWidgetHistogramRequestQuery(v *FormulaAndFunctionApmResourceStatsQueryDefinition) DistributionWidgetHistogramRequestQuery { + return DistributionWidgetHistogramRequestQuery{FormulaAndFunctionApmResourceStatsQueryDefinition: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DistributionWidgetHistogramRequestQuery) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into FormulaAndFunctionMetricQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionMetricQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionMetricQueryDefinition != nil && obj.FormulaAndFunctionMetricQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionMetricQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionMetricQueryDefinition) + if string(jsonFormulaAndFunctionMetricQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionMetricQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionMetricQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionMetricQueryDefinition = nil + } + + // try to unmarshal data into FormulaAndFunctionEventQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionEventQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionEventQueryDefinition != nil && obj.FormulaAndFunctionEventQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionEventQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionEventQueryDefinition) + if string(jsonFormulaAndFunctionEventQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionEventQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionEventQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionEventQueryDefinition = nil + } + + // try to unmarshal data into FormulaAndFunctionApmResourceStatsQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionApmResourceStatsQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil && obj.FormulaAndFunctionApmResourceStatsQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionApmResourceStatsQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionApmResourceStatsQueryDefinition) + if string(jsonFormulaAndFunctionApmResourceStatsQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.FormulaAndFunctionMetricQueryDefinition = nil + obj.FormulaAndFunctionEventQueryDefinition = nil + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DistributionWidgetHistogramRequestQuery) MarshalJSON() ([]byte, error) { + if obj.FormulaAndFunctionMetricQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionMetricQueryDefinition) + } + + if obj.FormulaAndFunctionEventQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionEventQueryDefinition) + } + + if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionApmResourceStatsQueryDefinition) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DistributionWidgetHistogramRequestQuery) GetActualInstance() interface{} { + if obj.FormulaAndFunctionMetricQueryDefinition != nil { + return obj.FormulaAndFunctionMetricQueryDefinition + } + + if obj.FormulaAndFunctionEventQueryDefinition != nil { + return obj.FormulaAndFunctionEventQueryDefinition + } + + if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { + return obj.FormulaAndFunctionApmResourceStatsQueryDefinition + } + + // all schemas are nil + return nil +} + +// NullableDistributionWidgetHistogramRequestQuery handles when a null is used for DistributionWidgetHistogramRequestQuery. +type NullableDistributionWidgetHistogramRequestQuery struct { + value *DistributionWidgetHistogramRequestQuery + isSet bool +} + +// Get returns the associated value. +func (v NullableDistributionWidgetHistogramRequestQuery) Get() *DistributionWidgetHistogramRequestQuery { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDistributionWidgetHistogramRequestQuery) Set(val *DistributionWidgetHistogramRequestQuery) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDistributionWidgetHistogramRequestQuery) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableDistributionWidgetHistogramRequestQuery) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDistributionWidgetHistogramRequestQuery initializes the struct as if Set has been called. +func NewNullableDistributionWidgetHistogramRequestQuery(val *DistributionWidgetHistogramRequestQuery) *NullableDistributionWidgetHistogramRequestQuery { + return &NullableDistributionWidgetHistogramRequestQuery{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDistributionWidgetHistogramRequestQuery) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDistributionWidgetHistogramRequestQuery) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_distribution_widget_histogram_request_type.go b/api/v1/datadog/model_distribution_widget_histogram_request_type.go new file mode 100644 index 00000000000..2d25202874a --- /dev/null +++ b/api/v1/datadog/model_distribution_widget_histogram_request_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DistributionWidgetHistogramRequestType Request type for the histogram request. +type DistributionWidgetHistogramRequestType string + +// List of DistributionWidgetHistogramRequestType. +const ( + DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM DistributionWidgetHistogramRequestType = "histogram" +) + +var allowedDistributionWidgetHistogramRequestTypeEnumValues = []DistributionWidgetHistogramRequestType{ + DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DistributionWidgetHistogramRequestType) GetAllowedValues() []DistributionWidgetHistogramRequestType { + return allowedDistributionWidgetHistogramRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DistributionWidgetHistogramRequestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DistributionWidgetHistogramRequestType(value) + return nil +} + +// NewDistributionWidgetHistogramRequestTypeFromValue returns a pointer to a valid DistributionWidgetHistogramRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDistributionWidgetHistogramRequestTypeFromValue(v string) (*DistributionWidgetHistogramRequestType, error) { + ev := DistributionWidgetHistogramRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DistributionWidgetHistogramRequestType: valid values are %v", v, allowedDistributionWidgetHistogramRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DistributionWidgetHistogramRequestType) IsValid() bool { + for _, existing := range allowedDistributionWidgetHistogramRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DistributionWidgetHistogramRequestType value. +func (v DistributionWidgetHistogramRequestType) Ptr() *DistributionWidgetHistogramRequestType { + return &v +} + +// NullableDistributionWidgetHistogramRequestType handles when a null is used for DistributionWidgetHistogramRequestType. +type NullableDistributionWidgetHistogramRequestType struct { + value *DistributionWidgetHistogramRequestType + isSet bool +} + +// Get returns the associated value. +func (v NullableDistributionWidgetHistogramRequestType) Get() *DistributionWidgetHistogramRequestType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDistributionWidgetHistogramRequestType) Set(val *DistributionWidgetHistogramRequestType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDistributionWidgetHistogramRequestType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDistributionWidgetHistogramRequestType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDistributionWidgetHistogramRequestType initializes the struct as if Set has been called. +func NewNullableDistributionWidgetHistogramRequestType(val *DistributionWidgetHistogramRequestType) *NullableDistributionWidgetHistogramRequestType { + return &NullableDistributionWidgetHistogramRequestType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDistributionWidgetHistogramRequestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDistributionWidgetHistogramRequestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_distribution_widget_request.go b/api/v1/datadog/model_distribution_widget_request.go new file mode 100644 index 00000000000..abac82b5928 --- /dev/null +++ b/api/v1/datadog/model_distribution_widget_request.go @@ -0,0 +1,648 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// DistributionWidgetRequest Updated distribution widget. +type DistributionWidgetRequest struct { + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The APM stats query for table and distributions widgets. + ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Widget query. + Q *string `json:"q,omitempty"` + // Query definition for Distribution Widget Histogram Request + Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` + // Request type for the histogram request. + RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + // Widget style definition. + Style *WidgetStyle `json:"style,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{} +} + +// NewDistributionWidgetRequest instantiates a new DistributionWidgetRequest 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 NewDistributionWidgetRequest() *DistributionWidgetRequest { + this := DistributionWidgetRequest{} + return &this +} + +// NewDistributionWidgetRequestWithDefaults instantiates a new DistributionWidgetRequest 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 NewDistributionWidgetRequestWithDefaults() *DistributionWidgetRequest { + this := DistributionWidgetRequest{} + return &this +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *DistributionWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetApmStatsQuery returns the ApmStatsQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetApmStatsQuery() ApmStatsQueryDefinition { + if o == nil || o.ApmStatsQuery == nil { + var ret ApmStatsQueryDefinition + return ret + } + return *o.ApmStatsQuery +} + +// GetApmStatsQueryOk returns a tuple with the ApmStatsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetApmStatsQueryOk() (*ApmStatsQueryDefinition, bool) { + if o == nil || o.ApmStatsQuery == nil { + return nil, false + } + return o.ApmStatsQuery, true +} + +// HasApmStatsQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasApmStatsQuery() bool { + if o != nil && o.ApmStatsQuery != nil { + return true + } + + return false +} + +// SetApmStatsQuery gets a reference to the given ApmStatsQueryDefinition and assigns it to the ApmStatsQuery field. +func (o *DistributionWidgetRequest) SetApmStatsQuery(v ApmStatsQueryDefinition) { + o.ApmStatsQuery = &v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *DistributionWidgetRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *DistributionWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *DistributionWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *DistributionWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *DistributionWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *DistributionWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetQuery() DistributionWidgetHistogramRequestQuery { + if o == nil || o.Query == nil { + var ret DistributionWidgetHistogramRequestQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetQueryOk() (*DistributionWidgetHistogramRequestQuery, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given DistributionWidgetHistogramRequestQuery and assigns it to the Query field. +func (o *DistributionWidgetRequest) SetQuery(v DistributionWidgetHistogramRequestQuery) { + o.Query = &v +} + +// GetRequestType returns the RequestType field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetRequestType() DistributionWidgetHistogramRequestType { + if o == nil || o.RequestType == nil { + var ret DistributionWidgetHistogramRequestType + return ret + } + return *o.RequestType +} + +// GetRequestTypeOk returns a tuple with the RequestType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetRequestTypeOk() (*DistributionWidgetHistogramRequestType, bool) { + if o == nil || o.RequestType == nil { + return nil, false + } + return o.RequestType, true +} + +// HasRequestType returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasRequestType() bool { + if o != nil && o.RequestType != nil { + return true + } + + return false +} + +// SetRequestType gets a reference to the given DistributionWidgetHistogramRequestType and assigns it to the RequestType field. +func (o *DistributionWidgetRequest) SetRequestType(v DistributionWidgetHistogramRequestType) { + o.RequestType = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *DistributionWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *DistributionWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// GetStyle returns the Style field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetStyle() WidgetStyle { + if o == nil || o.Style == nil { + var ret WidgetStyle + return ret + } + return *o.Style +} + +// GetStyleOk returns a tuple with the Style field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetStyleOk() (*WidgetStyle, bool) { + if o == nil || o.Style == nil { + return nil, false + } + return o.Style, true +} + +// HasStyle returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasStyle() bool { + if o != nil && o.Style != nil { + return true + } + + return false +} + +// SetStyle gets a reference to the given WidgetStyle and assigns it to the Style field. +func (o *DistributionWidgetRequest) SetStyle(v WidgetStyle) { + o.Style = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DistributionWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.ApmStatsQuery != nil { + toSerialize["apm_stats_query"] = o.ApmStatsQuery + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.RequestType != nil { + toSerialize["request_type"] = o.RequestType + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + if o.Style != nil { + toSerialize["style"] = o.Style + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` + RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + Style *WidgetStyle `json:"style,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.RequestType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.ApmStatsQuery != nil && all.ApmStatsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmStatsQuery = all.ApmStatsQuery + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + o.Query = all.Query + o.RequestType = all.RequestType + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Style = all.Style + return nil +} diff --git a/api/v1/datadog/model_distribution_widget_x_axis.go b/api/v1/datadog/model_distribution_widget_x_axis.go new file mode 100644 index 00000000000..fee4f35f7da --- /dev/null +++ b/api/v1/datadog/model_distribution_widget_x_axis.go @@ -0,0 +1,231 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// DistributionWidgetXAxis X Axis controls for the distribution widget. +type DistributionWidgetXAxis struct { + // True includes zero. + IncludeZero *bool `json:"include_zero,omitempty"` + // Specifies maximum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. + Max *string `json:"max,omitempty"` + // Specifies minimum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. + Min *string `json:"min,omitempty"` + // Specifies the scale type. Possible values are `linear`. + Scale *string `json:"scale,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{} +} + +// NewDistributionWidgetXAxis instantiates a new DistributionWidgetXAxis 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 NewDistributionWidgetXAxis() *DistributionWidgetXAxis { + this := DistributionWidgetXAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// NewDistributionWidgetXAxisWithDefaults instantiates a new DistributionWidgetXAxis 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 NewDistributionWidgetXAxisWithDefaults() *DistributionWidgetXAxis { + this := DistributionWidgetXAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// GetIncludeZero returns the IncludeZero field value if set, zero value otherwise. +func (o *DistributionWidgetXAxis) GetIncludeZero() bool { + if o == nil || o.IncludeZero == nil { + var ret bool + return ret + } + return *o.IncludeZero +} + +// GetIncludeZeroOk returns a tuple with the IncludeZero field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetXAxis) GetIncludeZeroOk() (*bool, bool) { + if o == nil || o.IncludeZero == nil { + return nil, false + } + return o.IncludeZero, true +} + +// HasIncludeZero returns a boolean if a field has been set. +func (o *DistributionWidgetXAxis) HasIncludeZero() bool { + if o != nil && o.IncludeZero != nil { + return true + } + + return false +} + +// SetIncludeZero gets a reference to the given bool and assigns it to the IncludeZero field. +func (o *DistributionWidgetXAxis) SetIncludeZero(v bool) { + o.IncludeZero = &v +} + +// GetMax returns the Max field value if set, zero value otherwise. +func (o *DistributionWidgetXAxis) GetMax() string { + if o == nil || o.Max == nil { + var ret string + return ret + } + return *o.Max +} + +// GetMaxOk returns a tuple with the Max field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetXAxis) GetMaxOk() (*string, bool) { + if o == nil || o.Max == nil { + return nil, false + } + return o.Max, true +} + +// HasMax returns a boolean if a field has been set. +func (o *DistributionWidgetXAxis) HasMax() bool { + if o != nil && o.Max != nil { + return true + } + + return false +} + +// SetMax gets a reference to the given string and assigns it to the Max field. +func (o *DistributionWidgetXAxis) SetMax(v string) { + o.Max = &v +} + +// GetMin returns the Min field value if set, zero value otherwise. +func (o *DistributionWidgetXAxis) GetMin() string { + if o == nil || o.Min == nil { + var ret string + return ret + } + return *o.Min +} + +// GetMinOk returns a tuple with the Min field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetXAxis) GetMinOk() (*string, bool) { + if o == nil || o.Min == nil { + return nil, false + } + return o.Min, true +} + +// HasMin returns a boolean if a field has been set. +func (o *DistributionWidgetXAxis) HasMin() bool { + if o != nil && o.Min != nil { + return true + } + + return false +} + +// SetMin gets a reference to the given string and assigns it to the Min field. +func (o *DistributionWidgetXAxis) SetMin(v string) { + o.Min = &v +} + +// GetScale returns the Scale field value if set, zero value otherwise. +func (o *DistributionWidgetXAxis) GetScale() string { + if o == nil || o.Scale == nil { + var ret string + return ret + } + return *o.Scale +} + +// GetScaleOk returns a tuple with the Scale field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetXAxis) GetScaleOk() (*string, bool) { + if o == nil || o.Scale == nil { + return nil, false + } + return o.Scale, true +} + +// HasScale returns a boolean if a field has been set. +func (o *DistributionWidgetXAxis) HasScale() bool { + if o != nil && o.Scale != nil { + return true + } + + return false +} + +// SetScale gets a reference to the given string and assigns it to the Scale field. +func (o *DistributionWidgetXAxis) SetScale(v string) { + o.Scale = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DistributionWidgetXAxis) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IncludeZero != nil { + toSerialize["include_zero"] = o.IncludeZero + } + if o.Max != nil { + toSerialize["max"] = o.Max + } + if o.Min != nil { + toSerialize["min"] = o.Min + } + if o.Scale != nil { + toSerialize["scale"] = o.Scale + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IncludeZero *bool `json:"include_zero,omitempty"` + Max *string `json:"max,omitempty"` + Min *string `json:"min,omitempty"` + Scale *string `json:"scale,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IncludeZero = all.IncludeZero + o.Max = all.Max + o.Min = all.Min + o.Scale = all.Scale + return nil +} diff --git a/api/v1/datadog/model_distribution_widget_y_axis.go b/api/v1/datadog/model_distribution_widget_y_axis.go new file mode 100644 index 00000000000..c071c8fe1e7 --- /dev/null +++ b/api/v1/datadog/model_distribution_widget_y_axis.go @@ -0,0 +1,270 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// DistributionWidgetYAxis Y Axis controls for the distribution widget. +type DistributionWidgetYAxis struct { + // True includes zero. + IncludeZero *bool `json:"include_zero,omitempty"` + // The label of the axis to display on the graph. + Label *string `json:"label,omitempty"` + // Specifies the maximum value to show on the y-axis. It takes a number, or auto for default behavior. + Max *string `json:"max,omitempty"` + // Specifies minimum value to show on the y-axis. It takes a number, or auto for default behavior. + Min *string `json:"min,omitempty"` + // Specifies the scale type. Possible values are `linear` or `log`. + Scale *string `json:"scale,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{} +} + +// NewDistributionWidgetYAxis instantiates a new DistributionWidgetYAxis 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 NewDistributionWidgetYAxis() *DistributionWidgetYAxis { + this := DistributionWidgetYAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// NewDistributionWidgetYAxisWithDefaults instantiates a new DistributionWidgetYAxis 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 NewDistributionWidgetYAxisWithDefaults() *DistributionWidgetYAxis { + this := DistributionWidgetYAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// GetIncludeZero returns the IncludeZero field value if set, zero value otherwise. +func (o *DistributionWidgetYAxis) GetIncludeZero() bool { + if o == nil || o.IncludeZero == nil { + var ret bool + return ret + } + return *o.IncludeZero +} + +// GetIncludeZeroOk returns a tuple with the IncludeZero field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetYAxis) GetIncludeZeroOk() (*bool, bool) { + if o == nil || o.IncludeZero == nil { + return nil, false + } + return o.IncludeZero, true +} + +// HasIncludeZero returns a boolean if a field has been set. +func (o *DistributionWidgetYAxis) HasIncludeZero() bool { + if o != nil && o.IncludeZero != nil { + return true + } + + return false +} + +// SetIncludeZero gets a reference to the given bool and assigns it to the IncludeZero field. +func (o *DistributionWidgetYAxis) SetIncludeZero(v bool) { + o.IncludeZero = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *DistributionWidgetYAxis) GetLabel() string { + if o == nil || o.Label == nil { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetYAxis) GetLabelOk() (*string, bool) { + if o == nil || o.Label == nil { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *DistributionWidgetYAxis) HasLabel() bool { + if o != nil && o.Label != nil { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *DistributionWidgetYAxis) SetLabel(v string) { + o.Label = &v +} + +// GetMax returns the Max field value if set, zero value otherwise. +func (o *DistributionWidgetYAxis) GetMax() string { + if o == nil || o.Max == nil { + var ret string + return ret + } + return *o.Max +} + +// GetMaxOk returns a tuple with the Max field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetYAxis) GetMaxOk() (*string, bool) { + if o == nil || o.Max == nil { + return nil, false + } + return o.Max, true +} + +// HasMax returns a boolean if a field has been set. +func (o *DistributionWidgetYAxis) HasMax() bool { + if o != nil && o.Max != nil { + return true + } + + return false +} + +// SetMax gets a reference to the given string and assigns it to the Max field. +func (o *DistributionWidgetYAxis) SetMax(v string) { + o.Max = &v +} + +// GetMin returns the Min field value if set, zero value otherwise. +func (o *DistributionWidgetYAxis) GetMin() string { + if o == nil || o.Min == nil { + var ret string + return ret + } + return *o.Min +} + +// GetMinOk returns a tuple with the Min field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetYAxis) GetMinOk() (*string, bool) { + if o == nil || o.Min == nil { + return nil, false + } + return o.Min, true +} + +// HasMin returns a boolean if a field has been set. +func (o *DistributionWidgetYAxis) HasMin() bool { + if o != nil && o.Min != nil { + return true + } + + return false +} + +// SetMin gets a reference to the given string and assigns it to the Min field. +func (o *DistributionWidgetYAxis) SetMin(v string) { + o.Min = &v +} + +// GetScale returns the Scale field value if set, zero value otherwise. +func (o *DistributionWidgetYAxis) GetScale() string { + if o == nil || o.Scale == nil { + var ret string + return ret + } + return *o.Scale +} + +// GetScaleOk returns a tuple with the Scale field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetYAxis) GetScaleOk() (*string, bool) { + if o == nil || o.Scale == nil { + return nil, false + } + return o.Scale, true +} + +// HasScale returns a boolean if a field has been set. +func (o *DistributionWidgetYAxis) HasScale() bool { + if o != nil && o.Scale != nil { + return true + } + + return false +} + +// SetScale gets a reference to the given string and assigns it to the Scale field. +func (o *DistributionWidgetYAxis) SetScale(v string) { + o.Scale = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DistributionWidgetYAxis) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IncludeZero != nil { + toSerialize["include_zero"] = o.IncludeZero + } + if o.Label != nil { + toSerialize["label"] = o.Label + } + if o.Max != nil { + toSerialize["max"] = o.Max + } + if o.Min != nil { + toSerialize["min"] = o.Min + } + if o.Scale != nil { + toSerialize["scale"] = o.Scale + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DistributionWidgetYAxis) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IncludeZero *bool `json:"include_zero,omitempty"` + Label *string `json:"label,omitempty"` + Max *string `json:"max,omitempty"` + Min *string `json:"min,omitempty"` + Scale *string `json:"scale,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IncludeZero = all.IncludeZero + o.Label = all.Label + o.Max = all.Max + o.Min = all.Min + o.Scale = all.Scale + return nil +} diff --git a/api/v1/datadog/model_downtime.go b/api/v1/datadog/model_downtime.go new file mode 100644 index 00000000000..c68eb44af44 --- /dev/null +++ b/api/v1/datadog/model_downtime.go @@ -0,0 +1,859 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// Downtime Downtiming gives you greater control over monitor notifications by +// allowing you to globally exclude scopes from alerting. +// Downtime settings, which can be scheduled with start and end times, +// prevent all alerting related to specified Datadog tags. +type Downtime struct { + // If a scheduled downtime currently exists. + Active *bool `json:"active,omitempty"` + // The downtime object definition of the active child for the original parent recurring downtime. This + // field will only exist on recurring downtimes. + ActiveChild NullableDowntimeChild `json:"active_child,omitempty"` + // If a scheduled downtime is canceled. + Canceled common.NullableInt64 `json:"canceled,omitempty"` + // User ID of the downtime creator. + CreatorId *int32 `json:"creator_id,omitempty"` + // If a downtime has been disabled. + Disabled *bool `json:"disabled,omitempty"` + // `0` for a downtime applied on `*` or all, + // `1` when the downtime is only scoped to hosts, + // or `2` when the downtime is scoped to anything but hosts. + DowntimeType *int32 `json:"downtime_type,omitempty"` + // POSIX timestamp to end the downtime. If not provided, + // the downtime is in effect indefinitely until you cancel it. + End common.NullableInt64 `json:"end,omitempty"` + // The downtime ID. + Id *int64 `json:"id,omitempty"` + // A message to include with notifications for this downtime. + // Email notifications can be sent to specific users by using the same `@username` notation as events. + Message *string `json:"message,omitempty"` + // A single monitor to which the downtime applies. + // If not provided, the downtime applies to all monitors. + MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` + // A comma-separated list of monitor tags. For example, tags that are applied directly to monitors, + // not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. + // The resulting downtime applies to monitors that match ALL provided monitor tags. + // For example, `service:postgres` **AND** `team:frontend`. + MonitorTags []string `json:"monitor_tags,omitempty"` + // If the first recovery notification during a downtime should be muted. + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + // ID of the parent Downtime. + ParentId common.NullableInt64 `json:"parent_id,omitempty"` + // An object defining the recurrence of the downtime. + Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` + // The scope(s) to which the downtime applies. For example, `host:app2`. + // Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. + // The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`). + Scope []string `json:"scope,omitempty"` + // POSIX timestamp to start the downtime. + // If not provided, the downtime starts the moment it is created. + Start *int64 `json:"start,omitempty"` + // The timezone in which to display the downtime's start and end times in Datadog applications. + Timezone *string `json:"timezone,omitempty"` + // ID of the last user that updated the downtime. + UpdaterId common.NullableInt32 `json:"updater_id,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{} +} + +// NewDowntime instantiates a new Downtime 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 NewDowntime() *Downtime { + this := Downtime{} + return &this +} + +// NewDowntimeWithDefaults instantiates a new Downtime 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 NewDowntimeWithDefaults() *Downtime { + this := Downtime{} + return &this +} + +// GetActive returns the Active field value if set, zero value otherwise. +func (o *Downtime) GetActive() bool { + if o == nil || o.Active == nil { + var ret bool + return ret + } + return *o.Active +} + +// GetActiveOk returns a tuple with the Active field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetActiveOk() (*bool, bool) { + if o == nil || o.Active == nil { + return nil, false + } + return o.Active, true +} + +// HasActive returns a boolean if a field has been set. +func (o *Downtime) HasActive() bool { + if o != nil && o.Active != nil { + return true + } + + return false +} + +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *Downtime) SetActive(v bool) { + o.Active = &v +} + +// GetActiveChild returns the ActiveChild field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Downtime) GetActiveChild() DowntimeChild { + if o == nil || o.ActiveChild.Get() == nil { + var ret DowntimeChild + return ret + } + return *o.ActiveChild.Get() +} + +// GetActiveChildOk returns a tuple with the ActiveChild 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 *Downtime) GetActiveChildOk() (*DowntimeChild, bool) { + if o == nil { + return nil, false + } + return o.ActiveChild.Get(), o.ActiveChild.IsSet() +} + +// HasActiveChild returns a boolean if a field has been set. +func (o *Downtime) HasActiveChild() bool { + if o != nil && o.ActiveChild.IsSet() { + return true + } + + return false +} + +// SetActiveChild gets a reference to the given NullableDowntimeChild and assigns it to the ActiveChild field. +func (o *Downtime) SetActiveChild(v DowntimeChild) { + o.ActiveChild.Set(&v) +} + +// SetActiveChildNil sets the value for ActiveChild to be an explicit nil. +func (o *Downtime) SetActiveChildNil() { + o.ActiveChild.Set(nil) +} + +// UnsetActiveChild ensures that no value is present for ActiveChild, not even an explicit nil. +func (o *Downtime) UnsetActiveChild() { + o.ActiveChild.Unset() +} + +// GetCanceled returns the Canceled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Downtime) GetCanceled() int64 { + if o == nil || o.Canceled.Get() == nil { + var ret int64 + return ret + } + return *o.Canceled.Get() +} + +// GetCanceledOk returns a tuple with the Canceled 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 *Downtime) GetCanceledOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Canceled.Get(), o.Canceled.IsSet() +} + +// HasCanceled returns a boolean if a field has been set. +func (o *Downtime) HasCanceled() bool { + if o != nil && o.Canceled.IsSet() { + return true + } + + return false +} + +// SetCanceled gets a reference to the given common.NullableInt64 and assigns it to the Canceled field. +func (o *Downtime) SetCanceled(v int64) { + o.Canceled.Set(&v) +} + +// SetCanceledNil sets the value for Canceled to be an explicit nil. +func (o *Downtime) SetCanceledNil() { + o.Canceled.Set(nil) +} + +// UnsetCanceled ensures that no value is present for Canceled, not even an explicit nil. +func (o *Downtime) UnsetCanceled() { + o.Canceled.Unset() +} + +// GetCreatorId returns the CreatorId field value if set, zero value otherwise. +func (o *Downtime) GetCreatorId() int32 { + if o == nil || o.CreatorId == nil { + var ret int32 + return ret + } + return *o.CreatorId +} + +// GetCreatorIdOk returns a tuple with the CreatorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetCreatorIdOk() (*int32, bool) { + if o == nil || o.CreatorId == nil { + return nil, false + } + return o.CreatorId, true +} + +// HasCreatorId returns a boolean if a field has been set. +func (o *Downtime) HasCreatorId() bool { + if o != nil && o.CreatorId != nil { + return true + } + + return false +} + +// SetCreatorId gets a reference to the given int32 and assigns it to the CreatorId field. +func (o *Downtime) SetCreatorId(v int32) { + o.CreatorId = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *Downtime) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *Downtime) HasDisabled() bool { + if o != nil && o.Disabled != nil { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *Downtime) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetDowntimeType returns the DowntimeType field value if set, zero value otherwise. +func (o *Downtime) GetDowntimeType() int32 { + if o == nil || o.DowntimeType == nil { + var ret int32 + return ret + } + return *o.DowntimeType +} + +// GetDowntimeTypeOk returns a tuple with the DowntimeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetDowntimeTypeOk() (*int32, bool) { + if o == nil || o.DowntimeType == nil { + return nil, false + } + return o.DowntimeType, true +} + +// HasDowntimeType returns a boolean if a field has been set. +func (o *Downtime) HasDowntimeType() bool { + if o != nil && o.DowntimeType != nil { + return true + } + + return false +} + +// SetDowntimeType gets a reference to the given int32 and assigns it to the DowntimeType field. +func (o *Downtime) SetDowntimeType(v int32) { + o.DowntimeType = &v +} + +// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Downtime) GetEnd() int64 { + if o == nil || o.End.Get() == nil { + var ret int64 + return ret + } + return *o.End.Get() +} + +// GetEndOk returns a tuple with the End 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 *Downtime) GetEndOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.End.Get(), o.End.IsSet() +} + +// HasEnd returns a boolean if a field has been set. +func (o *Downtime) HasEnd() bool { + if o != nil && o.End.IsSet() { + return true + } + + return false +} + +// SetEnd gets a reference to the given common.NullableInt64 and assigns it to the End field. +func (o *Downtime) SetEnd(v int64) { + o.End.Set(&v) +} + +// SetEndNil sets the value for End to be an explicit nil. +func (o *Downtime) SetEndNil() { + o.End.Set(nil) +} + +// UnsetEnd ensures that no value is present for End, not even an explicit nil. +func (o *Downtime) UnsetEnd() { + o.End.Unset() +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Downtime) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Downtime) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Downtime) SetId(v int64) { + o.Id = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Downtime) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *Downtime) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Downtime) SetMessage(v string) { + o.Message = &v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Downtime) GetMonitorId() int64 { + if o == nil || o.MonitorId.Get() == nil { + var ret int64 + return ret + } + return *o.MonitorId.Get() +} + +// GetMonitorIdOk returns a tuple with the MonitorId 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 *Downtime) GetMonitorIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.MonitorId.Get(), o.MonitorId.IsSet() +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *Downtime) HasMonitorId() bool { + if o != nil && o.MonitorId.IsSet() { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given common.NullableInt64 and assigns it to the MonitorId field. +func (o *Downtime) SetMonitorId(v int64) { + o.MonitorId.Set(&v) +} + +// SetMonitorIdNil sets the value for MonitorId to be an explicit nil. +func (o *Downtime) SetMonitorIdNil() { + o.MonitorId.Set(nil) +} + +// UnsetMonitorId ensures that no value is present for MonitorId, not even an explicit nil. +func (o *Downtime) UnsetMonitorId() { + o.MonitorId.Unset() +} + +// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. +func (o *Downtime) GetMonitorTags() []string { + if o == nil || o.MonitorTags == nil { + var ret []string + return ret + } + return o.MonitorTags +} + +// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetMonitorTagsOk() (*[]string, bool) { + if o == nil || o.MonitorTags == nil { + return nil, false + } + return &o.MonitorTags, true +} + +// HasMonitorTags returns a boolean if a field has been set. +func (o *Downtime) HasMonitorTags() bool { + if o != nil && o.MonitorTags != nil { + return true + } + + return false +} + +// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. +func (o *Downtime) SetMonitorTags(v []string) { + o.MonitorTags = v +} + +// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise. +func (o *Downtime) GetMuteFirstRecoveryNotification() bool { + if o == nil || o.MuteFirstRecoveryNotification == nil { + var ret bool + return ret + } + return *o.MuteFirstRecoveryNotification +} + +// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetMuteFirstRecoveryNotificationOk() (*bool, bool) { + if o == nil || o.MuteFirstRecoveryNotification == nil { + return nil, false + } + return o.MuteFirstRecoveryNotification, true +} + +// HasMuteFirstRecoveryNotification returns a boolean if a field has been set. +func (o *Downtime) HasMuteFirstRecoveryNotification() bool { + if o != nil && o.MuteFirstRecoveryNotification != nil { + return true + } + + return false +} + +// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field. +func (o *Downtime) SetMuteFirstRecoveryNotification(v bool) { + o.MuteFirstRecoveryNotification = &v +} + +// GetParentId returns the ParentId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Downtime) GetParentId() int64 { + if o == nil || o.ParentId.Get() == nil { + var ret int64 + return ret + } + return *o.ParentId.Get() +} + +// GetParentIdOk returns a tuple with the ParentId 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 *Downtime) GetParentIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.ParentId.Get(), o.ParentId.IsSet() +} + +// HasParentId returns a boolean if a field has been set. +func (o *Downtime) HasParentId() bool { + if o != nil && o.ParentId.IsSet() { + return true + } + + return false +} + +// SetParentId gets a reference to the given common.NullableInt64 and assigns it to the ParentId field. +func (o *Downtime) SetParentId(v int64) { + o.ParentId.Set(&v) +} + +// SetParentIdNil sets the value for ParentId to be an explicit nil. +func (o *Downtime) SetParentIdNil() { + o.ParentId.Set(nil) +} + +// UnsetParentId ensures that no value is present for ParentId, not even an explicit nil. +func (o *Downtime) UnsetParentId() { + o.ParentId.Unset() +} + +// GetRecurrence returns the Recurrence field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Downtime) GetRecurrence() DowntimeRecurrence { + if o == nil || o.Recurrence.Get() == nil { + var ret DowntimeRecurrence + return ret + } + return *o.Recurrence.Get() +} + +// GetRecurrenceOk returns a tuple with the Recurrence 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 *Downtime) GetRecurrenceOk() (*DowntimeRecurrence, bool) { + if o == nil { + return nil, false + } + return o.Recurrence.Get(), o.Recurrence.IsSet() +} + +// HasRecurrence returns a boolean if a field has been set. +func (o *Downtime) HasRecurrence() bool { + if o != nil && o.Recurrence.IsSet() { + return true + } + + return false +} + +// SetRecurrence gets a reference to the given NullableDowntimeRecurrence and assigns it to the Recurrence field. +func (o *Downtime) SetRecurrence(v DowntimeRecurrence) { + o.Recurrence.Set(&v) +} + +// SetRecurrenceNil sets the value for Recurrence to be an explicit nil. +func (o *Downtime) SetRecurrenceNil() { + o.Recurrence.Set(nil) +} + +// UnsetRecurrence ensures that no value is present for Recurrence, not even an explicit nil. +func (o *Downtime) UnsetRecurrence() { + o.Recurrence.Unset() +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *Downtime) GetScope() []string { + if o == nil || o.Scope == nil { + var ret []string + return ret + } + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetScopeOk() (*[]string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return &o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *Downtime) HasScope() bool { + if o != nil && o.Scope != nil { + return true + } + + return false +} + +// SetScope gets a reference to the given []string and assigns it to the Scope field. +func (o *Downtime) SetScope(v []string) { + o.Scope = v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *Downtime) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *Downtime) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +func (o *Downtime) SetStart(v int64) { + o.Start = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *Downtime) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Downtime) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *Downtime) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *Downtime) SetTimezone(v string) { + o.Timezone = &v +} + +// GetUpdaterId returns the UpdaterId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Downtime) GetUpdaterId() int32 { + if o == nil || o.UpdaterId.Get() == nil { + var ret int32 + return ret + } + return *o.UpdaterId.Get() +} + +// GetUpdaterIdOk returns a tuple with the UpdaterId 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 *Downtime) GetUpdaterIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.UpdaterId.Get(), o.UpdaterId.IsSet() +} + +// HasUpdaterId returns a boolean if a field has been set. +func (o *Downtime) HasUpdaterId() bool { + if o != nil && o.UpdaterId.IsSet() { + return true + } + + return false +} + +// SetUpdaterId gets a reference to the given common.NullableInt32 and assigns it to the UpdaterId field. +func (o *Downtime) SetUpdaterId(v int32) { + o.UpdaterId.Set(&v) +} + +// SetUpdaterIdNil sets the value for UpdaterId to be an explicit nil. +func (o *Downtime) SetUpdaterIdNil() { + o.UpdaterId.Set(nil) +} + +// UnsetUpdaterId ensures that no value is present for UpdaterId, not even an explicit nil. +func (o *Downtime) UnsetUpdaterId() { + o.UpdaterId.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o Downtime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Active != nil { + toSerialize["active"] = o.Active + } + if o.ActiveChild.IsSet() { + toSerialize["active_child"] = o.ActiveChild.Get() + } + if o.Canceled.IsSet() { + toSerialize["canceled"] = o.Canceled.Get() + } + if o.CreatorId != nil { + toSerialize["creator_id"] = o.CreatorId + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.DowntimeType != nil { + toSerialize["downtime_type"] = o.DowntimeType + } + if o.End.IsSet() { + toSerialize["end"] = o.End.Get() + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.MonitorId.IsSet() { + toSerialize["monitor_id"] = o.MonitorId.Get() + } + if o.MonitorTags != nil { + toSerialize["monitor_tags"] = o.MonitorTags + } + if o.MuteFirstRecoveryNotification != nil { + toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification + } + if o.ParentId.IsSet() { + toSerialize["parent_id"] = o.ParentId.Get() + } + if o.Recurrence.IsSet() { + toSerialize["recurrence"] = o.Recurrence.Get() + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + if o.UpdaterId.IsSet() { + toSerialize["updater_id"] = o.UpdaterId.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Downtime) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Active *bool `json:"active,omitempty"` + ActiveChild NullableDowntimeChild `json:"active_child,omitempty"` + Canceled common.NullableInt64 `json:"canceled,omitempty"` + CreatorId *int32 `json:"creator_id,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + DowntimeType *int32 `json:"downtime_type,omitempty"` + End common.NullableInt64 `json:"end,omitempty"` + Id *int64 `json:"id,omitempty"` + Message *string `json:"message,omitempty"` + MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` + MonitorTags []string `json:"monitor_tags,omitempty"` + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + ParentId common.NullableInt64 `json:"parent_id,omitempty"` + Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` + Scope []string `json:"scope,omitempty"` + Start *int64 `json:"start,omitempty"` + Timezone *string `json:"timezone,omitempty"` + UpdaterId common.NullableInt32 `json:"updater_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Active = all.Active + o.ActiveChild = all.ActiveChild + o.Canceled = all.Canceled + o.CreatorId = all.CreatorId + o.Disabled = all.Disabled + o.DowntimeType = all.DowntimeType + o.End = all.End + o.Id = all.Id + o.Message = all.Message + o.MonitorId = all.MonitorId + o.MonitorTags = all.MonitorTags + o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification + o.ParentId = all.ParentId + o.Recurrence = all.Recurrence + o.Scope = all.Scope + o.Start = all.Start + o.Timezone = all.Timezone + o.UpdaterId = all.UpdaterId + return nil +} diff --git a/api/v1/datadog/model_downtime_child.go b/api/v1/datadog/model_downtime_child.go new file mode 100644 index 00000000000..7c5438f4ad0 --- /dev/null +++ b/api/v1/datadog/model_downtime_child.go @@ -0,0 +1,856 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DowntimeChild The downtime object definition of the active child for the original parent recurring downtime. This +// field will only exist on recurring downtimes. +type DowntimeChild struct { + // If a scheduled downtime currently exists. + Active *bool `json:"active,omitempty"` + // If a scheduled downtime is canceled. + Canceled common.NullableInt64 `json:"canceled,omitempty"` + // User ID of the downtime creator. + CreatorId *int32 `json:"creator_id,omitempty"` + // If a downtime has been disabled. + Disabled *bool `json:"disabled,omitempty"` + // `0` for a downtime applied on `*` or all, + // `1` when the downtime is only scoped to hosts, + // or `2` when the downtime is scoped to anything but hosts. + DowntimeType *int32 `json:"downtime_type,omitempty"` + // POSIX timestamp to end the downtime. If not provided, + // the downtime is in effect indefinitely until you cancel it. + End common.NullableInt64 `json:"end,omitempty"` + // The downtime ID. + Id *int64 `json:"id,omitempty"` + // A message to include with notifications for this downtime. + // Email notifications can be sent to specific users by using the same `@username` notation as events. + Message *string `json:"message,omitempty"` + // A single monitor to which the downtime applies. + // If not provided, the downtime applies to all monitors. + MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` + // A comma-separated list of monitor tags. For example, tags that are applied directly to monitors, + // not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. + // The resulting downtime applies to monitors that match ALL provided monitor tags. + // For example, `service:postgres` **AND** `team:frontend`. + MonitorTags []string `json:"monitor_tags,omitempty"` + // If the first recovery notification during a downtime should be muted. + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + // ID of the parent Downtime. + ParentId common.NullableInt64 `json:"parent_id,omitempty"` + // An object defining the recurrence of the downtime. + Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` + // The scope(s) to which the downtime applies. For example, `host:app2`. + // Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. + // The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`). + Scope []string `json:"scope,omitempty"` + // POSIX timestamp to start the downtime. + // If not provided, the downtime starts the moment it is created. + Start *int64 `json:"start,omitempty"` + // The timezone in which to display the downtime's start and end times in Datadog applications. + Timezone *string `json:"timezone,omitempty"` + // ID of the last user that updated the downtime. + UpdaterId common.NullableInt32 `json:"updater_id,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{} +} + +// NewDowntimeChild instantiates a new DowntimeChild 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 NewDowntimeChild() *DowntimeChild { + this := DowntimeChild{} + return &this +} + +// NewDowntimeChildWithDefaults instantiates a new DowntimeChild 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 NewDowntimeChildWithDefaults() *DowntimeChild { + this := DowntimeChild{} + return &this +} + +// GetActive returns the Active field value if set, zero value otherwise. +func (o *DowntimeChild) GetActive() bool { + if o == nil || o.Active == nil { + var ret bool + return ret + } + return *o.Active +} + +// GetActiveOk returns a tuple with the Active field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetActiveOk() (*bool, bool) { + if o == nil || o.Active == nil { + return nil, false + } + return o.Active, true +} + +// HasActive returns a boolean if a field has been set. +func (o *DowntimeChild) HasActive() bool { + if o != nil && o.Active != nil { + return true + } + + return false +} + +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *DowntimeChild) SetActive(v bool) { + o.Active = &v +} + +// GetCanceled returns the Canceled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeChild) GetCanceled() int64 { + if o == nil || o.Canceled.Get() == nil { + var ret int64 + return ret + } + return *o.Canceled.Get() +} + +// GetCanceledOk returns a tuple with the Canceled 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 *DowntimeChild) GetCanceledOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Canceled.Get(), o.Canceled.IsSet() +} + +// HasCanceled returns a boolean if a field has been set. +func (o *DowntimeChild) HasCanceled() bool { + if o != nil && o.Canceled.IsSet() { + return true + } + + return false +} + +// SetCanceled gets a reference to the given common.NullableInt64 and assigns it to the Canceled field. +func (o *DowntimeChild) SetCanceled(v int64) { + o.Canceled.Set(&v) +} + +// SetCanceledNil sets the value for Canceled to be an explicit nil. +func (o *DowntimeChild) SetCanceledNil() { + o.Canceled.Set(nil) +} + +// UnsetCanceled ensures that no value is present for Canceled, not even an explicit nil. +func (o *DowntimeChild) UnsetCanceled() { + o.Canceled.Unset() +} + +// GetCreatorId returns the CreatorId field value if set, zero value otherwise. +func (o *DowntimeChild) GetCreatorId() int32 { + if o == nil || o.CreatorId == nil { + var ret int32 + return ret + } + return *o.CreatorId +} + +// GetCreatorIdOk returns a tuple with the CreatorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetCreatorIdOk() (*int32, bool) { + if o == nil || o.CreatorId == nil { + return nil, false + } + return o.CreatorId, true +} + +// HasCreatorId returns a boolean if a field has been set. +func (o *DowntimeChild) HasCreatorId() bool { + if o != nil && o.CreatorId != nil { + return true + } + + return false +} + +// SetCreatorId gets a reference to the given int32 and assigns it to the CreatorId field. +func (o *DowntimeChild) SetCreatorId(v int32) { + o.CreatorId = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *DowntimeChild) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *DowntimeChild) HasDisabled() bool { + if o != nil && o.Disabled != nil { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *DowntimeChild) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetDowntimeType returns the DowntimeType field value if set, zero value otherwise. +func (o *DowntimeChild) GetDowntimeType() int32 { + if o == nil || o.DowntimeType == nil { + var ret int32 + return ret + } + return *o.DowntimeType +} + +// GetDowntimeTypeOk returns a tuple with the DowntimeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetDowntimeTypeOk() (*int32, bool) { + if o == nil || o.DowntimeType == nil { + return nil, false + } + return o.DowntimeType, true +} + +// HasDowntimeType returns a boolean if a field has been set. +func (o *DowntimeChild) HasDowntimeType() bool { + if o != nil && o.DowntimeType != nil { + return true + } + + return false +} + +// SetDowntimeType gets a reference to the given int32 and assigns it to the DowntimeType field. +func (o *DowntimeChild) SetDowntimeType(v int32) { + o.DowntimeType = &v +} + +// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeChild) GetEnd() int64 { + if o == nil || o.End.Get() == nil { + var ret int64 + return ret + } + return *o.End.Get() +} + +// GetEndOk returns a tuple with the End 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 *DowntimeChild) GetEndOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.End.Get(), o.End.IsSet() +} + +// HasEnd returns a boolean if a field has been set. +func (o *DowntimeChild) HasEnd() bool { + if o != nil && o.End.IsSet() { + return true + } + + return false +} + +// SetEnd gets a reference to the given common.NullableInt64 and assigns it to the End field. +func (o *DowntimeChild) SetEnd(v int64) { + o.End.Set(&v) +} + +// SetEndNil sets the value for End to be an explicit nil. +func (o *DowntimeChild) SetEndNil() { + o.End.Set(nil) +} + +// UnsetEnd ensures that no value is present for End, not even an explicit nil. +func (o *DowntimeChild) UnsetEnd() { + o.End.Unset() +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DowntimeChild) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DowntimeChild) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *DowntimeChild) SetId(v int64) { + o.Id = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *DowntimeChild) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *DowntimeChild) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *DowntimeChild) SetMessage(v string) { + o.Message = &v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeChild) GetMonitorId() int64 { + if o == nil || o.MonitorId.Get() == nil { + var ret int64 + return ret + } + return *o.MonitorId.Get() +} + +// GetMonitorIdOk returns a tuple with the MonitorId 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 *DowntimeChild) GetMonitorIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.MonitorId.Get(), o.MonitorId.IsSet() +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *DowntimeChild) HasMonitorId() bool { + if o != nil && o.MonitorId.IsSet() { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given common.NullableInt64 and assigns it to the MonitorId field. +func (o *DowntimeChild) SetMonitorId(v int64) { + o.MonitorId.Set(&v) +} + +// SetMonitorIdNil sets the value for MonitorId to be an explicit nil. +func (o *DowntimeChild) SetMonitorIdNil() { + o.MonitorId.Set(nil) +} + +// UnsetMonitorId ensures that no value is present for MonitorId, not even an explicit nil. +func (o *DowntimeChild) UnsetMonitorId() { + o.MonitorId.Unset() +} + +// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. +func (o *DowntimeChild) GetMonitorTags() []string { + if o == nil || o.MonitorTags == nil { + var ret []string + return ret + } + return o.MonitorTags +} + +// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetMonitorTagsOk() (*[]string, bool) { + if o == nil || o.MonitorTags == nil { + return nil, false + } + return &o.MonitorTags, true +} + +// HasMonitorTags returns a boolean if a field has been set. +func (o *DowntimeChild) HasMonitorTags() bool { + if o != nil && o.MonitorTags != nil { + return true + } + + return false +} + +// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. +func (o *DowntimeChild) SetMonitorTags(v []string) { + o.MonitorTags = v +} + +// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise. +func (o *DowntimeChild) GetMuteFirstRecoveryNotification() bool { + if o == nil || o.MuteFirstRecoveryNotification == nil { + var ret bool + return ret + } + return *o.MuteFirstRecoveryNotification +} + +// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetMuteFirstRecoveryNotificationOk() (*bool, bool) { + if o == nil || o.MuteFirstRecoveryNotification == nil { + return nil, false + } + return o.MuteFirstRecoveryNotification, true +} + +// HasMuteFirstRecoveryNotification returns a boolean if a field has been set. +func (o *DowntimeChild) HasMuteFirstRecoveryNotification() bool { + if o != nil && o.MuteFirstRecoveryNotification != nil { + return true + } + + return false +} + +// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field. +func (o *DowntimeChild) SetMuteFirstRecoveryNotification(v bool) { + o.MuteFirstRecoveryNotification = &v +} + +// GetParentId returns the ParentId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeChild) GetParentId() int64 { + if o == nil || o.ParentId.Get() == nil { + var ret int64 + return ret + } + return *o.ParentId.Get() +} + +// GetParentIdOk returns a tuple with the ParentId 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 *DowntimeChild) GetParentIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.ParentId.Get(), o.ParentId.IsSet() +} + +// HasParentId returns a boolean if a field has been set. +func (o *DowntimeChild) HasParentId() bool { + if o != nil && o.ParentId.IsSet() { + return true + } + + return false +} + +// SetParentId gets a reference to the given common.NullableInt64 and assigns it to the ParentId field. +func (o *DowntimeChild) SetParentId(v int64) { + o.ParentId.Set(&v) +} + +// SetParentIdNil sets the value for ParentId to be an explicit nil. +func (o *DowntimeChild) SetParentIdNil() { + o.ParentId.Set(nil) +} + +// UnsetParentId ensures that no value is present for ParentId, not even an explicit nil. +func (o *DowntimeChild) UnsetParentId() { + o.ParentId.Unset() +} + +// GetRecurrence returns the Recurrence field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeChild) GetRecurrence() DowntimeRecurrence { + if o == nil || o.Recurrence.Get() == nil { + var ret DowntimeRecurrence + return ret + } + return *o.Recurrence.Get() +} + +// GetRecurrenceOk returns a tuple with the Recurrence 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 *DowntimeChild) GetRecurrenceOk() (*DowntimeRecurrence, bool) { + if o == nil { + return nil, false + } + return o.Recurrence.Get(), o.Recurrence.IsSet() +} + +// HasRecurrence returns a boolean if a field has been set. +func (o *DowntimeChild) HasRecurrence() bool { + if o != nil && o.Recurrence.IsSet() { + return true + } + + return false +} + +// SetRecurrence gets a reference to the given NullableDowntimeRecurrence and assigns it to the Recurrence field. +func (o *DowntimeChild) SetRecurrence(v DowntimeRecurrence) { + o.Recurrence.Set(&v) +} + +// SetRecurrenceNil sets the value for Recurrence to be an explicit nil. +func (o *DowntimeChild) SetRecurrenceNil() { + o.Recurrence.Set(nil) +} + +// UnsetRecurrence ensures that no value is present for Recurrence, not even an explicit nil. +func (o *DowntimeChild) UnsetRecurrence() { + o.Recurrence.Unset() +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *DowntimeChild) GetScope() []string { + if o == nil || o.Scope == nil { + var ret []string + return ret + } + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetScopeOk() (*[]string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return &o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *DowntimeChild) HasScope() bool { + if o != nil && o.Scope != nil { + return true + } + + return false +} + +// SetScope gets a reference to the given []string and assigns it to the Scope field. +func (o *DowntimeChild) SetScope(v []string) { + o.Scope = v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *DowntimeChild) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *DowntimeChild) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +func (o *DowntimeChild) SetStart(v int64) { + o.Start = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *DowntimeChild) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeChild) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *DowntimeChild) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *DowntimeChild) SetTimezone(v string) { + o.Timezone = &v +} + +// GetUpdaterId returns the UpdaterId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeChild) GetUpdaterId() int32 { + if o == nil || o.UpdaterId.Get() == nil { + var ret int32 + return ret + } + return *o.UpdaterId.Get() +} + +// GetUpdaterIdOk returns a tuple with the UpdaterId 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 *DowntimeChild) GetUpdaterIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.UpdaterId.Get(), o.UpdaterId.IsSet() +} + +// HasUpdaterId returns a boolean if a field has been set. +func (o *DowntimeChild) HasUpdaterId() bool { + if o != nil && o.UpdaterId.IsSet() { + return true + } + + return false +} + +// SetUpdaterId gets a reference to the given common.NullableInt32 and assigns it to the UpdaterId field. +func (o *DowntimeChild) SetUpdaterId(v int32) { + o.UpdaterId.Set(&v) +} + +// SetUpdaterIdNil sets the value for UpdaterId to be an explicit nil. +func (o *DowntimeChild) SetUpdaterIdNil() { + o.UpdaterId.Set(nil) +} + +// UnsetUpdaterId ensures that no value is present for UpdaterId, not even an explicit nil. +func (o *DowntimeChild) UnsetUpdaterId() { + o.UpdaterId.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeChild) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Active != nil { + toSerialize["active"] = o.Active + } + if o.Canceled.IsSet() { + toSerialize["canceled"] = o.Canceled.Get() + } + if o.CreatorId != nil { + toSerialize["creator_id"] = o.CreatorId + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.DowntimeType != nil { + toSerialize["downtime_type"] = o.DowntimeType + } + if o.End.IsSet() { + toSerialize["end"] = o.End.Get() + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.MonitorId.IsSet() { + toSerialize["monitor_id"] = o.MonitorId.Get() + } + if o.MonitorTags != nil { + toSerialize["monitor_tags"] = o.MonitorTags + } + if o.MuteFirstRecoveryNotification != nil { + toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification + } + if o.ParentId.IsSet() { + toSerialize["parent_id"] = o.ParentId.Get() + } + if o.Recurrence.IsSet() { + toSerialize["recurrence"] = o.Recurrence.Get() + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + if o.UpdaterId.IsSet() { + toSerialize["updater_id"] = o.UpdaterId.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeChild) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Active *bool `json:"active,omitempty"` + Canceled common.NullableInt64 `json:"canceled,omitempty"` + CreatorId *int32 `json:"creator_id,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + DowntimeType *int32 `json:"downtime_type,omitempty"` + End common.NullableInt64 `json:"end,omitempty"` + Id *int64 `json:"id,omitempty"` + Message *string `json:"message,omitempty"` + MonitorId common.NullableInt64 `json:"monitor_id,omitempty"` + MonitorTags []string `json:"monitor_tags,omitempty"` + MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"` + ParentId common.NullableInt64 `json:"parent_id,omitempty"` + Recurrence NullableDowntimeRecurrence `json:"recurrence,omitempty"` + Scope []string `json:"scope,omitempty"` + Start *int64 `json:"start,omitempty"` + Timezone *string `json:"timezone,omitempty"` + UpdaterId common.NullableInt32 `json:"updater_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Active = all.Active + o.Canceled = all.Canceled + o.CreatorId = all.CreatorId + o.Disabled = all.Disabled + o.DowntimeType = all.DowntimeType + o.End = all.End + o.Id = all.Id + o.Message = all.Message + o.MonitorId = all.MonitorId + o.MonitorTags = all.MonitorTags + o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification + o.ParentId = all.ParentId + o.Recurrence = all.Recurrence + o.Scope = all.Scope + o.Start = all.Start + o.Timezone = all.Timezone + o.UpdaterId = all.UpdaterId + return nil +} + +// NullableDowntimeChild handles when a null is used for DowntimeChild. +type NullableDowntimeChild struct { + value *DowntimeChild + isSet bool +} + +// Get returns the associated value. +func (v NullableDowntimeChild) Get() *DowntimeChild { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDowntimeChild) Set(val *DowntimeChild) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDowntimeChild) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableDowntimeChild) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDowntimeChild initializes the struct as if Set has been called. +func NewNullableDowntimeChild(val *DowntimeChild) *NullableDowntimeChild { + return &NullableDowntimeChild{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDowntimeChild) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDowntimeChild) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_downtime_recurrence.go b/api/v1/datadog/model_downtime_recurrence.go new file mode 100644 index 00000000000..6e0b81fb5d9 --- /dev/null +++ b/api/v1/datadog/model_downtime_recurrence.go @@ -0,0 +1,381 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DowntimeRecurrence An object defining the recurrence of the downtime. +type DowntimeRecurrence struct { + // How often to repeat as an integer. + // For example, to repeat every 3 days, select a type of `days` and a period of `3`. + Period *int32 `json:"period,omitempty"` + // The `RRULE` standard for defining recurring events (**requires to set "type" to rrule**) + // For example, to have a recurring event on the first day of each month, set the type to `rrule` and set the `FREQ` to `MONTHLY` and `BYMONTHDAY` to `1`. + // Most common `rrule` options from the [iCalendar Spec](https://tools.ietf.org/html/rfc5545) are supported. + // + // **Note**: Attributes specifying the duration in `RRULE` are not supported (for example, `DTSTART`, `DTEND`, `DURATION`). + // More examples available in this [downtime guide](https://docs.datadoghq.com/monitors/guide/suppress-alert-with-downtimes/?tab=api) + Rrule *string `json:"rrule,omitempty"` + // The type of recurrence. Choose from `days`, `weeks`, `months`, `years`, `rrule`. + Type *string `json:"type,omitempty"` + // The date at which the recurrence should end as a POSIX timestamp. + // `until_occurences` and `until_date` are mutually exclusive. + UntilDate common.NullableInt64 `json:"until_date,omitempty"` + // How many times the downtime is rescheduled. + // `until_occurences` and `until_date` are mutually exclusive. + UntilOccurrences common.NullableInt32 `json:"until_occurrences,omitempty"` + // A list of week days to repeat on. Choose from `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat` or `Sun`. + // Only applicable when type is weeks. First letter must be capitalized. + WeekDays []string `json:"week_days,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{} +} + +// NewDowntimeRecurrence instantiates a new DowntimeRecurrence 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 NewDowntimeRecurrence() *DowntimeRecurrence { + this := DowntimeRecurrence{} + return &this +} + +// NewDowntimeRecurrenceWithDefaults instantiates a new DowntimeRecurrence 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 NewDowntimeRecurrenceWithDefaults() *DowntimeRecurrence { + this := DowntimeRecurrence{} + return &this +} + +// GetPeriod returns the Period field value if set, zero value otherwise. +func (o *DowntimeRecurrence) GetPeriod() int32 { + if o == nil || o.Period == nil { + var ret int32 + return ret + } + return *o.Period +} + +// GetPeriodOk returns a tuple with the Period field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRecurrence) GetPeriodOk() (*int32, bool) { + if o == nil || o.Period == nil { + return nil, false + } + return o.Period, true +} + +// HasPeriod returns a boolean if a field has been set. +func (o *DowntimeRecurrence) HasPeriod() bool { + if o != nil && o.Period != nil { + return true + } + + return false +} + +// SetPeriod gets a reference to the given int32 and assigns it to the Period field. +func (o *DowntimeRecurrence) SetPeriod(v int32) { + o.Period = &v +} + +// GetRrule returns the Rrule field value if set, zero value otherwise. +func (o *DowntimeRecurrence) GetRrule() string { + if o == nil || o.Rrule == nil { + var ret string + return ret + } + return *o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRecurrence) GetRruleOk() (*string, bool) { + if o == nil || o.Rrule == nil { + return nil, false + } + return o.Rrule, true +} + +// HasRrule returns a boolean if a field has been set. +func (o *DowntimeRecurrence) HasRrule() bool { + if o != nil && o.Rrule != nil { + return true + } + + return false +} + +// SetRrule gets a reference to the given string and assigns it to the Rrule field. +func (o *DowntimeRecurrence) SetRrule(v string) { + o.Rrule = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DowntimeRecurrence) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DowntimeRecurrence) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DowntimeRecurrence) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DowntimeRecurrence) SetType(v string) { + o.Type = &v +} + +// GetUntilDate returns the UntilDate field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeRecurrence) GetUntilDate() int64 { + if o == nil || o.UntilDate.Get() == nil { + var ret int64 + return ret + } + return *o.UntilDate.Get() +} + +// GetUntilDateOk returns a tuple with the UntilDate 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 *DowntimeRecurrence) GetUntilDateOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.UntilDate.Get(), o.UntilDate.IsSet() +} + +// HasUntilDate returns a boolean if a field has been set. +func (o *DowntimeRecurrence) HasUntilDate() bool { + if o != nil && o.UntilDate.IsSet() { + return true + } + + return false +} + +// SetUntilDate gets a reference to the given common.NullableInt64 and assigns it to the UntilDate field. +func (o *DowntimeRecurrence) SetUntilDate(v int64) { + o.UntilDate.Set(&v) +} + +// SetUntilDateNil sets the value for UntilDate to be an explicit nil. +func (o *DowntimeRecurrence) SetUntilDateNil() { + o.UntilDate.Set(nil) +} + +// UnsetUntilDate ensures that no value is present for UntilDate, not even an explicit nil. +func (o *DowntimeRecurrence) UnsetUntilDate() { + o.UntilDate.Unset() +} + +// GetUntilOccurrences returns the UntilOccurrences field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeRecurrence) GetUntilOccurrences() int32 { + if o == nil || o.UntilOccurrences.Get() == nil { + var ret int32 + return ret + } + return *o.UntilOccurrences.Get() +} + +// GetUntilOccurrencesOk returns a tuple with the UntilOccurrences 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 *DowntimeRecurrence) GetUntilOccurrencesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.UntilOccurrences.Get(), o.UntilOccurrences.IsSet() +} + +// HasUntilOccurrences returns a boolean if a field has been set. +func (o *DowntimeRecurrence) HasUntilOccurrences() bool { + if o != nil && o.UntilOccurrences.IsSet() { + return true + } + + return false +} + +// SetUntilOccurrences gets a reference to the given common.NullableInt32 and assigns it to the UntilOccurrences field. +func (o *DowntimeRecurrence) SetUntilOccurrences(v int32) { + o.UntilOccurrences.Set(&v) +} + +// SetUntilOccurrencesNil sets the value for UntilOccurrences to be an explicit nil. +func (o *DowntimeRecurrence) SetUntilOccurrencesNil() { + o.UntilOccurrences.Set(nil) +} + +// UnsetUntilOccurrences ensures that no value is present for UntilOccurrences, not even an explicit nil. +func (o *DowntimeRecurrence) UnsetUntilOccurrences() { + o.UntilOccurrences.Unset() +} + +// GetWeekDays returns the WeekDays field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DowntimeRecurrence) GetWeekDays() []string { + if o == nil { + var ret []string + return ret + } + return o.WeekDays +} + +// GetWeekDaysOk returns a tuple with the WeekDays 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 *DowntimeRecurrence) GetWeekDaysOk() (*[]string, bool) { + if o == nil || o.WeekDays == nil { + return nil, false + } + return &o.WeekDays, true +} + +// HasWeekDays returns a boolean if a field has been set. +func (o *DowntimeRecurrence) HasWeekDays() bool { + if o != nil && o.WeekDays != nil { + return true + } + + return false +} + +// SetWeekDays gets a reference to the given []string and assigns it to the WeekDays field. +func (o *DowntimeRecurrence) SetWeekDays(v []string) { + o.WeekDays = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DowntimeRecurrence) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Period != nil { + toSerialize["period"] = o.Period + } + if o.Rrule != nil { + toSerialize["rrule"] = o.Rrule + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.UntilDate.IsSet() { + toSerialize["until_date"] = o.UntilDate.Get() + } + if o.UntilOccurrences.IsSet() { + toSerialize["until_occurrences"] = o.UntilOccurrences.Get() + } + if o.WeekDays != nil { + toSerialize["week_days"] = o.WeekDays + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DowntimeRecurrence) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Period *int32 `json:"period,omitempty"` + Rrule *string `json:"rrule,omitempty"` + Type *string `json:"type,omitempty"` + UntilDate common.NullableInt64 `json:"until_date,omitempty"` + UntilOccurrences common.NullableInt32 `json:"until_occurrences,omitempty"` + WeekDays []string `json:"week_days,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Period = all.Period + o.Rrule = all.Rrule + o.Type = all.Type + o.UntilDate = all.UntilDate + o.UntilOccurrences = all.UntilOccurrences + o.WeekDays = all.WeekDays + return nil +} + +// NullableDowntimeRecurrence handles when a null is used for DowntimeRecurrence. +type NullableDowntimeRecurrence struct { + value *DowntimeRecurrence + isSet bool +} + +// Get returns the associated value. +func (v NullableDowntimeRecurrence) Get() *DowntimeRecurrence { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDowntimeRecurrence) Set(val *DowntimeRecurrence) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDowntimeRecurrence) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableDowntimeRecurrence) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDowntimeRecurrence initializes the struct as if Set has been called. +func NewNullableDowntimeRecurrence(val *DowntimeRecurrence) *NullableDowntimeRecurrence { + return &NullableDowntimeRecurrence{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDowntimeRecurrence) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDowntimeRecurrence) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_event.go b/api/v1/datadog/model_event.go new file mode 100644 index 00000000000..1e572c8ccea --- /dev/null +++ b/api/v1/datadog/model_event.go @@ -0,0 +1,605 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Event Object representing an event. +type Event struct { + // If an alert event is enabled, set its type. + // For example, `error`, `warning`, `info`, `success`, `user_update`, + // `recommendation`, and `snapshot`. + AlertType *EventAlertType `json:"alert_type,omitempty"` + // POSIX timestamp of the event. Must be sent as an integer (that is no quotes). + // Limited to events no older than 18 hours. + DateHappened *int64 `json:"date_happened,omitempty"` + // A device name. + DeviceName *string `json:"device_name,omitempty"` + // Host name to associate with the event. + // Any tags associated with the host are also applied to this event. + Host *string `json:"host,omitempty"` + // Integer ID of the event. + Id *int64 `json:"id,omitempty"` + // Handling IDs as large 64-bit numbers can cause loss of accuracy issues with some programming languages. + // Instead, use the string representation of the Event ID to avoid losing accuracy. + IdStr *string `json:"id_str,omitempty"` + // Payload of the event. + Payload *string `json:"payload,omitempty"` + // The priority of the event. For example, `normal` or `low`. + Priority NullableEventPriority `json:"priority,omitempty"` + // The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. + // The list of standard source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). + SourceTypeName *string `json:"source_type_name,omitempty"` + // A list of tags to apply to the event. + Tags []string `json:"tags,omitempty"` + // The body of the event. Limited to 4000 characters. The text supports markdown. + // To use markdown in the event text, start the text block with `%%% \n` and end the text block with `\n %%%`. + // Use `msg_text` with the Datadog Ruby library. + Text *string `json:"text,omitempty"` + // The event title. + Title *string `json:"title,omitempty"` + // URL of the event. + Url *string `json:"url,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{} +} + +// NewEvent instantiates a new Event 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 NewEvent() *Event { + this := Event{} + return &this +} + +// NewEventWithDefaults instantiates a new Event 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 NewEventWithDefaults() *Event { + this := Event{} + return &this +} + +// GetAlertType returns the AlertType field value if set, zero value otherwise. +func (o *Event) GetAlertType() EventAlertType { + if o == nil || o.AlertType == nil { + var ret EventAlertType + return ret + } + return *o.AlertType +} + +// GetAlertTypeOk returns a tuple with the AlertType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetAlertTypeOk() (*EventAlertType, bool) { + if o == nil || o.AlertType == nil { + return nil, false + } + return o.AlertType, true +} + +// HasAlertType returns a boolean if a field has been set. +func (o *Event) HasAlertType() bool { + if o != nil && o.AlertType != nil { + return true + } + + return false +} + +// SetAlertType gets a reference to the given EventAlertType and assigns it to the AlertType field. +func (o *Event) SetAlertType(v EventAlertType) { + o.AlertType = &v +} + +// GetDateHappened returns the DateHappened field value if set, zero value otherwise. +func (o *Event) GetDateHappened() int64 { + if o == nil || o.DateHappened == nil { + var ret int64 + return ret + } + return *o.DateHappened +} + +// GetDateHappenedOk returns a tuple with the DateHappened field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetDateHappenedOk() (*int64, bool) { + if o == nil || o.DateHappened == nil { + return nil, false + } + return o.DateHappened, true +} + +// HasDateHappened returns a boolean if a field has been set. +func (o *Event) HasDateHappened() bool { + if o != nil && o.DateHappened != nil { + return true + } + + return false +} + +// SetDateHappened gets a reference to the given int64 and assigns it to the DateHappened field. +func (o *Event) SetDateHappened(v int64) { + o.DateHappened = &v +} + +// GetDeviceName returns the DeviceName field value if set, zero value otherwise. +func (o *Event) GetDeviceName() string { + if o == nil || o.DeviceName == nil { + var ret string + return ret + } + return *o.DeviceName +} + +// GetDeviceNameOk returns a tuple with the DeviceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetDeviceNameOk() (*string, bool) { + if o == nil || o.DeviceName == nil { + return nil, false + } + return o.DeviceName, true +} + +// HasDeviceName returns a boolean if a field has been set. +func (o *Event) HasDeviceName() bool { + if o != nil && o.DeviceName != nil { + return true + } + + return false +} + +// SetDeviceName gets a reference to the given string and assigns it to the DeviceName field. +func (o *Event) SetDeviceName(v string) { + o.DeviceName = &v +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *Event) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *Event) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *Event) SetHost(v string) { + o.Host = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Event) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Event) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Event) SetId(v int64) { + o.Id = &v +} + +// GetIdStr returns the IdStr field value if set, zero value otherwise. +func (o *Event) GetIdStr() string { + if o == nil || o.IdStr == nil { + var ret string + return ret + } + return *o.IdStr +} + +// GetIdStrOk returns a tuple with the IdStr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetIdStrOk() (*string, bool) { + if o == nil || o.IdStr == nil { + return nil, false + } + return o.IdStr, true +} + +// HasIdStr returns a boolean if a field has been set. +func (o *Event) HasIdStr() bool { + if o != nil && o.IdStr != nil { + return true + } + + return false +} + +// SetIdStr gets a reference to the given string and assigns it to the IdStr field. +func (o *Event) SetIdStr(v string) { + o.IdStr = &v +} + +// GetPayload returns the Payload field value if set, zero value otherwise. +func (o *Event) GetPayload() string { + if o == nil || o.Payload == nil { + var ret string + return ret + } + return *o.Payload +} + +// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetPayloadOk() (*string, bool) { + if o == nil || o.Payload == nil { + return nil, false + } + return o.Payload, true +} + +// HasPayload returns a boolean if a field has been set. +func (o *Event) HasPayload() bool { + if o != nil && o.Payload != nil { + return true + } + + return false +} + +// SetPayload gets a reference to the given string and assigns it to the Payload field. +func (o *Event) SetPayload(v string) { + o.Payload = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Event) GetPriority() EventPriority { + if o == nil || o.Priority.Get() == nil { + var ret EventPriority + return ret + } + return *o.Priority.Get() +} + +// GetPriorityOk returns a tuple with the Priority 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 *Event) GetPriorityOk() (*EventPriority, bool) { + if o == nil { + return nil, false + } + return o.Priority.Get(), o.Priority.IsSet() +} + +// HasPriority returns a boolean if a field has been set. +func (o *Event) HasPriority() bool { + if o != nil && o.Priority.IsSet() { + return true + } + + return false +} + +// SetPriority gets a reference to the given NullableEventPriority and assigns it to the Priority field. +func (o *Event) SetPriority(v EventPriority) { + o.Priority.Set(&v) +} + +// SetPriorityNil sets the value for Priority to be an explicit nil. +func (o *Event) SetPriorityNil() { + o.Priority.Set(nil) +} + +// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. +func (o *Event) UnsetPriority() { + o.Priority.Unset() +} + +// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. +func (o *Event) GetSourceTypeName() string { + if o == nil || o.SourceTypeName == nil { + var ret string + return ret + } + return *o.SourceTypeName +} + +// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetSourceTypeNameOk() (*string, bool) { + if o == nil || o.SourceTypeName == nil { + return nil, false + } + return o.SourceTypeName, true +} + +// HasSourceTypeName returns a boolean if a field has been set. +func (o *Event) HasSourceTypeName() bool { + if o != nil && o.SourceTypeName != nil { + return true + } + + return false +} + +// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. +func (o *Event) SetSourceTypeName(v string) { + o.SourceTypeName = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Event) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *Event) GetTagsOk() (*[]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 *Event) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Event) SetTags(v []string) { + o.Tags = v +} + +// GetText returns the Text field value if set, zero value otherwise. +func (o *Event) GetText() string { + if o == nil || o.Text == nil { + var ret string + return ret + } + return *o.Text +} + +// GetTextOk returns a tuple with the Text field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetTextOk() (*string, bool) { + if o == nil || o.Text == nil { + return nil, false + } + return o.Text, true +} + +// HasText returns a boolean if a field has been set. +func (o *Event) HasText() bool { + if o != nil && o.Text != nil { + return true + } + + return false +} + +// SetText gets a reference to the given string and assigns it to the Text field. +func (o *Event) SetText(v string) { + o.Text = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *Event) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *Event) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *Event) SetTitle(v string) { + o.Title = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *Event) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *Event) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *Event) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Event) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AlertType != nil { + toSerialize["alert_type"] = o.AlertType + } + if o.DateHappened != nil { + toSerialize["date_happened"] = o.DateHappened + } + if o.DeviceName != nil { + toSerialize["device_name"] = o.DeviceName + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IdStr != nil { + toSerialize["id_str"] = o.IdStr + } + if o.Payload != nil { + toSerialize["payload"] = o.Payload + } + if o.Priority.IsSet() { + toSerialize["priority"] = o.Priority.Get() + } + if o.SourceTypeName != nil { + toSerialize["source_type_name"] = o.SourceTypeName + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Text != nil { + toSerialize["text"] = o.Text + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Event) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AlertType *EventAlertType `json:"alert_type,omitempty"` + DateHappened *int64 `json:"date_happened,omitempty"` + DeviceName *string `json:"device_name,omitempty"` + Host *string `json:"host,omitempty"` + Id *int64 `json:"id,omitempty"` + IdStr *string `json:"id_str,omitempty"` + Payload *string `json:"payload,omitempty"` + Priority NullableEventPriority `json:"priority,omitempty"` + SourceTypeName *string `json:"source_type_name,omitempty"` + Tags []string `json:"tags,omitempty"` + Text *string `json:"text,omitempty"` + Title *string `json:"title,omitempty"` + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.AlertType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AlertType = all.AlertType + o.DateHappened = all.DateHappened + o.DeviceName = all.DeviceName + o.Host = all.Host + o.Id = all.Id + o.IdStr = all.IdStr + o.Payload = all.Payload + o.Priority = all.Priority + o.SourceTypeName = all.SourceTypeName + o.Tags = all.Tags + o.Text = all.Text + o.Title = all.Title + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_event_alert_type.go b/api/v1/datadog/model_event_alert_type.go new file mode 100644 index 00000000000..26e0e8737e6 --- /dev/null +++ b/api/v1/datadog/model_event_alert_type.go @@ -0,0 +1,121 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventAlertType If an alert event is enabled, set its type. +// For example, `error`, `warning`, `info`, `success`, `user_update`, +// `recommendation`, and `snapshot`. +type EventAlertType string + +// List of EventAlertType. +const ( + EVENTALERTTYPE_ERROR EventAlertType = "error" + EVENTALERTTYPE_WARNING EventAlertType = "warning" + EVENTALERTTYPE_INFO EventAlertType = "info" + EVENTALERTTYPE_SUCCESS EventAlertType = "success" + EVENTALERTTYPE_USER_UPDATE EventAlertType = "user_update" + EVENTALERTTYPE_RECOMMENDATION EventAlertType = "recommendation" + EVENTALERTTYPE_SNAPSHOT EventAlertType = "snapshot" +) + +var allowedEventAlertTypeEnumValues = []EventAlertType{ + EVENTALERTTYPE_ERROR, + EVENTALERTTYPE_WARNING, + EVENTALERTTYPE_INFO, + EVENTALERTTYPE_SUCCESS, + EVENTALERTTYPE_USER_UPDATE, + EVENTALERTTYPE_RECOMMENDATION, + EVENTALERTTYPE_SNAPSHOT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventAlertType) GetAllowedValues() []EventAlertType { + return allowedEventAlertTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventAlertType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventAlertType(value) + return nil +} + +// NewEventAlertTypeFromValue returns a pointer to a valid EventAlertType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventAlertTypeFromValue(v string) (*EventAlertType, error) { + ev := EventAlertType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventAlertType: valid values are %v", v, allowedEventAlertTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventAlertType) IsValid() bool { + for _, existing := range allowedEventAlertTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventAlertType value. +func (v EventAlertType) Ptr() *EventAlertType { + return &v +} + +// NullableEventAlertType handles when a null is used for EventAlertType. +type NullableEventAlertType struct { + value *EventAlertType + isSet bool +} + +// Get returns the associated value. +func (v NullableEventAlertType) Get() *EventAlertType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventAlertType) Set(val *EventAlertType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventAlertType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventAlertType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventAlertType initializes the struct as if Set has been called. +func NewNullableEventAlertType(val *EventAlertType) *NullableEventAlertType { + return &NullableEventAlertType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventAlertType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventAlertType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_event_create_request.go b/api/v1/datadog/model_event_create_request.go new file mode 100644 index 00000000000..bbf76333186 --- /dev/null +++ b/api/v1/datadog/model_event_create_request.go @@ -0,0 +1,522 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventCreateRequest Object representing an event. +type EventCreateRequest struct { + // An arbitrary string to use for aggregation. Limited to 100 characters. + // If you specify a key, all events using that key are grouped together in the Event Stream. + AggregationKey *string `json:"aggregation_key,omitempty"` + // If an alert event is enabled, set its type. + // For example, `error`, `warning`, `info`, `success`, `user_update`, + // `recommendation`, and `snapshot`. + AlertType *EventAlertType `json:"alert_type,omitempty"` + // POSIX timestamp of the event. Must be sent as an integer (that is no quotes). + // Limited to events no older than 18 hours + DateHappened *int64 `json:"date_happened,omitempty"` + // A device name. + DeviceName *string `json:"device_name,omitempty"` + // Host name to associate with the event. + // Any tags associated with the host are also applied to this event. + Host *string `json:"host,omitempty"` + // The priority of the event. For example, `normal` or `low`. + Priority NullableEventPriority `json:"priority,omitempty"` + // ID of the parent event. Must be sent as an integer (that is no quotes). + RelatedEventId *int64 `json:"related_event_id,omitempty"` + // The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. + // A complete list of source attribute values [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). + SourceTypeName *string `json:"source_type_name,omitempty"` + // A list of tags to apply to the event. + Tags []string `json:"tags,omitempty"` + // The body of the event. Limited to 4000 characters. The text supports markdown. + // To use markdown in the event text, start the text block with `%%% \n` and end the text block with `\n %%%`. + // Use `msg_text` with the Datadog Ruby library. + Text string `json:"text"` + // The event title. + Title string `json:"title"` + // 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{} +} + +// NewEventCreateRequest instantiates a new EventCreateRequest 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 NewEventCreateRequest(text string, title string) *EventCreateRequest { + this := EventCreateRequest{} + this.Text = text + this.Title = title + return &this +} + +// NewEventCreateRequestWithDefaults instantiates a new EventCreateRequest 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 NewEventCreateRequestWithDefaults() *EventCreateRequest { + this := EventCreateRequest{} + return &this +} + +// GetAggregationKey returns the AggregationKey field value if set, zero value otherwise. +func (o *EventCreateRequest) GetAggregationKey() string { + if o == nil || o.AggregationKey == nil { + var ret string + return ret + } + return *o.AggregationKey +} + +// GetAggregationKeyOk returns a tuple with the AggregationKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetAggregationKeyOk() (*string, bool) { + if o == nil || o.AggregationKey == nil { + return nil, false + } + return o.AggregationKey, true +} + +// HasAggregationKey returns a boolean if a field has been set. +func (o *EventCreateRequest) HasAggregationKey() bool { + if o != nil && o.AggregationKey != nil { + return true + } + + return false +} + +// SetAggregationKey gets a reference to the given string and assigns it to the AggregationKey field. +func (o *EventCreateRequest) SetAggregationKey(v string) { + o.AggregationKey = &v +} + +// GetAlertType returns the AlertType field value if set, zero value otherwise. +func (o *EventCreateRequest) GetAlertType() EventAlertType { + if o == nil || o.AlertType == nil { + var ret EventAlertType + return ret + } + return *o.AlertType +} + +// GetAlertTypeOk returns a tuple with the AlertType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetAlertTypeOk() (*EventAlertType, bool) { + if o == nil || o.AlertType == nil { + return nil, false + } + return o.AlertType, true +} + +// HasAlertType returns a boolean if a field has been set. +func (o *EventCreateRequest) HasAlertType() bool { + if o != nil && o.AlertType != nil { + return true + } + + return false +} + +// SetAlertType gets a reference to the given EventAlertType and assigns it to the AlertType field. +func (o *EventCreateRequest) SetAlertType(v EventAlertType) { + o.AlertType = &v +} + +// GetDateHappened returns the DateHappened field value if set, zero value otherwise. +func (o *EventCreateRequest) GetDateHappened() int64 { + if o == nil || o.DateHappened == nil { + var ret int64 + return ret + } + return *o.DateHappened +} + +// GetDateHappenedOk returns a tuple with the DateHappened field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetDateHappenedOk() (*int64, bool) { + if o == nil || o.DateHappened == nil { + return nil, false + } + return o.DateHappened, true +} + +// HasDateHappened returns a boolean if a field has been set. +func (o *EventCreateRequest) HasDateHappened() bool { + if o != nil && o.DateHappened != nil { + return true + } + + return false +} + +// SetDateHappened gets a reference to the given int64 and assigns it to the DateHappened field. +func (o *EventCreateRequest) SetDateHappened(v int64) { + o.DateHappened = &v +} + +// GetDeviceName returns the DeviceName field value if set, zero value otherwise. +func (o *EventCreateRequest) GetDeviceName() string { + if o == nil || o.DeviceName == nil { + var ret string + return ret + } + return *o.DeviceName +} + +// GetDeviceNameOk returns a tuple with the DeviceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetDeviceNameOk() (*string, bool) { + if o == nil || o.DeviceName == nil { + return nil, false + } + return o.DeviceName, true +} + +// HasDeviceName returns a boolean if a field has been set. +func (o *EventCreateRequest) HasDeviceName() bool { + if o != nil && o.DeviceName != nil { + return true + } + + return false +} + +// SetDeviceName gets a reference to the given string and assigns it to the DeviceName field. +func (o *EventCreateRequest) SetDeviceName(v string) { + o.DeviceName = &v +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *EventCreateRequest) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *EventCreateRequest) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *EventCreateRequest) SetHost(v string) { + o.Host = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EventCreateRequest) GetPriority() EventPriority { + if o == nil || o.Priority.Get() == nil { + var ret EventPriority + return ret + } + return *o.Priority.Get() +} + +// GetPriorityOk returns a tuple with the Priority 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 *EventCreateRequest) GetPriorityOk() (*EventPriority, bool) { + if o == nil { + return nil, false + } + return o.Priority.Get(), o.Priority.IsSet() +} + +// HasPriority returns a boolean if a field has been set. +func (o *EventCreateRequest) HasPriority() bool { + if o != nil && o.Priority.IsSet() { + return true + } + + return false +} + +// SetPriority gets a reference to the given NullableEventPriority and assigns it to the Priority field. +func (o *EventCreateRequest) SetPriority(v EventPriority) { + o.Priority.Set(&v) +} + +// SetPriorityNil sets the value for Priority to be an explicit nil. +func (o *EventCreateRequest) SetPriorityNil() { + o.Priority.Set(nil) +} + +// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. +func (o *EventCreateRequest) UnsetPriority() { + o.Priority.Unset() +} + +// GetRelatedEventId returns the RelatedEventId field value if set, zero value otherwise. +func (o *EventCreateRequest) GetRelatedEventId() int64 { + if o == nil || o.RelatedEventId == nil { + var ret int64 + return ret + } + return *o.RelatedEventId +} + +// GetRelatedEventIdOk returns a tuple with the RelatedEventId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetRelatedEventIdOk() (*int64, bool) { + if o == nil || o.RelatedEventId == nil { + return nil, false + } + return o.RelatedEventId, true +} + +// HasRelatedEventId returns a boolean if a field has been set. +func (o *EventCreateRequest) HasRelatedEventId() bool { + if o != nil && o.RelatedEventId != nil { + return true + } + + return false +} + +// SetRelatedEventId gets a reference to the given int64 and assigns it to the RelatedEventId field. +func (o *EventCreateRequest) SetRelatedEventId(v int64) { + o.RelatedEventId = &v +} + +// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. +func (o *EventCreateRequest) GetSourceTypeName() string { + if o == nil || o.SourceTypeName == nil { + var ret string + return ret + } + return *o.SourceTypeName +} + +// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetSourceTypeNameOk() (*string, bool) { + if o == nil || o.SourceTypeName == nil { + return nil, false + } + return o.SourceTypeName, true +} + +// HasSourceTypeName returns a boolean if a field has been set. +func (o *EventCreateRequest) HasSourceTypeName() bool { + if o != nil && o.SourceTypeName != nil { + return true + } + + return false +} + +// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. +func (o *EventCreateRequest) SetSourceTypeName(v string) { + o.SourceTypeName = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *EventCreateRequest) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *EventCreateRequest) GetTagsOk() (*[]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 *EventCreateRequest) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *EventCreateRequest) SetTags(v []string) { + o.Tags = v +} + +// GetText returns the Text field value. +func (o *EventCreateRequest) GetText() string { + if o == nil { + var ret string + return ret + } + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value. +func (o *EventCreateRequest) SetText(v string) { + o.Text = v +} + +// GetTitle returns the Title field value. +func (o *EventCreateRequest) GetTitle() string { + if o == nil { + var ret string + return ret + } + return o.Title +} + +// GetTitleOk returns a tuple with the Title field value +// and a boolean to check if the value has been set. +func (o *EventCreateRequest) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Title, true +} + +// SetTitle sets field value. +func (o *EventCreateRequest) SetTitle(v string) { + o.Title = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AggregationKey != nil { + toSerialize["aggregation_key"] = o.AggregationKey + } + if o.AlertType != nil { + toSerialize["alert_type"] = o.AlertType + } + if o.DateHappened != nil { + toSerialize["date_happened"] = o.DateHappened + } + if o.DeviceName != nil { + toSerialize["device_name"] = o.DeviceName + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Priority.IsSet() { + toSerialize["priority"] = o.Priority.Get() + } + if o.RelatedEventId != nil { + toSerialize["related_event_id"] = o.RelatedEventId + } + if o.SourceTypeName != nil { + toSerialize["source_type_name"] = o.SourceTypeName + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + toSerialize["text"] = o.Text + toSerialize["title"] = o.Title + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Text *string `json:"text"` + Title *string `json:"title"` + }{} + all := struct { + AggregationKey *string `json:"aggregation_key,omitempty"` + AlertType *EventAlertType `json:"alert_type,omitempty"` + DateHappened *int64 `json:"date_happened,omitempty"` + DeviceName *string `json:"device_name,omitempty"` + Host *string `json:"host,omitempty"` + Priority NullableEventPriority `json:"priority,omitempty"` + RelatedEventId *int64 `json:"related_event_id,omitempty"` + SourceTypeName *string `json:"source_type_name,omitempty"` + Tags []string `json:"tags,omitempty"` + Text string `json:"text"` + Title string `json:"title"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Text == nil { + return fmt.Errorf("Required field text missing") + } + if required.Title == nil { + return fmt.Errorf("Required field title missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.AlertType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AggregationKey = all.AggregationKey + o.AlertType = all.AlertType + o.DateHappened = all.DateHappened + o.DeviceName = all.DeviceName + o.Host = all.Host + o.Priority = all.Priority + o.RelatedEventId = all.RelatedEventId + o.SourceTypeName = all.SourceTypeName + o.Tags = all.Tags + o.Text = all.Text + o.Title = all.Title + return nil +} diff --git a/api/v1/datadog/model_event_create_response.go b/api/v1/datadog/model_event_create_response.go new file mode 100644 index 00000000000..76fffc56efe --- /dev/null +++ b/api/v1/datadog/model_event_create_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 datadog + +import ( + "encoding/json" +) + +// EventCreateResponse Object containing an event response. +type EventCreateResponse struct { + // Object representing an event. + Event *Event `json:"event,omitempty"` + // A status. + Status *string `json:"status,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{} +} + +// NewEventCreateResponse instantiates a new EventCreateResponse 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 NewEventCreateResponse() *EventCreateResponse { + this := EventCreateResponse{} + return &this +} + +// NewEventCreateResponseWithDefaults instantiates a new EventCreateResponse 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 NewEventCreateResponseWithDefaults() *EventCreateResponse { + this := EventCreateResponse{} + return &this +} + +// GetEvent returns the Event field value if set, zero value otherwise. +func (o *EventCreateResponse) GetEvent() Event { + if o == nil || o.Event == nil { + var ret Event + return ret + } + return *o.Event +} + +// GetEventOk returns a tuple with the Event field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateResponse) GetEventOk() (*Event, bool) { + if o == nil || o.Event == nil { + return nil, false + } + return o.Event, true +} + +// HasEvent returns a boolean if a field has been set. +func (o *EventCreateResponse) HasEvent() bool { + if o != nil && o.Event != nil { + return true + } + + return false +} + +// SetEvent gets a reference to the given Event and assigns it to the Event field. +func (o *EventCreateResponse) SetEvent(v Event) { + o.Event = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *EventCreateResponse) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventCreateResponse) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *EventCreateResponse) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *EventCreateResponse) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Event != nil { + toSerialize["event"] = o.Event + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventCreateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Event *Event `json:"event,omitempty"` + Status *string `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Event != nil && all.Event.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Event = all.Event + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_event_list_response.go b/api/v1/datadog/model_event_list_response.go new file mode 100644 index 00000000000..258b6a3c39a --- /dev/null +++ b/api/v1/datadog/model_event_list_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventListResponse An event list response. +type EventListResponse struct { + // An array of events. + Events []Event `json:"events,omitempty"` + // A status. + Status *string `json:"status,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{} +} + +// NewEventListResponse instantiates a new EventListResponse 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 NewEventListResponse() *EventListResponse { + this := EventListResponse{} + return &this +} + +// NewEventListResponseWithDefaults instantiates a new EventListResponse 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 NewEventListResponseWithDefaults() *EventListResponse { + this := EventListResponse{} + return &this +} + +// GetEvents returns the Events field value if set, zero value otherwise. +func (o *EventListResponse) GetEvents() []Event { + if o == nil || o.Events == nil { + var ret []Event + return ret + } + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventListResponse) GetEventsOk() (*[]Event, bool) { + if o == nil || o.Events == nil { + return nil, false + } + return &o.Events, true +} + +// HasEvents returns a boolean if a field has been set. +func (o *EventListResponse) HasEvents() bool { + if o != nil && o.Events != nil { + return true + } + + return false +} + +// SetEvents gets a reference to the given []Event and assigns it to the Events field. +func (o *EventListResponse) SetEvents(v []Event) { + o.Events = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *EventListResponse) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventListResponse) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *EventListResponse) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *EventListResponse) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Events != nil { + toSerialize["events"] = o.Events + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Events []Event `json:"events,omitempty"` + Status *string `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Events = all.Events + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_event_priority.go b/api/v1/datadog/model_event_priority.go new file mode 100644 index 00000000000..a06ba02f210 --- /dev/null +++ b/api/v1/datadog/model_event_priority.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventPriority The priority of the event. For example, `normal` or `low`. +type EventPriority string + +// List of EventPriority. +const ( + EVENTPRIORITY_NORMAL EventPriority = "normal" + EVENTPRIORITY_LOW EventPriority = "low" +) + +var allowedEventPriorityEnumValues = []EventPriority{ + EVENTPRIORITY_NORMAL, + EVENTPRIORITY_LOW, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventPriority) GetAllowedValues() []EventPriority { + return allowedEventPriorityEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventPriority) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventPriority(value) + return nil +} + +// NewEventPriorityFromValue returns a pointer to a valid EventPriority +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventPriorityFromValue(v string) (*EventPriority, error) { + ev := EventPriority(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventPriority: valid values are %v", v, allowedEventPriorityEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventPriority) IsValid() bool { + for _, existing := range allowedEventPriorityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventPriority value. +func (v EventPriority) Ptr() *EventPriority { + return &v +} + +// NullableEventPriority handles when a null is used for EventPriority. +type NullableEventPriority struct { + value *EventPriority + isSet bool +} + +// Get returns the associated value. +func (v NullableEventPriority) Get() *EventPriority { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventPriority) Set(val *EventPriority) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventPriority) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventPriority) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventPriority initializes the struct as if Set has been called. +func NewNullableEventPriority(val *EventPriority) *NullableEventPriority { + return &NullableEventPriority{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventPriority) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventPriority) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_event_query_definition.go b/api/v1/datadog/model_event_query_definition.go new file mode 100644 index 00000000000..c9953b5b2c8 --- /dev/null +++ b/api/v1/datadog/model_event_query_definition.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventQueryDefinition The event query. +type EventQueryDefinition struct { + // The query being made on the event. + Search string `json:"search"` + // The execution method for multi-value filters. Can be either and or or. + TagsExecution string `json:"tags_execution"` + // 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{} +} + +// NewEventQueryDefinition instantiates a new EventQueryDefinition 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 NewEventQueryDefinition(search string, tagsExecution string) *EventQueryDefinition { + this := EventQueryDefinition{} + this.Search = search + this.TagsExecution = tagsExecution + return &this +} + +// NewEventQueryDefinitionWithDefaults instantiates a new EventQueryDefinition 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 NewEventQueryDefinitionWithDefaults() *EventQueryDefinition { + this := EventQueryDefinition{} + return &this +} + +// GetSearch returns the Search field value. +func (o *EventQueryDefinition) GetSearch() string { + if o == nil { + var ret string + return ret + } + return o.Search +} + +// GetSearchOk returns a tuple with the Search field value +// and a boolean to check if the value has been set. +func (o *EventQueryDefinition) GetSearchOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Search, true +} + +// SetSearch sets field value. +func (o *EventQueryDefinition) SetSearch(v string) { + o.Search = v +} + +// GetTagsExecution returns the TagsExecution field value. +func (o *EventQueryDefinition) GetTagsExecution() string { + if o == nil { + var ret string + return ret + } + return o.TagsExecution +} + +// GetTagsExecutionOk returns a tuple with the TagsExecution field value +// and a boolean to check if the value has been set. +func (o *EventQueryDefinition) GetTagsExecutionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TagsExecution, true +} + +// SetTagsExecution sets field value. +func (o *EventQueryDefinition) SetTagsExecution(v string) { + o.TagsExecution = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["search"] = o.Search + toSerialize["tags_execution"] = o.TagsExecution + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Search *string `json:"search"` + TagsExecution *string `json:"tags_execution"` + }{} + all := struct { + Search string `json:"search"` + TagsExecution string `json:"tags_execution"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Search == nil { + return fmt.Errorf("Required field search missing") + } + if required.TagsExecution == nil { + return fmt.Errorf("Required field tags_execution missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Search = all.Search + o.TagsExecution = all.TagsExecution + return nil +} diff --git a/api/v1/datadog/model_event_response.go b/api/v1/datadog/model_event_response.go new file mode 100644 index 00000000000..a0e64b33d74 --- /dev/null +++ b/api/v1/datadog/model_event_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 datadog + +import ( + "encoding/json" +) + +// EventResponse Object containing an event response. +type EventResponse struct { + // Object representing an event. + Event *Event `json:"event,omitempty"` + // A status. + Status *string `json:"status,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{} +} + +// NewEventResponse instantiates a new EventResponse 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 NewEventResponse() *EventResponse { + this := EventResponse{} + return &this +} + +// NewEventResponseWithDefaults instantiates a new EventResponse 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 NewEventResponseWithDefaults() *EventResponse { + this := EventResponse{} + return &this +} + +// GetEvent returns the Event field value if set, zero value otherwise. +func (o *EventResponse) GetEvent() Event { + if o == nil || o.Event == nil { + var ret Event + return ret + } + return *o.Event +} + +// GetEventOk returns a tuple with the Event field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponse) GetEventOk() (*Event, bool) { + if o == nil || o.Event == nil { + return nil, false + } + return o.Event, true +} + +// HasEvent returns a boolean if a field has been set. +func (o *EventResponse) HasEvent() bool { + if o != nil && o.Event != nil { + return true + } + + return false +} + +// SetEvent gets a reference to the given Event and assigns it to the Event field. +func (o *EventResponse) SetEvent(v Event) { + o.Event = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *EventResponse) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponse) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *EventResponse) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *EventResponse) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Event != nil { + toSerialize["event"] = o.Event + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Event *Event `json:"event,omitempty"` + Status *string `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Event != nil && all.Event.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Event = all.Event + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_event_stream_widget_definition.go b/api/v1/datadog/model_event_stream_widget_definition.go new file mode 100644 index 00000000000..50e99ada886 --- /dev/null +++ b/api/v1/datadog/model_event_stream_widget_definition.go @@ -0,0 +1,404 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventStreamWidgetDefinition The event stream is a widget version of the stream of events +// on the Event Stream view. Only available on FREE layout dashboards. +type EventStreamWidgetDefinition struct { + // Size to use to display an event. + EventSize *WidgetEventSize `json:"event_size,omitempty"` + // Query to filter the event stream with. + Query string `json:"query"` + // The execution method for multi-value filters. Can be either and or or. + TagsExecution *string `json:"tags_execution,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the event stream widget. + Type EventStreamWidgetDefinitionType `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{} +} + +// NewEventStreamWidgetDefinition instantiates a new EventStreamWidgetDefinition 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 NewEventStreamWidgetDefinition(query string, typeVar EventStreamWidgetDefinitionType) *EventStreamWidgetDefinition { + this := EventStreamWidgetDefinition{} + this.Query = query + this.Type = typeVar + return &this +} + +// NewEventStreamWidgetDefinitionWithDefaults instantiates a new EventStreamWidgetDefinition 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 NewEventStreamWidgetDefinitionWithDefaults() *EventStreamWidgetDefinition { + this := EventStreamWidgetDefinition{} + var typeVar EventStreamWidgetDefinitionType = EVENTSTREAMWIDGETDEFINITIONTYPE_EVENT_STREAM + this.Type = typeVar + return &this +} + +// GetEventSize returns the EventSize field value if set, zero value otherwise. +func (o *EventStreamWidgetDefinition) GetEventSize() WidgetEventSize { + if o == nil || o.EventSize == nil { + var ret WidgetEventSize + return ret + } + return *o.EventSize +} + +// GetEventSizeOk returns a tuple with the EventSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventStreamWidgetDefinition) GetEventSizeOk() (*WidgetEventSize, bool) { + if o == nil || o.EventSize == nil { + return nil, false + } + return o.EventSize, true +} + +// HasEventSize returns a boolean if a field has been set. +func (o *EventStreamWidgetDefinition) HasEventSize() bool { + if o != nil && o.EventSize != nil { + return true + } + + return false +} + +// SetEventSize gets a reference to the given WidgetEventSize and assigns it to the EventSize field. +func (o *EventStreamWidgetDefinition) SetEventSize(v WidgetEventSize) { + o.EventSize = &v +} + +// GetQuery returns the Query field value. +func (o *EventStreamWidgetDefinition) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *EventStreamWidgetDefinition) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *EventStreamWidgetDefinition) SetQuery(v string) { + o.Query = v +} + +// GetTagsExecution returns the TagsExecution field value if set, zero value otherwise. +func (o *EventStreamWidgetDefinition) GetTagsExecution() string { + if o == nil || o.TagsExecution == nil { + var ret string + return ret + } + return *o.TagsExecution +} + +// GetTagsExecutionOk returns a tuple with the TagsExecution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventStreamWidgetDefinition) GetTagsExecutionOk() (*string, bool) { + if o == nil || o.TagsExecution == nil { + return nil, false + } + return o.TagsExecution, true +} + +// HasTagsExecution returns a boolean if a field has been set. +func (o *EventStreamWidgetDefinition) HasTagsExecution() bool { + if o != nil && o.TagsExecution != nil { + return true + } + + return false +} + +// SetTagsExecution gets a reference to the given string and assigns it to the TagsExecution field. +func (o *EventStreamWidgetDefinition) SetTagsExecution(v string) { + o.TagsExecution = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *EventStreamWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventStreamWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *EventStreamWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *EventStreamWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *EventStreamWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventStreamWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *EventStreamWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *EventStreamWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *EventStreamWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventStreamWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *EventStreamWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *EventStreamWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *EventStreamWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventStreamWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *EventStreamWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *EventStreamWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *EventStreamWidgetDefinition) GetType() EventStreamWidgetDefinitionType { + if o == nil { + var ret EventStreamWidgetDefinitionType + 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 *EventStreamWidgetDefinition) GetTypeOk() (*EventStreamWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *EventStreamWidgetDefinition) SetType(v EventStreamWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventStreamWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.EventSize != nil { + toSerialize["event_size"] = o.EventSize + } + toSerialize["query"] = o.Query + if o.TagsExecution != nil { + toSerialize["tags_execution"] = o.TagsExecution + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + Type *EventStreamWidgetDefinitionType `json:"type"` + }{} + all := struct { + EventSize *WidgetEventSize `json:"event_size,omitempty"` + Query string `json:"query"` + TagsExecution *string `json:"tags_execution,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type EventStreamWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.EventSize; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.EventSize = all.EventSize + o.Query = all.Query + o.TagsExecution = all.TagsExecution + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_event_stream_widget_definition_type.go b/api/v1/datadog/model_event_stream_widget_definition_type.go new file mode 100644 index 00000000000..c08be45bc50 --- /dev/null +++ b/api/v1/datadog/model_event_stream_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventStreamWidgetDefinitionType Type of the event stream widget. +type EventStreamWidgetDefinitionType string + +// List of EventStreamWidgetDefinitionType. +const ( + EVENTSTREAMWIDGETDEFINITIONTYPE_EVENT_STREAM EventStreamWidgetDefinitionType = "event_stream" +) + +var allowedEventStreamWidgetDefinitionTypeEnumValues = []EventStreamWidgetDefinitionType{ + EVENTSTREAMWIDGETDEFINITIONTYPE_EVENT_STREAM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventStreamWidgetDefinitionType) GetAllowedValues() []EventStreamWidgetDefinitionType { + return allowedEventStreamWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventStreamWidgetDefinitionType(value) + return nil +} + +// NewEventStreamWidgetDefinitionTypeFromValue returns a pointer to a valid EventStreamWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventStreamWidgetDefinitionTypeFromValue(v string) (*EventStreamWidgetDefinitionType, error) { + ev := EventStreamWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventStreamWidgetDefinitionType: valid values are %v", v, allowedEventStreamWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventStreamWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedEventStreamWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventStreamWidgetDefinitionType value. +func (v EventStreamWidgetDefinitionType) Ptr() *EventStreamWidgetDefinitionType { + return &v +} + +// NullableEventStreamWidgetDefinitionType handles when a null is used for EventStreamWidgetDefinitionType. +type NullableEventStreamWidgetDefinitionType struct { + value *EventStreamWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableEventStreamWidgetDefinitionType) Get() *EventStreamWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventStreamWidgetDefinitionType) Set(val *EventStreamWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventStreamWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventStreamWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventStreamWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableEventStreamWidgetDefinitionType(val *EventStreamWidgetDefinitionType) *NullableEventStreamWidgetDefinitionType { + return &NullableEventStreamWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_event_timeline_widget_definition.go b/api/v1/datadog/model_event_timeline_widget_definition.go new file mode 100644 index 00000000000..93b15dd2c7a --- /dev/null +++ b/api/v1/datadog/model_event_timeline_widget_definition.go @@ -0,0 +1,356 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventTimelineWidgetDefinition The event timeline is a widget version of the timeline that appears at the top of the Event Stream view. Only available on FREE layout dashboards. +type EventTimelineWidgetDefinition struct { + // Query to filter the event timeline with. + Query string `json:"query"` + // The execution method for multi-value filters. Can be either and or or. + TagsExecution *string `json:"tags_execution,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the event timeline widget. + Type EventTimelineWidgetDefinitionType `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{} +} + +// NewEventTimelineWidgetDefinition instantiates a new EventTimelineWidgetDefinition 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 NewEventTimelineWidgetDefinition(query string, typeVar EventTimelineWidgetDefinitionType) *EventTimelineWidgetDefinition { + this := EventTimelineWidgetDefinition{} + this.Query = query + this.Type = typeVar + return &this +} + +// NewEventTimelineWidgetDefinitionWithDefaults instantiates a new EventTimelineWidgetDefinition 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 NewEventTimelineWidgetDefinitionWithDefaults() *EventTimelineWidgetDefinition { + this := EventTimelineWidgetDefinition{} + var typeVar EventTimelineWidgetDefinitionType = EVENTTIMELINEWIDGETDEFINITIONTYPE_EVENT_TIMELINE + this.Type = typeVar + return &this +} + +// GetQuery returns the Query field value. +func (o *EventTimelineWidgetDefinition) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *EventTimelineWidgetDefinition) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *EventTimelineWidgetDefinition) SetQuery(v string) { + o.Query = v +} + +// GetTagsExecution returns the TagsExecution field value if set, zero value otherwise. +func (o *EventTimelineWidgetDefinition) GetTagsExecution() string { + if o == nil || o.TagsExecution == nil { + var ret string + return ret + } + return *o.TagsExecution +} + +// GetTagsExecutionOk returns a tuple with the TagsExecution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventTimelineWidgetDefinition) GetTagsExecutionOk() (*string, bool) { + if o == nil || o.TagsExecution == nil { + return nil, false + } + return o.TagsExecution, true +} + +// HasTagsExecution returns a boolean if a field has been set. +func (o *EventTimelineWidgetDefinition) HasTagsExecution() bool { + if o != nil && o.TagsExecution != nil { + return true + } + + return false +} + +// SetTagsExecution gets a reference to the given string and assigns it to the TagsExecution field. +func (o *EventTimelineWidgetDefinition) SetTagsExecution(v string) { + o.TagsExecution = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *EventTimelineWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventTimelineWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *EventTimelineWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *EventTimelineWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *EventTimelineWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventTimelineWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *EventTimelineWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *EventTimelineWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *EventTimelineWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventTimelineWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *EventTimelineWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *EventTimelineWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *EventTimelineWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventTimelineWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *EventTimelineWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *EventTimelineWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *EventTimelineWidgetDefinition) GetType() EventTimelineWidgetDefinitionType { + if o == nil { + var ret EventTimelineWidgetDefinitionType + 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 *EventTimelineWidgetDefinition) GetTypeOk() (*EventTimelineWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *EventTimelineWidgetDefinition) SetType(v EventTimelineWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventTimelineWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["query"] = o.Query + if o.TagsExecution != nil { + toSerialize["tags_execution"] = o.TagsExecution + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + Type *EventTimelineWidgetDefinitionType `json:"type"` + }{} + all := struct { + Query string `json:"query"` + TagsExecution *string `json:"tags_execution,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type EventTimelineWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + o.TagsExecution = all.TagsExecution + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_event_timeline_widget_definition_type.go b/api/v1/datadog/model_event_timeline_widget_definition_type.go new file mode 100644 index 00000000000..b4987245cf1 --- /dev/null +++ b/api/v1/datadog/model_event_timeline_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventTimelineWidgetDefinitionType Type of the event timeline widget. +type EventTimelineWidgetDefinitionType string + +// List of EventTimelineWidgetDefinitionType. +const ( + EVENTTIMELINEWIDGETDEFINITIONTYPE_EVENT_TIMELINE EventTimelineWidgetDefinitionType = "event_timeline" +) + +var allowedEventTimelineWidgetDefinitionTypeEnumValues = []EventTimelineWidgetDefinitionType{ + EVENTTIMELINEWIDGETDEFINITIONTYPE_EVENT_TIMELINE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventTimelineWidgetDefinitionType) GetAllowedValues() []EventTimelineWidgetDefinitionType { + return allowedEventTimelineWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventTimelineWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventTimelineWidgetDefinitionType(value) + return nil +} + +// NewEventTimelineWidgetDefinitionTypeFromValue returns a pointer to a valid EventTimelineWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventTimelineWidgetDefinitionTypeFromValue(v string) (*EventTimelineWidgetDefinitionType, error) { + ev := EventTimelineWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventTimelineWidgetDefinitionType: valid values are %v", v, allowedEventTimelineWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventTimelineWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedEventTimelineWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventTimelineWidgetDefinitionType value. +func (v EventTimelineWidgetDefinitionType) Ptr() *EventTimelineWidgetDefinitionType { + return &v +} + +// NullableEventTimelineWidgetDefinitionType handles when a null is used for EventTimelineWidgetDefinitionType. +type NullableEventTimelineWidgetDefinitionType struct { + value *EventTimelineWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableEventTimelineWidgetDefinitionType) Get() *EventTimelineWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventTimelineWidgetDefinitionType) Set(val *EventTimelineWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventTimelineWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventTimelineWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventTimelineWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableEventTimelineWidgetDefinitionType(val *EventTimelineWidgetDefinitionType) *NullableEventTimelineWidgetDefinitionType { + return &NullableEventTimelineWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventTimelineWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventTimelineWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go b/api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go new file mode 100644 index 00000000000..41f3c6e7070 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_apm_dependency_stat_name.go @@ -0,0 +1,119 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionApmDependencyStatName APM statistic. +type FormulaAndFunctionApmDependencyStatName string + +// List of FormulaAndFunctionApmDependencyStatName. +const ( + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_DURATION FormulaAndFunctionApmDependencyStatName = "avg_duration" + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_ROOT_DURATION FormulaAndFunctionApmDependencyStatName = "avg_root_duration" + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_SPANS_PER_TRACE FormulaAndFunctionApmDependencyStatName = "avg_spans_per_trace" + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_ERROR_RATE FormulaAndFunctionApmDependencyStatName = "error_rate" + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_EXEC_TIME FormulaAndFunctionApmDependencyStatName = "pct_exec_time" + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_OF_TRACES FormulaAndFunctionApmDependencyStatName = "pct_of_traces" + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_TOTAL_TRACES_COUNT FormulaAndFunctionApmDependencyStatName = "total_traces_count" +) + +var allowedFormulaAndFunctionApmDependencyStatNameEnumValues = []FormulaAndFunctionApmDependencyStatName{ + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_DURATION, + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_ROOT_DURATION, + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_AVG_SPANS_PER_TRACE, + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_ERROR_RATE, + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_EXEC_TIME, + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_PCT_OF_TRACES, + FORMULAANDFUNCTIONAPMDEPENDENCYSTATNAME_TOTAL_TRACES_COUNT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionApmDependencyStatName) GetAllowedValues() []FormulaAndFunctionApmDependencyStatName { + return allowedFormulaAndFunctionApmDependencyStatNameEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionApmDependencyStatName) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionApmDependencyStatName(value) + return nil +} + +// NewFormulaAndFunctionApmDependencyStatNameFromValue returns a pointer to a valid FormulaAndFunctionApmDependencyStatName +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionApmDependencyStatNameFromValue(v string) (*FormulaAndFunctionApmDependencyStatName, error) { + ev := FormulaAndFunctionApmDependencyStatName(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmDependencyStatName: valid values are %v", v, allowedFormulaAndFunctionApmDependencyStatNameEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionApmDependencyStatName) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionApmDependencyStatNameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionApmDependencyStatName value. +func (v FormulaAndFunctionApmDependencyStatName) Ptr() *FormulaAndFunctionApmDependencyStatName { + return &v +} + +// NullableFormulaAndFunctionApmDependencyStatName handles when a null is used for FormulaAndFunctionApmDependencyStatName. +type NullableFormulaAndFunctionApmDependencyStatName struct { + value *FormulaAndFunctionApmDependencyStatName + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionApmDependencyStatName) Get() *FormulaAndFunctionApmDependencyStatName { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionApmDependencyStatName) Set(val *FormulaAndFunctionApmDependencyStatName) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionApmDependencyStatName) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionApmDependencyStatName) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionApmDependencyStatName initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionApmDependencyStatName(val *FormulaAndFunctionApmDependencyStatName) *NullableFormulaAndFunctionApmDependencyStatName { + return &NullableFormulaAndFunctionApmDependencyStatName{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionApmDependencyStatName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionApmDependencyStatName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go b/api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go new file mode 100644 index 00000000000..6b4eb95aa94 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_apm_dependency_stats_data_source.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionApmDependencyStatsDataSource Data source for APM dependency stats queries. +type FormulaAndFunctionApmDependencyStatsDataSource string + +// List of FormulaAndFunctionApmDependencyStatsDataSource. +const ( + FORMULAANDFUNCTIONAPMDEPENDENCYSTATSDATASOURCE_APM_DEPENDENCY_STATS FormulaAndFunctionApmDependencyStatsDataSource = "apm_dependency_stats" +) + +var allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues = []FormulaAndFunctionApmDependencyStatsDataSource{ + FORMULAANDFUNCTIONAPMDEPENDENCYSTATSDATASOURCE_APM_DEPENDENCY_STATS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionApmDependencyStatsDataSource) GetAllowedValues() []FormulaAndFunctionApmDependencyStatsDataSource { + return allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionApmDependencyStatsDataSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionApmDependencyStatsDataSource(value) + return nil +} + +// NewFormulaAndFunctionApmDependencyStatsDataSourceFromValue returns a pointer to a valid FormulaAndFunctionApmDependencyStatsDataSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionApmDependencyStatsDataSourceFromValue(v string) (*FormulaAndFunctionApmDependencyStatsDataSource, error) { + ev := FormulaAndFunctionApmDependencyStatsDataSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmDependencyStatsDataSource: valid values are %v", v, allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionApmDependencyStatsDataSource) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionApmDependencyStatsDataSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionApmDependencyStatsDataSource value. +func (v FormulaAndFunctionApmDependencyStatsDataSource) Ptr() *FormulaAndFunctionApmDependencyStatsDataSource { + return &v +} + +// NullableFormulaAndFunctionApmDependencyStatsDataSource handles when a null is used for FormulaAndFunctionApmDependencyStatsDataSource. +type NullableFormulaAndFunctionApmDependencyStatsDataSource struct { + value *FormulaAndFunctionApmDependencyStatsDataSource + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) Get() *FormulaAndFunctionApmDependencyStatsDataSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) Set(val *FormulaAndFunctionApmDependencyStatsDataSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionApmDependencyStatsDataSource initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionApmDependencyStatsDataSource(val *FormulaAndFunctionApmDependencyStatsDataSource) *NullableFormulaAndFunctionApmDependencyStatsDataSource { + return &NullableFormulaAndFunctionApmDependencyStatsDataSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionApmDependencyStatsDataSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionApmDependencyStatsDataSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go b/api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go new file mode 100644 index 00000000000..4990fa2eefc --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_apm_dependency_stats_query_definition.go @@ -0,0 +1,434 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionApmDependencyStatsQueryDefinition A formula and functions APM dependency stats query. +type FormulaAndFunctionApmDependencyStatsQueryDefinition struct { + // Data source for APM dependency stats queries. + DataSource FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` + // APM environment. + Env string `json:"env"` + // Determines whether stats for upstream or downstream dependencies should be queried. + IsUpstream *bool `json:"is_upstream,omitempty"` + // Name of query to use in formulas. + Name string `json:"name"` + // Name of operation on service. + OperationName string `json:"operation_name"` + // The name of the second primary tag used within APM; required when `primary_tag_value` is specified. See https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog. + PrimaryTagName *string `json:"primary_tag_name,omitempty"` + // Filter APM data by the second primary tag. `primary_tag_name` must also be specified. + PrimaryTagValue *string `json:"primary_tag_value,omitempty"` + // APM resource. + ResourceName string `json:"resource_name"` + // APM service. + Service string `json:"service"` + // APM statistic. + Stat FormulaAndFunctionApmDependencyStatName `json:"stat"` + // 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{} +} + +// NewFormulaAndFunctionApmDependencyStatsQueryDefinition instantiates a new FormulaAndFunctionApmDependencyStatsQueryDefinition 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 NewFormulaAndFunctionApmDependencyStatsQueryDefinition(dataSource FormulaAndFunctionApmDependencyStatsDataSource, env string, name string, operationName string, resourceName string, service string, stat FormulaAndFunctionApmDependencyStatName) *FormulaAndFunctionApmDependencyStatsQueryDefinition { + this := FormulaAndFunctionApmDependencyStatsQueryDefinition{} + this.DataSource = dataSource + this.Env = env + this.Name = name + this.OperationName = operationName + this.ResourceName = resourceName + this.Service = service + this.Stat = stat + return &this +} + +// NewFormulaAndFunctionApmDependencyStatsQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionApmDependencyStatsQueryDefinition 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 NewFormulaAndFunctionApmDependencyStatsQueryDefinitionWithDefaults() *FormulaAndFunctionApmDependencyStatsQueryDefinition { + this := FormulaAndFunctionApmDependencyStatsQueryDefinition{} + return &this +} + +// GetDataSource returns the DataSource field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetDataSource() FormulaAndFunctionApmDependencyStatsDataSource { + if o == nil { + var ret FormulaAndFunctionApmDependencyStatsDataSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionApmDependencyStatsDataSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetDataSource(v FormulaAndFunctionApmDependencyStatsDataSource) { + o.DataSource = v +} + +// GetEnv returns the Env field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetEnv() string { + if o == nil { + var ret string + return ret + } + return o.Env +} + +// GetEnvOk returns a tuple with the Env field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetEnvOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Env, true +} + +// SetEnv sets field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetEnv(v string) { + o.Env = v +} + +// GetIsUpstream returns the IsUpstream field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetIsUpstream() bool { + if o == nil || o.IsUpstream == nil { + var ret bool + return ret + } + return *o.IsUpstream +} + +// GetIsUpstreamOk returns a tuple with the IsUpstream field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetIsUpstreamOk() (*bool, bool) { + if o == nil || o.IsUpstream == nil { + return nil, false + } + return o.IsUpstream, true +} + +// HasIsUpstream returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) HasIsUpstream() bool { + if o != nil && o.IsUpstream != nil { + return true + } + + return false +} + +// SetIsUpstream gets a reference to the given bool and assigns it to the IsUpstream field. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetIsUpstream(v bool) { + o.IsUpstream = &v +} + +// GetName returns the Name field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetOperationName returns the OperationName field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetOperationName() string { + if o == nil { + var ret string + return ret + } + return o.OperationName +} + +// GetOperationNameOk returns a tuple with the OperationName field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetOperationNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperationName, true +} + +// SetOperationName sets field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetOperationName(v string) { + o.OperationName = v +} + +// GetPrimaryTagName returns the PrimaryTagName field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagName() string { + if o == nil || o.PrimaryTagName == nil { + var ret string + return ret + } + return *o.PrimaryTagName +} + +// GetPrimaryTagNameOk returns a tuple with the PrimaryTagName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagNameOk() (*string, bool) { + if o == nil || o.PrimaryTagName == nil { + return nil, false + } + return o.PrimaryTagName, true +} + +// HasPrimaryTagName returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) HasPrimaryTagName() bool { + if o != nil && o.PrimaryTagName != nil { + return true + } + + return false +} + +// SetPrimaryTagName gets a reference to the given string and assigns it to the PrimaryTagName field. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetPrimaryTagName(v string) { + o.PrimaryTagName = &v +} + +// GetPrimaryTagValue returns the PrimaryTagValue field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagValue() string { + if o == nil || o.PrimaryTagValue == nil { + var ret string + return ret + } + return *o.PrimaryTagValue +} + +// GetPrimaryTagValueOk returns a tuple with the PrimaryTagValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetPrimaryTagValueOk() (*string, bool) { + if o == nil || o.PrimaryTagValue == nil { + return nil, false + } + return o.PrimaryTagValue, true +} + +// HasPrimaryTagValue returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) HasPrimaryTagValue() bool { + if o != nil && o.PrimaryTagValue != nil { + return true + } + + return false +} + +// SetPrimaryTagValue gets a reference to the given string and assigns it to the PrimaryTagValue field. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetPrimaryTagValue(v string) { + o.PrimaryTagValue = &v +} + +// GetResourceName returns the ResourceName field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetResourceName() string { + if o == nil { + var ret string + return ret + } + return o.ResourceName +} + +// GetResourceNameOk returns a tuple with the ResourceName field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetResourceNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ResourceName, true +} + +// SetResourceName sets field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetResourceName(v string) { + o.ResourceName = v +} + +// GetService returns the Service field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetService() string { + if o == nil { + var ret string + return ret + } + return o.Service +} + +// GetServiceOk returns a tuple with the Service field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Service, true +} + +// SetService sets field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetService(v string) { + o.Service = v +} + +// GetStat returns the Stat field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetStat() FormulaAndFunctionApmDependencyStatName { + if o == nil { + var ret FormulaAndFunctionApmDependencyStatName + return ret + } + return o.Stat +} + +// GetStatOk returns a tuple with the Stat field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetStatOk() (*FormulaAndFunctionApmDependencyStatName, bool) { + if o == nil { + return nil, false + } + return &o.Stat, true +} + +// SetStat sets field value. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) SetStat(v FormulaAndFunctionApmDependencyStatName) { + o.Stat = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionApmDependencyStatsQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data_source"] = o.DataSource + toSerialize["env"] = o.Env + if o.IsUpstream != nil { + toSerialize["is_upstream"] = o.IsUpstream + } + toSerialize["name"] = o.Name + toSerialize["operation_name"] = o.OperationName + if o.PrimaryTagName != nil { + toSerialize["primary_tag_name"] = o.PrimaryTagName + } + if o.PrimaryTagValue != nil { + toSerialize["primary_tag_value"] = o.PrimaryTagValue + } + toSerialize["resource_name"] = o.ResourceName + toSerialize["service"] = o.Service + toSerialize["stat"] = o.Stat + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DataSource *FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` + Env *string `json:"env"` + Name *string `json:"name"` + OperationName *string `json:"operation_name"` + ResourceName *string `json:"resource_name"` + Service *string `json:"service"` + Stat *FormulaAndFunctionApmDependencyStatName `json:"stat"` + }{} + all := struct { + DataSource FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` + Env string `json:"env"` + IsUpstream *bool `json:"is_upstream,omitempty"` + Name string `json:"name"` + OperationName string `json:"operation_name"` + PrimaryTagName *string `json:"primary_tag_name,omitempty"` + PrimaryTagValue *string `json:"primary_tag_value,omitempty"` + ResourceName string `json:"resource_name"` + Service string `json:"service"` + Stat FormulaAndFunctionApmDependencyStatName `json:"stat"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.Env == nil { + return fmt.Errorf("Required field env missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.OperationName == nil { + return fmt.Errorf("Required field operation_name missing") + } + if required.ResourceName == nil { + return fmt.Errorf("Required field resource_name missing") + } + if required.Service == nil { + return fmt.Errorf("Required field service missing") + } + if required.Stat == nil { + return fmt.Errorf("Required field stat missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Stat; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DataSource = all.DataSource + o.Env = all.Env + o.IsUpstream = all.IsUpstream + o.Name = all.Name + o.OperationName = all.OperationName + o.PrimaryTagName = all.PrimaryTagName + o.PrimaryTagValue = all.PrimaryTagValue + o.ResourceName = all.ResourceName + o.Service = all.Service + o.Stat = all.Stat + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go b/api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go new file mode 100644 index 00000000000..823074356d4 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_apm_resource_stat_name.go @@ -0,0 +1,127 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionApmResourceStatName APM resource stat name. +type FormulaAndFunctionApmResourceStatName string + +// List of FormulaAndFunctionApmResourceStatName. +const ( + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERRORS FormulaAndFunctionApmResourceStatName = "errors" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERROR_RATE FormulaAndFunctionApmResourceStatName = "error_rate" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_HITS FormulaAndFunctionApmResourceStatName = "hits" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_AVG FormulaAndFunctionApmResourceStatName = "latency_avg" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_DISTRIBUTION FormulaAndFunctionApmResourceStatName = "latency_distribution" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_MAX FormulaAndFunctionApmResourceStatName = "latency_max" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P50 FormulaAndFunctionApmResourceStatName = "latency_p50" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P75 FormulaAndFunctionApmResourceStatName = "latency_p75" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P90 FormulaAndFunctionApmResourceStatName = "latency_p90" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P95 FormulaAndFunctionApmResourceStatName = "latency_p95" + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P99 FormulaAndFunctionApmResourceStatName = "latency_p99" +) + +var allowedFormulaAndFunctionApmResourceStatNameEnumValues = []FormulaAndFunctionApmResourceStatName{ + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERRORS, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_ERROR_RATE, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_HITS, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_AVG, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_DISTRIBUTION, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_MAX, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P50, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P75, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P90, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P95, + FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_P99, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionApmResourceStatName) GetAllowedValues() []FormulaAndFunctionApmResourceStatName { + return allowedFormulaAndFunctionApmResourceStatNameEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionApmResourceStatName) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionApmResourceStatName(value) + return nil +} + +// NewFormulaAndFunctionApmResourceStatNameFromValue returns a pointer to a valid FormulaAndFunctionApmResourceStatName +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionApmResourceStatNameFromValue(v string) (*FormulaAndFunctionApmResourceStatName, error) { + ev := FormulaAndFunctionApmResourceStatName(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmResourceStatName: valid values are %v", v, allowedFormulaAndFunctionApmResourceStatNameEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionApmResourceStatName) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionApmResourceStatNameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionApmResourceStatName value. +func (v FormulaAndFunctionApmResourceStatName) Ptr() *FormulaAndFunctionApmResourceStatName { + return &v +} + +// NullableFormulaAndFunctionApmResourceStatName handles when a null is used for FormulaAndFunctionApmResourceStatName. +type NullableFormulaAndFunctionApmResourceStatName struct { + value *FormulaAndFunctionApmResourceStatName + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionApmResourceStatName) Get() *FormulaAndFunctionApmResourceStatName { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionApmResourceStatName) Set(val *FormulaAndFunctionApmResourceStatName) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionApmResourceStatName) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionApmResourceStatName) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionApmResourceStatName initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionApmResourceStatName(val *FormulaAndFunctionApmResourceStatName) *NullableFormulaAndFunctionApmResourceStatName { + return &NullableFormulaAndFunctionApmResourceStatName{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionApmResourceStatName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionApmResourceStatName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go b/api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go new file mode 100644 index 00000000000..652ec79553c --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_apm_resource_stats_data_source.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionApmResourceStatsDataSource Data source for APM resource stats queries. +type FormulaAndFunctionApmResourceStatsDataSource string + +// List of FormulaAndFunctionApmResourceStatsDataSource. +const ( + FORMULAANDFUNCTIONAPMRESOURCESTATSDATASOURCE_APM_RESOURCE_STATS FormulaAndFunctionApmResourceStatsDataSource = "apm_resource_stats" +) + +var allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues = []FormulaAndFunctionApmResourceStatsDataSource{ + FORMULAANDFUNCTIONAPMRESOURCESTATSDATASOURCE_APM_RESOURCE_STATS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionApmResourceStatsDataSource) GetAllowedValues() []FormulaAndFunctionApmResourceStatsDataSource { + return allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionApmResourceStatsDataSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionApmResourceStatsDataSource(value) + return nil +} + +// NewFormulaAndFunctionApmResourceStatsDataSourceFromValue returns a pointer to a valid FormulaAndFunctionApmResourceStatsDataSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionApmResourceStatsDataSourceFromValue(v string) (*FormulaAndFunctionApmResourceStatsDataSource, error) { + ev := FormulaAndFunctionApmResourceStatsDataSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionApmResourceStatsDataSource: valid values are %v", v, allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionApmResourceStatsDataSource) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionApmResourceStatsDataSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionApmResourceStatsDataSource value. +func (v FormulaAndFunctionApmResourceStatsDataSource) Ptr() *FormulaAndFunctionApmResourceStatsDataSource { + return &v +} + +// NullableFormulaAndFunctionApmResourceStatsDataSource handles when a null is used for FormulaAndFunctionApmResourceStatsDataSource. +type NullableFormulaAndFunctionApmResourceStatsDataSource struct { + value *FormulaAndFunctionApmResourceStatsDataSource + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionApmResourceStatsDataSource) Get() *FormulaAndFunctionApmResourceStatsDataSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) Set(val *FormulaAndFunctionApmResourceStatsDataSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionApmResourceStatsDataSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionApmResourceStatsDataSource initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionApmResourceStatsDataSource(val *FormulaAndFunctionApmResourceStatsDataSource) *NullableFormulaAndFunctionApmResourceStatsDataSource { + return &NullableFormulaAndFunctionApmResourceStatsDataSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionApmResourceStatsDataSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionApmResourceStatsDataSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go b/api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go new file mode 100644 index 00000000000..b998bc0a572 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_apm_resource_stats_query_definition.go @@ -0,0 +1,446 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionApmResourceStatsQueryDefinition APM resource stats query using formulas and functions. +type FormulaAndFunctionApmResourceStatsQueryDefinition struct { + // Data source for APM resource stats queries. + DataSource FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` + // APM environment. + Env string `json:"env"` + // Array of fields to group results by. + GroupBy []string `json:"group_by,omitempty"` + // Name of this query to use in formulas. + Name string `json:"name"` + // Name of operation on service. + OperationName *string `json:"operation_name,omitempty"` + // Name of the second primary tag used within APM. Required when `primary_tag_value` is specified. See https://docs.datadoghq.com/tracing/guide/setting_primary_tags_to_scope/#add-a-second-primary-tag-in-datadog + PrimaryTagName *string `json:"primary_tag_name,omitempty"` + // Value of the second primary tag by which to filter APM data. `primary_tag_name` must also be specified. + PrimaryTagValue *string `json:"primary_tag_value,omitempty"` + // APM resource name. + ResourceName *string `json:"resource_name,omitempty"` + // APM service name. + Service string `json:"service"` + // APM resource stat name. + Stat FormulaAndFunctionApmResourceStatName `json:"stat"` + // 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{} +} + +// NewFormulaAndFunctionApmResourceStatsQueryDefinition instantiates a new FormulaAndFunctionApmResourceStatsQueryDefinition 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 NewFormulaAndFunctionApmResourceStatsQueryDefinition(dataSource FormulaAndFunctionApmResourceStatsDataSource, env string, name string, service string, stat FormulaAndFunctionApmResourceStatName) *FormulaAndFunctionApmResourceStatsQueryDefinition { + this := FormulaAndFunctionApmResourceStatsQueryDefinition{} + this.DataSource = dataSource + this.Env = env + this.Name = name + this.Service = service + this.Stat = stat + return &this +} + +// NewFormulaAndFunctionApmResourceStatsQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionApmResourceStatsQueryDefinition 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 NewFormulaAndFunctionApmResourceStatsQueryDefinitionWithDefaults() *FormulaAndFunctionApmResourceStatsQueryDefinition { + this := FormulaAndFunctionApmResourceStatsQueryDefinition{} + return &this +} + +// GetDataSource returns the DataSource field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetDataSource() FormulaAndFunctionApmResourceStatsDataSource { + if o == nil { + var ret FormulaAndFunctionApmResourceStatsDataSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionApmResourceStatsDataSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetDataSource(v FormulaAndFunctionApmResourceStatsDataSource) { + o.DataSource = v +} + +// GetEnv returns the Env field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetEnv() string { + if o == nil { + var ret string + return ret + } + return o.Env +} + +// GetEnvOk returns a tuple with the Env field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetEnvOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Env, true +} + +// SetEnv sets field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetEnv(v string) { + o.Env = v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetGroupBy() []string { + if o == nil || o.GroupBy == nil { + var ret []string + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetGroupByOk() (*[]string, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetGroupBy(v []string) { + o.GroupBy = v +} + +// GetName returns the Name field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetOperationName returns the OperationName field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetOperationName() string { + if o == nil || o.OperationName == nil { + var ret string + return ret + } + return *o.OperationName +} + +// GetOperationNameOk returns a tuple with the OperationName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetOperationNameOk() (*string, bool) { + if o == nil || o.OperationName == nil { + return nil, false + } + return o.OperationName, true +} + +// HasOperationName returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasOperationName() bool { + if o != nil && o.OperationName != nil { + return true + } + + return false +} + +// SetOperationName gets a reference to the given string and assigns it to the OperationName field. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetOperationName(v string) { + o.OperationName = &v +} + +// GetPrimaryTagName returns the PrimaryTagName field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagName() string { + if o == nil || o.PrimaryTagName == nil { + var ret string + return ret + } + return *o.PrimaryTagName +} + +// GetPrimaryTagNameOk returns a tuple with the PrimaryTagName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagNameOk() (*string, bool) { + if o == nil || o.PrimaryTagName == nil { + return nil, false + } + return o.PrimaryTagName, true +} + +// HasPrimaryTagName returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasPrimaryTagName() bool { + if o != nil && o.PrimaryTagName != nil { + return true + } + + return false +} + +// SetPrimaryTagName gets a reference to the given string and assigns it to the PrimaryTagName field. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetPrimaryTagName(v string) { + o.PrimaryTagName = &v +} + +// GetPrimaryTagValue returns the PrimaryTagValue field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagValue() string { + if o == nil || o.PrimaryTagValue == nil { + var ret string + return ret + } + return *o.PrimaryTagValue +} + +// GetPrimaryTagValueOk returns a tuple with the PrimaryTagValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetPrimaryTagValueOk() (*string, bool) { + if o == nil || o.PrimaryTagValue == nil { + return nil, false + } + return o.PrimaryTagValue, true +} + +// HasPrimaryTagValue returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasPrimaryTagValue() bool { + if o != nil && o.PrimaryTagValue != nil { + return true + } + + return false +} + +// SetPrimaryTagValue gets a reference to the given string and assigns it to the PrimaryTagValue field. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetPrimaryTagValue(v string) { + o.PrimaryTagValue = &v +} + +// GetResourceName returns the ResourceName field value if set, zero value otherwise. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetResourceName() string { + if o == nil || o.ResourceName == nil { + var ret string + return ret + } + return *o.ResourceName +} + +// GetResourceNameOk returns a tuple with the ResourceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetResourceNameOk() (*string, bool) { + if o == nil || o.ResourceName == nil { + return nil, false + } + return o.ResourceName, true +} + +// HasResourceName returns a boolean if a field has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) HasResourceName() bool { + if o != nil && o.ResourceName != nil { + return true + } + + return false +} + +// SetResourceName gets a reference to the given string and assigns it to the ResourceName field. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetResourceName(v string) { + o.ResourceName = &v +} + +// GetService returns the Service field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetService() string { + if o == nil { + var ret string + return ret + } + return o.Service +} + +// GetServiceOk returns a tuple with the Service field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Service, true +} + +// SetService sets field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetService(v string) { + o.Service = v +} + +// GetStat returns the Stat field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetStat() FormulaAndFunctionApmResourceStatName { + if o == nil { + var ret FormulaAndFunctionApmResourceStatName + return ret + } + return o.Stat +} + +// GetStatOk returns a tuple with the Stat field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) GetStatOk() (*FormulaAndFunctionApmResourceStatName, bool) { + if o == nil { + return nil, false + } + return &o.Stat, true +} + +// SetStat sets field value. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) SetStat(v FormulaAndFunctionApmResourceStatName) { + o.Stat = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionApmResourceStatsQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data_source"] = o.DataSource + toSerialize["env"] = o.Env + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + toSerialize["name"] = o.Name + if o.OperationName != nil { + toSerialize["operation_name"] = o.OperationName + } + if o.PrimaryTagName != nil { + toSerialize["primary_tag_name"] = o.PrimaryTagName + } + if o.PrimaryTagValue != nil { + toSerialize["primary_tag_value"] = o.PrimaryTagValue + } + if o.ResourceName != nil { + toSerialize["resource_name"] = o.ResourceName + } + toSerialize["service"] = o.Service + toSerialize["stat"] = o.Stat + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DataSource *FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` + Env *string `json:"env"` + Name *string `json:"name"` + Service *string `json:"service"` + Stat *FormulaAndFunctionApmResourceStatName `json:"stat"` + }{} + all := struct { + DataSource FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` + Env string `json:"env"` + GroupBy []string `json:"group_by,omitempty"` + Name string `json:"name"` + OperationName *string `json:"operation_name,omitempty"` + PrimaryTagName *string `json:"primary_tag_name,omitempty"` + PrimaryTagValue *string `json:"primary_tag_value,omitempty"` + ResourceName *string `json:"resource_name,omitempty"` + Service string `json:"service"` + Stat FormulaAndFunctionApmResourceStatName `json:"stat"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.Env == nil { + return fmt.Errorf("Required field env missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Service == nil { + return fmt.Errorf("Required field service missing") + } + if required.Stat == nil { + return fmt.Errorf("Required field stat missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Stat; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DataSource = all.DataSource + o.Env = all.Env + o.GroupBy = all.GroupBy + o.Name = all.Name + o.OperationName = all.OperationName + o.PrimaryTagName = all.PrimaryTagName + o.PrimaryTagValue = all.PrimaryTagValue + o.ResourceName = all.ResourceName + o.Service = all.Service + o.Stat = all.Stat + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_event_aggregation.go b/api/v1/datadog/model_formula_and_function_event_aggregation.go new file mode 100644 index 00000000000..3d3667439f7 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_event_aggregation.go @@ -0,0 +1,129 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionEventAggregation Aggregation methods for event platform queries. +type FormulaAndFunctionEventAggregation string + +// List of FormulaAndFunctionEventAggregation. +const ( + FORMULAANDFUNCTIONEVENTAGGREGATION_COUNT FormulaAndFunctionEventAggregation = "count" + FORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY FormulaAndFunctionEventAggregation = "cardinality" + FORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN FormulaAndFunctionEventAggregation = "median" + FORMULAANDFUNCTIONEVENTAGGREGATION_PC75 FormulaAndFunctionEventAggregation = "pc75" + FORMULAANDFUNCTIONEVENTAGGREGATION_PC90 FormulaAndFunctionEventAggregation = "pc90" + FORMULAANDFUNCTIONEVENTAGGREGATION_PC95 FormulaAndFunctionEventAggregation = "pc95" + FORMULAANDFUNCTIONEVENTAGGREGATION_PC98 FormulaAndFunctionEventAggregation = "pc98" + FORMULAANDFUNCTIONEVENTAGGREGATION_PC99 FormulaAndFunctionEventAggregation = "pc99" + FORMULAANDFUNCTIONEVENTAGGREGATION_SUM FormulaAndFunctionEventAggregation = "sum" + FORMULAANDFUNCTIONEVENTAGGREGATION_MIN FormulaAndFunctionEventAggregation = "min" + FORMULAANDFUNCTIONEVENTAGGREGATION_MAX FormulaAndFunctionEventAggregation = "max" + FORMULAANDFUNCTIONEVENTAGGREGATION_AVG FormulaAndFunctionEventAggregation = "avg" +) + +var allowedFormulaAndFunctionEventAggregationEnumValues = []FormulaAndFunctionEventAggregation{ + FORMULAANDFUNCTIONEVENTAGGREGATION_COUNT, + FORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY, + FORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN, + FORMULAANDFUNCTIONEVENTAGGREGATION_PC75, + FORMULAANDFUNCTIONEVENTAGGREGATION_PC90, + FORMULAANDFUNCTIONEVENTAGGREGATION_PC95, + FORMULAANDFUNCTIONEVENTAGGREGATION_PC98, + FORMULAANDFUNCTIONEVENTAGGREGATION_PC99, + FORMULAANDFUNCTIONEVENTAGGREGATION_SUM, + FORMULAANDFUNCTIONEVENTAGGREGATION_MIN, + FORMULAANDFUNCTIONEVENTAGGREGATION_MAX, + FORMULAANDFUNCTIONEVENTAGGREGATION_AVG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionEventAggregation) GetAllowedValues() []FormulaAndFunctionEventAggregation { + return allowedFormulaAndFunctionEventAggregationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionEventAggregation(value) + return nil +} + +// NewFormulaAndFunctionEventAggregationFromValue returns a pointer to a valid FormulaAndFunctionEventAggregation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionEventAggregationFromValue(v string) (*FormulaAndFunctionEventAggregation, error) { + ev := FormulaAndFunctionEventAggregation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionEventAggregation: valid values are %v", v, allowedFormulaAndFunctionEventAggregationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionEventAggregation) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionEventAggregationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionEventAggregation value. +func (v FormulaAndFunctionEventAggregation) Ptr() *FormulaAndFunctionEventAggregation { + return &v +} + +// NullableFormulaAndFunctionEventAggregation handles when a null is used for FormulaAndFunctionEventAggregation. +type NullableFormulaAndFunctionEventAggregation struct { + value *FormulaAndFunctionEventAggregation + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionEventAggregation) Get() *FormulaAndFunctionEventAggregation { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionEventAggregation) Set(val *FormulaAndFunctionEventAggregation) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionEventAggregation) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionEventAggregation) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionEventAggregation initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionEventAggregation(val *FormulaAndFunctionEventAggregation) *NullableFormulaAndFunctionEventAggregation { + return &NullableFormulaAndFunctionEventAggregation{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionEventAggregation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_event_query_definition.go b/api/v1/datadog/model_formula_and_function_event_query_definition.go new file mode 100644 index 00000000000..f673feb854c --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_event_query_definition.go @@ -0,0 +1,308 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionEventQueryDefinition A formula and functions events query. +type FormulaAndFunctionEventQueryDefinition struct { + // Compute options. + Compute FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` + // Data source for event platform-based queries. + DataSource FormulaAndFunctionEventsDataSource `json:"data_source"` + // Group by options. + GroupBy []FormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` + // An array of index names to query in the stream. Omit or use `[]` to query all indexes at once. + Indexes []string `json:"indexes,omitempty"` + // Name of the query for use in formulas. + Name string `json:"name"` + // Search options. + Search *FormulaAndFunctionEventQueryDefinitionSearch `json:"search,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{} +} + +// NewFormulaAndFunctionEventQueryDefinition instantiates a new FormulaAndFunctionEventQueryDefinition 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 NewFormulaAndFunctionEventQueryDefinition(compute FormulaAndFunctionEventQueryDefinitionCompute, dataSource FormulaAndFunctionEventsDataSource, name string) *FormulaAndFunctionEventQueryDefinition { + this := FormulaAndFunctionEventQueryDefinition{} + this.Compute = compute + this.DataSource = dataSource + this.Name = name + return &this +} + +// NewFormulaAndFunctionEventQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionEventQueryDefinition 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 NewFormulaAndFunctionEventQueryDefinitionWithDefaults() *FormulaAndFunctionEventQueryDefinition { + this := FormulaAndFunctionEventQueryDefinition{} + return &this +} + +// GetCompute returns the Compute field value. +func (o *FormulaAndFunctionEventQueryDefinition) GetCompute() FormulaAndFunctionEventQueryDefinitionCompute { + if o == nil { + var ret FormulaAndFunctionEventQueryDefinitionCompute + return ret + } + return o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinition) GetComputeOk() (*FormulaAndFunctionEventQueryDefinitionCompute, bool) { + if o == nil { + return nil, false + } + return &o.Compute, true +} + +// SetCompute sets field value. +func (o *FormulaAndFunctionEventQueryDefinition) SetCompute(v FormulaAndFunctionEventQueryDefinitionCompute) { + o.Compute = v +} + +// GetDataSource returns the DataSource field value. +func (o *FormulaAndFunctionEventQueryDefinition) GetDataSource() FormulaAndFunctionEventsDataSource { + if o == nil { + var ret FormulaAndFunctionEventsDataSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionEventsDataSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *FormulaAndFunctionEventQueryDefinition) SetDataSource(v FormulaAndFunctionEventsDataSource) { + o.DataSource = v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryDefinition) GetGroupBy() []FormulaAndFunctionEventQueryGroupBy { + if o == nil || o.GroupBy == nil { + var ret []FormulaAndFunctionEventQueryGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinition) GetGroupByOk() (*[]FormulaAndFunctionEventQueryGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryDefinition) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []FormulaAndFunctionEventQueryGroupBy and assigns it to the GroupBy field. +func (o *FormulaAndFunctionEventQueryDefinition) SetGroupBy(v []FormulaAndFunctionEventQueryGroupBy) { + o.GroupBy = v +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryDefinition) GetIndexes() []string { + if o == nil || o.Indexes == nil { + var ret []string + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinition) GetIndexesOk() (*[]string, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryDefinition) HasIndexes() bool { + if o != nil && o.Indexes != nil { + return true + } + + return false +} + +// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. +func (o *FormulaAndFunctionEventQueryDefinition) SetIndexes(v []string) { + o.Indexes = v +} + +// GetName returns the Name field value. +func (o *FormulaAndFunctionEventQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *FormulaAndFunctionEventQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetSearch returns the Search field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryDefinition) GetSearch() FormulaAndFunctionEventQueryDefinitionSearch { + if o == nil || o.Search == nil { + var ret FormulaAndFunctionEventQueryDefinitionSearch + return ret + } + return *o.Search +} + +// GetSearchOk returns a tuple with the Search field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinition) GetSearchOk() (*FormulaAndFunctionEventQueryDefinitionSearch, bool) { + if o == nil || o.Search == nil { + return nil, false + } + return o.Search, true +} + +// HasSearch returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryDefinition) HasSearch() bool { + if o != nil && o.Search != nil { + return true + } + + return false +} + +// SetSearch gets a reference to the given FormulaAndFunctionEventQueryDefinitionSearch and assigns it to the Search field. +func (o *FormulaAndFunctionEventQueryDefinition) SetSearch(v FormulaAndFunctionEventQueryDefinitionSearch) { + o.Search = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["compute"] = o.Compute + toSerialize["data_source"] = o.DataSource + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + toSerialize["name"] = o.Name + if o.Search != nil { + toSerialize["search"] = o.Search + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Compute *FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` + DataSource *FormulaAndFunctionEventsDataSource `json:"data_source"` + Name *string `json:"name"` + }{} + all := struct { + Compute FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` + DataSource FormulaAndFunctionEventsDataSource `json:"data_source"` + GroupBy []FormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` + Indexes []string `json:"indexes,omitempty"` + Name string `json:"name"` + Search *FormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Compute == nil { + return fmt.Errorf("Required field compute missing") + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Compute = all.Compute + o.DataSource = all.DataSource + o.GroupBy = all.GroupBy + o.Indexes = all.Indexes + o.Name = all.Name + if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Search = all.Search + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_event_query_definition_compute.go b/api/v1/datadog/model_formula_and_function_event_query_definition_compute.go new file mode 100644 index 00000000000..8a2d9ad268f --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_event_query_definition_compute.go @@ -0,0 +1,189 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionEventQueryDefinitionCompute Compute options. +type FormulaAndFunctionEventQueryDefinitionCompute struct { + // Aggregation methods for event platform queries. + Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` + // A time interval in milliseconds. + Interval *int64 `json:"interval,omitempty"` + // Measurable attribute to compute. + Metric *string `json:"metric,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{} +} + +// NewFormulaAndFunctionEventQueryDefinitionCompute instantiates a new FormulaAndFunctionEventQueryDefinitionCompute 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 NewFormulaAndFunctionEventQueryDefinitionCompute(aggregation FormulaAndFunctionEventAggregation) *FormulaAndFunctionEventQueryDefinitionCompute { + this := FormulaAndFunctionEventQueryDefinitionCompute{} + this.Aggregation = aggregation + return &this +} + +// NewFormulaAndFunctionEventQueryDefinitionComputeWithDefaults instantiates a new FormulaAndFunctionEventQueryDefinitionCompute 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 NewFormulaAndFunctionEventQueryDefinitionComputeWithDefaults() *FormulaAndFunctionEventQueryDefinitionCompute { + this := FormulaAndFunctionEventQueryDefinitionCompute{} + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetAggregation() FormulaAndFunctionEventAggregation { + if o == nil { + var ret FormulaAndFunctionEventAggregation + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetAggregationOk() (*FormulaAndFunctionEventAggregation, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) SetAggregation(v FormulaAndFunctionEventAggregation) { + o.Aggregation = v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetInterval() int64 { + if o == nil || o.Interval == nil { + var ret int64 + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetIntervalOk() (*int64, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given int64 and assigns it to the Interval field. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) SetInterval(v int64) { + o.Interval = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) SetMetric(v string) { + o.Metric = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` + }{} + all := struct { + Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` + Interval *int64 `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Interval = all.Interval + o.Metric = all.Metric + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_event_query_definition_search.go b/api/v1/datadog/model_formula_and_function_event_query_definition_search.go new file mode 100644 index 00000000000..7bd2fadad93 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_event_query_definition_search.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionEventQueryDefinitionSearch Search options. +type FormulaAndFunctionEventQueryDefinitionSearch struct { + // Events search string. + Query string `json:"query"` + // 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{} +} + +// NewFormulaAndFunctionEventQueryDefinitionSearch instantiates a new FormulaAndFunctionEventQueryDefinitionSearch 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 NewFormulaAndFunctionEventQueryDefinitionSearch(query string) *FormulaAndFunctionEventQueryDefinitionSearch { + this := FormulaAndFunctionEventQueryDefinitionSearch{} + this.Query = query + return &this +} + +// NewFormulaAndFunctionEventQueryDefinitionSearchWithDefaults instantiates a new FormulaAndFunctionEventQueryDefinitionSearch 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 NewFormulaAndFunctionEventQueryDefinitionSearchWithDefaults() *FormulaAndFunctionEventQueryDefinitionSearch { + this := FormulaAndFunctionEventQueryDefinitionSearch{} + return &this +} + +// GetQuery returns the Query field value. +func (o *FormulaAndFunctionEventQueryDefinitionSearch) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryDefinitionSearch) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *FormulaAndFunctionEventQueryDefinitionSearch) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + }{} + all := struct { + Query string `json:"query"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_event_query_group_by.go b/api/v1/datadog/model_formula_and_function_event_query_group_by.go new file mode 100644 index 00000000000..2852c351a1c --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_event_query_group_by.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionEventQueryGroupBy List of objects used to group by. +type FormulaAndFunctionEventQueryGroupBy struct { + // Event facet. + Facet string `json:"facet"` + // Number of groups to return. + Limit *int64 `json:"limit,omitempty"` + // Options for sorting group by results. + Sort *FormulaAndFunctionEventQueryGroupBySort `json:"sort,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{} +} + +// NewFormulaAndFunctionEventQueryGroupBy instantiates a new FormulaAndFunctionEventQueryGroupBy 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 NewFormulaAndFunctionEventQueryGroupBy(facet string) *FormulaAndFunctionEventQueryGroupBy { + this := FormulaAndFunctionEventQueryGroupBy{} + this.Facet = facet + return &this +} + +// NewFormulaAndFunctionEventQueryGroupByWithDefaults instantiates a new FormulaAndFunctionEventQueryGroupBy 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 NewFormulaAndFunctionEventQueryGroupByWithDefaults() *FormulaAndFunctionEventQueryGroupBy { + this := FormulaAndFunctionEventQueryGroupBy{} + return &this +} + +// GetFacet returns the Facet field value. +func (o *FormulaAndFunctionEventQueryGroupBy) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryGroupBy) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *FormulaAndFunctionEventQueryGroupBy) SetFacet(v string) { + o.Facet = v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryGroupBy) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryGroupBy) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryGroupBy) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *FormulaAndFunctionEventQueryGroupBy) SetLimit(v int64) { + o.Limit = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryGroupBy) GetSort() FormulaAndFunctionEventQueryGroupBySort { + if o == nil || o.Sort == nil { + var ret FormulaAndFunctionEventQueryGroupBySort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryGroupBy) GetSortOk() (*FormulaAndFunctionEventQueryGroupBySort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryGroupBy) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given FormulaAndFunctionEventQueryGroupBySort and assigns it to the Sort field. +func (o *FormulaAndFunctionEventQueryGroupBy) SetSort(v FormulaAndFunctionEventQueryGroupBySort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Facet *string `json:"facet"` + }{} + all := struct { + Facet string `json:"facet"` + Limit *int64 `json:"limit,omitempty"` + Sort *FormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Facet == nil { + return fmt.Errorf("Required field facet missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Facet = all.Facet + o.Limit = all.Limit + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Sort = all.Sort + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go b/api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go new file mode 100644 index 00000000000..dc7ad5758e5 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_event_query_group_by_sort.go @@ -0,0 +1,201 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionEventQueryGroupBySort Options for sorting group by results. +type FormulaAndFunctionEventQueryGroupBySort struct { + // Aggregation methods for event platform queries. + Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` + // Metric used for sorting group by results. + Metric *string `json:"metric,omitempty"` + // Direction of sort. + Order *QuerySortOrder `json:"order,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{} +} + +// NewFormulaAndFunctionEventQueryGroupBySort instantiates a new FormulaAndFunctionEventQueryGroupBySort 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 NewFormulaAndFunctionEventQueryGroupBySort(aggregation FormulaAndFunctionEventAggregation) *FormulaAndFunctionEventQueryGroupBySort { + this := FormulaAndFunctionEventQueryGroupBySort{} + this.Aggregation = aggregation + var order QuerySortOrder = QUERYSORTORDER_DESC + this.Order = &order + return &this +} + +// NewFormulaAndFunctionEventQueryGroupBySortWithDefaults instantiates a new FormulaAndFunctionEventQueryGroupBySort 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 NewFormulaAndFunctionEventQueryGroupBySortWithDefaults() *FormulaAndFunctionEventQueryGroupBySort { + this := FormulaAndFunctionEventQueryGroupBySort{} + var order QuerySortOrder = QUERYSORTORDER_DESC + this.Order = &order + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *FormulaAndFunctionEventQueryGroupBySort) GetAggregation() FormulaAndFunctionEventAggregation { + if o == nil { + var ret FormulaAndFunctionEventAggregation + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryGroupBySort) GetAggregationOk() (*FormulaAndFunctionEventAggregation, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *FormulaAndFunctionEventQueryGroupBySort) SetAggregation(v FormulaAndFunctionEventAggregation) { + o.Aggregation = v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryGroupBySort) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryGroupBySort) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryGroupBySort) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *FormulaAndFunctionEventQueryGroupBySort) SetMetric(v string) { + o.Metric = &v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *FormulaAndFunctionEventQueryGroupBySort) GetOrder() QuerySortOrder { + if o == nil || o.Order == nil { + var ret QuerySortOrder + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionEventQueryGroupBySort) GetOrderOk() (*QuerySortOrder, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *FormulaAndFunctionEventQueryGroupBySort) HasOrder() bool { + if o != nil && o.Order != nil { + return true + } + + return false +} + +// SetOrder gets a reference to the given QuerySortOrder and assigns it to the Order field. +func (o *FormulaAndFunctionEventQueryGroupBySort) SetOrder(v QuerySortOrder) { + o.Order = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Order != nil { + toSerialize["order"] = o.Order + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` + }{} + all := struct { + Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` + Metric *string `json:"metric,omitempty"` + Order *QuerySortOrder `json:"order,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Metric = all.Metric + o.Order = all.Order + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_events_data_source.go b/api/v1/datadog/model_formula_and_function_events_data_source.go new file mode 100644 index 00000000000..c502bceb811 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_events_data_source.go @@ -0,0 +1,121 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionEventsDataSource Data source for event platform-based queries. +type FormulaAndFunctionEventsDataSource string + +// List of FormulaAndFunctionEventsDataSource. +const ( + FORMULAANDFUNCTIONEVENTSDATASOURCE_LOGS FormulaAndFunctionEventsDataSource = "logs" + FORMULAANDFUNCTIONEVENTSDATASOURCE_SPANS FormulaAndFunctionEventsDataSource = "spans" + FORMULAANDFUNCTIONEVENTSDATASOURCE_NETWORK FormulaAndFunctionEventsDataSource = "network" + FORMULAANDFUNCTIONEVENTSDATASOURCE_RUM FormulaAndFunctionEventsDataSource = "rum" + FORMULAANDFUNCTIONEVENTSDATASOURCE_SECURITY_SIGNALS FormulaAndFunctionEventsDataSource = "security_signals" + FORMULAANDFUNCTIONEVENTSDATASOURCE_PROFILES FormulaAndFunctionEventsDataSource = "profiles" + FORMULAANDFUNCTIONEVENTSDATASOURCE_AUDIT FormulaAndFunctionEventsDataSource = "audit" + FORMULAANDFUNCTIONEVENTSDATASOURCE_EVENTS FormulaAndFunctionEventsDataSource = "events" +) + +var allowedFormulaAndFunctionEventsDataSourceEnumValues = []FormulaAndFunctionEventsDataSource{ + FORMULAANDFUNCTIONEVENTSDATASOURCE_LOGS, + FORMULAANDFUNCTIONEVENTSDATASOURCE_SPANS, + FORMULAANDFUNCTIONEVENTSDATASOURCE_NETWORK, + FORMULAANDFUNCTIONEVENTSDATASOURCE_RUM, + FORMULAANDFUNCTIONEVENTSDATASOURCE_SECURITY_SIGNALS, + FORMULAANDFUNCTIONEVENTSDATASOURCE_PROFILES, + FORMULAANDFUNCTIONEVENTSDATASOURCE_AUDIT, + FORMULAANDFUNCTIONEVENTSDATASOURCE_EVENTS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionEventsDataSource) GetAllowedValues() []FormulaAndFunctionEventsDataSource { + return allowedFormulaAndFunctionEventsDataSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionEventsDataSource(value) + return nil +} + +// NewFormulaAndFunctionEventsDataSourceFromValue returns a pointer to a valid FormulaAndFunctionEventsDataSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionEventsDataSourceFromValue(v string) (*FormulaAndFunctionEventsDataSource, error) { + ev := FormulaAndFunctionEventsDataSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionEventsDataSource: valid values are %v", v, allowedFormulaAndFunctionEventsDataSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionEventsDataSource) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionEventsDataSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionEventsDataSource value. +func (v FormulaAndFunctionEventsDataSource) Ptr() *FormulaAndFunctionEventsDataSource { + return &v +} + +// NullableFormulaAndFunctionEventsDataSource handles when a null is used for FormulaAndFunctionEventsDataSource. +type NullableFormulaAndFunctionEventsDataSource struct { + value *FormulaAndFunctionEventsDataSource + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionEventsDataSource) Get() *FormulaAndFunctionEventsDataSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionEventsDataSource) Set(val *FormulaAndFunctionEventsDataSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionEventsDataSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionEventsDataSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionEventsDataSource initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionEventsDataSource(val *FormulaAndFunctionEventsDataSource) *NullableFormulaAndFunctionEventsDataSource { + return &NullableFormulaAndFunctionEventsDataSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionEventsDataSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_metric_aggregation.go b/api/v1/datadog/model_formula_and_function_metric_aggregation.go new file mode 100644 index 00000000000..c17f966c2bf --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_metric_aggregation.go @@ -0,0 +1,121 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionMetricAggregation The aggregation methods available for metrics queries. +type FormulaAndFunctionMetricAggregation string + +// List of FormulaAndFunctionMetricAggregation. +const ( + FORMULAANDFUNCTIONMETRICAGGREGATION_AVG FormulaAndFunctionMetricAggregation = "avg" + FORMULAANDFUNCTIONMETRICAGGREGATION_MIN FormulaAndFunctionMetricAggregation = "min" + FORMULAANDFUNCTIONMETRICAGGREGATION_MAX FormulaAndFunctionMetricAggregation = "max" + FORMULAANDFUNCTIONMETRICAGGREGATION_SUM FormulaAndFunctionMetricAggregation = "sum" + FORMULAANDFUNCTIONMETRICAGGREGATION_LAST FormulaAndFunctionMetricAggregation = "last" + FORMULAANDFUNCTIONMETRICAGGREGATION_AREA FormulaAndFunctionMetricAggregation = "area" + FORMULAANDFUNCTIONMETRICAGGREGATION_L2NORM FormulaAndFunctionMetricAggregation = "l2norm" + FORMULAANDFUNCTIONMETRICAGGREGATION_PERCENTILE FormulaAndFunctionMetricAggregation = "percentile" +) + +var allowedFormulaAndFunctionMetricAggregationEnumValues = []FormulaAndFunctionMetricAggregation{ + FORMULAANDFUNCTIONMETRICAGGREGATION_AVG, + FORMULAANDFUNCTIONMETRICAGGREGATION_MIN, + FORMULAANDFUNCTIONMETRICAGGREGATION_MAX, + FORMULAANDFUNCTIONMETRICAGGREGATION_SUM, + FORMULAANDFUNCTIONMETRICAGGREGATION_LAST, + FORMULAANDFUNCTIONMETRICAGGREGATION_AREA, + FORMULAANDFUNCTIONMETRICAGGREGATION_L2NORM, + FORMULAANDFUNCTIONMETRICAGGREGATION_PERCENTILE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionMetricAggregation) GetAllowedValues() []FormulaAndFunctionMetricAggregation { + return allowedFormulaAndFunctionMetricAggregationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionMetricAggregation) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionMetricAggregation(value) + return nil +} + +// NewFormulaAndFunctionMetricAggregationFromValue returns a pointer to a valid FormulaAndFunctionMetricAggregation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionMetricAggregationFromValue(v string) (*FormulaAndFunctionMetricAggregation, error) { + ev := FormulaAndFunctionMetricAggregation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionMetricAggregation: valid values are %v", v, allowedFormulaAndFunctionMetricAggregationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionMetricAggregation) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionMetricAggregationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionMetricAggregation value. +func (v FormulaAndFunctionMetricAggregation) Ptr() *FormulaAndFunctionMetricAggregation { + return &v +} + +// NullableFormulaAndFunctionMetricAggregation handles when a null is used for FormulaAndFunctionMetricAggregation. +type NullableFormulaAndFunctionMetricAggregation struct { + value *FormulaAndFunctionMetricAggregation + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionMetricAggregation) Get() *FormulaAndFunctionMetricAggregation { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionMetricAggregation) Set(val *FormulaAndFunctionMetricAggregation) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionMetricAggregation) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionMetricAggregation) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionMetricAggregation initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionMetricAggregation(val *FormulaAndFunctionMetricAggregation) *NullableFormulaAndFunctionMetricAggregation { + return &NullableFormulaAndFunctionMetricAggregation{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionMetricAggregation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionMetricAggregation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_metric_data_source.go b/api/v1/datadog/model_formula_and_function_metric_data_source.go new file mode 100644 index 00000000000..682b3834f7c --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_metric_data_source.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionMetricDataSource Data source for metrics queries. +type FormulaAndFunctionMetricDataSource string + +// List of FormulaAndFunctionMetricDataSource. +const ( + FORMULAANDFUNCTIONMETRICDATASOURCE_METRICS FormulaAndFunctionMetricDataSource = "metrics" +) + +var allowedFormulaAndFunctionMetricDataSourceEnumValues = []FormulaAndFunctionMetricDataSource{ + FORMULAANDFUNCTIONMETRICDATASOURCE_METRICS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionMetricDataSource) GetAllowedValues() []FormulaAndFunctionMetricDataSource { + return allowedFormulaAndFunctionMetricDataSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionMetricDataSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionMetricDataSource(value) + return nil +} + +// NewFormulaAndFunctionMetricDataSourceFromValue returns a pointer to a valid FormulaAndFunctionMetricDataSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionMetricDataSourceFromValue(v string) (*FormulaAndFunctionMetricDataSource, error) { + ev := FormulaAndFunctionMetricDataSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionMetricDataSource: valid values are %v", v, allowedFormulaAndFunctionMetricDataSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionMetricDataSource) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionMetricDataSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionMetricDataSource value. +func (v FormulaAndFunctionMetricDataSource) Ptr() *FormulaAndFunctionMetricDataSource { + return &v +} + +// NullableFormulaAndFunctionMetricDataSource handles when a null is used for FormulaAndFunctionMetricDataSource. +type NullableFormulaAndFunctionMetricDataSource struct { + value *FormulaAndFunctionMetricDataSource + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionMetricDataSource) Get() *FormulaAndFunctionMetricDataSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionMetricDataSource) Set(val *FormulaAndFunctionMetricDataSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionMetricDataSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionMetricDataSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionMetricDataSource initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionMetricDataSource(val *FormulaAndFunctionMetricDataSource) *NullableFormulaAndFunctionMetricDataSource { + return &NullableFormulaAndFunctionMetricDataSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionMetricDataSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionMetricDataSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_metric_query_definition.go b/api/v1/datadog/model_formula_and_function_metric_query_definition.go new file mode 100644 index 00000000000..aa4fadd292e --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_metric_query_definition.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionMetricQueryDefinition A formula and functions metrics query. +type FormulaAndFunctionMetricQueryDefinition struct { + // The aggregation methods available for metrics queries. + Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` + // Data source for metrics queries. + DataSource FormulaAndFunctionMetricDataSource `json:"data_source"` + // Name of the query for use in formulas. + Name string `json:"name"` + // Metrics query definition. + Query string `json:"query"` + // 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{} +} + +// NewFormulaAndFunctionMetricQueryDefinition instantiates a new FormulaAndFunctionMetricQueryDefinition 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 NewFormulaAndFunctionMetricQueryDefinition(dataSource FormulaAndFunctionMetricDataSource, name string, query string) *FormulaAndFunctionMetricQueryDefinition { + this := FormulaAndFunctionMetricQueryDefinition{} + this.DataSource = dataSource + this.Name = name + this.Query = query + return &this +} + +// NewFormulaAndFunctionMetricQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionMetricQueryDefinition 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 NewFormulaAndFunctionMetricQueryDefinitionWithDefaults() *FormulaAndFunctionMetricQueryDefinition { + this := FormulaAndFunctionMetricQueryDefinition{} + return &this +} + +// GetAggregator returns the Aggregator field value if set, zero value otherwise. +func (o *FormulaAndFunctionMetricQueryDefinition) GetAggregator() FormulaAndFunctionMetricAggregation { + if o == nil || o.Aggregator == nil { + var ret FormulaAndFunctionMetricAggregation + return ret + } + return *o.Aggregator +} + +// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionMetricQueryDefinition) GetAggregatorOk() (*FormulaAndFunctionMetricAggregation, bool) { + if o == nil || o.Aggregator == nil { + return nil, false + } + return o.Aggregator, true +} + +// HasAggregator returns a boolean if a field has been set. +func (o *FormulaAndFunctionMetricQueryDefinition) HasAggregator() bool { + if o != nil && o.Aggregator != nil { + return true + } + + return false +} + +// SetAggregator gets a reference to the given FormulaAndFunctionMetricAggregation and assigns it to the Aggregator field. +func (o *FormulaAndFunctionMetricQueryDefinition) SetAggregator(v FormulaAndFunctionMetricAggregation) { + o.Aggregator = &v +} + +// GetDataSource returns the DataSource field value. +func (o *FormulaAndFunctionMetricQueryDefinition) GetDataSource() FormulaAndFunctionMetricDataSource { + if o == nil { + var ret FormulaAndFunctionMetricDataSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionMetricQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionMetricDataSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *FormulaAndFunctionMetricQueryDefinition) SetDataSource(v FormulaAndFunctionMetricDataSource) { + o.DataSource = v +} + +// GetName returns the Name field value. +func (o *FormulaAndFunctionMetricQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionMetricQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *FormulaAndFunctionMetricQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value. +func (o *FormulaAndFunctionMetricQueryDefinition) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionMetricQueryDefinition) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *FormulaAndFunctionMetricQueryDefinition) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionMetricQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregator != nil { + toSerialize["aggregator"] = o.Aggregator + } + toSerialize["data_source"] = o.DataSource + toSerialize["name"] = o.Name + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DataSource *FormulaAndFunctionMetricDataSource `json:"data_source"` + Name *string `json:"name"` + Query *string `json:"query"` + }{} + all := struct { + Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` + DataSource FormulaAndFunctionMetricDataSource `json:"data_source"` + Name string `json:"name"` + Query string `json:"query"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregator; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregator = all.Aggregator + o.DataSource = all.DataSource + o.Name = all.Name + o.Query = all.Query + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_process_query_data_source.go b/api/v1/datadog/model_formula_and_function_process_query_data_source.go new file mode 100644 index 00000000000..d3302bfd25a --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_process_query_data_source.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionProcessQueryDataSource Data sources that rely on the process backend. +type FormulaAndFunctionProcessQueryDataSource string + +// List of FormulaAndFunctionProcessQueryDataSource. +const ( + FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_PROCESS FormulaAndFunctionProcessQueryDataSource = "process" + FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_CONTAINER FormulaAndFunctionProcessQueryDataSource = "container" +) + +var allowedFormulaAndFunctionProcessQueryDataSourceEnumValues = []FormulaAndFunctionProcessQueryDataSource{ + FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_PROCESS, + FORMULAANDFUNCTIONPROCESSQUERYDATASOURCE_CONTAINER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionProcessQueryDataSource) GetAllowedValues() []FormulaAndFunctionProcessQueryDataSource { + return allowedFormulaAndFunctionProcessQueryDataSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionProcessQueryDataSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionProcessQueryDataSource(value) + return nil +} + +// NewFormulaAndFunctionProcessQueryDataSourceFromValue returns a pointer to a valid FormulaAndFunctionProcessQueryDataSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionProcessQueryDataSourceFromValue(v string) (*FormulaAndFunctionProcessQueryDataSource, error) { + ev := FormulaAndFunctionProcessQueryDataSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionProcessQueryDataSource: valid values are %v", v, allowedFormulaAndFunctionProcessQueryDataSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionProcessQueryDataSource) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionProcessQueryDataSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionProcessQueryDataSource value. +func (v FormulaAndFunctionProcessQueryDataSource) Ptr() *FormulaAndFunctionProcessQueryDataSource { + return &v +} + +// NullableFormulaAndFunctionProcessQueryDataSource handles when a null is used for FormulaAndFunctionProcessQueryDataSource. +type NullableFormulaAndFunctionProcessQueryDataSource struct { + value *FormulaAndFunctionProcessQueryDataSource + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionProcessQueryDataSource) Get() *FormulaAndFunctionProcessQueryDataSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionProcessQueryDataSource) Set(val *FormulaAndFunctionProcessQueryDataSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionProcessQueryDataSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionProcessQueryDataSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionProcessQueryDataSource initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionProcessQueryDataSource(val *FormulaAndFunctionProcessQueryDataSource) *NullableFormulaAndFunctionProcessQueryDataSource { + return &NullableFormulaAndFunctionProcessQueryDataSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionProcessQueryDataSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionProcessQueryDataSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_process_query_definition.go b/api/v1/datadog/model_formula_and_function_process_query_definition.go new file mode 100644 index 00000000000..25f754e45b4 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_process_query_definition.go @@ -0,0 +1,431 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionProcessQueryDefinition Process query using formulas and functions. +type FormulaAndFunctionProcessQueryDefinition struct { + // The aggregation methods available for metrics queries. + Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` + // Data sources that rely on the process backend. + DataSource FormulaAndFunctionProcessQueryDataSource `json:"data_source"` + // Whether to normalize the CPU percentages. + IsNormalizedCpu *bool `json:"is_normalized_cpu,omitempty"` + // Number of hits to return. + Limit *int64 `json:"limit,omitempty"` + // Process metric name. + Metric string `json:"metric"` + // Name of query for use in formulas. + Name string `json:"name"` + // Direction of sort. + Sort *QuerySortOrder `json:"sort,omitempty"` + // An array of tags to filter by. + TagFilters []string `json:"tag_filters,omitempty"` + // Text to use as filter. + TextFilter *string `json:"text_filter,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{} +} + +// NewFormulaAndFunctionProcessQueryDefinition instantiates a new FormulaAndFunctionProcessQueryDefinition 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 NewFormulaAndFunctionProcessQueryDefinition(dataSource FormulaAndFunctionProcessQueryDataSource, metric string, name string) *FormulaAndFunctionProcessQueryDefinition { + this := FormulaAndFunctionProcessQueryDefinition{} + this.DataSource = dataSource + this.Metric = metric + this.Name = name + var sort QuerySortOrder = QUERYSORTORDER_DESC + this.Sort = &sort + return &this +} + +// NewFormulaAndFunctionProcessQueryDefinitionWithDefaults instantiates a new FormulaAndFunctionProcessQueryDefinition 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 NewFormulaAndFunctionProcessQueryDefinitionWithDefaults() *FormulaAndFunctionProcessQueryDefinition { + this := FormulaAndFunctionProcessQueryDefinition{} + var sort QuerySortOrder = QUERYSORTORDER_DESC + this.Sort = &sort + return &this +} + +// GetAggregator returns the Aggregator field value if set, zero value otherwise. +func (o *FormulaAndFunctionProcessQueryDefinition) GetAggregator() FormulaAndFunctionMetricAggregation { + if o == nil || o.Aggregator == nil { + var ret FormulaAndFunctionMetricAggregation + return ret + } + return *o.Aggregator +} + +// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetAggregatorOk() (*FormulaAndFunctionMetricAggregation, bool) { + if o == nil || o.Aggregator == nil { + return nil, false + } + return o.Aggregator, true +} + +// HasAggregator returns a boolean if a field has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) HasAggregator() bool { + if o != nil && o.Aggregator != nil { + return true + } + + return false +} + +// SetAggregator gets a reference to the given FormulaAndFunctionMetricAggregation and assigns it to the Aggregator field. +func (o *FormulaAndFunctionProcessQueryDefinition) SetAggregator(v FormulaAndFunctionMetricAggregation) { + o.Aggregator = &v +} + +// GetDataSource returns the DataSource field value. +func (o *FormulaAndFunctionProcessQueryDefinition) GetDataSource() FormulaAndFunctionProcessQueryDataSource { + if o == nil { + var ret FormulaAndFunctionProcessQueryDataSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionProcessQueryDataSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *FormulaAndFunctionProcessQueryDefinition) SetDataSource(v FormulaAndFunctionProcessQueryDataSource) { + o.DataSource = v +} + +// GetIsNormalizedCpu returns the IsNormalizedCpu field value if set, zero value otherwise. +func (o *FormulaAndFunctionProcessQueryDefinition) GetIsNormalizedCpu() bool { + if o == nil || o.IsNormalizedCpu == nil { + var ret bool + return ret + } + return *o.IsNormalizedCpu +} + +// GetIsNormalizedCpuOk returns a tuple with the IsNormalizedCpu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetIsNormalizedCpuOk() (*bool, bool) { + if o == nil || o.IsNormalizedCpu == nil { + return nil, false + } + return o.IsNormalizedCpu, true +} + +// HasIsNormalizedCpu returns a boolean if a field has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) HasIsNormalizedCpu() bool { + if o != nil && o.IsNormalizedCpu != nil { + return true + } + + return false +} + +// SetIsNormalizedCpu gets a reference to the given bool and assigns it to the IsNormalizedCpu field. +func (o *FormulaAndFunctionProcessQueryDefinition) SetIsNormalizedCpu(v bool) { + o.IsNormalizedCpu = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *FormulaAndFunctionProcessQueryDefinition) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *FormulaAndFunctionProcessQueryDefinition) SetLimit(v int64) { + o.Limit = &v +} + +// GetMetric returns the Metric field value. +func (o *FormulaAndFunctionProcessQueryDefinition) GetMetric() string { + if o == nil { + var ret string + return ret + } + return o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetMetricOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metric, true +} + +// SetMetric sets field value. +func (o *FormulaAndFunctionProcessQueryDefinition) SetMetric(v string) { + o.Metric = v +} + +// GetName returns the Name field value. +func (o *FormulaAndFunctionProcessQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *FormulaAndFunctionProcessQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *FormulaAndFunctionProcessQueryDefinition) GetSort() QuerySortOrder { + if o == nil || o.Sort == nil { + var ret QuerySortOrder + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetSortOk() (*QuerySortOrder, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given QuerySortOrder and assigns it to the Sort field. +func (o *FormulaAndFunctionProcessQueryDefinition) SetSort(v QuerySortOrder) { + o.Sort = &v +} + +// GetTagFilters returns the TagFilters field value if set, zero value otherwise. +func (o *FormulaAndFunctionProcessQueryDefinition) GetTagFilters() []string { + if o == nil || o.TagFilters == nil { + var ret []string + return ret + } + return o.TagFilters +} + +// GetTagFiltersOk returns a tuple with the TagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetTagFiltersOk() (*[]string, bool) { + if o == nil || o.TagFilters == nil { + return nil, false + } + return &o.TagFilters, true +} + +// HasTagFilters returns a boolean if a field has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) HasTagFilters() bool { + if o != nil && o.TagFilters != nil { + return true + } + + return false +} + +// SetTagFilters gets a reference to the given []string and assigns it to the TagFilters field. +func (o *FormulaAndFunctionProcessQueryDefinition) SetTagFilters(v []string) { + o.TagFilters = v +} + +// GetTextFilter returns the TextFilter field value if set, zero value otherwise. +func (o *FormulaAndFunctionProcessQueryDefinition) GetTextFilter() string { + if o == nil || o.TextFilter == nil { + var ret string + return ret + } + return *o.TextFilter +} + +// GetTextFilterOk returns a tuple with the TextFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) GetTextFilterOk() (*string, bool) { + if o == nil || o.TextFilter == nil { + return nil, false + } + return o.TextFilter, true +} + +// HasTextFilter returns a boolean if a field has been set. +func (o *FormulaAndFunctionProcessQueryDefinition) HasTextFilter() bool { + if o != nil && o.TextFilter != nil { + return true + } + + return false +} + +// SetTextFilter gets a reference to the given string and assigns it to the TextFilter field. +func (o *FormulaAndFunctionProcessQueryDefinition) SetTextFilter(v string) { + o.TextFilter = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FormulaAndFunctionProcessQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregator != nil { + toSerialize["aggregator"] = o.Aggregator + } + toSerialize["data_source"] = o.DataSource + if o.IsNormalizedCpu != nil { + toSerialize["is_normalized_cpu"] = o.IsNormalizedCpu + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + toSerialize["metric"] = o.Metric + toSerialize["name"] = o.Name + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.TagFilters != nil { + toSerialize["tag_filters"] = o.TagFilters + } + if o.TextFilter != nil { + toSerialize["text_filter"] = o.TextFilter + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DataSource *FormulaAndFunctionProcessQueryDataSource `json:"data_source"` + Metric *string `json:"metric"` + Name *string `json:"name"` + }{} + all := struct { + Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` + DataSource FormulaAndFunctionProcessQueryDataSource `json:"data_source"` + IsNormalizedCpu *bool `json:"is_normalized_cpu,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Metric string `json:"metric"` + Name string `json:"name"` + Sort *QuerySortOrder `json:"sort,omitempty"` + TagFilters []string `json:"tag_filters,omitempty"` + TextFilter *string `json:"text_filter,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.Metric == nil { + return fmt.Errorf("Required field metric missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregator; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregator = all.Aggregator + o.DataSource = all.DataSource + o.IsNormalizedCpu = all.IsNormalizedCpu + o.Limit = all.Limit + o.Metric = all.Metric + o.Name = all.Name + o.Sort = all.Sort + o.TagFilters = all.TagFilters + o.TextFilter = all.TextFilter + return nil +} diff --git a/api/v1/datadog/model_formula_and_function_query_definition.go b/api/v1/datadog/model_formula_and_function_query_definition.go new file mode 100644 index 00000000000..e7fd79566d8 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_query_definition.go @@ -0,0 +1,251 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// FormulaAndFunctionQueryDefinition - A formula and function query. +type FormulaAndFunctionQueryDefinition struct { + FormulaAndFunctionMetricQueryDefinition *FormulaAndFunctionMetricQueryDefinition + FormulaAndFunctionEventQueryDefinition *FormulaAndFunctionEventQueryDefinition + FormulaAndFunctionProcessQueryDefinition *FormulaAndFunctionProcessQueryDefinition + FormulaAndFunctionApmDependencyStatsQueryDefinition *FormulaAndFunctionApmDependencyStatsQueryDefinition + FormulaAndFunctionApmResourceStatsQueryDefinition *FormulaAndFunctionApmResourceStatsQueryDefinition + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// FormulaAndFunctionMetricQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionMetricQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. +func FormulaAndFunctionMetricQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionMetricQueryDefinition) FormulaAndFunctionQueryDefinition { + return FormulaAndFunctionQueryDefinition{FormulaAndFunctionMetricQueryDefinition: v} +} + +// FormulaAndFunctionEventQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionEventQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. +func FormulaAndFunctionEventQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionEventQueryDefinition) FormulaAndFunctionQueryDefinition { + return FormulaAndFunctionQueryDefinition{FormulaAndFunctionEventQueryDefinition: v} +} + +// FormulaAndFunctionProcessQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionProcessQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. +func FormulaAndFunctionProcessQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionProcessQueryDefinition) FormulaAndFunctionQueryDefinition { + return FormulaAndFunctionQueryDefinition{FormulaAndFunctionProcessQueryDefinition: v} +} + +// FormulaAndFunctionApmDependencyStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionApmDependencyStatsQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. +func FormulaAndFunctionApmDependencyStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionApmDependencyStatsQueryDefinition) FormulaAndFunctionQueryDefinition { + return FormulaAndFunctionQueryDefinition{FormulaAndFunctionApmDependencyStatsQueryDefinition: v} +} + +// FormulaAndFunctionApmResourceStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition is a convenience function that returns FormulaAndFunctionApmResourceStatsQueryDefinition wrapped in FormulaAndFunctionQueryDefinition. +func FormulaAndFunctionApmResourceStatsQueryDefinitionAsFormulaAndFunctionQueryDefinition(v *FormulaAndFunctionApmResourceStatsQueryDefinition) FormulaAndFunctionQueryDefinition { + return FormulaAndFunctionQueryDefinition{FormulaAndFunctionApmResourceStatsQueryDefinition: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *FormulaAndFunctionQueryDefinition) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into FormulaAndFunctionMetricQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionMetricQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionMetricQueryDefinition != nil && obj.FormulaAndFunctionMetricQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionMetricQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionMetricQueryDefinition) + if string(jsonFormulaAndFunctionMetricQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionMetricQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionMetricQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionMetricQueryDefinition = nil + } + + // try to unmarshal data into FormulaAndFunctionEventQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionEventQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionEventQueryDefinition != nil && obj.FormulaAndFunctionEventQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionEventQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionEventQueryDefinition) + if string(jsonFormulaAndFunctionEventQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionEventQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionEventQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionEventQueryDefinition = nil + } + + // try to unmarshal data into FormulaAndFunctionProcessQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionProcessQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionProcessQueryDefinition != nil && obj.FormulaAndFunctionProcessQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionProcessQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionProcessQueryDefinition) + if string(jsonFormulaAndFunctionProcessQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionProcessQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionProcessQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionProcessQueryDefinition = nil + } + + // try to unmarshal data into FormulaAndFunctionApmDependencyStatsQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionApmDependencyStatsQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionApmDependencyStatsQueryDefinition != nil && obj.FormulaAndFunctionApmDependencyStatsQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionApmDependencyStatsQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionApmDependencyStatsQueryDefinition) + if string(jsonFormulaAndFunctionApmDependencyStatsQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil + } + + // try to unmarshal data into FormulaAndFunctionApmResourceStatsQueryDefinition + err = json.Unmarshal(data, &obj.FormulaAndFunctionApmResourceStatsQueryDefinition) + if err == nil { + if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil && obj.FormulaAndFunctionApmResourceStatsQueryDefinition.UnparsedObject == nil { + jsonFormulaAndFunctionApmResourceStatsQueryDefinition, _ := json.Marshal(obj.FormulaAndFunctionApmResourceStatsQueryDefinition) + if string(jsonFormulaAndFunctionApmResourceStatsQueryDefinition) == "{}" { // empty struct + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + } else { + match++ + } + } else { + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + } + } else { + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.FormulaAndFunctionMetricQueryDefinition = nil + obj.FormulaAndFunctionEventQueryDefinition = nil + obj.FormulaAndFunctionProcessQueryDefinition = nil + obj.FormulaAndFunctionApmDependencyStatsQueryDefinition = nil + obj.FormulaAndFunctionApmResourceStatsQueryDefinition = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj FormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { + if obj.FormulaAndFunctionMetricQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionMetricQueryDefinition) + } + + if obj.FormulaAndFunctionEventQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionEventQueryDefinition) + } + + if obj.FormulaAndFunctionProcessQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionProcessQueryDefinition) + } + + if obj.FormulaAndFunctionApmDependencyStatsQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionApmDependencyStatsQueryDefinition) + } + + if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { + return json.Marshal(&obj.FormulaAndFunctionApmResourceStatsQueryDefinition) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *FormulaAndFunctionQueryDefinition) GetActualInstance() interface{} { + if obj.FormulaAndFunctionMetricQueryDefinition != nil { + return obj.FormulaAndFunctionMetricQueryDefinition + } + + if obj.FormulaAndFunctionEventQueryDefinition != nil { + return obj.FormulaAndFunctionEventQueryDefinition + } + + if obj.FormulaAndFunctionProcessQueryDefinition != nil { + return obj.FormulaAndFunctionProcessQueryDefinition + } + + if obj.FormulaAndFunctionApmDependencyStatsQueryDefinition != nil { + return obj.FormulaAndFunctionApmDependencyStatsQueryDefinition + } + + if obj.FormulaAndFunctionApmResourceStatsQueryDefinition != nil { + return obj.FormulaAndFunctionApmResourceStatsQueryDefinition + } + + // all schemas are nil + return nil +} + +// NullableFormulaAndFunctionQueryDefinition handles when a null is used for FormulaAndFunctionQueryDefinition. +type NullableFormulaAndFunctionQueryDefinition struct { + value *FormulaAndFunctionQueryDefinition + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionQueryDefinition) Get() *FormulaAndFunctionQueryDefinition { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionQueryDefinition) Set(val *FormulaAndFunctionQueryDefinition) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionQueryDefinition) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableFormulaAndFunctionQueryDefinition) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionQueryDefinition initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionQueryDefinition(val *FormulaAndFunctionQueryDefinition) *NullableFormulaAndFunctionQueryDefinition { + return &NullableFormulaAndFunctionQueryDefinition{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionQueryDefinition) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_formula_and_function_response_format.go b/api/v1/datadog/model_formula_and_function_response_format.go new file mode 100644 index 00000000000..8b9f85b4980 --- /dev/null +++ b/api/v1/datadog/model_formula_and_function_response_format.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FormulaAndFunctionResponseFormat Timeseries or Scalar response. +type FormulaAndFunctionResponseFormat string + +// List of FormulaAndFunctionResponseFormat. +const ( + FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES FormulaAndFunctionResponseFormat = "timeseries" + FORMULAANDFUNCTIONRESPONSEFORMAT_SCALAR FormulaAndFunctionResponseFormat = "scalar" +) + +var allowedFormulaAndFunctionResponseFormatEnumValues = []FormulaAndFunctionResponseFormat{ + FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES, + FORMULAANDFUNCTIONRESPONSEFORMAT_SCALAR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FormulaAndFunctionResponseFormat) GetAllowedValues() []FormulaAndFunctionResponseFormat { + return allowedFormulaAndFunctionResponseFormatEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FormulaAndFunctionResponseFormat) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FormulaAndFunctionResponseFormat(value) + return nil +} + +// NewFormulaAndFunctionResponseFormatFromValue returns a pointer to a valid FormulaAndFunctionResponseFormat +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFormulaAndFunctionResponseFormatFromValue(v string) (*FormulaAndFunctionResponseFormat, error) { + ev := FormulaAndFunctionResponseFormat(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FormulaAndFunctionResponseFormat: valid values are %v", v, allowedFormulaAndFunctionResponseFormatEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FormulaAndFunctionResponseFormat) IsValid() bool { + for _, existing := range allowedFormulaAndFunctionResponseFormatEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormulaAndFunctionResponseFormat value. +func (v FormulaAndFunctionResponseFormat) Ptr() *FormulaAndFunctionResponseFormat { + return &v +} + +// NullableFormulaAndFunctionResponseFormat handles when a null is used for FormulaAndFunctionResponseFormat. +type NullableFormulaAndFunctionResponseFormat struct { + value *FormulaAndFunctionResponseFormat + isSet bool +} + +// Get returns the associated value. +func (v NullableFormulaAndFunctionResponseFormat) Get() *FormulaAndFunctionResponseFormat { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFormulaAndFunctionResponseFormat) Set(val *FormulaAndFunctionResponseFormat) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFormulaAndFunctionResponseFormat) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFormulaAndFunctionResponseFormat) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFormulaAndFunctionResponseFormat initializes the struct as if Set has been called. +func NewNullableFormulaAndFunctionResponseFormat(val *FormulaAndFunctionResponseFormat) *NullableFormulaAndFunctionResponseFormat { + return &NullableFormulaAndFunctionResponseFormat{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFormulaAndFunctionResponseFormat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFormulaAndFunctionResponseFormat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_free_text_widget_definition.go b/api/v1/datadog/model_free_text_widget_definition.go new file mode 100644 index 00000000000..d5e313285bf --- /dev/null +++ b/api/v1/datadog/model_free_text_widget_definition.go @@ -0,0 +1,271 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FreeTextWidgetDefinition Free text is a widget that allows you to add headings to your screenboard. Commonly used to state the overall purpose of the dashboard. Only available on FREE layout dashboards. +type FreeTextWidgetDefinition struct { + // Color of the text. + Color *string `json:"color,omitempty"` + // Size of the text. + FontSize *string `json:"font_size,omitempty"` + // Text to display. + Text string `json:"text"` + // How to align the text on the widget. + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + // Type of the free text widget. + Type FreeTextWidgetDefinitionType `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{} +} + +// NewFreeTextWidgetDefinition instantiates a new FreeTextWidgetDefinition 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 NewFreeTextWidgetDefinition(text string, typeVar FreeTextWidgetDefinitionType) *FreeTextWidgetDefinition { + this := FreeTextWidgetDefinition{} + this.Text = text + this.Type = typeVar + return &this +} + +// NewFreeTextWidgetDefinitionWithDefaults instantiates a new FreeTextWidgetDefinition 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 NewFreeTextWidgetDefinitionWithDefaults() *FreeTextWidgetDefinition { + this := FreeTextWidgetDefinition{} + var typeVar FreeTextWidgetDefinitionType = FREETEXTWIDGETDEFINITIONTYPE_FREE_TEXT + this.Type = typeVar + return &this +} + +// GetColor returns the Color field value if set, zero value otherwise. +func (o *FreeTextWidgetDefinition) GetColor() string { + if o == nil || o.Color == nil { + var ret string + return ret + } + return *o.Color +} + +// GetColorOk returns a tuple with the Color field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FreeTextWidgetDefinition) GetColorOk() (*string, bool) { + if o == nil || o.Color == nil { + return nil, false + } + return o.Color, true +} + +// HasColor returns a boolean if a field has been set. +func (o *FreeTextWidgetDefinition) HasColor() bool { + if o != nil && o.Color != nil { + return true + } + + return false +} + +// SetColor gets a reference to the given string and assigns it to the Color field. +func (o *FreeTextWidgetDefinition) SetColor(v string) { + o.Color = &v +} + +// GetFontSize returns the FontSize field value if set, zero value otherwise. +func (o *FreeTextWidgetDefinition) GetFontSize() string { + if o == nil || o.FontSize == nil { + var ret string + return ret + } + return *o.FontSize +} + +// GetFontSizeOk returns a tuple with the FontSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FreeTextWidgetDefinition) GetFontSizeOk() (*string, bool) { + if o == nil || o.FontSize == nil { + return nil, false + } + return o.FontSize, true +} + +// HasFontSize returns a boolean if a field has been set. +func (o *FreeTextWidgetDefinition) HasFontSize() bool { + if o != nil && o.FontSize != nil { + return true + } + + return false +} + +// SetFontSize gets a reference to the given string and assigns it to the FontSize field. +func (o *FreeTextWidgetDefinition) SetFontSize(v string) { + o.FontSize = &v +} + +// GetText returns the Text field value. +func (o *FreeTextWidgetDefinition) GetText() string { + if o == nil { + var ret string + return ret + } + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *FreeTextWidgetDefinition) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value. +func (o *FreeTextWidgetDefinition) SetText(v string) { + o.Text = v +} + +// GetTextAlign returns the TextAlign field value if set, zero value otherwise. +func (o *FreeTextWidgetDefinition) GetTextAlign() WidgetTextAlign { + if o == nil || o.TextAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TextAlign +} + +// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FreeTextWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TextAlign == nil { + return nil, false + } + return o.TextAlign, true +} + +// HasTextAlign returns a boolean if a field has been set. +func (o *FreeTextWidgetDefinition) HasTextAlign() bool { + if o != nil && o.TextAlign != nil { + return true + } + + return false +} + +// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. +func (o *FreeTextWidgetDefinition) SetTextAlign(v WidgetTextAlign) { + o.TextAlign = &v +} + +// GetType returns the Type field value. +func (o *FreeTextWidgetDefinition) GetType() FreeTextWidgetDefinitionType { + if o == nil { + var ret FreeTextWidgetDefinitionType + 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 *FreeTextWidgetDefinition) GetTypeOk() (*FreeTextWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FreeTextWidgetDefinition) SetType(v FreeTextWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FreeTextWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Color != nil { + toSerialize["color"] = o.Color + } + if o.FontSize != nil { + toSerialize["font_size"] = o.FontSize + } + toSerialize["text"] = o.Text + if o.TextAlign != nil { + toSerialize["text_align"] = o.TextAlign + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Text *string `json:"text"` + Type *FreeTextWidgetDefinitionType `json:"type"` + }{} + all := struct { + Color *string `json:"color,omitempty"` + FontSize *string `json:"font_size,omitempty"` + Text string `json:"text"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + Type FreeTextWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Text == nil { + return fmt.Errorf("Required field text missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TextAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Color = all.Color + o.FontSize = all.FontSize + o.Text = all.Text + o.TextAlign = all.TextAlign + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_free_text_widget_definition_type.go b/api/v1/datadog/model_free_text_widget_definition_type.go new file mode 100644 index 00000000000..a7b6ad0a94f --- /dev/null +++ b/api/v1/datadog/model_free_text_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FreeTextWidgetDefinitionType Type of the free text widget. +type FreeTextWidgetDefinitionType string + +// List of FreeTextWidgetDefinitionType. +const ( + FREETEXTWIDGETDEFINITIONTYPE_FREE_TEXT FreeTextWidgetDefinitionType = "free_text" +) + +var allowedFreeTextWidgetDefinitionTypeEnumValues = []FreeTextWidgetDefinitionType{ + FREETEXTWIDGETDEFINITIONTYPE_FREE_TEXT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FreeTextWidgetDefinitionType) GetAllowedValues() []FreeTextWidgetDefinitionType { + return allowedFreeTextWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FreeTextWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FreeTextWidgetDefinitionType(value) + return nil +} + +// NewFreeTextWidgetDefinitionTypeFromValue returns a pointer to a valid FreeTextWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFreeTextWidgetDefinitionTypeFromValue(v string) (*FreeTextWidgetDefinitionType, error) { + ev := FreeTextWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FreeTextWidgetDefinitionType: valid values are %v", v, allowedFreeTextWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FreeTextWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedFreeTextWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FreeTextWidgetDefinitionType value. +func (v FreeTextWidgetDefinitionType) Ptr() *FreeTextWidgetDefinitionType { + return &v +} + +// NullableFreeTextWidgetDefinitionType handles when a null is used for FreeTextWidgetDefinitionType. +type NullableFreeTextWidgetDefinitionType struct { + value *FreeTextWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableFreeTextWidgetDefinitionType) Get() *FreeTextWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFreeTextWidgetDefinitionType) Set(val *FreeTextWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFreeTextWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFreeTextWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFreeTextWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableFreeTextWidgetDefinitionType(val *FreeTextWidgetDefinitionType) *NullableFreeTextWidgetDefinitionType { + return &NullableFreeTextWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFreeTextWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFreeTextWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_funnel_query.go b/api/v1/datadog/model_funnel_query.go new file mode 100644 index 00000000000..8eb45eac3b2 --- /dev/null +++ b/api/v1/datadog/model_funnel_query.go @@ -0,0 +1,179 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FunnelQuery Updated funnel widget. +type FunnelQuery struct { + // Source from which to query items to display in the funnel. + DataSource FunnelSource `json:"data_source"` + // The widget query. + QueryString string `json:"query_string"` + // List of funnel steps. + Steps []FunnelStep `json:"steps"` + // 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{} +} + +// NewFunnelQuery instantiates a new FunnelQuery 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 NewFunnelQuery(dataSource FunnelSource, queryString string, steps []FunnelStep) *FunnelQuery { + this := FunnelQuery{} + this.DataSource = dataSource + this.QueryString = queryString + this.Steps = steps + return &this +} + +// NewFunnelQueryWithDefaults instantiates a new FunnelQuery 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 NewFunnelQueryWithDefaults() *FunnelQuery { + this := FunnelQuery{} + var dataSource FunnelSource = FUNNELSOURCE_RUM + this.DataSource = dataSource + return &this +} + +// GetDataSource returns the DataSource field value. +func (o *FunnelQuery) GetDataSource() FunnelSource { + if o == nil { + var ret FunnelSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *FunnelQuery) GetDataSourceOk() (*FunnelSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *FunnelQuery) SetDataSource(v FunnelSource) { + o.DataSource = v +} + +// GetQueryString returns the QueryString field value. +func (o *FunnelQuery) GetQueryString() string { + if o == nil { + var ret string + return ret + } + return o.QueryString +} + +// GetQueryStringOk returns a tuple with the QueryString field value +// and a boolean to check if the value has been set. +func (o *FunnelQuery) GetQueryStringOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.QueryString, true +} + +// SetQueryString sets field value. +func (o *FunnelQuery) SetQueryString(v string) { + o.QueryString = v +} + +// GetSteps returns the Steps field value. +func (o *FunnelQuery) GetSteps() []FunnelStep { + if o == nil { + var ret []FunnelStep + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value +// and a boolean to check if the value has been set. +func (o *FunnelQuery) GetStepsOk() (*[]FunnelStep, bool) { + if o == nil { + return nil, false + } + return &o.Steps, true +} + +// SetSteps sets field value. +func (o *FunnelQuery) SetSteps(v []FunnelStep) { + o.Steps = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelQuery) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data_source"] = o.DataSource + toSerialize["query_string"] = o.QueryString + toSerialize["steps"] = o.Steps + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelQuery) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DataSource *FunnelSource `json:"data_source"` + QueryString *string `json:"query_string"` + Steps *[]FunnelStep `json:"steps"` + }{} + all := struct { + DataSource FunnelSource `json:"data_source"` + QueryString string `json:"query_string"` + Steps []FunnelStep `json:"steps"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.QueryString == nil { + return fmt.Errorf("Required field query_string missing") + } + if required.Steps == nil { + return fmt.Errorf("Required field steps missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DataSource = all.DataSource + o.QueryString = all.QueryString + o.Steps = all.Steps + return nil +} diff --git a/api/v1/datadog/model_funnel_request_type.go b/api/v1/datadog/model_funnel_request_type.go new file mode 100644 index 00000000000..e967d3b6f42 --- /dev/null +++ b/api/v1/datadog/model_funnel_request_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FunnelRequestType Widget request type. +type FunnelRequestType string + +// List of FunnelRequestType. +const ( + FUNNELREQUESTTYPE_FUNNEL FunnelRequestType = "funnel" +) + +var allowedFunnelRequestTypeEnumValues = []FunnelRequestType{ + FUNNELREQUESTTYPE_FUNNEL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FunnelRequestType) GetAllowedValues() []FunnelRequestType { + return allowedFunnelRequestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FunnelRequestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FunnelRequestType(value) + return nil +} + +// NewFunnelRequestTypeFromValue returns a pointer to a valid FunnelRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFunnelRequestTypeFromValue(v string) (*FunnelRequestType, error) { + ev := FunnelRequestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FunnelRequestType: valid values are %v", v, allowedFunnelRequestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FunnelRequestType) IsValid() bool { + for _, existing := range allowedFunnelRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FunnelRequestType value. +func (v FunnelRequestType) Ptr() *FunnelRequestType { + return &v +} + +// NullableFunnelRequestType handles when a null is used for FunnelRequestType. +type NullableFunnelRequestType struct { + value *FunnelRequestType + isSet bool +} + +// Get returns the associated value. +func (v NullableFunnelRequestType) Get() *FunnelRequestType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFunnelRequestType) Set(val *FunnelRequestType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFunnelRequestType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFunnelRequestType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFunnelRequestType initializes the struct as if Set has been called. +func NewNullableFunnelRequestType(val *FunnelRequestType) *NullableFunnelRequestType { + return &NullableFunnelRequestType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFunnelRequestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFunnelRequestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_funnel_source.go b/api/v1/datadog/model_funnel_source.go new file mode 100644 index 00000000000..42f6c5be771 --- /dev/null +++ b/api/v1/datadog/model_funnel_source.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FunnelSource Source from which to query items to display in the funnel. +type FunnelSource string + +// List of FunnelSource. +const ( + FUNNELSOURCE_RUM FunnelSource = "rum" +) + +var allowedFunnelSourceEnumValues = []FunnelSource{ + FUNNELSOURCE_RUM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FunnelSource) GetAllowedValues() []FunnelSource { + return allowedFunnelSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FunnelSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FunnelSource(value) + return nil +} + +// NewFunnelSourceFromValue returns a pointer to a valid FunnelSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFunnelSourceFromValue(v string) (*FunnelSource, error) { + ev := FunnelSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FunnelSource: valid values are %v", v, allowedFunnelSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FunnelSource) IsValid() bool { + for _, existing := range allowedFunnelSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FunnelSource value. +func (v FunnelSource) Ptr() *FunnelSource { + return &v +} + +// NullableFunnelSource handles when a null is used for FunnelSource. +type NullableFunnelSource struct { + value *FunnelSource + isSet bool +} + +// Get returns the associated value. +func (v NullableFunnelSource) Get() *FunnelSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFunnelSource) Set(val *FunnelSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFunnelSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFunnelSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFunnelSource initializes the struct as if Set has been called. +func NewNullableFunnelSource(val *FunnelSource) *NullableFunnelSource { + return &NullableFunnelSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFunnelSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFunnelSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_funnel_step.go b/api/v1/datadog/model_funnel_step.go new file mode 100644 index 00000000000..4c11c0c1c73 --- /dev/null +++ b/api/v1/datadog/model_funnel_step.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FunnelStep The funnel step. +type FunnelStep struct { + // The facet of the step. + Facet string `json:"facet"` + // The value of the step. + Value string `json:"value"` + // 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{} +} + +// NewFunnelStep instantiates a new FunnelStep 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 NewFunnelStep(facet string, value string) *FunnelStep { + this := FunnelStep{} + this.Facet = facet + this.Value = value + return &this +} + +// NewFunnelStepWithDefaults instantiates a new FunnelStep 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 NewFunnelStepWithDefaults() *FunnelStep { + this := FunnelStep{} + return &this +} + +// GetFacet returns the Facet field value. +func (o *FunnelStep) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *FunnelStep) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *FunnelStep) SetFacet(v string) { + o.Facet = v +} + +// GetValue returns the Value field value. +func (o *FunnelStep) GetValue() string { + if o == nil { + var ret string + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *FunnelStep) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *FunnelStep) SetValue(v string) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelStep) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelStep) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Facet *string `json:"facet"` + Value *string `json:"value"` + }{} + all := struct { + Facet string `json:"facet"` + Value string `json:"value"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Facet == nil { + return fmt.Errorf("Required field facet missing") + } + if required.Value == nil { + return fmt.Errorf("Required field value missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Facet = all.Facet + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_funnel_widget_definition.go b/api/v1/datadog/model_funnel_widget_definition.go new file mode 100644 index 00000000000..d1225dd856f --- /dev/null +++ b/api/v1/datadog/model_funnel_widget_definition.go @@ -0,0 +1,318 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FunnelWidgetDefinition The funnel visualization displays a funnel of user sessions that maps a sequence of view navigation and user interaction in your application. +// +type FunnelWidgetDefinition struct { + // Request payload used to query items. + Requests []FunnelWidgetRequest `json:"requests"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // The title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // The size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of funnel widget. + Type FunnelWidgetDefinitionType `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{} +} + +// NewFunnelWidgetDefinition instantiates a new FunnelWidgetDefinition 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 NewFunnelWidgetDefinition(requests []FunnelWidgetRequest, typeVar FunnelWidgetDefinitionType) *FunnelWidgetDefinition { + this := FunnelWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewFunnelWidgetDefinitionWithDefaults instantiates a new FunnelWidgetDefinition 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 NewFunnelWidgetDefinitionWithDefaults() *FunnelWidgetDefinition { + this := FunnelWidgetDefinition{} + var typeVar FunnelWidgetDefinitionType = FUNNELWIDGETDEFINITIONTYPE_FUNNEL + this.Type = typeVar + return &this +} + +// GetRequests returns the Requests field value. +func (o *FunnelWidgetDefinition) GetRequests() []FunnelWidgetRequest { + if o == nil { + var ret []FunnelWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *FunnelWidgetDefinition) GetRequestsOk() (*[]FunnelWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *FunnelWidgetDefinition) SetRequests(v []FunnelWidgetRequest) { + o.Requests = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *FunnelWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *FunnelWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *FunnelWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *FunnelWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *FunnelWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *FunnelWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *FunnelWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *FunnelWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *FunnelWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *FunnelWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunnelWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *FunnelWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *FunnelWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *FunnelWidgetDefinition) GetType() FunnelWidgetDefinitionType { + if o == nil { + var ret FunnelWidgetDefinitionType + 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 *FunnelWidgetDefinition) GetTypeOk() (*FunnelWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FunnelWidgetDefinition) SetType(v FunnelWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["requests"] = o.Requests + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]FunnelWidgetRequest `json:"requests"` + Type *FunnelWidgetDefinitionType `json:"type"` + }{} + all := struct { + Requests []FunnelWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type FunnelWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Requests = all.Requests + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_funnel_widget_definition_type.go b/api/v1/datadog/model_funnel_widget_definition_type.go new file mode 100644 index 00000000000..c722413a155 --- /dev/null +++ b/api/v1/datadog/model_funnel_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FunnelWidgetDefinitionType Type of funnel widget. +type FunnelWidgetDefinitionType string + +// List of FunnelWidgetDefinitionType. +const ( + FUNNELWIDGETDEFINITIONTYPE_FUNNEL FunnelWidgetDefinitionType = "funnel" +) + +var allowedFunnelWidgetDefinitionTypeEnumValues = []FunnelWidgetDefinitionType{ + FUNNELWIDGETDEFINITIONTYPE_FUNNEL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FunnelWidgetDefinitionType) GetAllowedValues() []FunnelWidgetDefinitionType { + return allowedFunnelWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FunnelWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FunnelWidgetDefinitionType(value) + return nil +} + +// NewFunnelWidgetDefinitionTypeFromValue returns a pointer to a valid FunnelWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFunnelWidgetDefinitionTypeFromValue(v string) (*FunnelWidgetDefinitionType, error) { + ev := FunnelWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FunnelWidgetDefinitionType: valid values are %v", v, allowedFunnelWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FunnelWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedFunnelWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FunnelWidgetDefinitionType value. +func (v FunnelWidgetDefinitionType) Ptr() *FunnelWidgetDefinitionType { + return &v +} + +// NullableFunnelWidgetDefinitionType handles when a null is used for FunnelWidgetDefinitionType. +type NullableFunnelWidgetDefinitionType struct { + value *FunnelWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableFunnelWidgetDefinitionType) Get() *FunnelWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableFunnelWidgetDefinitionType) Set(val *FunnelWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableFunnelWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableFunnelWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableFunnelWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableFunnelWidgetDefinitionType(val *FunnelWidgetDefinitionType) *NullableFunnelWidgetDefinitionType { + return &NullableFunnelWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableFunnelWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableFunnelWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_funnel_widget_request.go b/api/v1/datadog/model_funnel_widget_request.go new file mode 100644 index 00000000000..ca14ea7c85e --- /dev/null +++ b/api/v1/datadog/model_funnel_widget_request.go @@ -0,0 +1,151 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// FunnelWidgetRequest Updated funnel widget. +type FunnelWidgetRequest struct { + // Updated funnel widget. + Query FunnelQuery `json:"query"` + // Widget request type. + RequestType FunnelRequestType `json:"request_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{} +} + +// NewFunnelWidgetRequest instantiates a new FunnelWidgetRequest 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 NewFunnelWidgetRequest(query FunnelQuery, requestType FunnelRequestType) *FunnelWidgetRequest { + this := FunnelWidgetRequest{} + this.Query = query + this.RequestType = requestType + return &this +} + +// NewFunnelWidgetRequestWithDefaults instantiates a new FunnelWidgetRequest 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 NewFunnelWidgetRequestWithDefaults() *FunnelWidgetRequest { + this := FunnelWidgetRequest{} + return &this +} + +// GetQuery returns the Query field value. +func (o *FunnelWidgetRequest) GetQuery() FunnelQuery { + if o == nil { + var ret FunnelQuery + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *FunnelWidgetRequest) GetQueryOk() (*FunnelQuery, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *FunnelWidgetRequest) SetQuery(v FunnelQuery) { + o.Query = v +} + +// GetRequestType returns the RequestType field value. +func (o *FunnelWidgetRequest) GetRequestType() FunnelRequestType { + if o == nil { + var ret FunnelRequestType + return ret + } + return o.RequestType +} + +// GetRequestTypeOk returns a tuple with the RequestType field value +// and a boolean to check if the value has been set. +func (o *FunnelWidgetRequest) GetRequestTypeOk() (*FunnelRequestType, bool) { + if o == nil { + return nil, false + } + return &o.RequestType, true +} + +// SetRequestType sets field value. +func (o *FunnelWidgetRequest) SetRequestType(v FunnelRequestType) { + o.RequestType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FunnelWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["query"] = o.Query + toSerialize["request_type"] = o.RequestType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FunnelWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *FunnelQuery `json:"query"` + RequestType *FunnelRequestType `json:"request_type"` + }{} + all := struct { + Query FunnelQuery `json:"query"` + RequestType FunnelRequestType `json:"request_type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + if required.RequestType == nil { + return fmt.Errorf("Required field request_type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.RequestType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Query = all.Query + o.RequestType = all.RequestType + return nil +} diff --git a/api/v1/datadog/model_gcp_account.go b/api/v1/datadog/model_gcp_account.go new file mode 100644 index 00000000000..6d5cf73cd98 --- /dev/null +++ b/api/v1/datadog/model_gcp_account.go @@ -0,0 +1,572 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// GCPAccount Your Google Cloud Platform Account. +type GCPAccount struct { + // Should be `https://www.googleapis.com/oauth2/v1/certs`. + AuthProviderX509CertUrl *string `json:"auth_provider_x509_cert_url,omitempty"` + // Should be `https://accounts.google.com/o/oauth2/auth`. + AuthUri *string `json:"auth_uri,omitempty"` + // Silence monitors for expected GCE instance shutdowns. + Automute *bool `json:"automute,omitempty"` + // Your email found in your JSON service account key. + ClientEmail *string `json:"client_email,omitempty"` + // Your ID found in your JSON service account key. + ClientId *string `json:"client_id,omitempty"` + // Should be `https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL` + // where `$CLIENT_EMAIL` is the email found in your JSON service account key. + ClientX509CertUrl *string `json:"client_x509_cert_url,omitempty"` + // An array of errors. + Errors []string `json:"errors,omitempty"` + // Limit the GCE instances that are pulled into Datadog by using tags. + // Only hosts that match one of the defined tags are imported into Datadog. + HostFilters *string `json:"host_filters,omitempty"` + // Your private key name found in your JSON service account key. + PrivateKey *string `json:"private_key,omitempty"` + // Your private key ID found in your JSON service account key. + PrivateKeyId *string `json:"private_key_id,omitempty"` + // Your Google Cloud project ID found in your JSON service account key. + ProjectId *string `json:"project_id,omitempty"` + // Should be `https://accounts.google.com/o/oauth2/token`. + TokenUri *string `json:"token_uri,omitempty"` + // The value for service_account found in your JSON service account key. + Type *string `json:"type,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{} +} + +// NewGCPAccount instantiates a new GCPAccount 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 NewGCPAccount() *GCPAccount { + this := GCPAccount{} + return &this +} + +// NewGCPAccountWithDefaults instantiates a new GCPAccount 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 NewGCPAccountWithDefaults() *GCPAccount { + this := GCPAccount{} + return &this +} + +// GetAuthProviderX509CertUrl returns the AuthProviderX509CertUrl field value if set, zero value otherwise. +func (o *GCPAccount) GetAuthProviderX509CertUrl() string { + if o == nil || o.AuthProviderX509CertUrl == nil { + var ret string + return ret + } + return *o.AuthProviderX509CertUrl +} + +// GetAuthProviderX509CertUrlOk returns a tuple with the AuthProviderX509CertUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetAuthProviderX509CertUrlOk() (*string, bool) { + if o == nil || o.AuthProviderX509CertUrl == nil { + return nil, false + } + return o.AuthProviderX509CertUrl, true +} + +// HasAuthProviderX509CertUrl returns a boolean if a field has been set. +func (o *GCPAccount) HasAuthProviderX509CertUrl() bool { + if o != nil && o.AuthProviderX509CertUrl != nil { + return true + } + + return false +} + +// SetAuthProviderX509CertUrl gets a reference to the given string and assigns it to the AuthProviderX509CertUrl field. +func (o *GCPAccount) SetAuthProviderX509CertUrl(v string) { + o.AuthProviderX509CertUrl = &v +} + +// GetAuthUri returns the AuthUri field value if set, zero value otherwise. +func (o *GCPAccount) GetAuthUri() string { + if o == nil || o.AuthUri == nil { + var ret string + return ret + } + return *o.AuthUri +} + +// GetAuthUriOk returns a tuple with the AuthUri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetAuthUriOk() (*string, bool) { + if o == nil || o.AuthUri == nil { + return nil, false + } + return o.AuthUri, true +} + +// HasAuthUri returns a boolean if a field has been set. +func (o *GCPAccount) HasAuthUri() bool { + if o != nil && o.AuthUri != nil { + return true + } + + return false +} + +// SetAuthUri gets a reference to the given string and assigns it to the AuthUri field. +func (o *GCPAccount) SetAuthUri(v string) { + o.AuthUri = &v +} + +// GetAutomute returns the Automute field value if set, zero value otherwise. +func (o *GCPAccount) GetAutomute() bool { + if o == nil || o.Automute == nil { + var ret bool + return ret + } + return *o.Automute +} + +// GetAutomuteOk returns a tuple with the Automute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetAutomuteOk() (*bool, bool) { + if o == nil || o.Automute == nil { + return nil, false + } + return o.Automute, true +} + +// HasAutomute returns a boolean if a field has been set. +func (o *GCPAccount) HasAutomute() bool { + if o != nil && o.Automute != nil { + return true + } + + return false +} + +// SetAutomute gets a reference to the given bool and assigns it to the Automute field. +func (o *GCPAccount) SetAutomute(v bool) { + o.Automute = &v +} + +// GetClientEmail returns the ClientEmail field value if set, zero value otherwise. +func (o *GCPAccount) GetClientEmail() string { + if o == nil || o.ClientEmail == nil { + var ret string + return ret + } + return *o.ClientEmail +} + +// GetClientEmailOk returns a tuple with the ClientEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetClientEmailOk() (*string, bool) { + if o == nil || o.ClientEmail == nil { + return nil, false + } + return o.ClientEmail, true +} + +// HasClientEmail returns a boolean if a field has been set. +func (o *GCPAccount) HasClientEmail() bool { + if o != nil && o.ClientEmail != nil { + return true + } + + return false +} + +// SetClientEmail gets a reference to the given string and assigns it to the ClientEmail field. +func (o *GCPAccount) SetClientEmail(v string) { + o.ClientEmail = &v +} + +// GetClientId returns the ClientId field value if set, zero value otherwise. +func (o *GCPAccount) GetClientId() string { + if o == nil || o.ClientId == nil { + var ret string + return ret + } + return *o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetClientIdOk() (*string, bool) { + if o == nil || o.ClientId == nil { + return nil, false + } + return o.ClientId, true +} + +// HasClientId returns a boolean if a field has been set. +func (o *GCPAccount) HasClientId() bool { + if o != nil && o.ClientId != nil { + return true + } + + return false +} + +// SetClientId gets a reference to the given string and assigns it to the ClientId field. +func (o *GCPAccount) SetClientId(v string) { + o.ClientId = &v +} + +// GetClientX509CertUrl returns the ClientX509CertUrl field value if set, zero value otherwise. +func (o *GCPAccount) GetClientX509CertUrl() string { + if o == nil || o.ClientX509CertUrl == nil { + var ret string + return ret + } + return *o.ClientX509CertUrl +} + +// GetClientX509CertUrlOk returns a tuple with the ClientX509CertUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetClientX509CertUrlOk() (*string, bool) { + if o == nil || o.ClientX509CertUrl == nil { + return nil, false + } + return o.ClientX509CertUrl, true +} + +// HasClientX509CertUrl returns a boolean if a field has been set. +func (o *GCPAccount) HasClientX509CertUrl() bool { + if o != nil && o.ClientX509CertUrl != nil { + return true + } + + return false +} + +// SetClientX509CertUrl gets a reference to the given string and assigns it to the ClientX509CertUrl field. +func (o *GCPAccount) SetClientX509CertUrl(v string) { + o.ClientX509CertUrl = &v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *GCPAccount) GetErrors() []string { + if o == nil || o.Errors == nil { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetErrorsOk() (*[]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *GCPAccount) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []string and assigns it to the Errors field. +func (o *GCPAccount) SetErrors(v []string) { + o.Errors = v +} + +// GetHostFilters returns the HostFilters field value if set, zero value otherwise. +func (o *GCPAccount) GetHostFilters() string { + if o == nil || o.HostFilters == nil { + var ret string + return ret + } + return *o.HostFilters +} + +// GetHostFiltersOk returns a tuple with the HostFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetHostFiltersOk() (*string, bool) { + if o == nil || o.HostFilters == nil { + return nil, false + } + return o.HostFilters, true +} + +// HasHostFilters returns a boolean if a field has been set. +func (o *GCPAccount) HasHostFilters() bool { + if o != nil && o.HostFilters != nil { + return true + } + + return false +} + +// SetHostFilters gets a reference to the given string and assigns it to the HostFilters field. +func (o *GCPAccount) SetHostFilters(v string) { + o.HostFilters = &v +} + +// GetPrivateKey returns the PrivateKey field value if set, zero value otherwise. +func (o *GCPAccount) GetPrivateKey() string { + if o == nil || o.PrivateKey == nil { + var ret string + return ret + } + return *o.PrivateKey +} + +// GetPrivateKeyOk returns a tuple with the PrivateKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetPrivateKeyOk() (*string, bool) { + if o == nil || o.PrivateKey == nil { + return nil, false + } + return o.PrivateKey, true +} + +// HasPrivateKey returns a boolean if a field has been set. +func (o *GCPAccount) HasPrivateKey() bool { + if o != nil && o.PrivateKey != nil { + return true + } + + return false +} + +// SetPrivateKey gets a reference to the given string and assigns it to the PrivateKey field. +func (o *GCPAccount) SetPrivateKey(v string) { + o.PrivateKey = &v +} + +// GetPrivateKeyId returns the PrivateKeyId field value if set, zero value otherwise. +func (o *GCPAccount) GetPrivateKeyId() string { + if o == nil || o.PrivateKeyId == nil { + var ret string + return ret + } + return *o.PrivateKeyId +} + +// GetPrivateKeyIdOk returns a tuple with the PrivateKeyId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetPrivateKeyIdOk() (*string, bool) { + if o == nil || o.PrivateKeyId == nil { + return nil, false + } + return o.PrivateKeyId, true +} + +// HasPrivateKeyId returns a boolean if a field has been set. +func (o *GCPAccount) HasPrivateKeyId() bool { + if o != nil && o.PrivateKeyId != nil { + return true + } + + return false +} + +// SetPrivateKeyId gets a reference to the given string and assigns it to the PrivateKeyId field. +func (o *GCPAccount) SetPrivateKeyId(v string) { + o.PrivateKeyId = &v +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *GCPAccount) GetProjectId() string { + if o == nil || o.ProjectId == nil { + var ret string + return ret + } + return *o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetProjectIdOk() (*string, bool) { + if o == nil || o.ProjectId == nil { + return nil, false + } + return o.ProjectId, true +} + +// HasProjectId returns a boolean if a field has been set. +func (o *GCPAccount) HasProjectId() bool { + if o != nil && o.ProjectId != nil { + return true + } + + return false +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *GCPAccount) SetProjectId(v string) { + o.ProjectId = &v +} + +// GetTokenUri returns the TokenUri field value if set, zero value otherwise. +func (o *GCPAccount) GetTokenUri() string { + if o == nil || o.TokenUri == nil { + var ret string + return ret + } + return *o.TokenUri +} + +// GetTokenUriOk returns a tuple with the TokenUri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetTokenUriOk() (*string, bool) { + if o == nil || o.TokenUri == nil { + return nil, false + } + return o.TokenUri, true +} + +// HasTokenUri returns a boolean if a field has been set. +func (o *GCPAccount) HasTokenUri() bool { + if o != nil && o.TokenUri != nil { + return true + } + + return false +} + +// SetTokenUri gets a reference to the given string and assigns it to the TokenUri field. +func (o *GCPAccount) SetTokenUri(v string) { + o.TokenUri = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *GCPAccount) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GCPAccount) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *GCPAccount) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *GCPAccount) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GCPAccount) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AuthProviderX509CertUrl != nil { + toSerialize["auth_provider_x509_cert_url"] = o.AuthProviderX509CertUrl + } + if o.AuthUri != nil { + toSerialize["auth_uri"] = o.AuthUri + } + if o.Automute != nil { + toSerialize["automute"] = o.Automute + } + if o.ClientEmail != nil { + toSerialize["client_email"] = o.ClientEmail + } + if o.ClientId != nil { + toSerialize["client_id"] = o.ClientId + } + if o.ClientX509CertUrl != nil { + toSerialize["client_x509_cert_url"] = o.ClientX509CertUrl + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + if o.HostFilters != nil { + toSerialize["host_filters"] = o.HostFilters + } + if o.PrivateKey != nil { + toSerialize["private_key"] = o.PrivateKey + } + if o.PrivateKeyId != nil { + toSerialize["private_key_id"] = o.PrivateKeyId + } + if o.ProjectId != nil { + toSerialize["project_id"] = o.ProjectId + } + if o.TokenUri != nil { + toSerialize["token_uri"] = o.TokenUri + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GCPAccount) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AuthProviderX509CertUrl *string `json:"auth_provider_x509_cert_url,omitempty"` + AuthUri *string `json:"auth_uri,omitempty"` + Automute *bool `json:"automute,omitempty"` + ClientEmail *string `json:"client_email,omitempty"` + ClientId *string `json:"client_id,omitempty"` + ClientX509CertUrl *string `json:"client_x509_cert_url,omitempty"` + Errors []string `json:"errors,omitempty"` + HostFilters *string `json:"host_filters,omitempty"` + PrivateKey *string `json:"private_key,omitempty"` + PrivateKeyId *string `json:"private_key_id,omitempty"` + ProjectId *string `json:"project_id,omitempty"` + TokenUri *string `json:"token_uri,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AuthProviderX509CertUrl = all.AuthProviderX509CertUrl + o.AuthUri = all.AuthUri + o.Automute = all.Automute + o.ClientEmail = all.ClientEmail + o.ClientId = all.ClientId + o.ClientX509CertUrl = all.ClientX509CertUrl + o.Errors = all.Errors + o.HostFilters = all.HostFilters + o.PrivateKey = all.PrivateKey + o.PrivateKeyId = all.PrivateKeyId + o.ProjectId = all.ProjectId + o.TokenUri = all.TokenUri + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_geomap_widget_definition.go b/api/v1/datadog/model_geomap_widget_definition.go new file mode 100644 index 00000000000..8326fba9518 --- /dev/null +++ b/api/v1/datadog/model_geomap_widget_definition.go @@ -0,0 +1,439 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// GeomapWidgetDefinition This visualization displays a series of values by country on a world map. +type GeomapWidgetDefinition struct { + // A list of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // Array of one request object to display in the widget. The request must contain a `group-by` tag whose value is a country ISO code. + // + // See the [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json) + // for information about building the `REQUEST_SCHEMA`. + Requests []GeomapWidgetRequest `json:"requests"` + // The style to apply to the widget. + Style GeomapWidgetDefinitionStyle `json:"style"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // The title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // The size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the geomap widget. + Type GeomapWidgetDefinitionType `json:"type"` + // The view of the world that the map should render. + View GeomapWidgetDefinitionView `json:"view"` + // 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{} +} + +// NewGeomapWidgetDefinition instantiates a new GeomapWidgetDefinition 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 NewGeomapWidgetDefinition(requests []GeomapWidgetRequest, style GeomapWidgetDefinitionStyle, typeVar GeomapWidgetDefinitionType, view GeomapWidgetDefinitionView) *GeomapWidgetDefinition { + this := GeomapWidgetDefinition{} + this.Requests = requests + this.Style = style + this.Type = typeVar + this.View = view + return &this +} + +// NewGeomapWidgetDefinitionWithDefaults instantiates a new GeomapWidgetDefinition 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 NewGeomapWidgetDefinitionWithDefaults() *GeomapWidgetDefinition { + this := GeomapWidgetDefinition{} + var typeVar GeomapWidgetDefinitionType = GEOMAPWIDGETDEFINITIONTYPE_GEOMAP + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *GeomapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *GeomapWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *GeomapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetRequests returns the Requests field value. +func (o *GeomapWidgetDefinition) GetRequests() []GeomapWidgetRequest { + if o == nil { + var ret []GeomapWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetRequestsOk() (*[]GeomapWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *GeomapWidgetDefinition) SetRequests(v []GeomapWidgetRequest) { + o.Requests = v +} + +// GetStyle returns the Style field value. +func (o *GeomapWidgetDefinition) GetStyle() GeomapWidgetDefinitionStyle { + if o == nil { + var ret GeomapWidgetDefinitionStyle + return ret + } + return o.Style +} + +// GetStyleOk returns a tuple with the Style field value +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetStyleOk() (*GeomapWidgetDefinitionStyle, bool) { + if o == nil { + return nil, false + } + return &o.Style, true +} + +// SetStyle sets field value. +func (o *GeomapWidgetDefinition) SetStyle(v GeomapWidgetDefinitionStyle) { + o.Style = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *GeomapWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *GeomapWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *GeomapWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *GeomapWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *GeomapWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *GeomapWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *GeomapWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *GeomapWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *GeomapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *GeomapWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *GeomapWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *GeomapWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *GeomapWidgetDefinition) GetType() GeomapWidgetDefinitionType { + if o == nil { + var ret GeomapWidgetDefinitionType + 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 *GeomapWidgetDefinition) GetTypeOk() (*GeomapWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GeomapWidgetDefinition) SetType(v GeomapWidgetDefinitionType) { + o.Type = v +} + +// GetView returns the View field value. +func (o *GeomapWidgetDefinition) GetView() GeomapWidgetDefinitionView { + if o == nil { + var ret GeomapWidgetDefinitionView + return ret + } + return o.View +} + +// GetViewOk returns a tuple with the View field value +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinition) GetViewOk() (*GeomapWidgetDefinitionView, bool) { + if o == nil { + return nil, false + } + return &o.View, true +} + +// SetView sets field value. +func (o *GeomapWidgetDefinition) SetView(v GeomapWidgetDefinitionView) { + o.View = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GeomapWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + toSerialize["requests"] = o.Requests + toSerialize["style"] = o.Style + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + toSerialize["view"] = o.View + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]GeomapWidgetRequest `json:"requests"` + Style *GeomapWidgetDefinitionStyle `json:"style"` + Type *GeomapWidgetDefinitionType `json:"type"` + View *GeomapWidgetDefinitionView `json:"view"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests []GeomapWidgetRequest `json:"requests"` + Style GeomapWidgetDefinitionStyle `json:"style"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type GeomapWidgetDefinitionType `json:"type"` + View GeomapWidgetDefinitionView `json:"view"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Style == nil { + return fmt.Errorf("Required field style missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + if required.View == nil { + return fmt.Errorf("Required field view missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.Requests = all.Requests + if all.Style.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Style = all.Style + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + if all.View.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.View = all.View + return nil +} diff --git a/api/v1/datadog/model_geomap_widget_definition_style.go b/api/v1/datadog/model_geomap_widget_definition_style.go new file mode 100644 index 00000000000..8a41cab7dcc --- /dev/null +++ b/api/v1/datadog/model_geomap_widget_definition_style.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// GeomapWidgetDefinitionStyle The style to apply to the widget. +type GeomapWidgetDefinitionStyle struct { + // The color palette to apply to the widget. + Palette string `json:"palette"` + // Whether to flip the palette tones. + PaletteFlip bool `json:"palette_flip"` + // 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{} +} + +// NewGeomapWidgetDefinitionStyle instantiates a new GeomapWidgetDefinitionStyle 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 NewGeomapWidgetDefinitionStyle(palette string, paletteFlip bool) *GeomapWidgetDefinitionStyle { + this := GeomapWidgetDefinitionStyle{} + this.Palette = palette + this.PaletteFlip = paletteFlip + return &this +} + +// NewGeomapWidgetDefinitionStyleWithDefaults instantiates a new GeomapWidgetDefinitionStyle 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 NewGeomapWidgetDefinitionStyleWithDefaults() *GeomapWidgetDefinitionStyle { + this := GeomapWidgetDefinitionStyle{} + return &this +} + +// GetPalette returns the Palette field value. +func (o *GeomapWidgetDefinitionStyle) GetPalette() string { + if o == nil { + var ret string + return ret + } + return o.Palette +} + +// GetPaletteOk returns a tuple with the Palette field value +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinitionStyle) GetPaletteOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Palette, true +} + +// SetPalette sets field value. +func (o *GeomapWidgetDefinitionStyle) SetPalette(v string) { + o.Palette = v +} + +// GetPaletteFlip returns the PaletteFlip field value. +func (o *GeomapWidgetDefinitionStyle) GetPaletteFlip() bool { + if o == nil { + var ret bool + return ret + } + return o.PaletteFlip +} + +// GetPaletteFlipOk returns a tuple with the PaletteFlip field value +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinitionStyle) GetPaletteFlipOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.PaletteFlip, true +} + +// SetPaletteFlip sets field value. +func (o *GeomapWidgetDefinitionStyle) SetPaletteFlip(v bool) { + o.PaletteFlip = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GeomapWidgetDefinitionStyle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["palette"] = o.Palette + toSerialize["palette_flip"] = o.PaletteFlip + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GeomapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Palette *string `json:"palette"` + PaletteFlip *bool `json:"palette_flip"` + }{} + all := struct { + Palette string `json:"palette"` + PaletteFlip bool `json:"palette_flip"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Palette == nil { + return fmt.Errorf("Required field palette missing") + } + if required.PaletteFlip == nil { + return fmt.Errorf("Required field palette_flip missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Palette = all.Palette + o.PaletteFlip = all.PaletteFlip + return nil +} diff --git a/api/v1/datadog/model_geomap_widget_definition_type.go b/api/v1/datadog/model_geomap_widget_definition_type.go new file mode 100644 index 00000000000..cadabf22809 --- /dev/null +++ b/api/v1/datadog/model_geomap_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// GeomapWidgetDefinitionType Type of the geomap widget. +type GeomapWidgetDefinitionType string + +// List of GeomapWidgetDefinitionType. +const ( + GEOMAPWIDGETDEFINITIONTYPE_GEOMAP GeomapWidgetDefinitionType = "geomap" +) + +var allowedGeomapWidgetDefinitionTypeEnumValues = []GeomapWidgetDefinitionType{ + GEOMAPWIDGETDEFINITIONTYPE_GEOMAP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GeomapWidgetDefinitionType) GetAllowedValues() []GeomapWidgetDefinitionType { + return allowedGeomapWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GeomapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GeomapWidgetDefinitionType(value) + return nil +} + +// NewGeomapWidgetDefinitionTypeFromValue returns a pointer to a valid GeomapWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGeomapWidgetDefinitionTypeFromValue(v string) (*GeomapWidgetDefinitionType, error) { + ev := GeomapWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GeomapWidgetDefinitionType: valid values are %v", v, allowedGeomapWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GeomapWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedGeomapWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GeomapWidgetDefinitionType value. +func (v GeomapWidgetDefinitionType) Ptr() *GeomapWidgetDefinitionType { + return &v +} + +// NullableGeomapWidgetDefinitionType handles when a null is used for GeomapWidgetDefinitionType. +type NullableGeomapWidgetDefinitionType struct { + value *GeomapWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableGeomapWidgetDefinitionType) Get() *GeomapWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableGeomapWidgetDefinitionType) Set(val *GeomapWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableGeomapWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableGeomapWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableGeomapWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableGeomapWidgetDefinitionType(val *GeomapWidgetDefinitionType) *NullableGeomapWidgetDefinitionType { + return &NullableGeomapWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableGeomapWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableGeomapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_geomap_widget_definition_view.go b/api/v1/datadog/model_geomap_widget_definition_view.go new file mode 100644 index 00000000000..a6702d3f492 --- /dev/null +++ b/api/v1/datadog/model_geomap_widget_definition_view.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// GeomapWidgetDefinitionView The view of the world that the map should render. +type GeomapWidgetDefinitionView struct { + // The 2-letter ISO code of a country to focus the map on. Or `WORLD`. + Focus string `json:"focus"` + // 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{} +} + +// NewGeomapWidgetDefinitionView instantiates a new GeomapWidgetDefinitionView 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 NewGeomapWidgetDefinitionView(focus string) *GeomapWidgetDefinitionView { + this := GeomapWidgetDefinitionView{} + this.Focus = focus + return &this +} + +// NewGeomapWidgetDefinitionViewWithDefaults instantiates a new GeomapWidgetDefinitionView 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 NewGeomapWidgetDefinitionViewWithDefaults() *GeomapWidgetDefinitionView { + this := GeomapWidgetDefinitionView{} + return &this +} + +// GetFocus returns the Focus field value. +func (o *GeomapWidgetDefinitionView) GetFocus() string { + if o == nil { + var ret string + return ret + } + return o.Focus +} + +// GetFocusOk returns a tuple with the Focus field value +// and a boolean to check if the value has been set. +func (o *GeomapWidgetDefinitionView) GetFocusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Focus, true +} + +// SetFocus sets field value. +func (o *GeomapWidgetDefinitionView) SetFocus(v string) { + o.Focus = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GeomapWidgetDefinitionView) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["focus"] = o.Focus + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GeomapWidgetDefinitionView) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Focus *string `json:"focus"` + }{} + all := struct { + Focus string `json:"focus"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Focus == nil { + return fmt.Errorf("Required field focus missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Focus = all.Focus + return nil +} diff --git a/api/v1/datadog/model_geomap_widget_request.go b/api/v1/datadog/model_geomap_widget_request.go new file mode 100644 index 00000000000..b0f619dda85 --- /dev/null +++ b/api/v1/datadog/model_geomap_widget_request.go @@ -0,0 +1,365 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// GeomapWidgetRequest An updated geomap widget. +type GeomapWidgetRequest struct { + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The widget metrics query. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,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{} +} + +// NewGeomapWidgetRequest instantiates a new GeomapWidgetRequest 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 NewGeomapWidgetRequest() *GeomapWidgetRequest { + this := GeomapWidgetRequest{} + return &this +} + +// NewGeomapWidgetRequestWithDefaults instantiates a new GeomapWidgetRequest 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 NewGeomapWidgetRequestWithDefaults() *GeomapWidgetRequest { + this := GeomapWidgetRequest{} + return &this +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *GeomapWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *GeomapWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *GeomapWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *GeomapWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *GeomapWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *GeomapWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *GeomapWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GeomapWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *GeomapWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *GeomapWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GeomapWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GeomapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Formulas []WidgetFormula `json:"formulas,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Formulas = all.Formulas + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + return nil +} diff --git a/api/v1/datadog/model_graph_snapshot.go b/api/v1/datadog/model_graph_snapshot.go new file mode 100644 index 00000000000..ad30e623e78 --- /dev/null +++ b/api/v1/datadog/model_graph_snapshot.go @@ -0,0 +1,182 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// GraphSnapshot Object representing a graph snapshot. +type GraphSnapshot struct { + // A JSON document defining the graph. `graph_def` can be used instead of `metric_query`. + // The JSON document uses the [grammar defined here](https://docs.datadoghq.com/graphing/graphing_json/#grammar) + // and should be formatted to a single line then URL encoded. + GraphDef *string `json:"graph_def,omitempty"` + // The metric query. One of `metric_query` or `graph_def` is required. + MetricQuery *string `json:"metric_query,omitempty"` + // URL of your [graph snapshot](https://docs.datadoghq.com/metrics/explorer/#snapshot). + SnapshotUrl *string `json:"snapshot_url,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{} +} + +// NewGraphSnapshot instantiates a new GraphSnapshot 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 NewGraphSnapshot() *GraphSnapshot { + this := GraphSnapshot{} + return &this +} + +// NewGraphSnapshotWithDefaults instantiates a new GraphSnapshot 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 NewGraphSnapshotWithDefaults() *GraphSnapshot { + this := GraphSnapshot{} + return &this +} + +// GetGraphDef returns the GraphDef field value if set, zero value otherwise. +func (o *GraphSnapshot) GetGraphDef() string { + if o == nil || o.GraphDef == nil { + var ret string + return ret + } + return *o.GraphDef +} + +// GetGraphDefOk returns a tuple with the GraphDef field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GraphSnapshot) GetGraphDefOk() (*string, bool) { + if o == nil || o.GraphDef == nil { + return nil, false + } + return o.GraphDef, true +} + +// HasGraphDef returns a boolean if a field has been set. +func (o *GraphSnapshot) HasGraphDef() bool { + if o != nil && o.GraphDef != nil { + return true + } + + return false +} + +// SetGraphDef gets a reference to the given string and assigns it to the GraphDef field. +func (o *GraphSnapshot) SetGraphDef(v string) { + o.GraphDef = &v +} + +// GetMetricQuery returns the MetricQuery field value if set, zero value otherwise. +func (o *GraphSnapshot) GetMetricQuery() string { + if o == nil || o.MetricQuery == nil { + var ret string + return ret + } + return *o.MetricQuery +} + +// GetMetricQueryOk returns a tuple with the MetricQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GraphSnapshot) GetMetricQueryOk() (*string, bool) { + if o == nil || o.MetricQuery == nil { + return nil, false + } + return o.MetricQuery, true +} + +// HasMetricQuery returns a boolean if a field has been set. +func (o *GraphSnapshot) HasMetricQuery() bool { + if o != nil && o.MetricQuery != nil { + return true + } + + return false +} + +// SetMetricQuery gets a reference to the given string and assigns it to the MetricQuery field. +func (o *GraphSnapshot) SetMetricQuery(v string) { + o.MetricQuery = &v +} + +// GetSnapshotUrl returns the SnapshotUrl field value if set, zero value otherwise. +func (o *GraphSnapshot) GetSnapshotUrl() string { + if o == nil || o.SnapshotUrl == nil { + var ret string + return ret + } + return *o.SnapshotUrl +} + +// GetSnapshotUrlOk returns a tuple with the SnapshotUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GraphSnapshot) GetSnapshotUrlOk() (*string, bool) { + if o == nil || o.SnapshotUrl == nil { + return nil, false + } + return o.SnapshotUrl, true +} + +// HasSnapshotUrl returns a boolean if a field has been set. +func (o *GraphSnapshot) HasSnapshotUrl() bool { + if o != nil && o.SnapshotUrl != nil { + return true + } + + return false +} + +// SetSnapshotUrl gets a reference to the given string and assigns it to the SnapshotUrl field. +func (o *GraphSnapshot) SetSnapshotUrl(v string) { + o.SnapshotUrl = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GraphSnapshot) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.GraphDef != nil { + toSerialize["graph_def"] = o.GraphDef + } + if o.MetricQuery != nil { + toSerialize["metric_query"] = o.MetricQuery + } + if o.SnapshotUrl != nil { + toSerialize["snapshot_url"] = o.SnapshotUrl + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GraphSnapshot) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + GraphDef *string `json:"graph_def,omitempty"` + MetricQuery *string `json:"metric_query,omitempty"` + SnapshotUrl *string `json:"snapshot_url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.GraphDef = all.GraphDef + o.MetricQuery = all.MetricQuery + o.SnapshotUrl = all.SnapshotUrl + return nil +} diff --git a/api/v1/datadog/model_group_widget_definition.go b/api/v1/datadog/model_group_widget_definition.go new file mode 100644 index 00000000000..b056f598634 --- /dev/null +++ b/api/v1/datadog/model_group_widget_definition.go @@ -0,0 +1,394 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// GroupWidgetDefinition The groups widget allows you to keep similar graphs together on your timeboard. Each group has a custom header, can hold one to many graphs, and is collapsible. +type GroupWidgetDefinition struct { + // Background color of the group title. + BackgroundColor *string `json:"background_color,omitempty"` + // URL of image to display as a banner for the group. + BannerImg *string `json:"banner_img,omitempty"` + // Layout type of the group. + LayoutType WidgetLayoutType `json:"layout_type"` + // Whether to show the title or not. + ShowTitle *bool `json:"show_title,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Type of the group widget. + Type GroupWidgetDefinitionType `json:"type"` + // List of widget groups. + Widgets []Widget `json:"widgets"` + // 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{} +} + +// NewGroupWidgetDefinition instantiates a new GroupWidgetDefinition 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 NewGroupWidgetDefinition(layoutType WidgetLayoutType, typeVar GroupWidgetDefinitionType, widgets []Widget) *GroupWidgetDefinition { + this := GroupWidgetDefinition{} + this.LayoutType = layoutType + var showTitle bool = true + this.ShowTitle = &showTitle + this.Type = typeVar + this.Widgets = widgets + return &this +} + +// NewGroupWidgetDefinitionWithDefaults instantiates a new GroupWidgetDefinition 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 NewGroupWidgetDefinitionWithDefaults() *GroupWidgetDefinition { + this := GroupWidgetDefinition{} + var showTitle bool = true + this.ShowTitle = &showTitle + var typeVar GroupWidgetDefinitionType = GROUPWIDGETDEFINITIONTYPE_GROUP + this.Type = typeVar + return &this +} + +// GetBackgroundColor returns the BackgroundColor field value if set, zero value otherwise. +func (o *GroupWidgetDefinition) GetBackgroundColor() string { + if o == nil || o.BackgroundColor == nil { + var ret string + return ret + } + return *o.BackgroundColor +} + +// GetBackgroundColorOk returns a tuple with the BackgroundColor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GroupWidgetDefinition) GetBackgroundColorOk() (*string, bool) { + if o == nil || o.BackgroundColor == nil { + return nil, false + } + return o.BackgroundColor, true +} + +// HasBackgroundColor returns a boolean if a field has been set. +func (o *GroupWidgetDefinition) HasBackgroundColor() bool { + if o != nil && o.BackgroundColor != nil { + return true + } + + return false +} + +// SetBackgroundColor gets a reference to the given string and assigns it to the BackgroundColor field. +func (o *GroupWidgetDefinition) SetBackgroundColor(v string) { + o.BackgroundColor = &v +} + +// GetBannerImg returns the BannerImg field value if set, zero value otherwise. +func (o *GroupWidgetDefinition) GetBannerImg() string { + if o == nil || o.BannerImg == nil { + var ret string + return ret + } + return *o.BannerImg +} + +// GetBannerImgOk returns a tuple with the BannerImg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GroupWidgetDefinition) GetBannerImgOk() (*string, bool) { + if o == nil || o.BannerImg == nil { + return nil, false + } + return o.BannerImg, true +} + +// HasBannerImg returns a boolean if a field has been set. +func (o *GroupWidgetDefinition) HasBannerImg() bool { + if o != nil && o.BannerImg != nil { + return true + } + + return false +} + +// SetBannerImg gets a reference to the given string and assigns it to the BannerImg field. +func (o *GroupWidgetDefinition) SetBannerImg(v string) { + o.BannerImg = &v +} + +// GetLayoutType returns the LayoutType field value. +func (o *GroupWidgetDefinition) GetLayoutType() WidgetLayoutType { + if o == nil { + var ret WidgetLayoutType + return ret + } + return o.LayoutType +} + +// GetLayoutTypeOk returns a tuple with the LayoutType field value +// and a boolean to check if the value has been set. +func (o *GroupWidgetDefinition) GetLayoutTypeOk() (*WidgetLayoutType, bool) { + if o == nil { + return nil, false + } + return &o.LayoutType, true +} + +// SetLayoutType sets field value. +func (o *GroupWidgetDefinition) SetLayoutType(v WidgetLayoutType) { + o.LayoutType = v +} + +// GetShowTitle returns the ShowTitle field value if set, zero value otherwise. +func (o *GroupWidgetDefinition) GetShowTitle() bool { + if o == nil || o.ShowTitle == nil { + var ret bool + return ret + } + return *o.ShowTitle +} + +// GetShowTitleOk returns a tuple with the ShowTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GroupWidgetDefinition) GetShowTitleOk() (*bool, bool) { + if o == nil || o.ShowTitle == nil { + return nil, false + } + return o.ShowTitle, true +} + +// HasShowTitle returns a boolean if a field has been set. +func (o *GroupWidgetDefinition) HasShowTitle() bool { + if o != nil && o.ShowTitle != nil { + return true + } + + return false +} + +// SetShowTitle gets a reference to the given bool and assigns it to the ShowTitle field. +func (o *GroupWidgetDefinition) SetShowTitle(v bool) { + o.ShowTitle = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *GroupWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GroupWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *GroupWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *GroupWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *GroupWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GroupWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *GroupWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *GroupWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetType returns the Type field value. +func (o *GroupWidgetDefinition) GetType() GroupWidgetDefinitionType { + if o == nil { + var ret GroupWidgetDefinitionType + 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 *GroupWidgetDefinition) GetTypeOk() (*GroupWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GroupWidgetDefinition) SetType(v GroupWidgetDefinitionType) { + o.Type = v +} + +// GetWidgets returns the Widgets field value. +func (o *GroupWidgetDefinition) GetWidgets() []Widget { + if o == nil { + var ret []Widget + return ret + } + return o.Widgets +} + +// GetWidgetsOk returns a tuple with the Widgets field value +// and a boolean to check if the value has been set. +func (o *GroupWidgetDefinition) GetWidgetsOk() (*[]Widget, bool) { + if o == nil { + return nil, false + } + return &o.Widgets, true +} + +// SetWidgets sets field value. +func (o *GroupWidgetDefinition) SetWidgets(v []Widget) { + o.Widgets = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GroupWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BackgroundColor != nil { + toSerialize["background_color"] = o.BackgroundColor + } + if o.BannerImg != nil { + toSerialize["banner_img"] = o.BannerImg + } + toSerialize["layout_type"] = o.LayoutType + if o.ShowTitle != nil { + toSerialize["show_title"] = o.ShowTitle + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + toSerialize["type"] = o.Type + toSerialize["widgets"] = o.Widgets + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + LayoutType *WidgetLayoutType `json:"layout_type"` + Type *GroupWidgetDefinitionType `json:"type"` + Widgets *[]Widget `json:"widgets"` + }{} + all := struct { + BackgroundColor *string `json:"background_color,omitempty"` + BannerImg *string `json:"banner_img,omitempty"` + LayoutType WidgetLayoutType `json:"layout_type"` + ShowTitle *bool `json:"show_title,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + Type GroupWidgetDefinitionType `json:"type"` + Widgets []Widget `json:"widgets"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.LayoutType == nil { + return fmt.Errorf("Required field layout_type missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + if required.Widgets == nil { + return fmt.Errorf("Required field widgets missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LayoutType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BackgroundColor = all.BackgroundColor + o.BannerImg = all.BannerImg + o.LayoutType = all.LayoutType + o.ShowTitle = all.ShowTitle + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.Type = all.Type + o.Widgets = all.Widgets + return nil +} diff --git a/api/v1/datadog/model_group_widget_definition_type.go b/api/v1/datadog/model_group_widget_definition_type.go new file mode 100644 index 00000000000..0617706b4aa --- /dev/null +++ b/api/v1/datadog/model_group_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// GroupWidgetDefinitionType Type of the group widget. +type GroupWidgetDefinitionType string + +// List of GroupWidgetDefinitionType. +const ( + GROUPWIDGETDEFINITIONTYPE_GROUP GroupWidgetDefinitionType = "group" +) + +var allowedGroupWidgetDefinitionTypeEnumValues = []GroupWidgetDefinitionType{ + GROUPWIDGETDEFINITIONTYPE_GROUP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GroupWidgetDefinitionType) GetAllowedValues() []GroupWidgetDefinitionType { + return allowedGroupWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GroupWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GroupWidgetDefinitionType(value) + return nil +} + +// NewGroupWidgetDefinitionTypeFromValue returns a pointer to a valid GroupWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGroupWidgetDefinitionTypeFromValue(v string) (*GroupWidgetDefinitionType, error) { + ev := GroupWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GroupWidgetDefinitionType: valid values are %v", v, allowedGroupWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GroupWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedGroupWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GroupWidgetDefinitionType value. +func (v GroupWidgetDefinitionType) Ptr() *GroupWidgetDefinitionType { + return &v +} + +// NullableGroupWidgetDefinitionType handles when a null is used for GroupWidgetDefinitionType. +type NullableGroupWidgetDefinitionType struct { + value *GroupWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableGroupWidgetDefinitionType) Get() *GroupWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableGroupWidgetDefinitionType) Set(val *GroupWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableGroupWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableGroupWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableGroupWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableGroupWidgetDefinitionType(val *GroupWidgetDefinitionType) *NullableGroupWidgetDefinitionType { + return &NullableGroupWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableGroupWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableGroupWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_heat_map_widget_definition.go b/api/v1/datadog/model_heat_map_widget_definition.go new file mode 100644 index 00000000000..a9dd645e94d --- /dev/null +++ b/api/v1/datadog/model_heat_map_widget_definition.go @@ -0,0 +1,519 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HeatMapWidgetDefinition The heat map visualization shows metrics aggregated across many tags, such as hosts. The more hosts that have a particular value, the darker that square is. +type HeatMapWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // List of widget events. + Events []WidgetEvent `json:"events,omitempty"` + // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". + LegendSize *string `json:"legend_size,omitempty"` + // List of widget types. + Requests []HeatMapWidgetRequest `json:"requests"` + // Whether or not to display the legend on this widget. + ShowLegend *bool `json:"show_legend,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the heat map widget. + Type HeatMapWidgetDefinitionType `json:"type"` + // Axis controls for the widget. + Yaxis *WidgetAxis `json:"yaxis,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{} +} + +// NewHeatMapWidgetDefinition instantiates a new HeatMapWidgetDefinition 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 NewHeatMapWidgetDefinition(requests []HeatMapWidgetRequest, typeVar HeatMapWidgetDefinitionType) *HeatMapWidgetDefinition { + this := HeatMapWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewHeatMapWidgetDefinitionWithDefaults instantiates a new HeatMapWidgetDefinition 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 NewHeatMapWidgetDefinitionWithDefaults() *HeatMapWidgetDefinition { + this := HeatMapWidgetDefinition{} + var typeVar HeatMapWidgetDefinitionType = HEATMAPWIDGETDEFINITIONTYPE_HEATMAP + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *HeatMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetEvents returns the Events field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetEvents() []WidgetEvent { + if o == nil || o.Events == nil { + var ret []WidgetEvent + return ret + } + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetEventsOk() (*[]WidgetEvent, bool) { + if o == nil || o.Events == nil { + return nil, false + } + return &o.Events, true +} + +// HasEvents returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasEvents() bool { + if o != nil && o.Events != nil { + return true + } + + return false +} + +// SetEvents gets a reference to the given []WidgetEvent and assigns it to the Events field. +func (o *HeatMapWidgetDefinition) SetEvents(v []WidgetEvent) { + o.Events = v +} + +// GetLegendSize returns the LegendSize field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetLegendSize() string { + if o == nil || o.LegendSize == nil { + var ret string + return ret + } + return *o.LegendSize +} + +// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetLegendSizeOk() (*string, bool) { + if o == nil || o.LegendSize == nil { + return nil, false + } + return o.LegendSize, true +} + +// HasLegendSize returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasLegendSize() bool { + if o != nil && o.LegendSize != nil { + return true + } + + return false +} + +// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. +func (o *HeatMapWidgetDefinition) SetLegendSize(v string) { + o.LegendSize = &v +} + +// GetRequests returns the Requests field value. +func (o *HeatMapWidgetDefinition) GetRequests() []HeatMapWidgetRequest { + if o == nil { + var ret []HeatMapWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetRequestsOk() (*[]HeatMapWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *HeatMapWidgetDefinition) SetRequests(v []HeatMapWidgetRequest) { + o.Requests = v +} + +// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetShowLegend() bool { + if o == nil || o.ShowLegend == nil { + var ret bool + return ret + } + return *o.ShowLegend +} + +// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetShowLegendOk() (*bool, bool) { + if o == nil || o.ShowLegend == nil { + return nil, false + } + return o.ShowLegend, true +} + +// HasShowLegend returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasShowLegend() bool { + if o != nil && o.ShowLegend != nil { + return true + } + + return false +} + +// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. +func (o *HeatMapWidgetDefinition) SetShowLegend(v bool) { + o.ShowLegend = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *HeatMapWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *HeatMapWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *HeatMapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *HeatMapWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *HeatMapWidgetDefinition) GetType() HeatMapWidgetDefinitionType { + if o == nil { + var ret HeatMapWidgetDefinitionType + 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 *HeatMapWidgetDefinition) GetTypeOk() (*HeatMapWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *HeatMapWidgetDefinition) SetType(v HeatMapWidgetDefinitionType) { + o.Type = v +} + +// GetYaxis returns the Yaxis field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetYaxis() WidgetAxis { + if o == nil || o.Yaxis == nil { + var ret WidgetAxis + return ret + } + return *o.Yaxis +} + +// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetYaxisOk() (*WidgetAxis, bool) { + if o == nil || o.Yaxis == nil { + return nil, false + } + return o.Yaxis, true +} + +// HasYaxis returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasYaxis() bool { + if o != nil && o.Yaxis != nil { + return true + } + + return false +} + +// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. +func (o *HeatMapWidgetDefinition) SetYaxis(v WidgetAxis) { + o.Yaxis = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HeatMapWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + if o.Events != nil { + toSerialize["events"] = o.Events + } + if o.LegendSize != nil { + toSerialize["legend_size"] = o.LegendSize + } + toSerialize["requests"] = o.Requests + if o.ShowLegend != nil { + toSerialize["show_legend"] = o.ShowLegend + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + if o.Yaxis != nil { + toSerialize["yaxis"] = o.Yaxis + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]HeatMapWidgetRequest `json:"requests"` + Type *HeatMapWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Events []WidgetEvent `json:"events,omitempty"` + LegendSize *string `json:"legend_size,omitempty"` + Requests []HeatMapWidgetRequest `json:"requests"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type HeatMapWidgetDefinitionType `json:"type"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.Events = all.Events + o.LegendSize = all.LegendSize + o.Requests = all.Requests + o.ShowLegend = all.ShowLegend + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Yaxis = all.Yaxis + return nil +} diff --git a/api/v1/datadog/model_heat_map_widget_definition_type.go b/api/v1/datadog/model_heat_map_widget_definition_type.go new file mode 100644 index 00000000000..eb36583e598 --- /dev/null +++ b/api/v1/datadog/model_heat_map_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HeatMapWidgetDefinitionType Type of the heat map widget. +type HeatMapWidgetDefinitionType string + +// List of HeatMapWidgetDefinitionType. +const ( + HEATMAPWIDGETDEFINITIONTYPE_HEATMAP HeatMapWidgetDefinitionType = "heatmap" +) + +var allowedHeatMapWidgetDefinitionTypeEnumValues = []HeatMapWidgetDefinitionType{ + HEATMAPWIDGETDEFINITIONTYPE_HEATMAP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *HeatMapWidgetDefinitionType) GetAllowedValues() []HeatMapWidgetDefinitionType { + return allowedHeatMapWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *HeatMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = HeatMapWidgetDefinitionType(value) + return nil +} + +// NewHeatMapWidgetDefinitionTypeFromValue returns a pointer to a valid HeatMapWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewHeatMapWidgetDefinitionTypeFromValue(v string) (*HeatMapWidgetDefinitionType, error) { + ev := HeatMapWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for HeatMapWidgetDefinitionType: valid values are %v", v, allowedHeatMapWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v HeatMapWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedHeatMapWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to HeatMapWidgetDefinitionType value. +func (v HeatMapWidgetDefinitionType) Ptr() *HeatMapWidgetDefinitionType { + return &v +} + +// NullableHeatMapWidgetDefinitionType handles when a null is used for HeatMapWidgetDefinitionType. +type NullableHeatMapWidgetDefinitionType struct { + value *HeatMapWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableHeatMapWidgetDefinitionType) Get() *HeatMapWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableHeatMapWidgetDefinitionType) Set(val *HeatMapWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableHeatMapWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableHeatMapWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableHeatMapWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableHeatMapWidgetDefinitionType(val *HeatMapWidgetDefinitionType) *NullableHeatMapWidgetDefinitionType { + return &NullableHeatMapWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableHeatMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableHeatMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_heat_map_widget_request.go b/api/v1/datadog/model_heat_map_widget_request.go new file mode 100644 index 00000000000..7b4089d13e5 --- /dev/null +++ b/api/v1/datadog/model_heat_map_widget_request.go @@ -0,0 +1,516 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HeatMapWidgetRequest Updated heat map widget. +type HeatMapWidgetRequest struct { + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The event query. + EventQuery *EventQueryDefinition `json:"event_query,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Widget query. + Q *string `json:"q,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + // Widget style definition. + Style *WidgetStyle `json:"style,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{} +} + +// NewHeatMapWidgetRequest instantiates a new HeatMapWidgetRequest 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 NewHeatMapWidgetRequest() *HeatMapWidgetRequest { + this := HeatMapWidgetRequest{} + return &this +} + +// NewHeatMapWidgetRequestWithDefaults instantiates a new HeatMapWidgetRequest 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 NewHeatMapWidgetRequestWithDefaults() *HeatMapWidgetRequest { + this := HeatMapWidgetRequest{} + return &this +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *HeatMapWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetEventQuery() EventQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret EventQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetEventQueryOk() (*EventQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given EventQueryDefinition and assigns it to the EventQuery field. +func (o *HeatMapWidgetRequest) SetEventQuery(v EventQueryDefinition) { + o.EventQuery = &v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *HeatMapWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *HeatMapWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *HeatMapWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *HeatMapWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *HeatMapWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *HeatMapWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *HeatMapWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// GetStyle returns the Style field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetStyle() WidgetStyle { + if o == nil || o.Style == nil { + var ret WidgetStyle + return ret + } + return *o.Style +} + +// GetStyleOk returns a tuple with the Style field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetStyleOk() (*WidgetStyle, bool) { + if o == nil || o.Style == nil { + return nil, false + } + return o.Style, true +} + +// HasStyle returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasStyle() bool { + if o != nil && o.Style != nil { + return true + } + + return false +} + +// SetStyle gets a reference to the given WidgetStyle and assigns it to the Style field. +func (o *HeatMapWidgetRequest) SetStyle(v WidgetStyle) { + o.Style = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HeatMapWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + if o.Style != nil { + toSerialize["style"] = o.Style + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + EventQuery *EventQueryDefinition `json:"event_query,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + Style *WidgetStyle `json:"style,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Style = all.Style + return nil +} diff --git a/api/v1/datadog/model_host.go b/api/v1/datadog/model_host.go new file mode 100644 index 00000000000..23cbe9d6698 --- /dev/null +++ b/api/v1/datadog/model_host.go @@ -0,0 +1,623 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Host Object representing a host. +type Host struct { + // Host aliases collected by Datadog. + Aliases []string `json:"aliases,omitempty"` + // The Datadog integrations reporting metrics for the host. + Apps []string `json:"apps,omitempty"` + // AWS name of your host. + AwsName *string `json:"aws_name,omitempty"` + // The host name. + HostName *string `json:"host_name,omitempty"` + // The host ID. + Id *int64 `json:"id,omitempty"` + // If a host is muted or unmuted. + IsMuted *bool `json:"is_muted,omitempty"` + // Last time the host reported a metric data point. + LastReportedTime *int64 `json:"last_reported_time,omitempty"` + // Metadata associated with your host. + Meta *HostMeta `json:"meta,omitempty"` + // Host Metrics collected. + Metrics *HostMetrics `json:"metrics,omitempty"` + // Timeout of the mute applied to your host. + MuteTimeout *int64 `json:"mute_timeout,omitempty"` + // The host name. + Name *string `json:"name,omitempty"` + // Source or cloud provider associated with your host. + Sources []string `json:"sources,omitempty"` + // List of tags for each source (AWS, Datadog Agent, Chef..). + TagsBySource map[string][]string `json:"tags_by_source,omitempty"` + // Displays UP when the expected metrics are received and displays `???` if no metrics are received. + Up *bool `json:"up,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{} +} + +// NewHost instantiates a new Host 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 NewHost() *Host { + this := Host{} + return &this +} + +// NewHostWithDefaults instantiates a new Host 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 NewHostWithDefaults() *Host { + this := Host{} + return &this +} + +// GetAliases returns the Aliases field value if set, zero value otherwise. +func (o *Host) GetAliases() []string { + if o == nil || o.Aliases == nil { + var ret []string + return ret + } + return o.Aliases +} + +// GetAliasesOk returns a tuple with the Aliases field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetAliasesOk() (*[]string, bool) { + if o == nil || o.Aliases == nil { + return nil, false + } + return &o.Aliases, true +} + +// HasAliases returns a boolean if a field has been set. +func (o *Host) HasAliases() bool { + if o != nil && o.Aliases != nil { + return true + } + + return false +} + +// SetAliases gets a reference to the given []string and assigns it to the Aliases field. +func (o *Host) SetAliases(v []string) { + o.Aliases = v +} + +// GetApps returns the Apps field value if set, zero value otherwise. +func (o *Host) GetApps() []string { + if o == nil || o.Apps == nil { + var ret []string + return ret + } + return o.Apps +} + +// GetAppsOk returns a tuple with the Apps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetAppsOk() (*[]string, bool) { + if o == nil || o.Apps == nil { + return nil, false + } + return &o.Apps, true +} + +// HasApps returns a boolean if a field has been set. +func (o *Host) HasApps() bool { + if o != nil && o.Apps != nil { + return true + } + + return false +} + +// SetApps gets a reference to the given []string and assigns it to the Apps field. +func (o *Host) SetApps(v []string) { + o.Apps = v +} + +// GetAwsName returns the AwsName field value if set, zero value otherwise. +func (o *Host) GetAwsName() string { + if o == nil || o.AwsName == nil { + var ret string + return ret + } + return *o.AwsName +} + +// GetAwsNameOk returns a tuple with the AwsName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetAwsNameOk() (*string, bool) { + if o == nil || o.AwsName == nil { + return nil, false + } + return o.AwsName, true +} + +// HasAwsName returns a boolean if a field has been set. +func (o *Host) HasAwsName() bool { + if o != nil && o.AwsName != nil { + return true + } + + return false +} + +// SetAwsName gets a reference to the given string and assigns it to the AwsName field. +func (o *Host) SetAwsName(v string) { + o.AwsName = &v +} + +// GetHostName returns the HostName field value if set, zero value otherwise. +func (o *Host) 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 *Host) 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 *Host) HasHostName() bool { + if o != nil && o.HostName != nil { + return true + } + + return false +} + +// SetHostName gets a reference to the given string and assigns it to the HostName field. +func (o *Host) SetHostName(v string) { + o.HostName = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Host) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Host) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Host) SetId(v int64) { + o.Id = &v +} + +// GetIsMuted returns the IsMuted field value if set, zero value otherwise. +func (o *Host) GetIsMuted() bool { + if o == nil || o.IsMuted == nil { + var ret bool + return ret + } + return *o.IsMuted +} + +// GetIsMutedOk returns a tuple with the IsMuted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetIsMutedOk() (*bool, bool) { + if o == nil || o.IsMuted == nil { + return nil, false + } + return o.IsMuted, true +} + +// HasIsMuted returns a boolean if a field has been set. +func (o *Host) HasIsMuted() bool { + if o != nil && o.IsMuted != nil { + return true + } + + return false +} + +// SetIsMuted gets a reference to the given bool and assigns it to the IsMuted field. +func (o *Host) SetIsMuted(v bool) { + o.IsMuted = &v +} + +// GetLastReportedTime returns the LastReportedTime field value if set, zero value otherwise. +func (o *Host) GetLastReportedTime() int64 { + if o == nil || o.LastReportedTime == nil { + var ret int64 + return ret + } + return *o.LastReportedTime +} + +// GetLastReportedTimeOk returns a tuple with the LastReportedTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetLastReportedTimeOk() (*int64, bool) { + if o == nil || o.LastReportedTime == nil { + return nil, false + } + return o.LastReportedTime, true +} + +// HasLastReportedTime returns a boolean if a field has been set. +func (o *Host) HasLastReportedTime() bool { + if o != nil && o.LastReportedTime != nil { + return true + } + + return false +} + +// SetLastReportedTime gets a reference to the given int64 and assigns it to the LastReportedTime field. +func (o *Host) SetLastReportedTime(v int64) { + o.LastReportedTime = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *Host) GetMeta() HostMeta { + if o == nil || o.Meta == nil { + var ret HostMeta + 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 *Host) GetMetaOk() (*HostMeta, 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 *Host) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given HostMeta and assigns it to the Meta field. +func (o *Host) SetMeta(v HostMeta) { + o.Meta = &v +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *Host) GetMetrics() HostMetrics { + if o == nil || o.Metrics == nil { + var ret HostMetrics + return ret + } + return *o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetMetricsOk() (*HostMetrics, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *Host) HasMetrics() bool { + if o != nil && o.Metrics != nil { + return true + } + + return false +} + +// SetMetrics gets a reference to the given HostMetrics and assigns it to the Metrics field. +func (o *Host) SetMetrics(v HostMetrics) { + o.Metrics = &v +} + +// GetMuteTimeout returns the MuteTimeout field value if set, zero value otherwise. +func (o *Host) GetMuteTimeout() int64 { + if o == nil || o.MuteTimeout == nil { + var ret int64 + return ret + } + return *o.MuteTimeout +} + +// GetMuteTimeoutOk returns a tuple with the MuteTimeout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetMuteTimeoutOk() (*int64, bool) { + if o == nil || o.MuteTimeout == nil { + return nil, false + } + return o.MuteTimeout, true +} + +// HasMuteTimeout returns a boolean if a field has been set. +func (o *Host) HasMuteTimeout() bool { + if o != nil && o.MuteTimeout != nil { + return true + } + + return false +} + +// SetMuteTimeout gets a reference to the given int64 and assigns it to the MuteTimeout field. +func (o *Host) SetMuteTimeout(v int64) { + o.MuteTimeout = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Host) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Host) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Host) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value if set, zero value otherwise. +func (o *Host) GetSources() []string { + if o == nil || o.Sources == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetSourcesOk() (*[]string, bool) { + if o == nil || o.Sources == nil { + return nil, false + } + return &o.Sources, true +} + +// HasSources returns a boolean if a field has been set. +func (o *Host) HasSources() bool { + if o != nil && o.Sources != nil { + return true + } + + return false +} + +// SetSources gets a reference to the given []string and assigns it to the Sources field. +func (o *Host) SetSources(v []string) { + o.Sources = v +} + +// GetTagsBySource returns the TagsBySource field value if set, zero value otherwise. +func (o *Host) GetTagsBySource() map[string][]string { + if o == nil || o.TagsBySource == nil { + var ret map[string][]string + return ret + } + return o.TagsBySource +} + +// GetTagsBySourceOk returns a tuple with the TagsBySource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetTagsBySourceOk() (*map[string][]string, bool) { + if o == nil || o.TagsBySource == nil { + return nil, false + } + return &o.TagsBySource, true +} + +// HasTagsBySource returns a boolean if a field has been set. +func (o *Host) HasTagsBySource() bool { + if o != nil && o.TagsBySource != nil { + return true + } + + return false +} + +// SetTagsBySource gets a reference to the given map[string][]string and assigns it to the TagsBySource field. +func (o *Host) SetTagsBySource(v map[string][]string) { + o.TagsBySource = v +} + +// GetUp returns the Up field value if set, zero value otherwise. +func (o *Host) GetUp() bool { + if o == nil || o.Up == nil { + var ret bool + return ret + } + return *o.Up +} + +// GetUpOk returns a tuple with the Up field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Host) GetUpOk() (*bool, bool) { + if o == nil || o.Up == nil { + return nil, false + } + return o.Up, true +} + +// HasUp returns a boolean if a field has been set. +func (o *Host) HasUp() bool { + if o != nil && o.Up != nil { + return true + } + + return false +} + +// SetUp gets a reference to the given bool and assigns it to the Up field. +func (o *Host) SetUp(v bool) { + o.Up = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Host) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aliases != nil { + toSerialize["aliases"] = o.Aliases + } + if o.Apps != nil { + toSerialize["apps"] = o.Apps + } + if o.AwsName != nil { + toSerialize["aws_name"] = o.AwsName + } + if o.HostName != nil { + toSerialize["host_name"] = o.HostName + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IsMuted != nil { + toSerialize["is_muted"] = o.IsMuted + } + if o.LastReportedTime != nil { + toSerialize["last_reported_time"] = o.LastReportedTime + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + if o.MuteTimeout != nil { + toSerialize["mute_timeout"] = o.MuteTimeout + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Sources != nil { + toSerialize["sources"] = o.Sources + } + if o.TagsBySource != nil { + toSerialize["tags_by_source"] = o.TagsBySource + } + if o.Up != nil { + toSerialize["up"] = o.Up + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Host) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aliases []string `json:"aliases,omitempty"` + Apps []string `json:"apps,omitempty"` + AwsName *string `json:"aws_name,omitempty"` + HostName *string `json:"host_name,omitempty"` + Id *int64 `json:"id,omitempty"` + IsMuted *bool `json:"is_muted,omitempty"` + LastReportedTime *int64 `json:"last_reported_time,omitempty"` + Meta *HostMeta `json:"meta,omitempty"` + Metrics *HostMetrics `json:"metrics,omitempty"` + MuteTimeout *int64 `json:"mute_timeout,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources,omitempty"` + TagsBySource map[string][]string `json:"tags_by_source,omitempty"` + Up *bool `json:"up,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aliases = all.Aliases + o.Apps = all.Apps + o.AwsName = all.AwsName + o.HostName = all.HostName + o.Id = all.Id + o.IsMuted = all.IsMuted + o.LastReportedTime = all.LastReportedTime + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + if all.Metrics != nil && all.Metrics.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metrics = all.Metrics + o.MuteTimeout = all.MuteTimeout + o.Name = all.Name + o.Sources = all.Sources + o.TagsBySource = all.TagsBySource + o.Up = all.Up + return nil +} diff --git a/api/v1/datadog/model_host_list_response.go b/api/v1/datadog/model_host_list_response.go new file mode 100644 index 00000000000..e9d519c7e32 --- /dev/null +++ b/api/v1/datadog/model_host_list_response.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostListResponse Response with Host information from Datadog. +type HostListResponse struct { + // Array of hosts. + HostList []Host `json:"host_list,omitempty"` + // Number of host matching the query. + TotalMatching *int64 `json:"total_matching,omitempty"` + // Number of host returned. + TotalReturned *int64 `json:"total_returned,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{} +} + +// NewHostListResponse instantiates a new HostListResponse 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 NewHostListResponse() *HostListResponse { + this := HostListResponse{} + return &this +} + +// NewHostListResponseWithDefaults instantiates a new HostListResponse 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 NewHostListResponseWithDefaults() *HostListResponse { + this := HostListResponse{} + return &this +} + +// GetHostList returns the HostList field value if set, zero value otherwise. +func (o *HostListResponse) GetHostList() []Host { + if o == nil || o.HostList == nil { + var ret []Host + return ret + } + return o.HostList +} + +// GetHostListOk returns a tuple with the HostList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostListResponse) GetHostListOk() (*[]Host, bool) { + if o == nil || o.HostList == nil { + return nil, false + } + return &o.HostList, true +} + +// HasHostList returns a boolean if a field has been set. +func (o *HostListResponse) HasHostList() bool { + if o != nil && o.HostList != nil { + return true + } + + return false +} + +// SetHostList gets a reference to the given []Host and assigns it to the HostList field. +func (o *HostListResponse) SetHostList(v []Host) { + o.HostList = v +} + +// GetTotalMatching returns the TotalMatching field value if set, zero value otherwise. +func (o *HostListResponse) GetTotalMatching() int64 { + if o == nil || o.TotalMatching == nil { + var ret int64 + return ret + } + return *o.TotalMatching +} + +// GetTotalMatchingOk returns a tuple with the TotalMatching field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostListResponse) GetTotalMatchingOk() (*int64, bool) { + if o == nil || o.TotalMatching == nil { + return nil, false + } + return o.TotalMatching, true +} + +// HasTotalMatching returns a boolean if a field has been set. +func (o *HostListResponse) HasTotalMatching() bool { + if o != nil && o.TotalMatching != nil { + return true + } + + return false +} + +// SetTotalMatching gets a reference to the given int64 and assigns it to the TotalMatching field. +func (o *HostListResponse) SetTotalMatching(v int64) { + o.TotalMatching = &v +} + +// GetTotalReturned returns the TotalReturned field value if set, zero value otherwise. +func (o *HostListResponse) GetTotalReturned() int64 { + if o == nil || o.TotalReturned == nil { + var ret int64 + return ret + } + return *o.TotalReturned +} + +// GetTotalReturnedOk returns a tuple with the TotalReturned field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostListResponse) GetTotalReturnedOk() (*int64, bool) { + if o == nil || o.TotalReturned == nil { + return nil, false + } + return o.TotalReturned, true +} + +// HasTotalReturned returns a boolean if a field has been set. +func (o *HostListResponse) HasTotalReturned() bool { + if o != nil && o.TotalReturned != nil { + return true + } + + return false +} + +// SetTotalReturned gets a reference to the given int64 and assigns it to the TotalReturned field. +func (o *HostListResponse) SetTotalReturned(v int64) { + o.TotalReturned = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.HostList != nil { + toSerialize["host_list"] = o.HostList + } + if o.TotalMatching != nil { + toSerialize["total_matching"] = o.TotalMatching + } + if o.TotalReturned != nil { + toSerialize["total_returned"] = o.TotalReturned + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + HostList []Host `json:"host_list,omitempty"` + TotalMatching *int64 `json:"total_matching,omitempty"` + TotalReturned *int64 `json:"total_returned,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.HostList = all.HostList + o.TotalMatching = all.TotalMatching + o.TotalReturned = all.TotalReturned + return nil +} diff --git a/api/v1/datadog/model_host_map_request.go b/api/v1/datadog/model_host_map_request.go new file mode 100644 index 00000000000..82dc1e20f34 --- /dev/null +++ b/api/v1/datadog/model_host_map_request.go @@ -0,0 +1,470 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMapRequest Updated host map. +type HostMapRequest struct { + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Query definition. + Q *string `json:"q,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,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{} +} + +// NewHostMapRequest instantiates a new HostMapRequest 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 NewHostMapRequest() *HostMapRequest { + this := HostMapRequest{} + return &this +} + +// NewHostMapRequestWithDefaults instantiates a new HostMapRequest 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 NewHostMapRequestWithDefaults() *HostMapRequest { + this := HostMapRequest{} + return &this +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *HostMapRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *HostMapRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *HostMapRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *HostMapRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *HostMapRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *HostMapRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *HostMapRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *HostMapRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *HostMapRequest) SetQ(v string) { + o.Q = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *HostMapRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *HostMapRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *HostMapRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *HostMapRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMapRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMapRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + return nil +} diff --git a/api/v1/datadog/model_host_map_widget_definition.go b/api/v1/datadog/model_host_map_widget_definition.go new file mode 100644 index 00000000000..26e0a39ea79 --- /dev/null +++ b/api/v1/datadog/model_host_map_widget_definition.go @@ -0,0 +1,605 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HostMapWidgetDefinition The host map widget graphs any metric across your hosts using the same visualization available from the main Host Map page. +type HostMapWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // List of tag prefixes to group by. + Group []string `json:"group,omitempty"` + // Whether to show the hosts that don’t fit in a group. + NoGroupHosts *bool `json:"no_group_hosts,omitempty"` + // Whether to show the hosts with no metrics. + NoMetricHosts *bool `json:"no_metric_hosts,omitempty"` + // Which type of node to use in the map. + NodeType *WidgetNodeType `json:"node_type,omitempty"` + // Notes on the title. + Notes *string `json:"notes,omitempty"` + // List of definitions. + Requests HostMapWidgetDefinitionRequests `json:"requests"` + // List of tags used to filter the map. + Scope []string `json:"scope,omitempty"` + // The style to apply to the widget. + Style *HostMapWidgetDefinitionStyle `json:"style,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the host map widget. + Type HostMapWidgetDefinitionType `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{} +} + +// NewHostMapWidgetDefinition instantiates a new HostMapWidgetDefinition 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 NewHostMapWidgetDefinition(requests HostMapWidgetDefinitionRequests, typeVar HostMapWidgetDefinitionType) *HostMapWidgetDefinition { + this := HostMapWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewHostMapWidgetDefinitionWithDefaults instantiates a new HostMapWidgetDefinition 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 NewHostMapWidgetDefinitionWithDefaults() *HostMapWidgetDefinition { + this := HostMapWidgetDefinition{} + var typeVar HostMapWidgetDefinitionType = HOSTMAPWIDGETDEFINITIONTYPE_HOSTMAP + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *HostMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetGroup returns the Group field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetGroup() []string { + if o == nil || o.Group == nil { + var ret []string + return ret + } + return o.Group +} + +// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetGroupOk() (*[]string, bool) { + if o == nil || o.Group == nil { + return nil, false + } + return &o.Group, true +} + +// HasGroup returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasGroup() bool { + if o != nil && o.Group != nil { + return true + } + + return false +} + +// SetGroup gets a reference to the given []string and assigns it to the Group field. +func (o *HostMapWidgetDefinition) SetGroup(v []string) { + o.Group = v +} + +// GetNoGroupHosts returns the NoGroupHosts field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetNoGroupHosts() bool { + if o == nil || o.NoGroupHosts == nil { + var ret bool + return ret + } + return *o.NoGroupHosts +} + +// GetNoGroupHostsOk returns a tuple with the NoGroupHosts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetNoGroupHostsOk() (*bool, bool) { + if o == nil || o.NoGroupHosts == nil { + return nil, false + } + return o.NoGroupHosts, true +} + +// HasNoGroupHosts returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasNoGroupHosts() bool { + if o != nil && o.NoGroupHosts != nil { + return true + } + + return false +} + +// SetNoGroupHosts gets a reference to the given bool and assigns it to the NoGroupHosts field. +func (o *HostMapWidgetDefinition) SetNoGroupHosts(v bool) { + o.NoGroupHosts = &v +} + +// GetNoMetricHosts returns the NoMetricHosts field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetNoMetricHosts() bool { + if o == nil || o.NoMetricHosts == nil { + var ret bool + return ret + } + return *o.NoMetricHosts +} + +// GetNoMetricHostsOk returns a tuple with the NoMetricHosts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetNoMetricHostsOk() (*bool, bool) { + if o == nil || o.NoMetricHosts == nil { + return nil, false + } + return o.NoMetricHosts, true +} + +// HasNoMetricHosts returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasNoMetricHosts() bool { + if o != nil && o.NoMetricHosts != nil { + return true + } + + return false +} + +// SetNoMetricHosts gets a reference to the given bool and assigns it to the NoMetricHosts field. +func (o *HostMapWidgetDefinition) SetNoMetricHosts(v bool) { + o.NoMetricHosts = &v +} + +// GetNodeType returns the NodeType field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetNodeType() WidgetNodeType { + if o == nil || o.NodeType == nil { + var ret WidgetNodeType + return ret + } + return *o.NodeType +} + +// GetNodeTypeOk returns a tuple with the NodeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetNodeTypeOk() (*WidgetNodeType, bool) { + if o == nil || o.NodeType == nil { + return nil, false + } + return o.NodeType, true +} + +// HasNodeType returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasNodeType() bool { + if o != nil && o.NodeType != nil { + return true + } + + return false +} + +// SetNodeType gets a reference to the given WidgetNodeType and assigns it to the NodeType field. +func (o *HostMapWidgetDefinition) SetNodeType(v WidgetNodeType) { + o.NodeType = &v +} + +// GetNotes returns the Notes field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetNotes() string { + if o == nil || o.Notes == nil { + var ret string + return ret + } + return *o.Notes +} + +// GetNotesOk returns a tuple with the Notes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetNotesOk() (*string, bool) { + if o == nil || o.Notes == nil { + return nil, false + } + return o.Notes, true +} + +// HasNotes returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasNotes() bool { + if o != nil && o.Notes != nil { + return true + } + + return false +} + +// SetNotes gets a reference to the given string and assigns it to the Notes field. +func (o *HostMapWidgetDefinition) SetNotes(v string) { + o.Notes = &v +} + +// GetRequests returns the Requests field value. +func (o *HostMapWidgetDefinition) GetRequests() HostMapWidgetDefinitionRequests { + if o == nil { + var ret HostMapWidgetDefinitionRequests + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetRequestsOk() (*HostMapWidgetDefinitionRequests, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *HostMapWidgetDefinition) SetRequests(v HostMapWidgetDefinitionRequests) { + o.Requests = v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetScope() []string { + if o == nil || o.Scope == nil { + var ret []string + return ret + } + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetScopeOk() (*[]string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return &o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasScope() bool { + if o != nil && o.Scope != nil { + return true + } + + return false +} + +// SetScope gets a reference to the given []string and assigns it to the Scope field. +func (o *HostMapWidgetDefinition) SetScope(v []string) { + o.Scope = v +} + +// GetStyle returns the Style field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetStyle() HostMapWidgetDefinitionStyle { + if o == nil || o.Style == nil { + var ret HostMapWidgetDefinitionStyle + return ret + } + return *o.Style +} + +// GetStyleOk returns a tuple with the Style field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetStyleOk() (*HostMapWidgetDefinitionStyle, bool) { + if o == nil || o.Style == nil { + return nil, false + } + return o.Style, true +} + +// HasStyle returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasStyle() bool { + if o != nil && o.Style != nil { + return true + } + + return false +} + +// SetStyle gets a reference to the given HostMapWidgetDefinitionStyle and assigns it to the Style field. +func (o *HostMapWidgetDefinition) SetStyle(v HostMapWidgetDefinitionStyle) { + o.Style = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *HostMapWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *HostMapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *HostMapWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *HostMapWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *HostMapWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *HostMapWidgetDefinition) GetType() HostMapWidgetDefinitionType { + if o == nil { + var ret HostMapWidgetDefinitionType + 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 *HostMapWidgetDefinition) GetTypeOk() (*HostMapWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *HostMapWidgetDefinition) SetType(v HostMapWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMapWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + if o.Group != nil { + toSerialize["group"] = o.Group + } + if o.NoGroupHosts != nil { + toSerialize["no_group_hosts"] = o.NoGroupHosts + } + if o.NoMetricHosts != nil { + toSerialize["no_metric_hosts"] = o.NoMetricHosts + } + if o.NodeType != nil { + toSerialize["node_type"] = o.NodeType + } + if o.Notes != nil { + toSerialize["notes"] = o.Notes + } + toSerialize["requests"] = o.Requests + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Style != nil { + toSerialize["style"] = o.Style + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *HostMapWidgetDefinitionRequests `json:"requests"` + Type *HostMapWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Group []string `json:"group,omitempty"` + NoGroupHosts *bool `json:"no_group_hosts,omitempty"` + NoMetricHosts *bool `json:"no_metric_hosts,omitempty"` + NodeType *WidgetNodeType `json:"node_type,omitempty"` + Notes *string `json:"notes,omitempty"` + Requests HostMapWidgetDefinitionRequests `json:"requests"` + Scope []string `json:"scope,omitempty"` + Style *HostMapWidgetDefinitionStyle `json:"style,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type HostMapWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.NodeType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.Group = all.Group + o.NoGroupHosts = all.NoGroupHosts + o.NoMetricHosts = all.NoMetricHosts + o.NodeType = all.NodeType + o.Notes = all.Notes + if all.Requests.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Requests = all.Requests + o.Scope = all.Scope + if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Style = all.Style + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_host_map_widget_definition_requests.go b/api/v1/datadog/model_host_map_widget_definition_requests.go new file mode 100644 index 00000000000..a8c07bb067d --- /dev/null +++ b/api/v1/datadog/model_host_map_widget_definition_requests.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMapWidgetDefinitionRequests List of definitions. +type HostMapWidgetDefinitionRequests struct { + // Updated host map. + Fill *HostMapRequest `json:"fill,omitempty"` + // Updated host map. + Size *HostMapRequest `json:"size,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{} +} + +// NewHostMapWidgetDefinitionRequests instantiates a new HostMapWidgetDefinitionRequests 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 NewHostMapWidgetDefinitionRequests() *HostMapWidgetDefinitionRequests { + this := HostMapWidgetDefinitionRequests{} + return &this +} + +// NewHostMapWidgetDefinitionRequestsWithDefaults instantiates a new HostMapWidgetDefinitionRequests 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 NewHostMapWidgetDefinitionRequestsWithDefaults() *HostMapWidgetDefinitionRequests { + this := HostMapWidgetDefinitionRequests{} + return &this +} + +// GetFill returns the Fill field value if set, zero value otherwise. +func (o *HostMapWidgetDefinitionRequests) GetFill() HostMapRequest { + if o == nil || o.Fill == nil { + var ret HostMapRequest + return ret + } + return *o.Fill +} + +// GetFillOk returns a tuple with the Fill field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinitionRequests) GetFillOk() (*HostMapRequest, bool) { + if o == nil || o.Fill == nil { + return nil, false + } + return o.Fill, true +} + +// HasFill returns a boolean if a field has been set. +func (o *HostMapWidgetDefinitionRequests) HasFill() bool { + if o != nil && o.Fill != nil { + return true + } + + return false +} + +// SetFill gets a reference to the given HostMapRequest and assigns it to the Fill field. +func (o *HostMapWidgetDefinitionRequests) SetFill(v HostMapRequest) { + o.Fill = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *HostMapWidgetDefinitionRequests) GetSize() HostMapRequest { + if o == nil || o.Size == nil { + var ret HostMapRequest + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinitionRequests) GetSizeOk() (*HostMapRequest, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *HostMapWidgetDefinitionRequests) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given HostMapRequest and assigns it to the Size field. +func (o *HostMapWidgetDefinitionRequests) SetSize(v HostMapRequest) { + o.Size = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMapWidgetDefinitionRequests) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Fill != nil { + toSerialize["fill"] = o.Fill + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMapWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Fill *HostMapRequest `json:"fill,omitempty"` + Size *HostMapRequest `json:"size,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Fill != nil && all.Fill.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Fill = all.Fill + if all.Size != nil && all.Size.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Size = all.Size + return nil +} diff --git a/api/v1/datadog/model_host_map_widget_definition_style.go b/api/v1/datadog/model_host_map_widget_definition_style.go new file mode 100644 index 00000000000..9264369786b --- /dev/null +++ b/api/v1/datadog/model_host_map_widget_definition_style.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMapWidgetDefinitionStyle The style to apply to the widget. +type HostMapWidgetDefinitionStyle struct { + // Max value to use to color the map. + FillMax *string `json:"fill_max,omitempty"` + // Min value to use to color the map. + FillMin *string `json:"fill_min,omitempty"` + // Color palette to apply to the widget. + Palette *string `json:"palette,omitempty"` + // Whether to flip the palette tones. + PaletteFlip *bool `json:"palette_flip,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{} +} + +// NewHostMapWidgetDefinitionStyle instantiates a new HostMapWidgetDefinitionStyle 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 NewHostMapWidgetDefinitionStyle() *HostMapWidgetDefinitionStyle { + this := HostMapWidgetDefinitionStyle{} + return &this +} + +// NewHostMapWidgetDefinitionStyleWithDefaults instantiates a new HostMapWidgetDefinitionStyle 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 NewHostMapWidgetDefinitionStyleWithDefaults() *HostMapWidgetDefinitionStyle { + this := HostMapWidgetDefinitionStyle{} + return &this +} + +// GetFillMax returns the FillMax field value if set, zero value otherwise. +func (o *HostMapWidgetDefinitionStyle) GetFillMax() string { + if o == nil || o.FillMax == nil { + var ret string + return ret + } + return *o.FillMax +} + +// GetFillMaxOk returns a tuple with the FillMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinitionStyle) GetFillMaxOk() (*string, bool) { + if o == nil || o.FillMax == nil { + return nil, false + } + return o.FillMax, true +} + +// HasFillMax returns a boolean if a field has been set. +func (o *HostMapWidgetDefinitionStyle) HasFillMax() bool { + if o != nil && o.FillMax != nil { + return true + } + + return false +} + +// SetFillMax gets a reference to the given string and assigns it to the FillMax field. +func (o *HostMapWidgetDefinitionStyle) SetFillMax(v string) { + o.FillMax = &v +} + +// GetFillMin returns the FillMin field value if set, zero value otherwise. +func (o *HostMapWidgetDefinitionStyle) GetFillMin() string { + if o == nil || o.FillMin == nil { + var ret string + return ret + } + return *o.FillMin +} + +// GetFillMinOk returns a tuple with the FillMin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinitionStyle) GetFillMinOk() (*string, bool) { + if o == nil || o.FillMin == nil { + return nil, false + } + return o.FillMin, true +} + +// HasFillMin returns a boolean if a field has been set. +func (o *HostMapWidgetDefinitionStyle) HasFillMin() bool { + if o != nil && o.FillMin != nil { + return true + } + + return false +} + +// SetFillMin gets a reference to the given string and assigns it to the FillMin field. +func (o *HostMapWidgetDefinitionStyle) SetFillMin(v string) { + o.FillMin = &v +} + +// GetPalette returns the Palette field value if set, zero value otherwise. +func (o *HostMapWidgetDefinitionStyle) GetPalette() string { + if o == nil || o.Palette == nil { + var ret string + return ret + } + return *o.Palette +} + +// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinitionStyle) GetPaletteOk() (*string, bool) { + if o == nil || o.Palette == nil { + return nil, false + } + return o.Palette, true +} + +// HasPalette returns a boolean if a field has been set. +func (o *HostMapWidgetDefinitionStyle) HasPalette() bool { + if o != nil && o.Palette != nil { + return true + } + + return false +} + +// SetPalette gets a reference to the given string and assigns it to the Palette field. +func (o *HostMapWidgetDefinitionStyle) SetPalette(v string) { + o.Palette = &v +} + +// GetPaletteFlip returns the PaletteFlip field value if set, zero value otherwise. +func (o *HostMapWidgetDefinitionStyle) GetPaletteFlip() bool { + if o == nil || o.PaletteFlip == nil { + var ret bool + return ret + } + return *o.PaletteFlip +} + +// GetPaletteFlipOk returns a tuple with the PaletteFlip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMapWidgetDefinitionStyle) GetPaletteFlipOk() (*bool, bool) { + if o == nil || o.PaletteFlip == nil { + return nil, false + } + return o.PaletteFlip, true +} + +// HasPaletteFlip returns a boolean if a field has been set. +func (o *HostMapWidgetDefinitionStyle) HasPaletteFlip() bool { + if o != nil && o.PaletteFlip != nil { + return true + } + + return false +} + +// SetPaletteFlip gets a reference to the given bool and assigns it to the PaletteFlip field. +func (o *HostMapWidgetDefinitionStyle) SetPaletteFlip(v bool) { + o.PaletteFlip = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMapWidgetDefinitionStyle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.FillMax != nil { + toSerialize["fill_max"] = o.FillMax + } + if o.FillMin != nil { + toSerialize["fill_min"] = o.FillMin + } + if o.Palette != nil { + toSerialize["palette"] = o.Palette + } + if o.PaletteFlip != nil { + toSerialize["palette_flip"] = o.PaletteFlip + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + FillMax *string `json:"fill_max,omitempty"` + FillMin *string `json:"fill_min,omitempty"` + Palette *string `json:"palette,omitempty"` + PaletteFlip *bool `json:"palette_flip,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.FillMax = all.FillMax + o.FillMin = all.FillMin + o.Palette = all.Palette + o.PaletteFlip = all.PaletteFlip + return nil +} diff --git a/api/v1/datadog/model_host_map_widget_definition_type.go b/api/v1/datadog/model_host_map_widget_definition_type.go new file mode 100644 index 00000000000..16e9b86274c --- /dev/null +++ b/api/v1/datadog/model_host_map_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HostMapWidgetDefinitionType Type of the host map widget. +type HostMapWidgetDefinitionType string + +// List of HostMapWidgetDefinitionType. +const ( + HOSTMAPWIDGETDEFINITIONTYPE_HOSTMAP HostMapWidgetDefinitionType = "hostmap" +) + +var allowedHostMapWidgetDefinitionTypeEnumValues = []HostMapWidgetDefinitionType{ + HOSTMAPWIDGETDEFINITIONTYPE_HOSTMAP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *HostMapWidgetDefinitionType) GetAllowedValues() []HostMapWidgetDefinitionType { + return allowedHostMapWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *HostMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = HostMapWidgetDefinitionType(value) + return nil +} + +// NewHostMapWidgetDefinitionTypeFromValue returns a pointer to a valid HostMapWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewHostMapWidgetDefinitionTypeFromValue(v string) (*HostMapWidgetDefinitionType, error) { + ev := HostMapWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for HostMapWidgetDefinitionType: valid values are %v", v, allowedHostMapWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v HostMapWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedHostMapWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to HostMapWidgetDefinitionType value. +func (v HostMapWidgetDefinitionType) Ptr() *HostMapWidgetDefinitionType { + return &v +} + +// NullableHostMapWidgetDefinitionType handles when a null is used for HostMapWidgetDefinitionType. +type NullableHostMapWidgetDefinitionType struct { + value *HostMapWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableHostMapWidgetDefinitionType) Get() *HostMapWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableHostMapWidgetDefinitionType) Set(val *HostMapWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableHostMapWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableHostMapWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableHostMapWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableHostMapWidgetDefinitionType(val *HostMapWidgetDefinitionType) *NullableHostMapWidgetDefinitionType { + return &NullableHostMapWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableHostMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableHostMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_host_meta.go b/api/v1/datadog/model_host_meta.go new file mode 100644 index 00000000000..bc5dd55e269 --- /dev/null +++ b/api/v1/datadog/model_host_meta.go @@ -0,0 +1,655 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMeta Metadata associated with your host. +type HostMeta struct { + // A list of Agent checks running on the host. + AgentChecks [][]interface{} `json:"agent_checks,omitempty"` + // The Datadog Agent version. + AgentVersion *string `json:"agent_version,omitempty"` + // The number of cores. + CpuCores *int64 `json:"cpuCores,omitempty"` + // An array of Mac versions. + FbsdV []string `json:"fbsdV,omitempty"` + // JSON string containing system information. + Gohai *string `json:"gohai,omitempty"` + // Agent install method. + InstallMethod *HostMetaInstallMethod `json:"install_method,omitempty"` + // An array of Mac versions. + MacV []string `json:"macV,omitempty"` + // The machine architecture. + Machine *string `json:"machine,omitempty"` + // Array of Unix versions. + NixV []string `json:"nixV,omitempty"` + // The OS platform. + Platform *string `json:"platform,omitempty"` + // The processor. + Processor *string `json:"processor,omitempty"` + // The Python version. + PythonV *string `json:"pythonV,omitempty"` + // The socket fqdn. + SocketFqdn *string `json:"socket-fqdn,omitempty"` + // The socket hostname. + SocketHostname *string `json:"socket-hostname,omitempty"` + // An array of Windows versions. + WinV []string `json:"winV,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{} +} + +// NewHostMeta instantiates a new HostMeta 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 NewHostMeta() *HostMeta { + this := HostMeta{} + return &this +} + +// NewHostMetaWithDefaults instantiates a new HostMeta 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 NewHostMetaWithDefaults() *HostMeta { + this := HostMeta{} + return &this +} + +// GetAgentChecks returns the AgentChecks field value if set, zero value otherwise. +func (o *HostMeta) GetAgentChecks() [][]interface{} { + if o == nil || o.AgentChecks == nil { + var ret [][]interface{} + return ret + } + return o.AgentChecks +} + +// GetAgentChecksOk returns a tuple with the AgentChecks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetAgentChecksOk() (*[][]interface{}, bool) { + if o == nil || o.AgentChecks == nil { + return nil, false + } + return &o.AgentChecks, true +} + +// HasAgentChecks returns a boolean if a field has been set. +func (o *HostMeta) HasAgentChecks() bool { + if o != nil && o.AgentChecks != nil { + return true + } + + return false +} + +// SetAgentChecks gets a reference to the given [][]interface{} and assigns it to the AgentChecks field. +func (o *HostMeta) SetAgentChecks(v [][]interface{}) { + o.AgentChecks = v +} + +// GetAgentVersion returns the AgentVersion field value if set, zero value otherwise. +func (o *HostMeta) GetAgentVersion() string { + if o == nil || o.AgentVersion == nil { + var ret string + return ret + } + return *o.AgentVersion +} + +// GetAgentVersionOk returns a tuple with the AgentVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetAgentVersionOk() (*string, bool) { + if o == nil || o.AgentVersion == nil { + return nil, false + } + return o.AgentVersion, true +} + +// HasAgentVersion returns a boolean if a field has been set. +func (o *HostMeta) HasAgentVersion() bool { + if o != nil && o.AgentVersion != nil { + return true + } + + return false +} + +// SetAgentVersion gets a reference to the given string and assigns it to the AgentVersion field. +func (o *HostMeta) SetAgentVersion(v string) { + o.AgentVersion = &v +} + +// GetCpuCores returns the CpuCores field value if set, zero value otherwise. +func (o *HostMeta) GetCpuCores() int64 { + if o == nil || o.CpuCores == nil { + var ret int64 + return ret + } + return *o.CpuCores +} + +// GetCpuCoresOk returns a tuple with the CpuCores field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetCpuCoresOk() (*int64, bool) { + if o == nil || o.CpuCores == nil { + return nil, false + } + return o.CpuCores, true +} + +// HasCpuCores returns a boolean if a field has been set. +func (o *HostMeta) HasCpuCores() bool { + if o != nil && o.CpuCores != nil { + return true + } + + return false +} + +// SetCpuCores gets a reference to the given int64 and assigns it to the CpuCores field. +func (o *HostMeta) SetCpuCores(v int64) { + o.CpuCores = &v +} + +// GetFbsdV returns the FbsdV field value if set, zero value otherwise. +func (o *HostMeta) GetFbsdV() []string { + if o == nil || o.FbsdV == nil { + var ret []string + return ret + } + return o.FbsdV +} + +// GetFbsdVOk returns a tuple with the FbsdV field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetFbsdVOk() (*[]string, bool) { + if o == nil || o.FbsdV == nil { + return nil, false + } + return &o.FbsdV, true +} + +// HasFbsdV returns a boolean if a field has been set. +func (o *HostMeta) HasFbsdV() bool { + if o != nil && o.FbsdV != nil { + return true + } + + return false +} + +// SetFbsdV gets a reference to the given []string and assigns it to the FbsdV field. +func (o *HostMeta) SetFbsdV(v []string) { + o.FbsdV = v +} + +// GetGohai returns the Gohai field value if set, zero value otherwise. +func (o *HostMeta) GetGohai() string { + if o == nil || o.Gohai == nil { + var ret string + return ret + } + return *o.Gohai +} + +// GetGohaiOk returns a tuple with the Gohai field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetGohaiOk() (*string, bool) { + if o == nil || o.Gohai == nil { + return nil, false + } + return o.Gohai, true +} + +// HasGohai returns a boolean if a field has been set. +func (o *HostMeta) HasGohai() bool { + if o != nil && o.Gohai != nil { + return true + } + + return false +} + +// SetGohai gets a reference to the given string and assigns it to the Gohai field. +func (o *HostMeta) SetGohai(v string) { + o.Gohai = &v +} + +// GetInstallMethod returns the InstallMethod field value if set, zero value otherwise. +func (o *HostMeta) GetInstallMethod() HostMetaInstallMethod { + if o == nil || o.InstallMethod == nil { + var ret HostMetaInstallMethod + return ret + } + return *o.InstallMethod +} + +// GetInstallMethodOk returns a tuple with the InstallMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetInstallMethodOk() (*HostMetaInstallMethod, bool) { + if o == nil || o.InstallMethod == nil { + return nil, false + } + return o.InstallMethod, true +} + +// HasInstallMethod returns a boolean if a field has been set. +func (o *HostMeta) HasInstallMethod() bool { + if o != nil && o.InstallMethod != nil { + return true + } + + return false +} + +// SetInstallMethod gets a reference to the given HostMetaInstallMethod and assigns it to the InstallMethod field. +func (o *HostMeta) SetInstallMethod(v HostMetaInstallMethod) { + o.InstallMethod = &v +} + +// GetMacV returns the MacV field value if set, zero value otherwise. +func (o *HostMeta) GetMacV() []string { + if o == nil || o.MacV == nil { + var ret []string + return ret + } + return o.MacV +} + +// GetMacVOk returns a tuple with the MacV field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetMacVOk() (*[]string, bool) { + if o == nil || o.MacV == nil { + return nil, false + } + return &o.MacV, true +} + +// HasMacV returns a boolean if a field has been set. +func (o *HostMeta) HasMacV() bool { + if o != nil && o.MacV != nil { + return true + } + + return false +} + +// SetMacV gets a reference to the given []string and assigns it to the MacV field. +func (o *HostMeta) SetMacV(v []string) { + o.MacV = v +} + +// GetMachine returns the Machine field value if set, zero value otherwise. +func (o *HostMeta) GetMachine() string { + if o == nil || o.Machine == nil { + var ret string + return ret + } + return *o.Machine +} + +// GetMachineOk returns a tuple with the Machine field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetMachineOk() (*string, bool) { + if o == nil || o.Machine == nil { + return nil, false + } + return o.Machine, true +} + +// HasMachine returns a boolean if a field has been set. +func (o *HostMeta) HasMachine() bool { + if o != nil && o.Machine != nil { + return true + } + + return false +} + +// SetMachine gets a reference to the given string and assigns it to the Machine field. +func (o *HostMeta) SetMachine(v string) { + o.Machine = &v +} + +// GetNixV returns the NixV field value if set, zero value otherwise. +func (o *HostMeta) GetNixV() []string { + if o == nil || o.NixV == nil { + var ret []string + return ret + } + return o.NixV +} + +// GetNixVOk returns a tuple with the NixV field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetNixVOk() (*[]string, bool) { + if o == nil || o.NixV == nil { + return nil, false + } + return &o.NixV, true +} + +// HasNixV returns a boolean if a field has been set. +func (o *HostMeta) HasNixV() bool { + if o != nil && o.NixV != nil { + return true + } + + return false +} + +// SetNixV gets a reference to the given []string and assigns it to the NixV field. +func (o *HostMeta) SetNixV(v []string) { + o.NixV = v +} + +// GetPlatform returns the Platform field value if set, zero value otherwise. +func (o *HostMeta) GetPlatform() string { + if o == nil || o.Platform == nil { + var ret string + return ret + } + return *o.Platform +} + +// GetPlatformOk returns a tuple with the Platform field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetPlatformOk() (*string, bool) { + if o == nil || o.Platform == nil { + return nil, false + } + return o.Platform, true +} + +// HasPlatform returns a boolean if a field has been set. +func (o *HostMeta) HasPlatform() bool { + if o != nil && o.Platform != nil { + return true + } + + return false +} + +// SetPlatform gets a reference to the given string and assigns it to the Platform field. +func (o *HostMeta) SetPlatform(v string) { + o.Platform = &v +} + +// GetProcessor returns the Processor field value if set, zero value otherwise. +func (o *HostMeta) GetProcessor() string { + if o == nil || o.Processor == nil { + var ret string + return ret + } + return *o.Processor +} + +// GetProcessorOk returns a tuple with the Processor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetProcessorOk() (*string, bool) { + if o == nil || o.Processor == nil { + return nil, false + } + return o.Processor, true +} + +// HasProcessor returns a boolean if a field has been set. +func (o *HostMeta) HasProcessor() bool { + if o != nil && o.Processor != nil { + return true + } + + return false +} + +// SetProcessor gets a reference to the given string and assigns it to the Processor field. +func (o *HostMeta) SetProcessor(v string) { + o.Processor = &v +} + +// GetPythonV returns the PythonV field value if set, zero value otherwise. +func (o *HostMeta) GetPythonV() string { + if o == nil || o.PythonV == nil { + var ret string + return ret + } + return *o.PythonV +} + +// GetPythonVOk returns a tuple with the PythonV field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetPythonVOk() (*string, bool) { + if o == nil || o.PythonV == nil { + return nil, false + } + return o.PythonV, true +} + +// HasPythonV returns a boolean if a field has been set. +func (o *HostMeta) HasPythonV() bool { + if o != nil && o.PythonV != nil { + return true + } + + return false +} + +// SetPythonV gets a reference to the given string and assigns it to the PythonV field. +func (o *HostMeta) SetPythonV(v string) { + o.PythonV = &v +} + +// GetSocketFqdn returns the SocketFqdn field value if set, zero value otherwise. +func (o *HostMeta) GetSocketFqdn() string { + if o == nil || o.SocketFqdn == nil { + var ret string + return ret + } + return *o.SocketFqdn +} + +// GetSocketFqdnOk returns a tuple with the SocketFqdn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetSocketFqdnOk() (*string, bool) { + if o == nil || o.SocketFqdn == nil { + return nil, false + } + return o.SocketFqdn, true +} + +// HasSocketFqdn returns a boolean if a field has been set. +func (o *HostMeta) HasSocketFqdn() bool { + if o != nil && o.SocketFqdn != nil { + return true + } + + return false +} + +// SetSocketFqdn gets a reference to the given string and assigns it to the SocketFqdn field. +func (o *HostMeta) SetSocketFqdn(v string) { + o.SocketFqdn = &v +} + +// GetSocketHostname returns the SocketHostname field value if set, zero value otherwise. +func (o *HostMeta) GetSocketHostname() string { + if o == nil || o.SocketHostname == nil { + var ret string + return ret + } + return *o.SocketHostname +} + +// GetSocketHostnameOk returns a tuple with the SocketHostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetSocketHostnameOk() (*string, bool) { + if o == nil || o.SocketHostname == nil { + return nil, false + } + return o.SocketHostname, true +} + +// HasSocketHostname returns a boolean if a field has been set. +func (o *HostMeta) HasSocketHostname() bool { + if o != nil && o.SocketHostname != nil { + return true + } + + return false +} + +// SetSocketHostname gets a reference to the given string and assigns it to the SocketHostname field. +func (o *HostMeta) SetSocketHostname(v string) { + o.SocketHostname = &v +} + +// GetWinV returns the WinV field value if set, zero value otherwise. +func (o *HostMeta) GetWinV() []string { + if o == nil || o.WinV == nil { + var ret []string + return ret + } + return o.WinV +} + +// GetWinVOk returns a tuple with the WinV field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMeta) GetWinVOk() (*[]string, bool) { + if o == nil || o.WinV == nil { + return nil, false + } + return &o.WinV, true +} + +// HasWinV returns a boolean if a field has been set. +func (o *HostMeta) HasWinV() bool { + if o != nil && o.WinV != nil { + return true + } + + return false +} + +// SetWinV gets a reference to the given []string and assigns it to the WinV field. +func (o *HostMeta) SetWinV(v []string) { + o.WinV = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AgentChecks != nil { + toSerialize["agent_checks"] = o.AgentChecks + } + if o.AgentVersion != nil { + toSerialize["agent_version"] = o.AgentVersion + } + if o.CpuCores != nil { + toSerialize["cpuCores"] = o.CpuCores + } + if o.FbsdV != nil { + toSerialize["fbsdV"] = o.FbsdV + } + if o.Gohai != nil { + toSerialize["gohai"] = o.Gohai + } + if o.InstallMethod != nil { + toSerialize["install_method"] = o.InstallMethod + } + if o.MacV != nil { + toSerialize["macV"] = o.MacV + } + if o.Machine != nil { + toSerialize["machine"] = o.Machine + } + if o.NixV != nil { + toSerialize["nixV"] = o.NixV + } + if o.Platform != nil { + toSerialize["platform"] = o.Platform + } + if o.Processor != nil { + toSerialize["processor"] = o.Processor + } + if o.PythonV != nil { + toSerialize["pythonV"] = o.PythonV + } + if o.SocketFqdn != nil { + toSerialize["socket-fqdn"] = o.SocketFqdn + } + if o.SocketHostname != nil { + toSerialize["socket-hostname"] = o.SocketHostname + } + if o.WinV != nil { + toSerialize["winV"] = o.WinV + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AgentChecks [][]interface{} `json:"agent_checks,omitempty"` + AgentVersion *string `json:"agent_version,omitempty"` + CpuCores *int64 `json:"cpuCores,omitempty"` + FbsdV []string `json:"fbsdV,omitempty"` + Gohai *string `json:"gohai,omitempty"` + InstallMethod *HostMetaInstallMethod `json:"install_method,omitempty"` + MacV []string `json:"macV,omitempty"` + Machine *string `json:"machine,omitempty"` + NixV []string `json:"nixV,omitempty"` + Platform *string `json:"platform,omitempty"` + Processor *string `json:"processor,omitempty"` + PythonV *string `json:"pythonV,omitempty"` + SocketFqdn *string `json:"socket-fqdn,omitempty"` + SocketHostname *string `json:"socket-hostname,omitempty"` + WinV []string `json:"winV,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AgentChecks = all.AgentChecks + o.AgentVersion = all.AgentVersion + o.CpuCores = all.CpuCores + o.FbsdV = all.FbsdV + o.Gohai = all.Gohai + if all.InstallMethod != nil && all.InstallMethod.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.InstallMethod = all.InstallMethod + o.MacV = all.MacV + o.Machine = all.Machine + o.NixV = all.NixV + o.Platform = all.Platform + o.Processor = all.Processor + o.PythonV = all.PythonV + o.SocketFqdn = all.SocketFqdn + o.SocketHostname = all.SocketHostname + o.WinV = all.WinV + return nil +} diff --git a/api/v1/datadog/model_host_meta_install_method.go b/api/v1/datadog/model_host_meta_install_method.go new file mode 100644 index 00000000000..a21034320a8 --- /dev/null +++ b/api/v1/datadog/model_host_meta_install_method.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMetaInstallMethod Agent install method. +type HostMetaInstallMethod struct { + // The installer version. + InstallerVersion *string `json:"installer_version,omitempty"` + // Tool used to install the agent. + Tool *string `json:"tool,omitempty"` + // The tool version. + ToolVersion *string `json:"tool_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{} +} + +// NewHostMetaInstallMethod instantiates a new HostMetaInstallMethod 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 NewHostMetaInstallMethod() *HostMetaInstallMethod { + this := HostMetaInstallMethod{} + return &this +} + +// NewHostMetaInstallMethodWithDefaults instantiates a new HostMetaInstallMethod 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 NewHostMetaInstallMethodWithDefaults() *HostMetaInstallMethod { + this := HostMetaInstallMethod{} + return &this +} + +// GetInstallerVersion returns the InstallerVersion field value if set, zero value otherwise. +func (o *HostMetaInstallMethod) GetInstallerVersion() string { + if o == nil || o.InstallerVersion == nil { + var ret string + return ret + } + return *o.InstallerVersion +} + +// GetInstallerVersionOk returns a tuple with the InstallerVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMetaInstallMethod) GetInstallerVersionOk() (*string, bool) { + if o == nil || o.InstallerVersion == nil { + return nil, false + } + return o.InstallerVersion, true +} + +// HasInstallerVersion returns a boolean if a field has been set. +func (o *HostMetaInstallMethod) HasInstallerVersion() bool { + if o != nil && o.InstallerVersion != nil { + return true + } + + return false +} + +// SetInstallerVersion gets a reference to the given string and assigns it to the InstallerVersion field. +func (o *HostMetaInstallMethod) SetInstallerVersion(v string) { + o.InstallerVersion = &v +} + +// GetTool returns the Tool field value if set, zero value otherwise. +func (o *HostMetaInstallMethod) GetTool() string { + if o == nil || o.Tool == nil { + var ret string + return ret + } + return *o.Tool +} + +// GetToolOk returns a tuple with the Tool field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMetaInstallMethod) GetToolOk() (*string, bool) { + if o == nil || o.Tool == nil { + return nil, false + } + return o.Tool, true +} + +// HasTool returns a boolean if a field has been set. +func (o *HostMetaInstallMethod) HasTool() bool { + if o != nil && o.Tool != nil { + return true + } + + return false +} + +// SetTool gets a reference to the given string and assigns it to the Tool field. +func (o *HostMetaInstallMethod) SetTool(v string) { + o.Tool = &v +} + +// GetToolVersion returns the ToolVersion field value if set, zero value otherwise. +func (o *HostMetaInstallMethod) GetToolVersion() string { + if o == nil || o.ToolVersion == nil { + var ret string + return ret + } + return *o.ToolVersion +} + +// GetToolVersionOk returns a tuple with the ToolVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMetaInstallMethod) GetToolVersionOk() (*string, bool) { + if o == nil || o.ToolVersion == nil { + return nil, false + } + return o.ToolVersion, true +} + +// HasToolVersion returns a boolean if a field has been set. +func (o *HostMetaInstallMethod) HasToolVersion() bool { + if o != nil && o.ToolVersion != nil { + return true + } + + return false +} + +// SetToolVersion gets a reference to the given string and assigns it to the ToolVersion field. +func (o *HostMetaInstallMethod) SetToolVersion(v string) { + o.ToolVersion = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMetaInstallMethod) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.InstallerVersion != nil { + toSerialize["installer_version"] = o.InstallerVersion + } + if o.Tool != nil { + toSerialize["tool"] = o.Tool + } + if o.ToolVersion != nil { + toSerialize["tool_version"] = o.ToolVersion + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMetaInstallMethod) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + InstallerVersion *string `json:"installer_version,omitempty"` + Tool *string `json:"tool,omitempty"` + ToolVersion *string `json:"tool_version,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.InstallerVersion = all.InstallerVersion + o.Tool = all.Tool + o.ToolVersion = all.ToolVersion + return nil +} diff --git a/api/v1/datadog/model_host_metrics.go b/api/v1/datadog/model_host_metrics.go new file mode 100644 index 00000000000..46298cd7230 --- /dev/null +++ b/api/v1/datadog/model_host_metrics.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMetrics Host Metrics collected. +type HostMetrics struct { + // The percent of CPU used (everything but idle). + Cpu *float64 `json:"cpu,omitempty"` + // The percent of CPU spent waiting on the IO (not reported for all platforms). + Iowait *float64 `json:"iowait,omitempty"` + // The system load over the last 15 minutes. + Load *float64 `json:"load,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{} +} + +// NewHostMetrics instantiates a new HostMetrics 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 NewHostMetrics() *HostMetrics { + this := HostMetrics{} + return &this +} + +// NewHostMetricsWithDefaults instantiates a new HostMetrics 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 NewHostMetricsWithDefaults() *HostMetrics { + this := HostMetrics{} + return &this +} + +// GetCpu returns the Cpu field value if set, zero value otherwise. +func (o *HostMetrics) GetCpu() float64 { + if o == nil || o.Cpu == nil { + var ret float64 + return ret + } + return *o.Cpu +} + +// GetCpuOk returns a tuple with the Cpu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMetrics) GetCpuOk() (*float64, bool) { + if o == nil || o.Cpu == nil { + return nil, false + } + return o.Cpu, true +} + +// HasCpu returns a boolean if a field has been set. +func (o *HostMetrics) HasCpu() bool { + if o != nil && o.Cpu != nil { + return true + } + + return false +} + +// SetCpu gets a reference to the given float64 and assigns it to the Cpu field. +func (o *HostMetrics) SetCpu(v float64) { + o.Cpu = &v +} + +// GetIowait returns the Iowait field value if set, zero value otherwise. +func (o *HostMetrics) GetIowait() float64 { + if o == nil || o.Iowait == nil { + var ret float64 + return ret + } + return *o.Iowait +} + +// GetIowaitOk returns a tuple with the Iowait field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMetrics) GetIowaitOk() (*float64, bool) { + if o == nil || o.Iowait == nil { + return nil, false + } + return o.Iowait, true +} + +// HasIowait returns a boolean if a field has been set. +func (o *HostMetrics) HasIowait() bool { + if o != nil && o.Iowait != nil { + return true + } + + return false +} + +// SetIowait gets a reference to the given float64 and assigns it to the Iowait field. +func (o *HostMetrics) SetIowait(v float64) { + o.Iowait = &v +} + +// GetLoad returns the Load field value if set, zero value otherwise. +func (o *HostMetrics) GetLoad() float64 { + if o == nil || o.Load == nil { + var ret float64 + return ret + } + return *o.Load +} + +// GetLoadOk returns a tuple with the Load field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMetrics) GetLoadOk() (*float64, bool) { + if o == nil || o.Load == nil { + return nil, false + } + return o.Load, true +} + +// HasLoad returns a boolean if a field has been set. +func (o *HostMetrics) HasLoad() bool { + if o != nil && o.Load != nil { + return true + } + + return false +} + +// SetLoad gets a reference to the given float64 and assigns it to the Load field. +func (o *HostMetrics) SetLoad(v float64) { + o.Load = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMetrics) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cpu != nil { + toSerialize["cpu"] = o.Cpu + } + if o.Iowait != nil { + toSerialize["iowait"] = o.Iowait + } + if o.Load != nil { + toSerialize["load"] = o.Load + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMetrics) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cpu *float64 `json:"cpu,omitempty"` + Iowait *float64 `json:"iowait,omitempty"` + Load *float64 `json:"load,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cpu = all.Cpu + o.Iowait = all.Iowait + o.Load = all.Load + return nil +} diff --git a/api/v1/datadog/model_host_mute_response.go b/api/v1/datadog/model_host_mute_response.go new file mode 100644 index 00000000000..f8d2f84af7a --- /dev/null +++ b/api/v1/datadog/model_host_mute_response.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMuteResponse Response with the list of muted host for your organization. +type HostMuteResponse struct { + // Action applied to the hosts. + Action *string `json:"action,omitempty"` + // POSIX timestamp in seconds when the host is unmuted. + End *int64 `json:"end,omitempty"` + // The host name. + Hostname *string `json:"hostname,omitempty"` + // Message associated with the mute. + Message *string `json:"message,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{} +} + +// NewHostMuteResponse instantiates a new HostMuteResponse 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 NewHostMuteResponse() *HostMuteResponse { + this := HostMuteResponse{} + return &this +} + +// NewHostMuteResponseWithDefaults instantiates a new HostMuteResponse 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 NewHostMuteResponseWithDefaults() *HostMuteResponse { + this := HostMuteResponse{} + return &this +} + +// GetAction returns the Action field value if set, zero value otherwise. +func (o *HostMuteResponse) GetAction() string { + if o == nil || o.Action == nil { + var ret string + return ret + } + return *o.Action +} + +// GetActionOk returns a tuple with the Action field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMuteResponse) GetActionOk() (*string, bool) { + if o == nil || o.Action == nil { + return nil, false + } + return o.Action, true +} + +// HasAction returns a boolean if a field has been set. +func (o *HostMuteResponse) HasAction() bool { + if o != nil && o.Action != nil { + return true + } + + return false +} + +// SetAction gets a reference to the given string and assigns it to the Action field. +func (o *HostMuteResponse) SetAction(v string) { + o.Action = &v +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *HostMuteResponse) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMuteResponse) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *HostMuteResponse) HasEnd() bool { + if o != nil && o.End != nil { + return true + } + + return false +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *HostMuteResponse) SetEnd(v int64) { + o.End = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *HostMuteResponse) 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 *HostMuteResponse) 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 *HostMuteResponse) HasHostname() bool { + if o != nil && o.Hostname != nil { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *HostMuteResponse) SetHostname(v string) { + o.Hostname = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *HostMuteResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMuteResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *HostMuteResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *HostMuteResponse) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMuteResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Action != nil { + toSerialize["action"] = o.Action + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Hostname != nil { + toSerialize["hostname"] = o.Hostname + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMuteResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Action *string `json:"action,omitempty"` + End *int64 `json:"end,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Message *string `json:"message,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Action = all.Action + o.End = all.End + o.Hostname = all.Hostname + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_host_mute_settings.go b/api/v1/datadog/model_host_mute_settings.go new file mode 100644 index 00000000000..b7a31866438 --- /dev/null +++ b/api/v1/datadog/model_host_mute_settings.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostMuteSettings Combination of settings to mute a host. +type HostMuteSettings struct { + // POSIX timestamp in seconds when the host is unmuted. If omitted, the host remains muted until explicitly unmuted. + End *int64 `json:"end,omitempty"` + // Message to associate with the muting of this host. + Message *string `json:"message,omitempty"` + // If true and the host is already muted, replaces existing host mute settings. + Override *bool `json:"override,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{} +} + +// NewHostMuteSettings instantiates a new HostMuteSettings 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 NewHostMuteSettings() *HostMuteSettings { + this := HostMuteSettings{} + return &this +} + +// NewHostMuteSettingsWithDefaults instantiates a new HostMuteSettings 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 NewHostMuteSettingsWithDefaults() *HostMuteSettings { + this := HostMuteSettings{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *HostMuteSettings) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMuteSettings) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *HostMuteSettings) HasEnd() bool { + if o != nil && o.End != nil { + return true + } + + return false +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *HostMuteSettings) SetEnd(v int64) { + o.End = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *HostMuteSettings) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMuteSettings) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *HostMuteSettings) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *HostMuteSettings) SetMessage(v string) { + o.Message = &v +} + +// GetOverride returns the Override field value if set, zero value otherwise. +func (o *HostMuteSettings) GetOverride() bool { + if o == nil || o.Override == nil { + var ret bool + return ret + } + return *o.Override +} + +// GetOverrideOk returns a tuple with the Override field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostMuteSettings) GetOverrideOk() (*bool, bool) { + if o == nil || o.Override == nil { + return nil, false + } + return o.Override, true +} + +// HasOverride returns a boolean if a field has been set. +func (o *HostMuteSettings) HasOverride() bool { + if o != nil && o.Override != nil { + return true + } + + return false +} + +// SetOverride gets a reference to the given bool and assigns it to the Override field. +func (o *HostMuteSettings) SetOverride(v bool) { + o.Override = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostMuteSettings) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Override != nil { + toSerialize["override"] = o.Override + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostMuteSettings) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + End *int64 `json:"end,omitempty"` + Message *string `json:"message,omitempty"` + Override *bool `json:"override,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.End = all.End + o.Message = all.Message + o.Override = all.Override + return nil +} diff --git a/api/v1/datadog/model_host_tags.go b/api/v1/datadog/model_host_tags.go new file mode 100644 index 00000000000..82f8257b020 --- /dev/null +++ b/api/v1/datadog/model_host_tags.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostTags Set of tags to associate with your host. +type HostTags struct { + // Your host name. + Host *string `json:"host,omitempty"` + // A list of tags to apply to the host. + Tags []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{} +} + +// NewHostTags instantiates a new HostTags 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 NewHostTags() *HostTags { + this := HostTags{} + return &this +} + +// NewHostTagsWithDefaults instantiates a new HostTags 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 NewHostTagsWithDefaults() *HostTags { + this := HostTags{} + return &this +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *HostTags) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostTags) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *HostTags) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *HostTags) SetHost(v string) { + o.Host = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *HostTags) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *HostTags) GetTagsOk() (*[]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 *HostTags) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *HostTags) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostTags) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostTags) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Host *string `json:"host,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Host = all.Host + o.Tags = all.Tags + return nil +} diff --git a/api/v1/datadog/model_host_totals.go b/api/v1/datadog/model_host_totals.go new file mode 100644 index 00000000000..9456bbbebd7 --- /dev/null +++ b/api/v1/datadog/model_host_totals.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HostTotals Total number of host currently monitored by Datadog. +type HostTotals struct { + // Total number of active host (UP and ???) reporting to Datadog. + TotalActive *int64 `json:"total_active,omitempty"` + // Number of host that are UP and reporting to Datadog. + TotalUp *int64 `json:"total_up,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{} +} + +// NewHostTotals instantiates a new HostTotals 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 NewHostTotals() *HostTotals { + this := HostTotals{} + return &this +} + +// NewHostTotalsWithDefaults instantiates a new HostTotals 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 NewHostTotalsWithDefaults() *HostTotals { + this := HostTotals{} + return &this +} + +// GetTotalActive returns the TotalActive field value if set, zero value otherwise. +func (o *HostTotals) GetTotalActive() int64 { + if o == nil || o.TotalActive == nil { + var ret int64 + return ret + } + return *o.TotalActive +} + +// GetTotalActiveOk returns a tuple with the TotalActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostTotals) GetTotalActiveOk() (*int64, bool) { + if o == nil || o.TotalActive == nil { + return nil, false + } + return o.TotalActive, true +} + +// HasTotalActive returns a boolean if a field has been set. +func (o *HostTotals) HasTotalActive() bool { + if o != nil && o.TotalActive != nil { + return true + } + + return false +} + +// SetTotalActive gets a reference to the given int64 and assigns it to the TotalActive field. +func (o *HostTotals) SetTotalActive(v int64) { + o.TotalActive = &v +} + +// GetTotalUp returns the TotalUp field value if set, zero value otherwise. +func (o *HostTotals) GetTotalUp() int64 { + if o == nil || o.TotalUp == nil { + var ret int64 + return ret + } + return *o.TotalUp +} + +// GetTotalUpOk returns a tuple with the TotalUp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostTotals) GetTotalUpOk() (*int64, bool) { + if o == nil || o.TotalUp == nil { + return nil, false + } + return o.TotalUp, true +} + +// HasTotalUp returns a boolean if a field has been set. +func (o *HostTotals) HasTotalUp() bool { + if o != nil && o.TotalUp != nil { + return true + } + + return false +} + +// SetTotalUp gets a reference to the given int64 and assigns it to the TotalUp field. +func (o *HostTotals) SetTotalUp(v int64) { + o.TotalUp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HostTotals) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalActive != nil { + toSerialize["total_active"] = o.TotalActive + } + if o.TotalUp != nil { + toSerialize["total_up"] = o.TotalUp + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HostTotals) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TotalActive *int64 `json:"total_active,omitempty"` + TotalUp *int64 `json:"total_up,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TotalActive = all.TotalActive + o.TotalUp = all.TotalUp + return nil +} diff --git a/api/v1/datadog/model_hourly_usage_attribution_body.go b/api/v1/datadog/model_hourly_usage_attribution_body.go new file mode 100644 index 00000000000..8fa5e64cc5b --- /dev/null +++ b/api/v1/datadog/model_hourly_usage_attribution_body.go @@ -0,0 +1,392 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// HourlyUsageAttributionBody The usage for one set of tags for one hour. +type HourlyUsageAttributionBody struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The name of the organization. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The source of the usage attribution tag configuration and the selected tags in the format of `::://////`. + TagConfigSource *string `json:"tag_config_source,omitempty"` + // Tag keys and values. + // + // A `null` value here means that the requested tag breakdown cannot be applied because it does not match the [tags + // configured for usage attribution](https://docs.datadoghq.com/account_management/billing/usage_attribution/#getting-started). + // In this scenario the API returns the total usage, not broken down by tags. + Tags map[string][]string `json:"tags,omitempty"` + // Total product usage for the given tags within the hour. + TotalUsageSum *float64 `json:"total_usage_sum,omitempty"` + // Shows the most recent hour in the current month for all organizations where usages are calculated. + UpdatedAt *string `json:"updated_at,omitempty"` + // Supported products for hourly usage attribution requests. + UsageType *HourlyUsageAttributionUsageType `json:"usage_type,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{} +} + +// NewHourlyUsageAttributionBody instantiates a new HourlyUsageAttributionBody 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 NewHourlyUsageAttributionBody() *HourlyUsageAttributionBody { + this := HourlyUsageAttributionBody{} + return &this +} + +// NewHourlyUsageAttributionBodyWithDefaults instantiates a new HourlyUsageAttributionBody 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 NewHourlyUsageAttributionBodyWithDefaults() *HourlyUsageAttributionBody { + this := HourlyUsageAttributionBody{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionBody) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *HourlyUsageAttributionBody) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *HourlyUsageAttributionBody) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionBody) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *HourlyUsageAttributionBody) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *HourlyUsageAttributionBody) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionBody) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *HourlyUsageAttributionBody) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *HourlyUsageAttributionBody) SetPublicId(v string) { + o.PublicId = &v +} + +// GetTagConfigSource returns the TagConfigSource field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) GetTagConfigSource() string { + if o == nil || o.TagConfigSource == nil { + var ret string + return ret + } + return *o.TagConfigSource +} + +// GetTagConfigSourceOk returns a tuple with the TagConfigSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionBody) GetTagConfigSourceOk() (*string, bool) { + if o == nil || o.TagConfigSource == nil { + return nil, false + } + return o.TagConfigSource, true +} + +// HasTagConfigSource returns a boolean if a field has been set. +func (o *HourlyUsageAttributionBody) HasTagConfigSource() bool { + if o != nil && o.TagConfigSource != nil { + return true + } + + return false +} + +// SetTagConfigSource gets a reference to the given string and assigns it to the TagConfigSource field. +func (o *HourlyUsageAttributionBody) SetTagConfigSource(v string) { + o.TagConfigSource = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) 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 *HourlyUsageAttributionBody) 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 *HourlyUsageAttributionBody) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. +func (o *HourlyUsageAttributionBody) SetTags(v map[string][]string) { + o.Tags = v +} + +// GetTotalUsageSum returns the TotalUsageSum field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) GetTotalUsageSum() float64 { + if o == nil || o.TotalUsageSum == nil { + var ret float64 + return ret + } + return *o.TotalUsageSum +} + +// GetTotalUsageSumOk returns a tuple with the TotalUsageSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionBody) GetTotalUsageSumOk() (*float64, bool) { + if o == nil || o.TotalUsageSum == nil { + return nil, false + } + return o.TotalUsageSum, true +} + +// HasTotalUsageSum returns a boolean if a field has been set. +func (o *HourlyUsageAttributionBody) HasTotalUsageSum() bool { + if o != nil && o.TotalUsageSum != nil { + return true + } + + return false +} + +// SetTotalUsageSum gets a reference to the given float64 and assigns it to the TotalUsageSum field. +func (o *HourlyUsageAttributionBody) SetTotalUsageSum(v float64) { + o.TotalUsageSum = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) GetUpdatedAt() string { + if o == nil || o.UpdatedAt == nil { + var ret string + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionBody) GetUpdatedAtOk() (*string, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *HourlyUsageAttributionBody) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. +func (o *HourlyUsageAttributionBody) SetUpdatedAt(v string) { + o.UpdatedAt = &v +} + +// GetUsageType returns the UsageType field value if set, zero value otherwise. +func (o *HourlyUsageAttributionBody) GetUsageType() HourlyUsageAttributionUsageType { + if o == nil || o.UsageType == nil { + var ret HourlyUsageAttributionUsageType + return ret + } + return *o.UsageType +} + +// GetUsageTypeOk returns a tuple with the UsageType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionBody) GetUsageTypeOk() (*HourlyUsageAttributionUsageType, bool) { + if o == nil || o.UsageType == nil { + return nil, false + } + return o.UsageType, true +} + +// HasUsageType returns a boolean if a field has been set. +func (o *HourlyUsageAttributionBody) HasUsageType() bool { + if o != nil && o.UsageType != nil { + return true + } + + return false +} + +// SetUsageType gets a reference to the given HourlyUsageAttributionUsageType and assigns it to the UsageType field. +func (o *HourlyUsageAttributionBody) SetUsageType(v HourlyUsageAttributionUsageType) { + o.UsageType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageAttributionBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.TagConfigSource != nil { + toSerialize["tag_config_source"] = o.TagConfigSource + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.TotalUsageSum != nil { + toSerialize["total_usage_sum"] = o.TotalUsageSum + } + if o.UpdatedAt != nil { + toSerialize["updated_at"] = o.UpdatedAt + } + if o.UsageType != nil { + toSerialize["usage_type"] = o.UsageType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + TagConfigSource *string `json:"tag_config_source,omitempty"` + Tags map[string][]string `json:"tags,omitempty"` + TotalUsageSum *float64 `json:"total_usage_sum,omitempty"` + UpdatedAt *string `json:"updated_at,omitempty"` + UsageType *HourlyUsageAttributionUsageType `json:"usage_type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.UsageType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.TagConfigSource = all.TagConfigSource + o.Tags = all.Tags + o.TotalUsageSum = all.TotalUsageSum + o.UpdatedAt = all.UpdatedAt + o.UsageType = all.UsageType + return nil +} diff --git a/api/v1/datadog/model_hourly_usage_attribution_metadata.go b/api/v1/datadog/model_hourly_usage_attribution_metadata.go new file mode 100644 index 00000000000..ab886292bf0 --- /dev/null +++ b/api/v1/datadog/model_hourly_usage_attribution_metadata.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HourlyUsageAttributionMetadata The object containing document metadata. +type HourlyUsageAttributionMetadata struct { + // The metadata for the current pagination. + Pagination *HourlyUsageAttributionPagination `json:"pagination,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{} +} + +// NewHourlyUsageAttributionMetadata instantiates a new HourlyUsageAttributionMetadata 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 NewHourlyUsageAttributionMetadata() *HourlyUsageAttributionMetadata { + this := HourlyUsageAttributionMetadata{} + return &this +} + +// NewHourlyUsageAttributionMetadataWithDefaults instantiates a new HourlyUsageAttributionMetadata 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 NewHourlyUsageAttributionMetadataWithDefaults() *HourlyUsageAttributionMetadata { + this := HourlyUsageAttributionMetadata{} + return &this +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *HourlyUsageAttributionMetadata) GetPagination() HourlyUsageAttributionPagination { + if o == nil || o.Pagination == nil { + var ret HourlyUsageAttributionPagination + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionMetadata) GetPaginationOk() (*HourlyUsageAttributionPagination, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *HourlyUsageAttributionMetadata) HasPagination() bool { + if o != nil && o.Pagination != nil { + return true + } + + return false +} + +// SetPagination gets a reference to the given HourlyUsageAttributionPagination and assigns it to the Pagination field. +func (o *HourlyUsageAttributionMetadata) SetPagination(v HourlyUsageAttributionPagination) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageAttributionMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Pagination *HourlyUsageAttributionPagination `json:"pagination,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pagination = all.Pagination + return nil +} diff --git a/api/v1/datadog/model_hourly_usage_attribution_pagination.go b/api/v1/datadog/model_hourly_usage_attribution_pagination.go new file mode 100644 index 00000000000..38006ad2bcc --- /dev/null +++ b/api/v1/datadog/model_hourly_usage_attribution_pagination.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// HourlyUsageAttributionPagination The metadata for the current pagination. +type HourlyUsageAttributionPagination struct { + // The cursor to get the next results (if any). To make the next request, use the same parameters and add `next_record_id`. + NextRecordId common.NullableString `json:"next_record_id,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{} +} + +// NewHourlyUsageAttributionPagination instantiates a new HourlyUsageAttributionPagination 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 NewHourlyUsageAttributionPagination() *HourlyUsageAttributionPagination { + this := HourlyUsageAttributionPagination{} + return &this +} + +// NewHourlyUsageAttributionPaginationWithDefaults instantiates a new HourlyUsageAttributionPagination 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 NewHourlyUsageAttributionPaginationWithDefaults() *HourlyUsageAttributionPagination { + this := HourlyUsageAttributionPagination{} + return &this +} + +// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *HourlyUsageAttributionPagination) GetNextRecordId() string { + if o == nil || o.NextRecordId.Get() == nil { + var ret string + return ret + } + return *o.NextRecordId.Get() +} + +// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *HourlyUsageAttributionPagination) GetNextRecordIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NextRecordId.Get(), o.NextRecordId.IsSet() +} + +// HasNextRecordId returns a boolean if a field has been set. +func (o *HourlyUsageAttributionPagination) HasNextRecordId() bool { + if o != nil && o.NextRecordId.IsSet() { + return true + } + + return false +} + +// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. +func (o *HourlyUsageAttributionPagination) SetNextRecordId(v string) { + o.NextRecordId.Set(&v) +} + +// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. +func (o *HourlyUsageAttributionPagination) SetNextRecordIdNil() { + o.NextRecordId.Set(nil) +} + +// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. +func (o *HourlyUsageAttributionPagination) UnsetNextRecordId() { + o.NextRecordId.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageAttributionPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.NextRecordId.IsSet() { + toSerialize["next_record_id"] = o.NextRecordId.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + NextRecordId common.NullableString `json:"next_record_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.NextRecordId = all.NextRecordId + return nil +} diff --git a/api/v1/datadog/model_hourly_usage_attribution_response.go b/api/v1/datadog/model_hourly_usage_attribution_response.go new file mode 100644 index 00000000000..3446b5d14b9 --- /dev/null +++ b/api/v1/datadog/model_hourly_usage_attribution_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 datadog + +import ( + "encoding/json" +) + +// HourlyUsageAttributionResponse Response containing the hourly usage attribution by tag(s). +type HourlyUsageAttributionResponse struct { + // The object containing document metadata. + Metadata *HourlyUsageAttributionMetadata `json:"metadata,omitempty"` + // Get the hourly usage attribution by tag(s). + Usage []HourlyUsageAttributionBody `json:"usage,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{} +} + +// NewHourlyUsageAttributionResponse instantiates a new HourlyUsageAttributionResponse 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 NewHourlyUsageAttributionResponse() *HourlyUsageAttributionResponse { + this := HourlyUsageAttributionResponse{} + return &this +} + +// NewHourlyUsageAttributionResponseWithDefaults instantiates a new HourlyUsageAttributionResponse 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 NewHourlyUsageAttributionResponseWithDefaults() *HourlyUsageAttributionResponse { + this := HourlyUsageAttributionResponse{} + return &this +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *HourlyUsageAttributionResponse) GetMetadata() HourlyUsageAttributionMetadata { + if o == nil || o.Metadata == nil { + var ret HourlyUsageAttributionMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionResponse) GetMetadataOk() (*HourlyUsageAttributionMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *HourlyUsageAttributionResponse) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given HourlyUsageAttributionMetadata and assigns it to the Metadata field. +func (o *HourlyUsageAttributionResponse) SetMetadata(v HourlyUsageAttributionMetadata) { + o.Metadata = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *HourlyUsageAttributionResponse) GetUsage() []HourlyUsageAttributionBody { + if o == nil || o.Usage == nil { + var ret []HourlyUsageAttributionBody + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributionResponse) GetUsageOk() (*[]HourlyUsageAttributionBody, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *HourlyUsageAttributionResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []HourlyUsageAttributionBody and assigns it to the Usage field. +func (o *HourlyUsageAttributionResponse) SetUsage(v []HourlyUsageAttributionBody) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageAttributionResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Metadata *HourlyUsageAttributionMetadata `json:"metadata,omitempty"` + Usage []HourlyUsageAttributionBody `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_hourly_usage_attribution_usage_type.go b/api/v1/datadog/model_hourly_usage_attribution_usage_type.go new file mode 100644 index 00000000000..96ef5c85b60 --- /dev/null +++ b/api/v1/datadog/model_hourly_usage_attribution_usage_type.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HourlyUsageAttributionUsageType Supported products for hourly usage attribution requests. +type HourlyUsageAttributionUsageType string + +// List of HourlyUsageAttributionUsageType. +const ( + HOURLYUSAGEATTRIBUTIONUSAGETYPE_API_USAGE HourlyUsageAttributionUsageType = "api_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_HOST_USAGE HourlyUsageAttributionUsageType = "apm_host_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_USAGE HourlyUsageAttributionUsageType = "appsec_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_BROWSER_USAGE HourlyUsageAttributionUsageType = "browser_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_USAGE HourlyUsageAttributionUsageType = "container_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_CONTAINERS_USAGE HourlyUsageAttributionUsageType = "cspm_containers_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_HOSTS_USAGE HourlyUsageAttributionUsageType = "cspm_hosts_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CUSTOM_TIMESERIES_USAGE HourlyUsageAttributionUsageType = "custom_timeseries_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_CONTAINERS_USAGE HourlyUsageAttributionUsageType = "cws_containers_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_HOSTS_USAGE HourlyUsageAttributionUsageType = "cws_hosts_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_HOSTS_USAGE HourlyUsageAttributionUsageType = "dbm_hosts_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_QUERIES_USAGE HourlyUsageAttributionUsageType = "dbm_queries_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_LOGS_USAGE HourlyUsageAttributionUsageType = "estimated_indexed_logs_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_SPANS_USAGE HourlyUsageAttributionUsageType = "estimated_indexed_spans_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INGESTED_SPANS_USAGE HourlyUsageAttributionUsageType = "estimated_ingested_spans_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_FARGATE_USAGE HourlyUsageAttributionUsageType = "fargate_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_FUNCTIONS_USAGE HourlyUsageAttributionUsageType = "functions_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_INDEXED_LOGS_USAGE HourlyUsageAttributionUsageType = "indexed_logs_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_INFRA_HOST_USAGE HourlyUsageAttributionUsageType = "infra_host_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_INVOCATIONS_USAGE HourlyUsageAttributionUsageType = "invocations_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_NPM_HOST_USAGE HourlyUsageAttributionUsageType = "npm_host_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_CONTAINER_USAGE HourlyUsageAttributionUsageType = "profiled_container_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_HOST_USAGE HourlyUsageAttributionUsageType = "profiled_host_usage" + HOURLYUSAGEATTRIBUTIONUSAGETYPE_SNMP_USAGE HourlyUsageAttributionUsageType = "snmp_usage" +) + +var allowedHourlyUsageAttributionUsageTypeEnumValues = []HourlyUsageAttributionUsageType{ + HOURLYUSAGEATTRIBUTIONUSAGETYPE_API_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_APM_HOST_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_APPSEC_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_BROWSER_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CONTAINER_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_CONTAINERS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CSPM_HOSTS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CUSTOM_TIMESERIES_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_CONTAINERS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_CWS_HOSTS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_HOSTS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_DBM_QUERIES_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_LOGS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INDEXED_SPANS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_ESTIMATED_INGESTED_SPANS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_FARGATE_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_FUNCTIONS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_INDEXED_LOGS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_INFRA_HOST_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_INVOCATIONS_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_NPM_HOST_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_CONTAINER_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_PROFILED_HOST_USAGE, + HOURLYUSAGEATTRIBUTIONUSAGETYPE_SNMP_USAGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *HourlyUsageAttributionUsageType) GetAllowedValues() []HourlyUsageAttributionUsageType { + return allowedHourlyUsageAttributionUsageTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *HourlyUsageAttributionUsageType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = HourlyUsageAttributionUsageType(value) + return nil +} + +// NewHourlyUsageAttributionUsageTypeFromValue returns a pointer to a valid HourlyUsageAttributionUsageType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewHourlyUsageAttributionUsageTypeFromValue(v string) (*HourlyUsageAttributionUsageType, error) { + ev := HourlyUsageAttributionUsageType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for HourlyUsageAttributionUsageType: valid values are %v", v, allowedHourlyUsageAttributionUsageTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v HourlyUsageAttributionUsageType) IsValid() bool { + for _, existing := range allowedHourlyUsageAttributionUsageTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to HourlyUsageAttributionUsageType value. +func (v HourlyUsageAttributionUsageType) Ptr() *HourlyUsageAttributionUsageType { + return &v +} + +// NullableHourlyUsageAttributionUsageType handles when a null is used for HourlyUsageAttributionUsageType. +type NullableHourlyUsageAttributionUsageType struct { + value *HourlyUsageAttributionUsageType + isSet bool +} + +// Get returns the associated value. +func (v NullableHourlyUsageAttributionUsageType) Get() *HourlyUsageAttributionUsageType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableHourlyUsageAttributionUsageType) Set(val *HourlyUsageAttributionUsageType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableHourlyUsageAttributionUsageType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableHourlyUsageAttributionUsageType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableHourlyUsageAttributionUsageType initializes the struct as if Set has been called. +func NewNullableHourlyUsageAttributionUsageType(val *HourlyUsageAttributionUsageType) *NullableHourlyUsageAttributionUsageType { + return &NullableHourlyUsageAttributionUsageType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableHourlyUsageAttributionUsageType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableHourlyUsageAttributionUsageType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_http_log_error.go b/api/v1/datadog/model_http_log_error.go new file mode 100644 index 00000000000..f223a1f1c79 --- /dev/null +++ b/api/v1/datadog/model_http_log_error.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HTTPLogError Invalid query performed. +type HTTPLogError struct { + // Error code. + Code int32 `json:"code"` + // Error message. + Message string `json:"message"` + // 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{} +} + +// NewHTTPLogError instantiates a new HTTPLogError 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 NewHTTPLogError(code int32, message string) *HTTPLogError { + this := HTTPLogError{} + this.Code = code + this.Message = message + return &this +} + +// NewHTTPLogErrorWithDefaults instantiates a new HTTPLogError 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 NewHTTPLogErrorWithDefaults() *HTTPLogError { + this := HTTPLogError{} + return &this +} + +// GetCode returns the Code field value. +func (o *HTTPLogError) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *HTTPLogError) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value. +func (o *HTTPLogError) SetCode(v int32) { + o.Code = v +} + +// GetMessage returns the Message field value. +func (o *HTTPLogError) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *HTTPLogError) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *HTTPLogError) SetMessage(v string) { + o.Message = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPLogError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["code"] = o.Code + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Code *int32 `json:"code"` + Message *string `json:"message"` + }{} + all := struct { + Code int32 `json:"code"` + Message string `json:"message"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Code == nil { + return fmt.Errorf("Required field code missing") + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_http_log_item.go b/api/v1/datadog/model_http_log_item.go new file mode 100644 index 00000000000..e0a9b9d7679 --- /dev/null +++ b/api/v1/datadog/model_http_log_item.go @@ -0,0 +1,265 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HTTPLogItem Logs that are sent over HTTP. +type HTTPLogItem struct { + // The integration name associated with your log: the technology from which the log originated. + // When it matches an integration name, Datadog automatically installs the corresponding parsers and facets. + // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). + Ddsource *string `json:"ddsource,omitempty"` + // Tags associated with your logs. + Ddtags *string `json:"ddtags,omitempty"` + // The name of the originating host of the log. + Hostname *string `json:"hostname,omitempty"` + // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) + // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. + // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. + Message string `json:"message"` + // The name of the application or service generating the log events. + // It is used to switch from Logs to APM, so make sure you define the same value when you use both products. + // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). + Service *string `json:"service,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]string +} + +// NewHTTPLogItem instantiates a new HTTPLogItem 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 NewHTTPLogItem(message string) *HTTPLogItem { + this := HTTPLogItem{} + this.Message = message + return &this +} + +// NewHTTPLogItemWithDefaults instantiates a new HTTPLogItem 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 NewHTTPLogItemWithDefaults() *HTTPLogItem { + this := HTTPLogItem{} + return &this +} + +// GetDdsource returns the Ddsource field value if set, zero value otherwise. +func (o *HTTPLogItem) GetDdsource() string { + if o == nil || o.Ddsource == nil { + var ret string + return ret + } + return *o.Ddsource +} + +// GetDdsourceOk returns a tuple with the Ddsource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogItem) GetDdsourceOk() (*string, bool) { + if o == nil || o.Ddsource == nil { + return nil, false + } + return o.Ddsource, true +} + +// HasDdsource returns a boolean if a field has been set. +func (o *HTTPLogItem) HasDdsource() bool { + if o != nil && o.Ddsource != nil { + return true + } + + return false +} + +// SetDdsource gets a reference to the given string and assigns it to the Ddsource field. +func (o *HTTPLogItem) SetDdsource(v string) { + o.Ddsource = &v +} + +// GetDdtags returns the Ddtags field value if set, zero value otherwise. +func (o *HTTPLogItem) GetDdtags() string { + if o == nil || o.Ddtags == nil { + var ret string + return ret + } + return *o.Ddtags +} + +// GetDdtagsOk returns a tuple with the Ddtags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogItem) GetDdtagsOk() (*string, bool) { + if o == nil || o.Ddtags == nil { + return nil, false + } + return o.Ddtags, true +} + +// HasDdtags returns a boolean if a field has been set. +func (o *HTTPLogItem) HasDdtags() bool { + if o != nil && o.Ddtags != nil { + return true + } + + return false +} + +// SetDdtags gets a reference to the given string and assigns it to the Ddtags field. +func (o *HTTPLogItem) SetDdtags(v string) { + o.Ddtags = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasHostname() bool { + if o != nil && o.Hostname != nil { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *HTTPLogItem) SetHostname(v string) { + o.Hostname = &v +} + +// GetMessage returns the Message field value. +func (o *HTTPLogItem) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *HTTPLogItem) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *HTTPLogItem) SetMessage(v string) { + o.Message = v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *HTTPLogItem) SetService(v string) { + o.Service = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPLogItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Ddsource != nil { + toSerialize["ddsource"] = o.Ddsource + } + if o.Ddtags != nil { + toSerialize["ddtags"] = o.Ddtags + } + if o.Hostname != nil { + toSerialize["hostname"] = o.Hostname + } + toSerialize["message"] = o.Message + if o.Service != nil { + toSerialize["service"] = o.Service + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Message *string `json:"message"` + }{} + all := struct { + Ddsource *string `json:"ddsource,omitempty"` + Ddtags *string `json:"ddtags,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Message string `json:"message"` + Service *string `json:"service,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Ddsource = all.Ddsource + o.Ddtags = all.Ddtags + o.Hostname = all.Hostname + o.Message = all.Message + o.Service = all.Service + return nil +} diff --git a/api/v1/datadog/model_http_method.go b/api/v1/datadog/model_http_method.go new file mode 100644 index 00000000000..67c48f4b031 --- /dev/null +++ b/api/v1/datadog/model_http_method.go @@ -0,0 +1,119 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HTTPMethod The HTTP method. +type HTTPMethod string + +// List of HTTPMethod. +const ( + HTTPMETHOD_GET HTTPMethod = "GET" + HTTPMETHOD_POST HTTPMethod = "POST" + HTTPMETHOD_PATCH HTTPMethod = "PATCH" + HTTPMETHOD_PUT HTTPMethod = "PUT" + HTTPMETHOD_DELETE HTTPMethod = "DELETE" + HTTPMETHOD_HEAD HTTPMethod = "HEAD" + HTTPMETHOD_OPTIONS HTTPMethod = "OPTIONS" +) + +var allowedHTTPMethodEnumValues = []HTTPMethod{ + HTTPMETHOD_GET, + HTTPMETHOD_POST, + HTTPMETHOD_PATCH, + HTTPMETHOD_PUT, + HTTPMETHOD_DELETE, + HTTPMETHOD_HEAD, + HTTPMETHOD_OPTIONS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *HTTPMethod) GetAllowedValues() []HTTPMethod { + return allowedHTTPMethodEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *HTTPMethod) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = HTTPMethod(value) + return nil +} + +// NewHTTPMethodFromValue returns a pointer to a valid HTTPMethod +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewHTTPMethodFromValue(v string) (*HTTPMethod, error) { + ev := HTTPMethod(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for HTTPMethod: valid values are %v", v, allowedHTTPMethodEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v HTTPMethod) IsValid() bool { + for _, existing := range allowedHTTPMethodEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to HTTPMethod value. +func (v HTTPMethod) Ptr() *HTTPMethod { + return &v +} + +// NullableHTTPMethod handles when a null is used for HTTPMethod. +type NullableHTTPMethod struct { + value *HTTPMethod + isSet bool +} + +// Get returns the associated value. +func (v NullableHTTPMethod) Get() *HTTPMethod { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableHTTPMethod) Set(val *HTTPMethod) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableHTTPMethod) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableHTTPMethod) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableHTTPMethod initializes the struct as if Set has been called. +func NewNullableHTTPMethod(val *HTTPMethod) *NullableHTTPMethod { + return &NullableHTTPMethod{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableHTTPMethod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableHTTPMethod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_i_frame_widget_definition.go b/api/v1/datadog/model_i_frame_widget_definition.go new file mode 100644 index 00000000000..1cf24743deb --- /dev/null +++ b/api/v1/datadog/model_i_frame_widget_definition.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IFrameWidgetDefinition The iframe widget allows you to embed a portion of any other web page on your dashboard. Only available on FREE layout dashboards. +type IFrameWidgetDefinition struct { + // Type of the iframe widget. + Type IFrameWidgetDefinitionType `json:"type"` + // URL of the iframe. + Url string `json:"url"` + // 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{} +} + +// NewIFrameWidgetDefinition instantiates a new IFrameWidgetDefinition 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 NewIFrameWidgetDefinition(typeVar IFrameWidgetDefinitionType, url string) *IFrameWidgetDefinition { + this := IFrameWidgetDefinition{} + this.Type = typeVar + this.Url = url + return &this +} + +// NewIFrameWidgetDefinitionWithDefaults instantiates a new IFrameWidgetDefinition 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 NewIFrameWidgetDefinitionWithDefaults() *IFrameWidgetDefinition { + this := IFrameWidgetDefinition{} + var typeVar IFrameWidgetDefinitionType = IFRAMEWIDGETDEFINITIONTYPE_IFRAME + this.Type = typeVar + return &this +} + +// GetType returns the Type field value. +func (o *IFrameWidgetDefinition) GetType() IFrameWidgetDefinitionType { + if o == nil { + var ret IFrameWidgetDefinitionType + 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 *IFrameWidgetDefinition) GetTypeOk() (*IFrameWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IFrameWidgetDefinition) SetType(v IFrameWidgetDefinitionType) { + o.Type = v +} + +// GetUrl returns the Url field value. +func (o *IFrameWidgetDefinition) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *IFrameWidgetDefinition) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *IFrameWidgetDefinition) SetUrl(v string) { + o.Url = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IFrameWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["type"] = o.Type + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IFrameWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *IFrameWidgetDefinitionType `json:"type"` + Url *string `json:"url"` + }{} + all := struct { + Type IFrameWidgetDefinitionType `json:"type"` + Url string `json:"url"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + if required.Url == nil { + return fmt.Errorf("Required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_i_frame_widget_definition_type.go b/api/v1/datadog/model_i_frame_widget_definition_type.go new file mode 100644 index 00000000000..2005b4d9e08 --- /dev/null +++ b/api/v1/datadog/model_i_frame_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IFrameWidgetDefinitionType Type of the iframe widget. +type IFrameWidgetDefinitionType string + +// List of IFrameWidgetDefinitionType. +const ( + IFRAMEWIDGETDEFINITIONTYPE_IFRAME IFrameWidgetDefinitionType = "iframe" +) + +var allowedIFrameWidgetDefinitionTypeEnumValues = []IFrameWidgetDefinitionType{ + IFRAMEWIDGETDEFINITIONTYPE_IFRAME, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IFrameWidgetDefinitionType) GetAllowedValues() []IFrameWidgetDefinitionType { + return allowedIFrameWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IFrameWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IFrameWidgetDefinitionType(value) + return nil +} + +// NewIFrameWidgetDefinitionTypeFromValue returns a pointer to a valid IFrameWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIFrameWidgetDefinitionTypeFromValue(v string) (*IFrameWidgetDefinitionType, error) { + ev := IFrameWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IFrameWidgetDefinitionType: valid values are %v", v, allowedIFrameWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IFrameWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedIFrameWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IFrameWidgetDefinitionType value. +func (v IFrameWidgetDefinitionType) Ptr() *IFrameWidgetDefinitionType { + return &v +} + +// NullableIFrameWidgetDefinitionType handles when a null is used for IFrameWidgetDefinitionType. +type NullableIFrameWidgetDefinitionType struct { + value *IFrameWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableIFrameWidgetDefinitionType) Get() *IFrameWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIFrameWidgetDefinitionType) Set(val *IFrameWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIFrameWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIFrameWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIFrameWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableIFrameWidgetDefinitionType(val *IFrameWidgetDefinitionType) *NullableIFrameWidgetDefinitionType { + return &NullableIFrameWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIFrameWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIFrameWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_idp_form_data.go b/api/v1/datadog/model_idp_form_data.go new file mode 100644 index 00000000000..705e01006ba --- /dev/null +++ b/api/v1/datadog/model_idp_form_data.go @@ -0,0 +1,104 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "os" +) + +// IdpFormData Object describing the IdP configuration. +type IdpFormData struct { + // The path to the XML metadata file you wish to upload. + IdpFile *os.File `json:"idp_file"` + // 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{} +} + +// NewIdpFormData instantiates a new IdpFormData 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 NewIdpFormData(idpFile *os.File) *IdpFormData { + this := IdpFormData{} + this.IdpFile = idpFile + return &this +} + +// NewIdpFormDataWithDefaults instantiates a new IdpFormData 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 NewIdpFormDataWithDefaults() *IdpFormData { + this := IdpFormData{} + return &this +} + +// GetIdpFile returns the IdpFile field value. +func (o *IdpFormData) GetIdpFile() *os.File { + if o == nil { + var ret *os.File + return ret + } + return o.IdpFile +} + +// GetIdpFileOk returns a tuple with the IdpFile field value +// and a boolean to check if the value has been set. +func (o *IdpFormData) GetIdpFileOk() (**os.File, bool) { + if o == nil { + return nil, false + } + return &o.IdpFile, true +} + +// SetIdpFile sets field value. +func (o *IdpFormData) SetIdpFile(v *os.File) { + o.IdpFile = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IdpFormData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["idp_file"] = o.IdpFile + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IdpFormData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + IdpFile **os.File `json:"idp_file"` + }{} + all := struct { + IdpFile *os.File `json:"idp_file"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.IdpFile == nil { + return fmt.Errorf("Required field idp_file missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IdpFile = all.IdpFile + return nil +} diff --git a/api/v1/datadog/model_idp_response.go b/api/v1/datadog/model_idp_response.go new file mode 100644 index 00000000000..4d73383655d --- /dev/null +++ b/api/v1/datadog/model_idp_response.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IdpResponse The IdP response object. +type IdpResponse struct { + // Identity provider response. + Message string `json:"message"` + // 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{} +} + +// NewIdpResponse instantiates a new IdpResponse 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 NewIdpResponse(message string) *IdpResponse { + this := IdpResponse{} + this.Message = message + return &this +} + +// NewIdpResponseWithDefaults instantiates a new IdpResponse 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 NewIdpResponseWithDefaults() *IdpResponse { + this := IdpResponse{} + return &this +} + +// GetMessage returns the Message field value. +func (o *IdpResponse) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *IdpResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *IdpResponse) SetMessage(v string) { + o.Message = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IdpResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IdpResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Message *string `json:"message"` + }{} + all := struct { + Message string `json:"message"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_image_widget_definition.go b/api/v1/datadog/model_image_widget_definition.go new file mode 100644 index 00000000000..d790e9251ef --- /dev/null +++ b/api/v1/datadog/model_image_widget_definition.go @@ -0,0 +1,461 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ImageWidgetDefinition The image widget allows you to embed an image on your dashboard. An image can be a PNG, JPG, or animated GIF. Only available on FREE layout dashboards. +type ImageWidgetDefinition struct { + // Whether to display a background or not. + HasBackground *bool `json:"has_background,omitempty"` + // Whether to display a border or not. + HasBorder *bool `json:"has_border,omitempty"` + // Horizontal alignment. + HorizontalAlign *WidgetHorizontalAlign `json:"horizontal_align,omitempty"` + // Size of the margins around the image. + // **Note**: `small` and `large` values are deprecated. + Margin *WidgetMargin `json:"margin,omitempty"` + // How to size the image on the widget. The values are based on the image `object-fit` CSS properties. + // **Note**: `zoom`, `fit` and `center` values are deprecated. + Sizing *WidgetImageSizing `json:"sizing,omitempty"` + // Type of the image widget. + Type ImageWidgetDefinitionType `json:"type"` + // URL of the image. + Url string `json:"url"` + // URL of the image in dark mode. + UrlDarkTheme *string `json:"url_dark_theme,omitempty"` + // Vertical alignment. + VerticalAlign *WidgetVerticalAlign `json:"vertical_align,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{} +} + +// NewImageWidgetDefinition instantiates a new ImageWidgetDefinition 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 NewImageWidgetDefinition(typeVar ImageWidgetDefinitionType, url string) *ImageWidgetDefinition { + this := ImageWidgetDefinition{} + var hasBackground bool = true + this.HasBackground = &hasBackground + var hasBorder bool = true + this.HasBorder = &hasBorder + this.Type = typeVar + this.Url = url + return &this +} + +// NewImageWidgetDefinitionWithDefaults instantiates a new ImageWidgetDefinition 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 NewImageWidgetDefinitionWithDefaults() *ImageWidgetDefinition { + this := ImageWidgetDefinition{} + var hasBackground bool = true + this.HasBackground = &hasBackground + var hasBorder bool = true + this.HasBorder = &hasBorder + var typeVar ImageWidgetDefinitionType = IMAGEWIDGETDEFINITIONTYPE_IMAGE + this.Type = typeVar + return &this +} + +// GetHasBackground returns the HasBackground field value if set, zero value otherwise. +func (o *ImageWidgetDefinition) GetHasBackground() bool { + if o == nil || o.HasBackground == nil { + var ret bool + return ret + } + return *o.HasBackground +} + +// GetHasBackgroundOk returns a tuple with the HasBackground field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetHasBackgroundOk() (*bool, bool) { + if o == nil || o.HasBackground == nil { + return nil, false + } + return o.HasBackground, true +} + +// HasHasBackground returns a boolean if a field has been set. +func (o *ImageWidgetDefinition) HasHasBackground() bool { + if o != nil && o.HasBackground != nil { + return true + } + + return false +} + +// SetHasBackground gets a reference to the given bool and assigns it to the HasBackground field. +func (o *ImageWidgetDefinition) SetHasBackground(v bool) { + o.HasBackground = &v +} + +// GetHasBorder returns the HasBorder field value if set, zero value otherwise. +func (o *ImageWidgetDefinition) GetHasBorder() bool { + if o == nil || o.HasBorder == nil { + var ret bool + return ret + } + return *o.HasBorder +} + +// GetHasBorderOk returns a tuple with the HasBorder field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetHasBorderOk() (*bool, bool) { + if o == nil || o.HasBorder == nil { + return nil, false + } + return o.HasBorder, true +} + +// HasHasBorder returns a boolean if a field has been set. +func (o *ImageWidgetDefinition) HasHasBorder() bool { + if o != nil && o.HasBorder != nil { + return true + } + + return false +} + +// SetHasBorder gets a reference to the given bool and assigns it to the HasBorder field. +func (o *ImageWidgetDefinition) SetHasBorder(v bool) { + o.HasBorder = &v +} + +// GetHorizontalAlign returns the HorizontalAlign field value if set, zero value otherwise. +func (o *ImageWidgetDefinition) GetHorizontalAlign() WidgetHorizontalAlign { + if o == nil || o.HorizontalAlign == nil { + var ret WidgetHorizontalAlign + return ret + } + return *o.HorizontalAlign +} + +// GetHorizontalAlignOk returns a tuple with the HorizontalAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetHorizontalAlignOk() (*WidgetHorizontalAlign, bool) { + if o == nil || o.HorizontalAlign == nil { + return nil, false + } + return o.HorizontalAlign, true +} + +// HasHorizontalAlign returns a boolean if a field has been set. +func (o *ImageWidgetDefinition) HasHorizontalAlign() bool { + if o != nil && o.HorizontalAlign != nil { + return true + } + + return false +} + +// SetHorizontalAlign gets a reference to the given WidgetHorizontalAlign and assigns it to the HorizontalAlign field. +func (o *ImageWidgetDefinition) SetHorizontalAlign(v WidgetHorizontalAlign) { + o.HorizontalAlign = &v +} + +// GetMargin returns the Margin field value if set, zero value otherwise. +func (o *ImageWidgetDefinition) GetMargin() WidgetMargin { + if o == nil || o.Margin == nil { + var ret WidgetMargin + return ret + } + return *o.Margin +} + +// GetMarginOk returns a tuple with the Margin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetMarginOk() (*WidgetMargin, bool) { + if o == nil || o.Margin == nil { + return nil, false + } + return o.Margin, true +} + +// HasMargin returns a boolean if a field has been set. +func (o *ImageWidgetDefinition) HasMargin() bool { + if o != nil && o.Margin != nil { + return true + } + + return false +} + +// SetMargin gets a reference to the given WidgetMargin and assigns it to the Margin field. +func (o *ImageWidgetDefinition) SetMargin(v WidgetMargin) { + o.Margin = &v +} + +// GetSizing returns the Sizing field value if set, zero value otherwise. +func (o *ImageWidgetDefinition) GetSizing() WidgetImageSizing { + if o == nil || o.Sizing == nil { + var ret WidgetImageSizing + return ret + } + return *o.Sizing +} + +// GetSizingOk returns a tuple with the Sizing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetSizingOk() (*WidgetImageSizing, bool) { + if o == nil || o.Sizing == nil { + return nil, false + } + return o.Sizing, true +} + +// HasSizing returns a boolean if a field has been set. +func (o *ImageWidgetDefinition) HasSizing() bool { + if o != nil && o.Sizing != nil { + return true + } + + return false +} + +// SetSizing gets a reference to the given WidgetImageSizing and assigns it to the Sizing field. +func (o *ImageWidgetDefinition) SetSizing(v WidgetImageSizing) { + o.Sizing = &v +} + +// GetType returns the Type field value. +func (o *ImageWidgetDefinition) GetType() ImageWidgetDefinitionType { + if o == nil { + var ret ImageWidgetDefinitionType + 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 *ImageWidgetDefinition) GetTypeOk() (*ImageWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ImageWidgetDefinition) SetType(v ImageWidgetDefinitionType) { + o.Type = v +} + +// GetUrl returns the Url field value. +func (o *ImageWidgetDefinition) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *ImageWidgetDefinition) SetUrl(v string) { + o.Url = v +} + +// GetUrlDarkTheme returns the UrlDarkTheme field value if set, zero value otherwise. +func (o *ImageWidgetDefinition) GetUrlDarkTheme() string { + if o == nil || o.UrlDarkTheme == nil { + var ret string + return ret + } + return *o.UrlDarkTheme +} + +// GetUrlDarkThemeOk returns a tuple with the UrlDarkTheme field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetUrlDarkThemeOk() (*string, bool) { + if o == nil || o.UrlDarkTheme == nil { + return nil, false + } + return o.UrlDarkTheme, true +} + +// HasUrlDarkTheme returns a boolean if a field has been set. +func (o *ImageWidgetDefinition) HasUrlDarkTheme() bool { + if o != nil && o.UrlDarkTheme != nil { + return true + } + + return false +} + +// SetUrlDarkTheme gets a reference to the given string and assigns it to the UrlDarkTheme field. +func (o *ImageWidgetDefinition) SetUrlDarkTheme(v string) { + o.UrlDarkTheme = &v +} + +// GetVerticalAlign returns the VerticalAlign field value if set, zero value otherwise. +func (o *ImageWidgetDefinition) GetVerticalAlign() WidgetVerticalAlign { + if o == nil || o.VerticalAlign == nil { + var ret WidgetVerticalAlign + return ret + } + return *o.VerticalAlign +} + +// GetVerticalAlignOk returns a tuple with the VerticalAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageWidgetDefinition) GetVerticalAlignOk() (*WidgetVerticalAlign, bool) { + if o == nil || o.VerticalAlign == nil { + return nil, false + } + return o.VerticalAlign, true +} + +// HasVerticalAlign returns a boolean if a field has been set. +func (o *ImageWidgetDefinition) HasVerticalAlign() bool { + if o != nil && o.VerticalAlign != nil { + return true + } + + return false +} + +// SetVerticalAlign gets a reference to the given WidgetVerticalAlign and assigns it to the VerticalAlign field. +func (o *ImageWidgetDefinition) SetVerticalAlign(v WidgetVerticalAlign) { + o.VerticalAlign = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ImageWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.HasBackground != nil { + toSerialize["has_background"] = o.HasBackground + } + if o.HasBorder != nil { + toSerialize["has_border"] = o.HasBorder + } + if o.HorizontalAlign != nil { + toSerialize["horizontal_align"] = o.HorizontalAlign + } + if o.Margin != nil { + toSerialize["margin"] = o.Margin + } + if o.Sizing != nil { + toSerialize["sizing"] = o.Sizing + } + toSerialize["type"] = o.Type + toSerialize["url"] = o.Url + if o.UrlDarkTheme != nil { + toSerialize["url_dark_theme"] = o.UrlDarkTheme + } + if o.VerticalAlign != nil { + toSerialize["vertical_align"] = o.VerticalAlign + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *ImageWidgetDefinitionType `json:"type"` + Url *string `json:"url"` + }{} + all := struct { + HasBackground *bool `json:"has_background,omitempty"` + HasBorder *bool `json:"has_border,omitempty"` + HorizontalAlign *WidgetHorizontalAlign `json:"horizontal_align,omitempty"` + Margin *WidgetMargin `json:"margin,omitempty"` + Sizing *WidgetImageSizing `json:"sizing,omitempty"` + Type ImageWidgetDefinitionType `json:"type"` + Url string `json:"url"` + UrlDarkTheme *string `json:"url_dark_theme,omitempty"` + VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + if required.Url == nil { + return fmt.Errorf("Required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.HorizontalAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Margin; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sizing; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.VerticalAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.HasBackground = all.HasBackground + o.HasBorder = all.HasBorder + o.HorizontalAlign = all.HorizontalAlign + o.Margin = all.Margin + o.Sizing = all.Sizing + o.Type = all.Type + o.Url = all.Url + o.UrlDarkTheme = all.UrlDarkTheme + o.VerticalAlign = all.VerticalAlign + return nil +} diff --git a/api/v1/datadog/model_image_widget_definition_type.go b/api/v1/datadog/model_image_widget_definition_type.go new file mode 100644 index 00000000000..7949b31af90 --- /dev/null +++ b/api/v1/datadog/model_image_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ImageWidgetDefinitionType Type of the image widget. +type ImageWidgetDefinitionType string + +// List of ImageWidgetDefinitionType. +const ( + IMAGEWIDGETDEFINITIONTYPE_IMAGE ImageWidgetDefinitionType = "image" +) + +var allowedImageWidgetDefinitionTypeEnumValues = []ImageWidgetDefinitionType{ + IMAGEWIDGETDEFINITIONTYPE_IMAGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ImageWidgetDefinitionType) GetAllowedValues() []ImageWidgetDefinitionType { + return allowedImageWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ImageWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ImageWidgetDefinitionType(value) + return nil +} + +// NewImageWidgetDefinitionTypeFromValue returns a pointer to a valid ImageWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewImageWidgetDefinitionTypeFromValue(v string) (*ImageWidgetDefinitionType, error) { + ev := ImageWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ImageWidgetDefinitionType: valid values are %v", v, allowedImageWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ImageWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedImageWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ImageWidgetDefinitionType value. +func (v ImageWidgetDefinitionType) Ptr() *ImageWidgetDefinitionType { + return &v +} + +// NullableImageWidgetDefinitionType handles when a null is used for ImageWidgetDefinitionType. +type NullableImageWidgetDefinitionType struct { + value *ImageWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableImageWidgetDefinitionType) Get() *ImageWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableImageWidgetDefinitionType) Set(val *ImageWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableImageWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableImageWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableImageWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableImageWidgetDefinitionType(val *ImageWidgetDefinitionType) *NullableImageWidgetDefinitionType { + return &NullableImageWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableImageWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableImageWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_intake_payload_accepted.go b/api/v1/datadog/model_intake_payload_accepted.go new file mode 100644 index 00000000000..28de606ebf6 --- /dev/null +++ b/api/v1/datadog/model_intake_payload_accepted.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 datadog + +import ( + "encoding/json" +) + +// IntakePayloadAccepted The payload accepted for intake. +type IntakePayloadAccepted struct { + // The status of the intake payload. + Status *string `json:"status,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{} +} + +// NewIntakePayloadAccepted instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAccepted() *IntakePayloadAccepted { + this := IntakePayloadAccepted{} + return &this +} + +// NewIntakePayloadAcceptedWithDefaults instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAcceptedWithDefaults() *IntakePayloadAccepted { + this := IntakePayloadAccepted{} + return &this +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *IntakePayloadAccepted) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakePayloadAccepted) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *IntakePayloadAccepted) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *IntakePayloadAccepted) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntakePayloadAccepted) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Status *string `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_agents.go b/api/v1/datadog/model_ip_prefixes_agents.go new file mode 100644 index 00000000000..22d8a7730b4 --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_agents.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesAgents Available prefix information for the Agent endpoints. +type IPPrefixesAgents struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesAgents instantiates a new IPPrefixesAgents 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 NewIPPrefixesAgents() *IPPrefixesAgents { + this := IPPrefixesAgents{} + return &this +} + +// NewIPPrefixesAgentsWithDefaults instantiates a new IPPrefixesAgents 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 NewIPPrefixesAgentsWithDefaults() *IPPrefixesAgents { + this := IPPrefixesAgents{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesAgents) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesAgents) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesAgents) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesAgents) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesAgents) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesAgents) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesAgents) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesAgents) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesAgents) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesAgents) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_api.go b/api/v1/datadog/model_ip_prefixes_api.go new file mode 100644 index 00000000000..4a9bf056e7a --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_api.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesAPI Available prefix information for the API endpoints. +type IPPrefixesAPI struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesAPI instantiates a new IPPrefixesAPI 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 NewIPPrefixesAPI() *IPPrefixesAPI { + this := IPPrefixesAPI{} + return &this +} + +// NewIPPrefixesAPIWithDefaults instantiates a new IPPrefixesAPI 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 NewIPPrefixesAPIWithDefaults() *IPPrefixesAPI { + this := IPPrefixesAPI{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesAPI) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesAPI) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesAPI) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesAPI) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesAPI) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesAPI) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesAPI) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesAPI) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesAPI) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesAPI) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_apm.go b/api/v1/datadog/model_ip_prefixes_apm.go new file mode 100644 index 00000000000..90aec8a5478 --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_apm.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesAPM Available prefix information for the APM endpoints. +type IPPrefixesAPM struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesAPM instantiates a new IPPrefixesAPM 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 NewIPPrefixesAPM() *IPPrefixesAPM { + this := IPPrefixesAPM{} + return &this +} + +// NewIPPrefixesAPMWithDefaults instantiates a new IPPrefixesAPM 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 NewIPPrefixesAPMWithDefaults() *IPPrefixesAPM { + this := IPPrefixesAPM{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesAPM) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesAPM) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesAPM) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesAPM) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesAPM) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesAPM) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesAPM) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesAPM) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesAPM) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesAPM) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_logs.go b/api/v1/datadog/model_ip_prefixes_logs.go new file mode 100644 index 00000000000..f2c5f1efb7f --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_logs.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesLogs Available prefix information for the Logs endpoints. +type IPPrefixesLogs struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesLogs instantiates a new IPPrefixesLogs 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 NewIPPrefixesLogs() *IPPrefixesLogs { + this := IPPrefixesLogs{} + return &this +} + +// NewIPPrefixesLogsWithDefaults instantiates a new IPPrefixesLogs 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 NewIPPrefixesLogsWithDefaults() *IPPrefixesLogs { + this := IPPrefixesLogs{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesLogs) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesLogs) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesLogs) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesLogs) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesLogs) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesLogs) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesLogs) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesLogs) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesLogs) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesLogs) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_process.go b/api/v1/datadog/model_ip_prefixes_process.go new file mode 100644 index 00000000000..ee432fec530 --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_process.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesProcess Available prefix information for the Process endpoints. +type IPPrefixesProcess struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesProcess instantiates a new IPPrefixesProcess 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 NewIPPrefixesProcess() *IPPrefixesProcess { + this := IPPrefixesProcess{} + return &this +} + +// NewIPPrefixesProcessWithDefaults instantiates a new IPPrefixesProcess 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 NewIPPrefixesProcessWithDefaults() *IPPrefixesProcess { + this := IPPrefixesProcess{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesProcess) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesProcess) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesProcess) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesProcess) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesProcess) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesProcess) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesProcess) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesProcess) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesProcess) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesProcess) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_synthetics.go b/api/v1/datadog/model_ip_prefixes_synthetics.go new file mode 100644 index 00000000000..2d9c84eb20d --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_synthetics.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesSynthetics Available prefix information for the Synthetics endpoints. +type IPPrefixesSynthetics struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv4 prefixes by location. + PrefixesIpv4ByLocation map[string][]string `json:"prefixes_ipv4_by_location,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + // List of IPv6 prefixes by location. + PrefixesIpv6ByLocation map[string][]string `json:"prefixes_ipv6_by_location,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{} +} + +// NewIPPrefixesSynthetics instantiates a new IPPrefixesSynthetics 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 NewIPPrefixesSynthetics() *IPPrefixesSynthetics { + this := IPPrefixesSynthetics{} + return &this +} + +// NewIPPrefixesSyntheticsWithDefaults instantiates a new IPPrefixesSynthetics 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 NewIPPrefixesSyntheticsWithDefaults() *IPPrefixesSynthetics { + this := IPPrefixesSynthetics{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesSynthetics) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesSynthetics) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesSynthetics) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesSynthetics) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv4ByLocation returns the PrefixesIpv4ByLocation field value if set, zero value otherwise. +func (o *IPPrefixesSynthetics) GetPrefixesIpv4ByLocation() map[string][]string { + if o == nil || o.PrefixesIpv4ByLocation == nil { + var ret map[string][]string + return ret + } + return o.PrefixesIpv4ByLocation +} + +// GetPrefixesIpv4ByLocationOk returns a tuple with the PrefixesIpv4ByLocation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesSynthetics) GetPrefixesIpv4ByLocationOk() (*map[string][]string, bool) { + if o == nil || o.PrefixesIpv4ByLocation == nil { + return nil, false + } + return &o.PrefixesIpv4ByLocation, true +} + +// HasPrefixesIpv4ByLocation returns a boolean if a field has been set. +func (o *IPPrefixesSynthetics) HasPrefixesIpv4ByLocation() bool { + if o != nil && o.PrefixesIpv4ByLocation != nil { + return true + } + + return false +} + +// SetPrefixesIpv4ByLocation gets a reference to the given map[string][]string and assigns it to the PrefixesIpv4ByLocation field. +func (o *IPPrefixesSynthetics) SetPrefixesIpv4ByLocation(v map[string][]string) { + o.PrefixesIpv4ByLocation = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesSynthetics) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesSynthetics) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesSynthetics) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesSynthetics) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// GetPrefixesIpv6ByLocation returns the PrefixesIpv6ByLocation field value if set, zero value otherwise. +func (o *IPPrefixesSynthetics) GetPrefixesIpv6ByLocation() map[string][]string { + if o == nil || o.PrefixesIpv6ByLocation == nil { + var ret map[string][]string + return ret + } + return o.PrefixesIpv6ByLocation +} + +// GetPrefixesIpv6ByLocationOk returns a tuple with the PrefixesIpv6ByLocation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesSynthetics) GetPrefixesIpv6ByLocationOk() (*map[string][]string, bool) { + if o == nil || o.PrefixesIpv6ByLocation == nil { + return nil, false + } + return &o.PrefixesIpv6ByLocation, true +} + +// HasPrefixesIpv6ByLocation returns a boolean if a field has been set. +func (o *IPPrefixesSynthetics) HasPrefixesIpv6ByLocation() bool { + if o != nil && o.PrefixesIpv6ByLocation != nil { + return true + } + + return false +} + +// SetPrefixesIpv6ByLocation gets a reference to the given map[string][]string and assigns it to the PrefixesIpv6ByLocation field. +func (o *IPPrefixesSynthetics) SetPrefixesIpv6ByLocation(v map[string][]string) { + o.PrefixesIpv6ByLocation = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesSynthetics) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv4ByLocation != nil { + toSerialize["prefixes_ipv4_by_location"] = o.PrefixesIpv4ByLocation + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + if o.PrefixesIpv6ByLocation != nil { + toSerialize["prefixes_ipv6_by_location"] = o.PrefixesIpv6ByLocation + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesSynthetics) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv4ByLocation map[string][]string `json:"prefixes_ipv4_by_location,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + PrefixesIpv6ByLocation map[string][]string `json:"prefixes_ipv6_by_location,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv4ByLocation = all.PrefixesIpv4ByLocation + o.PrefixesIpv6 = all.PrefixesIpv6 + o.PrefixesIpv6ByLocation = all.PrefixesIpv6ByLocation + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go b/api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go new file mode 100644 index 00000000000..d9e3bc41c71 --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_synthetics_private_locations.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesSyntheticsPrivateLocations Available prefix information for the Synthetics Private Locations endpoints. +type IPPrefixesSyntheticsPrivateLocations struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesSyntheticsPrivateLocations instantiates a new IPPrefixesSyntheticsPrivateLocations 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 NewIPPrefixesSyntheticsPrivateLocations() *IPPrefixesSyntheticsPrivateLocations { + this := IPPrefixesSyntheticsPrivateLocations{} + return &this +} + +// NewIPPrefixesSyntheticsPrivateLocationsWithDefaults instantiates a new IPPrefixesSyntheticsPrivateLocations 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 NewIPPrefixesSyntheticsPrivateLocationsWithDefaults() *IPPrefixesSyntheticsPrivateLocations { + this := IPPrefixesSyntheticsPrivateLocations{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesSyntheticsPrivateLocations) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesSyntheticsPrivateLocations) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesSyntheticsPrivateLocations) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesSyntheticsPrivateLocations) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesSyntheticsPrivateLocations) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesSyntheticsPrivateLocations) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesSyntheticsPrivateLocations) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + return nil +} diff --git a/api/v1/datadog/model_ip_prefixes_webhooks.go b/api/v1/datadog/model_ip_prefixes_webhooks.go new file mode 100644 index 00000000000..feebfe969e5 --- /dev/null +++ b/api/v1/datadog/model_ip_prefixes_webhooks.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPPrefixesWebhooks Available prefix information for the Webhook endpoints. +type IPPrefixesWebhooks struct { + // List of IPv4 prefixes. + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + // List of IPv6 prefixes. + PrefixesIpv6 []string `json:"prefixes_ipv6,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{} +} + +// NewIPPrefixesWebhooks instantiates a new IPPrefixesWebhooks 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 NewIPPrefixesWebhooks() *IPPrefixesWebhooks { + this := IPPrefixesWebhooks{} + return &this +} + +// NewIPPrefixesWebhooksWithDefaults instantiates a new IPPrefixesWebhooks 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 NewIPPrefixesWebhooksWithDefaults() *IPPrefixesWebhooks { + this := IPPrefixesWebhooks{} + return &this +} + +// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. +func (o *IPPrefixesWebhooks) GetPrefixesIpv4() []string { + if o == nil || o.PrefixesIpv4 == nil { + var ret []string + return ret + } + return o.PrefixesIpv4 +} + +// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesWebhooks) GetPrefixesIpv4Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv4 == nil { + return nil, false + } + return &o.PrefixesIpv4, true +} + +// HasPrefixesIpv4 returns a boolean if a field has been set. +func (o *IPPrefixesWebhooks) HasPrefixesIpv4() bool { + if o != nil && o.PrefixesIpv4 != nil { + return true + } + + return false +} + +// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. +func (o *IPPrefixesWebhooks) SetPrefixesIpv4(v []string) { + o.PrefixesIpv4 = v +} + +// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. +func (o *IPPrefixesWebhooks) GetPrefixesIpv6() []string { + if o == nil || o.PrefixesIpv6 == nil { + var ret []string + return ret + } + return o.PrefixesIpv6 +} + +// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPPrefixesWebhooks) GetPrefixesIpv6Ok() (*[]string, bool) { + if o == nil || o.PrefixesIpv6 == nil { + return nil, false + } + return &o.PrefixesIpv6, true +} + +// HasPrefixesIpv6 returns a boolean if a field has been set. +func (o *IPPrefixesWebhooks) HasPrefixesIpv6() bool { + if o != nil && o.PrefixesIpv6 != nil { + return true + } + + return false +} + +// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. +func (o *IPPrefixesWebhooks) SetPrefixesIpv6(v []string) { + o.PrefixesIpv6 = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPPrefixesWebhooks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrefixesIpv4 != nil { + toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 + } + if o.PrefixesIpv6 != nil { + toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPPrefixesWebhooks) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` + PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrefixesIpv4 = all.PrefixesIpv4 + o.PrefixesIpv6 = all.PrefixesIpv6 + return nil +} diff --git a/api/v1/datadog/model_ip_ranges.go b/api/v1/datadog/model_ip_ranges.go new file mode 100644 index 00000000000..647124d46ce --- /dev/null +++ b/api/v1/datadog/model_ip_ranges.go @@ -0,0 +1,509 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IPRanges IP ranges. +type IPRanges struct { + // Available prefix information for the Agent endpoints. + Agents *IPPrefixesAgents `json:"agents,omitempty"` + // Available prefix information for the API endpoints. + Api *IPPrefixesAPI `json:"api,omitempty"` + // Available prefix information for the APM endpoints. + Apm *IPPrefixesAPM `json:"apm,omitempty"` + // Available prefix information for the Logs endpoints. + Logs *IPPrefixesLogs `json:"logs,omitempty"` + // Date when last updated, in the form `YYYY-MM-DD-hh-mm-ss`. + Modified *string `json:"modified,omitempty"` + // Available prefix information for the Process endpoints. + Process *IPPrefixesProcess `json:"process,omitempty"` + // Available prefix information for the Synthetics endpoints. + Synthetics *IPPrefixesSynthetics `json:"synthetics,omitempty"` + // Available prefix information for the Synthetics Private Locations endpoints. + SyntheticsPrivateLocations *IPPrefixesSyntheticsPrivateLocations `json:"synthetics-private-locations,omitempty"` + // Version of the IP list. + Version *int64 `json:"version,omitempty"` + // Available prefix information for the Webhook endpoints. + Webhooks *IPPrefixesWebhooks `json:"webhooks,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{} +} + +// NewIPRanges instantiates a new IPRanges 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 NewIPRanges() *IPRanges { + this := IPRanges{} + return &this +} + +// NewIPRangesWithDefaults instantiates a new IPRanges 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 NewIPRangesWithDefaults() *IPRanges { + this := IPRanges{} + return &this +} + +// GetAgents returns the Agents field value if set, zero value otherwise. +func (o *IPRanges) GetAgents() IPPrefixesAgents { + if o == nil || o.Agents == nil { + var ret IPPrefixesAgents + return ret + } + return *o.Agents +} + +// GetAgentsOk returns a tuple with the Agents field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetAgentsOk() (*IPPrefixesAgents, bool) { + if o == nil || o.Agents == nil { + return nil, false + } + return o.Agents, true +} + +// HasAgents returns a boolean if a field has been set. +func (o *IPRanges) HasAgents() bool { + if o != nil && o.Agents != nil { + return true + } + + return false +} + +// SetAgents gets a reference to the given IPPrefixesAgents and assigns it to the Agents field. +func (o *IPRanges) SetAgents(v IPPrefixesAgents) { + o.Agents = &v +} + +// GetApi returns the Api field value if set, zero value otherwise. +func (o *IPRanges) GetApi() IPPrefixesAPI { + if o == nil || o.Api == nil { + var ret IPPrefixesAPI + return ret + } + return *o.Api +} + +// GetApiOk returns a tuple with the Api field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetApiOk() (*IPPrefixesAPI, bool) { + if o == nil || o.Api == nil { + return nil, false + } + return o.Api, true +} + +// HasApi returns a boolean if a field has been set. +func (o *IPRanges) HasApi() bool { + if o != nil && o.Api != nil { + return true + } + + return false +} + +// SetApi gets a reference to the given IPPrefixesAPI and assigns it to the Api field. +func (o *IPRanges) SetApi(v IPPrefixesAPI) { + o.Api = &v +} + +// GetApm returns the Apm field value if set, zero value otherwise. +func (o *IPRanges) GetApm() IPPrefixesAPM { + if o == nil || o.Apm == nil { + var ret IPPrefixesAPM + return ret + } + return *o.Apm +} + +// GetApmOk returns a tuple with the Apm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetApmOk() (*IPPrefixesAPM, bool) { + if o == nil || o.Apm == nil { + return nil, false + } + return o.Apm, true +} + +// HasApm returns a boolean if a field has been set. +func (o *IPRanges) HasApm() bool { + if o != nil && o.Apm != nil { + return true + } + + return false +} + +// SetApm gets a reference to the given IPPrefixesAPM and assigns it to the Apm field. +func (o *IPRanges) SetApm(v IPPrefixesAPM) { + o.Apm = &v +} + +// GetLogs returns the Logs field value if set, zero value otherwise. +func (o *IPRanges) GetLogs() IPPrefixesLogs { + if o == nil || o.Logs == nil { + var ret IPPrefixesLogs + return ret + } + return *o.Logs +} + +// GetLogsOk returns a tuple with the Logs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetLogsOk() (*IPPrefixesLogs, bool) { + if o == nil || o.Logs == nil { + return nil, false + } + return o.Logs, true +} + +// HasLogs returns a boolean if a field has been set. +func (o *IPRanges) HasLogs() bool { + if o != nil && o.Logs != nil { + return true + } + + return false +} + +// SetLogs gets a reference to the given IPPrefixesLogs and assigns it to the Logs field. +func (o *IPRanges) SetLogs(v IPPrefixesLogs) { + o.Logs = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *IPRanges) GetModified() string { + if o == nil || o.Modified == nil { + var ret string + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetModifiedOk() (*string, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *IPRanges) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given string and assigns it to the Modified field. +func (o *IPRanges) SetModified(v string) { + o.Modified = &v +} + +// GetProcess returns the Process field value if set, zero value otherwise. +func (o *IPRanges) GetProcess() IPPrefixesProcess { + if o == nil || o.Process == nil { + var ret IPPrefixesProcess + return ret + } + return *o.Process +} + +// GetProcessOk returns a tuple with the Process field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetProcessOk() (*IPPrefixesProcess, bool) { + if o == nil || o.Process == nil { + return nil, false + } + return o.Process, true +} + +// HasProcess returns a boolean if a field has been set. +func (o *IPRanges) HasProcess() bool { + if o != nil && o.Process != nil { + return true + } + + return false +} + +// SetProcess gets a reference to the given IPPrefixesProcess and assigns it to the Process field. +func (o *IPRanges) SetProcess(v IPPrefixesProcess) { + o.Process = &v +} + +// GetSynthetics returns the Synthetics field value if set, zero value otherwise. +func (o *IPRanges) GetSynthetics() IPPrefixesSynthetics { + if o == nil || o.Synthetics == nil { + var ret IPPrefixesSynthetics + return ret + } + return *o.Synthetics +} + +// GetSyntheticsOk returns a tuple with the Synthetics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetSyntheticsOk() (*IPPrefixesSynthetics, bool) { + if o == nil || o.Synthetics == nil { + return nil, false + } + return o.Synthetics, true +} + +// HasSynthetics returns a boolean if a field has been set. +func (o *IPRanges) HasSynthetics() bool { + if o != nil && o.Synthetics != nil { + return true + } + + return false +} + +// SetSynthetics gets a reference to the given IPPrefixesSynthetics and assigns it to the Synthetics field. +func (o *IPRanges) SetSynthetics(v IPPrefixesSynthetics) { + o.Synthetics = &v +} + +// GetSyntheticsPrivateLocations returns the SyntheticsPrivateLocations field value if set, zero value otherwise. +func (o *IPRanges) GetSyntheticsPrivateLocations() IPPrefixesSyntheticsPrivateLocations { + if o == nil || o.SyntheticsPrivateLocations == nil { + var ret IPPrefixesSyntheticsPrivateLocations + return ret + } + return *o.SyntheticsPrivateLocations +} + +// GetSyntheticsPrivateLocationsOk returns a tuple with the SyntheticsPrivateLocations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetSyntheticsPrivateLocationsOk() (*IPPrefixesSyntheticsPrivateLocations, bool) { + if o == nil || o.SyntheticsPrivateLocations == nil { + return nil, false + } + return o.SyntheticsPrivateLocations, true +} + +// HasSyntheticsPrivateLocations returns a boolean if a field has been set. +func (o *IPRanges) HasSyntheticsPrivateLocations() bool { + if o != nil && o.SyntheticsPrivateLocations != nil { + return true + } + + return false +} + +// SetSyntheticsPrivateLocations gets a reference to the given IPPrefixesSyntheticsPrivateLocations and assigns it to the SyntheticsPrivateLocations field. +func (o *IPRanges) SetSyntheticsPrivateLocations(v IPPrefixesSyntheticsPrivateLocations) { + o.SyntheticsPrivateLocations = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *IPRanges) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *IPRanges) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *IPRanges) SetVersion(v int64) { + o.Version = &v +} + +// GetWebhooks returns the Webhooks field value if set, zero value otherwise. +func (o *IPRanges) GetWebhooks() IPPrefixesWebhooks { + if o == nil || o.Webhooks == nil { + var ret IPPrefixesWebhooks + return ret + } + return *o.Webhooks +} + +// GetWebhooksOk returns a tuple with the Webhooks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPRanges) GetWebhooksOk() (*IPPrefixesWebhooks, bool) { + if o == nil || o.Webhooks == nil { + return nil, false + } + return o.Webhooks, true +} + +// HasWebhooks returns a boolean if a field has been set. +func (o *IPRanges) HasWebhooks() bool { + if o != nil && o.Webhooks != nil { + return true + } + + return false +} + +// SetWebhooks gets a reference to the given IPPrefixesWebhooks and assigns it to the Webhooks field. +func (o *IPRanges) SetWebhooks(v IPPrefixesWebhooks) { + o.Webhooks = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IPRanges) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Agents != nil { + toSerialize["agents"] = o.Agents + } + if o.Api != nil { + toSerialize["api"] = o.Api + } + if o.Apm != nil { + toSerialize["apm"] = o.Apm + } + if o.Logs != nil { + toSerialize["logs"] = o.Logs + } + if o.Modified != nil { + toSerialize["modified"] = o.Modified + } + if o.Process != nil { + toSerialize["process"] = o.Process + } + if o.Synthetics != nil { + toSerialize["synthetics"] = o.Synthetics + } + if o.SyntheticsPrivateLocations != nil { + toSerialize["synthetics-private-locations"] = o.SyntheticsPrivateLocations + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + if o.Webhooks != nil { + toSerialize["webhooks"] = o.Webhooks + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Agents *IPPrefixesAgents `json:"agents,omitempty"` + Api *IPPrefixesAPI `json:"api,omitempty"` + Apm *IPPrefixesAPM `json:"apm,omitempty"` + Logs *IPPrefixesLogs `json:"logs,omitempty"` + Modified *string `json:"modified,omitempty"` + Process *IPPrefixesProcess `json:"process,omitempty"` + Synthetics *IPPrefixesSynthetics `json:"synthetics,omitempty"` + SyntheticsPrivateLocations *IPPrefixesSyntheticsPrivateLocations `json:"synthetics-private-locations,omitempty"` + Version *int64 `json:"version,omitempty"` + Webhooks *IPPrefixesWebhooks `json:"webhooks,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Agents != nil && all.Agents.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Agents = all.Agents + if all.Api != nil && all.Api.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Api = all.Api + if all.Apm != nil && all.Apm.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Apm = all.Apm + if all.Logs != nil && all.Logs.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Logs = all.Logs + o.Modified = all.Modified + if all.Process != nil && all.Process.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Process = all.Process + if all.Synthetics != nil && all.Synthetics.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Synthetics = all.Synthetics + if all.SyntheticsPrivateLocations != nil && all.SyntheticsPrivateLocations.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SyntheticsPrivateLocations = all.SyntheticsPrivateLocations + o.Version = all.Version + if all.Webhooks != nil && all.Webhooks.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Webhooks = all.Webhooks + return nil +} diff --git a/api/v1/datadog/model_list_stream_column.go b/api/v1/datadog/model_list_stream_column.go new file mode 100644 index 00000000000..dcd7d22985f --- /dev/null +++ b/api/v1/datadog/model_list_stream_column.go @@ -0,0 +1,144 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamColumn Widget column. +type ListStreamColumn struct { + // Widget column field. + Field string `json:"field"` + // Widget column width. + Width ListStreamColumnWidth `json:"width"` + // 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{} +} + +// NewListStreamColumn instantiates a new ListStreamColumn 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 NewListStreamColumn(field string, width ListStreamColumnWidth) *ListStreamColumn { + this := ListStreamColumn{} + this.Field = field + this.Width = width + return &this +} + +// NewListStreamColumnWithDefaults instantiates a new ListStreamColumn 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 NewListStreamColumnWithDefaults() *ListStreamColumn { + this := ListStreamColumn{} + return &this +} + +// GetField returns the Field field value. +func (o *ListStreamColumn) GetField() string { + if o == nil { + var ret string + return ret + } + return o.Field +} + +// GetFieldOk returns a tuple with the Field field value +// and a boolean to check if the value has been set. +func (o *ListStreamColumn) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value. +func (o *ListStreamColumn) SetField(v string) { + o.Field = v +} + +// GetWidth returns the Width field value. +func (o *ListStreamColumn) GetWidth() ListStreamColumnWidth { + if o == nil { + var ret ListStreamColumnWidth + return ret + } + return o.Width +} + +// GetWidthOk returns a tuple with the Width field value +// and a boolean to check if the value has been set. +func (o *ListStreamColumn) GetWidthOk() (*ListStreamColumnWidth, bool) { + if o == nil { + return nil, false + } + return &o.Width, true +} + +// SetWidth sets field value. +func (o *ListStreamColumn) SetWidth(v ListStreamColumnWidth) { + o.Width = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ListStreamColumn) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["field"] = o.Field + toSerialize["width"] = o.Width + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ListStreamColumn) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Field *string `json:"field"` + Width *ListStreamColumnWidth `json:"width"` + }{} + all := struct { + Field string `json:"field"` + Width ListStreamColumnWidth `json:"width"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Field == nil { + return fmt.Errorf("Required field field missing") + } + if required.Width == nil { + return fmt.Errorf("Required field width missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Width; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Field = all.Field + o.Width = all.Width + return nil +} diff --git a/api/v1/datadog/model_list_stream_column_width.go b/api/v1/datadog/model_list_stream_column_width.go new file mode 100644 index 00000000000..6024127005e --- /dev/null +++ b/api/v1/datadog/model_list_stream_column_width.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamColumnWidth Widget column width. +type ListStreamColumnWidth string + +// List of ListStreamColumnWidth. +const ( + LISTSTREAMCOLUMNWIDTH_AUTO ListStreamColumnWidth = "auto" + LISTSTREAMCOLUMNWIDTH_COMPACT ListStreamColumnWidth = "compact" + LISTSTREAMCOLUMNWIDTH_FULL ListStreamColumnWidth = "full" +) + +var allowedListStreamColumnWidthEnumValues = []ListStreamColumnWidth{ + LISTSTREAMCOLUMNWIDTH_AUTO, + LISTSTREAMCOLUMNWIDTH_COMPACT, + LISTSTREAMCOLUMNWIDTH_FULL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ListStreamColumnWidth) GetAllowedValues() []ListStreamColumnWidth { + return allowedListStreamColumnWidthEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ListStreamColumnWidth) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ListStreamColumnWidth(value) + return nil +} + +// NewListStreamColumnWidthFromValue returns a pointer to a valid ListStreamColumnWidth +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewListStreamColumnWidthFromValue(v string) (*ListStreamColumnWidth, error) { + ev := ListStreamColumnWidth(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ListStreamColumnWidth: valid values are %v", v, allowedListStreamColumnWidthEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ListStreamColumnWidth) IsValid() bool { + for _, existing := range allowedListStreamColumnWidthEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListStreamColumnWidth value. +func (v ListStreamColumnWidth) Ptr() *ListStreamColumnWidth { + return &v +} + +// NullableListStreamColumnWidth handles when a null is used for ListStreamColumnWidth. +type NullableListStreamColumnWidth struct { + value *ListStreamColumnWidth + isSet bool +} + +// Get returns the associated value. +func (v NullableListStreamColumnWidth) Get() *ListStreamColumnWidth { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableListStreamColumnWidth) Set(val *ListStreamColumnWidth) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableListStreamColumnWidth) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableListStreamColumnWidth) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableListStreamColumnWidth initializes the struct as if Set has been called. +func NewNullableListStreamColumnWidth(val *ListStreamColumnWidth) *NullableListStreamColumnWidth { + return &NullableListStreamColumnWidth{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableListStreamColumnWidth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableListStreamColumnWidth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_list_stream_query.go b/api/v1/datadog/model_list_stream_query.go new file mode 100644 index 00000000000..afc58d07a0f --- /dev/null +++ b/api/v1/datadog/model_list_stream_query.go @@ -0,0 +1,185 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamQuery Updated list stream widget. +type ListStreamQuery struct { + // Source from which to query items to display in the stream. + DataSource ListStreamSource `json:"data_source"` + // List of indexes. + Indexes []string `json:"indexes,omitempty"` + // Widget query. + QueryString string `json:"query_string"` + // 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{} +} + +// NewListStreamQuery instantiates a new ListStreamQuery 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 NewListStreamQuery(dataSource ListStreamSource, queryString string) *ListStreamQuery { + this := ListStreamQuery{} + this.DataSource = dataSource + this.QueryString = queryString + return &this +} + +// NewListStreamQueryWithDefaults instantiates a new ListStreamQuery 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 NewListStreamQueryWithDefaults() *ListStreamQuery { + this := ListStreamQuery{} + var dataSource ListStreamSource = LISTSTREAMSOURCE_APM_ISSUE_STREAM + this.DataSource = dataSource + return &this +} + +// GetDataSource returns the DataSource field value. +func (o *ListStreamQuery) GetDataSource() ListStreamSource { + if o == nil { + var ret ListStreamSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *ListStreamQuery) GetDataSourceOk() (*ListStreamSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *ListStreamQuery) SetDataSource(v ListStreamSource) { + o.DataSource = v +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *ListStreamQuery) GetIndexes() []string { + if o == nil || o.Indexes == nil { + var ret []string + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListStreamQuery) GetIndexesOk() (*[]string, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *ListStreamQuery) HasIndexes() bool { + if o != nil && o.Indexes != nil { + return true + } + + return false +} + +// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. +func (o *ListStreamQuery) SetIndexes(v []string) { + o.Indexes = v +} + +// GetQueryString returns the QueryString field value. +func (o *ListStreamQuery) GetQueryString() string { + if o == nil { + var ret string + return ret + } + return o.QueryString +} + +// GetQueryStringOk returns a tuple with the QueryString field value +// and a boolean to check if the value has been set. +func (o *ListStreamQuery) GetQueryStringOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.QueryString, true +} + +// SetQueryString sets field value. +func (o *ListStreamQuery) SetQueryString(v string) { + o.QueryString = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ListStreamQuery) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data_source"] = o.DataSource + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + toSerialize["query_string"] = o.QueryString + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + DataSource *ListStreamSource `json:"data_source"` + QueryString *string `json:"query_string"` + }{} + all := struct { + DataSource ListStreamSource `json:"data_source"` + Indexes []string `json:"indexes,omitempty"` + QueryString string `json:"query_string"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.QueryString == nil { + return fmt.Errorf("Required field query_string missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DataSource = all.DataSource + o.Indexes = all.Indexes + o.QueryString = all.QueryString + return nil +} diff --git a/api/v1/datadog/model_list_stream_response_format.go b/api/v1/datadog/model_list_stream_response_format.go new file mode 100644 index 00000000000..d33a14ba82d --- /dev/null +++ b/api/v1/datadog/model_list_stream_response_format.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamResponseFormat Widget response format. +type ListStreamResponseFormat string + +// List of ListStreamResponseFormat. +const ( + LISTSTREAMRESPONSEFORMAT_EVENT_LIST ListStreamResponseFormat = "event_list" +) + +var allowedListStreamResponseFormatEnumValues = []ListStreamResponseFormat{ + LISTSTREAMRESPONSEFORMAT_EVENT_LIST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ListStreamResponseFormat) GetAllowedValues() []ListStreamResponseFormat { + return allowedListStreamResponseFormatEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ListStreamResponseFormat) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ListStreamResponseFormat(value) + return nil +} + +// NewListStreamResponseFormatFromValue returns a pointer to a valid ListStreamResponseFormat +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewListStreamResponseFormatFromValue(v string) (*ListStreamResponseFormat, error) { + ev := ListStreamResponseFormat(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ListStreamResponseFormat: valid values are %v", v, allowedListStreamResponseFormatEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ListStreamResponseFormat) IsValid() bool { + for _, existing := range allowedListStreamResponseFormatEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListStreamResponseFormat value. +func (v ListStreamResponseFormat) Ptr() *ListStreamResponseFormat { + return &v +} + +// NullableListStreamResponseFormat handles when a null is used for ListStreamResponseFormat. +type NullableListStreamResponseFormat struct { + value *ListStreamResponseFormat + isSet bool +} + +// Get returns the associated value. +func (v NullableListStreamResponseFormat) Get() *ListStreamResponseFormat { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableListStreamResponseFormat) Set(val *ListStreamResponseFormat) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableListStreamResponseFormat) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableListStreamResponseFormat) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableListStreamResponseFormat initializes the struct as if Set has been called. +func NewNullableListStreamResponseFormat(val *ListStreamResponseFormat) *NullableListStreamResponseFormat { + return &NullableListStreamResponseFormat{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableListStreamResponseFormat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableListStreamResponseFormat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_list_stream_source.go b/api/v1/datadog/model_list_stream_source.go new file mode 100644 index 00000000000..ad40e5d2878 --- /dev/null +++ b/api/v1/datadog/model_list_stream_source.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamSource Source from which to query items to display in the stream. +type ListStreamSource string + +// List of ListStreamSource. +const ( + LISTSTREAMSOURCE_LOGS_STREAM ListStreamSource = "logs_stream" + LISTSTREAMSOURCE_AUDIT_STREAM ListStreamSource = "audit_stream" + LISTSTREAMSOURCE_RUM_ISSUE_STREAM ListStreamSource = "rum_issue_stream" + LISTSTREAMSOURCE_APM_ISSUE_STREAM ListStreamSource = "apm_issue_stream" +) + +var allowedListStreamSourceEnumValues = []ListStreamSource{ + LISTSTREAMSOURCE_LOGS_STREAM, + LISTSTREAMSOURCE_AUDIT_STREAM, + LISTSTREAMSOURCE_RUM_ISSUE_STREAM, + LISTSTREAMSOURCE_APM_ISSUE_STREAM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ListStreamSource) GetAllowedValues() []ListStreamSource { + return allowedListStreamSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ListStreamSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ListStreamSource(value) + return nil +} + +// NewListStreamSourceFromValue returns a pointer to a valid ListStreamSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewListStreamSourceFromValue(v string) (*ListStreamSource, error) { + ev := ListStreamSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ListStreamSource: valid values are %v", v, allowedListStreamSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ListStreamSource) IsValid() bool { + for _, existing := range allowedListStreamSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListStreamSource value. +func (v ListStreamSource) Ptr() *ListStreamSource { + return &v +} + +// NullableListStreamSource handles when a null is used for ListStreamSource. +type NullableListStreamSource struct { + value *ListStreamSource + isSet bool +} + +// Get returns the associated value. +func (v NullableListStreamSource) Get() *ListStreamSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableListStreamSource) Set(val *ListStreamSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableListStreamSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableListStreamSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableListStreamSource initializes the struct as if Set has been called. +func NewNullableListStreamSource(val *ListStreamSource) *NullableListStreamSource { + return &NullableListStreamSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableListStreamSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableListStreamSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_list_stream_widget_definition.go b/api/v1/datadog/model_list_stream_widget_definition.go new file mode 100644 index 00000000000..f481dd31dc2 --- /dev/null +++ b/api/v1/datadog/model_list_stream_widget_definition.go @@ -0,0 +1,397 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamWidgetDefinition The list stream visualization displays a table of recent events in your application that +// match a search criteria using user-defined columns. +// +type ListStreamWidgetDefinition struct { + // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". + LegendSize *string `json:"legend_size,omitempty"` + // Request payload used to query items. + Requests []ListStreamWidgetRequest `json:"requests"` + // Whether or not to display the legend on this widget. + ShowLegend *bool `json:"show_legend,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the list stream widget. + Type ListStreamWidgetDefinitionType `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{} +} + +// NewListStreamWidgetDefinition instantiates a new ListStreamWidgetDefinition 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 NewListStreamWidgetDefinition(requests []ListStreamWidgetRequest, typeVar ListStreamWidgetDefinitionType) *ListStreamWidgetDefinition { + this := ListStreamWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewListStreamWidgetDefinitionWithDefaults instantiates a new ListStreamWidgetDefinition 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 NewListStreamWidgetDefinitionWithDefaults() *ListStreamWidgetDefinition { + this := ListStreamWidgetDefinition{} + var typeVar ListStreamWidgetDefinitionType = LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM + this.Type = typeVar + return &this +} + +// GetLegendSize returns the LegendSize field value if set, zero value otherwise. +func (o *ListStreamWidgetDefinition) GetLegendSize() string { + if o == nil || o.LegendSize == nil { + var ret string + return ret + } + return *o.LegendSize +} + +// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetDefinition) GetLegendSizeOk() (*string, bool) { + if o == nil || o.LegendSize == nil { + return nil, false + } + return o.LegendSize, true +} + +// HasLegendSize returns a boolean if a field has been set. +func (o *ListStreamWidgetDefinition) HasLegendSize() bool { + if o != nil && o.LegendSize != nil { + return true + } + + return false +} + +// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. +func (o *ListStreamWidgetDefinition) SetLegendSize(v string) { + o.LegendSize = &v +} + +// GetRequests returns the Requests field value. +func (o *ListStreamWidgetDefinition) GetRequests() []ListStreamWidgetRequest { + if o == nil { + var ret []ListStreamWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetDefinition) GetRequestsOk() (*[]ListStreamWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *ListStreamWidgetDefinition) SetRequests(v []ListStreamWidgetRequest) { + o.Requests = v +} + +// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. +func (o *ListStreamWidgetDefinition) GetShowLegend() bool { + if o == nil || o.ShowLegend == nil { + var ret bool + return ret + } + return *o.ShowLegend +} + +// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetDefinition) GetShowLegendOk() (*bool, bool) { + if o == nil || o.ShowLegend == nil { + return nil, false + } + return o.ShowLegend, true +} + +// HasShowLegend returns a boolean if a field has been set. +func (o *ListStreamWidgetDefinition) HasShowLegend() bool { + if o != nil && o.ShowLegend != nil { + return true + } + + return false +} + +// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. +func (o *ListStreamWidgetDefinition) SetShowLegend(v bool) { + o.ShowLegend = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *ListStreamWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *ListStreamWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *ListStreamWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *ListStreamWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *ListStreamWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *ListStreamWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *ListStreamWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *ListStreamWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *ListStreamWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *ListStreamWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *ListStreamWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *ListStreamWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *ListStreamWidgetDefinition) GetType() ListStreamWidgetDefinitionType { + if o == nil { + var ret ListStreamWidgetDefinitionType + 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 *ListStreamWidgetDefinition) GetTypeOk() (*ListStreamWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ListStreamWidgetDefinition) SetType(v ListStreamWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ListStreamWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LegendSize != nil { + toSerialize["legend_size"] = o.LegendSize + } + toSerialize["requests"] = o.Requests + if o.ShowLegend != nil { + toSerialize["show_legend"] = o.ShowLegend + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]ListStreamWidgetRequest `json:"requests"` + Type *ListStreamWidgetDefinitionType `json:"type"` + }{} + all := struct { + LegendSize *string `json:"legend_size,omitempty"` + Requests []ListStreamWidgetRequest `json:"requests"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type ListStreamWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LegendSize = all.LegendSize + o.Requests = all.Requests + o.ShowLegend = all.ShowLegend + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_list_stream_widget_definition_type.go b/api/v1/datadog/model_list_stream_widget_definition_type.go new file mode 100644 index 00000000000..fcaf6165822 --- /dev/null +++ b/api/v1/datadog/model_list_stream_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamWidgetDefinitionType Type of the list stream widget. +type ListStreamWidgetDefinitionType string + +// List of ListStreamWidgetDefinitionType. +const ( + LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM ListStreamWidgetDefinitionType = "list_stream" +) + +var allowedListStreamWidgetDefinitionTypeEnumValues = []ListStreamWidgetDefinitionType{ + LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ListStreamWidgetDefinitionType) GetAllowedValues() []ListStreamWidgetDefinitionType { + return allowedListStreamWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ListStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ListStreamWidgetDefinitionType(value) + return nil +} + +// NewListStreamWidgetDefinitionTypeFromValue returns a pointer to a valid ListStreamWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewListStreamWidgetDefinitionTypeFromValue(v string) (*ListStreamWidgetDefinitionType, error) { + ev := ListStreamWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ListStreamWidgetDefinitionType: valid values are %v", v, allowedListStreamWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ListStreamWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedListStreamWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListStreamWidgetDefinitionType value. +func (v ListStreamWidgetDefinitionType) Ptr() *ListStreamWidgetDefinitionType { + return &v +} + +// NullableListStreamWidgetDefinitionType handles when a null is used for ListStreamWidgetDefinitionType. +type NullableListStreamWidgetDefinitionType struct { + value *ListStreamWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableListStreamWidgetDefinitionType) Get() *ListStreamWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableListStreamWidgetDefinitionType) Set(val *ListStreamWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableListStreamWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableListStreamWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableListStreamWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableListStreamWidgetDefinitionType(val *ListStreamWidgetDefinitionType) *NullableListStreamWidgetDefinitionType { + return &NullableListStreamWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableListStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableListStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_list_stream_widget_request.go b/api/v1/datadog/model_list_stream_widget_request.go new file mode 100644 index 00000000000..0e738397ba1 --- /dev/null +++ b/api/v1/datadog/model_list_stream_widget_request.go @@ -0,0 +1,184 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ListStreamWidgetRequest Updated list stream widget. +type ListStreamWidgetRequest struct { + // Widget columns. + Columns []ListStreamColumn `json:"columns"` + // Updated list stream widget. + Query ListStreamQuery `json:"query"` + // Widget response format. + ResponseFormat ListStreamResponseFormat `json:"response_format"` + // 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{} +} + +// NewListStreamWidgetRequest instantiates a new ListStreamWidgetRequest 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 NewListStreamWidgetRequest(columns []ListStreamColumn, query ListStreamQuery, responseFormat ListStreamResponseFormat) *ListStreamWidgetRequest { + this := ListStreamWidgetRequest{} + this.Columns = columns + this.Query = query + this.ResponseFormat = responseFormat + return &this +} + +// NewListStreamWidgetRequestWithDefaults instantiates a new ListStreamWidgetRequest 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 NewListStreamWidgetRequestWithDefaults() *ListStreamWidgetRequest { + this := ListStreamWidgetRequest{} + return &this +} + +// GetColumns returns the Columns field value. +func (o *ListStreamWidgetRequest) GetColumns() []ListStreamColumn { + if o == nil { + var ret []ListStreamColumn + return ret + } + return o.Columns +} + +// GetColumnsOk returns a tuple with the Columns field value +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetRequest) GetColumnsOk() (*[]ListStreamColumn, bool) { + if o == nil { + return nil, false + } + return &o.Columns, true +} + +// SetColumns sets field value. +func (o *ListStreamWidgetRequest) SetColumns(v []ListStreamColumn) { + o.Columns = v +} + +// GetQuery returns the Query field value. +func (o *ListStreamWidgetRequest) GetQuery() ListStreamQuery { + if o == nil { + var ret ListStreamQuery + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetRequest) GetQueryOk() (*ListStreamQuery, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *ListStreamWidgetRequest) SetQuery(v ListStreamQuery) { + o.Query = v +} + +// GetResponseFormat returns the ResponseFormat field value. +func (o *ListStreamWidgetRequest) GetResponseFormat() ListStreamResponseFormat { + if o == nil { + var ret ListStreamResponseFormat + return ret + } + return o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value +// and a boolean to check if the value has been set. +func (o *ListStreamWidgetRequest) GetResponseFormatOk() (*ListStreamResponseFormat, bool) { + if o == nil { + return nil, false + } + return &o.ResponseFormat, true +} + +// SetResponseFormat sets field value. +func (o *ListStreamWidgetRequest) SetResponseFormat(v ListStreamResponseFormat) { + o.ResponseFormat = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ListStreamWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["columns"] = o.Columns + toSerialize["query"] = o.Query + toSerialize["response_format"] = o.ResponseFormat + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Columns *[]ListStreamColumn `json:"columns"` + Query *ListStreamQuery `json:"query"` + ResponseFormat *ListStreamResponseFormat `json:"response_format"` + }{} + all := struct { + Columns []ListStreamColumn `json:"columns"` + Query ListStreamQuery `json:"query"` + ResponseFormat ListStreamResponseFormat `json:"response_format"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Columns == nil { + return fmt.Errorf("Required field columns missing") + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + if required.ResponseFormat == nil { + return fmt.Errorf("Required field response_format missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Columns = all.Columns + if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Query = all.Query + o.ResponseFormat = all.ResponseFormat + return nil +} diff --git a/api/v1/datadog/model_log.go b/api/v1/datadog/model_log.go new file mode 100644 index 00000000000..44e2ad26bcc --- /dev/null +++ b/api/v1/datadog/model_log.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 datadog + +import ( + "encoding/json" +) + +// Log Object describing a log after being processed and stored by Datadog. +type Log struct { + // JSON object containing all log attributes and their associated values. + Content *LogContent `json:"content,omitempty"` + // Unique ID of the Log. + Id *string `json:"id,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{} +} + +// NewLog instantiates a new Log 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 NewLog() *Log { + this := Log{} + return &this +} + +// NewLogWithDefaults instantiates a new Log 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 NewLogWithDefaults() *Log { + this := Log{} + return &this +} + +// GetContent returns the Content field value if set, zero value otherwise. +func (o *Log) GetContent() LogContent { + if o == nil || o.Content == nil { + var ret LogContent + return ret + } + return *o.Content +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Log) GetContentOk() (*LogContent, bool) { + if o == nil || o.Content == nil { + return nil, false + } + return o.Content, true +} + +// HasContent returns a boolean if a field has been set. +func (o *Log) HasContent() bool { + if o != nil && o.Content != nil { + return true + } + + return false +} + +// SetContent gets a reference to the given LogContent and assigns it to the Content field. +func (o *Log) SetContent(v LogContent) { + o.Content = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Log) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Log) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Log) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Log) SetId(v string) { + o.Id = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Log) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Content != nil { + toSerialize["content"] = o.Content + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Log) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Content *LogContent `json:"content,omitempty"` + Id *string `json:"id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Content != nil && all.Content.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Content = all.Content + o.Id = all.Id + return nil +} diff --git a/api/v1/datadog/model_log_content.go b/api/v1/datadog/model_log_content.go new file mode 100644 index 00000000000..72c70cede33 --- /dev/null +++ b/api/v1/datadog/model_log_content.go @@ -0,0 +1,306 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// LogContent JSON object containing all log attributes and their associated values. +type LogContent struct { + // JSON object of attributes from your log. + Attributes map[string]interface{} `json:"attributes,omitempty"` + // Name of the machine from where the logs are being sent. + Host *string `json:"host,omitempty"` + // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) + // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. + // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. + Message *string `json:"message,omitempty"` + // The name of the application or service generating the log events. + // It is used to switch from Logs to APM, so make sure you define the same + // value when you use both products. + Service *string `json:"service,omitempty"` + // Array of tags associated with your log. + Tags []string `json:"tags,omitempty"` + // Timestamp of your log. + Timestamp *time.Time `json:"timestamp,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{} +} + +// NewLogContent instantiates a new LogContent 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 NewLogContent() *LogContent { + this := LogContent{} + return &this +} + +// NewLogContentWithDefaults instantiates a new LogContent 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 NewLogContentWithDefaults() *LogContent { + this := LogContent{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *LogContent) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogContent) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *LogContent) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *LogContent) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *LogContent) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogContent) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *LogContent) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *LogContent) SetHost(v string) { + o.Host = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *LogContent) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogContent) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *LogContent) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *LogContent) SetMessage(v string) { + o.Message = &v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *LogContent) 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 *LogContent) 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 *LogContent) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *LogContent) SetService(v string) { + o.Service = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *LogContent) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *LogContent) GetTagsOk() (*[]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 *LogContent) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *LogContent) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *LogContent) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogContent) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *LogContent) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *LogContent) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogContent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogContent) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` + Host *string `json:"host,omitempty"` + Message *string `json:"message,omitempty"` + Service *string `json:"service,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Host = all.Host + o.Message = all.Message + o.Service = all.Service + o.Tags = all.Tags + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v1/datadog/model_log_query_definition.go b/api/v1/datadog/model_log_query_definition.go new file mode 100644 index 00000000000..5ea75c2aed1 --- /dev/null +++ b/api/v1/datadog/model_log_query_definition.go @@ -0,0 +1,272 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogQueryDefinition The log query. +type LogQueryDefinition struct { + // Define computation for a log query. + Compute *LogsQueryCompute `json:"compute,omitempty"` + // List of tag prefixes to group by in the case of a cluster check. + GroupBy []LogQueryDefinitionGroupBy `json:"group_by,omitempty"` + // A coma separated-list of index names. Use "*" query all indexes at once. [Multiple Indexes](https://docs.datadoghq.com/logs/indexes/#multiple-indexes) + Index *string `json:"index,omitempty"` + // This field is mutually exclusive with `compute`. + MultiCompute []LogsQueryCompute `json:"multi_compute,omitempty"` + // The query being made on the logs. + Search *LogQueryDefinitionSearch `json:"search,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{} +} + +// NewLogQueryDefinition instantiates a new LogQueryDefinition 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 NewLogQueryDefinition() *LogQueryDefinition { + this := LogQueryDefinition{} + return &this +} + +// NewLogQueryDefinitionWithDefaults instantiates a new LogQueryDefinition 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 NewLogQueryDefinitionWithDefaults() *LogQueryDefinition { + this := LogQueryDefinition{} + return &this +} + +// GetCompute returns the Compute field value if set, zero value otherwise. +func (o *LogQueryDefinition) GetCompute() LogsQueryCompute { + if o == nil || o.Compute == nil { + var ret LogsQueryCompute + return ret + } + return *o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinition) GetComputeOk() (*LogsQueryCompute, bool) { + if o == nil || o.Compute == nil { + return nil, false + } + return o.Compute, true +} + +// HasCompute returns a boolean if a field has been set. +func (o *LogQueryDefinition) HasCompute() bool { + if o != nil && o.Compute != nil { + return true + } + + return false +} + +// SetCompute gets a reference to the given LogsQueryCompute and assigns it to the Compute field. +func (o *LogQueryDefinition) SetCompute(v LogsQueryCompute) { + o.Compute = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *LogQueryDefinition) GetGroupBy() []LogQueryDefinitionGroupBy { + if o == nil || o.GroupBy == nil { + var ret []LogQueryDefinitionGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinition) GetGroupByOk() (*[]LogQueryDefinitionGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *LogQueryDefinition) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []LogQueryDefinitionGroupBy and assigns it to the GroupBy field. +func (o *LogQueryDefinition) SetGroupBy(v []LogQueryDefinitionGroupBy) { + o.GroupBy = v +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *LogQueryDefinition) GetIndex() string { + if o == nil || o.Index == nil { + var ret string + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinition) GetIndexOk() (*string, bool) { + if o == nil || o.Index == nil { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *LogQueryDefinition) HasIndex() bool { + if o != nil && o.Index != nil { + return true + } + + return false +} + +// SetIndex gets a reference to the given string and assigns it to the Index field. +func (o *LogQueryDefinition) SetIndex(v string) { + o.Index = &v +} + +// GetMultiCompute returns the MultiCompute field value if set, zero value otherwise. +func (o *LogQueryDefinition) GetMultiCompute() []LogsQueryCompute { + if o == nil || o.MultiCompute == nil { + var ret []LogsQueryCompute + return ret + } + return o.MultiCompute +} + +// GetMultiComputeOk returns a tuple with the MultiCompute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinition) GetMultiComputeOk() (*[]LogsQueryCompute, bool) { + if o == nil || o.MultiCompute == nil { + return nil, false + } + return &o.MultiCompute, true +} + +// HasMultiCompute returns a boolean if a field has been set. +func (o *LogQueryDefinition) HasMultiCompute() bool { + if o != nil && o.MultiCompute != nil { + return true + } + + return false +} + +// SetMultiCompute gets a reference to the given []LogsQueryCompute and assigns it to the MultiCompute field. +func (o *LogQueryDefinition) SetMultiCompute(v []LogsQueryCompute) { + o.MultiCompute = v +} + +// GetSearch returns the Search field value if set, zero value otherwise. +func (o *LogQueryDefinition) GetSearch() LogQueryDefinitionSearch { + if o == nil || o.Search == nil { + var ret LogQueryDefinitionSearch + return ret + } + return *o.Search +} + +// GetSearchOk returns a tuple with the Search field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinition) GetSearchOk() (*LogQueryDefinitionSearch, bool) { + if o == nil || o.Search == nil { + return nil, false + } + return o.Search, true +} + +// HasSearch returns a boolean if a field has been set. +func (o *LogQueryDefinition) HasSearch() bool { + if o != nil && o.Search != nil { + return true + } + + return false +} + +// SetSearch gets a reference to the given LogQueryDefinitionSearch and assigns it to the Search field. +func (o *LogQueryDefinition) SetSearch(v LogQueryDefinitionSearch) { + o.Search = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Compute != nil { + toSerialize["compute"] = o.Compute + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Index != nil { + toSerialize["index"] = o.Index + } + if o.MultiCompute != nil { + toSerialize["multi_compute"] = o.MultiCompute + } + if o.Search != nil { + toSerialize["search"] = o.Search + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Compute *LogsQueryCompute `json:"compute,omitempty"` + GroupBy []LogQueryDefinitionGroupBy `json:"group_by,omitempty"` + Index *string `json:"index,omitempty"` + MultiCompute []LogsQueryCompute `json:"multi_compute,omitempty"` + Search *LogQueryDefinitionSearch `json:"search,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Compute = all.Compute + o.GroupBy = all.GroupBy + o.Index = all.Index + o.MultiCompute = all.MultiCompute + if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Search = all.Search + return nil +} diff --git a/api/v1/datadog/model_log_query_definition_group_by.go b/api/v1/datadog/model_log_query_definition_group_by.go new file mode 100644 index 00000000000..dff6a22ac8c --- /dev/null +++ b/api/v1/datadog/model_log_query_definition_group_by.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogQueryDefinitionGroupBy Defined items in the group. +type LogQueryDefinitionGroupBy struct { + // Facet name. + Facet string `json:"facet"` + // Maximum number of items in the group. + Limit *int64 `json:"limit,omitempty"` + // Define a sorting method. + Sort *LogQueryDefinitionGroupBySort `json:"sort,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{} +} + +// NewLogQueryDefinitionGroupBy instantiates a new LogQueryDefinitionGroupBy 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 NewLogQueryDefinitionGroupBy(facet string) *LogQueryDefinitionGroupBy { + this := LogQueryDefinitionGroupBy{} + this.Facet = facet + return &this +} + +// NewLogQueryDefinitionGroupByWithDefaults instantiates a new LogQueryDefinitionGroupBy 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 NewLogQueryDefinitionGroupByWithDefaults() *LogQueryDefinitionGroupBy { + this := LogQueryDefinitionGroupBy{} + return &this +} + +// GetFacet returns the Facet field value. +func (o *LogQueryDefinitionGroupBy) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *LogQueryDefinitionGroupBy) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *LogQueryDefinitionGroupBy) SetFacet(v string) { + o.Facet = v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *LogQueryDefinitionGroupBy) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinitionGroupBy) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *LogQueryDefinitionGroupBy) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *LogQueryDefinitionGroupBy) SetLimit(v int64) { + o.Limit = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *LogQueryDefinitionGroupBy) GetSort() LogQueryDefinitionGroupBySort { + if o == nil || o.Sort == nil { + var ret LogQueryDefinitionGroupBySort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinitionGroupBy) GetSortOk() (*LogQueryDefinitionGroupBySort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *LogQueryDefinitionGroupBy) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given LogQueryDefinitionGroupBySort and assigns it to the Sort field. +func (o *LogQueryDefinitionGroupBy) SetSort(v LogQueryDefinitionGroupBySort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogQueryDefinitionGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogQueryDefinitionGroupBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Facet *string `json:"facet"` + }{} + all := struct { + Facet string `json:"facet"` + Limit *int64 `json:"limit,omitempty"` + Sort *LogQueryDefinitionGroupBySort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Facet == nil { + return fmt.Errorf("Required field facet missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Facet = all.Facet + o.Limit = all.Limit + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Sort = all.Sort + return nil +} diff --git a/api/v1/datadog/model_log_query_definition_group_by_sort.go b/api/v1/datadog/model_log_query_definition_group_by_sort.go new file mode 100644 index 00000000000..07580ade9fe --- /dev/null +++ b/api/v1/datadog/model_log_query_definition_group_by_sort.go @@ -0,0 +1,183 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogQueryDefinitionGroupBySort Define a sorting method. +type LogQueryDefinitionGroupBySort struct { + // The aggregation method. + Aggregation string `json:"aggregation"` + // Facet name. + Facet *string `json:"facet,omitempty"` + // Widget sorting methods. + Order WidgetSort `json:"order"` + // 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{} +} + +// NewLogQueryDefinitionGroupBySort instantiates a new LogQueryDefinitionGroupBySort 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 NewLogQueryDefinitionGroupBySort(aggregation string, order WidgetSort) *LogQueryDefinitionGroupBySort { + this := LogQueryDefinitionGroupBySort{} + this.Aggregation = aggregation + this.Order = order + return &this +} + +// NewLogQueryDefinitionGroupBySortWithDefaults instantiates a new LogQueryDefinitionGroupBySort 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 NewLogQueryDefinitionGroupBySortWithDefaults() *LogQueryDefinitionGroupBySort { + this := LogQueryDefinitionGroupBySort{} + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *LogQueryDefinitionGroupBySort) GetAggregation() string { + if o == nil { + var ret string + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *LogQueryDefinitionGroupBySort) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *LogQueryDefinitionGroupBySort) SetAggregation(v string) { + o.Aggregation = v +} + +// GetFacet returns the Facet field value if set, zero value otherwise. +func (o *LogQueryDefinitionGroupBySort) GetFacet() string { + if o == nil || o.Facet == nil { + var ret string + return ret + } + return *o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogQueryDefinitionGroupBySort) GetFacetOk() (*string, bool) { + if o == nil || o.Facet == nil { + return nil, false + } + return o.Facet, true +} + +// HasFacet returns a boolean if a field has been set. +func (o *LogQueryDefinitionGroupBySort) HasFacet() bool { + if o != nil && o.Facet != nil { + return true + } + + return false +} + +// SetFacet gets a reference to the given string and assigns it to the Facet field. +func (o *LogQueryDefinitionGroupBySort) SetFacet(v string) { + o.Facet = &v +} + +// GetOrder returns the Order field value. +func (o *LogQueryDefinitionGroupBySort) GetOrder() WidgetSort { + if o == nil { + var ret WidgetSort + return ret + } + return o.Order +} + +// GetOrderOk returns a tuple with the Order field value +// and a boolean to check if the value has been set. +func (o *LogQueryDefinitionGroupBySort) GetOrderOk() (*WidgetSort, bool) { + if o == nil { + return nil, false + } + return &o.Order, true +} + +// SetOrder sets field value. +func (o *LogQueryDefinitionGroupBySort) SetOrder(v WidgetSort) { + o.Order = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogQueryDefinitionGroupBySort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Facet != nil { + toSerialize["facet"] = o.Facet + } + toSerialize["order"] = o.Order + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogQueryDefinitionGroupBySort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *string `json:"aggregation"` + Order *WidgetSort `json:"order"` + }{} + all := struct { + Aggregation string `json:"aggregation"` + Facet *string `json:"facet,omitempty"` + Order WidgetSort `json:"order"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + if required.Order == nil { + return fmt.Errorf("Required field order missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Facet = all.Facet + o.Order = all.Order + return nil +} diff --git a/api/v1/datadog/model_log_query_definition_search.go b/api/v1/datadog/model_log_query_definition_search.go new file mode 100644 index 00000000000..0bea0063686 --- /dev/null +++ b/api/v1/datadog/model_log_query_definition_search.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogQueryDefinitionSearch The query being made on the logs. +type LogQueryDefinitionSearch struct { + // Search value to apply. + Query string `json:"query"` + // 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{} +} + +// NewLogQueryDefinitionSearch instantiates a new LogQueryDefinitionSearch 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 NewLogQueryDefinitionSearch(query string) *LogQueryDefinitionSearch { + this := LogQueryDefinitionSearch{} + this.Query = query + return &this +} + +// NewLogQueryDefinitionSearchWithDefaults instantiates a new LogQueryDefinitionSearch 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 NewLogQueryDefinitionSearchWithDefaults() *LogQueryDefinitionSearch { + this := LogQueryDefinitionSearch{} + return &this +} + +// GetQuery returns the Query field value. +func (o *LogQueryDefinitionSearch) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *LogQueryDefinitionSearch) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *LogQueryDefinitionSearch) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogQueryDefinitionSearch) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + }{} + all := struct { + Query string `json:"query"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + return nil +} diff --git a/api/v1/datadog/model_log_stream_widget_definition.go b/api/v1/datadog/model_log_stream_widget_definition.go new file mode 100644 index 00000000000..9b07b7075a1 --- /dev/null +++ b/api/v1/datadog/model_log_stream_widget_definition.go @@ -0,0 +1,615 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogStreamWidgetDefinition The Log Stream displays a log flow matching the defined query. Only available on FREE layout dashboards. +type LogStreamWidgetDefinition struct { + // Which columns to display on the widget. + Columns []string `json:"columns,omitempty"` + // An array of index names to query in the stream. Use [] to query all indexes at once. + Indexes []string `json:"indexes,omitempty"` + // ID of the log set to use. + // Deprecated + Logset *string `json:"logset,omitempty"` + // Amount of log lines to display + MessageDisplay *WidgetMessageDisplay `json:"message_display,omitempty"` + // Query to filter the log stream with. + Query *string `json:"query,omitempty"` + // Whether to show the date column or not + ShowDateColumn *bool `json:"show_date_column,omitempty"` + // Whether to show the message column or not + ShowMessageColumn *bool `json:"show_message_column,omitempty"` + // Which column and order to sort by + Sort *WidgetFieldSort `json:"sort,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the log stream widget. + Type LogStreamWidgetDefinitionType `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{} +} + +// NewLogStreamWidgetDefinition instantiates a new LogStreamWidgetDefinition 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 NewLogStreamWidgetDefinition(typeVar LogStreamWidgetDefinitionType) *LogStreamWidgetDefinition { + this := LogStreamWidgetDefinition{} + this.Type = typeVar + return &this +} + +// NewLogStreamWidgetDefinitionWithDefaults instantiates a new LogStreamWidgetDefinition 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 NewLogStreamWidgetDefinitionWithDefaults() *LogStreamWidgetDefinition { + this := LogStreamWidgetDefinition{} + var typeVar LogStreamWidgetDefinitionType = LOGSTREAMWIDGETDEFINITIONTYPE_LOG_STREAM + this.Type = typeVar + return &this +} + +// GetColumns returns the Columns field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetColumns() []string { + if o == nil || o.Columns == nil { + var ret []string + return ret + } + return o.Columns +} + +// GetColumnsOk returns a tuple with the Columns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetColumnsOk() (*[]string, bool) { + if o == nil || o.Columns == nil { + return nil, false + } + return &o.Columns, true +} + +// HasColumns returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasColumns() bool { + if o != nil && o.Columns != nil { + return true + } + + return false +} + +// SetColumns gets a reference to the given []string and assigns it to the Columns field. +func (o *LogStreamWidgetDefinition) SetColumns(v []string) { + o.Columns = v +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetIndexes() []string { + if o == nil || o.Indexes == nil { + var ret []string + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetIndexesOk() (*[]string, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasIndexes() bool { + if o != nil && o.Indexes != nil { + return true + } + + return false +} + +// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. +func (o *LogStreamWidgetDefinition) SetIndexes(v []string) { + o.Indexes = v +} + +// GetLogset returns the Logset field value if set, zero value otherwise. +// Deprecated +func (o *LogStreamWidgetDefinition) GetLogset() string { + if o == nil || o.Logset == nil { + var ret string + return ret + } + return *o.Logset +} + +// GetLogsetOk returns a tuple with the Logset field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *LogStreamWidgetDefinition) GetLogsetOk() (*string, bool) { + if o == nil || o.Logset == nil { + return nil, false + } + return o.Logset, true +} + +// HasLogset returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasLogset() bool { + if o != nil && o.Logset != nil { + return true + } + + return false +} + +// SetLogset gets a reference to the given string and assigns it to the Logset field. +// Deprecated +func (o *LogStreamWidgetDefinition) SetLogset(v string) { + o.Logset = &v +} + +// GetMessageDisplay returns the MessageDisplay field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetMessageDisplay() WidgetMessageDisplay { + if o == nil || o.MessageDisplay == nil { + var ret WidgetMessageDisplay + return ret + } + return *o.MessageDisplay +} + +// GetMessageDisplayOk returns a tuple with the MessageDisplay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetMessageDisplayOk() (*WidgetMessageDisplay, bool) { + if o == nil || o.MessageDisplay == nil { + return nil, false + } + return o.MessageDisplay, true +} + +// HasMessageDisplay returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasMessageDisplay() bool { + if o != nil && o.MessageDisplay != nil { + return true + } + + return false +} + +// SetMessageDisplay gets a reference to the given WidgetMessageDisplay and assigns it to the MessageDisplay field. +func (o *LogStreamWidgetDefinition) SetMessageDisplay(v WidgetMessageDisplay) { + o.MessageDisplay = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *LogStreamWidgetDefinition) SetQuery(v string) { + o.Query = &v +} + +// GetShowDateColumn returns the ShowDateColumn field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetShowDateColumn() bool { + if o == nil || o.ShowDateColumn == nil { + var ret bool + return ret + } + return *o.ShowDateColumn +} + +// GetShowDateColumnOk returns a tuple with the ShowDateColumn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetShowDateColumnOk() (*bool, bool) { + if o == nil || o.ShowDateColumn == nil { + return nil, false + } + return o.ShowDateColumn, true +} + +// HasShowDateColumn returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasShowDateColumn() bool { + if o != nil && o.ShowDateColumn != nil { + return true + } + + return false +} + +// SetShowDateColumn gets a reference to the given bool and assigns it to the ShowDateColumn field. +func (o *LogStreamWidgetDefinition) SetShowDateColumn(v bool) { + o.ShowDateColumn = &v +} + +// GetShowMessageColumn returns the ShowMessageColumn field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetShowMessageColumn() bool { + if o == nil || o.ShowMessageColumn == nil { + var ret bool + return ret + } + return *o.ShowMessageColumn +} + +// GetShowMessageColumnOk returns a tuple with the ShowMessageColumn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetShowMessageColumnOk() (*bool, bool) { + if o == nil || o.ShowMessageColumn == nil { + return nil, false + } + return o.ShowMessageColumn, true +} + +// HasShowMessageColumn returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasShowMessageColumn() bool { + if o != nil && o.ShowMessageColumn != nil { + return true + } + + return false +} + +// SetShowMessageColumn gets a reference to the given bool and assigns it to the ShowMessageColumn field. +func (o *LogStreamWidgetDefinition) SetShowMessageColumn(v bool) { + o.ShowMessageColumn = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetSort() WidgetFieldSort { + if o == nil || o.Sort == nil { + var ret WidgetFieldSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetSortOk() (*WidgetFieldSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given WidgetFieldSort and assigns it to the Sort field. +func (o *LogStreamWidgetDefinition) SetSort(v WidgetFieldSort) { + o.Sort = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *LogStreamWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *LogStreamWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *LogStreamWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *LogStreamWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogStreamWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *LogStreamWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *LogStreamWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *LogStreamWidgetDefinition) GetType() LogStreamWidgetDefinitionType { + if o == nil { + var ret LogStreamWidgetDefinitionType + 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 *LogStreamWidgetDefinition) GetTypeOk() (*LogStreamWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogStreamWidgetDefinition) SetType(v LogStreamWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogStreamWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Columns != nil { + toSerialize["columns"] = o.Columns + } + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + if o.Logset != nil { + toSerialize["logset"] = o.Logset + } + if o.MessageDisplay != nil { + toSerialize["message_display"] = o.MessageDisplay + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.ShowDateColumn != nil { + toSerialize["show_date_column"] = o.ShowDateColumn + } + if o.ShowMessageColumn != nil { + toSerialize["show_message_column"] = o.ShowMessageColumn + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *LogStreamWidgetDefinitionType `json:"type"` + }{} + all := struct { + Columns []string `json:"columns,omitempty"` + Indexes []string `json:"indexes,omitempty"` + Logset *string `json:"logset,omitempty"` + MessageDisplay *WidgetMessageDisplay `json:"message_display,omitempty"` + Query *string `json:"query,omitempty"` + ShowDateColumn *bool `json:"show_date_column,omitempty"` + ShowMessageColumn *bool `json:"show_message_column,omitempty"` + Sort *WidgetFieldSort `json:"sort,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type LogStreamWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.MessageDisplay; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Columns = all.Columns + o.Indexes = all.Indexes + o.Logset = all.Logset + o.MessageDisplay = all.MessageDisplay + o.Query = all.Query + o.ShowDateColumn = all.ShowDateColumn + o.ShowMessageColumn = all.ShowMessageColumn + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Sort = all.Sort + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_log_stream_widget_definition_type.go b/api/v1/datadog/model_log_stream_widget_definition_type.go new file mode 100644 index 00000000000..3edcb490175 --- /dev/null +++ b/api/v1/datadog/model_log_stream_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogStreamWidgetDefinitionType Type of the log stream widget. +type LogStreamWidgetDefinitionType string + +// List of LogStreamWidgetDefinitionType. +const ( + LOGSTREAMWIDGETDEFINITIONTYPE_LOG_STREAM LogStreamWidgetDefinitionType = "log_stream" +) + +var allowedLogStreamWidgetDefinitionTypeEnumValues = []LogStreamWidgetDefinitionType{ + LOGSTREAMWIDGETDEFINITIONTYPE_LOG_STREAM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogStreamWidgetDefinitionType) GetAllowedValues() []LogStreamWidgetDefinitionType { + return allowedLogStreamWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogStreamWidgetDefinitionType(value) + return nil +} + +// NewLogStreamWidgetDefinitionTypeFromValue returns a pointer to a valid LogStreamWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogStreamWidgetDefinitionTypeFromValue(v string) (*LogStreamWidgetDefinitionType, error) { + ev := LogStreamWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogStreamWidgetDefinitionType: valid values are %v", v, allowedLogStreamWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogStreamWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedLogStreamWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogStreamWidgetDefinitionType value. +func (v LogStreamWidgetDefinitionType) Ptr() *LogStreamWidgetDefinitionType { + return &v +} + +// NullableLogStreamWidgetDefinitionType handles when a null is used for LogStreamWidgetDefinitionType. +type NullableLogStreamWidgetDefinitionType struct { + value *LogStreamWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogStreamWidgetDefinitionType) Get() *LogStreamWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogStreamWidgetDefinitionType) Set(val *LogStreamWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogStreamWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogStreamWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogStreamWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableLogStreamWidgetDefinitionType(val *LogStreamWidgetDefinitionType) *NullableLogStreamWidgetDefinitionType { + return &NullableLogStreamWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogStreamWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogStreamWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_api_error.go b/api/v1/datadog/model_logs_api_error.go new file mode 100644 index 00000000000..e74552885cd --- /dev/null +++ b/api/v1/datadog/model_logs_api_error.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAPIError Error returned by the Logs API +type LogsAPIError struct { + // Code identifying the error + Code *string `json:"code,omitempty"` + // Additional error details + Details []LogsAPIError `json:"details,omitempty"` + // Error message + Message *string `json:"message,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{} +} + +// NewLogsAPIError instantiates a new LogsAPIError 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 NewLogsAPIError() *LogsAPIError { + this := LogsAPIError{} + return &this +} + +// NewLogsAPIErrorWithDefaults instantiates a new LogsAPIError 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 NewLogsAPIErrorWithDefaults() *LogsAPIError { + this := LogsAPIError{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *LogsAPIError) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAPIError) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *LogsAPIError) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *LogsAPIError) SetCode(v string) { + o.Code = &v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *LogsAPIError) GetDetails() []LogsAPIError { + if o == nil || o.Details == nil { + var ret []LogsAPIError + return ret + } + return o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAPIError) GetDetailsOk() (*[]LogsAPIError, bool) { + if o == nil || o.Details == nil { + return nil, false + } + return &o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *LogsAPIError) HasDetails() bool { + if o != nil && o.Details != nil { + return true + } + + return false +} + +// SetDetails gets a reference to the given []LogsAPIError and assigns it to the Details field. +func (o *LogsAPIError) SetDetails(v []LogsAPIError) { + o.Details = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *LogsAPIError) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAPIError) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *LogsAPIError) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *LogsAPIError) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAPIError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Details != nil { + toSerialize["details"] = o.Details + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAPIError) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *string `json:"code,omitempty"` + Details []LogsAPIError `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Details = all.Details + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_logs_api_error_response.go b/api/v1/datadog/model_logs_api_error_response.go new file mode 100644 index 00000000000..66599a8d418 --- /dev/null +++ b/api/v1/datadog/model_logs_api_error_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAPIErrorResponse Response returned by the Logs API when errors occur. +type LogsAPIErrorResponse struct { + // Error returned by the Logs API + Error *LogsAPIError `json:"error,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{} +} + +// NewLogsAPIErrorResponse instantiates a new LogsAPIErrorResponse 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 NewLogsAPIErrorResponse() *LogsAPIErrorResponse { + this := LogsAPIErrorResponse{} + return &this +} + +// NewLogsAPIErrorResponseWithDefaults instantiates a new LogsAPIErrorResponse 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 NewLogsAPIErrorResponseWithDefaults() *LogsAPIErrorResponse { + this := LogsAPIErrorResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *LogsAPIErrorResponse) GetError() LogsAPIError { + if o == nil || o.Error == nil { + var ret LogsAPIError + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAPIErrorResponse) GetErrorOk() (*LogsAPIError, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *LogsAPIErrorResponse) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given LogsAPIError and assigns it to the Error field. +func (o *LogsAPIErrorResponse) SetError(v LogsAPIError) { + o.Error = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAPIErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Error *LogsAPIError `json:"error,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Error != nil && all.Error.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Error = all.Error + return nil +} diff --git a/api/v1/datadog/model_logs_arithmetic_processor.go b/api/v1/datadog/model_logs_arithmetic_processor.go new file mode 100644 index 00000000000..e7062883e93 --- /dev/null +++ b/api/v1/datadog/model_logs_arithmetic_processor.go @@ -0,0 +1,325 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArithmeticProcessor Use the Arithmetic Processor to add a new attribute (without spaces or special characters +// in the new attribute name) to a log with the result of the provided formula. +// This enables you to remap different time attributes with different units into a single attribute, +// or to compute operations on attributes within the same log. +// +// The formula can use parentheses and the basic arithmetic operators `-`, `+`, `*`, `/`. +// +// By default, the calculation is skipped if an attribute is missing. +// Select “Replace missing attribute by 0” to automatically populate +// missing attribute values with 0 to ensure that the calculation is done. +// An attribute is missing if it is not found in the log attributes, +// or if it cannot be converted to a number. +// +// *Notes*: +// +// - The operator `-` needs to be space split in the formula as it can also be contained in attribute names. +// - If the target attribute already exists, it is overwritten by the result of the formula. +// - Results are rounded up to the 9th decimal. For example, if the result of the formula is `0.1234567891`, +// the actual value stored for the attribute is `0.123456789`. +// - If you need to scale a unit of measure, +// see [Scale Filter](https://docs.datadoghq.com/logs/log_configuration/parsing/?tab=filter#matcher-and-filter). +type LogsArithmeticProcessor struct { + // Arithmetic operation between one or more log attributes. + Expression string `json:"expression"` + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // If `true`, it replaces all missing attributes of expression by `0`, `false` + // skip the operation if an attribute is missing. + IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Name of the attribute that contains the result of the arithmetic operation. + Target string `json:"target"` + // Type of logs arithmetic processor. + Type LogsArithmeticProcessorType `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{} +} + +// NewLogsArithmeticProcessor instantiates a new LogsArithmeticProcessor 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 NewLogsArithmeticProcessor(expression string, target string, typeVar LogsArithmeticProcessorType) *LogsArithmeticProcessor { + this := LogsArithmeticProcessor{} + this.Expression = expression + var isEnabled bool = false + this.IsEnabled = &isEnabled + var isReplaceMissing bool = false + this.IsReplaceMissing = &isReplaceMissing + this.Target = target + this.Type = typeVar + return &this +} + +// NewLogsArithmeticProcessorWithDefaults instantiates a new LogsArithmeticProcessor 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 NewLogsArithmeticProcessorWithDefaults() *LogsArithmeticProcessor { + this := LogsArithmeticProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var isReplaceMissing bool = false + this.IsReplaceMissing = &isReplaceMissing + var typeVar LogsArithmeticProcessorType = LOGSARITHMETICPROCESSORTYPE_ARITHMETIC_PROCESSOR + this.Type = typeVar + return &this +} + +// GetExpression returns the Expression field value. +func (o *LogsArithmeticProcessor) GetExpression() string { + if o == nil { + var ret string + return ret + } + return o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value +// and a boolean to check if the value has been set. +func (o *LogsArithmeticProcessor) GetExpressionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Expression, true +} + +// SetExpression sets field value. +func (o *LogsArithmeticProcessor) SetExpression(v string) { + o.Expression = v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsArithmeticProcessor) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArithmeticProcessor) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsArithmeticProcessor) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsArithmeticProcessor) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetIsReplaceMissing returns the IsReplaceMissing field value if set, zero value otherwise. +func (o *LogsArithmeticProcessor) GetIsReplaceMissing() bool { + if o == nil || o.IsReplaceMissing == nil { + var ret bool + return ret + } + return *o.IsReplaceMissing +} + +// GetIsReplaceMissingOk returns a tuple with the IsReplaceMissing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArithmeticProcessor) GetIsReplaceMissingOk() (*bool, bool) { + if o == nil || o.IsReplaceMissing == nil { + return nil, false + } + return o.IsReplaceMissing, true +} + +// HasIsReplaceMissing returns a boolean if a field has been set. +func (o *LogsArithmeticProcessor) HasIsReplaceMissing() bool { + if o != nil && o.IsReplaceMissing != nil { + return true + } + + return false +} + +// SetIsReplaceMissing gets a reference to the given bool and assigns it to the IsReplaceMissing field. +func (o *LogsArithmeticProcessor) SetIsReplaceMissing(v bool) { + o.IsReplaceMissing = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsArithmeticProcessor) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArithmeticProcessor) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsArithmeticProcessor) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsArithmeticProcessor) SetName(v string) { + o.Name = &v +} + +// GetTarget returns the Target field value. +func (o *LogsArithmeticProcessor) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsArithmeticProcessor) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsArithmeticProcessor) SetTarget(v string) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *LogsArithmeticProcessor) GetType() LogsArithmeticProcessorType { + if o == nil { + var ret LogsArithmeticProcessorType + 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 *LogsArithmeticProcessor) GetTypeOk() (*LogsArithmeticProcessorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsArithmeticProcessor) SetType(v LogsArithmeticProcessorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArithmeticProcessor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["expression"] = o.Expression + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.IsReplaceMissing != nil { + toSerialize["is_replace_missing"] = o.IsReplaceMissing + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Expression *string `json:"expression"` + Target *string `json:"target"` + Type *LogsArithmeticProcessorType `json:"type"` + }{} + all := struct { + Expression string `json:"expression"` + IsEnabled *bool `json:"is_enabled,omitempty"` + IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` + Name *string `json:"name,omitempty"` + Target string `json:"target"` + Type LogsArithmeticProcessorType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Expression == nil { + return fmt.Errorf("Required field expression missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Expression = all.Expression + o.IsEnabled = all.IsEnabled + o.IsReplaceMissing = all.IsReplaceMissing + o.Name = all.Name + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_arithmetic_processor_type.go b/api/v1/datadog/model_logs_arithmetic_processor_type.go new file mode 100644 index 00000000000..0f4779dca4c --- /dev/null +++ b/api/v1/datadog/model_logs_arithmetic_processor_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArithmeticProcessorType Type of logs arithmetic processor. +type LogsArithmeticProcessorType string + +// List of LogsArithmeticProcessorType. +const ( + LOGSARITHMETICPROCESSORTYPE_ARITHMETIC_PROCESSOR LogsArithmeticProcessorType = "arithmetic-processor" +) + +var allowedLogsArithmeticProcessorTypeEnumValues = []LogsArithmeticProcessorType{ + LOGSARITHMETICPROCESSORTYPE_ARITHMETIC_PROCESSOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsArithmeticProcessorType) GetAllowedValues() []LogsArithmeticProcessorType { + return allowedLogsArithmeticProcessorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsArithmeticProcessorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsArithmeticProcessorType(value) + return nil +} + +// NewLogsArithmeticProcessorTypeFromValue returns a pointer to a valid LogsArithmeticProcessorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsArithmeticProcessorTypeFromValue(v string) (*LogsArithmeticProcessorType, error) { + ev := LogsArithmeticProcessorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsArithmeticProcessorType: valid values are %v", v, allowedLogsArithmeticProcessorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsArithmeticProcessorType) IsValid() bool { + for _, existing := range allowedLogsArithmeticProcessorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsArithmeticProcessorType value. +func (v LogsArithmeticProcessorType) Ptr() *LogsArithmeticProcessorType { + return &v +} + +// NullableLogsArithmeticProcessorType handles when a null is used for LogsArithmeticProcessorType. +type NullableLogsArithmeticProcessorType struct { + value *LogsArithmeticProcessorType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArithmeticProcessorType) Get() *LogsArithmeticProcessorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArithmeticProcessorType) Set(val *LogsArithmeticProcessorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArithmeticProcessorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsArithmeticProcessorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArithmeticProcessorType initializes the struct as if Set has been called. +func NewNullableLogsArithmeticProcessorType(val *LogsArithmeticProcessorType) *NullableLogsArithmeticProcessorType { + return &NullableLogsArithmeticProcessorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArithmeticProcessorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArithmeticProcessorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_attribute_remapper.go b/api/v1/datadog/model_logs_attribute_remapper.go new file mode 100644 index 00000000000..8a155068dbf --- /dev/null +++ b/api/v1/datadog/model_logs_attribute_remapper.go @@ -0,0 +1,484 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsAttributeRemapper The remapper processor remaps any source attribute(s) or tag to another target attribute or tag. +// Constraints on the tag/attribute name are explained in the [Tag Best Practice documentation](https://docs.datadoghq.com/logs/guide/log-parsing-best-practice). +// Some additional constraints are applied as `:` or `,` are not allowed in the target tag/attribute name. +type LogsAttributeRemapper struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Override or not the target element if already set, + OverrideOnConflict *bool `json:"override_on_conflict,omitempty"` + // Remove or preserve the remapped source element. + PreserveSource *bool `json:"preserve_source,omitempty"` + // Defines if the sources are from log `attribute` or `tag`. + SourceType *string `json:"source_type,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Final attribute or tag name to remap the sources to. + Target string `json:"target"` + // If the `target_type` of the remapper is `attribute`, try to cast the value to a new specific type. + // If the cast is not possible, the original type is kept. `string`, `integer`, or `double` are the possible types. + // If the `target_type` is `tag`, this parameter may not be specified. + TargetFormat *TargetFormatType `json:"target_format,omitempty"` + // Defines if the final attribute or tag name is from log `attribute` or `tag`. + TargetType *string `json:"target_type,omitempty"` + // Type of logs attribute remapper. + Type LogsAttributeRemapperType `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{} +} + +// NewLogsAttributeRemapper instantiates a new LogsAttributeRemapper 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 NewLogsAttributeRemapper(sources []string, target string, typeVar LogsAttributeRemapperType) *LogsAttributeRemapper { + this := LogsAttributeRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var overrideOnConflict bool = false + this.OverrideOnConflict = &overrideOnConflict + var preserveSource bool = false + this.PreserveSource = &preserveSource + var sourceType string = "attribute" + this.SourceType = &sourceType + this.Sources = sources + this.Target = target + var targetType string = "attribute" + this.TargetType = &targetType + this.Type = typeVar + return &this +} + +// NewLogsAttributeRemapperWithDefaults instantiates a new LogsAttributeRemapper 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 NewLogsAttributeRemapperWithDefaults() *LogsAttributeRemapper { + this := LogsAttributeRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var overrideOnConflict bool = false + this.OverrideOnConflict = &overrideOnConflict + var preserveSource bool = false + this.PreserveSource = &preserveSource + var sourceType string = "attribute" + this.SourceType = &sourceType + var targetType string = "attribute" + this.TargetType = &targetType + var typeVar LogsAttributeRemapperType = LOGSATTRIBUTEREMAPPERTYPE_ATTRIBUTE_REMAPPER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsAttributeRemapper) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsAttributeRemapper) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsAttributeRemapper) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsAttributeRemapper) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsAttributeRemapper) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsAttributeRemapper) SetName(v string) { + o.Name = &v +} + +// GetOverrideOnConflict returns the OverrideOnConflict field value if set, zero value otherwise. +func (o *LogsAttributeRemapper) GetOverrideOnConflict() bool { + if o == nil || o.OverrideOnConflict == nil { + var ret bool + return ret + } + return *o.OverrideOnConflict +} + +// GetOverrideOnConflictOk returns a tuple with the OverrideOnConflict field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetOverrideOnConflictOk() (*bool, bool) { + if o == nil || o.OverrideOnConflict == nil { + return nil, false + } + return o.OverrideOnConflict, true +} + +// HasOverrideOnConflict returns a boolean if a field has been set. +func (o *LogsAttributeRemapper) HasOverrideOnConflict() bool { + if o != nil && o.OverrideOnConflict != nil { + return true + } + + return false +} + +// SetOverrideOnConflict gets a reference to the given bool and assigns it to the OverrideOnConflict field. +func (o *LogsAttributeRemapper) SetOverrideOnConflict(v bool) { + o.OverrideOnConflict = &v +} + +// GetPreserveSource returns the PreserveSource field value if set, zero value otherwise. +func (o *LogsAttributeRemapper) GetPreserveSource() bool { + if o == nil || o.PreserveSource == nil { + var ret bool + return ret + } + return *o.PreserveSource +} + +// GetPreserveSourceOk returns a tuple with the PreserveSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetPreserveSourceOk() (*bool, bool) { + if o == nil || o.PreserveSource == nil { + return nil, false + } + return o.PreserveSource, true +} + +// HasPreserveSource returns a boolean if a field has been set. +func (o *LogsAttributeRemapper) HasPreserveSource() bool { + if o != nil && o.PreserveSource != nil { + return true + } + + return false +} + +// SetPreserveSource gets a reference to the given bool and assigns it to the PreserveSource field. +func (o *LogsAttributeRemapper) SetPreserveSource(v bool) { + o.PreserveSource = &v +} + +// GetSourceType returns the SourceType field value if set, zero value otherwise. +func (o *LogsAttributeRemapper) GetSourceType() string { + if o == nil || o.SourceType == nil { + var ret string + return ret + } + return *o.SourceType +} + +// GetSourceTypeOk returns a tuple with the SourceType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetSourceTypeOk() (*string, bool) { + if o == nil || o.SourceType == nil { + return nil, false + } + return o.SourceType, true +} + +// HasSourceType returns a boolean if a field has been set. +func (o *LogsAttributeRemapper) HasSourceType() bool { + if o != nil && o.SourceType != nil { + return true + } + + return false +} + +// SetSourceType gets a reference to the given string and assigns it to the SourceType field. +func (o *LogsAttributeRemapper) SetSourceType(v string) { + o.SourceType = &v +} + +// GetSources returns the Sources field value. +func (o *LogsAttributeRemapper) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsAttributeRemapper) SetSources(v []string) { + o.Sources = v +} + +// GetTarget returns the Target field value. +func (o *LogsAttributeRemapper) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsAttributeRemapper) SetTarget(v string) { + o.Target = v +} + +// GetTargetFormat returns the TargetFormat field value if set, zero value otherwise. +func (o *LogsAttributeRemapper) GetTargetFormat() TargetFormatType { + if o == nil || o.TargetFormat == nil { + var ret TargetFormatType + return ret + } + return *o.TargetFormat +} + +// GetTargetFormatOk returns a tuple with the TargetFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetTargetFormatOk() (*TargetFormatType, bool) { + if o == nil || o.TargetFormat == nil { + return nil, false + } + return o.TargetFormat, true +} + +// HasTargetFormat returns a boolean if a field has been set. +func (o *LogsAttributeRemapper) HasTargetFormat() bool { + if o != nil && o.TargetFormat != nil { + return true + } + + return false +} + +// SetTargetFormat gets a reference to the given TargetFormatType and assigns it to the TargetFormat field. +func (o *LogsAttributeRemapper) SetTargetFormat(v TargetFormatType) { + o.TargetFormat = &v +} + +// GetTargetType returns the TargetType field value if set, zero value otherwise. +func (o *LogsAttributeRemapper) GetTargetType() string { + if o == nil || o.TargetType == nil { + var ret string + return ret + } + return *o.TargetType +} + +// GetTargetTypeOk returns a tuple with the TargetType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAttributeRemapper) GetTargetTypeOk() (*string, bool) { + if o == nil || o.TargetType == nil { + return nil, false + } + return o.TargetType, true +} + +// HasTargetType returns a boolean if a field has been set. +func (o *LogsAttributeRemapper) HasTargetType() bool { + if o != nil && o.TargetType != nil { + return true + } + + return false +} + +// SetTargetType gets a reference to the given string and assigns it to the TargetType field. +func (o *LogsAttributeRemapper) SetTargetType(v string) { + o.TargetType = &v +} + +// GetType returns the Type field value. +func (o *LogsAttributeRemapper) GetType() LogsAttributeRemapperType { + if o == nil { + var ret LogsAttributeRemapperType + 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 *LogsAttributeRemapper) GetTypeOk() (*LogsAttributeRemapperType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsAttributeRemapper) SetType(v LogsAttributeRemapperType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAttributeRemapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OverrideOnConflict != nil { + toSerialize["override_on_conflict"] = o.OverrideOnConflict + } + if o.PreserveSource != nil { + toSerialize["preserve_source"] = o.PreserveSource + } + if o.SourceType != nil { + toSerialize["source_type"] = o.SourceType + } + toSerialize["sources"] = o.Sources + toSerialize["target"] = o.Target + if o.TargetFormat != nil { + toSerialize["target_format"] = o.TargetFormat + } + if o.TargetType != nil { + toSerialize["target_type"] = o.TargetType + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Target *string `json:"target"` + Type *LogsAttributeRemapperType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + OverrideOnConflict *bool `json:"override_on_conflict,omitempty"` + PreserveSource *bool `json:"preserve_source,omitempty"` + SourceType *string `json:"source_type,omitempty"` + Sources []string `json:"sources"` + Target string `json:"target"` + TargetFormat *TargetFormatType `json:"target_format,omitempty"` + TargetType *string `json:"target_type,omitempty"` + Type LogsAttributeRemapperType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TargetFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.OverrideOnConflict = all.OverrideOnConflict + o.PreserveSource = all.PreserveSource + o.SourceType = all.SourceType + o.Sources = all.Sources + o.Target = all.Target + o.TargetFormat = all.TargetFormat + o.TargetType = all.TargetType + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_attribute_remapper_type.go b/api/v1/datadog/model_logs_attribute_remapper_type.go new file mode 100644 index 00000000000..35b7f0f7c92 --- /dev/null +++ b/api/v1/datadog/model_logs_attribute_remapper_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsAttributeRemapperType Type of logs attribute remapper. +type LogsAttributeRemapperType string + +// List of LogsAttributeRemapperType. +const ( + LOGSATTRIBUTEREMAPPERTYPE_ATTRIBUTE_REMAPPER LogsAttributeRemapperType = "attribute-remapper" +) + +var allowedLogsAttributeRemapperTypeEnumValues = []LogsAttributeRemapperType{ + LOGSATTRIBUTEREMAPPERTYPE_ATTRIBUTE_REMAPPER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsAttributeRemapperType) GetAllowedValues() []LogsAttributeRemapperType { + return allowedLogsAttributeRemapperTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsAttributeRemapperType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsAttributeRemapperType(value) + return nil +} + +// NewLogsAttributeRemapperTypeFromValue returns a pointer to a valid LogsAttributeRemapperType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsAttributeRemapperTypeFromValue(v string) (*LogsAttributeRemapperType, error) { + ev := LogsAttributeRemapperType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsAttributeRemapperType: valid values are %v", v, allowedLogsAttributeRemapperTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsAttributeRemapperType) IsValid() bool { + for _, existing := range allowedLogsAttributeRemapperTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsAttributeRemapperType value. +func (v LogsAttributeRemapperType) Ptr() *LogsAttributeRemapperType { + return &v +} + +// NullableLogsAttributeRemapperType handles when a null is used for LogsAttributeRemapperType. +type NullableLogsAttributeRemapperType struct { + value *LogsAttributeRemapperType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsAttributeRemapperType) Get() *LogsAttributeRemapperType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsAttributeRemapperType) Set(val *LogsAttributeRemapperType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsAttributeRemapperType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsAttributeRemapperType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsAttributeRemapperType initializes the struct as if Set has been called. +func NewNullableLogsAttributeRemapperType(val *LogsAttributeRemapperType) *NullableLogsAttributeRemapperType { + return &NullableLogsAttributeRemapperType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsAttributeRemapperType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsAttributeRemapperType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_by_retention.go b/api/v1/datadog/model_logs_by_retention.go new file mode 100644 index 00000000000..fb8d97c3c5a --- /dev/null +++ b/api/v1/datadog/model_logs_by_retention.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsByRetention Object containing logs usage data broken down by retention period. +type LogsByRetention struct { + // Indexed logs usage summary for each organization for each retention period with usage. + Orgs *LogsByRetentionOrgs `json:"orgs,omitempty"` + // Aggregated index logs usage for each retention period with usage. + Usage []LogsRetentionAggSumUsage `json:"usage,omitempty"` + // Object containing a summary of indexed logs usage by retention period for a single month. + UsageByMonth *LogsByRetentionMonthlyUsage `json:"usage_by_month,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{} +} + +// NewLogsByRetention instantiates a new LogsByRetention 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 NewLogsByRetention() *LogsByRetention { + this := LogsByRetention{} + return &this +} + +// NewLogsByRetentionWithDefaults instantiates a new LogsByRetention 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 NewLogsByRetentionWithDefaults() *LogsByRetention { + this := LogsByRetention{} + return &this +} + +// GetOrgs returns the Orgs field value if set, zero value otherwise. +func (o *LogsByRetention) GetOrgs() LogsByRetentionOrgs { + if o == nil || o.Orgs == nil { + var ret LogsByRetentionOrgs + return ret + } + return *o.Orgs +} + +// GetOrgsOk returns a tuple with the Orgs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsByRetention) GetOrgsOk() (*LogsByRetentionOrgs, bool) { + if o == nil || o.Orgs == nil { + return nil, false + } + return o.Orgs, true +} + +// HasOrgs returns a boolean if a field has been set. +func (o *LogsByRetention) HasOrgs() bool { + if o != nil && o.Orgs != nil { + return true + } + + return false +} + +// SetOrgs gets a reference to the given LogsByRetentionOrgs and assigns it to the Orgs field. +func (o *LogsByRetention) SetOrgs(v LogsByRetentionOrgs) { + o.Orgs = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *LogsByRetention) GetUsage() []LogsRetentionAggSumUsage { + if o == nil || o.Usage == nil { + var ret []LogsRetentionAggSumUsage + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsByRetention) GetUsageOk() (*[]LogsRetentionAggSumUsage, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *LogsByRetention) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []LogsRetentionAggSumUsage and assigns it to the Usage field. +func (o *LogsByRetention) SetUsage(v []LogsRetentionAggSumUsage) { + o.Usage = v +} + +// GetUsageByMonth returns the UsageByMonth field value if set, zero value otherwise. +func (o *LogsByRetention) GetUsageByMonth() LogsByRetentionMonthlyUsage { + if o == nil || o.UsageByMonth == nil { + var ret LogsByRetentionMonthlyUsage + return ret + } + return *o.UsageByMonth +} + +// GetUsageByMonthOk returns a tuple with the UsageByMonth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsByRetention) GetUsageByMonthOk() (*LogsByRetentionMonthlyUsage, bool) { + if o == nil || o.UsageByMonth == nil { + return nil, false + } + return o.UsageByMonth, true +} + +// HasUsageByMonth returns a boolean if a field has been set. +func (o *LogsByRetention) HasUsageByMonth() bool { + if o != nil && o.UsageByMonth != nil { + return true + } + + return false +} + +// SetUsageByMonth gets a reference to the given LogsByRetentionMonthlyUsage and assigns it to the UsageByMonth field. +func (o *LogsByRetention) SetUsageByMonth(v LogsByRetentionMonthlyUsage) { + o.UsageByMonth = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsByRetention) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Orgs != nil { + toSerialize["orgs"] = o.Orgs + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + if o.UsageByMonth != nil { + toSerialize["usage_by_month"] = o.UsageByMonth + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsByRetention) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Orgs *LogsByRetentionOrgs `json:"orgs,omitempty"` + Usage []LogsRetentionAggSumUsage `json:"usage,omitempty"` + UsageByMonth *LogsByRetentionMonthlyUsage `json:"usage_by_month,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Orgs != nil && all.Orgs.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Orgs = all.Orgs + o.Usage = all.Usage + if all.UsageByMonth != nil && all.UsageByMonth.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.UsageByMonth = all.UsageByMonth + return nil +} diff --git a/api/v1/datadog/model_logs_by_retention_monthly_usage.go b/api/v1/datadog/model_logs_by_retention_monthly_usage.go new file mode 100644 index 00000000000..70d47cdbfb2 --- /dev/null +++ b/api/v1/datadog/model_logs_by_retention_monthly_usage.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// LogsByRetentionMonthlyUsage Object containing a summary of indexed logs usage by retention period for a single month. +type LogsByRetentionMonthlyUsage struct { + // The month for the usage. + Date *time.Time `json:"date,omitempty"` + // Indexed logs usage for each active retention for the month. + Usage []LogsRetentionSumUsage `json:"usage,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{} +} + +// NewLogsByRetentionMonthlyUsage instantiates a new LogsByRetentionMonthlyUsage 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 NewLogsByRetentionMonthlyUsage() *LogsByRetentionMonthlyUsage { + this := LogsByRetentionMonthlyUsage{} + return &this +} + +// NewLogsByRetentionMonthlyUsageWithDefaults instantiates a new LogsByRetentionMonthlyUsage 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 NewLogsByRetentionMonthlyUsageWithDefaults() *LogsByRetentionMonthlyUsage { + this := LogsByRetentionMonthlyUsage{} + return &this +} + +// GetDate returns the Date field value if set, zero value otherwise. +func (o *LogsByRetentionMonthlyUsage) GetDate() time.Time { + if o == nil || o.Date == nil { + var ret time.Time + return ret + } + return *o.Date +} + +// GetDateOk returns a tuple with the Date field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsByRetentionMonthlyUsage) GetDateOk() (*time.Time, bool) { + if o == nil || o.Date == nil { + return nil, false + } + return o.Date, true +} + +// HasDate returns a boolean if a field has been set. +func (o *LogsByRetentionMonthlyUsage) HasDate() bool { + if o != nil && o.Date != nil { + return true + } + + return false +} + +// SetDate gets a reference to the given time.Time and assigns it to the Date field. +func (o *LogsByRetentionMonthlyUsage) SetDate(v time.Time) { + o.Date = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *LogsByRetentionMonthlyUsage) GetUsage() []LogsRetentionSumUsage { + if o == nil || o.Usage == nil { + var ret []LogsRetentionSumUsage + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsByRetentionMonthlyUsage) GetUsageOk() (*[]LogsRetentionSumUsage, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *LogsByRetentionMonthlyUsage) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []LogsRetentionSumUsage and assigns it to the Usage field. +func (o *LogsByRetentionMonthlyUsage) SetUsage(v []LogsRetentionSumUsage) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsByRetentionMonthlyUsage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Date != nil { + if o.Date.Nanosecond() == 0 { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsByRetentionMonthlyUsage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Date *time.Time `json:"date,omitempty"` + Usage []LogsRetentionSumUsage `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Date = all.Date + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_logs_by_retention_org_usage.go b/api/v1/datadog/model_logs_by_retention_org_usage.go new file mode 100644 index 00000000000..ad16c8c2a0b --- /dev/null +++ b/api/v1/datadog/model_logs_by_retention_org_usage.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 datadog + +import ( + "encoding/json" +) + +// LogsByRetentionOrgUsage Indexed logs usage by retention for a single organization. +type LogsByRetentionOrgUsage struct { + // Indexed logs usage for each active retention for the organization. + Usage []LogsRetentionSumUsage `json:"usage,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{} +} + +// NewLogsByRetentionOrgUsage instantiates a new LogsByRetentionOrgUsage 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 NewLogsByRetentionOrgUsage() *LogsByRetentionOrgUsage { + this := LogsByRetentionOrgUsage{} + return &this +} + +// NewLogsByRetentionOrgUsageWithDefaults instantiates a new LogsByRetentionOrgUsage 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 NewLogsByRetentionOrgUsageWithDefaults() *LogsByRetentionOrgUsage { + this := LogsByRetentionOrgUsage{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *LogsByRetentionOrgUsage) GetUsage() []LogsRetentionSumUsage { + if o == nil || o.Usage == nil { + var ret []LogsRetentionSumUsage + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsByRetentionOrgUsage) GetUsageOk() (*[]LogsRetentionSumUsage, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *LogsByRetentionOrgUsage) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []LogsRetentionSumUsage and assigns it to the Usage field. +func (o *LogsByRetentionOrgUsage) SetUsage(v []LogsRetentionSumUsage) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsByRetentionOrgUsage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsByRetentionOrgUsage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []LogsRetentionSumUsage `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_logs_by_retention_orgs.go b/api/v1/datadog/model_logs_by_retention_orgs.go new file mode 100644 index 00000000000..cf82be023e5 --- /dev/null +++ b/api/v1/datadog/model_logs_by_retention_orgs.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 datadog + +import ( + "encoding/json" +) + +// LogsByRetentionOrgs Indexed logs usage summary for each organization for each retention period with usage. +type LogsByRetentionOrgs struct { + // Indexed logs usage summary for each organization. + Usage []LogsByRetentionOrgUsage `json:"usage,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{} +} + +// NewLogsByRetentionOrgs instantiates a new LogsByRetentionOrgs 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 NewLogsByRetentionOrgs() *LogsByRetentionOrgs { + this := LogsByRetentionOrgs{} + return &this +} + +// NewLogsByRetentionOrgsWithDefaults instantiates a new LogsByRetentionOrgs 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 NewLogsByRetentionOrgsWithDefaults() *LogsByRetentionOrgs { + this := LogsByRetentionOrgs{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *LogsByRetentionOrgs) GetUsage() []LogsByRetentionOrgUsage { + if o == nil || o.Usage == nil { + var ret []LogsByRetentionOrgUsage + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsByRetentionOrgs) GetUsageOk() (*[]LogsByRetentionOrgUsage, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *LogsByRetentionOrgs) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []LogsByRetentionOrgUsage and assigns it to the Usage field. +func (o *LogsByRetentionOrgs) SetUsage(v []LogsByRetentionOrgUsage) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsByRetentionOrgs) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsByRetentionOrgs) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []LogsByRetentionOrgUsage `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_logs_category_processor.go b/api/v1/datadog/model_logs_category_processor.go new file mode 100644 index 00000000000..ab1c7b0c9b7 --- /dev/null +++ b/api/v1/datadog/model_logs_category_processor.go @@ -0,0 +1,274 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsCategoryProcessor Use the Category Processor to add a new attribute (without spaces or special characters in the new attribute name) +// to a log matching a provided search query. Use categories to create groups for an analytical view. +// For example, URL groups, machine groups, environments, and response time buckets. +// +// **Notes**: +// +// - The syntax of the query is the one of Logs Explorer search bar. +// The query can be done on any log attribute or tag, whether it is a facet or not. +// Wildcards can also be used inside your query. +// - Once the log has matched one of the Processor queries, it stops. +// Make sure they are properly ordered in case a log could match several queries. +// - The names of the categories must be unique. +// - Once defined in the Category Processor, you can map categories to log status using the Log Status Remapper. +type LogsCategoryProcessor struct { + // Array of filters to match or not a log and their + // corresponding `name` to assign a custom value to the log. + Categories []LogsCategoryProcessorCategory `json:"categories"` + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Name of the target attribute which value is defined by the matching category. + Target string `json:"target"` + // Type of logs category processor. + Type LogsCategoryProcessorType `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{} +} + +// NewLogsCategoryProcessor instantiates a new LogsCategoryProcessor 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 NewLogsCategoryProcessor(categories []LogsCategoryProcessorCategory, target string, typeVar LogsCategoryProcessorType) *LogsCategoryProcessor { + this := LogsCategoryProcessor{} + this.Categories = categories + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Target = target + this.Type = typeVar + return &this +} + +// NewLogsCategoryProcessorWithDefaults instantiates a new LogsCategoryProcessor 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 NewLogsCategoryProcessorWithDefaults() *LogsCategoryProcessor { + this := LogsCategoryProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsCategoryProcessorType = LOGSCATEGORYPROCESSORTYPE_CATEGORY_PROCESSOR + this.Type = typeVar + return &this +} + +// GetCategories returns the Categories field value. +func (o *LogsCategoryProcessor) GetCategories() []LogsCategoryProcessorCategory { + if o == nil { + var ret []LogsCategoryProcessorCategory + return ret + } + return o.Categories +} + +// GetCategoriesOk returns a tuple with the Categories field value +// and a boolean to check if the value has been set. +func (o *LogsCategoryProcessor) GetCategoriesOk() (*[]LogsCategoryProcessorCategory, bool) { + if o == nil { + return nil, false + } + return &o.Categories, true +} + +// SetCategories sets field value. +func (o *LogsCategoryProcessor) SetCategories(v []LogsCategoryProcessorCategory) { + o.Categories = v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsCategoryProcessor) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsCategoryProcessor) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsCategoryProcessor) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsCategoryProcessor) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsCategoryProcessor) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsCategoryProcessor) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsCategoryProcessor) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsCategoryProcessor) SetName(v string) { + o.Name = &v +} + +// GetTarget returns the Target field value. +func (o *LogsCategoryProcessor) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsCategoryProcessor) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsCategoryProcessor) SetTarget(v string) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *LogsCategoryProcessor) GetType() LogsCategoryProcessorType { + if o == nil { + var ret LogsCategoryProcessorType + 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 *LogsCategoryProcessor) GetTypeOk() (*LogsCategoryProcessorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsCategoryProcessor) SetType(v LogsCategoryProcessorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsCategoryProcessor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["categories"] = o.Categories + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Categories *[]LogsCategoryProcessorCategory `json:"categories"` + Target *string `json:"target"` + Type *LogsCategoryProcessorType `json:"type"` + }{} + all := struct { + Categories []LogsCategoryProcessorCategory `json:"categories"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Target string `json:"target"` + Type LogsCategoryProcessorType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Categories == nil { + return fmt.Errorf("Required field categories missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Categories = all.Categories + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_category_processor_category.go b/api/v1/datadog/model_logs_category_processor_category.go new file mode 100644 index 00000000000..6f915c0146a --- /dev/null +++ b/api/v1/datadog/model_logs_category_processor_category.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 datadog + +import ( + "encoding/json" +) + +// LogsCategoryProcessorCategory Object describing the logs filter. +type LogsCategoryProcessorCategory struct { + // Filter for logs. + Filter *LogsFilter `json:"filter,omitempty"` + // Value to assign to the target attribute. + Name *string `json:"name,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{} +} + +// NewLogsCategoryProcessorCategory instantiates a new LogsCategoryProcessorCategory 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 NewLogsCategoryProcessorCategory() *LogsCategoryProcessorCategory { + this := LogsCategoryProcessorCategory{} + return &this +} + +// NewLogsCategoryProcessorCategoryWithDefaults instantiates a new LogsCategoryProcessorCategory 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 NewLogsCategoryProcessorCategoryWithDefaults() *LogsCategoryProcessorCategory { + this := LogsCategoryProcessorCategory{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsCategoryProcessorCategory) GetFilter() LogsFilter { + if o == nil || o.Filter == nil { + var ret LogsFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsCategoryProcessorCategory) GetFilterOk() (*LogsFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsCategoryProcessorCategory) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsFilter and assigns it to the Filter field. +func (o *LogsCategoryProcessorCategory) SetFilter(v LogsFilter) { + o.Filter = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsCategoryProcessorCategory) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsCategoryProcessorCategory) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsCategoryProcessorCategory) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsCategoryProcessorCategory) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsCategoryProcessorCategory) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsCategoryProcessorCategory) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filter *LogsFilter `json:"filter,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_logs_category_processor_type.go b/api/v1/datadog/model_logs_category_processor_type.go new file mode 100644 index 00000000000..1896db24d31 --- /dev/null +++ b/api/v1/datadog/model_logs_category_processor_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsCategoryProcessorType Type of logs category processor. +type LogsCategoryProcessorType string + +// List of LogsCategoryProcessorType. +const ( + LOGSCATEGORYPROCESSORTYPE_CATEGORY_PROCESSOR LogsCategoryProcessorType = "category-processor" +) + +var allowedLogsCategoryProcessorTypeEnumValues = []LogsCategoryProcessorType{ + LOGSCATEGORYPROCESSORTYPE_CATEGORY_PROCESSOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsCategoryProcessorType) GetAllowedValues() []LogsCategoryProcessorType { + return allowedLogsCategoryProcessorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsCategoryProcessorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsCategoryProcessorType(value) + return nil +} + +// NewLogsCategoryProcessorTypeFromValue returns a pointer to a valid LogsCategoryProcessorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsCategoryProcessorTypeFromValue(v string) (*LogsCategoryProcessorType, error) { + ev := LogsCategoryProcessorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsCategoryProcessorType: valid values are %v", v, allowedLogsCategoryProcessorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsCategoryProcessorType) IsValid() bool { + for _, existing := range allowedLogsCategoryProcessorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsCategoryProcessorType value. +func (v LogsCategoryProcessorType) Ptr() *LogsCategoryProcessorType { + return &v +} + +// NullableLogsCategoryProcessorType handles when a null is used for LogsCategoryProcessorType. +type NullableLogsCategoryProcessorType struct { + value *LogsCategoryProcessorType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsCategoryProcessorType) Get() *LogsCategoryProcessorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsCategoryProcessorType) Set(val *LogsCategoryProcessorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsCategoryProcessorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsCategoryProcessorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsCategoryProcessorType initializes the struct as if Set has been called. +func NewNullableLogsCategoryProcessorType(val *LogsCategoryProcessorType) *NullableLogsCategoryProcessorType { + return &NullableLogsCategoryProcessorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsCategoryProcessorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsCategoryProcessorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_date_remapper.go b/api/v1/datadog/model_logs_date_remapper.go new file mode 100644 index 00000000000..88c48b3e6c1 --- /dev/null +++ b/api/v1/datadog/model_logs_date_remapper.go @@ -0,0 +1,246 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsDateRemapper As Datadog receives logs, it timestamps them using the value(s) from any of these default attributes. +// +// - `timestamp` +// - `date` +// - `_timestamp` +// - `Timestamp` +// - `eventTime` +// - `published_date` +// +// If your logs put their dates in an attribute not in this list, +// use the log date Remapper Processor to define their date attribute as the official log timestamp. +// The recognized date formats are ISO8601, UNIX (the milliseconds EPOCH format), and RFC3164. +// +// **Note:** If your logs don’t contain any of the default attributes +// and you haven’t defined your own date attribute, Datadog timestamps +// the logs with the date it received them. +// +// If multiple log date remapper processors can be applied to a given log, +// only the first one (according to the pipelines order) is taken into account. +type LogsDateRemapper struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Type of logs date remapper. + Type LogsDateRemapperType `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{} +} + +// NewLogsDateRemapper instantiates a new LogsDateRemapper 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 NewLogsDateRemapper(sources []string, typeVar LogsDateRemapperType) *LogsDateRemapper { + this := LogsDateRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Sources = sources + this.Type = typeVar + return &this +} + +// NewLogsDateRemapperWithDefaults instantiates a new LogsDateRemapper 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 NewLogsDateRemapperWithDefaults() *LogsDateRemapper { + this := LogsDateRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsDateRemapperType = LOGSDATEREMAPPERTYPE_DATE_REMAPPER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsDateRemapper) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsDateRemapper) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsDateRemapper) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsDateRemapper) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsDateRemapper) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsDateRemapper) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsDateRemapper) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsDateRemapper) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value. +func (o *LogsDateRemapper) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsDateRemapper) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsDateRemapper) SetSources(v []string) { + o.Sources = v +} + +// GetType returns the Type field value. +func (o *LogsDateRemapper) GetType() LogsDateRemapperType { + if o == nil { + var ret LogsDateRemapperType + 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 *LogsDateRemapper) GetTypeOk() (*LogsDateRemapperType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsDateRemapper) SetType(v LogsDateRemapperType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsDateRemapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["sources"] = o.Sources + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Type *LogsDateRemapperType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources"` + Type LogsDateRemapperType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Sources = all.Sources + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_date_remapper_type.go b/api/v1/datadog/model_logs_date_remapper_type.go new file mode 100644 index 00000000000..416ab4779c7 --- /dev/null +++ b/api/v1/datadog/model_logs_date_remapper_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsDateRemapperType Type of logs date remapper. +type LogsDateRemapperType string + +// List of LogsDateRemapperType. +const ( + LOGSDATEREMAPPERTYPE_DATE_REMAPPER LogsDateRemapperType = "date-remapper" +) + +var allowedLogsDateRemapperTypeEnumValues = []LogsDateRemapperType{ + LOGSDATEREMAPPERTYPE_DATE_REMAPPER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsDateRemapperType) GetAllowedValues() []LogsDateRemapperType { + return allowedLogsDateRemapperTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsDateRemapperType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsDateRemapperType(value) + return nil +} + +// NewLogsDateRemapperTypeFromValue returns a pointer to a valid LogsDateRemapperType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsDateRemapperTypeFromValue(v string) (*LogsDateRemapperType, error) { + ev := LogsDateRemapperType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsDateRemapperType: valid values are %v", v, allowedLogsDateRemapperTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsDateRemapperType) IsValid() bool { + for _, existing := range allowedLogsDateRemapperTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsDateRemapperType value. +func (v LogsDateRemapperType) Ptr() *LogsDateRemapperType { + return &v +} + +// NullableLogsDateRemapperType handles when a null is used for LogsDateRemapperType. +type NullableLogsDateRemapperType struct { + value *LogsDateRemapperType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsDateRemapperType) Get() *LogsDateRemapperType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsDateRemapperType) Set(val *LogsDateRemapperType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsDateRemapperType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsDateRemapperType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsDateRemapperType initializes the struct as if Set has been called. +func NewNullableLogsDateRemapperType(val *LogsDateRemapperType) *NullableLogsDateRemapperType { + return &NullableLogsDateRemapperType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsDateRemapperType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsDateRemapperType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_exclusion.go b/api/v1/datadog/model_logs_exclusion.go new file mode 100644 index 00000000000..7d381474499 --- /dev/null +++ b/api/v1/datadog/model_logs_exclusion.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsExclusion Represents the index exclusion filter object from configuration API. +type LogsExclusion struct { + // Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle. + Filter *LogsExclusionFilter `json:"filter,omitempty"` + // Whether or not the exclusion filter is active. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the index exclusion filter. + Name string `json:"name"` + // 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{} +} + +// NewLogsExclusion instantiates a new LogsExclusion 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 NewLogsExclusion(name string) *LogsExclusion { + this := LogsExclusion{} + this.Name = name + return &this +} + +// NewLogsExclusionWithDefaults instantiates a new LogsExclusion 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 NewLogsExclusionWithDefaults() *LogsExclusion { + this := LogsExclusion{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsExclusion) GetFilter() LogsExclusionFilter { + if o == nil || o.Filter == nil { + var ret LogsExclusionFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsExclusion) GetFilterOk() (*LogsExclusionFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsExclusion) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsExclusionFilter and assigns it to the Filter field. +func (o *LogsExclusion) SetFilter(v LogsExclusionFilter) { + o.Filter = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsExclusion) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsExclusion) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsExclusion) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsExclusion) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value. +func (o *LogsExclusion) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *LogsExclusion) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *LogsExclusion) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsExclusion) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsExclusion) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Filter *LogsExclusionFilter `json:"filter,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.IsEnabled = all.IsEnabled + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_logs_exclusion_filter.go b/api/v1/datadog/model_logs_exclusion_filter.go new file mode 100644 index 00000000000..8affe9814a0 --- /dev/null +++ b/api/v1/datadog/model_logs_exclusion_filter.go @@ -0,0 +1,144 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsExclusionFilter Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle. +type LogsExclusionFilter struct { + // Default query is `*`, meaning all logs flowing in the index would be excluded. + // Scope down exclusion filter to only a subset of logs with a log query. + Query *string `json:"query,omitempty"` + // Sample rate to apply to logs going through this exclusion filter, + // a value of 1.0 excludes all logs matching the query. + SampleRate float64 `json:"sample_rate"` + // 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{} +} + +// NewLogsExclusionFilter instantiates a new LogsExclusionFilter 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 NewLogsExclusionFilter(sampleRate float64) *LogsExclusionFilter { + this := LogsExclusionFilter{} + this.SampleRate = sampleRate + return &this +} + +// NewLogsExclusionFilterWithDefaults instantiates a new LogsExclusionFilter 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 NewLogsExclusionFilterWithDefaults() *LogsExclusionFilter { + this := LogsExclusionFilter{} + return &this +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *LogsExclusionFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsExclusionFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *LogsExclusionFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *LogsExclusionFilter) SetQuery(v string) { + o.Query = &v +} + +// GetSampleRate returns the SampleRate field value. +func (o *LogsExclusionFilter) GetSampleRate() float64 { + if o == nil { + var ret float64 + return ret + } + return o.SampleRate +} + +// GetSampleRateOk returns a tuple with the SampleRate field value +// and a boolean to check if the value has been set. +func (o *LogsExclusionFilter) GetSampleRateOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.SampleRate, true +} + +// SetSampleRate sets field value. +func (o *LogsExclusionFilter) SetSampleRate(v float64) { + o.SampleRate = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsExclusionFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + toSerialize["sample_rate"] = o.SampleRate + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + SampleRate *float64 `json:"sample_rate"` + }{} + all := struct { + Query *string `json:"query,omitempty"` + SampleRate float64 `json:"sample_rate"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.SampleRate == nil { + return fmt.Errorf("Required field sample_rate missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + o.SampleRate = all.SampleRate + return nil +} diff --git a/api/v1/datadog/model_logs_filter.go b/api/v1/datadog/model_logs_filter.go new file mode 100644 index 00000000000..f2894474519 --- /dev/null +++ b/api/v1/datadog/model_logs_filter.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 datadog + +import ( + "encoding/json" +) + +// LogsFilter Filter for logs. +type LogsFilter struct { + // The filter query. + Query *string `json:"query,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{} +} + +// NewLogsFilter instantiates a new LogsFilter 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 NewLogsFilter() *LogsFilter { + this := LogsFilter{} + return &this +} + +// NewLogsFilterWithDefaults instantiates a new LogsFilter 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 NewLogsFilterWithDefaults() *LogsFilter { + this := LogsFilter{} + return &this +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *LogsFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *LogsFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *LogsFilter) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Query *string `json:"query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + return nil +} diff --git a/api/v1/datadog/model_logs_geo_ip_parser.go b/api/v1/datadog/model_logs_geo_ip_parser.go new file mode 100644 index 00000000000..1787f5e68a5 --- /dev/null +++ b/api/v1/datadog/model_logs_geo_ip_parser.go @@ -0,0 +1,264 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsGeoIPParser The GeoIP parser takes an IP address attribute and extracts if available +// the Continent, Country, Subdivision, and City information in the target attribute path. +type LogsGeoIPParser struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Name of the parent attribute that contains all the extracted details from the `sources`. + Target string `json:"target"` + // Type of GeoIP parser. + Type LogsGeoIPParserType `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{} +} + +// NewLogsGeoIPParser instantiates a new LogsGeoIPParser 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 NewLogsGeoIPParser(sources []string, target string, typeVar LogsGeoIPParserType) *LogsGeoIPParser { + this := LogsGeoIPParser{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Sources = sources + this.Target = target + this.Type = typeVar + return &this +} + +// NewLogsGeoIPParserWithDefaults instantiates a new LogsGeoIPParser 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 NewLogsGeoIPParserWithDefaults() *LogsGeoIPParser { + this := LogsGeoIPParser{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var target string = "network.client.geoip" + this.Target = target + var typeVar LogsGeoIPParserType = LOGSGEOIPPARSERTYPE_GEO_IP_PARSER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsGeoIPParser) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGeoIPParser) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsGeoIPParser) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsGeoIPParser) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsGeoIPParser) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGeoIPParser) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsGeoIPParser) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsGeoIPParser) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value. +func (o *LogsGeoIPParser) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsGeoIPParser) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsGeoIPParser) SetSources(v []string) { + o.Sources = v +} + +// GetTarget returns the Target field value. +func (o *LogsGeoIPParser) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsGeoIPParser) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsGeoIPParser) SetTarget(v string) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *LogsGeoIPParser) GetType() LogsGeoIPParserType { + if o == nil { + var ret LogsGeoIPParserType + 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 *LogsGeoIPParser) GetTypeOk() (*LogsGeoIPParserType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsGeoIPParser) SetType(v LogsGeoIPParserType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsGeoIPParser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["sources"] = o.Sources + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Target *string `json:"target"` + Type *LogsGeoIPParserType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources"` + Target string `json:"target"` + Type LogsGeoIPParserType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Sources = all.Sources + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_geo_ip_parser_type.go b/api/v1/datadog/model_logs_geo_ip_parser_type.go new file mode 100644 index 00000000000..ffb2ea7cfe8 --- /dev/null +++ b/api/v1/datadog/model_logs_geo_ip_parser_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsGeoIPParserType Type of GeoIP parser. +type LogsGeoIPParserType string + +// List of LogsGeoIPParserType. +const ( + LOGSGEOIPPARSERTYPE_GEO_IP_PARSER LogsGeoIPParserType = "geo-ip-parser" +) + +var allowedLogsGeoIPParserTypeEnumValues = []LogsGeoIPParserType{ + LOGSGEOIPPARSERTYPE_GEO_IP_PARSER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsGeoIPParserType) GetAllowedValues() []LogsGeoIPParserType { + return allowedLogsGeoIPParserTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsGeoIPParserType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsGeoIPParserType(value) + return nil +} + +// NewLogsGeoIPParserTypeFromValue returns a pointer to a valid LogsGeoIPParserType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsGeoIPParserTypeFromValue(v string) (*LogsGeoIPParserType, error) { + ev := LogsGeoIPParserType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsGeoIPParserType: valid values are %v", v, allowedLogsGeoIPParserTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsGeoIPParserType) IsValid() bool { + for _, existing := range allowedLogsGeoIPParserTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsGeoIPParserType value. +func (v LogsGeoIPParserType) Ptr() *LogsGeoIPParserType { + return &v +} + +// NullableLogsGeoIPParserType handles when a null is used for LogsGeoIPParserType. +type NullableLogsGeoIPParserType struct { + value *LogsGeoIPParserType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsGeoIPParserType) Get() *LogsGeoIPParserType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsGeoIPParserType) Set(val *LogsGeoIPParserType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsGeoIPParserType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsGeoIPParserType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsGeoIPParserType initializes the struct as if Set has been called. +func NewNullableLogsGeoIPParserType(val *LogsGeoIPParserType) *NullableLogsGeoIPParserType { + return &NullableLogsGeoIPParserType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsGeoIPParserType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsGeoIPParserType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_grok_parser.go b/api/v1/datadog/model_logs_grok_parser.go new file mode 100644 index 00000000000..66730fe8144 --- /dev/null +++ b/api/v1/datadog/model_logs_grok_parser.go @@ -0,0 +1,310 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsGrokParser Create custom grok rules to parse the full message or [a specific attribute of your raw event](https://docs.datadoghq.com/logs/log_configuration/parsing/#advanced-settings). +// For more information, see the [parsing section](https://docs.datadoghq.com/logs/log_configuration/parsing). +type LogsGrokParser struct { + // Set of rules for the grok parser. + Grok LogsGrokParserRules `json:"grok"` + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // List of sample logs to test this grok parser. + Samples []string `json:"samples,omitempty"` + // Name of the log attribute to parse. + Source string `json:"source"` + // Type of logs grok parser. + Type LogsGrokParserType `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{} +} + +// NewLogsGrokParser instantiates a new LogsGrokParser 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 NewLogsGrokParser(grok LogsGrokParserRules, source string, typeVar LogsGrokParserType) *LogsGrokParser { + this := LogsGrokParser{} + this.Grok = grok + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Source = source + this.Type = typeVar + return &this +} + +// NewLogsGrokParserWithDefaults instantiates a new LogsGrokParser 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 NewLogsGrokParserWithDefaults() *LogsGrokParser { + this := LogsGrokParser{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var source string = "message" + this.Source = source + var typeVar LogsGrokParserType = LOGSGROKPARSERTYPE_GROK_PARSER + this.Type = typeVar + return &this +} + +// GetGrok returns the Grok field value. +func (o *LogsGrokParser) GetGrok() LogsGrokParserRules { + if o == nil { + var ret LogsGrokParserRules + return ret + } + return o.Grok +} + +// GetGrokOk returns a tuple with the Grok field value +// and a boolean to check if the value has been set. +func (o *LogsGrokParser) GetGrokOk() (*LogsGrokParserRules, bool) { + if o == nil { + return nil, false + } + return &o.Grok, true +} + +// SetGrok sets field value. +func (o *LogsGrokParser) SetGrok(v LogsGrokParserRules) { + o.Grok = v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsGrokParser) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGrokParser) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsGrokParser) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsGrokParser) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsGrokParser) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGrokParser) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsGrokParser) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsGrokParser) SetName(v string) { + o.Name = &v +} + +// GetSamples returns the Samples field value if set, zero value otherwise. +func (o *LogsGrokParser) GetSamples() []string { + if o == nil || o.Samples == nil { + var ret []string + return ret + } + return o.Samples +} + +// GetSamplesOk returns a tuple with the Samples field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGrokParser) GetSamplesOk() (*[]string, bool) { + if o == nil || o.Samples == nil { + return nil, false + } + return &o.Samples, true +} + +// HasSamples returns a boolean if a field has been set. +func (o *LogsGrokParser) HasSamples() bool { + if o != nil && o.Samples != nil { + return true + } + + return false +} + +// SetSamples gets a reference to the given []string and assigns it to the Samples field. +func (o *LogsGrokParser) SetSamples(v []string) { + o.Samples = v +} + +// GetSource returns the Source field value. +func (o *LogsGrokParser) GetSource() string { + if o == nil { + var ret string + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *LogsGrokParser) GetSourceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Source, true +} + +// SetSource sets field value. +func (o *LogsGrokParser) SetSource(v string) { + o.Source = v +} + +// GetType returns the Type field value. +func (o *LogsGrokParser) GetType() LogsGrokParserType { + if o == nil { + var ret LogsGrokParserType + 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 *LogsGrokParser) GetTypeOk() (*LogsGrokParserType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsGrokParser) SetType(v LogsGrokParserType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsGrokParser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["grok"] = o.Grok + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Samples != nil { + toSerialize["samples"] = o.Samples + } + toSerialize["source"] = o.Source + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Grok *LogsGrokParserRules `json:"grok"` + Source *string `json:"source"` + Type *LogsGrokParserType `json:"type"` + }{} + all := struct { + Grok LogsGrokParserRules `json:"grok"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Samples []string `json:"samples,omitempty"` + Source string `json:"source"` + Type LogsGrokParserType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Grok == nil { + return fmt.Errorf("Required field grok missing") + } + if required.Source == nil { + return fmt.Errorf("Required field source missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Grok.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Grok = all.Grok + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Samples = all.Samples + o.Source = all.Source + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_grok_parser_rules.go b/api/v1/datadog/model_logs_grok_parser_rules.go new file mode 100644 index 00000000000..1dcb84de9d3 --- /dev/null +++ b/api/v1/datadog/model_logs_grok_parser_rules.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsGrokParserRules Set of rules for the grok parser. +type LogsGrokParserRules struct { + // List of match rules for the grok parser, separated by a new line. + MatchRules string `json:"match_rules"` + // List of support rules for the grok parser, separated by a new line. + SupportRules *string `json:"support_rules,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{} +} + +// NewLogsGrokParserRules instantiates a new LogsGrokParserRules 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 NewLogsGrokParserRules(matchRules string) *LogsGrokParserRules { + this := LogsGrokParserRules{} + this.MatchRules = matchRules + var supportRules string = "" + this.SupportRules = &supportRules + return &this +} + +// NewLogsGrokParserRulesWithDefaults instantiates a new LogsGrokParserRules 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 NewLogsGrokParserRulesWithDefaults() *LogsGrokParserRules { + this := LogsGrokParserRules{} + var supportRules string = "" + this.SupportRules = &supportRules + return &this +} + +// GetMatchRules returns the MatchRules field value. +func (o *LogsGrokParserRules) GetMatchRules() string { + if o == nil { + var ret string + return ret + } + return o.MatchRules +} + +// GetMatchRulesOk returns a tuple with the MatchRules field value +// and a boolean to check if the value has been set. +func (o *LogsGrokParserRules) GetMatchRulesOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MatchRules, true +} + +// SetMatchRules sets field value. +func (o *LogsGrokParserRules) SetMatchRules(v string) { + o.MatchRules = v +} + +// GetSupportRules returns the SupportRules field value if set, zero value otherwise. +func (o *LogsGrokParserRules) GetSupportRules() string { + if o == nil || o.SupportRules == nil { + var ret string + return ret + } + return *o.SupportRules +} + +// GetSupportRulesOk returns a tuple with the SupportRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGrokParserRules) GetSupportRulesOk() (*string, bool) { + if o == nil || o.SupportRules == nil { + return nil, false + } + return o.SupportRules, true +} + +// HasSupportRules returns a boolean if a field has been set. +func (o *LogsGrokParserRules) HasSupportRules() bool { + if o != nil && o.SupportRules != nil { + return true + } + + return false +} + +// SetSupportRules gets a reference to the given string and assigns it to the SupportRules field. +func (o *LogsGrokParserRules) SetSupportRules(v string) { + o.SupportRules = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsGrokParserRules) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["match_rules"] = o.MatchRules + if o.SupportRules != nil { + toSerialize["support_rules"] = o.SupportRules + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsGrokParserRules) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + MatchRules *string `json:"match_rules"` + }{} + all := struct { + MatchRules string `json:"match_rules"` + SupportRules *string `json:"support_rules,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.MatchRules == nil { + return fmt.Errorf("Required field match_rules missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.MatchRules = all.MatchRules + o.SupportRules = all.SupportRules + return nil +} diff --git a/api/v1/datadog/model_logs_grok_parser_type.go b/api/v1/datadog/model_logs_grok_parser_type.go new file mode 100644 index 00000000000..1a59b876892 --- /dev/null +++ b/api/v1/datadog/model_logs_grok_parser_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsGrokParserType Type of logs grok parser. +type LogsGrokParserType string + +// List of LogsGrokParserType. +const ( + LOGSGROKPARSERTYPE_GROK_PARSER LogsGrokParserType = "grok-parser" +) + +var allowedLogsGrokParserTypeEnumValues = []LogsGrokParserType{ + LOGSGROKPARSERTYPE_GROK_PARSER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsGrokParserType) GetAllowedValues() []LogsGrokParserType { + return allowedLogsGrokParserTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsGrokParserType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsGrokParserType(value) + return nil +} + +// NewLogsGrokParserTypeFromValue returns a pointer to a valid LogsGrokParserType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsGrokParserTypeFromValue(v string) (*LogsGrokParserType, error) { + ev := LogsGrokParserType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsGrokParserType: valid values are %v", v, allowedLogsGrokParserTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsGrokParserType) IsValid() bool { + for _, existing := range allowedLogsGrokParserTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsGrokParserType value. +func (v LogsGrokParserType) Ptr() *LogsGrokParserType { + return &v +} + +// NullableLogsGrokParserType handles when a null is used for LogsGrokParserType. +type NullableLogsGrokParserType struct { + value *LogsGrokParserType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsGrokParserType) Get() *LogsGrokParserType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsGrokParserType) Set(val *LogsGrokParserType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsGrokParserType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsGrokParserType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsGrokParserType initializes the struct as if Set has been called. +func NewNullableLogsGrokParserType(val *LogsGrokParserType) *NullableLogsGrokParserType { + return &NullableLogsGrokParserType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsGrokParserType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsGrokParserType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_index.go b/api/v1/datadog/model_logs_index.go new file mode 100644 index 00000000000..d6715c78e20 --- /dev/null +++ b/api/v1/datadog/model_logs_index.go @@ -0,0 +1,303 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsIndex Object describing a Datadog Log index. +type LogsIndex struct { + // The number of log events you can send in this index per day before you are rate-limited. + DailyLimit *int64 `json:"daily_limit,omitempty"` + // An array of exclusion objects. The logs are tested against the query of each filter, + // following the order of the array. Only the first matching active exclusion matters, + // others (if any) are ignored. + ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` + // Filter for logs. + Filter LogsFilter `json:"filter"` + // A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. + // Rate limit is reset every-day at 2pm UTC. + IsRateLimited *bool `json:"is_rate_limited,omitempty"` + // The name of the index. + Name string `json:"name"` + // The number of days before logs are deleted from this index. Available values depend on + // retention plans specified in your organization's contract/subscriptions. + NumRetentionDays *int64 `json:"num_retention_days,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{} +} + +// NewLogsIndex instantiates a new LogsIndex 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 NewLogsIndex(filter LogsFilter, name string) *LogsIndex { + this := LogsIndex{} + this.Filter = filter + this.Name = name + return &this +} + +// NewLogsIndexWithDefaults instantiates a new LogsIndex 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 NewLogsIndexWithDefaults() *LogsIndex { + this := LogsIndex{} + return &this +} + +// GetDailyLimit returns the DailyLimit field value if set, zero value otherwise. +func (o *LogsIndex) GetDailyLimit() int64 { + if o == nil || o.DailyLimit == nil { + var ret int64 + return ret + } + return *o.DailyLimit +} + +// GetDailyLimitOk returns a tuple with the DailyLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndex) GetDailyLimitOk() (*int64, bool) { + if o == nil || o.DailyLimit == nil { + return nil, false + } + return o.DailyLimit, true +} + +// HasDailyLimit returns a boolean if a field has been set. +func (o *LogsIndex) HasDailyLimit() bool { + if o != nil && o.DailyLimit != nil { + return true + } + + return false +} + +// SetDailyLimit gets a reference to the given int64 and assigns it to the DailyLimit field. +func (o *LogsIndex) SetDailyLimit(v int64) { + o.DailyLimit = &v +} + +// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. +func (o *LogsIndex) GetExclusionFilters() []LogsExclusion { + if o == nil || o.ExclusionFilters == nil { + var ret []LogsExclusion + return ret + } + return o.ExclusionFilters +} + +// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndex) GetExclusionFiltersOk() (*[]LogsExclusion, bool) { + if o == nil || o.ExclusionFilters == nil { + return nil, false + } + return &o.ExclusionFilters, true +} + +// HasExclusionFilters returns a boolean if a field has been set. +func (o *LogsIndex) HasExclusionFilters() bool { + if o != nil && o.ExclusionFilters != nil { + return true + } + + return false +} + +// SetExclusionFilters gets a reference to the given []LogsExclusion and assigns it to the ExclusionFilters field. +func (o *LogsIndex) SetExclusionFilters(v []LogsExclusion) { + o.ExclusionFilters = v +} + +// GetFilter returns the Filter field value. +func (o *LogsIndex) GetFilter() LogsFilter { + if o == nil { + var ret LogsFilter + return ret + } + return o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value +// and a boolean to check if the value has been set. +func (o *LogsIndex) GetFilterOk() (*LogsFilter, bool) { + if o == nil { + return nil, false + } + return &o.Filter, true +} + +// SetFilter sets field value. +func (o *LogsIndex) SetFilter(v LogsFilter) { + o.Filter = v +} + +// GetIsRateLimited returns the IsRateLimited field value if set, zero value otherwise. +func (o *LogsIndex) GetIsRateLimited() bool { + if o == nil || o.IsRateLimited == nil { + var ret bool + return ret + } + return *o.IsRateLimited +} + +// GetIsRateLimitedOk returns a tuple with the IsRateLimited field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndex) GetIsRateLimitedOk() (*bool, bool) { + if o == nil || o.IsRateLimited == nil { + return nil, false + } + return o.IsRateLimited, true +} + +// HasIsRateLimited returns a boolean if a field has been set. +func (o *LogsIndex) HasIsRateLimited() bool { + if o != nil && o.IsRateLimited != nil { + return true + } + + return false +} + +// SetIsRateLimited gets a reference to the given bool and assigns it to the IsRateLimited field. +func (o *LogsIndex) SetIsRateLimited(v bool) { + o.IsRateLimited = &v +} + +// GetName returns the Name field value. +func (o *LogsIndex) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *LogsIndex) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *LogsIndex) SetName(v string) { + o.Name = v +} + +// GetNumRetentionDays returns the NumRetentionDays field value if set, zero value otherwise. +func (o *LogsIndex) GetNumRetentionDays() int64 { + if o == nil || o.NumRetentionDays == nil { + var ret int64 + return ret + } + return *o.NumRetentionDays +} + +// GetNumRetentionDaysOk returns a tuple with the NumRetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndex) GetNumRetentionDaysOk() (*int64, bool) { + if o == nil || o.NumRetentionDays == nil { + return nil, false + } + return o.NumRetentionDays, true +} + +// HasNumRetentionDays returns a boolean if a field has been set. +func (o *LogsIndex) HasNumRetentionDays() bool { + if o != nil && o.NumRetentionDays != nil { + return true + } + + return false +} + +// SetNumRetentionDays gets a reference to the given int64 and assigns it to the NumRetentionDays field. +func (o *LogsIndex) SetNumRetentionDays(v int64) { + o.NumRetentionDays = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsIndex) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DailyLimit != nil { + toSerialize["daily_limit"] = o.DailyLimit + } + if o.ExclusionFilters != nil { + toSerialize["exclusion_filters"] = o.ExclusionFilters + } + toSerialize["filter"] = o.Filter + if o.IsRateLimited != nil { + toSerialize["is_rate_limited"] = o.IsRateLimited + } + toSerialize["name"] = o.Name + if o.NumRetentionDays != nil { + toSerialize["num_retention_days"] = o.NumRetentionDays + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Filter *LogsFilter `json:"filter"` + Name *string `json:"name"` + }{} + all := struct { + DailyLimit *int64 `json:"daily_limit,omitempty"` + ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` + Filter LogsFilter `json:"filter"` + IsRateLimited *bool `json:"is_rate_limited,omitempty"` + Name string `json:"name"` + NumRetentionDays *int64 `json:"num_retention_days,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Filter == nil { + return fmt.Errorf("Required field filter missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DailyLimit = all.DailyLimit + o.ExclusionFilters = all.ExclusionFilters + if all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.IsRateLimited = all.IsRateLimited + o.Name = all.Name + o.NumRetentionDays = all.NumRetentionDays + return nil +} diff --git a/api/v1/datadog/model_logs_index_list_response.go b/api/v1/datadog/model_logs_index_list_response.go new file mode 100644 index 00000000000..dd00ac6e4a5 --- /dev/null +++ b/api/v1/datadog/model_logs_index_list_response.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 datadog + +import ( + "encoding/json" +) + +// LogsIndexListResponse Object with all Index configurations for a given organization. +type LogsIndexListResponse struct { + // Array of Log index configurations. + Indexes []LogsIndex `json:"indexes,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{} +} + +// NewLogsIndexListResponse instantiates a new LogsIndexListResponse 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 NewLogsIndexListResponse() *LogsIndexListResponse { + this := LogsIndexListResponse{} + return &this +} + +// NewLogsIndexListResponseWithDefaults instantiates a new LogsIndexListResponse 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 NewLogsIndexListResponseWithDefaults() *LogsIndexListResponse { + this := LogsIndexListResponse{} + return &this +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *LogsIndexListResponse) GetIndexes() []LogsIndex { + if o == nil || o.Indexes == nil { + var ret []LogsIndex + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndexListResponse) GetIndexesOk() (*[]LogsIndex, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *LogsIndexListResponse) HasIndexes() bool { + if o != nil && o.Indexes != nil { + return true + } + + return false +} + +// SetIndexes gets a reference to the given []LogsIndex and assigns it to the Indexes field. +func (o *LogsIndexListResponse) SetIndexes(v []LogsIndex) { + o.Indexes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsIndexListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsIndexListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Indexes []LogsIndex `json:"indexes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Indexes = all.Indexes + return nil +} diff --git a/api/v1/datadog/model_logs_index_update_request.go b/api/v1/datadog/model_logs_index_update_request.go new file mode 100644 index 00000000000..eb3765aae33 --- /dev/null +++ b/api/v1/datadog/model_logs_index_update_request.go @@ -0,0 +1,274 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsIndexUpdateRequest Object for updating a Datadog Log index. +type LogsIndexUpdateRequest struct { + // The number of log events you can send in this index per day before you are rate-limited. + DailyLimit *int64 `json:"daily_limit,omitempty"` + // If true, sets the `daily_limit` value to null and the index is not limited on a daily basis (any + // specified `daily_limit` value in the request is ignored). If false or omitted, the index's current + // `daily_limit` is maintained. + DisableDailyLimit *bool `json:"disable_daily_limit,omitempty"` + // An array of exclusion objects. The logs are tested against the query of each filter, + // following the order of the array. Only the first matching active exclusion matters, + // others (if any) are ignored. + ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` + // Filter for logs. + Filter LogsFilter `json:"filter"` + // The number of days before logs are deleted from this index. Available values depend on + // retention plans specified in your organization's contract/subscriptions. + // + // **Note:** Changing the retention for an index adjusts the length of retention for all logs + // already in this index. It may also affect billing. + NumRetentionDays *int64 `json:"num_retention_days,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{} +} + +// NewLogsIndexUpdateRequest instantiates a new LogsIndexUpdateRequest 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 NewLogsIndexUpdateRequest(filter LogsFilter) *LogsIndexUpdateRequest { + this := LogsIndexUpdateRequest{} + this.Filter = filter + return &this +} + +// NewLogsIndexUpdateRequestWithDefaults instantiates a new LogsIndexUpdateRequest 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 NewLogsIndexUpdateRequestWithDefaults() *LogsIndexUpdateRequest { + this := LogsIndexUpdateRequest{} + return &this +} + +// GetDailyLimit returns the DailyLimit field value if set, zero value otherwise. +func (o *LogsIndexUpdateRequest) GetDailyLimit() int64 { + if o == nil || o.DailyLimit == nil { + var ret int64 + return ret + } + return *o.DailyLimit +} + +// GetDailyLimitOk returns a tuple with the DailyLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndexUpdateRequest) GetDailyLimitOk() (*int64, bool) { + if o == nil || o.DailyLimit == nil { + return nil, false + } + return o.DailyLimit, true +} + +// HasDailyLimit returns a boolean if a field has been set. +func (o *LogsIndexUpdateRequest) HasDailyLimit() bool { + if o != nil && o.DailyLimit != nil { + return true + } + + return false +} + +// SetDailyLimit gets a reference to the given int64 and assigns it to the DailyLimit field. +func (o *LogsIndexUpdateRequest) SetDailyLimit(v int64) { + o.DailyLimit = &v +} + +// GetDisableDailyLimit returns the DisableDailyLimit field value if set, zero value otherwise. +func (o *LogsIndexUpdateRequest) GetDisableDailyLimit() bool { + if o == nil || o.DisableDailyLimit == nil { + var ret bool + return ret + } + return *o.DisableDailyLimit +} + +// GetDisableDailyLimitOk returns a tuple with the DisableDailyLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndexUpdateRequest) GetDisableDailyLimitOk() (*bool, bool) { + if o == nil || o.DisableDailyLimit == nil { + return nil, false + } + return o.DisableDailyLimit, true +} + +// HasDisableDailyLimit returns a boolean if a field has been set. +func (o *LogsIndexUpdateRequest) HasDisableDailyLimit() bool { + if o != nil && o.DisableDailyLimit != nil { + return true + } + + return false +} + +// SetDisableDailyLimit gets a reference to the given bool and assigns it to the DisableDailyLimit field. +func (o *LogsIndexUpdateRequest) SetDisableDailyLimit(v bool) { + o.DisableDailyLimit = &v +} + +// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. +func (o *LogsIndexUpdateRequest) GetExclusionFilters() []LogsExclusion { + if o == nil || o.ExclusionFilters == nil { + var ret []LogsExclusion + return ret + } + return o.ExclusionFilters +} + +// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndexUpdateRequest) GetExclusionFiltersOk() (*[]LogsExclusion, bool) { + if o == nil || o.ExclusionFilters == nil { + return nil, false + } + return &o.ExclusionFilters, true +} + +// HasExclusionFilters returns a boolean if a field has been set. +func (o *LogsIndexUpdateRequest) HasExclusionFilters() bool { + if o != nil && o.ExclusionFilters != nil { + return true + } + + return false +} + +// SetExclusionFilters gets a reference to the given []LogsExclusion and assigns it to the ExclusionFilters field. +func (o *LogsIndexUpdateRequest) SetExclusionFilters(v []LogsExclusion) { + o.ExclusionFilters = v +} + +// GetFilter returns the Filter field value. +func (o *LogsIndexUpdateRequest) GetFilter() LogsFilter { + if o == nil { + var ret LogsFilter + return ret + } + return o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value +// and a boolean to check if the value has been set. +func (o *LogsIndexUpdateRequest) GetFilterOk() (*LogsFilter, bool) { + if o == nil { + return nil, false + } + return &o.Filter, true +} + +// SetFilter sets field value. +func (o *LogsIndexUpdateRequest) SetFilter(v LogsFilter) { + o.Filter = v +} + +// GetNumRetentionDays returns the NumRetentionDays field value if set, zero value otherwise. +func (o *LogsIndexUpdateRequest) GetNumRetentionDays() int64 { + if o == nil || o.NumRetentionDays == nil { + var ret int64 + return ret + } + return *o.NumRetentionDays +} + +// GetNumRetentionDaysOk returns a tuple with the NumRetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsIndexUpdateRequest) GetNumRetentionDaysOk() (*int64, bool) { + if o == nil || o.NumRetentionDays == nil { + return nil, false + } + return o.NumRetentionDays, true +} + +// HasNumRetentionDays returns a boolean if a field has been set. +func (o *LogsIndexUpdateRequest) HasNumRetentionDays() bool { + if o != nil && o.NumRetentionDays != nil { + return true + } + + return false +} + +// SetNumRetentionDays gets a reference to the given int64 and assigns it to the NumRetentionDays field. +func (o *LogsIndexUpdateRequest) SetNumRetentionDays(v int64) { + o.NumRetentionDays = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsIndexUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DailyLimit != nil { + toSerialize["daily_limit"] = o.DailyLimit + } + if o.DisableDailyLimit != nil { + toSerialize["disable_daily_limit"] = o.DisableDailyLimit + } + if o.ExclusionFilters != nil { + toSerialize["exclusion_filters"] = o.ExclusionFilters + } + toSerialize["filter"] = o.Filter + if o.NumRetentionDays != nil { + toSerialize["num_retention_days"] = o.NumRetentionDays + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Filter *LogsFilter `json:"filter"` + }{} + all := struct { + DailyLimit *int64 `json:"daily_limit,omitempty"` + DisableDailyLimit *bool `json:"disable_daily_limit,omitempty"` + ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` + Filter LogsFilter `json:"filter"` + NumRetentionDays *int64 `json:"num_retention_days,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Filter == nil { + return fmt.Errorf("Required field filter missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DailyLimit = all.DailyLimit + o.DisableDailyLimit = all.DisableDailyLimit + o.ExclusionFilters = all.ExclusionFilters + if all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.NumRetentionDays = all.NumRetentionDays + return nil +} diff --git a/api/v1/datadog/model_logs_indexes_order.go b/api/v1/datadog/model_logs_indexes_order.go new file mode 100644 index 00000000000..fecda023599 --- /dev/null +++ b/api/v1/datadog/model_logs_indexes_order.go @@ -0,0 +1,105 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsIndexesOrder Object containing the ordered list of log index names. +type LogsIndexesOrder struct { + // Array of strings identifying by their name(s) the index(es) of your organization. + // Logs are tested against the query filter of each index one by one, following the order of the array. + // Logs are eventually stored in the first matching index. + IndexNames []string `json:"index_names"` + // 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{} +} + +// NewLogsIndexesOrder instantiates a new LogsIndexesOrder 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 NewLogsIndexesOrder(indexNames []string) *LogsIndexesOrder { + this := LogsIndexesOrder{} + this.IndexNames = indexNames + return &this +} + +// NewLogsIndexesOrderWithDefaults instantiates a new LogsIndexesOrder 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 NewLogsIndexesOrderWithDefaults() *LogsIndexesOrder { + this := LogsIndexesOrder{} + return &this +} + +// GetIndexNames returns the IndexNames field value. +func (o *LogsIndexesOrder) GetIndexNames() []string { + if o == nil { + var ret []string + return ret + } + return o.IndexNames +} + +// GetIndexNamesOk returns a tuple with the IndexNames field value +// and a boolean to check if the value has been set. +func (o *LogsIndexesOrder) GetIndexNamesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.IndexNames, true +} + +// SetIndexNames sets field value. +func (o *LogsIndexesOrder) SetIndexNames(v []string) { + o.IndexNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsIndexesOrder) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["index_names"] = o.IndexNames + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsIndexesOrder) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + IndexNames *[]string `json:"index_names"` + }{} + all := struct { + IndexNames []string `json:"index_names"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.IndexNames == nil { + return fmt.Errorf("Required field index_names missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IndexNames = all.IndexNames + return nil +} diff --git a/api/v1/datadog/model_logs_list_request.go b/api/v1/datadog/model_logs_list_request.go new file mode 100644 index 00000000000..3adfa1c8574 --- /dev/null +++ b/api/v1/datadog/model_logs_list_request.go @@ -0,0 +1,318 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsListRequest Object to send with the request to retrieve a list of logs from your Organization. +type LogsListRequest struct { + // The log index on which the request is performed. For multi-index organizations, + // the default is all live indexes. Historical indexes of rehydrated logs must be specified. + Index *string `json:"index,omitempty"` + // Number of logs return in the response. + Limit *int32 `json:"limit,omitempty"` + // The search query - following the log search syntax. + Query *string `json:"query,omitempty"` + // Time-ascending `asc` or time-descending `desc` results. + Sort *LogsSort `json:"sort,omitempty"` + // Hash identifier of the first log to return in the list, available in a log `id` attribute. + // This parameter is used for the pagination feature. + // + // **Note**: This parameter is ignored if the corresponding log + // is out of the scope of the specified time window. + StartAt *string `json:"startAt,omitempty"` + // Timeframe to retrieve the log from. + Time LogsListRequestTime `json:"time"` + // 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{} +} + +// NewLogsListRequest instantiates a new LogsListRequest 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 NewLogsListRequest(time LogsListRequestTime) *LogsListRequest { + this := LogsListRequest{} + this.Time = time + return &this +} + +// NewLogsListRequestWithDefaults instantiates a new LogsListRequest 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 NewLogsListRequestWithDefaults() *LogsListRequest { + this := LogsListRequest{} + return &this +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *LogsListRequest) GetIndex() string { + if o == nil || o.Index == nil { + var ret string + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetIndexOk() (*string, bool) { + if o == nil || o.Index == nil { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *LogsListRequest) HasIndex() bool { + if o != nil && o.Index != nil { + return true + } + + return false +} + +// SetIndex gets a reference to the given string and assigns it to the Index field. +func (o *LogsListRequest) SetIndex(v string) { + o.Index = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *LogsListRequest) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *LogsListRequest) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *LogsListRequest) SetLimit(v int32) { + o.Limit = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *LogsListRequest) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *LogsListRequest) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *LogsListRequest) SetQuery(v string) { + o.Query = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *LogsListRequest) GetSort() LogsSort { + if o == nil || o.Sort == nil { + var ret LogsSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetSortOk() (*LogsSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *LogsListRequest) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given LogsSort and assigns it to the Sort field. +func (o *LogsListRequest) SetSort(v LogsSort) { + o.Sort = &v +} + +// GetStartAt returns the StartAt field value if set, zero value otherwise. +func (o *LogsListRequest) GetStartAt() string { + if o == nil || o.StartAt == nil { + var ret string + return ret + } + return *o.StartAt +} + +// GetStartAtOk returns a tuple with the StartAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetStartAtOk() (*string, bool) { + if o == nil || o.StartAt == nil { + return nil, false + } + return o.StartAt, true +} + +// HasStartAt returns a boolean if a field has been set. +func (o *LogsListRequest) HasStartAt() bool { + if o != nil && o.StartAt != nil { + return true + } + + return false +} + +// SetStartAt gets a reference to the given string and assigns it to the StartAt field. +func (o *LogsListRequest) SetStartAt(v string) { + o.StartAt = &v +} + +// GetTime returns the Time field value. +func (o *LogsListRequest) GetTime() LogsListRequestTime { + if o == nil { + var ret LogsListRequestTime + return ret + } + return o.Time +} + +// GetTimeOk returns a tuple with the Time field value +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetTimeOk() (*LogsListRequestTime, bool) { + if o == nil { + return nil, false + } + return &o.Time, true +} + +// SetTime sets field value. +func (o *LogsListRequest) SetTime(v LogsListRequestTime) { + o.Time = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsListRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Index != nil { + toSerialize["index"] = o.Index + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.StartAt != nil { + toSerialize["startAt"] = o.StartAt + } + toSerialize["time"] = o.Time + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Time *LogsListRequestTime `json:"time"` + }{} + all := struct { + Index *string `json:"index,omitempty"` + Limit *int32 `json:"limit,omitempty"` + Query *string `json:"query,omitempty"` + Sort *LogsSort `json:"sort,omitempty"` + StartAt *string `json:"startAt,omitempty"` + Time LogsListRequestTime `json:"time"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Time == nil { + return fmt.Errorf("Required field time missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Index = all.Index + o.Limit = all.Limit + o.Query = all.Query + o.Sort = all.Sort + o.StartAt = all.StartAt + if all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_logs_list_request_time.go b/api/v1/datadog/model_logs_list_request_time.go new file mode 100644 index 00000000000..dfd409ad7fd --- /dev/null +++ b/api/v1/datadog/model_logs_list_request_time.go @@ -0,0 +1,185 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" +) + +// LogsListRequestTime Timeframe to retrieve the log from. +type LogsListRequestTime struct { + // Minimum timestamp for requested logs. + From time.Time `json:"from"` + // Timezone can be specified both as an offset (for example "UTC+03:00") + // or a regional zone (for example "Europe/Paris"). + Timezone *string `json:"timezone,omitempty"` + // Maximum timestamp for requested logs. + To time.Time `json:"to"` + // 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{} +} + +// NewLogsListRequestTime instantiates a new LogsListRequestTime 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 NewLogsListRequestTime(from time.Time, to time.Time) *LogsListRequestTime { + this := LogsListRequestTime{} + this.From = from + this.To = to + return &this +} + +// NewLogsListRequestTimeWithDefaults instantiates a new LogsListRequestTime 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 NewLogsListRequestTimeWithDefaults() *LogsListRequestTime { + this := LogsListRequestTime{} + return &this +} + +// GetFrom returns the From field value. +func (o *LogsListRequestTime) GetFrom() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.From +} + +// GetFromOk returns a tuple with the From field value +// and a boolean to check if the value has been set. +func (o *LogsListRequestTime) GetFromOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.From, true +} + +// SetFrom sets field value. +func (o *LogsListRequestTime) SetFrom(v time.Time) { + o.From = v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *LogsListRequestTime) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequestTime) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *LogsListRequestTime) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *LogsListRequestTime) SetTimezone(v string) { + o.Timezone = &v +} + +// GetTo returns the To field value. +func (o *LogsListRequestTime) GetTo() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *LogsListRequestTime) GetToOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value. +func (o *LogsListRequestTime) SetTo(v time.Time) { + o.To = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsListRequestTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From.Nanosecond() == 0 { + toSerialize["from"] = o.From.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["from"] = o.From.Format("2006-01-02T15:04:05.000Z07:00") + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + if o.To.Nanosecond() == 0 { + toSerialize["to"] = o.To.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["to"] = o.To.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsListRequestTime) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + From *time.Time `json:"from"` + To *time.Time `json:"to"` + }{} + all := struct { + From time.Time `json:"from"` + Timezone *string `json:"timezone,omitempty"` + To time.Time `json:"to"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.From == nil { + return fmt.Errorf("Required field from missing") + } + if required.To == nil { + return fmt.Errorf("Required field to missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.From = all.From + o.Timezone = all.Timezone + o.To = all.To + return nil +} diff --git a/api/v1/datadog/model_logs_list_response.go b/api/v1/datadog/model_logs_list_response.go new file mode 100644 index 00000000000..02b5e778efc --- /dev/null +++ b/api/v1/datadog/model_logs_list_response.go @@ -0,0 +1,181 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsListResponse Response object with all logs matching the request and pagination information. +type LogsListResponse struct { + // Array of logs matching the request and the `nextLogId` if sent. + Logs []Log `json:"logs,omitempty"` + // Hash identifier of the next log to return in the list. + // This parameter is used for the pagination feature. + NextLogId *string `json:"nextLogId,omitempty"` + // Status of the response. + Status *string `json:"status,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{} +} + +// NewLogsListResponse instantiates a new LogsListResponse 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 NewLogsListResponse() *LogsListResponse { + this := LogsListResponse{} + return &this +} + +// NewLogsListResponseWithDefaults instantiates a new LogsListResponse 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 NewLogsListResponseWithDefaults() *LogsListResponse { + this := LogsListResponse{} + return &this +} + +// GetLogs returns the Logs field value if set, zero value otherwise. +func (o *LogsListResponse) GetLogs() []Log { + if o == nil || o.Logs == nil { + var ret []Log + return ret + } + return o.Logs +} + +// GetLogsOk returns a tuple with the Logs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListResponse) GetLogsOk() (*[]Log, bool) { + if o == nil || o.Logs == nil { + return nil, false + } + return &o.Logs, true +} + +// HasLogs returns a boolean if a field has been set. +func (o *LogsListResponse) HasLogs() bool { + if o != nil && o.Logs != nil { + return true + } + + return false +} + +// SetLogs gets a reference to the given []Log and assigns it to the Logs field. +func (o *LogsListResponse) SetLogs(v []Log) { + o.Logs = v +} + +// GetNextLogId returns the NextLogId field value if set, zero value otherwise. +func (o *LogsListResponse) GetNextLogId() string { + if o == nil || o.NextLogId == nil { + var ret string + return ret + } + return *o.NextLogId +} + +// GetNextLogIdOk returns a tuple with the NextLogId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListResponse) GetNextLogIdOk() (*string, bool) { + if o == nil || o.NextLogId == nil { + return nil, false + } + return o.NextLogId, true +} + +// HasNextLogId returns a boolean if a field has been set. +func (o *LogsListResponse) HasNextLogId() bool { + if o != nil && o.NextLogId != nil { + return true + } + + return false +} + +// SetNextLogId gets a reference to the given string and assigns it to the NextLogId field. +func (o *LogsListResponse) SetNextLogId(v string) { + o.NextLogId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *LogsListResponse) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListResponse) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *LogsListResponse) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *LogsListResponse) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Logs != nil { + toSerialize["logs"] = o.Logs + } + if o.NextLogId != nil { + toSerialize["nextLogId"] = o.NextLogId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Logs []Log `json:"logs,omitempty"` + NextLogId *string `json:"nextLogId,omitempty"` + Status *string `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Logs = all.Logs + o.NextLogId = all.NextLogId + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_logs_lookup_processor.go b/api/v1/datadog/model_logs_lookup_processor.go new file mode 100644 index 00000000000..09e29afc8a4 --- /dev/null +++ b/api/v1/datadog/model_logs_lookup_processor.go @@ -0,0 +1,340 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsLookupProcessor Use the Lookup Processor to define a mapping between a log attribute +// and a human readable value saved in the processors mapping table. +// For example, you can use the Lookup Processor to map an internal service ID +// into a human readable service name. Alternatively, you could also use it to check +// if the MAC address that just attempted to connect to the production +// environment belongs to your list of stolen machines. +type LogsLookupProcessor struct { + // Value to set the target attribute if the source value is not found in the list. + DefaultLookup *string `json:"default_lookup,omitempty"` + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Mapping table of values for the source attribute and their associated target attribute values, + // formatted as `["source_key1,target_value1", "source_key2,target_value2"]` + LookupTable []string `json:"lookup_table"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Source attribute used to perform the lookup. + Source string `json:"source"` + // Name of the attribute that contains the corresponding value in the mapping list + // or the `default_lookup` if not found in the mapping list. + Target string `json:"target"` + // Type of logs lookup processor. + Type LogsLookupProcessorType `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{} +} + +// NewLogsLookupProcessor instantiates a new LogsLookupProcessor 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 NewLogsLookupProcessor(lookupTable []string, source string, target string, typeVar LogsLookupProcessorType) *LogsLookupProcessor { + this := LogsLookupProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.LookupTable = lookupTable + this.Source = source + this.Target = target + this.Type = typeVar + return &this +} + +// NewLogsLookupProcessorWithDefaults instantiates a new LogsLookupProcessor 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 NewLogsLookupProcessorWithDefaults() *LogsLookupProcessor { + this := LogsLookupProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsLookupProcessorType = LOGSLOOKUPPROCESSORTYPE_LOOKUP_PROCESSOR + this.Type = typeVar + return &this +} + +// GetDefaultLookup returns the DefaultLookup field value if set, zero value otherwise. +func (o *LogsLookupProcessor) GetDefaultLookup() string { + if o == nil || o.DefaultLookup == nil { + var ret string + return ret + } + return *o.DefaultLookup +} + +// GetDefaultLookupOk returns a tuple with the DefaultLookup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsLookupProcessor) GetDefaultLookupOk() (*string, bool) { + if o == nil || o.DefaultLookup == nil { + return nil, false + } + return o.DefaultLookup, true +} + +// HasDefaultLookup returns a boolean if a field has been set. +func (o *LogsLookupProcessor) HasDefaultLookup() bool { + if o != nil && o.DefaultLookup != nil { + return true + } + + return false +} + +// SetDefaultLookup gets a reference to the given string and assigns it to the DefaultLookup field. +func (o *LogsLookupProcessor) SetDefaultLookup(v string) { + o.DefaultLookup = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsLookupProcessor) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsLookupProcessor) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsLookupProcessor) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsLookupProcessor) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetLookupTable returns the LookupTable field value. +func (o *LogsLookupProcessor) GetLookupTable() []string { + if o == nil { + var ret []string + return ret + } + return o.LookupTable +} + +// GetLookupTableOk returns a tuple with the LookupTable field value +// and a boolean to check if the value has been set. +func (o *LogsLookupProcessor) GetLookupTableOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.LookupTable, true +} + +// SetLookupTable sets field value. +func (o *LogsLookupProcessor) SetLookupTable(v []string) { + o.LookupTable = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsLookupProcessor) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsLookupProcessor) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsLookupProcessor) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsLookupProcessor) SetName(v string) { + o.Name = &v +} + +// GetSource returns the Source field value. +func (o *LogsLookupProcessor) GetSource() string { + if o == nil { + var ret string + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *LogsLookupProcessor) GetSourceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Source, true +} + +// SetSource sets field value. +func (o *LogsLookupProcessor) SetSource(v string) { + o.Source = v +} + +// GetTarget returns the Target field value. +func (o *LogsLookupProcessor) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsLookupProcessor) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsLookupProcessor) SetTarget(v string) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *LogsLookupProcessor) GetType() LogsLookupProcessorType { + if o == nil { + var ret LogsLookupProcessorType + 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 *LogsLookupProcessor) GetTypeOk() (*LogsLookupProcessorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsLookupProcessor) SetType(v LogsLookupProcessorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsLookupProcessor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DefaultLookup != nil { + toSerialize["default_lookup"] = o.DefaultLookup + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + toSerialize["lookup_table"] = o.LookupTable + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["source"] = o.Source + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + LookupTable *[]string `json:"lookup_table"` + Source *string `json:"source"` + Target *string `json:"target"` + Type *LogsLookupProcessorType `json:"type"` + }{} + all := struct { + DefaultLookup *string `json:"default_lookup,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + LookupTable []string `json:"lookup_table"` + Name *string `json:"name,omitempty"` + Source string `json:"source"` + Target string `json:"target"` + Type LogsLookupProcessorType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.LookupTable == nil { + return fmt.Errorf("Required field lookup_table missing") + } + if required.Source == nil { + return fmt.Errorf("Required field source missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DefaultLookup = all.DefaultLookup + o.IsEnabled = all.IsEnabled + o.LookupTable = all.LookupTable + o.Name = all.Name + o.Source = all.Source + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_lookup_processor_type.go b/api/v1/datadog/model_logs_lookup_processor_type.go new file mode 100644 index 00000000000..4816a2af434 --- /dev/null +++ b/api/v1/datadog/model_logs_lookup_processor_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsLookupProcessorType Type of logs lookup processor. +type LogsLookupProcessorType string + +// List of LogsLookupProcessorType. +const ( + LOGSLOOKUPPROCESSORTYPE_LOOKUP_PROCESSOR LogsLookupProcessorType = "lookup-processor" +) + +var allowedLogsLookupProcessorTypeEnumValues = []LogsLookupProcessorType{ + LOGSLOOKUPPROCESSORTYPE_LOOKUP_PROCESSOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsLookupProcessorType) GetAllowedValues() []LogsLookupProcessorType { + return allowedLogsLookupProcessorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsLookupProcessorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsLookupProcessorType(value) + return nil +} + +// NewLogsLookupProcessorTypeFromValue returns a pointer to a valid LogsLookupProcessorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsLookupProcessorTypeFromValue(v string) (*LogsLookupProcessorType, error) { + ev := LogsLookupProcessorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsLookupProcessorType: valid values are %v", v, allowedLogsLookupProcessorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsLookupProcessorType) IsValid() bool { + for _, existing := range allowedLogsLookupProcessorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsLookupProcessorType value. +func (v LogsLookupProcessorType) Ptr() *LogsLookupProcessorType { + return &v +} + +// NullableLogsLookupProcessorType handles when a null is used for LogsLookupProcessorType. +type NullableLogsLookupProcessorType struct { + value *LogsLookupProcessorType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsLookupProcessorType) Get() *LogsLookupProcessorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsLookupProcessorType) Set(val *LogsLookupProcessorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsLookupProcessorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsLookupProcessorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsLookupProcessorType initializes the struct as if Set has been called. +func NewNullableLogsLookupProcessorType(val *LogsLookupProcessorType) *NullableLogsLookupProcessorType { + return &NullableLogsLookupProcessorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsLookupProcessorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsLookupProcessorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_message_remapper.go b/api/v1/datadog/model_logs_message_remapper.go new file mode 100644 index 00000000000..7ed39f4a764 --- /dev/null +++ b/api/v1/datadog/model_logs_message_remapper.go @@ -0,0 +1,233 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMessageRemapper The message is a key attribute in Datadog. +// It is displayed in the message column of the Log Explorer and you can do full string search on it. +// Use this Processor to define one or more attributes as the official log message. +// +// **Note:** If multiple log message remapper processors can be applied to a given log, +// only the first one (according to the pipeline order) is taken into account. +type LogsMessageRemapper struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Type of logs message remapper. + Type LogsMessageRemapperType `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{} +} + +// NewLogsMessageRemapper instantiates a new LogsMessageRemapper 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 NewLogsMessageRemapper(sources []string, typeVar LogsMessageRemapperType) *LogsMessageRemapper { + this := LogsMessageRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Sources = sources + this.Type = typeVar + return &this +} + +// NewLogsMessageRemapperWithDefaults instantiates a new LogsMessageRemapper 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 NewLogsMessageRemapperWithDefaults() *LogsMessageRemapper { + this := LogsMessageRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsMessageRemapperType = LOGSMESSAGEREMAPPERTYPE_MESSAGE_REMAPPER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsMessageRemapper) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMessageRemapper) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsMessageRemapper) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsMessageRemapper) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsMessageRemapper) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMessageRemapper) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsMessageRemapper) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsMessageRemapper) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value. +func (o *LogsMessageRemapper) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsMessageRemapper) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsMessageRemapper) SetSources(v []string) { + o.Sources = v +} + +// GetType returns the Type field value. +func (o *LogsMessageRemapper) GetType() LogsMessageRemapperType { + if o == nil { + var ret LogsMessageRemapperType + 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 *LogsMessageRemapper) GetTypeOk() (*LogsMessageRemapperType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsMessageRemapper) SetType(v LogsMessageRemapperType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMessageRemapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["sources"] = o.Sources + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Type *LogsMessageRemapperType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources"` + Type LogsMessageRemapperType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Sources = all.Sources + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_message_remapper_type.go b/api/v1/datadog/model_logs_message_remapper_type.go new file mode 100644 index 00000000000..b4a9ae036d7 --- /dev/null +++ b/api/v1/datadog/model_logs_message_remapper_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMessageRemapperType Type of logs message remapper. +type LogsMessageRemapperType string + +// List of LogsMessageRemapperType. +const ( + LOGSMESSAGEREMAPPERTYPE_MESSAGE_REMAPPER LogsMessageRemapperType = "message-remapper" +) + +var allowedLogsMessageRemapperTypeEnumValues = []LogsMessageRemapperType{ + LOGSMESSAGEREMAPPERTYPE_MESSAGE_REMAPPER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsMessageRemapperType) GetAllowedValues() []LogsMessageRemapperType { + return allowedLogsMessageRemapperTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsMessageRemapperType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsMessageRemapperType(value) + return nil +} + +// NewLogsMessageRemapperTypeFromValue returns a pointer to a valid LogsMessageRemapperType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsMessageRemapperTypeFromValue(v string) (*LogsMessageRemapperType, error) { + ev := LogsMessageRemapperType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsMessageRemapperType: valid values are %v", v, allowedLogsMessageRemapperTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsMessageRemapperType) IsValid() bool { + for _, existing := range allowedLogsMessageRemapperTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsMessageRemapperType value. +func (v LogsMessageRemapperType) Ptr() *LogsMessageRemapperType { + return &v +} + +// NullableLogsMessageRemapperType handles when a null is used for LogsMessageRemapperType. +type NullableLogsMessageRemapperType struct { + value *LogsMessageRemapperType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsMessageRemapperType) Get() *LogsMessageRemapperType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsMessageRemapperType) Set(val *LogsMessageRemapperType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsMessageRemapperType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsMessageRemapperType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsMessageRemapperType initializes the struct as if Set has been called. +func NewNullableLogsMessageRemapperType(val *LogsMessageRemapperType) *NullableLogsMessageRemapperType { + return &NullableLogsMessageRemapperType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsMessageRemapperType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsMessageRemapperType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_pipeline.go b/api/v1/datadog/model_logs_pipeline.go new file mode 100644 index 00000000000..b5f3b90898e --- /dev/null +++ b/api/v1/datadog/model_logs_pipeline.go @@ -0,0 +1,348 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsPipeline Pipelines and processors operate on incoming logs, +// parsing and transforming them into structured attributes for easier querying. +// +// **Note**: These endpoints are only available for admin users. +// Make sure to use an application key created by an admin. +type LogsPipeline struct { + // Filter for logs. + Filter *LogsFilter `json:"filter,omitempty"` + // ID of the pipeline. + Id *string `json:"id,omitempty"` + // Whether or not the pipeline is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Whether or not the pipeline can be edited. + IsReadOnly *bool `json:"is_read_only,omitempty"` + // Name of the pipeline. + Name string `json:"name"` + // Ordered list of processors in this pipeline. + Processors []LogsProcessor `json:"processors,omitempty"` + // Type of pipeline. + Type *string `json:"type,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{} +} + +// NewLogsPipeline instantiates a new LogsPipeline 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 NewLogsPipeline(name string) *LogsPipeline { + this := LogsPipeline{} + this.Name = name + return &this +} + +// NewLogsPipelineWithDefaults instantiates a new LogsPipeline 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 NewLogsPipelineWithDefaults() *LogsPipeline { + this := LogsPipeline{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsPipeline) GetFilter() LogsFilter { + if o == nil || o.Filter == nil { + var ret LogsFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetFilterOk() (*LogsFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsPipeline) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsFilter and assigns it to the Filter field. +func (o *LogsPipeline) SetFilter(v LogsFilter) { + o.Filter = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *LogsPipeline) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *LogsPipeline) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LogsPipeline) SetId(v string) { + o.Id = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsPipeline) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsPipeline) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsPipeline) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. +func (o *LogsPipeline) GetIsReadOnly() bool { + if o == nil || o.IsReadOnly == nil { + var ret bool + return ret + } + return *o.IsReadOnly +} + +// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetIsReadOnlyOk() (*bool, bool) { + if o == nil || o.IsReadOnly == nil { + return nil, false + } + return o.IsReadOnly, true +} + +// HasIsReadOnly returns a boolean if a field has been set. +func (o *LogsPipeline) HasIsReadOnly() bool { + if o != nil && o.IsReadOnly != nil { + return true + } + + return false +} + +// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. +func (o *LogsPipeline) SetIsReadOnly(v bool) { + o.IsReadOnly = &v +} + +// GetName returns the Name field value. +func (o *LogsPipeline) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *LogsPipeline) SetName(v string) { + o.Name = v +} + +// GetProcessors returns the Processors field value if set, zero value otherwise. +func (o *LogsPipeline) GetProcessors() []LogsProcessor { + if o == nil || o.Processors == nil { + var ret []LogsProcessor + return ret + } + return o.Processors +} + +// GetProcessorsOk returns a tuple with the Processors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetProcessorsOk() (*[]LogsProcessor, bool) { + if o == nil || o.Processors == nil { + return nil, false + } + return &o.Processors, true +} + +// HasProcessors returns a boolean if a field has been set. +func (o *LogsPipeline) HasProcessors() bool { + if o != nil && o.Processors != nil { + return true + } + + return false +} + +// SetProcessors gets a reference to the given []LogsProcessor and assigns it to the Processors field. +func (o *LogsPipeline) SetProcessors(v []LogsProcessor) { + o.Processors = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LogsPipeline) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LogsPipeline) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LogsPipeline) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsPipeline) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.IsReadOnly != nil { + toSerialize["is_read_only"] = o.IsReadOnly + } + toSerialize["name"] = o.Name + if o.Processors != nil { + toSerialize["processors"] = o.Processors + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Filter *LogsFilter `json:"filter,omitempty"` + Id *string `json:"id,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + IsReadOnly *bool `json:"is_read_only,omitempty"` + Name string `json:"name"` + Processors []LogsProcessor `json:"processors,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.Id = all.Id + o.IsEnabled = all.IsEnabled + o.IsReadOnly = all.IsReadOnly + o.Name = all.Name + o.Processors = all.Processors + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_pipeline_processor.go b/api/v1/datadog/model_logs_pipeline_processor.go new file mode 100644 index 00000000000..30f0c59fa51 --- /dev/null +++ b/api/v1/datadog/model_logs_pipeline_processor.go @@ -0,0 +1,284 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsPipelineProcessor Nested Pipelines are pipelines within a pipeline. Use Nested Pipelines to split the processing into two steps. +// For example, first use a high-level filtering such as team and then a second level of filtering based on the +// integration, service, or any other tag or attribute. +// +// A pipeline can contain Nested Pipelines and Processors whereas a Nested Pipeline can only contain Processors. +type LogsPipelineProcessor struct { + // Filter for logs. + Filter *LogsFilter `json:"filter,omitempty"` + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Ordered list of processors in this pipeline. + Processors []LogsProcessor `json:"processors,omitempty"` + // Type of logs pipeline processor. + Type LogsPipelineProcessorType `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{} +} + +// NewLogsPipelineProcessor instantiates a new LogsPipelineProcessor 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 NewLogsPipelineProcessor(typeVar LogsPipelineProcessorType) *LogsPipelineProcessor { + this := LogsPipelineProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Type = typeVar + return &this +} + +// NewLogsPipelineProcessorWithDefaults instantiates a new LogsPipelineProcessor 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 NewLogsPipelineProcessorWithDefaults() *LogsPipelineProcessor { + this := LogsPipelineProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsPipelineProcessorType = LOGSPIPELINEPROCESSORTYPE_PIPELINE + this.Type = typeVar + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsPipelineProcessor) GetFilter() LogsFilter { + if o == nil || o.Filter == nil { + var ret LogsFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipelineProcessor) GetFilterOk() (*LogsFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsPipelineProcessor) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsFilter and assigns it to the Filter field. +func (o *LogsPipelineProcessor) SetFilter(v LogsFilter) { + o.Filter = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsPipelineProcessor) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipelineProcessor) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsPipelineProcessor) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsPipelineProcessor) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsPipelineProcessor) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipelineProcessor) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsPipelineProcessor) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsPipelineProcessor) SetName(v string) { + o.Name = &v +} + +// GetProcessors returns the Processors field value if set, zero value otherwise. +func (o *LogsPipelineProcessor) GetProcessors() []LogsProcessor { + if o == nil || o.Processors == nil { + var ret []LogsProcessor + return ret + } + return o.Processors +} + +// GetProcessorsOk returns a tuple with the Processors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipelineProcessor) GetProcessorsOk() (*[]LogsProcessor, bool) { + if o == nil || o.Processors == nil { + return nil, false + } + return &o.Processors, true +} + +// HasProcessors returns a boolean if a field has been set. +func (o *LogsPipelineProcessor) HasProcessors() bool { + if o != nil && o.Processors != nil { + return true + } + + return false +} + +// SetProcessors gets a reference to the given []LogsProcessor and assigns it to the Processors field. +func (o *LogsPipelineProcessor) SetProcessors(v []LogsProcessor) { + o.Processors = v +} + +// GetType returns the Type field value. +func (o *LogsPipelineProcessor) GetType() LogsPipelineProcessorType { + if o == nil { + var ret LogsPipelineProcessorType + 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 *LogsPipelineProcessor) GetTypeOk() (*LogsPipelineProcessorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsPipelineProcessor) SetType(v LogsPipelineProcessorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsPipelineProcessor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Processors != nil { + toSerialize["processors"] = o.Processors + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *LogsPipelineProcessorType `json:"type"` + }{} + all := struct { + Filter *LogsFilter `json:"filter,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Processors []LogsProcessor `json:"processors,omitempty"` + Type LogsPipelineProcessorType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Processors = all.Processors + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_pipeline_processor_type.go b/api/v1/datadog/model_logs_pipeline_processor_type.go new file mode 100644 index 00000000000..326592e52a7 --- /dev/null +++ b/api/v1/datadog/model_logs_pipeline_processor_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsPipelineProcessorType Type of logs pipeline processor. +type LogsPipelineProcessorType string + +// List of LogsPipelineProcessorType. +const ( + LOGSPIPELINEPROCESSORTYPE_PIPELINE LogsPipelineProcessorType = "pipeline" +) + +var allowedLogsPipelineProcessorTypeEnumValues = []LogsPipelineProcessorType{ + LOGSPIPELINEPROCESSORTYPE_PIPELINE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsPipelineProcessorType) GetAllowedValues() []LogsPipelineProcessorType { + return allowedLogsPipelineProcessorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsPipelineProcessorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsPipelineProcessorType(value) + return nil +} + +// NewLogsPipelineProcessorTypeFromValue returns a pointer to a valid LogsPipelineProcessorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsPipelineProcessorTypeFromValue(v string) (*LogsPipelineProcessorType, error) { + ev := LogsPipelineProcessorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsPipelineProcessorType: valid values are %v", v, allowedLogsPipelineProcessorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsPipelineProcessorType) IsValid() bool { + for _, existing := range allowedLogsPipelineProcessorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsPipelineProcessorType value. +func (v LogsPipelineProcessorType) Ptr() *LogsPipelineProcessorType { + return &v +} + +// NullableLogsPipelineProcessorType handles when a null is used for LogsPipelineProcessorType. +type NullableLogsPipelineProcessorType struct { + value *LogsPipelineProcessorType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsPipelineProcessorType) Get() *LogsPipelineProcessorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsPipelineProcessorType) Set(val *LogsPipelineProcessorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsPipelineProcessorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsPipelineProcessorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsPipelineProcessorType initializes the struct as if Set has been called. +func NewNullableLogsPipelineProcessorType(val *LogsPipelineProcessorType) *NullableLogsPipelineProcessorType { + return &NullableLogsPipelineProcessorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsPipelineProcessorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsPipelineProcessorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_pipelines_order.go b/api/v1/datadog/model_logs_pipelines_order.go new file mode 100644 index 00000000000..71c41c8ed04 --- /dev/null +++ b/api/v1/datadog/model_logs_pipelines_order.go @@ -0,0 +1,104 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsPipelinesOrder Object containing the ordered list of pipeline IDs. +type LogsPipelinesOrder struct { + // Ordered Array of `` strings, the order of pipeline IDs in the array + // define the overall Pipelines order for Datadog. + PipelineIds []string `json:"pipeline_ids"` + // 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{} +} + +// NewLogsPipelinesOrder instantiates a new LogsPipelinesOrder 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 NewLogsPipelinesOrder(pipelineIds []string) *LogsPipelinesOrder { + this := LogsPipelinesOrder{} + this.PipelineIds = pipelineIds + return &this +} + +// NewLogsPipelinesOrderWithDefaults instantiates a new LogsPipelinesOrder 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 NewLogsPipelinesOrderWithDefaults() *LogsPipelinesOrder { + this := LogsPipelinesOrder{} + return &this +} + +// GetPipelineIds returns the PipelineIds field value. +func (o *LogsPipelinesOrder) GetPipelineIds() []string { + if o == nil { + var ret []string + return ret + } + return o.PipelineIds +} + +// GetPipelineIdsOk returns a tuple with the PipelineIds field value +// and a boolean to check if the value has been set. +func (o *LogsPipelinesOrder) GetPipelineIdsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.PipelineIds, true +} + +// SetPipelineIds sets field value. +func (o *LogsPipelinesOrder) SetPipelineIds(v []string) { + o.PipelineIds = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsPipelinesOrder) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["pipeline_ids"] = o.PipelineIds + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsPipelinesOrder) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + PipelineIds *[]string `json:"pipeline_ids"` + }{} + all := struct { + PipelineIds []string `json:"pipeline_ids"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.PipelineIds == nil { + return fmt.Errorf("Required field pipeline_ids missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PipelineIds = all.PipelineIds + return nil +} diff --git a/api/v1/datadog/model_logs_processor.go b/api/v1/datadog/model_logs_processor.go new file mode 100644 index 00000000000..ee72c18c64d --- /dev/null +++ b/api/v1/datadog/model_logs_processor.go @@ -0,0 +1,571 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsProcessor - Definition of a logs processor. +type LogsProcessor struct { + LogsGrokParser *LogsGrokParser + LogsDateRemapper *LogsDateRemapper + LogsStatusRemapper *LogsStatusRemapper + LogsServiceRemapper *LogsServiceRemapper + LogsMessageRemapper *LogsMessageRemapper + LogsAttributeRemapper *LogsAttributeRemapper + LogsURLParser *LogsURLParser + LogsUserAgentParser *LogsUserAgentParser + LogsCategoryProcessor *LogsCategoryProcessor + LogsArithmeticProcessor *LogsArithmeticProcessor + LogsStringBuilderProcessor *LogsStringBuilderProcessor + LogsPipelineProcessor *LogsPipelineProcessor + LogsGeoIPParser *LogsGeoIPParser + LogsLookupProcessor *LogsLookupProcessor + LogsTraceRemapper *LogsTraceRemapper + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// LogsGrokParserAsLogsProcessor is a convenience function that returns LogsGrokParser wrapped in LogsProcessor. +func LogsGrokParserAsLogsProcessor(v *LogsGrokParser) LogsProcessor { + return LogsProcessor{LogsGrokParser: v} +} + +// LogsDateRemapperAsLogsProcessor is a convenience function that returns LogsDateRemapper wrapped in LogsProcessor. +func LogsDateRemapperAsLogsProcessor(v *LogsDateRemapper) LogsProcessor { + return LogsProcessor{LogsDateRemapper: v} +} + +// LogsStatusRemapperAsLogsProcessor is a convenience function that returns LogsStatusRemapper wrapped in LogsProcessor. +func LogsStatusRemapperAsLogsProcessor(v *LogsStatusRemapper) LogsProcessor { + return LogsProcessor{LogsStatusRemapper: v} +} + +// LogsServiceRemapperAsLogsProcessor is a convenience function that returns LogsServiceRemapper wrapped in LogsProcessor. +func LogsServiceRemapperAsLogsProcessor(v *LogsServiceRemapper) LogsProcessor { + return LogsProcessor{LogsServiceRemapper: v} +} + +// LogsMessageRemapperAsLogsProcessor is a convenience function that returns LogsMessageRemapper wrapped in LogsProcessor. +func LogsMessageRemapperAsLogsProcessor(v *LogsMessageRemapper) LogsProcessor { + return LogsProcessor{LogsMessageRemapper: v} +} + +// LogsAttributeRemapperAsLogsProcessor is a convenience function that returns LogsAttributeRemapper wrapped in LogsProcessor. +func LogsAttributeRemapperAsLogsProcessor(v *LogsAttributeRemapper) LogsProcessor { + return LogsProcessor{LogsAttributeRemapper: v} +} + +// LogsURLParserAsLogsProcessor is a convenience function that returns LogsURLParser wrapped in LogsProcessor. +func LogsURLParserAsLogsProcessor(v *LogsURLParser) LogsProcessor { + return LogsProcessor{LogsURLParser: v} +} + +// LogsUserAgentParserAsLogsProcessor is a convenience function that returns LogsUserAgentParser wrapped in LogsProcessor. +func LogsUserAgentParserAsLogsProcessor(v *LogsUserAgentParser) LogsProcessor { + return LogsProcessor{LogsUserAgentParser: v} +} + +// LogsCategoryProcessorAsLogsProcessor is a convenience function that returns LogsCategoryProcessor wrapped in LogsProcessor. +func LogsCategoryProcessorAsLogsProcessor(v *LogsCategoryProcessor) LogsProcessor { + return LogsProcessor{LogsCategoryProcessor: v} +} + +// LogsArithmeticProcessorAsLogsProcessor is a convenience function that returns LogsArithmeticProcessor wrapped in LogsProcessor. +func LogsArithmeticProcessorAsLogsProcessor(v *LogsArithmeticProcessor) LogsProcessor { + return LogsProcessor{LogsArithmeticProcessor: v} +} + +// LogsStringBuilderProcessorAsLogsProcessor is a convenience function that returns LogsStringBuilderProcessor wrapped in LogsProcessor. +func LogsStringBuilderProcessorAsLogsProcessor(v *LogsStringBuilderProcessor) LogsProcessor { + return LogsProcessor{LogsStringBuilderProcessor: v} +} + +// LogsPipelineProcessorAsLogsProcessor is a convenience function that returns LogsPipelineProcessor wrapped in LogsProcessor. +func LogsPipelineProcessorAsLogsProcessor(v *LogsPipelineProcessor) LogsProcessor { + return LogsProcessor{LogsPipelineProcessor: v} +} + +// LogsGeoIPParserAsLogsProcessor is a convenience function that returns LogsGeoIPParser wrapped in LogsProcessor. +func LogsGeoIPParserAsLogsProcessor(v *LogsGeoIPParser) LogsProcessor { + return LogsProcessor{LogsGeoIPParser: v} +} + +// LogsLookupProcessorAsLogsProcessor is a convenience function that returns LogsLookupProcessor wrapped in LogsProcessor. +func LogsLookupProcessorAsLogsProcessor(v *LogsLookupProcessor) LogsProcessor { + return LogsProcessor{LogsLookupProcessor: v} +} + +// LogsTraceRemapperAsLogsProcessor is a convenience function that returns LogsTraceRemapper wrapped in LogsProcessor. +func LogsTraceRemapperAsLogsProcessor(v *LogsTraceRemapper) LogsProcessor { + return LogsProcessor{LogsTraceRemapper: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *LogsProcessor) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into LogsGrokParser + err = json.Unmarshal(data, &obj.LogsGrokParser) + if err == nil { + if obj.LogsGrokParser != nil && obj.LogsGrokParser.UnparsedObject == nil { + jsonLogsGrokParser, _ := json.Marshal(obj.LogsGrokParser) + if string(jsonLogsGrokParser) == "{}" { // empty struct + obj.LogsGrokParser = nil + } else { + match++ + } + } else { + obj.LogsGrokParser = nil + } + } else { + obj.LogsGrokParser = nil + } + + // try to unmarshal data into LogsDateRemapper + err = json.Unmarshal(data, &obj.LogsDateRemapper) + if err == nil { + if obj.LogsDateRemapper != nil && obj.LogsDateRemapper.UnparsedObject == nil { + jsonLogsDateRemapper, _ := json.Marshal(obj.LogsDateRemapper) + if string(jsonLogsDateRemapper) == "{}" { // empty struct + obj.LogsDateRemapper = nil + } else { + match++ + } + } else { + obj.LogsDateRemapper = nil + } + } else { + obj.LogsDateRemapper = nil + } + + // try to unmarshal data into LogsStatusRemapper + err = json.Unmarshal(data, &obj.LogsStatusRemapper) + if err == nil { + if obj.LogsStatusRemapper != nil && obj.LogsStatusRemapper.UnparsedObject == nil { + jsonLogsStatusRemapper, _ := json.Marshal(obj.LogsStatusRemapper) + if string(jsonLogsStatusRemapper) == "{}" { // empty struct + obj.LogsStatusRemapper = nil + } else { + match++ + } + } else { + obj.LogsStatusRemapper = nil + } + } else { + obj.LogsStatusRemapper = nil + } + + // try to unmarshal data into LogsServiceRemapper + err = json.Unmarshal(data, &obj.LogsServiceRemapper) + if err == nil { + if obj.LogsServiceRemapper != nil && obj.LogsServiceRemapper.UnparsedObject == nil { + jsonLogsServiceRemapper, _ := json.Marshal(obj.LogsServiceRemapper) + if string(jsonLogsServiceRemapper) == "{}" { // empty struct + obj.LogsServiceRemapper = nil + } else { + match++ + } + } else { + obj.LogsServiceRemapper = nil + } + } else { + obj.LogsServiceRemapper = nil + } + + // try to unmarshal data into LogsMessageRemapper + err = json.Unmarshal(data, &obj.LogsMessageRemapper) + if err == nil { + if obj.LogsMessageRemapper != nil && obj.LogsMessageRemapper.UnparsedObject == nil { + jsonLogsMessageRemapper, _ := json.Marshal(obj.LogsMessageRemapper) + if string(jsonLogsMessageRemapper) == "{}" { // empty struct + obj.LogsMessageRemapper = nil + } else { + match++ + } + } else { + obj.LogsMessageRemapper = nil + } + } else { + obj.LogsMessageRemapper = nil + } + + // try to unmarshal data into LogsAttributeRemapper + err = json.Unmarshal(data, &obj.LogsAttributeRemapper) + if err == nil { + if obj.LogsAttributeRemapper != nil && obj.LogsAttributeRemapper.UnparsedObject == nil { + jsonLogsAttributeRemapper, _ := json.Marshal(obj.LogsAttributeRemapper) + if string(jsonLogsAttributeRemapper) == "{}" { // empty struct + obj.LogsAttributeRemapper = nil + } else { + match++ + } + } else { + obj.LogsAttributeRemapper = nil + } + } else { + obj.LogsAttributeRemapper = nil + } + + // try to unmarshal data into LogsURLParser + err = json.Unmarshal(data, &obj.LogsURLParser) + if err == nil { + if obj.LogsURLParser != nil && obj.LogsURLParser.UnparsedObject == nil { + jsonLogsURLParser, _ := json.Marshal(obj.LogsURLParser) + if string(jsonLogsURLParser) == "{}" { // empty struct + obj.LogsURLParser = nil + } else { + match++ + } + } else { + obj.LogsURLParser = nil + } + } else { + obj.LogsURLParser = nil + } + + // try to unmarshal data into LogsUserAgentParser + err = json.Unmarshal(data, &obj.LogsUserAgentParser) + if err == nil { + if obj.LogsUserAgentParser != nil && obj.LogsUserAgentParser.UnparsedObject == nil { + jsonLogsUserAgentParser, _ := json.Marshal(obj.LogsUserAgentParser) + if string(jsonLogsUserAgentParser) == "{}" { // empty struct + obj.LogsUserAgentParser = nil + } else { + match++ + } + } else { + obj.LogsUserAgentParser = nil + } + } else { + obj.LogsUserAgentParser = nil + } + + // try to unmarshal data into LogsCategoryProcessor + err = json.Unmarshal(data, &obj.LogsCategoryProcessor) + if err == nil { + if obj.LogsCategoryProcessor != nil && obj.LogsCategoryProcessor.UnparsedObject == nil { + jsonLogsCategoryProcessor, _ := json.Marshal(obj.LogsCategoryProcessor) + if string(jsonLogsCategoryProcessor) == "{}" { // empty struct + obj.LogsCategoryProcessor = nil + } else { + match++ + } + } else { + obj.LogsCategoryProcessor = nil + } + } else { + obj.LogsCategoryProcessor = nil + } + + // try to unmarshal data into LogsArithmeticProcessor + err = json.Unmarshal(data, &obj.LogsArithmeticProcessor) + if err == nil { + if obj.LogsArithmeticProcessor != nil && obj.LogsArithmeticProcessor.UnparsedObject == nil { + jsonLogsArithmeticProcessor, _ := json.Marshal(obj.LogsArithmeticProcessor) + if string(jsonLogsArithmeticProcessor) == "{}" { // empty struct + obj.LogsArithmeticProcessor = nil + } else { + match++ + } + } else { + obj.LogsArithmeticProcessor = nil + } + } else { + obj.LogsArithmeticProcessor = nil + } + + // try to unmarshal data into LogsStringBuilderProcessor + err = json.Unmarshal(data, &obj.LogsStringBuilderProcessor) + if err == nil { + if obj.LogsStringBuilderProcessor != nil && obj.LogsStringBuilderProcessor.UnparsedObject == nil { + jsonLogsStringBuilderProcessor, _ := json.Marshal(obj.LogsStringBuilderProcessor) + if string(jsonLogsStringBuilderProcessor) == "{}" { // empty struct + obj.LogsStringBuilderProcessor = nil + } else { + match++ + } + } else { + obj.LogsStringBuilderProcessor = nil + } + } else { + obj.LogsStringBuilderProcessor = nil + } + + // try to unmarshal data into LogsPipelineProcessor + err = json.Unmarshal(data, &obj.LogsPipelineProcessor) + if err == nil { + if obj.LogsPipelineProcessor != nil && obj.LogsPipelineProcessor.UnparsedObject == nil { + jsonLogsPipelineProcessor, _ := json.Marshal(obj.LogsPipelineProcessor) + if string(jsonLogsPipelineProcessor) == "{}" { // empty struct + obj.LogsPipelineProcessor = nil + } else { + match++ + } + } else { + obj.LogsPipelineProcessor = nil + } + } else { + obj.LogsPipelineProcessor = nil + } + + // try to unmarshal data into LogsGeoIPParser + err = json.Unmarshal(data, &obj.LogsGeoIPParser) + if err == nil { + if obj.LogsGeoIPParser != nil && obj.LogsGeoIPParser.UnparsedObject == nil { + jsonLogsGeoIPParser, _ := json.Marshal(obj.LogsGeoIPParser) + if string(jsonLogsGeoIPParser) == "{}" { // empty struct + obj.LogsGeoIPParser = nil + } else { + match++ + } + } else { + obj.LogsGeoIPParser = nil + } + } else { + obj.LogsGeoIPParser = nil + } + + // try to unmarshal data into LogsLookupProcessor + err = json.Unmarshal(data, &obj.LogsLookupProcessor) + if err == nil { + if obj.LogsLookupProcessor != nil && obj.LogsLookupProcessor.UnparsedObject == nil { + jsonLogsLookupProcessor, _ := json.Marshal(obj.LogsLookupProcessor) + if string(jsonLogsLookupProcessor) == "{}" { // empty struct + obj.LogsLookupProcessor = nil + } else { + match++ + } + } else { + obj.LogsLookupProcessor = nil + } + } else { + obj.LogsLookupProcessor = nil + } + + // try to unmarshal data into LogsTraceRemapper + err = json.Unmarshal(data, &obj.LogsTraceRemapper) + if err == nil { + if obj.LogsTraceRemapper != nil && obj.LogsTraceRemapper.UnparsedObject == nil { + jsonLogsTraceRemapper, _ := json.Marshal(obj.LogsTraceRemapper) + if string(jsonLogsTraceRemapper) == "{}" { // empty struct + obj.LogsTraceRemapper = nil + } else { + match++ + } + } else { + obj.LogsTraceRemapper = nil + } + } else { + obj.LogsTraceRemapper = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.LogsGrokParser = nil + obj.LogsDateRemapper = nil + obj.LogsStatusRemapper = nil + obj.LogsServiceRemapper = nil + obj.LogsMessageRemapper = nil + obj.LogsAttributeRemapper = nil + obj.LogsURLParser = nil + obj.LogsUserAgentParser = nil + obj.LogsCategoryProcessor = nil + obj.LogsArithmeticProcessor = nil + obj.LogsStringBuilderProcessor = nil + obj.LogsPipelineProcessor = nil + obj.LogsGeoIPParser = nil + obj.LogsLookupProcessor = nil + obj.LogsTraceRemapper = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj LogsProcessor) MarshalJSON() ([]byte, error) { + if obj.LogsGrokParser != nil { + return json.Marshal(&obj.LogsGrokParser) + } + + if obj.LogsDateRemapper != nil { + return json.Marshal(&obj.LogsDateRemapper) + } + + if obj.LogsStatusRemapper != nil { + return json.Marshal(&obj.LogsStatusRemapper) + } + + if obj.LogsServiceRemapper != nil { + return json.Marshal(&obj.LogsServiceRemapper) + } + + if obj.LogsMessageRemapper != nil { + return json.Marshal(&obj.LogsMessageRemapper) + } + + if obj.LogsAttributeRemapper != nil { + return json.Marshal(&obj.LogsAttributeRemapper) + } + + if obj.LogsURLParser != nil { + return json.Marshal(&obj.LogsURLParser) + } + + if obj.LogsUserAgentParser != nil { + return json.Marshal(&obj.LogsUserAgentParser) + } + + if obj.LogsCategoryProcessor != nil { + return json.Marshal(&obj.LogsCategoryProcessor) + } + + if obj.LogsArithmeticProcessor != nil { + return json.Marshal(&obj.LogsArithmeticProcessor) + } + + if obj.LogsStringBuilderProcessor != nil { + return json.Marshal(&obj.LogsStringBuilderProcessor) + } + + if obj.LogsPipelineProcessor != nil { + return json.Marshal(&obj.LogsPipelineProcessor) + } + + if obj.LogsGeoIPParser != nil { + return json.Marshal(&obj.LogsGeoIPParser) + } + + if obj.LogsLookupProcessor != nil { + return json.Marshal(&obj.LogsLookupProcessor) + } + + if obj.LogsTraceRemapper != nil { + return json.Marshal(&obj.LogsTraceRemapper) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *LogsProcessor) GetActualInstance() interface{} { + if obj.LogsGrokParser != nil { + return obj.LogsGrokParser + } + + if obj.LogsDateRemapper != nil { + return obj.LogsDateRemapper + } + + if obj.LogsStatusRemapper != nil { + return obj.LogsStatusRemapper + } + + if obj.LogsServiceRemapper != nil { + return obj.LogsServiceRemapper + } + + if obj.LogsMessageRemapper != nil { + return obj.LogsMessageRemapper + } + + if obj.LogsAttributeRemapper != nil { + return obj.LogsAttributeRemapper + } + + if obj.LogsURLParser != nil { + return obj.LogsURLParser + } + + if obj.LogsUserAgentParser != nil { + return obj.LogsUserAgentParser + } + + if obj.LogsCategoryProcessor != nil { + return obj.LogsCategoryProcessor + } + + if obj.LogsArithmeticProcessor != nil { + return obj.LogsArithmeticProcessor + } + + if obj.LogsStringBuilderProcessor != nil { + return obj.LogsStringBuilderProcessor + } + + if obj.LogsPipelineProcessor != nil { + return obj.LogsPipelineProcessor + } + + if obj.LogsGeoIPParser != nil { + return obj.LogsGeoIPParser + } + + if obj.LogsLookupProcessor != nil { + return obj.LogsLookupProcessor + } + + if obj.LogsTraceRemapper != nil { + return obj.LogsTraceRemapper + } + + // all schemas are nil + return nil +} + +// NullableLogsProcessor handles when a null is used for LogsProcessor. +type NullableLogsProcessor struct { + value *LogsProcessor + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsProcessor) Get() *LogsProcessor { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsProcessor) Set(val *LogsProcessor) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsProcessor) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableLogsProcessor) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsProcessor initializes the struct as if Set has been called. +func NewNullableLogsProcessor(val *LogsProcessor) *NullableLogsProcessor { + return &NullableLogsProcessor{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsProcessor) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsProcessor) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_query_compute.go b/api/v1/datadog/model_logs_query_compute.go new file mode 100644 index 00000000000..91ee415dc5a --- /dev/null +++ b/api/v1/datadog/model_logs_query_compute.go @@ -0,0 +1,181 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsQueryCompute Define computation for a log query. +type LogsQueryCompute struct { + // The aggregation method. + Aggregation string `json:"aggregation"` + // Facet name. + Facet *string `json:"facet,omitempty"` + // Define a time interval in seconds. + Interval *int64 `json:"interval,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{} +} + +// NewLogsQueryCompute instantiates a new LogsQueryCompute 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 NewLogsQueryCompute(aggregation string) *LogsQueryCompute { + this := LogsQueryCompute{} + this.Aggregation = aggregation + return &this +} + +// NewLogsQueryComputeWithDefaults instantiates a new LogsQueryCompute 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 NewLogsQueryComputeWithDefaults() *LogsQueryCompute { + this := LogsQueryCompute{} + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *LogsQueryCompute) GetAggregation() string { + if o == nil { + var ret string + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *LogsQueryCompute) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *LogsQueryCompute) SetAggregation(v string) { + o.Aggregation = v +} + +// GetFacet returns the Facet field value if set, zero value otherwise. +func (o *LogsQueryCompute) GetFacet() string { + if o == nil || o.Facet == nil { + var ret string + return ret + } + return *o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryCompute) GetFacetOk() (*string, bool) { + if o == nil || o.Facet == nil { + return nil, false + } + return o.Facet, true +} + +// HasFacet returns a boolean if a field has been set. +func (o *LogsQueryCompute) HasFacet() bool { + if o != nil && o.Facet != nil { + return true + } + + return false +} + +// SetFacet gets a reference to the given string and assigns it to the Facet field. +func (o *LogsQueryCompute) SetFacet(v string) { + o.Facet = &v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *LogsQueryCompute) GetInterval() int64 { + if o == nil || o.Interval == nil { + var ret int64 + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryCompute) GetIntervalOk() (*int64, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *LogsQueryCompute) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given int64 and assigns it to the Interval field. +func (o *LogsQueryCompute) SetInterval(v int64) { + o.Interval = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsQueryCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Facet != nil { + toSerialize["facet"] = o.Facet + } + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsQueryCompute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *string `json:"aggregation"` + }{} + all := struct { + Aggregation string `json:"aggregation"` + Facet *string `json:"facet,omitempty"` + Interval *int64 `json:"interval,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Facet = all.Facet + o.Interval = all.Interval + return nil +} diff --git a/api/v1/datadog/model_logs_retention_agg_sum_usage.go b/api/v1/datadog/model_logs_retention_agg_sum_usage.go new file mode 100644 index 00000000000..0afe0ec4b5e --- /dev/null +++ b/api/v1/datadog/model_logs_retention_agg_sum_usage.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsRetentionAggSumUsage Object containing indexed logs usage aggregated across organizations and months for a retention period. +type LogsRetentionAggSumUsage struct { + // Total indexed logs for this retention period. + LogsIndexedLogsUsageAggSum *int64 `json:"logs_indexed_logs_usage_agg_sum,omitempty"` + // Live indexed logs for this retention period. + LogsLiveIndexedLogsUsageAggSum *int64 `json:"logs_live_indexed_logs_usage_agg_sum,omitempty"` + // Rehydrated indexed logs for this retention period. + LogsRehydratedIndexedLogsUsageAggSum *int64 `json:"logs_rehydrated_indexed_logs_usage_agg_sum,omitempty"` + // The retention period in days or "custom" for all custom retention periods. + Retention *string `json:"retention,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{} +} + +// NewLogsRetentionAggSumUsage instantiates a new LogsRetentionAggSumUsage 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 NewLogsRetentionAggSumUsage() *LogsRetentionAggSumUsage { + this := LogsRetentionAggSumUsage{} + return &this +} + +// NewLogsRetentionAggSumUsageWithDefaults instantiates a new LogsRetentionAggSumUsage 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 NewLogsRetentionAggSumUsageWithDefaults() *LogsRetentionAggSumUsage { + this := LogsRetentionAggSumUsage{} + return &this +} + +// GetLogsIndexedLogsUsageAggSum returns the LogsIndexedLogsUsageAggSum field value if set, zero value otherwise. +func (o *LogsRetentionAggSumUsage) GetLogsIndexedLogsUsageAggSum() int64 { + if o == nil || o.LogsIndexedLogsUsageAggSum == nil { + var ret int64 + return ret + } + return *o.LogsIndexedLogsUsageAggSum +} + +// GetLogsIndexedLogsUsageAggSumOk returns a tuple with the LogsIndexedLogsUsageAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionAggSumUsage) GetLogsIndexedLogsUsageAggSumOk() (*int64, bool) { + if o == nil || o.LogsIndexedLogsUsageAggSum == nil { + return nil, false + } + return o.LogsIndexedLogsUsageAggSum, true +} + +// HasLogsIndexedLogsUsageAggSum returns a boolean if a field has been set. +func (o *LogsRetentionAggSumUsage) HasLogsIndexedLogsUsageAggSum() bool { + if o != nil && o.LogsIndexedLogsUsageAggSum != nil { + return true + } + + return false +} + +// SetLogsIndexedLogsUsageAggSum gets a reference to the given int64 and assigns it to the LogsIndexedLogsUsageAggSum field. +func (o *LogsRetentionAggSumUsage) SetLogsIndexedLogsUsageAggSum(v int64) { + o.LogsIndexedLogsUsageAggSum = &v +} + +// GetLogsLiveIndexedLogsUsageAggSum returns the LogsLiveIndexedLogsUsageAggSum field value if set, zero value otherwise. +func (o *LogsRetentionAggSumUsage) GetLogsLiveIndexedLogsUsageAggSum() int64 { + if o == nil || o.LogsLiveIndexedLogsUsageAggSum == nil { + var ret int64 + return ret + } + return *o.LogsLiveIndexedLogsUsageAggSum +} + +// GetLogsLiveIndexedLogsUsageAggSumOk returns a tuple with the LogsLiveIndexedLogsUsageAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionAggSumUsage) GetLogsLiveIndexedLogsUsageAggSumOk() (*int64, bool) { + if o == nil || o.LogsLiveIndexedLogsUsageAggSum == nil { + return nil, false + } + return o.LogsLiveIndexedLogsUsageAggSum, true +} + +// HasLogsLiveIndexedLogsUsageAggSum returns a boolean if a field has been set. +func (o *LogsRetentionAggSumUsage) HasLogsLiveIndexedLogsUsageAggSum() bool { + if o != nil && o.LogsLiveIndexedLogsUsageAggSum != nil { + return true + } + + return false +} + +// SetLogsLiveIndexedLogsUsageAggSum gets a reference to the given int64 and assigns it to the LogsLiveIndexedLogsUsageAggSum field. +func (o *LogsRetentionAggSumUsage) SetLogsLiveIndexedLogsUsageAggSum(v int64) { + o.LogsLiveIndexedLogsUsageAggSum = &v +} + +// GetLogsRehydratedIndexedLogsUsageAggSum returns the LogsRehydratedIndexedLogsUsageAggSum field value if set, zero value otherwise. +func (o *LogsRetentionAggSumUsage) GetLogsRehydratedIndexedLogsUsageAggSum() int64 { + if o == nil || o.LogsRehydratedIndexedLogsUsageAggSum == nil { + var ret int64 + return ret + } + return *o.LogsRehydratedIndexedLogsUsageAggSum +} + +// GetLogsRehydratedIndexedLogsUsageAggSumOk returns a tuple with the LogsRehydratedIndexedLogsUsageAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionAggSumUsage) GetLogsRehydratedIndexedLogsUsageAggSumOk() (*int64, bool) { + if o == nil || o.LogsRehydratedIndexedLogsUsageAggSum == nil { + return nil, false + } + return o.LogsRehydratedIndexedLogsUsageAggSum, true +} + +// HasLogsRehydratedIndexedLogsUsageAggSum returns a boolean if a field has been set. +func (o *LogsRetentionAggSumUsage) HasLogsRehydratedIndexedLogsUsageAggSum() bool { + if o != nil && o.LogsRehydratedIndexedLogsUsageAggSum != nil { + return true + } + + return false +} + +// SetLogsRehydratedIndexedLogsUsageAggSum gets a reference to the given int64 and assigns it to the LogsRehydratedIndexedLogsUsageAggSum field. +func (o *LogsRetentionAggSumUsage) SetLogsRehydratedIndexedLogsUsageAggSum(v int64) { + o.LogsRehydratedIndexedLogsUsageAggSum = &v +} + +// GetRetention returns the Retention field value if set, zero value otherwise. +func (o *LogsRetentionAggSumUsage) GetRetention() string { + if o == nil || o.Retention == nil { + var ret string + return ret + } + return *o.Retention +} + +// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionAggSumUsage) GetRetentionOk() (*string, bool) { + if o == nil || o.Retention == nil { + return nil, false + } + return o.Retention, true +} + +// HasRetention returns a boolean if a field has been set. +func (o *LogsRetentionAggSumUsage) HasRetention() bool { + if o != nil && o.Retention != nil { + return true + } + + return false +} + +// SetRetention gets a reference to the given string and assigns it to the Retention field. +func (o *LogsRetentionAggSumUsage) SetRetention(v string) { + o.Retention = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsRetentionAggSumUsage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LogsIndexedLogsUsageAggSum != nil { + toSerialize["logs_indexed_logs_usage_agg_sum"] = o.LogsIndexedLogsUsageAggSum + } + if o.LogsLiveIndexedLogsUsageAggSum != nil { + toSerialize["logs_live_indexed_logs_usage_agg_sum"] = o.LogsLiveIndexedLogsUsageAggSum + } + if o.LogsRehydratedIndexedLogsUsageAggSum != nil { + toSerialize["logs_rehydrated_indexed_logs_usage_agg_sum"] = o.LogsRehydratedIndexedLogsUsageAggSum + } + if o.Retention != nil { + toSerialize["retention"] = o.Retention + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsRetentionAggSumUsage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + LogsIndexedLogsUsageAggSum *int64 `json:"logs_indexed_logs_usage_agg_sum,omitempty"` + LogsLiveIndexedLogsUsageAggSum *int64 `json:"logs_live_indexed_logs_usage_agg_sum,omitempty"` + LogsRehydratedIndexedLogsUsageAggSum *int64 `json:"logs_rehydrated_indexed_logs_usage_agg_sum,omitempty"` + Retention *string `json:"retention,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LogsIndexedLogsUsageAggSum = all.LogsIndexedLogsUsageAggSum + o.LogsLiveIndexedLogsUsageAggSum = all.LogsLiveIndexedLogsUsageAggSum + o.LogsRehydratedIndexedLogsUsageAggSum = all.LogsRehydratedIndexedLogsUsageAggSum + o.Retention = all.Retention + return nil +} diff --git a/api/v1/datadog/model_logs_retention_sum_usage.go b/api/v1/datadog/model_logs_retention_sum_usage.go new file mode 100644 index 00000000000..ae6dedc6af2 --- /dev/null +++ b/api/v1/datadog/model_logs_retention_sum_usage.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsRetentionSumUsage Object containing indexed logs usage grouped by retention period and summed. +type LogsRetentionSumUsage struct { + // Total indexed logs for this retention period. + LogsIndexedLogsUsageSum *int64 `json:"logs_indexed_logs_usage_sum,omitempty"` + // Live indexed logs for this retention period. + LogsLiveIndexedLogsUsageSum *int64 `json:"logs_live_indexed_logs_usage_sum,omitempty"` + // Rehydrated indexed logs for this retention period. + LogsRehydratedIndexedLogsUsageSum *int64 `json:"logs_rehydrated_indexed_logs_usage_sum,omitempty"` + // The retention period in days or "custom" for all custom retention periods. + Retention *string `json:"retention,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{} +} + +// NewLogsRetentionSumUsage instantiates a new LogsRetentionSumUsage 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 NewLogsRetentionSumUsage() *LogsRetentionSumUsage { + this := LogsRetentionSumUsage{} + return &this +} + +// NewLogsRetentionSumUsageWithDefaults instantiates a new LogsRetentionSumUsage 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 NewLogsRetentionSumUsageWithDefaults() *LogsRetentionSumUsage { + this := LogsRetentionSumUsage{} + return &this +} + +// GetLogsIndexedLogsUsageSum returns the LogsIndexedLogsUsageSum field value if set, zero value otherwise. +func (o *LogsRetentionSumUsage) GetLogsIndexedLogsUsageSum() int64 { + if o == nil || o.LogsIndexedLogsUsageSum == nil { + var ret int64 + return ret + } + return *o.LogsIndexedLogsUsageSum +} + +// GetLogsIndexedLogsUsageSumOk returns a tuple with the LogsIndexedLogsUsageSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionSumUsage) GetLogsIndexedLogsUsageSumOk() (*int64, bool) { + if o == nil || o.LogsIndexedLogsUsageSum == nil { + return nil, false + } + return o.LogsIndexedLogsUsageSum, true +} + +// HasLogsIndexedLogsUsageSum returns a boolean if a field has been set. +func (o *LogsRetentionSumUsage) HasLogsIndexedLogsUsageSum() bool { + if o != nil && o.LogsIndexedLogsUsageSum != nil { + return true + } + + return false +} + +// SetLogsIndexedLogsUsageSum gets a reference to the given int64 and assigns it to the LogsIndexedLogsUsageSum field. +func (o *LogsRetentionSumUsage) SetLogsIndexedLogsUsageSum(v int64) { + o.LogsIndexedLogsUsageSum = &v +} + +// GetLogsLiveIndexedLogsUsageSum returns the LogsLiveIndexedLogsUsageSum field value if set, zero value otherwise. +func (o *LogsRetentionSumUsage) GetLogsLiveIndexedLogsUsageSum() int64 { + if o == nil || o.LogsLiveIndexedLogsUsageSum == nil { + var ret int64 + return ret + } + return *o.LogsLiveIndexedLogsUsageSum +} + +// GetLogsLiveIndexedLogsUsageSumOk returns a tuple with the LogsLiveIndexedLogsUsageSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionSumUsage) GetLogsLiveIndexedLogsUsageSumOk() (*int64, bool) { + if o == nil || o.LogsLiveIndexedLogsUsageSum == nil { + return nil, false + } + return o.LogsLiveIndexedLogsUsageSum, true +} + +// HasLogsLiveIndexedLogsUsageSum returns a boolean if a field has been set. +func (o *LogsRetentionSumUsage) HasLogsLiveIndexedLogsUsageSum() bool { + if o != nil && o.LogsLiveIndexedLogsUsageSum != nil { + return true + } + + return false +} + +// SetLogsLiveIndexedLogsUsageSum gets a reference to the given int64 and assigns it to the LogsLiveIndexedLogsUsageSum field. +func (o *LogsRetentionSumUsage) SetLogsLiveIndexedLogsUsageSum(v int64) { + o.LogsLiveIndexedLogsUsageSum = &v +} + +// GetLogsRehydratedIndexedLogsUsageSum returns the LogsRehydratedIndexedLogsUsageSum field value if set, zero value otherwise. +func (o *LogsRetentionSumUsage) GetLogsRehydratedIndexedLogsUsageSum() int64 { + if o == nil || o.LogsRehydratedIndexedLogsUsageSum == nil { + var ret int64 + return ret + } + return *o.LogsRehydratedIndexedLogsUsageSum +} + +// GetLogsRehydratedIndexedLogsUsageSumOk returns a tuple with the LogsRehydratedIndexedLogsUsageSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionSumUsage) GetLogsRehydratedIndexedLogsUsageSumOk() (*int64, bool) { + if o == nil || o.LogsRehydratedIndexedLogsUsageSum == nil { + return nil, false + } + return o.LogsRehydratedIndexedLogsUsageSum, true +} + +// HasLogsRehydratedIndexedLogsUsageSum returns a boolean if a field has been set. +func (o *LogsRetentionSumUsage) HasLogsRehydratedIndexedLogsUsageSum() bool { + if o != nil && o.LogsRehydratedIndexedLogsUsageSum != nil { + return true + } + + return false +} + +// SetLogsRehydratedIndexedLogsUsageSum gets a reference to the given int64 and assigns it to the LogsRehydratedIndexedLogsUsageSum field. +func (o *LogsRetentionSumUsage) SetLogsRehydratedIndexedLogsUsageSum(v int64) { + o.LogsRehydratedIndexedLogsUsageSum = &v +} + +// GetRetention returns the Retention field value if set, zero value otherwise. +func (o *LogsRetentionSumUsage) GetRetention() string { + if o == nil || o.Retention == nil { + var ret string + return ret + } + return *o.Retention +} + +// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsRetentionSumUsage) GetRetentionOk() (*string, bool) { + if o == nil || o.Retention == nil { + return nil, false + } + return o.Retention, true +} + +// HasRetention returns a boolean if a field has been set. +func (o *LogsRetentionSumUsage) HasRetention() bool { + if o != nil && o.Retention != nil { + return true + } + + return false +} + +// SetRetention gets a reference to the given string and assigns it to the Retention field. +func (o *LogsRetentionSumUsage) SetRetention(v string) { + o.Retention = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsRetentionSumUsage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LogsIndexedLogsUsageSum != nil { + toSerialize["logs_indexed_logs_usage_sum"] = o.LogsIndexedLogsUsageSum + } + if o.LogsLiveIndexedLogsUsageSum != nil { + toSerialize["logs_live_indexed_logs_usage_sum"] = o.LogsLiveIndexedLogsUsageSum + } + if o.LogsRehydratedIndexedLogsUsageSum != nil { + toSerialize["logs_rehydrated_indexed_logs_usage_sum"] = o.LogsRehydratedIndexedLogsUsageSum + } + if o.Retention != nil { + toSerialize["retention"] = o.Retention + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsRetentionSumUsage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + LogsIndexedLogsUsageSum *int64 `json:"logs_indexed_logs_usage_sum,omitempty"` + LogsLiveIndexedLogsUsageSum *int64 `json:"logs_live_indexed_logs_usage_sum,omitempty"` + LogsRehydratedIndexedLogsUsageSum *int64 `json:"logs_rehydrated_indexed_logs_usage_sum,omitempty"` + Retention *string `json:"retention,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LogsIndexedLogsUsageSum = all.LogsIndexedLogsUsageSum + o.LogsLiveIndexedLogsUsageSum = all.LogsLiveIndexedLogsUsageSum + o.LogsRehydratedIndexedLogsUsageSum = all.LogsRehydratedIndexedLogsUsageSum + o.Retention = all.Retention + return nil +} diff --git a/api/v1/datadog/model_logs_service_remapper.go b/api/v1/datadog/model_logs_service_remapper.go new file mode 100644 index 00000000000..34ca12d4cd6 --- /dev/null +++ b/api/v1/datadog/model_logs_service_remapper.go @@ -0,0 +1,231 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsServiceRemapper Use this processor if you want to assign one or more attributes as the official service. +// +// **Note:** If multiple service remapper processors can be applied to a given log, +// only the first one (according to the pipeline order) is taken into account. +type LogsServiceRemapper struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Type of logs service remapper. + Type LogsServiceRemapperType `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{} +} + +// NewLogsServiceRemapper instantiates a new LogsServiceRemapper 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 NewLogsServiceRemapper(sources []string, typeVar LogsServiceRemapperType) *LogsServiceRemapper { + this := LogsServiceRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Sources = sources + this.Type = typeVar + return &this +} + +// NewLogsServiceRemapperWithDefaults instantiates a new LogsServiceRemapper 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 NewLogsServiceRemapperWithDefaults() *LogsServiceRemapper { + this := LogsServiceRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsServiceRemapperType = LOGSSERVICEREMAPPERTYPE_SERVICE_REMAPPER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsServiceRemapper) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsServiceRemapper) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsServiceRemapper) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsServiceRemapper) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsServiceRemapper) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsServiceRemapper) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsServiceRemapper) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsServiceRemapper) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value. +func (o *LogsServiceRemapper) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsServiceRemapper) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsServiceRemapper) SetSources(v []string) { + o.Sources = v +} + +// GetType returns the Type field value. +func (o *LogsServiceRemapper) GetType() LogsServiceRemapperType { + if o == nil { + var ret LogsServiceRemapperType + 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 *LogsServiceRemapper) GetTypeOk() (*LogsServiceRemapperType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsServiceRemapper) SetType(v LogsServiceRemapperType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsServiceRemapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["sources"] = o.Sources + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Type *LogsServiceRemapperType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources"` + Type LogsServiceRemapperType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Sources = all.Sources + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_service_remapper_type.go b/api/v1/datadog/model_logs_service_remapper_type.go new file mode 100644 index 00000000000..4cea7cf58f5 --- /dev/null +++ b/api/v1/datadog/model_logs_service_remapper_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsServiceRemapperType Type of logs service remapper. +type LogsServiceRemapperType string + +// List of LogsServiceRemapperType. +const ( + LOGSSERVICEREMAPPERTYPE_SERVICE_REMAPPER LogsServiceRemapperType = "service-remapper" +) + +var allowedLogsServiceRemapperTypeEnumValues = []LogsServiceRemapperType{ + LOGSSERVICEREMAPPERTYPE_SERVICE_REMAPPER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsServiceRemapperType) GetAllowedValues() []LogsServiceRemapperType { + return allowedLogsServiceRemapperTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsServiceRemapperType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsServiceRemapperType(value) + return nil +} + +// NewLogsServiceRemapperTypeFromValue returns a pointer to a valid LogsServiceRemapperType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsServiceRemapperTypeFromValue(v string) (*LogsServiceRemapperType, error) { + ev := LogsServiceRemapperType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsServiceRemapperType: valid values are %v", v, allowedLogsServiceRemapperTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsServiceRemapperType) IsValid() bool { + for _, existing := range allowedLogsServiceRemapperTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsServiceRemapperType value. +func (v LogsServiceRemapperType) Ptr() *LogsServiceRemapperType { + return &v +} + +// NullableLogsServiceRemapperType handles when a null is used for LogsServiceRemapperType. +type NullableLogsServiceRemapperType struct { + value *LogsServiceRemapperType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsServiceRemapperType) Get() *LogsServiceRemapperType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsServiceRemapperType) Set(val *LogsServiceRemapperType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsServiceRemapperType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsServiceRemapperType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsServiceRemapperType initializes the struct as if Set has been called. +func NewNullableLogsServiceRemapperType(val *LogsServiceRemapperType) *NullableLogsServiceRemapperType { + return &NullableLogsServiceRemapperType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsServiceRemapperType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsServiceRemapperType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_sort.go b/api/v1/datadog/model_logs_sort.go new file mode 100644 index 00000000000..03eeda525f2 --- /dev/null +++ b/api/v1/datadog/model_logs_sort.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsSort Time-ascending `asc` or time-descending `desc` results. +type LogsSort string + +// List of LogsSort. +const ( + LOGSSORT_TIME_ASCENDING LogsSort = "asc" + LOGSSORT_TIME_DESCENDING LogsSort = "desc" +) + +var allowedLogsSortEnumValues = []LogsSort{ + LOGSSORT_TIME_ASCENDING, + LOGSSORT_TIME_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsSort) GetAllowedValues() []LogsSort { + return allowedLogsSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsSort(value) + return nil +} + +// NewLogsSortFromValue returns a pointer to a valid LogsSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsSortFromValue(v string) (*LogsSort, error) { + ev := LogsSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsSort: valid values are %v", v, allowedLogsSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsSort) IsValid() bool { + for _, existing := range allowedLogsSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsSort value. +func (v LogsSort) Ptr() *LogsSort { + return &v +} + +// NullableLogsSort handles when a null is used for LogsSort. +type NullableLogsSort struct { + value *LogsSort + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsSort) Get() *LogsSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsSort) Set(val *LogsSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsSort initializes the struct as if Set has been called. +func NewNullableLogsSort(val *LogsSort) *NullableLogsSort { + return &NullableLogsSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_status_remapper.go b/api/v1/datadog/model_logs_status_remapper.go new file mode 100644 index 00000000000..c3a3d34616f --- /dev/null +++ b/api/v1/datadog/model_logs_status_remapper.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsStatusRemapper Use this Processor if you want to assign some attributes as the official status. +// +// Each incoming status value is mapped as follows. +// +// - Integers from 0 to 7 map to the Syslog severity standards +// - Strings beginning with `emerg` or f (case-insensitive) map to `emerg` (0) +// - Strings beginning with `a` (case-insensitive) map to `alert` (1) +// - Strings beginning with `c` (case-insensitive) map to `critical` (2) +// - Strings beginning with `err` (case-insensitive) map to `error` (3) +// - Strings beginning with `w` (case-insensitive) map to `warning` (4) +// - Strings beginning with `n` (case-insensitive) map to `notice` (5) +// - Strings beginning with `i` (case-insensitive) map to `info` (6) +// - Strings beginning with `d`, `trace` or `verbose` (case-insensitive) map to `debug` (7) +// - Strings beginning with `o` or matching `OK` or `Success` (case-insensitive) map to OK +// - All others map to `info` (6) +// +// **Note:** If multiple log status remapper processors can be applied to a given log, +// only the first one (according to the pipelines order) is taken into account. +type LogsStatusRemapper struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Type of logs status remapper. + Type LogsStatusRemapperType `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{} +} + +// NewLogsStatusRemapper instantiates a new LogsStatusRemapper 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 NewLogsStatusRemapper(sources []string, typeVar LogsStatusRemapperType) *LogsStatusRemapper { + this := LogsStatusRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Sources = sources + this.Type = typeVar + return &this +} + +// NewLogsStatusRemapperWithDefaults instantiates a new LogsStatusRemapper 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 NewLogsStatusRemapperWithDefaults() *LogsStatusRemapper { + this := LogsStatusRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsStatusRemapperType = LOGSSTATUSREMAPPERTYPE_STATUS_REMAPPER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsStatusRemapper) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsStatusRemapper) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsStatusRemapper) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsStatusRemapper) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsStatusRemapper) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsStatusRemapper) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsStatusRemapper) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsStatusRemapper) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value. +func (o *LogsStatusRemapper) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsStatusRemapper) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsStatusRemapper) SetSources(v []string) { + o.Sources = v +} + +// GetType returns the Type field value. +func (o *LogsStatusRemapper) GetType() LogsStatusRemapperType { + if o == nil { + var ret LogsStatusRemapperType + 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 *LogsStatusRemapper) GetTypeOk() (*LogsStatusRemapperType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsStatusRemapper) SetType(v LogsStatusRemapperType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsStatusRemapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["sources"] = o.Sources + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Type *LogsStatusRemapperType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources"` + Type LogsStatusRemapperType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Sources = all.Sources + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_status_remapper_type.go b/api/v1/datadog/model_logs_status_remapper_type.go new file mode 100644 index 00000000000..20d6ab58402 --- /dev/null +++ b/api/v1/datadog/model_logs_status_remapper_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsStatusRemapperType Type of logs status remapper. +type LogsStatusRemapperType string + +// List of LogsStatusRemapperType. +const ( + LOGSSTATUSREMAPPERTYPE_STATUS_REMAPPER LogsStatusRemapperType = "status-remapper" +) + +var allowedLogsStatusRemapperTypeEnumValues = []LogsStatusRemapperType{ + LOGSSTATUSREMAPPERTYPE_STATUS_REMAPPER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsStatusRemapperType) GetAllowedValues() []LogsStatusRemapperType { + return allowedLogsStatusRemapperTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsStatusRemapperType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsStatusRemapperType(value) + return nil +} + +// NewLogsStatusRemapperTypeFromValue returns a pointer to a valid LogsStatusRemapperType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsStatusRemapperTypeFromValue(v string) (*LogsStatusRemapperType, error) { + ev := LogsStatusRemapperType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsStatusRemapperType: valid values are %v", v, allowedLogsStatusRemapperTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsStatusRemapperType) IsValid() bool { + for _, existing := range allowedLogsStatusRemapperTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsStatusRemapperType value. +func (v LogsStatusRemapperType) Ptr() *LogsStatusRemapperType { + return &v +} + +// NullableLogsStatusRemapperType handles when a null is used for LogsStatusRemapperType. +type NullableLogsStatusRemapperType struct { + value *LogsStatusRemapperType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsStatusRemapperType) Get() *LogsStatusRemapperType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsStatusRemapperType) Set(val *LogsStatusRemapperType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsStatusRemapperType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsStatusRemapperType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsStatusRemapperType initializes the struct as if Set has been called. +func NewNullableLogsStatusRemapperType(val *LogsStatusRemapperType) *NullableLogsStatusRemapperType { + return &NullableLogsStatusRemapperType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsStatusRemapperType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsStatusRemapperType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_string_builder_processor.go b/api/v1/datadog/model_logs_string_builder_processor.go new file mode 100644 index 00000000000..dbc110b7f15 --- /dev/null +++ b/api/v1/datadog/model_logs_string_builder_processor.go @@ -0,0 +1,317 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsStringBuilderProcessor Use the string builder processor to add a new attribute (without spaces or special characters) +// to a log with the result of the provided template. +// This enables aggregation of different attributes or raw strings into a single attribute. +// +// The template is defined by both raw text and blocks with the syntax `%{attribute_path}`. +// +// **Notes**: +// +// - The processor only accepts attributes with values or an array of values in the blocks. +// - If an attribute cannot be used (object or array of object), +// it is replaced by an empty string or the entire operation is skipped depending on your selection. +// - If the target attribute already exists, it is overwritten by the result of the template. +// - Results of the template cannot exceed 256 characters. +type LogsStringBuilderProcessor struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // If true, it replaces all missing attributes of `template` by an empty string. + // If `false` (default), skips the operation for missing attributes. + IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // The name of the attribute that contains the result of the template. + Target string `json:"target"` + // A formula with one or more attributes and raw text. + Template string `json:"template"` + // Type of logs string builder processor. + Type LogsStringBuilderProcessorType `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{} +} + +// NewLogsStringBuilderProcessor instantiates a new LogsStringBuilderProcessor 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 NewLogsStringBuilderProcessor(target string, template string, typeVar LogsStringBuilderProcessorType) *LogsStringBuilderProcessor { + this := LogsStringBuilderProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var isReplaceMissing bool = false + this.IsReplaceMissing = &isReplaceMissing + this.Target = target + this.Template = template + this.Type = typeVar + return &this +} + +// NewLogsStringBuilderProcessorWithDefaults instantiates a new LogsStringBuilderProcessor 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 NewLogsStringBuilderProcessorWithDefaults() *LogsStringBuilderProcessor { + this := LogsStringBuilderProcessor{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var isReplaceMissing bool = false + this.IsReplaceMissing = &isReplaceMissing + var typeVar LogsStringBuilderProcessorType = LOGSSTRINGBUILDERPROCESSORTYPE_STRING_BUILDER_PROCESSOR + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsStringBuilderProcessor) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsStringBuilderProcessor) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsStringBuilderProcessor) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsStringBuilderProcessor) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetIsReplaceMissing returns the IsReplaceMissing field value if set, zero value otherwise. +func (o *LogsStringBuilderProcessor) GetIsReplaceMissing() bool { + if o == nil || o.IsReplaceMissing == nil { + var ret bool + return ret + } + return *o.IsReplaceMissing +} + +// GetIsReplaceMissingOk returns a tuple with the IsReplaceMissing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsStringBuilderProcessor) GetIsReplaceMissingOk() (*bool, bool) { + if o == nil || o.IsReplaceMissing == nil { + return nil, false + } + return o.IsReplaceMissing, true +} + +// HasIsReplaceMissing returns a boolean if a field has been set. +func (o *LogsStringBuilderProcessor) HasIsReplaceMissing() bool { + if o != nil && o.IsReplaceMissing != nil { + return true + } + + return false +} + +// SetIsReplaceMissing gets a reference to the given bool and assigns it to the IsReplaceMissing field. +func (o *LogsStringBuilderProcessor) SetIsReplaceMissing(v bool) { + o.IsReplaceMissing = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsStringBuilderProcessor) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsStringBuilderProcessor) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsStringBuilderProcessor) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsStringBuilderProcessor) SetName(v string) { + o.Name = &v +} + +// GetTarget returns the Target field value. +func (o *LogsStringBuilderProcessor) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsStringBuilderProcessor) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsStringBuilderProcessor) SetTarget(v string) { + o.Target = v +} + +// GetTemplate returns the Template field value. +func (o *LogsStringBuilderProcessor) GetTemplate() string { + if o == nil { + var ret string + return ret + } + return o.Template +} + +// GetTemplateOk returns a tuple with the Template field value +// and a boolean to check if the value has been set. +func (o *LogsStringBuilderProcessor) GetTemplateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Template, true +} + +// SetTemplate sets field value. +func (o *LogsStringBuilderProcessor) SetTemplate(v string) { + o.Template = v +} + +// GetType returns the Type field value. +func (o *LogsStringBuilderProcessor) GetType() LogsStringBuilderProcessorType { + if o == nil { + var ret LogsStringBuilderProcessorType + 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 *LogsStringBuilderProcessor) GetTypeOk() (*LogsStringBuilderProcessorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsStringBuilderProcessor) SetType(v LogsStringBuilderProcessorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsStringBuilderProcessor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.IsReplaceMissing != nil { + toSerialize["is_replace_missing"] = o.IsReplaceMissing + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["target"] = o.Target + toSerialize["template"] = o.Template + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Target *string `json:"target"` + Template *string `json:"template"` + Type *LogsStringBuilderProcessorType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` + Name *string `json:"name,omitempty"` + Target string `json:"target"` + Template string `json:"template"` + Type LogsStringBuilderProcessorType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Template == nil { + return fmt.Errorf("Required field template missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.IsReplaceMissing = all.IsReplaceMissing + o.Name = all.Name + o.Target = all.Target + o.Template = all.Template + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_string_builder_processor_type.go b/api/v1/datadog/model_logs_string_builder_processor_type.go new file mode 100644 index 00000000000..2411fcbc3c2 --- /dev/null +++ b/api/v1/datadog/model_logs_string_builder_processor_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsStringBuilderProcessorType Type of logs string builder processor. +type LogsStringBuilderProcessorType string + +// List of LogsStringBuilderProcessorType. +const ( + LOGSSTRINGBUILDERPROCESSORTYPE_STRING_BUILDER_PROCESSOR LogsStringBuilderProcessorType = "string-builder-processor" +) + +var allowedLogsStringBuilderProcessorTypeEnumValues = []LogsStringBuilderProcessorType{ + LOGSSTRINGBUILDERPROCESSORTYPE_STRING_BUILDER_PROCESSOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsStringBuilderProcessorType) GetAllowedValues() []LogsStringBuilderProcessorType { + return allowedLogsStringBuilderProcessorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsStringBuilderProcessorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsStringBuilderProcessorType(value) + return nil +} + +// NewLogsStringBuilderProcessorTypeFromValue returns a pointer to a valid LogsStringBuilderProcessorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsStringBuilderProcessorTypeFromValue(v string) (*LogsStringBuilderProcessorType, error) { + ev := LogsStringBuilderProcessorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsStringBuilderProcessorType: valid values are %v", v, allowedLogsStringBuilderProcessorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsStringBuilderProcessorType) IsValid() bool { + for _, existing := range allowedLogsStringBuilderProcessorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsStringBuilderProcessorType value. +func (v LogsStringBuilderProcessorType) Ptr() *LogsStringBuilderProcessorType { + return &v +} + +// NullableLogsStringBuilderProcessorType handles when a null is used for LogsStringBuilderProcessorType. +type NullableLogsStringBuilderProcessorType struct { + value *LogsStringBuilderProcessorType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsStringBuilderProcessorType) Get() *LogsStringBuilderProcessorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsStringBuilderProcessorType) Set(val *LogsStringBuilderProcessorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsStringBuilderProcessorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsStringBuilderProcessorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsStringBuilderProcessorType initializes the struct as if Set has been called. +func NewNullableLogsStringBuilderProcessorType(val *LogsStringBuilderProcessorType) *NullableLogsStringBuilderProcessorType { + return &NullableLogsStringBuilderProcessorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsStringBuilderProcessorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsStringBuilderProcessorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_trace_remapper.go b/api/v1/datadog/model_logs_trace_remapper.go new file mode 100644 index 00000000000..8a927f6ea62 --- /dev/null +++ b/api/v1/datadog/model_logs_trace_remapper.go @@ -0,0 +1,239 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsTraceRemapper There are two ways to improve correlation between application traces and logs. +// +// 1. Follow the documentation on [how to inject a trace ID in the application logs](https://docs.datadoghq.com/tracing/connect_logs_and_traces) +// and by default log integrations take care of all the rest of the setup. +// +// 2. Use the Trace remapper processor to define a log attribute as its associated trace ID. +type LogsTraceRemapper struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Array of source attributes. + Sources []string `json:"sources,omitempty"` + // Type of logs trace remapper. + Type LogsTraceRemapperType `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{} +} + +// NewLogsTraceRemapper instantiates a new LogsTraceRemapper 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 NewLogsTraceRemapper(typeVar LogsTraceRemapperType) *LogsTraceRemapper { + this := LogsTraceRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + this.Type = typeVar + return &this +} + +// NewLogsTraceRemapperWithDefaults instantiates a new LogsTraceRemapper 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 NewLogsTraceRemapperWithDefaults() *LogsTraceRemapper { + this := LogsTraceRemapper{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var typeVar LogsTraceRemapperType = LOGSTRACEREMAPPERTYPE_TRACE_ID_REMAPPER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsTraceRemapper) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsTraceRemapper) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsTraceRemapper) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsTraceRemapper) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsTraceRemapper) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsTraceRemapper) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsTraceRemapper) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsTraceRemapper) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value if set, zero value otherwise. +func (o *LogsTraceRemapper) GetSources() []string { + if o == nil || o.Sources == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsTraceRemapper) GetSourcesOk() (*[]string, bool) { + if o == nil || o.Sources == nil { + return nil, false + } + return &o.Sources, true +} + +// HasSources returns a boolean if a field has been set. +func (o *LogsTraceRemapper) HasSources() bool { + if o != nil && o.Sources != nil { + return true + } + + return false +} + +// SetSources gets a reference to the given []string and assigns it to the Sources field. +func (o *LogsTraceRemapper) SetSources(v []string) { + o.Sources = v +} + +// GetType returns the Type field value. +func (o *LogsTraceRemapper) GetType() LogsTraceRemapperType { + if o == nil { + var ret LogsTraceRemapperType + 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 *LogsTraceRemapper) GetTypeOk() (*LogsTraceRemapperType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsTraceRemapper) SetType(v LogsTraceRemapperType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsTraceRemapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Sources != nil { + toSerialize["sources"] = o.Sources + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *LogsTraceRemapperType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources,omitempty"` + Type LogsTraceRemapperType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Sources = all.Sources + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_trace_remapper_type.go b/api/v1/datadog/model_logs_trace_remapper_type.go new file mode 100644 index 00000000000..735b81fb696 --- /dev/null +++ b/api/v1/datadog/model_logs_trace_remapper_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsTraceRemapperType Type of logs trace remapper. +type LogsTraceRemapperType string + +// List of LogsTraceRemapperType. +const ( + LOGSTRACEREMAPPERTYPE_TRACE_ID_REMAPPER LogsTraceRemapperType = "trace-id-remapper" +) + +var allowedLogsTraceRemapperTypeEnumValues = []LogsTraceRemapperType{ + LOGSTRACEREMAPPERTYPE_TRACE_ID_REMAPPER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsTraceRemapperType) GetAllowedValues() []LogsTraceRemapperType { + return allowedLogsTraceRemapperTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsTraceRemapperType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsTraceRemapperType(value) + return nil +} + +// NewLogsTraceRemapperTypeFromValue returns a pointer to a valid LogsTraceRemapperType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsTraceRemapperTypeFromValue(v string) (*LogsTraceRemapperType, error) { + ev := LogsTraceRemapperType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsTraceRemapperType: valid values are %v", v, allowedLogsTraceRemapperTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsTraceRemapperType) IsValid() bool { + for _, existing := range allowedLogsTraceRemapperTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsTraceRemapperType value. +func (v LogsTraceRemapperType) Ptr() *LogsTraceRemapperType { + return &v +} + +// NullableLogsTraceRemapperType handles when a null is used for LogsTraceRemapperType. +type NullableLogsTraceRemapperType struct { + value *LogsTraceRemapperType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsTraceRemapperType) Get() *LogsTraceRemapperType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsTraceRemapperType) Set(val *LogsTraceRemapperType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsTraceRemapperType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsTraceRemapperType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsTraceRemapperType initializes the struct as if Set has been called. +func NewNullableLogsTraceRemapperType(val *LogsTraceRemapperType) *NullableLogsTraceRemapperType { + return &NullableLogsTraceRemapperType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsTraceRemapperType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsTraceRemapperType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_url_parser.go b/api/v1/datadog/model_logs_url_parser.go new file mode 100644 index 00000000000..c6c9f3420d2 --- /dev/null +++ b/api/v1/datadog/model_logs_url_parser.go @@ -0,0 +1,319 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsURLParser This processor extracts query parameters and other important parameters from a URL. +type LogsURLParser struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Normalize the ending slashes or not. + NormalizeEndingSlashes common.NullableBool `json:"normalize_ending_slashes,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Name of the parent attribute that contains all the extracted details from the `sources`. + Target string `json:"target"` + // Type of logs URL parser. + Type LogsURLParserType `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{} +} + +// NewLogsURLParser instantiates a new LogsURLParser 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 NewLogsURLParser(sources []string, target string, typeVar LogsURLParserType) *LogsURLParser { + this := LogsURLParser{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var normalizeEndingSlashes bool = false + this.NormalizeEndingSlashes = *common.NewNullableBool(&normalizeEndingSlashes) + this.Sources = sources + this.Target = target + this.Type = typeVar + return &this +} + +// NewLogsURLParserWithDefaults instantiates a new LogsURLParser 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 NewLogsURLParserWithDefaults() *LogsURLParser { + this := LogsURLParser{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var normalizeEndingSlashes bool = false + this.NormalizeEndingSlashes = *common.NewNullableBool(&normalizeEndingSlashes) + var target string = "http.url_details" + this.Target = target + var typeVar LogsURLParserType = LOGSURLPARSERTYPE_URL_PARSER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsURLParser) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsURLParser) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsURLParser) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsURLParser) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsURLParser) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsURLParser) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsURLParser) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsURLParser) SetName(v string) { + o.Name = &v +} + +// GetNormalizeEndingSlashes returns the NormalizeEndingSlashes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LogsURLParser) GetNormalizeEndingSlashes() bool { + if o == nil || o.NormalizeEndingSlashes.Get() == nil { + var ret bool + return ret + } + return *o.NormalizeEndingSlashes.Get() +} + +// GetNormalizeEndingSlashesOk returns a tuple with the NormalizeEndingSlashes 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 *LogsURLParser) GetNormalizeEndingSlashesOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NormalizeEndingSlashes.Get(), o.NormalizeEndingSlashes.IsSet() +} + +// HasNormalizeEndingSlashes returns a boolean if a field has been set. +func (o *LogsURLParser) HasNormalizeEndingSlashes() bool { + if o != nil && o.NormalizeEndingSlashes.IsSet() { + return true + } + + return false +} + +// SetNormalizeEndingSlashes gets a reference to the given common.NullableBool and assigns it to the NormalizeEndingSlashes field. +func (o *LogsURLParser) SetNormalizeEndingSlashes(v bool) { + o.NormalizeEndingSlashes.Set(&v) +} + +// SetNormalizeEndingSlashesNil sets the value for NormalizeEndingSlashes to be an explicit nil. +func (o *LogsURLParser) SetNormalizeEndingSlashesNil() { + o.NormalizeEndingSlashes.Set(nil) +} + +// UnsetNormalizeEndingSlashes ensures that no value is present for NormalizeEndingSlashes, not even an explicit nil. +func (o *LogsURLParser) UnsetNormalizeEndingSlashes() { + o.NormalizeEndingSlashes.Unset() +} + +// GetSources returns the Sources field value. +func (o *LogsURLParser) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsURLParser) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsURLParser) SetSources(v []string) { + o.Sources = v +} + +// GetTarget returns the Target field value. +func (o *LogsURLParser) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsURLParser) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsURLParser) SetTarget(v string) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *LogsURLParser) GetType() LogsURLParserType { + if o == nil { + var ret LogsURLParserType + 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 *LogsURLParser) GetTypeOk() (*LogsURLParserType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsURLParser) SetType(v LogsURLParserType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsURLParser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.NormalizeEndingSlashes.IsSet() { + toSerialize["normalize_ending_slashes"] = o.NormalizeEndingSlashes.Get() + } + toSerialize["sources"] = o.Sources + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Target *string `json:"target"` + Type *LogsURLParserType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + NormalizeEndingSlashes common.NullableBool `json:"normalize_ending_slashes,omitempty"` + Sources []string `json:"sources"` + Target string `json:"target"` + Type LogsURLParserType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.NormalizeEndingSlashes = all.NormalizeEndingSlashes + o.Sources = all.Sources + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_url_parser_type.go b/api/v1/datadog/model_logs_url_parser_type.go new file mode 100644 index 00000000000..57562db6812 --- /dev/null +++ b/api/v1/datadog/model_logs_url_parser_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsURLParserType Type of logs URL parser. +type LogsURLParserType string + +// List of LogsURLParserType. +const ( + LOGSURLPARSERTYPE_URL_PARSER LogsURLParserType = "url-parser" +) + +var allowedLogsURLParserTypeEnumValues = []LogsURLParserType{ + LOGSURLPARSERTYPE_URL_PARSER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsURLParserType) GetAllowedValues() []LogsURLParserType { + return allowedLogsURLParserTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsURLParserType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsURLParserType(value) + return nil +} + +// NewLogsURLParserTypeFromValue returns a pointer to a valid LogsURLParserType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsURLParserTypeFromValue(v string) (*LogsURLParserType, error) { + ev := LogsURLParserType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsURLParserType: valid values are %v", v, allowedLogsURLParserTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsURLParserType) IsValid() bool { + for _, existing := range allowedLogsURLParserTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsURLParserType value. +func (v LogsURLParserType) Ptr() *LogsURLParserType { + return &v +} + +// NullableLogsURLParserType handles when a null is used for LogsURLParserType. +type NullableLogsURLParserType struct { + value *LogsURLParserType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsURLParserType) Get() *LogsURLParserType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsURLParserType) Set(val *LogsURLParserType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsURLParserType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsURLParserType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsURLParserType initializes the struct as if Set has been called. +func NewNullableLogsURLParserType(val *LogsURLParserType) *NullableLogsURLParserType { + return &NullableLogsURLParserType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsURLParserType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsURLParserType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_logs_user_agent_parser.go b/api/v1/datadog/model_logs_user_agent_parser.go new file mode 100644 index 00000000000..b189976e23a --- /dev/null +++ b/api/v1/datadog/model_logs_user_agent_parser.go @@ -0,0 +1,307 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsUserAgentParser The User-Agent parser takes a User-Agent attribute and extracts the OS, browser, device, and other user data. +// It recognizes major bots like the Google Bot, Yahoo Slurp, and Bing. +type LogsUserAgentParser struct { + // Whether or not the processor is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // Define if the source attribute is URL encoded or not. + IsEncoded *bool `json:"is_encoded,omitempty"` + // Name of the processor. + Name *string `json:"name,omitempty"` + // Array of source attributes. + Sources []string `json:"sources"` + // Name of the parent attribute that contains all the extracted details from the `sources`. + Target string `json:"target"` + // Type of logs User-Agent parser. + Type LogsUserAgentParserType `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{} +} + +// NewLogsUserAgentParser instantiates a new LogsUserAgentParser 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 NewLogsUserAgentParser(sources []string, target string, typeVar LogsUserAgentParserType) *LogsUserAgentParser { + this := LogsUserAgentParser{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var isEncoded bool = false + this.IsEncoded = &isEncoded + this.Sources = sources + this.Target = target + this.Type = typeVar + return &this +} + +// NewLogsUserAgentParserWithDefaults instantiates a new LogsUserAgentParser 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 NewLogsUserAgentParserWithDefaults() *LogsUserAgentParser { + this := LogsUserAgentParser{} + var isEnabled bool = false + this.IsEnabled = &isEnabled + var isEncoded bool = false + this.IsEncoded = &isEncoded + var target string = "http.useragent_details" + this.Target = target + var typeVar LogsUserAgentParserType = LOGSUSERAGENTPARSERTYPE_USER_AGENT_PARSER + this.Type = typeVar + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *LogsUserAgentParser) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsUserAgentParser) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *LogsUserAgentParser) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *LogsUserAgentParser) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetIsEncoded returns the IsEncoded field value if set, zero value otherwise. +func (o *LogsUserAgentParser) GetIsEncoded() bool { + if o == nil || o.IsEncoded == nil { + var ret bool + return ret + } + return *o.IsEncoded +} + +// GetIsEncodedOk returns a tuple with the IsEncoded field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsUserAgentParser) GetIsEncodedOk() (*bool, bool) { + if o == nil || o.IsEncoded == nil { + return nil, false + } + return o.IsEncoded, true +} + +// HasIsEncoded returns a boolean if a field has been set. +func (o *LogsUserAgentParser) HasIsEncoded() bool { + if o != nil && o.IsEncoded != nil { + return true + } + + return false +} + +// SetIsEncoded gets a reference to the given bool and assigns it to the IsEncoded field. +func (o *LogsUserAgentParser) SetIsEncoded(v bool) { + o.IsEncoded = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LogsUserAgentParser) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsUserAgentParser) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LogsUserAgentParser) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LogsUserAgentParser) SetName(v string) { + o.Name = &v +} + +// GetSources returns the Sources field value. +func (o *LogsUserAgentParser) GetSources() []string { + if o == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value +// and a boolean to check if the value has been set. +func (o *LogsUserAgentParser) GetSourcesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Sources, true +} + +// SetSources sets field value. +func (o *LogsUserAgentParser) SetSources(v []string) { + o.Sources = v +} + +// GetTarget returns the Target field value. +func (o *LogsUserAgentParser) GetTarget() string { + if o == nil { + var ret string + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LogsUserAgentParser) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LogsUserAgentParser) SetTarget(v string) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *LogsUserAgentParser) GetType() LogsUserAgentParserType { + if o == nil { + var ret LogsUserAgentParserType + 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 *LogsUserAgentParser) GetTypeOk() (*LogsUserAgentParserType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsUserAgentParser) SetType(v LogsUserAgentParserType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsUserAgentParser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.IsEncoded != nil { + toSerialize["is_encoded"] = o.IsEncoded + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["sources"] = o.Sources + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Sources *[]string `json:"sources"` + Target *string `json:"target"` + Type *LogsUserAgentParserType `json:"type"` + }{} + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + IsEncoded *bool `json:"is_encoded,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources"` + Target string `json:"target"` + Type LogsUserAgentParserType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Sources == nil { + return fmt.Errorf("Required field sources missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsEnabled = all.IsEnabled + o.IsEncoded = all.IsEncoded + o.Name = all.Name + o.Sources = all.Sources + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_logs_user_agent_parser_type.go b/api/v1/datadog/model_logs_user_agent_parser_type.go new file mode 100644 index 00000000000..b2f36f2d6e5 --- /dev/null +++ b/api/v1/datadog/model_logs_user_agent_parser_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsUserAgentParserType Type of logs User-Agent parser. +type LogsUserAgentParserType string + +// List of LogsUserAgentParserType. +const ( + LOGSUSERAGENTPARSERTYPE_USER_AGENT_PARSER LogsUserAgentParserType = "user-agent-parser" +) + +var allowedLogsUserAgentParserTypeEnumValues = []LogsUserAgentParserType{ + LOGSUSERAGENTPARSERTYPE_USER_AGENT_PARSER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsUserAgentParserType) GetAllowedValues() []LogsUserAgentParserType { + return allowedLogsUserAgentParserTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsUserAgentParserType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsUserAgentParserType(value) + return nil +} + +// NewLogsUserAgentParserTypeFromValue returns a pointer to a valid LogsUserAgentParserType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsUserAgentParserTypeFromValue(v string) (*LogsUserAgentParserType, error) { + ev := LogsUserAgentParserType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsUserAgentParserType: valid values are %v", v, allowedLogsUserAgentParserTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsUserAgentParserType) IsValid() bool { + for _, existing := range allowedLogsUserAgentParserTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsUserAgentParserType value. +func (v LogsUserAgentParserType) Ptr() *LogsUserAgentParserType { + return &v +} + +// NullableLogsUserAgentParserType handles when a null is used for LogsUserAgentParserType. +type NullableLogsUserAgentParserType struct { + value *LogsUserAgentParserType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsUserAgentParserType) Get() *LogsUserAgentParserType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsUserAgentParserType) Set(val *LogsUserAgentParserType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsUserAgentParserType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsUserAgentParserType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsUserAgentParserType initializes the struct as if Set has been called. +func NewNullableLogsUserAgentParserType(val *LogsUserAgentParserType) *NullableLogsUserAgentParserType { + return &NullableLogsUserAgentParserType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsUserAgentParserType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsUserAgentParserType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_metric_content_encoding.go b/api/v1/datadog/model_metric_content_encoding.go new file mode 100644 index 00000000000..05dc8ba28e3 --- /dev/null +++ b/api/v1/datadog/model_metric_content_encoding.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricContentEncoding HTTP header used to compress the media-type. +type MetricContentEncoding string + +// List of MetricContentEncoding. +const ( + METRICCONTENTENCODING_DEFLATE MetricContentEncoding = "deflate" +) + +var allowedMetricContentEncodingEnumValues = []MetricContentEncoding{ + METRICCONTENTENCODING_DEFLATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricContentEncoding) GetAllowedValues() []MetricContentEncoding { + return allowedMetricContentEncodingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricContentEncoding) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricContentEncoding(value) + return nil +} + +// NewMetricContentEncodingFromValue returns a pointer to a valid MetricContentEncoding +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricContentEncodingFromValue(v string) (*MetricContentEncoding, error) { + ev := MetricContentEncoding(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricContentEncoding: valid values are %v", v, allowedMetricContentEncodingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricContentEncoding) IsValid() bool { + for _, existing := range allowedMetricContentEncodingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricContentEncoding value. +func (v MetricContentEncoding) Ptr() *MetricContentEncoding { + return &v +} + +// NullableMetricContentEncoding handles when a null is used for MetricContentEncoding. +type NullableMetricContentEncoding struct { + value *MetricContentEncoding + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricContentEncoding) Get() *MetricContentEncoding { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricContentEncoding) Set(val *MetricContentEncoding) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricContentEncoding) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricContentEncoding) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricContentEncoding initializes the struct as if Set has been called. +func NewNullableMetricContentEncoding(val *MetricContentEncoding) *NullableMetricContentEncoding { + return &NullableMetricContentEncoding{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricContentEncoding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricContentEncoding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_metric_metadata.go b/api/v1/datadog/model_metric_metadata.go new file mode 100644 index 00000000000..a129ca26bce --- /dev/null +++ b/api/v1/datadog/model_metric_metadata.go @@ -0,0 +1,336 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricMetadata Object with all metric related metadata. +type MetricMetadata struct { + // Metric description. + Description *string `json:"description,omitempty"` + // Name of the integration that sent the metric if applicable. + Integration *string `json:"integration,omitempty"` + // Per unit of the metric such as `second` in `bytes per second`. + PerUnit *string `json:"per_unit,omitempty"` + // A more human-readable and abbreviated version of the metric name. + ShortName *string `json:"short_name,omitempty"` + // StatsD flush interval of the metric in seconds if applicable. + StatsdInterval *int64 `json:"statsd_interval,omitempty"` + // Metric type such as `gauge` or `rate`. + Type *string `json:"type,omitempty"` + // Primary unit of the metric such as `byte` or `operation`. + Unit *string `json:"unit,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{} +} + +// NewMetricMetadata instantiates a new MetricMetadata 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 NewMetricMetadata() *MetricMetadata { + this := MetricMetadata{} + return &this +} + +// NewMetricMetadataWithDefaults instantiates a new MetricMetadata 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 NewMetricMetadataWithDefaults() *MetricMetadata { + this := MetricMetadata{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *MetricMetadata) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *MetricMetadata) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *MetricMetadata) SetDescription(v string) { + o.Description = &v +} + +// GetIntegration returns the Integration field value if set, zero value otherwise. +func (o *MetricMetadata) GetIntegration() string { + if o == nil || o.Integration == nil { + var ret string + return ret + } + return *o.Integration +} + +// GetIntegrationOk returns a tuple with the Integration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetIntegrationOk() (*string, bool) { + if o == nil || o.Integration == nil { + return nil, false + } + return o.Integration, true +} + +// HasIntegration returns a boolean if a field has been set. +func (o *MetricMetadata) HasIntegration() bool { + if o != nil && o.Integration != nil { + return true + } + + return false +} + +// SetIntegration gets a reference to the given string and assigns it to the Integration field. +func (o *MetricMetadata) SetIntegration(v string) { + o.Integration = &v +} + +// GetPerUnit returns the PerUnit field value if set, zero value otherwise. +func (o *MetricMetadata) GetPerUnit() string { + if o == nil || o.PerUnit == nil { + var ret string + return ret + } + return *o.PerUnit +} + +// GetPerUnitOk returns a tuple with the PerUnit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetPerUnitOk() (*string, bool) { + if o == nil || o.PerUnit == nil { + return nil, false + } + return o.PerUnit, true +} + +// HasPerUnit returns a boolean if a field has been set. +func (o *MetricMetadata) HasPerUnit() bool { + if o != nil && o.PerUnit != nil { + return true + } + + return false +} + +// SetPerUnit gets a reference to the given string and assigns it to the PerUnit field. +func (o *MetricMetadata) SetPerUnit(v string) { + o.PerUnit = &v +} + +// GetShortName returns the ShortName field value if set, zero value otherwise. +func (o *MetricMetadata) GetShortName() string { + if o == nil || o.ShortName == nil { + var ret string + return ret + } + return *o.ShortName +} + +// GetShortNameOk returns a tuple with the ShortName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetShortNameOk() (*string, bool) { + if o == nil || o.ShortName == nil { + return nil, false + } + return o.ShortName, true +} + +// HasShortName returns a boolean if a field has been set. +func (o *MetricMetadata) HasShortName() bool { + if o != nil && o.ShortName != nil { + return true + } + + return false +} + +// SetShortName gets a reference to the given string and assigns it to the ShortName field. +func (o *MetricMetadata) SetShortName(v string) { + o.ShortName = &v +} + +// GetStatsdInterval returns the StatsdInterval field value if set, zero value otherwise. +func (o *MetricMetadata) GetStatsdInterval() int64 { + if o == nil || o.StatsdInterval == nil { + var ret int64 + return ret + } + return *o.StatsdInterval +} + +// GetStatsdIntervalOk returns a tuple with the StatsdInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetStatsdIntervalOk() (*int64, bool) { + if o == nil || o.StatsdInterval == nil { + return nil, false + } + return o.StatsdInterval, true +} + +// HasStatsdInterval returns a boolean if a field has been set. +func (o *MetricMetadata) HasStatsdInterval() bool { + if o != nil && o.StatsdInterval != nil { + return true + } + + return false +} + +// SetStatsdInterval gets a reference to the given int64 and assigns it to the StatsdInterval field. +func (o *MetricMetadata) SetStatsdInterval(v int64) { + o.StatsdInterval = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricMetadata) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricMetadata) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *MetricMetadata) SetType(v string) { + o.Type = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *MetricMetadata) GetUnit() string { + if o == nil || o.Unit == nil { + var ret string + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetUnitOk() (*string, bool) { + if o == nil || o.Unit == nil { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *MetricMetadata) HasUnit() bool { + if o != nil && o.Unit != nil { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *MetricMetadata) SetUnit(v string) { + o.Unit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Integration != nil { + toSerialize["integration"] = o.Integration + } + if o.PerUnit != nil { + toSerialize["per_unit"] = o.PerUnit + } + if o.ShortName != nil { + toSerialize["short_name"] = o.ShortName + } + if o.StatsdInterval != nil { + toSerialize["statsd_interval"] = o.StatsdInterval + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Unit != nil { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Description *string `json:"description,omitempty"` + Integration *string `json:"integration,omitempty"` + PerUnit *string `json:"per_unit,omitempty"` + ShortName *string `json:"short_name,omitempty"` + StatsdInterval *int64 `json:"statsd_interval,omitempty"` + Type *string `json:"type,omitempty"` + Unit *string `json:"unit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Description = all.Description + o.Integration = all.Integration + o.PerUnit = all.PerUnit + o.ShortName = all.ShortName + o.StatsdInterval = all.StatsdInterval + o.Type = all.Type + o.Unit = all.Unit + return nil +} diff --git a/api/v1/datadog/model_metric_search_response.go b/api/v1/datadog/model_metric_search_response.go new file mode 100644 index 00000000000..964011c6cee --- /dev/null +++ b/api/v1/datadog/model_metric_search_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricSearchResponse Object containing the list of metrics matching the search query. +type MetricSearchResponse struct { + // Search result. + Results *MetricSearchResponseResults `json:"results,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{} +} + +// NewMetricSearchResponse instantiates a new MetricSearchResponse 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 NewMetricSearchResponse() *MetricSearchResponse { + this := MetricSearchResponse{} + return &this +} + +// NewMetricSearchResponseWithDefaults instantiates a new MetricSearchResponse 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 NewMetricSearchResponseWithDefaults() *MetricSearchResponse { + this := MetricSearchResponse{} + return &this +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *MetricSearchResponse) GetResults() MetricSearchResponseResults { + if o == nil || o.Results == nil { + var ret MetricSearchResponseResults + return ret + } + return *o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSearchResponse) GetResultsOk() (*MetricSearchResponseResults, bool) { + if o == nil || o.Results == nil { + return nil, false + } + return o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *MetricSearchResponse) HasResults() bool { + if o != nil && o.Results != nil { + return true + } + + return false +} + +// SetResults gets a reference to the given MetricSearchResponseResults and assigns it to the Results field. +func (o *MetricSearchResponse) SetResults(v MetricSearchResponseResults) { + o.Results = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricSearchResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Results != nil { + toSerialize["results"] = o.Results + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricSearchResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Results *MetricSearchResponseResults `json:"results,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Results != nil && all.Results.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Results = all.Results + return nil +} diff --git a/api/v1/datadog/model_metric_search_response_results.go b/api/v1/datadog/model_metric_search_response_results.go new file mode 100644 index 00000000000..867b668cba3 --- /dev/null +++ b/api/v1/datadog/model_metric_search_response_results.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 datadog + +import ( + "encoding/json" +) + +// MetricSearchResponseResults Search result. +type MetricSearchResponseResults struct { + // List of metrics that match the search query. + Metrics []string `json:"metrics,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{} +} + +// NewMetricSearchResponseResults instantiates a new MetricSearchResponseResults 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 NewMetricSearchResponseResults() *MetricSearchResponseResults { + this := MetricSearchResponseResults{} + return &this +} + +// NewMetricSearchResponseResultsWithDefaults instantiates a new MetricSearchResponseResults 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 NewMetricSearchResponseResultsWithDefaults() *MetricSearchResponseResults { + this := MetricSearchResponseResults{} + return &this +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *MetricSearchResponseResults) GetMetrics() []string { + if o == nil || o.Metrics == nil { + var ret []string + return ret + } + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSearchResponseResults) GetMetricsOk() (*[]string, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return &o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *MetricSearchResponseResults) HasMetrics() bool { + if o != nil && o.Metrics != nil { + return true + } + + return false +} + +// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. +func (o *MetricSearchResponseResults) SetMetrics(v []string) { + o.Metrics = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricSearchResponseResults) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricSearchResponseResults) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Metrics []string `json:"metrics,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Metrics = all.Metrics + return nil +} diff --git a/api/v1/datadog/model_metrics_list_response.go b/api/v1/datadog/model_metrics_list_response.go new file mode 100644 index 00000000000..da1fd57b7c6 --- /dev/null +++ b/api/v1/datadog/model_metrics_list_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricsListResponse Object listing all metric names stored by Datadog since a given time. +type MetricsListResponse struct { + // Time when the metrics were active, seconds since the Unix epoch. + From *string `json:"from,omitempty"` + // List of metric names. + Metrics []string `json:"metrics,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{} +} + +// NewMetricsListResponse instantiates a new MetricsListResponse 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 NewMetricsListResponse() *MetricsListResponse { + this := MetricsListResponse{} + return &this +} + +// NewMetricsListResponseWithDefaults instantiates a new MetricsListResponse 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 NewMetricsListResponseWithDefaults() *MetricsListResponse { + this := MetricsListResponse{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *MetricsListResponse) GetFrom() string { + if o == nil || o.From == nil { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsListResponse) GetFromOk() (*string, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *MetricsListResponse) HasFrom() bool { + if o != nil && o.From != nil { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *MetricsListResponse) SetFrom(v string) { + o.From = &v +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *MetricsListResponse) GetMetrics() []string { + if o == nil || o.Metrics == nil { + var ret []string + return ret + } + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsListResponse) GetMetricsOk() (*[]string, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return &o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *MetricsListResponse) HasMetrics() bool { + if o != nil && o.Metrics != nil { + return true + } + + return false +} + +// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. +func (o *MetricsListResponse) SetMetrics(v []string) { + o.Metrics = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricsListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + From *string `json:"from,omitempty"` + Metrics []string `json:"metrics,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.From = all.From + o.Metrics = all.Metrics + return nil +} diff --git a/api/v1/datadog/model_metrics_payload.go b/api/v1/datadog/model_metrics_payload.go new file mode 100644 index 00000000000..15a92088bb1 --- /dev/null +++ b/api/v1/datadog/model_metrics_payload.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricsPayload The metrics' payload. +type MetricsPayload struct { + // A list of time series to submit to Datadog. + Series []Series `json:"series"` + // 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{} +} + +// NewMetricsPayload instantiates a new MetricsPayload 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 NewMetricsPayload(series []Series) *MetricsPayload { + this := MetricsPayload{} + this.Series = series + return &this +} + +// NewMetricsPayloadWithDefaults instantiates a new MetricsPayload 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 NewMetricsPayloadWithDefaults() *MetricsPayload { + this := MetricsPayload{} + return &this +} + +// GetSeries returns the Series field value. +func (o *MetricsPayload) GetSeries() []Series { + if o == nil { + var ret []Series + return ret + } + return o.Series +} + +// GetSeriesOk returns a tuple with the Series field value +// and a boolean to check if the value has been set. +func (o *MetricsPayload) GetSeriesOk() (*[]Series, bool) { + if o == nil { + return nil, false + } + return &o.Series, true +} + +// SetSeries sets field value. +func (o *MetricsPayload) SetSeries(v []Series) { + o.Series = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricsPayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["series"] = o.Series + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricsPayload) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Series *[]Series `json:"series"` + }{} + all := struct { + Series []Series `json:"series"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Series == nil { + return fmt.Errorf("Required field series missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Series = all.Series + return nil +} diff --git a/api/v1/datadog/model_metrics_query_metadata.go b/api/v1/datadog/model_metrics_query_metadata.go new file mode 100644 index 00000000000..db00105e3fc --- /dev/null +++ b/api/v1/datadog/model_metrics_query_metadata.go @@ -0,0 +1,585 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MetricsQueryMetadata Object containing all metric names returned and their associated metadata. +type MetricsQueryMetadata struct { + // Aggregation type. + Aggr common.NullableString `json:"aggr,omitempty"` + // Display name of the metric. + DisplayName *string `json:"display_name,omitempty"` + // End of the time window, milliseconds since Unix epoch. + End *int64 `json:"end,omitempty"` + // Metric expression. + Expression *string `json:"expression,omitempty"` + // Number of seconds between data samples. + Interval *int64 `json:"interval,omitempty"` + // Number of data samples. + Length *int64 `json:"length,omitempty"` + // Metric name. + Metric *string `json:"metric,omitempty"` + // List of points of the time series. + Pointlist [][]*float64 `json:"pointlist,omitempty"` + // The index of the series' query within the request. + QueryIndex *int64 `json:"query_index,omitempty"` + // Metric scope, comma separated list of tags. + Scope *string `json:"scope,omitempty"` + // Start of the time window, milliseconds since Unix epoch. + Start *int64 `json:"start,omitempty"` + // Unique tags identifying this series. + TagSet []string `json:"tag_set,omitempty"` + // Detailed information about the metric unit. + // First element describes the "primary unit" (for example, `bytes` in `bytes per second`), + // second describes the "per unit" (for example, `second` in `bytes per second`). + Unit []MetricsQueryUnit `json:"unit,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{} +} + +// NewMetricsQueryMetadata instantiates a new MetricsQueryMetadata 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 NewMetricsQueryMetadata() *MetricsQueryMetadata { + this := MetricsQueryMetadata{} + return &this +} + +// NewMetricsQueryMetadataWithDefaults instantiates a new MetricsQueryMetadata 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 NewMetricsQueryMetadataWithDefaults() *MetricsQueryMetadata { + this := MetricsQueryMetadata{} + return &this +} + +// GetAggr returns the Aggr field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MetricsQueryMetadata) GetAggr() string { + if o == nil || o.Aggr.Get() == nil { + var ret string + return ret + } + return *o.Aggr.Get() +} + +// GetAggrOk returns a tuple with the Aggr 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 *MetricsQueryMetadata) GetAggrOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Aggr.Get(), o.Aggr.IsSet() +} + +// HasAggr returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasAggr() bool { + if o != nil && o.Aggr.IsSet() { + return true + } + + return false +} + +// SetAggr gets a reference to the given common.NullableString and assigns it to the Aggr field. +func (o *MetricsQueryMetadata) SetAggr(v string) { + o.Aggr.Set(&v) +} + +// SetAggrNil sets the value for Aggr to be an explicit nil. +func (o *MetricsQueryMetadata) SetAggrNil() { + o.Aggr.Set(nil) +} + +// UnsetAggr ensures that no value is present for Aggr, not even an explicit nil. +func (o *MetricsQueryMetadata) UnsetAggr() { + o.Aggr.Unset() +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetDisplayName() string { + if o == nil || o.DisplayName == nil { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetDisplayNameOk() (*string, bool) { + if o == nil || o.DisplayName == nil { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasDisplayName() bool { + if o != nil && o.DisplayName != nil { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *MetricsQueryMetadata) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasEnd() bool { + if o != nil && o.End != nil { + return true + } + + return false +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *MetricsQueryMetadata) SetEnd(v int64) { + o.End = &v +} + +// GetExpression returns the Expression field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetExpression() string { + if o == nil || o.Expression == nil { + var ret string + return ret + } + return *o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetExpressionOk() (*string, bool) { + if o == nil || o.Expression == nil { + return nil, false + } + return o.Expression, true +} + +// HasExpression returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasExpression() bool { + if o != nil && o.Expression != nil { + return true + } + + return false +} + +// SetExpression gets a reference to the given string and assigns it to the Expression field. +func (o *MetricsQueryMetadata) SetExpression(v string) { + o.Expression = &v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetInterval() int64 { + if o == nil || o.Interval == nil { + var ret int64 + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetIntervalOk() (*int64, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given int64 and assigns it to the Interval field. +func (o *MetricsQueryMetadata) SetInterval(v int64) { + o.Interval = &v +} + +// GetLength returns the Length field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetLength() int64 { + if o == nil || o.Length == nil { + var ret int64 + return ret + } + return *o.Length +} + +// GetLengthOk returns a tuple with the Length field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetLengthOk() (*int64, bool) { + if o == nil || o.Length == nil { + return nil, false + } + return o.Length, true +} + +// HasLength returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasLength() bool { + if o != nil && o.Length != nil { + return true + } + + return false +} + +// SetLength gets a reference to the given int64 and assigns it to the Length field. +func (o *MetricsQueryMetadata) SetLength(v int64) { + o.Length = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *MetricsQueryMetadata) SetMetric(v string) { + o.Metric = &v +} + +// GetPointlist returns the Pointlist field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetPointlist() [][]*float64 { + if o == nil || o.Pointlist == nil { + var ret [][]*float64 + return ret + } + return o.Pointlist +} + +// GetPointlistOk returns a tuple with the Pointlist field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetPointlistOk() (*[][]*float64, bool) { + if o == nil || o.Pointlist == nil { + return nil, false + } + return &o.Pointlist, true +} + +// HasPointlist returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasPointlist() bool { + if o != nil && o.Pointlist != nil { + return true + } + + return false +} + +// SetPointlist gets a reference to the given [][]*float64 and assigns it to the Pointlist field. +func (o *MetricsQueryMetadata) SetPointlist(v [][]*float64) { + o.Pointlist = v +} + +// GetQueryIndex returns the QueryIndex field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetQueryIndex() int64 { + if o == nil || o.QueryIndex == nil { + var ret int64 + return ret + } + return *o.QueryIndex +} + +// GetQueryIndexOk returns a tuple with the QueryIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetQueryIndexOk() (*int64, bool) { + if o == nil || o.QueryIndex == nil { + return nil, false + } + return o.QueryIndex, true +} + +// HasQueryIndex returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasQueryIndex() bool { + if o != nil && o.QueryIndex != nil { + return true + } + + return false +} + +// SetQueryIndex gets a reference to the given int64 and assigns it to the QueryIndex field. +func (o *MetricsQueryMetadata) SetQueryIndex(v int64) { + o.QueryIndex = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetScope() string { + if o == nil || o.Scope == nil { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetScopeOk() (*string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasScope() bool { + if o != nil && o.Scope != nil { + return true + } + + return false +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *MetricsQueryMetadata) SetScope(v string) { + o.Scope = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +func (o *MetricsQueryMetadata) SetStart(v int64) { + o.Start = &v +} + +// GetTagSet returns the TagSet field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetTagSet() []string { + if o == nil || o.TagSet == nil { + var ret []string + return ret + } + return o.TagSet +} + +// GetTagSetOk returns a tuple with the TagSet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetTagSetOk() (*[]string, bool) { + if o == nil || o.TagSet == nil { + return nil, false + } + return &o.TagSet, true +} + +// HasTagSet returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasTagSet() bool { + if o != nil && o.TagSet != nil { + return true + } + + return false +} + +// SetTagSet gets a reference to the given []string and assigns it to the TagSet field. +func (o *MetricsQueryMetadata) SetTagSet(v []string) { + o.TagSet = v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *MetricsQueryMetadata) GetUnit() []MetricsQueryUnit { + if o == nil || o.Unit == nil { + var ret []MetricsQueryUnit + return ret + } + return o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryMetadata) GetUnitOk() (*[]MetricsQueryUnit, bool) { + if o == nil || o.Unit == nil { + return nil, false + } + return &o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *MetricsQueryMetadata) HasUnit() bool { + if o != nil && o.Unit != nil { + return true + } + + return false +} + +// SetUnit gets a reference to the given []MetricsQueryUnit and assigns it to the Unit field. +func (o *MetricsQueryMetadata) SetUnit(v []MetricsQueryUnit) { + o.Unit = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricsQueryMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggr.IsSet() { + toSerialize["aggr"] = o.Aggr.Get() + } + if o.DisplayName != nil { + toSerialize["display_name"] = o.DisplayName + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Expression != nil { + toSerialize["expression"] = o.Expression + } + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + if o.Length != nil { + toSerialize["length"] = o.Length + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Pointlist != nil { + toSerialize["pointlist"] = o.Pointlist + } + if o.QueryIndex != nil { + toSerialize["query_index"] = o.QueryIndex + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.TagSet != nil { + toSerialize["tag_set"] = o.TagSet + } + if o.Unit != nil { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricsQueryMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggr common.NullableString `json:"aggr,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + End *int64 `json:"end,omitempty"` + Expression *string `json:"expression,omitempty"` + Interval *int64 `json:"interval,omitempty"` + Length *int64 `json:"length,omitempty"` + Metric *string `json:"metric,omitempty"` + Pointlist [][]*float64 `json:"pointlist,omitempty"` + QueryIndex *int64 `json:"query_index,omitempty"` + Scope *string `json:"scope,omitempty"` + Start *int64 `json:"start,omitempty"` + TagSet []string `json:"tag_set,omitempty"` + Unit []MetricsQueryUnit `json:"unit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggr = all.Aggr + o.DisplayName = all.DisplayName + o.End = all.End + o.Expression = all.Expression + o.Interval = all.Interval + o.Length = all.Length + o.Metric = all.Metric + o.Pointlist = all.Pointlist + o.QueryIndex = all.QueryIndex + o.Scope = all.Scope + o.Start = all.Start + o.TagSet = all.TagSet + o.Unit = all.Unit + return nil +} diff --git a/api/v1/datadog/model_metrics_query_response.go b/api/v1/datadog/model_metrics_query_response.go new file mode 100644 index 00000000000..028b2405a0d --- /dev/null +++ b/api/v1/datadog/model_metrics_query_response.go @@ -0,0 +1,414 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricsQueryResponse Response Object that includes your query and the list of metrics retrieved. +type MetricsQueryResponse struct { + // Message indicating the errors if status is not `ok`. + Error *string `json:"error,omitempty"` + // Start of requested time window, milliseconds since Unix epoch. + FromDate *int64 `json:"from_date,omitempty"` + // List of tag keys on which to group. + GroupBy []string `json:"group_by,omitempty"` + // Message indicating `success` if status is `ok`. + Message *string `json:"message,omitempty"` + // Query string + Query *string `json:"query,omitempty"` + // Type of response. + ResType *string `json:"res_type,omitempty"` + // List of timeseries queried. + Series []MetricsQueryMetadata `json:"series,omitempty"` + // Status of the query. + Status *string `json:"status,omitempty"` + // End of requested time window, milliseconds since Unix epoch. + ToDate *int64 `json:"to_date,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{} +} + +// NewMetricsQueryResponse instantiates a new MetricsQueryResponse 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 NewMetricsQueryResponse() *MetricsQueryResponse { + this := MetricsQueryResponse{} + return &this +} + +// NewMetricsQueryResponseWithDefaults instantiates a new MetricsQueryResponse 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 NewMetricsQueryResponseWithDefaults() *MetricsQueryResponse { + this := MetricsQueryResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetError() string { + if o == nil || o.Error == nil { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetErrorOk() (*string, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *MetricsQueryResponse) SetError(v string) { + o.Error = &v +} + +// GetFromDate returns the FromDate field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetFromDate() int64 { + if o == nil || o.FromDate == nil { + var ret int64 + return ret + } + return *o.FromDate +} + +// GetFromDateOk returns a tuple with the FromDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetFromDateOk() (*int64, bool) { + if o == nil || o.FromDate == nil { + return nil, false + } + return o.FromDate, true +} + +// HasFromDate returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasFromDate() bool { + if o != nil && o.FromDate != nil { + return true + } + + return false +} + +// SetFromDate gets a reference to the given int64 and assigns it to the FromDate field. +func (o *MetricsQueryResponse) SetFromDate(v int64) { + o.FromDate = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetGroupBy() []string { + if o == nil || o.GroupBy == nil { + var ret []string + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetGroupByOk() (*[]string, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. +func (o *MetricsQueryResponse) SetGroupBy(v []string) { + o.GroupBy = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *MetricsQueryResponse) SetMessage(v string) { + o.Message = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *MetricsQueryResponse) SetQuery(v string) { + o.Query = &v +} + +// GetResType returns the ResType field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetResType() string { + if o == nil || o.ResType == nil { + var ret string + return ret + } + return *o.ResType +} + +// GetResTypeOk returns a tuple with the ResType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetResTypeOk() (*string, bool) { + if o == nil || o.ResType == nil { + return nil, false + } + return o.ResType, true +} + +// HasResType returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasResType() bool { + if o != nil && o.ResType != nil { + return true + } + + return false +} + +// SetResType gets a reference to the given string and assigns it to the ResType field. +func (o *MetricsQueryResponse) SetResType(v string) { + o.ResType = &v +} + +// GetSeries returns the Series field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetSeries() []MetricsQueryMetadata { + if o == nil || o.Series == nil { + var ret []MetricsQueryMetadata + return ret + } + return o.Series +} + +// GetSeriesOk returns a tuple with the Series field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetSeriesOk() (*[]MetricsQueryMetadata, bool) { + if o == nil || o.Series == nil { + return nil, false + } + return &o.Series, true +} + +// HasSeries returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasSeries() bool { + if o != nil && o.Series != nil { + return true + } + + return false +} + +// SetSeries gets a reference to the given []MetricsQueryMetadata and assigns it to the Series field. +func (o *MetricsQueryResponse) SetSeries(v []MetricsQueryMetadata) { + o.Series = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *MetricsQueryResponse) SetStatus(v string) { + o.Status = &v +} + +// GetToDate returns the ToDate field value if set, zero value otherwise. +func (o *MetricsQueryResponse) GetToDate() int64 { + if o == nil || o.ToDate == nil { + var ret int64 + return ret + } + return *o.ToDate +} + +// GetToDateOk returns a tuple with the ToDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryResponse) GetToDateOk() (*int64, bool) { + if o == nil || o.ToDate == nil { + return nil, false + } + return o.ToDate, true +} + +// HasToDate returns a boolean if a field has been set. +func (o *MetricsQueryResponse) HasToDate() bool { + if o != nil && o.ToDate != nil { + return true + } + + return false +} + +// SetToDate gets a reference to the given int64 and assigns it to the ToDate field. +func (o *MetricsQueryResponse) SetToDate(v int64) { + o.ToDate = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricsQueryResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + if o.FromDate != nil { + toSerialize["from_date"] = o.FromDate + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.ResType != nil { + toSerialize["res_type"] = o.ResType + } + if o.Series != nil { + toSerialize["series"] = o.Series + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.ToDate != nil { + toSerialize["to_date"] = o.ToDate + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricsQueryResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Error *string `json:"error,omitempty"` + FromDate *int64 `json:"from_date,omitempty"` + GroupBy []string `json:"group_by,omitempty"` + Message *string `json:"message,omitempty"` + Query *string `json:"query,omitempty"` + ResType *string `json:"res_type,omitempty"` + Series []MetricsQueryMetadata `json:"series,omitempty"` + Status *string `json:"status,omitempty"` + ToDate *int64 `json:"to_date,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Error = all.Error + o.FromDate = all.FromDate + o.GroupBy = all.GroupBy + o.Message = all.Message + o.Query = all.Query + o.ResType = all.ResType + o.Series = all.Series + o.Status = all.Status + o.ToDate = all.ToDate + return nil +} diff --git a/api/v1/datadog/model_metrics_query_unit.go b/api/v1/datadog/model_metrics_query_unit.go new file mode 100644 index 00000000000..40a50c04bef --- /dev/null +++ b/api/v1/datadog/model_metrics_query_unit.go @@ -0,0 +1,308 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricsQueryUnit Object containing the metric unit family, scale factor, name, and short name. +type MetricsQueryUnit struct { + // Unit family, allows for conversion between units of the same family, for scaling. + Family *string `json:"family,omitempty"` + // Unit name + Name *string `json:"name,omitempty"` + // Plural form of the unit name. + Plural *string `json:"plural,omitempty"` + // Factor for scaling between units of the same family. + ScaleFactor *float64 `json:"scale_factor,omitempty"` + // Abbreviation of the unit. + ShortName *string `json:"short_name,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{} +} + +// NewMetricsQueryUnit instantiates a new MetricsQueryUnit 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 NewMetricsQueryUnit() *MetricsQueryUnit { + this := MetricsQueryUnit{} + return &this +} + +// NewMetricsQueryUnitWithDefaults instantiates a new MetricsQueryUnit 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 NewMetricsQueryUnitWithDefaults() *MetricsQueryUnit { + this := MetricsQueryUnit{} + return &this +} + +// GetFamily returns the Family field value if set, zero value otherwise. +func (o *MetricsQueryUnit) GetFamily() string { + if o == nil || o.Family == nil { + var ret string + return ret + } + return *o.Family +} + +// GetFamilyOk returns a tuple with the Family field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryUnit) GetFamilyOk() (*string, bool) { + if o == nil || o.Family == nil { + return nil, false + } + return o.Family, true +} + +// HasFamily returns a boolean if a field has been set. +func (o *MetricsQueryUnit) HasFamily() bool { + if o != nil && o.Family != nil { + return true + } + + return false +} + +// SetFamily gets a reference to the given string and assigns it to the Family field. +func (o *MetricsQueryUnit) SetFamily(v string) { + o.Family = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MetricsQueryUnit) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryUnit) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MetricsQueryUnit) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MetricsQueryUnit) SetName(v string) { + o.Name = &v +} + +// GetPlural returns the Plural field value if set, zero value otherwise. +func (o *MetricsQueryUnit) GetPlural() string { + if o == nil || o.Plural == nil { + var ret string + return ret + } + return *o.Plural +} + +// GetPluralOk returns a tuple with the Plural field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryUnit) GetPluralOk() (*string, bool) { + if o == nil || o.Plural == nil { + return nil, false + } + return o.Plural, true +} + +// HasPlural returns a boolean if a field has been set. +func (o *MetricsQueryUnit) HasPlural() bool { + if o != nil && o.Plural != nil { + return true + } + + return false +} + +// SetPlural gets a reference to the given string and assigns it to the Plural field. +func (o *MetricsQueryUnit) SetPlural(v string) { + o.Plural = &v +} + +// GetScaleFactor returns the ScaleFactor field value if set, zero value otherwise. +func (o *MetricsQueryUnit) GetScaleFactor() float64 { + if o == nil || o.ScaleFactor == nil { + var ret float64 + return ret + } + return *o.ScaleFactor +} + +// GetScaleFactorOk returns a tuple with the ScaleFactor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryUnit) GetScaleFactorOk() (*float64, bool) { + if o == nil || o.ScaleFactor == nil { + return nil, false + } + return o.ScaleFactor, true +} + +// HasScaleFactor returns a boolean if a field has been set. +func (o *MetricsQueryUnit) HasScaleFactor() bool { + if o != nil && o.ScaleFactor != nil { + return true + } + + return false +} + +// SetScaleFactor gets a reference to the given float64 and assigns it to the ScaleFactor field. +func (o *MetricsQueryUnit) SetScaleFactor(v float64) { + o.ScaleFactor = &v +} + +// GetShortName returns the ShortName field value if set, zero value otherwise. +func (o *MetricsQueryUnit) GetShortName() string { + if o == nil || o.ShortName == nil { + var ret string + return ret + } + return *o.ShortName +} + +// GetShortNameOk returns a tuple with the ShortName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsQueryUnit) GetShortNameOk() (*string, bool) { + if o == nil || o.ShortName == nil { + return nil, false + } + return o.ShortName, true +} + +// HasShortName returns a boolean if a field has been set. +func (o *MetricsQueryUnit) HasShortName() bool { + if o != nil && o.ShortName != nil { + return true + } + + return false +} + +// SetShortName gets a reference to the given string and assigns it to the ShortName field. +func (o *MetricsQueryUnit) SetShortName(v string) { + o.ShortName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricsQueryUnit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Family != nil { + toSerialize["family"] = o.Family + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Plural != nil { + toSerialize["plural"] = o.Plural + } + if o.ScaleFactor != nil { + toSerialize["scale_factor"] = o.ScaleFactor + } + if o.ShortName != nil { + toSerialize["short_name"] = o.ShortName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricsQueryUnit) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Family *string `json:"family,omitempty"` + Name *string `json:"name,omitempty"` + Plural *string `json:"plural,omitempty"` + ScaleFactor *float64 `json:"scale_factor,omitempty"` + ShortName *string `json:"short_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Family = all.Family + o.Name = all.Name + o.Plural = all.Plural + o.ScaleFactor = all.ScaleFactor + o.ShortName = all.ShortName + return nil +} + +// NullableMetricsQueryUnit handles when a null is used for MetricsQueryUnit. +type NullableMetricsQueryUnit struct { + value *MetricsQueryUnit + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricsQueryUnit) Get() *MetricsQueryUnit { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricsQueryUnit) Set(val *MetricsQueryUnit) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricsQueryUnit) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableMetricsQueryUnit) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricsQueryUnit initializes the struct as if Set has been called. +func NewNullableMetricsQueryUnit(val *MetricsQueryUnit) *NullableMetricsQueryUnit { + return &NullableMetricsQueryUnit{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricsQueryUnit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricsQueryUnit) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor.go b/api/v1/datadog/model_monitor.go new file mode 100644 index 00000000000..f997b1d9521 --- /dev/null +++ b/api/v1/datadog/model_monitor.go @@ -0,0 +1,753 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// Monitor Object describing a monitor. +type Monitor struct { + // Timestamp of the monitor creation. + Created *time.Time `json:"created,omitempty"` + // Object describing the creator of the shared element. + Creator *Creator `json:"creator,omitempty"` + // Whether or not the monitor is deleted. (Always `null`) + Deleted common.NullableTime `json:"deleted,omitempty"` + // ID of this monitor. + Id *int64 `json:"id,omitempty"` + // A message to include with notifications for this monitor. + Message *string `json:"message,omitempty"` + // Last timestamp when the monitor was edited. + Modified *time.Time `json:"modified,omitempty"` + // Whether or not the monitor is broken down on different groups. + Multi *bool `json:"multi,omitempty"` + // The monitor name. + Name *string `json:"name,omitempty"` + // List of options associated with your monitor. + Options *MonitorOptions `json:"options,omitempty"` + // The different states your monitor can be in. + OverallState *MonitorOverallStates `json:"overall_state,omitempty"` + // Integer from 1 (high) to 5 (low) indicating alert severity. + Priority common.NullableInt64 `json:"priority,omitempty"` + // The monitor query. + Query string `json:"query"` + // A list of unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the [Roles API](https://docs.datadoghq.com/api/latest/roles/#list-roles) and are located in the `data.id` field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. `restricted_roles` is the successor of `locked`. For more information about `locked` and `restricted_roles`, see the [monitor options docs](https://docs.datadoghq.com/monitors/guide/monitor_api_options/#permissions-options). + RestrictedRoles []string `json:"restricted_roles,omitempty"` + // Wrapper object with the different monitor states. + State *MonitorState `json:"state,omitempty"` + // Tags associated to your monitor. + Tags []string `json:"tags,omitempty"` + // The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. + Type MonitorType `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{} +} + +// NewMonitor instantiates a new Monitor 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 NewMonitor(query string, typeVar MonitorType) *Monitor { + this := Monitor{} + this.Query = query + this.Type = typeVar + return &this +} + +// NewMonitorWithDefaults instantiates a new Monitor 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 NewMonitorWithDefaults() *Monitor { + this := Monitor{} + return &this +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *Monitor) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *Monitor) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *Monitor) SetCreated(v time.Time) { + o.Created = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *Monitor) GetCreator() Creator { + if o == nil || o.Creator == nil { + var ret Creator + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetCreatorOk() (*Creator, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *Monitor) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given Creator and assigns it to the Creator field. +func (o *Monitor) SetCreator(v Creator) { + o.Creator = &v +} + +// GetDeleted returns the Deleted field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Monitor) GetDeleted() time.Time { + if o == nil || o.Deleted.Get() == nil { + var ret time.Time + return ret + } + return *o.Deleted.Get() +} + +// GetDeletedOk returns a tuple with the Deleted 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 *Monitor) GetDeletedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Deleted.Get(), o.Deleted.IsSet() +} + +// HasDeleted returns a boolean if a field has been set. +func (o *Monitor) HasDeleted() bool { + if o != nil && o.Deleted.IsSet() { + return true + } + + return false +} + +// SetDeleted gets a reference to the given common.NullableTime and assigns it to the Deleted field. +func (o *Monitor) SetDeleted(v time.Time) { + o.Deleted.Set(&v) +} + +// SetDeletedNil sets the value for Deleted to be an explicit nil. +func (o *Monitor) SetDeletedNil() { + o.Deleted.Set(nil) +} + +// UnsetDeleted ensures that no value is present for Deleted, not even an explicit nil. +func (o *Monitor) UnsetDeleted() { + o.Deleted.Unset() +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Monitor) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Monitor) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Monitor) SetId(v int64) { + o.Id = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Monitor) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *Monitor) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Monitor) SetMessage(v string) { + o.Message = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *Monitor) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *Monitor) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *Monitor) SetModified(v time.Time) { + o.Modified = &v +} + +// GetMulti returns the Multi field value if set, zero value otherwise. +func (o *Monitor) GetMulti() bool { + if o == nil || o.Multi == nil { + var ret bool + return ret + } + return *o.Multi +} + +// GetMultiOk returns a tuple with the Multi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetMultiOk() (*bool, bool) { + if o == nil || o.Multi == nil { + return nil, false + } + return o.Multi, true +} + +// HasMulti returns a boolean if a field has been set. +func (o *Monitor) HasMulti() bool { + if o != nil && o.Multi != nil { + return true + } + + return false +} + +// SetMulti gets a reference to the given bool and assigns it to the Multi field. +func (o *Monitor) SetMulti(v bool) { + o.Multi = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Monitor) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Monitor) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Monitor) SetName(v string) { + o.Name = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *Monitor) GetOptions() MonitorOptions { + if o == nil || o.Options == nil { + var ret MonitorOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetOptionsOk() (*MonitorOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *Monitor) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given MonitorOptions and assigns it to the Options field. +func (o *Monitor) SetOptions(v MonitorOptions) { + o.Options = &v +} + +// GetOverallState returns the OverallState field value if set, zero value otherwise. +func (o *Monitor) GetOverallState() MonitorOverallStates { + if o == nil || o.OverallState == nil { + var ret MonitorOverallStates + return ret + } + return *o.OverallState +} + +// GetOverallStateOk returns a tuple with the OverallState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetOverallStateOk() (*MonitorOverallStates, bool) { + if o == nil || o.OverallState == nil { + return nil, false + } + return o.OverallState, true +} + +// HasOverallState returns a boolean if a field has been set. +func (o *Monitor) HasOverallState() bool { + if o != nil && o.OverallState != nil { + return true + } + + return false +} + +// SetOverallState gets a reference to the given MonitorOverallStates and assigns it to the OverallState field. +func (o *Monitor) SetOverallState(v MonitorOverallStates) { + o.OverallState = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Monitor) GetPriority() int64 { + if o == nil || o.Priority.Get() == nil { + var ret int64 + return ret + } + return *o.Priority.Get() +} + +// GetPriorityOk returns a tuple with the Priority 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 *Monitor) GetPriorityOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Priority.Get(), o.Priority.IsSet() +} + +// HasPriority returns a boolean if a field has been set. +func (o *Monitor) HasPriority() bool { + if o != nil && o.Priority.IsSet() { + return true + } + + return false +} + +// SetPriority gets a reference to the given common.NullableInt64 and assigns it to the Priority field. +func (o *Monitor) SetPriority(v int64) { + o.Priority.Set(&v) +} + +// SetPriorityNil sets the value for Priority to be an explicit nil. +func (o *Monitor) SetPriorityNil() { + o.Priority.Set(nil) +} + +// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. +func (o *Monitor) UnsetPriority() { + o.Priority.Unset() +} + +// GetQuery returns the Query field value. +func (o *Monitor) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *Monitor) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *Monitor) SetQuery(v string) { + o.Query = v +} + +// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Monitor) GetRestrictedRoles() []string { + if o == nil { + var ret []string + return ret + } + return o.RestrictedRoles +} + +// GetRestrictedRolesOk returns a tuple with the RestrictedRoles 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 *Monitor) GetRestrictedRolesOk() (*[]string, bool) { + if o == nil || o.RestrictedRoles == nil { + return nil, false + } + return &o.RestrictedRoles, true +} + +// HasRestrictedRoles returns a boolean if a field has been set. +func (o *Monitor) HasRestrictedRoles() bool { + if o != nil && o.RestrictedRoles != nil { + return true + } + + return false +} + +// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. +func (o *Monitor) SetRestrictedRoles(v []string) { + o.RestrictedRoles = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Monitor) GetState() MonitorState { + if o == nil || o.State == nil { + var ret MonitorState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Monitor) GetStateOk() (*MonitorState, bool) { + if o == nil || o.State == nil { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Monitor) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + +// SetState gets a reference to the given MonitorState and assigns it to the State field. +func (o *Monitor) SetState(v MonitorState) { + o.State = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Monitor) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *Monitor) GetTagsOk() (*[]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 *Monitor) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Monitor) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value. +func (o *Monitor) GetType() MonitorType { + if o == nil { + var ret MonitorType + 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 *Monitor) GetTypeOk() (*MonitorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *Monitor) SetType(v MonitorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Monitor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.Deleted.IsSet() { + toSerialize["deleted"] = o.Deleted.Get() + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Multi != nil { + toSerialize["multi"] = o.Multi + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.OverallState != nil { + toSerialize["overall_state"] = o.OverallState + } + if o.Priority.IsSet() { + toSerialize["priority"] = o.Priority.Get() + } + toSerialize["query"] = o.Query + if o.RestrictedRoles != nil { + toSerialize["restricted_roles"] = o.RestrictedRoles + } + if o.State != nil { + toSerialize["state"] = o.State + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + Type *MonitorType `json:"type"` + }{} + all := struct { + Created *time.Time `json:"created,omitempty"` + Creator *Creator `json:"creator,omitempty"` + Deleted common.NullableTime `json:"deleted,omitempty"` + Id *int64 `json:"id,omitempty"` + Message *string `json:"message,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Multi *bool `json:"multi,omitempty"` + Name *string `json:"name,omitempty"` + Options *MonitorOptions `json:"options,omitempty"` + OverallState *MonitorOverallStates `json:"overall_state,omitempty"` + Priority common.NullableInt64 `json:"priority,omitempty"` + Query string `json:"query"` + RestrictedRoles []string `json:"restricted_roles,omitempty"` + State *MonitorState `json:"state,omitempty"` + Tags []string `json:"tags,omitempty"` + Type MonitorType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.OverallState; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Created = all.Created + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.Deleted = all.Deleted + o.Id = all.Id + o.Message = all.Message + o.Modified = all.Modified + o.Multi = all.Multi + o.Name = all.Name + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.OverallState = all.OverallState + o.Priority = all.Priority + o.Query = all.Query + o.RestrictedRoles = all.RestrictedRoles + if all.State != nil && all.State.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.State = all.State + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_monitor_device_id.go b/api/v1/datadog/model_monitor_device_id.go new file mode 100644 index 00000000000..98eab25df61 --- /dev/null +++ b/api/v1/datadog/model_monitor_device_id.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorDeviceID ID of the device the Synthetics monitor is running on. Same as `SyntheticsDeviceID`. +type MonitorDeviceID string + +// List of MonitorDeviceID. +const ( + MONITORDEVICEID_LAPTOP_LARGE MonitorDeviceID = "laptop_large" + MONITORDEVICEID_TABLET MonitorDeviceID = "tablet" + MONITORDEVICEID_MOBILE_SMALL MonitorDeviceID = "mobile_small" + MONITORDEVICEID_CHROME_LAPTOP_LARGE MonitorDeviceID = "chrome.laptop_large" + MONITORDEVICEID_CHROME_TABLET MonitorDeviceID = "chrome.tablet" + MONITORDEVICEID_CHROME_MOBILE_SMALL MonitorDeviceID = "chrome.mobile_small" + MONITORDEVICEID_FIREFOX_LAPTOP_LARGE MonitorDeviceID = "firefox.laptop_large" + MONITORDEVICEID_FIREFOX_TABLET MonitorDeviceID = "firefox.tablet" + MONITORDEVICEID_FIREFOX_MOBILE_SMALL MonitorDeviceID = "firefox.mobile_small" +) + +var allowedMonitorDeviceIDEnumValues = []MonitorDeviceID{ + MONITORDEVICEID_LAPTOP_LARGE, + MONITORDEVICEID_TABLET, + MONITORDEVICEID_MOBILE_SMALL, + MONITORDEVICEID_CHROME_LAPTOP_LARGE, + MONITORDEVICEID_CHROME_TABLET, + MONITORDEVICEID_CHROME_MOBILE_SMALL, + MONITORDEVICEID_FIREFOX_LAPTOP_LARGE, + MONITORDEVICEID_FIREFOX_TABLET, + MONITORDEVICEID_FIREFOX_MOBILE_SMALL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorDeviceID) GetAllowedValues() []MonitorDeviceID { + return allowedMonitorDeviceIDEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorDeviceID) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorDeviceID(value) + return nil +} + +// NewMonitorDeviceIDFromValue returns a pointer to a valid MonitorDeviceID +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorDeviceIDFromValue(v string) (*MonitorDeviceID, error) { + ev := MonitorDeviceID(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorDeviceID: valid values are %v", v, allowedMonitorDeviceIDEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorDeviceID) IsValid() bool { + for _, existing := range allowedMonitorDeviceIDEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorDeviceID value. +func (v MonitorDeviceID) Ptr() *MonitorDeviceID { + return &v +} + +// NullableMonitorDeviceID handles when a null is used for MonitorDeviceID. +type NullableMonitorDeviceID struct { + value *MonitorDeviceID + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorDeviceID) Get() *MonitorDeviceID { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorDeviceID) Set(val *MonitorDeviceID) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorDeviceID) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonitorDeviceID) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorDeviceID initializes the struct as if Set has been called. +func NewNullableMonitorDeviceID(val *MonitorDeviceID) *NullableMonitorDeviceID { + return &NullableMonitorDeviceID{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorDeviceID) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorDeviceID) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go b/api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go new file mode 100644 index 00000000000..230c8e3f186 --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_event_aggregation.go @@ -0,0 +1,129 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorFormulaAndFunctionEventAggregation Aggregation methods for event platform queries. +type MonitorFormulaAndFunctionEventAggregation string + +// List of MonitorFormulaAndFunctionEventAggregation. +const ( + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_COUNT MonitorFormulaAndFunctionEventAggregation = "count" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY MonitorFormulaAndFunctionEventAggregation = "cardinality" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN MonitorFormulaAndFunctionEventAggregation = "median" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC75 MonitorFormulaAndFunctionEventAggregation = "pc75" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC90 MonitorFormulaAndFunctionEventAggregation = "pc90" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC95 MonitorFormulaAndFunctionEventAggregation = "pc95" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC98 MonitorFormulaAndFunctionEventAggregation = "pc98" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC99 MonitorFormulaAndFunctionEventAggregation = "pc99" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_SUM MonitorFormulaAndFunctionEventAggregation = "sum" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MIN MonitorFormulaAndFunctionEventAggregation = "min" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MAX MonitorFormulaAndFunctionEventAggregation = "max" + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_AVG MonitorFormulaAndFunctionEventAggregation = "avg" +) + +var allowedMonitorFormulaAndFunctionEventAggregationEnumValues = []MonitorFormulaAndFunctionEventAggregation{ + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_COUNT, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_CARDINALITY, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MEDIAN, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC75, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC90, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC95, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC98, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_PC99, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_SUM, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MIN, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_MAX, + MONITORFORMULAANDFUNCTIONEVENTAGGREGATION_AVG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorFormulaAndFunctionEventAggregation) GetAllowedValues() []MonitorFormulaAndFunctionEventAggregation { + return allowedMonitorFormulaAndFunctionEventAggregationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorFormulaAndFunctionEventAggregation(value) + return nil +} + +// NewMonitorFormulaAndFunctionEventAggregationFromValue returns a pointer to a valid MonitorFormulaAndFunctionEventAggregation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorFormulaAndFunctionEventAggregationFromValue(v string) (*MonitorFormulaAndFunctionEventAggregation, error) { + ev := MonitorFormulaAndFunctionEventAggregation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorFormulaAndFunctionEventAggregation: valid values are %v", v, allowedMonitorFormulaAndFunctionEventAggregationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorFormulaAndFunctionEventAggregation) IsValid() bool { + for _, existing := range allowedMonitorFormulaAndFunctionEventAggregationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorFormulaAndFunctionEventAggregation value. +func (v MonitorFormulaAndFunctionEventAggregation) Ptr() *MonitorFormulaAndFunctionEventAggregation { + return &v +} + +// NullableMonitorFormulaAndFunctionEventAggregation handles when a null is used for MonitorFormulaAndFunctionEventAggregation. +type NullableMonitorFormulaAndFunctionEventAggregation struct { + value *MonitorFormulaAndFunctionEventAggregation + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorFormulaAndFunctionEventAggregation) Get() *MonitorFormulaAndFunctionEventAggregation { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorFormulaAndFunctionEventAggregation) Set(val *MonitorFormulaAndFunctionEventAggregation) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorFormulaAndFunctionEventAggregation) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonitorFormulaAndFunctionEventAggregation) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorFormulaAndFunctionEventAggregation initializes the struct as if Set has been called. +func NewNullableMonitorFormulaAndFunctionEventAggregation(val *MonitorFormulaAndFunctionEventAggregation) *NullableMonitorFormulaAndFunctionEventAggregation { + return &NullableMonitorFormulaAndFunctionEventAggregation{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorFormulaAndFunctionEventAggregation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorFormulaAndFunctionEventAggregation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go new file mode 100644 index 00000000000..d9071036b9a --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition.go @@ -0,0 +1,308 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorFormulaAndFunctionEventQueryDefinition A formula and functions events query. +type MonitorFormulaAndFunctionEventQueryDefinition struct { + // Compute options. + Compute MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` + // Data source for event platform-based queries. + DataSource MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` + // Group by options. + GroupBy []MonitorFormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` + // An array of index names to query in the stream. Omit or use `[]` to query all indexes at once. + Indexes []string `json:"indexes,omitempty"` + // Name of the query for use in formulas. + Name string `json:"name"` + // Search options. + Search *MonitorFormulaAndFunctionEventQueryDefinitionSearch `json:"search,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{} +} + +// NewMonitorFormulaAndFunctionEventQueryDefinition instantiates a new MonitorFormulaAndFunctionEventQueryDefinition 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 NewMonitorFormulaAndFunctionEventQueryDefinition(compute MonitorFormulaAndFunctionEventQueryDefinitionCompute, dataSource MonitorFormulaAndFunctionEventsDataSource, name string) *MonitorFormulaAndFunctionEventQueryDefinition { + this := MonitorFormulaAndFunctionEventQueryDefinition{} + this.Compute = compute + this.DataSource = dataSource + this.Name = name + return &this +} + +// NewMonitorFormulaAndFunctionEventQueryDefinitionWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryDefinition 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 NewMonitorFormulaAndFunctionEventQueryDefinitionWithDefaults() *MonitorFormulaAndFunctionEventQueryDefinition { + this := MonitorFormulaAndFunctionEventQueryDefinition{} + return &this +} + +// GetCompute returns the Compute field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetCompute() MonitorFormulaAndFunctionEventQueryDefinitionCompute { + if o == nil { + var ret MonitorFormulaAndFunctionEventQueryDefinitionCompute + return ret + } + return o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetComputeOk() (*MonitorFormulaAndFunctionEventQueryDefinitionCompute, bool) { + if o == nil { + return nil, false + } + return &o.Compute, true +} + +// SetCompute sets field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetCompute(v MonitorFormulaAndFunctionEventQueryDefinitionCompute) { + o.Compute = v +} + +// GetDataSource returns the DataSource field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetDataSource() MonitorFormulaAndFunctionEventsDataSource { + if o == nil { + var ret MonitorFormulaAndFunctionEventsDataSource + return ret + } + return o.DataSource +} + +// GetDataSourceOk returns a tuple with the DataSource field value +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetDataSourceOk() (*MonitorFormulaAndFunctionEventsDataSource, bool) { + if o == nil { + return nil, false + } + return &o.DataSource, true +} + +// SetDataSource sets field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetDataSource(v MonitorFormulaAndFunctionEventsDataSource) { + o.DataSource = v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetGroupBy() []MonitorFormulaAndFunctionEventQueryGroupBy { + if o == nil || o.GroupBy == nil { + var ret []MonitorFormulaAndFunctionEventQueryGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetGroupByOk() (*[]MonitorFormulaAndFunctionEventQueryGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []MonitorFormulaAndFunctionEventQueryGroupBy and assigns it to the GroupBy field. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetGroupBy(v []MonitorFormulaAndFunctionEventQueryGroupBy) { + o.GroupBy = v +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetIndexes() []string { + if o == nil || o.Indexes == nil { + var ret []string + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetIndexesOk() (*[]string, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) HasIndexes() bool { + if o != nil && o.Indexes != nil { + return true + } + + return false +} + +// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetIndexes(v []string) { + o.Indexes = v +} + +// GetName returns the Name field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetName(v string) { + o.Name = v +} + +// GetSearch returns the Search field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetSearch() MonitorFormulaAndFunctionEventQueryDefinitionSearch { + if o == nil || o.Search == nil { + var ret MonitorFormulaAndFunctionEventQueryDefinitionSearch + return ret + } + return *o.Search +} + +// GetSearchOk returns a tuple with the Search field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) GetSearchOk() (*MonitorFormulaAndFunctionEventQueryDefinitionSearch, bool) { + if o == nil || o.Search == nil { + return nil, false + } + return o.Search, true +} + +// HasSearch returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) HasSearch() bool { + if o != nil && o.Search != nil { + return true + } + + return false +} + +// SetSearch gets a reference to the given MonitorFormulaAndFunctionEventQueryDefinitionSearch and assigns it to the Search field. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) SetSearch(v MonitorFormulaAndFunctionEventQueryDefinitionSearch) { + o.Search = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorFormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["compute"] = o.Compute + toSerialize["data_source"] = o.DataSource + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + toSerialize["name"] = o.Name + if o.Search != nil { + toSerialize["search"] = o.Search + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Compute *MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` + DataSource *MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` + Name *string `json:"name"` + }{} + all := struct { + Compute MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` + DataSource MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` + GroupBy []MonitorFormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` + Indexes []string `json:"indexes,omitempty"` + Name string `json:"name"` + Search *MonitorFormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Compute == nil { + return fmt.Errorf("Required field compute missing") + } + if required.DataSource == nil { + return fmt.Errorf("Required field data_source missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DataSource; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Compute = all.Compute + o.DataSource = all.DataSource + o.GroupBy = all.GroupBy + o.Indexes = all.Indexes + o.Name = all.Name + if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Search = all.Search + return nil +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go new file mode 100644 index 00000000000..1767e165213 --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_compute.go @@ -0,0 +1,189 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorFormulaAndFunctionEventQueryDefinitionCompute Compute options. +type MonitorFormulaAndFunctionEventQueryDefinitionCompute struct { + // Aggregation methods for event platform queries. + Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + // A time interval in milliseconds. + Interval *int64 `json:"interval,omitempty"` + // Measurable attribute to compute. + Metric *string `json:"metric,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{} +} + +// NewMonitorFormulaAndFunctionEventQueryDefinitionCompute instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionCompute 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 NewMonitorFormulaAndFunctionEventQueryDefinitionCompute(aggregation MonitorFormulaAndFunctionEventAggregation) *MonitorFormulaAndFunctionEventQueryDefinitionCompute { + this := MonitorFormulaAndFunctionEventQueryDefinitionCompute{} + this.Aggregation = aggregation + return &this +} + +// NewMonitorFormulaAndFunctionEventQueryDefinitionComputeWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionCompute 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 NewMonitorFormulaAndFunctionEventQueryDefinitionComputeWithDefaults() *MonitorFormulaAndFunctionEventQueryDefinitionCompute { + this := MonitorFormulaAndFunctionEventQueryDefinitionCompute{} + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetAggregation() MonitorFormulaAndFunctionEventAggregation { + if o == nil { + var ret MonitorFormulaAndFunctionEventAggregation + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetAggregationOk() (*MonitorFormulaAndFunctionEventAggregation, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) SetAggregation(v MonitorFormulaAndFunctionEventAggregation) { + o.Aggregation = v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetInterval() int64 { + if o == nil || o.Interval == nil { + var ret int64 + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetIntervalOk() (*int64, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given int64 and assigns it to the Interval field. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) SetInterval(v int64) { + o.Interval = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) SetMetric(v string) { + o.Metric = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorFormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + }{} + all := struct { + Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + Interval *int64 `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Interval = all.Interval + o.Metric = all.Metric + return nil +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go new file mode 100644 index 00000000000..58de556db15 --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_event_query_definition_search.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorFormulaAndFunctionEventQueryDefinitionSearch Search options. +type MonitorFormulaAndFunctionEventQueryDefinitionSearch struct { + // Events search string. + Query string `json:"query"` + // 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{} +} + +// NewMonitorFormulaAndFunctionEventQueryDefinitionSearch instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionSearch 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 NewMonitorFormulaAndFunctionEventQueryDefinitionSearch(query string) *MonitorFormulaAndFunctionEventQueryDefinitionSearch { + this := MonitorFormulaAndFunctionEventQueryDefinitionSearch{} + this.Query = query + return &this +} + +// NewMonitorFormulaAndFunctionEventQueryDefinitionSearchWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryDefinitionSearch 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 NewMonitorFormulaAndFunctionEventQueryDefinitionSearchWithDefaults() *MonitorFormulaAndFunctionEventQueryDefinitionSearch { + this := MonitorFormulaAndFunctionEventQueryDefinitionSearch{} + return &this +} + +// GetQuery returns the Query field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorFormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + }{} + all := struct { + Query string `json:"query"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + return nil +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go new file mode 100644 index 00000000000..05a7b6877df --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorFormulaAndFunctionEventQueryGroupBy List of objects used to group by. +type MonitorFormulaAndFunctionEventQueryGroupBy struct { + // Event facet. + Facet string `json:"facet"` + // Number of groups to return. + Limit *int64 `json:"limit,omitempty"` + // Options for sorting group by results. + Sort *MonitorFormulaAndFunctionEventQueryGroupBySort `json:"sort,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{} +} + +// NewMonitorFormulaAndFunctionEventQueryGroupBy instantiates a new MonitorFormulaAndFunctionEventQueryGroupBy 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 NewMonitorFormulaAndFunctionEventQueryGroupBy(facet string) *MonitorFormulaAndFunctionEventQueryGroupBy { + this := MonitorFormulaAndFunctionEventQueryGroupBy{} + this.Facet = facet + return &this +} + +// NewMonitorFormulaAndFunctionEventQueryGroupByWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryGroupBy 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 NewMonitorFormulaAndFunctionEventQueryGroupByWithDefaults() *MonitorFormulaAndFunctionEventQueryGroupBy { + this := MonitorFormulaAndFunctionEventQueryGroupBy{} + return &this +} + +// GetFacet returns the Facet field value. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) SetFacet(v string) { + o.Facet = v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) SetLimit(v int64) { + o.Limit = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetSort() MonitorFormulaAndFunctionEventQueryGroupBySort { + if o == nil || o.Sort == nil { + var ret MonitorFormulaAndFunctionEventQueryGroupBySort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) GetSortOk() (*MonitorFormulaAndFunctionEventQueryGroupBySort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given MonitorFormulaAndFunctionEventQueryGroupBySort and assigns it to the Sort field. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) SetSort(v MonitorFormulaAndFunctionEventQueryGroupBySort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorFormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorFormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Facet *string `json:"facet"` + }{} + all := struct { + Facet string `json:"facet"` + Limit *int64 `json:"limit,omitempty"` + Sort *MonitorFormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Facet == nil { + return fmt.Errorf("Required field facet missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Facet = all.Facet + o.Limit = all.Limit + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Sort = all.Sort + return nil +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go b/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go new file mode 100644 index 00000000000..9f911df39e1 --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_event_query_group_by_sort.go @@ -0,0 +1,201 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorFormulaAndFunctionEventQueryGroupBySort Options for sorting group by results. +type MonitorFormulaAndFunctionEventQueryGroupBySort struct { + // Aggregation methods for event platform queries. + Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + // Metric used for sorting group by results. + Metric *string `json:"metric,omitempty"` + // Direction of sort. + Order *QuerySortOrder `json:"order,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{} +} + +// NewMonitorFormulaAndFunctionEventQueryGroupBySort instantiates a new MonitorFormulaAndFunctionEventQueryGroupBySort 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 NewMonitorFormulaAndFunctionEventQueryGroupBySort(aggregation MonitorFormulaAndFunctionEventAggregation) *MonitorFormulaAndFunctionEventQueryGroupBySort { + this := MonitorFormulaAndFunctionEventQueryGroupBySort{} + this.Aggregation = aggregation + var order QuerySortOrder = QUERYSORTORDER_DESC + this.Order = &order + return &this +} + +// NewMonitorFormulaAndFunctionEventQueryGroupBySortWithDefaults instantiates a new MonitorFormulaAndFunctionEventQueryGroupBySort 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 NewMonitorFormulaAndFunctionEventQueryGroupBySortWithDefaults() *MonitorFormulaAndFunctionEventQueryGroupBySort { + this := MonitorFormulaAndFunctionEventQueryGroupBySort{} + var order QuerySortOrder = QUERYSORTORDER_DESC + this.Order = &order + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetAggregation() MonitorFormulaAndFunctionEventAggregation { + if o == nil { + var ret MonitorFormulaAndFunctionEventAggregation + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetAggregationOk() (*MonitorFormulaAndFunctionEventAggregation, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) SetAggregation(v MonitorFormulaAndFunctionEventAggregation) { + o.Aggregation = v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) SetMetric(v string) { + o.Metric = &v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetOrder() QuerySortOrder { + if o == nil || o.Order == nil { + var ret QuerySortOrder + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) GetOrderOk() (*QuerySortOrder, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) HasOrder() bool { + if o != nil && o.Order != nil { + return true + } + + return false +} + +// SetOrder gets a reference to the given QuerySortOrder and assigns it to the Order field. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) SetOrder(v QuerySortOrder) { + o.Order = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorFormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Order != nil { + toSerialize["order"] = o.Order + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + }{} + all := struct { + Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + Metric *string `json:"metric,omitempty"` + Order *QuerySortOrder `json:"order,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Metric = all.Metric + o.Order = all.Order + return nil +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_events_data_source.go b/api/v1/datadog/model_monitor_formula_and_function_events_data_source.go new file mode 100644 index 00000000000..14138579c75 --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_events_data_source.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorFormulaAndFunctionEventsDataSource Data source for event platform-based queries. +type MonitorFormulaAndFunctionEventsDataSource string + +// List of MonitorFormulaAndFunctionEventsDataSource. +const ( + MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_RUM MonitorFormulaAndFunctionEventsDataSource = "rum" + MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_PIPELINES MonitorFormulaAndFunctionEventsDataSource = "ci_pipelines" + MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_TESTS MonitorFormulaAndFunctionEventsDataSource = "ci_tests" +) + +var allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues = []MonitorFormulaAndFunctionEventsDataSource{ + MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_RUM, + MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_PIPELINES, + MONITORFORMULAANDFUNCTIONEVENTSDATASOURCE_CI_TESTS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorFormulaAndFunctionEventsDataSource) GetAllowedValues() []MonitorFormulaAndFunctionEventsDataSource { + return allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorFormulaAndFunctionEventsDataSource(value) + return nil +} + +// NewMonitorFormulaAndFunctionEventsDataSourceFromValue returns a pointer to a valid MonitorFormulaAndFunctionEventsDataSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorFormulaAndFunctionEventsDataSourceFromValue(v string) (*MonitorFormulaAndFunctionEventsDataSource, error) { + ev := MonitorFormulaAndFunctionEventsDataSource(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorFormulaAndFunctionEventsDataSource: valid values are %v", v, allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorFormulaAndFunctionEventsDataSource) IsValid() bool { + for _, existing := range allowedMonitorFormulaAndFunctionEventsDataSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorFormulaAndFunctionEventsDataSource value. +func (v MonitorFormulaAndFunctionEventsDataSource) Ptr() *MonitorFormulaAndFunctionEventsDataSource { + return &v +} + +// NullableMonitorFormulaAndFunctionEventsDataSource handles when a null is used for MonitorFormulaAndFunctionEventsDataSource. +type NullableMonitorFormulaAndFunctionEventsDataSource struct { + value *MonitorFormulaAndFunctionEventsDataSource + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorFormulaAndFunctionEventsDataSource) Get() *MonitorFormulaAndFunctionEventsDataSource { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorFormulaAndFunctionEventsDataSource) Set(val *MonitorFormulaAndFunctionEventsDataSource) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorFormulaAndFunctionEventsDataSource) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonitorFormulaAndFunctionEventsDataSource) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorFormulaAndFunctionEventsDataSource initializes the struct as if Set has been called. +func NewNullableMonitorFormulaAndFunctionEventsDataSource(val *MonitorFormulaAndFunctionEventsDataSource) *NullableMonitorFormulaAndFunctionEventsDataSource { + return &NullableMonitorFormulaAndFunctionEventsDataSource{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorFormulaAndFunctionEventsDataSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorFormulaAndFunctionEventsDataSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_formula_and_function_query_definition.go b/api/v1/datadog/model_monitor_formula_and_function_query_definition.go new file mode 100644 index 00000000000..eb16faddbdd --- /dev/null +++ b/api/v1/datadog/model_monitor_formula_and_function_query_definition.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorFormulaAndFunctionQueryDefinition - A formula and function query. +type MonitorFormulaAndFunctionQueryDefinition struct { + MonitorFormulaAndFunctionEventQueryDefinition *MonitorFormulaAndFunctionEventQueryDefinition + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// MonitorFormulaAndFunctionEventQueryDefinitionAsMonitorFormulaAndFunctionQueryDefinition is a convenience function that returns MonitorFormulaAndFunctionEventQueryDefinition wrapped in MonitorFormulaAndFunctionQueryDefinition. +func MonitorFormulaAndFunctionEventQueryDefinitionAsMonitorFormulaAndFunctionQueryDefinition(v *MonitorFormulaAndFunctionEventQueryDefinition) MonitorFormulaAndFunctionQueryDefinition { + return MonitorFormulaAndFunctionQueryDefinition{MonitorFormulaAndFunctionEventQueryDefinition: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *MonitorFormulaAndFunctionQueryDefinition) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into MonitorFormulaAndFunctionEventQueryDefinition + err = json.Unmarshal(data, &obj.MonitorFormulaAndFunctionEventQueryDefinition) + if err == nil { + if obj.MonitorFormulaAndFunctionEventQueryDefinition != nil && obj.MonitorFormulaAndFunctionEventQueryDefinition.UnparsedObject == nil { + jsonMonitorFormulaAndFunctionEventQueryDefinition, _ := json.Marshal(obj.MonitorFormulaAndFunctionEventQueryDefinition) + if string(jsonMonitorFormulaAndFunctionEventQueryDefinition) == "{}" { // empty struct + obj.MonitorFormulaAndFunctionEventQueryDefinition = nil + } else { + match++ + } + } else { + obj.MonitorFormulaAndFunctionEventQueryDefinition = nil + } + } else { + obj.MonitorFormulaAndFunctionEventQueryDefinition = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.MonitorFormulaAndFunctionEventQueryDefinition = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj MonitorFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { + if obj.MonitorFormulaAndFunctionEventQueryDefinition != nil { + return json.Marshal(&obj.MonitorFormulaAndFunctionEventQueryDefinition) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *MonitorFormulaAndFunctionQueryDefinition) GetActualInstance() interface{} { + if obj.MonitorFormulaAndFunctionEventQueryDefinition != nil { + return obj.MonitorFormulaAndFunctionEventQueryDefinition + } + + // all schemas are nil + return nil +} + +// NullableMonitorFormulaAndFunctionQueryDefinition handles when a null is used for MonitorFormulaAndFunctionQueryDefinition. +type NullableMonitorFormulaAndFunctionQueryDefinition struct { + value *MonitorFormulaAndFunctionQueryDefinition + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorFormulaAndFunctionQueryDefinition) Get() *MonitorFormulaAndFunctionQueryDefinition { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorFormulaAndFunctionQueryDefinition) Set(val *MonitorFormulaAndFunctionQueryDefinition) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorFormulaAndFunctionQueryDefinition) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableMonitorFormulaAndFunctionQueryDefinition) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorFormulaAndFunctionQueryDefinition initializes the struct as if Set has been called. +func NewNullableMonitorFormulaAndFunctionQueryDefinition(val *MonitorFormulaAndFunctionQueryDefinition) *NullableMonitorFormulaAndFunctionQueryDefinition { + return &NullableMonitorFormulaAndFunctionQueryDefinition{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorFormulaAndFunctionQueryDefinition) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorFormulaAndFunctionQueryDefinition) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_group_search_response.go b/api/v1/datadog/model_monitor_group_search_response.go new file mode 100644 index 00000000000..16373963d6f --- /dev/null +++ b/api/v1/datadog/model_monitor_group_search_response.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorGroupSearchResponse The response of a monitor group search. +type MonitorGroupSearchResponse struct { + // The counts of monitor groups per different criteria. + Counts *MonitorGroupSearchResponseCounts `json:"counts,omitempty"` + // The list of found monitor groups. + Groups []MonitorGroupSearchResult `json:"groups,omitempty"` + // Metadata about the response. + Metadata *MonitorSearchResponseMetadata `json:"metadata,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{} +} + +// NewMonitorGroupSearchResponse instantiates a new MonitorGroupSearchResponse 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 NewMonitorGroupSearchResponse() *MonitorGroupSearchResponse { + this := MonitorGroupSearchResponse{} + return &this +} + +// NewMonitorGroupSearchResponseWithDefaults instantiates a new MonitorGroupSearchResponse 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 NewMonitorGroupSearchResponseWithDefaults() *MonitorGroupSearchResponse { + this := MonitorGroupSearchResponse{} + return &this +} + +// GetCounts returns the Counts field value if set, zero value otherwise. +func (o *MonitorGroupSearchResponse) GetCounts() MonitorGroupSearchResponseCounts { + if o == nil || o.Counts == nil { + var ret MonitorGroupSearchResponseCounts + return ret + } + return *o.Counts +} + +// GetCountsOk returns a tuple with the Counts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResponse) GetCountsOk() (*MonitorGroupSearchResponseCounts, bool) { + if o == nil || o.Counts == nil { + return nil, false + } + return o.Counts, true +} + +// HasCounts returns a boolean if a field has been set. +func (o *MonitorGroupSearchResponse) HasCounts() bool { + if o != nil && o.Counts != nil { + return true + } + + return false +} + +// SetCounts gets a reference to the given MonitorGroupSearchResponseCounts and assigns it to the Counts field. +func (o *MonitorGroupSearchResponse) SetCounts(v MonitorGroupSearchResponseCounts) { + o.Counts = &v +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *MonitorGroupSearchResponse) GetGroups() []MonitorGroupSearchResult { + if o == nil || o.Groups == nil { + var ret []MonitorGroupSearchResult + 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 *MonitorGroupSearchResponse) GetGroupsOk() (*[]MonitorGroupSearchResult, 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 *MonitorGroupSearchResponse) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + +// SetGroups gets a reference to the given []MonitorGroupSearchResult and assigns it to the Groups field. +func (o *MonitorGroupSearchResponse) SetGroups(v []MonitorGroupSearchResult) { + o.Groups = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *MonitorGroupSearchResponse) GetMetadata() MonitorSearchResponseMetadata { + if o == nil || o.Metadata == nil { + var ret MonitorSearchResponseMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResponse) GetMetadataOk() (*MonitorSearchResponseMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *MonitorGroupSearchResponse) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given MonitorSearchResponseMetadata and assigns it to the Metadata field. +func (o *MonitorGroupSearchResponse) SetMetadata(v MonitorSearchResponseMetadata) { + o.Metadata = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorGroupSearchResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Counts != nil { + toSerialize["counts"] = o.Counts + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorGroupSearchResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Counts *MonitorGroupSearchResponseCounts `json:"counts,omitempty"` + Groups []MonitorGroupSearchResult `json:"groups,omitempty"` + Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Counts != nil && all.Counts.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Counts = all.Counts + o.Groups = all.Groups + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + return nil +} diff --git a/api/v1/datadog/model_monitor_group_search_response_counts.go b/api/v1/datadog/model_monitor_group_search_response_counts.go new file mode 100644 index 00000000000..0c8cbb43248 --- /dev/null +++ b/api/v1/datadog/model_monitor_group_search_response_counts.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorGroupSearchResponseCounts The counts of monitor groups per different criteria. +type MonitorGroupSearchResponseCounts struct { + // Search facets. + Status []MonitorSearchCountItem `json:"status,omitempty"` + // Search facets. + Type []MonitorSearchCountItem `json:"type,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{} +} + +// NewMonitorGroupSearchResponseCounts instantiates a new MonitorGroupSearchResponseCounts 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 NewMonitorGroupSearchResponseCounts() *MonitorGroupSearchResponseCounts { + this := MonitorGroupSearchResponseCounts{} + return &this +} + +// NewMonitorGroupSearchResponseCountsWithDefaults instantiates a new MonitorGroupSearchResponseCounts 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 NewMonitorGroupSearchResponseCountsWithDefaults() *MonitorGroupSearchResponseCounts { + this := MonitorGroupSearchResponseCounts{} + return &this +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *MonitorGroupSearchResponseCounts) GetStatus() []MonitorSearchCountItem { + if o == nil || o.Status == nil { + var ret []MonitorSearchCountItem + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResponseCounts) GetStatusOk() (*[]MonitorSearchCountItem, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return &o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *MonitorGroupSearchResponseCounts) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given []MonitorSearchCountItem and assigns it to the Status field. +func (o *MonitorGroupSearchResponseCounts) SetStatus(v []MonitorSearchCountItem) { + o.Status = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MonitorGroupSearchResponseCounts) GetType() []MonitorSearchCountItem { + if o == nil || o.Type == nil { + var ret []MonitorSearchCountItem + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResponseCounts) GetTypeOk() (*[]MonitorSearchCountItem, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return &o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MonitorGroupSearchResponseCounts) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given []MonitorSearchCountItem and assigns it to the Type field. +func (o *MonitorGroupSearchResponseCounts) SetType(v []MonitorSearchCountItem) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorGroupSearchResponseCounts) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorGroupSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Status []MonitorSearchCountItem `json:"status,omitempty"` + Type []MonitorSearchCountItem `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Status = all.Status + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_monitor_group_search_result.go b/api/v1/datadog/model_monitor_group_search_result.go new file mode 100644 index 00000000000..f61fc85b6e7 --- /dev/null +++ b/api/v1/datadog/model_monitor_group_search_result.go @@ -0,0 +1,357 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonitorGroupSearchResult A single monitor group search result. +type MonitorGroupSearchResult struct { + // The name of the group. + Group *string `json:"group,omitempty"` + // The list of tags of the monitor group. + GroupTags []string `json:"group_tags,omitempty"` + // Latest timestamp the monitor group was in NO_DATA state. + LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` + // Latest timestamp the monitor group triggered. + LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` + // The ID of the monitor. + MonitorId *int64 `json:"monitor_id,omitempty"` + // The name of the monitor. + MonitorName *string `json:"monitor_name,omitempty"` + // The different states your monitor can be in. + Status *MonitorOverallStates `json:"status,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{} +} + +// NewMonitorGroupSearchResult instantiates a new MonitorGroupSearchResult 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 NewMonitorGroupSearchResult() *MonitorGroupSearchResult { + this := MonitorGroupSearchResult{} + return &this +} + +// NewMonitorGroupSearchResultWithDefaults instantiates a new MonitorGroupSearchResult 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 NewMonitorGroupSearchResultWithDefaults() *MonitorGroupSearchResult { + this := MonitorGroupSearchResult{} + return &this +} + +// GetGroup returns the Group field value if set, zero value otherwise. +func (o *MonitorGroupSearchResult) GetGroup() string { + if o == nil || o.Group == nil { + var ret string + return ret + } + return *o.Group +} + +// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResult) GetGroupOk() (*string, bool) { + if o == nil || o.Group == nil { + return nil, false + } + return o.Group, true +} + +// HasGroup returns a boolean if a field has been set. +func (o *MonitorGroupSearchResult) HasGroup() bool { + if o != nil && o.Group != nil { + return true + } + + return false +} + +// SetGroup gets a reference to the given string and assigns it to the Group field. +func (o *MonitorGroupSearchResult) SetGroup(v string) { + o.Group = &v +} + +// GetGroupTags returns the GroupTags field value if set, zero value otherwise. +func (o *MonitorGroupSearchResult) GetGroupTags() []string { + if o == nil || o.GroupTags == nil { + var ret []string + return ret + } + return o.GroupTags +} + +// GetGroupTagsOk returns a tuple with the GroupTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResult) GetGroupTagsOk() (*[]string, bool) { + if o == nil || o.GroupTags == nil { + return nil, false + } + return &o.GroupTags, true +} + +// HasGroupTags returns a boolean if a field has been set. +func (o *MonitorGroupSearchResult) HasGroupTags() bool { + if o != nil && o.GroupTags != nil { + return true + } + + return false +} + +// SetGroupTags gets a reference to the given []string and assigns it to the GroupTags field. +func (o *MonitorGroupSearchResult) SetGroupTags(v []string) { + o.GroupTags = v +} + +// GetLastNodataTs returns the LastNodataTs field value if set, zero value otherwise. +func (o *MonitorGroupSearchResult) GetLastNodataTs() int64 { + if o == nil || o.LastNodataTs == nil { + var ret int64 + return ret + } + return *o.LastNodataTs +} + +// GetLastNodataTsOk returns a tuple with the LastNodataTs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResult) GetLastNodataTsOk() (*int64, bool) { + if o == nil || o.LastNodataTs == nil { + return nil, false + } + return o.LastNodataTs, true +} + +// HasLastNodataTs returns a boolean if a field has been set. +func (o *MonitorGroupSearchResult) HasLastNodataTs() bool { + if o != nil && o.LastNodataTs != nil { + return true + } + + return false +} + +// SetLastNodataTs gets a reference to the given int64 and assigns it to the LastNodataTs field. +func (o *MonitorGroupSearchResult) SetLastNodataTs(v int64) { + o.LastNodataTs = &v +} + +// GetLastTriggeredTs returns the LastTriggeredTs field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorGroupSearchResult) GetLastTriggeredTs() int64 { + if o == nil || o.LastTriggeredTs.Get() == nil { + var ret int64 + return ret + } + return *o.LastTriggeredTs.Get() +} + +// GetLastTriggeredTsOk returns a tuple with the LastTriggeredTs 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 *MonitorGroupSearchResult) GetLastTriggeredTsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.LastTriggeredTs.Get(), o.LastTriggeredTs.IsSet() +} + +// HasLastTriggeredTs returns a boolean if a field has been set. +func (o *MonitorGroupSearchResult) HasLastTriggeredTs() bool { + if o != nil && o.LastTriggeredTs.IsSet() { + return true + } + + return false +} + +// SetLastTriggeredTs gets a reference to the given common.NullableInt64 and assigns it to the LastTriggeredTs field. +func (o *MonitorGroupSearchResult) SetLastTriggeredTs(v int64) { + o.LastTriggeredTs.Set(&v) +} + +// SetLastTriggeredTsNil sets the value for LastTriggeredTs to be an explicit nil. +func (o *MonitorGroupSearchResult) SetLastTriggeredTsNil() { + o.LastTriggeredTs.Set(nil) +} + +// UnsetLastTriggeredTs ensures that no value is present for LastTriggeredTs, not even an explicit nil. +func (o *MonitorGroupSearchResult) UnsetLastTriggeredTs() { + o.LastTriggeredTs.Unset() +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise. +func (o *MonitorGroupSearchResult) GetMonitorId() int64 { + if o == nil || o.MonitorId == nil { + var ret int64 + return ret + } + return *o.MonitorId +} + +// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResult) GetMonitorIdOk() (*int64, bool) { + if o == nil || o.MonitorId == nil { + return nil, false + } + return o.MonitorId, true +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *MonitorGroupSearchResult) HasMonitorId() bool { + if o != nil && o.MonitorId != nil { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. +func (o *MonitorGroupSearchResult) SetMonitorId(v int64) { + o.MonitorId = &v +} + +// GetMonitorName returns the MonitorName field value if set, zero value otherwise. +func (o *MonitorGroupSearchResult) GetMonitorName() string { + if o == nil || o.MonitorName == nil { + var ret string + return ret + } + return *o.MonitorName +} + +// GetMonitorNameOk returns a tuple with the MonitorName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResult) GetMonitorNameOk() (*string, bool) { + if o == nil || o.MonitorName == nil { + return nil, false + } + return o.MonitorName, true +} + +// HasMonitorName returns a boolean if a field has been set. +func (o *MonitorGroupSearchResult) HasMonitorName() bool { + if o != nil && o.MonitorName != nil { + return true + } + + return false +} + +// SetMonitorName gets a reference to the given string and assigns it to the MonitorName field. +func (o *MonitorGroupSearchResult) SetMonitorName(v string) { + o.MonitorName = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *MonitorGroupSearchResult) GetStatus() MonitorOverallStates { + if o == nil || o.Status == nil { + var ret MonitorOverallStates + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorGroupSearchResult) GetStatusOk() (*MonitorOverallStates, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *MonitorGroupSearchResult) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given MonitorOverallStates and assigns it to the Status field. +func (o *MonitorGroupSearchResult) SetStatus(v MonitorOverallStates) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorGroupSearchResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Group != nil { + toSerialize["group"] = o.Group + } + if o.GroupTags != nil { + toSerialize["group_tags"] = o.GroupTags + } + if o.LastNodataTs != nil { + toSerialize["last_nodata_ts"] = o.LastNodataTs + } + if o.LastTriggeredTs.IsSet() { + toSerialize["last_triggered_ts"] = o.LastTriggeredTs.Get() + } + if o.MonitorId != nil { + toSerialize["monitor_id"] = o.MonitorId + } + if o.MonitorName != nil { + toSerialize["monitor_name"] = o.MonitorName + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorGroupSearchResult) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Group *string `json:"group,omitempty"` + GroupTags []string `json:"group_tags,omitempty"` + LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` + LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` + MonitorId *int64 `json:"monitor_id,omitempty"` + MonitorName *string `json:"monitor_name,omitempty"` + Status *MonitorOverallStates `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Group = all.Group + o.GroupTags = all.GroupTags + o.LastNodataTs = all.LastNodataTs + o.LastTriggeredTs = all.LastTriggeredTs + o.MonitorId = all.MonitorId + o.MonitorName = all.MonitorName + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_monitor_options.go b/api/v1/datadog/model_monitor_options.go new file mode 100644 index 00000000000..5beca6b0cd3 --- /dev/null +++ b/api/v1/datadog/model_monitor_options.go @@ -0,0 +1,1248 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonitorOptions List of options associated with your monitor. +type MonitorOptions struct { + // Type of aggregation performed in the monitor query. + Aggregation *MonitorOptionsAggregation `json:"aggregation,omitempty"` + // IDs of the device the Synthetics monitor is running on. + // Deprecated + DeviceIds []MonitorDeviceID `json:"device_ids,omitempty"` + // Whether or not to send a log sample when the log monitor triggers. + EnableLogsSample *bool `json:"enable_logs_sample,omitempty"` + // We recommend using the [is_renotify](https://docs.datadoghq.com/monitors/notify/?tab=is_alert#renotify), + // block in the original message instead. + // A message to include with a re-notification. Supports the `@username` notification we allow elsewhere. + // Not applicable if `renotify_interval` is `None`. + EscalationMessage *string `json:"escalation_message,omitempty"` + // Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to `300` (5min), + // the timeframe is set to `last_5m` and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. + // This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation. + EvaluationDelay common.NullableInt64 `json:"evaluation_delay,omitempty"` + // Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold. + GroupbySimpleMonitor *bool `json:"groupby_simple_monitor,omitempty"` + // A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title. + // + // **Examples** + // - If `True`, `[Triggered on {host:h1}] Monitor Title` + // - If `False`, `[Triggered] Monitor Title` + IncludeTags *bool `json:"include_tags,omitempty"` + // Whether or not the monitor is locked (only editable by creator and admins). Use `restricted_roles` instead. + // Deprecated + Locked *bool `json:"locked,omitempty"` + // How long the test should be in failure before alerting (integer, number of seconds, max 7200). + MinFailureDuration common.NullableInt64 `json:"min_failure_duration,omitempty"` + // The minimum number of locations in failure at the same time during + // at least one moment in the `min_failure_duration` period (`min_location_failed` and `min_failure_duration` + // are part of the advanced alerting rules - integer, >= 1). + MinLocationFailed common.NullableInt64 `json:"min_location_failed,omitempty"` + // Time (in seconds) to skip evaluations for new groups. + // + // For example, this option can be used to skip evaluations for new hosts while they initialize. + // + // Must be a non negative integer. + NewGroupDelay common.NullableInt64 `json:"new_group_delay,omitempty"` + // Time (in seconds) to allow a host to boot and applications + // to fully start before starting the evaluation of monitor results. + // Should be a non negative integer. + // + // Use new_group_delay instead. + // Deprecated + NewHostDelay common.NullableInt64 `json:"new_host_delay,omitempty"` + // The number of minutes before a monitor notifies after data stops reporting. + // Datadog recommends at least 2x the monitor timeframe for query alerts or 2 minutes for service checks. + // If omitted, 2x the evaluation timeframe is used for query alerts, and 24 hours is used for service checks. + NoDataTimeframe common.NullableInt64 `json:"no_data_timeframe,omitempty"` + // A Boolean indicating whether tagged users is notified on changes to this monitor. + NotifyAudit *bool `json:"notify_audit,omitempty"` + // A Boolean indicating whether this monitor notifies when data stops reporting. + NotifyNoData *bool `json:"notify_no_data,omitempty"` + // The number of minutes after the last notification before a monitor re-notifies on the current status. + // It only re-notifies if it’s not resolved. + RenotifyInterval common.NullableInt64 `json:"renotify_interval,omitempty"` + // The number of times re-notification messages should be sent on the current status at the provided re-notification interval. + RenotifyOccurrences common.NullableInt64 `json:"renotify_occurrences,omitempty"` + // The types of monitor statuses for which re-notification messages are sent. + RenotifyStatuses []MonitorRenotifyStatusType `json:"renotify_statuses,omitempty"` + // A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. + // We highly recommend you set this to `false` for sparse metrics, + // otherwise some evaluations are skipped. Default is false. + RequireFullWindow *bool `json:"require_full_window,omitempty"` + // Information about the downtime applied to the monitor. + // Deprecated + Silenced map[string]int64 `json:"silenced,omitempty"` + // ID of the corresponding Synthetic check. + // Deprecated + SyntheticsCheckId common.NullableString `json:"synthetics_check_id,omitempty"` + // Alerting time window options. + ThresholdWindows *MonitorThresholdWindowOptions `json:"threshold_windows,omitempty"` + // List of the different monitor threshold available. + Thresholds *MonitorThresholds `json:"thresholds,omitempty"` + // The number of hours of the monitor not reporting data before it automatically resolves from a triggered state. The minimum allowed value is 0 hours. The maximum allowed value is 24 hours. + TimeoutH common.NullableInt64 `json:"timeout_h,omitempty"` + // List of requests that can be used in the monitor query. **This feature is currently in beta.** + Variables []MonitorFormulaAndFunctionQueryDefinition `json:"variables,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{} +} + +// NewMonitorOptions instantiates a new MonitorOptions 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 NewMonitorOptions() *MonitorOptions { + this := MonitorOptions{} + var escalationMessage string = "none" + this.EscalationMessage = &escalationMessage + var includeTags bool = true + this.IncludeTags = &includeTags + var minFailureDuration int64 = 0 + this.MinFailureDuration = *common.NewNullableInt64(&minFailureDuration) + var minLocationFailed int64 = 1 + this.MinLocationFailed = *common.NewNullableInt64(&minLocationFailed) + var newHostDelay int64 = 300 + this.NewHostDelay = *common.NewNullableInt64(&newHostDelay) + var notifyAudit bool = false + this.NotifyAudit = ¬ifyAudit + var notifyNoData bool = false + this.NotifyNoData = ¬ifyNoData + this.RenotifyInterval = *common.NewNullableInt64(nil) + this.TimeoutH = *common.NewNullableInt64(nil) + return &this +} + +// NewMonitorOptionsWithDefaults instantiates a new MonitorOptions 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 NewMonitorOptionsWithDefaults() *MonitorOptions { + this := MonitorOptions{} + var escalationMessage string = "none" + this.EscalationMessage = &escalationMessage + var includeTags bool = true + this.IncludeTags = &includeTags + var minFailureDuration int64 = 0 + this.MinFailureDuration = *common.NewNullableInt64(&minFailureDuration) + var minLocationFailed int64 = 1 + this.MinLocationFailed = *common.NewNullableInt64(&minLocationFailed) + var newHostDelay int64 = 300 + this.NewHostDelay = *common.NewNullableInt64(&newHostDelay) + var notifyAudit bool = false + this.NotifyAudit = ¬ifyAudit + var notifyNoData bool = false + this.NotifyNoData = ¬ifyNoData + this.RenotifyInterval = *common.NewNullableInt64(nil) + this.TimeoutH = *common.NewNullableInt64(nil) + return &this +} + +// GetAggregation returns the Aggregation field value if set, zero value otherwise. +func (o *MonitorOptions) GetAggregation() MonitorOptionsAggregation { + if o == nil || o.Aggregation == nil { + var ret MonitorOptionsAggregation + return ret + } + return *o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetAggregationOk() (*MonitorOptionsAggregation, bool) { + if o == nil || o.Aggregation == nil { + return nil, false + } + return o.Aggregation, true +} + +// HasAggregation returns a boolean if a field has been set. +func (o *MonitorOptions) HasAggregation() bool { + if o != nil && o.Aggregation != nil { + return true + } + + return false +} + +// SetAggregation gets a reference to the given MonitorOptionsAggregation and assigns it to the Aggregation field. +func (o *MonitorOptions) SetAggregation(v MonitorOptionsAggregation) { + o.Aggregation = &v +} + +// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise. +// Deprecated +func (o *MonitorOptions) GetDeviceIds() []MonitorDeviceID { + if o == nil || o.DeviceIds == nil { + var ret []MonitorDeviceID + return ret + } + return o.DeviceIds +} + +// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *MonitorOptions) GetDeviceIdsOk() (*[]MonitorDeviceID, bool) { + if o == nil || o.DeviceIds == nil { + return nil, false + } + return &o.DeviceIds, true +} + +// HasDeviceIds returns a boolean if a field has been set. +func (o *MonitorOptions) HasDeviceIds() bool { + if o != nil && o.DeviceIds != nil { + return true + } + + return false +} + +// SetDeviceIds gets a reference to the given []MonitorDeviceID and assigns it to the DeviceIds field. +// Deprecated +func (o *MonitorOptions) SetDeviceIds(v []MonitorDeviceID) { + o.DeviceIds = v +} + +// GetEnableLogsSample returns the EnableLogsSample field value if set, zero value otherwise. +func (o *MonitorOptions) GetEnableLogsSample() bool { + if o == nil || o.EnableLogsSample == nil { + var ret bool + return ret + } + return *o.EnableLogsSample +} + +// GetEnableLogsSampleOk returns a tuple with the EnableLogsSample field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetEnableLogsSampleOk() (*bool, bool) { + if o == nil || o.EnableLogsSample == nil { + return nil, false + } + return o.EnableLogsSample, true +} + +// HasEnableLogsSample returns a boolean if a field has been set. +func (o *MonitorOptions) HasEnableLogsSample() bool { + if o != nil && o.EnableLogsSample != nil { + return true + } + + return false +} + +// SetEnableLogsSample gets a reference to the given bool and assigns it to the EnableLogsSample field. +func (o *MonitorOptions) SetEnableLogsSample(v bool) { + o.EnableLogsSample = &v +} + +// GetEscalationMessage returns the EscalationMessage field value if set, zero value otherwise. +func (o *MonitorOptions) GetEscalationMessage() string { + if o == nil || o.EscalationMessage == nil { + var ret string + return ret + } + return *o.EscalationMessage +} + +// GetEscalationMessageOk returns a tuple with the EscalationMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetEscalationMessageOk() (*string, bool) { + if o == nil || o.EscalationMessage == nil { + return nil, false + } + return o.EscalationMessage, true +} + +// HasEscalationMessage returns a boolean if a field has been set. +func (o *MonitorOptions) HasEscalationMessage() bool { + if o != nil && o.EscalationMessage != nil { + return true + } + + return false +} + +// SetEscalationMessage gets a reference to the given string and assigns it to the EscalationMessage field. +func (o *MonitorOptions) SetEscalationMessage(v string) { + o.EscalationMessage = &v +} + +// GetEvaluationDelay returns the EvaluationDelay field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetEvaluationDelay() int64 { + if o == nil || o.EvaluationDelay.Get() == nil { + var ret int64 + return ret + } + return *o.EvaluationDelay.Get() +} + +// GetEvaluationDelayOk returns a tuple with the EvaluationDelay 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 *MonitorOptions) GetEvaluationDelayOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.EvaluationDelay.Get(), o.EvaluationDelay.IsSet() +} + +// HasEvaluationDelay returns a boolean if a field has been set. +func (o *MonitorOptions) HasEvaluationDelay() bool { + if o != nil && o.EvaluationDelay.IsSet() { + return true + } + + return false +} + +// SetEvaluationDelay gets a reference to the given common.NullableInt64 and assigns it to the EvaluationDelay field. +func (o *MonitorOptions) SetEvaluationDelay(v int64) { + o.EvaluationDelay.Set(&v) +} + +// SetEvaluationDelayNil sets the value for EvaluationDelay to be an explicit nil. +func (o *MonitorOptions) SetEvaluationDelayNil() { + o.EvaluationDelay.Set(nil) +} + +// UnsetEvaluationDelay ensures that no value is present for EvaluationDelay, not even an explicit nil. +func (o *MonitorOptions) UnsetEvaluationDelay() { + o.EvaluationDelay.Unset() +} + +// GetGroupbySimpleMonitor returns the GroupbySimpleMonitor field value if set, zero value otherwise. +func (o *MonitorOptions) GetGroupbySimpleMonitor() bool { + if o == nil || o.GroupbySimpleMonitor == nil { + var ret bool + return ret + } + return *o.GroupbySimpleMonitor +} + +// GetGroupbySimpleMonitorOk returns a tuple with the GroupbySimpleMonitor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetGroupbySimpleMonitorOk() (*bool, bool) { + if o == nil || o.GroupbySimpleMonitor == nil { + return nil, false + } + return o.GroupbySimpleMonitor, true +} + +// HasGroupbySimpleMonitor returns a boolean if a field has been set. +func (o *MonitorOptions) HasGroupbySimpleMonitor() bool { + if o != nil && o.GroupbySimpleMonitor != nil { + return true + } + + return false +} + +// SetGroupbySimpleMonitor gets a reference to the given bool and assigns it to the GroupbySimpleMonitor field. +func (o *MonitorOptions) SetGroupbySimpleMonitor(v bool) { + o.GroupbySimpleMonitor = &v +} + +// GetIncludeTags returns the IncludeTags field value if set, zero value otherwise. +func (o *MonitorOptions) GetIncludeTags() bool { + if o == nil || o.IncludeTags == nil { + var ret bool + return ret + } + return *o.IncludeTags +} + +// GetIncludeTagsOk returns a tuple with the IncludeTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetIncludeTagsOk() (*bool, bool) { + if o == nil || o.IncludeTags == nil { + return nil, false + } + return o.IncludeTags, true +} + +// HasIncludeTags returns a boolean if a field has been set. +func (o *MonitorOptions) HasIncludeTags() bool { + if o != nil && o.IncludeTags != nil { + return true + } + + return false +} + +// SetIncludeTags gets a reference to the given bool and assigns it to the IncludeTags field. +func (o *MonitorOptions) SetIncludeTags(v bool) { + o.IncludeTags = &v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +// Deprecated +func (o *MonitorOptions) GetLocked() bool { + if o == nil || o.Locked == nil { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *MonitorOptions) GetLockedOk() (*bool, bool) { + if o == nil || o.Locked == nil { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *MonitorOptions) HasLocked() bool { + if o != nil && o.Locked != nil { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +// Deprecated +func (o *MonitorOptions) SetLocked(v bool) { + o.Locked = &v +} + +// GetMinFailureDuration returns the MinFailureDuration field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetMinFailureDuration() int64 { + if o == nil || o.MinFailureDuration.Get() == nil { + var ret int64 + return ret + } + return *o.MinFailureDuration.Get() +} + +// GetMinFailureDurationOk returns a tuple with the MinFailureDuration 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 *MonitorOptions) GetMinFailureDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.MinFailureDuration.Get(), o.MinFailureDuration.IsSet() +} + +// HasMinFailureDuration returns a boolean if a field has been set. +func (o *MonitorOptions) HasMinFailureDuration() bool { + if o != nil && o.MinFailureDuration.IsSet() { + return true + } + + return false +} + +// SetMinFailureDuration gets a reference to the given common.NullableInt64 and assigns it to the MinFailureDuration field. +func (o *MonitorOptions) SetMinFailureDuration(v int64) { + o.MinFailureDuration.Set(&v) +} + +// SetMinFailureDurationNil sets the value for MinFailureDuration to be an explicit nil. +func (o *MonitorOptions) SetMinFailureDurationNil() { + o.MinFailureDuration.Set(nil) +} + +// UnsetMinFailureDuration ensures that no value is present for MinFailureDuration, not even an explicit nil. +func (o *MonitorOptions) UnsetMinFailureDuration() { + o.MinFailureDuration.Unset() +} + +// GetMinLocationFailed returns the MinLocationFailed field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetMinLocationFailed() int64 { + if o == nil || o.MinLocationFailed.Get() == nil { + var ret int64 + return ret + } + return *o.MinLocationFailed.Get() +} + +// GetMinLocationFailedOk returns a tuple with the MinLocationFailed 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 *MonitorOptions) GetMinLocationFailedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.MinLocationFailed.Get(), o.MinLocationFailed.IsSet() +} + +// HasMinLocationFailed returns a boolean if a field has been set. +func (o *MonitorOptions) HasMinLocationFailed() bool { + if o != nil && o.MinLocationFailed.IsSet() { + return true + } + + return false +} + +// SetMinLocationFailed gets a reference to the given common.NullableInt64 and assigns it to the MinLocationFailed field. +func (o *MonitorOptions) SetMinLocationFailed(v int64) { + o.MinLocationFailed.Set(&v) +} + +// SetMinLocationFailedNil sets the value for MinLocationFailed to be an explicit nil. +func (o *MonitorOptions) SetMinLocationFailedNil() { + o.MinLocationFailed.Set(nil) +} + +// UnsetMinLocationFailed ensures that no value is present for MinLocationFailed, not even an explicit nil. +func (o *MonitorOptions) UnsetMinLocationFailed() { + o.MinLocationFailed.Unset() +} + +// GetNewGroupDelay returns the NewGroupDelay field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetNewGroupDelay() int64 { + if o == nil || o.NewGroupDelay.Get() == nil { + var ret int64 + return ret + } + return *o.NewGroupDelay.Get() +} + +// GetNewGroupDelayOk returns a tuple with the NewGroupDelay 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 *MonitorOptions) GetNewGroupDelayOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.NewGroupDelay.Get(), o.NewGroupDelay.IsSet() +} + +// HasNewGroupDelay returns a boolean if a field has been set. +func (o *MonitorOptions) HasNewGroupDelay() bool { + if o != nil && o.NewGroupDelay.IsSet() { + return true + } + + return false +} + +// SetNewGroupDelay gets a reference to the given common.NullableInt64 and assigns it to the NewGroupDelay field. +func (o *MonitorOptions) SetNewGroupDelay(v int64) { + o.NewGroupDelay.Set(&v) +} + +// SetNewGroupDelayNil sets the value for NewGroupDelay to be an explicit nil. +func (o *MonitorOptions) SetNewGroupDelayNil() { + o.NewGroupDelay.Set(nil) +} + +// UnsetNewGroupDelay ensures that no value is present for NewGroupDelay, not even an explicit nil. +func (o *MonitorOptions) UnsetNewGroupDelay() { + o.NewGroupDelay.Unset() +} + +// GetNewHostDelay returns the NewHostDelay field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated +func (o *MonitorOptions) GetNewHostDelay() int64 { + if o == nil || o.NewHostDelay.Get() == nil { + var ret int64 + return ret + } + return *o.NewHostDelay.Get() +} + +// GetNewHostDelayOk returns a tuple with the NewHostDelay 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. +// Deprecated +func (o *MonitorOptions) GetNewHostDelayOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.NewHostDelay.Get(), o.NewHostDelay.IsSet() +} + +// HasNewHostDelay returns a boolean if a field has been set. +func (o *MonitorOptions) HasNewHostDelay() bool { + if o != nil && o.NewHostDelay.IsSet() { + return true + } + + return false +} + +// SetNewHostDelay gets a reference to the given common.NullableInt64 and assigns it to the NewHostDelay field. +// Deprecated +func (o *MonitorOptions) SetNewHostDelay(v int64) { + o.NewHostDelay.Set(&v) +} + +// SetNewHostDelayNil sets the value for NewHostDelay to be an explicit nil. +func (o *MonitorOptions) SetNewHostDelayNil() { + o.NewHostDelay.Set(nil) +} + +// UnsetNewHostDelay ensures that no value is present for NewHostDelay, not even an explicit nil. +func (o *MonitorOptions) UnsetNewHostDelay() { + o.NewHostDelay.Unset() +} + +// GetNoDataTimeframe returns the NoDataTimeframe field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetNoDataTimeframe() int64 { + if o == nil || o.NoDataTimeframe.Get() == nil { + var ret int64 + return ret + } + return *o.NoDataTimeframe.Get() +} + +// GetNoDataTimeframeOk returns a tuple with the NoDataTimeframe 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 *MonitorOptions) GetNoDataTimeframeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.NoDataTimeframe.Get(), o.NoDataTimeframe.IsSet() +} + +// HasNoDataTimeframe returns a boolean if a field has been set. +func (o *MonitorOptions) HasNoDataTimeframe() bool { + if o != nil && o.NoDataTimeframe.IsSet() { + return true + } + + return false +} + +// SetNoDataTimeframe gets a reference to the given common.NullableInt64 and assigns it to the NoDataTimeframe field. +func (o *MonitorOptions) SetNoDataTimeframe(v int64) { + o.NoDataTimeframe.Set(&v) +} + +// SetNoDataTimeframeNil sets the value for NoDataTimeframe to be an explicit nil. +func (o *MonitorOptions) SetNoDataTimeframeNil() { + o.NoDataTimeframe.Set(nil) +} + +// UnsetNoDataTimeframe ensures that no value is present for NoDataTimeframe, not even an explicit nil. +func (o *MonitorOptions) UnsetNoDataTimeframe() { + o.NoDataTimeframe.Unset() +} + +// GetNotifyAudit returns the NotifyAudit field value if set, zero value otherwise. +func (o *MonitorOptions) GetNotifyAudit() bool { + if o == nil || o.NotifyAudit == nil { + var ret bool + return ret + } + return *o.NotifyAudit +} + +// GetNotifyAuditOk returns a tuple with the NotifyAudit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetNotifyAuditOk() (*bool, bool) { + if o == nil || o.NotifyAudit == nil { + return nil, false + } + return o.NotifyAudit, true +} + +// HasNotifyAudit returns a boolean if a field has been set. +func (o *MonitorOptions) HasNotifyAudit() bool { + if o != nil && o.NotifyAudit != nil { + return true + } + + return false +} + +// SetNotifyAudit gets a reference to the given bool and assigns it to the NotifyAudit field. +func (o *MonitorOptions) SetNotifyAudit(v bool) { + o.NotifyAudit = &v +} + +// GetNotifyNoData returns the NotifyNoData field value if set, zero value otherwise. +func (o *MonitorOptions) GetNotifyNoData() bool { + if o == nil || o.NotifyNoData == nil { + var ret bool + return ret + } + return *o.NotifyNoData +} + +// GetNotifyNoDataOk returns a tuple with the NotifyNoData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetNotifyNoDataOk() (*bool, bool) { + if o == nil || o.NotifyNoData == nil { + return nil, false + } + return o.NotifyNoData, true +} + +// HasNotifyNoData returns a boolean if a field has been set. +func (o *MonitorOptions) HasNotifyNoData() bool { + if o != nil && o.NotifyNoData != nil { + return true + } + + return false +} + +// SetNotifyNoData gets a reference to the given bool and assigns it to the NotifyNoData field. +func (o *MonitorOptions) SetNotifyNoData(v bool) { + o.NotifyNoData = &v +} + +// GetRenotifyInterval returns the RenotifyInterval field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetRenotifyInterval() int64 { + if o == nil || o.RenotifyInterval.Get() == nil { + var ret int64 + return ret + } + return *o.RenotifyInterval.Get() +} + +// GetRenotifyIntervalOk returns a tuple with the RenotifyInterval 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 *MonitorOptions) GetRenotifyIntervalOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.RenotifyInterval.Get(), o.RenotifyInterval.IsSet() +} + +// HasRenotifyInterval returns a boolean if a field has been set. +func (o *MonitorOptions) HasRenotifyInterval() bool { + if o != nil && o.RenotifyInterval.IsSet() { + return true + } + + return false +} + +// SetRenotifyInterval gets a reference to the given common.NullableInt64 and assigns it to the RenotifyInterval field. +func (o *MonitorOptions) SetRenotifyInterval(v int64) { + o.RenotifyInterval.Set(&v) +} + +// SetRenotifyIntervalNil sets the value for RenotifyInterval to be an explicit nil. +func (o *MonitorOptions) SetRenotifyIntervalNil() { + o.RenotifyInterval.Set(nil) +} + +// UnsetRenotifyInterval ensures that no value is present for RenotifyInterval, not even an explicit nil. +func (o *MonitorOptions) UnsetRenotifyInterval() { + o.RenotifyInterval.Unset() +} + +// GetRenotifyOccurrences returns the RenotifyOccurrences field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetRenotifyOccurrences() int64 { + if o == nil || o.RenotifyOccurrences.Get() == nil { + var ret int64 + return ret + } + return *o.RenotifyOccurrences.Get() +} + +// GetRenotifyOccurrencesOk returns a tuple with the RenotifyOccurrences 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 *MonitorOptions) GetRenotifyOccurrencesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.RenotifyOccurrences.Get(), o.RenotifyOccurrences.IsSet() +} + +// HasRenotifyOccurrences returns a boolean if a field has been set. +func (o *MonitorOptions) HasRenotifyOccurrences() bool { + if o != nil && o.RenotifyOccurrences.IsSet() { + return true + } + + return false +} + +// SetRenotifyOccurrences gets a reference to the given common.NullableInt64 and assigns it to the RenotifyOccurrences field. +func (o *MonitorOptions) SetRenotifyOccurrences(v int64) { + o.RenotifyOccurrences.Set(&v) +} + +// SetRenotifyOccurrencesNil sets the value for RenotifyOccurrences to be an explicit nil. +func (o *MonitorOptions) SetRenotifyOccurrencesNil() { + o.RenotifyOccurrences.Set(nil) +} + +// UnsetRenotifyOccurrences ensures that no value is present for RenotifyOccurrences, not even an explicit nil. +func (o *MonitorOptions) UnsetRenotifyOccurrences() { + o.RenotifyOccurrences.Unset() +} + +// GetRenotifyStatuses returns the RenotifyStatuses field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetRenotifyStatuses() []MonitorRenotifyStatusType { + if o == nil { + var ret []MonitorRenotifyStatusType + return ret + } + return o.RenotifyStatuses +} + +// GetRenotifyStatusesOk returns a tuple with the RenotifyStatuses 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 *MonitorOptions) GetRenotifyStatusesOk() (*[]MonitorRenotifyStatusType, bool) { + if o == nil || o.RenotifyStatuses == nil { + return nil, false + } + return &o.RenotifyStatuses, true +} + +// HasRenotifyStatuses returns a boolean if a field has been set. +func (o *MonitorOptions) HasRenotifyStatuses() bool { + if o != nil && o.RenotifyStatuses != nil { + return true + } + + return false +} + +// SetRenotifyStatuses gets a reference to the given []MonitorRenotifyStatusType and assigns it to the RenotifyStatuses field. +func (o *MonitorOptions) SetRenotifyStatuses(v []MonitorRenotifyStatusType) { + o.RenotifyStatuses = v +} + +// GetRequireFullWindow returns the RequireFullWindow field value if set, zero value otherwise. +func (o *MonitorOptions) GetRequireFullWindow() bool { + if o == nil || o.RequireFullWindow == nil { + var ret bool + return ret + } + return *o.RequireFullWindow +} + +// GetRequireFullWindowOk returns a tuple with the RequireFullWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetRequireFullWindowOk() (*bool, bool) { + if o == nil || o.RequireFullWindow == nil { + return nil, false + } + return o.RequireFullWindow, true +} + +// HasRequireFullWindow returns a boolean if a field has been set. +func (o *MonitorOptions) HasRequireFullWindow() bool { + if o != nil && o.RequireFullWindow != nil { + return true + } + + return false +} + +// SetRequireFullWindow gets a reference to the given bool and assigns it to the RequireFullWindow field. +func (o *MonitorOptions) SetRequireFullWindow(v bool) { + o.RequireFullWindow = &v +} + +// GetSilenced returns the Silenced field value if set, zero value otherwise. +// Deprecated +func (o *MonitorOptions) GetSilenced() map[string]int64 { + if o == nil || o.Silenced == nil { + var ret map[string]int64 + return ret + } + return o.Silenced +} + +// GetSilencedOk returns a tuple with the Silenced field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *MonitorOptions) GetSilencedOk() (*map[string]int64, bool) { + if o == nil || o.Silenced == nil { + return nil, false + } + return &o.Silenced, true +} + +// HasSilenced returns a boolean if a field has been set. +func (o *MonitorOptions) HasSilenced() bool { + if o != nil && o.Silenced != nil { + return true + } + + return false +} + +// SetSilenced gets a reference to the given map[string]int64 and assigns it to the Silenced field. +// Deprecated +func (o *MonitorOptions) SetSilenced(v map[string]int64) { + o.Silenced = v +} + +// GetSyntheticsCheckId returns the SyntheticsCheckId field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated +func (o *MonitorOptions) GetSyntheticsCheckId() string { + if o == nil || o.SyntheticsCheckId.Get() == nil { + var ret string + return ret + } + return *o.SyntheticsCheckId.Get() +} + +// GetSyntheticsCheckIdOk returns a tuple with the SyntheticsCheckId 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. +// Deprecated +func (o *MonitorOptions) GetSyntheticsCheckIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SyntheticsCheckId.Get(), o.SyntheticsCheckId.IsSet() +} + +// HasSyntheticsCheckId returns a boolean if a field has been set. +func (o *MonitorOptions) HasSyntheticsCheckId() bool { + if o != nil && o.SyntheticsCheckId.IsSet() { + return true + } + + return false +} + +// SetSyntheticsCheckId gets a reference to the given common.NullableString and assigns it to the SyntheticsCheckId field. +// Deprecated +func (o *MonitorOptions) SetSyntheticsCheckId(v string) { + o.SyntheticsCheckId.Set(&v) +} + +// SetSyntheticsCheckIdNil sets the value for SyntheticsCheckId to be an explicit nil. +func (o *MonitorOptions) SetSyntheticsCheckIdNil() { + o.SyntheticsCheckId.Set(nil) +} + +// UnsetSyntheticsCheckId ensures that no value is present for SyntheticsCheckId, not even an explicit nil. +func (o *MonitorOptions) UnsetSyntheticsCheckId() { + o.SyntheticsCheckId.Unset() +} + +// GetThresholdWindows returns the ThresholdWindows field value if set, zero value otherwise. +func (o *MonitorOptions) GetThresholdWindows() MonitorThresholdWindowOptions { + if o == nil || o.ThresholdWindows == nil { + var ret MonitorThresholdWindowOptions + return ret + } + return *o.ThresholdWindows +} + +// GetThresholdWindowsOk returns a tuple with the ThresholdWindows field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetThresholdWindowsOk() (*MonitorThresholdWindowOptions, bool) { + if o == nil || o.ThresholdWindows == nil { + return nil, false + } + return o.ThresholdWindows, true +} + +// HasThresholdWindows returns a boolean if a field has been set. +func (o *MonitorOptions) HasThresholdWindows() bool { + if o != nil && o.ThresholdWindows != nil { + return true + } + + return false +} + +// SetThresholdWindows gets a reference to the given MonitorThresholdWindowOptions and assigns it to the ThresholdWindows field. +func (o *MonitorOptions) SetThresholdWindows(v MonitorThresholdWindowOptions) { + o.ThresholdWindows = &v +} + +// GetThresholds returns the Thresholds field value if set, zero value otherwise. +func (o *MonitorOptions) GetThresholds() MonitorThresholds { + if o == nil || o.Thresholds == nil { + var ret MonitorThresholds + return ret + } + return *o.Thresholds +} + +// GetThresholdsOk returns a tuple with the Thresholds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetThresholdsOk() (*MonitorThresholds, bool) { + if o == nil || o.Thresholds == nil { + return nil, false + } + return o.Thresholds, true +} + +// HasThresholds returns a boolean if a field has been set. +func (o *MonitorOptions) HasThresholds() bool { + if o != nil && o.Thresholds != nil { + return true + } + + return false +} + +// SetThresholds gets a reference to the given MonitorThresholds and assigns it to the Thresholds field. +func (o *MonitorOptions) SetThresholds(v MonitorThresholds) { + o.Thresholds = &v +} + +// GetTimeoutH returns the TimeoutH field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorOptions) GetTimeoutH() int64 { + if o == nil || o.TimeoutH.Get() == nil { + var ret int64 + return ret + } + return *o.TimeoutH.Get() +} + +// GetTimeoutHOk returns a tuple with the TimeoutH 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 *MonitorOptions) GetTimeoutHOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.TimeoutH.Get(), o.TimeoutH.IsSet() +} + +// HasTimeoutH returns a boolean if a field has been set. +func (o *MonitorOptions) HasTimeoutH() bool { + if o != nil && o.TimeoutH.IsSet() { + return true + } + + return false +} + +// SetTimeoutH gets a reference to the given common.NullableInt64 and assigns it to the TimeoutH field. +func (o *MonitorOptions) SetTimeoutH(v int64) { + o.TimeoutH.Set(&v) +} + +// SetTimeoutHNil sets the value for TimeoutH to be an explicit nil. +func (o *MonitorOptions) SetTimeoutHNil() { + o.TimeoutH.Set(nil) +} + +// UnsetTimeoutH ensures that no value is present for TimeoutH, not even an explicit nil. +func (o *MonitorOptions) UnsetTimeoutH() { + o.TimeoutH.Unset() +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *MonitorOptions) GetVariables() []MonitorFormulaAndFunctionQueryDefinition { + if o == nil || o.Variables == nil { + var ret []MonitorFormulaAndFunctionQueryDefinition + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetVariablesOk() (*[]MonitorFormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Variables == nil { + return nil, false + } + return &o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *MonitorOptions) HasVariables() bool { + if o != nil && o.Variables != nil { + return true + } + + return false +} + +// SetVariables gets a reference to the given []MonitorFormulaAndFunctionQueryDefinition and assigns it to the Variables field. +func (o *MonitorOptions) SetVariables(v []MonitorFormulaAndFunctionQueryDefinition) { + o.Variables = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregation != nil { + toSerialize["aggregation"] = o.Aggregation + } + if o.DeviceIds != nil { + toSerialize["device_ids"] = o.DeviceIds + } + if o.EnableLogsSample != nil { + toSerialize["enable_logs_sample"] = o.EnableLogsSample + } + if o.EscalationMessage != nil { + toSerialize["escalation_message"] = o.EscalationMessage + } + if o.EvaluationDelay.IsSet() { + toSerialize["evaluation_delay"] = o.EvaluationDelay.Get() + } + if o.GroupbySimpleMonitor != nil { + toSerialize["groupby_simple_monitor"] = o.GroupbySimpleMonitor + } + if o.IncludeTags != nil { + toSerialize["include_tags"] = o.IncludeTags + } + if o.Locked != nil { + toSerialize["locked"] = o.Locked + } + if o.MinFailureDuration.IsSet() { + toSerialize["min_failure_duration"] = o.MinFailureDuration.Get() + } + if o.MinLocationFailed.IsSet() { + toSerialize["min_location_failed"] = o.MinLocationFailed.Get() + } + if o.NewGroupDelay.IsSet() { + toSerialize["new_group_delay"] = o.NewGroupDelay.Get() + } + if o.NewHostDelay.IsSet() { + toSerialize["new_host_delay"] = o.NewHostDelay.Get() + } + if o.NoDataTimeframe.IsSet() { + toSerialize["no_data_timeframe"] = o.NoDataTimeframe.Get() + } + if o.NotifyAudit != nil { + toSerialize["notify_audit"] = o.NotifyAudit + } + if o.NotifyNoData != nil { + toSerialize["notify_no_data"] = o.NotifyNoData + } + if o.RenotifyInterval.IsSet() { + toSerialize["renotify_interval"] = o.RenotifyInterval.Get() + } + if o.RenotifyOccurrences.IsSet() { + toSerialize["renotify_occurrences"] = o.RenotifyOccurrences.Get() + } + if o.RenotifyStatuses != nil { + toSerialize["renotify_statuses"] = o.RenotifyStatuses + } + if o.RequireFullWindow != nil { + toSerialize["require_full_window"] = o.RequireFullWindow + } + if o.Silenced != nil { + toSerialize["silenced"] = o.Silenced + } + if o.SyntheticsCheckId.IsSet() { + toSerialize["synthetics_check_id"] = o.SyntheticsCheckId.Get() + } + if o.ThresholdWindows != nil { + toSerialize["threshold_windows"] = o.ThresholdWindows + } + if o.Thresholds != nil { + toSerialize["thresholds"] = o.Thresholds + } + if o.TimeoutH.IsSet() { + toSerialize["timeout_h"] = o.TimeoutH.Get() + } + if o.Variables != nil { + toSerialize["variables"] = o.Variables + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregation *MonitorOptionsAggregation `json:"aggregation,omitempty"` + DeviceIds []MonitorDeviceID `json:"device_ids,omitempty"` + EnableLogsSample *bool `json:"enable_logs_sample,omitempty"` + EscalationMessage *string `json:"escalation_message,omitempty"` + EvaluationDelay common.NullableInt64 `json:"evaluation_delay,omitempty"` + GroupbySimpleMonitor *bool `json:"groupby_simple_monitor,omitempty"` + IncludeTags *bool `json:"include_tags,omitempty"` + Locked *bool `json:"locked,omitempty"` + MinFailureDuration common.NullableInt64 `json:"min_failure_duration,omitempty"` + MinLocationFailed common.NullableInt64 `json:"min_location_failed,omitempty"` + NewGroupDelay common.NullableInt64 `json:"new_group_delay,omitempty"` + NewHostDelay common.NullableInt64 `json:"new_host_delay,omitempty"` + NoDataTimeframe common.NullableInt64 `json:"no_data_timeframe,omitempty"` + NotifyAudit *bool `json:"notify_audit,omitempty"` + NotifyNoData *bool `json:"notify_no_data,omitempty"` + RenotifyInterval common.NullableInt64 `json:"renotify_interval,omitempty"` + RenotifyOccurrences common.NullableInt64 `json:"renotify_occurrences,omitempty"` + RenotifyStatuses []MonitorRenotifyStatusType `json:"renotify_statuses,omitempty"` + RequireFullWindow *bool `json:"require_full_window,omitempty"` + Silenced map[string]int64 `json:"silenced,omitempty"` + SyntheticsCheckId common.NullableString `json:"synthetics_check_id,omitempty"` + ThresholdWindows *MonitorThresholdWindowOptions `json:"threshold_windows,omitempty"` + Thresholds *MonitorThresholds `json:"thresholds,omitempty"` + TimeoutH common.NullableInt64 `json:"timeout_h,omitempty"` + Variables []MonitorFormulaAndFunctionQueryDefinition `json:"variables,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Aggregation != nil && all.Aggregation.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Aggregation = all.Aggregation + o.DeviceIds = all.DeviceIds + o.EnableLogsSample = all.EnableLogsSample + o.EscalationMessage = all.EscalationMessage + o.EvaluationDelay = all.EvaluationDelay + o.GroupbySimpleMonitor = all.GroupbySimpleMonitor + o.IncludeTags = all.IncludeTags + o.Locked = all.Locked + o.MinFailureDuration = all.MinFailureDuration + o.MinLocationFailed = all.MinLocationFailed + o.NewGroupDelay = all.NewGroupDelay + o.NewHostDelay = all.NewHostDelay + o.NoDataTimeframe = all.NoDataTimeframe + o.NotifyAudit = all.NotifyAudit + o.NotifyNoData = all.NotifyNoData + o.RenotifyInterval = all.RenotifyInterval + o.RenotifyOccurrences = all.RenotifyOccurrences + o.RenotifyStatuses = all.RenotifyStatuses + o.RequireFullWindow = all.RequireFullWindow + o.Silenced = all.Silenced + o.SyntheticsCheckId = all.SyntheticsCheckId + if all.ThresholdWindows != nil && all.ThresholdWindows.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ThresholdWindows = all.ThresholdWindows + if all.Thresholds != nil && all.Thresholds.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Thresholds = all.Thresholds + o.TimeoutH = all.TimeoutH + o.Variables = all.Variables + return nil +} diff --git a/api/v1/datadog/model_monitor_options_aggregation.go b/api/v1/datadog/model_monitor_options_aggregation.go new file mode 100644 index 00000000000..0b922c69d02 --- /dev/null +++ b/api/v1/datadog/model_monitor_options_aggregation.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorOptionsAggregation Type of aggregation performed in the monitor query. +type MonitorOptionsAggregation struct { + // Group to break down the monitor on. + GroupBy *string `json:"group_by,omitempty"` + // Metric name used in the monitor. + Metric *string `json:"metric,omitempty"` + // Metric type used in the monitor. + Type *string `json:"type,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{} +} + +// NewMonitorOptionsAggregation instantiates a new MonitorOptionsAggregation 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 NewMonitorOptionsAggregation() *MonitorOptionsAggregation { + this := MonitorOptionsAggregation{} + return &this +} + +// NewMonitorOptionsAggregationWithDefaults instantiates a new MonitorOptionsAggregation 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 NewMonitorOptionsAggregationWithDefaults() *MonitorOptionsAggregation { + this := MonitorOptionsAggregation{} + return &this +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *MonitorOptionsAggregation) GetGroupBy() string { + if o == nil || o.GroupBy == nil { + var ret string + return ret + } + return *o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsAggregation) GetGroupByOk() (*string, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *MonitorOptionsAggregation) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given string and assigns it to the GroupBy field. +func (o *MonitorOptionsAggregation) SetGroupBy(v string) { + o.GroupBy = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *MonitorOptionsAggregation) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsAggregation) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *MonitorOptionsAggregation) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *MonitorOptionsAggregation) SetMetric(v string) { + o.Metric = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MonitorOptionsAggregation) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsAggregation) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MonitorOptionsAggregation) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *MonitorOptionsAggregation) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorOptionsAggregation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorOptionsAggregation) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + GroupBy *string `json:"group_by,omitempty"` + Metric *string `json:"metric,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.GroupBy = all.GroupBy + o.Metric = all.Metric + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_monitor_overall_states.go b/api/v1/datadog/model_monitor_overall_states.go new file mode 100644 index 00000000000..51557c26937 --- /dev/null +++ b/api/v1/datadog/model_monitor_overall_states.go @@ -0,0 +1,119 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorOverallStates The different states your monitor can be in. +type MonitorOverallStates string + +// List of MonitorOverallStates. +const ( + MONITOROVERALLSTATES_ALERT MonitorOverallStates = "Alert" + MONITOROVERALLSTATES_IGNORED MonitorOverallStates = "Ignored" + MONITOROVERALLSTATES_NO_DATA MonitorOverallStates = "No Data" + MONITOROVERALLSTATES_OK MonitorOverallStates = "OK" + MONITOROVERALLSTATES_SKIPPED MonitorOverallStates = "Skipped" + MONITOROVERALLSTATES_UNKNOWN MonitorOverallStates = "Unknown" + MONITOROVERALLSTATES_WARN MonitorOverallStates = "Warn" +) + +var allowedMonitorOverallStatesEnumValues = []MonitorOverallStates{ + MONITOROVERALLSTATES_ALERT, + MONITOROVERALLSTATES_IGNORED, + MONITOROVERALLSTATES_NO_DATA, + MONITOROVERALLSTATES_OK, + MONITOROVERALLSTATES_SKIPPED, + MONITOROVERALLSTATES_UNKNOWN, + MONITOROVERALLSTATES_WARN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorOverallStates) GetAllowedValues() []MonitorOverallStates { + return allowedMonitorOverallStatesEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorOverallStates) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorOverallStates(value) + return nil +} + +// NewMonitorOverallStatesFromValue returns a pointer to a valid MonitorOverallStates +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorOverallStatesFromValue(v string) (*MonitorOverallStates, error) { + ev := MonitorOverallStates(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorOverallStates: valid values are %v", v, allowedMonitorOverallStatesEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorOverallStates) IsValid() bool { + for _, existing := range allowedMonitorOverallStatesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorOverallStates value. +func (v MonitorOverallStates) Ptr() *MonitorOverallStates { + return &v +} + +// NullableMonitorOverallStates handles when a null is used for MonitorOverallStates. +type NullableMonitorOverallStates struct { + value *MonitorOverallStates + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorOverallStates) Get() *MonitorOverallStates { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorOverallStates) Set(val *MonitorOverallStates) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorOverallStates) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonitorOverallStates) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorOverallStates initializes the struct as if Set has been called. +func NewNullableMonitorOverallStates(val *MonitorOverallStates) *NullableMonitorOverallStates { + return &NullableMonitorOverallStates{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorOverallStates) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorOverallStates) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_renotify_status_type.go b/api/v1/datadog/model_monitor_renotify_status_type.go new file mode 100644 index 00000000000..5f457c7c07a --- /dev/null +++ b/api/v1/datadog/model_monitor_renotify_status_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorRenotifyStatusType The different statuses for which renotification is supported. +type MonitorRenotifyStatusType string + +// List of MonitorRenotifyStatusType. +const ( + MONITORRENOTIFYSTATUSTYPE_ALERT MonitorRenotifyStatusType = "alert" + MONITORRENOTIFYSTATUSTYPE_WARN MonitorRenotifyStatusType = "warn" + MONITORRENOTIFYSTATUSTYPE_NO_DATA MonitorRenotifyStatusType = "no data" +) + +var allowedMonitorRenotifyStatusTypeEnumValues = []MonitorRenotifyStatusType{ + MONITORRENOTIFYSTATUSTYPE_ALERT, + MONITORRENOTIFYSTATUSTYPE_WARN, + MONITORRENOTIFYSTATUSTYPE_NO_DATA, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorRenotifyStatusType) GetAllowedValues() []MonitorRenotifyStatusType { + return allowedMonitorRenotifyStatusTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorRenotifyStatusType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorRenotifyStatusType(value) + return nil +} + +// NewMonitorRenotifyStatusTypeFromValue returns a pointer to a valid MonitorRenotifyStatusType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorRenotifyStatusTypeFromValue(v string) (*MonitorRenotifyStatusType, error) { + ev := MonitorRenotifyStatusType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorRenotifyStatusType: valid values are %v", v, allowedMonitorRenotifyStatusTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorRenotifyStatusType) IsValid() bool { + for _, existing := range allowedMonitorRenotifyStatusTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorRenotifyStatusType value. +func (v MonitorRenotifyStatusType) Ptr() *MonitorRenotifyStatusType { + return &v +} + +// NullableMonitorRenotifyStatusType handles when a null is used for MonitorRenotifyStatusType. +type NullableMonitorRenotifyStatusType struct { + value *MonitorRenotifyStatusType + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorRenotifyStatusType) Get() *MonitorRenotifyStatusType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorRenotifyStatusType) Set(val *MonitorRenotifyStatusType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorRenotifyStatusType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonitorRenotifyStatusType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorRenotifyStatusType initializes the struct as if Set has been called. +func NewNullableMonitorRenotifyStatusType(val *MonitorRenotifyStatusType) *NullableMonitorRenotifyStatusType { + return &NullableMonitorRenotifyStatusType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorRenotifyStatusType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorRenotifyStatusType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_search_count_item.go b/api/v1/datadog/model_monitor_search_count_item.go new file mode 100644 index 00000000000..ec8a5aeb9af --- /dev/null +++ b/api/v1/datadog/model_monitor_search_count_item.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorSearchCountItem A facet item. +type MonitorSearchCountItem struct { + // The number of found monitors with the listed value. + Count *int64 `json:"count,omitempty"` + // The facet value. + Name interface{} `json:"name,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{} +} + +// NewMonitorSearchCountItem instantiates a new MonitorSearchCountItem 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 NewMonitorSearchCountItem() *MonitorSearchCountItem { + this := MonitorSearchCountItem{} + return &this +} + +// NewMonitorSearchCountItemWithDefaults instantiates a new MonitorSearchCountItem 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 NewMonitorSearchCountItemWithDefaults() *MonitorSearchCountItem { + this := MonitorSearchCountItem{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *MonitorSearchCountItem) GetCount() int64 { + if o == nil || o.Count == nil { + var ret int64 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchCountItem) GetCountOk() (*int64, bool) { + if o == nil || o.Count == nil { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *MonitorSearchCountItem) HasCount() bool { + if o != nil && o.Count != nil { + return true + } + + return false +} + +// SetCount gets a reference to the given int64 and assigns it to the Count field. +func (o *MonitorSearchCountItem) SetCount(v int64) { + o.Count = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MonitorSearchCountItem) GetName() interface{} { + if o == nil || o.Name == nil { + var ret interface{} + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchCountItem) GetNameOk() (*interface{}, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return &o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MonitorSearchCountItem) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given interface{} and assigns it to the Name field. +func (o *MonitorSearchCountItem) SetName(v interface{}) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorSearchCountItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Count != nil { + toSerialize["count"] = o.Count + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorSearchCountItem) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Count *int64 `json:"count,omitempty"` + Name interface{} `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Count = all.Count + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_monitor_search_response.go b/api/v1/datadog/model_monitor_search_response.go new file mode 100644 index 00000000000..0dabbdbfb84 --- /dev/null +++ b/api/v1/datadog/model_monitor_search_response.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorSearchResponse The response form a monitor search. +type MonitorSearchResponse struct { + // The counts of monitors per different criteria. + Counts *MonitorSearchResponseCounts `json:"counts,omitempty"` + // Metadata about the response. + Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` + // The list of found monitors. + Monitors []MonitorSearchResult `json:"monitors,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{} +} + +// NewMonitorSearchResponse instantiates a new MonitorSearchResponse 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 NewMonitorSearchResponse() *MonitorSearchResponse { + this := MonitorSearchResponse{} + return &this +} + +// NewMonitorSearchResponseWithDefaults instantiates a new MonitorSearchResponse 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 NewMonitorSearchResponseWithDefaults() *MonitorSearchResponse { + this := MonitorSearchResponse{} + return &this +} + +// GetCounts returns the Counts field value if set, zero value otherwise. +func (o *MonitorSearchResponse) GetCounts() MonitorSearchResponseCounts { + if o == nil || o.Counts == nil { + var ret MonitorSearchResponseCounts + return ret + } + return *o.Counts +} + +// GetCountsOk returns a tuple with the Counts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponse) GetCountsOk() (*MonitorSearchResponseCounts, bool) { + if o == nil || o.Counts == nil { + return nil, false + } + return o.Counts, true +} + +// HasCounts returns a boolean if a field has been set. +func (o *MonitorSearchResponse) HasCounts() bool { + if o != nil && o.Counts != nil { + return true + } + + return false +} + +// SetCounts gets a reference to the given MonitorSearchResponseCounts and assigns it to the Counts field. +func (o *MonitorSearchResponse) SetCounts(v MonitorSearchResponseCounts) { + o.Counts = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *MonitorSearchResponse) GetMetadata() MonitorSearchResponseMetadata { + if o == nil || o.Metadata == nil { + var ret MonitorSearchResponseMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponse) GetMetadataOk() (*MonitorSearchResponseMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *MonitorSearchResponse) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given MonitorSearchResponseMetadata and assigns it to the Metadata field. +func (o *MonitorSearchResponse) SetMetadata(v MonitorSearchResponseMetadata) { + o.Metadata = &v +} + +// GetMonitors returns the Monitors field value if set, zero value otherwise. +func (o *MonitorSearchResponse) GetMonitors() []MonitorSearchResult { + if o == nil || o.Monitors == nil { + var ret []MonitorSearchResult + return ret + } + return o.Monitors +} + +// GetMonitorsOk returns a tuple with the Monitors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponse) GetMonitorsOk() (*[]MonitorSearchResult, bool) { + if o == nil || o.Monitors == nil { + return nil, false + } + return &o.Monitors, true +} + +// HasMonitors returns a boolean if a field has been set. +func (o *MonitorSearchResponse) HasMonitors() bool { + if o != nil && o.Monitors != nil { + return true + } + + return false +} + +// SetMonitors gets a reference to the given []MonitorSearchResult and assigns it to the Monitors field. +func (o *MonitorSearchResponse) SetMonitors(v []MonitorSearchResult) { + o.Monitors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorSearchResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Counts != nil { + toSerialize["counts"] = o.Counts + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Monitors != nil { + toSerialize["monitors"] = o.Monitors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorSearchResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Counts *MonitorSearchResponseCounts `json:"counts,omitempty"` + Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` + Monitors []MonitorSearchResult `json:"monitors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Counts != nil && all.Counts.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Counts = all.Counts + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Monitors = all.Monitors + return nil +} diff --git a/api/v1/datadog/model_monitor_search_response_counts.go b/api/v1/datadog/model_monitor_search_response_counts.go new file mode 100644 index 00000000000..7d006903b8e --- /dev/null +++ b/api/v1/datadog/model_monitor_search_response_counts.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorSearchResponseCounts The counts of monitors per different criteria. +type MonitorSearchResponseCounts struct { + // Search facets. + Muted []MonitorSearchCountItem `json:"muted,omitempty"` + // Search facets. + Status []MonitorSearchCountItem `json:"status,omitempty"` + // Search facets. + Tag []MonitorSearchCountItem `json:"tag,omitempty"` + // Search facets. + Type []MonitorSearchCountItem `json:"type,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{} +} + +// NewMonitorSearchResponseCounts instantiates a new MonitorSearchResponseCounts 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 NewMonitorSearchResponseCounts() *MonitorSearchResponseCounts { + this := MonitorSearchResponseCounts{} + return &this +} + +// NewMonitorSearchResponseCountsWithDefaults instantiates a new MonitorSearchResponseCounts 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 NewMonitorSearchResponseCountsWithDefaults() *MonitorSearchResponseCounts { + this := MonitorSearchResponseCounts{} + return &this +} + +// GetMuted returns the Muted field value if set, zero value otherwise. +func (o *MonitorSearchResponseCounts) GetMuted() []MonitorSearchCountItem { + if o == nil || o.Muted == nil { + var ret []MonitorSearchCountItem + return ret + } + return o.Muted +} + +// GetMutedOk returns a tuple with the Muted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseCounts) GetMutedOk() (*[]MonitorSearchCountItem, bool) { + if o == nil || o.Muted == nil { + return nil, false + } + return &o.Muted, true +} + +// HasMuted returns a boolean if a field has been set. +func (o *MonitorSearchResponseCounts) HasMuted() bool { + if o != nil && o.Muted != nil { + return true + } + + return false +} + +// SetMuted gets a reference to the given []MonitorSearchCountItem and assigns it to the Muted field. +func (o *MonitorSearchResponseCounts) SetMuted(v []MonitorSearchCountItem) { + o.Muted = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *MonitorSearchResponseCounts) GetStatus() []MonitorSearchCountItem { + if o == nil || o.Status == nil { + var ret []MonitorSearchCountItem + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseCounts) GetStatusOk() (*[]MonitorSearchCountItem, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return &o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *MonitorSearchResponseCounts) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given []MonitorSearchCountItem and assigns it to the Status field. +func (o *MonitorSearchResponseCounts) SetStatus(v []MonitorSearchCountItem) { + o.Status = v +} + +// GetTag returns the Tag field value if set, zero value otherwise. +func (o *MonitorSearchResponseCounts) GetTag() []MonitorSearchCountItem { + if o == nil || o.Tag == nil { + var ret []MonitorSearchCountItem + return ret + } + return o.Tag +} + +// GetTagOk returns a tuple with the Tag field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseCounts) GetTagOk() (*[]MonitorSearchCountItem, bool) { + if o == nil || o.Tag == nil { + return nil, false + } + return &o.Tag, true +} + +// HasTag returns a boolean if a field has been set. +func (o *MonitorSearchResponseCounts) HasTag() bool { + if o != nil && o.Tag != nil { + return true + } + + return false +} + +// SetTag gets a reference to the given []MonitorSearchCountItem and assigns it to the Tag field. +func (o *MonitorSearchResponseCounts) SetTag(v []MonitorSearchCountItem) { + o.Tag = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MonitorSearchResponseCounts) GetType() []MonitorSearchCountItem { + if o == nil || o.Type == nil { + var ret []MonitorSearchCountItem + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseCounts) GetTypeOk() (*[]MonitorSearchCountItem, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return &o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MonitorSearchResponseCounts) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given []MonitorSearchCountItem and assigns it to the Type field. +func (o *MonitorSearchResponseCounts) SetType(v []MonitorSearchCountItem) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorSearchResponseCounts) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Muted != nil { + toSerialize["muted"] = o.Muted + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Tag != nil { + toSerialize["tag"] = o.Tag + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Muted []MonitorSearchCountItem `json:"muted,omitempty"` + Status []MonitorSearchCountItem `json:"status,omitempty"` + Tag []MonitorSearchCountItem `json:"tag,omitempty"` + Type []MonitorSearchCountItem `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Muted = all.Muted + o.Status = all.Status + o.Tag = all.Tag + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_monitor_search_response_metadata.go b/api/v1/datadog/model_monitor_search_response_metadata.go new file mode 100644 index 00000000000..8b332b434ce --- /dev/null +++ b/api/v1/datadog/model_monitor_search_response_metadata.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorSearchResponseMetadata Metadata about the response. +type MonitorSearchResponseMetadata struct { + // The page to start paginating from. + Page *int64 `json:"page,omitempty"` + // The number of pages. + PageCount *int64 `json:"page_count,omitempty"` + // The number of monitors to return per page. + PerPage *int64 `json:"per_page,omitempty"` + // The total number of monitors. + TotalCount *int64 `json:"total_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{} +} + +// NewMonitorSearchResponseMetadata instantiates a new MonitorSearchResponseMetadata 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 NewMonitorSearchResponseMetadata() *MonitorSearchResponseMetadata { + this := MonitorSearchResponseMetadata{} + return &this +} + +// NewMonitorSearchResponseMetadataWithDefaults instantiates a new MonitorSearchResponseMetadata 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 NewMonitorSearchResponseMetadataWithDefaults() *MonitorSearchResponseMetadata { + this := MonitorSearchResponseMetadata{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *MonitorSearchResponseMetadata) GetPage() int64 { + if o == nil || o.Page == nil { + var ret int64 + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseMetadata) GetPageOk() (*int64, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *MonitorSearchResponseMetadata) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given int64 and assigns it to the Page field. +func (o *MonitorSearchResponseMetadata) SetPage(v int64) { + o.Page = &v +} + +// GetPageCount returns the PageCount field value if set, zero value otherwise. +func (o *MonitorSearchResponseMetadata) GetPageCount() int64 { + if o == nil || o.PageCount == nil { + var ret int64 + return ret + } + return *o.PageCount +} + +// GetPageCountOk returns a tuple with the PageCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseMetadata) GetPageCountOk() (*int64, bool) { + if o == nil || o.PageCount == nil { + return nil, false + } + return o.PageCount, true +} + +// HasPageCount returns a boolean if a field has been set. +func (o *MonitorSearchResponseMetadata) HasPageCount() bool { + if o != nil && o.PageCount != nil { + return true + } + + return false +} + +// SetPageCount gets a reference to the given int64 and assigns it to the PageCount field. +func (o *MonitorSearchResponseMetadata) SetPageCount(v int64) { + o.PageCount = &v +} + +// GetPerPage returns the PerPage field value if set, zero value otherwise. +func (o *MonitorSearchResponseMetadata) GetPerPage() int64 { + if o == nil || o.PerPage == nil { + var ret int64 + return ret + } + return *o.PerPage +} + +// GetPerPageOk returns a tuple with the PerPage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseMetadata) GetPerPageOk() (*int64, bool) { + if o == nil || o.PerPage == nil { + return nil, false + } + return o.PerPage, true +} + +// HasPerPage returns a boolean if a field has been set. +func (o *MonitorSearchResponseMetadata) HasPerPage() bool { + if o != nil && o.PerPage != nil { + return true + } + + return false +} + +// SetPerPage gets a reference to the given int64 and assigns it to the PerPage field. +func (o *MonitorSearchResponseMetadata) SetPerPage(v int64) { + o.PerPage = &v +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *MonitorSearchResponseMetadata) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResponseMetadata) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *MonitorSearchResponseMetadata) HasTotalCount() bool { + if o != nil && o.TotalCount != nil { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *MonitorSearchResponseMetadata) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorSearchResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.PageCount != nil { + toSerialize["page_count"] = o.PageCount + } + if o.PerPage != nil { + toSerialize["per_page"] = o.PerPage + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorSearchResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *int64 `json:"page,omitempty"` + PageCount *int64 `json:"page_count,omitempty"` + PerPage *int64 `json:"per_page,omitempty"` + TotalCount *int64 `json:"total_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Page = all.Page + o.PageCount = all.PageCount + o.PerPage = all.PerPage + o.TotalCount = all.TotalCount + return nil +} diff --git a/api/v1/datadog/model_monitor_search_result.go b/api/v1/datadog/model_monitor_search_result.go new file mode 100644 index 00000000000..90e0588e62e --- /dev/null +++ b/api/v1/datadog/model_monitor_search_result.go @@ -0,0 +1,609 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonitorSearchResult Holds search results. +type MonitorSearchResult struct { + // Classification of the monitor. + Classification *string `json:"classification,omitempty"` + // Object describing the creator of the shared element. + Creator *Creator `json:"creator,omitempty"` + // ID of the monitor. + Id *int64 `json:"id,omitempty"` + // Latest timestamp the monitor triggered. + LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` + // Metrics used by the monitor. + Metrics []string `json:"metrics,omitempty"` + // The monitor name. + Name *string `json:"name,omitempty"` + // The notification triggered by the monitor. + Notifications []MonitorSearchResultNotification `json:"notifications,omitempty"` + // The ID of the organization. + OrgId *int64 `json:"org_id,omitempty"` + // The monitor query. + Query *string `json:"query,omitempty"` + // The scope(s) to which the downtime applies, for example `host:app2`. + // Provide multiple scopes as a comma-separated list, for example `env:dev,env:prod`. + // The resulting downtime applies to sources that matches ALL provided scopes + // (that is `env:dev AND env:prod`), NOT any of them. + Scopes []string `json:"scopes,omitempty"` + // The different states your monitor can be in. + Status *MonitorOverallStates `json:"status,omitempty"` + // Tags associated with the monitor. + Tags []string `json:"tags,omitempty"` + // The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. + Type *MonitorType `json:"type,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{} +} + +// NewMonitorSearchResult instantiates a new MonitorSearchResult 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 NewMonitorSearchResult() *MonitorSearchResult { + this := MonitorSearchResult{} + return &this +} + +// NewMonitorSearchResultWithDefaults instantiates a new MonitorSearchResult 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 NewMonitorSearchResultWithDefaults() *MonitorSearchResult { + this := MonitorSearchResult{} + return &this +} + +// GetClassification returns the Classification field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetClassification() string { + if o == nil || o.Classification == nil { + var ret string + return ret + } + return *o.Classification +} + +// GetClassificationOk returns a tuple with the Classification field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetClassificationOk() (*string, bool) { + if o == nil || o.Classification == nil { + return nil, false + } + return o.Classification, true +} + +// HasClassification returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasClassification() bool { + if o != nil && o.Classification != nil { + return true + } + + return false +} + +// SetClassification gets a reference to the given string and assigns it to the Classification field. +func (o *MonitorSearchResult) SetClassification(v string) { + o.Classification = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetCreator() Creator { + if o == nil || o.Creator == nil { + var ret Creator + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetCreatorOk() (*Creator, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given Creator and assigns it to the Creator field. +func (o *MonitorSearchResult) SetCreator(v Creator) { + o.Creator = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *MonitorSearchResult) SetId(v int64) { + o.Id = &v +} + +// GetLastTriggeredTs returns the LastTriggeredTs field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorSearchResult) GetLastTriggeredTs() int64 { + if o == nil || o.LastTriggeredTs.Get() == nil { + var ret int64 + return ret + } + return *o.LastTriggeredTs.Get() +} + +// GetLastTriggeredTsOk returns a tuple with the LastTriggeredTs 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 *MonitorSearchResult) GetLastTriggeredTsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.LastTriggeredTs.Get(), o.LastTriggeredTs.IsSet() +} + +// HasLastTriggeredTs returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasLastTriggeredTs() bool { + if o != nil && o.LastTriggeredTs.IsSet() { + return true + } + + return false +} + +// SetLastTriggeredTs gets a reference to the given common.NullableInt64 and assigns it to the LastTriggeredTs field. +func (o *MonitorSearchResult) SetLastTriggeredTs(v int64) { + o.LastTriggeredTs.Set(&v) +} + +// SetLastTriggeredTsNil sets the value for LastTriggeredTs to be an explicit nil. +func (o *MonitorSearchResult) SetLastTriggeredTsNil() { + o.LastTriggeredTs.Set(nil) +} + +// UnsetLastTriggeredTs ensures that no value is present for LastTriggeredTs, not even an explicit nil. +func (o *MonitorSearchResult) UnsetLastTriggeredTs() { + o.LastTriggeredTs.Unset() +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetMetrics() []string { + if o == nil || o.Metrics == nil { + var ret []string + return ret + } + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetMetricsOk() (*[]string, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return &o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasMetrics() bool { + if o != nil && o.Metrics != nil { + return true + } + + return false +} + +// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. +func (o *MonitorSearchResult) SetMetrics(v []string) { + o.Metrics = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MonitorSearchResult) SetName(v string) { + o.Name = &v +} + +// GetNotifications returns the Notifications field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetNotifications() []MonitorSearchResultNotification { + if o == nil || o.Notifications == nil { + var ret []MonitorSearchResultNotification + return ret + } + return o.Notifications +} + +// GetNotificationsOk returns a tuple with the Notifications field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetNotificationsOk() (*[]MonitorSearchResultNotification, bool) { + if o == nil || o.Notifications == nil { + return nil, false + } + return &o.Notifications, true +} + +// HasNotifications returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasNotifications() bool { + if o != nil && o.Notifications != nil { + return true + } + + return false +} + +// SetNotifications gets a reference to the given []MonitorSearchResultNotification and assigns it to the Notifications field. +func (o *MonitorSearchResult) SetNotifications(v []MonitorSearchResultNotification) { + o.Notifications = v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetOrgId() int64 { + if o == nil || o.OrgId == nil { + var ret int64 + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetOrgIdOk() (*int64, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasOrgId() bool { + if o != nil && o.OrgId != nil { + return true + } + + return false +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *MonitorSearchResult) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *MonitorSearchResult) SetQuery(v string) { + o.Query = &v +} + +// GetScopes returns the Scopes field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetScopes() []string { + if o == nil || o.Scopes == nil { + var ret []string + return ret + } + return o.Scopes +} + +// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetScopesOk() (*[]string, bool) { + if o == nil || o.Scopes == nil { + return nil, false + } + return &o.Scopes, true +} + +// HasScopes returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasScopes() bool { + if o != nil && o.Scopes != nil { + return true + } + + return false +} + +// SetScopes gets a reference to the given []string and assigns it to the Scopes field. +func (o *MonitorSearchResult) SetScopes(v []string) { + o.Scopes = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetStatus() MonitorOverallStates { + if o == nil || o.Status == nil { + var ret MonitorOverallStates + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetStatusOk() (*MonitorOverallStates, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given MonitorOverallStates and assigns it to the Status field. +func (o *MonitorSearchResult) SetStatus(v MonitorOverallStates) { + o.Status = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MonitorSearchResult) GetTagsOk() (*[]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 *MonitorSearchResult) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MonitorSearchResult) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MonitorSearchResult) GetType() MonitorType { + if o == nil || o.Type == nil { + var ret MonitorType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResult) GetTypeOk() (*MonitorType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MonitorSearchResult) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MonitorType and assigns it to the Type field. +func (o *MonitorSearchResult) SetType(v MonitorType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorSearchResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Classification != nil { + toSerialize["classification"] = o.Classification + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.LastTriggeredTs.IsSet() { + toSerialize["last_triggered_ts"] = o.LastTriggeredTs.Get() + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Notifications != nil { + toSerialize["notifications"] = o.Notifications + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Scopes != nil { + toSerialize["scopes"] = o.Scopes + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorSearchResult) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Classification *string `json:"classification,omitempty"` + Creator *Creator `json:"creator,omitempty"` + Id *int64 `json:"id,omitempty"` + LastTriggeredTs common.NullableInt64 `json:"last_triggered_ts,omitempty"` + Metrics []string `json:"metrics,omitempty"` + Name *string `json:"name,omitempty"` + Notifications []MonitorSearchResultNotification `json:"notifications,omitempty"` + OrgId *int64 `json:"org_id,omitempty"` + Query *string `json:"query,omitempty"` + Scopes []string `json:"scopes,omitempty"` + Status *MonitorOverallStates `json:"status,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *MonitorType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Classification = all.Classification + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.Id = all.Id + o.LastTriggeredTs = all.LastTriggeredTs + o.Metrics = all.Metrics + o.Name = all.Name + o.Notifications = all.Notifications + o.OrgId = all.OrgId + o.Query = all.Query + o.Scopes = all.Scopes + o.Status = all.Status + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_monitor_search_result_notification.go b/api/v1/datadog/model_monitor_search_result_notification.go new file mode 100644 index 00000000000..95fc77cb930 --- /dev/null +++ b/api/v1/datadog/model_monitor_search_result_notification.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorSearchResultNotification A notification triggered by the monitor. +type MonitorSearchResultNotification struct { + // The email address that received the notification. + Handle *string `json:"handle,omitempty"` + // The username receiving the notification + Name *string `json:"name,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{} +} + +// NewMonitorSearchResultNotification instantiates a new MonitorSearchResultNotification 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 NewMonitorSearchResultNotification() *MonitorSearchResultNotification { + this := MonitorSearchResultNotification{} + return &this +} + +// NewMonitorSearchResultNotificationWithDefaults instantiates a new MonitorSearchResultNotification 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 NewMonitorSearchResultNotificationWithDefaults() *MonitorSearchResultNotification { + this := MonitorSearchResultNotification{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *MonitorSearchResultNotification) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResultNotification) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *MonitorSearchResultNotification) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *MonitorSearchResultNotification) SetHandle(v string) { + o.Handle = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MonitorSearchResultNotification) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSearchResultNotification) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MonitorSearchResultNotification) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MonitorSearchResultNotification) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorSearchResultNotification) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorSearchResultNotification) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Handle *string `json:"handle,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Handle = all.Handle + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_monitor_state.go b/api/v1/datadog/model_monitor_state.go new file mode 100644 index 00000000000..04882bb4ff7 --- /dev/null +++ b/api/v1/datadog/model_monitor_state.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorState Wrapper object with the different monitor states. +type MonitorState struct { + // Dictionary where the keys are groups (comma separated lists of tags) and the values are + // the list of groups your monitor is broken down on. + Groups map[string]MonitorStateGroup `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{} +} + +// NewMonitorState instantiates a new MonitorState 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 NewMonitorState() *MonitorState { + this := MonitorState{} + return &this +} + +// NewMonitorStateWithDefaults instantiates a new MonitorState 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 NewMonitorStateWithDefaults() *MonitorState { + this := MonitorState{} + return &this +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *MonitorState) GetGroups() map[string]MonitorStateGroup { + if o == nil || o.Groups == nil { + var ret map[string]MonitorStateGroup + 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 *MonitorState) GetGroupsOk() (*map[string]MonitorStateGroup, 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 *MonitorState) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + +// SetGroups gets a reference to the given map[string]MonitorStateGroup and assigns it to the Groups field. +func (o *MonitorState) SetGroups(v map[string]MonitorStateGroup) { + o.Groups = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorState) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorState) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Groups map[string]MonitorStateGroup `json:"groups,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Groups = all.Groups + return nil +} diff --git a/api/v1/datadog/model_monitor_state_group.go b/api/v1/datadog/model_monitor_state_group.go new file mode 100644 index 00000000000..886170e950e --- /dev/null +++ b/api/v1/datadog/model_monitor_state_group.go @@ -0,0 +1,305 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorStateGroup Monitor state for a single group. +type MonitorStateGroup struct { + // Latest timestamp the monitor was in NO_DATA state. + LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` + // Latest timestamp of the notification sent for this monitor group. + LastNotifiedTs *int64 `json:"last_notified_ts,omitempty"` + // Latest timestamp the monitor group was resolved. + LastResolvedTs *int64 `json:"last_resolved_ts,omitempty"` + // Latest timestamp the monitor group triggered. + LastTriggeredTs *int64 `json:"last_triggered_ts,omitempty"` + // The name of the monitor. + Name *string `json:"name,omitempty"` + // The different states your monitor can be in. + Status *MonitorOverallStates `json:"status,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{} +} + +// NewMonitorStateGroup instantiates a new MonitorStateGroup 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 NewMonitorStateGroup() *MonitorStateGroup { + this := MonitorStateGroup{} + return &this +} + +// NewMonitorStateGroupWithDefaults instantiates a new MonitorStateGroup 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 NewMonitorStateGroupWithDefaults() *MonitorStateGroup { + this := MonitorStateGroup{} + return &this +} + +// GetLastNodataTs returns the LastNodataTs field value if set, zero value otherwise. +func (o *MonitorStateGroup) GetLastNodataTs() int64 { + if o == nil || o.LastNodataTs == nil { + var ret int64 + return ret + } + return *o.LastNodataTs +} + +// GetLastNodataTsOk returns a tuple with the LastNodataTs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorStateGroup) GetLastNodataTsOk() (*int64, bool) { + if o == nil || o.LastNodataTs == nil { + return nil, false + } + return o.LastNodataTs, true +} + +// HasLastNodataTs returns a boolean if a field has been set. +func (o *MonitorStateGroup) HasLastNodataTs() bool { + if o != nil && o.LastNodataTs != nil { + return true + } + + return false +} + +// SetLastNodataTs gets a reference to the given int64 and assigns it to the LastNodataTs field. +func (o *MonitorStateGroup) SetLastNodataTs(v int64) { + o.LastNodataTs = &v +} + +// GetLastNotifiedTs returns the LastNotifiedTs field value if set, zero value otherwise. +func (o *MonitorStateGroup) GetLastNotifiedTs() int64 { + if o == nil || o.LastNotifiedTs == nil { + var ret int64 + return ret + } + return *o.LastNotifiedTs +} + +// GetLastNotifiedTsOk returns a tuple with the LastNotifiedTs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorStateGroup) GetLastNotifiedTsOk() (*int64, bool) { + if o == nil || o.LastNotifiedTs == nil { + return nil, false + } + return o.LastNotifiedTs, true +} + +// HasLastNotifiedTs returns a boolean if a field has been set. +func (o *MonitorStateGroup) HasLastNotifiedTs() bool { + if o != nil && o.LastNotifiedTs != nil { + return true + } + + return false +} + +// SetLastNotifiedTs gets a reference to the given int64 and assigns it to the LastNotifiedTs field. +func (o *MonitorStateGroup) SetLastNotifiedTs(v int64) { + o.LastNotifiedTs = &v +} + +// GetLastResolvedTs returns the LastResolvedTs field value if set, zero value otherwise. +func (o *MonitorStateGroup) GetLastResolvedTs() int64 { + if o == nil || o.LastResolvedTs == nil { + var ret int64 + return ret + } + return *o.LastResolvedTs +} + +// GetLastResolvedTsOk returns a tuple with the LastResolvedTs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorStateGroup) GetLastResolvedTsOk() (*int64, bool) { + if o == nil || o.LastResolvedTs == nil { + return nil, false + } + return o.LastResolvedTs, true +} + +// HasLastResolvedTs returns a boolean if a field has been set. +func (o *MonitorStateGroup) HasLastResolvedTs() bool { + if o != nil && o.LastResolvedTs != nil { + return true + } + + return false +} + +// SetLastResolvedTs gets a reference to the given int64 and assigns it to the LastResolvedTs field. +func (o *MonitorStateGroup) SetLastResolvedTs(v int64) { + o.LastResolvedTs = &v +} + +// GetLastTriggeredTs returns the LastTriggeredTs field value if set, zero value otherwise. +func (o *MonitorStateGroup) GetLastTriggeredTs() int64 { + if o == nil || o.LastTriggeredTs == nil { + var ret int64 + return ret + } + return *o.LastTriggeredTs +} + +// GetLastTriggeredTsOk returns a tuple with the LastTriggeredTs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorStateGroup) GetLastTriggeredTsOk() (*int64, bool) { + if o == nil || o.LastTriggeredTs == nil { + return nil, false + } + return o.LastTriggeredTs, true +} + +// HasLastTriggeredTs returns a boolean if a field has been set. +func (o *MonitorStateGroup) HasLastTriggeredTs() bool { + if o != nil && o.LastTriggeredTs != nil { + return true + } + + return false +} + +// SetLastTriggeredTs gets a reference to the given int64 and assigns it to the LastTriggeredTs field. +func (o *MonitorStateGroup) SetLastTriggeredTs(v int64) { + o.LastTriggeredTs = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MonitorStateGroup) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorStateGroup) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MonitorStateGroup) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MonitorStateGroup) SetName(v string) { + o.Name = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *MonitorStateGroup) GetStatus() MonitorOverallStates { + if o == nil || o.Status == nil { + var ret MonitorOverallStates + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorStateGroup) GetStatusOk() (*MonitorOverallStates, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *MonitorStateGroup) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given MonitorOverallStates and assigns it to the Status field. +func (o *MonitorStateGroup) SetStatus(v MonitorOverallStates) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorStateGroup) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LastNodataTs != nil { + toSerialize["last_nodata_ts"] = o.LastNodataTs + } + if o.LastNotifiedTs != nil { + toSerialize["last_notified_ts"] = o.LastNotifiedTs + } + if o.LastResolvedTs != nil { + toSerialize["last_resolved_ts"] = o.LastResolvedTs + } + if o.LastTriggeredTs != nil { + toSerialize["last_triggered_ts"] = o.LastTriggeredTs + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorStateGroup) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + LastNodataTs *int64 `json:"last_nodata_ts,omitempty"` + LastNotifiedTs *int64 `json:"last_notified_ts,omitempty"` + LastResolvedTs *int64 `json:"last_resolved_ts,omitempty"` + LastTriggeredTs *int64 `json:"last_triggered_ts,omitempty"` + Name *string `json:"name,omitempty"` + Status *MonitorOverallStates `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LastNodataTs = all.LastNodataTs + o.LastNotifiedTs = all.LastNotifiedTs + o.LastResolvedTs = all.LastResolvedTs + o.LastTriggeredTs = all.LastTriggeredTs + o.Name = all.Name + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_monitor_summary_widget_definition.go b/api/v1/datadog/model_monitor_summary_widget_definition.go new file mode 100644 index 00000000000..87a059663fe --- /dev/null +++ b/api/v1/datadog/model_monitor_summary_widget_definition.go @@ -0,0 +1,623 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorSummaryWidgetDefinition The monitor summary widget displays a summary view of all your Datadog monitors, or a subset based on a query. Only available on FREE layout dashboards. +type MonitorSummaryWidgetDefinition struct { + // Which color to use on the widget. + ColorPreference *WidgetColorPreference `json:"color_preference,omitempty"` + // The number of monitors to display. + // Deprecated + Count *int64 `json:"count,omitempty"` + // What to display on the widget. + DisplayFormat *WidgetMonitorSummaryDisplayFormat `json:"display_format,omitempty"` + // Whether to show counts of 0 or not. + HideZeroCounts *bool `json:"hide_zero_counts,omitempty"` + // Query to filter the monitors with. + Query string `json:"query"` + // Whether to show the time that has elapsed since the monitor/group triggered. + ShowLastTriggered *bool `json:"show_last_triggered,omitempty"` + // Widget sorting methods. + Sort *WidgetMonitorSummarySort `json:"sort,omitempty"` + // The start of the list. Typically 0. + // Deprecated + Start *int64 `json:"start,omitempty"` + // Which summary type should be used. + SummaryType *WidgetSummaryType `json:"summary_type,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the monitor summary widget. + Type MonitorSummaryWidgetDefinitionType `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{} +} + +// NewMonitorSummaryWidgetDefinition instantiates a new MonitorSummaryWidgetDefinition 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 NewMonitorSummaryWidgetDefinition(query string, typeVar MonitorSummaryWidgetDefinitionType) *MonitorSummaryWidgetDefinition { + this := MonitorSummaryWidgetDefinition{} + this.Query = query + this.Type = typeVar + return &this +} + +// NewMonitorSummaryWidgetDefinitionWithDefaults instantiates a new MonitorSummaryWidgetDefinition 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 NewMonitorSummaryWidgetDefinitionWithDefaults() *MonitorSummaryWidgetDefinition { + this := MonitorSummaryWidgetDefinition{} + var typeVar MonitorSummaryWidgetDefinitionType = MONITORSUMMARYWIDGETDEFINITIONTYPE_MANAGE_STATUS + this.Type = typeVar + return &this +} + +// GetColorPreference returns the ColorPreference field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetColorPreference() WidgetColorPreference { + if o == nil || o.ColorPreference == nil { + var ret WidgetColorPreference + return ret + } + return *o.ColorPreference +} + +// GetColorPreferenceOk returns a tuple with the ColorPreference field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetColorPreferenceOk() (*WidgetColorPreference, bool) { + if o == nil || o.ColorPreference == nil { + return nil, false + } + return o.ColorPreference, true +} + +// HasColorPreference returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasColorPreference() bool { + if o != nil && o.ColorPreference != nil { + return true + } + + return false +} + +// SetColorPreference gets a reference to the given WidgetColorPreference and assigns it to the ColorPreference field. +func (o *MonitorSummaryWidgetDefinition) SetColorPreference(v WidgetColorPreference) { + o.ColorPreference = &v +} + +// GetCount returns the Count field value if set, zero value otherwise. +// Deprecated +func (o *MonitorSummaryWidgetDefinition) GetCount() int64 { + if o == nil || o.Count == nil { + var ret int64 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *MonitorSummaryWidgetDefinition) GetCountOk() (*int64, bool) { + if o == nil || o.Count == nil { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasCount() bool { + if o != nil && o.Count != nil { + return true + } + + return false +} + +// SetCount gets a reference to the given int64 and assigns it to the Count field. +// Deprecated +func (o *MonitorSummaryWidgetDefinition) SetCount(v int64) { + o.Count = &v +} + +// GetDisplayFormat returns the DisplayFormat field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetDisplayFormat() WidgetMonitorSummaryDisplayFormat { + if o == nil || o.DisplayFormat == nil { + var ret WidgetMonitorSummaryDisplayFormat + return ret + } + return *o.DisplayFormat +} + +// GetDisplayFormatOk returns a tuple with the DisplayFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetDisplayFormatOk() (*WidgetMonitorSummaryDisplayFormat, bool) { + if o == nil || o.DisplayFormat == nil { + return nil, false + } + return o.DisplayFormat, true +} + +// HasDisplayFormat returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasDisplayFormat() bool { + if o != nil && o.DisplayFormat != nil { + return true + } + + return false +} + +// SetDisplayFormat gets a reference to the given WidgetMonitorSummaryDisplayFormat and assigns it to the DisplayFormat field. +func (o *MonitorSummaryWidgetDefinition) SetDisplayFormat(v WidgetMonitorSummaryDisplayFormat) { + o.DisplayFormat = &v +} + +// GetHideZeroCounts returns the HideZeroCounts field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetHideZeroCounts() bool { + if o == nil || o.HideZeroCounts == nil { + var ret bool + return ret + } + return *o.HideZeroCounts +} + +// GetHideZeroCountsOk returns a tuple with the HideZeroCounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetHideZeroCountsOk() (*bool, bool) { + if o == nil || o.HideZeroCounts == nil { + return nil, false + } + return o.HideZeroCounts, true +} + +// HasHideZeroCounts returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasHideZeroCounts() bool { + if o != nil && o.HideZeroCounts != nil { + return true + } + + return false +} + +// SetHideZeroCounts gets a reference to the given bool and assigns it to the HideZeroCounts field. +func (o *MonitorSummaryWidgetDefinition) SetHideZeroCounts(v bool) { + o.HideZeroCounts = &v +} + +// GetQuery returns the Query field value. +func (o *MonitorSummaryWidgetDefinition) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *MonitorSummaryWidgetDefinition) SetQuery(v string) { + o.Query = v +} + +// GetShowLastTriggered returns the ShowLastTriggered field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetShowLastTriggered() bool { + if o == nil || o.ShowLastTriggered == nil { + var ret bool + return ret + } + return *o.ShowLastTriggered +} + +// GetShowLastTriggeredOk returns a tuple with the ShowLastTriggered field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetShowLastTriggeredOk() (*bool, bool) { + if o == nil || o.ShowLastTriggered == nil { + return nil, false + } + return o.ShowLastTriggered, true +} + +// HasShowLastTriggered returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasShowLastTriggered() bool { + if o != nil && o.ShowLastTriggered != nil { + return true + } + + return false +} + +// SetShowLastTriggered gets a reference to the given bool and assigns it to the ShowLastTriggered field. +func (o *MonitorSummaryWidgetDefinition) SetShowLastTriggered(v bool) { + o.ShowLastTriggered = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetSort() WidgetMonitorSummarySort { + if o == nil || o.Sort == nil { + var ret WidgetMonitorSummarySort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetSortOk() (*WidgetMonitorSummarySort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given WidgetMonitorSummarySort and assigns it to the Sort field. +func (o *MonitorSummaryWidgetDefinition) SetSort(v WidgetMonitorSummarySort) { + o.Sort = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +// Deprecated +func (o *MonitorSummaryWidgetDefinition) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *MonitorSummaryWidgetDefinition) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +// Deprecated +func (o *MonitorSummaryWidgetDefinition) SetStart(v int64) { + o.Start = &v +} + +// GetSummaryType returns the SummaryType field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetSummaryType() WidgetSummaryType { + if o == nil || o.SummaryType == nil { + var ret WidgetSummaryType + return ret + } + return *o.SummaryType +} + +// GetSummaryTypeOk returns a tuple with the SummaryType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetSummaryTypeOk() (*WidgetSummaryType, bool) { + if o == nil || o.SummaryType == nil { + return nil, false + } + return o.SummaryType, true +} + +// HasSummaryType returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasSummaryType() bool { + if o != nil && o.SummaryType != nil { + return true + } + + return false +} + +// SetSummaryType gets a reference to the given WidgetSummaryType and assigns it to the SummaryType field. +func (o *MonitorSummaryWidgetDefinition) SetSummaryType(v WidgetSummaryType) { + o.SummaryType = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *MonitorSummaryWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *MonitorSummaryWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *MonitorSummaryWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorSummaryWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *MonitorSummaryWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *MonitorSummaryWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *MonitorSummaryWidgetDefinition) GetType() MonitorSummaryWidgetDefinitionType { + if o == nil { + var ret MonitorSummaryWidgetDefinitionType + 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 *MonitorSummaryWidgetDefinition) GetTypeOk() (*MonitorSummaryWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MonitorSummaryWidgetDefinition) SetType(v MonitorSummaryWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ColorPreference != nil { + toSerialize["color_preference"] = o.ColorPreference + } + if o.Count != nil { + toSerialize["count"] = o.Count + } + if o.DisplayFormat != nil { + toSerialize["display_format"] = o.DisplayFormat + } + if o.HideZeroCounts != nil { + toSerialize["hide_zero_counts"] = o.HideZeroCounts + } + toSerialize["query"] = o.Query + if o.ShowLastTriggered != nil { + toSerialize["show_last_triggered"] = o.ShowLastTriggered + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.SummaryType != nil { + toSerialize["summary_type"] = o.SummaryType + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + Type *MonitorSummaryWidgetDefinitionType `json:"type"` + }{} + all := struct { + ColorPreference *WidgetColorPreference `json:"color_preference,omitempty"` + Count *int64 `json:"count,omitempty"` + DisplayFormat *WidgetMonitorSummaryDisplayFormat `json:"display_format,omitempty"` + HideZeroCounts *bool `json:"hide_zero_counts,omitempty"` + Query string `json:"query"` + ShowLastTriggered *bool `json:"show_last_triggered,omitempty"` + Sort *WidgetMonitorSummarySort `json:"sort,omitempty"` + Start *int64 `json:"start,omitempty"` + SummaryType *WidgetSummaryType `json:"summary_type,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type MonitorSummaryWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ColorPreference; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DisplayFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.SummaryType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ColorPreference = all.ColorPreference + o.Count = all.Count + o.DisplayFormat = all.DisplayFormat + o.HideZeroCounts = all.HideZeroCounts + o.Query = all.Query + o.ShowLastTriggered = all.ShowLastTriggered + o.Sort = all.Sort + o.Start = all.Start + o.SummaryType = all.SummaryType + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_monitor_summary_widget_definition_type.go b/api/v1/datadog/model_monitor_summary_widget_definition_type.go new file mode 100644 index 00000000000..cd70ad8f4da --- /dev/null +++ b/api/v1/datadog/model_monitor_summary_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorSummaryWidgetDefinitionType Type of the monitor summary widget. +type MonitorSummaryWidgetDefinitionType string + +// List of MonitorSummaryWidgetDefinitionType. +const ( + MONITORSUMMARYWIDGETDEFINITIONTYPE_MANAGE_STATUS MonitorSummaryWidgetDefinitionType = "manage_status" +) + +var allowedMonitorSummaryWidgetDefinitionTypeEnumValues = []MonitorSummaryWidgetDefinitionType{ + MONITORSUMMARYWIDGETDEFINITIONTYPE_MANAGE_STATUS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorSummaryWidgetDefinitionType) GetAllowedValues() []MonitorSummaryWidgetDefinitionType { + return allowedMonitorSummaryWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorSummaryWidgetDefinitionType(value) + return nil +} + +// NewMonitorSummaryWidgetDefinitionTypeFromValue returns a pointer to a valid MonitorSummaryWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorSummaryWidgetDefinitionTypeFromValue(v string) (*MonitorSummaryWidgetDefinitionType, error) { + ev := MonitorSummaryWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorSummaryWidgetDefinitionType: valid values are %v", v, allowedMonitorSummaryWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorSummaryWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedMonitorSummaryWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorSummaryWidgetDefinitionType value. +func (v MonitorSummaryWidgetDefinitionType) Ptr() *MonitorSummaryWidgetDefinitionType { + return &v +} + +// NullableMonitorSummaryWidgetDefinitionType handles when a null is used for MonitorSummaryWidgetDefinitionType. +type NullableMonitorSummaryWidgetDefinitionType struct { + value *MonitorSummaryWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorSummaryWidgetDefinitionType) Get() *MonitorSummaryWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorSummaryWidgetDefinitionType) Set(val *MonitorSummaryWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorSummaryWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonitorSummaryWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorSummaryWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableMonitorSummaryWidgetDefinitionType(val *MonitorSummaryWidgetDefinitionType) *NullableMonitorSummaryWidgetDefinitionType { + return &NullableMonitorSummaryWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorSummaryWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_threshold_window_options.go b/api/v1/datadog/model_monitor_threshold_window_options.go new file mode 100644 index 00000000000..2e46b6e4d0f --- /dev/null +++ b/api/v1/datadog/model_monitor_threshold_window_options.go @@ -0,0 +1,165 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonitorThresholdWindowOptions Alerting time window options. +type MonitorThresholdWindowOptions struct { + // Describes how long an anomalous metric must be normal before the alert recovers. + RecoveryWindow common.NullableString `json:"recovery_window,omitempty"` + // Describes how long a metric must be anomalous before an alert triggers. + TriggerWindow common.NullableString `json:"trigger_window,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{} +} + +// NewMonitorThresholdWindowOptions instantiates a new MonitorThresholdWindowOptions 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 NewMonitorThresholdWindowOptions() *MonitorThresholdWindowOptions { + this := MonitorThresholdWindowOptions{} + return &this +} + +// NewMonitorThresholdWindowOptionsWithDefaults instantiates a new MonitorThresholdWindowOptions 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 NewMonitorThresholdWindowOptionsWithDefaults() *MonitorThresholdWindowOptions { + this := MonitorThresholdWindowOptions{} + return &this +} + +// GetRecoveryWindow returns the RecoveryWindow field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorThresholdWindowOptions) GetRecoveryWindow() string { + if o == nil || o.RecoveryWindow.Get() == nil { + var ret string + return ret + } + return *o.RecoveryWindow.Get() +} + +// GetRecoveryWindowOk returns a tuple with the RecoveryWindow 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 *MonitorThresholdWindowOptions) GetRecoveryWindowOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.RecoveryWindow.Get(), o.RecoveryWindow.IsSet() +} + +// HasRecoveryWindow returns a boolean if a field has been set. +func (o *MonitorThresholdWindowOptions) HasRecoveryWindow() bool { + if o != nil && o.RecoveryWindow.IsSet() { + return true + } + + return false +} + +// SetRecoveryWindow gets a reference to the given common.NullableString and assigns it to the RecoveryWindow field. +func (o *MonitorThresholdWindowOptions) SetRecoveryWindow(v string) { + o.RecoveryWindow.Set(&v) +} + +// SetRecoveryWindowNil sets the value for RecoveryWindow to be an explicit nil. +func (o *MonitorThresholdWindowOptions) SetRecoveryWindowNil() { + o.RecoveryWindow.Set(nil) +} + +// UnsetRecoveryWindow ensures that no value is present for RecoveryWindow, not even an explicit nil. +func (o *MonitorThresholdWindowOptions) UnsetRecoveryWindow() { + o.RecoveryWindow.Unset() +} + +// GetTriggerWindow returns the TriggerWindow field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorThresholdWindowOptions) GetTriggerWindow() string { + if o == nil || o.TriggerWindow.Get() == nil { + var ret string + return ret + } + return *o.TriggerWindow.Get() +} + +// GetTriggerWindowOk returns a tuple with the TriggerWindow 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 *MonitorThresholdWindowOptions) GetTriggerWindowOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TriggerWindow.Get(), o.TriggerWindow.IsSet() +} + +// HasTriggerWindow returns a boolean if a field has been set. +func (o *MonitorThresholdWindowOptions) HasTriggerWindow() bool { + if o != nil && o.TriggerWindow.IsSet() { + return true + } + + return false +} + +// SetTriggerWindow gets a reference to the given common.NullableString and assigns it to the TriggerWindow field. +func (o *MonitorThresholdWindowOptions) SetTriggerWindow(v string) { + o.TriggerWindow.Set(&v) +} + +// SetTriggerWindowNil sets the value for TriggerWindow to be an explicit nil. +func (o *MonitorThresholdWindowOptions) SetTriggerWindowNil() { + o.TriggerWindow.Set(nil) +} + +// UnsetTriggerWindow ensures that no value is present for TriggerWindow, not even an explicit nil. +func (o *MonitorThresholdWindowOptions) UnsetTriggerWindow() { + o.TriggerWindow.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorThresholdWindowOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.RecoveryWindow.IsSet() { + toSerialize["recovery_window"] = o.RecoveryWindow.Get() + } + if o.TriggerWindow.IsSet() { + toSerialize["trigger_window"] = o.TriggerWindow.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorThresholdWindowOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + RecoveryWindow common.NullableString `json:"recovery_window,omitempty"` + TriggerWindow common.NullableString `json:"trigger_window,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.RecoveryWindow = all.RecoveryWindow + o.TriggerWindow = all.TriggerWindow + return nil +} diff --git a/api/v1/datadog/model_monitor_thresholds.go b/api/v1/datadog/model_monitor_thresholds.go new file mode 100644 index 00000000000..51d5788d157 --- /dev/null +++ b/api/v1/datadog/model_monitor_thresholds.go @@ -0,0 +1,354 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonitorThresholds List of the different monitor threshold available. +type MonitorThresholds struct { + // The monitor `CRITICAL` threshold. + Critical *float64 `json:"critical,omitempty"` + // The monitor `CRITICAL` recovery threshold. + CriticalRecovery common.NullableFloat64 `json:"critical_recovery,omitempty"` + // The monitor `OK` threshold. + Ok common.NullableFloat64 `json:"ok,omitempty"` + // The monitor UNKNOWN threshold. + Unknown common.NullableFloat64 `json:"unknown,omitempty"` + // The monitor `WARNING` threshold. + Warning common.NullableFloat64 `json:"warning,omitempty"` + // The monitor `WARNING` recovery threshold. + WarningRecovery common.NullableFloat64 `json:"warning_recovery,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{} +} + +// NewMonitorThresholds instantiates a new MonitorThresholds 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 NewMonitorThresholds() *MonitorThresholds { + this := MonitorThresholds{} + return &this +} + +// NewMonitorThresholdsWithDefaults instantiates a new MonitorThresholds 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 NewMonitorThresholdsWithDefaults() *MonitorThresholds { + this := MonitorThresholds{} + return &this +} + +// GetCritical returns the Critical field value if set, zero value otherwise. +func (o *MonitorThresholds) GetCritical() float64 { + if o == nil || o.Critical == nil { + var ret float64 + return ret + } + return *o.Critical +} + +// GetCriticalOk returns a tuple with the Critical field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorThresholds) GetCriticalOk() (*float64, bool) { + if o == nil || o.Critical == nil { + return nil, false + } + return o.Critical, true +} + +// HasCritical returns a boolean if a field has been set. +func (o *MonitorThresholds) HasCritical() bool { + if o != nil && o.Critical != nil { + return true + } + + return false +} + +// SetCritical gets a reference to the given float64 and assigns it to the Critical field. +func (o *MonitorThresholds) SetCritical(v float64) { + o.Critical = &v +} + +// GetCriticalRecovery returns the CriticalRecovery field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorThresholds) GetCriticalRecovery() float64 { + if o == nil || o.CriticalRecovery.Get() == nil { + var ret float64 + return ret + } + return *o.CriticalRecovery.Get() +} + +// GetCriticalRecoveryOk returns a tuple with the CriticalRecovery 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 *MonitorThresholds) GetCriticalRecoveryOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.CriticalRecovery.Get(), o.CriticalRecovery.IsSet() +} + +// HasCriticalRecovery returns a boolean if a field has been set. +func (o *MonitorThresholds) HasCriticalRecovery() bool { + if o != nil && o.CriticalRecovery.IsSet() { + return true + } + + return false +} + +// SetCriticalRecovery gets a reference to the given common.NullableFloat64 and assigns it to the CriticalRecovery field. +func (o *MonitorThresholds) SetCriticalRecovery(v float64) { + o.CriticalRecovery.Set(&v) +} + +// SetCriticalRecoveryNil sets the value for CriticalRecovery to be an explicit nil. +func (o *MonitorThresholds) SetCriticalRecoveryNil() { + o.CriticalRecovery.Set(nil) +} + +// UnsetCriticalRecovery ensures that no value is present for CriticalRecovery, not even an explicit nil. +func (o *MonitorThresholds) UnsetCriticalRecovery() { + o.CriticalRecovery.Unset() +} + +// GetOk returns the Ok field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorThresholds) GetOk() float64 { + if o == nil || o.Ok.Get() == nil { + var ret float64 + return ret + } + return *o.Ok.Get() +} + +// GetOkOk returns a tuple with the Ok 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 *MonitorThresholds) GetOkOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.Ok.Get(), o.Ok.IsSet() +} + +// HasOk returns a boolean if a field has been set. +func (o *MonitorThresholds) HasOk() bool { + if o != nil && o.Ok.IsSet() { + return true + } + + return false +} + +// SetOk gets a reference to the given common.NullableFloat64 and assigns it to the Ok field. +func (o *MonitorThresholds) SetOk(v float64) { + o.Ok.Set(&v) +} + +// SetOkNil sets the value for Ok to be an explicit nil. +func (o *MonitorThresholds) SetOkNil() { + o.Ok.Set(nil) +} + +// UnsetOk ensures that no value is present for Ok, not even an explicit nil. +func (o *MonitorThresholds) UnsetOk() { + o.Ok.Unset() +} + +// GetUnknown returns the Unknown field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorThresholds) GetUnknown() float64 { + if o == nil || o.Unknown.Get() == nil { + var ret float64 + return ret + } + return *o.Unknown.Get() +} + +// GetUnknownOk returns a tuple with the Unknown 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 *MonitorThresholds) GetUnknownOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.Unknown.Get(), o.Unknown.IsSet() +} + +// HasUnknown returns a boolean if a field has been set. +func (o *MonitorThresholds) HasUnknown() bool { + if o != nil && o.Unknown.IsSet() { + return true + } + + return false +} + +// SetUnknown gets a reference to the given common.NullableFloat64 and assigns it to the Unknown field. +func (o *MonitorThresholds) SetUnknown(v float64) { + o.Unknown.Set(&v) +} + +// SetUnknownNil sets the value for Unknown to be an explicit nil. +func (o *MonitorThresholds) SetUnknownNil() { + o.Unknown.Set(nil) +} + +// UnsetUnknown ensures that no value is present for Unknown, not even an explicit nil. +func (o *MonitorThresholds) UnsetUnknown() { + o.Unknown.Unset() +} + +// GetWarning returns the Warning field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorThresholds) GetWarning() float64 { + if o == nil || o.Warning.Get() == nil { + var ret float64 + return ret + } + return *o.Warning.Get() +} + +// GetWarningOk returns a tuple with the Warning 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 *MonitorThresholds) GetWarningOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.Warning.Get(), o.Warning.IsSet() +} + +// HasWarning returns a boolean if a field has been set. +func (o *MonitorThresholds) HasWarning() bool { + if o != nil && o.Warning.IsSet() { + return true + } + + return false +} + +// SetWarning gets a reference to the given common.NullableFloat64 and assigns it to the Warning field. +func (o *MonitorThresholds) SetWarning(v float64) { + o.Warning.Set(&v) +} + +// SetWarningNil sets the value for Warning to be an explicit nil. +func (o *MonitorThresholds) SetWarningNil() { + o.Warning.Set(nil) +} + +// UnsetWarning ensures that no value is present for Warning, not even an explicit nil. +func (o *MonitorThresholds) UnsetWarning() { + o.Warning.Unset() +} + +// GetWarningRecovery returns the WarningRecovery field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorThresholds) GetWarningRecovery() float64 { + if o == nil || o.WarningRecovery.Get() == nil { + var ret float64 + return ret + } + return *o.WarningRecovery.Get() +} + +// GetWarningRecoveryOk returns a tuple with the WarningRecovery 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 *MonitorThresholds) GetWarningRecoveryOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.WarningRecovery.Get(), o.WarningRecovery.IsSet() +} + +// HasWarningRecovery returns a boolean if a field has been set. +func (o *MonitorThresholds) HasWarningRecovery() bool { + if o != nil && o.WarningRecovery.IsSet() { + return true + } + + return false +} + +// SetWarningRecovery gets a reference to the given common.NullableFloat64 and assigns it to the WarningRecovery field. +func (o *MonitorThresholds) SetWarningRecovery(v float64) { + o.WarningRecovery.Set(&v) +} + +// SetWarningRecoveryNil sets the value for WarningRecovery to be an explicit nil. +func (o *MonitorThresholds) SetWarningRecoveryNil() { + o.WarningRecovery.Set(nil) +} + +// UnsetWarningRecovery ensures that no value is present for WarningRecovery, not even an explicit nil. +func (o *MonitorThresholds) UnsetWarningRecovery() { + o.WarningRecovery.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorThresholds) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Critical != nil { + toSerialize["critical"] = o.Critical + } + if o.CriticalRecovery.IsSet() { + toSerialize["critical_recovery"] = o.CriticalRecovery.Get() + } + if o.Ok.IsSet() { + toSerialize["ok"] = o.Ok.Get() + } + if o.Unknown.IsSet() { + toSerialize["unknown"] = o.Unknown.Get() + } + if o.Warning.IsSet() { + toSerialize["warning"] = o.Warning.Get() + } + if o.WarningRecovery.IsSet() { + toSerialize["warning_recovery"] = o.WarningRecovery.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorThresholds) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Critical *float64 `json:"critical,omitempty"` + CriticalRecovery common.NullableFloat64 `json:"critical_recovery,omitempty"` + Ok common.NullableFloat64 `json:"ok,omitempty"` + Unknown common.NullableFloat64 `json:"unknown,omitempty"` + Warning common.NullableFloat64 `json:"warning,omitempty"` + WarningRecovery common.NullableFloat64 `json:"warning_recovery,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Critical = all.Critical + o.CriticalRecovery = all.CriticalRecovery + o.Ok = all.Ok + o.Unknown = all.Unknown + o.Warning = all.Warning + o.WarningRecovery = all.WarningRecovery + return nil +} diff --git a/api/v1/datadog/model_monitor_type.go b/api/v1/datadog/model_monitor_type.go new file mode 100644 index 00000000000..c8fd2682cc5 --- /dev/null +++ b/api/v1/datadog/model_monitor_type.go @@ -0,0 +1,137 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonitorType The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. +type MonitorType string + +// List of MonitorType. +const ( + MONITORTYPE_COMPOSITE MonitorType = "composite" + MONITORTYPE_EVENT_ALERT MonitorType = "event alert" + MONITORTYPE_LOG_ALERT MonitorType = "log alert" + MONITORTYPE_METRIC_ALERT MonitorType = "metric alert" + MONITORTYPE_PROCESS_ALERT MonitorType = "process alert" + MONITORTYPE_QUERY_ALERT MonitorType = "query alert" + MONITORTYPE_RUM_ALERT MonitorType = "rum alert" + MONITORTYPE_SERVICE_CHECK MonitorType = "service check" + MONITORTYPE_SYNTHETICS_ALERT MonitorType = "synthetics alert" + MONITORTYPE_TRACE_ANALYTICS_ALERT MonitorType = "trace-analytics alert" + MONITORTYPE_SLO_ALERT MonitorType = "slo alert" + MONITORTYPE_EVENT_V2_ALERT MonitorType = "event-v2 alert" + MONITORTYPE_AUDIT_ALERT MonitorType = "audit alert" + MONITORTYPE_CI_PIPELINES_ALERT MonitorType = "ci-pipelines alert" + MONITORTYPE_CI_TESTS_ALERT MonitorType = "ci-tests alert" + MONITORTYPE_ERROR_TRACKING_ALERT MonitorType = "error-tracking alert" +) + +var allowedMonitorTypeEnumValues = []MonitorType{ + MONITORTYPE_COMPOSITE, + MONITORTYPE_EVENT_ALERT, + MONITORTYPE_LOG_ALERT, + MONITORTYPE_METRIC_ALERT, + MONITORTYPE_PROCESS_ALERT, + MONITORTYPE_QUERY_ALERT, + MONITORTYPE_RUM_ALERT, + MONITORTYPE_SERVICE_CHECK, + MONITORTYPE_SYNTHETICS_ALERT, + MONITORTYPE_TRACE_ANALYTICS_ALERT, + MONITORTYPE_SLO_ALERT, + MONITORTYPE_EVENT_V2_ALERT, + MONITORTYPE_AUDIT_ALERT, + MONITORTYPE_CI_PIPELINES_ALERT, + MONITORTYPE_CI_TESTS_ALERT, + MONITORTYPE_ERROR_TRACKING_ALERT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonitorType) GetAllowedValues() []MonitorType { + return allowedMonitorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonitorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonitorType(value) + return nil +} + +// NewMonitorTypeFromValue returns a pointer to a valid MonitorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonitorTypeFromValue(v string) (*MonitorType, error) { + ev := MonitorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonitorType: valid values are %v", v, allowedMonitorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonitorType) IsValid() bool { + for _, existing := range allowedMonitorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonitorType value. +func (v MonitorType) Ptr() *MonitorType { + return &v +} + +// NullableMonitorType handles when a null is used for MonitorType. +type NullableMonitorType struct { + value *MonitorType + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorType) Get() *MonitorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorType) Set(val *MonitorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonitorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorType initializes the struct as if Set has been called. +func NewNullableMonitorType(val *MonitorType) *NullableMonitorType { + return &NullableMonitorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monitor_update_request.go b/api/v1/datadog/model_monitor_update_request.go new file mode 100644 index 00000000000..dd631de60e4 --- /dev/null +++ b/api/v1/datadog/model_monitor_update_request.go @@ -0,0 +1,746 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonitorUpdateRequest Object describing a monitor update request. +type MonitorUpdateRequest struct { + // Timestamp of the monitor creation. + Created *time.Time `json:"created,omitempty"` + // Object describing the creator of the shared element. + Creator *Creator `json:"creator,omitempty"` + // Whether or not the monitor is deleted. (Always `null`) + Deleted common.NullableTime `json:"deleted,omitempty"` + // ID of this monitor. + Id *int64 `json:"id,omitempty"` + // A message to include with notifications for this monitor. + Message *string `json:"message,omitempty"` + // Last timestamp when the monitor was edited. + Modified *time.Time `json:"modified,omitempty"` + // Whether or not the monitor is broken down on different groups. + Multi *bool `json:"multi,omitempty"` + // The monitor name. + Name *string `json:"name,omitempty"` + // List of options associated with your monitor. + Options *MonitorOptions `json:"options,omitempty"` + // The different states your monitor can be in. + OverallState *MonitorOverallStates `json:"overall_state,omitempty"` + // Integer from 1 (high) to 5 (low) indicating alert severity. + Priority *int64 `json:"priority,omitempty"` + // The monitor query. + Query *string `json:"query,omitempty"` + // A list of unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the [Roles API](https://docs.datadoghq.com/api/latest/roles/#list-roles) and are located in the `data.id` field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. `restricted_roles` is the successor of `locked`. For more information about `locked` and `restricted_roles`, see the [monitor options docs](https://docs.datadoghq.com/monitors/guide/monitor_api_options/#permissions-options). + RestrictedRoles []string `json:"restricted_roles,omitempty"` + // Wrapper object with the different monitor states. + State *MonitorState `json:"state,omitempty"` + // Tags associated to your monitor. + Tags []string `json:"tags,omitempty"` + // The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. + Type *MonitorType `json:"type,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{} +} + +// NewMonitorUpdateRequest instantiates a new MonitorUpdateRequest 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 NewMonitorUpdateRequest() *MonitorUpdateRequest { + this := MonitorUpdateRequest{} + return &this +} + +// NewMonitorUpdateRequestWithDefaults instantiates a new MonitorUpdateRequest 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 NewMonitorUpdateRequestWithDefaults() *MonitorUpdateRequest { + this := MonitorUpdateRequest{} + return &this +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *MonitorUpdateRequest) SetCreated(v time.Time) { + o.Created = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetCreator() Creator { + if o == nil || o.Creator == nil { + var ret Creator + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetCreatorOk() (*Creator, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given Creator and assigns it to the Creator field. +func (o *MonitorUpdateRequest) SetCreator(v Creator) { + o.Creator = &v +} + +// GetDeleted returns the Deleted field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonitorUpdateRequest) GetDeleted() time.Time { + if o == nil || o.Deleted.Get() == nil { + var ret time.Time + return ret + } + return *o.Deleted.Get() +} + +// GetDeletedOk returns a tuple with the Deleted 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 *MonitorUpdateRequest) GetDeletedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Deleted.Get(), o.Deleted.IsSet() +} + +// HasDeleted returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasDeleted() bool { + if o != nil && o.Deleted.IsSet() { + return true + } + + return false +} + +// SetDeleted gets a reference to the given common.NullableTime and assigns it to the Deleted field. +func (o *MonitorUpdateRequest) SetDeleted(v time.Time) { + o.Deleted.Set(&v) +} + +// SetDeletedNil sets the value for Deleted to be an explicit nil. +func (o *MonitorUpdateRequest) SetDeletedNil() { + o.Deleted.Set(nil) +} + +// UnsetDeleted ensures that no value is present for Deleted, not even an explicit nil. +func (o *MonitorUpdateRequest) UnsetDeleted() { + o.Deleted.Unset() +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *MonitorUpdateRequest) SetId(v int64) { + o.Id = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *MonitorUpdateRequest) SetMessage(v string) { + o.Message = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *MonitorUpdateRequest) SetModified(v time.Time) { + o.Modified = &v +} + +// GetMulti returns the Multi field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetMulti() bool { + if o == nil || o.Multi == nil { + var ret bool + return ret + } + return *o.Multi +} + +// GetMultiOk returns a tuple with the Multi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetMultiOk() (*bool, bool) { + if o == nil || o.Multi == nil { + return nil, false + } + return o.Multi, true +} + +// HasMulti returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasMulti() bool { + if o != nil && o.Multi != nil { + return true + } + + return false +} + +// SetMulti gets a reference to the given bool and assigns it to the Multi field. +func (o *MonitorUpdateRequest) SetMulti(v bool) { + o.Multi = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MonitorUpdateRequest) SetName(v string) { + o.Name = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetOptions() MonitorOptions { + if o == nil || o.Options == nil { + var ret MonitorOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetOptionsOk() (*MonitorOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given MonitorOptions and assigns it to the Options field. +func (o *MonitorUpdateRequest) SetOptions(v MonitorOptions) { + o.Options = &v +} + +// GetOverallState returns the OverallState field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetOverallState() MonitorOverallStates { + if o == nil || o.OverallState == nil { + var ret MonitorOverallStates + return ret + } + return *o.OverallState +} + +// GetOverallStateOk returns a tuple with the OverallState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetOverallStateOk() (*MonitorOverallStates, bool) { + if o == nil || o.OverallState == nil { + return nil, false + } + return o.OverallState, true +} + +// HasOverallState returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasOverallState() bool { + if o != nil && o.OverallState != nil { + return true + } + + return false +} + +// SetOverallState gets a reference to the given MonitorOverallStates and assigns it to the OverallState field. +func (o *MonitorUpdateRequest) SetOverallState(v MonitorOverallStates) { + o.OverallState = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetPriority() int64 { + if o == nil || o.Priority == nil { + var ret int64 + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetPriorityOk() (*int64, bool) { + if o == nil || o.Priority == nil { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasPriority() bool { + if o != nil && o.Priority != nil { + return true + } + + return false +} + +// SetPriority gets a reference to the given int64 and assigns it to the Priority field. +func (o *MonitorUpdateRequest) SetPriority(v int64) { + o.Priority = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *MonitorUpdateRequest) SetQuery(v string) { + o.Query = &v +} + +// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetRestrictedRoles() []string { + if o == nil || o.RestrictedRoles == nil { + var ret []string + return ret + } + return o.RestrictedRoles +} + +// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetRestrictedRolesOk() (*[]string, bool) { + if o == nil || o.RestrictedRoles == nil { + return nil, false + } + return &o.RestrictedRoles, true +} + +// HasRestrictedRoles returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasRestrictedRoles() bool { + if o != nil && o.RestrictedRoles != nil { + return true + } + + return false +} + +// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. +func (o *MonitorUpdateRequest) SetRestrictedRoles(v []string) { + o.RestrictedRoles = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetState() MonitorState { + if o == nil || o.State == nil { + var ret MonitorState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetStateOk() (*MonitorState, bool) { + if o == nil || o.State == nil { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + +// SetState gets a reference to the given MonitorState and assigns it to the State field. +func (o *MonitorUpdateRequest) SetState(v MonitorState) { + o.State = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MonitorUpdateRequest) GetTagsOk() (*[]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 *MonitorUpdateRequest) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MonitorUpdateRequest) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MonitorUpdateRequest) GetType() MonitorType { + if o == nil || o.Type == nil { + var ret MonitorType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorUpdateRequest) GetTypeOk() (*MonitorType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MonitorUpdateRequest) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MonitorType and assigns it to the Type field. +func (o *MonitorUpdateRequest) SetType(v MonitorType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.Deleted.IsSet() { + toSerialize["deleted"] = o.Deleted.Get() + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Multi != nil { + toSerialize["multi"] = o.Multi + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.OverallState != nil { + toSerialize["overall_state"] = o.OverallState + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.RestrictedRoles != nil { + toSerialize["restricted_roles"] = o.RestrictedRoles + } + if o.State != nil { + toSerialize["state"] = o.State + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Created *time.Time `json:"created,omitempty"` + Creator *Creator `json:"creator,omitempty"` + Deleted common.NullableTime `json:"deleted,omitempty"` + Id *int64 `json:"id,omitempty"` + Message *string `json:"message,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Multi *bool `json:"multi,omitempty"` + Name *string `json:"name,omitempty"` + Options *MonitorOptions `json:"options,omitempty"` + OverallState *MonitorOverallStates `json:"overall_state,omitempty"` + Priority *int64 `json:"priority,omitempty"` + Query *string `json:"query,omitempty"` + RestrictedRoles []string `json:"restricted_roles,omitempty"` + State *MonitorState `json:"state,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *MonitorType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.OverallState; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Created = all.Created + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.Deleted = all.Deleted + o.Id = all.Id + o.Message = all.Message + o.Modified = all.Modified + o.Multi = all.Multi + o.Name = all.Name + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.OverallState = all.OverallState + o.Priority = all.Priority + o.Query = all.Query + o.RestrictedRoles = all.RestrictedRoles + if all.State != nil && all.State.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.State = all.State + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_monthly_usage_attribution_body.go b/api/v1/datadog/model_monthly_usage_attribution_body.go new file mode 100644 index 00000000000..8f88a93ad9f --- /dev/null +++ b/api/v1/datadog/model_monthly_usage_attribution_body.go @@ -0,0 +1,356 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// MonthlyUsageAttributionBody Usage Summary by tag for a given organization. +type MonthlyUsageAttributionBody struct { + // Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM]. + Month *time.Time `json:"month,omitempty"` + // The name of the organization. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The source of the usage attribution tag configuration and the selected tags in the format `::://////`. + TagConfigSource *string `json:"tag_config_source,omitempty"` + // Tag keys and values. + // + // A `null` value here means that the requested tag breakdown cannot be applied because it does not match the [tags + // configured for usage attribution](https://docs.datadoghq.com/account_management/billing/usage_attribution/#getting-started). + // In this scenario the API returns the total usage, not broken down by tags. + Tags map[string][]string `json:"tags,omitempty"` + // Datetime of the most recent update to the usage values. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Fields in Usage Summary by tag(s). + Values *MonthlyUsageAttributionValues `json:"values,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{} +} + +// NewMonthlyUsageAttributionBody instantiates a new MonthlyUsageAttributionBody 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 NewMonthlyUsageAttributionBody() *MonthlyUsageAttributionBody { + this := MonthlyUsageAttributionBody{} + return &this +} + +// NewMonthlyUsageAttributionBodyWithDefaults instantiates a new MonthlyUsageAttributionBody 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 NewMonthlyUsageAttributionBodyWithDefaults() *MonthlyUsageAttributionBody { + this := MonthlyUsageAttributionBody{} + return &this +} + +// GetMonth returns the Month field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionBody) GetMonth() time.Time { + if o == nil || o.Month == nil { + var ret time.Time + return ret + } + return *o.Month +} + +// GetMonthOk returns a tuple with the Month field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionBody) GetMonthOk() (*time.Time, bool) { + if o == nil || o.Month == nil { + return nil, false + } + return o.Month, true +} + +// HasMonth returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionBody) HasMonth() bool { + if o != nil && o.Month != nil { + return true + } + + return false +} + +// SetMonth gets a reference to the given time.Time and assigns it to the Month field. +func (o *MonthlyUsageAttributionBody) SetMonth(v time.Time) { + o.Month = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionBody) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionBody) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionBody) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *MonthlyUsageAttributionBody) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionBody) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionBody) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionBody) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *MonthlyUsageAttributionBody) SetPublicId(v string) { + o.PublicId = &v +} + +// GetTagConfigSource returns the TagConfigSource field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionBody) GetTagConfigSource() string { + if o == nil || o.TagConfigSource == nil { + var ret string + return ret + } + return *o.TagConfigSource +} + +// GetTagConfigSourceOk returns a tuple with the TagConfigSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionBody) GetTagConfigSourceOk() (*string, bool) { + if o == nil || o.TagConfigSource == nil { + return nil, false + } + return o.TagConfigSource, true +} + +// HasTagConfigSource returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionBody) HasTagConfigSource() bool { + if o != nil && o.TagConfigSource != nil { + return true + } + + return false +} + +// SetTagConfigSource gets a reference to the given string and assigns it to the TagConfigSource field. +func (o *MonthlyUsageAttributionBody) SetTagConfigSource(v string) { + o.TagConfigSource = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionBody) 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 *MonthlyUsageAttributionBody) 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 *MonthlyUsageAttributionBody) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. +func (o *MonthlyUsageAttributionBody) SetTags(v map[string][]string) { + o.Tags = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionBody) GetUpdatedAt() time.Time { + if o == nil || o.UpdatedAt == nil { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionBody) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionBody) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *MonthlyUsageAttributionBody) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionBody) GetValues() MonthlyUsageAttributionValues { + if o == nil || o.Values == nil { + var ret MonthlyUsageAttributionValues + return ret + } + return *o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionBody) GetValuesOk() (*MonthlyUsageAttributionValues, bool) { + if o == nil || o.Values == nil { + return nil, false + } + return o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionBody) HasValues() bool { + if o != nil && o.Values != nil { + return true + } + + return false +} + +// SetValues gets a reference to the given MonthlyUsageAttributionValues and assigns it to the Values field. +func (o *MonthlyUsageAttributionBody) SetValues(v MonthlyUsageAttributionValues) { + o.Values = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonthlyUsageAttributionBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Month != nil { + if o.Month.Nanosecond() == 0 { + toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.TagConfigSource != nil { + toSerialize["tag_config_source"] = o.TagConfigSource + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.UpdatedAt != nil { + if o.UpdatedAt.Nanosecond() == 0 { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Values != nil { + toSerialize["values"] = o.Values + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonthlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Month *time.Time `json:"month,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + TagConfigSource *string `json:"tag_config_source,omitempty"` + Tags map[string][]string `json:"tags,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Values *MonthlyUsageAttributionValues `json:"values,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Month = all.Month + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.TagConfigSource = all.TagConfigSource + o.Tags = all.Tags + o.UpdatedAt = all.UpdatedAt + if all.Values != nil && all.Values.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Values = all.Values + return nil +} diff --git a/api/v1/datadog/model_monthly_usage_attribution_metadata.go b/api/v1/datadog/model_monthly_usage_attribution_metadata.go new file mode 100644 index 00000000000..a5b04c27487 --- /dev/null +++ b/api/v1/datadog/model_monthly_usage_attribution_metadata.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 datadog + +import ( + "encoding/json" +) + +// MonthlyUsageAttributionMetadata The object containing document metadata. +type MonthlyUsageAttributionMetadata struct { + // An array of available aggregates. + Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` + // The metadata for the current pagination. + Pagination *MonthlyUsageAttributionPagination `json:"pagination,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{} +} + +// NewMonthlyUsageAttributionMetadata instantiates a new MonthlyUsageAttributionMetadata 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 NewMonthlyUsageAttributionMetadata() *MonthlyUsageAttributionMetadata { + this := MonthlyUsageAttributionMetadata{} + return &this +} + +// NewMonthlyUsageAttributionMetadataWithDefaults instantiates a new MonthlyUsageAttributionMetadata 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 NewMonthlyUsageAttributionMetadataWithDefaults() *MonthlyUsageAttributionMetadata { + this := MonthlyUsageAttributionMetadata{} + return &this +} + +// GetAggregates returns the Aggregates field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionMetadata) GetAggregates() []UsageAttributionAggregatesBody { + if o == nil || o.Aggregates == nil { + var ret []UsageAttributionAggregatesBody + return ret + } + return o.Aggregates +} + +// GetAggregatesOk returns a tuple with the Aggregates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionMetadata) GetAggregatesOk() (*[]UsageAttributionAggregatesBody, bool) { + if o == nil || o.Aggregates == nil { + return nil, false + } + return &o.Aggregates, true +} + +// HasAggregates returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionMetadata) HasAggregates() bool { + if o != nil && o.Aggregates != nil { + return true + } + + return false +} + +// SetAggregates gets a reference to the given []UsageAttributionAggregatesBody and assigns it to the Aggregates field. +func (o *MonthlyUsageAttributionMetadata) SetAggregates(v []UsageAttributionAggregatesBody) { + o.Aggregates = v +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionMetadata) GetPagination() MonthlyUsageAttributionPagination { + if o == nil || o.Pagination == nil { + var ret MonthlyUsageAttributionPagination + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionMetadata) GetPaginationOk() (*MonthlyUsageAttributionPagination, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionMetadata) HasPagination() bool { + if o != nil && o.Pagination != nil { + return true + } + + return false +} + +// SetPagination gets a reference to the given MonthlyUsageAttributionPagination and assigns it to the Pagination field. +func (o *MonthlyUsageAttributionMetadata) SetPagination(v MonthlyUsageAttributionPagination) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonthlyUsageAttributionMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregates != nil { + toSerialize["aggregates"] = o.Aggregates + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonthlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` + Pagination *MonthlyUsageAttributionPagination `json:"pagination,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregates = all.Aggregates + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pagination = all.Pagination + return nil +} diff --git a/api/v1/datadog/model_monthly_usage_attribution_pagination.go b/api/v1/datadog/model_monthly_usage_attribution_pagination.go new file mode 100644 index 00000000000..8911a263d65 --- /dev/null +++ b/api/v1/datadog/model_monthly_usage_attribution_pagination.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MonthlyUsageAttributionPagination The metadata for the current pagination. +type MonthlyUsageAttributionPagination struct { + // The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of the `next_record_id`. + NextRecordId common.NullableString `json:"next_record_id,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{} +} + +// NewMonthlyUsageAttributionPagination instantiates a new MonthlyUsageAttributionPagination 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 NewMonthlyUsageAttributionPagination() *MonthlyUsageAttributionPagination { + this := MonthlyUsageAttributionPagination{} + return &this +} + +// NewMonthlyUsageAttributionPaginationWithDefaults instantiates a new MonthlyUsageAttributionPagination 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 NewMonthlyUsageAttributionPaginationWithDefaults() *MonthlyUsageAttributionPagination { + this := MonthlyUsageAttributionPagination{} + return &this +} + +// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MonthlyUsageAttributionPagination) GetNextRecordId() string { + if o == nil || o.NextRecordId.Get() == nil { + var ret string + return ret + } + return *o.NextRecordId.Get() +} + +// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *MonthlyUsageAttributionPagination) GetNextRecordIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NextRecordId.Get(), o.NextRecordId.IsSet() +} + +// HasNextRecordId returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionPagination) HasNextRecordId() bool { + if o != nil && o.NextRecordId.IsSet() { + return true + } + + return false +} + +// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. +func (o *MonthlyUsageAttributionPagination) SetNextRecordId(v string) { + o.NextRecordId.Set(&v) +} + +// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. +func (o *MonthlyUsageAttributionPagination) SetNextRecordIdNil() { + o.NextRecordId.Set(nil) +} + +// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. +func (o *MonthlyUsageAttributionPagination) UnsetNextRecordId() { + o.NextRecordId.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonthlyUsageAttributionPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.NextRecordId.IsSet() { + toSerialize["next_record_id"] = o.NextRecordId.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonthlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + NextRecordId common.NullableString `json:"next_record_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.NextRecordId = all.NextRecordId + return nil +} diff --git a/api/v1/datadog/model_monthly_usage_attribution_response.go b/api/v1/datadog/model_monthly_usage_attribution_response.go new file mode 100644 index 00000000000..9c7c9ac5914 --- /dev/null +++ b/api/v1/datadog/model_monthly_usage_attribution_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 datadog + +import ( + "encoding/json" +) + +// MonthlyUsageAttributionResponse Response containing the monthly Usage Summary by tag(s). +type MonthlyUsageAttributionResponse struct { + // The object containing document metadata. + Metadata *MonthlyUsageAttributionMetadata `json:"metadata,omitempty"` + // Get usage summary by tag(s). + Usage []MonthlyUsageAttributionBody `json:"usage,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{} +} + +// NewMonthlyUsageAttributionResponse instantiates a new MonthlyUsageAttributionResponse 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 NewMonthlyUsageAttributionResponse() *MonthlyUsageAttributionResponse { + this := MonthlyUsageAttributionResponse{} + return &this +} + +// NewMonthlyUsageAttributionResponseWithDefaults instantiates a new MonthlyUsageAttributionResponse 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 NewMonthlyUsageAttributionResponseWithDefaults() *MonthlyUsageAttributionResponse { + this := MonthlyUsageAttributionResponse{} + return &this +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionResponse) GetMetadata() MonthlyUsageAttributionMetadata { + if o == nil || o.Metadata == nil { + var ret MonthlyUsageAttributionMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionResponse) GetMetadataOk() (*MonthlyUsageAttributionMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionResponse) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given MonthlyUsageAttributionMetadata and assigns it to the Metadata field. +func (o *MonthlyUsageAttributionResponse) SetMetadata(v MonthlyUsageAttributionMetadata) { + o.Metadata = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionResponse) GetUsage() []MonthlyUsageAttributionBody { + if o == nil || o.Usage == nil { + var ret []MonthlyUsageAttributionBody + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionResponse) GetUsageOk() (*[]MonthlyUsageAttributionBody, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []MonthlyUsageAttributionBody and assigns it to the Usage field. +func (o *MonthlyUsageAttributionResponse) SetUsage(v []MonthlyUsageAttributionBody) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonthlyUsageAttributionResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonthlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Metadata *MonthlyUsageAttributionMetadata `json:"metadata,omitempty"` + Usage []MonthlyUsageAttributionBody `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go b/api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go new file mode 100644 index 00000000000..14e4838e2c9 --- /dev/null +++ b/api/v1/datadog/model_monthly_usage_attribution_supported_metrics.go @@ -0,0 +1,203 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MonthlyUsageAttributionSupportedMetrics Supported metrics for monthly usage attribution requests. +type MonthlyUsageAttributionSupportedMetrics string + +// List of MonthlyUsageAttributionSupportedMetrics. +const ( + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE MonthlyUsageAttributionSupportedMetrics = "api_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "api_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "apm_host_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "apm_host_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE MonthlyUsageAttributionSupportedMetrics = "appsec_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "appsec_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE MonthlyUsageAttributionSupportedMetrics = "browser_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "browser_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE MonthlyUsageAttributionSupportedMetrics = "container_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "container_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cspm_containers_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_USAGE MonthlyUsageAttributionSupportedMetrics = "cspm_containers_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cspm_hosts_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_USAGE MonthlyUsageAttributionSupportedMetrics = "cspm_hosts_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE MonthlyUsageAttributionSupportedMetrics = "custom_timeseries_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "custom_timeseries_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cws_containers_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_USAGE MonthlyUsageAttributionSupportedMetrics = "cws_containers_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "cws_hosts_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_USAGE MonthlyUsageAttributionSupportedMetrics = "cws_hosts_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "dbm_hosts_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE MonthlyUsageAttributionSupportedMetrics = "dbm_hosts_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "dbm_queries_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE MonthlyUsageAttributionSupportedMetrics = "dbm_queries_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_logs_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_logs_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_spans_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "estimated_indexed_spans_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE MonthlyUsageAttributionSupportedMetrics = "estimated_ingested_spans_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "estimated_ingested_spans_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE MonthlyUsageAttributionSupportedMetrics = "fargate_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "fargate_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_USAGE MonthlyUsageAttributionSupportedMetrics = "functions_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "functions_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_USAGE MonthlyUsageAttributionSupportedMetrics = "indexed_logs_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "indexed_logs_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "infra_host_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "infra_host_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_USAGE MonthlyUsageAttributionSupportedMetrics = "invocations_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "invocations_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "npm_host_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "npm_host_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE MonthlyUsageAttributionSupportedMetrics = "profiled_container_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "profiled_container_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE MonthlyUsageAttributionSupportedMetrics = "profiled_host_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "profiled_host_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE MonthlyUsageAttributionSupportedMetrics = "snmp_usage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE MonthlyUsageAttributionSupportedMetrics = "snmp_percentage" + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ALL MonthlyUsageAttributionSupportedMetrics = "*" +) + +var allowedMonthlyUsageAttributionSupportedMetricsEnumValues = []MonthlyUsageAttributionSupportedMetrics{ + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_CONTAINERS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CSPM_HOSTS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_CONTAINERS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_CWS_HOSTS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_FUNCTIONS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INDEXED_LOGS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_INVOCATIONS_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE, + MONTHLYUSAGEATTRIBUTIONSUPPORTEDMETRICS_ALL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MonthlyUsageAttributionSupportedMetrics) GetAllowedValues() []MonthlyUsageAttributionSupportedMetrics { + return allowedMonthlyUsageAttributionSupportedMetricsEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MonthlyUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MonthlyUsageAttributionSupportedMetrics(value) + return nil +} + +// NewMonthlyUsageAttributionSupportedMetricsFromValue returns a pointer to a valid MonthlyUsageAttributionSupportedMetrics +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMonthlyUsageAttributionSupportedMetricsFromValue(v string) (*MonthlyUsageAttributionSupportedMetrics, error) { + ev := MonthlyUsageAttributionSupportedMetrics(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MonthlyUsageAttributionSupportedMetrics: valid values are %v", v, allowedMonthlyUsageAttributionSupportedMetricsEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MonthlyUsageAttributionSupportedMetrics) IsValid() bool { + for _, existing := range allowedMonthlyUsageAttributionSupportedMetricsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MonthlyUsageAttributionSupportedMetrics value. +func (v MonthlyUsageAttributionSupportedMetrics) Ptr() *MonthlyUsageAttributionSupportedMetrics { + return &v +} + +// NullableMonthlyUsageAttributionSupportedMetrics handles when a null is used for MonthlyUsageAttributionSupportedMetrics. +type NullableMonthlyUsageAttributionSupportedMetrics struct { + value *MonthlyUsageAttributionSupportedMetrics + isSet bool +} + +// Get returns the associated value. +func (v NullableMonthlyUsageAttributionSupportedMetrics) Get() *MonthlyUsageAttributionSupportedMetrics { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonthlyUsageAttributionSupportedMetrics) Set(val *MonthlyUsageAttributionSupportedMetrics) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonthlyUsageAttributionSupportedMetrics) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMonthlyUsageAttributionSupportedMetrics) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonthlyUsageAttributionSupportedMetrics initializes the struct as if Set has been called. +func NewNullableMonthlyUsageAttributionSupportedMetrics(val *MonthlyUsageAttributionSupportedMetrics) *NullableMonthlyUsageAttributionSupportedMetrics { + return &NullableMonthlyUsageAttributionSupportedMetrics{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonthlyUsageAttributionSupportedMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonthlyUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_monthly_usage_attribution_values.go b/api/v1/datadog/model_monthly_usage_attribution_values.go new file mode 100644 index 00000000000..8138c2b3cfc --- /dev/null +++ b/api/v1/datadog/model_monthly_usage_attribution_values.go @@ -0,0 +1,1467 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonthlyUsageAttributionValues Fields in Usage Summary by tag(s). +type MonthlyUsageAttributionValues struct { + // The percentage of synthetic API test usage by tag(s). + ApiPercentage *float64 `json:"api_percentage,omitempty"` + // The synthetic API test usage by tag(s). + ApiUsage *float64 `json:"api_usage,omitempty"` + // The percentage of APM host usage by tag(s). + ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` + // The APM host usage by tag(s). + ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` + // The percentage of Application Security Monitoring host usage by tag(s). + AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` + // The Application Security Monitoring host usage by tag(s). + AppsecUsage *float64 `json:"appsec_usage,omitempty"` + // The percentage of synthetic browser test usage by tag(s). + BrowserPercentage *float64 `json:"browser_percentage,omitempty"` + // The synthetic browser test usage by tag(s). + BrowserUsage *float64 `json:"browser_usage,omitempty"` + // The percentage of container usage by tag(s). + ContainerPercentage *float64 `json:"container_percentage,omitempty"` + // The container usage by tag(s). + ContainerUsage *float64 `json:"container_usage,omitempty"` + // The percentage of custom metrics usage by tag(s). + CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` + // The custom metrics usage by tag(s). + CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` + // The percentage of estimated live indexed logs usage by tag(s). This field is in private beta. + EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` + // The estimated live indexed logs usage by tag(s). This field is in private beta. + EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` + // The percentage of estimated indexed spans usage by tag(s). This field is in private beta. + EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` + // The estimated indexed spans usage by tag(s). This field is in private beta. + EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` + // The percentage of estimated ingested spans usage by tag(s). This field is in private beta. + EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` + // The estimated ingested spans usage by tag(s). This field is in private beta. + EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` + // The percentage of Fargate usage by tags. + FargatePercentage *float64 `json:"fargate_percentage,omitempty"` + // The Fargate usage by tags. + FargateUsage *float64 `json:"fargate_usage,omitempty"` + // The percentage of Lambda function usage by tag(s). + FunctionsPercentage *float64 `json:"functions_percentage,omitempty"` + // The Lambda function usage by tag(s). + FunctionsUsage *float64 `json:"functions_usage,omitempty"` + // The percentage of indexed logs usage by tags. + IndexedLogsPercentage *float64 `json:"indexed_logs_percentage,omitempty"` + // The indexed logs usage by tags. + IndexedLogsUsage *float64 `json:"indexed_logs_usage,omitempty"` + // The percentage of infrastructure host usage by tag(s). + InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` + // The infrastructure host usage by tag(s). + InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` + // The percentage of Lambda invocation usage by tag(s). + InvocationsPercentage *float64 `json:"invocations_percentage,omitempty"` + // The Lambda invocation usage by tag(s). + InvocationsUsage *float64 `json:"invocations_usage,omitempty"` + // The percentage of network host usage by tag(s). + NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` + // The network host usage by tag(s). + NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` + // The percentage of profiled container usage by tag(s). + ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` + // The profiled container usage by tag(s). + ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` + // The percentage of profiled hosts usage by tag(s). + ProfiledHostPercentage *float64 `json:"profiled_host_percentage,omitempty"` + // The profiled hosts usage by tag(s). + ProfiledHostUsage *float64 `json:"profiled_host_usage,omitempty"` + // The percentage of network device usage by tag(s). + SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` + // The network device usage by tag(s). + SnmpUsage *float64 `json:"snmp_usage,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{} +} + +// NewMonthlyUsageAttributionValues instantiates a new MonthlyUsageAttributionValues 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 NewMonthlyUsageAttributionValues() *MonthlyUsageAttributionValues { + this := MonthlyUsageAttributionValues{} + return &this +} + +// NewMonthlyUsageAttributionValuesWithDefaults instantiates a new MonthlyUsageAttributionValues 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 NewMonthlyUsageAttributionValuesWithDefaults() *MonthlyUsageAttributionValues { + this := MonthlyUsageAttributionValues{} + return &this +} + +// GetApiPercentage returns the ApiPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetApiPercentage() float64 { + if o == nil || o.ApiPercentage == nil { + var ret float64 + return ret + } + return *o.ApiPercentage +} + +// GetApiPercentageOk returns a tuple with the ApiPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetApiPercentageOk() (*float64, bool) { + if o == nil || o.ApiPercentage == nil { + return nil, false + } + return o.ApiPercentage, true +} + +// HasApiPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasApiPercentage() bool { + if o != nil && o.ApiPercentage != nil { + return true + } + + return false +} + +// SetApiPercentage gets a reference to the given float64 and assigns it to the ApiPercentage field. +func (o *MonthlyUsageAttributionValues) SetApiPercentage(v float64) { + o.ApiPercentage = &v +} + +// GetApiUsage returns the ApiUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetApiUsage() float64 { + if o == nil || o.ApiUsage == nil { + var ret float64 + return ret + } + return *o.ApiUsage +} + +// GetApiUsageOk returns a tuple with the ApiUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetApiUsageOk() (*float64, bool) { + if o == nil || o.ApiUsage == nil { + return nil, false + } + return o.ApiUsage, true +} + +// HasApiUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasApiUsage() bool { + if o != nil && o.ApiUsage != nil { + return true + } + + return false +} + +// SetApiUsage gets a reference to the given float64 and assigns it to the ApiUsage field. +func (o *MonthlyUsageAttributionValues) SetApiUsage(v float64) { + o.ApiUsage = &v +} + +// GetApmHostPercentage returns the ApmHostPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetApmHostPercentage() float64 { + if o == nil || o.ApmHostPercentage == nil { + var ret float64 + return ret + } + return *o.ApmHostPercentage +} + +// GetApmHostPercentageOk returns a tuple with the ApmHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetApmHostPercentageOk() (*float64, bool) { + if o == nil || o.ApmHostPercentage == nil { + return nil, false + } + return o.ApmHostPercentage, true +} + +// HasApmHostPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasApmHostPercentage() bool { + if o != nil && o.ApmHostPercentage != nil { + return true + } + + return false +} + +// SetApmHostPercentage gets a reference to the given float64 and assigns it to the ApmHostPercentage field. +func (o *MonthlyUsageAttributionValues) SetApmHostPercentage(v float64) { + o.ApmHostPercentage = &v +} + +// GetApmHostUsage returns the ApmHostUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetApmHostUsage() float64 { + if o == nil || o.ApmHostUsage == nil { + var ret float64 + return ret + } + return *o.ApmHostUsage +} + +// GetApmHostUsageOk returns a tuple with the ApmHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetApmHostUsageOk() (*float64, bool) { + if o == nil || o.ApmHostUsage == nil { + return nil, false + } + return o.ApmHostUsage, true +} + +// HasApmHostUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasApmHostUsage() bool { + if o != nil && o.ApmHostUsage != nil { + return true + } + + return false +} + +// SetApmHostUsage gets a reference to the given float64 and assigns it to the ApmHostUsage field. +func (o *MonthlyUsageAttributionValues) SetApmHostUsage(v float64) { + o.ApmHostUsage = &v +} + +// GetAppsecPercentage returns the AppsecPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetAppsecPercentage() float64 { + if o == nil || o.AppsecPercentage == nil { + var ret float64 + return ret + } + return *o.AppsecPercentage +} + +// GetAppsecPercentageOk returns a tuple with the AppsecPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetAppsecPercentageOk() (*float64, bool) { + if o == nil || o.AppsecPercentage == nil { + return nil, false + } + return o.AppsecPercentage, true +} + +// HasAppsecPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasAppsecPercentage() bool { + if o != nil && o.AppsecPercentage != nil { + return true + } + + return false +} + +// SetAppsecPercentage gets a reference to the given float64 and assigns it to the AppsecPercentage field. +func (o *MonthlyUsageAttributionValues) SetAppsecPercentage(v float64) { + o.AppsecPercentage = &v +} + +// GetAppsecUsage returns the AppsecUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetAppsecUsage() float64 { + if o == nil || o.AppsecUsage == nil { + var ret float64 + return ret + } + return *o.AppsecUsage +} + +// GetAppsecUsageOk returns a tuple with the AppsecUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetAppsecUsageOk() (*float64, bool) { + if o == nil || o.AppsecUsage == nil { + return nil, false + } + return o.AppsecUsage, true +} + +// HasAppsecUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasAppsecUsage() bool { + if o != nil && o.AppsecUsage != nil { + return true + } + + return false +} + +// SetAppsecUsage gets a reference to the given float64 and assigns it to the AppsecUsage field. +func (o *MonthlyUsageAttributionValues) SetAppsecUsage(v float64) { + o.AppsecUsage = &v +} + +// GetBrowserPercentage returns the BrowserPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetBrowserPercentage() float64 { + if o == nil || o.BrowserPercentage == nil { + var ret float64 + return ret + } + return *o.BrowserPercentage +} + +// GetBrowserPercentageOk returns a tuple with the BrowserPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetBrowserPercentageOk() (*float64, bool) { + if o == nil || o.BrowserPercentage == nil { + return nil, false + } + return o.BrowserPercentage, true +} + +// HasBrowserPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasBrowserPercentage() bool { + if o != nil && o.BrowserPercentage != nil { + return true + } + + return false +} + +// SetBrowserPercentage gets a reference to the given float64 and assigns it to the BrowserPercentage field. +func (o *MonthlyUsageAttributionValues) SetBrowserPercentage(v float64) { + o.BrowserPercentage = &v +} + +// GetBrowserUsage returns the BrowserUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetBrowserUsage() float64 { + if o == nil || o.BrowserUsage == nil { + var ret float64 + return ret + } + return *o.BrowserUsage +} + +// GetBrowserUsageOk returns a tuple with the BrowserUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetBrowserUsageOk() (*float64, bool) { + if o == nil || o.BrowserUsage == nil { + return nil, false + } + return o.BrowserUsage, true +} + +// HasBrowserUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasBrowserUsage() bool { + if o != nil && o.BrowserUsage != nil { + return true + } + + return false +} + +// SetBrowserUsage gets a reference to the given float64 and assigns it to the BrowserUsage field. +func (o *MonthlyUsageAttributionValues) SetBrowserUsage(v float64) { + o.BrowserUsage = &v +} + +// GetContainerPercentage returns the ContainerPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetContainerPercentage() float64 { + if o == nil || o.ContainerPercentage == nil { + var ret float64 + return ret + } + return *o.ContainerPercentage +} + +// GetContainerPercentageOk returns a tuple with the ContainerPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetContainerPercentageOk() (*float64, bool) { + if o == nil || o.ContainerPercentage == nil { + return nil, false + } + return o.ContainerPercentage, true +} + +// HasContainerPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasContainerPercentage() bool { + if o != nil && o.ContainerPercentage != nil { + return true + } + + return false +} + +// SetContainerPercentage gets a reference to the given float64 and assigns it to the ContainerPercentage field. +func (o *MonthlyUsageAttributionValues) SetContainerPercentage(v float64) { + o.ContainerPercentage = &v +} + +// GetContainerUsage returns the ContainerUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetContainerUsage() float64 { + if o == nil || o.ContainerUsage == nil { + var ret float64 + return ret + } + return *o.ContainerUsage +} + +// GetContainerUsageOk returns a tuple with the ContainerUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetContainerUsageOk() (*float64, bool) { + if o == nil || o.ContainerUsage == nil { + return nil, false + } + return o.ContainerUsage, true +} + +// HasContainerUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasContainerUsage() bool { + if o != nil && o.ContainerUsage != nil { + return true + } + + return false +} + +// SetContainerUsage gets a reference to the given float64 and assigns it to the ContainerUsage field. +func (o *MonthlyUsageAttributionValues) SetContainerUsage(v float64) { + o.ContainerUsage = &v +} + +// GetCustomTimeseriesPercentage returns the CustomTimeseriesPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesPercentage() float64 { + if o == nil || o.CustomTimeseriesPercentage == nil { + var ret float64 + return ret + } + return *o.CustomTimeseriesPercentage +} + +// GetCustomTimeseriesPercentageOk returns a tuple with the CustomTimeseriesPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesPercentageOk() (*float64, bool) { + if o == nil || o.CustomTimeseriesPercentage == nil { + return nil, false + } + return o.CustomTimeseriesPercentage, true +} + +// HasCustomTimeseriesPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasCustomTimeseriesPercentage() bool { + if o != nil && o.CustomTimeseriesPercentage != nil { + return true + } + + return false +} + +// SetCustomTimeseriesPercentage gets a reference to the given float64 and assigns it to the CustomTimeseriesPercentage field. +func (o *MonthlyUsageAttributionValues) SetCustomTimeseriesPercentage(v float64) { + o.CustomTimeseriesPercentage = &v +} + +// GetCustomTimeseriesUsage returns the CustomTimeseriesUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesUsage() float64 { + if o == nil || o.CustomTimeseriesUsage == nil { + var ret float64 + return ret + } + return *o.CustomTimeseriesUsage +} + +// GetCustomTimeseriesUsageOk returns a tuple with the CustomTimeseriesUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetCustomTimeseriesUsageOk() (*float64, bool) { + if o == nil || o.CustomTimeseriesUsage == nil { + return nil, false + } + return o.CustomTimeseriesUsage, true +} + +// HasCustomTimeseriesUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasCustomTimeseriesUsage() bool { + if o != nil && o.CustomTimeseriesUsage != nil { + return true + } + + return false +} + +// SetCustomTimeseriesUsage gets a reference to the given float64 and assigns it to the CustomTimeseriesUsage field. +func (o *MonthlyUsageAttributionValues) SetCustomTimeseriesUsage(v float64) { + o.CustomTimeseriesUsage = &v +} + +// GetEstimatedIndexedLogsPercentage returns the EstimatedIndexedLogsPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsPercentage() float64 { + if o == nil || o.EstimatedIndexedLogsPercentage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedLogsPercentage +} + +// GetEstimatedIndexedLogsPercentageOk returns a tuple with the EstimatedIndexedLogsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsPercentageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedLogsPercentage == nil { + return nil, false + } + return o.EstimatedIndexedLogsPercentage, true +} + +// HasEstimatedIndexedLogsPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedLogsPercentage() bool { + if o != nil && o.EstimatedIndexedLogsPercentage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedLogsPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsPercentage field. +func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedLogsPercentage(v float64) { + o.EstimatedIndexedLogsPercentage = &v +} + +// GetEstimatedIndexedLogsUsage returns the EstimatedIndexedLogsUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsUsage() float64 { + if o == nil || o.EstimatedIndexedLogsUsage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedLogsUsage +} + +// GetEstimatedIndexedLogsUsageOk returns a tuple with the EstimatedIndexedLogsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedLogsUsageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedLogsUsage == nil { + return nil, false + } + return o.EstimatedIndexedLogsUsage, true +} + +// HasEstimatedIndexedLogsUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedLogsUsage() bool { + if o != nil && o.EstimatedIndexedLogsUsage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedLogsUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsUsage field. +func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedLogsUsage(v float64) { + o.EstimatedIndexedLogsUsage = &v +} + +// GetEstimatedIndexedSpansPercentage returns the EstimatedIndexedSpansPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansPercentage() float64 { + if o == nil || o.EstimatedIndexedSpansPercentage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedSpansPercentage +} + +// GetEstimatedIndexedSpansPercentageOk returns a tuple with the EstimatedIndexedSpansPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansPercentageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedSpansPercentage == nil { + return nil, false + } + return o.EstimatedIndexedSpansPercentage, true +} + +// HasEstimatedIndexedSpansPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedSpansPercentage() bool { + if o != nil && o.EstimatedIndexedSpansPercentage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansPercentage field. +func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedSpansPercentage(v float64) { + o.EstimatedIndexedSpansPercentage = &v +} + +// GetEstimatedIndexedSpansUsage returns the EstimatedIndexedSpansUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansUsage() float64 { + if o == nil || o.EstimatedIndexedSpansUsage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedSpansUsage +} + +// GetEstimatedIndexedSpansUsageOk returns a tuple with the EstimatedIndexedSpansUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetEstimatedIndexedSpansUsageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedSpansUsage == nil { + return nil, false + } + return o.EstimatedIndexedSpansUsage, true +} + +// HasEstimatedIndexedSpansUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasEstimatedIndexedSpansUsage() bool { + if o != nil && o.EstimatedIndexedSpansUsage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansUsage field. +func (o *MonthlyUsageAttributionValues) SetEstimatedIndexedSpansUsage(v float64) { + o.EstimatedIndexedSpansUsage = &v +} + +// GetEstimatedIngestedSpansPercentage returns the EstimatedIngestedSpansPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansPercentage() float64 { + if o == nil || o.EstimatedIngestedSpansPercentage == nil { + var ret float64 + return ret + } + return *o.EstimatedIngestedSpansPercentage +} + +// GetEstimatedIngestedSpansPercentageOk returns a tuple with the EstimatedIngestedSpansPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansPercentageOk() (*float64, bool) { + if o == nil || o.EstimatedIngestedSpansPercentage == nil { + return nil, false + } + return o.EstimatedIngestedSpansPercentage, true +} + +// HasEstimatedIngestedSpansPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasEstimatedIngestedSpansPercentage() bool { + if o != nil && o.EstimatedIngestedSpansPercentage != nil { + return true + } + + return false +} + +// SetEstimatedIngestedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansPercentage field. +func (o *MonthlyUsageAttributionValues) SetEstimatedIngestedSpansPercentage(v float64) { + o.EstimatedIngestedSpansPercentage = &v +} + +// GetEstimatedIngestedSpansUsage returns the EstimatedIngestedSpansUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansUsage() float64 { + if o == nil || o.EstimatedIngestedSpansUsage == nil { + var ret float64 + return ret + } + return *o.EstimatedIngestedSpansUsage +} + +// GetEstimatedIngestedSpansUsageOk returns a tuple with the EstimatedIngestedSpansUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetEstimatedIngestedSpansUsageOk() (*float64, bool) { + if o == nil || o.EstimatedIngestedSpansUsage == nil { + return nil, false + } + return o.EstimatedIngestedSpansUsage, true +} + +// HasEstimatedIngestedSpansUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasEstimatedIngestedSpansUsage() bool { + if o != nil && o.EstimatedIngestedSpansUsage != nil { + return true + } + + return false +} + +// SetEstimatedIngestedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansUsage field. +func (o *MonthlyUsageAttributionValues) SetEstimatedIngestedSpansUsage(v float64) { + o.EstimatedIngestedSpansUsage = &v +} + +// GetFargatePercentage returns the FargatePercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetFargatePercentage() float64 { + if o == nil || o.FargatePercentage == nil { + var ret float64 + return ret + } + return *o.FargatePercentage +} + +// GetFargatePercentageOk returns a tuple with the FargatePercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetFargatePercentageOk() (*float64, bool) { + if o == nil || o.FargatePercentage == nil { + return nil, false + } + return o.FargatePercentage, true +} + +// HasFargatePercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasFargatePercentage() bool { + if o != nil && o.FargatePercentage != nil { + return true + } + + return false +} + +// SetFargatePercentage gets a reference to the given float64 and assigns it to the FargatePercentage field. +func (o *MonthlyUsageAttributionValues) SetFargatePercentage(v float64) { + o.FargatePercentage = &v +} + +// GetFargateUsage returns the FargateUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetFargateUsage() float64 { + if o == nil || o.FargateUsage == nil { + var ret float64 + return ret + } + return *o.FargateUsage +} + +// GetFargateUsageOk returns a tuple with the FargateUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetFargateUsageOk() (*float64, bool) { + if o == nil || o.FargateUsage == nil { + return nil, false + } + return o.FargateUsage, true +} + +// HasFargateUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasFargateUsage() bool { + if o != nil && o.FargateUsage != nil { + return true + } + + return false +} + +// SetFargateUsage gets a reference to the given float64 and assigns it to the FargateUsage field. +func (o *MonthlyUsageAttributionValues) SetFargateUsage(v float64) { + o.FargateUsage = &v +} + +// GetFunctionsPercentage returns the FunctionsPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetFunctionsPercentage() float64 { + if o == nil || o.FunctionsPercentage == nil { + var ret float64 + return ret + } + return *o.FunctionsPercentage +} + +// GetFunctionsPercentageOk returns a tuple with the FunctionsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetFunctionsPercentageOk() (*float64, bool) { + if o == nil || o.FunctionsPercentage == nil { + return nil, false + } + return o.FunctionsPercentage, true +} + +// HasFunctionsPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasFunctionsPercentage() bool { + if o != nil && o.FunctionsPercentage != nil { + return true + } + + return false +} + +// SetFunctionsPercentage gets a reference to the given float64 and assigns it to the FunctionsPercentage field. +func (o *MonthlyUsageAttributionValues) SetFunctionsPercentage(v float64) { + o.FunctionsPercentage = &v +} + +// GetFunctionsUsage returns the FunctionsUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetFunctionsUsage() float64 { + if o == nil || o.FunctionsUsage == nil { + var ret float64 + return ret + } + return *o.FunctionsUsage +} + +// GetFunctionsUsageOk returns a tuple with the FunctionsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetFunctionsUsageOk() (*float64, bool) { + if o == nil || o.FunctionsUsage == nil { + return nil, false + } + return o.FunctionsUsage, true +} + +// HasFunctionsUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasFunctionsUsage() bool { + if o != nil && o.FunctionsUsage != nil { + return true + } + + return false +} + +// SetFunctionsUsage gets a reference to the given float64 and assigns it to the FunctionsUsage field. +func (o *MonthlyUsageAttributionValues) SetFunctionsUsage(v float64) { + o.FunctionsUsage = &v +} + +// GetIndexedLogsPercentage returns the IndexedLogsPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetIndexedLogsPercentage() float64 { + if o == nil || o.IndexedLogsPercentage == nil { + var ret float64 + return ret + } + return *o.IndexedLogsPercentage +} + +// GetIndexedLogsPercentageOk returns a tuple with the IndexedLogsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetIndexedLogsPercentageOk() (*float64, bool) { + if o == nil || o.IndexedLogsPercentage == nil { + return nil, false + } + return o.IndexedLogsPercentage, true +} + +// HasIndexedLogsPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasIndexedLogsPercentage() bool { + if o != nil && o.IndexedLogsPercentage != nil { + return true + } + + return false +} + +// SetIndexedLogsPercentage gets a reference to the given float64 and assigns it to the IndexedLogsPercentage field. +func (o *MonthlyUsageAttributionValues) SetIndexedLogsPercentage(v float64) { + o.IndexedLogsPercentage = &v +} + +// GetIndexedLogsUsage returns the IndexedLogsUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetIndexedLogsUsage() float64 { + if o == nil || o.IndexedLogsUsage == nil { + var ret float64 + return ret + } + return *o.IndexedLogsUsage +} + +// GetIndexedLogsUsageOk returns a tuple with the IndexedLogsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetIndexedLogsUsageOk() (*float64, bool) { + if o == nil || o.IndexedLogsUsage == nil { + return nil, false + } + return o.IndexedLogsUsage, true +} + +// HasIndexedLogsUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasIndexedLogsUsage() bool { + if o != nil && o.IndexedLogsUsage != nil { + return true + } + + return false +} + +// SetIndexedLogsUsage gets a reference to the given float64 and assigns it to the IndexedLogsUsage field. +func (o *MonthlyUsageAttributionValues) SetIndexedLogsUsage(v float64) { + o.IndexedLogsUsage = &v +} + +// GetInfraHostPercentage returns the InfraHostPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetInfraHostPercentage() float64 { + if o == nil || o.InfraHostPercentage == nil { + var ret float64 + return ret + } + return *o.InfraHostPercentage +} + +// GetInfraHostPercentageOk returns a tuple with the InfraHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetInfraHostPercentageOk() (*float64, bool) { + if o == nil || o.InfraHostPercentage == nil { + return nil, false + } + return o.InfraHostPercentage, true +} + +// HasInfraHostPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasInfraHostPercentage() bool { + if o != nil && o.InfraHostPercentage != nil { + return true + } + + return false +} + +// SetInfraHostPercentage gets a reference to the given float64 and assigns it to the InfraHostPercentage field. +func (o *MonthlyUsageAttributionValues) SetInfraHostPercentage(v float64) { + o.InfraHostPercentage = &v +} + +// GetInfraHostUsage returns the InfraHostUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetInfraHostUsage() float64 { + if o == nil || o.InfraHostUsage == nil { + var ret float64 + return ret + } + return *o.InfraHostUsage +} + +// GetInfraHostUsageOk returns a tuple with the InfraHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetInfraHostUsageOk() (*float64, bool) { + if o == nil || o.InfraHostUsage == nil { + return nil, false + } + return o.InfraHostUsage, true +} + +// HasInfraHostUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasInfraHostUsage() bool { + if o != nil && o.InfraHostUsage != nil { + return true + } + + return false +} + +// SetInfraHostUsage gets a reference to the given float64 and assigns it to the InfraHostUsage field. +func (o *MonthlyUsageAttributionValues) SetInfraHostUsage(v float64) { + o.InfraHostUsage = &v +} + +// GetInvocationsPercentage returns the InvocationsPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetInvocationsPercentage() float64 { + if o == nil || o.InvocationsPercentage == nil { + var ret float64 + return ret + } + return *o.InvocationsPercentage +} + +// GetInvocationsPercentageOk returns a tuple with the InvocationsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetInvocationsPercentageOk() (*float64, bool) { + if o == nil || o.InvocationsPercentage == nil { + return nil, false + } + return o.InvocationsPercentage, true +} + +// HasInvocationsPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasInvocationsPercentage() bool { + if o != nil && o.InvocationsPercentage != nil { + return true + } + + return false +} + +// SetInvocationsPercentage gets a reference to the given float64 and assigns it to the InvocationsPercentage field. +func (o *MonthlyUsageAttributionValues) SetInvocationsPercentage(v float64) { + o.InvocationsPercentage = &v +} + +// GetInvocationsUsage returns the InvocationsUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetInvocationsUsage() float64 { + if o == nil || o.InvocationsUsage == nil { + var ret float64 + return ret + } + return *o.InvocationsUsage +} + +// GetInvocationsUsageOk returns a tuple with the InvocationsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetInvocationsUsageOk() (*float64, bool) { + if o == nil || o.InvocationsUsage == nil { + return nil, false + } + return o.InvocationsUsage, true +} + +// HasInvocationsUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasInvocationsUsage() bool { + if o != nil && o.InvocationsUsage != nil { + return true + } + + return false +} + +// SetInvocationsUsage gets a reference to the given float64 and assigns it to the InvocationsUsage field. +func (o *MonthlyUsageAttributionValues) SetInvocationsUsage(v float64) { + o.InvocationsUsage = &v +} + +// GetNpmHostPercentage returns the NpmHostPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetNpmHostPercentage() float64 { + if o == nil || o.NpmHostPercentage == nil { + var ret float64 + return ret + } + return *o.NpmHostPercentage +} + +// GetNpmHostPercentageOk returns a tuple with the NpmHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetNpmHostPercentageOk() (*float64, bool) { + if o == nil || o.NpmHostPercentage == nil { + return nil, false + } + return o.NpmHostPercentage, true +} + +// HasNpmHostPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasNpmHostPercentage() bool { + if o != nil && o.NpmHostPercentage != nil { + return true + } + + return false +} + +// SetNpmHostPercentage gets a reference to the given float64 and assigns it to the NpmHostPercentage field. +func (o *MonthlyUsageAttributionValues) SetNpmHostPercentage(v float64) { + o.NpmHostPercentage = &v +} + +// GetNpmHostUsage returns the NpmHostUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetNpmHostUsage() float64 { + if o == nil || o.NpmHostUsage == nil { + var ret float64 + return ret + } + return *o.NpmHostUsage +} + +// GetNpmHostUsageOk returns a tuple with the NpmHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetNpmHostUsageOk() (*float64, bool) { + if o == nil || o.NpmHostUsage == nil { + return nil, false + } + return o.NpmHostUsage, true +} + +// HasNpmHostUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasNpmHostUsage() bool { + if o != nil && o.NpmHostUsage != nil { + return true + } + + return false +} + +// SetNpmHostUsage gets a reference to the given float64 and assigns it to the NpmHostUsage field. +func (o *MonthlyUsageAttributionValues) SetNpmHostUsage(v float64) { + o.NpmHostUsage = &v +} + +// GetProfiledContainerPercentage returns the ProfiledContainerPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetProfiledContainerPercentage() float64 { + if o == nil || o.ProfiledContainerPercentage == nil { + var ret float64 + return ret + } + return *o.ProfiledContainerPercentage +} + +// GetProfiledContainerPercentageOk returns a tuple with the ProfiledContainerPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetProfiledContainerPercentageOk() (*float64, bool) { + if o == nil || o.ProfiledContainerPercentage == nil { + return nil, false + } + return o.ProfiledContainerPercentage, true +} + +// HasProfiledContainerPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasProfiledContainerPercentage() bool { + if o != nil && o.ProfiledContainerPercentage != nil { + return true + } + + return false +} + +// SetProfiledContainerPercentage gets a reference to the given float64 and assigns it to the ProfiledContainerPercentage field. +func (o *MonthlyUsageAttributionValues) SetProfiledContainerPercentage(v float64) { + o.ProfiledContainerPercentage = &v +} + +// GetProfiledContainerUsage returns the ProfiledContainerUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetProfiledContainerUsage() float64 { + if o == nil || o.ProfiledContainerUsage == nil { + var ret float64 + return ret + } + return *o.ProfiledContainerUsage +} + +// GetProfiledContainerUsageOk returns a tuple with the ProfiledContainerUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetProfiledContainerUsageOk() (*float64, bool) { + if o == nil || o.ProfiledContainerUsage == nil { + return nil, false + } + return o.ProfiledContainerUsage, true +} + +// HasProfiledContainerUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasProfiledContainerUsage() bool { + if o != nil && o.ProfiledContainerUsage != nil { + return true + } + + return false +} + +// SetProfiledContainerUsage gets a reference to the given float64 and assigns it to the ProfiledContainerUsage field. +func (o *MonthlyUsageAttributionValues) SetProfiledContainerUsage(v float64) { + o.ProfiledContainerUsage = &v +} + +// GetProfiledHostPercentage returns the ProfiledHostPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetProfiledHostPercentage() float64 { + if o == nil || o.ProfiledHostPercentage == nil { + var ret float64 + return ret + } + return *o.ProfiledHostPercentage +} + +// GetProfiledHostPercentageOk returns a tuple with the ProfiledHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetProfiledHostPercentageOk() (*float64, bool) { + if o == nil || o.ProfiledHostPercentage == nil { + return nil, false + } + return o.ProfiledHostPercentage, true +} + +// HasProfiledHostPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasProfiledHostPercentage() bool { + if o != nil && o.ProfiledHostPercentage != nil { + return true + } + + return false +} + +// SetProfiledHostPercentage gets a reference to the given float64 and assigns it to the ProfiledHostPercentage field. +func (o *MonthlyUsageAttributionValues) SetProfiledHostPercentage(v float64) { + o.ProfiledHostPercentage = &v +} + +// GetProfiledHostUsage returns the ProfiledHostUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetProfiledHostUsage() float64 { + if o == nil || o.ProfiledHostUsage == nil { + var ret float64 + return ret + } + return *o.ProfiledHostUsage +} + +// GetProfiledHostUsageOk returns a tuple with the ProfiledHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetProfiledHostUsageOk() (*float64, bool) { + if o == nil || o.ProfiledHostUsage == nil { + return nil, false + } + return o.ProfiledHostUsage, true +} + +// HasProfiledHostUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasProfiledHostUsage() bool { + if o != nil && o.ProfiledHostUsage != nil { + return true + } + + return false +} + +// SetProfiledHostUsage gets a reference to the given float64 and assigns it to the ProfiledHostUsage field. +func (o *MonthlyUsageAttributionValues) SetProfiledHostUsage(v float64) { + o.ProfiledHostUsage = &v +} + +// GetSnmpPercentage returns the SnmpPercentage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetSnmpPercentage() float64 { + if o == nil || o.SnmpPercentage == nil { + var ret float64 + return ret + } + return *o.SnmpPercentage +} + +// GetSnmpPercentageOk returns a tuple with the SnmpPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetSnmpPercentageOk() (*float64, bool) { + if o == nil || o.SnmpPercentage == nil { + return nil, false + } + return o.SnmpPercentage, true +} + +// HasSnmpPercentage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasSnmpPercentage() bool { + if o != nil && o.SnmpPercentage != nil { + return true + } + + return false +} + +// SetSnmpPercentage gets a reference to the given float64 and assigns it to the SnmpPercentage field. +func (o *MonthlyUsageAttributionValues) SetSnmpPercentage(v float64) { + o.SnmpPercentage = &v +} + +// GetSnmpUsage returns the SnmpUsage field value if set, zero value otherwise. +func (o *MonthlyUsageAttributionValues) GetSnmpUsage() float64 { + if o == nil || o.SnmpUsage == nil { + var ret float64 + return ret + } + return *o.SnmpUsage +} + +// GetSnmpUsageOk returns a tuple with the SnmpUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonthlyUsageAttributionValues) GetSnmpUsageOk() (*float64, bool) { + if o == nil || o.SnmpUsage == nil { + return nil, false + } + return o.SnmpUsage, true +} + +// HasSnmpUsage returns a boolean if a field has been set. +func (o *MonthlyUsageAttributionValues) HasSnmpUsage() bool { + if o != nil && o.SnmpUsage != nil { + return true + } + + return false +} + +// SetSnmpUsage gets a reference to the given float64 and assigns it to the SnmpUsage field. +func (o *MonthlyUsageAttributionValues) SetSnmpUsage(v float64) { + o.SnmpUsage = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonthlyUsageAttributionValues) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApiPercentage != nil { + toSerialize["api_percentage"] = o.ApiPercentage + } + if o.ApiUsage != nil { + toSerialize["api_usage"] = o.ApiUsage + } + if o.ApmHostPercentage != nil { + toSerialize["apm_host_percentage"] = o.ApmHostPercentage + } + if o.ApmHostUsage != nil { + toSerialize["apm_host_usage"] = o.ApmHostUsage + } + if o.AppsecPercentage != nil { + toSerialize["appsec_percentage"] = o.AppsecPercentage + } + if o.AppsecUsage != nil { + toSerialize["appsec_usage"] = o.AppsecUsage + } + if o.BrowserPercentage != nil { + toSerialize["browser_percentage"] = o.BrowserPercentage + } + if o.BrowserUsage != nil { + toSerialize["browser_usage"] = o.BrowserUsage + } + if o.ContainerPercentage != nil { + toSerialize["container_percentage"] = o.ContainerPercentage + } + if o.ContainerUsage != nil { + toSerialize["container_usage"] = o.ContainerUsage + } + if o.CustomTimeseriesPercentage != nil { + toSerialize["custom_timeseries_percentage"] = o.CustomTimeseriesPercentage + } + if o.CustomTimeseriesUsage != nil { + toSerialize["custom_timeseries_usage"] = o.CustomTimeseriesUsage + } + if o.EstimatedIndexedLogsPercentage != nil { + toSerialize["estimated_indexed_logs_percentage"] = o.EstimatedIndexedLogsPercentage + } + if o.EstimatedIndexedLogsUsage != nil { + toSerialize["estimated_indexed_logs_usage"] = o.EstimatedIndexedLogsUsage + } + if o.EstimatedIndexedSpansPercentage != nil { + toSerialize["estimated_indexed_spans_percentage"] = o.EstimatedIndexedSpansPercentage + } + if o.EstimatedIndexedSpansUsage != nil { + toSerialize["estimated_indexed_spans_usage"] = o.EstimatedIndexedSpansUsage + } + if o.EstimatedIngestedSpansPercentage != nil { + toSerialize["estimated_ingested_spans_percentage"] = o.EstimatedIngestedSpansPercentage + } + if o.EstimatedIngestedSpansUsage != nil { + toSerialize["estimated_ingested_spans_usage"] = o.EstimatedIngestedSpansUsage + } + if o.FargatePercentage != nil { + toSerialize["fargate_percentage"] = o.FargatePercentage + } + if o.FargateUsage != nil { + toSerialize["fargate_usage"] = o.FargateUsage + } + if o.FunctionsPercentage != nil { + toSerialize["functions_percentage"] = o.FunctionsPercentage + } + if o.FunctionsUsage != nil { + toSerialize["functions_usage"] = o.FunctionsUsage + } + if o.IndexedLogsPercentage != nil { + toSerialize["indexed_logs_percentage"] = o.IndexedLogsPercentage + } + if o.IndexedLogsUsage != nil { + toSerialize["indexed_logs_usage"] = o.IndexedLogsUsage + } + if o.InfraHostPercentage != nil { + toSerialize["infra_host_percentage"] = o.InfraHostPercentage + } + if o.InfraHostUsage != nil { + toSerialize["infra_host_usage"] = o.InfraHostUsage + } + if o.InvocationsPercentage != nil { + toSerialize["invocations_percentage"] = o.InvocationsPercentage + } + if o.InvocationsUsage != nil { + toSerialize["invocations_usage"] = o.InvocationsUsage + } + if o.NpmHostPercentage != nil { + toSerialize["npm_host_percentage"] = o.NpmHostPercentage + } + if o.NpmHostUsage != nil { + toSerialize["npm_host_usage"] = o.NpmHostUsage + } + if o.ProfiledContainerPercentage != nil { + toSerialize["profiled_container_percentage"] = o.ProfiledContainerPercentage + } + if o.ProfiledContainerUsage != nil { + toSerialize["profiled_container_usage"] = o.ProfiledContainerUsage + } + if o.ProfiledHostPercentage != nil { + toSerialize["profiled_host_percentage"] = o.ProfiledHostPercentage + } + if o.ProfiledHostUsage != nil { + toSerialize["profiled_host_usage"] = o.ProfiledHostUsage + } + if o.SnmpPercentage != nil { + toSerialize["snmp_percentage"] = o.SnmpPercentage + } + if o.SnmpUsage != nil { + toSerialize["snmp_usage"] = o.SnmpUsage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApiPercentage *float64 `json:"api_percentage,omitempty"` + ApiUsage *float64 `json:"api_usage,omitempty"` + ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` + ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` + AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` + AppsecUsage *float64 `json:"appsec_usage,omitempty"` + BrowserPercentage *float64 `json:"browser_percentage,omitempty"` + BrowserUsage *float64 `json:"browser_usage,omitempty"` + ContainerPercentage *float64 `json:"container_percentage,omitempty"` + ContainerUsage *float64 `json:"container_usage,omitempty"` + CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` + CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` + EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` + EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` + EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` + EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` + EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` + EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` + FargatePercentage *float64 `json:"fargate_percentage,omitempty"` + FargateUsage *float64 `json:"fargate_usage,omitempty"` + FunctionsPercentage *float64 `json:"functions_percentage,omitempty"` + FunctionsUsage *float64 `json:"functions_usage,omitempty"` + IndexedLogsPercentage *float64 `json:"indexed_logs_percentage,omitempty"` + IndexedLogsUsage *float64 `json:"indexed_logs_usage,omitempty"` + InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` + InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` + InvocationsPercentage *float64 `json:"invocations_percentage,omitempty"` + InvocationsUsage *float64 `json:"invocations_usage,omitempty"` + NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` + NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` + ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` + ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` + ProfiledHostPercentage *float64 `json:"profiled_host_percentage,omitempty"` + ProfiledHostUsage *float64 `json:"profiled_host_usage,omitempty"` + SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` + SnmpUsage *float64 `json:"snmp_usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ApiPercentage = all.ApiPercentage + o.ApiUsage = all.ApiUsage + o.ApmHostPercentage = all.ApmHostPercentage + o.ApmHostUsage = all.ApmHostUsage + o.AppsecPercentage = all.AppsecPercentage + o.AppsecUsage = all.AppsecUsage + o.BrowserPercentage = all.BrowserPercentage + o.BrowserUsage = all.BrowserUsage + o.ContainerPercentage = all.ContainerPercentage + o.ContainerUsage = all.ContainerUsage + o.CustomTimeseriesPercentage = all.CustomTimeseriesPercentage + o.CustomTimeseriesUsage = all.CustomTimeseriesUsage + o.EstimatedIndexedLogsPercentage = all.EstimatedIndexedLogsPercentage + o.EstimatedIndexedLogsUsage = all.EstimatedIndexedLogsUsage + o.EstimatedIndexedSpansPercentage = all.EstimatedIndexedSpansPercentage + o.EstimatedIndexedSpansUsage = all.EstimatedIndexedSpansUsage + o.EstimatedIngestedSpansPercentage = all.EstimatedIngestedSpansPercentage + o.EstimatedIngestedSpansUsage = all.EstimatedIngestedSpansUsage + o.FargatePercentage = all.FargatePercentage + o.FargateUsage = all.FargateUsage + o.FunctionsPercentage = all.FunctionsPercentage + o.FunctionsUsage = all.FunctionsUsage + o.IndexedLogsPercentage = all.IndexedLogsPercentage + o.IndexedLogsUsage = all.IndexedLogsUsage + o.InfraHostPercentage = all.InfraHostPercentage + o.InfraHostUsage = all.InfraHostUsage + o.InvocationsPercentage = all.InvocationsPercentage + o.InvocationsUsage = all.InvocationsUsage + o.NpmHostPercentage = all.NpmHostPercentage + o.NpmHostUsage = all.NpmHostUsage + o.ProfiledContainerPercentage = all.ProfiledContainerPercentage + o.ProfiledContainerUsage = all.ProfiledContainerUsage + o.ProfiledHostPercentage = all.ProfiledHostPercentage + o.ProfiledHostUsage = all.ProfiledHostUsage + o.SnmpPercentage = all.SnmpPercentage + o.SnmpUsage = all.SnmpUsage + return nil +} diff --git a/api/v1/datadog/model_note_widget_definition.go b/api/v1/datadog/model_note_widget_definition.go new file mode 100644 index 00000000000..1a9582e7ef3 --- /dev/null +++ b/api/v1/datadog/model_note_widget_definition.go @@ -0,0 +1,486 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NoteWidgetDefinition The notes and links widget is similar to free text widget, but allows for more formatting options. +type NoteWidgetDefinition struct { + // Background color of the note. + BackgroundColor *string `json:"background_color,omitempty"` + // Content of the note. + Content string `json:"content"` + // Size of the text. + FontSize *string `json:"font_size,omitempty"` + // Whether to add padding or not. + HasPadding *bool `json:"has_padding,omitempty"` + // Whether to show a tick or not. + ShowTick *bool `json:"show_tick,omitempty"` + // How to align the text on the widget. + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + // Define how you want to align the text on the widget. + TickEdge *WidgetTickEdge `json:"tick_edge,omitempty"` + // Where to position the tick on an edge. + TickPos *string `json:"tick_pos,omitempty"` + // Type of the note widget. + Type NoteWidgetDefinitionType `json:"type"` + // Vertical alignment. + VerticalAlign *WidgetVerticalAlign `json:"vertical_align,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{} +} + +// NewNoteWidgetDefinition instantiates a new NoteWidgetDefinition 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 NewNoteWidgetDefinition(content string, typeVar NoteWidgetDefinitionType) *NoteWidgetDefinition { + this := NoteWidgetDefinition{} + this.Content = content + var hasPadding bool = true + this.HasPadding = &hasPadding + this.Type = typeVar + return &this +} + +// NewNoteWidgetDefinitionWithDefaults instantiates a new NoteWidgetDefinition 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 NewNoteWidgetDefinitionWithDefaults() *NoteWidgetDefinition { + this := NoteWidgetDefinition{} + var hasPadding bool = true + this.HasPadding = &hasPadding + var typeVar NoteWidgetDefinitionType = NOTEWIDGETDEFINITIONTYPE_NOTE + this.Type = typeVar + return &this +} + +// GetBackgroundColor returns the BackgroundColor field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetBackgroundColor() string { + if o == nil || o.BackgroundColor == nil { + var ret string + return ret + } + return *o.BackgroundColor +} + +// GetBackgroundColorOk returns a tuple with the BackgroundColor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetBackgroundColorOk() (*string, bool) { + if o == nil || o.BackgroundColor == nil { + return nil, false + } + return o.BackgroundColor, true +} + +// HasBackgroundColor returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasBackgroundColor() bool { + if o != nil && o.BackgroundColor != nil { + return true + } + + return false +} + +// SetBackgroundColor gets a reference to the given string and assigns it to the BackgroundColor field. +func (o *NoteWidgetDefinition) SetBackgroundColor(v string) { + o.BackgroundColor = &v +} + +// GetContent returns the Content field value. +func (o *NoteWidgetDefinition) GetContent() string { + if o == nil { + var ret string + return ret + } + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value. +func (o *NoteWidgetDefinition) SetContent(v string) { + o.Content = v +} + +// GetFontSize returns the FontSize field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetFontSize() string { + if o == nil || o.FontSize == nil { + var ret string + return ret + } + return *o.FontSize +} + +// GetFontSizeOk returns a tuple with the FontSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetFontSizeOk() (*string, bool) { + if o == nil || o.FontSize == nil { + return nil, false + } + return o.FontSize, true +} + +// HasFontSize returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasFontSize() bool { + if o != nil && o.FontSize != nil { + return true + } + + return false +} + +// SetFontSize gets a reference to the given string and assigns it to the FontSize field. +func (o *NoteWidgetDefinition) SetFontSize(v string) { + o.FontSize = &v +} + +// GetHasPadding returns the HasPadding field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetHasPadding() bool { + if o == nil || o.HasPadding == nil { + var ret bool + return ret + } + return *o.HasPadding +} + +// GetHasPaddingOk returns a tuple with the HasPadding field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetHasPaddingOk() (*bool, bool) { + if o == nil || o.HasPadding == nil { + return nil, false + } + return o.HasPadding, true +} + +// HasHasPadding returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasHasPadding() bool { + if o != nil && o.HasPadding != nil { + return true + } + + return false +} + +// SetHasPadding gets a reference to the given bool and assigns it to the HasPadding field. +func (o *NoteWidgetDefinition) SetHasPadding(v bool) { + o.HasPadding = &v +} + +// GetShowTick returns the ShowTick field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetShowTick() bool { + if o == nil || o.ShowTick == nil { + var ret bool + return ret + } + return *o.ShowTick +} + +// GetShowTickOk returns a tuple with the ShowTick field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetShowTickOk() (*bool, bool) { + if o == nil || o.ShowTick == nil { + return nil, false + } + return o.ShowTick, true +} + +// HasShowTick returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasShowTick() bool { + if o != nil && o.ShowTick != nil { + return true + } + + return false +} + +// SetShowTick gets a reference to the given bool and assigns it to the ShowTick field. +func (o *NoteWidgetDefinition) SetShowTick(v bool) { + o.ShowTick = &v +} + +// GetTextAlign returns the TextAlign field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetTextAlign() WidgetTextAlign { + if o == nil || o.TextAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TextAlign +} + +// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TextAlign == nil { + return nil, false + } + return o.TextAlign, true +} + +// HasTextAlign returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasTextAlign() bool { + if o != nil && o.TextAlign != nil { + return true + } + + return false +} + +// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. +func (o *NoteWidgetDefinition) SetTextAlign(v WidgetTextAlign) { + o.TextAlign = &v +} + +// GetTickEdge returns the TickEdge field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetTickEdge() WidgetTickEdge { + if o == nil || o.TickEdge == nil { + var ret WidgetTickEdge + return ret + } + return *o.TickEdge +} + +// GetTickEdgeOk returns a tuple with the TickEdge field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetTickEdgeOk() (*WidgetTickEdge, bool) { + if o == nil || o.TickEdge == nil { + return nil, false + } + return o.TickEdge, true +} + +// HasTickEdge returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasTickEdge() bool { + if o != nil && o.TickEdge != nil { + return true + } + + return false +} + +// SetTickEdge gets a reference to the given WidgetTickEdge and assigns it to the TickEdge field. +func (o *NoteWidgetDefinition) SetTickEdge(v WidgetTickEdge) { + o.TickEdge = &v +} + +// GetTickPos returns the TickPos field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetTickPos() string { + if o == nil || o.TickPos == nil { + var ret string + return ret + } + return *o.TickPos +} + +// GetTickPosOk returns a tuple with the TickPos field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetTickPosOk() (*string, bool) { + if o == nil || o.TickPos == nil { + return nil, false + } + return o.TickPos, true +} + +// HasTickPos returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasTickPos() bool { + if o != nil && o.TickPos != nil { + return true + } + + return false +} + +// SetTickPos gets a reference to the given string and assigns it to the TickPos field. +func (o *NoteWidgetDefinition) SetTickPos(v string) { + o.TickPos = &v +} + +// GetType returns the Type field value. +func (o *NoteWidgetDefinition) GetType() NoteWidgetDefinitionType { + if o == nil { + var ret NoteWidgetDefinitionType + 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 *NoteWidgetDefinition) GetTypeOk() (*NoteWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NoteWidgetDefinition) SetType(v NoteWidgetDefinitionType) { + o.Type = v +} + +// GetVerticalAlign returns the VerticalAlign field value if set, zero value otherwise. +func (o *NoteWidgetDefinition) GetVerticalAlign() WidgetVerticalAlign { + if o == nil || o.VerticalAlign == nil { + var ret WidgetVerticalAlign + return ret + } + return *o.VerticalAlign +} + +// GetVerticalAlignOk returns a tuple with the VerticalAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoteWidgetDefinition) GetVerticalAlignOk() (*WidgetVerticalAlign, bool) { + if o == nil || o.VerticalAlign == nil { + return nil, false + } + return o.VerticalAlign, true +} + +// HasVerticalAlign returns a boolean if a field has been set. +func (o *NoteWidgetDefinition) HasVerticalAlign() bool { + if o != nil && o.VerticalAlign != nil { + return true + } + + return false +} + +// SetVerticalAlign gets a reference to the given WidgetVerticalAlign and assigns it to the VerticalAlign field. +func (o *NoteWidgetDefinition) SetVerticalAlign(v WidgetVerticalAlign) { + o.VerticalAlign = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NoteWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BackgroundColor != nil { + toSerialize["background_color"] = o.BackgroundColor + } + toSerialize["content"] = o.Content + if o.FontSize != nil { + toSerialize["font_size"] = o.FontSize + } + if o.HasPadding != nil { + toSerialize["has_padding"] = o.HasPadding + } + if o.ShowTick != nil { + toSerialize["show_tick"] = o.ShowTick + } + if o.TextAlign != nil { + toSerialize["text_align"] = o.TextAlign + } + if o.TickEdge != nil { + toSerialize["tick_edge"] = o.TickEdge + } + if o.TickPos != nil { + toSerialize["tick_pos"] = o.TickPos + } + toSerialize["type"] = o.Type + if o.VerticalAlign != nil { + toSerialize["vertical_align"] = o.VerticalAlign + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Content *string `json:"content"` + Type *NoteWidgetDefinitionType `json:"type"` + }{} + all := struct { + BackgroundColor *string `json:"background_color,omitempty"` + Content string `json:"content"` + FontSize *string `json:"font_size,omitempty"` + HasPadding *bool `json:"has_padding,omitempty"` + ShowTick *bool `json:"show_tick,omitempty"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + TickEdge *WidgetTickEdge `json:"tick_edge,omitempty"` + TickPos *string `json:"tick_pos,omitempty"` + Type NoteWidgetDefinitionType `json:"type"` + VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Content == nil { + return fmt.Errorf("Required field content missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TextAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TickEdge; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.VerticalAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BackgroundColor = all.BackgroundColor + o.Content = all.Content + o.FontSize = all.FontSize + o.HasPadding = all.HasPadding + o.ShowTick = all.ShowTick + o.TextAlign = all.TextAlign + o.TickEdge = all.TickEdge + o.TickPos = all.TickPos + o.Type = all.Type + o.VerticalAlign = all.VerticalAlign + return nil +} diff --git a/api/v1/datadog/model_note_widget_definition_type.go b/api/v1/datadog/model_note_widget_definition_type.go new file mode 100644 index 00000000000..35e119ff70e --- /dev/null +++ b/api/v1/datadog/model_note_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NoteWidgetDefinitionType Type of the note widget. +type NoteWidgetDefinitionType string + +// List of NoteWidgetDefinitionType. +const ( + NOTEWIDGETDEFINITIONTYPE_NOTE NoteWidgetDefinitionType = "note" +) + +var allowedNoteWidgetDefinitionTypeEnumValues = []NoteWidgetDefinitionType{ + NOTEWIDGETDEFINITIONTYPE_NOTE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *NoteWidgetDefinitionType) GetAllowedValues() []NoteWidgetDefinitionType { + return allowedNoteWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *NoteWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = NoteWidgetDefinitionType(value) + return nil +} + +// NewNoteWidgetDefinitionTypeFromValue returns a pointer to a valid NoteWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewNoteWidgetDefinitionTypeFromValue(v string) (*NoteWidgetDefinitionType, error) { + ev := NoteWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for NoteWidgetDefinitionType: valid values are %v", v, allowedNoteWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v NoteWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedNoteWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NoteWidgetDefinitionType value. +func (v NoteWidgetDefinitionType) Ptr() *NoteWidgetDefinitionType { + return &v +} + +// NullableNoteWidgetDefinitionType handles when a null is used for NoteWidgetDefinitionType. +type NullableNoteWidgetDefinitionType struct { + value *NoteWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableNoteWidgetDefinitionType) Get() *NoteWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNoteWidgetDefinitionType) Set(val *NoteWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNoteWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableNoteWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNoteWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableNoteWidgetDefinitionType(val *NoteWidgetDefinitionType) *NullableNoteWidgetDefinitionType { + return &NullableNoteWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNoteWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNoteWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_absolute_time.go b/api/v1/datadog/model_notebook_absolute_time.go new file mode 100644 index 00000000000..c24774b092e --- /dev/null +++ b/api/v1/datadog/model_notebook_absolute_time.go @@ -0,0 +1,184 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" +) + +// NotebookAbsoluteTime Absolute timeframe. +type NotebookAbsoluteTime struct { + // The end time. + End time.Time `json:"end"` + // Indicates whether the timeframe should be shifted to end at the current time. + Live *bool `json:"live,omitempty"` + // The start time. + Start time.Time `json:"start"` + // 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{} +} + +// NewNotebookAbsoluteTime instantiates a new NotebookAbsoluteTime 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 NewNotebookAbsoluteTime(end time.Time, start time.Time) *NotebookAbsoluteTime { + this := NotebookAbsoluteTime{} + this.End = end + this.Start = start + return &this +} + +// NewNotebookAbsoluteTimeWithDefaults instantiates a new NotebookAbsoluteTime 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 NewNotebookAbsoluteTimeWithDefaults() *NotebookAbsoluteTime { + this := NotebookAbsoluteTime{} + return &this +} + +// GetEnd returns the End field value. +func (o *NotebookAbsoluteTime) GetEnd() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.End +} + +// GetEndOk returns a tuple with the End field value +// and a boolean to check if the value has been set. +func (o *NotebookAbsoluteTime) GetEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.End, true +} + +// SetEnd sets field value. +func (o *NotebookAbsoluteTime) SetEnd(v time.Time) { + o.End = v +} + +// GetLive returns the Live field value if set, zero value otherwise. +func (o *NotebookAbsoluteTime) GetLive() bool { + if o == nil || o.Live == nil { + var ret bool + return ret + } + return *o.Live +} + +// GetLiveOk returns a tuple with the Live field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAbsoluteTime) GetLiveOk() (*bool, bool) { + if o == nil || o.Live == nil { + return nil, false + } + return o.Live, true +} + +// HasLive returns a boolean if a field has been set. +func (o *NotebookAbsoluteTime) HasLive() bool { + if o != nil && o.Live != nil { + return true + } + + return false +} + +// SetLive gets a reference to the given bool and assigns it to the Live field. +func (o *NotebookAbsoluteTime) SetLive(v bool) { + o.Live = &v +} + +// GetStart returns the Start field value. +func (o *NotebookAbsoluteTime) GetStart() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Start +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +func (o *NotebookAbsoluteTime) GetStartOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Start, true +} + +// SetStart sets field value. +func (o *NotebookAbsoluteTime) SetStart(v time.Time) { + o.Start = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookAbsoluteTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.End.Nanosecond() == 0 { + toSerialize["end"] = o.End.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["end"] = o.End.Format("2006-01-02T15:04:05.000Z07:00") + } + if o.Live != nil { + toSerialize["live"] = o.Live + } + if o.Start.Nanosecond() == 0 { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start"] = o.Start.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookAbsoluteTime) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + End *time.Time `json:"end"` + Start *time.Time `json:"start"` + }{} + all := struct { + End time.Time `json:"end"` + Live *bool `json:"live,omitempty"` + Start time.Time `json:"start"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.End == nil { + return fmt.Errorf("Required field end missing") + } + if required.Start == nil { + return fmt.Errorf("Required field start missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.End = all.End + o.Live = all.Live + o.Start = all.Start + return nil +} diff --git a/api/v1/datadog/model_notebook_author.go b/api/v1/datadog/model_notebook_author.go new file mode 100644 index 00000000000..7a1bb7cdb53 --- /dev/null +++ b/api/v1/datadog/model_notebook_author.go @@ -0,0 +1,443 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// NotebookAuthor Attributes of user object returned by the API. +type NotebookAuthor struct { + // Creation time of the user. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Whether the user is disabled. + Disabled *bool `json:"disabled,omitempty"` + // Email of the user. + Email *string `json:"email,omitempty"` + // Handle of the user. + Handle *string `json:"handle,omitempty"` + // URL of the user's icon. + Icon *string `json:"icon,omitempty"` + // Name of the user. + Name common.NullableString `json:"name,omitempty"` + // Status of the user. + Status *string `json:"status,omitempty"` + // Title of the user. + Title common.NullableString `json:"title,omitempty"` + // Whether the user is verified. + Verified *bool `json:"verified,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{} +} + +// NewNotebookAuthor instantiates a new NotebookAuthor 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 NewNotebookAuthor() *NotebookAuthor { + this := NotebookAuthor{} + return &this +} + +// NewNotebookAuthorWithDefaults instantiates a new NotebookAuthor 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 NewNotebookAuthorWithDefaults() *NotebookAuthor { + this := NotebookAuthor{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *NotebookAuthor) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAuthor) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *NotebookAuthor) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *NotebookAuthor) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *NotebookAuthor) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAuthor) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *NotebookAuthor) HasDisabled() bool { + if o != nil && o.Disabled != nil { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *NotebookAuthor) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *NotebookAuthor) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAuthor) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *NotebookAuthor) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *NotebookAuthor) SetEmail(v string) { + o.Email = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *NotebookAuthor) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAuthor) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *NotebookAuthor) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *NotebookAuthor) SetHandle(v string) { + o.Handle = &v +} + +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *NotebookAuthor) GetIcon() string { + if o == nil || o.Icon == nil { + var ret string + return ret + } + return *o.Icon +} + +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAuthor) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { + return nil, false + } + return o.Icon, true +} + +// HasIcon returns a boolean if a field has been set. +func (o *NotebookAuthor) HasIcon() bool { + if o != nil && o.Icon != nil { + return true + } + + return false +} + +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *NotebookAuthor) SetIcon(v string) { + o.Icon = &v +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookAuthor) GetName() string { + if o == nil || o.Name.Get() == nil { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *NotebookAuthor) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *NotebookAuthor) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given common.NullableString and assigns it to the Name field. +func (o *NotebookAuthor) SetName(v string) { + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil. +func (o *NotebookAuthor) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil. +func (o *NotebookAuthor) UnsetName() { + o.Name.Unset() +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NotebookAuthor) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAuthor) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *NotebookAuthor) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *NotebookAuthor) SetStatus(v string) { + o.Status = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookAuthor) GetTitle() string { + if o == nil || o.Title.Get() == nil { + var ret string + return ret + } + return *o.Title.Get() +} + +// GetTitleOk returns a tuple with the Title 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 *NotebookAuthor) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Title.Get(), o.Title.IsSet() +} + +// HasTitle returns a boolean if a field has been set. +func (o *NotebookAuthor) HasTitle() bool { + if o != nil && o.Title.IsSet() { + return true + } + + return false +} + +// SetTitle gets a reference to the given common.NullableString and assigns it to the Title field. +func (o *NotebookAuthor) SetTitle(v string) { + o.Title.Set(&v) +} + +// SetTitleNil sets the value for Title to be an explicit nil. +func (o *NotebookAuthor) SetTitleNil() { + o.Title.Set(nil) +} + +// UnsetTitle ensures that no value is present for Title, not even an explicit nil. +func (o *NotebookAuthor) UnsetTitle() { + o.Title.Unset() +} + +// GetVerified returns the Verified field value if set, zero value otherwise. +func (o *NotebookAuthor) GetVerified() bool { + if o == nil || o.Verified == nil { + var ret bool + return ret + } + return *o.Verified +} + +// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookAuthor) GetVerifiedOk() (*bool, bool) { + if o == nil || o.Verified == nil { + return nil, false + } + return o.Verified, true +} + +// HasVerified returns a boolean if a field has been set. +func (o *NotebookAuthor) HasVerified() bool { + if o != nil && o.Verified != nil { + return true + } + + return false +} + +// SetVerified gets a reference to the given bool and assigns it to the Verified field. +func (o *NotebookAuthor) SetVerified(v bool) { + o.Verified = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookAuthor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Title.IsSet() { + toSerialize["title"] = o.Title.Get() + } + if o.Verified != nil { + toSerialize["verified"] = o.Verified + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookAuthor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Icon *string `json:"icon,omitempty"` + Name common.NullableString `json:"name,omitempty"` + Status *string `json:"status,omitempty"` + Title common.NullableString `json:"title,omitempty"` + Verified *bool `json:"verified,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.Disabled = all.Disabled + o.Email = all.Email + o.Handle = all.Handle + o.Icon = all.Icon + o.Name = all.Name + o.Status = all.Status + o.Title = all.Title + o.Verified = all.Verified + return nil +} diff --git a/api/v1/datadog/model_notebook_cell_create_request.go b/api/v1/datadog/model_notebook_cell_create_request.go new file mode 100644 index 00000000000..e6fa919a0c9 --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_create_request.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookCellCreateRequest The description of a notebook cell create request. +type NotebookCellCreateRequest struct { + // The attributes of a notebook cell in create cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, + // `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) + Attributes NotebookCellCreateRequestAttributes `json:"attributes"` + // Type of the Notebook Cell resource. + Type NotebookCellResourceType `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:-` +} + +// NewNotebookCellCreateRequest instantiates a new NotebookCellCreateRequest 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 NewNotebookCellCreateRequest(attributes NotebookCellCreateRequestAttributes, typeVar NotebookCellResourceType) *NotebookCellCreateRequest { + this := NotebookCellCreateRequest{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewNotebookCellCreateRequestWithDefaults instantiates a new NotebookCellCreateRequest 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 NewNotebookCellCreateRequestWithDefaults() *NotebookCellCreateRequest { + this := NotebookCellCreateRequest{} + var typeVar NotebookCellResourceType = NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *NotebookCellCreateRequest) GetAttributes() NotebookCellCreateRequestAttributes { + if o == nil { + var ret NotebookCellCreateRequestAttributes + 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 *NotebookCellCreateRequest) GetAttributesOk() (*NotebookCellCreateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *NotebookCellCreateRequest) SetAttributes(v NotebookCellCreateRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *NotebookCellCreateRequest) GetType() NotebookCellResourceType { + if o == nil { + var ret NotebookCellResourceType + 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 *NotebookCellCreateRequest) GetTypeOk() (*NotebookCellResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebookCellCreateRequest) SetType(v NotebookCellResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookCellCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookCellCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *NotebookCellCreateRequestAttributes `json:"attributes"` + Type *NotebookCellResourceType `json:"type"` + }{} + all := struct { + Attributes NotebookCellCreateRequestAttributes `json:"attributes"` + Type NotebookCellResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_cell_create_request_attributes.go b/api/v1/datadog/model_notebook_cell_create_request_attributes.go new file mode 100644 index 00000000000..9dd241958d4 --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_create_request_attributes.go @@ -0,0 +1,284 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookCellCreateRequestAttributes - The attributes of a notebook cell in create cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, +// `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) +type NotebookCellCreateRequestAttributes struct { + NotebookMarkdownCellAttributes *NotebookMarkdownCellAttributes + NotebookTimeseriesCellAttributes *NotebookTimeseriesCellAttributes + NotebookToplistCellAttributes *NotebookToplistCellAttributes + NotebookHeatMapCellAttributes *NotebookHeatMapCellAttributes + NotebookDistributionCellAttributes *NotebookDistributionCellAttributes + NotebookLogStreamCellAttributes *NotebookLogStreamCellAttributes + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// NotebookMarkdownCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookMarkdownCellAttributes wrapped in NotebookCellCreateRequestAttributes. +func NotebookMarkdownCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookMarkdownCellAttributes) NotebookCellCreateRequestAttributes { + return NotebookCellCreateRequestAttributes{NotebookMarkdownCellAttributes: v} +} + +// NotebookTimeseriesCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookTimeseriesCellAttributes wrapped in NotebookCellCreateRequestAttributes. +func NotebookTimeseriesCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookTimeseriesCellAttributes) NotebookCellCreateRequestAttributes { + return NotebookCellCreateRequestAttributes{NotebookTimeseriesCellAttributes: v} +} + +// NotebookToplistCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookToplistCellAttributes wrapped in NotebookCellCreateRequestAttributes. +func NotebookToplistCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookToplistCellAttributes) NotebookCellCreateRequestAttributes { + return NotebookCellCreateRequestAttributes{NotebookToplistCellAttributes: v} +} + +// NotebookHeatMapCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookHeatMapCellAttributes wrapped in NotebookCellCreateRequestAttributes. +func NotebookHeatMapCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookHeatMapCellAttributes) NotebookCellCreateRequestAttributes { + return NotebookCellCreateRequestAttributes{NotebookHeatMapCellAttributes: v} +} + +// NotebookDistributionCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookDistributionCellAttributes wrapped in NotebookCellCreateRequestAttributes. +func NotebookDistributionCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookDistributionCellAttributes) NotebookCellCreateRequestAttributes { + return NotebookCellCreateRequestAttributes{NotebookDistributionCellAttributes: v} +} + +// NotebookLogStreamCellAttributesAsNotebookCellCreateRequestAttributes is a convenience function that returns NotebookLogStreamCellAttributes wrapped in NotebookCellCreateRequestAttributes. +func NotebookLogStreamCellAttributesAsNotebookCellCreateRequestAttributes(v *NotebookLogStreamCellAttributes) NotebookCellCreateRequestAttributes { + return NotebookCellCreateRequestAttributes{NotebookLogStreamCellAttributes: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *NotebookCellCreateRequestAttributes) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NotebookMarkdownCellAttributes + err = json.Unmarshal(data, &obj.NotebookMarkdownCellAttributes) + if err == nil { + if obj.NotebookMarkdownCellAttributes != nil && obj.NotebookMarkdownCellAttributes.UnparsedObject == nil { + jsonNotebookMarkdownCellAttributes, _ := json.Marshal(obj.NotebookMarkdownCellAttributes) + if string(jsonNotebookMarkdownCellAttributes) == "{}" { // empty struct + obj.NotebookMarkdownCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookMarkdownCellAttributes = nil + } + } else { + obj.NotebookMarkdownCellAttributes = nil + } + + // try to unmarshal data into NotebookTimeseriesCellAttributes + err = json.Unmarshal(data, &obj.NotebookTimeseriesCellAttributes) + if err == nil { + if obj.NotebookTimeseriesCellAttributes != nil && obj.NotebookTimeseriesCellAttributes.UnparsedObject == nil { + jsonNotebookTimeseriesCellAttributes, _ := json.Marshal(obj.NotebookTimeseriesCellAttributes) + if string(jsonNotebookTimeseriesCellAttributes) == "{}" { // empty struct + obj.NotebookTimeseriesCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookTimeseriesCellAttributes = nil + } + } else { + obj.NotebookTimeseriesCellAttributes = nil + } + + // try to unmarshal data into NotebookToplistCellAttributes + err = json.Unmarshal(data, &obj.NotebookToplistCellAttributes) + if err == nil { + if obj.NotebookToplistCellAttributes != nil && obj.NotebookToplistCellAttributes.UnparsedObject == nil { + jsonNotebookToplistCellAttributes, _ := json.Marshal(obj.NotebookToplistCellAttributes) + if string(jsonNotebookToplistCellAttributes) == "{}" { // empty struct + obj.NotebookToplistCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookToplistCellAttributes = nil + } + } else { + obj.NotebookToplistCellAttributes = nil + } + + // try to unmarshal data into NotebookHeatMapCellAttributes + err = json.Unmarshal(data, &obj.NotebookHeatMapCellAttributes) + if err == nil { + if obj.NotebookHeatMapCellAttributes != nil && obj.NotebookHeatMapCellAttributes.UnparsedObject == nil { + jsonNotebookHeatMapCellAttributes, _ := json.Marshal(obj.NotebookHeatMapCellAttributes) + if string(jsonNotebookHeatMapCellAttributes) == "{}" { // empty struct + obj.NotebookHeatMapCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookHeatMapCellAttributes = nil + } + } else { + obj.NotebookHeatMapCellAttributes = nil + } + + // try to unmarshal data into NotebookDistributionCellAttributes + err = json.Unmarshal(data, &obj.NotebookDistributionCellAttributes) + if err == nil { + if obj.NotebookDistributionCellAttributes != nil && obj.NotebookDistributionCellAttributes.UnparsedObject == nil { + jsonNotebookDistributionCellAttributes, _ := json.Marshal(obj.NotebookDistributionCellAttributes) + if string(jsonNotebookDistributionCellAttributes) == "{}" { // empty struct + obj.NotebookDistributionCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookDistributionCellAttributes = nil + } + } else { + obj.NotebookDistributionCellAttributes = nil + } + + // try to unmarshal data into NotebookLogStreamCellAttributes + err = json.Unmarshal(data, &obj.NotebookLogStreamCellAttributes) + if err == nil { + if obj.NotebookLogStreamCellAttributes != nil && obj.NotebookLogStreamCellAttributes.UnparsedObject == nil { + jsonNotebookLogStreamCellAttributes, _ := json.Marshal(obj.NotebookLogStreamCellAttributes) + if string(jsonNotebookLogStreamCellAttributes) == "{}" { // empty struct + obj.NotebookLogStreamCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookLogStreamCellAttributes = nil + } + } else { + obj.NotebookLogStreamCellAttributes = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.NotebookMarkdownCellAttributes = nil + obj.NotebookTimeseriesCellAttributes = nil + obj.NotebookToplistCellAttributes = nil + obj.NotebookHeatMapCellAttributes = nil + obj.NotebookDistributionCellAttributes = nil + obj.NotebookLogStreamCellAttributes = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj NotebookCellCreateRequestAttributes) MarshalJSON() ([]byte, error) { + if obj.NotebookMarkdownCellAttributes != nil { + return json.Marshal(&obj.NotebookMarkdownCellAttributes) + } + + if obj.NotebookTimeseriesCellAttributes != nil { + return json.Marshal(&obj.NotebookTimeseriesCellAttributes) + } + + if obj.NotebookToplistCellAttributes != nil { + return json.Marshal(&obj.NotebookToplistCellAttributes) + } + + if obj.NotebookHeatMapCellAttributes != nil { + return json.Marshal(&obj.NotebookHeatMapCellAttributes) + } + + if obj.NotebookDistributionCellAttributes != nil { + return json.Marshal(&obj.NotebookDistributionCellAttributes) + } + + if obj.NotebookLogStreamCellAttributes != nil { + return json.Marshal(&obj.NotebookLogStreamCellAttributes) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *NotebookCellCreateRequestAttributes) GetActualInstance() interface{} { + if obj.NotebookMarkdownCellAttributes != nil { + return obj.NotebookMarkdownCellAttributes + } + + if obj.NotebookTimeseriesCellAttributes != nil { + return obj.NotebookTimeseriesCellAttributes + } + + if obj.NotebookToplistCellAttributes != nil { + return obj.NotebookToplistCellAttributes + } + + if obj.NotebookHeatMapCellAttributes != nil { + return obj.NotebookHeatMapCellAttributes + } + + if obj.NotebookDistributionCellAttributes != nil { + return obj.NotebookDistributionCellAttributes + } + + if obj.NotebookLogStreamCellAttributes != nil { + return obj.NotebookLogStreamCellAttributes + } + + // all schemas are nil + return nil +} + +// NullableNotebookCellCreateRequestAttributes handles when a null is used for NotebookCellCreateRequestAttributes. +type NullableNotebookCellCreateRequestAttributes struct { + value *NotebookCellCreateRequestAttributes + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookCellCreateRequestAttributes) Get() *NotebookCellCreateRequestAttributes { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookCellCreateRequestAttributes) Set(val *NotebookCellCreateRequestAttributes) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookCellCreateRequestAttributes) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNotebookCellCreateRequestAttributes) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookCellCreateRequestAttributes initializes the struct as if Set has been called. +func NewNullableNotebookCellCreateRequestAttributes(val *NotebookCellCreateRequestAttributes) *NullableNotebookCellCreateRequestAttributes { + return &NullableNotebookCellCreateRequestAttributes{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookCellCreateRequestAttributes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookCellCreateRequestAttributes) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_cell_resource_type.go b/api/v1/datadog/model_notebook_cell_resource_type.go new file mode 100644 index 00000000000..60c223ad8c9 --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_resource_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookCellResourceType Type of the Notebook Cell resource. +type NotebookCellResourceType string + +// List of NotebookCellResourceType. +const ( + NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS NotebookCellResourceType = "notebook_cells" +) + +var allowedNotebookCellResourceTypeEnumValues = []NotebookCellResourceType{ + NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *NotebookCellResourceType) GetAllowedValues() []NotebookCellResourceType { + return allowedNotebookCellResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *NotebookCellResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = NotebookCellResourceType(value) + return nil +} + +// NewNotebookCellResourceTypeFromValue returns a pointer to a valid NotebookCellResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewNotebookCellResourceTypeFromValue(v string) (*NotebookCellResourceType, error) { + ev := NotebookCellResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for NotebookCellResourceType: valid values are %v", v, allowedNotebookCellResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v NotebookCellResourceType) IsValid() bool { + for _, existing := range allowedNotebookCellResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NotebookCellResourceType value. +func (v NotebookCellResourceType) Ptr() *NotebookCellResourceType { + return &v +} + +// NullableNotebookCellResourceType handles when a null is used for NotebookCellResourceType. +type NullableNotebookCellResourceType struct { + value *NotebookCellResourceType + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookCellResourceType) Get() *NotebookCellResourceType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookCellResourceType) Set(val *NotebookCellResourceType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookCellResourceType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableNotebookCellResourceType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookCellResourceType initializes the struct as if Set has been called. +func NewNullableNotebookCellResourceType(val *NotebookCellResourceType) *NullableNotebookCellResourceType { + return &NullableNotebookCellResourceType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookCellResourceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookCellResourceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_cell_response.go b/api/v1/datadog/model_notebook_cell_response.go new file mode 100644 index 00000000000..f7f663d4f94 --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_response.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookCellResponse The description of a notebook cell response. +type NotebookCellResponse struct { + // The attributes of a notebook cell response. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, + // `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) + Attributes NotebookCellResponseAttributes `json:"attributes"` + // Notebook cell ID. + Id string `json:"id"` + // Type of the Notebook Cell resource. + Type NotebookCellResourceType `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{} +} + +// NewNotebookCellResponse instantiates a new NotebookCellResponse 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 NewNotebookCellResponse(attributes NotebookCellResponseAttributes, id string, typeVar NotebookCellResourceType) *NotebookCellResponse { + this := NotebookCellResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewNotebookCellResponseWithDefaults instantiates a new NotebookCellResponse 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 NewNotebookCellResponseWithDefaults() *NotebookCellResponse { + this := NotebookCellResponse{} + var typeVar NotebookCellResourceType = NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *NotebookCellResponse) GetAttributes() NotebookCellResponseAttributes { + if o == nil { + var ret NotebookCellResponseAttributes + 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 *NotebookCellResponse) GetAttributesOk() (*NotebookCellResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *NotebookCellResponse) SetAttributes(v NotebookCellResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *NotebookCellResponse) 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 *NotebookCellResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *NotebookCellResponse) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *NotebookCellResponse) GetType() NotebookCellResourceType { + if o == nil { + var ret NotebookCellResourceType + 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 *NotebookCellResponse) GetTypeOk() (*NotebookCellResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebookCellResponse) SetType(v NotebookCellResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookCellResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookCellResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *NotebookCellResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *NotebookCellResourceType `json:"type"` + }{} + all := struct { + Attributes NotebookCellResponseAttributes `json:"attributes"` + Id string `json:"id"` + Type NotebookCellResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_cell_response_attributes.go b/api/v1/datadog/model_notebook_cell_response_attributes.go new file mode 100644 index 00000000000..4d4396a2a72 --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_response_attributes.go @@ -0,0 +1,284 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookCellResponseAttributes - The attributes of a notebook cell response. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, +// `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) +type NotebookCellResponseAttributes struct { + NotebookMarkdownCellAttributes *NotebookMarkdownCellAttributes + NotebookTimeseriesCellAttributes *NotebookTimeseriesCellAttributes + NotebookToplistCellAttributes *NotebookToplistCellAttributes + NotebookHeatMapCellAttributes *NotebookHeatMapCellAttributes + NotebookDistributionCellAttributes *NotebookDistributionCellAttributes + NotebookLogStreamCellAttributes *NotebookLogStreamCellAttributes + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// NotebookMarkdownCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookMarkdownCellAttributes wrapped in NotebookCellResponseAttributes. +func NotebookMarkdownCellAttributesAsNotebookCellResponseAttributes(v *NotebookMarkdownCellAttributes) NotebookCellResponseAttributes { + return NotebookCellResponseAttributes{NotebookMarkdownCellAttributes: v} +} + +// NotebookTimeseriesCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookTimeseriesCellAttributes wrapped in NotebookCellResponseAttributes. +func NotebookTimeseriesCellAttributesAsNotebookCellResponseAttributes(v *NotebookTimeseriesCellAttributes) NotebookCellResponseAttributes { + return NotebookCellResponseAttributes{NotebookTimeseriesCellAttributes: v} +} + +// NotebookToplistCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookToplistCellAttributes wrapped in NotebookCellResponseAttributes. +func NotebookToplistCellAttributesAsNotebookCellResponseAttributes(v *NotebookToplistCellAttributes) NotebookCellResponseAttributes { + return NotebookCellResponseAttributes{NotebookToplistCellAttributes: v} +} + +// NotebookHeatMapCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookHeatMapCellAttributes wrapped in NotebookCellResponseAttributes. +func NotebookHeatMapCellAttributesAsNotebookCellResponseAttributes(v *NotebookHeatMapCellAttributes) NotebookCellResponseAttributes { + return NotebookCellResponseAttributes{NotebookHeatMapCellAttributes: v} +} + +// NotebookDistributionCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookDistributionCellAttributes wrapped in NotebookCellResponseAttributes. +func NotebookDistributionCellAttributesAsNotebookCellResponseAttributes(v *NotebookDistributionCellAttributes) NotebookCellResponseAttributes { + return NotebookCellResponseAttributes{NotebookDistributionCellAttributes: v} +} + +// NotebookLogStreamCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookLogStreamCellAttributes wrapped in NotebookCellResponseAttributes. +func NotebookLogStreamCellAttributesAsNotebookCellResponseAttributes(v *NotebookLogStreamCellAttributes) NotebookCellResponseAttributes { + return NotebookCellResponseAttributes{NotebookLogStreamCellAttributes: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *NotebookCellResponseAttributes) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NotebookMarkdownCellAttributes + err = json.Unmarshal(data, &obj.NotebookMarkdownCellAttributes) + if err == nil { + if obj.NotebookMarkdownCellAttributes != nil && obj.NotebookMarkdownCellAttributes.UnparsedObject == nil { + jsonNotebookMarkdownCellAttributes, _ := json.Marshal(obj.NotebookMarkdownCellAttributes) + if string(jsonNotebookMarkdownCellAttributes) == "{}" { // empty struct + obj.NotebookMarkdownCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookMarkdownCellAttributes = nil + } + } else { + obj.NotebookMarkdownCellAttributes = nil + } + + // try to unmarshal data into NotebookTimeseriesCellAttributes + err = json.Unmarshal(data, &obj.NotebookTimeseriesCellAttributes) + if err == nil { + if obj.NotebookTimeseriesCellAttributes != nil && obj.NotebookTimeseriesCellAttributes.UnparsedObject == nil { + jsonNotebookTimeseriesCellAttributes, _ := json.Marshal(obj.NotebookTimeseriesCellAttributes) + if string(jsonNotebookTimeseriesCellAttributes) == "{}" { // empty struct + obj.NotebookTimeseriesCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookTimeseriesCellAttributes = nil + } + } else { + obj.NotebookTimeseriesCellAttributes = nil + } + + // try to unmarshal data into NotebookToplistCellAttributes + err = json.Unmarshal(data, &obj.NotebookToplistCellAttributes) + if err == nil { + if obj.NotebookToplistCellAttributes != nil && obj.NotebookToplistCellAttributes.UnparsedObject == nil { + jsonNotebookToplistCellAttributes, _ := json.Marshal(obj.NotebookToplistCellAttributes) + if string(jsonNotebookToplistCellAttributes) == "{}" { // empty struct + obj.NotebookToplistCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookToplistCellAttributes = nil + } + } else { + obj.NotebookToplistCellAttributes = nil + } + + // try to unmarshal data into NotebookHeatMapCellAttributes + err = json.Unmarshal(data, &obj.NotebookHeatMapCellAttributes) + if err == nil { + if obj.NotebookHeatMapCellAttributes != nil && obj.NotebookHeatMapCellAttributes.UnparsedObject == nil { + jsonNotebookHeatMapCellAttributes, _ := json.Marshal(obj.NotebookHeatMapCellAttributes) + if string(jsonNotebookHeatMapCellAttributes) == "{}" { // empty struct + obj.NotebookHeatMapCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookHeatMapCellAttributes = nil + } + } else { + obj.NotebookHeatMapCellAttributes = nil + } + + // try to unmarshal data into NotebookDistributionCellAttributes + err = json.Unmarshal(data, &obj.NotebookDistributionCellAttributes) + if err == nil { + if obj.NotebookDistributionCellAttributes != nil && obj.NotebookDistributionCellAttributes.UnparsedObject == nil { + jsonNotebookDistributionCellAttributes, _ := json.Marshal(obj.NotebookDistributionCellAttributes) + if string(jsonNotebookDistributionCellAttributes) == "{}" { // empty struct + obj.NotebookDistributionCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookDistributionCellAttributes = nil + } + } else { + obj.NotebookDistributionCellAttributes = nil + } + + // try to unmarshal data into NotebookLogStreamCellAttributes + err = json.Unmarshal(data, &obj.NotebookLogStreamCellAttributes) + if err == nil { + if obj.NotebookLogStreamCellAttributes != nil && obj.NotebookLogStreamCellAttributes.UnparsedObject == nil { + jsonNotebookLogStreamCellAttributes, _ := json.Marshal(obj.NotebookLogStreamCellAttributes) + if string(jsonNotebookLogStreamCellAttributes) == "{}" { // empty struct + obj.NotebookLogStreamCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookLogStreamCellAttributes = nil + } + } else { + obj.NotebookLogStreamCellAttributes = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.NotebookMarkdownCellAttributes = nil + obj.NotebookTimeseriesCellAttributes = nil + obj.NotebookToplistCellAttributes = nil + obj.NotebookHeatMapCellAttributes = nil + obj.NotebookDistributionCellAttributes = nil + obj.NotebookLogStreamCellAttributes = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj NotebookCellResponseAttributes) MarshalJSON() ([]byte, error) { + if obj.NotebookMarkdownCellAttributes != nil { + return json.Marshal(&obj.NotebookMarkdownCellAttributes) + } + + if obj.NotebookTimeseriesCellAttributes != nil { + return json.Marshal(&obj.NotebookTimeseriesCellAttributes) + } + + if obj.NotebookToplistCellAttributes != nil { + return json.Marshal(&obj.NotebookToplistCellAttributes) + } + + if obj.NotebookHeatMapCellAttributes != nil { + return json.Marshal(&obj.NotebookHeatMapCellAttributes) + } + + if obj.NotebookDistributionCellAttributes != nil { + return json.Marshal(&obj.NotebookDistributionCellAttributes) + } + + if obj.NotebookLogStreamCellAttributes != nil { + return json.Marshal(&obj.NotebookLogStreamCellAttributes) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *NotebookCellResponseAttributes) GetActualInstance() interface{} { + if obj.NotebookMarkdownCellAttributes != nil { + return obj.NotebookMarkdownCellAttributes + } + + if obj.NotebookTimeseriesCellAttributes != nil { + return obj.NotebookTimeseriesCellAttributes + } + + if obj.NotebookToplistCellAttributes != nil { + return obj.NotebookToplistCellAttributes + } + + if obj.NotebookHeatMapCellAttributes != nil { + return obj.NotebookHeatMapCellAttributes + } + + if obj.NotebookDistributionCellAttributes != nil { + return obj.NotebookDistributionCellAttributes + } + + if obj.NotebookLogStreamCellAttributes != nil { + return obj.NotebookLogStreamCellAttributes + } + + // all schemas are nil + return nil +} + +// NullableNotebookCellResponseAttributes handles when a null is used for NotebookCellResponseAttributes. +type NullableNotebookCellResponseAttributes struct { + value *NotebookCellResponseAttributes + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookCellResponseAttributes) Get() *NotebookCellResponseAttributes { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookCellResponseAttributes) Set(val *NotebookCellResponseAttributes) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookCellResponseAttributes) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNotebookCellResponseAttributes) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookCellResponseAttributes initializes the struct as if Set has been called. +func NewNullableNotebookCellResponseAttributes(val *NotebookCellResponseAttributes) *NullableNotebookCellResponseAttributes { + return &NullableNotebookCellResponseAttributes{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookCellResponseAttributes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookCellResponseAttributes) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_cell_time.go b/api/v1/datadog/model_notebook_cell_time.go new file mode 100644 index 00000000000..201559bf14b --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_time.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookCellTime - Timeframe for the notebook cell. When 'null', the notebook global time is used. +type NotebookCellTime struct { + NotebookRelativeTime *NotebookRelativeTime + NotebookAbsoluteTime *NotebookAbsoluteTime + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// NotebookRelativeTimeAsNotebookCellTime is a convenience function that returns NotebookRelativeTime wrapped in NotebookCellTime. +func NotebookRelativeTimeAsNotebookCellTime(v *NotebookRelativeTime) NotebookCellTime { + return NotebookCellTime{NotebookRelativeTime: v} +} + +// NotebookAbsoluteTimeAsNotebookCellTime is a convenience function that returns NotebookAbsoluteTime wrapped in NotebookCellTime. +func NotebookAbsoluteTimeAsNotebookCellTime(v *NotebookAbsoluteTime) NotebookCellTime { + return NotebookCellTime{NotebookAbsoluteTime: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *NotebookCellTime) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NotebookRelativeTime + err = json.Unmarshal(data, &obj.NotebookRelativeTime) + if err == nil { + if obj.NotebookRelativeTime != nil && obj.NotebookRelativeTime.UnparsedObject == nil { + jsonNotebookRelativeTime, _ := json.Marshal(obj.NotebookRelativeTime) + if string(jsonNotebookRelativeTime) == "{}" { // empty struct + obj.NotebookRelativeTime = nil + } else { + match++ + } + } else { + obj.NotebookRelativeTime = nil + } + } else { + obj.NotebookRelativeTime = nil + } + + // try to unmarshal data into NotebookAbsoluteTime + err = json.Unmarshal(data, &obj.NotebookAbsoluteTime) + if err == nil { + if obj.NotebookAbsoluteTime != nil && obj.NotebookAbsoluteTime.UnparsedObject == nil { + jsonNotebookAbsoluteTime, _ := json.Marshal(obj.NotebookAbsoluteTime) + if string(jsonNotebookAbsoluteTime) == "{}" { // empty struct + obj.NotebookAbsoluteTime = nil + } else { + match++ + } + } else { + obj.NotebookAbsoluteTime = nil + } + } else { + obj.NotebookAbsoluteTime = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.NotebookRelativeTime = nil + obj.NotebookAbsoluteTime = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj NotebookCellTime) MarshalJSON() ([]byte, error) { + if obj.NotebookRelativeTime != nil { + return json.Marshal(&obj.NotebookRelativeTime) + } + + if obj.NotebookAbsoluteTime != nil { + return json.Marshal(&obj.NotebookAbsoluteTime) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *NotebookCellTime) GetActualInstance() interface{} { + if obj.NotebookRelativeTime != nil { + return obj.NotebookRelativeTime + } + + if obj.NotebookAbsoluteTime != nil { + return obj.NotebookAbsoluteTime + } + + // all schemas are nil + return nil +} + +// NullableNotebookCellTime handles when a null is used for NotebookCellTime. +type NullableNotebookCellTime struct { + value *NotebookCellTime + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookCellTime) Get() *NotebookCellTime { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookCellTime) Set(val *NotebookCellTime) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookCellTime) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNotebookCellTime) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookCellTime initializes the struct as if Set has been called. +func NewNullableNotebookCellTime(val *NotebookCellTime) *NullableNotebookCellTime { + return &NullableNotebookCellTime{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookCellTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookCellTime) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_cell_update_request.go b/api/v1/datadog/model_notebook_cell_update_request.go new file mode 100644 index 00000000000..c5fa310812b --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_update_request.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookCellUpdateRequest The description of a notebook cell update request. +type NotebookCellUpdateRequest struct { + // The attributes of a notebook cell in update cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, + // `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) + Attributes NotebookCellUpdateRequestAttributes `json:"attributes"` + // Notebook cell ID. + Id string `json:"id"` + // Type of the Notebook Cell resource. + Type NotebookCellResourceType `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{} +} + +// NewNotebookCellUpdateRequest instantiates a new NotebookCellUpdateRequest 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 NewNotebookCellUpdateRequest(attributes NotebookCellUpdateRequestAttributes, id string, typeVar NotebookCellResourceType) *NotebookCellUpdateRequest { + this := NotebookCellUpdateRequest{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewNotebookCellUpdateRequestWithDefaults instantiates a new NotebookCellUpdateRequest 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 NewNotebookCellUpdateRequestWithDefaults() *NotebookCellUpdateRequest { + this := NotebookCellUpdateRequest{} + var typeVar NotebookCellResourceType = NOTEBOOKCELLRESOURCETYPE_NOTEBOOK_CELLS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *NotebookCellUpdateRequest) GetAttributes() NotebookCellUpdateRequestAttributes { + if o == nil { + var ret NotebookCellUpdateRequestAttributes + 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 *NotebookCellUpdateRequest) GetAttributesOk() (*NotebookCellUpdateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *NotebookCellUpdateRequest) SetAttributes(v NotebookCellUpdateRequestAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *NotebookCellUpdateRequest) 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 *NotebookCellUpdateRequest) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *NotebookCellUpdateRequest) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *NotebookCellUpdateRequest) GetType() NotebookCellResourceType { + if o == nil { + var ret NotebookCellResourceType + 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 *NotebookCellUpdateRequest) GetTypeOk() (*NotebookCellResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebookCellUpdateRequest) SetType(v NotebookCellResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookCellUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookCellUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *NotebookCellUpdateRequestAttributes `json:"attributes"` + Id *string `json:"id"` + Type *NotebookCellResourceType `json:"type"` + }{} + all := struct { + Attributes NotebookCellUpdateRequestAttributes `json:"attributes"` + Id string `json:"id"` + Type NotebookCellResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_cell_update_request_attributes.go b/api/v1/datadog/model_notebook_cell_update_request_attributes.go new file mode 100644 index 00000000000..d0de8351ecc --- /dev/null +++ b/api/v1/datadog/model_notebook_cell_update_request_attributes.go @@ -0,0 +1,284 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookCellUpdateRequestAttributes - The attributes of a notebook cell in update cell request. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`, +// `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/) +type NotebookCellUpdateRequestAttributes struct { + NotebookMarkdownCellAttributes *NotebookMarkdownCellAttributes + NotebookTimeseriesCellAttributes *NotebookTimeseriesCellAttributes + NotebookToplistCellAttributes *NotebookToplistCellAttributes + NotebookHeatMapCellAttributes *NotebookHeatMapCellAttributes + NotebookDistributionCellAttributes *NotebookDistributionCellAttributes + NotebookLogStreamCellAttributes *NotebookLogStreamCellAttributes + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// NotebookMarkdownCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookMarkdownCellAttributes wrapped in NotebookCellUpdateRequestAttributes. +func NotebookMarkdownCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookMarkdownCellAttributes) NotebookCellUpdateRequestAttributes { + return NotebookCellUpdateRequestAttributes{NotebookMarkdownCellAttributes: v} +} + +// NotebookTimeseriesCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookTimeseriesCellAttributes wrapped in NotebookCellUpdateRequestAttributes. +func NotebookTimeseriesCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookTimeseriesCellAttributes) NotebookCellUpdateRequestAttributes { + return NotebookCellUpdateRequestAttributes{NotebookTimeseriesCellAttributes: v} +} + +// NotebookToplistCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookToplistCellAttributes wrapped in NotebookCellUpdateRequestAttributes. +func NotebookToplistCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookToplistCellAttributes) NotebookCellUpdateRequestAttributes { + return NotebookCellUpdateRequestAttributes{NotebookToplistCellAttributes: v} +} + +// NotebookHeatMapCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookHeatMapCellAttributes wrapped in NotebookCellUpdateRequestAttributes. +func NotebookHeatMapCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookHeatMapCellAttributes) NotebookCellUpdateRequestAttributes { + return NotebookCellUpdateRequestAttributes{NotebookHeatMapCellAttributes: v} +} + +// NotebookDistributionCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookDistributionCellAttributes wrapped in NotebookCellUpdateRequestAttributes. +func NotebookDistributionCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookDistributionCellAttributes) NotebookCellUpdateRequestAttributes { + return NotebookCellUpdateRequestAttributes{NotebookDistributionCellAttributes: v} +} + +// NotebookLogStreamCellAttributesAsNotebookCellUpdateRequestAttributes is a convenience function that returns NotebookLogStreamCellAttributes wrapped in NotebookCellUpdateRequestAttributes. +func NotebookLogStreamCellAttributesAsNotebookCellUpdateRequestAttributes(v *NotebookLogStreamCellAttributes) NotebookCellUpdateRequestAttributes { + return NotebookCellUpdateRequestAttributes{NotebookLogStreamCellAttributes: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *NotebookCellUpdateRequestAttributes) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NotebookMarkdownCellAttributes + err = json.Unmarshal(data, &obj.NotebookMarkdownCellAttributes) + if err == nil { + if obj.NotebookMarkdownCellAttributes != nil && obj.NotebookMarkdownCellAttributes.UnparsedObject == nil { + jsonNotebookMarkdownCellAttributes, _ := json.Marshal(obj.NotebookMarkdownCellAttributes) + if string(jsonNotebookMarkdownCellAttributes) == "{}" { // empty struct + obj.NotebookMarkdownCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookMarkdownCellAttributes = nil + } + } else { + obj.NotebookMarkdownCellAttributes = nil + } + + // try to unmarshal data into NotebookTimeseriesCellAttributes + err = json.Unmarshal(data, &obj.NotebookTimeseriesCellAttributes) + if err == nil { + if obj.NotebookTimeseriesCellAttributes != nil && obj.NotebookTimeseriesCellAttributes.UnparsedObject == nil { + jsonNotebookTimeseriesCellAttributes, _ := json.Marshal(obj.NotebookTimeseriesCellAttributes) + if string(jsonNotebookTimeseriesCellAttributes) == "{}" { // empty struct + obj.NotebookTimeseriesCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookTimeseriesCellAttributes = nil + } + } else { + obj.NotebookTimeseriesCellAttributes = nil + } + + // try to unmarshal data into NotebookToplistCellAttributes + err = json.Unmarshal(data, &obj.NotebookToplistCellAttributes) + if err == nil { + if obj.NotebookToplistCellAttributes != nil && obj.NotebookToplistCellAttributes.UnparsedObject == nil { + jsonNotebookToplistCellAttributes, _ := json.Marshal(obj.NotebookToplistCellAttributes) + if string(jsonNotebookToplistCellAttributes) == "{}" { // empty struct + obj.NotebookToplistCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookToplistCellAttributes = nil + } + } else { + obj.NotebookToplistCellAttributes = nil + } + + // try to unmarshal data into NotebookHeatMapCellAttributes + err = json.Unmarshal(data, &obj.NotebookHeatMapCellAttributes) + if err == nil { + if obj.NotebookHeatMapCellAttributes != nil && obj.NotebookHeatMapCellAttributes.UnparsedObject == nil { + jsonNotebookHeatMapCellAttributes, _ := json.Marshal(obj.NotebookHeatMapCellAttributes) + if string(jsonNotebookHeatMapCellAttributes) == "{}" { // empty struct + obj.NotebookHeatMapCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookHeatMapCellAttributes = nil + } + } else { + obj.NotebookHeatMapCellAttributes = nil + } + + // try to unmarshal data into NotebookDistributionCellAttributes + err = json.Unmarshal(data, &obj.NotebookDistributionCellAttributes) + if err == nil { + if obj.NotebookDistributionCellAttributes != nil && obj.NotebookDistributionCellAttributes.UnparsedObject == nil { + jsonNotebookDistributionCellAttributes, _ := json.Marshal(obj.NotebookDistributionCellAttributes) + if string(jsonNotebookDistributionCellAttributes) == "{}" { // empty struct + obj.NotebookDistributionCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookDistributionCellAttributes = nil + } + } else { + obj.NotebookDistributionCellAttributes = nil + } + + // try to unmarshal data into NotebookLogStreamCellAttributes + err = json.Unmarshal(data, &obj.NotebookLogStreamCellAttributes) + if err == nil { + if obj.NotebookLogStreamCellAttributes != nil && obj.NotebookLogStreamCellAttributes.UnparsedObject == nil { + jsonNotebookLogStreamCellAttributes, _ := json.Marshal(obj.NotebookLogStreamCellAttributes) + if string(jsonNotebookLogStreamCellAttributes) == "{}" { // empty struct + obj.NotebookLogStreamCellAttributes = nil + } else { + match++ + } + } else { + obj.NotebookLogStreamCellAttributes = nil + } + } else { + obj.NotebookLogStreamCellAttributes = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.NotebookMarkdownCellAttributes = nil + obj.NotebookTimeseriesCellAttributes = nil + obj.NotebookToplistCellAttributes = nil + obj.NotebookHeatMapCellAttributes = nil + obj.NotebookDistributionCellAttributes = nil + obj.NotebookLogStreamCellAttributes = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj NotebookCellUpdateRequestAttributes) MarshalJSON() ([]byte, error) { + if obj.NotebookMarkdownCellAttributes != nil { + return json.Marshal(&obj.NotebookMarkdownCellAttributes) + } + + if obj.NotebookTimeseriesCellAttributes != nil { + return json.Marshal(&obj.NotebookTimeseriesCellAttributes) + } + + if obj.NotebookToplistCellAttributes != nil { + return json.Marshal(&obj.NotebookToplistCellAttributes) + } + + if obj.NotebookHeatMapCellAttributes != nil { + return json.Marshal(&obj.NotebookHeatMapCellAttributes) + } + + if obj.NotebookDistributionCellAttributes != nil { + return json.Marshal(&obj.NotebookDistributionCellAttributes) + } + + if obj.NotebookLogStreamCellAttributes != nil { + return json.Marshal(&obj.NotebookLogStreamCellAttributes) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *NotebookCellUpdateRequestAttributes) GetActualInstance() interface{} { + if obj.NotebookMarkdownCellAttributes != nil { + return obj.NotebookMarkdownCellAttributes + } + + if obj.NotebookTimeseriesCellAttributes != nil { + return obj.NotebookTimeseriesCellAttributes + } + + if obj.NotebookToplistCellAttributes != nil { + return obj.NotebookToplistCellAttributes + } + + if obj.NotebookHeatMapCellAttributes != nil { + return obj.NotebookHeatMapCellAttributes + } + + if obj.NotebookDistributionCellAttributes != nil { + return obj.NotebookDistributionCellAttributes + } + + if obj.NotebookLogStreamCellAttributes != nil { + return obj.NotebookLogStreamCellAttributes + } + + // all schemas are nil + return nil +} + +// NullableNotebookCellUpdateRequestAttributes handles when a null is used for NotebookCellUpdateRequestAttributes. +type NullableNotebookCellUpdateRequestAttributes struct { + value *NotebookCellUpdateRequestAttributes + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookCellUpdateRequestAttributes) Get() *NotebookCellUpdateRequestAttributes { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookCellUpdateRequestAttributes) Set(val *NotebookCellUpdateRequestAttributes) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookCellUpdateRequestAttributes) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNotebookCellUpdateRequestAttributes) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookCellUpdateRequestAttributes initializes the struct as if Set has been called. +func NewNullableNotebookCellUpdateRequestAttributes(val *NotebookCellUpdateRequestAttributes) *NullableNotebookCellUpdateRequestAttributes { + return &NullableNotebookCellUpdateRequestAttributes{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookCellUpdateRequestAttributes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookCellUpdateRequestAttributes) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_create_data.go b/api/v1/datadog/model_notebook_create_data.go new file mode 100644 index 00000000000..bec1eec183c --- /dev/null +++ b/api/v1/datadog/model_notebook_create_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookCreateData The data for a notebook create request. +type NotebookCreateData struct { + // The data attributes of a notebook. + Attributes NotebookCreateDataAttributes `json:"attributes"` + // Type of the Notebook resource. + Type NotebookResourceType `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{} +} + +// NewNotebookCreateData instantiates a new NotebookCreateData 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 NewNotebookCreateData(attributes NotebookCreateDataAttributes, typeVar NotebookResourceType) *NotebookCreateData { + this := NotebookCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewNotebookCreateDataWithDefaults instantiates a new NotebookCreateData 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 NewNotebookCreateDataWithDefaults() *NotebookCreateData { + this := NotebookCreateData{} + var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *NotebookCreateData) GetAttributes() NotebookCreateDataAttributes { + if o == nil { + var ret NotebookCreateDataAttributes + 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 *NotebookCreateData) GetAttributesOk() (*NotebookCreateDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *NotebookCreateData) SetAttributes(v NotebookCreateDataAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *NotebookCreateData) GetType() NotebookResourceType { + if o == nil { + var ret NotebookResourceType + 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 *NotebookCreateData) GetTypeOk() (*NotebookResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebookCreateData) SetType(v NotebookResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *NotebookCreateDataAttributes `json:"attributes"` + Type *NotebookResourceType `json:"type"` + }{} + all := struct { + Attributes NotebookCreateDataAttributes `json:"attributes"` + Type NotebookResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_create_data_attributes.go b/api/v1/datadog/model_notebook_create_data_attributes.go new file mode 100644 index 00000000000..e7c05319d2a --- /dev/null +++ b/api/v1/datadog/model_notebook_create_data_attributes.go @@ -0,0 +1,266 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookCreateDataAttributes The data attributes of a notebook. +type NotebookCreateDataAttributes struct { + // List of cells to display in the notebook. + Cells []NotebookCellCreateRequest `json:"cells"` + // Metadata associated with the notebook. + Metadata *NotebookMetadata `json:"metadata,omitempty"` + // The name of the notebook. + Name string `json:"name"` + // Publication status of the notebook. For now, always "published". + Status *NotebookStatus `json:"status,omitempty"` + // Notebook global timeframe. + Time NotebookGlobalTime `json:"time"` + // 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{} +} + +// NewNotebookCreateDataAttributes instantiates a new NotebookCreateDataAttributes 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 NewNotebookCreateDataAttributes(cells []NotebookCellCreateRequest, name string, time NotebookGlobalTime) *NotebookCreateDataAttributes { + this := NotebookCreateDataAttributes{} + this.Cells = cells + this.Name = name + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + this.Time = time + return &this +} + +// NewNotebookCreateDataAttributesWithDefaults instantiates a new NotebookCreateDataAttributes 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 NewNotebookCreateDataAttributesWithDefaults() *NotebookCreateDataAttributes { + this := NotebookCreateDataAttributes{} + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + return &this +} + +// GetCells returns the Cells field value. +func (o *NotebookCreateDataAttributes) GetCells() []NotebookCellCreateRequest { + if o == nil { + var ret []NotebookCellCreateRequest + return ret + } + return o.Cells +} + +// GetCellsOk returns a tuple with the Cells field value +// and a boolean to check if the value has been set. +func (o *NotebookCreateDataAttributes) GetCellsOk() (*[]NotebookCellCreateRequest, bool) { + if o == nil { + return nil, false + } + return &o.Cells, true +} + +// SetCells sets field value. +func (o *NotebookCreateDataAttributes) SetCells(v []NotebookCellCreateRequest) { + o.Cells = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NotebookCreateDataAttributes) GetMetadata() NotebookMetadata { + if o == nil || o.Metadata == nil { + var ret NotebookMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookCreateDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *NotebookCreateDataAttributes) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. +func (o *NotebookCreateDataAttributes) SetMetadata(v NotebookMetadata) { + o.Metadata = &v +} + +// GetName returns the Name field value. +func (o *NotebookCreateDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NotebookCreateDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *NotebookCreateDataAttributes) SetName(v string) { + o.Name = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NotebookCreateDataAttributes) GetStatus() NotebookStatus { + if o == nil || o.Status == nil { + var ret NotebookStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookCreateDataAttributes) GetStatusOk() (*NotebookStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *NotebookCreateDataAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. +func (o *NotebookCreateDataAttributes) SetStatus(v NotebookStatus) { + o.Status = &v +} + +// GetTime returns the Time field value. +func (o *NotebookCreateDataAttributes) GetTime() NotebookGlobalTime { + if o == nil { + var ret NotebookGlobalTime + return ret + } + return o.Time +} + +// GetTimeOk returns a tuple with the Time field value +// and a boolean to check if the value has been set. +func (o *NotebookCreateDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { + if o == nil { + return nil, false + } + return &o.Time, true +} + +// SetTime sets field value. +func (o *NotebookCreateDataAttributes) SetTime(v NotebookGlobalTime) { + o.Time = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookCreateDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["cells"] = o.Cells + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["name"] = o.Name + if o.Status != nil { + toSerialize["status"] = o.Status + } + toSerialize["time"] = o.Time + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Cells *[]NotebookCellCreateRequest `json:"cells"` + Name *string `json:"name"` + Time *NotebookGlobalTime `json:"time"` + }{} + all := struct { + Cells []NotebookCellCreateRequest `json:"cells"` + Metadata *NotebookMetadata `json:"metadata,omitempty"` + Name string `json:"name"` + Status *NotebookStatus `json:"status,omitempty"` + Time NotebookGlobalTime `json:"time"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Cells == nil { + return fmt.Errorf("Required field cells missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Time == nil { + return fmt.Errorf("Required field time missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cells = all.Cells + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Name = all.Name + o.Status = all.Status + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_create_request.go b/api/v1/datadog/model_notebook_create_request.go new file mode 100644 index 00000000000..3d9d5799f65 --- /dev/null +++ b/api/v1/datadog/model_notebook_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookCreateRequest The description of a notebook create request. +type NotebookCreateRequest struct { + // The data for a notebook create request. + Data NotebookCreateData `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{} +} + +// NewNotebookCreateRequest instantiates a new NotebookCreateRequest 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 NewNotebookCreateRequest(data NotebookCreateData) *NotebookCreateRequest { + this := NotebookCreateRequest{} + this.Data = data + return &this +} + +// NewNotebookCreateRequestWithDefaults instantiates a new NotebookCreateRequest 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 NewNotebookCreateRequestWithDefaults() *NotebookCreateRequest { + this := NotebookCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *NotebookCreateRequest) GetData() NotebookCreateData { + if o == nil { + var ret NotebookCreateData + 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 *NotebookCreateRequest) GetDataOk() (*NotebookCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *NotebookCreateRequest) SetData(v NotebookCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *NotebookCreateData `json:"data"` + }{} + all := struct { + Data NotebookCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_notebook_distribution_cell_attributes.go b/api/v1/datadog/model_notebook_distribution_cell_attributes.go new file mode 100644 index 00000000000..51a773ba179 --- /dev/null +++ b/api/v1/datadog/model_notebook_distribution_cell_attributes.go @@ -0,0 +1,255 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookDistributionCellAttributes The attributes of a notebook `distribution` cell. +type NotebookDistributionCellAttributes struct { + // The Distribution visualization is another way of showing metrics + // aggregated across one or several tags, such as hosts. + // Unlike the heat map, a distribution graph’s x-axis is quantity rather than time. + Definition DistributionWidgetDefinition `json:"definition"` + // The size of the graph. + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + // Object describing how to split the graph to display multiple visualizations per request. + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + // Timeframe for the notebook cell. When 'null', the notebook global time is used. + Time NullableNotebookCellTime `json:"time,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{} +} + +// NewNotebookDistributionCellAttributes instantiates a new NotebookDistributionCellAttributes 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 NewNotebookDistributionCellAttributes(definition DistributionWidgetDefinition) *NotebookDistributionCellAttributes { + this := NotebookDistributionCellAttributes{} + this.Definition = definition + return &this +} + +// NewNotebookDistributionCellAttributesWithDefaults instantiates a new NotebookDistributionCellAttributes 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 NewNotebookDistributionCellAttributesWithDefaults() *NotebookDistributionCellAttributes { + this := NotebookDistributionCellAttributes{} + return &this +} + +// GetDefinition returns the Definition field value. +func (o *NotebookDistributionCellAttributes) GetDefinition() DistributionWidgetDefinition { + if o == nil { + var ret DistributionWidgetDefinition + return ret + } + return o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value +// and a boolean to check if the value has been set. +func (o *NotebookDistributionCellAttributes) GetDefinitionOk() (*DistributionWidgetDefinition, bool) { + if o == nil { + return nil, false + } + return &o.Definition, true +} + +// SetDefinition sets field value. +func (o *NotebookDistributionCellAttributes) SetDefinition(v DistributionWidgetDefinition) { + o.Definition = v +} + +// GetGraphSize returns the GraphSize field value if set, zero value otherwise. +func (o *NotebookDistributionCellAttributes) GetGraphSize() NotebookGraphSize { + if o == nil || o.GraphSize == nil { + var ret NotebookGraphSize + return ret + } + return *o.GraphSize +} + +// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookDistributionCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { + if o == nil || o.GraphSize == nil { + return nil, false + } + return o.GraphSize, true +} + +// HasGraphSize returns a boolean if a field has been set. +func (o *NotebookDistributionCellAttributes) HasGraphSize() bool { + if o != nil && o.GraphSize != nil { + return true + } + + return false +} + +// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. +func (o *NotebookDistributionCellAttributes) SetGraphSize(v NotebookGraphSize) { + o.GraphSize = &v +} + +// GetSplitBy returns the SplitBy field value if set, zero value otherwise. +func (o *NotebookDistributionCellAttributes) GetSplitBy() NotebookSplitBy { + if o == nil || o.SplitBy == nil { + var ret NotebookSplitBy + return ret + } + return *o.SplitBy +} + +// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookDistributionCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { + if o == nil || o.SplitBy == nil { + return nil, false + } + return o.SplitBy, true +} + +// HasSplitBy returns a boolean if a field has been set. +func (o *NotebookDistributionCellAttributes) HasSplitBy() bool { + if o != nil && o.SplitBy != nil { + return true + } + + return false +} + +// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. +func (o *NotebookDistributionCellAttributes) SetSplitBy(v NotebookSplitBy) { + o.SplitBy = &v +} + +// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookDistributionCellAttributes) GetTime() NotebookCellTime { + if o == nil || o.Time.Get() == nil { + var ret NotebookCellTime + return ret + } + return *o.Time.Get() +} + +// GetTimeOk returns a tuple with the Time 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 *NotebookDistributionCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { + if o == nil { + return nil, false + } + return o.Time.Get(), o.Time.IsSet() +} + +// HasTime returns a boolean if a field has been set. +func (o *NotebookDistributionCellAttributes) HasTime() bool { + if o != nil && o.Time.IsSet() { + return true + } + + return false +} + +// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. +func (o *NotebookDistributionCellAttributes) SetTime(v NotebookCellTime) { + o.Time.Set(&v) +} + +// SetTimeNil sets the value for Time to be an explicit nil. +func (o *NotebookDistributionCellAttributes) SetTimeNil() { + o.Time.Set(nil) +} + +// UnsetTime ensures that no value is present for Time, not even an explicit nil. +func (o *NotebookDistributionCellAttributes) UnsetTime() { + o.Time.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookDistributionCellAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["definition"] = o.Definition + if o.GraphSize != nil { + toSerialize["graph_size"] = o.GraphSize + } + if o.SplitBy != nil { + toSerialize["split_by"] = o.SplitBy + } + if o.Time.IsSet() { + toSerialize["time"] = o.Time.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Definition *DistributionWidgetDefinition `json:"definition"` + }{} + all := struct { + Definition DistributionWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Definition == nil { + return fmt.Errorf("Required field definition missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.GraphSize; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Definition = all.Definition + o.GraphSize = all.GraphSize + if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SplitBy = all.SplitBy + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_global_time.go b/api/v1/datadog/model_notebook_global_time.go new file mode 100644 index 00000000000..81952cca0b1 --- /dev/null +++ b/api/v1/datadog/model_notebook_global_time.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookGlobalTime - Notebook global timeframe. +type NotebookGlobalTime struct { + NotebookRelativeTime *NotebookRelativeTime + NotebookAbsoluteTime *NotebookAbsoluteTime + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// NotebookRelativeTimeAsNotebookGlobalTime is a convenience function that returns NotebookRelativeTime wrapped in NotebookGlobalTime. +func NotebookRelativeTimeAsNotebookGlobalTime(v *NotebookRelativeTime) NotebookGlobalTime { + return NotebookGlobalTime{NotebookRelativeTime: v} +} + +// NotebookAbsoluteTimeAsNotebookGlobalTime is a convenience function that returns NotebookAbsoluteTime wrapped in NotebookGlobalTime. +func NotebookAbsoluteTimeAsNotebookGlobalTime(v *NotebookAbsoluteTime) NotebookGlobalTime { + return NotebookGlobalTime{NotebookAbsoluteTime: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *NotebookGlobalTime) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NotebookRelativeTime + err = json.Unmarshal(data, &obj.NotebookRelativeTime) + if err == nil { + if obj.NotebookRelativeTime != nil && obj.NotebookRelativeTime.UnparsedObject == nil { + jsonNotebookRelativeTime, _ := json.Marshal(obj.NotebookRelativeTime) + if string(jsonNotebookRelativeTime) == "{}" { // empty struct + obj.NotebookRelativeTime = nil + } else { + match++ + } + } else { + obj.NotebookRelativeTime = nil + } + } else { + obj.NotebookRelativeTime = nil + } + + // try to unmarshal data into NotebookAbsoluteTime + err = json.Unmarshal(data, &obj.NotebookAbsoluteTime) + if err == nil { + if obj.NotebookAbsoluteTime != nil && obj.NotebookAbsoluteTime.UnparsedObject == nil { + jsonNotebookAbsoluteTime, _ := json.Marshal(obj.NotebookAbsoluteTime) + if string(jsonNotebookAbsoluteTime) == "{}" { // empty struct + obj.NotebookAbsoluteTime = nil + } else { + match++ + } + } else { + obj.NotebookAbsoluteTime = nil + } + } else { + obj.NotebookAbsoluteTime = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.NotebookRelativeTime = nil + obj.NotebookAbsoluteTime = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj NotebookGlobalTime) MarshalJSON() ([]byte, error) { + if obj.NotebookRelativeTime != nil { + return json.Marshal(&obj.NotebookRelativeTime) + } + + if obj.NotebookAbsoluteTime != nil { + return json.Marshal(&obj.NotebookAbsoluteTime) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *NotebookGlobalTime) GetActualInstance() interface{} { + if obj.NotebookRelativeTime != nil { + return obj.NotebookRelativeTime + } + + if obj.NotebookAbsoluteTime != nil { + return obj.NotebookAbsoluteTime + } + + // all schemas are nil + return nil +} + +// NullableNotebookGlobalTime handles when a null is used for NotebookGlobalTime. +type NullableNotebookGlobalTime struct { + value *NotebookGlobalTime + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookGlobalTime) Get() *NotebookGlobalTime { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookGlobalTime) Set(val *NotebookGlobalTime) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookGlobalTime) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNotebookGlobalTime) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookGlobalTime initializes the struct as if Set has been called. +func NewNullableNotebookGlobalTime(val *NotebookGlobalTime) *NullableNotebookGlobalTime { + return &NullableNotebookGlobalTime{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookGlobalTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookGlobalTime) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_graph_size.go b/api/v1/datadog/model_notebook_graph_size.go new file mode 100644 index 00000000000..191a016a3ad --- /dev/null +++ b/api/v1/datadog/model_notebook_graph_size.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookGraphSize The size of the graph. +type NotebookGraphSize string + +// List of NotebookGraphSize. +const ( + NOTEBOOKGRAPHSIZE_EXTRA_SMALL NotebookGraphSize = "xs" + NOTEBOOKGRAPHSIZE_SMALL NotebookGraphSize = "s" + NOTEBOOKGRAPHSIZE_MEDIUM NotebookGraphSize = "m" + NOTEBOOKGRAPHSIZE_LARGE NotebookGraphSize = "l" + NOTEBOOKGRAPHSIZE_EXTRA_LARGE NotebookGraphSize = "xl" +) + +var allowedNotebookGraphSizeEnumValues = []NotebookGraphSize{ + NOTEBOOKGRAPHSIZE_EXTRA_SMALL, + NOTEBOOKGRAPHSIZE_SMALL, + NOTEBOOKGRAPHSIZE_MEDIUM, + NOTEBOOKGRAPHSIZE_LARGE, + NOTEBOOKGRAPHSIZE_EXTRA_LARGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *NotebookGraphSize) GetAllowedValues() []NotebookGraphSize { + return allowedNotebookGraphSizeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *NotebookGraphSize) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = NotebookGraphSize(value) + return nil +} + +// NewNotebookGraphSizeFromValue returns a pointer to a valid NotebookGraphSize +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewNotebookGraphSizeFromValue(v string) (*NotebookGraphSize, error) { + ev := NotebookGraphSize(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for NotebookGraphSize: valid values are %v", v, allowedNotebookGraphSizeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v NotebookGraphSize) IsValid() bool { + for _, existing := range allowedNotebookGraphSizeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NotebookGraphSize value. +func (v NotebookGraphSize) Ptr() *NotebookGraphSize { + return &v +} + +// NullableNotebookGraphSize handles when a null is used for NotebookGraphSize. +type NullableNotebookGraphSize struct { + value *NotebookGraphSize + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookGraphSize) Get() *NotebookGraphSize { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookGraphSize) Set(val *NotebookGraphSize) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookGraphSize) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableNotebookGraphSize) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookGraphSize initializes the struct as if Set has been called. +func NewNullableNotebookGraphSize(val *NotebookGraphSize) *NullableNotebookGraphSize { + return &NullableNotebookGraphSize{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookGraphSize) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookGraphSize) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_heat_map_cell_attributes.go b/api/v1/datadog/model_notebook_heat_map_cell_attributes.go new file mode 100644 index 00000000000..0158b80e6fb --- /dev/null +++ b/api/v1/datadog/model_notebook_heat_map_cell_attributes.go @@ -0,0 +1,253 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookHeatMapCellAttributes The attributes of a notebook `heatmap` cell. +type NotebookHeatMapCellAttributes struct { + // The heat map visualization shows metrics aggregated across many tags, such as hosts. The more hosts that have a particular value, the darker that square is. + Definition HeatMapWidgetDefinition `json:"definition"` + // The size of the graph. + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + // Object describing how to split the graph to display multiple visualizations per request. + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + // Timeframe for the notebook cell. When 'null', the notebook global time is used. + Time NullableNotebookCellTime `json:"time,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{} +} + +// NewNotebookHeatMapCellAttributes instantiates a new NotebookHeatMapCellAttributes 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 NewNotebookHeatMapCellAttributes(definition HeatMapWidgetDefinition) *NotebookHeatMapCellAttributes { + this := NotebookHeatMapCellAttributes{} + this.Definition = definition + return &this +} + +// NewNotebookHeatMapCellAttributesWithDefaults instantiates a new NotebookHeatMapCellAttributes 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 NewNotebookHeatMapCellAttributesWithDefaults() *NotebookHeatMapCellAttributes { + this := NotebookHeatMapCellAttributes{} + return &this +} + +// GetDefinition returns the Definition field value. +func (o *NotebookHeatMapCellAttributes) GetDefinition() HeatMapWidgetDefinition { + if o == nil { + var ret HeatMapWidgetDefinition + return ret + } + return o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value +// and a boolean to check if the value has been set. +func (o *NotebookHeatMapCellAttributes) GetDefinitionOk() (*HeatMapWidgetDefinition, bool) { + if o == nil { + return nil, false + } + return &o.Definition, true +} + +// SetDefinition sets field value. +func (o *NotebookHeatMapCellAttributes) SetDefinition(v HeatMapWidgetDefinition) { + o.Definition = v +} + +// GetGraphSize returns the GraphSize field value if set, zero value otherwise. +func (o *NotebookHeatMapCellAttributes) GetGraphSize() NotebookGraphSize { + if o == nil || o.GraphSize == nil { + var ret NotebookGraphSize + return ret + } + return *o.GraphSize +} + +// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookHeatMapCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { + if o == nil || o.GraphSize == nil { + return nil, false + } + return o.GraphSize, true +} + +// HasGraphSize returns a boolean if a field has been set. +func (o *NotebookHeatMapCellAttributes) HasGraphSize() bool { + if o != nil && o.GraphSize != nil { + return true + } + + return false +} + +// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. +func (o *NotebookHeatMapCellAttributes) SetGraphSize(v NotebookGraphSize) { + o.GraphSize = &v +} + +// GetSplitBy returns the SplitBy field value if set, zero value otherwise. +func (o *NotebookHeatMapCellAttributes) GetSplitBy() NotebookSplitBy { + if o == nil || o.SplitBy == nil { + var ret NotebookSplitBy + return ret + } + return *o.SplitBy +} + +// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookHeatMapCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { + if o == nil || o.SplitBy == nil { + return nil, false + } + return o.SplitBy, true +} + +// HasSplitBy returns a boolean if a field has been set. +func (o *NotebookHeatMapCellAttributes) HasSplitBy() bool { + if o != nil && o.SplitBy != nil { + return true + } + + return false +} + +// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. +func (o *NotebookHeatMapCellAttributes) SetSplitBy(v NotebookSplitBy) { + o.SplitBy = &v +} + +// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookHeatMapCellAttributes) GetTime() NotebookCellTime { + if o == nil || o.Time.Get() == nil { + var ret NotebookCellTime + return ret + } + return *o.Time.Get() +} + +// GetTimeOk returns a tuple with the Time 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 *NotebookHeatMapCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { + if o == nil { + return nil, false + } + return o.Time.Get(), o.Time.IsSet() +} + +// HasTime returns a boolean if a field has been set. +func (o *NotebookHeatMapCellAttributes) HasTime() bool { + if o != nil && o.Time.IsSet() { + return true + } + + return false +} + +// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. +func (o *NotebookHeatMapCellAttributes) SetTime(v NotebookCellTime) { + o.Time.Set(&v) +} + +// SetTimeNil sets the value for Time to be an explicit nil. +func (o *NotebookHeatMapCellAttributes) SetTimeNil() { + o.Time.Set(nil) +} + +// UnsetTime ensures that no value is present for Time, not even an explicit nil. +func (o *NotebookHeatMapCellAttributes) UnsetTime() { + o.Time.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookHeatMapCellAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["definition"] = o.Definition + if o.GraphSize != nil { + toSerialize["graph_size"] = o.GraphSize + } + if o.SplitBy != nil { + toSerialize["split_by"] = o.SplitBy + } + if o.Time.IsSet() { + toSerialize["time"] = o.Time.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Definition *HeatMapWidgetDefinition `json:"definition"` + }{} + all := struct { + Definition HeatMapWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Definition == nil { + return fmt.Errorf("Required field definition missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.GraphSize; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Definition = all.Definition + o.GraphSize = all.GraphSize + if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SplitBy = all.SplitBy + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_log_stream_cell_attributes.go b/api/v1/datadog/model_notebook_log_stream_cell_attributes.go new file mode 100644 index 00000000000..49a480b5701 --- /dev/null +++ b/api/v1/datadog/model_notebook_log_stream_cell_attributes.go @@ -0,0 +1,207 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookLogStreamCellAttributes The attributes of a notebook `log_stream` cell. +type NotebookLogStreamCellAttributes struct { + // The Log Stream displays a log flow matching the defined query. Only available on FREE layout dashboards. + Definition LogStreamWidgetDefinition `json:"definition"` + // The size of the graph. + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + // Timeframe for the notebook cell. When 'null', the notebook global time is used. + Time NullableNotebookCellTime `json:"time,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{} +} + +// NewNotebookLogStreamCellAttributes instantiates a new NotebookLogStreamCellAttributes 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 NewNotebookLogStreamCellAttributes(definition LogStreamWidgetDefinition) *NotebookLogStreamCellAttributes { + this := NotebookLogStreamCellAttributes{} + this.Definition = definition + return &this +} + +// NewNotebookLogStreamCellAttributesWithDefaults instantiates a new NotebookLogStreamCellAttributes 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 NewNotebookLogStreamCellAttributesWithDefaults() *NotebookLogStreamCellAttributes { + this := NotebookLogStreamCellAttributes{} + return &this +} + +// GetDefinition returns the Definition field value. +func (o *NotebookLogStreamCellAttributes) GetDefinition() LogStreamWidgetDefinition { + if o == nil { + var ret LogStreamWidgetDefinition + return ret + } + return o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value +// and a boolean to check if the value has been set. +func (o *NotebookLogStreamCellAttributes) GetDefinitionOk() (*LogStreamWidgetDefinition, bool) { + if o == nil { + return nil, false + } + return &o.Definition, true +} + +// SetDefinition sets field value. +func (o *NotebookLogStreamCellAttributes) SetDefinition(v LogStreamWidgetDefinition) { + o.Definition = v +} + +// GetGraphSize returns the GraphSize field value if set, zero value otherwise. +func (o *NotebookLogStreamCellAttributes) GetGraphSize() NotebookGraphSize { + if o == nil || o.GraphSize == nil { + var ret NotebookGraphSize + return ret + } + return *o.GraphSize +} + +// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookLogStreamCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { + if o == nil || o.GraphSize == nil { + return nil, false + } + return o.GraphSize, true +} + +// HasGraphSize returns a boolean if a field has been set. +func (o *NotebookLogStreamCellAttributes) HasGraphSize() bool { + if o != nil && o.GraphSize != nil { + return true + } + + return false +} + +// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. +func (o *NotebookLogStreamCellAttributes) SetGraphSize(v NotebookGraphSize) { + o.GraphSize = &v +} + +// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookLogStreamCellAttributes) GetTime() NotebookCellTime { + if o == nil || o.Time.Get() == nil { + var ret NotebookCellTime + return ret + } + return *o.Time.Get() +} + +// GetTimeOk returns a tuple with the Time 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 *NotebookLogStreamCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { + if o == nil { + return nil, false + } + return o.Time.Get(), o.Time.IsSet() +} + +// HasTime returns a boolean if a field has been set. +func (o *NotebookLogStreamCellAttributes) HasTime() bool { + if o != nil && o.Time.IsSet() { + return true + } + + return false +} + +// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. +func (o *NotebookLogStreamCellAttributes) SetTime(v NotebookCellTime) { + o.Time.Set(&v) +} + +// SetTimeNil sets the value for Time to be an explicit nil. +func (o *NotebookLogStreamCellAttributes) SetTimeNil() { + o.Time.Set(nil) +} + +// UnsetTime ensures that no value is present for Time, not even an explicit nil. +func (o *NotebookLogStreamCellAttributes) UnsetTime() { + o.Time.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookLogStreamCellAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["definition"] = o.Definition + if o.GraphSize != nil { + toSerialize["graph_size"] = o.GraphSize + } + if o.Time.IsSet() { + toSerialize["time"] = o.Time.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookLogStreamCellAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Definition *LogStreamWidgetDefinition `json:"definition"` + }{} + all := struct { + Definition LogStreamWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Definition == nil { + return fmt.Errorf("Required field definition missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.GraphSize; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Definition = all.Definition + o.GraphSize = all.GraphSize + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_markdown_cell_attributes.go b/api/v1/datadog/model_notebook_markdown_cell_attributes.go new file mode 100644 index 00000000000..3e27a05377d --- /dev/null +++ b/api/v1/datadog/model_notebook_markdown_cell_attributes.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookMarkdownCellAttributes The attributes of a notebook `markdown` cell. +type NotebookMarkdownCellAttributes struct { + // Text in a notebook is formatted with [Markdown](https://daringfireball.net/projects/markdown/), which enables the use of headings, subheadings, links, images, lists, and code blocks. + Definition NotebookMarkdownCellDefinition `json:"definition"` + // 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{} +} + +// NewNotebookMarkdownCellAttributes instantiates a new NotebookMarkdownCellAttributes 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 NewNotebookMarkdownCellAttributes(definition NotebookMarkdownCellDefinition) *NotebookMarkdownCellAttributes { + this := NotebookMarkdownCellAttributes{} + this.Definition = definition + return &this +} + +// NewNotebookMarkdownCellAttributesWithDefaults instantiates a new NotebookMarkdownCellAttributes 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 NewNotebookMarkdownCellAttributesWithDefaults() *NotebookMarkdownCellAttributes { + this := NotebookMarkdownCellAttributes{} + return &this +} + +// GetDefinition returns the Definition field value. +func (o *NotebookMarkdownCellAttributes) GetDefinition() NotebookMarkdownCellDefinition { + if o == nil { + var ret NotebookMarkdownCellDefinition + return ret + } + return o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value +// and a boolean to check if the value has been set. +func (o *NotebookMarkdownCellAttributes) GetDefinitionOk() (*NotebookMarkdownCellDefinition, bool) { + if o == nil { + return nil, false + } + return &o.Definition, true +} + +// SetDefinition sets field value. +func (o *NotebookMarkdownCellAttributes) SetDefinition(v NotebookMarkdownCellDefinition) { + o.Definition = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookMarkdownCellAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["definition"] = o.Definition + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookMarkdownCellAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Definition *NotebookMarkdownCellDefinition `json:"definition"` + }{} + all := struct { + Definition NotebookMarkdownCellDefinition `json:"definition"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Definition == nil { + return fmt.Errorf("Required field definition missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Definition = all.Definition + return nil +} diff --git a/api/v1/datadog/model_notebook_markdown_cell_definition.go b/api/v1/datadog/model_notebook_markdown_cell_definition.go new file mode 100644 index 00000000000..9e58db6adcd --- /dev/null +++ b/api/v1/datadog/model_notebook_markdown_cell_definition.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookMarkdownCellDefinition Text in a notebook is formatted with [Markdown](https://daringfireball.net/projects/markdown/), which enables the use of headings, subheadings, links, images, lists, and code blocks. +type NotebookMarkdownCellDefinition struct { + // The markdown content. + Text string `json:"text"` + // Type of the markdown cell. + Type NotebookMarkdownCellDefinitionType `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{} +} + +// NewNotebookMarkdownCellDefinition instantiates a new NotebookMarkdownCellDefinition 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 NewNotebookMarkdownCellDefinition(text string, typeVar NotebookMarkdownCellDefinitionType) *NotebookMarkdownCellDefinition { + this := NotebookMarkdownCellDefinition{} + this.Text = text + this.Type = typeVar + return &this +} + +// NewNotebookMarkdownCellDefinitionWithDefaults instantiates a new NotebookMarkdownCellDefinition 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 NewNotebookMarkdownCellDefinitionWithDefaults() *NotebookMarkdownCellDefinition { + this := NotebookMarkdownCellDefinition{} + var typeVar NotebookMarkdownCellDefinitionType = NOTEBOOKMARKDOWNCELLDEFINITIONTYPE_MARKDOWN + this.Type = typeVar + return &this +} + +// GetText returns the Text field value. +func (o *NotebookMarkdownCellDefinition) GetText() string { + if o == nil { + var ret string + return ret + } + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *NotebookMarkdownCellDefinition) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value. +func (o *NotebookMarkdownCellDefinition) SetText(v string) { + o.Text = v +} + +// GetType returns the Type field value. +func (o *NotebookMarkdownCellDefinition) GetType() NotebookMarkdownCellDefinitionType { + if o == nil { + var ret NotebookMarkdownCellDefinitionType + 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 *NotebookMarkdownCellDefinition) GetTypeOk() (*NotebookMarkdownCellDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebookMarkdownCellDefinition) SetType(v NotebookMarkdownCellDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookMarkdownCellDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["text"] = o.Text + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookMarkdownCellDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Text *string `json:"text"` + Type *NotebookMarkdownCellDefinitionType `json:"type"` + }{} + all := struct { + Text string `json:"text"` + Type NotebookMarkdownCellDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Text == nil { + return fmt.Errorf("Required field text missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Text = all.Text + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_markdown_cell_definition_type.go b/api/v1/datadog/model_notebook_markdown_cell_definition_type.go new file mode 100644 index 00000000000..c305d43ce8b --- /dev/null +++ b/api/v1/datadog/model_notebook_markdown_cell_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookMarkdownCellDefinitionType Type of the markdown cell. +type NotebookMarkdownCellDefinitionType string + +// List of NotebookMarkdownCellDefinitionType. +const ( + NOTEBOOKMARKDOWNCELLDEFINITIONTYPE_MARKDOWN NotebookMarkdownCellDefinitionType = "markdown" +) + +var allowedNotebookMarkdownCellDefinitionTypeEnumValues = []NotebookMarkdownCellDefinitionType{ + NOTEBOOKMARKDOWNCELLDEFINITIONTYPE_MARKDOWN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *NotebookMarkdownCellDefinitionType) GetAllowedValues() []NotebookMarkdownCellDefinitionType { + return allowedNotebookMarkdownCellDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *NotebookMarkdownCellDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = NotebookMarkdownCellDefinitionType(value) + return nil +} + +// NewNotebookMarkdownCellDefinitionTypeFromValue returns a pointer to a valid NotebookMarkdownCellDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewNotebookMarkdownCellDefinitionTypeFromValue(v string) (*NotebookMarkdownCellDefinitionType, error) { + ev := NotebookMarkdownCellDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for NotebookMarkdownCellDefinitionType: valid values are %v", v, allowedNotebookMarkdownCellDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v NotebookMarkdownCellDefinitionType) IsValid() bool { + for _, existing := range allowedNotebookMarkdownCellDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NotebookMarkdownCellDefinitionType value. +func (v NotebookMarkdownCellDefinitionType) Ptr() *NotebookMarkdownCellDefinitionType { + return &v +} + +// NullableNotebookMarkdownCellDefinitionType handles when a null is used for NotebookMarkdownCellDefinitionType. +type NullableNotebookMarkdownCellDefinitionType struct { + value *NotebookMarkdownCellDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookMarkdownCellDefinitionType) Get() *NotebookMarkdownCellDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookMarkdownCellDefinitionType) Set(val *NotebookMarkdownCellDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookMarkdownCellDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableNotebookMarkdownCellDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookMarkdownCellDefinitionType initializes the struct as if Set has been called. +func NewNullableNotebookMarkdownCellDefinitionType(val *NotebookMarkdownCellDefinitionType) *NullableNotebookMarkdownCellDefinitionType { + return &NullableNotebookMarkdownCellDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookMarkdownCellDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookMarkdownCellDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_metadata.go b/api/v1/datadog/model_notebook_metadata.go new file mode 100644 index 00000000000..ce37f528f73 --- /dev/null +++ b/api/v1/datadog/model_notebook_metadata.go @@ -0,0 +1,207 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookMetadata Metadata associated with the notebook. +type NotebookMetadata struct { + // Whether or not the notebook is a template. + IsTemplate *bool `json:"is_template,omitempty"` + // Whether or not the notebook takes snapshot image backups of the notebook's fixed-time graphs. + TakeSnapshots *bool `json:"take_snapshots,omitempty"` + // Metadata type of the notebook. + Type NullableNotebookMetadataType `json:"type,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{} +} + +// NewNotebookMetadata instantiates a new NotebookMetadata 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 NewNotebookMetadata() *NotebookMetadata { + this := NotebookMetadata{} + var isTemplate bool = false + this.IsTemplate = &isTemplate + var takeSnapshots bool = false + this.TakeSnapshots = &takeSnapshots + return &this +} + +// NewNotebookMetadataWithDefaults instantiates a new NotebookMetadata 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 NewNotebookMetadataWithDefaults() *NotebookMetadata { + this := NotebookMetadata{} + var isTemplate bool = false + this.IsTemplate = &isTemplate + var takeSnapshots bool = false + this.TakeSnapshots = &takeSnapshots + return &this +} + +// GetIsTemplate returns the IsTemplate field value if set, zero value otherwise. +func (o *NotebookMetadata) GetIsTemplate() bool { + if o == nil || o.IsTemplate == nil { + var ret bool + return ret + } + return *o.IsTemplate +} + +// GetIsTemplateOk returns a tuple with the IsTemplate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookMetadata) GetIsTemplateOk() (*bool, bool) { + if o == nil || o.IsTemplate == nil { + return nil, false + } + return o.IsTemplate, true +} + +// HasIsTemplate returns a boolean if a field has been set. +func (o *NotebookMetadata) HasIsTemplate() bool { + if o != nil && o.IsTemplate != nil { + return true + } + + return false +} + +// SetIsTemplate gets a reference to the given bool and assigns it to the IsTemplate field. +func (o *NotebookMetadata) SetIsTemplate(v bool) { + o.IsTemplate = &v +} + +// GetTakeSnapshots returns the TakeSnapshots field value if set, zero value otherwise. +func (o *NotebookMetadata) GetTakeSnapshots() bool { + if o == nil || o.TakeSnapshots == nil { + var ret bool + return ret + } + return *o.TakeSnapshots +} + +// GetTakeSnapshotsOk returns a tuple with the TakeSnapshots field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookMetadata) GetTakeSnapshotsOk() (*bool, bool) { + if o == nil || o.TakeSnapshots == nil { + return nil, false + } + return o.TakeSnapshots, true +} + +// HasTakeSnapshots returns a boolean if a field has been set. +func (o *NotebookMetadata) HasTakeSnapshots() bool { + if o != nil && o.TakeSnapshots != nil { + return true + } + + return false +} + +// SetTakeSnapshots gets a reference to the given bool and assigns it to the TakeSnapshots field. +func (o *NotebookMetadata) SetTakeSnapshots(v bool) { + o.TakeSnapshots = &v +} + +// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookMetadata) GetType() NotebookMetadataType { + if o == nil || o.Type.Get() == nil { + var ret NotebookMetadataType + return ret + } + return *o.Type.Get() +} + +// GetTypeOk returns a tuple with the Type 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 *NotebookMetadata) GetTypeOk() (*NotebookMetadataType, bool) { + if o == nil { + return nil, false + } + return o.Type.Get(), o.Type.IsSet() +} + +// HasType returns a boolean if a field has been set. +func (o *NotebookMetadata) HasType() bool { + if o != nil && o.Type.IsSet() { + return true + } + + return false +} + +// SetType gets a reference to the given NullableNotebookMetadataType and assigns it to the Type field. +func (o *NotebookMetadata) SetType(v NotebookMetadataType) { + o.Type.Set(&v) +} + +// SetTypeNil sets the value for Type to be an explicit nil. +func (o *NotebookMetadata) SetTypeNil() { + o.Type.Set(nil) +} + +// UnsetType ensures that no value is present for Type, not even an explicit nil. +func (o *NotebookMetadata) UnsetType() { + o.Type.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsTemplate != nil { + toSerialize["is_template"] = o.IsTemplate + } + if o.TakeSnapshots != nil { + toSerialize["take_snapshots"] = o.TakeSnapshots + } + if o.Type.IsSet() { + toSerialize["type"] = o.Type.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IsTemplate *bool `json:"is_template,omitempty"` + TakeSnapshots *bool `json:"take_snapshots,omitempty"` + Type NullableNotebookMetadataType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v.Get() != nil && !v.Get().IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsTemplate = all.IsTemplate + o.TakeSnapshots = all.TakeSnapshots + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_metadata_type.go b/api/v1/datadog/model_notebook_metadata_type.go new file mode 100644 index 00000000000..9f4204d58be --- /dev/null +++ b/api/v1/datadog/model_notebook_metadata_type.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookMetadataType Metadata type of the notebook. +type NotebookMetadataType string + +// List of NotebookMetadataType. +const ( + NOTEBOOKMETADATATYPE_POSTMORTEM NotebookMetadataType = "postmortem" + NOTEBOOKMETADATATYPE_RUNBOOK NotebookMetadataType = "runbook" + NOTEBOOKMETADATATYPE_INVESTIGATION NotebookMetadataType = "investigation" + NOTEBOOKMETADATATYPE_DOCUMENTATION NotebookMetadataType = "documentation" + NOTEBOOKMETADATATYPE_REPORT NotebookMetadataType = "report" +) + +var allowedNotebookMetadataTypeEnumValues = []NotebookMetadataType{ + NOTEBOOKMETADATATYPE_POSTMORTEM, + NOTEBOOKMETADATATYPE_RUNBOOK, + NOTEBOOKMETADATATYPE_INVESTIGATION, + NOTEBOOKMETADATATYPE_DOCUMENTATION, + NOTEBOOKMETADATATYPE_REPORT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *NotebookMetadataType) GetAllowedValues() []NotebookMetadataType { + return allowedNotebookMetadataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *NotebookMetadataType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = NotebookMetadataType(value) + return nil +} + +// NewNotebookMetadataTypeFromValue returns a pointer to a valid NotebookMetadataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewNotebookMetadataTypeFromValue(v string) (*NotebookMetadataType, error) { + ev := NotebookMetadataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for NotebookMetadataType: valid values are %v", v, allowedNotebookMetadataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v NotebookMetadataType) IsValid() bool { + for _, existing := range allowedNotebookMetadataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NotebookMetadataType value. +func (v NotebookMetadataType) Ptr() *NotebookMetadataType { + return &v +} + +// NullableNotebookMetadataType handles when a null is used for NotebookMetadataType. +type NullableNotebookMetadataType struct { + value *NotebookMetadataType + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookMetadataType) Get() *NotebookMetadataType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookMetadataType) Set(val *NotebookMetadataType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookMetadataType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableNotebookMetadataType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookMetadataType initializes the struct as if Set has been called. +func NewNullableNotebookMetadataType(val *NotebookMetadataType) *NullableNotebookMetadataType { + return &NullableNotebookMetadataType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookMetadataType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookMetadataType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_relative_time.go b/api/v1/datadog/model_notebook_relative_time.go new file mode 100644 index 00000000000..2ce6f5f4c84 --- /dev/null +++ b/api/v1/datadog/model_notebook_relative_time.go @@ -0,0 +1,161 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookRelativeTime Relative timeframe. +type NotebookRelativeTime struct { + // The available timeframes depend on the widget you are using. + LiveSpan WidgetLiveSpan `json:"live_span"` + // 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{} +} + +// NewNotebookRelativeTime instantiates a new NotebookRelativeTime 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 NewNotebookRelativeTime(liveSpan WidgetLiveSpan) *NotebookRelativeTime { + this := NotebookRelativeTime{} + this.LiveSpan = liveSpan + return &this +} + +// NewNotebookRelativeTimeWithDefaults instantiates a new NotebookRelativeTime 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 NewNotebookRelativeTimeWithDefaults() *NotebookRelativeTime { + this := NotebookRelativeTime{} + return &this +} + +// GetLiveSpan returns the LiveSpan field value. +func (o *NotebookRelativeTime) GetLiveSpan() WidgetLiveSpan { + if o == nil { + var ret WidgetLiveSpan + return ret + } + return o.LiveSpan +} + +// GetLiveSpanOk returns a tuple with the LiveSpan field value +// and a boolean to check if the value has been set. +func (o *NotebookRelativeTime) GetLiveSpanOk() (*WidgetLiveSpan, bool) { + if o == nil { + return nil, false + } + return &o.LiveSpan, true +} + +// SetLiveSpan sets field value. +func (o *NotebookRelativeTime) SetLiveSpan(v WidgetLiveSpan) { + o.LiveSpan = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookRelativeTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["live_span"] = o.LiveSpan + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookRelativeTime) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + LiveSpan *WidgetLiveSpan `json:"live_span"` + }{} + all := struct { + LiveSpan WidgetLiveSpan `json:"live_span"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.LiveSpan == nil { + return fmt.Errorf("Required field live_span missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LiveSpan; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LiveSpan = all.LiveSpan + return nil +} + +// NullableNotebookRelativeTime handles when a null is used for NotebookRelativeTime. +type NullableNotebookRelativeTime struct { + value *NotebookRelativeTime + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookRelativeTime) Get() *NotebookRelativeTime { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookRelativeTime) Set(val *NotebookRelativeTime) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookRelativeTime) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNotebookRelativeTime) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookRelativeTime initializes the struct as if Set has been called. +func NewNullableNotebookRelativeTime(val *NotebookRelativeTime) *NullableNotebookRelativeTime { + return &NullableNotebookRelativeTime{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookRelativeTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookRelativeTime) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_resource_type.go b/api/v1/datadog/model_notebook_resource_type.go new file mode 100644 index 00000000000..dc84c8ba3f3 --- /dev/null +++ b/api/v1/datadog/model_notebook_resource_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookResourceType Type of the Notebook resource. +type NotebookResourceType string + +// List of NotebookResourceType. +const ( + NOTEBOOKRESOURCETYPE_NOTEBOOKS NotebookResourceType = "notebooks" +) + +var allowedNotebookResourceTypeEnumValues = []NotebookResourceType{ + NOTEBOOKRESOURCETYPE_NOTEBOOKS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *NotebookResourceType) GetAllowedValues() []NotebookResourceType { + return allowedNotebookResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *NotebookResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = NotebookResourceType(value) + return nil +} + +// NewNotebookResourceTypeFromValue returns a pointer to a valid NotebookResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewNotebookResourceTypeFromValue(v string) (*NotebookResourceType, error) { + ev := NotebookResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for NotebookResourceType: valid values are %v", v, allowedNotebookResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v NotebookResourceType) IsValid() bool { + for _, existing := range allowedNotebookResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NotebookResourceType value. +func (v NotebookResourceType) Ptr() *NotebookResourceType { + return &v +} + +// NullableNotebookResourceType handles when a null is used for NotebookResourceType. +type NullableNotebookResourceType struct { + value *NotebookResourceType + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookResourceType) Get() *NotebookResourceType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookResourceType) Set(val *NotebookResourceType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookResourceType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableNotebookResourceType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookResourceType initializes the struct as if Set has been called. +func NewNullableNotebookResourceType(val *NotebookResourceType) *NullableNotebookResourceType { + return &NullableNotebookResourceType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookResourceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookResourceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_response.go b/api/v1/datadog/model_notebook_response.go new file mode 100644 index 00000000000..30b861705b2 --- /dev/null +++ b/api/v1/datadog/model_notebook_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookResponse The description of a notebook response. +type NotebookResponse struct { + // The data for a notebook. + Data *NotebookResponseData `json:"data,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{} +} + +// NewNotebookResponse instantiates a new NotebookResponse 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 NewNotebookResponse() *NotebookResponse { + this := NotebookResponse{} + return &this +} + +// NewNotebookResponseWithDefaults instantiates a new NotebookResponse 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 NewNotebookResponseWithDefaults() *NotebookResponse { + this := NotebookResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *NotebookResponse) GetData() NotebookResponseData { + if o == nil || o.Data == nil { + var ret NotebookResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookResponse) GetDataOk() (*NotebookResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *NotebookResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given NotebookResponseData and assigns it to the Data field. +func (o *NotebookResponse) SetData(v NotebookResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *NotebookResponseData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_notebook_response_data.go b/api/v1/datadog/model_notebook_response_data.go new file mode 100644 index 00000000000..0f8bcde5ea1 --- /dev/null +++ b/api/v1/datadog/model_notebook_response_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookResponseData The data for a notebook. +type NotebookResponseData struct { + // The attributes of a notebook. + Attributes NotebookResponseDataAttributes `json:"attributes"` + // Unique notebook ID, assigned when you create the notebook. + Id int64 `json:"id"` + // Type of the Notebook resource. + Type NotebookResourceType `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{} +} + +// NewNotebookResponseData instantiates a new NotebookResponseData 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 NewNotebookResponseData(attributes NotebookResponseDataAttributes, id int64, typeVar NotebookResourceType) *NotebookResponseData { + this := NotebookResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewNotebookResponseDataWithDefaults instantiates a new NotebookResponseData 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 NewNotebookResponseDataWithDefaults() *NotebookResponseData { + this := NotebookResponseData{} + var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *NotebookResponseData) GetAttributes() NotebookResponseDataAttributes { + if o == nil { + var ret NotebookResponseDataAttributes + 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 *NotebookResponseData) GetAttributesOk() (*NotebookResponseDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *NotebookResponseData) SetAttributes(v NotebookResponseDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *NotebookResponseData) GetId() int64 { + if o == nil { + var ret int64 + 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 *NotebookResponseData) GetIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *NotebookResponseData) SetId(v int64) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *NotebookResponseData) GetType() NotebookResourceType { + if o == nil { + var ret NotebookResourceType + 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 *NotebookResponseData) GetTypeOk() (*NotebookResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebookResponseData) SetType(v NotebookResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *NotebookResponseDataAttributes `json:"attributes"` + Id *int64 `json:"id"` + Type *NotebookResourceType `json:"type"` + }{} + all := struct { + Attributes NotebookResponseDataAttributes `json:"attributes"` + Id int64 `json:"id"` + Type NotebookResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_response_data_attributes.go b/api/v1/datadog/model_notebook_response_data_attributes.go new file mode 100644 index 00000000000..d057acfee9f --- /dev/null +++ b/api/v1/datadog/model_notebook_response_data_attributes.go @@ -0,0 +1,399 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" +) + +// NotebookResponseDataAttributes The attributes of a notebook. +type NotebookResponseDataAttributes struct { + // Attributes of user object returned by the API. + Author *NotebookAuthor `json:"author,omitempty"` + // List of cells to display in the notebook. + Cells []NotebookCellResponse `json:"cells"` + // UTC time stamp for when the notebook was created. + Created *time.Time `json:"created,omitempty"` + // Metadata associated with the notebook. + Metadata *NotebookMetadata `json:"metadata,omitempty"` + // UTC time stamp for when the notebook was last modified. + Modified *time.Time `json:"modified,omitempty"` + // The name of the notebook. + Name string `json:"name"` + // Publication status of the notebook. For now, always "published". + Status *NotebookStatus `json:"status,omitempty"` + // Notebook global timeframe. + Time NotebookGlobalTime `json:"time"` + // 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{} +} + +// NewNotebookResponseDataAttributes instantiates a new NotebookResponseDataAttributes 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 NewNotebookResponseDataAttributes(cells []NotebookCellResponse, name string, time NotebookGlobalTime) *NotebookResponseDataAttributes { + this := NotebookResponseDataAttributes{} + this.Cells = cells + this.Name = name + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + this.Time = time + return &this +} + +// NewNotebookResponseDataAttributesWithDefaults instantiates a new NotebookResponseDataAttributes 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 NewNotebookResponseDataAttributesWithDefaults() *NotebookResponseDataAttributes { + this := NotebookResponseDataAttributes{} + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + return &this +} + +// GetAuthor returns the Author field value if set, zero value otherwise. +func (o *NotebookResponseDataAttributes) GetAuthor() NotebookAuthor { + if o == nil || o.Author == nil { + var ret NotebookAuthor + return ret + } + return *o.Author +} + +// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetAuthorOk() (*NotebookAuthor, bool) { + if o == nil || o.Author == nil { + return nil, false + } + return o.Author, true +} + +// HasAuthor returns a boolean if a field has been set. +func (o *NotebookResponseDataAttributes) HasAuthor() bool { + if o != nil && o.Author != nil { + return true + } + + return false +} + +// SetAuthor gets a reference to the given NotebookAuthor and assigns it to the Author field. +func (o *NotebookResponseDataAttributes) SetAuthor(v NotebookAuthor) { + o.Author = &v +} + +// GetCells returns the Cells field value. +func (o *NotebookResponseDataAttributes) GetCells() []NotebookCellResponse { + if o == nil { + var ret []NotebookCellResponse + return ret + } + return o.Cells +} + +// GetCellsOk returns a tuple with the Cells field value +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetCellsOk() (*[]NotebookCellResponse, bool) { + if o == nil { + return nil, false + } + return &o.Cells, true +} + +// SetCells sets field value. +func (o *NotebookResponseDataAttributes) SetCells(v []NotebookCellResponse) { + o.Cells = v +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *NotebookResponseDataAttributes) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *NotebookResponseDataAttributes) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *NotebookResponseDataAttributes) SetCreated(v time.Time) { + o.Created = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NotebookResponseDataAttributes) GetMetadata() NotebookMetadata { + if o == nil || o.Metadata == nil { + var ret NotebookMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *NotebookResponseDataAttributes) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. +func (o *NotebookResponseDataAttributes) SetMetadata(v NotebookMetadata) { + o.Metadata = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *NotebookResponseDataAttributes) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *NotebookResponseDataAttributes) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *NotebookResponseDataAttributes) SetModified(v time.Time) { + o.Modified = &v +} + +// GetName returns the Name field value. +func (o *NotebookResponseDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *NotebookResponseDataAttributes) SetName(v string) { + o.Name = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NotebookResponseDataAttributes) GetStatus() NotebookStatus { + if o == nil || o.Status == nil { + var ret NotebookStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetStatusOk() (*NotebookStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *NotebookResponseDataAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. +func (o *NotebookResponseDataAttributes) SetStatus(v NotebookStatus) { + o.Status = &v +} + +// GetTime returns the Time field value. +func (o *NotebookResponseDataAttributes) GetTime() NotebookGlobalTime { + if o == nil { + var ret NotebookGlobalTime + return ret + } + return o.Time +} + +// GetTimeOk returns a tuple with the Time field value +// and a boolean to check if the value has been set. +func (o *NotebookResponseDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { + if o == nil { + return nil, false + } + return &o.Time, true +} + +// SetTime sets field value. +func (o *NotebookResponseDataAttributes) SetTime(v NotebookGlobalTime) { + o.Time = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Author != nil { + toSerialize["author"] = o.Author + } + toSerialize["cells"] = o.Cells + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + toSerialize["name"] = o.Name + if o.Status != nil { + toSerialize["status"] = o.Status + } + toSerialize["time"] = o.Time + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Cells *[]NotebookCellResponse `json:"cells"` + Name *string `json:"name"` + Time *NotebookGlobalTime `json:"time"` + }{} + all := struct { + Author *NotebookAuthor `json:"author,omitempty"` + Cells []NotebookCellResponse `json:"cells"` + Created *time.Time `json:"created,omitempty"` + Metadata *NotebookMetadata `json:"metadata,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Name string `json:"name"` + Status *NotebookStatus `json:"status,omitempty"` + Time NotebookGlobalTime `json:"time"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Cells == nil { + return fmt.Errorf("Required field cells missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Time == nil { + return fmt.Errorf("Required field time missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Author = all.Author + o.Cells = all.Cells + o.Created = all.Created + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Modified = all.Modified + o.Name = all.Name + o.Status = all.Status + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_split_by.go b/api/v1/datadog/model_notebook_split_by.go new file mode 100644 index 00000000000..272a028cea7 --- /dev/null +++ b/api/v1/datadog/model_notebook_split_by.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookSplitBy Object describing how to split the graph to display multiple visualizations per request. +type NotebookSplitBy struct { + // Keys to split on. + Keys []string `json:"keys"` + // Tags to split on. + Tags []string `json:"tags"` + // 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{} +} + +// NewNotebookSplitBy instantiates a new NotebookSplitBy 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 NewNotebookSplitBy(keys []string, tags []string) *NotebookSplitBy { + this := NotebookSplitBy{} + this.Keys = keys + this.Tags = tags + return &this +} + +// NewNotebookSplitByWithDefaults instantiates a new NotebookSplitBy 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 NewNotebookSplitByWithDefaults() *NotebookSplitBy { + this := NotebookSplitBy{} + return &this +} + +// GetKeys returns the Keys field value. +func (o *NotebookSplitBy) GetKeys() []string { + if o == nil { + var ret []string + return ret + } + return o.Keys +} + +// GetKeysOk returns a tuple with the Keys field value +// and a boolean to check if the value has been set. +func (o *NotebookSplitBy) GetKeysOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Keys, true +} + +// SetKeys sets field value. +func (o *NotebookSplitBy) SetKeys(v []string) { + o.Keys = v +} + +// GetTags returns the Tags field value. +func (o *NotebookSplitBy) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *NotebookSplitBy) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *NotebookSplitBy) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookSplitBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["keys"] = o.Keys + toSerialize["tags"] = o.Tags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookSplitBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Keys *[]string `json:"keys"` + Tags *[]string `json:"tags"` + }{} + all := struct { + Keys []string `json:"keys"` + Tags []string `json:"tags"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Keys == nil { + return fmt.Errorf("Required field keys missing") + } + if required.Tags == nil { + return fmt.Errorf("Required field tags missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Keys = all.Keys + o.Tags = all.Tags + return nil +} diff --git a/api/v1/datadog/model_notebook_status.go b/api/v1/datadog/model_notebook_status.go new file mode 100644 index 00000000000..dd861abfbe6 --- /dev/null +++ b/api/v1/datadog/model_notebook_status.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookStatus Publication status of the notebook. For now, always "published". +type NotebookStatus string + +// List of NotebookStatus. +const ( + NOTEBOOKSTATUS_PUBLISHED NotebookStatus = "published" +) + +var allowedNotebookStatusEnumValues = []NotebookStatus{ + NOTEBOOKSTATUS_PUBLISHED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *NotebookStatus) GetAllowedValues() []NotebookStatus { + return allowedNotebookStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *NotebookStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = NotebookStatus(value) + return nil +} + +// NewNotebookStatusFromValue returns a pointer to a valid NotebookStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewNotebookStatusFromValue(v string) (*NotebookStatus, error) { + ev := NotebookStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for NotebookStatus: valid values are %v", v, allowedNotebookStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v NotebookStatus) IsValid() bool { + for _, existing := range allowedNotebookStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NotebookStatus value. +func (v NotebookStatus) Ptr() *NotebookStatus { + return &v +} + +// NullableNotebookStatus handles when a null is used for NotebookStatus. +type NullableNotebookStatus struct { + value *NotebookStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookStatus) Get() *NotebookStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookStatus) Set(val *NotebookStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableNotebookStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookStatus initializes the struct as if Set has been called. +func NewNullableNotebookStatus(val *NotebookStatus) *NullableNotebookStatus { + return &NullableNotebookStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_timeseries_cell_attributes.go b/api/v1/datadog/model_notebook_timeseries_cell_attributes.go new file mode 100644 index 00000000000..6e23bc7ad6f --- /dev/null +++ b/api/v1/datadog/model_notebook_timeseries_cell_attributes.go @@ -0,0 +1,253 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookTimeseriesCellAttributes The attributes of a notebook `timeseries` cell. +type NotebookTimeseriesCellAttributes struct { + // The timeseries visualization allows you to display the evolution of one or more metrics, log events, or Indexed Spans over time. + Definition TimeseriesWidgetDefinition `json:"definition"` + // The size of the graph. + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + // Object describing how to split the graph to display multiple visualizations per request. + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + // Timeframe for the notebook cell. When 'null', the notebook global time is used. + Time NullableNotebookCellTime `json:"time,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{} +} + +// NewNotebookTimeseriesCellAttributes instantiates a new NotebookTimeseriesCellAttributes 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 NewNotebookTimeseriesCellAttributes(definition TimeseriesWidgetDefinition) *NotebookTimeseriesCellAttributes { + this := NotebookTimeseriesCellAttributes{} + this.Definition = definition + return &this +} + +// NewNotebookTimeseriesCellAttributesWithDefaults instantiates a new NotebookTimeseriesCellAttributes 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 NewNotebookTimeseriesCellAttributesWithDefaults() *NotebookTimeseriesCellAttributes { + this := NotebookTimeseriesCellAttributes{} + return &this +} + +// GetDefinition returns the Definition field value. +func (o *NotebookTimeseriesCellAttributes) GetDefinition() TimeseriesWidgetDefinition { + if o == nil { + var ret TimeseriesWidgetDefinition + return ret + } + return o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value +// and a boolean to check if the value has been set. +func (o *NotebookTimeseriesCellAttributes) GetDefinitionOk() (*TimeseriesWidgetDefinition, bool) { + if o == nil { + return nil, false + } + return &o.Definition, true +} + +// SetDefinition sets field value. +func (o *NotebookTimeseriesCellAttributes) SetDefinition(v TimeseriesWidgetDefinition) { + o.Definition = v +} + +// GetGraphSize returns the GraphSize field value if set, zero value otherwise. +func (o *NotebookTimeseriesCellAttributes) GetGraphSize() NotebookGraphSize { + if o == nil || o.GraphSize == nil { + var ret NotebookGraphSize + return ret + } + return *o.GraphSize +} + +// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookTimeseriesCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { + if o == nil || o.GraphSize == nil { + return nil, false + } + return o.GraphSize, true +} + +// HasGraphSize returns a boolean if a field has been set. +func (o *NotebookTimeseriesCellAttributes) HasGraphSize() bool { + if o != nil && o.GraphSize != nil { + return true + } + + return false +} + +// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. +func (o *NotebookTimeseriesCellAttributes) SetGraphSize(v NotebookGraphSize) { + o.GraphSize = &v +} + +// GetSplitBy returns the SplitBy field value if set, zero value otherwise. +func (o *NotebookTimeseriesCellAttributes) GetSplitBy() NotebookSplitBy { + if o == nil || o.SplitBy == nil { + var ret NotebookSplitBy + return ret + } + return *o.SplitBy +} + +// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookTimeseriesCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { + if o == nil || o.SplitBy == nil { + return nil, false + } + return o.SplitBy, true +} + +// HasSplitBy returns a boolean if a field has been set. +func (o *NotebookTimeseriesCellAttributes) HasSplitBy() bool { + if o != nil && o.SplitBy != nil { + return true + } + + return false +} + +// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. +func (o *NotebookTimeseriesCellAttributes) SetSplitBy(v NotebookSplitBy) { + o.SplitBy = &v +} + +// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookTimeseriesCellAttributes) GetTime() NotebookCellTime { + if o == nil || o.Time.Get() == nil { + var ret NotebookCellTime + return ret + } + return *o.Time.Get() +} + +// GetTimeOk returns a tuple with the Time 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 *NotebookTimeseriesCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { + if o == nil { + return nil, false + } + return o.Time.Get(), o.Time.IsSet() +} + +// HasTime returns a boolean if a field has been set. +func (o *NotebookTimeseriesCellAttributes) HasTime() bool { + if o != nil && o.Time.IsSet() { + return true + } + + return false +} + +// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. +func (o *NotebookTimeseriesCellAttributes) SetTime(v NotebookCellTime) { + o.Time.Set(&v) +} + +// SetTimeNil sets the value for Time to be an explicit nil. +func (o *NotebookTimeseriesCellAttributes) SetTimeNil() { + o.Time.Set(nil) +} + +// UnsetTime ensures that no value is present for Time, not even an explicit nil. +func (o *NotebookTimeseriesCellAttributes) UnsetTime() { + o.Time.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookTimeseriesCellAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["definition"] = o.Definition + if o.GraphSize != nil { + toSerialize["graph_size"] = o.GraphSize + } + if o.SplitBy != nil { + toSerialize["split_by"] = o.SplitBy + } + if o.Time.IsSet() { + toSerialize["time"] = o.Time.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Definition *TimeseriesWidgetDefinition `json:"definition"` + }{} + all := struct { + Definition TimeseriesWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Definition == nil { + return fmt.Errorf("Required field definition missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.GraphSize; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Definition = all.Definition + o.GraphSize = all.GraphSize + if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SplitBy = all.SplitBy + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_toplist_cell_attributes.go b/api/v1/datadog/model_notebook_toplist_cell_attributes.go new file mode 100644 index 00000000000..4064f663ea6 --- /dev/null +++ b/api/v1/datadog/model_notebook_toplist_cell_attributes.go @@ -0,0 +1,253 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookToplistCellAttributes The attributes of a notebook `toplist` cell. +type NotebookToplistCellAttributes struct { + // The top list visualization enables you to display a list of Tag value like hostname or service with the most or least of any metric value, such as highest consumers of CPU, hosts with the least disk space, etc. + Definition ToplistWidgetDefinition `json:"definition"` + // The size of the graph. + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + // Object describing how to split the graph to display multiple visualizations per request. + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + // Timeframe for the notebook cell. When 'null', the notebook global time is used. + Time NullableNotebookCellTime `json:"time,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{} +} + +// NewNotebookToplistCellAttributes instantiates a new NotebookToplistCellAttributes 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 NewNotebookToplistCellAttributes(definition ToplistWidgetDefinition) *NotebookToplistCellAttributes { + this := NotebookToplistCellAttributes{} + this.Definition = definition + return &this +} + +// NewNotebookToplistCellAttributesWithDefaults instantiates a new NotebookToplistCellAttributes 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 NewNotebookToplistCellAttributesWithDefaults() *NotebookToplistCellAttributes { + this := NotebookToplistCellAttributes{} + return &this +} + +// GetDefinition returns the Definition field value. +func (o *NotebookToplistCellAttributes) GetDefinition() ToplistWidgetDefinition { + if o == nil { + var ret ToplistWidgetDefinition + return ret + } + return o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value +// and a boolean to check if the value has been set. +func (o *NotebookToplistCellAttributes) GetDefinitionOk() (*ToplistWidgetDefinition, bool) { + if o == nil { + return nil, false + } + return &o.Definition, true +} + +// SetDefinition sets field value. +func (o *NotebookToplistCellAttributes) SetDefinition(v ToplistWidgetDefinition) { + o.Definition = v +} + +// GetGraphSize returns the GraphSize field value if set, zero value otherwise. +func (o *NotebookToplistCellAttributes) GetGraphSize() NotebookGraphSize { + if o == nil || o.GraphSize == nil { + var ret NotebookGraphSize + return ret + } + return *o.GraphSize +} + +// GetGraphSizeOk returns a tuple with the GraphSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookToplistCellAttributes) GetGraphSizeOk() (*NotebookGraphSize, bool) { + if o == nil || o.GraphSize == nil { + return nil, false + } + return o.GraphSize, true +} + +// HasGraphSize returns a boolean if a field has been set. +func (o *NotebookToplistCellAttributes) HasGraphSize() bool { + if o != nil && o.GraphSize != nil { + return true + } + + return false +} + +// SetGraphSize gets a reference to the given NotebookGraphSize and assigns it to the GraphSize field. +func (o *NotebookToplistCellAttributes) SetGraphSize(v NotebookGraphSize) { + o.GraphSize = &v +} + +// GetSplitBy returns the SplitBy field value if set, zero value otherwise. +func (o *NotebookToplistCellAttributes) GetSplitBy() NotebookSplitBy { + if o == nil || o.SplitBy == nil { + var ret NotebookSplitBy + return ret + } + return *o.SplitBy +} + +// GetSplitByOk returns a tuple with the SplitBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookToplistCellAttributes) GetSplitByOk() (*NotebookSplitBy, bool) { + if o == nil || o.SplitBy == nil { + return nil, false + } + return o.SplitBy, true +} + +// HasSplitBy returns a boolean if a field has been set. +func (o *NotebookToplistCellAttributes) HasSplitBy() bool { + if o != nil && o.SplitBy != nil { + return true + } + + return false +} + +// SetSplitBy gets a reference to the given NotebookSplitBy and assigns it to the SplitBy field. +func (o *NotebookToplistCellAttributes) SetSplitBy(v NotebookSplitBy) { + o.SplitBy = &v +} + +// GetTime returns the Time field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NotebookToplistCellAttributes) GetTime() NotebookCellTime { + if o == nil || o.Time.Get() == nil { + var ret NotebookCellTime + return ret + } + return *o.Time.Get() +} + +// GetTimeOk returns a tuple with the Time 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 *NotebookToplistCellAttributes) GetTimeOk() (*NotebookCellTime, bool) { + if o == nil { + return nil, false + } + return o.Time.Get(), o.Time.IsSet() +} + +// HasTime returns a boolean if a field has been set. +func (o *NotebookToplistCellAttributes) HasTime() bool { + if o != nil && o.Time.IsSet() { + return true + } + + return false +} + +// SetTime gets a reference to the given NullableNotebookCellTime and assigns it to the Time field. +func (o *NotebookToplistCellAttributes) SetTime(v NotebookCellTime) { + o.Time.Set(&v) +} + +// SetTimeNil sets the value for Time to be an explicit nil. +func (o *NotebookToplistCellAttributes) SetTimeNil() { + o.Time.Set(nil) +} + +// UnsetTime ensures that no value is present for Time, not even an explicit nil. +func (o *NotebookToplistCellAttributes) UnsetTime() { + o.Time.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookToplistCellAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["definition"] = o.Definition + if o.GraphSize != nil { + toSerialize["graph_size"] = o.GraphSize + } + if o.SplitBy != nil { + toSerialize["split_by"] = o.SplitBy + } + if o.Time.IsSet() { + toSerialize["time"] = o.Time.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Definition *ToplistWidgetDefinition `json:"definition"` + }{} + all := struct { + Definition ToplistWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Definition == nil { + return fmt.Errorf("Required field definition missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.GraphSize; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Definition.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Definition = all.Definition + o.GraphSize = all.GraphSize + if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SplitBy = all.SplitBy + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_update_cell.go b/api/v1/datadog/model_notebook_update_cell.go new file mode 100644 index 00000000000..fa67c4c3b15 --- /dev/null +++ b/api/v1/datadog/model_notebook_update_cell.go @@ -0,0 +1,156 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebookUpdateCell - Updating a notebook can either insert new cell(s) or update existing cell(s) by including the cell `id`. +// To delete existing cell(s), simply omit it from the list of cells. +type NotebookUpdateCell struct { + NotebookCellCreateRequest *NotebookCellCreateRequest + NotebookCellUpdateRequest *NotebookCellUpdateRequest + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// NotebookCellCreateRequestAsNotebookUpdateCell is a convenience function that returns NotebookCellCreateRequest wrapped in NotebookUpdateCell. +func NotebookCellCreateRequestAsNotebookUpdateCell(v *NotebookCellCreateRequest) NotebookUpdateCell { + return NotebookUpdateCell{NotebookCellCreateRequest: v} +} + +// NotebookCellUpdateRequestAsNotebookUpdateCell is a convenience function that returns NotebookCellUpdateRequest wrapped in NotebookUpdateCell. +func NotebookCellUpdateRequestAsNotebookUpdateCell(v *NotebookCellUpdateRequest) NotebookUpdateCell { + return NotebookUpdateCell{NotebookCellUpdateRequest: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *NotebookUpdateCell) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into NotebookCellCreateRequest + err = json.Unmarshal(data, &obj.NotebookCellCreateRequest) + if err == nil { + if obj.NotebookCellCreateRequest != nil && obj.NotebookCellCreateRequest.UnparsedObject == nil { + jsonNotebookCellCreateRequest, _ := json.Marshal(obj.NotebookCellCreateRequest) + if string(jsonNotebookCellCreateRequest) == "{}" { // empty struct + obj.NotebookCellCreateRequest = nil + } else { + match++ + } + } else { + obj.NotebookCellCreateRequest = nil + } + } else { + obj.NotebookCellCreateRequest = nil + } + + // try to unmarshal data into NotebookCellUpdateRequest + err = json.Unmarshal(data, &obj.NotebookCellUpdateRequest) + if err == nil { + if obj.NotebookCellUpdateRequest != nil && obj.NotebookCellUpdateRequest.UnparsedObject == nil { + jsonNotebookCellUpdateRequest, _ := json.Marshal(obj.NotebookCellUpdateRequest) + if string(jsonNotebookCellUpdateRequest) == "{}" { // empty struct + obj.NotebookCellUpdateRequest = nil + } else { + match++ + } + } else { + obj.NotebookCellUpdateRequest = nil + } + } else { + obj.NotebookCellUpdateRequest = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.NotebookCellCreateRequest = nil + obj.NotebookCellUpdateRequest = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj NotebookUpdateCell) MarshalJSON() ([]byte, error) { + if obj.NotebookCellCreateRequest != nil { + return json.Marshal(&obj.NotebookCellCreateRequest) + } + + if obj.NotebookCellUpdateRequest != nil { + return json.Marshal(&obj.NotebookCellUpdateRequest) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *NotebookUpdateCell) GetActualInstance() interface{} { + if obj.NotebookCellCreateRequest != nil { + return obj.NotebookCellCreateRequest + } + + if obj.NotebookCellUpdateRequest != nil { + return obj.NotebookCellUpdateRequest + } + + // all schemas are nil + return nil +} + +// NullableNotebookUpdateCell handles when a null is used for NotebookUpdateCell. +type NullableNotebookUpdateCell struct { + value *NotebookUpdateCell + isSet bool +} + +// Get returns the associated value. +func (v NullableNotebookUpdateCell) Get() *NotebookUpdateCell { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNotebookUpdateCell) Set(val *NotebookUpdateCell) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNotebookUpdateCell) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNotebookUpdateCell) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNotebookUpdateCell initializes the struct as if Set has been called. +func NewNullableNotebookUpdateCell(val *NotebookUpdateCell) *NullableNotebookUpdateCell { + return &NullableNotebookUpdateCell{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNotebookUpdateCell) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNotebookUpdateCell) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_notebook_update_data.go b/api/v1/datadog/model_notebook_update_data.go new file mode 100644 index 00000000000..33eb4abbd7e --- /dev/null +++ b/api/v1/datadog/model_notebook_update_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookUpdateData The data for a notebook update request. +type NotebookUpdateData struct { + // The data attributes of a notebook. + Attributes NotebookUpdateDataAttributes `json:"attributes"` + // Type of the Notebook resource. + Type NotebookResourceType `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{} +} + +// NewNotebookUpdateData instantiates a new NotebookUpdateData 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 NewNotebookUpdateData(attributes NotebookUpdateDataAttributes, typeVar NotebookResourceType) *NotebookUpdateData { + this := NotebookUpdateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewNotebookUpdateDataWithDefaults instantiates a new NotebookUpdateData 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 NewNotebookUpdateDataWithDefaults() *NotebookUpdateData { + this := NotebookUpdateData{} + var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *NotebookUpdateData) GetAttributes() NotebookUpdateDataAttributes { + if o == nil { + var ret NotebookUpdateDataAttributes + 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 *NotebookUpdateData) GetAttributesOk() (*NotebookUpdateDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *NotebookUpdateData) SetAttributes(v NotebookUpdateDataAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *NotebookUpdateData) GetType() NotebookResourceType { + if o == nil { + var ret NotebookResourceType + 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 *NotebookUpdateData) GetTypeOk() (*NotebookResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebookUpdateData) SetType(v NotebookResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *NotebookUpdateDataAttributes `json:"attributes"` + Type *NotebookResourceType `json:"type"` + }{} + all := struct { + Attributes NotebookUpdateDataAttributes `json:"attributes"` + Type NotebookResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebook_update_data_attributes.go b/api/v1/datadog/model_notebook_update_data_attributes.go new file mode 100644 index 00000000000..ee1baf172da --- /dev/null +++ b/api/v1/datadog/model_notebook_update_data_attributes.go @@ -0,0 +1,266 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookUpdateDataAttributes The data attributes of a notebook. +type NotebookUpdateDataAttributes struct { + // List of cells to display in the notebook. + Cells []NotebookUpdateCell `json:"cells"` + // Metadata associated with the notebook. + Metadata *NotebookMetadata `json:"metadata,omitempty"` + // The name of the notebook. + Name string `json:"name"` + // Publication status of the notebook. For now, always "published". + Status *NotebookStatus `json:"status,omitempty"` + // Notebook global timeframe. + Time NotebookGlobalTime `json:"time"` + // 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{} +} + +// NewNotebookUpdateDataAttributes instantiates a new NotebookUpdateDataAttributes 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 NewNotebookUpdateDataAttributes(cells []NotebookUpdateCell, name string, time NotebookGlobalTime) *NotebookUpdateDataAttributes { + this := NotebookUpdateDataAttributes{} + this.Cells = cells + this.Name = name + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + this.Time = time + return &this +} + +// NewNotebookUpdateDataAttributesWithDefaults instantiates a new NotebookUpdateDataAttributes 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 NewNotebookUpdateDataAttributesWithDefaults() *NotebookUpdateDataAttributes { + this := NotebookUpdateDataAttributes{} + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + return &this +} + +// GetCells returns the Cells field value. +func (o *NotebookUpdateDataAttributes) GetCells() []NotebookUpdateCell { + if o == nil { + var ret []NotebookUpdateCell + return ret + } + return o.Cells +} + +// GetCellsOk returns a tuple with the Cells field value +// and a boolean to check if the value has been set. +func (o *NotebookUpdateDataAttributes) GetCellsOk() (*[]NotebookUpdateCell, bool) { + if o == nil { + return nil, false + } + return &o.Cells, true +} + +// SetCells sets field value. +func (o *NotebookUpdateDataAttributes) SetCells(v []NotebookUpdateCell) { + o.Cells = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NotebookUpdateDataAttributes) GetMetadata() NotebookMetadata { + if o == nil || o.Metadata == nil { + var ret NotebookMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookUpdateDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *NotebookUpdateDataAttributes) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. +func (o *NotebookUpdateDataAttributes) SetMetadata(v NotebookMetadata) { + o.Metadata = &v +} + +// GetName returns the Name field value. +func (o *NotebookUpdateDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NotebookUpdateDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *NotebookUpdateDataAttributes) SetName(v string) { + o.Name = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NotebookUpdateDataAttributes) GetStatus() NotebookStatus { + if o == nil || o.Status == nil { + var ret NotebookStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebookUpdateDataAttributes) GetStatusOk() (*NotebookStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *NotebookUpdateDataAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. +func (o *NotebookUpdateDataAttributes) SetStatus(v NotebookStatus) { + o.Status = &v +} + +// GetTime returns the Time field value. +func (o *NotebookUpdateDataAttributes) GetTime() NotebookGlobalTime { + if o == nil { + var ret NotebookGlobalTime + return ret + } + return o.Time +} + +// GetTimeOk returns a tuple with the Time field value +// and a boolean to check if the value has been set. +func (o *NotebookUpdateDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { + if o == nil { + return nil, false + } + return &o.Time, true +} + +// SetTime sets field value. +func (o *NotebookUpdateDataAttributes) SetTime(v NotebookGlobalTime) { + o.Time = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookUpdateDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["cells"] = o.Cells + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["name"] = o.Name + if o.Status != nil { + toSerialize["status"] = o.Status + } + toSerialize["time"] = o.Time + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Cells *[]NotebookUpdateCell `json:"cells"` + Name *string `json:"name"` + Time *NotebookGlobalTime `json:"time"` + }{} + all := struct { + Cells []NotebookUpdateCell `json:"cells"` + Metadata *NotebookMetadata `json:"metadata,omitempty"` + Name string `json:"name"` + Status *NotebookStatus `json:"status,omitempty"` + Time NotebookGlobalTime `json:"time"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Cells == nil { + return fmt.Errorf("Required field cells missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Time == nil { + return fmt.Errorf("Required field time missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cells = all.Cells + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Name = all.Name + o.Status = all.Status + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebook_update_request.go b/api/v1/datadog/model_notebook_update_request.go new file mode 100644 index 00000000000..0c3e4bd7ba5 --- /dev/null +++ b/api/v1/datadog/model_notebook_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebookUpdateRequest The description of a notebook update request. +type NotebookUpdateRequest struct { + // The data for a notebook update request. + Data NotebookUpdateData `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{} +} + +// NewNotebookUpdateRequest instantiates a new NotebookUpdateRequest 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 NewNotebookUpdateRequest(data NotebookUpdateData) *NotebookUpdateRequest { + this := NotebookUpdateRequest{} + this.Data = data + return &this +} + +// NewNotebookUpdateRequestWithDefaults instantiates a new NotebookUpdateRequest 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 NewNotebookUpdateRequestWithDefaults() *NotebookUpdateRequest { + this := NotebookUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *NotebookUpdateRequest) GetData() NotebookUpdateData { + if o == nil { + var ret NotebookUpdateData + 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 *NotebookUpdateRequest) GetDataOk() (*NotebookUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *NotebookUpdateRequest) SetData(v NotebookUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebookUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebookUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *NotebookUpdateData `json:"data"` + }{} + all := struct { + Data NotebookUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_notebooks_response.go b/api/v1/datadog/model_notebooks_response.go new file mode 100644 index 00000000000..f9c9d3b14b2 --- /dev/null +++ b/api/v1/datadog/model_notebooks_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 datadog + +import ( + "encoding/json" +) + +// NotebooksResponse Notebooks get all response. +type NotebooksResponse struct { + // List of notebook definitions. + Data []NotebooksResponseData `json:"data,omitempty"` + // Searches metadata returned by the API. + Meta *NotebooksResponseMeta `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{} +} + +// NewNotebooksResponse instantiates a new NotebooksResponse 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 NewNotebooksResponse() *NotebooksResponse { + this := NotebooksResponse{} + return &this +} + +// NewNotebooksResponseWithDefaults instantiates a new NotebooksResponse 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 NewNotebooksResponseWithDefaults() *NotebooksResponse { + this := NotebooksResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *NotebooksResponse) GetData() []NotebooksResponseData { + if o == nil || o.Data == nil { + var ret []NotebooksResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponse) GetDataOk() (*[]NotebooksResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *NotebooksResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []NotebooksResponseData and assigns it to the Data field. +func (o *NotebooksResponse) SetData(v []NotebooksResponseData) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *NotebooksResponse) GetMeta() NotebooksResponseMeta { + if o == nil || o.Meta == nil { + var ret NotebooksResponseMeta + 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 *NotebooksResponse) GetMetaOk() (*NotebooksResponseMeta, 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 *NotebooksResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given NotebooksResponseMeta and assigns it to the Meta field. +func (o *NotebooksResponse) SetMeta(v NotebooksResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebooksResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebooksResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []NotebooksResponseData `json:"data,omitempty"` + Meta *NotebooksResponseMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v1/datadog/model_notebooks_response_data.go b/api/v1/datadog/model_notebooks_response_data.go new file mode 100644 index 00000000000..2271886a717 --- /dev/null +++ b/api/v1/datadog/model_notebooks_response_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NotebooksResponseData The data for a notebook in get all response. +type NotebooksResponseData struct { + // The attributes of a notebook in get all response. + Attributes NotebooksResponseDataAttributes `json:"attributes"` + // Unique notebook ID, assigned when you create the notebook. + Id int64 `json:"id"` + // Type of the Notebook resource. + Type NotebookResourceType `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{} +} + +// NewNotebooksResponseData instantiates a new NotebooksResponseData 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 NewNotebooksResponseData(attributes NotebooksResponseDataAttributes, id int64, typeVar NotebookResourceType) *NotebooksResponseData { + this := NotebooksResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewNotebooksResponseDataWithDefaults instantiates a new NotebooksResponseData 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 NewNotebooksResponseDataWithDefaults() *NotebooksResponseData { + this := NotebooksResponseData{} + var typeVar NotebookResourceType = NOTEBOOKRESOURCETYPE_NOTEBOOKS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *NotebooksResponseData) GetAttributes() NotebooksResponseDataAttributes { + if o == nil { + var ret NotebooksResponseDataAttributes + 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 *NotebooksResponseData) GetAttributesOk() (*NotebooksResponseDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *NotebooksResponseData) SetAttributes(v NotebooksResponseDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *NotebooksResponseData) GetId() int64 { + if o == nil { + var ret int64 + 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 *NotebooksResponseData) GetIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *NotebooksResponseData) SetId(v int64) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *NotebooksResponseData) GetType() NotebookResourceType { + if o == nil { + var ret NotebookResourceType + 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 *NotebooksResponseData) GetTypeOk() (*NotebookResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NotebooksResponseData) SetType(v NotebookResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebooksResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebooksResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *NotebooksResponseDataAttributes `json:"attributes"` + Id *int64 `json:"id"` + Type *NotebookResourceType `json:"type"` + }{} + all := struct { + Attributes NotebooksResponseDataAttributes `json:"attributes"` + Id int64 `json:"id"` + Type NotebookResourceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_notebooks_response_data_attributes.go b/api/v1/datadog/model_notebooks_response_data_attributes.go new file mode 100644 index 00000000000..3ae0ee17835 --- /dev/null +++ b/api/v1/datadog/model_notebooks_response_data_attributes.go @@ -0,0 +1,411 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" +) + +// NotebooksResponseDataAttributes The attributes of a notebook in get all response. +type NotebooksResponseDataAttributes struct { + // Attributes of user object returned by the API. + Author *NotebookAuthor `json:"author,omitempty"` + // List of cells to display in the notebook. + Cells []NotebookCellResponse `json:"cells,omitempty"` + // UTC time stamp for when the notebook was created. + Created *time.Time `json:"created,omitempty"` + // Metadata associated with the notebook. + Metadata *NotebookMetadata `json:"metadata,omitempty"` + // UTC time stamp for when the notebook was last modified. + Modified *time.Time `json:"modified,omitempty"` + // The name of the notebook. + Name string `json:"name"` + // Publication status of the notebook. For now, always "published". + Status *NotebookStatus `json:"status,omitempty"` + // Notebook global timeframe. + Time *NotebookGlobalTime `json:"time,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{} +} + +// NewNotebooksResponseDataAttributes instantiates a new NotebooksResponseDataAttributes 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 NewNotebooksResponseDataAttributes(name string) *NotebooksResponseDataAttributes { + this := NotebooksResponseDataAttributes{} + this.Name = name + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + return &this +} + +// NewNotebooksResponseDataAttributesWithDefaults instantiates a new NotebooksResponseDataAttributes 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 NewNotebooksResponseDataAttributesWithDefaults() *NotebooksResponseDataAttributes { + this := NotebooksResponseDataAttributes{} + var status NotebookStatus = NOTEBOOKSTATUS_PUBLISHED + this.Status = &status + return &this +} + +// GetAuthor returns the Author field value if set, zero value otherwise. +func (o *NotebooksResponseDataAttributes) GetAuthor() NotebookAuthor { + if o == nil || o.Author == nil { + var ret NotebookAuthor + return ret + } + return *o.Author +} + +// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetAuthorOk() (*NotebookAuthor, bool) { + if o == nil || o.Author == nil { + return nil, false + } + return o.Author, true +} + +// HasAuthor returns a boolean if a field has been set. +func (o *NotebooksResponseDataAttributes) HasAuthor() bool { + if o != nil && o.Author != nil { + return true + } + + return false +} + +// SetAuthor gets a reference to the given NotebookAuthor and assigns it to the Author field. +func (o *NotebooksResponseDataAttributes) SetAuthor(v NotebookAuthor) { + o.Author = &v +} + +// GetCells returns the Cells field value if set, zero value otherwise. +func (o *NotebooksResponseDataAttributes) GetCells() []NotebookCellResponse { + if o == nil || o.Cells == nil { + var ret []NotebookCellResponse + return ret + } + return o.Cells +} + +// GetCellsOk returns a tuple with the Cells field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetCellsOk() (*[]NotebookCellResponse, bool) { + if o == nil || o.Cells == nil { + return nil, false + } + return &o.Cells, true +} + +// HasCells returns a boolean if a field has been set. +func (o *NotebooksResponseDataAttributes) HasCells() bool { + if o != nil && o.Cells != nil { + return true + } + + return false +} + +// SetCells gets a reference to the given []NotebookCellResponse and assigns it to the Cells field. +func (o *NotebooksResponseDataAttributes) SetCells(v []NotebookCellResponse) { + o.Cells = v +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *NotebooksResponseDataAttributes) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *NotebooksResponseDataAttributes) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *NotebooksResponseDataAttributes) SetCreated(v time.Time) { + o.Created = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NotebooksResponseDataAttributes) GetMetadata() NotebookMetadata { + if o == nil || o.Metadata == nil { + var ret NotebookMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetMetadataOk() (*NotebookMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *NotebooksResponseDataAttributes) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given NotebookMetadata and assigns it to the Metadata field. +func (o *NotebooksResponseDataAttributes) SetMetadata(v NotebookMetadata) { + o.Metadata = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *NotebooksResponseDataAttributes) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *NotebooksResponseDataAttributes) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *NotebooksResponseDataAttributes) SetModified(v time.Time) { + o.Modified = &v +} + +// GetName returns the Name field value. +func (o *NotebooksResponseDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *NotebooksResponseDataAttributes) SetName(v string) { + o.Name = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NotebooksResponseDataAttributes) GetStatus() NotebookStatus { + if o == nil || o.Status == nil { + var ret NotebookStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetStatusOk() (*NotebookStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *NotebooksResponseDataAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given NotebookStatus and assigns it to the Status field. +func (o *NotebooksResponseDataAttributes) SetStatus(v NotebookStatus) { + o.Status = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *NotebooksResponseDataAttributes) GetTime() NotebookGlobalTime { + if o == nil || o.Time == nil { + var ret NotebookGlobalTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseDataAttributes) GetTimeOk() (*NotebookGlobalTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *NotebooksResponseDataAttributes) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given NotebookGlobalTime and assigns it to the Time field. +func (o *NotebooksResponseDataAttributes) SetTime(v NotebookGlobalTime) { + o.Time = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebooksResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Author != nil { + toSerialize["author"] = o.Author + } + if o.Cells != nil { + toSerialize["cells"] = o.Cells + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + toSerialize["name"] = o.Name + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Author *NotebookAuthor `json:"author,omitempty"` + Cells []NotebookCellResponse `json:"cells,omitempty"` + Created *time.Time `json:"created,omitempty"` + Metadata *NotebookMetadata `json:"metadata,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Name string `json:"name"` + Status *NotebookStatus `json:"status,omitempty"` + Time *NotebookGlobalTime `json:"time,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Author = all.Author + o.Cells = all.Cells + o.Created = all.Created + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Modified = all.Modified + o.Name = all.Name + o.Status = all.Status + o.Time = all.Time + return nil +} diff --git a/api/v1/datadog/model_notebooks_response_meta.go b/api/v1/datadog/model_notebooks_response_meta.go new file mode 100644 index 00000000000..bd20c2269e6 --- /dev/null +++ b/api/v1/datadog/model_notebooks_response_meta.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebooksResponseMeta Searches metadata returned by the API. +type NotebooksResponseMeta struct { + // Pagination metadata returned by the API. + Page *NotebooksResponsePage `json:"page,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{} +} + +// NewNotebooksResponseMeta instantiates a new NotebooksResponseMeta 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 NewNotebooksResponseMeta() *NotebooksResponseMeta { + this := NotebooksResponseMeta{} + return &this +} + +// NewNotebooksResponseMetaWithDefaults instantiates a new NotebooksResponseMeta 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 NewNotebooksResponseMetaWithDefaults() *NotebooksResponseMeta { + this := NotebooksResponseMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *NotebooksResponseMeta) GetPage() NotebooksResponsePage { + if o == nil || o.Page == nil { + var ret NotebooksResponsePage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponseMeta) GetPageOk() (*NotebooksResponsePage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *NotebooksResponseMeta) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given NotebooksResponsePage and assigns it to the Page field. +func (o *NotebooksResponseMeta) SetPage(v NotebooksResponsePage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebooksResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebooksResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *NotebooksResponsePage `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v1/datadog/model_notebooks_response_page.go b/api/v1/datadog/model_notebooks_response_page.go new file mode 100644 index 00000000000..2daa01ffec8 --- /dev/null +++ b/api/v1/datadog/model_notebooks_response_page.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// NotebooksResponsePage Pagination metadata returned by the API. +type NotebooksResponsePage struct { + // The total number of notebooks that would be returned if the request was not filtered by `start` and `count` parameters. + TotalCount *int64 `json:"total_count,omitempty"` + // The total number of notebooks returned. + 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{} +} + +// NewNotebooksResponsePage instantiates a new NotebooksResponsePage 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 NewNotebooksResponsePage() *NotebooksResponsePage { + this := NotebooksResponsePage{} + return &this +} + +// NewNotebooksResponsePageWithDefaults instantiates a new NotebooksResponsePage 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 NewNotebooksResponsePageWithDefaults() *NotebooksResponsePage { + this := NotebooksResponsePage{} + return &this +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *NotebooksResponsePage) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotebooksResponsePage) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *NotebooksResponsePage) HasTotalCount() bool { + if o != nil && o.TotalCount != nil { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *NotebooksResponsePage) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *NotebooksResponsePage) 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 *NotebooksResponsePage) 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 *NotebooksResponsePage) HasTotalFilteredCount() bool { + if o != nil && o.TotalFilteredCount != nil { + return true + } + + return false +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *NotebooksResponsePage) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NotebooksResponsePage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NotebooksResponsePage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TotalCount *int64 `json:"total_count,omitempty"` + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TotalCount = all.TotalCount + o.TotalFilteredCount = all.TotalFilteredCount + return nil +} diff --git a/api/v1/datadog/model_org_downgraded_response.go b/api/v1/datadog/model_org_downgraded_response.go new file mode 100644 index 00000000000..50a6cd070e6 --- /dev/null +++ b/api/v1/datadog/model_org_downgraded_response.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 datadog + +import ( + "encoding/json" +) + +// OrgDowngradedResponse Status of downgrade +type OrgDowngradedResponse struct { + // Information pertaining to the downgraded child organization. + Message *string `json:"message,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{} +} + +// NewOrgDowngradedResponse instantiates a new OrgDowngradedResponse 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 NewOrgDowngradedResponse() *OrgDowngradedResponse { + this := OrgDowngradedResponse{} + return &this +} + +// NewOrgDowngradedResponseWithDefaults instantiates a new OrgDowngradedResponse 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 NewOrgDowngradedResponseWithDefaults() *OrgDowngradedResponse { + this := OrgDowngradedResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *OrgDowngradedResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrgDowngradedResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *OrgDowngradedResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *OrgDowngradedResponse) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrgDowngradedResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrgDowngradedResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Message *string `json:"message,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_organization.go b/api/v1/datadog/model_organization.go new file mode 100644 index 00000000000..d382d63e93a --- /dev/null +++ b/api/v1/datadog/model_organization.go @@ -0,0 +1,404 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Organization Create, edit, and manage organizations. +type Organization struct { + // A JSON array of billing type. + // Deprecated + Billing *OrganizationBilling `json:"billing,omitempty"` + // Date of the organization creation. + Created *string `json:"created,omitempty"` + // Description of the organization. + Description *string `json:"description,omitempty"` + // The name of the new child-organization, limited to 32 characters. + Name *string `json:"name,omitempty"` + // The `public_id` of the organization you are operating within. + PublicId *string `json:"public_id,omitempty"` + // A JSON array of settings. + Settings *OrganizationSettings `json:"settings,omitempty"` + // Subscription definition. + // Deprecated + Subscription *OrganizationSubscription `json:"subscription,omitempty"` + // Only available for MSP customers. Allows child organizations to be created on a trial plan. + Trial *bool `json:"trial,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{} +} + +// NewOrganization instantiates a new Organization 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 NewOrganization() *Organization { + this := Organization{} + return &this +} + +// NewOrganizationWithDefaults instantiates a new Organization 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 NewOrganizationWithDefaults() *Organization { + this := Organization{} + return &this +} + +// GetBilling returns the Billing field value if set, zero value otherwise. +// Deprecated +func (o *Organization) GetBilling() OrganizationBilling { + if o == nil || o.Billing == nil { + var ret OrganizationBilling + return ret + } + return *o.Billing +} + +// GetBillingOk returns a tuple with the Billing field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *Organization) GetBillingOk() (*OrganizationBilling, bool) { + if o == nil || o.Billing == nil { + return nil, false + } + return o.Billing, true +} + +// HasBilling returns a boolean if a field has been set. +func (o *Organization) HasBilling() bool { + if o != nil && o.Billing != nil { + return true + } + + return false +} + +// SetBilling gets a reference to the given OrganizationBilling and assigns it to the Billing field. +// Deprecated +func (o *Organization) SetBilling(v OrganizationBilling) { + o.Billing = &v +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *Organization) GetCreated() string { + if o == nil || o.Created == nil { + var ret string + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetCreatedOk() (*string, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *Organization) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given string and assigns it to the Created field. +func (o *Organization) SetCreated(v string) { + o.Created = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Organization) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Organization) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Organization) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Organization) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Organization) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Organization) SetName(v string) { + o.Name = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *Organization) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *Organization) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *Organization) SetPublicId(v string) { + o.PublicId = &v +} + +// GetSettings returns the Settings field value if set, zero value otherwise. +func (o *Organization) GetSettings() OrganizationSettings { + if o == nil || o.Settings == nil { + var ret OrganizationSettings + return ret + } + return *o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetSettingsOk() (*OrganizationSettings, bool) { + if o == nil || o.Settings == nil { + return nil, false + } + return o.Settings, true +} + +// HasSettings returns a boolean if a field has been set. +func (o *Organization) HasSettings() bool { + if o != nil && o.Settings != nil { + return true + } + + return false +} + +// SetSettings gets a reference to the given OrganizationSettings and assigns it to the Settings field. +func (o *Organization) SetSettings(v OrganizationSettings) { + o.Settings = &v +} + +// GetSubscription returns the Subscription field value if set, zero value otherwise. +// Deprecated +func (o *Organization) GetSubscription() OrganizationSubscription { + if o == nil || o.Subscription == nil { + var ret OrganizationSubscription + return ret + } + return *o.Subscription +} + +// GetSubscriptionOk returns a tuple with the Subscription field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *Organization) GetSubscriptionOk() (*OrganizationSubscription, bool) { + if o == nil || o.Subscription == nil { + return nil, false + } + return o.Subscription, true +} + +// HasSubscription returns a boolean if a field has been set. +func (o *Organization) HasSubscription() bool { + if o != nil && o.Subscription != nil { + return true + } + + return false +} + +// SetSubscription gets a reference to the given OrganizationSubscription and assigns it to the Subscription field. +// Deprecated +func (o *Organization) SetSubscription(v OrganizationSubscription) { + o.Subscription = &v +} + +// GetTrial returns the Trial field value if set, zero value otherwise. +func (o *Organization) GetTrial() bool { + if o == nil || o.Trial == nil { + var ret bool + return ret + } + return *o.Trial +} + +// GetTrialOk returns a tuple with the Trial field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetTrialOk() (*bool, bool) { + if o == nil || o.Trial == nil { + return nil, false + } + return o.Trial, true +} + +// HasTrial returns a boolean if a field has been set. +func (o *Organization) HasTrial() bool { + if o != nil && o.Trial != nil { + return true + } + + return false +} + +// SetTrial gets a reference to the given bool and assigns it to the Trial field. +func (o *Organization) SetTrial(v bool) { + o.Trial = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Organization) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Billing != nil { + toSerialize["billing"] = o.Billing + } + if o.Created != nil { + toSerialize["created"] = o.Created + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Settings != nil { + toSerialize["settings"] = o.Settings + } + if o.Subscription != nil { + toSerialize["subscription"] = o.Subscription + } + if o.Trial != nil { + toSerialize["trial"] = o.Trial + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Billing *OrganizationBilling `json:"billing,omitempty"` + Created *string `json:"created,omitempty"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + Settings *OrganizationSettings `json:"settings,omitempty"` + Subscription *OrganizationSubscription `json:"subscription,omitempty"` + Trial *bool `json:"trial,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Billing != nil && all.Billing.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Billing = all.Billing + o.Created = all.Created + o.Description = all.Description + o.Name = all.Name + o.PublicId = all.PublicId + if all.Settings != nil && all.Settings.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Settings = all.Settings + if all.Subscription != nil && all.Subscription.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Subscription = all.Subscription + o.Trial = all.Trial + return nil +} diff --git a/api/v1/datadog/model_organization_billing.go b/api/v1/datadog/model_organization_billing.go new file mode 100644 index 00000000000..d8f031b6f59 --- /dev/null +++ b/api/v1/datadog/model_organization_billing.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 datadog + +import ( + "encoding/json" +) + +// OrganizationBilling A JSON array of billing type. +type OrganizationBilling struct { + // The type of billing. Only `parent_billing` is supported. + Type *string `json:"type,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{} +} + +// NewOrganizationBilling instantiates a new OrganizationBilling 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 NewOrganizationBilling() *OrganizationBilling { + this := OrganizationBilling{} + return &this +} + +// NewOrganizationBillingWithDefaults instantiates a new OrganizationBilling 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 NewOrganizationBillingWithDefaults() *OrganizationBilling { + this := OrganizationBilling{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *OrganizationBilling) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationBilling) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *OrganizationBilling) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *OrganizationBilling) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationBilling) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationBilling) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_organization_create_body.go b/api/v1/datadog/model_organization_create_body.go new file mode 100644 index 00000000000..28c17d26b70 --- /dev/null +++ b/api/v1/datadog/model_organization_create_body.go @@ -0,0 +1,203 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OrganizationCreateBody Object describing an organization to create. +type OrganizationCreateBody struct { + // A JSON array of billing type. + // Deprecated + Billing *OrganizationBilling `json:"billing,omitempty"` + // The name of the new child-organization, limited to 32 characters. + Name string `json:"name"` + // Subscription definition. + // Deprecated + Subscription *OrganizationSubscription `json:"subscription,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{} +} + +// NewOrganizationCreateBody instantiates a new OrganizationCreateBody 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 NewOrganizationCreateBody(name string) *OrganizationCreateBody { + this := OrganizationCreateBody{} + this.Name = name + return &this +} + +// NewOrganizationCreateBodyWithDefaults instantiates a new OrganizationCreateBody 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 NewOrganizationCreateBodyWithDefaults() *OrganizationCreateBody { + this := OrganizationCreateBody{} + return &this +} + +// GetBilling returns the Billing field value if set, zero value otherwise. +// Deprecated +func (o *OrganizationCreateBody) GetBilling() OrganizationBilling { + if o == nil || o.Billing == nil { + var ret OrganizationBilling + return ret + } + return *o.Billing +} + +// GetBillingOk returns a tuple with the Billing field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *OrganizationCreateBody) GetBillingOk() (*OrganizationBilling, bool) { + if o == nil || o.Billing == nil { + return nil, false + } + return o.Billing, true +} + +// HasBilling returns a boolean if a field has been set. +func (o *OrganizationCreateBody) HasBilling() bool { + if o != nil && o.Billing != nil { + return true + } + + return false +} + +// SetBilling gets a reference to the given OrganizationBilling and assigns it to the Billing field. +// Deprecated +func (o *OrganizationCreateBody) SetBilling(v OrganizationBilling) { + o.Billing = &v +} + +// GetName returns the Name field value. +func (o *OrganizationCreateBody) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *OrganizationCreateBody) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *OrganizationCreateBody) SetName(v string) { + o.Name = v +} + +// GetSubscription returns the Subscription field value if set, zero value otherwise. +// Deprecated +func (o *OrganizationCreateBody) GetSubscription() OrganizationSubscription { + if o == nil || o.Subscription == nil { + var ret OrganizationSubscription + return ret + } + return *o.Subscription +} + +// GetSubscriptionOk returns a tuple with the Subscription field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *OrganizationCreateBody) GetSubscriptionOk() (*OrganizationSubscription, bool) { + if o == nil || o.Subscription == nil { + return nil, false + } + return o.Subscription, true +} + +// HasSubscription returns a boolean if a field has been set. +func (o *OrganizationCreateBody) HasSubscription() bool { + if o != nil && o.Subscription != nil { + return true + } + + return false +} + +// SetSubscription gets a reference to the given OrganizationSubscription and assigns it to the Subscription field. +// Deprecated +func (o *OrganizationCreateBody) SetSubscription(v OrganizationSubscription) { + o.Subscription = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationCreateBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Billing != nil { + toSerialize["billing"] = o.Billing + } + toSerialize["name"] = o.Name + if o.Subscription != nil { + toSerialize["subscription"] = o.Subscription + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationCreateBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Billing *OrganizationBilling `json:"billing,omitempty"` + Name string `json:"name"` + Subscription *OrganizationSubscription `json:"subscription,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Billing != nil && all.Billing.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Billing = all.Billing + o.Name = all.Name + if all.Subscription != nil && all.Subscription.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Subscription = all.Subscription + return nil +} diff --git a/api/v1/datadog/model_organization_create_response.go b/api/v1/datadog/model_organization_create_response.go new file mode 100644 index 00000000000..cdd770d7dbf --- /dev/null +++ b/api/v1/datadog/model_organization_create_response.go @@ -0,0 +1,247 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// OrganizationCreateResponse Response object for an organization creation. +type OrganizationCreateResponse struct { + // Datadog API key. + ApiKey *ApiKey `json:"api_key,omitempty"` + // An application key with its associated metadata. + ApplicationKey *ApplicationKey `json:"application_key,omitempty"` + // Create, edit, and manage organizations. + Org *Organization `json:"org,omitempty"` + // Create, edit, and disable users. + User *User `json:"user,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{} +} + +// NewOrganizationCreateResponse instantiates a new OrganizationCreateResponse 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 NewOrganizationCreateResponse() *OrganizationCreateResponse { + this := OrganizationCreateResponse{} + return &this +} + +// NewOrganizationCreateResponseWithDefaults instantiates a new OrganizationCreateResponse 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 NewOrganizationCreateResponseWithDefaults() *OrganizationCreateResponse { + this := OrganizationCreateResponse{} + return &this +} + +// GetApiKey returns the ApiKey field value if set, zero value otherwise. +func (o *OrganizationCreateResponse) GetApiKey() ApiKey { + if o == nil || o.ApiKey == nil { + var ret ApiKey + return ret + } + return *o.ApiKey +} + +// GetApiKeyOk returns a tuple with the ApiKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationCreateResponse) GetApiKeyOk() (*ApiKey, bool) { + if o == nil || o.ApiKey == nil { + return nil, false + } + return o.ApiKey, true +} + +// HasApiKey returns a boolean if a field has been set. +func (o *OrganizationCreateResponse) HasApiKey() bool { + if o != nil && o.ApiKey != nil { + return true + } + + return false +} + +// SetApiKey gets a reference to the given ApiKey and assigns it to the ApiKey field. +func (o *OrganizationCreateResponse) SetApiKey(v ApiKey) { + o.ApiKey = &v +} + +// GetApplicationKey returns the ApplicationKey field value if set, zero value otherwise. +func (o *OrganizationCreateResponse) GetApplicationKey() ApplicationKey { + if o == nil || o.ApplicationKey == nil { + var ret ApplicationKey + return ret + } + return *o.ApplicationKey +} + +// GetApplicationKeyOk returns a tuple with the ApplicationKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationCreateResponse) GetApplicationKeyOk() (*ApplicationKey, bool) { + if o == nil || o.ApplicationKey == nil { + return nil, false + } + return o.ApplicationKey, true +} + +// HasApplicationKey returns a boolean if a field has been set. +func (o *OrganizationCreateResponse) HasApplicationKey() bool { + if o != nil && o.ApplicationKey != nil { + return true + } + + return false +} + +// SetApplicationKey gets a reference to the given ApplicationKey and assigns it to the ApplicationKey field. +func (o *OrganizationCreateResponse) SetApplicationKey(v ApplicationKey) { + o.ApplicationKey = &v +} + +// GetOrg returns the Org field value if set, zero value otherwise. +func (o *OrganizationCreateResponse) GetOrg() Organization { + if o == nil || o.Org == nil { + var ret Organization + return ret + } + return *o.Org +} + +// GetOrgOk returns a tuple with the Org field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationCreateResponse) GetOrgOk() (*Organization, bool) { + if o == nil || o.Org == nil { + return nil, false + } + return o.Org, true +} + +// HasOrg returns a boolean if a field has been set. +func (o *OrganizationCreateResponse) HasOrg() bool { + if o != nil && o.Org != nil { + return true + } + + return false +} + +// SetOrg gets a reference to the given Organization and assigns it to the Org field. +func (o *OrganizationCreateResponse) SetOrg(v Organization) { + o.Org = &v +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *OrganizationCreateResponse) GetUser() User { + if o == nil || o.User == nil { + var ret User + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationCreateResponse) GetUserOk() (*User, bool) { + if o == nil || o.User == nil { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *OrganizationCreateResponse) HasUser() bool { + if o != nil && o.User != nil { + return true + } + + return false +} + +// SetUser gets a reference to the given User and assigns it to the User field. +func (o *OrganizationCreateResponse) SetUser(v User) { + o.User = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApiKey != nil { + toSerialize["api_key"] = o.ApiKey + } + if o.ApplicationKey != nil { + toSerialize["application_key"] = o.ApplicationKey + } + if o.Org != nil { + toSerialize["org"] = o.Org + } + if o.User != nil { + toSerialize["user"] = o.User + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationCreateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApiKey *ApiKey `json:"api_key,omitempty"` + ApplicationKey *ApplicationKey `json:"application_key,omitempty"` + Org *Organization `json:"org,omitempty"` + User *User `json:"user,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApiKey != nil && all.ApiKey.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApiKey = all.ApiKey + if all.ApplicationKey != nil && all.ApplicationKey.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApplicationKey = all.ApplicationKey + if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Org = all.Org + if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.User = all.User + return nil +} diff --git a/api/v1/datadog/model_organization_list_response.go b/api/v1/datadog/model_organization_list_response.go new file mode 100644 index 00000000000..5bdc8221aaa --- /dev/null +++ b/api/v1/datadog/model_organization_list_response.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 datadog + +import ( + "encoding/json" +) + +// OrganizationListResponse Response with the list of organizations. +type OrganizationListResponse struct { + // Array of organization objects. + Orgs []Organization `json:"orgs,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{} +} + +// NewOrganizationListResponse instantiates a new OrganizationListResponse 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 NewOrganizationListResponse() *OrganizationListResponse { + this := OrganizationListResponse{} + return &this +} + +// NewOrganizationListResponseWithDefaults instantiates a new OrganizationListResponse 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 NewOrganizationListResponseWithDefaults() *OrganizationListResponse { + this := OrganizationListResponse{} + return &this +} + +// GetOrgs returns the Orgs field value if set, zero value otherwise. +func (o *OrganizationListResponse) GetOrgs() []Organization { + if o == nil || o.Orgs == nil { + var ret []Organization + return ret + } + return o.Orgs +} + +// GetOrgsOk returns a tuple with the Orgs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationListResponse) GetOrgsOk() (*[]Organization, bool) { + if o == nil || o.Orgs == nil { + return nil, false + } + return &o.Orgs, true +} + +// HasOrgs returns a boolean if a field has been set. +func (o *OrganizationListResponse) HasOrgs() bool { + if o != nil && o.Orgs != nil { + return true + } + + return false +} + +// SetOrgs gets a reference to the given []Organization and assigns it to the Orgs field. +func (o *OrganizationListResponse) SetOrgs(v []Organization) { + o.Orgs = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Orgs != nil { + toSerialize["orgs"] = o.Orgs + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Orgs []Organization `json:"orgs,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Orgs = all.Orgs + return nil +} diff --git a/api/v1/datadog/model_organization_response.go b/api/v1/datadog/model_organization_response.go new file mode 100644 index 00000000000..ca52471c117 --- /dev/null +++ b/api/v1/datadog/model_organization_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// OrganizationResponse Response with an organization. +type OrganizationResponse struct { + // Create, edit, and manage organizations. + Org *Organization `json:"org,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{} +} + +// NewOrganizationResponse instantiates a new OrganizationResponse 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 NewOrganizationResponse() *OrganizationResponse { + this := OrganizationResponse{} + return &this +} + +// NewOrganizationResponseWithDefaults instantiates a new OrganizationResponse 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 NewOrganizationResponseWithDefaults() *OrganizationResponse { + this := OrganizationResponse{} + return &this +} + +// GetOrg returns the Org field value if set, zero value otherwise. +func (o *OrganizationResponse) GetOrg() Organization { + if o == nil || o.Org == nil { + var ret Organization + return ret + } + return *o.Org +} + +// GetOrgOk returns a tuple with the Org field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationResponse) GetOrgOk() (*Organization, bool) { + if o == nil || o.Org == nil { + return nil, false + } + return o.Org, true +} + +// HasOrg returns a boolean if a field has been set. +func (o *OrganizationResponse) HasOrg() bool { + if o != nil && o.Org != nil { + return true + } + + return false +} + +// SetOrg gets a reference to the given Organization and assigns it to the Org field. +func (o *OrganizationResponse) SetOrg(v Organization) { + o.Org = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Org != nil { + toSerialize["org"] = o.Org + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Org *Organization `json:"org,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Org = all.Org + return nil +} diff --git a/api/v1/datadog/model_organization_settings.go b/api/v1/datadog/model_organization_settings.go new file mode 100644 index 00000000000..00441d21037 --- /dev/null +++ b/api/v1/datadog/model_organization_settings.go @@ -0,0 +1,494 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// OrganizationSettings A JSON array of settings. +type OrganizationSettings struct { + // Whether or not the organization users can share widgets outside of Datadog. + PrivateWidgetShare *bool `json:"private_widget_share,omitempty"` + // Set the boolean property enabled to enable or disable single sign on with SAML. + // See the SAML documentation for more information about all SAML settings. + Saml *OrganizationSettingsSaml `json:"saml,omitempty"` + // The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). + SamlAutocreateAccessRole *AccessRole `json:"saml_autocreate_access_role,omitempty"` + // Has two properties, `enabled` (boolean) and `domains`, which is a list of domains without the @ symbol. + SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"` + // Whether or not SAML can be enabled for this organization. + SamlCanBeEnabled *bool `json:"saml_can_be_enabled,omitempty"` + // Identity provider endpoint for SAML authentication. + SamlIdpEndpoint *string `json:"saml_idp_endpoint,omitempty"` + // Has one property enabled (boolean). + SamlIdpInitiatedLogin *OrganizationSettingsSamlIdpInitiatedLogin `json:"saml_idp_initiated_login,omitempty"` + // Whether or not a SAML identity provider metadata file was provided to the Datadog organization. + SamlIdpMetadataUploaded *bool `json:"saml_idp_metadata_uploaded,omitempty"` + // URL for SAML logging. + SamlLoginUrl *string `json:"saml_login_url,omitempty"` + // Has one property enabled (boolean). + SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,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{} +} + +// NewOrganizationSettings instantiates a new OrganizationSettings 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 NewOrganizationSettings() *OrganizationSettings { + this := OrganizationSettings{} + var samlAutocreateAccessRole AccessRole = ACCESSROLE_STANDARD + this.SamlAutocreateAccessRole = &samlAutocreateAccessRole + return &this +} + +// NewOrganizationSettingsWithDefaults instantiates a new OrganizationSettings 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 NewOrganizationSettingsWithDefaults() *OrganizationSettings { + this := OrganizationSettings{} + var samlAutocreateAccessRole AccessRole = ACCESSROLE_STANDARD + this.SamlAutocreateAccessRole = &samlAutocreateAccessRole + return &this +} + +// GetPrivateWidgetShare returns the PrivateWidgetShare field value if set, zero value otherwise. +func (o *OrganizationSettings) GetPrivateWidgetShare() bool { + if o == nil || o.PrivateWidgetShare == nil { + var ret bool + return ret + } + return *o.PrivateWidgetShare +} + +// GetPrivateWidgetShareOk returns a tuple with the PrivateWidgetShare field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetPrivateWidgetShareOk() (*bool, bool) { + if o == nil || o.PrivateWidgetShare == nil { + return nil, false + } + return o.PrivateWidgetShare, true +} + +// HasPrivateWidgetShare returns a boolean if a field has been set. +func (o *OrganizationSettings) HasPrivateWidgetShare() bool { + if o != nil && o.PrivateWidgetShare != nil { + return true + } + + return false +} + +// SetPrivateWidgetShare gets a reference to the given bool and assigns it to the PrivateWidgetShare field. +func (o *OrganizationSettings) SetPrivateWidgetShare(v bool) { + o.PrivateWidgetShare = &v +} + +// GetSaml returns the Saml field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSaml() OrganizationSettingsSaml { + if o == nil || o.Saml == nil { + var ret OrganizationSettingsSaml + return ret + } + return *o.Saml +} + +// GetSamlOk returns a tuple with the Saml field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlOk() (*OrganizationSettingsSaml, bool) { + if o == nil || o.Saml == nil { + return nil, false + } + return o.Saml, true +} + +// HasSaml returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSaml() bool { + if o != nil && o.Saml != nil { + return true + } + + return false +} + +// SetSaml gets a reference to the given OrganizationSettingsSaml and assigns it to the Saml field. +func (o *OrganizationSettings) SetSaml(v OrganizationSettingsSaml) { + o.Saml = &v +} + +// GetSamlAutocreateAccessRole returns the SamlAutocreateAccessRole field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlAutocreateAccessRole() AccessRole { + if o == nil || o.SamlAutocreateAccessRole == nil { + var ret AccessRole + return ret + } + return *o.SamlAutocreateAccessRole +} + +// GetSamlAutocreateAccessRoleOk returns a tuple with the SamlAutocreateAccessRole field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlAutocreateAccessRoleOk() (*AccessRole, bool) { + if o == nil || o.SamlAutocreateAccessRole == nil { + return nil, false + } + return o.SamlAutocreateAccessRole, true +} + +// HasSamlAutocreateAccessRole returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlAutocreateAccessRole() bool { + if o != nil && o.SamlAutocreateAccessRole != nil { + return true + } + + return false +} + +// SetSamlAutocreateAccessRole gets a reference to the given AccessRole and assigns it to the SamlAutocreateAccessRole field. +func (o *OrganizationSettings) SetSamlAutocreateAccessRole(v AccessRole) { + o.SamlAutocreateAccessRole = &v +} + +// GetSamlAutocreateUsersDomains returns the SamlAutocreateUsersDomains field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlAutocreateUsersDomains() OrganizationSettingsSamlAutocreateUsersDomains { + if o == nil || o.SamlAutocreateUsersDomains == nil { + var ret OrganizationSettingsSamlAutocreateUsersDomains + return ret + } + return *o.SamlAutocreateUsersDomains +} + +// GetSamlAutocreateUsersDomainsOk returns a tuple with the SamlAutocreateUsersDomains field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlAutocreateUsersDomainsOk() (*OrganizationSettingsSamlAutocreateUsersDomains, bool) { + if o == nil || o.SamlAutocreateUsersDomains == nil { + return nil, false + } + return o.SamlAutocreateUsersDomains, true +} + +// HasSamlAutocreateUsersDomains returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlAutocreateUsersDomains() bool { + if o != nil && o.SamlAutocreateUsersDomains != nil { + return true + } + + return false +} + +// SetSamlAutocreateUsersDomains gets a reference to the given OrganizationSettingsSamlAutocreateUsersDomains and assigns it to the SamlAutocreateUsersDomains field. +func (o *OrganizationSettings) SetSamlAutocreateUsersDomains(v OrganizationSettingsSamlAutocreateUsersDomains) { + o.SamlAutocreateUsersDomains = &v +} + +// GetSamlCanBeEnabled returns the SamlCanBeEnabled field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlCanBeEnabled() bool { + if o == nil || o.SamlCanBeEnabled == nil { + var ret bool + return ret + } + return *o.SamlCanBeEnabled +} + +// GetSamlCanBeEnabledOk returns a tuple with the SamlCanBeEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlCanBeEnabledOk() (*bool, bool) { + if o == nil || o.SamlCanBeEnabled == nil { + return nil, false + } + return o.SamlCanBeEnabled, true +} + +// HasSamlCanBeEnabled returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlCanBeEnabled() bool { + if o != nil && o.SamlCanBeEnabled != nil { + return true + } + + return false +} + +// SetSamlCanBeEnabled gets a reference to the given bool and assigns it to the SamlCanBeEnabled field. +func (o *OrganizationSettings) SetSamlCanBeEnabled(v bool) { + o.SamlCanBeEnabled = &v +} + +// GetSamlIdpEndpoint returns the SamlIdpEndpoint field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlIdpEndpoint() string { + if o == nil || o.SamlIdpEndpoint == nil { + var ret string + return ret + } + return *o.SamlIdpEndpoint +} + +// GetSamlIdpEndpointOk returns a tuple with the SamlIdpEndpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlIdpEndpointOk() (*string, bool) { + if o == nil || o.SamlIdpEndpoint == nil { + return nil, false + } + return o.SamlIdpEndpoint, true +} + +// HasSamlIdpEndpoint returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlIdpEndpoint() bool { + if o != nil && o.SamlIdpEndpoint != nil { + return true + } + + return false +} + +// SetSamlIdpEndpoint gets a reference to the given string and assigns it to the SamlIdpEndpoint field. +func (o *OrganizationSettings) SetSamlIdpEndpoint(v string) { + o.SamlIdpEndpoint = &v +} + +// GetSamlIdpInitiatedLogin returns the SamlIdpInitiatedLogin field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlIdpInitiatedLogin() OrganizationSettingsSamlIdpInitiatedLogin { + if o == nil || o.SamlIdpInitiatedLogin == nil { + var ret OrganizationSettingsSamlIdpInitiatedLogin + return ret + } + return *o.SamlIdpInitiatedLogin +} + +// GetSamlIdpInitiatedLoginOk returns a tuple with the SamlIdpInitiatedLogin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlIdpInitiatedLoginOk() (*OrganizationSettingsSamlIdpInitiatedLogin, bool) { + if o == nil || o.SamlIdpInitiatedLogin == nil { + return nil, false + } + return o.SamlIdpInitiatedLogin, true +} + +// HasSamlIdpInitiatedLogin returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlIdpInitiatedLogin() bool { + if o != nil && o.SamlIdpInitiatedLogin != nil { + return true + } + + return false +} + +// SetSamlIdpInitiatedLogin gets a reference to the given OrganizationSettingsSamlIdpInitiatedLogin and assigns it to the SamlIdpInitiatedLogin field. +func (o *OrganizationSettings) SetSamlIdpInitiatedLogin(v OrganizationSettingsSamlIdpInitiatedLogin) { + o.SamlIdpInitiatedLogin = &v +} + +// GetSamlIdpMetadataUploaded returns the SamlIdpMetadataUploaded field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlIdpMetadataUploaded() bool { + if o == nil || o.SamlIdpMetadataUploaded == nil { + var ret bool + return ret + } + return *o.SamlIdpMetadataUploaded +} + +// GetSamlIdpMetadataUploadedOk returns a tuple with the SamlIdpMetadataUploaded field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlIdpMetadataUploadedOk() (*bool, bool) { + if o == nil || o.SamlIdpMetadataUploaded == nil { + return nil, false + } + return o.SamlIdpMetadataUploaded, true +} + +// HasSamlIdpMetadataUploaded returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlIdpMetadataUploaded() bool { + if o != nil && o.SamlIdpMetadataUploaded != nil { + return true + } + + return false +} + +// SetSamlIdpMetadataUploaded gets a reference to the given bool and assigns it to the SamlIdpMetadataUploaded field. +func (o *OrganizationSettings) SetSamlIdpMetadataUploaded(v bool) { + o.SamlIdpMetadataUploaded = &v +} + +// GetSamlLoginUrl returns the SamlLoginUrl field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlLoginUrl() string { + if o == nil || o.SamlLoginUrl == nil { + var ret string + return ret + } + return *o.SamlLoginUrl +} + +// GetSamlLoginUrlOk returns a tuple with the SamlLoginUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlLoginUrlOk() (*string, bool) { + if o == nil || o.SamlLoginUrl == nil { + return nil, false + } + return o.SamlLoginUrl, true +} + +// HasSamlLoginUrl returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlLoginUrl() bool { + if o != nil && o.SamlLoginUrl != nil { + return true + } + + return false +} + +// SetSamlLoginUrl gets a reference to the given string and assigns it to the SamlLoginUrl field. +func (o *OrganizationSettings) SetSamlLoginUrl(v string) { + o.SamlLoginUrl = &v +} + +// GetSamlStrictMode returns the SamlStrictMode field value if set, zero value otherwise. +func (o *OrganizationSettings) GetSamlStrictMode() OrganizationSettingsSamlStrictMode { + if o == nil || o.SamlStrictMode == nil { + var ret OrganizationSettingsSamlStrictMode + return ret + } + return *o.SamlStrictMode +} + +// GetSamlStrictModeOk returns a tuple with the SamlStrictMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettings) GetSamlStrictModeOk() (*OrganizationSettingsSamlStrictMode, bool) { + if o == nil || o.SamlStrictMode == nil { + return nil, false + } + return o.SamlStrictMode, true +} + +// HasSamlStrictMode returns a boolean if a field has been set. +func (o *OrganizationSettings) HasSamlStrictMode() bool { + if o != nil && o.SamlStrictMode != nil { + return true + } + + return false +} + +// SetSamlStrictMode gets a reference to the given OrganizationSettingsSamlStrictMode and assigns it to the SamlStrictMode field. +func (o *OrganizationSettings) SetSamlStrictMode(v OrganizationSettingsSamlStrictMode) { + o.SamlStrictMode = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationSettings) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PrivateWidgetShare != nil { + toSerialize["private_widget_share"] = o.PrivateWidgetShare + } + if o.Saml != nil { + toSerialize["saml"] = o.Saml + } + if o.SamlAutocreateAccessRole != nil { + toSerialize["saml_autocreate_access_role"] = o.SamlAutocreateAccessRole + } + if o.SamlAutocreateUsersDomains != nil { + toSerialize["saml_autocreate_users_domains"] = o.SamlAutocreateUsersDomains + } + if o.SamlCanBeEnabled != nil { + toSerialize["saml_can_be_enabled"] = o.SamlCanBeEnabled + } + if o.SamlIdpEndpoint != nil { + toSerialize["saml_idp_endpoint"] = o.SamlIdpEndpoint + } + if o.SamlIdpInitiatedLogin != nil { + toSerialize["saml_idp_initiated_login"] = o.SamlIdpInitiatedLogin + } + if o.SamlIdpMetadataUploaded != nil { + toSerialize["saml_idp_metadata_uploaded"] = o.SamlIdpMetadataUploaded + } + if o.SamlLoginUrl != nil { + toSerialize["saml_login_url"] = o.SamlLoginUrl + } + if o.SamlStrictMode != nil { + toSerialize["saml_strict_mode"] = o.SamlStrictMode + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationSettings) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PrivateWidgetShare *bool `json:"private_widget_share,omitempty"` + Saml *OrganizationSettingsSaml `json:"saml,omitempty"` + SamlAutocreateAccessRole *AccessRole `json:"saml_autocreate_access_role,omitempty"` + SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"` + SamlCanBeEnabled *bool `json:"saml_can_be_enabled,omitempty"` + SamlIdpEndpoint *string `json:"saml_idp_endpoint,omitempty"` + SamlIdpInitiatedLogin *OrganizationSettingsSamlIdpInitiatedLogin `json:"saml_idp_initiated_login,omitempty"` + SamlIdpMetadataUploaded *bool `json:"saml_idp_metadata_uploaded,omitempty"` + SamlLoginUrl *string `json:"saml_login_url,omitempty"` + SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.SamlAutocreateAccessRole; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PrivateWidgetShare = all.PrivateWidgetShare + if all.Saml != nil && all.Saml.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Saml = all.Saml + o.SamlAutocreateAccessRole = all.SamlAutocreateAccessRole + if all.SamlAutocreateUsersDomains != nil && all.SamlAutocreateUsersDomains.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SamlAutocreateUsersDomains = all.SamlAutocreateUsersDomains + o.SamlCanBeEnabled = all.SamlCanBeEnabled + o.SamlIdpEndpoint = all.SamlIdpEndpoint + if all.SamlIdpInitiatedLogin != nil && all.SamlIdpInitiatedLogin.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SamlIdpInitiatedLogin = all.SamlIdpInitiatedLogin + o.SamlIdpMetadataUploaded = all.SamlIdpMetadataUploaded + o.SamlLoginUrl = all.SamlLoginUrl + if all.SamlStrictMode != nil && all.SamlStrictMode.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SamlStrictMode = all.SamlStrictMode + return nil +} diff --git a/api/v1/datadog/model_organization_settings_saml.go b/api/v1/datadog/model_organization_settings_saml.go new file mode 100644 index 00000000000..019e3b7972f --- /dev/null +++ b/api/v1/datadog/model_organization_settings_saml.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// OrganizationSettingsSaml Set the boolean property enabled to enable or disable single sign on with SAML. +// See the SAML documentation for more information about all SAML settings. +type OrganizationSettingsSaml struct { + // Whether or not SAML is enabled for this organization. + Enabled *bool `json:"enabled,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{} +} + +// NewOrganizationSettingsSaml instantiates a new OrganizationSettingsSaml 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 NewOrganizationSettingsSaml() *OrganizationSettingsSaml { + this := OrganizationSettingsSaml{} + return &this +} + +// NewOrganizationSettingsSamlWithDefaults instantiates a new OrganizationSettingsSaml 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 NewOrganizationSettingsSamlWithDefaults() *OrganizationSettingsSaml { + this := OrganizationSettingsSaml{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *OrganizationSettingsSaml) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettingsSaml) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *OrganizationSettingsSaml) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *OrganizationSettingsSaml) SetEnabled(v bool) { + o.Enabled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationSettingsSaml) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationSettingsSaml) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Enabled *bool `json:"enabled,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Enabled = all.Enabled + return nil +} diff --git a/api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go b/api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go new file mode 100644 index 00000000000..89929305b44 --- /dev/null +++ b/api/v1/datadog/model_organization_settings_saml_autocreate_users_domains.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// OrganizationSettingsSamlAutocreateUsersDomains Has two properties, `enabled` (boolean) and `domains`, which is a list of domains without the @ symbol. +type OrganizationSettingsSamlAutocreateUsersDomains struct { + // List of domains where the SAML automated user creation is enabled. + Domains []string `json:"domains,omitempty"` + // Whether or not the automated user creation based on SAML domain is enabled. + Enabled *bool `json:"enabled,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{} +} + +// NewOrganizationSettingsSamlAutocreateUsersDomains instantiates a new OrganizationSettingsSamlAutocreateUsersDomains 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 NewOrganizationSettingsSamlAutocreateUsersDomains() *OrganizationSettingsSamlAutocreateUsersDomains { + this := OrganizationSettingsSamlAutocreateUsersDomains{} + return &this +} + +// NewOrganizationSettingsSamlAutocreateUsersDomainsWithDefaults instantiates a new OrganizationSettingsSamlAutocreateUsersDomains 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 NewOrganizationSettingsSamlAutocreateUsersDomainsWithDefaults() *OrganizationSettingsSamlAutocreateUsersDomains { + this := OrganizationSettingsSamlAutocreateUsersDomains{} + return &this +} + +// GetDomains returns the Domains field value if set, zero value otherwise. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetDomains() []string { + if o == nil || o.Domains == nil { + var ret []string + return ret + } + return o.Domains +} + +// GetDomainsOk returns a tuple with the Domains field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetDomainsOk() (*[]string, bool) { + if o == nil || o.Domains == nil { + return nil, false + } + return &o.Domains, true +} + +// HasDomains returns a boolean if a field has been set. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) HasDomains() bool { + if o != nil && o.Domains != nil { + return true + } + + return false +} + +// SetDomains gets a reference to the given []string and assigns it to the Domains field. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) SetDomains(v []string) { + o.Domains = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) SetEnabled(v bool) { + o.Enabled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationSettingsSamlAutocreateUsersDomains) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Domains != nil { + toSerialize["domains"] = o.Domains + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationSettingsSamlAutocreateUsersDomains) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Domains []string `json:"domains,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Domains = all.Domains + o.Enabled = all.Enabled + return nil +} diff --git a/api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go b/api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go new file mode 100644 index 00000000000..4487833b511 --- /dev/null +++ b/api/v1/datadog/model_organization_settings_saml_idp_initiated_login.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// OrganizationSettingsSamlIdpInitiatedLogin Has one property enabled (boolean). +type OrganizationSettingsSamlIdpInitiatedLogin struct { + // Whether SAML IdP initiated login is enabled, learn more + // in the [SAML documentation](https://docs.datadoghq.com/account_management/saml/#idp-initiated-login). + Enabled *bool `json:"enabled,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{} +} + +// NewOrganizationSettingsSamlIdpInitiatedLogin instantiates a new OrganizationSettingsSamlIdpInitiatedLogin 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 NewOrganizationSettingsSamlIdpInitiatedLogin() *OrganizationSettingsSamlIdpInitiatedLogin { + this := OrganizationSettingsSamlIdpInitiatedLogin{} + return &this +} + +// NewOrganizationSettingsSamlIdpInitiatedLoginWithDefaults instantiates a new OrganizationSettingsSamlIdpInitiatedLogin 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 NewOrganizationSettingsSamlIdpInitiatedLoginWithDefaults() *OrganizationSettingsSamlIdpInitiatedLogin { + this := OrganizationSettingsSamlIdpInitiatedLogin{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *OrganizationSettingsSamlIdpInitiatedLogin) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettingsSamlIdpInitiatedLogin) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *OrganizationSettingsSamlIdpInitiatedLogin) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *OrganizationSettingsSamlIdpInitiatedLogin) SetEnabled(v bool) { + o.Enabled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationSettingsSamlIdpInitiatedLogin) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationSettingsSamlIdpInitiatedLogin) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Enabled *bool `json:"enabled,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Enabled = all.Enabled + return nil +} diff --git a/api/v1/datadog/model_organization_settings_saml_strict_mode.go b/api/v1/datadog/model_organization_settings_saml_strict_mode.go new file mode 100644 index 00000000000..cbcb665b86b --- /dev/null +++ b/api/v1/datadog/model_organization_settings_saml_strict_mode.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// OrganizationSettingsSamlStrictMode Has one property enabled (boolean). +type OrganizationSettingsSamlStrictMode struct { + // Whether or not the SAML strict mode is enabled. If true, all users must log in with SAML. + // Learn more on the [SAML Strict documentation](https://docs.datadoghq.com/account_management/saml/#saml-strict). + Enabled *bool `json:"enabled,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{} +} + +// NewOrganizationSettingsSamlStrictMode instantiates a new OrganizationSettingsSamlStrictMode 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 NewOrganizationSettingsSamlStrictMode() *OrganizationSettingsSamlStrictMode { + this := OrganizationSettingsSamlStrictMode{} + return &this +} + +// NewOrganizationSettingsSamlStrictModeWithDefaults instantiates a new OrganizationSettingsSamlStrictMode 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 NewOrganizationSettingsSamlStrictModeWithDefaults() *OrganizationSettingsSamlStrictMode { + this := OrganizationSettingsSamlStrictMode{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *OrganizationSettingsSamlStrictMode) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSettingsSamlStrictMode) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *OrganizationSettingsSamlStrictMode) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *OrganizationSettingsSamlStrictMode) SetEnabled(v bool) { + o.Enabled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationSettingsSamlStrictMode) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationSettingsSamlStrictMode) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Enabled *bool `json:"enabled,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Enabled = all.Enabled + return nil +} diff --git a/api/v1/datadog/model_organization_subscription.go b/api/v1/datadog/model_organization_subscription.go new file mode 100644 index 00000000000..e8d78b1c6db --- /dev/null +++ b/api/v1/datadog/model_organization_subscription.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 datadog + +import ( + "encoding/json" +) + +// OrganizationSubscription Subscription definition. +type OrganizationSubscription struct { + // The subscription type. Types available are `trial`, `free`, and `pro`. + Type *string `json:"type,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{} +} + +// NewOrganizationSubscription instantiates a new OrganizationSubscription 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 NewOrganizationSubscription() *OrganizationSubscription { + this := OrganizationSubscription{} + return &this +} + +// NewOrganizationSubscriptionWithDefaults instantiates a new OrganizationSubscription 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 NewOrganizationSubscriptionWithDefaults() *OrganizationSubscription { + this := OrganizationSubscription{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *OrganizationSubscription) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationSubscription) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *OrganizationSubscription) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *OrganizationSubscription) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationSubscription) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationSubscription) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_pager_duty_service.go b/api/v1/datadog/model_pager_duty_service.go new file mode 100644 index 00000000000..f05a0e088df --- /dev/null +++ b/api/v1/datadog/model_pager_duty_service.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// PagerDutyService The PagerDuty service that is available for integration with Datadog. +type PagerDutyService struct { + // Your service key in PagerDuty. + ServiceKey string `json:"service_key"` + // Your service name associated with a service key in PagerDuty. + ServiceName string `json:"service_name"` + // 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{} +} + +// NewPagerDutyService instantiates a new PagerDutyService 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 NewPagerDutyService(serviceKey string, serviceName string) *PagerDutyService { + this := PagerDutyService{} + this.ServiceKey = serviceKey + this.ServiceName = serviceName + return &this +} + +// NewPagerDutyServiceWithDefaults instantiates a new PagerDutyService 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 NewPagerDutyServiceWithDefaults() *PagerDutyService { + this := PagerDutyService{} + return &this +} + +// GetServiceKey returns the ServiceKey field value. +func (o *PagerDutyService) GetServiceKey() string { + if o == nil { + var ret string + return ret + } + return o.ServiceKey +} + +// GetServiceKeyOk returns a tuple with the ServiceKey field value +// and a boolean to check if the value has been set. +func (o *PagerDutyService) GetServiceKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceKey, true +} + +// SetServiceKey sets field value. +func (o *PagerDutyService) SetServiceKey(v string) { + o.ServiceKey = v +} + +// GetServiceName returns the ServiceName field value. +func (o *PagerDutyService) GetServiceName() string { + if o == nil { + var ret string + return ret + } + return o.ServiceName +} + +// GetServiceNameOk returns a tuple with the ServiceName field value +// and a boolean to check if the value has been set. +func (o *PagerDutyService) GetServiceNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceName, true +} + +// SetServiceName sets field value. +func (o *PagerDutyService) SetServiceName(v string) { + o.ServiceName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PagerDutyService) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["service_key"] = o.ServiceKey + toSerialize["service_name"] = o.ServiceName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PagerDutyService) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ServiceKey *string `json:"service_key"` + ServiceName *string `json:"service_name"` + }{} + all := struct { + ServiceKey string `json:"service_key"` + ServiceName string `json:"service_name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ServiceKey == nil { + return fmt.Errorf("Required field service_key missing") + } + if required.ServiceName == nil { + return fmt.Errorf("Required field service_name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ServiceKey = all.ServiceKey + o.ServiceName = all.ServiceName + return nil +} diff --git a/api/v1/datadog/model_pager_duty_service_key.go b/api/v1/datadog/model_pager_duty_service_key.go new file mode 100644 index 00000000000..408a847cb00 --- /dev/null +++ b/api/v1/datadog/model_pager_duty_service_key.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// PagerDutyServiceKey PagerDuty service object key. +type PagerDutyServiceKey struct { + // Your service key in PagerDuty. + ServiceKey string `json:"service_key"` + // 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{} +} + +// NewPagerDutyServiceKey instantiates a new PagerDutyServiceKey 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 NewPagerDutyServiceKey(serviceKey string) *PagerDutyServiceKey { + this := PagerDutyServiceKey{} + this.ServiceKey = serviceKey + return &this +} + +// NewPagerDutyServiceKeyWithDefaults instantiates a new PagerDutyServiceKey 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 NewPagerDutyServiceKeyWithDefaults() *PagerDutyServiceKey { + this := PagerDutyServiceKey{} + return &this +} + +// GetServiceKey returns the ServiceKey field value. +func (o *PagerDutyServiceKey) GetServiceKey() string { + if o == nil { + var ret string + return ret + } + return o.ServiceKey +} + +// GetServiceKeyOk returns a tuple with the ServiceKey field value +// and a boolean to check if the value has been set. +func (o *PagerDutyServiceKey) GetServiceKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceKey, true +} + +// SetServiceKey sets field value. +func (o *PagerDutyServiceKey) SetServiceKey(v string) { + o.ServiceKey = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PagerDutyServiceKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["service_key"] = o.ServiceKey + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PagerDutyServiceKey) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ServiceKey *string `json:"service_key"` + }{} + all := struct { + ServiceKey string `json:"service_key"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ServiceKey == nil { + return fmt.Errorf("Required field service_key missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ServiceKey = all.ServiceKey + return nil +} diff --git a/api/v1/datadog/model_pager_duty_service_name.go b/api/v1/datadog/model_pager_duty_service_name.go new file mode 100644 index 00000000000..ecae71ce9e1 --- /dev/null +++ b/api/v1/datadog/model_pager_duty_service_name.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// PagerDutyServiceName PagerDuty service object name. +type PagerDutyServiceName struct { + // Your service name associated service key in PagerDuty. + ServiceName string `json:"service_name"` + // 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{} +} + +// NewPagerDutyServiceName instantiates a new PagerDutyServiceName 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 NewPagerDutyServiceName(serviceName string) *PagerDutyServiceName { + this := PagerDutyServiceName{} + this.ServiceName = serviceName + return &this +} + +// NewPagerDutyServiceNameWithDefaults instantiates a new PagerDutyServiceName 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 NewPagerDutyServiceNameWithDefaults() *PagerDutyServiceName { + this := PagerDutyServiceName{} + return &this +} + +// GetServiceName returns the ServiceName field value. +func (o *PagerDutyServiceName) GetServiceName() string { + if o == nil { + var ret string + return ret + } + return o.ServiceName +} + +// GetServiceNameOk returns a tuple with the ServiceName field value +// and a boolean to check if the value has been set. +func (o *PagerDutyServiceName) GetServiceNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceName, true +} + +// SetServiceName sets field value. +func (o *PagerDutyServiceName) SetServiceName(v string) { + o.ServiceName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PagerDutyServiceName) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["service_name"] = o.ServiceName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PagerDutyServiceName) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ServiceName *string `json:"service_name"` + }{} + all := struct { + ServiceName string `json:"service_name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ServiceName == nil { + return fmt.Errorf("Required field service_name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ServiceName = all.ServiceName + return nil +} diff --git a/api/v1/datadog/model_pagination.go b/api/v1/datadog/model_pagination.go new file mode 100644 index 00000000000..8993857c687 --- /dev/null +++ b/api/v1/datadog/model_pagination.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Pagination Pagination object. +type Pagination struct { + // Total count. + TotalCount *int64 `json:"total_count,omitempty"` + // Total count of elements matched by the filter. + 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{} +} + +// NewPagination instantiates a new Pagination 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 NewPagination() *Pagination { + this := Pagination{} + return &this +} + +// NewPaginationWithDefaults instantiates a new Pagination 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 NewPaginationWithDefaults() *Pagination { + this := Pagination{} + return &this +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *Pagination) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pagination) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *Pagination) HasTotalCount() bool { + if o != nil && o.TotalCount != nil { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *Pagination) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *Pagination) 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 *Pagination) 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 *Pagination) HasTotalFilteredCount() bool { + if o != nil && o.TotalFilteredCount != nil { + return true + } + + return false +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *Pagination) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Pagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TotalCount *int64 `json:"total_count,omitempty"` + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TotalCount = all.TotalCount + o.TotalFilteredCount = all.TotalFilteredCount + return nil +} diff --git a/api/v1/datadog/model_process_query_definition.go b/api/v1/datadog/model_process_query_definition.go new file mode 100644 index 00000000000..6c57c410f1b --- /dev/null +++ b/api/v1/datadog/model_process_query_definition.go @@ -0,0 +1,220 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ProcessQueryDefinition The process query to use in the widget. +type ProcessQueryDefinition struct { + // List of processes. + FilterBy []string `json:"filter_by,omitempty"` + // Max number of items in the filter list. + Limit *int64 `json:"limit,omitempty"` + // Your chosen metric. + Metric string `json:"metric"` + // Your chosen search term. + SearchBy *string `json:"search_by,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{} +} + +// NewProcessQueryDefinition instantiates a new ProcessQueryDefinition 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 NewProcessQueryDefinition(metric string) *ProcessQueryDefinition { + this := ProcessQueryDefinition{} + this.Metric = metric + return &this +} + +// NewProcessQueryDefinitionWithDefaults instantiates a new ProcessQueryDefinition 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 NewProcessQueryDefinitionWithDefaults() *ProcessQueryDefinition { + this := ProcessQueryDefinition{} + return &this +} + +// GetFilterBy returns the FilterBy field value if set, zero value otherwise. +func (o *ProcessQueryDefinition) GetFilterBy() []string { + if o == nil || o.FilterBy == nil { + var ret []string + return ret + } + return o.FilterBy +} + +// GetFilterByOk returns a tuple with the FilterBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessQueryDefinition) GetFilterByOk() (*[]string, bool) { + if o == nil || o.FilterBy == nil { + return nil, false + } + return &o.FilterBy, true +} + +// HasFilterBy returns a boolean if a field has been set. +func (o *ProcessQueryDefinition) HasFilterBy() bool { + if o != nil && o.FilterBy != nil { + return true + } + + return false +} + +// SetFilterBy gets a reference to the given []string and assigns it to the FilterBy field. +func (o *ProcessQueryDefinition) SetFilterBy(v []string) { + o.FilterBy = v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *ProcessQueryDefinition) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessQueryDefinition) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *ProcessQueryDefinition) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *ProcessQueryDefinition) SetLimit(v int64) { + o.Limit = &v +} + +// GetMetric returns the Metric field value. +func (o *ProcessQueryDefinition) GetMetric() string { + if o == nil { + var ret string + return ret + } + return o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value +// and a boolean to check if the value has been set. +func (o *ProcessQueryDefinition) GetMetricOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metric, true +} + +// SetMetric sets field value. +func (o *ProcessQueryDefinition) SetMetric(v string) { + o.Metric = v +} + +// GetSearchBy returns the SearchBy field value if set, zero value otherwise. +func (o *ProcessQueryDefinition) GetSearchBy() string { + if o == nil || o.SearchBy == nil { + var ret string + return ret + } + return *o.SearchBy +} + +// GetSearchByOk returns a tuple with the SearchBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessQueryDefinition) GetSearchByOk() (*string, bool) { + if o == nil || o.SearchBy == nil { + return nil, false + } + return o.SearchBy, true +} + +// HasSearchBy returns a boolean if a field has been set. +func (o *ProcessQueryDefinition) HasSearchBy() bool { + if o != nil && o.SearchBy != nil { + return true + } + + return false +} + +// SetSearchBy gets a reference to the given string and assigns it to the SearchBy field. +func (o *ProcessQueryDefinition) SetSearchBy(v string) { + o.SearchBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProcessQueryDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.FilterBy != nil { + toSerialize["filter_by"] = o.FilterBy + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + toSerialize["metric"] = o.Metric + if o.SearchBy != nil { + toSerialize["search_by"] = o.SearchBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Metric *string `json:"metric"` + }{} + all := struct { + FilterBy []string `json:"filter_by,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Metric string `json:"metric"` + SearchBy *string `json:"search_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Metric == nil { + return fmt.Errorf("Required field metric missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.FilterBy = all.FilterBy + o.Limit = all.Limit + o.Metric = all.Metric + o.SearchBy = all.SearchBy + return nil +} diff --git a/api/v1/datadog/model_query_sort_order.go b/api/v1/datadog/model_query_sort_order.go new file mode 100644 index 00000000000..8074bfd22e3 --- /dev/null +++ b/api/v1/datadog/model_query_sort_order.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// QuerySortOrder Direction of sort. +type QuerySortOrder string + +// List of QuerySortOrder. +const ( + QUERYSORTORDER_ASC QuerySortOrder = "asc" + QUERYSORTORDER_DESC QuerySortOrder = "desc" +) + +var allowedQuerySortOrderEnumValues = []QuerySortOrder{ + QUERYSORTORDER_ASC, + QUERYSORTORDER_DESC, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *QuerySortOrder) GetAllowedValues() []QuerySortOrder { + return allowedQuerySortOrderEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *QuerySortOrder) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = QuerySortOrder(value) + return nil +} + +// NewQuerySortOrderFromValue returns a pointer to a valid QuerySortOrder +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewQuerySortOrderFromValue(v string) (*QuerySortOrder, error) { + ev := QuerySortOrder(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for QuerySortOrder: valid values are %v", v, allowedQuerySortOrderEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v QuerySortOrder) IsValid() bool { + for _, existing := range allowedQuerySortOrderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to QuerySortOrder value. +func (v QuerySortOrder) Ptr() *QuerySortOrder { + return &v +} + +// NullableQuerySortOrder handles when a null is used for QuerySortOrder. +type NullableQuerySortOrder struct { + value *QuerySortOrder + isSet bool +} + +// Get returns the associated value. +func (v NullableQuerySortOrder) Get() *QuerySortOrder { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableQuerySortOrder) Set(val *QuerySortOrder) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableQuerySortOrder) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableQuerySortOrder) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableQuerySortOrder initializes the struct as if Set has been called. +func NewNullableQuerySortOrder(val *QuerySortOrder) *NullableQuerySortOrder { + return &NullableQuerySortOrder{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableQuerySortOrder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableQuerySortOrder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_query_value_widget_definition.go b/api/v1/datadog/model_query_value_widget_definition.go new file mode 100644 index 00000000000..dfda3d8125e --- /dev/null +++ b/api/v1/datadog/model_query_value_widget_definition.go @@ -0,0 +1,566 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// QueryValueWidgetDefinition Query values display the current value of a given metric, APM, or log query. +type QueryValueWidgetDefinition struct { + // Whether to use auto-scaling or not. + Autoscale *bool `json:"autoscale,omitempty"` + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // Display a unit of your choice on the widget. + CustomUnit *string `json:"custom_unit,omitempty"` + // Number of decimals to show. If not defined, the widget uses the raw value. + Precision *int64 `json:"precision,omitempty"` + // Widget definition. + Requests []QueryValueWidgetRequest `json:"requests"` + // How to align the text on the widget. + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Set a timeseries on the widget background. + TimeseriesBackground *TimeseriesBackground `json:"timeseries_background,omitempty"` + // Title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the query value widget. + Type QueryValueWidgetDefinitionType `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{} +} + +// NewQueryValueWidgetDefinition instantiates a new QueryValueWidgetDefinition 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 NewQueryValueWidgetDefinition(requests []QueryValueWidgetRequest, typeVar QueryValueWidgetDefinitionType) *QueryValueWidgetDefinition { + this := QueryValueWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewQueryValueWidgetDefinitionWithDefaults instantiates a new QueryValueWidgetDefinition 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 NewQueryValueWidgetDefinitionWithDefaults() *QueryValueWidgetDefinition { + this := QueryValueWidgetDefinition{} + var typeVar QueryValueWidgetDefinitionType = QUERYVALUEWIDGETDEFINITIONTYPE_QUERY_VALUE + this.Type = typeVar + return &this +} + +// GetAutoscale returns the Autoscale field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetAutoscale() bool { + if o == nil || o.Autoscale == nil { + var ret bool + return ret + } + return *o.Autoscale +} + +// GetAutoscaleOk returns a tuple with the Autoscale field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetAutoscaleOk() (*bool, bool) { + if o == nil || o.Autoscale == nil { + return nil, false + } + return o.Autoscale, true +} + +// HasAutoscale returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasAutoscale() bool { + if o != nil && o.Autoscale != nil { + return true + } + + return false +} + +// SetAutoscale gets a reference to the given bool and assigns it to the Autoscale field. +func (o *QueryValueWidgetDefinition) SetAutoscale(v bool) { + o.Autoscale = &v +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *QueryValueWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetCustomUnit returns the CustomUnit field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetCustomUnit() string { + if o == nil || o.CustomUnit == nil { + var ret string + return ret + } + return *o.CustomUnit +} + +// GetCustomUnitOk returns a tuple with the CustomUnit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetCustomUnitOk() (*string, bool) { + if o == nil || o.CustomUnit == nil { + return nil, false + } + return o.CustomUnit, true +} + +// HasCustomUnit returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasCustomUnit() bool { + if o != nil && o.CustomUnit != nil { + return true + } + + return false +} + +// SetCustomUnit gets a reference to the given string and assigns it to the CustomUnit field. +func (o *QueryValueWidgetDefinition) SetCustomUnit(v string) { + o.CustomUnit = &v +} + +// GetPrecision returns the Precision field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetPrecision() int64 { + if o == nil || o.Precision == nil { + var ret int64 + return ret + } + return *o.Precision +} + +// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetPrecisionOk() (*int64, bool) { + if o == nil || o.Precision == nil { + return nil, false + } + return o.Precision, true +} + +// HasPrecision returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasPrecision() bool { + if o != nil && o.Precision != nil { + return true + } + + return false +} + +// SetPrecision gets a reference to the given int64 and assigns it to the Precision field. +func (o *QueryValueWidgetDefinition) SetPrecision(v int64) { + o.Precision = &v +} + +// GetRequests returns the Requests field value. +func (o *QueryValueWidgetDefinition) GetRequests() []QueryValueWidgetRequest { + if o == nil { + var ret []QueryValueWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetRequestsOk() (*[]QueryValueWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *QueryValueWidgetDefinition) SetRequests(v []QueryValueWidgetRequest) { + o.Requests = v +} + +// GetTextAlign returns the TextAlign field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetTextAlign() WidgetTextAlign { + if o == nil || o.TextAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TextAlign +} + +// GetTextAlignOk returns a tuple with the TextAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetTextAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TextAlign == nil { + return nil, false + } + return o.TextAlign, true +} + +// HasTextAlign returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasTextAlign() bool { + if o != nil && o.TextAlign != nil { + return true + } + + return false +} + +// SetTextAlign gets a reference to the given WidgetTextAlign and assigns it to the TextAlign field. +func (o *QueryValueWidgetDefinition) SetTextAlign(v WidgetTextAlign) { + o.TextAlign = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *QueryValueWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTimeseriesBackground returns the TimeseriesBackground field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetTimeseriesBackground() TimeseriesBackground { + if o == nil || o.TimeseriesBackground == nil { + var ret TimeseriesBackground + return ret + } + return *o.TimeseriesBackground +} + +// GetTimeseriesBackgroundOk returns a tuple with the TimeseriesBackground field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetTimeseriesBackgroundOk() (*TimeseriesBackground, bool) { + if o == nil || o.TimeseriesBackground == nil { + return nil, false + } + return o.TimeseriesBackground, true +} + +// HasTimeseriesBackground returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasTimeseriesBackground() bool { + if o != nil && o.TimeseriesBackground != nil { + return true + } + + return false +} + +// SetTimeseriesBackground gets a reference to the given TimeseriesBackground and assigns it to the TimeseriesBackground field. +func (o *QueryValueWidgetDefinition) SetTimeseriesBackground(v TimeseriesBackground) { + o.TimeseriesBackground = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *QueryValueWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *QueryValueWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *QueryValueWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *QueryValueWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *QueryValueWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *QueryValueWidgetDefinition) GetType() QueryValueWidgetDefinitionType { + if o == nil { + var ret QueryValueWidgetDefinitionType + 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 *QueryValueWidgetDefinition) GetTypeOk() (*QueryValueWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *QueryValueWidgetDefinition) SetType(v QueryValueWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o QueryValueWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Autoscale != nil { + toSerialize["autoscale"] = o.Autoscale + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + if o.CustomUnit != nil { + toSerialize["custom_unit"] = o.CustomUnit + } + if o.Precision != nil { + toSerialize["precision"] = o.Precision + } + toSerialize["requests"] = o.Requests + if o.TextAlign != nil { + toSerialize["text_align"] = o.TextAlign + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.TimeseriesBackground != nil { + toSerialize["timeseries_background"] = o.TimeseriesBackground + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]QueryValueWidgetRequest `json:"requests"` + Type *QueryValueWidgetDefinitionType `json:"type"` + }{} + all := struct { + Autoscale *bool `json:"autoscale,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + CustomUnit *string `json:"custom_unit,omitempty"` + Precision *int64 `json:"precision,omitempty"` + Requests []QueryValueWidgetRequest `json:"requests"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + TimeseriesBackground *TimeseriesBackground `json:"timeseries_background,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type QueryValueWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TextAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Autoscale = all.Autoscale + o.CustomLinks = all.CustomLinks + o.CustomUnit = all.CustomUnit + o.Precision = all.Precision + o.Requests = all.Requests + o.TextAlign = all.TextAlign + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + if all.TimeseriesBackground != nil && all.TimeseriesBackground.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.TimeseriesBackground = all.TimeseriesBackground + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_query_value_widget_definition_type.go b/api/v1/datadog/model_query_value_widget_definition_type.go new file mode 100644 index 00000000000..afa74ec0c91 --- /dev/null +++ b/api/v1/datadog/model_query_value_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// QueryValueWidgetDefinitionType Type of the query value widget. +type QueryValueWidgetDefinitionType string + +// List of QueryValueWidgetDefinitionType. +const ( + QUERYVALUEWIDGETDEFINITIONTYPE_QUERY_VALUE QueryValueWidgetDefinitionType = "query_value" +) + +var allowedQueryValueWidgetDefinitionTypeEnumValues = []QueryValueWidgetDefinitionType{ + QUERYVALUEWIDGETDEFINITIONTYPE_QUERY_VALUE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *QueryValueWidgetDefinitionType) GetAllowedValues() []QueryValueWidgetDefinitionType { + return allowedQueryValueWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *QueryValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = QueryValueWidgetDefinitionType(value) + return nil +} + +// NewQueryValueWidgetDefinitionTypeFromValue returns a pointer to a valid QueryValueWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewQueryValueWidgetDefinitionTypeFromValue(v string) (*QueryValueWidgetDefinitionType, error) { + ev := QueryValueWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for QueryValueWidgetDefinitionType: valid values are %v", v, allowedQueryValueWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v QueryValueWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedQueryValueWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to QueryValueWidgetDefinitionType value. +func (v QueryValueWidgetDefinitionType) Ptr() *QueryValueWidgetDefinitionType { + return &v +} + +// NullableQueryValueWidgetDefinitionType handles when a null is used for QueryValueWidgetDefinitionType. +type NullableQueryValueWidgetDefinitionType struct { + value *QueryValueWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableQueryValueWidgetDefinitionType) Get() *QueryValueWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableQueryValueWidgetDefinitionType) Set(val *QueryValueWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableQueryValueWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableQueryValueWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableQueryValueWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableQueryValueWidgetDefinitionType(val *QueryValueWidgetDefinitionType) *NullableQueryValueWidgetDefinitionType { + return &NullableQueryValueWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableQueryValueWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableQueryValueWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_query_value_widget_request.go b/api/v1/datadog/model_query_value_widget_request.go new file mode 100644 index 00000000000..cbe23d45554 --- /dev/null +++ b/api/v1/datadog/model_query_value_widget_request.go @@ -0,0 +1,727 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// QueryValueWidgetRequest Updated query value widget. +type QueryValueWidgetRequest struct { + // Aggregator used for the request. + Aggregator *WidgetAggregator `json:"aggregator,omitempty"` + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The log query. + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + // List of conditional formats. + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // TODO. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,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{} +} + +// NewQueryValueWidgetRequest instantiates a new QueryValueWidgetRequest 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 NewQueryValueWidgetRequest() *QueryValueWidgetRequest { + this := QueryValueWidgetRequest{} + return &this +} + +// NewQueryValueWidgetRequestWithDefaults instantiates a new QueryValueWidgetRequest 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 NewQueryValueWidgetRequestWithDefaults() *QueryValueWidgetRequest { + this := QueryValueWidgetRequest{} + return &this +} + +// GetAggregator returns the Aggregator field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetAggregator() WidgetAggregator { + if o == nil || o.Aggregator == nil { + var ret WidgetAggregator + return ret + } + return *o.Aggregator +} + +// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetAggregatorOk() (*WidgetAggregator, bool) { + if o == nil || o.Aggregator == nil { + return nil, false + } + return o.Aggregator, true +} + +// HasAggregator returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasAggregator() bool { + if o != nil && o.Aggregator != nil { + return true + } + + return false +} + +// SetAggregator gets a reference to the given WidgetAggregator and assigns it to the Aggregator field. +func (o *QueryValueWidgetRequest) SetAggregator(v WidgetAggregator) { + o.Aggregator = &v +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *QueryValueWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetAuditQuery() LogQueryDefinition { + if o == nil || o.AuditQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.AuditQuery +} + +// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.AuditQuery == nil { + return nil, false + } + return o.AuditQuery, true +} + +// HasAuditQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasAuditQuery() bool { + if o != nil && o.AuditQuery != nil { + return true + } + + return false +} + +// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. +func (o *QueryValueWidgetRequest) SetAuditQuery(v LogQueryDefinition) { + o.AuditQuery = &v +} + +// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetConditionalFormats() []WidgetConditionalFormat { + if o == nil || o.ConditionalFormats == nil { + var ret []WidgetConditionalFormat + return ret + } + return o.ConditionalFormats +} + +// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { + if o == nil || o.ConditionalFormats == nil { + return nil, false + } + return &o.ConditionalFormats, true +} + +// HasConditionalFormats returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasConditionalFormats() bool { + if o != nil && o.ConditionalFormats != nil { + return true + } + + return false +} + +// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. +func (o *QueryValueWidgetRequest) SetConditionalFormats(v []WidgetConditionalFormat) { + o.ConditionalFormats = v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *QueryValueWidgetRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *QueryValueWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *QueryValueWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *QueryValueWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *QueryValueWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *QueryValueWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *QueryValueWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *QueryValueWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *QueryValueWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *QueryValueWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *QueryValueWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryValueWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *QueryValueWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *QueryValueWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o QueryValueWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregator != nil { + toSerialize["aggregator"] = o.Aggregator + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.AuditQuery != nil { + toSerialize["audit_query"] = o.AuditQuery + } + if o.ConditionalFormats != nil { + toSerialize["conditional_formats"] = o.ConditionalFormats + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *QueryValueWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregator *WidgetAggregator `json:"aggregator,omitempty"` + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregator; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregator = all.Aggregator + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.AuditQuery = all.AuditQuery + o.ConditionalFormats = all.ConditionalFormats + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + o.Formulas = all.Formulas + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + return nil +} diff --git a/api/v1/datadog/model_response_meta_attributes.go b/api/v1/datadog/model_response_meta_attributes.go new file mode 100644 index 00000000000..40cc83c63a6 --- /dev/null +++ b/api/v1/datadog/model_response_meta_attributes.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ResponseMetaAttributes Object describing meta attributes of response. +type ResponseMetaAttributes struct { + // Pagination object. + Page *Pagination `json:"page,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{} +} + +// NewResponseMetaAttributes instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributes() *ResponseMetaAttributes { + this := ResponseMetaAttributes{} + return &this +} + +// NewResponseMetaAttributesWithDefaults instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributesWithDefaults() *ResponseMetaAttributes { + this := ResponseMetaAttributes{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *ResponseMetaAttributes) GetPage() Pagination { + if o == nil || o.Page == nil { + var ret Pagination + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResponseMetaAttributes) GetPageOk() (*Pagination, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *ResponseMetaAttributes) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given Pagination and assigns it to the Page field. +func (o *ResponseMetaAttributes) SetPage(v Pagination) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ResponseMetaAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *Pagination `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v1/datadog/model_scatter_plot_request.go b/api/v1/datadog/model_scatter_plot_request.go new file mode 100644 index 00000000000..1f0e808beaa --- /dev/null +++ b/api/v1/datadog/model_scatter_plot_request.go @@ -0,0 +1,517 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ScatterPlotRequest Updated scatter plot. +type ScatterPlotRequest struct { + // Aggregator used for the request. + Aggregator *ScatterplotWidgetAggregator `json:"aggregator,omitempty"` + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Query definition. + Q *string `json:"q,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,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{} +} + +// NewScatterPlotRequest instantiates a new ScatterPlotRequest 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 NewScatterPlotRequest() *ScatterPlotRequest { + this := ScatterPlotRequest{} + return &this +} + +// NewScatterPlotRequestWithDefaults instantiates a new ScatterPlotRequest 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 NewScatterPlotRequestWithDefaults() *ScatterPlotRequest { + this := ScatterPlotRequest{} + return &this +} + +// GetAggregator returns the Aggregator field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetAggregator() ScatterplotWidgetAggregator { + if o == nil || o.Aggregator == nil { + var ret ScatterplotWidgetAggregator + return ret + } + return *o.Aggregator +} + +// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetAggregatorOk() (*ScatterplotWidgetAggregator, bool) { + if o == nil || o.Aggregator == nil { + return nil, false + } + return o.Aggregator, true +} + +// HasAggregator returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasAggregator() bool { + if o != nil && o.Aggregator != nil { + return true + } + + return false +} + +// SetAggregator gets a reference to the given ScatterplotWidgetAggregator and assigns it to the Aggregator field. +func (o *ScatterPlotRequest) SetAggregator(v ScatterplotWidgetAggregator) { + o.Aggregator = &v +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *ScatterPlotRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *ScatterPlotRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *ScatterPlotRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *ScatterPlotRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *ScatterPlotRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *ScatterPlotRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *ScatterPlotRequest) SetQ(v string) { + o.Q = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *ScatterPlotRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *ScatterPlotRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *ScatterPlotRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *ScatterPlotRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ScatterPlotRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregator != nil { + toSerialize["aggregator"] = o.Aggregator + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ScatterPlotRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregator *ScatterplotWidgetAggregator `json:"aggregator,omitempty"` + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregator; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregator = all.Aggregator + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + return nil +} diff --git a/api/v1/datadog/model_scatter_plot_widget_definition.go b/api/v1/datadog/model_scatter_plot_widget_definition.go new file mode 100644 index 00000000000..bc0b5594d94 --- /dev/null +++ b/api/v1/datadog/model_scatter_plot_widget_definition.go @@ -0,0 +1,494 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ScatterPlotWidgetDefinition The scatter plot visualization allows you to graph a chosen scope over two different metrics with their respective aggregation. +type ScatterPlotWidgetDefinition struct { + // List of groups used for colors. + ColorByGroups []string `json:"color_by_groups,omitempty"` + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // Widget definition. + Requests ScatterPlotWidgetDefinitionRequests `json:"requests"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the scatter plot widget. + Type ScatterPlotWidgetDefinitionType `json:"type"` + // Axis controls for the widget. + Xaxis *WidgetAxis `json:"xaxis,omitempty"` + // Axis controls for the widget. + Yaxis *WidgetAxis `json:"yaxis,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{} +} + +// NewScatterPlotWidgetDefinition instantiates a new ScatterPlotWidgetDefinition 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 NewScatterPlotWidgetDefinition(requests ScatterPlotWidgetDefinitionRequests, typeVar ScatterPlotWidgetDefinitionType) *ScatterPlotWidgetDefinition { + this := ScatterPlotWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewScatterPlotWidgetDefinitionWithDefaults instantiates a new ScatterPlotWidgetDefinition 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 NewScatterPlotWidgetDefinitionWithDefaults() *ScatterPlotWidgetDefinition { + this := ScatterPlotWidgetDefinition{} + var typeVar ScatterPlotWidgetDefinitionType = SCATTERPLOTWIDGETDEFINITIONTYPE_SCATTERPLOT + this.Type = typeVar + return &this +} + +// GetColorByGroups returns the ColorByGroups field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetColorByGroups() []string { + if o == nil || o.ColorByGroups == nil { + var ret []string + return ret + } + return o.ColorByGroups +} + +// GetColorByGroupsOk returns a tuple with the ColorByGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetColorByGroupsOk() (*[]string, bool) { + if o == nil || o.ColorByGroups == nil { + return nil, false + } + return &o.ColorByGroups, true +} + +// HasColorByGroups returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasColorByGroups() bool { + if o != nil && o.ColorByGroups != nil { + return true + } + + return false +} + +// SetColorByGroups gets a reference to the given []string and assigns it to the ColorByGroups field. +func (o *ScatterPlotWidgetDefinition) SetColorByGroups(v []string) { + o.ColorByGroups = v +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *ScatterPlotWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetRequests returns the Requests field value. +func (o *ScatterPlotWidgetDefinition) GetRequests() ScatterPlotWidgetDefinitionRequests { + if o == nil { + var ret ScatterPlotWidgetDefinitionRequests + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetRequestsOk() (*ScatterPlotWidgetDefinitionRequests, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *ScatterPlotWidgetDefinition) SetRequests(v ScatterPlotWidgetDefinitionRequests) { + o.Requests = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *ScatterPlotWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *ScatterPlotWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *ScatterPlotWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *ScatterPlotWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *ScatterPlotWidgetDefinition) GetType() ScatterPlotWidgetDefinitionType { + if o == nil { + var ret ScatterPlotWidgetDefinitionType + 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 *ScatterPlotWidgetDefinition) GetTypeOk() (*ScatterPlotWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ScatterPlotWidgetDefinition) SetType(v ScatterPlotWidgetDefinitionType) { + o.Type = v +} + +// GetXaxis returns the Xaxis field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetXaxis() WidgetAxis { + if o == nil || o.Xaxis == nil { + var ret WidgetAxis + return ret + } + return *o.Xaxis +} + +// GetXaxisOk returns a tuple with the Xaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetXaxisOk() (*WidgetAxis, bool) { + if o == nil || o.Xaxis == nil { + return nil, false + } + return o.Xaxis, true +} + +// HasXaxis returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasXaxis() bool { + if o != nil && o.Xaxis != nil { + return true + } + + return false +} + +// SetXaxis gets a reference to the given WidgetAxis and assigns it to the Xaxis field. +func (o *ScatterPlotWidgetDefinition) SetXaxis(v WidgetAxis) { + o.Xaxis = &v +} + +// GetYaxis returns the Yaxis field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinition) GetYaxis() WidgetAxis { + if o == nil || o.Yaxis == nil { + var ret WidgetAxis + return ret + } + return *o.Yaxis +} + +// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinition) GetYaxisOk() (*WidgetAxis, bool) { + if o == nil || o.Yaxis == nil { + return nil, false + } + return o.Yaxis, true +} + +// HasYaxis returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinition) HasYaxis() bool { + if o != nil && o.Yaxis != nil { + return true + } + + return false +} + +// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. +func (o *ScatterPlotWidgetDefinition) SetYaxis(v WidgetAxis) { + o.Yaxis = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ScatterPlotWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ColorByGroups != nil { + toSerialize["color_by_groups"] = o.ColorByGroups + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + toSerialize["requests"] = o.Requests + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + if o.Xaxis != nil { + toSerialize["xaxis"] = o.Xaxis + } + if o.Yaxis != nil { + toSerialize["yaxis"] = o.Yaxis + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *ScatterPlotWidgetDefinitionRequests `json:"requests"` + Type *ScatterPlotWidgetDefinitionType `json:"type"` + }{} + all := struct { + ColorByGroups []string `json:"color_by_groups,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests ScatterPlotWidgetDefinitionRequests `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type ScatterPlotWidgetDefinitionType `json:"type"` + Xaxis *WidgetAxis `json:"xaxis,omitempty"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ColorByGroups = all.ColorByGroups + o.CustomLinks = all.CustomLinks + if all.Requests.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Requests = all.Requests + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Xaxis = all.Xaxis + if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Yaxis = all.Yaxis + return nil +} diff --git a/api/v1/datadog/model_scatter_plot_widget_definition_requests.go b/api/v1/datadog/model_scatter_plot_widget_definition_requests.go new file mode 100644 index 00000000000..3a19a3ab7e5 --- /dev/null +++ b/api/v1/datadog/model_scatter_plot_widget_definition_requests.go @@ -0,0 +1,201 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ScatterPlotWidgetDefinitionRequests Widget definition. +type ScatterPlotWidgetDefinitionRequests struct { + // Scatterplot request containing formulas and functions. + Table *ScatterplotTableRequest `json:"table,omitempty"` + // Updated scatter plot. + X *ScatterPlotRequest `json:"x,omitempty"` + // Updated scatter plot. + Y *ScatterPlotRequest `json:"y,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{} +} + +// NewScatterPlotWidgetDefinitionRequests instantiates a new ScatterPlotWidgetDefinitionRequests 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 NewScatterPlotWidgetDefinitionRequests() *ScatterPlotWidgetDefinitionRequests { + this := ScatterPlotWidgetDefinitionRequests{} + return &this +} + +// NewScatterPlotWidgetDefinitionRequestsWithDefaults instantiates a new ScatterPlotWidgetDefinitionRequests 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 NewScatterPlotWidgetDefinitionRequestsWithDefaults() *ScatterPlotWidgetDefinitionRequests { + this := ScatterPlotWidgetDefinitionRequests{} + return &this +} + +// GetTable returns the Table field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinitionRequests) GetTable() ScatterplotTableRequest { + if o == nil || o.Table == nil { + var ret ScatterplotTableRequest + return ret + } + return *o.Table +} + +// GetTableOk returns a tuple with the Table field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinitionRequests) GetTableOk() (*ScatterplotTableRequest, bool) { + if o == nil || o.Table == nil { + return nil, false + } + return o.Table, true +} + +// HasTable returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinitionRequests) HasTable() bool { + if o != nil && o.Table != nil { + return true + } + + return false +} + +// SetTable gets a reference to the given ScatterplotTableRequest and assigns it to the Table field. +func (o *ScatterPlotWidgetDefinitionRequests) SetTable(v ScatterplotTableRequest) { + o.Table = &v +} + +// GetX returns the X field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinitionRequests) GetX() ScatterPlotRequest { + if o == nil || o.X == nil { + var ret ScatterPlotRequest + return ret + } + return *o.X +} + +// GetXOk returns a tuple with the X field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinitionRequests) GetXOk() (*ScatterPlotRequest, bool) { + if o == nil || o.X == nil { + return nil, false + } + return o.X, true +} + +// HasX returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinitionRequests) HasX() bool { + if o != nil && o.X != nil { + return true + } + + return false +} + +// SetX gets a reference to the given ScatterPlotRequest and assigns it to the X field. +func (o *ScatterPlotWidgetDefinitionRequests) SetX(v ScatterPlotRequest) { + o.X = &v +} + +// GetY returns the Y field value if set, zero value otherwise. +func (o *ScatterPlotWidgetDefinitionRequests) GetY() ScatterPlotRequest { + if o == nil || o.Y == nil { + var ret ScatterPlotRequest + return ret + } + return *o.Y +} + +// GetYOk returns a tuple with the Y field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterPlotWidgetDefinitionRequests) GetYOk() (*ScatterPlotRequest, bool) { + if o == nil || o.Y == nil { + return nil, false + } + return o.Y, true +} + +// HasY returns a boolean if a field has been set. +func (o *ScatterPlotWidgetDefinitionRequests) HasY() bool { + if o != nil && o.Y != nil { + return true + } + + return false +} + +// SetY gets a reference to the given ScatterPlotRequest and assigns it to the Y field. +func (o *ScatterPlotWidgetDefinitionRequests) SetY(v ScatterPlotRequest) { + o.Y = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ScatterPlotWidgetDefinitionRequests) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Table != nil { + toSerialize["table"] = o.Table + } + if o.X != nil { + toSerialize["x"] = o.X + } + if o.Y != nil { + toSerialize["y"] = o.Y + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ScatterPlotWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Table *ScatterplotTableRequest `json:"table,omitempty"` + X *ScatterPlotRequest `json:"x,omitempty"` + Y *ScatterPlotRequest `json:"y,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Table != nil && all.Table.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Table = all.Table + if all.X != nil && all.X.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.X = all.X + if all.Y != nil && all.Y.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Y = all.Y + return nil +} diff --git a/api/v1/datadog/model_scatter_plot_widget_definition_type.go b/api/v1/datadog/model_scatter_plot_widget_definition_type.go new file mode 100644 index 00000000000..93ec5932477 --- /dev/null +++ b/api/v1/datadog/model_scatter_plot_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ScatterPlotWidgetDefinitionType Type of the scatter plot widget. +type ScatterPlotWidgetDefinitionType string + +// List of ScatterPlotWidgetDefinitionType. +const ( + SCATTERPLOTWIDGETDEFINITIONTYPE_SCATTERPLOT ScatterPlotWidgetDefinitionType = "scatterplot" +) + +var allowedScatterPlotWidgetDefinitionTypeEnumValues = []ScatterPlotWidgetDefinitionType{ + SCATTERPLOTWIDGETDEFINITIONTYPE_SCATTERPLOT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ScatterPlotWidgetDefinitionType) GetAllowedValues() []ScatterPlotWidgetDefinitionType { + return allowedScatterPlotWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ScatterPlotWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ScatterPlotWidgetDefinitionType(value) + return nil +} + +// NewScatterPlotWidgetDefinitionTypeFromValue returns a pointer to a valid ScatterPlotWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewScatterPlotWidgetDefinitionTypeFromValue(v string) (*ScatterPlotWidgetDefinitionType, error) { + ev := ScatterPlotWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ScatterPlotWidgetDefinitionType: valid values are %v", v, allowedScatterPlotWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ScatterPlotWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedScatterPlotWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ScatterPlotWidgetDefinitionType value. +func (v ScatterPlotWidgetDefinitionType) Ptr() *ScatterPlotWidgetDefinitionType { + return &v +} + +// NullableScatterPlotWidgetDefinitionType handles when a null is used for ScatterPlotWidgetDefinitionType. +type NullableScatterPlotWidgetDefinitionType struct { + value *ScatterPlotWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableScatterPlotWidgetDefinitionType) Get() *ScatterPlotWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableScatterPlotWidgetDefinitionType) Set(val *ScatterPlotWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableScatterPlotWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableScatterPlotWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableScatterPlotWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableScatterPlotWidgetDefinitionType(val *ScatterPlotWidgetDefinitionType) *NullableScatterPlotWidgetDefinitionType { + return &NullableScatterPlotWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableScatterPlotWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableScatterPlotWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_scatterplot_dimension.go b/api/v1/datadog/model_scatterplot_dimension.go new file mode 100644 index 00000000000..29adb0a1ddc --- /dev/null +++ b/api/v1/datadog/model_scatterplot_dimension.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ScatterplotDimension Dimension of the Scatterplot. +type ScatterplotDimension string + +// List of ScatterplotDimension. +const ( + SCATTERPLOTDIMENSION_X ScatterplotDimension = "x" + SCATTERPLOTDIMENSION_Y ScatterplotDimension = "y" + SCATTERPLOTDIMENSION_RADIUS ScatterplotDimension = "radius" + SCATTERPLOTDIMENSION_COLOR ScatterplotDimension = "color" +) + +var allowedScatterplotDimensionEnumValues = []ScatterplotDimension{ + SCATTERPLOTDIMENSION_X, + SCATTERPLOTDIMENSION_Y, + SCATTERPLOTDIMENSION_RADIUS, + SCATTERPLOTDIMENSION_COLOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ScatterplotDimension) GetAllowedValues() []ScatterplotDimension { + return allowedScatterplotDimensionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ScatterplotDimension) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ScatterplotDimension(value) + return nil +} + +// NewScatterplotDimensionFromValue returns a pointer to a valid ScatterplotDimension +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewScatterplotDimensionFromValue(v string) (*ScatterplotDimension, error) { + ev := ScatterplotDimension(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ScatterplotDimension: valid values are %v", v, allowedScatterplotDimensionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ScatterplotDimension) IsValid() bool { + for _, existing := range allowedScatterplotDimensionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ScatterplotDimension value. +func (v ScatterplotDimension) Ptr() *ScatterplotDimension { + return &v +} + +// NullableScatterplotDimension handles when a null is used for ScatterplotDimension. +type NullableScatterplotDimension struct { + value *ScatterplotDimension + isSet bool +} + +// Get returns the associated value. +func (v NullableScatterplotDimension) Get() *ScatterplotDimension { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableScatterplotDimension) Set(val *ScatterplotDimension) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableScatterplotDimension) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableScatterplotDimension) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableScatterplotDimension initializes the struct as if Set has been called. +func NewNullableScatterplotDimension(val *ScatterplotDimension) *NullableScatterplotDimension { + return &NullableScatterplotDimension{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableScatterplotDimension) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableScatterplotDimension) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_scatterplot_table_request.go b/api/v1/datadog/model_scatterplot_table_request.go new file mode 100644 index 00000000000..573ddd43a9f --- /dev/null +++ b/api/v1/datadog/model_scatterplot_table_request.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ScatterplotTableRequest Scatterplot request containing formulas and functions. +type ScatterplotTableRequest struct { + // List of Scatterplot formulas that operate on queries. + Formulas []ScatterplotWidgetFormula `json:"formulas,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,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{} +} + +// NewScatterplotTableRequest instantiates a new ScatterplotTableRequest 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 NewScatterplotTableRequest() *ScatterplotTableRequest { + this := ScatterplotTableRequest{} + return &this +} + +// NewScatterplotTableRequestWithDefaults instantiates a new ScatterplotTableRequest 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 NewScatterplotTableRequestWithDefaults() *ScatterplotTableRequest { + this := ScatterplotTableRequest{} + return &this +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *ScatterplotTableRequest) GetFormulas() []ScatterplotWidgetFormula { + if o == nil || o.Formulas == nil { + var ret []ScatterplotWidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterplotTableRequest) GetFormulasOk() (*[]ScatterplotWidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *ScatterplotTableRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []ScatterplotWidgetFormula and assigns it to the Formulas field. +func (o *ScatterplotTableRequest) SetFormulas(v []ScatterplotWidgetFormula) { + o.Formulas = v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *ScatterplotTableRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterplotTableRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *ScatterplotTableRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *ScatterplotTableRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *ScatterplotTableRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterplotTableRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *ScatterplotTableRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *ScatterplotTableRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ScatterplotTableRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ScatterplotTableRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Formulas []ScatterplotWidgetFormula `json:"formulas,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Formulas = all.Formulas + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + return nil +} diff --git a/api/v1/datadog/model_scatterplot_widget_aggregator.go b/api/v1/datadog/model_scatterplot_widget_aggregator.go new file mode 100644 index 00000000000..b90b949d59a --- /dev/null +++ b/api/v1/datadog/model_scatterplot_widget_aggregator.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ScatterplotWidgetAggregator Aggregator used for the request. +type ScatterplotWidgetAggregator string + +// List of ScatterplotWidgetAggregator. +const ( + SCATTERPLOTWIDGETAGGREGATOR_AVERAGE ScatterplotWidgetAggregator = "avg" + SCATTERPLOTWIDGETAGGREGATOR_LAST ScatterplotWidgetAggregator = "last" + SCATTERPLOTWIDGETAGGREGATOR_MAXIMUM ScatterplotWidgetAggregator = "max" + SCATTERPLOTWIDGETAGGREGATOR_MINIMUM ScatterplotWidgetAggregator = "min" + SCATTERPLOTWIDGETAGGREGATOR_SUM ScatterplotWidgetAggregator = "sum" +) + +var allowedScatterplotWidgetAggregatorEnumValues = []ScatterplotWidgetAggregator{ + SCATTERPLOTWIDGETAGGREGATOR_AVERAGE, + SCATTERPLOTWIDGETAGGREGATOR_LAST, + SCATTERPLOTWIDGETAGGREGATOR_MAXIMUM, + SCATTERPLOTWIDGETAGGREGATOR_MINIMUM, + SCATTERPLOTWIDGETAGGREGATOR_SUM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ScatterplotWidgetAggregator) GetAllowedValues() []ScatterplotWidgetAggregator { + return allowedScatterplotWidgetAggregatorEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ScatterplotWidgetAggregator) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ScatterplotWidgetAggregator(value) + return nil +} + +// NewScatterplotWidgetAggregatorFromValue returns a pointer to a valid ScatterplotWidgetAggregator +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewScatterplotWidgetAggregatorFromValue(v string) (*ScatterplotWidgetAggregator, error) { + ev := ScatterplotWidgetAggregator(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ScatterplotWidgetAggregator: valid values are %v", v, allowedScatterplotWidgetAggregatorEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ScatterplotWidgetAggregator) IsValid() bool { + for _, existing := range allowedScatterplotWidgetAggregatorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ScatterplotWidgetAggregator value. +func (v ScatterplotWidgetAggregator) Ptr() *ScatterplotWidgetAggregator { + return &v +} + +// NullableScatterplotWidgetAggregator handles when a null is used for ScatterplotWidgetAggregator. +type NullableScatterplotWidgetAggregator struct { + value *ScatterplotWidgetAggregator + isSet bool +} + +// Get returns the associated value. +func (v NullableScatterplotWidgetAggregator) Get() *ScatterplotWidgetAggregator { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableScatterplotWidgetAggregator) Set(val *ScatterplotWidgetAggregator) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableScatterplotWidgetAggregator) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableScatterplotWidgetAggregator) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableScatterplotWidgetAggregator initializes the struct as if Set has been called. +func NewNullableScatterplotWidgetAggregator(val *ScatterplotWidgetAggregator) *NullableScatterplotWidgetAggregator { + return &NullableScatterplotWidgetAggregator{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableScatterplotWidgetAggregator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableScatterplotWidgetAggregator) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_scatterplot_widget_formula.go b/api/v1/datadog/model_scatterplot_widget_formula.go new file mode 100644 index 00000000000..259e213ef10 --- /dev/null +++ b/api/v1/datadog/model_scatterplot_widget_formula.go @@ -0,0 +1,183 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ScatterplotWidgetFormula Formula to be used in a Scatterplot widget query. +type ScatterplotWidgetFormula struct { + // Expression alias. + Alias *string `json:"alias,omitempty"` + // Dimension of the Scatterplot. + Dimension ScatterplotDimension `json:"dimension"` + // String expression built from queries, formulas, and functions. + Formula string `json:"formula"` + // 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{} +} + +// NewScatterplotWidgetFormula instantiates a new ScatterplotWidgetFormula 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 NewScatterplotWidgetFormula(dimension ScatterplotDimension, formula string) *ScatterplotWidgetFormula { + this := ScatterplotWidgetFormula{} + this.Dimension = dimension + this.Formula = formula + return &this +} + +// NewScatterplotWidgetFormulaWithDefaults instantiates a new ScatterplotWidgetFormula 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 NewScatterplotWidgetFormulaWithDefaults() *ScatterplotWidgetFormula { + this := ScatterplotWidgetFormula{} + return &this +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *ScatterplotWidgetFormula) GetAlias() string { + if o == nil || o.Alias == nil { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScatterplotWidgetFormula) GetAliasOk() (*string, bool) { + if o == nil || o.Alias == nil { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *ScatterplotWidgetFormula) HasAlias() bool { + if o != nil && o.Alias != nil { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *ScatterplotWidgetFormula) SetAlias(v string) { + o.Alias = &v +} + +// GetDimension returns the Dimension field value. +func (o *ScatterplotWidgetFormula) GetDimension() ScatterplotDimension { + if o == nil { + var ret ScatterplotDimension + return ret + } + return o.Dimension +} + +// GetDimensionOk returns a tuple with the Dimension field value +// and a boolean to check if the value has been set. +func (o *ScatterplotWidgetFormula) GetDimensionOk() (*ScatterplotDimension, bool) { + if o == nil { + return nil, false + } + return &o.Dimension, true +} + +// SetDimension sets field value. +func (o *ScatterplotWidgetFormula) SetDimension(v ScatterplotDimension) { + o.Dimension = v +} + +// GetFormula returns the Formula field value. +func (o *ScatterplotWidgetFormula) GetFormula() string { + if o == nil { + var ret string + return ret + } + return o.Formula +} + +// GetFormulaOk returns a tuple with the Formula field value +// and a boolean to check if the value has been set. +func (o *ScatterplotWidgetFormula) GetFormulaOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Formula, true +} + +// SetFormula sets field value. +func (o *ScatterplotWidgetFormula) SetFormula(v string) { + o.Formula = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ScatterplotWidgetFormula) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Alias != nil { + toSerialize["alias"] = o.Alias + } + toSerialize["dimension"] = o.Dimension + toSerialize["formula"] = o.Formula + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ScatterplotWidgetFormula) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Dimension *ScatterplotDimension `json:"dimension"` + Formula *string `json:"formula"` + }{} + all := struct { + Alias *string `json:"alias,omitempty"` + Dimension ScatterplotDimension `json:"dimension"` + Formula string `json:"formula"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Dimension == nil { + return fmt.Errorf("Required field dimension missing") + } + if required.Formula == nil { + return fmt.Errorf("Required field formula missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Dimension; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Alias = all.Alias + o.Dimension = all.Dimension + o.Formula = all.Formula + return nil +} diff --git a/api/v1/datadog/model_search_slo_response.go b/api/v1/datadog/model_search_slo_response.go new file mode 100644 index 00000000000..047270cdf3c --- /dev/null +++ b/api/v1/datadog/model_search_slo_response.go @@ -0,0 +1,201 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponse A search SLO response containing results from the search query. +type SearchSLOResponse struct { + // Data from search SLO response. + Data *SearchSLOResponseData `json:"data,omitempty"` + // Pagination links. + Links *SearchSLOResponseLinks `json:"links,omitempty"` + // Searches metadata returned by the API. + Meta *SearchSLOResponseMeta `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{} +} + +// NewSearchSLOResponse instantiates a new SearchSLOResponse 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 NewSearchSLOResponse() *SearchSLOResponse { + this := SearchSLOResponse{} + return &this +} + +// NewSearchSLOResponseWithDefaults instantiates a new SearchSLOResponse 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 NewSearchSLOResponseWithDefaults() *SearchSLOResponse { + this := SearchSLOResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SearchSLOResponse) GetData() SearchSLOResponseData { + if o == nil || o.Data == nil { + var ret SearchSLOResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponse) GetDataOk() (*SearchSLOResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SearchSLOResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SearchSLOResponseData and assigns it to the Data field. +func (o *SearchSLOResponse) SetData(v SearchSLOResponseData) { + o.Data = &v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *SearchSLOResponse) GetLinks() SearchSLOResponseLinks { + if o == nil || o.Links == nil { + var ret SearchSLOResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponse) GetLinksOk() (*SearchSLOResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *SearchSLOResponse) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +// SetLinks gets a reference to the given SearchSLOResponseLinks and assigns it to the Links field. +func (o *SearchSLOResponse) SetLinks(v SearchSLOResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SearchSLOResponse) GetMeta() SearchSLOResponseMeta { + if o == nil || o.Meta == nil { + var ret SearchSLOResponseMeta + 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 *SearchSLOResponse) GetMetaOk() (*SearchSLOResponseMeta, 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 *SearchSLOResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given SearchSLOResponseMeta and assigns it to the Meta field. +func (o *SearchSLOResponse) SetMeta(v SearchSLOResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SearchSLOResponseData `json:"data,omitempty"` + Links *SearchSLOResponseLinks `json:"links,omitempty"` + Meta *SearchSLOResponseMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_data.go b/api/v1/datadog/model_search_slo_response_data.go new file mode 100644 index 00000000000..7b80c224ef7 --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_data.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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseData Data from search SLO response. +type SearchSLOResponseData struct { + // Attributes + Attributes *SearchSLOResponseDataAttributes `json:"attributes,omitempty"` + // Type of service level objective result. + Type *string `json:"type,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{} +} + +// NewSearchSLOResponseData instantiates a new SearchSLOResponseData 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 NewSearchSLOResponseData() *SearchSLOResponseData { + this := SearchSLOResponseData{} + return &this +} + +// NewSearchSLOResponseDataWithDefaults instantiates a new SearchSLOResponseData 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 NewSearchSLOResponseDataWithDefaults() *SearchSLOResponseData { + this := SearchSLOResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SearchSLOResponseData) GetAttributes() SearchSLOResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret SearchSLOResponseDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseData) GetAttributesOk() (*SearchSLOResponseDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SearchSLOResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SearchSLOResponseDataAttributes and assigns it to the Attributes field. +func (o *SearchSLOResponseData) SetAttributes(v SearchSLOResponseDataAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SearchSLOResponseData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SearchSLOResponseData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *SearchSLOResponseData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *SearchSLOResponseDataAttributes `json:"attributes,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes.go b/api/v1/datadog/model_search_slo_response_data_attributes.go new file mode 100644 index 00000000000..5da67c4bf90 --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_data_attributes.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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseDataAttributes Attributes +type SearchSLOResponseDataAttributes struct { + // Facets + Facets *SearchSLOResponseDataAttributesFacets `json:"facets,omitempty"` + // SLOs + Slo []ServiceLevelObjective `json:"slo,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{} +} + +// NewSearchSLOResponseDataAttributes instantiates a new SearchSLOResponseDataAttributes 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 NewSearchSLOResponseDataAttributes() *SearchSLOResponseDataAttributes { + this := SearchSLOResponseDataAttributes{} + return &this +} + +// NewSearchSLOResponseDataAttributesWithDefaults instantiates a new SearchSLOResponseDataAttributes 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 NewSearchSLOResponseDataAttributesWithDefaults() *SearchSLOResponseDataAttributes { + this := SearchSLOResponseDataAttributes{} + return &this +} + +// GetFacets returns the Facets field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributes) GetFacets() SearchSLOResponseDataAttributesFacets { + if o == nil || o.Facets == nil { + var ret SearchSLOResponseDataAttributesFacets + return ret + } + return *o.Facets +} + +// GetFacetsOk returns a tuple with the Facets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributes) GetFacetsOk() (*SearchSLOResponseDataAttributesFacets, bool) { + if o == nil || o.Facets == nil { + return nil, false + } + return o.Facets, true +} + +// HasFacets returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributes) HasFacets() bool { + if o != nil && o.Facets != nil { + return true + } + + return false +} + +// SetFacets gets a reference to the given SearchSLOResponseDataAttributesFacets and assigns it to the Facets field. +func (o *SearchSLOResponseDataAttributes) SetFacets(v SearchSLOResponseDataAttributesFacets) { + o.Facets = &v +} + +// GetSlo returns the Slo field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributes) GetSlo() []ServiceLevelObjective { + if o == nil || o.Slo == nil { + var ret []ServiceLevelObjective + return ret + } + return o.Slo +} + +// GetSloOk returns a tuple with the Slo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributes) GetSloOk() (*[]ServiceLevelObjective, bool) { + if o == nil || o.Slo == nil { + return nil, false + } + return &o.Slo, true +} + +// HasSlo returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributes) HasSlo() bool { + if o != nil && o.Slo != nil { + return true + } + + return false +} + +// SetSlo gets a reference to the given []ServiceLevelObjective and assigns it to the Slo field. +func (o *SearchSLOResponseDataAttributes) SetSlo(v []ServiceLevelObjective) { + o.Slo = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Facets != nil { + toSerialize["facets"] = o.Facets + } + if o.Slo != nil { + toSerialize["slo"] = o.Slo + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Facets *SearchSLOResponseDataAttributesFacets `json:"facets,omitempty"` + Slo []ServiceLevelObjective `json:"slo,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Facets != nil && all.Facets.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Facets = all.Facets + o.Slo = all.Slo + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes_facets.go b/api/v1/datadog/model_search_slo_response_data_attributes_facets.go new file mode 100644 index 00000000000..970158321b4 --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_data_attributes_facets.go @@ -0,0 +1,375 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseDataAttributesFacets Facets +type SearchSLOResponseDataAttributesFacets struct { + // All tags associated with an SLO. + AllTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"all_tags,omitempty"` + // Creator of an SLO. + CreatorName []SearchSLOResponseDataAttributesFacetsObjectString `json:"creator_name,omitempty"` + // Tags with the `env` tag key. + EnvTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"env_tags,omitempty"` + // Tags with the `service` tag key. + ServiceTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"service_tags,omitempty"` + // Type of SLO. + SloType []SearchSLOResponseDataAttributesFacetsObjectInt `json:"slo_type,omitempty"` + // SLO Target + Target []SearchSLOResponseDataAttributesFacetsObjectInt `json:"target,omitempty"` + // Tags with the `team` tag key. + TeamTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"team_tags,omitempty"` + // Timeframes of SLOs. + Timeframe []SearchSLOResponseDataAttributesFacetsObjectString `json:"timeframe,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{} +} + +// NewSearchSLOResponseDataAttributesFacets instantiates a new SearchSLOResponseDataAttributesFacets 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 NewSearchSLOResponseDataAttributesFacets() *SearchSLOResponseDataAttributesFacets { + this := SearchSLOResponseDataAttributesFacets{} + return &this +} + +// NewSearchSLOResponseDataAttributesFacetsWithDefaults instantiates a new SearchSLOResponseDataAttributesFacets 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 NewSearchSLOResponseDataAttributesFacetsWithDefaults() *SearchSLOResponseDataAttributesFacets { + this := SearchSLOResponseDataAttributesFacets{} + return &this +} + +// GetAllTags returns the AllTags field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetAllTags() []SearchSLOResponseDataAttributesFacetsObjectString { + if o == nil || o.AllTags == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectString + return ret + } + return o.AllTags +} + +// GetAllTagsOk returns a tuple with the AllTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetAllTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { + if o == nil || o.AllTags == nil { + return nil, false + } + return &o.AllTags, true +} + +// HasAllTags returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasAllTags() bool { + if o != nil && o.AllTags != nil { + return true + } + + return false +} + +// SetAllTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the AllTags field. +func (o *SearchSLOResponseDataAttributesFacets) SetAllTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { + o.AllTags = v +} + +// GetCreatorName returns the CreatorName field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetCreatorName() []SearchSLOResponseDataAttributesFacetsObjectString { + if o == nil || o.CreatorName == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectString + return ret + } + return o.CreatorName +} + +// GetCreatorNameOk returns a tuple with the CreatorName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetCreatorNameOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { + if o == nil || o.CreatorName == nil { + return nil, false + } + return &o.CreatorName, true +} + +// HasCreatorName returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasCreatorName() bool { + if o != nil && o.CreatorName != nil { + return true + } + + return false +} + +// SetCreatorName gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the CreatorName field. +func (o *SearchSLOResponseDataAttributesFacets) SetCreatorName(v []SearchSLOResponseDataAttributesFacetsObjectString) { + o.CreatorName = v +} + +// GetEnvTags returns the EnvTags field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetEnvTags() []SearchSLOResponseDataAttributesFacetsObjectString { + if o == nil || o.EnvTags == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectString + return ret + } + return o.EnvTags +} + +// GetEnvTagsOk returns a tuple with the EnvTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetEnvTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { + if o == nil || o.EnvTags == nil { + return nil, false + } + return &o.EnvTags, true +} + +// HasEnvTags returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasEnvTags() bool { + if o != nil && o.EnvTags != nil { + return true + } + + return false +} + +// SetEnvTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the EnvTags field. +func (o *SearchSLOResponseDataAttributesFacets) SetEnvTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { + o.EnvTags = v +} + +// GetServiceTags returns the ServiceTags field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetServiceTags() []SearchSLOResponseDataAttributesFacetsObjectString { + if o == nil || o.ServiceTags == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectString + return ret + } + return o.ServiceTags +} + +// GetServiceTagsOk returns a tuple with the ServiceTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetServiceTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { + if o == nil || o.ServiceTags == nil { + return nil, false + } + return &o.ServiceTags, true +} + +// HasServiceTags returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasServiceTags() bool { + if o != nil && o.ServiceTags != nil { + return true + } + + return false +} + +// SetServiceTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the ServiceTags field. +func (o *SearchSLOResponseDataAttributesFacets) SetServiceTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { + o.ServiceTags = v +} + +// GetSloType returns the SloType field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetSloType() []SearchSLOResponseDataAttributesFacetsObjectInt { + if o == nil || o.SloType == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectInt + return ret + } + return o.SloType +} + +// GetSloTypeOk returns a tuple with the SloType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetSloTypeOk() (*[]SearchSLOResponseDataAttributesFacetsObjectInt, bool) { + if o == nil || o.SloType == nil { + return nil, false + } + return &o.SloType, true +} + +// HasSloType returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasSloType() bool { + if o != nil && o.SloType != nil { + return true + } + + return false +} + +// SetSloType gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectInt and assigns it to the SloType field. +func (o *SearchSLOResponseDataAttributesFacets) SetSloType(v []SearchSLOResponseDataAttributesFacetsObjectInt) { + o.SloType = v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetTarget() []SearchSLOResponseDataAttributesFacetsObjectInt { + if o == nil || o.Target == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectInt + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetTargetOk() (*[]SearchSLOResponseDataAttributesFacetsObjectInt, bool) { + if o == nil || o.Target == nil { + return nil, false + } + return &o.Target, true +} + +// HasTarget returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasTarget() bool { + if o != nil && o.Target != nil { + return true + } + + return false +} + +// SetTarget gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectInt and assigns it to the Target field. +func (o *SearchSLOResponseDataAttributesFacets) SetTarget(v []SearchSLOResponseDataAttributesFacetsObjectInt) { + o.Target = v +} + +// GetTeamTags returns the TeamTags field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetTeamTags() []SearchSLOResponseDataAttributesFacetsObjectString { + if o == nil || o.TeamTags == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectString + return ret + } + return o.TeamTags +} + +// GetTeamTagsOk returns a tuple with the TeamTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetTeamTagsOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { + if o == nil || o.TeamTags == nil { + return nil, false + } + return &o.TeamTags, true +} + +// HasTeamTags returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasTeamTags() bool { + if o != nil && o.TeamTags != nil { + return true + } + + return false +} + +// SetTeamTags gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the TeamTags field. +func (o *SearchSLOResponseDataAttributesFacets) SetTeamTags(v []SearchSLOResponseDataAttributesFacetsObjectString) { + o.TeamTags = v +} + +// GetTimeframe returns the Timeframe field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacets) GetTimeframe() []SearchSLOResponseDataAttributesFacetsObjectString { + if o == nil || o.Timeframe == nil { + var ret []SearchSLOResponseDataAttributesFacetsObjectString + return ret + } + return o.Timeframe +} + +// GetTimeframeOk returns a tuple with the Timeframe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacets) GetTimeframeOk() (*[]SearchSLOResponseDataAttributesFacetsObjectString, bool) { + if o == nil || o.Timeframe == nil { + return nil, false + } + return &o.Timeframe, true +} + +// HasTimeframe returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacets) HasTimeframe() bool { + if o != nil && o.Timeframe != nil { + return true + } + + return false +} + +// SetTimeframe gets a reference to the given []SearchSLOResponseDataAttributesFacetsObjectString and assigns it to the Timeframe field. +func (o *SearchSLOResponseDataAttributesFacets) SetTimeframe(v []SearchSLOResponseDataAttributesFacetsObjectString) { + o.Timeframe = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseDataAttributesFacets) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AllTags != nil { + toSerialize["all_tags"] = o.AllTags + } + if o.CreatorName != nil { + toSerialize["creator_name"] = o.CreatorName + } + if o.EnvTags != nil { + toSerialize["env_tags"] = o.EnvTags + } + if o.ServiceTags != nil { + toSerialize["service_tags"] = o.ServiceTags + } + if o.SloType != nil { + toSerialize["slo_type"] = o.SloType + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + if o.TeamTags != nil { + toSerialize["team_tags"] = o.TeamTags + } + if o.Timeframe != nil { + toSerialize["timeframe"] = o.Timeframe + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseDataAttributesFacets) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AllTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"all_tags,omitempty"` + CreatorName []SearchSLOResponseDataAttributesFacetsObjectString `json:"creator_name,omitempty"` + EnvTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"env_tags,omitempty"` + ServiceTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"service_tags,omitempty"` + SloType []SearchSLOResponseDataAttributesFacetsObjectInt `json:"slo_type,omitempty"` + Target []SearchSLOResponseDataAttributesFacetsObjectInt `json:"target,omitempty"` + TeamTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"team_tags,omitempty"` + Timeframe []SearchSLOResponseDataAttributesFacetsObjectString `json:"timeframe,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AllTags = all.AllTags + o.CreatorName = all.CreatorName + o.EnvTags = all.EnvTags + o.ServiceTags = all.ServiceTags + o.SloType = all.SloType + o.Target = all.Target + o.TeamTags = all.TeamTags + o.Timeframe = all.Timeframe + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go b/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go new file mode 100644 index 00000000000..609ff9e4992 --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_int.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseDataAttributesFacetsObjectInt Facet +type SearchSLOResponseDataAttributesFacetsObjectInt struct { + // Count + Count *int64 `json:"count,omitempty"` + // Facet + Name *float64 `json:"name,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{} +} + +// NewSearchSLOResponseDataAttributesFacetsObjectInt instantiates a new SearchSLOResponseDataAttributesFacetsObjectInt 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 NewSearchSLOResponseDataAttributesFacetsObjectInt() *SearchSLOResponseDataAttributesFacetsObjectInt { + this := SearchSLOResponseDataAttributesFacetsObjectInt{} + return &this +} + +// NewSearchSLOResponseDataAttributesFacetsObjectIntWithDefaults instantiates a new SearchSLOResponseDataAttributesFacetsObjectInt 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 NewSearchSLOResponseDataAttributesFacetsObjectIntWithDefaults() *SearchSLOResponseDataAttributesFacetsObjectInt { + this := SearchSLOResponseDataAttributesFacetsObjectInt{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetCount() int64 { + if o == nil || o.Count == nil { + var ret int64 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetCountOk() (*int64, bool) { + if o == nil || o.Count == nil { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) HasCount() bool { + if o != nil && o.Count != nil { + return true + } + + return false +} + +// SetCount gets a reference to the given int64 and assigns it to the Count field. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) SetCount(v int64) { + o.Count = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetName() float64 { + if o == nil || o.Name == nil { + var ret float64 + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) GetNameOk() (*float64, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given float64 and assigns it to the Name field. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) SetName(v float64) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseDataAttributesFacetsObjectInt) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Count != nil { + toSerialize["count"] = o.Count + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseDataAttributesFacetsObjectInt) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Count *int64 `json:"count,omitempty"` + Name *float64 `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Count = all.Count + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go b/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go new file mode 100644 index 00000000000..d8066a3400d --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_data_attributes_facets_object_string.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseDataAttributesFacetsObjectString Facet +type SearchSLOResponseDataAttributesFacetsObjectString struct { + // Count + Count *int64 `json:"count,omitempty"` + // Facet + Name *string `json:"name,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{} +} + +// NewSearchSLOResponseDataAttributesFacetsObjectString instantiates a new SearchSLOResponseDataAttributesFacetsObjectString 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 NewSearchSLOResponseDataAttributesFacetsObjectString() *SearchSLOResponseDataAttributesFacetsObjectString { + this := SearchSLOResponseDataAttributesFacetsObjectString{} + return &this +} + +// NewSearchSLOResponseDataAttributesFacetsObjectStringWithDefaults instantiates a new SearchSLOResponseDataAttributesFacetsObjectString 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 NewSearchSLOResponseDataAttributesFacetsObjectStringWithDefaults() *SearchSLOResponseDataAttributesFacetsObjectString { + this := SearchSLOResponseDataAttributesFacetsObjectString{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetCount() int64 { + if o == nil || o.Count == nil { + var ret int64 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetCountOk() (*int64, bool) { + if o == nil || o.Count == nil { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) HasCount() bool { + if o != nil && o.Count != nil { + return true + } + + return false +} + +// SetCount gets a reference to the given int64 and assigns it to the Count field. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) SetCount(v int64) { + o.Count = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseDataAttributesFacetsObjectString) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Count != nil { + toSerialize["count"] = o.Count + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseDataAttributesFacetsObjectString) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Count *int64 `json:"count,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Count = all.Count + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_links.go b/api/v1/datadog/model_search_slo_response_links.go new file mode 100644 index 00000000000..2388ddfbba7 --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_links.go @@ -0,0 +1,258 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseLinks Pagination links. +type SearchSLOResponseLinks struct { + // Link to last page. + First *string `json:"first,omitempty"` + // Link to first page. + Last *string `json:"last,omitempty"` + // Link to the next page. + Next *string `json:"next,omitempty"` + // Link to previous page. + Prev *string `json:"prev,omitempty"` + // Link to current page. + Self *string `json:"self,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{} +} + +// NewSearchSLOResponseLinks instantiates a new SearchSLOResponseLinks 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 NewSearchSLOResponseLinks() *SearchSLOResponseLinks { + this := SearchSLOResponseLinks{} + return &this +} + +// NewSearchSLOResponseLinksWithDefaults instantiates a new SearchSLOResponseLinks 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 NewSearchSLOResponseLinksWithDefaults() *SearchSLOResponseLinks { + this := SearchSLOResponseLinks{} + return &this +} + +// GetFirst returns the First field value if set, zero value otherwise. +func (o *SearchSLOResponseLinks) GetFirst() string { + if o == nil || o.First == nil { + var ret string + return ret + } + return *o.First +} + +// GetFirstOk returns a tuple with the First field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseLinks) GetFirstOk() (*string, bool) { + if o == nil || o.First == nil { + return nil, false + } + return o.First, true +} + +// HasFirst returns a boolean if a field has been set. +func (o *SearchSLOResponseLinks) HasFirst() bool { + if o != nil && o.First != nil { + return true + } + + return false +} + +// SetFirst gets a reference to the given string and assigns it to the First field. +func (o *SearchSLOResponseLinks) SetFirst(v string) { + o.First = &v +} + +// GetLast returns the Last field value if set, zero value otherwise. +func (o *SearchSLOResponseLinks) GetLast() string { + if o == nil || o.Last == nil { + var ret string + return ret + } + return *o.Last +} + +// GetLastOk returns a tuple with the Last field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseLinks) GetLastOk() (*string, bool) { + if o == nil || o.Last == nil { + return nil, false + } + return o.Last, true +} + +// HasLast returns a boolean if a field has been set. +func (o *SearchSLOResponseLinks) HasLast() bool { + if o != nil && o.Last != nil { + return true + } + + return false +} + +// SetLast gets a reference to the given string and assigns it to the Last field. +func (o *SearchSLOResponseLinks) SetLast(v string) { + o.Last = &v +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *SearchSLOResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *SearchSLOResponseLinks) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *SearchSLOResponseLinks) SetNext(v string) { + o.Next = &v +} + +// GetPrev returns the Prev field value if set, zero value otherwise. +func (o *SearchSLOResponseLinks) GetPrev() string { + if o == nil || o.Prev == nil { + var ret string + return ret + } + return *o.Prev +} + +// GetPrevOk returns a tuple with the Prev field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseLinks) GetPrevOk() (*string, bool) { + if o == nil || o.Prev == nil { + return nil, false + } + return o.Prev, true +} + +// HasPrev returns a boolean if a field has been set. +func (o *SearchSLOResponseLinks) HasPrev() bool { + if o != nil && o.Prev != nil { + return true + } + + return false +} + +// SetPrev gets a reference to the given string and assigns it to the Prev field. +func (o *SearchSLOResponseLinks) SetPrev(v string) { + o.Prev = &v +} + +// GetSelf returns the Self field value if set, zero value otherwise. +func (o *SearchSLOResponseLinks) GetSelf() string { + if o == nil || o.Self == nil { + var ret string + return ret + } + return *o.Self +} + +// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseLinks) GetSelfOk() (*string, bool) { + if o == nil || o.Self == nil { + return nil, false + } + return o.Self, true +} + +// HasSelf returns a boolean if a field has been set. +func (o *SearchSLOResponseLinks) HasSelf() bool { + if o != nil && o.Self != nil { + return true + } + + return false +} + +// SetSelf gets a reference to the given string and assigns it to the Self field. +func (o *SearchSLOResponseLinks) SetSelf(v string) { + o.Self = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.First != nil { + toSerialize["first"] = o.First + } + if o.Last != nil { + toSerialize["last"] = o.Last + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + if o.Prev != nil { + toSerialize["prev"] = o.Prev + } + if o.Self != nil { + toSerialize["self"] = o.Self + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + First *string `json:"first,omitempty"` + Last *string `json:"last,omitempty"` + Next *string `json:"next,omitempty"` + Prev *string `json:"prev,omitempty"` + Self *string `json:"self,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.First = all.First + o.Last = all.Last + o.Next = all.Next + o.Prev = all.Prev + o.Self = all.Self + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_meta.go b/api/v1/datadog/model_search_slo_response_meta.go new file mode 100644 index 00000000000..e2441de62fb --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_meta.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseMeta Searches metadata returned by the API. +type SearchSLOResponseMeta struct { + // Pagination metadata returned by the API. + Pagination *SearchSLOResponseMetaPage `json:"pagination,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{} +} + +// NewSearchSLOResponseMeta instantiates a new SearchSLOResponseMeta 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 NewSearchSLOResponseMeta() *SearchSLOResponseMeta { + this := SearchSLOResponseMeta{} + return &this +} + +// NewSearchSLOResponseMetaWithDefaults instantiates a new SearchSLOResponseMeta 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 NewSearchSLOResponseMetaWithDefaults() *SearchSLOResponseMeta { + this := SearchSLOResponseMeta{} + return &this +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *SearchSLOResponseMeta) GetPagination() SearchSLOResponseMetaPage { + if o == nil || o.Pagination == nil { + var ret SearchSLOResponseMetaPage + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMeta) GetPaginationOk() (*SearchSLOResponseMetaPage, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *SearchSLOResponseMeta) HasPagination() bool { + if o != nil && o.Pagination != nil { + return true + } + + return false +} + +// SetPagination gets a reference to the given SearchSLOResponseMetaPage and assigns it to the Pagination field. +func (o *SearchSLOResponseMeta) SetPagination(v SearchSLOResponseMetaPage) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Pagination *SearchSLOResponseMetaPage `json:"pagination,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pagination = all.Pagination + return nil +} diff --git a/api/v1/datadog/model_search_slo_response_meta_page.go b/api/v1/datadog/model_search_slo_response_meta_page.go new file mode 100644 index 00000000000..aee031ce762 --- /dev/null +++ b/api/v1/datadog/model_search_slo_response_meta_page.go @@ -0,0 +1,375 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SearchSLOResponseMetaPage Pagination metadata returned by the API. +type SearchSLOResponseMetaPage struct { + // The first number. + FirstNumber *int64 `json:"first_number,omitempty"` + // The last number. + LastNumber *int64 `json:"last_number,omitempty"` + // The next number. + NextNumber *int64 `json:"next_number,omitempty"` + // The page number. + Number *int64 `json:"number,omitempty"` + // The previous page number. + PrevNumber *int64 `json:"prev_number,omitempty"` + // The size of the response. + Size *int64 `json:"size,omitempty"` + // The total number of SLOs in the response. + Total *int64 `json:"total,omitempty"` + // Type of pagination. + Type *string `json:"type,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{} +} + +// NewSearchSLOResponseMetaPage instantiates a new SearchSLOResponseMetaPage 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 NewSearchSLOResponseMetaPage() *SearchSLOResponseMetaPage { + this := SearchSLOResponseMetaPage{} + return &this +} + +// NewSearchSLOResponseMetaPageWithDefaults instantiates a new SearchSLOResponseMetaPage 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 NewSearchSLOResponseMetaPageWithDefaults() *SearchSLOResponseMetaPage { + this := SearchSLOResponseMetaPage{} + return &this +} + +// GetFirstNumber returns the FirstNumber field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetFirstNumber() int64 { + if o == nil || o.FirstNumber == nil { + var ret int64 + return ret + } + return *o.FirstNumber +} + +// GetFirstNumberOk returns a tuple with the FirstNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetFirstNumberOk() (*int64, bool) { + if o == nil || o.FirstNumber == nil { + return nil, false + } + return o.FirstNumber, true +} + +// HasFirstNumber returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasFirstNumber() bool { + if o != nil && o.FirstNumber != nil { + return true + } + + return false +} + +// SetFirstNumber gets a reference to the given int64 and assigns it to the FirstNumber field. +func (o *SearchSLOResponseMetaPage) SetFirstNumber(v int64) { + o.FirstNumber = &v +} + +// GetLastNumber returns the LastNumber field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetLastNumber() int64 { + if o == nil || o.LastNumber == nil { + var ret int64 + return ret + } + return *o.LastNumber +} + +// GetLastNumberOk returns a tuple with the LastNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetLastNumberOk() (*int64, bool) { + if o == nil || o.LastNumber == nil { + return nil, false + } + return o.LastNumber, true +} + +// HasLastNumber returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasLastNumber() bool { + if o != nil && o.LastNumber != nil { + return true + } + + return false +} + +// SetLastNumber gets a reference to the given int64 and assigns it to the LastNumber field. +func (o *SearchSLOResponseMetaPage) SetLastNumber(v int64) { + o.LastNumber = &v +} + +// GetNextNumber returns the NextNumber field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetNextNumber() int64 { + if o == nil || o.NextNumber == nil { + var ret int64 + return ret + } + return *o.NextNumber +} + +// GetNextNumberOk returns a tuple with the NextNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetNextNumberOk() (*int64, bool) { + if o == nil || o.NextNumber == nil { + return nil, false + } + return o.NextNumber, true +} + +// HasNextNumber returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasNextNumber() bool { + if o != nil && o.NextNumber != nil { + return true + } + + return false +} + +// SetNextNumber gets a reference to the given int64 and assigns it to the NextNumber field. +func (o *SearchSLOResponseMetaPage) SetNextNumber(v int64) { + o.NextNumber = &v +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetNumber() int64 { + if o == nil || o.Number == nil { + var ret int64 + return ret + } + return *o.Number +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetNumberOk() (*int64, bool) { + if o == nil || o.Number == nil { + return nil, false + } + return o.Number, true +} + +// HasNumber returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasNumber() bool { + if o != nil && o.Number != nil { + return true + } + + return false +} + +// SetNumber gets a reference to the given int64 and assigns it to the Number field. +func (o *SearchSLOResponseMetaPage) SetNumber(v int64) { + o.Number = &v +} + +// GetPrevNumber returns the PrevNumber field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetPrevNumber() int64 { + if o == nil || o.PrevNumber == nil { + var ret int64 + return ret + } + return *o.PrevNumber +} + +// GetPrevNumberOk returns a tuple with the PrevNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetPrevNumberOk() (*int64, bool) { + if o == nil || o.PrevNumber == nil { + return nil, false + } + return o.PrevNumber, true +} + +// HasPrevNumber returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasPrevNumber() bool { + if o != nil && o.PrevNumber != nil { + return true + } + + return false +} + +// SetPrevNumber gets a reference to the given int64 and assigns it to the PrevNumber field. +func (o *SearchSLOResponseMetaPage) SetPrevNumber(v int64) { + o.PrevNumber = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *SearchSLOResponseMetaPage) SetSize(v int64) { + o.Size = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetTotal() int64 { + if o == nil || o.Total == nil { + var ret int64 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetTotalOk() (*int64, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasTotal() bool { + if o != nil && o.Total != nil { + return true + } + + return false +} + +// SetTotal gets a reference to the given int64 and assigns it to the Total field. +func (o *SearchSLOResponseMetaPage) SetTotal(v int64) { + o.Total = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SearchSLOResponseMetaPage) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchSLOResponseMetaPage) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SearchSLOResponseMetaPage) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *SearchSLOResponseMetaPage) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SearchSLOResponseMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.FirstNumber != nil { + toSerialize["first_number"] = o.FirstNumber + } + if o.LastNumber != nil { + toSerialize["last_number"] = o.LastNumber + } + if o.NextNumber != nil { + toSerialize["next_number"] = o.NextNumber + } + if o.Number != nil { + toSerialize["number"] = o.Number + } + if o.PrevNumber != nil { + toSerialize["prev_number"] = o.PrevNumber + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SearchSLOResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + FirstNumber *int64 `json:"first_number,omitempty"` + LastNumber *int64 `json:"last_number,omitempty"` + NextNumber *int64 `json:"next_number,omitempty"` + Number *int64 `json:"number,omitempty"` + PrevNumber *int64 `json:"prev_number,omitempty"` + Size *int64 `json:"size,omitempty"` + Total *int64 `json:"total,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.FirstNumber = all.FirstNumber + o.LastNumber = all.LastNumber + o.NextNumber = all.NextNumber + o.Number = all.Number + o.PrevNumber = all.PrevNumber + o.Size = all.Size + o.Total = all.Total + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_series.go b/api/v1/datadog/model_series.go new file mode 100644 index 00000000000..5e1759b636d --- /dev/null +++ b/api/v1/datadog/model_series.go @@ -0,0 +1,312 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// Series A metric to submit to Datadog. +// See [Datadog metrics](https://docs.datadoghq.com/developers/metrics/#custom-metrics-properties). +type Series struct { + // The name of the host that produced the metric. + Host *string `json:"host,omitempty"` + // If the type of the metric is rate or count, define the corresponding interval. + Interval common.NullableInt64 `json:"interval,omitempty"` + // The name of the timeseries. + Metric string `json:"metric"` + // Points relating to a metric. All points must be tuples with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past. + Points [][]*float64 `json:"points"` + // A list of tags associated with the metric. + Tags []string `json:"tags,omitempty"` + // The type of the metric. Valid types are "",`count`, `gauge`, and `rate`. + Type *string `json:"type,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{} +} + +// NewSeries instantiates a new Series 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 NewSeries(metric string, points [][]*float64) *Series { + this := Series{} + this.Interval = *common.NewNullableInt64(nil) + this.Metric = metric + this.Points = points + var typeVar string = "" + this.Type = &typeVar + return &this +} + +// NewSeriesWithDefaults instantiates a new Series 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 NewSeriesWithDefaults() *Series { + this := Series{} + this.Interval = *common.NewNullableInt64(nil) + var typeVar string = "" + this.Type = &typeVar + return &this +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *Series) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Series) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *Series) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *Series) SetHost(v string) { + o.Host = &v +} + +// GetInterval returns the Interval field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Series) GetInterval() int64 { + if o == nil || o.Interval.Get() == nil { + var ret int64 + return ret + } + return *o.Interval.Get() +} + +// GetIntervalOk returns a tuple with the Interval 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 *Series) GetIntervalOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Interval.Get(), o.Interval.IsSet() +} + +// HasInterval returns a boolean if a field has been set. +func (o *Series) HasInterval() bool { + if o != nil && o.Interval.IsSet() { + return true + } + + return false +} + +// SetInterval gets a reference to the given common.NullableInt64 and assigns it to the Interval field. +func (o *Series) SetInterval(v int64) { + o.Interval.Set(&v) +} + +// SetIntervalNil sets the value for Interval to be an explicit nil. +func (o *Series) SetIntervalNil() { + o.Interval.Set(nil) +} + +// UnsetInterval ensures that no value is present for Interval, not even an explicit nil. +func (o *Series) UnsetInterval() { + o.Interval.Unset() +} + +// GetMetric returns the Metric field value. +func (o *Series) GetMetric() string { + if o == nil { + var ret string + return ret + } + return o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value +// and a boolean to check if the value has been set. +func (o *Series) GetMetricOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metric, true +} + +// SetMetric sets field value. +func (o *Series) SetMetric(v string) { + o.Metric = v +} + +// GetPoints returns the Points field value. +func (o *Series) GetPoints() [][]*float64 { + if o == nil { + var ret [][]*float64 + return ret + } + return o.Points +} + +// GetPointsOk returns a tuple with the Points field value +// and a boolean to check if the value has been set. +func (o *Series) GetPointsOk() (*[][]*float64, bool) { + if o == nil { + return nil, false + } + return &o.Points, true +} + +// SetPoints sets field value. +func (o *Series) SetPoints(v [][]*float64) { + o.Points = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Series) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *Series) GetTagsOk() (*[]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 *Series) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Series) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Series) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Series) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Series) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Series) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Series) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Interval.IsSet() { + toSerialize["interval"] = o.Interval.Get() + } + toSerialize["metric"] = o.Metric + toSerialize["points"] = o.Points + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Series) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Metric *string `json:"metric"` + Points *[][]*float64 `json:"points"` + }{} + all := struct { + Host *string `json:"host,omitempty"` + Interval common.NullableInt64 `json:"interval,omitempty"` + Metric string `json:"metric"` + Points [][]*float64 `json:"points"` + Tags []string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Metric == nil { + return fmt.Errorf("Required field metric missing") + } + if required.Points == nil { + return fmt.Errorf("Required field points missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Host = all.Host + o.Interval = all.Interval + o.Metric = all.Metric + o.Points = all.Points + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_service_check.go b/api/v1/datadog/model_service_check.go new file mode 100644 index 00000000000..aa85e14edb8 --- /dev/null +++ b/api/v1/datadog/model_service_check.go @@ -0,0 +1,288 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceCheck An object containing service check and status. +type ServiceCheck struct { + // The check. + Check string `json:"check"` + // The host name correlated with the check. + HostName string `json:"host_name"` + // Message containing check status. + Message *string `json:"message,omitempty"` + // The status of a service check. + Status ServiceCheckStatus `json:"status"` + // Tags related to a check. + Tags []string `json:"tags"` + // Time of check. + Timestamp *int64 `json:"timestamp,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{} +} + +// NewServiceCheck instantiates a new ServiceCheck 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 NewServiceCheck(check string, hostName string, status ServiceCheckStatus, tags []string) *ServiceCheck { + this := ServiceCheck{} + this.Check = check + this.HostName = hostName + this.Status = status + this.Tags = tags + return &this +} + +// NewServiceCheckWithDefaults instantiates a new ServiceCheck 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 NewServiceCheckWithDefaults() *ServiceCheck { + this := ServiceCheck{} + return &this +} + +// GetCheck returns the Check field value. +func (o *ServiceCheck) GetCheck() string { + if o == nil { + var ret string + return ret + } + return o.Check +} + +// GetCheckOk returns a tuple with the Check field value +// and a boolean to check if the value has been set. +func (o *ServiceCheck) GetCheckOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Check, true +} + +// SetCheck sets field value. +func (o *ServiceCheck) SetCheck(v string) { + o.Check = v +} + +// GetHostName returns the HostName field value. +func (o *ServiceCheck) GetHostName() string { + if o == nil { + var ret string + return ret + } + return o.HostName +} + +// GetHostNameOk returns a tuple with the HostName field value +// and a boolean to check if the value has been set. +func (o *ServiceCheck) GetHostNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.HostName, true +} + +// SetHostName sets field value. +func (o *ServiceCheck) SetHostName(v string) { + o.HostName = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ServiceCheck) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceCheck) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ServiceCheck) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ServiceCheck) SetMessage(v string) { + o.Message = &v +} + +// GetStatus returns the Status field value. +func (o *ServiceCheck) GetStatus() ServiceCheckStatus { + if o == nil { + var ret ServiceCheckStatus + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ServiceCheck) GetStatusOk() (*ServiceCheckStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value. +func (o *ServiceCheck) SetStatus(v ServiceCheckStatus) { + o.Status = v +} + +// GetTags returns the Tags field value. +func (o *ServiceCheck) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *ServiceCheck) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *ServiceCheck) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *ServiceCheck) GetTimestamp() int64 { + if o == nil || o.Timestamp == nil { + var ret int64 + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceCheck) GetTimestampOk() (*int64, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *ServiceCheck) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. +func (o *ServiceCheck) SetTimestamp(v int64) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceCheck) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["check"] = o.Check + toSerialize["host_name"] = o.HostName + if o.Message != nil { + toSerialize["message"] = o.Message + } + toSerialize["status"] = o.Status + toSerialize["tags"] = o.Tags + if o.Timestamp != nil { + toSerialize["timestamp"] = o.Timestamp + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceCheck) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Check *string `json:"check"` + HostName *string `json:"host_name"` + Status *ServiceCheckStatus `json:"status"` + Tags *[]string `json:"tags"` + }{} + all := struct { + Check string `json:"check"` + HostName string `json:"host_name"` + Message *string `json:"message,omitempty"` + Status ServiceCheckStatus `json:"status"` + Tags []string `json:"tags"` + Timestamp *int64 `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Check == nil { + return fmt.Errorf("Required field check missing") + } + if required.HostName == nil { + return fmt.Errorf("Required field host_name missing") + } + if required.Status == nil { + return fmt.Errorf("Required field status missing") + } + if required.Tags == nil { + return fmt.Errorf("Required field tags missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Check = all.Check + o.HostName = all.HostName + o.Message = all.Message + o.Status = all.Status + o.Tags = all.Tags + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v1/datadog/model_service_check_status.go b/api/v1/datadog/model_service_check_status.go new file mode 100644 index 00000000000..9ec8dbb9ffc --- /dev/null +++ b/api/v1/datadog/model_service_check_status.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceCheckStatus The status of a service check. +type ServiceCheckStatus int32 + +// List of ServiceCheckStatus. +const ( + SERVICECHECKSTATUS_OK ServiceCheckStatus = 0 + SERVICECHECKSTATUS_WARNING ServiceCheckStatus = 1 + SERVICECHECKSTATUS_CRITICAL ServiceCheckStatus = 2 + SERVICECHECKSTATUS_UNKNOWN ServiceCheckStatus = 3 +) + +var allowedServiceCheckStatusEnumValues = []ServiceCheckStatus{ + SERVICECHECKSTATUS_OK, + SERVICECHECKSTATUS_WARNING, + SERVICECHECKSTATUS_CRITICAL, + SERVICECHECKSTATUS_UNKNOWN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceCheckStatus) GetAllowedValues() []ServiceCheckStatus { + return allowedServiceCheckStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceCheckStatus) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceCheckStatus(value) + return nil +} + +// NewServiceCheckStatusFromValue returns a pointer to a valid ServiceCheckStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceCheckStatusFromValue(v int32) (*ServiceCheckStatus, error) { + ev := ServiceCheckStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceCheckStatus: valid values are %v", v, allowedServiceCheckStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceCheckStatus) IsValid() bool { + for _, existing := range allowedServiceCheckStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceCheckStatus value. +func (v ServiceCheckStatus) Ptr() *ServiceCheckStatus { + return &v +} + +// NullableServiceCheckStatus handles when a null is used for ServiceCheckStatus. +type NullableServiceCheckStatus struct { + value *ServiceCheckStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceCheckStatus) Get() *ServiceCheckStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceCheckStatus) Set(val *ServiceCheckStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceCheckStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceCheckStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceCheckStatus initializes the struct as if Set has been called. +func NewNullableServiceCheckStatus(val *ServiceCheckStatus) *NullableServiceCheckStatus { + return &NullableServiceCheckStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceCheckStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceCheckStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_service_level_objective.go b/api/v1/datadog/model_service_level_objective.go new file mode 100644 index 00000000000..f9c170f6fd7 --- /dev/null +++ b/api/v1/datadog/model_service_level_objective.go @@ -0,0 +1,619 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// ServiceLevelObjective A service level objective object includes a service level indicator, thresholds +// for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). +type ServiceLevelObjective struct { + // Creation timestamp (UNIX time in seconds) + // + // Always included in service level objective responses. + CreatedAt *int64 `json:"created_at,omitempty"` + // Object describing the creator of the shared element. + Creator *Creator `json:"creator,omitempty"` + // A user-defined description of the service level objective. + // + // Always included in service level objective responses (but may be `null`). + // Optional in create/update requests. + Description common.NullableString `json:"description,omitempty"` + // A list of (up to 100) monitor groups that narrow the scope of a monitor service level objective. + // + // Included in service level objective responses if it is not empty. Optional in + // create/update requests for monitor service level objectives, but may only be + // used when then length of the `monitor_ids` field is one. + Groups []string `json:"groups,omitempty"` + // A unique identifier for the service level objective object. + // + // Always included in service level objective responses. + Id *string `json:"id,omitempty"` + // Modification timestamp (UNIX time in seconds) + // + // Always included in service level objective responses. + ModifiedAt *int64 `json:"modified_at,omitempty"` + // A list of monitor ids that defines the scope of a monitor service level + // objective. **Required if type is `monitor`**. + MonitorIds []int64 `json:"monitor_ids,omitempty"` + // The union of monitor tags for all monitors referenced by the `monitor_ids` + // field. + // Always included in service level objective responses for monitor-based service level + // objectives (but may be empty). Ignored in create/update requests. Does not + // affect which monitors are included in the service level objective (that is + // determined entirely by the `monitor_ids` field). + MonitorTags []string `json:"monitor_tags,omitempty"` + // The name of the service level objective object. + Name string `json:"name"` + // A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator + // to be used because this will sum up all request counts instead of averaging them, or taking the max or + // min of all of those requests. + Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` + // A list of tags associated with this service level objective. + // Always included in service level objective responses (but may be empty). + // Optional in create/update requests. + Tags []string `json:"tags,omitempty"` + // The thresholds (timeframes and associated targets) for this service level + // objective object. + Thresholds []SLOThreshold `json:"thresholds"` + // The type of the service level objective. + Type SLOType `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{} +} + +// NewServiceLevelObjective instantiates a new ServiceLevelObjective 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 NewServiceLevelObjective(name string, thresholds []SLOThreshold, typeVar SLOType) *ServiceLevelObjective { + this := ServiceLevelObjective{} + this.Name = name + this.Thresholds = thresholds + this.Type = typeVar + return &this +} + +// NewServiceLevelObjectiveWithDefaults instantiates a new ServiceLevelObjective 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 NewServiceLevelObjectiveWithDefaults() *ServiceLevelObjective { + this := ServiceLevelObjective{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *ServiceLevelObjective) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetCreator() Creator { + if o == nil || o.Creator == nil { + var ret Creator + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetCreatorOk() (*Creator, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given Creator and assigns it to the Creator field. +func (o *ServiceLevelObjective) SetCreator(v Creator) { + o.Creator = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ServiceLevelObjective) GetDescription() string { + if o == nil || o.Description.Get() == nil { + var ret string + return ret + } + return *o.Description.Get() +} + +// GetDescriptionOk returns a tuple with the Description 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 *ServiceLevelObjective) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description.Get(), o.Description.IsSet() +} + +// HasDescription returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasDescription() bool { + if o != nil && o.Description.IsSet() { + return true + } + + return false +} + +// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. +func (o *ServiceLevelObjective) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *ServiceLevelObjective) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *ServiceLevelObjective) UnsetDescription() { + o.Description.Unset() +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetGroups() []string { + if o == nil || o.Groups == nil { + var ret []string + 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 *ServiceLevelObjective) GetGroupsOk() (*[]string, 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 *ServiceLevelObjective) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + +// SetGroups gets a reference to the given []string and assigns it to the Groups field. +func (o *ServiceLevelObjective) SetGroups(v []string) { + o.Groups = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ServiceLevelObjective) SetId(v string) { + o.Id = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetModifiedAt() int64 { + if o == nil || o.ModifiedAt == nil { + var ret int64 + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetModifiedAtOk() (*int64, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given int64 and assigns it to the ModifiedAt field. +func (o *ServiceLevelObjective) SetModifiedAt(v int64) { + o.ModifiedAt = &v +} + +// GetMonitorIds returns the MonitorIds field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetMonitorIds() []int64 { + if o == nil || o.MonitorIds == nil { + var ret []int64 + return ret + } + return o.MonitorIds +} + +// GetMonitorIdsOk returns a tuple with the MonitorIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetMonitorIdsOk() (*[]int64, bool) { + if o == nil || o.MonitorIds == nil { + return nil, false + } + return &o.MonitorIds, true +} + +// HasMonitorIds returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasMonitorIds() bool { + if o != nil && o.MonitorIds != nil { + return true + } + + return false +} + +// SetMonitorIds gets a reference to the given []int64 and assigns it to the MonitorIds field. +func (o *ServiceLevelObjective) SetMonitorIds(v []int64) { + o.MonitorIds = v +} + +// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetMonitorTags() []string { + if o == nil || o.MonitorTags == nil { + var ret []string + return ret + } + return o.MonitorTags +} + +// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetMonitorTagsOk() (*[]string, bool) { + if o == nil || o.MonitorTags == nil { + return nil, false + } + return &o.MonitorTags, true +} + +// HasMonitorTags returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasMonitorTags() bool { + if o != nil && o.MonitorTags != nil { + return true + } + + return false +} + +// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. +func (o *ServiceLevelObjective) SetMonitorTags(v []string) { + o.MonitorTags = v +} + +// GetName returns the Name field value. +func (o *ServiceLevelObjective) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ServiceLevelObjective) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetQuery() ServiceLevelObjectiveQuery { + if o == nil || o.Query == nil { + var ret ServiceLevelObjectiveQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetQueryOk() (*ServiceLevelObjectiveQuery, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *ServiceLevelObjective) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given ServiceLevelObjectiveQuery and assigns it to the Query field. +func (o *ServiceLevelObjective) SetQuery(v ServiceLevelObjectiveQuery) { + o.Query = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ServiceLevelObjective) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *ServiceLevelObjective) GetTagsOk() (*[]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 *ServiceLevelObjective) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ServiceLevelObjective) SetTags(v []string) { + o.Tags = v +} + +// GetThresholds returns the Thresholds field value. +func (o *ServiceLevelObjective) GetThresholds() []SLOThreshold { + if o == nil { + var ret []SLOThreshold + return ret + } + return o.Thresholds +} + +// GetThresholdsOk returns a tuple with the Thresholds field value +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjective) GetThresholdsOk() (*[]SLOThreshold, bool) { + if o == nil { + return nil, false + } + return &o.Thresholds, true +} + +// SetThresholds sets field value. +func (o *ServiceLevelObjective) SetThresholds(v []SLOThreshold) { + o.Thresholds = v +} + +// GetType returns the Type field value. +func (o *ServiceLevelObjective) GetType() SLOType { + if o == nil { + var ret SLOType + 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 *ServiceLevelObjective) GetTypeOk() (*SLOType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceLevelObjective) SetType(v SLOType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceLevelObjective) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.ModifiedAt != nil { + toSerialize["modified_at"] = o.ModifiedAt + } + if o.MonitorIds != nil { + toSerialize["monitor_ids"] = o.MonitorIds + } + if o.MonitorTags != nil { + toSerialize["monitor_tags"] = o.MonitorTags + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + toSerialize["thresholds"] = o.Thresholds + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Thresholds *[]SLOThreshold `json:"thresholds"` + Type *SLOType `json:"type"` + }{} + all := struct { + CreatedAt *int64 `json:"created_at,omitempty"` + Creator *Creator `json:"creator,omitempty"` + Description common.NullableString `json:"description,omitempty"` + Groups []string `json:"groups,omitempty"` + Id *string `json:"id,omitempty"` + ModifiedAt *int64 `json:"modified_at,omitempty"` + MonitorIds []int64 `json:"monitor_ids,omitempty"` + MonitorTags []string `json:"monitor_tags,omitempty"` + Name string `json:"name"` + Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` + Tags []string `json:"tags,omitempty"` + Thresholds []SLOThreshold `json:"thresholds"` + Type SLOType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Thresholds == nil { + return fmt.Errorf("Required field thresholds missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.Description = all.Description + o.Groups = all.Groups + o.Id = all.Id + o.ModifiedAt = all.ModifiedAt + o.MonitorIds = all.MonitorIds + o.MonitorTags = all.MonitorTags + o.Name = all.Name + if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Query = all.Query + o.Tags = all.Tags + o.Thresholds = all.Thresholds + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_service_level_objective_query.go b/api/v1/datadog/model_service_level_objective_query.go new file mode 100644 index 00000000000..7be49dae628 --- /dev/null +++ b/api/v1/datadog/model_service_level_objective_query.go @@ -0,0 +1,138 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceLevelObjectiveQuery A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator +// to be used because this will sum up all request counts instead of averaging them, or taking the max or +// min of all of those requests. +type ServiceLevelObjectiveQuery struct { + // A Datadog metric query for total (valid) events. + Denominator string `json:"denominator"` + // A Datadog metric query for good events. + Numerator string `json:"numerator"` + // 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{} +} + +// NewServiceLevelObjectiveQuery instantiates a new ServiceLevelObjectiveQuery 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 NewServiceLevelObjectiveQuery(denominator string, numerator string) *ServiceLevelObjectiveQuery { + this := ServiceLevelObjectiveQuery{} + this.Denominator = denominator + this.Numerator = numerator + return &this +} + +// NewServiceLevelObjectiveQueryWithDefaults instantiates a new ServiceLevelObjectiveQuery 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 NewServiceLevelObjectiveQueryWithDefaults() *ServiceLevelObjectiveQuery { + this := ServiceLevelObjectiveQuery{} + return &this +} + +// GetDenominator returns the Denominator field value. +func (o *ServiceLevelObjectiveQuery) GetDenominator() string { + if o == nil { + var ret string + return ret + } + return o.Denominator +} + +// GetDenominatorOk returns a tuple with the Denominator field value +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjectiveQuery) GetDenominatorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Denominator, true +} + +// SetDenominator sets field value. +func (o *ServiceLevelObjectiveQuery) SetDenominator(v string) { + o.Denominator = v +} + +// GetNumerator returns the Numerator field value. +func (o *ServiceLevelObjectiveQuery) GetNumerator() string { + if o == nil { + var ret string + return ret + } + return o.Numerator +} + +// GetNumeratorOk returns a tuple with the Numerator field value +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjectiveQuery) GetNumeratorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Numerator, true +} + +// SetNumerator sets field value. +func (o *ServiceLevelObjectiveQuery) SetNumerator(v string) { + o.Numerator = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceLevelObjectiveQuery) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["denominator"] = o.Denominator + toSerialize["numerator"] = o.Numerator + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceLevelObjectiveQuery) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Denominator *string `json:"denominator"` + Numerator *string `json:"numerator"` + }{} + all := struct { + Denominator string `json:"denominator"` + Numerator string `json:"numerator"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Denominator == nil { + return fmt.Errorf("Required field denominator missing") + } + if required.Numerator == nil { + return fmt.Errorf("Required field numerator missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Denominator = all.Denominator + o.Numerator = all.Numerator + return nil +} diff --git a/api/v1/datadog/model_service_level_objective_request.go b/api/v1/datadog/model_service_level_objective_request.go new file mode 100644 index 00000000000..bbed358168f --- /dev/null +++ b/api/v1/datadog/model_service_level_objective_request.go @@ -0,0 +1,406 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// ServiceLevelObjectiveRequest A service level objective object includes a service level indicator, thresholds +// for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). +type ServiceLevelObjectiveRequest struct { + // A user-defined description of the service level objective. + // + // Always included in service level objective responses (but may be `null`). + // Optional in create/update requests. + Description common.NullableString `json:"description,omitempty"` + // A list of (up to 100) monitor groups that narrow the scope of a monitor service level objective. + // + // Included in service level objective responses if it is not empty. Optional in + // create/update requests for monitor service level objectives, but may only be + // used when then length of the `monitor_ids` field is one. + Groups []string `json:"groups,omitempty"` + // A list of monitor IDs that defines the scope of a monitor service level + // objective. **Required if type is `monitor`**. + MonitorIds []int64 `json:"monitor_ids,omitempty"` + // The name of the service level objective object. + Name string `json:"name"` + // A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator + // to be used because this will sum up all request counts instead of averaging them, or taking the max or + // min of all of those requests. + Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` + // A list of tags associated with this service level objective. + // Always included in service level objective responses (but may be empty). + // Optional in create/update requests. + Tags []string `json:"tags,omitempty"` + // The thresholds (timeframes and associated targets) for this service level + // objective object. + Thresholds []SLOThreshold `json:"thresholds"` + // The type of the service level objective. + Type SLOType `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{} +} + +// NewServiceLevelObjectiveRequest instantiates a new ServiceLevelObjectiveRequest 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 NewServiceLevelObjectiveRequest(name string, thresholds []SLOThreshold, typeVar SLOType) *ServiceLevelObjectiveRequest { + this := ServiceLevelObjectiveRequest{} + this.Name = name + this.Thresholds = thresholds + this.Type = typeVar + return &this +} + +// NewServiceLevelObjectiveRequestWithDefaults instantiates a new ServiceLevelObjectiveRequest 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 NewServiceLevelObjectiveRequestWithDefaults() *ServiceLevelObjectiveRequest { + this := ServiceLevelObjectiveRequest{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ServiceLevelObjectiveRequest) GetDescription() string { + if o == nil || o.Description.Get() == nil { + var ret string + return ret + } + return *o.Description.Get() +} + +// GetDescriptionOk returns a tuple with the Description 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 *ServiceLevelObjectiveRequest) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description.Get(), o.Description.IsSet() +} + +// HasDescription returns a boolean if a field has been set. +func (o *ServiceLevelObjectiveRequest) HasDescription() bool { + if o != nil && o.Description.IsSet() { + return true + } + + return false +} + +// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. +func (o *ServiceLevelObjectiveRequest) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *ServiceLevelObjectiveRequest) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *ServiceLevelObjectiveRequest) UnsetDescription() { + o.Description.Unset() +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *ServiceLevelObjectiveRequest) GetGroups() []string { + if o == nil || o.Groups == nil { + var ret []string + 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 *ServiceLevelObjectiveRequest) GetGroupsOk() (*[]string, 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 *ServiceLevelObjectiveRequest) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + +// SetGroups gets a reference to the given []string and assigns it to the Groups field. +func (o *ServiceLevelObjectiveRequest) SetGroups(v []string) { + o.Groups = v +} + +// GetMonitorIds returns the MonitorIds field value if set, zero value otherwise. +func (o *ServiceLevelObjectiveRequest) GetMonitorIds() []int64 { + if o == nil || o.MonitorIds == nil { + var ret []int64 + return ret + } + return o.MonitorIds +} + +// GetMonitorIdsOk returns a tuple with the MonitorIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjectiveRequest) GetMonitorIdsOk() (*[]int64, bool) { + if o == nil || o.MonitorIds == nil { + return nil, false + } + return &o.MonitorIds, true +} + +// HasMonitorIds returns a boolean if a field has been set. +func (o *ServiceLevelObjectiveRequest) HasMonitorIds() bool { + if o != nil && o.MonitorIds != nil { + return true + } + + return false +} + +// SetMonitorIds gets a reference to the given []int64 and assigns it to the MonitorIds field. +func (o *ServiceLevelObjectiveRequest) SetMonitorIds(v []int64) { + o.MonitorIds = v +} + +// GetName returns the Name field value. +func (o *ServiceLevelObjectiveRequest) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjectiveRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ServiceLevelObjectiveRequest) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *ServiceLevelObjectiveRequest) GetQuery() ServiceLevelObjectiveQuery { + if o == nil || o.Query == nil { + var ret ServiceLevelObjectiveQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjectiveRequest) GetQueryOk() (*ServiceLevelObjectiveQuery, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *ServiceLevelObjectiveRequest) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given ServiceLevelObjectiveQuery and assigns it to the Query field. +func (o *ServiceLevelObjectiveRequest) SetQuery(v ServiceLevelObjectiveQuery) { + o.Query = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ServiceLevelObjectiveRequest) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *ServiceLevelObjectiveRequest) GetTagsOk() (*[]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 *ServiceLevelObjectiveRequest) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ServiceLevelObjectiveRequest) SetTags(v []string) { + o.Tags = v +} + +// GetThresholds returns the Thresholds field value. +func (o *ServiceLevelObjectiveRequest) GetThresholds() []SLOThreshold { + if o == nil { + var ret []SLOThreshold + return ret + } + return o.Thresholds +} + +// GetThresholdsOk returns a tuple with the Thresholds field value +// and a boolean to check if the value has been set. +func (o *ServiceLevelObjectiveRequest) GetThresholdsOk() (*[]SLOThreshold, bool) { + if o == nil { + return nil, false + } + return &o.Thresholds, true +} + +// SetThresholds sets field value. +func (o *ServiceLevelObjectiveRequest) SetThresholds(v []SLOThreshold) { + o.Thresholds = v +} + +// GetType returns the Type field value. +func (o *ServiceLevelObjectiveRequest) GetType() SLOType { + if o == nil { + var ret SLOType + 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 *ServiceLevelObjectiveRequest) GetTypeOk() (*SLOType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceLevelObjectiveRequest) SetType(v SLOType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceLevelObjectiveRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + if o.MonitorIds != nil { + toSerialize["monitor_ids"] = o.MonitorIds + } + toSerialize["name"] = o.Name + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + toSerialize["thresholds"] = o.Thresholds + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Thresholds *[]SLOThreshold `json:"thresholds"` + Type *SLOType `json:"type"` + }{} + all := struct { + Description common.NullableString `json:"description,omitempty"` + Groups []string `json:"groups,omitempty"` + MonitorIds []int64 `json:"monitor_ids,omitempty"` + Name string `json:"name"` + Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` + Tags []string `json:"tags,omitempty"` + Thresholds []SLOThreshold `json:"thresholds"` + Type SLOType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Thresholds == nil { + return fmt.Errorf("Required field thresholds missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Description = all.Description + o.Groups = all.Groups + o.MonitorIds = all.MonitorIds + o.Name = all.Name + if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Query = all.Query + o.Tags = all.Tags + o.Thresholds = all.Thresholds + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_service_map_widget_definition.go b/api/v1/datadog/model_service_map_widget_definition.go new file mode 100644 index 00000000000..fe064ee0f7f --- /dev/null +++ b/api/v1/datadog/model_service_map_widget_definition.go @@ -0,0 +1,343 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceMapWidgetDefinition This widget displays a map of a service to all of the services that call it, and all of the services that it calls. +type ServiceMapWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // Your environment and primary tag (or * if enabled for your account). + Filters []string `json:"filters"` + // The ID of the service you want to map. + Service string `json:"service"` + // The title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the service map widget. + Type ServiceMapWidgetDefinitionType `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{} +} + +// NewServiceMapWidgetDefinition instantiates a new ServiceMapWidgetDefinition 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 NewServiceMapWidgetDefinition(filters []string, service string, typeVar ServiceMapWidgetDefinitionType) *ServiceMapWidgetDefinition { + this := ServiceMapWidgetDefinition{} + this.Filters = filters + this.Service = service + this.Type = typeVar + return &this +} + +// NewServiceMapWidgetDefinitionWithDefaults instantiates a new ServiceMapWidgetDefinition 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 NewServiceMapWidgetDefinitionWithDefaults() *ServiceMapWidgetDefinition { + this := ServiceMapWidgetDefinition{} + var typeVar ServiceMapWidgetDefinitionType = SERVICEMAPWIDGETDEFINITIONTYPE_SERVICEMAP + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *ServiceMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *ServiceMapWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *ServiceMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetFilters returns the Filters field value. +func (o *ServiceMapWidgetDefinition) GetFilters() []string { + if o == nil { + var ret []string + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value +// and a boolean to check if the value has been set. +func (o *ServiceMapWidgetDefinition) GetFiltersOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Filters, true +} + +// SetFilters sets field value. +func (o *ServiceMapWidgetDefinition) SetFilters(v []string) { + o.Filters = v +} + +// GetService returns the Service field value. +func (o *ServiceMapWidgetDefinition) GetService() string { + if o == nil { + var ret string + return ret + } + return o.Service +} + +// GetServiceOk returns a tuple with the Service field value +// and a boolean to check if the value has been set. +func (o *ServiceMapWidgetDefinition) GetServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Service, true +} + +// SetService sets field value. +func (o *ServiceMapWidgetDefinition) SetService(v string) { + o.Service = v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *ServiceMapWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceMapWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *ServiceMapWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *ServiceMapWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *ServiceMapWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceMapWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *ServiceMapWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *ServiceMapWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *ServiceMapWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceMapWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *ServiceMapWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *ServiceMapWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *ServiceMapWidgetDefinition) GetType() ServiceMapWidgetDefinitionType { + if o == nil { + var ret ServiceMapWidgetDefinitionType + 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 *ServiceMapWidgetDefinition) GetTypeOk() (*ServiceMapWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceMapWidgetDefinition) SetType(v ServiceMapWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceMapWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + toSerialize["filters"] = o.Filters + toSerialize["service"] = o.Service + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Filters *[]string `json:"filters"` + Service *string `json:"service"` + Type *ServiceMapWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Filters []string `json:"filters"` + Service string `json:"service"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type ServiceMapWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Filters == nil { + return fmt.Errorf("Required field filters missing") + } + if required.Service == nil { + return fmt.Errorf("Required field service missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.Filters = all.Filters + o.Service = all.Service + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_service_map_widget_definition_type.go b/api/v1/datadog/model_service_map_widget_definition_type.go new file mode 100644 index 00000000000..f084b19964c --- /dev/null +++ b/api/v1/datadog/model_service_map_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceMapWidgetDefinitionType Type of the service map widget. +type ServiceMapWidgetDefinitionType string + +// List of ServiceMapWidgetDefinitionType. +const ( + SERVICEMAPWIDGETDEFINITIONTYPE_SERVICEMAP ServiceMapWidgetDefinitionType = "servicemap" +) + +var allowedServiceMapWidgetDefinitionTypeEnumValues = []ServiceMapWidgetDefinitionType{ + SERVICEMAPWIDGETDEFINITIONTYPE_SERVICEMAP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceMapWidgetDefinitionType) GetAllowedValues() []ServiceMapWidgetDefinitionType { + return allowedServiceMapWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceMapWidgetDefinitionType(value) + return nil +} + +// NewServiceMapWidgetDefinitionTypeFromValue returns a pointer to a valid ServiceMapWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceMapWidgetDefinitionTypeFromValue(v string) (*ServiceMapWidgetDefinitionType, error) { + ev := ServiceMapWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceMapWidgetDefinitionType: valid values are %v", v, allowedServiceMapWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceMapWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedServiceMapWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceMapWidgetDefinitionType value. +func (v ServiceMapWidgetDefinitionType) Ptr() *ServiceMapWidgetDefinitionType { + return &v +} + +// NullableServiceMapWidgetDefinitionType handles when a null is used for ServiceMapWidgetDefinitionType. +type NullableServiceMapWidgetDefinitionType struct { + value *ServiceMapWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceMapWidgetDefinitionType) Get() *ServiceMapWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceMapWidgetDefinitionType) Set(val *ServiceMapWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceMapWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceMapWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceMapWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableServiceMapWidgetDefinitionType(val *ServiceMapWidgetDefinitionType) *NullableServiceMapWidgetDefinitionType { + return &NullableServiceMapWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_service_summary_widget_definition.go b/api/v1/datadog/model_service_summary_widget_definition.go new file mode 100644 index 00000000000..a47b4a89fb3 --- /dev/null +++ b/api/v1/datadog/model_service_summary_widget_definition.go @@ -0,0 +1,711 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceSummaryWidgetDefinition The service summary displays the graphs of a chosen service in your screenboard. Only available on FREE layout dashboards. +type ServiceSummaryWidgetDefinition struct { + // Number of columns to display. + DisplayFormat *WidgetServiceSummaryDisplayFormat `json:"display_format,omitempty"` + // APM environment. + Env string `json:"env"` + // APM service. + Service string `json:"service"` + // Whether to show the latency breakdown or not. + ShowBreakdown *bool `json:"show_breakdown,omitempty"` + // Whether to show the latency distribution or not. + ShowDistribution *bool `json:"show_distribution,omitempty"` + // Whether to show the error metrics or not. + ShowErrors *bool `json:"show_errors,omitempty"` + // Whether to show the hits metrics or not. + ShowHits *bool `json:"show_hits,omitempty"` + // Whether to show the latency metrics or not. + ShowLatency *bool `json:"show_latency,omitempty"` + // Whether to show the resource list or not. + ShowResourceList *bool `json:"show_resource_list,omitempty"` + // Size of the widget. + SizeFormat *WidgetSizeFormat `json:"size_format,omitempty"` + // APM span name. + SpanName string `json:"span_name"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the service summary widget. + Type ServiceSummaryWidgetDefinitionType `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{} +} + +// NewServiceSummaryWidgetDefinition instantiates a new ServiceSummaryWidgetDefinition 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 NewServiceSummaryWidgetDefinition(env string, service string, spanName string, typeVar ServiceSummaryWidgetDefinitionType) *ServiceSummaryWidgetDefinition { + this := ServiceSummaryWidgetDefinition{} + this.Env = env + this.Service = service + this.SpanName = spanName + this.Type = typeVar + return &this +} + +// NewServiceSummaryWidgetDefinitionWithDefaults instantiates a new ServiceSummaryWidgetDefinition 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 NewServiceSummaryWidgetDefinitionWithDefaults() *ServiceSummaryWidgetDefinition { + this := ServiceSummaryWidgetDefinition{} + var typeVar ServiceSummaryWidgetDefinitionType = SERVICESUMMARYWIDGETDEFINITIONTYPE_TRACE_SERVICE + this.Type = typeVar + return &this +} + +// GetDisplayFormat returns the DisplayFormat field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetDisplayFormat() WidgetServiceSummaryDisplayFormat { + if o == nil || o.DisplayFormat == nil { + var ret WidgetServiceSummaryDisplayFormat + return ret + } + return *o.DisplayFormat +} + +// GetDisplayFormatOk returns a tuple with the DisplayFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetDisplayFormatOk() (*WidgetServiceSummaryDisplayFormat, bool) { + if o == nil || o.DisplayFormat == nil { + return nil, false + } + return o.DisplayFormat, true +} + +// HasDisplayFormat returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasDisplayFormat() bool { + if o != nil && o.DisplayFormat != nil { + return true + } + + return false +} + +// SetDisplayFormat gets a reference to the given WidgetServiceSummaryDisplayFormat and assigns it to the DisplayFormat field. +func (o *ServiceSummaryWidgetDefinition) SetDisplayFormat(v WidgetServiceSummaryDisplayFormat) { + o.DisplayFormat = &v +} + +// GetEnv returns the Env field value. +func (o *ServiceSummaryWidgetDefinition) GetEnv() string { + if o == nil { + var ret string + return ret + } + return o.Env +} + +// GetEnvOk returns a tuple with the Env field value +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetEnvOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Env, true +} + +// SetEnv sets field value. +func (o *ServiceSummaryWidgetDefinition) SetEnv(v string) { + o.Env = v +} + +// GetService returns the Service field value. +func (o *ServiceSummaryWidgetDefinition) GetService() string { + if o == nil { + var ret string + return ret + } + return o.Service +} + +// GetServiceOk returns a tuple with the Service field value +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Service, true +} + +// SetService sets field value. +func (o *ServiceSummaryWidgetDefinition) SetService(v string) { + o.Service = v +} + +// GetShowBreakdown returns the ShowBreakdown field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetShowBreakdown() bool { + if o == nil || o.ShowBreakdown == nil { + var ret bool + return ret + } + return *o.ShowBreakdown +} + +// GetShowBreakdownOk returns a tuple with the ShowBreakdown field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetShowBreakdownOk() (*bool, bool) { + if o == nil || o.ShowBreakdown == nil { + return nil, false + } + return o.ShowBreakdown, true +} + +// HasShowBreakdown returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasShowBreakdown() bool { + if o != nil && o.ShowBreakdown != nil { + return true + } + + return false +} + +// SetShowBreakdown gets a reference to the given bool and assigns it to the ShowBreakdown field. +func (o *ServiceSummaryWidgetDefinition) SetShowBreakdown(v bool) { + o.ShowBreakdown = &v +} + +// GetShowDistribution returns the ShowDistribution field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetShowDistribution() bool { + if o == nil || o.ShowDistribution == nil { + var ret bool + return ret + } + return *o.ShowDistribution +} + +// GetShowDistributionOk returns a tuple with the ShowDistribution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetShowDistributionOk() (*bool, bool) { + if o == nil || o.ShowDistribution == nil { + return nil, false + } + return o.ShowDistribution, true +} + +// HasShowDistribution returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasShowDistribution() bool { + if o != nil && o.ShowDistribution != nil { + return true + } + + return false +} + +// SetShowDistribution gets a reference to the given bool and assigns it to the ShowDistribution field. +func (o *ServiceSummaryWidgetDefinition) SetShowDistribution(v bool) { + o.ShowDistribution = &v +} + +// GetShowErrors returns the ShowErrors field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetShowErrors() bool { + if o == nil || o.ShowErrors == nil { + var ret bool + return ret + } + return *o.ShowErrors +} + +// GetShowErrorsOk returns a tuple with the ShowErrors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetShowErrorsOk() (*bool, bool) { + if o == nil || o.ShowErrors == nil { + return nil, false + } + return o.ShowErrors, true +} + +// HasShowErrors returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasShowErrors() bool { + if o != nil && o.ShowErrors != nil { + return true + } + + return false +} + +// SetShowErrors gets a reference to the given bool and assigns it to the ShowErrors field. +func (o *ServiceSummaryWidgetDefinition) SetShowErrors(v bool) { + o.ShowErrors = &v +} + +// GetShowHits returns the ShowHits field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetShowHits() bool { + if o == nil || o.ShowHits == nil { + var ret bool + return ret + } + return *o.ShowHits +} + +// GetShowHitsOk returns a tuple with the ShowHits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetShowHitsOk() (*bool, bool) { + if o == nil || o.ShowHits == nil { + return nil, false + } + return o.ShowHits, true +} + +// HasShowHits returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasShowHits() bool { + if o != nil && o.ShowHits != nil { + return true + } + + return false +} + +// SetShowHits gets a reference to the given bool and assigns it to the ShowHits field. +func (o *ServiceSummaryWidgetDefinition) SetShowHits(v bool) { + o.ShowHits = &v +} + +// GetShowLatency returns the ShowLatency field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetShowLatency() bool { + if o == nil || o.ShowLatency == nil { + var ret bool + return ret + } + return *o.ShowLatency +} + +// GetShowLatencyOk returns a tuple with the ShowLatency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetShowLatencyOk() (*bool, bool) { + if o == nil || o.ShowLatency == nil { + return nil, false + } + return o.ShowLatency, true +} + +// HasShowLatency returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasShowLatency() bool { + if o != nil && o.ShowLatency != nil { + return true + } + + return false +} + +// SetShowLatency gets a reference to the given bool and assigns it to the ShowLatency field. +func (o *ServiceSummaryWidgetDefinition) SetShowLatency(v bool) { + o.ShowLatency = &v +} + +// GetShowResourceList returns the ShowResourceList field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetShowResourceList() bool { + if o == nil || o.ShowResourceList == nil { + var ret bool + return ret + } + return *o.ShowResourceList +} + +// GetShowResourceListOk returns a tuple with the ShowResourceList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetShowResourceListOk() (*bool, bool) { + if o == nil || o.ShowResourceList == nil { + return nil, false + } + return o.ShowResourceList, true +} + +// HasShowResourceList returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasShowResourceList() bool { + if o != nil && o.ShowResourceList != nil { + return true + } + + return false +} + +// SetShowResourceList gets a reference to the given bool and assigns it to the ShowResourceList field. +func (o *ServiceSummaryWidgetDefinition) SetShowResourceList(v bool) { + o.ShowResourceList = &v +} + +// GetSizeFormat returns the SizeFormat field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetSizeFormat() WidgetSizeFormat { + if o == nil || o.SizeFormat == nil { + var ret WidgetSizeFormat + return ret + } + return *o.SizeFormat +} + +// GetSizeFormatOk returns a tuple with the SizeFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetSizeFormatOk() (*WidgetSizeFormat, bool) { + if o == nil || o.SizeFormat == nil { + return nil, false + } + return o.SizeFormat, true +} + +// HasSizeFormat returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasSizeFormat() bool { + if o != nil && o.SizeFormat != nil { + return true + } + + return false +} + +// SetSizeFormat gets a reference to the given WidgetSizeFormat and assigns it to the SizeFormat field. +func (o *ServiceSummaryWidgetDefinition) SetSizeFormat(v WidgetSizeFormat) { + o.SizeFormat = &v +} + +// GetSpanName returns the SpanName field value. +func (o *ServiceSummaryWidgetDefinition) GetSpanName() string { + if o == nil { + var ret string + return ret + } + return o.SpanName +} + +// GetSpanNameOk returns a tuple with the SpanName field value +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetSpanNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SpanName, true +} + +// SetSpanName sets field value. +func (o *ServiceSummaryWidgetDefinition) SetSpanName(v string) { + o.SpanName = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *ServiceSummaryWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *ServiceSummaryWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *ServiceSummaryWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *ServiceSummaryWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceSummaryWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *ServiceSummaryWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *ServiceSummaryWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *ServiceSummaryWidgetDefinition) GetType() ServiceSummaryWidgetDefinitionType { + if o == nil { + var ret ServiceSummaryWidgetDefinitionType + 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 *ServiceSummaryWidgetDefinition) GetTypeOk() (*ServiceSummaryWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceSummaryWidgetDefinition) SetType(v ServiceSummaryWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DisplayFormat != nil { + toSerialize["display_format"] = o.DisplayFormat + } + toSerialize["env"] = o.Env + toSerialize["service"] = o.Service + if o.ShowBreakdown != nil { + toSerialize["show_breakdown"] = o.ShowBreakdown + } + if o.ShowDistribution != nil { + toSerialize["show_distribution"] = o.ShowDistribution + } + if o.ShowErrors != nil { + toSerialize["show_errors"] = o.ShowErrors + } + if o.ShowHits != nil { + toSerialize["show_hits"] = o.ShowHits + } + if o.ShowLatency != nil { + toSerialize["show_latency"] = o.ShowLatency + } + if o.ShowResourceList != nil { + toSerialize["show_resource_list"] = o.ShowResourceList + } + if o.SizeFormat != nil { + toSerialize["size_format"] = o.SizeFormat + } + toSerialize["span_name"] = o.SpanName + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Env *string `json:"env"` + Service *string `json:"service"` + SpanName *string `json:"span_name"` + Type *ServiceSummaryWidgetDefinitionType `json:"type"` + }{} + all := struct { + DisplayFormat *WidgetServiceSummaryDisplayFormat `json:"display_format,omitempty"` + Env string `json:"env"` + Service string `json:"service"` + ShowBreakdown *bool `json:"show_breakdown,omitempty"` + ShowDistribution *bool `json:"show_distribution,omitempty"` + ShowErrors *bool `json:"show_errors,omitempty"` + ShowHits *bool `json:"show_hits,omitempty"` + ShowLatency *bool `json:"show_latency,omitempty"` + ShowResourceList *bool `json:"show_resource_list,omitempty"` + SizeFormat *WidgetSizeFormat `json:"size_format,omitempty"` + SpanName string `json:"span_name"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type ServiceSummaryWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Env == nil { + return fmt.Errorf("Required field env missing") + } + if required.Service == nil { + return fmt.Errorf("Required field service missing") + } + if required.SpanName == nil { + return fmt.Errorf("Required field span_name missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DisplayFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.SizeFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DisplayFormat = all.DisplayFormat + o.Env = all.Env + o.Service = all.Service + o.ShowBreakdown = all.ShowBreakdown + o.ShowDistribution = all.ShowDistribution + o.ShowErrors = all.ShowErrors + o.ShowHits = all.ShowHits + o.ShowLatency = all.ShowLatency + o.ShowResourceList = all.ShowResourceList + o.SizeFormat = all.SizeFormat + o.SpanName = all.SpanName + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_service_summary_widget_definition_type.go b/api/v1/datadog/model_service_summary_widget_definition_type.go new file mode 100644 index 00000000000..dce7f9690f4 --- /dev/null +++ b/api/v1/datadog/model_service_summary_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceSummaryWidgetDefinitionType Type of the service summary widget. +type ServiceSummaryWidgetDefinitionType string + +// List of ServiceSummaryWidgetDefinitionType. +const ( + SERVICESUMMARYWIDGETDEFINITIONTYPE_TRACE_SERVICE ServiceSummaryWidgetDefinitionType = "trace_service" +) + +var allowedServiceSummaryWidgetDefinitionTypeEnumValues = []ServiceSummaryWidgetDefinitionType{ + SERVICESUMMARYWIDGETDEFINITIONTYPE_TRACE_SERVICE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ServiceSummaryWidgetDefinitionType) GetAllowedValues() []ServiceSummaryWidgetDefinitionType { + return allowedServiceSummaryWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ServiceSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ServiceSummaryWidgetDefinitionType(value) + return nil +} + +// NewServiceSummaryWidgetDefinitionTypeFromValue returns a pointer to a valid ServiceSummaryWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewServiceSummaryWidgetDefinitionTypeFromValue(v string) (*ServiceSummaryWidgetDefinitionType, error) { + ev := ServiceSummaryWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ServiceSummaryWidgetDefinitionType: valid values are %v", v, allowedServiceSummaryWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ServiceSummaryWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedServiceSummaryWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ServiceSummaryWidgetDefinitionType value. +func (v ServiceSummaryWidgetDefinitionType) Ptr() *ServiceSummaryWidgetDefinitionType { + return &v +} + +// NullableServiceSummaryWidgetDefinitionType handles when a null is used for ServiceSummaryWidgetDefinitionType. +type NullableServiceSummaryWidgetDefinitionType struct { + value *ServiceSummaryWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableServiceSummaryWidgetDefinitionType) Get() *ServiceSummaryWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableServiceSummaryWidgetDefinitionType) Set(val *ServiceSummaryWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableServiceSummaryWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableServiceSummaryWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableServiceSummaryWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableServiceSummaryWidgetDefinitionType(val *ServiceSummaryWidgetDefinitionType) *NullableServiceSummaryWidgetDefinitionType { + return &NullableServiceSummaryWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableServiceSummaryWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableServiceSummaryWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_signal_archive_reason.go b/api/v1/datadog/model_signal_archive_reason.go new file mode 100644 index 00000000000..88fac37466a --- /dev/null +++ b/api/v1/datadog/model_signal_archive_reason.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SignalArchiveReason Reason why a signal has been archived. +type SignalArchiveReason string + +// List of SignalArchiveReason. +const ( + SIGNALARCHIVEREASON_NONE SignalArchiveReason = "none" + SIGNALARCHIVEREASON_FALSE_POSITIVE SignalArchiveReason = "false_positive" + SIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE SignalArchiveReason = "testing_or_maintenance" + SIGNALARCHIVEREASON_OTHER SignalArchiveReason = "other" +) + +var allowedSignalArchiveReasonEnumValues = []SignalArchiveReason{ + SIGNALARCHIVEREASON_NONE, + SIGNALARCHIVEREASON_FALSE_POSITIVE, + SIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE, + SIGNALARCHIVEREASON_OTHER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SignalArchiveReason) GetAllowedValues() []SignalArchiveReason { + return allowedSignalArchiveReasonEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SignalArchiveReason) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SignalArchiveReason(value) + return nil +} + +// NewSignalArchiveReasonFromValue returns a pointer to a valid SignalArchiveReason +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSignalArchiveReasonFromValue(v string) (*SignalArchiveReason, error) { + ev := SignalArchiveReason(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SignalArchiveReason: valid values are %v", v, allowedSignalArchiveReasonEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SignalArchiveReason) IsValid() bool { + for _, existing := range allowedSignalArchiveReasonEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SignalArchiveReason value. +func (v SignalArchiveReason) Ptr() *SignalArchiveReason { + return &v +} + +// NullableSignalArchiveReason handles when a null is used for SignalArchiveReason. +type NullableSignalArchiveReason struct { + value *SignalArchiveReason + isSet bool +} + +// Get returns the associated value. +func (v NullableSignalArchiveReason) Get() *SignalArchiveReason { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSignalArchiveReason) Set(val *SignalArchiveReason) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSignalArchiveReason) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSignalArchiveReason) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSignalArchiveReason initializes the struct as if Set has been called. +func NewNullableSignalArchiveReason(val *SignalArchiveReason) *NullableSignalArchiveReason { + return &NullableSignalArchiveReason{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSignalArchiveReason) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSignalArchiveReason) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_signal_assignee_update_request.go b/api/v1/datadog/model_signal_assignee_update_request.go new file mode 100644 index 00000000000..713825df8e8 --- /dev/null +++ b/api/v1/datadog/model_signal_assignee_update_request.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SignalAssigneeUpdateRequest Attributes describing an assignee update operation over a security signal. +type SignalAssigneeUpdateRequest struct { + // The UUID of the user being assigned. Use empty string to return signal to unassigned. + Assignee string `json:"assignee"` + // Version of the updated signal. If server side version is higher, update will be rejected. + Version *int64 `json:"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{} +} + +// NewSignalAssigneeUpdateRequest instantiates a new SignalAssigneeUpdateRequest 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 NewSignalAssigneeUpdateRequest(assignee string) *SignalAssigneeUpdateRequest { + this := SignalAssigneeUpdateRequest{} + this.Assignee = assignee + return &this +} + +// NewSignalAssigneeUpdateRequestWithDefaults instantiates a new SignalAssigneeUpdateRequest 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 NewSignalAssigneeUpdateRequestWithDefaults() *SignalAssigneeUpdateRequest { + this := SignalAssigneeUpdateRequest{} + return &this +} + +// GetAssignee returns the Assignee field value. +func (o *SignalAssigneeUpdateRequest) GetAssignee() string { + if o == nil { + var ret string + return ret + } + return o.Assignee +} + +// GetAssigneeOk returns a tuple with the Assignee field value +// and a boolean to check if the value has been set. +func (o *SignalAssigneeUpdateRequest) GetAssigneeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Assignee, true +} + +// SetAssignee sets field value. +func (o *SignalAssigneeUpdateRequest) SetAssignee(v string) { + o.Assignee = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SignalAssigneeUpdateRequest) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalAssigneeUpdateRequest) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SignalAssigneeUpdateRequest) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SignalAssigneeUpdateRequest) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SignalAssigneeUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["assignee"] = o.Assignee + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Assignee *string `json:"assignee"` + }{} + all := struct { + Assignee string `json:"assignee"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Assignee == nil { + return fmt.Errorf("Required field assignee missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Assignee = all.Assignee + o.Version = all.Version + return nil +} diff --git a/api/v1/datadog/model_signal_state_update_request.go b/api/v1/datadog/model_signal_state_update_request.go new file mode 100644 index 00000000000..3d24a6d99fc --- /dev/null +++ b/api/v1/datadog/model_signal_state_update_request.go @@ -0,0 +1,236 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SignalStateUpdateRequest Attributes describing the change of state for a given state. +type SignalStateUpdateRequest struct { + // Optional comment to explain why a signal is being archived. + ArchiveComment *string `json:"archiveComment,omitempty"` + // Reason why a signal has been archived. + ArchiveReason *SignalArchiveReason `json:"archiveReason,omitempty"` + // The new triage state of the signal. + State SignalTriageState `json:"state"` + // Version of the updated signal. If server side version is higher, update will be rejected. + Version *int64 `json:"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{} +} + +// NewSignalStateUpdateRequest instantiates a new SignalStateUpdateRequest 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 NewSignalStateUpdateRequest(state SignalTriageState) *SignalStateUpdateRequest { + this := SignalStateUpdateRequest{} + this.State = state + return &this +} + +// NewSignalStateUpdateRequestWithDefaults instantiates a new SignalStateUpdateRequest 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 NewSignalStateUpdateRequestWithDefaults() *SignalStateUpdateRequest { + this := SignalStateUpdateRequest{} + return &this +} + +// GetArchiveComment returns the ArchiveComment field value if set, zero value otherwise. +func (o *SignalStateUpdateRequest) GetArchiveComment() string { + if o == nil || o.ArchiveComment == nil { + var ret string + return ret + } + return *o.ArchiveComment +} + +// GetArchiveCommentOk returns a tuple with the ArchiveComment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalStateUpdateRequest) GetArchiveCommentOk() (*string, bool) { + if o == nil || o.ArchiveComment == nil { + return nil, false + } + return o.ArchiveComment, true +} + +// HasArchiveComment returns a boolean if a field has been set. +func (o *SignalStateUpdateRequest) HasArchiveComment() bool { + if o != nil && o.ArchiveComment != nil { + return true + } + + return false +} + +// SetArchiveComment gets a reference to the given string and assigns it to the ArchiveComment field. +func (o *SignalStateUpdateRequest) SetArchiveComment(v string) { + o.ArchiveComment = &v +} + +// GetArchiveReason returns the ArchiveReason field value if set, zero value otherwise. +func (o *SignalStateUpdateRequest) GetArchiveReason() SignalArchiveReason { + if o == nil || o.ArchiveReason == nil { + var ret SignalArchiveReason + return ret + } + return *o.ArchiveReason +} + +// GetArchiveReasonOk returns a tuple with the ArchiveReason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalStateUpdateRequest) GetArchiveReasonOk() (*SignalArchiveReason, bool) { + if o == nil || o.ArchiveReason == nil { + return nil, false + } + return o.ArchiveReason, true +} + +// HasArchiveReason returns a boolean if a field has been set. +func (o *SignalStateUpdateRequest) HasArchiveReason() bool { + if o != nil && o.ArchiveReason != nil { + return true + } + + return false +} + +// SetArchiveReason gets a reference to the given SignalArchiveReason and assigns it to the ArchiveReason field. +func (o *SignalStateUpdateRequest) SetArchiveReason(v SignalArchiveReason) { + o.ArchiveReason = &v +} + +// GetState returns the State field value. +func (o *SignalStateUpdateRequest) GetState() SignalTriageState { + if o == nil { + var ret SignalTriageState + return ret + } + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *SignalStateUpdateRequest) GetStateOk() (*SignalTriageState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value. +func (o *SignalStateUpdateRequest) SetState(v SignalTriageState) { + o.State = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SignalStateUpdateRequest) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SignalStateUpdateRequest) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SignalStateUpdateRequest) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SignalStateUpdateRequest) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SignalStateUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ArchiveComment != nil { + toSerialize["archiveComment"] = o.ArchiveComment + } + if o.ArchiveReason != nil { + toSerialize["archiveReason"] = o.ArchiveReason + } + toSerialize["state"] = o.State + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + State *SignalTriageState `json:"state"` + }{} + all := struct { + ArchiveComment *string `json:"archiveComment,omitempty"` + ArchiveReason *SignalArchiveReason `json:"archiveReason,omitempty"` + State SignalTriageState `json:"state"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.State == nil { + return fmt.Errorf("Required field state missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ArchiveReason; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.State; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ArchiveComment = all.ArchiveComment + o.ArchiveReason = all.ArchiveReason + o.State = all.State + o.Version = all.Version + return nil +} diff --git a/api/v1/datadog/model_signal_triage_state.go b/api/v1/datadog/model_signal_triage_state.go new file mode 100644 index 00000000000..fb063fd04d9 --- /dev/null +++ b/api/v1/datadog/model_signal_triage_state.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SignalTriageState The new triage state of the signal. +type SignalTriageState string + +// List of SignalTriageState. +const ( + SIGNALTRIAGESTATE_OPEN SignalTriageState = "open" + SIGNALTRIAGESTATE_ARCHIVED SignalTriageState = "archived" + SIGNALTRIAGESTATE_UNDER_REVIEW SignalTriageState = "under_review" +) + +var allowedSignalTriageStateEnumValues = []SignalTriageState{ + SIGNALTRIAGESTATE_OPEN, + SIGNALTRIAGESTATE_ARCHIVED, + SIGNALTRIAGESTATE_UNDER_REVIEW, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SignalTriageState) GetAllowedValues() []SignalTriageState { + return allowedSignalTriageStateEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SignalTriageState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SignalTriageState(value) + return nil +} + +// NewSignalTriageStateFromValue returns a pointer to a valid SignalTriageState +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSignalTriageStateFromValue(v string) (*SignalTriageState, error) { + ev := SignalTriageState(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SignalTriageState: valid values are %v", v, allowedSignalTriageStateEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SignalTriageState) IsValid() bool { + for _, existing := range allowedSignalTriageStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SignalTriageState value. +func (v SignalTriageState) Ptr() *SignalTriageState { + return &v +} + +// NullableSignalTriageState handles when a null is used for SignalTriageState. +type NullableSignalTriageState struct { + value *SignalTriageState + isSet bool +} + +// Get returns the associated value. +func (v NullableSignalTriageState) Get() *SignalTriageState { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSignalTriageState) Set(val *SignalTriageState) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSignalTriageState) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSignalTriageState) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSignalTriageState initializes the struct as if Set has been called. +func NewNullableSignalTriageState(val *SignalTriageState) *NullableSignalTriageState { + return &NullableSignalTriageState{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSignalTriageState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSignalTriageState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slack_integration_channel.go b/api/v1/datadog/model_slack_integration_channel.go new file mode 100644 index 00000000000..daaddef9075 --- /dev/null +++ b/api/v1/datadog/model_slack_integration_channel.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 datadog + +import ( + "encoding/json" +) + +// SlackIntegrationChannel The Slack channel configuration. +type SlackIntegrationChannel struct { + // Configuration options for what is shown in an alert event message. + Display *SlackIntegrationChannelDisplay `json:"display,omitempty"` + // Your channel name. + Name *string `json:"name,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{} +} + +// NewSlackIntegrationChannel instantiates a new SlackIntegrationChannel 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 NewSlackIntegrationChannel() *SlackIntegrationChannel { + this := SlackIntegrationChannel{} + return &this +} + +// NewSlackIntegrationChannelWithDefaults instantiates a new SlackIntegrationChannel 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 NewSlackIntegrationChannelWithDefaults() *SlackIntegrationChannel { + this := SlackIntegrationChannel{} + return &this +} + +// GetDisplay returns the Display field value if set, zero value otherwise. +func (o *SlackIntegrationChannel) GetDisplay() SlackIntegrationChannelDisplay { + if o == nil || o.Display == nil { + var ret SlackIntegrationChannelDisplay + return ret + } + return *o.Display +} + +// GetDisplayOk returns a tuple with the Display field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlackIntegrationChannel) GetDisplayOk() (*SlackIntegrationChannelDisplay, bool) { + if o == nil || o.Display == nil { + return nil, false + } + return o.Display, true +} + +// HasDisplay returns a boolean if a field has been set. +func (o *SlackIntegrationChannel) HasDisplay() bool { + if o != nil && o.Display != nil { + return true + } + + return false +} + +// SetDisplay gets a reference to the given SlackIntegrationChannelDisplay and assigns it to the Display field. +func (o *SlackIntegrationChannel) SetDisplay(v SlackIntegrationChannelDisplay) { + o.Display = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SlackIntegrationChannel) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlackIntegrationChannel) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SlackIntegrationChannel) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SlackIntegrationChannel) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SlackIntegrationChannel) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Display != nil { + toSerialize["display"] = o.Display + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SlackIntegrationChannel) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Display *SlackIntegrationChannelDisplay `json:"display,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Display != nil && all.Display.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Display = all.Display + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_slack_integration_channel_display.go b/api/v1/datadog/model_slack_integration_channel_display.go new file mode 100644 index 00000000000..6d886bc1c45 --- /dev/null +++ b/api/v1/datadog/model_slack_integration_channel_display.go @@ -0,0 +1,235 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SlackIntegrationChannelDisplay Configuration options for what is shown in an alert event message. +type SlackIntegrationChannelDisplay struct { + // Show the main body of the alert event. + Message *bool `json:"message,omitempty"` + // Show the list of @-handles in the alert event. + Notified *bool `json:"notified,omitempty"` + // Show the alert event's snapshot image. + Snapshot *bool `json:"snapshot,omitempty"` + // Show the scopes on which the monitor alerted. + Tags *bool `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{} +} + +// NewSlackIntegrationChannelDisplay instantiates a new SlackIntegrationChannelDisplay 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 NewSlackIntegrationChannelDisplay() *SlackIntegrationChannelDisplay { + this := SlackIntegrationChannelDisplay{} + var message bool = true + this.Message = &message + var notified bool = true + this.Notified = ¬ified + var snapshot bool = true + this.Snapshot = &snapshot + var tags bool = true + this.Tags = &tags + return &this +} + +// NewSlackIntegrationChannelDisplayWithDefaults instantiates a new SlackIntegrationChannelDisplay 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 NewSlackIntegrationChannelDisplayWithDefaults() *SlackIntegrationChannelDisplay { + this := SlackIntegrationChannelDisplay{} + var message bool = true + this.Message = &message + var notified bool = true + this.Notified = ¬ified + var snapshot bool = true + this.Snapshot = &snapshot + var tags bool = true + this.Tags = &tags + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SlackIntegrationChannelDisplay) GetMessage() bool { + if o == nil || o.Message == nil { + var ret bool + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlackIntegrationChannelDisplay) GetMessageOk() (*bool, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SlackIntegrationChannelDisplay) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given bool and assigns it to the Message field. +func (o *SlackIntegrationChannelDisplay) SetMessage(v bool) { + o.Message = &v +} + +// GetNotified returns the Notified field value if set, zero value otherwise. +func (o *SlackIntegrationChannelDisplay) GetNotified() bool { + if o == nil || o.Notified == nil { + var ret bool + return ret + } + return *o.Notified +} + +// GetNotifiedOk returns a tuple with the Notified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlackIntegrationChannelDisplay) GetNotifiedOk() (*bool, bool) { + if o == nil || o.Notified == nil { + return nil, false + } + return o.Notified, true +} + +// HasNotified returns a boolean if a field has been set. +func (o *SlackIntegrationChannelDisplay) HasNotified() bool { + if o != nil && o.Notified != nil { + return true + } + + return false +} + +// SetNotified gets a reference to the given bool and assigns it to the Notified field. +func (o *SlackIntegrationChannelDisplay) SetNotified(v bool) { + o.Notified = &v +} + +// GetSnapshot returns the Snapshot field value if set, zero value otherwise. +func (o *SlackIntegrationChannelDisplay) GetSnapshot() bool { + if o == nil || o.Snapshot == nil { + var ret bool + return ret + } + return *o.Snapshot +} + +// GetSnapshotOk returns a tuple with the Snapshot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlackIntegrationChannelDisplay) GetSnapshotOk() (*bool, bool) { + if o == nil || o.Snapshot == nil { + return nil, false + } + return o.Snapshot, true +} + +// HasSnapshot returns a boolean if a field has been set. +func (o *SlackIntegrationChannelDisplay) HasSnapshot() bool { + if o != nil && o.Snapshot != nil { + return true + } + + return false +} + +// SetSnapshot gets a reference to the given bool and assigns it to the Snapshot field. +func (o *SlackIntegrationChannelDisplay) SetSnapshot(v bool) { + o.Snapshot = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SlackIntegrationChannelDisplay) GetTags() bool { + if o == nil || o.Tags == nil { + var ret bool + 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 *SlackIntegrationChannelDisplay) GetTagsOk() (*bool, 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 *SlackIntegrationChannelDisplay) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given bool and assigns it to the Tags field. +func (o *SlackIntegrationChannelDisplay) SetTags(v bool) { + o.Tags = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SlackIntegrationChannelDisplay) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Notified != nil { + toSerialize["notified"] = o.Notified + } + if o.Snapshot != nil { + toSerialize["snapshot"] = o.Snapshot + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SlackIntegrationChannelDisplay) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Message *bool `json:"message,omitempty"` + Notified *bool `json:"notified,omitempty"` + Snapshot *bool `json:"snapshot,omitempty"` + Tags *bool `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Message = all.Message + o.Notified = all.Notified + o.Snapshot = all.Snapshot + o.Tags = all.Tags + return nil +} diff --git a/api/v1/datadog/model_slo_bulk_delete_error.go b/api/v1/datadog/model_slo_bulk_delete_error.go new file mode 100644 index 00000000000..9be42bd43c4 --- /dev/null +++ b/api/v1/datadog/model_slo_bulk_delete_error.go @@ -0,0 +1,179 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOBulkDeleteError Object describing the error. +type SLOBulkDeleteError struct { + // The ID of the service level objective object associated with + // this error. + Id string `json:"id"` + // The error message. + Message string `json:"message"` + // The timeframe of the threshold associated with this error + // or "all" if all thresholds are affected. + Timeframe SLOErrorTimeframe `json:"timeframe"` + // 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{} +} + +// NewSLOBulkDeleteError instantiates a new SLOBulkDeleteError 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 NewSLOBulkDeleteError(id string, message string, timeframe SLOErrorTimeframe) *SLOBulkDeleteError { + this := SLOBulkDeleteError{} + this.Id = id + this.Message = message + this.Timeframe = timeframe + return &this +} + +// NewSLOBulkDeleteErrorWithDefaults instantiates a new SLOBulkDeleteError 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 NewSLOBulkDeleteErrorWithDefaults() *SLOBulkDeleteError { + this := SLOBulkDeleteError{} + return &this +} + +// GetId returns the Id field value. +func (o *SLOBulkDeleteError) 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 *SLOBulkDeleteError) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SLOBulkDeleteError) SetId(v string) { + o.Id = v +} + +// GetMessage returns the Message field value. +func (o *SLOBulkDeleteError) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *SLOBulkDeleteError) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *SLOBulkDeleteError) SetMessage(v string) { + o.Message = v +} + +// GetTimeframe returns the Timeframe field value. +func (o *SLOBulkDeleteError) GetTimeframe() SLOErrorTimeframe { + if o == nil { + var ret SLOErrorTimeframe + return ret + } + return o.Timeframe +} + +// GetTimeframeOk returns a tuple with the Timeframe field value +// and a boolean to check if the value has been set. +func (o *SLOBulkDeleteError) GetTimeframeOk() (*SLOErrorTimeframe, bool) { + if o == nil { + return nil, false + } + return &o.Timeframe, true +} + +// SetTimeframe sets field value. +func (o *SLOBulkDeleteError) SetTimeframe(v SLOErrorTimeframe) { + o.Timeframe = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOBulkDeleteError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["message"] = o.Message + toSerialize["timeframe"] = o.Timeframe + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOBulkDeleteError) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Message *string `json:"message"` + Timeframe *SLOErrorTimeframe `json:"timeframe"` + }{} + all := struct { + Id string `json:"id"` + Message string `json:"message"` + Timeframe SLOErrorTimeframe `json:"timeframe"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + if required.Timeframe == nil { + return fmt.Errorf("Required field timeframe missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Timeframe; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Message = all.Message + o.Timeframe = all.Timeframe + return nil +} diff --git a/api/v1/datadog/model_slo_bulk_delete_response.go b/api/v1/datadog/model_slo_bulk_delete_response.go new file mode 100644 index 00000000000..10842fa95e3 --- /dev/null +++ b/api/v1/datadog/model_slo_bulk_delete_response.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOBulkDeleteResponse The bulk partial delete service level objective object endpoint +// response. +// +// This endpoint operates on multiple service level objective objects, so +// it may be partially successful. In such cases, the "data" and "error" +// fields in this response indicate which deletions succeeded and failed. +type SLOBulkDeleteResponse struct { + // An array of service level objective objects. + Data *SLOBulkDeleteResponseData `json:"data,omitempty"` + // Array of errors object returned. + Errors []SLOBulkDeleteError `json:"errors,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{} +} + +// NewSLOBulkDeleteResponse instantiates a new SLOBulkDeleteResponse 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 NewSLOBulkDeleteResponse() *SLOBulkDeleteResponse { + this := SLOBulkDeleteResponse{} + return &this +} + +// NewSLOBulkDeleteResponseWithDefaults instantiates a new SLOBulkDeleteResponse 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 NewSLOBulkDeleteResponseWithDefaults() *SLOBulkDeleteResponse { + this := SLOBulkDeleteResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOBulkDeleteResponse) GetData() SLOBulkDeleteResponseData { + if o == nil || o.Data == nil { + var ret SLOBulkDeleteResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOBulkDeleteResponse) GetDataOk() (*SLOBulkDeleteResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOBulkDeleteResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SLOBulkDeleteResponseData and assigns it to the Data field. +func (o *SLOBulkDeleteResponse) SetData(v SLOBulkDeleteResponseData) { + o.Data = &v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *SLOBulkDeleteResponse) GetErrors() []SLOBulkDeleteError { + if o == nil || o.Errors == nil { + var ret []SLOBulkDeleteError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOBulkDeleteResponse) GetErrorsOk() (*[]SLOBulkDeleteError, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *SLOBulkDeleteResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []SLOBulkDeleteError and assigns it to the Errors field. +func (o *SLOBulkDeleteResponse) SetErrors(v []SLOBulkDeleteError) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOBulkDeleteResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOBulkDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SLOBulkDeleteResponseData `json:"data,omitempty"` + Errors []SLOBulkDeleteError `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Errors = all.Errors + return nil +} diff --git a/api/v1/datadog/model_slo_bulk_delete_response_data.go b/api/v1/datadog/model_slo_bulk_delete_response_data.go new file mode 100644 index 00000000000..d2aad858bb9 --- /dev/null +++ b/api/v1/datadog/model_slo_bulk_delete_response_data.go @@ -0,0 +1,144 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOBulkDeleteResponseData An array of service level objective objects. +type SLOBulkDeleteResponseData struct { + // An array of service level objective object IDs that indicates + // which objects that were completely deleted. + Deleted []string `json:"deleted,omitempty"` + // An array of service level objective object IDs that indicates + // which objects that were modified (objects for which at least one + // threshold was deleted, but that were not completely deleted). + Updated []string `json:"updated,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{} +} + +// NewSLOBulkDeleteResponseData instantiates a new SLOBulkDeleteResponseData 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 NewSLOBulkDeleteResponseData() *SLOBulkDeleteResponseData { + this := SLOBulkDeleteResponseData{} + return &this +} + +// NewSLOBulkDeleteResponseDataWithDefaults instantiates a new SLOBulkDeleteResponseData 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 NewSLOBulkDeleteResponseDataWithDefaults() *SLOBulkDeleteResponseData { + this := SLOBulkDeleteResponseData{} + return &this +} + +// GetDeleted returns the Deleted field value if set, zero value otherwise. +func (o *SLOBulkDeleteResponseData) GetDeleted() []string { + if o == nil || o.Deleted == nil { + var ret []string + return ret + } + return o.Deleted +} + +// GetDeletedOk returns a tuple with the Deleted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOBulkDeleteResponseData) GetDeletedOk() (*[]string, bool) { + if o == nil || o.Deleted == nil { + return nil, false + } + return &o.Deleted, true +} + +// HasDeleted returns a boolean if a field has been set. +func (o *SLOBulkDeleteResponseData) HasDeleted() bool { + if o != nil && o.Deleted != nil { + return true + } + + return false +} + +// SetDeleted gets a reference to the given []string and assigns it to the Deleted field. +func (o *SLOBulkDeleteResponseData) SetDeleted(v []string) { + o.Deleted = v +} + +// GetUpdated returns the Updated field value if set, zero value otherwise. +func (o *SLOBulkDeleteResponseData) GetUpdated() []string { + if o == nil || o.Updated == nil { + var ret []string + return ret + } + return o.Updated +} + +// GetUpdatedOk returns a tuple with the Updated field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOBulkDeleteResponseData) GetUpdatedOk() (*[]string, bool) { + if o == nil || o.Updated == nil { + return nil, false + } + return &o.Updated, true +} + +// HasUpdated returns a boolean if a field has been set. +func (o *SLOBulkDeleteResponseData) HasUpdated() bool { + if o != nil && o.Updated != nil { + return true + } + + return false +} + +// SetUpdated gets a reference to the given []string and assigns it to the Updated field. +func (o *SLOBulkDeleteResponseData) SetUpdated(v []string) { + o.Updated = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOBulkDeleteResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Deleted != nil { + toSerialize["deleted"] = o.Deleted + } + if o.Updated != nil { + toSerialize["updated"] = o.Updated + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOBulkDeleteResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Deleted []string `json:"deleted,omitempty"` + Updated []string `json:"updated,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Deleted = all.Deleted + o.Updated = all.Updated + return nil +} diff --git a/api/v1/datadog/model_slo_correction.go b/api/v1/datadog/model_slo_correction.go new file mode 100644 index 00000000000..20e96341580 --- /dev/null +++ b/api/v1/datadog/model_slo_correction.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOCorrection The response object of a list of SLO corrections. +type SLOCorrection struct { + // The attribute object associated with the SLO correction. + Attributes *SLOCorrectionResponseAttributes `json:"attributes,omitempty"` + // The ID of the SLO correction. + Id *string `json:"id,omitempty"` + // SLO correction resource type. + Type *SLOCorrectionType `json:"type,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{} +} + +// NewSLOCorrection instantiates a new SLOCorrection 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 NewSLOCorrection() *SLOCorrection { + this := SLOCorrection{} + var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION + this.Type = &typeVar + return &this +} + +// NewSLOCorrectionWithDefaults instantiates a new SLOCorrection 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 NewSLOCorrectionWithDefaults() *SLOCorrection { + this := SLOCorrection{} + var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SLOCorrection) GetAttributes() SLOCorrectionResponseAttributes { + if o == nil || o.Attributes == nil { + var ret SLOCorrectionResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrection) GetAttributesOk() (*SLOCorrectionResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SLOCorrection) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SLOCorrectionResponseAttributes and assigns it to the Attributes field. +func (o *SLOCorrection) SetAttributes(v SLOCorrectionResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SLOCorrection) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrection) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SLOCorrection) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SLOCorrection) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SLOCorrection) GetType() SLOCorrectionType { + if o == nil || o.Type == nil { + var ret SLOCorrectionType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrection) GetTypeOk() (*SLOCorrectionType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SLOCorrection) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SLOCorrectionType and assigns it to the Type field. +func (o *SLOCorrection) SetType(v SLOCorrectionType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrection) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrection) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *SLOCorrectionResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SLOCorrectionType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_slo_correction_category.go b/api/v1/datadog/model_slo_correction_category.go new file mode 100644 index 00000000000..3a4bdc40304 --- /dev/null +++ b/api/v1/datadog/model_slo_correction_category.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOCorrectionCategory Category the SLO correction belongs to. +type SLOCorrectionCategory string + +// List of SLOCorrectionCategory. +const ( + SLOCORRECTIONCATEGORY_SCHEDULED_MAINTENANCE SLOCorrectionCategory = "Scheduled Maintenance" + SLOCORRECTIONCATEGORY_OUTSIDE_BUSINESS_HOURS SLOCorrectionCategory = "Outside Business Hours" + SLOCORRECTIONCATEGORY_DEPLOYMENT SLOCorrectionCategory = "Deployment" + SLOCORRECTIONCATEGORY_OTHER SLOCorrectionCategory = "Other" +) + +var allowedSLOCorrectionCategoryEnumValues = []SLOCorrectionCategory{ + SLOCORRECTIONCATEGORY_SCHEDULED_MAINTENANCE, + SLOCORRECTIONCATEGORY_OUTSIDE_BUSINESS_HOURS, + SLOCORRECTIONCATEGORY_DEPLOYMENT, + SLOCORRECTIONCATEGORY_OTHER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SLOCorrectionCategory) GetAllowedValues() []SLOCorrectionCategory { + return allowedSLOCorrectionCategoryEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SLOCorrectionCategory) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SLOCorrectionCategory(value) + return nil +} + +// NewSLOCorrectionCategoryFromValue returns a pointer to a valid SLOCorrectionCategory +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSLOCorrectionCategoryFromValue(v string) (*SLOCorrectionCategory, error) { + ev := SLOCorrectionCategory(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SLOCorrectionCategory: valid values are %v", v, allowedSLOCorrectionCategoryEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SLOCorrectionCategory) IsValid() bool { + for _, existing := range allowedSLOCorrectionCategoryEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SLOCorrectionCategory value. +func (v SLOCorrectionCategory) Ptr() *SLOCorrectionCategory { + return &v +} + +// NullableSLOCorrectionCategory handles when a null is used for SLOCorrectionCategory. +type NullableSLOCorrectionCategory struct { + value *SLOCorrectionCategory + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOCorrectionCategory) Get() *SLOCorrectionCategory { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOCorrectionCategory) Set(val *SLOCorrectionCategory) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOCorrectionCategory) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSLOCorrectionCategory) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOCorrectionCategory initializes the struct as if Set has been called. +func NewNullableSLOCorrectionCategory(val *SLOCorrectionCategory) *NullableSLOCorrectionCategory { + return &NullableSLOCorrectionCategory{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOCorrectionCategory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOCorrectionCategory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_correction_create_data.go b/api/v1/datadog/model_slo_correction_create_data.go new file mode 100644 index 00000000000..34f7477eaf3 --- /dev/null +++ b/api/v1/datadog/model_slo_correction_create_data.go @@ -0,0 +1,159 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOCorrectionCreateData The data object associated with the SLO correction to be created. +type SLOCorrectionCreateData struct { + // The attribute object associated with the SLO correction to be created. + Attributes *SLOCorrectionCreateRequestAttributes `json:"attributes,omitempty"` + // SLO correction resource type. + Type SLOCorrectionType `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{} +} + +// NewSLOCorrectionCreateData instantiates a new SLOCorrectionCreateData 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 NewSLOCorrectionCreateData(typeVar SLOCorrectionType) *SLOCorrectionCreateData { + this := SLOCorrectionCreateData{} + this.Type = typeVar + return &this +} + +// NewSLOCorrectionCreateDataWithDefaults instantiates a new SLOCorrectionCreateData 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 NewSLOCorrectionCreateDataWithDefaults() *SLOCorrectionCreateData { + this := SLOCorrectionCreateData{} + var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SLOCorrectionCreateData) GetAttributes() SLOCorrectionCreateRequestAttributes { + if o == nil || o.Attributes == nil { + var ret SLOCorrectionCreateRequestAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateData) GetAttributesOk() (*SLOCorrectionCreateRequestAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SLOCorrectionCreateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SLOCorrectionCreateRequestAttributes and assigns it to the Attributes field. +func (o *SLOCorrectionCreateData) SetAttributes(v SLOCorrectionCreateRequestAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *SLOCorrectionCreateData) GetType() SLOCorrectionType { + if o == nil { + var ret SLOCorrectionType + 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 *SLOCorrectionCreateData) GetTypeOk() (*SLOCorrectionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SLOCorrectionCreateData) SetType(v SLOCorrectionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *SLOCorrectionType `json:"type"` + }{} + all := struct { + Attributes *SLOCorrectionCreateRequestAttributes `json:"attributes,omitempty"` + Type SLOCorrectionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_slo_correction_create_request.go b/api/v1/datadog/model_slo_correction_create_request.go new file mode 100644 index 00000000000..e8d0bc1ffbf --- /dev/null +++ b/api/v1/datadog/model_slo_correction_create_request.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOCorrectionCreateRequest An object that defines a correction to be applied to an SLO. +type SLOCorrectionCreateRequest struct { + // The data object associated with the SLO correction to be created. + Data *SLOCorrectionCreateData `json:"data,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{} +} + +// NewSLOCorrectionCreateRequest instantiates a new SLOCorrectionCreateRequest 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 NewSLOCorrectionCreateRequest() *SLOCorrectionCreateRequest { + this := SLOCorrectionCreateRequest{} + return &this +} + +// NewSLOCorrectionCreateRequestWithDefaults instantiates a new SLOCorrectionCreateRequest 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 NewSLOCorrectionCreateRequestWithDefaults() *SLOCorrectionCreateRequest { + this := SLOCorrectionCreateRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOCorrectionCreateRequest) GetData() SLOCorrectionCreateData { + if o == nil || o.Data == nil { + var ret SLOCorrectionCreateData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequest) GetDataOk() (*SLOCorrectionCreateData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOCorrectionCreateRequest) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SLOCorrectionCreateData and assigns it to the Data field. +func (o *SLOCorrectionCreateRequest) SetData(v SLOCorrectionCreateData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SLOCorrectionCreateData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_slo_correction_create_request_attributes.go b/api/v1/datadog/model_slo_correction_create_request_attributes.go new file mode 100644 index 00000000000..ca14fa7295d --- /dev/null +++ b/api/v1/datadog/model_slo_correction_create_request_attributes.go @@ -0,0 +1,373 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOCorrectionCreateRequestAttributes The attribute object associated with the SLO correction to be created. +type SLOCorrectionCreateRequestAttributes struct { + // Category the SLO correction belongs to. + Category SLOCorrectionCategory `json:"category"` + // Description of the correction being made. + Description *string `json:"description,omitempty"` + // Length of time (in seconds) for a specified `rrule` recurring SLO correction. + Duration *int64 `json:"duration,omitempty"` + // Ending time of the correction in epoch seconds. + End *int64 `json:"end,omitempty"` + // The recurrence rules as defined in the iCalendar RFC 5545. The supported rules for SLO corrections + // are `FREQ`, `INTERVAL`, `COUNT` and `UNTIL`. + Rrule *string `json:"rrule,omitempty"` + // ID of the SLO that this correction applies to. + SloId string `json:"slo_id"` + // Starting time of the correction in epoch seconds. + Start int64 `json:"start"` + // The timezone to display in the UI for the correction times (defaults to "UTC"). + Timezone *string `json:"timezone,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{} +} + +// NewSLOCorrectionCreateRequestAttributes instantiates a new SLOCorrectionCreateRequestAttributes 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 NewSLOCorrectionCreateRequestAttributes(category SLOCorrectionCategory, sloId string, start int64) *SLOCorrectionCreateRequestAttributes { + this := SLOCorrectionCreateRequestAttributes{} + this.Category = category + this.SloId = sloId + this.Start = start + return &this +} + +// NewSLOCorrectionCreateRequestAttributesWithDefaults instantiates a new SLOCorrectionCreateRequestAttributes 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 NewSLOCorrectionCreateRequestAttributesWithDefaults() *SLOCorrectionCreateRequestAttributes { + this := SLOCorrectionCreateRequestAttributes{} + return &this +} + +// GetCategory returns the Category field value. +func (o *SLOCorrectionCreateRequestAttributes) GetCategory() SLOCorrectionCategory { + if o == nil { + var ret SLOCorrectionCategory + return ret + } + return o.Category +} + +// GetCategoryOk returns a tuple with the Category field value +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetCategoryOk() (*SLOCorrectionCategory, bool) { + if o == nil { + return nil, false + } + return &o.Category, true +} + +// SetCategory sets field value. +func (o *SLOCorrectionCreateRequestAttributes) SetCategory(v SLOCorrectionCategory) { + o.Category = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SLOCorrectionCreateRequestAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *SLOCorrectionCreateRequestAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SLOCorrectionCreateRequestAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *SLOCorrectionCreateRequestAttributes) GetDuration() int64 { + if o == nil || o.Duration == nil { + var ret int64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetDurationOk() (*int64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *SLOCorrectionCreateRequestAttributes) HasDuration() bool { + if o != nil && o.Duration != nil { + return true + } + + return false +} + +// SetDuration gets a reference to the given int64 and assigns it to the Duration field. +func (o *SLOCorrectionCreateRequestAttributes) SetDuration(v int64) { + o.Duration = &v +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *SLOCorrectionCreateRequestAttributes) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *SLOCorrectionCreateRequestAttributes) HasEnd() bool { + if o != nil && o.End != nil { + return true + } + + return false +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *SLOCorrectionCreateRequestAttributes) SetEnd(v int64) { + o.End = &v +} + +// GetRrule returns the Rrule field value if set, zero value otherwise. +func (o *SLOCorrectionCreateRequestAttributes) GetRrule() string { + if o == nil || o.Rrule == nil { + var ret string + return ret + } + return *o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetRruleOk() (*string, bool) { + if o == nil || o.Rrule == nil { + return nil, false + } + return o.Rrule, true +} + +// HasRrule returns a boolean if a field has been set. +func (o *SLOCorrectionCreateRequestAttributes) HasRrule() bool { + if o != nil && o.Rrule != nil { + return true + } + + return false +} + +// SetRrule gets a reference to the given string and assigns it to the Rrule field. +func (o *SLOCorrectionCreateRequestAttributes) SetRrule(v string) { + o.Rrule = &v +} + +// GetSloId returns the SloId field value. +func (o *SLOCorrectionCreateRequestAttributes) GetSloId() string { + if o == nil { + var ret string + return ret + } + return o.SloId +} + +// GetSloIdOk returns a tuple with the SloId field value +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetSloIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SloId, true +} + +// SetSloId sets field value. +func (o *SLOCorrectionCreateRequestAttributes) SetSloId(v string) { + o.SloId = v +} + +// GetStart returns the Start field value. +func (o *SLOCorrectionCreateRequestAttributes) GetStart() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Start +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetStartOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Start, true +} + +// SetStart sets field value. +func (o *SLOCorrectionCreateRequestAttributes) SetStart(v int64) { + o.Start = v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *SLOCorrectionCreateRequestAttributes) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionCreateRequestAttributes) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *SLOCorrectionCreateRequestAttributes) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *SLOCorrectionCreateRequestAttributes) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionCreateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["category"] = o.Category + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Rrule != nil { + toSerialize["rrule"] = o.Rrule + } + toSerialize["slo_id"] = o.SloId + toSerialize["start"] = o.Start + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Category *SLOCorrectionCategory `json:"category"` + SloId *string `json:"slo_id"` + Start *int64 `json:"start"` + }{} + all := struct { + Category SLOCorrectionCategory `json:"category"` + Description *string `json:"description,omitempty"` + Duration *int64 `json:"duration,omitempty"` + End *int64 `json:"end,omitempty"` + Rrule *string `json:"rrule,omitempty"` + SloId string `json:"slo_id"` + Start int64 `json:"start"` + Timezone *string `json:"timezone,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Category == nil { + return fmt.Errorf("Required field category missing") + } + if required.SloId == nil { + return fmt.Errorf("Required field slo_id missing") + } + if required.Start == nil { + return fmt.Errorf("Required field start missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Category; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Category = all.Category + o.Description = all.Description + o.Duration = all.Duration + o.End = all.End + o.Rrule = all.Rrule + o.SloId = all.SloId + o.Start = all.Start + o.Timezone = all.Timezone + return nil +} diff --git a/api/v1/datadog/model_slo_correction_list_response.go b/api/v1/datadog/model_slo_correction_list_response.go new file mode 100644 index 00000000000..30635615de6 --- /dev/null +++ b/api/v1/datadog/model_slo_correction_list_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 datadog + +import ( + "encoding/json" +) + +// SLOCorrectionListResponse A list of SLO correction objects. +type SLOCorrectionListResponse struct { + // The list of of SLO corrections objects. + Data []SLOCorrection `json:"data,omitempty"` + // Object describing meta attributes of response. + Meta *ResponseMetaAttributes `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{} +} + +// NewSLOCorrectionListResponse instantiates a new SLOCorrectionListResponse 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 NewSLOCorrectionListResponse() *SLOCorrectionListResponse { + this := SLOCorrectionListResponse{} + return &this +} + +// NewSLOCorrectionListResponseWithDefaults instantiates a new SLOCorrectionListResponse 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 NewSLOCorrectionListResponseWithDefaults() *SLOCorrectionListResponse { + this := SLOCorrectionListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOCorrectionListResponse) GetData() []SLOCorrection { + if o == nil || o.Data == nil { + var ret []SLOCorrection + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionListResponse) GetDataOk() (*[]SLOCorrection, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOCorrectionListResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []SLOCorrection and assigns it to the Data field. +func (o *SLOCorrectionListResponse) SetData(v []SLOCorrection) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SLOCorrectionListResponse) GetMeta() ResponseMetaAttributes { + if o == nil || o.Meta == nil { + var ret ResponseMetaAttributes + 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 *SLOCorrectionListResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *SLOCorrectionListResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. +func (o *SLOCorrectionListResponse) SetMeta(v ResponseMetaAttributes) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []SLOCorrection `json:"data,omitempty"` + Meta *ResponseMetaAttributes `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v1/datadog/model_slo_correction_response.go b/api/v1/datadog/model_slo_correction_response.go new file mode 100644 index 00000000000..ea64e447c76 --- /dev/null +++ b/api/v1/datadog/model_slo_correction_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOCorrectionResponse The response object of an SLO correction. +type SLOCorrectionResponse struct { + // The response object of a list of SLO corrections. + Data *SLOCorrection `json:"data,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{} +} + +// NewSLOCorrectionResponse instantiates a new SLOCorrectionResponse 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 NewSLOCorrectionResponse() *SLOCorrectionResponse { + this := SLOCorrectionResponse{} + return &this +} + +// NewSLOCorrectionResponseWithDefaults instantiates a new SLOCorrectionResponse 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 NewSLOCorrectionResponseWithDefaults() *SLOCorrectionResponse { + this := SLOCorrectionResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOCorrectionResponse) GetData() SLOCorrection { + if o == nil || o.Data == nil { + var ret SLOCorrection + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponse) GetDataOk() (*SLOCorrection, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOCorrectionResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SLOCorrection and assigns it to the Data field. +func (o *SLOCorrectionResponse) SetData(v SLOCorrection) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SLOCorrection `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_slo_correction_response_attributes.go b/api/v1/datadog/model_slo_correction_response_attributes.go new file mode 100644 index 00000000000..731ee1bd0f2 --- /dev/null +++ b/api/v1/datadog/model_slo_correction_response_attributes.go @@ -0,0 +1,582 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SLOCorrectionResponseAttributes The attribute object associated with the SLO correction. +type SLOCorrectionResponseAttributes struct { + // Category the SLO correction belongs to. + Category *SLOCorrectionCategory `json:"category,omitempty"` + // The epoch timestamp of when the correction was created at. + CreatedAt *int64 `json:"created_at,omitempty"` + // Object describing the creator of the shared element. + Creator *Creator `json:"creator,omitempty"` + // Description of the correction being made. + Description *string `json:"description,omitempty"` + // Length of time (in seconds) for a specified `rrule` recurring SLO correction. + Duration common.NullableInt64 `json:"duration,omitempty"` + // Ending time of the correction in epoch seconds. + End *int64 `json:"end,omitempty"` + // The epoch timestamp of when the correction was modified at. + ModifiedAt *int64 `json:"modified_at,omitempty"` + // Modifier of the object. + Modifier NullableSLOCorrectionResponseAttributesModifier `json:"modifier,omitempty"` + // The recurrence rules as defined in the iCalendar RFC 5545. The supported rules for SLO corrections + // are `FREQ`, `INTERVAL`, `COUNT`, and `UNTIL`. + Rrule common.NullableString `json:"rrule,omitempty"` + // ID of the SLO that this correction applies to. + SloId *string `json:"slo_id,omitempty"` + // Starting time of the correction in epoch seconds. + Start *int64 `json:"start,omitempty"` + // The timezone to display in the UI for the correction times (defaults to "UTC"). + Timezone *string `json:"timezone,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{} +} + +// NewSLOCorrectionResponseAttributes instantiates a new SLOCorrectionResponseAttributes 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 NewSLOCorrectionResponseAttributes() *SLOCorrectionResponseAttributes { + this := SLOCorrectionResponseAttributes{} + return &this +} + +// NewSLOCorrectionResponseAttributesWithDefaults instantiates a new SLOCorrectionResponseAttributes 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 NewSLOCorrectionResponseAttributesWithDefaults() *SLOCorrectionResponseAttributes { + this := SLOCorrectionResponseAttributes{} + return &this +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetCategory() SLOCorrectionCategory { + if o == nil || o.Category == nil { + var ret SLOCorrectionCategory + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetCategoryOk() (*SLOCorrectionCategory, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasCategory() bool { + if o != nil && o.Category != nil { + return true + } + + return false +} + +// SetCategory gets a reference to the given SLOCorrectionCategory and assigns it to the Category field. +func (o *SLOCorrectionResponseAttributes) SetCategory(v SLOCorrectionCategory) { + o.Category = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *SLOCorrectionResponseAttributes) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetCreator() Creator { + if o == nil || o.Creator == nil { + var ret Creator + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetCreatorOk() (*Creator, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given Creator and assigns it to the Creator field. +func (o *SLOCorrectionResponseAttributes) SetCreator(v Creator) { + o.Creator = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SLOCorrectionResponseAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SLOCorrectionResponseAttributes) GetDuration() int64 { + if o == nil || o.Duration.Get() == nil { + var ret int64 + return ret + } + return *o.Duration.Get() +} + +// GetDurationOk returns a tuple with the Duration 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 *SLOCorrectionResponseAttributes) GetDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Duration.Get(), o.Duration.IsSet() +} + +// HasDuration returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasDuration() bool { + if o != nil && o.Duration.IsSet() { + return true + } + + return false +} + +// SetDuration gets a reference to the given common.NullableInt64 and assigns it to the Duration field. +func (o *SLOCorrectionResponseAttributes) SetDuration(v int64) { + o.Duration.Set(&v) +} + +// SetDurationNil sets the value for Duration to be an explicit nil. +func (o *SLOCorrectionResponseAttributes) SetDurationNil() { + o.Duration.Set(nil) +} + +// UnsetDuration ensures that no value is present for Duration, not even an explicit nil. +func (o *SLOCorrectionResponseAttributes) UnsetDuration() { + o.Duration.Unset() +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasEnd() bool { + if o != nil && o.End != nil { + return true + } + + return false +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *SLOCorrectionResponseAttributes) SetEnd(v int64) { + o.End = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetModifiedAt() int64 { + if o == nil || o.ModifiedAt == nil { + var ret int64 + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetModifiedAtOk() (*int64, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given int64 and assigns it to the ModifiedAt field. +func (o *SLOCorrectionResponseAttributes) SetModifiedAt(v int64) { + o.ModifiedAt = &v +} + +// GetModifier returns the Modifier field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SLOCorrectionResponseAttributes) GetModifier() SLOCorrectionResponseAttributesModifier { + if o == nil || o.Modifier.Get() == nil { + var ret SLOCorrectionResponseAttributesModifier + return ret + } + return *o.Modifier.Get() +} + +// GetModifierOk returns a tuple with the Modifier 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 *SLOCorrectionResponseAttributes) GetModifierOk() (*SLOCorrectionResponseAttributesModifier, bool) { + if o == nil { + return nil, false + } + return o.Modifier.Get(), o.Modifier.IsSet() +} + +// HasModifier returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasModifier() bool { + if o != nil && o.Modifier.IsSet() { + return true + } + + return false +} + +// SetModifier gets a reference to the given NullableSLOCorrectionResponseAttributesModifier and assigns it to the Modifier field. +func (o *SLOCorrectionResponseAttributes) SetModifier(v SLOCorrectionResponseAttributesModifier) { + o.Modifier.Set(&v) +} + +// SetModifierNil sets the value for Modifier to be an explicit nil. +func (o *SLOCorrectionResponseAttributes) SetModifierNil() { + o.Modifier.Set(nil) +} + +// UnsetModifier ensures that no value is present for Modifier, not even an explicit nil. +func (o *SLOCorrectionResponseAttributes) UnsetModifier() { + o.Modifier.Unset() +} + +// GetRrule returns the Rrule field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SLOCorrectionResponseAttributes) GetRrule() string { + if o == nil || o.Rrule.Get() == nil { + var ret string + return ret + } + return *o.Rrule.Get() +} + +// GetRruleOk returns a tuple with the Rrule 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 *SLOCorrectionResponseAttributes) GetRruleOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Rrule.Get(), o.Rrule.IsSet() +} + +// HasRrule returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasRrule() bool { + if o != nil && o.Rrule.IsSet() { + return true + } + + return false +} + +// SetRrule gets a reference to the given common.NullableString and assigns it to the Rrule field. +func (o *SLOCorrectionResponseAttributes) SetRrule(v string) { + o.Rrule.Set(&v) +} + +// SetRruleNil sets the value for Rrule to be an explicit nil. +func (o *SLOCorrectionResponseAttributes) SetRruleNil() { + o.Rrule.Set(nil) +} + +// UnsetRrule ensures that no value is present for Rrule, not even an explicit nil. +func (o *SLOCorrectionResponseAttributes) UnsetRrule() { + o.Rrule.Unset() +} + +// GetSloId returns the SloId field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetSloId() string { + if o == nil || o.SloId == nil { + var ret string + return ret + } + return *o.SloId +} + +// GetSloIdOk returns a tuple with the SloId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetSloIdOk() (*string, bool) { + if o == nil || o.SloId == nil { + return nil, false + } + return o.SloId, true +} + +// HasSloId returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasSloId() bool { + if o != nil && o.SloId != nil { + return true + } + + return false +} + +// SetSloId gets a reference to the given string and assigns it to the SloId field. +func (o *SLOCorrectionResponseAttributes) SetSloId(v string) { + o.SloId = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +func (o *SLOCorrectionResponseAttributes) SetStart(v int64) { + o.Start = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributes) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributes) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributes) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *SLOCorrectionResponseAttributes) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Duration.IsSet() { + toSerialize["duration"] = o.Duration.Get() + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.ModifiedAt != nil { + toSerialize["modified_at"] = o.ModifiedAt + } + if o.Modifier.IsSet() { + toSerialize["modifier"] = o.Modifier.Get() + } + if o.Rrule.IsSet() { + toSerialize["rrule"] = o.Rrule.Get() + } + if o.SloId != nil { + toSerialize["slo_id"] = o.SloId + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Category *SLOCorrectionCategory `json:"category,omitempty"` + CreatedAt *int64 `json:"created_at,omitempty"` + Creator *Creator `json:"creator,omitempty"` + Description *string `json:"description,omitempty"` + Duration common.NullableInt64 `json:"duration,omitempty"` + End *int64 `json:"end,omitempty"` + ModifiedAt *int64 `json:"modified_at,omitempty"` + Modifier NullableSLOCorrectionResponseAttributesModifier `json:"modifier,omitempty"` + Rrule common.NullableString `json:"rrule,omitempty"` + SloId *string `json:"slo_id,omitempty"` + Start *int64 `json:"start,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Category; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Category = all.Category + o.CreatedAt = all.CreatedAt + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.Description = all.Description + o.Duration = all.Duration + o.End = all.End + o.ModifiedAt = all.ModifiedAt + o.Modifier = all.Modifier + o.Rrule = all.Rrule + o.SloId = all.SloId + o.Start = all.Start + o.Timezone = all.Timezone + return nil +} diff --git a/api/v1/datadog/model_slo_correction_response_attributes_modifier.go b/api/v1/datadog/model_slo_correction_response_attributes_modifier.go new file mode 100644 index 00000000000..8c103e182c6 --- /dev/null +++ b/api/v1/datadog/model_slo_correction_response_attributes_modifier.go @@ -0,0 +1,230 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOCorrectionResponseAttributesModifier Modifier of the object. +type SLOCorrectionResponseAttributesModifier struct { + // Email of the Modifier. + Email *string `json:"email,omitempty"` + // Handle of the Modifier. + Handle *string `json:"handle,omitempty"` + // Name of the Modifier. + Name *string `json:"name,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{} +} + +// NewSLOCorrectionResponseAttributesModifier instantiates a new SLOCorrectionResponseAttributesModifier 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 NewSLOCorrectionResponseAttributesModifier() *SLOCorrectionResponseAttributesModifier { + this := SLOCorrectionResponseAttributesModifier{} + return &this +} + +// NewSLOCorrectionResponseAttributesModifierWithDefaults instantiates a new SLOCorrectionResponseAttributesModifier 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 NewSLOCorrectionResponseAttributesModifierWithDefaults() *SLOCorrectionResponseAttributesModifier { + this := SLOCorrectionResponseAttributesModifier{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributesModifier) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributesModifier) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributesModifier) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *SLOCorrectionResponseAttributesModifier) SetEmail(v string) { + o.Email = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributesModifier) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributesModifier) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributesModifier) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *SLOCorrectionResponseAttributesModifier) SetHandle(v string) { + o.Handle = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SLOCorrectionResponseAttributesModifier) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionResponseAttributesModifier) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SLOCorrectionResponseAttributesModifier) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SLOCorrectionResponseAttributesModifier) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionResponseAttributesModifier) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionResponseAttributesModifier) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Email = all.Email + o.Handle = all.Handle + o.Name = all.Name + return nil +} + +// NullableSLOCorrectionResponseAttributesModifier handles when a null is used for SLOCorrectionResponseAttributesModifier. +type NullableSLOCorrectionResponseAttributesModifier struct { + value *SLOCorrectionResponseAttributesModifier + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOCorrectionResponseAttributesModifier) Get() *SLOCorrectionResponseAttributesModifier { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOCorrectionResponseAttributesModifier) Set(val *SLOCorrectionResponseAttributesModifier) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOCorrectionResponseAttributesModifier) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableSLOCorrectionResponseAttributesModifier) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOCorrectionResponseAttributesModifier initializes the struct as if Set has been called. +func NewNullableSLOCorrectionResponseAttributesModifier(val *SLOCorrectionResponseAttributesModifier) *NullableSLOCorrectionResponseAttributesModifier { + return &NullableSLOCorrectionResponseAttributesModifier{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOCorrectionResponseAttributesModifier) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOCorrectionResponseAttributesModifier) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_correction_type.go b/api/v1/datadog/model_slo_correction_type.go new file mode 100644 index 00000000000..eecf17f9e3d --- /dev/null +++ b/api/v1/datadog/model_slo_correction_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOCorrectionType SLO correction resource type. +type SLOCorrectionType string + +// List of SLOCorrectionType. +const ( + SLOCORRECTIONTYPE_CORRECTION SLOCorrectionType = "correction" +) + +var allowedSLOCorrectionTypeEnumValues = []SLOCorrectionType{ + SLOCORRECTIONTYPE_CORRECTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SLOCorrectionType) GetAllowedValues() []SLOCorrectionType { + return allowedSLOCorrectionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SLOCorrectionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SLOCorrectionType(value) + return nil +} + +// NewSLOCorrectionTypeFromValue returns a pointer to a valid SLOCorrectionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSLOCorrectionTypeFromValue(v string) (*SLOCorrectionType, error) { + ev := SLOCorrectionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SLOCorrectionType: valid values are %v", v, allowedSLOCorrectionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SLOCorrectionType) IsValid() bool { + for _, existing := range allowedSLOCorrectionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SLOCorrectionType value. +func (v SLOCorrectionType) Ptr() *SLOCorrectionType { + return &v +} + +// NullableSLOCorrectionType handles when a null is used for SLOCorrectionType. +type NullableSLOCorrectionType struct { + value *SLOCorrectionType + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOCorrectionType) Get() *SLOCorrectionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOCorrectionType) Set(val *SLOCorrectionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOCorrectionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSLOCorrectionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOCorrectionType initializes the struct as if Set has been called. +func NewNullableSLOCorrectionType(val *SLOCorrectionType) *NullableSLOCorrectionType { + return &NullableSLOCorrectionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOCorrectionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOCorrectionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_correction_update_data.go b/api/v1/datadog/model_slo_correction_update_data.go new file mode 100644 index 00000000000..b062e60efb0 --- /dev/null +++ b/api/v1/datadog/model_slo_correction_update_data.go @@ -0,0 +1,160 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOCorrectionUpdateData The data object associated with the SLO correction to be updated. +type SLOCorrectionUpdateData struct { + // The attribute object associated with the SLO correction to be updated. + Attributes *SLOCorrectionUpdateRequestAttributes `json:"attributes,omitempty"` + // SLO correction resource type. + Type *SLOCorrectionType `json:"type,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{} +} + +// NewSLOCorrectionUpdateData instantiates a new SLOCorrectionUpdateData 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 NewSLOCorrectionUpdateData() *SLOCorrectionUpdateData { + this := SLOCorrectionUpdateData{} + var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION + this.Type = &typeVar + return &this +} + +// NewSLOCorrectionUpdateDataWithDefaults instantiates a new SLOCorrectionUpdateData 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 NewSLOCorrectionUpdateDataWithDefaults() *SLOCorrectionUpdateData { + this := SLOCorrectionUpdateData{} + var typeVar SLOCorrectionType = SLOCORRECTIONTYPE_CORRECTION + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateData) GetAttributes() SLOCorrectionUpdateRequestAttributes { + if o == nil || o.Attributes == nil { + var ret SLOCorrectionUpdateRequestAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateData) GetAttributesOk() (*SLOCorrectionUpdateRequestAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SLOCorrectionUpdateRequestAttributes and assigns it to the Attributes field. +func (o *SLOCorrectionUpdateData) SetAttributes(v SLOCorrectionUpdateRequestAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateData) GetType() SLOCorrectionType { + if o == nil || o.Type == nil { + var ret SLOCorrectionType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateData) GetTypeOk() (*SLOCorrectionType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SLOCorrectionType and assigns it to the Type field. +func (o *SLOCorrectionUpdateData) SetType(v SLOCorrectionType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *SLOCorrectionUpdateRequestAttributes `json:"attributes,omitempty"` + Type *SLOCorrectionType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_slo_correction_update_request.go b/api/v1/datadog/model_slo_correction_update_request.go new file mode 100644 index 00000000000..5632ca28a2f --- /dev/null +++ b/api/v1/datadog/model_slo_correction_update_request.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOCorrectionUpdateRequest An object that defines a correction to be applied to an SLO. +type SLOCorrectionUpdateRequest struct { + // The data object associated with the SLO correction to be updated. + Data *SLOCorrectionUpdateData `json:"data,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{} +} + +// NewSLOCorrectionUpdateRequest instantiates a new SLOCorrectionUpdateRequest 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 NewSLOCorrectionUpdateRequest() *SLOCorrectionUpdateRequest { + this := SLOCorrectionUpdateRequest{} + return &this +} + +// NewSLOCorrectionUpdateRequestWithDefaults instantiates a new SLOCorrectionUpdateRequest 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 NewSLOCorrectionUpdateRequestWithDefaults() *SLOCorrectionUpdateRequest { + this := SLOCorrectionUpdateRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequest) GetData() SLOCorrectionUpdateData { + if o == nil || o.Data == nil { + var ret SLOCorrectionUpdateData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequest) GetDataOk() (*SLOCorrectionUpdateData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequest) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SLOCorrectionUpdateData and assigns it to the Data field. +func (o *SLOCorrectionUpdateRequest) SetData(v SLOCorrectionUpdateData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SLOCorrectionUpdateData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_slo_correction_update_request_attributes.go b/api/v1/datadog/model_slo_correction_update_request_attributes.go new file mode 100644 index 00000000000..4b04a29a2ef --- /dev/null +++ b/api/v1/datadog/model_slo_correction_update_request_attributes.go @@ -0,0 +1,345 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOCorrectionUpdateRequestAttributes The attribute object associated with the SLO correction to be updated. +type SLOCorrectionUpdateRequestAttributes struct { + // Category the SLO correction belongs to. + Category *SLOCorrectionCategory `json:"category,omitempty"` + // Description of the correction being made. + Description *string `json:"description,omitempty"` + // Length of time (in seconds) for a specified `rrule` recurring SLO correction. + Duration *int64 `json:"duration,omitempty"` + // Ending time of the correction in epoch seconds. + End *int64 `json:"end,omitempty"` + // The recurrence rules as defined in the iCalendar RFC 5545. The supported rules for SLO corrections + // are `FREQ`, `INTERVAL`, `COUNT`, and `UNTIL`. + Rrule *string `json:"rrule,omitempty"` + // Starting time of the correction in epoch seconds. + Start *int64 `json:"start,omitempty"` + // The timezone to display in the UI for the correction times (defaults to "UTC"). + Timezone *string `json:"timezone,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{} +} + +// NewSLOCorrectionUpdateRequestAttributes instantiates a new SLOCorrectionUpdateRequestAttributes 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 NewSLOCorrectionUpdateRequestAttributes() *SLOCorrectionUpdateRequestAttributes { + this := SLOCorrectionUpdateRequestAttributes{} + return &this +} + +// NewSLOCorrectionUpdateRequestAttributesWithDefaults instantiates a new SLOCorrectionUpdateRequestAttributes 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 NewSLOCorrectionUpdateRequestAttributesWithDefaults() *SLOCorrectionUpdateRequestAttributes { + this := SLOCorrectionUpdateRequestAttributes{} + return &this +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequestAttributes) GetCategory() SLOCorrectionCategory { + if o == nil || o.Category == nil { + var ret SLOCorrectionCategory + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequestAttributes) GetCategoryOk() (*SLOCorrectionCategory, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequestAttributes) HasCategory() bool { + if o != nil && o.Category != nil { + return true + } + + return false +} + +// SetCategory gets a reference to the given SLOCorrectionCategory and assigns it to the Category field. +func (o *SLOCorrectionUpdateRequestAttributes) SetCategory(v SLOCorrectionCategory) { + o.Category = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequestAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequestAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequestAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SLOCorrectionUpdateRequestAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequestAttributes) GetDuration() int64 { + if o == nil || o.Duration == nil { + var ret int64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequestAttributes) GetDurationOk() (*int64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequestAttributes) HasDuration() bool { + if o != nil && o.Duration != nil { + return true + } + + return false +} + +// SetDuration gets a reference to the given int64 and assigns it to the Duration field. +func (o *SLOCorrectionUpdateRequestAttributes) SetDuration(v int64) { + o.Duration = &v +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequestAttributes) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequestAttributes) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequestAttributes) HasEnd() bool { + if o != nil && o.End != nil { + return true + } + + return false +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *SLOCorrectionUpdateRequestAttributes) SetEnd(v int64) { + o.End = &v +} + +// GetRrule returns the Rrule field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequestAttributes) GetRrule() string { + if o == nil || o.Rrule == nil { + var ret string + return ret + } + return *o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequestAttributes) GetRruleOk() (*string, bool) { + if o == nil || o.Rrule == nil { + return nil, false + } + return o.Rrule, true +} + +// HasRrule returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequestAttributes) HasRrule() bool { + if o != nil && o.Rrule != nil { + return true + } + + return false +} + +// SetRrule gets a reference to the given string and assigns it to the Rrule field. +func (o *SLOCorrectionUpdateRequestAttributes) SetRrule(v string) { + o.Rrule = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequestAttributes) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequestAttributes) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequestAttributes) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +func (o *SLOCorrectionUpdateRequestAttributes) SetStart(v int64) { + o.Start = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *SLOCorrectionUpdateRequestAttributes) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOCorrectionUpdateRequestAttributes) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *SLOCorrectionUpdateRequestAttributes) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *SLOCorrectionUpdateRequestAttributes) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOCorrectionUpdateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Rrule != nil { + toSerialize["rrule"] = o.Rrule + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOCorrectionUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Category *SLOCorrectionCategory `json:"category,omitempty"` + Description *string `json:"description,omitempty"` + Duration *int64 `json:"duration,omitempty"` + End *int64 `json:"end,omitempty"` + Rrule *string `json:"rrule,omitempty"` + Start *int64 `json:"start,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Category; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Category = all.Category + o.Description = all.Description + o.Duration = all.Duration + o.End = all.End + o.Rrule = all.Rrule + o.Start = all.Start + o.Timezone = all.Timezone + return nil +} diff --git a/api/v1/datadog/model_slo_delete_response.go b/api/v1/datadog/model_slo_delete_response.go new file mode 100644 index 00000000000..e3bbece63d8 --- /dev/null +++ b/api/v1/datadog/model_slo_delete_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLODeleteResponse A response list of all service level objective deleted. +type SLODeleteResponse struct { + // An array containing the ID of the deleted service level objective object. + Data []string `json:"data,omitempty"` + // An dictionary containing the ID of the SLO as key and a deletion error as value. + Errors map[string]string `json:"errors,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{} +} + +// NewSLODeleteResponse instantiates a new SLODeleteResponse 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 NewSLODeleteResponse() *SLODeleteResponse { + this := SLODeleteResponse{} + return &this +} + +// NewSLODeleteResponseWithDefaults instantiates a new SLODeleteResponse 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 NewSLODeleteResponseWithDefaults() *SLODeleteResponse { + this := SLODeleteResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLODeleteResponse) GetData() []string { + if o == nil || o.Data == nil { + var ret []string + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLODeleteResponse) GetDataOk() (*[]string, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLODeleteResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []string and assigns it to the Data field. +func (o *SLODeleteResponse) SetData(v []string) { + o.Data = v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *SLODeleteResponse) GetErrors() map[string]string { + if o == nil || o.Errors == nil { + var ret map[string]string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLODeleteResponse) GetErrorsOk() (*map[string]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *SLODeleteResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given map[string]string and assigns it to the Errors field. +func (o *SLODeleteResponse) SetErrors(v map[string]string) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLODeleteResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLODeleteResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []string `json:"data,omitempty"` + Errors map[string]string `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Errors = all.Errors + return nil +} diff --git a/api/v1/datadog/model_slo_error_timeframe.go b/api/v1/datadog/model_slo_error_timeframe.go new file mode 100644 index 00000000000..71f69418e98 --- /dev/null +++ b/api/v1/datadog/model_slo_error_timeframe.go @@ -0,0 +1,114 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOErrorTimeframe The timeframe of the threshold associated with this error +// or "all" if all thresholds are affected. +type SLOErrorTimeframe string + +// List of SLOErrorTimeframe. +const ( + SLOERRORTIMEFRAME_SEVEN_DAYS SLOErrorTimeframe = "7d" + SLOERRORTIMEFRAME_THIRTY_DAYS SLOErrorTimeframe = "30d" + SLOERRORTIMEFRAME_NINETY_DAYS SLOErrorTimeframe = "90d" + SLOERRORTIMEFRAME_ALL SLOErrorTimeframe = "all" +) + +var allowedSLOErrorTimeframeEnumValues = []SLOErrorTimeframe{ + SLOERRORTIMEFRAME_SEVEN_DAYS, + SLOERRORTIMEFRAME_THIRTY_DAYS, + SLOERRORTIMEFRAME_NINETY_DAYS, + SLOERRORTIMEFRAME_ALL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SLOErrorTimeframe) GetAllowedValues() []SLOErrorTimeframe { + return allowedSLOErrorTimeframeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SLOErrorTimeframe) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SLOErrorTimeframe(value) + return nil +} + +// NewSLOErrorTimeframeFromValue returns a pointer to a valid SLOErrorTimeframe +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSLOErrorTimeframeFromValue(v string) (*SLOErrorTimeframe, error) { + ev := SLOErrorTimeframe(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SLOErrorTimeframe: valid values are %v", v, allowedSLOErrorTimeframeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SLOErrorTimeframe) IsValid() bool { + for _, existing := range allowedSLOErrorTimeframeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SLOErrorTimeframe value. +func (v SLOErrorTimeframe) Ptr() *SLOErrorTimeframe { + return &v +} + +// NullableSLOErrorTimeframe handles when a null is used for SLOErrorTimeframe. +type NullableSLOErrorTimeframe struct { + value *SLOErrorTimeframe + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOErrorTimeframe) Get() *SLOErrorTimeframe { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOErrorTimeframe) Set(val *SLOErrorTimeframe) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOErrorTimeframe) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSLOErrorTimeframe) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOErrorTimeframe initializes the struct as if Set has been called. +func NewNullableSLOErrorTimeframe(val *SLOErrorTimeframe) *NullableSLOErrorTimeframe { + return &NullableSLOErrorTimeframe{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOErrorTimeframe) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOErrorTimeframe) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_history_metrics.go b/api/v1/datadog/model_slo_history_metrics.go new file mode 100644 index 00000000000..76f5560bcbf --- /dev/null +++ b/api/v1/datadog/model_slo_history_metrics.go @@ -0,0 +1,358 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOHistoryMetrics A `metric` based SLO history response. +// +// This is not included in responses for `monitor` based SLOs. +type SLOHistoryMetrics struct { + // A representation of `metric` based SLO time series for the provided queries. + // This is the same response type from `batch_query` endpoint. + Denominator SLOHistoryMetricsSeries `json:"denominator"` + // The aggregated query interval for the series data. It's implicit based on the query time window. + Interval int64 `json:"interval"` + // Optional message if there are specific query issues/warnings. + Message *string `json:"message,omitempty"` + // A representation of `metric` based SLO time series for the provided queries. + // This is the same response type from `batch_query` endpoint. + Numerator SLOHistoryMetricsSeries `json:"numerator"` + // The combined numerator and denominator query CSV. + Query string `json:"query"` + // The series result type. This mimics `batch_query` response type. + ResType string `json:"res_type"` + // The series response version type. This mimics `batch_query` response type. + RespVersion int64 `json:"resp_version"` + // An array of query timestamps in EPOCH milliseconds. + Times []float64 `json:"times"` + // 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{} +} + +// NewSLOHistoryMetrics instantiates a new SLOHistoryMetrics 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 NewSLOHistoryMetrics(denominator SLOHistoryMetricsSeries, interval int64, numerator SLOHistoryMetricsSeries, query string, resType string, respVersion int64, times []float64) *SLOHistoryMetrics { + this := SLOHistoryMetrics{} + this.Denominator = denominator + this.Interval = interval + this.Numerator = numerator + this.Query = query + this.ResType = resType + this.RespVersion = respVersion + this.Times = times + return &this +} + +// NewSLOHistoryMetricsWithDefaults instantiates a new SLOHistoryMetrics 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 NewSLOHistoryMetricsWithDefaults() *SLOHistoryMetrics { + this := SLOHistoryMetrics{} + return &this +} + +// GetDenominator returns the Denominator field value. +func (o *SLOHistoryMetrics) GetDenominator() SLOHistoryMetricsSeries { + if o == nil { + var ret SLOHistoryMetricsSeries + return ret + } + return o.Denominator +} + +// GetDenominatorOk returns a tuple with the Denominator field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetDenominatorOk() (*SLOHistoryMetricsSeries, bool) { + if o == nil { + return nil, false + } + return &o.Denominator, true +} + +// SetDenominator sets field value. +func (o *SLOHistoryMetrics) SetDenominator(v SLOHistoryMetricsSeries) { + o.Denominator = v +} + +// GetInterval returns the Interval field value. +func (o *SLOHistoryMetrics) GetInterval() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetIntervalOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Interval, true +} + +// SetInterval sets field value. +func (o *SLOHistoryMetrics) SetInterval(v int64) { + o.Interval = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SLOHistoryMetrics) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SLOHistoryMetrics) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SLOHistoryMetrics) SetMessage(v string) { + o.Message = &v +} + +// GetNumerator returns the Numerator field value. +func (o *SLOHistoryMetrics) GetNumerator() SLOHistoryMetricsSeries { + if o == nil { + var ret SLOHistoryMetricsSeries + return ret + } + return o.Numerator +} + +// GetNumeratorOk returns a tuple with the Numerator field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetNumeratorOk() (*SLOHistoryMetricsSeries, bool) { + if o == nil { + return nil, false + } + return &o.Numerator, true +} + +// SetNumerator sets field value. +func (o *SLOHistoryMetrics) SetNumerator(v SLOHistoryMetricsSeries) { + o.Numerator = v +} + +// GetQuery returns the Query field value. +func (o *SLOHistoryMetrics) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *SLOHistoryMetrics) SetQuery(v string) { + o.Query = v +} + +// GetResType returns the ResType field value. +func (o *SLOHistoryMetrics) GetResType() string { + if o == nil { + var ret string + return ret + } + return o.ResType +} + +// GetResTypeOk returns a tuple with the ResType field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetResTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ResType, true +} + +// SetResType sets field value. +func (o *SLOHistoryMetrics) SetResType(v string) { + o.ResType = v +} + +// GetRespVersion returns the RespVersion field value. +func (o *SLOHistoryMetrics) GetRespVersion() int64 { + if o == nil { + var ret int64 + return ret + } + return o.RespVersion +} + +// GetRespVersionOk returns a tuple with the RespVersion field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetRespVersionOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.RespVersion, true +} + +// SetRespVersion sets field value. +func (o *SLOHistoryMetrics) SetRespVersion(v int64) { + o.RespVersion = v +} + +// GetTimes returns the Times field value. +func (o *SLOHistoryMetrics) GetTimes() []float64 { + if o == nil { + var ret []float64 + return ret + } + return o.Times +} + +// GetTimesOk returns a tuple with the Times field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetrics) GetTimesOk() (*[]float64, bool) { + if o == nil { + return nil, false + } + return &o.Times, true +} + +// SetTimes sets field value. +func (o *SLOHistoryMetrics) SetTimes(v []float64) { + o.Times = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryMetrics) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["denominator"] = o.Denominator + toSerialize["interval"] = o.Interval + if o.Message != nil { + toSerialize["message"] = o.Message + } + toSerialize["numerator"] = o.Numerator + toSerialize["query"] = o.Query + toSerialize["res_type"] = o.ResType + toSerialize["resp_version"] = o.RespVersion + toSerialize["times"] = o.Times + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Denominator *SLOHistoryMetricsSeries `json:"denominator"` + Interval *int64 `json:"interval"` + Numerator *SLOHistoryMetricsSeries `json:"numerator"` + Query *string `json:"query"` + ResType *string `json:"res_type"` + RespVersion *int64 `json:"resp_version"` + Times *[]float64 `json:"times"` + }{} + all := struct { + Denominator SLOHistoryMetricsSeries `json:"denominator"` + Interval int64 `json:"interval"` + Message *string `json:"message,omitempty"` + Numerator SLOHistoryMetricsSeries `json:"numerator"` + Query string `json:"query"` + ResType string `json:"res_type"` + RespVersion int64 `json:"resp_version"` + Times []float64 `json:"times"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Denominator == nil { + return fmt.Errorf("Required field denominator missing") + } + if required.Interval == nil { + return fmt.Errorf("Required field interval missing") + } + if required.Numerator == nil { + return fmt.Errorf("Required field numerator missing") + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + if required.ResType == nil { + return fmt.Errorf("Required field res_type missing") + } + if required.RespVersion == nil { + return fmt.Errorf("Required field resp_version missing") + } + if required.Times == nil { + return fmt.Errorf("Required field times missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Denominator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Denominator = all.Denominator + o.Interval = all.Interval + o.Message = all.Message + if all.Numerator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Numerator = all.Numerator + o.Query = all.Query + o.ResType = all.ResType + o.RespVersion = all.RespVersion + o.Times = all.Times + return nil +} diff --git a/api/v1/datadog/model_slo_history_metrics_series.go b/api/v1/datadog/model_slo_history_metrics_series.go new file mode 100644 index 00000000000..ec2dc0ba4de --- /dev/null +++ b/api/v1/datadog/model_slo_history_metrics_series.go @@ -0,0 +1,216 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOHistoryMetricsSeries A representation of `metric` based SLO time series for the provided queries. +// This is the same response type from `batch_query` endpoint. +type SLOHistoryMetricsSeries struct { + // Count of submitted metrics. + Count int64 `json:"count"` + // Query metadata. + Metadata *SLOHistoryMetricsSeriesMetadata `json:"metadata,omitempty"` + // Total sum of the query. + Sum float64 `json:"sum"` + // The query values for each metric. + Values []float64 `json:"values"` + // 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{} +} + +// NewSLOHistoryMetricsSeries instantiates a new SLOHistoryMetricsSeries 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 NewSLOHistoryMetricsSeries(count int64, sum float64, values []float64) *SLOHistoryMetricsSeries { + this := SLOHistoryMetricsSeries{} + this.Count = count + this.Sum = sum + this.Values = values + return &this +} + +// NewSLOHistoryMetricsSeriesWithDefaults instantiates a new SLOHistoryMetricsSeries 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 NewSLOHistoryMetricsSeriesWithDefaults() *SLOHistoryMetricsSeries { + this := SLOHistoryMetricsSeries{} + return &this +} + +// GetCount returns the Count field value. +func (o *SLOHistoryMetricsSeries) GetCount() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeries) GetCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value. +func (o *SLOHistoryMetricsSeries) SetCount(v int64) { + o.Count = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeries) GetMetadata() SLOHistoryMetricsSeriesMetadata { + if o == nil || o.Metadata == nil { + var ret SLOHistoryMetricsSeriesMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeries) GetMetadataOk() (*SLOHistoryMetricsSeriesMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeries) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given SLOHistoryMetricsSeriesMetadata and assigns it to the Metadata field. +func (o *SLOHistoryMetricsSeries) SetMetadata(v SLOHistoryMetricsSeriesMetadata) { + o.Metadata = &v +} + +// GetSum returns the Sum field value. +func (o *SLOHistoryMetricsSeries) GetSum() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Sum +} + +// GetSumOk returns a tuple with the Sum field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeries) GetSumOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Sum, true +} + +// SetSum sets field value. +func (o *SLOHistoryMetricsSeries) SetSum(v float64) { + o.Sum = v +} + +// GetValues returns the Values field value. +func (o *SLOHistoryMetricsSeries) GetValues() []float64 { + if o == nil { + var ret []float64 + return ret + } + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeries) GetValuesOk() (*[]float64, bool) { + if o == nil { + return nil, false + } + return &o.Values, true +} + +// SetValues sets field value. +func (o *SLOHistoryMetricsSeries) SetValues(v []float64) { + o.Values = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryMetricsSeries) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["count"] = o.Count + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["sum"] = o.Sum + toSerialize["values"] = o.Values + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Count *int64 `json:"count"` + Sum *float64 `json:"sum"` + Values *[]float64 `json:"values"` + }{} + all := struct { + Count int64 `json:"count"` + Metadata *SLOHistoryMetricsSeriesMetadata `json:"metadata,omitempty"` + Sum float64 `json:"sum"` + Values []float64 `json:"values"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Count == nil { + return fmt.Errorf("Required field count missing") + } + if required.Sum == nil { + return fmt.Errorf("Required field sum missing") + } + if required.Values == nil { + return fmt.Errorf("Required field values missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Count = all.Count + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Sum = all.Sum + o.Values = all.Values + return nil +} diff --git a/api/v1/datadog/model_slo_history_metrics_series_metadata.go b/api/v1/datadog/model_slo_history_metrics_series_metadata.go new file mode 100644 index 00000000000..41872c49b2e --- /dev/null +++ b/api/v1/datadog/model_slo_history_metrics_series_metadata.go @@ -0,0 +1,300 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOHistoryMetricsSeriesMetadata Query metadata. +type SLOHistoryMetricsSeriesMetadata struct { + // Query aggregator function. + Aggr *string `json:"aggr,omitempty"` + // Query expression. + Expression *string `json:"expression,omitempty"` + // Query metric used. + Metric *string `json:"metric,omitempty"` + // Query index from original combined query. + QueryIndex *int64 `json:"query_index,omitempty"` + // Query scope. + Scope *string `json:"scope,omitempty"` + // An array of metric units that contains up to two unit objects. + // For example, bytes represents one unit object and bytes per second represents two unit objects. + // If a metric query only has one unit object, the second array element is null. + Unit []SLOHistoryMetricsSeriesMetadataUnit `json:"unit,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{} +} + +// NewSLOHistoryMetricsSeriesMetadata instantiates a new SLOHistoryMetricsSeriesMetadata 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 NewSLOHistoryMetricsSeriesMetadata() *SLOHistoryMetricsSeriesMetadata { + this := SLOHistoryMetricsSeriesMetadata{} + return &this +} + +// NewSLOHistoryMetricsSeriesMetadataWithDefaults instantiates a new SLOHistoryMetricsSeriesMetadata 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 NewSLOHistoryMetricsSeriesMetadataWithDefaults() *SLOHistoryMetricsSeriesMetadata { + this := SLOHistoryMetricsSeriesMetadata{} + return &this +} + +// GetAggr returns the Aggr field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadata) GetAggr() string { + if o == nil || o.Aggr == nil { + var ret string + return ret + } + return *o.Aggr +} + +// GetAggrOk returns a tuple with the Aggr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadata) GetAggrOk() (*string, bool) { + if o == nil || o.Aggr == nil { + return nil, false + } + return o.Aggr, true +} + +// HasAggr returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadata) HasAggr() bool { + if o != nil && o.Aggr != nil { + return true + } + + return false +} + +// SetAggr gets a reference to the given string and assigns it to the Aggr field. +func (o *SLOHistoryMetricsSeriesMetadata) SetAggr(v string) { + o.Aggr = &v +} + +// GetExpression returns the Expression field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadata) GetExpression() string { + if o == nil || o.Expression == nil { + var ret string + return ret + } + return *o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadata) GetExpressionOk() (*string, bool) { + if o == nil || o.Expression == nil { + return nil, false + } + return o.Expression, true +} + +// HasExpression returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadata) HasExpression() bool { + if o != nil && o.Expression != nil { + return true + } + + return false +} + +// SetExpression gets a reference to the given string and assigns it to the Expression field. +func (o *SLOHistoryMetricsSeriesMetadata) SetExpression(v string) { + o.Expression = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadata) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadata) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadata) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *SLOHistoryMetricsSeriesMetadata) SetMetric(v string) { + o.Metric = &v +} + +// GetQueryIndex returns the QueryIndex field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadata) GetQueryIndex() int64 { + if o == nil || o.QueryIndex == nil { + var ret int64 + return ret + } + return *o.QueryIndex +} + +// GetQueryIndexOk returns a tuple with the QueryIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadata) GetQueryIndexOk() (*int64, bool) { + if o == nil || o.QueryIndex == nil { + return nil, false + } + return o.QueryIndex, true +} + +// HasQueryIndex returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadata) HasQueryIndex() bool { + if o != nil && o.QueryIndex != nil { + return true + } + + return false +} + +// SetQueryIndex gets a reference to the given int64 and assigns it to the QueryIndex field. +func (o *SLOHistoryMetricsSeriesMetadata) SetQueryIndex(v int64) { + o.QueryIndex = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadata) GetScope() string { + if o == nil || o.Scope == nil { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadata) GetScopeOk() (*string, bool) { + if o == nil || o.Scope == nil { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadata) HasScope() bool { + if o != nil && o.Scope != nil { + return true + } + + return false +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *SLOHistoryMetricsSeriesMetadata) SetScope(v string) { + o.Scope = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SLOHistoryMetricsSeriesMetadata) GetUnit() []SLOHistoryMetricsSeriesMetadataUnit { + if o == nil { + var ret []SLOHistoryMetricsSeriesMetadataUnit + return ret + } + return o.Unit +} + +// GetUnitOk returns a tuple with the Unit 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 *SLOHistoryMetricsSeriesMetadata) GetUnitOk() (*[]SLOHistoryMetricsSeriesMetadataUnit, bool) { + if o == nil || o.Unit == nil { + return nil, false + } + return &o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadata) HasUnit() bool { + if o != nil && o.Unit != nil { + return true + } + + return false +} + +// SetUnit gets a reference to the given []SLOHistoryMetricsSeriesMetadataUnit and assigns it to the Unit field. +func (o *SLOHistoryMetricsSeriesMetadata) SetUnit(v []SLOHistoryMetricsSeriesMetadataUnit) { + o.Unit = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryMetricsSeriesMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggr != nil { + toSerialize["aggr"] = o.Aggr + } + if o.Expression != nil { + toSerialize["expression"] = o.Expression + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.QueryIndex != nil { + toSerialize["query_index"] = o.QueryIndex + } + if o.Scope != nil { + toSerialize["scope"] = o.Scope + } + if o.Unit != nil { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryMetricsSeriesMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggr *string `json:"aggr,omitempty"` + Expression *string `json:"expression,omitempty"` + Metric *string `json:"metric,omitempty"` + QueryIndex *int64 `json:"query_index,omitempty"` + Scope *string `json:"scope,omitempty"` + Unit []SLOHistoryMetricsSeriesMetadataUnit `json:"unit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggr = all.Aggr + o.Expression = all.Expression + o.Metric = all.Metric + o.QueryIndex = all.QueryIndex + o.Scope = all.Scope + o.Unit = all.Unit + return nil +} diff --git a/api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go b/api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go new file mode 100644 index 00000000000..10b42461b80 --- /dev/null +++ b/api/v1/datadog/model_slo_history_metrics_series_metadata_unit.go @@ -0,0 +1,371 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SLOHistoryMetricsSeriesMetadataUnit An Object of metric units. +type SLOHistoryMetricsSeriesMetadataUnit struct { + // The family of metric unit, for example `bytes` is the family for `kibibyte`, `byte`, and `bit` units. + Family *string `json:"family,omitempty"` + // The ID of the metric unit. + Id *int64 `json:"id,omitempty"` + // The unit of the metric, for instance `byte`. + Name *string `json:"name,omitempty"` + // The plural Unit of metric, for instance `bytes`. + Plural common.NullableString `json:"plural,omitempty"` + // The scale factor of metric unit, for instance `1.0`. + ScaleFactor *float64 `json:"scale_factor,omitempty"` + // A shorter and abbreviated version of the metric unit, for instance `B`. + ShortName common.NullableString `json:"short_name,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{} +} + +// NewSLOHistoryMetricsSeriesMetadataUnit instantiates a new SLOHistoryMetricsSeriesMetadataUnit 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 NewSLOHistoryMetricsSeriesMetadataUnit() *SLOHistoryMetricsSeriesMetadataUnit { + this := SLOHistoryMetricsSeriesMetadataUnit{} + return &this +} + +// NewSLOHistoryMetricsSeriesMetadataUnitWithDefaults instantiates a new SLOHistoryMetricsSeriesMetadataUnit 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 NewSLOHistoryMetricsSeriesMetadataUnitWithDefaults() *SLOHistoryMetricsSeriesMetadataUnit { + this := SLOHistoryMetricsSeriesMetadataUnit{} + return &this +} + +// GetFamily returns the Family field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetFamily() string { + if o == nil || o.Family == nil { + var ret string + return ret + } + return *o.Family +} + +// GetFamilyOk returns a tuple with the Family field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetFamilyOk() (*string, bool) { + if o == nil || o.Family == nil { + return nil, false + } + return o.Family, true +} + +// HasFamily returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) HasFamily() bool { + if o != nil && o.Family != nil { + return true + } + + return false +} + +// SetFamily gets a reference to the given string and assigns it to the Family field. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetFamily(v string) { + o.Family = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetName(v string) { + o.Name = &v +} + +// GetPlural returns the Plural field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetPlural() string { + if o == nil || o.Plural.Get() == nil { + var ret string + return ret + } + return *o.Plural.Get() +} + +// GetPluralOk returns a tuple with the Plural 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 *SLOHistoryMetricsSeriesMetadataUnit) GetPluralOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Plural.Get(), o.Plural.IsSet() +} + +// HasPlural returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) HasPlural() bool { + if o != nil && o.Plural.IsSet() { + return true + } + + return false +} + +// SetPlural gets a reference to the given common.NullableString and assigns it to the Plural field. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetPlural(v string) { + o.Plural.Set(&v) +} + +// SetPluralNil sets the value for Plural to be an explicit nil. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetPluralNil() { + o.Plural.Set(nil) +} + +// UnsetPlural ensures that no value is present for Plural, not even an explicit nil. +func (o *SLOHistoryMetricsSeriesMetadataUnit) UnsetPlural() { + o.Plural.Unset() +} + +// GetScaleFactor returns the ScaleFactor field value if set, zero value otherwise. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetScaleFactor() float64 { + if o == nil || o.ScaleFactor == nil { + var ret float64 + return ret + } + return *o.ScaleFactor +} + +// GetScaleFactorOk returns a tuple with the ScaleFactor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetScaleFactorOk() (*float64, bool) { + if o == nil || o.ScaleFactor == nil { + return nil, false + } + return o.ScaleFactor, true +} + +// HasScaleFactor returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) HasScaleFactor() bool { + if o != nil && o.ScaleFactor != nil { + return true + } + + return false +} + +// SetScaleFactor gets a reference to the given float64 and assigns it to the ScaleFactor field. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetScaleFactor(v float64) { + o.ScaleFactor = &v +} + +// GetShortName returns the ShortName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SLOHistoryMetricsSeriesMetadataUnit) GetShortName() string { + if o == nil || o.ShortName.Get() == nil { + var ret string + return ret + } + return *o.ShortName.Get() +} + +// GetShortNameOk returns a tuple with the ShortName 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 *SLOHistoryMetricsSeriesMetadataUnit) GetShortNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ShortName.Get(), o.ShortName.IsSet() +} + +// HasShortName returns a boolean if a field has been set. +func (o *SLOHistoryMetricsSeriesMetadataUnit) HasShortName() bool { + if o != nil && o.ShortName.IsSet() { + return true + } + + return false +} + +// SetShortName gets a reference to the given common.NullableString and assigns it to the ShortName field. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetShortName(v string) { + o.ShortName.Set(&v) +} + +// SetShortNameNil sets the value for ShortName to be an explicit nil. +func (o *SLOHistoryMetricsSeriesMetadataUnit) SetShortNameNil() { + o.ShortName.Set(nil) +} + +// UnsetShortName ensures that no value is present for ShortName, not even an explicit nil. +func (o *SLOHistoryMetricsSeriesMetadataUnit) UnsetShortName() { + o.ShortName.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryMetricsSeriesMetadataUnit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Family != nil { + toSerialize["family"] = o.Family + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Plural.IsSet() { + toSerialize["plural"] = o.Plural.Get() + } + if o.ScaleFactor != nil { + toSerialize["scale_factor"] = o.ScaleFactor + } + if o.ShortName.IsSet() { + toSerialize["short_name"] = o.ShortName.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Family *string `json:"family,omitempty"` + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Plural common.NullableString `json:"plural,omitempty"` + ScaleFactor *float64 `json:"scale_factor,omitempty"` + ShortName common.NullableString `json:"short_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Family = all.Family + o.Id = all.Id + o.Name = all.Name + o.Plural = all.Plural + o.ScaleFactor = all.ScaleFactor + o.ShortName = all.ShortName + return nil +} + +// NullableSLOHistoryMetricsSeriesMetadataUnit handles when a null is used for SLOHistoryMetricsSeriesMetadataUnit. +type NullableSLOHistoryMetricsSeriesMetadataUnit struct { + value *SLOHistoryMetricsSeriesMetadataUnit + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOHistoryMetricsSeriesMetadataUnit) Get() *SLOHistoryMetricsSeriesMetadataUnit { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOHistoryMetricsSeriesMetadataUnit) Set(val *SLOHistoryMetricsSeriesMetadataUnit) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOHistoryMetricsSeriesMetadataUnit) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableSLOHistoryMetricsSeriesMetadataUnit) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOHistoryMetricsSeriesMetadataUnit initializes the struct as if Set has been called. +func NewNullableSLOHistoryMetricsSeriesMetadataUnit(val *SLOHistoryMetricsSeriesMetadataUnit) *NullableSLOHistoryMetricsSeriesMetadataUnit { + return &NullableSLOHistoryMetricsSeriesMetadataUnit{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOHistoryMetricsSeriesMetadataUnit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_history_monitor.go b/api/v1/datadog/model_slo_history_monitor.go new file mode 100644 index 00000000000..5603febc096 --- /dev/null +++ b/api/v1/datadog/model_slo_history_monitor.go @@ -0,0 +1,541 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOHistoryMonitor An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. +// This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs. +type SLOHistoryMonitor struct { + // A mapping of threshold `timeframe` to the remaining error budget. + ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` + // An array of error objects returned while querying the history data for the service level objective. + Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` + // For groups in a grouped SLO, this is the group name. + Group *string `json:"group,omitempty"` + // For `monitor` based SLOs, this includes the aggregated history as arrays that include time series and uptime data where `0=monitor` is in `OK` state and `1=monitor` is in `alert` state. + History [][]float64 `json:"history,omitempty"` + // For `monitor` based SLOs, this is the last modified timestamp in epoch seconds of the monitor. + MonitorModified *int64 `json:"monitor_modified,omitempty"` + // For `monitor` based SLOs, this describes the type of monitor. + MonitorType *string `json:"monitor_type,omitempty"` + // For groups in a grouped SLO, this is the group name. For monitors in a multi-monitor SLO, this is the monitor name. + Name *string `json:"name,omitempty"` + // The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. Use `span_precision` instead. + // Deprecated + Precision *float64 `json:"precision,omitempty"` + // For `monitor` based SLOs, when `true` this indicates that a replay is in progress to give an accurate uptime + // calculation. + Preview *bool `json:"preview,omitempty"` + // The current SLI value of the SLO over the history window. + SliValue *float64 `json:"sli_value,omitempty"` + // The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. + SpanPrecision *float64 `json:"span_precision,omitempty"` + // Use `sli_value` instead. + // Deprecated + Uptime *float64 `json:"uptime,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{} +} + +// NewSLOHistoryMonitor instantiates a new SLOHistoryMonitor 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 NewSLOHistoryMonitor() *SLOHistoryMonitor { + this := SLOHistoryMonitor{} + return &this +} + +// NewSLOHistoryMonitorWithDefaults instantiates a new SLOHistoryMonitor 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 NewSLOHistoryMonitorWithDefaults() *SLOHistoryMonitor { + this := SLOHistoryMonitor{} + return &this +} + +// GetErrorBudgetRemaining returns the ErrorBudgetRemaining field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetErrorBudgetRemaining() map[string]float64 { + if o == nil || o.ErrorBudgetRemaining == nil { + var ret map[string]float64 + return ret + } + return o.ErrorBudgetRemaining +} + +// GetErrorBudgetRemainingOk returns a tuple with the ErrorBudgetRemaining field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetErrorBudgetRemainingOk() (*map[string]float64, bool) { + if o == nil || o.ErrorBudgetRemaining == nil { + return nil, false + } + return &o.ErrorBudgetRemaining, true +} + +// HasErrorBudgetRemaining returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasErrorBudgetRemaining() bool { + if o != nil && o.ErrorBudgetRemaining != nil { + return true + } + + return false +} + +// SetErrorBudgetRemaining gets a reference to the given map[string]float64 and assigns it to the ErrorBudgetRemaining field. +func (o *SLOHistoryMonitor) SetErrorBudgetRemaining(v map[string]float64) { + o.ErrorBudgetRemaining = v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetErrors() []SLOHistoryResponseErrorWithType { + if o == nil || o.Errors == nil { + var ret []SLOHistoryResponseErrorWithType + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetErrorsOk() (*[]SLOHistoryResponseErrorWithType, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []SLOHistoryResponseErrorWithType and assigns it to the Errors field. +func (o *SLOHistoryMonitor) SetErrors(v []SLOHistoryResponseErrorWithType) { + o.Errors = v +} + +// GetGroup returns the Group field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetGroup() string { + if o == nil || o.Group == nil { + var ret string + return ret + } + return *o.Group +} + +// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetGroupOk() (*string, bool) { + if o == nil || o.Group == nil { + return nil, false + } + return o.Group, true +} + +// HasGroup returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasGroup() bool { + if o != nil && o.Group != nil { + return true + } + + return false +} + +// SetGroup gets a reference to the given string and assigns it to the Group field. +func (o *SLOHistoryMonitor) SetGroup(v string) { + o.Group = &v +} + +// GetHistory returns the History field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetHistory() [][]float64 { + if o == nil || o.History == nil { + var ret [][]float64 + return ret + } + return o.History +} + +// GetHistoryOk returns a tuple with the History field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetHistoryOk() (*[][]float64, bool) { + if o == nil || o.History == nil { + return nil, false + } + return &o.History, true +} + +// HasHistory returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasHistory() bool { + if o != nil && o.History != nil { + return true + } + + return false +} + +// SetHistory gets a reference to the given [][]float64 and assigns it to the History field. +func (o *SLOHistoryMonitor) SetHistory(v [][]float64) { + o.History = v +} + +// GetMonitorModified returns the MonitorModified field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetMonitorModified() int64 { + if o == nil || o.MonitorModified == nil { + var ret int64 + return ret + } + return *o.MonitorModified +} + +// GetMonitorModifiedOk returns a tuple with the MonitorModified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetMonitorModifiedOk() (*int64, bool) { + if o == nil || o.MonitorModified == nil { + return nil, false + } + return o.MonitorModified, true +} + +// HasMonitorModified returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasMonitorModified() bool { + if o != nil && o.MonitorModified != nil { + return true + } + + return false +} + +// SetMonitorModified gets a reference to the given int64 and assigns it to the MonitorModified field. +func (o *SLOHistoryMonitor) SetMonitorModified(v int64) { + o.MonitorModified = &v +} + +// GetMonitorType returns the MonitorType field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetMonitorType() string { + if o == nil || o.MonitorType == nil { + var ret string + return ret + } + return *o.MonitorType +} + +// GetMonitorTypeOk returns a tuple with the MonitorType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetMonitorTypeOk() (*string, bool) { + if o == nil || o.MonitorType == nil { + return nil, false + } + return o.MonitorType, true +} + +// HasMonitorType returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasMonitorType() bool { + if o != nil && o.MonitorType != nil { + return true + } + + return false +} + +// SetMonitorType gets a reference to the given string and assigns it to the MonitorType field. +func (o *SLOHistoryMonitor) SetMonitorType(v string) { + o.MonitorType = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SLOHistoryMonitor) SetName(v string) { + o.Name = &v +} + +// GetPrecision returns the Precision field value if set, zero value otherwise. +// Deprecated +func (o *SLOHistoryMonitor) GetPrecision() float64 { + if o == nil || o.Precision == nil { + var ret float64 + return ret + } + return *o.Precision +} + +// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *SLOHistoryMonitor) GetPrecisionOk() (*float64, bool) { + if o == nil || o.Precision == nil { + return nil, false + } + return o.Precision, true +} + +// HasPrecision returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasPrecision() bool { + if o != nil && o.Precision != nil { + return true + } + + return false +} + +// SetPrecision gets a reference to the given float64 and assigns it to the Precision field. +// Deprecated +func (o *SLOHistoryMonitor) SetPrecision(v float64) { + o.Precision = &v +} + +// GetPreview returns the Preview field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetPreview() bool { + if o == nil || o.Preview == nil { + var ret bool + return ret + } + return *o.Preview +} + +// GetPreviewOk returns a tuple with the Preview field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetPreviewOk() (*bool, bool) { + if o == nil || o.Preview == nil { + return nil, false + } + return o.Preview, true +} + +// HasPreview returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasPreview() bool { + if o != nil && o.Preview != nil { + return true + } + + return false +} + +// SetPreview gets a reference to the given bool and assigns it to the Preview field. +func (o *SLOHistoryMonitor) SetPreview(v bool) { + o.Preview = &v +} + +// GetSliValue returns the SliValue field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetSliValue() float64 { + if o == nil || o.SliValue == nil { + var ret float64 + return ret + } + return *o.SliValue +} + +// GetSliValueOk returns a tuple with the SliValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetSliValueOk() (*float64, bool) { + if o == nil || o.SliValue == nil { + return nil, false + } + return o.SliValue, true +} + +// HasSliValue returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasSliValue() bool { + if o != nil && o.SliValue != nil { + return true + } + + return false +} + +// SetSliValue gets a reference to the given float64 and assigns it to the SliValue field. +func (o *SLOHistoryMonitor) SetSliValue(v float64) { + o.SliValue = &v +} + +// GetSpanPrecision returns the SpanPrecision field value if set, zero value otherwise. +func (o *SLOHistoryMonitor) GetSpanPrecision() float64 { + if o == nil || o.SpanPrecision == nil { + var ret float64 + return ret + } + return *o.SpanPrecision +} + +// GetSpanPrecisionOk returns a tuple with the SpanPrecision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryMonitor) GetSpanPrecisionOk() (*float64, bool) { + if o == nil || o.SpanPrecision == nil { + return nil, false + } + return o.SpanPrecision, true +} + +// HasSpanPrecision returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasSpanPrecision() bool { + if o != nil && o.SpanPrecision != nil { + return true + } + + return false +} + +// SetSpanPrecision gets a reference to the given float64 and assigns it to the SpanPrecision field. +func (o *SLOHistoryMonitor) SetSpanPrecision(v float64) { + o.SpanPrecision = &v +} + +// GetUptime returns the Uptime field value if set, zero value otherwise. +// Deprecated +func (o *SLOHistoryMonitor) GetUptime() float64 { + if o == nil || o.Uptime == nil { + var ret float64 + return ret + } + return *o.Uptime +} + +// GetUptimeOk returns a tuple with the Uptime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *SLOHistoryMonitor) GetUptimeOk() (*float64, bool) { + if o == nil || o.Uptime == nil { + return nil, false + } + return o.Uptime, true +} + +// HasUptime returns a boolean if a field has been set. +func (o *SLOHistoryMonitor) HasUptime() bool { + if o != nil && o.Uptime != nil { + return true + } + + return false +} + +// SetUptime gets a reference to the given float64 and assigns it to the Uptime field. +// Deprecated +func (o *SLOHistoryMonitor) SetUptime(v float64) { + o.Uptime = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryMonitor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ErrorBudgetRemaining != nil { + toSerialize["error_budget_remaining"] = o.ErrorBudgetRemaining + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + if o.Group != nil { + toSerialize["group"] = o.Group + } + if o.History != nil { + toSerialize["history"] = o.History + } + if o.MonitorModified != nil { + toSerialize["monitor_modified"] = o.MonitorModified + } + if o.MonitorType != nil { + toSerialize["monitor_type"] = o.MonitorType + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Precision != nil { + toSerialize["precision"] = o.Precision + } + if o.Preview != nil { + toSerialize["preview"] = o.Preview + } + if o.SliValue != nil { + toSerialize["sli_value"] = o.SliValue + } + if o.SpanPrecision != nil { + toSerialize["span_precision"] = o.SpanPrecision + } + if o.Uptime != nil { + toSerialize["uptime"] = o.Uptime + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryMonitor) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` + Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` + Group *string `json:"group,omitempty"` + History [][]float64 `json:"history,omitempty"` + MonitorModified *int64 `json:"monitor_modified,omitempty"` + MonitorType *string `json:"monitor_type,omitempty"` + Name *string `json:"name,omitempty"` + Precision *float64 `json:"precision,omitempty"` + Preview *bool `json:"preview,omitempty"` + SliValue *float64 `json:"sli_value,omitempty"` + SpanPrecision *float64 `json:"span_precision,omitempty"` + Uptime *float64 `json:"uptime,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ErrorBudgetRemaining = all.ErrorBudgetRemaining + o.Errors = all.Errors + o.Group = all.Group + o.History = all.History + o.MonitorModified = all.MonitorModified + o.MonitorType = all.MonitorType + o.Name = all.Name + o.Precision = all.Precision + o.Preview = all.Preview + o.SliValue = all.SliValue + o.SpanPrecision = all.SpanPrecision + o.Uptime = all.Uptime + return nil +} diff --git a/api/v1/datadog/model_slo_history_response.go b/api/v1/datadog/model_slo_history_response.go new file mode 100644 index 00000000000..3daccd041ba --- /dev/null +++ b/api/v1/datadog/model_slo_history_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 datadog + +import ( + "encoding/json" +) + +// SLOHistoryResponse A service level objective history response. +type SLOHistoryResponse struct { + // An array of service level objective objects. + Data *SLOHistoryResponseData `json:"data,omitempty"` + // A list of errors while querying the history data for the service level objective. + Errors []SLOHistoryResponseError `json:"errors,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{} +} + +// NewSLOHistoryResponse instantiates a new SLOHistoryResponse 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 NewSLOHistoryResponse() *SLOHistoryResponse { + this := SLOHistoryResponse{} + return &this +} + +// NewSLOHistoryResponseWithDefaults instantiates a new SLOHistoryResponse 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 NewSLOHistoryResponseWithDefaults() *SLOHistoryResponse { + this := SLOHistoryResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOHistoryResponse) GetData() SLOHistoryResponseData { + if o == nil || o.Data == nil { + var ret SLOHistoryResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponse) GetDataOk() (*SLOHistoryResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOHistoryResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SLOHistoryResponseData and assigns it to the Data field. +func (o *SLOHistoryResponse) SetData(v SLOHistoryResponseData) { + o.Data = &v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *SLOHistoryResponse) GetErrors() []SLOHistoryResponseError { + if o == nil || o.Errors == nil { + var ret []SLOHistoryResponseError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponse) GetErrorsOk() (*[]SLOHistoryResponseError, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *SLOHistoryResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []SLOHistoryResponseError and assigns it to the Errors field. +func (o *SLOHistoryResponse) SetErrors(v []SLOHistoryResponseError) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SLOHistoryResponseData `json:"data,omitempty"` + Errors []SLOHistoryResponseError `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Errors = all.Errors + return nil +} diff --git a/api/v1/datadog/model_slo_history_response_data.go b/api/v1/datadog/model_slo_history_response_data.go new file mode 100644 index 00000000000..3593e5b8b15 --- /dev/null +++ b/api/v1/datadog/model_slo_history_response_data.go @@ -0,0 +1,494 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOHistoryResponseData An array of service level objective objects. +type SLOHistoryResponseData struct { + // The `from` timestamp in epoch seconds. + FromTs *int64 `json:"from_ts,omitempty"` + // For `metric` based SLOs where the query includes a group-by clause, this represents the list of grouping parameters. + // + // This is not included in responses for `monitor` based SLOs. + GroupBy []string `json:"group_by,omitempty"` + // For grouped SLOs, this represents SLI data for specific groups. + // + // This is not included in the responses for `metric` based SLOs. + Groups []SLOHistoryMonitor `json:"groups,omitempty"` + // For multi-monitor SLOs, this represents SLI data for specific monitors. + // + // This is not included in the responses for `metric` based SLOs. + Monitors []SLOHistoryMonitor `json:"monitors,omitempty"` + // An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. + // This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs. + Overall *SLOHistorySLIData `json:"overall,omitempty"` + // A `metric` based SLO history response. + // + // This is not included in responses for `monitor` based SLOs. + Series *SLOHistoryMetrics `json:"series,omitempty"` + // mapping of string timeframe to the SLO threshold. + Thresholds map[string]SLOThreshold `json:"thresholds,omitempty"` + // The `to` timestamp in epoch seconds. + ToTs *int64 `json:"to_ts,omitempty"` + // The type of the service level objective. + Type *SLOType `json:"type,omitempty"` + // A numeric representation of the type of the service level objective (`0` for + // monitor, `1` for metric). Always included in service level objective responses. + // Ignored in create/update requests. + TypeId *SLOTypeNumeric `json:"type_id,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{} +} + +// NewSLOHistoryResponseData instantiates a new SLOHistoryResponseData 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 NewSLOHistoryResponseData() *SLOHistoryResponseData { + this := SLOHistoryResponseData{} + return &this +} + +// NewSLOHistoryResponseDataWithDefaults instantiates a new SLOHistoryResponseData 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 NewSLOHistoryResponseDataWithDefaults() *SLOHistoryResponseData { + this := SLOHistoryResponseData{} + return &this +} + +// GetFromTs returns the FromTs field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetFromTs() int64 { + if o == nil || o.FromTs == nil { + var ret int64 + return ret + } + return *o.FromTs +} + +// GetFromTsOk returns a tuple with the FromTs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetFromTsOk() (*int64, bool) { + if o == nil || o.FromTs == nil { + return nil, false + } + return o.FromTs, true +} + +// HasFromTs returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasFromTs() bool { + if o != nil && o.FromTs != nil { + return true + } + + return false +} + +// SetFromTs gets a reference to the given int64 and assigns it to the FromTs field. +func (o *SLOHistoryResponseData) SetFromTs(v int64) { + o.FromTs = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetGroupBy() []string { + if o == nil || o.GroupBy == nil { + var ret []string + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetGroupByOk() (*[]string, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []string and assigns it to the GroupBy field. +func (o *SLOHistoryResponseData) SetGroupBy(v []string) { + o.GroupBy = v +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetGroups() []SLOHistoryMonitor { + if o == nil || o.Groups == nil { + var ret []SLOHistoryMonitor + 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 *SLOHistoryResponseData) GetGroupsOk() (*[]SLOHistoryMonitor, 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 *SLOHistoryResponseData) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + +// SetGroups gets a reference to the given []SLOHistoryMonitor and assigns it to the Groups field. +func (o *SLOHistoryResponseData) SetGroups(v []SLOHistoryMonitor) { + o.Groups = v +} + +// GetMonitors returns the Monitors field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetMonitors() []SLOHistoryMonitor { + if o == nil || o.Monitors == nil { + var ret []SLOHistoryMonitor + return ret + } + return o.Monitors +} + +// GetMonitorsOk returns a tuple with the Monitors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetMonitorsOk() (*[]SLOHistoryMonitor, bool) { + if o == nil || o.Monitors == nil { + return nil, false + } + return &o.Monitors, true +} + +// HasMonitors returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasMonitors() bool { + if o != nil && o.Monitors != nil { + return true + } + + return false +} + +// SetMonitors gets a reference to the given []SLOHistoryMonitor and assigns it to the Monitors field. +func (o *SLOHistoryResponseData) SetMonitors(v []SLOHistoryMonitor) { + o.Monitors = v +} + +// GetOverall returns the Overall field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetOverall() SLOHistorySLIData { + if o == nil || o.Overall == nil { + var ret SLOHistorySLIData + return ret + } + return *o.Overall +} + +// GetOverallOk returns a tuple with the Overall field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetOverallOk() (*SLOHistorySLIData, bool) { + if o == nil || o.Overall == nil { + return nil, false + } + return o.Overall, true +} + +// HasOverall returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasOverall() bool { + if o != nil && o.Overall != nil { + return true + } + + return false +} + +// SetOverall gets a reference to the given SLOHistorySLIData and assigns it to the Overall field. +func (o *SLOHistoryResponseData) SetOverall(v SLOHistorySLIData) { + o.Overall = &v +} + +// GetSeries returns the Series field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetSeries() SLOHistoryMetrics { + if o == nil || o.Series == nil { + var ret SLOHistoryMetrics + return ret + } + return *o.Series +} + +// GetSeriesOk returns a tuple with the Series field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetSeriesOk() (*SLOHistoryMetrics, bool) { + if o == nil || o.Series == nil { + return nil, false + } + return o.Series, true +} + +// HasSeries returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasSeries() bool { + if o != nil && o.Series != nil { + return true + } + + return false +} + +// SetSeries gets a reference to the given SLOHistoryMetrics and assigns it to the Series field. +func (o *SLOHistoryResponseData) SetSeries(v SLOHistoryMetrics) { + o.Series = &v +} + +// GetThresholds returns the Thresholds field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetThresholds() map[string]SLOThreshold { + if o == nil || o.Thresholds == nil { + var ret map[string]SLOThreshold + return ret + } + return o.Thresholds +} + +// GetThresholdsOk returns a tuple with the Thresholds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetThresholdsOk() (*map[string]SLOThreshold, bool) { + if o == nil || o.Thresholds == nil { + return nil, false + } + return &o.Thresholds, true +} + +// HasThresholds returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasThresholds() bool { + if o != nil && o.Thresholds != nil { + return true + } + + return false +} + +// SetThresholds gets a reference to the given map[string]SLOThreshold and assigns it to the Thresholds field. +func (o *SLOHistoryResponseData) SetThresholds(v map[string]SLOThreshold) { + o.Thresholds = v +} + +// GetToTs returns the ToTs field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetToTs() int64 { + if o == nil || o.ToTs == nil { + var ret int64 + return ret + } + return *o.ToTs +} + +// GetToTsOk returns a tuple with the ToTs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetToTsOk() (*int64, bool) { + if o == nil || o.ToTs == nil { + return nil, false + } + return o.ToTs, true +} + +// HasToTs returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasToTs() bool { + if o != nil && o.ToTs != nil { + return true + } + + return false +} + +// SetToTs gets a reference to the given int64 and assigns it to the ToTs field. +func (o *SLOHistoryResponseData) SetToTs(v int64) { + o.ToTs = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetType() SLOType { + if o == nil || o.Type == nil { + var ret SLOType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetTypeOk() (*SLOType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SLOType and assigns it to the Type field. +func (o *SLOHistoryResponseData) SetType(v SLOType) { + o.Type = &v +} + +// GetTypeId returns the TypeId field value if set, zero value otherwise. +func (o *SLOHistoryResponseData) GetTypeId() SLOTypeNumeric { + if o == nil || o.TypeId == nil { + var ret SLOTypeNumeric + return ret + } + return *o.TypeId +} + +// GetTypeIdOk returns a tuple with the TypeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseData) GetTypeIdOk() (*SLOTypeNumeric, bool) { + if o == nil || o.TypeId == nil { + return nil, false + } + return o.TypeId, true +} + +// HasTypeId returns a boolean if a field has been set. +func (o *SLOHistoryResponseData) HasTypeId() bool { + if o != nil && o.TypeId != nil { + return true + } + + return false +} + +// SetTypeId gets a reference to the given SLOTypeNumeric and assigns it to the TypeId field. +func (o *SLOHistoryResponseData) SetTypeId(v SLOTypeNumeric) { + o.TypeId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.FromTs != nil { + toSerialize["from_ts"] = o.FromTs + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + if o.Monitors != nil { + toSerialize["monitors"] = o.Monitors + } + if o.Overall != nil { + toSerialize["overall"] = o.Overall + } + if o.Series != nil { + toSerialize["series"] = o.Series + } + if o.Thresholds != nil { + toSerialize["thresholds"] = o.Thresholds + } + if o.ToTs != nil { + toSerialize["to_ts"] = o.ToTs + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.TypeId != nil { + toSerialize["type_id"] = o.TypeId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + FromTs *int64 `json:"from_ts,omitempty"` + GroupBy []string `json:"group_by,omitempty"` + Groups []SLOHistoryMonitor `json:"groups,omitempty"` + Monitors []SLOHistoryMonitor `json:"monitors,omitempty"` + Overall *SLOHistorySLIData `json:"overall,omitempty"` + Series *SLOHistoryMetrics `json:"series,omitempty"` + Thresholds map[string]SLOThreshold `json:"thresholds,omitempty"` + ToTs *int64 `json:"to_ts,omitempty"` + Type *SLOType `json:"type,omitempty"` + TypeId *SLOTypeNumeric `json:"type_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TypeId; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.FromTs = all.FromTs + o.GroupBy = all.GroupBy + o.Groups = all.Groups + o.Monitors = all.Monitors + if all.Overall != nil && all.Overall.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Overall = all.Overall + if all.Series != nil && all.Series.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Series = all.Series + o.Thresholds = all.Thresholds + o.ToTs = all.ToTs + o.Type = all.Type + o.TypeId = all.TypeId + return nil +} diff --git a/api/v1/datadog/model_slo_history_response_error.go b/api/v1/datadog/model_slo_history_response_error.go new file mode 100644 index 00000000000..9d1709d50e1 --- /dev/null +++ b/api/v1/datadog/model_slo_history_response_error.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 datadog + +import ( + "encoding/json" +) + +// SLOHistoryResponseError A list of errors while querying the history data for the service level objective. +type SLOHistoryResponseError struct { + // Human readable error. + Error *string `json:"error,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{} +} + +// NewSLOHistoryResponseError instantiates a new SLOHistoryResponseError 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 NewSLOHistoryResponseError() *SLOHistoryResponseError { + this := SLOHistoryResponseError{} + return &this +} + +// NewSLOHistoryResponseErrorWithDefaults instantiates a new SLOHistoryResponseError 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 NewSLOHistoryResponseErrorWithDefaults() *SLOHistoryResponseError { + this := SLOHistoryResponseError{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *SLOHistoryResponseError) GetError() string { + if o == nil || o.Error == nil { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseError) GetErrorOk() (*string, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *SLOHistoryResponseError) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *SLOHistoryResponseError) SetError(v string) { + o.Error = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryResponseError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryResponseError) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Error *string `json:"error,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Error = all.Error + return nil +} diff --git a/api/v1/datadog/model_slo_history_response_error_with_type.go b/api/v1/datadog/model_slo_history_response_error_with_type.go new file mode 100644 index 00000000000..777a921c8f9 --- /dev/null +++ b/api/v1/datadog/model_slo_history_response_error_with_type.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOHistoryResponseErrorWithType An object describing the error with error type and error message. +type SLOHistoryResponseErrorWithType struct { + // A message with more details about the error. + ErrorMessage string `json:"error_message"` + // Type of the error. + ErrorType string `json:"error_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{} +} + +// NewSLOHistoryResponseErrorWithType instantiates a new SLOHistoryResponseErrorWithType 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 NewSLOHistoryResponseErrorWithType(errorMessage string, errorType string) *SLOHistoryResponseErrorWithType { + this := SLOHistoryResponseErrorWithType{} + this.ErrorMessage = errorMessage + this.ErrorType = errorType + return &this +} + +// NewSLOHistoryResponseErrorWithTypeWithDefaults instantiates a new SLOHistoryResponseErrorWithType 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 NewSLOHistoryResponseErrorWithTypeWithDefaults() *SLOHistoryResponseErrorWithType { + this := SLOHistoryResponseErrorWithType{} + return &this +} + +// GetErrorMessage returns the ErrorMessage field value. +func (o *SLOHistoryResponseErrorWithType) GetErrorMessage() string { + if o == nil { + var ret string + return ret + } + return o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseErrorWithType) GetErrorMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ErrorMessage, true +} + +// SetErrorMessage sets field value. +func (o *SLOHistoryResponseErrorWithType) SetErrorMessage(v string) { + o.ErrorMessage = v +} + +// GetErrorType returns the ErrorType field value. +func (o *SLOHistoryResponseErrorWithType) GetErrorType() string { + if o == nil { + var ret string + return ret + } + return o.ErrorType +} + +// GetErrorTypeOk returns a tuple with the ErrorType field value +// and a boolean to check if the value has been set. +func (o *SLOHistoryResponseErrorWithType) GetErrorTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ErrorType, true +} + +// SetErrorType sets field value. +func (o *SLOHistoryResponseErrorWithType) SetErrorType(v string) { + o.ErrorType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistoryResponseErrorWithType) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["error_message"] = o.ErrorMessage + toSerialize["error_type"] = o.ErrorType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistoryResponseErrorWithType) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ErrorMessage *string `json:"error_message"` + ErrorType *string `json:"error_type"` + }{} + all := struct { + ErrorMessage string `json:"error_message"` + ErrorType string `json:"error_type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ErrorMessage == nil { + return fmt.Errorf("Required field error_message missing") + } + if required.ErrorType == nil { + return fmt.Errorf("Required field error_type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ErrorMessage = all.ErrorMessage + o.ErrorType = all.ErrorType + return nil +} diff --git a/api/v1/datadog/model_slo_history_sli_data.go b/api/v1/datadog/model_slo_history_sli_data.go new file mode 100644 index 00000000000..7b5f87b6910 --- /dev/null +++ b/api/v1/datadog/model_slo_history_sli_data.go @@ -0,0 +1,537 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOHistorySLIData An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. +// This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs. +type SLOHistorySLIData struct { + // A mapping of threshold `timeframe` to the remaining error budget. + ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` + // An array of error objects returned while querying the history data for the service level objective. + Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` + // For groups in a grouped SLO, this is the group name. + Group *string `json:"group,omitempty"` + // For `monitor` based SLOs, this includes the aggregated history as arrays that include time series and uptime data where `0=monitor` is in `OK` state and `1=monitor` is in `alert` state. + History [][]float64 `json:"history,omitempty"` + // For `monitor` based SLOs, this is the last modified timestamp in epoch seconds of the monitor. + MonitorModified *int64 `json:"monitor_modified,omitempty"` + // For `monitor` based SLOs, this describes the type of monitor. + MonitorType *string `json:"monitor_type,omitempty"` + // For groups in a grouped SLO, this is the group name. For monitors in a multi-monitor SLO, this is the monitor name. + Name *string `json:"name,omitempty"` + // A mapping of threshold `timeframe` to number of accurate decimals, regardless of the from && to timestamp. + Precision map[string]float64 `json:"precision,omitempty"` + // For `monitor` based SLOs, when `true` this indicates that a replay is in progress to give an accurate uptime + // calculation. + Preview *bool `json:"preview,omitempty"` + // The current SLI value of the SLO over the history window. + SliValue *float64 `json:"sli_value,omitempty"` + // The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. + SpanPrecision *float64 `json:"span_precision,omitempty"` + // Use `sli_value` instead. + // Deprecated + Uptime *float64 `json:"uptime,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{} +} + +// NewSLOHistorySLIData instantiates a new SLOHistorySLIData 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 NewSLOHistorySLIData() *SLOHistorySLIData { + this := SLOHistorySLIData{} + return &this +} + +// NewSLOHistorySLIDataWithDefaults instantiates a new SLOHistorySLIData 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 NewSLOHistorySLIDataWithDefaults() *SLOHistorySLIData { + this := SLOHistorySLIData{} + return &this +} + +// GetErrorBudgetRemaining returns the ErrorBudgetRemaining field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetErrorBudgetRemaining() map[string]float64 { + if o == nil || o.ErrorBudgetRemaining == nil { + var ret map[string]float64 + return ret + } + return o.ErrorBudgetRemaining +} + +// GetErrorBudgetRemainingOk returns a tuple with the ErrorBudgetRemaining field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetErrorBudgetRemainingOk() (*map[string]float64, bool) { + if o == nil || o.ErrorBudgetRemaining == nil { + return nil, false + } + return &o.ErrorBudgetRemaining, true +} + +// HasErrorBudgetRemaining returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasErrorBudgetRemaining() bool { + if o != nil && o.ErrorBudgetRemaining != nil { + return true + } + + return false +} + +// SetErrorBudgetRemaining gets a reference to the given map[string]float64 and assigns it to the ErrorBudgetRemaining field. +func (o *SLOHistorySLIData) SetErrorBudgetRemaining(v map[string]float64) { + o.ErrorBudgetRemaining = v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetErrors() []SLOHistoryResponseErrorWithType { + if o == nil || o.Errors == nil { + var ret []SLOHistoryResponseErrorWithType + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetErrorsOk() (*[]SLOHistoryResponseErrorWithType, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []SLOHistoryResponseErrorWithType and assigns it to the Errors field. +func (o *SLOHistorySLIData) SetErrors(v []SLOHistoryResponseErrorWithType) { + o.Errors = v +} + +// GetGroup returns the Group field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetGroup() string { + if o == nil || o.Group == nil { + var ret string + return ret + } + return *o.Group +} + +// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetGroupOk() (*string, bool) { + if o == nil || o.Group == nil { + return nil, false + } + return o.Group, true +} + +// HasGroup returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasGroup() bool { + if o != nil && o.Group != nil { + return true + } + + return false +} + +// SetGroup gets a reference to the given string and assigns it to the Group field. +func (o *SLOHistorySLIData) SetGroup(v string) { + o.Group = &v +} + +// GetHistory returns the History field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetHistory() [][]float64 { + if o == nil || o.History == nil { + var ret [][]float64 + return ret + } + return o.History +} + +// GetHistoryOk returns a tuple with the History field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetHistoryOk() (*[][]float64, bool) { + if o == nil || o.History == nil { + return nil, false + } + return &o.History, true +} + +// HasHistory returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasHistory() bool { + if o != nil && o.History != nil { + return true + } + + return false +} + +// SetHistory gets a reference to the given [][]float64 and assigns it to the History field. +func (o *SLOHistorySLIData) SetHistory(v [][]float64) { + o.History = v +} + +// GetMonitorModified returns the MonitorModified field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetMonitorModified() int64 { + if o == nil || o.MonitorModified == nil { + var ret int64 + return ret + } + return *o.MonitorModified +} + +// GetMonitorModifiedOk returns a tuple with the MonitorModified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetMonitorModifiedOk() (*int64, bool) { + if o == nil || o.MonitorModified == nil { + return nil, false + } + return o.MonitorModified, true +} + +// HasMonitorModified returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasMonitorModified() bool { + if o != nil && o.MonitorModified != nil { + return true + } + + return false +} + +// SetMonitorModified gets a reference to the given int64 and assigns it to the MonitorModified field. +func (o *SLOHistorySLIData) SetMonitorModified(v int64) { + o.MonitorModified = &v +} + +// GetMonitorType returns the MonitorType field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetMonitorType() string { + if o == nil || o.MonitorType == nil { + var ret string + return ret + } + return *o.MonitorType +} + +// GetMonitorTypeOk returns a tuple with the MonitorType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetMonitorTypeOk() (*string, bool) { + if o == nil || o.MonitorType == nil { + return nil, false + } + return o.MonitorType, true +} + +// HasMonitorType returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasMonitorType() bool { + if o != nil && o.MonitorType != nil { + return true + } + + return false +} + +// SetMonitorType gets a reference to the given string and assigns it to the MonitorType field. +func (o *SLOHistorySLIData) SetMonitorType(v string) { + o.MonitorType = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SLOHistorySLIData) SetName(v string) { + o.Name = &v +} + +// GetPrecision returns the Precision field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetPrecision() map[string]float64 { + if o == nil || o.Precision == nil { + var ret map[string]float64 + return ret + } + return o.Precision +} + +// GetPrecisionOk returns a tuple with the Precision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetPrecisionOk() (*map[string]float64, bool) { + if o == nil || o.Precision == nil { + return nil, false + } + return &o.Precision, true +} + +// HasPrecision returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasPrecision() bool { + if o != nil && o.Precision != nil { + return true + } + + return false +} + +// SetPrecision gets a reference to the given map[string]float64 and assigns it to the Precision field. +func (o *SLOHistorySLIData) SetPrecision(v map[string]float64) { + o.Precision = v +} + +// GetPreview returns the Preview field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetPreview() bool { + if o == nil || o.Preview == nil { + var ret bool + return ret + } + return *o.Preview +} + +// GetPreviewOk returns a tuple with the Preview field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetPreviewOk() (*bool, bool) { + if o == nil || o.Preview == nil { + return nil, false + } + return o.Preview, true +} + +// HasPreview returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasPreview() bool { + if o != nil && o.Preview != nil { + return true + } + + return false +} + +// SetPreview gets a reference to the given bool and assigns it to the Preview field. +func (o *SLOHistorySLIData) SetPreview(v bool) { + o.Preview = &v +} + +// GetSliValue returns the SliValue field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetSliValue() float64 { + if o == nil || o.SliValue == nil { + var ret float64 + return ret + } + return *o.SliValue +} + +// GetSliValueOk returns a tuple with the SliValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetSliValueOk() (*float64, bool) { + if o == nil || o.SliValue == nil { + return nil, false + } + return o.SliValue, true +} + +// HasSliValue returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasSliValue() bool { + if o != nil && o.SliValue != nil { + return true + } + + return false +} + +// SetSliValue gets a reference to the given float64 and assigns it to the SliValue field. +func (o *SLOHistorySLIData) SetSliValue(v float64) { + o.SliValue = &v +} + +// GetSpanPrecision returns the SpanPrecision field value if set, zero value otherwise. +func (o *SLOHistorySLIData) GetSpanPrecision() float64 { + if o == nil || o.SpanPrecision == nil { + var ret float64 + return ret + } + return *o.SpanPrecision +} + +// GetSpanPrecisionOk returns a tuple with the SpanPrecision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOHistorySLIData) GetSpanPrecisionOk() (*float64, bool) { + if o == nil || o.SpanPrecision == nil { + return nil, false + } + return o.SpanPrecision, true +} + +// HasSpanPrecision returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasSpanPrecision() bool { + if o != nil && o.SpanPrecision != nil { + return true + } + + return false +} + +// SetSpanPrecision gets a reference to the given float64 and assigns it to the SpanPrecision field. +func (o *SLOHistorySLIData) SetSpanPrecision(v float64) { + o.SpanPrecision = &v +} + +// GetUptime returns the Uptime field value if set, zero value otherwise. +// Deprecated +func (o *SLOHistorySLIData) GetUptime() float64 { + if o == nil || o.Uptime == nil { + var ret float64 + return ret + } + return *o.Uptime +} + +// GetUptimeOk returns a tuple with the Uptime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *SLOHistorySLIData) GetUptimeOk() (*float64, bool) { + if o == nil || o.Uptime == nil { + return nil, false + } + return o.Uptime, true +} + +// HasUptime returns a boolean if a field has been set. +func (o *SLOHistorySLIData) HasUptime() bool { + if o != nil && o.Uptime != nil { + return true + } + + return false +} + +// SetUptime gets a reference to the given float64 and assigns it to the Uptime field. +// Deprecated +func (o *SLOHistorySLIData) SetUptime(v float64) { + o.Uptime = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOHistorySLIData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ErrorBudgetRemaining != nil { + toSerialize["error_budget_remaining"] = o.ErrorBudgetRemaining + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + if o.Group != nil { + toSerialize["group"] = o.Group + } + if o.History != nil { + toSerialize["history"] = o.History + } + if o.MonitorModified != nil { + toSerialize["monitor_modified"] = o.MonitorModified + } + if o.MonitorType != nil { + toSerialize["monitor_type"] = o.MonitorType + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Precision != nil { + toSerialize["precision"] = o.Precision + } + if o.Preview != nil { + toSerialize["preview"] = o.Preview + } + if o.SliValue != nil { + toSerialize["sli_value"] = o.SliValue + } + if o.SpanPrecision != nil { + toSerialize["span_precision"] = o.SpanPrecision + } + if o.Uptime != nil { + toSerialize["uptime"] = o.Uptime + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOHistorySLIData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ErrorBudgetRemaining map[string]float64 `json:"error_budget_remaining,omitempty"` + Errors []SLOHistoryResponseErrorWithType `json:"errors,omitempty"` + Group *string `json:"group,omitempty"` + History [][]float64 `json:"history,omitempty"` + MonitorModified *int64 `json:"monitor_modified,omitempty"` + MonitorType *string `json:"monitor_type,omitempty"` + Name *string `json:"name,omitempty"` + Precision map[string]float64 `json:"precision,omitempty"` + Preview *bool `json:"preview,omitempty"` + SliValue *float64 `json:"sli_value,omitempty"` + SpanPrecision *float64 `json:"span_precision,omitempty"` + Uptime *float64 `json:"uptime,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ErrorBudgetRemaining = all.ErrorBudgetRemaining + o.Errors = all.Errors + o.Group = all.Group + o.History = all.History + o.MonitorModified = all.MonitorModified + o.MonitorType = all.MonitorType + o.Name = all.Name + o.Precision = all.Precision + o.Preview = all.Preview + o.SliValue = all.SliValue + o.SpanPrecision = all.SpanPrecision + o.Uptime = all.Uptime + return nil +} diff --git a/api/v1/datadog/model_slo_list_response.go b/api/v1/datadog/model_slo_list_response.go new file mode 100644 index 00000000000..3e63c1e0e96 --- /dev/null +++ b/api/v1/datadog/model_slo_list_response.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOListResponse A response with one or more service level objective. +type SLOListResponse struct { + // An array of service level objective objects. + Data []ServiceLevelObjective `json:"data,omitempty"` + // An array of error messages. Each endpoint documents how/whether this field is + // used. + Errors []string `json:"errors,omitempty"` + // The metadata object containing additional information about the list of SLOs. + Metadata *SLOListResponseMetadata `json:"metadata,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{} +} + +// NewSLOListResponse instantiates a new SLOListResponse 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 NewSLOListResponse() *SLOListResponse { + this := SLOListResponse{} + return &this +} + +// NewSLOListResponseWithDefaults instantiates a new SLOListResponse 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 NewSLOListResponseWithDefaults() *SLOListResponse { + this := SLOListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOListResponse) GetData() []ServiceLevelObjective { + if o == nil || o.Data == nil { + var ret []ServiceLevelObjective + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOListResponse) GetDataOk() (*[]ServiceLevelObjective, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOListResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []ServiceLevelObjective and assigns it to the Data field. +func (o *SLOListResponse) SetData(v []ServiceLevelObjective) { + o.Data = v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *SLOListResponse) GetErrors() []string { + if o == nil || o.Errors == nil { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOListResponse) GetErrorsOk() (*[]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *SLOListResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []string and assigns it to the Errors field. +func (o *SLOListResponse) SetErrors(v []string) { + o.Errors = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SLOListResponse) GetMetadata() SLOListResponseMetadata { + if o == nil || o.Metadata == nil { + var ret SLOListResponseMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOListResponse) GetMetadataOk() (*SLOListResponseMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SLOListResponse) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given SLOListResponseMetadata and assigns it to the Metadata field. +func (o *SLOListResponse) SetMetadata(v SLOListResponseMetadata) { + o.Metadata = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []ServiceLevelObjective `json:"data,omitempty"` + Errors []string `json:"errors,omitempty"` + Metadata *SLOListResponseMetadata `json:"metadata,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Errors = all.Errors + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + return nil +} diff --git a/api/v1/datadog/model_slo_list_response_metadata.go b/api/v1/datadog/model_slo_list_response_metadata.go new file mode 100644 index 00000000000..d8e9d05d7fa --- /dev/null +++ b/api/v1/datadog/model_slo_list_response_metadata.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOListResponseMetadata The metadata object containing additional information about the list of SLOs. +type SLOListResponseMetadata struct { + // The object containing information about the pages of the list of SLOs. + Page *SLOListResponseMetadataPage `json:"page,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{} +} + +// NewSLOListResponseMetadata instantiates a new SLOListResponseMetadata 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 NewSLOListResponseMetadata() *SLOListResponseMetadata { + this := SLOListResponseMetadata{} + return &this +} + +// NewSLOListResponseMetadataWithDefaults instantiates a new SLOListResponseMetadata 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 NewSLOListResponseMetadataWithDefaults() *SLOListResponseMetadata { + this := SLOListResponseMetadata{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *SLOListResponseMetadata) GetPage() SLOListResponseMetadataPage { + if o == nil || o.Page == nil { + var ret SLOListResponseMetadataPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOListResponseMetadata) GetPageOk() (*SLOListResponseMetadataPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *SLOListResponseMetadata) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given SLOListResponseMetadataPage and assigns it to the Page field. +func (o *SLOListResponseMetadata) SetPage(v SLOListResponseMetadataPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOListResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOListResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *SLOListResponseMetadataPage `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v1/datadog/model_slo_list_response_metadata_page.go b/api/v1/datadog/model_slo_list_response_metadata_page.go new file mode 100644 index 00000000000..ff0ef2036ef --- /dev/null +++ b/api/v1/datadog/model_slo_list_response_metadata_page.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOListResponseMetadataPage The object containing information about the pages of the list of SLOs. +type SLOListResponseMetadataPage struct { + // The total number of resources that could be retrieved ignoring the parameters and filters in the request. + TotalCount *int64 `json:"total_count,omitempty"` + // The total number of resources that match the parameters and filters in the request. This attribute can be used by a client to determine the total number of 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{} +} + +// NewSLOListResponseMetadataPage instantiates a new SLOListResponseMetadataPage 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 NewSLOListResponseMetadataPage() *SLOListResponseMetadataPage { + this := SLOListResponseMetadataPage{} + return &this +} + +// NewSLOListResponseMetadataPageWithDefaults instantiates a new SLOListResponseMetadataPage 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 NewSLOListResponseMetadataPageWithDefaults() *SLOListResponseMetadataPage { + this := SLOListResponseMetadataPage{} + return &this +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *SLOListResponseMetadataPage) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOListResponseMetadataPage) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *SLOListResponseMetadataPage) HasTotalCount() bool { + if o != nil && o.TotalCount != nil { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *SLOListResponseMetadataPage) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *SLOListResponseMetadataPage) 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 *SLOListResponseMetadataPage) 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 *SLOListResponseMetadataPage) HasTotalFilteredCount() bool { + if o != nil && o.TotalFilteredCount != nil { + return true + } + + return false +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *SLOListResponseMetadataPage) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOListResponseMetadataPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOListResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TotalCount *int64 `json:"total_count,omitempty"` + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TotalCount = all.TotalCount + o.TotalFilteredCount = all.TotalFilteredCount + return nil +} diff --git a/api/v1/datadog/model_slo_response.go b/api/v1/datadog/model_slo_response.go new file mode 100644 index 00000000000..721b074a9fa --- /dev/null +++ b/api/v1/datadog/model_slo_response.go @@ -0,0 +1,150 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SLOResponse A service level objective response containing a single service level objective. +type SLOResponse struct { + // A service level objective object includes a service level indicator, thresholds + // for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). + Data *SLOResponseData `json:"data,omitempty"` + // An array of error messages. Each endpoint documents how/whether this field is + // used. + Errors []string `json:"errors,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{} +} + +// NewSLOResponse instantiates a new SLOResponse 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 NewSLOResponse() *SLOResponse { + this := SLOResponse{} + return &this +} + +// NewSLOResponseWithDefaults instantiates a new SLOResponse 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 NewSLOResponseWithDefaults() *SLOResponse { + this := SLOResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SLOResponse) GetData() SLOResponseData { + if o == nil || o.Data == nil { + var ret SLOResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponse) GetDataOk() (*SLOResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SLOResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SLOResponseData and assigns it to the Data field. +func (o *SLOResponse) SetData(v SLOResponseData) { + o.Data = &v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *SLOResponse) GetErrors() []string { + if o == nil || o.Errors == nil { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponse) GetErrorsOk() (*[]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *SLOResponse) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []string and assigns it to the Errors field. +func (o *SLOResponse) SetErrors(v []string) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SLOResponseData `json:"data,omitempty"` + Errors []string `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Errors = all.Errors + return nil +} diff --git a/api/v1/datadog/model_slo_response_data.go b/api/v1/datadog/model_slo_response_data.go new file mode 100644 index 00000000000..6095487e5b3 --- /dev/null +++ b/api/v1/datadog/model_slo_response_data.go @@ -0,0 +1,669 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SLOResponseData A service level objective object includes a service level indicator, thresholds +// for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.). +type SLOResponseData struct { + // A list of SLO monitors IDs that reference this SLO. This field is returned only when `with_configured_alert_ids` parameter is true in query. + ConfiguredAlertIds []int64 `json:"configured_alert_ids,omitempty"` + // Creation timestamp (UNIX time in seconds) + // + // Always included in service level objective responses. + CreatedAt *int64 `json:"created_at,omitempty"` + // Object describing the creator of the shared element. + Creator *Creator `json:"creator,omitempty"` + // A user-defined description of the service level objective. + // + // Always included in service level objective responses (but may be `null`). + // Optional in create/update requests. + Description common.NullableString `json:"description,omitempty"` + // A list of (up to 20) monitor groups that narrow the scope of a monitor service level objective. + // + // Included in service level objective responses if it is not empty. Optional in + // create/update requests for monitor service level objectives, but may only be + // used when then length of the `monitor_ids` field is one. + Groups []string `json:"groups,omitempty"` + // A unique identifier for the service level objective object. + // + // Always included in service level objective responses. + Id *string `json:"id,omitempty"` + // Modification timestamp (UNIX time in seconds) + // + // Always included in service level objective responses. + ModifiedAt *int64 `json:"modified_at,omitempty"` + // A list of monitor ids that defines the scope of a monitor service level + // objective. **Required if type is `monitor`**. + MonitorIds []int64 `json:"monitor_ids,omitempty"` + // The union of monitor tags for all monitors referenced by the `monitor_ids` + // field. + // Always included in service level objective responses for monitor service level + // objectives (but may be empty). Ignored in create/update requests. Does not + // affect which monitors are included in the service level objective (that is + // determined entirely by the `monitor_ids` field). + MonitorTags []string `json:"monitor_tags,omitempty"` + // The name of the service level objective object. + Name *string `json:"name,omitempty"` + // A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator + // to be used because this will sum up all request counts instead of averaging them, or taking the max or + // min of all of those requests. + Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` + // A list of tags associated with this service level objective. + // Always included in service level objective responses (but may be empty). + // Optional in create/update requests. + Tags []string `json:"tags,omitempty"` + // The thresholds (timeframes and associated targets) for this service level + // objective object. + Thresholds []SLOThreshold `json:"thresholds,omitempty"` + // The type of the service level objective. + Type *SLOType `json:"type,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{} +} + +// NewSLOResponseData instantiates a new SLOResponseData 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 NewSLOResponseData() *SLOResponseData { + this := SLOResponseData{} + return &this +} + +// NewSLOResponseDataWithDefaults instantiates a new SLOResponseData 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 NewSLOResponseDataWithDefaults() *SLOResponseData { + this := SLOResponseData{} + return &this +} + +// GetConfiguredAlertIds returns the ConfiguredAlertIds field value if set, zero value otherwise. +func (o *SLOResponseData) GetConfiguredAlertIds() []int64 { + if o == nil || o.ConfiguredAlertIds == nil { + var ret []int64 + return ret + } + return o.ConfiguredAlertIds +} + +// GetConfiguredAlertIdsOk returns a tuple with the ConfiguredAlertIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetConfiguredAlertIdsOk() (*[]int64, bool) { + if o == nil || o.ConfiguredAlertIds == nil { + return nil, false + } + return &o.ConfiguredAlertIds, true +} + +// HasConfiguredAlertIds returns a boolean if a field has been set. +func (o *SLOResponseData) HasConfiguredAlertIds() bool { + if o != nil && o.ConfiguredAlertIds != nil { + return true + } + + return false +} + +// SetConfiguredAlertIds gets a reference to the given []int64 and assigns it to the ConfiguredAlertIds field. +func (o *SLOResponseData) SetConfiguredAlertIds(v []int64) { + o.ConfiguredAlertIds = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SLOResponseData) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SLOResponseData) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *SLOResponseData) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *SLOResponseData) GetCreator() Creator { + if o == nil || o.Creator == nil { + var ret Creator + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetCreatorOk() (*Creator, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *SLOResponseData) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given Creator and assigns it to the Creator field. +func (o *SLOResponseData) SetCreator(v Creator) { + o.Creator = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SLOResponseData) GetDescription() string { + if o == nil || o.Description.Get() == nil { + var ret string + return ret + } + return *o.Description.Get() +} + +// GetDescriptionOk returns a tuple with the Description 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 *SLOResponseData) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description.Get(), o.Description.IsSet() +} + +// HasDescription returns a boolean if a field has been set. +func (o *SLOResponseData) HasDescription() bool { + if o != nil && o.Description.IsSet() { + return true + } + + return false +} + +// SetDescription gets a reference to the given common.NullableString and assigns it to the Description field. +func (o *SLOResponseData) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *SLOResponseData) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *SLOResponseData) UnsetDescription() { + o.Description.Unset() +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *SLOResponseData) GetGroups() []string { + if o == nil || o.Groups == nil { + var ret []string + 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 *SLOResponseData) GetGroupsOk() (*[]string, 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 *SLOResponseData) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + +// SetGroups gets a reference to the given []string and assigns it to the Groups field. +func (o *SLOResponseData) SetGroups(v []string) { + o.Groups = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SLOResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SLOResponseData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SLOResponseData) SetId(v string) { + o.Id = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *SLOResponseData) GetModifiedAt() int64 { + if o == nil || o.ModifiedAt == nil { + var ret int64 + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetModifiedAtOk() (*int64, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *SLOResponseData) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given int64 and assigns it to the ModifiedAt field. +func (o *SLOResponseData) SetModifiedAt(v int64) { + o.ModifiedAt = &v +} + +// GetMonitorIds returns the MonitorIds field value if set, zero value otherwise. +func (o *SLOResponseData) GetMonitorIds() []int64 { + if o == nil || o.MonitorIds == nil { + var ret []int64 + return ret + } + return o.MonitorIds +} + +// GetMonitorIdsOk returns a tuple with the MonitorIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetMonitorIdsOk() (*[]int64, bool) { + if o == nil || o.MonitorIds == nil { + return nil, false + } + return &o.MonitorIds, true +} + +// HasMonitorIds returns a boolean if a field has been set. +func (o *SLOResponseData) HasMonitorIds() bool { + if o != nil && o.MonitorIds != nil { + return true + } + + return false +} + +// SetMonitorIds gets a reference to the given []int64 and assigns it to the MonitorIds field. +func (o *SLOResponseData) SetMonitorIds(v []int64) { + o.MonitorIds = v +} + +// GetMonitorTags returns the MonitorTags field value if set, zero value otherwise. +func (o *SLOResponseData) GetMonitorTags() []string { + if o == nil || o.MonitorTags == nil { + var ret []string + return ret + } + return o.MonitorTags +} + +// GetMonitorTagsOk returns a tuple with the MonitorTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetMonitorTagsOk() (*[]string, bool) { + if o == nil || o.MonitorTags == nil { + return nil, false + } + return &o.MonitorTags, true +} + +// HasMonitorTags returns a boolean if a field has been set. +func (o *SLOResponseData) HasMonitorTags() bool { + if o != nil && o.MonitorTags != nil { + return true + } + + return false +} + +// SetMonitorTags gets a reference to the given []string and assigns it to the MonitorTags field. +func (o *SLOResponseData) SetMonitorTags(v []string) { + o.MonitorTags = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SLOResponseData) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SLOResponseData) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SLOResponseData) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SLOResponseData) GetQuery() ServiceLevelObjectiveQuery { + if o == nil || o.Query == nil { + var ret ServiceLevelObjectiveQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetQueryOk() (*ServiceLevelObjectiveQuery, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SLOResponseData) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given ServiceLevelObjectiveQuery and assigns it to the Query field. +func (o *SLOResponseData) SetQuery(v ServiceLevelObjectiveQuery) { + o.Query = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SLOResponseData) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SLOResponseData) GetTagsOk() (*[]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 *SLOResponseData) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SLOResponseData) SetTags(v []string) { + o.Tags = v +} + +// GetThresholds returns the Thresholds field value if set, zero value otherwise. +func (o *SLOResponseData) GetThresholds() []SLOThreshold { + if o == nil || o.Thresholds == nil { + var ret []SLOThreshold + return ret + } + return o.Thresholds +} + +// GetThresholdsOk returns a tuple with the Thresholds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetThresholdsOk() (*[]SLOThreshold, bool) { + if o == nil || o.Thresholds == nil { + return nil, false + } + return &o.Thresholds, true +} + +// HasThresholds returns a boolean if a field has been set. +func (o *SLOResponseData) HasThresholds() bool { + if o != nil && o.Thresholds != nil { + return true + } + + return false +} + +// SetThresholds gets a reference to the given []SLOThreshold and assigns it to the Thresholds field. +func (o *SLOResponseData) SetThresholds(v []SLOThreshold) { + o.Thresholds = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SLOResponseData) GetType() SLOType { + if o == nil || o.Type == nil { + var ret SLOType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOResponseData) GetTypeOk() (*SLOType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SLOResponseData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SLOType and assigns it to the Type field. +func (o *SLOResponseData) SetType(v SLOType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ConfiguredAlertIds != nil { + toSerialize["configured_alert_ids"] = o.ConfiguredAlertIds + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.ModifiedAt != nil { + toSerialize["modified_at"] = o.ModifiedAt + } + if o.MonitorIds != nil { + toSerialize["monitor_ids"] = o.MonitorIds + } + if o.MonitorTags != nil { + toSerialize["monitor_tags"] = o.MonitorTags + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Thresholds != nil { + toSerialize["thresholds"] = o.Thresholds + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ConfiguredAlertIds []int64 `json:"configured_alert_ids,omitempty"` + CreatedAt *int64 `json:"created_at,omitempty"` + Creator *Creator `json:"creator,omitempty"` + Description common.NullableString `json:"description,omitempty"` + Groups []string `json:"groups,omitempty"` + Id *string `json:"id,omitempty"` + ModifiedAt *int64 `json:"modified_at,omitempty"` + MonitorIds []int64 `json:"monitor_ids,omitempty"` + MonitorTags []string `json:"monitor_tags,omitempty"` + Name *string `json:"name,omitempty"` + Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` + Tags []string `json:"tags,omitempty"` + Thresholds []SLOThreshold `json:"thresholds,omitempty"` + Type *SLOType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ConfiguredAlertIds = all.ConfiguredAlertIds + o.CreatedAt = all.CreatedAt + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.Description = all.Description + o.Groups = all.Groups + o.Id = all.Id + o.ModifiedAt = all.ModifiedAt + o.MonitorIds = all.MonitorIds + o.MonitorTags = all.MonitorTags + o.Name = all.Name + if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Query = all.Query + o.Tags = all.Tags + o.Thresholds = all.Thresholds + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_slo_threshold.go b/api/v1/datadog/model_slo_threshold.go new file mode 100644 index 00000000000..457ff7d13d3 --- /dev/null +++ b/api/v1/datadog/model_slo_threshold.go @@ -0,0 +1,270 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOThreshold SLO thresholds (target and optionally warning) for a single time window. +type SLOThreshold struct { + // The target value for the service level indicator within the corresponding + // timeframe. + Target float64 `json:"target"` + // A string representation of the target that indicates its precision. + // It uses trailing zeros to show significant decimal places (for example `98.00`). + // + // Always included in service level objective responses. Ignored in + // create/update requests. + TargetDisplay *string `json:"target_display,omitempty"` + // The SLO time window options. + Timeframe SLOTimeframe `json:"timeframe"` + // The warning value for the service level objective. + Warning *float64 `json:"warning,omitempty"` + // A string representation of the warning target (see the description of + // the `target_display` field for details). + // + // Included in service level objective responses if a warning target exists. + // Ignored in create/update requests. + WarningDisplay *string `json:"warning_display,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{} +} + +// NewSLOThreshold instantiates a new SLOThreshold 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 NewSLOThreshold(target float64, timeframe SLOTimeframe) *SLOThreshold { + this := SLOThreshold{} + this.Target = target + this.Timeframe = timeframe + return &this +} + +// NewSLOThresholdWithDefaults instantiates a new SLOThreshold 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 NewSLOThresholdWithDefaults() *SLOThreshold { + this := SLOThreshold{} + return &this +} + +// GetTarget returns the Target field value. +func (o *SLOThreshold) GetTarget() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *SLOThreshold) GetTargetOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *SLOThreshold) SetTarget(v float64) { + o.Target = v +} + +// GetTargetDisplay returns the TargetDisplay field value if set, zero value otherwise. +func (o *SLOThreshold) GetTargetDisplay() string { + if o == nil || o.TargetDisplay == nil { + var ret string + return ret + } + return *o.TargetDisplay +} + +// GetTargetDisplayOk returns a tuple with the TargetDisplay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOThreshold) GetTargetDisplayOk() (*string, bool) { + if o == nil || o.TargetDisplay == nil { + return nil, false + } + return o.TargetDisplay, true +} + +// HasTargetDisplay returns a boolean if a field has been set. +func (o *SLOThreshold) HasTargetDisplay() bool { + if o != nil && o.TargetDisplay != nil { + return true + } + + return false +} + +// SetTargetDisplay gets a reference to the given string and assigns it to the TargetDisplay field. +func (o *SLOThreshold) SetTargetDisplay(v string) { + o.TargetDisplay = &v +} + +// GetTimeframe returns the Timeframe field value. +func (o *SLOThreshold) GetTimeframe() SLOTimeframe { + if o == nil { + var ret SLOTimeframe + return ret + } + return o.Timeframe +} + +// GetTimeframeOk returns a tuple with the Timeframe field value +// and a boolean to check if the value has been set. +func (o *SLOThreshold) GetTimeframeOk() (*SLOTimeframe, bool) { + if o == nil { + return nil, false + } + return &o.Timeframe, true +} + +// SetTimeframe sets field value. +func (o *SLOThreshold) SetTimeframe(v SLOTimeframe) { + o.Timeframe = v +} + +// GetWarning returns the Warning field value if set, zero value otherwise. +func (o *SLOThreshold) GetWarning() float64 { + if o == nil || o.Warning == nil { + var ret float64 + return ret + } + return *o.Warning +} + +// GetWarningOk returns a tuple with the Warning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOThreshold) GetWarningOk() (*float64, bool) { + if o == nil || o.Warning == nil { + return nil, false + } + return o.Warning, true +} + +// HasWarning returns a boolean if a field has been set. +func (o *SLOThreshold) HasWarning() bool { + if o != nil && o.Warning != nil { + return true + } + + return false +} + +// SetWarning gets a reference to the given float64 and assigns it to the Warning field. +func (o *SLOThreshold) SetWarning(v float64) { + o.Warning = &v +} + +// GetWarningDisplay returns the WarningDisplay field value if set, zero value otherwise. +func (o *SLOThreshold) GetWarningDisplay() string { + if o == nil || o.WarningDisplay == nil { + var ret string + return ret + } + return *o.WarningDisplay +} + +// GetWarningDisplayOk returns a tuple with the WarningDisplay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOThreshold) GetWarningDisplayOk() (*string, bool) { + if o == nil || o.WarningDisplay == nil { + return nil, false + } + return o.WarningDisplay, true +} + +// HasWarningDisplay returns a boolean if a field has been set. +func (o *SLOThreshold) HasWarningDisplay() bool { + if o != nil && o.WarningDisplay != nil { + return true + } + + return false +} + +// SetWarningDisplay gets a reference to the given string and assigns it to the WarningDisplay field. +func (o *SLOThreshold) SetWarningDisplay(v string) { + o.WarningDisplay = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOThreshold) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["target"] = o.Target + if o.TargetDisplay != nil { + toSerialize["target_display"] = o.TargetDisplay + } + toSerialize["timeframe"] = o.Timeframe + if o.Warning != nil { + toSerialize["warning"] = o.Warning + } + if o.WarningDisplay != nil { + toSerialize["warning_display"] = o.WarningDisplay + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Target *float64 `json:"target"` + Timeframe *SLOTimeframe `json:"timeframe"` + }{} + all := struct { + Target float64 `json:"target"` + TargetDisplay *string `json:"target_display,omitempty"` + Timeframe SLOTimeframe `json:"timeframe"` + Warning *float64 `json:"warning,omitempty"` + WarningDisplay *string `json:"warning_display,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Timeframe == nil { + return fmt.Errorf("Required field timeframe missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Timeframe; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Target = all.Target + o.TargetDisplay = all.TargetDisplay + o.Timeframe = all.Timeframe + o.Warning = all.Warning + o.WarningDisplay = all.WarningDisplay + return nil +} diff --git a/api/v1/datadog/model_slo_timeframe.go b/api/v1/datadog/model_slo_timeframe.go new file mode 100644 index 00000000000..15eb8efe82b --- /dev/null +++ b/api/v1/datadog/model_slo_timeframe.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOTimeframe The SLO time window options. +type SLOTimeframe string + +// List of SLOTimeframe. +const ( + SLOTIMEFRAME_SEVEN_DAYS SLOTimeframe = "7d" + SLOTIMEFRAME_THIRTY_DAYS SLOTimeframe = "30d" + SLOTIMEFRAME_NINETY_DAYS SLOTimeframe = "90d" + SLOTIMEFRAME_CUSTOM SLOTimeframe = "custom" +) + +var allowedSLOTimeframeEnumValues = []SLOTimeframe{ + SLOTIMEFRAME_SEVEN_DAYS, + SLOTIMEFRAME_THIRTY_DAYS, + SLOTIMEFRAME_NINETY_DAYS, + SLOTIMEFRAME_CUSTOM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SLOTimeframe) GetAllowedValues() []SLOTimeframe { + return allowedSLOTimeframeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SLOTimeframe) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SLOTimeframe(value) + return nil +} + +// NewSLOTimeframeFromValue returns a pointer to a valid SLOTimeframe +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSLOTimeframeFromValue(v string) (*SLOTimeframe, error) { + ev := SLOTimeframe(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SLOTimeframe: valid values are %v", v, allowedSLOTimeframeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SLOTimeframe) IsValid() bool { + for _, existing := range allowedSLOTimeframeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SLOTimeframe value. +func (v SLOTimeframe) Ptr() *SLOTimeframe { + return &v +} + +// NullableSLOTimeframe handles when a null is used for SLOTimeframe. +type NullableSLOTimeframe struct { + value *SLOTimeframe + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOTimeframe) Get() *SLOTimeframe { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOTimeframe) Set(val *SLOTimeframe) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOTimeframe) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSLOTimeframe) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOTimeframe initializes the struct as if Set has been called. +func NewNullableSLOTimeframe(val *SLOTimeframe) *NullableSLOTimeframe { + return &NullableSLOTimeframe{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOTimeframe) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOTimeframe) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_type.go b/api/v1/datadog/model_slo_type.go new file mode 100644 index 00000000000..2f580816e71 --- /dev/null +++ b/api/v1/datadog/model_slo_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOType The type of the service level objective. +type SLOType string + +// List of SLOType. +const ( + SLOTYPE_METRIC SLOType = "metric" + SLOTYPE_MONITOR SLOType = "monitor" +) + +var allowedSLOTypeEnumValues = []SLOType{ + SLOTYPE_METRIC, + SLOTYPE_MONITOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SLOType) GetAllowedValues() []SLOType { + return allowedSLOTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SLOType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SLOType(value) + return nil +} + +// NewSLOTypeFromValue returns a pointer to a valid SLOType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSLOTypeFromValue(v string) (*SLOType, error) { + ev := SLOType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SLOType: valid values are %v", v, allowedSLOTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SLOType) IsValid() bool { + for _, existing := range allowedSLOTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SLOType value. +func (v SLOType) Ptr() *SLOType { + return &v +} + +// NullableSLOType handles when a null is used for SLOType. +type NullableSLOType struct { + value *SLOType + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOType) Get() *SLOType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOType) Set(val *SLOType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSLOType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOType initializes the struct as if Set has been called. +func NewNullableSLOType(val *SLOType) *NullableSLOType { + return &NullableSLOType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_type_numeric.go b/api/v1/datadog/model_slo_type_numeric.go new file mode 100644 index 00000000000..74a28cbc3fc --- /dev/null +++ b/api/v1/datadog/model_slo_type_numeric.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOTypeNumeric A numeric representation of the type of the service level objective (`0` for +// monitor, `1` for metric). Always included in service level objective responses. +// Ignored in create/update requests. +type SLOTypeNumeric int32 + +// List of SLOTypeNumeric. +const ( + SLOTYPENUMERIC_MONITOR SLOTypeNumeric = 0 + SLOTYPENUMERIC_METRIC SLOTypeNumeric = 1 +) + +var allowedSLOTypeNumericEnumValues = []SLOTypeNumeric{ + SLOTYPENUMERIC_MONITOR, + SLOTYPENUMERIC_METRIC, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SLOTypeNumeric) GetAllowedValues() []SLOTypeNumeric { + return allowedSLOTypeNumericEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SLOTypeNumeric) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SLOTypeNumeric(value) + return nil +} + +// NewSLOTypeNumericFromValue returns a pointer to a valid SLOTypeNumeric +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSLOTypeNumericFromValue(v int32) (*SLOTypeNumeric, error) { + ev := SLOTypeNumeric(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SLOTypeNumeric: valid values are %v", v, allowedSLOTypeNumericEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SLOTypeNumeric) IsValid() bool { + for _, existing := range allowedSLOTypeNumericEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SLOTypeNumeric value. +func (v SLOTypeNumeric) Ptr() *SLOTypeNumeric { + return &v +} + +// NullableSLOTypeNumeric handles when a null is used for SLOTypeNumeric. +type NullableSLOTypeNumeric struct { + value *SLOTypeNumeric + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOTypeNumeric) Get() *SLOTypeNumeric { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOTypeNumeric) Set(val *SLOTypeNumeric) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOTypeNumeric) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSLOTypeNumeric) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOTypeNumeric initializes the struct as if Set has been called. +func NewNullableSLOTypeNumeric(val *SLOTypeNumeric) *NullableSLOTypeNumeric { + return &NullableSLOTypeNumeric{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOTypeNumeric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOTypeNumeric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_slo_widget_definition.go b/api/v1/datadog/model_slo_widget_definition.go new file mode 100644 index 00000000000..4113057c6e3 --- /dev/null +++ b/api/v1/datadog/model_slo_widget_definition.go @@ -0,0 +1,476 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOWidgetDefinition Use the SLO and uptime widget to track your SLOs (Service Level Objectives) and uptime on screenboards and timeboards. +type SLOWidgetDefinition struct { + // Defined global time target. + GlobalTimeTarget *string `json:"global_time_target,omitempty"` + // Defined error budget. + ShowErrorBudget *bool `json:"show_error_budget,omitempty"` + // ID of the SLO displayed. + SloId *string `json:"slo_id,omitempty"` + // Times being monitored. + TimeWindows []WidgetTimeWindows `json:"time_windows,omitempty"` + // Title of the widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the SLO widget. + Type SLOWidgetDefinitionType `json:"type"` + // Define how you want the SLO to be displayed. + ViewMode *WidgetViewMode `json:"view_mode,omitempty"` + // Type of view displayed by the widget. + ViewType string `json:"view_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{} +} + +// NewSLOWidgetDefinition instantiates a new SLOWidgetDefinition 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 NewSLOWidgetDefinition(typeVar SLOWidgetDefinitionType, viewType string) *SLOWidgetDefinition { + this := SLOWidgetDefinition{} + this.Type = typeVar + this.ViewType = viewType + return &this +} + +// NewSLOWidgetDefinitionWithDefaults instantiates a new SLOWidgetDefinition 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 NewSLOWidgetDefinitionWithDefaults() *SLOWidgetDefinition { + this := SLOWidgetDefinition{} + var typeVar SLOWidgetDefinitionType = SLOWIDGETDEFINITIONTYPE_SLO + this.Type = typeVar + var viewType string = "detail" + this.ViewType = viewType + return &this +} + +// GetGlobalTimeTarget returns the GlobalTimeTarget field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetGlobalTimeTarget() string { + if o == nil || o.GlobalTimeTarget == nil { + var ret string + return ret + } + return *o.GlobalTimeTarget +} + +// GetGlobalTimeTargetOk returns a tuple with the GlobalTimeTarget field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetGlobalTimeTargetOk() (*string, bool) { + if o == nil || o.GlobalTimeTarget == nil { + return nil, false + } + return o.GlobalTimeTarget, true +} + +// HasGlobalTimeTarget returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasGlobalTimeTarget() bool { + if o != nil && o.GlobalTimeTarget != nil { + return true + } + + return false +} + +// SetGlobalTimeTarget gets a reference to the given string and assigns it to the GlobalTimeTarget field. +func (o *SLOWidgetDefinition) SetGlobalTimeTarget(v string) { + o.GlobalTimeTarget = &v +} + +// GetShowErrorBudget returns the ShowErrorBudget field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetShowErrorBudget() bool { + if o == nil || o.ShowErrorBudget == nil { + var ret bool + return ret + } + return *o.ShowErrorBudget +} + +// GetShowErrorBudgetOk returns a tuple with the ShowErrorBudget field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetShowErrorBudgetOk() (*bool, bool) { + if o == nil || o.ShowErrorBudget == nil { + return nil, false + } + return o.ShowErrorBudget, true +} + +// HasShowErrorBudget returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasShowErrorBudget() bool { + if o != nil && o.ShowErrorBudget != nil { + return true + } + + return false +} + +// SetShowErrorBudget gets a reference to the given bool and assigns it to the ShowErrorBudget field. +func (o *SLOWidgetDefinition) SetShowErrorBudget(v bool) { + o.ShowErrorBudget = &v +} + +// GetSloId returns the SloId field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetSloId() string { + if o == nil || o.SloId == nil { + var ret string + return ret + } + return *o.SloId +} + +// GetSloIdOk returns a tuple with the SloId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetSloIdOk() (*string, bool) { + if o == nil || o.SloId == nil { + return nil, false + } + return o.SloId, true +} + +// HasSloId returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasSloId() bool { + if o != nil && o.SloId != nil { + return true + } + + return false +} + +// SetSloId gets a reference to the given string and assigns it to the SloId field. +func (o *SLOWidgetDefinition) SetSloId(v string) { + o.SloId = &v +} + +// GetTimeWindows returns the TimeWindows field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetTimeWindows() []WidgetTimeWindows { + if o == nil || o.TimeWindows == nil { + var ret []WidgetTimeWindows + return ret + } + return o.TimeWindows +} + +// GetTimeWindowsOk returns a tuple with the TimeWindows field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetTimeWindowsOk() (*[]WidgetTimeWindows, bool) { + if o == nil || o.TimeWindows == nil { + return nil, false + } + return &o.TimeWindows, true +} + +// HasTimeWindows returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasTimeWindows() bool { + if o != nil && o.TimeWindows != nil { + return true + } + + return false +} + +// SetTimeWindows gets a reference to the given []WidgetTimeWindows and assigns it to the TimeWindows field. +func (o *SLOWidgetDefinition) SetTimeWindows(v []WidgetTimeWindows) { + o.TimeWindows = v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *SLOWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *SLOWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *SLOWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *SLOWidgetDefinition) GetType() SLOWidgetDefinitionType { + if o == nil { + var ret SLOWidgetDefinitionType + 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 *SLOWidgetDefinition) GetTypeOk() (*SLOWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SLOWidgetDefinition) SetType(v SLOWidgetDefinitionType) { + o.Type = v +} + +// GetViewMode returns the ViewMode field value if set, zero value otherwise. +func (o *SLOWidgetDefinition) GetViewMode() WidgetViewMode { + if o == nil || o.ViewMode == nil { + var ret WidgetViewMode + return ret + } + return *o.ViewMode +} + +// GetViewModeOk returns a tuple with the ViewMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetViewModeOk() (*WidgetViewMode, bool) { + if o == nil || o.ViewMode == nil { + return nil, false + } + return o.ViewMode, true +} + +// HasViewMode returns a boolean if a field has been set. +func (o *SLOWidgetDefinition) HasViewMode() bool { + if o != nil && o.ViewMode != nil { + return true + } + + return false +} + +// SetViewMode gets a reference to the given WidgetViewMode and assigns it to the ViewMode field. +func (o *SLOWidgetDefinition) SetViewMode(v WidgetViewMode) { + o.ViewMode = &v +} + +// GetViewType returns the ViewType field value. +func (o *SLOWidgetDefinition) GetViewType() string { + if o == nil { + var ret string + return ret + } + return o.ViewType +} + +// GetViewTypeOk returns a tuple with the ViewType field value +// and a boolean to check if the value has been set. +func (o *SLOWidgetDefinition) GetViewTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ViewType, true +} + +// SetViewType sets field value. +func (o *SLOWidgetDefinition) SetViewType(v string) { + o.ViewType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SLOWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.GlobalTimeTarget != nil { + toSerialize["global_time_target"] = o.GlobalTimeTarget + } + if o.ShowErrorBudget != nil { + toSerialize["show_error_budget"] = o.ShowErrorBudget + } + if o.SloId != nil { + toSerialize["slo_id"] = o.SloId + } + if o.TimeWindows != nil { + toSerialize["time_windows"] = o.TimeWindows + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + if o.ViewMode != nil { + toSerialize["view_mode"] = o.ViewMode + } + toSerialize["view_type"] = o.ViewType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *SLOWidgetDefinitionType `json:"type"` + ViewType *string `json:"view_type"` + }{} + all := struct { + GlobalTimeTarget *string `json:"global_time_target,omitempty"` + ShowErrorBudget *bool `json:"show_error_budget,omitempty"` + SloId *string `json:"slo_id,omitempty"` + TimeWindows []WidgetTimeWindows `json:"time_windows,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type SLOWidgetDefinitionType `json:"type"` + ViewMode *WidgetViewMode `json:"view_mode,omitempty"` + ViewType string `json:"view_type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + if required.ViewType == nil { + return fmt.Errorf("Required field view_type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ViewMode; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.GlobalTimeTarget = all.GlobalTimeTarget + o.ShowErrorBudget = all.ShowErrorBudget + o.SloId = all.SloId + o.TimeWindows = all.TimeWindows + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + o.ViewMode = all.ViewMode + o.ViewType = all.ViewType + return nil +} diff --git a/api/v1/datadog/model_slo_widget_definition_type.go b/api/v1/datadog/model_slo_widget_definition_type.go new file mode 100644 index 00000000000..349a7888302 --- /dev/null +++ b/api/v1/datadog/model_slo_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SLOWidgetDefinitionType Type of the SLO widget. +type SLOWidgetDefinitionType string + +// List of SLOWidgetDefinitionType. +const ( + SLOWIDGETDEFINITIONTYPE_SLO SLOWidgetDefinitionType = "slo" +) + +var allowedSLOWidgetDefinitionTypeEnumValues = []SLOWidgetDefinitionType{ + SLOWIDGETDEFINITIONTYPE_SLO, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SLOWidgetDefinitionType) GetAllowedValues() []SLOWidgetDefinitionType { + return allowedSLOWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SLOWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SLOWidgetDefinitionType(value) + return nil +} + +// NewSLOWidgetDefinitionTypeFromValue returns a pointer to a valid SLOWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSLOWidgetDefinitionTypeFromValue(v string) (*SLOWidgetDefinitionType, error) { + ev := SLOWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SLOWidgetDefinitionType: valid values are %v", v, allowedSLOWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SLOWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedSLOWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SLOWidgetDefinitionType value. +func (v SLOWidgetDefinitionType) Ptr() *SLOWidgetDefinitionType { + return &v +} + +// NullableSLOWidgetDefinitionType handles when a null is used for SLOWidgetDefinitionType. +type NullableSLOWidgetDefinitionType struct { + value *SLOWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableSLOWidgetDefinitionType) Get() *SLOWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSLOWidgetDefinitionType) Set(val *SLOWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSLOWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSLOWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSLOWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableSLOWidgetDefinitionType(val *SLOWidgetDefinitionType) *NullableSLOWidgetDefinitionType { + return &NullableSLOWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSLOWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSLOWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_successful_signal_update_response.go b/api/v1/datadog/model_successful_signal_update_response.go new file mode 100644 index 00000000000..c0a4d096892 --- /dev/null +++ b/api/v1/datadog/model_successful_signal_update_response.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 datadog + +import ( + "encoding/json" +) + +// SuccessfulSignalUpdateResponse Updated signal data following a successfully performed update. +type SuccessfulSignalUpdateResponse struct { + // Status of the response. + Status *string `json:"status,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{} +} + +// NewSuccessfulSignalUpdateResponse instantiates a new SuccessfulSignalUpdateResponse 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 NewSuccessfulSignalUpdateResponse() *SuccessfulSignalUpdateResponse { + this := SuccessfulSignalUpdateResponse{} + return &this +} + +// NewSuccessfulSignalUpdateResponseWithDefaults instantiates a new SuccessfulSignalUpdateResponse 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 NewSuccessfulSignalUpdateResponseWithDefaults() *SuccessfulSignalUpdateResponse { + this := SuccessfulSignalUpdateResponse{} + return &this +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SuccessfulSignalUpdateResponse) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SuccessfulSignalUpdateResponse) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SuccessfulSignalUpdateResponse) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *SuccessfulSignalUpdateResponse) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SuccessfulSignalUpdateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SuccessfulSignalUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Status *string `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_sunburst_widget_definition.go b/api/v1/datadog/model_sunburst_widget_definition.go new file mode 100644 index 00000000000..1960607ffc9 --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_definition.go @@ -0,0 +1,434 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SunburstWidgetDefinition Sunbursts are spot on to highlight how groups contribute to the total of a query. +type SunburstWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // Show the total value in this widget. + HideTotal *bool `json:"hide_total,omitempty"` + // Configuration of the legend. + Legend *SunburstWidgetLegend `json:"legend,omitempty"` + // List of sunburst widget requests. + Requests []SunburstWidgetRequest `json:"requests"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the Sunburst widget. + Type SunburstWidgetDefinitionType `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{} +} + +// NewSunburstWidgetDefinition instantiates a new SunburstWidgetDefinition 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 NewSunburstWidgetDefinition(requests []SunburstWidgetRequest, typeVar SunburstWidgetDefinitionType) *SunburstWidgetDefinition { + this := SunburstWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewSunburstWidgetDefinitionWithDefaults instantiates a new SunburstWidgetDefinition 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 NewSunburstWidgetDefinitionWithDefaults() *SunburstWidgetDefinition { + this := SunburstWidgetDefinition{} + var typeVar SunburstWidgetDefinitionType = SUNBURSTWIDGETDEFINITIONTYPE_SUNBURST + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *SunburstWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *SunburstWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *SunburstWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetHideTotal returns the HideTotal field value if set, zero value otherwise. +func (o *SunburstWidgetDefinition) GetHideTotal() bool { + if o == nil || o.HideTotal == nil { + var ret bool + return ret + } + return *o.HideTotal +} + +// GetHideTotalOk returns a tuple with the HideTotal field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetHideTotalOk() (*bool, bool) { + if o == nil || o.HideTotal == nil { + return nil, false + } + return o.HideTotal, true +} + +// HasHideTotal returns a boolean if a field has been set. +func (o *SunburstWidgetDefinition) HasHideTotal() bool { + if o != nil && o.HideTotal != nil { + return true + } + + return false +} + +// SetHideTotal gets a reference to the given bool and assigns it to the HideTotal field. +func (o *SunburstWidgetDefinition) SetHideTotal(v bool) { + o.HideTotal = &v +} + +// GetLegend returns the Legend field value if set, zero value otherwise. +func (o *SunburstWidgetDefinition) GetLegend() SunburstWidgetLegend { + if o == nil || o.Legend == nil { + var ret SunburstWidgetLegend + return ret + } + return *o.Legend +} + +// GetLegendOk returns a tuple with the Legend field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetLegendOk() (*SunburstWidgetLegend, bool) { + if o == nil || o.Legend == nil { + return nil, false + } + return o.Legend, true +} + +// HasLegend returns a boolean if a field has been set. +func (o *SunburstWidgetDefinition) HasLegend() bool { + if o != nil && o.Legend != nil { + return true + } + + return false +} + +// SetLegend gets a reference to the given SunburstWidgetLegend and assigns it to the Legend field. +func (o *SunburstWidgetDefinition) SetLegend(v SunburstWidgetLegend) { + o.Legend = &v +} + +// GetRequests returns the Requests field value. +func (o *SunburstWidgetDefinition) GetRequests() []SunburstWidgetRequest { + if o == nil { + var ret []SunburstWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetRequestsOk() (*[]SunburstWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *SunburstWidgetDefinition) SetRequests(v []SunburstWidgetRequest) { + o.Requests = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *SunburstWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *SunburstWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *SunburstWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *SunburstWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *SunburstWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *SunburstWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *SunburstWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *SunburstWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *SunburstWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *SunburstWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *SunburstWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *SunburstWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *SunburstWidgetDefinition) GetType() SunburstWidgetDefinitionType { + if o == nil { + var ret SunburstWidgetDefinitionType + 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 *SunburstWidgetDefinition) GetTypeOk() (*SunburstWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SunburstWidgetDefinition) SetType(v SunburstWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SunburstWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + if o.HideTotal != nil { + toSerialize["hide_total"] = o.HideTotal + } + if o.Legend != nil { + toSerialize["legend"] = o.Legend + } + toSerialize["requests"] = o.Requests + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]SunburstWidgetRequest `json:"requests"` + Type *SunburstWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + HideTotal *bool `json:"hide_total,omitempty"` + Legend *SunburstWidgetLegend `json:"legend,omitempty"` + Requests []SunburstWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type SunburstWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.HideTotal = all.HideTotal + o.Legend = all.Legend + o.Requests = all.Requests + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_sunburst_widget_definition_type.go b/api/v1/datadog/model_sunburst_widget_definition_type.go new file mode 100644 index 00000000000..5ab9bd73f1d --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SunburstWidgetDefinitionType Type of the Sunburst widget. +type SunburstWidgetDefinitionType string + +// List of SunburstWidgetDefinitionType. +const ( + SUNBURSTWIDGETDEFINITIONTYPE_SUNBURST SunburstWidgetDefinitionType = "sunburst" +) + +var allowedSunburstWidgetDefinitionTypeEnumValues = []SunburstWidgetDefinitionType{ + SUNBURSTWIDGETDEFINITIONTYPE_SUNBURST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SunburstWidgetDefinitionType) GetAllowedValues() []SunburstWidgetDefinitionType { + return allowedSunburstWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SunburstWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SunburstWidgetDefinitionType(value) + return nil +} + +// NewSunburstWidgetDefinitionTypeFromValue returns a pointer to a valid SunburstWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSunburstWidgetDefinitionTypeFromValue(v string) (*SunburstWidgetDefinitionType, error) { + ev := SunburstWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SunburstWidgetDefinitionType: valid values are %v", v, allowedSunburstWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SunburstWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedSunburstWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SunburstWidgetDefinitionType value. +func (v SunburstWidgetDefinitionType) Ptr() *SunburstWidgetDefinitionType { + return &v +} + +// NullableSunburstWidgetDefinitionType handles when a null is used for SunburstWidgetDefinitionType. +type NullableSunburstWidgetDefinitionType struct { + value *SunburstWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableSunburstWidgetDefinitionType) Get() *SunburstWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSunburstWidgetDefinitionType) Set(val *SunburstWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSunburstWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSunburstWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSunburstWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableSunburstWidgetDefinitionType(val *SunburstWidgetDefinitionType) *NullableSunburstWidgetDefinitionType { + return &NullableSunburstWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSunburstWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSunburstWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_sunburst_widget_legend.go b/api/v1/datadog/model_sunburst_widget_legend.go new file mode 100644 index 00000000000..28e182fd973 --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_legend.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SunburstWidgetLegend - Configuration of the legend. +type SunburstWidgetLegend struct { + SunburstWidgetLegendTable *SunburstWidgetLegendTable + SunburstWidgetLegendInlineAutomatic *SunburstWidgetLegendInlineAutomatic + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SunburstWidgetLegendTableAsSunburstWidgetLegend is a convenience function that returns SunburstWidgetLegendTable wrapped in SunburstWidgetLegend. +func SunburstWidgetLegendTableAsSunburstWidgetLegend(v *SunburstWidgetLegendTable) SunburstWidgetLegend { + return SunburstWidgetLegend{SunburstWidgetLegendTable: v} +} + +// SunburstWidgetLegendInlineAutomaticAsSunburstWidgetLegend is a convenience function that returns SunburstWidgetLegendInlineAutomatic wrapped in SunburstWidgetLegend. +func SunburstWidgetLegendInlineAutomaticAsSunburstWidgetLegend(v *SunburstWidgetLegendInlineAutomatic) SunburstWidgetLegend { + return SunburstWidgetLegend{SunburstWidgetLegendInlineAutomatic: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *SunburstWidgetLegend) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into SunburstWidgetLegendTable + err = json.Unmarshal(data, &obj.SunburstWidgetLegendTable) + if err == nil { + if obj.SunburstWidgetLegendTable != nil && obj.SunburstWidgetLegendTable.UnparsedObject == nil { + jsonSunburstWidgetLegendTable, _ := json.Marshal(obj.SunburstWidgetLegendTable) + if string(jsonSunburstWidgetLegendTable) == "{}" { // empty struct + obj.SunburstWidgetLegendTable = nil + } else { + match++ + } + } else { + obj.SunburstWidgetLegendTable = nil + } + } else { + obj.SunburstWidgetLegendTable = nil + } + + // try to unmarshal data into SunburstWidgetLegendInlineAutomatic + err = json.Unmarshal(data, &obj.SunburstWidgetLegendInlineAutomatic) + if err == nil { + if obj.SunburstWidgetLegendInlineAutomatic != nil && obj.SunburstWidgetLegendInlineAutomatic.UnparsedObject == nil { + jsonSunburstWidgetLegendInlineAutomatic, _ := json.Marshal(obj.SunburstWidgetLegendInlineAutomatic) + if string(jsonSunburstWidgetLegendInlineAutomatic) == "{}" { // empty struct + obj.SunburstWidgetLegendInlineAutomatic = nil + } else { + match++ + } + } else { + obj.SunburstWidgetLegendInlineAutomatic = nil + } + } else { + obj.SunburstWidgetLegendInlineAutomatic = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.SunburstWidgetLegendTable = nil + obj.SunburstWidgetLegendInlineAutomatic = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj SunburstWidgetLegend) MarshalJSON() ([]byte, error) { + if obj.SunburstWidgetLegendTable != nil { + return json.Marshal(&obj.SunburstWidgetLegendTable) + } + + if obj.SunburstWidgetLegendInlineAutomatic != nil { + return json.Marshal(&obj.SunburstWidgetLegendInlineAutomatic) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *SunburstWidgetLegend) GetActualInstance() interface{} { + if obj.SunburstWidgetLegendTable != nil { + return obj.SunburstWidgetLegendTable + } + + if obj.SunburstWidgetLegendInlineAutomatic != nil { + return obj.SunburstWidgetLegendInlineAutomatic + } + + // all schemas are nil + return nil +} + +// NullableSunburstWidgetLegend handles when a null is used for SunburstWidgetLegend. +type NullableSunburstWidgetLegend struct { + value *SunburstWidgetLegend + isSet bool +} + +// Get returns the associated value. +func (v NullableSunburstWidgetLegend) Get() *SunburstWidgetLegend { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSunburstWidgetLegend) Set(val *SunburstWidgetLegend) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSunburstWidgetLegend) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableSunburstWidgetLegend) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSunburstWidgetLegend initializes the struct as if Set has been called. +func NewNullableSunburstWidgetLegend(val *SunburstWidgetLegend) *NullableSunburstWidgetLegend { + return &NullableSunburstWidgetLegend{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSunburstWidgetLegend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSunburstWidgetLegend) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go b/api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go new file mode 100644 index 00000000000..920425631c5 --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_legend_inline_automatic.go @@ -0,0 +1,189 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SunburstWidgetLegendInlineAutomatic Configuration of inline or automatic legends. +type SunburstWidgetLegendInlineAutomatic struct { + // Whether to hide the percentages of the groups. + HidePercent *bool `json:"hide_percent,omitempty"` + // Whether to hide the values of the groups. + HideValue *bool `json:"hide_value,omitempty"` + // Whether to show the legend inline or let it be automatically generated. + Type SunburstWidgetLegendInlineAutomaticType `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{} +} + +// NewSunburstWidgetLegendInlineAutomatic instantiates a new SunburstWidgetLegendInlineAutomatic 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 NewSunburstWidgetLegendInlineAutomatic(typeVar SunburstWidgetLegendInlineAutomaticType) *SunburstWidgetLegendInlineAutomatic { + this := SunburstWidgetLegendInlineAutomatic{} + this.Type = typeVar + return &this +} + +// NewSunburstWidgetLegendInlineAutomaticWithDefaults instantiates a new SunburstWidgetLegendInlineAutomatic 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 NewSunburstWidgetLegendInlineAutomaticWithDefaults() *SunburstWidgetLegendInlineAutomatic { + this := SunburstWidgetLegendInlineAutomatic{} + return &this +} + +// GetHidePercent returns the HidePercent field value if set, zero value otherwise. +func (o *SunburstWidgetLegendInlineAutomatic) GetHidePercent() bool { + if o == nil || o.HidePercent == nil { + var ret bool + return ret + } + return *o.HidePercent +} + +// GetHidePercentOk returns a tuple with the HidePercent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetLegendInlineAutomatic) GetHidePercentOk() (*bool, bool) { + if o == nil || o.HidePercent == nil { + return nil, false + } + return o.HidePercent, true +} + +// HasHidePercent returns a boolean if a field has been set. +func (o *SunburstWidgetLegendInlineAutomatic) HasHidePercent() bool { + if o != nil && o.HidePercent != nil { + return true + } + + return false +} + +// SetHidePercent gets a reference to the given bool and assigns it to the HidePercent field. +func (o *SunburstWidgetLegendInlineAutomatic) SetHidePercent(v bool) { + o.HidePercent = &v +} + +// GetHideValue returns the HideValue field value if set, zero value otherwise. +func (o *SunburstWidgetLegendInlineAutomatic) GetHideValue() bool { + if o == nil || o.HideValue == nil { + var ret bool + return ret + } + return *o.HideValue +} + +// GetHideValueOk returns a tuple with the HideValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetLegendInlineAutomatic) GetHideValueOk() (*bool, bool) { + if o == nil || o.HideValue == nil { + return nil, false + } + return o.HideValue, true +} + +// HasHideValue returns a boolean if a field has been set. +func (o *SunburstWidgetLegendInlineAutomatic) HasHideValue() bool { + if o != nil && o.HideValue != nil { + return true + } + + return false +} + +// SetHideValue gets a reference to the given bool and assigns it to the HideValue field. +func (o *SunburstWidgetLegendInlineAutomatic) SetHideValue(v bool) { + o.HideValue = &v +} + +// GetType returns the Type field value. +func (o *SunburstWidgetLegendInlineAutomatic) GetType() SunburstWidgetLegendInlineAutomaticType { + if o == nil { + var ret SunburstWidgetLegendInlineAutomaticType + 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 *SunburstWidgetLegendInlineAutomatic) GetTypeOk() (*SunburstWidgetLegendInlineAutomaticType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SunburstWidgetLegendInlineAutomatic) SetType(v SunburstWidgetLegendInlineAutomaticType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SunburstWidgetLegendInlineAutomatic) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.HidePercent != nil { + toSerialize["hide_percent"] = o.HidePercent + } + if o.HideValue != nil { + toSerialize["hide_value"] = o.HideValue + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SunburstWidgetLegendInlineAutomatic) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *SunburstWidgetLegendInlineAutomaticType `json:"type"` + }{} + all := struct { + HidePercent *bool `json:"hide_percent,omitempty"` + HideValue *bool `json:"hide_value,omitempty"` + Type SunburstWidgetLegendInlineAutomaticType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.HidePercent = all.HidePercent + o.HideValue = all.HideValue + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go b/api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go new file mode 100644 index 00000000000..23bb38307dd --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_legend_inline_automatic_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SunburstWidgetLegendInlineAutomaticType Whether to show the legend inline or let it be automatically generated. +type SunburstWidgetLegendInlineAutomaticType string + +// List of SunburstWidgetLegendInlineAutomaticType. +const ( + SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_INLINE SunburstWidgetLegendInlineAutomaticType = "inline" + SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_AUTOMATIC SunburstWidgetLegendInlineAutomaticType = "automatic" +) + +var allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues = []SunburstWidgetLegendInlineAutomaticType{ + SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_INLINE, + SUNBURSTWIDGETLEGENDINLINEAUTOMATICTYPE_AUTOMATIC, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SunburstWidgetLegendInlineAutomaticType) GetAllowedValues() []SunburstWidgetLegendInlineAutomaticType { + return allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SunburstWidgetLegendInlineAutomaticType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SunburstWidgetLegendInlineAutomaticType(value) + return nil +} + +// NewSunburstWidgetLegendInlineAutomaticTypeFromValue returns a pointer to a valid SunburstWidgetLegendInlineAutomaticType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSunburstWidgetLegendInlineAutomaticTypeFromValue(v string) (*SunburstWidgetLegendInlineAutomaticType, error) { + ev := SunburstWidgetLegendInlineAutomaticType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SunburstWidgetLegendInlineAutomaticType: valid values are %v", v, allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SunburstWidgetLegendInlineAutomaticType) IsValid() bool { + for _, existing := range allowedSunburstWidgetLegendInlineAutomaticTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SunburstWidgetLegendInlineAutomaticType value. +func (v SunburstWidgetLegendInlineAutomaticType) Ptr() *SunburstWidgetLegendInlineAutomaticType { + return &v +} + +// NullableSunburstWidgetLegendInlineAutomaticType handles when a null is used for SunburstWidgetLegendInlineAutomaticType. +type NullableSunburstWidgetLegendInlineAutomaticType struct { + value *SunburstWidgetLegendInlineAutomaticType + isSet bool +} + +// Get returns the associated value. +func (v NullableSunburstWidgetLegendInlineAutomaticType) Get() *SunburstWidgetLegendInlineAutomaticType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSunburstWidgetLegendInlineAutomaticType) Set(val *SunburstWidgetLegendInlineAutomaticType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSunburstWidgetLegendInlineAutomaticType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSunburstWidgetLegendInlineAutomaticType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSunburstWidgetLegendInlineAutomaticType initializes the struct as if Set has been called. +func NewNullableSunburstWidgetLegendInlineAutomaticType(val *SunburstWidgetLegendInlineAutomaticType) *NullableSunburstWidgetLegendInlineAutomaticType { + return &NullableSunburstWidgetLegendInlineAutomaticType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSunburstWidgetLegendInlineAutomaticType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSunburstWidgetLegendInlineAutomaticType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_sunburst_widget_legend_table.go b/api/v1/datadog/model_sunburst_widget_legend_table.go new file mode 100644 index 00000000000..2fa8a8bae82 --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_legend_table.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SunburstWidgetLegendTable Configuration of table-based legend. +type SunburstWidgetLegendTable struct { + // Whether or not to show a table legend. + Type SunburstWidgetLegendTableType `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{} +} + +// NewSunburstWidgetLegendTable instantiates a new SunburstWidgetLegendTable 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 NewSunburstWidgetLegendTable(typeVar SunburstWidgetLegendTableType) *SunburstWidgetLegendTable { + this := SunburstWidgetLegendTable{} + this.Type = typeVar + return &this +} + +// NewSunburstWidgetLegendTableWithDefaults instantiates a new SunburstWidgetLegendTable 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 NewSunburstWidgetLegendTableWithDefaults() *SunburstWidgetLegendTable { + this := SunburstWidgetLegendTable{} + return &this +} + +// GetType returns the Type field value. +func (o *SunburstWidgetLegendTable) GetType() SunburstWidgetLegendTableType { + if o == nil { + var ret SunburstWidgetLegendTableType + 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 *SunburstWidgetLegendTable) GetTypeOk() (*SunburstWidgetLegendTableType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SunburstWidgetLegendTable) SetType(v SunburstWidgetLegendTableType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SunburstWidgetLegendTable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SunburstWidgetLegendTable) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *SunburstWidgetLegendTableType `json:"type"` + }{} + all := struct { + Type SunburstWidgetLegendTableType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_sunburst_widget_legend_table_type.go b/api/v1/datadog/model_sunburst_widget_legend_table_type.go new file mode 100644 index 00000000000..87afb23c1b6 --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_legend_table_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SunburstWidgetLegendTableType Whether or not to show a table legend. +type SunburstWidgetLegendTableType string + +// List of SunburstWidgetLegendTableType. +const ( + SUNBURSTWIDGETLEGENDTABLETYPE_TABLE SunburstWidgetLegendTableType = "table" + SUNBURSTWIDGETLEGENDTABLETYPE_NONE SunburstWidgetLegendTableType = "none" +) + +var allowedSunburstWidgetLegendTableTypeEnumValues = []SunburstWidgetLegendTableType{ + SUNBURSTWIDGETLEGENDTABLETYPE_TABLE, + SUNBURSTWIDGETLEGENDTABLETYPE_NONE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SunburstWidgetLegendTableType) GetAllowedValues() []SunburstWidgetLegendTableType { + return allowedSunburstWidgetLegendTableTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SunburstWidgetLegendTableType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SunburstWidgetLegendTableType(value) + return nil +} + +// NewSunburstWidgetLegendTableTypeFromValue returns a pointer to a valid SunburstWidgetLegendTableType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSunburstWidgetLegendTableTypeFromValue(v string) (*SunburstWidgetLegendTableType, error) { + ev := SunburstWidgetLegendTableType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SunburstWidgetLegendTableType: valid values are %v", v, allowedSunburstWidgetLegendTableTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SunburstWidgetLegendTableType) IsValid() bool { + for _, existing := range allowedSunburstWidgetLegendTableTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SunburstWidgetLegendTableType value. +func (v SunburstWidgetLegendTableType) Ptr() *SunburstWidgetLegendTableType { + return &v +} + +// NullableSunburstWidgetLegendTableType handles when a null is used for SunburstWidgetLegendTableType. +type NullableSunburstWidgetLegendTableType struct { + value *SunburstWidgetLegendTableType + isSet bool +} + +// Get returns the associated value. +func (v NullableSunburstWidgetLegendTableType) Get() *SunburstWidgetLegendTableType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSunburstWidgetLegendTableType) Set(val *SunburstWidgetLegendTableType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSunburstWidgetLegendTableType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSunburstWidgetLegendTableType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSunburstWidgetLegendTableType initializes the struct as if Set has been called. +func NewNullableSunburstWidgetLegendTableType(val *SunburstWidgetLegendTableType) *NullableSunburstWidgetLegendTableType { + return &NullableSunburstWidgetLegendTableType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSunburstWidgetLegendTableType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSunburstWidgetLegendTableType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_sunburst_widget_request.go b/api/v1/datadog/model_sunburst_widget_request.go new file mode 100644 index 00000000000..d87e0d1985f --- /dev/null +++ b/api/v1/datadog/model_sunburst_widget_request.go @@ -0,0 +1,641 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SunburstWidgetRequest Request definition of sunburst widget. +type SunburstWidgetRequest struct { + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The log query. + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Widget query. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,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{} +} + +// NewSunburstWidgetRequest instantiates a new SunburstWidgetRequest 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 NewSunburstWidgetRequest() *SunburstWidgetRequest { + this := SunburstWidgetRequest{} + return &this +} + +// NewSunburstWidgetRequestWithDefaults instantiates a new SunburstWidgetRequest 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 NewSunburstWidgetRequestWithDefaults() *SunburstWidgetRequest { + this := SunburstWidgetRequest{} + return &this +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *SunburstWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetAuditQuery() LogQueryDefinition { + if o == nil || o.AuditQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.AuditQuery +} + +// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.AuditQuery == nil { + return nil, false + } + return o.AuditQuery, true +} + +// HasAuditQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasAuditQuery() bool { + if o != nil && o.AuditQuery != nil { + return true + } + + return false +} + +// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. +func (o *SunburstWidgetRequest) SetAuditQuery(v LogQueryDefinition) { + o.AuditQuery = &v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *SunburstWidgetRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *SunburstWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *SunburstWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *SunburstWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *SunburstWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *SunburstWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *SunburstWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *SunburstWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *SunburstWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *SunburstWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *SunburstWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SunburstWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *SunburstWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *SunburstWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SunburstWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.AuditQuery != nil { + toSerialize["audit_query"] = o.AuditQuery + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SunburstWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.AuditQuery = all.AuditQuery + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + o.Formulas = all.Formulas + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_step.go b/api/v1/datadog/model_synthetics_api_step.go new file mode 100644 index 00000000000..c26f2fea407 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_step.go @@ -0,0 +1,381 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAPIStep The steps used in a Synthetics multistep API test. +type SyntheticsAPIStep struct { + // Determines whether or not to continue with test if this step fails. + AllowFailure *bool `json:"allowFailure,omitempty"` + // Array of assertions used for the test. + Assertions []SyntheticsAssertion `json:"assertions"` + // Array of values to parse and save as variables from the response. + ExtractedValues []SyntheticsParsingOptions `json:"extractedValues,omitempty"` + // Determines whether or not to consider the entire test as failed if this step fails. + // Can be used only if `allowFailure` is `true`. + IsCritical *bool `json:"isCritical,omitempty"` + // The name of the step. + Name string `json:"name"` + // Object describing the Synthetic test request. + Request SyntheticsTestRequest `json:"request"` + // Object describing the retry strategy to apply to a Synthetic test. + Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` + // The subtype of the Synthetic multistep API test step, currently only supporting `http`. + Subtype SyntheticsAPIStepSubtype `json:"subtype"` + // 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{} +} + +// NewSyntheticsAPIStep instantiates a new SyntheticsAPIStep 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 NewSyntheticsAPIStep(assertions []SyntheticsAssertion, name string, request SyntheticsTestRequest, subtype SyntheticsAPIStepSubtype) *SyntheticsAPIStep { + this := SyntheticsAPIStep{} + this.Assertions = assertions + this.Name = name + this.Request = request + this.Subtype = subtype + return &this +} + +// NewSyntheticsAPIStepWithDefaults instantiates a new SyntheticsAPIStep 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 NewSyntheticsAPIStepWithDefaults() *SyntheticsAPIStep { + this := SyntheticsAPIStep{} + return &this +} + +// GetAllowFailure returns the AllowFailure field value if set, zero value otherwise. +func (o *SyntheticsAPIStep) GetAllowFailure() bool { + if o == nil || o.AllowFailure == nil { + var ret bool + return ret + } + return *o.AllowFailure +} + +// GetAllowFailureOk returns a tuple with the AllowFailure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetAllowFailureOk() (*bool, bool) { + if o == nil || o.AllowFailure == nil { + return nil, false + } + return o.AllowFailure, true +} + +// HasAllowFailure returns a boolean if a field has been set. +func (o *SyntheticsAPIStep) HasAllowFailure() bool { + if o != nil && o.AllowFailure != nil { + return true + } + + return false +} + +// SetAllowFailure gets a reference to the given bool and assigns it to the AllowFailure field. +func (o *SyntheticsAPIStep) SetAllowFailure(v bool) { + o.AllowFailure = &v +} + +// GetAssertions returns the Assertions field value. +func (o *SyntheticsAPIStep) GetAssertions() []SyntheticsAssertion { + if o == nil { + var ret []SyntheticsAssertion + return ret + } + return o.Assertions +} + +// GetAssertionsOk returns a tuple with the Assertions field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { + if o == nil { + return nil, false + } + return &o.Assertions, true +} + +// SetAssertions sets field value. +func (o *SyntheticsAPIStep) SetAssertions(v []SyntheticsAssertion) { + o.Assertions = v +} + +// GetExtractedValues returns the ExtractedValues field value if set, zero value otherwise. +func (o *SyntheticsAPIStep) GetExtractedValues() []SyntheticsParsingOptions { + if o == nil || o.ExtractedValues == nil { + var ret []SyntheticsParsingOptions + return ret + } + return o.ExtractedValues +} + +// GetExtractedValuesOk returns a tuple with the ExtractedValues field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetExtractedValuesOk() (*[]SyntheticsParsingOptions, bool) { + if o == nil || o.ExtractedValues == nil { + return nil, false + } + return &o.ExtractedValues, true +} + +// HasExtractedValues returns a boolean if a field has been set. +func (o *SyntheticsAPIStep) HasExtractedValues() bool { + if o != nil && o.ExtractedValues != nil { + return true + } + + return false +} + +// SetExtractedValues gets a reference to the given []SyntheticsParsingOptions and assigns it to the ExtractedValues field. +func (o *SyntheticsAPIStep) SetExtractedValues(v []SyntheticsParsingOptions) { + o.ExtractedValues = v +} + +// GetIsCritical returns the IsCritical field value if set, zero value otherwise. +func (o *SyntheticsAPIStep) GetIsCritical() bool { + if o == nil || o.IsCritical == nil { + var ret bool + return ret + } + return *o.IsCritical +} + +// GetIsCriticalOk returns a tuple with the IsCritical field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetIsCriticalOk() (*bool, bool) { + if o == nil || o.IsCritical == nil { + return nil, false + } + return o.IsCritical, true +} + +// HasIsCritical returns a boolean if a field has been set. +func (o *SyntheticsAPIStep) HasIsCritical() bool { + if o != nil && o.IsCritical != nil { + return true + } + + return false +} + +// SetIsCritical gets a reference to the given bool and assigns it to the IsCritical field. +func (o *SyntheticsAPIStep) SetIsCritical(v bool) { + o.IsCritical = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsAPIStep) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsAPIStep) SetName(v string) { + o.Name = v +} + +// GetRequest returns the Request field value. +func (o *SyntheticsAPIStep) GetRequest() SyntheticsTestRequest { + if o == nil { + var ret SyntheticsTestRequest + return ret + } + return o.Request +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetRequestOk() (*SyntheticsTestRequest, bool) { + if o == nil { + return nil, false + } + return &o.Request, true +} + +// SetRequest sets field value. +func (o *SyntheticsAPIStep) SetRequest(v SyntheticsTestRequest) { + o.Request = v +} + +// GetRetry returns the Retry field value if set, zero value otherwise. +func (o *SyntheticsAPIStep) GetRetry() SyntheticsTestOptionsRetry { + if o == nil || o.Retry == nil { + var ret SyntheticsTestOptionsRetry + return ret + } + return *o.Retry +} + +// GetRetryOk returns a tuple with the Retry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetRetryOk() (*SyntheticsTestOptionsRetry, bool) { + if o == nil || o.Retry == nil { + return nil, false + } + return o.Retry, true +} + +// HasRetry returns a boolean if a field has been set. +func (o *SyntheticsAPIStep) HasRetry() bool { + if o != nil && o.Retry != nil { + return true + } + + return false +} + +// SetRetry gets a reference to the given SyntheticsTestOptionsRetry and assigns it to the Retry field. +func (o *SyntheticsAPIStep) SetRetry(v SyntheticsTestOptionsRetry) { + o.Retry = &v +} + +// GetSubtype returns the Subtype field value. +func (o *SyntheticsAPIStep) GetSubtype() SyntheticsAPIStepSubtype { + if o == nil { + var ret SyntheticsAPIStepSubtype + return ret + } + return o.Subtype +} + +// GetSubtypeOk returns a tuple with the Subtype field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPIStep) GetSubtypeOk() (*SyntheticsAPIStepSubtype, bool) { + if o == nil { + return nil, false + } + return &o.Subtype, true +} + +// SetSubtype sets field value. +func (o *SyntheticsAPIStep) SetSubtype(v SyntheticsAPIStepSubtype) { + o.Subtype = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPIStep) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AllowFailure != nil { + toSerialize["allowFailure"] = o.AllowFailure + } + toSerialize["assertions"] = o.Assertions + if o.ExtractedValues != nil { + toSerialize["extractedValues"] = o.ExtractedValues + } + if o.IsCritical != nil { + toSerialize["isCritical"] = o.IsCritical + } + toSerialize["name"] = o.Name + toSerialize["request"] = o.Request + if o.Retry != nil { + toSerialize["retry"] = o.Retry + } + toSerialize["subtype"] = o.Subtype + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Assertions *[]SyntheticsAssertion `json:"assertions"` + Name *string `json:"name"` + Request *SyntheticsTestRequest `json:"request"` + Subtype *SyntheticsAPIStepSubtype `json:"subtype"` + }{} + all := struct { + AllowFailure *bool `json:"allowFailure,omitempty"` + Assertions []SyntheticsAssertion `json:"assertions"` + ExtractedValues []SyntheticsParsingOptions `json:"extractedValues,omitempty"` + IsCritical *bool `json:"isCritical,omitempty"` + Name string `json:"name"` + Request SyntheticsTestRequest `json:"request"` + Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` + Subtype SyntheticsAPIStepSubtype `json:"subtype"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Assertions == nil { + return fmt.Errorf("Required field assertions missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Request == nil { + return fmt.Errorf("Required field request missing") + } + if required.Subtype == nil { + return fmt.Errorf("Required field subtype missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Subtype; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AllowFailure = all.AllowFailure + o.Assertions = all.Assertions + o.ExtractedValues = all.ExtractedValues + o.IsCritical = all.IsCritical + o.Name = all.Name + if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Request = all.Request + if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Retry = all.Retry + o.Subtype = all.Subtype + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_step_subtype.go b/api/v1/datadog/model_synthetics_api_step_subtype.go new file mode 100644 index 00000000000..b9be3ed801d --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_step_subtype.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAPIStepSubtype The subtype of the Synthetic multistep API test step, currently only supporting `http`. +type SyntheticsAPIStepSubtype string + +// List of SyntheticsAPIStepSubtype. +const ( + SYNTHETICSAPISTEPSUBTYPE_HTTP SyntheticsAPIStepSubtype = "http" +) + +var allowedSyntheticsAPIStepSubtypeEnumValues = []SyntheticsAPIStepSubtype{ + SYNTHETICSAPISTEPSUBTYPE_HTTP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsAPIStepSubtype) GetAllowedValues() []SyntheticsAPIStepSubtype { + return allowedSyntheticsAPIStepSubtypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsAPIStepSubtype) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsAPIStepSubtype(value) + return nil +} + +// NewSyntheticsAPIStepSubtypeFromValue returns a pointer to a valid SyntheticsAPIStepSubtype +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsAPIStepSubtypeFromValue(v string) (*SyntheticsAPIStepSubtype, error) { + ev := SyntheticsAPIStepSubtype(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAPIStepSubtype: valid values are %v", v, allowedSyntheticsAPIStepSubtypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsAPIStepSubtype) IsValid() bool { + for _, existing := range allowedSyntheticsAPIStepSubtypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAPIStepSubtype value. +func (v SyntheticsAPIStepSubtype) Ptr() *SyntheticsAPIStepSubtype { + return &v +} + +// NullableSyntheticsAPIStepSubtype handles when a null is used for SyntheticsAPIStepSubtype. +type NullableSyntheticsAPIStepSubtype struct { + value *SyntheticsAPIStepSubtype + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsAPIStepSubtype) Get() *SyntheticsAPIStepSubtype { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsAPIStepSubtype) Set(val *SyntheticsAPIStepSubtype) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsAPIStepSubtype) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsAPIStepSubtype) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsAPIStepSubtype initializes the struct as if Set has been called. +func NewNullableSyntheticsAPIStepSubtype(val *SyntheticsAPIStepSubtype) *NullableSyntheticsAPIStepSubtype { + return &NullableSyntheticsAPIStepSubtype{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsAPIStepSubtype) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsAPIStepSubtype) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_api_test_.go b/api/v1/datadog/model_synthetics_api_test_.go new file mode 100644 index 00000000000..62122994fc4 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_.go @@ -0,0 +1,505 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAPITest Object containing details about a Synthetic API test. +type SyntheticsAPITest struct { + // Configuration object for a Synthetic API test. + Config SyntheticsAPITestConfig `json:"config"` + // Array of locations used to run the test. + Locations []string `json:"locations"` + // Notification message associated with the test. + Message string `json:"message"` + // The associated monitor ID. + MonitorId *int64 `json:"monitor_id,omitempty"` + // Name of the test. + Name string `json:"name"` + // Object describing the extra options for a Synthetic test. + Options SyntheticsTestOptions `json:"options"` + // The public ID for the test. + PublicId *string `json:"public_id,omitempty"` + // Define whether you want to start (`live`) or pause (`paused`) a + // Synthetic test. + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + // The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, + // `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. + Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` + // Array of tags attached to the test. + Tags []string `json:"tags,omitempty"` + // Type of the Synthetic test, `api`. + Type SyntheticsAPITestType `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{} +} + +// NewSyntheticsAPITest instantiates a new SyntheticsAPITest 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 NewSyntheticsAPITest(config SyntheticsAPITestConfig, locations []string, message string, name string, options SyntheticsTestOptions, typeVar SyntheticsAPITestType) *SyntheticsAPITest { + this := SyntheticsAPITest{} + this.Config = config + this.Locations = locations + this.Message = message + this.Name = name + this.Options = options + this.Type = typeVar + return &this +} + +// NewSyntheticsAPITestWithDefaults instantiates a new SyntheticsAPITest 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 NewSyntheticsAPITestWithDefaults() *SyntheticsAPITest { + this := SyntheticsAPITest{} + var typeVar SyntheticsAPITestType = SYNTHETICSAPITESTTYPE_API + this.Type = typeVar + return &this +} + +// GetConfig returns the Config field value. +func (o *SyntheticsAPITest) GetConfig() SyntheticsAPITestConfig { + if o == nil { + var ret SyntheticsAPITestConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetConfigOk() (*SyntheticsAPITestConfig, bool) { + if o == nil { + return nil, false + } + return &o.Config, true +} + +// SetConfig sets field value. +func (o *SyntheticsAPITest) SetConfig(v SyntheticsAPITestConfig) { + o.Config = v +} + +// GetLocations returns the Locations field value. +func (o *SyntheticsAPITest) GetLocations() []string { + if o == nil { + var ret []string + return ret + } + return o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetLocationsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Locations, true +} + +// SetLocations sets field value. +func (o *SyntheticsAPITest) SetLocations(v []string) { + o.Locations = v +} + +// GetMessage returns the Message field value. +func (o *SyntheticsAPITest) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *SyntheticsAPITest) SetMessage(v string) { + o.Message = v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetMonitorId() int64 { + if o == nil || o.MonitorId == nil { + var ret int64 + return ret + } + return *o.MonitorId +} + +// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetMonitorIdOk() (*int64, bool) { + if o == nil || o.MonitorId == nil { + return nil, false + } + return o.MonitorId, true +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasMonitorId() bool { + if o != nil && o.MonitorId != nil { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. +func (o *SyntheticsAPITest) SetMonitorId(v int64) { + o.MonitorId = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsAPITest) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsAPITest) SetName(v string) { + o.Name = v +} + +// GetOptions returns the Options field value. +func (o *SyntheticsAPITest) GetOptions() SyntheticsTestOptions { + if o == nil { + var ret SyntheticsTestOptions + return ret + } + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetOptionsOk() (*SyntheticsTestOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value. +func (o *SyntheticsAPITest) SetOptions(v SyntheticsTestOptions) { + o.Options = v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *SyntheticsAPITest) SetPublicId(v string) { + o.PublicId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetStatus() SyntheticsTestPauseStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestPauseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. +func (o *SyntheticsAPITest) SetStatus(v SyntheticsTestPauseStatus) { + o.Status = &v +} + +// GetSubtype returns the Subtype field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetSubtype() SyntheticsTestDetailsSubType { + if o == nil || o.Subtype == nil { + var ret SyntheticsTestDetailsSubType + return ret + } + return *o.Subtype +} + +// GetSubtypeOk returns a tuple with the Subtype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetSubtypeOk() (*SyntheticsTestDetailsSubType, bool) { + if o == nil || o.Subtype == nil { + return nil, false + } + return o.Subtype, true +} + +// HasSubtype returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasSubtype() bool { + if o != nil && o.Subtype != nil { + return true + } + + return false +} + +// SetSubtype gets a reference to the given SyntheticsTestDetailsSubType and assigns it to the Subtype field. +func (o *SyntheticsAPITest) SetSubtype(v SyntheticsTestDetailsSubType) { + o.Subtype = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SyntheticsAPITest) GetTagsOk() (*[]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 *SyntheticsAPITest) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SyntheticsAPITest) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value. +func (o *SyntheticsAPITest) GetType() SyntheticsAPITestType { + if o == nil { + var ret SyntheticsAPITestType + 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 *SyntheticsAPITest) GetTypeOk() (*SyntheticsAPITestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsAPITest) SetType(v SyntheticsAPITestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPITest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["config"] = o.Config + toSerialize["locations"] = o.Locations + toSerialize["message"] = o.Message + if o.MonitorId != nil { + toSerialize["monitor_id"] = o.MonitorId + } + toSerialize["name"] = o.Name + toSerialize["options"] = o.Options + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Subtype != nil { + toSerialize["subtype"] = o.Subtype + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Config *SyntheticsAPITestConfig `json:"config"` + Locations *[]string `json:"locations"` + Message *string `json:"message"` + Name *string `json:"name"` + Options *SyntheticsTestOptions `json:"options"` + Type *SyntheticsAPITestType `json:"type"` + }{} + all := struct { + Config SyntheticsAPITestConfig `json:"config"` + Locations []string `json:"locations"` + Message string `json:"message"` + MonitorId *int64 `json:"monitor_id,omitempty"` + Name string `json:"name"` + Options SyntheticsTestOptions `json:"options"` + PublicId *string `json:"public_id,omitempty"` + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` + Tags []string `json:"tags,omitempty"` + Type SyntheticsAPITestType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Config == nil { + return fmt.Errorf("Required field config missing") + } + if required.Locations == nil { + return fmt.Errorf("Required field locations missing") + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Options == nil { + return fmt.Errorf("Required field options missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Subtype; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Config = all.Config + o.Locations = all.Locations + o.Message = all.Message + o.MonitorId = all.MonitorId + o.Name = all.Name + if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.PublicId = all.PublicId + o.Status = all.Status + o.Subtype = all.Subtype + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_config.go b/api/v1/datadog/model_synthetics_api_test_config.go new file mode 100644 index 00000000000..26ca3a4cde3 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_config.go @@ -0,0 +1,226 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsAPITestConfig Configuration object for a Synthetic API test. +type SyntheticsAPITestConfig struct { + // Array of assertions used for the test. Required for single API tests. + Assertions []SyntheticsAssertion `json:"assertions,omitempty"` + // Array of variables used for the test. + ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` + // Object describing the Synthetic test request. + Request *SyntheticsTestRequest `json:"request,omitempty"` + // When the test subtype is `multi`, the steps of the test. + Steps []SyntheticsAPIStep `json:"steps,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{} +} + +// NewSyntheticsAPITestConfig instantiates a new SyntheticsAPITestConfig 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 NewSyntheticsAPITestConfig() *SyntheticsAPITestConfig { + this := SyntheticsAPITestConfig{} + return &this +} + +// NewSyntheticsAPITestConfigWithDefaults instantiates a new SyntheticsAPITestConfig 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 NewSyntheticsAPITestConfigWithDefaults() *SyntheticsAPITestConfig { + this := SyntheticsAPITestConfig{} + return &this +} + +// GetAssertions returns the Assertions field value if set, zero value otherwise. +func (o *SyntheticsAPITestConfig) GetAssertions() []SyntheticsAssertion { + if o == nil || o.Assertions == nil { + var ret []SyntheticsAssertion + return ret + } + return o.Assertions +} + +// GetAssertionsOk returns a tuple with the Assertions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { + if o == nil || o.Assertions == nil { + return nil, false + } + return &o.Assertions, true +} + +// HasAssertions returns a boolean if a field has been set. +func (o *SyntheticsAPITestConfig) HasAssertions() bool { + if o != nil && o.Assertions != nil { + return true + } + + return false +} + +// SetAssertions gets a reference to the given []SyntheticsAssertion and assigns it to the Assertions field. +func (o *SyntheticsAPITestConfig) SetAssertions(v []SyntheticsAssertion) { + o.Assertions = v +} + +// GetConfigVariables returns the ConfigVariables field value if set, zero value otherwise. +func (o *SyntheticsAPITestConfig) GetConfigVariables() []SyntheticsConfigVariable { + if o == nil || o.ConfigVariables == nil { + var ret []SyntheticsConfigVariable + return ret + } + return o.ConfigVariables +} + +// GetConfigVariablesOk returns a tuple with the ConfigVariables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool) { + if o == nil || o.ConfigVariables == nil { + return nil, false + } + return &o.ConfigVariables, true +} + +// HasConfigVariables returns a boolean if a field has been set. +func (o *SyntheticsAPITestConfig) HasConfigVariables() bool { + if o != nil && o.ConfigVariables != nil { + return true + } + + return false +} + +// SetConfigVariables gets a reference to the given []SyntheticsConfigVariable and assigns it to the ConfigVariables field. +func (o *SyntheticsAPITestConfig) SetConfigVariables(v []SyntheticsConfigVariable) { + o.ConfigVariables = v +} + +// GetRequest returns the Request field value if set, zero value otherwise. +func (o *SyntheticsAPITestConfig) GetRequest() SyntheticsTestRequest { + if o == nil || o.Request == nil { + var ret SyntheticsTestRequest + return ret + } + return *o.Request +} + +// GetRequestOk returns a tuple with the Request field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { + if o == nil || o.Request == nil { + return nil, false + } + return o.Request, true +} + +// HasRequest returns a boolean if a field has been set. +func (o *SyntheticsAPITestConfig) HasRequest() bool { + if o != nil && o.Request != nil { + return true + } + + return false +} + +// SetRequest gets a reference to the given SyntheticsTestRequest and assigns it to the Request field. +func (o *SyntheticsAPITestConfig) SetRequest(v SyntheticsTestRequest) { + o.Request = &v +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *SyntheticsAPITestConfig) GetSteps() []SyntheticsAPIStep { + if o == nil || o.Steps == nil { + var ret []SyntheticsAPIStep + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestConfig) GetStepsOk() (*[]SyntheticsAPIStep, bool) { + if o == nil || o.Steps == nil { + return nil, false + } + return &o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *SyntheticsAPITestConfig) HasSteps() bool { + if o != nil && o.Steps != nil { + return true + } + + return false +} + +// SetSteps gets a reference to the given []SyntheticsAPIStep and assigns it to the Steps field. +func (o *SyntheticsAPITestConfig) SetSteps(v []SyntheticsAPIStep) { + o.Steps = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPITestConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Assertions != nil { + toSerialize["assertions"] = o.Assertions + } + if o.ConfigVariables != nil { + toSerialize["configVariables"] = o.ConfigVariables + } + if o.Request != nil { + toSerialize["request"] = o.Request + } + if o.Steps != nil { + toSerialize["steps"] = o.Steps + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPITestConfig) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Assertions []SyntheticsAssertion `json:"assertions,omitempty"` + ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` + Request *SyntheticsTestRequest `json:"request,omitempty"` + Steps []SyntheticsAPIStep `json:"steps,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Assertions = all.Assertions + o.ConfigVariables = all.ConfigVariables + if all.Request != nil && all.Request.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Request = all.Request + o.Steps = all.Steps + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_failure_code.go b/api/v1/datadog/model_synthetics_api_test_failure_code.go new file mode 100644 index 00000000000..37be90a63a0 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_failure_code.go @@ -0,0 +1,157 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsApiTestFailureCode Error code that can be returned by a Synthetic test. +type SyntheticsApiTestFailureCode string + +// List of SyntheticsApiTestFailureCode. +const ( + SYNTHETICSAPITESTFAILURECODE_BODY_TOO_LARGE SyntheticsApiTestFailureCode = "BODY_TOO_LARGE" + SYNTHETICSAPITESTFAILURECODE_DENIED SyntheticsApiTestFailureCode = "DENIED" + SYNTHETICSAPITESTFAILURECODE_TOO_MANY_REDIRECTS SyntheticsApiTestFailureCode = "TOO_MANY_REDIRECTS" + SYNTHETICSAPITESTFAILURECODE_AUTHENTICATION_ERROR SyntheticsApiTestFailureCode = "AUTHENTICATION_ERROR" + SYNTHETICSAPITESTFAILURECODE_DECRYPTION SyntheticsApiTestFailureCode = "DECRYPTION" + SYNTHETICSAPITESTFAILURECODE_INVALID_CHAR_IN_HEADER SyntheticsApiTestFailureCode = "INVALID_CHAR_IN_HEADER" + SYNTHETICSAPITESTFAILURECODE_HEADER_TOO_LARGE SyntheticsApiTestFailureCode = "HEADER_TOO_LARGE" + SYNTHETICSAPITESTFAILURECODE_HEADERS_INCOMPATIBLE_CONTENT_LENGTH SyntheticsApiTestFailureCode = "HEADERS_INCOMPATIBLE_CONTENT_LENGTH" + SYNTHETICSAPITESTFAILURECODE_INVALID_REQUEST SyntheticsApiTestFailureCode = "INVALID_REQUEST" + SYNTHETICSAPITESTFAILURECODE_REQUIRES_UPDATE SyntheticsApiTestFailureCode = "REQUIRES_UPDATE" + SYNTHETICSAPITESTFAILURECODE_UNESCAPED_CHARACTERS_IN_REQUEST_PATH SyntheticsApiTestFailureCode = "UNESCAPED_CHARACTERS_IN_REQUEST_PATH" + SYNTHETICSAPITESTFAILURECODE_MALFORMED_RESPONSE SyntheticsApiTestFailureCode = "MALFORMED_RESPONSE" + SYNTHETICSAPITESTFAILURECODE_INCORRECT_ASSERTION SyntheticsApiTestFailureCode = "INCORRECT_ASSERTION" + SYNTHETICSAPITESTFAILURECODE_CONNREFUSED SyntheticsApiTestFailureCode = "CONNREFUSED" + SYNTHETICSAPITESTFAILURECODE_CONNRESET SyntheticsApiTestFailureCode = "CONNRESET" + SYNTHETICSAPITESTFAILURECODE_DNS SyntheticsApiTestFailureCode = "DNS" + SYNTHETICSAPITESTFAILURECODE_HOSTUNREACH SyntheticsApiTestFailureCode = "HOSTUNREACH" + SYNTHETICSAPITESTFAILURECODE_NETUNREACH SyntheticsApiTestFailureCode = "NETUNREACH" + SYNTHETICSAPITESTFAILURECODE_TIMEOUT SyntheticsApiTestFailureCode = "TIMEOUT" + SYNTHETICSAPITESTFAILURECODE_SSL SyntheticsApiTestFailureCode = "SSL" + SYNTHETICSAPITESTFAILURECODE_OCSP SyntheticsApiTestFailureCode = "OCSP" + SYNTHETICSAPITESTFAILURECODE_INVALID_TEST SyntheticsApiTestFailureCode = "INVALID_TEST" + SYNTHETICSAPITESTFAILURECODE_TUNNEL SyntheticsApiTestFailureCode = "TUNNEL" + SYNTHETICSAPITESTFAILURECODE_WEBSOCKET SyntheticsApiTestFailureCode = "WEBSOCKET" + SYNTHETICSAPITESTFAILURECODE_UNKNOWN SyntheticsApiTestFailureCode = "UNKNOWN" + SYNTHETICSAPITESTFAILURECODE_INTERNAL_ERROR SyntheticsApiTestFailureCode = "INTERNAL_ERROR" +) + +var allowedSyntheticsApiTestFailureCodeEnumValues = []SyntheticsApiTestFailureCode{ + SYNTHETICSAPITESTFAILURECODE_BODY_TOO_LARGE, + SYNTHETICSAPITESTFAILURECODE_DENIED, + SYNTHETICSAPITESTFAILURECODE_TOO_MANY_REDIRECTS, + SYNTHETICSAPITESTFAILURECODE_AUTHENTICATION_ERROR, + SYNTHETICSAPITESTFAILURECODE_DECRYPTION, + SYNTHETICSAPITESTFAILURECODE_INVALID_CHAR_IN_HEADER, + SYNTHETICSAPITESTFAILURECODE_HEADER_TOO_LARGE, + SYNTHETICSAPITESTFAILURECODE_HEADERS_INCOMPATIBLE_CONTENT_LENGTH, + SYNTHETICSAPITESTFAILURECODE_INVALID_REQUEST, + SYNTHETICSAPITESTFAILURECODE_REQUIRES_UPDATE, + SYNTHETICSAPITESTFAILURECODE_UNESCAPED_CHARACTERS_IN_REQUEST_PATH, + SYNTHETICSAPITESTFAILURECODE_MALFORMED_RESPONSE, + SYNTHETICSAPITESTFAILURECODE_INCORRECT_ASSERTION, + SYNTHETICSAPITESTFAILURECODE_CONNREFUSED, + SYNTHETICSAPITESTFAILURECODE_CONNRESET, + SYNTHETICSAPITESTFAILURECODE_DNS, + SYNTHETICSAPITESTFAILURECODE_HOSTUNREACH, + SYNTHETICSAPITESTFAILURECODE_NETUNREACH, + SYNTHETICSAPITESTFAILURECODE_TIMEOUT, + SYNTHETICSAPITESTFAILURECODE_SSL, + SYNTHETICSAPITESTFAILURECODE_OCSP, + SYNTHETICSAPITESTFAILURECODE_INVALID_TEST, + SYNTHETICSAPITESTFAILURECODE_TUNNEL, + SYNTHETICSAPITESTFAILURECODE_WEBSOCKET, + SYNTHETICSAPITESTFAILURECODE_UNKNOWN, + SYNTHETICSAPITESTFAILURECODE_INTERNAL_ERROR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsApiTestFailureCode) GetAllowedValues() []SyntheticsApiTestFailureCode { + return allowedSyntheticsApiTestFailureCodeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsApiTestFailureCode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsApiTestFailureCode(value) + return nil +} + +// NewSyntheticsApiTestFailureCodeFromValue returns a pointer to a valid SyntheticsApiTestFailureCode +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsApiTestFailureCodeFromValue(v string) (*SyntheticsApiTestFailureCode, error) { + ev := SyntheticsApiTestFailureCode(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsApiTestFailureCode: valid values are %v", v, allowedSyntheticsApiTestFailureCodeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsApiTestFailureCode) IsValid() bool { + for _, existing := range allowedSyntheticsApiTestFailureCodeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsApiTestFailureCode value. +func (v SyntheticsApiTestFailureCode) Ptr() *SyntheticsApiTestFailureCode { + return &v +} + +// NullableSyntheticsApiTestFailureCode handles when a null is used for SyntheticsApiTestFailureCode. +type NullableSyntheticsApiTestFailureCode struct { + value *SyntheticsApiTestFailureCode + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsApiTestFailureCode) Get() *SyntheticsApiTestFailureCode { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsApiTestFailureCode) Set(val *SyntheticsApiTestFailureCode) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsApiTestFailureCode) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsApiTestFailureCode) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsApiTestFailureCode initializes the struct as if Set has been called. +func NewNullableSyntheticsApiTestFailureCode(val *SyntheticsApiTestFailureCode) *NullableSyntheticsApiTestFailureCode { + return &NullableSyntheticsApiTestFailureCode{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsApiTestFailureCode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsApiTestFailureCode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_api_test_result_data.go b/api/v1/datadog/model_synthetics_api_test_result_data.go new file mode 100644 index 00000000000..7d5a1c4a958 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_result_data.go @@ -0,0 +1,444 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsAPITestResultData Object containing results for your Synthetic API test. +type SyntheticsAPITestResultData struct { + // Object describing the SSL certificate used for a Synthetic test. + Cert *SyntheticsSSLCertificate `json:"cert,omitempty"` + // Status of a Synthetic test. + EventType *SyntheticsTestProcessStatus `json:"eventType,omitempty"` + // The API test failure details. + Failure *SyntheticsApiTestResultFailure `json:"failure,omitempty"` + // The API test HTTP status code. + HttpStatusCode *int64 `json:"httpStatusCode,omitempty"` + // Request header object used for the API test. + RequestHeaders map[string]interface{} `json:"requestHeaders,omitempty"` + // Response body returned for the API test. + ResponseBody *string `json:"responseBody,omitempty"` + // Response headers returned for the API test. + ResponseHeaders map[string]interface{} `json:"responseHeaders,omitempty"` + // Global size in byte of the API test response. + ResponseSize *int64 `json:"responseSize,omitempty"` + // Object containing all metrics and their values collected for a Synthetic API test. + // Learn more about those metrics in [Synthetics documentation](https://docs.datadoghq.com/synthetics/#metrics). + Timings *SyntheticsTiming `json:"timings,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{} +} + +// NewSyntheticsAPITestResultData instantiates a new SyntheticsAPITestResultData 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 NewSyntheticsAPITestResultData() *SyntheticsAPITestResultData { + this := SyntheticsAPITestResultData{} + return &this +} + +// NewSyntheticsAPITestResultDataWithDefaults instantiates a new SyntheticsAPITestResultData 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 NewSyntheticsAPITestResultDataWithDefaults() *SyntheticsAPITestResultData { + this := SyntheticsAPITestResultData{} + return &this +} + +// GetCert returns the Cert field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetCert() SyntheticsSSLCertificate { + if o == nil || o.Cert == nil { + var ret SyntheticsSSLCertificate + return ret + } + return *o.Cert +} + +// GetCertOk returns a tuple with the Cert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetCertOk() (*SyntheticsSSLCertificate, bool) { + if o == nil || o.Cert == nil { + return nil, false + } + return o.Cert, true +} + +// HasCert returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasCert() bool { + if o != nil && o.Cert != nil { + return true + } + + return false +} + +// SetCert gets a reference to the given SyntheticsSSLCertificate and assigns it to the Cert field. +func (o *SyntheticsAPITestResultData) SetCert(v SyntheticsSSLCertificate) { + o.Cert = &v +} + +// GetEventType returns the EventType field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetEventType() SyntheticsTestProcessStatus { + if o == nil || o.EventType == nil { + var ret SyntheticsTestProcessStatus + return ret + } + return *o.EventType +} + +// GetEventTypeOk returns a tuple with the EventType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetEventTypeOk() (*SyntheticsTestProcessStatus, bool) { + if o == nil || o.EventType == nil { + return nil, false + } + return o.EventType, true +} + +// HasEventType returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasEventType() bool { + if o != nil && o.EventType != nil { + return true + } + + return false +} + +// SetEventType gets a reference to the given SyntheticsTestProcessStatus and assigns it to the EventType field. +func (o *SyntheticsAPITestResultData) SetEventType(v SyntheticsTestProcessStatus) { + o.EventType = &v +} + +// GetFailure returns the Failure field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetFailure() SyntheticsApiTestResultFailure { + if o == nil || o.Failure == nil { + var ret SyntheticsApiTestResultFailure + return ret + } + return *o.Failure +} + +// GetFailureOk returns a tuple with the Failure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetFailureOk() (*SyntheticsApiTestResultFailure, bool) { + if o == nil || o.Failure == nil { + return nil, false + } + return o.Failure, true +} + +// HasFailure returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasFailure() bool { + if o != nil && o.Failure != nil { + return true + } + + return false +} + +// SetFailure gets a reference to the given SyntheticsApiTestResultFailure and assigns it to the Failure field. +func (o *SyntheticsAPITestResultData) SetFailure(v SyntheticsApiTestResultFailure) { + o.Failure = &v +} + +// GetHttpStatusCode returns the HttpStatusCode field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetHttpStatusCode() int64 { + if o == nil || o.HttpStatusCode == nil { + var ret int64 + return ret + } + return *o.HttpStatusCode +} + +// GetHttpStatusCodeOk returns a tuple with the HttpStatusCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetHttpStatusCodeOk() (*int64, bool) { + if o == nil || o.HttpStatusCode == nil { + return nil, false + } + return o.HttpStatusCode, true +} + +// HasHttpStatusCode returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasHttpStatusCode() bool { + if o != nil && o.HttpStatusCode != nil { + return true + } + + return false +} + +// SetHttpStatusCode gets a reference to the given int64 and assigns it to the HttpStatusCode field. +func (o *SyntheticsAPITestResultData) SetHttpStatusCode(v int64) { + o.HttpStatusCode = &v +} + +// GetRequestHeaders returns the RequestHeaders field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetRequestHeaders() map[string]interface{} { + if o == nil || o.RequestHeaders == nil { + var ret map[string]interface{} + return ret + } + return o.RequestHeaders +} + +// GetRequestHeadersOk returns a tuple with the RequestHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetRequestHeadersOk() (*map[string]interface{}, bool) { + if o == nil || o.RequestHeaders == nil { + return nil, false + } + return &o.RequestHeaders, true +} + +// HasRequestHeaders returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasRequestHeaders() bool { + if o != nil && o.RequestHeaders != nil { + return true + } + + return false +} + +// SetRequestHeaders gets a reference to the given map[string]interface{} and assigns it to the RequestHeaders field. +func (o *SyntheticsAPITestResultData) SetRequestHeaders(v map[string]interface{}) { + o.RequestHeaders = v +} + +// GetResponseBody returns the ResponseBody field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetResponseBody() string { + if o == nil || o.ResponseBody == nil { + var ret string + return ret + } + return *o.ResponseBody +} + +// GetResponseBodyOk returns a tuple with the ResponseBody field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetResponseBodyOk() (*string, bool) { + if o == nil || o.ResponseBody == nil { + return nil, false + } + return o.ResponseBody, true +} + +// HasResponseBody returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasResponseBody() bool { + if o != nil && o.ResponseBody != nil { + return true + } + + return false +} + +// SetResponseBody gets a reference to the given string and assigns it to the ResponseBody field. +func (o *SyntheticsAPITestResultData) SetResponseBody(v string) { + o.ResponseBody = &v +} + +// GetResponseHeaders returns the ResponseHeaders field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetResponseHeaders() map[string]interface{} { + if o == nil || o.ResponseHeaders == nil { + var ret map[string]interface{} + return ret + } + return o.ResponseHeaders +} + +// GetResponseHeadersOk returns a tuple with the ResponseHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetResponseHeadersOk() (*map[string]interface{}, bool) { + if o == nil || o.ResponseHeaders == nil { + return nil, false + } + return &o.ResponseHeaders, true +} + +// HasResponseHeaders returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasResponseHeaders() bool { + if o != nil && o.ResponseHeaders != nil { + return true + } + + return false +} + +// SetResponseHeaders gets a reference to the given map[string]interface{} and assigns it to the ResponseHeaders field. +func (o *SyntheticsAPITestResultData) SetResponseHeaders(v map[string]interface{}) { + o.ResponseHeaders = v +} + +// GetResponseSize returns the ResponseSize field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetResponseSize() int64 { + if o == nil || o.ResponseSize == nil { + var ret int64 + return ret + } + return *o.ResponseSize +} + +// GetResponseSizeOk returns a tuple with the ResponseSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetResponseSizeOk() (*int64, bool) { + if o == nil || o.ResponseSize == nil { + return nil, false + } + return o.ResponseSize, true +} + +// HasResponseSize returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasResponseSize() bool { + if o != nil && o.ResponseSize != nil { + return true + } + + return false +} + +// SetResponseSize gets a reference to the given int64 and assigns it to the ResponseSize field. +func (o *SyntheticsAPITestResultData) SetResponseSize(v int64) { + o.ResponseSize = &v +} + +// GetTimings returns the Timings field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultData) GetTimings() SyntheticsTiming { + if o == nil || o.Timings == nil { + var ret SyntheticsTiming + return ret + } + return *o.Timings +} + +// GetTimingsOk returns a tuple with the Timings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultData) GetTimingsOk() (*SyntheticsTiming, bool) { + if o == nil || o.Timings == nil { + return nil, false + } + return o.Timings, true +} + +// HasTimings returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultData) HasTimings() bool { + if o != nil && o.Timings != nil { + return true + } + + return false +} + +// SetTimings gets a reference to the given SyntheticsTiming and assigns it to the Timings field. +func (o *SyntheticsAPITestResultData) SetTimings(v SyntheticsTiming) { + o.Timings = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPITestResultData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cert != nil { + toSerialize["cert"] = o.Cert + } + if o.EventType != nil { + toSerialize["eventType"] = o.EventType + } + if o.Failure != nil { + toSerialize["failure"] = o.Failure + } + if o.HttpStatusCode != nil { + toSerialize["httpStatusCode"] = o.HttpStatusCode + } + if o.RequestHeaders != nil { + toSerialize["requestHeaders"] = o.RequestHeaders + } + if o.ResponseBody != nil { + toSerialize["responseBody"] = o.ResponseBody + } + if o.ResponseHeaders != nil { + toSerialize["responseHeaders"] = o.ResponseHeaders + } + if o.ResponseSize != nil { + toSerialize["responseSize"] = o.ResponseSize + } + if o.Timings != nil { + toSerialize["timings"] = o.Timings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cert *SyntheticsSSLCertificate `json:"cert,omitempty"` + EventType *SyntheticsTestProcessStatus `json:"eventType,omitempty"` + Failure *SyntheticsApiTestResultFailure `json:"failure,omitempty"` + HttpStatusCode *int64 `json:"httpStatusCode,omitempty"` + RequestHeaders map[string]interface{} `json:"requestHeaders,omitempty"` + ResponseBody *string `json:"responseBody,omitempty"` + ResponseHeaders map[string]interface{} `json:"responseHeaders,omitempty"` + ResponseSize *int64 `json:"responseSize,omitempty"` + Timings *SyntheticsTiming `json:"timings,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.EventType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Cert != nil && all.Cert.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Cert = all.Cert + o.EventType = all.EventType + if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Failure = all.Failure + o.HttpStatusCode = all.HttpStatusCode + o.RequestHeaders = all.RequestHeaders + o.ResponseBody = all.ResponseBody + o.ResponseHeaders = all.ResponseHeaders + o.ResponseSize = all.ResponseSize + if all.Timings != nil && all.Timings.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Timings = all.Timings + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_result_failure.go b/api/v1/datadog/model_synthetics_api_test_result_failure.go new file mode 100644 index 00000000000..2e0dca70788 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_result_failure.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsApiTestResultFailure The API test failure details. +type SyntheticsApiTestResultFailure struct { + // Error code that can be returned by a Synthetic test. + Code *SyntheticsApiTestFailureCode `json:"code,omitempty"` + // The API test error message. + Message *string `json:"message,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{} +} + +// NewSyntheticsApiTestResultFailure instantiates a new SyntheticsApiTestResultFailure 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 NewSyntheticsApiTestResultFailure() *SyntheticsApiTestResultFailure { + this := SyntheticsApiTestResultFailure{} + return &this +} + +// NewSyntheticsApiTestResultFailureWithDefaults instantiates a new SyntheticsApiTestResultFailure 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 NewSyntheticsApiTestResultFailureWithDefaults() *SyntheticsApiTestResultFailure { + this := SyntheticsApiTestResultFailure{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *SyntheticsApiTestResultFailure) GetCode() SyntheticsApiTestFailureCode { + if o == nil || o.Code == nil { + var ret SyntheticsApiTestFailureCode + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsApiTestResultFailure) GetCodeOk() (*SyntheticsApiTestFailureCode, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *SyntheticsApiTestResultFailure) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given SyntheticsApiTestFailureCode and assigns it to the Code field. +func (o *SyntheticsApiTestResultFailure) SetCode(v SyntheticsApiTestFailureCode) { + o.Code = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SyntheticsApiTestResultFailure) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsApiTestResultFailure) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SyntheticsApiTestResultFailure) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SyntheticsApiTestResultFailure) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsApiTestResultFailure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsApiTestResultFailure) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *SyntheticsApiTestFailureCode `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Code; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_result_full.go b/api/v1/datadog/model_synthetics_api_test_result_full.go new file mode 100644 index 00000000000..ed8388cb162 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_result_full.go @@ -0,0 +1,361 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsAPITestResultFull Object returned describing a API test result. +type SyntheticsAPITestResultFull struct { + // Object describing the API test configuration. + Check *SyntheticsAPITestResultFullCheck `json:"check,omitempty"` + // When the API test was conducted. + CheckTime *float64 `json:"check_time,omitempty"` + // Version of the API test used. + CheckVersion *int64 `json:"check_version,omitempty"` + // Locations for which to query the API test results. + ProbeDc *string `json:"probe_dc,omitempty"` + // Object containing results for your Synthetic API test. + Result *SyntheticsAPITestResultData `json:"result,omitempty"` + // ID of the API test result. + ResultId *string `json:"result_id,omitempty"` + // The status of your Synthetic monitor. + // * `O` for not triggered + // * `1` for triggered + // * `2` for no data + Status *SyntheticsTestMonitorStatus `json:"status,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{} +} + +// NewSyntheticsAPITestResultFull instantiates a new SyntheticsAPITestResultFull 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 NewSyntheticsAPITestResultFull() *SyntheticsAPITestResultFull { + this := SyntheticsAPITestResultFull{} + return &this +} + +// NewSyntheticsAPITestResultFullWithDefaults instantiates a new SyntheticsAPITestResultFull 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 NewSyntheticsAPITestResultFullWithDefaults() *SyntheticsAPITestResultFull { + this := SyntheticsAPITestResultFull{} + return &this +} + +// GetCheck returns the Check field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultFull) GetCheck() SyntheticsAPITestResultFullCheck { + if o == nil || o.Check == nil { + var ret SyntheticsAPITestResultFullCheck + return ret + } + return *o.Check +} + +// GetCheckOk returns a tuple with the Check field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFull) GetCheckOk() (*SyntheticsAPITestResultFullCheck, bool) { + if o == nil || o.Check == nil { + return nil, false + } + return o.Check, true +} + +// HasCheck returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultFull) HasCheck() bool { + if o != nil && o.Check != nil { + return true + } + + return false +} + +// SetCheck gets a reference to the given SyntheticsAPITestResultFullCheck and assigns it to the Check field. +func (o *SyntheticsAPITestResultFull) SetCheck(v SyntheticsAPITestResultFullCheck) { + o.Check = &v +} + +// GetCheckTime returns the CheckTime field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultFull) GetCheckTime() float64 { + if o == nil || o.CheckTime == nil { + var ret float64 + return ret + } + return *o.CheckTime +} + +// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFull) GetCheckTimeOk() (*float64, bool) { + if o == nil || o.CheckTime == nil { + return nil, false + } + return o.CheckTime, true +} + +// HasCheckTime returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultFull) HasCheckTime() bool { + if o != nil && o.CheckTime != nil { + return true + } + + return false +} + +// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. +func (o *SyntheticsAPITestResultFull) SetCheckTime(v float64) { + o.CheckTime = &v +} + +// GetCheckVersion returns the CheckVersion field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultFull) GetCheckVersion() int64 { + if o == nil || o.CheckVersion == nil { + var ret int64 + return ret + } + return *o.CheckVersion +} + +// GetCheckVersionOk returns a tuple with the CheckVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFull) GetCheckVersionOk() (*int64, bool) { + if o == nil || o.CheckVersion == nil { + return nil, false + } + return o.CheckVersion, true +} + +// HasCheckVersion returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultFull) HasCheckVersion() bool { + if o != nil && o.CheckVersion != nil { + return true + } + + return false +} + +// SetCheckVersion gets a reference to the given int64 and assigns it to the CheckVersion field. +func (o *SyntheticsAPITestResultFull) SetCheckVersion(v int64) { + o.CheckVersion = &v +} + +// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultFull) GetProbeDc() string { + if o == nil || o.ProbeDc == nil { + var ret string + return ret + } + return *o.ProbeDc +} + +// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFull) GetProbeDcOk() (*string, bool) { + if o == nil || o.ProbeDc == nil { + return nil, false + } + return o.ProbeDc, true +} + +// HasProbeDc returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultFull) HasProbeDc() bool { + if o != nil && o.ProbeDc != nil { + return true + } + + return false +} + +// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. +func (o *SyntheticsAPITestResultFull) SetProbeDc(v string) { + o.ProbeDc = &v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultFull) GetResult() SyntheticsAPITestResultData { + if o == nil || o.Result == nil { + var ret SyntheticsAPITestResultData + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFull) GetResultOk() (*SyntheticsAPITestResultData, bool) { + if o == nil || o.Result == nil { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultFull) HasResult() bool { + if o != nil && o.Result != nil { + return true + } + + return false +} + +// SetResult gets a reference to the given SyntheticsAPITestResultData and assigns it to the Result field. +func (o *SyntheticsAPITestResultFull) SetResult(v SyntheticsAPITestResultData) { + o.Result = &v +} + +// GetResultId returns the ResultId field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultFull) GetResultId() string { + if o == nil || o.ResultId == nil { + var ret string + return ret + } + return *o.ResultId +} + +// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFull) GetResultIdOk() (*string, bool) { + if o == nil || o.ResultId == nil { + return nil, false + } + return o.ResultId, true +} + +// HasResultId returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultFull) HasResultId() bool { + if o != nil && o.ResultId != nil { + return true + } + + return false +} + +// SetResultId gets a reference to the given string and assigns it to the ResultId field. +func (o *SyntheticsAPITestResultFull) SetResultId(v string) { + o.ResultId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultFull) GetStatus() SyntheticsTestMonitorStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestMonitorStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFull) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultFull) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. +func (o *SyntheticsAPITestResultFull) SetStatus(v SyntheticsTestMonitorStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPITestResultFull) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Check != nil { + toSerialize["check"] = o.Check + } + if o.CheckTime != nil { + toSerialize["check_time"] = o.CheckTime + } + if o.CheckVersion != nil { + toSerialize["check_version"] = o.CheckVersion + } + if o.ProbeDc != nil { + toSerialize["probe_dc"] = o.ProbeDc + } + if o.Result != nil { + toSerialize["result"] = o.Result + } + if o.ResultId != nil { + toSerialize["result_id"] = o.ResultId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPITestResultFull) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Check *SyntheticsAPITestResultFullCheck `json:"check,omitempty"` + CheckTime *float64 `json:"check_time,omitempty"` + CheckVersion *int64 `json:"check_version,omitempty"` + ProbeDc *string `json:"probe_dc,omitempty"` + Result *SyntheticsAPITestResultData `json:"result,omitempty"` + ResultId *string `json:"result_id,omitempty"` + Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Check != nil && all.Check.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Check = all.Check + o.CheckTime = all.CheckTime + o.CheckVersion = all.CheckVersion + o.ProbeDc = all.ProbeDc + if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Result = all.Result + o.ResultId = all.ResultId + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_result_full_check.go b/api/v1/datadog/model_synthetics_api_test_result_full_check.go new file mode 100644 index 00000000000..0cffc3dad7d --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_result_full_check.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAPITestResultFullCheck Object describing the API test configuration. +type SyntheticsAPITestResultFullCheck struct { + // Configuration object for a Synthetic test. + Config SyntheticsTestConfig `json:"config"` + // 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{} +} + +// NewSyntheticsAPITestResultFullCheck instantiates a new SyntheticsAPITestResultFullCheck 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 NewSyntheticsAPITestResultFullCheck(config SyntheticsTestConfig) *SyntheticsAPITestResultFullCheck { + this := SyntheticsAPITestResultFullCheck{} + this.Config = config + return &this +} + +// NewSyntheticsAPITestResultFullCheckWithDefaults instantiates a new SyntheticsAPITestResultFullCheck 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 NewSyntheticsAPITestResultFullCheckWithDefaults() *SyntheticsAPITestResultFullCheck { + this := SyntheticsAPITestResultFullCheck{} + return &this +} + +// GetConfig returns the Config field value. +func (o *SyntheticsAPITestResultFullCheck) GetConfig() SyntheticsTestConfig { + if o == nil { + var ret SyntheticsTestConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultFullCheck) GetConfigOk() (*SyntheticsTestConfig, bool) { + if o == nil { + return nil, false + } + return &o.Config, true +} + +// SetConfig sets field value. +func (o *SyntheticsAPITestResultFullCheck) SetConfig(v SyntheticsTestConfig) { + o.Config = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPITestResultFullCheck) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["config"] = o.Config + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPITestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Config *SyntheticsTestConfig `json:"config"` + }{} + all := struct { + Config SyntheticsTestConfig `json:"config"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Config == nil { + return fmt.Errorf("Required field config missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Config = all.Config + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_result_short.go b/api/v1/datadog/model_synthetics_api_test_result_short.go new file mode 100644 index 00000000000..b6111b4c707 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_result_short.go @@ -0,0 +1,276 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsAPITestResultShort Object with the results of a single Synthetic API test. +type SyntheticsAPITestResultShort struct { + // Last time the API test was performed. + CheckTime *float64 `json:"check_time,omitempty"` + // Location from which the API test was performed. + ProbeDc *string `json:"probe_dc,omitempty"` + // Result of the last API test run. + Result *SyntheticsAPITestResultShortResult `json:"result,omitempty"` + // ID of the API test result. + ResultId *string `json:"result_id,omitempty"` + // The status of your Synthetic monitor. + // * `O` for not triggered + // * `1` for triggered + // * `2` for no data + Status *SyntheticsTestMonitorStatus `json:"status,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{} +} + +// NewSyntheticsAPITestResultShort instantiates a new SyntheticsAPITestResultShort 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 NewSyntheticsAPITestResultShort() *SyntheticsAPITestResultShort { + this := SyntheticsAPITestResultShort{} + return &this +} + +// NewSyntheticsAPITestResultShortWithDefaults instantiates a new SyntheticsAPITestResultShort 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 NewSyntheticsAPITestResultShortWithDefaults() *SyntheticsAPITestResultShort { + this := SyntheticsAPITestResultShort{} + return &this +} + +// GetCheckTime returns the CheckTime field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultShort) GetCheckTime() float64 { + if o == nil || o.CheckTime == nil { + var ret float64 + return ret + } + return *o.CheckTime +} + +// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultShort) GetCheckTimeOk() (*float64, bool) { + if o == nil || o.CheckTime == nil { + return nil, false + } + return o.CheckTime, true +} + +// HasCheckTime returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultShort) HasCheckTime() bool { + if o != nil && o.CheckTime != nil { + return true + } + + return false +} + +// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. +func (o *SyntheticsAPITestResultShort) SetCheckTime(v float64) { + o.CheckTime = &v +} + +// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultShort) GetProbeDc() string { + if o == nil || o.ProbeDc == nil { + var ret string + return ret + } + return *o.ProbeDc +} + +// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultShort) GetProbeDcOk() (*string, bool) { + if o == nil || o.ProbeDc == nil { + return nil, false + } + return o.ProbeDc, true +} + +// HasProbeDc returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultShort) HasProbeDc() bool { + if o != nil && o.ProbeDc != nil { + return true + } + + return false +} + +// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. +func (o *SyntheticsAPITestResultShort) SetProbeDc(v string) { + o.ProbeDc = &v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultShort) GetResult() SyntheticsAPITestResultShortResult { + if o == nil || o.Result == nil { + var ret SyntheticsAPITestResultShortResult + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultShort) GetResultOk() (*SyntheticsAPITestResultShortResult, bool) { + if o == nil || o.Result == nil { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultShort) HasResult() bool { + if o != nil && o.Result != nil { + return true + } + + return false +} + +// SetResult gets a reference to the given SyntheticsAPITestResultShortResult and assigns it to the Result field. +func (o *SyntheticsAPITestResultShort) SetResult(v SyntheticsAPITestResultShortResult) { + o.Result = &v +} + +// GetResultId returns the ResultId field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultShort) GetResultId() string { + if o == nil || o.ResultId == nil { + var ret string + return ret + } + return *o.ResultId +} + +// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultShort) GetResultIdOk() (*string, bool) { + if o == nil || o.ResultId == nil { + return nil, false + } + return o.ResultId, true +} + +// HasResultId returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultShort) HasResultId() bool { + if o != nil && o.ResultId != nil { + return true + } + + return false +} + +// SetResultId gets a reference to the given string and assigns it to the ResultId field. +func (o *SyntheticsAPITestResultShort) SetResultId(v string) { + o.ResultId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultShort) GetStatus() SyntheticsTestMonitorStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestMonitorStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultShort) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultShort) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. +func (o *SyntheticsAPITestResultShort) SetStatus(v SyntheticsTestMonitorStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPITestResultShort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CheckTime != nil { + toSerialize["check_time"] = o.CheckTime + } + if o.ProbeDc != nil { + toSerialize["probe_dc"] = o.ProbeDc + } + if o.Result != nil { + toSerialize["result"] = o.Result + } + if o.ResultId != nil { + toSerialize["result_id"] = o.ResultId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPITestResultShort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CheckTime *float64 `json:"check_time,omitempty"` + ProbeDc *string `json:"probe_dc,omitempty"` + Result *SyntheticsAPITestResultShortResult `json:"result,omitempty"` + ResultId *string `json:"result_id,omitempty"` + Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CheckTime = all.CheckTime + o.ProbeDc = all.ProbeDc + if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Result = all.Result + o.ResultId = all.ResultId + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_result_short_result.go b/api/v1/datadog/model_synthetics_api_test_result_short_result.go new file mode 100644 index 00000000000..21149cc07ef --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_result_short_result.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsAPITestResultShortResult Result of the last API test run. +type SyntheticsAPITestResultShortResult struct { + // Describes if the test run has passed or failed. + Passed *bool `json:"passed,omitempty"` + // Object containing all metrics and their values collected for a Synthetic API test. + // Learn more about those metrics in [Synthetics documentation](https://docs.datadoghq.com/synthetics/#metrics). + Timings *SyntheticsTiming `json:"timings,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{} +} + +// NewSyntheticsAPITestResultShortResult instantiates a new SyntheticsAPITestResultShortResult 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 NewSyntheticsAPITestResultShortResult() *SyntheticsAPITestResultShortResult { + this := SyntheticsAPITestResultShortResult{} + return &this +} + +// NewSyntheticsAPITestResultShortResultWithDefaults instantiates a new SyntheticsAPITestResultShortResult 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 NewSyntheticsAPITestResultShortResultWithDefaults() *SyntheticsAPITestResultShortResult { + this := SyntheticsAPITestResultShortResult{} + return &this +} + +// GetPassed returns the Passed field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultShortResult) GetPassed() bool { + if o == nil || o.Passed == nil { + var ret bool + return ret + } + return *o.Passed +} + +// GetPassedOk returns a tuple with the Passed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultShortResult) GetPassedOk() (*bool, bool) { + if o == nil || o.Passed == nil { + return nil, false + } + return o.Passed, true +} + +// HasPassed returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultShortResult) HasPassed() bool { + if o != nil && o.Passed != nil { + return true + } + + return false +} + +// SetPassed gets a reference to the given bool and assigns it to the Passed field. +func (o *SyntheticsAPITestResultShortResult) SetPassed(v bool) { + o.Passed = &v +} + +// GetTimings returns the Timings field value if set, zero value otherwise. +func (o *SyntheticsAPITestResultShortResult) GetTimings() SyntheticsTiming { + if o == nil || o.Timings == nil { + var ret SyntheticsTiming + return ret + } + return *o.Timings +} + +// GetTimingsOk returns a tuple with the Timings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestResultShortResult) GetTimingsOk() (*SyntheticsTiming, bool) { + if o == nil || o.Timings == nil { + return nil, false + } + return o.Timings, true +} + +// HasTimings returns a boolean if a field has been set. +func (o *SyntheticsAPITestResultShortResult) HasTimings() bool { + if o != nil && o.Timings != nil { + return true + } + + return false +} + +// SetTimings gets a reference to the given SyntheticsTiming and assigns it to the Timings field. +func (o *SyntheticsAPITestResultShortResult) SetTimings(v SyntheticsTiming) { + o.Timings = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAPITestResultShortResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Passed != nil { + toSerialize["passed"] = o.Passed + } + if o.Timings != nil { + toSerialize["timings"] = o.Timings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAPITestResultShortResult) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Passed *bool `json:"passed,omitempty"` + Timings *SyntheticsTiming `json:"timings,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Passed = all.Passed + if all.Timings != nil && all.Timings.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Timings = all.Timings + return nil +} diff --git a/api/v1/datadog/model_synthetics_api_test_type.go b/api/v1/datadog/model_synthetics_api_test_type.go new file mode 100644 index 00000000000..3a70ccfcd9c --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAPITestType Type of the Synthetic test, `api`. +type SyntheticsAPITestType string + +// List of SyntheticsAPITestType. +const ( + SYNTHETICSAPITESTTYPE_API SyntheticsAPITestType = "api" +) + +var allowedSyntheticsAPITestTypeEnumValues = []SyntheticsAPITestType{ + SYNTHETICSAPITESTTYPE_API, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsAPITestType) GetAllowedValues() []SyntheticsAPITestType { + return allowedSyntheticsAPITestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsAPITestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsAPITestType(value) + return nil +} + +// NewSyntheticsAPITestTypeFromValue returns a pointer to a valid SyntheticsAPITestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsAPITestTypeFromValue(v string) (*SyntheticsAPITestType, error) { + ev := SyntheticsAPITestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAPITestType: valid values are %v", v, allowedSyntheticsAPITestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsAPITestType) IsValid() bool { + for _, existing := range allowedSyntheticsAPITestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAPITestType value. +func (v SyntheticsAPITestType) Ptr() *SyntheticsAPITestType { + return &v +} + +// NullableSyntheticsAPITestType handles when a null is used for SyntheticsAPITestType. +type NullableSyntheticsAPITestType struct { + value *SyntheticsAPITestType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsAPITestType) Get() *SyntheticsAPITestType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsAPITestType) Set(val *SyntheticsAPITestType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsAPITestType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsAPITestType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsAPITestType initializes the struct as if Set has been called. +func NewNullableSyntheticsAPITestType(val *SyntheticsAPITestType) *NullableSyntheticsAPITestType { + return &NullableSyntheticsAPITestType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsAPITestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsAPITestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_assertion.go b/api/v1/datadog/model_synthetics_assertion.go new file mode 100644 index 00000000000..6272d78d42c --- /dev/null +++ b/api/v1/datadog/model_synthetics_assertion.go @@ -0,0 +1,156 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsAssertion - Object describing the assertions type, their associated operator, +// which property they apply, and upon which target. +type SyntheticsAssertion struct { + SyntheticsAssertionTarget *SyntheticsAssertionTarget + SyntheticsAssertionJSONPathTarget *SyntheticsAssertionJSONPathTarget + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SyntheticsAssertionTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionTarget wrapped in SyntheticsAssertion. +func SyntheticsAssertionTargetAsSyntheticsAssertion(v *SyntheticsAssertionTarget) SyntheticsAssertion { + return SyntheticsAssertion{SyntheticsAssertionTarget: v} +} + +// SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionJSONPathTarget wrapped in SyntheticsAssertion. +func SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion(v *SyntheticsAssertionJSONPathTarget) SyntheticsAssertion { + return SyntheticsAssertion{SyntheticsAssertionJSONPathTarget: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into SyntheticsAssertionTarget + err = json.Unmarshal(data, &obj.SyntheticsAssertionTarget) + if err == nil { + if obj.SyntheticsAssertionTarget != nil && obj.SyntheticsAssertionTarget.UnparsedObject == nil { + jsonSyntheticsAssertionTarget, _ := json.Marshal(obj.SyntheticsAssertionTarget) + if string(jsonSyntheticsAssertionTarget) == "{}" { // empty struct + obj.SyntheticsAssertionTarget = nil + } else { + match++ + } + } else { + obj.SyntheticsAssertionTarget = nil + } + } else { + obj.SyntheticsAssertionTarget = nil + } + + // try to unmarshal data into SyntheticsAssertionJSONPathTarget + err = json.Unmarshal(data, &obj.SyntheticsAssertionJSONPathTarget) + if err == nil { + if obj.SyntheticsAssertionJSONPathTarget != nil && obj.SyntheticsAssertionJSONPathTarget.UnparsedObject == nil { + jsonSyntheticsAssertionJSONPathTarget, _ := json.Marshal(obj.SyntheticsAssertionJSONPathTarget) + if string(jsonSyntheticsAssertionJSONPathTarget) == "{}" { // empty struct + obj.SyntheticsAssertionJSONPathTarget = nil + } else { + match++ + } + } else { + obj.SyntheticsAssertionJSONPathTarget = nil + } + } else { + obj.SyntheticsAssertionJSONPathTarget = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.SyntheticsAssertionTarget = nil + obj.SyntheticsAssertionJSONPathTarget = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj SyntheticsAssertion) MarshalJSON() ([]byte, error) { + if obj.SyntheticsAssertionTarget != nil { + return json.Marshal(&obj.SyntheticsAssertionTarget) + } + + if obj.SyntheticsAssertionJSONPathTarget != nil { + return json.Marshal(&obj.SyntheticsAssertionJSONPathTarget) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *SyntheticsAssertion) GetActualInstance() interface{} { + if obj.SyntheticsAssertionTarget != nil { + return obj.SyntheticsAssertionTarget + } + + if obj.SyntheticsAssertionJSONPathTarget != nil { + return obj.SyntheticsAssertionJSONPathTarget + } + + // all schemas are nil + return nil +} + +// NullableSyntheticsAssertion handles when a null is used for SyntheticsAssertion. +type NullableSyntheticsAssertion struct { + value *SyntheticsAssertion + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsAssertion) Get() *SyntheticsAssertion { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsAssertion) Set(val *SyntheticsAssertion) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsAssertion) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableSyntheticsAssertion) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsAssertion initializes the struct as if Set has been called. +func NewNullableSyntheticsAssertion(val *SyntheticsAssertion) *NullableSyntheticsAssertion { + return &NullableSyntheticsAssertion{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsAssertion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsAssertion) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_assertion_json_path_operator.go b/api/v1/datadog/model_synthetics_assertion_json_path_operator.go new file mode 100644 index 00000000000..83742b5e642 --- /dev/null +++ b/api/v1/datadog/model_synthetics_assertion_json_path_operator.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAssertionJSONPathOperator Assertion operator to apply. +type SyntheticsAssertionJSONPathOperator string + +// List of SyntheticsAssertionJSONPathOperator. +const ( + SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH SyntheticsAssertionJSONPathOperator = "validatesJSONPath" +) + +var allowedSyntheticsAssertionJSONPathOperatorEnumValues = []SyntheticsAssertionJSONPathOperator{ + SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsAssertionJSONPathOperator) GetAllowedValues() []SyntheticsAssertionJSONPathOperator { + return allowedSyntheticsAssertionJSONPathOperatorEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsAssertionJSONPathOperator) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsAssertionJSONPathOperator(value) + return nil +} + +// NewSyntheticsAssertionJSONPathOperatorFromValue returns a pointer to a valid SyntheticsAssertionJSONPathOperator +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsAssertionJSONPathOperatorFromValue(v string) (*SyntheticsAssertionJSONPathOperator, error) { + ev := SyntheticsAssertionJSONPathOperator(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionJSONPathOperator: valid values are %v", v, allowedSyntheticsAssertionJSONPathOperatorEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsAssertionJSONPathOperator) IsValid() bool { + for _, existing := range allowedSyntheticsAssertionJSONPathOperatorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAssertionJSONPathOperator value. +func (v SyntheticsAssertionJSONPathOperator) Ptr() *SyntheticsAssertionJSONPathOperator { + return &v +} + +// NullableSyntheticsAssertionJSONPathOperator handles when a null is used for SyntheticsAssertionJSONPathOperator. +type NullableSyntheticsAssertionJSONPathOperator struct { + value *SyntheticsAssertionJSONPathOperator + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsAssertionJSONPathOperator) Get() *SyntheticsAssertionJSONPathOperator { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsAssertionJSONPathOperator) Set(val *SyntheticsAssertionJSONPathOperator) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsAssertionJSONPathOperator) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsAssertionJSONPathOperator) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsAssertionJSONPathOperator initializes the struct as if Set has been called. +func NewNullableSyntheticsAssertionJSONPathOperator(val *SyntheticsAssertionJSONPathOperator) *NullableSyntheticsAssertionJSONPathOperator { + return &NullableSyntheticsAssertionJSONPathOperator{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsAssertionJSONPathOperator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsAssertionJSONPathOperator) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_assertion_json_path_target.go b/api/v1/datadog/model_synthetics_assertion_json_path_target.go new file mode 100644 index 00000000000..2bc20041396 --- /dev/null +++ b/api/v1/datadog/model_synthetics_assertion_json_path_target.go @@ -0,0 +1,237 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAssertionJSONPathTarget An assertion for the `validatesJSONPath` operator. +type SyntheticsAssertionJSONPathTarget struct { + // Assertion operator to apply. + Operator SyntheticsAssertionJSONPathOperator `json:"operator"` + // The associated assertion property. + Property *string `json:"property,omitempty"` + // Composed target for `validatesJSONPath` operator. + Target *SyntheticsAssertionJSONPathTargetTarget `json:"target,omitempty"` + // Type of the assertion. + Type SyntheticsAssertionType `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{} +} + +// NewSyntheticsAssertionJSONPathTarget instantiates a new SyntheticsAssertionJSONPathTarget 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 NewSyntheticsAssertionJSONPathTarget(operator SyntheticsAssertionJSONPathOperator, typeVar SyntheticsAssertionType) *SyntheticsAssertionJSONPathTarget { + this := SyntheticsAssertionJSONPathTarget{} + this.Operator = operator + this.Type = typeVar + return &this +} + +// NewSyntheticsAssertionJSONPathTargetWithDefaults instantiates a new SyntheticsAssertionJSONPathTarget 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 NewSyntheticsAssertionJSONPathTargetWithDefaults() *SyntheticsAssertionJSONPathTarget { + this := SyntheticsAssertionJSONPathTarget{} + return &this +} + +// GetOperator returns the Operator field value. +func (o *SyntheticsAssertionJSONPathTarget) GetOperator() SyntheticsAssertionJSONPathOperator { + if o == nil { + var ret SyntheticsAssertionJSONPathOperator + return ret + } + return o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionJSONPathTarget) GetOperatorOk() (*SyntheticsAssertionJSONPathOperator, bool) { + if o == nil { + return nil, false + } + return &o.Operator, true +} + +// SetOperator sets field value. +func (o *SyntheticsAssertionJSONPathTarget) SetOperator(v SyntheticsAssertionJSONPathOperator) { + o.Operator = v +} + +// GetProperty returns the Property field value if set, zero value otherwise. +func (o *SyntheticsAssertionJSONPathTarget) GetProperty() string { + if o == nil || o.Property == nil { + var ret string + return ret + } + return *o.Property +} + +// GetPropertyOk returns a tuple with the Property field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionJSONPathTarget) GetPropertyOk() (*string, bool) { + if o == nil || o.Property == nil { + return nil, false + } + return o.Property, true +} + +// HasProperty returns a boolean if a field has been set. +func (o *SyntheticsAssertionJSONPathTarget) HasProperty() bool { + if o != nil && o.Property != nil { + return true + } + + return false +} + +// SetProperty gets a reference to the given string and assigns it to the Property field. +func (o *SyntheticsAssertionJSONPathTarget) SetProperty(v string) { + o.Property = &v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *SyntheticsAssertionJSONPathTarget) GetTarget() SyntheticsAssertionJSONPathTargetTarget { + if o == nil || o.Target == nil { + var ret SyntheticsAssertionJSONPathTargetTarget + return ret + } + return *o.Target +} + +// GetTargetOk returns a tuple with the Target field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionJSONPathTarget) GetTargetOk() (*SyntheticsAssertionJSONPathTargetTarget, bool) { + if o == nil || o.Target == nil { + return nil, false + } + return o.Target, true +} + +// HasTarget returns a boolean if a field has been set. +func (o *SyntheticsAssertionJSONPathTarget) HasTarget() bool { + if o != nil && o.Target != nil { + return true + } + + return false +} + +// SetTarget gets a reference to the given SyntheticsAssertionJSONPathTargetTarget and assigns it to the Target field. +func (o *SyntheticsAssertionJSONPathTarget) SetTarget(v SyntheticsAssertionJSONPathTargetTarget) { + o.Target = &v +} + +// GetType returns the Type field value. +func (o *SyntheticsAssertionJSONPathTarget) GetType() SyntheticsAssertionType { + if o == nil { + var ret SyntheticsAssertionType + 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 *SyntheticsAssertionJSONPathTarget) GetTypeOk() (*SyntheticsAssertionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsAssertionJSONPathTarget) SetType(v SyntheticsAssertionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAssertionJSONPathTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["operator"] = o.Operator + if o.Property != nil { + toSerialize["property"] = o.Property + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Operator *SyntheticsAssertionJSONPathOperator `json:"operator"` + Type *SyntheticsAssertionType `json:"type"` + }{} + all := struct { + Operator SyntheticsAssertionJSONPathOperator `json:"operator"` + Property *string `json:"property,omitempty"` + Target *SyntheticsAssertionJSONPathTargetTarget `json:"target,omitempty"` + Type SyntheticsAssertionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Operator == nil { + return fmt.Errorf("Required field operator missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Operator; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Operator = all.Operator + o.Property = all.Property + if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_assertion_json_path_target_target.go b/api/v1/datadog/model_synthetics_assertion_json_path_target_target.go new file mode 100644 index 00000000000..0381c430024 --- /dev/null +++ b/api/v1/datadog/model_synthetics_assertion_json_path_target_target.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsAssertionJSONPathTargetTarget Composed target for `validatesJSONPath` operator. +type SyntheticsAssertionJSONPathTargetTarget struct { + // The JSON path to assert. + JsonPath *string `json:"jsonPath,omitempty"` + // The specific operator to use on the path. + Operator *string `json:"operator,omitempty"` + // The path target value to compare to. + TargetValue interface{} `json:"targetValue,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{} +} + +// NewSyntheticsAssertionJSONPathTargetTarget instantiates a new SyntheticsAssertionJSONPathTargetTarget 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 NewSyntheticsAssertionJSONPathTargetTarget() *SyntheticsAssertionJSONPathTargetTarget { + this := SyntheticsAssertionJSONPathTargetTarget{} + return &this +} + +// NewSyntheticsAssertionJSONPathTargetTargetWithDefaults instantiates a new SyntheticsAssertionJSONPathTargetTarget 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 NewSyntheticsAssertionJSONPathTargetTargetWithDefaults() *SyntheticsAssertionJSONPathTargetTarget { + this := SyntheticsAssertionJSONPathTargetTarget{} + return &this +} + +// GetJsonPath returns the JsonPath field value if set, zero value otherwise. +func (o *SyntheticsAssertionJSONPathTargetTarget) GetJsonPath() string { + if o == nil || o.JsonPath == nil { + var ret string + return ret + } + return *o.JsonPath +} + +// GetJsonPathOk returns a tuple with the JsonPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionJSONPathTargetTarget) GetJsonPathOk() (*string, bool) { + if o == nil || o.JsonPath == nil { + return nil, false + } + return o.JsonPath, true +} + +// HasJsonPath returns a boolean if a field has been set. +func (o *SyntheticsAssertionJSONPathTargetTarget) HasJsonPath() bool { + if o != nil && o.JsonPath != nil { + return true + } + + return false +} + +// SetJsonPath gets a reference to the given string and assigns it to the JsonPath field. +func (o *SyntheticsAssertionJSONPathTargetTarget) SetJsonPath(v string) { + o.JsonPath = &v +} + +// GetOperator returns the Operator field value if set, zero value otherwise. +func (o *SyntheticsAssertionJSONPathTargetTarget) GetOperator() string { + if o == nil || o.Operator == nil { + var ret string + return ret + } + return *o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionJSONPathTargetTarget) GetOperatorOk() (*string, bool) { + if o == nil || o.Operator == nil { + return nil, false + } + return o.Operator, true +} + +// HasOperator returns a boolean if a field has been set. +func (o *SyntheticsAssertionJSONPathTargetTarget) HasOperator() bool { + if o != nil && o.Operator != nil { + return true + } + + return false +} + +// SetOperator gets a reference to the given string and assigns it to the Operator field. +func (o *SyntheticsAssertionJSONPathTargetTarget) SetOperator(v string) { + o.Operator = &v +} + +// GetTargetValue returns the TargetValue field value if set, zero value otherwise. +func (o *SyntheticsAssertionJSONPathTargetTarget) GetTargetValue() interface{} { + if o == nil || o.TargetValue == nil { + var ret interface{} + return ret + } + return o.TargetValue +} + +// GetTargetValueOk returns a tuple with the TargetValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionJSONPathTargetTarget) GetTargetValueOk() (*interface{}, bool) { + if o == nil || o.TargetValue == nil { + return nil, false + } + return &o.TargetValue, true +} + +// HasTargetValue returns a boolean if a field has been set. +func (o *SyntheticsAssertionJSONPathTargetTarget) HasTargetValue() bool { + if o != nil && o.TargetValue != nil { + return true + } + + return false +} + +// SetTargetValue gets a reference to the given interface{} and assigns it to the TargetValue field. +func (o *SyntheticsAssertionJSONPathTargetTarget) SetTargetValue(v interface{}) { + o.TargetValue = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAssertionJSONPathTargetTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.JsonPath != nil { + toSerialize["jsonPath"] = o.JsonPath + } + if o.Operator != nil { + toSerialize["operator"] = o.Operator + } + if o.TargetValue != nil { + toSerialize["targetValue"] = o.TargetValue + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAssertionJSONPathTargetTarget) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + JsonPath *string `json:"jsonPath,omitempty"` + Operator *string `json:"operator,omitempty"` + TargetValue interface{} `json:"targetValue,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.JsonPath = all.JsonPath + o.Operator = all.Operator + o.TargetValue = all.TargetValue + return nil +} diff --git a/api/v1/datadog/model_synthetics_assertion_operator.go b/api/v1/datadog/model_synthetics_assertion_operator.go new file mode 100644 index 00000000000..e4339657304 --- /dev/null +++ b/api/v1/datadog/model_synthetics_assertion_operator.go @@ -0,0 +1,131 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAssertionOperator Assertion operator to apply. +type SyntheticsAssertionOperator string + +// List of SyntheticsAssertionOperator. +const ( + SYNTHETICSASSERTIONOPERATOR_CONTAINS SyntheticsAssertionOperator = "contains" + SYNTHETICSASSERTIONOPERATOR_DOES_NOT_CONTAIN SyntheticsAssertionOperator = "doesNotContain" + SYNTHETICSASSERTIONOPERATOR_IS SyntheticsAssertionOperator = "is" + SYNTHETICSASSERTIONOPERATOR_IS_NOT SyntheticsAssertionOperator = "isNot" + SYNTHETICSASSERTIONOPERATOR_LESS_THAN SyntheticsAssertionOperator = "lessThan" + SYNTHETICSASSERTIONOPERATOR_LESS_THAN_OR_EQUAL SyntheticsAssertionOperator = "lessThanOrEqual" + SYNTHETICSASSERTIONOPERATOR_MORE_THAN SyntheticsAssertionOperator = "moreThan" + SYNTHETICSASSERTIONOPERATOR_MORE_THAN_OR_EQUAL SyntheticsAssertionOperator = "moreThanOrEqual" + SYNTHETICSASSERTIONOPERATOR_MATCHES SyntheticsAssertionOperator = "matches" + SYNTHETICSASSERTIONOPERATOR_DOES_NOT_MATCH SyntheticsAssertionOperator = "doesNotMatch" + SYNTHETICSASSERTIONOPERATOR_VALIDATES SyntheticsAssertionOperator = "validates" + SYNTHETICSASSERTIONOPERATOR_IS_IN_MORE_DAYS_THAN SyntheticsAssertionOperator = "isInMoreThan" + SYNTHETICSASSERTIONOPERATOR_IS_IN_LESS_DAYS_THAN SyntheticsAssertionOperator = "isInLessThan" +) + +var allowedSyntheticsAssertionOperatorEnumValues = []SyntheticsAssertionOperator{ + SYNTHETICSASSERTIONOPERATOR_CONTAINS, + SYNTHETICSASSERTIONOPERATOR_DOES_NOT_CONTAIN, + SYNTHETICSASSERTIONOPERATOR_IS, + SYNTHETICSASSERTIONOPERATOR_IS_NOT, + SYNTHETICSASSERTIONOPERATOR_LESS_THAN, + SYNTHETICSASSERTIONOPERATOR_LESS_THAN_OR_EQUAL, + SYNTHETICSASSERTIONOPERATOR_MORE_THAN, + SYNTHETICSASSERTIONOPERATOR_MORE_THAN_OR_EQUAL, + SYNTHETICSASSERTIONOPERATOR_MATCHES, + SYNTHETICSASSERTIONOPERATOR_DOES_NOT_MATCH, + SYNTHETICSASSERTIONOPERATOR_VALIDATES, + SYNTHETICSASSERTIONOPERATOR_IS_IN_MORE_DAYS_THAN, + SYNTHETICSASSERTIONOPERATOR_IS_IN_LESS_DAYS_THAN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsAssertionOperator) GetAllowedValues() []SyntheticsAssertionOperator { + return allowedSyntheticsAssertionOperatorEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsAssertionOperator) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsAssertionOperator(value) + return nil +} + +// NewSyntheticsAssertionOperatorFromValue returns a pointer to a valid SyntheticsAssertionOperator +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsAssertionOperatorFromValue(v string) (*SyntheticsAssertionOperator, error) { + ev := SyntheticsAssertionOperator(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionOperator: valid values are %v", v, allowedSyntheticsAssertionOperatorEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsAssertionOperator) IsValid() bool { + for _, existing := range allowedSyntheticsAssertionOperatorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAssertionOperator value. +func (v SyntheticsAssertionOperator) Ptr() *SyntheticsAssertionOperator { + return &v +} + +// NullableSyntheticsAssertionOperator handles when a null is used for SyntheticsAssertionOperator. +type NullableSyntheticsAssertionOperator struct { + value *SyntheticsAssertionOperator + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsAssertionOperator) Get() *SyntheticsAssertionOperator { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsAssertionOperator) Set(val *SyntheticsAssertionOperator) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsAssertionOperator) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsAssertionOperator) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsAssertionOperator initializes the struct as if Set has been called. +func NewNullableSyntheticsAssertionOperator(val *SyntheticsAssertionOperator) *NullableSyntheticsAssertionOperator { + return &NullableSyntheticsAssertionOperator{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsAssertionOperator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsAssertionOperator) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_assertion_target.go b/api/v1/datadog/model_synthetics_assertion_target.go new file mode 100644 index 00000000000..cee6dee2b02 --- /dev/null +++ b/api/v1/datadog/model_synthetics_assertion_target.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAssertionTarget An assertion which uses a simple target. +type SyntheticsAssertionTarget struct { + // Assertion operator to apply. + Operator SyntheticsAssertionOperator `json:"operator"` + // The associated assertion property. + Property *string `json:"property,omitempty"` + // Value used by the operator. + Target interface{} `json:"target"` + // Type of the assertion. + Type SyntheticsAssertionType `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{} +} + +// NewSyntheticsAssertionTarget instantiates a new SyntheticsAssertionTarget 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 NewSyntheticsAssertionTarget(operator SyntheticsAssertionOperator, target interface{}, typeVar SyntheticsAssertionType) *SyntheticsAssertionTarget { + this := SyntheticsAssertionTarget{} + this.Operator = operator + this.Target = target + this.Type = typeVar + return &this +} + +// NewSyntheticsAssertionTargetWithDefaults instantiates a new SyntheticsAssertionTarget 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 NewSyntheticsAssertionTargetWithDefaults() *SyntheticsAssertionTarget { + this := SyntheticsAssertionTarget{} + return &this +} + +// GetOperator returns the Operator field value. +func (o *SyntheticsAssertionTarget) GetOperator() SyntheticsAssertionOperator { + if o == nil { + var ret SyntheticsAssertionOperator + return ret + } + return o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionTarget) GetOperatorOk() (*SyntheticsAssertionOperator, bool) { + if o == nil { + return nil, false + } + return &o.Operator, true +} + +// SetOperator sets field value. +func (o *SyntheticsAssertionTarget) SetOperator(v SyntheticsAssertionOperator) { + o.Operator = v +} + +// GetProperty returns the Property field value if set, zero value otherwise. +func (o *SyntheticsAssertionTarget) GetProperty() string { + if o == nil || o.Property == nil { + var ret string + return ret + } + return *o.Property +} + +// GetPropertyOk returns a tuple with the Property field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionTarget) GetPropertyOk() (*string, bool) { + if o == nil || o.Property == nil { + return nil, false + } + return o.Property, true +} + +// HasProperty returns a boolean if a field has been set. +func (o *SyntheticsAssertionTarget) HasProperty() bool { + if o != nil && o.Property != nil { + return true + } + + return false +} + +// SetProperty gets a reference to the given string and assigns it to the Property field. +func (o *SyntheticsAssertionTarget) SetProperty(v string) { + o.Property = &v +} + +// GetTarget returns the Target field value. +func (o *SyntheticsAssertionTarget) GetTarget() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionTarget) GetTargetOk() (*interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *SyntheticsAssertionTarget) SetTarget(v interface{}) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *SyntheticsAssertionTarget) GetType() SyntheticsAssertionType { + if o == nil { + var ret SyntheticsAssertionType + 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 *SyntheticsAssertionTarget) GetTypeOk() (*SyntheticsAssertionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsAssertionTarget) SetType(v SyntheticsAssertionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAssertionTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["operator"] = o.Operator + if o.Property != nil { + toSerialize["property"] = o.Property + } + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Operator *SyntheticsAssertionOperator `json:"operator"` + Target *interface{} `json:"target"` + Type *SyntheticsAssertionType `json:"type"` + }{} + all := struct { + Operator SyntheticsAssertionOperator `json:"operator"` + Property *string `json:"property,omitempty"` + Target interface{} `json:"target"` + Type SyntheticsAssertionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Operator == nil { + return fmt.Errorf("Required field operator missing") + } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Operator; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Operator = all.Operator + o.Property = all.Property + o.Target = all.Target + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_assertion_type.go b/api/v1/datadog/model_synthetics_assertion_type.go new file mode 100644 index 00000000000..5499a2dfb4a --- /dev/null +++ b/api/v1/datadog/model_synthetics_assertion_type.go @@ -0,0 +1,139 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAssertionType Type of the assertion. +type SyntheticsAssertionType string + +// List of SyntheticsAssertionType. +const ( + SYNTHETICSASSERTIONTYPE_BODY SyntheticsAssertionType = "body" + SYNTHETICSASSERTIONTYPE_HEADER SyntheticsAssertionType = "header" + SYNTHETICSASSERTIONTYPE_STATUS_CODE SyntheticsAssertionType = "statusCode" + SYNTHETICSASSERTIONTYPE_CERTIFICATE SyntheticsAssertionType = "certificate" + SYNTHETICSASSERTIONTYPE_RESPONSE_TIME SyntheticsAssertionType = "responseTime" + SYNTHETICSASSERTIONTYPE_PROPERTY SyntheticsAssertionType = "property" + SYNTHETICSASSERTIONTYPE_RECORD_EVERY SyntheticsAssertionType = "recordEvery" + SYNTHETICSASSERTIONTYPE_RECORD_SOME SyntheticsAssertionType = "recordSome" + SYNTHETICSASSERTIONTYPE_TLS_VERSION SyntheticsAssertionType = "tlsVersion" + SYNTHETICSASSERTIONTYPE_MIN_TLS_VERSION SyntheticsAssertionType = "minTlsVersion" + SYNTHETICSASSERTIONTYPE_LATENCY SyntheticsAssertionType = "latency" + SYNTHETICSASSERTIONTYPE_PACKET_LOSS_PERCENTAGE SyntheticsAssertionType = "packetLossPercentage" + SYNTHETICSASSERTIONTYPE_PACKETS_RECEIVED SyntheticsAssertionType = "packetsReceived" + SYNTHETICSASSERTIONTYPE_NETWORK_HOP SyntheticsAssertionType = "networkHop" + SYNTHETICSASSERTIONTYPE_RECEIVED_MESSAGE SyntheticsAssertionType = "receivedMessage" + SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS SyntheticsAssertionType = "grpcHealthcheckStatus" + SYNTHETICSASSERTIONTYPE_CONNECTION SyntheticsAssertionType = "connection" +) + +var allowedSyntheticsAssertionTypeEnumValues = []SyntheticsAssertionType{ + SYNTHETICSASSERTIONTYPE_BODY, + SYNTHETICSASSERTIONTYPE_HEADER, + SYNTHETICSASSERTIONTYPE_STATUS_CODE, + SYNTHETICSASSERTIONTYPE_CERTIFICATE, + SYNTHETICSASSERTIONTYPE_RESPONSE_TIME, + SYNTHETICSASSERTIONTYPE_PROPERTY, + SYNTHETICSASSERTIONTYPE_RECORD_EVERY, + SYNTHETICSASSERTIONTYPE_RECORD_SOME, + SYNTHETICSASSERTIONTYPE_TLS_VERSION, + SYNTHETICSASSERTIONTYPE_MIN_TLS_VERSION, + SYNTHETICSASSERTIONTYPE_LATENCY, + SYNTHETICSASSERTIONTYPE_PACKET_LOSS_PERCENTAGE, + SYNTHETICSASSERTIONTYPE_PACKETS_RECEIVED, + SYNTHETICSASSERTIONTYPE_NETWORK_HOP, + SYNTHETICSASSERTIONTYPE_RECEIVED_MESSAGE, + SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS, + SYNTHETICSASSERTIONTYPE_CONNECTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsAssertionType) GetAllowedValues() []SyntheticsAssertionType { + return allowedSyntheticsAssertionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsAssertionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsAssertionType(value) + return nil +} + +// NewSyntheticsAssertionTypeFromValue returns a pointer to a valid SyntheticsAssertionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsAssertionTypeFromValue(v string) (*SyntheticsAssertionType, error) { + ev := SyntheticsAssertionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionType: valid values are %v", v, allowedSyntheticsAssertionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsAssertionType) IsValid() bool { + for _, existing := range allowedSyntheticsAssertionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAssertionType value. +func (v SyntheticsAssertionType) Ptr() *SyntheticsAssertionType { + return &v +} + +// NullableSyntheticsAssertionType handles when a null is used for SyntheticsAssertionType. +type NullableSyntheticsAssertionType struct { + value *SyntheticsAssertionType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsAssertionType) Get() *SyntheticsAssertionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsAssertionType) Set(val *SyntheticsAssertionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsAssertionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsAssertionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsAssertionType initializes the struct as if Set has been called. +func NewNullableSyntheticsAssertionType(val *SyntheticsAssertionType) *NullableSyntheticsAssertionType { + return &NullableSyntheticsAssertionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsAssertionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsAssertionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_basic_auth.go b/api/v1/datadog/model_synthetics_basic_auth.go new file mode 100644 index 00000000000..f45be6c5a5e --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBasicAuth - Object to handle basic authentication when performing the test. +type SyntheticsBasicAuth struct { + SyntheticsBasicAuthWeb *SyntheticsBasicAuthWeb + SyntheticsBasicAuthSigv4 *SyntheticsBasicAuthSigv4 + SyntheticsBasicAuthNTLM *SyntheticsBasicAuthNTLM + SyntheticsBasicAuthDigest *SyntheticsBasicAuthDigest + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SyntheticsBasicAuthWebAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthWeb wrapped in SyntheticsBasicAuth. +func SyntheticsBasicAuthWebAsSyntheticsBasicAuth(v *SyntheticsBasicAuthWeb) SyntheticsBasicAuth { + return SyntheticsBasicAuth{SyntheticsBasicAuthWeb: v} +} + +// SyntheticsBasicAuthSigv4AsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthSigv4 wrapped in SyntheticsBasicAuth. +func SyntheticsBasicAuthSigv4AsSyntheticsBasicAuth(v *SyntheticsBasicAuthSigv4) SyntheticsBasicAuth { + return SyntheticsBasicAuth{SyntheticsBasicAuthSigv4: v} +} + +// SyntheticsBasicAuthNTLMAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthNTLM wrapped in SyntheticsBasicAuth. +func SyntheticsBasicAuthNTLMAsSyntheticsBasicAuth(v *SyntheticsBasicAuthNTLM) SyntheticsBasicAuth { + return SyntheticsBasicAuth{SyntheticsBasicAuthNTLM: v} +} + +// SyntheticsBasicAuthDigestAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthDigest wrapped in SyntheticsBasicAuth. +func SyntheticsBasicAuthDigestAsSyntheticsBasicAuth(v *SyntheticsBasicAuthDigest) SyntheticsBasicAuth { + return SyntheticsBasicAuth{SyntheticsBasicAuthDigest: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into SyntheticsBasicAuthWeb + err = json.Unmarshal(data, &obj.SyntheticsBasicAuthWeb) + if err == nil { + if obj.SyntheticsBasicAuthWeb != nil && obj.SyntheticsBasicAuthWeb.UnparsedObject == nil { + jsonSyntheticsBasicAuthWeb, _ := json.Marshal(obj.SyntheticsBasicAuthWeb) + if string(jsonSyntheticsBasicAuthWeb) == "{}" { // empty struct + obj.SyntheticsBasicAuthWeb = nil + } else { + match++ + } + } else { + obj.SyntheticsBasicAuthWeb = nil + } + } else { + obj.SyntheticsBasicAuthWeb = nil + } + + // try to unmarshal data into SyntheticsBasicAuthSigv4 + err = json.Unmarshal(data, &obj.SyntheticsBasicAuthSigv4) + if err == nil { + if obj.SyntheticsBasicAuthSigv4 != nil && obj.SyntheticsBasicAuthSigv4.UnparsedObject == nil { + jsonSyntheticsBasicAuthSigv4, _ := json.Marshal(obj.SyntheticsBasicAuthSigv4) + if string(jsonSyntheticsBasicAuthSigv4) == "{}" { // empty struct + obj.SyntheticsBasicAuthSigv4 = nil + } else { + match++ + } + } else { + obj.SyntheticsBasicAuthSigv4 = nil + } + } else { + obj.SyntheticsBasicAuthSigv4 = nil + } + + // try to unmarshal data into SyntheticsBasicAuthNTLM + err = json.Unmarshal(data, &obj.SyntheticsBasicAuthNTLM) + if err == nil { + if obj.SyntheticsBasicAuthNTLM != nil && obj.SyntheticsBasicAuthNTLM.UnparsedObject == nil { + jsonSyntheticsBasicAuthNTLM, _ := json.Marshal(obj.SyntheticsBasicAuthNTLM) + if string(jsonSyntheticsBasicAuthNTLM) == "{}" { // empty struct + obj.SyntheticsBasicAuthNTLM = nil + } else { + match++ + } + } else { + obj.SyntheticsBasicAuthNTLM = nil + } + } else { + obj.SyntheticsBasicAuthNTLM = nil + } + + // try to unmarshal data into SyntheticsBasicAuthDigest + err = json.Unmarshal(data, &obj.SyntheticsBasicAuthDigest) + if err == nil { + if obj.SyntheticsBasicAuthDigest != nil && obj.SyntheticsBasicAuthDigest.UnparsedObject == nil { + jsonSyntheticsBasicAuthDigest, _ := json.Marshal(obj.SyntheticsBasicAuthDigest) + if string(jsonSyntheticsBasicAuthDigest) == "{}" { // empty struct + obj.SyntheticsBasicAuthDigest = nil + } else { + match++ + } + } else { + obj.SyntheticsBasicAuthDigest = nil + } + } else { + obj.SyntheticsBasicAuthDigest = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.SyntheticsBasicAuthWeb = nil + obj.SyntheticsBasicAuthSigv4 = nil + obj.SyntheticsBasicAuthNTLM = nil + obj.SyntheticsBasicAuthDigest = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj SyntheticsBasicAuth) MarshalJSON() ([]byte, error) { + if obj.SyntheticsBasicAuthWeb != nil { + return json.Marshal(&obj.SyntheticsBasicAuthWeb) + } + + if obj.SyntheticsBasicAuthSigv4 != nil { + return json.Marshal(&obj.SyntheticsBasicAuthSigv4) + } + + if obj.SyntheticsBasicAuthNTLM != nil { + return json.Marshal(&obj.SyntheticsBasicAuthNTLM) + } + + if obj.SyntheticsBasicAuthDigest != nil { + return json.Marshal(&obj.SyntheticsBasicAuthDigest) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *SyntheticsBasicAuth) GetActualInstance() interface{} { + if obj.SyntheticsBasicAuthWeb != nil { + return obj.SyntheticsBasicAuthWeb + } + + if obj.SyntheticsBasicAuthSigv4 != nil { + return obj.SyntheticsBasicAuthSigv4 + } + + if obj.SyntheticsBasicAuthNTLM != nil { + return obj.SyntheticsBasicAuthNTLM + } + + if obj.SyntheticsBasicAuthDigest != nil { + return obj.SyntheticsBasicAuthDigest + } + + // all schemas are nil + return nil +} + +// NullableSyntheticsBasicAuth handles when a null is used for SyntheticsBasicAuth. +type NullableSyntheticsBasicAuth struct { + value *SyntheticsBasicAuth + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBasicAuth) Get() *SyntheticsBasicAuth { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBasicAuth) Set(val *SyntheticsBasicAuth) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBasicAuth) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableSyntheticsBasicAuth) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBasicAuth initializes the struct as if Set has been called. +func NewNullableSyntheticsBasicAuth(val *SyntheticsBasicAuth) *NullableSyntheticsBasicAuth { + return &NullableSyntheticsBasicAuth{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBasicAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBasicAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest.go b/api/v1/datadog/model_synthetics_basic_auth_digest.go new file mode 100644 index 00000000000..3615ee77437 --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_digest.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthDigest Object to handle digest authentication when performing the test. +type SyntheticsBasicAuthDigest struct { + // Password to use for the digest authentication. + Password string `json:"password"` + // The type of basic authentication to use when performing the test. + Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` + // Username to use for the digest authentication. + Username string `json:"username"` + // 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{} +} + +// NewSyntheticsBasicAuthDigest instantiates a new SyntheticsBasicAuthDigest 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 NewSyntheticsBasicAuthDigest(password string, username string) *SyntheticsBasicAuthDigest { + this := SyntheticsBasicAuthDigest{} + this.Password = password + var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST + this.Type = &typeVar + this.Username = username + return &this +} + +// NewSyntheticsBasicAuthDigestWithDefaults instantiates a new SyntheticsBasicAuthDigest 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 NewSyntheticsBasicAuthDigestWithDefaults() *SyntheticsBasicAuthDigest { + this := SyntheticsBasicAuthDigest{} + var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST + this.Type = &typeVar + return &this +} + +// GetPassword returns the Password field value. +func (o *SyntheticsBasicAuthDigest) GetPassword() string { + if o == nil { + var ret string + return ret + } + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value. +func (o *SyntheticsBasicAuthDigest) SetPassword(v string) { + o.Password = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthDigest) GetType() SyntheticsBasicAuthDigestType { + if o == nil || o.Type == nil { + var ret SyntheticsBasicAuthDigestType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetTypeOk() (*SyntheticsBasicAuthDigestType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthDigest) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsBasicAuthDigestType and assigns it to the Type field. +func (o *SyntheticsBasicAuthDigest) SetType(v SyntheticsBasicAuthDigestType) { + o.Type = &v +} + +// GetUsername returns the Username field value. +func (o *SyntheticsBasicAuthDigest) GetUsername() string { + if o == nil { + var ret string + return ret + } + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value. +func (o *SyntheticsBasicAuthDigest) SetUsername(v string) { + o.Username = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBasicAuthDigest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["password"] = o.Password + if o.Type != nil { + toSerialize["type"] = o.Type + } + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Password *string `json:"password"` + Username *string `json:"username"` + }{} + all := struct { + Password string `json:"password"` + Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` + Username string `json:"username"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Password == nil { + return fmt.Errorf("Required field password missing") + } + if required.Username == nil { + return fmt.Errorf("Required field username missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Password = all.Password + o.Type = all.Type + o.Username = all.Username + return nil +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest_type.go b/api/v1/datadog/model_synthetics_basic_auth_digest_type.go new file mode 100644 index 00000000000..f054e3531ad --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_digest_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthDigestType The type of basic authentication to use when performing the test. +type SyntheticsBasicAuthDigestType string + +// List of SyntheticsBasicAuthDigestType. +const ( + SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST SyntheticsBasicAuthDigestType = "digest" +) + +var allowedSyntheticsBasicAuthDigestTypeEnumValues = []SyntheticsBasicAuthDigestType{ + SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBasicAuthDigestType) GetAllowedValues() []SyntheticsBasicAuthDigestType { + return allowedSyntheticsBasicAuthDigestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBasicAuthDigestType(value) + return nil +} + +// NewSyntheticsBasicAuthDigestTypeFromValue returns a pointer to a valid SyntheticsBasicAuthDigestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBasicAuthDigestTypeFromValue(v string) (*SyntheticsBasicAuthDigestType, error) { + ev := SyntheticsBasicAuthDigestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthDigestType: valid values are %v", v, allowedSyntheticsBasicAuthDigestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBasicAuthDigestType) IsValid() bool { + for _, existing := range allowedSyntheticsBasicAuthDigestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBasicAuthDigestType value. +func (v SyntheticsBasicAuthDigestType) Ptr() *SyntheticsBasicAuthDigestType { + return &v +} + +// NullableSyntheticsBasicAuthDigestType handles when a null is used for SyntheticsBasicAuthDigestType. +type NullableSyntheticsBasicAuthDigestType struct { + value *SyntheticsBasicAuthDigestType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBasicAuthDigestType) Get() *SyntheticsBasicAuthDigestType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBasicAuthDigestType) Set(val *SyntheticsBasicAuthDigestType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBasicAuthDigestType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBasicAuthDigestType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBasicAuthDigestType initializes the struct as if Set has been called. +func NewNullableSyntheticsBasicAuthDigestType(val *SyntheticsBasicAuthDigestType) *NullableSyntheticsBasicAuthDigestType { + return &NullableSyntheticsBasicAuthDigestType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBasicAuthDigestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_ntlm.go b/api/v1/datadog/model_synthetics_basic_auth_ntlm.go new file mode 100644 index 00000000000..310800fd694 --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_ntlm.go @@ -0,0 +1,269 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthNTLM Object to handle `NTLM` authentication when performing the test. +type SyntheticsBasicAuthNTLM struct { + // Domain for the authentication to use when performing the test. + Domain *string `json:"domain,omitempty"` + // Password for the authentication to use when performing the test. + Password *string `json:"password,omitempty"` + // The type of authentication to use when performing the test. + Type SyntheticsBasicAuthNTLMType `json:"type"` + // Username for the authentication to use when performing the test. + Username *string `json:"username,omitempty"` + // Workstation for the authentication to use when performing the test. + Workstation *string `json:"workstation,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{} +} + +// NewSyntheticsBasicAuthNTLM instantiates a new SyntheticsBasicAuthNTLM 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 NewSyntheticsBasicAuthNTLM(typeVar SyntheticsBasicAuthNTLMType) *SyntheticsBasicAuthNTLM { + this := SyntheticsBasicAuthNTLM{} + this.Type = typeVar + return &this +} + +// NewSyntheticsBasicAuthNTLMWithDefaults instantiates a new SyntheticsBasicAuthNTLM 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 NewSyntheticsBasicAuthNTLMWithDefaults() *SyntheticsBasicAuthNTLM { + this := SyntheticsBasicAuthNTLM{} + var typeVar SyntheticsBasicAuthNTLMType = SYNTHETICSBASICAUTHNTLMTYPE_NTLM + this.Type = typeVar + return &this +} + +// GetDomain returns the Domain field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthNTLM) GetDomain() string { + if o == nil || o.Domain == nil { + var ret string + return ret + } + return *o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthNTLM) GetDomainOk() (*string, bool) { + if o == nil || o.Domain == nil { + return nil, false + } + return o.Domain, true +} + +// HasDomain returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthNTLM) HasDomain() bool { + if o != nil && o.Domain != nil { + return true + } + + return false +} + +// SetDomain gets a reference to the given string and assigns it to the Domain field. +func (o *SyntheticsBasicAuthNTLM) SetDomain(v string) { + o.Domain = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthNTLM) GetPassword() string { + if o == nil || o.Password == nil { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthNTLM) GetPasswordOk() (*string, bool) { + if o == nil || o.Password == nil { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthNTLM) HasPassword() bool { + if o != nil && o.Password != nil { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *SyntheticsBasicAuthNTLM) SetPassword(v string) { + o.Password = &v +} + +// GetType returns the Type field value. +func (o *SyntheticsBasicAuthNTLM) GetType() SyntheticsBasicAuthNTLMType { + if o == nil { + var ret SyntheticsBasicAuthNTLMType + 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 *SyntheticsBasicAuthNTLM) GetTypeOk() (*SyntheticsBasicAuthNTLMType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsBasicAuthNTLM) SetType(v SyntheticsBasicAuthNTLMType) { + o.Type = v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthNTLM) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthNTLM) GetUsernameOk() (*string, bool) { + if o == nil || o.Username == nil { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthNTLM) HasUsername() bool { + if o != nil && o.Username != nil { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *SyntheticsBasicAuthNTLM) SetUsername(v string) { + o.Username = &v +} + +// GetWorkstation returns the Workstation field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthNTLM) GetWorkstation() string { + if o == nil || o.Workstation == nil { + var ret string + return ret + } + return *o.Workstation +} + +// GetWorkstationOk returns a tuple with the Workstation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthNTLM) GetWorkstationOk() (*string, bool) { + if o == nil || o.Workstation == nil { + return nil, false + } + return o.Workstation, true +} + +// HasWorkstation returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthNTLM) HasWorkstation() bool { + if o != nil && o.Workstation != nil { + return true + } + + return false +} + +// SetWorkstation gets a reference to the given string and assigns it to the Workstation field. +func (o *SyntheticsBasicAuthNTLM) SetWorkstation(v string) { + o.Workstation = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBasicAuthNTLM) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Domain != nil { + toSerialize["domain"] = o.Domain + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + toSerialize["type"] = o.Type + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.Workstation != nil { + toSerialize["workstation"] = o.Workstation + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *SyntheticsBasicAuthNTLMType `json:"type"` + }{} + all := struct { + Domain *string `json:"domain,omitempty"` + Password *string `json:"password,omitempty"` + Type SyntheticsBasicAuthNTLMType `json:"type"` + Username *string `json:"username,omitempty"` + Workstation *string `json:"workstation,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Domain = all.Domain + o.Password = all.Password + o.Type = all.Type + o.Username = all.Username + o.Workstation = all.Workstation + return nil +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go b/api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go new file mode 100644 index 00000000000..eff9fbe505d --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_ntlm_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthNTLMType The type of authentication to use when performing the test. +type SyntheticsBasicAuthNTLMType string + +// List of SyntheticsBasicAuthNTLMType. +const ( + SYNTHETICSBASICAUTHNTLMTYPE_NTLM SyntheticsBasicAuthNTLMType = "ntlm" +) + +var allowedSyntheticsBasicAuthNTLMTypeEnumValues = []SyntheticsBasicAuthNTLMType{ + SYNTHETICSBASICAUTHNTLMTYPE_NTLM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBasicAuthNTLMType) GetAllowedValues() []SyntheticsBasicAuthNTLMType { + return allowedSyntheticsBasicAuthNTLMTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBasicAuthNTLMType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBasicAuthNTLMType(value) + return nil +} + +// NewSyntheticsBasicAuthNTLMTypeFromValue returns a pointer to a valid SyntheticsBasicAuthNTLMType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBasicAuthNTLMTypeFromValue(v string) (*SyntheticsBasicAuthNTLMType, error) { + ev := SyntheticsBasicAuthNTLMType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthNTLMType: valid values are %v", v, allowedSyntheticsBasicAuthNTLMTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBasicAuthNTLMType) IsValid() bool { + for _, existing := range allowedSyntheticsBasicAuthNTLMTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBasicAuthNTLMType value. +func (v SyntheticsBasicAuthNTLMType) Ptr() *SyntheticsBasicAuthNTLMType { + return &v +} + +// NullableSyntheticsBasicAuthNTLMType handles when a null is used for SyntheticsBasicAuthNTLMType. +type NullableSyntheticsBasicAuthNTLMType struct { + value *SyntheticsBasicAuthNTLMType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBasicAuthNTLMType) Get() *SyntheticsBasicAuthNTLMType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBasicAuthNTLMType) Set(val *SyntheticsBasicAuthNTLMType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBasicAuthNTLMType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBasicAuthNTLMType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBasicAuthNTLMType initializes the struct as if Set has been called. +func NewNullableSyntheticsBasicAuthNTLMType(val *SyntheticsBasicAuthNTLMType) *NullableSyntheticsBasicAuthNTLMType { + return &NullableSyntheticsBasicAuthNTLMType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBasicAuthNTLMType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBasicAuthNTLMType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_sigv4.go b/api/v1/datadog/model_synthetics_basic_auth_sigv4.go new file mode 100644 index 00000000000..563aeac2a72 --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_sigv4.go @@ -0,0 +1,296 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthSigv4 Object to handle `SIGV4` authentication when performing the test. +type SyntheticsBasicAuthSigv4 struct { + // Access key for the `SIGV4` authentication. + AccessKey string `json:"accessKey"` + // Region for the `SIGV4` authentication. + Region *string `json:"region,omitempty"` + // Secret key for the `SIGV4` authentication. + SecretKey string `json:"secretKey"` + // Service name for the `SIGV4` authentication. + ServiceName *string `json:"serviceName,omitempty"` + // Session token for the `SIGV4` authentication. + SessionToken *string `json:"sessionToken,omitempty"` + // The type of authentication to use when performing the test. + Type SyntheticsBasicAuthSigv4Type `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{} +} + +// NewSyntheticsBasicAuthSigv4 instantiates a new SyntheticsBasicAuthSigv4 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 NewSyntheticsBasicAuthSigv4(accessKey string, secretKey string, typeVar SyntheticsBasicAuthSigv4Type) *SyntheticsBasicAuthSigv4 { + this := SyntheticsBasicAuthSigv4{} + this.AccessKey = accessKey + this.SecretKey = secretKey + this.Type = typeVar + return &this +} + +// NewSyntheticsBasicAuthSigv4WithDefaults instantiates a new SyntheticsBasicAuthSigv4 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 NewSyntheticsBasicAuthSigv4WithDefaults() *SyntheticsBasicAuthSigv4 { + this := SyntheticsBasicAuthSigv4{} + var typeVar SyntheticsBasicAuthSigv4Type = SYNTHETICSBASICAUTHSIGV4TYPE_SIGV4 + this.Type = typeVar + return &this +} + +// GetAccessKey returns the AccessKey field value. +func (o *SyntheticsBasicAuthSigv4) GetAccessKey() string { + if o == nil { + var ret string + return ret + } + return o.AccessKey +} + +// GetAccessKeyOk returns a tuple with the AccessKey field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthSigv4) GetAccessKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccessKey, true +} + +// SetAccessKey sets field value. +func (o *SyntheticsBasicAuthSigv4) SetAccessKey(v string) { + o.AccessKey = v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthSigv4) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthSigv4) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthSigv4) HasRegion() bool { + if o != nil && o.Region != nil { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *SyntheticsBasicAuthSigv4) SetRegion(v string) { + o.Region = &v +} + +// GetSecretKey returns the SecretKey field value. +func (o *SyntheticsBasicAuthSigv4) GetSecretKey() string { + if o == nil { + var ret string + return ret + } + return o.SecretKey +} + +// GetSecretKeyOk returns a tuple with the SecretKey field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthSigv4) GetSecretKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SecretKey, true +} + +// SetSecretKey sets field value. +func (o *SyntheticsBasicAuthSigv4) SetSecretKey(v string) { + o.SecretKey = v +} + +// GetServiceName returns the ServiceName field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthSigv4) GetServiceName() string { + if o == nil || o.ServiceName == nil { + var ret string + return ret + } + return *o.ServiceName +} + +// GetServiceNameOk returns a tuple with the ServiceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthSigv4) GetServiceNameOk() (*string, bool) { + if o == nil || o.ServiceName == nil { + return nil, false + } + return o.ServiceName, true +} + +// HasServiceName returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthSigv4) HasServiceName() bool { + if o != nil && o.ServiceName != nil { + return true + } + + return false +} + +// SetServiceName gets a reference to the given string and assigns it to the ServiceName field. +func (o *SyntheticsBasicAuthSigv4) SetServiceName(v string) { + o.ServiceName = &v +} + +// GetSessionToken returns the SessionToken field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthSigv4) GetSessionToken() string { + if o == nil || o.SessionToken == nil { + var ret string + return ret + } + return *o.SessionToken +} + +// GetSessionTokenOk returns a tuple with the SessionToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthSigv4) GetSessionTokenOk() (*string, bool) { + if o == nil || o.SessionToken == nil { + return nil, false + } + return o.SessionToken, true +} + +// HasSessionToken returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthSigv4) HasSessionToken() bool { + if o != nil && o.SessionToken != nil { + return true + } + + return false +} + +// SetSessionToken gets a reference to the given string and assigns it to the SessionToken field. +func (o *SyntheticsBasicAuthSigv4) SetSessionToken(v string) { + o.SessionToken = &v +} + +// GetType returns the Type field value. +func (o *SyntheticsBasicAuthSigv4) GetType() SyntheticsBasicAuthSigv4Type { + if o == nil { + var ret SyntheticsBasicAuthSigv4Type + 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 *SyntheticsBasicAuthSigv4) GetTypeOk() (*SyntheticsBasicAuthSigv4Type, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsBasicAuthSigv4) SetType(v SyntheticsBasicAuthSigv4Type) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBasicAuthSigv4) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["accessKey"] = o.AccessKey + if o.Region != nil { + toSerialize["region"] = o.Region + } + toSerialize["secretKey"] = o.SecretKey + if o.ServiceName != nil { + toSerialize["serviceName"] = o.ServiceName + } + if o.SessionToken != nil { + toSerialize["sessionToken"] = o.SessionToken + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + AccessKey *string `json:"accessKey"` + SecretKey *string `json:"secretKey"` + Type *SyntheticsBasicAuthSigv4Type `json:"type"` + }{} + all := struct { + AccessKey string `json:"accessKey"` + Region *string `json:"region,omitempty"` + SecretKey string `json:"secretKey"` + ServiceName *string `json:"serviceName,omitempty"` + SessionToken *string `json:"sessionToken,omitempty"` + Type SyntheticsBasicAuthSigv4Type `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.AccessKey == nil { + return fmt.Errorf("Required field accessKey missing") + } + if required.SecretKey == nil { + return fmt.Errorf("Required field secretKey missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccessKey = all.AccessKey + o.Region = all.Region + o.SecretKey = all.SecretKey + o.ServiceName = all.ServiceName + o.SessionToken = all.SessionToken + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go b/api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go new file mode 100644 index 00000000000..79d87dfae2d --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_sigv4_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthSigv4Type The type of authentication to use when performing the test. +type SyntheticsBasicAuthSigv4Type string + +// List of SyntheticsBasicAuthSigv4Type. +const ( + SYNTHETICSBASICAUTHSIGV4TYPE_SIGV4 SyntheticsBasicAuthSigv4Type = "sigv4" +) + +var allowedSyntheticsBasicAuthSigv4TypeEnumValues = []SyntheticsBasicAuthSigv4Type{ + SYNTHETICSBASICAUTHSIGV4TYPE_SIGV4, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBasicAuthSigv4Type) GetAllowedValues() []SyntheticsBasicAuthSigv4Type { + return allowedSyntheticsBasicAuthSigv4TypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBasicAuthSigv4Type) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBasicAuthSigv4Type(value) + return nil +} + +// NewSyntheticsBasicAuthSigv4TypeFromValue returns a pointer to a valid SyntheticsBasicAuthSigv4Type +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBasicAuthSigv4TypeFromValue(v string) (*SyntheticsBasicAuthSigv4Type, error) { + ev := SyntheticsBasicAuthSigv4Type(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthSigv4Type: valid values are %v", v, allowedSyntheticsBasicAuthSigv4TypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBasicAuthSigv4Type) IsValid() bool { + for _, existing := range allowedSyntheticsBasicAuthSigv4TypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBasicAuthSigv4Type value. +func (v SyntheticsBasicAuthSigv4Type) Ptr() *SyntheticsBasicAuthSigv4Type { + return &v +} + +// NullableSyntheticsBasicAuthSigv4Type handles when a null is used for SyntheticsBasicAuthSigv4Type. +type NullableSyntheticsBasicAuthSigv4Type struct { + value *SyntheticsBasicAuthSigv4Type + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBasicAuthSigv4Type) Get() *SyntheticsBasicAuthSigv4Type { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBasicAuthSigv4Type) Set(val *SyntheticsBasicAuthSigv4Type) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBasicAuthSigv4Type) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBasicAuthSigv4Type) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBasicAuthSigv4Type initializes the struct as if Set has been called. +func NewNullableSyntheticsBasicAuthSigv4Type(val *SyntheticsBasicAuthSigv4Type) *NullableSyntheticsBasicAuthSigv4Type { + return &NullableSyntheticsBasicAuthSigv4Type{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBasicAuthSigv4Type) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBasicAuthSigv4Type) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_web.go b/api/v1/datadog/model_synthetics_basic_auth_web.go new file mode 100644 index 00000000000..b018a64b35c --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_web.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthWeb Object to handle basic authentication when performing the test. +type SyntheticsBasicAuthWeb struct { + // Password to use for the basic authentication. + Password string `json:"password"` + // The type of basic authentication to use when performing the test. + Type *SyntheticsBasicAuthWebType `json:"type,omitempty"` + // Username to use for the basic authentication. + Username string `json:"username"` + // 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{} +} + +// NewSyntheticsBasicAuthWeb instantiates a new SyntheticsBasicAuthWeb 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 NewSyntheticsBasicAuthWeb(password string, username string) *SyntheticsBasicAuthWeb { + this := SyntheticsBasicAuthWeb{} + this.Password = password + var typeVar SyntheticsBasicAuthWebType = SYNTHETICSBASICAUTHWEBTYPE_WEB + this.Type = &typeVar + this.Username = username + return &this +} + +// NewSyntheticsBasicAuthWebWithDefaults instantiates a new SyntheticsBasicAuthWeb 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 NewSyntheticsBasicAuthWebWithDefaults() *SyntheticsBasicAuthWeb { + this := SyntheticsBasicAuthWeb{} + var typeVar SyntheticsBasicAuthWebType = SYNTHETICSBASICAUTHWEBTYPE_WEB + this.Type = &typeVar + return &this +} + +// GetPassword returns the Password field value. +func (o *SyntheticsBasicAuthWeb) GetPassword() string { + if o == nil { + var ret string + return ret + } + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthWeb) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value. +func (o *SyntheticsBasicAuthWeb) SetPassword(v string) { + o.Password = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthWeb) GetType() SyntheticsBasicAuthWebType { + if o == nil || o.Type == nil { + var ret SyntheticsBasicAuthWebType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthWeb) GetTypeOk() (*SyntheticsBasicAuthWebType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthWeb) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsBasicAuthWebType and assigns it to the Type field. +func (o *SyntheticsBasicAuthWeb) SetType(v SyntheticsBasicAuthWebType) { + o.Type = &v +} + +// GetUsername returns the Username field value. +func (o *SyntheticsBasicAuthWeb) GetUsername() string { + if o == nil { + var ret string + return ret + } + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthWeb) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value. +func (o *SyntheticsBasicAuthWeb) SetUsername(v string) { + o.Username = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["password"] = o.Password + if o.Type != nil { + toSerialize["type"] = o.Type + } + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Password *string `json:"password"` + Username *string `json:"username"` + }{} + all := struct { + Password string `json:"password"` + Type *SyntheticsBasicAuthWebType `json:"type,omitempty"` + Username string `json:"username"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Password == nil { + return fmt.Errorf("Required field password missing") + } + if required.Username == nil { + return fmt.Errorf("Required field username missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Password = all.Password + o.Type = all.Type + o.Username = all.Username + return nil +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_web_type.go b/api/v1/datadog/model_synthetics_basic_auth_web_type.go new file mode 100644 index 00000000000..886871688b7 --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_web_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthWebType The type of basic authentication to use when performing the test. +type SyntheticsBasicAuthWebType string + +// List of SyntheticsBasicAuthWebType. +const ( + SYNTHETICSBASICAUTHWEBTYPE_WEB SyntheticsBasicAuthWebType = "web" +) + +var allowedSyntheticsBasicAuthWebTypeEnumValues = []SyntheticsBasicAuthWebType{ + SYNTHETICSBASICAUTHWEBTYPE_WEB, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBasicAuthWebType) GetAllowedValues() []SyntheticsBasicAuthWebType { + return allowedSyntheticsBasicAuthWebTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBasicAuthWebType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBasicAuthWebType(value) + return nil +} + +// NewSyntheticsBasicAuthWebTypeFromValue returns a pointer to a valid SyntheticsBasicAuthWebType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBasicAuthWebTypeFromValue(v string) (*SyntheticsBasicAuthWebType, error) { + ev := SyntheticsBasicAuthWebType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthWebType: valid values are %v", v, allowedSyntheticsBasicAuthWebTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBasicAuthWebType) IsValid() bool { + for _, existing := range allowedSyntheticsBasicAuthWebTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBasicAuthWebType value. +func (v SyntheticsBasicAuthWebType) Ptr() *SyntheticsBasicAuthWebType { + return &v +} + +// NullableSyntheticsBasicAuthWebType handles when a null is used for SyntheticsBasicAuthWebType. +type NullableSyntheticsBasicAuthWebType struct { + value *SyntheticsBasicAuthWebType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBasicAuthWebType) Get() *SyntheticsBasicAuthWebType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBasicAuthWebType) Set(val *SyntheticsBasicAuthWebType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBasicAuthWebType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBasicAuthWebType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBasicAuthWebType initializes the struct as if Set has been called. +func NewNullableSyntheticsBasicAuthWebType(val *SyntheticsBasicAuthWebType) *NullableSyntheticsBasicAuthWebType { + return &NullableSyntheticsBasicAuthWebType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBasicAuthWebType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBasicAuthWebType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_batch_details.go b/api/v1/datadog/model_synthetics_batch_details.go new file mode 100644 index 00000000000..5937aa47eba --- /dev/null +++ b/api/v1/datadog/model_synthetics_batch_details.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBatchDetails Details about a batch response. +type SyntheticsBatchDetails struct { + // Wrapper object that contains the details of a batch. + Data *SyntheticsBatchDetailsData `json:"data,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{} +} + +// NewSyntheticsBatchDetails instantiates a new SyntheticsBatchDetails 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 NewSyntheticsBatchDetails() *SyntheticsBatchDetails { + this := SyntheticsBatchDetails{} + return &this +} + +// NewSyntheticsBatchDetailsWithDefaults instantiates a new SyntheticsBatchDetails 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 NewSyntheticsBatchDetailsWithDefaults() *SyntheticsBatchDetails { + this := SyntheticsBatchDetails{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SyntheticsBatchDetails) GetData() SyntheticsBatchDetailsData { + if o == nil || o.Data == nil { + var ret SyntheticsBatchDetailsData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchDetails) GetDataOk() (*SyntheticsBatchDetailsData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SyntheticsBatchDetails) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SyntheticsBatchDetailsData and assigns it to the Data field. +func (o *SyntheticsBatchDetails) SetData(v SyntheticsBatchDetailsData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBatchDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBatchDetails) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SyntheticsBatchDetailsData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v1/datadog/model_synthetics_batch_details_data.go b/api/v1/datadog/model_synthetics_batch_details_data.go new file mode 100644 index 00000000000..08a008357a8 --- /dev/null +++ b/api/v1/datadog/model_synthetics_batch_details_data.go @@ -0,0 +1,195 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBatchDetailsData Wrapper object that contains the details of a batch. +type SyntheticsBatchDetailsData struct { + // Metadata for the Synthetics tests run. + Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` + // List of results for the batch. + Results []SyntheticsBatchResult `json:"results,omitempty"` + // Determines whether or not the batch has passed, failed, or is in progress. + Status *SyntheticsStatus `json:"status,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{} +} + +// NewSyntheticsBatchDetailsData instantiates a new SyntheticsBatchDetailsData 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 NewSyntheticsBatchDetailsData() *SyntheticsBatchDetailsData { + this := SyntheticsBatchDetailsData{} + return &this +} + +// NewSyntheticsBatchDetailsDataWithDefaults instantiates a new SyntheticsBatchDetailsData 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 NewSyntheticsBatchDetailsDataWithDefaults() *SyntheticsBatchDetailsData { + this := SyntheticsBatchDetailsData{} + return &this +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SyntheticsBatchDetailsData) GetMetadata() SyntheticsCIBatchMetadata { + if o == nil || o.Metadata == nil { + var ret SyntheticsCIBatchMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchDetailsData) GetMetadataOk() (*SyntheticsCIBatchMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SyntheticsBatchDetailsData) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given SyntheticsCIBatchMetadata and assigns it to the Metadata field. +func (o *SyntheticsBatchDetailsData) SetMetadata(v SyntheticsCIBatchMetadata) { + o.Metadata = &v +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *SyntheticsBatchDetailsData) GetResults() []SyntheticsBatchResult { + if o == nil || o.Results == nil { + var ret []SyntheticsBatchResult + return ret + } + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchDetailsData) GetResultsOk() (*[]SyntheticsBatchResult, bool) { + if o == nil || o.Results == nil { + return nil, false + } + return &o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *SyntheticsBatchDetailsData) HasResults() bool { + if o != nil && o.Results != nil { + return true + } + + return false +} + +// SetResults gets a reference to the given []SyntheticsBatchResult and assigns it to the Results field. +func (o *SyntheticsBatchDetailsData) SetResults(v []SyntheticsBatchResult) { + o.Results = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsBatchDetailsData) GetStatus() SyntheticsStatus { + if o == nil || o.Status == nil { + var ret SyntheticsStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchDetailsData) GetStatusOk() (*SyntheticsStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsBatchDetailsData) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsStatus and assigns it to the Status field. +func (o *SyntheticsBatchDetailsData) SetStatus(v SyntheticsStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBatchDetailsData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Results != nil { + toSerialize["results"] = o.Results + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBatchDetailsData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` + Results []SyntheticsBatchResult `json:"results,omitempty"` + Status *SyntheticsStatus `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Results = all.Results + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_synthetics_batch_result.go b/api/v1/datadog/model_synthetics_batch_result.go new file mode 100644 index 00000000000..a9ac5e47dc1 --- /dev/null +++ b/api/v1/datadog/model_synthetics_batch_result.go @@ -0,0 +1,485 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBatchResult Object with the results of a Synthetics batch. +type SyntheticsBatchResult struct { + // The device ID. + Device *SyntheticsDeviceID `json:"device,omitempty"` + // Total duration in millisecond of the test. + Duration *float64 `json:"duration,omitempty"` + // Execution rule for a Synthetics test. + ExecutionRule *SyntheticsTestExecutionRule `json:"execution_rule,omitempty"` + // Name of the location. + Location *string `json:"location,omitempty"` + // The ID of the result to get. + ResultId *string `json:"result_id,omitempty"` + // Number of times this result has been retried. + Retries *float64 `json:"retries,omitempty"` + // Determines whether or not the batch has passed, failed, or is in progress. + Status *SyntheticsStatus `json:"status,omitempty"` + // Name of the test. + TestName *string `json:"test_name,omitempty"` + // The public ID of the Synthetic test. + TestPublicId *string `json:"test_public_id,omitempty"` + // Type of the Synthetic test, either `api` or `browser`. + TestType *SyntheticsTestDetailsType `json:"test_type,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{} +} + +// NewSyntheticsBatchResult instantiates a new SyntheticsBatchResult 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 NewSyntheticsBatchResult() *SyntheticsBatchResult { + this := SyntheticsBatchResult{} + return &this +} + +// NewSyntheticsBatchResultWithDefaults instantiates a new SyntheticsBatchResult 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 NewSyntheticsBatchResultWithDefaults() *SyntheticsBatchResult { + this := SyntheticsBatchResult{} + return &this +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetDevice() SyntheticsDeviceID { + if o == nil || o.Device == nil { + var ret SyntheticsDeviceID + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetDeviceOk() (*SyntheticsDeviceID, bool) { + if o == nil || o.Device == nil { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasDevice() bool { + if o != nil && o.Device != nil { + return true + } + + return false +} + +// SetDevice gets a reference to the given SyntheticsDeviceID and assigns it to the Device field. +func (o *SyntheticsBatchResult) SetDevice(v SyntheticsDeviceID) { + o.Device = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetDuration() float64 { + if o == nil || o.Duration == nil { + var ret float64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetDurationOk() (*float64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasDuration() bool { + if o != nil && o.Duration != nil { + return true + } + + return false +} + +// SetDuration gets a reference to the given float64 and assigns it to the Duration field. +func (o *SyntheticsBatchResult) SetDuration(v float64) { + o.Duration = &v +} + +// GetExecutionRule returns the ExecutionRule field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetExecutionRule() SyntheticsTestExecutionRule { + if o == nil || o.ExecutionRule == nil { + var ret SyntheticsTestExecutionRule + return ret + } + return *o.ExecutionRule +} + +// GetExecutionRuleOk returns a tuple with the ExecutionRule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetExecutionRuleOk() (*SyntheticsTestExecutionRule, bool) { + if o == nil || o.ExecutionRule == nil { + return nil, false + } + return o.ExecutionRule, true +} + +// HasExecutionRule returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasExecutionRule() bool { + if o != nil && o.ExecutionRule != nil { + return true + } + + return false +} + +// SetExecutionRule gets a reference to the given SyntheticsTestExecutionRule and assigns it to the ExecutionRule field. +func (o *SyntheticsBatchResult) SetExecutionRule(v SyntheticsTestExecutionRule) { + o.ExecutionRule = &v +} + +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetLocation() string { + if o == nil || o.Location == nil { + var ret string + return ret + } + return *o.Location +} + +// GetLocationOk returns a tuple with the Location field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetLocationOk() (*string, bool) { + if o == nil || o.Location == nil { + return nil, false + } + return o.Location, true +} + +// HasLocation returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *SyntheticsBatchResult) SetLocation(v string) { + o.Location = &v +} + +// GetResultId returns the ResultId field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetResultId() string { + if o == nil || o.ResultId == nil { + var ret string + return ret + } + return *o.ResultId +} + +// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetResultIdOk() (*string, bool) { + if o == nil || o.ResultId == nil { + return nil, false + } + return o.ResultId, true +} + +// HasResultId returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasResultId() bool { + if o != nil && o.ResultId != nil { + return true + } + + return false +} + +// SetResultId gets a reference to the given string and assigns it to the ResultId field. +func (o *SyntheticsBatchResult) SetResultId(v string) { + o.ResultId = &v +} + +// GetRetries returns the Retries field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetRetries() float64 { + if o == nil || o.Retries == nil { + var ret float64 + return ret + } + return *o.Retries +} + +// GetRetriesOk returns a tuple with the Retries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetRetriesOk() (*float64, bool) { + if o == nil || o.Retries == nil { + return nil, false + } + return o.Retries, true +} + +// HasRetries returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasRetries() bool { + if o != nil && o.Retries != nil { + return true + } + + return false +} + +// SetRetries gets a reference to the given float64 and assigns it to the Retries field. +func (o *SyntheticsBatchResult) SetRetries(v float64) { + o.Retries = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetStatus() SyntheticsStatus { + if o == nil || o.Status == nil { + var ret SyntheticsStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetStatusOk() (*SyntheticsStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsStatus and assigns it to the Status field. +func (o *SyntheticsBatchResult) SetStatus(v SyntheticsStatus) { + o.Status = &v +} + +// GetTestName returns the TestName field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetTestName() string { + if o == nil || o.TestName == nil { + var ret string + return ret + } + return *o.TestName +} + +// GetTestNameOk returns a tuple with the TestName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetTestNameOk() (*string, bool) { + if o == nil || o.TestName == nil { + return nil, false + } + return o.TestName, true +} + +// HasTestName returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasTestName() bool { + if o != nil && o.TestName != nil { + return true + } + + return false +} + +// SetTestName gets a reference to the given string and assigns it to the TestName field. +func (o *SyntheticsBatchResult) SetTestName(v string) { + o.TestName = &v +} + +// GetTestPublicId returns the TestPublicId field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetTestPublicId() string { + if o == nil || o.TestPublicId == nil { + var ret string + return ret + } + return *o.TestPublicId +} + +// GetTestPublicIdOk returns a tuple with the TestPublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetTestPublicIdOk() (*string, bool) { + if o == nil || o.TestPublicId == nil { + return nil, false + } + return o.TestPublicId, true +} + +// HasTestPublicId returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasTestPublicId() bool { + if o != nil && o.TestPublicId != nil { + return true + } + + return false +} + +// SetTestPublicId gets a reference to the given string and assigns it to the TestPublicId field. +func (o *SyntheticsBatchResult) SetTestPublicId(v string) { + o.TestPublicId = &v +} + +// GetTestType returns the TestType field value if set, zero value otherwise. +func (o *SyntheticsBatchResult) GetTestType() SyntheticsTestDetailsType { + if o == nil || o.TestType == nil { + var ret SyntheticsTestDetailsType + return ret + } + return *o.TestType +} + +// GetTestTypeOk returns a tuple with the TestType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBatchResult) GetTestTypeOk() (*SyntheticsTestDetailsType, bool) { + if o == nil || o.TestType == nil { + return nil, false + } + return o.TestType, true +} + +// HasTestType returns a boolean if a field has been set. +func (o *SyntheticsBatchResult) HasTestType() bool { + if o != nil && o.TestType != nil { + return true + } + + return false +} + +// SetTestType gets a reference to the given SyntheticsTestDetailsType and assigns it to the TestType field. +func (o *SyntheticsBatchResult) SetTestType(v SyntheticsTestDetailsType) { + o.TestType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBatchResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Device != nil { + toSerialize["device"] = o.Device + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.ExecutionRule != nil { + toSerialize["execution_rule"] = o.ExecutionRule + } + if o.Location != nil { + toSerialize["location"] = o.Location + } + if o.ResultId != nil { + toSerialize["result_id"] = o.ResultId + } + if o.Retries != nil { + toSerialize["retries"] = o.Retries + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.TestName != nil { + toSerialize["test_name"] = o.TestName + } + if o.TestPublicId != nil { + toSerialize["test_public_id"] = o.TestPublicId + } + if o.TestType != nil { + toSerialize["test_type"] = o.TestType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBatchResult) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Device *SyntheticsDeviceID `json:"device,omitempty"` + Duration *float64 `json:"duration,omitempty"` + ExecutionRule *SyntheticsTestExecutionRule `json:"execution_rule,omitempty"` + Location *string `json:"location,omitempty"` + ResultId *string `json:"result_id,omitempty"` + Retries *float64 `json:"retries,omitempty"` + Status *SyntheticsStatus `json:"status,omitempty"` + TestName *string `json:"test_name,omitempty"` + TestPublicId *string `json:"test_public_id,omitempty"` + TestType *SyntheticsTestDetailsType `json:"test_type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Device; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ExecutionRule; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TestType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Device = all.Device + o.Duration = all.Duration + o.ExecutionRule = all.ExecutionRule + o.Location = all.Location + o.ResultId = all.ResultId + o.Retries = all.Retries + o.Status = all.Status + o.TestName = all.TestName + o.TestPublicId = all.TestPublicId + o.TestType = all.TestType + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_error.go b/api/v1/datadog/model_synthetics_browser_error.go new file mode 100644 index 00000000000..baa171e312f --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_error.go @@ -0,0 +1,216 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserError Error response object for a browser test. +type SyntheticsBrowserError struct { + // Description of the error. + Description string `json:"description"` + // Name of the error. + Name string `json:"name"` + // Status Code of the error. + Status *int64 `json:"status,omitempty"` + // Error type returned by a browser test. + Type SyntheticsBrowserErrorType `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{} +} + +// NewSyntheticsBrowserError instantiates a new SyntheticsBrowserError 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 NewSyntheticsBrowserError(description string, name string, typeVar SyntheticsBrowserErrorType) *SyntheticsBrowserError { + this := SyntheticsBrowserError{} + this.Description = description + this.Name = name + this.Type = typeVar + return &this +} + +// NewSyntheticsBrowserErrorWithDefaults instantiates a new SyntheticsBrowserError 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 NewSyntheticsBrowserErrorWithDefaults() *SyntheticsBrowserError { + this := SyntheticsBrowserError{} + return &this +} + +// GetDescription returns the Description field value. +func (o *SyntheticsBrowserError) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserError) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *SyntheticsBrowserError) SetDescription(v string) { + o.Description = v +} + +// GetName returns the Name field value. +func (o *SyntheticsBrowserError) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserError) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsBrowserError) SetName(v string) { + o.Name = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsBrowserError) GetStatus() int64 { + if o == nil || o.Status == nil { + var ret int64 + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserError) GetStatusOk() (*int64, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsBrowserError) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given int64 and assigns it to the Status field. +func (o *SyntheticsBrowserError) SetStatus(v int64) { + o.Status = &v +} + +// GetType returns the Type field value. +func (o *SyntheticsBrowserError) GetType() SyntheticsBrowserErrorType { + if o == nil { + var ret SyntheticsBrowserErrorType + 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 *SyntheticsBrowserError) GetTypeOk() (*SyntheticsBrowserErrorType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsBrowserError) SetType(v SyntheticsBrowserErrorType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["description"] = o.Description + toSerialize["name"] = o.Name + if o.Status != nil { + toSerialize["status"] = o.Status + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Description *string `json:"description"` + Name *string `json:"name"` + Type *SyntheticsBrowserErrorType `json:"type"` + }{} + all := struct { + Description string `json:"description"` + Name string `json:"name"` + Status *int64 `json:"status,omitempty"` + Type SyntheticsBrowserErrorType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Description == nil { + return fmt.Errorf("Required field description missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Description = all.Description + o.Name = all.Name + o.Status = all.Status + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_error_type.go b/api/v1/datadog/model_synthetics_browser_error_type.go new file mode 100644 index 00000000000..e2e2697a746 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_error_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserErrorType Error type returned by a browser test. +type SyntheticsBrowserErrorType string + +// List of SyntheticsBrowserErrorType. +const ( + SYNTHETICSBROWSERERRORTYPE_NETWORK SyntheticsBrowserErrorType = "network" + SYNTHETICSBROWSERERRORTYPE_JS SyntheticsBrowserErrorType = "js" +) + +var allowedSyntheticsBrowserErrorTypeEnumValues = []SyntheticsBrowserErrorType{ + SYNTHETICSBROWSERERRORTYPE_NETWORK, + SYNTHETICSBROWSERERRORTYPE_JS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBrowserErrorType) GetAllowedValues() []SyntheticsBrowserErrorType { + return allowedSyntheticsBrowserErrorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBrowserErrorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBrowserErrorType(value) + return nil +} + +// NewSyntheticsBrowserErrorTypeFromValue returns a pointer to a valid SyntheticsBrowserErrorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBrowserErrorTypeFromValue(v string) (*SyntheticsBrowserErrorType, error) { + ev := SyntheticsBrowserErrorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserErrorType: valid values are %v", v, allowedSyntheticsBrowserErrorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBrowserErrorType) IsValid() bool { + for _, existing := range allowedSyntheticsBrowserErrorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBrowserErrorType value. +func (v SyntheticsBrowserErrorType) Ptr() *SyntheticsBrowserErrorType { + return &v +} + +// NullableSyntheticsBrowserErrorType handles when a null is used for SyntheticsBrowserErrorType. +type NullableSyntheticsBrowserErrorType struct { + value *SyntheticsBrowserErrorType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBrowserErrorType) Get() *SyntheticsBrowserErrorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBrowserErrorType) Set(val *SyntheticsBrowserErrorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBrowserErrorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBrowserErrorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBrowserErrorType initializes the struct as if Set has been called. +func NewNullableSyntheticsBrowserErrorType(val *SyntheticsBrowserErrorType) *NullableSyntheticsBrowserErrorType { + return &NullableSyntheticsBrowserErrorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBrowserErrorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBrowserErrorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_browser_test_.go b/api/v1/datadog/model_synthetics_browser_test_.go new file mode 100644 index 00000000000..20b60aa247e --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_.go @@ -0,0 +1,496 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserTest Object containing details about a Synthetic browser test. +type SyntheticsBrowserTest struct { + // Configuration object for a Synthetic browser test. + Config SyntheticsBrowserTestConfig `json:"config"` + // Array of locations used to run the test. + Locations []string `json:"locations"` + // Notification message associated with the test. Message can either be text or an empty string. + Message string `json:"message"` + // The associated monitor ID. + MonitorId *int64 `json:"monitor_id,omitempty"` + // Name of the test. + Name string `json:"name"` + // Object describing the extra options for a Synthetic test. + Options SyntheticsTestOptions `json:"options"` + // The public ID of the test. + PublicId *string `json:"public_id,omitempty"` + // Define whether you want to start (`live`) or pause (`paused`) a + // Synthetic test. + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + // The steps of the test. + Steps []SyntheticsStep `json:"steps,omitempty"` + // Array of tags attached to the test. + Tags []string `json:"tags,omitempty"` + // Type of the Synthetic test, `browser`. + Type SyntheticsBrowserTestType `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{} +} + +// NewSyntheticsBrowserTest instantiates a new SyntheticsBrowserTest 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 NewSyntheticsBrowserTest(config SyntheticsBrowserTestConfig, locations []string, message string, name string, options SyntheticsTestOptions, typeVar SyntheticsBrowserTestType) *SyntheticsBrowserTest { + this := SyntheticsBrowserTest{} + this.Config = config + this.Locations = locations + this.Message = message + this.Name = name + this.Options = options + this.Type = typeVar + return &this +} + +// NewSyntheticsBrowserTestWithDefaults instantiates a new SyntheticsBrowserTest 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 NewSyntheticsBrowserTestWithDefaults() *SyntheticsBrowserTest { + this := SyntheticsBrowserTest{} + var typeVar SyntheticsBrowserTestType = SYNTHETICSBROWSERTESTTYPE_BROWSER + this.Type = typeVar + return &this +} + +// GetConfig returns the Config field value. +func (o *SyntheticsBrowserTest) GetConfig() SyntheticsBrowserTestConfig { + if o == nil { + var ret SyntheticsBrowserTestConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetConfigOk() (*SyntheticsBrowserTestConfig, bool) { + if o == nil { + return nil, false + } + return &o.Config, true +} + +// SetConfig sets field value. +func (o *SyntheticsBrowserTest) SetConfig(v SyntheticsBrowserTestConfig) { + o.Config = v +} + +// GetLocations returns the Locations field value. +func (o *SyntheticsBrowserTest) GetLocations() []string { + if o == nil { + var ret []string + return ret + } + return o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetLocationsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Locations, true +} + +// SetLocations sets field value. +func (o *SyntheticsBrowserTest) SetLocations(v []string) { + o.Locations = v +} + +// GetMessage returns the Message field value. +func (o *SyntheticsBrowserTest) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *SyntheticsBrowserTest) SetMessage(v string) { + o.Message = v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetMonitorId() int64 { + if o == nil || o.MonitorId == nil { + var ret int64 + return ret + } + return *o.MonitorId +} + +// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetMonitorIdOk() (*int64, bool) { + if o == nil || o.MonitorId == nil { + return nil, false + } + return o.MonitorId, true +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasMonitorId() bool { + if o != nil && o.MonitorId != nil { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. +func (o *SyntheticsBrowserTest) SetMonitorId(v int64) { + o.MonitorId = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsBrowserTest) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsBrowserTest) SetName(v string) { + o.Name = v +} + +// GetOptions returns the Options field value. +func (o *SyntheticsBrowserTest) GetOptions() SyntheticsTestOptions { + if o == nil { + var ret SyntheticsTestOptions + return ret + } + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetOptionsOk() (*SyntheticsTestOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value. +func (o *SyntheticsBrowserTest) SetOptions(v SyntheticsTestOptions) { + o.Options = v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *SyntheticsBrowserTest) SetPublicId(v string) { + o.PublicId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetStatus() SyntheticsTestPauseStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestPauseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. +func (o *SyntheticsBrowserTest) SetStatus(v SyntheticsTestPauseStatus) { + o.Status = &v +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetSteps() []SyntheticsStep { + if o == nil || o.Steps == nil { + var ret []SyntheticsStep + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetStepsOk() (*[]SyntheticsStep, bool) { + if o == nil || o.Steps == nil { + return nil, false + } + return &o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasSteps() bool { + if o != nil && o.Steps != nil { + return true + } + + return false +} + +// SetSteps gets a reference to the given []SyntheticsStep and assigns it to the Steps field. +func (o *SyntheticsBrowserTest) SetSteps(v []SyntheticsStep) { + o.Steps = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SyntheticsBrowserTest) GetTagsOk() (*[]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 *SyntheticsBrowserTest) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SyntheticsBrowserTest) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value. +func (o *SyntheticsBrowserTest) GetType() SyntheticsBrowserTestType { + if o == nil { + var ret SyntheticsBrowserTestType + 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 *SyntheticsBrowserTest) GetTypeOk() (*SyntheticsBrowserTestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsBrowserTest) SetType(v SyntheticsBrowserTestType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["config"] = o.Config + toSerialize["locations"] = o.Locations + toSerialize["message"] = o.Message + if o.MonitorId != nil { + toSerialize["monitor_id"] = o.MonitorId + } + toSerialize["name"] = o.Name + toSerialize["options"] = o.Options + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Steps != nil { + toSerialize["steps"] = o.Steps + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Config *SyntheticsBrowserTestConfig `json:"config"` + Locations *[]string `json:"locations"` + Message *string `json:"message"` + Name *string `json:"name"` + Options *SyntheticsTestOptions `json:"options"` + Type *SyntheticsBrowserTestType `json:"type"` + }{} + all := struct { + Config SyntheticsBrowserTestConfig `json:"config"` + Locations []string `json:"locations"` + Message string `json:"message"` + MonitorId *int64 `json:"monitor_id,omitempty"` + Name string `json:"name"` + Options SyntheticsTestOptions `json:"options"` + PublicId *string `json:"public_id,omitempty"` + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + Steps []SyntheticsStep `json:"steps,omitempty"` + Tags []string `json:"tags,omitempty"` + Type SyntheticsBrowserTestType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Config == nil { + return fmt.Errorf("Required field config missing") + } + if required.Locations == nil { + return fmt.Errorf("Required field locations missing") + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Options == nil { + return fmt.Errorf("Required field options missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Config = all.Config + o.Locations = all.Locations + o.Message = all.Message + o.MonitorId = all.MonitorId + o.Name = all.Name + if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.PublicId = all.PublicId + o.Status = all.Status + o.Steps = all.Steps + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_config.go b/api/v1/datadog/model_synthetics_browser_test_config.go new file mode 100644 index 00000000000..8f12f59799d --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_config.go @@ -0,0 +1,260 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserTestConfig Configuration object for a Synthetic browser test. +type SyntheticsBrowserTestConfig struct { + // Array of assertions used for the test. + Assertions []SyntheticsAssertion `json:"assertions"` + // Array of variables used for the test. + ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` + // Object describing the Synthetic test request. + Request SyntheticsTestRequest `json:"request"` + // Cookies to be used for the request, using the [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) syntax. + SetCookie *string `json:"setCookie,omitempty"` + // Array of variables used for the test steps. + Variables []SyntheticsBrowserVariable `json:"variables,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{} +} + +// NewSyntheticsBrowserTestConfig instantiates a new SyntheticsBrowserTestConfig 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 NewSyntheticsBrowserTestConfig(assertions []SyntheticsAssertion, request SyntheticsTestRequest) *SyntheticsBrowserTestConfig { + this := SyntheticsBrowserTestConfig{} + this.Assertions = assertions + this.Request = request + return &this +} + +// NewSyntheticsBrowserTestConfigWithDefaults instantiates a new SyntheticsBrowserTestConfig 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 NewSyntheticsBrowserTestConfigWithDefaults() *SyntheticsBrowserTestConfig { + this := SyntheticsBrowserTestConfig{} + return &this +} + +// GetAssertions returns the Assertions field value. +func (o *SyntheticsBrowserTestConfig) GetAssertions() []SyntheticsAssertion { + if o == nil { + var ret []SyntheticsAssertion + return ret + } + return o.Assertions +} + +// GetAssertionsOk returns a tuple with the Assertions field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { + if o == nil { + return nil, false + } + return &o.Assertions, true +} + +// SetAssertions sets field value. +func (o *SyntheticsBrowserTestConfig) SetAssertions(v []SyntheticsAssertion) { + o.Assertions = v +} + +// GetConfigVariables returns the ConfigVariables field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestConfig) GetConfigVariables() []SyntheticsConfigVariable { + if o == nil || o.ConfigVariables == nil { + var ret []SyntheticsConfigVariable + return ret + } + return o.ConfigVariables +} + +// GetConfigVariablesOk returns a tuple with the ConfigVariables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool) { + if o == nil || o.ConfigVariables == nil { + return nil, false + } + return &o.ConfigVariables, true +} + +// HasConfigVariables returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestConfig) HasConfigVariables() bool { + if o != nil && o.ConfigVariables != nil { + return true + } + + return false +} + +// SetConfigVariables gets a reference to the given []SyntheticsConfigVariable and assigns it to the ConfigVariables field. +func (o *SyntheticsBrowserTestConfig) SetConfigVariables(v []SyntheticsConfigVariable) { + o.ConfigVariables = v +} + +// GetRequest returns the Request field value. +func (o *SyntheticsBrowserTestConfig) GetRequest() SyntheticsTestRequest { + if o == nil { + var ret SyntheticsTestRequest + return ret + } + return o.Request +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { + if o == nil { + return nil, false + } + return &o.Request, true +} + +// SetRequest sets field value. +func (o *SyntheticsBrowserTestConfig) SetRequest(v SyntheticsTestRequest) { + o.Request = v +} + +// GetSetCookie returns the SetCookie field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestConfig) GetSetCookie() string { + if o == nil || o.SetCookie == nil { + var ret string + return ret + } + return *o.SetCookie +} + +// GetSetCookieOk returns a tuple with the SetCookie field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetSetCookieOk() (*string, bool) { + if o == nil || o.SetCookie == nil { + return nil, false + } + return o.SetCookie, true +} + +// HasSetCookie returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestConfig) HasSetCookie() bool { + if o != nil && o.SetCookie != nil { + return true + } + + return false +} + +// SetSetCookie gets a reference to the given string and assigns it to the SetCookie field. +func (o *SyntheticsBrowserTestConfig) SetSetCookie(v string) { + o.SetCookie = &v +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestConfig) GetVariables() []SyntheticsBrowserVariable { + if o == nil || o.Variables == nil { + var ret []SyntheticsBrowserVariable + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetVariablesOk() (*[]SyntheticsBrowserVariable, bool) { + if o == nil || o.Variables == nil { + return nil, false + } + return &o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestConfig) HasVariables() bool { + if o != nil && o.Variables != nil { + return true + } + + return false +} + +// SetVariables gets a reference to the given []SyntheticsBrowserVariable and assigns it to the Variables field. +func (o *SyntheticsBrowserTestConfig) SetVariables(v []SyntheticsBrowserVariable) { + o.Variables = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["assertions"] = o.Assertions + if o.ConfigVariables != nil { + toSerialize["configVariables"] = o.ConfigVariables + } + toSerialize["request"] = o.Request + if o.SetCookie != nil { + toSerialize["setCookie"] = o.SetCookie + } + if o.Variables != nil { + toSerialize["variables"] = o.Variables + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Assertions *[]SyntheticsAssertion `json:"assertions"` + Request *SyntheticsTestRequest `json:"request"` + }{} + all := struct { + Assertions []SyntheticsAssertion `json:"assertions"` + ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` + Request SyntheticsTestRequest `json:"request"` + SetCookie *string `json:"setCookie,omitempty"` + Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Assertions == nil { + return fmt.Errorf("Required field assertions missing") + } + if required.Request == nil { + return fmt.Errorf("Required field request missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Assertions = all.Assertions + o.ConfigVariables = all.ConfigVariables + if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Request = all.Request + o.SetCookie = all.SetCookie + o.Variables = all.Variables + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_failure_code.go b/api/v1/datadog/model_synthetics_browser_test_failure_code.go new file mode 100644 index 00000000000..3a7cc489968 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_failure_code.go @@ -0,0 +1,171 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserTestFailureCode Error code that can be returned by a Synthetic test. +type SyntheticsBrowserTestFailureCode string + +// List of SyntheticsBrowserTestFailureCode. +const ( + SYNTHETICSBROWSERTESTFAILURECODE_API_REQUEST_FAILURE SyntheticsBrowserTestFailureCode = "API_REQUEST_FAILURE" + SYNTHETICSBROWSERTESTFAILURECODE_ASSERTION_FAILURE SyntheticsBrowserTestFailureCode = "ASSERTION_FAILURE" + SYNTHETICSBROWSERTESTFAILURECODE_DOWNLOAD_FILE_TOO_LARGE SyntheticsBrowserTestFailureCode = "DOWNLOAD_FILE_TOO_LARGE" + SYNTHETICSBROWSERTESTFAILURECODE_ELEMENT_NOT_INTERACTABLE SyntheticsBrowserTestFailureCode = "ELEMENT_NOT_INTERACTABLE" + SYNTHETICSBROWSERTESTFAILURECODE_EMAIL_VARIABLE_NOT_DEFINED SyntheticsBrowserTestFailureCode = "EMAIL_VARIABLE_NOT_DEFINED" + SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT SyntheticsBrowserTestFailureCode = "EVALUATE_JAVASCRIPT" + SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT_CONTEXT SyntheticsBrowserTestFailureCode = "EVALUATE_JAVASCRIPT_CONTEXT" + SYNTHETICSBROWSERTESTFAILURECODE_EXTRACT_VARIABLE SyntheticsBrowserTestFailureCode = "EXTRACT_VARIABLE" + SYNTHETICSBROWSERTESTFAILURECODE_FORBIDDEN_URL SyntheticsBrowserTestFailureCode = "FORBIDDEN_URL" + SYNTHETICSBROWSERTESTFAILURECODE_FRAME_DETACHED SyntheticsBrowserTestFailureCode = "FRAME_DETACHED" + SYNTHETICSBROWSERTESTFAILURECODE_INCONSISTENCIES SyntheticsBrowserTestFailureCode = "INCONSISTENCIES" + SYNTHETICSBROWSERTESTFAILURECODE_INTERNAL_ERROR SyntheticsBrowserTestFailureCode = "INTERNAL_ERROR" + SYNTHETICSBROWSERTESTFAILURECODE_INVALID_TYPE_TEXT_DELAY SyntheticsBrowserTestFailureCode = "INVALID_TYPE_TEXT_DELAY" + SYNTHETICSBROWSERTESTFAILURECODE_INVALID_URL SyntheticsBrowserTestFailureCode = "INVALID_URL" + SYNTHETICSBROWSERTESTFAILURECODE_INVALID_VARIABLE_PATTERN SyntheticsBrowserTestFailureCode = "INVALID_VARIABLE_PATTERN" + SYNTHETICSBROWSERTESTFAILURECODE_INVISIBLE_ELEMENT SyntheticsBrowserTestFailureCode = "INVISIBLE_ELEMENT" + SYNTHETICSBROWSERTESTFAILURECODE_LOCATE_ELEMENT SyntheticsBrowserTestFailureCode = "LOCATE_ELEMENT" + SYNTHETICSBROWSERTESTFAILURECODE_NAVIGATE_TO_LINK SyntheticsBrowserTestFailureCode = "NAVIGATE_TO_LINK" + SYNTHETICSBROWSERTESTFAILURECODE_OPEN_URL SyntheticsBrowserTestFailureCode = "OPEN_URL" + SYNTHETICSBROWSERTESTFAILURECODE_PRESS_KEY SyntheticsBrowserTestFailureCode = "PRESS_KEY" + SYNTHETICSBROWSERTESTFAILURECODE_SERVER_CERTIFICATE SyntheticsBrowserTestFailureCode = "SERVER_CERTIFICATE" + SYNTHETICSBROWSERTESTFAILURECODE_SELECT_OPTION SyntheticsBrowserTestFailureCode = "SELECT_OPTION" + SYNTHETICSBROWSERTESTFAILURECODE_STEP_TIMEOUT SyntheticsBrowserTestFailureCode = "STEP_TIMEOUT" + SYNTHETICSBROWSERTESTFAILURECODE_SUB_TEST_NOT_PASSED SyntheticsBrowserTestFailureCode = "SUB_TEST_NOT_PASSED" + SYNTHETICSBROWSERTESTFAILURECODE_TEST_TIMEOUT SyntheticsBrowserTestFailureCode = "TEST_TIMEOUT" + SYNTHETICSBROWSERTESTFAILURECODE_TOO_MANY_HTTP_REQUESTS SyntheticsBrowserTestFailureCode = "TOO_MANY_HTTP_REQUESTS" + SYNTHETICSBROWSERTESTFAILURECODE_UNAVAILABLE_BROWSER SyntheticsBrowserTestFailureCode = "UNAVAILABLE_BROWSER" + SYNTHETICSBROWSERTESTFAILURECODE_UNKNOWN SyntheticsBrowserTestFailureCode = "UNKNOWN" + SYNTHETICSBROWSERTESTFAILURECODE_UNSUPPORTED_AUTH_SCHEMA SyntheticsBrowserTestFailureCode = "UNSUPPORTED_AUTH_SCHEMA" + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_ELEMENT_TYPE SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_ELEMENT_TYPE" + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DIALOG SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_DIALOG" + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DYNAMIC_ELEMENT SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_DYNAMIC_ELEMENT" + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_NAME SyntheticsBrowserTestFailureCode = "UPLOAD_FILES_NAME" +) + +var allowedSyntheticsBrowserTestFailureCodeEnumValues = []SyntheticsBrowserTestFailureCode{ + SYNTHETICSBROWSERTESTFAILURECODE_API_REQUEST_FAILURE, + SYNTHETICSBROWSERTESTFAILURECODE_ASSERTION_FAILURE, + SYNTHETICSBROWSERTESTFAILURECODE_DOWNLOAD_FILE_TOO_LARGE, + SYNTHETICSBROWSERTESTFAILURECODE_ELEMENT_NOT_INTERACTABLE, + SYNTHETICSBROWSERTESTFAILURECODE_EMAIL_VARIABLE_NOT_DEFINED, + SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT, + SYNTHETICSBROWSERTESTFAILURECODE_EVALUATE_JAVASCRIPT_CONTEXT, + SYNTHETICSBROWSERTESTFAILURECODE_EXTRACT_VARIABLE, + SYNTHETICSBROWSERTESTFAILURECODE_FORBIDDEN_URL, + SYNTHETICSBROWSERTESTFAILURECODE_FRAME_DETACHED, + SYNTHETICSBROWSERTESTFAILURECODE_INCONSISTENCIES, + SYNTHETICSBROWSERTESTFAILURECODE_INTERNAL_ERROR, + SYNTHETICSBROWSERTESTFAILURECODE_INVALID_TYPE_TEXT_DELAY, + SYNTHETICSBROWSERTESTFAILURECODE_INVALID_URL, + SYNTHETICSBROWSERTESTFAILURECODE_INVALID_VARIABLE_PATTERN, + SYNTHETICSBROWSERTESTFAILURECODE_INVISIBLE_ELEMENT, + SYNTHETICSBROWSERTESTFAILURECODE_LOCATE_ELEMENT, + SYNTHETICSBROWSERTESTFAILURECODE_NAVIGATE_TO_LINK, + SYNTHETICSBROWSERTESTFAILURECODE_OPEN_URL, + SYNTHETICSBROWSERTESTFAILURECODE_PRESS_KEY, + SYNTHETICSBROWSERTESTFAILURECODE_SERVER_CERTIFICATE, + SYNTHETICSBROWSERTESTFAILURECODE_SELECT_OPTION, + SYNTHETICSBROWSERTESTFAILURECODE_STEP_TIMEOUT, + SYNTHETICSBROWSERTESTFAILURECODE_SUB_TEST_NOT_PASSED, + SYNTHETICSBROWSERTESTFAILURECODE_TEST_TIMEOUT, + SYNTHETICSBROWSERTESTFAILURECODE_TOO_MANY_HTTP_REQUESTS, + SYNTHETICSBROWSERTESTFAILURECODE_UNAVAILABLE_BROWSER, + SYNTHETICSBROWSERTESTFAILURECODE_UNKNOWN, + SYNTHETICSBROWSERTESTFAILURECODE_UNSUPPORTED_AUTH_SCHEMA, + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_ELEMENT_TYPE, + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DIALOG, + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_DYNAMIC_ELEMENT, + SYNTHETICSBROWSERTESTFAILURECODE_UPLOAD_FILES_NAME, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBrowserTestFailureCode) GetAllowedValues() []SyntheticsBrowserTestFailureCode { + return allowedSyntheticsBrowserTestFailureCodeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBrowserTestFailureCode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBrowserTestFailureCode(value) + return nil +} + +// NewSyntheticsBrowserTestFailureCodeFromValue returns a pointer to a valid SyntheticsBrowserTestFailureCode +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBrowserTestFailureCodeFromValue(v string) (*SyntheticsBrowserTestFailureCode, error) { + ev := SyntheticsBrowserTestFailureCode(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserTestFailureCode: valid values are %v", v, allowedSyntheticsBrowserTestFailureCodeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBrowserTestFailureCode) IsValid() bool { + for _, existing := range allowedSyntheticsBrowserTestFailureCodeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBrowserTestFailureCode value. +func (v SyntheticsBrowserTestFailureCode) Ptr() *SyntheticsBrowserTestFailureCode { + return &v +} + +// NullableSyntheticsBrowserTestFailureCode handles when a null is used for SyntheticsBrowserTestFailureCode. +type NullableSyntheticsBrowserTestFailureCode struct { + value *SyntheticsBrowserTestFailureCode + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBrowserTestFailureCode) Get() *SyntheticsBrowserTestFailureCode { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBrowserTestFailureCode) Set(val *SyntheticsBrowserTestFailureCode) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBrowserTestFailureCode) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBrowserTestFailureCode) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBrowserTestFailureCode initializes the struct as if Set has been called. +func NewNullableSyntheticsBrowserTestFailureCode(val *SyntheticsBrowserTestFailureCode) *NullableSyntheticsBrowserTestFailureCode { + return &NullableSyntheticsBrowserTestFailureCode{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBrowserTestFailureCode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBrowserTestFailureCode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_data.go b/api/v1/datadog/model_synthetics_browser_test_result_data.go new file mode 100644 index 00000000000..7df59a48de3 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_result_data.go @@ -0,0 +1,546 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBrowserTestResultData Object containing results for your Synthetic browser test. +type SyntheticsBrowserTestResultData struct { + // Type of browser device used for the browser test. + BrowserType *string `json:"browserType,omitempty"` + // Browser version used for the browser test. + BrowserVersion *string `json:"browserVersion,omitempty"` + // Object describing the device used to perform the Synthetic test. + Device *SyntheticsDevice `json:"device,omitempty"` + // Global duration in second of the browser test. + Duration *float64 `json:"duration,omitempty"` + // Error returned for the browser test. + Error *string `json:"error,omitempty"` + // The browser test failure details. + Failure *SyntheticsBrowserTestResultFailure `json:"failure,omitempty"` + // Whether or not the browser test was conducted. + Passed *bool `json:"passed,omitempty"` + // The amount of email received during the browser test. + ReceivedEmailCount *int64 `json:"receivedEmailCount,omitempty"` + // Starting URL for the browser test. + StartUrl *string `json:"startUrl,omitempty"` + // Array containing the different browser test steps. + StepDetails []SyntheticsStepDetail `json:"stepDetails,omitempty"` + // Whether or not a thumbnail is associated with the browser test. + ThumbnailsBucketKey *bool `json:"thumbnailsBucketKey,omitempty"` + // Time in second to wait before the browser test starts after + // reaching the start URL. + TimeToInteractive *float64 `json:"timeToInteractive,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{} +} + +// NewSyntheticsBrowserTestResultData instantiates a new SyntheticsBrowserTestResultData 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 NewSyntheticsBrowserTestResultData() *SyntheticsBrowserTestResultData { + this := SyntheticsBrowserTestResultData{} + return &this +} + +// NewSyntheticsBrowserTestResultDataWithDefaults instantiates a new SyntheticsBrowserTestResultData 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 NewSyntheticsBrowserTestResultDataWithDefaults() *SyntheticsBrowserTestResultData { + this := SyntheticsBrowserTestResultData{} + return &this +} + +// GetBrowserType returns the BrowserType field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetBrowserType() string { + if o == nil || o.BrowserType == nil { + var ret string + return ret + } + return *o.BrowserType +} + +// GetBrowserTypeOk returns a tuple with the BrowserType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetBrowserTypeOk() (*string, bool) { + if o == nil || o.BrowserType == nil { + return nil, false + } + return o.BrowserType, true +} + +// HasBrowserType returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasBrowserType() bool { + if o != nil && o.BrowserType != nil { + return true + } + + return false +} + +// SetBrowserType gets a reference to the given string and assigns it to the BrowserType field. +func (o *SyntheticsBrowserTestResultData) SetBrowserType(v string) { + o.BrowserType = &v +} + +// GetBrowserVersion returns the BrowserVersion field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetBrowserVersion() string { + if o == nil || o.BrowserVersion == nil { + var ret string + return ret + } + return *o.BrowserVersion +} + +// GetBrowserVersionOk returns a tuple with the BrowserVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetBrowserVersionOk() (*string, bool) { + if o == nil || o.BrowserVersion == nil { + return nil, false + } + return o.BrowserVersion, true +} + +// HasBrowserVersion returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasBrowserVersion() bool { + if o != nil && o.BrowserVersion != nil { + return true + } + + return false +} + +// SetBrowserVersion gets a reference to the given string and assigns it to the BrowserVersion field. +func (o *SyntheticsBrowserTestResultData) SetBrowserVersion(v string) { + o.BrowserVersion = &v +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetDevice() SyntheticsDevice { + if o == nil || o.Device == nil { + var ret SyntheticsDevice + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetDeviceOk() (*SyntheticsDevice, bool) { + if o == nil || o.Device == nil { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasDevice() bool { + if o != nil && o.Device != nil { + return true + } + + return false +} + +// SetDevice gets a reference to the given SyntheticsDevice and assigns it to the Device field. +func (o *SyntheticsBrowserTestResultData) SetDevice(v SyntheticsDevice) { + o.Device = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetDuration() float64 { + if o == nil || o.Duration == nil { + var ret float64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetDurationOk() (*float64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasDuration() bool { + if o != nil && o.Duration != nil { + return true + } + + return false +} + +// SetDuration gets a reference to the given float64 and assigns it to the Duration field. +func (o *SyntheticsBrowserTestResultData) SetDuration(v float64) { + o.Duration = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetError() string { + if o == nil || o.Error == nil { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetErrorOk() (*string, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *SyntheticsBrowserTestResultData) SetError(v string) { + o.Error = &v +} + +// GetFailure returns the Failure field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetFailure() SyntheticsBrowserTestResultFailure { + if o == nil || o.Failure == nil { + var ret SyntheticsBrowserTestResultFailure + return ret + } + return *o.Failure +} + +// GetFailureOk returns a tuple with the Failure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetFailureOk() (*SyntheticsBrowserTestResultFailure, bool) { + if o == nil || o.Failure == nil { + return nil, false + } + return o.Failure, true +} + +// HasFailure returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasFailure() bool { + if o != nil && o.Failure != nil { + return true + } + + return false +} + +// SetFailure gets a reference to the given SyntheticsBrowserTestResultFailure and assigns it to the Failure field. +func (o *SyntheticsBrowserTestResultData) SetFailure(v SyntheticsBrowserTestResultFailure) { + o.Failure = &v +} + +// GetPassed returns the Passed field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetPassed() bool { + if o == nil || o.Passed == nil { + var ret bool + return ret + } + return *o.Passed +} + +// GetPassedOk returns a tuple with the Passed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetPassedOk() (*bool, bool) { + if o == nil || o.Passed == nil { + return nil, false + } + return o.Passed, true +} + +// HasPassed returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasPassed() bool { + if o != nil && o.Passed != nil { + return true + } + + return false +} + +// SetPassed gets a reference to the given bool and assigns it to the Passed field. +func (o *SyntheticsBrowserTestResultData) SetPassed(v bool) { + o.Passed = &v +} + +// GetReceivedEmailCount returns the ReceivedEmailCount field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetReceivedEmailCount() int64 { + if o == nil || o.ReceivedEmailCount == nil { + var ret int64 + return ret + } + return *o.ReceivedEmailCount +} + +// GetReceivedEmailCountOk returns a tuple with the ReceivedEmailCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetReceivedEmailCountOk() (*int64, bool) { + if o == nil || o.ReceivedEmailCount == nil { + return nil, false + } + return o.ReceivedEmailCount, true +} + +// HasReceivedEmailCount returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasReceivedEmailCount() bool { + if o != nil && o.ReceivedEmailCount != nil { + return true + } + + return false +} + +// SetReceivedEmailCount gets a reference to the given int64 and assigns it to the ReceivedEmailCount field. +func (o *SyntheticsBrowserTestResultData) SetReceivedEmailCount(v int64) { + o.ReceivedEmailCount = &v +} + +// GetStartUrl returns the StartUrl field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetStartUrl() string { + if o == nil || o.StartUrl == nil { + var ret string + return ret + } + return *o.StartUrl +} + +// GetStartUrlOk returns a tuple with the StartUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetStartUrlOk() (*string, bool) { + if o == nil || o.StartUrl == nil { + return nil, false + } + return o.StartUrl, true +} + +// HasStartUrl returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasStartUrl() bool { + if o != nil && o.StartUrl != nil { + return true + } + + return false +} + +// SetStartUrl gets a reference to the given string and assigns it to the StartUrl field. +func (o *SyntheticsBrowserTestResultData) SetStartUrl(v string) { + o.StartUrl = &v +} + +// GetStepDetails returns the StepDetails field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetStepDetails() []SyntheticsStepDetail { + if o == nil || o.StepDetails == nil { + var ret []SyntheticsStepDetail + return ret + } + return o.StepDetails +} + +// GetStepDetailsOk returns a tuple with the StepDetails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetStepDetailsOk() (*[]SyntheticsStepDetail, bool) { + if o == nil || o.StepDetails == nil { + return nil, false + } + return &o.StepDetails, true +} + +// HasStepDetails returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasStepDetails() bool { + if o != nil && o.StepDetails != nil { + return true + } + + return false +} + +// SetStepDetails gets a reference to the given []SyntheticsStepDetail and assigns it to the StepDetails field. +func (o *SyntheticsBrowserTestResultData) SetStepDetails(v []SyntheticsStepDetail) { + o.StepDetails = v +} + +// GetThumbnailsBucketKey returns the ThumbnailsBucketKey field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetThumbnailsBucketKey() bool { + if o == nil || o.ThumbnailsBucketKey == nil { + var ret bool + return ret + } + return *o.ThumbnailsBucketKey +} + +// GetThumbnailsBucketKeyOk returns a tuple with the ThumbnailsBucketKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetThumbnailsBucketKeyOk() (*bool, bool) { + if o == nil || o.ThumbnailsBucketKey == nil { + return nil, false + } + return o.ThumbnailsBucketKey, true +} + +// HasThumbnailsBucketKey returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasThumbnailsBucketKey() bool { + if o != nil && o.ThumbnailsBucketKey != nil { + return true + } + + return false +} + +// SetThumbnailsBucketKey gets a reference to the given bool and assigns it to the ThumbnailsBucketKey field. +func (o *SyntheticsBrowserTestResultData) SetThumbnailsBucketKey(v bool) { + o.ThumbnailsBucketKey = &v +} + +// GetTimeToInteractive returns the TimeToInteractive field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultData) GetTimeToInteractive() float64 { + if o == nil || o.TimeToInteractive == nil { + var ret float64 + return ret + } + return *o.TimeToInteractive +} + +// GetTimeToInteractiveOk returns a tuple with the TimeToInteractive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultData) GetTimeToInteractiveOk() (*float64, bool) { + if o == nil || o.TimeToInteractive == nil { + return nil, false + } + return o.TimeToInteractive, true +} + +// HasTimeToInteractive returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultData) HasTimeToInteractive() bool { + if o != nil && o.TimeToInteractive != nil { + return true + } + + return false +} + +// SetTimeToInteractive gets a reference to the given float64 and assigns it to the TimeToInteractive field. +func (o *SyntheticsBrowserTestResultData) SetTimeToInteractive(v float64) { + o.TimeToInteractive = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestResultData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BrowserType != nil { + toSerialize["browserType"] = o.BrowserType + } + if o.BrowserVersion != nil { + toSerialize["browserVersion"] = o.BrowserVersion + } + if o.Device != nil { + toSerialize["device"] = o.Device + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + if o.Failure != nil { + toSerialize["failure"] = o.Failure + } + if o.Passed != nil { + toSerialize["passed"] = o.Passed + } + if o.ReceivedEmailCount != nil { + toSerialize["receivedEmailCount"] = o.ReceivedEmailCount + } + if o.StartUrl != nil { + toSerialize["startUrl"] = o.StartUrl + } + if o.StepDetails != nil { + toSerialize["stepDetails"] = o.StepDetails + } + if o.ThumbnailsBucketKey != nil { + toSerialize["thumbnailsBucketKey"] = o.ThumbnailsBucketKey + } + if o.TimeToInteractive != nil { + toSerialize["timeToInteractive"] = o.TimeToInteractive + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestResultData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BrowserType *string `json:"browserType,omitempty"` + BrowserVersion *string `json:"browserVersion,omitempty"` + Device *SyntheticsDevice `json:"device,omitempty"` + Duration *float64 `json:"duration,omitempty"` + Error *string `json:"error,omitempty"` + Failure *SyntheticsBrowserTestResultFailure `json:"failure,omitempty"` + Passed *bool `json:"passed,omitempty"` + ReceivedEmailCount *int64 `json:"receivedEmailCount,omitempty"` + StartUrl *string `json:"startUrl,omitempty"` + StepDetails []SyntheticsStepDetail `json:"stepDetails,omitempty"` + ThumbnailsBucketKey *bool `json:"thumbnailsBucketKey,omitempty"` + TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BrowserType = all.BrowserType + o.BrowserVersion = all.BrowserVersion + if all.Device != nil && all.Device.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Device = all.Device + o.Duration = all.Duration + o.Error = all.Error + if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Failure = all.Failure + o.Passed = all.Passed + o.ReceivedEmailCount = all.ReceivedEmailCount + o.StartUrl = all.StartUrl + o.StepDetails = all.StepDetails + o.ThumbnailsBucketKey = all.ThumbnailsBucketKey + o.TimeToInteractive = all.TimeToInteractive + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_failure.go b/api/v1/datadog/model_synthetics_browser_test_result_failure.go new file mode 100644 index 00000000000..de81093deae --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_result_failure.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBrowserTestResultFailure The browser test failure details. +type SyntheticsBrowserTestResultFailure struct { + // Error code that can be returned by a Synthetic test. + Code *SyntheticsBrowserTestFailureCode `json:"code,omitempty"` + // The browser test error message. + Message *string `json:"message,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{} +} + +// NewSyntheticsBrowserTestResultFailure instantiates a new SyntheticsBrowserTestResultFailure 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 NewSyntheticsBrowserTestResultFailure() *SyntheticsBrowserTestResultFailure { + this := SyntheticsBrowserTestResultFailure{} + return &this +} + +// NewSyntheticsBrowserTestResultFailureWithDefaults instantiates a new SyntheticsBrowserTestResultFailure 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 NewSyntheticsBrowserTestResultFailureWithDefaults() *SyntheticsBrowserTestResultFailure { + this := SyntheticsBrowserTestResultFailure{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFailure) GetCode() SyntheticsBrowserTestFailureCode { + if o == nil || o.Code == nil { + var ret SyntheticsBrowserTestFailureCode + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFailure) GetCodeOk() (*SyntheticsBrowserTestFailureCode, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFailure) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given SyntheticsBrowserTestFailureCode and assigns it to the Code field. +func (o *SyntheticsBrowserTestResultFailure) SetCode(v SyntheticsBrowserTestFailureCode) { + o.Code = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFailure) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFailure) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFailure) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SyntheticsBrowserTestResultFailure) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestResultFailure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestResultFailure) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *SyntheticsBrowserTestFailureCode `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Code; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_full.go b/api/v1/datadog/model_synthetics_browser_test_result_full.go new file mode 100644 index 00000000000..94fe3ca74df --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_result_full.go @@ -0,0 +1,361 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBrowserTestResultFull Object returned describing a browser test result. +type SyntheticsBrowserTestResultFull struct { + // Object describing the browser test configuration. + Check *SyntheticsBrowserTestResultFullCheck `json:"check,omitempty"` + // When the browser test was conducted. + CheckTime *float64 `json:"check_time,omitempty"` + // Version of the browser test used. + CheckVersion *int64 `json:"check_version,omitempty"` + // Location from which the browser test was performed. + ProbeDc *string `json:"probe_dc,omitempty"` + // Object containing results for your Synthetic browser test. + Result *SyntheticsBrowserTestResultData `json:"result,omitempty"` + // ID of the browser test result. + ResultId *string `json:"result_id,omitempty"` + // The status of your Synthetic monitor. + // * `O` for not triggered + // * `1` for triggered + // * `2` for no data + Status *SyntheticsTestMonitorStatus `json:"status,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{} +} + +// NewSyntheticsBrowserTestResultFull instantiates a new SyntheticsBrowserTestResultFull 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 NewSyntheticsBrowserTestResultFull() *SyntheticsBrowserTestResultFull { + this := SyntheticsBrowserTestResultFull{} + return &this +} + +// NewSyntheticsBrowserTestResultFullWithDefaults instantiates a new SyntheticsBrowserTestResultFull 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 NewSyntheticsBrowserTestResultFullWithDefaults() *SyntheticsBrowserTestResultFull { + this := SyntheticsBrowserTestResultFull{} + return &this +} + +// GetCheck returns the Check field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFull) GetCheck() SyntheticsBrowserTestResultFullCheck { + if o == nil || o.Check == nil { + var ret SyntheticsBrowserTestResultFullCheck + return ret + } + return *o.Check +} + +// GetCheckOk returns a tuple with the Check field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFull) GetCheckOk() (*SyntheticsBrowserTestResultFullCheck, bool) { + if o == nil || o.Check == nil { + return nil, false + } + return o.Check, true +} + +// HasCheck returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFull) HasCheck() bool { + if o != nil && o.Check != nil { + return true + } + + return false +} + +// SetCheck gets a reference to the given SyntheticsBrowserTestResultFullCheck and assigns it to the Check field. +func (o *SyntheticsBrowserTestResultFull) SetCheck(v SyntheticsBrowserTestResultFullCheck) { + o.Check = &v +} + +// GetCheckTime returns the CheckTime field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFull) GetCheckTime() float64 { + if o == nil || o.CheckTime == nil { + var ret float64 + return ret + } + return *o.CheckTime +} + +// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFull) GetCheckTimeOk() (*float64, bool) { + if o == nil || o.CheckTime == nil { + return nil, false + } + return o.CheckTime, true +} + +// HasCheckTime returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFull) HasCheckTime() bool { + if o != nil && o.CheckTime != nil { + return true + } + + return false +} + +// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. +func (o *SyntheticsBrowserTestResultFull) SetCheckTime(v float64) { + o.CheckTime = &v +} + +// GetCheckVersion returns the CheckVersion field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFull) GetCheckVersion() int64 { + if o == nil || o.CheckVersion == nil { + var ret int64 + return ret + } + return *o.CheckVersion +} + +// GetCheckVersionOk returns a tuple with the CheckVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFull) GetCheckVersionOk() (*int64, bool) { + if o == nil || o.CheckVersion == nil { + return nil, false + } + return o.CheckVersion, true +} + +// HasCheckVersion returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFull) HasCheckVersion() bool { + if o != nil && o.CheckVersion != nil { + return true + } + + return false +} + +// SetCheckVersion gets a reference to the given int64 and assigns it to the CheckVersion field. +func (o *SyntheticsBrowserTestResultFull) SetCheckVersion(v int64) { + o.CheckVersion = &v +} + +// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFull) GetProbeDc() string { + if o == nil || o.ProbeDc == nil { + var ret string + return ret + } + return *o.ProbeDc +} + +// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFull) GetProbeDcOk() (*string, bool) { + if o == nil || o.ProbeDc == nil { + return nil, false + } + return o.ProbeDc, true +} + +// HasProbeDc returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFull) HasProbeDc() bool { + if o != nil && o.ProbeDc != nil { + return true + } + + return false +} + +// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. +func (o *SyntheticsBrowserTestResultFull) SetProbeDc(v string) { + o.ProbeDc = &v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFull) GetResult() SyntheticsBrowserTestResultData { + if o == nil || o.Result == nil { + var ret SyntheticsBrowserTestResultData + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFull) GetResultOk() (*SyntheticsBrowserTestResultData, bool) { + if o == nil || o.Result == nil { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFull) HasResult() bool { + if o != nil && o.Result != nil { + return true + } + + return false +} + +// SetResult gets a reference to the given SyntheticsBrowserTestResultData and assigns it to the Result field. +func (o *SyntheticsBrowserTestResultFull) SetResult(v SyntheticsBrowserTestResultData) { + o.Result = &v +} + +// GetResultId returns the ResultId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFull) GetResultId() string { + if o == nil || o.ResultId == nil { + var ret string + return ret + } + return *o.ResultId +} + +// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFull) GetResultIdOk() (*string, bool) { + if o == nil || o.ResultId == nil { + return nil, false + } + return o.ResultId, true +} + +// HasResultId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFull) HasResultId() bool { + if o != nil && o.ResultId != nil { + return true + } + + return false +} + +// SetResultId gets a reference to the given string and assigns it to the ResultId field. +func (o *SyntheticsBrowserTestResultFull) SetResultId(v string) { + o.ResultId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultFull) GetStatus() SyntheticsTestMonitorStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestMonitorStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFull) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultFull) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. +func (o *SyntheticsBrowserTestResultFull) SetStatus(v SyntheticsTestMonitorStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestResultFull) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Check != nil { + toSerialize["check"] = o.Check + } + if o.CheckTime != nil { + toSerialize["check_time"] = o.CheckTime + } + if o.CheckVersion != nil { + toSerialize["check_version"] = o.CheckVersion + } + if o.ProbeDc != nil { + toSerialize["probe_dc"] = o.ProbeDc + } + if o.Result != nil { + toSerialize["result"] = o.Result + } + if o.ResultId != nil { + toSerialize["result_id"] = o.ResultId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestResultFull) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Check *SyntheticsBrowserTestResultFullCheck `json:"check,omitempty"` + CheckTime *float64 `json:"check_time,omitempty"` + CheckVersion *int64 `json:"check_version,omitempty"` + ProbeDc *string `json:"probe_dc,omitempty"` + Result *SyntheticsBrowserTestResultData `json:"result,omitempty"` + ResultId *string `json:"result_id,omitempty"` + Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Check != nil && all.Check.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Check = all.Check + o.CheckTime = all.CheckTime + o.CheckVersion = all.CheckVersion + o.ProbeDc = all.ProbeDc + if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Result = all.Result + o.ResultId = all.ResultId + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_full_check.go b/api/v1/datadog/model_synthetics_browser_test_result_full_check.go new file mode 100644 index 00000000000..58dd163e7e0 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_result_full_check.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserTestResultFullCheck Object describing the browser test configuration. +type SyntheticsBrowserTestResultFullCheck struct { + // Configuration object for a Synthetic test. + Config SyntheticsTestConfig `json:"config"` + // 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{} +} + +// NewSyntheticsBrowserTestResultFullCheck instantiates a new SyntheticsBrowserTestResultFullCheck 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 NewSyntheticsBrowserTestResultFullCheck(config SyntheticsTestConfig) *SyntheticsBrowserTestResultFullCheck { + this := SyntheticsBrowserTestResultFullCheck{} + this.Config = config + return &this +} + +// NewSyntheticsBrowserTestResultFullCheckWithDefaults instantiates a new SyntheticsBrowserTestResultFullCheck 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 NewSyntheticsBrowserTestResultFullCheckWithDefaults() *SyntheticsBrowserTestResultFullCheck { + this := SyntheticsBrowserTestResultFullCheck{} + return &this +} + +// GetConfig returns the Config field value. +func (o *SyntheticsBrowserTestResultFullCheck) GetConfig() SyntheticsTestConfig { + if o == nil { + var ret SyntheticsTestConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultFullCheck) GetConfigOk() (*SyntheticsTestConfig, bool) { + if o == nil { + return nil, false + } + return &o.Config, true +} + +// SetConfig sets field value. +func (o *SyntheticsBrowserTestResultFullCheck) SetConfig(v SyntheticsTestConfig) { + o.Config = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestResultFullCheck) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["config"] = o.Config + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Config *SyntheticsTestConfig `json:"config"` + }{} + all := struct { + Config SyntheticsTestConfig `json:"config"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Config == nil { + return fmt.Errorf("Required field config missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Config.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Config = all.Config + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_short.go b/api/v1/datadog/model_synthetics_browser_test_result_short.go new file mode 100644 index 00000000000..156b12edd88 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_result_short.go @@ -0,0 +1,276 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBrowserTestResultShort Object with the results of a single Synthetic browser test. +type SyntheticsBrowserTestResultShort struct { + // Last time the browser test was performed. + CheckTime *float64 `json:"check_time,omitempty"` + // Location from which the Browser test was performed. + ProbeDc *string `json:"probe_dc,omitempty"` + // Object with the result of the last browser test run. + Result *SyntheticsBrowserTestResultShortResult `json:"result,omitempty"` + // ID of the browser test result. + ResultId *string `json:"result_id,omitempty"` + // The status of your Synthetic monitor. + // * `O` for not triggered + // * `1` for triggered + // * `2` for no data + Status *SyntheticsTestMonitorStatus `json:"status,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{} +} + +// NewSyntheticsBrowserTestResultShort instantiates a new SyntheticsBrowserTestResultShort 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 NewSyntheticsBrowserTestResultShort() *SyntheticsBrowserTestResultShort { + this := SyntheticsBrowserTestResultShort{} + return &this +} + +// NewSyntheticsBrowserTestResultShortWithDefaults instantiates a new SyntheticsBrowserTestResultShort 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 NewSyntheticsBrowserTestResultShortWithDefaults() *SyntheticsBrowserTestResultShort { + this := SyntheticsBrowserTestResultShort{} + return &this +} + +// GetCheckTime returns the CheckTime field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShort) GetCheckTime() float64 { + if o == nil || o.CheckTime == nil { + var ret float64 + return ret + } + return *o.CheckTime +} + +// GetCheckTimeOk returns a tuple with the CheckTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShort) GetCheckTimeOk() (*float64, bool) { + if o == nil || o.CheckTime == nil { + return nil, false + } + return o.CheckTime, true +} + +// HasCheckTime returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShort) HasCheckTime() bool { + if o != nil && o.CheckTime != nil { + return true + } + + return false +} + +// SetCheckTime gets a reference to the given float64 and assigns it to the CheckTime field. +func (o *SyntheticsBrowserTestResultShort) SetCheckTime(v float64) { + o.CheckTime = &v +} + +// GetProbeDc returns the ProbeDc field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShort) GetProbeDc() string { + if o == nil || o.ProbeDc == nil { + var ret string + return ret + } + return *o.ProbeDc +} + +// GetProbeDcOk returns a tuple with the ProbeDc field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShort) GetProbeDcOk() (*string, bool) { + if o == nil || o.ProbeDc == nil { + return nil, false + } + return o.ProbeDc, true +} + +// HasProbeDc returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShort) HasProbeDc() bool { + if o != nil && o.ProbeDc != nil { + return true + } + + return false +} + +// SetProbeDc gets a reference to the given string and assigns it to the ProbeDc field. +func (o *SyntheticsBrowserTestResultShort) SetProbeDc(v string) { + o.ProbeDc = &v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShort) GetResult() SyntheticsBrowserTestResultShortResult { + if o == nil || o.Result == nil { + var ret SyntheticsBrowserTestResultShortResult + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShort) GetResultOk() (*SyntheticsBrowserTestResultShortResult, bool) { + if o == nil || o.Result == nil { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShort) HasResult() bool { + if o != nil && o.Result != nil { + return true + } + + return false +} + +// SetResult gets a reference to the given SyntheticsBrowserTestResultShortResult and assigns it to the Result field. +func (o *SyntheticsBrowserTestResultShort) SetResult(v SyntheticsBrowserTestResultShortResult) { + o.Result = &v +} + +// GetResultId returns the ResultId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShort) GetResultId() string { + if o == nil || o.ResultId == nil { + var ret string + return ret + } + return *o.ResultId +} + +// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShort) GetResultIdOk() (*string, bool) { + if o == nil || o.ResultId == nil { + return nil, false + } + return o.ResultId, true +} + +// HasResultId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShort) HasResultId() bool { + if o != nil && o.ResultId != nil { + return true + } + + return false +} + +// SetResultId gets a reference to the given string and assigns it to the ResultId field. +func (o *SyntheticsBrowserTestResultShort) SetResultId(v string) { + o.ResultId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShort) GetStatus() SyntheticsTestMonitorStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestMonitorStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShort) GetStatusOk() (*SyntheticsTestMonitorStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShort) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestMonitorStatus and assigns it to the Status field. +func (o *SyntheticsBrowserTestResultShort) SetStatus(v SyntheticsTestMonitorStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestResultShort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CheckTime != nil { + toSerialize["check_time"] = o.CheckTime + } + if o.ProbeDc != nil { + toSerialize["probe_dc"] = o.ProbeDc + } + if o.Result != nil { + toSerialize["result"] = o.Result + } + if o.ResultId != nil { + toSerialize["result_id"] = o.ResultId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestResultShort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CheckTime *float64 `json:"check_time,omitempty"` + ProbeDc *string `json:"probe_dc,omitempty"` + Result *SyntheticsBrowserTestResultShortResult `json:"result,omitempty"` + ResultId *string `json:"result_id,omitempty"` + Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CheckTime = all.CheckTime + o.ProbeDc = all.ProbeDc + if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Result = all.Result + o.ResultId = all.ResultId + o.Status = all.Status + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_result_short_result.go b/api/v1/datadog/model_synthetics_browser_test_result_short_result.go new file mode 100644 index 00000000000..2312614f6a8 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_result_short_result.go @@ -0,0 +1,265 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsBrowserTestResultShortResult Object with the result of the last browser test run. +type SyntheticsBrowserTestResultShortResult struct { + // Object describing the device used to perform the Synthetic test. + Device *SyntheticsDevice `json:"device,omitempty"` + // Length in milliseconds of the browser test run. + Duration *float64 `json:"duration,omitempty"` + // Amount of errors collected for a single browser test run. + ErrorCount *int64 `json:"errorCount,omitempty"` + // Amount of browser test steps completed before failing. + StepCountCompleted *int64 `json:"stepCountCompleted,omitempty"` + // Total amount of browser test steps. + StepCountTotal *int64 `json:"stepCountTotal,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{} +} + +// NewSyntheticsBrowserTestResultShortResult instantiates a new SyntheticsBrowserTestResultShortResult 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 NewSyntheticsBrowserTestResultShortResult() *SyntheticsBrowserTestResultShortResult { + this := SyntheticsBrowserTestResultShortResult{} + return &this +} + +// NewSyntheticsBrowserTestResultShortResultWithDefaults instantiates a new SyntheticsBrowserTestResultShortResult 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 NewSyntheticsBrowserTestResultShortResultWithDefaults() *SyntheticsBrowserTestResultShortResult { + this := SyntheticsBrowserTestResultShortResult{} + return &this +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShortResult) GetDevice() SyntheticsDevice { + if o == nil || o.Device == nil { + var ret SyntheticsDevice + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShortResult) GetDeviceOk() (*SyntheticsDevice, bool) { + if o == nil || o.Device == nil { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShortResult) HasDevice() bool { + if o != nil && o.Device != nil { + return true + } + + return false +} + +// SetDevice gets a reference to the given SyntheticsDevice and assigns it to the Device field. +func (o *SyntheticsBrowserTestResultShortResult) SetDevice(v SyntheticsDevice) { + o.Device = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShortResult) GetDuration() float64 { + if o == nil || o.Duration == nil { + var ret float64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShortResult) GetDurationOk() (*float64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShortResult) HasDuration() bool { + if o != nil && o.Duration != nil { + return true + } + + return false +} + +// SetDuration gets a reference to the given float64 and assigns it to the Duration field. +func (o *SyntheticsBrowserTestResultShortResult) SetDuration(v float64) { + o.Duration = &v +} + +// GetErrorCount returns the ErrorCount field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShortResult) GetErrorCount() int64 { + if o == nil || o.ErrorCount == nil { + var ret int64 + return ret + } + return *o.ErrorCount +} + +// GetErrorCountOk returns a tuple with the ErrorCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShortResult) GetErrorCountOk() (*int64, bool) { + if o == nil || o.ErrorCount == nil { + return nil, false + } + return o.ErrorCount, true +} + +// HasErrorCount returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShortResult) HasErrorCount() bool { + if o != nil && o.ErrorCount != nil { + return true + } + + return false +} + +// SetErrorCount gets a reference to the given int64 and assigns it to the ErrorCount field. +func (o *SyntheticsBrowserTestResultShortResult) SetErrorCount(v int64) { + o.ErrorCount = &v +} + +// GetStepCountCompleted returns the StepCountCompleted field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShortResult) GetStepCountCompleted() int64 { + if o == nil || o.StepCountCompleted == nil { + var ret int64 + return ret + } + return *o.StepCountCompleted +} + +// GetStepCountCompletedOk returns a tuple with the StepCountCompleted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShortResult) GetStepCountCompletedOk() (*int64, bool) { + if o == nil || o.StepCountCompleted == nil { + return nil, false + } + return o.StepCountCompleted, true +} + +// HasStepCountCompleted returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShortResult) HasStepCountCompleted() bool { + if o != nil && o.StepCountCompleted != nil { + return true + } + + return false +} + +// SetStepCountCompleted gets a reference to the given int64 and assigns it to the StepCountCompleted field. +func (o *SyntheticsBrowserTestResultShortResult) SetStepCountCompleted(v int64) { + o.StepCountCompleted = &v +} + +// GetStepCountTotal returns the StepCountTotal field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestResultShortResult) GetStepCountTotal() int64 { + if o == nil || o.StepCountTotal == nil { + var ret int64 + return ret + } + return *o.StepCountTotal +} + +// GetStepCountTotalOk returns a tuple with the StepCountTotal field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestResultShortResult) GetStepCountTotalOk() (*int64, bool) { + if o == nil || o.StepCountTotal == nil { + return nil, false + } + return o.StepCountTotal, true +} + +// HasStepCountTotal returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestResultShortResult) HasStepCountTotal() bool { + if o != nil && o.StepCountTotal != nil { + return true + } + + return false +} + +// SetStepCountTotal gets a reference to the given int64 and assigns it to the StepCountTotal field. +func (o *SyntheticsBrowserTestResultShortResult) SetStepCountTotal(v int64) { + o.StepCountTotal = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestResultShortResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Device != nil { + toSerialize["device"] = o.Device + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.ErrorCount != nil { + toSerialize["errorCount"] = o.ErrorCount + } + if o.StepCountCompleted != nil { + toSerialize["stepCountCompleted"] = o.StepCountCompleted + } + if o.StepCountTotal != nil { + toSerialize["stepCountTotal"] = o.StepCountTotal + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestResultShortResult) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Device *SyntheticsDevice `json:"device,omitempty"` + Duration *float64 `json:"duration,omitempty"` + ErrorCount *int64 `json:"errorCount,omitempty"` + StepCountCompleted *int64 `json:"stepCountCompleted,omitempty"` + StepCountTotal *int64 `json:"stepCountTotal,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Device != nil && all.Device.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Device = all.Device + o.Duration = all.Duration + o.ErrorCount = all.ErrorCount + o.StepCountCompleted = all.StepCountCompleted + o.StepCountTotal = all.StepCountTotal + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_rum_settings.go b/api/v1/datadog/model_synthetics_browser_test_rum_settings.go new file mode 100644 index 00000000000..356a5890d1a --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_rum_settings.go @@ -0,0 +1,191 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserTestRumSettings The RUM data collection settings for the Synthetic browser test. +// **Note:** There are 3 ways to format RUM settings: +// +// `{ isEnabled: false }` +// RUM data is not collected. +// +// `{ isEnabled: true }` +// RUM data is collected from the Synthetic test's default application. +// +// `{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 }` +// RUM data is collected using the specified application. +type SyntheticsBrowserTestRumSettings struct { + // RUM application ID used to collect RUM data for the browser test. + ApplicationId *string `json:"applicationId,omitempty"` + // RUM application API key ID used to collect RUM data for the browser test. + ClientTokenId *int64 `json:"clientTokenId,omitempty"` + // Determines whether RUM data is collected during test runs. + IsEnabled bool `json:"isEnabled"` + // 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{} +} + +// NewSyntheticsBrowserTestRumSettings instantiates a new SyntheticsBrowserTestRumSettings 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 NewSyntheticsBrowserTestRumSettings(isEnabled bool) *SyntheticsBrowserTestRumSettings { + this := SyntheticsBrowserTestRumSettings{} + this.IsEnabled = isEnabled + return &this +} + +// NewSyntheticsBrowserTestRumSettingsWithDefaults instantiates a new SyntheticsBrowserTestRumSettings 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 NewSyntheticsBrowserTestRumSettingsWithDefaults() *SyntheticsBrowserTestRumSettings { + this := SyntheticsBrowserTestRumSettings{} + return &this +} + +// GetApplicationId returns the ApplicationId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestRumSettings) GetApplicationId() string { + if o == nil || o.ApplicationId == nil { + var ret string + return ret + } + return *o.ApplicationId +} + +// GetApplicationIdOk returns a tuple with the ApplicationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestRumSettings) GetApplicationIdOk() (*string, bool) { + if o == nil || o.ApplicationId == nil { + return nil, false + } + return o.ApplicationId, true +} + +// HasApplicationId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestRumSettings) HasApplicationId() bool { + if o != nil && o.ApplicationId != nil { + return true + } + + return false +} + +// SetApplicationId gets a reference to the given string and assigns it to the ApplicationId field. +func (o *SyntheticsBrowserTestRumSettings) SetApplicationId(v string) { + o.ApplicationId = &v +} + +// GetClientTokenId returns the ClientTokenId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestRumSettings) GetClientTokenId() int64 { + if o == nil || o.ClientTokenId == nil { + var ret int64 + return ret + } + return *o.ClientTokenId +} + +// GetClientTokenIdOk returns a tuple with the ClientTokenId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestRumSettings) GetClientTokenIdOk() (*int64, bool) { + if o == nil || o.ClientTokenId == nil { + return nil, false + } + return o.ClientTokenId, true +} + +// HasClientTokenId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestRumSettings) HasClientTokenId() bool { + if o != nil && o.ClientTokenId != nil { + return true + } + + return false +} + +// SetClientTokenId gets a reference to the given int64 and assigns it to the ClientTokenId field. +func (o *SyntheticsBrowserTestRumSettings) SetClientTokenId(v int64) { + o.ClientTokenId = &v +} + +// GetIsEnabled returns the IsEnabled field value. +func (o *SyntheticsBrowserTestRumSettings) GetIsEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestRumSettings) GetIsEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsEnabled, true +} + +// SetIsEnabled sets field value. +func (o *SyntheticsBrowserTestRumSettings) SetIsEnabled(v bool) { + o.IsEnabled = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserTestRumSettings) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApplicationId != nil { + toSerialize["applicationId"] = o.ApplicationId + } + if o.ClientTokenId != nil { + toSerialize["clientTokenId"] = o.ClientTokenId + } + toSerialize["isEnabled"] = o.IsEnabled + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserTestRumSettings) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + IsEnabled *bool `json:"isEnabled"` + }{} + all := struct { + ApplicationId *string `json:"applicationId,omitempty"` + ClientTokenId *int64 `json:"clientTokenId,omitempty"` + IsEnabled bool `json:"isEnabled"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.IsEnabled == nil { + return fmt.Errorf("Required field isEnabled missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ApplicationId = all.ApplicationId + o.ClientTokenId = all.ClientTokenId + o.IsEnabled = all.IsEnabled + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_test_type.go b/api/v1/datadog/model_synthetics_browser_test_type.go new file mode 100644 index 00000000000..4db9b7e1eec --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserTestType Type of the Synthetic test, `browser`. +type SyntheticsBrowserTestType string + +// List of SyntheticsBrowserTestType. +const ( + SYNTHETICSBROWSERTESTTYPE_BROWSER SyntheticsBrowserTestType = "browser" +) + +var allowedSyntheticsBrowserTestTypeEnumValues = []SyntheticsBrowserTestType{ + SYNTHETICSBROWSERTESTTYPE_BROWSER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBrowserTestType) GetAllowedValues() []SyntheticsBrowserTestType { + return allowedSyntheticsBrowserTestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBrowserTestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBrowserTestType(value) + return nil +} + +// NewSyntheticsBrowserTestTypeFromValue returns a pointer to a valid SyntheticsBrowserTestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBrowserTestTypeFromValue(v string) (*SyntheticsBrowserTestType, error) { + ev := SyntheticsBrowserTestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserTestType: valid values are %v", v, allowedSyntheticsBrowserTestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBrowserTestType) IsValid() bool { + for _, existing := range allowedSyntheticsBrowserTestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBrowserTestType value. +func (v SyntheticsBrowserTestType) Ptr() *SyntheticsBrowserTestType { + return &v +} + +// NullableSyntheticsBrowserTestType handles when a null is used for SyntheticsBrowserTestType. +type NullableSyntheticsBrowserTestType struct { + value *SyntheticsBrowserTestType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBrowserTestType) Get() *SyntheticsBrowserTestType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBrowserTestType) Set(val *SyntheticsBrowserTestType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBrowserTestType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBrowserTestType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBrowserTestType initializes the struct as if Set has been called. +func NewNullableSyntheticsBrowserTestType(val *SyntheticsBrowserTestType) *NullableSyntheticsBrowserTestType { + return &NullableSyntheticsBrowserTestType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBrowserTestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBrowserTestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_browser_variable.go b/api/v1/datadog/model_synthetics_browser_variable.go new file mode 100644 index 00000000000..d836ba9c039 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_variable.go @@ -0,0 +1,262 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserVariable Object defining a variable that can be used in your browser test. +// Learn more in the [Browser test Actions documentation](https://docs.datadoghq.com/synthetics/browser_tests/actions#variable). +type SyntheticsBrowserVariable struct { + // Example for the variable. + Example *string `json:"example,omitempty"` + // ID for the variable. Global variables require an ID. + Id *string `json:"id,omitempty"` + // Name of the variable. + Name string `json:"name"` + // Pattern of the variable. + Pattern *string `json:"pattern,omitempty"` + // Type of browser test variable. + Type SyntheticsBrowserVariableType `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{} +} + +// NewSyntheticsBrowserVariable instantiates a new SyntheticsBrowserVariable 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 NewSyntheticsBrowserVariable(name string, typeVar SyntheticsBrowserVariableType) *SyntheticsBrowserVariable { + this := SyntheticsBrowserVariable{} + this.Name = name + this.Type = typeVar + return &this +} + +// NewSyntheticsBrowserVariableWithDefaults instantiates a new SyntheticsBrowserVariable 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 NewSyntheticsBrowserVariableWithDefaults() *SyntheticsBrowserVariable { + this := SyntheticsBrowserVariable{} + return &this +} + +// GetExample returns the Example field value if set, zero value otherwise. +func (o *SyntheticsBrowserVariable) GetExample() string { + if o == nil || o.Example == nil { + var ret string + return ret + } + return *o.Example +} + +// GetExampleOk returns a tuple with the Example field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserVariable) GetExampleOk() (*string, bool) { + if o == nil || o.Example == nil { + return nil, false + } + return o.Example, true +} + +// HasExample returns a boolean if a field has been set. +func (o *SyntheticsBrowserVariable) HasExample() bool { + if o != nil && o.Example != nil { + return true + } + + return false +} + +// SetExample gets a reference to the given string and assigns it to the Example field. +func (o *SyntheticsBrowserVariable) SetExample(v string) { + o.Example = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsBrowserVariable) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserVariable) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsBrowserVariable) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SyntheticsBrowserVariable) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsBrowserVariable) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserVariable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsBrowserVariable) SetName(v string) { + o.Name = v +} + +// GetPattern returns the Pattern field value if set, zero value otherwise. +func (o *SyntheticsBrowserVariable) GetPattern() string { + if o == nil || o.Pattern == nil { + var ret string + return ret + } + return *o.Pattern +} + +// GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserVariable) GetPatternOk() (*string, bool) { + if o == nil || o.Pattern == nil { + return nil, false + } + return o.Pattern, true +} + +// HasPattern returns a boolean if a field has been set. +func (o *SyntheticsBrowserVariable) HasPattern() bool { + if o != nil && o.Pattern != nil { + return true + } + + return false +} + +// SetPattern gets a reference to the given string and assigns it to the Pattern field. +func (o *SyntheticsBrowserVariable) SetPattern(v string) { + o.Pattern = &v +} + +// GetType returns the Type field value. +func (o *SyntheticsBrowserVariable) GetType() SyntheticsBrowserVariableType { + if o == nil { + var ret SyntheticsBrowserVariableType + 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 *SyntheticsBrowserVariable) GetTypeOk() (*SyntheticsBrowserVariableType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsBrowserVariable) SetType(v SyntheticsBrowserVariableType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBrowserVariable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Example != nil { + toSerialize["example"] = o.Example + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["name"] = o.Name + if o.Pattern != nil { + toSerialize["pattern"] = o.Pattern + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Type *SyntheticsBrowserVariableType `json:"type"` + }{} + all := struct { + Example *string `json:"example,omitempty"` + Id *string `json:"id,omitempty"` + Name string `json:"name"` + Pattern *string `json:"pattern,omitempty"` + Type SyntheticsBrowserVariableType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Example = all.Example + o.Id = all.Id + o.Name = all.Name + o.Pattern = all.Pattern + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_browser_variable_type.go b/api/v1/datadog/model_synthetics_browser_variable_type.go new file mode 100644 index 00000000000..c59c03c0bfe --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_variable_type.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserVariableType Type of browser test variable. +type SyntheticsBrowserVariableType string + +// List of SyntheticsBrowserVariableType. +const ( + SYNTHETICSBROWSERVARIABLETYPE_ELEMENT SyntheticsBrowserVariableType = "element" + SYNTHETICSBROWSERVARIABLETYPE_EMAIL SyntheticsBrowserVariableType = "email" + SYNTHETICSBROWSERVARIABLETYPE_GLOBAL SyntheticsBrowserVariableType = "global" + SYNTHETICSBROWSERVARIABLETYPE_JAVASCRIPT SyntheticsBrowserVariableType = "javascript" + SYNTHETICSBROWSERVARIABLETYPE_TEXT SyntheticsBrowserVariableType = "text" +) + +var allowedSyntheticsBrowserVariableTypeEnumValues = []SyntheticsBrowserVariableType{ + SYNTHETICSBROWSERVARIABLETYPE_ELEMENT, + SYNTHETICSBROWSERVARIABLETYPE_EMAIL, + SYNTHETICSBROWSERVARIABLETYPE_GLOBAL, + SYNTHETICSBROWSERVARIABLETYPE_JAVASCRIPT, + SYNTHETICSBROWSERVARIABLETYPE_TEXT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBrowserVariableType) GetAllowedValues() []SyntheticsBrowserVariableType { + return allowedSyntheticsBrowserVariableTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBrowserVariableType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBrowserVariableType(value) + return nil +} + +// NewSyntheticsBrowserVariableTypeFromValue returns a pointer to a valid SyntheticsBrowserVariableType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBrowserVariableTypeFromValue(v string) (*SyntheticsBrowserVariableType, error) { + ev := SyntheticsBrowserVariableType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserVariableType: valid values are %v", v, allowedSyntheticsBrowserVariableTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBrowserVariableType) IsValid() bool { + for _, existing := range allowedSyntheticsBrowserVariableTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBrowserVariableType value. +func (v SyntheticsBrowserVariableType) Ptr() *SyntheticsBrowserVariableType { + return &v +} + +// NullableSyntheticsBrowserVariableType handles when a null is used for SyntheticsBrowserVariableType. +type NullableSyntheticsBrowserVariableType struct { + value *SyntheticsBrowserVariableType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBrowserVariableType) Get() *SyntheticsBrowserVariableType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBrowserVariableType) Set(val *SyntheticsBrowserVariableType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBrowserVariableType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBrowserVariableType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBrowserVariableType initializes the struct as if Set has been called. +func NewNullableSyntheticsBrowserVariableType(val *SyntheticsBrowserVariableType) *NullableSyntheticsBrowserVariableType { + return &NullableSyntheticsBrowserVariableType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBrowserVariableType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBrowserVariableType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_check_type.go b/api/v1/datadog/model_synthetics_check_type.go new file mode 100644 index 00000000000..109a18c7788 --- /dev/null +++ b/api/v1/datadog/model_synthetics_check_type.go @@ -0,0 +1,133 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsCheckType Type of assertion to apply in an API test. +type SyntheticsCheckType string + +// List of SyntheticsCheckType. +const ( + SYNTHETICSCHECKTYPE_EQUALS SyntheticsCheckType = "equals" + SYNTHETICSCHECKTYPE_NOT_EQUALS SyntheticsCheckType = "notEquals" + SYNTHETICSCHECKTYPE_CONTAINS SyntheticsCheckType = "contains" + SYNTHETICSCHECKTYPE_NOT_CONTAINS SyntheticsCheckType = "notContains" + SYNTHETICSCHECKTYPE_STARTS_WITH SyntheticsCheckType = "startsWith" + SYNTHETICSCHECKTYPE_NOT_STARTS_WITH SyntheticsCheckType = "notStartsWith" + SYNTHETICSCHECKTYPE_GREATER SyntheticsCheckType = "greater" + SYNTHETICSCHECKTYPE_LOWER SyntheticsCheckType = "lower" + SYNTHETICSCHECKTYPE_GREATER_EQUALS SyntheticsCheckType = "greaterEquals" + SYNTHETICSCHECKTYPE_LOWER_EQUALS SyntheticsCheckType = "lowerEquals" + SYNTHETICSCHECKTYPE_MATCH_REGEX SyntheticsCheckType = "matchRegex" + SYNTHETICSCHECKTYPE_BETWEEN SyntheticsCheckType = "between" + SYNTHETICSCHECKTYPE_IS_EMPTY SyntheticsCheckType = "isEmpty" + SYNTHETICSCHECKTYPE_NOT_IS_EMPTY SyntheticsCheckType = "notIsEmpty" +) + +var allowedSyntheticsCheckTypeEnumValues = []SyntheticsCheckType{ + SYNTHETICSCHECKTYPE_EQUALS, + SYNTHETICSCHECKTYPE_NOT_EQUALS, + SYNTHETICSCHECKTYPE_CONTAINS, + SYNTHETICSCHECKTYPE_NOT_CONTAINS, + SYNTHETICSCHECKTYPE_STARTS_WITH, + SYNTHETICSCHECKTYPE_NOT_STARTS_WITH, + SYNTHETICSCHECKTYPE_GREATER, + SYNTHETICSCHECKTYPE_LOWER, + SYNTHETICSCHECKTYPE_GREATER_EQUALS, + SYNTHETICSCHECKTYPE_LOWER_EQUALS, + SYNTHETICSCHECKTYPE_MATCH_REGEX, + SYNTHETICSCHECKTYPE_BETWEEN, + SYNTHETICSCHECKTYPE_IS_EMPTY, + SYNTHETICSCHECKTYPE_NOT_IS_EMPTY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsCheckType) GetAllowedValues() []SyntheticsCheckType { + return allowedSyntheticsCheckTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsCheckType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsCheckType(value) + return nil +} + +// NewSyntheticsCheckTypeFromValue returns a pointer to a valid SyntheticsCheckType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsCheckTypeFromValue(v string) (*SyntheticsCheckType, error) { + ev := SyntheticsCheckType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsCheckType: valid values are %v", v, allowedSyntheticsCheckTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsCheckType) IsValid() bool { + for _, existing := range allowedSyntheticsCheckTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsCheckType value. +func (v SyntheticsCheckType) Ptr() *SyntheticsCheckType { + return &v +} + +// NullableSyntheticsCheckType handles when a null is used for SyntheticsCheckType. +type NullableSyntheticsCheckType struct { + value *SyntheticsCheckType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsCheckType) Get() *SyntheticsCheckType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsCheckType) Set(val *SyntheticsCheckType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsCheckType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsCheckType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsCheckType initializes the struct as if Set has been called. +func NewNullableSyntheticsCheckType(val *SyntheticsCheckType) *NullableSyntheticsCheckType { + return &NullableSyntheticsCheckType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsCheckType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsCheckType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata.go b/api/v1/datadog/model_synthetics_ci_batch_metadata.go new file mode 100644 index 00000000000..479e6b8d7b8 --- /dev/null +++ b/api/v1/datadog/model_synthetics_ci_batch_metadata.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsCIBatchMetadata Metadata for the Synthetics tests run. +type SyntheticsCIBatchMetadata struct { + // Description of the CI provider. + Ci *SyntheticsCIBatchMetadataCI `json:"ci,omitempty"` + // Git information. + Git *SyntheticsCIBatchMetadataGit `json:"git,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{} +} + +// NewSyntheticsCIBatchMetadata instantiates a new SyntheticsCIBatchMetadata 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 NewSyntheticsCIBatchMetadata() *SyntheticsCIBatchMetadata { + this := SyntheticsCIBatchMetadata{} + return &this +} + +// NewSyntheticsCIBatchMetadataWithDefaults instantiates a new SyntheticsCIBatchMetadata 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 NewSyntheticsCIBatchMetadataWithDefaults() *SyntheticsCIBatchMetadata { + this := SyntheticsCIBatchMetadata{} + return &this +} + +// GetCi returns the Ci field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadata) GetCi() SyntheticsCIBatchMetadataCI { + if o == nil || o.Ci == nil { + var ret SyntheticsCIBatchMetadataCI + return ret + } + return *o.Ci +} + +// GetCiOk returns a tuple with the Ci field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadata) GetCiOk() (*SyntheticsCIBatchMetadataCI, bool) { + if o == nil || o.Ci == nil { + return nil, false + } + return o.Ci, true +} + +// HasCi returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadata) HasCi() bool { + if o != nil && o.Ci != nil { + return true + } + + return false +} + +// SetCi gets a reference to the given SyntheticsCIBatchMetadataCI and assigns it to the Ci field. +func (o *SyntheticsCIBatchMetadata) SetCi(v SyntheticsCIBatchMetadataCI) { + o.Ci = &v +} + +// GetGit returns the Git field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadata) GetGit() SyntheticsCIBatchMetadataGit { + if o == nil || o.Git == nil { + var ret SyntheticsCIBatchMetadataGit + return ret + } + return *o.Git +} + +// GetGitOk returns a tuple with the Git field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadata) GetGitOk() (*SyntheticsCIBatchMetadataGit, bool) { + if o == nil || o.Git == nil { + return nil, false + } + return o.Git, true +} + +// HasGit returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadata) HasGit() bool { + if o != nil && o.Git != nil { + return true + } + + return false +} + +// SetGit gets a reference to the given SyntheticsCIBatchMetadataGit and assigns it to the Git field. +func (o *SyntheticsCIBatchMetadata) SetGit(v SyntheticsCIBatchMetadataGit) { + o.Git = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCIBatchMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Ci != nil { + toSerialize["ci"] = o.Ci + } + if o.Git != nil { + toSerialize["git"] = o.Git + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCIBatchMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Ci *SyntheticsCIBatchMetadataCI `json:"ci,omitempty"` + Git *SyntheticsCIBatchMetadataGit `json:"git,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Ci != nil && all.Ci.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Ci = all.Ci + if all.Git != nil && all.Git.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Git = all.Git + return nil +} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go new file mode 100644 index 00000000000..357ce0b2f1b --- /dev/null +++ b/api/v1/datadog/model_synthetics_ci_batch_metadata_ci.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsCIBatchMetadataCI Description of the CI provider. +type SyntheticsCIBatchMetadataCI struct { + // Description of the CI pipeline. + Pipeline *SyntheticsCIBatchMetadataPipeline `json:"pipeline,omitempty"` + // Description of the CI provider. + Provider *SyntheticsCIBatchMetadataProvider `json:"provider,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{} +} + +// NewSyntheticsCIBatchMetadataCI instantiates a new SyntheticsCIBatchMetadataCI 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 NewSyntheticsCIBatchMetadataCI() *SyntheticsCIBatchMetadataCI { + this := SyntheticsCIBatchMetadataCI{} + return &this +} + +// NewSyntheticsCIBatchMetadataCIWithDefaults instantiates a new SyntheticsCIBatchMetadataCI 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 NewSyntheticsCIBatchMetadataCIWithDefaults() *SyntheticsCIBatchMetadataCI { + this := SyntheticsCIBatchMetadataCI{} + return &this +} + +// GetPipeline returns the Pipeline field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadataCI) GetPipeline() SyntheticsCIBatchMetadataPipeline { + if o == nil || o.Pipeline == nil { + var ret SyntheticsCIBatchMetadataPipeline + return ret + } + return *o.Pipeline +} + +// GetPipelineOk returns a tuple with the Pipeline field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadataCI) GetPipelineOk() (*SyntheticsCIBatchMetadataPipeline, bool) { + if o == nil || o.Pipeline == nil { + return nil, false + } + return o.Pipeline, true +} + +// HasPipeline returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadataCI) HasPipeline() bool { + if o != nil && o.Pipeline != nil { + return true + } + + return false +} + +// SetPipeline gets a reference to the given SyntheticsCIBatchMetadataPipeline and assigns it to the Pipeline field. +func (o *SyntheticsCIBatchMetadataCI) SetPipeline(v SyntheticsCIBatchMetadataPipeline) { + o.Pipeline = &v +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadataCI) GetProvider() SyntheticsCIBatchMetadataProvider { + if o == nil || o.Provider == nil { + var ret SyntheticsCIBatchMetadataProvider + return ret + } + return *o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadataCI) GetProviderOk() (*SyntheticsCIBatchMetadataProvider, bool) { + if o == nil || o.Provider == nil { + return nil, false + } + return o.Provider, true +} + +// HasProvider returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadataCI) HasProvider() bool { + if o != nil && o.Provider != nil { + return true + } + + return false +} + +// SetProvider gets a reference to the given SyntheticsCIBatchMetadataProvider and assigns it to the Provider field. +func (o *SyntheticsCIBatchMetadataCI) SetProvider(v SyntheticsCIBatchMetadataProvider) { + o.Provider = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCIBatchMetadataCI) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Pipeline != nil { + toSerialize["pipeline"] = o.Pipeline + } + if o.Provider != nil { + toSerialize["provider"] = o.Provider + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCIBatchMetadataCI) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Pipeline *SyntheticsCIBatchMetadataPipeline `json:"pipeline,omitempty"` + Provider *SyntheticsCIBatchMetadataProvider `json:"provider,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Pipeline != nil && all.Pipeline.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pipeline = all.Pipeline + if all.Provider != nil && all.Provider.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Provider = all.Provider + return nil +} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go new file mode 100644 index 00000000000..6b1e65c99fe --- /dev/null +++ b/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsCIBatchMetadataGit Git information. +type SyntheticsCIBatchMetadataGit struct { + // Branch name. + Branch *string `json:"branch,omitempty"` + // The commit SHA. + CommitSha *string `json:"commitSha,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{} +} + +// NewSyntheticsCIBatchMetadataGit instantiates a new SyntheticsCIBatchMetadataGit 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 NewSyntheticsCIBatchMetadataGit() *SyntheticsCIBatchMetadataGit { + this := SyntheticsCIBatchMetadataGit{} + return &this +} + +// NewSyntheticsCIBatchMetadataGitWithDefaults instantiates a new SyntheticsCIBatchMetadataGit 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 NewSyntheticsCIBatchMetadataGitWithDefaults() *SyntheticsCIBatchMetadataGit { + this := SyntheticsCIBatchMetadataGit{} + return &this +} + +// GetBranch returns the Branch field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadataGit) GetBranch() string { + if o == nil || o.Branch == nil { + var ret string + return ret + } + return *o.Branch +} + +// GetBranchOk returns a tuple with the Branch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadataGit) GetBranchOk() (*string, bool) { + if o == nil || o.Branch == nil { + return nil, false + } + return o.Branch, true +} + +// HasBranch returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadataGit) HasBranch() bool { + if o != nil && o.Branch != nil { + return true + } + + return false +} + +// SetBranch gets a reference to the given string and assigns it to the Branch field. +func (o *SyntheticsCIBatchMetadataGit) SetBranch(v string) { + o.Branch = &v +} + +// GetCommitSha returns the CommitSha field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadataGit) GetCommitSha() string { + if o == nil || o.CommitSha == nil { + var ret string + return ret + } + return *o.CommitSha +} + +// GetCommitShaOk returns a tuple with the CommitSha field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadataGit) GetCommitShaOk() (*string, bool) { + if o == nil || o.CommitSha == nil { + return nil, false + } + return o.CommitSha, true +} + +// HasCommitSha returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadataGit) HasCommitSha() bool { + if o != nil && o.CommitSha != nil { + return true + } + + return false +} + +// SetCommitSha gets a reference to the given string and assigns it to the CommitSha field. +func (o *SyntheticsCIBatchMetadataGit) SetCommitSha(v string) { + o.CommitSha = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCIBatchMetadataGit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Branch != nil { + toSerialize["branch"] = o.Branch + } + if o.CommitSha != nil { + toSerialize["commitSha"] = o.CommitSha + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCIBatchMetadataGit) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Branch *string `json:"branch,omitempty"` + CommitSha *string `json:"commitSha,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Branch = all.Branch + o.CommitSha = all.CommitSha + return nil +} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.go new file mode 100644 index 00000000000..d6a4940152e --- /dev/null +++ b/api/v1/datadog/model_synthetics_ci_batch_metadata_pipeline.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsCIBatchMetadataPipeline Description of the CI pipeline. +type SyntheticsCIBatchMetadataPipeline struct { + // URL of the pipeline. + Url *string `json:"url,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{} +} + +// NewSyntheticsCIBatchMetadataPipeline instantiates a new SyntheticsCIBatchMetadataPipeline 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 NewSyntheticsCIBatchMetadataPipeline() *SyntheticsCIBatchMetadataPipeline { + this := SyntheticsCIBatchMetadataPipeline{} + return &this +} + +// NewSyntheticsCIBatchMetadataPipelineWithDefaults instantiates a new SyntheticsCIBatchMetadataPipeline 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 NewSyntheticsCIBatchMetadataPipelineWithDefaults() *SyntheticsCIBatchMetadataPipeline { + this := SyntheticsCIBatchMetadataPipeline{} + return &this +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadataPipeline) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadataPipeline) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadataPipeline) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *SyntheticsCIBatchMetadataPipeline) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCIBatchMetadataPipeline) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCIBatchMetadataPipeline) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_provider.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_provider.go new file mode 100644 index 00000000000..2916c5beeed --- /dev/null +++ b/api/v1/datadog/model_synthetics_ci_batch_metadata_provider.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsCIBatchMetadataProvider Description of the CI provider. +type SyntheticsCIBatchMetadataProvider struct { + // Name of the CI provider. + Name *string `json:"name,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{} +} + +// NewSyntheticsCIBatchMetadataProvider instantiates a new SyntheticsCIBatchMetadataProvider 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 NewSyntheticsCIBatchMetadataProvider() *SyntheticsCIBatchMetadataProvider { + this := SyntheticsCIBatchMetadataProvider{} + return &this +} + +// NewSyntheticsCIBatchMetadataProviderWithDefaults instantiates a new SyntheticsCIBatchMetadataProvider 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 NewSyntheticsCIBatchMetadataProviderWithDefaults() *SyntheticsCIBatchMetadataProvider { + this := SyntheticsCIBatchMetadataProvider{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsCIBatchMetadataProvider) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCIBatchMetadataProvider) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SyntheticsCIBatchMetadataProvider) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsCIBatchMetadataProvider) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCIBatchMetadataProvider) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCIBatchMetadataProvider) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_synthetics_ci_test_.go b/api/v1/datadog/model_synthetics_ci_test_.go new file mode 100644 index 00000000000..c8124fac889 --- /dev/null +++ b/api/v1/datadog/model_synthetics_ci_test_.go @@ -0,0 +1,624 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsCITest Test configuration for Synthetics CI +type SyntheticsCITest struct { + // Disable certificate checks in API tests. + AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"` + // Object to handle basic authentication when performing the test. + BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` + // Body to include in the test. + Body *string `json:"body,omitempty"` + // Type of the data sent in a synthetics API test. + BodyType *string `json:"bodyType,omitempty"` + // Cookies for the request. + Cookies *string `json:"cookies,omitempty"` + // For browser test, array with the different device IDs used to run the test. + DeviceIds []SyntheticsDeviceID `json:"deviceIds,omitempty"` + // For API HTTP test, whether or not the test should follow redirects. + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Headers to include when performing the test. + Headers map[string]string `json:"headers,omitempty"` + // Array of locations used to run the test. + Locations []string `json:"locations,omitempty"` + // Metadata for the Synthetics tests run. + Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` + // The public ID of the Synthetics test to trigger. + PublicId string `json:"public_id"` + // Object describing the retry strategy to apply to a Synthetic test. + Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` + // Starting URL for the browser test. + StartUrl *string `json:"startUrl,omitempty"` + // Variables to replace in the test. + Variables map[string]string `json:"variables,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{} +} + +// NewSyntheticsCITest instantiates a new SyntheticsCITest 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 NewSyntheticsCITest(publicId string) *SyntheticsCITest { + this := SyntheticsCITest{} + this.PublicId = publicId + return &this +} + +// NewSyntheticsCITestWithDefaults instantiates a new SyntheticsCITest 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 NewSyntheticsCITestWithDefaults() *SyntheticsCITest { + this := SyntheticsCITest{} + return &this +} + +// GetAllowInsecureCertificates returns the AllowInsecureCertificates field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetAllowInsecureCertificates() bool { + if o == nil || o.AllowInsecureCertificates == nil { + var ret bool + return ret + } + return *o.AllowInsecureCertificates +} + +// GetAllowInsecureCertificatesOk returns a tuple with the AllowInsecureCertificates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetAllowInsecureCertificatesOk() (*bool, bool) { + if o == nil || o.AllowInsecureCertificates == nil { + return nil, false + } + return o.AllowInsecureCertificates, true +} + +// HasAllowInsecureCertificates returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasAllowInsecureCertificates() bool { + if o != nil && o.AllowInsecureCertificates != nil { + return true + } + + return false +} + +// SetAllowInsecureCertificates gets a reference to the given bool and assigns it to the AllowInsecureCertificates field. +func (o *SyntheticsCITest) SetAllowInsecureCertificates(v bool) { + o.AllowInsecureCertificates = &v +} + +// GetBasicAuth returns the BasicAuth field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetBasicAuth() SyntheticsBasicAuth { + if o == nil || o.BasicAuth == nil { + var ret SyntheticsBasicAuth + return ret + } + return *o.BasicAuth +} + +// GetBasicAuthOk returns a tuple with the BasicAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetBasicAuthOk() (*SyntheticsBasicAuth, bool) { + if o == nil || o.BasicAuth == nil { + return nil, false + } + return o.BasicAuth, true +} + +// HasBasicAuth returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasBasicAuth() bool { + if o != nil && o.BasicAuth != nil { + return true + } + + return false +} + +// SetBasicAuth gets a reference to the given SyntheticsBasicAuth and assigns it to the BasicAuth field. +func (o *SyntheticsCITest) SetBasicAuth(v SyntheticsBasicAuth) { + o.BasicAuth = &v +} + +// GetBody returns the Body field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetBody() string { + if o == nil || o.Body == nil { + var ret string + return ret + } + return *o.Body +} + +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetBodyOk() (*string, bool) { + if o == nil || o.Body == nil { + return nil, false + } + return o.Body, true +} + +// HasBody returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasBody() bool { + if o != nil && o.Body != nil { + return true + } + + return false +} + +// SetBody gets a reference to the given string and assigns it to the Body field. +func (o *SyntheticsCITest) SetBody(v string) { + o.Body = &v +} + +// GetBodyType returns the BodyType field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetBodyType() string { + if o == nil || o.BodyType == nil { + var ret string + return ret + } + return *o.BodyType +} + +// GetBodyTypeOk returns a tuple with the BodyType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetBodyTypeOk() (*string, bool) { + if o == nil || o.BodyType == nil { + return nil, false + } + return o.BodyType, true +} + +// HasBodyType returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasBodyType() bool { + if o != nil && o.BodyType != nil { + return true + } + + return false +} + +// SetBodyType gets a reference to the given string and assigns it to the BodyType field. +func (o *SyntheticsCITest) SetBodyType(v string) { + o.BodyType = &v +} + +// GetCookies returns the Cookies field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetCookies() string { + if o == nil || o.Cookies == nil { + var ret string + return ret + } + return *o.Cookies +} + +// GetCookiesOk returns a tuple with the Cookies field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetCookiesOk() (*string, bool) { + if o == nil || o.Cookies == nil { + return nil, false + } + return o.Cookies, true +} + +// HasCookies returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasCookies() bool { + if o != nil && o.Cookies != nil { + return true + } + + return false +} + +// SetCookies gets a reference to the given string and assigns it to the Cookies field. +func (o *SyntheticsCITest) SetCookies(v string) { + o.Cookies = &v +} + +// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetDeviceIds() []SyntheticsDeviceID { + if o == nil || o.DeviceIds == nil { + var ret []SyntheticsDeviceID + return ret + } + return o.DeviceIds +} + +// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetDeviceIdsOk() (*[]SyntheticsDeviceID, bool) { + if o == nil || o.DeviceIds == nil { + return nil, false + } + return &o.DeviceIds, true +} + +// HasDeviceIds returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasDeviceIds() bool { + if o != nil && o.DeviceIds != nil { + return true + } + + return false +} + +// SetDeviceIds gets a reference to the given []SyntheticsDeviceID and assigns it to the DeviceIds field. +func (o *SyntheticsCITest) SetDeviceIds(v []SyntheticsDeviceID) { + o.DeviceIds = v +} + +// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetFollowRedirects() bool { + if o == nil || o.FollowRedirects == nil { + var ret bool + return ret + } + return *o.FollowRedirects +} + +// GetFollowRedirectsOk returns a tuple with the FollowRedirects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetFollowRedirectsOk() (*bool, bool) { + if o == nil || o.FollowRedirects == nil { + return nil, false + } + return o.FollowRedirects, true +} + +// HasFollowRedirects returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasFollowRedirects() bool { + if o != nil && o.FollowRedirects != nil { + return true + } + + return false +} + +// SetFollowRedirects gets a reference to the given bool and assigns it to the FollowRedirects field. +func (o *SyntheticsCITest) SetFollowRedirects(v bool) { + o.FollowRedirects = &v +} + +// GetHeaders returns the Headers field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetHeaders() map[string]string { + if o == nil || o.Headers == nil { + var ret map[string]string + return ret + } + return o.Headers +} + +// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetHeadersOk() (*map[string]string, bool) { + if o == nil || o.Headers == nil { + return nil, false + } + return &o.Headers, true +} + +// HasHeaders returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasHeaders() bool { + if o != nil && o.Headers != nil { + return true + } + + return false +} + +// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field. +func (o *SyntheticsCITest) SetHeaders(v map[string]string) { + o.Headers = v +} + +// GetLocations returns the Locations field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetLocations() []string { + if o == nil || o.Locations == nil { + var ret []string + return ret + } + return o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetLocationsOk() (*[]string, bool) { + if o == nil || o.Locations == nil { + return nil, false + } + return &o.Locations, true +} + +// HasLocations returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasLocations() bool { + if o != nil && o.Locations != nil { + return true + } + + return false +} + +// SetLocations gets a reference to the given []string and assigns it to the Locations field. +func (o *SyntheticsCITest) SetLocations(v []string) { + o.Locations = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetMetadata() SyntheticsCIBatchMetadata { + if o == nil || o.Metadata == nil { + var ret SyntheticsCIBatchMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetMetadataOk() (*SyntheticsCIBatchMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given SyntheticsCIBatchMetadata and assigns it to the Metadata field. +func (o *SyntheticsCITest) SetMetadata(v SyntheticsCIBatchMetadata) { + o.Metadata = &v +} + +// GetPublicId returns the PublicId field value. +func (o *SyntheticsCITest) GetPublicId() string { + if o == nil { + var ret string + return ret + } + return o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetPublicIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicId, true +} + +// SetPublicId sets field value. +func (o *SyntheticsCITest) SetPublicId(v string) { + o.PublicId = v +} + +// GetRetry returns the Retry field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetRetry() SyntheticsTestOptionsRetry { + if o == nil || o.Retry == nil { + var ret SyntheticsTestOptionsRetry + return ret + } + return *o.Retry +} + +// GetRetryOk returns a tuple with the Retry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetRetryOk() (*SyntheticsTestOptionsRetry, bool) { + if o == nil || o.Retry == nil { + return nil, false + } + return o.Retry, true +} + +// HasRetry returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasRetry() bool { + if o != nil && o.Retry != nil { + return true + } + + return false +} + +// SetRetry gets a reference to the given SyntheticsTestOptionsRetry and assigns it to the Retry field. +func (o *SyntheticsCITest) SetRetry(v SyntheticsTestOptionsRetry) { + o.Retry = &v +} + +// GetStartUrl returns the StartUrl field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetStartUrl() string { + if o == nil || o.StartUrl == nil { + var ret string + return ret + } + return *o.StartUrl +} + +// GetStartUrlOk returns a tuple with the StartUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetStartUrlOk() (*string, bool) { + if o == nil || o.StartUrl == nil { + return nil, false + } + return o.StartUrl, true +} + +// HasStartUrl returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasStartUrl() bool { + if o != nil && o.StartUrl != nil { + return true + } + + return false +} + +// SetStartUrl gets a reference to the given string and assigns it to the StartUrl field. +func (o *SyntheticsCITest) SetStartUrl(v string) { + o.StartUrl = &v +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *SyntheticsCITest) GetVariables() map[string]string { + if o == nil || o.Variables == nil { + var ret map[string]string + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITest) GetVariablesOk() (*map[string]string, bool) { + if o == nil || o.Variables == nil { + return nil, false + } + return &o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *SyntheticsCITest) HasVariables() bool { + if o != nil && o.Variables != nil { + return true + } + + return false +} + +// SetVariables gets a reference to the given map[string]string and assigns it to the Variables field. +func (o *SyntheticsCITest) SetVariables(v map[string]string) { + o.Variables = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCITest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AllowInsecureCertificates != nil { + toSerialize["allowInsecureCertificates"] = o.AllowInsecureCertificates + } + if o.BasicAuth != nil { + toSerialize["basicAuth"] = o.BasicAuth + } + if o.Body != nil { + toSerialize["body"] = o.Body + } + if o.BodyType != nil { + toSerialize["bodyType"] = o.BodyType + } + if o.Cookies != nil { + toSerialize["cookies"] = o.Cookies + } + if o.DeviceIds != nil { + toSerialize["deviceIds"] = o.DeviceIds + } + if o.FollowRedirects != nil { + toSerialize["followRedirects"] = o.FollowRedirects + } + if o.Headers != nil { + toSerialize["headers"] = o.Headers + } + if o.Locations != nil { + toSerialize["locations"] = o.Locations + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["public_id"] = o.PublicId + if o.Retry != nil { + toSerialize["retry"] = o.Retry + } + if o.StartUrl != nil { + toSerialize["startUrl"] = o.StartUrl + } + if o.Variables != nil { + toSerialize["variables"] = o.Variables + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + PublicId *string `json:"public_id"` + }{} + all := struct { + AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"` + BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` + Body *string `json:"body,omitempty"` + BodyType *string `json:"bodyType,omitempty"` + Cookies *string `json:"cookies,omitempty"` + DeviceIds []SyntheticsDeviceID `json:"deviceIds,omitempty"` + FollowRedirects *bool `json:"followRedirects,omitempty"` + Headers map[string]string `json:"headers,omitempty"` + Locations []string `json:"locations,omitempty"` + Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` + PublicId string `json:"public_id"` + Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` + StartUrl *string `json:"startUrl,omitempty"` + Variables map[string]string `json:"variables,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.PublicId == nil { + return fmt.Errorf("Required field public_id missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AllowInsecureCertificates = all.AllowInsecureCertificates + o.BasicAuth = all.BasicAuth + o.Body = all.Body + o.BodyType = all.BodyType + o.Cookies = all.Cookies + o.DeviceIds = all.DeviceIds + o.FollowRedirects = all.FollowRedirects + o.Headers = all.Headers + o.Locations = all.Locations + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.PublicId = all.PublicId + if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Retry = all.Retry + o.StartUrl = all.StartUrl + o.Variables = all.Variables + return nil +} diff --git a/api/v1/datadog/model_synthetics_ci_test_body.go b/api/v1/datadog/model_synthetics_ci_test_body.go new file mode 100644 index 00000000000..c8967377318 --- /dev/null +++ b/api/v1/datadog/model_synthetics_ci_test_body.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsCITestBody Object describing the synthetics tests to trigger. +type SyntheticsCITestBody struct { + // Individual synthetics test. + Tests []SyntheticsCITest `json:"tests,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{} +} + +// NewSyntheticsCITestBody instantiates a new SyntheticsCITestBody 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 NewSyntheticsCITestBody() *SyntheticsCITestBody { + this := SyntheticsCITestBody{} + return &this +} + +// NewSyntheticsCITestBodyWithDefaults instantiates a new SyntheticsCITestBody 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 NewSyntheticsCITestBodyWithDefaults() *SyntheticsCITestBody { + this := SyntheticsCITestBody{} + return &this +} + +// GetTests returns the Tests field value if set, zero value otherwise. +func (o *SyntheticsCITestBody) GetTests() []SyntheticsCITest { + if o == nil || o.Tests == nil { + var ret []SyntheticsCITest + return ret + } + return o.Tests +} + +// GetTestsOk returns a tuple with the Tests field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCITestBody) GetTestsOk() (*[]SyntheticsCITest, bool) { + if o == nil || o.Tests == nil { + return nil, false + } + return &o.Tests, true +} + +// HasTests returns a boolean if a field has been set. +func (o *SyntheticsCITestBody) HasTests() bool { + if o != nil && o.Tests != nil { + return true + } + + return false +} + +// SetTests gets a reference to the given []SyntheticsCITest and assigns it to the Tests field. +func (o *SyntheticsCITestBody) SetTests(v []SyntheticsCITest) { + o.Tests = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCITestBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Tests != nil { + toSerialize["tests"] = o.Tests + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCITestBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Tests []SyntheticsCITest `json:"tests,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Tests = all.Tests + return nil +} diff --git a/api/v1/datadog/model_synthetics_config_variable.go b/api/v1/datadog/model_synthetics_config_variable.go new file mode 100644 index 00000000000..31dcb2517cf --- /dev/null +++ b/api/v1/datadog/model_synthetics_config_variable.go @@ -0,0 +1,261 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsConfigVariable Object defining a variable that can be used in your test configuration. +type SyntheticsConfigVariable struct { + // Example for the variable. + Example *string `json:"example,omitempty"` + // ID of the variable for global variables. + Id *string `json:"id,omitempty"` + // Name of the variable. + Name string `json:"name"` + // Pattern of the variable. + Pattern *string `json:"pattern,omitempty"` + // Type of the configuration variable. + Type SyntheticsConfigVariableType `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{} +} + +// NewSyntheticsConfigVariable instantiates a new SyntheticsConfigVariable 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 NewSyntheticsConfigVariable(name string, typeVar SyntheticsConfigVariableType) *SyntheticsConfigVariable { + this := SyntheticsConfigVariable{} + this.Name = name + this.Type = typeVar + return &this +} + +// NewSyntheticsConfigVariableWithDefaults instantiates a new SyntheticsConfigVariable 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 NewSyntheticsConfigVariableWithDefaults() *SyntheticsConfigVariable { + this := SyntheticsConfigVariable{} + return &this +} + +// GetExample returns the Example field value if set, zero value otherwise. +func (o *SyntheticsConfigVariable) GetExample() string { + if o == nil || o.Example == nil { + var ret string + return ret + } + return *o.Example +} + +// GetExampleOk returns a tuple with the Example field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsConfigVariable) GetExampleOk() (*string, bool) { + if o == nil || o.Example == nil { + return nil, false + } + return o.Example, true +} + +// HasExample returns a boolean if a field has been set. +func (o *SyntheticsConfigVariable) HasExample() bool { + if o != nil && o.Example != nil { + return true + } + + return false +} + +// SetExample gets a reference to the given string and assigns it to the Example field. +func (o *SyntheticsConfigVariable) SetExample(v string) { + o.Example = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsConfigVariable) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsConfigVariable) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsConfigVariable) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SyntheticsConfigVariable) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsConfigVariable) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsConfigVariable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsConfigVariable) SetName(v string) { + o.Name = v +} + +// GetPattern returns the Pattern field value if set, zero value otherwise. +func (o *SyntheticsConfigVariable) GetPattern() string { + if o == nil || o.Pattern == nil { + var ret string + return ret + } + return *o.Pattern +} + +// GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsConfigVariable) GetPatternOk() (*string, bool) { + if o == nil || o.Pattern == nil { + return nil, false + } + return o.Pattern, true +} + +// HasPattern returns a boolean if a field has been set. +func (o *SyntheticsConfigVariable) HasPattern() bool { + if o != nil && o.Pattern != nil { + return true + } + + return false +} + +// SetPattern gets a reference to the given string and assigns it to the Pattern field. +func (o *SyntheticsConfigVariable) SetPattern(v string) { + o.Pattern = &v +} + +// GetType returns the Type field value. +func (o *SyntheticsConfigVariable) GetType() SyntheticsConfigVariableType { + if o == nil { + var ret SyntheticsConfigVariableType + 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 *SyntheticsConfigVariable) GetTypeOk() (*SyntheticsConfigVariableType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsConfigVariable) SetType(v SyntheticsConfigVariableType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsConfigVariable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Example != nil { + toSerialize["example"] = o.Example + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["name"] = o.Name + if o.Pattern != nil { + toSerialize["pattern"] = o.Pattern + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Type *SyntheticsConfigVariableType `json:"type"` + }{} + all := struct { + Example *string `json:"example,omitempty"` + Id *string `json:"id,omitempty"` + Name string `json:"name"` + Pattern *string `json:"pattern,omitempty"` + Type SyntheticsConfigVariableType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Example = all.Example + o.Id = all.Id + o.Name = all.Name + o.Pattern = all.Pattern + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_config_variable_type.go b/api/v1/datadog/model_synthetics_config_variable_type.go new file mode 100644 index 00000000000..a880574355e --- /dev/null +++ b/api/v1/datadog/model_synthetics_config_variable_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsConfigVariableType Type of the configuration variable. +type SyntheticsConfigVariableType string + +// List of SyntheticsConfigVariableType. +const ( + SYNTHETICSCONFIGVARIABLETYPE_GLOBAL SyntheticsConfigVariableType = "global" + SYNTHETICSCONFIGVARIABLETYPE_TEXT SyntheticsConfigVariableType = "text" +) + +var allowedSyntheticsConfigVariableTypeEnumValues = []SyntheticsConfigVariableType{ + SYNTHETICSCONFIGVARIABLETYPE_GLOBAL, + SYNTHETICSCONFIGVARIABLETYPE_TEXT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsConfigVariableType) GetAllowedValues() []SyntheticsConfigVariableType { + return allowedSyntheticsConfigVariableTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsConfigVariableType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsConfigVariableType(value) + return nil +} + +// NewSyntheticsConfigVariableTypeFromValue returns a pointer to a valid SyntheticsConfigVariableType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsConfigVariableTypeFromValue(v string) (*SyntheticsConfigVariableType, error) { + ev := SyntheticsConfigVariableType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsConfigVariableType: valid values are %v", v, allowedSyntheticsConfigVariableTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsConfigVariableType) IsValid() bool { + for _, existing := range allowedSyntheticsConfigVariableTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsConfigVariableType value. +func (v SyntheticsConfigVariableType) Ptr() *SyntheticsConfigVariableType { + return &v +} + +// NullableSyntheticsConfigVariableType handles when a null is used for SyntheticsConfigVariableType. +type NullableSyntheticsConfigVariableType struct { + value *SyntheticsConfigVariableType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsConfigVariableType) Get() *SyntheticsConfigVariableType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsConfigVariableType) Set(val *SyntheticsConfigVariableType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsConfigVariableType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsConfigVariableType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsConfigVariableType initializes the struct as if Set has been called. +func NewNullableSyntheticsConfigVariableType(val *SyntheticsConfigVariableType) *NullableSyntheticsConfigVariableType { + return &NullableSyntheticsConfigVariableType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsConfigVariableType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsConfigVariableType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_core_web_vitals.go b/api/v1/datadog/model_synthetics_core_web_vitals.go new file mode 100644 index 00000000000..ff84ec43aa2 --- /dev/null +++ b/api/v1/datadog/model_synthetics_core_web_vitals.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsCoreWebVitals Core Web Vitals attached to a browser test step. +type SyntheticsCoreWebVitals struct { + // Cumulative Layout Shift. + Cls *float64 `json:"cls,omitempty"` + // Largest Contentful Paint in milliseconds. + Lcp *float64 `json:"lcp,omitempty"` + // URL attached to the metrics. + Url *string `json:"url,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{} +} + +// NewSyntheticsCoreWebVitals instantiates a new SyntheticsCoreWebVitals 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 NewSyntheticsCoreWebVitals() *SyntheticsCoreWebVitals { + this := SyntheticsCoreWebVitals{} + return &this +} + +// NewSyntheticsCoreWebVitalsWithDefaults instantiates a new SyntheticsCoreWebVitals 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 NewSyntheticsCoreWebVitalsWithDefaults() *SyntheticsCoreWebVitals { + this := SyntheticsCoreWebVitals{} + return &this +} + +// GetCls returns the Cls field value if set, zero value otherwise. +func (o *SyntheticsCoreWebVitals) GetCls() float64 { + if o == nil || o.Cls == nil { + var ret float64 + return ret + } + return *o.Cls +} + +// GetClsOk returns a tuple with the Cls field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCoreWebVitals) GetClsOk() (*float64, bool) { + if o == nil || o.Cls == nil { + return nil, false + } + return o.Cls, true +} + +// HasCls returns a boolean if a field has been set. +func (o *SyntheticsCoreWebVitals) HasCls() bool { + if o != nil && o.Cls != nil { + return true + } + + return false +} + +// SetCls gets a reference to the given float64 and assigns it to the Cls field. +func (o *SyntheticsCoreWebVitals) SetCls(v float64) { + o.Cls = &v +} + +// GetLcp returns the Lcp field value if set, zero value otherwise. +func (o *SyntheticsCoreWebVitals) GetLcp() float64 { + if o == nil || o.Lcp == nil { + var ret float64 + return ret + } + return *o.Lcp +} + +// GetLcpOk returns a tuple with the Lcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCoreWebVitals) GetLcpOk() (*float64, bool) { + if o == nil || o.Lcp == nil { + return nil, false + } + return o.Lcp, true +} + +// HasLcp returns a boolean if a field has been set. +func (o *SyntheticsCoreWebVitals) HasLcp() bool { + if o != nil && o.Lcp != nil { + return true + } + + return false +} + +// SetLcp gets a reference to the given float64 and assigns it to the Lcp field. +func (o *SyntheticsCoreWebVitals) SetLcp(v float64) { + o.Lcp = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *SyntheticsCoreWebVitals) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsCoreWebVitals) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *SyntheticsCoreWebVitals) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *SyntheticsCoreWebVitals) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsCoreWebVitals) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cls != nil { + toSerialize["cls"] = o.Cls + } + if o.Lcp != nil { + toSerialize["lcp"] = o.Lcp + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsCoreWebVitals) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cls *float64 `json:"cls,omitempty"` + Lcp *float64 `json:"lcp,omitempty"` + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cls = all.Cls + o.Lcp = all.Lcp + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_synthetics_delete_tests_payload.go b/api/v1/datadog/model_synthetics_delete_tests_payload.go new file mode 100644 index 00000000000..4b8c3c2c00f --- /dev/null +++ b/api/v1/datadog/model_synthetics_delete_tests_payload.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsDeleteTestsPayload A JSON list of the ID or IDs of the Synthetic tests that you want +// to delete. +type SyntheticsDeleteTestsPayload struct { + // An array of Synthetic test IDs you want to delete. + PublicIds []string `json:"public_ids,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{} +} + +// NewSyntheticsDeleteTestsPayload instantiates a new SyntheticsDeleteTestsPayload 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 NewSyntheticsDeleteTestsPayload() *SyntheticsDeleteTestsPayload { + this := SyntheticsDeleteTestsPayload{} + return &this +} + +// NewSyntheticsDeleteTestsPayloadWithDefaults instantiates a new SyntheticsDeleteTestsPayload 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 NewSyntheticsDeleteTestsPayloadWithDefaults() *SyntheticsDeleteTestsPayload { + this := SyntheticsDeleteTestsPayload{} + return &this +} + +// GetPublicIds returns the PublicIds field value if set, zero value otherwise. +func (o *SyntheticsDeleteTestsPayload) GetPublicIds() []string { + if o == nil || o.PublicIds == nil { + var ret []string + return ret + } + return o.PublicIds +} + +// GetPublicIdsOk returns a tuple with the PublicIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsDeleteTestsPayload) GetPublicIdsOk() (*[]string, bool) { + if o == nil || o.PublicIds == nil { + return nil, false + } + return &o.PublicIds, true +} + +// HasPublicIds returns a boolean if a field has been set. +func (o *SyntheticsDeleteTestsPayload) HasPublicIds() bool { + if o != nil && o.PublicIds != nil { + return true + } + + return false +} + +// SetPublicIds gets a reference to the given []string and assigns it to the PublicIds field. +func (o *SyntheticsDeleteTestsPayload) SetPublicIds(v []string) { + o.PublicIds = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsDeleteTestsPayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.PublicIds != nil { + toSerialize["public_ids"] = o.PublicIds + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsDeleteTestsPayload) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + PublicIds []string `json:"public_ids,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.PublicIds = all.PublicIds + return nil +} diff --git a/api/v1/datadog/model_synthetics_delete_tests_response.go b/api/v1/datadog/model_synthetics_delete_tests_response.go new file mode 100644 index 00000000000..8da48748c9d --- /dev/null +++ b/api/v1/datadog/model_synthetics_delete_tests_response.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsDeleteTestsResponse Response object for deleting Synthetic tests. +type SyntheticsDeleteTestsResponse struct { + // Array of objects containing a deleted Synthetic test ID with + // the associated deletion timestamp. + DeletedTests []SyntheticsDeletedTest `json:"deleted_tests,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{} +} + +// NewSyntheticsDeleteTestsResponse instantiates a new SyntheticsDeleteTestsResponse 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 NewSyntheticsDeleteTestsResponse() *SyntheticsDeleteTestsResponse { + this := SyntheticsDeleteTestsResponse{} + return &this +} + +// NewSyntheticsDeleteTestsResponseWithDefaults instantiates a new SyntheticsDeleteTestsResponse 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 NewSyntheticsDeleteTestsResponseWithDefaults() *SyntheticsDeleteTestsResponse { + this := SyntheticsDeleteTestsResponse{} + return &this +} + +// GetDeletedTests returns the DeletedTests field value if set, zero value otherwise. +func (o *SyntheticsDeleteTestsResponse) GetDeletedTests() []SyntheticsDeletedTest { + if o == nil || o.DeletedTests == nil { + var ret []SyntheticsDeletedTest + return ret + } + return o.DeletedTests +} + +// GetDeletedTestsOk returns a tuple with the DeletedTests field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsDeleteTestsResponse) GetDeletedTestsOk() (*[]SyntheticsDeletedTest, bool) { + if o == nil || o.DeletedTests == nil { + return nil, false + } + return &o.DeletedTests, true +} + +// HasDeletedTests returns a boolean if a field has been set. +func (o *SyntheticsDeleteTestsResponse) HasDeletedTests() bool { + if o != nil && o.DeletedTests != nil { + return true + } + + return false +} + +// SetDeletedTests gets a reference to the given []SyntheticsDeletedTest and assigns it to the DeletedTests field. +func (o *SyntheticsDeleteTestsResponse) SetDeletedTests(v []SyntheticsDeletedTest) { + o.DeletedTests = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsDeleteTestsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DeletedTests != nil { + toSerialize["deleted_tests"] = o.DeletedTests + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsDeleteTestsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DeletedTests []SyntheticsDeletedTest `json:"deleted_tests,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DeletedTests = all.DeletedTests + return nil +} diff --git a/api/v1/datadog/model_synthetics_deleted_test_.go b/api/v1/datadog/model_synthetics_deleted_test_.go new file mode 100644 index 00000000000..932b02a8679 --- /dev/null +++ b/api/v1/datadog/model_synthetics_deleted_test_.go @@ -0,0 +1,147 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// SyntheticsDeletedTest Object containing a deleted Synthetic test ID with the associated +// deletion timestamp. +type SyntheticsDeletedTest struct { + // Deletion timestamp of the Synthetic test ID. + DeletedAt *time.Time `json:"deleted_at,omitempty"` + // The Synthetic test ID deleted. + PublicId *string `json:"public_id,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{} +} + +// NewSyntheticsDeletedTest instantiates a new SyntheticsDeletedTest 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 NewSyntheticsDeletedTest() *SyntheticsDeletedTest { + this := SyntheticsDeletedTest{} + return &this +} + +// NewSyntheticsDeletedTestWithDefaults instantiates a new SyntheticsDeletedTest 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 NewSyntheticsDeletedTestWithDefaults() *SyntheticsDeletedTest { + this := SyntheticsDeletedTest{} + return &this +} + +// GetDeletedAt returns the DeletedAt field value if set, zero value otherwise. +func (o *SyntheticsDeletedTest) GetDeletedAt() time.Time { + if o == nil || o.DeletedAt == nil { + var ret time.Time + return ret + } + return *o.DeletedAt +} + +// GetDeletedAtOk returns a tuple with the DeletedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsDeletedTest) GetDeletedAtOk() (*time.Time, bool) { + if o == nil || o.DeletedAt == nil { + return nil, false + } + return o.DeletedAt, true +} + +// HasDeletedAt returns a boolean if a field has been set. +func (o *SyntheticsDeletedTest) HasDeletedAt() bool { + if o != nil && o.DeletedAt != nil { + return true + } + + return false +} + +// SetDeletedAt gets a reference to the given time.Time and assigns it to the DeletedAt field. +func (o *SyntheticsDeletedTest) SetDeletedAt(v time.Time) { + o.DeletedAt = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *SyntheticsDeletedTest) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsDeletedTest) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *SyntheticsDeletedTest) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *SyntheticsDeletedTest) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsDeletedTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DeletedAt != nil { + if o.DeletedAt.Nanosecond() == 0 { + toSerialize["deleted_at"] = o.DeletedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["deleted_at"] = o.DeletedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsDeletedTest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DeletedAt *time.Time `json:"deleted_at,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DeletedAt = all.DeletedAt + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_synthetics_device.go b/api/v1/datadog/model_synthetics_device.go new file mode 100644 index 00000000000..df5a57bca9c --- /dev/null +++ b/api/v1/datadog/model_synthetics_device.go @@ -0,0 +1,249 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsDevice Object describing the device used to perform the Synthetic test. +type SyntheticsDevice struct { + // Screen height of the device. + Height int64 `json:"height"` + // The device ID. + Id SyntheticsDeviceID `json:"id"` + // Whether or not the device is a mobile. + IsMobile *bool `json:"isMobile,omitempty"` + // The device name. + Name string `json:"name"` + // Screen width of the device. + Width int64 `json:"width"` + // 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{} +} + +// NewSyntheticsDevice instantiates a new SyntheticsDevice 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 NewSyntheticsDevice(height int64, id SyntheticsDeviceID, name string, width int64) *SyntheticsDevice { + this := SyntheticsDevice{} + this.Height = height + this.Id = id + this.Name = name + this.Width = width + return &this +} + +// NewSyntheticsDeviceWithDefaults instantiates a new SyntheticsDevice 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 NewSyntheticsDeviceWithDefaults() *SyntheticsDevice { + this := SyntheticsDevice{} + return &this +} + +// GetHeight returns the Height field value. +func (o *SyntheticsDevice) GetHeight() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Height +} + +// GetHeightOk returns a tuple with the Height field value +// and a boolean to check if the value has been set. +func (o *SyntheticsDevice) GetHeightOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Height, true +} + +// SetHeight sets field value. +func (o *SyntheticsDevice) SetHeight(v int64) { + o.Height = v +} + +// GetId returns the Id field value. +func (o *SyntheticsDevice) GetId() SyntheticsDeviceID { + if o == nil { + var ret SyntheticsDeviceID + 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 *SyntheticsDevice) GetIdOk() (*SyntheticsDeviceID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SyntheticsDevice) SetId(v SyntheticsDeviceID) { + o.Id = v +} + +// GetIsMobile returns the IsMobile field value if set, zero value otherwise. +func (o *SyntheticsDevice) GetIsMobile() bool { + if o == nil || o.IsMobile == nil { + var ret bool + return ret + } + return *o.IsMobile +} + +// GetIsMobileOk returns a tuple with the IsMobile field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsDevice) GetIsMobileOk() (*bool, bool) { + if o == nil || o.IsMobile == nil { + return nil, false + } + return o.IsMobile, true +} + +// HasIsMobile returns a boolean if a field has been set. +func (o *SyntheticsDevice) HasIsMobile() bool { + if o != nil && o.IsMobile != nil { + return true + } + + return false +} + +// SetIsMobile gets a reference to the given bool and assigns it to the IsMobile field. +func (o *SyntheticsDevice) SetIsMobile(v bool) { + o.IsMobile = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsDevice) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsDevice) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsDevice) SetName(v string) { + o.Name = v +} + +// GetWidth returns the Width field value. +func (o *SyntheticsDevice) GetWidth() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Width +} + +// GetWidthOk returns a tuple with the Width field value +// and a boolean to check if the value has been set. +func (o *SyntheticsDevice) GetWidthOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Width, true +} + +// SetWidth sets field value. +func (o *SyntheticsDevice) SetWidth(v int64) { + o.Width = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsDevice) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["height"] = o.Height + toSerialize["id"] = o.Id + if o.IsMobile != nil { + toSerialize["isMobile"] = o.IsMobile + } + toSerialize["name"] = o.Name + toSerialize["width"] = o.Width + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsDevice) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Height *int64 `json:"height"` + Id *SyntheticsDeviceID `json:"id"` + Name *string `json:"name"` + Width *int64 `json:"width"` + }{} + all := struct { + Height int64 `json:"height"` + Id SyntheticsDeviceID `json:"id"` + IsMobile *bool `json:"isMobile,omitempty"` + Name string `json:"name"` + Width int64 `json:"width"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Height == nil { + return fmt.Errorf("Required field height missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Width == nil { + return fmt.Errorf("Required field width missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Id; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Height = all.Height + o.Id = all.Id + o.IsMobile = all.IsMobile + o.Name = all.Name + o.Width = all.Width + return nil +} diff --git a/api/v1/datadog/model_synthetics_device_id.go b/api/v1/datadog/model_synthetics_device_id.go new file mode 100644 index 00000000000..e607814692a --- /dev/null +++ b/api/v1/datadog/model_synthetics_device_id.go @@ -0,0 +1,129 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsDeviceID The device ID. +type SyntheticsDeviceID string + +// List of SyntheticsDeviceID. +const ( + SYNTHETICSDEVICEID_LAPTOP_LARGE SyntheticsDeviceID = "laptop_large" + SYNTHETICSDEVICEID_TABLET SyntheticsDeviceID = "tablet" + SYNTHETICSDEVICEID_MOBILE_SMALL SyntheticsDeviceID = "mobile_small" + SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE SyntheticsDeviceID = "chrome.laptop_large" + SYNTHETICSDEVICEID_CHROME_TABLET SyntheticsDeviceID = "chrome.tablet" + SYNTHETICSDEVICEID_CHROME_MOBILE_SMALL SyntheticsDeviceID = "chrome.mobile_small" + SYNTHETICSDEVICEID_FIREFOX_LAPTOP_LARGE SyntheticsDeviceID = "firefox.laptop_large" + SYNTHETICSDEVICEID_FIREFOX_TABLET SyntheticsDeviceID = "firefox.tablet" + SYNTHETICSDEVICEID_FIREFOX_MOBILE_SMALL SyntheticsDeviceID = "firefox.mobile_small" + SYNTHETICSDEVICEID_EDGE_LAPTOP_LARGE SyntheticsDeviceID = "edge.laptop_large" + SYNTHETICSDEVICEID_EDGE_TABLET SyntheticsDeviceID = "edge.tablet" + SYNTHETICSDEVICEID_EDGE_MOBILE_SMALL SyntheticsDeviceID = "edge.mobile_small" +) + +var allowedSyntheticsDeviceIDEnumValues = []SyntheticsDeviceID{ + SYNTHETICSDEVICEID_LAPTOP_LARGE, + SYNTHETICSDEVICEID_TABLET, + SYNTHETICSDEVICEID_MOBILE_SMALL, + SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE, + SYNTHETICSDEVICEID_CHROME_TABLET, + SYNTHETICSDEVICEID_CHROME_MOBILE_SMALL, + SYNTHETICSDEVICEID_FIREFOX_LAPTOP_LARGE, + SYNTHETICSDEVICEID_FIREFOX_TABLET, + SYNTHETICSDEVICEID_FIREFOX_MOBILE_SMALL, + SYNTHETICSDEVICEID_EDGE_LAPTOP_LARGE, + SYNTHETICSDEVICEID_EDGE_TABLET, + SYNTHETICSDEVICEID_EDGE_MOBILE_SMALL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsDeviceID) GetAllowedValues() []SyntheticsDeviceID { + return allowedSyntheticsDeviceIDEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsDeviceID) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsDeviceID(value) + return nil +} + +// NewSyntheticsDeviceIDFromValue returns a pointer to a valid SyntheticsDeviceID +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsDeviceIDFromValue(v string) (*SyntheticsDeviceID, error) { + ev := SyntheticsDeviceID(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsDeviceID: valid values are %v", v, allowedSyntheticsDeviceIDEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsDeviceID) IsValid() bool { + for _, existing := range allowedSyntheticsDeviceIDEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsDeviceID value. +func (v SyntheticsDeviceID) Ptr() *SyntheticsDeviceID { + return &v +} + +// NullableSyntheticsDeviceID handles when a null is used for SyntheticsDeviceID. +type NullableSyntheticsDeviceID struct { + value *SyntheticsDeviceID + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsDeviceID) Get() *SyntheticsDeviceID { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsDeviceID) Set(val *SyntheticsDeviceID) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsDeviceID) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsDeviceID) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsDeviceID initializes the struct as if Set has been called. +func NewNullableSyntheticsDeviceID(val *SyntheticsDeviceID) *NullableSyntheticsDeviceID { + return &NullableSyntheticsDeviceID{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsDeviceID) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsDeviceID) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go b/api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go new file mode 100644 index 00000000000..a273d3546ee --- /dev/null +++ b/api/v1/datadog/model_synthetics_get_api_test_latest_results_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsGetAPITestLatestResultsResponse Object with the latest Synthetic API test run. +type SyntheticsGetAPITestLatestResultsResponse struct { + // Timestamp of the latest API test run. + LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` + // Result of the latest API test run. + Results []SyntheticsAPITestResultShort `json:"results,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{} +} + +// NewSyntheticsGetAPITestLatestResultsResponse instantiates a new SyntheticsGetAPITestLatestResultsResponse 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 NewSyntheticsGetAPITestLatestResultsResponse() *SyntheticsGetAPITestLatestResultsResponse { + this := SyntheticsGetAPITestLatestResultsResponse{} + return &this +} + +// NewSyntheticsGetAPITestLatestResultsResponseWithDefaults instantiates a new SyntheticsGetAPITestLatestResultsResponse 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 NewSyntheticsGetAPITestLatestResultsResponseWithDefaults() *SyntheticsGetAPITestLatestResultsResponse { + this := SyntheticsGetAPITestLatestResultsResponse{} + return &this +} + +// GetLastTimestampFetched returns the LastTimestampFetched field value if set, zero value otherwise. +func (o *SyntheticsGetAPITestLatestResultsResponse) GetLastTimestampFetched() int64 { + if o == nil || o.LastTimestampFetched == nil { + var ret int64 + return ret + } + return *o.LastTimestampFetched +} + +// GetLastTimestampFetchedOk returns a tuple with the LastTimestampFetched field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGetAPITestLatestResultsResponse) GetLastTimestampFetchedOk() (*int64, bool) { + if o == nil || o.LastTimestampFetched == nil { + return nil, false + } + return o.LastTimestampFetched, true +} + +// HasLastTimestampFetched returns a boolean if a field has been set. +func (o *SyntheticsGetAPITestLatestResultsResponse) HasLastTimestampFetched() bool { + if o != nil && o.LastTimestampFetched != nil { + return true + } + + return false +} + +// SetLastTimestampFetched gets a reference to the given int64 and assigns it to the LastTimestampFetched field. +func (o *SyntheticsGetAPITestLatestResultsResponse) SetLastTimestampFetched(v int64) { + o.LastTimestampFetched = &v +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *SyntheticsGetAPITestLatestResultsResponse) GetResults() []SyntheticsAPITestResultShort { + if o == nil || o.Results == nil { + var ret []SyntheticsAPITestResultShort + return ret + } + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGetAPITestLatestResultsResponse) GetResultsOk() (*[]SyntheticsAPITestResultShort, bool) { + if o == nil || o.Results == nil { + return nil, false + } + return &o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *SyntheticsGetAPITestLatestResultsResponse) HasResults() bool { + if o != nil && o.Results != nil { + return true + } + + return false +} + +// SetResults gets a reference to the given []SyntheticsAPITestResultShort and assigns it to the Results field. +func (o *SyntheticsGetAPITestLatestResultsResponse) SetResults(v []SyntheticsAPITestResultShort) { + o.Results = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsGetAPITestLatestResultsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LastTimestampFetched != nil { + toSerialize["last_timestamp_fetched"] = o.LastTimestampFetched + } + if o.Results != nil { + toSerialize["results"] = o.Results + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsGetAPITestLatestResultsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` + Results []SyntheticsAPITestResultShort `json:"results,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LastTimestampFetched = all.LastTimestampFetched + o.Results = all.Results + return nil +} diff --git a/api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go b/api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go new file mode 100644 index 00000000000..232e3608fd5 --- /dev/null +++ b/api/v1/datadog/model_synthetics_get_browser_test_latest_results_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsGetBrowserTestLatestResultsResponse Object with the latest Synthetic browser test run. +type SyntheticsGetBrowserTestLatestResultsResponse struct { + // Timestamp of the latest browser test run. + LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` + // Result of the latest browser test run. + Results []SyntheticsBrowserTestResultShort `json:"results,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{} +} + +// NewSyntheticsGetBrowserTestLatestResultsResponse instantiates a new SyntheticsGetBrowserTestLatestResultsResponse 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 NewSyntheticsGetBrowserTestLatestResultsResponse() *SyntheticsGetBrowserTestLatestResultsResponse { + this := SyntheticsGetBrowserTestLatestResultsResponse{} + return &this +} + +// NewSyntheticsGetBrowserTestLatestResultsResponseWithDefaults instantiates a new SyntheticsGetBrowserTestLatestResultsResponse 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 NewSyntheticsGetBrowserTestLatestResultsResponseWithDefaults() *SyntheticsGetBrowserTestLatestResultsResponse { + this := SyntheticsGetBrowserTestLatestResultsResponse{} + return &this +} + +// GetLastTimestampFetched returns the LastTimestampFetched field value if set, zero value otherwise. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetLastTimestampFetched() int64 { + if o == nil || o.LastTimestampFetched == nil { + var ret int64 + return ret + } + return *o.LastTimestampFetched +} + +// GetLastTimestampFetchedOk returns a tuple with the LastTimestampFetched field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetLastTimestampFetchedOk() (*int64, bool) { + if o == nil || o.LastTimestampFetched == nil { + return nil, false + } + return o.LastTimestampFetched, true +} + +// HasLastTimestampFetched returns a boolean if a field has been set. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) HasLastTimestampFetched() bool { + if o != nil && o.LastTimestampFetched != nil { + return true + } + + return false +} + +// SetLastTimestampFetched gets a reference to the given int64 and assigns it to the LastTimestampFetched field. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) SetLastTimestampFetched(v int64) { + o.LastTimestampFetched = &v +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetResults() []SyntheticsBrowserTestResultShort { + if o == nil || o.Results == nil { + var ret []SyntheticsBrowserTestResultShort + return ret + } + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) GetResultsOk() (*[]SyntheticsBrowserTestResultShort, bool) { + if o == nil || o.Results == nil { + return nil, false + } + return &o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) HasResults() bool { + if o != nil && o.Results != nil { + return true + } + + return false +} + +// SetResults gets a reference to the given []SyntheticsBrowserTestResultShort and assigns it to the Results field. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) SetResults(v []SyntheticsBrowserTestResultShort) { + o.Results = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsGetBrowserTestLatestResultsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LastTimestampFetched != nil { + toSerialize["last_timestamp_fetched"] = o.LastTimestampFetched + } + if o.Results != nil { + toSerialize["results"] = o.Results + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsGetBrowserTestLatestResultsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` + Results []SyntheticsBrowserTestResultShort `json:"results,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LastTimestampFetched = all.LastTimestampFetched + o.Results = all.Results + return nil +} diff --git a/api/v1/datadog/model_synthetics_global_variable.go b/api/v1/datadog/model_synthetics_global_variable.go new file mode 100644 index 00000000000..90acdd414cf --- /dev/null +++ b/api/v1/datadog/model_synthetics_global_variable.go @@ -0,0 +1,379 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsGlobalVariable Synthetics global variable. +type SyntheticsGlobalVariable struct { + // Attributes of the global variable. + Attributes *SyntheticsGlobalVariableAttributes `json:"attributes,omitempty"` + // Description of the global variable. + Description string `json:"description"` + // Unique identifier of the global variable. + Id *string `json:"id,omitempty"` + // Name of the global variable. Unique across Synthetics global variables. + Name string `json:"name"` + // Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with `parse_test_public_id`. + ParseTestOptions *SyntheticsGlobalVariableParseTestOptions `json:"parse_test_options,omitempty"` + // A Synthetic test ID to use as a test to generate the variable value. + ParseTestPublicId *string `json:"parse_test_public_id,omitempty"` + // Tags of the global variable. + Tags []string `json:"tags"` + // Value of the global variable. + Value SyntheticsGlobalVariableValue `json:"value"` + // 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{} +} + +// NewSyntheticsGlobalVariable instantiates a new SyntheticsGlobalVariable 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 NewSyntheticsGlobalVariable(description string, name string, tags []string, value SyntheticsGlobalVariableValue) *SyntheticsGlobalVariable { + this := SyntheticsGlobalVariable{} + this.Description = description + this.Name = name + this.Tags = tags + this.Value = value + return &this +} + +// NewSyntheticsGlobalVariableWithDefaults instantiates a new SyntheticsGlobalVariable 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 NewSyntheticsGlobalVariableWithDefaults() *SyntheticsGlobalVariable { + this := SyntheticsGlobalVariable{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariable) GetAttributes() SyntheticsGlobalVariableAttributes { + if o == nil || o.Attributes == nil { + var ret SyntheticsGlobalVariableAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetAttributesOk() (*SyntheticsGlobalVariableAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariable) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SyntheticsGlobalVariableAttributes and assigns it to the Attributes field. +func (o *SyntheticsGlobalVariable) SetAttributes(v SyntheticsGlobalVariableAttributes) { + o.Attributes = &v +} + +// GetDescription returns the Description field value. +func (o *SyntheticsGlobalVariable) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *SyntheticsGlobalVariable) SetDescription(v string) { + o.Description = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariable) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariable) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SyntheticsGlobalVariable) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsGlobalVariable) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsGlobalVariable) SetName(v string) { + o.Name = v +} + +// GetParseTestOptions returns the ParseTestOptions field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariable) GetParseTestOptions() SyntheticsGlobalVariableParseTestOptions { + if o == nil || o.ParseTestOptions == nil { + var ret SyntheticsGlobalVariableParseTestOptions + return ret + } + return *o.ParseTestOptions +} + +// GetParseTestOptionsOk returns a tuple with the ParseTestOptions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetParseTestOptionsOk() (*SyntheticsGlobalVariableParseTestOptions, bool) { + if o == nil || o.ParseTestOptions == nil { + return nil, false + } + return o.ParseTestOptions, true +} + +// HasParseTestOptions returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariable) HasParseTestOptions() bool { + if o != nil && o.ParseTestOptions != nil { + return true + } + + return false +} + +// SetParseTestOptions gets a reference to the given SyntheticsGlobalVariableParseTestOptions and assigns it to the ParseTestOptions field. +func (o *SyntheticsGlobalVariable) SetParseTestOptions(v SyntheticsGlobalVariableParseTestOptions) { + o.ParseTestOptions = &v +} + +// GetParseTestPublicId returns the ParseTestPublicId field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariable) GetParseTestPublicId() string { + if o == nil || o.ParseTestPublicId == nil { + var ret string + return ret + } + return *o.ParseTestPublicId +} + +// GetParseTestPublicIdOk returns a tuple with the ParseTestPublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetParseTestPublicIdOk() (*string, bool) { + if o == nil || o.ParseTestPublicId == nil { + return nil, false + } + return o.ParseTestPublicId, true +} + +// HasParseTestPublicId returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariable) HasParseTestPublicId() bool { + if o != nil && o.ParseTestPublicId != nil { + return true + } + + return false +} + +// SetParseTestPublicId gets a reference to the given string and assigns it to the ParseTestPublicId field. +func (o *SyntheticsGlobalVariable) SetParseTestPublicId(v string) { + o.ParseTestPublicId = &v +} + +// GetTags returns the Tags field value. +func (o *SyntheticsGlobalVariable) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *SyntheticsGlobalVariable) SetTags(v []string) { + o.Tags = v +} + +// GetValue returns the Value field value. +func (o *SyntheticsGlobalVariable) GetValue() SyntheticsGlobalVariableValue { + if o == nil { + var ret SyntheticsGlobalVariableValue + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariable) GetValueOk() (*SyntheticsGlobalVariableValue, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *SyntheticsGlobalVariable) SetValue(v SyntheticsGlobalVariableValue) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsGlobalVariable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["description"] = o.Description + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["name"] = o.Name + if o.ParseTestOptions != nil { + toSerialize["parse_test_options"] = o.ParseTestOptions + } + if o.ParseTestPublicId != nil { + toSerialize["parse_test_public_id"] = o.ParseTestPublicId + } + toSerialize["tags"] = o.Tags + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Description *string `json:"description"` + Name *string `json:"name"` + Tags *[]string `json:"tags"` + Value *SyntheticsGlobalVariableValue `json:"value"` + }{} + all := struct { + Attributes *SyntheticsGlobalVariableAttributes `json:"attributes,omitempty"` + Description string `json:"description"` + Id *string `json:"id,omitempty"` + Name string `json:"name"` + ParseTestOptions *SyntheticsGlobalVariableParseTestOptions `json:"parse_test_options,omitempty"` + ParseTestPublicId *string `json:"parse_test_public_id,omitempty"` + Tags []string `json:"tags"` + Value SyntheticsGlobalVariableValue `json:"value"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Description == nil { + return fmt.Errorf("Required field description missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Tags == nil { + return fmt.Errorf("Required field tags missing") + } + if required.Value == nil { + return fmt.Errorf("Required field value missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Description = all.Description + o.Id = all.Id + o.Name = all.Name + if all.ParseTestOptions != nil && all.ParseTestOptions.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ParseTestOptions = all.ParseTestOptions + o.ParseTestPublicId = all.ParseTestPublicId + o.Tags = all.Tags + if all.Value.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_synthetics_global_variable_attributes.go b/api/v1/datadog/model_synthetics_global_variable_attributes.go new file mode 100644 index 00000000000..709d27cc6eb --- /dev/null +++ b/api/v1/datadog/model_synthetics_global_variable_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 datadog + +import ( + "encoding/json" +) + +// SyntheticsGlobalVariableAttributes Attributes of the global variable. +type SyntheticsGlobalVariableAttributes struct { + // A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. + RestrictedRoles []string `json:"restricted_roles,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{} +} + +// NewSyntheticsGlobalVariableAttributes instantiates a new SyntheticsGlobalVariableAttributes 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 NewSyntheticsGlobalVariableAttributes() *SyntheticsGlobalVariableAttributes { + this := SyntheticsGlobalVariableAttributes{} + return &this +} + +// NewSyntheticsGlobalVariableAttributesWithDefaults instantiates a new SyntheticsGlobalVariableAttributes 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 NewSyntheticsGlobalVariableAttributesWithDefaults() *SyntheticsGlobalVariableAttributes { + this := SyntheticsGlobalVariableAttributes{} + return &this +} + +// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariableAttributes) GetRestrictedRoles() []string { + if o == nil || o.RestrictedRoles == nil { + var ret []string + return ret + } + return o.RestrictedRoles +} + +// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariableAttributes) GetRestrictedRolesOk() (*[]string, bool) { + if o == nil || o.RestrictedRoles == nil { + return nil, false + } + return &o.RestrictedRoles, true +} + +// HasRestrictedRoles returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariableAttributes) HasRestrictedRoles() bool { + if o != nil && o.RestrictedRoles != nil { + return true + } + + return false +} + +// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. +func (o *SyntheticsGlobalVariableAttributes) SetRestrictedRoles(v []string) { + o.RestrictedRoles = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsGlobalVariableAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.RestrictedRoles != nil { + toSerialize["restricted_roles"] = o.RestrictedRoles + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsGlobalVariableAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + RestrictedRoles []string `json:"restricted_roles,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.RestrictedRoles = all.RestrictedRoles + return nil +} diff --git a/api/v1/datadog/model_synthetics_global_variable_parse_test_options.go b/api/v1/datadog/model_synthetics_global_variable_parse_test_options.go new file mode 100644 index 00000000000..d6595257e0c --- /dev/null +++ b/api/v1/datadog/model_synthetics_global_variable_parse_test_options.go @@ -0,0 +1,190 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsGlobalVariableParseTestOptions Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with `parse_test_public_id`. +type SyntheticsGlobalVariableParseTestOptions struct { + // When type is `http_header`, name of the header to use to extract the value. + Field *string `json:"field,omitempty"` + // Details of the parser to use for the global variable. + Parser SyntheticsVariableParser `json:"parser"` + // Property of the Synthetics Test Response to use for a Synthetics global variable. + Type SyntheticsGlobalVariableParseTestOptionsType `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{} +} + +// NewSyntheticsGlobalVariableParseTestOptions instantiates a new SyntheticsGlobalVariableParseTestOptions 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 NewSyntheticsGlobalVariableParseTestOptions(parser SyntheticsVariableParser, typeVar SyntheticsGlobalVariableParseTestOptionsType) *SyntheticsGlobalVariableParseTestOptions { + this := SyntheticsGlobalVariableParseTestOptions{} + this.Parser = parser + this.Type = typeVar + return &this +} + +// NewSyntheticsGlobalVariableParseTestOptionsWithDefaults instantiates a new SyntheticsGlobalVariableParseTestOptions 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 NewSyntheticsGlobalVariableParseTestOptionsWithDefaults() *SyntheticsGlobalVariableParseTestOptions { + this := SyntheticsGlobalVariableParseTestOptions{} + return &this +} + +// GetField returns the Field field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariableParseTestOptions) GetField() string { + if o == nil || o.Field == nil { + var ret string + return ret + } + return *o.Field +} + +// GetFieldOk returns a tuple with the Field field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariableParseTestOptions) GetFieldOk() (*string, bool) { + if o == nil || o.Field == nil { + return nil, false + } + return o.Field, true +} + +// HasField returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariableParseTestOptions) HasField() bool { + if o != nil && o.Field != nil { + return true + } + + return false +} + +// SetField gets a reference to the given string and assigns it to the Field field. +func (o *SyntheticsGlobalVariableParseTestOptions) SetField(v string) { + o.Field = &v +} + +// GetParser returns the Parser field value. +func (o *SyntheticsGlobalVariableParseTestOptions) GetParser() SyntheticsVariableParser { + if o == nil { + var ret SyntheticsVariableParser + return ret + } + return o.Parser +} + +// GetParserOk returns a tuple with the Parser field value +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariableParseTestOptions) GetParserOk() (*SyntheticsVariableParser, bool) { + if o == nil { + return nil, false + } + return &o.Parser, true +} + +// SetParser sets field value. +func (o *SyntheticsGlobalVariableParseTestOptions) SetParser(v SyntheticsVariableParser) { + o.Parser = v +} + +// GetType returns the Type field value. +func (o *SyntheticsGlobalVariableParseTestOptions) GetType() SyntheticsGlobalVariableParseTestOptionsType { + if o == nil { + var ret SyntheticsGlobalVariableParseTestOptionsType + 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 *SyntheticsGlobalVariableParseTestOptions) GetTypeOk() (*SyntheticsGlobalVariableParseTestOptionsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsGlobalVariableParseTestOptions) SetType(v SyntheticsGlobalVariableParseTestOptionsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsGlobalVariableParseTestOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Field != nil { + toSerialize["field"] = o.Field + } + toSerialize["parser"] = o.Parser + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Parser *SyntheticsVariableParser `json:"parser"` + Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type"` + }{} + all := struct { + Field *string `json:"field,omitempty"` + Parser SyntheticsVariableParser `json:"parser"` + Type SyntheticsGlobalVariableParseTestOptionsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Parser == nil { + return fmt.Errorf("Required field parser missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Field = all.Field + if all.Parser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Parser = all.Parser + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go b/api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go new file mode 100644 index 00000000000..7422775dd2d --- /dev/null +++ b/api/v1/datadog/model_synthetics_global_variable_parse_test_options_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsGlobalVariableParseTestOptionsType Property of the Synthetics Test Response to use for a Synthetics global variable. +type SyntheticsGlobalVariableParseTestOptionsType string + +// List of SyntheticsGlobalVariableParseTestOptionsType. +const ( + SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY SyntheticsGlobalVariableParseTestOptionsType = "http_body" + SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER SyntheticsGlobalVariableParseTestOptionsType = "http_header" +) + +var allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues = []SyntheticsGlobalVariableParseTestOptionsType{ + SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY, + SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsGlobalVariableParseTestOptionsType) GetAllowedValues() []SyntheticsGlobalVariableParseTestOptionsType { + return allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsGlobalVariableParseTestOptionsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsGlobalVariableParseTestOptionsType(value) + return nil +} + +// NewSyntheticsGlobalVariableParseTestOptionsTypeFromValue returns a pointer to a valid SyntheticsGlobalVariableParseTestOptionsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsGlobalVariableParseTestOptionsTypeFromValue(v string) (*SyntheticsGlobalVariableParseTestOptionsType, error) { + ev := SyntheticsGlobalVariableParseTestOptionsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsGlobalVariableParseTestOptionsType: valid values are %v", v, allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsGlobalVariableParseTestOptionsType) IsValid() bool { + for _, existing := range allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsGlobalVariableParseTestOptionsType value. +func (v SyntheticsGlobalVariableParseTestOptionsType) Ptr() *SyntheticsGlobalVariableParseTestOptionsType { + return &v +} + +// NullableSyntheticsGlobalVariableParseTestOptionsType handles when a null is used for SyntheticsGlobalVariableParseTestOptionsType. +type NullableSyntheticsGlobalVariableParseTestOptionsType struct { + value *SyntheticsGlobalVariableParseTestOptionsType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsGlobalVariableParseTestOptionsType) Get() *SyntheticsGlobalVariableParseTestOptionsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) Set(val *SyntheticsGlobalVariableParseTestOptionsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsGlobalVariableParseTestOptionsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsGlobalVariableParseTestOptionsType initializes the struct as if Set has been called. +func NewNullableSyntheticsGlobalVariableParseTestOptionsType(val *SyntheticsGlobalVariableParseTestOptionsType) *NullableSyntheticsGlobalVariableParseTestOptionsType { + return &NullableSyntheticsGlobalVariableParseTestOptionsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsGlobalVariableParseTestOptionsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsGlobalVariableParseTestOptionsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_global_variable_parser_type.go b/api/v1/datadog/model_synthetics_global_variable_parser_type.go new file mode 100644 index 00000000000..f389f8a5310 --- /dev/null +++ b/api/v1/datadog/model_synthetics_global_variable_parser_type.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsGlobalVariableParserType Type of parser for a Synthetics global variable from a synthetics test. +type SyntheticsGlobalVariableParserType string + +// List of SyntheticsGlobalVariableParserType. +const ( + SYNTHETICSGLOBALVARIABLEPARSERTYPE_RAW SyntheticsGlobalVariableParserType = "raw" + SYNTHETICSGLOBALVARIABLEPARSERTYPE_JSON_PATH SyntheticsGlobalVariableParserType = "json_path" + SYNTHETICSGLOBALVARIABLEPARSERTYPE_REGEX SyntheticsGlobalVariableParserType = "regex" + SYNTHETICSGLOBALVARIABLEPARSERTYPE_X_PATH SyntheticsGlobalVariableParserType = "x_path" +) + +var allowedSyntheticsGlobalVariableParserTypeEnumValues = []SyntheticsGlobalVariableParserType{ + SYNTHETICSGLOBALVARIABLEPARSERTYPE_RAW, + SYNTHETICSGLOBALVARIABLEPARSERTYPE_JSON_PATH, + SYNTHETICSGLOBALVARIABLEPARSERTYPE_REGEX, + SYNTHETICSGLOBALVARIABLEPARSERTYPE_X_PATH, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsGlobalVariableParserType) GetAllowedValues() []SyntheticsGlobalVariableParserType { + return allowedSyntheticsGlobalVariableParserTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsGlobalVariableParserType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsGlobalVariableParserType(value) + return nil +} + +// NewSyntheticsGlobalVariableParserTypeFromValue returns a pointer to a valid SyntheticsGlobalVariableParserType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsGlobalVariableParserTypeFromValue(v string) (*SyntheticsGlobalVariableParserType, error) { + ev := SyntheticsGlobalVariableParserType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsGlobalVariableParserType: valid values are %v", v, allowedSyntheticsGlobalVariableParserTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsGlobalVariableParserType) IsValid() bool { + for _, existing := range allowedSyntheticsGlobalVariableParserTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsGlobalVariableParserType value. +func (v SyntheticsGlobalVariableParserType) Ptr() *SyntheticsGlobalVariableParserType { + return &v +} + +// NullableSyntheticsGlobalVariableParserType handles when a null is used for SyntheticsGlobalVariableParserType. +type NullableSyntheticsGlobalVariableParserType struct { + value *SyntheticsGlobalVariableParserType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsGlobalVariableParserType) Get() *SyntheticsGlobalVariableParserType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsGlobalVariableParserType) Set(val *SyntheticsGlobalVariableParserType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsGlobalVariableParserType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsGlobalVariableParserType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsGlobalVariableParserType initializes the struct as if Set has been called. +func NewNullableSyntheticsGlobalVariableParserType(val *SyntheticsGlobalVariableParserType) *NullableSyntheticsGlobalVariableParserType { + return &NullableSyntheticsGlobalVariableParserType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsGlobalVariableParserType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsGlobalVariableParserType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_global_variable_value.go b/api/v1/datadog/model_synthetics_global_variable_value.go new file mode 100644 index 00000000000..38d008c8567 --- /dev/null +++ b/api/v1/datadog/model_synthetics_global_variable_value.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsGlobalVariableValue Value of the global variable. +type SyntheticsGlobalVariableValue struct { + // Determines if the value of the variable is hidden. + Secure *bool `json:"secure,omitempty"` + // Value of the global variable. When reading a global variable, + // the value will not be present if the variable is hidden with the `secure` property. + Value *string `json:"value,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{} +} + +// NewSyntheticsGlobalVariableValue instantiates a new SyntheticsGlobalVariableValue 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 NewSyntheticsGlobalVariableValue() *SyntheticsGlobalVariableValue { + this := SyntheticsGlobalVariableValue{} + return &this +} + +// NewSyntheticsGlobalVariableValueWithDefaults instantiates a new SyntheticsGlobalVariableValue 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 NewSyntheticsGlobalVariableValueWithDefaults() *SyntheticsGlobalVariableValue { + this := SyntheticsGlobalVariableValue{} + return &this +} + +// GetSecure returns the Secure field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariableValue) GetSecure() bool { + if o == nil || o.Secure == nil { + var ret bool + return ret + } + return *o.Secure +} + +// GetSecureOk returns a tuple with the Secure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariableValue) GetSecureOk() (*bool, bool) { + if o == nil || o.Secure == nil { + return nil, false + } + return o.Secure, true +} + +// HasSecure returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariableValue) HasSecure() bool { + if o != nil && o.Secure != nil { + return true + } + + return false +} + +// SetSecure gets a reference to the given bool and assigns it to the Secure field. +func (o *SyntheticsGlobalVariableValue) SetSecure(v bool) { + o.Secure = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SyntheticsGlobalVariableValue) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsGlobalVariableValue) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *SyntheticsGlobalVariableValue) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *SyntheticsGlobalVariableValue) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsGlobalVariableValue) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Secure != nil { + toSerialize["secure"] = o.Secure + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsGlobalVariableValue) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Secure *bool `json:"secure,omitempty"` + Value *string `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Secure = all.Secure + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_synthetics_list_global_variables_response.go b/api/v1/datadog/model_synthetics_list_global_variables_response.go new file mode 100644 index 00000000000..3e7d841c62f --- /dev/null +++ b/api/v1/datadog/model_synthetics_list_global_variables_response.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsListGlobalVariablesResponse Object containing an array of Synthetic global variables. +type SyntheticsListGlobalVariablesResponse struct { + // Array of Synthetic global variables. + Variables []SyntheticsGlobalVariable `json:"variables,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{} +} + +// NewSyntheticsListGlobalVariablesResponse instantiates a new SyntheticsListGlobalVariablesResponse 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 NewSyntheticsListGlobalVariablesResponse() *SyntheticsListGlobalVariablesResponse { + this := SyntheticsListGlobalVariablesResponse{} + return &this +} + +// NewSyntheticsListGlobalVariablesResponseWithDefaults instantiates a new SyntheticsListGlobalVariablesResponse 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 NewSyntheticsListGlobalVariablesResponseWithDefaults() *SyntheticsListGlobalVariablesResponse { + this := SyntheticsListGlobalVariablesResponse{} + return &this +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *SyntheticsListGlobalVariablesResponse) GetVariables() []SyntheticsGlobalVariable { + if o == nil || o.Variables == nil { + var ret []SyntheticsGlobalVariable + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsListGlobalVariablesResponse) GetVariablesOk() (*[]SyntheticsGlobalVariable, bool) { + if o == nil || o.Variables == nil { + return nil, false + } + return &o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *SyntheticsListGlobalVariablesResponse) HasVariables() bool { + if o != nil && o.Variables != nil { + return true + } + + return false +} + +// SetVariables gets a reference to the given []SyntheticsGlobalVariable and assigns it to the Variables field. +func (o *SyntheticsListGlobalVariablesResponse) SetVariables(v []SyntheticsGlobalVariable) { + o.Variables = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsListGlobalVariablesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Variables != nil { + toSerialize["variables"] = o.Variables + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsListGlobalVariablesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Variables []SyntheticsGlobalVariable `json:"variables,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Variables = all.Variables + return nil +} diff --git a/api/v1/datadog/model_synthetics_list_tests_response.go b/api/v1/datadog/model_synthetics_list_tests_response.go new file mode 100644 index 00000000000..c3a209ed501 --- /dev/null +++ b/api/v1/datadog/model_synthetics_list_tests_response.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsListTestsResponse Object containing an array of Synthetic tests configuration. +type SyntheticsListTestsResponse struct { + // Array of Synthetic tests configuration. + Tests []SyntheticsTestDetails `json:"tests,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{} +} + +// NewSyntheticsListTestsResponse instantiates a new SyntheticsListTestsResponse 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 NewSyntheticsListTestsResponse() *SyntheticsListTestsResponse { + this := SyntheticsListTestsResponse{} + return &this +} + +// NewSyntheticsListTestsResponseWithDefaults instantiates a new SyntheticsListTestsResponse 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 NewSyntheticsListTestsResponseWithDefaults() *SyntheticsListTestsResponse { + this := SyntheticsListTestsResponse{} + return &this +} + +// GetTests returns the Tests field value if set, zero value otherwise. +func (o *SyntheticsListTestsResponse) GetTests() []SyntheticsTestDetails { + if o == nil || o.Tests == nil { + var ret []SyntheticsTestDetails + return ret + } + return o.Tests +} + +// GetTestsOk returns a tuple with the Tests field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsListTestsResponse) GetTestsOk() (*[]SyntheticsTestDetails, bool) { + if o == nil || o.Tests == nil { + return nil, false + } + return &o.Tests, true +} + +// HasTests returns a boolean if a field has been set. +func (o *SyntheticsListTestsResponse) HasTests() bool { + if o != nil && o.Tests != nil { + return true + } + + return false +} + +// SetTests gets a reference to the given []SyntheticsTestDetails and assigns it to the Tests field. +func (o *SyntheticsListTestsResponse) SetTests(v []SyntheticsTestDetails) { + o.Tests = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsListTestsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Tests != nil { + toSerialize["tests"] = o.Tests + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsListTestsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Tests []SyntheticsTestDetails `json:"tests,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Tests = all.Tests + return nil +} diff --git a/api/v1/datadog/model_synthetics_location.go b/api/v1/datadog/model_synthetics_location.go new file mode 100644 index 00000000000..63226bcab80 --- /dev/null +++ b/api/v1/datadog/model_synthetics_location.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsLocation Synthetic location that can be used when creating or editing a +// test. +type SyntheticsLocation struct { + // Unique identifier of the location. + Id *string `json:"id,omitempty"` + // Name of the location. + Name *string `json:"name,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{} +} + +// NewSyntheticsLocation instantiates a new SyntheticsLocation 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 NewSyntheticsLocation() *SyntheticsLocation { + this := SyntheticsLocation{} + return &this +} + +// NewSyntheticsLocationWithDefaults instantiates a new SyntheticsLocation 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 NewSyntheticsLocationWithDefaults() *SyntheticsLocation { + this := SyntheticsLocation{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsLocation) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsLocation) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsLocation) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SyntheticsLocation) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsLocation) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsLocation) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SyntheticsLocation) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsLocation) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsLocation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsLocation) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_synthetics_locations.go b/api/v1/datadog/model_synthetics_locations.go new file mode 100644 index 00000000000..498df4fb190 --- /dev/null +++ b/api/v1/datadog/model_synthetics_locations.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsLocations List of Synthetics locations. +type SyntheticsLocations struct { + // List of Synthetics locations. + Locations []SyntheticsLocation `json:"locations,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{} +} + +// NewSyntheticsLocations instantiates a new SyntheticsLocations 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 NewSyntheticsLocations() *SyntheticsLocations { + this := SyntheticsLocations{} + return &this +} + +// NewSyntheticsLocationsWithDefaults instantiates a new SyntheticsLocations 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 NewSyntheticsLocationsWithDefaults() *SyntheticsLocations { + this := SyntheticsLocations{} + return &this +} + +// GetLocations returns the Locations field value if set, zero value otherwise. +func (o *SyntheticsLocations) GetLocations() []SyntheticsLocation { + if o == nil || o.Locations == nil { + var ret []SyntheticsLocation + return ret + } + return o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsLocations) GetLocationsOk() (*[]SyntheticsLocation, bool) { + if o == nil || o.Locations == nil { + return nil, false + } + return &o.Locations, true +} + +// HasLocations returns a boolean if a field has been set. +func (o *SyntheticsLocations) HasLocations() bool { + if o != nil && o.Locations != nil { + return true + } + + return false +} + +// SetLocations gets a reference to the given []SyntheticsLocation and assigns it to the Locations field. +func (o *SyntheticsLocations) SetLocations(v []SyntheticsLocation) { + o.Locations = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsLocations) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Locations != nil { + toSerialize["locations"] = o.Locations + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsLocations) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Locations []SyntheticsLocation `json:"locations,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Locations = all.Locations + return nil +} diff --git a/api/v1/datadog/model_synthetics_parsing_options.go b/api/v1/datadog/model_synthetics_parsing_options.go new file mode 100644 index 00000000000..7623adf26ea --- /dev/null +++ b/api/v1/datadog/model_synthetics_parsing_options.go @@ -0,0 +1,234 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsParsingOptions Parsing options for variables to extract. +type SyntheticsParsingOptions struct { + // When type is `http_header`, name of the header to use to extract the value. + Field *string `json:"field,omitempty"` + // Name of the variable to extract. + Name *string `json:"name,omitempty"` + // Details of the parser to use for the global variable. + Parser *SyntheticsVariableParser `json:"parser,omitempty"` + // Property of the Synthetics Test Response to use for a Synthetics global variable. + Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type,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{} +} + +// NewSyntheticsParsingOptions instantiates a new SyntheticsParsingOptions 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 NewSyntheticsParsingOptions() *SyntheticsParsingOptions { + this := SyntheticsParsingOptions{} + return &this +} + +// NewSyntheticsParsingOptionsWithDefaults instantiates a new SyntheticsParsingOptions 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 NewSyntheticsParsingOptionsWithDefaults() *SyntheticsParsingOptions { + this := SyntheticsParsingOptions{} + return &this +} + +// GetField returns the Field field value if set, zero value otherwise. +func (o *SyntheticsParsingOptions) GetField() string { + if o == nil || o.Field == nil { + var ret string + return ret + } + return *o.Field +} + +// GetFieldOk returns a tuple with the Field field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsParsingOptions) GetFieldOk() (*string, bool) { + if o == nil || o.Field == nil { + return nil, false + } + return o.Field, true +} + +// HasField returns a boolean if a field has been set. +func (o *SyntheticsParsingOptions) HasField() bool { + if o != nil && o.Field != nil { + return true + } + + return false +} + +// SetField gets a reference to the given string and assigns it to the Field field. +func (o *SyntheticsParsingOptions) SetField(v string) { + o.Field = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsParsingOptions) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsParsingOptions) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SyntheticsParsingOptions) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsParsingOptions) SetName(v string) { + o.Name = &v +} + +// GetParser returns the Parser field value if set, zero value otherwise. +func (o *SyntheticsParsingOptions) GetParser() SyntheticsVariableParser { + if o == nil || o.Parser == nil { + var ret SyntheticsVariableParser + return ret + } + return *o.Parser +} + +// GetParserOk returns a tuple with the Parser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsParsingOptions) GetParserOk() (*SyntheticsVariableParser, bool) { + if o == nil || o.Parser == nil { + return nil, false + } + return o.Parser, true +} + +// HasParser returns a boolean if a field has been set. +func (o *SyntheticsParsingOptions) HasParser() bool { + if o != nil && o.Parser != nil { + return true + } + + return false +} + +// SetParser gets a reference to the given SyntheticsVariableParser and assigns it to the Parser field. +func (o *SyntheticsParsingOptions) SetParser(v SyntheticsVariableParser) { + o.Parser = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsParsingOptions) GetType() SyntheticsGlobalVariableParseTestOptionsType { + if o == nil || o.Type == nil { + var ret SyntheticsGlobalVariableParseTestOptionsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsParsingOptions) GetTypeOk() (*SyntheticsGlobalVariableParseTestOptionsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsParsingOptions) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsGlobalVariableParseTestOptionsType and assigns it to the Type field. +func (o *SyntheticsParsingOptions) SetType(v SyntheticsGlobalVariableParseTestOptionsType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsParsingOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Field != nil { + toSerialize["field"] = o.Field + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Parser != nil { + toSerialize["parser"] = o.Parser + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsParsingOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Field *string `json:"field,omitempty"` + Name *string `json:"name,omitempty"` + Parser *SyntheticsVariableParser `json:"parser,omitempty"` + Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Field = all.Field + o.Name = all.Name + if all.Parser != nil && all.Parser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Parser = all.Parser + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_playing_tab.go b/api/v1/datadog/model_synthetics_playing_tab.go new file mode 100644 index 00000000000..cd518a468dc --- /dev/null +++ b/api/v1/datadog/model_synthetics_playing_tab.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsPlayingTab Navigate between different tabs for your browser test. +type SyntheticsPlayingTab int64 + +// List of SyntheticsPlayingTab. +const ( + SYNTHETICSPLAYINGTAB_MAIN_TAB SyntheticsPlayingTab = -1 + SYNTHETICSPLAYINGTAB_NEW_TAB SyntheticsPlayingTab = 0 + SYNTHETICSPLAYINGTAB_TAB_1 SyntheticsPlayingTab = 1 + SYNTHETICSPLAYINGTAB_TAB_2 SyntheticsPlayingTab = 2 + SYNTHETICSPLAYINGTAB_TAB_3 SyntheticsPlayingTab = 3 +) + +var allowedSyntheticsPlayingTabEnumValues = []SyntheticsPlayingTab{ + SYNTHETICSPLAYINGTAB_MAIN_TAB, + SYNTHETICSPLAYINGTAB_NEW_TAB, + SYNTHETICSPLAYINGTAB_TAB_1, + SYNTHETICSPLAYINGTAB_TAB_2, + SYNTHETICSPLAYINGTAB_TAB_3, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsPlayingTab) GetAllowedValues() []SyntheticsPlayingTab { + return allowedSyntheticsPlayingTabEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsPlayingTab) UnmarshalJSON(src []byte) error { + var value int64 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsPlayingTab(value) + return nil +} + +// NewSyntheticsPlayingTabFromValue returns a pointer to a valid SyntheticsPlayingTab +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsPlayingTabFromValue(v int64) (*SyntheticsPlayingTab, error) { + ev := SyntheticsPlayingTab(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsPlayingTab: valid values are %v", v, allowedSyntheticsPlayingTabEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsPlayingTab) IsValid() bool { + for _, existing := range allowedSyntheticsPlayingTabEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsPlayingTab value. +func (v SyntheticsPlayingTab) Ptr() *SyntheticsPlayingTab { + return &v +} + +// NullableSyntheticsPlayingTab handles when a null is used for SyntheticsPlayingTab. +type NullableSyntheticsPlayingTab struct { + value *SyntheticsPlayingTab + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsPlayingTab) Get() *SyntheticsPlayingTab { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsPlayingTab) Set(val *SyntheticsPlayingTab) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsPlayingTab) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsPlayingTab) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsPlayingTab initializes the struct as if Set has been called. +func NewNullableSyntheticsPlayingTab(val *SyntheticsPlayingTab) *NullableSyntheticsPlayingTab { + return &NullableSyntheticsPlayingTab{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsPlayingTab) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsPlayingTab) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_private_location.go b/api/v1/datadog/model_synthetics_private_location.go new file mode 100644 index 00000000000..0c9d5f483f1 --- /dev/null +++ b/api/v1/datadog/model_synthetics_private_location.go @@ -0,0 +1,300 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsPrivateLocation Object containing information about the private location to create. +type SyntheticsPrivateLocation struct { + // Description of the private location. + Description string `json:"description"` + // Unique identifier of the private location. + Id *string `json:"id,omitempty"` + // Object containing metadata about the private location. + Metadata *SyntheticsPrivateLocationMetadata `json:"metadata,omitempty"` + // Name of the private location. + Name string `json:"name"` + // Secrets for the private location. Only present in the response when creating the private location. + Secrets *SyntheticsPrivateLocationSecrets `json:"secrets,omitempty"` + // Array of tags attached to the private location. + Tags []string `json:"tags"` + // 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{} +} + +// NewSyntheticsPrivateLocation instantiates a new SyntheticsPrivateLocation 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 NewSyntheticsPrivateLocation(description string, name string, tags []string) *SyntheticsPrivateLocation { + this := SyntheticsPrivateLocation{} + this.Description = description + this.Name = name + this.Tags = tags + return &this +} + +// NewSyntheticsPrivateLocationWithDefaults instantiates a new SyntheticsPrivateLocation 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 NewSyntheticsPrivateLocationWithDefaults() *SyntheticsPrivateLocation { + this := SyntheticsPrivateLocation{} + return &this +} + +// GetDescription returns the Description field value. +func (o *SyntheticsPrivateLocation) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocation) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *SyntheticsPrivateLocation) SetDescription(v string) { + o.Description = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocation) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocation) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocation) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SyntheticsPrivateLocation) SetId(v string) { + o.Id = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocation) GetMetadata() SyntheticsPrivateLocationMetadata { + if o == nil || o.Metadata == nil { + var ret SyntheticsPrivateLocationMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocation) GetMetadataOk() (*SyntheticsPrivateLocationMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocation) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given SyntheticsPrivateLocationMetadata and assigns it to the Metadata field. +func (o *SyntheticsPrivateLocation) SetMetadata(v SyntheticsPrivateLocationMetadata) { + o.Metadata = &v +} + +// GetName returns the Name field value. +func (o *SyntheticsPrivateLocation) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocation) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsPrivateLocation) SetName(v string) { + o.Name = v +} + +// GetSecrets returns the Secrets field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocation) GetSecrets() SyntheticsPrivateLocationSecrets { + if o == nil || o.Secrets == nil { + var ret SyntheticsPrivateLocationSecrets + return ret + } + return *o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocation) GetSecretsOk() (*SyntheticsPrivateLocationSecrets, bool) { + if o == nil || o.Secrets == nil { + return nil, false + } + return o.Secrets, true +} + +// HasSecrets returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocation) HasSecrets() bool { + if o != nil && o.Secrets != nil { + return true + } + + return false +} + +// SetSecrets gets a reference to the given SyntheticsPrivateLocationSecrets and assigns it to the Secrets field. +func (o *SyntheticsPrivateLocation) SetSecrets(v SyntheticsPrivateLocationSecrets) { + o.Secrets = &v +} + +// GetTags returns the Tags field value. +func (o *SyntheticsPrivateLocation) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocation) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *SyntheticsPrivateLocation) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsPrivateLocation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["description"] = o.Description + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["name"] = o.Name + if o.Secrets != nil { + toSerialize["secrets"] = o.Secrets + } + toSerialize["tags"] = o.Tags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Description *string `json:"description"` + Name *string `json:"name"` + Tags *[]string `json:"tags"` + }{} + all := struct { + Description string `json:"description"` + Id *string `json:"id,omitempty"` + Metadata *SyntheticsPrivateLocationMetadata `json:"metadata,omitempty"` + Name string `json:"name"` + Secrets *SyntheticsPrivateLocationSecrets `json:"secrets,omitempty"` + Tags []string `json:"tags"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Description == nil { + return fmt.Errorf("Required field description missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Tags == nil { + return fmt.Errorf("Required field tags missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Description = all.Description + o.Id = all.Id + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Name = all.Name + if all.Secrets != nil && all.Secrets.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Secrets = all.Secrets + o.Tags = all.Tags + return nil +} diff --git a/api/v1/datadog/model_synthetics_private_location_creation_response.go b/api/v1/datadog/model_synthetics_private_location_creation_response.go new file mode 100644 index 00000000000..95198ab7343 --- /dev/null +++ b/api/v1/datadog/model_synthetics_private_location_creation_response.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsPrivateLocationCreationResponse Object that contains the new private location, the public key for result encryption, and the configuration skeleton. +type SyntheticsPrivateLocationCreationResponse struct { + // Configuration skeleton for the private location. See installation instructions of the private location on how to use this configuration. + Config interface{} `json:"config,omitempty"` + // Object containing information about the private location to create. + PrivateLocation *SyntheticsPrivateLocation `json:"private_location,omitempty"` + // Public key for the result encryption. + ResultEncryption *SyntheticsPrivateLocationCreationResponseResultEncryption `json:"result_encryption,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{} +} + +// NewSyntheticsPrivateLocationCreationResponse instantiates a new SyntheticsPrivateLocationCreationResponse 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 NewSyntheticsPrivateLocationCreationResponse() *SyntheticsPrivateLocationCreationResponse { + this := SyntheticsPrivateLocationCreationResponse{} + return &this +} + +// NewSyntheticsPrivateLocationCreationResponseWithDefaults instantiates a new SyntheticsPrivateLocationCreationResponse 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 NewSyntheticsPrivateLocationCreationResponseWithDefaults() *SyntheticsPrivateLocationCreationResponse { + this := SyntheticsPrivateLocationCreationResponse{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationCreationResponse) GetConfig() interface{} { + if o == nil || o.Config == nil { + var ret interface{} + 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 *SyntheticsPrivateLocationCreationResponse) GetConfigOk() (*interface{}, 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 *SyntheticsPrivateLocationCreationResponse) HasConfig() bool { + if o != nil && o.Config != nil { + return true + } + + return false +} + +// SetConfig gets a reference to the given interface{} and assigns it to the Config field. +func (o *SyntheticsPrivateLocationCreationResponse) SetConfig(v interface{}) { + o.Config = v +} + +// GetPrivateLocation returns the PrivateLocation field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationCreationResponse) GetPrivateLocation() SyntheticsPrivateLocation { + if o == nil || o.PrivateLocation == nil { + var ret SyntheticsPrivateLocation + return ret + } + return *o.PrivateLocation +} + +// GetPrivateLocationOk returns a tuple with the PrivateLocation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationCreationResponse) GetPrivateLocationOk() (*SyntheticsPrivateLocation, bool) { + if o == nil || o.PrivateLocation == nil { + return nil, false + } + return o.PrivateLocation, true +} + +// HasPrivateLocation returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationCreationResponse) HasPrivateLocation() bool { + if o != nil && o.PrivateLocation != nil { + return true + } + + return false +} + +// SetPrivateLocation gets a reference to the given SyntheticsPrivateLocation and assigns it to the PrivateLocation field. +func (o *SyntheticsPrivateLocationCreationResponse) SetPrivateLocation(v SyntheticsPrivateLocation) { + o.PrivateLocation = &v +} + +// GetResultEncryption returns the ResultEncryption field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationCreationResponse) GetResultEncryption() SyntheticsPrivateLocationCreationResponseResultEncryption { + if o == nil || o.ResultEncryption == nil { + var ret SyntheticsPrivateLocationCreationResponseResultEncryption + return ret + } + return *o.ResultEncryption +} + +// GetResultEncryptionOk returns a tuple with the ResultEncryption field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationCreationResponse) GetResultEncryptionOk() (*SyntheticsPrivateLocationCreationResponseResultEncryption, bool) { + if o == nil || o.ResultEncryption == nil { + return nil, false + } + return o.ResultEncryption, true +} + +// HasResultEncryption returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationCreationResponse) HasResultEncryption() bool { + if o != nil && o.ResultEncryption != nil { + return true + } + + return false +} + +// SetResultEncryption gets a reference to the given SyntheticsPrivateLocationCreationResponseResultEncryption and assigns it to the ResultEncryption field. +func (o *SyntheticsPrivateLocationCreationResponse) SetResultEncryption(v SyntheticsPrivateLocationCreationResponseResultEncryption) { + o.ResultEncryption = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsPrivateLocationCreationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Config != nil { + toSerialize["config"] = o.Config + } + if o.PrivateLocation != nil { + toSerialize["private_location"] = o.PrivateLocation + } + if o.ResultEncryption != nil { + toSerialize["result_encryption"] = o.ResultEncryption + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsPrivateLocationCreationResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Config interface{} `json:"config,omitempty"` + PrivateLocation *SyntheticsPrivateLocation `json:"private_location,omitempty"` + ResultEncryption *SyntheticsPrivateLocationCreationResponseResultEncryption `json:"result_encryption,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Config = all.Config + if all.PrivateLocation != nil && all.PrivateLocation.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.PrivateLocation = all.PrivateLocation + if all.ResultEncryption != nil && all.ResultEncryption.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ResultEncryption = all.ResultEncryption + return nil +} diff --git a/api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go b/api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go new file mode 100644 index 00000000000..e8283780af5 --- /dev/null +++ b/api/v1/datadog/model_synthetics_private_location_creation_response_result_encryption.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsPrivateLocationCreationResponseResultEncryption Public key for the result encryption. +type SyntheticsPrivateLocationCreationResponseResultEncryption struct { + // Fingerprint for the encryption key. + Id *string `json:"id,omitempty"` + // Public key for result encryption. + Key *string `json:"key,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{} +} + +// NewSyntheticsPrivateLocationCreationResponseResultEncryption instantiates a new SyntheticsPrivateLocationCreationResponseResultEncryption 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 NewSyntheticsPrivateLocationCreationResponseResultEncryption() *SyntheticsPrivateLocationCreationResponseResultEncryption { + this := SyntheticsPrivateLocationCreationResponseResultEncryption{} + return &this +} + +// NewSyntheticsPrivateLocationCreationResponseResultEncryptionWithDefaults instantiates a new SyntheticsPrivateLocationCreationResponseResultEncryption 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 NewSyntheticsPrivateLocationCreationResponseResultEncryptionWithDefaults() *SyntheticsPrivateLocationCreationResponseResultEncryption { + this := SyntheticsPrivateLocationCreationResponseResultEncryption{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) SetId(v string) { + o.Id = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) SetKey(v string) { + o.Key = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsPrivateLocationCreationResponseResultEncryption) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Key = all.Key + return nil +} diff --git a/api/v1/datadog/model_synthetics_private_location_metadata.go b/api/v1/datadog/model_synthetics_private_location_metadata.go new file mode 100644 index 00000000000..3a8a485fbf3 --- /dev/null +++ b/api/v1/datadog/model_synthetics_private_location_metadata.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsPrivateLocationMetadata Object containing metadata about the private location. +type SyntheticsPrivateLocationMetadata struct { + // A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. + RestrictedRoles []string `json:"restricted_roles,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{} +} + +// NewSyntheticsPrivateLocationMetadata instantiates a new SyntheticsPrivateLocationMetadata 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 NewSyntheticsPrivateLocationMetadata() *SyntheticsPrivateLocationMetadata { + this := SyntheticsPrivateLocationMetadata{} + return &this +} + +// NewSyntheticsPrivateLocationMetadataWithDefaults instantiates a new SyntheticsPrivateLocationMetadata 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 NewSyntheticsPrivateLocationMetadataWithDefaults() *SyntheticsPrivateLocationMetadata { + this := SyntheticsPrivateLocationMetadata{} + return &this +} + +// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationMetadata) GetRestrictedRoles() []string { + if o == nil || o.RestrictedRoles == nil { + var ret []string + return ret + } + return o.RestrictedRoles +} + +// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationMetadata) GetRestrictedRolesOk() (*[]string, bool) { + if o == nil || o.RestrictedRoles == nil { + return nil, false + } + return &o.RestrictedRoles, true +} + +// HasRestrictedRoles returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationMetadata) HasRestrictedRoles() bool { + if o != nil && o.RestrictedRoles != nil { + return true + } + + return false +} + +// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. +func (o *SyntheticsPrivateLocationMetadata) SetRestrictedRoles(v []string) { + o.RestrictedRoles = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsPrivateLocationMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.RestrictedRoles != nil { + toSerialize["restricted_roles"] = o.RestrictedRoles + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsPrivateLocationMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + RestrictedRoles []string `json:"restricted_roles,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.RestrictedRoles = all.RestrictedRoles + return nil +} diff --git a/api/v1/datadog/model_synthetics_private_location_secrets.go b/api/v1/datadog/model_synthetics_private_location_secrets.go new file mode 100644 index 00000000000..7e4d2e3aeac --- /dev/null +++ b/api/v1/datadog/model_synthetics_private_location_secrets.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsPrivateLocationSecrets Secrets for the private location. Only present in the response when creating the private location. +type SyntheticsPrivateLocationSecrets struct { + // Authentication part of the secrets. + Authentication *SyntheticsPrivateLocationSecretsAuthentication `json:"authentication,omitempty"` + // Private key for the private location. + ConfigDecryption *SyntheticsPrivateLocationSecretsConfigDecryption `json:"config_decryption,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{} +} + +// NewSyntheticsPrivateLocationSecrets instantiates a new SyntheticsPrivateLocationSecrets 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 NewSyntheticsPrivateLocationSecrets() *SyntheticsPrivateLocationSecrets { + this := SyntheticsPrivateLocationSecrets{} + return &this +} + +// NewSyntheticsPrivateLocationSecretsWithDefaults instantiates a new SyntheticsPrivateLocationSecrets 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 NewSyntheticsPrivateLocationSecretsWithDefaults() *SyntheticsPrivateLocationSecrets { + this := SyntheticsPrivateLocationSecrets{} + return &this +} + +// GetAuthentication returns the Authentication field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationSecrets) GetAuthentication() SyntheticsPrivateLocationSecretsAuthentication { + if o == nil || o.Authentication == nil { + var ret SyntheticsPrivateLocationSecretsAuthentication + return ret + } + return *o.Authentication +} + +// GetAuthenticationOk returns a tuple with the Authentication field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationSecrets) GetAuthenticationOk() (*SyntheticsPrivateLocationSecretsAuthentication, bool) { + if o == nil || o.Authentication == nil { + return nil, false + } + return o.Authentication, true +} + +// HasAuthentication returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationSecrets) HasAuthentication() bool { + if o != nil && o.Authentication != nil { + return true + } + + return false +} + +// SetAuthentication gets a reference to the given SyntheticsPrivateLocationSecretsAuthentication and assigns it to the Authentication field. +func (o *SyntheticsPrivateLocationSecrets) SetAuthentication(v SyntheticsPrivateLocationSecretsAuthentication) { + o.Authentication = &v +} + +// GetConfigDecryption returns the ConfigDecryption field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationSecrets) GetConfigDecryption() SyntheticsPrivateLocationSecretsConfigDecryption { + if o == nil || o.ConfigDecryption == nil { + var ret SyntheticsPrivateLocationSecretsConfigDecryption + return ret + } + return *o.ConfigDecryption +} + +// GetConfigDecryptionOk returns a tuple with the ConfigDecryption field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationSecrets) GetConfigDecryptionOk() (*SyntheticsPrivateLocationSecretsConfigDecryption, bool) { + if o == nil || o.ConfigDecryption == nil { + return nil, false + } + return o.ConfigDecryption, true +} + +// HasConfigDecryption returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationSecrets) HasConfigDecryption() bool { + if o != nil && o.ConfigDecryption != nil { + return true + } + + return false +} + +// SetConfigDecryption gets a reference to the given SyntheticsPrivateLocationSecretsConfigDecryption and assigns it to the ConfigDecryption field. +func (o *SyntheticsPrivateLocationSecrets) SetConfigDecryption(v SyntheticsPrivateLocationSecretsConfigDecryption) { + o.ConfigDecryption = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsPrivateLocationSecrets) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Authentication != nil { + toSerialize["authentication"] = o.Authentication + } + if o.ConfigDecryption != nil { + toSerialize["config_decryption"] = o.ConfigDecryption + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsPrivateLocationSecrets) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Authentication *SyntheticsPrivateLocationSecretsAuthentication `json:"authentication,omitempty"` + ConfigDecryption *SyntheticsPrivateLocationSecretsConfigDecryption `json:"config_decryption,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Authentication != nil && all.Authentication.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Authentication = all.Authentication + if all.ConfigDecryption != nil && all.ConfigDecryption.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ConfigDecryption = all.ConfigDecryption + return nil +} diff --git a/api/v1/datadog/model_synthetics_private_location_secrets_authentication.go b/api/v1/datadog/model_synthetics_private_location_secrets_authentication.go new file mode 100644 index 00000000000..58a8b2da515 --- /dev/null +++ b/api/v1/datadog/model_synthetics_private_location_secrets_authentication.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsPrivateLocationSecretsAuthentication Authentication part of the secrets. +type SyntheticsPrivateLocationSecretsAuthentication struct { + // Access key for the private location. + Id *string `json:"id,omitempty"` + // Secret access key for the private location. + Key *string `json:"key,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{} +} + +// NewSyntheticsPrivateLocationSecretsAuthentication instantiates a new SyntheticsPrivateLocationSecretsAuthentication 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 NewSyntheticsPrivateLocationSecretsAuthentication() *SyntheticsPrivateLocationSecretsAuthentication { + this := SyntheticsPrivateLocationSecretsAuthentication{} + return &this +} + +// NewSyntheticsPrivateLocationSecretsAuthenticationWithDefaults instantiates a new SyntheticsPrivateLocationSecretsAuthentication 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 NewSyntheticsPrivateLocationSecretsAuthenticationWithDefaults() *SyntheticsPrivateLocationSecretsAuthentication { + this := SyntheticsPrivateLocationSecretsAuthentication{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationSecretsAuthentication) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationSecretsAuthentication) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationSecretsAuthentication) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SyntheticsPrivateLocationSecretsAuthentication) SetId(v string) { + o.Id = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationSecretsAuthentication) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationSecretsAuthentication) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationSecretsAuthentication) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *SyntheticsPrivateLocationSecretsAuthentication) SetKey(v string) { + o.Key = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsPrivateLocationSecretsAuthentication) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsPrivateLocationSecretsAuthentication) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Key = all.Key + return nil +} diff --git a/api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.go b/api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.go new file mode 100644 index 00000000000..5d9d8959b04 --- /dev/null +++ b/api/v1/datadog/model_synthetics_private_location_secrets_config_decryption.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsPrivateLocationSecretsConfigDecryption Private key for the private location. +type SyntheticsPrivateLocationSecretsConfigDecryption struct { + // Private key for the private location. + Key *string `json:"key,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{} +} + +// NewSyntheticsPrivateLocationSecretsConfigDecryption instantiates a new SyntheticsPrivateLocationSecretsConfigDecryption 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 NewSyntheticsPrivateLocationSecretsConfigDecryption() *SyntheticsPrivateLocationSecretsConfigDecryption { + this := SyntheticsPrivateLocationSecretsConfigDecryption{} + return &this +} + +// NewSyntheticsPrivateLocationSecretsConfigDecryptionWithDefaults instantiates a new SyntheticsPrivateLocationSecretsConfigDecryption 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 NewSyntheticsPrivateLocationSecretsConfigDecryptionWithDefaults() *SyntheticsPrivateLocationSecretsConfigDecryption { + this := SyntheticsPrivateLocationSecretsConfigDecryption{} + return &this +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *SyntheticsPrivateLocationSecretsConfigDecryption) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsPrivateLocationSecretsConfigDecryption) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *SyntheticsPrivateLocationSecretsConfigDecryption) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *SyntheticsPrivateLocationSecretsConfigDecryption) SetKey(v string) { + o.Key = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsPrivateLocationSecretsConfigDecryption) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsPrivateLocationSecretsConfigDecryption) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Key *string `json:"key,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Key = all.Key + return nil +} diff --git a/api/v1/datadog/model_synthetics_ssl_certificate.go b/api/v1/datadog/model_synthetics_ssl_certificate.go new file mode 100644 index 00000000000..06a908b2737 --- /dev/null +++ b/api/v1/datadog/model_synthetics_ssl_certificate.go @@ -0,0 +1,554 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// SyntheticsSSLCertificate Object describing the SSL certificate used for a Synthetic test. +type SyntheticsSSLCertificate struct { + // Cipher used for the connection. + Cipher *string `json:"cipher,omitempty"` + // Exponent associated to the certificate. + Exponent *float64 `json:"exponent,omitempty"` + // Array of extensions and details used for the certificate. + ExtKeyUsage []string `json:"extKeyUsage,omitempty"` + // MD5 digest of the DER-encoded Certificate information. + Fingerprint *string `json:"fingerprint,omitempty"` + // SHA-1 digest of the DER-encoded Certificate information. + Fingerprint256 *string `json:"fingerprint256,omitempty"` + // Object describing the issuer of a SSL certificate. + Issuer *SyntheticsSSLCertificateIssuer `json:"issuer,omitempty"` + // Modulus associated to the SSL certificate private key. + Modulus *string `json:"modulus,omitempty"` + // TLS protocol used for the test. + Protocol *string `json:"protocol,omitempty"` + // Serial Number assigned by Symantec to the SSL certificate. + SerialNumber *string `json:"serialNumber,omitempty"` + // Object describing the SSL certificate used for the test. + Subject *SyntheticsSSLCertificateSubject `json:"subject,omitempty"` + // Date from which the SSL certificate is valid. + ValidFrom *time.Time `json:"validFrom,omitempty"` + // Date until which the SSL certificate is valid. + ValidTo *time.Time `json:"validTo,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{} +} + +// NewSyntheticsSSLCertificate instantiates a new SyntheticsSSLCertificate 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 NewSyntheticsSSLCertificate() *SyntheticsSSLCertificate { + this := SyntheticsSSLCertificate{} + return &this +} + +// NewSyntheticsSSLCertificateWithDefaults instantiates a new SyntheticsSSLCertificate 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 NewSyntheticsSSLCertificateWithDefaults() *SyntheticsSSLCertificate { + this := SyntheticsSSLCertificate{} + return &this +} + +// GetCipher returns the Cipher field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetCipher() string { + if o == nil || o.Cipher == nil { + var ret string + return ret + } + return *o.Cipher +} + +// GetCipherOk returns a tuple with the Cipher field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetCipherOk() (*string, bool) { + if o == nil || o.Cipher == nil { + return nil, false + } + return o.Cipher, true +} + +// HasCipher returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasCipher() bool { + if o != nil && o.Cipher != nil { + return true + } + + return false +} + +// SetCipher gets a reference to the given string and assigns it to the Cipher field. +func (o *SyntheticsSSLCertificate) SetCipher(v string) { + o.Cipher = &v +} + +// GetExponent returns the Exponent field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetExponent() float64 { + if o == nil || o.Exponent == nil { + var ret float64 + return ret + } + return *o.Exponent +} + +// GetExponentOk returns a tuple with the Exponent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetExponentOk() (*float64, bool) { + if o == nil || o.Exponent == nil { + return nil, false + } + return o.Exponent, true +} + +// HasExponent returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasExponent() bool { + if o != nil && o.Exponent != nil { + return true + } + + return false +} + +// SetExponent gets a reference to the given float64 and assigns it to the Exponent field. +func (o *SyntheticsSSLCertificate) SetExponent(v float64) { + o.Exponent = &v +} + +// GetExtKeyUsage returns the ExtKeyUsage field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetExtKeyUsage() []string { + if o == nil || o.ExtKeyUsage == nil { + var ret []string + return ret + } + return o.ExtKeyUsage +} + +// GetExtKeyUsageOk returns a tuple with the ExtKeyUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetExtKeyUsageOk() (*[]string, bool) { + if o == nil || o.ExtKeyUsage == nil { + return nil, false + } + return &o.ExtKeyUsage, true +} + +// HasExtKeyUsage returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasExtKeyUsage() bool { + if o != nil && o.ExtKeyUsage != nil { + return true + } + + return false +} + +// SetExtKeyUsage gets a reference to the given []string and assigns it to the ExtKeyUsage field. +func (o *SyntheticsSSLCertificate) SetExtKeyUsage(v []string) { + o.ExtKeyUsage = v +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetFingerprint() string { + if o == nil || o.Fingerprint == nil { + var ret string + return ret + } + return *o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetFingerprintOk() (*string, bool) { + if o == nil || o.Fingerprint == nil { + return nil, false + } + return o.Fingerprint, true +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasFingerprint() bool { + if o != nil && o.Fingerprint != nil { + return true + } + + return false +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *SyntheticsSSLCertificate) SetFingerprint(v string) { + o.Fingerprint = &v +} + +// GetFingerprint256 returns the Fingerprint256 field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetFingerprint256() string { + if o == nil || o.Fingerprint256 == nil { + var ret string + return ret + } + return *o.Fingerprint256 +} + +// GetFingerprint256Ok returns a tuple with the Fingerprint256 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetFingerprint256Ok() (*string, bool) { + if o == nil || o.Fingerprint256 == nil { + return nil, false + } + return o.Fingerprint256, true +} + +// HasFingerprint256 returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasFingerprint256() bool { + if o != nil && o.Fingerprint256 != nil { + return true + } + + return false +} + +// SetFingerprint256 gets a reference to the given string and assigns it to the Fingerprint256 field. +func (o *SyntheticsSSLCertificate) SetFingerprint256(v string) { + o.Fingerprint256 = &v +} + +// GetIssuer returns the Issuer field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetIssuer() SyntheticsSSLCertificateIssuer { + if o == nil || o.Issuer == nil { + var ret SyntheticsSSLCertificateIssuer + return ret + } + return *o.Issuer +} + +// GetIssuerOk returns a tuple with the Issuer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetIssuerOk() (*SyntheticsSSLCertificateIssuer, bool) { + if o == nil || o.Issuer == nil { + return nil, false + } + return o.Issuer, true +} + +// HasIssuer returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasIssuer() bool { + if o != nil && o.Issuer != nil { + return true + } + + return false +} + +// SetIssuer gets a reference to the given SyntheticsSSLCertificateIssuer and assigns it to the Issuer field. +func (o *SyntheticsSSLCertificate) SetIssuer(v SyntheticsSSLCertificateIssuer) { + o.Issuer = &v +} + +// GetModulus returns the Modulus field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetModulus() string { + if o == nil || o.Modulus == nil { + var ret string + return ret + } + return *o.Modulus +} + +// GetModulusOk returns a tuple with the Modulus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetModulusOk() (*string, bool) { + if o == nil || o.Modulus == nil { + return nil, false + } + return o.Modulus, true +} + +// HasModulus returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasModulus() bool { + if o != nil && o.Modulus != nil { + return true + } + + return false +} + +// SetModulus gets a reference to the given string and assigns it to the Modulus field. +func (o *SyntheticsSSLCertificate) SetModulus(v string) { + o.Modulus = &v +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetProtocol() string { + if o == nil || o.Protocol == nil { + var ret string + return ret + } + return *o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetProtocolOk() (*string, bool) { + if o == nil || o.Protocol == nil { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasProtocol() bool { + if o != nil && o.Protocol != nil { + return true + } + + return false +} + +// SetProtocol gets a reference to the given string and assigns it to the Protocol field. +func (o *SyntheticsSSLCertificate) SetProtocol(v string) { + o.Protocol = &v +} + +// GetSerialNumber returns the SerialNumber field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetSerialNumber() string { + if o == nil || o.SerialNumber == nil { + var ret string + return ret + } + return *o.SerialNumber +} + +// GetSerialNumberOk returns a tuple with the SerialNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetSerialNumberOk() (*string, bool) { + if o == nil || o.SerialNumber == nil { + return nil, false + } + return o.SerialNumber, true +} + +// HasSerialNumber returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasSerialNumber() bool { + if o != nil && o.SerialNumber != nil { + return true + } + + return false +} + +// SetSerialNumber gets a reference to the given string and assigns it to the SerialNumber field. +func (o *SyntheticsSSLCertificate) SetSerialNumber(v string) { + o.SerialNumber = &v +} + +// GetSubject returns the Subject field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetSubject() SyntheticsSSLCertificateSubject { + if o == nil || o.Subject == nil { + var ret SyntheticsSSLCertificateSubject + return ret + } + return *o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetSubjectOk() (*SyntheticsSSLCertificateSubject, bool) { + if o == nil || o.Subject == nil { + return nil, false + } + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasSubject() bool { + if o != nil && o.Subject != nil { + return true + } + + return false +} + +// SetSubject gets a reference to the given SyntheticsSSLCertificateSubject and assigns it to the Subject field. +func (o *SyntheticsSSLCertificate) SetSubject(v SyntheticsSSLCertificateSubject) { + o.Subject = &v +} + +// GetValidFrom returns the ValidFrom field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetValidFrom() time.Time { + if o == nil || o.ValidFrom == nil { + var ret time.Time + return ret + } + return *o.ValidFrom +} + +// GetValidFromOk returns a tuple with the ValidFrom field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetValidFromOk() (*time.Time, bool) { + if o == nil || o.ValidFrom == nil { + return nil, false + } + return o.ValidFrom, true +} + +// HasValidFrom returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasValidFrom() bool { + if o != nil && o.ValidFrom != nil { + return true + } + + return false +} + +// SetValidFrom gets a reference to the given time.Time and assigns it to the ValidFrom field. +func (o *SyntheticsSSLCertificate) SetValidFrom(v time.Time) { + o.ValidFrom = &v +} + +// GetValidTo returns the ValidTo field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificate) GetValidTo() time.Time { + if o == nil || o.ValidTo == nil { + var ret time.Time + return ret + } + return *o.ValidTo +} + +// GetValidToOk returns a tuple with the ValidTo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificate) GetValidToOk() (*time.Time, bool) { + if o == nil || o.ValidTo == nil { + return nil, false + } + return o.ValidTo, true +} + +// HasValidTo returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificate) HasValidTo() bool { + if o != nil && o.ValidTo != nil { + return true + } + + return false +} + +// SetValidTo gets a reference to the given time.Time and assigns it to the ValidTo field. +func (o *SyntheticsSSLCertificate) SetValidTo(v time.Time) { + o.ValidTo = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsSSLCertificate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cipher != nil { + toSerialize["cipher"] = o.Cipher + } + if o.Exponent != nil { + toSerialize["exponent"] = o.Exponent + } + if o.ExtKeyUsage != nil { + toSerialize["extKeyUsage"] = o.ExtKeyUsage + } + if o.Fingerprint != nil { + toSerialize["fingerprint"] = o.Fingerprint + } + if o.Fingerprint256 != nil { + toSerialize["fingerprint256"] = o.Fingerprint256 + } + if o.Issuer != nil { + toSerialize["issuer"] = o.Issuer + } + if o.Modulus != nil { + toSerialize["modulus"] = o.Modulus + } + if o.Protocol != nil { + toSerialize["protocol"] = o.Protocol + } + if o.SerialNumber != nil { + toSerialize["serialNumber"] = o.SerialNumber + } + if o.Subject != nil { + toSerialize["subject"] = o.Subject + } + if o.ValidFrom != nil { + if o.ValidFrom.Nanosecond() == 0 { + toSerialize["validFrom"] = o.ValidFrom.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["validFrom"] = o.ValidFrom.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ValidTo != nil { + if o.ValidTo.Nanosecond() == 0 { + toSerialize["validTo"] = o.ValidTo.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["validTo"] = o.ValidTo.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsSSLCertificate) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cipher *string `json:"cipher,omitempty"` + Exponent *float64 `json:"exponent,omitempty"` + ExtKeyUsage []string `json:"extKeyUsage,omitempty"` + Fingerprint *string `json:"fingerprint,omitempty"` + Fingerprint256 *string `json:"fingerprint256,omitempty"` + Issuer *SyntheticsSSLCertificateIssuer `json:"issuer,omitempty"` + Modulus *string `json:"modulus,omitempty"` + Protocol *string `json:"protocol,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + Subject *SyntheticsSSLCertificateSubject `json:"subject,omitempty"` + ValidFrom *time.Time `json:"validFrom,omitempty"` + ValidTo *time.Time `json:"validTo,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cipher = all.Cipher + o.Exponent = all.Exponent + o.ExtKeyUsage = all.ExtKeyUsage + o.Fingerprint = all.Fingerprint + o.Fingerprint256 = all.Fingerprint256 + if all.Issuer != nil && all.Issuer.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Issuer = all.Issuer + o.Modulus = all.Modulus + o.Protocol = all.Protocol + o.SerialNumber = all.SerialNumber + if all.Subject != nil && all.Subject.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Subject = all.Subject + o.ValidFrom = all.ValidFrom + o.ValidTo = all.ValidTo + return nil +} diff --git a/api/v1/datadog/model_synthetics_ssl_certificate_issuer.go b/api/v1/datadog/model_synthetics_ssl_certificate_issuer.go new file mode 100644 index 00000000000..2f5b7a57f39 --- /dev/null +++ b/api/v1/datadog/model_synthetics_ssl_certificate_issuer.go @@ -0,0 +1,297 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsSSLCertificateIssuer Object describing the issuer of a SSL certificate. +type SyntheticsSSLCertificateIssuer struct { + // Country Name that issued the certificate. + C *string `json:"C,omitempty"` + // Common Name that issued certificate. + Cn *string `json:"CN,omitempty"` + // Locality that issued the certificate. + L *string `json:"L,omitempty"` + // Organization that issued the certificate. + O *string `json:"O,omitempty"` + // Organizational Unit that issued the certificate. + Ou *string `json:"OU,omitempty"` + // State Or Province Name that issued the certificate. + St *string `json:"ST,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{} +} + +// NewSyntheticsSSLCertificateIssuer instantiates a new SyntheticsSSLCertificateIssuer 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 NewSyntheticsSSLCertificateIssuer() *SyntheticsSSLCertificateIssuer { + this := SyntheticsSSLCertificateIssuer{} + return &this +} + +// NewSyntheticsSSLCertificateIssuerWithDefaults instantiates a new SyntheticsSSLCertificateIssuer 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 NewSyntheticsSSLCertificateIssuerWithDefaults() *SyntheticsSSLCertificateIssuer { + this := SyntheticsSSLCertificateIssuer{} + return &this +} + +// GetC returns the C field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateIssuer) GetC() string { + if o == nil || o.C == nil { + var ret string + return ret + } + return *o.C +} + +// GetCOk returns a tuple with the C field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateIssuer) GetCOk() (*string, bool) { + if o == nil || o.C == nil { + return nil, false + } + return o.C, true +} + +// HasC returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateIssuer) HasC() bool { + if o != nil && o.C != nil { + return true + } + + return false +} + +// SetC gets a reference to the given string and assigns it to the C field. +func (o *SyntheticsSSLCertificateIssuer) SetC(v string) { + o.C = &v +} + +// GetCn returns the Cn field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateIssuer) GetCn() string { + if o == nil || o.Cn == nil { + var ret string + return ret + } + return *o.Cn +} + +// GetCnOk returns a tuple with the Cn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateIssuer) GetCnOk() (*string, bool) { + if o == nil || o.Cn == nil { + return nil, false + } + return o.Cn, true +} + +// HasCn returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateIssuer) HasCn() bool { + if o != nil && o.Cn != nil { + return true + } + + return false +} + +// SetCn gets a reference to the given string and assigns it to the Cn field. +func (o *SyntheticsSSLCertificateIssuer) SetCn(v string) { + o.Cn = &v +} + +// GetL returns the L field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateIssuer) GetL() string { + if o == nil || o.L == nil { + var ret string + return ret + } + return *o.L +} + +// GetLOk returns a tuple with the L field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateIssuer) GetLOk() (*string, bool) { + if o == nil || o.L == nil { + return nil, false + } + return o.L, true +} + +// HasL returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateIssuer) HasL() bool { + if o != nil && o.L != nil { + return true + } + + return false +} + +// SetL gets a reference to the given string and assigns it to the L field. +func (o *SyntheticsSSLCertificateIssuer) SetL(v string) { + o.L = &v +} + +// GetO returns the O field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateIssuer) GetO() string { + if o == nil || o.O == nil { + var ret string + return ret + } + return *o.O +} + +// GetOOk returns a tuple with the O field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateIssuer) GetOOk() (*string, bool) { + if o == nil || o.O == nil { + return nil, false + } + return o.O, true +} + +// HasO returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateIssuer) HasO() bool { + if o != nil && o.O != nil { + return true + } + + return false +} + +// SetO gets a reference to the given string and assigns it to the O field. +func (o *SyntheticsSSLCertificateIssuer) SetO(v string) { + o.O = &v +} + +// GetOu returns the Ou field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateIssuer) GetOu() string { + if o == nil || o.Ou == nil { + var ret string + return ret + } + return *o.Ou +} + +// GetOuOk returns a tuple with the Ou field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateIssuer) GetOuOk() (*string, bool) { + if o == nil || o.Ou == nil { + return nil, false + } + return o.Ou, true +} + +// HasOu returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateIssuer) HasOu() bool { + if o != nil && o.Ou != nil { + return true + } + + return false +} + +// SetOu gets a reference to the given string and assigns it to the Ou field. +func (o *SyntheticsSSLCertificateIssuer) SetOu(v string) { + o.Ou = &v +} + +// GetSt returns the St field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateIssuer) GetSt() string { + if o == nil || o.St == nil { + var ret string + return ret + } + return *o.St +} + +// GetStOk returns a tuple with the St field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateIssuer) GetStOk() (*string, bool) { + if o == nil || o.St == nil { + return nil, false + } + return o.St, true +} + +// HasSt returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateIssuer) HasSt() bool { + if o != nil && o.St != nil { + return true + } + + return false +} + +// SetSt gets a reference to the given string and assigns it to the St field. +func (o *SyntheticsSSLCertificateIssuer) SetSt(v string) { + o.St = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsSSLCertificateIssuer) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.C != nil { + toSerialize["C"] = o.C + } + if o.Cn != nil { + toSerialize["CN"] = o.Cn + } + if o.L != nil { + toSerialize["L"] = o.L + } + if o.O != nil { + toSerialize["O"] = o.O + } + if o.Ou != nil { + toSerialize["OU"] = o.Ou + } + if o.St != nil { + toSerialize["ST"] = o.St + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsSSLCertificateIssuer) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + C *string `json:"C,omitempty"` + Cn *string `json:"CN,omitempty"` + L *string `json:"L,omitempty"` + O *string `json:"O,omitempty"` + Ou *string `json:"OU,omitempty"` + St *string `json:"ST,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.C = all.C + o.Cn = all.Cn + o.L = all.L + o.O = all.O + o.Ou = all.Ou + o.St = all.St + return nil +} diff --git a/api/v1/datadog/model_synthetics_ssl_certificate_subject.go b/api/v1/datadog/model_synthetics_ssl_certificate_subject.go new file mode 100644 index 00000000000..64f0bc8b90e --- /dev/null +++ b/api/v1/datadog/model_synthetics_ssl_certificate_subject.go @@ -0,0 +1,336 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsSSLCertificateSubject Object describing the SSL certificate used for the test. +type SyntheticsSSLCertificateSubject struct { + // Country Name associated with the certificate. + C *string `json:"C,omitempty"` + // Common Name that associated with the certificate. + Cn *string `json:"CN,omitempty"` + // Locality associated with the certificate. + L *string `json:"L,omitempty"` + // Organization associated with the certificate. + O *string `json:"O,omitempty"` + // Organizational Unit associated with the certificate. + Ou *string `json:"OU,omitempty"` + // State Or Province Name associated with the certificate. + St *string `json:"ST,omitempty"` + // Subject Alternative Name associated with the certificate. + AltName *string `json:"altName,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{} +} + +// NewSyntheticsSSLCertificateSubject instantiates a new SyntheticsSSLCertificateSubject 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 NewSyntheticsSSLCertificateSubject() *SyntheticsSSLCertificateSubject { + this := SyntheticsSSLCertificateSubject{} + return &this +} + +// NewSyntheticsSSLCertificateSubjectWithDefaults instantiates a new SyntheticsSSLCertificateSubject 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 NewSyntheticsSSLCertificateSubjectWithDefaults() *SyntheticsSSLCertificateSubject { + this := SyntheticsSSLCertificateSubject{} + return &this +} + +// GetC returns the C field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateSubject) GetC() string { + if o == nil || o.C == nil { + var ret string + return ret + } + return *o.C +} + +// GetCOk returns a tuple with the C field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateSubject) GetCOk() (*string, bool) { + if o == nil || o.C == nil { + return nil, false + } + return o.C, true +} + +// HasC returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateSubject) HasC() bool { + if o != nil && o.C != nil { + return true + } + + return false +} + +// SetC gets a reference to the given string and assigns it to the C field. +func (o *SyntheticsSSLCertificateSubject) SetC(v string) { + o.C = &v +} + +// GetCn returns the Cn field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateSubject) GetCn() string { + if o == nil || o.Cn == nil { + var ret string + return ret + } + return *o.Cn +} + +// GetCnOk returns a tuple with the Cn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateSubject) GetCnOk() (*string, bool) { + if o == nil || o.Cn == nil { + return nil, false + } + return o.Cn, true +} + +// HasCn returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateSubject) HasCn() bool { + if o != nil && o.Cn != nil { + return true + } + + return false +} + +// SetCn gets a reference to the given string and assigns it to the Cn field. +func (o *SyntheticsSSLCertificateSubject) SetCn(v string) { + o.Cn = &v +} + +// GetL returns the L field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateSubject) GetL() string { + if o == nil || o.L == nil { + var ret string + return ret + } + return *o.L +} + +// GetLOk returns a tuple with the L field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateSubject) GetLOk() (*string, bool) { + if o == nil || o.L == nil { + return nil, false + } + return o.L, true +} + +// HasL returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateSubject) HasL() bool { + if o != nil && o.L != nil { + return true + } + + return false +} + +// SetL gets a reference to the given string and assigns it to the L field. +func (o *SyntheticsSSLCertificateSubject) SetL(v string) { + o.L = &v +} + +// GetO returns the O field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateSubject) GetO() string { + if o == nil || o.O == nil { + var ret string + return ret + } + return *o.O +} + +// GetOOk returns a tuple with the O field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateSubject) GetOOk() (*string, bool) { + if o == nil || o.O == nil { + return nil, false + } + return o.O, true +} + +// HasO returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateSubject) HasO() bool { + if o != nil && o.O != nil { + return true + } + + return false +} + +// SetO gets a reference to the given string and assigns it to the O field. +func (o *SyntheticsSSLCertificateSubject) SetO(v string) { + o.O = &v +} + +// GetOu returns the Ou field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateSubject) GetOu() string { + if o == nil || o.Ou == nil { + var ret string + return ret + } + return *o.Ou +} + +// GetOuOk returns a tuple with the Ou field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateSubject) GetOuOk() (*string, bool) { + if o == nil || o.Ou == nil { + return nil, false + } + return o.Ou, true +} + +// HasOu returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateSubject) HasOu() bool { + if o != nil && o.Ou != nil { + return true + } + + return false +} + +// SetOu gets a reference to the given string and assigns it to the Ou field. +func (o *SyntheticsSSLCertificateSubject) SetOu(v string) { + o.Ou = &v +} + +// GetSt returns the St field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateSubject) GetSt() string { + if o == nil || o.St == nil { + var ret string + return ret + } + return *o.St +} + +// GetStOk returns a tuple with the St field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateSubject) GetStOk() (*string, bool) { + if o == nil || o.St == nil { + return nil, false + } + return o.St, true +} + +// HasSt returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateSubject) HasSt() bool { + if o != nil && o.St != nil { + return true + } + + return false +} + +// SetSt gets a reference to the given string and assigns it to the St field. +func (o *SyntheticsSSLCertificateSubject) SetSt(v string) { + o.St = &v +} + +// GetAltName returns the AltName field value if set, zero value otherwise. +func (o *SyntheticsSSLCertificateSubject) GetAltName() string { + if o == nil || o.AltName == nil { + var ret string + return ret + } + return *o.AltName +} + +// GetAltNameOk returns a tuple with the AltName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsSSLCertificateSubject) GetAltNameOk() (*string, bool) { + if o == nil || o.AltName == nil { + return nil, false + } + return o.AltName, true +} + +// HasAltName returns a boolean if a field has been set. +func (o *SyntheticsSSLCertificateSubject) HasAltName() bool { + if o != nil && o.AltName != nil { + return true + } + + return false +} + +// SetAltName gets a reference to the given string and assigns it to the AltName field. +func (o *SyntheticsSSLCertificateSubject) SetAltName(v string) { + o.AltName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsSSLCertificateSubject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.C != nil { + toSerialize["C"] = o.C + } + if o.Cn != nil { + toSerialize["CN"] = o.Cn + } + if o.L != nil { + toSerialize["L"] = o.L + } + if o.O != nil { + toSerialize["O"] = o.O + } + if o.Ou != nil { + toSerialize["OU"] = o.Ou + } + if o.St != nil { + toSerialize["ST"] = o.St + } + if o.AltName != nil { + toSerialize["altName"] = o.AltName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsSSLCertificateSubject) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + C *string `json:"C,omitempty"` + Cn *string `json:"CN,omitempty"` + L *string `json:"L,omitempty"` + O *string `json:"O,omitempty"` + Ou *string `json:"OU,omitempty"` + St *string `json:"ST,omitempty"` + AltName *string `json:"altName,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.C = all.C + o.Cn = all.Cn + o.L = all.L + o.O = all.O + o.Ou = all.Ou + o.St = all.St + o.AltName = all.AltName + return nil +} diff --git a/api/v1/datadog/model_synthetics_status.go b/api/v1/datadog/model_synthetics_status.go new file mode 100644 index 00000000000..b6f66ac5600 --- /dev/null +++ b/api/v1/datadog/model_synthetics_status.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsStatus Determines whether or not the batch has passed, failed, or is in progress. +type SyntheticsStatus string + +// List of SyntheticsStatus. +const ( + SYNTHETICSSTATUS_PASSED SyntheticsStatus = "passed" + SYNTHETICSSTATUS_skipped SyntheticsStatus = "skipped" + SYNTHETICSSTATUS_failed SyntheticsStatus = "failed" +) + +var allowedSyntheticsStatusEnumValues = []SyntheticsStatus{ + SYNTHETICSSTATUS_PASSED, + SYNTHETICSSTATUS_skipped, + SYNTHETICSSTATUS_failed, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsStatus) GetAllowedValues() []SyntheticsStatus { + return allowedSyntheticsStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsStatus(value) + return nil +} + +// NewSyntheticsStatusFromValue returns a pointer to a valid SyntheticsStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsStatusFromValue(v string) (*SyntheticsStatus, error) { + ev := SyntheticsStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsStatus: valid values are %v", v, allowedSyntheticsStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsStatus) IsValid() bool { + for _, existing := range allowedSyntheticsStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsStatus value. +func (v SyntheticsStatus) Ptr() *SyntheticsStatus { + return &v +} + +// NullableSyntheticsStatus handles when a null is used for SyntheticsStatus. +type NullableSyntheticsStatus struct { + value *SyntheticsStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsStatus) Get() *SyntheticsStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsStatus) Set(val *SyntheticsStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsStatus initializes the struct as if Set has been called. +func NewNullableSyntheticsStatus(val *SyntheticsStatus) *NullableSyntheticsStatus { + return &NullableSyntheticsStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_step.go b/api/v1/datadog/model_synthetics_step.go new file mode 100644 index 00000000000..cec6c47f2fd --- /dev/null +++ b/api/v1/datadog/model_synthetics_step.go @@ -0,0 +1,305 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsStep The steps used in a Synthetics browser test. +type SyntheticsStep struct { + // A boolean set to allow this step to fail. + AllowFailure *bool `json:"allowFailure,omitempty"` + // A boolean to use in addition to `allowFailure` to determine if the test should be marked as failed when the step fails. + IsCritical *bool `json:"isCritical,omitempty"` + // The name of the step. + Name *string `json:"name,omitempty"` + // The parameters of the step. + Params interface{} `json:"params,omitempty"` + // The time before declaring a step failed. + Timeout *int64 `json:"timeout,omitempty"` + // Step type used in your Synthetic test. + Type *SyntheticsStepType `json:"type,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{} +} + +// NewSyntheticsStep instantiates a new SyntheticsStep 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 NewSyntheticsStep() *SyntheticsStep { + this := SyntheticsStep{} + return &this +} + +// NewSyntheticsStepWithDefaults instantiates a new SyntheticsStep 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 NewSyntheticsStepWithDefaults() *SyntheticsStep { + this := SyntheticsStep{} + return &this +} + +// GetAllowFailure returns the AllowFailure field value if set, zero value otherwise. +func (o *SyntheticsStep) GetAllowFailure() bool { + if o == nil || o.AllowFailure == nil { + var ret bool + return ret + } + return *o.AllowFailure +} + +// GetAllowFailureOk returns a tuple with the AllowFailure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStep) GetAllowFailureOk() (*bool, bool) { + if o == nil || o.AllowFailure == nil { + return nil, false + } + return o.AllowFailure, true +} + +// HasAllowFailure returns a boolean if a field has been set. +func (o *SyntheticsStep) HasAllowFailure() bool { + if o != nil && o.AllowFailure != nil { + return true + } + + return false +} + +// SetAllowFailure gets a reference to the given bool and assigns it to the AllowFailure field. +func (o *SyntheticsStep) SetAllowFailure(v bool) { + o.AllowFailure = &v +} + +// GetIsCritical returns the IsCritical field value if set, zero value otherwise. +func (o *SyntheticsStep) GetIsCritical() bool { + if o == nil || o.IsCritical == nil { + var ret bool + return ret + } + return *o.IsCritical +} + +// GetIsCriticalOk returns a tuple with the IsCritical field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStep) GetIsCriticalOk() (*bool, bool) { + if o == nil || o.IsCritical == nil { + return nil, false + } + return o.IsCritical, true +} + +// HasIsCritical returns a boolean if a field has been set. +func (o *SyntheticsStep) HasIsCritical() bool { + if o != nil && o.IsCritical != nil { + return true + } + + return false +} + +// SetIsCritical gets a reference to the given bool and assigns it to the IsCritical field. +func (o *SyntheticsStep) SetIsCritical(v bool) { + o.IsCritical = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsStep) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStep) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SyntheticsStep) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsStep) SetName(v string) { + o.Name = &v +} + +// GetParams returns the Params field value if set, zero value otherwise. +func (o *SyntheticsStep) GetParams() interface{} { + if o == nil || o.Params == nil { + var ret interface{} + return ret + } + return o.Params +} + +// GetParamsOk returns a tuple with the Params field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStep) GetParamsOk() (*interface{}, bool) { + if o == nil || o.Params == nil { + return nil, false + } + return &o.Params, true +} + +// HasParams returns a boolean if a field has been set. +func (o *SyntheticsStep) HasParams() bool { + if o != nil && o.Params != nil { + return true + } + + return false +} + +// SetParams gets a reference to the given interface{} and assigns it to the Params field. +func (o *SyntheticsStep) SetParams(v interface{}) { + o.Params = v +} + +// GetTimeout returns the Timeout field value if set, zero value otherwise. +func (o *SyntheticsStep) GetTimeout() int64 { + if o == nil || o.Timeout == nil { + var ret int64 + return ret + } + return *o.Timeout +} + +// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStep) GetTimeoutOk() (*int64, bool) { + if o == nil || o.Timeout == nil { + return nil, false + } + return o.Timeout, true +} + +// HasTimeout returns a boolean if a field has been set. +func (o *SyntheticsStep) HasTimeout() bool { + if o != nil && o.Timeout != nil { + return true + } + + return false +} + +// SetTimeout gets a reference to the given int64 and assigns it to the Timeout field. +func (o *SyntheticsStep) SetTimeout(v int64) { + o.Timeout = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsStep) GetType() SyntheticsStepType { + if o == nil || o.Type == nil { + var ret SyntheticsStepType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStep) GetTypeOk() (*SyntheticsStepType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsStep) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsStepType and assigns it to the Type field. +func (o *SyntheticsStep) SetType(v SyntheticsStepType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsStep) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AllowFailure != nil { + toSerialize["allowFailure"] = o.AllowFailure + } + if o.IsCritical != nil { + toSerialize["isCritical"] = o.IsCritical + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Params != nil { + toSerialize["params"] = o.Params + } + if o.Timeout != nil { + toSerialize["timeout"] = o.Timeout + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AllowFailure *bool `json:"allowFailure,omitempty"` + IsCritical *bool `json:"isCritical,omitempty"` + Name *string `json:"name,omitempty"` + Params interface{} `json:"params,omitempty"` + Timeout *int64 `json:"timeout,omitempty"` + Type *SyntheticsStepType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AllowFailure = all.AllowFailure + o.IsCritical = all.IsCritical + o.Name = all.Name + o.Params = all.Params + o.Timeout = all.Timeout + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_step_detail.go b/api/v1/datadog/model_synthetics_step_detail.go new file mode 100644 index 00000000000..928074e3556 --- /dev/null +++ b/api/v1/datadog/model_synthetics_step_detail.go @@ -0,0 +1,751 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsStepDetail Object describing a step for a Synthetic test. +type SyntheticsStepDetail struct { + // Array of errors collected for a browser test. + BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"` + // Type of assertion to apply in an API test. + CheckType *SyntheticsCheckType `json:"checkType,omitempty"` + // Description of the test. + Description *string `json:"description,omitempty"` + // Total duration in millisecond of the test. + Duration *float64 `json:"duration,omitempty"` + // Error returned by the test. + Error *string `json:"error,omitempty"` + // Navigate between different tabs for your browser test. + PlayingTab *SyntheticsPlayingTab `json:"playingTab,omitempty"` + // Whether or not screenshots where collected by the test. + ScreenshotBucketKey *bool `json:"screenshotBucketKey,omitempty"` + // Whether or not to skip this step. + Skipped *bool `json:"skipped,omitempty"` + // Whether or not snapshots where collected by the test. + SnapshotBucketKey *bool `json:"snapshotBucketKey,omitempty"` + // The step ID. + StepId *int64 `json:"stepId,omitempty"` + // If this steps include a sub-test. + // [Subtests documentation](https://docs.datadoghq.com/synthetics/browser_tests/advanced_options/#subtests). + SubTestStepDetails []SyntheticsStepDetail `json:"subTestStepDetails,omitempty"` + // Time before starting the step. + TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` + // Step type used in your Synthetic test. + Type *SyntheticsStepType `json:"type,omitempty"` + // URL to perform the step against. + Url *string `json:"url,omitempty"` + // Value for the step. + Value interface{} `json:"value,omitempty"` + // Array of Core Web Vitals metrics for the step. + VitalsMetrics []SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"` + // Warning collected that didn't failed the step. + Warnings []SyntheticsStepDetailWarning `json:"warnings,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{} +} + +// NewSyntheticsStepDetail instantiates a new SyntheticsStepDetail 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 NewSyntheticsStepDetail() *SyntheticsStepDetail { + this := SyntheticsStepDetail{} + return &this +} + +// NewSyntheticsStepDetailWithDefaults instantiates a new SyntheticsStepDetail 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 NewSyntheticsStepDetailWithDefaults() *SyntheticsStepDetail { + this := SyntheticsStepDetail{} + return &this +} + +// GetBrowserErrors returns the BrowserErrors field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetBrowserErrors() []SyntheticsBrowserError { + if o == nil || o.BrowserErrors == nil { + var ret []SyntheticsBrowserError + return ret + } + return o.BrowserErrors +} + +// GetBrowserErrorsOk returns a tuple with the BrowserErrors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetBrowserErrorsOk() (*[]SyntheticsBrowserError, bool) { + if o == nil || o.BrowserErrors == nil { + return nil, false + } + return &o.BrowserErrors, true +} + +// HasBrowserErrors returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasBrowserErrors() bool { + if o != nil && o.BrowserErrors != nil { + return true + } + + return false +} + +// SetBrowserErrors gets a reference to the given []SyntheticsBrowserError and assigns it to the BrowserErrors field. +func (o *SyntheticsStepDetail) SetBrowserErrors(v []SyntheticsBrowserError) { + o.BrowserErrors = v +} + +// GetCheckType returns the CheckType field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetCheckType() SyntheticsCheckType { + if o == nil || o.CheckType == nil { + var ret SyntheticsCheckType + return ret + } + return *o.CheckType +} + +// GetCheckTypeOk returns a tuple with the CheckType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetCheckTypeOk() (*SyntheticsCheckType, bool) { + if o == nil || o.CheckType == nil { + return nil, false + } + return o.CheckType, true +} + +// HasCheckType returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasCheckType() bool { + if o != nil && o.CheckType != nil { + return true + } + + return false +} + +// SetCheckType gets a reference to the given SyntheticsCheckType and assigns it to the CheckType field. +func (o *SyntheticsStepDetail) SetCheckType(v SyntheticsCheckType) { + o.CheckType = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SyntheticsStepDetail) SetDescription(v string) { + o.Description = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetDuration() float64 { + if o == nil || o.Duration == nil { + var ret float64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetDurationOk() (*float64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasDuration() bool { + if o != nil && o.Duration != nil { + return true + } + + return false +} + +// SetDuration gets a reference to the given float64 and assigns it to the Duration field. +func (o *SyntheticsStepDetail) SetDuration(v float64) { + o.Duration = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetError() string { + if o == nil || o.Error == nil { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetErrorOk() (*string, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *SyntheticsStepDetail) SetError(v string) { + o.Error = &v +} + +// GetPlayingTab returns the PlayingTab field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetPlayingTab() SyntheticsPlayingTab { + if o == nil || o.PlayingTab == nil { + var ret SyntheticsPlayingTab + return ret + } + return *o.PlayingTab +} + +// GetPlayingTabOk returns a tuple with the PlayingTab field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetPlayingTabOk() (*SyntheticsPlayingTab, bool) { + if o == nil || o.PlayingTab == nil { + return nil, false + } + return o.PlayingTab, true +} + +// HasPlayingTab returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasPlayingTab() bool { + if o != nil && o.PlayingTab != nil { + return true + } + + return false +} + +// SetPlayingTab gets a reference to the given SyntheticsPlayingTab and assigns it to the PlayingTab field. +func (o *SyntheticsStepDetail) SetPlayingTab(v SyntheticsPlayingTab) { + o.PlayingTab = &v +} + +// GetScreenshotBucketKey returns the ScreenshotBucketKey field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetScreenshotBucketKey() bool { + if o == nil || o.ScreenshotBucketKey == nil { + var ret bool + return ret + } + return *o.ScreenshotBucketKey +} + +// GetScreenshotBucketKeyOk returns a tuple with the ScreenshotBucketKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetScreenshotBucketKeyOk() (*bool, bool) { + if o == nil || o.ScreenshotBucketKey == nil { + return nil, false + } + return o.ScreenshotBucketKey, true +} + +// HasScreenshotBucketKey returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasScreenshotBucketKey() bool { + if o != nil && o.ScreenshotBucketKey != nil { + return true + } + + return false +} + +// SetScreenshotBucketKey gets a reference to the given bool and assigns it to the ScreenshotBucketKey field. +func (o *SyntheticsStepDetail) SetScreenshotBucketKey(v bool) { + o.ScreenshotBucketKey = &v +} + +// GetSkipped returns the Skipped field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetSkipped() bool { + if o == nil || o.Skipped == nil { + var ret bool + return ret + } + return *o.Skipped +} + +// GetSkippedOk returns a tuple with the Skipped field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetSkippedOk() (*bool, bool) { + if o == nil || o.Skipped == nil { + return nil, false + } + return o.Skipped, true +} + +// HasSkipped returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasSkipped() bool { + if o != nil && o.Skipped != nil { + return true + } + + return false +} + +// SetSkipped gets a reference to the given bool and assigns it to the Skipped field. +func (o *SyntheticsStepDetail) SetSkipped(v bool) { + o.Skipped = &v +} + +// GetSnapshotBucketKey returns the SnapshotBucketKey field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetSnapshotBucketKey() bool { + if o == nil || o.SnapshotBucketKey == nil { + var ret bool + return ret + } + return *o.SnapshotBucketKey +} + +// GetSnapshotBucketKeyOk returns a tuple with the SnapshotBucketKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetSnapshotBucketKeyOk() (*bool, bool) { + if o == nil || o.SnapshotBucketKey == nil { + return nil, false + } + return o.SnapshotBucketKey, true +} + +// HasSnapshotBucketKey returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasSnapshotBucketKey() bool { + if o != nil && o.SnapshotBucketKey != nil { + return true + } + + return false +} + +// SetSnapshotBucketKey gets a reference to the given bool and assigns it to the SnapshotBucketKey field. +func (o *SyntheticsStepDetail) SetSnapshotBucketKey(v bool) { + o.SnapshotBucketKey = &v +} + +// GetStepId returns the StepId field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetStepId() int64 { + if o == nil || o.StepId == nil { + var ret int64 + return ret + } + return *o.StepId +} + +// GetStepIdOk returns a tuple with the StepId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetStepIdOk() (*int64, bool) { + if o == nil || o.StepId == nil { + return nil, false + } + return o.StepId, true +} + +// HasStepId returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasStepId() bool { + if o != nil && o.StepId != nil { + return true + } + + return false +} + +// SetStepId gets a reference to the given int64 and assigns it to the StepId field. +func (o *SyntheticsStepDetail) SetStepId(v int64) { + o.StepId = &v +} + +// GetSubTestStepDetails returns the SubTestStepDetails field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetSubTestStepDetails() []SyntheticsStepDetail { + if o == nil || o.SubTestStepDetails == nil { + var ret []SyntheticsStepDetail + return ret + } + return o.SubTestStepDetails +} + +// GetSubTestStepDetailsOk returns a tuple with the SubTestStepDetails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetSubTestStepDetailsOk() (*[]SyntheticsStepDetail, bool) { + if o == nil || o.SubTestStepDetails == nil { + return nil, false + } + return &o.SubTestStepDetails, true +} + +// HasSubTestStepDetails returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasSubTestStepDetails() bool { + if o != nil && o.SubTestStepDetails != nil { + return true + } + + return false +} + +// SetSubTestStepDetails gets a reference to the given []SyntheticsStepDetail and assigns it to the SubTestStepDetails field. +func (o *SyntheticsStepDetail) SetSubTestStepDetails(v []SyntheticsStepDetail) { + o.SubTestStepDetails = v +} + +// GetTimeToInteractive returns the TimeToInteractive field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetTimeToInteractive() float64 { + if o == nil || o.TimeToInteractive == nil { + var ret float64 + return ret + } + return *o.TimeToInteractive +} + +// GetTimeToInteractiveOk returns a tuple with the TimeToInteractive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetTimeToInteractiveOk() (*float64, bool) { + if o == nil || o.TimeToInteractive == nil { + return nil, false + } + return o.TimeToInteractive, true +} + +// HasTimeToInteractive returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasTimeToInteractive() bool { + if o != nil && o.TimeToInteractive != nil { + return true + } + + return false +} + +// SetTimeToInteractive gets a reference to the given float64 and assigns it to the TimeToInteractive field. +func (o *SyntheticsStepDetail) SetTimeToInteractive(v float64) { + o.TimeToInteractive = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetType() SyntheticsStepType { + if o == nil || o.Type == nil { + var ret SyntheticsStepType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetTypeOk() (*SyntheticsStepType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsStepType and assigns it to the Type field. +func (o *SyntheticsStepDetail) SetType(v SyntheticsStepType) { + o.Type = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *SyntheticsStepDetail) SetUrl(v string) { + o.Url = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetValue() interface{} { + if o == nil || o.Value == nil { + var ret interface{} + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetValueOk() (*interface{}, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return &o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given interface{} and assigns it to the Value field. +func (o *SyntheticsStepDetail) SetValue(v interface{}) { + o.Value = v +} + +// GetVitalsMetrics returns the VitalsMetrics field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetVitalsMetrics() []SyntheticsCoreWebVitals { + if o == nil || o.VitalsMetrics == nil { + var ret []SyntheticsCoreWebVitals + return ret + } + return o.VitalsMetrics +} + +// GetVitalsMetricsOk returns a tuple with the VitalsMetrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetVitalsMetricsOk() (*[]SyntheticsCoreWebVitals, bool) { + if o == nil || o.VitalsMetrics == nil { + return nil, false + } + return &o.VitalsMetrics, true +} + +// HasVitalsMetrics returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasVitalsMetrics() bool { + if o != nil && o.VitalsMetrics != nil { + return true + } + + return false +} + +// SetVitalsMetrics gets a reference to the given []SyntheticsCoreWebVitals and assigns it to the VitalsMetrics field. +func (o *SyntheticsStepDetail) SetVitalsMetrics(v []SyntheticsCoreWebVitals) { + o.VitalsMetrics = v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *SyntheticsStepDetail) GetWarnings() []SyntheticsStepDetailWarning { + if o == nil || o.Warnings == nil { + var ret []SyntheticsStepDetailWarning + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetail) GetWarningsOk() (*[]SyntheticsStepDetailWarning, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *SyntheticsStepDetail) HasWarnings() bool { + if o != nil && o.Warnings != nil { + return true + } + + return false +} + +// SetWarnings gets a reference to the given []SyntheticsStepDetailWarning and assigns it to the Warnings field. +func (o *SyntheticsStepDetail) SetWarnings(v []SyntheticsStepDetailWarning) { + o.Warnings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsStepDetail) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BrowserErrors != nil { + toSerialize["browserErrors"] = o.BrowserErrors + } + if o.CheckType != nil { + toSerialize["checkType"] = o.CheckType + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + if o.PlayingTab != nil { + toSerialize["playingTab"] = o.PlayingTab + } + if o.ScreenshotBucketKey != nil { + toSerialize["screenshotBucketKey"] = o.ScreenshotBucketKey + } + if o.Skipped != nil { + toSerialize["skipped"] = o.Skipped + } + if o.SnapshotBucketKey != nil { + toSerialize["snapshotBucketKey"] = o.SnapshotBucketKey + } + if o.StepId != nil { + toSerialize["stepId"] = o.StepId + } + if o.SubTestStepDetails != nil { + toSerialize["subTestStepDetails"] = o.SubTestStepDetails + } + if o.TimeToInteractive != nil { + toSerialize["timeToInteractive"] = o.TimeToInteractive + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + if o.VitalsMetrics != nil { + toSerialize["vitalsMetrics"] = o.VitalsMetrics + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BrowserErrors []SyntheticsBrowserError `json:"browserErrors,omitempty"` + CheckType *SyntheticsCheckType `json:"checkType,omitempty"` + Description *string `json:"description,omitempty"` + Duration *float64 `json:"duration,omitempty"` + Error *string `json:"error,omitempty"` + PlayingTab *SyntheticsPlayingTab `json:"playingTab,omitempty"` + ScreenshotBucketKey *bool `json:"screenshotBucketKey,omitempty"` + Skipped *bool `json:"skipped,omitempty"` + SnapshotBucketKey *bool `json:"snapshotBucketKey,omitempty"` + StepId *int64 `json:"stepId,omitempty"` + SubTestStepDetails []SyntheticsStepDetail `json:"subTestStepDetails,omitempty"` + TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` + Type *SyntheticsStepType `json:"type,omitempty"` + Url *string `json:"url,omitempty"` + Value interface{} `json:"value,omitempty"` + VitalsMetrics []SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"` + Warnings []SyntheticsStepDetailWarning `json:"warnings,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.CheckType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.PlayingTab; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BrowserErrors = all.BrowserErrors + o.CheckType = all.CheckType + o.Description = all.Description + o.Duration = all.Duration + o.Error = all.Error + o.PlayingTab = all.PlayingTab + o.ScreenshotBucketKey = all.ScreenshotBucketKey + o.Skipped = all.Skipped + o.SnapshotBucketKey = all.SnapshotBucketKey + o.StepId = all.StepId + o.SubTestStepDetails = all.SubTestStepDetails + o.TimeToInteractive = all.TimeToInteractive + o.Type = all.Type + o.Url = all.Url + o.Value = all.Value + o.VitalsMetrics = all.VitalsMetrics + o.Warnings = all.Warnings + return nil +} diff --git a/api/v1/datadog/model_synthetics_step_detail_warning.go b/api/v1/datadog/model_synthetics_step_detail_warning.go new file mode 100644 index 00000000000..477c8e68bac --- /dev/null +++ b/api/v1/datadog/model_synthetics_step_detail_warning.go @@ -0,0 +1,144 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsStepDetailWarning Object collecting warnings for a given step. +type SyntheticsStepDetailWarning struct { + // Message for the warning. + Message string `json:"message"` + // User locator used. + Type SyntheticsWarningType `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{} +} + +// NewSyntheticsStepDetailWarning instantiates a new SyntheticsStepDetailWarning 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 NewSyntheticsStepDetailWarning(message string, typeVar SyntheticsWarningType) *SyntheticsStepDetailWarning { + this := SyntheticsStepDetailWarning{} + this.Message = message + this.Type = typeVar + return &this +} + +// NewSyntheticsStepDetailWarningWithDefaults instantiates a new SyntheticsStepDetailWarning 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 NewSyntheticsStepDetailWarningWithDefaults() *SyntheticsStepDetailWarning { + this := SyntheticsStepDetailWarning{} + return &this +} + +// GetMessage returns the Message field value. +func (o *SyntheticsStepDetailWarning) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *SyntheticsStepDetailWarning) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *SyntheticsStepDetailWarning) SetMessage(v string) { + o.Message = v +} + +// GetType returns the Type field value. +func (o *SyntheticsStepDetailWarning) GetType() SyntheticsWarningType { + if o == nil { + var ret SyntheticsWarningType + 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 *SyntheticsStepDetailWarning) GetTypeOk() (*SyntheticsWarningType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsStepDetailWarning) SetType(v SyntheticsWarningType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsStepDetailWarning) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["message"] = o.Message + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsStepDetailWarning) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Message *string `json:"message"` + Type *SyntheticsWarningType `json:"type"` + }{} + all := struct { + Message string `json:"message"` + Type SyntheticsWarningType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Message = all.Message + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_step_type.go b/api/v1/datadog/model_synthetics_step_type.go new file mode 100644 index 00000000000..7850d166b05 --- /dev/null +++ b/api/v1/datadog/model_synthetics_step_type.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsStepType Step type used in your Synthetic test. +type SyntheticsStepType string + +// List of SyntheticsStepType. +const ( + SYNTHETICSSTEPTYPE_ASSERT_CURRENT_URL SyntheticsStepType = "assertCurrentUrl" + SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_ATTRIBUTE SyntheticsStepType = "assertElementAttribute" + SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_CONTENT SyntheticsStepType = "assertElementContent" + SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_PRESENT SyntheticsStepType = "assertElementPresent" + SYNTHETICSSTEPTYPE_ASSERT_EMAIL SyntheticsStepType = "assertEmail" + SYNTHETICSSTEPTYPE_ASSERT_FILE_DOWNLOAD SyntheticsStepType = "assertFileDownload" + SYNTHETICSSTEPTYPE_ASSERT_FROM_JAVASCRIPT SyntheticsStepType = "assertFromJavascript" + SYNTHETICSSTEPTYPE_ASSERT_PAGE_CONTAINS SyntheticsStepType = "assertPageContains" + SYNTHETICSSTEPTYPE_ASSERT_PAGE_LACKS SyntheticsStepType = "assertPageLacks" + SYNTHETICSSTEPTYPE_CLICK SyntheticsStepType = "click" + SYNTHETICSSTEPTYPE_EXTRACT_FROM_JAVASCRIPT SyntheticsStepType = "extractFromJavascript" + SYNTHETICSSTEPTYPE_EXTRACT_VARIABLE SyntheticsStepType = "extractVariable" + SYNTHETICSSTEPTYPE_GO_TO_EMAIL_LINK SyntheticsStepType = "goToEmailLink" + SYNTHETICSSTEPTYPE_GO_TO_URL SyntheticsStepType = "goToUrl" + SYNTHETICSSTEPTYPE_GO_TO_URL_AND_MEASURE_TTI SyntheticsStepType = "goToUrlAndMeasureTti" + SYNTHETICSSTEPTYPE_HOVER SyntheticsStepType = "hover" + SYNTHETICSSTEPTYPE_PLAY_SUB_TEST SyntheticsStepType = "playSubTest" + SYNTHETICSSTEPTYPE_PRESS_KEY SyntheticsStepType = "pressKey" + SYNTHETICSSTEPTYPE_REFRESH SyntheticsStepType = "refresh" + SYNTHETICSSTEPTYPE_RUN_API_TEST SyntheticsStepType = "runApiTest" + SYNTHETICSSTEPTYPE_SCROLL SyntheticsStepType = "scroll" + SYNTHETICSSTEPTYPE_SELECT_OPTION SyntheticsStepType = "selectOption" + SYNTHETICSSTEPTYPE_TYPE_TEXT SyntheticsStepType = "typeText" + SYNTHETICSSTEPTYPE_UPLOAD_FILES SyntheticsStepType = "uploadFiles" + SYNTHETICSSTEPTYPE_WAIT SyntheticsStepType = "wait" +) + +var allowedSyntheticsStepTypeEnumValues = []SyntheticsStepType{ + SYNTHETICSSTEPTYPE_ASSERT_CURRENT_URL, + SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_ATTRIBUTE, + SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_CONTENT, + SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_PRESENT, + SYNTHETICSSTEPTYPE_ASSERT_EMAIL, + SYNTHETICSSTEPTYPE_ASSERT_FILE_DOWNLOAD, + SYNTHETICSSTEPTYPE_ASSERT_FROM_JAVASCRIPT, + SYNTHETICSSTEPTYPE_ASSERT_PAGE_CONTAINS, + SYNTHETICSSTEPTYPE_ASSERT_PAGE_LACKS, + SYNTHETICSSTEPTYPE_CLICK, + SYNTHETICSSTEPTYPE_EXTRACT_FROM_JAVASCRIPT, + SYNTHETICSSTEPTYPE_EXTRACT_VARIABLE, + SYNTHETICSSTEPTYPE_GO_TO_EMAIL_LINK, + SYNTHETICSSTEPTYPE_GO_TO_URL, + SYNTHETICSSTEPTYPE_GO_TO_URL_AND_MEASURE_TTI, + SYNTHETICSSTEPTYPE_HOVER, + SYNTHETICSSTEPTYPE_PLAY_SUB_TEST, + SYNTHETICSSTEPTYPE_PRESS_KEY, + SYNTHETICSSTEPTYPE_REFRESH, + SYNTHETICSSTEPTYPE_RUN_API_TEST, + SYNTHETICSSTEPTYPE_SCROLL, + SYNTHETICSSTEPTYPE_SELECT_OPTION, + SYNTHETICSSTEPTYPE_TYPE_TEXT, + SYNTHETICSSTEPTYPE_UPLOAD_FILES, + SYNTHETICSSTEPTYPE_WAIT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsStepType) GetAllowedValues() []SyntheticsStepType { + return allowedSyntheticsStepTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsStepType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsStepType(value) + return nil +} + +// NewSyntheticsStepTypeFromValue returns a pointer to a valid SyntheticsStepType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsStepTypeFromValue(v string) (*SyntheticsStepType, error) { + ev := SyntheticsStepType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsStepType: valid values are %v", v, allowedSyntheticsStepTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsStepType) IsValid() bool { + for _, existing := range allowedSyntheticsStepTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsStepType value. +func (v SyntheticsStepType) Ptr() *SyntheticsStepType { + return &v +} + +// NullableSyntheticsStepType handles when a null is used for SyntheticsStepType. +type NullableSyntheticsStepType struct { + value *SyntheticsStepType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsStepType) Get() *SyntheticsStepType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsStepType) Set(val *SyntheticsStepType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsStepType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsStepType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsStepType initializes the struct as if Set has been called. +func NewNullableSyntheticsStepType(val *SyntheticsStepType) *NullableSyntheticsStepType { + return &NullableSyntheticsStepType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsStepType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsStepType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_test_ci_options.go b/api/v1/datadog/model_synthetics_test_ci_options.go new file mode 100644 index 00000000000..f4c8cbb19a2 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_ci_options.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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestCiOptions CI/CD options for a Synthetic test. +type SyntheticsTestCiOptions struct { + // Execution rule for a Synthetics test. + ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,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{} +} + +// NewSyntheticsTestCiOptions instantiates a new SyntheticsTestCiOptions 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 NewSyntheticsTestCiOptions() *SyntheticsTestCiOptions { + this := SyntheticsTestCiOptions{} + return &this +} + +// NewSyntheticsTestCiOptionsWithDefaults instantiates a new SyntheticsTestCiOptions 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 NewSyntheticsTestCiOptionsWithDefaults() *SyntheticsTestCiOptions { + this := SyntheticsTestCiOptions{} + return &this +} + +// GetExecutionRule returns the ExecutionRule field value if set, zero value otherwise. +func (o *SyntheticsTestCiOptions) GetExecutionRule() SyntheticsTestExecutionRule { + if o == nil || o.ExecutionRule == nil { + var ret SyntheticsTestExecutionRule + return ret + } + return *o.ExecutionRule +} + +// GetExecutionRuleOk returns a tuple with the ExecutionRule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestCiOptions) GetExecutionRuleOk() (*SyntheticsTestExecutionRule, bool) { + if o == nil || o.ExecutionRule == nil { + return nil, false + } + return o.ExecutionRule, true +} + +// HasExecutionRule returns a boolean if a field has been set. +func (o *SyntheticsTestCiOptions) HasExecutionRule() bool { + if o != nil && o.ExecutionRule != nil { + return true + } + + return false +} + +// SetExecutionRule gets a reference to the given SyntheticsTestExecutionRule and assigns it to the ExecutionRule field. +func (o *SyntheticsTestCiOptions) SetExecutionRule(v SyntheticsTestExecutionRule) { + o.ExecutionRule = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestCiOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ExecutionRule != nil { + toSerialize["executionRule"] = o.ExecutionRule + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ExecutionRule; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ExecutionRule = all.ExecutionRule + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_config.go b/api/v1/datadog/model_synthetics_test_config.go new file mode 100644 index 00000000000..fad98e43084 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_config.go @@ -0,0 +1,226 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestConfig Configuration object for a Synthetic test. +type SyntheticsTestConfig struct { + // Array of assertions used for the test. Required for single API tests. + Assertions []SyntheticsAssertion `json:"assertions,omitempty"` + // Array of variables used for the test. + ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` + // Object describing the Synthetic test request. + Request *SyntheticsTestRequest `json:"request,omitempty"` + // Browser tests only - array of variables used for the test steps. + Variables []SyntheticsBrowserVariable `json:"variables,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{} +} + +// NewSyntheticsTestConfig instantiates a new SyntheticsTestConfig 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 NewSyntheticsTestConfig() *SyntheticsTestConfig { + this := SyntheticsTestConfig{} + return &this +} + +// NewSyntheticsTestConfigWithDefaults instantiates a new SyntheticsTestConfig 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 NewSyntheticsTestConfigWithDefaults() *SyntheticsTestConfig { + this := SyntheticsTestConfig{} + return &this +} + +// GetAssertions returns the Assertions field value if set, zero value otherwise. +func (o *SyntheticsTestConfig) GetAssertions() []SyntheticsAssertion { + if o == nil || o.Assertions == nil { + var ret []SyntheticsAssertion + return ret + } + return o.Assertions +} + +// GetAssertionsOk returns a tuple with the Assertions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { + if o == nil || o.Assertions == nil { + return nil, false + } + return &o.Assertions, true +} + +// HasAssertions returns a boolean if a field has been set. +func (o *SyntheticsTestConfig) HasAssertions() bool { + if o != nil && o.Assertions != nil { + return true + } + + return false +} + +// SetAssertions gets a reference to the given []SyntheticsAssertion and assigns it to the Assertions field. +func (o *SyntheticsTestConfig) SetAssertions(v []SyntheticsAssertion) { + o.Assertions = v +} + +// GetConfigVariables returns the ConfigVariables field value if set, zero value otherwise. +func (o *SyntheticsTestConfig) GetConfigVariables() []SyntheticsConfigVariable { + if o == nil || o.ConfigVariables == nil { + var ret []SyntheticsConfigVariable + return ret + } + return o.ConfigVariables +} + +// GetConfigVariablesOk returns a tuple with the ConfigVariables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool) { + if o == nil || o.ConfigVariables == nil { + return nil, false + } + return &o.ConfigVariables, true +} + +// HasConfigVariables returns a boolean if a field has been set. +func (o *SyntheticsTestConfig) HasConfigVariables() bool { + if o != nil && o.ConfigVariables != nil { + return true + } + + return false +} + +// SetConfigVariables gets a reference to the given []SyntheticsConfigVariable and assigns it to the ConfigVariables field. +func (o *SyntheticsTestConfig) SetConfigVariables(v []SyntheticsConfigVariable) { + o.ConfigVariables = v +} + +// GetRequest returns the Request field value if set, zero value otherwise. +func (o *SyntheticsTestConfig) GetRequest() SyntheticsTestRequest { + if o == nil || o.Request == nil { + var ret SyntheticsTestRequest + return ret + } + return *o.Request +} + +// GetRequestOk returns a tuple with the Request field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { + if o == nil || o.Request == nil { + return nil, false + } + return o.Request, true +} + +// HasRequest returns a boolean if a field has been set. +func (o *SyntheticsTestConfig) HasRequest() bool { + if o != nil && o.Request != nil { + return true + } + + return false +} + +// SetRequest gets a reference to the given SyntheticsTestRequest and assigns it to the Request field. +func (o *SyntheticsTestConfig) SetRequest(v SyntheticsTestRequest) { + o.Request = &v +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *SyntheticsTestConfig) GetVariables() []SyntheticsBrowserVariable { + if o == nil || o.Variables == nil { + var ret []SyntheticsBrowserVariable + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestConfig) GetVariablesOk() (*[]SyntheticsBrowserVariable, bool) { + if o == nil || o.Variables == nil { + return nil, false + } + return &o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *SyntheticsTestConfig) HasVariables() bool { + if o != nil && o.Variables != nil { + return true + } + + return false +} + +// SetVariables gets a reference to the given []SyntheticsBrowserVariable and assigns it to the Variables field. +func (o *SyntheticsTestConfig) SetVariables(v []SyntheticsBrowserVariable) { + o.Variables = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Assertions != nil { + toSerialize["assertions"] = o.Assertions + } + if o.ConfigVariables != nil { + toSerialize["configVariables"] = o.ConfigVariables + } + if o.Request != nil { + toSerialize["request"] = o.Request + } + if o.Variables != nil { + toSerialize["variables"] = o.Variables + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestConfig) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Assertions []SyntheticsAssertion `json:"assertions,omitempty"` + ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` + Request *SyntheticsTestRequest `json:"request,omitempty"` + Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Assertions = all.Assertions + o.ConfigVariables = all.ConfigVariables + if all.Request != nil && all.Request.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Request = all.Request + o.Variables = all.Variables + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_details.go b/api/v1/datadog/model_synthetics_test_details.go new file mode 100644 index 00000000000..b1d0f6f79d2 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_details.go @@ -0,0 +1,617 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestDetails Object containing details about your Synthetic test. +type SyntheticsTestDetails struct { + // Configuration object for a Synthetic test. + Config *SyntheticsTestConfig `json:"config,omitempty"` + // Object describing the creator of the shared element. + Creator *Creator `json:"creator,omitempty"` + // Array of locations used to run the test. + Locations []string `json:"locations,omitempty"` + // Notification message associated with the test. + Message *string `json:"message,omitempty"` + // The associated monitor ID. + MonitorId *int64 `json:"monitor_id,omitempty"` + // Name of the test. + Name *string `json:"name,omitempty"` + // Object describing the extra options for a Synthetic test. + Options *SyntheticsTestOptions `json:"options,omitempty"` + // The test public ID. + PublicId *string `json:"public_id,omitempty"` + // Define whether you want to start (`live`) or pause (`paused`) a + // Synthetic test. + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + // For browser test, the steps of the test. + Steps []SyntheticsStep `json:"steps,omitempty"` + // The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, + // `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. + Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` + // Array of tags attached to the test. + Tags []string `json:"tags,omitempty"` + // Type of the Synthetic test, either `api` or `browser`. + Type *SyntheticsTestDetailsType `json:"type,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{} +} + +// NewSyntheticsTestDetails instantiates a new SyntheticsTestDetails 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 NewSyntheticsTestDetails() *SyntheticsTestDetails { + this := SyntheticsTestDetails{} + return &this +} + +// NewSyntheticsTestDetailsWithDefaults instantiates a new SyntheticsTestDetails 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 NewSyntheticsTestDetailsWithDefaults() *SyntheticsTestDetails { + this := SyntheticsTestDetails{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetConfig() SyntheticsTestConfig { + if o == nil || o.Config == nil { + var ret SyntheticsTestConfig + 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 *SyntheticsTestDetails) GetConfigOk() (*SyntheticsTestConfig, 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 *SyntheticsTestDetails) HasConfig() bool { + if o != nil && o.Config != nil { + return true + } + + return false +} + +// SetConfig gets a reference to the given SyntheticsTestConfig and assigns it to the Config field. +func (o *SyntheticsTestDetails) SetConfig(v SyntheticsTestConfig) { + o.Config = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetCreator() Creator { + if o == nil || o.Creator == nil { + var ret Creator + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetCreatorOk() (*Creator, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given Creator and assigns it to the Creator field. +func (o *SyntheticsTestDetails) SetCreator(v Creator) { + o.Creator = &v +} + +// GetLocations returns the Locations field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetLocations() []string { + if o == nil || o.Locations == nil { + var ret []string + return ret + } + return o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetLocationsOk() (*[]string, bool) { + if o == nil || o.Locations == nil { + return nil, false + } + return &o.Locations, true +} + +// HasLocations returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasLocations() bool { + if o != nil && o.Locations != nil { + return true + } + + return false +} + +// SetLocations gets a reference to the given []string and assigns it to the Locations field. +func (o *SyntheticsTestDetails) SetLocations(v []string) { + o.Locations = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SyntheticsTestDetails) SetMessage(v string) { + o.Message = &v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetMonitorId() int64 { + if o == nil || o.MonitorId == nil { + var ret int64 + return ret + } + return *o.MonitorId +} + +// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetMonitorIdOk() (*int64, bool) { + if o == nil || o.MonitorId == nil { + return nil, false + } + return o.MonitorId, true +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasMonitorId() bool { + if o != nil && o.MonitorId != nil { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. +func (o *SyntheticsTestDetails) SetMonitorId(v int64) { + o.MonitorId = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsTestDetails) SetName(v string) { + o.Name = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetOptions() SyntheticsTestOptions { + if o == nil || o.Options == nil { + var ret SyntheticsTestOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetOptionsOk() (*SyntheticsTestOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given SyntheticsTestOptions and assigns it to the Options field. +func (o *SyntheticsTestDetails) SetOptions(v SyntheticsTestOptions) { + o.Options = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *SyntheticsTestDetails) SetPublicId(v string) { + o.PublicId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetStatus() SyntheticsTestPauseStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestPauseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. +func (o *SyntheticsTestDetails) SetStatus(v SyntheticsTestPauseStatus) { + o.Status = &v +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetSteps() []SyntheticsStep { + if o == nil || o.Steps == nil { + var ret []SyntheticsStep + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetStepsOk() (*[]SyntheticsStep, bool) { + if o == nil || o.Steps == nil { + return nil, false + } + return &o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasSteps() bool { + if o != nil && o.Steps != nil { + return true + } + + return false +} + +// SetSteps gets a reference to the given []SyntheticsStep and assigns it to the Steps field. +func (o *SyntheticsTestDetails) SetSteps(v []SyntheticsStep) { + o.Steps = v +} + +// GetSubtype returns the Subtype field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetSubtype() SyntheticsTestDetailsSubType { + if o == nil || o.Subtype == nil { + var ret SyntheticsTestDetailsSubType + return ret + } + return *o.Subtype +} + +// GetSubtypeOk returns a tuple with the Subtype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetSubtypeOk() (*SyntheticsTestDetailsSubType, bool) { + if o == nil || o.Subtype == nil { + return nil, false + } + return o.Subtype, true +} + +// HasSubtype returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasSubtype() bool { + if o != nil && o.Subtype != nil { + return true + } + + return false +} + +// SetSubtype gets a reference to the given SyntheticsTestDetailsSubType and assigns it to the Subtype field. +func (o *SyntheticsTestDetails) SetSubtype(v SyntheticsTestDetailsSubType) { + o.Subtype = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SyntheticsTestDetails) GetTagsOk() (*[]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 *SyntheticsTestDetails) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SyntheticsTestDetails) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsTestDetails) GetType() SyntheticsTestDetailsType { + if o == nil || o.Type == nil { + var ret SyntheticsTestDetailsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestDetails) GetTypeOk() (*SyntheticsTestDetailsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsTestDetails) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsTestDetailsType and assigns it to the Type field. +func (o *SyntheticsTestDetails) SetType(v SyntheticsTestDetailsType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestDetails) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Config != nil { + toSerialize["config"] = o.Config + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.Locations != nil { + toSerialize["locations"] = o.Locations + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.MonitorId != nil { + toSerialize["monitor_id"] = o.MonitorId + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Steps != nil { + toSerialize["steps"] = o.Steps + } + if o.Subtype != nil { + toSerialize["subtype"] = o.Subtype + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestDetails) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Config *SyntheticsTestConfig `json:"config,omitempty"` + Creator *Creator `json:"creator,omitempty"` + Locations []string `json:"locations,omitempty"` + Message *string `json:"message,omitempty"` + MonitorId *int64 `json:"monitor_id,omitempty"` + Name *string `json:"name,omitempty"` + Options *SyntheticsTestOptions `json:"options,omitempty"` + PublicId *string `json:"public_id,omitempty"` + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + Steps []SyntheticsStep `json:"steps,omitempty"` + Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *SyntheticsTestDetailsType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Subtype; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Config != nil && all.Config.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Config = all.Config + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.Locations = all.Locations + o.Message = all.Message + o.MonitorId = all.MonitorId + o.Name = all.Name + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.PublicId = all.PublicId + o.Status = all.Status + o.Steps = all.Steps + o.Subtype = all.Subtype + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_details_sub_type.go b/api/v1/datadog/model_synthetics_test_details_sub_type.go new file mode 100644 index 00000000000..7b20e6e1442 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_details_sub_type.go @@ -0,0 +1,124 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTestDetailsSubType The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, +// `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. +type SyntheticsTestDetailsSubType string + +// List of SyntheticsTestDetailsSubType. +const ( + SYNTHETICSTESTDETAILSSUBTYPE_HTTP SyntheticsTestDetailsSubType = "http" + SYNTHETICSTESTDETAILSSUBTYPE_SSL SyntheticsTestDetailsSubType = "ssl" + SYNTHETICSTESTDETAILSSUBTYPE_TCP SyntheticsTestDetailsSubType = "tcp" + SYNTHETICSTESTDETAILSSUBTYPE_DNS SyntheticsTestDetailsSubType = "dns" + SYNTHETICSTESTDETAILSSUBTYPE_MULTI SyntheticsTestDetailsSubType = "multi" + SYNTHETICSTESTDETAILSSUBTYPE_ICMP SyntheticsTestDetailsSubType = "icmp" + SYNTHETICSTESTDETAILSSUBTYPE_UDP SyntheticsTestDetailsSubType = "udp" + SYNTHETICSTESTDETAILSSUBTYPE_WEBSOCKET SyntheticsTestDetailsSubType = "websocket" + SYNTHETICSTESTDETAILSSUBTYPE_GRPC SyntheticsTestDetailsSubType = "grpc" +) + +var allowedSyntheticsTestDetailsSubTypeEnumValues = []SyntheticsTestDetailsSubType{ + SYNTHETICSTESTDETAILSSUBTYPE_HTTP, + SYNTHETICSTESTDETAILSSUBTYPE_SSL, + SYNTHETICSTESTDETAILSSUBTYPE_TCP, + SYNTHETICSTESTDETAILSSUBTYPE_DNS, + SYNTHETICSTESTDETAILSSUBTYPE_MULTI, + SYNTHETICSTESTDETAILSSUBTYPE_ICMP, + SYNTHETICSTESTDETAILSSUBTYPE_UDP, + SYNTHETICSTESTDETAILSSUBTYPE_WEBSOCKET, + SYNTHETICSTESTDETAILSSUBTYPE_GRPC, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestDetailsSubType) GetAllowedValues() []SyntheticsTestDetailsSubType { + return allowedSyntheticsTestDetailsSubTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestDetailsSubType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestDetailsSubType(value) + return nil +} + +// NewSyntheticsTestDetailsSubTypeFromValue returns a pointer to a valid SyntheticsTestDetailsSubType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestDetailsSubTypeFromValue(v string) (*SyntheticsTestDetailsSubType, error) { + ev := SyntheticsTestDetailsSubType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestDetailsSubType: valid values are %v", v, allowedSyntheticsTestDetailsSubTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestDetailsSubType) IsValid() bool { + for _, existing := range allowedSyntheticsTestDetailsSubTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestDetailsSubType value. +func (v SyntheticsTestDetailsSubType) Ptr() *SyntheticsTestDetailsSubType { + return &v +} + +// NullableSyntheticsTestDetailsSubType handles when a null is used for SyntheticsTestDetailsSubType. +type NullableSyntheticsTestDetailsSubType struct { + value *SyntheticsTestDetailsSubType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsTestDetailsSubType) Get() *SyntheticsTestDetailsSubType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsTestDetailsSubType) Set(val *SyntheticsTestDetailsSubType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsTestDetailsSubType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsTestDetailsSubType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsTestDetailsSubType initializes the struct as if Set has been called. +func NewNullableSyntheticsTestDetailsSubType(val *SyntheticsTestDetailsSubType) *NullableSyntheticsTestDetailsSubType { + return &NullableSyntheticsTestDetailsSubType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsTestDetailsSubType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsTestDetailsSubType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_test_details_type.go b/api/v1/datadog/model_synthetics_test_details_type.go new file mode 100644 index 00000000000..b784444d929 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_details_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTestDetailsType Type of the Synthetic test, either `api` or `browser`. +type SyntheticsTestDetailsType string + +// List of SyntheticsTestDetailsType. +const ( + SYNTHETICSTESTDETAILSTYPE_API SyntheticsTestDetailsType = "api" + SYNTHETICSTESTDETAILSTYPE_BROWSER SyntheticsTestDetailsType = "browser" +) + +var allowedSyntheticsTestDetailsTypeEnumValues = []SyntheticsTestDetailsType{ + SYNTHETICSTESTDETAILSTYPE_API, + SYNTHETICSTESTDETAILSTYPE_BROWSER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestDetailsType) GetAllowedValues() []SyntheticsTestDetailsType { + return allowedSyntheticsTestDetailsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestDetailsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestDetailsType(value) + return nil +} + +// NewSyntheticsTestDetailsTypeFromValue returns a pointer to a valid SyntheticsTestDetailsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestDetailsTypeFromValue(v string) (*SyntheticsTestDetailsType, error) { + ev := SyntheticsTestDetailsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestDetailsType: valid values are %v", v, allowedSyntheticsTestDetailsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestDetailsType) IsValid() bool { + for _, existing := range allowedSyntheticsTestDetailsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestDetailsType value. +func (v SyntheticsTestDetailsType) Ptr() *SyntheticsTestDetailsType { + return &v +} + +// NullableSyntheticsTestDetailsType handles when a null is used for SyntheticsTestDetailsType. +type NullableSyntheticsTestDetailsType struct { + value *SyntheticsTestDetailsType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsTestDetailsType) Get() *SyntheticsTestDetailsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsTestDetailsType) Set(val *SyntheticsTestDetailsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsTestDetailsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsTestDetailsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsTestDetailsType initializes the struct as if Set has been called. +func NewNullableSyntheticsTestDetailsType(val *SyntheticsTestDetailsType) *NullableSyntheticsTestDetailsType { + return &NullableSyntheticsTestDetailsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsTestDetailsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsTestDetailsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_test_execution_rule.go b/api/v1/datadog/model_synthetics_test_execution_rule.go new file mode 100644 index 00000000000..41bca6d8545 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_execution_rule.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTestExecutionRule Execution rule for a Synthetics test. +type SyntheticsTestExecutionRule string + +// List of SyntheticsTestExecutionRule. +const ( + SYNTHETICSTESTEXECUTIONRULE_BLOCKING SyntheticsTestExecutionRule = "blocking" + SYNTHETICSTESTEXECUTIONRULE_NON_BLOCKING SyntheticsTestExecutionRule = "non_blocking" + SYNTHETICSTESTEXECUTIONRULE_SKIPPED SyntheticsTestExecutionRule = "skipped" +) + +var allowedSyntheticsTestExecutionRuleEnumValues = []SyntheticsTestExecutionRule{ + SYNTHETICSTESTEXECUTIONRULE_BLOCKING, + SYNTHETICSTESTEXECUTIONRULE_NON_BLOCKING, + SYNTHETICSTESTEXECUTIONRULE_SKIPPED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestExecutionRule) GetAllowedValues() []SyntheticsTestExecutionRule { + return allowedSyntheticsTestExecutionRuleEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestExecutionRule) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestExecutionRule(value) + return nil +} + +// NewSyntheticsTestExecutionRuleFromValue returns a pointer to a valid SyntheticsTestExecutionRule +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestExecutionRuleFromValue(v string) (*SyntheticsTestExecutionRule, error) { + ev := SyntheticsTestExecutionRule(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestExecutionRule: valid values are %v", v, allowedSyntheticsTestExecutionRuleEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestExecutionRule) IsValid() bool { + for _, existing := range allowedSyntheticsTestExecutionRuleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestExecutionRule value. +func (v SyntheticsTestExecutionRule) Ptr() *SyntheticsTestExecutionRule { + return &v +} + +// NullableSyntheticsTestExecutionRule handles when a null is used for SyntheticsTestExecutionRule. +type NullableSyntheticsTestExecutionRule struct { + value *SyntheticsTestExecutionRule + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsTestExecutionRule) Get() *SyntheticsTestExecutionRule { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsTestExecutionRule) Set(val *SyntheticsTestExecutionRule) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsTestExecutionRule) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsTestExecutionRule) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsTestExecutionRule initializes the struct as if Set has been called. +func NewNullableSyntheticsTestExecutionRule(val *SyntheticsTestExecutionRule) *NullableSyntheticsTestExecutionRule { + return &NullableSyntheticsTestExecutionRule{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsTestExecutionRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsTestExecutionRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_test_monitor_status.go b/api/v1/datadog/model_synthetics_test_monitor_status.go new file mode 100644 index 00000000000..88d35f2183b --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_monitor_status.go @@ -0,0 +1,114 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTestMonitorStatus The status of your Synthetic monitor. +// * `O` for not triggered +// * `1` for triggered +// * `2` for no data +type SyntheticsTestMonitorStatus int64 + +// List of SyntheticsTestMonitorStatus. +const ( + SYNTHETICSTESTMONITORSTATUS_UNTRIGGERED SyntheticsTestMonitorStatus = 0 + SYNTHETICSTESTMONITORSTATUS_TRIGGERED SyntheticsTestMonitorStatus = 1 + SYNTHETICSTESTMONITORSTATUS_NO_DATA SyntheticsTestMonitorStatus = 2 +) + +var allowedSyntheticsTestMonitorStatusEnumValues = []SyntheticsTestMonitorStatus{ + SYNTHETICSTESTMONITORSTATUS_UNTRIGGERED, + SYNTHETICSTESTMONITORSTATUS_TRIGGERED, + SYNTHETICSTESTMONITORSTATUS_NO_DATA, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestMonitorStatus) GetAllowedValues() []SyntheticsTestMonitorStatus { + return allowedSyntheticsTestMonitorStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestMonitorStatus) UnmarshalJSON(src []byte) error { + var value int64 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestMonitorStatus(value) + return nil +} + +// NewSyntheticsTestMonitorStatusFromValue returns a pointer to a valid SyntheticsTestMonitorStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestMonitorStatusFromValue(v int64) (*SyntheticsTestMonitorStatus, error) { + ev := SyntheticsTestMonitorStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestMonitorStatus: valid values are %v", v, allowedSyntheticsTestMonitorStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestMonitorStatus) IsValid() bool { + for _, existing := range allowedSyntheticsTestMonitorStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestMonitorStatus value. +func (v SyntheticsTestMonitorStatus) Ptr() *SyntheticsTestMonitorStatus { + return &v +} + +// NullableSyntheticsTestMonitorStatus handles when a null is used for SyntheticsTestMonitorStatus. +type NullableSyntheticsTestMonitorStatus struct { + value *SyntheticsTestMonitorStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsTestMonitorStatus) Get() *SyntheticsTestMonitorStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsTestMonitorStatus) Set(val *SyntheticsTestMonitorStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsTestMonitorStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsTestMonitorStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsTestMonitorStatus initializes the struct as if Set has been called. +func NewNullableSyntheticsTestMonitorStatus(val *SyntheticsTestMonitorStatus) *NullableSyntheticsTestMonitorStatus { + return &NullableSyntheticsTestMonitorStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsTestMonitorStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsTestMonitorStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_test_options.go b/api/v1/datadog/model_synthetics_test_options.go new file mode 100644 index 00000000000..982ce4b0f5d --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_options.go @@ -0,0 +1,767 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestOptions Object describing the extra options for a Synthetic test. +type SyntheticsTestOptions struct { + // For SSL test, whether or not the test should allow self signed + // certificates. + AcceptSelfSigned *bool `json:"accept_self_signed,omitempty"` + // Allows loading insecure content for an HTTP request. + AllowInsecure *bool `json:"allow_insecure,omitempty"` + // For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP. + CheckCertificateRevocation *bool `json:"checkCertificateRevocation,omitempty"` + // CI/CD options for a Synthetic test. + Ci *SyntheticsTestCiOptions `json:"ci,omitempty"` + // For browser test, array with the different device IDs used to run the test. + DeviceIds []SyntheticsDeviceID `json:"device_ids,omitempty"` + // Whether or not to disable CORS mechanism. + DisableCors *bool `json:"disableCors,omitempty"` + // For API HTTP test, whether or not the test should follow redirects. + FollowRedirects *bool `json:"follow_redirects,omitempty"` + // Minimum amount of time in failure required to trigger an alert. + MinFailureDuration *int64 `json:"min_failure_duration,omitempty"` + // Minimum number of locations in failure required to trigger + // an alert. + MinLocationFailed *int64 `json:"min_location_failed,omitempty"` + // The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs. + MonitorName *string `json:"monitor_name,omitempty"` + // Object containing the options for a Synthetic test as a monitor + // (for example, renotification). + MonitorOptions *SyntheticsTestOptionsMonitorOptions `json:"monitor_options,omitempty"` + // Integer from 1 (high) to 5 (low) indicating alert severity. + MonitorPriority *int32 `json:"monitor_priority,omitempty"` + // Prevents saving screenshots of the steps. + NoScreenshot *bool `json:"noScreenshot,omitempty"` + // A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. + RestrictedRoles []string `json:"restricted_roles,omitempty"` + // Object describing the retry strategy to apply to a Synthetic test. + Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` + // The RUM data collection settings for the Synthetic browser test. + // **Note:** There are 3 ways to format RUM settings: + // + // `{ isEnabled: false }` + // RUM data is not collected. + // + // `{ isEnabled: true }` + // RUM data is collected from the Synthetic test's default application. + // + // `{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 }` + // RUM data is collected using the specified application. + RumSettings *SyntheticsBrowserTestRumSettings `json:"rumSettings,omitempty"` + // The frequency at which to run the Synthetic test (in seconds). + TickEvery *int64 `json:"tick_every,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{} +} + +// NewSyntheticsTestOptions instantiates a new SyntheticsTestOptions 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 NewSyntheticsTestOptions() *SyntheticsTestOptions { + this := SyntheticsTestOptions{} + return &this +} + +// NewSyntheticsTestOptionsWithDefaults instantiates a new SyntheticsTestOptions 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 NewSyntheticsTestOptionsWithDefaults() *SyntheticsTestOptions { + this := SyntheticsTestOptions{} + return &this +} + +// GetAcceptSelfSigned returns the AcceptSelfSigned field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetAcceptSelfSigned() bool { + if o == nil || o.AcceptSelfSigned == nil { + var ret bool + return ret + } + return *o.AcceptSelfSigned +} + +// GetAcceptSelfSignedOk returns a tuple with the AcceptSelfSigned field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetAcceptSelfSignedOk() (*bool, bool) { + if o == nil || o.AcceptSelfSigned == nil { + return nil, false + } + return o.AcceptSelfSigned, true +} + +// HasAcceptSelfSigned returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasAcceptSelfSigned() bool { + if o != nil && o.AcceptSelfSigned != nil { + return true + } + + return false +} + +// SetAcceptSelfSigned gets a reference to the given bool and assigns it to the AcceptSelfSigned field. +func (o *SyntheticsTestOptions) SetAcceptSelfSigned(v bool) { + o.AcceptSelfSigned = &v +} + +// GetAllowInsecure returns the AllowInsecure field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetAllowInsecure() bool { + if o == nil || o.AllowInsecure == nil { + var ret bool + return ret + } + return *o.AllowInsecure +} + +// GetAllowInsecureOk returns a tuple with the AllowInsecure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetAllowInsecureOk() (*bool, bool) { + if o == nil || o.AllowInsecure == nil { + return nil, false + } + return o.AllowInsecure, true +} + +// HasAllowInsecure returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasAllowInsecure() bool { + if o != nil && o.AllowInsecure != nil { + return true + } + + return false +} + +// SetAllowInsecure gets a reference to the given bool and assigns it to the AllowInsecure field. +func (o *SyntheticsTestOptions) SetAllowInsecure(v bool) { + o.AllowInsecure = &v +} + +// GetCheckCertificateRevocation returns the CheckCertificateRevocation field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetCheckCertificateRevocation() bool { + if o == nil || o.CheckCertificateRevocation == nil { + var ret bool + return ret + } + return *o.CheckCertificateRevocation +} + +// GetCheckCertificateRevocationOk returns a tuple with the CheckCertificateRevocation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetCheckCertificateRevocationOk() (*bool, bool) { + if o == nil || o.CheckCertificateRevocation == nil { + return nil, false + } + return o.CheckCertificateRevocation, true +} + +// HasCheckCertificateRevocation returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasCheckCertificateRevocation() bool { + if o != nil && o.CheckCertificateRevocation != nil { + return true + } + + return false +} + +// SetCheckCertificateRevocation gets a reference to the given bool and assigns it to the CheckCertificateRevocation field. +func (o *SyntheticsTestOptions) SetCheckCertificateRevocation(v bool) { + o.CheckCertificateRevocation = &v +} + +// GetCi returns the Ci field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetCi() SyntheticsTestCiOptions { + if o == nil || o.Ci == nil { + var ret SyntheticsTestCiOptions + return ret + } + return *o.Ci +} + +// GetCiOk returns a tuple with the Ci field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetCiOk() (*SyntheticsTestCiOptions, bool) { + if o == nil || o.Ci == nil { + return nil, false + } + return o.Ci, true +} + +// HasCi returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasCi() bool { + if o != nil && o.Ci != nil { + return true + } + + return false +} + +// SetCi gets a reference to the given SyntheticsTestCiOptions and assigns it to the Ci field. +func (o *SyntheticsTestOptions) SetCi(v SyntheticsTestCiOptions) { + o.Ci = &v +} + +// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetDeviceIds() []SyntheticsDeviceID { + if o == nil || o.DeviceIds == nil { + var ret []SyntheticsDeviceID + return ret + } + return o.DeviceIds +} + +// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetDeviceIdsOk() (*[]SyntheticsDeviceID, bool) { + if o == nil || o.DeviceIds == nil { + return nil, false + } + return &o.DeviceIds, true +} + +// HasDeviceIds returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasDeviceIds() bool { + if o != nil && o.DeviceIds != nil { + return true + } + + return false +} + +// SetDeviceIds gets a reference to the given []SyntheticsDeviceID and assigns it to the DeviceIds field. +func (o *SyntheticsTestOptions) SetDeviceIds(v []SyntheticsDeviceID) { + o.DeviceIds = v +} + +// GetDisableCors returns the DisableCors field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetDisableCors() bool { + if o == nil || o.DisableCors == nil { + var ret bool + return ret + } + return *o.DisableCors +} + +// GetDisableCorsOk returns a tuple with the DisableCors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetDisableCorsOk() (*bool, bool) { + if o == nil || o.DisableCors == nil { + return nil, false + } + return o.DisableCors, true +} + +// HasDisableCors returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasDisableCors() bool { + if o != nil && o.DisableCors != nil { + return true + } + + return false +} + +// SetDisableCors gets a reference to the given bool and assigns it to the DisableCors field. +func (o *SyntheticsTestOptions) SetDisableCors(v bool) { + o.DisableCors = &v +} + +// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetFollowRedirects() bool { + if o == nil || o.FollowRedirects == nil { + var ret bool + return ret + } + return *o.FollowRedirects +} + +// GetFollowRedirectsOk returns a tuple with the FollowRedirects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetFollowRedirectsOk() (*bool, bool) { + if o == nil || o.FollowRedirects == nil { + return nil, false + } + return o.FollowRedirects, true +} + +// HasFollowRedirects returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasFollowRedirects() bool { + if o != nil && o.FollowRedirects != nil { + return true + } + + return false +} + +// SetFollowRedirects gets a reference to the given bool and assigns it to the FollowRedirects field. +func (o *SyntheticsTestOptions) SetFollowRedirects(v bool) { + o.FollowRedirects = &v +} + +// GetMinFailureDuration returns the MinFailureDuration field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetMinFailureDuration() int64 { + if o == nil || o.MinFailureDuration == nil { + var ret int64 + return ret + } + return *o.MinFailureDuration +} + +// GetMinFailureDurationOk returns a tuple with the MinFailureDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetMinFailureDurationOk() (*int64, bool) { + if o == nil || o.MinFailureDuration == nil { + return nil, false + } + return o.MinFailureDuration, true +} + +// HasMinFailureDuration returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasMinFailureDuration() bool { + if o != nil && o.MinFailureDuration != nil { + return true + } + + return false +} + +// SetMinFailureDuration gets a reference to the given int64 and assigns it to the MinFailureDuration field. +func (o *SyntheticsTestOptions) SetMinFailureDuration(v int64) { + o.MinFailureDuration = &v +} + +// GetMinLocationFailed returns the MinLocationFailed field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetMinLocationFailed() int64 { + if o == nil || o.MinLocationFailed == nil { + var ret int64 + return ret + } + return *o.MinLocationFailed +} + +// GetMinLocationFailedOk returns a tuple with the MinLocationFailed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetMinLocationFailedOk() (*int64, bool) { + if o == nil || o.MinLocationFailed == nil { + return nil, false + } + return o.MinLocationFailed, true +} + +// HasMinLocationFailed returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasMinLocationFailed() bool { + if o != nil && o.MinLocationFailed != nil { + return true + } + + return false +} + +// SetMinLocationFailed gets a reference to the given int64 and assigns it to the MinLocationFailed field. +func (o *SyntheticsTestOptions) SetMinLocationFailed(v int64) { + o.MinLocationFailed = &v +} + +// GetMonitorName returns the MonitorName field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetMonitorName() string { + if o == nil || o.MonitorName == nil { + var ret string + return ret + } + return *o.MonitorName +} + +// GetMonitorNameOk returns a tuple with the MonitorName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetMonitorNameOk() (*string, bool) { + if o == nil || o.MonitorName == nil { + return nil, false + } + return o.MonitorName, true +} + +// HasMonitorName returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasMonitorName() bool { + if o != nil && o.MonitorName != nil { + return true + } + + return false +} + +// SetMonitorName gets a reference to the given string and assigns it to the MonitorName field. +func (o *SyntheticsTestOptions) SetMonitorName(v string) { + o.MonitorName = &v +} + +// GetMonitorOptions returns the MonitorOptions field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetMonitorOptions() SyntheticsTestOptionsMonitorOptions { + if o == nil || o.MonitorOptions == nil { + var ret SyntheticsTestOptionsMonitorOptions + return ret + } + return *o.MonitorOptions +} + +// GetMonitorOptionsOk returns a tuple with the MonitorOptions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetMonitorOptionsOk() (*SyntheticsTestOptionsMonitorOptions, bool) { + if o == nil || o.MonitorOptions == nil { + return nil, false + } + return o.MonitorOptions, true +} + +// HasMonitorOptions returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasMonitorOptions() bool { + if o != nil && o.MonitorOptions != nil { + return true + } + + return false +} + +// SetMonitorOptions gets a reference to the given SyntheticsTestOptionsMonitorOptions and assigns it to the MonitorOptions field. +func (o *SyntheticsTestOptions) SetMonitorOptions(v SyntheticsTestOptionsMonitorOptions) { + o.MonitorOptions = &v +} + +// GetMonitorPriority returns the MonitorPriority field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetMonitorPriority() int32 { + if o == nil || o.MonitorPriority == nil { + var ret int32 + return ret + } + return *o.MonitorPriority +} + +// GetMonitorPriorityOk returns a tuple with the MonitorPriority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetMonitorPriorityOk() (*int32, bool) { + if o == nil || o.MonitorPriority == nil { + return nil, false + } + return o.MonitorPriority, true +} + +// HasMonitorPriority returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasMonitorPriority() bool { + if o != nil && o.MonitorPriority != nil { + return true + } + + return false +} + +// SetMonitorPriority gets a reference to the given int32 and assigns it to the MonitorPriority field. +func (o *SyntheticsTestOptions) SetMonitorPriority(v int32) { + o.MonitorPriority = &v +} + +// GetNoScreenshot returns the NoScreenshot field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetNoScreenshot() bool { + if o == nil || o.NoScreenshot == nil { + var ret bool + return ret + } + return *o.NoScreenshot +} + +// GetNoScreenshotOk returns a tuple with the NoScreenshot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetNoScreenshotOk() (*bool, bool) { + if o == nil || o.NoScreenshot == nil { + return nil, false + } + return o.NoScreenshot, true +} + +// HasNoScreenshot returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasNoScreenshot() bool { + if o != nil && o.NoScreenshot != nil { + return true + } + + return false +} + +// SetNoScreenshot gets a reference to the given bool and assigns it to the NoScreenshot field. +func (o *SyntheticsTestOptions) SetNoScreenshot(v bool) { + o.NoScreenshot = &v +} + +// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetRestrictedRoles() []string { + if o == nil || o.RestrictedRoles == nil { + var ret []string + return ret + } + return o.RestrictedRoles +} + +// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetRestrictedRolesOk() (*[]string, bool) { + if o == nil || o.RestrictedRoles == nil { + return nil, false + } + return &o.RestrictedRoles, true +} + +// HasRestrictedRoles returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasRestrictedRoles() bool { + if o != nil && o.RestrictedRoles != nil { + return true + } + + return false +} + +// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field. +func (o *SyntheticsTestOptions) SetRestrictedRoles(v []string) { + o.RestrictedRoles = v +} + +// GetRetry returns the Retry field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetRetry() SyntheticsTestOptionsRetry { + if o == nil || o.Retry == nil { + var ret SyntheticsTestOptionsRetry + return ret + } + return *o.Retry +} + +// GetRetryOk returns a tuple with the Retry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetRetryOk() (*SyntheticsTestOptionsRetry, bool) { + if o == nil || o.Retry == nil { + return nil, false + } + return o.Retry, true +} + +// HasRetry returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasRetry() bool { + if o != nil && o.Retry != nil { + return true + } + + return false +} + +// SetRetry gets a reference to the given SyntheticsTestOptionsRetry and assigns it to the Retry field. +func (o *SyntheticsTestOptions) SetRetry(v SyntheticsTestOptionsRetry) { + o.Retry = &v +} + +// GetRumSettings returns the RumSettings field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetRumSettings() SyntheticsBrowserTestRumSettings { + if o == nil || o.RumSettings == nil { + var ret SyntheticsBrowserTestRumSettings + return ret + } + return *o.RumSettings +} + +// GetRumSettingsOk returns a tuple with the RumSettings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetRumSettingsOk() (*SyntheticsBrowserTestRumSettings, bool) { + if o == nil || o.RumSettings == nil { + return nil, false + } + return o.RumSettings, true +} + +// HasRumSettings returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasRumSettings() bool { + if o != nil && o.RumSettings != nil { + return true + } + + return false +} + +// SetRumSettings gets a reference to the given SyntheticsBrowserTestRumSettings and assigns it to the RumSettings field. +func (o *SyntheticsTestOptions) SetRumSettings(v SyntheticsBrowserTestRumSettings) { + o.RumSettings = &v +} + +// GetTickEvery returns the TickEvery field value if set, zero value otherwise. +func (o *SyntheticsTestOptions) GetTickEvery() int64 { + if o == nil || o.TickEvery == nil { + var ret int64 + return ret + } + return *o.TickEvery +} + +// GetTickEveryOk returns a tuple with the TickEvery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptions) GetTickEveryOk() (*int64, bool) { + if o == nil || o.TickEvery == nil { + return nil, false + } + return o.TickEvery, true +} + +// HasTickEvery returns a boolean if a field has been set. +func (o *SyntheticsTestOptions) HasTickEvery() bool { + if o != nil && o.TickEvery != nil { + return true + } + + return false +} + +// SetTickEvery gets a reference to the given int64 and assigns it to the TickEvery field. +func (o *SyntheticsTestOptions) SetTickEvery(v int64) { + o.TickEvery = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AcceptSelfSigned != nil { + toSerialize["accept_self_signed"] = o.AcceptSelfSigned + } + if o.AllowInsecure != nil { + toSerialize["allow_insecure"] = o.AllowInsecure + } + if o.CheckCertificateRevocation != nil { + toSerialize["checkCertificateRevocation"] = o.CheckCertificateRevocation + } + if o.Ci != nil { + toSerialize["ci"] = o.Ci + } + if o.DeviceIds != nil { + toSerialize["device_ids"] = o.DeviceIds + } + if o.DisableCors != nil { + toSerialize["disableCors"] = o.DisableCors + } + if o.FollowRedirects != nil { + toSerialize["follow_redirects"] = o.FollowRedirects + } + if o.MinFailureDuration != nil { + toSerialize["min_failure_duration"] = o.MinFailureDuration + } + if o.MinLocationFailed != nil { + toSerialize["min_location_failed"] = o.MinLocationFailed + } + if o.MonitorName != nil { + toSerialize["monitor_name"] = o.MonitorName + } + if o.MonitorOptions != nil { + toSerialize["monitor_options"] = o.MonitorOptions + } + if o.MonitorPriority != nil { + toSerialize["monitor_priority"] = o.MonitorPriority + } + if o.NoScreenshot != nil { + toSerialize["noScreenshot"] = o.NoScreenshot + } + if o.RestrictedRoles != nil { + toSerialize["restricted_roles"] = o.RestrictedRoles + } + if o.Retry != nil { + toSerialize["retry"] = o.Retry + } + if o.RumSettings != nil { + toSerialize["rumSettings"] = o.RumSettings + } + if o.TickEvery != nil { + toSerialize["tick_every"] = o.TickEvery + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AcceptSelfSigned *bool `json:"accept_self_signed,omitempty"` + AllowInsecure *bool `json:"allow_insecure,omitempty"` + CheckCertificateRevocation *bool `json:"checkCertificateRevocation,omitempty"` + Ci *SyntheticsTestCiOptions `json:"ci,omitempty"` + DeviceIds []SyntheticsDeviceID `json:"device_ids,omitempty"` + DisableCors *bool `json:"disableCors,omitempty"` + FollowRedirects *bool `json:"follow_redirects,omitempty"` + MinFailureDuration *int64 `json:"min_failure_duration,omitempty"` + MinLocationFailed *int64 `json:"min_location_failed,omitempty"` + MonitorName *string `json:"monitor_name,omitempty"` + MonitorOptions *SyntheticsTestOptionsMonitorOptions `json:"monitor_options,omitempty"` + MonitorPriority *int32 `json:"monitor_priority,omitempty"` + NoScreenshot *bool `json:"noScreenshot,omitempty"` + RestrictedRoles []string `json:"restricted_roles,omitempty"` + Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` + RumSettings *SyntheticsBrowserTestRumSettings `json:"rumSettings,omitempty"` + TickEvery *int64 `json:"tick_every,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AcceptSelfSigned = all.AcceptSelfSigned + o.AllowInsecure = all.AllowInsecure + o.CheckCertificateRevocation = all.CheckCertificateRevocation + if all.Ci != nil && all.Ci.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Ci = all.Ci + o.DeviceIds = all.DeviceIds + o.DisableCors = all.DisableCors + o.FollowRedirects = all.FollowRedirects + o.MinFailureDuration = all.MinFailureDuration + o.MinLocationFailed = all.MinLocationFailed + o.MonitorName = all.MonitorName + if all.MonitorOptions != nil && all.MonitorOptions.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.MonitorOptions = all.MonitorOptions + o.MonitorPriority = all.MonitorPriority + o.NoScreenshot = all.NoScreenshot + o.RestrictedRoles = all.RestrictedRoles + if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Retry = all.Retry + if all.RumSettings != nil && all.RumSettings.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumSettings = all.RumSettings + o.TickEvery = all.TickEvery + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_options_monitor_options.go b/api/v1/datadog/model_synthetics_test_options_monitor_options.go new file mode 100644 index 00000000000..38aea847057 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_options_monitor_options.go @@ -0,0 +1,104 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestOptionsMonitorOptions Object containing the options for a Synthetic test as a monitor +// (for example, renotification). +type SyntheticsTestOptionsMonitorOptions struct { + // Time interval before renotifying if the test is still failing + // (in minutes). + RenotifyInterval *int64 `json:"renotify_interval,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{} +} + +// NewSyntheticsTestOptionsMonitorOptions instantiates a new SyntheticsTestOptionsMonitorOptions 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 NewSyntheticsTestOptionsMonitorOptions() *SyntheticsTestOptionsMonitorOptions { + this := SyntheticsTestOptionsMonitorOptions{} + return &this +} + +// NewSyntheticsTestOptionsMonitorOptionsWithDefaults instantiates a new SyntheticsTestOptionsMonitorOptions 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 NewSyntheticsTestOptionsMonitorOptionsWithDefaults() *SyntheticsTestOptionsMonitorOptions { + this := SyntheticsTestOptionsMonitorOptions{} + return &this +} + +// GetRenotifyInterval returns the RenotifyInterval field value if set, zero value otherwise. +func (o *SyntheticsTestOptionsMonitorOptions) GetRenotifyInterval() int64 { + if o == nil || o.RenotifyInterval == nil { + var ret int64 + return ret + } + return *o.RenotifyInterval +} + +// GetRenotifyIntervalOk returns a tuple with the RenotifyInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptionsMonitorOptions) GetRenotifyIntervalOk() (*int64, bool) { + if o == nil || o.RenotifyInterval == nil { + return nil, false + } + return o.RenotifyInterval, true +} + +// HasRenotifyInterval returns a boolean if a field has been set. +func (o *SyntheticsTestOptionsMonitorOptions) HasRenotifyInterval() bool { + if o != nil && o.RenotifyInterval != nil { + return true + } + + return false +} + +// SetRenotifyInterval gets a reference to the given int64 and assigns it to the RenotifyInterval field. +func (o *SyntheticsTestOptionsMonitorOptions) SetRenotifyInterval(v int64) { + o.RenotifyInterval = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestOptionsMonitorOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.RenotifyInterval != nil { + toSerialize["renotify_interval"] = o.RenotifyInterval + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestOptionsMonitorOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + RenotifyInterval *int64 `json:"renotify_interval,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.RenotifyInterval = all.RenotifyInterval + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_options_retry.go b/api/v1/datadog/model_synthetics_test_options_retry.go new file mode 100644 index 00000000000..c7841710205 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_options_retry.go @@ -0,0 +1,143 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestOptionsRetry Object describing the retry strategy to apply to a Synthetic test. +type SyntheticsTestOptionsRetry struct { + // Number of times a test needs to be retried before marking a + // location as failed. Defaults to 0. + Count *int64 `json:"count,omitempty"` + // Time interval between retries (in milliseconds). Defaults to + // 300ms. + Interval *float64 `json:"interval,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{} +} + +// NewSyntheticsTestOptionsRetry instantiates a new SyntheticsTestOptionsRetry 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 NewSyntheticsTestOptionsRetry() *SyntheticsTestOptionsRetry { + this := SyntheticsTestOptionsRetry{} + return &this +} + +// NewSyntheticsTestOptionsRetryWithDefaults instantiates a new SyntheticsTestOptionsRetry 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 NewSyntheticsTestOptionsRetryWithDefaults() *SyntheticsTestOptionsRetry { + this := SyntheticsTestOptionsRetry{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *SyntheticsTestOptionsRetry) GetCount() int64 { + if o == nil || o.Count == nil { + var ret int64 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptionsRetry) GetCountOk() (*int64, bool) { + if o == nil || o.Count == nil { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *SyntheticsTestOptionsRetry) HasCount() bool { + if o != nil && o.Count != nil { + return true + } + + return false +} + +// SetCount gets a reference to the given int64 and assigns it to the Count field. +func (o *SyntheticsTestOptionsRetry) SetCount(v int64) { + o.Count = &v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *SyntheticsTestOptionsRetry) GetInterval() float64 { + if o == nil || o.Interval == nil { + var ret float64 + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptionsRetry) GetIntervalOk() (*float64, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *SyntheticsTestOptionsRetry) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given float64 and assigns it to the Interval field. +func (o *SyntheticsTestOptionsRetry) SetInterval(v float64) { + o.Interval = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestOptionsRetry) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Count != nil { + toSerialize["count"] = o.Count + } + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestOptionsRetry) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Count *int64 `json:"count,omitempty"` + Interval *float64 `json:"interval,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Count = all.Count + o.Interval = all.Interval + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_pause_status.go b/api/v1/datadog/model_synthetics_test_pause_status.go new file mode 100644 index 00000000000..6ddc9aeacd1 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_pause_status.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTestPauseStatus Define whether you want to start (`live`) or pause (`paused`) a +// Synthetic test. +type SyntheticsTestPauseStatus string + +// List of SyntheticsTestPauseStatus. +const ( + SYNTHETICSTESTPAUSESTATUS_LIVE SyntheticsTestPauseStatus = "live" + SYNTHETICSTESTPAUSESTATUS_PAUSED SyntheticsTestPauseStatus = "paused" +) + +var allowedSyntheticsTestPauseStatusEnumValues = []SyntheticsTestPauseStatus{ + SYNTHETICSTESTPAUSESTATUS_LIVE, + SYNTHETICSTESTPAUSESTATUS_PAUSED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestPauseStatus) GetAllowedValues() []SyntheticsTestPauseStatus { + return allowedSyntheticsTestPauseStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestPauseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestPauseStatus(value) + return nil +} + +// NewSyntheticsTestPauseStatusFromValue returns a pointer to a valid SyntheticsTestPauseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestPauseStatusFromValue(v string) (*SyntheticsTestPauseStatus, error) { + ev := SyntheticsTestPauseStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestPauseStatus: valid values are %v", v, allowedSyntheticsTestPauseStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestPauseStatus) IsValid() bool { + for _, existing := range allowedSyntheticsTestPauseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestPauseStatus value. +func (v SyntheticsTestPauseStatus) Ptr() *SyntheticsTestPauseStatus { + return &v +} + +// NullableSyntheticsTestPauseStatus handles when a null is used for SyntheticsTestPauseStatus. +type NullableSyntheticsTestPauseStatus struct { + value *SyntheticsTestPauseStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsTestPauseStatus) Get() *SyntheticsTestPauseStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsTestPauseStatus) Set(val *SyntheticsTestPauseStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsTestPauseStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsTestPauseStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsTestPauseStatus initializes the struct as if Set has been called. +func NewNullableSyntheticsTestPauseStatus(val *SyntheticsTestPauseStatus) *NullableSyntheticsTestPauseStatus { + return &NullableSyntheticsTestPauseStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsTestPauseStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsTestPauseStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_test_process_status.go b/api/v1/datadog/model_synthetics_test_process_status.go new file mode 100644 index 00000000000..949e0740eb8 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_process_status.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTestProcessStatus Status of a Synthetic test. +type SyntheticsTestProcessStatus string + +// List of SyntheticsTestProcessStatus. +const ( + SYNTHETICSTESTPROCESSSTATUS_NOT_SCHEDULED SyntheticsTestProcessStatus = "not_scheduled" + SYNTHETICSTESTPROCESSSTATUS_SCHEDULED SyntheticsTestProcessStatus = "scheduled" + SYNTHETICSTESTPROCESSSTATUS_STARTED SyntheticsTestProcessStatus = "started" + SYNTHETICSTESTPROCESSSTATUS_FINISHED SyntheticsTestProcessStatus = "finished" + SYNTHETICSTESTPROCESSSTATUS_FINISHED_WITH_ERROR SyntheticsTestProcessStatus = "finished_with_error" +) + +var allowedSyntheticsTestProcessStatusEnumValues = []SyntheticsTestProcessStatus{ + SYNTHETICSTESTPROCESSSTATUS_NOT_SCHEDULED, + SYNTHETICSTESTPROCESSSTATUS_SCHEDULED, + SYNTHETICSTESTPROCESSSTATUS_STARTED, + SYNTHETICSTESTPROCESSSTATUS_FINISHED, + SYNTHETICSTESTPROCESSSTATUS_FINISHED_WITH_ERROR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestProcessStatus) GetAllowedValues() []SyntheticsTestProcessStatus { + return allowedSyntheticsTestProcessStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestProcessStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestProcessStatus(value) + return nil +} + +// NewSyntheticsTestProcessStatusFromValue returns a pointer to a valid SyntheticsTestProcessStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestProcessStatusFromValue(v string) (*SyntheticsTestProcessStatus, error) { + ev := SyntheticsTestProcessStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestProcessStatus: valid values are %v", v, allowedSyntheticsTestProcessStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestProcessStatus) IsValid() bool { + for _, existing := range allowedSyntheticsTestProcessStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestProcessStatus value. +func (v SyntheticsTestProcessStatus) Ptr() *SyntheticsTestProcessStatus { + return &v +} + +// NullableSyntheticsTestProcessStatus handles when a null is used for SyntheticsTestProcessStatus. +type NullableSyntheticsTestProcessStatus struct { + value *SyntheticsTestProcessStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsTestProcessStatus) Get() *SyntheticsTestProcessStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsTestProcessStatus) Set(val *SyntheticsTestProcessStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsTestProcessStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsTestProcessStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsTestProcessStatus initializes the struct as if Set has been called. +func NewNullableSyntheticsTestProcessStatus(val *SyntheticsTestProcessStatus) *NullableSyntheticsTestProcessStatus { + return &NullableSyntheticsTestProcessStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsTestProcessStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsTestProcessStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_test_request.go b/api/v1/datadog/model_synthetics_test_request.go new file mode 100644 index 00000000000..e83070b0a36 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_request.go @@ -0,0 +1,945 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestRequest Object describing the Synthetic test request. +type SyntheticsTestRequest struct { + // Allows loading insecure content for an HTTP request in a multistep test step. + AllowInsecure *bool `json:"allow_insecure,omitempty"` + // Object to handle basic authentication when performing the test. + BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` + // Body to include in the test. + Body *string `json:"body,omitempty"` + // Client certificate to use when performing the test request. + Certificate *SyntheticsTestRequestCertificate `json:"certificate,omitempty"` + // DNS server to use for DNS tests. + DnsServer *string `json:"dnsServer,omitempty"` + // DNS server port to use for DNS tests. + DnsServerPort *int32 `json:"dnsServerPort,omitempty"` + // Specifies whether or not the request follows redirects. + FollowRedirects *bool `json:"follow_redirects,omitempty"` + // Headers to include when performing the test. + Headers map[string]string `json:"headers,omitempty"` + // Host name to perform the test with. + Host *string `json:"host,omitempty"` + // Message to send for UDP or WebSocket tests. + Message *string `json:"message,omitempty"` + // Metadata to include when performing the gRPC test. + Metadata map[string]string `json:"metadata,omitempty"` + // The HTTP method. + Method *HTTPMethod `json:"method,omitempty"` + // Determines whether or not to save the response body. + NoSavingResponseBody *bool `json:"noSavingResponseBody,omitempty"` + // Number of pings to use per test. + NumberOfPackets *int32 `json:"numberOfPackets,omitempty"` + // Port to use when performing the test. + Port *int64 `json:"port,omitempty"` + // The proxy to perform the test. + Proxy *SyntheticsTestRequestProxy `json:"proxy,omitempty"` + // Query to use for the test. + Query interface{} `json:"query,omitempty"` + // For SSL tests, it specifies on which server you want to initiate the TLS handshake, + // allowing the server to present one of multiple possible certificates on + // the same IP address and TCP port number. + Servername *string `json:"servername,omitempty"` + // gRPC service on which you want to perform the healthcheck. + Service *string `json:"service,omitempty"` + // Turns on a traceroute probe to discover all gateways along the path to the host destination. + ShouldTrackHops *bool `json:"shouldTrackHops,omitempty"` + // Timeout in seconds for the test. + Timeout *float64 `json:"timeout,omitempty"` + // URL to perform the test with. + Url *string `json:"url,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{} +} + +// NewSyntheticsTestRequest instantiates a new SyntheticsTestRequest 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 NewSyntheticsTestRequest() *SyntheticsTestRequest { + this := SyntheticsTestRequest{} + return &this +} + +// NewSyntheticsTestRequestWithDefaults instantiates a new SyntheticsTestRequest 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 NewSyntheticsTestRequestWithDefaults() *SyntheticsTestRequest { + this := SyntheticsTestRequest{} + return &this +} + +// GetAllowInsecure returns the AllowInsecure field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetAllowInsecure() bool { + if o == nil || o.AllowInsecure == nil { + var ret bool + return ret + } + return *o.AllowInsecure +} + +// GetAllowInsecureOk returns a tuple with the AllowInsecure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetAllowInsecureOk() (*bool, bool) { + if o == nil || o.AllowInsecure == nil { + return nil, false + } + return o.AllowInsecure, true +} + +// HasAllowInsecure returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasAllowInsecure() bool { + if o != nil && o.AllowInsecure != nil { + return true + } + + return false +} + +// SetAllowInsecure gets a reference to the given bool and assigns it to the AllowInsecure field. +func (o *SyntheticsTestRequest) SetAllowInsecure(v bool) { + o.AllowInsecure = &v +} + +// GetBasicAuth returns the BasicAuth field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetBasicAuth() SyntheticsBasicAuth { + if o == nil || o.BasicAuth == nil { + var ret SyntheticsBasicAuth + return ret + } + return *o.BasicAuth +} + +// GetBasicAuthOk returns a tuple with the BasicAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetBasicAuthOk() (*SyntheticsBasicAuth, bool) { + if o == nil || o.BasicAuth == nil { + return nil, false + } + return o.BasicAuth, true +} + +// HasBasicAuth returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasBasicAuth() bool { + if o != nil && o.BasicAuth != nil { + return true + } + + return false +} + +// SetBasicAuth gets a reference to the given SyntheticsBasicAuth and assigns it to the BasicAuth field. +func (o *SyntheticsTestRequest) SetBasicAuth(v SyntheticsBasicAuth) { + o.BasicAuth = &v +} + +// GetBody returns the Body field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetBody() string { + if o == nil || o.Body == nil { + var ret string + return ret + } + return *o.Body +} + +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetBodyOk() (*string, bool) { + if o == nil || o.Body == nil { + return nil, false + } + return o.Body, true +} + +// HasBody returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasBody() bool { + if o != nil && o.Body != nil { + return true + } + + return false +} + +// SetBody gets a reference to the given string and assigns it to the Body field. +func (o *SyntheticsTestRequest) SetBody(v string) { + o.Body = &v +} + +// GetCertificate returns the Certificate field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetCertificate() SyntheticsTestRequestCertificate { + if o == nil || o.Certificate == nil { + var ret SyntheticsTestRequestCertificate + return ret + } + return *o.Certificate +} + +// GetCertificateOk returns a tuple with the Certificate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetCertificateOk() (*SyntheticsTestRequestCertificate, bool) { + if o == nil || o.Certificate == nil { + return nil, false + } + return o.Certificate, true +} + +// HasCertificate returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasCertificate() bool { + if o != nil && o.Certificate != nil { + return true + } + + return false +} + +// SetCertificate gets a reference to the given SyntheticsTestRequestCertificate and assigns it to the Certificate field. +func (o *SyntheticsTestRequest) SetCertificate(v SyntheticsTestRequestCertificate) { + o.Certificate = &v +} + +// GetDnsServer returns the DnsServer field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetDnsServer() string { + if o == nil || o.DnsServer == nil { + var ret string + return ret + } + return *o.DnsServer +} + +// GetDnsServerOk returns a tuple with the DnsServer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetDnsServerOk() (*string, bool) { + if o == nil || o.DnsServer == nil { + return nil, false + } + return o.DnsServer, true +} + +// HasDnsServer returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasDnsServer() bool { + if o != nil && o.DnsServer != nil { + return true + } + + return false +} + +// SetDnsServer gets a reference to the given string and assigns it to the DnsServer field. +func (o *SyntheticsTestRequest) SetDnsServer(v string) { + o.DnsServer = &v +} + +// GetDnsServerPort returns the DnsServerPort field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetDnsServerPort() int32 { + if o == nil || o.DnsServerPort == nil { + var ret int32 + return ret + } + return *o.DnsServerPort +} + +// GetDnsServerPortOk returns a tuple with the DnsServerPort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetDnsServerPortOk() (*int32, bool) { + if o == nil || o.DnsServerPort == nil { + return nil, false + } + return o.DnsServerPort, true +} + +// HasDnsServerPort returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasDnsServerPort() bool { + if o != nil && o.DnsServerPort != nil { + return true + } + + return false +} + +// SetDnsServerPort gets a reference to the given int32 and assigns it to the DnsServerPort field. +func (o *SyntheticsTestRequest) SetDnsServerPort(v int32) { + o.DnsServerPort = &v +} + +// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetFollowRedirects() bool { + if o == nil || o.FollowRedirects == nil { + var ret bool + return ret + } + return *o.FollowRedirects +} + +// GetFollowRedirectsOk returns a tuple with the FollowRedirects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetFollowRedirectsOk() (*bool, bool) { + if o == nil || o.FollowRedirects == nil { + return nil, false + } + return o.FollowRedirects, true +} + +// HasFollowRedirects returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasFollowRedirects() bool { + if o != nil && o.FollowRedirects != nil { + return true + } + + return false +} + +// SetFollowRedirects gets a reference to the given bool and assigns it to the FollowRedirects field. +func (o *SyntheticsTestRequest) SetFollowRedirects(v bool) { + o.FollowRedirects = &v +} + +// GetHeaders returns the Headers field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetHeaders() map[string]string { + if o == nil || o.Headers == nil { + var ret map[string]string + return ret + } + return o.Headers +} + +// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetHeadersOk() (*map[string]string, bool) { + if o == nil || o.Headers == nil { + return nil, false + } + return &o.Headers, true +} + +// HasHeaders returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasHeaders() bool { + if o != nil && o.Headers != nil { + return true + } + + return false +} + +// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field. +func (o *SyntheticsTestRequest) SetHeaders(v map[string]string) { + o.Headers = v +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *SyntheticsTestRequest) SetHost(v string) { + o.Host = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SyntheticsTestRequest) SetMessage(v string) { + o.Message = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetMetadata() map[string]string { + if o == nil || o.Metadata == nil { + var ret map[string]string + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetMetadataOk() (*map[string]string, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return &o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *SyntheticsTestRequest) SetMetadata(v map[string]string) { + o.Metadata = v +} + +// GetMethod returns the Method field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetMethod() HTTPMethod { + if o == nil || o.Method == nil { + var ret HTTPMethod + return ret + } + return *o.Method +} + +// GetMethodOk returns a tuple with the Method field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetMethodOk() (*HTTPMethod, bool) { + if o == nil || o.Method == nil { + return nil, false + } + return o.Method, true +} + +// HasMethod returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasMethod() bool { + if o != nil && o.Method != nil { + return true + } + + return false +} + +// SetMethod gets a reference to the given HTTPMethod and assigns it to the Method field. +func (o *SyntheticsTestRequest) SetMethod(v HTTPMethod) { + o.Method = &v +} + +// GetNoSavingResponseBody returns the NoSavingResponseBody field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetNoSavingResponseBody() bool { + if o == nil || o.NoSavingResponseBody == nil { + var ret bool + return ret + } + return *o.NoSavingResponseBody +} + +// GetNoSavingResponseBodyOk returns a tuple with the NoSavingResponseBody field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetNoSavingResponseBodyOk() (*bool, bool) { + if o == nil || o.NoSavingResponseBody == nil { + return nil, false + } + return o.NoSavingResponseBody, true +} + +// HasNoSavingResponseBody returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasNoSavingResponseBody() bool { + if o != nil && o.NoSavingResponseBody != nil { + return true + } + + return false +} + +// SetNoSavingResponseBody gets a reference to the given bool and assigns it to the NoSavingResponseBody field. +func (o *SyntheticsTestRequest) SetNoSavingResponseBody(v bool) { + o.NoSavingResponseBody = &v +} + +// GetNumberOfPackets returns the NumberOfPackets field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetNumberOfPackets() int32 { + if o == nil || o.NumberOfPackets == nil { + var ret int32 + return ret + } + return *o.NumberOfPackets +} + +// GetNumberOfPacketsOk returns a tuple with the NumberOfPackets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetNumberOfPacketsOk() (*int32, bool) { + if o == nil || o.NumberOfPackets == nil { + return nil, false + } + return o.NumberOfPackets, true +} + +// HasNumberOfPackets returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasNumberOfPackets() bool { + if o != nil && o.NumberOfPackets != nil { + return true + } + + return false +} + +// SetNumberOfPackets gets a reference to the given int32 and assigns it to the NumberOfPackets field. +func (o *SyntheticsTestRequest) SetNumberOfPackets(v int32) { + o.NumberOfPackets = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetPort() int64 { + if o == nil || o.Port == nil { + var ret int64 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetPortOk() (*int64, bool) { + if o == nil || o.Port == nil { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasPort() bool { + if o != nil && o.Port != nil { + return true + } + + return false +} + +// SetPort gets a reference to the given int64 and assigns it to the Port field. +func (o *SyntheticsTestRequest) SetPort(v int64) { + o.Port = &v +} + +// GetProxy returns the Proxy field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetProxy() SyntheticsTestRequestProxy { + if o == nil || o.Proxy == nil { + var ret SyntheticsTestRequestProxy + return ret + } + return *o.Proxy +} + +// GetProxyOk returns a tuple with the Proxy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetProxyOk() (*SyntheticsTestRequestProxy, bool) { + if o == nil || o.Proxy == nil { + return nil, false + } + return o.Proxy, true +} + +// HasProxy returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasProxy() bool { + if o != nil && o.Proxy != nil { + return true + } + + return false +} + +// SetProxy gets a reference to the given SyntheticsTestRequestProxy and assigns it to the Proxy field. +func (o *SyntheticsTestRequest) SetProxy(v SyntheticsTestRequestProxy) { + o.Proxy = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetQuery() interface{} { + if o == nil || o.Query == nil { + var ret interface{} + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetQueryOk() (*interface{}, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return &o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given interface{} and assigns it to the Query field. +func (o *SyntheticsTestRequest) SetQuery(v interface{}) { + o.Query = v +} + +// GetServername returns the Servername field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetServername() string { + if o == nil || o.Servername == nil { + var ret string + return ret + } + return *o.Servername +} + +// GetServernameOk returns a tuple with the Servername field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetServernameOk() (*string, bool) { + if o == nil || o.Servername == nil { + return nil, false + } + return o.Servername, true +} + +// HasServername returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasServername() bool { + if o != nil && o.Servername != nil { + return true + } + + return false +} + +// SetServername gets a reference to the given string and assigns it to the Servername field. +func (o *SyntheticsTestRequest) SetServername(v string) { + o.Servername = &v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) 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 *SyntheticsTestRequest) 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 *SyntheticsTestRequest) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *SyntheticsTestRequest) SetService(v string) { + o.Service = &v +} + +// GetShouldTrackHops returns the ShouldTrackHops field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetShouldTrackHops() bool { + if o == nil || o.ShouldTrackHops == nil { + var ret bool + return ret + } + return *o.ShouldTrackHops +} + +// GetShouldTrackHopsOk returns a tuple with the ShouldTrackHops field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetShouldTrackHopsOk() (*bool, bool) { + if o == nil || o.ShouldTrackHops == nil { + return nil, false + } + return o.ShouldTrackHops, true +} + +// HasShouldTrackHops returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasShouldTrackHops() bool { + if o != nil && o.ShouldTrackHops != nil { + return true + } + + return false +} + +// SetShouldTrackHops gets a reference to the given bool and assigns it to the ShouldTrackHops field. +func (o *SyntheticsTestRequest) SetShouldTrackHops(v bool) { + o.ShouldTrackHops = &v +} + +// GetTimeout returns the Timeout field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetTimeout() float64 { + if o == nil || o.Timeout == nil { + var ret float64 + return ret + } + return *o.Timeout +} + +// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetTimeoutOk() (*float64, bool) { + if o == nil || o.Timeout == nil { + return nil, false + } + return o.Timeout, true +} + +// HasTimeout returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasTimeout() bool { + if o != nil && o.Timeout != nil { + return true + } + + return false +} + +// SetTimeout gets a reference to the given float64 and assigns it to the Timeout field. +func (o *SyntheticsTestRequest) SetTimeout(v float64) { + o.Timeout = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *SyntheticsTestRequest) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequest) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *SyntheticsTestRequest) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *SyntheticsTestRequest) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AllowInsecure != nil { + toSerialize["allow_insecure"] = o.AllowInsecure + } + if o.BasicAuth != nil { + toSerialize["basicAuth"] = o.BasicAuth + } + if o.Body != nil { + toSerialize["body"] = o.Body + } + if o.Certificate != nil { + toSerialize["certificate"] = o.Certificate + } + if o.DnsServer != nil { + toSerialize["dnsServer"] = o.DnsServer + } + if o.DnsServerPort != nil { + toSerialize["dnsServerPort"] = o.DnsServerPort + } + if o.FollowRedirects != nil { + toSerialize["follow_redirects"] = o.FollowRedirects + } + if o.Headers != nil { + toSerialize["headers"] = o.Headers + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Method != nil { + toSerialize["method"] = o.Method + } + if o.NoSavingResponseBody != nil { + toSerialize["noSavingResponseBody"] = o.NoSavingResponseBody + } + if o.NumberOfPackets != nil { + toSerialize["numberOfPackets"] = o.NumberOfPackets + } + if o.Port != nil { + toSerialize["port"] = o.Port + } + if o.Proxy != nil { + toSerialize["proxy"] = o.Proxy + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Servername != nil { + toSerialize["servername"] = o.Servername + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.ShouldTrackHops != nil { + toSerialize["shouldTrackHops"] = o.ShouldTrackHops + } + if o.Timeout != nil { + toSerialize["timeout"] = o.Timeout + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AllowInsecure *bool `json:"allow_insecure,omitempty"` + BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` + Body *string `json:"body,omitempty"` + Certificate *SyntheticsTestRequestCertificate `json:"certificate,omitempty"` + DnsServer *string `json:"dnsServer,omitempty"` + DnsServerPort *int32 `json:"dnsServerPort,omitempty"` + FollowRedirects *bool `json:"follow_redirects,omitempty"` + Headers map[string]string `json:"headers,omitempty"` + Host *string `json:"host,omitempty"` + Message *string `json:"message,omitempty"` + Metadata map[string]string `json:"metadata,omitempty"` + Method *HTTPMethod `json:"method,omitempty"` + NoSavingResponseBody *bool `json:"noSavingResponseBody,omitempty"` + NumberOfPackets *int32 `json:"numberOfPackets,omitempty"` + Port *int64 `json:"port,omitempty"` + Proxy *SyntheticsTestRequestProxy `json:"proxy,omitempty"` + Query interface{} `json:"query,omitempty"` + Servername *string `json:"servername,omitempty"` + Service *string `json:"service,omitempty"` + ShouldTrackHops *bool `json:"shouldTrackHops,omitempty"` + Timeout *float64 `json:"timeout,omitempty"` + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Method; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AllowInsecure = all.AllowInsecure + o.BasicAuth = all.BasicAuth + o.Body = all.Body + if all.Certificate != nil && all.Certificate.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Certificate = all.Certificate + o.DnsServer = all.DnsServer + o.DnsServerPort = all.DnsServerPort + o.FollowRedirects = all.FollowRedirects + o.Headers = all.Headers + o.Host = all.Host + o.Message = all.Message + o.Metadata = all.Metadata + o.Method = all.Method + o.NoSavingResponseBody = all.NoSavingResponseBody + o.NumberOfPackets = all.NumberOfPackets + o.Port = all.Port + if all.Proxy != nil && all.Proxy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Proxy = all.Proxy + o.Query = all.Query + o.Servername = all.Servername + o.Service = all.Service + o.ShouldTrackHops = all.ShouldTrackHops + o.Timeout = all.Timeout + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_request_certificate.go b/api/v1/datadog/model_synthetics_test_request_certificate.go new file mode 100644 index 00000000000..3cc47a8cea8 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_request_certificate.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestRequestCertificate Client certificate to use when performing the test request. +type SyntheticsTestRequestCertificate struct { + // Define a request certificate. + Cert *SyntheticsTestRequestCertificateItem `json:"cert,omitempty"` + // Define a request certificate. + Key *SyntheticsTestRequestCertificateItem `json:"key,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{} +} + +// NewSyntheticsTestRequestCertificate instantiates a new SyntheticsTestRequestCertificate 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 NewSyntheticsTestRequestCertificate() *SyntheticsTestRequestCertificate { + this := SyntheticsTestRequestCertificate{} + return &this +} + +// NewSyntheticsTestRequestCertificateWithDefaults instantiates a new SyntheticsTestRequestCertificate 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 NewSyntheticsTestRequestCertificateWithDefaults() *SyntheticsTestRequestCertificate { + this := SyntheticsTestRequestCertificate{} + return &this +} + +// GetCert returns the Cert field value if set, zero value otherwise. +func (o *SyntheticsTestRequestCertificate) GetCert() SyntheticsTestRequestCertificateItem { + if o == nil || o.Cert == nil { + var ret SyntheticsTestRequestCertificateItem + return ret + } + return *o.Cert +} + +// GetCertOk returns a tuple with the Cert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequestCertificate) GetCertOk() (*SyntheticsTestRequestCertificateItem, bool) { + if o == nil || o.Cert == nil { + return nil, false + } + return o.Cert, true +} + +// HasCert returns a boolean if a field has been set. +func (o *SyntheticsTestRequestCertificate) HasCert() bool { + if o != nil && o.Cert != nil { + return true + } + + return false +} + +// SetCert gets a reference to the given SyntheticsTestRequestCertificateItem and assigns it to the Cert field. +func (o *SyntheticsTestRequestCertificate) SetCert(v SyntheticsTestRequestCertificateItem) { + o.Cert = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *SyntheticsTestRequestCertificate) GetKey() SyntheticsTestRequestCertificateItem { + if o == nil || o.Key == nil { + var ret SyntheticsTestRequestCertificateItem + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequestCertificate) GetKeyOk() (*SyntheticsTestRequestCertificateItem, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *SyntheticsTestRequestCertificate) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given SyntheticsTestRequestCertificateItem and assigns it to the Key field. +func (o *SyntheticsTestRequestCertificate) SetKey(v SyntheticsTestRequestCertificateItem) { + o.Key = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestRequestCertificate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cert != nil { + toSerialize["cert"] = o.Cert + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestRequestCertificate) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cert *SyntheticsTestRequestCertificateItem `json:"cert,omitempty"` + Key *SyntheticsTestRequestCertificateItem `json:"key,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Cert != nil && all.Cert.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Cert = all.Cert + if all.Key != nil && all.Key.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Key = all.Key + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_request_certificate_item.go b/api/v1/datadog/model_synthetics_test_request_certificate_item.go new file mode 100644 index 00000000000..361460e34c7 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_request_certificate_item.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTestRequestCertificateItem Define a request certificate. +type SyntheticsTestRequestCertificateItem struct { + // Content of the certificate or key. + Content *string `json:"content,omitempty"` + // File name for the certificate or key. + Filename *string `json:"filename,omitempty"` + // Date of update of the certificate or key, ISO format. + UpdatedAt *string `json:"updatedAt,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{} +} + +// NewSyntheticsTestRequestCertificateItem instantiates a new SyntheticsTestRequestCertificateItem 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 NewSyntheticsTestRequestCertificateItem() *SyntheticsTestRequestCertificateItem { + this := SyntheticsTestRequestCertificateItem{} + return &this +} + +// NewSyntheticsTestRequestCertificateItemWithDefaults instantiates a new SyntheticsTestRequestCertificateItem 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 NewSyntheticsTestRequestCertificateItemWithDefaults() *SyntheticsTestRequestCertificateItem { + this := SyntheticsTestRequestCertificateItem{} + return &this +} + +// GetContent returns the Content field value if set, zero value otherwise. +func (o *SyntheticsTestRequestCertificateItem) GetContent() string { + if o == nil || o.Content == nil { + var ret string + return ret + } + return *o.Content +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequestCertificateItem) GetContentOk() (*string, bool) { + if o == nil || o.Content == nil { + return nil, false + } + return o.Content, true +} + +// HasContent returns a boolean if a field has been set. +func (o *SyntheticsTestRequestCertificateItem) HasContent() bool { + if o != nil && o.Content != nil { + return true + } + + return false +} + +// SetContent gets a reference to the given string and assigns it to the Content field. +func (o *SyntheticsTestRequestCertificateItem) SetContent(v string) { + o.Content = &v +} + +// GetFilename returns the Filename field value if set, zero value otherwise. +func (o *SyntheticsTestRequestCertificateItem) GetFilename() string { + if o == nil || o.Filename == nil { + var ret string + return ret + } + return *o.Filename +} + +// GetFilenameOk returns a tuple with the Filename field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequestCertificateItem) GetFilenameOk() (*string, bool) { + if o == nil || o.Filename == nil { + return nil, false + } + return o.Filename, true +} + +// HasFilename returns a boolean if a field has been set. +func (o *SyntheticsTestRequestCertificateItem) HasFilename() bool { + if o != nil && o.Filename != nil { + return true + } + + return false +} + +// SetFilename gets a reference to the given string and assigns it to the Filename field. +func (o *SyntheticsTestRequestCertificateItem) SetFilename(v string) { + o.Filename = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *SyntheticsTestRequestCertificateItem) GetUpdatedAt() string { + if o == nil || o.UpdatedAt == nil { + var ret string + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequestCertificateItem) GetUpdatedAtOk() (*string, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *SyntheticsTestRequestCertificateItem) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. +func (o *SyntheticsTestRequestCertificateItem) SetUpdatedAt(v string) { + o.UpdatedAt = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestRequestCertificateItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Content != nil { + toSerialize["content"] = o.Content + } + if o.Filename != nil { + toSerialize["filename"] = o.Filename + } + if o.UpdatedAt != nil { + toSerialize["updatedAt"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestRequestCertificateItem) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Content *string `json:"content,omitempty"` + Filename *string `json:"filename,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Content = all.Content + o.Filename = all.Filename + o.UpdatedAt = all.UpdatedAt + return nil +} diff --git a/api/v1/datadog/model_synthetics_test_request_proxy.go b/api/v1/datadog/model_synthetics_test_request_proxy.go new file mode 100644 index 00000000000..04db0531793 --- /dev/null +++ b/api/v1/datadog/model_synthetics_test_request_proxy.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTestRequestProxy The proxy to perform the test. +type SyntheticsTestRequestProxy struct { + // Headers to include when performing the test. + Headers map[string]string `json:"headers,omitempty"` + // URL of the proxy to perform the test. + Url string `json:"url"` + // 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{} +} + +// NewSyntheticsTestRequestProxy instantiates a new SyntheticsTestRequestProxy 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 NewSyntheticsTestRequestProxy(url string) *SyntheticsTestRequestProxy { + this := SyntheticsTestRequestProxy{} + this.Url = url + return &this +} + +// NewSyntheticsTestRequestProxyWithDefaults instantiates a new SyntheticsTestRequestProxy 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 NewSyntheticsTestRequestProxyWithDefaults() *SyntheticsTestRequestProxy { + this := SyntheticsTestRequestProxy{} + return &this +} + +// GetHeaders returns the Headers field value if set, zero value otherwise. +func (o *SyntheticsTestRequestProxy) GetHeaders() map[string]string { + if o == nil || o.Headers == nil { + var ret map[string]string + return ret + } + return o.Headers +} + +// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequestProxy) GetHeadersOk() (*map[string]string, bool) { + if o == nil || o.Headers == nil { + return nil, false + } + return &o.Headers, true +} + +// HasHeaders returns a boolean if a field has been set. +func (o *SyntheticsTestRequestProxy) HasHeaders() bool { + if o != nil && o.Headers != nil { + return true + } + + return false +} + +// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field. +func (o *SyntheticsTestRequestProxy) SetHeaders(v map[string]string) { + o.Headers = v +} + +// GetUrl returns the Url field value. +func (o *SyntheticsTestRequestProxy) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *SyntheticsTestRequestProxy) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *SyntheticsTestRequestProxy) SetUrl(v string) { + o.Url = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTestRequestProxy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Headers != nil { + toSerialize["headers"] = o.Headers + } + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTestRequestProxy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Url *string `json:"url"` + }{} + all := struct { + Headers map[string]string `json:"headers,omitempty"` + Url string `json:"url"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Url == nil { + return fmt.Errorf("Required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Headers = all.Headers + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_synthetics_timing.go b/api/v1/datadog/model_synthetics_timing.go new file mode 100644 index 00000000000..592d4411193 --- /dev/null +++ b/api/v1/datadog/model_synthetics_timing.go @@ -0,0 +1,415 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTiming Object containing all metrics and their values collected for a Synthetic API test. +// Learn more about those metrics in [Synthetics documentation](https://docs.datadoghq.com/synthetics/#metrics). +type SyntheticsTiming struct { + // The duration in millisecond of the DNS lookup. + Dns *float64 `json:"dns,omitempty"` + // The time in millisecond to download the response. + Download *float64 `json:"download,omitempty"` + // The time in millisecond to first byte. + FirstByte *float64 `json:"firstByte,omitempty"` + // The duration in millisecond of the TLS handshake. + Handshake *float64 `json:"handshake,omitempty"` + // The time in millisecond spent during redirections. + Redirect *float64 `json:"redirect,omitempty"` + // The duration in millisecond of the TLS handshake. + Ssl *float64 `json:"ssl,omitempty"` + // Time in millisecond to establish the TCP connection. + Tcp *float64 `json:"tcp,omitempty"` + // The overall time in millisecond the request took to be processed. + Total *float64 `json:"total,omitempty"` + // Time spent in millisecond waiting for a response. + Wait *float64 `json:"wait,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{} +} + +// NewSyntheticsTiming instantiates a new SyntheticsTiming 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 NewSyntheticsTiming() *SyntheticsTiming { + this := SyntheticsTiming{} + return &this +} + +// NewSyntheticsTimingWithDefaults instantiates a new SyntheticsTiming 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 NewSyntheticsTimingWithDefaults() *SyntheticsTiming { + this := SyntheticsTiming{} + return &this +} + +// GetDns returns the Dns field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetDns() float64 { + if o == nil || o.Dns == nil { + var ret float64 + return ret + } + return *o.Dns +} + +// GetDnsOk returns a tuple with the Dns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetDnsOk() (*float64, bool) { + if o == nil || o.Dns == nil { + return nil, false + } + return o.Dns, true +} + +// HasDns returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasDns() bool { + if o != nil && o.Dns != nil { + return true + } + + return false +} + +// SetDns gets a reference to the given float64 and assigns it to the Dns field. +func (o *SyntheticsTiming) SetDns(v float64) { + o.Dns = &v +} + +// GetDownload returns the Download field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetDownload() float64 { + if o == nil || o.Download == nil { + var ret float64 + return ret + } + return *o.Download +} + +// GetDownloadOk returns a tuple with the Download field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetDownloadOk() (*float64, bool) { + if o == nil || o.Download == nil { + return nil, false + } + return o.Download, true +} + +// HasDownload returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasDownload() bool { + if o != nil && o.Download != nil { + return true + } + + return false +} + +// SetDownload gets a reference to the given float64 and assigns it to the Download field. +func (o *SyntheticsTiming) SetDownload(v float64) { + o.Download = &v +} + +// GetFirstByte returns the FirstByte field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetFirstByte() float64 { + if o == nil || o.FirstByte == nil { + var ret float64 + return ret + } + return *o.FirstByte +} + +// GetFirstByteOk returns a tuple with the FirstByte field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetFirstByteOk() (*float64, bool) { + if o == nil || o.FirstByte == nil { + return nil, false + } + return o.FirstByte, true +} + +// HasFirstByte returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasFirstByte() bool { + if o != nil && o.FirstByte != nil { + return true + } + + return false +} + +// SetFirstByte gets a reference to the given float64 and assigns it to the FirstByte field. +func (o *SyntheticsTiming) SetFirstByte(v float64) { + o.FirstByte = &v +} + +// GetHandshake returns the Handshake field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetHandshake() float64 { + if o == nil || o.Handshake == nil { + var ret float64 + return ret + } + return *o.Handshake +} + +// GetHandshakeOk returns a tuple with the Handshake field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetHandshakeOk() (*float64, bool) { + if o == nil || o.Handshake == nil { + return nil, false + } + return o.Handshake, true +} + +// HasHandshake returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasHandshake() bool { + if o != nil && o.Handshake != nil { + return true + } + + return false +} + +// SetHandshake gets a reference to the given float64 and assigns it to the Handshake field. +func (o *SyntheticsTiming) SetHandshake(v float64) { + o.Handshake = &v +} + +// GetRedirect returns the Redirect field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetRedirect() float64 { + if o == nil || o.Redirect == nil { + var ret float64 + return ret + } + return *o.Redirect +} + +// GetRedirectOk returns a tuple with the Redirect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetRedirectOk() (*float64, bool) { + if o == nil || o.Redirect == nil { + return nil, false + } + return o.Redirect, true +} + +// HasRedirect returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasRedirect() bool { + if o != nil && o.Redirect != nil { + return true + } + + return false +} + +// SetRedirect gets a reference to the given float64 and assigns it to the Redirect field. +func (o *SyntheticsTiming) SetRedirect(v float64) { + o.Redirect = &v +} + +// GetSsl returns the Ssl field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetSsl() float64 { + if o == nil || o.Ssl == nil { + var ret float64 + return ret + } + return *o.Ssl +} + +// GetSslOk returns a tuple with the Ssl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetSslOk() (*float64, bool) { + if o == nil || o.Ssl == nil { + return nil, false + } + return o.Ssl, true +} + +// HasSsl returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasSsl() bool { + if o != nil && o.Ssl != nil { + return true + } + + return false +} + +// SetSsl gets a reference to the given float64 and assigns it to the Ssl field. +func (o *SyntheticsTiming) SetSsl(v float64) { + o.Ssl = &v +} + +// GetTcp returns the Tcp field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetTcp() float64 { + if o == nil || o.Tcp == nil { + var ret float64 + return ret + } + return *o.Tcp +} + +// GetTcpOk returns a tuple with the Tcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetTcpOk() (*float64, bool) { + if o == nil || o.Tcp == nil { + return nil, false + } + return o.Tcp, true +} + +// HasTcp returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasTcp() bool { + if o != nil && o.Tcp != nil { + return true + } + + return false +} + +// SetTcp gets a reference to the given float64 and assigns it to the Tcp field. +func (o *SyntheticsTiming) SetTcp(v float64) { + o.Tcp = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetTotal() float64 { + if o == nil || o.Total == nil { + var ret float64 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetTotalOk() (*float64, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasTotal() bool { + if o != nil && o.Total != nil { + return true + } + + return false +} + +// SetTotal gets a reference to the given float64 and assigns it to the Total field. +func (o *SyntheticsTiming) SetTotal(v float64) { + o.Total = &v +} + +// GetWait returns the Wait field value if set, zero value otherwise. +func (o *SyntheticsTiming) GetWait() float64 { + if o == nil || o.Wait == nil { + var ret float64 + return ret + } + return *o.Wait +} + +// GetWaitOk returns a tuple with the Wait field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTiming) GetWaitOk() (*float64, bool) { + if o == nil || o.Wait == nil { + return nil, false + } + return o.Wait, true +} + +// HasWait returns a boolean if a field has been set. +func (o *SyntheticsTiming) HasWait() bool { + if o != nil && o.Wait != nil { + return true + } + + return false +} + +// SetWait gets a reference to the given float64 and assigns it to the Wait field. +func (o *SyntheticsTiming) SetWait(v float64) { + o.Wait = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTiming) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Dns != nil { + toSerialize["dns"] = o.Dns + } + if o.Download != nil { + toSerialize["download"] = o.Download + } + if o.FirstByte != nil { + toSerialize["firstByte"] = o.FirstByte + } + if o.Handshake != nil { + toSerialize["handshake"] = o.Handshake + } + if o.Redirect != nil { + toSerialize["redirect"] = o.Redirect + } + if o.Ssl != nil { + toSerialize["ssl"] = o.Ssl + } + if o.Tcp != nil { + toSerialize["tcp"] = o.Tcp + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + if o.Wait != nil { + toSerialize["wait"] = o.Wait + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTiming) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Dns *float64 `json:"dns,omitempty"` + Download *float64 `json:"download,omitempty"` + FirstByte *float64 `json:"firstByte,omitempty"` + Handshake *float64 `json:"handshake,omitempty"` + Redirect *float64 `json:"redirect,omitempty"` + Ssl *float64 `json:"ssl,omitempty"` + Tcp *float64 `json:"tcp,omitempty"` + Total *float64 `json:"total,omitempty"` + Wait *float64 `json:"wait,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Dns = all.Dns + o.Download = all.Download + o.FirstByte = all.FirstByte + o.Handshake = all.Handshake + o.Redirect = all.Redirect + o.Ssl = all.Ssl + o.Tcp = all.Tcp + o.Total = all.Total + o.Wait = all.Wait + return nil +} diff --git a/api/v1/datadog/model_synthetics_trigger_body.go b/api/v1/datadog/model_synthetics_trigger_body.go new file mode 100644 index 00000000000..1b03f875341 --- /dev/null +++ b/api/v1/datadog/model_synthetics_trigger_body.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTriggerBody Object describing the synthetics tests to trigger. +type SyntheticsTriggerBody struct { + // Individual synthetics test. + Tests []SyntheticsTriggerTest `json:"tests"` + // 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{} +} + +// NewSyntheticsTriggerBody instantiates a new SyntheticsTriggerBody 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 NewSyntheticsTriggerBody(tests []SyntheticsTriggerTest) *SyntheticsTriggerBody { + this := SyntheticsTriggerBody{} + this.Tests = tests + return &this +} + +// NewSyntheticsTriggerBodyWithDefaults instantiates a new SyntheticsTriggerBody 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 NewSyntheticsTriggerBodyWithDefaults() *SyntheticsTriggerBody { + this := SyntheticsTriggerBody{} + return &this +} + +// GetTests returns the Tests field value. +func (o *SyntheticsTriggerBody) GetTests() []SyntheticsTriggerTest { + if o == nil { + var ret []SyntheticsTriggerTest + return ret + } + return o.Tests +} + +// GetTestsOk returns a tuple with the Tests field value +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerBody) GetTestsOk() (*[]SyntheticsTriggerTest, bool) { + if o == nil { + return nil, false + } + return &o.Tests, true +} + +// SetTests sets field value. +func (o *SyntheticsTriggerBody) SetTests(v []SyntheticsTriggerTest) { + o.Tests = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTriggerBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["tests"] = o.Tests + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTriggerBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Tests *[]SyntheticsTriggerTest `json:"tests"` + }{} + all := struct { + Tests []SyntheticsTriggerTest `json:"tests"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Tests == nil { + return fmt.Errorf("Required field tests missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Tests = all.Tests + return nil +} diff --git a/api/v1/datadog/model_synthetics_trigger_ci_test_location.go b/api/v1/datadog/model_synthetics_trigger_ci_test_location.go new file mode 100644 index 00000000000..1352969cd62 --- /dev/null +++ b/api/v1/datadog/model_synthetics_trigger_ci_test_location.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTriggerCITestLocation Synthetics location. +type SyntheticsTriggerCITestLocation struct { + // Unique identifier of the location. + Id *int64 `json:"id,omitempty"` + // Name of the location. + Name *string `json:"name,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{} +} + +// NewSyntheticsTriggerCITestLocation instantiates a new SyntheticsTriggerCITestLocation 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 NewSyntheticsTriggerCITestLocation() *SyntheticsTriggerCITestLocation { + this := SyntheticsTriggerCITestLocation{} + return &this +} + +// NewSyntheticsTriggerCITestLocationWithDefaults instantiates a new SyntheticsTriggerCITestLocation 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 NewSyntheticsTriggerCITestLocationWithDefaults() *SyntheticsTriggerCITestLocation { + this := SyntheticsTriggerCITestLocation{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestLocation) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestLocation) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestLocation) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *SyntheticsTriggerCITestLocation) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestLocation) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestLocation) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestLocation) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsTriggerCITestLocation) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTriggerCITestLocation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTriggerCITestLocation) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Name = all.Name + return nil +} diff --git a/api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go b/api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go new file mode 100644 index 00000000000..a13c727f263 --- /dev/null +++ b/api/v1/datadog/model_synthetics_trigger_ci_test_run_result.go @@ -0,0 +1,227 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsTriggerCITestRunResult Information about a single test run. +type SyntheticsTriggerCITestRunResult struct { + // The device ID. + Device *SyntheticsDeviceID `json:"device,omitempty"` + // The location ID of the test run. + Location *int64 `json:"location,omitempty"` + // The public ID of the Synthetics test. + PublicId *string `json:"public_id,omitempty"` + // ID of the result. + ResultId *string `json:"result_id,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{} +} + +// NewSyntheticsTriggerCITestRunResult instantiates a new SyntheticsTriggerCITestRunResult 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 NewSyntheticsTriggerCITestRunResult() *SyntheticsTriggerCITestRunResult { + this := SyntheticsTriggerCITestRunResult{} + return &this +} + +// NewSyntheticsTriggerCITestRunResultWithDefaults instantiates a new SyntheticsTriggerCITestRunResult 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 NewSyntheticsTriggerCITestRunResultWithDefaults() *SyntheticsTriggerCITestRunResult { + this := SyntheticsTriggerCITestRunResult{} + return &this +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestRunResult) GetDevice() SyntheticsDeviceID { + if o == nil || o.Device == nil { + var ret SyntheticsDeviceID + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestRunResult) GetDeviceOk() (*SyntheticsDeviceID, bool) { + if o == nil || o.Device == nil { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestRunResult) HasDevice() bool { + if o != nil && o.Device != nil { + return true + } + + return false +} + +// SetDevice gets a reference to the given SyntheticsDeviceID and assigns it to the Device field. +func (o *SyntheticsTriggerCITestRunResult) SetDevice(v SyntheticsDeviceID) { + o.Device = &v +} + +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestRunResult) GetLocation() int64 { + if o == nil || o.Location == nil { + var ret int64 + return ret + } + return *o.Location +} + +// GetLocationOk returns a tuple with the Location field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestRunResult) GetLocationOk() (*int64, bool) { + if o == nil || o.Location == nil { + return nil, false + } + return o.Location, true +} + +// HasLocation returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestRunResult) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + +// SetLocation gets a reference to the given int64 and assigns it to the Location field. +func (o *SyntheticsTriggerCITestRunResult) SetLocation(v int64) { + o.Location = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestRunResult) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestRunResult) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestRunResult) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *SyntheticsTriggerCITestRunResult) SetPublicId(v string) { + o.PublicId = &v +} + +// GetResultId returns the ResultId field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestRunResult) GetResultId() string { + if o == nil || o.ResultId == nil { + var ret string + return ret + } + return *o.ResultId +} + +// GetResultIdOk returns a tuple with the ResultId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestRunResult) GetResultIdOk() (*string, bool) { + if o == nil || o.ResultId == nil { + return nil, false + } + return o.ResultId, true +} + +// HasResultId returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestRunResult) HasResultId() bool { + if o != nil && o.ResultId != nil { + return true + } + + return false +} + +// SetResultId gets a reference to the given string and assigns it to the ResultId field. +func (o *SyntheticsTriggerCITestRunResult) SetResultId(v string) { + o.ResultId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTriggerCITestRunResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Device != nil { + toSerialize["device"] = o.Device + } + if o.Location != nil { + toSerialize["location"] = o.Location + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.ResultId != nil { + toSerialize["result_id"] = o.ResultId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTriggerCITestRunResult) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Device *SyntheticsDeviceID `json:"device,omitempty"` + Location *int64 `json:"location,omitempty"` + PublicId *string `json:"public_id,omitempty"` + ResultId *string `json:"result_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Device; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Device = all.Device + o.Location = all.Location + o.PublicId = all.PublicId + o.ResultId = all.ResultId + return nil +} diff --git a/api/v1/datadog/model_synthetics_trigger_ci_tests_response.go b/api/v1/datadog/model_synthetics_trigger_ci_tests_response.go new file mode 100644 index 00000000000..fb6d22aff61 --- /dev/null +++ b/api/v1/datadog/model_synthetics_trigger_ci_tests_response.go @@ -0,0 +1,232 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SyntheticsTriggerCITestsResponse Object containing information about the tests triggered. +type SyntheticsTriggerCITestsResponse struct { + // The public ID of the batch triggered. + BatchId common.NullableString `json:"batch_id,omitempty"` + // List of Synthetics locations. + Locations []SyntheticsTriggerCITestLocation `json:"locations,omitempty"` + // Information about the tests runs. + Results []SyntheticsTriggerCITestRunResult `json:"results,omitempty"` + // The public IDs of the Synthetics test triggered. + TriggeredCheckIds []string `json:"triggered_check_ids,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{} +} + +// NewSyntheticsTriggerCITestsResponse instantiates a new SyntheticsTriggerCITestsResponse 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 NewSyntheticsTriggerCITestsResponse() *SyntheticsTriggerCITestsResponse { + this := SyntheticsTriggerCITestsResponse{} + return &this +} + +// NewSyntheticsTriggerCITestsResponseWithDefaults instantiates a new SyntheticsTriggerCITestsResponse 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 NewSyntheticsTriggerCITestsResponseWithDefaults() *SyntheticsTriggerCITestsResponse { + this := SyntheticsTriggerCITestsResponse{} + return &this +} + +// GetBatchId returns the BatchId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SyntheticsTriggerCITestsResponse) GetBatchId() string { + if o == nil || o.BatchId.Get() == nil { + var ret string + return ret + } + return *o.BatchId.Get() +} + +// GetBatchIdOk returns a tuple with the BatchId 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 *SyntheticsTriggerCITestsResponse) GetBatchIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.BatchId.Get(), o.BatchId.IsSet() +} + +// HasBatchId returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestsResponse) HasBatchId() bool { + if o != nil && o.BatchId.IsSet() { + return true + } + + return false +} + +// SetBatchId gets a reference to the given common.NullableString and assigns it to the BatchId field. +func (o *SyntheticsTriggerCITestsResponse) SetBatchId(v string) { + o.BatchId.Set(&v) +} + +// SetBatchIdNil sets the value for BatchId to be an explicit nil. +func (o *SyntheticsTriggerCITestsResponse) SetBatchIdNil() { + o.BatchId.Set(nil) +} + +// UnsetBatchId ensures that no value is present for BatchId, not even an explicit nil. +func (o *SyntheticsTriggerCITestsResponse) UnsetBatchId() { + o.BatchId.Unset() +} + +// GetLocations returns the Locations field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestsResponse) GetLocations() []SyntheticsTriggerCITestLocation { + if o == nil || o.Locations == nil { + var ret []SyntheticsTriggerCITestLocation + return ret + } + return o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestsResponse) GetLocationsOk() (*[]SyntheticsTriggerCITestLocation, bool) { + if o == nil || o.Locations == nil { + return nil, false + } + return &o.Locations, true +} + +// HasLocations returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestsResponse) HasLocations() bool { + if o != nil && o.Locations != nil { + return true + } + + return false +} + +// SetLocations gets a reference to the given []SyntheticsTriggerCITestLocation and assigns it to the Locations field. +func (o *SyntheticsTriggerCITestsResponse) SetLocations(v []SyntheticsTriggerCITestLocation) { + o.Locations = v +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestsResponse) GetResults() []SyntheticsTriggerCITestRunResult { + if o == nil || o.Results == nil { + var ret []SyntheticsTriggerCITestRunResult + return ret + } + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestsResponse) GetResultsOk() (*[]SyntheticsTriggerCITestRunResult, bool) { + if o == nil || o.Results == nil { + return nil, false + } + return &o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestsResponse) HasResults() bool { + if o != nil && o.Results != nil { + return true + } + + return false +} + +// SetResults gets a reference to the given []SyntheticsTriggerCITestRunResult and assigns it to the Results field. +func (o *SyntheticsTriggerCITestsResponse) SetResults(v []SyntheticsTriggerCITestRunResult) { + o.Results = v +} + +// GetTriggeredCheckIds returns the TriggeredCheckIds field value if set, zero value otherwise. +func (o *SyntheticsTriggerCITestsResponse) GetTriggeredCheckIds() []string { + if o == nil || o.TriggeredCheckIds == nil { + var ret []string + return ret + } + return o.TriggeredCheckIds +} + +// GetTriggeredCheckIdsOk returns a tuple with the TriggeredCheckIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerCITestsResponse) GetTriggeredCheckIdsOk() (*[]string, bool) { + if o == nil || o.TriggeredCheckIds == nil { + return nil, false + } + return &o.TriggeredCheckIds, true +} + +// HasTriggeredCheckIds returns a boolean if a field has been set. +func (o *SyntheticsTriggerCITestsResponse) HasTriggeredCheckIds() bool { + if o != nil && o.TriggeredCheckIds != nil { + return true + } + + return false +} + +// SetTriggeredCheckIds gets a reference to the given []string and assigns it to the TriggeredCheckIds field. +func (o *SyntheticsTriggerCITestsResponse) SetTriggeredCheckIds(v []string) { + o.TriggeredCheckIds = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTriggerCITestsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BatchId.IsSet() { + toSerialize["batch_id"] = o.BatchId.Get() + } + if o.Locations != nil { + toSerialize["locations"] = o.Locations + } + if o.Results != nil { + toSerialize["results"] = o.Results + } + if o.TriggeredCheckIds != nil { + toSerialize["triggered_check_ids"] = o.TriggeredCheckIds + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTriggerCITestsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BatchId common.NullableString `json:"batch_id,omitempty"` + Locations []SyntheticsTriggerCITestLocation `json:"locations,omitempty"` + Results []SyntheticsTriggerCITestRunResult `json:"results,omitempty"` + TriggeredCheckIds []string `json:"triggered_check_ids,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BatchId = all.BatchId + o.Locations = all.Locations + o.Results = all.Results + o.TriggeredCheckIds = all.TriggeredCheckIds + return nil +} diff --git a/api/v1/datadog/model_synthetics_trigger_test_.go b/api/v1/datadog/model_synthetics_trigger_test_.go new file mode 100644 index 00000000000..fc49cb6802a --- /dev/null +++ b/api/v1/datadog/model_synthetics_trigger_test_.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsTriggerTest Test configuration for Synthetics +type SyntheticsTriggerTest struct { + // Metadata for the Synthetics tests run. + Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` + // The public ID of the Synthetics test to trigger. + PublicId string `json:"public_id"` + // 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{} +} + +// NewSyntheticsTriggerTest instantiates a new SyntheticsTriggerTest 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 NewSyntheticsTriggerTest(publicId string) *SyntheticsTriggerTest { + this := SyntheticsTriggerTest{} + this.PublicId = publicId + return &this +} + +// NewSyntheticsTriggerTestWithDefaults instantiates a new SyntheticsTriggerTest 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 NewSyntheticsTriggerTestWithDefaults() *SyntheticsTriggerTest { + this := SyntheticsTriggerTest{} + return &this +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SyntheticsTriggerTest) GetMetadata() SyntheticsCIBatchMetadata { + if o == nil || o.Metadata == nil { + var ret SyntheticsCIBatchMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerTest) GetMetadataOk() (*SyntheticsCIBatchMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SyntheticsTriggerTest) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given SyntheticsCIBatchMetadata and assigns it to the Metadata field. +func (o *SyntheticsTriggerTest) SetMetadata(v SyntheticsCIBatchMetadata) { + o.Metadata = &v +} + +// GetPublicId returns the PublicId field value. +func (o *SyntheticsTriggerTest) GetPublicId() string { + if o == nil { + var ret string + return ret + } + return o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value +// and a boolean to check if the value has been set. +func (o *SyntheticsTriggerTest) GetPublicIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicId, true +} + +// SetPublicId sets field value. +func (o *SyntheticsTriggerTest) SetPublicId(v string) { + o.PublicId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsTriggerTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["public_id"] = o.PublicId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsTriggerTest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + PublicId *string `json:"public_id"` + }{} + all := struct { + Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` + PublicId string `json:"public_id"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.PublicId == nil { + return fmt.Errorf("Required field public_id missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_synthetics_update_test_pause_status_payload.go b/api/v1/datadog/model_synthetics_update_test_pause_status_payload.go new file mode 100644 index 00000000000..87a0e807c44 --- /dev/null +++ b/api/v1/datadog/model_synthetics_update_test_pause_status_payload.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SyntheticsUpdateTestPauseStatusPayload Object to start or pause an existing Synthetic test. +type SyntheticsUpdateTestPauseStatusPayload struct { + // Define whether you want to start (`live`) or pause (`paused`) a + // Synthetic test. + NewStatus *SyntheticsTestPauseStatus `json:"new_status,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{} +} + +// NewSyntheticsUpdateTestPauseStatusPayload instantiates a new SyntheticsUpdateTestPauseStatusPayload 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 NewSyntheticsUpdateTestPauseStatusPayload() *SyntheticsUpdateTestPauseStatusPayload { + this := SyntheticsUpdateTestPauseStatusPayload{} + return &this +} + +// NewSyntheticsUpdateTestPauseStatusPayloadWithDefaults instantiates a new SyntheticsUpdateTestPauseStatusPayload 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 NewSyntheticsUpdateTestPauseStatusPayloadWithDefaults() *SyntheticsUpdateTestPauseStatusPayload { + this := SyntheticsUpdateTestPauseStatusPayload{} + return &this +} + +// GetNewStatus returns the NewStatus field value if set, zero value otherwise. +func (o *SyntheticsUpdateTestPauseStatusPayload) GetNewStatus() SyntheticsTestPauseStatus { + if o == nil || o.NewStatus == nil { + var ret SyntheticsTestPauseStatus + return ret + } + return *o.NewStatus +} + +// GetNewStatusOk returns a tuple with the NewStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsUpdateTestPauseStatusPayload) GetNewStatusOk() (*SyntheticsTestPauseStatus, bool) { + if o == nil || o.NewStatus == nil { + return nil, false + } + return o.NewStatus, true +} + +// HasNewStatus returns a boolean if a field has been set. +func (o *SyntheticsUpdateTestPauseStatusPayload) HasNewStatus() bool { + if o != nil && o.NewStatus != nil { + return true + } + + return false +} + +// SetNewStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the NewStatus field. +func (o *SyntheticsUpdateTestPauseStatusPayload) SetNewStatus(v SyntheticsTestPauseStatus) { + o.NewStatus = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsUpdateTestPauseStatusPayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.NewStatus != nil { + toSerialize["new_status"] = o.NewStatus + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsUpdateTestPauseStatusPayload) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + NewStatus *SyntheticsTestPauseStatus `json:"new_status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.NewStatus; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.NewStatus = all.NewStatus + return nil +} diff --git a/api/v1/datadog/model_synthetics_variable_parser.go b/api/v1/datadog/model_synthetics_variable_parser.go new file mode 100644 index 00000000000..0b6922cbe26 --- /dev/null +++ b/api/v1/datadog/model_synthetics_variable_parser.go @@ -0,0 +1,150 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsVariableParser Details of the parser to use for the global variable. +type SyntheticsVariableParser struct { + // Type of parser for a Synthetics global variable from a synthetics test. + Type SyntheticsGlobalVariableParserType `json:"type"` + // Regex or JSON path used for the parser. Not used with type `raw`. + Value *string `json:"value,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{} +} + +// NewSyntheticsVariableParser instantiates a new SyntheticsVariableParser 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 NewSyntheticsVariableParser(typeVar SyntheticsGlobalVariableParserType) *SyntheticsVariableParser { + this := SyntheticsVariableParser{} + this.Type = typeVar + return &this +} + +// NewSyntheticsVariableParserWithDefaults instantiates a new SyntheticsVariableParser 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 NewSyntheticsVariableParserWithDefaults() *SyntheticsVariableParser { + this := SyntheticsVariableParser{} + return &this +} + +// GetType returns the Type field value. +func (o *SyntheticsVariableParser) GetType() SyntheticsGlobalVariableParserType { + if o == nil { + var ret SyntheticsGlobalVariableParserType + 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 *SyntheticsVariableParser) GetTypeOk() (*SyntheticsGlobalVariableParserType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsVariableParser) SetType(v SyntheticsGlobalVariableParserType) { + o.Type = v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SyntheticsVariableParser) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsVariableParser) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *SyntheticsVariableParser) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *SyntheticsVariableParser) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsVariableParser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["type"] = o.Type + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsVariableParser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *SyntheticsGlobalVariableParserType `json:"type"` + }{} + all := struct { + Type SyntheticsGlobalVariableParserType `json:"type"` + Value *string `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_synthetics_warning_type.go b/api/v1/datadog/model_synthetics_warning_type.go new file mode 100644 index 00000000000..31f44e7b352 --- /dev/null +++ b/api/v1/datadog/model_synthetics_warning_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsWarningType User locator used. +type SyntheticsWarningType string + +// List of SyntheticsWarningType. +const ( + SYNTHETICSWARNINGTYPE_USER_LOCATOR SyntheticsWarningType = "user_locator" +) + +var allowedSyntheticsWarningTypeEnumValues = []SyntheticsWarningType{ + SYNTHETICSWARNINGTYPE_USER_LOCATOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsWarningType) GetAllowedValues() []SyntheticsWarningType { + return allowedSyntheticsWarningTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsWarningType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsWarningType(value) + return nil +} + +// NewSyntheticsWarningTypeFromValue returns a pointer to a valid SyntheticsWarningType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsWarningTypeFromValue(v string) (*SyntheticsWarningType, error) { + ev := SyntheticsWarningType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsWarningType: valid values are %v", v, allowedSyntheticsWarningTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsWarningType) IsValid() bool { + for _, existing := range allowedSyntheticsWarningTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsWarningType value. +func (v SyntheticsWarningType) Ptr() *SyntheticsWarningType { + return &v +} + +// NullableSyntheticsWarningType handles when a null is used for SyntheticsWarningType. +type NullableSyntheticsWarningType struct { + value *SyntheticsWarningType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsWarningType) Get() *SyntheticsWarningType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsWarningType) Set(val *SyntheticsWarningType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsWarningType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsWarningType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsWarningType initializes the struct as if Set has been called. +func NewNullableSyntheticsWarningType(val *SyntheticsWarningType) *NullableSyntheticsWarningType { + return &NullableSyntheticsWarningType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsWarningType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsWarningType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_table_widget_cell_display_mode.go b/api/v1/datadog/model_table_widget_cell_display_mode.go new file mode 100644 index 00000000000..ebd16587d4c --- /dev/null +++ b/api/v1/datadog/model_table_widget_cell_display_mode.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TableWidgetCellDisplayMode Define a display mode for the table cell. +type TableWidgetCellDisplayMode string + +// List of TableWidgetCellDisplayMode. +const ( + TABLEWIDGETCELLDISPLAYMODE_NUMBER TableWidgetCellDisplayMode = "number" + TABLEWIDGETCELLDISPLAYMODE_BAR TableWidgetCellDisplayMode = "bar" +) + +var allowedTableWidgetCellDisplayModeEnumValues = []TableWidgetCellDisplayMode{ + TABLEWIDGETCELLDISPLAYMODE_NUMBER, + TABLEWIDGETCELLDISPLAYMODE_BAR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TableWidgetCellDisplayMode) GetAllowedValues() []TableWidgetCellDisplayMode { + return allowedTableWidgetCellDisplayModeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TableWidgetCellDisplayMode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TableWidgetCellDisplayMode(value) + return nil +} + +// NewTableWidgetCellDisplayModeFromValue returns a pointer to a valid TableWidgetCellDisplayMode +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTableWidgetCellDisplayModeFromValue(v string) (*TableWidgetCellDisplayMode, error) { + ev := TableWidgetCellDisplayMode(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TableWidgetCellDisplayMode: valid values are %v", v, allowedTableWidgetCellDisplayModeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TableWidgetCellDisplayMode) IsValid() bool { + for _, existing := range allowedTableWidgetCellDisplayModeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TableWidgetCellDisplayMode value. +func (v TableWidgetCellDisplayMode) Ptr() *TableWidgetCellDisplayMode { + return &v +} + +// NullableTableWidgetCellDisplayMode handles when a null is used for TableWidgetCellDisplayMode. +type NullableTableWidgetCellDisplayMode struct { + value *TableWidgetCellDisplayMode + isSet bool +} + +// Get returns the associated value. +func (v NullableTableWidgetCellDisplayMode) Get() *TableWidgetCellDisplayMode { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTableWidgetCellDisplayMode) Set(val *TableWidgetCellDisplayMode) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTableWidgetCellDisplayMode) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTableWidgetCellDisplayMode) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTableWidgetCellDisplayMode initializes the struct as if Set has been called. +func NewNullableTableWidgetCellDisplayMode(val *TableWidgetCellDisplayMode) *NullableTableWidgetCellDisplayMode { + return &NullableTableWidgetCellDisplayMode{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTableWidgetCellDisplayMode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTableWidgetCellDisplayMode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_table_widget_definition.go b/api/v1/datadog/model_table_widget_definition.go new file mode 100644 index 00000000000..8b79ece5610 --- /dev/null +++ b/api/v1/datadog/model_table_widget_definition.go @@ -0,0 +1,403 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TableWidgetDefinition The table visualization is available on timeboards and screenboards. It displays columns of metrics grouped by tag key. +type TableWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // Controls the display of the search bar. + HasSearchBar *TableWidgetHasSearchBar `json:"has_search_bar,omitempty"` + // Widget definition. + Requests []TableWidgetRequest `json:"requests"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the table widget. + Type TableWidgetDefinitionType `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{} +} + +// NewTableWidgetDefinition instantiates a new TableWidgetDefinition 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 NewTableWidgetDefinition(requests []TableWidgetRequest, typeVar TableWidgetDefinitionType) *TableWidgetDefinition { + this := TableWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewTableWidgetDefinitionWithDefaults instantiates a new TableWidgetDefinition 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 NewTableWidgetDefinitionWithDefaults() *TableWidgetDefinition { + this := TableWidgetDefinition{} + var typeVar TableWidgetDefinitionType = TABLEWIDGETDEFINITIONTYPE_QUERY_TABLE + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *TableWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *TableWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *TableWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetHasSearchBar returns the HasSearchBar field value if set, zero value otherwise. +func (o *TableWidgetDefinition) GetHasSearchBar() TableWidgetHasSearchBar { + if o == nil || o.HasSearchBar == nil { + var ret TableWidgetHasSearchBar + return ret + } + return *o.HasSearchBar +} + +// GetHasSearchBarOk returns a tuple with the HasSearchBar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetDefinition) GetHasSearchBarOk() (*TableWidgetHasSearchBar, bool) { + if o == nil || o.HasSearchBar == nil { + return nil, false + } + return o.HasSearchBar, true +} + +// HasHasSearchBar returns a boolean if a field has been set. +func (o *TableWidgetDefinition) HasHasSearchBar() bool { + if o != nil && o.HasSearchBar != nil { + return true + } + + return false +} + +// SetHasSearchBar gets a reference to the given TableWidgetHasSearchBar and assigns it to the HasSearchBar field. +func (o *TableWidgetDefinition) SetHasSearchBar(v TableWidgetHasSearchBar) { + o.HasSearchBar = &v +} + +// GetRequests returns the Requests field value. +func (o *TableWidgetDefinition) GetRequests() []TableWidgetRequest { + if o == nil { + var ret []TableWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *TableWidgetDefinition) GetRequestsOk() (*[]TableWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *TableWidgetDefinition) SetRequests(v []TableWidgetRequest) { + o.Requests = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *TableWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *TableWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *TableWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *TableWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *TableWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *TableWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *TableWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *TableWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *TableWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *TableWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *TableWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *TableWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *TableWidgetDefinition) GetType() TableWidgetDefinitionType { + if o == nil { + var ret TableWidgetDefinitionType + 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 *TableWidgetDefinition) GetTypeOk() (*TableWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TableWidgetDefinition) SetType(v TableWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TableWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + if o.HasSearchBar != nil { + toSerialize["has_search_bar"] = o.HasSearchBar + } + toSerialize["requests"] = o.Requests + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]TableWidgetRequest `json:"requests"` + Type *TableWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + HasSearchBar *TableWidgetHasSearchBar `json:"has_search_bar,omitempty"` + Requests []TableWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type TableWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.HasSearchBar; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.HasSearchBar = all.HasSearchBar + o.Requests = all.Requests + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_table_widget_definition_type.go b/api/v1/datadog/model_table_widget_definition_type.go new file mode 100644 index 00000000000..acfdd3c0396 --- /dev/null +++ b/api/v1/datadog/model_table_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TableWidgetDefinitionType Type of the table widget. +type TableWidgetDefinitionType string + +// List of TableWidgetDefinitionType. +const ( + TABLEWIDGETDEFINITIONTYPE_QUERY_TABLE TableWidgetDefinitionType = "query_table" +) + +var allowedTableWidgetDefinitionTypeEnumValues = []TableWidgetDefinitionType{ + TABLEWIDGETDEFINITIONTYPE_QUERY_TABLE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TableWidgetDefinitionType) GetAllowedValues() []TableWidgetDefinitionType { + return allowedTableWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TableWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TableWidgetDefinitionType(value) + return nil +} + +// NewTableWidgetDefinitionTypeFromValue returns a pointer to a valid TableWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTableWidgetDefinitionTypeFromValue(v string) (*TableWidgetDefinitionType, error) { + ev := TableWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TableWidgetDefinitionType: valid values are %v", v, allowedTableWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TableWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedTableWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TableWidgetDefinitionType value. +func (v TableWidgetDefinitionType) Ptr() *TableWidgetDefinitionType { + return &v +} + +// NullableTableWidgetDefinitionType handles when a null is used for TableWidgetDefinitionType. +type NullableTableWidgetDefinitionType struct { + value *TableWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableTableWidgetDefinitionType) Get() *TableWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTableWidgetDefinitionType) Set(val *TableWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTableWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTableWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTableWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableTableWidgetDefinitionType(val *TableWidgetDefinitionType) *NullableTableWidgetDefinitionType { + return &NullableTableWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTableWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTableWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_table_widget_has_search_bar.go b/api/v1/datadog/model_table_widget_has_search_bar.go new file mode 100644 index 00000000000..25997e72749 --- /dev/null +++ b/api/v1/datadog/model_table_widget_has_search_bar.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TableWidgetHasSearchBar Controls the display of the search bar. +type TableWidgetHasSearchBar string + +// List of TableWidgetHasSearchBar. +const ( + TABLEWIDGETHASSEARCHBAR_ALWAYS TableWidgetHasSearchBar = "always" + TABLEWIDGETHASSEARCHBAR_NEVER TableWidgetHasSearchBar = "never" + TABLEWIDGETHASSEARCHBAR_AUTO TableWidgetHasSearchBar = "auto" +) + +var allowedTableWidgetHasSearchBarEnumValues = []TableWidgetHasSearchBar{ + TABLEWIDGETHASSEARCHBAR_ALWAYS, + TABLEWIDGETHASSEARCHBAR_NEVER, + TABLEWIDGETHASSEARCHBAR_AUTO, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TableWidgetHasSearchBar) GetAllowedValues() []TableWidgetHasSearchBar { + return allowedTableWidgetHasSearchBarEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TableWidgetHasSearchBar) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TableWidgetHasSearchBar(value) + return nil +} + +// NewTableWidgetHasSearchBarFromValue returns a pointer to a valid TableWidgetHasSearchBar +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTableWidgetHasSearchBarFromValue(v string) (*TableWidgetHasSearchBar, error) { + ev := TableWidgetHasSearchBar(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TableWidgetHasSearchBar: valid values are %v", v, allowedTableWidgetHasSearchBarEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TableWidgetHasSearchBar) IsValid() bool { + for _, existing := range allowedTableWidgetHasSearchBarEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TableWidgetHasSearchBar value. +func (v TableWidgetHasSearchBar) Ptr() *TableWidgetHasSearchBar { + return &v +} + +// NullableTableWidgetHasSearchBar handles when a null is used for TableWidgetHasSearchBar. +type NullableTableWidgetHasSearchBar struct { + value *TableWidgetHasSearchBar + isSet bool +} + +// Get returns the associated value. +func (v NullableTableWidgetHasSearchBar) Get() *TableWidgetHasSearchBar { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTableWidgetHasSearchBar) Set(val *TableWidgetHasSearchBar) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTableWidgetHasSearchBar) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTableWidgetHasSearchBar) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTableWidgetHasSearchBar initializes the struct as if Set has been called. +func NewNullableTableWidgetHasSearchBar(val *TableWidgetHasSearchBar) *NullableTableWidgetHasSearchBar { + return &NullableTableWidgetHasSearchBar{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTableWidgetHasSearchBar) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTableWidgetHasSearchBar) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_table_widget_request.go b/api/v1/datadog/model_table_widget_request.go new file mode 100644 index 00000000000..b6acfa74a38 --- /dev/null +++ b/api/v1/datadog/model_table_widget_request.go @@ -0,0 +1,891 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// TableWidgetRequest Updated table widget. +type TableWidgetRequest struct { + // Aggregator used for the request. + Aggregator *WidgetAggregator `json:"aggregator,omitempty"` + // The column name (defaults to the metric name). + Alias *string `json:"alias,omitempty"` + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The APM stats query for table and distributions widgets. + ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` + // A list of display modes for each table cell. + CellDisplayMode []TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` + // List of conditional formats. + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // For metric queries, the number of lines to show in the table. Only one request should have this property. + Limit *int64 `json:"limit,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // Widget sorting methods. + Order *WidgetSort `json:"order,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Query definition. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,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{} +} + +// NewTableWidgetRequest instantiates a new TableWidgetRequest 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 NewTableWidgetRequest() *TableWidgetRequest { + this := TableWidgetRequest{} + return &this +} + +// NewTableWidgetRequestWithDefaults instantiates a new TableWidgetRequest 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 NewTableWidgetRequestWithDefaults() *TableWidgetRequest { + this := TableWidgetRequest{} + return &this +} + +// GetAggregator returns the Aggregator field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetAggregator() WidgetAggregator { + if o == nil || o.Aggregator == nil { + var ret WidgetAggregator + return ret + } + return *o.Aggregator +} + +// GetAggregatorOk returns a tuple with the Aggregator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetAggregatorOk() (*WidgetAggregator, bool) { + if o == nil || o.Aggregator == nil { + return nil, false + } + return o.Aggregator, true +} + +// HasAggregator returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasAggregator() bool { + if o != nil && o.Aggregator != nil { + return true + } + + return false +} + +// SetAggregator gets a reference to the given WidgetAggregator and assigns it to the Aggregator field. +func (o *TableWidgetRequest) SetAggregator(v WidgetAggregator) { + o.Aggregator = &v +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetAlias() string { + if o == nil || o.Alias == nil { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetAliasOk() (*string, bool) { + if o == nil || o.Alias == nil { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasAlias() bool { + if o != nil && o.Alias != nil { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *TableWidgetRequest) SetAlias(v string) { + o.Alias = &v +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *TableWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetApmStatsQuery returns the ApmStatsQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetApmStatsQuery() ApmStatsQueryDefinition { + if o == nil || o.ApmStatsQuery == nil { + var ret ApmStatsQueryDefinition + return ret + } + return *o.ApmStatsQuery +} + +// GetApmStatsQueryOk returns a tuple with the ApmStatsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetApmStatsQueryOk() (*ApmStatsQueryDefinition, bool) { + if o == nil || o.ApmStatsQuery == nil { + return nil, false + } + return o.ApmStatsQuery, true +} + +// HasApmStatsQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasApmStatsQuery() bool { + if o != nil && o.ApmStatsQuery != nil { + return true + } + + return false +} + +// SetApmStatsQuery gets a reference to the given ApmStatsQueryDefinition and assigns it to the ApmStatsQuery field. +func (o *TableWidgetRequest) SetApmStatsQuery(v ApmStatsQueryDefinition) { + o.ApmStatsQuery = &v +} + +// GetCellDisplayMode returns the CellDisplayMode field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetCellDisplayMode() []TableWidgetCellDisplayMode { + if o == nil || o.CellDisplayMode == nil { + var ret []TableWidgetCellDisplayMode + return ret + } + return o.CellDisplayMode +} + +// GetCellDisplayModeOk returns a tuple with the CellDisplayMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetCellDisplayModeOk() (*[]TableWidgetCellDisplayMode, bool) { + if o == nil || o.CellDisplayMode == nil { + return nil, false + } + return &o.CellDisplayMode, true +} + +// HasCellDisplayMode returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasCellDisplayMode() bool { + if o != nil && o.CellDisplayMode != nil { + return true + } + + return false +} + +// SetCellDisplayMode gets a reference to the given []TableWidgetCellDisplayMode and assigns it to the CellDisplayMode field. +func (o *TableWidgetRequest) SetCellDisplayMode(v []TableWidgetCellDisplayMode) { + o.CellDisplayMode = v +} + +// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetConditionalFormats() []WidgetConditionalFormat { + if o == nil || o.ConditionalFormats == nil { + var ret []WidgetConditionalFormat + return ret + } + return o.ConditionalFormats +} + +// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { + if o == nil || o.ConditionalFormats == nil { + return nil, false + } + return &o.ConditionalFormats, true +} + +// HasConditionalFormats returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasConditionalFormats() bool { + if o != nil && o.ConditionalFormats != nil { + return true + } + + return false +} + +// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. +func (o *TableWidgetRequest) SetConditionalFormats(v []WidgetConditionalFormat) { + o.ConditionalFormats = v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *TableWidgetRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *TableWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *TableWidgetRequest) SetLimit(v int64) { + o.Limit = &v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *TableWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *TableWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetOrder() WidgetSort { + if o == nil || o.Order == nil { + var ret WidgetSort + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetOrderOk() (*WidgetSort, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasOrder() bool { + if o != nil && o.Order != nil { + return true + } + + return false +} + +// SetOrder gets a reference to the given WidgetSort and assigns it to the Order field. +func (o *TableWidgetRequest) SetOrder(v WidgetSort) { + o.Order = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *TableWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *TableWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *TableWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *TableWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *TableWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *TableWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *TableWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TableWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *TableWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *TableWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TableWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregator != nil { + toSerialize["aggregator"] = o.Aggregator + } + if o.Alias != nil { + toSerialize["alias"] = o.Alias + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.ApmStatsQuery != nil { + toSerialize["apm_stats_query"] = o.ApmStatsQuery + } + if o.CellDisplayMode != nil { + toSerialize["cell_display_mode"] = o.CellDisplayMode + } + if o.ConditionalFormats != nil { + toSerialize["conditional_formats"] = o.ConditionalFormats + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.Order != nil { + toSerialize["order"] = o.Order + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TableWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregator *WidgetAggregator `json:"aggregator,omitempty"` + Alias *string `json:"alias,omitempty"` + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` + CellDisplayMode []TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` + Limit *int64 `json:"limit,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + Order *WidgetSort `json:"order,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregator; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregator = all.Aggregator + o.Alias = all.Alias + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.ApmStatsQuery != nil && all.ApmStatsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmStatsQuery = all.ApmStatsQuery + o.CellDisplayMode = all.CellDisplayMode + o.ConditionalFormats = all.ConditionalFormats + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + o.Formulas = all.Formulas + o.Limit = all.Limit + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + o.Order = all.Order + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + return nil +} diff --git a/api/v1/datadog/model_tag_to_hosts.go b/api/v1/datadog/model_tag_to_hosts.go new file mode 100644 index 00000000000..3040532d7c1 --- /dev/null +++ b/api/v1/datadog/model_tag_to_hosts.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 datadog + +import ( + "encoding/json" +) + +// TagToHosts In this object, the key is the tag, the value is a list of host names that are reporting that tag. +type TagToHosts struct { + // A list of tags to apply to the host. + 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{} +} + +// NewTagToHosts instantiates a new TagToHosts 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 NewTagToHosts() *TagToHosts { + this := TagToHosts{} + return &this +} + +// NewTagToHostsWithDefaults instantiates a new TagToHosts 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 NewTagToHostsWithDefaults() *TagToHosts { + this := TagToHosts{} + return &this +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *TagToHosts) 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 *TagToHosts) 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 *TagToHosts) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. +func (o *TagToHosts) SetTags(v map[string][]string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TagToHosts) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TagToHosts) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Tags map[string][]string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Tags = all.Tags + return nil +} diff --git a/api/v1/datadog/model_target_format_type.go b/api/v1/datadog/model_target_format_type.go new file mode 100644 index 00000000000..5bdec101ffc --- /dev/null +++ b/api/v1/datadog/model_target_format_type.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TargetFormatType If the `target_type` of the remapper is `attribute`, try to cast the value to a new specific type. +// If the cast is not possible, the original type is kept. `string`, `integer`, or `double` are the possible types. +// If the `target_type` is `tag`, this parameter may not be specified. +type TargetFormatType string + +// List of TargetFormatType. +const ( + TARGETFORMATTYPE_AUTO TargetFormatType = "auto" + TARGETFORMATTYPE_STRING TargetFormatType = "string" + TARGETFORMATTYPE_INTEGER TargetFormatType = "integer" + TARGETFORMATTYPE_DOUBLE TargetFormatType = "double" +) + +var allowedTargetFormatTypeEnumValues = []TargetFormatType{ + TARGETFORMATTYPE_AUTO, + TARGETFORMATTYPE_STRING, + TARGETFORMATTYPE_INTEGER, + TARGETFORMATTYPE_DOUBLE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TargetFormatType) GetAllowedValues() []TargetFormatType { + return allowedTargetFormatTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TargetFormatType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TargetFormatType(value) + return nil +} + +// NewTargetFormatTypeFromValue returns a pointer to a valid TargetFormatType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTargetFormatTypeFromValue(v string) (*TargetFormatType, error) { + ev := TargetFormatType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TargetFormatType: valid values are %v", v, allowedTargetFormatTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TargetFormatType) IsValid() bool { + for _, existing := range allowedTargetFormatTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TargetFormatType value. +func (v TargetFormatType) Ptr() *TargetFormatType { + return &v +} + +// NullableTargetFormatType handles when a null is used for TargetFormatType. +type NullableTargetFormatType struct { + value *TargetFormatType + isSet bool +} + +// Get returns the associated value. +func (v NullableTargetFormatType) Get() *TargetFormatType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTargetFormatType) Set(val *TargetFormatType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTargetFormatType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTargetFormatType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTargetFormatType initializes the struct as if Set has been called. +func NewNullableTargetFormatType(val *TargetFormatType) *NullableTargetFormatType { + return &NullableTargetFormatType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTargetFormatType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTargetFormatType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_timeseries_background.go b/api/v1/datadog/model_timeseries_background.go new file mode 100644 index 00000000000..b6625993944 --- /dev/null +++ b/api/v1/datadog/model_timeseries_background.go @@ -0,0 +1,159 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TimeseriesBackground Set a timeseries on the widget background. +type TimeseriesBackground struct { + // Timeseries is made using an area or bars. + Type TimeseriesBackgroundType `json:"type"` + // Axis controls for the widget. + Yaxis *WidgetAxis `json:"yaxis,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{} +} + +// NewTimeseriesBackground instantiates a new TimeseriesBackground 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 NewTimeseriesBackground(typeVar TimeseriesBackgroundType) *TimeseriesBackground { + this := TimeseriesBackground{} + this.Type = typeVar + return &this +} + +// NewTimeseriesBackgroundWithDefaults instantiates a new TimeseriesBackground 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 NewTimeseriesBackgroundWithDefaults() *TimeseriesBackground { + this := TimeseriesBackground{} + var typeVar TimeseriesBackgroundType = TIMESERIESBACKGROUNDTYPE_AREA + this.Type = typeVar + return &this +} + +// GetType returns the Type field value. +func (o *TimeseriesBackground) GetType() TimeseriesBackgroundType { + if o == nil { + var ret TimeseriesBackgroundType + 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 *TimeseriesBackground) GetTypeOk() (*TimeseriesBackgroundType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TimeseriesBackground) SetType(v TimeseriesBackgroundType) { + o.Type = v +} + +// GetYaxis returns the Yaxis field value if set, zero value otherwise. +func (o *TimeseriesBackground) GetYaxis() WidgetAxis { + if o == nil || o.Yaxis == nil { + var ret WidgetAxis + return ret + } + return *o.Yaxis +} + +// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesBackground) GetYaxisOk() (*WidgetAxis, bool) { + if o == nil || o.Yaxis == nil { + return nil, false + } + return o.Yaxis, true +} + +// HasYaxis returns a boolean if a field has been set. +func (o *TimeseriesBackground) HasYaxis() bool { + if o != nil && o.Yaxis != nil { + return true + } + + return false +} + +// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. +func (o *TimeseriesBackground) SetYaxis(v WidgetAxis) { + o.Yaxis = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TimeseriesBackground) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["type"] = o.Type + if o.Yaxis != nil { + toSerialize["yaxis"] = o.Yaxis + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TimeseriesBackground) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *TimeseriesBackgroundType `json:"type"` + }{} + all := struct { + Type TimeseriesBackgroundType `json:"type"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Yaxis = all.Yaxis + return nil +} diff --git a/api/v1/datadog/model_timeseries_background_type.go b/api/v1/datadog/model_timeseries_background_type.go new file mode 100644 index 00000000000..627d10ac0a6 --- /dev/null +++ b/api/v1/datadog/model_timeseries_background_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TimeseriesBackgroundType Timeseries is made using an area or bars. +type TimeseriesBackgroundType string + +// List of TimeseriesBackgroundType. +const ( + TIMESERIESBACKGROUNDTYPE_BARS TimeseriesBackgroundType = "bars" + TIMESERIESBACKGROUNDTYPE_AREA TimeseriesBackgroundType = "area" +) + +var allowedTimeseriesBackgroundTypeEnumValues = []TimeseriesBackgroundType{ + TIMESERIESBACKGROUNDTYPE_BARS, + TIMESERIESBACKGROUNDTYPE_AREA, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TimeseriesBackgroundType) GetAllowedValues() []TimeseriesBackgroundType { + return allowedTimeseriesBackgroundTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TimeseriesBackgroundType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TimeseriesBackgroundType(value) + return nil +} + +// NewTimeseriesBackgroundTypeFromValue returns a pointer to a valid TimeseriesBackgroundType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTimeseriesBackgroundTypeFromValue(v string) (*TimeseriesBackgroundType, error) { + ev := TimeseriesBackgroundType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TimeseriesBackgroundType: valid values are %v", v, allowedTimeseriesBackgroundTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TimeseriesBackgroundType) IsValid() bool { + for _, existing := range allowedTimeseriesBackgroundTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TimeseriesBackgroundType value. +func (v TimeseriesBackgroundType) Ptr() *TimeseriesBackgroundType { + return &v +} + +// NullableTimeseriesBackgroundType handles when a null is used for TimeseriesBackgroundType. +type NullableTimeseriesBackgroundType struct { + value *TimeseriesBackgroundType + isSet bool +} + +// Get returns the associated value. +func (v NullableTimeseriesBackgroundType) Get() *TimeseriesBackgroundType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTimeseriesBackgroundType) Set(val *TimeseriesBackgroundType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTimeseriesBackgroundType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTimeseriesBackgroundType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTimeseriesBackgroundType initializes the struct as if Set has been called. +func NewNullableTimeseriesBackgroundType(val *TimeseriesBackgroundType) *NullableTimeseriesBackgroundType { + return &NullableTimeseriesBackgroundType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTimeseriesBackgroundType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTimeseriesBackgroundType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_timeseries_widget_definition.go b/api/v1/datadog/model_timeseries_widget_definition.go new file mode 100644 index 00000000000..6ec08d46b6c --- /dev/null +++ b/api/v1/datadog/model_timeseries_widget_definition.go @@ -0,0 +1,690 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TimeseriesWidgetDefinition The timeseries visualization allows you to display the evolution of one or more metrics, log events, or Indexed Spans over time. +type TimeseriesWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // List of widget events. + Events []WidgetEvent `json:"events,omitempty"` + // Columns displayed in the legend. + LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"` + // Layout of the legend. + LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"` + // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". + LegendSize *string `json:"legend_size,omitempty"` + // List of markers. + Markers []WidgetMarker `json:"markers,omitempty"` + // List of timeseries widget requests. + Requests []TimeseriesWidgetRequest `json:"requests"` + // Axis controls for the widget. + RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"` + // (screenboard only) Show the legend for this widget. + ShowLegend *bool `json:"show_legend,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the timeseries widget. + Type TimeseriesWidgetDefinitionType `json:"type"` + // Axis controls for the widget. + Yaxis *WidgetAxis `json:"yaxis,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{} +} + +// NewTimeseriesWidgetDefinition instantiates a new TimeseriesWidgetDefinition 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 NewTimeseriesWidgetDefinition(requests []TimeseriesWidgetRequest, typeVar TimeseriesWidgetDefinitionType) *TimeseriesWidgetDefinition { + this := TimeseriesWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewTimeseriesWidgetDefinitionWithDefaults instantiates a new TimeseriesWidgetDefinition 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 NewTimeseriesWidgetDefinitionWithDefaults() *TimeseriesWidgetDefinition { + this := TimeseriesWidgetDefinition{} + var typeVar TimeseriesWidgetDefinitionType = TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *TimeseriesWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetEvents returns the Events field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetEvents() []WidgetEvent { + if o == nil || o.Events == nil { + var ret []WidgetEvent + return ret + } + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetEventsOk() (*[]WidgetEvent, bool) { + if o == nil || o.Events == nil { + return nil, false + } + return &o.Events, true +} + +// HasEvents returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasEvents() bool { + if o != nil && o.Events != nil { + return true + } + + return false +} + +// SetEvents gets a reference to the given []WidgetEvent and assigns it to the Events field. +func (o *TimeseriesWidgetDefinition) SetEvents(v []WidgetEvent) { + o.Events = v +} + +// GetLegendColumns returns the LegendColumns field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetLegendColumns() []TimeseriesWidgetLegendColumn { + if o == nil || o.LegendColumns == nil { + var ret []TimeseriesWidgetLegendColumn + return ret + } + return o.LegendColumns +} + +// GetLegendColumnsOk returns a tuple with the LegendColumns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetLegendColumnsOk() (*[]TimeseriesWidgetLegendColumn, bool) { + if o == nil || o.LegendColumns == nil { + return nil, false + } + return &o.LegendColumns, true +} + +// HasLegendColumns returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasLegendColumns() bool { + if o != nil && o.LegendColumns != nil { + return true + } + + return false +} + +// SetLegendColumns gets a reference to the given []TimeseriesWidgetLegendColumn and assigns it to the LegendColumns field. +func (o *TimeseriesWidgetDefinition) SetLegendColumns(v []TimeseriesWidgetLegendColumn) { + o.LegendColumns = v +} + +// GetLegendLayout returns the LegendLayout field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetLegendLayout() TimeseriesWidgetLegendLayout { + if o == nil || o.LegendLayout == nil { + var ret TimeseriesWidgetLegendLayout + return ret + } + return *o.LegendLayout +} + +// GetLegendLayoutOk returns a tuple with the LegendLayout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetLegendLayoutOk() (*TimeseriesWidgetLegendLayout, bool) { + if o == nil || o.LegendLayout == nil { + return nil, false + } + return o.LegendLayout, true +} + +// HasLegendLayout returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasLegendLayout() bool { + if o != nil && o.LegendLayout != nil { + return true + } + + return false +} + +// SetLegendLayout gets a reference to the given TimeseriesWidgetLegendLayout and assigns it to the LegendLayout field. +func (o *TimeseriesWidgetDefinition) SetLegendLayout(v TimeseriesWidgetLegendLayout) { + o.LegendLayout = &v +} + +// GetLegendSize returns the LegendSize field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetLegendSize() string { + if o == nil || o.LegendSize == nil { + var ret string + return ret + } + return *o.LegendSize +} + +// GetLegendSizeOk returns a tuple with the LegendSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetLegendSizeOk() (*string, bool) { + if o == nil || o.LegendSize == nil { + return nil, false + } + return o.LegendSize, true +} + +// HasLegendSize returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasLegendSize() bool { + if o != nil && o.LegendSize != nil { + return true + } + + return false +} + +// SetLegendSize gets a reference to the given string and assigns it to the LegendSize field. +func (o *TimeseriesWidgetDefinition) SetLegendSize(v string) { + o.LegendSize = &v +} + +// GetMarkers returns the Markers field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetMarkers() []WidgetMarker { + if o == nil || o.Markers == nil { + var ret []WidgetMarker + return ret + } + return o.Markers +} + +// GetMarkersOk returns a tuple with the Markers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetMarkersOk() (*[]WidgetMarker, bool) { + if o == nil || o.Markers == nil { + return nil, false + } + return &o.Markers, true +} + +// HasMarkers returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasMarkers() bool { + if o != nil && o.Markers != nil { + return true + } + + return false +} + +// SetMarkers gets a reference to the given []WidgetMarker and assigns it to the Markers field. +func (o *TimeseriesWidgetDefinition) SetMarkers(v []WidgetMarker) { + o.Markers = v +} + +// GetRequests returns the Requests field value. +func (o *TimeseriesWidgetDefinition) GetRequests() []TimeseriesWidgetRequest { + if o == nil { + var ret []TimeseriesWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetRequestsOk() (*[]TimeseriesWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *TimeseriesWidgetDefinition) SetRequests(v []TimeseriesWidgetRequest) { + o.Requests = v +} + +// GetRightYaxis returns the RightYaxis field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetRightYaxis() WidgetAxis { + if o == nil || o.RightYaxis == nil { + var ret WidgetAxis + return ret + } + return *o.RightYaxis +} + +// GetRightYaxisOk returns a tuple with the RightYaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetRightYaxisOk() (*WidgetAxis, bool) { + if o == nil || o.RightYaxis == nil { + return nil, false + } + return o.RightYaxis, true +} + +// HasRightYaxis returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasRightYaxis() bool { + if o != nil && o.RightYaxis != nil { + return true + } + + return false +} + +// SetRightYaxis gets a reference to the given WidgetAxis and assigns it to the RightYaxis field. +func (o *TimeseriesWidgetDefinition) SetRightYaxis(v WidgetAxis) { + o.RightYaxis = &v +} + +// GetShowLegend returns the ShowLegend field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetShowLegend() bool { + if o == nil || o.ShowLegend == nil { + var ret bool + return ret + } + return *o.ShowLegend +} + +// GetShowLegendOk returns a tuple with the ShowLegend field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetShowLegendOk() (*bool, bool) { + if o == nil || o.ShowLegend == nil { + return nil, false + } + return o.ShowLegend, true +} + +// HasShowLegend returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasShowLegend() bool { + if o != nil && o.ShowLegend != nil { + return true + } + + return false +} + +// SetShowLegend gets a reference to the given bool and assigns it to the ShowLegend field. +func (o *TimeseriesWidgetDefinition) SetShowLegend(v bool) { + o.ShowLegend = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *TimeseriesWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *TimeseriesWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *TimeseriesWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *TimeseriesWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *TimeseriesWidgetDefinition) GetType() TimeseriesWidgetDefinitionType { + if o == nil { + var ret TimeseriesWidgetDefinitionType + 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 *TimeseriesWidgetDefinition) GetTypeOk() (*TimeseriesWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TimeseriesWidgetDefinition) SetType(v TimeseriesWidgetDefinitionType) { + o.Type = v +} + +// GetYaxis returns the Yaxis field value if set, zero value otherwise. +func (o *TimeseriesWidgetDefinition) GetYaxis() WidgetAxis { + if o == nil || o.Yaxis == nil { + var ret WidgetAxis + return ret + } + return *o.Yaxis +} + +// GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetDefinition) GetYaxisOk() (*WidgetAxis, bool) { + if o == nil || o.Yaxis == nil { + return nil, false + } + return o.Yaxis, true +} + +// HasYaxis returns a boolean if a field has been set. +func (o *TimeseriesWidgetDefinition) HasYaxis() bool { + if o != nil && o.Yaxis != nil { + return true + } + + return false +} + +// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. +func (o *TimeseriesWidgetDefinition) SetYaxis(v WidgetAxis) { + o.Yaxis = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TimeseriesWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + if o.Events != nil { + toSerialize["events"] = o.Events + } + if o.LegendColumns != nil { + toSerialize["legend_columns"] = o.LegendColumns + } + if o.LegendLayout != nil { + toSerialize["legend_layout"] = o.LegendLayout + } + if o.LegendSize != nil { + toSerialize["legend_size"] = o.LegendSize + } + if o.Markers != nil { + toSerialize["markers"] = o.Markers + } + toSerialize["requests"] = o.Requests + if o.RightYaxis != nil { + toSerialize["right_yaxis"] = o.RightYaxis + } + if o.ShowLegend != nil { + toSerialize["show_legend"] = o.ShowLegend + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + if o.Yaxis != nil { + toSerialize["yaxis"] = o.Yaxis + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]TimeseriesWidgetRequest `json:"requests"` + Type *TimeseriesWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Events []WidgetEvent `json:"events,omitempty"` + LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"` + LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"` + LegendSize *string `json:"legend_size,omitempty"` + Markers []WidgetMarker `json:"markers,omitempty"` + Requests []TimeseriesWidgetRequest `json:"requests"` + RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type TimeseriesWidgetDefinitionType `json:"type"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LegendLayout; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.Events = all.Events + o.LegendColumns = all.LegendColumns + o.LegendLayout = all.LegendLayout + o.LegendSize = all.LegendSize + o.Markers = all.Markers + o.Requests = all.Requests + if all.RightYaxis != nil && all.RightYaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RightYaxis = all.RightYaxis + o.ShowLegend = all.ShowLegend + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Yaxis = all.Yaxis + return nil +} diff --git a/api/v1/datadog/model_timeseries_widget_definition_type.go b/api/v1/datadog/model_timeseries_widget_definition_type.go new file mode 100644 index 00000000000..312f7b681ad --- /dev/null +++ b/api/v1/datadog/model_timeseries_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TimeseriesWidgetDefinitionType Type of the timeseries widget. +type TimeseriesWidgetDefinitionType string + +// List of TimeseriesWidgetDefinitionType. +const ( + TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES TimeseriesWidgetDefinitionType = "timeseries" +) + +var allowedTimeseriesWidgetDefinitionTypeEnumValues = []TimeseriesWidgetDefinitionType{ + TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TimeseriesWidgetDefinitionType) GetAllowedValues() []TimeseriesWidgetDefinitionType { + return allowedTimeseriesWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TimeseriesWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TimeseriesWidgetDefinitionType(value) + return nil +} + +// NewTimeseriesWidgetDefinitionTypeFromValue returns a pointer to a valid TimeseriesWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTimeseriesWidgetDefinitionTypeFromValue(v string) (*TimeseriesWidgetDefinitionType, error) { + ev := TimeseriesWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TimeseriesWidgetDefinitionType: valid values are %v", v, allowedTimeseriesWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TimeseriesWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedTimeseriesWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TimeseriesWidgetDefinitionType value. +func (v TimeseriesWidgetDefinitionType) Ptr() *TimeseriesWidgetDefinitionType { + return &v +} + +// NullableTimeseriesWidgetDefinitionType handles when a null is used for TimeseriesWidgetDefinitionType. +type NullableTimeseriesWidgetDefinitionType struct { + value *TimeseriesWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableTimeseriesWidgetDefinitionType) Get() *TimeseriesWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTimeseriesWidgetDefinitionType) Set(val *TimeseriesWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTimeseriesWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTimeseriesWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTimeseriesWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableTimeseriesWidgetDefinitionType(val *TimeseriesWidgetDefinitionType) *NullableTimeseriesWidgetDefinitionType { + return &NullableTimeseriesWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTimeseriesWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTimeseriesWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_timeseries_widget_expression_alias.go b/api/v1/datadog/model_timeseries_widget_expression_alias.go new file mode 100644 index 00000000000..fdaae03f7b6 --- /dev/null +++ b/api/v1/datadog/model_timeseries_widget_expression_alias.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TimeseriesWidgetExpressionAlias Define an expression alias. +type TimeseriesWidgetExpressionAlias struct { + // Expression alias. + AliasName *string `json:"alias_name,omitempty"` + // Expression name. + Expression string `json:"expression"` + // 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{} +} + +// NewTimeseriesWidgetExpressionAlias instantiates a new TimeseriesWidgetExpressionAlias 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 NewTimeseriesWidgetExpressionAlias(expression string) *TimeseriesWidgetExpressionAlias { + this := TimeseriesWidgetExpressionAlias{} + this.Expression = expression + return &this +} + +// NewTimeseriesWidgetExpressionAliasWithDefaults instantiates a new TimeseriesWidgetExpressionAlias 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 NewTimeseriesWidgetExpressionAliasWithDefaults() *TimeseriesWidgetExpressionAlias { + this := TimeseriesWidgetExpressionAlias{} + return &this +} + +// GetAliasName returns the AliasName field value if set, zero value otherwise. +func (o *TimeseriesWidgetExpressionAlias) GetAliasName() string { + if o == nil || o.AliasName == nil { + var ret string + return ret + } + return *o.AliasName +} + +// GetAliasNameOk returns a tuple with the AliasName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetExpressionAlias) GetAliasNameOk() (*string, bool) { + if o == nil || o.AliasName == nil { + return nil, false + } + return o.AliasName, true +} + +// HasAliasName returns a boolean if a field has been set. +func (o *TimeseriesWidgetExpressionAlias) HasAliasName() bool { + if o != nil && o.AliasName != nil { + return true + } + + return false +} + +// SetAliasName gets a reference to the given string and assigns it to the AliasName field. +func (o *TimeseriesWidgetExpressionAlias) SetAliasName(v string) { + o.AliasName = &v +} + +// GetExpression returns the Expression field value. +func (o *TimeseriesWidgetExpressionAlias) GetExpression() string { + if o == nil { + var ret string + return ret + } + return o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetExpressionAlias) GetExpressionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Expression, true +} + +// SetExpression sets field value. +func (o *TimeseriesWidgetExpressionAlias) SetExpression(v string) { + o.Expression = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TimeseriesWidgetExpressionAlias) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AliasName != nil { + toSerialize["alias_name"] = o.AliasName + } + toSerialize["expression"] = o.Expression + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TimeseriesWidgetExpressionAlias) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Expression *string `json:"expression"` + }{} + all := struct { + AliasName *string `json:"alias_name,omitempty"` + Expression string `json:"expression"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Expression == nil { + return fmt.Errorf("Required field expression missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AliasName = all.AliasName + o.Expression = all.Expression + return nil +} diff --git a/api/v1/datadog/model_timeseries_widget_legend_column.go b/api/v1/datadog/model_timeseries_widget_legend_column.go new file mode 100644 index 00000000000..104dd11c44f --- /dev/null +++ b/api/v1/datadog/model_timeseries_widget_legend_column.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TimeseriesWidgetLegendColumn Legend column. +type TimeseriesWidgetLegendColumn string + +// List of TimeseriesWidgetLegendColumn. +const ( + TIMESERIESWIDGETLEGENDCOLUMN_VALUE TimeseriesWidgetLegendColumn = "value" + TIMESERIESWIDGETLEGENDCOLUMN_AVG TimeseriesWidgetLegendColumn = "avg" + TIMESERIESWIDGETLEGENDCOLUMN_SUM TimeseriesWidgetLegendColumn = "sum" + TIMESERIESWIDGETLEGENDCOLUMN_MIN TimeseriesWidgetLegendColumn = "min" + TIMESERIESWIDGETLEGENDCOLUMN_MAX TimeseriesWidgetLegendColumn = "max" +) + +var allowedTimeseriesWidgetLegendColumnEnumValues = []TimeseriesWidgetLegendColumn{ + TIMESERIESWIDGETLEGENDCOLUMN_VALUE, + TIMESERIESWIDGETLEGENDCOLUMN_AVG, + TIMESERIESWIDGETLEGENDCOLUMN_SUM, + TIMESERIESWIDGETLEGENDCOLUMN_MIN, + TIMESERIESWIDGETLEGENDCOLUMN_MAX, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TimeseriesWidgetLegendColumn) GetAllowedValues() []TimeseriesWidgetLegendColumn { + return allowedTimeseriesWidgetLegendColumnEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TimeseriesWidgetLegendColumn) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TimeseriesWidgetLegendColumn(value) + return nil +} + +// NewTimeseriesWidgetLegendColumnFromValue returns a pointer to a valid TimeseriesWidgetLegendColumn +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTimeseriesWidgetLegendColumnFromValue(v string) (*TimeseriesWidgetLegendColumn, error) { + ev := TimeseriesWidgetLegendColumn(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TimeseriesWidgetLegendColumn: valid values are %v", v, allowedTimeseriesWidgetLegendColumnEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TimeseriesWidgetLegendColumn) IsValid() bool { + for _, existing := range allowedTimeseriesWidgetLegendColumnEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TimeseriesWidgetLegendColumn value. +func (v TimeseriesWidgetLegendColumn) Ptr() *TimeseriesWidgetLegendColumn { + return &v +} + +// NullableTimeseriesWidgetLegendColumn handles when a null is used for TimeseriesWidgetLegendColumn. +type NullableTimeseriesWidgetLegendColumn struct { + value *TimeseriesWidgetLegendColumn + isSet bool +} + +// Get returns the associated value. +func (v NullableTimeseriesWidgetLegendColumn) Get() *TimeseriesWidgetLegendColumn { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTimeseriesWidgetLegendColumn) Set(val *TimeseriesWidgetLegendColumn) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTimeseriesWidgetLegendColumn) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTimeseriesWidgetLegendColumn) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTimeseriesWidgetLegendColumn initializes the struct as if Set has been called. +func NewNullableTimeseriesWidgetLegendColumn(val *TimeseriesWidgetLegendColumn) *NullableTimeseriesWidgetLegendColumn { + return &NullableTimeseriesWidgetLegendColumn{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTimeseriesWidgetLegendColumn) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTimeseriesWidgetLegendColumn) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_timeseries_widget_legend_layout.go b/api/v1/datadog/model_timeseries_widget_legend_layout.go new file mode 100644 index 00000000000..0fca079a9f2 --- /dev/null +++ b/api/v1/datadog/model_timeseries_widget_legend_layout.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TimeseriesWidgetLegendLayout Layout of the legend. +type TimeseriesWidgetLegendLayout string + +// List of TimeseriesWidgetLegendLayout. +const ( + TIMESERIESWIDGETLEGENDLAYOUT_AUTO TimeseriesWidgetLegendLayout = "auto" + TIMESERIESWIDGETLEGENDLAYOUT_HORIZONTAL TimeseriesWidgetLegendLayout = "horizontal" + TIMESERIESWIDGETLEGENDLAYOUT_VERTICAL TimeseriesWidgetLegendLayout = "vertical" +) + +var allowedTimeseriesWidgetLegendLayoutEnumValues = []TimeseriesWidgetLegendLayout{ + TIMESERIESWIDGETLEGENDLAYOUT_AUTO, + TIMESERIESWIDGETLEGENDLAYOUT_HORIZONTAL, + TIMESERIESWIDGETLEGENDLAYOUT_VERTICAL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TimeseriesWidgetLegendLayout) GetAllowedValues() []TimeseriesWidgetLegendLayout { + return allowedTimeseriesWidgetLegendLayoutEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TimeseriesWidgetLegendLayout) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TimeseriesWidgetLegendLayout(value) + return nil +} + +// NewTimeseriesWidgetLegendLayoutFromValue returns a pointer to a valid TimeseriesWidgetLegendLayout +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTimeseriesWidgetLegendLayoutFromValue(v string) (*TimeseriesWidgetLegendLayout, error) { + ev := TimeseriesWidgetLegendLayout(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TimeseriesWidgetLegendLayout: valid values are %v", v, allowedTimeseriesWidgetLegendLayoutEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TimeseriesWidgetLegendLayout) IsValid() bool { + for _, existing := range allowedTimeseriesWidgetLegendLayoutEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TimeseriesWidgetLegendLayout value. +func (v TimeseriesWidgetLegendLayout) Ptr() *TimeseriesWidgetLegendLayout { + return &v +} + +// NullableTimeseriesWidgetLegendLayout handles when a null is used for TimeseriesWidgetLegendLayout. +type NullableTimeseriesWidgetLegendLayout struct { + value *TimeseriesWidgetLegendLayout + isSet bool +} + +// Get returns the associated value. +func (v NullableTimeseriesWidgetLegendLayout) Get() *TimeseriesWidgetLegendLayout { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTimeseriesWidgetLegendLayout) Set(val *TimeseriesWidgetLegendLayout) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTimeseriesWidgetLegendLayout) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTimeseriesWidgetLegendLayout) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTimeseriesWidgetLegendLayout initializes the struct as if Set has been called. +func NewNullableTimeseriesWidgetLegendLayout(val *TimeseriesWidgetLegendLayout) *NullableTimeseriesWidgetLegendLayout { + return &NullableTimeseriesWidgetLegendLayout{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTimeseriesWidgetLegendLayout) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTimeseriesWidgetLegendLayout) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_timeseries_widget_request.go b/api/v1/datadog/model_timeseries_widget_request.go new file mode 100644 index 00000000000..5ab9ef19e01 --- /dev/null +++ b/api/v1/datadog/model_timeseries_widget_request.go @@ -0,0 +1,812 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// TimeseriesWidgetRequest Updated timeseries widget. +type TimeseriesWidgetRequest struct { + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The log query. + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + // Type of display to use for the request. + DisplayType *WidgetDisplayType `json:"display_type,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // Used to define expression aliases. + Metadata []TimeseriesWidgetExpressionAlias `json:"metadata,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // Whether or not to display a second y-axis on the right. + OnRightYaxis *bool `json:"on_right_yaxis,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Widget query. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + // Define request widget style. + Style *WidgetRequestStyle `json:"style,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{} +} + +// NewTimeseriesWidgetRequest instantiates a new TimeseriesWidgetRequest 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 NewTimeseriesWidgetRequest() *TimeseriesWidgetRequest { + this := TimeseriesWidgetRequest{} + return &this +} + +// NewTimeseriesWidgetRequestWithDefaults instantiates a new TimeseriesWidgetRequest 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 NewTimeseriesWidgetRequestWithDefaults() *TimeseriesWidgetRequest { + this := TimeseriesWidgetRequest{} + return &this +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *TimeseriesWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetAuditQuery() LogQueryDefinition { + if o == nil || o.AuditQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.AuditQuery +} + +// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.AuditQuery == nil { + return nil, false + } + return o.AuditQuery, true +} + +// HasAuditQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasAuditQuery() bool { + if o != nil && o.AuditQuery != nil { + return true + } + + return false +} + +// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. +func (o *TimeseriesWidgetRequest) SetAuditQuery(v LogQueryDefinition) { + o.AuditQuery = &v +} + +// GetDisplayType returns the DisplayType field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetDisplayType() WidgetDisplayType { + if o == nil || o.DisplayType == nil { + var ret WidgetDisplayType + return ret + } + return *o.DisplayType +} + +// GetDisplayTypeOk returns a tuple with the DisplayType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetDisplayTypeOk() (*WidgetDisplayType, bool) { + if o == nil || o.DisplayType == nil { + return nil, false + } + return o.DisplayType, true +} + +// HasDisplayType returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasDisplayType() bool { + if o != nil && o.DisplayType != nil { + return true + } + + return false +} + +// SetDisplayType gets a reference to the given WidgetDisplayType and assigns it to the DisplayType field. +func (o *TimeseriesWidgetRequest) SetDisplayType(v WidgetDisplayType) { + o.DisplayType = &v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *TimeseriesWidgetRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *TimeseriesWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *TimeseriesWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetMetadata() []TimeseriesWidgetExpressionAlias { + if o == nil || o.Metadata == nil { + var ret []TimeseriesWidgetExpressionAlias + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetMetadataOk() (*[]TimeseriesWidgetExpressionAlias, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return &o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given []TimeseriesWidgetExpressionAlias and assigns it to the Metadata field. +func (o *TimeseriesWidgetRequest) SetMetadata(v []TimeseriesWidgetExpressionAlias) { + o.Metadata = v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *TimeseriesWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetOnRightYaxis returns the OnRightYaxis field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetOnRightYaxis() bool { + if o == nil || o.OnRightYaxis == nil { + var ret bool + return ret + } + return *o.OnRightYaxis +} + +// GetOnRightYaxisOk returns a tuple with the OnRightYaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetOnRightYaxisOk() (*bool, bool) { + if o == nil || o.OnRightYaxis == nil { + return nil, false + } + return o.OnRightYaxis, true +} + +// HasOnRightYaxis returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasOnRightYaxis() bool { + if o != nil && o.OnRightYaxis != nil { + return true + } + + return false +} + +// SetOnRightYaxis gets a reference to the given bool and assigns it to the OnRightYaxis field. +func (o *TimeseriesWidgetRequest) SetOnRightYaxis(v bool) { + o.OnRightYaxis = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *TimeseriesWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *TimeseriesWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *TimeseriesWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *TimeseriesWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *TimeseriesWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *TimeseriesWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *TimeseriesWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// GetStyle returns the Style field value if set, zero value otherwise. +func (o *TimeseriesWidgetRequest) GetStyle() WidgetRequestStyle { + if o == nil || o.Style == nil { + var ret WidgetRequestStyle + return ret + } + return *o.Style +} + +// GetStyleOk returns a tuple with the Style field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimeseriesWidgetRequest) GetStyleOk() (*WidgetRequestStyle, bool) { + if o == nil || o.Style == nil { + return nil, false + } + return o.Style, true +} + +// HasStyle returns a boolean if a field has been set. +func (o *TimeseriesWidgetRequest) HasStyle() bool { + if o != nil && o.Style != nil { + return true + } + + return false +} + +// SetStyle gets a reference to the given WidgetRequestStyle and assigns it to the Style field. +func (o *TimeseriesWidgetRequest) SetStyle(v WidgetRequestStyle) { + o.Style = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TimeseriesWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.AuditQuery != nil { + toSerialize["audit_query"] = o.AuditQuery + } + if o.DisplayType != nil { + toSerialize["display_type"] = o.DisplayType + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.OnRightYaxis != nil { + toSerialize["on_right_yaxis"] = o.OnRightYaxis + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + if o.Style != nil { + toSerialize["style"] = o.Style + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + DisplayType *WidgetDisplayType `json:"display_type,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + Metadata []TimeseriesWidgetExpressionAlias `json:"metadata,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + OnRightYaxis *bool `json:"on_right_yaxis,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + Style *WidgetRequestStyle `json:"style,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DisplayType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.AuditQuery = all.AuditQuery + o.DisplayType = all.DisplayType + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + o.Formulas = all.Formulas + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + o.Metadata = all.Metadata + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + o.OnRightYaxis = all.OnRightYaxis + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Style = all.Style + return nil +} diff --git a/api/v1/datadog/model_toplist_widget_definition.go b/api/v1/datadog/model_toplist_widget_definition.go new file mode 100644 index 00000000000..d7bce963817 --- /dev/null +++ b/api/v1/datadog/model_toplist_widget_definition.go @@ -0,0 +1,356 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ToplistWidgetDefinition The top list visualization enables you to display a list of Tag value like hostname or service with the most or least of any metric value, such as highest consumers of CPU, hosts with the least disk space, etc. +type ToplistWidgetDefinition struct { + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // List of top list widget requests. + Requests []ToplistWidgetRequest `json:"requests"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of your widget. + Title *string `json:"title,omitempty"` + // How to align the text on the widget. + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + // Size of the title. + TitleSize *string `json:"title_size,omitempty"` + // Type of the top list widget. + Type ToplistWidgetDefinitionType `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{} +} + +// NewToplistWidgetDefinition instantiates a new ToplistWidgetDefinition 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 NewToplistWidgetDefinition(requests []ToplistWidgetRequest, typeVar ToplistWidgetDefinitionType) *ToplistWidgetDefinition { + this := ToplistWidgetDefinition{} + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewToplistWidgetDefinitionWithDefaults instantiates a new ToplistWidgetDefinition 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 NewToplistWidgetDefinitionWithDefaults() *ToplistWidgetDefinition { + this := ToplistWidgetDefinition{} + var typeVar ToplistWidgetDefinitionType = TOPLISTWIDGETDEFINITIONTYPE_TOPLIST + this.Type = typeVar + return &this +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *ToplistWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *ToplistWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *ToplistWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetRequests returns the Requests field value. +func (o *ToplistWidgetDefinition) GetRequests() []ToplistWidgetRequest { + if o == nil { + var ret []ToplistWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *ToplistWidgetDefinition) GetRequestsOk() (*[]ToplistWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *ToplistWidgetDefinition) SetRequests(v []ToplistWidgetRequest) { + o.Requests = v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *ToplistWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *ToplistWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *ToplistWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *ToplistWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *ToplistWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *ToplistWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetTitleAlign returns the TitleAlign field value if set, zero value otherwise. +func (o *ToplistWidgetDefinition) GetTitleAlign() WidgetTextAlign { + if o == nil || o.TitleAlign == nil { + var ret WidgetTextAlign + return ret + } + return *o.TitleAlign +} + +// GetTitleAlignOk returns a tuple with the TitleAlign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetDefinition) GetTitleAlignOk() (*WidgetTextAlign, bool) { + if o == nil || o.TitleAlign == nil { + return nil, false + } + return o.TitleAlign, true +} + +// HasTitleAlign returns a boolean if a field has been set. +func (o *ToplistWidgetDefinition) HasTitleAlign() bool { + if o != nil && o.TitleAlign != nil { + return true + } + + return false +} + +// SetTitleAlign gets a reference to the given WidgetTextAlign and assigns it to the TitleAlign field. +func (o *ToplistWidgetDefinition) SetTitleAlign(v WidgetTextAlign) { + o.TitleAlign = &v +} + +// GetTitleSize returns the TitleSize field value if set, zero value otherwise. +func (o *ToplistWidgetDefinition) GetTitleSize() string { + if o == nil || o.TitleSize == nil { + var ret string + return ret + } + return *o.TitleSize +} + +// GetTitleSizeOk returns a tuple with the TitleSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetDefinition) GetTitleSizeOk() (*string, bool) { + if o == nil || o.TitleSize == nil { + return nil, false + } + return o.TitleSize, true +} + +// HasTitleSize returns a boolean if a field has been set. +func (o *ToplistWidgetDefinition) HasTitleSize() bool { + if o != nil && o.TitleSize != nil { + return true + } + + return false +} + +// SetTitleSize gets a reference to the given string and assigns it to the TitleSize field. +func (o *ToplistWidgetDefinition) SetTitleSize(v string) { + o.TitleSize = &v +} + +// GetType returns the Type field value. +func (o *ToplistWidgetDefinition) GetType() ToplistWidgetDefinitionType { + if o == nil { + var ret ToplistWidgetDefinitionType + 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 *ToplistWidgetDefinition) GetTypeOk() (*ToplistWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ToplistWidgetDefinition) SetType(v ToplistWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ToplistWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + toSerialize["requests"] = o.Requests + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.TitleAlign != nil { + toSerialize["title_align"] = o.TitleAlign + } + if o.TitleSize != nil { + toSerialize["title_size"] = o.TitleSize + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]ToplistWidgetRequest `json:"requests"` + Type *ToplistWidgetDefinitionType `json:"type"` + }{} + all := struct { + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests []ToplistWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type ToplistWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.TitleAlign; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomLinks = all.CustomLinks + o.Requests = all.Requests + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.TitleAlign = all.TitleAlign + o.TitleSize = all.TitleSize + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_toplist_widget_definition_type.go b/api/v1/datadog/model_toplist_widget_definition_type.go new file mode 100644 index 00000000000..19f230f2b7f --- /dev/null +++ b/api/v1/datadog/model_toplist_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ToplistWidgetDefinitionType Type of the top list widget. +type ToplistWidgetDefinitionType string + +// List of ToplistWidgetDefinitionType. +const ( + TOPLISTWIDGETDEFINITIONTYPE_TOPLIST ToplistWidgetDefinitionType = "toplist" +) + +var allowedToplistWidgetDefinitionTypeEnumValues = []ToplistWidgetDefinitionType{ + TOPLISTWIDGETDEFINITIONTYPE_TOPLIST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ToplistWidgetDefinitionType) GetAllowedValues() []ToplistWidgetDefinitionType { + return allowedToplistWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ToplistWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ToplistWidgetDefinitionType(value) + return nil +} + +// NewToplistWidgetDefinitionTypeFromValue returns a pointer to a valid ToplistWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewToplistWidgetDefinitionTypeFromValue(v string) (*ToplistWidgetDefinitionType, error) { + ev := ToplistWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ToplistWidgetDefinitionType: valid values are %v", v, allowedToplistWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ToplistWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedToplistWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ToplistWidgetDefinitionType value. +func (v ToplistWidgetDefinitionType) Ptr() *ToplistWidgetDefinitionType { + return &v +} + +// NullableToplistWidgetDefinitionType handles when a null is used for ToplistWidgetDefinitionType. +type NullableToplistWidgetDefinitionType struct { + value *ToplistWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableToplistWidgetDefinitionType) Get() *ToplistWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableToplistWidgetDefinitionType) Set(val *ToplistWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableToplistWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableToplistWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableToplistWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableToplistWidgetDefinitionType(val *ToplistWidgetDefinitionType) *NullableToplistWidgetDefinitionType { + return &NullableToplistWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableToplistWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableToplistWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_toplist_widget_request.go b/api/v1/datadog/model_toplist_widget_request.go new file mode 100644 index 00000000000..421a8e26ee6 --- /dev/null +++ b/api/v1/datadog/model_toplist_widget_request.go @@ -0,0 +1,726 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ToplistWidgetRequest Updated top list widget. +type ToplistWidgetRequest struct { + // The log query. + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + // The log query. + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + // List of conditional formats. + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + // The log query. + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // The log query. + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + // The log query. + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + // The process query to use in the widget. + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + // The log query. + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + // Widget query. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + // The log query. + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + // The log query. + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + // Define request widget style. + Style *WidgetRequestStyle `json:"style,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{} +} + +// NewToplistWidgetRequest instantiates a new ToplistWidgetRequest 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 NewToplistWidgetRequest() *ToplistWidgetRequest { + this := ToplistWidgetRequest{} + return &this +} + +// NewToplistWidgetRequestWithDefaults instantiates a new ToplistWidgetRequest 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 NewToplistWidgetRequestWithDefaults() *ToplistWidgetRequest { + this := ToplistWidgetRequest{} + return &this +} + +// GetApmQuery returns the ApmQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetApmQuery() LogQueryDefinition { + if o == nil || o.ApmQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ApmQuery +} + +// GetApmQueryOk returns a tuple with the ApmQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetApmQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ApmQuery == nil { + return nil, false + } + return o.ApmQuery, true +} + +// HasApmQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasApmQuery() bool { + if o != nil && o.ApmQuery != nil { + return true + } + + return false +} + +// SetApmQuery gets a reference to the given LogQueryDefinition and assigns it to the ApmQuery field. +func (o *ToplistWidgetRequest) SetApmQuery(v LogQueryDefinition) { + o.ApmQuery = &v +} + +// GetAuditQuery returns the AuditQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetAuditQuery() LogQueryDefinition { + if o == nil || o.AuditQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.AuditQuery +} + +// GetAuditQueryOk returns a tuple with the AuditQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetAuditQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.AuditQuery == nil { + return nil, false + } + return o.AuditQuery, true +} + +// HasAuditQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasAuditQuery() bool { + if o != nil && o.AuditQuery != nil { + return true + } + + return false +} + +// SetAuditQuery gets a reference to the given LogQueryDefinition and assigns it to the AuditQuery field. +func (o *ToplistWidgetRequest) SetAuditQuery(v LogQueryDefinition) { + o.AuditQuery = &v +} + +// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetConditionalFormats() []WidgetConditionalFormat { + if o == nil || o.ConditionalFormats == nil { + var ret []WidgetConditionalFormat + return ret + } + return o.ConditionalFormats +} + +// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { + if o == nil || o.ConditionalFormats == nil { + return nil, false + } + return &o.ConditionalFormats, true +} + +// HasConditionalFormats returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasConditionalFormats() bool { + if o != nil && o.ConditionalFormats != nil { + return true + } + + return false +} + +// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. +func (o *ToplistWidgetRequest) SetConditionalFormats(v []WidgetConditionalFormat) { + o.ConditionalFormats = v +} + +// GetEventQuery returns the EventQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetEventQuery() LogQueryDefinition { + if o == nil || o.EventQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.EventQuery +} + +// GetEventQueryOk returns a tuple with the EventQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetEventQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.EventQuery == nil { + return nil, false + } + return o.EventQuery, true +} + +// HasEventQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasEventQuery() bool { + if o != nil && o.EventQuery != nil { + return true + } + + return false +} + +// SetEventQuery gets a reference to the given LogQueryDefinition and assigns it to the EventQuery field. +func (o *ToplistWidgetRequest) SetEventQuery(v LogQueryDefinition) { + o.EventQuery = &v +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *ToplistWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetLogQuery returns the LogQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetLogQuery() LogQueryDefinition { + if o == nil || o.LogQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.LogQuery +} + +// GetLogQueryOk returns a tuple with the LogQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetLogQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.LogQuery == nil { + return nil, false + } + return o.LogQuery, true +} + +// HasLogQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasLogQuery() bool { + if o != nil && o.LogQuery != nil { + return true + } + + return false +} + +// SetLogQuery gets a reference to the given LogQueryDefinition and assigns it to the LogQuery field. +func (o *ToplistWidgetRequest) SetLogQuery(v LogQueryDefinition) { + o.LogQuery = &v +} + +// GetNetworkQuery returns the NetworkQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetNetworkQuery() LogQueryDefinition { + if o == nil || o.NetworkQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.NetworkQuery +} + +// GetNetworkQueryOk returns a tuple with the NetworkQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetNetworkQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.NetworkQuery == nil { + return nil, false + } + return o.NetworkQuery, true +} + +// HasNetworkQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasNetworkQuery() bool { + if o != nil && o.NetworkQuery != nil { + return true + } + + return false +} + +// SetNetworkQuery gets a reference to the given LogQueryDefinition and assigns it to the NetworkQuery field. +func (o *ToplistWidgetRequest) SetNetworkQuery(v LogQueryDefinition) { + o.NetworkQuery = &v +} + +// GetProcessQuery returns the ProcessQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetProcessQuery() ProcessQueryDefinition { + if o == nil || o.ProcessQuery == nil { + var ret ProcessQueryDefinition + return ret + } + return *o.ProcessQuery +} + +// GetProcessQueryOk returns a tuple with the ProcessQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetProcessQueryOk() (*ProcessQueryDefinition, bool) { + if o == nil || o.ProcessQuery == nil { + return nil, false + } + return o.ProcessQuery, true +} + +// HasProcessQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasProcessQuery() bool { + if o != nil && o.ProcessQuery != nil { + return true + } + + return false +} + +// SetProcessQuery gets a reference to the given ProcessQueryDefinition and assigns it to the ProcessQuery field. +func (o *ToplistWidgetRequest) SetProcessQuery(v ProcessQueryDefinition) { + o.ProcessQuery = &v +} + +// GetProfileMetricsQuery returns the ProfileMetricsQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetProfileMetricsQuery() LogQueryDefinition { + if o == nil || o.ProfileMetricsQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.ProfileMetricsQuery +} + +// GetProfileMetricsQueryOk returns a tuple with the ProfileMetricsQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetProfileMetricsQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.ProfileMetricsQuery == nil { + return nil, false + } + return o.ProfileMetricsQuery, true +} + +// HasProfileMetricsQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasProfileMetricsQuery() bool { + if o != nil && o.ProfileMetricsQuery != nil { + return true + } + + return false +} + +// SetProfileMetricsQuery gets a reference to the given LogQueryDefinition and assigns it to the ProfileMetricsQuery field. +func (o *ToplistWidgetRequest) SetProfileMetricsQuery(v LogQueryDefinition) { + o.ProfileMetricsQuery = &v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *ToplistWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *ToplistWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *ToplistWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// GetRumQuery returns the RumQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetRumQuery() LogQueryDefinition { + if o == nil || o.RumQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.RumQuery +} + +// GetRumQueryOk returns a tuple with the RumQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetRumQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.RumQuery == nil { + return nil, false + } + return o.RumQuery, true +} + +// HasRumQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasRumQuery() bool { + if o != nil && o.RumQuery != nil { + return true + } + + return false +} + +// SetRumQuery gets a reference to the given LogQueryDefinition and assigns it to the RumQuery field. +func (o *ToplistWidgetRequest) SetRumQuery(v LogQueryDefinition) { + o.RumQuery = &v +} + +// GetSecurityQuery returns the SecurityQuery field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetSecurityQuery() LogQueryDefinition { + if o == nil || o.SecurityQuery == nil { + var ret LogQueryDefinition + return ret + } + return *o.SecurityQuery +} + +// GetSecurityQueryOk returns a tuple with the SecurityQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetSecurityQueryOk() (*LogQueryDefinition, bool) { + if o == nil || o.SecurityQuery == nil { + return nil, false + } + return o.SecurityQuery, true +} + +// HasSecurityQuery returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasSecurityQuery() bool { + if o != nil && o.SecurityQuery != nil { + return true + } + + return false +} + +// SetSecurityQuery gets a reference to the given LogQueryDefinition and assigns it to the SecurityQuery field. +func (o *ToplistWidgetRequest) SetSecurityQuery(v LogQueryDefinition) { + o.SecurityQuery = &v +} + +// GetStyle returns the Style field value if set, zero value otherwise. +func (o *ToplistWidgetRequest) GetStyle() WidgetRequestStyle { + if o == nil || o.Style == nil { + var ret WidgetRequestStyle + return ret + } + return *o.Style +} + +// GetStyleOk returns a tuple with the Style field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToplistWidgetRequest) GetStyleOk() (*WidgetRequestStyle, bool) { + if o == nil || o.Style == nil { + return nil, false + } + return o.Style, true +} + +// HasStyle returns a boolean if a field has been set. +func (o *ToplistWidgetRequest) HasStyle() bool { + if o != nil && o.Style != nil { + return true + } + + return false +} + +// SetStyle gets a reference to the given WidgetRequestStyle and assigns it to the Style field. +func (o *ToplistWidgetRequest) SetStyle(v WidgetRequestStyle) { + o.Style = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ToplistWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmQuery != nil { + toSerialize["apm_query"] = o.ApmQuery + } + if o.AuditQuery != nil { + toSerialize["audit_query"] = o.AuditQuery + } + if o.ConditionalFormats != nil { + toSerialize["conditional_formats"] = o.ConditionalFormats + } + if o.EventQuery != nil { + toSerialize["event_query"] = o.EventQuery + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.LogQuery != nil { + toSerialize["log_query"] = o.LogQuery + } + if o.NetworkQuery != nil { + toSerialize["network_query"] = o.NetworkQuery + } + if o.ProcessQuery != nil { + toSerialize["process_query"] = o.ProcessQuery + } + if o.ProfileMetricsQuery != nil { + toSerialize["profile_metrics_query"] = o.ProfileMetricsQuery + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + if o.RumQuery != nil { + toSerialize["rum_query"] = o.RumQuery + } + if o.SecurityQuery != nil { + toSerialize["security_query"] = o.SecurityQuery + } + if o.Style != nil { + toSerialize["style"] = o.Style + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ToplistWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + AuditQuery *LogQueryDefinition `json:"audit_query,omitempty"` + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + Style *WidgetRequestStyle `json:"style,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmQuery != nil && all.ApmQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmQuery = all.ApmQuery + if all.AuditQuery != nil && all.AuditQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.AuditQuery = all.AuditQuery + o.ConditionalFormats = all.ConditionalFormats + if all.EventQuery != nil && all.EventQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EventQuery = all.EventQuery + o.Formulas = all.Formulas + if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogQuery = all.LogQuery + if all.NetworkQuery != nil && all.NetworkQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkQuery = all.NetworkQuery + if all.ProcessQuery != nil && all.ProcessQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProcessQuery = all.ProcessQuery + if all.ProfileMetricsQuery != nil && all.ProfileMetricsQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfileMetricsQuery = all.ProfileMetricsQuery + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumQuery = all.RumQuery + if all.SecurityQuery != nil && all.SecurityQuery.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SecurityQuery = all.SecurityQuery + if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Style = all.Style + return nil +} diff --git a/api/v1/datadog/model_tree_map_color_by.go b/api/v1/datadog/model_tree_map_color_by.go new file mode 100644 index 00000000000..399a4753799 --- /dev/null +++ b/api/v1/datadog/model_tree_map_color_by.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TreeMapColorBy (deprecated) The attribute formerly used to determine color in the widget. +type TreeMapColorBy string + +// List of TreeMapColorBy. +const ( + TREEMAPCOLORBY_USER TreeMapColorBy = "user" +) + +var allowedTreeMapColorByEnumValues = []TreeMapColorBy{ + TREEMAPCOLORBY_USER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TreeMapColorBy) GetAllowedValues() []TreeMapColorBy { + return allowedTreeMapColorByEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TreeMapColorBy) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TreeMapColorBy(value) + return nil +} + +// NewTreeMapColorByFromValue returns a pointer to a valid TreeMapColorBy +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTreeMapColorByFromValue(v string) (*TreeMapColorBy, error) { + ev := TreeMapColorBy(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TreeMapColorBy: valid values are %v", v, allowedTreeMapColorByEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TreeMapColorBy) IsValid() bool { + for _, existing := range allowedTreeMapColorByEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TreeMapColorBy value. +func (v TreeMapColorBy) Ptr() *TreeMapColorBy { + return &v +} + +// NullableTreeMapColorBy handles when a null is used for TreeMapColorBy. +type NullableTreeMapColorBy struct { + value *TreeMapColorBy + isSet bool +} + +// Get returns the associated value. +func (v NullableTreeMapColorBy) Get() *TreeMapColorBy { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTreeMapColorBy) Set(val *TreeMapColorBy) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTreeMapColorBy) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTreeMapColorBy) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTreeMapColorBy initializes the struct as if Set has been called. +func NewNullableTreeMapColorBy(val *TreeMapColorBy) *NullableTreeMapColorBy { + return &NullableTreeMapColorBy{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTreeMapColorBy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTreeMapColorBy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_tree_map_group_by.go b/api/v1/datadog/model_tree_map_group_by.go new file mode 100644 index 00000000000..a26a03d685c --- /dev/null +++ b/api/v1/datadog/model_tree_map_group_by.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TreeMapGroupBy (deprecated) The attribute formerly used to group elements in the widget. +type TreeMapGroupBy string + +// List of TreeMapGroupBy. +const ( + TREEMAPGROUPBY_USER TreeMapGroupBy = "user" + TREEMAPGROUPBY_FAMILY TreeMapGroupBy = "family" + TREEMAPGROUPBY_PROCESS TreeMapGroupBy = "process" +) + +var allowedTreeMapGroupByEnumValues = []TreeMapGroupBy{ + TREEMAPGROUPBY_USER, + TREEMAPGROUPBY_FAMILY, + TREEMAPGROUPBY_PROCESS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TreeMapGroupBy) GetAllowedValues() []TreeMapGroupBy { + return allowedTreeMapGroupByEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TreeMapGroupBy) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TreeMapGroupBy(value) + return nil +} + +// NewTreeMapGroupByFromValue returns a pointer to a valid TreeMapGroupBy +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTreeMapGroupByFromValue(v string) (*TreeMapGroupBy, error) { + ev := TreeMapGroupBy(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TreeMapGroupBy: valid values are %v", v, allowedTreeMapGroupByEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TreeMapGroupBy) IsValid() bool { + for _, existing := range allowedTreeMapGroupByEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TreeMapGroupBy value. +func (v TreeMapGroupBy) Ptr() *TreeMapGroupBy { + return &v +} + +// NullableTreeMapGroupBy handles when a null is used for TreeMapGroupBy. +type NullableTreeMapGroupBy struct { + value *TreeMapGroupBy + isSet bool +} + +// Get returns the associated value. +func (v NullableTreeMapGroupBy) Get() *TreeMapGroupBy { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTreeMapGroupBy) Set(val *TreeMapGroupBy) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTreeMapGroupBy) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTreeMapGroupBy) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTreeMapGroupBy initializes the struct as if Set has been called. +func NewNullableTreeMapGroupBy(val *TreeMapGroupBy) *NullableTreeMapGroupBy { + return &NullableTreeMapGroupBy{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTreeMapGroupBy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTreeMapGroupBy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_tree_map_size_by.go b/api/v1/datadog/model_tree_map_size_by.go new file mode 100644 index 00000000000..e829c3ba168 --- /dev/null +++ b/api/v1/datadog/model_tree_map_size_by.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TreeMapSizeBy (deprecated) The attribute formerly used to determine size in the widget. +type TreeMapSizeBy string + +// List of TreeMapSizeBy. +const ( + TREEMAPSIZEBY_PCT_CPU TreeMapSizeBy = "pct_cpu" + TREEMAPSIZEBY_PCT_MEM TreeMapSizeBy = "pct_mem" +) + +var allowedTreeMapSizeByEnumValues = []TreeMapSizeBy{ + TREEMAPSIZEBY_PCT_CPU, + TREEMAPSIZEBY_PCT_MEM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TreeMapSizeBy) GetAllowedValues() []TreeMapSizeBy { + return allowedTreeMapSizeByEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TreeMapSizeBy) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TreeMapSizeBy(value) + return nil +} + +// NewTreeMapSizeByFromValue returns a pointer to a valid TreeMapSizeBy +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTreeMapSizeByFromValue(v string) (*TreeMapSizeBy, error) { + ev := TreeMapSizeBy(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TreeMapSizeBy: valid values are %v", v, allowedTreeMapSizeByEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TreeMapSizeBy) IsValid() bool { + for _, existing := range allowedTreeMapSizeByEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TreeMapSizeBy value. +func (v TreeMapSizeBy) Ptr() *TreeMapSizeBy { + return &v +} + +// NullableTreeMapSizeBy handles when a null is used for TreeMapSizeBy. +type NullableTreeMapSizeBy struct { + value *TreeMapSizeBy + isSet bool +} + +// Get returns the associated value. +func (v NullableTreeMapSizeBy) Get() *TreeMapSizeBy { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTreeMapSizeBy) Set(val *TreeMapSizeBy) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTreeMapSizeBy) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTreeMapSizeBy) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTreeMapSizeBy initializes the struct as if Set has been called. +func NewNullableTreeMapSizeBy(val *TreeMapSizeBy) *NullableTreeMapSizeBy { + return &NullableTreeMapSizeBy{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTreeMapSizeBy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTreeMapSizeBy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_tree_map_widget_definition.go b/api/v1/datadog/model_tree_map_widget_definition.go new file mode 100644 index 00000000000..e0ff448966f --- /dev/null +++ b/api/v1/datadog/model_tree_map_widget_definition.go @@ -0,0 +1,427 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TreeMapWidgetDefinition The treemap visualization enables you to display hierarchical and nested data. It is well suited for queries that describe part-whole relationships, such as resource usage by availability zone, data center, or team. +type TreeMapWidgetDefinition struct { + // (deprecated) The attribute formerly used to determine color in the widget. + // Deprecated + ColorBy *TreeMapColorBy `json:"color_by,omitempty"` + // List of custom links. + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + // (deprecated) The attribute formerly used to group elements in the widget. + // Deprecated + GroupBy *TreeMapGroupBy `json:"group_by,omitempty"` + // List of treemap widget requests. + Requests []TreeMapWidgetRequest `json:"requests"` + // (deprecated) The attribute formerly used to determine size in the widget. + // Deprecated + SizeBy *TreeMapSizeBy `json:"size_by,omitempty"` + // Time setting for the widget. + Time *WidgetTime `json:"time,omitempty"` + // Title of your widget. + Title *string `json:"title,omitempty"` + // Type of the treemap widget. + Type TreeMapWidgetDefinitionType `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{} +} + +// NewTreeMapWidgetDefinition instantiates a new TreeMapWidgetDefinition 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 NewTreeMapWidgetDefinition(requests []TreeMapWidgetRequest, typeVar TreeMapWidgetDefinitionType) *TreeMapWidgetDefinition { + this := TreeMapWidgetDefinition{} + var colorBy TreeMapColorBy = TREEMAPCOLORBY_USER + this.ColorBy = &colorBy + this.Requests = requests + this.Type = typeVar + return &this +} + +// NewTreeMapWidgetDefinitionWithDefaults instantiates a new TreeMapWidgetDefinition 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 NewTreeMapWidgetDefinitionWithDefaults() *TreeMapWidgetDefinition { + this := TreeMapWidgetDefinition{} + var colorBy TreeMapColorBy = TREEMAPCOLORBY_USER + this.ColorBy = &colorBy + var typeVar TreeMapWidgetDefinitionType = TREEMAPWIDGETDEFINITIONTYPE_TREEMAP + this.Type = typeVar + return &this +} + +// GetColorBy returns the ColorBy field value if set, zero value otherwise. +// Deprecated +func (o *TreeMapWidgetDefinition) GetColorBy() TreeMapColorBy { + if o == nil || o.ColorBy == nil { + var ret TreeMapColorBy + return ret + } + return *o.ColorBy +} + +// GetColorByOk returns a tuple with the ColorBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *TreeMapWidgetDefinition) GetColorByOk() (*TreeMapColorBy, bool) { + if o == nil || o.ColorBy == nil { + return nil, false + } + return o.ColorBy, true +} + +// HasColorBy returns a boolean if a field has been set. +func (o *TreeMapWidgetDefinition) HasColorBy() bool { + if o != nil && o.ColorBy != nil { + return true + } + + return false +} + +// SetColorBy gets a reference to the given TreeMapColorBy and assigns it to the ColorBy field. +// Deprecated +func (o *TreeMapWidgetDefinition) SetColorBy(v TreeMapColorBy) { + o.ColorBy = &v +} + +// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise. +func (o *TreeMapWidgetDefinition) GetCustomLinks() []WidgetCustomLink { + if o == nil || o.CustomLinks == nil { + var ret []WidgetCustomLink + return ret + } + return o.CustomLinks +} + +// GetCustomLinksOk returns a tuple with the CustomLinks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetDefinition) GetCustomLinksOk() (*[]WidgetCustomLink, bool) { + if o == nil || o.CustomLinks == nil { + return nil, false + } + return &o.CustomLinks, true +} + +// HasCustomLinks returns a boolean if a field has been set. +func (o *TreeMapWidgetDefinition) HasCustomLinks() bool { + if o != nil && o.CustomLinks != nil { + return true + } + + return false +} + +// SetCustomLinks gets a reference to the given []WidgetCustomLink and assigns it to the CustomLinks field. +func (o *TreeMapWidgetDefinition) SetCustomLinks(v []WidgetCustomLink) { + o.CustomLinks = v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +// Deprecated +func (o *TreeMapWidgetDefinition) GetGroupBy() TreeMapGroupBy { + if o == nil || o.GroupBy == nil { + var ret TreeMapGroupBy + return ret + } + return *o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *TreeMapWidgetDefinition) GetGroupByOk() (*TreeMapGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *TreeMapWidgetDefinition) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given TreeMapGroupBy and assigns it to the GroupBy field. +// Deprecated +func (o *TreeMapWidgetDefinition) SetGroupBy(v TreeMapGroupBy) { + o.GroupBy = &v +} + +// GetRequests returns the Requests field value. +func (o *TreeMapWidgetDefinition) GetRequests() []TreeMapWidgetRequest { + if o == nil { + var ret []TreeMapWidgetRequest + return ret + } + return o.Requests +} + +// GetRequestsOk returns a tuple with the Requests field value +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetDefinition) GetRequestsOk() (*[]TreeMapWidgetRequest, bool) { + if o == nil { + return nil, false + } + return &o.Requests, true +} + +// SetRequests sets field value. +func (o *TreeMapWidgetDefinition) SetRequests(v []TreeMapWidgetRequest) { + o.Requests = v +} + +// GetSizeBy returns the SizeBy field value if set, zero value otherwise. +// Deprecated +func (o *TreeMapWidgetDefinition) GetSizeBy() TreeMapSizeBy { + if o == nil || o.SizeBy == nil { + var ret TreeMapSizeBy + return ret + } + return *o.SizeBy +} + +// GetSizeByOk returns a tuple with the SizeBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *TreeMapWidgetDefinition) GetSizeByOk() (*TreeMapSizeBy, bool) { + if o == nil || o.SizeBy == nil { + return nil, false + } + return o.SizeBy, true +} + +// HasSizeBy returns a boolean if a field has been set. +func (o *TreeMapWidgetDefinition) HasSizeBy() bool { + if o != nil && o.SizeBy != nil { + return true + } + + return false +} + +// SetSizeBy gets a reference to the given TreeMapSizeBy and assigns it to the SizeBy field. +// Deprecated +func (o *TreeMapWidgetDefinition) SetSizeBy(v TreeMapSizeBy) { + o.SizeBy = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *TreeMapWidgetDefinition) GetTime() WidgetTime { + if o == nil || o.Time == nil { + var ret WidgetTime + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetDefinition) GetTimeOk() (*WidgetTime, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *TreeMapWidgetDefinition) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given WidgetTime and assigns it to the Time field. +func (o *TreeMapWidgetDefinition) SetTime(v WidgetTime) { + o.Time = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *TreeMapWidgetDefinition) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetDefinition) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *TreeMapWidgetDefinition) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *TreeMapWidgetDefinition) SetTitle(v string) { + o.Title = &v +} + +// GetType returns the Type field value. +func (o *TreeMapWidgetDefinition) GetType() TreeMapWidgetDefinitionType { + if o == nil { + var ret TreeMapWidgetDefinitionType + 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 *TreeMapWidgetDefinition) GetTypeOk() (*TreeMapWidgetDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TreeMapWidgetDefinition) SetType(v TreeMapWidgetDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TreeMapWidgetDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ColorBy != nil { + toSerialize["color_by"] = o.ColorBy + } + if o.CustomLinks != nil { + toSerialize["custom_links"] = o.CustomLinks + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + toSerialize["requests"] = o.Requests + if o.SizeBy != nil { + toSerialize["size_by"] = o.SizeBy + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Requests *[]TreeMapWidgetRequest `json:"requests"` + Type *TreeMapWidgetDefinitionType `json:"type"` + }{} + all := struct { + ColorBy *TreeMapColorBy `json:"color_by,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + GroupBy *TreeMapGroupBy `json:"group_by,omitempty"` + Requests []TreeMapWidgetRequest `json:"requests"` + SizeBy *TreeMapSizeBy `json:"size_by,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + Type TreeMapWidgetDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Requests == nil { + return fmt.Errorf("Required field requests missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ColorBy; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.GroupBy; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.SizeBy; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ColorBy = all.ColorBy + o.CustomLinks = all.CustomLinks + o.GroupBy = all.GroupBy + o.Requests = all.Requests + o.SizeBy = all.SizeBy + if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Time = all.Time + o.Title = all.Title + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_tree_map_widget_definition_type.go b/api/v1/datadog/model_tree_map_widget_definition_type.go new file mode 100644 index 00000000000..e781d666e3a --- /dev/null +++ b/api/v1/datadog/model_tree_map_widget_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// TreeMapWidgetDefinitionType Type of the treemap widget. +type TreeMapWidgetDefinitionType string + +// List of TreeMapWidgetDefinitionType. +const ( + TREEMAPWIDGETDEFINITIONTYPE_TREEMAP TreeMapWidgetDefinitionType = "treemap" +) + +var allowedTreeMapWidgetDefinitionTypeEnumValues = []TreeMapWidgetDefinitionType{ + TREEMAPWIDGETDEFINITIONTYPE_TREEMAP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TreeMapWidgetDefinitionType) GetAllowedValues() []TreeMapWidgetDefinitionType { + return allowedTreeMapWidgetDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TreeMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TreeMapWidgetDefinitionType(value) + return nil +} + +// NewTreeMapWidgetDefinitionTypeFromValue returns a pointer to a valid TreeMapWidgetDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTreeMapWidgetDefinitionTypeFromValue(v string) (*TreeMapWidgetDefinitionType, error) { + ev := TreeMapWidgetDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TreeMapWidgetDefinitionType: valid values are %v", v, allowedTreeMapWidgetDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TreeMapWidgetDefinitionType) IsValid() bool { + for _, existing := range allowedTreeMapWidgetDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TreeMapWidgetDefinitionType value. +func (v TreeMapWidgetDefinitionType) Ptr() *TreeMapWidgetDefinitionType { + return &v +} + +// NullableTreeMapWidgetDefinitionType handles when a null is used for TreeMapWidgetDefinitionType. +type NullableTreeMapWidgetDefinitionType struct { + value *TreeMapWidgetDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableTreeMapWidgetDefinitionType) Get() *TreeMapWidgetDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableTreeMapWidgetDefinitionType) Set(val *TreeMapWidgetDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableTreeMapWidgetDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableTreeMapWidgetDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableTreeMapWidgetDefinitionType initializes the struct as if Set has been called. +func NewNullableTreeMapWidgetDefinitionType(val *TreeMapWidgetDefinitionType) *NullableTreeMapWidgetDefinitionType { + return &NullableTreeMapWidgetDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableTreeMapWidgetDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableTreeMapWidgetDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_tree_map_widget_request.go b/api/v1/datadog/model_tree_map_widget_request.go new file mode 100644 index 00000000000..efec5c03329 --- /dev/null +++ b/api/v1/datadog/model_tree_map_widget_request.go @@ -0,0 +1,227 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// TreeMapWidgetRequest An updated treemap widget. +type TreeMapWidgetRequest struct { + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` + // The widget metrics query. + Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Timeseries or Scalar response. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,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{} +} + +// NewTreeMapWidgetRequest instantiates a new TreeMapWidgetRequest 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 NewTreeMapWidgetRequest() *TreeMapWidgetRequest { + this := TreeMapWidgetRequest{} + return &this +} + +// NewTreeMapWidgetRequestWithDefaults instantiates a new TreeMapWidgetRequest 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 NewTreeMapWidgetRequestWithDefaults() *TreeMapWidgetRequest { + this := TreeMapWidgetRequest{} + return &this +} + +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *TreeMapWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *TreeMapWidgetRequest) HasFormulas() bool { + if o != nil && o.Formulas != nil { + return true + } + + return false +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *TreeMapWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + +// GetQ returns the Q field value if set, zero value otherwise. +func (o *TreeMapWidgetRequest) GetQ() string { + if o == nil || o.Q == nil { + var ret string + return ret + } + return *o.Q +} + +// GetQOk returns a tuple with the Q field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetRequest) GetQOk() (*string, bool) { + if o == nil || o.Q == nil { + return nil, false + } + return o.Q, true +} + +// HasQ returns a boolean if a field has been set. +func (o *TreeMapWidgetRequest) HasQ() bool { + if o != nil && o.Q != nil { + return true + } + + return false +} + +// SetQ gets a reference to the given string and assigns it to the Q field. +func (o *TreeMapWidgetRequest) SetQ(v string) { + o.Q = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *TreeMapWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *TreeMapWidgetRequest) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *TreeMapWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *TreeMapWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TreeMapWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *TreeMapWidgetRequest) HasResponseFormat() bool { + if o != nil && o.ResponseFormat != nil { + return true + } + + return false +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *TreeMapWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TreeMapWidgetRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } + if o.Q != nil { + toSerialize["q"] = o.Q + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TreeMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Formulas []WidgetFormula `json:"formulas,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ResponseFormat; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Formulas = all.Formulas + o.Q = all.Q + o.Queries = all.Queries + o.ResponseFormat = all.ResponseFormat + return nil +} diff --git a/api/v1/datadog/model_usage_analyzed_logs_hour.go b/api/v1/datadog/model_usage_analyzed_logs_hour.go new file mode 100644 index 00000000000..59daa4a5207 --- /dev/null +++ b/api/v1/datadog/model_usage_analyzed_logs_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageAnalyzedLogsHour The number of analyzed logs for each hour for a given organization. +type UsageAnalyzedLogsHour struct { + // Contains the number of analyzed logs. + AnalyzedLogs *int64 `json:"analyzed_logs,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageAnalyzedLogsHour instantiates a new UsageAnalyzedLogsHour 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 NewUsageAnalyzedLogsHour() *UsageAnalyzedLogsHour { + this := UsageAnalyzedLogsHour{} + return &this +} + +// NewUsageAnalyzedLogsHourWithDefaults instantiates a new UsageAnalyzedLogsHour 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 NewUsageAnalyzedLogsHourWithDefaults() *UsageAnalyzedLogsHour { + this := UsageAnalyzedLogsHour{} + return &this +} + +// GetAnalyzedLogs returns the AnalyzedLogs field value if set, zero value otherwise. +func (o *UsageAnalyzedLogsHour) GetAnalyzedLogs() int64 { + if o == nil || o.AnalyzedLogs == nil { + var ret int64 + return ret + } + return *o.AnalyzedLogs +} + +// GetAnalyzedLogsOk returns a tuple with the AnalyzedLogs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAnalyzedLogsHour) GetAnalyzedLogsOk() (*int64, bool) { + if o == nil || o.AnalyzedLogs == nil { + return nil, false + } + return o.AnalyzedLogs, true +} + +// HasAnalyzedLogs returns a boolean if a field has been set. +func (o *UsageAnalyzedLogsHour) HasAnalyzedLogs() bool { + if o != nil && o.AnalyzedLogs != nil { + return true + } + + return false +} + +// SetAnalyzedLogs gets a reference to the given int64 and assigns it to the AnalyzedLogs field. +func (o *UsageAnalyzedLogsHour) SetAnalyzedLogs(v int64) { + o.AnalyzedLogs = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageAnalyzedLogsHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAnalyzedLogsHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageAnalyzedLogsHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageAnalyzedLogsHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageAnalyzedLogsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAnalyzedLogsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageAnalyzedLogsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageAnalyzedLogsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageAnalyzedLogsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAnalyzedLogsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageAnalyzedLogsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageAnalyzedLogsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAnalyzedLogsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AnalyzedLogs != nil { + toSerialize["analyzed_logs"] = o.AnalyzedLogs + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAnalyzedLogsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AnalyzedLogs *int64 `json:"analyzed_logs,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AnalyzedLogs = all.AnalyzedLogs + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_analyzed_logs_response.go b/api/v1/datadog/model_usage_analyzed_logs_response.go new file mode 100644 index 00000000000..77c1e3e5f4a --- /dev/null +++ b/api/v1/datadog/model_usage_analyzed_logs_response.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 datadog + +import ( + "encoding/json" +) + +// UsageAnalyzedLogsResponse A response containing the number of analyzed logs for each hour for a given organization. +type UsageAnalyzedLogsResponse struct { + // Get hourly usage for analyzed logs. + Usage []UsageAnalyzedLogsHour `json:"usage,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{} +} + +// NewUsageAnalyzedLogsResponse instantiates a new UsageAnalyzedLogsResponse 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 NewUsageAnalyzedLogsResponse() *UsageAnalyzedLogsResponse { + this := UsageAnalyzedLogsResponse{} + return &this +} + +// NewUsageAnalyzedLogsResponseWithDefaults instantiates a new UsageAnalyzedLogsResponse 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 NewUsageAnalyzedLogsResponseWithDefaults() *UsageAnalyzedLogsResponse { + this := UsageAnalyzedLogsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageAnalyzedLogsResponse) GetUsage() []UsageAnalyzedLogsHour { + if o == nil || o.Usage == nil { + var ret []UsageAnalyzedLogsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAnalyzedLogsResponse) GetUsageOk() (*[]UsageAnalyzedLogsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageAnalyzedLogsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageAnalyzedLogsHour and assigns it to the Usage field. +func (o *UsageAnalyzedLogsResponse) SetUsage(v []UsageAnalyzedLogsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAnalyzedLogsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAnalyzedLogsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageAnalyzedLogsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_attribution_aggregates_body.go b/api/v1/datadog/model_usage_attribution_aggregates_body.go new file mode 100644 index 00000000000..b1856602de1 --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_aggregates_body.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageAttributionAggregatesBody The object containing the aggregates. +type UsageAttributionAggregatesBody struct { + // The aggregate type. + AggType *string `json:"agg_type,omitempty"` + // The field. + Field *string `json:"field,omitempty"` + // The value for a given field. + Value *float64 `json:"value,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{} +} + +// NewUsageAttributionAggregatesBody instantiates a new UsageAttributionAggregatesBody 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 NewUsageAttributionAggregatesBody() *UsageAttributionAggregatesBody { + this := UsageAttributionAggregatesBody{} + return &this +} + +// NewUsageAttributionAggregatesBodyWithDefaults instantiates a new UsageAttributionAggregatesBody 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 NewUsageAttributionAggregatesBodyWithDefaults() *UsageAttributionAggregatesBody { + this := UsageAttributionAggregatesBody{} + return &this +} + +// GetAggType returns the AggType field value if set, zero value otherwise. +func (o *UsageAttributionAggregatesBody) GetAggType() string { + if o == nil || o.AggType == nil { + var ret string + return ret + } + return *o.AggType +} + +// GetAggTypeOk returns a tuple with the AggType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionAggregatesBody) GetAggTypeOk() (*string, bool) { + if o == nil || o.AggType == nil { + return nil, false + } + return o.AggType, true +} + +// HasAggType returns a boolean if a field has been set. +func (o *UsageAttributionAggregatesBody) HasAggType() bool { + if o != nil && o.AggType != nil { + return true + } + + return false +} + +// SetAggType gets a reference to the given string and assigns it to the AggType field. +func (o *UsageAttributionAggregatesBody) SetAggType(v string) { + o.AggType = &v +} + +// GetField returns the Field field value if set, zero value otherwise. +func (o *UsageAttributionAggregatesBody) GetField() string { + if o == nil || o.Field == nil { + var ret string + return ret + } + return *o.Field +} + +// GetFieldOk returns a tuple with the Field field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionAggregatesBody) GetFieldOk() (*string, bool) { + if o == nil || o.Field == nil { + return nil, false + } + return o.Field, true +} + +// HasField returns a boolean if a field has been set. +func (o *UsageAttributionAggregatesBody) HasField() bool { + if o != nil && o.Field != nil { + return true + } + + return false +} + +// SetField gets a reference to the given string and assigns it to the Field field. +func (o *UsageAttributionAggregatesBody) SetField(v string) { + o.Field = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *UsageAttributionAggregatesBody) GetValue() float64 { + if o == nil || o.Value == nil { + var ret float64 + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionAggregatesBody) GetValueOk() (*float64, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *UsageAttributionAggregatesBody) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given float64 and assigns it to the Value field. +func (o *UsageAttributionAggregatesBody) SetValue(v float64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAttributionAggregatesBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AggType != nil { + toSerialize["agg_type"] = o.AggType + } + if o.Field != nil { + toSerialize["field"] = o.Field + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAttributionAggregatesBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AggType *string `json:"agg_type,omitempty"` + Field *string `json:"field,omitempty"` + Value *float64 `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AggType = all.AggType + o.Field = all.Field + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_usage_attribution_body.go b/api/v1/datadog/model_usage_attribution_body.go new file mode 100644 index 00000000000..912f0b0b37f --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_body.go @@ -0,0 +1,352 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageAttributionBody Usage Summary by tag for a given organization. +type UsageAttributionBody struct { + // Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM]. + Month *time.Time `json:"month,omitempty"` + // The name of the organization. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The source of the usage attribution tag configuration and the selected tags in the format `::://////`. + TagConfigSource *string `json:"tag_config_source,omitempty"` + // Tag keys and values. + // + // A `null` value here means that the requested tag breakdown cannot be applied because it does not match the [tags + // configured for usage attribution](https://docs.datadoghq.com/account_management/billing/usage_attribution/#getting-started). + // In this scenario the API returns the total usage, not broken down by tags. + Tags map[string][]string `json:"tags,omitempty"` + // Shows the the most recent hour in the current months for all organizations for which all usages were calculated. + UpdatedAt *string `json:"updated_at,omitempty"` + // Fields in Usage Summary by tag(s). + Values *UsageAttributionValues `json:"values,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{} +} + +// NewUsageAttributionBody instantiates a new UsageAttributionBody 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 NewUsageAttributionBody() *UsageAttributionBody { + this := UsageAttributionBody{} + return &this +} + +// NewUsageAttributionBodyWithDefaults instantiates a new UsageAttributionBody 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 NewUsageAttributionBodyWithDefaults() *UsageAttributionBody { + this := UsageAttributionBody{} + return &this +} + +// GetMonth returns the Month field value if set, zero value otherwise. +func (o *UsageAttributionBody) GetMonth() time.Time { + if o == nil || o.Month == nil { + var ret time.Time + return ret + } + return *o.Month +} + +// GetMonthOk returns a tuple with the Month field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionBody) GetMonthOk() (*time.Time, bool) { + if o == nil || o.Month == nil { + return nil, false + } + return o.Month, true +} + +// HasMonth returns a boolean if a field has been set. +func (o *UsageAttributionBody) HasMonth() bool { + if o != nil && o.Month != nil { + return true + } + + return false +} + +// SetMonth gets a reference to the given time.Time and assigns it to the Month field. +func (o *UsageAttributionBody) SetMonth(v time.Time) { + o.Month = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageAttributionBody) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionBody) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageAttributionBody) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageAttributionBody) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageAttributionBody) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionBody) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageAttributionBody) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageAttributionBody) SetPublicId(v string) { + o.PublicId = &v +} + +// GetTagConfigSource returns the TagConfigSource field value if set, zero value otherwise. +func (o *UsageAttributionBody) GetTagConfigSource() string { + if o == nil || o.TagConfigSource == nil { + var ret string + return ret + } + return *o.TagConfigSource +} + +// GetTagConfigSourceOk returns a tuple with the TagConfigSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionBody) GetTagConfigSourceOk() (*string, bool) { + if o == nil || o.TagConfigSource == nil { + return nil, false + } + return o.TagConfigSource, true +} + +// HasTagConfigSource returns a boolean if a field has been set. +func (o *UsageAttributionBody) HasTagConfigSource() bool { + if o != nil && o.TagConfigSource != nil { + return true + } + + return false +} + +// SetTagConfigSource gets a reference to the given string and assigns it to the TagConfigSource field. +func (o *UsageAttributionBody) SetTagConfigSource(v string) { + o.TagConfigSource = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *UsageAttributionBody) 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 *UsageAttributionBody) 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 *UsageAttributionBody) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given map[string][]string and assigns it to the Tags field. +func (o *UsageAttributionBody) SetTags(v map[string][]string) { + o.Tags = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *UsageAttributionBody) GetUpdatedAt() string { + if o == nil || o.UpdatedAt == nil { + var ret string + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionBody) GetUpdatedAtOk() (*string, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *UsageAttributionBody) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. +func (o *UsageAttributionBody) SetUpdatedAt(v string) { + o.UpdatedAt = &v +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *UsageAttributionBody) GetValues() UsageAttributionValues { + if o == nil || o.Values == nil { + var ret UsageAttributionValues + return ret + } + return *o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionBody) GetValuesOk() (*UsageAttributionValues, bool) { + if o == nil || o.Values == nil { + return nil, false + } + return o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *UsageAttributionBody) HasValues() bool { + if o != nil && o.Values != nil { + return true + } + + return false +} + +// SetValues gets a reference to the given UsageAttributionValues and assigns it to the Values field. +func (o *UsageAttributionBody) SetValues(v UsageAttributionValues) { + o.Values = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAttributionBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Month != nil { + if o.Month.Nanosecond() == 0 { + toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.TagConfigSource != nil { + toSerialize["tag_config_source"] = o.TagConfigSource + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.UpdatedAt != nil { + toSerialize["updated_at"] = o.UpdatedAt + } + if o.Values != nil { + toSerialize["values"] = o.Values + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Month *time.Time `json:"month,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + TagConfigSource *string `json:"tag_config_source,omitempty"` + Tags map[string][]string `json:"tags,omitempty"` + UpdatedAt *string `json:"updated_at,omitempty"` + Values *UsageAttributionValues `json:"values,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Month = all.Month + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.TagConfigSource = all.TagConfigSource + o.Tags = all.Tags + o.UpdatedAt = all.UpdatedAt + if all.Values != nil && all.Values.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Values = all.Values + return nil +} diff --git a/api/v1/datadog/model_usage_attribution_metadata.go b/api/v1/datadog/model_usage_attribution_metadata.go new file mode 100644 index 00000000000..c89ef16e828 --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_metadata.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 datadog + +import ( + "encoding/json" +) + +// UsageAttributionMetadata The object containing document metadata. +type UsageAttributionMetadata struct { + // An array of available aggregates. + Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` + // The metadata for the current pagination. + Pagination *UsageAttributionPagination `json:"pagination,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{} +} + +// NewUsageAttributionMetadata instantiates a new UsageAttributionMetadata 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 NewUsageAttributionMetadata() *UsageAttributionMetadata { + this := UsageAttributionMetadata{} + return &this +} + +// NewUsageAttributionMetadataWithDefaults instantiates a new UsageAttributionMetadata 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 NewUsageAttributionMetadataWithDefaults() *UsageAttributionMetadata { + this := UsageAttributionMetadata{} + return &this +} + +// GetAggregates returns the Aggregates field value if set, zero value otherwise. +func (o *UsageAttributionMetadata) GetAggregates() []UsageAttributionAggregatesBody { + if o == nil || o.Aggregates == nil { + var ret []UsageAttributionAggregatesBody + return ret + } + return o.Aggregates +} + +// GetAggregatesOk returns a tuple with the Aggregates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionMetadata) GetAggregatesOk() (*[]UsageAttributionAggregatesBody, bool) { + if o == nil || o.Aggregates == nil { + return nil, false + } + return &o.Aggregates, true +} + +// HasAggregates returns a boolean if a field has been set. +func (o *UsageAttributionMetadata) HasAggregates() bool { + if o != nil && o.Aggregates != nil { + return true + } + + return false +} + +// SetAggregates gets a reference to the given []UsageAttributionAggregatesBody and assigns it to the Aggregates field. +func (o *UsageAttributionMetadata) SetAggregates(v []UsageAttributionAggregatesBody) { + o.Aggregates = v +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *UsageAttributionMetadata) GetPagination() UsageAttributionPagination { + if o == nil || o.Pagination == nil { + var ret UsageAttributionPagination + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionMetadata) GetPaginationOk() (*UsageAttributionPagination, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *UsageAttributionMetadata) HasPagination() bool { + if o != nil && o.Pagination != nil { + return true + } + + return false +} + +// SetPagination gets a reference to the given UsageAttributionPagination and assigns it to the Pagination field. +func (o *UsageAttributionMetadata) SetPagination(v UsageAttributionPagination) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAttributionMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregates != nil { + toSerialize["aggregates"] = o.Aggregates + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` + Pagination *UsageAttributionPagination `json:"pagination,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregates = all.Aggregates + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pagination = all.Pagination + return nil +} diff --git a/api/v1/datadog/model_usage_attribution_pagination.go b/api/v1/datadog/model_usage_attribution_pagination.go new file mode 100644 index 00000000000..f4f28a87af3 --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_pagination.go @@ -0,0 +1,258 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageAttributionPagination The metadata for the current pagination. +type UsageAttributionPagination struct { + // Maximum amount of records to be returned. + Limit *int64 `json:"limit,omitempty"` + // Records to be skipped before beginning to return. + Offset *int64 `json:"offset,omitempty"` + // Direction to sort by. + SortDirection *string `json:"sort_direction,omitempty"` + // Field to sort by. + SortName *string `json:"sort_name,omitempty"` + // Total number of records. + TotalNumberOfRecords *int64 `json:"total_number_of_records,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{} +} + +// NewUsageAttributionPagination instantiates a new UsageAttributionPagination 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 NewUsageAttributionPagination() *UsageAttributionPagination { + this := UsageAttributionPagination{} + return &this +} + +// NewUsageAttributionPaginationWithDefaults instantiates a new UsageAttributionPagination 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 NewUsageAttributionPaginationWithDefaults() *UsageAttributionPagination { + this := UsageAttributionPagination{} + return &this +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *UsageAttributionPagination) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionPagination) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *UsageAttributionPagination) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *UsageAttributionPagination) SetLimit(v int64) { + o.Limit = &v +} + +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *UsageAttributionPagination) GetOffset() int64 { + if o == nil || o.Offset == nil { + var ret int64 + return ret + } + return *o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionPagination) GetOffsetOk() (*int64, bool) { + if o == nil || o.Offset == nil { + return nil, false + } + return o.Offset, true +} + +// HasOffset returns a boolean if a field has been set. +func (o *UsageAttributionPagination) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// SetOffset gets a reference to the given int64 and assigns it to the Offset field. +func (o *UsageAttributionPagination) SetOffset(v int64) { + o.Offset = &v +} + +// GetSortDirection returns the SortDirection field value if set, zero value otherwise. +func (o *UsageAttributionPagination) GetSortDirection() string { + if o == nil || o.SortDirection == nil { + var ret string + return ret + } + return *o.SortDirection +} + +// GetSortDirectionOk returns a tuple with the SortDirection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionPagination) GetSortDirectionOk() (*string, bool) { + if o == nil || o.SortDirection == nil { + return nil, false + } + return o.SortDirection, true +} + +// HasSortDirection returns a boolean if a field has been set. +func (o *UsageAttributionPagination) HasSortDirection() bool { + if o != nil && o.SortDirection != nil { + return true + } + + return false +} + +// SetSortDirection gets a reference to the given string and assigns it to the SortDirection field. +func (o *UsageAttributionPagination) SetSortDirection(v string) { + o.SortDirection = &v +} + +// GetSortName returns the SortName field value if set, zero value otherwise. +func (o *UsageAttributionPagination) GetSortName() string { + if o == nil || o.SortName == nil { + var ret string + return ret + } + return *o.SortName +} + +// GetSortNameOk returns a tuple with the SortName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionPagination) GetSortNameOk() (*string, bool) { + if o == nil || o.SortName == nil { + return nil, false + } + return o.SortName, true +} + +// HasSortName returns a boolean if a field has been set. +func (o *UsageAttributionPagination) HasSortName() bool { + if o != nil && o.SortName != nil { + return true + } + + return false +} + +// SetSortName gets a reference to the given string and assigns it to the SortName field. +func (o *UsageAttributionPagination) SetSortName(v string) { + o.SortName = &v +} + +// GetTotalNumberOfRecords returns the TotalNumberOfRecords field value if set, zero value otherwise. +func (o *UsageAttributionPagination) GetTotalNumberOfRecords() int64 { + if o == nil || o.TotalNumberOfRecords == nil { + var ret int64 + return ret + } + return *o.TotalNumberOfRecords +} + +// GetTotalNumberOfRecordsOk returns a tuple with the TotalNumberOfRecords field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionPagination) GetTotalNumberOfRecordsOk() (*int64, bool) { + if o == nil || o.TotalNumberOfRecords == nil { + return nil, false + } + return o.TotalNumberOfRecords, true +} + +// HasTotalNumberOfRecords returns a boolean if a field has been set. +func (o *UsageAttributionPagination) HasTotalNumberOfRecords() bool { + if o != nil && o.TotalNumberOfRecords != nil { + return true + } + + return false +} + +// SetTotalNumberOfRecords gets a reference to the given int64 and assigns it to the TotalNumberOfRecords field. +func (o *UsageAttributionPagination) SetTotalNumberOfRecords(v int64) { + o.TotalNumberOfRecords = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAttributionPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + if o.SortDirection != nil { + toSerialize["sort_direction"] = o.SortDirection + } + if o.SortName != nil { + toSerialize["sort_name"] = o.SortName + } + if o.TotalNumberOfRecords != nil { + toSerialize["total_number_of_records"] = o.TotalNumberOfRecords + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Limit *int64 `json:"limit,omitempty"` + Offset *int64 `json:"offset,omitempty"` + SortDirection *string `json:"sort_direction,omitempty"` + SortName *string `json:"sort_name,omitempty"` + TotalNumberOfRecords *int64 `json:"total_number_of_records,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Limit = all.Limit + o.Offset = all.Offset + o.SortDirection = all.SortDirection + o.SortName = all.SortName + o.TotalNumberOfRecords = all.TotalNumberOfRecords + return nil +} diff --git a/api/v1/datadog/model_usage_attribution_response.go b/api/v1/datadog/model_usage_attribution_response.go new file mode 100644 index 00000000000..27f9afd9c05 --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_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 datadog + +import ( + "encoding/json" +) + +// UsageAttributionResponse Response containing the Usage Summary by tag(s). +type UsageAttributionResponse struct { + // The object containing document metadata. + Metadata *UsageAttributionMetadata `json:"metadata,omitempty"` + // Get usage summary by tag(s). + Usage []UsageAttributionBody `json:"usage,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{} +} + +// NewUsageAttributionResponse instantiates a new UsageAttributionResponse 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 NewUsageAttributionResponse() *UsageAttributionResponse { + this := UsageAttributionResponse{} + return &this +} + +// NewUsageAttributionResponseWithDefaults instantiates a new UsageAttributionResponse 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 NewUsageAttributionResponseWithDefaults() *UsageAttributionResponse { + this := UsageAttributionResponse{} + return &this +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *UsageAttributionResponse) GetMetadata() UsageAttributionMetadata { + if o == nil || o.Metadata == nil { + var ret UsageAttributionMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionResponse) GetMetadataOk() (*UsageAttributionMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *UsageAttributionResponse) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given UsageAttributionMetadata and assigns it to the Metadata field. +func (o *UsageAttributionResponse) SetMetadata(v UsageAttributionMetadata) { + o.Metadata = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageAttributionResponse) GetUsage() []UsageAttributionBody { + if o == nil || o.Usage == nil { + var ret []UsageAttributionBody + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionResponse) GetUsageOk() (*[]UsageAttributionBody, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageAttributionResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageAttributionBody and assigns it to the Usage field. +func (o *UsageAttributionResponse) SetUsage(v []UsageAttributionBody) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAttributionResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Metadata *UsageAttributionMetadata `json:"metadata,omitempty"` + Usage []UsageAttributionBody `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_attribution_sort.go b/api/v1/datadog/model_usage_attribution_sort.go new file mode 100644 index 00000000000..58ac757a77b --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_sort.go @@ -0,0 +1,161 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsageAttributionSort The field to sort by. +type UsageAttributionSort string + +// List of UsageAttributionSort. +const ( + USAGEATTRIBUTIONSORT_API_PERCENTAGE UsageAttributionSort = "api_percentage" + USAGEATTRIBUTIONSORT_SNMP_USAGE UsageAttributionSort = "snmp_usage" + USAGEATTRIBUTIONSORT_APM_HOST_USAGE UsageAttributionSort = "apm_host_usage" + USAGEATTRIBUTIONSORT_API_USAGE UsageAttributionSort = "api_usage" + USAGEATTRIBUTIONSORT_APPSEC_USAGE UsageAttributionSort = "appsec_usage" + USAGEATTRIBUTIONSORT_APPSEC_PERCENTAGE UsageAttributionSort = "appsec_percentage" + USAGEATTRIBUTIONSORT_CONTAINER_USAGE UsageAttributionSort = "container_usage" + USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_PERCENTAGE UsageAttributionSort = "custom_timeseries_percentage" + USAGEATTRIBUTIONSORT_CONTAINER_PERCENTAGE UsageAttributionSort = "container_percentage" + USAGEATTRIBUTIONSORT_APM_HOST_PERCENTAGE UsageAttributionSort = "apm_host_percentage" + USAGEATTRIBUTIONSORT_NPM_HOST_PERCENTAGE UsageAttributionSort = "npm_host_percentage" + USAGEATTRIBUTIONSORT_BROWSER_PERCENTAGE UsageAttributionSort = "browser_percentage" + USAGEATTRIBUTIONSORT_BROWSER_USAGE UsageAttributionSort = "browser_usage" + USAGEATTRIBUTIONSORT_INFRA_HOST_PERCENTAGE UsageAttributionSort = "infra_host_percentage" + USAGEATTRIBUTIONSORT_SNMP_PERCENTAGE UsageAttributionSort = "snmp_percentage" + USAGEATTRIBUTIONSORT_NPM_HOST_USAGE UsageAttributionSort = "npm_host_usage" + USAGEATTRIBUTIONSORT_INFRA_HOST_USAGE UsageAttributionSort = "infra_host_usage" + USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_USAGE UsageAttributionSort = "custom_timeseries_usage" + USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_USAGE UsageAttributionSort = "lambda_functions_usage" + USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_PERCENTAGE UsageAttributionSort = "lambda_functions_percentage" + USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_USAGE UsageAttributionSort = "lambda_invocations_usage" + USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_PERCENTAGE UsageAttributionSort = "lambda_invocations_percentage" + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_USAGE UsageAttributionSort = "estimated_indexed_logs_usage" + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_PERCENTAGE UsageAttributionSort = "estimated_indexed_logs_percentage" + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_USAGE UsageAttributionSort = "estimated_indexed_spans_usage" + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_PERCENTAGE UsageAttributionSort = "estimated_indexed_spans_percentage" + USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_USAGE UsageAttributionSort = "estimated_ingested_spans_usage" + USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_PERCENTAGE UsageAttributionSort = "estimated_ingested_spans_percentage" +) + +var allowedUsageAttributionSortEnumValues = []UsageAttributionSort{ + USAGEATTRIBUTIONSORT_API_PERCENTAGE, + USAGEATTRIBUTIONSORT_SNMP_USAGE, + USAGEATTRIBUTIONSORT_APM_HOST_USAGE, + USAGEATTRIBUTIONSORT_API_USAGE, + USAGEATTRIBUTIONSORT_APPSEC_USAGE, + USAGEATTRIBUTIONSORT_APPSEC_PERCENTAGE, + USAGEATTRIBUTIONSORT_CONTAINER_USAGE, + USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_PERCENTAGE, + USAGEATTRIBUTIONSORT_CONTAINER_PERCENTAGE, + USAGEATTRIBUTIONSORT_APM_HOST_PERCENTAGE, + USAGEATTRIBUTIONSORT_NPM_HOST_PERCENTAGE, + USAGEATTRIBUTIONSORT_BROWSER_PERCENTAGE, + USAGEATTRIBUTIONSORT_BROWSER_USAGE, + USAGEATTRIBUTIONSORT_INFRA_HOST_PERCENTAGE, + USAGEATTRIBUTIONSORT_SNMP_PERCENTAGE, + USAGEATTRIBUTIONSORT_NPM_HOST_USAGE, + USAGEATTRIBUTIONSORT_INFRA_HOST_USAGE, + USAGEATTRIBUTIONSORT_CUSTOM_TIMESERIES_USAGE, + USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_USAGE, + USAGEATTRIBUTIONSORT_LAMBDA_FUNCTIONS_PERCENTAGE, + USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_USAGE, + USAGEATTRIBUTIONSORT_LAMBDA_INVOCATIONS_PERCENTAGE, + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_USAGE, + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_LOGS_PERCENTAGE, + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_USAGE, + USAGEATTRIBUTIONSORT_ESTIMATED_INDEXED_SPANS_PERCENTAGE, + USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_USAGE, + USAGEATTRIBUTIONSORT_ESTIMATED_INGESTED_SPANS_PERCENTAGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsageAttributionSort) GetAllowedValues() []UsageAttributionSort { + return allowedUsageAttributionSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsageAttributionSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsageAttributionSort(value) + return nil +} + +// NewUsageAttributionSortFromValue returns a pointer to a valid UsageAttributionSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsageAttributionSortFromValue(v string) (*UsageAttributionSort, error) { + ev := UsageAttributionSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsageAttributionSort: valid values are %v", v, allowedUsageAttributionSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsageAttributionSort) IsValid() bool { + for _, existing := range allowedUsageAttributionSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsageAttributionSort value. +func (v UsageAttributionSort) Ptr() *UsageAttributionSort { + return &v +} + +// NullableUsageAttributionSort handles when a null is used for UsageAttributionSort. +type NullableUsageAttributionSort struct { + value *UsageAttributionSort + isSet bool +} + +// Get returns the associated value. +func (v NullableUsageAttributionSort) Get() *UsageAttributionSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsageAttributionSort) Set(val *UsageAttributionSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsageAttributionSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsageAttributionSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsageAttributionSort initializes the struct as if Set has been called. +func NewNullableUsageAttributionSort(val *UsageAttributionSort) *NullableUsageAttributionSort { + return &NullableUsageAttributionSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsageAttributionSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsageAttributionSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_usage_attribution_supported_metrics.go b/api/v1/datadog/model_usage_attribution_supported_metrics.go new file mode 100644 index 00000000000..f2130b1025d --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_supported_metrics.go @@ -0,0 +1,183 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsageAttributionSupportedMetrics Supported fields for usage attribution requests (valid requests contain one or more metrics, or `*` for all). +type UsageAttributionSupportedMetrics string + +// List of UsageAttributionSupportedMetrics. +const ( + USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE UsageAttributionSupportedMetrics = "custom_timeseries_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE UsageAttributionSupportedMetrics = "container_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE UsageAttributionSupportedMetrics = "snmp_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE UsageAttributionSupportedMetrics = "apm_host_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE UsageAttributionSupportedMetrics = "browser_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "npm_host_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE UsageAttributionSupportedMetrics = "infra_host_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE UsageAttributionSupportedMetrics = "custom_timeseries_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE UsageAttributionSupportedMetrics = "container_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE UsageAttributionSupportedMetrics = "api_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "apm_host_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "infra_host_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE UsageAttributionSupportedMetrics = "snmp_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE UsageAttributionSupportedMetrics = "browser_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE UsageAttributionSupportedMetrics = "api_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE UsageAttributionSupportedMetrics = "npm_host_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_USAGE UsageAttributionSupportedMetrics = "lambda_functions_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_PERCENTAGE UsageAttributionSupportedMetrics = "lambda_functions_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_USAGE UsageAttributionSupportedMetrics = "lambda_invocations_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_PERCENTAGE UsageAttributionSupportedMetrics = "lambda_invocations_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE UsageAttributionSupportedMetrics = "fargate_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE UsageAttributionSupportedMetrics = "fargate_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE UsageAttributionSupportedMetrics = "profiled_host_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE UsageAttributionSupportedMetrics = "profiled_host_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE UsageAttributionSupportedMetrics = "profiled_container_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE UsageAttributionSupportedMetrics = "profiled_container_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE UsageAttributionSupportedMetrics = "dbm_hosts_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE UsageAttributionSupportedMetrics = "dbm_hosts_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE UsageAttributionSupportedMetrics = "dbm_queries_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE UsageAttributionSupportedMetrics = "dbm_queries_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE UsageAttributionSupportedMetrics = "estimated_indexed_logs_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE UsageAttributionSupportedMetrics = "estimated_indexed_logs_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE UsageAttributionSupportedMetrics = "appsec_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE UsageAttributionSupportedMetrics = "appsec_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE UsageAttributionSupportedMetrics = "estimated_indexed_spans_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE UsageAttributionSupportedMetrics = "estimated_indexed_spans_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE UsageAttributionSupportedMetrics = "estimated_ingested_spans_usage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE UsageAttributionSupportedMetrics = "estimated_ingested_spans_percentage" + USAGEATTRIBUTIONSUPPORTEDMETRICS_ALL UsageAttributionSupportedMetrics = "*" +) + +var allowedUsageAttributionSupportedMetricsEnumValues = []UsageAttributionSupportedMetrics{ + USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_CUSTOM_TIMESERIES_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_CONTAINER_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_API_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_APM_HOST_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_INFRA_HOST_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_SNMP_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_BROWSER_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_API_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_NPM_HOST_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_FUNCTIONS_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_LAMBDA_INVOCATIONS_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_FARGATE_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_HOST_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_PROFILED_CONTAINER_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_HOSTS_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_DBM_QUERIES_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_LOGS_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_APPSEC_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INDEXED_SPANS_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_USAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_ESTIMATED_INGESTED_SPANS_PERCENTAGE, + USAGEATTRIBUTIONSUPPORTEDMETRICS_ALL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsageAttributionSupportedMetrics) GetAllowedValues() []UsageAttributionSupportedMetrics { + return allowedUsageAttributionSupportedMetricsEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsageAttributionSupportedMetrics(value) + return nil +} + +// NewUsageAttributionSupportedMetricsFromValue returns a pointer to a valid UsageAttributionSupportedMetrics +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsageAttributionSupportedMetricsFromValue(v string) (*UsageAttributionSupportedMetrics, error) { + ev := UsageAttributionSupportedMetrics(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsageAttributionSupportedMetrics: valid values are %v", v, allowedUsageAttributionSupportedMetricsEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsageAttributionSupportedMetrics) IsValid() bool { + for _, existing := range allowedUsageAttributionSupportedMetricsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsageAttributionSupportedMetrics value. +func (v UsageAttributionSupportedMetrics) Ptr() *UsageAttributionSupportedMetrics { + return &v +} + +// NullableUsageAttributionSupportedMetrics handles when a null is used for UsageAttributionSupportedMetrics. +type NullableUsageAttributionSupportedMetrics struct { + value *UsageAttributionSupportedMetrics + isSet bool +} + +// Get returns the associated value. +func (v NullableUsageAttributionSupportedMetrics) Get() *UsageAttributionSupportedMetrics { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsageAttributionSupportedMetrics) Set(val *UsageAttributionSupportedMetrics) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsageAttributionSupportedMetrics) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsageAttributionSupportedMetrics) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsageAttributionSupportedMetrics initializes the struct as if Set has been called. +func NewNullableUsageAttributionSupportedMetrics(val *UsageAttributionSupportedMetrics) *NullableUsageAttributionSupportedMetrics { + return &NullableUsageAttributionSupportedMetrics{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsageAttributionSupportedMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsageAttributionSupportedMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_usage_attribution_values.go b/api/v1/datadog/model_usage_attribution_values.go new file mode 100644 index 00000000000..0f9bfe0a271 --- /dev/null +++ b/api/v1/datadog/model_usage_attribution_values.go @@ -0,0 +1,1779 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageAttributionValues Fields in Usage Summary by tag(s). +type UsageAttributionValues struct { + // The percentage of synthetic API test usage by tag(s). + ApiPercentage *float64 `json:"api_percentage,omitempty"` + // The synthetic API test usage by tag(s). + ApiUsage *float64 `json:"api_usage,omitempty"` + // The percentage of APM host usage by tag(s). + ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` + // The APM host usage by tag(s). + ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` + // The percentage of Application Security Monitoring host usage by tag(s). + AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` + // The Application Security Monitoring host usage by tag(s). + AppsecUsage *float64 `json:"appsec_usage,omitempty"` + // The percentage of synthetic browser test usage by tag(s). + BrowserPercentage *float64 `json:"browser_percentage,omitempty"` + // The synthetic browser test usage by tag(s). + BrowserUsage *float64 `json:"browser_usage,omitempty"` + // The percentage of container usage by tag(s). + ContainerPercentage *float64 `json:"container_percentage,omitempty"` + // The container usage by tag(s). + ContainerUsage *float64 `json:"container_usage,omitempty"` + // The percentage of Cloud Security Posture Management container usage by tag(s) + CspmContainerPercentage *float64 `json:"cspm_container_percentage,omitempty"` + // The Cloud Security Posture Management container usage by tag(s) + CspmContainerUsage *float64 `json:"cspm_container_usage,omitempty"` + // The percentage of Cloud Security Posture Management host usage by tag(s) + CspmHostPercentage *float64 `json:"cspm_host_percentage,omitempty"` + // The Cloud Security Posture Management host usage by tag(s) + CspmHostUsage *float64 `json:"cspm_host_usage,omitempty"` + // The percentage of custom metrics usage by tag(s). + CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` + // The custom metrics usage by tag(s). + CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` + // The percentage of Cloud Workload Security container usage by tag(s) + CwsContainerPercentage *float64 `json:"cws_container_percentage,omitempty"` + // The Cloud Workload Security container usage by tag(s) + CwsContainerUsage *float64 `json:"cws_container_usage,omitempty"` + // The percentage of Cloud Workload Security host usage by tag(s) + CwsHostPercentage *float64 `json:"cws_host_percentage,omitempty"` + // The Cloud Workload Security host usage by tag(s) + CwsHostUsage *float64 `json:"cws_host_usage,omitempty"` + // The percentage of Database Monitoring host usage by tag(s). + DbmHostsPercentage *float64 `json:"dbm_hosts_percentage,omitempty"` + // The Database Monitoring host usage by tag(s). + DbmHostsUsage *float64 `json:"dbm_hosts_usage,omitempty"` + // The percentage of Database Monitoring normalized queries usage by tag(s). + DbmQueriesPercentage *float64 `json:"dbm_queries_percentage,omitempty"` + // The Database Monitoring normalized queries usage by tag(s). + DbmQueriesUsage *float64 `json:"dbm_queries_usage,omitempty"` + // The percentage of estimated live indexed logs usage by tag(s). Note this field is in private beta. + EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` + // The estimated live indexed logs usage by tag(s). Note this field is in private beta. + EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` + // The percentage of estimated indexed spans usage by tag(s). Note this field is in private beta. + EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` + // The estimated indexed spans usage by tag(s). Note this field is in private beta. + EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` + // The percentage of estimated ingested spans usage by tag(s). Note this field is in private beta. + EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` + // The estimated ingested spans usage by tag(s). Note this field is in private beta. + EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` + // The percentage of infrastructure host usage by tag(s). + InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` + // The infrastructure host usage by tag(s). + InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` + // The percentage of Lambda function usage by tag(s). + LambdaFunctionsPercentage *float64 `json:"lambda_functions_percentage,omitempty"` + // The Lambda function usage by tag(s). + LambdaFunctionsUsage *float64 `json:"lambda_functions_usage,omitempty"` + // The percentage of Lambda invocation usage by tag(s). + LambdaInvocationsPercentage *float64 `json:"lambda_invocations_percentage,omitempty"` + // The Lambda invocation usage by tag(s). + LambdaInvocationsUsage *float64 `json:"lambda_invocations_usage,omitempty"` + // The percentage of network host usage by tag(s). + NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` + // The network host usage by tag(s). + NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` + // The percentage of profiled containers usage by tag(s). + ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` + // The profiled container usage by tag(s). + ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` + // The percentage of profiled hosts usage by tag(s). + ProfiledHostsPercentage *float64 `json:"profiled_hosts_percentage,omitempty"` + // The profiled host usage by tag(s). + ProfiledHostsUsage *float64 `json:"profiled_hosts_usage,omitempty"` + // The percentage of network device usage by tag(s). + SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` + // The network device usage by tag(s). + SnmpUsage *float64 `json:"snmp_usage,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{} +} + +// NewUsageAttributionValues instantiates a new UsageAttributionValues 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 NewUsageAttributionValues() *UsageAttributionValues { + this := UsageAttributionValues{} + return &this +} + +// NewUsageAttributionValuesWithDefaults instantiates a new UsageAttributionValues 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 NewUsageAttributionValuesWithDefaults() *UsageAttributionValues { + this := UsageAttributionValues{} + return &this +} + +// GetApiPercentage returns the ApiPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetApiPercentage() float64 { + if o == nil || o.ApiPercentage == nil { + var ret float64 + return ret + } + return *o.ApiPercentage +} + +// GetApiPercentageOk returns a tuple with the ApiPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetApiPercentageOk() (*float64, bool) { + if o == nil || o.ApiPercentage == nil { + return nil, false + } + return o.ApiPercentage, true +} + +// HasApiPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasApiPercentage() bool { + if o != nil && o.ApiPercentage != nil { + return true + } + + return false +} + +// SetApiPercentage gets a reference to the given float64 and assigns it to the ApiPercentage field. +func (o *UsageAttributionValues) SetApiPercentage(v float64) { + o.ApiPercentage = &v +} + +// GetApiUsage returns the ApiUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetApiUsage() float64 { + if o == nil || o.ApiUsage == nil { + var ret float64 + return ret + } + return *o.ApiUsage +} + +// GetApiUsageOk returns a tuple with the ApiUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetApiUsageOk() (*float64, bool) { + if o == nil || o.ApiUsage == nil { + return nil, false + } + return o.ApiUsage, true +} + +// HasApiUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasApiUsage() bool { + if o != nil && o.ApiUsage != nil { + return true + } + + return false +} + +// SetApiUsage gets a reference to the given float64 and assigns it to the ApiUsage field. +func (o *UsageAttributionValues) SetApiUsage(v float64) { + o.ApiUsage = &v +} + +// GetApmHostPercentage returns the ApmHostPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetApmHostPercentage() float64 { + if o == nil || o.ApmHostPercentage == nil { + var ret float64 + return ret + } + return *o.ApmHostPercentage +} + +// GetApmHostPercentageOk returns a tuple with the ApmHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetApmHostPercentageOk() (*float64, bool) { + if o == nil || o.ApmHostPercentage == nil { + return nil, false + } + return o.ApmHostPercentage, true +} + +// HasApmHostPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasApmHostPercentage() bool { + if o != nil && o.ApmHostPercentage != nil { + return true + } + + return false +} + +// SetApmHostPercentage gets a reference to the given float64 and assigns it to the ApmHostPercentage field. +func (o *UsageAttributionValues) SetApmHostPercentage(v float64) { + o.ApmHostPercentage = &v +} + +// GetApmHostUsage returns the ApmHostUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetApmHostUsage() float64 { + if o == nil || o.ApmHostUsage == nil { + var ret float64 + return ret + } + return *o.ApmHostUsage +} + +// GetApmHostUsageOk returns a tuple with the ApmHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetApmHostUsageOk() (*float64, bool) { + if o == nil || o.ApmHostUsage == nil { + return nil, false + } + return o.ApmHostUsage, true +} + +// HasApmHostUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasApmHostUsage() bool { + if o != nil && o.ApmHostUsage != nil { + return true + } + + return false +} + +// SetApmHostUsage gets a reference to the given float64 and assigns it to the ApmHostUsage field. +func (o *UsageAttributionValues) SetApmHostUsage(v float64) { + o.ApmHostUsage = &v +} + +// GetAppsecPercentage returns the AppsecPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetAppsecPercentage() float64 { + if o == nil || o.AppsecPercentage == nil { + var ret float64 + return ret + } + return *o.AppsecPercentage +} + +// GetAppsecPercentageOk returns a tuple with the AppsecPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetAppsecPercentageOk() (*float64, bool) { + if o == nil || o.AppsecPercentage == nil { + return nil, false + } + return o.AppsecPercentage, true +} + +// HasAppsecPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasAppsecPercentage() bool { + if o != nil && o.AppsecPercentage != nil { + return true + } + + return false +} + +// SetAppsecPercentage gets a reference to the given float64 and assigns it to the AppsecPercentage field. +func (o *UsageAttributionValues) SetAppsecPercentage(v float64) { + o.AppsecPercentage = &v +} + +// GetAppsecUsage returns the AppsecUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetAppsecUsage() float64 { + if o == nil || o.AppsecUsage == nil { + var ret float64 + return ret + } + return *o.AppsecUsage +} + +// GetAppsecUsageOk returns a tuple with the AppsecUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetAppsecUsageOk() (*float64, bool) { + if o == nil || o.AppsecUsage == nil { + return nil, false + } + return o.AppsecUsage, true +} + +// HasAppsecUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasAppsecUsage() bool { + if o != nil && o.AppsecUsage != nil { + return true + } + + return false +} + +// SetAppsecUsage gets a reference to the given float64 and assigns it to the AppsecUsage field. +func (o *UsageAttributionValues) SetAppsecUsage(v float64) { + o.AppsecUsage = &v +} + +// GetBrowserPercentage returns the BrowserPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetBrowserPercentage() float64 { + if o == nil || o.BrowserPercentage == nil { + var ret float64 + return ret + } + return *o.BrowserPercentage +} + +// GetBrowserPercentageOk returns a tuple with the BrowserPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetBrowserPercentageOk() (*float64, bool) { + if o == nil || o.BrowserPercentage == nil { + return nil, false + } + return o.BrowserPercentage, true +} + +// HasBrowserPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasBrowserPercentage() bool { + if o != nil && o.BrowserPercentage != nil { + return true + } + + return false +} + +// SetBrowserPercentage gets a reference to the given float64 and assigns it to the BrowserPercentage field. +func (o *UsageAttributionValues) SetBrowserPercentage(v float64) { + o.BrowserPercentage = &v +} + +// GetBrowserUsage returns the BrowserUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetBrowserUsage() float64 { + if o == nil || o.BrowserUsage == nil { + var ret float64 + return ret + } + return *o.BrowserUsage +} + +// GetBrowserUsageOk returns a tuple with the BrowserUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetBrowserUsageOk() (*float64, bool) { + if o == nil || o.BrowserUsage == nil { + return nil, false + } + return o.BrowserUsage, true +} + +// HasBrowserUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasBrowserUsage() bool { + if o != nil && o.BrowserUsage != nil { + return true + } + + return false +} + +// SetBrowserUsage gets a reference to the given float64 and assigns it to the BrowserUsage field. +func (o *UsageAttributionValues) SetBrowserUsage(v float64) { + o.BrowserUsage = &v +} + +// GetContainerPercentage returns the ContainerPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetContainerPercentage() float64 { + if o == nil || o.ContainerPercentage == nil { + var ret float64 + return ret + } + return *o.ContainerPercentage +} + +// GetContainerPercentageOk returns a tuple with the ContainerPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetContainerPercentageOk() (*float64, bool) { + if o == nil || o.ContainerPercentage == nil { + return nil, false + } + return o.ContainerPercentage, true +} + +// HasContainerPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasContainerPercentage() bool { + if o != nil && o.ContainerPercentage != nil { + return true + } + + return false +} + +// SetContainerPercentage gets a reference to the given float64 and assigns it to the ContainerPercentage field. +func (o *UsageAttributionValues) SetContainerPercentage(v float64) { + o.ContainerPercentage = &v +} + +// GetContainerUsage returns the ContainerUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetContainerUsage() float64 { + if o == nil || o.ContainerUsage == nil { + var ret float64 + return ret + } + return *o.ContainerUsage +} + +// GetContainerUsageOk returns a tuple with the ContainerUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetContainerUsageOk() (*float64, bool) { + if o == nil || o.ContainerUsage == nil { + return nil, false + } + return o.ContainerUsage, true +} + +// HasContainerUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasContainerUsage() bool { + if o != nil && o.ContainerUsage != nil { + return true + } + + return false +} + +// SetContainerUsage gets a reference to the given float64 and assigns it to the ContainerUsage field. +func (o *UsageAttributionValues) SetContainerUsage(v float64) { + o.ContainerUsage = &v +} + +// GetCspmContainerPercentage returns the CspmContainerPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCspmContainerPercentage() float64 { + if o == nil || o.CspmContainerPercentage == nil { + var ret float64 + return ret + } + return *o.CspmContainerPercentage +} + +// GetCspmContainerPercentageOk returns a tuple with the CspmContainerPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCspmContainerPercentageOk() (*float64, bool) { + if o == nil || o.CspmContainerPercentage == nil { + return nil, false + } + return o.CspmContainerPercentage, true +} + +// HasCspmContainerPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCspmContainerPercentage() bool { + if o != nil && o.CspmContainerPercentage != nil { + return true + } + + return false +} + +// SetCspmContainerPercentage gets a reference to the given float64 and assigns it to the CspmContainerPercentage field. +func (o *UsageAttributionValues) SetCspmContainerPercentage(v float64) { + o.CspmContainerPercentage = &v +} + +// GetCspmContainerUsage returns the CspmContainerUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCspmContainerUsage() float64 { + if o == nil || o.CspmContainerUsage == nil { + var ret float64 + return ret + } + return *o.CspmContainerUsage +} + +// GetCspmContainerUsageOk returns a tuple with the CspmContainerUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCspmContainerUsageOk() (*float64, bool) { + if o == nil || o.CspmContainerUsage == nil { + return nil, false + } + return o.CspmContainerUsage, true +} + +// HasCspmContainerUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCspmContainerUsage() bool { + if o != nil && o.CspmContainerUsage != nil { + return true + } + + return false +} + +// SetCspmContainerUsage gets a reference to the given float64 and assigns it to the CspmContainerUsage field. +func (o *UsageAttributionValues) SetCspmContainerUsage(v float64) { + o.CspmContainerUsage = &v +} + +// GetCspmHostPercentage returns the CspmHostPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCspmHostPercentage() float64 { + if o == nil || o.CspmHostPercentage == nil { + var ret float64 + return ret + } + return *o.CspmHostPercentage +} + +// GetCspmHostPercentageOk returns a tuple with the CspmHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCspmHostPercentageOk() (*float64, bool) { + if o == nil || o.CspmHostPercentage == nil { + return nil, false + } + return o.CspmHostPercentage, true +} + +// HasCspmHostPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCspmHostPercentage() bool { + if o != nil && o.CspmHostPercentage != nil { + return true + } + + return false +} + +// SetCspmHostPercentage gets a reference to the given float64 and assigns it to the CspmHostPercentage field. +func (o *UsageAttributionValues) SetCspmHostPercentage(v float64) { + o.CspmHostPercentage = &v +} + +// GetCspmHostUsage returns the CspmHostUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCspmHostUsage() float64 { + if o == nil || o.CspmHostUsage == nil { + var ret float64 + return ret + } + return *o.CspmHostUsage +} + +// GetCspmHostUsageOk returns a tuple with the CspmHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCspmHostUsageOk() (*float64, bool) { + if o == nil || o.CspmHostUsage == nil { + return nil, false + } + return o.CspmHostUsage, true +} + +// HasCspmHostUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCspmHostUsage() bool { + if o != nil && o.CspmHostUsage != nil { + return true + } + + return false +} + +// SetCspmHostUsage gets a reference to the given float64 and assigns it to the CspmHostUsage field. +func (o *UsageAttributionValues) SetCspmHostUsage(v float64) { + o.CspmHostUsage = &v +} + +// GetCustomTimeseriesPercentage returns the CustomTimeseriesPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCustomTimeseriesPercentage() float64 { + if o == nil || o.CustomTimeseriesPercentage == nil { + var ret float64 + return ret + } + return *o.CustomTimeseriesPercentage +} + +// GetCustomTimeseriesPercentageOk returns a tuple with the CustomTimeseriesPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCustomTimeseriesPercentageOk() (*float64, bool) { + if o == nil || o.CustomTimeseriesPercentage == nil { + return nil, false + } + return o.CustomTimeseriesPercentage, true +} + +// HasCustomTimeseriesPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCustomTimeseriesPercentage() bool { + if o != nil && o.CustomTimeseriesPercentage != nil { + return true + } + + return false +} + +// SetCustomTimeseriesPercentage gets a reference to the given float64 and assigns it to the CustomTimeseriesPercentage field. +func (o *UsageAttributionValues) SetCustomTimeseriesPercentage(v float64) { + o.CustomTimeseriesPercentage = &v +} + +// GetCustomTimeseriesUsage returns the CustomTimeseriesUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCustomTimeseriesUsage() float64 { + if o == nil || o.CustomTimeseriesUsage == nil { + var ret float64 + return ret + } + return *o.CustomTimeseriesUsage +} + +// GetCustomTimeseriesUsageOk returns a tuple with the CustomTimeseriesUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCustomTimeseriesUsageOk() (*float64, bool) { + if o == nil || o.CustomTimeseriesUsage == nil { + return nil, false + } + return o.CustomTimeseriesUsage, true +} + +// HasCustomTimeseriesUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCustomTimeseriesUsage() bool { + if o != nil && o.CustomTimeseriesUsage != nil { + return true + } + + return false +} + +// SetCustomTimeseriesUsage gets a reference to the given float64 and assigns it to the CustomTimeseriesUsage field. +func (o *UsageAttributionValues) SetCustomTimeseriesUsage(v float64) { + o.CustomTimeseriesUsage = &v +} + +// GetCwsContainerPercentage returns the CwsContainerPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCwsContainerPercentage() float64 { + if o == nil || o.CwsContainerPercentage == nil { + var ret float64 + return ret + } + return *o.CwsContainerPercentage +} + +// GetCwsContainerPercentageOk returns a tuple with the CwsContainerPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCwsContainerPercentageOk() (*float64, bool) { + if o == nil || o.CwsContainerPercentage == nil { + return nil, false + } + return o.CwsContainerPercentage, true +} + +// HasCwsContainerPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCwsContainerPercentage() bool { + if o != nil && o.CwsContainerPercentage != nil { + return true + } + + return false +} + +// SetCwsContainerPercentage gets a reference to the given float64 and assigns it to the CwsContainerPercentage field. +func (o *UsageAttributionValues) SetCwsContainerPercentage(v float64) { + o.CwsContainerPercentage = &v +} + +// GetCwsContainerUsage returns the CwsContainerUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCwsContainerUsage() float64 { + if o == nil || o.CwsContainerUsage == nil { + var ret float64 + return ret + } + return *o.CwsContainerUsage +} + +// GetCwsContainerUsageOk returns a tuple with the CwsContainerUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCwsContainerUsageOk() (*float64, bool) { + if o == nil || o.CwsContainerUsage == nil { + return nil, false + } + return o.CwsContainerUsage, true +} + +// HasCwsContainerUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCwsContainerUsage() bool { + if o != nil && o.CwsContainerUsage != nil { + return true + } + + return false +} + +// SetCwsContainerUsage gets a reference to the given float64 and assigns it to the CwsContainerUsage field. +func (o *UsageAttributionValues) SetCwsContainerUsage(v float64) { + o.CwsContainerUsage = &v +} + +// GetCwsHostPercentage returns the CwsHostPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCwsHostPercentage() float64 { + if o == nil || o.CwsHostPercentage == nil { + var ret float64 + return ret + } + return *o.CwsHostPercentage +} + +// GetCwsHostPercentageOk returns a tuple with the CwsHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCwsHostPercentageOk() (*float64, bool) { + if o == nil || o.CwsHostPercentage == nil { + return nil, false + } + return o.CwsHostPercentage, true +} + +// HasCwsHostPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCwsHostPercentage() bool { + if o != nil && o.CwsHostPercentage != nil { + return true + } + + return false +} + +// SetCwsHostPercentage gets a reference to the given float64 and assigns it to the CwsHostPercentage field. +func (o *UsageAttributionValues) SetCwsHostPercentage(v float64) { + o.CwsHostPercentage = &v +} + +// GetCwsHostUsage returns the CwsHostUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetCwsHostUsage() float64 { + if o == nil || o.CwsHostUsage == nil { + var ret float64 + return ret + } + return *o.CwsHostUsage +} + +// GetCwsHostUsageOk returns a tuple with the CwsHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetCwsHostUsageOk() (*float64, bool) { + if o == nil || o.CwsHostUsage == nil { + return nil, false + } + return o.CwsHostUsage, true +} + +// HasCwsHostUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasCwsHostUsage() bool { + if o != nil && o.CwsHostUsage != nil { + return true + } + + return false +} + +// SetCwsHostUsage gets a reference to the given float64 and assigns it to the CwsHostUsage field. +func (o *UsageAttributionValues) SetCwsHostUsage(v float64) { + o.CwsHostUsage = &v +} + +// GetDbmHostsPercentage returns the DbmHostsPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetDbmHostsPercentage() float64 { + if o == nil || o.DbmHostsPercentage == nil { + var ret float64 + return ret + } + return *o.DbmHostsPercentage +} + +// GetDbmHostsPercentageOk returns a tuple with the DbmHostsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetDbmHostsPercentageOk() (*float64, bool) { + if o == nil || o.DbmHostsPercentage == nil { + return nil, false + } + return o.DbmHostsPercentage, true +} + +// HasDbmHostsPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasDbmHostsPercentage() bool { + if o != nil && o.DbmHostsPercentage != nil { + return true + } + + return false +} + +// SetDbmHostsPercentage gets a reference to the given float64 and assigns it to the DbmHostsPercentage field. +func (o *UsageAttributionValues) SetDbmHostsPercentage(v float64) { + o.DbmHostsPercentage = &v +} + +// GetDbmHostsUsage returns the DbmHostsUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetDbmHostsUsage() float64 { + if o == nil || o.DbmHostsUsage == nil { + var ret float64 + return ret + } + return *o.DbmHostsUsage +} + +// GetDbmHostsUsageOk returns a tuple with the DbmHostsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetDbmHostsUsageOk() (*float64, bool) { + if o == nil || o.DbmHostsUsage == nil { + return nil, false + } + return o.DbmHostsUsage, true +} + +// HasDbmHostsUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasDbmHostsUsage() bool { + if o != nil && o.DbmHostsUsage != nil { + return true + } + + return false +} + +// SetDbmHostsUsage gets a reference to the given float64 and assigns it to the DbmHostsUsage field. +func (o *UsageAttributionValues) SetDbmHostsUsage(v float64) { + o.DbmHostsUsage = &v +} + +// GetDbmQueriesPercentage returns the DbmQueriesPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetDbmQueriesPercentage() float64 { + if o == nil || o.DbmQueriesPercentage == nil { + var ret float64 + return ret + } + return *o.DbmQueriesPercentage +} + +// GetDbmQueriesPercentageOk returns a tuple with the DbmQueriesPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetDbmQueriesPercentageOk() (*float64, bool) { + if o == nil || o.DbmQueriesPercentage == nil { + return nil, false + } + return o.DbmQueriesPercentage, true +} + +// HasDbmQueriesPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasDbmQueriesPercentage() bool { + if o != nil && o.DbmQueriesPercentage != nil { + return true + } + + return false +} + +// SetDbmQueriesPercentage gets a reference to the given float64 and assigns it to the DbmQueriesPercentage field. +func (o *UsageAttributionValues) SetDbmQueriesPercentage(v float64) { + o.DbmQueriesPercentage = &v +} + +// GetDbmQueriesUsage returns the DbmQueriesUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetDbmQueriesUsage() float64 { + if o == nil || o.DbmQueriesUsage == nil { + var ret float64 + return ret + } + return *o.DbmQueriesUsage +} + +// GetDbmQueriesUsageOk returns a tuple with the DbmQueriesUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetDbmQueriesUsageOk() (*float64, bool) { + if o == nil || o.DbmQueriesUsage == nil { + return nil, false + } + return o.DbmQueriesUsage, true +} + +// HasDbmQueriesUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasDbmQueriesUsage() bool { + if o != nil && o.DbmQueriesUsage != nil { + return true + } + + return false +} + +// SetDbmQueriesUsage gets a reference to the given float64 and assigns it to the DbmQueriesUsage field. +func (o *UsageAttributionValues) SetDbmQueriesUsage(v float64) { + o.DbmQueriesUsage = &v +} + +// GetEstimatedIndexedLogsPercentage returns the EstimatedIndexedLogsPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetEstimatedIndexedLogsPercentage() float64 { + if o == nil || o.EstimatedIndexedLogsPercentage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedLogsPercentage +} + +// GetEstimatedIndexedLogsPercentageOk returns a tuple with the EstimatedIndexedLogsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetEstimatedIndexedLogsPercentageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedLogsPercentage == nil { + return nil, false + } + return o.EstimatedIndexedLogsPercentage, true +} + +// HasEstimatedIndexedLogsPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasEstimatedIndexedLogsPercentage() bool { + if o != nil && o.EstimatedIndexedLogsPercentage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedLogsPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsPercentage field. +func (o *UsageAttributionValues) SetEstimatedIndexedLogsPercentage(v float64) { + o.EstimatedIndexedLogsPercentage = &v +} + +// GetEstimatedIndexedLogsUsage returns the EstimatedIndexedLogsUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetEstimatedIndexedLogsUsage() float64 { + if o == nil || o.EstimatedIndexedLogsUsage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedLogsUsage +} + +// GetEstimatedIndexedLogsUsageOk returns a tuple with the EstimatedIndexedLogsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetEstimatedIndexedLogsUsageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedLogsUsage == nil { + return nil, false + } + return o.EstimatedIndexedLogsUsage, true +} + +// HasEstimatedIndexedLogsUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasEstimatedIndexedLogsUsage() bool { + if o != nil && o.EstimatedIndexedLogsUsage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedLogsUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedLogsUsage field. +func (o *UsageAttributionValues) SetEstimatedIndexedLogsUsage(v float64) { + o.EstimatedIndexedLogsUsage = &v +} + +// GetEstimatedIndexedSpansPercentage returns the EstimatedIndexedSpansPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetEstimatedIndexedSpansPercentage() float64 { + if o == nil || o.EstimatedIndexedSpansPercentage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedSpansPercentage +} + +// GetEstimatedIndexedSpansPercentageOk returns a tuple with the EstimatedIndexedSpansPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetEstimatedIndexedSpansPercentageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedSpansPercentage == nil { + return nil, false + } + return o.EstimatedIndexedSpansPercentage, true +} + +// HasEstimatedIndexedSpansPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasEstimatedIndexedSpansPercentage() bool { + if o != nil && o.EstimatedIndexedSpansPercentage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansPercentage field. +func (o *UsageAttributionValues) SetEstimatedIndexedSpansPercentage(v float64) { + o.EstimatedIndexedSpansPercentage = &v +} + +// GetEstimatedIndexedSpansUsage returns the EstimatedIndexedSpansUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetEstimatedIndexedSpansUsage() float64 { + if o == nil || o.EstimatedIndexedSpansUsage == nil { + var ret float64 + return ret + } + return *o.EstimatedIndexedSpansUsage +} + +// GetEstimatedIndexedSpansUsageOk returns a tuple with the EstimatedIndexedSpansUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetEstimatedIndexedSpansUsageOk() (*float64, bool) { + if o == nil || o.EstimatedIndexedSpansUsage == nil { + return nil, false + } + return o.EstimatedIndexedSpansUsage, true +} + +// HasEstimatedIndexedSpansUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasEstimatedIndexedSpansUsage() bool { + if o != nil && o.EstimatedIndexedSpansUsage != nil { + return true + } + + return false +} + +// SetEstimatedIndexedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIndexedSpansUsage field. +func (o *UsageAttributionValues) SetEstimatedIndexedSpansUsage(v float64) { + o.EstimatedIndexedSpansUsage = &v +} + +// GetEstimatedIngestedSpansPercentage returns the EstimatedIngestedSpansPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetEstimatedIngestedSpansPercentage() float64 { + if o == nil || o.EstimatedIngestedSpansPercentage == nil { + var ret float64 + return ret + } + return *o.EstimatedIngestedSpansPercentage +} + +// GetEstimatedIngestedSpansPercentageOk returns a tuple with the EstimatedIngestedSpansPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetEstimatedIngestedSpansPercentageOk() (*float64, bool) { + if o == nil || o.EstimatedIngestedSpansPercentage == nil { + return nil, false + } + return o.EstimatedIngestedSpansPercentage, true +} + +// HasEstimatedIngestedSpansPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasEstimatedIngestedSpansPercentage() bool { + if o != nil && o.EstimatedIngestedSpansPercentage != nil { + return true + } + + return false +} + +// SetEstimatedIngestedSpansPercentage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansPercentage field. +func (o *UsageAttributionValues) SetEstimatedIngestedSpansPercentage(v float64) { + o.EstimatedIngestedSpansPercentage = &v +} + +// GetEstimatedIngestedSpansUsage returns the EstimatedIngestedSpansUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetEstimatedIngestedSpansUsage() float64 { + if o == nil || o.EstimatedIngestedSpansUsage == nil { + var ret float64 + return ret + } + return *o.EstimatedIngestedSpansUsage +} + +// GetEstimatedIngestedSpansUsageOk returns a tuple with the EstimatedIngestedSpansUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetEstimatedIngestedSpansUsageOk() (*float64, bool) { + if o == nil || o.EstimatedIngestedSpansUsage == nil { + return nil, false + } + return o.EstimatedIngestedSpansUsage, true +} + +// HasEstimatedIngestedSpansUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasEstimatedIngestedSpansUsage() bool { + if o != nil && o.EstimatedIngestedSpansUsage != nil { + return true + } + + return false +} + +// SetEstimatedIngestedSpansUsage gets a reference to the given float64 and assigns it to the EstimatedIngestedSpansUsage field. +func (o *UsageAttributionValues) SetEstimatedIngestedSpansUsage(v float64) { + o.EstimatedIngestedSpansUsage = &v +} + +// GetInfraHostPercentage returns the InfraHostPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetInfraHostPercentage() float64 { + if o == nil || o.InfraHostPercentage == nil { + var ret float64 + return ret + } + return *o.InfraHostPercentage +} + +// GetInfraHostPercentageOk returns a tuple with the InfraHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetInfraHostPercentageOk() (*float64, bool) { + if o == nil || o.InfraHostPercentage == nil { + return nil, false + } + return o.InfraHostPercentage, true +} + +// HasInfraHostPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasInfraHostPercentage() bool { + if o != nil && o.InfraHostPercentage != nil { + return true + } + + return false +} + +// SetInfraHostPercentage gets a reference to the given float64 and assigns it to the InfraHostPercentage field. +func (o *UsageAttributionValues) SetInfraHostPercentage(v float64) { + o.InfraHostPercentage = &v +} + +// GetInfraHostUsage returns the InfraHostUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetInfraHostUsage() float64 { + if o == nil || o.InfraHostUsage == nil { + var ret float64 + return ret + } + return *o.InfraHostUsage +} + +// GetInfraHostUsageOk returns a tuple with the InfraHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetInfraHostUsageOk() (*float64, bool) { + if o == nil || o.InfraHostUsage == nil { + return nil, false + } + return o.InfraHostUsage, true +} + +// HasInfraHostUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasInfraHostUsage() bool { + if o != nil && o.InfraHostUsage != nil { + return true + } + + return false +} + +// SetInfraHostUsage gets a reference to the given float64 and assigns it to the InfraHostUsage field. +func (o *UsageAttributionValues) SetInfraHostUsage(v float64) { + o.InfraHostUsage = &v +} + +// GetLambdaFunctionsPercentage returns the LambdaFunctionsPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetLambdaFunctionsPercentage() float64 { + if o == nil || o.LambdaFunctionsPercentage == nil { + var ret float64 + return ret + } + return *o.LambdaFunctionsPercentage +} + +// GetLambdaFunctionsPercentageOk returns a tuple with the LambdaFunctionsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetLambdaFunctionsPercentageOk() (*float64, bool) { + if o == nil || o.LambdaFunctionsPercentage == nil { + return nil, false + } + return o.LambdaFunctionsPercentage, true +} + +// HasLambdaFunctionsPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasLambdaFunctionsPercentage() bool { + if o != nil && o.LambdaFunctionsPercentage != nil { + return true + } + + return false +} + +// SetLambdaFunctionsPercentage gets a reference to the given float64 and assigns it to the LambdaFunctionsPercentage field. +func (o *UsageAttributionValues) SetLambdaFunctionsPercentage(v float64) { + o.LambdaFunctionsPercentage = &v +} + +// GetLambdaFunctionsUsage returns the LambdaFunctionsUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetLambdaFunctionsUsage() float64 { + if o == nil || o.LambdaFunctionsUsage == nil { + var ret float64 + return ret + } + return *o.LambdaFunctionsUsage +} + +// GetLambdaFunctionsUsageOk returns a tuple with the LambdaFunctionsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetLambdaFunctionsUsageOk() (*float64, bool) { + if o == nil || o.LambdaFunctionsUsage == nil { + return nil, false + } + return o.LambdaFunctionsUsage, true +} + +// HasLambdaFunctionsUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasLambdaFunctionsUsage() bool { + if o != nil && o.LambdaFunctionsUsage != nil { + return true + } + + return false +} + +// SetLambdaFunctionsUsage gets a reference to the given float64 and assigns it to the LambdaFunctionsUsage field. +func (o *UsageAttributionValues) SetLambdaFunctionsUsage(v float64) { + o.LambdaFunctionsUsage = &v +} + +// GetLambdaInvocationsPercentage returns the LambdaInvocationsPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetLambdaInvocationsPercentage() float64 { + if o == nil || o.LambdaInvocationsPercentage == nil { + var ret float64 + return ret + } + return *o.LambdaInvocationsPercentage +} + +// GetLambdaInvocationsPercentageOk returns a tuple with the LambdaInvocationsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetLambdaInvocationsPercentageOk() (*float64, bool) { + if o == nil || o.LambdaInvocationsPercentage == nil { + return nil, false + } + return o.LambdaInvocationsPercentage, true +} + +// HasLambdaInvocationsPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasLambdaInvocationsPercentage() bool { + if o != nil && o.LambdaInvocationsPercentage != nil { + return true + } + + return false +} + +// SetLambdaInvocationsPercentage gets a reference to the given float64 and assigns it to the LambdaInvocationsPercentage field. +func (o *UsageAttributionValues) SetLambdaInvocationsPercentage(v float64) { + o.LambdaInvocationsPercentage = &v +} + +// GetLambdaInvocationsUsage returns the LambdaInvocationsUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetLambdaInvocationsUsage() float64 { + if o == nil || o.LambdaInvocationsUsage == nil { + var ret float64 + return ret + } + return *o.LambdaInvocationsUsage +} + +// GetLambdaInvocationsUsageOk returns a tuple with the LambdaInvocationsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetLambdaInvocationsUsageOk() (*float64, bool) { + if o == nil || o.LambdaInvocationsUsage == nil { + return nil, false + } + return o.LambdaInvocationsUsage, true +} + +// HasLambdaInvocationsUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasLambdaInvocationsUsage() bool { + if o != nil && o.LambdaInvocationsUsage != nil { + return true + } + + return false +} + +// SetLambdaInvocationsUsage gets a reference to the given float64 and assigns it to the LambdaInvocationsUsage field. +func (o *UsageAttributionValues) SetLambdaInvocationsUsage(v float64) { + o.LambdaInvocationsUsage = &v +} + +// GetNpmHostPercentage returns the NpmHostPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetNpmHostPercentage() float64 { + if o == nil || o.NpmHostPercentage == nil { + var ret float64 + return ret + } + return *o.NpmHostPercentage +} + +// GetNpmHostPercentageOk returns a tuple with the NpmHostPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetNpmHostPercentageOk() (*float64, bool) { + if o == nil || o.NpmHostPercentage == nil { + return nil, false + } + return o.NpmHostPercentage, true +} + +// HasNpmHostPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasNpmHostPercentage() bool { + if o != nil && o.NpmHostPercentage != nil { + return true + } + + return false +} + +// SetNpmHostPercentage gets a reference to the given float64 and assigns it to the NpmHostPercentage field. +func (o *UsageAttributionValues) SetNpmHostPercentage(v float64) { + o.NpmHostPercentage = &v +} + +// GetNpmHostUsage returns the NpmHostUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetNpmHostUsage() float64 { + if o == nil || o.NpmHostUsage == nil { + var ret float64 + return ret + } + return *o.NpmHostUsage +} + +// GetNpmHostUsageOk returns a tuple with the NpmHostUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetNpmHostUsageOk() (*float64, bool) { + if o == nil || o.NpmHostUsage == nil { + return nil, false + } + return o.NpmHostUsage, true +} + +// HasNpmHostUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasNpmHostUsage() bool { + if o != nil && o.NpmHostUsage != nil { + return true + } + + return false +} + +// SetNpmHostUsage gets a reference to the given float64 and assigns it to the NpmHostUsage field. +func (o *UsageAttributionValues) SetNpmHostUsage(v float64) { + o.NpmHostUsage = &v +} + +// GetProfiledContainerPercentage returns the ProfiledContainerPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetProfiledContainerPercentage() float64 { + if o == nil || o.ProfiledContainerPercentage == nil { + var ret float64 + return ret + } + return *o.ProfiledContainerPercentage +} + +// GetProfiledContainerPercentageOk returns a tuple with the ProfiledContainerPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetProfiledContainerPercentageOk() (*float64, bool) { + if o == nil || o.ProfiledContainerPercentage == nil { + return nil, false + } + return o.ProfiledContainerPercentage, true +} + +// HasProfiledContainerPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasProfiledContainerPercentage() bool { + if o != nil && o.ProfiledContainerPercentage != nil { + return true + } + + return false +} + +// SetProfiledContainerPercentage gets a reference to the given float64 and assigns it to the ProfiledContainerPercentage field. +func (o *UsageAttributionValues) SetProfiledContainerPercentage(v float64) { + o.ProfiledContainerPercentage = &v +} + +// GetProfiledContainerUsage returns the ProfiledContainerUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetProfiledContainerUsage() float64 { + if o == nil || o.ProfiledContainerUsage == nil { + var ret float64 + return ret + } + return *o.ProfiledContainerUsage +} + +// GetProfiledContainerUsageOk returns a tuple with the ProfiledContainerUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetProfiledContainerUsageOk() (*float64, bool) { + if o == nil || o.ProfiledContainerUsage == nil { + return nil, false + } + return o.ProfiledContainerUsage, true +} + +// HasProfiledContainerUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasProfiledContainerUsage() bool { + if o != nil && o.ProfiledContainerUsage != nil { + return true + } + + return false +} + +// SetProfiledContainerUsage gets a reference to the given float64 and assigns it to the ProfiledContainerUsage field. +func (o *UsageAttributionValues) SetProfiledContainerUsage(v float64) { + o.ProfiledContainerUsage = &v +} + +// GetProfiledHostsPercentage returns the ProfiledHostsPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetProfiledHostsPercentage() float64 { + if o == nil || o.ProfiledHostsPercentage == nil { + var ret float64 + return ret + } + return *o.ProfiledHostsPercentage +} + +// GetProfiledHostsPercentageOk returns a tuple with the ProfiledHostsPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetProfiledHostsPercentageOk() (*float64, bool) { + if o == nil || o.ProfiledHostsPercentage == nil { + return nil, false + } + return o.ProfiledHostsPercentage, true +} + +// HasProfiledHostsPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasProfiledHostsPercentage() bool { + if o != nil && o.ProfiledHostsPercentage != nil { + return true + } + + return false +} + +// SetProfiledHostsPercentage gets a reference to the given float64 and assigns it to the ProfiledHostsPercentage field. +func (o *UsageAttributionValues) SetProfiledHostsPercentage(v float64) { + o.ProfiledHostsPercentage = &v +} + +// GetProfiledHostsUsage returns the ProfiledHostsUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetProfiledHostsUsage() float64 { + if o == nil || o.ProfiledHostsUsage == nil { + var ret float64 + return ret + } + return *o.ProfiledHostsUsage +} + +// GetProfiledHostsUsageOk returns a tuple with the ProfiledHostsUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetProfiledHostsUsageOk() (*float64, bool) { + if o == nil || o.ProfiledHostsUsage == nil { + return nil, false + } + return o.ProfiledHostsUsage, true +} + +// HasProfiledHostsUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasProfiledHostsUsage() bool { + if o != nil && o.ProfiledHostsUsage != nil { + return true + } + + return false +} + +// SetProfiledHostsUsage gets a reference to the given float64 and assigns it to the ProfiledHostsUsage field. +func (o *UsageAttributionValues) SetProfiledHostsUsage(v float64) { + o.ProfiledHostsUsage = &v +} + +// GetSnmpPercentage returns the SnmpPercentage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetSnmpPercentage() float64 { + if o == nil || o.SnmpPercentage == nil { + var ret float64 + return ret + } + return *o.SnmpPercentage +} + +// GetSnmpPercentageOk returns a tuple with the SnmpPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetSnmpPercentageOk() (*float64, bool) { + if o == nil || o.SnmpPercentage == nil { + return nil, false + } + return o.SnmpPercentage, true +} + +// HasSnmpPercentage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasSnmpPercentage() bool { + if o != nil && o.SnmpPercentage != nil { + return true + } + + return false +} + +// SetSnmpPercentage gets a reference to the given float64 and assigns it to the SnmpPercentage field. +func (o *UsageAttributionValues) SetSnmpPercentage(v float64) { + o.SnmpPercentage = &v +} + +// GetSnmpUsage returns the SnmpUsage field value if set, zero value otherwise. +func (o *UsageAttributionValues) GetSnmpUsage() float64 { + if o == nil || o.SnmpUsage == nil { + var ret float64 + return ret + } + return *o.SnmpUsage +} + +// GetSnmpUsageOk returns a tuple with the SnmpUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributionValues) GetSnmpUsageOk() (*float64, bool) { + if o == nil || o.SnmpUsage == nil { + return nil, false + } + return o.SnmpUsage, true +} + +// HasSnmpUsage returns a boolean if a field has been set. +func (o *UsageAttributionValues) HasSnmpUsage() bool { + if o != nil && o.SnmpUsage != nil { + return true + } + + return false +} + +// SetSnmpUsage gets a reference to the given float64 and assigns it to the SnmpUsage field. +func (o *UsageAttributionValues) SetSnmpUsage(v float64) { + o.SnmpUsage = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAttributionValues) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApiPercentage != nil { + toSerialize["api_percentage"] = o.ApiPercentage + } + if o.ApiUsage != nil { + toSerialize["api_usage"] = o.ApiUsage + } + if o.ApmHostPercentage != nil { + toSerialize["apm_host_percentage"] = o.ApmHostPercentage + } + if o.ApmHostUsage != nil { + toSerialize["apm_host_usage"] = o.ApmHostUsage + } + if o.AppsecPercentage != nil { + toSerialize["appsec_percentage"] = o.AppsecPercentage + } + if o.AppsecUsage != nil { + toSerialize["appsec_usage"] = o.AppsecUsage + } + if o.BrowserPercentage != nil { + toSerialize["browser_percentage"] = o.BrowserPercentage + } + if o.BrowserUsage != nil { + toSerialize["browser_usage"] = o.BrowserUsage + } + if o.ContainerPercentage != nil { + toSerialize["container_percentage"] = o.ContainerPercentage + } + if o.ContainerUsage != nil { + toSerialize["container_usage"] = o.ContainerUsage + } + if o.CspmContainerPercentage != nil { + toSerialize["cspm_container_percentage"] = o.CspmContainerPercentage + } + if o.CspmContainerUsage != nil { + toSerialize["cspm_container_usage"] = o.CspmContainerUsage + } + if o.CspmHostPercentage != nil { + toSerialize["cspm_host_percentage"] = o.CspmHostPercentage + } + if o.CspmHostUsage != nil { + toSerialize["cspm_host_usage"] = o.CspmHostUsage + } + if o.CustomTimeseriesPercentage != nil { + toSerialize["custom_timeseries_percentage"] = o.CustomTimeseriesPercentage + } + if o.CustomTimeseriesUsage != nil { + toSerialize["custom_timeseries_usage"] = o.CustomTimeseriesUsage + } + if o.CwsContainerPercentage != nil { + toSerialize["cws_container_percentage"] = o.CwsContainerPercentage + } + if o.CwsContainerUsage != nil { + toSerialize["cws_container_usage"] = o.CwsContainerUsage + } + if o.CwsHostPercentage != nil { + toSerialize["cws_host_percentage"] = o.CwsHostPercentage + } + if o.CwsHostUsage != nil { + toSerialize["cws_host_usage"] = o.CwsHostUsage + } + if o.DbmHostsPercentage != nil { + toSerialize["dbm_hosts_percentage"] = o.DbmHostsPercentage + } + if o.DbmHostsUsage != nil { + toSerialize["dbm_hosts_usage"] = o.DbmHostsUsage + } + if o.DbmQueriesPercentage != nil { + toSerialize["dbm_queries_percentage"] = o.DbmQueriesPercentage + } + if o.DbmQueriesUsage != nil { + toSerialize["dbm_queries_usage"] = o.DbmQueriesUsage + } + if o.EstimatedIndexedLogsPercentage != nil { + toSerialize["estimated_indexed_logs_percentage"] = o.EstimatedIndexedLogsPercentage + } + if o.EstimatedIndexedLogsUsage != nil { + toSerialize["estimated_indexed_logs_usage"] = o.EstimatedIndexedLogsUsage + } + if o.EstimatedIndexedSpansPercentage != nil { + toSerialize["estimated_indexed_spans_percentage"] = o.EstimatedIndexedSpansPercentage + } + if o.EstimatedIndexedSpansUsage != nil { + toSerialize["estimated_indexed_spans_usage"] = o.EstimatedIndexedSpansUsage + } + if o.EstimatedIngestedSpansPercentage != nil { + toSerialize["estimated_ingested_spans_percentage"] = o.EstimatedIngestedSpansPercentage + } + if o.EstimatedIngestedSpansUsage != nil { + toSerialize["estimated_ingested_spans_usage"] = o.EstimatedIngestedSpansUsage + } + if o.InfraHostPercentage != nil { + toSerialize["infra_host_percentage"] = o.InfraHostPercentage + } + if o.InfraHostUsage != nil { + toSerialize["infra_host_usage"] = o.InfraHostUsage + } + if o.LambdaFunctionsPercentage != nil { + toSerialize["lambda_functions_percentage"] = o.LambdaFunctionsPercentage + } + if o.LambdaFunctionsUsage != nil { + toSerialize["lambda_functions_usage"] = o.LambdaFunctionsUsage + } + if o.LambdaInvocationsPercentage != nil { + toSerialize["lambda_invocations_percentage"] = o.LambdaInvocationsPercentage + } + if o.LambdaInvocationsUsage != nil { + toSerialize["lambda_invocations_usage"] = o.LambdaInvocationsUsage + } + if o.NpmHostPercentage != nil { + toSerialize["npm_host_percentage"] = o.NpmHostPercentage + } + if o.NpmHostUsage != nil { + toSerialize["npm_host_usage"] = o.NpmHostUsage + } + if o.ProfiledContainerPercentage != nil { + toSerialize["profiled_container_percentage"] = o.ProfiledContainerPercentage + } + if o.ProfiledContainerUsage != nil { + toSerialize["profiled_container_usage"] = o.ProfiledContainerUsage + } + if o.ProfiledHostsPercentage != nil { + toSerialize["profiled_hosts_percentage"] = o.ProfiledHostsPercentage + } + if o.ProfiledHostsUsage != nil { + toSerialize["profiled_hosts_usage"] = o.ProfiledHostsUsage + } + if o.SnmpPercentage != nil { + toSerialize["snmp_percentage"] = o.SnmpPercentage + } + if o.SnmpUsage != nil { + toSerialize["snmp_usage"] = o.SnmpUsage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApiPercentage *float64 `json:"api_percentage,omitempty"` + ApiUsage *float64 `json:"api_usage,omitempty"` + ApmHostPercentage *float64 `json:"apm_host_percentage,omitempty"` + ApmHostUsage *float64 `json:"apm_host_usage,omitempty"` + AppsecPercentage *float64 `json:"appsec_percentage,omitempty"` + AppsecUsage *float64 `json:"appsec_usage,omitempty"` + BrowserPercentage *float64 `json:"browser_percentage,omitempty"` + BrowserUsage *float64 `json:"browser_usage,omitempty"` + ContainerPercentage *float64 `json:"container_percentage,omitempty"` + ContainerUsage *float64 `json:"container_usage,omitempty"` + CspmContainerPercentage *float64 `json:"cspm_container_percentage,omitempty"` + CspmContainerUsage *float64 `json:"cspm_container_usage,omitempty"` + CspmHostPercentage *float64 `json:"cspm_host_percentage,omitempty"` + CspmHostUsage *float64 `json:"cspm_host_usage,omitempty"` + CustomTimeseriesPercentage *float64 `json:"custom_timeseries_percentage,omitempty"` + CustomTimeseriesUsage *float64 `json:"custom_timeseries_usage,omitempty"` + CwsContainerPercentage *float64 `json:"cws_container_percentage,omitempty"` + CwsContainerUsage *float64 `json:"cws_container_usage,omitempty"` + CwsHostPercentage *float64 `json:"cws_host_percentage,omitempty"` + CwsHostUsage *float64 `json:"cws_host_usage,omitempty"` + DbmHostsPercentage *float64 `json:"dbm_hosts_percentage,omitempty"` + DbmHostsUsage *float64 `json:"dbm_hosts_usage,omitempty"` + DbmQueriesPercentage *float64 `json:"dbm_queries_percentage,omitempty"` + DbmQueriesUsage *float64 `json:"dbm_queries_usage,omitempty"` + EstimatedIndexedLogsPercentage *float64 `json:"estimated_indexed_logs_percentage,omitempty"` + EstimatedIndexedLogsUsage *float64 `json:"estimated_indexed_logs_usage,omitempty"` + EstimatedIndexedSpansPercentage *float64 `json:"estimated_indexed_spans_percentage,omitempty"` + EstimatedIndexedSpansUsage *float64 `json:"estimated_indexed_spans_usage,omitempty"` + EstimatedIngestedSpansPercentage *float64 `json:"estimated_ingested_spans_percentage,omitempty"` + EstimatedIngestedSpansUsage *float64 `json:"estimated_ingested_spans_usage,omitempty"` + InfraHostPercentage *float64 `json:"infra_host_percentage,omitempty"` + InfraHostUsage *float64 `json:"infra_host_usage,omitempty"` + LambdaFunctionsPercentage *float64 `json:"lambda_functions_percentage,omitempty"` + LambdaFunctionsUsage *float64 `json:"lambda_functions_usage,omitempty"` + LambdaInvocationsPercentage *float64 `json:"lambda_invocations_percentage,omitempty"` + LambdaInvocationsUsage *float64 `json:"lambda_invocations_usage,omitempty"` + NpmHostPercentage *float64 `json:"npm_host_percentage,omitempty"` + NpmHostUsage *float64 `json:"npm_host_usage,omitempty"` + ProfiledContainerPercentage *float64 `json:"profiled_container_percentage,omitempty"` + ProfiledContainerUsage *float64 `json:"profiled_container_usage,omitempty"` + ProfiledHostsPercentage *float64 `json:"profiled_hosts_percentage,omitempty"` + ProfiledHostsUsage *float64 `json:"profiled_hosts_usage,omitempty"` + SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` + SnmpUsage *float64 `json:"snmp_usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ApiPercentage = all.ApiPercentage + o.ApiUsage = all.ApiUsage + o.ApmHostPercentage = all.ApmHostPercentage + o.ApmHostUsage = all.ApmHostUsage + o.AppsecPercentage = all.AppsecPercentage + o.AppsecUsage = all.AppsecUsage + o.BrowserPercentage = all.BrowserPercentage + o.BrowserUsage = all.BrowserUsage + o.ContainerPercentage = all.ContainerPercentage + o.ContainerUsage = all.ContainerUsage + o.CspmContainerPercentage = all.CspmContainerPercentage + o.CspmContainerUsage = all.CspmContainerUsage + o.CspmHostPercentage = all.CspmHostPercentage + o.CspmHostUsage = all.CspmHostUsage + o.CustomTimeseriesPercentage = all.CustomTimeseriesPercentage + o.CustomTimeseriesUsage = all.CustomTimeseriesUsage + o.CwsContainerPercentage = all.CwsContainerPercentage + o.CwsContainerUsage = all.CwsContainerUsage + o.CwsHostPercentage = all.CwsHostPercentage + o.CwsHostUsage = all.CwsHostUsage + o.DbmHostsPercentage = all.DbmHostsPercentage + o.DbmHostsUsage = all.DbmHostsUsage + o.DbmQueriesPercentage = all.DbmQueriesPercentage + o.DbmQueriesUsage = all.DbmQueriesUsage + o.EstimatedIndexedLogsPercentage = all.EstimatedIndexedLogsPercentage + o.EstimatedIndexedLogsUsage = all.EstimatedIndexedLogsUsage + o.EstimatedIndexedSpansPercentage = all.EstimatedIndexedSpansPercentage + o.EstimatedIndexedSpansUsage = all.EstimatedIndexedSpansUsage + o.EstimatedIngestedSpansPercentage = all.EstimatedIngestedSpansPercentage + o.EstimatedIngestedSpansUsage = all.EstimatedIngestedSpansUsage + o.InfraHostPercentage = all.InfraHostPercentage + o.InfraHostUsage = all.InfraHostUsage + o.LambdaFunctionsPercentage = all.LambdaFunctionsPercentage + o.LambdaFunctionsUsage = all.LambdaFunctionsUsage + o.LambdaInvocationsPercentage = all.LambdaInvocationsPercentage + o.LambdaInvocationsUsage = all.LambdaInvocationsUsage + o.NpmHostPercentage = all.NpmHostPercentage + o.NpmHostUsage = all.NpmHostUsage + o.ProfiledContainerPercentage = all.ProfiledContainerPercentage + o.ProfiledContainerUsage = all.ProfiledContainerUsage + o.ProfiledHostsPercentage = all.ProfiledHostsPercentage + o.ProfiledHostsUsage = all.ProfiledHostsUsage + o.SnmpPercentage = all.SnmpPercentage + o.SnmpUsage = all.SnmpUsage + return nil +} diff --git a/api/v1/datadog/model_usage_audit_logs_hour.go b/api/v1/datadog/model_usage_audit_logs_hour.go new file mode 100644 index 00000000000..7c1d3cc9a54 --- /dev/null +++ b/api/v1/datadog/model_usage_audit_logs_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageAuditLogsHour Audit logs usage for a given organization for a given hour. +type UsageAuditLogsHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The total number of audit logs lines indexed during a given hour. + LinesIndexed *int64 `json:"lines_indexed,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageAuditLogsHour instantiates a new UsageAuditLogsHour 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 NewUsageAuditLogsHour() *UsageAuditLogsHour { + this := UsageAuditLogsHour{} + return &this +} + +// NewUsageAuditLogsHourWithDefaults instantiates a new UsageAuditLogsHour 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 NewUsageAuditLogsHourWithDefaults() *UsageAuditLogsHour { + this := UsageAuditLogsHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageAuditLogsHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAuditLogsHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageAuditLogsHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageAuditLogsHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetLinesIndexed returns the LinesIndexed field value if set, zero value otherwise. +func (o *UsageAuditLogsHour) GetLinesIndexed() int64 { + if o == nil || o.LinesIndexed == nil { + var ret int64 + return ret + } + return *o.LinesIndexed +} + +// GetLinesIndexedOk returns a tuple with the LinesIndexed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAuditLogsHour) GetLinesIndexedOk() (*int64, bool) { + if o == nil || o.LinesIndexed == nil { + return nil, false + } + return o.LinesIndexed, true +} + +// HasLinesIndexed returns a boolean if a field has been set. +func (o *UsageAuditLogsHour) HasLinesIndexed() bool { + if o != nil && o.LinesIndexed != nil { + return true + } + + return false +} + +// SetLinesIndexed gets a reference to the given int64 and assigns it to the LinesIndexed field. +func (o *UsageAuditLogsHour) SetLinesIndexed(v int64) { + o.LinesIndexed = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageAuditLogsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAuditLogsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageAuditLogsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageAuditLogsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageAuditLogsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAuditLogsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageAuditLogsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageAuditLogsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAuditLogsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LinesIndexed != nil { + toSerialize["lines_indexed"] = o.LinesIndexed + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAuditLogsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + LinesIndexed *int64 `json:"lines_indexed,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.LinesIndexed = all.LinesIndexed + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_audit_logs_response.go b/api/v1/datadog/model_usage_audit_logs_response.go new file mode 100644 index 00000000000..6e778cfb9a1 --- /dev/null +++ b/api/v1/datadog/model_usage_audit_logs_response.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 datadog + +import ( + "encoding/json" +) + +// UsageAuditLogsResponse Response containing the audit logs usage for each hour for a given organization. +type UsageAuditLogsResponse struct { + // Get hourly usage for audit logs. + Usage []UsageAuditLogsHour `json:"usage,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{} +} + +// NewUsageAuditLogsResponse instantiates a new UsageAuditLogsResponse 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 NewUsageAuditLogsResponse() *UsageAuditLogsResponse { + this := UsageAuditLogsResponse{} + return &this +} + +// NewUsageAuditLogsResponseWithDefaults instantiates a new UsageAuditLogsResponse 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 NewUsageAuditLogsResponseWithDefaults() *UsageAuditLogsResponse { + this := UsageAuditLogsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageAuditLogsResponse) GetUsage() []UsageAuditLogsHour { + if o == nil || o.Usage == nil { + var ret []UsageAuditLogsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAuditLogsResponse) GetUsageOk() (*[]UsageAuditLogsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageAuditLogsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageAuditLogsHour and assigns it to the Usage field. +func (o *UsageAuditLogsResponse) SetUsage(v []UsageAuditLogsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAuditLogsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAuditLogsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageAuditLogsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_billable_summary_body.go b/api/v1/datadog/model_usage_billable_summary_body.go new file mode 100644 index 00000000000..1bfd4616cef --- /dev/null +++ b/api/v1/datadog/model_usage_billable_summary_body.go @@ -0,0 +1,345 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageBillableSummaryBody Response with properties for each aggregated usage type. +type UsageBillableSummaryBody struct { + // The total account usage. + AccountBillableUsage *int64 `json:"account_billable_usage,omitempty"` + // Elapsed usage hours for some billable product. + ElapsedUsageHours *int64 `json:"elapsed_usage_hours,omitempty"` + // The first billable hour for the org. + FirstBillableUsageHour *time.Time `json:"first_billable_usage_hour,omitempty"` + // The last billable hour for the org. + LastBillableUsageHour *time.Time `json:"last_billable_usage_hour,omitempty"` + // The number of units used within the billable timeframe. + OrgBillableUsage *int64 `json:"org_billable_usage,omitempty"` + // The percentage of account usage the org represents. + PercentageInAccount *float64 `json:"percentage_in_account,omitempty"` + // Units pertaining to the usage. + UsageUnit *string `json:"usage_unit,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{} +} + +// NewUsageBillableSummaryBody instantiates a new UsageBillableSummaryBody 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 NewUsageBillableSummaryBody() *UsageBillableSummaryBody { + this := UsageBillableSummaryBody{} + return &this +} + +// NewUsageBillableSummaryBodyWithDefaults instantiates a new UsageBillableSummaryBody 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 NewUsageBillableSummaryBodyWithDefaults() *UsageBillableSummaryBody { + this := UsageBillableSummaryBody{} + return &this +} + +// GetAccountBillableUsage returns the AccountBillableUsage field value if set, zero value otherwise. +func (o *UsageBillableSummaryBody) GetAccountBillableUsage() int64 { + if o == nil || o.AccountBillableUsage == nil { + var ret int64 + return ret + } + return *o.AccountBillableUsage +} + +// GetAccountBillableUsageOk returns a tuple with the AccountBillableUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryBody) GetAccountBillableUsageOk() (*int64, bool) { + if o == nil || o.AccountBillableUsage == nil { + return nil, false + } + return o.AccountBillableUsage, true +} + +// HasAccountBillableUsage returns a boolean if a field has been set. +func (o *UsageBillableSummaryBody) HasAccountBillableUsage() bool { + if o != nil && o.AccountBillableUsage != nil { + return true + } + + return false +} + +// SetAccountBillableUsage gets a reference to the given int64 and assigns it to the AccountBillableUsage field. +func (o *UsageBillableSummaryBody) SetAccountBillableUsage(v int64) { + o.AccountBillableUsage = &v +} + +// GetElapsedUsageHours returns the ElapsedUsageHours field value if set, zero value otherwise. +func (o *UsageBillableSummaryBody) GetElapsedUsageHours() int64 { + if o == nil || o.ElapsedUsageHours == nil { + var ret int64 + return ret + } + return *o.ElapsedUsageHours +} + +// GetElapsedUsageHoursOk returns a tuple with the ElapsedUsageHours field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryBody) GetElapsedUsageHoursOk() (*int64, bool) { + if o == nil || o.ElapsedUsageHours == nil { + return nil, false + } + return o.ElapsedUsageHours, true +} + +// HasElapsedUsageHours returns a boolean if a field has been set. +func (o *UsageBillableSummaryBody) HasElapsedUsageHours() bool { + if o != nil && o.ElapsedUsageHours != nil { + return true + } + + return false +} + +// SetElapsedUsageHours gets a reference to the given int64 and assigns it to the ElapsedUsageHours field. +func (o *UsageBillableSummaryBody) SetElapsedUsageHours(v int64) { + o.ElapsedUsageHours = &v +} + +// GetFirstBillableUsageHour returns the FirstBillableUsageHour field value if set, zero value otherwise. +func (o *UsageBillableSummaryBody) GetFirstBillableUsageHour() time.Time { + if o == nil || o.FirstBillableUsageHour == nil { + var ret time.Time + return ret + } + return *o.FirstBillableUsageHour +} + +// GetFirstBillableUsageHourOk returns a tuple with the FirstBillableUsageHour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryBody) GetFirstBillableUsageHourOk() (*time.Time, bool) { + if o == nil || o.FirstBillableUsageHour == nil { + return nil, false + } + return o.FirstBillableUsageHour, true +} + +// HasFirstBillableUsageHour returns a boolean if a field has been set. +func (o *UsageBillableSummaryBody) HasFirstBillableUsageHour() bool { + if o != nil && o.FirstBillableUsageHour != nil { + return true + } + + return false +} + +// SetFirstBillableUsageHour gets a reference to the given time.Time and assigns it to the FirstBillableUsageHour field. +func (o *UsageBillableSummaryBody) SetFirstBillableUsageHour(v time.Time) { + o.FirstBillableUsageHour = &v +} + +// GetLastBillableUsageHour returns the LastBillableUsageHour field value if set, zero value otherwise. +func (o *UsageBillableSummaryBody) GetLastBillableUsageHour() time.Time { + if o == nil || o.LastBillableUsageHour == nil { + var ret time.Time + return ret + } + return *o.LastBillableUsageHour +} + +// GetLastBillableUsageHourOk returns a tuple with the LastBillableUsageHour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryBody) GetLastBillableUsageHourOk() (*time.Time, bool) { + if o == nil || o.LastBillableUsageHour == nil { + return nil, false + } + return o.LastBillableUsageHour, true +} + +// HasLastBillableUsageHour returns a boolean if a field has been set. +func (o *UsageBillableSummaryBody) HasLastBillableUsageHour() bool { + if o != nil && o.LastBillableUsageHour != nil { + return true + } + + return false +} + +// SetLastBillableUsageHour gets a reference to the given time.Time and assigns it to the LastBillableUsageHour field. +func (o *UsageBillableSummaryBody) SetLastBillableUsageHour(v time.Time) { + o.LastBillableUsageHour = &v +} + +// GetOrgBillableUsage returns the OrgBillableUsage field value if set, zero value otherwise. +func (o *UsageBillableSummaryBody) GetOrgBillableUsage() int64 { + if o == nil || o.OrgBillableUsage == nil { + var ret int64 + return ret + } + return *o.OrgBillableUsage +} + +// GetOrgBillableUsageOk returns a tuple with the OrgBillableUsage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryBody) GetOrgBillableUsageOk() (*int64, bool) { + if o == nil || o.OrgBillableUsage == nil { + return nil, false + } + return o.OrgBillableUsage, true +} + +// HasOrgBillableUsage returns a boolean if a field has been set. +func (o *UsageBillableSummaryBody) HasOrgBillableUsage() bool { + if o != nil && o.OrgBillableUsage != nil { + return true + } + + return false +} + +// SetOrgBillableUsage gets a reference to the given int64 and assigns it to the OrgBillableUsage field. +func (o *UsageBillableSummaryBody) SetOrgBillableUsage(v int64) { + o.OrgBillableUsage = &v +} + +// GetPercentageInAccount returns the PercentageInAccount field value if set, zero value otherwise. +func (o *UsageBillableSummaryBody) GetPercentageInAccount() float64 { + if o == nil || o.PercentageInAccount == nil { + var ret float64 + return ret + } + return *o.PercentageInAccount +} + +// GetPercentageInAccountOk returns a tuple with the PercentageInAccount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryBody) GetPercentageInAccountOk() (*float64, bool) { + if o == nil || o.PercentageInAccount == nil { + return nil, false + } + return o.PercentageInAccount, true +} + +// HasPercentageInAccount returns a boolean if a field has been set. +func (o *UsageBillableSummaryBody) HasPercentageInAccount() bool { + if o != nil && o.PercentageInAccount != nil { + return true + } + + return false +} + +// SetPercentageInAccount gets a reference to the given float64 and assigns it to the PercentageInAccount field. +func (o *UsageBillableSummaryBody) SetPercentageInAccount(v float64) { + o.PercentageInAccount = &v +} + +// GetUsageUnit returns the UsageUnit field value if set, zero value otherwise. +func (o *UsageBillableSummaryBody) GetUsageUnit() string { + if o == nil || o.UsageUnit == nil { + var ret string + return ret + } + return *o.UsageUnit +} + +// GetUsageUnitOk returns a tuple with the UsageUnit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryBody) GetUsageUnitOk() (*string, bool) { + if o == nil || o.UsageUnit == nil { + return nil, false + } + return o.UsageUnit, true +} + +// HasUsageUnit returns a boolean if a field has been set. +func (o *UsageBillableSummaryBody) HasUsageUnit() bool { + if o != nil && o.UsageUnit != nil { + return true + } + + return false +} + +// SetUsageUnit gets a reference to the given string and assigns it to the UsageUnit field. +func (o *UsageBillableSummaryBody) SetUsageUnit(v string) { + o.UsageUnit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageBillableSummaryBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AccountBillableUsage != nil { + toSerialize["account_billable_usage"] = o.AccountBillableUsage + } + if o.ElapsedUsageHours != nil { + toSerialize["elapsed_usage_hours"] = o.ElapsedUsageHours + } + if o.FirstBillableUsageHour != nil { + if o.FirstBillableUsageHour.Nanosecond() == 0 { + toSerialize["first_billable_usage_hour"] = o.FirstBillableUsageHour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["first_billable_usage_hour"] = o.FirstBillableUsageHour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LastBillableUsageHour != nil { + if o.LastBillableUsageHour.Nanosecond() == 0 { + toSerialize["last_billable_usage_hour"] = o.LastBillableUsageHour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["last_billable_usage_hour"] = o.LastBillableUsageHour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgBillableUsage != nil { + toSerialize["org_billable_usage"] = o.OrgBillableUsage + } + if o.PercentageInAccount != nil { + toSerialize["percentage_in_account"] = o.PercentageInAccount + } + if o.UsageUnit != nil { + toSerialize["usage_unit"] = o.UsageUnit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageBillableSummaryBody) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AccountBillableUsage *int64 `json:"account_billable_usage,omitempty"` + ElapsedUsageHours *int64 `json:"elapsed_usage_hours,omitempty"` + FirstBillableUsageHour *time.Time `json:"first_billable_usage_hour,omitempty"` + LastBillableUsageHour *time.Time `json:"last_billable_usage_hour,omitempty"` + OrgBillableUsage *int64 `json:"org_billable_usage,omitempty"` + PercentageInAccount *float64 `json:"percentage_in_account,omitempty"` + UsageUnit *string `json:"usage_unit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccountBillableUsage = all.AccountBillableUsage + o.ElapsedUsageHours = all.ElapsedUsageHours + o.FirstBillableUsageHour = all.FirstBillableUsageHour + o.LastBillableUsageHour = all.LastBillableUsageHour + o.OrgBillableUsage = all.OrgBillableUsage + o.PercentageInAccount = all.PercentageInAccount + o.UsageUnit = all.UsageUnit + return nil +} diff --git a/api/v1/datadog/model_usage_billable_summary_hour.go b/api/v1/datadog/model_usage_billable_summary_hour.go new file mode 100644 index 00000000000..da06af9ffee --- /dev/null +++ b/api/v1/datadog/model_usage_billable_summary_hour.go @@ -0,0 +1,391 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageBillableSummaryHour Response with monthly summary of data billed by Datadog. +type UsageBillableSummaryHour struct { + // The billing plan. + BillingPlan *string `json:"billing_plan,omitempty"` + // Shows the last date of usage. + EndDate *time.Time `json:"end_date,omitempty"` + // The number of organizations. + NumOrgs *int64 `json:"num_orgs,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // Shows usage aggregation for a billing period. + RatioInMonth *float64 `json:"ratio_in_month,omitempty"` + // Shows the first date of usage. + StartDate *time.Time `json:"start_date,omitempty"` + // Response with aggregated usage types. + Usage *UsageBillableSummaryKeys `json:"usage,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{} +} + +// NewUsageBillableSummaryHour instantiates a new UsageBillableSummaryHour 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 NewUsageBillableSummaryHour() *UsageBillableSummaryHour { + this := UsageBillableSummaryHour{} + return &this +} + +// NewUsageBillableSummaryHourWithDefaults instantiates a new UsageBillableSummaryHour 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 NewUsageBillableSummaryHourWithDefaults() *UsageBillableSummaryHour { + this := UsageBillableSummaryHour{} + return &this +} + +// GetBillingPlan returns the BillingPlan field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetBillingPlan() string { + if o == nil || o.BillingPlan == nil { + var ret string + return ret + } + return *o.BillingPlan +} + +// GetBillingPlanOk returns a tuple with the BillingPlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetBillingPlanOk() (*string, bool) { + if o == nil || o.BillingPlan == nil { + return nil, false + } + return o.BillingPlan, true +} + +// HasBillingPlan returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasBillingPlan() bool { + if o != nil && o.BillingPlan != nil { + return true + } + + return false +} + +// SetBillingPlan gets a reference to the given string and assigns it to the BillingPlan field. +func (o *UsageBillableSummaryHour) SetBillingPlan(v string) { + o.BillingPlan = &v +} + +// GetEndDate returns the EndDate field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetEndDate() time.Time { + if o == nil || o.EndDate == nil { + var ret time.Time + return ret + } + return *o.EndDate +} + +// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetEndDateOk() (*time.Time, bool) { + if o == nil || o.EndDate == nil { + return nil, false + } + return o.EndDate, true +} + +// HasEndDate returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasEndDate() bool { + if o != nil && o.EndDate != nil { + return true + } + + return false +} + +// SetEndDate gets a reference to the given time.Time and assigns it to the EndDate field. +func (o *UsageBillableSummaryHour) SetEndDate(v time.Time) { + o.EndDate = &v +} + +// GetNumOrgs returns the NumOrgs field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetNumOrgs() int64 { + if o == nil || o.NumOrgs == nil { + var ret int64 + return ret + } + return *o.NumOrgs +} + +// GetNumOrgsOk returns a tuple with the NumOrgs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetNumOrgsOk() (*int64, bool) { + if o == nil || o.NumOrgs == nil { + return nil, false + } + return o.NumOrgs, true +} + +// HasNumOrgs returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasNumOrgs() bool { + if o != nil && o.NumOrgs != nil { + return true + } + + return false +} + +// SetNumOrgs gets a reference to the given int64 and assigns it to the NumOrgs field. +func (o *UsageBillableSummaryHour) SetNumOrgs(v int64) { + o.NumOrgs = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageBillableSummaryHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageBillableSummaryHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetRatioInMonth returns the RatioInMonth field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetRatioInMonth() float64 { + if o == nil || o.RatioInMonth == nil { + var ret float64 + return ret + } + return *o.RatioInMonth +} + +// GetRatioInMonthOk returns a tuple with the RatioInMonth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetRatioInMonthOk() (*float64, bool) { + if o == nil || o.RatioInMonth == nil { + return nil, false + } + return o.RatioInMonth, true +} + +// HasRatioInMonth returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasRatioInMonth() bool { + if o != nil && o.RatioInMonth != nil { + return true + } + + return false +} + +// SetRatioInMonth gets a reference to the given float64 and assigns it to the RatioInMonth field. +func (o *UsageBillableSummaryHour) SetRatioInMonth(v float64) { + o.RatioInMonth = &v +} + +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetStartDate() time.Time { + if o == nil || o.StartDate == nil { + var ret time.Time + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetStartDateOk() (*time.Time, bool) { + if o == nil || o.StartDate == nil { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasStartDate() bool { + if o != nil && o.StartDate != nil { + return true + } + + return false +} + +// SetStartDate gets a reference to the given time.Time and assigns it to the StartDate field. +func (o *UsageBillableSummaryHour) SetStartDate(v time.Time) { + o.StartDate = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageBillableSummaryHour) GetUsage() UsageBillableSummaryKeys { + if o == nil || o.Usage == nil { + var ret UsageBillableSummaryKeys + return ret + } + return *o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryHour) GetUsageOk() (*UsageBillableSummaryKeys, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageBillableSummaryHour) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given UsageBillableSummaryKeys and assigns it to the Usage field. +func (o *UsageBillableSummaryHour) SetUsage(v UsageBillableSummaryKeys) { + o.Usage = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageBillableSummaryHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BillingPlan != nil { + toSerialize["billing_plan"] = o.BillingPlan + } + if o.EndDate != nil { + if o.EndDate.Nanosecond() == 0 { + toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.NumOrgs != nil { + toSerialize["num_orgs"] = o.NumOrgs + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.RatioInMonth != nil { + toSerialize["ratio_in_month"] = o.RatioInMonth + } + if o.StartDate != nil { + if o.StartDate.Nanosecond() == 0 { + toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageBillableSummaryHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BillingPlan *string `json:"billing_plan,omitempty"` + EndDate *time.Time `json:"end_date,omitempty"` + NumOrgs *int64 `json:"num_orgs,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + RatioInMonth *float64 `json:"ratio_in_month,omitempty"` + StartDate *time.Time `json:"start_date,omitempty"` + Usage *UsageBillableSummaryKeys `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BillingPlan = all.BillingPlan + o.EndDate = all.EndDate + o.NumOrgs = all.NumOrgs + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.RatioInMonth = all.RatioInMonth + o.StartDate = all.StartDate + if all.Usage != nil && all.Usage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_billable_summary_keys.go b/api/v1/datadog/model_usage_billable_summary_keys.go new file mode 100644 index 00000000000..b6a69a8bf73 --- /dev/null +++ b/api/v1/datadog/model_usage_billable_summary_keys.go @@ -0,0 +1,3697 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageBillableSummaryKeys Response with aggregated usage types. +type UsageBillableSummaryKeys struct { + // Response with properties for each aggregated usage type. + ApmFargateAverage *UsageBillableSummaryBody `json:"apm_fargate_average,omitempty"` + // Response with properties for each aggregated usage type. + ApmFargateSum *UsageBillableSummaryBody `json:"apm_fargate_sum,omitempty"` + // Response with properties for each aggregated usage type. + ApmHostSum *UsageBillableSummaryBody `json:"apm_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + ApmHostTop99p *UsageBillableSummaryBody `json:"apm_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + ApmProfilerHostSum *UsageBillableSummaryBody `json:"apm_profiler_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + ApmProfilerHostTop99p *UsageBillableSummaryBody `json:"apm_profiler_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + ApmTraceSearchSum *UsageBillableSummaryBody `json:"apm_trace_search_sum,omitempty"` + // Response with properties for each aggregated usage type. + ApplicationSecurityHostSum *UsageBillableSummaryBody `json:"application_security_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + CiPipelineIndexedSpansSum *UsageBillableSummaryBody `json:"ci_pipeline_indexed_spans_sum,omitempty"` + // Response with properties for each aggregated usage type. + CiPipelineMaximum *UsageBillableSummaryBody `json:"ci_pipeline_maximum,omitempty"` + // Response with properties for each aggregated usage type. + CiPipelineSum *UsageBillableSummaryBody `json:"ci_pipeline_sum,omitempty"` + // Response with properties for each aggregated usage type. + CiTestIndexedSpansSum *UsageBillableSummaryBody `json:"ci_test_indexed_spans_sum,omitempty"` + // Response with properties for each aggregated usage type. + CiTestingMaximum *UsageBillableSummaryBody `json:"ci_testing_maximum,omitempty"` + // Response with properties for each aggregated usage type. + CiTestingSum *UsageBillableSummaryBody `json:"ci_testing_sum,omitempty"` + // Response with properties for each aggregated usage type. + CspmContainerSum *UsageBillableSummaryBody `json:"cspm_container_sum,omitempty"` + // Response with properties for each aggregated usage type. + CspmHostSum *UsageBillableSummaryBody `json:"cspm_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + CspmHostTop99p *UsageBillableSummaryBody `json:"cspm_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + CustomEventSum *UsageBillableSummaryBody `json:"custom_event_sum,omitempty"` + // Response with properties for each aggregated usage type. + CwsContainerSum *UsageBillableSummaryBody `json:"cws_container_sum,omitempty"` + // Response with properties for each aggregated usage type. + CwsHostSum *UsageBillableSummaryBody `json:"cws_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + CwsHostTop99p *UsageBillableSummaryBody `json:"cws_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + DbmHostSum *UsageBillableSummaryBody `json:"dbm_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + DbmHostTop99p *UsageBillableSummaryBody `json:"dbm_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + DbmNormalizedQueriesAverage *UsageBillableSummaryBody `json:"dbm_normalized_queries_average,omitempty"` + // Response with properties for each aggregated usage type. + DbmNormalizedQueriesSum *UsageBillableSummaryBody `json:"dbm_normalized_queries_sum,omitempty"` + // Response with properties for each aggregated usage type. + FargateContainerApmAndProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_average,omitempty"` + // Response with properties for each aggregated usage type. + FargateContainerApmAndProfilerSum *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_sum,omitempty"` + // Response with properties for each aggregated usage type. + FargateContainerAverage *UsageBillableSummaryBody `json:"fargate_container_average,omitempty"` + // Response with properties for each aggregated usage type. + FargateContainerProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_profiler_average,omitempty"` + // Response with properties for each aggregated usage type. + FargateContainerProfilerSum *UsageBillableSummaryBody `json:"fargate_container_profiler_sum,omitempty"` + // Response with properties for each aggregated usage type. + FargateContainerSum *UsageBillableSummaryBody `json:"fargate_container_sum,omitempty"` + // Response with properties for each aggregated usage type. + IncidentManagementMaximum *UsageBillableSummaryBody `json:"incident_management_maximum,omitempty"` + // Response with properties for each aggregated usage type. + IncidentManagementSum *UsageBillableSummaryBody `json:"incident_management_sum,omitempty"` + // Response with properties for each aggregated usage type. + InfraAndApmHostSum *UsageBillableSummaryBody `json:"infra_and_apm_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + InfraAndApmHostTop99p *UsageBillableSummaryBody `json:"infra_and_apm_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + InfraContainerSum *UsageBillableSummaryBody `json:"infra_container_sum,omitempty"` + // Response with properties for each aggregated usage type. + InfraHostSum *UsageBillableSummaryBody `json:"infra_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + InfraHostTop99p *UsageBillableSummaryBody `json:"infra_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + IngestedSpansSum *UsageBillableSummaryBody `json:"ingested_spans_sum,omitempty"` + // Response with properties for each aggregated usage type. + IngestedTimeseriesAverage *UsageBillableSummaryBody `json:"ingested_timeseries_average,omitempty"` + // Response with properties for each aggregated usage type. + IngestedTimeseriesSum *UsageBillableSummaryBody `json:"ingested_timeseries_sum,omitempty"` + // Response with properties for each aggregated usage type. + IotSum *UsageBillableSummaryBody `json:"iot_sum,omitempty"` + // Response with properties for each aggregated usage type. + IotTop99p *UsageBillableSummaryBody `json:"iot_top99p,omitempty"` + // Response with properties for each aggregated usage type. + LambdaFunctionAverage *UsageBillableSummaryBody `json:"lambda_function_average,omitempty"` + // Response with properties for each aggregated usage type. + LambdaFunctionSum *UsageBillableSummaryBody `json:"lambda_function_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed15daySum *UsageBillableSummaryBody `json:"logs_indexed_15day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed180daySum *UsageBillableSummaryBody `json:"logs_indexed_180day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed30daySum *UsageBillableSummaryBody `json:"logs_indexed_30day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed360daySum *UsageBillableSummaryBody `json:"logs_indexed_360day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed3daySum *UsageBillableSummaryBody `json:"logs_indexed_3day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed45daySum *UsageBillableSummaryBody `json:"logs_indexed_45day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed60daySum *UsageBillableSummaryBody `json:"logs_indexed_60day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed7daySum *UsageBillableSummaryBody `json:"logs_indexed_7day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexed90daySum *UsageBillableSummaryBody `json:"logs_indexed_90day_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexedCustomRetentionSum *UsageBillableSummaryBody `json:"logs_indexed_custom_retention_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIndexedSum *UsageBillableSummaryBody `json:"logs_indexed_sum,omitempty"` + // Response with properties for each aggregated usage type. + LogsIngestedSum *UsageBillableSummaryBody `json:"logs_ingested_sum,omitempty"` + // Response with properties for each aggregated usage type. + NetworkDeviceSum *UsageBillableSummaryBody `json:"network_device_sum,omitempty"` + // Response with properties for each aggregated usage type. + NetworkDeviceTop99p *UsageBillableSummaryBody `json:"network_device_top99p,omitempty"` + // Response with properties for each aggregated usage type. + NpmFlowSum *UsageBillableSummaryBody `json:"npm_flow_sum,omitempty"` + // Response with properties for each aggregated usage type. + NpmHostSum *UsageBillableSummaryBody `json:"npm_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + NpmHostTop99p *UsageBillableSummaryBody `json:"npm_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + ObservabilityPipelineSum *UsageBillableSummaryBody `json:"observability_pipeline_sum,omitempty"` + // Response with properties for each aggregated usage type. + OnlineArchiveSum *UsageBillableSummaryBody `json:"online_archive_sum,omitempty"` + // Response with properties for each aggregated usage type. + ProfContainerSum *UsageBillableSummaryBody `json:"prof_container_sum,omitempty"` + // Response with properties for each aggregated usage type. + ProfHostSum *UsageBillableSummaryBody `json:"prof_host_sum,omitempty"` + // Response with properties for each aggregated usage type. + ProfHostTop99p *UsageBillableSummaryBody `json:"prof_host_top99p,omitempty"` + // Response with properties for each aggregated usage type. + RumLiteSum *UsageBillableSummaryBody `json:"rum_lite_sum,omitempty"` + // Response with properties for each aggregated usage type. + RumReplaySum *UsageBillableSummaryBody `json:"rum_replay_sum,omitempty"` + // Response with properties for each aggregated usage type. + RumSum *UsageBillableSummaryBody `json:"rum_sum,omitempty"` + // Response with properties for each aggregated usage type. + RumUnitsSum *UsageBillableSummaryBody `json:"rum_units_sum,omitempty"` + // Response with properties for each aggregated usage type. + SensitiveDataScannerSum *UsageBillableSummaryBody `json:"sensitive_data_scanner_sum,omitempty"` + // Response with properties for each aggregated usage type. + ServerlessInvocationSum *UsageBillableSummaryBody `json:"serverless_invocation_sum,omitempty"` + // Response with properties for each aggregated usage type. + SiemSum *UsageBillableSummaryBody `json:"siem_sum,omitempty"` + // Response with properties for each aggregated usage type. + StandardTimeseriesAverage *UsageBillableSummaryBody `json:"standard_timeseries_average,omitempty"` + // Response with properties for each aggregated usage type. + SyntheticsApiTestsSum *UsageBillableSummaryBody `json:"synthetics_api_tests_sum,omitempty"` + // Response with properties for each aggregated usage type. + SyntheticsBrowserChecksSum *UsageBillableSummaryBody `json:"synthetics_browser_checks_sum,omitempty"` + // Response with properties for each aggregated usage type. + TimeseriesAverage *UsageBillableSummaryBody `json:"timeseries_average,omitempty"` + // Response with properties for each aggregated usage type. + TimeseriesSum *UsageBillableSummaryBody `json:"timeseries_sum,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{} +} + +// NewUsageBillableSummaryKeys instantiates a new UsageBillableSummaryKeys 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 NewUsageBillableSummaryKeys() *UsageBillableSummaryKeys { + this := UsageBillableSummaryKeys{} + return &this +} + +// NewUsageBillableSummaryKeysWithDefaults instantiates a new UsageBillableSummaryKeys 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 NewUsageBillableSummaryKeysWithDefaults() *UsageBillableSummaryKeys { + this := UsageBillableSummaryKeys{} + return &this +} + +// GetApmFargateAverage returns the ApmFargateAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApmFargateAverage() UsageBillableSummaryBody { + if o == nil || o.ApmFargateAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApmFargateAverage +} + +// GetApmFargateAverageOk returns a tuple with the ApmFargateAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApmFargateAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApmFargateAverage == nil { + return nil, false + } + return o.ApmFargateAverage, true +} + +// HasApmFargateAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApmFargateAverage() bool { + if o != nil && o.ApmFargateAverage != nil { + return true + } + + return false +} + +// SetApmFargateAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmFargateAverage field. +func (o *UsageBillableSummaryKeys) SetApmFargateAverage(v UsageBillableSummaryBody) { + o.ApmFargateAverage = &v +} + +// GetApmFargateSum returns the ApmFargateSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApmFargateSum() UsageBillableSummaryBody { + if o == nil || o.ApmFargateSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApmFargateSum +} + +// GetApmFargateSumOk returns a tuple with the ApmFargateSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApmFargateSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApmFargateSum == nil { + return nil, false + } + return o.ApmFargateSum, true +} + +// HasApmFargateSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApmFargateSum() bool { + if o != nil && o.ApmFargateSum != nil { + return true + } + + return false +} + +// SetApmFargateSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmFargateSum field. +func (o *UsageBillableSummaryKeys) SetApmFargateSum(v UsageBillableSummaryBody) { + o.ApmFargateSum = &v +} + +// GetApmHostSum returns the ApmHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApmHostSum() UsageBillableSummaryBody { + if o == nil || o.ApmHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApmHostSum +} + +// GetApmHostSumOk returns a tuple with the ApmHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApmHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApmHostSum == nil { + return nil, false + } + return o.ApmHostSum, true +} + +// HasApmHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApmHostSum() bool { + if o != nil && o.ApmHostSum != nil { + return true + } + + return false +} + +// SetApmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmHostSum field. +func (o *UsageBillableSummaryKeys) SetApmHostSum(v UsageBillableSummaryBody) { + o.ApmHostSum = &v +} + +// GetApmHostTop99p returns the ApmHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApmHostTop99p() UsageBillableSummaryBody { + if o == nil || o.ApmHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApmHostTop99p +} + +// GetApmHostTop99pOk returns a tuple with the ApmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApmHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApmHostTop99p == nil { + return nil, false + } + return o.ApmHostTop99p, true +} + +// HasApmHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApmHostTop99p() bool { + if o != nil && o.ApmHostTop99p != nil { + return true + } + + return false +} + +// SetApmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmHostTop99p field. +func (o *UsageBillableSummaryKeys) SetApmHostTop99p(v UsageBillableSummaryBody) { + o.ApmHostTop99p = &v +} + +// GetApmProfilerHostSum returns the ApmProfilerHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApmProfilerHostSum() UsageBillableSummaryBody { + if o == nil || o.ApmProfilerHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApmProfilerHostSum +} + +// GetApmProfilerHostSumOk returns a tuple with the ApmProfilerHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApmProfilerHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApmProfilerHostSum == nil { + return nil, false + } + return o.ApmProfilerHostSum, true +} + +// HasApmProfilerHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApmProfilerHostSum() bool { + if o != nil && o.ApmProfilerHostSum != nil { + return true + } + + return false +} + +// SetApmProfilerHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmProfilerHostSum field. +func (o *UsageBillableSummaryKeys) SetApmProfilerHostSum(v UsageBillableSummaryBody) { + o.ApmProfilerHostSum = &v +} + +// GetApmProfilerHostTop99p returns the ApmProfilerHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApmProfilerHostTop99p() UsageBillableSummaryBody { + if o == nil || o.ApmProfilerHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApmProfilerHostTop99p +} + +// GetApmProfilerHostTop99pOk returns a tuple with the ApmProfilerHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApmProfilerHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApmProfilerHostTop99p == nil { + return nil, false + } + return o.ApmProfilerHostTop99p, true +} + +// HasApmProfilerHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApmProfilerHostTop99p() bool { + if o != nil && o.ApmProfilerHostTop99p != nil { + return true + } + + return false +} + +// SetApmProfilerHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmProfilerHostTop99p field. +func (o *UsageBillableSummaryKeys) SetApmProfilerHostTop99p(v UsageBillableSummaryBody) { + o.ApmProfilerHostTop99p = &v +} + +// GetApmTraceSearchSum returns the ApmTraceSearchSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApmTraceSearchSum() UsageBillableSummaryBody { + if o == nil || o.ApmTraceSearchSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApmTraceSearchSum +} + +// GetApmTraceSearchSumOk returns a tuple with the ApmTraceSearchSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApmTraceSearchSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApmTraceSearchSum == nil { + return nil, false + } + return o.ApmTraceSearchSum, true +} + +// HasApmTraceSearchSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApmTraceSearchSum() bool { + if o != nil && o.ApmTraceSearchSum != nil { + return true + } + + return false +} + +// SetApmTraceSearchSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApmTraceSearchSum field. +func (o *UsageBillableSummaryKeys) SetApmTraceSearchSum(v UsageBillableSummaryBody) { + o.ApmTraceSearchSum = &v +} + +// GetApplicationSecurityHostSum returns the ApplicationSecurityHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetApplicationSecurityHostSum() UsageBillableSummaryBody { + if o == nil || o.ApplicationSecurityHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ApplicationSecurityHostSum +} + +// GetApplicationSecurityHostSumOk returns a tuple with the ApplicationSecurityHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetApplicationSecurityHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ApplicationSecurityHostSum == nil { + return nil, false + } + return o.ApplicationSecurityHostSum, true +} + +// HasApplicationSecurityHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasApplicationSecurityHostSum() bool { + if o != nil && o.ApplicationSecurityHostSum != nil { + return true + } + + return false +} + +// SetApplicationSecurityHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ApplicationSecurityHostSum field. +func (o *UsageBillableSummaryKeys) SetApplicationSecurityHostSum(v UsageBillableSummaryBody) { + o.ApplicationSecurityHostSum = &v +} + +// GetCiPipelineIndexedSpansSum returns the CiPipelineIndexedSpansSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCiPipelineIndexedSpansSum() UsageBillableSummaryBody { + if o == nil || o.CiPipelineIndexedSpansSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CiPipelineIndexedSpansSum +} + +// GetCiPipelineIndexedSpansSumOk returns a tuple with the CiPipelineIndexedSpansSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCiPipelineIndexedSpansSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CiPipelineIndexedSpansSum == nil { + return nil, false + } + return o.CiPipelineIndexedSpansSum, true +} + +// HasCiPipelineIndexedSpansSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCiPipelineIndexedSpansSum() bool { + if o != nil && o.CiPipelineIndexedSpansSum != nil { + return true + } + + return false +} + +// SetCiPipelineIndexedSpansSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiPipelineIndexedSpansSum field. +func (o *UsageBillableSummaryKeys) SetCiPipelineIndexedSpansSum(v UsageBillableSummaryBody) { + o.CiPipelineIndexedSpansSum = &v +} + +// GetCiPipelineMaximum returns the CiPipelineMaximum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCiPipelineMaximum() UsageBillableSummaryBody { + if o == nil || o.CiPipelineMaximum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CiPipelineMaximum +} + +// GetCiPipelineMaximumOk returns a tuple with the CiPipelineMaximum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCiPipelineMaximumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CiPipelineMaximum == nil { + return nil, false + } + return o.CiPipelineMaximum, true +} + +// HasCiPipelineMaximum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCiPipelineMaximum() bool { + if o != nil && o.CiPipelineMaximum != nil { + return true + } + + return false +} + +// SetCiPipelineMaximum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiPipelineMaximum field. +func (o *UsageBillableSummaryKeys) SetCiPipelineMaximum(v UsageBillableSummaryBody) { + o.CiPipelineMaximum = &v +} + +// GetCiPipelineSum returns the CiPipelineSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCiPipelineSum() UsageBillableSummaryBody { + if o == nil || o.CiPipelineSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CiPipelineSum +} + +// GetCiPipelineSumOk returns a tuple with the CiPipelineSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCiPipelineSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CiPipelineSum == nil { + return nil, false + } + return o.CiPipelineSum, true +} + +// HasCiPipelineSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCiPipelineSum() bool { + if o != nil && o.CiPipelineSum != nil { + return true + } + + return false +} + +// SetCiPipelineSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiPipelineSum field. +func (o *UsageBillableSummaryKeys) SetCiPipelineSum(v UsageBillableSummaryBody) { + o.CiPipelineSum = &v +} + +// GetCiTestIndexedSpansSum returns the CiTestIndexedSpansSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCiTestIndexedSpansSum() UsageBillableSummaryBody { + if o == nil || o.CiTestIndexedSpansSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CiTestIndexedSpansSum +} + +// GetCiTestIndexedSpansSumOk returns a tuple with the CiTestIndexedSpansSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCiTestIndexedSpansSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CiTestIndexedSpansSum == nil { + return nil, false + } + return o.CiTestIndexedSpansSum, true +} + +// HasCiTestIndexedSpansSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCiTestIndexedSpansSum() bool { + if o != nil && o.CiTestIndexedSpansSum != nil { + return true + } + + return false +} + +// SetCiTestIndexedSpansSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiTestIndexedSpansSum field. +func (o *UsageBillableSummaryKeys) SetCiTestIndexedSpansSum(v UsageBillableSummaryBody) { + o.CiTestIndexedSpansSum = &v +} + +// GetCiTestingMaximum returns the CiTestingMaximum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCiTestingMaximum() UsageBillableSummaryBody { + if o == nil || o.CiTestingMaximum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CiTestingMaximum +} + +// GetCiTestingMaximumOk returns a tuple with the CiTestingMaximum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCiTestingMaximumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CiTestingMaximum == nil { + return nil, false + } + return o.CiTestingMaximum, true +} + +// HasCiTestingMaximum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCiTestingMaximum() bool { + if o != nil && o.CiTestingMaximum != nil { + return true + } + + return false +} + +// SetCiTestingMaximum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiTestingMaximum field. +func (o *UsageBillableSummaryKeys) SetCiTestingMaximum(v UsageBillableSummaryBody) { + o.CiTestingMaximum = &v +} + +// GetCiTestingSum returns the CiTestingSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCiTestingSum() UsageBillableSummaryBody { + if o == nil || o.CiTestingSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CiTestingSum +} + +// GetCiTestingSumOk returns a tuple with the CiTestingSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCiTestingSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CiTestingSum == nil { + return nil, false + } + return o.CiTestingSum, true +} + +// HasCiTestingSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCiTestingSum() bool { + if o != nil && o.CiTestingSum != nil { + return true + } + + return false +} + +// SetCiTestingSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CiTestingSum field. +func (o *UsageBillableSummaryKeys) SetCiTestingSum(v UsageBillableSummaryBody) { + o.CiTestingSum = &v +} + +// GetCspmContainerSum returns the CspmContainerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCspmContainerSum() UsageBillableSummaryBody { + if o == nil || o.CspmContainerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CspmContainerSum +} + +// GetCspmContainerSumOk returns a tuple with the CspmContainerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCspmContainerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CspmContainerSum == nil { + return nil, false + } + return o.CspmContainerSum, true +} + +// HasCspmContainerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCspmContainerSum() bool { + if o != nil && o.CspmContainerSum != nil { + return true + } + + return false +} + +// SetCspmContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CspmContainerSum field. +func (o *UsageBillableSummaryKeys) SetCspmContainerSum(v UsageBillableSummaryBody) { + o.CspmContainerSum = &v +} + +// GetCspmHostSum returns the CspmHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCspmHostSum() UsageBillableSummaryBody { + if o == nil || o.CspmHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CspmHostSum +} + +// GetCspmHostSumOk returns a tuple with the CspmHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCspmHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CspmHostSum == nil { + return nil, false + } + return o.CspmHostSum, true +} + +// HasCspmHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCspmHostSum() bool { + if o != nil && o.CspmHostSum != nil { + return true + } + + return false +} + +// SetCspmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CspmHostSum field. +func (o *UsageBillableSummaryKeys) SetCspmHostSum(v UsageBillableSummaryBody) { + o.CspmHostSum = &v +} + +// GetCspmHostTop99p returns the CspmHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCspmHostTop99p() UsageBillableSummaryBody { + if o == nil || o.CspmHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CspmHostTop99p +} + +// GetCspmHostTop99pOk returns a tuple with the CspmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCspmHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CspmHostTop99p == nil { + return nil, false + } + return o.CspmHostTop99p, true +} + +// HasCspmHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCspmHostTop99p() bool { + if o != nil && o.CspmHostTop99p != nil { + return true + } + + return false +} + +// SetCspmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the CspmHostTop99p field. +func (o *UsageBillableSummaryKeys) SetCspmHostTop99p(v UsageBillableSummaryBody) { + o.CspmHostTop99p = &v +} + +// GetCustomEventSum returns the CustomEventSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCustomEventSum() UsageBillableSummaryBody { + if o == nil || o.CustomEventSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CustomEventSum +} + +// GetCustomEventSumOk returns a tuple with the CustomEventSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCustomEventSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CustomEventSum == nil { + return nil, false + } + return o.CustomEventSum, true +} + +// HasCustomEventSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCustomEventSum() bool { + if o != nil && o.CustomEventSum != nil { + return true + } + + return false +} + +// SetCustomEventSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CustomEventSum field. +func (o *UsageBillableSummaryKeys) SetCustomEventSum(v UsageBillableSummaryBody) { + o.CustomEventSum = &v +} + +// GetCwsContainerSum returns the CwsContainerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCwsContainerSum() UsageBillableSummaryBody { + if o == nil || o.CwsContainerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CwsContainerSum +} + +// GetCwsContainerSumOk returns a tuple with the CwsContainerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCwsContainerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CwsContainerSum == nil { + return nil, false + } + return o.CwsContainerSum, true +} + +// HasCwsContainerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCwsContainerSum() bool { + if o != nil && o.CwsContainerSum != nil { + return true + } + + return false +} + +// SetCwsContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CwsContainerSum field. +func (o *UsageBillableSummaryKeys) SetCwsContainerSum(v UsageBillableSummaryBody) { + o.CwsContainerSum = &v +} + +// GetCwsHostSum returns the CwsHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCwsHostSum() UsageBillableSummaryBody { + if o == nil || o.CwsHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CwsHostSum +} + +// GetCwsHostSumOk returns a tuple with the CwsHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCwsHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CwsHostSum == nil { + return nil, false + } + return o.CwsHostSum, true +} + +// HasCwsHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCwsHostSum() bool { + if o != nil && o.CwsHostSum != nil { + return true + } + + return false +} + +// SetCwsHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the CwsHostSum field. +func (o *UsageBillableSummaryKeys) SetCwsHostSum(v UsageBillableSummaryBody) { + o.CwsHostSum = &v +} + +// GetCwsHostTop99p returns the CwsHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetCwsHostTop99p() UsageBillableSummaryBody { + if o == nil || o.CwsHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.CwsHostTop99p +} + +// GetCwsHostTop99pOk returns a tuple with the CwsHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetCwsHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.CwsHostTop99p == nil { + return nil, false + } + return o.CwsHostTop99p, true +} + +// HasCwsHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasCwsHostTop99p() bool { + if o != nil && o.CwsHostTop99p != nil { + return true + } + + return false +} + +// SetCwsHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the CwsHostTop99p field. +func (o *UsageBillableSummaryKeys) SetCwsHostTop99p(v UsageBillableSummaryBody) { + o.CwsHostTop99p = &v +} + +// GetDbmHostSum returns the DbmHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetDbmHostSum() UsageBillableSummaryBody { + if o == nil || o.DbmHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.DbmHostSum +} + +// GetDbmHostSumOk returns a tuple with the DbmHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetDbmHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.DbmHostSum == nil { + return nil, false + } + return o.DbmHostSum, true +} + +// HasDbmHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasDbmHostSum() bool { + if o != nil && o.DbmHostSum != nil { + return true + } + + return false +} + +// SetDbmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmHostSum field. +func (o *UsageBillableSummaryKeys) SetDbmHostSum(v UsageBillableSummaryBody) { + o.DbmHostSum = &v +} + +// GetDbmHostTop99p returns the DbmHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetDbmHostTop99p() UsageBillableSummaryBody { + if o == nil || o.DbmHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.DbmHostTop99p +} + +// GetDbmHostTop99pOk returns a tuple with the DbmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetDbmHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.DbmHostTop99p == nil { + return nil, false + } + return o.DbmHostTop99p, true +} + +// HasDbmHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasDbmHostTop99p() bool { + if o != nil && o.DbmHostTop99p != nil { + return true + } + + return false +} + +// SetDbmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmHostTop99p field. +func (o *UsageBillableSummaryKeys) SetDbmHostTop99p(v UsageBillableSummaryBody) { + o.DbmHostTop99p = &v +} + +// GetDbmNormalizedQueriesAverage returns the DbmNormalizedQueriesAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesAverage() UsageBillableSummaryBody { + if o == nil || o.DbmNormalizedQueriesAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.DbmNormalizedQueriesAverage +} + +// GetDbmNormalizedQueriesAverageOk returns a tuple with the DbmNormalizedQueriesAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.DbmNormalizedQueriesAverage == nil { + return nil, false + } + return o.DbmNormalizedQueriesAverage, true +} + +// HasDbmNormalizedQueriesAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasDbmNormalizedQueriesAverage() bool { + if o != nil && o.DbmNormalizedQueriesAverage != nil { + return true + } + + return false +} + +// SetDbmNormalizedQueriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmNormalizedQueriesAverage field. +func (o *UsageBillableSummaryKeys) SetDbmNormalizedQueriesAverage(v UsageBillableSummaryBody) { + o.DbmNormalizedQueriesAverage = &v +} + +// GetDbmNormalizedQueriesSum returns the DbmNormalizedQueriesSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesSum() UsageBillableSummaryBody { + if o == nil || o.DbmNormalizedQueriesSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.DbmNormalizedQueriesSum +} + +// GetDbmNormalizedQueriesSumOk returns a tuple with the DbmNormalizedQueriesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetDbmNormalizedQueriesSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.DbmNormalizedQueriesSum == nil { + return nil, false + } + return o.DbmNormalizedQueriesSum, true +} + +// HasDbmNormalizedQueriesSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasDbmNormalizedQueriesSum() bool { + if o != nil && o.DbmNormalizedQueriesSum != nil { + return true + } + + return false +} + +// SetDbmNormalizedQueriesSum gets a reference to the given UsageBillableSummaryBody and assigns it to the DbmNormalizedQueriesSum field. +func (o *UsageBillableSummaryKeys) SetDbmNormalizedQueriesSum(v UsageBillableSummaryBody) { + o.DbmNormalizedQueriesSum = &v +} + +// GetFargateContainerApmAndProfilerAverage returns the FargateContainerApmAndProfilerAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerAverage() UsageBillableSummaryBody { + if o == nil || o.FargateContainerApmAndProfilerAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.FargateContainerApmAndProfilerAverage +} + +// GetFargateContainerApmAndProfilerAverageOk returns a tuple with the FargateContainerApmAndProfilerAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.FargateContainerApmAndProfilerAverage == nil { + return nil, false + } + return o.FargateContainerApmAndProfilerAverage, true +} + +// HasFargateContainerApmAndProfilerAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasFargateContainerApmAndProfilerAverage() bool { + if o != nil && o.FargateContainerApmAndProfilerAverage != nil { + return true + } + + return false +} + +// SetFargateContainerApmAndProfilerAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerApmAndProfilerAverage field. +func (o *UsageBillableSummaryKeys) SetFargateContainerApmAndProfilerAverage(v UsageBillableSummaryBody) { + o.FargateContainerApmAndProfilerAverage = &v +} + +// GetFargateContainerApmAndProfilerSum returns the FargateContainerApmAndProfilerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerSum() UsageBillableSummaryBody { + if o == nil || o.FargateContainerApmAndProfilerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.FargateContainerApmAndProfilerSum +} + +// GetFargateContainerApmAndProfilerSumOk returns a tuple with the FargateContainerApmAndProfilerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetFargateContainerApmAndProfilerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.FargateContainerApmAndProfilerSum == nil { + return nil, false + } + return o.FargateContainerApmAndProfilerSum, true +} + +// HasFargateContainerApmAndProfilerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasFargateContainerApmAndProfilerSum() bool { + if o != nil && o.FargateContainerApmAndProfilerSum != nil { + return true + } + + return false +} + +// SetFargateContainerApmAndProfilerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerApmAndProfilerSum field. +func (o *UsageBillableSummaryKeys) SetFargateContainerApmAndProfilerSum(v UsageBillableSummaryBody) { + o.FargateContainerApmAndProfilerSum = &v +} + +// GetFargateContainerAverage returns the FargateContainerAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetFargateContainerAverage() UsageBillableSummaryBody { + if o == nil || o.FargateContainerAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.FargateContainerAverage +} + +// GetFargateContainerAverageOk returns a tuple with the FargateContainerAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetFargateContainerAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.FargateContainerAverage == nil { + return nil, false + } + return o.FargateContainerAverage, true +} + +// HasFargateContainerAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasFargateContainerAverage() bool { + if o != nil && o.FargateContainerAverage != nil { + return true + } + + return false +} + +// SetFargateContainerAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerAverage field. +func (o *UsageBillableSummaryKeys) SetFargateContainerAverage(v UsageBillableSummaryBody) { + o.FargateContainerAverage = &v +} + +// GetFargateContainerProfilerAverage returns the FargateContainerProfilerAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerAverage() UsageBillableSummaryBody { + if o == nil || o.FargateContainerProfilerAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.FargateContainerProfilerAverage +} + +// GetFargateContainerProfilerAverageOk returns a tuple with the FargateContainerProfilerAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.FargateContainerProfilerAverage == nil { + return nil, false + } + return o.FargateContainerProfilerAverage, true +} + +// HasFargateContainerProfilerAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasFargateContainerProfilerAverage() bool { + if o != nil && o.FargateContainerProfilerAverage != nil { + return true + } + + return false +} + +// SetFargateContainerProfilerAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerProfilerAverage field. +func (o *UsageBillableSummaryKeys) SetFargateContainerProfilerAverage(v UsageBillableSummaryBody) { + o.FargateContainerProfilerAverage = &v +} + +// GetFargateContainerProfilerSum returns the FargateContainerProfilerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerSum() UsageBillableSummaryBody { + if o == nil || o.FargateContainerProfilerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.FargateContainerProfilerSum +} + +// GetFargateContainerProfilerSumOk returns a tuple with the FargateContainerProfilerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetFargateContainerProfilerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.FargateContainerProfilerSum == nil { + return nil, false + } + return o.FargateContainerProfilerSum, true +} + +// HasFargateContainerProfilerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasFargateContainerProfilerSum() bool { + if o != nil && o.FargateContainerProfilerSum != nil { + return true + } + + return false +} + +// SetFargateContainerProfilerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerProfilerSum field. +func (o *UsageBillableSummaryKeys) SetFargateContainerProfilerSum(v UsageBillableSummaryBody) { + o.FargateContainerProfilerSum = &v +} + +// GetFargateContainerSum returns the FargateContainerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetFargateContainerSum() UsageBillableSummaryBody { + if o == nil || o.FargateContainerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.FargateContainerSum +} + +// GetFargateContainerSumOk returns a tuple with the FargateContainerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetFargateContainerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.FargateContainerSum == nil { + return nil, false + } + return o.FargateContainerSum, true +} + +// HasFargateContainerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasFargateContainerSum() bool { + if o != nil && o.FargateContainerSum != nil { + return true + } + + return false +} + +// SetFargateContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the FargateContainerSum field. +func (o *UsageBillableSummaryKeys) SetFargateContainerSum(v UsageBillableSummaryBody) { + o.FargateContainerSum = &v +} + +// GetIncidentManagementMaximum returns the IncidentManagementMaximum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetIncidentManagementMaximum() UsageBillableSummaryBody { + if o == nil || o.IncidentManagementMaximum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.IncidentManagementMaximum +} + +// GetIncidentManagementMaximumOk returns a tuple with the IncidentManagementMaximum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetIncidentManagementMaximumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.IncidentManagementMaximum == nil { + return nil, false + } + return o.IncidentManagementMaximum, true +} + +// HasIncidentManagementMaximum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasIncidentManagementMaximum() bool { + if o != nil && o.IncidentManagementMaximum != nil { + return true + } + + return false +} + +// SetIncidentManagementMaximum gets a reference to the given UsageBillableSummaryBody and assigns it to the IncidentManagementMaximum field. +func (o *UsageBillableSummaryKeys) SetIncidentManagementMaximum(v UsageBillableSummaryBody) { + o.IncidentManagementMaximum = &v +} + +// GetIncidentManagementSum returns the IncidentManagementSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetIncidentManagementSum() UsageBillableSummaryBody { + if o == nil || o.IncidentManagementSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.IncidentManagementSum +} + +// GetIncidentManagementSumOk returns a tuple with the IncidentManagementSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetIncidentManagementSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.IncidentManagementSum == nil { + return nil, false + } + return o.IncidentManagementSum, true +} + +// HasIncidentManagementSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasIncidentManagementSum() bool { + if o != nil && o.IncidentManagementSum != nil { + return true + } + + return false +} + +// SetIncidentManagementSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IncidentManagementSum field. +func (o *UsageBillableSummaryKeys) SetIncidentManagementSum(v UsageBillableSummaryBody) { + o.IncidentManagementSum = &v +} + +// GetInfraAndApmHostSum returns the InfraAndApmHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetInfraAndApmHostSum() UsageBillableSummaryBody { + if o == nil || o.InfraAndApmHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.InfraAndApmHostSum +} + +// GetInfraAndApmHostSumOk returns a tuple with the InfraAndApmHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetInfraAndApmHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.InfraAndApmHostSum == nil { + return nil, false + } + return o.InfraAndApmHostSum, true +} + +// HasInfraAndApmHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasInfraAndApmHostSum() bool { + if o != nil && o.InfraAndApmHostSum != nil { + return true + } + + return false +} + +// SetInfraAndApmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraAndApmHostSum field. +func (o *UsageBillableSummaryKeys) SetInfraAndApmHostSum(v UsageBillableSummaryBody) { + o.InfraAndApmHostSum = &v +} + +// GetInfraAndApmHostTop99p returns the InfraAndApmHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetInfraAndApmHostTop99p() UsageBillableSummaryBody { + if o == nil || o.InfraAndApmHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.InfraAndApmHostTop99p +} + +// GetInfraAndApmHostTop99pOk returns a tuple with the InfraAndApmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetInfraAndApmHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.InfraAndApmHostTop99p == nil { + return nil, false + } + return o.InfraAndApmHostTop99p, true +} + +// HasInfraAndApmHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasInfraAndApmHostTop99p() bool { + if o != nil && o.InfraAndApmHostTop99p != nil { + return true + } + + return false +} + +// SetInfraAndApmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraAndApmHostTop99p field. +func (o *UsageBillableSummaryKeys) SetInfraAndApmHostTop99p(v UsageBillableSummaryBody) { + o.InfraAndApmHostTop99p = &v +} + +// GetInfraContainerSum returns the InfraContainerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetInfraContainerSum() UsageBillableSummaryBody { + if o == nil || o.InfraContainerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.InfraContainerSum +} + +// GetInfraContainerSumOk returns a tuple with the InfraContainerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetInfraContainerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.InfraContainerSum == nil { + return nil, false + } + return o.InfraContainerSum, true +} + +// HasInfraContainerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasInfraContainerSum() bool { + if o != nil && o.InfraContainerSum != nil { + return true + } + + return false +} + +// SetInfraContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraContainerSum field. +func (o *UsageBillableSummaryKeys) SetInfraContainerSum(v UsageBillableSummaryBody) { + o.InfraContainerSum = &v +} + +// GetInfraHostSum returns the InfraHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetInfraHostSum() UsageBillableSummaryBody { + if o == nil || o.InfraHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.InfraHostSum +} + +// GetInfraHostSumOk returns a tuple with the InfraHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetInfraHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.InfraHostSum == nil { + return nil, false + } + return o.InfraHostSum, true +} + +// HasInfraHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasInfraHostSum() bool { + if o != nil && o.InfraHostSum != nil { + return true + } + + return false +} + +// SetInfraHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraHostSum field. +func (o *UsageBillableSummaryKeys) SetInfraHostSum(v UsageBillableSummaryBody) { + o.InfraHostSum = &v +} + +// GetInfraHostTop99p returns the InfraHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetInfraHostTop99p() UsageBillableSummaryBody { + if o == nil || o.InfraHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.InfraHostTop99p +} + +// GetInfraHostTop99pOk returns a tuple with the InfraHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetInfraHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.InfraHostTop99p == nil { + return nil, false + } + return o.InfraHostTop99p, true +} + +// HasInfraHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasInfraHostTop99p() bool { + if o != nil && o.InfraHostTop99p != nil { + return true + } + + return false +} + +// SetInfraHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the InfraHostTop99p field. +func (o *UsageBillableSummaryKeys) SetInfraHostTop99p(v UsageBillableSummaryBody) { + o.InfraHostTop99p = &v +} + +// GetIngestedSpansSum returns the IngestedSpansSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetIngestedSpansSum() UsageBillableSummaryBody { + if o == nil || o.IngestedSpansSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.IngestedSpansSum +} + +// GetIngestedSpansSumOk returns a tuple with the IngestedSpansSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetIngestedSpansSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.IngestedSpansSum == nil { + return nil, false + } + return o.IngestedSpansSum, true +} + +// HasIngestedSpansSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasIngestedSpansSum() bool { + if o != nil && o.IngestedSpansSum != nil { + return true + } + + return false +} + +// SetIngestedSpansSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IngestedSpansSum field. +func (o *UsageBillableSummaryKeys) SetIngestedSpansSum(v UsageBillableSummaryBody) { + o.IngestedSpansSum = &v +} + +// GetIngestedTimeseriesAverage returns the IngestedTimeseriesAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesAverage() UsageBillableSummaryBody { + if o == nil || o.IngestedTimeseriesAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.IngestedTimeseriesAverage +} + +// GetIngestedTimeseriesAverageOk returns a tuple with the IngestedTimeseriesAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.IngestedTimeseriesAverage == nil { + return nil, false + } + return o.IngestedTimeseriesAverage, true +} + +// HasIngestedTimeseriesAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasIngestedTimeseriesAverage() bool { + if o != nil && o.IngestedTimeseriesAverage != nil { + return true + } + + return false +} + +// SetIngestedTimeseriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the IngestedTimeseriesAverage field. +func (o *UsageBillableSummaryKeys) SetIngestedTimeseriesAverage(v UsageBillableSummaryBody) { + o.IngestedTimeseriesAverage = &v +} + +// GetIngestedTimeseriesSum returns the IngestedTimeseriesSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesSum() UsageBillableSummaryBody { + if o == nil || o.IngestedTimeseriesSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.IngestedTimeseriesSum +} + +// GetIngestedTimeseriesSumOk returns a tuple with the IngestedTimeseriesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetIngestedTimeseriesSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.IngestedTimeseriesSum == nil { + return nil, false + } + return o.IngestedTimeseriesSum, true +} + +// HasIngestedTimeseriesSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasIngestedTimeseriesSum() bool { + if o != nil && o.IngestedTimeseriesSum != nil { + return true + } + + return false +} + +// SetIngestedTimeseriesSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IngestedTimeseriesSum field. +func (o *UsageBillableSummaryKeys) SetIngestedTimeseriesSum(v UsageBillableSummaryBody) { + o.IngestedTimeseriesSum = &v +} + +// GetIotSum returns the IotSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetIotSum() UsageBillableSummaryBody { + if o == nil || o.IotSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.IotSum +} + +// GetIotSumOk returns a tuple with the IotSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetIotSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.IotSum == nil { + return nil, false + } + return o.IotSum, true +} + +// HasIotSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasIotSum() bool { + if o != nil && o.IotSum != nil { + return true + } + + return false +} + +// SetIotSum gets a reference to the given UsageBillableSummaryBody and assigns it to the IotSum field. +func (o *UsageBillableSummaryKeys) SetIotSum(v UsageBillableSummaryBody) { + o.IotSum = &v +} + +// GetIotTop99p returns the IotTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetIotTop99p() UsageBillableSummaryBody { + if o == nil || o.IotTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.IotTop99p +} + +// GetIotTop99pOk returns a tuple with the IotTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetIotTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.IotTop99p == nil { + return nil, false + } + return o.IotTop99p, true +} + +// HasIotTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasIotTop99p() bool { + if o != nil && o.IotTop99p != nil { + return true + } + + return false +} + +// SetIotTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the IotTop99p field. +func (o *UsageBillableSummaryKeys) SetIotTop99p(v UsageBillableSummaryBody) { + o.IotTop99p = &v +} + +// GetLambdaFunctionAverage returns the LambdaFunctionAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLambdaFunctionAverage() UsageBillableSummaryBody { + if o == nil || o.LambdaFunctionAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LambdaFunctionAverage +} + +// GetLambdaFunctionAverageOk returns a tuple with the LambdaFunctionAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLambdaFunctionAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LambdaFunctionAverage == nil { + return nil, false + } + return o.LambdaFunctionAverage, true +} + +// HasLambdaFunctionAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLambdaFunctionAverage() bool { + if o != nil && o.LambdaFunctionAverage != nil { + return true + } + + return false +} + +// SetLambdaFunctionAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the LambdaFunctionAverage field. +func (o *UsageBillableSummaryKeys) SetLambdaFunctionAverage(v UsageBillableSummaryBody) { + o.LambdaFunctionAverage = &v +} + +// GetLambdaFunctionSum returns the LambdaFunctionSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLambdaFunctionSum() UsageBillableSummaryBody { + if o == nil || o.LambdaFunctionSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LambdaFunctionSum +} + +// GetLambdaFunctionSumOk returns a tuple with the LambdaFunctionSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLambdaFunctionSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LambdaFunctionSum == nil { + return nil, false + } + return o.LambdaFunctionSum, true +} + +// HasLambdaFunctionSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLambdaFunctionSum() bool { + if o != nil && o.LambdaFunctionSum != nil { + return true + } + + return false +} + +// SetLambdaFunctionSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LambdaFunctionSum field. +func (o *UsageBillableSummaryKeys) SetLambdaFunctionSum(v UsageBillableSummaryBody) { + o.LambdaFunctionSum = &v +} + +// GetLogsIndexed15daySum returns the LogsIndexed15daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed15daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed15daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed15daySum +} + +// GetLogsIndexed15daySumOk returns a tuple with the LogsIndexed15daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed15daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed15daySum == nil { + return nil, false + } + return o.LogsIndexed15daySum, true +} + +// HasLogsIndexed15daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed15daySum() bool { + if o != nil && o.LogsIndexed15daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed15daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed15daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed15daySum(v UsageBillableSummaryBody) { + o.LogsIndexed15daySum = &v +} + +// GetLogsIndexed180daySum returns the LogsIndexed180daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed180daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed180daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed180daySum +} + +// GetLogsIndexed180daySumOk returns a tuple with the LogsIndexed180daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed180daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed180daySum == nil { + return nil, false + } + return o.LogsIndexed180daySum, true +} + +// HasLogsIndexed180daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed180daySum() bool { + if o != nil && o.LogsIndexed180daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed180daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed180daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed180daySum(v UsageBillableSummaryBody) { + o.LogsIndexed180daySum = &v +} + +// GetLogsIndexed30daySum returns the LogsIndexed30daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed30daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed30daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed30daySum +} + +// GetLogsIndexed30daySumOk returns a tuple with the LogsIndexed30daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed30daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed30daySum == nil { + return nil, false + } + return o.LogsIndexed30daySum, true +} + +// HasLogsIndexed30daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed30daySum() bool { + if o != nil && o.LogsIndexed30daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed30daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed30daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed30daySum(v UsageBillableSummaryBody) { + o.LogsIndexed30daySum = &v +} + +// GetLogsIndexed360daySum returns the LogsIndexed360daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed360daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed360daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed360daySum +} + +// GetLogsIndexed360daySumOk returns a tuple with the LogsIndexed360daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed360daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed360daySum == nil { + return nil, false + } + return o.LogsIndexed360daySum, true +} + +// HasLogsIndexed360daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed360daySum() bool { + if o != nil && o.LogsIndexed360daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed360daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed360daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed360daySum(v UsageBillableSummaryBody) { + o.LogsIndexed360daySum = &v +} + +// GetLogsIndexed3daySum returns the LogsIndexed3daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed3daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed3daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed3daySum +} + +// GetLogsIndexed3daySumOk returns a tuple with the LogsIndexed3daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed3daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed3daySum == nil { + return nil, false + } + return o.LogsIndexed3daySum, true +} + +// HasLogsIndexed3daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed3daySum() bool { + if o != nil && o.LogsIndexed3daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed3daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed3daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed3daySum(v UsageBillableSummaryBody) { + o.LogsIndexed3daySum = &v +} + +// GetLogsIndexed45daySum returns the LogsIndexed45daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed45daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed45daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed45daySum +} + +// GetLogsIndexed45daySumOk returns a tuple with the LogsIndexed45daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed45daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed45daySum == nil { + return nil, false + } + return o.LogsIndexed45daySum, true +} + +// HasLogsIndexed45daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed45daySum() bool { + if o != nil && o.LogsIndexed45daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed45daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed45daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed45daySum(v UsageBillableSummaryBody) { + o.LogsIndexed45daySum = &v +} + +// GetLogsIndexed60daySum returns the LogsIndexed60daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed60daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed60daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed60daySum +} + +// GetLogsIndexed60daySumOk returns a tuple with the LogsIndexed60daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed60daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed60daySum == nil { + return nil, false + } + return o.LogsIndexed60daySum, true +} + +// HasLogsIndexed60daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed60daySum() bool { + if o != nil && o.LogsIndexed60daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed60daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed60daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed60daySum(v UsageBillableSummaryBody) { + o.LogsIndexed60daySum = &v +} + +// GetLogsIndexed7daySum returns the LogsIndexed7daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed7daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed7daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed7daySum +} + +// GetLogsIndexed7daySumOk returns a tuple with the LogsIndexed7daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed7daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed7daySum == nil { + return nil, false + } + return o.LogsIndexed7daySum, true +} + +// HasLogsIndexed7daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed7daySum() bool { + if o != nil && o.LogsIndexed7daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed7daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed7daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed7daySum(v UsageBillableSummaryBody) { + o.LogsIndexed7daySum = &v +} + +// GetLogsIndexed90daySum returns the LogsIndexed90daySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexed90daySum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexed90daySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexed90daySum +} + +// GetLogsIndexed90daySumOk returns a tuple with the LogsIndexed90daySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexed90daySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexed90daySum == nil { + return nil, false + } + return o.LogsIndexed90daySum, true +} + +// HasLogsIndexed90daySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexed90daySum() bool { + if o != nil && o.LogsIndexed90daySum != nil { + return true + } + + return false +} + +// SetLogsIndexed90daySum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexed90daySum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexed90daySum(v UsageBillableSummaryBody) { + o.LogsIndexed90daySum = &v +} + +// GetLogsIndexedCustomRetentionSum returns the LogsIndexedCustomRetentionSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexedCustomRetentionSum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexedCustomRetentionSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexedCustomRetentionSum +} + +// GetLogsIndexedCustomRetentionSumOk returns a tuple with the LogsIndexedCustomRetentionSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexedCustomRetentionSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexedCustomRetentionSum == nil { + return nil, false + } + return o.LogsIndexedCustomRetentionSum, true +} + +// HasLogsIndexedCustomRetentionSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexedCustomRetentionSum() bool { + if o != nil && o.LogsIndexedCustomRetentionSum != nil { + return true + } + + return false +} + +// SetLogsIndexedCustomRetentionSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexedCustomRetentionSum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexedCustomRetentionSum(v UsageBillableSummaryBody) { + o.LogsIndexedCustomRetentionSum = &v +} + +// GetLogsIndexedSum returns the LogsIndexedSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIndexedSum() UsageBillableSummaryBody { + if o == nil || o.LogsIndexedSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIndexedSum +} + +// GetLogsIndexedSumOk returns a tuple with the LogsIndexedSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIndexedSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIndexedSum == nil { + return nil, false + } + return o.LogsIndexedSum, true +} + +// HasLogsIndexedSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIndexedSum() bool { + if o != nil && o.LogsIndexedSum != nil { + return true + } + + return false +} + +// SetLogsIndexedSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIndexedSum field. +func (o *UsageBillableSummaryKeys) SetLogsIndexedSum(v UsageBillableSummaryBody) { + o.LogsIndexedSum = &v +} + +// GetLogsIngestedSum returns the LogsIngestedSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetLogsIngestedSum() UsageBillableSummaryBody { + if o == nil || o.LogsIngestedSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.LogsIngestedSum +} + +// GetLogsIngestedSumOk returns a tuple with the LogsIngestedSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetLogsIngestedSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.LogsIngestedSum == nil { + return nil, false + } + return o.LogsIngestedSum, true +} + +// HasLogsIngestedSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasLogsIngestedSum() bool { + if o != nil && o.LogsIngestedSum != nil { + return true + } + + return false +} + +// SetLogsIngestedSum gets a reference to the given UsageBillableSummaryBody and assigns it to the LogsIngestedSum field. +func (o *UsageBillableSummaryKeys) SetLogsIngestedSum(v UsageBillableSummaryBody) { + o.LogsIngestedSum = &v +} + +// GetNetworkDeviceSum returns the NetworkDeviceSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetNetworkDeviceSum() UsageBillableSummaryBody { + if o == nil || o.NetworkDeviceSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.NetworkDeviceSum +} + +// GetNetworkDeviceSumOk returns a tuple with the NetworkDeviceSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetNetworkDeviceSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.NetworkDeviceSum == nil { + return nil, false + } + return o.NetworkDeviceSum, true +} + +// HasNetworkDeviceSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasNetworkDeviceSum() bool { + if o != nil && o.NetworkDeviceSum != nil { + return true + } + + return false +} + +// SetNetworkDeviceSum gets a reference to the given UsageBillableSummaryBody and assigns it to the NetworkDeviceSum field. +func (o *UsageBillableSummaryKeys) SetNetworkDeviceSum(v UsageBillableSummaryBody) { + o.NetworkDeviceSum = &v +} + +// GetNetworkDeviceTop99p returns the NetworkDeviceTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetNetworkDeviceTop99p() UsageBillableSummaryBody { + if o == nil || o.NetworkDeviceTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.NetworkDeviceTop99p +} + +// GetNetworkDeviceTop99pOk returns a tuple with the NetworkDeviceTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetNetworkDeviceTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.NetworkDeviceTop99p == nil { + return nil, false + } + return o.NetworkDeviceTop99p, true +} + +// HasNetworkDeviceTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasNetworkDeviceTop99p() bool { + if o != nil && o.NetworkDeviceTop99p != nil { + return true + } + + return false +} + +// SetNetworkDeviceTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the NetworkDeviceTop99p field. +func (o *UsageBillableSummaryKeys) SetNetworkDeviceTop99p(v UsageBillableSummaryBody) { + o.NetworkDeviceTop99p = &v +} + +// GetNpmFlowSum returns the NpmFlowSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetNpmFlowSum() UsageBillableSummaryBody { + if o == nil || o.NpmFlowSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.NpmFlowSum +} + +// GetNpmFlowSumOk returns a tuple with the NpmFlowSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetNpmFlowSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.NpmFlowSum == nil { + return nil, false + } + return o.NpmFlowSum, true +} + +// HasNpmFlowSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasNpmFlowSum() bool { + if o != nil && o.NpmFlowSum != nil { + return true + } + + return false +} + +// SetNpmFlowSum gets a reference to the given UsageBillableSummaryBody and assigns it to the NpmFlowSum field. +func (o *UsageBillableSummaryKeys) SetNpmFlowSum(v UsageBillableSummaryBody) { + o.NpmFlowSum = &v +} + +// GetNpmHostSum returns the NpmHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetNpmHostSum() UsageBillableSummaryBody { + if o == nil || o.NpmHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.NpmHostSum +} + +// GetNpmHostSumOk returns a tuple with the NpmHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetNpmHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.NpmHostSum == nil { + return nil, false + } + return o.NpmHostSum, true +} + +// HasNpmHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasNpmHostSum() bool { + if o != nil && o.NpmHostSum != nil { + return true + } + + return false +} + +// SetNpmHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the NpmHostSum field. +func (o *UsageBillableSummaryKeys) SetNpmHostSum(v UsageBillableSummaryBody) { + o.NpmHostSum = &v +} + +// GetNpmHostTop99p returns the NpmHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetNpmHostTop99p() UsageBillableSummaryBody { + if o == nil || o.NpmHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.NpmHostTop99p +} + +// GetNpmHostTop99pOk returns a tuple with the NpmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetNpmHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.NpmHostTop99p == nil { + return nil, false + } + return o.NpmHostTop99p, true +} + +// HasNpmHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasNpmHostTop99p() bool { + if o != nil && o.NpmHostTop99p != nil { + return true + } + + return false +} + +// SetNpmHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the NpmHostTop99p field. +func (o *UsageBillableSummaryKeys) SetNpmHostTop99p(v UsageBillableSummaryBody) { + o.NpmHostTop99p = &v +} + +// GetObservabilityPipelineSum returns the ObservabilityPipelineSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetObservabilityPipelineSum() UsageBillableSummaryBody { + if o == nil || o.ObservabilityPipelineSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ObservabilityPipelineSum +} + +// GetObservabilityPipelineSumOk returns a tuple with the ObservabilityPipelineSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetObservabilityPipelineSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ObservabilityPipelineSum == nil { + return nil, false + } + return o.ObservabilityPipelineSum, true +} + +// HasObservabilityPipelineSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasObservabilityPipelineSum() bool { + if o != nil && o.ObservabilityPipelineSum != nil { + return true + } + + return false +} + +// SetObservabilityPipelineSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ObservabilityPipelineSum field. +func (o *UsageBillableSummaryKeys) SetObservabilityPipelineSum(v UsageBillableSummaryBody) { + o.ObservabilityPipelineSum = &v +} + +// GetOnlineArchiveSum returns the OnlineArchiveSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetOnlineArchiveSum() UsageBillableSummaryBody { + if o == nil || o.OnlineArchiveSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.OnlineArchiveSum +} + +// GetOnlineArchiveSumOk returns a tuple with the OnlineArchiveSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetOnlineArchiveSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.OnlineArchiveSum == nil { + return nil, false + } + return o.OnlineArchiveSum, true +} + +// HasOnlineArchiveSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasOnlineArchiveSum() bool { + if o != nil && o.OnlineArchiveSum != nil { + return true + } + + return false +} + +// SetOnlineArchiveSum gets a reference to the given UsageBillableSummaryBody and assigns it to the OnlineArchiveSum field. +func (o *UsageBillableSummaryKeys) SetOnlineArchiveSum(v UsageBillableSummaryBody) { + o.OnlineArchiveSum = &v +} + +// GetProfContainerSum returns the ProfContainerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetProfContainerSum() UsageBillableSummaryBody { + if o == nil || o.ProfContainerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ProfContainerSum +} + +// GetProfContainerSumOk returns a tuple with the ProfContainerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetProfContainerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ProfContainerSum == nil { + return nil, false + } + return o.ProfContainerSum, true +} + +// HasProfContainerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasProfContainerSum() bool { + if o != nil && o.ProfContainerSum != nil { + return true + } + + return false +} + +// SetProfContainerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ProfContainerSum field. +func (o *UsageBillableSummaryKeys) SetProfContainerSum(v UsageBillableSummaryBody) { + o.ProfContainerSum = &v +} + +// GetProfHostSum returns the ProfHostSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetProfHostSum() UsageBillableSummaryBody { + if o == nil || o.ProfHostSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ProfHostSum +} + +// GetProfHostSumOk returns a tuple with the ProfHostSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetProfHostSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ProfHostSum == nil { + return nil, false + } + return o.ProfHostSum, true +} + +// HasProfHostSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasProfHostSum() bool { + if o != nil && o.ProfHostSum != nil { + return true + } + + return false +} + +// SetProfHostSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ProfHostSum field. +func (o *UsageBillableSummaryKeys) SetProfHostSum(v UsageBillableSummaryBody) { + o.ProfHostSum = &v +} + +// GetProfHostTop99p returns the ProfHostTop99p field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetProfHostTop99p() UsageBillableSummaryBody { + if o == nil || o.ProfHostTop99p == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ProfHostTop99p +} + +// GetProfHostTop99pOk returns a tuple with the ProfHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetProfHostTop99pOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ProfHostTop99p == nil { + return nil, false + } + return o.ProfHostTop99p, true +} + +// HasProfHostTop99p returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasProfHostTop99p() bool { + if o != nil && o.ProfHostTop99p != nil { + return true + } + + return false +} + +// SetProfHostTop99p gets a reference to the given UsageBillableSummaryBody and assigns it to the ProfHostTop99p field. +func (o *UsageBillableSummaryKeys) SetProfHostTop99p(v UsageBillableSummaryBody) { + o.ProfHostTop99p = &v +} + +// GetRumLiteSum returns the RumLiteSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetRumLiteSum() UsageBillableSummaryBody { + if o == nil || o.RumLiteSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.RumLiteSum +} + +// GetRumLiteSumOk returns a tuple with the RumLiteSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetRumLiteSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.RumLiteSum == nil { + return nil, false + } + return o.RumLiteSum, true +} + +// HasRumLiteSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasRumLiteSum() bool { + if o != nil && o.RumLiteSum != nil { + return true + } + + return false +} + +// SetRumLiteSum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumLiteSum field. +func (o *UsageBillableSummaryKeys) SetRumLiteSum(v UsageBillableSummaryBody) { + o.RumLiteSum = &v +} + +// GetRumReplaySum returns the RumReplaySum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetRumReplaySum() UsageBillableSummaryBody { + if o == nil || o.RumReplaySum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.RumReplaySum +} + +// GetRumReplaySumOk returns a tuple with the RumReplaySum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetRumReplaySumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.RumReplaySum == nil { + return nil, false + } + return o.RumReplaySum, true +} + +// HasRumReplaySum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasRumReplaySum() bool { + if o != nil && o.RumReplaySum != nil { + return true + } + + return false +} + +// SetRumReplaySum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumReplaySum field. +func (o *UsageBillableSummaryKeys) SetRumReplaySum(v UsageBillableSummaryBody) { + o.RumReplaySum = &v +} + +// GetRumSum returns the RumSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetRumSum() UsageBillableSummaryBody { + if o == nil || o.RumSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.RumSum +} + +// GetRumSumOk returns a tuple with the RumSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetRumSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.RumSum == nil { + return nil, false + } + return o.RumSum, true +} + +// HasRumSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasRumSum() bool { + if o != nil && o.RumSum != nil { + return true + } + + return false +} + +// SetRumSum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumSum field. +func (o *UsageBillableSummaryKeys) SetRumSum(v UsageBillableSummaryBody) { + o.RumSum = &v +} + +// GetRumUnitsSum returns the RumUnitsSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetRumUnitsSum() UsageBillableSummaryBody { + if o == nil || o.RumUnitsSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.RumUnitsSum +} + +// GetRumUnitsSumOk returns a tuple with the RumUnitsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetRumUnitsSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.RumUnitsSum == nil { + return nil, false + } + return o.RumUnitsSum, true +} + +// HasRumUnitsSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasRumUnitsSum() bool { + if o != nil && o.RumUnitsSum != nil { + return true + } + + return false +} + +// SetRumUnitsSum gets a reference to the given UsageBillableSummaryBody and assigns it to the RumUnitsSum field. +func (o *UsageBillableSummaryKeys) SetRumUnitsSum(v UsageBillableSummaryBody) { + o.RumUnitsSum = &v +} + +// GetSensitiveDataScannerSum returns the SensitiveDataScannerSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetSensitiveDataScannerSum() UsageBillableSummaryBody { + if o == nil || o.SensitiveDataScannerSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.SensitiveDataScannerSum +} + +// GetSensitiveDataScannerSumOk returns a tuple with the SensitiveDataScannerSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetSensitiveDataScannerSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.SensitiveDataScannerSum == nil { + return nil, false + } + return o.SensitiveDataScannerSum, true +} + +// HasSensitiveDataScannerSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasSensitiveDataScannerSum() bool { + if o != nil && o.SensitiveDataScannerSum != nil { + return true + } + + return false +} + +// SetSensitiveDataScannerSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SensitiveDataScannerSum field. +func (o *UsageBillableSummaryKeys) SetSensitiveDataScannerSum(v UsageBillableSummaryBody) { + o.SensitiveDataScannerSum = &v +} + +// GetServerlessInvocationSum returns the ServerlessInvocationSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetServerlessInvocationSum() UsageBillableSummaryBody { + if o == nil || o.ServerlessInvocationSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.ServerlessInvocationSum +} + +// GetServerlessInvocationSumOk returns a tuple with the ServerlessInvocationSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetServerlessInvocationSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.ServerlessInvocationSum == nil { + return nil, false + } + return o.ServerlessInvocationSum, true +} + +// HasServerlessInvocationSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasServerlessInvocationSum() bool { + if o != nil && o.ServerlessInvocationSum != nil { + return true + } + + return false +} + +// SetServerlessInvocationSum gets a reference to the given UsageBillableSummaryBody and assigns it to the ServerlessInvocationSum field. +func (o *UsageBillableSummaryKeys) SetServerlessInvocationSum(v UsageBillableSummaryBody) { + o.ServerlessInvocationSum = &v +} + +// GetSiemSum returns the SiemSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetSiemSum() UsageBillableSummaryBody { + if o == nil || o.SiemSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.SiemSum +} + +// GetSiemSumOk returns a tuple with the SiemSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetSiemSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.SiemSum == nil { + return nil, false + } + return o.SiemSum, true +} + +// HasSiemSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasSiemSum() bool { + if o != nil && o.SiemSum != nil { + return true + } + + return false +} + +// SetSiemSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SiemSum field. +func (o *UsageBillableSummaryKeys) SetSiemSum(v UsageBillableSummaryBody) { + o.SiemSum = &v +} + +// GetStandardTimeseriesAverage returns the StandardTimeseriesAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetStandardTimeseriesAverage() UsageBillableSummaryBody { + if o == nil || o.StandardTimeseriesAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.StandardTimeseriesAverage +} + +// GetStandardTimeseriesAverageOk returns a tuple with the StandardTimeseriesAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetStandardTimeseriesAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.StandardTimeseriesAverage == nil { + return nil, false + } + return o.StandardTimeseriesAverage, true +} + +// HasStandardTimeseriesAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasStandardTimeseriesAverage() bool { + if o != nil && o.StandardTimeseriesAverage != nil { + return true + } + + return false +} + +// SetStandardTimeseriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the StandardTimeseriesAverage field. +func (o *UsageBillableSummaryKeys) SetStandardTimeseriesAverage(v UsageBillableSummaryBody) { + o.StandardTimeseriesAverage = &v +} + +// GetSyntheticsApiTestsSum returns the SyntheticsApiTestsSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetSyntheticsApiTestsSum() UsageBillableSummaryBody { + if o == nil || o.SyntheticsApiTestsSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.SyntheticsApiTestsSum +} + +// GetSyntheticsApiTestsSumOk returns a tuple with the SyntheticsApiTestsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetSyntheticsApiTestsSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.SyntheticsApiTestsSum == nil { + return nil, false + } + return o.SyntheticsApiTestsSum, true +} + +// HasSyntheticsApiTestsSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasSyntheticsApiTestsSum() bool { + if o != nil && o.SyntheticsApiTestsSum != nil { + return true + } + + return false +} + +// SetSyntheticsApiTestsSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SyntheticsApiTestsSum field. +func (o *UsageBillableSummaryKeys) SetSyntheticsApiTestsSum(v UsageBillableSummaryBody) { + o.SyntheticsApiTestsSum = &v +} + +// GetSyntheticsBrowserChecksSum returns the SyntheticsBrowserChecksSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetSyntheticsBrowserChecksSum() UsageBillableSummaryBody { + if o == nil || o.SyntheticsBrowserChecksSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.SyntheticsBrowserChecksSum +} + +// GetSyntheticsBrowserChecksSumOk returns a tuple with the SyntheticsBrowserChecksSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetSyntheticsBrowserChecksSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.SyntheticsBrowserChecksSum == nil { + return nil, false + } + return o.SyntheticsBrowserChecksSum, true +} + +// HasSyntheticsBrowserChecksSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasSyntheticsBrowserChecksSum() bool { + if o != nil && o.SyntheticsBrowserChecksSum != nil { + return true + } + + return false +} + +// SetSyntheticsBrowserChecksSum gets a reference to the given UsageBillableSummaryBody and assigns it to the SyntheticsBrowserChecksSum field. +func (o *UsageBillableSummaryKeys) SetSyntheticsBrowserChecksSum(v UsageBillableSummaryBody) { + o.SyntheticsBrowserChecksSum = &v +} + +// GetTimeseriesAverage returns the TimeseriesAverage field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetTimeseriesAverage() UsageBillableSummaryBody { + if o == nil || o.TimeseriesAverage == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.TimeseriesAverage +} + +// GetTimeseriesAverageOk returns a tuple with the TimeseriesAverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetTimeseriesAverageOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.TimeseriesAverage == nil { + return nil, false + } + return o.TimeseriesAverage, true +} + +// HasTimeseriesAverage returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasTimeseriesAverage() bool { + if o != nil && o.TimeseriesAverage != nil { + return true + } + + return false +} + +// SetTimeseriesAverage gets a reference to the given UsageBillableSummaryBody and assigns it to the TimeseriesAverage field. +func (o *UsageBillableSummaryKeys) SetTimeseriesAverage(v UsageBillableSummaryBody) { + o.TimeseriesAverage = &v +} + +// GetTimeseriesSum returns the TimeseriesSum field value if set, zero value otherwise. +func (o *UsageBillableSummaryKeys) GetTimeseriesSum() UsageBillableSummaryBody { + if o == nil || o.TimeseriesSum == nil { + var ret UsageBillableSummaryBody + return ret + } + return *o.TimeseriesSum +} + +// GetTimeseriesSumOk returns a tuple with the TimeseriesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryKeys) GetTimeseriesSumOk() (*UsageBillableSummaryBody, bool) { + if o == nil || o.TimeseriesSum == nil { + return nil, false + } + return o.TimeseriesSum, true +} + +// HasTimeseriesSum returns a boolean if a field has been set. +func (o *UsageBillableSummaryKeys) HasTimeseriesSum() bool { + if o != nil && o.TimeseriesSum != nil { + return true + } + + return false +} + +// SetTimeseriesSum gets a reference to the given UsageBillableSummaryBody and assigns it to the TimeseriesSum field. +func (o *UsageBillableSummaryKeys) SetTimeseriesSum(v UsageBillableSummaryBody) { + o.TimeseriesSum = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageBillableSummaryKeys) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ApmFargateAverage != nil { + toSerialize["apm_fargate_average"] = o.ApmFargateAverage + } + if o.ApmFargateSum != nil { + toSerialize["apm_fargate_sum"] = o.ApmFargateSum + } + if o.ApmHostSum != nil { + toSerialize["apm_host_sum"] = o.ApmHostSum + } + if o.ApmHostTop99p != nil { + toSerialize["apm_host_top99p"] = o.ApmHostTop99p + } + if o.ApmProfilerHostSum != nil { + toSerialize["apm_profiler_host_sum"] = o.ApmProfilerHostSum + } + if o.ApmProfilerHostTop99p != nil { + toSerialize["apm_profiler_host_top99p"] = o.ApmProfilerHostTop99p + } + if o.ApmTraceSearchSum != nil { + toSerialize["apm_trace_search_sum"] = o.ApmTraceSearchSum + } + if o.ApplicationSecurityHostSum != nil { + toSerialize["application_security_host_sum"] = o.ApplicationSecurityHostSum + } + if o.CiPipelineIndexedSpansSum != nil { + toSerialize["ci_pipeline_indexed_spans_sum"] = o.CiPipelineIndexedSpansSum + } + if o.CiPipelineMaximum != nil { + toSerialize["ci_pipeline_maximum"] = o.CiPipelineMaximum + } + if o.CiPipelineSum != nil { + toSerialize["ci_pipeline_sum"] = o.CiPipelineSum + } + if o.CiTestIndexedSpansSum != nil { + toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum + } + if o.CiTestingMaximum != nil { + toSerialize["ci_testing_maximum"] = o.CiTestingMaximum + } + if o.CiTestingSum != nil { + toSerialize["ci_testing_sum"] = o.CiTestingSum + } + if o.CspmContainerSum != nil { + toSerialize["cspm_container_sum"] = o.CspmContainerSum + } + if o.CspmHostSum != nil { + toSerialize["cspm_host_sum"] = o.CspmHostSum + } + if o.CspmHostTop99p != nil { + toSerialize["cspm_host_top99p"] = o.CspmHostTop99p + } + if o.CustomEventSum != nil { + toSerialize["custom_event_sum"] = o.CustomEventSum + } + if o.CwsContainerSum != nil { + toSerialize["cws_container_sum"] = o.CwsContainerSum + } + if o.CwsHostSum != nil { + toSerialize["cws_host_sum"] = o.CwsHostSum + } + if o.CwsHostTop99p != nil { + toSerialize["cws_host_top99p"] = o.CwsHostTop99p + } + if o.DbmHostSum != nil { + toSerialize["dbm_host_sum"] = o.DbmHostSum + } + if o.DbmHostTop99p != nil { + toSerialize["dbm_host_top99p"] = o.DbmHostTop99p + } + if o.DbmNormalizedQueriesAverage != nil { + toSerialize["dbm_normalized_queries_average"] = o.DbmNormalizedQueriesAverage + } + if o.DbmNormalizedQueriesSum != nil { + toSerialize["dbm_normalized_queries_sum"] = o.DbmNormalizedQueriesSum + } + if o.FargateContainerApmAndProfilerAverage != nil { + toSerialize["fargate_container_apm_and_profiler_average"] = o.FargateContainerApmAndProfilerAverage + } + if o.FargateContainerApmAndProfilerSum != nil { + toSerialize["fargate_container_apm_and_profiler_sum"] = o.FargateContainerApmAndProfilerSum + } + if o.FargateContainerAverage != nil { + toSerialize["fargate_container_average"] = o.FargateContainerAverage + } + if o.FargateContainerProfilerAverage != nil { + toSerialize["fargate_container_profiler_average"] = o.FargateContainerProfilerAverage + } + if o.FargateContainerProfilerSum != nil { + toSerialize["fargate_container_profiler_sum"] = o.FargateContainerProfilerSum + } + if o.FargateContainerSum != nil { + toSerialize["fargate_container_sum"] = o.FargateContainerSum + } + if o.IncidentManagementMaximum != nil { + toSerialize["incident_management_maximum"] = o.IncidentManagementMaximum + } + if o.IncidentManagementSum != nil { + toSerialize["incident_management_sum"] = o.IncidentManagementSum + } + if o.InfraAndApmHostSum != nil { + toSerialize["infra_and_apm_host_sum"] = o.InfraAndApmHostSum + } + if o.InfraAndApmHostTop99p != nil { + toSerialize["infra_and_apm_host_top99p"] = o.InfraAndApmHostTop99p + } + if o.InfraContainerSum != nil { + toSerialize["infra_container_sum"] = o.InfraContainerSum + } + if o.InfraHostSum != nil { + toSerialize["infra_host_sum"] = o.InfraHostSum + } + if o.InfraHostTop99p != nil { + toSerialize["infra_host_top99p"] = o.InfraHostTop99p + } + if o.IngestedSpansSum != nil { + toSerialize["ingested_spans_sum"] = o.IngestedSpansSum + } + if o.IngestedTimeseriesAverage != nil { + toSerialize["ingested_timeseries_average"] = o.IngestedTimeseriesAverage + } + if o.IngestedTimeseriesSum != nil { + toSerialize["ingested_timeseries_sum"] = o.IngestedTimeseriesSum + } + if o.IotSum != nil { + toSerialize["iot_sum"] = o.IotSum + } + if o.IotTop99p != nil { + toSerialize["iot_top99p"] = o.IotTop99p + } + if o.LambdaFunctionAverage != nil { + toSerialize["lambda_function_average"] = o.LambdaFunctionAverage + } + if o.LambdaFunctionSum != nil { + toSerialize["lambda_function_sum"] = o.LambdaFunctionSum + } + if o.LogsIndexed15daySum != nil { + toSerialize["logs_indexed_15day_sum"] = o.LogsIndexed15daySum + } + if o.LogsIndexed180daySum != nil { + toSerialize["logs_indexed_180day_sum"] = o.LogsIndexed180daySum + } + if o.LogsIndexed30daySum != nil { + toSerialize["logs_indexed_30day_sum"] = o.LogsIndexed30daySum + } + if o.LogsIndexed360daySum != nil { + toSerialize["logs_indexed_360day_sum"] = o.LogsIndexed360daySum + } + if o.LogsIndexed3daySum != nil { + toSerialize["logs_indexed_3day_sum"] = o.LogsIndexed3daySum + } + if o.LogsIndexed45daySum != nil { + toSerialize["logs_indexed_45day_sum"] = o.LogsIndexed45daySum + } + if o.LogsIndexed60daySum != nil { + toSerialize["logs_indexed_60day_sum"] = o.LogsIndexed60daySum + } + if o.LogsIndexed7daySum != nil { + toSerialize["logs_indexed_7day_sum"] = o.LogsIndexed7daySum + } + if o.LogsIndexed90daySum != nil { + toSerialize["logs_indexed_90day_sum"] = o.LogsIndexed90daySum + } + if o.LogsIndexedCustomRetentionSum != nil { + toSerialize["logs_indexed_custom_retention_sum"] = o.LogsIndexedCustomRetentionSum + } + if o.LogsIndexedSum != nil { + toSerialize["logs_indexed_sum"] = o.LogsIndexedSum + } + if o.LogsIngestedSum != nil { + toSerialize["logs_ingested_sum"] = o.LogsIngestedSum + } + if o.NetworkDeviceSum != nil { + toSerialize["network_device_sum"] = o.NetworkDeviceSum + } + if o.NetworkDeviceTop99p != nil { + toSerialize["network_device_top99p"] = o.NetworkDeviceTop99p + } + if o.NpmFlowSum != nil { + toSerialize["npm_flow_sum"] = o.NpmFlowSum + } + if o.NpmHostSum != nil { + toSerialize["npm_host_sum"] = o.NpmHostSum + } + if o.NpmHostTop99p != nil { + toSerialize["npm_host_top99p"] = o.NpmHostTop99p + } + if o.ObservabilityPipelineSum != nil { + toSerialize["observability_pipeline_sum"] = o.ObservabilityPipelineSum + } + if o.OnlineArchiveSum != nil { + toSerialize["online_archive_sum"] = o.OnlineArchiveSum + } + if o.ProfContainerSum != nil { + toSerialize["prof_container_sum"] = o.ProfContainerSum + } + if o.ProfHostSum != nil { + toSerialize["prof_host_sum"] = o.ProfHostSum + } + if o.ProfHostTop99p != nil { + toSerialize["prof_host_top99p"] = o.ProfHostTop99p + } + if o.RumLiteSum != nil { + toSerialize["rum_lite_sum"] = o.RumLiteSum + } + if o.RumReplaySum != nil { + toSerialize["rum_replay_sum"] = o.RumReplaySum + } + if o.RumSum != nil { + toSerialize["rum_sum"] = o.RumSum + } + if o.RumUnitsSum != nil { + toSerialize["rum_units_sum"] = o.RumUnitsSum + } + if o.SensitiveDataScannerSum != nil { + toSerialize["sensitive_data_scanner_sum"] = o.SensitiveDataScannerSum + } + if o.ServerlessInvocationSum != nil { + toSerialize["serverless_invocation_sum"] = o.ServerlessInvocationSum + } + if o.SiemSum != nil { + toSerialize["siem_sum"] = o.SiemSum + } + if o.StandardTimeseriesAverage != nil { + toSerialize["standard_timeseries_average"] = o.StandardTimeseriesAverage + } + if o.SyntheticsApiTestsSum != nil { + toSerialize["synthetics_api_tests_sum"] = o.SyntheticsApiTestsSum + } + if o.SyntheticsBrowserChecksSum != nil { + toSerialize["synthetics_browser_checks_sum"] = o.SyntheticsBrowserChecksSum + } + if o.TimeseriesAverage != nil { + toSerialize["timeseries_average"] = o.TimeseriesAverage + } + if o.TimeseriesSum != nil { + toSerialize["timeseries_sum"] = o.TimeseriesSum + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageBillableSummaryKeys) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ApmFargateAverage *UsageBillableSummaryBody `json:"apm_fargate_average,omitempty"` + ApmFargateSum *UsageBillableSummaryBody `json:"apm_fargate_sum,omitempty"` + ApmHostSum *UsageBillableSummaryBody `json:"apm_host_sum,omitempty"` + ApmHostTop99p *UsageBillableSummaryBody `json:"apm_host_top99p,omitempty"` + ApmProfilerHostSum *UsageBillableSummaryBody `json:"apm_profiler_host_sum,omitempty"` + ApmProfilerHostTop99p *UsageBillableSummaryBody `json:"apm_profiler_host_top99p,omitempty"` + ApmTraceSearchSum *UsageBillableSummaryBody `json:"apm_trace_search_sum,omitempty"` + ApplicationSecurityHostSum *UsageBillableSummaryBody `json:"application_security_host_sum,omitempty"` + CiPipelineIndexedSpansSum *UsageBillableSummaryBody `json:"ci_pipeline_indexed_spans_sum,omitempty"` + CiPipelineMaximum *UsageBillableSummaryBody `json:"ci_pipeline_maximum,omitempty"` + CiPipelineSum *UsageBillableSummaryBody `json:"ci_pipeline_sum,omitempty"` + CiTestIndexedSpansSum *UsageBillableSummaryBody `json:"ci_test_indexed_spans_sum,omitempty"` + CiTestingMaximum *UsageBillableSummaryBody `json:"ci_testing_maximum,omitempty"` + CiTestingSum *UsageBillableSummaryBody `json:"ci_testing_sum,omitempty"` + CspmContainerSum *UsageBillableSummaryBody `json:"cspm_container_sum,omitempty"` + CspmHostSum *UsageBillableSummaryBody `json:"cspm_host_sum,omitempty"` + CspmHostTop99p *UsageBillableSummaryBody `json:"cspm_host_top99p,omitempty"` + CustomEventSum *UsageBillableSummaryBody `json:"custom_event_sum,omitempty"` + CwsContainerSum *UsageBillableSummaryBody `json:"cws_container_sum,omitempty"` + CwsHostSum *UsageBillableSummaryBody `json:"cws_host_sum,omitempty"` + CwsHostTop99p *UsageBillableSummaryBody `json:"cws_host_top99p,omitempty"` + DbmHostSum *UsageBillableSummaryBody `json:"dbm_host_sum,omitempty"` + DbmHostTop99p *UsageBillableSummaryBody `json:"dbm_host_top99p,omitempty"` + DbmNormalizedQueriesAverage *UsageBillableSummaryBody `json:"dbm_normalized_queries_average,omitempty"` + DbmNormalizedQueriesSum *UsageBillableSummaryBody `json:"dbm_normalized_queries_sum,omitempty"` + FargateContainerApmAndProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_average,omitempty"` + FargateContainerApmAndProfilerSum *UsageBillableSummaryBody `json:"fargate_container_apm_and_profiler_sum,omitempty"` + FargateContainerAverage *UsageBillableSummaryBody `json:"fargate_container_average,omitempty"` + FargateContainerProfilerAverage *UsageBillableSummaryBody `json:"fargate_container_profiler_average,omitempty"` + FargateContainerProfilerSum *UsageBillableSummaryBody `json:"fargate_container_profiler_sum,omitempty"` + FargateContainerSum *UsageBillableSummaryBody `json:"fargate_container_sum,omitempty"` + IncidentManagementMaximum *UsageBillableSummaryBody `json:"incident_management_maximum,omitempty"` + IncidentManagementSum *UsageBillableSummaryBody `json:"incident_management_sum,omitempty"` + InfraAndApmHostSum *UsageBillableSummaryBody `json:"infra_and_apm_host_sum,omitempty"` + InfraAndApmHostTop99p *UsageBillableSummaryBody `json:"infra_and_apm_host_top99p,omitempty"` + InfraContainerSum *UsageBillableSummaryBody `json:"infra_container_sum,omitempty"` + InfraHostSum *UsageBillableSummaryBody `json:"infra_host_sum,omitempty"` + InfraHostTop99p *UsageBillableSummaryBody `json:"infra_host_top99p,omitempty"` + IngestedSpansSum *UsageBillableSummaryBody `json:"ingested_spans_sum,omitempty"` + IngestedTimeseriesAverage *UsageBillableSummaryBody `json:"ingested_timeseries_average,omitempty"` + IngestedTimeseriesSum *UsageBillableSummaryBody `json:"ingested_timeseries_sum,omitempty"` + IotSum *UsageBillableSummaryBody `json:"iot_sum,omitempty"` + IotTop99p *UsageBillableSummaryBody `json:"iot_top99p,omitempty"` + LambdaFunctionAverage *UsageBillableSummaryBody `json:"lambda_function_average,omitempty"` + LambdaFunctionSum *UsageBillableSummaryBody `json:"lambda_function_sum,omitempty"` + LogsIndexed15daySum *UsageBillableSummaryBody `json:"logs_indexed_15day_sum,omitempty"` + LogsIndexed180daySum *UsageBillableSummaryBody `json:"logs_indexed_180day_sum,omitempty"` + LogsIndexed30daySum *UsageBillableSummaryBody `json:"logs_indexed_30day_sum,omitempty"` + LogsIndexed360daySum *UsageBillableSummaryBody `json:"logs_indexed_360day_sum,omitempty"` + LogsIndexed3daySum *UsageBillableSummaryBody `json:"logs_indexed_3day_sum,omitempty"` + LogsIndexed45daySum *UsageBillableSummaryBody `json:"logs_indexed_45day_sum,omitempty"` + LogsIndexed60daySum *UsageBillableSummaryBody `json:"logs_indexed_60day_sum,omitempty"` + LogsIndexed7daySum *UsageBillableSummaryBody `json:"logs_indexed_7day_sum,omitempty"` + LogsIndexed90daySum *UsageBillableSummaryBody `json:"logs_indexed_90day_sum,omitempty"` + LogsIndexedCustomRetentionSum *UsageBillableSummaryBody `json:"logs_indexed_custom_retention_sum,omitempty"` + LogsIndexedSum *UsageBillableSummaryBody `json:"logs_indexed_sum,omitempty"` + LogsIngestedSum *UsageBillableSummaryBody `json:"logs_ingested_sum,omitempty"` + NetworkDeviceSum *UsageBillableSummaryBody `json:"network_device_sum,omitempty"` + NetworkDeviceTop99p *UsageBillableSummaryBody `json:"network_device_top99p,omitempty"` + NpmFlowSum *UsageBillableSummaryBody `json:"npm_flow_sum,omitempty"` + NpmHostSum *UsageBillableSummaryBody `json:"npm_host_sum,omitempty"` + NpmHostTop99p *UsageBillableSummaryBody `json:"npm_host_top99p,omitempty"` + ObservabilityPipelineSum *UsageBillableSummaryBody `json:"observability_pipeline_sum,omitempty"` + OnlineArchiveSum *UsageBillableSummaryBody `json:"online_archive_sum,omitempty"` + ProfContainerSum *UsageBillableSummaryBody `json:"prof_container_sum,omitempty"` + ProfHostSum *UsageBillableSummaryBody `json:"prof_host_sum,omitempty"` + ProfHostTop99p *UsageBillableSummaryBody `json:"prof_host_top99p,omitempty"` + RumLiteSum *UsageBillableSummaryBody `json:"rum_lite_sum,omitempty"` + RumReplaySum *UsageBillableSummaryBody `json:"rum_replay_sum,omitempty"` + RumSum *UsageBillableSummaryBody `json:"rum_sum,omitempty"` + RumUnitsSum *UsageBillableSummaryBody `json:"rum_units_sum,omitempty"` + SensitiveDataScannerSum *UsageBillableSummaryBody `json:"sensitive_data_scanner_sum,omitempty"` + ServerlessInvocationSum *UsageBillableSummaryBody `json:"serverless_invocation_sum,omitempty"` + SiemSum *UsageBillableSummaryBody `json:"siem_sum,omitempty"` + StandardTimeseriesAverage *UsageBillableSummaryBody `json:"standard_timeseries_average,omitempty"` + SyntheticsApiTestsSum *UsageBillableSummaryBody `json:"synthetics_api_tests_sum,omitempty"` + SyntheticsBrowserChecksSum *UsageBillableSummaryBody `json:"synthetics_browser_checks_sum,omitempty"` + TimeseriesAverage *UsageBillableSummaryBody `json:"timeseries_average,omitempty"` + TimeseriesSum *UsageBillableSummaryBody `json:"timeseries_sum,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.ApmFargateAverage != nil && all.ApmFargateAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmFargateAverage = all.ApmFargateAverage + if all.ApmFargateSum != nil && all.ApmFargateSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmFargateSum = all.ApmFargateSum + if all.ApmHostSum != nil && all.ApmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmHostSum = all.ApmHostSum + if all.ApmHostTop99p != nil && all.ApmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmHostTop99p = all.ApmHostTop99p + if all.ApmProfilerHostSum != nil && all.ApmProfilerHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmProfilerHostSum = all.ApmProfilerHostSum + if all.ApmProfilerHostTop99p != nil && all.ApmProfilerHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmProfilerHostTop99p = all.ApmProfilerHostTop99p + if all.ApmTraceSearchSum != nil && all.ApmTraceSearchSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApmTraceSearchSum = all.ApmTraceSearchSum + if all.ApplicationSecurityHostSum != nil && all.ApplicationSecurityHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ApplicationSecurityHostSum = all.ApplicationSecurityHostSum + if all.CiPipelineIndexedSpansSum != nil && all.CiPipelineIndexedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum + if all.CiPipelineMaximum != nil && all.CiPipelineMaximum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CiPipelineMaximum = all.CiPipelineMaximum + if all.CiPipelineSum != nil && all.CiPipelineSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CiPipelineSum = all.CiPipelineSum + if all.CiTestIndexedSpansSum != nil && all.CiTestIndexedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum + if all.CiTestingMaximum != nil && all.CiTestingMaximum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CiTestingMaximum = all.CiTestingMaximum + if all.CiTestingSum != nil && all.CiTestingSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CiTestingSum = all.CiTestingSum + if all.CspmContainerSum != nil && all.CspmContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CspmContainerSum = all.CspmContainerSum + if all.CspmHostSum != nil && all.CspmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CspmHostSum = all.CspmHostSum + if all.CspmHostTop99p != nil && all.CspmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CspmHostTop99p = all.CspmHostTop99p + if all.CustomEventSum != nil && all.CustomEventSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CustomEventSum = all.CustomEventSum + if all.CwsContainerSum != nil && all.CwsContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CwsContainerSum = all.CwsContainerSum + if all.CwsHostSum != nil && all.CwsHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CwsHostSum = all.CwsHostSum + if all.CwsHostTop99p != nil && all.CwsHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CwsHostTop99p = all.CwsHostTop99p + if all.DbmHostSum != nil && all.DbmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.DbmHostSum = all.DbmHostSum + if all.DbmHostTop99p != nil && all.DbmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.DbmHostTop99p = all.DbmHostTop99p + if all.DbmNormalizedQueriesAverage != nil && all.DbmNormalizedQueriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.DbmNormalizedQueriesAverage = all.DbmNormalizedQueriesAverage + if all.DbmNormalizedQueriesSum != nil && all.DbmNormalizedQueriesSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.DbmNormalizedQueriesSum = all.DbmNormalizedQueriesSum + if all.FargateContainerApmAndProfilerAverage != nil && all.FargateContainerApmAndProfilerAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.FargateContainerApmAndProfilerAverage = all.FargateContainerApmAndProfilerAverage + if all.FargateContainerApmAndProfilerSum != nil && all.FargateContainerApmAndProfilerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.FargateContainerApmAndProfilerSum = all.FargateContainerApmAndProfilerSum + if all.FargateContainerAverage != nil && all.FargateContainerAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.FargateContainerAverage = all.FargateContainerAverage + if all.FargateContainerProfilerAverage != nil && all.FargateContainerProfilerAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.FargateContainerProfilerAverage = all.FargateContainerProfilerAverage + if all.FargateContainerProfilerSum != nil && all.FargateContainerProfilerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.FargateContainerProfilerSum = all.FargateContainerProfilerSum + if all.FargateContainerSum != nil && all.FargateContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.FargateContainerSum = all.FargateContainerSum + if all.IncidentManagementMaximum != nil && all.IncidentManagementMaximum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.IncidentManagementMaximum = all.IncidentManagementMaximum + if all.IncidentManagementSum != nil && all.IncidentManagementSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.IncidentManagementSum = all.IncidentManagementSum + if all.InfraAndApmHostSum != nil && all.InfraAndApmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.InfraAndApmHostSum = all.InfraAndApmHostSum + if all.InfraAndApmHostTop99p != nil && all.InfraAndApmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.InfraAndApmHostTop99p = all.InfraAndApmHostTop99p + if all.InfraContainerSum != nil && all.InfraContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.InfraContainerSum = all.InfraContainerSum + if all.InfraHostSum != nil && all.InfraHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.InfraHostSum = all.InfraHostSum + if all.InfraHostTop99p != nil && all.InfraHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.InfraHostTop99p = all.InfraHostTop99p + if all.IngestedSpansSum != nil && all.IngestedSpansSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.IngestedSpansSum = all.IngestedSpansSum + if all.IngestedTimeseriesAverage != nil && all.IngestedTimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.IngestedTimeseriesAverage = all.IngestedTimeseriesAverage + if all.IngestedTimeseriesSum != nil && all.IngestedTimeseriesSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.IngestedTimeseriesSum = all.IngestedTimeseriesSum + if all.IotSum != nil && all.IotSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.IotSum = all.IotSum + if all.IotTop99p != nil && all.IotTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.IotTop99p = all.IotTop99p + if all.LambdaFunctionAverage != nil && all.LambdaFunctionAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LambdaFunctionAverage = all.LambdaFunctionAverage + if all.LambdaFunctionSum != nil && all.LambdaFunctionSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LambdaFunctionSum = all.LambdaFunctionSum + if all.LogsIndexed15daySum != nil && all.LogsIndexed15daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed15daySum = all.LogsIndexed15daySum + if all.LogsIndexed180daySum != nil && all.LogsIndexed180daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed180daySum = all.LogsIndexed180daySum + if all.LogsIndexed30daySum != nil && all.LogsIndexed30daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed30daySum = all.LogsIndexed30daySum + if all.LogsIndexed360daySum != nil && all.LogsIndexed360daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed360daySum = all.LogsIndexed360daySum + if all.LogsIndexed3daySum != nil && all.LogsIndexed3daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed3daySum = all.LogsIndexed3daySum + if all.LogsIndexed45daySum != nil && all.LogsIndexed45daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed45daySum = all.LogsIndexed45daySum + if all.LogsIndexed60daySum != nil && all.LogsIndexed60daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed60daySum = all.LogsIndexed60daySum + if all.LogsIndexed7daySum != nil && all.LogsIndexed7daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed7daySum = all.LogsIndexed7daySum + if all.LogsIndexed90daySum != nil && all.LogsIndexed90daySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexed90daySum = all.LogsIndexed90daySum + if all.LogsIndexedCustomRetentionSum != nil && all.LogsIndexedCustomRetentionSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexedCustomRetentionSum = all.LogsIndexedCustomRetentionSum + if all.LogsIndexedSum != nil && all.LogsIndexedSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIndexedSum = all.LogsIndexedSum + if all.LogsIngestedSum != nil && all.LogsIngestedSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsIngestedSum = all.LogsIngestedSum + if all.NetworkDeviceSum != nil && all.NetworkDeviceSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkDeviceSum = all.NetworkDeviceSum + if all.NetworkDeviceTop99p != nil && all.NetworkDeviceTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NetworkDeviceTop99p = all.NetworkDeviceTop99p + if all.NpmFlowSum != nil && all.NpmFlowSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NpmFlowSum = all.NpmFlowSum + if all.NpmHostSum != nil && all.NpmHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NpmHostSum = all.NpmHostSum + if all.NpmHostTop99p != nil && all.NpmHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NpmHostTop99p = all.NpmHostTop99p + if all.ObservabilityPipelineSum != nil && all.ObservabilityPipelineSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ObservabilityPipelineSum = all.ObservabilityPipelineSum + if all.OnlineArchiveSum != nil && all.OnlineArchiveSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.OnlineArchiveSum = all.OnlineArchiveSum + if all.ProfContainerSum != nil && all.ProfContainerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfContainerSum = all.ProfContainerSum + if all.ProfHostSum != nil && all.ProfHostSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfHostSum = all.ProfHostSum + if all.ProfHostTop99p != nil && all.ProfHostTop99p.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ProfHostTop99p = all.ProfHostTop99p + if all.RumLiteSum != nil && all.RumLiteSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumLiteSum = all.RumLiteSum + if all.RumReplaySum != nil && all.RumReplaySum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumReplaySum = all.RumReplaySum + if all.RumSum != nil && all.RumSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumSum = all.RumSum + if all.RumUnitsSum != nil && all.RumUnitsSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.RumUnitsSum = all.RumUnitsSum + if all.SensitiveDataScannerSum != nil && all.SensitiveDataScannerSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SensitiveDataScannerSum = all.SensitiveDataScannerSum + if all.ServerlessInvocationSum != nil && all.ServerlessInvocationSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ServerlessInvocationSum = all.ServerlessInvocationSum + if all.SiemSum != nil && all.SiemSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SiemSum = all.SiemSum + if all.StandardTimeseriesAverage != nil && all.StandardTimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.StandardTimeseriesAverage = all.StandardTimeseriesAverage + if all.SyntheticsApiTestsSum != nil && all.SyntheticsApiTestsSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SyntheticsApiTestsSum = all.SyntheticsApiTestsSum + if all.SyntheticsBrowserChecksSum != nil && all.SyntheticsBrowserChecksSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SyntheticsBrowserChecksSum = all.SyntheticsBrowserChecksSum + if all.TimeseriesAverage != nil && all.TimeseriesAverage.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.TimeseriesAverage = all.TimeseriesAverage + if all.TimeseriesSum != nil && all.TimeseriesSum.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.TimeseriesSum = all.TimeseriesSum + return nil +} diff --git a/api/v1/datadog/model_usage_billable_summary_response.go b/api/v1/datadog/model_usage_billable_summary_response.go new file mode 100644 index 00000000000..bd8d7bd503c --- /dev/null +++ b/api/v1/datadog/model_usage_billable_summary_response.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 datadog + +import ( + "encoding/json" +) + +// UsageBillableSummaryResponse Response with monthly summary of data billed by Datadog. +type UsageBillableSummaryResponse struct { + // An array of objects regarding usage of billable summary. + Usage []UsageBillableSummaryHour `json:"usage,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{} +} + +// NewUsageBillableSummaryResponse instantiates a new UsageBillableSummaryResponse 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 NewUsageBillableSummaryResponse() *UsageBillableSummaryResponse { + this := UsageBillableSummaryResponse{} + return &this +} + +// NewUsageBillableSummaryResponseWithDefaults instantiates a new UsageBillableSummaryResponse 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 NewUsageBillableSummaryResponseWithDefaults() *UsageBillableSummaryResponse { + this := UsageBillableSummaryResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageBillableSummaryResponse) GetUsage() []UsageBillableSummaryHour { + if o == nil || o.Usage == nil { + var ret []UsageBillableSummaryHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageBillableSummaryResponse) GetUsageOk() (*[]UsageBillableSummaryHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageBillableSummaryResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageBillableSummaryHour and assigns it to the Usage field. +func (o *UsageBillableSummaryResponse) SetUsage(v []UsageBillableSummaryHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageBillableSummaryResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageBillableSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageBillableSummaryHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_ci_visibility_hour.go b/api/v1/datadog/model_usage_ci_visibility_hour.go new file mode 100644 index 00000000000..af8010eec77 --- /dev/null +++ b/api/v1/datadog/model_usage_ci_visibility_hour.go @@ -0,0 +1,297 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageCIVisibilityHour CI visibility usage in a given hour. +type UsageCIVisibilityHour struct { + // The number of spans for pipelines in the queried hour. + CiPipelineIndexedSpans *int32 `json:"ci_pipeline_indexed_spans,omitempty"` + // The number of spans for tests in the queried hour. + CiTestIndexedSpans *int32 `json:"ci_test_indexed_spans,omitempty"` + // Shows the total count of all active Git committers for Pipelines in the current month. A committer is active if they commit at least 3 times in a given month. + CiVisibilityPipelineCommitters *int32 `json:"ci_visibility_pipeline_committers,omitempty"` + // The total count of all active Git committers for tests in the current month. A committer is active if they commit at least 3 times in a given month. + CiVisibilityTestCommitters *int32 `json:"ci_visibility_test_committers,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageCIVisibilityHour instantiates a new UsageCIVisibilityHour 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 NewUsageCIVisibilityHour() *UsageCIVisibilityHour { + this := UsageCIVisibilityHour{} + return &this +} + +// NewUsageCIVisibilityHourWithDefaults instantiates a new UsageCIVisibilityHour 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 NewUsageCIVisibilityHourWithDefaults() *UsageCIVisibilityHour { + this := UsageCIVisibilityHour{} + return &this +} + +// GetCiPipelineIndexedSpans returns the CiPipelineIndexedSpans field value if set, zero value otherwise. +func (o *UsageCIVisibilityHour) GetCiPipelineIndexedSpans() int32 { + if o == nil || o.CiPipelineIndexedSpans == nil { + var ret int32 + return ret + } + return *o.CiPipelineIndexedSpans +} + +// GetCiPipelineIndexedSpansOk returns a tuple with the CiPipelineIndexedSpans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCIVisibilityHour) GetCiPipelineIndexedSpansOk() (*int32, bool) { + if o == nil || o.CiPipelineIndexedSpans == nil { + return nil, false + } + return o.CiPipelineIndexedSpans, true +} + +// HasCiPipelineIndexedSpans returns a boolean if a field has been set. +func (o *UsageCIVisibilityHour) HasCiPipelineIndexedSpans() bool { + if o != nil && o.CiPipelineIndexedSpans != nil { + return true + } + + return false +} + +// SetCiPipelineIndexedSpans gets a reference to the given int32 and assigns it to the CiPipelineIndexedSpans field. +func (o *UsageCIVisibilityHour) SetCiPipelineIndexedSpans(v int32) { + o.CiPipelineIndexedSpans = &v +} + +// GetCiTestIndexedSpans returns the CiTestIndexedSpans field value if set, zero value otherwise. +func (o *UsageCIVisibilityHour) GetCiTestIndexedSpans() int32 { + if o == nil || o.CiTestIndexedSpans == nil { + var ret int32 + return ret + } + return *o.CiTestIndexedSpans +} + +// GetCiTestIndexedSpansOk returns a tuple with the CiTestIndexedSpans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCIVisibilityHour) GetCiTestIndexedSpansOk() (*int32, bool) { + if o == nil || o.CiTestIndexedSpans == nil { + return nil, false + } + return o.CiTestIndexedSpans, true +} + +// HasCiTestIndexedSpans returns a boolean if a field has been set. +func (o *UsageCIVisibilityHour) HasCiTestIndexedSpans() bool { + if o != nil && o.CiTestIndexedSpans != nil { + return true + } + + return false +} + +// SetCiTestIndexedSpans gets a reference to the given int32 and assigns it to the CiTestIndexedSpans field. +func (o *UsageCIVisibilityHour) SetCiTestIndexedSpans(v int32) { + o.CiTestIndexedSpans = &v +} + +// GetCiVisibilityPipelineCommitters returns the CiVisibilityPipelineCommitters field value if set, zero value otherwise. +func (o *UsageCIVisibilityHour) GetCiVisibilityPipelineCommitters() int32 { + if o == nil || o.CiVisibilityPipelineCommitters == nil { + var ret int32 + return ret + } + return *o.CiVisibilityPipelineCommitters +} + +// GetCiVisibilityPipelineCommittersOk returns a tuple with the CiVisibilityPipelineCommitters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCIVisibilityHour) GetCiVisibilityPipelineCommittersOk() (*int32, bool) { + if o == nil || o.CiVisibilityPipelineCommitters == nil { + return nil, false + } + return o.CiVisibilityPipelineCommitters, true +} + +// HasCiVisibilityPipelineCommitters returns a boolean if a field has been set. +func (o *UsageCIVisibilityHour) HasCiVisibilityPipelineCommitters() bool { + if o != nil && o.CiVisibilityPipelineCommitters != nil { + return true + } + + return false +} + +// SetCiVisibilityPipelineCommitters gets a reference to the given int32 and assigns it to the CiVisibilityPipelineCommitters field. +func (o *UsageCIVisibilityHour) SetCiVisibilityPipelineCommitters(v int32) { + o.CiVisibilityPipelineCommitters = &v +} + +// GetCiVisibilityTestCommitters returns the CiVisibilityTestCommitters field value if set, zero value otherwise. +func (o *UsageCIVisibilityHour) GetCiVisibilityTestCommitters() int32 { + if o == nil || o.CiVisibilityTestCommitters == nil { + var ret int32 + return ret + } + return *o.CiVisibilityTestCommitters +} + +// GetCiVisibilityTestCommittersOk returns a tuple with the CiVisibilityTestCommitters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCIVisibilityHour) GetCiVisibilityTestCommittersOk() (*int32, bool) { + if o == nil || o.CiVisibilityTestCommitters == nil { + return nil, false + } + return o.CiVisibilityTestCommitters, true +} + +// HasCiVisibilityTestCommitters returns a boolean if a field has been set. +func (o *UsageCIVisibilityHour) HasCiVisibilityTestCommitters() bool { + if o != nil && o.CiVisibilityTestCommitters != nil { + return true + } + + return false +} + +// SetCiVisibilityTestCommitters gets a reference to the given int32 and assigns it to the CiVisibilityTestCommitters field. +func (o *UsageCIVisibilityHour) SetCiVisibilityTestCommitters(v int32) { + o.CiVisibilityTestCommitters = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageCIVisibilityHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCIVisibilityHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageCIVisibilityHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageCIVisibilityHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageCIVisibilityHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCIVisibilityHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageCIVisibilityHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageCIVisibilityHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCIVisibilityHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CiPipelineIndexedSpans != nil { + toSerialize["ci_pipeline_indexed_spans"] = o.CiPipelineIndexedSpans + } + if o.CiTestIndexedSpans != nil { + toSerialize["ci_test_indexed_spans"] = o.CiTestIndexedSpans + } + if o.CiVisibilityPipelineCommitters != nil { + toSerialize["ci_visibility_pipeline_committers"] = o.CiVisibilityPipelineCommitters + } + if o.CiVisibilityTestCommitters != nil { + toSerialize["ci_visibility_test_committers"] = o.CiVisibilityTestCommitters + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCIVisibilityHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CiPipelineIndexedSpans *int32 `json:"ci_pipeline_indexed_spans,omitempty"` + CiTestIndexedSpans *int32 `json:"ci_test_indexed_spans,omitempty"` + CiVisibilityPipelineCommitters *int32 `json:"ci_visibility_pipeline_committers,omitempty"` + CiVisibilityTestCommitters *int32 `json:"ci_visibility_test_committers,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CiPipelineIndexedSpans = all.CiPipelineIndexedSpans + o.CiTestIndexedSpans = all.CiTestIndexedSpans + o.CiVisibilityPipelineCommitters = all.CiVisibilityPipelineCommitters + o.CiVisibilityTestCommitters = all.CiVisibilityTestCommitters + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_ci_visibility_response.go b/api/v1/datadog/model_usage_ci_visibility_response.go new file mode 100644 index 00000000000..9bc8dd7deb1 --- /dev/null +++ b/api/v1/datadog/model_usage_ci_visibility_response.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 datadog + +import ( + "encoding/json" +) + +// UsageCIVisibilityResponse CI visibility usage response +type UsageCIVisibilityResponse struct { + // Response containing CI visibility usage. + Usage []UsageCIVisibilityHour `json:"usage,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{} +} + +// NewUsageCIVisibilityResponse instantiates a new UsageCIVisibilityResponse 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 NewUsageCIVisibilityResponse() *UsageCIVisibilityResponse { + this := UsageCIVisibilityResponse{} + return &this +} + +// NewUsageCIVisibilityResponseWithDefaults instantiates a new UsageCIVisibilityResponse 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 NewUsageCIVisibilityResponseWithDefaults() *UsageCIVisibilityResponse { + this := UsageCIVisibilityResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageCIVisibilityResponse) GetUsage() []UsageCIVisibilityHour { + if o == nil || o.Usage == nil { + var ret []UsageCIVisibilityHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCIVisibilityResponse) GetUsageOk() (*[]UsageCIVisibilityHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageCIVisibilityResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageCIVisibilityHour and assigns it to the Usage field. +func (o *UsageCIVisibilityResponse) SetUsage(v []UsageCIVisibilityHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCIVisibilityResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCIVisibilityResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageCIVisibilityHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_cloud_security_posture_management_hour.go b/api/v1/datadog/model_usage_cloud_security_posture_management_hour.go new file mode 100644 index 00000000000..4cb150323f2 --- /dev/null +++ b/api/v1/datadog/model_usage_cloud_security_posture_management_hour.go @@ -0,0 +1,437 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsageCloudSecurityPostureManagementHour Cloud Security Posture Management usage for a given organization for a given hour. +type UsageCloudSecurityPostureManagementHour struct { + // The number of Cloud Security Posture Management Azure app services hosts during a given hour. + AasHostCount common.NullableFloat64 `json:"aas_host_count,omitempty"` + // The number of Cloud Security Posture Management Azure hosts during a given hour. + AzureHostCount common.NullableFloat64 `json:"azure_host_count,omitempty"` + // The number of Cloud Security Posture Management hosts during a given hour. + ComplianceHostCount common.NullableFloat64 `json:"compliance_host_count,omitempty"` + // The total number of Cloud Security Posture Management containers during a given hour. + ContainerCount common.NullableFloat64 `json:"container_count,omitempty"` + // The total number of Cloud Security Posture Management hosts during a given hour. + HostCount common.NullableFloat64 `json:"host_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageCloudSecurityPostureManagementHour instantiates a new UsageCloudSecurityPostureManagementHour 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 NewUsageCloudSecurityPostureManagementHour() *UsageCloudSecurityPostureManagementHour { + this := UsageCloudSecurityPostureManagementHour{} + return &this +} + +// NewUsageCloudSecurityPostureManagementHourWithDefaults instantiates a new UsageCloudSecurityPostureManagementHour 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 NewUsageCloudSecurityPostureManagementHourWithDefaults() *UsageCloudSecurityPostureManagementHour { + this := UsageCloudSecurityPostureManagementHour{} + return &this +} + +// GetAasHostCount returns the AasHostCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageCloudSecurityPostureManagementHour) GetAasHostCount() float64 { + if o == nil || o.AasHostCount.Get() == nil { + var ret float64 + return ret + } + return *o.AasHostCount.Get() +} + +// GetAasHostCountOk returns a tuple with the AasHostCount 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 *UsageCloudSecurityPostureManagementHour) GetAasHostCountOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.AasHostCount.Get(), o.AasHostCount.IsSet() +} + +// HasAasHostCount returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasAasHostCount() bool { + if o != nil && o.AasHostCount.IsSet() { + return true + } + + return false +} + +// SetAasHostCount gets a reference to the given common.NullableFloat64 and assigns it to the AasHostCount field. +func (o *UsageCloudSecurityPostureManagementHour) SetAasHostCount(v float64) { + o.AasHostCount.Set(&v) +} + +// SetAasHostCountNil sets the value for AasHostCount to be an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) SetAasHostCountNil() { + o.AasHostCount.Set(nil) +} + +// UnsetAasHostCount ensures that no value is present for AasHostCount, not even an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) UnsetAasHostCount() { + o.AasHostCount.Unset() +} + +// GetAzureHostCount returns the AzureHostCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageCloudSecurityPostureManagementHour) GetAzureHostCount() float64 { + if o == nil || o.AzureHostCount.Get() == nil { + var ret float64 + return ret + } + return *o.AzureHostCount.Get() +} + +// GetAzureHostCountOk returns a tuple with the AzureHostCount 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 *UsageCloudSecurityPostureManagementHour) GetAzureHostCountOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.AzureHostCount.Get(), o.AzureHostCount.IsSet() +} + +// HasAzureHostCount returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasAzureHostCount() bool { + if o != nil && o.AzureHostCount.IsSet() { + return true + } + + return false +} + +// SetAzureHostCount gets a reference to the given common.NullableFloat64 and assigns it to the AzureHostCount field. +func (o *UsageCloudSecurityPostureManagementHour) SetAzureHostCount(v float64) { + o.AzureHostCount.Set(&v) +} + +// SetAzureHostCountNil sets the value for AzureHostCount to be an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) SetAzureHostCountNil() { + o.AzureHostCount.Set(nil) +} + +// UnsetAzureHostCount ensures that no value is present for AzureHostCount, not even an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) UnsetAzureHostCount() { + o.AzureHostCount.Unset() +} + +// GetComplianceHostCount returns the ComplianceHostCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageCloudSecurityPostureManagementHour) GetComplianceHostCount() float64 { + if o == nil || o.ComplianceHostCount.Get() == nil { + var ret float64 + return ret + } + return *o.ComplianceHostCount.Get() +} + +// GetComplianceHostCountOk returns a tuple with the ComplianceHostCount 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 *UsageCloudSecurityPostureManagementHour) GetComplianceHostCountOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.ComplianceHostCount.Get(), o.ComplianceHostCount.IsSet() +} + +// HasComplianceHostCount returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasComplianceHostCount() bool { + if o != nil && o.ComplianceHostCount.IsSet() { + return true + } + + return false +} + +// SetComplianceHostCount gets a reference to the given common.NullableFloat64 and assigns it to the ComplianceHostCount field. +func (o *UsageCloudSecurityPostureManagementHour) SetComplianceHostCount(v float64) { + o.ComplianceHostCount.Set(&v) +} + +// SetComplianceHostCountNil sets the value for ComplianceHostCount to be an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) SetComplianceHostCountNil() { + o.ComplianceHostCount.Set(nil) +} + +// UnsetComplianceHostCount ensures that no value is present for ComplianceHostCount, not even an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) UnsetComplianceHostCount() { + o.ComplianceHostCount.Unset() +} + +// GetContainerCount returns the ContainerCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageCloudSecurityPostureManagementHour) GetContainerCount() float64 { + if o == nil || o.ContainerCount.Get() == nil { + var ret float64 + return ret + } + return *o.ContainerCount.Get() +} + +// GetContainerCountOk returns a tuple with the ContainerCount 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 *UsageCloudSecurityPostureManagementHour) GetContainerCountOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.ContainerCount.Get(), o.ContainerCount.IsSet() +} + +// HasContainerCount returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasContainerCount() bool { + if o != nil && o.ContainerCount.IsSet() { + return true + } + + return false +} + +// SetContainerCount gets a reference to the given common.NullableFloat64 and assigns it to the ContainerCount field. +func (o *UsageCloudSecurityPostureManagementHour) SetContainerCount(v float64) { + o.ContainerCount.Set(&v) +} + +// SetContainerCountNil sets the value for ContainerCount to be an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) SetContainerCountNil() { + o.ContainerCount.Set(nil) +} + +// UnsetContainerCount ensures that no value is present for ContainerCount, not even an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) UnsetContainerCount() { + o.ContainerCount.Unset() +} + +// GetHostCount returns the HostCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageCloudSecurityPostureManagementHour) GetHostCount() float64 { + if o == nil || o.HostCount.Get() == nil { + var ret float64 + return ret + } + return *o.HostCount.Get() +} + +// GetHostCountOk returns a tuple with the HostCount 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 *UsageCloudSecurityPostureManagementHour) GetHostCountOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.HostCount.Get(), o.HostCount.IsSet() +} + +// HasHostCount returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasHostCount() bool { + if o != nil && o.HostCount.IsSet() { + return true + } + + return false +} + +// SetHostCount gets a reference to the given common.NullableFloat64 and assigns it to the HostCount field. +func (o *UsageCloudSecurityPostureManagementHour) SetHostCount(v float64) { + o.HostCount.Set(&v) +} + +// SetHostCountNil sets the value for HostCount to be an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) SetHostCountNil() { + o.HostCount.Set(nil) +} + +// UnsetHostCount ensures that no value is present for HostCount, not even an explicit nil. +func (o *UsageCloudSecurityPostureManagementHour) UnsetHostCount() { + o.HostCount.Unset() +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageCloudSecurityPostureManagementHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCloudSecurityPostureManagementHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageCloudSecurityPostureManagementHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageCloudSecurityPostureManagementHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCloudSecurityPostureManagementHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageCloudSecurityPostureManagementHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageCloudSecurityPostureManagementHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCloudSecurityPostureManagementHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageCloudSecurityPostureManagementHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCloudSecurityPostureManagementHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AasHostCount.IsSet() { + toSerialize["aas_host_count"] = o.AasHostCount.Get() + } + if o.AzureHostCount.IsSet() { + toSerialize["azure_host_count"] = o.AzureHostCount.Get() + } + if o.ComplianceHostCount.IsSet() { + toSerialize["compliance_host_count"] = o.ComplianceHostCount.Get() + } + if o.ContainerCount.IsSet() { + toSerialize["container_count"] = o.ContainerCount.Get() + } + if o.HostCount.IsSet() { + toSerialize["host_count"] = o.HostCount.Get() + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCloudSecurityPostureManagementHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AasHostCount common.NullableFloat64 `json:"aas_host_count,omitempty"` + AzureHostCount common.NullableFloat64 `json:"azure_host_count,omitempty"` + ComplianceHostCount common.NullableFloat64 `json:"compliance_host_count,omitempty"` + ContainerCount common.NullableFloat64 `json:"container_count,omitempty"` + HostCount common.NullableFloat64 `json:"host_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AasHostCount = all.AasHostCount + o.AzureHostCount = all.AzureHostCount + o.ComplianceHostCount = all.ComplianceHostCount + o.ContainerCount = all.ContainerCount + o.HostCount = all.HostCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_cloud_security_posture_management_response.go b/api/v1/datadog/model_usage_cloud_security_posture_management_response.go new file mode 100644 index 00000000000..27358295874 --- /dev/null +++ b/api/v1/datadog/model_usage_cloud_security_posture_management_response.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 datadog + +import ( + "encoding/json" +) + +// UsageCloudSecurityPostureManagementResponse The response containing the Cloud Security Posture Management usage for each hour for a given organization. +type UsageCloudSecurityPostureManagementResponse struct { + // Get hourly usage for Cloud Security Posture Management. + Usage []UsageCloudSecurityPostureManagementHour `json:"usage,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{} +} + +// NewUsageCloudSecurityPostureManagementResponse instantiates a new UsageCloudSecurityPostureManagementResponse 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 NewUsageCloudSecurityPostureManagementResponse() *UsageCloudSecurityPostureManagementResponse { + this := UsageCloudSecurityPostureManagementResponse{} + return &this +} + +// NewUsageCloudSecurityPostureManagementResponseWithDefaults instantiates a new UsageCloudSecurityPostureManagementResponse 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 NewUsageCloudSecurityPostureManagementResponseWithDefaults() *UsageCloudSecurityPostureManagementResponse { + this := UsageCloudSecurityPostureManagementResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageCloudSecurityPostureManagementResponse) GetUsage() []UsageCloudSecurityPostureManagementHour { + if o == nil || o.Usage == nil { + var ret []UsageCloudSecurityPostureManagementHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCloudSecurityPostureManagementResponse) GetUsageOk() (*[]UsageCloudSecurityPostureManagementHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageCloudSecurityPostureManagementResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageCloudSecurityPostureManagementHour and assigns it to the Usage field. +func (o *UsageCloudSecurityPostureManagementResponse) SetUsage(v []UsageCloudSecurityPostureManagementHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCloudSecurityPostureManagementResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCloudSecurityPostureManagementResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageCloudSecurityPostureManagementHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_custom_reports_attributes.go b/api/v1/datadog/model_usage_custom_reports_attributes.go new file mode 100644 index 00000000000..f92fba8854a --- /dev/null +++ b/api/v1/datadog/model_usage_custom_reports_attributes.go @@ -0,0 +1,258 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageCustomReportsAttributes The response containing attributes for custom reports. +type UsageCustomReportsAttributes struct { + // The date the specified custom report was computed. + ComputedOn *string `json:"computed_on,omitempty"` + // The ending date of custom report. + EndDate *string `json:"end_date,omitempty"` + // size + Size *int64 `json:"size,omitempty"` + // The starting date of custom report. + StartDate *string `json:"start_date,omitempty"` + // A list of tags to apply to custom reports. + Tags []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{} +} + +// NewUsageCustomReportsAttributes instantiates a new UsageCustomReportsAttributes 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 NewUsageCustomReportsAttributes() *UsageCustomReportsAttributes { + this := UsageCustomReportsAttributes{} + return &this +} + +// NewUsageCustomReportsAttributesWithDefaults instantiates a new UsageCustomReportsAttributes 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 NewUsageCustomReportsAttributesWithDefaults() *UsageCustomReportsAttributes { + this := UsageCustomReportsAttributes{} + return &this +} + +// GetComputedOn returns the ComputedOn field value if set, zero value otherwise. +func (o *UsageCustomReportsAttributes) GetComputedOn() string { + if o == nil || o.ComputedOn == nil { + var ret string + return ret + } + return *o.ComputedOn +} + +// GetComputedOnOk returns a tuple with the ComputedOn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsAttributes) GetComputedOnOk() (*string, bool) { + if o == nil || o.ComputedOn == nil { + return nil, false + } + return o.ComputedOn, true +} + +// HasComputedOn returns a boolean if a field has been set. +func (o *UsageCustomReportsAttributes) HasComputedOn() bool { + if o != nil && o.ComputedOn != nil { + return true + } + + return false +} + +// SetComputedOn gets a reference to the given string and assigns it to the ComputedOn field. +func (o *UsageCustomReportsAttributes) SetComputedOn(v string) { + o.ComputedOn = &v +} + +// GetEndDate returns the EndDate field value if set, zero value otherwise. +func (o *UsageCustomReportsAttributes) GetEndDate() string { + if o == nil || o.EndDate == nil { + var ret string + return ret + } + return *o.EndDate +} + +// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsAttributes) GetEndDateOk() (*string, bool) { + if o == nil || o.EndDate == nil { + return nil, false + } + return o.EndDate, true +} + +// HasEndDate returns a boolean if a field has been set. +func (o *UsageCustomReportsAttributes) HasEndDate() bool { + if o != nil && o.EndDate != nil { + return true + } + + return false +} + +// SetEndDate gets a reference to the given string and assigns it to the EndDate field. +func (o *UsageCustomReportsAttributes) SetEndDate(v string) { + o.EndDate = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *UsageCustomReportsAttributes) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsAttributes) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *UsageCustomReportsAttributes) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *UsageCustomReportsAttributes) SetSize(v int64) { + o.Size = &v +} + +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *UsageCustomReportsAttributes) GetStartDate() string { + if o == nil || o.StartDate == nil { + var ret string + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsAttributes) GetStartDateOk() (*string, bool) { + if o == nil || o.StartDate == nil { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *UsageCustomReportsAttributes) HasStartDate() bool { + if o != nil && o.StartDate != nil { + return true + } + + return false +} + +// SetStartDate gets a reference to the given string and assigns it to the StartDate field. +func (o *UsageCustomReportsAttributes) SetStartDate(v string) { + o.StartDate = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *UsageCustomReportsAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *UsageCustomReportsAttributes) GetTagsOk() (*[]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 *UsageCustomReportsAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *UsageCustomReportsAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCustomReportsAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ComputedOn != nil { + toSerialize["computed_on"] = o.ComputedOn + } + if o.EndDate != nil { + toSerialize["end_date"] = o.EndDate + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + if o.StartDate != nil { + toSerialize["start_date"] = o.StartDate + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ComputedOn *string `json:"computed_on,omitempty"` + EndDate *string `json:"end_date,omitempty"` + Size *int64 `json:"size,omitempty"` + StartDate *string `json:"start_date,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ComputedOn = all.ComputedOn + o.EndDate = all.EndDate + o.Size = all.Size + o.StartDate = all.StartDate + o.Tags = all.Tags + return nil +} diff --git a/api/v1/datadog/model_usage_custom_reports_data.go b/api/v1/datadog/model_usage_custom_reports_data.go new file mode 100644 index 00000000000..01008ccb4b4 --- /dev/null +++ b/api/v1/datadog/model_usage_custom_reports_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageCustomReportsData The response containing the date and type for custom reports. +type UsageCustomReportsData struct { + // The response containing attributes for custom reports. + Attributes *UsageCustomReportsAttributes `json:"attributes,omitempty"` + // The date for specified custom reports. + Id *string `json:"id,omitempty"` + // The type of reports. + Type *UsageReportsType `json:"type,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{} +} + +// NewUsageCustomReportsData instantiates a new UsageCustomReportsData 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 NewUsageCustomReportsData() *UsageCustomReportsData { + this := UsageCustomReportsData{} + var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS + this.Type = &typeVar + return &this +} + +// NewUsageCustomReportsDataWithDefaults instantiates a new UsageCustomReportsData 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 NewUsageCustomReportsDataWithDefaults() *UsageCustomReportsData { + this := UsageCustomReportsData{} + var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UsageCustomReportsData) GetAttributes() UsageCustomReportsAttributes { + if o == nil || o.Attributes == nil { + var ret UsageCustomReportsAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsData) GetAttributesOk() (*UsageCustomReportsAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *UsageCustomReportsData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given UsageCustomReportsAttributes and assigns it to the Attributes field. +func (o *UsageCustomReportsData) SetAttributes(v UsageCustomReportsAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UsageCustomReportsData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UsageCustomReportsData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UsageCustomReportsData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *UsageCustomReportsData) GetType() UsageReportsType { + if o == nil || o.Type == nil { + var ret UsageReportsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsData) GetTypeOk() (*UsageReportsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *UsageCustomReportsData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given UsageReportsType and assigns it to the Type field. +func (o *UsageCustomReportsData) SetType(v UsageReportsType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCustomReportsData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *UsageCustomReportsAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UsageReportsType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_usage_custom_reports_meta.go b/api/v1/datadog/model_usage_custom_reports_meta.go new file mode 100644 index 00000000000..14d017718b5 --- /dev/null +++ b/api/v1/datadog/model_usage_custom_reports_meta.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageCustomReportsMeta The object containing document metadata. +type UsageCustomReportsMeta struct { + // The object containing page total count. + Page *UsageCustomReportsPage `json:"page,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{} +} + +// NewUsageCustomReportsMeta instantiates a new UsageCustomReportsMeta 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 NewUsageCustomReportsMeta() *UsageCustomReportsMeta { + this := UsageCustomReportsMeta{} + return &this +} + +// NewUsageCustomReportsMetaWithDefaults instantiates a new UsageCustomReportsMeta 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 NewUsageCustomReportsMetaWithDefaults() *UsageCustomReportsMeta { + this := UsageCustomReportsMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *UsageCustomReportsMeta) GetPage() UsageCustomReportsPage { + if o == nil || o.Page == nil { + var ret UsageCustomReportsPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsMeta) GetPageOk() (*UsageCustomReportsPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *UsageCustomReportsMeta) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given UsageCustomReportsPage and assigns it to the Page field. +func (o *UsageCustomReportsMeta) SetPage(v UsageCustomReportsPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCustomReportsMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *UsageCustomReportsPage `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v1/datadog/model_usage_custom_reports_page.go b/api/v1/datadog/model_usage_custom_reports_page.go new file mode 100644 index 00000000000..7489c606b82 --- /dev/null +++ b/api/v1/datadog/model_usage_custom_reports_page.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 datadog + +import ( + "encoding/json" +) + +// UsageCustomReportsPage The object containing page total count. +type UsageCustomReportsPage struct { + // Total page count. + TotalCount *int64 `json:"total_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{} +} + +// NewUsageCustomReportsPage instantiates a new UsageCustomReportsPage 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 NewUsageCustomReportsPage() *UsageCustomReportsPage { + this := UsageCustomReportsPage{} + return &this +} + +// NewUsageCustomReportsPageWithDefaults instantiates a new UsageCustomReportsPage 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 NewUsageCustomReportsPageWithDefaults() *UsageCustomReportsPage { + this := UsageCustomReportsPage{} + return &this +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *UsageCustomReportsPage) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsPage) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *UsageCustomReportsPage) HasTotalCount() bool { + if o != nil && o.TotalCount != nil { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *UsageCustomReportsPage) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCustomReportsPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TotalCount *int64 `json:"total_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TotalCount = all.TotalCount + return nil +} diff --git a/api/v1/datadog/model_usage_custom_reports_response.go b/api/v1/datadog/model_usage_custom_reports_response.go new file mode 100644 index 00000000000..7491fad78b1 --- /dev/null +++ b/api/v1/datadog/model_usage_custom_reports_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 datadog + +import ( + "encoding/json" +) + +// UsageCustomReportsResponse Response containing available custom reports. +type UsageCustomReportsResponse struct { + // An array of available custom reports. + Data []UsageCustomReportsData `json:"data,omitempty"` + // The object containing document metadata. + Meta *UsageCustomReportsMeta `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{} +} + +// NewUsageCustomReportsResponse instantiates a new UsageCustomReportsResponse 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 NewUsageCustomReportsResponse() *UsageCustomReportsResponse { + this := UsageCustomReportsResponse{} + return &this +} + +// NewUsageCustomReportsResponseWithDefaults instantiates a new UsageCustomReportsResponse 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 NewUsageCustomReportsResponseWithDefaults() *UsageCustomReportsResponse { + this := UsageCustomReportsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UsageCustomReportsResponse) GetData() []UsageCustomReportsData { + if o == nil || o.Data == nil { + var ret []UsageCustomReportsData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCustomReportsResponse) GetDataOk() (*[]UsageCustomReportsData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UsageCustomReportsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []UsageCustomReportsData and assigns it to the Data field. +func (o *UsageCustomReportsResponse) SetData(v []UsageCustomReportsData) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *UsageCustomReportsResponse) GetMeta() UsageCustomReportsMeta { + if o == nil || o.Meta == nil { + var ret UsageCustomReportsMeta + 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 *UsageCustomReportsResponse) GetMetaOk() (*UsageCustomReportsMeta, 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 *UsageCustomReportsResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given UsageCustomReportsMeta and assigns it to the Meta field. +func (o *UsageCustomReportsResponse) SetMeta(v UsageCustomReportsMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCustomReportsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []UsageCustomReportsData `json:"data,omitempty"` + Meta *UsageCustomReportsMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v1/datadog/model_usage_cws_hour.go b/api/v1/datadog/model_usage_cws_hour.go new file mode 100644 index 00000000000..ec63b09f70f --- /dev/null +++ b/api/v1/datadog/model_usage_cws_hour.go @@ -0,0 +1,263 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageCWSHour Cloud Workload Security usage for a given organization for a given hour. +type UsageCWSHour struct { + // The total number of Cloud Workload Security container hours from the start of the given hour’s month until the given hour. + CwsContainerCount *int64 `json:"cws_container_count,omitempty"` + // The total number of Cloud Workload Security host hours from the start of the given hour’s month until the given hour. + CwsHostCount *int64 `json:"cws_host_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageCWSHour instantiates a new UsageCWSHour 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 NewUsageCWSHour() *UsageCWSHour { + this := UsageCWSHour{} + return &this +} + +// NewUsageCWSHourWithDefaults instantiates a new UsageCWSHour 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 NewUsageCWSHourWithDefaults() *UsageCWSHour { + this := UsageCWSHour{} + return &this +} + +// GetCwsContainerCount returns the CwsContainerCount field value if set, zero value otherwise. +func (o *UsageCWSHour) GetCwsContainerCount() int64 { + if o == nil || o.CwsContainerCount == nil { + var ret int64 + return ret + } + return *o.CwsContainerCount +} + +// GetCwsContainerCountOk returns a tuple with the CwsContainerCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCWSHour) GetCwsContainerCountOk() (*int64, bool) { + if o == nil || o.CwsContainerCount == nil { + return nil, false + } + return o.CwsContainerCount, true +} + +// HasCwsContainerCount returns a boolean if a field has been set. +func (o *UsageCWSHour) HasCwsContainerCount() bool { + if o != nil && o.CwsContainerCount != nil { + return true + } + + return false +} + +// SetCwsContainerCount gets a reference to the given int64 and assigns it to the CwsContainerCount field. +func (o *UsageCWSHour) SetCwsContainerCount(v int64) { + o.CwsContainerCount = &v +} + +// GetCwsHostCount returns the CwsHostCount field value if set, zero value otherwise. +func (o *UsageCWSHour) GetCwsHostCount() int64 { + if o == nil || o.CwsHostCount == nil { + var ret int64 + return ret + } + return *o.CwsHostCount +} + +// GetCwsHostCountOk returns a tuple with the CwsHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCWSHour) GetCwsHostCountOk() (*int64, bool) { + if o == nil || o.CwsHostCount == nil { + return nil, false + } + return o.CwsHostCount, true +} + +// HasCwsHostCount returns a boolean if a field has been set. +func (o *UsageCWSHour) HasCwsHostCount() bool { + if o != nil && o.CwsHostCount != nil { + return true + } + + return false +} + +// SetCwsHostCount gets a reference to the given int64 and assigns it to the CwsHostCount field. +func (o *UsageCWSHour) SetCwsHostCount(v int64) { + o.CwsHostCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageCWSHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCWSHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageCWSHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageCWSHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageCWSHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCWSHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageCWSHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageCWSHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageCWSHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCWSHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageCWSHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageCWSHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCWSHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CwsContainerCount != nil { + toSerialize["cws_container_count"] = o.CwsContainerCount + } + if o.CwsHostCount != nil { + toSerialize["cws_host_count"] = o.CwsHostCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCWSHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CwsContainerCount *int64 `json:"cws_container_count,omitempty"` + CwsHostCount *int64 `json:"cws_host_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CwsContainerCount = all.CwsContainerCount + o.CwsHostCount = all.CwsHostCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_cws_response.go b/api/v1/datadog/model_usage_cws_response.go new file mode 100644 index 00000000000..6df15c9e057 --- /dev/null +++ b/api/v1/datadog/model_usage_cws_response.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 datadog + +import ( + "encoding/json" +) + +// UsageCWSResponse Response containing the Cloud Workload Security usage for each hour for a given organization. +type UsageCWSResponse struct { + // Get hourly usage for Cloud Workload Security. + Usage []UsageCWSHour `json:"usage,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{} +} + +// NewUsageCWSResponse instantiates a new UsageCWSResponse 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 NewUsageCWSResponse() *UsageCWSResponse { + this := UsageCWSResponse{} + return &this +} + +// NewUsageCWSResponseWithDefaults instantiates a new UsageCWSResponse 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 NewUsageCWSResponseWithDefaults() *UsageCWSResponse { + this := UsageCWSResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageCWSResponse) GetUsage() []UsageCWSHour { + if o == nil || o.Usage == nil { + var ret []UsageCWSHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageCWSResponse) GetUsageOk() (*[]UsageCWSHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageCWSResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageCWSHour and assigns it to the Usage field. +func (o *UsageCWSResponse) SetUsage(v []UsageCWSHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageCWSResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageCWSResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageCWSHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_dbm_hour.go b/api/v1/datadog/model_usage_dbm_hour.go new file mode 100644 index 00000000000..8e0510d7862 --- /dev/null +++ b/api/v1/datadog/model_usage_dbm_hour.go @@ -0,0 +1,263 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageDBMHour Database Monitoring usage for a given organization for a given hour. +type UsageDBMHour struct { + // The total number of Database Monitoring host hours from the start of the given hour’s month until the given hour. + DbmHostCount *int64 `json:"dbm_host_count,omitempty"` + // The total number of normalized Database Monitoring queries from the start of the given hour’s month until the given hour. + DbmQueriesCount *int64 `json:"dbm_queries_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageDBMHour instantiates a new UsageDBMHour 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 NewUsageDBMHour() *UsageDBMHour { + this := UsageDBMHour{} + return &this +} + +// NewUsageDBMHourWithDefaults instantiates a new UsageDBMHour 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 NewUsageDBMHourWithDefaults() *UsageDBMHour { + this := UsageDBMHour{} + return &this +} + +// GetDbmHostCount returns the DbmHostCount field value if set, zero value otherwise. +func (o *UsageDBMHour) GetDbmHostCount() int64 { + if o == nil || o.DbmHostCount == nil { + var ret int64 + return ret + } + return *o.DbmHostCount +} + +// GetDbmHostCountOk returns a tuple with the DbmHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDBMHour) GetDbmHostCountOk() (*int64, bool) { + if o == nil || o.DbmHostCount == nil { + return nil, false + } + return o.DbmHostCount, true +} + +// HasDbmHostCount returns a boolean if a field has been set. +func (o *UsageDBMHour) HasDbmHostCount() bool { + if o != nil && o.DbmHostCount != nil { + return true + } + + return false +} + +// SetDbmHostCount gets a reference to the given int64 and assigns it to the DbmHostCount field. +func (o *UsageDBMHour) SetDbmHostCount(v int64) { + o.DbmHostCount = &v +} + +// GetDbmQueriesCount returns the DbmQueriesCount field value if set, zero value otherwise. +func (o *UsageDBMHour) GetDbmQueriesCount() int64 { + if o == nil || o.DbmQueriesCount == nil { + var ret int64 + return ret + } + return *o.DbmQueriesCount +} + +// GetDbmQueriesCountOk returns a tuple with the DbmQueriesCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDBMHour) GetDbmQueriesCountOk() (*int64, bool) { + if o == nil || o.DbmQueriesCount == nil { + return nil, false + } + return o.DbmQueriesCount, true +} + +// HasDbmQueriesCount returns a boolean if a field has been set. +func (o *UsageDBMHour) HasDbmQueriesCount() bool { + if o != nil && o.DbmQueriesCount != nil { + return true + } + + return false +} + +// SetDbmQueriesCount gets a reference to the given int64 and assigns it to the DbmQueriesCount field. +func (o *UsageDBMHour) SetDbmQueriesCount(v int64) { + o.DbmQueriesCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageDBMHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDBMHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageDBMHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageDBMHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageDBMHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDBMHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageDBMHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageDBMHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageDBMHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDBMHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageDBMHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageDBMHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageDBMHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DbmHostCount != nil { + toSerialize["dbm_host_count"] = o.DbmHostCount + } + if o.DbmQueriesCount != nil { + toSerialize["dbm_queries_count"] = o.DbmQueriesCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageDBMHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DbmHostCount *int64 `json:"dbm_host_count,omitempty"` + DbmQueriesCount *int64 `json:"dbm_queries_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DbmHostCount = all.DbmHostCount + o.DbmQueriesCount = all.DbmQueriesCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_dbm_response.go b/api/v1/datadog/model_usage_dbm_response.go new file mode 100644 index 00000000000..bb114dce8ca --- /dev/null +++ b/api/v1/datadog/model_usage_dbm_response.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 datadog + +import ( + "encoding/json" +) + +// UsageDBMResponse Response containing the Database Monitoring usage for each hour for a given organization. +type UsageDBMResponse struct { + // Get hourly usage for Database Monitoring + Usage []UsageDBMHour `json:"usage,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{} +} + +// NewUsageDBMResponse instantiates a new UsageDBMResponse 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 NewUsageDBMResponse() *UsageDBMResponse { + this := UsageDBMResponse{} + return &this +} + +// NewUsageDBMResponseWithDefaults instantiates a new UsageDBMResponse 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 NewUsageDBMResponseWithDefaults() *UsageDBMResponse { + this := UsageDBMResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageDBMResponse) GetUsage() []UsageDBMHour { + if o == nil || o.Usage == nil { + var ret []UsageDBMHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDBMResponse) GetUsageOk() (*[]UsageDBMHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageDBMResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageDBMHour and assigns it to the Usage field. +func (o *UsageDBMResponse) SetUsage(v []UsageDBMHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageDBMResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageDBMResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageDBMHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_fargate_hour.go b/api/v1/datadog/model_usage_fargate_hour.go new file mode 100644 index 00000000000..1e9c3deb285 --- /dev/null +++ b/api/v1/datadog/model_usage_fargate_hour.go @@ -0,0 +1,263 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageFargateHour Number of Fargate tasks run and hourly usage. +type UsageFargateHour struct { + // The average profiled task count for Fargate Profiling. + AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The number of Fargate tasks run. + TasksCount *int64 `json:"tasks_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{} +} + +// NewUsageFargateHour instantiates a new UsageFargateHour 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 NewUsageFargateHour() *UsageFargateHour { + this := UsageFargateHour{} + return &this +} + +// NewUsageFargateHourWithDefaults instantiates a new UsageFargateHour 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 NewUsageFargateHourWithDefaults() *UsageFargateHour { + this := UsageFargateHour{} + return &this +} + +// GetAvgProfiledFargateTasks returns the AvgProfiledFargateTasks field value if set, zero value otherwise. +func (o *UsageFargateHour) GetAvgProfiledFargateTasks() int64 { + if o == nil || o.AvgProfiledFargateTasks == nil { + var ret int64 + return ret + } + return *o.AvgProfiledFargateTasks +} + +// GetAvgProfiledFargateTasksOk returns a tuple with the AvgProfiledFargateTasks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageFargateHour) GetAvgProfiledFargateTasksOk() (*int64, bool) { + if o == nil || o.AvgProfiledFargateTasks == nil { + return nil, false + } + return o.AvgProfiledFargateTasks, true +} + +// HasAvgProfiledFargateTasks returns a boolean if a field has been set. +func (o *UsageFargateHour) HasAvgProfiledFargateTasks() bool { + if o != nil && o.AvgProfiledFargateTasks != nil { + return true + } + + return false +} + +// SetAvgProfiledFargateTasks gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasks field. +func (o *UsageFargateHour) SetAvgProfiledFargateTasks(v int64) { + o.AvgProfiledFargateTasks = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageFargateHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageFargateHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageFargateHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageFargateHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageFargateHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageFargateHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageFargateHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageFargateHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageFargateHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageFargateHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageFargateHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageFargateHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetTasksCount returns the TasksCount field value if set, zero value otherwise. +func (o *UsageFargateHour) GetTasksCount() int64 { + if o == nil || o.TasksCount == nil { + var ret int64 + return ret + } + return *o.TasksCount +} + +// GetTasksCountOk returns a tuple with the TasksCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageFargateHour) GetTasksCountOk() (*int64, bool) { + if o == nil || o.TasksCount == nil { + return nil, false + } + return o.TasksCount, true +} + +// HasTasksCount returns a boolean if a field has been set. +func (o *UsageFargateHour) HasTasksCount() bool { + if o != nil && o.TasksCount != nil { + return true + } + + return false +} + +// SetTasksCount gets a reference to the given int64 and assigns it to the TasksCount field. +func (o *UsageFargateHour) SetTasksCount(v int64) { + o.TasksCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageFargateHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AvgProfiledFargateTasks != nil { + toSerialize["avg_profiled_fargate_tasks"] = o.AvgProfiledFargateTasks + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.TasksCount != nil { + toSerialize["tasks_count"] = o.TasksCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageFargateHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + TasksCount *int64 `json:"tasks_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AvgProfiledFargateTasks = all.AvgProfiledFargateTasks + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.TasksCount = all.TasksCount + return nil +} diff --git a/api/v1/datadog/model_usage_fargate_response.go b/api/v1/datadog/model_usage_fargate_response.go new file mode 100644 index 00000000000..193b44df82a --- /dev/null +++ b/api/v1/datadog/model_usage_fargate_response.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 datadog + +import ( + "encoding/json" +) + +// UsageFargateResponse Response containing the number of Fargate tasks run and hourly usage. +type UsageFargateResponse struct { + // Array with the number of hourly Fargate tasks recorded for a given organization. + Usage []UsageFargateHour `json:"usage,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{} +} + +// NewUsageFargateResponse instantiates a new UsageFargateResponse 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 NewUsageFargateResponse() *UsageFargateResponse { + this := UsageFargateResponse{} + return &this +} + +// NewUsageFargateResponseWithDefaults instantiates a new UsageFargateResponse 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 NewUsageFargateResponseWithDefaults() *UsageFargateResponse { + this := UsageFargateResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageFargateResponse) GetUsage() []UsageFargateHour { + if o == nil || o.Usage == nil { + var ret []UsageFargateHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageFargateResponse) GetUsageOk() (*[]UsageFargateHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageFargateResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageFargateHour and assigns it to the Usage field. +func (o *UsageFargateResponse) SetUsage(v []UsageFargateHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageFargateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageFargateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageFargateHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_host_hour.go b/api/v1/datadog/model_usage_host_hour.go new file mode 100644 index 00000000000..f27f4eec993 --- /dev/null +++ b/api/v1/datadog/model_usage_host_hour.go @@ -0,0 +1,701 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageHostHour Number of hosts/containers recorded for each hour for a given organization. +type UsageHostHour struct { + // Contains the total number of infrastructure hosts reporting + // during a given hour that were running the Datadog Agent. + AgentHostCount *int64 `json:"agent_host_count,omitempty"` + // Contains the total number of hosts that reported through Alibaba integration + // (and were NOT running the Datadog Agent). + AlibabaHostCount *int64 `json:"alibaba_host_count,omitempty"` + // Contains the total number of Azure App Services hosts using APM. + ApmAzureAppServiceHostCount *int64 `json:"apm_azure_app_service_host_count,omitempty"` + // Shows the total number of hosts using APM during the hour, + // these are counted as billable (except during trial periods). + ApmHostCount *int64 `json:"apm_host_count,omitempty"` + // Contains the total number of hosts that reported through the AWS integration + // (and were NOT running the Datadog Agent). + AwsHostCount *int64 `json:"aws_host_count,omitempty"` + // Contains the total number of hosts that reported through Azure integration + // (and were NOT running the Datadog Agent). + AzureHostCount *int64 `json:"azure_host_count,omitempty"` + // Shows the total number of containers reported by the Docker integration during the hour. + ContainerCount *int64 `json:"container_count,omitempty"` + // Contains the total number of hosts that reported through the Google Cloud integration + // (and were NOT running the Datadog Agent). + GcpHostCount *int64 `json:"gcp_host_count,omitempty"` + // Contains the total number of Heroku dynos reported by the Datadog Agent. + HerokuHostCount *int64 `json:"heroku_host_count,omitempty"` + // Contains the total number of billable infrastructure hosts reporting during a given hour. + // This is the sum of `agent_host_count`, `aws_host_count`, and `gcp_host_count`. + HostCount *int64 `json:"host_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the total number of hosts that reported through the Azure App Services integration + // (and were NOT running the Datadog Agent). + InfraAzureAppService *int64 `json:"infra_azure_app_service,omitempty"` + // Contains the total number of hosts reported by Datadog exporter for the OpenTelemetry Collector. + OpentelemetryHostCount *int64 `json:"opentelemetry_host_count,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // Contains the total number of hosts that reported through vSphere integration + // (and were NOT running the Datadog Agent). + VsphereHostCount *int64 `json:"vsphere_host_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{} +} + +// NewUsageHostHour instantiates a new UsageHostHour 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 NewUsageHostHour() *UsageHostHour { + this := UsageHostHour{} + return &this +} + +// NewUsageHostHourWithDefaults instantiates a new UsageHostHour 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 NewUsageHostHourWithDefaults() *UsageHostHour { + this := UsageHostHour{} + return &this +} + +// GetAgentHostCount returns the AgentHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetAgentHostCount() int64 { + if o == nil || o.AgentHostCount == nil { + var ret int64 + return ret + } + return *o.AgentHostCount +} + +// GetAgentHostCountOk returns a tuple with the AgentHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetAgentHostCountOk() (*int64, bool) { + if o == nil || o.AgentHostCount == nil { + return nil, false + } + return o.AgentHostCount, true +} + +// HasAgentHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasAgentHostCount() bool { + if o != nil && o.AgentHostCount != nil { + return true + } + + return false +} + +// SetAgentHostCount gets a reference to the given int64 and assigns it to the AgentHostCount field. +func (o *UsageHostHour) SetAgentHostCount(v int64) { + o.AgentHostCount = &v +} + +// GetAlibabaHostCount returns the AlibabaHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetAlibabaHostCount() int64 { + if o == nil || o.AlibabaHostCount == nil { + var ret int64 + return ret + } + return *o.AlibabaHostCount +} + +// GetAlibabaHostCountOk returns a tuple with the AlibabaHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetAlibabaHostCountOk() (*int64, bool) { + if o == nil || o.AlibabaHostCount == nil { + return nil, false + } + return o.AlibabaHostCount, true +} + +// HasAlibabaHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasAlibabaHostCount() bool { + if o != nil && o.AlibabaHostCount != nil { + return true + } + + return false +} + +// SetAlibabaHostCount gets a reference to the given int64 and assigns it to the AlibabaHostCount field. +func (o *UsageHostHour) SetAlibabaHostCount(v int64) { + o.AlibabaHostCount = &v +} + +// GetApmAzureAppServiceHostCount returns the ApmAzureAppServiceHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetApmAzureAppServiceHostCount() int64 { + if o == nil || o.ApmAzureAppServiceHostCount == nil { + var ret int64 + return ret + } + return *o.ApmAzureAppServiceHostCount +} + +// GetApmAzureAppServiceHostCountOk returns a tuple with the ApmAzureAppServiceHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetApmAzureAppServiceHostCountOk() (*int64, bool) { + if o == nil || o.ApmAzureAppServiceHostCount == nil { + return nil, false + } + return o.ApmAzureAppServiceHostCount, true +} + +// HasApmAzureAppServiceHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasApmAzureAppServiceHostCount() bool { + if o != nil && o.ApmAzureAppServiceHostCount != nil { + return true + } + + return false +} + +// SetApmAzureAppServiceHostCount gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostCount field. +func (o *UsageHostHour) SetApmAzureAppServiceHostCount(v int64) { + o.ApmAzureAppServiceHostCount = &v +} + +// GetApmHostCount returns the ApmHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetApmHostCount() int64 { + if o == nil || o.ApmHostCount == nil { + var ret int64 + return ret + } + return *o.ApmHostCount +} + +// GetApmHostCountOk returns a tuple with the ApmHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetApmHostCountOk() (*int64, bool) { + if o == nil || o.ApmHostCount == nil { + return nil, false + } + return o.ApmHostCount, true +} + +// HasApmHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasApmHostCount() bool { + if o != nil && o.ApmHostCount != nil { + return true + } + + return false +} + +// SetApmHostCount gets a reference to the given int64 and assigns it to the ApmHostCount field. +func (o *UsageHostHour) SetApmHostCount(v int64) { + o.ApmHostCount = &v +} + +// GetAwsHostCount returns the AwsHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetAwsHostCount() int64 { + if o == nil || o.AwsHostCount == nil { + var ret int64 + return ret + } + return *o.AwsHostCount +} + +// GetAwsHostCountOk returns a tuple with the AwsHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetAwsHostCountOk() (*int64, bool) { + if o == nil || o.AwsHostCount == nil { + return nil, false + } + return o.AwsHostCount, true +} + +// HasAwsHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasAwsHostCount() bool { + if o != nil && o.AwsHostCount != nil { + return true + } + + return false +} + +// SetAwsHostCount gets a reference to the given int64 and assigns it to the AwsHostCount field. +func (o *UsageHostHour) SetAwsHostCount(v int64) { + o.AwsHostCount = &v +} + +// GetAzureHostCount returns the AzureHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetAzureHostCount() int64 { + if o == nil || o.AzureHostCount == nil { + var ret int64 + return ret + } + return *o.AzureHostCount +} + +// GetAzureHostCountOk returns a tuple with the AzureHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetAzureHostCountOk() (*int64, bool) { + if o == nil || o.AzureHostCount == nil { + return nil, false + } + return o.AzureHostCount, true +} + +// HasAzureHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasAzureHostCount() bool { + if o != nil && o.AzureHostCount != nil { + return true + } + + return false +} + +// SetAzureHostCount gets a reference to the given int64 and assigns it to the AzureHostCount field. +func (o *UsageHostHour) SetAzureHostCount(v int64) { + o.AzureHostCount = &v +} + +// GetContainerCount returns the ContainerCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetContainerCount() int64 { + if o == nil || o.ContainerCount == nil { + var ret int64 + return ret + } + return *o.ContainerCount +} + +// GetContainerCountOk returns a tuple with the ContainerCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetContainerCountOk() (*int64, bool) { + if o == nil || o.ContainerCount == nil { + return nil, false + } + return o.ContainerCount, true +} + +// HasContainerCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasContainerCount() bool { + if o != nil && o.ContainerCount != nil { + return true + } + + return false +} + +// SetContainerCount gets a reference to the given int64 and assigns it to the ContainerCount field. +func (o *UsageHostHour) SetContainerCount(v int64) { + o.ContainerCount = &v +} + +// GetGcpHostCount returns the GcpHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetGcpHostCount() int64 { + if o == nil || o.GcpHostCount == nil { + var ret int64 + return ret + } + return *o.GcpHostCount +} + +// GetGcpHostCountOk returns a tuple with the GcpHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetGcpHostCountOk() (*int64, bool) { + if o == nil || o.GcpHostCount == nil { + return nil, false + } + return o.GcpHostCount, true +} + +// HasGcpHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasGcpHostCount() bool { + if o != nil && o.GcpHostCount != nil { + return true + } + + return false +} + +// SetGcpHostCount gets a reference to the given int64 and assigns it to the GcpHostCount field. +func (o *UsageHostHour) SetGcpHostCount(v int64) { + o.GcpHostCount = &v +} + +// GetHerokuHostCount returns the HerokuHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetHerokuHostCount() int64 { + if o == nil || o.HerokuHostCount == nil { + var ret int64 + return ret + } + return *o.HerokuHostCount +} + +// GetHerokuHostCountOk returns a tuple with the HerokuHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetHerokuHostCountOk() (*int64, bool) { + if o == nil || o.HerokuHostCount == nil { + return nil, false + } + return o.HerokuHostCount, true +} + +// HasHerokuHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasHerokuHostCount() bool { + if o != nil && o.HerokuHostCount != nil { + return true + } + + return false +} + +// SetHerokuHostCount gets a reference to the given int64 and assigns it to the HerokuHostCount field. +func (o *UsageHostHour) SetHerokuHostCount(v int64) { + o.HerokuHostCount = &v +} + +// GetHostCount returns the HostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetHostCount() int64 { + if o == nil || o.HostCount == nil { + var ret int64 + return ret + } + return *o.HostCount +} + +// GetHostCountOk returns a tuple with the HostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetHostCountOk() (*int64, bool) { + if o == nil || o.HostCount == nil { + return nil, false + } + return o.HostCount, true +} + +// HasHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasHostCount() bool { + if o != nil && o.HostCount != nil { + return true + } + + return false +} + +// SetHostCount gets a reference to the given int64 and assigns it to the HostCount field. +func (o *UsageHostHour) SetHostCount(v int64) { + o.HostCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageHostHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageHostHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageHostHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetInfraAzureAppService returns the InfraAzureAppService field value if set, zero value otherwise. +func (o *UsageHostHour) GetInfraAzureAppService() int64 { + if o == nil || o.InfraAzureAppService == nil { + var ret int64 + return ret + } + return *o.InfraAzureAppService +} + +// GetInfraAzureAppServiceOk returns a tuple with the InfraAzureAppService field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetInfraAzureAppServiceOk() (*int64, bool) { + if o == nil || o.InfraAzureAppService == nil { + return nil, false + } + return o.InfraAzureAppService, true +} + +// HasInfraAzureAppService returns a boolean if a field has been set. +func (o *UsageHostHour) HasInfraAzureAppService() bool { + if o != nil && o.InfraAzureAppService != nil { + return true + } + + return false +} + +// SetInfraAzureAppService gets a reference to the given int64 and assigns it to the InfraAzureAppService field. +func (o *UsageHostHour) SetInfraAzureAppService(v int64) { + o.InfraAzureAppService = &v +} + +// GetOpentelemetryHostCount returns the OpentelemetryHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetOpentelemetryHostCount() int64 { + if o == nil || o.OpentelemetryHostCount == nil { + var ret int64 + return ret + } + return *o.OpentelemetryHostCount +} + +// GetOpentelemetryHostCountOk returns a tuple with the OpentelemetryHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetOpentelemetryHostCountOk() (*int64, bool) { + if o == nil || o.OpentelemetryHostCount == nil { + return nil, false + } + return o.OpentelemetryHostCount, true +} + +// HasOpentelemetryHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasOpentelemetryHostCount() bool { + if o != nil && o.OpentelemetryHostCount != nil { + return true + } + + return false +} + +// SetOpentelemetryHostCount gets a reference to the given int64 and assigns it to the OpentelemetryHostCount field. +func (o *UsageHostHour) SetOpentelemetryHostCount(v int64) { + o.OpentelemetryHostCount = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageHostHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageHostHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageHostHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageHostHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageHostHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageHostHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetVsphereHostCount returns the VsphereHostCount field value if set, zero value otherwise. +func (o *UsageHostHour) GetVsphereHostCount() int64 { + if o == nil || o.VsphereHostCount == nil { + var ret int64 + return ret + } + return *o.VsphereHostCount +} + +// GetVsphereHostCountOk returns a tuple with the VsphereHostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostHour) GetVsphereHostCountOk() (*int64, bool) { + if o == nil || o.VsphereHostCount == nil { + return nil, false + } + return o.VsphereHostCount, true +} + +// HasVsphereHostCount returns a boolean if a field has been set. +func (o *UsageHostHour) HasVsphereHostCount() bool { + if o != nil && o.VsphereHostCount != nil { + return true + } + + return false +} + +// SetVsphereHostCount gets a reference to the given int64 and assigns it to the VsphereHostCount field. +func (o *UsageHostHour) SetVsphereHostCount(v int64) { + o.VsphereHostCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageHostHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AgentHostCount != nil { + toSerialize["agent_host_count"] = o.AgentHostCount + } + if o.AlibabaHostCount != nil { + toSerialize["alibaba_host_count"] = o.AlibabaHostCount + } + if o.ApmAzureAppServiceHostCount != nil { + toSerialize["apm_azure_app_service_host_count"] = o.ApmAzureAppServiceHostCount + } + if o.ApmHostCount != nil { + toSerialize["apm_host_count"] = o.ApmHostCount + } + if o.AwsHostCount != nil { + toSerialize["aws_host_count"] = o.AwsHostCount + } + if o.AzureHostCount != nil { + toSerialize["azure_host_count"] = o.AzureHostCount + } + if o.ContainerCount != nil { + toSerialize["container_count"] = o.ContainerCount + } + if o.GcpHostCount != nil { + toSerialize["gcp_host_count"] = o.GcpHostCount + } + if o.HerokuHostCount != nil { + toSerialize["heroku_host_count"] = o.HerokuHostCount + } + if o.HostCount != nil { + toSerialize["host_count"] = o.HostCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.InfraAzureAppService != nil { + toSerialize["infra_azure_app_service"] = o.InfraAzureAppService + } + if o.OpentelemetryHostCount != nil { + toSerialize["opentelemetry_host_count"] = o.OpentelemetryHostCount + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.VsphereHostCount != nil { + toSerialize["vsphere_host_count"] = o.VsphereHostCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageHostHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AgentHostCount *int64 `json:"agent_host_count,omitempty"` + AlibabaHostCount *int64 `json:"alibaba_host_count,omitempty"` + ApmAzureAppServiceHostCount *int64 `json:"apm_azure_app_service_host_count,omitempty"` + ApmHostCount *int64 `json:"apm_host_count,omitempty"` + AwsHostCount *int64 `json:"aws_host_count,omitempty"` + AzureHostCount *int64 `json:"azure_host_count,omitempty"` + ContainerCount *int64 `json:"container_count,omitempty"` + GcpHostCount *int64 `json:"gcp_host_count,omitempty"` + HerokuHostCount *int64 `json:"heroku_host_count,omitempty"` + HostCount *int64 `json:"host_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + InfraAzureAppService *int64 `json:"infra_azure_app_service,omitempty"` + OpentelemetryHostCount *int64 `json:"opentelemetry_host_count,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + VsphereHostCount *int64 `json:"vsphere_host_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AgentHostCount = all.AgentHostCount + o.AlibabaHostCount = all.AlibabaHostCount + o.ApmAzureAppServiceHostCount = all.ApmAzureAppServiceHostCount + o.ApmHostCount = all.ApmHostCount + o.AwsHostCount = all.AwsHostCount + o.AzureHostCount = all.AzureHostCount + o.ContainerCount = all.ContainerCount + o.GcpHostCount = all.GcpHostCount + o.HerokuHostCount = all.HerokuHostCount + o.HostCount = all.HostCount + o.Hour = all.Hour + o.InfraAzureAppService = all.InfraAzureAppService + o.OpentelemetryHostCount = all.OpentelemetryHostCount + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.VsphereHostCount = all.VsphereHostCount + return nil +} diff --git a/api/v1/datadog/model_usage_hosts_response.go b/api/v1/datadog/model_usage_hosts_response.go new file mode 100644 index 00000000000..c3dbc4c2e83 --- /dev/null +++ b/api/v1/datadog/model_usage_hosts_response.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 datadog + +import ( + "encoding/json" +) + +// UsageHostsResponse Host usage response. +type UsageHostsResponse struct { + // An array of objects related to host usage. + Usage []UsageHostHour `json:"usage,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{} +} + +// NewUsageHostsResponse instantiates a new UsageHostsResponse 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 NewUsageHostsResponse() *UsageHostsResponse { + this := UsageHostsResponse{} + return &this +} + +// NewUsageHostsResponseWithDefaults instantiates a new UsageHostsResponse 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 NewUsageHostsResponseWithDefaults() *UsageHostsResponse { + this := UsageHostsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageHostsResponse) GetUsage() []UsageHostHour { + if o == nil || o.Usage == nil { + var ret []UsageHostHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageHostsResponse) GetUsageOk() (*[]UsageHostHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageHostsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageHostHour and assigns it to the Usage field. +func (o *UsageHostsResponse) SetUsage(v []UsageHostHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageHostsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageHostsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageHostHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_incident_management_hour.go b/api/v1/datadog/model_usage_incident_management_hour.go new file mode 100644 index 00000000000..a8cf2d16f7d --- /dev/null +++ b/api/v1/datadog/model_usage_incident_management_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageIncidentManagementHour Incident management usage for a given organization for a given hour. +type UsageIncidentManagementHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the total number monthly active users from the start of the given hour's month until the given hour. + MonthlyActiveUsers *int64 `json:"monthly_active_users,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageIncidentManagementHour instantiates a new UsageIncidentManagementHour 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 NewUsageIncidentManagementHour() *UsageIncidentManagementHour { + this := UsageIncidentManagementHour{} + return &this +} + +// NewUsageIncidentManagementHourWithDefaults instantiates a new UsageIncidentManagementHour 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 NewUsageIncidentManagementHourWithDefaults() *UsageIncidentManagementHour { + this := UsageIncidentManagementHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageIncidentManagementHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIncidentManagementHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageIncidentManagementHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageIncidentManagementHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetMonthlyActiveUsers returns the MonthlyActiveUsers field value if set, zero value otherwise. +func (o *UsageIncidentManagementHour) GetMonthlyActiveUsers() int64 { + if o == nil || o.MonthlyActiveUsers == nil { + var ret int64 + return ret + } + return *o.MonthlyActiveUsers +} + +// GetMonthlyActiveUsersOk returns a tuple with the MonthlyActiveUsers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIncidentManagementHour) GetMonthlyActiveUsersOk() (*int64, bool) { + if o == nil || o.MonthlyActiveUsers == nil { + return nil, false + } + return o.MonthlyActiveUsers, true +} + +// HasMonthlyActiveUsers returns a boolean if a field has been set. +func (o *UsageIncidentManagementHour) HasMonthlyActiveUsers() bool { + if o != nil && o.MonthlyActiveUsers != nil { + return true + } + + return false +} + +// SetMonthlyActiveUsers gets a reference to the given int64 and assigns it to the MonthlyActiveUsers field. +func (o *UsageIncidentManagementHour) SetMonthlyActiveUsers(v int64) { + o.MonthlyActiveUsers = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageIncidentManagementHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIncidentManagementHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageIncidentManagementHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageIncidentManagementHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageIncidentManagementHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIncidentManagementHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageIncidentManagementHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageIncidentManagementHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIncidentManagementHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.MonthlyActiveUsers != nil { + toSerialize["monthly_active_users"] = o.MonthlyActiveUsers + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIncidentManagementHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + MonthlyActiveUsers *int64 `json:"monthly_active_users,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.MonthlyActiveUsers = all.MonthlyActiveUsers + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_incident_management_response.go b/api/v1/datadog/model_usage_incident_management_response.go new file mode 100644 index 00000000000..cf3cbd097a2 --- /dev/null +++ b/api/v1/datadog/model_usage_incident_management_response.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 datadog + +import ( + "encoding/json" +) + +// UsageIncidentManagementResponse Response containing the incident management usage for each hour for a given organization. +type UsageIncidentManagementResponse struct { + // Get hourly usage for incident management. + Usage []UsageIncidentManagementHour `json:"usage,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{} +} + +// NewUsageIncidentManagementResponse instantiates a new UsageIncidentManagementResponse 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 NewUsageIncidentManagementResponse() *UsageIncidentManagementResponse { + this := UsageIncidentManagementResponse{} + return &this +} + +// NewUsageIncidentManagementResponseWithDefaults instantiates a new UsageIncidentManagementResponse 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 NewUsageIncidentManagementResponseWithDefaults() *UsageIncidentManagementResponse { + this := UsageIncidentManagementResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageIncidentManagementResponse) GetUsage() []UsageIncidentManagementHour { + if o == nil || o.Usage == nil { + var ret []UsageIncidentManagementHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIncidentManagementResponse) GetUsageOk() (*[]UsageIncidentManagementHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageIncidentManagementResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageIncidentManagementHour and assigns it to the Usage field. +func (o *UsageIncidentManagementResponse) SetUsage(v []UsageIncidentManagementHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIncidentManagementResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIncidentManagementResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageIncidentManagementHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_indexed_spans_hour.go b/api/v1/datadog/model_usage_indexed_spans_hour.go new file mode 100644 index 00000000000..c1532ce407d --- /dev/null +++ b/api/v1/datadog/model_usage_indexed_spans_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageIndexedSpansHour The hours of indexed spans usage. +type UsageIndexedSpansHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the number of spans indexed. + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageIndexedSpansHour instantiates a new UsageIndexedSpansHour 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 NewUsageIndexedSpansHour() *UsageIndexedSpansHour { + this := UsageIndexedSpansHour{} + return &this +} + +// NewUsageIndexedSpansHourWithDefaults instantiates a new UsageIndexedSpansHour 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 NewUsageIndexedSpansHourWithDefaults() *UsageIndexedSpansHour { + this := UsageIndexedSpansHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageIndexedSpansHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIndexedSpansHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageIndexedSpansHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageIndexedSpansHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. +func (o *UsageIndexedSpansHour) GetIndexedEventsCount() int64 { + if o == nil || o.IndexedEventsCount == nil { + var ret int64 + return ret + } + return *o.IndexedEventsCount +} + +// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIndexedSpansHour) GetIndexedEventsCountOk() (*int64, bool) { + if o == nil || o.IndexedEventsCount == nil { + return nil, false + } + return o.IndexedEventsCount, true +} + +// HasIndexedEventsCount returns a boolean if a field has been set. +func (o *UsageIndexedSpansHour) HasIndexedEventsCount() bool { + if o != nil && o.IndexedEventsCount != nil { + return true + } + + return false +} + +// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. +func (o *UsageIndexedSpansHour) SetIndexedEventsCount(v int64) { + o.IndexedEventsCount = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageIndexedSpansHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIndexedSpansHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageIndexedSpansHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageIndexedSpansHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageIndexedSpansHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIndexedSpansHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageIndexedSpansHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageIndexedSpansHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIndexedSpansHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.IndexedEventsCount != nil { + toSerialize["indexed_events_count"] = o.IndexedEventsCount + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIndexedSpansHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.IndexedEventsCount = all.IndexedEventsCount + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_indexed_spans_response.go b/api/v1/datadog/model_usage_indexed_spans_response.go new file mode 100644 index 00000000000..e7146029784 --- /dev/null +++ b/api/v1/datadog/model_usage_indexed_spans_response.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 datadog + +import ( + "encoding/json" +) + +// UsageIndexedSpansResponse A response containing indexed spans usage. +type UsageIndexedSpansResponse struct { + // Array with the number of hourly traces indexed for a given organization. + Usage []UsageIndexedSpansHour `json:"usage,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{} +} + +// NewUsageIndexedSpansResponse instantiates a new UsageIndexedSpansResponse 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 NewUsageIndexedSpansResponse() *UsageIndexedSpansResponse { + this := UsageIndexedSpansResponse{} + return &this +} + +// NewUsageIndexedSpansResponseWithDefaults instantiates a new UsageIndexedSpansResponse 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 NewUsageIndexedSpansResponseWithDefaults() *UsageIndexedSpansResponse { + this := UsageIndexedSpansResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageIndexedSpansResponse) GetUsage() []UsageIndexedSpansHour { + if o == nil || o.Usage == nil { + var ret []UsageIndexedSpansHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIndexedSpansResponse) GetUsageOk() (*[]UsageIndexedSpansHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageIndexedSpansResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageIndexedSpansHour and assigns it to the Usage field. +func (o *UsageIndexedSpansResponse) SetUsage(v []UsageIndexedSpansHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIndexedSpansResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIndexedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageIndexedSpansHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_ingested_spans_hour.go b/api/v1/datadog/model_usage_ingested_spans_hour.go new file mode 100644 index 00000000000..fc168232c23 --- /dev/null +++ b/api/v1/datadog/model_usage_ingested_spans_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageIngestedSpansHour Ingested spans usage for a given organization for a given hour. +type UsageIngestedSpansHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the total number of bytes ingested for APM spans during a given hour. + IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageIngestedSpansHour instantiates a new UsageIngestedSpansHour 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 NewUsageIngestedSpansHour() *UsageIngestedSpansHour { + this := UsageIngestedSpansHour{} + return &this +} + +// NewUsageIngestedSpansHourWithDefaults instantiates a new UsageIngestedSpansHour 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 NewUsageIngestedSpansHourWithDefaults() *UsageIngestedSpansHour { + this := UsageIngestedSpansHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageIngestedSpansHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIngestedSpansHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageIngestedSpansHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageIngestedSpansHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetIngestedEventsBytes returns the IngestedEventsBytes field value if set, zero value otherwise. +func (o *UsageIngestedSpansHour) GetIngestedEventsBytes() int64 { + if o == nil || o.IngestedEventsBytes == nil { + var ret int64 + return ret + } + return *o.IngestedEventsBytes +} + +// GetIngestedEventsBytesOk returns a tuple with the IngestedEventsBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIngestedSpansHour) GetIngestedEventsBytesOk() (*int64, bool) { + if o == nil || o.IngestedEventsBytes == nil { + return nil, false + } + return o.IngestedEventsBytes, true +} + +// HasIngestedEventsBytes returns a boolean if a field has been set. +func (o *UsageIngestedSpansHour) HasIngestedEventsBytes() bool { + if o != nil && o.IngestedEventsBytes != nil { + return true + } + + return false +} + +// SetIngestedEventsBytes gets a reference to the given int64 and assigns it to the IngestedEventsBytes field. +func (o *UsageIngestedSpansHour) SetIngestedEventsBytes(v int64) { + o.IngestedEventsBytes = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageIngestedSpansHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIngestedSpansHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageIngestedSpansHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageIngestedSpansHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageIngestedSpansHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIngestedSpansHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageIngestedSpansHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageIngestedSpansHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIngestedSpansHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.IngestedEventsBytes != nil { + toSerialize["ingested_events_bytes"] = o.IngestedEventsBytes + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIngestedSpansHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.IngestedEventsBytes = all.IngestedEventsBytes + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_ingested_spans_response.go b/api/v1/datadog/model_usage_ingested_spans_response.go new file mode 100644 index 00000000000..58e2878ee27 --- /dev/null +++ b/api/v1/datadog/model_usage_ingested_spans_response.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 datadog + +import ( + "encoding/json" +) + +// UsageIngestedSpansResponse Response containing the ingested spans usage for each hour for a given organization. +type UsageIngestedSpansResponse struct { + // Get hourly usage for ingested spans. + Usage []UsageIngestedSpansHour `json:"usage,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{} +} + +// NewUsageIngestedSpansResponse instantiates a new UsageIngestedSpansResponse 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 NewUsageIngestedSpansResponse() *UsageIngestedSpansResponse { + this := UsageIngestedSpansResponse{} + return &this +} + +// NewUsageIngestedSpansResponseWithDefaults instantiates a new UsageIngestedSpansResponse 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 NewUsageIngestedSpansResponseWithDefaults() *UsageIngestedSpansResponse { + this := UsageIngestedSpansResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageIngestedSpansResponse) GetUsage() []UsageIngestedSpansHour { + if o == nil || o.Usage == nil { + var ret []UsageIngestedSpansHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIngestedSpansResponse) GetUsageOk() (*[]UsageIngestedSpansHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageIngestedSpansResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageIngestedSpansHour and assigns it to the Usage field. +func (o *UsageIngestedSpansResponse) SetUsage(v []UsageIngestedSpansHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIngestedSpansResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIngestedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageIngestedSpansHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_io_t_hour.go b/api/v1/datadog/model_usage_io_t_hour.go new file mode 100644 index 00000000000..b6f8eae0b8e --- /dev/null +++ b/api/v1/datadog/model_usage_io_t_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageIoTHour IoT usage for a given organization for a given hour. +type UsageIoTHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The total number of IoT devices during a given hour. + IotDeviceCount *int64 `json:"iot_device_count,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageIoTHour instantiates a new UsageIoTHour 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 NewUsageIoTHour() *UsageIoTHour { + this := UsageIoTHour{} + return &this +} + +// NewUsageIoTHourWithDefaults instantiates a new UsageIoTHour 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 NewUsageIoTHourWithDefaults() *UsageIoTHour { + this := UsageIoTHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageIoTHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIoTHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageIoTHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageIoTHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetIotDeviceCount returns the IotDeviceCount field value if set, zero value otherwise. +func (o *UsageIoTHour) GetIotDeviceCount() int64 { + if o == nil || o.IotDeviceCount == nil { + var ret int64 + return ret + } + return *o.IotDeviceCount +} + +// GetIotDeviceCountOk returns a tuple with the IotDeviceCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIoTHour) GetIotDeviceCountOk() (*int64, bool) { + if o == nil || o.IotDeviceCount == nil { + return nil, false + } + return o.IotDeviceCount, true +} + +// HasIotDeviceCount returns a boolean if a field has been set. +func (o *UsageIoTHour) HasIotDeviceCount() bool { + if o != nil && o.IotDeviceCount != nil { + return true + } + + return false +} + +// SetIotDeviceCount gets a reference to the given int64 and assigns it to the IotDeviceCount field. +func (o *UsageIoTHour) SetIotDeviceCount(v int64) { + o.IotDeviceCount = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageIoTHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIoTHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageIoTHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageIoTHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageIoTHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIoTHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageIoTHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageIoTHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIoTHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.IotDeviceCount != nil { + toSerialize["iot_device_count"] = o.IotDeviceCount + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIoTHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + IotDeviceCount *int64 `json:"iot_device_count,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.IotDeviceCount = all.IotDeviceCount + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_io_t_response.go b/api/v1/datadog/model_usage_io_t_response.go new file mode 100644 index 00000000000..699d87d0d93 --- /dev/null +++ b/api/v1/datadog/model_usage_io_t_response.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 datadog + +import ( + "encoding/json" +) + +// UsageIoTResponse Response containing the IoT usage for each hour for a given organization. +type UsageIoTResponse struct { + // Get hourly usage for IoT. + Usage []UsageIoTHour `json:"usage,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{} +} + +// NewUsageIoTResponse instantiates a new UsageIoTResponse 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 NewUsageIoTResponse() *UsageIoTResponse { + this := UsageIoTResponse{} + return &this +} + +// NewUsageIoTResponseWithDefaults instantiates a new UsageIoTResponse 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 NewUsageIoTResponseWithDefaults() *UsageIoTResponse { + this := UsageIoTResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageIoTResponse) GetUsage() []UsageIoTHour { + if o == nil || o.Usage == nil { + var ret []UsageIoTHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageIoTResponse) GetUsageOk() (*[]UsageIoTHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageIoTResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageIoTHour and assigns it to the Usage field. +func (o *UsageIoTResponse) SetUsage(v []UsageIoTHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageIoTResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageIoTResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageIoTHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_lambda_hour.go b/api/v1/datadog/model_usage_lambda_hour.go new file mode 100644 index 00000000000..022846068d7 --- /dev/null +++ b/api/v1/datadog/model_usage_lambda_hour.go @@ -0,0 +1,264 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageLambdaHour Number of lambda functions and sum of the invocations of all lambda functions +// for each hour for a given organization. +type UsageLambdaHour struct { + // Contains the number of different functions for each region and AWS account. + FuncCount *int64 `json:"func_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the sum of invocations of all functions. + InvocationsSum *int64 `json:"invocations_sum,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageLambdaHour instantiates a new UsageLambdaHour 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 NewUsageLambdaHour() *UsageLambdaHour { + this := UsageLambdaHour{} + return &this +} + +// NewUsageLambdaHourWithDefaults instantiates a new UsageLambdaHour 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 NewUsageLambdaHourWithDefaults() *UsageLambdaHour { + this := UsageLambdaHour{} + return &this +} + +// GetFuncCount returns the FuncCount field value if set, zero value otherwise. +func (o *UsageLambdaHour) GetFuncCount() int64 { + if o == nil || o.FuncCount == nil { + var ret int64 + return ret + } + return *o.FuncCount +} + +// GetFuncCountOk returns a tuple with the FuncCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLambdaHour) GetFuncCountOk() (*int64, bool) { + if o == nil || o.FuncCount == nil { + return nil, false + } + return o.FuncCount, true +} + +// HasFuncCount returns a boolean if a field has been set. +func (o *UsageLambdaHour) HasFuncCount() bool { + if o != nil && o.FuncCount != nil { + return true + } + + return false +} + +// SetFuncCount gets a reference to the given int64 and assigns it to the FuncCount field. +func (o *UsageLambdaHour) SetFuncCount(v int64) { + o.FuncCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageLambdaHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLambdaHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageLambdaHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageLambdaHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetInvocationsSum returns the InvocationsSum field value if set, zero value otherwise. +func (o *UsageLambdaHour) GetInvocationsSum() int64 { + if o == nil || o.InvocationsSum == nil { + var ret int64 + return ret + } + return *o.InvocationsSum +} + +// GetInvocationsSumOk returns a tuple with the InvocationsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLambdaHour) GetInvocationsSumOk() (*int64, bool) { + if o == nil || o.InvocationsSum == nil { + return nil, false + } + return o.InvocationsSum, true +} + +// HasInvocationsSum returns a boolean if a field has been set. +func (o *UsageLambdaHour) HasInvocationsSum() bool { + if o != nil && o.InvocationsSum != nil { + return true + } + + return false +} + +// SetInvocationsSum gets a reference to the given int64 and assigns it to the InvocationsSum field. +func (o *UsageLambdaHour) SetInvocationsSum(v int64) { + o.InvocationsSum = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageLambdaHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLambdaHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageLambdaHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageLambdaHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageLambdaHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLambdaHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageLambdaHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageLambdaHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLambdaHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.FuncCount != nil { + toSerialize["func_count"] = o.FuncCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.InvocationsSum != nil { + toSerialize["invocations_sum"] = o.InvocationsSum + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLambdaHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + FuncCount *int64 `json:"func_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + InvocationsSum *int64 `json:"invocations_sum,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.FuncCount = all.FuncCount + o.Hour = all.Hour + o.InvocationsSum = all.InvocationsSum + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_lambda_response.go b/api/v1/datadog/model_usage_lambda_response.go new file mode 100644 index 00000000000..8c8056b602b --- /dev/null +++ b/api/v1/datadog/model_usage_lambda_response.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageLambdaResponse Response containing the number of lambda functions and sum of the invocations of all lambda functions +// for each hour for a given organization. +type UsageLambdaResponse struct { + // Get hourly usage for Lambda. + Usage []UsageLambdaHour `json:"usage,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{} +} + +// NewUsageLambdaResponse instantiates a new UsageLambdaResponse 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 NewUsageLambdaResponse() *UsageLambdaResponse { + this := UsageLambdaResponse{} + return &this +} + +// NewUsageLambdaResponseWithDefaults instantiates a new UsageLambdaResponse 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 NewUsageLambdaResponseWithDefaults() *UsageLambdaResponse { + this := UsageLambdaResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageLambdaResponse) GetUsage() []UsageLambdaHour { + if o == nil || o.Usage == nil { + var ret []UsageLambdaHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLambdaResponse) GetUsageOk() (*[]UsageLambdaHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageLambdaResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageLambdaHour and assigns it to the Usage field. +func (o *UsageLambdaResponse) SetUsage(v []UsageLambdaHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLambdaResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLambdaResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageLambdaHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_logs_by_index_hour.go b/api/v1/datadog/model_usage_logs_by_index_hour.go new file mode 100644 index 00000000000..33300bd71fe --- /dev/null +++ b/api/v1/datadog/model_usage_logs_by_index_hour.go @@ -0,0 +1,341 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageLogsByIndexHour Number of indexed logs for each hour and index for a given organization. +type UsageLogsByIndexHour struct { + // The total number of indexed logs for the queried hour. + EventCount *int64 `json:"event_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The index ID for this usage. + IndexId *string `json:"index_id,omitempty"` + // The user specified name for this index ID. + IndexName *string `json:"index_name,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The retention period (in days) for this index ID. + Retention *int64 `json:"retention,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{} +} + +// NewUsageLogsByIndexHour instantiates a new UsageLogsByIndexHour 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 NewUsageLogsByIndexHour() *UsageLogsByIndexHour { + this := UsageLogsByIndexHour{} + return &this +} + +// NewUsageLogsByIndexHourWithDefaults instantiates a new UsageLogsByIndexHour 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 NewUsageLogsByIndexHourWithDefaults() *UsageLogsByIndexHour { + this := UsageLogsByIndexHour{} + return &this +} + +// GetEventCount returns the EventCount field value if set, zero value otherwise. +func (o *UsageLogsByIndexHour) GetEventCount() int64 { + if o == nil || o.EventCount == nil { + var ret int64 + return ret + } + return *o.EventCount +} + +// GetEventCountOk returns a tuple with the EventCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexHour) GetEventCountOk() (*int64, bool) { + if o == nil || o.EventCount == nil { + return nil, false + } + return o.EventCount, true +} + +// HasEventCount returns a boolean if a field has been set. +func (o *UsageLogsByIndexHour) HasEventCount() bool { + if o != nil && o.EventCount != nil { + return true + } + + return false +} + +// SetEventCount gets a reference to the given int64 and assigns it to the EventCount field. +func (o *UsageLogsByIndexHour) SetEventCount(v int64) { + o.EventCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageLogsByIndexHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageLogsByIndexHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageLogsByIndexHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetIndexId returns the IndexId field value if set, zero value otherwise. +func (o *UsageLogsByIndexHour) GetIndexId() string { + if o == nil || o.IndexId == nil { + var ret string + return ret + } + return *o.IndexId +} + +// GetIndexIdOk returns a tuple with the IndexId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexHour) GetIndexIdOk() (*string, bool) { + if o == nil || o.IndexId == nil { + return nil, false + } + return o.IndexId, true +} + +// HasIndexId returns a boolean if a field has been set. +func (o *UsageLogsByIndexHour) HasIndexId() bool { + if o != nil && o.IndexId != nil { + return true + } + + return false +} + +// SetIndexId gets a reference to the given string and assigns it to the IndexId field. +func (o *UsageLogsByIndexHour) SetIndexId(v string) { + o.IndexId = &v +} + +// GetIndexName returns the IndexName field value if set, zero value otherwise. +func (o *UsageLogsByIndexHour) GetIndexName() string { + if o == nil || o.IndexName == nil { + var ret string + return ret + } + return *o.IndexName +} + +// GetIndexNameOk returns a tuple with the IndexName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexHour) GetIndexNameOk() (*string, bool) { + if o == nil || o.IndexName == nil { + return nil, false + } + return o.IndexName, true +} + +// HasIndexName returns a boolean if a field has been set. +func (o *UsageLogsByIndexHour) HasIndexName() bool { + if o != nil && o.IndexName != nil { + return true + } + + return false +} + +// SetIndexName gets a reference to the given string and assigns it to the IndexName field. +func (o *UsageLogsByIndexHour) SetIndexName(v string) { + o.IndexName = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageLogsByIndexHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageLogsByIndexHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageLogsByIndexHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageLogsByIndexHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageLogsByIndexHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageLogsByIndexHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetRetention returns the Retention field value if set, zero value otherwise. +func (o *UsageLogsByIndexHour) GetRetention() int64 { + if o == nil || o.Retention == nil { + var ret int64 + return ret + } + return *o.Retention +} + +// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexHour) GetRetentionOk() (*int64, bool) { + if o == nil || o.Retention == nil { + return nil, false + } + return o.Retention, true +} + +// HasRetention returns a boolean if a field has been set. +func (o *UsageLogsByIndexHour) HasRetention() bool { + if o != nil && o.Retention != nil { + return true + } + + return false +} + +// SetRetention gets a reference to the given int64 and assigns it to the Retention field. +func (o *UsageLogsByIndexHour) SetRetention(v int64) { + o.Retention = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLogsByIndexHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.EventCount != nil { + toSerialize["event_count"] = o.EventCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.IndexId != nil { + toSerialize["index_id"] = o.IndexId + } + if o.IndexName != nil { + toSerialize["index_name"] = o.IndexName + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Retention != nil { + toSerialize["retention"] = o.Retention + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLogsByIndexHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + EventCount *int64 `json:"event_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + IndexId *string `json:"index_id,omitempty"` + IndexName *string `json:"index_name,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + Retention *int64 `json:"retention,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.EventCount = all.EventCount + o.Hour = all.Hour + o.IndexId = all.IndexId + o.IndexName = all.IndexName + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.Retention = all.Retention + return nil +} diff --git a/api/v1/datadog/model_usage_logs_by_index_response.go b/api/v1/datadog/model_usage_logs_by_index_response.go new file mode 100644 index 00000000000..e4ecb06f76a --- /dev/null +++ b/api/v1/datadog/model_usage_logs_by_index_response.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 datadog + +import ( + "encoding/json" +) + +// UsageLogsByIndexResponse Response containing the number of indexed logs for each hour and index for a given organization. +type UsageLogsByIndexResponse struct { + // An array of objects regarding hourly usage of logs by index response. + Usage []UsageLogsByIndexHour `json:"usage,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{} +} + +// NewUsageLogsByIndexResponse instantiates a new UsageLogsByIndexResponse 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 NewUsageLogsByIndexResponse() *UsageLogsByIndexResponse { + this := UsageLogsByIndexResponse{} + return &this +} + +// NewUsageLogsByIndexResponseWithDefaults instantiates a new UsageLogsByIndexResponse 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 NewUsageLogsByIndexResponseWithDefaults() *UsageLogsByIndexResponse { + this := UsageLogsByIndexResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageLogsByIndexResponse) GetUsage() []UsageLogsByIndexHour { + if o == nil || o.Usage == nil { + var ret []UsageLogsByIndexHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByIndexResponse) GetUsageOk() (*[]UsageLogsByIndexHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageLogsByIndexResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageLogsByIndexHour and assigns it to the Usage field. +func (o *UsageLogsByIndexResponse) SetUsage(v []UsageLogsByIndexHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLogsByIndexResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLogsByIndexResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageLogsByIndexHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_logs_by_retention_hour.go b/api/v1/datadog/model_usage_logs_by_retention_hour.go new file mode 100644 index 00000000000..5d556073b5a --- /dev/null +++ b/api/v1/datadog/model_usage_logs_by_retention_hour.go @@ -0,0 +1,297 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageLogsByRetentionHour The number of indexed logs for each hour for a given organization broken down by retention period. +type UsageLogsByRetentionHour struct { + // Total logs indexed with this retention period during a given hour. + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + // Live logs indexed with this retention period during a given hour. + LiveIndexedEventsCount *int64 `json:"live_indexed_events_count,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // Rehydrated logs indexed with this retention period during a given hour. + RehydratedIndexedEventsCount *int64 `json:"rehydrated_indexed_events_count,omitempty"` + // The retention period in days or "custom" for all custom retention usage. + Retention *string `json:"retention,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{} +} + +// NewUsageLogsByRetentionHour instantiates a new UsageLogsByRetentionHour 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 NewUsageLogsByRetentionHour() *UsageLogsByRetentionHour { + this := UsageLogsByRetentionHour{} + return &this +} + +// NewUsageLogsByRetentionHourWithDefaults instantiates a new UsageLogsByRetentionHour 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 NewUsageLogsByRetentionHourWithDefaults() *UsageLogsByRetentionHour { + this := UsageLogsByRetentionHour{} + return &this +} + +// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. +func (o *UsageLogsByRetentionHour) GetIndexedEventsCount() int64 { + if o == nil || o.IndexedEventsCount == nil { + var ret int64 + return ret + } + return *o.IndexedEventsCount +} + +// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByRetentionHour) GetIndexedEventsCountOk() (*int64, bool) { + if o == nil || o.IndexedEventsCount == nil { + return nil, false + } + return o.IndexedEventsCount, true +} + +// HasIndexedEventsCount returns a boolean if a field has been set. +func (o *UsageLogsByRetentionHour) HasIndexedEventsCount() bool { + if o != nil && o.IndexedEventsCount != nil { + return true + } + + return false +} + +// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. +func (o *UsageLogsByRetentionHour) SetIndexedEventsCount(v int64) { + o.IndexedEventsCount = &v +} + +// GetLiveIndexedEventsCount returns the LiveIndexedEventsCount field value if set, zero value otherwise. +func (o *UsageLogsByRetentionHour) GetLiveIndexedEventsCount() int64 { + if o == nil || o.LiveIndexedEventsCount == nil { + var ret int64 + return ret + } + return *o.LiveIndexedEventsCount +} + +// GetLiveIndexedEventsCountOk returns a tuple with the LiveIndexedEventsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByRetentionHour) GetLiveIndexedEventsCountOk() (*int64, bool) { + if o == nil || o.LiveIndexedEventsCount == nil { + return nil, false + } + return o.LiveIndexedEventsCount, true +} + +// HasLiveIndexedEventsCount returns a boolean if a field has been set. +func (o *UsageLogsByRetentionHour) HasLiveIndexedEventsCount() bool { + if o != nil && o.LiveIndexedEventsCount != nil { + return true + } + + return false +} + +// SetLiveIndexedEventsCount gets a reference to the given int64 and assigns it to the LiveIndexedEventsCount field. +func (o *UsageLogsByRetentionHour) SetLiveIndexedEventsCount(v int64) { + o.LiveIndexedEventsCount = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageLogsByRetentionHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByRetentionHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageLogsByRetentionHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageLogsByRetentionHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageLogsByRetentionHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByRetentionHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageLogsByRetentionHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageLogsByRetentionHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetRehydratedIndexedEventsCount returns the RehydratedIndexedEventsCount field value if set, zero value otherwise. +func (o *UsageLogsByRetentionHour) GetRehydratedIndexedEventsCount() int64 { + if o == nil || o.RehydratedIndexedEventsCount == nil { + var ret int64 + return ret + } + return *o.RehydratedIndexedEventsCount +} + +// GetRehydratedIndexedEventsCountOk returns a tuple with the RehydratedIndexedEventsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByRetentionHour) GetRehydratedIndexedEventsCountOk() (*int64, bool) { + if o == nil || o.RehydratedIndexedEventsCount == nil { + return nil, false + } + return o.RehydratedIndexedEventsCount, true +} + +// HasRehydratedIndexedEventsCount returns a boolean if a field has been set. +func (o *UsageLogsByRetentionHour) HasRehydratedIndexedEventsCount() bool { + if o != nil && o.RehydratedIndexedEventsCount != nil { + return true + } + + return false +} + +// SetRehydratedIndexedEventsCount gets a reference to the given int64 and assigns it to the RehydratedIndexedEventsCount field. +func (o *UsageLogsByRetentionHour) SetRehydratedIndexedEventsCount(v int64) { + o.RehydratedIndexedEventsCount = &v +} + +// GetRetention returns the Retention field value if set, zero value otherwise. +func (o *UsageLogsByRetentionHour) GetRetention() string { + if o == nil || o.Retention == nil { + var ret string + return ret + } + return *o.Retention +} + +// GetRetentionOk returns a tuple with the Retention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByRetentionHour) GetRetentionOk() (*string, bool) { + if o == nil || o.Retention == nil { + return nil, false + } + return o.Retention, true +} + +// HasRetention returns a boolean if a field has been set. +func (o *UsageLogsByRetentionHour) HasRetention() bool { + if o != nil && o.Retention != nil { + return true + } + + return false +} + +// SetRetention gets a reference to the given string and assigns it to the Retention field. +func (o *UsageLogsByRetentionHour) SetRetention(v string) { + o.Retention = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLogsByRetentionHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IndexedEventsCount != nil { + toSerialize["indexed_events_count"] = o.IndexedEventsCount + } + if o.LiveIndexedEventsCount != nil { + toSerialize["live_indexed_events_count"] = o.LiveIndexedEventsCount + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.RehydratedIndexedEventsCount != nil { + toSerialize["rehydrated_indexed_events_count"] = o.RehydratedIndexedEventsCount + } + if o.Retention != nil { + toSerialize["retention"] = o.Retention + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLogsByRetentionHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + LiveIndexedEventsCount *int64 `json:"live_indexed_events_count,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + RehydratedIndexedEventsCount *int64 `json:"rehydrated_indexed_events_count,omitempty"` + Retention *string `json:"retention,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IndexedEventsCount = all.IndexedEventsCount + o.LiveIndexedEventsCount = all.LiveIndexedEventsCount + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.RehydratedIndexedEventsCount = all.RehydratedIndexedEventsCount + o.Retention = all.Retention + return nil +} diff --git a/api/v1/datadog/model_usage_logs_by_retention_response.go b/api/v1/datadog/model_usage_logs_by_retention_response.go new file mode 100644 index 00000000000..42ab5bd6afc --- /dev/null +++ b/api/v1/datadog/model_usage_logs_by_retention_response.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 datadog + +import ( + "encoding/json" +) + +// UsageLogsByRetentionResponse Response containing the indexed logs usage broken down by retention period for an organization during a given hour. +type UsageLogsByRetentionResponse struct { + // Get hourly usage for indexed logs by retention period. + Usage []UsageLogsByRetentionHour `json:"usage,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{} +} + +// NewUsageLogsByRetentionResponse instantiates a new UsageLogsByRetentionResponse 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 NewUsageLogsByRetentionResponse() *UsageLogsByRetentionResponse { + this := UsageLogsByRetentionResponse{} + return &this +} + +// NewUsageLogsByRetentionResponseWithDefaults instantiates a new UsageLogsByRetentionResponse 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 NewUsageLogsByRetentionResponseWithDefaults() *UsageLogsByRetentionResponse { + this := UsageLogsByRetentionResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageLogsByRetentionResponse) GetUsage() []UsageLogsByRetentionHour { + if o == nil || o.Usage == nil { + var ret []UsageLogsByRetentionHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsByRetentionResponse) GetUsageOk() (*[]UsageLogsByRetentionHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageLogsByRetentionResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageLogsByRetentionHour and assigns it to the Usage field. +func (o *UsageLogsByRetentionResponse) SetUsage(v []UsageLogsByRetentionHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLogsByRetentionResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLogsByRetentionResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageLogsByRetentionHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_logs_hour.go b/api/v1/datadog/model_usage_logs_hour.go new file mode 100644 index 00000000000..bb86af1cf7c --- /dev/null +++ b/api/v1/datadog/model_usage_logs_hour.go @@ -0,0 +1,458 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageLogsHour Hour usage for logs. +type UsageLogsHour struct { + // Contains the number of billable log bytes ingested. + BillableIngestedBytes *int64 `json:"billable_ingested_bytes,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the number of log events indexed. + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + // Contains the number of log bytes ingested. + IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` + // Contains the number of live log events indexed (data available as of December 1, 2020). + LogsLiveIndexedCount *int64 `json:"logs_live_indexed_count,omitempty"` + // Contains the number of live log bytes ingested (data available as of December 1, 2020). + LogsLiveIngestedBytes *int64 `json:"logs_live_ingested_bytes,omitempty"` + // Contains the number of rehydrated log events indexed (data available as of December 1, 2020). + LogsRehydratedIndexedCount *int64 `json:"logs_rehydrated_indexed_count,omitempty"` + // Contains the number of rehydrated log bytes ingested (data available as of December 1, 2020). + LogsRehydratedIngestedBytes *int64 `json:"logs_rehydrated_ingested_bytes,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageLogsHour instantiates a new UsageLogsHour 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 NewUsageLogsHour() *UsageLogsHour { + this := UsageLogsHour{} + return &this +} + +// NewUsageLogsHourWithDefaults instantiates a new UsageLogsHour 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 NewUsageLogsHourWithDefaults() *UsageLogsHour { + this := UsageLogsHour{} + return &this +} + +// GetBillableIngestedBytes returns the BillableIngestedBytes field value if set, zero value otherwise. +func (o *UsageLogsHour) GetBillableIngestedBytes() int64 { + if o == nil || o.BillableIngestedBytes == nil { + var ret int64 + return ret + } + return *o.BillableIngestedBytes +} + +// GetBillableIngestedBytesOk returns a tuple with the BillableIngestedBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetBillableIngestedBytesOk() (*int64, bool) { + if o == nil || o.BillableIngestedBytes == nil { + return nil, false + } + return o.BillableIngestedBytes, true +} + +// HasBillableIngestedBytes returns a boolean if a field has been set. +func (o *UsageLogsHour) HasBillableIngestedBytes() bool { + if o != nil && o.BillableIngestedBytes != nil { + return true + } + + return false +} + +// SetBillableIngestedBytes gets a reference to the given int64 and assigns it to the BillableIngestedBytes field. +func (o *UsageLogsHour) SetBillableIngestedBytes(v int64) { + o.BillableIngestedBytes = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageLogsHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageLogsHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageLogsHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. +func (o *UsageLogsHour) GetIndexedEventsCount() int64 { + if o == nil || o.IndexedEventsCount == nil { + var ret int64 + return ret + } + return *o.IndexedEventsCount +} + +// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetIndexedEventsCountOk() (*int64, bool) { + if o == nil || o.IndexedEventsCount == nil { + return nil, false + } + return o.IndexedEventsCount, true +} + +// HasIndexedEventsCount returns a boolean if a field has been set. +func (o *UsageLogsHour) HasIndexedEventsCount() bool { + if o != nil && o.IndexedEventsCount != nil { + return true + } + + return false +} + +// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. +func (o *UsageLogsHour) SetIndexedEventsCount(v int64) { + o.IndexedEventsCount = &v +} + +// GetIngestedEventsBytes returns the IngestedEventsBytes field value if set, zero value otherwise. +func (o *UsageLogsHour) GetIngestedEventsBytes() int64 { + if o == nil || o.IngestedEventsBytes == nil { + var ret int64 + return ret + } + return *o.IngestedEventsBytes +} + +// GetIngestedEventsBytesOk returns a tuple with the IngestedEventsBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetIngestedEventsBytesOk() (*int64, bool) { + if o == nil || o.IngestedEventsBytes == nil { + return nil, false + } + return o.IngestedEventsBytes, true +} + +// HasIngestedEventsBytes returns a boolean if a field has been set. +func (o *UsageLogsHour) HasIngestedEventsBytes() bool { + if o != nil && o.IngestedEventsBytes != nil { + return true + } + + return false +} + +// SetIngestedEventsBytes gets a reference to the given int64 and assigns it to the IngestedEventsBytes field. +func (o *UsageLogsHour) SetIngestedEventsBytes(v int64) { + o.IngestedEventsBytes = &v +} + +// GetLogsLiveIndexedCount returns the LogsLiveIndexedCount field value if set, zero value otherwise. +func (o *UsageLogsHour) GetLogsLiveIndexedCount() int64 { + if o == nil || o.LogsLiveIndexedCount == nil { + var ret int64 + return ret + } + return *o.LogsLiveIndexedCount +} + +// GetLogsLiveIndexedCountOk returns a tuple with the LogsLiveIndexedCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetLogsLiveIndexedCountOk() (*int64, bool) { + if o == nil || o.LogsLiveIndexedCount == nil { + return nil, false + } + return o.LogsLiveIndexedCount, true +} + +// HasLogsLiveIndexedCount returns a boolean if a field has been set. +func (o *UsageLogsHour) HasLogsLiveIndexedCount() bool { + if o != nil && o.LogsLiveIndexedCount != nil { + return true + } + + return false +} + +// SetLogsLiveIndexedCount gets a reference to the given int64 and assigns it to the LogsLiveIndexedCount field. +func (o *UsageLogsHour) SetLogsLiveIndexedCount(v int64) { + o.LogsLiveIndexedCount = &v +} + +// GetLogsLiveIngestedBytes returns the LogsLiveIngestedBytes field value if set, zero value otherwise. +func (o *UsageLogsHour) GetLogsLiveIngestedBytes() int64 { + if o == nil || o.LogsLiveIngestedBytes == nil { + var ret int64 + return ret + } + return *o.LogsLiveIngestedBytes +} + +// GetLogsLiveIngestedBytesOk returns a tuple with the LogsLiveIngestedBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetLogsLiveIngestedBytesOk() (*int64, bool) { + if o == nil || o.LogsLiveIngestedBytes == nil { + return nil, false + } + return o.LogsLiveIngestedBytes, true +} + +// HasLogsLiveIngestedBytes returns a boolean if a field has been set. +func (o *UsageLogsHour) HasLogsLiveIngestedBytes() bool { + if o != nil && o.LogsLiveIngestedBytes != nil { + return true + } + + return false +} + +// SetLogsLiveIngestedBytes gets a reference to the given int64 and assigns it to the LogsLiveIngestedBytes field. +func (o *UsageLogsHour) SetLogsLiveIngestedBytes(v int64) { + o.LogsLiveIngestedBytes = &v +} + +// GetLogsRehydratedIndexedCount returns the LogsRehydratedIndexedCount field value if set, zero value otherwise. +func (o *UsageLogsHour) GetLogsRehydratedIndexedCount() int64 { + if o == nil || o.LogsRehydratedIndexedCount == nil { + var ret int64 + return ret + } + return *o.LogsRehydratedIndexedCount +} + +// GetLogsRehydratedIndexedCountOk returns a tuple with the LogsRehydratedIndexedCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetLogsRehydratedIndexedCountOk() (*int64, bool) { + if o == nil || o.LogsRehydratedIndexedCount == nil { + return nil, false + } + return o.LogsRehydratedIndexedCount, true +} + +// HasLogsRehydratedIndexedCount returns a boolean if a field has been set. +func (o *UsageLogsHour) HasLogsRehydratedIndexedCount() bool { + if o != nil && o.LogsRehydratedIndexedCount != nil { + return true + } + + return false +} + +// SetLogsRehydratedIndexedCount gets a reference to the given int64 and assigns it to the LogsRehydratedIndexedCount field. +func (o *UsageLogsHour) SetLogsRehydratedIndexedCount(v int64) { + o.LogsRehydratedIndexedCount = &v +} + +// GetLogsRehydratedIngestedBytes returns the LogsRehydratedIngestedBytes field value if set, zero value otherwise. +func (o *UsageLogsHour) GetLogsRehydratedIngestedBytes() int64 { + if o == nil || o.LogsRehydratedIngestedBytes == nil { + var ret int64 + return ret + } + return *o.LogsRehydratedIngestedBytes +} + +// GetLogsRehydratedIngestedBytesOk returns a tuple with the LogsRehydratedIngestedBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetLogsRehydratedIngestedBytesOk() (*int64, bool) { + if o == nil || o.LogsRehydratedIngestedBytes == nil { + return nil, false + } + return o.LogsRehydratedIngestedBytes, true +} + +// HasLogsRehydratedIngestedBytes returns a boolean if a field has been set. +func (o *UsageLogsHour) HasLogsRehydratedIngestedBytes() bool { + if o != nil && o.LogsRehydratedIngestedBytes != nil { + return true + } + + return false +} + +// SetLogsRehydratedIngestedBytes gets a reference to the given int64 and assigns it to the LogsRehydratedIngestedBytes field. +func (o *UsageLogsHour) SetLogsRehydratedIngestedBytes(v int64) { + o.LogsRehydratedIngestedBytes = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageLogsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageLogsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageLogsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageLogsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageLogsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageLogsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLogsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BillableIngestedBytes != nil { + toSerialize["billable_ingested_bytes"] = o.BillableIngestedBytes + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.IndexedEventsCount != nil { + toSerialize["indexed_events_count"] = o.IndexedEventsCount + } + if o.IngestedEventsBytes != nil { + toSerialize["ingested_events_bytes"] = o.IngestedEventsBytes + } + if o.LogsLiveIndexedCount != nil { + toSerialize["logs_live_indexed_count"] = o.LogsLiveIndexedCount + } + if o.LogsLiveIngestedBytes != nil { + toSerialize["logs_live_ingested_bytes"] = o.LogsLiveIngestedBytes + } + if o.LogsRehydratedIndexedCount != nil { + toSerialize["logs_rehydrated_indexed_count"] = o.LogsRehydratedIndexedCount + } + if o.LogsRehydratedIngestedBytes != nil { + toSerialize["logs_rehydrated_ingested_bytes"] = o.LogsRehydratedIngestedBytes + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLogsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BillableIngestedBytes *int64 `json:"billable_ingested_bytes,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"` + LogsLiveIndexedCount *int64 `json:"logs_live_indexed_count,omitempty"` + LogsLiveIngestedBytes *int64 `json:"logs_live_ingested_bytes,omitempty"` + LogsRehydratedIndexedCount *int64 `json:"logs_rehydrated_indexed_count,omitempty"` + LogsRehydratedIngestedBytes *int64 `json:"logs_rehydrated_ingested_bytes,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BillableIngestedBytes = all.BillableIngestedBytes + o.Hour = all.Hour + o.IndexedEventsCount = all.IndexedEventsCount + o.IngestedEventsBytes = all.IngestedEventsBytes + o.LogsLiveIndexedCount = all.LogsLiveIndexedCount + o.LogsLiveIngestedBytes = all.LogsLiveIngestedBytes + o.LogsRehydratedIndexedCount = all.LogsRehydratedIndexedCount + o.LogsRehydratedIngestedBytes = all.LogsRehydratedIngestedBytes + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_logs_response.go b/api/v1/datadog/model_usage_logs_response.go new file mode 100644 index 00000000000..3262eec27cf --- /dev/null +++ b/api/v1/datadog/model_usage_logs_response.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 datadog + +import ( + "encoding/json" +) + +// UsageLogsResponse Response containing the number of logs for each hour. +type UsageLogsResponse struct { + // An array of objects regarding hourly usage of logs. + Usage []UsageLogsHour `json:"usage,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{} +} + +// NewUsageLogsResponse instantiates a new UsageLogsResponse 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 NewUsageLogsResponse() *UsageLogsResponse { + this := UsageLogsResponse{} + return &this +} + +// NewUsageLogsResponseWithDefaults instantiates a new UsageLogsResponse 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 NewUsageLogsResponseWithDefaults() *UsageLogsResponse { + this := UsageLogsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageLogsResponse) GetUsage() []UsageLogsHour { + if o == nil || o.Usage == nil { + var ret []UsageLogsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLogsResponse) GetUsageOk() (*[]UsageLogsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageLogsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageLogsHour and assigns it to the Usage field. +func (o *UsageLogsResponse) SetUsage(v []UsageLogsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLogsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLogsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageLogsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_metric_category.go b/api/v1/datadog/model_usage_metric_category.go new file mode 100644 index 00000000000..3f122e0671d --- /dev/null +++ b/api/v1/datadog/model_usage_metric_category.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsageMetricCategory Contains the metric category. +type UsageMetricCategory string + +// List of UsageMetricCategory. +const ( + USAGEMETRICCATEGORY_STANDARD UsageMetricCategory = "standard" + USAGEMETRICCATEGORY_CUSTOM UsageMetricCategory = "custom" +) + +var allowedUsageMetricCategoryEnumValues = []UsageMetricCategory{ + USAGEMETRICCATEGORY_STANDARD, + USAGEMETRICCATEGORY_CUSTOM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsageMetricCategory) GetAllowedValues() []UsageMetricCategory { + return allowedUsageMetricCategoryEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsageMetricCategory) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsageMetricCategory(value) + return nil +} + +// NewUsageMetricCategoryFromValue returns a pointer to a valid UsageMetricCategory +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsageMetricCategoryFromValue(v string) (*UsageMetricCategory, error) { + ev := UsageMetricCategory(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsageMetricCategory: valid values are %v", v, allowedUsageMetricCategoryEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsageMetricCategory) IsValid() bool { + for _, existing := range allowedUsageMetricCategoryEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsageMetricCategory value. +func (v UsageMetricCategory) Ptr() *UsageMetricCategory { + return &v +} + +// NullableUsageMetricCategory handles when a null is used for UsageMetricCategory. +type NullableUsageMetricCategory struct { + value *UsageMetricCategory + isSet bool +} + +// Get returns the associated value. +func (v NullableUsageMetricCategory) Get() *UsageMetricCategory { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsageMetricCategory) Set(val *UsageMetricCategory) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsageMetricCategory) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsageMetricCategory) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsageMetricCategory initializes the struct as if Set has been called. +func NewNullableUsageMetricCategory(val *UsageMetricCategory) *NullableUsageMetricCategory { + return &NullableUsageMetricCategory{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsageMetricCategory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsageMetricCategory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_usage_network_flows_hour.go b/api/v1/datadog/model_usage_network_flows_hour.go new file mode 100644 index 00000000000..9491b4e1678 --- /dev/null +++ b/api/v1/datadog/model_usage_network_flows_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageNetworkFlowsHour Number of netflow events indexed for each hour for a given organization. +type UsageNetworkFlowsHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the number of netflow events indexed. + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageNetworkFlowsHour instantiates a new UsageNetworkFlowsHour 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 NewUsageNetworkFlowsHour() *UsageNetworkFlowsHour { + this := UsageNetworkFlowsHour{} + return &this +} + +// NewUsageNetworkFlowsHourWithDefaults instantiates a new UsageNetworkFlowsHour 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 NewUsageNetworkFlowsHourWithDefaults() *UsageNetworkFlowsHour { + this := UsageNetworkFlowsHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageNetworkFlowsHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkFlowsHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageNetworkFlowsHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageNetworkFlowsHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetIndexedEventsCount returns the IndexedEventsCount field value if set, zero value otherwise. +func (o *UsageNetworkFlowsHour) GetIndexedEventsCount() int64 { + if o == nil || o.IndexedEventsCount == nil { + var ret int64 + return ret + } + return *o.IndexedEventsCount +} + +// GetIndexedEventsCountOk returns a tuple with the IndexedEventsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkFlowsHour) GetIndexedEventsCountOk() (*int64, bool) { + if o == nil || o.IndexedEventsCount == nil { + return nil, false + } + return o.IndexedEventsCount, true +} + +// HasIndexedEventsCount returns a boolean if a field has been set. +func (o *UsageNetworkFlowsHour) HasIndexedEventsCount() bool { + if o != nil && o.IndexedEventsCount != nil { + return true + } + + return false +} + +// SetIndexedEventsCount gets a reference to the given int64 and assigns it to the IndexedEventsCount field. +func (o *UsageNetworkFlowsHour) SetIndexedEventsCount(v int64) { + o.IndexedEventsCount = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageNetworkFlowsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkFlowsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageNetworkFlowsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageNetworkFlowsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageNetworkFlowsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkFlowsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageNetworkFlowsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageNetworkFlowsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageNetworkFlowsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.IndexedEventsCount != nil { + toSerialize["indexed_events_count"] = o.IndexedEventsCount + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageNetworkFlowsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + IndexedEventsCount *int64 `json:"indexed_events_count,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.IndexedEventsCount = all.IndexedEventsCount + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_network_flows_response.go b/api/v1/datadog/model_usage_network_flows_response.go new file mode 100644 index 00000000000..463d5fd8e95 --- /dev/null +++ b/api/v1/datadog/model_usage_network_flows_response.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 datadog + +import ( + "encoding/json" +) + +// UsageNetworkFlowsResponse Response containing the number of netflow events indexed for each hour for a given organization. +type UsageNetworkFlowsResponse struct { + // Get hourly usage for Network Flows. + Usage []UsageNetworkFlowsHour `json:"usage,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{} +} + +// NewUsageNetworkFlowsResponse instantiates a new UsageNetworkFlowsResponse 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 NewUsageNetworkFlowsResponse() *UsageNetworkFlowsResponse { + this := UsageNetworkFlowsResponse{} + return &this +} + +// NewUsageNetworkFlowsResponseWithDefaults instantiates a new UsageNetworkFlowsResponse 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 NewUsageNetworkFlowsResponseWithDefaults() *UsageNetworkFlowsResponse { + this := UsageNetworkFlowsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageNetworkFlowsResponse) GetUsage() []UsageNetworkFlowsHour { + if o == nil || o.Usage == nil { + var ret []UsageNetworkFlowsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkFlowsResponse) GetUsageOk() (*[]UsageNetworkFlowsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageNetworkFlowsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageNetworkFlowsHour and assigns it to the Usage field. +func (o *UsageNetworkFlowsResponse) SetUsage(v []UsageNetworkFlowsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageNetworkFlowsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageNetworkFlowsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageNetworkFlowsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_network_hosts_hour.go b/api/v1/datadog/model_usage_network_hosts_hour.go new file mode 100644 index 00000000000..e79ed7f5eb0 --- /dev/null +++ b/api/v1/datadog/model_usage_network_hosts_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageNetworkHostsHour Number of active NPM hosts for each hour for a given organization. +type UsageNetworkHostsHour struct { + // Contains the number of active NPM hosts. + HostCount *int64 `json:"host_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageNetworkHostsHour instantiates a new UsageNetworkHostsHour 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 NewUsageNetworkHostsHour() *UsageNetworkHostsHour { + this := UsageNetworkHostsHour{} + return &this +} + +// NewUsageNetworkHostsHourWithDefaults instantiates a new UsageNetworkHostsHour 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 NewUsageNetworkHostsHourWithDefaults() *UsageNetworkHostsHour { + this := UsageNetworkHostsHour{} + return &this +} + +// GetHostCount returns the HostCount field value if set, zero value otherwise. +func (o *UsageNetworkHostsHour) GetHostCount() int64 { + if o == nil || o.HostCount == nil { + var ret int64 + return ret + } + return *o.HostCount +} + +// GetHostCountOk returns a tuple with the HostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkHostsHour) GetHostCountOk() (*int64, bool) { + if o == nil || o.HostCount == nil { + return nil, false + } + return o.HostCount, true +} + +// HasHostCount returns a boolean if a field has been set. +func (o *UsageNetworkHostsHour) HasHostCount() bool { + if o != nil && o.HostCount != nil { + return true + } + + return false +} + +// SetHostCount gets a reference to the given int64 and assigns it to the HostCount field. +func (o *UsageNetworkHostsHour) SetHostCount(v int64) { + o.HostCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageNetworkHostsHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkHostsHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageNetworkHostsHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageNetworkHostsHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageNetworkHostsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkHostsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageNetworkHostsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageNetworkHostsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageNetworkHostsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkHostsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageNetworkHostsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageNetworkHostsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageNetworkHostsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.HostCount != nil { + toSerialize["host_count"] = o.HostCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageNetworkHostsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + HostCount *int64 `json:"host_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.HostCount = all.HostCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_network_hosts_response.go b/api/v1/datadog/model_usage_network_hosts_response.go new file mode 100644 index 00000000000..fe2919bc8a8 --- /dev/null +++ b/api/v1/datadog/model_usage_network_hosts_response.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 datadog + +import ( + "encoding/json" +) + +// UsageNetworkHostsResponse Response containing the number of active NPM hosts for each hour for a given organization. +type UsageNetworkHostsResponse struct { + // Get hourly usage for NPM hosts. + Usage []UsageNetworkHostsHour `json:"usage,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{} +} + +// NewUsageNetworkHostsResponse instantiates a new UsageNetworkHostsResponse 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 NewUsageNetworkHostsResponse() *UsageNetworkHostsResponse { + this := UsageNetworkHostsResponse{} + return &this +} + +// NewUsageNetworkHostsResponseWithDefaults instantiates a new UsageNetworkHostsResponse 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 NewUsageNetworkHostsResponseWithDefaults() *UsageNetworkHostsResponse { + this := UsageNetworkHostsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageNetworkHostsResponse) GetUsage() []UsageNetworkHostsHour { + if o == nil || o.Usage == nil { + var ret []UsageNetworkHostsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageNetworkHostsResponse) GetUsageOk() (*[]UsageNetworkHostsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageNetworkHostsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageNetworkHostsHour and assigns it to the Usage field. +func (o *UsageNetworkHostsResponse) SetUsage(v []UsageNetworkHostsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageNetworkHostsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageNetworkHostsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageNetworkHostsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_online_archive_hour.go b/api/v1/datadog/model_usage_online_archive_hour.go new file mode 100644 index 00000000000..5849b8578ae --- /dev/null +++ b/api/v1/datadog/model_usage_online_archive_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageOnlineArchiveHour Online Archive usage in a given hour. +type UsageOnlineArchiveHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Total count of online archived events within the hour. + OnlineArchiveEventsCount *int32 `json:"online_archive_events_count,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageOnlineArchiveHour instantiates a new UsageOnlineArchiveHour 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 NewUsageOnlineArchiveHour() *UsageOnlineArchiveHour { + this := UsageOnlineArchiveHour{} + return &this +} + +// NewUsageOnlineArchiveHourWithDefaults instantiates a new UsageOnlineArchiveHour 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 NewUsageOnlineArchiveHourWithDefaults() *UsageOnlineArchiveHour { + this := UsageOnlineArchiveHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageOnlineArchiveHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageOnlineArchiveHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageOnlineArchiveHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageOnlineArchiveHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOnlineArchiveEventsCount returns the OnlineArchiveEventsCount field value if set, zero value otherwise. +func (o *UsageOnlineArchiveHour) GetOnlineArchiveEventsCount() int32 { + if o == nil || o.OnlineArchiveEventsCount == nil { + var ret int32 + return ret + } + return *o.OnlineArchiveEventsCount +} + +// GetOnlineArchiveEventsCountOk returns a tuple with the OnlineArchiveEventsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageOnlineArchiveHour) GetOnlineArchiveEventsCountOk() (*int32, bool) { + if o == nil || o.OnlineArchiveEventsCount == nil { + return nil, false + } + return o.OnlineArchiveEventsCount, true +} + +// HasOnlineArchiveEventsCount returns a boolean if a field has been set. +func (o *UsageOnlineArchiveHour) HasOnlineArchiveEventsCount() bool { + if o != nil && o.OnlineArchiveEventsCount != nil { + return true + } + + return false +} + +// SetOnlineArchiveEventsCount gets a reference to the given int32 and assigns it to the OnlineArchiveEventsCount field. +func (o *UsageOnlineArchiveHour) SetOnlineArchiveEventsCount(v int32) { + o.OnlineArchiveEventsCount = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageOnlineArchiveHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageOnlineArchiveHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageOnlineArchiveHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageOnlineArchiveHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageOnlineArchiveHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageOnlineArchiveHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageOnlineArchiveHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageOnlineArchiveHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageOnlineArchiveHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OnlineArchiveEventsCount != nil { + toSerialize["online_archive_events_count"] = o.OnlineArchiveEventsCount + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageOnlineArchiveHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + OnlineArchiveEventsCount *int32 `json:"online_archive_events_count,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.OnlineArchiveEventsCount = all.OnlineArchiveEventsCount + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_online_archive_response.go b/api/v1/datadog/model_usage_online_archive_response.go new file mode 100644 index 00000000000..b0ff2a22c7d --- /dev/null +++ b/api/v1/datadog/model_usage_online_archive_response.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 datadog + +import ( + "encoding/json" +) + +// UsageOnlineArchiveResponse Online Archive usage response. +type UsageOnlineArchiveResponse struct { + // Response containing Online Archive usage. + Usage []UsageOnlineArchiveHour `json:"usage,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{} +} + +// NewUsageOnlineArchiveResponse instantiates a new UsageOnlineArchiveResponse 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 NewUsageOnlineArchiveResponse() *UsageOnlineArchiveResponse { + this := UsageOnlineArchiveResponse{} + return &this +} + +// NewUsageOnlineArchiveResponseWithDefaults instantiates a new UsageOnlineArchiveResponse 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 NewUsageOnlineArchiveResponseWithDefaults() *UsageOnlineArchiveResponse { + this := UsageOnlineArchiveResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageOnlineArchiveResponse) GetUsage() []UsageOnlineArchiveHour { + if o == nil || o.Usage == nil { + var ret []UsageOnlineArchiveHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageOnlineArchiveResponse) GetUsageOk() (*[]UsageOnlineArchiveHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageOnlineArchiveResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageOnlineArchiveHour and assigns it to the Usage field. +func (o *UsageOnlineArchiveResponse) SetUsage(v []UsageOnlineArchiveHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageOnlineArchiveResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageOnlineArchiveResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageOnlineArchiveHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_profiling_hour.go b/api/v1/datadog/model_usage_profiling_hour.go new file mode 100644 index 00000000000..684540c0ce1 --- /dev/null +++ b/api/v1/datadog/model_usage_profiling_hour.go @@ -0,0 +1,263 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageProfilingHour The number of profiled hosts for each hour for a given organization. +type UsageProfilingHour struct { + // Get average number of container agents for that hour. + AvgContainerAgentCount *int64 `json:"avg_container_agent_count,omitempty"` + // Contains the total number of profiled hosts reporting during a given hour. + HostCount *int64 `json:"host_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageProfilingHour instantiates a new UsageProfilingHour 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 NewUsageProfilingHour() *UsageProfilingHour { + this := UsageProfilingHour{} + return &this +} + +// NewUsageProfilingHourWithDefaults instantiates a new UsageProfilingHour 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 NewUsageProfilingHourWithDefaults() *UsageProfilingHour { + this := UsageProfilingHour{} + return &this +} + +// GetAvgContainerAgentCount returns the AvgContainerAgentCount field value if set, zero value otherwise. +func (o *UsageProfilingHour) GetAvgContainerAgentCount() int64 { + if o == nil || o.AvgContainerAgentCount == nil { + var ret int64 + return ret + } + return *o.AvgContainerAgentCount +} + +// GetAvgContainerAgentCountOk returns a tuple with the AvgContainerAgentCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageProfilingHour) GetAvgContainerAgentCountOk() (*int64, bool) { + if o == nil || o.AvgContainerAgentCount == nil { + return nil, false + } + return o.AvgContainerAgentCount, true +} + +// HasAvgContainerAgentCount returns a boolean if a field has been set. +func (o *UsageProfilingHour) HasAvgContainerAgentCount() bool { + if o != nil && o.AvgContainerAgentCount != nil { + return true + } + + return false +} + +// SetAvgContainerAgentCount gets a reference to the given int64 and assigns it to the AvgContainerAgentCount field. +func (o *UsageProfilingHour) SetAvgContainerAgentCount(v int64) { + o.AvgContainerAgentCount = &v +} + +// GetHostCount returns the HostCount field value if set, zero value otherwise. +func (o *UsageProfilingHour) GetHostCount() int64 { + if o == nil || o.HostCount == nil { + var ret int64 + return ret + } + return *o.HostCount +} + +// GetHostCountOk returns a tuple with the HostCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageProfilingHour) GetHostCountOk() (*int64, bool) { + if o == nil || o.HostCount == nil { + return nil, false + } + return o.HostCount, true +} + +// HasHostCount returns a boolean if a field has been set. +func (o *UsageProfilingHour) HasHostCount() bool { + if o != nil && o.HostCount != nil { + return true + } + + return false +} + +// SetHostCount gets a reference to the given int64 and assigns it to the HostCount field. +func (o *UsageProfilingHour) SetHostCount(v int64) { + o.HostCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageProfilingHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageProfilingHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageProfilingHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageProfilingHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageProfilingHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageProfilingHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageProfilingHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageProfilingHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageProfilingHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageProfilingHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageProfilingHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageProfilingHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageProfilingHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AvgContainerAgentCount != nil { + toSerialize["avg_container_agent_count"] = o.AvgContainerAgentCount + } + if o.HostCount != nil { + toSerialize["host_count"] = o.HostCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageProfilingHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AvgContainerAgentCount *int64 `json:"avg_container_agent_count,omitempty"` + HostCount *int64 `json:"host_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AvgContainerAgentCount = all.AvgContainerAgentCount + o.HostCount = all.HostCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_profiling_response.go b/api/v1/datadog/model_usage_profiling_response.go new file mode 100644 index 00000000000..4b909dde184 --- /dev/null +++ b/api/v1/datadog/model_usage_profiling_response.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 datadog + +import ( + "encoding/json" +) + +// UsageProfilingResponse Response containing the number of profiled hosts for each hour for a given organization. +type UsageProfilingResponse struct { + // Get hourly usage for profiled hosts. + Usage []UsageProfilingHour `json:"usage,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{} +} + +// NewUsageProfilingResponse instantiates a new UsageProfilingResponse 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 NewUsageProfilingResponse() *UsageProfilingResponse { + this := UsageProfilingResponse{} + return &this +} + +// NewUsageProfilingResponseWithDefaults instantiates a new UsageProfilingResponse 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 NewUsageProfilingResponseWithDefaults() *UsageProfilingResponse { + this := UsageProfilingResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageProfilingResponse) GetUsage() []UsageProfilingHour { + if o == nil || o.Usage == nil { + var ret []UsageProfilingHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageProfilingResponse) GetUsageOk() (*[]UsageProfilingHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageProfilingResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageProfilingHour and assigns it to the Usage field. +func (o *UsageProfilingResponse) SetUsage(v []UsageProfilingHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageProfilingResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageProfilingResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageProfilingHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_reports_type.go b/api/v1/datadog/model_usage_reports_type.go new file mode 100644 index 00000000000..ff5040d04fa --- /dev/null +++ b/api/v1/datadog/model_usage_reports_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsageReportsType The type of reports. +type UsageReportsType string + +// List of UsageReportsType. +const ( + USAGEREPORTSTYPE_REPORTS UsageReportsType = "reports" +) + +var allowedUsageReportsTypeEnumValues = []UsageReportsType{ + USAGEREPORTSTYPE_REPORTS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsageReportsType) GetAllowedValues() []UsageReportsType { + return allowedUsageReportsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsageReportsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsageReportsType(value) + return nil +} + +// NewUsageReportsTypeFromValue returns a pointer to a valid UsageReportsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsageReportsTypeFromValue(v string) (*UsageReportsType, error) { + ev := UsageReportsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsageReportsType: valid values are %v", v, allowedUsageReportsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsageReportsType) IsValid() bool { + for _, existing := range allowedUsageReportsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsageReportsType value. +func (v UsageReportsType) Ptr() *UsageReportsType { + return &v +} + +// NullableUsageReportsType handles when a null is used for UsageReportsType. +type NullableUsageReportsType struct { + value *UsageReportsType + isSet bool +} + +// Get returns the associated value. +func (v NullableUsageReportsType) Get() *UsageReportsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsageReportsType) Set(val *UsageReportsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsageReportsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsageReportsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsageReportsType initializes the struct as if Set has been called. +func NewNullableUsageReportsType(val *UsageReportsType) *NullableUsageReportsType { + return &NullableUsageReportsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsageReportsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsageReportsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_usage_rum_sessions_hour.go b/api/v1/datadog/model_usage_rum_sessions_hour.go new file mode 100644 index 00000000000..955b3ea24a2 --- /dev/null +++ b/api/v1/datadog/model_usage_rum_sessions_hour.go @@ -0,0 +1,426 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsageRumSessionsHour Number of RUM Sessions recorded for each hour for a given organization. +type UsageRumSessionsHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // Contains the number of RUM Replay Sessions (data available beginning November 1, 2021). + ReplaySessionCount *int64 `json:"replay_session_count,omitempty"` + // Contains the number of browser RUM Lite Sessions. + SessionCount common.NullableInt64 `json:"session_count,omitempty"` + // Contains the number of mobile RUM Sessions on Android (data available beginning December 1, 2020). + SessionCountAndroid common.NullableInt64 `json:"session_count_android,omitempty"` + // Contains the number of mobile RUM Sessions on iOS (data available beginning December 1, 2020). + SessionCountIos common.NullableInt64 `json:"session_count_ios,omitempty"` + // Contains the number of mobile RUM Sessions on React Native (data available beginning May 1, 2022). + SessionCountReactnative common.NullableInt64 `json:"session_count_reactnative,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{} +} + +// NewUsageRumSessionsHour instantiates a new UsageRumSessionsHour 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 NewUsageRumSessionsHour() *UsageRumSessionsHour { + this := UsageRumSessionsHour{} + return &this +} + +// NewUsageRumSessionsHourWithDefaults instantiates a new UsageRumSessionsHour 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 NewUsageRumSessionsHourWithDefaults() *UsageRumSessionsHour { + this := UsageRumSessionsHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageRumSessionsHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumSessionsHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageRumSessionsHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageRumSessionsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumSessionsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageRumSessionsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageRumSessionsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumSessionsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageRumSessionsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetReplaySessionCount returns the ReplaySessionCount field value if set, zero value otherwise. +func (o *UsageRumSessionsHour) GetReplaySessionCount() int64 { + if o == nil || o.ReplaySessionCount == nil { + var ret int64 + return ret + } + return *o.ReplaySessionCount +} + +// GetReplaySessionCountOk returns a tuple with the ReplaySessionCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumSessionsHour) GetReplaySessionCountOk() (*int64, bool) { + if o == nil || o.ReplaySessionCount == nil { + return nil, false + } + return o.ReplaySessionCount, true +} + +// HasReplaySessionCount returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasReplaySessionCount() bool { + if o != nil && o.ReplaySessionCount != nil { + return true + } + + return false +} + +// SetReplaySessionCount gets a reference to the given int64 and assigns it to the ReplaySessionCount field. +func (o *UsageRumSessionsHour) SetReplaySessionCount(v int64) { + o.ReplaySessionCount = &v +} + +// GetSessionCount returns the SessionCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageRumSessionsHour) GetSessionCount() int64 { + if o == nil || o.SessionCount.Get() == nil { + var ret int64 + return ret + } + return *o.SessionCount.Get() +} + +// GetSessionCountOk returns a tuple with the SessionCount 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 *UsageRumSessionsHour) GetSessionCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.SessionCount.Get(), o.SessionCount.IsSet() +} + +// HasSessionCount returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasSessionCount() bool { + if o != nil && o.SessionCount.IsSet() { + return true + } + + return false +} + +// SetSessionCount gets a reference to the given common.NullableInt64 and assigns it to the SessionCount field. +func (o *UsageRumSessionsHour) SetSessionCount(v int64) { + o.SessionCount.Set(&v) +} + +// SetSessionCountNil sets the value for SessionCount to be an explicit nil. +func (o *UsageRumSessionsHour) SetSessionCountNil() { + o.SessionCount.Set(nil) +} + +// UnsetSessionCount ensures that no value is present for SessionCount, not even an explicit nil. +func (o *UsageRumSessionsHour) UnsetSessionCount() { + o.SessionCount.Unset() +} + +// GetSessionCountAndroid returns the SessionCountAndroid field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageRumSessionsHour) GetSessionCountAndroid() int64 { + if o == nil || o.SessionCountAndroid.Get() == nil { + var ret int64 + return ret + } + return *o.SessionCountAndroid.Get() +} + +// GetSessionCountAndroidOk returns a tuple with the SessionCountAndroid 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 *UsageRumSessionsHour) GetSessionCountAndroidOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.SessionCountAndroid.Get(), o.SessionCountAndroid.IsSet() +} + +// HasSessionCountAndroid returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasSessionCountAndroid() bool { + if o != nil && o.SessionCountAndroid.IsSet() { + return true + } + + return false +} + +// SetSessionCountAndroid gets a reference to the given common.NullableInt64 and assigns it to the SessionCountAndroid field. +func (o *UsageRumSessionsHour) SetSessionCountAndroid(v int64) { + o.SessionCountAndroid.Set(&v) +} + +// SetSessionCountAndroidNil sets the value for SessionCountAndroid to be an explicit nil. +func (o *UsageRumSessionsHour) SetSessionCountAndroidNil() { + o.SessionCountAndroid.Set(nil) +} + +// UnsetSessionCountAndroid ensures that no value is present for SessionCountAndroid, not even an explicit nil. +func (o *UsageRumSessionsHour) UnsetSessionCountAndroid() { + o.SessionCountAndroid.Unset() +} + +// GetSessionCountIos returns the SessionCountIos field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageRumSessionsHour) GetSessionCountIos() int64 { + if o == nil || o.SessionCountIos.Get() == nil { + var ret int64 + return ret + } + return *o.SessionCountIos.Get() +} + +// GetSessionCountIosOk returns a tuple with the SessionCountIos 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 *UsageRumSessionsHour) GetSessionCountIosOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.SessionCountIos.Get(), o.SessionCountIos.IsSet() +} + +// HasSessionCountIos returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasSessionCountIos() bool { + if o != nil && o.SessionCountIos.IsSet() { + return true + } + + return false +} + +// SetSessionCountIos gets a reference to the given common.NullableInt64 and assigns it to the SessionCountIos field. +func (o *UsageRumSessionsHour) SetSessionCountIos(v int64) { + o.SessionCountIos.Set(&v) +} + +// SetSessionCountIosNil sets the value for SessionCountIos to be an explicit nil. +func (o *UsageRumSessionsHour) SetSessionCountIosNil() { + o.SessionCountIos.Set(nil) +} + +// UnsetSessionCountIos ensures that no value is present for SessionCountIos, not even an explicit nil. +func (o *UsageRumSessionsHour) UnsetSessionCountIos() { + o.SessionCountIos.Unset() +} + +// GetSessionCountReactnative returns the SessionCountReactnative field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageRumSessionsHour) GetSessionCountReactnative() int64 { + if o == nil || o.SessionCountReactnative.Get() == nil { + var ret int64 + return ret + } + return *o.SessionCountReactnative.Get() +} + +// GetSessionCountReactnativeOk returns a tuple with the SessionCountReactnative 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 *UsageRumSessionsHour) GetSessionCountReactnativeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.SessionCountReactnative.Get(), o.SessionCountReactnative.IsSet() +} + +// HasSessionCountReactnative returns a boolean if a field has been set. +func (o *UsageRumSessionsHour) HasSessionCountReactnative() bool { + if o != nil && o.SessionCountReactnative.IsSet() { + return true + } + + return false +} + +// SetSessionCountReactnative gets a reference to the given common.NullableInt64 and assigns it to the SessionCountReactnative field. +func (o *UsageRumSessionsHour) SetSessionCountReactnative(v int64) { + o.SessionCountReactnative.Set(&v) +} + +// SetSessionCountReactnativeNil sets the value for SessionCountReactnative to be an explicit nil. +func (o *UsageRumSessionsHour) SetSessionCountReactnativeNil() { + o.SessionCountReactnative.Set(nil) +} + +// UnsetSessionCountReactnative ensures that no value is present for SessionCountReactnative, not even an explicit nil. +func (o *UsageRumSessionsHour) UnsetSessionCountReactnative() { + o.SessionCountReactnative.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageRumSessionsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.ReplaySessionCount != nil { + toSerialize["replay_session_count"] = o.ReplaySessionCount + } + if o.SessionCount.IsSet() { + toSerialize["session_count"] = o.SessionCount.Get() + } + if o.SessionCountAndroid.IsSet() { + toSerialize["session_count_android"] = o.SessionCountAndroid.Get() + } + if o.SessionCountIos.IsSet() { + toSerialize["session_count_ios"] = o.SessionCountIos.Get() + } + if o.SessionCountReactnative.IsSet() { + toSerialize["session_count_reactnative"] = o.SessionCountReactnative.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageRumSessionsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + ReplaySessionCount *int64 `json:"replay_session_count,omitempty"` + SessionCount common.NullableInt64 `json:"session_count,omitempty"` + SessionCountAndroid common.NullableInt64 `json:"session_count_android,omitempty"` + SessionCountIos common.NullableInt64 `json:"session_count_ios,omitempty"` + SessionCountReactnative common.NullableInt64 `json:"session_count_reactnative,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.ReplaySessionCount = all.ReplaySessionCount + o.SessionCount = all.SessionCount + o.SessionCountAndroid = all.SessionCountAndroid + o.SessionCountIos = all.SessionCountIos + o.SessionCountReactnative = all.SessionCountReactnative + return nil +} diff --git a/api/v1/datadog/model_usage_rum_sessions_response.go b/api/v1/datadog/model_usage_rum_sessions_response.go new file mode 100644 index 00000000000..a56ab85d3a4 --- /dev/null +++ b/api/v1/datadog/model_usage_rum_sessions_response.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 datadog + +import ( + "encoding/json" +) + +// UsageRumSessionsResponse Response containing the number of RUM Sessions for each hour for a given organization. +type UsageRumSessionsResponse struct { + // Get hourly usage for RUM Sessions. + Usage []UsageRumSessionsHour `json:"usage,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{} +} + +// NewUsageRumSessionsResponse instantiates a new UsageRumSessionsResponse 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 NewUsageRumSessionsResponse() *UsageRumSessionsResponse { + this := UsageRumSessionsResponse{} + return &this +} + +// NewUsageRumSessionsResponseWithDefaults instantiates a new UsageRumSessionsResponse 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 NewUsageRumSessionsResponseWithDefaults() *UsageRumSessionsResponse { + this := UsageRumSessionsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageRumSessionsResponse) GetUsage() []UsageRumSessionsHour { + if o == nil || o.Usage == nil { + var ret []UsageRumSessionsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumSessionsResponse) GetUsageOk() (*[]UsageRumSessionsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageRumSessionsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageRumSessionsHour and assigns it to the Usage field. +func (o *UsageRumSessionsResponse) SetUsage(v []UsageRumSessionsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageRumSessionsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageRumSessionsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageRumSessionsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_rum_units_hour.go b/api/v1/datadog/model_usage_rum_units_hour.go new file mode 100644 index 00000000000..8aa0288f72c --- /dev/null +++ b/api/v1/datadog/model_usage_rum_units_hour.go @@ -0,0 +1,271 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsageRumUnitsHour Number of RUM Units used for each hour for a given organization (data available as of November 1, 2021). +type UsageRumUnitsHour struct { + // The number of browser RUM units. + BrowserRumUnits *int64 `json:"browser_rum_units,omitempty"` + // The number of mobile RUM units. + MobileRumUnits *int64 `json:"mobile_rum_units,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // Total RUM units across mobile and browser RUM. + RumUnits common.NullableInt64 `json:"rum_units,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{} +} + +// NewUsageRumUnitsHour instantiates a new UsageRumUnitsHour 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 NewUsageRumUnitsHour() *UsageRumUnitsHour { + this := UsageRumUnitsHour{} + return &this +} + +// NewUsageRumUnitsHourWithDefaults instantiates a new UsageRumUnitsHour 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 NewUsageRumUnitsHourWithDefaults() *UsageRumUnitsHour { + this := UsageRumUnitsHour{} + return &this +} + +// GetBrowserRumUnits returns the BrowserRumUnits field value if set, zero value otherwise. +func (o *UsageRumUnitsHour) GetBrowserRumUnits() int64 { + if o == nil || o.BrowserRumUnits == nil { + var ret int64 + return ret + } + return *o.BrowserRumUnits +} + +// GetBrowserRumUnitsOk returns a tuple with the BrowserRumUnits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumUnitsHour) GetBrowserRumUnitsOk() (*int64, bool) { + if o == nil || o.BrowserRumUnits == nil { + return nil, false + } + return o.BrowserRumUnits, true +} + +// HasBrowserRumUnits returns a boolean if a field has been set. +func (o *UsageRumUnitsHour) HasBrowserRumUnits() bool { + if o != nil && o.BrowserRumUnits != nil { + return true + } + + return false +} + +// SetBrowserRumUnits gets a reference to the given int64 and assigns it to the BrowserRumUnits field. +func (o *UsageRumUnitsHour) SetBrowserRumUnits(v int64) { + o.BrowserRumUnits = &v +} + +// GetMobileRumUnits returns the MobileRumUnits field value if set, zero value otherwise. +func (o *UsageRumUnitsHour) GetMobileRumUnits() int64 { + if o == nil || o.MobileRumUnits == nil { + var ret int64 + return ret + } + return *o.MobileRumUnits +} + +// GetMobileRumUnitsOk returns a tuple with the MobileRumUnits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumUnitsHour) GetMobileRumUnitsOk() (*int64, bool) { + if o == nil || o.MobileRumUnits == nil { + return nil, false + } + return o.MobileRumUnits, true +} + +// HasMobileRumUnits returns a boolean if a field has been set. +func (o *UsageRumUnitsHour) HasMobileRumUnits() bool { + if o != nil && o.MobileRumUnits != nil { + return true + } + + return false +} + +// SetMobileRumUnits gets a reference to the given int64 and assigns it to the MobileRumUnits field. +func (o *UsageRumUnitsHour) SetMobileRumUnits(v int64) { + o.MobileRumUnits = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageRumUnitsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumUnitsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageRumUnitsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageRumUnitsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageRumUnitsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumUnitsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageRumUnitsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageRumUnitsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetRumUnits returns the RumUnits field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageRumUnitsHour) GetRumUnits() int64 { + if o == nil || o.RumUnits.Get() == nil { + var ret int64 + return ret + } + return *o.RumUnits.Get() +} + +// GetRumUnitsOk returns a tuple with the RumUnits 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 *UsageRumUnitsHour) GetRumUnitsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.RumUnits.Get(), o.RumUnits.IsSet() +} + +// HasRumUnits returns a boolean if a field has been set. +func (o *UsageRumUnitsHour) HasRumUnits() bool { + if o != nil && o.RumUnits.IsSet() { + return true + } + + return false +} + +// SetRumUnits gets a reference to the given common.NullableInt64 and assigns it to the RumUnits field. +func (o *UsageRumUnitsHour) SetRumUnits(v int64) { + o.RumUnits.Set(&v) +} + +// SetRumUnitsNil sets the value for RumUnits to be an explicit nil. +func (o *UsageRumUnitsHour) SetRumUnitsNil() { + o.RumUnits.Set(nil) +} + +// UnsetRumUnits ensures that no value is present for RumUnits, not even an explicit nil. +func (o *UsageRumUnitsHour) UnsetRumUnits() { + o.RumUnits.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageRumUnitsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BrowserRumUnits != nil { + toSerialize["browser_rum_units"] = o.BrowserRumUnits + } + if o.MobileRumUnits != nil { + toSerialize["mobile_rum_units"] = o.MobileRumUnits + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.RumUnits.IsSet() { + toSerialize["rum_units"] = o.RumUnits.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageRumUnitsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BrowserRumUnits *int64 `json:"browser_rum_units,omitempty"` + MobileRumUnits *int64 `json:"mobile_rum_units,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + RumUnits common.NullableInt64 `json:"rum_units,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BrowserRumUnits = all.BrowserRumUnits + o.MobileRumUnits = all.MobileRumUnits + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.RumUnits = all.RumUnits + return nil +} diff --git a/api/v1/datadog/model_usage_rum_units_response.go b/api/v1/datadog/model_usage_rum_units_response.go new file mode 100644 index 00000000000..f44997b4242 --- /dev/null +++ b/api/v1/datadog/model_usage_rum_units_response.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 datadog + +import ( + "encoding/json" +) + +// UsageRumUnitsResponse Response containing the number of RUM Units for each hour for a given organization. +type UsageRumUnitsResponse struct { + // Get hourly usage for RUM Units. + Usage []UsageRumUnitsHour `json:"usage,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{} +} + +// NewUsageRumUnitsResponse instantiates a new UsageRumUnitsResponse 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 NewUsageRumUnitsResponse() *UsageRumUnitsResponse { + this := UsageRumUnitsResponse{} + return &this +} + +// NewUsageRumUnitsResponseWithDefaults instantiates a new UsageRumUnitsResponse 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 NewUsageRumUnitsResponseWithDefaults() *UsageRumUnitsResponse { + this := UsageRumUnitsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageRumUnitsResponse) GetUsage() []UsageRumUnitsHour { + if o == nil || o.Usage == nil { + var ret []UsageRumUnitsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageRumUnitsResponse) GetUsageOk() (*[]UsageRumUnitsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageRumUnitsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageRumUnitsHour and assigns it to the Usage field. +func (o *UsageRumUnitsResponse) SetUsage(v []UsageRumUnitsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageRumUnitsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageRumUnitsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageRumUnitsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_sds_hour.go b/api/v1/datadog/model_usage_sds_hour.go new file mode 100644 index 00000000000..50000f6267b --- /dev/null +++ b/api/v1/datadog/model_usage_sds_hour.go @@ -0,0 +1,263 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageSDSHour Sensitive Data Scanner usage for a given organization for a given hour. +type UsageSDSHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The total number of bytes scanned of logs usage by the Sensitive Data Scanner from the start of the given hour’s month until the given hour. + LogsScannedBytes *int64 `json:"logs_scanned_bytes,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The total number of bytes scanned across all usage types by the Sensitive Data Scanner from the start of the given hour’s month until the given hour. + TotalScannedBytes *int64 `json:"total_scanned_bytes,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{} +} + +// NewUsageSDSHour instantiates a new UsageSDSHour 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 NewUsageSDSHour() *UsageSDSHour { + this := UsageSDSHour{} + return &this +} + +// NewUsageSDSHourWithDefaults instantiates a new UsageSDSHour 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 NewUsageSDSHourWithDefaults() *UsageSDSHour { + this := UsageSDSHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageSDSHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSDSHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageSDSHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageSDSHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetLogsScannedBytes returns the LogsScannedBytes field value if set, zero value otherwise. +func (o *UsageSDSHour) GetLogsScannedBytes() int64 { + if o == nil || o.LogsScannedBytes == nil { + var ret int64 + return ret + } + return *o.LogsScannedBytes +} + +// GetLogsScannedBytesOk returns a tuple with the LogsScannedBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSDSHour) GetLogsScannedBytesOk() (*int64, bool) { + if o == nil || o.LogsScannedBytes == nil { + return nil, false + } + return o.LogsScannedBytes, true +} + +// HasLogsScannedBytes returns a boolean if a field has been set. +func (o *UsageSDSHour) HasLogsScannedBytes() bool { + if o != nil && o.LogsScannedBytes != nil { + return true + } + + return false +} + +// SetLogsScannedBytes gets a reference to the given int64 and assigns it to the LogsScannedBytes field. +func (o *UsageSDSHour) SetLogsScannedBytes(v int64) { + o.LogsScannedBytes = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageSDSHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSDSHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageSDSHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageSDSHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageSDSHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSDSHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageSDSHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageSDSHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetTotalScannedBytes returns the TotalScannedBytes field value if set, zero value otherwise. +func (o *UsageSDSHour) GetTotalScannedBytes() int64 { + if o == nil || o.TotalScannedBytes == nil { + var ret int64 + return ret + } + return *o.TotalScannedBytes +} + +// GetTotalScannedBytesOk returns a tuple with the TotalScannedBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSDSHour) GetTotalScannedBytesOk() (*int64, bool) { + if o == nil || o.TotalScannedBytes == nil { + return nil, false + } + return o.TotalScannedBytes, true +} + +// HasTotalScannedBytes returns a boolean if a field has been set. +func (o *UsageSDSHour) HasTotalScannedBytes() bool { + if o != nil && o.TotalScannedBytes != nil { + return true + } + + return false +} + +// SetTotalScannedBytes gets a reference to the given int64 and assigns it to the TotalScannedBytes field. +func (o *UsageSDSHour) SetTotalScannedBytes(v int64) { + o.TotalScannedBytes = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSDSHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LogsScannedBytes != nil { + toSerialize["logs_scanned_bytes"] = o.LogsScannedBytes + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.TotalScannedBytes != nil { + toSerialize["total_scanned_bytes"] = o.TotalScannedBytes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSDSHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + LogsScannedBytes *int64 `json:"logs_scanned_bytes,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + TotalScannedBytes *int64 `json:"total_scanned_bytes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.LogsScannedBytes = all.LogsScannedBytes + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.TotalScannedBytes = all.TotalScannedBytes + return nil +} diff --git a/api/v1/datadog/model_usage_sds_response.go b/api/v1/datadog/model_usage_sds_response.go new file mode 100644 index 00000000000..9882f42178f --- /dev/null +++ b/api/v1/datadog/model_usage_sds_response.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 datadog + +import ( + "encoding/json" +) + +// UsageSDSResponse Response containing the Sensitive Data Scanner usage for each hour for a given organization. +type UsageSDSResponse struct { + // Get hourly usage for Sensitive Data Scanner. + Usage []UsageSDSHour `json:"usage,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{} +} + +// NewUsageSDSResponse instantiates a new UsageSDSResponse 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 NewUsageSDSResponse() *UsageSDSResponse { + this := UsageSDSResponse{} + return &this +} + +// NewUsageSDSResponseWithDefaults instantiates a new UsageSDSResponse 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 NewUsageSDSResponseWithDefaults() *UsageSDSResponse { + this := UsageSDSResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageSDSResponse) GetUsage() []UsageSDSHour { + if o == nil || o.Usage == nil { + var ret []UsageSDSHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSDSResponse) GetUsageOk() (*[]UsageSDSHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageSDSResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageSDSHour and assigns it to the Usage field. +func (o *UsageSDSResponse) SetUsage(v []UsageSDSHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSDSResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSDSResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageSDSHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_snmp_hour.go b/api/v1/datadog/model_usage_snmp_hour.go new file mode 100644 index 00000000000..61ed34450d5 --- /dev/null +++ b/api/v1/datadog/model_usage_snmp_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageSNMPHour The number of SNMP devices for each hour for a given organization. +type UsageSNMPHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // Contains the number of SNMP devices. + SnmpDevices *int64 `json:"snmp_devices,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{} +} + +// NewUsageSNMPHour instantiates a new UsageSNMPHour 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 NewUsageSNMPHour() *UsageSNMPHour { + this := UsageSNMPHour{} + return &this +} + +// NewUsageSNMPHourWithDefaults instantiates a new UsageSNMPHour 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 NewUsageSNMPHourWithDefaults() *UsageSNMPHour { + this := UsageSNMPHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageSNMPHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSNMPHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageSNMPHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageSNMPHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageSNMPHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSNMPHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageSNMPHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageSNMPHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageSNMPHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSNMPHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageSNMPHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageSNMPHour) SetPublicId(v string) { + o.PublicId = &v +} + +// GetSnmpDevices returns the SnmpDevices field value if set, zero value otherwise. +func (o *UsageSNMPHour) GetSnmpDevices() int64 { + if o == nil || o.SnmpDevices == nil { + var ret int64 + return ret + } + return *o.SnmpDevices +} + +// GetSnmpDevicesOk returns a tuple with the SnmpDevices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSNMPHour) GetSnmpDevicesOk() (*int64, bool) { + if o == nil || o.SnmpDevices == nil { + return nil, false + } + return o.SnmpDevices, true +} + +// HasSnmpDevices returns a boolean if a field has been set. +func (o *UsageSNMPHour) HasSnmpDevices() bool { + if o != nil && o.SnmpDevices != nil { + return true + } + + return false +} + +// SetSnmpDevices gets a reference to the given int64 and assigns it to the SnmpDevices field. +func (o *UsageSNMPHour) SetSnmpDevices(v int64) { + o.SnmpDevices = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSNMPHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.SnmpDevices != nil { + toSerialize["snmp_devices"] = o.SnmpDevices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSNMPHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + SnmpDevices *int64 `json:"snmp_devices,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.SnmpDevices = all.SnmpDevices + return nil +} diff --git a/api/v1/datadog/model_usage_snmp_response.go b/api/v1/datadog/model_usage_snmp_response.go new file mode 100644 index 00000000000..0910e32e9bd --- /dev/null +++ b/api/v1/datadog/model_usage_snmp_response.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 datadog + +import ( + "encoding/json" +) + +// UsageSNMPResponse Response containing the number of SNMP devices for each hour for a given organization. +type UsageSNMPResponse struct { + // Get hourly usage for SNMP devices. + Usage []UsageSNMPHour `json:"usage,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{} +} + +// NewUsageSNMPResponse instantiates a new UsageSNMPResponse 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 NewUsageSNMPResponse() *UsageSNMPResponse { + this := UsageSNMPResponse{} + return &this +} + +// NewUsageSNMPResponseWithDefaults instantiates a new UsageSNMPResponse 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 NewUsageSNMPResponseWithDefaults() *UsageSNMPResponse { + this := UsageSNMPResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageSNMPResponse) GetUsage() []UsageSNMPHour { + if o == nil || o.Usage == nil { + var ret []UsageSNMPHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSNMPResponse) GetUsageOk() (*[]UsageSNMPHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageSNMPResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageSNMPHour and assigns it to the Usage field. +func (o *UsageSNMPResponse) SetUsage(v []UsageSNMPHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSNMPResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSNMPResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageSNMPHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_sort.go b/api/v1/datadog/model_usage_sort.go new file mode 100644 index 00000000000..ba9e4236bd0 --- /dev/null +++ b/api/v1/datadog/model_usage_sort.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsageSort The field to sort by. +type UsageSort string + +// List of UsageSort. +const ( + USAGESORT_COMPUTED_ON UsageSort = "computed_on" + USAGESORT_SIZE UsageSort = "size" + USAGESORT_START_DATE UsageSort = "start_date" + USAGESORT_END_DATE UsageSort = "end_date" +) + +var allowedUsageSortEnumValues = []UsageSort{ + USAGESORT_COMPUTED_ON, + USAGESORT_SIZE, + USAGESORT_START_DATE, + USAGESORT_END_DATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsageSort) GetAllowedValues() []UsageSort { + return allowedUsageSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsageSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsageSort(value) + return nil +} + +// NewUsageSortFromValue returns a pointer to a valid UsageSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsageSortFromValue(v string) (*UsageSort, error) { + ev := UsageSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsageSort: valid values are %v", v, allowedUsageSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsageSort) IsValid() bool { + for _, existing := range allowedUsageSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsageSort value. +func (v UsageSort) Ptr() *UsageSort { + return &v +} + +// NullableUsageSort handles when a null is used for UsageSort. +type NullableUsageSort struct { + value *UsageSort + isSet bool +} + +// Get returns the associated value. +func (v NullableUsageSort) Get() *UsageSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsageSort) Set(val *UsageSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsageSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsageSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsageSort initializes the struct as if Set has been called. +func NewNullableUsageSort(val *UsageSort) *NullableUsageSort { + return &NullableUsageSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsageSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsageSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_usage_sort_direction.go b/api/v1/datadog/model_usage_sort_direction.go new file mode 100644 index 00000000000..68e278b4a46 --- /dev/null +++ b/api/v1/datadog/model_usage_sort_direction.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsageSortDirection The direction to sort by. +type UsageSortDirection string + +// List of UsageSortDirection. +const ( + USAGESORTDIRECTION_DESC UsageSortDirection = "desc" + USAGESORTDIRECTION_ASC UsageSortDirection = "asc" +) + +var allowedUsageSortDirectionEnumValues = []UsageSortDirection{ + USAGESORTDIRECTION_DESC, + USAGESORTDIRECTION_ASC, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsageSortDirection) GetAllowedValues() []UsageSortDirection { + return allowedUsageSortDirectionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsageSortDirection) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsageSortDirection(value) + return nil +} + +// NewUsageSortDirectionFromValue returns a pointer to a valid UsageSortDirection +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsageSortDirectionFromValue(v string) (*UsageSortDirection, error) { + ev := UsageSortDirection(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsageSortDirection: valid values are %v", v, allowedUsageSortDirectionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsageSortDirection) IsValid() bool { + for _, existing := range allowedUsageSortDirectionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsageSortDirection value. +func (v UsageSortDirection) Ptr() *UsageSortDirection { + return &v +} + +// NullableUsageSortDirection handles when a null is used for UsageSortDirection. +type NullableUsageSortDirection struct { + value *UsageSortDirection + isSet bool +} + +// Get returns the associated value. +func (v NullableUsageSortDirection) Get() *UsageSortDirection { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsageSortDirection) Set(val *UsageSortDirection) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsageSortDirection) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsageSortDirection) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsageSortDirection initializes the struct as if Set has been called. +func NewNullableUsageSortDirection(val *UsageSortDirection) *NullableUsageSortDirection { + return &NullableUsageSortDirection{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsageSortDirection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsageSortDirection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_attributes.go b/api/v1/datadog/model_usage_specified_custom_reports_attributes.go new file mode 100644 index 00000000000..9a4ce2e7ff4 --- /dev/null +++ b/api/v1/datadog/model_usage_specified_custom_reports_attributes.go @@ -0,0 +1,297 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageSpecifiedCustomReportsAttributes The response containing attributes for specified custom reports. +type UsageSpecifiedCustomReportsAttributes struct { + // The date the specified custom report was computed. + ComputedOn *string `json:"computed_on,omitempty"` + // The ending date of specified custom report. + EndDate *string `json:"end_date,omitempty"` + // A downloadable file for the specified custom reporting file. + Location *string `json:"location,omitempty"` + // size + Size *int64 `json:"size,omitempty"` + // The starting date of specified custom report. + StartDate *string `json:"start_date,omitempty"` + // A list of tags to apply to specified custom reports. + Tags []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{} +} + +// NewUsageSpecifiedCustomReportsAttributes instantiates a new UsageSpecifiedCustomReportsAttributes 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 NewUsageSpecifiedCustomReportsAttributes() *UsageSpecifiedCustomReportsAttributes { + this := UsageSpecifiedCustomReportsAttributes{} + return &this +} + +// NewUsageSpecifiedCustomReportsAttributesWithDefaults instantiates a new UsageSpecifiedCustomReportsAttributes 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 NewUsageSpecifiedCustomReportsAttributesWithDefaults() *UsageSpecifiedCustomReportsAttributes { + this := UsageSpecifiedCustomReportsAttributes{} + return &this +} + +// GetComputedOn returns the ComputedOn field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsAttributes) GetComputedOn() string { + if o == nil || o.ComputedOn == nil { + var ret string + return ret + } + return *o.ComputedOn +} + +// GetComputedOnOk returns a tuple with the ComputedOn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsAttributes) GetComputedOnOk() (*string, bool) { + if o == nil || o.ComputedOn == nil { + return nil, false + } + return o.ComputedOn, true +} + +// HasComputedOn returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsAttributes) HasComputedOn() bool { + if o != nil && o.ComputedOn != nil { + return true + } + + return false +} + +// SetComputedOn gets a reference to the given string and assigns it to the ComputedOn field. +func (o *UsageSpecifiedCustomReportsAttributes) SetComputedOn(v string) { + o.ComputedOn = &v +} + +// GetEndDate returns the EndDate field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsAttributes) GetEndDate() string { + if o == nil || o.EndDate == nil { + var ret string + return ret + } + return *o.EndDate +} + +// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsAttributes) GetEndDateOk() (*string, bool) { + if o == nil || o.EndDate == nil { + return nil, false + } + return o.EndDate, true +} + +// HasEndDate returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsAttributes) HasEndDate() bool { + if o != nil && o.EndDate != nil { + return true + } + + return false +} + +// SetEndDate gets a reference to the given string and assigns it to the EndDate field. +func (o *UsageSpecifiedCustomReportsAttributes) SetEndDate(v string) { + o.EndDate = &v +} + +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsAttributes) GetLocation() string { + if o == nil || o.Location == nil { + var ret string + return ret + } + return *o.Location +} + +// GetLocationOk returns a tuple with the Location field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsAttributes) GetLocationOk() (*string, bool) { + if o == nil || o.Location == nil { + return nil, false + } + return o.Location, true +} + +// HasLocation returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsAttributes) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *UsageSpecifiedCustomReportsAttributes) SetLocation(v string) { + o.Location = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsAttributes) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsAttributes) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsAttributes) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *UsageSpecifiedCustomReportsAttributes) SetSize(v int64) { + o.Size = &v +} + +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsAttributes) GetStartDate() string { + if o == nil || o.StartDate == nil { + var ret string + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsAttributes) GetStartDateOk() (*string, bool) { + if o == nil || o.StartDate == nil { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsAttributes) HasStartDate() bool { + if o != nil && o.StartDate != nil { + return true + } + + return false +} + +// SetStartDate gets a reference to the given string and assigns it to the StartDate field. +func (o *UsageSpecifiedCustomReportsAttributes) SetStartDate(v string) { + o.StartDate = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *UsageSpecifiedCustomReportsAttributes) GetTagsOk() (*[]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 *UsageSpecifiedCustomReportsAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *UsageSpecifiedCustomReportsAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSpecifiedCustomReportsAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ComputedOn != nil { + toSerialize["computed_on"] = o.ComputedOn + } + if o.EndDate != nil { + toSerialize["end_date"] = o.EndDate + } + if o.Location != nil { + toSerialize["location"] = o.Location + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + if o.StartDate != nil { + toSerialize["start_date"] = o.StartDate + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSpecifiedCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ComputedOn *string `json:"computed_on,omitempty"` + EndDate *string `json:"end_date,omitempty"` + Location *string `json:"location,omitempty"` + Size *int64 `json:"size,omitempty"` + StartDate *string `json:"start_date,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ComputedOn = all.ComputedOn + o.EndDate = all.EndDate + o.Location = all.Location + o.Size = all.Size + o.StartDate = all.StartDate + o.Tags = all.Tags + return nil +} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_data.go b/api/v1/datadog/model_usage_specified_custom_reports_data.go new file mode 100644 index 00000000000..9fabf4fe55f --- /dev/null +++ b/api/v1/datadog/model_usage_specified_custom_reports_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageSpecifiedCustomReportsData Response containing date and type for specified custom reports. +type UsageSpecifiedCustomReportsData struct { + // The response containing attributes for specified custom reports. + Attributes *UsageSpecifiedCustomReportsAttributes `json:"attributes,omitempty"` + // The date for specified custom reports. + Id *string `json:"id,omitempty"` + // The type of reports. + Type *UsageReportsType `json:"type,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{} +} + +// NewUsageSpecifiedCustomReportsData instantiates a new UsageSpecifiedCustomReportsData 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 NewUsageSpecifiedCustomReportsData() *UsageSpecifiedCustomReportsData { + this := UsageSpecifiedCustomReportsData{} + var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS + this.Type = &typeVar + return &this +} + +// NewUsageSpecifiedCustomReportsDataWithDefaults instantiates a new UsageSpecifiedCustomReportsData 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 NewUsageSpecifiedCustomReportsDataWithDefaults() *UsageSpecifiedCustomReportsData { + this := UsageSpecifiedCustomReportsData{} + var typeVar UsageReportsType = USAGEREPORTSTYPE_REPORTS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsData) GetAttributes() UsageSpecifiedCustomReportsAttributes { + if o == nil || o.Attributes == nil { + var ret UsageSpecifiedCustomReportsAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsData) GetAttributesOk() (*UsageSpecifiedCustomReportsAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given UsageSpecifiedCustomReportsAttributes and assigns it to the Attributes field. +func (o *UsageSpecifiedCustomReportsData) SetAttributes(v UsageSpecifiedCustomReportsAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UsageSpecifiedCustomReportsData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsData) GetType() UsageReportsType { + if o == nil || o.Type == nil { + var ret UsageReportsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsData) GetTypeOk() (*UsageReportsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given UsageReportsType and assigns it to the Type field. +func (o *UsageSpecifiedCustomReportsData) SetType(v UsageReportsType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSpecifiedCustomReportsData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSpecifiedCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *UsageSpecifiedCustomReportsAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UsageReportsType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_meta.go b/api/v1/datadog/model_usage_specified_custom_reports_meta.go new file mode 100644 index 00000000000..e4e6d6ea741 --- /dev/null +++ b/api/v1/datadog/model_usage_specified_custom_reports_meta.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageSpecifiedCustomReportsMeta The object containing document metadata. +type UsageSpecifiedCustomReportsMeta struct { + // The object containing page total count for specified ID. + Page *UsageSpecifiedCustomReportsPage `json:"page,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{} +} + +// NewUsageSpecifiedCustomReportsMeta instantiates a new UsageSpecifiedCustomReportsMeta 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 NewUsageSpecifiedCustomReportsMeta() *UsageSpecifiedCustomReportsMeta { + this := UsageSpecifiedCustomReportsMeta{} + return &this +} + +// NewUsageSpecifiedCustomReportsMetaWithDefaults instantiates a new UsageSpecifiedCustomReportsMeta 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 NewUsageSpecifiedCustomReportsMetaWithDefaults() *UsageSpecifiedCustomReportsMeta { + this := UsageSpecifiedCustomReportsMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsMeta) GetPage() UsageSpecifiedCustomReportsPage { + if o == nil || o.Page == nil { + var ret UsageSpecifiedCustomReportsPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsMeta) GetPageOk() (*UsageSpecifiedCustomReportsPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsMeta) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given UsageSpecifiedCustomReportsPage and assigns it to the Page field. +func (o *UsageSpecifiedCustomReportsMeta) SetPage(v UsageSpecifiedCustomReportsPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSpecifiedCustomReportsMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSpecifiedCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *UsageSpecifiedCustomReportsPage `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_page.go b/api/v1/datadog/model_usage_specified_custom_reports_page.go new file mode 100644 index 00000000000..c874f0ad9d8 --- /dev/null +++ b/api/v1/datadog/model_usage_specified_custom_reports_page.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 datadog + +import ( + "encoding/json" +) + +// UsageSpecifiedCustomReportsPage The object containing page total count for specified ID. +type UsageSpecifiedCustomReportsPage struct { + // Total page count. + TotalCount *int64 `json:"total_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{} +} + +// NewUsageSpecifiedCustomReportsPage instantiates a new UsageSpecifiedCustomReportsPage 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 NewUsageSpecifiedCustomReportsPage() *UsageSpecifiedCustomReportsPage { + this := UsageSpecifiedCustomReportsPage{} + return &this +} + +// NewUsageSpecifiedCustomReportsPageWithDefaults instantiates a new UsageSpecifiedCustomReportsPage 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 NewUsageSpecifiedCustomReportsPageWithDefaults() *UsageSpecifiedCustomReportsPage { + this := UsageSpecifiedCustomReportsPage{} + return &this +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsPage) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsPage) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsPage) HasTotalCount() bool { + if o != nil && o.TotalCount != nil { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *UsageSpecifiedCustomReportsPage) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSpecifiedCustomReportsPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSpecifiedCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TotalCount *int64 `json:"total_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TotalCount = all.TotalCount + return nil +} diff --git a/api/v1/datadog/model_usage_specified_custom_reports_response.go b/api/v1/datadog/model_usage_specified_custom_reports_response.go new file mode 100644 index 00000000000..0e1ce2eda0f --- /dev/null +++ b/api/v1/datadog/model_usage_specified_custom_reports_response.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageSpecifiedCustomReportsResponse Returns available specified custom reports. +type UsageSpecifiedCustomReportsResponse struct { + // Response containing date and type for specified custom reports. + Data *UsageSpecifiedCustomReportsData `json:"data,omitempty"` + // The object containing document metadata. + Meta *UsageSpecifiedCustomReportsMeta `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{} +} + +// NewUsageSpecifiedCustomReportsResponse instantiates a new UsageSpecifiedCustomReportsResponse 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 NewUsageSpecifiedCustomReportsResponse() *UsageSpecifiedCustomReportsResponse { + this := UsageSpecifiedCustomReportsResponse{} + return &this +} + +// NewUsageSpecifiedCustomReportsResponseWithDefaults instantiates a new UsageSpecifiedCustomReportsResponse 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 NewUsageSpecifiedCustomReportsResponseWithDefaults() *UsageSpecifiedCustomReportsResponse { + this := UsageSpecifiedCustomReportsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsResponse) GetData() UsageSpecifiedCustomReportsData { + if o == nil || o.Data == nil { + var ret UsageSpecifiedCustomReportsData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSpecifiedCustomReportsResponse) GetDataOk() (*UsageSpecifiedCustomReportsData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UsageSpecifiedCustomReportsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given UsageSpecifiedCustomReportsData and assigns it to the Data field. +func (o *UsageSpecifiedCustomReportsResponse) SetData(v UsageSpecifiedCustomReportsData) { + o.Data = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *UsageSpecifiedCustomReportsResponse) GetMeta() UsageSpecifiedCustomReportsMeta { + if o == nil || o.Meta == nil { + var ret UsageSpecifiedCustomReportsMeta + 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 *UsageSpecifiedCustomReportsResponse) GetMetaOk() (*UsageSpecifiedCustomReportsMeta, 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 *UsageSpecifiedCustomReportsResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given UsageSpecifiedCustomReportsMeta and assigns it to the Meta field. +func (o *UsageSpecifiedCustomReportsResponse) SetMeta(v UsageSpecifiedCustomReportsMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSpecifiedCustomReportsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSpecifiedCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *UsageSpecifiedCustomReportsData `json:"data,omitempty"` + Meta *UsageSpecifiedCustomReportsMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v1/datadog/model_usage_summary_date.go b/api/v1/datadog/model_usage_summary_date.go new file mode 100644 index 00000000000..94b1789e4bb --- /dev/null +++ b/api/v1/datadog/model_usage_summary_date.go @@ -0,0 +1,2564 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageSummaryDate Response with hourly report of all data billed by Datadog all organizations. +type UsageSummaryDate struct { + // Shows the 99th percentile of all agent hosts over all hours in the current date for all organizations. + AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` + // Shows the 99th percentile of all Azure app services using APM over all hours in the current date all organizations. + ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` + // Shows the 99th percentile of all distinct APM hosts over all hours in the current date for all organizations. + ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` + // Shows the sum of audit logs lines indexed over all hours in the current date for all organizations. + AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` + // The average profiled task count for Fargate Profiling. + AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` + // Shows the 99th percentile of all AWS hosts over all hours in the current date for all organizations. + AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` + // Shows the average of the number of functions that executed 1 or more times each hour in the current date for all organizations. + AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` + // Shows the sum of all AWS Lambda invocations over all hours in the current date for all organizations. + AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` + // Shows the 99th percentile of all Azure app services over all hours in the current date for all organizations. + AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` + // Shows the sum of all log bytes ingested over all hours in the current date for all organizations. + BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` + // Shows the sum of all browser lite sessions over all hours in the current date for all organizations. + BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` + // Shows the sum of all browser replay sessions over all hours in the current date for all organizations. + BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` + // Shows the sum of all browser RUM units over all hours in the current date for all organizations. + BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` + // Shows the sum of all CI pipeline indexed spans over all hours in the current month for all organizations. + CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` + // Shows the sum of all CI test indexed spans over all hours in the current month for all organizations. + CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current month for all organizations. + CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` + // Shows the high-water mark of all CI visibility test committers over all hours in the current month for all organizations. + CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` + // Shows the average of all distinct containers over all hours in the current date for all organizations. + ContainerAvg *int64 `json:"container_avg,omitempty"` + // Shows the high-water mark of all distinct containers over all hours in the current date for all organizations. + ContainerHwm *int64 `json:"container_hwm,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management Azure app services hosts over all hours in the current date for all organizations. + CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management Azure hosts over all hours in the current date for all organizations. + CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` + // Shows the average number of Cloud Security Posture Management containers over all hours in the current date for all organizations. + CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` + // Shows the high-water mark of Cloud Security Posture Management containers over all hours in the current date for all organizations. + CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management hosts over all hours in the current date for all organizations. + CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` + // Shows the average number of distinct custom metrics over all hours in the current date for all organizations. + CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` + // Shows the average of all distinct Cloud Workload Security containers over all hours in the current date for all organizations. + CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` + // Shows the 99th percentile of all Cloud Workload Security hosts over all hours in the current date for all organizations. + CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` + // The date for the usage. + Date *time.Time `json:"date,omitempty"` + // Shows the 99th percentile of all Database Monitoring hosts over all hours in the current date for all organizations. + DbmHostTop99p *int64 `json:"dbm_host_top99p,omitempty"` + // Shows the average of all normalized Database Monitoring queries over all hours in the current date for all organizations. + DbmQueriesCountAvg *int64 `json:"dbm_queries_count_avg,omitempty"` + // Shows the high-watermark of all Fargate tasks over all hours in the current date for all organizations. + FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` + // Shows the average of all Fargate tasks over all hours in the current date for all organizations. + FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` + // Shows the 99th percentile of all GCP hosts over all hours in the current date for all organizations. + GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` + // Shows the 99th percentile of all Heroku dynos over all hours in the current date for all organizations. + HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` + // Shows the high-water mark of incident management monthly active users over all hours in the current date for all organizations. + IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` + // Shows the sum of all log events indexed over all hours in the current date for all organizations. + IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` + // Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for all organizations. + InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` + // Shows the sum of all log bytes ingested over all hours in the current date for all organizations. + IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` + // Shows the sum of all IoT devices over all hours in the current date for all organizations. + IotDeviceSum *int64 `json:"iot_device_sum,omitempty"` + // Shows the 99th percentile of all IoT devices over all hours in the current date all organizations. + IotDeviceTop99p *int64 `json:"iot_device_top99p,omitempty"` + // Shows the sum of all mobile lite sessions over all hours in the current date for all organizations. + MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for all organizations. + MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for all organizations. + MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on React Native over all hours in the current date for all organizations. + MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions over all hours in the current date for all organizations + MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` + // Shows the sum of all mobile RUM units over all hours in the current date for all organizations. + MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` + // Shows the sum of all Network flows indexed over all hours in the current date for all organizations. + NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` + // Shows the 99th percentile of all distinct Networks hosts over all hours in the current date for all organizations. + NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` + // Sum of all observability pipelines bytes processed over all hours in the current date for the given org. + ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` + // Sum of all online archived events over all hours in the current date for all organizations. + OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` + // Shows the 99th percentile of all hosts reported by the Datadog exporter for the OpenTelemetry Collector over all hours in the current date for all organizations. + OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` + // Organizations associated with a user. + Orgs []UsageSummaryDateOrg `json:"orgs,omitempty"` + // Shows the 99th percentile of all profiled hosts over all hours in the current date for all organizations. + ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` + // Shows the sum of all mobile sessions and all browser lite and legacy sessions over all hours in the current month for all organizations. + RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` + // Shows the sum of all browser RUM Lite Sessions over all hours in the current date for all organizations + RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` + // Shows the sum of RUM Sessions (browser and mobile) over all hours in the current date for all organizations. + RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` + // Shows the sum of all browser and mobile RUM units over all hours in the current date for all organizations. + RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` + // Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for all organizations. + SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` + // Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for all organizations. + SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` + // Shows the sum of all Synthetic browser tests over all hours in the current date for all organizations. + SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` + // Shows the sum of all Synthetic API tests over all hours in the current date for all organizations. + SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` + // Shows the sum of all Indexed Spans indexed over all hours in the current date for all organizations. + TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` + // Shows the sum of all ingested APM span bytes over all hours in the current date for all organizations. + TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` + // Shows the 99th percentile of all vSphere hosts over all hours in the current date for all organizations. + VsphereHostTop99p *int64 `json:"vsphere_host_top99p,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{} +} + +// NewUsageSummaryDate instantiates a new UsageSummaryDate 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 NewUsageSummaryDate() *UsageSummaryDate { + this := UsageSummaryDate{} + return &this +} + +// NewUsageSummaryDateWithDefaults instantiates a new UsageSummaryDate 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 NewUsageSummaryDateWithDefaults() *UsageSummaryDate { + this := UsageSummaryDate{} + return &this +} + +// GetAgentHostTop99p returns the AgentHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetAgentHostTop99p() int64 { + if o == nil || o.AgentHostTop99p == nil { + var ret int64 + return ret + } + return *o.AgentHostTop99p +} + +// GetAgentHostTop99pOk returns a tuple with the AgentHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetAgentHostTop99pOk() (*int64, bool) { + if o == nil || o.AgentHostTop99p == nil { + return nil, false + } + return o.AgentHostTop99p, true +} + +// HasAgentHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasAgentHostTop99p() bool { + if o != nil && o.AgentHostTop99p != nil { + return true + } + + return false +} + +// SetAgentHostTop99p gets a reference to the given int64 and assigns it to the AgentHostTop99p field. +func (o *UsageSummaryDate) SetAgentHostTop99p(v int64) { + o.AgentHostTop99p = &v +} + +// GetApmAzureAppServiceHostTop99p returns the ApmAzureAppServiceHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetApmAzureAppServiceHostTop99p() int64 { + if o == nil || o.ApmAzureAppServiceHostTop99p == nil { + var ret int64 + return ret + } + return *o.ApmAzureAppServiceHostTop99p +} + +// GetApmAzureAppServiceHostTop99pOk returns a tuple with the ApmAzureAppServiceHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetApmAzureAppServiceHostTop99pOk() (*int64, bool) { + if o == nil || o.ApmAzureAppServiceHostTop99p == nil { + return nil, false + } + return o.ApmAzureAppServiceHostTop99p, true +} + +// HasApmAzureAppServiceHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasApmAzureAppServiceHostTop99p() bool { + if o != nil && o.ApmAzureAppServiceHostTop99p != nil { + return true + } + + return false +} + +// SetApmAzureAppServiceHostTop99p gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostTop99p field. +func (o *UsageSummaryDate) SetApmAzureAppServiceHostTop99p(v int64) { + o.ApmAzureAppServiceHostTop99p = &v +} + +// GetApmHostTop99p returns the ApmHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetApmHostTop99p() int64 { + if o == nil || o.ApmHostTop99p == nil { + var ret int64 + return ret + } + return *o.ApmHostTop99p +} + +// GetApmHostTop99pOk returns a tuple with the ApmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetApmHostTop99pOk() (*int64, bool) { + if o == nil || o.ApmHostTop99p == nil { + return nil, false + } + return o.ApmHostTop99p, true +} + +// HasApmHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasApmHostTop99p() bool { + if o != nil && o.ApmHostTop99p != nil { + return true + } + + return false +} + +// SetApmHostTop99p gets a reference to the given int64 and assigns it to the ApmHostTop99p field. +func (o *UsageSummaryDate) SetApmHostTop99p(v int64) { + o.ApmHostTop99p = &v +} + +// GetAuditLogsLinesIndexedSum returns the AuditLogsLinesIndexedSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetAuditLogsLinesIndexedSum() int64 { + if o == nil || o.AuditLogsLinesIndexedSum == nil { + var ret int64 + return ret + } + return *o.AuditLogsLinesIndexedSum +} + +// GetAuditLogsLinesIndexedSumOk returns a tuple with the AuditLogsLinesIndexedSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetAuditLogsLinesIndexedSumOk() (*int64, bool) { + if o == nil || o.AuditLogsLinesIndexedSum == nil { + return nil, false + } + return o.AuditLogsLinesIndexedSum, true +} + +// HasAuditLogsLinesIndexedSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasAuditLogsLinesIndexedSum() bool { + if o != nil && o.AuditLogsLinesIndexedSum != nil { + return true + } + + return false +} + +// SetAuditLogsLinesIndexedSum gets a reference to the given int64 and assigns it to the AuditLogsLinesIndexedSum field. +func (o *UsageSummaryDate) SetAuditLogsLinesIndexedSum(v int64) { + o.AuditLogsLinesIndexedSum = &v +} + +// GetAvgProfiledFargateTasks returns the AvgProfiledFargateTasks field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetAvgProfiledFargateTasks() int64 { + if o == nil || o.AvgProfiledFargateTasks == nil { + var ret int64 + return ret + } + return *o.AvgProfiledFargateTasks +} + +// GetAvgProfiledFargateTasksOk returns a tuple with the AvgProfiledFargateTasks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetAvgProfiledFargateTasksOk() (*int64, bool) { + if o == nil || o.AvgProfiledFargateTasks == nil { + return nil, false + } + return o.AvgProfiledFargateTasks, true +} + +// HasAvgProfiledFargateTasks returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasAvgProfiledFargateTasks() bool { + if o != nil && o.AvgProfiledFargateTasks != nil { + return true + } + + return false +} + +// SetAvgProfiledFargateTasks gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasks field. +func (o *UsageSummaryDate) SetAvgProfiledFargateTasks(v int64) { + o.AvgProfiledFargateTasks = &v +} + +// GetAwsHostTop99p returns the AwsHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetAwsHostTop99p() int64 { + if o == nil || o.AwsHostTop99p == nil { + var ret int64 + return ret + } + return *o.AwsHostTop99p +} + +// GetAwsHostTop99pOk returns a tuple with the AwsHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetAwsHostTop99pOk() (*int64, bool) { + if o == nil || o.AwsHostTop99p == nil { + return nil, false + } + return o.AwsHostTop99p, true +} + +// HasAwsHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasAwsHostTop99p() bool { + if o != nil && o.AwsHostTop99p != nil { + return true + } + + return false +} + +// SetAwsHostTop99p gets a reference to the given int64 and assigns it to the AwsHostTop99p field. +func (o *UsageSummaryDate) SetAwsHostTop99p(v int64) { + o.AwsHostTop99p = &v +} + +// GetAwsLambdaFuncCount returns the AwsLambdaFuncCount field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetAwsLambdaFuncCount() int64 { + if o == nil || o.AwsLambdaFuncCount == nil { + var ret int64 + return ret + } + return *o.AwsLambdaFuncCount +} + +// GetAwsLambdaFuncCountOk returns a tuple with the AwsLambdaFuncCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetAwsLambdaFuncCountOk() (*int64, bool) { + if o == nil || o.AwsLambdaFuncCount == nil { + return nil, false + } + return o.AwsLambdaFuncCount, true +} + +// HasAwsLambdaFuncCount returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasAwsLambdaFuncCount() bool { + if o != nil && o.AwsLambdaFuncCount != nil { + return true + } + + return false +} + +// SetAwsLambdaFuncCount gets a reference to the given int64 and assigns it to the AwsLambdaFuncCount field. +func (o *UsageSummaryDate) SetAwsLambdaFuncCount(v int64) { + o.AwsLambdaFuncCount = &v +} + +// GetAwsLambdaInvocationsSum returns the AwsLambdaInvocationsSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetAwsLambdaInvocationsSum() int64 { + if o == nil || o.AwsLambdaInvocationsSum == nil { + var ret int64 + return ret + } + return *o.AwsLambdaInvocationsSum +} + +// GetAwsLambdaInvocationsSumOk returns a tuple with the AwsLambdaInvocationsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetAwsLambdaInvocationsSumOk() (*int64, bool) { + if o == nil || o.AwsLambdaInvocationsSum == nil { + return nil, false + } + return o.AwsLambdaInvocationsSum, true +} + +// HasAwsLambdaInvocationsSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasAwsLambdaInvocationsSum() bool { + if o != nil && o.AwsLambdaInvocationsSum != nil { + return true + } + + return false +} + +// SetAwsLambdaInvocationsSum gets a reference to the given int64 and assigns it to the AwsLambdaInvocationsSum field. +func (o *UsageSummaryDate) SetAwsLambdaInvocationsSum(v int64) { + o.AwsLambdaInvocationsSum = &v +} + +// GetAzureAppServiceTop99p returns the AzureAppServiceTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetAzureAppServiceTop99p() int64 { + if o == nil || o.AzureAppServiceTop99p == nil { + var ret int64 + return ret + } + return *o.AzureAppServiceTop99p +} + +// GetAzureAppServiceTop99pOk returns a tuple with the AzureAppServiceTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetAzureAppServiceTop99pOk() (*int64, bool) { + if o == nil || o.AzureAppServiceTop99p == nil { + return nil, false + } + return o.AzureAppServiceTop99p, true +} + +// HasAzureAppServiceTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasAzureAppServiceTop99p() bool { + if o != nil && o.AzureAppServiceTop99p != nil { + return true + } + + return false +} + +// SetAzureAppServiceTop99p gets a reference to the given int64 and assigns it to the AzureAppServiceTop99p field. +func (o *UsageSummaryDate) SetAzureAppServiceTop99p(v int64) { + o.AzureAppServiceTop99p = &v +} + +// GetBillableIngestedBytesSum returns the BillableIngestedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetBillableIngestedBytesSum() int64 { + if o == nil || o.BillableIngestedBytesSum == nil { + var ret int64 + return ret + } + return *o.BillableIngestedBytesSum +} + +// GetBillableIngestedBytesSumOk returns a tuple with the BillableIngestedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetBillableIngestedBytesSumOk() (*int64, bool) { + if o == nil || o.BillableIngestedBytesSum == nil { + return nil, false + } + return o.BillableIngestedBytesSum, true +} + +// HasBillableIngestedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasBillableIngestedBytesSum() bool { + if o != nil && o.BillableIngestedBytesSum != nil { + return true + } + + return false +} + +// SetBillableIngestedBytesSum gets a reference to the given int64 and assigns it to the BillableIngestedBytesSum field. +func (o *UsageSummaryDate) SetBillableIngestedBytesSum(v int64) { + o.BillableIngestedBytesSum = &v +} + +// GetBrowserRumLiteSessionCountSum returns the BrowserRumLiteSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetBrowserRumLiteSessionCountSum() int64 { + if o == nil || o.BrowserRumLiteSessionCountSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumLiteSessionCountSum +} + +// GetBrowserRumLiteSessionCountSumOk returns a tuple with the BrowserRumLiteSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetBrowserRumLiteSessionCountSumOk() (*int64, bool) { + if o == nil || o.BrowserRumLiteSessionCountSum == nil { + return nil, false + } + return o.BrowserRumLiteSessionCountSum, true +} + +// HasBrowserRumLiteSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasBrowserRumLiteSessionCountSum() bool { + if o != nil && o.BrowserRumLiteSessionCountSum != nil { + return true + } + + return false +} + +// SetBrowserRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumLiteSessionCountSum field. +func (o *UsageSummaryDate) SetBrowserRumLiteSessionCountSum(v int64) { + o.BrowserRumLiteSessionCountSum = &v +} + +// GetBrowserRumReplaySessionCountSum returns the BrowserRumReplaySessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetBrowserRumReplaySessionCountSum() int64 { + if o == nil || o.BrowserRumReplaySessionCountSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumReplaySessionCountSum +} + +// GetBrowserRumReplaySessionCountSumOk returns a tuple with the BrowserRumReplaySessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetBrowserRumReplaySessionCountSumOk() (*int64, bool) { + if o == nil || o.BrowserRumReplaySessionCountSum == nil { + return nil, false + } + return o.BrowserRumReplaySessionCountSum, true +} + +// HasBrowserRumReplaySessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasBrowserRumReplaySessionCountSum() bool { + if o != nil && o.BrowserRumReplaySessionCountSum != nil { + return true + } + + return false +} + +// SetBrowserRumReplaySessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumReplaySessionCountSum field. +func (o *UsageSummaryDate) SetBrowserRumReplaySessionCountSum(v int64) { + o.BrowserRumReplaySessionCountSum = &v +} + +// GetBrowserRumUnitsSum returns the BrowserRumUnitsSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetBrowserRumUnitsSum() int64 { + if o == nil || o.BrowserRumUnitsSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumUnitsSum +} + +// GetBrowserRumUnitsSumOk returns a tuple with the BrowserRumUnitsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetBrowserRumUnitsSumOk() (*int64, bool) { + if o == nil || o.BrowserRumUnitsSum == nil { + return nil, false + } + return o.BrowserRumUnitsSum, true +} + +// HasBrowserRumUnitsSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasBrowserRumUnitsSum() bool { + if o != nil && o.BrowserRumUnitsSum != nil { + return true + } + + return false +} + +// SetBrowserRumUnitsSum gets a reference to the given int64 and assigns it to the BrowserRumUnitsSum field. +func (o *UsageSummaryDate) SetBrowserRumUnitsSum(v int64) { + o.BrowserRumUnitsSum = &v +} + +// GetCiPipelineIndexedSpansSum returns the CiPipelineIndexedSpansSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCiPipelineIndexedSpansSum() int64 { + if o == nil || o.CiPipelineIndexedSpansSum == nil { + var ret int64 + return ret + } + return *o.CiPipelineIndexedSpansSum +} + +// GetCiPipelineIndexedSpansSumOk returns a tuple with the CiPipelineIndexedSpansSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCiPipelineIndexedSpansSumOk() (*int64, bool) { + if o == nil || o.CiPipelineIndexedSpansSum == nil { + return nil, false + } + return o.CiPipelineIndexedSpansSum, true +} + +// HasCiPipelineIndexedSpansSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCiPipelineIndexedSpansSum() bool { + if o != nil && o.CiPipelineIndexedSpansSum != nil { + return true + } + + return false +} + +// SetCiPipelineIndexedSpansSum gets a reference to the given int64 and assigns it to the CiPipelineIndexedSpansSum field. +func (o *UsageSummaryDate) SetCiPipelineIndexedSpansSum(v int64) { + o.CiPipelineIndexedSpansSum = &v +} + +// GetCiTestIndexedSpansSum returns the CiTestIndexedSpansSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCiTestIndexedSpansSum() int64 { + if o == nil || o.CiTestIndexedSpansSum == nil { + var ret int64 + return ret + } + return *o.CiTestIndexedSpansSum +} + +// GetCiTestIndexedSpansSumOk returns a tuple with the CiTestIndexedSpansSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCiTestIndexedSpansSumOk() (*int64, bool) { + if o == nil || o.CiTestIndexedSpansSum == nil { + return nil, false + } + return o.CiTestIndexedSpansSum, true +} + +// HasCiTestIndexedSpansSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCiTestIndexedSpansSum() bool { + if o != nil && o.CiTestIndexedSpansSum != nil { + return true + } + + return false +} + +// SetCiTestIndexedSpansSum gets a reference to the given int64 and assigns it to the CiTestIndexedSpansSum field. +func (o *UsageSummaryDate) SetCiTestIndexedSpansSum(v int64) { + o.CiTestIndexedSpansSum = &v +} + +// GetCiVisibilityPipelineCommittersHwm returns the CiVisibilityPipelineCommittersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCiVisibilityPipelineCommittersHwm() int64 { + if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { + var ret int64 + return ret + } + return *o.CiVisibilityPipelineCommittersHwm +} + +// GetCiVisibilityPipelineCommittersHwmOk returns a tuple with the CiVisibilityPipelineCommittersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCiVisibilityPipelineCommittersHwmOk() (*int64, bool) { + if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { + return nil, false + } + return o.CiVisibilityPipelineCommittersHwm, true +} + +// HasCiVisibilityPipelineCommittersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCiVisibilityPipelineCommittersHwm() bool { + if o != nil && o.CiVisibilityPipelineCommittersHwm != nil { + return true + } + + return false +} + +// SetCiVisibilityPipelineCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityPipelineCommittersHwm field. +func (o *UsageSummaryDate) SetCiVisibilityPipelineCommittersHwm(v int64) { + o.CiVisibilityPipelineCommittersHwm = &v +} + +// GetCiVisibilityTestCommittersHwm returns the CiVisibilityTestCommittersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCiVisibilityTestCommittersHwm() int64 { + if o == nil || o.CiVisibilityTestCommittersHwm == nil { + var ret int64 + return ret + } + return *o.CiVisibilityTestCommittersHwm +} + +// GetCiVisibilityTestCommittersHwmOk returns a tuple with the CiVisibilityTestCommittersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCiVisibilityTestCommittersHwmOk() (*int64, bool) { + if o == nil || o.CiVisibilityTestCommittersHwm == nil { + return nil, false + } + return o.CiVisibilityTestCommittersHwm, true +} + +// HasCiVisibilityTestCommittersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCiVisibilityTestCommittersHwm() bool { + if o != nil && o.CiVisibilityTestCommittersHwm != nil { + return true + } + + return false +} + +// SetCiVisibilityTestCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityTestCommittersHwm field. +func (o *UsageSummaryDate) SetCiVisibilityTestCommittersHwm(v int64) { + o.CiVisibilityTestCommittersHwm = &v +} + +// GetContainerAvg returns the ContainerAvg field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetContainerAvg() int64 { + if o == nil || o.ContainerAvg == nil { + var ret int64 + return ret + } + return *o.ContainerAvg +} + +// GetContainerAvgOk returns a tuple with the ContainerAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetContainerAvgOk() (*int64, bool) { + if o == nil || o.ContainerAvg == nil { + return nil, false + } + return o.ContainerAvg, true +} + +// HasContainerAvg returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasContainerAvg() bool { + if o != nil && o.ContainerAvg != nil { + return true + } + + return false +} + +// SetContainerAvg gets a reference to the given int64 and assigns it to the ContainerAvg field. +func (o *UsageSummaryDate) SetContainerAvg(v int64) { + o.ContainerAvg = &v +} + +// GetContainerHwm returns the ContainerHwm field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetContainerHwm() int64 { + if o == nil || o.ContainerHwm == nil { + var ret int64 + return ret + } + return *o.ContainerHwm +} + +// GetContainerHwmOk returns a tuple with the ContainerHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetContainerHwmOk() (*int64, bool) { + if o == nil || o.ContainerHwm == nil { + return nil, false + } + return o.ContainerHwm, true +} + +// HasContainerHwm returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasContainerHwm() bool { + if o != nil && o.ContainerHwm != nil { + return true + } + + return false +} + +// SetContainerHwm gets a reference to the given int64 and assigns it to the ContainerHwm field. +func (o *UsageSummaryDate) SetContainerHwm(v int64) { + o.ContainerHwm = &v +} + +// GetCspmAasHostTop99p returns the CspmAasHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCspmAasHostTop99p() int64 { + if o == nil || o.CspmAasHostTop99p == nil { + var ret int64 + return ret + } + return *o.CspmAasHostTop99p +} + +// GetCspmAasHostTop99pOk returns a tuple with the CspmAasHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCspmAasHostTop99pOk() (*int64, bool) { + if o == nil || o.CspmAasHostTop99p == nil { + return nil, false + } + return o.CspmAasHostTop99p, true +} + +// HasCspmAasHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCspmAasHostTop99p() bool { + if o != nil && o.CspmAasHostTop99p != nil { + return true + } + + return false +} + +// SetCspmAasHostTop99p gets a reference to the given int64 and assigns it to the CspmAasHostTop99p field. +func (o *UsageSummaryDate) SetCspmAasHostTop99p(v int64) { + o.CspmAasHostTop99p = &v +} + +// GetCspmAzureHostTop99p returns the CspmAzureHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCspmAzureHostTop99p() int64 { + if o == nil || o.CspmAzureHostTop99p == nil { + var ret int64 + return ret + } + return *o.CspmAzureHostTop99p +} + +// GetCspmAzureHostTop99pOk returns a tuple with the CspmAzureHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCspmAzureHostTop99pOk() (*int64, bool) { + if o == nil || o.CspmAzureHostTop99p == nil { + return nil, false + } + return o.CspmAzureHostTop99p, true +} + +// HasCspmAzureHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCspmAzureHostTop99p() bool { + if o != nil && o.CspmAzureHostTop99p != nil { + return true + } + + return false +} + +// SetCspmAzureHostTop99p gets a reference to the given int64 and assigns it to the CspmAzureHostTop99p field. +func (o *UsageSummaryDate) SetCspmAzureHostTop99p(v int64) { + o.CspmAzureHostTop99p = &v +} + +// GetCspmContainerAvg returns the CspmContainerAvg field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCspmContainerAvg() int64 { + if o == nil || o.CspmContainerAvg == nil { + var ret int64 + return ret + } + return *o.CspmContainerAvg +} + +// GetCspmContainerAvgOk returns a tuple with the CspmContainerAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCspmContainerAvgOk() (*int64, bool) { + if o == nil || o.CspmContainerAvg == nil { + return nil, false + } + return o.CspmContainerAvg, true +} + +// HasCspmContainerAvg returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCspmContainerAvg() bool { + if o != nil && o.CspmContainerAvg != nil { + return true + } + + return false +} + +// SetCspmContainerAvg gets a reference to the given int64 and assigns it to the CspmContainerAvg field. +func (o *UsageSummaryDate) SetCspmContainerAvg(v int64) { + o.CspmContainerAvg = &v +} + +// GetCspmContainerHwm returns the CspmContainerHwm field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCspmContainerHwm() int64 { + if o == nil || o.CspmContainerHwm == nil { + var ret int64 + return ret + } + return *o.CspmContainerHwm +} + +// GetCspmContainerHwmOk returns a tuple with the CspmContainerHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCspmContainerHwmOk() (*int64, bool) { + if o == nil || o.CspmContainerHwm == nil { + return nil, false + } + return o.CspmContainerHwm, true +} + +// HasCspmContainerHwm returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCspmContainerHwm() bool { + if o != nil && o.CspmContainerHwm != nil { + return true + } + + return false +} + +// SetCspmContainerHwm gets a reference to the given int64 and assigns it to the CspmContainerHwm field. +func (o *UsageSummaryDate) SetCspmContainerHwm(v int64) { + o.CspmContainerHwm = &v +} + +// GetCspmHostTop99p returns the CspmHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCspmHostTop99p() int64 { + if o == nil || o.CspmHostTop99p == nil { + var ret int64 + return ret + } + return *o.CspmHostTop99p +} + +// GetCspmHostTop99pOk returns a tuple with the CspmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCspmHostTop99pOk() (*int64, bool) { + if o == nil || o.CspmHostTop99p == nil { + return nil, false + } + return o.CspmHostTop99p, true +} + +// HasCspmHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCspmHostTop99p() bool { + if o != nil && o.CspmHostTop99p != nil { + return true + } + + return false +} + +// SetCspmHostTop99p gets a reference to the given int64 and assigns it to the CspmHostTop99p field. +func (o *UsageSummaryDate) SetCspmHostTop99p(v int64) { + o.CspmHostTop99p = &v +} + +// GetCustomTsAvg returns the CustomTsAvg field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCustomTsAvg() int64 { + if o == nil || o.CustomTsAvg == nil { + var ret int64 + return ret + } + return *o.CustomTsAvg +} + +// GetCustomTsAvgOk returns a tuple with the CustomTsAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCustomTsAvgOk() (*int64, bool) { + if o == nil || o.CustomTsAvg == nil { + return nil, false + } + return o.CustomTsAvg, true +} + +// HasCustomTsAvg returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCustomTsAvg() bool { + if o != nil && o.CustomTsAvg != nil { + return true + } + + return false +} + +// SetCustomTsAvg gets a reference to the given int64 and assigns it to the CustomTsAvg field. +func (o *UsageSummaryDate) SetCustomTsAvg(v int64) { + o.CustomTsAvg = &v +} + +// GetCwsContainerCountAvg returns the CwsContainerCountAvg field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCwsContainerCountAvg() int64 { + if o == nil || o.CwsContainerCountAvg == nil { + var ret int64 + return ret + } + return *o.CwsContainerCountAvg +} + +// GetCwsContainerCountAvgOk returns a tuple with the CwsContainerCountAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCwsContainerCountAvgOk() (*int64, bool) { + if o == nil || o.CwsContainerCountAvg == nil { + return nil, false + } + return o.CwsContainerCountAvg, true +} + +// HasCwsContainerCountAvg returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCwsContainerCountAvg() bool { + if o != nil && o.CwsContainerCountAvg != nil { + return true + } + + return false +} + +// SetCwsContainerCountAvg gets a reference to the given int64 and assigns it to the CwsContainerCountAvg field. +func (o *UsageSummaryDate) SetCwsContainerCountAvg(v int64) { + o.CwsContainerCountAvg = &v +} + +// GetCwsHostTop99p returns the CwsHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetCwsHostTop99p() int64 { + if o == nil || o.CwsHostTop99p == nil { + var ret int64 + return ret + } + return *o.CwsHostTop99p +} + +// GetCwsHostTop99pOk returns a tuple with the CwsHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetCwsHostTop99pOk() (*int64, bool) { + if o == nil || o.CwsHostTop99p == nil { + return nil, false + } + return o.CwsHostTop99p, true +} + +// HasCwsHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasCwsHostTop99p() bool { + if o != nil && o.CwsHostTop99p != nil { + return true + } + + return false +} + +// SetCwsHostTop99p gets a reference to the given int64 and assigns it to the CwsHostTop99p field. +func (o *UsageSummaryDate) SetCwsHostTop99p(v int64) { + o.CwsHostTop99p = &v +} + +// GetDate returns the Date field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetDate() time.Time { + if o == nil || o.Date == nil { + var ret time.Time + return ret + } + return *o.Date +} + +// GetDateOk returns a tuple with the Date field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetDateOk() (*time.Time, bool) { + if o == nil || o.Date == nil { + return nil, false + } + return o.Date, true +} + +// HasDate returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasDate() bool { + if o != nil && o.Date != nil { + return true + } + + return false +} + +// SetDate gets a reference to the given time.Time and assigns it to the Date field. +func (o *UsageSummaryDate) SetDate(v time.Time) { + o.Date = &v +} + +// GetDbmHostTop99p returns the DbmHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetDbmHostTop99p() int64 { + if o == nil || o.DbmHostTop99p == nil { + var ret int64 + return ret + } + return *o.DbmHostTop99p +} + +// GetDbmHostTop99pOk returns a tuple with the DbmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetDbmHostTop99pOk() (*int64, bool) { + if o == nil || o.DbmHostTop99p == nil { + return nil, false + } + return o.DbmHostTop99p, true +} + +// HasDbmHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasDbmHostTop99p() bool { + if o != nil && o.DbmHostTop99p != nil { + return true + } + + return false +} + +// SetDbmHostTop99p gets a reference to the given int64 and assigns it to the DbmHostTop99p field. +func (o *UsageSummaryDate) SetDbmHostTop99p(v int64) { + o.DbmHostTop99p = &v +} + +// GetDbmQueriesCountAvg returns the DbmQueriesCountAvg field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetDbmQueriesCountAvg() int64 { + if o == nil || o.DbmQueriesCountAvg == nil { + var ret int64 + return ret + } + return *o.DbmQueriesCountAvg +} + +// GetDbmQueriesCountAvgOk returns a tuple with the DbmQueriesCountAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetDbmQueriesCountAvgOk() (*int64, bool) { + if o == nil || o.DbmQueriesCountAvg == nil { + return nil, false + } + return o.DbmQueriesCountAvg, true +} + +// HasDbmQueriesCountAvg returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasDbmQueriesCountAvg() bool { + if o != nil && o.DbmQueriesCountAvg != nil { + return true + } + + return false +} + +// SetDbmQueriesCountAvg gets a reference to the given int64 and assigns it to the DbmQueriesCountAvg field. +func (o *UsageSummaryDate) SetDbmQueriesCountAvg(v int64) { + o.DbmQueriesCountAvg = &v +} + +// GetFargateTasksCountAvg returns the FargateTasksCountAvg field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetFargateTasksCountAvg() int64 { + if o == nil || o.FargateTasksCountAvg == nil { + var ret int64 + return ret + } + return *o.FargateTasksCountAvg +} + +// GetFargateTasksCountAvgOk returns a tuple with the FargateTasksCountAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetFargateTasksCountAvgOk() (*int64, bool) { + if o == nil || o.FargateTasksCountAvg == nil { + return nil, false + } + return o.FargateTasksCountAvg, true +} + +// HasFargateTasksCountAvg returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasFargateTasksCountAvg() bool { + if o != nil && o.FargateTasksCountAvg != nil { + return true + } + + return false +} + +// SetFargateTasksCountAvg gets a reference to the given int64 and assigns it to the FargateTasksCountAvg field. +func (o *UsageSummaryDate) SetFargateTasksCountAvg(v int64) { + o.FargateTasksCountAvg = &v +} + +// GetFargateTasksCountHwm returns the FargateTasksCountHwm field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetFargateTasksCountHwm() int64 { + if o == nil || o.FargateTasksCountHwm == nil { + var ret int64 + return ret + } + return *o.FargateTasksCountHwm +} + +// GetFargateTasksCountHwmOk returns a tuple with the FargateTasksCountHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetFargateTasksCountHwmOk() (*int64, bool) { + if o == nil || o.FargateTasksCountHwm == nil { + return nil, false + } + return o.FargateTasksCountHwm, true +} + +// HasFargateTasksCountHwm returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasFargateTasksCountHwm() bool { + if o != nil && o.FargateTasksCountHwm != nil { + return true + } + + return false +} + +// SetFargateTasksCountHwm gets a reference to the given int64 and assigns it to the FargateTasksCountHwm field. +func (o *UsageSummaryDate) SetFargateTasksCountHwm(v int64) { + o.FargateTasksCountHwm = &v +} + +// GetGcpHostTop99p returns the GcpHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetGcpHostTop99p() int64 { + if o == nil || o.GcpHostTop99p == nil { + var ret int64 + return ret + } + return *o.GcpHostTop99p +} + +// GetGcpHostTop99pOk returns a tuple with the GcpHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetGcpHostTop99pOk() (*int64, bool) { + if o == nil || o.GcpHostTop99p == nil { + return nil, false + } + return o.GcpHostTop99p, true +} + +// HasGcpHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasGcpHostTop99p() bool { + if o != nil && o.GcpHostTop99p != nil { + return true + } + + return false +} + +// SetGcpHostTop99p gets a reference to the given int64 and assigns it to the GcpHostTop99p field. +func (o *UsageSummaryDate) SetGcpHostTop99p(v int64) { + o.GcpHostTop99p = &v +} + +// GetHerokuHostTop99p returns the HerokuHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetHerokuHostTop99p() int64 { + if o == nil || o.HerokuHostTop99p == nil { + var ret int64 + return ret + } + return *o.HerokuHostTop99p +} + +// GetHerokuHostTop99pOk returns a tuple with the HerokuHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetHerokuHostTop99pOk() (*int64, bool) { + if o == nil || o.HerokuHostTop99p == nil { + return nil, false + } + return o.HerokuHostTop99p, true +} + +// HasHerokuHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasHerokuHostTop99p() bool { + if o != nil && o.HerokuHostTop99p != nil { + return true + } + + return false +} + +// SetHerokuHostTop99p gets a reference to the given int64 and assigns it to the HerokuHostTop99p field. +func (o *UsageSummaryDate) SetHerokuHostTop99p(v int64) { + o.HerokuHostTop99p = &v +} + +// GetIncidentManagementMonthlyActiveUsersHwm returns the IncidentManagementMonthlyActiveUsersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetIncidentManagementMonthlyActiveUsersHwm() int64 { + if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { + var ret int64 + return ret + } + return *o.IncidentManagementMonthlyActiveUsersHwm +} + +// GetIncidentManagementMonthlyActiveUsersHwmOk returns a tuple with the IncidentManagementMonthlyActiveUsersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetIncidentManagementMonthlyActiveUsersHwmOk() (*int64, bool) { + if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { + return nil, false + } + return o.IncidentManagementMonthlyActiveUsersHwm, true +} + +// HasIncidentManagementMonthlyActiveUsersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasIncidentManagementMonthlyActiveUsersHwm() bool { + if o != nil && o.IncidentManagementMonthlyActiveUsersHwm != nil { + return true + } + + return false +} + +// SetIncidentManagementMonthlyActiveUsersHwm gets a reference to the given int64 and assigns it to the IncidentManagementMonthlyActiveUsersHwm field. +func (o *UsageSummaryDate) SetIncidentManagementMonthlyActiveUsersHwm(v int64) { + o.IncidentManagementMonthlyActiveUsersHwm = &v +} + +// GetIndexedEventsCountSum returns the IndexedEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetIndexedEventsCountSum() int64 { + if o == nil || o.IndexedEventsCountSum == nil { + var ret int64 + return ret + } + return *o.IndexedEventsCountSum +} + +// GetIndexedEventsCountSumOk returns a tuple with the IndexedEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetIndexedEventsCountSumOk() (*int64, bool) { + if o == nil || o.IndexedEventsCountSum == nil { + return nil, false + } + return o.IndexedEventsCountSum, true +} + +// HasIndexedEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasIndexedEventsCountSum() bool { + if o != nil && o.IndexedEventsCountSum != nil { + return true + } + + return false +} + +// SetIndexedEventsCountSum gets a reference to the given int64 and assigns it to the IndexedEventsCountSum field. +func (o *UsageSummaryDate) SetIndexedEventsCountSum(v int64) { + o.IndexedEventsCountSum = &v +} + +// GetInfraHostTop99p returns the InfraHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetInfraHostTop99p() int64 { + if o == nil || o.InfraHostTop99p == nil { + var ret int64 + return ret + } + return *o.InfraHostTop99p +} + +// GetInfraHostTop99pOk returns a tuple with the InfraHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetInfraHostTop99pOk() (*int64, bool) { + if o == nil || o.InfraHostTop99p == nil { + return nil, false + } + return o.InfraHostTop99p, true +} + +// HasInfraHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasInfraHostTop99p() bool { + if o != nil && o.InfraHostTop99p != nil { + return true + } + + return false +} + +// SetInfraHostTop99p gets a reference to the given int64 and assigns it to the InfraHostTop99p field. +func (o *UsageSummaryDate) SetInfraHostTop99p(v int64) { + o.InfraHostTop99p = &v +} + +// GetIngestedEventsBytesSum returns the IngestedEventsBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetIngestedEventsBytesSum() int64 { + if o == nil || o.IngestedEventsBytesSum == nil { + var ret int64 + return ret + } + return *o.IngestedEventsBytesSum +} + +// GetIngestedEventsBytesSumOk returns a tuple with the IngestedEventsBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetIngestedEventsBytesSumOk() (*int64, bool) { + if o == nil || o.IngestedEventsBytesSum == nil { + return nil, false + } + return o.IngestedEventsBytesSum, true +} + +// HasIngestedEventsBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasIngestedEventsBytesSum() bool { + if o != nil && o.IngestedEventsBytesSum != nil { + return true + } + + return false +} + +// SetIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the IngestedEventsBytesSum field. +func (o *UsageSummaryDate) SetIngestedEventsBytesSum(v int64) { + o.IngestedEventsBytesSum = &v +} + +// GetIotDeviceSum returns the IotDeviceSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetIotDeviceSum() int64 { + if o == nil || o.IotDeviceSum == nil { + var ret int64 + return ret + } + return *o.IotDeviceSum +} + +// GetIotDeviceSumOk returns a tuple with the IotDeviceSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetIotDeviceSumOk() (*int64, bool) { + if o == nil || o.IotDeviceSum == nil { + return nil, false + } + return o.IotDeviceSum, true +} + +// HasIotDeviceSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasIotDeviceSum() bool { + if o != nil && o.IotDeviceSum != nil { + return true + } + + return false +} + +// SetIotDeviceSum gets a reference to the given int64 and assigns it to the IotDeviceSum field. +func (o *UsageSummaryDate) SetIotDeviceSum(v int64) { + o.IotDeviceSum = &v +} + +// GetIotDeviceTop99p returns the IotDeviceTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetIotDeviceTop99p() int64 { + if o == nil || o.IotDeviceTop99p == nil { + var ret int64 + return ret + } + return *o.IotDeviceTop99p +} + +// GetIotDeviceTop99pOk returns a tuple with the IotDeviceTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetIotDeviceTop99pOk() (*int64, bool) { + if o == nil || o.IotDeviceTop99p == nil { + return nil, false + } + return o.IotDeviceTop99p, true +} + +// HasIotDeviceTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasIotDeviceTop99p() bool { + if o != nil && o.IotDeviceTop99p != nil { + return true + } + + return false +} + +// SetIotDeviceTop99p gets a reference to the given int64 and assigns it to the IotDeviceTop99p field. +func (o *UsageSummaryDate) SetIotDeviceTop99p(v int64) { + o.IotDeviceTop99p = &v +} + +// GetMobileRumLiteSessionCountSum returns the MobileRumLiteSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetMobileRumLiteSessionCountSum() int64 { + if o == nil || o.MobileRumLiteSessionCountSum == nil { + var ret int64 + return ret + } + return *o.MobileRumLiteSessionCountSum +} + +// GetMobileRumLiteSessionCountSumOk returns a tuple with the MobileRumLiteSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetMobileRumLiteSessionCountSumOk() (*int64, bool) { + if o == nil || o.MobileRumLiteSessionCountSum == nil { + return nil, false + } + return o.MobileRumLiteSessionCountSum, true +} + +// HasMobileRumLiteSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasMobileRumLiteSessionCountSum() bool { + if o != nil && o.MobileRumLiteSessionCountSum != nil { + return true + } + + return false +} + +// SetMobileRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumLiteSessionCountSum field. +func (o *UsageSummaryDate) SetMobileRumLiteSessionCountSum(v int64) { + o.MobileRumLiteSessionCountSum = &v +} + +// GetMobileRumSessionCountAndroidSum returns the MobileRumSessionCountAndroidSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetMobileRumSessionCountAndroidSum() int64 { + if o == nil || o.MobileRumSessionCountAndroidSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountAndroidSum +} + +// GetMobileRumSessionCountAndroidSumOk returns a tuple with the MobileRumSessionCountAndroidSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetMobileRumSessionCountAndroidSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountAndroidSum == nil { + return nil, false + } + return o.MobileRumSessionCountAndroidSum, true +} + +// HasMobileRumSessionCountAndroidSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasMobileRumSessionCountAndroidSum() bool { + if o != nil && o.MobileRumSessionCountAndroidSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountAndroidSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAndroidSum field. +func (o *UsageSummaryDate) SetMobileRumSessionCountAndroidSum(v int64) { + o.MobileRumSessionCountAndroidSum = &v +} + +// GetMobileRumSessionCountIosSum returns the MobileRumSessionCountIosSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetMobileRumSessionCountIosSum() int64 { + if o == nil || o.MobileRumSessionCountIosSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountIosSum +} + +// GetMobileRumSessionCountIosSumOk returns a tuple with the MobileRumSessionCountIosSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetMobileRumSessionCountIosSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountIosSum == nil { + return nil, false + } + return o.MobileRumSessionCountIosSum, true +} + +// HasMobileRumSessionCountIosSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasMobileRumSessionCountIosSum() bool { + if o != nil && o.MobileRumSessionCountIosSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountIosSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountIosSum field. +func (o *UsageSummaryDate) SetMobileRumSessionCountIosSum(v int64) { + o.MobileRumSessionCountIosSum = &v +} + +// GetMobileRumSessionCountReactnativeSum returns the MobileRumSessionCountReactnativeSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetMobileRumSessionCountReactnativeSum() int64 { + if o == nil || o.MobileRumSessionCountReactnativeSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountReactnativeSum +} + +// GetMobileRumSessionCountReactnativeSumOk returns a tuple with the MobileRumSessionCountReactnativeSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetMobileRumSessionCountReactnativeSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountReactnativeSum == nil { + return nil, false + } + return o.MobileRumSessionCountReactnativeSum, true +} + +// HasMobileRumSessionCountReactnativeSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasMobileRumSessionCountReactnativeSum() bool { + if o != nil && o.MobileRumSessionCountReactnativeSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountReactnativeSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountReactnativeSum field. +func (o *UsageSummaryDate) SetMobileRumSessionCountReactnativeSum(v int64) { + o.MobileRumSessionCountReactnativeSum = &v +} + +// GetMobileRumSessionCountSum returns the MobileRumSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetMobileRumSessionCountSum() int64 { + if o == nil || o.MobileRumSessionCountSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountSum +} + +// GetMobileRumSessionCountSumOk returns a tuple with the MobileRumSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetMobileRumSessionCountSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountSum == nil { + return nil, false + } + return o.MobileRumSessionCountSum, true +} + +// HasMobileRumSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasMobileRumSessionCountSum() bool { + if o != nil && o.MobileRumSessionCountSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountSum field. +func (o *UsageSummaryDate) SetMobileRumSessionCountSum(v int64) { + o.MobileRumSessionCountSum = &v +} + +// GetMobileRumUnitsSum returns the MobileRumUnitsSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetMobileRumUnitsSum() int64 { + if o == nil || o.MobileRumUnitsSum == nil { + var ret int64 + return ret + } + return *o.MobileRumUnitsSum +} + +// GetMobileRumUnitsSumOk returns a tuple with the MobileRumUnitsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetMobileRumUnitsSumOk() (*int64, bool) { + if o == nil || o.MobileRumUnitsSum == nil { + return nil, false + } + return o.MobileRumUnitsSum, true +} + +// HasMobileRumUnitsSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasMobileRumUnitsSum() bool { + if o != nil && o.MobileRumUnitsSum != nil { + return true + } + + return false +} + +// SetMobileRumUnitsSum gets a reference to the given int64 and assigns it to the MobileRumUnitsSum field. +func (o *UsageSummaryDate) SetMobileRumUnitsSum(v int64) { + o.MobileRumUnitsSum = &v +} + +// GetNetflowIndexedEventsCountSum returns the NetflowIndexedEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetNetflowIndexedEventsCountSum() int64 { + if o == nil || o.NetflowIndexedEventsCountSum == nil { + var ret int64 + return ret + } + return *o.NetflowIndexedEventsCountSum +} + +// GetNetflowIndexedEventsCountSumOk returns a tuple with the NetflowIndexedEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetNetflowIndexedEventsCountSumOk() (*int64, bool) { + if o == nil || o.NetflowIndexedEventsCountSum == nil { + return nil, false + } + return o.NetflowIndexedEventsCountSum, true +} + +// HasNetflowIndexedEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasNetflowIndexedEventsCountSum() bool { + if o != nil && o.NetflowIndexedEventsCountSum != nil { + return true + } + + return false +} + +// SetNetflowIndexedEventsCountSum gets a reference to the given int64 and assigns it to the NetflowIndexedEventsCountSum field. +func (o *UsageSummaryDate) SetNetflowIndexedEventsCountSum(v int64) { + o.NetflowIndexedEventsCountSum = &v +} + +// GetNpmHostTop99p returns the NpmHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetNpmHostTop99p() int64 { + if o == nil || o.NpmHostTop99p == nil { + var ret int64 + return ret + } + return *o.NpmHostTop99p +} + +// GetNpmHostTop99pOk returns a tuple with the NpmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetNpmHostTop99pOk() (*int64, bool) { + if o == nil || o.NpmHostTop99p == nil { + return nil, false + } + return o.NpmHostTop99p, true +} + +// HasNpmHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasNpmHostTop99p() bool { + if o != nil && o.NpmHostTop99p != nil { + return true + } + + return false +} + +// SetNpmHostTop99p gets a reference to the given int64 and assigns it to the NpmHostTop99p field. +func (o *UsageSummaryDate) SetNpmHostTop99p(v int64) { + o.NpmHostTop99p = &v +} + +// GetObservabilityPipelinesBytesProcessedSum returns the ObservabilityPipelinesBytesProcessedSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetObservabilityPipelinesBytesProcessedSum() int64 { + if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { + var ret int64 + return ret + } + return *o.ObservabilityPipelinesBytesProcessedSum +} + +// GetObservabilityPipelinesBytesProcessedSumOk returns a tuple with the ObservabilityPipelinesBytesProcessedSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetObservabilityPipelinesBytesProcessedSumOk() (*int64, bool) { + if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { + return nil, false + } + return o.ObservabilityPipelinesBytesProcessedSum, true +} + +// HasObservabilityPipelinesBytesProcessedSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasObservabilityPipelinesBytesProcessedSum() bool { + if o != nil && o.ObservabilityPipelinesBytesProcessedSum != nil { + return true + } + + return false +} + +// SetObservabilityPipelinesBytesProcessedSum gets a reference to the given int64 and assigns it to the ObservabilityPipelinesBytesProcessedSum field. +func (o *UsageSummaryDate) SetObservabilityPipelinesBytesProcessedSum(v int64) { + o.ObservabilityPipelinesBytesProcessedSum = &v +} + +// GetOnlineArchiveEventsCountSum returns the OnlineArchiveEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetOnlineArchiveEventsCountSum() int64 { + if o == nil || o.OnlineArchiveEventsCountSum == nil { + var ret int64 + return ret + } + return *o.OnlineArchiveEventsCountSum +} + +// GetOnlineArchiveEventsCountSumOk returns a tuple with the OnlineArchiveEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetOnlineArchiveEventsCountSumOk() (*int64, bool) { + if o == nil || o.OnlineArchiveEventsCountSum == nil { + return nil, false + } + return o.OnlineArchiveEventsCountSum, true +} + +// HasOnlineArchiveEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasOnlineArchiveEventsCountSum() bool { + if o != nil && o.OnlineArchiveEventsCountSum != nil { + return true + } + + return false +} + +// SetOnlineArchiveEventsCountSum gets a reference to the given int64 and assigns it to the OnlineArchiveEventsCountSum field. +func (o *UsageSummaryDate) SetOnlineArchiveEventsCountSum(v int64) { + o.OnlineArchiveEventsCountSum = &v +} + +// GetOpentelemetryHostTop99p returns the OpentelemetryHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetOpentelemetryHostTop99p() int64 { + if o == nil || o.OpentelemetryHostTop99p == nil { + var ret int64 + return ret + } + return *o.OpentelemetryHostTop99p +} + +// GetOpentelemetryHostTop99pOk returns a tuple with the OpentelemetryHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetOpentelemetryHostTop99pOk() (*int64, bool) { + if o == nil || o.OpentelemetryHostTop99p == nil { + return nil, false + } + return o.OpentelemetryHostTop99p, true +} + +// HasOpentelemetryHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasOpentelemetryHostTop99p() bool { + if o != nil && o.OpentelemetryHostTop99p != nil { + return true + } + + return false +} + +// SetOpentelemetryHostTop99p gets a reference to the given int64 and assigns it to the OpentelemetryHostTop99p field. +func (o *UsageSummaryDate) SetOpentelemetryHostTop99p(v int64) { + o.OpentelemetryHostTop99p = &v +} + +// GetOrgs returns the Orgs field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetOrgs() []UsageSummaryDateOrg { + if o == nil || o.Orgs == nil { + var ret []UsageSummaryDateOrg + return ret + } + return o.Orgs +} + +// GetOrgsOk returns a tuple with the Orgs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetOrgsOk() (*[]UsageSummaryDateOrg, bool) { + if o == nil || o.Orgs == nil { + return nil, false + } + return &o.Orgs, true +} + +// HasOrgs returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasOrgs() bool { + if o != nil && o.Orgs != nil { + return true + } + + return false +} + +// SetOrgs gets a reference to the given []UsageSummaryDateOrg and assigns it to the Orgs field. +func (o *UsageSummaryDate) SetOrgs(v []UsageSummaryDateOrg) { + o.Orgs = v +} + +// GetProfilingHostTop99p returns the ProfilingHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetProfilingHostTop99p() int64 { + if o == nil || o.ProfilingHostTop99p == nil { + var ret int64 + return ret + } + return *o.ProfilingHostTop99p +} + +// GetProfilingHostTop99pOk returns a tuple with the ProfilingHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetProfilingHostTop99pOk() (*int64, bool) { + if o == nil || o.ProfilingHostTop99p == nil { + return nil, false + } + return o.ProfilingHostTop99p, true +} + +// HasProfilingHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasProfilingHostTop99p() bool { + if o != nil && o.ProfilingHostTop99p != nil { + return true + } + + return false +} + +// SetProfilingHostTop99p gets a reference to the given int64 and assigns it to the ProfilingHostTop99p field. +func (o *UsageSummaryDate) SetProfilingHostTop99p(v int64) { + o.ProfilingHostTop99p = &v +} + +// GetRumBrowserAndMobileSessionCount returns the RumBrowserAndMobileSessionCount field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetRumBrowserAndMobileSessionCount() int64 { + if o == nil || o.RumBrowserAndMobileSessionCount == nil { + var ret int64 + return ret + } + return *o.RumBrowserAndMobileSessionCount +} + +// GetRumBrowserAndMobileSessionCountOk returns a tuple with the RumBrowserAndMobileSessionCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetRumBrowserAndMobileSessionCountOk() (*int64, bool) { + if o == nil || o.RumBrowserAndMobileSessionCount == nil { + return nil, false + } + return o.RumBrowserAndMobileSessionCount, true +} + +// HasRumBrowserAndMobileSessionCount returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasRumBrowserAndMobileSessionCount() bool { + if o != nil && o.RumBrowserAndMobileSessionCount != nil { + return true + } + + return false +} + +// SetRumBrowserAndMobileSessionCount gets a reference to the given int64 and assigns it to the RumBrowserAndMobileSessionCount field. +func (o *UsageSummaryDate) SetRumBrowserAndMobileSessionCount(v int64) { + o.RumBrowserAndMobileSessionCount = &v +} + +// GetRumSessionCountSum returns the RumSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetRumSessionCountSum() int64 { + if o == nil || o.RumSessionCountSum == nil { + var ret int64 + return ret + } + return *o.RumSessionCountSum +} + +// GetRumSessionCountSumOk returns a tuple with the RumSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetRumSessionCountSumOk() (*int64, bool) { + if o == nil || o.RumSessionCountSum == nil { + return nil, false + } + return o.RumSessionCountSum, true +} + +// HasRumSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasRumSessionCountSum() bool { + if o != nil && o.RumSessionCountSum != nil { + return true + } + + return false +} + +// SetRumSessionCountSum gets a reference to the given int64 and assigns it to the RumSessionCountSum field. +func (o *UsageSummaryDate) SetRumSessionCountSum(v int64) { + o.RumSessionCountSum = &v +} + +// GetRumTotalSessionCountSum returns the RumTotalSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetRumTotalSessionCountSum() int64 { + if o == nil || o.RumTotalSessionCountSum == nil { + var ret int64 + return ret + } + return *o.RumTotalSessionCountSum +} + +// GetRumTotalSessionCountSumOk returns a tuple with the RumTotalSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetRumTotalSessionCountSumOk() (*int64, bool) { + if o == nil || o.RumTotalSessionCountSum == nil { + return nil, false + } + return o.RumTotalSessionCountSum, true +} + +// HasRumTotalSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasRumTotalSessionCountSum() bool { + if o != nil && o.RumTotalSessionCountSum != nil { + return true + } + + return false +} + +// SetRumTotalSessionCountSum gets a reference to the given int64 and assigns it to the RumTotalSessionCountSum field. +func (o *UsageSummaryDate) SetRumTotalSessionCountSum(v int64) { + o.RumTotalSessionCountSum = &v +} + +// GetRumUnitsSum returns the RumUnitsSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetRumUnitsSum() int64 { + if o == nil || o.RumUnitsSum == nil { + var ret int64 + return ret + } + return *o.RumUnitsSum +} + +// GetRumUnitsSumOk returns a tuple with the RumUnitsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetRumUnitsSumOk() (*int64, bool) { + if o == nil || o.RumUnitsSum == nil { + return nil, false + } + return o.RumUnitsSum, true +} + +// HasRumUnitsSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasRumUnitsSum() bool { + if o != nil && o.RumUnitsSum != nil { + return true + } + + return false +} + +// SetRumUnitsSum gets a reference to the given int64 and assigns it to the RumUnitsSum field. +func (o *UsageSummaryDate) SetRumUnitsSum(v int64) { + o.RumUnitsSum = &v +} + +// GetSdsLogsScannedBytesSum returns the SdsLogsScannedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetSdsLogsScannedBytesSum() int64 { + if o == nil || o.SdsLogsScannedBytesSum == nil { + var ret int64 + return ret + } + return *o.SdsLogsScannedBytesSum +} + +// GetSdsLogsScannedBytesSumOk returns a tuple with the SdsLogsScannedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetSdsLogsScannedBytesSumOk() (*int64, bool) { + if o == nil || o.SdsLogsScannedBytesSum == nil { + return nil, false + } + return o.SdsLogsScannedBytesSum, true +} + +// HasSdsLogsScannedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasSdsLogsScannedBytesSum() bool { + if o != nil && o.SdsLogsScannedBytesSum != nil { + return true + } + + return false +} + +// SetSdsLogsScannedBytesSum gets a reference to the given int64 and assigns it to the SdsLogsScannedBytesSum field. +func (o *UsageSummaryDate) SetSdsLogsScannedBytesSum(v int64) { + o.SdsLogsScannedBytesSum = &v +} + +// GetSdsTotalScannedBytesSum returns the SdsTotalScannedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetSdsTotalScannedBytesSum() int64 { + if o == nil || o.SdsTotalScannedBytesSum == nil { + var ret int64 + return ret + } + return *o.SdsTotalScannedBytesSum +} + +// GetSdsTotalScannedBytesSumOk returns a tuple with the SdsTotalScannedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetSdsTotalScannedBytesSumOk() (*int64, bool) { + if o == nil || o.SdsTotalScannedBytesSum == nil { + return nil, false + } + return o.SdsTotalScannedBytesSum, true +} + +// HasSdsTotalScannedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasSdsTotalScannedBytesSum() bool { + if o != nil && o.SdsTotalScannedBytesSum != nil { + return true + } + + return false +} + +// SetSdsTotalScannedBytesSum gets a reference to the given int64 and assigns it to the SdsTotalScannedBytesSum field. +func (o *UsageSummaryDate) SetSdsTotalScannedBytesSum(v int64) { + o.SdsTotalScannedBytesSum = &v +} + +// GetSyntheticsBrowserCheckCallsCountSum returns the SyntheticsBrowserCheckCallsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetSyntheticsBrowserCheckCallsCountSum() int64 { + if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { + var ret int64 + return ret + } + return *o.SyntheticsBrowserCheckCallsCountSum +} + +// GetSyntheticsBrowserCheckCallsCountSumOk returns a tuple with the SyntheticsBrowserCheckCallsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetSyntheticsBrowserCheckCallsCountSumOk() (*int64, bool) { + if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { + return nil, false + } + return o.SyntheticsBrowserCheckCallsCountSum, true +} + +// HasSyntheticsBrowserCheckCallsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasSyntheticsBrowserCheckCallsCountSum() bool { + if o != nil && o.SyntheticsBrowserCheckCallsCountSum != nil { + return true + } + + return false +} + +// SetSyntheticsBrowserCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsBrowserCheckCallsCountSum field. +func (o *UsageSummaryDate) SetSyntheticsBrowserCheckCallsCountSum(v int64) { + o.SyntheticsBrowserCheckCallsCountSum = &v +} + +// GetSyntheticsCheckCallsCountSum returns the SyntheticsCheckCallsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetSyntheticsCheckCallsCountSum() int64 { + if o == nil || o.SyntheticsCheckCallsCountSum == nil { + var ret int64 + return ret + } + return *o.SyntheticsCheckCallsCountSum +} + +// GetSyntheticsCheckCallsCountSumOk returns a tuple with the SyntheticsCheckCallsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetSyntheticsCheckCallsCountSumOk() (*int64, bool) { + if o == nil || o.SyntheticsCheckCallsCountSum == nil { + return nil, false + } + return o.SyntheticsCheckCallsCountSum, true +} + +// HasSyntheticsCheckCallsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasSyntheticsCheckCallsCountSum() bool { + if o != nil && o.SyntheticsCheckCallsCountSum != nil { + return true + } + + return false +} + +// SetSyntheticsCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsCheckCallsCountSum field. +func (o *UsageSummaryDate) SetSyntheticsCheckCallsCountSum(v int64) { + o.SyntheticsCheckCallsCountSum = &v +} + +// GetTraceSearchIndexedEventsCountSum returns the TraceSearchIndexedEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetTraceSearchIndexedEventsCountSum() int64 { + if o == nil || o.TraceSearchIndexedEventsCountSum == nil { + var ret int64 + return ret + } + return *o.TraceSearchIndexedEventsCountSum +} + +// GetTraceSearchIndexedEventsCountSumOk returns a tuple with the TraceSearchIndexedEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetTraceSearchIndexedEventsCountSumOk() (*int64, bool) { + if o == nil || o.TraceSearchIndexedEventsCountSum == nil { + return nil, false + } + return o.TraceSearchIndexedEventsCountSum, true +} + +// HasTraceSearchIndexedEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasTraceSearchIndexedEventsCountSum() bool { + if o != nil && o.TraceSearchIndexedEventsCountSum != nil { + return true + } + + return false +} + +// SetTraceSearchIndexedEventsCountSum gets a reference to the given int64 and assigns it to the TraceSearchIndexedEventsCountSum field. +func (o *UsageSummaryDate) SetTraceSearchIndexedEventsCountSum(v int64) { + o.TraceSearchIndexedEventsCountSum = &v +} + +// GetTwolIngestedEventsBytesSum returns the TwolIngestedEventsBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetTwolIngestedEventsBytesSum() int64 { + if o == nil || o.TwolIngestedEventsBytesSum == nil { + var ret int64 + return ret + } + return *o.TwolIngestedEventsBytesSum +} + +// GetTwolIngestedEventsBytesSumOk returns a tuple with the TwolIngestedEventsBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetTwolIngestedEventsBytesSumOk() (*int64, bool) { + if o == nil || o.TwolIngestedEventsBytesSum == nil { + return nil, false + } + return o.TwolIngestedEventsBytesSum, true +} + +// HasTwolIngestedEventsBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasTwolIngestedEventsBytesSum() bool { + if o != nil && o.TwolIngestedEventsBytesSum != nil { + return true + } + + return false +} + +// SetTwolIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the TwolIngestedEventsBytesSum field. +func (o *UsageSummaryDate) SetTwolIngestedEventsBytesSum(v int64) { + o.TwolIngestedEventsBytesSum = &v +} + +// GetVsphereHostTop99p returns the VsphereHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDate) GetVsphereHostTop99p() int64 { + if o == nil || o.VsphereHostTop99p == nil { + var ret int64 + return ret + } + return *o.VsphereHostTop99p +} + +// GetVsphereHostTop99pOk returns a tuple with the VsphereHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDate) GetVsphereHostTop99pOk() (*int64, bool) { + if o == nil || o.VsphereHostTop99p == nil { + return nil, false + } + return o.VsphereHostTop99p, true +} + +// HasVsphereHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDate) HasVsphereHostTop99p() bool { + if o != nil && o.VsphereHostTop99p != nil { + return true + } + + return false +} + +// SetVsphereHostTop99p gets a reference to the given int64 and assigns it to the VsphereHostTop99p field. +func (o *UsageSummaryDate) SetVsphereHostTop99p(v int64) { + o.VsphereHostTop99p = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSummaryDate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AgentHostTop99p != nil { + toSerialize["agent_host_top99p"] = o.AgentHostTop99p + } + if o.ApmAzureAppServiceHostTop99p != nil { + toSerialize["apm_azure_app_service_host_top99p"] = o.ApmAzureAppServiceHostTop99p + } + if o.ApmHostTop99p != nil { + toSerialize["apm_host_top99p"] = o.ApmHostTop99p + } + if o.AuditLogsLinesIndexedSum != nil { + toSerialize["audit_logs_lines_indexed_sum"] = o.AuditLogsLinesIndexedSum + } + if o.AvgProfiledFargateTasks != nil { + toSerialize["avg_profiled_fargate_tasks"] = o.AvgProfiledFargateTasks + } + if o.AwsHostTop99p != nil { + toSerialize["aws_host_top99p"] = o.AwsHostTop99p + } + if o.AwsLambdaFuncCount != nil { + toSerialize["aws_lambda_func_count"] = o.AwsLambdaFuncCount + } + if o.AwsLambdaInvocationsSum != nil { + toSerialize["aws_lambda_invocations_sum"] = o.AwsLambdaInvocationsSum + } + if o.AzureAppServiceTop99p != nil { + toSerialize["azure_app_service_top99p"] = o.AzureAppServiceTop99p + } + if o.BillableIngestedBytesSum != nil { + toSerialize["billable_ingested_bytes_sum"] = o.BillableIngestedBytesSum + } + if o.BrowserRumLiteSessionCountSum != nil { + toSerialize["browser_rum_lite_session_count_sum"] = o.BrowserRumLiteSessionCountSum + } + if o.BrowserRumReplaySessionCountSum != nil { + toSerialize["browser_rum_replay_session_count_sum"] = o.BrowserRumReplaySessionCountSum + } + if o.BrowserRumUnitsSum != nil { + toSerialize["browser_rum_units_sum"] = o.BrowserRumUnitsSum + } + if o.CiPipelineIndexedSpansSum != nil { + toSerialize["ci_pipeline_indexed_spans_sum"] = o.CiPipelineIndexedSpansSum + } + if o.CiTestIndexedSpansSum != nil { + toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum + } + if o.CiVisibilityPipelineCommittersHwm != nil { + toSerialize["ci_visibility_pipeline_committers_hwm"] = o.CiVisibilityPipelineCommittersHwm + } + if o.CiVisibilityTestCommittersHwm != nil { + toSerialize["ci_visibility_test_committers_hwm"] = o.CiVisibilityTestCommittersHwm + } + if o.ContainerAvg != nil { + toSerialize["container_avg"] = o.ContainerAvg + } + if o.ContainerHwm != nil { + toSerialize["container_hwm"] = o.ContainerHwm + } + if o.CspmAasHostTop99p != nil { + toSerialize["cspm_aas_host_top99p"] = o.CspmAasHostTop99p + } + if o.CspmAzureHostTop99p != nil { + toSerialize["cspm_azure_host_top99p"] = o.CspmAzureHostTop99p + } + if o.CspmContainerAvg != nil { + toSerialize["cspm_container_avg"] = o.CspmContainerAvg + } + if o.CspmContainerHwm != nil { + toSerialize["cspm_container_hwm"] = o.CspmContainerHwm + } + if o.CspmHostTop99p != nil { + toSerialize["cspm_host_top99p"] = o.CspmHostTop99p + } + if o.CustomTsAvg != nil { + toSerialize["custom_ts_avg"] = o.CustomTsAvg + } + if o.CwsContainerCountAvg != nil { + toSerialize["cws_container_count_avg"] = o.CwsContainerCountAvg + } + if o.CwsHostTop99p != nil { + toSerialize["cws_host_top99p"] = o.CwsHostTop99p + } + if o.Date != nil { + if o.Date.Nanosecond() == 0 { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.DbmHostTop99p != nil { + toSerialize["dbm_host_top99p"] = o.DbmHostTop99p + } + if o.DbmQueriesCountAvg != nil { + toSerialize["dbm_queries_count_avg"] = o.DbmQueriesCountAvg + } + if o.FargateTasksCountAvg != nil { + toSerialize["fargate_tasks_count_avg"] = o.FargateTasksCountAvg + } + if o.FargateTasksCountHwm != nil { + toSerialize["fargate_tasks_count_hwm"] = o.FargateTasksCountHwm + } + if o.GcpHostTop99p != nil { + toSerialize["gcp_host_top99p"] = o.GcpHostTop99p + } + if o.HerokuHostTop99p != nil { + toSerialize["heroku_host_top99p"] = o.HerokuHostTop99p + } + if o.IncidentManagementMonthlyActiveUsersHwm != nil { + toSerialize["incident_management_monthly_active_users_hwm"] = o.IncidentManagementMonthlyActiveUsersHwm + } + if o.IndexedEventsCountSum != nil { + toSerialize["indexed_events_count_sum"] = o.IndexedEventsCountSum + } + if o.InfraHostTop99p != nil { + toSerialize["infra_host_top99p"] = o.InfraHostTop99p + } + if o.IngestedEventsBytesSum != nil { + toSerialize["ingested_events_bytes_sum"] = o.IngestedEventsBytesSum + } + if o.IotDeviceSum != nil { + toSerialize["iot_device_sum"] = o.IotDeviceSum + } + if o.IotDeviceTop99p != nil { + toSerialize["iot_device_top99p"] = o.IotDeviceTop99p + } + if o.MobileRumLiteSessionCountSum != nil { + toSerialize["mobile_rum_lite_session_count_sum"] = o.MobileRumLiteSessionCountSum + } + if o.MobileRumSessionCountAndroidSum != nil { + toSerialize["mobile_rum_session_count_android_sum"] = o.MobileRumSessionCountAndroidSum + } + if o.MobileRumSessionCountIosSum != nil { + toSerialize["mobile_rum_session_count_ios_sum"] = o.MobileRumSessionCountIosSum + } + if o.MobileRumSessionCountReactnativeSum != nil { + toSerialize["mobile_rum_session_count_reactnative_sum"] = o.MobileRumSessionCountReactnativeSum + } + if o.MobileRumSessionCountSum != nil { + toSerialize["mobile_rum_session_count_sum"] = o.MobileRumSessionCountSum + } + if o.MobileRumUnitsSum != nil { + toSerialize["mobile_rum_units_sum"] = o.MobileRumUnitsSum + } + if o.NetflowIndexedEventsCountSum != nil { + toSerialize["netflow_indexed_events_count_sum"] = o.NetflowIndexedEventsCountSum + } + if o.NpmHostTop99p != nil { + toSerialize["npm_host_top99p"] = o.NpmHostTop99p + } + if o.ObservabilityPipelinesBytesProcessedSum != nil { + toSerialize["observability_pipelines_bytes_processed_sum"] = o.ObservabilityPipelinesBytesProcessedSum + } + if o.OnlineArchiveEventsCountSum != nil { + toSerialize["online_archive_events_count_sum"] = o.OnlineArchiveEventsCountSum + } + if o.OpentelemetryHostTop99p != nil { + toSerialize["opentelemetry_host_top99p"] = o.OpentelemetryHostTop99p + } + if o.Orgs != nil { + toSerialize["orgs"] = o.Orgs + } + if o.ProfilingHostTop99p != nil { + toSerialize["profiling_host_top99p"] = o.ProfilingHostTop99p + } + if o.RumBrowserAndMobileSessionCount != nil { + toSerialize["rum_browser_and_mobile_session_count"] = o.RumBrowserAndMobileSessionCount + } + if o.RumSessionCountSum != nil { + toSerialize["rum_session_count_sum"] = o.RumSessionCountSum + } + if o.RumTotalSessionCountSum != nil { + toSerialize["rum_total_session_count_sum"] = o.RumTotalSessionCountSum + } + if o.RumUnitsSum != nil { + toSerialize["rum_units_sum"] = o.RumUnitsSum + } + if o.SdsLogsScannedBytesSum != nil { + toSerialize["sds_logs_scanned_bytes_sum"] = o.SdsLogsScannedBytesSum + } + if o.SdsTotalScannedBytesSum != nil { + toSerialize["sds_total_scanned_bytes_sum"] = o.SdsTotalScannedBytesSum + } + if o.SyntheticsBrowserCheckCallsCountSum != nil { + toSerialize["synthetics_browser_check_calls_count_sum"] = o.SyntheticsBrowserCheckCallsCountSum + } + if o.SyntheticsCheckCallsCountSum != nil { + toSerialize["synthetics_check_calls_count_sum"] = o.SyntheticsCheckCallsCountSum + } + if o.TraceSearchIndexedEventsCountSum != nil { + toSerialize["trace_search_indexed_events_count_sum"] = o.TraceSearchIndexedEventsCountSum + } + if o.TwolIngestedEventsBytesSum != nil { + toSerialize["twol_ingested_events_bytes_sum"] = o.TwolIngestedEventsBytesSum + } + if o.VsphereHostTop99p != nil { + toSerialize["vsphere_host_top99p"] = o.VsphereHostTop99p + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` + ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` + ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` + AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` + AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` + AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` + AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` + AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` + AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` + BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` + BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` + BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` + BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` + CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` + CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` + CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` + ContainerAvg *int64 `json:"container_avg,omitempty"` + ContainerHwm *int64 `json:"container_hwm,omitempty"` + CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` + CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` + CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` + CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` + CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` + CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` + CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` + CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` + Date *time.Time `json:"date,omitempty"` + DbmHostTop99p *int64 `json:"dbm_host_top99p,omitempty"` + DbmQueriesCountAvg *int64 `json:"dbm_queries_count_avg,omitempty"` + FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` + FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` + GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` + HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` + IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` + IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` + InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` + IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` + IotDeviceSum *int64 `json:"iot_device_sum,omitempty"` + IotDeviceTop99p *int64 `json:"iot_device_top99p,omitempty"` + MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` + MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` + MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` + MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` + MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` + MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` + NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` + NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` + ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` + OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` + OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` + Orgs []UsageSummaryDateOrg `json:"orgs,omitempty"` + ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` + RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` + RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` + RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` + RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` + SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` + SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` + SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` + SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` + TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` + TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` + VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AgentHostTop99p = all.AgentHostTop99p + o.ApmAzureAppServiceHostTop99p = all.ApmAzureAppServiceHostTop99p + o.ApmHostTop99p = all.ApmHostTop99p + o.AuditLogsLinesIndexedSum = all.AuditLogsLinesIndexedSum + o.AvgProfiledFargateTasks = all.AvgProfiledFargateTasks + o.AwsHostTop99p = all.AwsHostTop99p + o.AwsLambdaFuncCount = all.AwsLambdaFuncCount + o.AwsLambdaInvocationsSum = all.AwsLambdaInvocationsSum + o.AzureAppServiceTop99p = all.AzureAppServiceTop99p + o.BillableIngestedBytesSum = all.BillableIngestedBytesSum + o.BrowserRumLiteSessionCountSum = all.BrowserRumLiteSessionCountSum + o.BrowserRumReplaySessionCountSum = all.BrowserRumReplaySessionCountSum + o.BrowserRumUnitsSum = all.BrowserRumUnitsSum + o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum + o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum + o.CiVisibilityPipelineCommittersHwm = all.CiVisibilityPipelineCommittersHwm + o.CiVisibilityTestCommittersHwm = all.CiVisibilityTestCommittersHwm + o.ContainerAvg = all.ContainerAvg + o.ContainerHwm = all.ContainerHwm + o.CspmAasHostTop99p = all.CspmAasHostTop99p + o.CspmAzureHostTop99p = all.CspmAzureHostTop99p + o.CspmContainerAvg = all.CspmContainerAvg + o.CspmContainerHwm = all.CspmContainerHwm + o.CspmHostTop99p = all.CspmHostTop99p + o.CustomTsAvg = all.CustomTsAvg + o.CwsContainerCountAvg = all.CwsContainerCountAvg + o.CwsHostTop99p = all.CwsHostTop99p + o.Date = all.Date + o.DbmHostTop99p = all.DbmHostTop99p + o.DbmQueriesCountAvg = all.DbmQueriesCountAvg + o.FargateTasksCountAvg = all.FargateTasksCountAvg + o.FargateTasksCountHwm = all.FargateTasksCountHwm + o.GcpHostTop99p = all.GcpHostTop99p + o.HerokuHostTop99p = all.HerokuHostTop99p + o.IncidentManagementMonthlyActiveUsersHwm = all.IncidentManagementMonthlyActiveUsersHwm + o.IndexedEventsCountSum = all.IndexedEventsCountSum + o.InfraHostTop99p = all.InfraHostTop99p + o.IngestedEventsBytesSum = all.IngestedEventsBytesSum + o.IotDeviceSum = all.IotDeviceSum + o.IotDeviceTop99p = all.IotDeviceTop99p + o.MobileRumLiteSessionCountSum = all.MobileRumLiteSessionCountSum + o.MobileRumSessionCountAndroidSum = all.MobileRumSessionCountAndroidSum + o.MobileRumSessionCountIosSum = all.MobileRumSessionCountIosSum + o.MobileRumSessionCountReactnativeSum = all.MobileRumSessionCountReactnativeSum + o.MobileRumSessionCountSum = all.MobileRumSessionCountSum + o.MobileRumUnitsSum = all.MobileRumUnitsSum + o.NetflowIndexedEventsCountSum = all.NetflowIndexedEventsCountSum + o.NpmHostTop99p = all.NpmHostTop99p + o.ObservabilityPipelinesBytesProcessedSum = all.ObservabilityPipelinesBytesProcessedSum + o.OnlineArchiveEventsCountSum = all.OnlineArchiveEventsCountSum + o.OpentelemetryHostTop99p = all.OpentelemetryHostTop99p + o.Orgs = all.Orgs + o.ProfilingHostTop99p = all.ProfilingHostTop99p + o.RumBrowserAndMobileSessionCount = all.RumBrowserAndMobileSessionCount + o.RumSessionCountSum = all.RumSessionCountSum + o.RumTotalSessionCountSum = all.RumTotalSessionCountSum + o.RumUnitsSum = all.RumUnitsSum + o.SdsLogsScannedBytesSum = all.SdsLogsScannedBytesSum + o.SdsTotalScannedBytesSum = all.SdsTotalScannedBytesSum + o.SyntheticsBrowserCheckCallsCountSum = all.SyntheticsBrowserCheckCallsCountSum + o.SyntheticsCheckCallsCountSum = all.SyntheticsCheckCallsCountSum + o.TraceSearchIndexedEventsCountSum = all.TraceSearchIndexedEventsCountSum + o.TwolIngestedEventsBytesSum = all.TwolIngestedEventsBytesSum + o.VsphereHostTop99p = all.VsphereHostTop99p + return nil +} diff --git a/api/v1/datadog/model_usage_summary_date_org.go b/api/v1/datadog/model_usage_summary_date_org.go new file mode 100644 index 00000000000..593418f3bb9 --- /dev/null +++ b/api/v1/datadog/model_usage_summary_date_org.go @@ -0,0 +1,2598 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageSummaryDateOrg Global hourly report of all data billed by Datadog for a given organization. +type UsageSummaryDateOrg struct { + // Shows the 99th percentile of all agent hosts over all hours in the current date for the given org. + AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` + // Shows the 99th percentile of all Azure app services using APM over all hours in the current date for the given org. + ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` + // Shows the 99th percentile of all distinct APM hosts over all hours in the current date for the given org. + ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` + // Shows the sum of all audit logs lines indexed over all hours in the current date for the given org. + AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` + // The average profiled task count for Fargate Profiling. + AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` + // Shows the 99th percentile of all AWS hosts over all hours in the current date for the given org. + AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` + // Shows the sum of all AWS Lambda invocations over all hours in the current date for the given org. + AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` + // Shows the sum of all AWS Lambda invocations over all hours in the current date for the given org. + AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` + // Shows the 99th percentile of all Azure app services over all hours in the current date for the given org. + AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` + // Shows the sum of all log bytes ingested over all hours in the current date for the given org. + BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` + // Shows the sum of all browser lite sessions over all hours in the current date for the given org. + BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` + // Shows the sum of all browser replay sessions over all hours in the current date for the given org. + BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` + // Shows the sum of all browser RUM units over all hours in the current date for the given org. + BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` + // Shows the sum of all CI pipeline indexed spans over all hours in the current date for the given org. + CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` + // Shows the sum of all CI test indexed spans over all hours in the current date for the given org. + CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current date for the given org. + CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` + // Shows the high-water mark of all CI visibility test committers over all hours in the current date for the given org. + CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` + // Shows the average of all distinct containers over all hours in the current date for the given org. + ContainerAvg *int64 `json:"container_avg,omitempty"` + // Shows the high-water mark of all distinct containers over all hours in the current date for the given org. + ContainerHwm *int64 `json:"container_hwm,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management Azure app services hosts over all hours in the current date for the given org. + CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management Azure hosts over all hours in the current date for the given org. + CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` + // Shows the average number of Cloud Security Posture Management containers over all hours in the current date for the given org. + CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` + // Shows the high-water mark of Cloud Security Posture Management containers over all hours in the current date for the given org. + CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management hosts over all hours in the current date for the given org. + CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` + // Shows the average number of distinct custom metrics over all hours in the current date for the given org. + CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` + // Shows the average of all distinct Cloud Workload Security containers over all hours in the current date for the given org. + CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` + // Shows the 99th percentile of all Cloud Workload Security hosts over all hours in the current date for the given org. + CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` + // Shows the 99th percentile of all Database Monitoring hosts over all hours in the current month for the given org. + DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` + // Shows the average of all distinct Database Monitoring normalized queries over all hours in the current month for the given org. + DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` + // The average task count for Fargate. + FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` + // Shows the high-water mark of all Fargate tasks over all hours in the current date for the given org. + FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` + // Shows the 99th percentile of all GCP hosts over all hours in the current date for the given org. + GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` + // Shows the 99th percentile of all Heroku dynos over all hours in the current date for the given org. + HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` + // The organization id. + Id *string `json:"id,omitempty"` + // Shows the high-water mark of incident management monthly active users over all hours in the current date for the given org. + IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` + // Shows the sum of all log events indexed over all hours in the current date for the given org. + IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` + // Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for the given org. + InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` + // Shows the sum of all log bytes ingested over all hours in the current date for the given org. + IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` + // Shows the sum of all IoT devices over all hours in the current date for the given org. + IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` + // Shows the 99th percentile of all IoT devices over all hours in the current date for the given org. + IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` + // Shows the sum of all mobile lite sessions over all hours in the current date for the given org. + MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for the given org. + MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for the given org. + MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on React Native over all hours in the current date for the given org. + MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions over all hours in the current date for the given org. + MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` + // Shows the sum of all mobile RUM units over all hours in the current date for the given org. + MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` + // The organization name. + Name *string `json:"name,omitempty"` + // Shows the sum of all Network flows indexed over all hours in the current date for the given org. + NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` + // Shows the 99th percentile of all distinct Networks hosts over all hours in the current date for the given org. + NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` + // Sum of all observability pipelines bytes processed over all hours in the current date for the given org. + ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` + // Sum of all online archived events over all hours in the current date for the given org. + OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` + // Shows the 99th percentile of all hosts reported by the Datadog exporter for the OpenTelemetry Collector over all hours in the current date for the given org. + OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` + // Shows the 99th percentile of all profiled hosts over all hours in the current date for the given org. + ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` + // The organization public id. + PublicId *string `json:"public_id,omitempty"` + // Shows the sum of all mobile sessions and all browser lite and legacy sessions over all hours in the current date for the given org. + RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` + // Shows the sum of all browser RUM Lite Sessions over all hours in the current date for the given org. + RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` + // Shows the sum of RUM Sessions (browser and mobile) over all hours in the current date for the given org. + RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` + // Shows the sum of all browser and mobile RUM units over all hours in the current date for the given org. + RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` + // Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for the given org. + SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` + // Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for the given org. + SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` + // Shows the sum of all Synthetic browser tests over all hours in the current date for the given org. + SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` + // Shows the sum of all Synthetic API tests over all hours in the current date for the given org. + SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` + // Shows the sum of all Indexed Spans indexed over all hours in the current date for the given org. + TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` + // Shows the sum of all ingested APM span bytes over all hours in the current date for the given org. + TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` + // Shows the 99th percentile of all vSphere hosts over all hours in the current date for the given org. + VsphereHostTop99p *int64 `json:"vsphere_host_top99p,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{} +} + +// NewUsageSummaryDateOrg instantiates a new UsageSummaryDateOrg 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 NewUsageSummaryDateOrg() *UsageSummaryDateOrg { + this := UsageSummaryDateOrg{} + return &this +} + +// NewUsageSummaryDateOrgWithDefaults instantiates a new UsageSummaryDateOrg 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 NewUsageSummaryDateOrgWithDefaults() *UsageSummaryDateOrg { + this := UsageSummaryDateOrg{} + return &this +} + +// GetAgentHostTop99p returns the AgentHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetAgentHostTop99p() int64 { + if o == nil || o.AgentHostTop99p == nil { + var ret int64 + return ret + } + return *o.AgentHostTop99p +} + +// GetAgentHostTop99pOk returns a tuple with the AgentHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetAgentHostTop99pOk() (*int64, bool) { + if o == nil || o.AgentHostTop99p == nil { + return nil, false + } + return o.AgentHostTop99p, true +} + +// HasAgentHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasAgentHostTop99p() bool { + if o != nil && o.AgentHostTop99p != nil { + return true + } + + return false +} + +// SetAgentHostTop99p gets a reference to the given int64 and assigns it to the AgentHostTop99p field. +func (o *UsageSummaryDateOrg) SetAgentHostTop99p(v int64) { + o.AgentHostTop99p = &v +} + +// GetApmAzureAppServiceHostTop99p returns the ApmAzureAppServiceHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetApmAzureAppServiceHostTop99p() int64 { + if o == nil || o.ApmAzureAppServiceHostTop99p == nil { + var ret int64 + return ret + } + return *o.ApmAzureAppServiceHostTop99p +} + +// GetApmAzureAppServiceHostTop99pOk returns a tuple with the ApmAzureAppServiceHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetApmAzureAppServiceHostTop99pOk() (*int64, bool) { + if o == nil || o.ApmAzureAppServiceHostTop99p == nil { + return nil, false + } + return o.ApmAzureAppServiceHostTop99p, true +} + +// HasApmAzureAppServiceHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasApmAzureAppServiceHostTop99p() bool { + if o != nil && o.ApmAzureAppServiceHostTop99p != nil { + return true + } + + return false +} + +// SetApmAzureAppServiceHostTop99p gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostTop99p field. +func (o *UsageSummaryDateOrg) SetApmAzureAppServiceHostTop99p(v int64) { + o.ApmAzureAppServiceHostTop99p = &v +} + +// GetApmHostTop99p returns the ApmHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetApmHostTop99p() int64 { + if o == nil || o.ApmHostTop99p == nil { + var ret int64 + return ret + } + return *o.ApmHostTop99p +} + +// GetApmHostTop99pOk returns a tuple with the ApmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetApmHostTop99pOk() (*int64, bool) { + if o == nil || o.ApmHostTop99p == nil { + return nil, false + } + return o.ApmHostTop99p, true +} + +// HasApmHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasApmHostTop99p() bool { + if o != nil && o.ApmHostTop99p != nil { + return true + } + + return false +} + +// SetApmHostTop99p gets a reference to the given int64 and assigns it to the ApmHostTop99p field. +func (o *UsageSummaryDateOrg) SetApmHostTop99p(v int64) { + o.ApmHostTop99p = &v +} + +// GetAuditLogsLinesIndexedSum returns the AuditLogsLinesIndexedSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetAuditLogsLinesIndexedSum() int64 { + if o == nil || o.AuditLogsLinesIndexedSum == nil { + var ret int64 + return ret + } + return *o.AuditLogsLinesIndexedSum +} + +// GetAuditLogsLinesIndexedSumOk returns a tuple with the AuditLogsLinesIndexedSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetAuditLogsLinesIndexedSumOk() (*int64, bool) { + if o == nil || o.AuditLogsLinesIndexedSum == nil { + return nil, false + } + return o.AuditLogsLinesIndexedSum, true +} + +// HasAuditLogsLinesIndexedSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasAuditLogsLinesIndexedSum() bool { + if o != nil && o.AuditLogsLinesIndexedSum != nil { + return true + } + + return false +} + +// SetAuditLogsLinesIndexedSum gets a reference to the given int64 and assigns it to the AuditLogsLinesIndexedSum field. +func (o *UsageSummaryDateOrg) SetAuditLogsLinesIndexedSum(v int64) { + o.AuditLogsLinesIndexedSum = &v +} + +// GetAvgProfiledFargateTasks returns the AvgProfiledFargateTasks field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetAvgProfiledFargateTasks() int64 { + if o == nil || o.AvgProfiledFargateTasks == nil { + var ret int64 + return ret + } + return *o.AvgProfiledFargateTasks +} + +// GetAvgProfiledFargateTasksOk returns a tuple with the AvgProfiledFargateTasks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetAvgProfiledFargateTasksOk() (*int64, bool) { + if o == nil || o.AvgProfiledFargateTasks == nil { + return nil, false + } + return o.AvgProfiledFargateTasks, true +} + +// HasAvgProfiledFargateTasks returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasAvgProfiledFargateTasks() bool { + if o != nil && o.AvgProfiledFargateTasks != nil { + return true + } + + return false +} + +// SetAvgProfiledFargateTasks gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasks field. +func (o *UsageSummaryDateOrg) SetAvgProfiledFargateTasks(v int64) { + o.AvgProfiledFargateTasks = &v +} + +// GetAwsHostTop99p returns the AwsHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetAwsHostTop99p() int64 { + if o == nil || o.AwsHostTop99p == nil { + var ret int64 + return ret + } + return *o.AwsHostTop99p +} + +// GetAwsHostTop99pOk returns a tuple with the AwsHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetAwsHostTop99pOk() (*int64, bool) { + if o == nil || o.AwsHostTop99p == nil { + return nil, false + } + return o.AwsHostTop99p, true +} + +// HasAwsHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasAwsHostTop99p() bool { + if o != nil && o.AwsHostTop99p != nil { + return true + } + + return false +} + +// SetAwsHostTop99p gets a reference to the given int64 and assigns it to the AwsHostTop99p field. +func (o *UsageSummaryDateOrg) SetAwsHostTop99p(v int64) { + o.AwsHostTop99p = &v +} + +// GetAwsLambdaFuncCount returns the AwsLambdaFuncCount field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetAwsLambdaFuncCount() int64 { + if o == nil || o.AwsLambdaFuncCount == nil { + var ret int64 + return ret + } + return *o.AwsLambdaFuncCount +} + +// GetAwsLambdaFuncCountOk returns a tuple with the AwsLambdaFuncCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetAwsLambdaFuncCountOk() (*int64, bool) { + if o == nil || o.AwsLambdaFuncCount == nil { + return nil, false + } + return o.AwsLambdaFuncCount, true +} + +// HasAwsLambdaFuncCount returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasAwsLambdaFuncCount() bool { + if o != nil && o.AwsLambdaFuncCount != nil { + return true + } + + return false +} + +// SetAwsLambdaFuncCount gets a reference to the given int64 and assigns it to the AwsLambdaFuncCount field. +func (o *UsageSummaryDateOrg) SetAwsLambdaFuncCount(v int64) { + o.AwsLambdaFuncCount = &v +} + +// GetAwsLambdaInvocationsSum returns the AwsLambdaInvocationsSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetAwsLambdaInvocationsSum() int64 { + if o == nil || o.AwsLambdaInvocationsSum == nil { + var ret int64 + return ret + } + return *o.AwsLambdaInvocationsSum +} + +// GetAwsLambdaInvocationsSumOk returns a tuple with the AwsLambdaInvocationsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetAwsLambdaInvocationsSumOk() (*int64, bool) { + if o == nil || o.AwsLambdaInvocationsSum == nil { + return nil, false + } + return o.AwsLambdaInvocationsSum, true +} + +// HasAwsLambdaInvocationsSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasAwsLambdaInvocationsSum() bool { + if o != nil && o.AwsLambdaInvocationsSum != nil { + return true + } + + return false +} + +// SetAwsLambdaInvocationsSum gets a reference to the given int64 and assigns it to the AwsLambdaInvocationsSum field. +func (o *UsageSummaryDateOrg) SetAwsLambdaInvocationsSum(v int64) { + o.AwsLambdaInvocationsSum = &v +} + +// GetAzureAppServiceTop99p returns the AzureAppServiceTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetAzureAppServiceTop99p() int64 { + if o == nil || o.AzureAppServiceTop99p == nil { + var ret int64 + return ret + } + return *o.AzureAppServiceTop99p +} + +// GetAzureAppServiceTop99pOk returns a tuple with the AzureAppServiceTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetAzureAppServiceTop99pOk() (*int64, bool) { + if o == nil || o.AzureAppServiceTop99p == nil { + return nil, false + } + return o.AzureAppServiceTop99p, true +} + +// HasAzureAppServiceTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasAzureAppServiceTop99p() bool { + if o != nil && o.AzureAppServiceTop99p != nil { + return true + } + + return false +} + +// SetAzureAppServiceTop99p gets a reference to the given int64 and assigns it to the AzureAppServiceTop99p field. +func (o *UsageSummaryDateOrg) SetAzureAppServiceTop99p(v int64) { + o.AzureAppServiceTop99p = &v +} + +// GetBillableIngestedBytesSum returns the BillableIngestedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetBillableIngestedBytesSum() int64 { + if o == nil || o.BillableIngestedBytesSum == nil { + var ret int64 + return ret + } + return *o.BillableIngestedBytesSum +} + +// GetBillableIngestedBytesSumOk returns a tuple with the BillableIngestedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetBillableIngestedBytesSumOk() (*int64, bool) { + if o == nil || o.BillableIngestedBytesSum == nil { + return nil, false + } + return o.BillableIngestedBytesSum, true +} + +// HasBillableIngestedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasBillableIngestedBytesSum() bool { + if o != nil && o.BillableIngestedBytesSum != nil { + return true + } + + return false +} + +// SetBillableIngestedBytesSum gets a reference to the given int64 and assigns it to the BillableIngestedBytesSum field. +func (o *UsageSummaryDateOrg) SetBillableIngestedBytesSum(v int64) { + o.BillableIngestedBytesSum = &v +} + +// GetBrowserRumLiteSessionCountSum returns the BrowserRumLiteSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetBrowserRumLiteSessionCountSum() int64 { + if o == nil || o.BrowserRumLiteSessionCountSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumLiteSessionCountSum +} + +// GetBrowserRumLiteSessionCountSumOk returns a tuple with the BrowserRumLiteSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetBrowserRumLiteSessionCountSumOk() (*int64, bool) { + if o == nil || o.BrowserRumLiteSessionCountSum == nil { + return nil, false + } + return o.BrowserRumLiteSessionCountSum, true +} + +// HasBrowserRumLiteSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasBrowserRumLiteSessionCountSum() bool { + if o != nil && o.BrowserRumLiteSessionCountSum != nil { + return true + } + + return false +} + +// SetBrowserRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumLiteSessionCountSum field. +func (o *UsageSummaryDateOrg) SetBrowserRumLiteSessionCountSum(v int64) { + o.BrowserRumLiteSessionCountSum = &v +} + +// GetBrowserRumReplaySessionCountSum returns the BrowserRumReplaySessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetBrowserRumReplaySessionCountSum() int64 { + if o == nil || o.BrowserRumReplaySessionCountSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumReplaySessionCountSum +} + +// GetBrowserRumReplaySessionCountSumOk returns a tuple with the BrowserRumReplaySessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetBrowserRumReplaySessionCountSumOk() (*int64, bool) { + if o == nil || o.BrowserRumReplaySessionCountSum == nil { + return nil, false + } + return o.BrowserRumReplaySessionCountSum, true +} + +// HasBrowserRumReplaySessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasBrowserRumReplaySessionCountSum() bool { + if o != nil && o.BrowserRumReplaySessionCountSum != nil { + return true + } + + return false +} + +// SetBrowserRumReplaySessionCountSum gets a reference to the given int64 and assigns it to the BrowserRumReplaySessionCountSum field. +func (o *UsageSummaryDateOrg) SetBrowserRumReplaySessionCountSum(v int64) { + o.BrowserRumReplaySessionCountSum = &v +} + +// GetBrowserRumUnitsSum returns the BrowserRumUnitsSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetBrowserRumUnitsSum() int64 { + if o == nil || o.BrowserRumUnitsSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumUnitsSum +} + +// GetBrowserRumUnitsSumOk returns a tuple with the BrowserRumUnitsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetBrowserRumUnitsSumOk() (*int64, bool) { + if o == nil || o.BrowserRumUnitsSum == nil { + return nil, false + } + return o.BrowserRumUnitsSum, true +} + +// HasBrowserRumUnitsSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasBrowserRumUnitsSum() bool { + if o != nil && o.BrowserRumUnitsSum != nil { + return true + } + + return false +} + +// SetBrowserRumUnitsSum gets a reference to the given int64 and assigns it to the BrowserRumUnitsSum field. +func (o *UsageSummaryDateOrg) SetBrowserRumUnitsSum(v int64) { + o.BrowserRumUnitsSum = &v +} + +// GetCiPipelineIndexedSpansSum returns the CiPipelineIndexedSpansSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCiPipelineIndexedSpansSum() int64 { + if o == nil || o.CiPipelineIndexedSpansSum == nil { + var ret int64 + return ret + } + return *o.CiPipelineIndexedSpansSum +} + +// GetCiPipelineIndexedSpansSumOk returns a tuple with the CiPipelineIndexedSpansSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCiPipelineIndexedSpansSumOk() (*int64, bool) { + if o == nil || o.CiPipelineIndexedSpansSum == nil { + return nil, false + } + return o.CiPipelineIndexedSpansSum, true +} + +// HasCiPipelineIndexedSpansSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCiPipelineIndexedSpansSum() bool { + if o != nil && o.CiPipelineIndexedSpansSum != nil { + return true + } + + return false +} + +// SetCiPipelineIndexedSpansSum gets a reference to the given int64 and assigns it to the CiPipelineIndexedSpansSum field. +func (o *UsageSummaryDateOrg) SetCiPipelineIndexedSpansSum(v int64) { + o.CiPipelineIndexedSpansSum = &v +} + +// GetCiTestIndexedSpansSum returns the CiTestIndexedSpansSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCiTestIndexedSpansSum() int64 { + if o == nil || o.CiTestIndexedSpansSum == nil { + var ret int64 + return ret + } + return *o.CiTestIndexedSpansSum +} + +// GetCiTestIndexedSpansSumOk returns a tuple with the CiTestIndexedSpansSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCiTestIndexedSpansSumOk() (*int64, bool) { + if o == nil || o.CiTestIndexedSpansSum == nil { + return nil, false + } + return o.CiTestIndexedSpansSum, true +} + +// HasCiTestIndexedSpansSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCiTestIndexedSpansSum() bool { + if o != nil && o.CiTestIndexedSpansSum != nil { + return true + } + + return false +} + +// SetCiTestIndexedSpansSum gets a reference to the given int64 and assigns it to the CiTestIndexedSpansSum field. +func (o *UsageSummaryDateOrg) SetCiTestIndexedSpansSum(v int64) { + o.CiTestIndexedSpansSum = &v +} + +// GetCiVisibilityPipelineCommittersHwm returns the CiVisibilityPipelineCommittersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCiVisibilityPipelineCommittersHwm() int64 { + if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { + var ret int64 + return ret + } + return *o.CiVisibilityPipelineCommittersHwm +} + +// GetCiVisibilityPipelineCommittersHwmOk returns a tuple with the CiVisibilityPipelineCommittersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCiVisibilityPipelineCommittersHwmOk() (*int64, bool) { + if o == nil || o.CiVisibilityPipelineCommittersHwm == nil { + return nil, false + } + return o.CiVisibilityPipelineCommittersHwm, true +} + +// HasCiVisibilityPipelineCommittersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCiVisibilityPipelineCommittersHwm() bool { + if o != nil && o.CiVisibilityPipelineCommittersHwm != nil { + return true + } + + return false +} + +// SetCiVisibilityPipelineCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityPipelineCommittersHwm field. +func (o *UsageSummaryDateOrg) SetCiVisibilityPipelineCommittersHwm(v int64) { + o.CiVisibilityPipelineCommittersHwm = &v +} + +// GetCiVisibilityTestCommittersHwm returns the CiVisibilityTestCommittersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCiVisibilityTestCommittersHwm() int64 { + if o == nil || o.CiVisibilityTestCommittersHwm == nil { + var ret int64 + return ret + } + return *o.CiVisibilityTestCommittersHwm +} + +// GetCiVisibilityTestCommittersHwmOk returns a tuple with the CiVisibilityTestCommittersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCiVisibilityTestCommittersHwmOk() (*int64, bool) { + if o == nil || o.CiVisibilityTestCommittersHwm == nil { + return nil, false + } + return o.CiVisibilityTestCommittersHwm, true +} + +// HasCiVisibilityTestCommittersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCiVisibilityTestCommittersHwm() bool { + if o != nil && o.CiVisibilityTestCommittersHwm != nil { + return true + } + + return false +} + +// SetCiVisibilityTestCommittersHwm gets a reference to the given int64 and assigns it to the CiVisibilityTestCommittersHwm field. +func (o *UsageSummaryDateOrg) SetCiVisibilityTestCommittersHwm(v int64) { + o.CiVisibilityTestCommittersHwm = &v +} + +// GetContainerAvg returns the ContainerAvg field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetContainerAvg() int64 { + if o == nil || o.ContainerAvg == nil { + var ret int64 + return ret + } + return *o.ContainerAvg +} + +// GetContainerAvgOk returns a tuple with the ContainerAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetContainerAvgOk() (*int64, bool) { + if o == nil || o.ContainerAvg == nil { + return nil, false + } + return o.ContainerAvg, true +} + +// HasContainerAvg returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasContainerAvg() bool { + if o != nil && o.ContainerAvg != nil { + return true + } + + return false +} + +// SetContainerAvg gets a reference to the given int64 and assigns it to the ContainerAvg field. +func (o *UsageSummaryDateOrg) SetContainerAvg(v int64) { + o.ContainerAvg = &v +} + +// GetContainerHwm returns the ContainerHwm field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetContainerHwm() int64 { + if o == nil || o.ContainerHwm == nil { + var ret int64 + return ret + } + return *o.ContainerHwm +} + +// GetContainerHwmOk returns a tuple with the ContainerHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetContainerHwmOk() (*int64, bool) { + if o == nil || o.ContainerHwm == nil { + return nil, false + } + return o.ContainerHwm, true +} + +// HasContainerHwm returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasContainerHwm() bool { + if o != nil && o.ContainerHwm != nil { + return true + } + + return false +} + +// SetContainerHwm gets a reference to the given int64 and assigns it to the ContainerHwm field. +func (o *UsageSummaryDateOrg) SetContainerHwm(v int64) { + o.ContainerHwm = &v +} + +// GetCspmAasHostTop99p returns the CspmAasHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCspmAasHostTop99p() int64 { + if o == nil || o.CspmAasHostTop99p == nil { + var ret int64 + return ret + } + return *o.CspmAasHostTop99p +} + +// GetCspmAasHostTop99pOk returns a tuple with the CspmAasHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCspmAasHostTop99pOk() (*int64, bool) { + if o == nil || o.CspmAasHostTop99p == nil { + return nil, false + } + return o.CspmAasHostTop99p, true +} + +// HasCspmAasHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCspmAasHostTop99p() bool { + if o != nil && o.CspmAasHostTop99p != nil { + return true + } + + return false +} + +// SetCspmAasHostTop99p gets a reference to the given int64 and assigns it to the CspmAasHostTop99p field. +func (o *UsageSummaryDateOrg) SetCspmAasHostTop99p(v int64) { + o.CspmAasHostTop99p = &v +} + +// GetCspmAzureHostTop99p returns the CspmAzureHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCspmAzureHostTop99p() int64 { + if o == nil || o.CspmAzureHostTop99p == nil { + var ret int64 + return ret + } + return *o.CspmAzureHostTop99p +} + +// GetCspmAzureHostTop99pOk returns a tuple with the CspmAzureHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCspmAzureHostTop99pOk() (*int64, bool) { + if o == nil || o.CspmAzureHostTop99p == nil { + return nil, false + } + return o.CspmAzureHostTop99p, true +} + +// HasCspmAzureHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCspmAzureHostTop99p() bool { + if o != nil && o.CspmAzureHostTop99p != nil { + return true + } + + return false +} + +// SetCspmAzureHostTop99p gets a reference to the given int64 and assigns it to the CspmAzureHostTop99p field. +func (o *UsageSummaryDateOrg) SetCspmAzureHostTop99p(v int64) { + o.CspmAzureHostTop99p = &v +} + +// GetCspmContainerAvg returns the CspmContainerAvg field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCspmContainerAvg() int64 { + if o == nil || o.CspmContainerAvg == nil { + var ret int64 + return ret + } + return *o.CspmContainerAvg +} + +// GetCspmContainerAvgOk returns a tuple with the CspmContainerAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCspmContainerAvgOk() (*int64, bool) { + if o == nil || o.CspmContainerAvg == nil { + return nil, false + } + return o.CspmContainerAvg, true +} + +// HasCspmContainerAvg returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCspmContainerAvg() bool { + if o != nil && o.CspmContainerAvg != nil { + return true + } + + return false +} + +// SetCspmContainerAvg gets a reference to the given int64 and assigns it to the CspmContainerAvg field. +func (o *UsageSummaryDateOrg) SetCspmContainerAvg(v int64) { + o.CspmContainerAvg = &v +} + +// GetCspmContainerHwm returns the CspmContainerHwm field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCspmContainerHwm() int64 { + if o == nil || o.CspmContainerHwm == nil { + var ret int64 + return ret + } + return *o.CspmContainerHwm +} + +// GetCspmContainerHwmOk returns a tuple with the CspmContainerHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCspmContainerHwmOk() (*int64, bool) { + if o == nil || o.CspmContainerHwm == nil { + return nil, false + } + return o.CspmContainerHwm, true +} + +// HasCspmContainerHwm returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCspmContainerHwm() bool { + if o != nil && o.CspmContainerHwm != nil { + return true + } + + return false +} + +// SetCspmContainerHwm gets a reference to the given int64 and assigns it to the CspmContainerHwm field. +func (o *UsageSummaryDateOrg) SetCspmContainerHwm(v int64) { + o.CspmContainerHwm = &v +} + +// GetCspmHostTop99p returns the CspmHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCspmHostTop99p() int64 { + if o == nil || o.CspmHostTop99p == nil { + var ret int64 + return ret + } + return *o.CspmHostTop99p +} + +// GetCspmHostTop99pOk returns a tuple with the CspmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCspmHostTop99pOk() (*int64, bool) { + if o == nil || o.CspmHostTop99p == nil { + return nil, false + } + return o.CspmHostTop99p, true +} + +// HasCspmHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCspmHostTop99p() bool { + if o != nil && o.CspmHostTop99p != nil { + return true + } + + return false +} + +// SetCspmHostTop99p gets a reference to the given int64 and assigns it to the CspmHostTop99p field. +func (o *UsageSummaryDateOrg) SetCspmHostTop99p(v int64) { + o.CspmHostTop99p = &v +} + +// GetCustomTsAvg returns the CustomTsAvg field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCustomTsAvg() int64 { + if o == nil || o.CustomTsAvg == nil { + var ret int64 + return ret + } + return *o.CustomTsAvg +} + +// GetCustomTsAvgOk returns a tuple with the CustomTsAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCustomTsAvgOk() (*int64, bool) { + if o == nil || o.CustomTsAvg == nil { + return nil, false + } + return o.CustomTsAvg, true +} + +// HasCustomTsAvg returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCustomTsAvg() bool { + if o != nil && o.CustomTsAvg != nil { + return true + } + + return false +} + +// SetCustomTsAvg gets a reference to the given int64 and assigns it to the CustomTsAvg field. +func (o *UsageSummaryDateOrg) SetCustomTsAvg(v int64) { + o.CustomTsAvg = &v +} + +// GetCwsContainerCountAvg returns the CwsContainerCountAvg field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCwsContainerCountAvg() int64 { + if o == nil || o.CwsContainerCountAvg == nil { + var ret int64 + return ret + } + return *o.CwsContainerCountAvg +} + +// GetCwsContainerCountAvgOk returns a tuple with the CwsContainerCountAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCwsContainerCountAvgOk() (*int64, bool) { + if o == nil || o.CwsContainerCountAvg == nil { + return nil, false + } + return o.CwsContainerCountAvg, true +} + +// HasCwsContainerCountAvg returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCwsContainerCountAvg() bool { + if o != nil && o.CwsContainerCountAvg != nil { + return true + } + + return false +} + +// SetCwsContainerCountAvg gets a reference to the given int64 and assigns it to the CwsContainerCountAvg field. +func (o *UsageSummaryDateOrg) SetCwsContainerCountAvg(v int64) { + o.CwsContainerCountAvg = &v +} + +// GetCwsHostTop99p returns the CwsHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetCwsHostTop99p() int64 { + if o == nil || o.CwsHostTop99p == nil { + var ret int64 + return ret + } + return *o.CwsHostTop99p +} + +// GetCwsHostTop99pOk returns a tuple with the CwsHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetCwsHostTop99pOk() (*int64, bool) { + if o == nil || o.CwsHostTop99p == nil { + return nil, false + } + return o.CwsHostTop99p, true +} + +// HasCwsHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasCwsHostTop99p() bool { + if o != nil && o.CwsHostTop99p != nil { + return true + } + + return false +} + +// SetCwsHostTop99p gets a reference to the given int64 and assigns it to the CwsHostTop99p field. +func (o *UsageSummaryDateOrg) SetCwsHostTop99p(v int64) { + o.CwsHostTop99p = &v +} + +// GetDbmHostTop99pSum returns the DbmHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetDbmHostTop99pSum() int64 { + if o == nil || o.DbmHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.DbmHostTop99pSum +} + +// GetDbmHostTop99pSumOk returns a tuple with the DbmHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetDbmHostTop99pSumOk() (*int64, bool) { + if o == nil || o.DbmHostTop99pSum == nil { + return nil, false + } + return o.DbmHostTop99pSum, true +} + +// HasDbmHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasDbmHostTop99pSum() bool { + if o != nil && o.DbmHostTop99pSum != nil { + return true + } + + return false +} + +// SetDbmHostTop99pSum gets a reference to the given int64 and assigns it to the DbmHostTop99pSum field. +func (o *UsageSummaryDateOrg) SetDbmHostTop99pSum(v int64) { + o.DbmHostTop99pSum = &v +} + +// GetDbmQueriesAvgSum returns the DbmQueriesAvgSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetDbmQueriesAvgSum() int64 { + if o == nil || o.DbmQueriesAvgSum == nil { + var ret int64 + return ret + } + return *o.DbmQueriesAvgSum +} + +// GetDbmQueriesAvgSumOk returns a tuple with the DbmQueriesAvgSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetDbmQueriesAvgSumOk() (*int64, bool) { + if o == nil || o.DbmQueriesAvgSum == nil { + return nil, false + } + return o.DbmQueriesAvgSum, true +} + +// HasDbmQueriesAvgSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasDbmQueriesAvgSum() bool { + if o != nil && o.DbmQueriesAvgSum != nil { + return true + } + + return false +} + +// SetDbmQueriesAvgSum gets a reference to the given int64 and assigns it to the DbmQueriesAvgSum field. +func (o *UsageSummaryDateOrg) SetDbmQueriesAvgSum(v int64) { + o.DbmQueriesAvgSum = &v +} + +// GetFargateTasksCountAvg returns the FargateTasksCountAvg field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetFargateTasksCountAvg() int64 { + if o == nil || o.FargateTasksCountAvg == nil { + var ret int64 + return ret + } + return *o.FargateTasksCountAvg +} + +// GetFargateTasksCountAvgOk returns a tuple with the FargateTasksCountAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetFargateTasksCountAvgOk() (*int64, bool) { + if o == nil || o.FargateTasksCountAvg == nil { + return nil, false + } + return o.FargateTasksCountAvg, true +} + +// HasFargateTasksCountAvg returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasFargateTasksCountAvg() bool { + if o != nil && o.FargateTasksCountAvg != nil { + return true + } + + return false +} + +// SetFargateTasksCountAvg gets a reference to the given int64 and assigns it to the FargateTasksCountAvg field. +func (o *UsageSummaryDateOrg) SetFargateTasksCountAvg(v int64) { + o.FargateTasksCountAvg = &v +} + +// GetFargateTasksCountHwm returns the FargateTasksCountHwm field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetFargateTasksCountHwm() int64 { + if o == nil || o.FargateTasksCountHwm == nil { + var ret int64 + return ret + } + return *o.FargateTasksCountHwm +} + +// GetFargateTasksCountHwmOk returns a tuple with the FargateTasksCountHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetFargateTasksCountHwmOk() (*int64, bool) { + if o == nil || o.FargateTasksCountHwm == nil { + return nil, false + } + return o.FargateTasksCountHwm, true +} + +// HasFargateTasksCountHwm returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasFargateTasksCountHwm() bool { + if o != nil && o.FargateTasksCountHwm != nil { + return true + } + + return false +} + +// SetFargateTasksCountHwm gets a reference to the given int64 and assigns it to the FargateTasksCountHwm field. +func (o *UsageSummaryDateOrg) SetFargateTasksCountHwm(v int64) { + o.FargateTasksCountHwm = &v +} + +// GetGcpHostTop99p returns the GcpHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetGcpHostTop99p() int64 { + if o == nil || o.GcpHostTop99p == nil { + var ret int64 + return ret + } + return *o.GcpHostTop99p +} + +// GetGcpHostTop99pOk returns a tuple with the GcpHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetGcpHostTop99pOk() (*int64, bool) { + if o == nil || o.GcpHostTop99p == nil { + return nil, false + } + return o.GcpHostTop99p, true +} + +// HasGcpHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasGcpHostTop99p() bool { + if o != nil && o.GcpHostTop99p != nil { + return true + } + + return false +} + +// SetGcpHostTop99p gets a reference to the given int64 and assigns it to the GcpHostTop99p field. +func (o *UsageSummaryDateOrg) SetGcpHostTop99p(v int64) { + o.GcpHostTop99p = &v +} + +// GetHerokuHostTop99p returns the HerokuHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetHerokuHostTop99p() int64 { + if o == nil || o.HerokuHostTop99p == nil { + var ret int64 + return ret + } + return *o.HerokuHostTop99p +} + +// GetHerokuHostTop99pOk returns a tuple with the HerokuHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetHerokuHostTop99pOk() (*int64, bool) { + if o == nil || o.HerokuHostTop99p == nil { + return nil, false + } + return o.HerokuHostTop99p, true +} + +// HasHerokuHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasHerokuHostTop99p() bool { + if o != nil && o.HerokuHostTop99p != nil { + return true + } + + return false +} + +// SetHerokuHostTop99p gets a reference to the given int64 and assigns it to the HerokuHostTop99p field. +func (o *UsageSummaryDateOrg) SetHerokuHostTop99p(v int64) { + o.HerokuHostTop99p = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UsageSummaryDateOrg) SetId(v string) { + o.Id = &v +} + +// GetIncidentManagementMonthlyActiveUsersHwm returns the IncidentManagementMonthlyActiveUsersHwm field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetIncidentManagementMonthlyActiveUsersHwm() int64 { + if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { + var ret int64 + return ret + } + return *o.IncidentManagementMonthlyActiveUsersHwm +} + +// GetIncidentManagementMonthlyActiveUsersHwmOk returns a tuple with the IncidentManagementMonthlyActiveUsersHwm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetIncidentManagementMonthlyActiveUsersHwmOk() (*int64, bool) { + if o == nil || o.IncidentManagementMonthlyActiveUsersHwm == nil { + return nil, false + } + return o.IncidentManagementMonthlyActiveUsersHwm, true +} + +// HasIncidentManagementMonthlyActiveUsersHwm returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasIncidentManagementMonthlyActiveUsersHwm() bool { + if o != nil && o.IncidentManagementMonthlyActiveUsersHwm != nil { + return true + } + + return false +} + +// SetIncidentManagementMonthlyActiveUsersHwm gets a reference to the given int64 and assigns it to the IncidentManagementMonthlyActiveUsersHwm field. +func (o *UsageSummaryDateOrg) SetIncidentManagementMonthlyActiveUsersHwm(v int64) { + o.IncidentManagementMonthlyActiveUsersHwm = &v +} + +// GetIndexedEventsCountSum returns the IndexedEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetIndexedEventsCountSum() int64 { + if o == nil || o.IndexedEventsCountSum == nil { + var ret int64 + return ret + } + return *o.IndexedEventsCountSum +} + +// GetIndexedEventsCountSumOk returns a tuple with the IndexedEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetIndexedEventsCountSumOk() (*int64, bool) { + if o == nil || o.IndexedEventsCountSum == nil { + return nil, false + } + return o.IndexedEventsCountSum, true +} + +// HasIndexedEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasIndexedEventsCountSum() bool { + if o != nil && o.IndexedEventsCountSum != nil { + return true + } + + return false +} + +// SetIndexedEventsCountSum gets a reference to the given int64 and assigns it to the IndexedEventsCountSum field. +func (o *UsageSummaryDateOrg) SetIndexedEventsCountSum(v int64) { + o.IndexedEventsCountSum = &v +} + +// GetInfraHostTop99p returns the InfraHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetInfraHostTop99p() int64 { + if o == nil || o.InfraHostTop99p == nil { + var ret int64 + return ret + } + return *o.InfraHostTop99p +} + +// GetInfraHostTop99pOk returns a tuple with the InfraHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetInfraHostTop99pOk() (*int64, bool) { + if o == nil || o.InfraHostTop99p == nil { + return nil, false + } + return o.InfraHostTop99p, true +} + +// HasInfraHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasInfraHostTop99p() bool { + if o != nil && o.InfraHostTop99p != nil { + return true + } + + return false +} + +// SetInfraHostTop99p gets a reference to the given int64 and assigns it to the InfraHostTop99p field. +func (o *UsageSummaryDateOrg) SetInfraHostTop99p(v int64) { + o.InfraHostTop99p = &v +} + +// GetIngestedEventsBytesSum returns the IngestedEventsBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetIngestedEventsBytesSum() int64 { + if o == nil || o.IngestedEventsBytesSum == nil { + var ret int64 + return ret + } + return *o.IngestedEventsBytesSum +} + +// GetIngestedEventsBytesSumOk returns a tuple with the IngestedEventsBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetIngestedEventsBytesSumOk() (*int64, bool) { + if o == nil || o.IngestedEventsBytesSum == nil { + return nil, false + } + return o.IngestedEventsBytesSum, true +} + +// HasIngestedEventsBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasIngestedEventsBytesSum() bool { + if o != nil && o.IngestedEventsBytesSum != nil { + return true + } + + return false +} + +// SetIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the IngestedEventsBytesSum field. +func (o *UsageSummaryDateOrg) SetIngestedEventsBytesSum(v int64) { + o.IngestedEventsBytesSum = &v +} + +// GetIotDeviceAggSum returns the IotDeviceAggSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetIotDeviceAggSum() int64 { + if o == nil || o.IotDeviceAggSum == nil { + var ret int64 + return ret + } + return *o.IotDeviceAggSum +} + +// GetIotDeviceAggSumOk returns a tuple with the IotDeviceAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetIotDeviceAggSumOk() (*int64, bool) { + if o == nil || o.IotDeviceAggSum == nil { + return nil, false + } + return o.IotDeviceAggSum, true +} + +// HasIotDeviceAggSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasIotDeviceAggSum() bool { + if o != nil && o.IotDeviceAggSum != nil { + return true + } + + return false +} + +// SetIotDeviceAggSum gets a reference to the given int64 and assigns it to the IotDeviceAggSum field. +func (o *UsageSummaryDateOrg) SetIotDeviceAggSum(v int64) { + o.IotDeviceAggSum = &v +} + +// GetIotDeviceTop99pSum returns the IotDeviceTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetIotDeviceTop99pSum() int64 { + if o == nil || o.IotDeviceTop99pSum == nil { + var ret int64 + return ret + } + return *o.IotDeviceTop99pSum +} + +// GetIotDeviceTop99pSumOk returns a tuple with the IotDeviceTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetIotDeviceTop99pSumOk() (*int64, bool) { + if o == nil || o.IotDeviceTop99pSum == nil { + return nil, false + } + return o.IotDeviceTop99pSum, true +} + +// HasIotDeviceTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasIotDeviceTop99pSum() bool { + if o != nil && o.IotDeviceTop99pSum != nil { + return true + } + + return false +} + +// SetIotDeviceTop99pSum gets a reference to the given int64 and assigns it to the IotDeviceTop99pSum field. +func (o *UsageSummaryDateOrg) SetIotDeviceTop99pSum(v int64) { + o.IotDeviceTop99pSum = &v +} + +// GetMobileRumLiteSessionCountSum returns the MobileRumLiteSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetMobileRumLiteSessionCountSum() int64 { + if o == nil || o.MobileRumLiteSessionCountSum == nil { + var ret int64 + return ret + } + return *o.MobileRumLiteSessionCountSum +} + +// GetMobileRumLiteSessionCountSumOk returns a tuple with the MobileRumLiteSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetMobileRumLiteSessionCountSumOk() (*int64, bool) { + if o == nil || o.MobileRumLiteSessionCountSum == nil { + return nil, false + } + return o.MobileRumLiteSessionCountSum, true +} + +// HasMobileRumLiteSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasMobileRumLiteSessionCountSum() bool { + if o != nil && o.MobileRumLiteSessionCountSum != nil { + return true + } + + return false +} + +// SetMobileRumLiteSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumLiteSessionCountSum field. +func (o *UsageSummaryDateOrg) SetMobileRumLiteSessionCountSum(v int64) { + o.MobileRumLiteSessionCountSum = &v +} + +// GetMobileRumSessionCountAndroidSum returns the MobileRumSessionCountAndroidSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountAndroidSum() int64 { + if o == nil || o.MobileRumSessionCountAndroidSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountAndroidSum +} + +// GetMobileRumSessionCountAndroidSumOk returns a tuple with the MobileRumSessionCountAndroidSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountAndroidSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountAndroidSum == nil { + return nil, false + } + return o.MobileRumSessionCountAndroidSum, true +} + +// HasMobileRumSessionCountAndroidSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasMobileRumSessionCountAndroidSum() bool { + if o != nil && o.MobileRumSessionCountAndroidSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountAndroidSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAndroidSum field. +func (o *UsageSummaryDateOrg) SetMobileRumSessionCountAndroidSum(v int64) { + o.MobileRumSessionCountAndroidSum = &v +} + +// GetMobileRumSessionCountIosSum returns the MobileRumSessionCountIosSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountIosSum() int64 { + if o == nil || o.MobileRumSessionCountIosSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountIosSum +} + +// GetMobileRumSessionCountIosSumOk returns a tuple with the MobileRumSessionCountIosSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountIosSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountIosSum == nil { + return nil, false + } + return o.MobileRumSessionCountIosSum, true +} + +// HasMobileRumSessionCountIosSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasMobileRumSessionCountIosSum() bool { + if o != nil && o.MobileRumSessionCountIosSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountIosSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountIosSum field. +func (o *UsageSummaryDateOrg) SetMobileRumSessionCountIosSum(v int64) { + o.MobileRumSessionCountIosSum = &v +} + +// GetMobileRumSessionCountReactnativeSum returns the MobileRumSessionCountReactnativeSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountReactnativeSum() int64 { + if o == nil || o.MobileRumSessionCountReactnativeSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountReactnativeSum +} + +// GetMobileRumSessionCountReactnativeSumOk returns a tuple with the MobileRumSessionCountReactnativeSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountReactnativeSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountReactnativeSum == nil { + return nil, false + } + return o.MobileRumSessionCountReactnativeSum, true +} + +// HasMobileRumSessionCountReactnativeSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasMobileRumSessionCountReactnativeSum() bool { + if o != nil && o.MobileRumSessionCountReactnativeSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountReactnativeSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountReactnativeSum field. +func (o *UsageSummaryDateOrg) SetMobileRumSessionCountReactnativeSum(v int64) { + o.MobileRumSessionCountReactnativeSum = &v +} + +// GetMobileRumSessionCountSum returns the MobileRumSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountSum() int64 { + if o == nil || o.MobileRumSessionCountSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountSum +} + +// GetMobileRumSessionCountSumOk returns a tuple with the MobileRumSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetMobileRumSessionCountSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountSum == nil { + return nil, false + } + return o.MobileRumSessionCountSum, true +} + +// HasMobileRumSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasMobileRumSessionCountSum() bool { + if o != nil && o.MobileRumSessionCountSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountSum field. +func (o *UsageSummaryDateOrg) SetMobileRumSessionCountSum(v int64) { + o.MobileRumSessionCountSum = &v +} + +// GetMobileRumUnitsSum returns the MobileRumUnitsSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetMobileRumUnitsSum() int64 { + if o == nil || o.MobileRumUnitsSum == nil { + var ret int64 + return ret + } + return *o.MobileRumUnitsSum +} + +// GetMobileRumUnitsSumOk returns a tuple with the MobileRumUnitsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetMobileRumUnitsSumOk() (*int64, bool) { + if o == nil || o.MobileRumUnitsSum == nil { + return nil, false + } + return o.MobileRumUnitsSum, true +} + +// HasMobileRumUnitsSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasMobileRumUnitsSum() bool { + if o != nil && o.MobileRumUnitsSum != nil { + return true + } + + return false +} + +// SetMobileRumUnitsSum gets a reference to the given int64 and assigns it to the MobileRumUnitsSum field. +func (o *UsageSummaryDateOrg) SetMobileRumUnitsSum(v int64) { + o.MobileRumUnitsSum = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UsageSummaryDateOrg) SetName(v string) { + o.Name = &v +} + +// GetNetflowIndexedEventsCountSum returns the NetflowIndexedEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetNetflowIndexedEventsCountSum() int64 { + if o == nil || o.NetflowIndexedEventsCountSum == nil { + var ret int64 + return ret + } + return *o.NetflowIndexedEventsCountSum +} + +// GetNetflowIndexedEventsCountSumOk returns a tuple with the NetflowIndexedEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetNetflowIndexedEventsCountSumOk() (*int64, bool) { + if o == nil || o.NetflowIndexedEventsCountSum == nil { + return nil, false + } + return o.NetflowIndexedEventsCountSum, true +} + +// HasNetflowIndexedEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasNetflowIndexedEventsCountSum() bool { + if o != nil && o.NetflowIndexedEventsCountSum != nil { + return true + } + + return false +} + +// SetNetflowIndexedEventsCountSum gets a reference to the given int64 and assigns it to the NetflowIndexedEventsCountSum field. +func (o *UsageSummaryDateOrg) SetNetflowIndexedEventsCountSum(v int64) { + o.NetflowIndexedEventsCountSum = &v +} + +// GetNpmHostTop99p returns the NpmHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetNpmHostTop99p() int64 { + if o == nil || o.NpmHostTop99p == nil { + var ret int64 + return ret + } + return *o.NpmHostTop99p +} + +// GetNpmHostTop99pOk returns a tuple with the NpmHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetNpmHostTop99pOk() (*int64, bool) { + if o == nil || o.NpmHostTop99p == nil { + return nil, false + } + return o.NpmHostTop99p, true +} + +// HasNpmHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasNpmHostTop99p() bool { + if o != nil && o.NpmHostTop99p != nil { + return true + } + + return false +} + +// SetNpmHostTop99p gets a reference to the given int64 and assigns it to the NpmHostTop99p field. +func (o *UsageSummaryDateOrg) SetNpmHostTop99p(v int64) { + o.NpmHostTop99p = &v +} + +// GetObservabilityPipelinesBytesProcessedSum returns the ObservabilityPipelinesBytesProcessedSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetObservabilityPipelinesBytesProcessedSum() int64 { + if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { + var ret int64 + return ret + } + return *o.ObservabilityPipelinesBytesProcessedSum +} + +// GetObservabilityPipelinesBytesProcessedSumOk returns a tuple with the ObservabilityPipelinesBytesProcessedSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetObservabilityPipelinesBytesProcessedSumOk() (*int64, bool) { + if o == nil || o.ObservabilityPipelinesBytesProcessedSum == nil { + return nil, false + } + return o.ObservabilityPipelinesBytesProcessedSum, true +} + +// HasObservabilityPipelinesBytesProcessedSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasObservabilityPipelinesBytesProcessedSum() bool { + if o != nil && o.ObservabilityPipelinesBytesProcessedSum != nil { + return true + } + + return false +} + +// SetObservabilityPipelinesBytesProcessedSum gets a reference to the given int64 and assigns it to the ObservabilityPipelinesBytesProcessedSum field. +func (o *UsageSummaryDateOrg) SetObservabilityPipelinesBytesProcessedSum(v int64) { + o.ObservabilityPipelinesBytesProcessedSum = &v +} + +// GetOnlineArchiveEventsCountSum returns the OnlineArchiveEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetOnlineArchiveEventsCountSum() int64 { + if o == nil || o.OnlineArchiveEventsCountSum == nil { + var ret int64 + return ret + } + return *o.OnlineArchiveEventsCountSum +} + +// GetOnlineArchiveEventsCountSumOk returns a tuple with the OnlineArchiveEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetOnlineArchiveEventsCountSumOk() (*int64, bool) { + if o == nil || o.OnlineArchiveEventsCountSum == nil { + return nil, false + } + return o.OnlineArchiveEventsCountSum, true +} + +// HasOnlineArchiveEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasOnlineArchiveEventsCountSum() bool { + if o != nil && o.OnlineArchiveEventsCountSum != nil { + return true + } + + return false +} + +// SetOnlineArchiveEventsCountSum gets a reference to the given int64 and assigns it to the OnlineArchiveEventsCountSum field. +func (o *UsageSummaryDateOrg) SetOnlineArchiveEventsCountSum(v int64) { + o.OnlineArchiveEventsCountSum = &v +} + +// GetOpentelemetryHostTop99p returns the OpentelemetryHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetOpentelemetryHostTop99p() int64 { + if o == nil || o.OpentelemetryHostTop99p == nil { + var ret int64 + return ret + } + return *o.OpentelemetryHostTop99p +} + +// GetOpentelemetryHostTop99pOk returns a tuple with the OpentelemetryHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetOpentelemetryHostTop99pOk() (*int64, bool) { + if o == nil || o.OpentelemetryHostTop99p == nil { + return nil, false + } + return o.OpentelemetryHostTop99p, true +} + +// HasOpentelemetryHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasOpentelemetryHostTop99p() bool { + if o != nil && o.OpentelemetryHostTop99p != nil { + return true + } + + return false +} + +// SetOpentelemetryHostTop99p gets a reference to the given int64 and assigns it to the OpentelemetryHostTop99p field. +func (o *UsageSummaryDateOrg) SetOpentelemetryHostTop99p(v int64) { + o.OpentelemetryHostTop99p = &v +} + +// GetProfilingHostTop99p returns the ProfilingHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetProfilingHostTop99p() int64 { + if o == nil || o.ProfilingHostTop99p == nil { + var ret int64 + return ret + } + return *o.ProfilingHostTop99p +} + +// GetProfilingHostTop99pOk returns a tuple with the ProfilingHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetProfilingHostTop99pOk() (*int64, bool) { + if o == nil || o.ProfilingHostTop99p == nil { + return nil, false + } + return o.ProfilingHostTop99p, true +} + +// HasProfilingHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasProfilingHostTop99p() bool { + if o != nil && o.ProfilingHostTop99p != nil { + return true + } + + return false +} + +// SetProfilingHostTop99p gets a reference to the given int64 and assigns it to the ProfilingHostTop99p field. +func (o *UsageSummaryDateOrg) SetProfilingHostTop99p(v int64) { + o.ProfilingHostTop99p = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageSummaryDateOrg) SetPublicId(v string) { + o.PublicId = &v +} + +// GetRumBrowserAndMobileSessionCount returns the RumBrowserAndMobileSessionCount field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetRumBrowserAndMobileSessionCount() int64 { + if o == nil || o.RumBrowserAndMobileSessionCount == nil { + var ret int64 + return ret + } + return *o.RumBrowserAndMobileSessionCount +} + +// GetRumBrowserAndMobileSessionCountOk returns a tuple with the RumBrowserAndMobileSessionCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetRumBrowserAndMobileSessionCountOk() (*int64, bool) { + if o == nil || o.RumBrowserAndMobileSessionCount == nil { + return nil, false + } + return o.RumBrowserAndMobileSessionCount, true +} + +// HasRumBrowserAndMobileSessionCount returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasRumBrowserAndMobileSessionCount() bool { + if o != nil && o.RumBrowserAndMobileSessionCount != nil { + return true + } + + return false +} + +// SetRumBrowserAndMobileSessionCount gets a reference to the given int64 and assigns it to the RumBrowserAndMobileSessionCount field. +func (o *UsageSummaryDateOrg) SetRumBrowserAndMobileSessionCount(v int64) { + o.RumBrowserAndMobileSessionCount = &v +} + +// GetRumSessionCountSum returns the RumSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetRumSessionCountSum() int64 { + if o == nil || o.RumSessionCountSum == nil { + var ret int64 + return ret + } + return *o.RumSessionCountSum +} + +// GetRumSessionCountSumOk returns a tuple with the RumSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetRumSessionCountSumOk() (*int64, bool) { + if o == nil || o.RumSessionCountSum == nil { + return nil, false + } + return o.RumSessionCountSum, true +} + +// HasRumSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasRumSessionCountSum() bool { + if o != nil && o.RumSessionCountSum != nil { + return true + } + + return false +} + +// SetRumSessionCountSum gets a reference to the given int64 and assigns it to the RumSessionCountSum field. +func (o *UsageSummaryDateOrg) SetRumSessionCountSum(v int64) { + o.RumSessionCountSum = &v +} + +// GetRumTotalSessionCountSum returns the RumTotalSessionCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetRumTotalSessionCountSum() int64 { + if o == nil || o.RumTotalSessionCountSum == nil { + var ret int64 + return ret + } + return *o.RumTotalSessionCountSum +} + +// GetRumTotalSessionCountSumOk returns a tuple with the RumTotalSessionCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetRumTotalSessionCountSumOk() (*int64, bool) { + if o == nil || o.RumTotalSessionCountSum == nil { + return nil, false + } + return o.RumTotalSessionCountSum, true +} + +// HasRumTotalSessionCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasRumTotalSessionCountSum() bool { + if o != nil && o.RumTotalSessionCountSum != nil { + return true + } + + return false +} + +// SetRumTotalSessionCountSum gets a reference to the given int64 and assigns it to the RumTotalSessionCountSum field. +func (o *UsageSummaryDateOrg) SetRumTotalSessionCountSum(v int64) { + o.RumTotalSessionCountSum = &v +} + +// GetRumUnitsSum returns the RumUnitsSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetRumUnitsSum() int64 { + if o == nil || o.RumUnitsSum == nil { + var ret int64 + return ret + } + return *o.RumUnitsSum +} + +// GetRumUnitsSumOk returns a tuple with the RumUnitsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetRumUnitsSumOk() (*int64, bool) { + if o == nil || o.RumUnitsSum == nil { + return nil, false + } + return o.RumUnitsSum, true +} + +// HasRumUnitsSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasRumUnitsSum() bool { + if o != nil && o.RumUnitsSum != nil { + return true + } + + return false +} + +// SetRumUnitsSum gets a reference to the given int64 and assigns it to the RumUnitsSum field. +func (o *UsageSummaryDateOrg) SetRumUnitsSum(v int64) { + o.RumUnitsSum = &v +} + +// GetSdsLogsScannedBytesSum returns the SdsLogsScannedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetSdsLogsScannedBytesSum() int64 { + if o == nil || o.SdsLogsScannedBytesSum == nil { + var ret int64 + return ret + } + return *o.SdsLogsScannedBytesSum +} + +// GetSdsLogsScannedBytesSumOk returns a tuple with the SdsLogsScannedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetSdsLogsScannedBytesSumOk() (*int64, bool) { + if o == nil || o.SdsLogsScannedBytesSum == nil { + return nil, false + } + return o.SdsLogsScannedBytesSum, true +} + +// HasSdsLogsScannedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasSdsLogsScannedBytesSum() bool { + if o != nil && o.SdsLogsScannedBytesSum != nil { + return true + } + + return false +} + +// SetSdsLogsScannedBytesSum gets a reference to the given int64 and assigns it to the SdsLogsScannedBytesSum field. +func (o *UsageSummaryDateOrg) SetSdsLogsScannedBytesSum(v int64) { + o.SdsLogsScannedBytesSum = &v +} + +// GetSdsTotalScannedBytesSum returns the SdsTotalScannedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetSdsTotalScannedBytesSum() int64 { + if o == nil || o.SdsTotalScannedBytesSum == nil { + var ret int64 + return ret + } + return *o.SdsTotalScannedBytesSum +} + +// GetSdsTotalScannedBytesSumOk returns a tuple with the SdsTotalScannedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetSdsTotalScannedBytesSumOk() (*int64, bool) { + if o == nil || o.SdsTotalScannedBytesSum == nil { + return nil, false + } + return o.SdsTotalScannedBytesSum, true +} + +// HasSdsTotalScannedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasSdsTotalScannedBytesSum() bool { + if o != nil && o.SdsTotalScannedBytesSum != nil { + return true + } + + return false +} + +// SetSdsTotalScannedBytesSum gets a reference to the given int64 and assigns it to the SdsTotalScannedBytesSum field. +func (o *UsageSummaryDateOrg) SetSdsTotalScannedBytesSum(v int64) { + o.SdsTotalScannedBytesSum = &v +} + +// GetSyntheticsBrowserCheckCallsCountSum returns the SyntheticsBrowserCheckCallsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetSyntheticsBrowserCheckCallsCountSum() int64 { + if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { + var ret int64 + return ret + } + return *o.SyntheticsBrowserCheckCallsCountSum +} + +// GetSyntheticsBrowserCheckCallsCountSumOk returns a tuple with the SyntheticsBrowserCheckCallsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetSyntheticsBrowserCheckCallsCountSumOk() (*int64, bool) { + if o == nil || o.SyntheticsBrowserCheckCallsCountSum == nil { + return nil, false + } + return o.SyntheticsBrowserCheckCallsCountSum, true +} + +// HasSyntheticsBrowserCheckCallsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasSyntheticsBrowserCheckCallsCountSum() bool { + if o != nil && o.SyntheticsBrowserCheckCallsCountSum != nil { + return true + } + + return false +} + +// SetSyntheticsBrowserCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsBrowserCheckCallsCountSum field. +func (o *UsageSummaryDateOrg) SetSyntheticsBrowserCheckCallsCountSum(v int64) { + o.SyntheticsBrowserCheckCallsCountSum = &v +} + +// GetSyntheticsCheckCallsCountSum returns the SyntheticsCheckCallsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetSyntheticsCheckCallsCountSum() int64 { + if o == nil || o.SyntheticsCheckCallsCountSum == nil { + var ret int64 + return ret + } + return *o.SyntheticsCheckCallsCountSum +} + +// GetSyntheticsCheckCallsCountSumOk returns a tuple with the SyntheticsCheckCallsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetSyntheticsCheckCallsCountSumOk() (*int64, bool) { + if o == nil || o.SyntheticsCheckCallsCountSum == nil { + return nil, false + } + return o.SyntheticsCheckCallsCountSum, true +} + +// HasSyntheticsCheckCallsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasSyntheticsCheckCallsCountSum() bool { + if o != nil && o.SyntheticsCheckCallsCountSum != nil { + return true + } + + return false +} + +// SetSyntheticsCheckCallsCountSum gets a reference to the given int64 and assigns it to the SyntheticsCheckCallsCountSum field. +func (o *UsageSummaryDateOrg) SetSyntheticsCheckCallsCountSum(v int64) { + o.SyntheticsCheckCallsCountSum = &v +} + +// GetTraceSearchIndexedEventsCountSum returns the TraceSearchIndexedEventsCountSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetTraceSearchIndexedEventsCountSum() int64 { + if o == nil || o.TraceSearchIndexedEventsCountSum == nil { + var ret int64 + return ret + } + return *o.TraceSearchIndexedEventsCountSum +} + +// GetTraceSearchIndexedEventsCountSumOk returns a tuple with the TraceSearchIndexedEventsCountSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetTraceSearchIndexedEventsCountSumOk() (*int64, bool) { + if o == nil || o.TraceSearchIndexedEventsCountSum == nil { + return nil, false + } + return o.TraceSearchIndexedEventsCountSum, true +} + +// HasTraceSearchIndexedEventsCountSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasTraceSearchIndexedEventsCountSum() bool { + if o != nil && o.TraceSearchIndexedEventsCountSum != nil { + return true + } + + return false +} + +// SetTraceSearchIndexedEventsCountSum gets a reference to the given int64 and assigns it to the TraceSearchIndexedEventsCountSum field. +func (o *UsageSummaryDateOrg) SetTraceSearchIndexedEventsCountSum(v int64) { + o.TraceSearchIndexedEventsCountSum = &v +} + +// GetTwolIngestedEventsBytesSum returns the TwolIngestedEventsBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetTwolIngestedEventsBytesSum() int64 { + if o == nil || o.TwolIngestedEventsBytesSum == nil { + var ret int64 + return ret + } + return *o.TwolIngestedEventsBytesSum +} + +// GetTwolIngestedEventsBytesSumOk returns a tuple with the TwolIngestedEventsBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetTwolIngestedEventsBytesSumOk() (*int64, bool) { + if o == nil || o.TwolIngestedEventsBytesSum == nil { + return nil, false + } + return o.TwolIngestedEventsBytesSum, true +} + +// HasTwolIngestedEventsBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasTwolIngestedEventsBytesSum() bool { + if o != nil && o.TwolIngestedEventsBytesSum != nil { + return true + } + + return false +} + +// SetTwolIngestedEventsBytesSum gets a reference to the given int64 and assigns it to the TwolIngestedEventsBytesSum field. +func (o *UsageSummaryDateOrg) SetTwolIngestedEventsBytesSum(v int64) { + o.TwolIngestedEventsBytesSum = &v +} + +// GetVsphereHostTop99p returns the VsphereHostTop99p field value if set, zero value otherwise. +func (o *UsageSummaryDateOrg) GetVsphereHostTop99p() int64 { + if o == nil || o.VsphereHostTop99p == nil { + var ret int64 + return ret + } + return *o.VsphereHostTop99p +} + +// GetVsphereHostTop99pOk returns a tuple with the VsphereHostTop99p field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryDateOrg) GetVsphereHostTop99pOk() (*int64, bool) { + if o == nil || o.VsphereHostTop99p == nil { + return nil, false + } + return o.VsphereHostTop99p, true +} + +// HasVsphereHostTop99p returns a boolean if a field has been set. +func (o *UsageSummaryDateOrg) HasVsphereHostTop99p() bool { + if o != nil && o.VsphereHostTop99p != nil { + return true + } + + return false +} + +// SetVsphereHostTop99p gets a reference to the given int64 and assigns it to the VsphereHostTop99p field. +func (o *UsageSummaryDateOrg) SetVsphereHostTop99p(v int64) { + o.VsphereHostTop99p = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSummaryDateOrg) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AgentHostTop99p != nil { + toSerialize["agent_host_top99p"] = o.AgentHostTop99p + } + if o.ApmAzureAppServiceHostTop99p != nil { + toSerialize["apm_azure_app_service_host_top99p"] = o.ApmAzureAppServiceHostTop99p + } + if o.ApmHostTop99p != nil { + toSerialize["apm_host_top99p"] = o.ApmHostTop99p + } + if o.AuditLogsLinesIndexedSum != nil { + toSerialize["audit_logs_lines_indexed_sum"] = o.AuditLogsLinesIndexedSum + } + if o.AvgProfiledFargateTasks != nil { + toSerialize["avg_profiled_fargate_tasks"] = o.AvgProfiledFargateTasks + } + if o.AwsHostTop99p != nil { + toSerialize["aws_host_top99p"] = o.AwsHostTop99p + } + if o.AwsLambdaFuncCount != nil { + toSerialize["aws_lambda_func_count"] = o.AwsLambdaFuncCount + } + if o.AwsLambdaInvocationsSum != nil { + toSerialize["aws_lambda_invocations_sum"] = o.AwsLambdaInvocationsSum + } + if o.AzureAppServiceTop99p != nil { + toSerialize["azure_app_service_top99p"] = o.AzureAppServiceTop99p + } + if o.BillableIngestedBytesSum != nil { + toSerialize["billable_ingested_bytes_sum"] = o.BillableIngestedBytesSum + } + if o.BrowserRumLiteSessionCountSum != nil { + toSerialize["browser_rum_lite_session_count_sum"] = o.BrowserRumLiteSessionCountSum + } + if o.BrowserRumReplaySessionCountSum != nil { + toSerialize["browser_rum_replay_session_count_sum"] = o.BrowserRumReplaySessionCountSum + } + if o.BrowserRumUnitsSum != nil { + toSerialize["browser_rum_units_sum"] = o.BrowserRumUnitsSum + } + if o.CiPipelineIndexedSpansSum != nil { + toSerialize["ci_pipeline_indexed_spans_sum"] = o.CiPipelineIndexedSpansSum + } + if o.CiTestIndexedSpansSum != nil { + toSerialize["ci_test_indexed_spans_sum"] = o.CiTestIndexedSpansSum + } + if o.CiVisibilityPipelineCommittersHwm != nil { + toSerialize["ci_visibility_pipeline_committers_hwm"] = o.CiVisibilityPipelineCommittersHwm + } + if o.CiVisibilityTestCommittersHwm != nil { + toSerialize["ci_visibility_test_committers_hwm"] = o.CiVisibilityTestCommittersHwm + } + if o.ContainerAvg != nil { + toSerialize["container_avg"] = o.ContainerAvg + } + if o.ContainerHwm != nil { + toSerialize["container_hwm"] = o.ContainerHwm + } + if o.CspmAasHostTop99p != nil { + toSerialize["cspm_aas_host_top99p"] = o.CspmAasHostTop99p + } + if o.CspmAzureHostTop99p != nil { + toSerialize["cspm_azure_host_top99p"] = o.CspmAzureHostTop99p + } + if o.CspmContainerAvg != nil { + toSerialize["cspm_container_avg"] = o.CspmContainerAvg + } + if o.CspmContainerHwm != nil { + toSerialize["cspm_container_hwm"] = o.CspmContainerHwm + } + if o.CspmHostTop99p != nil { + toSerialize["cspm_host_top99p"] = o.CspmHostTop99p + } + if o.CustomTsAvg != nil { + toSerialize["custom_ts_avg"] = o.CustomTsAvg + } + if o.CwsContainerCountAvg != nil { + toSerialize["cws_container_count_avg"] = o.CwsContainerCountAvg + } + if o.CwsHostTop99p != nil { + toSerialize["cws_host_top99p"] = o.CwsHostTop99p + } + if o.DbmHostTop99pSum != nil { + toSerialize["dbm_host_top99p_sum"] = o.DbmHostTop99pSum + } + if o.DbmQueriesAvgSum != nil { + toSerialize["dbm_queries_avg_sum"] = o.DbmQueriesAvgSum + } + if o.FargateTasksCountAvg != nil { + toSerialize["fargate_tasks_count_avg"] = o.FargateTasksCountAvg + } + if o.FargateTasksCountHwm != nil { + toSerialize["fargate_tasks_count_hwm"] = o.FargateTasksCountHwm + } + if o.GcpHostTop99p != nil { + toSerialize["gcp_host_top99p"] = o.GcpHostTop99p + } + if o.HerokuHostTop99p != nil { + toSerialize["heroku_host_top99p"] = o.HerokuHostTop99p + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IncidentManagementMonthlyActiveUsersHwm != nil { + toSerialize["incident_management_monthly_active_users_hwm"] = o.IncidentManagementMonthlyActiveUsersHwm + } + if o.IndexedEventsCountSum != nil { + toSerialize["indexed_events_count_sum"] = o.IndexedEventsCountSum + } + if o.InfraHostTop99p != nil { + toSerialize["infra_host_top99p"] = o.InfraHostTop99p + } + if o.IngestedEventsBytesSum != nil { + toSerialize["ingested_events_bytes_sum"] = o.IngestedEventsBytesSum + } + if o.IotDeviceAggSum != nil { + toSerialize["iot_device_agg_sum"] = o.IotDeviceAggSum + } + if o.IotDeviceTop99pSum != nil { + toSerialize["iot_device_top99p_sum"] = o.IotDeviceTop99pSum + } + if o.MobileRumLiteSessionCountSum != nil { + toSerialize["mobile_rum_lite_session_count_sum"] = o.MobileRumLiteSessionCountSum + } + if o.MobileRumSessionCountAndroidSum != nil { + toSerialize["mobile_rum_session_count_android_sum"] = o.MobileRumSessionCountAndroidSum + } + if o.MobileRumSessionCountIosSum != nil { + toSerialize["mobile_rum_session_count_ios_sum"] = o.MobileRumSessionCountIosSum + } + if o.MobileRumSessionCountReactnativeSum != nil { + toSerialize["mobile_rum_session_count_reactnative_sum"] = o.MobileRumSessionCountReactnativeSum + } + if o.MobileRumSessionCountSum != nil { + toSerialize["mobile_rum_session_count_sum"] = o.MobileRumSessionCountSum + } + if o.MobileRumUnitsSum != nil { + toSerialize["mobile_rum_units_sum"] = o.MobileRumUnitsSum + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.NetflowIndexedEventsCountSum != nil { + toSerialize["netflow_indexed_events_count_sum"] = o.NetflowIndexedEventsCountSum + } + if o.NpmHostTop99p != nil { + toSerialize["npm_host_top99p"] = o.NpmHostTop99p + } + if o.ObservabilityPipelinesBytesProcessedSum != nil { + toSerialize["observability_pipelines_bytes_processed_sum"] = o.ObservabilityPipelinesBytesProcessedSum + } + if o.OnlineArchiveEventsCountSum != nil { + toSerialize["online_archive_events_count_sum"] = o.OnlineArchiveEventsCountSum + } + if o.OpentelemetryHostTop99p != nil { + toSerialize["opentelemetry_host_top99p"] = o.OpentelemetryHostTop99p + } + if o.ProfilingHostTop99p != nil { + toSerialize["profiling_host_top99p"] = o.ProfilingHostTop99p + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.RumBrowserAndMobileSessionCount != nil { + toSerialize["rum_browser_and_mobile_session_count"] = o.RumBrowserAndMobileSessionCount + } + if o.RumSessionCountSum != nil { + toSerialize["rum_session_count_sum"] = o.RumSessionCountSum + } + if o.RumTotalSessionCountSum != nil { + toSerialize["rum_total_session_count_sum"] = o.RumTotalSessionCountSum + } + if o.RumUnitsSum != nil { + toSerialize["rum_units_sum"] = o.RumUnitsSum + } + if o.SdsLogsScannedBytesSum != nil { + toSerialize["sds_logs_scanned_bytes_sum"] = o.SdsLogsScannedBytesSum + } + if o.SdsTotalScannedBytesSum != nil { + toSerialize["sds_total_scanned_bytes_sum"] = o.SdsTotalScannedBytesSum + } + if o.SyntheticsBrowserCheckCallsCountSum != nil { + toSerialize["synthetics_browser_check_calls_count_sum"] = o.SyntheticsBrowserCheckCallsCountSum + } + if o.SyntheticsCheckCallsCountSum != nil { + toSerialize["synthetics_check_calls_count_sum"] = o.SyntheticsCheckCallsCountSum + } + if o.TraceSearchIndexedEventsCountSum != nil { + toSerialize["trace_search_indexed_events_count_sum"] = o.TraceSearchIndexedEventsCountSum + } + if o.TwolIngestedEventsBytesSum != nil { + toSerialize["twol_ingested_events_bytes_sum"] = o.TwolIngestedEventsBytesSum + } + if o.VsphereHostTop99p != nil { + toSerialize["vsphere_host_top99p"] = o.VsphereHostTop99p + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AgentHostTop99p *int64 `json:"agent_host_top99p,omitempty"` + ApmAzureAppServiceHostTop99p *int64 `json:"apm_azure_app_service_host_top99p,omitempty"` + ApmHostTop99p *int64 `json:"apm_host_top99p,omitempty"` + AuditLogsLinesIndexedSum *int64 `json:"audit_logs_lines_indexed_sum,omitempty"` + AvgProfiledFargateTasks *int64 `json:"avg_profiled_fargate_tasks,omitempty"` + AwsHostTop99p *int64 `json:"aws_host_top99p,omitempty"` + AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` + AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` + AzureAppServiceTop99p *int64 `json:"azure_app_service_top99p,omitempty"` + BillableIngestedBytesSum *int64 `json:"billable_ingested_bytes_sum,omitempty"` + BrowserRumLiteSessionCountSum *int64 `json:"browser_rum_lite_session_count_sum,omitempty"` + BrowserRumReplaySessionCountSum *int64 `json:"browser_rum_replay_session_count_sum,omitempty"` + BrowserRumUnitsSum *int64 `json:"browser_rum_units_sum,omitempty"` + CiPipelineIndexedSpansSum *int64 `json:"ci_pipeline_indexed_spans_sum,omitempty"` + CiTestIndexedSpansSum *int64 `json:"ci_test_indexed_spans_sum,omitempty"` + CiVisibilityPipelineCommittersHwm *int64 `json:"ci_visibility_pipeline_committers_hwm,omitempty"` + CiVisibilityTestCommittersHwm *int64 `json:"ci_visibility_test_committers_hwm,omitempty"` + ContainerAvg *int64 `json:"container_avg,omitempty"` + ContainerHwm *int64 `json:"container_hwm,omitempty"` + CspmAasHostTop99p *int64 `json:"cspm_aas_host_top99p,omitempty"` + CspmAzureHostTop99p *int64 `json:"cspm_azure_host_top99p,omitempty"` + CspmContainerAvg *int64 `json:"cspm_container_avg,omitempty"` + CspmContainerHwm *int64 `json:"cspm_container_hwm,omitempty"` + CspmHostTop99p *int64 `json:"cspm_host_top99p,omitempty"` + CustomTsAvg *int64 `json:"custom_ts_avg,omitempty"` + CwsContainerCountAvg *int64 `json:"cws_container_count_avg,omitempty"` + CwsHostTop99p *int64 `json:"cws_host_top99p,omitempty"` + DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` + DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` + FargateTasksCountAvg *int64 `json:"fargate_tasks_count_avg,omitempty"` + FargateTasksCountHwm *int64 `json:"fargate_tasks_count_hwm,omitempty"` + GcpHostTop99p *int64 `json:"gcp_host_top99p,omitempty"` + HerokuHostTop99p *int64 `json:"heroku_host_top99p,omitempty"` + Id *string `json:"id,omitempty"` + IncidentManagementMonthlyActiveUsersHwm *int64 `json:"incident_management_monthly_active_users_hwm,omitempty"` + IndexedEventsCountSum *int64 `json:"indexed_events_count_sum,omitempty"` + InfraHostTop99p *int64 `json:"infra_host_top99p,omitempty"` + IngestedEventsBytesSum *int64 `json:"ingested_events_bytes_sum,omitempty"` + IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` + IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` + MobileRumLiteSessionCountSum *int64 `json:"mobile_rum_lite_session_count_sum,omitempty"` + MobileRumSessionCountAndroidSum *int64 `json:"mobile_rum_session_count_android_sum,omitempty"` + MobileRumSessionCountIosSum *int64 `json:"mobile_rum_session_count_ios_sum,omitempty"` + MobileRumSessionCountReactnativeSum *int64 `json:"mobile_rum_session_count_reactnative_sum,omitempty"` + MobileRumSessionCountSum *int64 `json:"mobile_rum_session_count_sum,omitempty"` + MobileRumUnitsSum *int64 `json:"mobile_rum_units_sum,omitempty"` + Name *string `json:"name,omitempty"` + NetflowIndexedEventsCountSum *int64 `json:"netflow_indexed_events_count_sum,omitempty"` + NpmHostTop99p *int64 `json:"npm_host_top99p,omitempty"` + ObservabilityPipelinesBytesProcessedSum *int64 `json:"observability_pipelines_bytes_processed_sum,omitempty"` + OnlineArchiveEventsCountSum *int64 `json:"online_archive_events_count_sum,omitempty"` + OpentelemetryHostTop99p *int64 `json:"opentelemetry_host_top99p,omitempty"` + ProfilingHostTop99p *int64 `json:"profiling_host_top99p,omitempty"` + PublicId *string `json:"public_id,omitempty"` + RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` + RumSessionCountSum *int64 `json:"rum_session_count_sum,omitempty"` + RumTotalSessionCountSum *int64 `json:"rum_total_session_count_sum,omitempty"` + RumUnitsSum *int64 `json:"rum_units_sum,omitempty"` + SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` + SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` + SyntheticsBrowserCheckCallsCountSum *int64 `json:"synthetics_browser_check_calls_count_sum,omitempty"` + SyntheticsCheckCallsCountSum *int64 `json:"synthetics_check_calls_count_sum,omitempty"` + TraceSearchIndexedEventsCountSum *int64 `json:"trace_search_indexed_events_count_sum,omitempty"` + TwolIngestedEventsBytesSum *int64 `json:"twol_ingested_events_bytes_sum,omitempty"` + VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AgentHostTop99p = all.AgentHostTop99p + o.ApmAzureAppServiceHostTop99p = all.ApmAzureAppServiceHostTop99p + o.ApmHostTop99p = all.ApmHostTop99p + o.AuditLogsLinesIndexedSum = all.AuditLogsLinesIndexedSum + o.AvgProfiledFargateTasks = all.AvgProfiledFargateTasks + o.AwsHostTop99p = all.AwsHostTop99p + o.AwsLambdaFuncCount = all.AwsLambdaFuncCount + o.AwsLambdaInvocationsSum = all.AwsLambdaInvocationsSum + o.AzureAppServiceTop99p = all.AzureAppServiceTop99p + o.BillableIngestedBytesSum = all.BillableIngestedBytesSum + o.BrowserRumLiteSessionCountSum = all.BrowserRumLiteSessionCountSum + o.BrowserRumReplaySessionCountSum = all.BrowserRumReplaySessionCountSum + o.BrowserRumUnitsSum = all.BrowserRumUnitsSum + o.CiPipelineIndexedSpansSum = all.CiPipelineIndexedSpansSum + o.CiTestIndexedSpansSum = all.CiTestIndexedSpansSum + o.CiVisibilityPipelineCommittersHwm = all.CiVisibilityPipelineCommittersHwm + o.CiVisibilityTestCommittersHwm = all.CiVisibilityTestCommittersHwm + o.ContainerAvg = all.ContainerAvg + o.ContainerHwm = all.ContainerHwm + o.CspmAasHostTop99p = all.CspmAasHostTop99p + o.CspmAzureHostTop99p = all.CspmAzureHostTop99p + o.CspmContainerAvg = all.CspmContainerAvg + o.CspmContainerHwm = all.CspmContainerHwm + o.CspmHostTop99p = all.CspmHostTop99p + o.CustomTsAvg = all.CustomTsAvg + o.CwsContainerCountAvg = all.CwsContainerCountAvg + o.CwsHostTop99p = all.CwsHostTop99p + o.DbmHostTop99pSum = all.DbmHostTop99pSum + o.DbmQueriesAvgSum = all.DbmQueriesAvgSum + o.FargateTasksCountAvg = all.FargateTasksCountAvg + o.FargateTasksCountHwm = all.FargateTasksCountHwm + o.GcpHostTop99p = all.GcpHostTop99p + o.HerokuHostTop99p = all.HerokuHostTop99p + o.Id = all.Id + o.IncidentManagementMonthlyActiveUsersHwm = all.IncidentManagementMonthlyActiveUsersHwm + o.IndexedEventsCountSum = all.IndexedEventsCountSum + o.InfraHostTop99p = all.InfraHostTop99p + o.IngestedEventsBytesSum = all.IngestedEventsBytesSum + o.IotDeviceAggSum = all.IotDeviceAggSum + o.IotDeviceTop99pSum = all.IotDeviceTop99pSum + o.MobileRumLiteSessionCountSum = all.MobileRumLiteSessionCountSum + o.MobileRumSessionCountAndroidSum = all.MobileRumSessionCountAndroidSum + o.MobileRumSessionCountIosSum = all.MobileRumSessionCountIosSum + o.MobileRumSessionCountReactnativeSum = all.MobileRumSessionCountReactnativeSum + o.MobileRumSessionCountSum = all.MobileRumSessionCountSum + o.MobileRumUnitsSum = all.MobileRumUnitsSum + o.Name = all.Name + o.NetflowIndexedEventsCountSum = all.NetflowIndexedEventsCountSum + o.NpmHostTop99p = all.NpmHostTop99p + o.ObservabilityPipelinesBytesProcessedSum = all.ObservabilityPipelinesBytesProcessedSum + o.OnlineArchiveEventsCountSum = all.OnlineArchiveEventsCountSum + o.OpentelemetryHostTop99p = all.OpentelemetryHostTop99p + o.ProfilingHostTop99p = all.ProfilingHostTop99p + o.PublicId = all.PublicId + o.RumBrowserAndMobileSessionCount = all.RumBrowserAndMobileSessionCount + o.RumSessionCountSum = all.RumSessionCountSum + o.RumTotalSessionCountSum = all.RumTotalSessionCountSum + o.RumUnitsSum = all.RumUnitsSum + o.SdsLogsScannedBytesSum = all.SdsLogsScannedBytesSum + o.SdsTotalScannedBytesSum = all.SdsTotalScannedBytesSum + o.SyntheticsBrowserCheckCallsCountSum = all.SyntheticsBrowserCheckCallsCountSum + o.SyntheticsCheckCallsCountSum = all.SyntheticsCheckCallsCountSum + o.TraceSearchIndexedEventsCountSum = all.TraceSearchIndexedEventsCountSum + o.TwolIngestedEventsBytesSum = all.TwolIngestedEventsBytesSum + o.VsphereHostTop99p = all.VsphereHostTop99p + return nil +} diff --git a/api/v1/datadog/model_usage_summary_response.go b/api/v1/datadog/model_usage_summary_response.go new file mode 100644 index 00000000000..8a784c1513f --- /dev/null +++ b/api/v1/datadog/model_usage_summary_response.go @@ -0,0 +1,2930 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageSummaryResponse Response summarizing all usage aggregated across the months in the request for all organizations, and broken down by month and by organization. +type UsageSummaryResponse struct { + // Shows the 99th percentile of all agent hosts over all hours in the current months for all organizations. + AgentHostTop99pSum *int64 `json:"agent_host_top99p_sum,omitempty"` + // Shows the 99th percentile of all Azure app services using APM over all hours in the current months all organizations. + ApmAzureAppServiceHostTop99pSum *int64 `json:"apm_azure_app_service_host_top99p_sum,omitempty"` + // Shows the 99th percentile of all distinct APM hosts over all hours in the current months for all organizations. + ApmHostTop99pSum *int64 `json:"apm_host_top99p_sum,omitempty"` + // Shows the sum of all audit logs lines indexed over all hours in the current months for all organizations. + AuditLogsLinesIndexedAggSum *int64 `json:"audit_logs_lines_indexed_agg_sum,omitempty"` + // Shows the average of all profiled Fargate tasks over all hours in the current months for all organizations. + AvgProfiledFargateTasksSum *int64 `json:"avg_profiled_fargate_tasks_sum,omitempty"` + // Shows the 99th percentile of all AWS hosts over all hours in the current months for all organizations. + AwsHostTop99pSum *int64 `json:"aws_host_top99p_sum,omitempty"` + // Shows the average of the number of functions that executed 1 or more times each hour in the current months for all organizations. + AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` + // Shows the sum of all AWS Lambda invocations over all hours in the current months for all organizations. + AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` + // Shows the 99th percentile of all Azure app services over all hours in the current months for all organizations. + AzureAppServiceTop99pSum *int64 `json:"azure_app_service_top99p_sum,omitempty"` + // Shows the 99th percentile of all Azure hosts over all hours in the current months for all organizations. + AzureHostTop99pSum *int64 `json:"azure_host_top99p_sum,omitempty"` + // Shows the sum of all log bytes ingested over all hours in the current months for all organizations. + BillableIngestedBytesAggSum *int64 `json:"billable_ingested_bytes_agg_sum,omitempty"` + // Shows the sum of all browser lite sessions over all hours in the current months for all organizations. + BrowserRumLiteSessionCountAggSum *int64 `json:"browser_rum_lite_session_count_agg_sum,omitempty"` + // Shows the sum of all browser replay sessions over all hours in the current months for all organizations. + BrowserRumReplaySessionCountAggSum *int64 `json:"browser_rum_replay_session_count_agg_sum,omitempty"` + // Shows the sum of all browser RUM units over all hours in the current months for all organizations. + BrowserRumUnitsAggSum *int64 `json:"browser_rum_units_agg_sum,omitempty"` + // Shows the sum of all CI pipeline indexed spans over all hours in the current months for all organizations. + CiPipelineIndexedSpansAggSum *int64 `json:"ci_pipeline_indexed_spans_agg_sum,omitempty"` + // Shows the sum of all CI test indexed spans over all hours in the current months for all organizations. + CiTestIndexedSpansAggSum *int64 `json:"ci_test_indexed_spans_agg_sum,omitempty"` + // Shows the high-water mark of all CI visibility pipeline committers over all hours in the current months for all organizations. + CiVisibilityPipelineCommittersHwmSum *int64 `json:"ci_visibility_pipeline_committers_hwm_sum,omitempty"` + // Shows the high-water mark of all CI visibility test committers over all hours in the current months for all organizations. + CiVisibilityTestCommittersHwmSum *int64 `json:"ci_visibility_test_committers_hwm_sum,omitempty"` + // Shows the average of all distinct containers over all hours in the current months for all organizations. + ContainerAvgSum *int64 `json:"container_avg_sum,omitempty"` + // Shows the sum of the high-water marks of all distinct containers over all hours in the current months for all organizations. + ContainerHwmSum *int64 `json:"container_hwm_sum,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management Azure app services hosts over all hours in the current months for all organizations. + CspmAasHostTop99pSum *int64 `json:"cspm_aas_host_top99p_sum,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management Azure hosts over all hours in the current months for all organizations. + CspmAzureHostTop99pSum *int64 `json:"cspm_azure_host_top99p_sum,omitempty"` + // Shows the average number of Cloud Security Posture Management containers over all hours in the current months for all organizations. + CspmContainerAvgSum *int64 `json:"cspm_container_avg_sum,omitempty"` + // Shows the sum of the the high-water marks of Cloud Security Posture Management containers over all hours in the current months for all organizations. + CspmContainerHwmSum *int64 `json:"cspm_container_hwm_sum,omitempty"` + // Shows the 99th percentile of all Cloud Security Posture Management hosts over all hours in the current months for all organizations. + CspmHostTop99pSum *int64 `json:"cspm_host_top99p_sum,omitempty"` + // Shows the average number of distinct custom metrics over all hours in the current months for all organizations. + CustomTsSum *int64 `json:"custom_ts_sum,omitempty"` + // Shows the average of all distinct Cloud Workload Security containers over all hours in the current months for all organizations. + CwsContainersAvgSum *int64 `json:"cws_containers_avg_sum,omitempty"` + // Shows the 99th percentile of all Cloud Workload Security hosts over all hours in the current months for all organizations. + CwsHostTop99pSum *int64 `json:"cws_host_top99p_sum,omitempty"` + // Shows the 99th percentile of all Database Monitoring hosts over all hours in the current month for all organizations. + DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` + // Shows the average of all distinct Database Monitoring Normalized Queries over all hours in the current month for all organizations. + DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` + // Shows the last date of usage in the current months for all organizations. + EndDate *time.Time `json:"end_date,omitempty"` + // Shows the average of all Fargate tasks over all hours in the current months for all organizations. + FargateTasksCountAvgSum *int64 `json:"fargate_tasks_count_avg_sum,omitempty"` + // Shows the sum of the high-water marks of all Fargate tasks over all hours in the current months for all organizations. + FargateTasksCountHwmSum *int64 `json:"fargate_tasks_count_hwm_sum,omitempty"` + // Shows the 99th percentile of all GCP hosts over all hours in the current months for all organizations. + GcpHostTop99pSum *int64 `json:"gcp_host_top99p_sum,omitempty"` + // Shows the 99th percentile of all Heroku dynos over all hours in the current months for all organizations. + HerokuHostTop99pSum *int64 `json:"heroku_host_top99p_sum,omitempty"` + // Shows sum of the the high-water marks of incident management monthly active users in the current months for all organizations. + IncidentManagementMonthlyActiveUsersHwmSum *int64 `json:"incident_management_monthly_active_users_hwm_sum,omitempty"` + // Shows the sum of all log events indexed over all hours in the current months for all organizations. + IndexedEventsCountAggSum *int64 `json:"indexed_events_count_agg_sum,omitempty"` + // Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current months for all organizations. + InfraHostTop99pSum *int64 `json:"infra_host_top99p_sum,omitempty"` + // Shows the sum of all log bytes ingested over all hours in the current months for all organizations. + IngestedEventsBytesAggSum *int64 `json:"ingested_events_bytes_agg_sum,omitempty"` + // Shows the sum of all IoT devices over all hours in the current months for all organizations. + IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` + // Shows the 99th percentile of all IoT devices over all hours in the current months of all organizations. + IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` + // Shows the the most recent hour in the current months for all organizations for which all usages were calculated. + LastUpdated *time.Time `json:"last_updated,omitempty"` + // Shows the sum of all live logs indexed over all hours in the current months for all organizations (data available as of December 1, 2020). + LiveIndexedEventsAggSum *int64 `json:"live_indexed_events_agg_sum,omitempty"` + // Shows the sum of all live logs bytes ingested over all hours in the current months for all organizations (data available as of December 1, 2020). + LiveIngestedBytesAggSum *int64 `json:"live_ingested_bytes_agg_sum,omitempty"` + // Object containing logs usage data broken down by retention period. + LogsByRetention *LogsByRetention `json:"logs_by_retention,omitempty"` + // Shows the sum of all mobile lite sessions over all hours in the current months for all organizations. + MobileRumLiteSessionCountAggSum *int64 `json:"mobile_rum_lite_session_count_agg_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions over all hours in the current months for all organizations. + MobileRumSessionCountAggSum *int64 `json:"mobile_rum_session_count_agg_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on Android over all hours in the current months for all organizations. + MobileRumSessionCountAndroidAggSum *int64 `json:"mobile_rum_session_count_android_agg_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on iOS over all hours in the current months for all organizations. + MobileRumSessionCountIosAggSum *int64 `json:"mobile_rum_session_count_ios_agg_sum,omitempty"` + // Shows the sum of all mobile RUM Sessions on React Native over all hours in the current months for all organizations. + MobileRumSessionCountReactnativeAggSum *int64 `json:"mobile_rum_session_count_reactnative_agg_sum,omitempty"` + // Shows the sum of all mobile RUM units over all hours in the current months for all organizations. + MobileRumUnitsAggSum *int64 `json:"mobile_rum_units_agg_sum,omitempty"` + // Shows the sum of all Network flows indexed over all hours in the current months for all organizations. + NetflowIndexedEventsCountAggSum *int64 `json:"netflow_indexed_events_count_agg_sum,omitempty"` + // Shows the 99th percentile of all distinct Networks hosts over all hours in the current months for all organizations. + NpmHostTop99pSum *int64 `json:"npm_host_top99p_sum,omitempty"` + // Sum of all observability pipelines bytes processed over all hours in the current months for all organizations. + ObservabilityPipelinesBytesProcessedAggSum *int64 `json:"observability_pipelines_bytes_processed_agg_sum,omitempty"` + // Sum of all online archived events over all hours in the current months for all organizations. + OnlineArchiveEventsCountAggSum *int64 `json:"online_archive_events_count_agg_sum,omitempty"` + // Shows the 99th percentile of all hosts reported by the Datadog exporter for the OpenTelemetry Collector over all hours in the current months for all organizations. + OpentelemetryHostTop99pSum *int64 `json:"opentelemetry_host_top99p_sum,omitempty"` + // Shows the average number of profiled containers over all hours in the current months for all organizations. + ProfilingContainerAgentCountAvg *int64 `json:"profiling_container_agent_count_avg,omitempty"` + // Shows the 99th percentile of all profiled hosts over all hours in the current months for all organizations. + ProfilingHostCountTop99pSum *int64 `json:"profiling_host_count_top99p_sum,omitempty"` + // Shows the sum of all rehydrated logs indexed over all hours in the current months for all organizations (data available as of December 1, 2020). + RehydratedIndexedEventsAggSum *int64 `json:"rehydrated_indexed_events_agg_sum,omitempty"` + // Shows the sum of all rehydrated logs bytes ingested over all hours in the current months for all organizations (data available as of December 1, 2020). + RehydratedIngestedBytesAggSum *int64 `json:"rehydrated_ingested_bytes_agg_sum,omitempty"` + // Shows the sum of all mobile sessions and all browser lite and legacy sessions over all hours in the current month for all organizations. + RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` + // Shows the sum of all browser RUM Lite Sessions over all hours in the current months for all organizations. + RumSessionCountAggSum *int64 `json:"rum_session_count_agg_sum,omitempty"` + // Shows the sum of RUM Sessions (browser and mobile) over all hours in the current months for all organizations. + RumTotalSessionCountAggSum *int64 `json:"rum_total_session_count_agg_sum,omitempty"` + // Shows the sum of all browser and mobile RUM units over all hours in the current months for all organizations. + RumUnitsAggSum *int64 `json:"rum_units_agg_sum,omitempty"` + // Shows the sum of all bytes scanned of logs usage by the Sensitive Data Scanner over all hours in the current month for all organizations. + SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` + // Shows the sum of all bytes scanned across all usage types by the Sensitive Data Scanner over all hours in the current month for all organizations. + SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` + // Shows the first date of usage in the current months for all organizations. + StartDate *time.Time `json:"start_date,omitempty"` + // Shows the sum of all Synthetic browser tests over all hours in the current months for all organizations. + SyntheticsBrowserCheckCallsCountAggSum *int64 `json:"synthetics_browser_check_calls_count_agg_sum,omitempty"` + // Shows the sum of all Synthetic API tests over all hours in the current months for all organizations. + SyntheticsCheckCallsCountAggSum *int64 `json:"synthetics_check_calls_count_agg_sum,omitempty"` + // Shows the sum of all Indexed Spans indexed over all hours in the current months for all organizations. + TraceSearchIndexedEventsCountAggSum *int64 `json:"trace_search_indexed_events_count_agg_sum,omitempty"` + // Shows the sum of all ingested APM span bytes over all hours in the current months for all organizations. + TwolIngestedEventsBytesAggSum *int64 `json:"twol_ingested_events_bytes_agg_sum,omitempty"` + // An array of objects regarding hourly usage. + Usage []UsageSummaryDate `json:"usage,omitempty"` + // Shows the 99th percentile of all vSphere hosts over all hours in the current months for all organizations. + VsphereHostTop99pSum *int64 `json:"vsphere_host_top99p_sum,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{} +} + +// NewUsageSummaryResponse instantiates a new UsageSummaryResponse 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 NewUsageSummaryResponse() *UsageSummaryResponse { + this := UsageSummaryResponse{} + return &this +} + +// NewUsageSummaryResponseWithDefaults instantiates a new UsageSummaryResponse 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 NewUsageSummaryResponseWithDefaults() *UsageSummaryResponse { + this := UsageSummaryResponse{} + return &this +} + +// GetAgentHostTop99pSum returns the AgentHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAgentHostTop99pSum() int64 { + if o == nil || o.AgentHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.AgentHostTop99pSum +} + +// GetAgentHostTop99pSumOk returns a tuple with the AgentHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAgentHostTop99pSumOk() (*int64, bool) { + if o == nil || o.AgentHostTop99pSum == nil { + return nil, false + } + return o.AgentHostTop99pSum, true +} + +// HasAgentHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAgentHostTop99pSum() bool { + if o != nil && o.AgentHostTop99pSum != nil { + return true + } + + return false +} + +// SetAgentHostTop99pSum gets a reference to the given int64 and assigns it to the AgentHostTop99pSum field. +func (o *UsageSummaryResponse) SetAgentHostTop99pSum(v int64) { + o.AgentHostTop99pSum = &v +} + +// GetApmAzureAppServiceHostTop99pSum returns the ApmAzureAppServiceHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetApmAzureAppServiceHostTop99pSum() int64 { + if o == nil || o.ApmAzureAppServiceHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.ApmAzureAppServiceHostTop99pSum +} + +// GetApmAzureAppServiceHostTop99pSumOk returns a tuple with the ApmAzureAppServiceHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetApmAzureAppServiceHostTop99pSumOk() (*int64, bool) { + if o == nil || o.ApmAzureAppServiceHostTop99pSum == nil { + return nil, false + } + return o.ApmAzureAppServiceHostTop99pSum, true +} + +// HasApmAzureAppServiceHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasApmAzureAppServiceHostTop99pSum() bool { + if o != nil && o.ApmAzureAppServiceHostTop99pSum != nil { + return true + } + + return false +} + +// SetApmAzureAppServiceHostTop99pSum gets a reference to the given int64 and assigns it to the ApmAzureAppServiceHostTop99pSum field. +func (o *UsageSummaryResponse) SetApmAzureAppServiceHostTop99pSum(v int64) { + o.ApmAzureAppServiceHostTop99pSum = &v +} + +// GetApmHostTop99pSum returns the ApmHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetApmHostTop99pSum() int64 { + if o == nil || o.ApmHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.ApmHostTop99pSum +} + +// GetApmHostTop99pSumOk returns a tuple with the ApmHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetApmHostTop99pSumOk() (*int64, bool) { + if o == nil || o.ApmHostTop99pSum == nil { + return nil, false + } + return o.ApmHostTop99pSum, true +} + +// HasApmHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasApmHostTop99pSum() bool { + if o != nil && o.ApmHostTop99pSum != nil { + return true + } + + return false +} + +// SetApmHostTop99pSum gets a reference to the given int64 and assigns it to the ApmHostTop99pSum field. +func (o *UsageSummaryResponse) SetApmHostTop99pSum(v int64) { + o.ApmHostTop99pSum = &v +} + +// GetAuditLogsLinesIndexedAggSum returns the AuditLogsLinesIndexedAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAuditLogsLinesIndexedAggSum() int64 { + if o == nil || o.AuditLogsLinesIndexedAggSum == nil { + var ret int64 + return ret + } + return *o.AuditLogsLinesIndexedAggSum +} + +// GetAuditLogsLinesIndexedAggSumOk returns a tuple with the AuditLogsLinesIndexedAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAuditLogsLinesIndexedAggSumOk() (*int64, bool) { + if o == nil || o.AuditLogsLinesIndexedAggSum == nil { + return nil, false + } + return o.AuditLogsLinesIndexedAggSum, true +} + +// HasAuditLogsLinesIndexedAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAuditLogsLinesIndexedAggSum() bool { + if o != nil && o.AuditLogsLinesIndexedAggSum != nil { + return true + } + + return false +} + +// SetAuditLogsLinesIndexedAggSum gets a reference to the given int64 and assigns it to the AuditLogsLinesIndexedAggSum field. +func (o *UsageSummaryResponse) SetAuditLogsLinesIndexedAggSum(v int64) { + o.AuditLogsLinesIndexedAggSum = &v +} + +// GetAvgProfiledFargateTasksSum returns the AvgProfiledFargateTasksSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAvgProfiledFargateTasksSum() int64 { + if o == nil || o.AvgProfiledFargateTasksSum == nil { + var ret int64 + return ret + } + return *o.AvgProfiledFargateTasksSum +} + +// GetAvgProfiledFargateTasksSumOk returns a tuple with the AvgProfiledFargateTasksSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAvgProfiledFargateTasksSumOk() (*int64, bool) { + if o == nil || o.AvgProfiledFargateTasksSum == nil { + return nil, false + } + return o.AvgProfiledFargateTasksSum, true +} + +// HasAvgProfiledFargateTasksSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAvgProfiledFargateTasksSum() bool { + if o != nil && o.AvgProfiledFargateTasksSum != nil { + return true + } + + return false +} + +// SetAvgProfiledFargateTasksSum gets a reference to the given int64 and assigns it to the AvgProfiledFargateTasksSum field. +func (o *UsageSummaryResponse) SetAvgProfiledFargateTasksSum(v int64) { + o.AvgProfiledFargateTasksSum = &v +} + +// GetAwsHostTop99pSum returns the AwsHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAwsHostTop99pSum() int64 { + if o == nil || o.AwsHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.AwsHostTop99pSum +} + +// GetAwsHostTop99pSumOk returns a tuple with the AwsHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAwsHostTop99pSumOk() (*int64, bool) { + if o == nil || o.AwsHostTop99pSum == nil { + return nil, false + } + return o.AwsHostTop99pSum, true +} + +// HasAwsHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAwsHostTop99pSum() bool { + if o != nil && o.AwsHostTop99pSum != nil { + return true + } + + return false +} + +// SetAwsHostTop99pSum gets a reference to the given int64 and assigns it to the AwsHostTop99pSum field. +func (o *UsageSummaryResponse) SetAwsHostTop99pSum(v int64) { + o.AwsHostTop99pSum = &v +} + +// GetAwsLambdaFuncCount returns the AwsLambdaFuncCount field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAwsLambdaFuncCount() int64 { + if o == nil || o.AwsLambdaFuncCount == nil { + var ret int64 + return ret + } + return *o.AwsLambdaFuncCount +} + +// GetAwsLambdaFuncCountOk returns a tuple with the AwsLambdaFuncCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAwsLambdaFuncCountOk() (*int64, bool) { + if o == nil || o.AwsLambdaFuncCount == nil { + return nil, false + } + return o.AwsLambdaFuncCount, true +} + +// HasAwsLambdaFuncCount returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAwsLambdaFuncCount() bool { + if o != nil && o.AwsLambdaFuncCount != nil { + return true + } + + return false +} + +// SetAwsLambdaFuncCount gets a reference to the given int64 and assigns it to the AwsLambdaFuncCount field. +func (o *UsageSummaryResponse) SetAwsLambdaFuncCount(v int64) { + o.AwsLambdaFuncCount = &v +} + +// GetAwsLambdaInvocationsSum returns the AwsLambdaInvocationsSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAwsLambdaInvocationsSum() int64 { + if o == nil || o.AwsLambdaInvocationsSum == nil { + var ret int64 + return ret + } + return *o.AwsLambdaInvocationsSum +} + +// GetAwsLambdaInvocationsSumOk returns a tuple with the AwsLambdaInvocationsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAwsLambdaInvocationsSumOk() (*int64, bool) { + if o == nil || o.AwsLambdaInvocationsSum == nil { + return nil, false + } + return o.AwsLambdaInvocationsSum, true +} + +// HasAwsLambdaInvocationsSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAwsLambdaInvocationsSum() bool { + if o != nil && o.AwsLambdaInvocationsSum != nil { + return true + } + + return false +} + +// SetAwsLambdaInvocationsSum gets a reference to the given int64 and assigns it to the AwsLambdaInvocationsSum field. +func (o *UsageSummaryResponse) SetAwsLambdaInvocationsSum(v int64) { + o.AwsLambdaInvocationsSum = &v +} + +// GetAzureAppServiceTop99pSum returns the AzureAppServiceTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAzureAppServiceTop99pSum() int64 { + if o == nil || o.AzureAppServiceTop99pSum == nil { + var ret int64 + return ret + } + return *o.AzureAppServiceTop99pSum +} + +// GetAzureAppServiceTop99pSumOk returns a tuple with the AzureAppServiceTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAzureAppServiceTop99pSumOk() (*int64, bool) { + if o == nil || o.AzureAppServiceTop99pSum == nil { + return nil, false + } + return o.AzureAppServiceTop99pSum, true +} + +// HasAzureAppServiceTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAzureAppServiceTop99pSum() bool { + if o != nil && o.AzureAppServiceTop99pSum != nil { + return true + } + + return false +} + +// SetAzureAppServiceTop99pSum gets a reference to the given int64 and assigns it to the AzureAppServiceTop99pSum field. +func (o *UsageSummaryResponse) SetAzureAppServiceTop99pSum(v int64) { + o.AzureAppServiceTop99pSum = &v +} + +// GetAzureHostTop99pSum returns the AzureHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetAzureHostTop99pSum() int64 { + if o == nil || o.AzureHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.AzureHostTop99pSum +} + +// GetAzureHostTop99pSumOk returns a tuple with the AzureHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetAzureHostTop99pSumOk() (*int64, bool) { + if o == nil || o.AzureHostTop99pSum == nil { + return nil, false + } + return o.AzureHostTop99pSum, true +} + +// HasAzureHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasAzureHostTop99pSum() bool { + if o != nil && o.AzureHostTop99pSum != nil { + return true + } + + return false +} + +// SetAzureHostTop99pSum gets a reference to the given int64 and assigns it to the AzureHostTop99pSum field. +func (o *UsageSummaryResponse) SetAzureHostTop99pSum(v int64) { + o.AzureHostTop99pSum = &v +} + +// GetBillableIngestedBytesAggSum returns the BillableIngestedBytesAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetBillableIngestedBytesAggSum() int64 { + if o == nil || o.BillableIngestedBytesAggSum == nil { + var ret int64 + return ret + } + return *o.BillableIngestedBytesAggSum +} + +// GetBillableIngestedBytesAggSumOk returns a tuple with the BillableIngestedBytesAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetBillableIngestedBytesAggSumOk() (*int64, bool) { + if o == nil || o.BillableIngestedBytesAggSum == nil { + return nil, false + } + return o.BillableIngestedBytesAggSum, true +} + +// HasBillableIngestedBytesAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasBillableIngestedBytesAggSum() bool { + if o != nil && o.BillableIngestedBytesAggSum != nil { + return true + } + + return false +} + +// SetBillableIngestedBytesAggSum gets a reference to the given int64 and assigns it to the BillableIngestedBytesAggSum field. +func (o *UsageSummaryResponse) SetBillableIngestedBytesAggSum(v int64) { + o.BillableIngestedBytesAggSum = &v +} + +// GetBrowserRumLiteSessionCountAggSum returns the BrowserRumLiteSessionCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetBrowserRumLiteSessionCountAggSum() int64 { + if o == nil || o.BrowserRumLiteSessionCountAggSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumLiteSessionCountAggSum +} + +// GetBrowserRumLiteSessionCountAggSumOk returns a tuple with the BrowserRumLiteSessionCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetBrowserRumLiteSessionCountAggSumOk() (*int64, bool) { + if o == nil || o.BrowserRumLiteSessionCountAggSum == nil { + return nil, false + } + return o.BrowserRumLiteSessionCountAggSum, true +} + +// HasBrowserRumLiteSessionCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasBrowserRumLiteSessionCountAggSum() bool { + if o != nil && o.BrowserRumLiteSessionCountAggSum != nil { + return true + } + + return false +} + +// SetBrowserRumLiteSessionCountAggSum gets a reference to the given int64 and assigns it to the BrowserRumLiteSessionCountAggSum field. +func (o *UsageSummaryResponse) SetBrowserRumLiteSessionCountAggSum(v int64) { + o.BrowserRumLiteSessionCountAggSum = &v +} + +// GetBrowserRumReplaySessionCountAggSum returns the BrowserRumReplaySessionCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetBrowserRumReplaySessionCountAggSum() int64 { + if o == nil || o.BrowserRumReplaySessionCountAggSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumReplaySessionCountAggSum +} + +// GetBrowserRumReplaySessionCountAggSumOk returns a tuple with the BrowserRumReplaySessionCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetBrowserRumReplaySessionCountAggSumOk() (*int64, bool) { + if o == nil || o.BrowserRumReplaySessionCountAggSum == nil { + return nil, false + } + return o.BrowserRumReplaySessionCountAggSum, true +} + +// HasBrowserRumReplaySessionCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasBrowserRumReplaySessionCountAggSum() bool { + if o != nil && o.BrowserRumReplaySessionCountAggSum != nil { + return true + } + + return false +} + +// SetBrowserRumReplaySessionCountAggSum gets a reference to the given int64 and assigns it to the BrowserRumReplaySessionCountAggSum field. +func (o *UsageSummaryResponse) SetBrowserRumReplaySessionCountAggSum(v int64) { + o.BrowserRumReplaySessionCountAggSum = &v +} + +// GetBrowserRumUnitsAggSum returns the BrowserRumUnitsAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetBrowserRumUnitsAggSum() int64 { + if o == nil || o.BrowserRumUnitsAggSum == nil { + var ret int64 + return ret + } + return *o.BrowserRumUnitsAggSum +} + +// GetBrowserRumUnitsAggSumOk returns a tuple with the BrowserRumUnitsAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetBrowserRumUnitsAggSumOk() (*int64, bool) { + if o == nil || o.BrowserRumUnitsAggSum == nil { + return nil, false + } + return o.BrowserRumUnitsAggSum, true +} + +// HasBrowserRumUnitsAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasBrowserRumUnitsAggSum() bool { + if o != nil && o.BrowserRumUnitsAggSum != nil { + return true + } + + return false +} + +// SetBrowserRumUnitsAggSum gets a reference to the given int64 and assigns it to the BrowserRumUnitsAggSum field. +func (o *UsageSummaryResponse) SetBrowserRumUnitsAggSum(v int64) { + o.BrowserRumUnitsAggSum = &v +} + +// GetCiPipelineIndexedSpansAggSum returns the CiPipelineIndexedSpansAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCiPipelineIndexedSpansAggSum() int64 { + if o == nil || o.CiPipelineIndexedSpansAggSum == nil { + var ret int64 + return ret + } + return *o.CiPipelineIndexedSpansAggSum +} + +// GetCiPipelineIndexedSpansAggSumOk returns a tuple with the CiPipelineIndexedSpansAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCiPipelineIndexedSpansAggSumOk() (*int64, bool) { + if o == nil || o.CiPipelineIndexedSpansAggSum == nil { + return nil, false + } + return o.CiPipelineIndexedSpansAggSum, true +} + +// HasCiPipelineIndexedSpansAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCiPipelineIndexedSpansAggSum() bool { + if o != nil && o.CiPipelineIndexedSpansAggSum != nil { + return true + } + + return false +} + +// SetCiPipelineIndexedSpansAggSum gets a reference to the given int64 and assigns it to the CiPipelineIndexedSpansAggSum field. +func (o *UsageSummaryResponse) SetCiPipelineIndexedSpansAggSum(v int64) { + o.CiPipelineIndexedSpansAggSum = &v +} + +// GetCiTestIndexedSpansAggSum returns the CiTestIndexedSpansAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCiTestIndexedSpansAggSum() int64 { + if o == nil || o.CiTestIndexedSpansAggSum == nil { + var ret int64 + return ret + } + return *o.CiTestIndexedSpansAggSum +} + +// GetCiTestIndexedSpansAggSumOk returns a tuple with the CiTestIndexedSpansAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCiTestIndexedSpansAggSumOk() (*int64, bool) { + if o == nil || o.CiTestIndexedSpansAggSum == nil { + return nil, false + } + return o.CiTestIndexedSpansAggSum, true +} + +// HasCiTestIndexedSpansAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCiTestIndexedSpansAggSum() bool { + if o != nil && o.CiTestIndexedSpansAggSum != nil { + return true + } + + return false +} + +// SetCiTestIndexedSpansAggSum gets a reference to the given int64 and assigns it to the CiTestIndexedSpansAggSum field. +func (o *UsageSummaryResponse) SetCiTestIndexedSpansAggSum(v int64) { + o.CiTestIndexedSpansAggSum = &v +} + +// GetCiVisibilityPipelineCommittersHwmSum returns the CiVisibilityPipelineCommittersHwmSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCiVisibilityPipelineCommittersHwmSum() int64 { + if o == nil || o.CiVisibilityPipelineCommittersHwmSum == nil { + var ret int64 + return ret + } + return *o.CiVisibilityPipelineCommittersHwmSum +} + +// GetCiVisibilityPipelineCommittersHwmSumOk returns a tuple with the CiVisibilityPipelineCommittersHwmSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCiVisibilityPipelineCommittersHwmSumOk() (*int64, bool) { + if o == nil || o.CiVisibilityPipelineCommittersHwmSum == nil { + return nil, false + } + return o.CiVisibilityPipelineCommittersHwmSum, true +} + +// HasCiVisibilityPipelineCommittersHwmSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCiVisibilityPipelineCommittersHwmSum() bool { + if o != nil && o.CiVisibilityPipelineCommittersHwmSum != nil { + return true + } + + return false +} + +// SetCiVisibilityPipelineCommittersHwmSum gets a reference to the given int64 and assigns it to the CiVisibilityPipelineCommittersHwmSum field. +func (o *UsageSummaryResponse) SetCiVisibilityPipelineCommittersHwmSum(v int64) { + o.CiVisibilityPipelineCommittersHwmSum = &v +} + +// GetCiVisibilityTestCommittersHwmSum returns the CiVisibilityTestCommittersHwmSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCiVisibilityTestCommittersHwmSum() int64 { + if o == nil || o.CiVisibilityTestCommittersHwmSum == nil { + var ret int64 + return ret + } + return *o.CiVisibilityTestCommittersHwmSum +} + +// GetCiVisibilityTestCommittersHwmSumOk returns a tuple with the CiVisibilityTestCommittersHwmSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCiVisibilityTestCommittersHwmSumOk() (*int64, bool) { + if o == nil || o.CiVisibilityTestCommittersHwmSum == nil { + return nil, false + } + return o.CiVisibilityTestCommittersHwmSum, true +} + +// HasCiVisibilityTestCommittersHwmSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCiVisibilityTestCommittersHwmSum() bool { + if o != nil && o.CiVisibilityTestCommittersHwmSum != nil { + return true + } + + return false +} + +// SetCiVisibilityTestCommittersHwmSum gets a reference to the given int64 and assigns it to the CiVisibilityTestCommittersHwmSum field. +func (o *UsageSummaryResponse) SetCiVisibilityTestCommittersHwmSum(v int64) { + o.CiVisibilityTestCommittersHwmSum = &v +} + +// GetContainerAvgSum returns the ContainerAvgSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetContainerAvgSum() int64 { + if o == nil || o.ContainerAvgSum == nil { + var ret int64 + return ret + } + return *o.ContainerAvgSum +} + +// GetContainerAvgSumOk returns a tuple with the ContainerAvgSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetContainerAvgSumOk() (*int64, bool) { + if o == nil || o.ContainerAvgSum == nil { + return nil, false + } + return o.ContainerAvgSum, true +} + +// HasContainerAvgSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasContainerAvgSum() bool { + if o != nil && o.ContainerAvgSum != nil { + return true + } + + return false +} + +// SetContainerAvgSum gets a reference to the given int64 and assigns it to the ContainerAvgSum field. +func (o *UsageSummaryResponse) SetContainerAvgSum(v int64) { + o.ContainerAvgSum = &v +} + +// GetContainerHwmSum returns the ContainerHwmSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetContainerHwmSum() int64 { + if o == nil || o.ContainerHwmSum == nil { + var ret int64 + return ret + } + return *o.ContainerHwmSum +} + +// GetContainerHwmSumOk returns a tuple with the ContainerHwmSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetContainerHwmSumOk() (*int64, bool) { + if o == nil || o.ContainerHwmSum == nil { + return nil, false + } + return o.ContainerHwmSum, true +} + +// HasContainerHwmSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasContainerHwmSum() bool { + if o != nil && o.ContainerHwmSum != nil { + return true + } + + return false +} + +// SetContainerHwmSum gets a reference to the given int64 and assigns it to the ContainerHwmSum field. +func (o *UsageSummaryResponse) SetContainerHwmSum(v int64) { + o.ContainerHwmSum = &v +} + +// GetCspmAasHostTop99pSum returns the CspmAasHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCspmAasHostTop99pSum() int64 { + if o == nil || o.CspmAasHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.CspmAasHostTop99pSum +} + +// GetCspmAasHostTop99pSumOk returns a tuple with the CspmAasHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCspmAasHostTop99pSumOk() (*int64, bool) { + if o == nil || o.CspmAasHostTop99pSum == nil { + return nil, false + } + return o.CspmAasHostTop99pSum, true +} + +// HasCspmAasHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCspmAasHostTop99pSum() bool { + if o != nil && o.CspmAasHostTop99pSum != nil { + return true + } + + return false +} + +// SetCspmAasHostTop99pSum gets a reference to the given int64 and assigns it to the CspmAasHostTop99pSum field. +func (o *UsageSummaryResponse) SetCspmAasHostTop99pSum(v int64) { + o.CspmAasHostTop99pSum = &v +} + +// GetCspmAzureHostTop99pSum returns the CspmAzureHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCspmAzureHostTop99pSum() int64 { + if o == nil || o.CspmAzureHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.CspmAzureHostTop99pSum +} + +// GetCspmAzureHostTop99pSumOk returns a tuple with the CspmAzureHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCspmAzureHostTop99pSumOk() (*int64, bool) { + if o == nil || o.CspmAzureHostTop99pSum == nil { + return nil, false + } + return o.CspmAzureHostTop99pSum, true +} + +// HasCspmAzureHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCspmAzureHostTop99pSum() bool { + if o != nil && o.CspmAzureHostTop99pSum != nil { + return true + } + + return false +} + +// SetCspmAzureHostTop99pSum gets a reference to the given int64 and assigns it to the CspmAzureHostTop99pSum field. +func (o *UsageSummaryResponse) SetCspmAzureHostTop99pSum(v int64) { + o.CspmAzureHostTop99pSum = &v +} + +// GetCspmContainerAvgSum returns the CspmContainerAvgSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCspmContainerAvgSum() int64 { + if o == nil || o.CspmContainerAvgSum == nil { + var ret int64 + return ret + } + return *o.CspmContainerAvgSum +} + +// GetCspmContainerAvgSumOk returns a tuple with the CspmContainerAvgSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCspmContainerAvgSumOk() (*int64, bool) { + if o == nil || o.CspmContainerAvgSum == nil { + return nil, false + } + return o.CspmContainerAvgSum, true +} + +// HasCspmContainerAvgSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCspmContainerAvgSum() bool { + if o != nil && o.CspmContainerAvgSum != nil { + return true + } + + return false +} + +// SetCspmContainerAvgSum gets a reference to the given int64 and assigns it to the CspmContainerAvgSum field. +func (o *UsageSummaryResponse) SetCspmContainerAvgSum(v int64) { + o.CspmContainerAvgSum = &v +} + +// GetCspmContainerHwmSum returns the CspmContainerHwmSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCspmContainerHwmSum() int64 { + if o == nil || o.CspmContainerHwmSum == nil { + var ret int64 + return ret + } + return *o.CspmContainerHwmSum +} + +// GetCspmContainerHwmSumOk returns a tuple with the CspmContainerHwmSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCspmContainerHwmSumOk() (*int64, bool) { + if o == nil || o.CspmContainerHwmSum == nil { + return nil, false + } + return o.CspmContainerHwmSum, true +} + +// HasCspmContainerHwmSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCspmContainerHwmSum() bool { + if o != nil && o.CspmContainerHwmSum != nil { + return true + } + + return false +} + +// SetCspmContainerHwmSum gets a reference to the given int64 and assigns it to the CspmContainerHwmSum field. +func (o *UsageSummaryResponse) SetCspmContainerHwmSum(v int64) { + o.CspmContainerHwmSum = &v +} + +// GetCspmHostTop99pSum returns the CspmHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCspmHostTop99pSum() int64 { + if o == nil || o.CspmHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.CspmHostTop99pSum +} + +// GetCspmHostTop99pSumOk returns a tuple with the CspmHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCspmHostTop99pSumOk() (*int64, bool) { + if o == nil || o.CspmHostTop99pSum == nil { + return nil, false + } + return o.CspmHostTop99pSum, true +} + +// HasCspmHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCspmHostTop99pSum() bool { + if o != nil && o.CspmHostTop99pSum != nil { + return true + } + + return false +} + +// SetCspmHostTop99pSum gets a reference to the given int64 and assigns it to the CspmHostTop99pSum field. +func (o *UsageSummaryResponse) SetCspmHostTop99pSum(v int64) { + o.CspmHostTop99pSum = &v +} + +// GetCustomTsSum returns the CustomTsSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCustomTsSum() int64 { + if o == nil || o.CustomTsSum == nil { + var ret int64 + return ret + } + return *o.CustomTsSum +} + +// GetCustomTsSumOk returns a tuple with the CustomTsSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCustomTsSumOk() (*int64, bool) { + if o == nil || o.CustomTsSum == nil { + return nil, false + } + return o.CustomTsSum, true +} + +// HasCustomTsSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCustomTsSum() bool { + if o != nil && o.CustomTsSum != nil { + return true + } + + return false +} + +// SetCustomTsSum gets a reference to the given int64 and assigns it to the CustomTsSum field. +func (o *UsageSummaryResponse) SetCustomTsSum(v int64) { + o.CustomTsSum = &v +} + +// GetCwsContainersAvgSum returns the CwsContainersAvgSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCwsContainersAvgSum() int64 { + if o == nil || o.CwsContainersAvgSum == nil { + var ret int64 + return ret + } + return *o.CwsContainersAvgSum +} + +// GetCwsContainersAvgSumOk returns a tuple with the CwsContainersAvgSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCwsContainersAvgSumOk() (*int64, bool) { + if o == nil || o.CwsContainersAvgSum == nil { + return nil, false + } + return o.CwsContainersAvgSum, true +} + +// HasCwsContainersAvgSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCwsContainersAvgSum() bool { + if o != nil && o.CwsContainersAvgSum != nil { + return true + } + + return false +} + +// SetCwsContainersAvgSum gets a reference to the given int64 and assigns it to the CwsContainersAvgSum field. +func (o *UsageSummaryResponse) SetCwsContainersAvgSum(v int64) { + o.CwsContainersAvgSum = &v +} + +// GetCwsHostTop99pSum returns the CwsHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetCwsHostTop99pSum() int64 { + if o == nil || o.CwsHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.CwsHostTop99pSum +} + +// GetCwsHostTop99pSumOk returns a tuple with the CwsHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetCwsHostTop99pSumOk() (*int64, bool) { + if o == nil || o.CwsHostTop99pSum == nil { + return nil, false + } + return o.CwsHostTop99pSum, true +} + +// HasCwsHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasCwsHostTop99pSum() bool { + if o != nil && o.CwsHostTop99pSum != nil { + return true + } + + return false +} + +// SetCwsHostTop99pSum gets a reference to the given int64 and assigns it to the CwsHostTop99pSum field. +func (o *UsageSummaryResponse) SetCwsHostTop99pSum(v int64) { + o.CwsHostTop99pSum = &v +} + +// GetDbmHostTop99pSum returns the DbmHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetDbmHostTop99pSum() int64 { + if o == nil || o.DbmHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.DbmHostTop99pSum +} + +// GetDbmHostTop99pSumOk returns a tuple with the DbmHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetDbmHostTop99pSumOk() (*int64, bool) { + if o == nil || o.DbmHostTop99pSum == nil { + return nil, false + } + return o.DbmHostTop99pSum, true +} + +// HasDbmHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasDbmHostTop99pSum() bool { + if o != nil && o.DbmHostTop99pSum != nil { + return true + } + + return false +} + +// SetDbmHostTop99pSum gets a reference to the given int64 and assigns it to the DbmHostTop99pSum field. +func (o *UsageSummaryResponse) SetDbmHostTop99pSum(v int64) { + o.DbmHostTop99pSum = &v +} + +// GetDbmQueriesAvgSum returns the DbmQueriesAvgSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetDbmQueriesAvgSum() int64 { + if o == nil || o.DbmQueriesAvgSum == nil { + var ret int64 + return ret + } + return *o.DbmQueriesAvgSum +} + +// GetDbmQueriesAvgSumOk returns a tuple with the DbmQueriesAvgSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetDbmQueriesAvgSumOk() (*int64, bool) { + if o == nil || o.DbmQueriesAvgSum == nil { + return nil, false + } + return o.DbmQueriesAvgSum, true +} + +// HasDbmQueriesAvgSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasDbmQueriesAvgSum() bool { + if o != nil && o.DbmQueriesAvgSum != nil { + return true + } + + return false +} + +// SetDbmQueriesAvgSum gets a reference to the given int64 and assigns it to the DbmQueriesAvgSum field. +func (o *UsageSummaryResponse) SetDbmQueriesAvgSum(v int64) { + o.DbmQueriesAvgSum = &v +} + +// GetEndDate returns the EndDate field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetEndDate() time.Time { + if o == nil || o.EndDate == nil { + var ret time.Time + return ret + } + return *o.EndDate +} + +// GetEndDateOk returns a tuple with the EndDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetEndDateOk() (*time.Time, bool) { + if o == nil || o.EndDate == nil { + return nil, false + } + return o.EndDate, true +} + +// HasEndDate returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasEndDate() bool { + if o != nil && o.EndDate != nil { + return true + } + + return false +} + +// SetEndDate gets a reference to the given time.Time and assigns it to the EndDate field. +func (o *UsageSummaryResponse) SetEndDate(v time.Time) { + o.EndDate = &v +} + +// GetFargateTasksCountAvgSum returns the FargateTasksCountAvgSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetFargateTasksCountAvgSum() int64 { + if o == nil || o.FargateTasksCountAvgSum == nil { + var ret int64 + return ret + } + return *o.FargateTasksCountAvgSum +} + +// GetFargateTasksCountAvgSumOk returns a tuple with the FargateTasksCountAvgSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetFargateTasksCountAvgSumOk() (*int64, bool) { + if o == nil || o.FargateTasksCountAvgSum == nil { + return nil, false + } + return o.FargateTasksCountAvgSum, true +} + +// HasFargateTasksCountAvgSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasFargateTasksCountAvgSum() bool { + if o != nil && o.FargateTasksCountAvgSum != nil { + return true + } + + return false +} + +// SetFargateTasksCountAvgSum gets a reference to the given int64 and assigns it to the FargateTasksCountAvgSum field. +func (o *UsageSummaryResponse) SetFargateTasksCountAvgSum(v int64) { + o.FargateTasksCountAvgSum = &v +} + +// GetFargateTasksCountHwmSum returns the FargateTasksCountHwmSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetFargateTasksCountHwmSum() int64 { + if o == nil || o.FargateTasksCountHwmSum == nil { + var ret int64 + return ret + } + return *o.FargateTasksCountHwmSum +} + +// GetFargateTasksCountHwmSumOk returns a tuple with the FargateTasksCountHwmSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetFargateTasksCountHwmSumOk() (*int64, bool) { + if o == nil || o.FargateTasksCountHwmSum == nil { + return nil, false + } + return o.FargateTasksCountHwmSum, true +} + +// HasFargateTasksCountHwmSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasFargateTasksCountHwmSum() bool { + if o != nil && o.FargateTasksCountHwmSum != nil { + return true + } + + return false +} + +// SetFargateTasksCountHwmSum gets a reference to the given int64 and assigns it to the FargateTasksCountHwmSum field. +func (o *UsageSummaryResponse) SetFargateTasksCountHwmSum(v int64) { + o.FargateTasksCountHwmSum = &v +} + +// GetGcpHostTop99pSum returns the GcpHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetGcpHostTop99pSum() int64 { + if o == nil || o.GcpHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.GcpHostTop99pSum +} + +// GetGcpHostTop99pSumOk returns a tuple with the GcpHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetGcpHostTop99pSumOk() (*int64, bool) { + if o == nil || o.GcpHostTop99pSum == nil { + return nil, false + } + return o.GcpHostTop99pSum, true +} + +// HasGcpHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasGcpHostTop99pSum() bool { + if o != nil && o.GcpHostTop99pSum != nil { + return true + } + + return false +} + +// SetGcpHostTop99pSum gets a reference to the given int64 and assigns it to the GcpHostTop99pSum field. +func (o *UsageSummaryResponse) SetGcpHostTop99pSum(v int64) { + o.GcpHostTop99pSum = &v +} + +// GetHerokuHostTop99pSum returns the HerokuHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetHerokuHostTop99pSum() int64 { + if o == nil || o.HerokuHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.HerokuHostTop99pSum +} + +// GetHerokuHostTop99pSumOk returns a tuple with the HerokuHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetHerokuHostTop99pSumOk() (*int64, bool) { + if o == nil || o.HerokuHostTop99pSum == nil { + return nil, false + } + return o.HerokuHostTop99pSum, true +} + +// HasHerokuHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasHerokuHostTop99pSum() bool { + if o != nil && o.HerokuHostTop99pSum != nil { + return true + } + + return false +} + +// SetHerokuHostTop99pSum gets a reference to the given int64 and assigns it to the HerokuHostTop99pSum field. +func (o *UsageSummaryResponse) SetHerokuHostTop99pSum(v int64) { + o.HerokuHostTop99pSum = &v +} + +// GetIncidentManagementMonthlyActiveUsersHwmSum returns the IncidentManagementMonthlyActiveUsersHwmSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetIncidentManagementMonthlyActiveUsersHwmSum() int64 { + if o == nil || o.IncidentManagementMonthlyActiveUsersHwmSum == nil { + var ret int64 + return ret + } + return *o.IncidentManagementMonthlyActiveUsersHwmSum +} + +// GetIncidentManagementMonthlyActiveUsersHwmSumOk returns a tuple with the IncidentManagementMonthlyActiveUsersHwmSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetIncidentManagementMonthlyActiveUsersHwmSumOk() (*int64, bool) { + if o == nil || o.IncidentManagementMonthlyActiveUsersHwmSum == nil { + return nil, false + } + return o.IncidentManagementMonthlyActiveUsersHwmSum, true +} + +// HasIncidentManagementMonthlyActiveUsersHwmSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasIncidentManagementMonthlyActiveUsersHwmSum() bool { + if o != nil && o.IncidentManagementMonthlyActiveUsersHwmSum != nil { + return true + } + + return false +} + +// SetIncidentManagementMonthlyActiveUsersHwmSum gets a reference to the given int64 and assigns it to the IncidentManagementMonthlyActiveUsersHwmSum field. +func (o *UsageSummaryResponse) SetIncidentManagementMonthlyActiveUsersHwmSum(v int64) { + o.IncidentManagementMonthlyActiveUsersHwmSum = &v +} + +// GetIndexedEventsCountAggSum returns the IndexedEventsCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetIndexedEventsCountAggSum() int64 { + if o == nil || o.IndexedEventsCountAggSum == nil { + var ret int64 + return ret + } + return *o.IndexedEventsCountAggSum +} + +// GetIndexedEventsCountAggSumOk returns a tuple with the IndexedEventsCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetIndexedEventsCountAggSumOk() (*int64, bool) { + if o == nil || o.IndexedEventsCountAggSum == nil { + return nil, false + } + return o.IndexedEventsCountAggSum, true +} + +// HasIndexedEventsCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasIndexedEventsCountAggSum() bool { + if o != nil && o.IndexedEventsCountAggSum != nil { + return true + } + + return false +} + +// SetIndexedEventsCountAggSum gets a reference to the given int64 and assigns it to the IndexedEventsCountAggSum field. +func (o *UsageSummaryResponse) SetIndexedEventsCountAggSum(v int64) { + o.IndexedEventsCountAggSum = &v +} + +// GetInfraHostTop99pSum returns the InfraHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetInfraHostTop99pSum() int64 { + if o == nil || o.InfraHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.InfraHostTop99pSum +} + +// GetInfraHostTop99pSumOk returns a tuple with the InfraHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetInfraHostTop99pSumOk() (*int64, bool) { + if o == nil || o.InfraHostTop99pSum == nil { + return nil, false + } + return o.InfraHostTop99pSum, true +} + +// HasInfraHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasInfraHostTop99pSum() bool { + if o != nil && o.InfraHostTop99pSum != nil { + return true + } + + return false +} + +// SetInfraHostTop99pSum gets a reference to the given int64 and assigns it to the InfraHostTop99pSum field. +func (o *UsageSummaryResponse) SetInfraHostTop99pSum(v int64) { + o.InfraHostTop99pSum = &v +} + +// GetIngestedEventsBytesAggSum returns the IngestedEventsBytesAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetIngestedEventsBytesAggSum() int64 { + if o == nil || o.IngestedEventsBytesAggSum == nil { + var ret int64 + return ret + } + return *o.IngestedEventsBytesAggSum +} + +// GetIngestedEventsBytesAggSumOk returns a tuple with the IngestedEventsBytesAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetIngestedEventsBytesAggSumOk() (*int64, bool) { + if o == nil || o.IngestedEventsBytesAggSum == nil { + return nil, false + } + return o.IngestedEventsBytesAggSum, true +} + +// HasIngestedEventsBytesAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasIngestedEventsBytesAggSum() bool { + if o != nil && o.IngestedEventsBytesAggSum != nil { + return true + } + + return false +} + +// SetIngestedEventsBytesAggSum gets a reference to the given int64 and assigns it to the IngestedEventsBytesAggSum field. +func (o *UsageSummaryResponse) SetIngestedEventsBytesAggSum(v int64) { + o.IngestedEventsBytesAggSum = &v +} + +// GetIotDeviceAggSum returns the IotDeviceAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetIotDeviceAggSum() int64 { + if o == nil || o.IotDeviceAggSum == nil { + var ret int64 + return ret + } + return *o.IotDeviceAggSum +} + +// GetIotDeviceAggSumOk returns a tuple with the IotDeviceAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetIotDeviceAggSumOk() (*int64, bool) { + if o == nil || o.IotDeviceAggSum == nil { + return nil, false + } + return o.IotDeviceAggSum, true +} + +// HasIotDeviceAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasIotDeviceAggSum() bool { + if o != nil && o.IotDeviceAggSum != nil { + return true + } + + return false +} + +// SetIotDeviceAggSum gets a reference to the given int64 and assigns it to the IotDeviceAggSum field. +func (o *UsageSummaryResponse) SetIotDeviceAggSum(v int64) { + o.IotDeviceAggSum = &v +} + +// GetIotDeviceTop99pSum returns the IotDeviceTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetIotDeviceTop99pSum() int64 { + if o == nil || o.IotDeviceTop99pSum == nil { + var ret int64 + return ret + } + return *o.IotDeviceTop99pSum +} + +// GetIotDeviceTop99pSumOk returns a tuple with the IotDeviceTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetIotDeviceTop99pSumOk() (*int64, bool) { + if o == nil || o.IotDeviceTop99pSum == nil { + return nil, false + } + return o.IotDeviceTop99pSum, true +} + +// HasIotDeviceTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasIotDeviceTop99pSum() bool { + if o != nil && o.IotDeviceTop99pSum != nil { + return true + } + + return false +} + +// SetIotDeviceTop99pSum gets a reference to the given int64 and assigns it to the IotDeviceTop99pSum field. +func (o *UsageSummaryResponse) SetIotDeviceTop99pSum(v int64) { + o.IotDeviceTop99pSum = &v +} + +// GetLastUpdated returns the LastUpdated field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetLastUpdated() time.Time { + if o == nil || o.LastUpdated == nil { + var ret time.Time + return ret + } + return *o.LastUpdated +} + +// GetLastUpdatedOk returns a tuple with the LastUpdated field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetLastUpdatedOk() (*time.Time, bool) { + if o == nil || o.LastUpdated == nil { + return nil, false + } + return o.LastUpdated, true +} + +// HasLastUpdated returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasLastUpdated() bool { + if o != nil && o.LastUpdated != nil { + return true + } + + return false +} + +// SetLastUpdated gets a reference to the given time.Time and assigns it to the LastUpdated field. +func (o *UsageSummaryResponse) SetLastUpdated(v time.Time) { + o.LastUpdated = &v +} + +// GetLiveIndexedEventsAggSum returns the LiveIndexedEventsAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetLiveIndexedEventsAggSum() int64 { + if o == nil || o.LiveIndexedEventsAggSum == nil { + var ret int64 + return ret + } + return *o.LiveIndexedEventsAggSum +} + +// GetLiveIndexedEventsAggSumOk returns a tuple with the LiveIndexedEventsAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetLiveIndexedEventsAggSumOk() (*int64, bool) { + if o == nil || o.LiveIndexedEventsAggSum == nil { + return nil, false + } + return o.LiveIndexedEventsAggSum, true +} + +// HasLiveIndexedEventsAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasLiveIndexedEventsAggSum() bool { + if o != nil && o.LiveIndexedEventsAggSum != nil { + return true + } + + return false +} + +// SetLiveIndexedEventsAggSum gets a reference to the given int64 and assigns it to the LiveIndexedEventsAggSum field. +func (o *UsageSummaryResponse) SetLiveIndexedEventsAggSum(v int64) { + o.LiveIndexedEventsAggSum = &v +} + +// GetLiveIngestedBytesAggSum returns the LiveIngestedBytesAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetLiveIngestedBytesAggSum() int64 { + if o == nil || o.LiveIngestedBytesAggSum == nil { + var ret int64 + return ret + } + return *o.LiveIngestedBytesAggSum +} + +// GetLiveIngestedBytesAggSumOk returns a tuple with the LiveIngestedBytesAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetLiveIngestedBytesAggSumOk() (*int64, bool) { + if o == nil || o.LiveIngestedBytesAggSum == nil { + return nil, false + } + return o.LiveIngestedBytesAggSum, true +} + +// HasLiveIngestedBytesAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasLiveIngestedBytesAggSum() bool { + if o != nil && o.LiveIngestedBytesAggSum != nil { + return true + } + + return false +} + +// SetLiveIngestedBytesAggSum gets a reference to the given int64 and assigns it to the LiveIngestedBytesAggSum field. +func (o *UsageSummaryResponse) SetLiveIngestedBytesAggSum(v int64) { + o.LiveIngestedBytesAggSum = &v +} + +// GetLogsByRetention returns the LogsByRetention field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetLogsByRetention() LogsByRetention { + if o == nil || o.LogsByRetention == nil { + var ret LogsByRetention + return ret + } + return *o.LogsByRetention +} + +// GetLogsByRetentionOk returns a tuple with the LogsByRetention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetLogsByRetentionOk() (*LogsByRetention, bool) { + if o == nil || o.LogsByRetention == nil { + return nil, false + } + return o.LogsByRetention, true +} + +// HasLogsByRetention returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasLogsByRetention() bool { + if o != nil && o.LogsByRetention != nil { + return true + } + + return false +} + +// SetLogsByRetention gets a reference to the given LogsByRetention and assigns it to the LogsByRetention field. +func (o *UsageSummaryResponse) SetLogsByRetention(v LogsByRetention) { + o.LogsByRetention = &v +} + +// GetMobileRumLiteSessionCountAggSum returns the MobileRumLiteSessionCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetMobileRumLiteSessionCountAggSum() int64 { + if o == nil || o.MobileRumLiteSessionCountAggSum == nil { + var ret int64 + return ret + } + return *o.MobileRumLiteSessionCountAggSum +} + +// GetMobileRumLiteSessionCountAggSumOk returns a tuple with the MobileRumLiteSessionCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetMobileRumLiteSessionCountAggSumOk() (*int64, bool) { + if o == nil || o.MobileRumLiteSessionCountAggSum == nil { + return nil, false + } + return o.MobileRumLiteSessionCountAggSum, true +} + +// HasMobileRumLiteSessionCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasMobileRumLiteSessionCountAggSum() bool { + if o != nil && o.MobileRumLiteSessionCountAggSum != nil { + return true + } + + return false +} + +// SetMobileRumLiteSessionCountAggSum gets a reference to the given int64 and assigns it to the MobileRumLiteSessionCountAggSum field. +func (o *UsageSummaryResponse) SetMobileRumLiteSessionCountAggSum(v int64) { + o.MobileRumLiteSessionCountAggSum = &v +} + +// GetMobileRumSessionCountAggSum returns the MobileRumSessionCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetMobileRumSessionCountAggSum() int64 { + if o == nil || o.MobileRumSessionCountAggSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountAggSum +} + +// GetMobileRumSessionCountAggSumOk returns a tuple with the MobileRumSessionCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetMobileRumSessionCountAggSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountAggSum == nil { + return nil, false + } + return o.MobileRumSessionCountAggSum, true +} + +// HasMobileRumSessionCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasMobileRumSessionCountAggSum() bool { + if o != nil && o.MobileRumSessionCountAggSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAggSum field. +func (o *UsageSummaryResponse) SetMobileRumSessionCountAggSum(v int64) { + o.MobileRumSessionCountAggSum = &v +} + +// GetMobileRumSessionCountAndroidAggSum returns the MobileRumSessionCountAndroidAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetMobileRumSessionCountAndroidAggSum() int64 { + if o == nil || o.MobileRumSessionCountAndroidAggSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountAndroidAggSum +} + +// GetMobileRumSessionCountAndroidAggSumOk returns a tuple with the MobileRumSessionCountAndroidAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetMobileRumSessionCountAndroidAggSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountAndroidAggSum == nil { + return nil, false + } + return o.MobileRumSessionCountAndroidAggSum, true +} + +// HasMobileRumSessionCountAndroidAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasMobileRumSessionCountAndroidAggSum() bool { + if o != nil && o.MobileRumSessionCountAndroidAggSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountAndroidAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountAndroidAggSum field. +func (o *UsageSummaryResponse) SetMobileRumSessionCountAndroidAggSum(v int64) { + o.MobileRumSessionCountAndroidAggSum = &v +} + +// GetMobileRumSessionCountIosAggSum returns the MobileRumSessionCountIosAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetMobileRumSessionCountIosAggSum() int64 { + if o == nil || o.MobileRumSessionCountIosAggSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountIosAggSum +} + +// GetMobileRumSessionCountIosAggSumOk returns a tuple with the MobileRumSessionCountIosAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetMobileRumSessionCountIosAggSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountIosAggSum == nil { + return nil, false + } + return o.MobileRumSessionCountIosAggSum, true +} + +// HasMobileRumSessionCountIosAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasMobileRumSessionCountIosAggSum() bool { + if o != nil && o.MobileRumSessionCountIosAggSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountIosAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountIosAggSum field. +func (o *UsageSummaryResponse) SetMobileRumSessionCountIosAggSum(v int64) { + o.MobileRumSessionCountIosAggSum = &v +} + +// GetMobileRumSessionCountReactnativeAggSum returns the MobileRumSessionCountReactnativeAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetMobileRumSessionCountReactnativeAggSum() int64 { + if o == nil || o.MobileRumSessionCountReactnativeAggSum == nil { + var ret int64 + return ret + } + return *o.MobileRumSessionCountReactnativeAggSum +} + +// GetMobileRumSessionCountReactnativeAggSumOk returns a tuple with the MobileRumSessionCountReactnativeAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetMobileRumSessionCountReactnativeAggSumOk() (*int64, bool) { + if o == nil || o.MobileRumSessionCountReactnativeAggSum == nil { + return nil, false + } + return o.MobileRumSessionCountReactnativeAggSum, true +} + +// HasMobileRumSessionCountReactnativeAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasMobileRumSessionCountReactnativeAggSum() bool { + if o != nil && o.MobileRumSessionCountReactnativeAggSum != nil { + return true + } + + return false +} + +// SetMobileRumSessionCountReactnativeAggSum gets a reference to the given int64 and assigns it to the MobileRumSessionCountReactnativeAggSum field. +func (o *UsageSummaryResponse) SetMobileRumSessionCountReactnativeAggSum(v int64) { + o.MobileRumSessionCountReactnativeAggSum = &v +} + +// GetMobileRumUnitsAggSum returns the MobileRumUnitsAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetMobileRumUnitsAggSum() int64 { + if o == nil || o.MobileRumUnitsAggSum == nil { + var ret int64 + return ret + } + return *o.MobileRumUnitsAggSum +} + +// GetMobileRumUnitsAggSumOk returns a tuple with the MobileRumUnitsAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetMobileRumUnitsAggSumOk() (*int64, bool) { + if o == nil || o.MobileRumUnitsAggSum == nil { + return nil, false + } + return o.MobileRumUnitsAggSum, true +} + +// HasMobileRumUnitsAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasMobileRumUnitsAggSum() bool { + if o != nil && o.MobileRumUnitsAggSum != nil { + return true + } + + return false +} + +// SetMobileRumUnitsAggSum gets a reference to the given int64 and assigns it to the MobileRumUnitsAggSum field. +func (o *UsageSummaryResponse) SetMobileRumUnitsAggSum(v int64) { + o.MobileRumUnitsAggSum = &v +} + +// GetNetflowIndexedEventsCountAggSum returns the NetflowIndexedEventsCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetNetflowIndexedEventsCountAggSum() int64 { + if o == nil || o.NetflowIndexedEventsCountAggSum == nil { + var ret int64 + return ret + } + return *o.NetflowIndexedEventsCountAggSum +} + +// GetNetflowIndexedEventsCountAggSumOk returns a tuple with the NetflowIndexedEventsCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetNetflowIndexedEventsCountAggSumOk() (*int64, bool) { + if o == nil || o.NetflowIndexedEventsCountAggSum == nil { + return nil, false + } + return o.NetflowIndexedEventsCountAggSum, true +} + +// HasNetflowIndexedEventsCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasNetflowIndexedEventsCountAggSum() bool { + if o != nil && o.NetflowIndexedEventsCountAggSum != nil { + return true + } + + return false +} + +// SetNetflowIndexedEventsCountAggSum gets a reference to the given int64 and assigns it to the NetflowIndexedEventsCountAggSum field. +func (o *UsageSummaryResponse) SetNetflowIndexedEventsCountAggSum(v int64) { + o.NetflowIndexedEventsCountAggSum = &v +} + +// GetNpmHostTop99pSum returns the NpmHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetNpmHostTop99pSum() int64 { + if o == nil || o.NpmHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.NpmHostTop99pSum +} + +// GetNpmHostTop99pSumOk returns a tuple with the NpmHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetNpmHostTop99pSumOk() (*int64, bool) { + if o == nil || o.NpmHostTop99pSum == nil { + return nil, false + } + return o.NpmHostTop99pSum, true +} + +// HasNpmHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasNpmHostTop99pSum() bool { + if o != nil && o.NpmHostTop99pSum != nil { + return true + } + + return false +} + +// SetNpmHostTop99pSum gets a reference to the given int64 and assigns it to the NpmHostTop99pSum field. +func (o *UsageSummaryResponse) SetNpmHostTop99pSum(v int64) { + o.NpmHostTop99pSum = &v +} + +// GetObservabilityPipelinesBytesProcessedAggSum returns the ObservabilityPipelinesBytesProcessedAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetObservabilityPipelinesBytesProcessedAggSum() int64 { + if o == nil || o.ObservabilityPipelinesBytesProcessedAggSum == nil { + var ret int64 + return ret + } + return *o.ObservabilityPipelinesBytesProcessedAggSum +} + +// GetObservabilityPipelinesBytesProcessedAggSumOk returns a tuple with the ObservabilityPipelinesBytesProcessedAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetObservabilityPipelinesBytesProcessedAggSumOk() (*int64, bool) { + if o == nil || o.ObservabilityPipelinesBytesProcessedAggSum == nil { + return nil, false + } + return o.ObservabilityPipelinesBytesProcessedAggSum, true +} + +// HasObservabilityPipelinesBytesProcessedAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasObservabilityPipelinesBytesProcessedAggSum() bool { + if o != nil && o.ObservabilityPipelinesBytesProcessedAggSum != nil { + return true + } + + return false +} + +// SetObservabilityPipelinesBytesProcessedAggSum gets a reference to the given int64 and assigns it to the ObservabilityPipelinesBytesProcessedAggSum field. +func (o *UsageSummaryResponse) SetObservabilityPipelinesBytesProcessedAggSum(v int64) { + o.ObservabilityPipelinesBytesProcessedAggSum = &v +} + +// GetOnlineArchiveEventsCountAggSum returns the OnlineArchiveEventsCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetOnlineArchiveEventsCountAggSum() int64 { + if o == nil || o.OnlineArchiveEventsCountAggSum == nil { + var ret int64 + return ret + } + return *o.OnlineArchiveEventsCountAggSum +} + +// GetOnlineArchiveEventsCountAggSumOk returns a tuple with the OnlineArchiveEventsCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetOnlineArchiveEventsCountAggSumOk() (*int64, bool) { + if o == nil || o.OnlineArchiveEventsCountAggSum == nil { + return nil, false + } + return o.OnlineArchiveEventsCountAggSum, true +} + +// HasOnlineArchiveEventsCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasOnlineArchiveEventsCountAggSum() bool { + if o != nil && o.OnlineArchiveEventsCountAggSum != nil { + return true + } + + return false +} + +// SetOnlineArchiveEventsCountAggSum gets a reference to the given int64 and assigns it to the OnlineArchiveEventsCountAggSum field. +func (o *UsageSummaryResponse) SetOnlineArchiveEventsCountAggSum(v int64) { + o.OnlineArchiveEventsCountAggSum = &v +} + +// GetOpentelemetryHostTop99pSum returns the OpentelemetryHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetOpentelemetryHostTop99pSum() int64 { + if o == nil || o.OpentelemetryHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.OpentelemetryHostTop99pSum +} + +// GetOpentelemetryHostTop99pSumOk returns a tuple with the OpentelemetryHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetOpentelemetryHostTop99pSumOk() (*int64, bool) { + if o == nil || o.OpentelemetryHostTop99pSum == nil { + return nil, false + } + return o.OpentelemetryHostTop99pSum, true +} + +// HasOpentelemetryHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasOpentelemetryHostTop99pSum() bool { + if o != nil && o.OpentelemetryHostTop99pSum != nil { + return true + } + + return false +} + +// SetOpentelemetryHostTop99pSum gets a reference to the given int64 and assigns it to the OpentelemetryHostTop99pSum field. +func (o *UsageSummaryResponse) SetOpentelemetryHostTop99pSum(v int64) { + o.OpentelemetryHostTop99pSum = &v +} + +// GetProfilingContainerAgentCountAvg returns the ProfilingContainerAgentCountAvg field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetProfilingContainerAgentCountAvg() int64 { + if o == nil || o.ProfilingContainerAgentCountAvg == nil { + var ret int64 + return ret + } + return *o.ProfilingContainerAgentCountAvg +} + +// GetProfilingContainerAgentCountAvgOk returns a tuple with the ProfilingContainerAgentCountAvg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetProfilingContainerAgentCountAvgOk() (*int64, bool) { + if o == nil || o.ProfilingContainerAgentCountAvg == nil { + return nil, false + } + return o.ProfilingContainerAgentCountAvg, true +} + +// HasProfilingContainerAgentCountAvg returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasProfilingContainerAgentCountAvg() bool { + if o != nil && o.ProfilingContainerAgentCountAvg != nil { + return true + } + + return false +} + +// SetProfilingContainerAgentCountAvg gets a reference to the given int64 and assigns it to the ProfilingContainerAgentCountAvg field. +func (o *UsageSummaryResponse) SetProfilingContainerAgentCountAvg(v int64) { + o.ProfilingContainerAgentCountAvg = &v +} + +// GetProfilingHostCountTop99pSum returns the ProfilingHostCountTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetProfilingHostCountTop99pSum() int64 { + if o == nil || o.ProfilingHostCountTop99pSum == nil { + var ret int64 + return ret + } + return *o.ProfilingHostCountTop99pSum +} + +// GetProfilingHostCountTop99pSumOk returns a tuple with the ProfilingHostCountTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetProfilingHostCountTop99pSumOk() (*int64, bool) { + if o == nil || o.ProfilingHostCountTop99pSum == nil { + return nil, false + } + return o.ProfilingHostCountTop99pSum, true +} + +// HasProfilingHostCountTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasProfilingHostCountTop99pSum() bool { + if o != nil && o.ProfilingHostCountTop99pSum != nil { + return true + } + + return false +} + +// SetProfilingHostCountTop99pSum gets a reference to the given int64 and assigns it to the ProfilingHostCountTop99pSum field. +func (o *UsageSummaryResponse) SetProfilingHostCountTop99pSum(v int64) { + o.ProfilingHostCountTop99pSum = &v +} + +// GetRehydratedIndexedEventsAggSum returns the RehydratedIndexedEventsAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetRehydratedIndexedEventsAggSum() int64 { + if o == nil || o.RehydratedIndexedEventsAggSum == nil { + var ret int64 + return ret + } + return *o.RehydratedIndexedEventsAggSum +} + +// GetRehydratedIndexedEventsAggSumOk returns a tuple with the RehydratedIndexedEventsAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetRehydratedIndexedEventsAggSumOk() (*int64, bool) { + if o == nil || o.RehydratedIndexedEventsAggSum == nil { + return nil, false + } + return o.RehydratedIndexedEventsAggSum, true +} + +// HasRehydratedIndexedEventsAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasRehydratedIndexedEventsAggSum() bool { + if o != nil && o.RehydratedIndexedEventsAggSum != nil { + return true + } + + return false +} + +// SetRehydratedIndexedEventsAggSum gets a reference to the given int64 and assigns it to the RehydratedIndexedEventsAggSum field. +func (o *UsageSummaryResponse) SetRehydratedIndexedEventsAggSum(v int64) { + o.RehydratedIndexedEventsAggSum = &v +} + +// GetRehydratedIngestedBytesAggSum returns the RehydratedIngestedBytesAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetRehydratedIngestedBytesAggSum() int64 { + if o == nil || o.RehydratedIngestedBytesAggSum == nil { + var ret int64 + return ret + } + return *o.RehydratedIngestedBytesAggSum +} + +// GetRehydratedIngestedBytesAggSumOk returns a tuple with the RehydratedIngestedBytesAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetRehydratedIngestedBytesAggSumOk() (*int64, bool) { + if o == nil || o.RehydratedIngestedBytesAggSum == nil { + return nil, false + } + return o.RehydratedIngestedBytesAggSum, true +} + +// HasRehydratedIngestedBytesAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasRehydratedIngestedBytesAggSum() bool { + if o != nil && o.RehydratedIngestedBytesAggSum != nil { + return true + } + + return false +} + +// SetRehydratedIngestedBytesAggSum gets a reference to the given int64 and assigns it to the RehydratedIngestedBytesAggSum field. +func (o *UsageSummaryResponse) SetRehydratedIngestedBytesAggSum(v int64) { + o.RehydratedIngestedBytesAggSum = &v +} + +// GetRumBrowserAndMobileSessionCount returns the RumBrowserAndMobileSessionCount field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetRumBrowserAndMobileSessionCount() int64 { + if o == nil || o.RumBrowserAndMobileSessionCount == nil { + var ret int64 + return ret + } + return *o.RumBrowserAndMobileSessionCount +} + +// GetRumBrowserAndMobileSessionCountOk returns a tuple with the RumBrowserAndMobileSessionCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetRumBrowserAndMobileSessionCountOk() (*int64, bool) { + if o == nil || o.RumBrowserAndMobileSessionCount == nil { + return nil, false + } + return o.RumBrowserAndMobileSessionCount, true +} + +// HasRumBrowserAndMobileSessionCount returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasRumBrowserAndMobileSessionCount() bool { + if o != nil && o.RumBrowserAndMobileSessionCount != nil { + return true + } + + return false +} + +// SetRumBrowserAndMobileSessionCount gets a reference to the given int64 and assigns it to the RumBrowserAndMobileSessionCount field. +func (o *UsageSummaryResponse) SetRumBrowserAndMobileSessionCount(v int64) { + o.RumBrowserAndMobileSessionCount = &v +} + +// GetRumSessionCountAggSum returns the RumSessionCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetRumSessionCountAggSum() int64 { + if o == nil || o.RumSessionCountAggSum == nil { + var ret int64 + return ret + } + return *o.RumSessionCountAggSum +} + +// GetRumSessionCountAggSumOk returns a tuple with the RumSessionCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetRumSessionCountAggSumOk() (*int64, bool) { + if o == nil || o.RumSessionCountAggSum == nil { + return nil, false + } + return o.RumSessionCountAggSum, true +} + +// HasRumSessionCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasRumSessionCountAggSum() bool { + if o != nil && o.RumSessionCountAggSum != nil { + return true + } + + return false +} + +// SetRumSessionCountAggSum gets a reference to the given int64 and assigns it to the RumSessionCountAggSum field. +func (o *UsageSummaryResponse) SetRumSessionCountAggSum(v int64) { + o.RumSessionCountAggSum = &v +} + +// GetRumTotalSessionCountAggSum returns the RumTotalSessionCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetRumTotalSessionCountAggSum() int64 { + if o == nil || o.RumTotalSessionCountAggSum == nil { + var ret int64 + return ret + } + return *o.RumTotalSessionCountAggSum +} + +// GetRumTotalSessionCountAggSumOk returns a tuple with the RumTotalSessionCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetRumTotalSessionCountAggSumOk() (*int64, bool) { + if o == nil || o.RumTotalSessionCountAggSum == nil { + return nil, false + } + return o.RumTotalSessionCountAggSum, true +} + +// HasRumTotalSessionCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasRumTotalSessionCountAggSum() bool { + if o != nil && o.RumTotalSessionCountAggSum != nil { + return true + } + + return false +} + +// SetRumTotalSessionCountAggSum gets a reference to the given int64 and assigns it to the RumTotalSessionCountAggSum field. +func (o *UsageSummaryResponse) SetRumTotalSessionCountAggSum(v int64) { + o.RumTotalSessionCountAggSum = &v +} + +// GetRumUnitsAggSum returns the RumUnitsAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetRumUnitsAggSum() int64 { + if o == nil || o.RumUnitsAggSum == nil { + var ret int64 + return ret + } + return *o.RumUnitsAggSum +} + +// GetRumUnitsAggSumOk returns a tuple with the RumUnitsAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetRumUnitsAggSumOk() (*int64, bool) { + if o == nil || o.RumUnitsAggSum == nil { + return nil, false + } + return o.RumUnitsAggSum, true +} + +// HasRumUnitsAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasRumUnitsAggSum() bool { + if o != nil && o.RumUnitsAggSum != nil { + return true + } + + return false +} + +// SetRumUnitsAggSum gets a reference to the given int64 and assigns it to the RumUnitsAggSum field. +func (o *UsageSummaryResponse) SetRumUnitsAggSum(v int64) { + o.RumUnitsAggSum = &v +} + +// GetSdsLogsScannedBytesSum returns the SdsLogsScannedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetSdsLogsScannedBytesSum() int64 { + if o == nil || o.SdsLogsScannedBytesSum == nil { + var ret int64 + return ret + } + return *o.SdsLogsScannedBytesSum +} + +// GetSdsLogsScannedBytesSumOk returns a tuple with the SdsLogsScannedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetSdsLogsScannedBytesSumOk() (*int64, bool) { + if o == nil || o.SdsLogsScannedBytesSum == nil { + return nil, false + } + return o.SdsLogsScannedBytesSum, true +} + +// HasSdsLogsScannedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasSdsLogsScannedBytesSum() bool { + if o != nil && o.SdsLogsScannedBytesSum != nil { + return true + } + + return false +} + +// SetSdsLogsScannedBytesSum gets a reference to the given int64 and assigns it to the SdsLogsScannedBytesSum field. +func (o *UsageSummaryResponse) SetSdsLogsScannedBytesSum(v int64) { + o.SdsLogsScannedBytesSum = &v +} + +// GetSdsTotalScannedBytesSum returns the SdsTotalScannedBytesSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetSdsTotalScannedBytesSum() int64 { + if o == nil || o.SdsTotalScannedBytesSum == nil { + var ret int64 + return ret + } + return *o.SdsTotalScannedBytesSum +} + +// GetSdsTotalScannedBytesSumOk returns a tuple with the SdsTotalScannedBytesSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetSdsTotalScannedBytesSumOk() (*int64, bool) { + if o == nil || o.SdsTotalScannedBytesSum == nil { + return nil, false + } + return o.SdsTotalScannedBytesSum, true +} + +// HasSdsTotalScannedBytesSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasSdsTotalScannedBytesSum() bool { + if o != nil && o.SdsTotalScannedBytesSum != nil { + return true + } + + return false +} + +// SetSdsTotalScannedBytesSum gets a reference to the given int64 and assigns it to the SdsTotalScannedBytesSum field. +func (o *UsageSummaryResponse) SetSdsTotalScannedBytesSum(v int64) { + o.SdsTotalScannedBytesSum = &v +} + +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetStartDate() time.Time { + if o == nil || o.StartDate == nil { + var ret time.Time + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetStartDateOk() (*time.Time, bool) { + if o == nil || o.StartDate == nil { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasStartDate() bool { + if o != nil && o.StartDate != nil { + return true + } + + return false +} + +// SetStartDate gets a reference to the given time.Time and assigns it to the StartDate field. +func (o *UsageSummaryResponse) SetStartDate(v time.Time) { + o.StartDate = &v +} + +// GetSyntheticsBrowserCheckCallsCountAggSum returns the SyntheticsBrowserCheckCallsCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetSyntheticsBrowserCheckCallsCountAggSum() int64 { + if o == nil || o.SyntheticsBrowserCheckCallsCountAggSum == nil { + var ret int64 + return ret + } + return *o.SyntheticsBrowserCheckCallsCountAggSum +} + +// GetSyntheticsBrowserCheckCallsCountAggSumOk returns a tuple with the SyntheticsBrowserCheckCallsCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetSyntheticsBrowserCheckCallsCountAggSumOk() (*int64, bool) { + if o == nil || o.SyntheticsBrowserCheckCallsCountAggSum == nil { + return nil, false + } + return o.SyntheticsBrowserCheckCallsCountAggSum, true +} + +// HasSyntheticsBrowserCheckCallsCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasSyntheticsBrowserCheckCallsCountAggSum() bool { + if o != nil && o.SyntheticsBrowserCheckCallsCountAggSum != nil { + return true + } + + return false +} + +// SetSyntheticsBrowserCheckCallsCountAggSum gets a reference to the given int64 and assigns it to the SyntheticsBrowserCheckCallsCountAggSum field. +func (o *UsageSummaryResponse) SetSyntheticsBrowserCheckCallsCountAggSum(v int64) { + o.SyntheticsBrowserCheckCallsCountAggSum = &v +} + +// GetSyntheticsCheckCallsCountAggSum returns the SyntheticsCheckCallsCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetSyntheticsCheckCallsCountAggSum() int64 { + if o == nil || o.SyntheticsCheckCallsCountAggSum == nil { + var ret int64 + return ret + } + return *o.SyntheticsCheckCallsCountAggSum +} + +// GetSyntheticsCheckCallsCountAggSumOk returns a tuple with the SyntheticsCheckCallsCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetSyntheticsCheckCallsCountAggSumOk() (*int64, bool) { + if o == nil || o.SyntheticsCheckCallsCountAggSum == nil { + return nil, false + } + return o.SyntheticsCheckCallsCountAggSum, true +} + +// HasSyntheticsCheckCallsCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasSyntheticsCheckCallsCountAggSum() bool { + if o != nil && o.SyntheticsCheckCallsCountAggSum != nil { + return true + } + + return false +} + +// SetSyntheticsCheckCallsCountAggSum gets a reference to the given int64 and assigns it to the SyntheticsCheckCallsCountAggSum field. +func (o *UsageSummaryResponse) SetSyntheticsCheckCallsCountAggSum(v int64) { + o.SyntheticsCheckCallsCountAggSum = &v +} + +// GetTraceSearchIndexedEventsCountAggSum returns the TraceSearchIndexedEventsCountAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetTraceSearchIndexedEventsCountAggSum() int64 { + if o == nil || o.TraceSearchIndexedEventsCountAggSum == nil { + var ret int64 + return ret + } + return *o.TraceSearchIndexedEventsCountAggSum +} + +// GetTraceSearchIndexedEventsCountAggSumOk returns a tuple with the TraceSearchIndexedEventsCountAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetTraceSearchIndexedEventsCountAggSumOk() (*int64, bool) { + if o == nil || o.TraceSearchIndexedEventsCountAggSum == nil { + return nil, false + } + return o.TraceSearchIndexedEventsCountAggSum, true +} + +// HasTraceSearchIndexedEventsCountAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasTraceSearchIndexedEventsCountAggSum() bool { + if o != nil && o.TraceSearchIndexedEventsCountAggSum != nil { + return true + } + + return false +} + +// SetTraceSearchIndexedEventsCountAggSum gets a reference to the given int64 and assigns it to the TraceSearchIndexedEventsCountAggSum field. +func (o *UsageSummaryResponse) SetTraceSearchIndexedEventsCountAggSum(v int64) { + o.TraceSearchIndexedEventsCountAggSum = &v +} + +// GetTwolIngestedEventsBytesAggSum returns the TwolIngestedEventsBytesAggSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetTwolIngestedEventsBytesAggSum() int64 { + if o == nil || o.TwolIngestedEventsBytesAggSum == nil { + var ret int64 + return ret + } + return *o.TwolIngestedEventsBytesAggSum +} + +// GetTwolIngestedEventsBytesAggSumOk returns a tuple with the TwolIngestedEventsBytesAggSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetTwolIngestedEventsBytesAggSumOk() (*int64, bool) { + if o == nil || o.TwolIngestedEventsBytesAggSum == nil { + return nil, false + } + return o.TwolIngestedEventsBytesAggSum, true +} + +// HasTwolIngestedEventsBytesAggSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasTwolIngestedEventsBytesAggSum() bool { + if o != nil && o.TwolIngestedEventsBytesAggSum != nil { + return true + } + + return false +} + +// SetTwolIngestedEventsBytesAggSum gets a reference to the given int64 and assigns it to the TwolIngestedEventsBytesAggSum field. +func (o *UsageSummaryResponse) SetTwolIngestedEventsBytesAggSum(v int64) { + o.TwolIngestedEventsBytesAggSum = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetUsage() []UsageSummaryDate { + if o == nil || o.Usage == nil { + var ret []UsageSummaryDate + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetUsageOk() (*[]UsageSummaryDate, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageSummaryDate and assigns it to the Usage field. +func (o *UsageSummaryResponse) SetUsage(v []UsageSummaryDate) { + o.Usage = v +} + +// GetVsphereHostTop99pSum returns the VsphereHostTop99pSum field value if set, zero value otherwise. +func (o *UsageSummaryResponse) GetVsphereHostTop99pSum() int64 { + if o == nil || o.VsphereHostTop99pSum == nil { + var ret int64 + return ret + } + return *o.VsphereHostTop99pSum +} + +// GetVsphereHostTop99pSumOk returns a tuple with the VsphereHostTop99pSum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSummaryResponse) GetVsphereHostTop99pSumOk() (*int64, bool) { + if o == nil || o.VsphereHostTop99pSum == nil { + return nil, false + } + return o.VsphereHostTop99pSum, true +} + +// HasVsphereHostTop99pSum returns a boolean if a field has been set. +func (o *UsageSummaryResponse) HasVsphereHostTop99pSum() bool { + if o != nil && o.VsphereHostTop99pSum != nil { + return true + } + + return false +} + +// SetVsphereHostTop99pSum gets a reference to the given int64 and assigns it to the VsphereHostTop99pSum field. +func (o *UsageSummaryResponse) SetVsphereHostTop99pSum(v int64) { + o.VsphereHostTop99pSum = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSummaryResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AgentHostTop99pSum != nil { + toSerialize["agent_host_top99p_sum"] = o.AgentHostTop99pSum + } + if o.ApmAzureAppServiceHostTop99pSum != nil { + toSerialize["apm_azure_app_service_host_top99p_sum"] = o.ApmAzureAppServiceHostTop99pSum + } + if o.ApmHostTop99pSum != nil { + toSerialize["apm_host_top99p_sum"] = o.ApmHostTop99pSum + } + if o.AuditLogsLinesIndexedAggSum != nil { + toSerialize["audit_logs_lines_indexed_agg_sum"] = o.AuditLogsLinesIndexedAggSum + } + if o.AvgProfiledFargateTasksSum != nil { + toSerialize["avg_profiled_fargate_tasks_sum"] = o.AvgProfiledFargateTasksSum + } + if o.AwsHostTop99pSum != nil { + toSerialize["aws_host_top99p_sum"] = o.AwsHostTop99pSum + } + if o.AwsLambdaFuncCount != nil { + toSerialize["aws_lambda_func_count"] = o.AwsLambdaFuncCount + } + if o.AwsLambdaInvocationsSum != nil { + toSerialize["aws_lambda_invocations_sum"] = o.AwsLambdaInvocationsSum + } + if o.AzureAppServiceTop99pSum != nil { + toSerialize["azure_app_service_top99p_sum"] = o.AzureAppServiceTop99pSum + } + if o.AzureHostTop99pSum != nil { + toSerialize["azure_host_top99p_sum"] = o.AzureHostTop99pSum + } + if o.BillableIngestedBytesAggSum != nil { + toSerialize["billable_ingested_bytes_agg_sum"] = o.BillableIngestedBytesAggSum + } + if o.BrowserRumLiteSessionCountAggSum != nil { + toSerialize["browser_rum_lite_session_count_agg_sum"] = o.BrowserRumLiteSessionCountAggSum + } + if o.BrowserRumReplaySessionCountAggSum != nil { + toSerialize["browser_rum_replay_session_count_agg_sum"] = o.BrowserRumReplaySessionCountAggSum + } + if o.BrowserRumUnitsAggSum != nil { + toSerialize["browser_rum_units_agg_sum"] = o.BrowserRumUnitsAggSum + } + if o.CiPipelineIndexedSpansAggSum != nil { + toSerialize["ci_pipeline_indexed_spans_agg_sum"] = o.CiPipelineIndexedSpansAggSum + } + if o.CiTestIndexedSpansAggSum != nil { + toSerialize["ci_test_indexed_spans_agg_sum"] = o.CiTestIndexedSpansAggSum + } + if o.CiVisibilityPipelineCommittersHwmSum != nil { + toSerialize["ci_visibility_pipeline_committers_hwm_sum"] = o.CiVisibilityPipelineCommittersHwmSum + } + if o.CiVisibilityTestCommittersHwmSum != nil { + toSerialize["ci_visibility_test_committers_hwm_sum"] = o.CiVisibilityTestCommittersHwmSum + } + if o.ContainerAvgSum != nil { + toSerialize["container_avg_sum"] = o.ContainerAvgSum + } + if o.ContainerHwmSum != nil { + toSerialize["container_hwm_sum"] = o.ContainerHwmSum + } + if o.CspmAasHostTop99pSum != nil { + toSerialize["cspm_aas_host_top99p_sum"] = o.CspmAasHostTop99pSum + } + if o.CspmAzureHostTop99pSum != nil { + toSerialize["cspm_azure_host_top99p_sum"] = o.CspmAzureHostTop99pSum + } + if o.CspmContainerAvgSum != nil { + toSerialize["cspm_container_avg_sum"] = o.CspmContainerAvgSum + } + if o.CspmContainerHwmSum != nil { + toSerialize["cspm_container_hwm_sum"] = o.CspmContainerHwmSum + } + if o.CspmHostTop99pSum != nil { + toSerialize["cspm_host_top99p_sum"] = o.CspmHostTop99pSum + } + if o.CustomTsSum != nil { + toSerialize["custom_ts_sum"] = o.CustomTsSum + } + if o.CwsContainersAvgSum != nil { + toSerialize["cws_containers_avg_sum"] = o.CwsContainersAvgSum + } + if o.CwsHostTop99pSum != nil { + toSerialize["cws_host_top99p_sum"] = o.CwsHostTop99pSum + } + if o.DbmHostTop99pSum != nil { + toSerialize["dbm_host_top99p_sum"] = o.DbmHostTop99pSum + } + if o.DbmQueriesAvgSum != nil { + toSerialize["dbm_queries_avg_sum"] = o.DbmQueriesAvgSum + } + if o.EndDate != nil { + if o.EndDate.Nanosecond() == 0 { + toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["end_date"] = o.EndDate.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.FargateTasksCountAvgSum != nil { + toSerialize["fargate_tasks_count_avg_sum"] = o.FargateTasksCountAvgSum + } + if o.FargateTasksCountHwmSum != nil { + toSerialize["fargate_tasks_count_hwm_sum"] = o.FargateTasksCountHwmSum + } + if o.GcpHostTop99pSum != nil { + toSerialize["gcp_host_top99p_sum"] = o.GcpHostTop99pSum + } + if o.HerokuHostTop99pSum != nil { + toSerialize["heroku_host_top99p_sum"] = o.HerokuHostTop99pSum + } + if o.IncidentManagementMonthlyActiveUsersHwmSum != nil { + toSerialize["incident_management_monthly_active_users_hwm_sum"] = o.IncidentManagementMonthlyActiveUsersHwmSum + } + if o.IndexedEventsCountAggSum != nil { + toSerialize["indexed_events_count_agg_sum"] = o.IndexedEventsCountAggSum + } + if o.InfraHostTop99pSum != nil { + toSerialize["infra_host_top99p_sum"] = o.InfraHostTop99pSum + } + if o.IngestedEventsBytesAggSum != nil { + toSerialize["ingested_events_bytes_agg_sum"] = o.IngestedEventsBytesAggSum + } + if o.IotDeviceAggSum != nil { + toSerialize["iot_device_agg_sum"] = o.IotDeviceAggSum + } + if o.IotDeviceTop99pSum != nil { + toSerialize["iot_device_top99p_sum"] = o.IotDeviceTop99pSum + } + if o.LastUpdated != nil { + if o.LastUpdated.Nanosecond() == 0 { + toSerialize["last_updated"] = o.LastUpdated.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["last_updated"] = o.LastUpdated.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LiveIndexedEventsAggSum != nil { + toSerialize["live_indexed_events_agg_sum"] = o.LiveIndexedEventsAggSum + } + if o.LiveIngestedBytesAggSum != nil { + toSerialize["live_ingested_bytes_agg_sum"] = o.LiveIngestedBytesAggSum + } + if o.LogsByRetention != nil { + toSerialize["logs_by_retention"] = o.LogsByRetention + } + if o.MobileRumLiteSessionCountAggSum != nil { + toSerialize["mobile_rum_lite_session_count_agg_sum"] = o.MobileRumLiteSessionCountAggSum + } + if o.MobileRumSessionCountAggSum != nil { + toSerialize["mobile_rum_session_count_agg_sum"] = o.MobileRumSessionCountAggSum + } + if o.MobileRumSessionCountAndroidAggSum != nil { + toSerialize["mobile_rum_session_count_android_agg_sum"] = o.MobileRumSessionCountAndroidAggSum + } + if o.MobileRumSessionCountIosAggSum != nil { + toSerialize["mobile_rum_session_count_ios_agg_sum"] = o.MobileRumSessionCountIosAggSum + } + if o.MobileRumSessionCountReactnativeAggSum != nil { + toSerialize["mobile_rum_session_count_reactnative_agg_sum"] = o.MobileRumSessionCountReactnativeAggSum + } + if o.MobileRumUnitsAggSum != nil { + toSerialize["mobile_rum_units_agg_sum"] = o.MobileRumUnitsAggSum + } + if o.NetflowIndexedEventsCountAggSum != nil { + toSerialize["netflow_indexed_events_count_agg_sum"] = o.NetflowIndexedEventsCountAggSum + } + if o.NpmHostTop99pSum != nil { + toSerialize["npm_host_top99p_sum"] = o.NpmHostTop99pSum + } + if o.ObservabilityPipelinesBytesProcessedAggSum != nil { + toSerialize["observability_pipelines_bytes_processed_agg_sum"] = o.ObservabilityPipelinesBytesProcessedAggSum + } + if o.OnlineArchiveEventsCountAggSum != nil { + toSerialize["online_archive_events_count_agg_sum"] = o.OnlineArchiveEventsCountAggSum + } + if o.OpentelemetryHostTop99pSum != nil { + toSerialize["opentelemetry_host_top99p_sum"] = o.OpentelemetryHostTop99pSum + } + if o.ProfilingContainerAgentCountAvg != nil { + toSerialize["profiling_container_agent_count_avg"] = o.ProfilingContainerAgentCountAvg + } + if o.ProfilingHostCountTop99pSum != nil { + toSerialize["profiling_host_count_top99p_sum"] = o.ProfilingHostCountTop99pSum + } + if o.RehydratedIndexedEventsAggSum != nil { + toSerialize["rehydrated_indexed_events_agg_sum"] = o.RehydratedIndexedEventsAggSum + } + if o.RehydratedIngestedBytesAggSum != nil { + toSerialize["rehydrated_ingested_bytes_agg_sum"] = o.RehydratedIngestedBytesAggSum + } + if o.RumBrowserAndMobileSessionCount != nil { + toSerialize["rum_browser_and_mobile_session_count"] = o.RumBrowserAndMobileSessionCount + } + if o.RumSessionCountAggSum != nil { + toSerialize["rum_session_count_agg_sum"] = o.RumSessionCountAggSum + } + if o.RumTotalSessionCountAggSum != nil { + toSerialize["rum_total_session_count_agg_sum"] = o.RumTotalSessionCountAggSum + } + if o.RumUnitsAggSum != nil { + toSerialize["rum_units_agg_sum"] = o.RumUnitsAggSum + } + if o.SdsLogsScannedBytesSum != nil { + toSerialize["sds_logs_scanned_bytes_sum"] = o.SdsLogsScannedBytesSum + } + if o.SdsTotalScannedBytesSum != nil { + toSerialize["sds_total_scanned_bytes_sum"] = o.SdsTotalScannedBytesSum + } + if o.StartDate != nil { + if o.StartDate.Nanosecond() == 0 { + toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.SyntheticsBrowserCheckCallsCountAggSum != nil { + toSerialize["synthetics_browser_check_calls_count_agg_sum"] = o.SyntheticsBrowserCheckCallsCountAggSum + } + if o.SyntheticsCheckCallsCountAggSum != nil { + toSerialize["synthetics_check_calls_count_agg_sum"] = o.SyntheticsCheckCallsCountAggSum + } + if o.TraceSearchIndexedEventsCountAggSum != nil { + toSerialize["trace_search_indexed_events_count_agg_sum"] = o.TraceSearchIndexedEventsCountAggSum + } + if o.TwolIngestedEventsBytesAggSum != nil { + toSerialize["twol_ingested_events_bytes_agg_sum"] = o.TwolIngestedEventsBytesAggSum + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + if o.VsphereHostTop99pSum != nil { + toSerialize["vsphere_host_top99p_sum"] = o.VsphereHostTop99pSum + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AgentHostTop99pSum *int64 `json:"agent_host_top99p_sum,omitempty"` + ApmAzureAppServiceHostTop99pSum *int64 `json:"apm_azure_app_service_host_top99p_sum,omitempty"` + ApmHostTop99pSum *int64 `json:"apm_host_top99p_sum,omitempty"` + AuditLogsLinesIndexedAggSum *int64 `json:"audit_logs_lines_indexed_agg_sum,omitempty"` + AvgProfiledFargateTasksSum *int64 `json:"avg_profiled_fargate_tasks_sum,omitempty"` + AwsHostTop99pSum *int64 `json:"aws_host_top99p_sum,omitempty"` + AwsLambdaFuncCount *int64 `json:"aws_lambda_func_count,omitempty"` + AwsLambdaInvocationsSum *int64 `json:"aws_lambda_invocations_sum,omitempty"` + AzureAppServiceTop99pSum *int64 `json:"azure_app_service_top99p_sum,omitempty"` + AzureHostTop99pSum *int64 `json:"azure_host_top99p_sum,omitempty"` + BillableIngestedBytesAggSum *int64 `json:"billable_ingested_bytes_agg_sum,omitempty"` + BrowserRumLiteSessionCountAggSum *int64 `json:"browser_rum_lite_session_count_agg_sum,omitempty"` + BrowserRumReplaySessionCountAggSum *int64 `json:"browser_rum_replay_session_count_agg_sum,omitempty"` + BrowserRumUnitsAggSum *int64 `json:"browser_rum_units_agg_sum,omitempty"` + CiPipelineIndexedSpansAggSum *int64 `json:"ci_pipeline_indexed_spans_agg_sum,omitempty"` + CiTestIndexedSpansAggSum *int64 `json:"ci_test_indexed_spans_agg_sum,omitempty"` + CiVisibilityPipelineCommittersHwmSum *int64 `json:"ci_visibility_pipeline_committers_hwm_sum,omitempty"` + CiVisibilityTestCommittersHwmSum *int64 `json:"ci_visibility_test_committers_hwm_sum,omitempty"` + ContainerAvgSum *int64 `json:"container_avg_sum,omitempty"` + ContainerHwmSum *int64 `json:"container_hwm_sum,omitempty"` + CspmAasHostTop99pSum *int64 `json:"cspm_aas_host_top99p_sum,omitempty"` + CspmAzureHostTop99pSum *int64 `json:"cspm_azure_host_top99p_sum,omitempty"` + CspmContainerAvgSum *int64 `json:"cspm_container_avg_sum,omitempty"` + CspmContainerHwmSum *int64 `json:"cspm_container_hwm_sum,omitempty"` + CspmHostTop99pSum *int64 `json:"cspm_host_top99p_sum,omitempty"` + CustomTsSum *int64 `json:"custom_ts_sum,omitempty"` + CwsContainersAvgSum *int64 `json:"cws_containers_avg_sum,omitempty"` + CwsHostTop99pSum *int64 `json:"cws_host_top99p_sum,omitempty"` + DbmHostTop99pSum *int64 `json:"dbm_host_top99p_sum,omitempty"` + DbmQueriesAvgSum *int64 `json:"dbm_queries_avg_sum,omitempty"` + EndDate *time.Time `json:"end_date,omitempty"` + FargateTasksCountAvgSum *int64 `json:"fargate_tasks_count_avg_sum,omitempty"` + FargateTasksCountHwmSum *int64 `json:"fargate_tasks_count_hwm_sum,omitempty"` + GcpHostTop99pSum *int64 `json:"gcp_host_top99p_sum,omitempty"` + HerokuHostTop99pSum *int64 `json:"heroku_host_top99p_sum,omitempty"` + IncidentManagementMonthlyActiveUsersHwmSum *int64 `json:"incident_management_monthly_active_users_hwm_sum,omitempty"` + IndexedEventsCountAggSum *int64 `json:"indexed_events_count_agg_sum,omitempty"` + InfraHostTop99pSum *int64 `json:"infra_host_top99p_sum,omitempty"` + IngestedEventsBytesAggSum *int64 `json:"ingested_events_bytes_agg_sum,omitempty"` + IotDeviceAggSum *int64 `json:"iot_device_agg_sum,omitempty"` + IotDeviceTop99pSum *int64 `json:"iot_device_top99p_sum,omitempty"` + LastUpdated *time.Time `json:"last_updated,omitempty"` + LiveIndexedEventsAggSum *int64 `json:"live_indexed_events_agg_sum,omitempty"` + LiveIngestedBytesAggSum *int64 `json:"live_ingested_bytes_agg_sum,omitempty"` + LogsByRetention *LogsByRetention `json:"logs_by_retention,omitempty"` + MobileRumLiteSessionCountAggSum *int64 `json:"mobile_rum_lite_session_count_agg_sum,omitempty"` + MobileRumSessionCountAggSum *int64 `json:"mobile_rum_session_count_agg_sum,omitempty"` + MobileRumSessionCountAndroidAggSum *int64 `json:"mobile_rum_session_count_android_agg_sum,omitempty"` + MobileRumSessionCountIosAggSum *int64 `json:"mobile_rum_session_count_ios_agg_sum,omitempty"` + MobileRumSessionCountReactnativeAggSum *int64 `json:"mobile_rum_session_count_reactnative_agg_sum,omitempty"` + MobileRumUnitsAggSum *int64 `json:"mobile_rum_units_agg_sum,omitempty"` + NetflowIndexedEventsCountAggSum *int64 `json:"netflow_indexed_events_count_agg_sum,omitempty"` + NpmHostTop99pSum *int64 `json:"npm_host_top99p_sum,omitempty"` + ObservabilityPipelinesBytesProcessedAggSum *int64 `json:"observability_pipelines_bytes_processed_agg_sum,omitempty"` + OnlineArchiveEventsCountAggSum *int64 `json:"online_archive_events_count_agg_sum,omitempty"` + OpentelemetryHostTop99pSum *int64 `json:"opentelemetry_host_top99p_sum,omitempty"` + ProfilingContainerAgentCountAvg *int64 `json:"profiling_container_agent_count_avg,omitempty"` + ProfilingHostCountTop99pSum *int64 `json:"profiling_host_count_top99p_sum,omitempty"` + RehydratedIndexedEventsAggSum *int64 `json:"rehydrated_indexed_events_agg_sum,omitempty"` + RehydratedIngestedBytesAggSum *int64 `json:"rehydrated_ingested_bytes_agg_sum,omitempty"` + RumBrowserAndMobileSessionCount *int64 `json:"rum_browser_and_mobile_session_count,omitempty"` + RumSessionCountAggSum *int64 `json:"rum_session_count_agg_sum,omitempty"` + RumTotalSessionCountAggSum *int64 `json:"rum_total_session_count_agg_sum,omitempty"` + RumUnitsAggSum *int64 `json:"rum_units_agg_sum,omitempty"` + SdsLogsScannedBytesSum *int64 `json:"sds_logs_scanned_bytes_sum,omitempty"` + SdsTotalScannedBytesSum *int64 `json:"sds_total_scanned_bytes_sum,omitempty"` + StartDate *time.Time `json:"start_date,omitempty"` + SyntheticsBrowserCheckCallsCountAggSum *int64 `json:"synthetics_browser_check_calls_count_agg_sum,omitempty"` + SyntheticsCheckCallsCountAggSum *int64 `json:"synthetics_check_calls_count_agg_sum,omitempty"` + TraceSearchIndexedEventsCountAggSum *int64 `json:"trace_search_indexed_events_count_agg_sum,omitempty"` + TwolIngestedEventsBytesAggSum *int64 `json:"twol_ingested_events_bytes_agg_sum,omitempty"` + Usage []UsageSummaryDate `json:"usage,omitempty"` + VsphereHostTop99pSum *int64 `json:"vsphere_host_top99p_sum,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AgentHostTop99pSum = all.AgentHostTop99pSum + o.ApmAzureAppServiceHostTop99pSum = all.ApmAzureAppServiceHostTop99pSum + o.ApmHostTop99pSum = all.ApmHostTop99pSum + o.AuditLogsLinesIndexedAggSum = all.AuditLogsLinesIndexedAggSum + o.AvgProfiledFargateTasksSum = all.AvgProfiledFargateTasksSum + o.AwsHostTop99pSum = all.AwsHostTop99pSum + o.AwsLambdaFuncCount = all.AwsLambdaFuncCount + o.AwsLambdaInvocationsSum = all.AwsLambdaInvocationsSum + o.AzureAppServiceTop99pSum = all.AzureAppServiceTop99pSum + o.AzureHostTop99pSum = all.AzureHostTop99pSum + o.BillableIngestedBytesAggSum = all.BillableIngestedBytesAggSum + o.BrowserRumLiteSessionCountAggSum = all.BrowserRumLiteSessionCountAggSum + o.BrowserRumReplaySessionCountAggSum = all.BrowserRumReplaySessionCountAggSum + o.BrowserRumUnitsAggSum = all.BrowserRumUnitsAggSum + o.CiPipelineIndexedSpansAggSum = all.CiPipelineIndexedSpansAggSum + o.CiTestIndexedSpansAggSum = all.CiTestIndexedSpansAggSum + o.CiVisibilityPipelineCommittersHwmSum = all.CiVisibilityPipelineCommittersHwmSum + o.CiVisibilityTestCommittersHwmSum = all.CiVisibilityTestCommittersHwmSum + o.ContainerAvgSum = all.ContainerAvgSum + o.ContainerHwmSum = all.ContainerHwmSum + o.CspmAasHostTop99pSum = all.CspmAasHostTop99pSum + o.CspmAzureHostTop99pSum = all.CspmAzureHostTop99pSum + o.CspmContainerAvgSum = all.CspmContainerAvgSum + o.CspmContainerHwmSum = all.CspmContainerHwmSum + o.CspmHostTop99pSum = all.CspmHostTop99pSum + o.CustomTsSum = all.CustomTsSum + o.CwsContainersAvgSum = all.CwsContainersAvgSum + o.CwsHostTop99pSum = all.CwsHostTop99pSum + o.DbmHostTop99pSum = all.DbmHostTop99pSum + o.DbmQueriesAvgSum = all.DbmQueriesAvgSum + o.EndDate = all.EndDate + o.FargateTasksCountAvgSum = all.FargateTasksCountAvgSum + o.FargateTasksCountHwmSum = all.FargateTasksCountHwmSum + o.GcpHostTop99pSum = all.GcpHostTop99pSum + o.HerokuHostTop99pSum = all.HerokuHostTop99pSum + o.IncidentManagementMonthlyActiveUsersHwmSum = all.IncidentManagementMonthlyActiveUsersHwmSum + o.IndexedEventsCountAggSum = all.IndexedEventsCountAggSum + o.InfraHostTop99pSum = all.InfraHostTop99pSum + o.IngestedEventsBytesAggSum = all.IngestedEventsBytesAggSum + o.IotDeviceAggSum = all.IotDeviceAggSum + o.IotDeviceTop99pSum = all.IotDeviceTop99pSum + o.LastUpdated = all.LastUpdated + o.LiveIndexedEventsAggSum = all.LiveIndexedEventsAggSum + o.LiveIngestedBytesAggSum = all.LiveIngestedBytesAggSum + if all.LogsByRetention != nil && all.LogsByRetention.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LogsByRetention = all.LogsByRetention + o.MobileRumLiteSessionCountAggSum = all.MobileRumLiteSessionCountAggSum + o.MobileRumSessionCountAggSum = all.MobileRumSessionCountAggSum + o.MobileRumSessionCountAndroidAggSum = all.MobileRumSessionCountAndroidAggSum + o.MobileRumSessionCountIosAggSum = all.MobileRumSessionCountIosAggSum + o.MobileRumSessionCountReactnativeAggSum = all.MobileRumSessionCountReactnativeAggSum + o.MobileRumUnitsAggSum = all.MobileRumUnitsAggSum + o.NetflowIndexedEventsCountAggSum = all.NetflowIndexedEventsCountAggSum + o.NpmHostTop99pSum = all.NpmHostTop99pSum + o.ObservabilityPipelinesBytesProcessedAggSum = all.ObservabilityPipelinesBytesProcessedAggSum + o.OnlineArchiveEventsCountAggSum = all.OnlineArchiveEventsCountAggSum + o.OpentelemetryHostTop99pSum = all.OpentelemetryHostTop99pSum + o.ProfilingContainerAgentCountAvg = all.ProfilingContainerAgentCountAvg + o.ProfilingHostCountTop99pSum = all.ProfilingHostCountTop99pSum + o.RehydratedIndexedEventsAggSum = all.RehydratedIndexedEventsAggSum + o.RehydratedIngestedBytesAggSum = all.RehydratedIngestedBytesAggSum + o.RumBrowserAndMobileSessionCount = all.RumBrowserAndMobileSessionCount + o.RumSessionCountAggSum = all.RumSessionCountAggSum + o.RumTotalSessionCountAggSum = all.RumTotalSessionCountAggSum + o.RumUnitsAggSum = all.RumUnitsAggSum + o.SdsLogsScannedBytesSum = all.SdsLogsScannedBytesSum + o.SdsTotalScannedBytesSum = all.SdsTotalScannedBytesSum + o.StartDate = all.StartDate + o.SyntheticsBrowserCheckCallsCountAggSum = all.SyntheticsBrowserCheckCallsCountAggSum + o.SyntheticsCheckCallsCountAggSum = all.SyntheticsCheckCallsCountAggSum + o.TraceSearchIndexedEventsCountAggSum = all.TraceSearchIndexedEventsCountAggSum + o.TwolIngestedEventsBytesAggSum = all.TwolIngestedEventsBytesAggSum + o.Usage = all.Usage + o.VsphereHostTop99pSum = all.VsphereHostTop99pSum + return nil +} diff --git a/api/v1/datadog/model_usage_synthetics_api_hour.go b/api/v1/datadog/model_usage_synthetics_api_hour.go new file mode 100644 index 00000000000..17dfafdbc69 --- /dev/null +++ b/api/v1/datadog/model_usage_synthetics_api_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageSyntheticsAPIHour Number of Synthetics API tests run for each hour for a given organization. +type UsageSyntheticsAPIHour struct { + // Contains the number of Synthetics API tests run. + CheckCallsCount *int64 `json:"check_calls_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageSyntheticsAPIHour instantiates a new UsageSyntheticsAPIHour 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 NewUsageSyntheticsAPIHour() *UsageSyntheticsAPIHour { + this := UsageSyntheticsAPIHour{} + return &this +} + +// NewUsageSyntheticsAPIHourWithDefaults instantiates a new UsageSyntheticsAPIHour 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 NewUsageSyntheticsAPIHourWithDefaults() *UsageSyntheticsAPIHour { + this := UsageSyntheticsAPIHour{} + return &this +} + +// GetCheckCallsCount returns the CheckCallsCount field value if set, zero value otherwise. +func (o *UsageSyntheticsAPIHour) GetCheckCallsCount() int64 { + if o == nil || o.CheckCallsCount == nil { + var ret int64 + return ret + } + return *o.CheckCallsCount +} + +// GetCheckCallsCountOk returns a tuple with the CheckCallsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsAPIHour) GetCheckCallsCountOk() (*int64, bool) { + if o == nil || o.CheckCallsCount == nil { + return nil, false + } + return o.CheckCallsCount, true +} + +// HasCheckCallsCount returns a boolean if a field has been set. +func (o *UsageSyntheticsAPIHour) HasCheckCallsCount() bool { + if o != nil && o.CheckCallsCount != nil { + return true + } + + return false +} + +// SetCheckCallsCount gets a reference to the given int64 and assigns it to the CheckCallsCount field. +func (o *UsageSyntheticsAPIHour) SetCheckCallsCount(v int64) { + o.CheckCallsCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageSyntheticsAPIHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsAPIHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageSyntheticsAPIHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageSyntheticsAPIHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageSyntheticsAPIHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsAPIHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageSyntheticsAPIHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageSyntheticsAPIHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageSyntheticsAPIHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsAPIHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageSyntheticsAPIHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageSyntheticsAPIHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSyntheticsAPIHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CheckCallsCount != nil { + toSerialize["check_calls_count"] = o.CheckCallsCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSyntheticsAPIHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CheckCallsCount *int64 `json:"check_calls_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CheckCallsCount = all.CheckCallsCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_synthetics_api_response.go b/api/v1/datadog/model_usage_synthetics_api_response.go new file mode 100644 index 00000000000..5b125757397 --- /dev/null +++ b/api/v1/datadog/model_usage_synthetics_api_response.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 datadog + +import ( + "encoding/json" +) + +// UsageSyntheticsAPIResponse Response containing the number of Synthetics API tests run for each hour for a given organization. +type UsageSyntheticsAPIResponse struct { + // Get hourly usage for Synthetics API tests. + Usage []UsageSyntheticsAPIHour `json:"usage,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{} +} + +// NewUsageSyntheticsAPIResponse instantiates a new UsageSyntheticsAPIResponse 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 NewUsageSyntheticsAPIResponse() *UsageSyntheticsAPIResponse { + this := UsageSyntheticsAPIResponse{} + return &this +} + +// NewUsageSyntheticsAPIResponseWithDefaults instantiates a new UsageSyntheticsAPIResponse 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 NewUsageSyntheticsAPIResponseWithDefaults() *UsageSyntheticsAPIResponse { + this := UsageSyntheticsAPIResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageSyntheticsAPIResponse) GetUsage() []UsageSyntheticsAPIHour { + if o == nil || o.Usage == nil { + var ret []UsageSyntheticsAPIHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsAPIResponse) GetUsageOk() (*[]UsageSyntheticsAPIHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageSyntheticsAPIResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageSyntheticsAPIHour and assigns it to the Usage field. +func (o *UsageSyntheticsAPIResponse) SetUsage(v []UsageSyntheticsAPIHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSyntheticsAPIResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSyntheticsAPIResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageSyntheticsAPIHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_synthetics_browser_hour.go b/api/v1/datadog/model_usage_synthetics_browser_hour.go new file mode 100644 index 00000000000..67820307e35 --- /dev/null +++ b/api/v1/datadog/model_usage_synthetics_browser_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageSyntheticsBrowserHour Number of Synthetics Browser tests run for each hour for a given organization. +type UsageSyntheticsBrowserHour struct { + // Contains the number of Synthetics Browser tests run. + BrowserCheckCallsCount *int64 `json:"browser_check_calls_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageSyntheticsBrowserHour instantiates a new UsageSyntheticsBrowserHour 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 NewUsageSyntheticsBrowserHour() *UsageSyntheticsBrowserHour { + this := UsageSyntheticsBrowserHour{} + return &this +} + +// NewUsageSyntheticsBrowserHourWithDefaults instantiates a new UsageSyntheticsBrowserHour 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 NewUsageSyntheticsBrowserHourWithDefaults() *UsageSyntheticsBrowserHour { + this := UsageSyntheticsBrowserHour{} + return &this +} + +// GetBrowserCheckCallsCount returns the BrowserCheckCallsCount field value if set, zero value otherwise. +func (o *UsageSyntheticsBrowserHour) GetBrowserCheckCallsCount() int64 { + if o == nil || o.BrowserCheckCallsCount == nil { + var ret int64 + return ret + } + return *o.BrowserCheckCallsCount +} + +// GetBrowserCheckCallsCountOk returns a tuple with the BrowserCheckCallsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsBrowserHour) GetBrowserCheckCallsCountOk() (*int64, bool) { + if o == nil || o.BrowserCheckCallsCount == nil { + return nil, false + } + return o.BrowserCheckCallsCount, true +} + +// HasBrowserCheckCallsCount returns a boolean if a field has been set. +func (o *UsageSyntheticsBrowserHour) HasBrowserCheckCallsCount() bool { + if o != nil && o.BrowserCheckCallsCount != nil { + return true + } + + return false +} + +// SetBrowserCheckCallsCount gets a reference to the given int64 and assigns it to the BrowserCheckCallsCount field. +func (o *UsageSyntheticsBrowserHour) SetBrowserCheckCallsCount(v int64) { + o.BrowserCheckCallsCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageSyntheticsBrowserHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsBrowserHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageSyntheticsBrowserHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageSyntheticsBrowserHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageSyntheticsBrowserHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsBrowserHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageSyntheticsBrowserHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageSyntheticsBrowserHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageSyntheticsBrowserHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsBrowserHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageSyntheticsBrowserHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageSyntheticsBrowserHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSyntheticsBrowserHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BrowserCheckCallsCount != nil { + toSerialize["browser_check_calls_count"] = o.BrowserCheckCallsCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSyntheticsBrowserHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BrowserCheckCallsCount *int64 `json:"browser_check_calls_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BrowserCheckCallsCount = all.BrowserCheckCallsCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_synthetics_browser_response.go b/api/v1/datadog/model_usage_synthetics_browser_response.go new file mode 100644 index 00000000000..3315a2c0892 --- /dev/null +++ b/api/v1/datadog/model_usage_synthetics_browser_response.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 datadog + +import ( + "encoding/json" +) + +// UsageSyntheticsBrowserResponse Response containing the number of Synthetics Browser tests run for each hour for a given organization. +type UsageSyntheticsBrowserResponse struct { + // Get hourly usage for Synthetics Browser tests. + Usage []UsageSyntheticsBrowserHour `json:"usage,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{} +} + +// NewUsageSyntheticsBrowserResponse instantiates a new UsageSyntheticsBrowserResponse 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 NewUsageSyntheticsBrowserResponse() *UsageSyntheticsBrowserResponse { + this := UsageSyntheticsBrowserResponse{} + return &this +} + +// NewUsageSyntheticsBrowserResponseWithDefaults instantiates a new UsageSyntheticsBrowserResponse 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 NewUsageSyntheticsBrowserResponseWithDefaults() *UsageSyntheticsBrowserResponse { + this := UsageSyntheticsBrowserResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageSyntheticsBrowserResponse) GetUsage() []UsageSyntheticsBrowserHour { + if o == nil || o.Usage == nil { + var ret []UsageSyntheticsBrowserHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsBrowserResponse) GetUsageOk() (*[]UsageSyntheticsBrowserHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageSyntheticsBrowserResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageSyntheticsBrowserHour and assigns it to the Usage field. +func (o *UsageSyntheticsBrowserResponse) SetUsage(v []UsageSyntheticsBrowserHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSyntheticsBrowserResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSyntheticsBrowserResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageSyntheticsBrowserHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_synthetics_hour.go b/api/v1/datadog/model_usage_synthetics_hour.go new file mode 100644 index 00000000000..c1da0709c14 --- /dev/null +++ b/api/v1/datadog/model_usage_synthetics_hour.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageSyntheticsHour The number of synthetics tests run for each hour for a given organization. +type UsageSyntheticsHour struct { + // Contains the number of Synthetics API tests run. + CheckCallsCount *int64 `json:"check_calls_count,omitempty"` + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageSyntheticsHour instantiates a new UsageSyntheticsHour 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 NewUsageSyntheticsHour() *UsageSyntheticsHour { + this := UsageSyntheticsHour{} + return &this +} + +// NewUsageSyntheticsHourWithDefaults instantiates a new UsageSyntheticsHour 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 NewUsageSyntheticsHourWithDefaults() *UsageSyntheticsHour { + this := UsageSyntheticsHour{} + return &this +} + +// GetCheckCallsCount returns the CheckCallsCount field value if set, zero value otherwise. +func (o *UsageSyntheticsHour) GetCheckCallsCount() int64 { + if o == nil || o.CheckCallsCount == nil { + var ret int64 + return ret + } + return *o.CheckCallsCount +} + +// GetCheckCallsCountOk returns a tuple with the CheckCallsCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsHour) GetCheckCallsCountOk() (*int64, bool) { + if o == nil || o.CheckCallsCount == nil { + return nil, false + } + return o.CheckCallsCount, true +} + +// HasCheckCallsCount returns a boolean if a field has been set. +func (o *UsageSyntheticsHour) HasCheckCallsCount() bool { + if o != nil && o.CheckCallsCount != nil { + return true + } + + return false +} + +// SetCheckCallsCount gets a reference to the given int64 and assigns it to the CheckCallsCount field. +func (o *UsageSyntheticsHour) SetCheckCallsCount(v int64) { + o.CheckCallsCount = &v +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageSyntheticsHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageSyntheticsHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageSyntheticsHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageSyntheticsHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageSyntheticsHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageSyntheticsHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageSyntheticsHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageSyntheticsHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageSyntheticsHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSyntheticsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CheckCallsCount != nil { + toSerialize["check_calls_count"] = o.CheckCallsCount + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSyntheticsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CheckCallsCount *int64 `json:"check_calls_count,omitempty"` + Hour *time.Time `json:"hour,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CheckCallsCount = all.CheckCallsCount + o.Hour = all.Hour + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_synthetics_response.go b/api/v1/datadog/model_usage_synthetics_response.go new file mode 100644 index 00000000000..6d9415bea39 --- /dev/null +++ b/api/v1/datadog/model_usage_synthetics_response.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 datadog + +import ( + "encoding/json" +) + +// UsageSyntheticsResponse Response containing the number of Synthetics API tests run for each hour for a given organization. +type UsageSyntheticsResponse struct { + // Array with the number of hourly Synthetics test run for a given organization. + Usage []UsageSyntheticsHour `json:"usage,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{} +} + +// NewUsageSyntheticsResponse instantiates a new UsageSyntheticsResponse 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 NewUsageSyntheticsResponse() *UsageSyntheticsResponse { + this := UsageSyntheticsResponse{} + return &this +} + +// NewUsageSyntheticsResponseWithDefaults instantiates a new UsageSyntheticsResponse 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 NewUsageSyntheticsResponseWithDefaults() *UsageSyntheticsResponse { + this := UsageSyntheticsResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageSyntheticsResponse) GetUsage() []UsageSyntheticsHour { + if o == nil || o.Usage == nil { + var ret []UsageSyntheticsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageSyntheticsResponse) GetUsageOk() (*[]UsageSyntheticsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageSyntheticsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageSyntheticsHour and assigns it to the Usage field. +func (o *UsageSyntheticsResponse) SetUsage(v []UsageSyntheticsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageSyntheticsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageSyntheticsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageSyntheticsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_timeseries_hour.go b/api/v1/datadog/model_usage_timeseries_hour.go new file mode 100644 index 00000000000..a32d62de3e8 --- /dev/null +++ b/api/v1/datadog/model_usage_timeseries_hour.go @@ -0,0 +1,302 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageTimeseriesHour The hourly usage of timeseries. +type UsageTimeseriesHour struct { + // The hour for the usage. + Hour *time.Time `json:"hour,omitempty"` + // Contains the number of custom metrics that are inputs for aggregations (metric configured is custom). + NumCustomInputTimeseries *int64 `json:"num_custom_input_timeseries,omitempty"` + // Contains the number of custom metrics that are outputs for aggregations (metric configured is custom). + NumCustomOutputTimeseries *int64 `json:"num_custom_output_timeseries,omitempty"` + // Contains sum of non-aggregation custom metrics and custom metrics that are outputs for aggregations. + NumCustomTimeseries *int64 `json:"num_custom_timeseries,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,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{} +} + +// NewUsageTimeseriesHour instantiates a new UsageTimeseriesHour 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 NewUsageTimeseriesHour() *UsageTimeseriesHour { + this := UsageTimeseriesHour{} + return &this +} + +// NewUsageTimeseriesHourWithDefaults instantiates a new UsageTimeseriesHour 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 NewUsageTimeseriesHourWithDefaults() *UsageTimeseriesHour { + this := UsageTimeseriesHour{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *UsageTimeseriesHour) GetHour() time.Time { + if o == nil || o.Hour == nil { + var ret time.Time + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeseriesHour) GetHourOk() (*time.Time, bool) { + if o == nil || o.Hour == nil { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *UsageTimeseriesHour) HasHour() bool { + if o != nil && o.Hour != nil { + return true + } + + return false +} + +// SetHour gets a reference to the given time.Time and assigns it to the Hour field. +func (o *UsageTimeseriesHour) SetHour(v time.Time) { + o.Hour = &v +} + +// GetNumCustomInputTimeseries returns the NumCustomInputTimeseries field value if set, zero value otherwise. +func (o *UsageTimeseriesHour) GetNumCustomInputTimeseries() int64 { + if o == nil || o.NumCustomInputTimeseries == nil { + var ret int64 + return ret + } + return *o.NumCustomInputTimeseries +} + +// GetNumCustomInputTimeseriesOk returns a tuple with the NumCustomInputTimeseries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeseriesHour) GetNumCustomInputTimeseriesOk() (*int64, bool) { + if o == nil || o.NumCustomInputTimeseries == nil { + return nil, false + } + return o.NumCustomInputTimeseries, true +} + +// HasNumCustomInputTimeseries returns a boolean if a field has been set. +func (o *UsageTimeseriesHour) HasNumCustomInputTimeseries() bool { + if o != nil && o.NumCustomInputTimeseries != nil { + return true + } + + return false +} + +// SetNumCustomInputTimeseries gets a reference to the given int64 and assigns it to the NumCustomInputTimeseries field. +func (o *UsageTimeseriesHour) SetNumCustomInputTimeseries(v int64) { + o.NumCustomInputTimeseries = &v +} + +// GetNumCustomOutputTimeseries returns the NumCustomOutputTimeseries field value if set, zero value otherwise. +func (o *UsageTimeseriesHour) GetNumCustomOutputTimeseries() int64 { + if o == nil || o.NumCustomOutputTimeseries == nil { + var ret int64 + return ret + } + return *o.NumCustomOutputTimeseries +} + +// GetNumCustomOutputTimeseriesOk returns a tuple with the NumCustomOutputTimeseries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeseriesHour) GetNumCustomOutputTimeseriesOk() (*int64, bool) { + if o == nil || o.NumCustomOutputTimeseries == nil { + return nil, false + } + return o.NumCustomOutputTimeseries, true +} + +// HasNumCustomOutputTimeseries returns a boolean if a field has been set. +func (o *UsageTimeseriesHour) HasNumCustomOutputTimeseries() bool { + if o != nil && o.NumCustomOutputTimeseries != nil { + return true + } + + return false +} + +// SetNumCustomOutputTimeseries gets a reference to the given int64 and assigns it to the NumCustomOutputTimeseries field. +func (o *UsageTimeseriesHour) SetNumCustomOutputTimeseries(v int64) { + o.NumCustomOutputTimeseries = &v +} + +// GetNumCustomTimeseries returns the NumCustomTimeseries field value if set, zero value otherwise. +func (o *UsageTimeseriesHour) GetNumCustomTimeseries() int64 { + if o == nil || o.NumCustomTimeseries == nil { + var ret int64 + return ret + } + return *o.NumCustomTimeseries +} + +// GetNumCustomTimeseriesOk returns a tuple with the NumCustomTimeseries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeseriesHour) GetNumCustomTimeseriesOk() (*int64, bool) { + if o == nil || o.NumCustomTimeseries == nil { + return nil, false + } + return o.NumCustomTimeseries, true +} + +// HasNumCustomTimeseries returns a boolean if a field has been set. +func (o *UsageTimeseriesHour) HasNumCustomTimeseries() bool { + if o != nil && o.NumCustomTimeseries != nil { + return true + } + + return false +} + +// SetNumCustomTimeseries gets a reference to the given int64 and assigns it to the NumCustomTimeseries field. +func (o *UsageTimeseriesHour) SetNumCustomTimeseries(v int64) { + o.NumCustomTimeseries = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageTimeseriesHour) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeseriesHour) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageTimeseriesHour) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageTimeseriesHour) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageTimeseriesHour) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeseriesHour) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageTimeseriesHour) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageTimeseriesHour) SetPublicId(v string) { + o.PublicId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageTimeseriesHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Hour != nil { + if o.Hour.Nanosecond() == 0 { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["hour"] = o.Hour.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.NumCustomInputTimeseries != nil { + toSerialize["num_custom_input_timeseries"] = o.NumCustomInputTimeseries + } + if o.NumCustomOutputTimeseries != nil { + toSerialize["num_custom_output_timeseries"] = o.NumCustomOutputTimeseries + } + if o.NumCustomTimeseries != nil { + toSerialize["num_custom_timeseries"] = o.NumCustomTimeseries + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageTimeseriesHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Hour *time.Time `json:"hour,omitempty"` + NumCustomInputTimeseries *int64 `json:"num_custom_input_timeseries,omitempty"` + NumCustomOutputTimeseries *int64 `json:"num_custom_output_timeseries,omitempty"` + NumCustomTimeseries *int64 `json:"num_custom_timeseries,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Hour = all.Hour + o.NumCustomInputTimeseries = all.NumCustomInputTimeseries + o.NumCustomOutputTimeseries = all.NumCustomOutputTimeseries + o.NumCustomTimeseries = all.NumCustomTimeseries + o.OrgName = all.OrgName + o.PublicId = all.PublicId + return nil +} diff --git a/api/v1/datadog/model_usage_timeseries_response.go b/api/v1/datadog/model_usage_timeseries_response.go new file mode 100644 index 00000000000..6619e410066 --- /dev/null +++ b/api/v1/datadog/model_usage_timeseries_response.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 datadog + +import ( + "encoding/json" +) + +// UsageTimeseriesResponse Response containing hourly usage of timeseries. +type UsageTimeseriesResponse struct { + // An array of objects regarding hourly usage of timeseries. + Usage []UsageTimeseriesHour `json:"usage,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{} +} + +// NewUsageTimeseriesResponse instantiates a new UsageTimeseriesResponse 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 NewUsageTimeseriesResponse() *UsageTimeseriesResponse { + this := UsageTimeseriesResponse{} + return &this +} + +// NewUsageTimeseriesResponseWithDefaults instantiates a new UsageTimeseriesResponse 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 NewUsageTimeseriesResponseWithDefaults() *UsageTimeseriesResponse { + this := UsageTimeseriesResponse{} + return &this +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageTimeseriesResponse) GetUsage() []UsageTimeseriesHour { + if o == nil || o.Usage == nil { + var ret []UsageTimeseriesHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeseriesResponse) GetUsageOk() (*[]UsageTimeseriesHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageTimeseriesResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageTimeseriesHour and assigns it to the Usage field. +func (o *UsageTimeseriesResponse) SetUsage(v []UsageTimeseriesHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageTimeseriesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageTimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Usage []UsageTimeseriesHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_hour.go b/api/v1/datadog/model_usage_top_avg_metrics_hour.go new file mode 100644 index 00000000000..b2358e09f09 --- /dev/null +++ b/api/v1/datadog/model_usage_top_avg_metrics_hour.go @@ -0,0 +1,227 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageTopAvgMetricsHour Number of hourly recorded custom metrics for a given organization. +type UsageTopAvgMetricsHour struct { + // Average number of timeseries per hour in which the metric occurs. + AvgMetricHour *int64 `json:"avg_metric_hour,omitempty"` + // Maximum number of timeseries per hour in which the metric occurs. + MaxMetricHour *int64 `json:"max_metric_hour,omitempty"` + // Contains the metric category. + MetricCategory *UsageMetricCategory `json:"metric_category,omitempty"` + // Contains the custom metric name. + MetricName *string `json:"metric_name,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{} +} + +// NewUsageTopAvgMetricsHour instantiates a new UsageTopAvgMetricsHour 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 NewUsageTopAvgMetricsHour() *UsageTopAvgMetricsHour { + this := UsageTopAvgMetricsHour{} + return &this +} + +// NewUsageTopAvgMetricsHourWithDefaults instantiates a new UsageTopAvgMetricsHour 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 NewUsageTopAvgMetricsHourWithDefaults() *UsageTopAvgMetricsHour { + this := UsageTopAvgMetricsHour{} + return &this +} + +// GetAvgMetricHour returns the AvgMetricHour field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsHour) GetAvgMetricHour() int64 { + if o == nil || o.AvgMetricHour == nil { + var ret int64 + return ret + } + return *o.AvgMetricHour +} + +// GetAvgMetricHourOk returns a tuple with the AvgMetricHour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsHour) GetAvgMetricHourOk() (*int64, bool) { + if o == nil || o.AvgMetricHour == nil { + return nil, false + } + return o.AvgMetricHour, true +} + +// HasAvgMetricHour returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsHour) HasAvgMetricHour() bool { + if o != nil && o.AvgMetricHour != nil { + return true + } + + return false +} + +// SetAvgMetricHour gets a reference to the given int64 and assigns it to the AvgMetricHour field. +func (o *UsageTopAvgMetricsHour) SetAvgMetricHour(v int64) { + o.AvgMetricHour = &v +} + +// GetMaxMetricHour returns the MaxMetricHour field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsHour) GetMaxMetricHour() int64 { + if o == nil || o.MaxMetricHour == nil { + var ret int64 + return ret + } + return *o.MaxMetricHour +} + +// GetMaxMetricHourOk returns a tuple with the MaxMetricHour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsHour) GetMaxMetricHourOk() (*int64, bool) { + if o == nil || o.MaxMetricHour == nil { + return nil, false + } + return o.MaxMetricHour, true +} + +// HasMaxMetricHour returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsHour) HasMaxMetricHour() bool { + if o != nil && o.MaxMetricHour != nil { + return true + } + + return false +} + +// SetMaxMetricHour gets a reference to the given int64 and assigns it to the MaxMetricHour field. +func (o *UsageTopAvgMetricsHour) SetMaxMetricHour(v int64) { + o.MaxMetricHour = &v +} + +// GetMetricCategory returns the MetricCategory field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsHour) GetMetricCategory() UsageMetricCategory { + if o == nil || o.MetricCategory == nil { + var ret UsageMetricCategory + return ret + } + return *o.MetricCategory +} + +// GetMetricCategoryOk returns a tuple with the MetricCategory field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsHour) GetMetricCategoryOk() (*UsageMetricCategory, bool) { + if o == nil || o.MetricCategory == nil { + return nil, false + } + return o.MetricCategory, true +} + +// HasMetricCategory returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsHour) HasMetricCategory() bool { + if o != nil && o.MetricCategory != nil { + return true + } + + return false +} + +// SetMetricCategory gets a reference to the given UsageMetricCategory and assigns it to the MetricCategory field. +func (o *UsageTopAvgMetricsHour) SetMetricCategory(v UsageMetricCategory) { + o.MetricCategory = &v +} + +// GetMetricName returns the MetricName field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsHour) GetMetricName() string { + if o == nil || o.MetricName == nil { + var ret string + return ret + } + return *o.MetricName +} + +// GetMetricNameOk returns a tuple with the MetricName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsHour) GetMetricNameOk() (*string, bool) { + if o == nil || o.MetricName == nil { + return nil, false + } + return o.MetricName, true +} + +// HasMetricName returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsHour) HasMetricName() bool { + if o != nil && o.MetricName != nil { + return true + } + + return false +} + +// SetMetricName gets a reference to the given string and assigns it to the MetricName field. +func (o *UsageTopAvgMetricsHour) SetMetricName(v string) { + o.MetricName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageTopAvgMetricsHour) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AvgMetricHour != nil { + toSerialize["avg_metric_hour"] = o.AvgMetricHour + } + if o.MaxMetricHour != nil { + toSerialize["max_metric_hour"] = o.MaxMetricHour + } + if o.MetricCategory != nil { + toSerialize["metric_category"] = o.MetricCategory + } + if o.MetricName != nil { + toSerialize["metric_name"] = o.MetricName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageTopAvgMetricsHour) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AvgMetricHour *int64 `json:"avg_metric_hour,omitempty"` + MaxMetricHour *int64 `json:"max_metric_hour,omitempty"` + MetricCategory *UsageMetricCategory `json:"metric_category,omitempty"` + MetricName *string `json:"metric_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.MetricCategory; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AvgMetricHour = all.AvgMetricHour + o.MaxMetricHour = all.MaxMetricHour + o.MetricCategory = all.MetricCategory + o.MetricName = all.MetricName + return nil +} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_metadata.go b/api/v1/datadog/model_usage_top_avg_metrics_metadata.go new file mode 100644 index 00000000000..12710ec2291 --- /dev/null +++ b/api/v1/datadog/model_usage_top_avg_metrics_metadata.go @@ -0,0 +1,196 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UsageTopAvgMetricsMetadata The object containing document metadata. +type UsageTopAvgMetricsMetadata struct { + // The day value from the user request that contains the returned usage data. (If day was used the request) + Day *time.Time `json:"day,omitempty"` + // The month value from the user request that contains the returned usage data. (If month was used the request) + Month *time.Time `json:"month,omitempty"` + // The metadata for the current pagination. + Pagination *UsageTopAvgMetricsPagination `json:"pagination,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{} +} + +// NewUsageTopAvgMetricsMetadata instantiates a new UsageTopAvgMetricsMetadata 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 NewUsageTopAvgMetricsMetadata() *UsageTopAvgMetricsMetadata { + this := UsageTopAvgMetricsMetadata{} + return &this +} + +// NewUsageTopAvgMetricsMetadataWithDefaults instantiates a new UsageTopAvgMetricsMetadata 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 NewUsageTopAvgMetricsMetadataWithDefaults() *UsageTopAvgMetricsMetadata { + this := UsageTopAvgMetricsMetadata{} + return &this +} + +// GetDay returns the Day field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsMetadata) GetDay() time.Time { + if o == nil || o.Day == nil { + var ret time.Time + return ret + } + return *o.Day +} + +// GetDayOk returns a tuple with the Day field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsMetadata) GetDayOk() (*time.Time, bool) { + if o == nil || o.Day == nil { + return nil, false + } + return o.Day, true +} + +// HasDay returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsMetadata) HasDay() bool { + if o != nil && o.Day != nil { + return true + } + + return false +} + +// SetDay gets a reference to the given time.Time and assigns it to the Day field. +func (o *UsageTopAvgMetricsMetadata) SetDay(v time.Time) { + o.Day = &v +} + +// GetMonth returns the Month field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsMetadata) GetMonth() time.Time { + if o == nil || o.Month == nil { + var ret time.Time + return ret + } + return *o.Month +} + +// GetMonthOk returns a tuple with the Month field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsMetadata) GetMonthOk() (*time.Time, bool) { + if o == nil || o.Month == nil { + return nil, false + } + return o.Month, true +} + +// HasMonth returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsMetadata) HasMonth() bool { + if o != nil && o.Month != nil { + return true + } + + return false +} + +// SetMonth gets a reference to the given time.Time and assigns it to the Month field. +func (o *UsageTopAvgMetricsMetadata) SetMonth(v time.Time) { + o.Month = &v +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsMetadata) GetPagination() UsageTopAvgMetricsPagination { + if o == nil || o.Pagination == nil { + var ret UsageTopAvgMetricsPagination + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsMetadata) GetPaginationOk() (*UsageTopAvgMetricsPagination, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsMetadata) HasPagination() bool { + if o != nil && o.Pagination != nil { + return true + } + + return false +} + +// SetPagination gets a reference to the given UsageTopAvgMetricsPagination and assigns it to the Pagination field. +func (o *UsageTopAvgMetricsMetadata) SetPagination(v UsageTopAvgMetricsPagination) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageTopAvgMetricsMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Day != nil { + if o.Day.Nanosecond() == 0 { + toSerialize["day"] = o.Day.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["day"] = o.Day.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Month != nil { + if o.Month.Nanosecond() == 0 { + toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["month"] = o.Month.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageTopAvgMetricsMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Day *time.Time `json:"day,omitempty"` + Month *time.Time `json:"month,omitempty"` + Pagination *UsageTopAvgMetricsPagination `json:"pagination,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Day = all.Day + o.Month = all.Month + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pagination = all.Pagination + return nil +} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_pagination.go b/api/v1/datadog/model_usage_top_avg_metrics_pagination.go new file mode 100644 index 00000000000..cf69c9a6752 --- /dev/null +++ b/api/v1/datadog/model_usage_top_avg_metrics_pagination.go @@ -0,0 +1,193 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsageTopAvgMetricsPagination The metadata for the current pagination. +type UsageTopAvgMetricsPagination struct { + // Maximum amount of records to be returned. + Limit *int64 `json:"limit,omitempty"` + // The cursor to get the next results (if any). To make the next request, use the same parameters and add `next_record_id`. + NextRecordId common.NullableString `json:"next_record_id,omitempty"` + // Total number of records. + TotalNumberOfRecords *int64 `json:"total_number_of_records,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{} +} + +// NewUsageTopAvgMetricsPagination instantiates a new UsageTopAvgMetricsPagination 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 NewUsageTopAvgMetricsPagination() *UsageTopAvgMetricsPagination { + this := UsageTopAvgMetricsPagination{} + return &this +} + +// NewUsageTopAvgMetricsPaginationWithDefaults instantiates a new UsageTopAvgMetricsPagination 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 NewUsageTopAvgMetricsPaginationWithDefaults() *UsageTopAvgMetricsPagination { + this := UsageTopAvgMetricsPagination{} + return &this +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsPagination) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsPagination) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsPagination) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *UsageTopAvgMetricsPagination) SetLimit(v int64) { + o.Limit = &v +} + +// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageTopAvgMetricsPagination) GetNextRecordId() string { + if o == nil || o.NextRecordId.Get() == nil { + var ret string + return ret + } + return *o.NextRecordId.Get() +} + +// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *UsageTopAvgMetricsPagination) GetNextRecordIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NextRecordId.Get(), o.NextRecordId.IsSet() +} + +// HasNextRecordId returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsPagination) HasNextRecordId() bool { + if o != nil && o.NextRecordId.IsSet() { + return true + } + + return false +} + +// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. +func (o *UsageTopAvgMetricsPagination) SetNextRecordId(v string) { + o.NextRecordId.Set(&v) +} + +// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. +func (o *UsageTopAvgMetricsPagination) SetNextRecordIdNil() { + o.NextRecordId.Set(nil) +} + +// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. +func (o *UsageTopAvgMetricsPagination) UnsetNextRecordId() { + o.NextRecordId.Unset() +} + +// GetTotalNumberOfRecords returns the TotalNumberOfRecords field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsPagination) GetTotalNumberOfRecords() int64 { + if o == nil || o.TotalNumberOfRecords == nil { + var ret int64 + return ret + } + return *o.TotalNumberOfRecords +} + +// GetTotalNumberOfRecordsOk returns a tuple with the TotalNumberOfRecords field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsPagination) GetTotalNumberOfRecordsOk() (*int64, bool) { + if o == nil || o.TotalNumberOfRecords == nil { + return nil, false + } + return o.TotalNumberOfRecords, true +} + +// HasTotalNumberOfRecords returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsPagination) HasTotalNumberOfRecords() bool { + if o != nil && o.TotalNumberOfRecords != nil { + return true + } + + return false +} + +// SetTotalNumberOfRecords gets a reference to the given int64 and assigns it to the TotalNumberOfRecords field. +func (o *UsageTopAvgMetricsPagination) SetTotalNumberOfRecords(v int64) { + o.TotalNumberOfRecords = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageTopAvgMetricsPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.NextRecordId.IsSet() { + toSerialize["next_record_id"] = o.NextRecordId.Get() + } + if o.TotalNumberOfRecords != nil { + toSerialize["total_number_of_records"] = o.TotalNumberOfRecords + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageTopAvgMetricsPagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Limit *int64 `json:"limit,omitempty"` + NextRecordId common.NullableString `json:"next_record_id,omitempty"` + TotalNumberOfRecords *int64 `json:"total_number_of_records,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Limit = all.Limit + o.NextRecordId = all.NextRecordId + o.TotalNumberOfRecords = all.TotalNumberOfRecords + return nil +} diff --git a/api/v1/datadog/model_usage_top_avg_metrics_response.go b/api/v1/datadog/model_usage_top_avg_metrics_response.go new file mode 100644 index 00000000000..f2e87d301ae --- /dev/null +++ b/api/v1/datadog/model_usage_top_avg_metrics_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 datadog + +import ( + "encoding/json" +) + +// UsageTopAvgMetricsResponse Response containing the number of hourly recorded custom metrics for a given organization. +type UsageTopAvgMetricsResponse struct { + // The object containing document metadata. + Metadata *UsageTopAvgMetricsMetadata `json:"metadata,omitempty"` + // Number of hourly recorded custom metrics for a given organization. + Usage []UsageTopAvgMetricsHour `json:"usage,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{} +} + +// NewUsageTopAvgMetricsResponse instantiates a new UsageTopAvgMetricsResponse 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 NewUsageTopAvgMetricsResponse() *UsageTopAvgMetricsResponse { + this := UsageTopAvgMetricsResponse{} + return &this +} + +// NewUsageTopAvgMetricsResponseWithDefaults instantiates a new UsageTopAvgMetricsResponse 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 NewUsageTopAvgMetricsResponseWithDefaults() *UsageTopAvgMetricsResponse { + this := UsageTopAvgMetricsResponse{} + return &this +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsResponse) GetMetadata() UsageTopAvgMetricsMetadata { + if o == nil || o.Metadata == nil { + var ret UsageTopAvgMetricsMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsResponse) GetMetadataOk() (*UsageTopAvgMetricsMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsResponse) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given UsageTopAvgMetricsMetadata and assigns it to the Metadata field. +func (o *UsageTopAvgMetricsResponse) SetMetadata(v UsageTopAvgMetricsMetadata) { + o.Metadata = &v +} + +// GetUsage returns the Usage field value if set, zero value otherwise. +func (o *UsageTopAvgMetricsResponse) GetUsage() []UsageTopAvgMetricsHour { + if o == nil || o.Usage == nil { + var ret []UsageTopAvgMetricsHour + return ret + } + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTopAvgMetricsResponse) GetUsageOk() (*[]UsageTopAvgMetricsHour, bool) { + if o == nil || o.Usage == nil { + return nil, false + } + return &o.Usage, true +} + +// HasUsage returns a boolean if a field has been set. +func (o *UsageTopAvgMetricsResponse) HasUsage() bool { + if o != nil && o.Usage != nil { + return true + } + + return false +} + +// SetUsage gets a reference to the given []UsageTopAvgMetricsHour and assigns it to the Usage field. +func (o *UsageTopAvgMetricsResponse) SetUsage(v []UsageTopAvgMetricsHour) { + o.Usage = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageTopAvgMetricsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Usage != nil { + toSerialize["usage"] = o.Usage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageTopAvgMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Metadata *UsageTopAvgMetricsMetadata `json:"metadata,omitempty"` + Usage []UsageTopAvgMetricsHour `json:"usage,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Usage = all.Usage + return nil +} diff --git a/api/v1/datadog/model_user.go b/api/v1/datadog/model_user.go new file mode 100644 index 00000000000..eac80a9feae --- /dev/null +++ b/api/v1/datadog/model_user.go @@ -0,0 +1,348 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// User Create, edit, and disable users. +type User struct { + // The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user). + AccessRole *AccessRole `json:"access_role,omitempty"` + // The new disabled status of the user. + Disabled *bool `json:"disabled,omitempty"` + // The new email of the user. + Email *string `json:"email,omitempty"` + // The user handle, must be a valid email. + Handle *string `json:"handle,omitempty"` + // Gravatar icon associated to the user. + Icon *string `json:"icon,omitempty"` + // The name of the user. + Name *string `json:"name,omitempty"` + // Whether or not the user logged in Datadog at least once. + Verified *bool `json:"verified,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{} +} + +// NewUser instantiates a new User 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 NewUser() *User { + this := User{} + var accessRole AccessRole = ACCESSROLE_STANDARD + this.AccessRole = &accessRole + return &this +} + +// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User { + this := User{} + var accessRole AccessRole = ACCESSROLE_STANDARD + this.AccessRole = &accessRole + return &this +} + +// GetAccessRole returns the AccessRole field value if set, zero value otherwise. +func (o *User) GetAccessRole() AccessRole { + if o == nil || o.AccessRole == nil { + var ret AccessRole + return ret + } + return *o.AccessRole +} + +// GetAccessRoleOk returns a tuple with the AccessRole field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetAccessRoleOk() (*AccessRole, bool) { + if o == nil || o.AccessRole == nil { + return nil, false + } + return o.AccessRole, true +} + +// HasAccessRole returns a boolean if a field has been set. +func (o *User) HasAccessRole() bool { + if o != nil && o.AccessRole != nil { + return true + } + + return false +} + +// SetAccessRole gets a reference to the given AccessRole and assigns it to the AccessRole field. +func (o *User) SetAccessRole(v AccessRole) { + o.AccessRole = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *User) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *User) HasDisabled() bool { + if o != nil && o.Disabled != nil { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *User) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *User) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *User) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *User) SetEmail(v string) { + o.Email = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *User) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *User) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *User) SetHandle(v string) { + o.Handle = &v +} + +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *User) GetIcon() string { + if o == nil || o.Icon == nil { + var ret string + return ret + } + return *o.Icon +} + +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { + return nil, false + } + return o.Icon, true +} + +// HasIcon returns a boolean if a field has been set. +func (o *User) HasIcon() bool { + if o != nil && o.Icon != nil { + return true + } + + return false +} + +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *User) SetIcon(v string) { + o.Icon = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *User) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *User) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *User) SetName(v string) { + o.Name = &v +} + +// GetVerified returns the Verified field value if set, zero value otherwise. +func (o *User) GetVerified() bool { + if o == nil || o.Verified == nil { + var ret bool + return ret + } + return *o.Verified +} + +// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetVerifiedOk() (*bool, bool) { + if o == nil || o.Verified == nil { + return nil, false + } + return o.Verified, true +} + +// HasVerified returns a boolean if a field has been set. +func (o *User) HasVerified() bool { + if o != nil && o.Verified != nil { + return true + } + + return false +} + +// SetVerified gets a reference to the given bool and assigns it to the Verified field. +func (o *User) SetVerified(v bool) { + o.Verified = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o User) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AccessRole != nil { + toSerialize["access_role"] = o.AccessRole + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Verified != nil { + toSerialize["verified"] = o.Verified + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *User) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AccessRole *AccessRole `json:"access_role,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Icon *string `json:"icon,omitempty"` + Name *string `json:"name,omitempty"` + Verified *bool `json:"verified,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.AccessRole; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccessRole = all.AccessRole + o.Disabled = all.Disabled + o.Email = all.Email + o.Handle = all.Handle + o.Icon = all.Icon + o.Name = all.Name + o.Verified = all.Verified + return nil +} diff --git a/api/v1/datadog/model_user_disable_response.go b/api/v1/datadog/model_user_disable_response.go new file mode 100644 index 00000000000..e462c98dc60 --- /dev/null +++ b/api/v1/datadog/model_user_disable_response.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 datadog + +import ( + "encoding/json" +) + +// UserDisableResponse Array of user disabled for a given organization. +type UserDisableResponse struct { + // Information pertaining to a user disabled for a given organization. + Message *string `json:"message,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{} +} + +// NewUserDisableResponse instantiates a new UserDisableResponse 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 NewUserDisableResponse() *UserDisableResponse { + this := UserDisableResponse{} + return &this +} + +// NewUserDisableResponseWithDefaults instantiates a new UserDisableResponse 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 NewUserDisableResponseWithDefaults() *UserDisableResponse { + this := UserDisableResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *UserDisableResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserDisableResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *UserDisableResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *UserDisableResponse) SetMessage(v string) { + o.Message = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserDisableResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserDisableResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Message *string `json:"message,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Message = all.Message + return nil +} diff --git a/api/v1/datadog/model_user_list_response.go b/api/v1/datadog/model_user_list_response.go new file mode 100644 index 00000000000..0213ff32c30 --- /dev/null +++ b/api/v1/datadog/model_user_list_response.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 datadog + +import ( + "encoding/json" +) + +// UserListResponse Array of Datadog users for a given organization. +type UserListResponse struct { + // Array of users. + Users []User `json:"users,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{} +} + +// NewUserListResponse instantiates a new UserListResponse 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 NewUserListResponse() *UserListResponse { + this := UserListResponse{} + return &this +} + +// NewUserListResponseWithDefaults instantiates a new UserListResponse 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 NewUserListResponseWithDefaults() *UserListResponse { + this := UserListResponse{} + return &this +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *UserListResponse) GetUsers() []User { + if o == nil || o.Users == nil { + var ret []User + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserListResponse) GetUsersOk() (*[]User, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return &o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *UserListResponse) HasUsers() bool { + if o != nil && o.Users != nil { + return true + } + + return false +} + +// SetUsers gets a reference to the given []User and assigns it to the Users field. +func (o *UserListResponse) SetUsers(v []User) { + o.Users = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Users []User `json:"users,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Users = all.Users + return nil +} diff --git a/api/v1/datadog/model_user_response.go b/api/v1/datadog/model_user_response.go new file mode 100644 index 00000000000..5badd8f8ed6 --- /dev/null +++ b/api/v1/datadog/model_user_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UserResponse A Datadog User. +type UserResponse struct { + // Create, edit, and disable users. + User *User `json:"user,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{} +} + +// NewUserResponse instantiates a new UserResponse 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 NewUserResponse() *UserResponse { + this := UserResponse{} + return &this +} + +// NewUserResponseWithDefaults instantiates a new UserResponse 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 NewUserResponseWithDefaults() *UserResponse { + this := UserResponse{} + return &this +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *UserResponse) GetUser() User { + if o == nil || o.User == nil { + var ret User + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserResponse) GetUserOk() (*User, bool) { + if o == nil || o.User == nil { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *UserResponse) HasUser() bool { + if o != nil && o.User != nil { + return true + } + + return false +} + +// SetUser gets a reference to the given User and assigns it to the User field. +func (o *UserResponse) SetUser(v User) { + o.User = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.User != nil { + toSerialize["user"] = o.User + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + User *User `json:"user,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.User = all.User + return nil +} diff --git a/api/v1/datadog/model_webhooks_integration.go b/api/v1/datadog/model_webhooks_integration.go new file mode 100644 index 00000000000..ab4e1928c85 --- /dev/null +++ b/api/v1/datadog/model_webhooks_integration.go @@ -0,0 +1,295 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// WebhooksIntegration Datadog-Webhooks integration. +type WebhooksIntegration struct { + // If `null`, uses no header. + // If given a JSON payload, these will be headers attached to your webhook. + CustomHeaders common.NullableString `json:"custom_headers,omitempty"` + // Encoding type. Can be given either `json` or `form`. + EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` + // The name of the webhook. It corresponds with ``. + // Learn more on how to use it in + // [monitor notifications](https://docs.datadoghq.com/monitors/notify). + Name string `json:"name"` + // If `null`, uses the default payload. + // If given a JSON payload, the webhook returns the payload + // specified by the given payload. + // [Webhooks variable usage](https://docs.datadoghq.com/integrations/webhooks/#usage). + Payload common.NullableString `json:"payload,omitempty"` + // URL of the webhook. + Url string `json:"url"` + // 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{} +} + +// NewWebhooksIntegration instantiates a new WebhooksIntegration 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 NewWebhooksIntegration(name string, url string) *WebhooksIntegration { + this := WebhooksIntegration{} + var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON + this.EncodeAs = &encodeAs + this.Name = name + this.Url = url + return &this +} + +// NewWebhooksIntegrationWithDefaults instantiates a new WebhooksIntegration 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 NewWebhooksIntegrationWithDefaults() *WebhooksIntegration { + this := WebhooksIntegration{} + var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON + this.EncodeAs = &encodeAs + return &this +} + +// GetCustomHeaders returns the CustomHeaders field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebhooksIntegration) GetCustomHeaders() string { + if o == nil || o.CustomHeaders.Get() == nil { + var ret string + return ret + } + return *o.CustomHeaders.Get() +} + +// GetCustomHeadersOk returns a tuple with the CustomHeaders 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 *WebhooksIntegration) GetCustomHeadersOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CustomHeaders.Get(), o.CustomHeaders.IsSet() +} + +// HasCustomHeaders returns a boolean if a field has been set. +func (o *WebhooksIntegration) HasCustomHeaders() bool { + if o != nil && o.CustomHeaders.IsSet() { + return true + } + + return false +} + +// SetCustomHeaders gets a reference to the given common.NullableString and assigns it to the CustomHeaders field. +func (o *WebhooksIntegration) SetCustomHeaders(v string) { + o.CustomHeaders.Set(&v) +} + +// SetCustomHeadersNil sets the value for CustomHeaders to be an explicit nil. +func (o *WebhooksIntegration) SetCustomHeadersNil() { + o.CustomHeaders.Set(nil) +} + +// UnsetCustomHeaders ensures that no value is present for CustomHeaders, not even an explicit nil. +func (o *WebhooksIntegration) UnsetCustomHeaders() { + o.CustomHeaders.Unset() +} + +// GetEncodeAs returns the EncodeAs field value if set, zero value otherwise. +func (o *WebhooksIntegration) GetEncodeAs() WebhooksIntegrationEncoding { + if o == nil || o.EncodeAs == nil { + var ret WebhooksIntegrationEncoding + return ret + } + return *o.EncodeAs +} + +// GetEncodeAsOk returns a tuple with the EncodeAs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegration) GetEncodeAsOk() (*WebhooksIntegrationEncoding, bool) { + if o == nil || o.EncodeAs == nil { + return nil, false + } + return o.EncodeAs, true +} + +// HasEncodeAs returns a boolean if a field has been set. +func (o *WebhooksIntegration) HasEncodeAs() bool { + if o != nil && o.EncodeAs != nil { + return true + } + + return false +} + +// SetEncodeAs gets a reference to the given WebhooksIntegrationEncoding and assigns it to the EncodeAs field. +func (o *WebhooksIntegration) SetEncodeAs(v WebhooksIntegrationEncoding) { + o.EncodeAs = &v +} + +// GetName returns the Name field value. +func (o *WebhooksIntegration) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *WebhooksIntegration) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *WebhooksIntegration) SetName(v string) { + o.Name = v +} + +// GetPayload returns the Payload field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebhooksIntegration) GetPayload() string { + if o == nil || o.Payload.Get() == nil { + var ret string + return ret + } + return *o.Payload.Get() +} + +// GetPayloadOk returns a tuple with the Payload 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 *WebhooksIntegration) GetPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Payload.Get(), o.Payload.IsSet() +} + +// HasPayload returns a boolean if a field has been set. +func (o *WebhooksIntegration) HasPayload() bool { + if o != nil && o.Payload.IsSet() { + return true + } + + return false +} + +// SetPayload gets a reference to the given common.NullableString and assigns it to the Payload field. +func (o *WebhooksIntegration) SetPayload(v string) { + o.Payload.Set(&v) +} + +// SetPayloadNil sets the value for Payload to be an explicit nil. +func (o *WebhooksIntegration) SetPayloadNil() { + o.Payload.Set(nil) +} + +// UnsetPayload ensures that no value is present for Payload, not even an explicit nil. +func (o *WebhooksIntegration) UnsetPayload() { + o.Payload.Unset() +} + +// GetUrl returns the Url field value. +func (o *WebhooksIntegration) GetUrl() string { + if o == nil { + var ret string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *WebhooksIntegration) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value. +func (o *WebhooksIntegration) SetUrl(v string) { + o.Url = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WebhooksIntegration) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomHeaders.IsSet() { + toSerialize["custom_headers"] = o.CustomHeaders.Get() + } + if o.EncodeAs != nil { + toSerialize["encode_as"] = o.EncodeAs + } + toSerialize["name"] = o.Name + if o.Payload.IsSet() { + toSerialize["payload"] = o.Payload.Get() + } + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Url *string `json:"url"` + }{} + all := struct { + CustomHeaders common.NullableString `json:"custom_headers,omitempty"` + EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` + Name string `json:"name"` + Payload common.NullableString `json:"payload,omitempty"` + Url string `json:"url"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Url == nil { + return fmt.Errorf("Required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.EncodeAs; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomHeaders = all.CustomHeaders + o.EncodeAs = all.EncodeAs + o.Name = all.Name + o.Payload = all.Payload + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_webhooks_integration_custom_variable.go b/api/v1/datadog/model_webhooks_integration_custom_variable.go new file mode 100644 index 00000000000..9ae97cabbee --- /dev/null +++ b/api/v1/datadog/model_webhooks_integration_custom_variable.go @@ -0,0 +1,170 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WebhooksIntegrationCustomVariable Custom variable for Webhook integration. +type WebhooksIntegrationCustomVariable struct { + // Make custom variable is secret or not. + // If the custom variable is secret, the value is not returned in the response payload. + IsSecret bool `json:"is_secret"` + // The name of the variable. It corresponds with ``. + Name string `json:"name"` + // Value of the custom variable. + Value string `json:"value"` + // 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{} +} + +// NewWebhooksIntegrationCustomVariable instantiates a new WebhooksIntegrationCustomVariable 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 NewWebhooksIntegrationCustomVariable(isSecret bool, name string, value string) *WebhooksIntegrationCustomVariable { + this := WebhooksIntegrationCustomVariable{} + this.IsSecret = isSecret + this.Name = name + this.Value = value + return &this +} + +// NewWebhooksIntegrationCustomVariableWithDefaults instantiates a new WebhooksIntegrationCustomVariable 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 NewWebhooksIntegrationCustomVariableWithDefaults() *WebhooksIntegrationCustomVariable { + this := WebhooksIntegrationCustomVariable{} + return &this +} + +// GetIsSecret returns the IsSecret field value. +func (o *WebhooksIntegrationCustomVariable) GetIsSecret() bool { + if o == nil { + var ret bool + return ret + } + return o.IsSecret +} + +// GetIsSecretOk returns a tuple with the IsSecret field value +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariable) GetIsSecretOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsSecret, true +} + +// SetIsSecret sets field value. +func (o *WebhooksIntegrationCustomVariable) SetIsSecret(v bool) { + o.IsSecret = v +} + +// GetName returns the Name field value. +func (o *WebhooksIntegrationCustomVariable) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *WebhooksIntegrationCustomVariable) SetName(v string) { + o.Name = v +} + +// GetValue returns the Value field value. +func (o *WebhooksIntegrationCustomVariable) GetValue() string { + if o == nil { + var ret string + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariable) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *WebhooksIntegrationCustomVariable) SetValue(v string) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WebhooksIntegrationCustomVariable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["is_secret"] = o.IsSecret + toSerialize["name"] = o.Name + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WebhooksIntegrationCustomVariable) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + IsSecret *bool `json:"is_secret"` + Name *string `json:"name"` + Value *string `json:"value"` + }{} + all := struct { + IsSecret bool `json:"is_secret"` + Name string `json:"name"` + Value string `json:"value"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.IsSecret == nil { + return fmt.Errorf("Required field is_secret missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Value == nil { + return fmt.Errorf("Required field value missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsSecret = all.IsSecret + o.Name = all.Name + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_webhooks_integration_custom_variable_response.go b/api/v1/datadog/model_webhooks_integration_custom_variable_response.go new file mode 100644 index 00000000000..8c40ce5da5e --- /dev/null +++ b/api/v1/datadog/model_webhooks_integration_custom_variable_response.go @@ -0,0 +1,176 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WebhooksIntegrationCustomVariableResponse Custom variable for Webhook integration. +type WebhooksIntegrationCustomVariableResponse struct { + // Make custom variable is secret or not. + // If the custom variable is secret, the value is not returned in the response payload. + IsSecret bool `json:"is_secret"` + // The name of the variable. It corresponds with ``. It must only contains upper-case characters, integers or underscores. + Name string `json:"name"` + // Value of the custom variable. It won't be returned if the variable is secret. + Value *string `json:"value,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{} +} + +// NewWebhooksIntegrationCustomVariableResponse instantiates a new WebhooksIntegrationCustomVariableResponse 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 NewWebhooksIntegrationCustomVariableResponse(isSecret bool, name string) *WebhooksIntegrationCustomVariableResponse { + this := WebhooksIntegrationCustomVariableResponse{} + this.IsSecret = isSecret + this.Name = name + return &this +} + +// NewWebhooksIntegrationCustomVariableResponseWithDefaults instantiates a new WebhooksIntegrationCustomVariableResponse 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 NewWebhooksIntegrationCustomVariableResponseWithDefaults() *WebhooksIntegrationCustomVariableResponse { + this := WebhooksIntegrationCustomVariableResponse{} + return &this +} + +// GetIsSecret returns the IsSecret field value. +func (o *WebhooksIntegrationCustomVariableResponse) GetIsSecret() bool { + if o == nil { + var ret bool + return ret + } + return o.IsSecret +} + +// GetIsSecretOk returns a tuple with the IsSecret field value +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariableResponse) GetIsSecretOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsSecret, true +} + +// SetIsSecret sets field value. +func (o *WebhooksIntegrationCustomVariableResponse) SetIsSecret(v bool) { + o.IsSecret = v +} + +// GetName returns the Name field value. +func (o *WebhooksIntegrationCustomVariableResponse) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariableResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *WebhooksIntegrationCustomVariableResponse) SetName(v string) { + o.Name = v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *WebhooksIntegrationCustomVariableResponse) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariableResponse) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *WebhooksIntegrationCustomVariableResponse) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *WebhooksIntegrationCustomVariableResponse) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WebhooksIntegrationCustomVariableResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["is_secret"] = o.IsSecret + toSerialize["name"] = o.Name + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WebhooksIntegrationCustomVariableResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + IsSecret *bool `json:"is_secret"` + Name *string `json:"name"` + }{} + all := struct { + IsSecret bool `json:"is_secret"` + Name string `json:"name"` + Value *string `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.IsSecret == nil { + return fmt.Errorf("Required field is_secret missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsSecret = all.IsSecret + o.Name = all.Name + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go b/api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go new file mode 100644 index 00000000000..4038f967f23 --- /dev/null +++ b/api/v1/datadog/model_webhooks_integration_custom_variable_update_request.go @@ -0,0 +1,183 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// WebhooksIntegrationCustomVariableUpdateRequest Update request of a custom variable object. +// +// *All properties are optional.* +type WebhooksIntegrationCustomVariableUpdateRequest struct { + // Make custom variable is secret or not. + // If the custom variable is secret, the value is not returned in the response payload. + IsSecret *bool `json:"is_secret,omitempty"` + // The name of the variable. It corresponds with ``. It must only contains upper-case characters, integers or underscores. + Name *string `json:"name,omitempty"` + // Value of the custom variable. + Value *string `json:"value,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{} +} + +// NewWebhooksIntegrationCustomVariableUpdateRequest instantiates a new WebhooksIntegrationCustomVariableUpdateRequest 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 NewWebhooksIntegrationCustomVariableUpdateRequest() *WebhooksIntegrationCustomVariableUpdateRequest { + this := WebhooksIntegrationCustomVariableUpdateRequest{} + return &this +} + +// NewWebhooksIntegrationCustomVariableUpdateRequestWithDefaults instantiates a new WebhooksIntegrationCustomVariableUpdateRequest 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 NewWebhooksIntegrationCustomVariableUpdateRequestWithDefaults() *WebhooksIntegrationCustomVariableUpdateRequest { + this := WebhooksIntegrationCustomVariableUpdateRequest{} + return &this +} + +// GetIsSecret returns the IsSecret field value if set, zero value otherwise. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetIsSecret() bool { + if o == nil || o.IsSecret == nil { + var ret bool + return ret + } + return *o.IsSecret +} + +// GetIsSecretOk returns a tuple with the IsSecret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetIsSecretOk() (*bool, bool) { + if o == nil || o.IsSecret == nil { + return nil, false + } + return o.IsSecret, true +} + +// HasIsSecret returns a boolean if a field has been set. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) HasIsSecret() bool { + if o != nil && o.IsSecret != nil { + return true + } + + return false +} + +// SetIsSecret gets a reference to the given bool and assigns it to the IsSecret field. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) SetIsSecret(v bool) { + o.IsSecret = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) SetName(v string) { + o.Name = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WebhooksIntegrationCustomVariableUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsSecret != nil { + toSerialize["is_secret"] = o.IsSecret + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WebhooksIntegrationCustomVariableUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IsSecret *bool `json:"is_secret,omitempty"` + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsSecret = all.IsSecret + o.Name = all.Name + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_webhooks_integration_encoding.go b/api/v1/datadog/model_webhooks_integration_encoding.go new file mode 100644 index 00000000000..d99160e2236 --- /dev/null +++ b/api/v1/datadog/model_webhooks_integration_encoding.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WebhooksIntegrationEncoding Encoding type. Can be given either `json` or `form`. +type WebhooksIntegrationEncoding string + +// List of WebhooksIntegrationEncoding. +const ( + WEBHOOKSINTEGRATIONENCODING_JSON WebhooksIntegrationEncoding = "json" + WEBHOOKSINTEGRATIONENCODING_FORM WebhooksIntegrationEncoding = "form" +) + +var allowedWebhooksIntegrationEncodingEnumValues = []WebhooksIntegrationEncoding{ + WEBHOOKSINTEGRATIONENCODING_JSON, + WEBHOOKSINTEGRATIONENCODING_FORM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WebhooksIntegrationEncoding) GetAllowedValues() []WebhooksIntegrationEncoding { + return allowedWebhooksIntegrationEncodingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WebhooksIntegrationEncoding) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WebhooksIntegrationEncoding(value) + return nil +} + +// NewWebhooksIntegrationEncodingFromValue returns a pointer to a valid WebhooksIntegrationEncoding +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWebhooksIntegrationEncodingFromValue(v string) (*WebhooksIntegrationEncoding, error) { + ev := WebhooksIntegrationEncoding(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WebhooksIntegrationEncoding: valid values are %v", v, allowedWebhooksIntegrationEncodingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WebhooksIntegrationEncoding) IsValid() bool { + for _, existing := range allowedWebhooksIntegrationEncodingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WebhooksIntegrationEncoding value. +func (v WebhooksIntegrationEncoding) Ptr() *WebhooksIntegrationEncoding { + return &v +} + +// NullableWebhooksIntegrationEncoding handles when a null is used for WebhooksIntegrationEncoding. +type NullableWebhooksIntegrationEncoding struct { + value *WebhooksIntegrationEncoding + isSet bool +} + +// Get returns the associated value. +func (v NullableWebhooksIntegrationEncoding) Get() *WebhooksIntegrationEncoding { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWebhooksIntegrationEncoding) Set(val *WebhooksIntegrationEncoding) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWebhooksIntegrationEncoding) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWebhooksIntegrationEncoding) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWebhooksIntegrationEncoding initializes the struct as if Set has been called. +func NewNullableWebhooksIntegrationEncoding(val *WebhooksIntegrationEncoding) *NullableWebhooksIntegrationEncoding { + return &NullableWebhooksIntegrationEncoding{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWebhooksIntegrationEncoding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWebhooksIntegrationEncoding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_webhooks_integration_update_request.go b/api/v1/datadog/model_webhooks_integration_update_request.go new file mode 100644 index 00000000000..642592c00ba --- /dev/null +++ b/api/v1/datadog/model_webhooks_integration_update_request.go @@ -0,0 +1,291 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// WebhooksIntegrationUpdateRequest Update request of a Webhooks integration object. +// +// *All properties are optional.* +type WebhooksIntegrationUpdateRequest struct { + // If `null`, uses no header. + // If given a JSON payload, these will be headers attached to your webhook. + CustomHeaders *string `json:"custom_headers,omitempty"` + // Encoding type. Can be given either `json` or `form`. + EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` + // The name of the webhook. It corresponds with ``. + // Learn more on how to use it in + // [monitor notifications](https://docs.datadoghq.com/monitors/notify). + Name *string `json:"name,omitempty"` + // If `null`, uses the default payload. + // If given a JSON payload, the webhook returns the payload + // specified by the given payload. + // [Webhooks variable usage](https://docs.datadoghq.com/integrations/webhooks/#usage). + Payload common.NullableString `json:"payload,omitempty"` + // URL of the webhook. + Url *string `json:"url,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{} +} + +// NewWebhooksIntegrationUpdateRequest instantiates a new WebhooksIntegrationUpdateRequest 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 NewWebhooksIntegrationUpdateRequest() *WebhooksIntegrationUpdateRequest { + this := WebhooksIntegrationUpdateRequest{} + var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON + this.EncodeAs = &encodeAs + return &this +} + +// NewWebhooksIntegrationUpdateRequestWithDefaults instantiates a new WebhooksIntegrationUpdateRequest 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 NewWebhooksIntegrationUpdateRequestWithDefaults() *WebhooksIntegrationUpdateRequest { + this := WebhooksIntegrationUpdateRequest{} + var encodeAs WebhooksIntegrationEncoding = WEBHOOKSINTEGRATIONENCODING_JSON + this.EncodeAs = &encodeAs + return &this +} + +// GetCustomHeaders returns the CustomHeaders field value if set, zero value otherwise. +func (o *WebhooksIntegrationUpdateRequest) GetCustomHeaders() string { + if o == nil || o.CustomHeaders == nil { + var ret string + return ret + } + return *o.CustomHeaders +} + +// GetCustomHeadersOk returns a tuple with the CustomHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationUpdateRequest) GetCustomHeadersOk() (*string, bool) { + if o == nil || o.CustomHeaders == nil { + return nil, false + } + return o.CustomHeaders, true +} + +// HasCustomHeaders returns a boolean if a field has been set. +func (o *WebhooksIntegrationUpdateRequest) HasCustomHeaders() bool { + if o != nil && o.CustomHeaders != nil { + return true + } + + return false +} + +// SetCustomHeaders gets a reference to the given string and assigns it to the CustomHeaders field. +func (o *WebhooksIntegrationUpdateRequest) SetCustomHeaders(v string) { + o.CustomHeaders = &v +} + +// GetEncodeAs returns the EncodeAs field value if set, zero value otherwise. +func (o *WebhooksIntegrationUpdateRequest) GetEncodeAs() WebhooksIntegrationEncoding { + if o == nil || o.EncodeAs == nil { + var ret WebhooksIntegrationEncoding + return ret + } + return *o.EncodeAs +} + +// GetEncodeAsOk returns a tuple with the EncodeAs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationUpdateRequest) GetEncodeAsOk() (*WebhooksIntegrationEncoding, bool) { + if o == nil || o.EncodeAs == nil { + return nil, false + } + return o.EncodeAs, true +} + +// HasEncodeAs returns a boolean if a field has been set. +func (o *WebhooksIntegrationUpdateRequest) HasEncodeAs() bool { + if o != nil && o.EncodeAs != nil { + return true + } + + return false +} + +// SetEncodeAs gets a reference to the given WebhooksIntegrationEncoding and assigns it to the EncodeAs field. +func (o *WebhooksIntegrationUpdateRequest) SetEncodeAs(v WebhooksIntegrationEncoding) { + o.EncodeAs = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *WebhooksIntegrationUpdateRequest) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationUpdateRequest) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *WebhooksIntegrationUpdateRequest) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *WebhooksIntegrationUpdateRequest) SetName(v string) { + o.Name = &v +} + +// GetPayload returns the Payload field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *WebhooksIntegrationUpdateRequest) GetPayload() string { + if o == nil || o.Payload.Get() == nil { + var ret string + return ret + } + return *o.Payload.Get() +} + +// GetPayloadOk returns a tuple with the Payload 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 *WebhooksIntegrationUpdateRequest) GetPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Payload.Get(), o.Payload.IsSet() +} + +// HasPayload returns a boolean if a field has been set. +func (o *WebhooksIntegrationUpdateRequest) HasPayload() bool { + if o != nil && o.Payload.IsSet() { + return true + } + + return false +} + +// SetPayload gets a reference to the given common.NullableString and assigns it to the Payload field. +func (o *WebhooksIntegrationUpdateRequest) SetPayload(v string) { + o.Payload.Set(&v) +} + +// SetPayloadNil sets the value for Payload to be an explicit nil. +func (o *WebhooksIntegrationUpdateRequest) SetPayloadNil() { + o.Payload.Set(nil) +} + +// UnsetPayload ensures that no value is present for Payload, not even an explicit nil. +func (o *WebhooksIntegrationUpdateRequest) UnsetPayload() { + o.Payload.Unset() +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *WebhooksIntegrationUpdateRequest) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WebhooksIntegrationUpdateRequest) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *WebhooksIntegrationUpdateRequest) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *WebhooksIntegrationUpdateRequest) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WebhooksIntegrationUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomHeaders != nil { + toSerialize["custom_headers"] = o.CustomHeaders + } + if o.EncodeAs != nil { + toSerialize["encode_as"] = o.EncodeAs + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Payload.IsSet() { + toSerialize["payload"] = o.Payload.Get() + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WebhooksIntegrationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CustomHeaders *string `json:"custom_headers,omitempty"` + EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` + Name *string `json:"name,omitempty"` + Payload common.NullableString `json:"payload,omitempty"` + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.EncodeAs; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomHeaders = all.CustomHeaders + o.EncodeAs = all.EncodeAs + o.Name = all.Name + o.Payload = all.Payload + o.Url = all.Url + return nil +} diff --git a/api/v1/datadog/model_widget.go b/api/v1/datadog/model_widget.go new file mode 100644 index 00000000000..0fe86daef55 --- /dev/null +++ b/api/v1/datadog/model_widget.go @@ -0,0 +1,193 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// Widget Information about widget. +// +// **Note**: The `layout` property is required for widgets in dashboards with `free` `layout_type`. +// For the **new dashboard layout**, the `layout` property depends on the `reflow_type` of the dashboard. +// - If `reflow_type` is `fixed`, `layout` is required. +// - If `reflow_type` is `auto`, `layout` should not be set. +type Widget struct { + // [Definition of the widget](https://docs.datadoghq.com/dashboards/widgets/). + Definition WidgetDefinition `json:"definition"` + // ID of the widget. + Id *int64 `json:"id,omitempty"` + // The layout for a widget on a `free` or **new dashboard layout** dashboard. + Layout *WidgetLayout `json:"layout,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{} +} + +// NewWidget instantiates a new Widget 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 NewWidget(definition WidgetDefinition) *Widget { + this := Widget{} + this.Definition = definition + return &this +} + +// NewWidgetWithDefaults instantiates a new Widget 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 NewWidgetWithDefaults() *Widget { + this := Widget{} + return &this +} + +// GetDefinition returns the Definition field value. +func (o *Widget) GetDefinition() WidgetDefinition { + if o == nil { + var ret WidgetDefinition + return ret + } + return o.Definition +} + +// GetDefinitionOk returns a tuple with the Definition field value +// and a boolean to check if the value has been set. +func (o *Widget) GetDefinitionOk() (*WidgetDefinition, bool) { + if o == nil { + return nil, false + } + return &o.Definition, true +} + +// SetDefinition sets field value. +func (o *Widget) SetDefinition(v WidgetDefinition) { + o.Definition = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Widget) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Widget) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Widget) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Widget) SetId(v int64) { + o.Id = &v +} + +// GetLayout returns the Layout field value if set, zero value otherwise. +func (o *Widget) GetLayout() WidgetLayout { + if o == nil || o.Layout == nil { + var ret WidgetLayout + return ret + } + return *o.Layout +} + +// GetLayoutOk returns a tuple with the Layout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Widget) GetLayoutOk() (*WidgetLayout, bool) { + if o == nil || o.Layout == nil { + return nil, false + } + return o.Layout, true +} + +// HasLayout returns a boolean if a field has been set. +func (o *Widget) HasLayout() bool { + if o != nil && o.Layout != nil { + return true + } + + return false +} + +// SetLayout gets a reference to the given WidgetLayout and assigns it to the Layout field. +func (o *Widget) SetLayout(v WidgetLayout) { + o.Layout = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Widget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["definition"] = o.Definition + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Layout != nil { + toSerialize["layout"] = o.Layout + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Widget) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Definition *WidgetDefinition `json:"definition"` + }{} + all := struct { + Definition WidgetDefinition `json:"definition"` + Id *int64 `json:"id,omitempty"` + Layout *WidgetLayout `json:"layout,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Definition == nil { + return fmt.Errorf("Required field definition missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Definition = all.Definition + o.Id = all.Id + if all.Layout != nil && all.Layout.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Layout = all.Layout + return nil +} diff --git a/api/v1/datadog/model_widget_aggregator.go b/api/v1/datadog/model_widget_aggregator.go new file mode 100644 index 00000000000..1b6d5d89b95 --- /dev/null +++ b/api/v1/datadog/model_widget_aggregator.go @@ -0,0 +1,117 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetAggregator Aggregator used for the request. +type WidgetAggregator string + +// List of WidgetAggregator. +const ( + WIDGETAGGREGATOR_AVERAGE WidgetAggregator = "avg" + WIDGETAGGREGATOR_LAST WidgetAggregator = "last" + WIDGETAGGREGATOR_MAXIMUM WidgetAggregator = "max" + WIDGETAGGREGATOR_MINIMUM WidgetAggregator = "min" + WIDGETAGGREGATOR_SUM WidgetAggregator = "sum" + WIDGETAGGREGATOR_PERCENTILE WidgetAggregator = "percentile" +) + +var allowedWidgetAggregatorEnumValues = []WidgetAggregator{ + WIDGETAGGREGATOR_AVERAGE, + WIDGETAGGREGATOR_LAST, + WIDGETAGGREGATOR_MAXIMUM, + WIDGETAGGREGATOR_MINIMUM, + WIDGETAGGREGATOR_SUM, + WIDGETAGGREGATOR_PERCENTILE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetAggregator) GetAllowedValues() []WidgetAggregator { + return allowedWidgetAggregatorEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetAggregator) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetAggregator(value) + return nil +} + +// NewWidgetAggregatorFromValue returns a pointer to a valid WidgetAggregator +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetAggregatorFromValue(v string) (*WidgetAggregator, error) { + ev := WidgetAggregator(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetAggregator: valid values are %v", v, allowedWidgetAggregatorEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetAggregator) IsValid() bool { + for _, existing := range allowedWidgetAggregatorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetAggregator value. +func (v WidgetAggregator) Ptr() *WidgetAggregator { + return &v +} + +// NullableWidgetAggregator handles when a null is used for WidgetAggregator. +type NullableWidgetAggregator struct { + value *WidgetAggregator + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetAggregator) Get() *WidgetAggregator { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetAggregator) Set(val *WidgetAggregator) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetAggregator) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetAggregator) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetAggregator initializes the struct as if Set has been called. +func NewNullableWidgetAggregator(val *WidgetAggregator) *NullableWidgetAggregator { + return &NullableWidgetAggregator{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetAggregator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetAggregator) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_axis.go b/api/v1/datadog/model_widget_axis.go new file mode 100644 index 00000000000..ee59c9abd16 --- /dev/null +++ b/api/v1/datadog/model_widget_axis.go @@ -0,0 +1,270 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// WidgetAxis Axis controls for the widget. +type WidgetAxis struct { + // True includes zero. + IncludeZero *bool `json:"include_zero,omitempty"` + // The label of the axis to display on the graph. + Label *string `json:"label,omitempty"` + // Specifies the maximum value to show on the y-axis. It takes a number, or auto for default behavior. + Max *string `json:"max,omitempty"` + // Specifies minimum value to show on the y-axis. It takes a number, or auto for default behavior. + Min *string `json:"min,omitempty"` + // Specifies the scale type. Possible values are `linear`, `log`, `sqrt`, `pow##` (for example `pow2`, `pow0.5` etc.). + Scale *string `json:"scale,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{} +} + +// NewWidgetAxis instantiates a new WidgetAxis 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 NewWidgetAxis() *WidgetAxis { + this := WidgetAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// NewWidgetAxisWithDefaults instantiates a new WidgetAxis 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 NewWidgetAxisWithDefaults() *WidgetAxis { + this := WidgetAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// GetIncludeZero returns the IncludeZero field value if set, zero value otherwise. +func (o *WidgetAxis) GetIncludeZero() bool { + if o == nil || o.IncludeZero == nil { + var ret bool + return ret + } + return *o.IncludeZero +} + +// GetIncludeZeroOk returns a tuple with the IncludeZero field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetAxis) GetIncludeZeroOk() (*bool, bool) { + if o == nil || o.IncludeZero == nil { + return nil, false + } + return o.IncludeZero, true +} + +// HasIncludeZero returns a boolean if a field has been set. +func (o *WidgetAxis) HasIncludeZero() bool { + if o != nil && o.IncludeZero != nil { + return true + } + + return false +} + +// SetIncludeZero gets a reference to the given bool and assigns it to the IncludeZero field. +func (o *WidgetAxis) SetIncludeZero(v bool) { + o.IncludeZero = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *WidgetAxis) GetLabel() string { + if o == nil || o.Label == nil { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetAxis) GetLabelOk() (*string, bool) { + if o == nil || o.Label == nil { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *WidgetAxis) HasLabel() bool { + if o != nil && o.Label != nil { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *WidgetAxis) SetLabel(v string) { + o.Label = &v +} + +// GetMax returns the Max field value if set, zero value otherwise. +func (o *WidgetAxis) GetMax() string { + if o == nil || o.Max == nil { + var ret string + return ret + } + return *o.Max +} + +// GetMaxOk returns a tuple with the Max field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetAxis) GetMaxOk() (*string, bool) { + if o == nil || o.Max == nil { + return nil, false + } + return o.Max, true +} + +// HasMax returns a boolean if a field has been set. +func (o *WidgetAxis) HasMax() bool { + if o != nil && o.Max != nil { + return true + } + + return false +} + +// SetMax gets a reference to the given string and assigns it to the Max field. +func (o *WidgetAxis) SetMax(v string) { + o.Max = &v +} + +// GetMin returns the Min field value if set, zero value otherwise. +func (o *WidgetAxis) GetMin() string { + if o == nil || o.Min == nil { + var ret string + return ret + } + return *o.Min +} + +// GetMinOk returns a tuple with the Min field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetAxis) GetMinOk() (*string, bool) { + if o == nil || o.Min == nil { + return nil, false + } + return o.Min, true +} + +// HasMin returns a boolean if a field has been set. +func (o *WidgetAxis) HasMin() bool { + if o != nil && o.Min != nil { + return true + } + + return false +} + +// SetMin gets a reference to the given string and assigns it to the Min field. +func (o *WidgetAxis) SetMin(v string) { + o.Min = &v +} + +// GetScale returns the Scale field value if set, zero value otherwise. +func (o *WidgetAxis) GetScale() string { + if o == nil || o.Scale == nil { + var ret string + return ret + } + return *o.Scale +} + +// GetScaleOk returns a tuple with the Scale field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetAxis) GetScaleOk() (*string, bool) { + if o == nil || o.Scale == nil { + return nil, false + } + return o.Scale, true +} + +// HasScale returns a boolean if a field has been set. +func (o *WidgetAxis) HasScale() bool { + if o != nil && o.Scale != nil { + return true + } + + return false +} + +// SetScale gets a reference to the given string and assigns it to the Scale field. +func (o *WidgetAxis) SetScale(v string) { + o.Scale = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetAxis) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IncludeZero != nil { + toSerialize["include_zero"] = o.IncludeZero + } + if o.Label != nil { + toSerialize["label"] = o.Label + } + if o.Max != nil { + toSerialize["max"] = o.Max + } + if o.Min != nil { + toSerialize["min"] = o.Min + } + if o.Scale != nil { + toSerialize["scale"] = o.Scale + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetAxis) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IncludeZero *bool `json:"include_zero,omitempty"` + Label *string `json:"label,omitempty"` + Max *string `json:"max,omitempty"` + Min *string `json:"min,omitempty"` + Scale *string `json:"scale,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IncludeZero = all.IncludeZero + o.Label = all.Label + o.Max = all.Max + o.Min = all.Min + o.Scale = all.Scale + return nil +} diff --git a/api/v1/datadog/model_widget_change_type.go b/api/v1/datadog/model_widget_change_type.go new file mode 100644 index 00000000000..b51dad151e4 --- /dev/null +++ b/api/v1/datadog/model_widget_change_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetChangeType Show the absolute or the relative change. +type WidgetChangeType string + +// List of WidgetChangeType. +const ( + WIDGETCHANGETYPE_ABSOLUTE WidgetChangeType = "absolute" + WIDGETCHANGETYPE_RELATIVE WidgetChangeType = "relative" +) + +var allowedWidgetChangeTypeEnumValues = []WidgetChangeType{ + WIDGETCHANGETYPE_ABSOLUTE, + WIDGETCHANGETYPE_RELATIVE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetChangeType) GetAllowedValues() []WidgetChangeType { + return allowedWidgetChangeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetChangeType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetChangeType(value) + return nil +} + +// NewWidgetChangeTypeFromValue returns a pointer to a valid WidgetChangeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetChangeTypeFromValue(v string) (*WidgetChangeType, error) { + ev := WidgetChangeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetChangeType: valid values are %v", v, allowedWidgetChangeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetChangeType) IsValid() bool { + for _, existing := range allowedWidgetChangeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetChangeType value. +func (v WidgetChangeType) Ptr() *WidgetChangeType { + return &v +} + +// NullableWidgetChangeType handles when a null is used for WidgetChangeType. +type NullableWidgetChangeType struct { + value *WidgetChangeType + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetChangeType) Get() *WidgetChangeType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetChangeType) Set(val *WidgetChangeType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetChangeType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetChangeType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetChangeType initializes the struct as if Set has been called. +func NewNullableWidgetChangeType(val *WidgetChangeType) *NullableWidgetChangeType { + return &NullableWidgetChangeType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetChangeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetChangeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_color_preference.go b/api/v1/datadog/model_widget_color_preference.go new file mode 100644 index 00000000000..353510e0bfe --- /dev/null +++ b/api/v1/datadog/model_widget_color_preference.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetColorPreference Which color to use on the widget. +type WidgetColorPreference string + +// List of WidgetColorPreference. +const ( + WIDGETCOLORPREFERENCE_BACKGROUND WidgetColorPreference = "background" + WIDGETCOLORPREFERENCE_TEXT WidgetColorPreference = "text" +) + +var allowedWidgetColorPreferenceEnumValues = []WidgetColorPreference{ + WIDGETCOLORPREFERENCE_BACKGROUND, + WIDGETCOLORPREFERENCE_TEXT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetColorPreference) GetAllowedValues() []WidgetColorPreference { + return allowedWidgetColorPreferenceEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetColorPreference) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetColorPreference(value) + return nil +} + +// NewWidgetColorPreferenceFromValue returns a pointer to a valid WidgetColorPreference +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetColorPreferenceFromValue(v string) (*WidgetColorPreference, error) { + ev := WidgetColorPreference(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetColorPreference: valid values are %v", v, allowedWidgetColorPreferenceEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetColorPreference) IsValid() bool { + for _, existing := range allowedWidgetColorPreferenceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetColorPreference value. +func (v WidgetColorPreference) Ptr() *WidgetColorPreference { + return &v +} + +// NullableWidgetColorPreference handles when a null is used for WidgetColorPreference. +type NullableWidgetColorPreference struct { + value *WidgetColorPreference + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetColorPreference) Get() *WidgetColorPreference { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetColorPreference) Set(val *WidgetColorPreference) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetColorPreference) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetColorPreference) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetColorPreference initializes the struct as if Set has been called. +func NewNullableWidgetColorPreference(val *WidgetColorPreference) *NullableWidgetColorPreference { + return &NullableWidgetColorPreference{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetColorPreference) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetColorPreference) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_comparator.go b/api/v1/datadog/model_widget_comparator.go new file mode 100644 index 00000000000..cc0510e1aae --- /dev/null +++ b/api/v1/datadog/model_widget_comparator.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetComparator Comparator to apply. +type WidgetComparator string + +// List of WidgetComparator. +const ( + WIDGETCOMPARATOR_GREATER_THAN WidgetComparator = ">" + WIDGETCOMPARATOR_GREATER_THAN_OR_EQUAL_TO WidgetComparator = ">=" + WIDGETCOMPARATOR_LESS_THAN WidgetComparator = "<" + WIDGETCOMPARATOR_LESS_THAN_OR_EQUAL_TO WidgetComparator = "<=" +) + +var allowedWidgetComparatorEnumValues = []WidgetComparator{ + WIDGETCOMPARATOR_GREATER_THAN, + WIDGETCOMPARATOR_GREATER_THAN_OR_EQUAL_TO, + WIDGETCOMPARATOR_LESS_THAN, + WIDGETCOMPARATOR_LESS_THAN_OR_EQUAL_TO, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetComparator) GetAllowedValues() []WidgetComparator { + return allowedWidgetComparatorEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetComparator) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetComparator(value) + return nil +} + +// NewWidgetComparatorFromValue returns a pointer to a valid WidgetComparator +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetComparatorFromValue(v string) (*WidgetComparator, error) { + ev := WidgetComparator(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetComparator: valid values are %v", v, allowedWidgetComparatorEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetComparator) IsValid() bool { + for _, existing := range allowedWidgetComparatorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetComparator value. +func (v WidgetComparator) Ptr() *WidgetComparator { + return &v +} + +// NullableWidgetComparator handles when a null is used for WidgetComparator. +type NullableWidgetComparator struct { + value *WidgetComparator + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetComparator) Get() *WidgetComparator { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetComparator) Set(val *WidgetComparator) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetComparator) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetComparator) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetComparator initializes the struct as if Set has been called. +func NewNullableWidgetComparator(val *WidgetComparator) *NullableWidgetComparator { + return &NullableWidgetComparator{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetComparator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetComparator) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_compare_to.go b/api/v1/datadog/model_widget_compare_to.go new file mode 100644 index 00000000000..68613bbf674 --- /dev/null +++ b/api/v1/datadog/model_widget_compare_to.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetCompareTo Timeframe used for the change comparison. +type WidgetCompareTo string + +// List of WidgetCompareTo. +const ( + WIDGETCOMPARETO_HOUR_BEFORE WidgetCompareTo = "hour_before" + WIDGETCOMPARETO_DAY_BEFORE WidgetCompareTo = "day_before" + WIDGETCOMPARETO_WEEK_BEFORE WidgetCompareTo = "week_before" + WIDGETCOMPARETO_MONTH_BEFORE WidgetCompareTo = "month_before" +) + +var allowedWidgetCompareToEnumValues = []WidgetCompareTo{ + WIDGETCOMPARETO_HOUR_BEFORE, + WIDGETCOMPARETO_DAY_BEFORE, + WIDGETCOMPARETO_WEEK_BEFORE, + WIDGETCOMPARETO_MONTH_BEFORE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetCompareTo) GetAllowedValues() []WidgetCompareTo { + return allowedWidgetCompareToEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetCompareTo) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetCompareTo(value) + return nil +} + +// NewWidgetCompareToFromValue returns a pointer to a valid WidgetCompareTo +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetCompareToFromValue(v string) (*WidgetCompareTo, error) { + ev := WidgetCompareTo(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetCompareTo: valid values are %v", v, allowedWidgetCompareToEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetCompareTo) IsValid() bool { + for _, existing := range allowedWidgetCompareToEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetCompareTo value. +func (v WidgetCompareTo) Ptr() *WidgetCompareTo { + return &v +} + +// NullableWidgetCompareTo handles when a null is used for WidgetCompareTo. +type NullableWidgetCompareTo struct { + value *WidgetCompareTo + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetCompareTo) Get() *WidgetCompareTo { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetCompareTo) Set(val *WidgetCompareTo) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetCompareTo) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetCompareTo) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetCompareTo initializes the struct as if Set has been called. +func NewNullableWidgetCompareTo(val *WidgetCompareTo) *NullableWidgetCompareTo { + return &NullableWidgetCompareTo{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetCompareTo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetCompareTo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_conditional_format.go b/api/v1/datadog/model_widget_conditional_format.go new file mode 100644 index 00000000000..a83b9d45a6a --- /dev/null +++ b/api/v1/datadog/model_widget_conditional_format.go @@ -0,0 +1,419 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetConditionalFormat Define a conditional format for the widget. +type WidgetConditionalFormat struct { + // Comparator to apply. + Comparator WidgetComparator `json:"comparator"` + // Color palette to apply to the background, same values available as palette. + CustomBgColor *string `json:"custom_bg_color,omitempty"` + // Color palette to apply to the foreground, same values available as palette. + CustomFgColor *string `json:"custom_fg_color,omitempty"` + // True hides values. + HideValue *bool `json:"hide_value,omitempty"` + // Displays an image as the background. + ImageUrl *string `json:"image_url,omitempty"` + // Metric from the request to correlate this conditional format with. + Metric *string `json:"metric,omitempty"` + // Color palette to apply. + Palette WidgetPalette `json:"palette"` + // Defines the displayed timeframe. + Timeframe *string `json:"timeframe,omitempty"` + // Value for the comparator. + Value float64 `json:"value"` + // 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{} +} + +// NewWidgetConditionalFormat instantiates a new WidgetConditionalFormat 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 NewWidgetConditionalFormat(comparator WidgetComparator, palette WidgetPalette, value float64) *WidgetConditionalFormat { + this := WidgetConditionalFormat{} + this.Comparator = comparator + this.Palette = palette + this.Value = value + return &this +} + +// NewWidgetConditionalFormatWithDefaults instantiates a new WidgetConditionalFormat 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 NewWidgetConditionalFormatWithDefaults() *WidgetConditionalFormat { + this := WidgetConditionalFormat{} + return &this +} + +// GetComparator returns the Comparator field value. +func (o *WidgetConditionalFormat) GetComparator() WidgetComparator { + if o == nil { + var ret WidgetComparator + return ret + } + return o.Comparator +} + +// GetComparatorOk returns a tuple with the Comparator field value +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetComparatorOk() (*WidgetComparator, bool) { + if o == nil { + return nil, false + } + return &o.Comparator, true +} + +// SetComparator sets field value. +func (o *WidgetConditionalFormat) SetComparator(v WidgetComparator) { + o.Comparator = v +} + +// GetCustomBgColor returns the CustomBgColor field value if set, zero value otherwise. +func (o *WidgetConditionalFormat) GetCustomBgColor() string { + if o == nil || o.CustomBgColor == nil { + var ret string + return ret + } + return *o.CustomBgColor +} + +// GetCustomBgColorOk returns a tuple with the CustomBgColor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetCustomBgColorOk() (*string, bool) { + if o == nil || o.CustomBgColor == nil { + return nil, false + } + return o.CustomBgColor, true +} + +// HasCustomBgColor returns a boolean if a field has been set. +func (o *WidgetConditionalFormat) HasCustomBgColor() bool { + if o != nil && o.CustomBgColor != nil { + return true + } + + return false +} + +// SetCustomBgColor gets a reference to the given string and assigns it to the CustomBgColor field. +func (o *WidgetConditionalFormat) SetCustomBgColor(v string) { + o.CustomBgColor = &v +} + +// GetCustomFgColor returns the CustomFgColor field value if set, zero value otherwise. +func (o *WidgetConditionalFormat) GetCustomFgColor() string { + if o == nil || o.CustomFgColor == nil { + var ret string + return ret + } + return *o.CustomFgColor +} + +// GetCustomFgColorOk returns a tuple with the CustomFgColor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetCustomFgColorOk() (*string, bool) { + if o == nil || o.CustomFgColor == nil { + return nil, false + } + return o.CustomFgColor, true +} + +// HasCustomFgColor returns a boolean if a field has been set. +func (o *WidgetConditionalFormat) HasCustomFgColor() bool { + if o != nil && o.CustomFgColor != nil { + return true + } + + return false +} + +// SetCustomFgColor gets a reference to the given string and assigns it to the CustomFgColor field. +func (o *WidgetConditionalFormat) SetCustomFgColor(v string) { + o.CustomFgColor = &v +} + +// GetHideValue returns the HideValue field value if set, zero value otherwise. +func (o *WidgetConditionalFormat) GetHideValue() bool { + if o == nil || o.HideValue == nil { + var ret bool + return ret + } + return *o.HideValue +} + +// GetHideValueOk returns a tuple with the HideValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetHideValueOk() (*bool, bool) { + if o == nil || o.HideValue == nil { + return nil, false + } + return o.HideValue, true +} + +// HasHideValue returns a boolean if a field has been set. +func (o *WidgetConditionalFormat) HasHideValue() bool { + if o != nil && o.HideValue != nil { + return true + } + + return false +} + +// SetHideValue gets a reference to the given bool and assigns it to the HideValue field. +func (o *WidgetConditionalFormat) SetHideValue(v bool) { + o.HideValue = &v +} + +// GetImageUrl returns the ImageUrl field value if set, zero value otherwise. +func (o *WidgetConditionalFormat) GetImageUrl() string { + if o == nil || o.ImageUrl == nil { + var ret string + return ret + } + return *o.ImageUrl +} + +// GetImageUrlOk returns a tuple with the ImageUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetImageUrlOk() (*string, bool) { + if o == nil || o.ImageUrl == nil { + return nil, false + } + return o.ImageUrl, true +} + +// HasImageUrl returns a boolean if a field has been set. +func (o *WidgetConditionalFormat) HasImageUrl() bool { + if o != nil && o.ImageUrl != nil { + return true + } + + return false +} + +// SetImageUrl gets a reference to the given string and assigns it to the ImageUrl field. +func (o *WidgetConditionalFormat) SetImageUrl(v string) { + o.ImageUrl = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *WidgetConditionalFormat) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *WidgetConditionalFormat) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *WidgetConditionalFormat) SetMetric(v string) { + o.Metric = &v +} + +// GetPalette returns the Palette field value. +func (o *WidgetConditionalFormat) GetPalette() WidgetPalette { + if o == nil { + var ret WidgetPalette + return ret + } + return o.Palette +} + +// GetPaletteOk returns a tuple with the Palette field value +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetPaletteOk() (*WidgetPalette, bool) { + if o == nil { + return nil, false + } + return &o.Palette, true +} + +// SetPalette sets field value. +func (o *WidgetConditionalFormat) SetPalette(v WidgetPalette) { + o.Palette = v +} + +// GetTimeframe returns the Timeframe field value if set, zero value otherwise. +func (o *WidgetConditionalFormat) GetTimeframe() string { + if o == nil || o.Timeframe == nil { + var ret string + return ret + } + return *o.Timeframe +} + +// GetTimeframeOk returns a tuple with the Timeframe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetTimeframeOk() (*string, bool) { + if o == nil || o.Timeframe == nil { + return nil, false + } + return o.Timeframe, true +} + +// HasTimeframe returns a boolean if a field has been set. +func (o *WidgetConditionalFormat) HasTimeframe() bool { + if o != nil && o.Timeframe != nil { + return true + } + + return false +} + +// SetTimeframe gets a reference to the given string and assigns it to the Timeframe field. +func (o *WidgetConditionalFormat) SetTimeframe(v string) { + o.Timeframe = &v +} + +// GetValue returns the Value field value. +func (o *WidgetConditionalFormat) GetValue() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *WidgetConditionalFormat) GetValueOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *WidgetConditionalFormat) SetValue(v float64) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetConditionalFormat) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["comparator"] = o.Comparator + if o.CustomBgColor != nil { + toSerialize["custom_bg_color"] = o.CustomBgColor + } + if o.CustomFgColor != nil { + toSerialize["custom_fg_color"] = o.CustomFgColor + } + if o.HideValue != nil { + toSerialize["hide_value"] = o.HideValue + } + if o.ImageUrl != nil { + toSerialize["image_url"] = o.ImageUrl + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + toSerialize["palette"] = o.Palette + if o.Timeframe != nil { + toSerialize["timeframe"] = o.Timeframe + } + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Comparator *WidgetComparator `json:"comparator"` + Palette *WidgetPalette `json:"palette"` + Value *float64 `json:"value"` + }{} + all := struct { + Comparator WidgetComparator `json:"comparator"` + CustomBgColor *string `json:"custom_bg_color,omitempty"` + CustomFgColor *string `json:"custom_fg_color,omitempty"` + HideValue *bool `json:"hide_value,omitempty"` + ImageUrl *string `json:"image_url,omitempty"` + Metric *string `json:"metric,omitempty"` + Palette WidgetPalette `json:"palette"` + Timeframe *string `json:"timeframe,omitempty"` + Value float64 `json:"value"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Comparator == nil { + return fmt.Errorf("Required field comparator missing") + } + if required.Palette == nil { + return fmt.Errorf("Required field palette missing") + } + if required.Value == nil { + return fmt.Errorf("Required field value missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Comparator; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Palette; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Comparator = all.Comparator + o.CustomBgColor = all.CustomBgColor + o.CustomFgColor = all.CustomFgColor + o.HideValue = all.HideValue + o.ImageUrl = all.ImageUrl + o.Metric = all.Metric + o.Palette = all.Palette + o.Timeframe = all.Timeframe + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_widget_custom_link.go b/api/v1/datadog/model_widget_custom_link.go new file mode 100644 index 00000000000..98c4c117c6e --- /dev/null +++ b/api/v1/datadog/model_widget_custom_link.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// WidgetCustomLink Custom links help you connect a data value to a URL, like a Datadog page or your AWS console. +type WidgetCustomLink struct { + // The flag for toggling context menu link visibility. + IsHidden *bool `json:"is_hidden,omitempty"` + // The label for the custom link URL. Keep the label short and descriptive. Use metrics and tags as variables. + Label *string `json:"label,omitempty"` + // The URL of the custom link. URL must include `http` or `https`. A relative URL must start with `/`. + Link *string `json:"link,omitempty"` + // The label ID that refers to a context menu link. Can be `logs`, `hosts`, `traces`, `profiles`, `processes`, `containers`, or `rum`. + OverrideLabel *string `json:"override_label,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{} +} + +// NewWidgetCustomLink instantiates a new WidgetCustomLink 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 NewWidgetCustomLink() *WidgetCustomLink { + this := WidgetCustomLink{} + return &this +} + +// NewWidgetCustomLinkWithDefaults instantiates a new WidgetCustomLink 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 NewWidgetCustomLinkWithDefaults() *WidgetCustomLink { + this := WidgetCustomLink{} + return &this +} + +// GetIsHidden returns the IsHidden field value if set, zero value otherwise. +func (o *WidgetCustomLink) GetIsHidden() bool { + if o == nil || o.IsHidden == nil { + var ret bool + return ret + } + return *o.IsHidden +} + +// GetIsHiddenOk returns a tuple with the IsHidden field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetCustomLink) GetIsHiddenOk() (*bool, bool) { + if o == nil || o.IsHidden == nil { + return nil, false + } + return o.IsHidden, true +} + +// HasIsHidden returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasIsHidden() bool { + if o != nil && o.IsHidden != nil { + return true + } + + return false +} + +// SetIsHidden gets a reference to the given bool and assigns it to the IsHidden field. +func (o *WidgetCustomLink) SetIsHidden(v bool) { + o.IsHidden = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *WidgetCustomLink) GetLabel() string { + if o == nil || o.Label == nil { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetCustomLink) GetLabelOk() (*string, bool) { + if o == nil || o.Label == nil { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasLabel() bool { + if o != nil && o.Label != nil { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *WidgetCustomLink) SetLabel(v string) { + o.Label = &v +} + +// GetLink returns the Link field value if set, zero value otherwise. +func (o *WidgetCustomLink) GetLink() string { + if o == nil || o.Link == nil { + var ret string + return ret + } + return *o.Link +} + +// GetLinkOk returns a tuple with the Link field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetCustomLink) GetLinkOk() (*string, bool) { + if o == nil || o.Link == nil { + return nil, false + } + return o.Link, true +} + +// HasLink returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasLink() bool { + if o != nil && o.Link != nil { + return true + } + + return false +} + +// SetLink gets a reference to the given string and assigns it to the Link field. +func (o *WidgetCustomLink) SetLink(v string) { + o.Link = &v +} + +// GetOverrideLabel returns the OverrideLabel field value if set, zero value otherwise. +func (o *WidgetCustomLink) GetOverrideLabel() string { + if o == nil || o.OverrideLabel == nil { + var ret string + return ret + } + return *o.OverrideLabel +} + +// GetOverrideLabelOk returns a tuple with the OverrideLabel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetCustomLink) GetOverrideLabelOk() (*string, bool) { + if o == nil || o.OverrideLabel == nil { + return nil, false + } + return o.OverrideLabel, true +} + +// HasOverrideLabel returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasOverrideLabel() bool { + if o != nil && o.OverrideLabel != nil { + return true + } + + return false +} + +// SetOverrideLabel gets a reference to the given string and assigns it to the OverrideLabel field. +func (o *WidgetCustomLink) SetOverrideLabel(v string) { + o.OverrideLabel = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetCustomLink) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IsHidden != nil { + toSerialize["is_hidden"] = o.IsHidden + } + if o.Label != nil { + toSerialize["label"] = o.Label + } + if o.Link != nil { + toSerialize["link"] = o.Link + } + if o.OverrideLabel != nil { + toSerialize["override_label"] = o.OverrideLabel + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetCustomLink) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IsHidden *bool `json:"is_hidden,omitempty"` + Label *string `json:"label,omitempty"` + Link *string `json:"link,omitempty"` + OverrideLabel *string `json:"override_label,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IsHidden = all.IsHidden + o.Label = all.Label + o.Link = all.Link + o.OverrideLabel = all.OverrideLabel + return nil +} diff --git a/api/v1/datadog/model_widget_definition.go b/api/v1/datadog/model_widget_definition.go new file mode 100644 index 00000000000..cf655095ca5 --- /dev/null +++ b/api/v1/datadog/model_widget_definition.go @@ -0,0 +1,1019 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// WidgetDefinition - [Definition of the widget](https://docs.datadoghq.com/dashboards/widgets/). +type WidgetDefinition struct { + AlertGraphWidgetDefinition *AlertGraphWidgetDefinition + AlertValueWidgetDefinition *AlertValueWidgetDefinition + ChangeWidgetDefinition *ChangeWidgetDefinition + CheckStatusWidgetDefinition *CheckStatusWidgetDefinition + DistributionWidgetDefinition *DistributionWidgetDefinition + EventStreamWidgetDefinition *EventStreamWidgetDefinition + EventTimelineWidgetDefinition *EventTimelineWidgetDefinition + FreeTextWidgetDefinition *FreeTextWidgetDefinition + GeomapWidgetDefinition *GeomapWidgetDefinition + GroupWidgetDefinition *GroupWidgetDefinition + HeatMapWidgetDefinition *HeatMapWidgetDefinition + HostMapWidgetDefinition *HostMapWidgetDefinition + IFrameWidgetDefinition *IFrameWidgetDefinition + ImageWidgetDefinition *ImageWidgetDefinition + LogStreamWidgetDefinition *LogStreamWidgetDefinition + MonitorSummaryWidgetDefinition *MonitorSummaryWidgetDefinition + NoteWidgetDefinition *NoteWidgetDefinition + QueryValueWidgetDefinition *QueryValueWidgetDefinition + ScatterPlotWidgetDefinition *ScatterPlotWidgetDefinition + SLOWidgetDefinition *SLOWidgetDefinition + ServiceMapWidgetDefinition *ServiceMapWidgetDefinition + ServiceSummaryWidgetDefinition *ServiceSummaryWidgetDefinition + SunburstWidgetDefinition *SunburstWidgetDefinition + TableWidgetDefinition *TableWidgetDefinition + TimeseriesWidgetDefinition *TimeseriesWidgetDefinition + ToplistWidgetDefinition *ToplistWidgetDefinition + TreeMapWidgetDefinition *TreeMapWidgetDefinition + ListStreamWidgetDefinition *ListStreamWidgetDefinition + FunnelWidgetDefinition *FunnelWidgetDefinition + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AlertGraphWidgetDefinitionAsWidgetDefinition is a convenience function that returns AlertGraphWidgetDefinition wrapped in WidgetDefinition. +func AlertGraphWidgetDefinitionAsWidgetDefinition(v *AlertGraphWidgetDefinition) WidgetDefinition { + return WidgetDefinition{AlertGraphWidgetDefinition: v} +} + +// AlertValueWidgetDefinitionAsWidgetDefinition is a convenience function that returns AlertValueWidgetDefinition wrapped in WidgetDefinition. +func AlertValueWidgetDefinitionAsWidgetDefinition(v *AlertValueWidgetDefinition) WidgetDefinition { + return WidgetDefinition{AlertValueWidgetDefinition: v} +} + +// ChangeWidgetDefinitionAsWidgetDefinition is a convenience function that returns ChangeWidgetDefinition wrapped in WidgetDefinition. +func ChangeWidgetDefinitionAsWidgetDefinition(v *ChangeWidgetDefinition) WidgetDefinition { + return WidgetDefinition{ChangeWidgetDefinition: v} +} + +// CheckStatusWidgetDefinitionAsWidgetDefinition is a convenience function that returns CheckStatusWidgetDefinition wrapped in WidgetDefinition. +func CheckStatusWidgetDefinitionAsWidgetDefinition(v *CheckStatusWidgetDefinition) WidgetDefinition { + return WidgetDefinition{CheckStatusWidgetDefinition: v} +} + +// DistributionWidgetDefinitionAsWidgetDefinition is a convenience function that returns DistributionWidgetDefinition wrapped in WidgetDefinition. +func DistributionWidgetDefinitionAsWidgetDefinition(v *DistributionWidgetDefinition) WidgetDefinition { + return WidgetDefinition{DistributionWidgetDefinition: v} +} + +// EventStreamWidgetDefinitionAsWidgetDefinition is a convenience function that returns EventStreamWidgetDefinition wrapped in WidgetDefinition. +func EventStreamWidgetDefinitionAsWidgetDefinition(v *EventStreamWidgetDefinition) WidgetDefinition { + return WidgetDefinition{EventStreamWidgetDefinition: v} +} + +// EventTimelineWidgetDefinitionAsWidgetDefinition is a convenience function that returns EventTimelineWidgetDefinition wrapped in WidgetDefinition. +func EventTimelineWidgetDefinitionAsWidgetDefinition(v *EventTimelineWidgetDefinition) WidgetDefinition { + return WidgetDefinition{EventTimelineWidgetDefinition: v} +} + +// FreeTextWidgetDefinitionAsWidgetDefinition is a convenience function that returns FreeTextWidgetDefinition wrapped in WidgetDefinition. +func FreeTextWidgetDefinitionAsWidgetDefinition(v *FreeTextWidgetDefinition) WidgetDefinition { + return WidgetDefinition{FreeTextWidgetDefinition: v} +} + +// GeomapWidgetDefinitionAsWidgetDefinition is a convenience function that returns GeomapWidgetDefinition wrapped in WidgetDefinition. +func GeomapWidgetDefinitionAsWidgetDefinition(v *GeomapWidgetDefinition) WidgetDefinition { + return WidgetDefinition{GeomapWidgetDefinition: v} +} + +// GroupWidgetDefinitionAsWidgetDefinition is a convenience function that returns GroupWidgetDefinition wrapped in WidgetDefinition. +func GroupWidgetDefinitionAsWidgetDefinition(v *GroupWidgetDefinition) WidgetDefinition { + return WidgetDefinition{GroupWidgetDefinition: v} +} + +// HeatMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns HeatMapWidgetDefinition wrapped in WidgetDefinition. +func HeatMapWidgetDefinitionAsWidgetDefinition(v *HeatMapWidgetDefinition) WidgetDefinition { + return WidgetDefinition{HeatMapWidgetDefinition: v} +} + +// HostMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns HostMapWidgetDefinition wrapped in WidgetDefinition. +func HostMapWidgetDefinitionAsWidgetDefinition(v *HostMapWidgetDefinition) WidgetDefinition { + return WidgetDefinition{HostMapWidgetDefinition: v} +} + +// IFrameWidgetDefinitionAsWidgetDefinition is a convenience function that returns IFrameWidgetDefinition wrapped in WidgetDefinition. +func IFrameWidgetDefinitionAsWidgetDefinition(v *IFrameWidgetDefinition) WidgetDefinition { + return WidgetDefinition{IFrameWidgetDefinition: v} +} + +// ImageWidgetDefinitionAsWidgetDefinition is a convenience function that returns ImageWidgetDefinition wrapped in WidgetDefinition. +func ImageWidgetDefinitionAsWidgetDefinition(v *ImageWidgetDefinition) WidgetDefinition { + return WidgetDefinition{ImageWidgetDefinition: v} +} + +// LogStreamWidgetDefinitionAsWidgetDefinition is a convenience function that returns LogStreamWidgetDefinition wrapped in WidgetDefinition. +func LogStreamWidgetDefinitionAsWidgetDefinition(v *LogStreamWidgetDefinition) WidgetDefinition { + return WidgetDefinition{LogStreamWidgetDefinition: v} +} + +// MonitorSummaryWidgetDefinitionAsWidgetDefinition is a convenience function that returns MonitorSummaryWidgetDefinition wrapped in WidgetDefinition. +func MonitorSummaryWidgetDefinitionAsWidgetDefinition(v *MonitorSummaryWidgetDefinition) WidgetDefinition { + return WidgetDefinition{MonitorSummaryWidgetDefinition: v} +} + +// NoteWidgetDefinitionAsWidgetDefinition is a convenience function that returns NoteWidgetDefinition wrapped in WidgetDefinition. +func NoteWidgetDefinitionAsWidgetDefinition(v *NoteWidgetDefinition) WidgetDefinition { + return WidgetDefinition{NoteWidgetDefinition: v} +} + +// QueryValueWidgetDefinitionAsWidgetDefinition is a convenience function that returns QueryValueWidgetDefinition wrapped in WidgetDefinition. +func QueryValueWidgetDefinitionAsWidgetDefinition(v *QueryValueWidgetDefinition) WidgetDefinition { + return WidgetDefinition{QueryValueWidgetDefinition: v} +} + +// ScatterPlotWidgetDefinitionAsWidgetDefinition is a convenience function that returns ScatterPlotWidgetDefinition wrapped in WidgetDefinition. +func ScatterPlotWidgetDefinitionAsWidgetDefinition(v *ScatterPlotWidgetDefinition) WidgetDefinition { + return WidgetDefinition{ScatterPlotWidgetDefinition: v} +} + +// SLOWidgetDefinitionAsWidgetDefinition is a convenience function that returns SLOWidgetDefinition wrapped in WidgetDefinition. +func SLOWidgetDefinitionAsWidgetDefinition(v *SLOWidgetDefinition) WidgetDefinition { + return WidgetDefinition{SLOWidgetDefinition: v} +} + +// ServiceMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns ServiceMapWidgetDefinition wrapped in WidgetDefinition. +func ServiceMapWidgetDefinitionAsWidgetDefinition(v *ServiceMapWidgetDefinition) WidgetDefinition { + return WidgetDefinition{ServiceMapWidgetDefinition: v} +} + +// ServiceSummaryWidgetDefinitionAsWidgetDefinition is a convenience function that returns ServiceSummaryWidgetDefinition wrapped in WidgetDefinition. +func ServiceSummaryWidgetDefinitionAsWidgetDefinition(v *ServiceSummaryWidgetDefinition) WidgetDefinition { + return WidgetDefinition{ServiceSummaryWidgetDefinition: v} +} + +// SunburstWidgetDefinitionAsWidgetDefinition is a convenience function that returns SunburstWidgetDefinition wrapped in WidgetDefinition. +func SunburstWidgetDefinitionAsWidgetDefinition(v *SunburstWidgetDefinition) WidgetDefinition { + return WidgetDefinition{SunburstWidgetDefinition: v} +} + +// TableWidgetDefinitionAsWidgetDefinition is a convenience function that returns TableWidgetDefinition wrapped in WidgetDefinition. +func TableWidgetDefinitionAsWidgetDefinition(v *TableWidgetDefinition) WidgetDefinition { + return WidgetDefinition{TableWidgetDefinition: v} +} + +// TimeseriesWidgetDefinitionAsWidgetDefinition is a convenience function that returns TimeseriesWidgetDefinition wrapped in WidgetDefinition. +func TimeseriesWidgetDefinitionAsWidgetDefinition(v *TimeseriesWidgetDefinition) WidgetDefinition { + return WidgetDefinition{TimeseriesWidgetDefinition: v} +} + +// ToplistWidgetDefinitionAsWidgetDefinition is a convenience function that returns ToplistWidgetDefinition wrapped in WidgetDefinition. +func ToplistWidgetDefinitionAsWidgetDefinition(v *ToplistWidgetDefinition) WidgetDefinition { + return WidgetDefinition{ToplistWidgetDefinition: v} +} + +// TreeMapWidgetDefinitionAsWidgetDefinition is a convenience function that returns TreeMapWidgetDefinition wrapped in WidgetDefinition. +func TreeMapWidgetDefinitionAsWidgetDefinition(v *TreeMapWidgetDefinition) WidgetDefinition { + return WidgetDefinition{TreeMapWidgetDefinition: v} +} + +// ListStreamWidgetDefinitionAsWidgetDefinition is a convenience function that returns ListStreamWidgetDefinition wrapped in WidgetDefinition. +func ListStreamWidgetDefinitionAsWidgetDefinition(v *ListStreamWidgetDefinition) WidgetDefinition { + return WidgetDefinition{ListStreamWidgetDefinition: v} +} + +// FunnelWidgetDefinitionAsWidgetDefinition is a convenience function that returns FunnelWidgetDefinition wrapped in WidgetDefinition. +func FunnelWidgetDefinitionAsWidgetDefinition(v *FunnelWidgetDefinition) WidgetDefinition { + return WidgetDefinition{FunnelWidgetDefinition: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *WidgetDefinition) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AlertGraphWidgetDefinition + err = json.Unmarshal(data, &obj.AlertGraphWidgetDefinition) + if err == nil { + if obj.AlertGraphWidgetDefinition != nil && obj.AlertGraphWidgetDefinition.UnparsedObject == nil { + jsonAlertGraphWidgetDefinition, _ := json.Marshal(obj.AlertGraphWidgetDefinition) + if string(jsonAlertGraphWidgetDefinition) == "{}" { // empty struct + obj.AlertGraphWidgetDefinition = nil + } else { + match++ + } + } else { + obj.AlertGraphWidgetDefinition = nil + } + } else { + obj.AlertGraphWidgetDefinition = nil + } + + // try to unmarshal data into AlertValueWidgetDefinition + err = json.Unmarshal(data, &obj.AlertValueWidgetDefinition) + if err == nil { + if obj.AlertValueWidgetDefinition != nil && obj.AlertValueWidgetDefinition.UnparsedObject == nil { + jsonAlertValueWidgetDefinition, _ := json.Marshal(obj.AlertValueWidgetDefinition) + if string(jsonAlertValueWidgetDefinition) == "{}" { // empty struct + obj.AlertValueWidgetDefinition = nil + } else { + match++ + } + } else { + obj.AlertValueWidgetDefinition = nil + } + } else { + obj.AlertValueWidgetDefinition = nil + } + + // try to unmarshal data into ChangeWidgetDefinition + err = json.Unmarshal(data, &obj.ChangeWidgetDefinition) + if err == nil { + if obj.ChangeWidgetDefinition != nil && obj.ChangeWidgetDefinition.UnparsedObject == nil { + jsonChangeWidgetDefinition, _ := json.Marshal(obj.ChangeWidgetDefinition) + if string(jsonChangeWidgetDefinition) == "{}" { // empty struct + obj.ChangeWidgetDefinition = nil + } else { + match++ + } + } else { + obj.ChangeWidgetDefinition = nil + } + } else { + obj.ChangeWidgetDefinition = nil + } + + // try to unmarshal data into CheckStatusWidgetDefinition + err = json.Unmarshal(data, &obj.CheckStatusWidgetDefinition) + if err == nil { + if obj.CheckStatusWidgetDefinition != nil && obj.CheckStatusWidgetDefinition.UnparsedObject == nil { + jsonCheckStatusWidgetDefinition, _ := json.Marshal(obj.CheckStatusWidgetDefinition) + if string(jsonCheckStatusWidgetDefinition) == "{}" { // empty struct + obj.CheckStatusWidgetDefinition = nil + } else { + match++ + } + } else { + obj.CheckStatusWidgetDefinition = nil + } + } else { + obj.CheckStatusWidgetDefinition = nil + } + + // try to unmarshal data into DistributionWidgetDefinition + err = json.Unmarshal(data, &obj.DistributionWidgetDefinition) + if err == nil { + if obj.DistributionWidgetDefinition != nil && obj.DistributionWidgetDefinition.UnparsedObject == nil { + jsonDistributionWidgetDefinition, _ := json.Marshal(obj.DistributionWidgetDefinition) + if string(jsonDistributionWidgetDefinition) == "{}" { // empty struct + obj.DistributionWidgetDefinition = nil + } else { + match++ + } + } else { + obj.DistributionWidgetDefinition = nil + } + } else { + obj.DistributionWidgetDefinition = nil + } + + // try to unmarshal data into EventStreamWidgetDefinition + err = json.Unmarshal(data, &obj.EventStreamWidgetDefinition) + if err == nil { + if obj.EventStreamWidgetDefinition != nil && obj.EventStreamWidgetDefinition.UnparsedObject == nil { + jsonEventStreamWidgetDefinition, _ := json.Marshal(obj.EventStreamWidgetDefinition) + if string(jsonEventStreamWidgetDefinition) == "{}" { // empty struct + obj.EventStreamWidgetDefinition = nil + } else { + match++ + } + } else { + obj.EventStreamWidgetDefinition = nil + } + } else { + obj.EventStreamWidgetDefinition = nil + } + + // try to unmarshal data into EventTimelineWidgetDefinition + err = json.Unmarshal(data, &obj.EventTimelineWidgetDefinition) + if err == nil { + if obj.EventTimelineWidgetDefinition != nil && obj.EventTimelineWidgetDefinition.UnparsedObject == nil { + jsonEventTimelineWidgetDefinition, _ := json.Marshal(obj.EventTimelineWidgetDefinition) + if string(jsonEventTimelineWidgetDefinition) == "{}" { // empty struct + obj.EventTimelineWidgetDefinition = nil + } else { + match++ + } + } else { + obj.EventTimelineWidgetDefinition = nil + } + } else { + obj.EventTimelineWidgetDefinition = nil + } + + // try to unmarshal data into FreeTextWidgetDefinition + err = json.Unmarshal(data, &obj.FreeTextWidgetDefinition) + if err == nil { + if obj.FreeTextWidgetDefinition != nil && obj.FreeTextWidgetDefinition.UnparsedObject == nil { + jsonFreeTextWidgetDefinition, _ := json.Marshal(obj.FreeTextWidgetDefinition) + if string(jsonFreeTextWidgetDefinition) == "{}" { // empty struct + obj.FreeTextWidgetDefinition = nil + } else { + match++ + } + } else { + obj.FreeTextWidgetDefinition = nil + } + } else { + obj.FreeTextWidgetDefinition = nil + } + + // try to unmarshal data into GeomapWidgetDefinition + err = json.Unmarshal(data, &obj.GeomapWidgetDefinition) + if err == nil { + if obj.GeomapWidgetDefinition != nil && obj.GeomapWidgetDefinition.UnparsedObject == nil { + jsonGeomapWidgetDefinition, _ := json.Marshal(obj.GeomapWidgetDefinition) + if string(jsonGeomapWidgetDefinition) == "{}" { // empty struct + obj.GeomapWidgetDefinition = nil + } else { + match++ + } + } else { + obj.GeomapWidgetDefinition = nil + } + } else { + obj.GeomapWidgetDefinition = nil + } + + // try to unmarshal data into GroupWidgetDefinition + err = json.Unmarshal(data, &obj.GroupWidgetDefinition) + if err == nil { + if obj.GroupWidgetDefinition != nil && obj.GroupWidgetDefinition.UnparsedObject == nil { + jsonGroupWidgetDefinition, _ := json.Marshal(obj.GroupWidgetDefinition) + if string(jsonGroupWidgetDefinition) == "{}" { // empty struct + obj.GroupWidgetDefinition = nil + } else { + match++ + } + } else { + obj.GroupWidgetDefinition = nil + } + } else { + obj.GroupWidgetDefinition = nil + } + + // try to unmarshal data into HeatMapWidgetDefinition + err = json.Unmarshal(data, &obj.HeatMapWidgetDefinition) + if err == nil { + if obj.HeatMapWidgetDefinition != nil && obj.HeatMapWidgetDefinition.UnparsedObject == nil { + jsonHeatMapWidgetDefinition, _ := json.Marshal(obj.HeatMapWidgetDefinition) + if string(jsonHeatMapWidgetDefinition) == "{}" { // empty struct + obj.HeatMapWidgetDefinition = nil + } else { + match++ + } + } else { + obj.HeatMapWidgetDefinition = nil + } + } else { + obj.HeatMapWidgetDefinition = nil + } + + // try to unmarshal data into HostMapWidgetDefinition + err = json.Unmarshal(data, &obj.HostMapWidgetDefinition) + if err == nil { + if obj.HostMapWidgetDefinition != nil && obj.HostMapWidgetDefinition.UnparsedObject == nil { + jsonHostMapWidgetDefinition, _ := json.Marshal(obj.HostMapWidgetDefinition) + if string(jsonHostMapWidgetDefinition) == "{}" { // empty struct + obj.HostMapWidgetDefinition = nil + } else { + match++ + } + } else { + obj.HostMapWidgetDefinition = nil + } + } else { + obj.HostMapWidgetDefinition = nil + } + + // try to unmarshal data into IFrameWidgetDefinition + err = json.Unmarshal(data, &obj.IFrameWidgetDefinition) + if err == nil { + if obj.IFrameWidgetDefinition != nil && obj.IFrameWidgetDefinition.UnparsedObject == nil { + jsonIFrameWidgetDefinition, _ := json.Marshal(obj.IFrameWidgetDefinition) + if string(jsonIFrameWidgetDefinition) == "{}" { // empty struct + obj.IFrameWidgetDefinition = nil + } else { + match++ + } + } else { + obj.IFrameWidgetDefinition = nil + } + } else { + obj.IFrameWidgetDefinition = nil + } + + // try to unmarshal data into ImageWidgetDefinition + err = json.Unmarshal(data, &obj.ImageWidgetDefinition) + if err == nil { + if obj.ImageWidgetDefinition != nil && obj.ImageWidgetDefinition.UnparsedObject == nil { + jsonImageWidgetDefinition, _ := json.Marshal(obj.ImageWidgetDefinition) + if string(jsonImageWidgetDefinition) == "{}" { // empty struct + obj.ImageWidgetDefinition = nil + } else { + match++ + } + } else { + obj.ImageWidgetDefinition = nil + } + } else { + obj.ImageWidgetDefinition = nil + } + + // try to unmarshal data into LogStreamWidgetDefinition + err = json.Unmarshal(data, &obj.LogStreamWidgetDefinition) + if err == nil { + if obj.LogStreamWidgetDefinition != nil && obj.LogStreamWidgetDefinition.UnparsedObject == nil { + jsonLogStreamWidgetDefinition, _ := json.Marshal(obj.LogStreamWidgetDefinition) + if string(jsonLogStreamWidgetDefinition) == "{}" { // empty struct + obj.LogStreamWidgetDefinition = nil + } else { + match++ + } + } else { + obj.LogStreamWidgetDefinition = nil + } + } else { + obj.LogStreamWidgetDefinition = nil + } + + // try to unmarshal data into MonitorSummaryWidgetDefinition + err = json.Unmarshal(data, &obj.MonitorSummaryWidgetDefinition) + if err == nil { + if obj.MonitorSummaryWidgetDefinition != nil && obj.MonitorSummaryWidgetDefinition.UnparsedObject == nil { + jsonMonitorSummaryWidgetDefinition, _ := json.Marshal(obj.MonitorSummaryWidgetDefinition) + if string(jsonMonitorSummaryWidgetDefinition) == "{}" { // empty struct + obj.MonitorSummaryWidgetDefinition = nil + } else { + match++ + } + } else { + obj.MonitorSummaryWidgetDefinition = nil + } + } else { + obj.MonitorSummaryWidgetDefinition = nil + } + + // try to unmarshal data into NoteWidgetDefinition + err = json.Unmarshal(data, &obj.NoteWidgetDefinition) + if err == nil { + if obj.NoteWidgetDefinition != nil && obj.NoteWidgetDefinition.UnparsedObject == nil { + jsonNoteWidgetDefinition, _ := json.Marshal(obj.NoteWidgetDefinition) + if string(jsonNoteWidgetDefinition) == "{}" { // empty struct + obj.NoteWidgetDefinition = nil + } else { + match++ + } + } else { + obj.NoteWidgetDefinition = nil + } + } else { + obj.NoteWidgetDefinition = nil + } + + // try to unmarshal data into QueryValueWidgetDefinition + err = json.Unmarshal(data, &obj.QueryValueWidgetDefinition) + if err == nil { + if obj.QueryValueWidgetDefinition != nil && obj.QueryValueWidgetDefinition.UnparsedObject == nil { + jsonQueryValueWidgetDefinition, _ := json.Marshal(obj.QueryValueWidgetDefinition) + if string(jsonQueryValueWidgetDefinition) == "{}" { // empty struct + obj.QueryValueWidgetDefinition = nil + } else { + match++ + } + } else { + obj.QueryValueWidgetDefinition = nil + } + } else { + obj.QueryValueWidgetDefinition = nil + } + + // try to unmarshal data into ScatterPlotWidgetDefinition + err = json.Unmarshal(data, &obj.ScatterPlotWidgetDefinition) + if err == nil { + if obj.ScatterPlotWidgetDefinition != nil && obj.ScatterPlotWidgetDefinition.UnparsedObject == nil { + jsonScatterPlotWidgetDefinition, _ := json.Marshal(obj.ScatterPlotWidgetDefinition) + if string(jsonScatterPlotWidgetDefinition) == "{}" { // empty struct + obj.ScatterPlotWidgetDefinition = nil + } else { + match++ + } + } else { + obj.ScatterPlotWidgetDefinition = nil + } + } else { + obj.ScatterPlotWidgetDefinition = nil + } + + // try to unmarshal data into SLOWidgetDefinition + err = json.Unmarshal(data, &obj.SLOWidgetDefinition) + if err == nil { + if obj.SLOWidgetDefinition != nil && obj.SLOWidgetDefinition.UnparsedObject == nil { + jsonSLOWidgetDefinition, _ := json.Marshal(obj.SLOWidgetDefinition) + if string(jsonSLOWidgetDefinition) == "{}" { // empty struct + obj.SLOWidgetDefinition = nil + } else { + match++ + } + } else { + obj.SLOWidgetDefinition = nil + } + } else { + obj.SLOWidgetDefinition = nil + } + + // try to unmarshal data into ServiceMapWidgetDefinition + err = json.Unmarshal(data, &obj.ServiceMapWidgetDefinition) + if err == nil { + if obj.ServiceMapWidgetDefinition != nil && obj.ServiceMapWidgetDefinition.UnparsedObject == nil { + jsonServiceMapWidgetDefinition, _ := json.Marshal(obj.ServiceMapWidgetDefinition) + if string(jsonServiceMapWidgetDefinition) == "{}" { // empty struct + obj.ServiceMapWidgetDefinition = nil + } else { + match++ + } + } else { + obj.ServiceMapWidgetDefinition = nil + } + } else { + obj.ServiceMapWidgetDefinition = nil + } + + // try to unmarshal data into ServiceSummaryWidgetDefinition + err = json.Unmarshal(data, &obj.ServiceSummaryWidgetDefinition) + if err == nil { + if obj.ServiceSummaryWidgetDefinition != nil && obj.ServiceSummaryWidgetDefinition.UnparsedObject == nil { + jsonServiceSummaryWidgetDefinition, _ := json.Marshal(obj.ServiceSummaryWidgetDefinition) + if string(jsonServiceSummaryWidgetDefinition) == "{}" { // empty struct + obj.ServiceSummaryWidgetDefinition = nil + } else { + match++ + } + } else { + obj.ServiceSummaryWidgetDefinition = nil + } + } else { + obj.ServiceSummaryWidgetDefinition = nil + } + + // try to unmarshal data into SunburstWidgetDefinition + err = json.Unmarshal(data, &obj.SunburstWidgetDefinition) + if err == nil { + if obj.SunburstWidgetDefinition != nil && obj.SunburstWidgetDefinition.UnparsedObject == nil { + jsonSunburstWidgetDefinition, _ := json.Marshal(obj.SunburstWidgetDefinition) + if string(jsonSunburstWidgetDefinition) == "{}" { // empty struct + obj.SunburstWidgetDefinition = nil + } else { + match++ + } + } else { + obj.SunburstWidgetDefinition = nil + } + } else { + obj.SunburstWidgetDefinition = nil + } + + // try to unmarshal data into TableWidgetDefinition + err = json.Unmarshal(data, &obj.TableWidgetDefinition) + if err == nil { + if obj.TableWidgetDefinition != nil && obj.TableWidgetDefinition.UnparsedObject == nil { + jsonTableWidgetDefinition, _ := json.Marshal(obj.TableWidgetDefinition) + if string(jsonTableWidgetDefinition) == "{}" { // empty struct + obj.TableWidgetDefinition = nil + } else { + match++ + } + } else { + obj.TableWidgetDefinition = nil + } + } else { + obj.TableWidgetDefinition = nil + } + + // try to unmarshal data into TimeseriesWidgetDefinition + err = json.Unmarshal(data, &obj.TimeseriesWidgetDefinition) + if err == nil { + if obj.TimeseriesWidgetDefinition != nil && obj.TimeseriesWidgetDefinition.UnparsedObject == nil { + jsonTimeseriesWidgetDefinition, _ := json.Marshal(obj.TimeseriesWidgetDefinition) + if string(jsonTimeseriesWidgetDefinition) == "{}" { // empty struct + obj.TimeseriesWidgetDefinition = nil + } else { + match++ + } + } else { + obj.TimeseriesWidgetDefinition = nil + } + } else { + obj.TimeseriesWidgetDefinition = nil + } + + // try to unmarshal data into ToplistWidgetDefinition + err = json.Unmarshal(data, &obj.ToplistWidgetDefinition) + if err == nil { + if obj.ToplistWidgetDefinition != nil && obj.ToplistWidgetDefinition.UnparsedObject == nil { + jsonToplistWidgetDefinition, _ := json.Marshal(obj.ToplistWidgetDefinition) + if string(jsonToplistWidgetDefinition) == "{}" { // empty struct + obj.ToplistWidgetDefinition = nil + } else { + match++ + } + } else { + obj.ToplistWidgetDefinition = nil + } + } else { + obj.ToplistWidgetDefinition = nil + } + + // try to unmarshal data into TreeMapWidgetDefinition + err = json.Unmarshal(data, &obj.TreeMapWidgetDefinition) + if err == nil { + if obj.TreeMapWidgetDefinition != nil && obj.TreeMapWidgetDefinition.UnparsedObject == nil { + jsonTreeMapWidgetDefinition, _ := json.Marshal(obj.TreeMapWidgetDefinition) + if string(jsonTreeMapWidgetDefinition) == "{}" { // empty struct + obj.TreeMapWidgetDefinition = nil + } else { + match++ + } + } else { + obj.TreeMapWidgetDefinition = nil + } + } else { + obj.TreeMapWidgetDefinition = nil + } + + // try to unmarshal data into ListStreamWidgetDefinition + err = json.Unmarshal(data, &obj.ListStreamWidgetDefinition) + if err == nil { + if obj.ListStreamWidgetDefinition != nil && obj.ListStreamWidgetDefinition.UnparsedObject == nil { + jsonListStreamWidgetDefinition, _ := json.Marshal(obj.ListStreamWidgetDefinition) + if string(jsonListStreamWidgetDefinition) == "{}" { // empty struct + obj.ListStreamWidgetDefinition = nil + } else { + match++ + } + } else { + obj.ListStreamWidgetDefinition = nil + } + } else { + obj.ListStreamWidgetDefinition = nil + } + + // try to unmarshal data into FunnelWidgetDefinition + err = json.Unmarshal(data, &obj.FunnelWidgetDefinition) + if err == nil { + if obj.FunnelWidgetDefinition != nil && obj.FunnelWidgetDefinition.UnparsedObject == nil { + jsonFunnelWidgetDefinition, _ := json.Marshal(obj.FunnelWidgetDefinition) + if string(jsonFunnelWidgetDefinition) == "{}" { // empty struct + obj.FunnelWidgetDefinition = nil + } else { + match++ + } + } else { + obj.FunnelWidgetDefinition = nil + } + } else { + obj.FunnelWidgetDefinition = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AlertGraphWidgetDefinition = nil + obj.AlertValueWidgetDefinition = nil + obj.ChangeWidgetDefinition = nil + obj.CheckStatusWidgetDefinition = nil + obj.DistributionWidgetDefinition = nil + obj.EventStreamWidgetDefinition = nil + obj.EventTimelineWidgetDefinition = nil + obj.FreeTextWidgetDefinition = nil + obj.GeomapWidgetDefinition = nil + obj.GroupWidgetDefinition = nil + obj.HeatMapWidgetDefinition = nil + obj.HostMapWidgetDefinition = nil + obj.IFrameWidgetDefinition = nil + obj.ImageWidgetDefinition = nil + obj.LogStreamWidgetDefinition = nil + obj.MonitorSummaryWidgetDefinition = nil + obj.NoteWidgetDefinition = nil + obj.QueryValueWidgetDefinition = nil + obj.ScatterPlotWidgetDefinition = nil + obj.SLOWidgetDefinition = nil + obj.ServiceMapWidgetDefinition = nil + obj.ServiceSummaryWidgetDefinition = nil + obj.SunburstWidgetDefinition = nil + obj.TableWidgetDefinition = nil + obj.TimeseriesWidgetDefinition = nil + obj.ToplistWidgetDefinition = nil + obj.TreeMapWidgetDefinition = nil + obj.ListStreamWidgetDefinition = nil + obj.FunnelWidgetDefinition = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj WidgetDefinition) MarshalJSON() ([]byte, error) { + if obj.AlertGraphWidgetDefinition != nil { + return json.Marshal(&obj.AlertGraphWidgetDefinition) + } + + if obj.AlertValueWidgetDefinition != nil { + return json.Marshal(&obj.AlertValueWidgetDefinition) + } + + if obj.ChangeWidgetDefinition != nil { + return json.Marshal(&obj.ChangeWidgetDefinition) + } + + if obj.CheckStatusWidgetDefinition != nil { + return json.Marshal(&obj.CheckStatusWidgetDefinition) + } + + if obj.DistributionWidgetDefinition != nil { + return json.Marshal(&obj.DistributionWidgetDefinition) + } + + if obj.EventStreamWidgetDefinition != nil { + return json.Marshal(&obj.EventStreamWidgetDefinition) + } + + if obj.EventTimelineWidgetDefinition != nil { + return json.Marshal(&obj.EventTimelineWidgetDefinition) + } + + if obj.FreeTextWidgetDefinition != nil { + return json.Marshal(&obj.FreeTextWidgetDefinition) + } + + if obj.GeomapWidgetDefinition != nil { + return json.Marshal(&obj.GeomapWidgetDefinition) + } + + if obj.GroupWidgetDefinition != nil { + return json.Marshal(&obj.GroupWidgetDefinition) + } + + if obj.HeatMapWidgetDefinition != nil { + return json.Marshal(&obj.HeatMapWidgetDefinition) + } + + if obj.HostMapWidgetDefinition != nil { + return json.Marshal(&obj.HostMapWidgetDefinition) + } + + if obj.IFrameWidgetDefinition != nil { + return json.Marshal(&obj.IFrameWidgetDefinition) + } + + if obj.ImageWidgetDefinition != nil { + return json.Marshal(&obj.ImageWidgetDefinition) + } + + if obj.LogStreamWidgetDefinition != nil { + return json.Marshal(&obj.LogStreamWidgetDefinition) + } + + if obj.MonitorSummaryWidgetDefinition != nil { + return json.Marshal(&obj.MonitorSummaryWidgetDefinition) + } + + if obj.NoteWidgetDefinition != nil { + return json.Marshal(&obj.NoteWidgetDefinition) + } + + if obj.QueryValueWidgetDefinition != nil { + return json.Marshal(&obj.QueryValueWidgetDefinition) + } + + if obj.ScatterPlotWidgetDefinition != nil { + return json.Marshal(&obj.ScatterPlotWidgetDefinition) + } + + if obj.SLOWidgetDefinition != nil { + return json.Marshal(&obj.SLOWidgetDefinition) + } + + if obj.ServiceMapWidgetDefinition != nil { + return json.Marshal(&obj.ServiceMapWidgetDefinition) + } + + if obj.ServiceSummaryWidgetDefinition != nil { + return json.Marshal(&obj.ServiceSummaryWidgetDefinition) + } + + if obj.SunburstWidgetDefinition != nil { + return json.Marshal(&obj.SunburstWidgetDefinition) + } + + if obj.TableWidgetDefinition != nil { + return json.Marshal(&obj.TableWidgetDefinition) + } + + if obj.TimeseriesWidgetDefinition != nil { + return json.Marshal(&obj.TimeseriesWidgetDefinition) + } + + if obj.ToplistWidgetDefinition != nil { + return json.Marshal(&obj.ToplistWidgetDefinition) + } + + if obj.TreeMapWidgetDefinition != nil { + return json.Marshal(&obj.TreeMapWidgetDefinition) + } + + if obj.ListStreamWidgetDefinition != nil { + return json.Marshal(&obj.ListStreamWidgetDefinition) + } + + if obj.FunnelWidgetDefinition != nil { + return json.Marshal(&obj.FunnelWidgetDefinition) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *WidgetDefinition) GetActualInstance() interface{} { + if obj.AlertGraphWidgetDefinition != nil { + return obj.AlertGraphWidgetDefinition + } + + if obj.AlertValueWidgetDefinition != nil { + return obj.AlertValueWidgetDefinition + } + + if obj.ChangeWidgetDefinition != nil { + return obj.ChangeWidgetDefinition + } + + if obj.CheckStatusWidgetDefinition != nil { + return obj.CheckStatusWidgetDefinition + } + + if obj.DistributionWidgetDefinition != nil { + return obj.DistributionWidgetDefinition + } + + if obj.EventStreamWidgetDefinition != nil { + return obj.EventStreamWidgetDefinition + } + + if obj.EventTimelineWidgetDefinition != nil { + return obj.EventTimelineWidgetDefinition + } + + if obj.FreeTextWidgetDefinition != nil { + return obj.FreeTextWidgetDefinition + } + + if obj.GeomapWidgetDefinition != nil { + return obj.GeomapWidgetDefinition + } + + if obj.GroupWidgetDefinition != nil { + return obj.GroupWidgetDefinition + } + + if obj.HeatMapWidgetDefinition != nil { + return obj.HeatMapWidgetDefinition + } + + if obj.HostMapWidgetDefinition != nil { + return obj.HostMapWidgetDefinition + } + + if obj.IFrameWidgetDefinition != nil { + return obj.IFrameWidgetDefinition + } + + if obj.ImageWidgetDefinition != nil { + return obj.ImageWidgetDefinition + } + + if obj.LogStreamWidgetDefinition != nil { + return obj.LogStreamWidgetDefinition + } + + if obj.MonitorSummaryWidgetDefinition != nil { + return obj.MonitorSummaryWidgetDefinition + } + + if obj.NoteWidgetDefinition != nil { + return obj.NoteWidgetDefinition + } + + if obj.QueryValueWidgetDefinition != nil { + return obj.QueryValueWidgetDefinition + } + + if obj.ScatterPlotWidgetDefinition != nil { + return obj.ScatterPlotWidgetDefinition + } + + if obj.SLOWidgetDefinition != nil { + return obj.SLOWidgetDefinition + } + + if obj.ServiceMapWidgetDefinition != nil { + return obj.ServiceMapWidgetDefinition + } + + if obj.ServiceSummaryWidgetDefinition != nil { + return obj.ServiceSummaryWidgetDefinition + } + + if obj.SunburstWidgetDefinition != nil { + return obj.SunburstWidgetDefinition + } + + if obj.TableWidgetDefinition != nil { + return obj.TableWidgetDefinition + } + + if obj.TimeseriesWidgetDefinition != nil { + return obj.TimeseriesWidgetDefinition + } + + if obj.ToplistWidgetDefinition != nil { + return obj.ToplistWidgetDefinition + } + + if obj.TreeMapWidgetDefinition != nil { + return obj.TreeMapWidgetDefinition + } + + if obj.ListStreamWidgetDefinition != nil { + return obj.ListStreamWidgetDefinition + } + + if obj.FunnelWidgetDefinition != nil { + return obj.FunnelWidgetDefinition + } + + // all schemas are nil + return nil +} + +// NullableWidgetDefinition handles when a null is used for WidgetDefinition. +type NullableWidgetDefinition struct { + value *WidgetDefinition + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetDefinition) Get() *WidgetDefinition { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetDefinition) Set(val *WidgetDefinition) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetDefinition) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableWidgetDefinition) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetDefinition initializes the struct as if Set has been called. +func NewNullableWidgetDefinition(val *WidgetDefinition) *NullableWidgetDefinition { + return &NullableWidgetDefinition{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetDefinition) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetDefinition) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_display_type.go b/api/v1/datadog/model_widget_display_type.go new file mode 100644 index 00000000000..f30e18d8a71 --- /dev/null +++ b/api/v1/datadog/model_widget_display_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetDisplayType Type of display to use for the request. +type WidgetDisplayType string + +// List of WidgetDisplayType. +const ( + WIDGETDISPLAYTYPE_AREA WidgetDisplayType = "area" + WIDGETDISPLAYTYPE_BARS WidgetDisplayType = "bars" + WIDGETDISPLAYTYPE_LINE WidgetDisplayType = "line" +) + +var allowedWidgetDisplayTypeEnumValues = []WidgetDisplayType{ + WIDGETDISPLAYTYPE_AREA, + WIDGETDISPLAYTYPE_BARS, + WIDGETDISPLAYTYPE_LINE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetDisplayType) GetAllowedValues() []WidgetDisplayType { + return allowedWidgetDisplayTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetDisplayType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetDisplayType(value) + return nil +} + +// NewWidgetDisplayTypeFromValue returns a pointer to a valid WidgetDisplayType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetDisplayTypeFromValue(v string) (*WidgetDisplayType, error) { + ev := WidgetDisplayType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetDisplayType: valid values are %v", v, allowedWidgetDisplayTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetDisplayType) IsValid() bool { + for _, existing := range allowedWidgetDisplayTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetDisplayType value. +func (v WidgetDisplayType) Ptr() *WidgetDisplayType { + return &v +} + +// NullableWidgetDisplayType handles when a null is used for WidgetDisplayType. +type NullableWidgetDisplayType struct { + value *WidgetDisplayType + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetDisplayType) Get() *WidgetDisplayType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetDisplayType) Set(val *WidgetDisplayType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetDisplayType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetDisplayType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetDisplayType initializes the struct as if Set has been called. +func NewNullableWidgetDisplayType(val *WidgetDisplayType) *NullableWidgetDisplayType { + return &NullableWidgetDisplayType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetDisplayType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetDisplayType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_event.go b/api/v1/datadog/model_widget_event.go new file mode 100644 index 00000000000..641a2ce567e --- /dev/null +++ b/api/v1/datadog/model_widget_event.go @@ -0,0 +1,145 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetEvent Event overlay control options. +// +// See the dedicated [Events JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/widget_json/#events-schema) +// to learn how to build the ``. +type WidgetEvent struct { + // Query definition. + Q string `json:"q"` + // The execution method for multi-value filters. + TagsExecution *string `json:"tags_execution,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{} +} + +// NewWidgetEvent instantiates a new WidgetEvent 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 NewWidgetEvent(q string) *WidgetEvent { + this := WidgetEvent{} + this.Q = q + return &this +} + +// NewWidgetEventWithDefaults instantiates a new WidgetEvent 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 NewWidgetEventWithDefaults() *WidgetEvent { + this := WidgetEvent{} + return &this +} + +// GetQ returns the Q field value. +func (o *WidgetEvent) GetQ() string { + if o == nil { + var ret string + return ret + } + return o.Q +} + +// GetQOk returns a tuple with the Q field value +// and a boolean to check if the value has been set. +func (o *WidgetEvent) GetQOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Q, true +} + +// SetQ sets field value. +func (o *WidgetEvent) SetQ(v string) { + o.Q = v +} + +// GetTagsExecution returns the TagsExecution field value if set, zero value otherwise. +func (o *WidgetEvent) GetTagsExecution() string { + if o == nil || o.TagsExecution == nil { + var ret string + return ret + } + return *o.TagsExecution +} + +// GetTagsExecutionOk returns a tuple with the TagsExecution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetEvent) GetTagsExecutionOk() (*string, bool) { + if o == nil || o.TagsExecution == nil { + return nil, false + } + return o.TagsExecution, true +} + +// HasTagsExecution returns a boolean if a field has been set. +func (o *WidgetEvent) HasTagsExecution() bool { + if o != nil && o.TagsExecution != nil { + return true + } + + return false +} + +// SetTagsExecution gets a reference to the given string and assigns it to the TagsExecution field. +func (o *WidgetEvent) SetTagsExecution(v string) { + o.TagsExecution = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetEvent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["q"] = o.Q + if o.TagsExecution != nil { + toSerialize["tags_execution"] = o.TagsExecution + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetEvent) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Q *string `json:"q"` + }{} + all := struct { + Q string `json:"q"` + TagsExecution *string `json:"tags_execution,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Q == nil { + return fmt.Errorf("Required field q missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Q = all.Q + o.TagsExecution = all.TagsExecution + return nil +} diff --git a/api/v1/datadog/model_widget_event_size.go b/api/v1/datadog/model_widget_event_size.go new file mode 100644 index 00000000000..6fb987ba7ff --- /dev/null +++ b/api/v1/datadog/model_widget_event_size.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetEventSize Size to use to display an event. +type WidgetEventSize string + +// List of WidgetEventSize. +const ( + WIDGETEVENTSIZE_SMALL WidgetEventSize = "s" + WIDGETEVENTSIZE_LARGE WidgetEventSize = "l" +) + +var allowedWidgetEventSizeEnumValues = []WidgetEventSize{ + WIDGETEVENTSIZE_SMALL, + WIDGETEVENTSIZE_LARGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetEventSize) GetAllowedValues() []WidgetEventSize { + return allowedWidgetEventSizeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetEventSize) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetEventSize(value) + return nil +} + +// NewWidgetEventSizeFromValue returns a pointer to a valid WidgetEventSize +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetEventSizeFromValue(v string) (*WidgetEventSize, error) { + ev := WidgetEventSize(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetEventSize: valid values are %v", v, allowedWidgetEventSizeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetEventSize) IsValid() bool { + for _, existing := range allowedWidgetEventSizeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetEventSize value. +func (v WidgetEventSize) Ptr() *WidgetEventSize { + return &v +} + +// NullableWidgetEventSize handles when a null is used for WidgetEventSize. +type NullableWidgetEventSize struct { + value *WidgetEventSize + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetEventSize) Get() *WidgetEventSize { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetEventSize) Set(val *WidgetEventSize) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetEventSize) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetEventSize) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetEventSize initializes the struct as if Set has been called. +func NewNullableWidgetEventSize(val *WidgetEventSize) *NullableWidgetEventSize { + return &NullableWidgetEventSize{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetEventSize) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetEventSize) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_field_sort.go b/api/v1/datadog/model_widget_field_sort.go new file mode 100644 index 00000000000..6b3066b37b0 --- /dev/null +++ b/api/v1/datadog/model_widget_field_sort.go @@ -0,0 +1,144 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetFieldSort Which column and order to sort by +type WidgetFieldSort struct { + // Facet path for the column + Column string `json:"column"` + // Widget sorting methods. + Order WidgetSort `json:"order"` + // 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{} +} + +// NewWidgetFieldSort instantiates a new WidgetFieldSort 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 NewWidgetFieldSort(column string, order WidgetSort) *WidgetFieldSort { + this := WidgetFieldSort{} + this.Column = column + this.Order = order + return &this +} + +// NewWidgetFieldSortWithDefaults instantiates a new WidgetFieldSort 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 NewWidgetFieldSortWithDefaults() *WidgetFieldSort { + this := WidgetFieldSort{} + return &this +} + +// GetColumn returns the Column field value. +func (o *WidgetFieldSort) GetColumn() string { + if o == nil { + var ret string + return ret + } + return o.Column +} + +// GetColumnOk returns a tuple with the Column field value +// and a boolean to check if the value has been set. +func (o *WidgetFieldSort) GetColumnOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Column, true +} + +// SetColumn sets field value. +func (o *WidgetFieldSort) SetColumn(v string) { + o.Column = v +} + +// GetOrder returns the Order field value. +func (o *WidgetFieldSort) GetOrder() WidgetSort { + if o == nil { + var ret WidgetSort + return ret + } + return o.Order +} + +// GetOrderOk returns a tuple with the Order field value +// and a boolean to check if the value has been set. +func (o *WidgetFieldSort) GetOrderOk() (*WidgetSort, bool) { + if o == nil { + return nil, false + } + return &o.Order, true +} + +// SetOrder sets field value. +func (o *WidgetFieldSort) SetOrder(v WidgetSort) { + o.Order = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetFieldSort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["column"] = o.Column + toSerialize["order"] = o.Order + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetFieldSort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Column *string `json:"column"` + Order *WidgetSort `json:"order"` + }{} + all := struct { + Column string `json:"column"` + Order WidgetSort `json:"order"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Column == nil { + return fmt.Errorf("Required field column missing") + } + if required.Order == nil { + return fmt.Errorf("Required field order missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Column = all.Column + o.Order = all.Order + return nil +} diff --git a/api/v1/datadog/model_widget_formula.go b/api/v1/datadog/model_widget_formula.go new file mode 100644 index 00000000000..8ddc2fef617 --- /dev/null +++ b/api/v1/datadog/model_widget_formula.go @@ -0,0 +1,274 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetFormula Formula to be used in a widget query. +type WidgetFormula struct { + // Expression alias. + Alias *string `json:"alias,omitempty"` + // Define a display mode for the table cell. + CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` + // List of conditional formats. + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + // String expression built from queries, formulas, and functions. + Formula string `json:"formula"` + // Options for limiting results returned. + Limit *WidgetFormulaLimit `json:"limit,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{} +} + +// NewWidgetFormula instantiates a new WidgetFormula 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 NewWidgetFormula(formula string) *WidgetFormula { + this := WidgetFormula{} + this.Formula = formula + return &this +} + +// NewWidgetFormulaWithDefaults instantiates a new WidgetFormula 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 NewWidgetFormulaWithDefaults() *WidgetFormula { + this := WidgetFormula{} + return &this +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *WidgetFormula) GetAlias() string { + if o == nil || o.Alias == nil { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetFormula) GetAliasOk() (*string, bool) { + if o == nil || o.Alias == nil { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *WidgetFormula) HasAlias() bool { + if o != nil && o.Alias != nil { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *WidgetFormula) SetAlias(v string) { + o.Alias = &v +} + +// GetCellDisplayMode returns the CellDisplayMode field value if set, zero value otherwise. +func (o *WidgetFormula) GetCellDisplayMode() TableWidgetCellDisplayMode { + if o == nil || o.CellDisplayMode == nil { + var ret TableWidgetCellDisplayMode + return ret + } + return *o.CellDisplayMode +} + +// GetCellDisplayModeOk returns a tuple with the CellDisplayMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetFormula) GetCellDisplayModeOk() (*TableWidgetCellDisplayMode, bool) { + if o == nil || o.CellDisplayMode == nil { + return nil, false + } + return o.CellDisplayMode, true +} + +// HasCellDisplayMode returns a boolean if a field has been set. +func (o *WidgetFormula) HasCellDisplayMode() bool { + if o != nil && o.CellDisplayMode != nil { + return true + } + + return false +} + +// SetCellDisplayMode gets a reference to the given TableWidgetCellDisplayMode and assigns it to the CellDisplayMode field. +func (o *WidgetFormula) SetCellDisplayMode(v TableWidgetCellDisplayMode) { + o.CellDisplayMode = &v +} + +// GetConditionalFormats returns the ConditionalFormats field value if set, zero value otherwise. +func (o *WidgetFormula) GetConditionalFormats() []WidgetConditionalFormat { + if o == nil || o.ConditionalFormats == nil { + var ret []WidgetConditionalFormat + return ret + } + return o.ConditionalFormats +} + +// GetConditionalFormatsOk returns a tuple with the ConditionalFormats field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetFormula) GetConditionalFormatsOk() (*[]WidgetConditionalFormat, bool) { + if o == nil || o.ConditionalFormats == nil { + return nil, false + } + return &o.ConditionalFormats, true +} + +// HasConditionalFormats returns a boolean if a field has been set. +func (o *WidgetFormula) HasConditionalFormats() bool { + if o != nil && o.ConditionalFormats != nil { + return true + } + + return false +} + +// SetConditionalFormats gets a reference to the given []WidgetConditionalFormat and assigns it to the ConditionalFormats field. +func (o *WidgetFormula) SetConditionalFormats(v []WidgetConditionalFormat) { + o.ConditionalFormats = v +} + +// GetFormula returns the Formula field value. +func (o *WidgetFormula) GetFormula() string { + if o == nil { + var ret string + return ret + } + return o.Formula +} + +// GetFormulaOk returns a tuple with the Formula field value +// and a boolean to check if the value has been set. +func (o *WidgetFormula) GetFormulaOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Formula, true +} + +// SetFormula sets field value. +func (o *WidgetFormula) SetFormula(v string) { + o.Formula = v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *WidgetFormula) GetLimit() WidgetFormulaLimit { + if o == nil || o.Limit == nil { + var ret WidgetFormulaLimit + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetFormula) GetLimitOk() (*WidgetFormulaLimit, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *WidgetFormula) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given WidgetFormulaLimit and assigns it to the Limit field. +func (o *WidgetFormula) SetLimit(v WidgetFormulaLimit) { + o.Limit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetFormula) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Alias != nil { + toSerialize["alias"] = o.Alias + } + if o.CellDisplayMode != nil { + toSerialize["cell_display_mode"] = o.CellDisplayMode + } + if o.ConditionalFormats != nil { + toSerialize["conditional_formats"] = o.ConditionalFormats + } + toSerialize["formula"] = o.Formula + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Formula *string `json:"formula"` + }{} + all := struct { + Alias *string `json:"alias,omitempty"` + CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` + ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` + Formula string `json:"formula"` + Limit *WidgetFormulaLimit `json:"limit,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Formula == nil { + return fmt.Errorf("Required field formula missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.CellDisplayMode; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Alias = all.Alias + o.CellDisplayMode = all.CellDisplayMode + o.ConditionalFormats = all.ConditionalFormats + o.Formula = all.Formula + if all.Limit != nil && all.Limit.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Limit = all.Limit + return nil +} diff --git a/api/v1/datadog/model_widget_formula_limit.go b/api/v1/datadog/model_widget_formula_limit.go new file mode 100644 index 00000000000..80f36c5ecc1 --- /dev/null +++ b/api/v1/datadog/model_widget_formula_limit.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// WidgetFormulaLimit Options for limiting results returned. +type WidgetFormulaLimit struct { + // Number of results to return. + Count *int64 `json:"count,omitempty"` + // Direction of sort. + Order *QuerySortOrder `json:"order,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{} +} + +// NewWidgetFormulaLimit instantiates a new WidgetFormulaLimit 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 NewWidgetFormulaLimit() *WidgetFormulaLimit { + this := WidgetFormulaLimit{} + var order QuerySortOrder = QUERYSORTORDER_DESC + this.Order = &order + return &this +} + +// NewWidgetFormulaLimitWithDefaults instantiates a new WidgetFormulaLimit 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 NewWidgetFormulaLimitWithDefaults() *WidgetFormulaLimit { + this := WidgetFormulaLimit{} + var order QuerySortOrder = QUERYSORTORDER_DESC + this.Order = &order + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *WidgetFormulaLimit) GetCount() int64 { + if o == nil || o.Count == nil { + var ret int64 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetFormulaLimit) GetCountOk() (*int64, bool) { + if o == nil || o.Count == nil { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *WidgetFormulaLimit) HasCount() bool { + if o != nil && o.Count != nil { + return true + } + + return false +} + +// SetCount gets a reference to the given int64 and assigns it to the Count field. +func (o *WidgetFormulaLimit) SetCount(v int64) { + o.Count = &v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *WidgetFormulaLimit) GetOrder() QuerySortOrder { + if o == nil || o.Order == nil { + var ret QuerySortOrder + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetFormulaLimit) GetOrderOk() (*QuerySortOrder, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *WidgetFormulaLimit) HasOrder() bool { + if o != nil && o.Order != nil { + return true + } + + return false +} + +// SetOrder gets a reference to the given QuerySortOrder and assigns it to the Order field. +func (o *WidgetFormulaLimit) SetOrder(v QuerySortOrder) { + o.Order = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetFormulaLimit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Count != nil { + toSerialize["count"] = o.Count + } + if o.Order != nil { + toSerialize["order"] = o.Order + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetFormulaLimit) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Count *int64 `json:"count,omitempty"` + Order *QuerySortOrder `json:"order,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Count = all.Count + o.Order = all.Order + return nil +} diff --git a/api/v1/datadog/model_widget_grouping.go b/api/v1/datadog/model_widget_grouping.go new file mode 100644 index 00000000000..e55212d35d9 --- /dev/null +++ b/api/v1/datadog/model_widget_grouping.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetGrouping The kind of grouping to use. +type WidgetGrouping string + +// List of WidgetGrouping. +const ( + WIDGETGROUPING_CHECK WidgetGrouping = "check" + WIDGETGROUPING_CLUSTER WidgetGrouping = "cluster" +) + +var allowedWidgetGroupingEnumValues = []WidgetGrouping{ + WIDGETGROUPING_CHECK, + WIDGETGROUPING_CLUSTER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetGrouping) GetAllowedValues() []WidgetGrouping { + return allowedWidgetGroupingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetGrouping) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetGrouping(value) + return nil +} + +// NewWidgetGroupingFromValue returns a pointer to a valid WidgetGrouping +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetGroupingFromValue(v string) (*WidgetGrouping, error) { + ev := WidgetGrouping(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetGrouping: valid values are %v", v, allowedWidgetGroupingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetGrouping) IsValid() bool { + for _, existing := range allowedWidgetGroupingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetGrouping value. +func (v WidgetGrouping) Ptr() *WidgetGrouping { + return &v +} + +// NullableWidgetGrouping handles when a null is used for WidgetGrouping. +type NullableWidgetGrouping struct { + value *WidgetGrouping + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetGrouping) Get() *WidgetGrouping { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetGrouping) Set(val *WidgetGrouping) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetGrouping) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetGrouping) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetGrouping initializes the struct as if Set has been called. +func NewNullableWidgetGrouping(val *WidgetGrouping) *NullableWidgetGrouping { + return &NullableWidgetGrouping{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetGrouping) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetGrouping) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_horizontal_align.go b/api/v1/datadog/model_widget_horizontal_align.go new file mode 100644 index 00000000000..9e0bd5c1f0e --- /dev/null +++ b/api/v1/datadog/model_widget_horizontal_align.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetHorizontalAlign Horizontal alignment. +type WidgetHorizontalAlign string + +// List of WidgetHorizontalAlign. +const ( + WIDGETHORIZONTALALIGN_CENTER WidgetHorizontalAlign = "center" + WIDGETHORIZONTALALIGN_LEFT WidgetHorizontalAlign = "left" + WIDGETHORIZONTALALIGN_RIGHT WidgetHorizontalAlign = "right" +) + +var allowedWidgetHorizontalAlignEnumValues = []WidgetHorizontalAlign{ + WIDGETHORIZONTALALIGN_CENTER, + WIDGETHORIZONTALALIGN_LEFT, + WIDGETHORIZONTALALIGN_RIGHT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetHorizontalAlign) GetAllowedValues() []WidgetHorizontalAlign { + return allowedWidgetHorizontalAlignEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetHorizontalAlign) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetHorizontalAlign(value) + return nil +} + +// NewWidgetHorizontalAlignFromValue returns a pointer to a valid WidgetHorizontalAlign +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetHorizontalAlignFromValue(v string) (*WidgetHorizontalAlign, error) { + ev := WidgetHorizontalAlign(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetHorizontalAlign: valid values are %v", v, allowedWidgetHorizontalAlignEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetHorizontalAlign) IsValid() bool { + for _, existing := range allowedWidgetHorizontalAlignEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetHorizontalAlign value. +func (v WidgetHorizontalAlign) Ptr() *WidgetHorizontalAlign { + return &v +} + +// NullableWidgetHorizontalAlign handles when a null is used for WidgetHorizontalAlign. +type NullableWidgetHorizontalAlign struct { + value *WidgetHorizontalAlign + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetHorizontalAlign) Get() *WidgetHorizontalAlign { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetHorizontalAlign) Set(val *WidgetHorizontalAlign) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetHorizontalAlign) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetHorizontalAlign) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetHorizontalAlign initializes the struct as if Set has been called. +func NewNullableWidgetHorizontalAlign(val *WidgetHorizontalAlign) *NullableWidgetHorizontalAlign { + return &NullableWidgetHorizontalAlign{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetHorizontalAlign) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetHorizontalAlign) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_image_sizing.go b/api/v1/datadog/model_widget_image_sizing.go new file mode 100644 index 00000000000..5bd7eb92f4c --- /dev/null +++ b/api/v1/datadog/model_widget_image_sizing.go @@ -0,0 +1,122 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetImageSizing How to size the image on the widget. The values are based on the image `object-fit` CSS properties. +// **Note**: `zoom`, `fit` and `center` values are deprecated. +type WidgetImageSizing string + +// List of WidgetImageSizing. +const ( + WIDGETIMAGESIZING_FILL WidgetImageSizing = "fill" + WIDGETIMAGESIZING_CONTAIN WidgetImageSizing = "contain" + WIDGETIMAGESIZING_COVER WidgetImageSizing = "cover" + WIDGETIMAGESIZING_NONE WidgetImageSizing = "none" + WIDGETIMAGESIZING_SCALEDOWN WidgetImageSizing = "scale-down" + WIDGETIMAGESIZING_ZOOM WidgetImageSizing = "zoom" + WIDGETIMAGESIZING_FIT WidgetImageSizing = "fit" + WIDGETIMAGESIZING_CENTER WidgetImageSizing = "center" +) + +var allowedWidgetImageSizingEnumValues = []WidgetImageSizing{ + WIDGETIMAGESIZING_FILL, + WIDGETIMAGESIZING_CONTAIN, + WIDGETIMAGESIZING_COVER, + WIDGETIMAGESIZING_NONE, + WIDGETIMAGESIZING_SCALEDOWN, + WIDGETIMAGESIZING_ZOOM, + WIDGETIMAGESIZING_FIT, + WIDGETIMAGESIZING_CENTER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetImageSizing) GetAllowedValues() []WidgetImageSizing { + return allowedWidgetImageSizingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetImageSizing) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetImageSizing(value) + return nil +} + +// NewWidgetImageSizingFromValue returns a pointer to a valid WidgetImageSizing +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetImageSizingFromValue(v string) (*WidgetImageSizing, error) { + ev := WidgetImageSizing(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetImageSizing: valid values are %v", v, allowedWidgetImageSizingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetImageSizing) IsValid() bool { + for _, existing := range allowedWidgetImageSizingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetImageSizing value. +func (v WidgetImageSizing) Ptr() *WidgetImageSizing { + return &v +} + +// NullableWidgetImageSizing handles when a null is used for WidgetImageSizing. +type NullableWidgetImageSizing struct { + value *WidgetImageSizing + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetImageSizing) Get() *WidgetImageSizing { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetImageSizing) Set(val *WidgetImageSizing) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetImageSizing) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetImageSizing) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetImageSizing initializes the struct as if Set has been called. +func NewNullableWidgetImageSizing(val *WidgetImageSizing) *NullableWidgetImageSizing { + return &NullableWidgetImageSizing{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetImageSizing) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetImageSizing) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_layout.go b/api/v1/datadog/model_widget_layout.go new file mode 100644 index 00000000000..38369b8a64c --- /dev/null +++ b/api/v1/datadog/model_widget_layout.go @@ -0,0 +1,242 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetLayout The layout for a widget on a `free` or **new dashboard layout** dashboard. +type WidgetLayout struct { + // The height of the widget. Should be a non-negative integer. + Height int64 `json:"height"` + // Whether the widget should be the first one on the second column in high density or not. + // **Note**: Only for the **new dashboard layout** and only one widget in the dashboard should have this property set to `true`. + IsColumnBreak *bool `json:"is_column_break,omitempty"` + // The width of the widget. Should be a non-negative integer. + Width int64 `json:"width"` + // The position of the widget on the x (horizontal) axis. Should be a non-negative integer. + X int64 `json:"x"` + // The position of the widget on the y (vertical) axis. Should be a non-negative integer. + Y int64 `json:"y"` + // 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{} +} + +// NewWidgetLayout instantiates a new WidgetLayout 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 NewWidgetLayout(height int64, width int64, x int64, y int64) *WidgetLayout { + this := WidgetLayout{} + this.Height = height + this.Width = width + this.X = x + this.Y = y + return &this +} + +// NewWidgetLayoutWithDefaults instantiates a new WidgetLayout 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 NewWidgetLayoutWithDefaults() *WidgetLayout { + this := WidgetLayout{} + return &this +} + +// GetHeight returns the Height field value. +func (o *WidgetLayout) GetHeight() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Height +} + +// GetHeightOk returns a tuple with the Height field value +// and a boolean to check if the value has been set. +func (o *WidgetLayout) GetHeightOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Height, true +} + +// SetHeight sets field value. +func (o *WidgetLayout) SetHeight(v int64) { + o.Height = v +} + +// GetIsColumnBreak returns the IsColumnBreak field value if set, zero value otherwise. +func (o *WidgetLayout) GetIsColumnBreak() bool { + if o == nil || o.IsColumnBreak == nil { + var ret bool + return ret + } + return *o.IsColumnBreak +} + +// GetIsColumnBreakOk returns a tuple with the IsColumnBreak field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetLayout) GetIsColumnBreakOk() (*bool, bool) { + if o == nil || o.IsColumnBreak == nil { + return nil, false + } + return o.IsColumnBreak, true +} + +// HasIsColumnBreak returns a boolean if a field has been set. +func (o *WidgetLayout) HasIsColumnBreak() bool { + if o != nil && o.IsColumnBreak != nil { + return true + } + + return false +} + +// SetIsColumnBreak gets a reference to the given bool and assigns it to the IsColumnBreak field. +func (o *WidgetLayout) SetIsColumnBreak(v bool) { + o.IsColumnBreak = &v +} + +// GetWidth returns the Width field value. +func (o *WidgetLayout) GetWidth() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Width +} + +// GetWidthOk returns a tuple with the Width field value +// and a boolean to check if the value has been set. +func (o *WidgetLayout) GetWidthOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Width, true +} + +// SetWidth sets field value. +func (o *WidgetLayout) SetWidth(v int64) { + o.Width = v +} + +// GetX returns the X field value. +func (o *WidgetLayout) GetX() int64 { + if o == nil { + var ret int64 + return ret + } + return o.X +} + +// GetXOk returns a tuple with the X field value +// and a boolean to check if the value has been set. +func (o *WidgetLayout) GetXOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.X, true +} + +// SetX sets field value. +func (o *WidgetLayout) SetX(v int64) { + o.X = v +} + +// GetY returns the Y field value. +func (o *WidgetLayout) GetY() int64 { + if o == nil { + var ret int64 + return ret + } + return o.Y +} + +// GetYOk returns a tuple with the Y field value +// and a boolean to check if the value has been set. +func (o *WidgetLayout) GetYOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Y, true +} + +// SetY sets field value. +func (o *WidgetLayout) SetY(v int64) { + o.Y = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetLayout) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["height"] = o.Height + if o.IsColumnBreak != nil { + toSerialize["is_column_break"] = o.IsColumnBreak + } + toSerialize["width"] = o.Width + toSerialize["x"] = o.X + toSerialize["y"] = o.Y + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetLayout) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Height *int64 `json:"height"` + Width *int64 `json:"width"` + X *int64 `json:"x"` + Y *int64 `json:"y"` + }{} + all := struct { + Height int64 `json:"height"` + IsColumnBreak *bool `json:"is_column_break,omitempty"` + Width int64 `json:"width"` + X int64 `json:"x"` + Y int64 `json:"y"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Height == nil { + return fmt.Errorf("Required field height missing") + } + if required.Width == nil { + return fmt.Errorf("Required field width missing") + } + if required.X == nil { + return fmt.Errorf("Required field x missing") + } + if required.Y == nil { + return fmt.Errorf("Required field y missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Height = all.Height + o.IsColumnBreak = all.IsColumnBreak + o.Width = all.Width + o.X = all.X + o.Y = all.Y + return nil +} diff --git a/api/v1/datadog/model_widget_layout_type.go b/api/v1/datadog/model_widget_layout_type.go new file mode 100644 index 00000000000..6749c249c0c --- /dev/null +++ b/api/v1/datadog/model_widget_layout_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetLayoutType Layout type of the group. +type WidgetLayoutType string + +// List of WidgetLayoutType. +const ( + WIDGETLAYOUTTYPE_ORDERED WidgetLayoutType = "ordered" +) + +var allowedWidgetLayoutTypeEnumValues = []WidgetLayoutType{ + WIDGETLAYOUTTYPE_ORDERED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetLayoutType) GetAllowedValues() []WidgetLayoutType { + return allowedWidgetLayoutTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetLayoutType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetLayoutType(value) + return nil +} + +// NewWidgetLayoutTypeFromValue returns a pointer to a valid WidgetLayoutType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetLayoutTypeFromValue(v string) (*WidgetLayoutType, error) { + ev := WidgetLayoutType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetLayoutType: valid values are %v", v, allowedWidgetLayoutTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetLayoutType) IsValid() bool { + for _, existing := range allowedWidgetLayoutTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetLayoutType value. +func (v WidgetLayoutType) Ptr() *WidgetLayoutType { + return &v +} + +// NullableWidgetLayoutType handles when a null is used for WidgetLayoutType. +type NullableWidgetLayoutType struct { + value *WidgetLayoutType + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetLayoutType) Get() *WidgetLayoutType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetLayoutType) Set(val *WidgetLayoutType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetLayoutType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetLayoutType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetLayoutType initializes the struct as if Set has been called. +func NewNullableWidgetLayoutType(val *WidgetLayoutType) *NullableWidgetLayoutType { + return &NullableWidgetLayoutType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetLayoutType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetLayoutType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_line_type.go b/api/v1/datadog/model_widget_line_type.go new file mode 100644 index 00000000000..2bc795659d6 --- /dev/null +++ b/api/v1/datadog/model_widget_line_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetLineType Type of lines displayed. +type WidgetLineType string + +// List of WidgetLineType. +const ( + WIDGETLINETYPE_DASHED WidgetLineType = "dashed" + WIDGETLINETYPE_DOTTED WidgetLineType = "dotted" + WIDGETLINETYPE_SOLID WidgetLineType = "solid" +) + +var allowedWidgetLineTypeEnumValues = []WidgetLineType{ + WIDGETLINETYPE_DASHED, + WIDGETLINETYPE_DOTTED, + WIDGETLINETYPE_SOLID, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetLineType) GetAllowedValues() []WidgetLineType { + return allowedWidgetLineTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetLineType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetLineType(value) + return nil +} + +// NewWidgetLineTypeFromValue returns a pointer to a valid WidgetLineType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetLineTypeFromValue(v string) (*WidgetLineType, error) { + ev := WidgetLineType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetLineType: valid values are %v", v, allowedWidgetLineTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetLineType) IsValid() bool { + for _, existing := range allowedWidgetLineTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetLineType value. +func (v WidgetLineType) Ptr() *WidgetLineType { + return &v +} + +// NullableWidgetLineType handles when a null is used for WidgetLineType. +type NullableWidgetLineType struct { + value *WidgetLineType + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetLineType) Get() *WidgetLineType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetLineType) Set(val *WidgetLineType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetLineType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetLineType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetLineType initializes the struct as if Set has been called. +func NewNullableWidgetLineType(val *WidgetLineType) *NullableWidgetLineType { + return &NullableWidgetLineType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetLineType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetLineType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_line_width.go b/api/v1/datadog/model_widget_line_width.go new file mode 100644 index 00000000000..2b98f1fbcc6 --- /dev/null +++ b/api/v1/datadog/model_widget_line_width.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetLineWidth Width of line displayed. +type WidgetLineWidth string + +// List of WidgetLineWidth. +const ( + WIDGETLINEWIDTH_NORMAL WidgetLineWidth = "normal" + WIDGETLINEWIDTH_THICK WidgetLineWidth = "thick" + WIDGETLINEWIDTH_THIN WidgetLineWidth = "thin" +) + +var allowedWidgetLineWidthEnumValues = []WidgetLineWidth{ + WIDGETLINEWIDTH_NORMAL, + WIDGETLINEWIDTH_THICK, + WIDGETLINEWIDTH_THIN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetLineWidth) GetAllowedValues() []WidgetLineWidth { + return allowedWidgetLineWidthEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetLineWidth) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetLineWidth(value) + return nil +} + +// NewWidgetLineWidthFromValue returns a pointer to a valid WidgetLineWidth +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetLineWidthFromValue(v string) (*WidgetLineWidth, error) { + ev := WidgetLineWidth(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetLineWidth: valid values are %v", v, allowedWidgetLineWidthEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetLineWidth) IsValid() bool { + for _, existing := range allowedWidgetLineWidthEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetLineWidth value. +func (v WidgetLineWidth) Ptr() *WidgetLineWidth { + return &v +} + +// NullableWidgetLineWidth handles when a null is used for WidgetLineWidth. +type NullableWidgetLineWidth struct { + value *WidgetLineWidth + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetLineWidth) Get() *WidgetLineWidth { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetLineWidth) Set(val *WidgetLineWidth) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetLineWidth) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetLineWidth) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetLineWidth initializes the struct as if Set has been called. +func NewNullableWidgetLineWidth(val *WidgetLineWidth) *NullableWidgetLineWidth { + return &NullableWidgetLineWidth{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetLineWidth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetLineWidth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_live_span.go b/api/v1/datadog/model_widget_live_span.go new file mode 100644 index 00000000000..c027024abac --- /dev/null +++ b/api/v1/datadog/model_widget_live_span.go @@ -0,0 +1,135 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetLiveSpan The available timeframes depend on the widget you are using. +type WidgetLiveSpan string + +// List of WidgetLiveSpan. +const ( + WIDGETLIVESPAN_PAST_ONE_MINUTE WidgetLiveSpan = "1m" + WIDGETLIVESPAN_PAST_FIVE_MINUTES WidgetLiveSpan = "5m" + WIDGETLIVESPAN_PAST_TEN_MINUTES WidgetLiveSpan = "10m" + WIDGETLIVESPAN_PAST_FIFTEEN_MINUTES WidgetLiveSpan = "15m" + WIDGETLIVESPAN_PAST_THIRTY_MINUTES WidgetLiveSpan = "30m" + WIDGETLIVESPAN_PAST_ONE_HOUR WidgetLiveSpan = "1h" + WIDGETLIVESPAN_PAST_FOUR_HOURS WidgetLiveSpan = "4h" + WIDGETLIVESPAN_PAST_ONE_DAY WidgetLiveSpan = "1d" + WIDGETLIVESPAN_PAST_TWO_DAYS WidgetLiveSpan = "2d" + WIDGETLIVESPAN_PAST_ONE_WEEK WidgetLiveSpan = "1w" + WIDGETLIVESPAN_PAST_ONE_MONTH WidgetLiveSpan = "1mo" + WIDGETLIVESPAN_PAST_THREE_MONTHS WidgetLiveSpan = "3mo" + WIDGETLIVESPAN_PAST_SIX_MONTHS WidgetLiveSpan = "6mo" + WIDGETLIVESPAN_PAST_ONE_YEAR WidgetLiveSpan = "1y" + WIDGETLIVESPAN_ALERT WidgetLiveSpan = "alert" +) + +var allowedWidgetLiveSpanEnumValues = []WidgetLiveSpan{ + WIDGETLIVESPAN_PAST_ONE_MINUTE, + WIDGETLIVESPAN_PAST_FIVE_MINUTES, + WIDGETLIVESPAN_PAST_TEN_MINUTES, + WIDGETLIVESPAN_PAST_FIFTEEN_MINUTES, + WIDGETLIVESPAN_PAST_THIRTY_MINUTES, + WIDGETLIVESPAN_PAST_ONE_HOUR, + WIDGETLIVESPAN_PAST_FOUR_HOURS, + WIDGETLIVESPAN_PAST_ONE_DAY, + WIDGETLIVESPAN_PAST_TWO_DAYS, + WIDGETLIVESPAN_PAST_ONE_WEEK, + WIDGETLIVESPAN_PAST_ONE_MONTH, + WIDGETLIVESPAN_PAST_THREE_MONTHS, + WIDGETLIVESPAN_PAST_SIX_MONTHS, + WIDGETLIVESPAN_PAST_ONE_YEAR, + WIDGETLIVESPAN_ALERT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetLiveSpan) GetAllowedValues() []WidgetLiveSpan { + return allowedWidgetLiveSpanEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetLiveSpan) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetLiveSpan(value) + return nil +} + +// NewWidgetLiveSpanFromValue returns a pointer to a valid WidgetLiveSpan +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetLiveSpanFromValue(v string) (*WidgetLiveSpan, error) { + ev := WidgetLiveSpan(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetLiveSpan: valid values are %v", v, allowedWidgetLiveSpanEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetLiveSpan) IsValid() bool { + for _, existing := range allowedWidgetLiveSpanEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetLiveSpan value. +func (v WidgetLiveSpan) Ptr() *WidgetLiveSpan { + return &v +} + +// NullableWidgetLiveSpan handles when a null is used for WidgetLiveSpan. +type NullableWidgetLiveSpan struct { + value *WidgetLiveSpan + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetLiveSpan) Get() *WidgetLiveSpan { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetLiveSpan) Set(val *WidgetLiveSpan) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetLiveSpan) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetLiveSpan) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetLiveSpan initializes the struct as if Set has been called. +func NewNullableWidgetLiveSpan(val *WidgetLiveSpan) *NullableWidgetLiveSpan { + return &NullableWidgetLiveSpan{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetLiveSpan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetLiveSpan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_margin.go b/api/v1/datadog/model_widget_margin.go new file mode 100644 index 00000000000..20f504f70f8 --- /dev/null +++ b/api/v1/datadog/model_widget_margin.go @@ -0,0 +1,116 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetMargin Size of the margins around the image. +// **Note**: `small` and `large` values are deprecated. +type WidgetMargin string + +// List of WidgetMargin. +const ( + WIDGETMARGIN_SM WidgetMargin = "sm" + WIDGETMARGIN_MD WidgetMargin = "md" + WIDGETMARGIN_LG WidgetMargin = "lg" + WIDGETMARGIN_SMALL WidgetMargin = "small" + WIDGETMARGIN_LARGE WidgetMargin = "large" +) + +var allowedWidgetMarginEnumValues = []WidgetMargin{ + WIDGETMARGIN_SM, + WIDGETMARGIN_MD, + WIDGETMARGIN_LG, + WIDGETMARGIN_SMALL, + WIDGETMARGIN_LARGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetMargin) GetAllowedValues() []WidgetMargin { + return allowedWidgetMarginEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetMargin) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetMargin(value) + return nil +} + +// NewWidgetMarginFromValue returns a pointer to a valid WidgetMargin +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetMarginFromValue(v string) (*WidgetMargin, error) { + ev := WidgetMargin(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetMargin: valid values are %v", v, allowedWidgetMarginEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetMargin) IsValid() bool { + for _, existing := range allowedWidgetMarginEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetMargin value. +func (v WidgetMargin) Ptr() *WidgetMargin { + return &v +} + +// NullableWidgetMargin handles when a null is used for WidgetMargin. +type NullableWidgetMargin struct { + value *WidgetMargin + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetMargin) Get() *WidgetMargin { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetMargin) Set(val *WidgetMargin) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetMargin) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetMargin) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetMargin initializes the struct as if Set has been called. +func NewNullableWidgetMargin(val *WidgetMargin) *NullableWidgetMargin { + return &NullableWidgetMargin{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetMargin) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetMargin) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_marker.go b/api/v1/datadog/model_widget_marker.go new file mode 100644 index 00000000000..a70872e463b --- /dev/null +++ b/api/v1/datadog/model_widget_marker.go @@ -0,0 +1,224 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetMarker Markers allow you to add visual conditional formatting for your graphs. +type WidgetMarker struct { + // Combination of: + // - A severity error, warning, ok, or info + // - A line type: dashed, solid, or bold + // In this case of a Distribution widget, this can be set to be `x_axis_percentile`. + // + DisplayType *string `json:"display_type,omitempty"` + // Label to display over the marker. + Label *string `json:"label,omitempty"` + // Timestamp for the widget. + Time *string `json:"time,omitempty"` + // Value to apply. Can be a single value y = 15 or a range of values 0 < y < 10. + Value string `json:"value"` + // 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{} +} + +// NewWidgetMarker instantiates a new WidgetMarker 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 NewWidgetMarker(value string) *WidgetMarker { + this := WidgetMarker{} + this.Value = value + return &this +} + +// NewWidgetMarkerWithDefaults instantiates a new WidgetMarker 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 NewWidgetMarkerWithDefaults() *WidgetMarker { + this := WidgetMarker{} + return &this +} + +// GetDisplayType returns the DisplayType field value if set, zero value otherwise. +func (o *WidgetMarker) GetDisplayType() string { + if o == nil || o.DisplayType == nil { + var ret string + return ret + } + return *o.DisplayType +} + +// GetDisplayTypeOk returns a tuple with the DisplayType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetMarker) GetDisplayTypeOk() (*string, bool) { + if o == nil || o.DisplayType == nil { + return nil, false + } + return o.DisplayType, true +} + +// HasDisplayType returns a boolean if a field has been set. +func (o *WidgetMarker) HasDisplayType() bool { + if o != nil && o.DisplayType != nil { + return true + } + + return false +} + +// SetDisplayType gets a reference to the given string and assigns it to the DisplayType field. +func (o *WidgetMarker) SetDisplayType(v string) { + o.DisplayType = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *WidgetMarker) GetLabel() string { + if o == nil || o.Label == nil { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetMarker) GetLabelOk() (*string, bool) { + if o == nil || o.Label == nil { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *WidgetMarker) HasLabel() bool { + if o != nil && o.Label != nil { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *WidgetMarker) SetLabel(v string) { + o.Label = &v +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *WidgetMarker) GetTime() string { + if o == nil || o.Time == nil { + var ret string + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetMarker) GetTimeOk() (*string, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *WidgetMarker) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given string and assigns it to the Time field. +func (o *WidgetMarker) SetTime(v string) { + o.Time = &v +} + +// GetValue returns the Value field value. +func (o *WidgetMarker) GetValue() string { + if o == nil { + var ret string + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *WidgetMarker) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *WidgetMarker) SetValue(v string) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetMarker) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DisplayType != nil { + toSerialize["display_type"] = o.DisplayType + } + if o.Label != nil { + toSerialize["label"] = o.Label + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Value *string `json:"value"` + }{} + all := struct { + DisplayType *string `json:"display_type,omitempty"` + Label *string `json:"label,omitempty"` + Time *string `json:"time,omitempty"` + Value string `json:"value"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Value == nil { + return fmt.Errorf("Required field value missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DisplayType = all.DisplayType + o.Label = all.Label + o.Time = all.Time + o.Value = all.Value + return nil +} diff --git a/api/v1/datadog/model_widget_message_display.go b/api/v1/datadog/model_widget_message_display.go new file mode 100644 index 00000000000..e5039100d3f --- /dev/null +++ b/api/v1/datadog/model_widget_message_display.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetMessageDisplay Amount of log lines to display +type WidgetMessageDisplay string + +// List of WidgetMessageDisplay. +const ( + WIDGETMESSAGEDISPLAY_INLINE WidgetMessageDisplay = "inline" + WIDGETMESSAGEDISPLAY_EXPANDED_MEDIUM WidgetMessageDisplay = "expanded-md" + WIDGETMESSAGEDISPLAY_EXPANDED_LARGE WidgetMessageDisplay = "expanded-lg" +) + +var allowedWidgetMessageDisplayEnumValues = []WidgetMessageDisplay{ + WIDGETMESSAGEDISPLAY_INLINE, + WIDGETMESSAGEDISPLAY_EXPANDED_MEDIUM, + WIDGETMESSAGEDISPLAY_EXPANDED_LARGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetMessageDisplay) GetAllowedValues() []WidgetMessageDisplay { + return allowedWidgetMessageDisplayEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetMessageDisplay) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetMessageDisplay(value) + return nil +} + +// NewWidgetMessageDisplayFromValue returns a pointer to a valid WidgetMessageDisplay +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetMessageDisplayFromValue(v string) (*WidgetMessageDisplay, error) { + ev := WidgetMessageDisplay(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetMessageDisplay: valid values are %v", v, allowedWidgetMessageDisplayEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetMessageDisplay) IsValid() bool { + for _, existing := range allowedWidgetMessageDisplayEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetMessageDisplay value. +func (v WidgetMessageDisplay) Ptr() *WidgetMessageDisplay { + return &v +} + +// NullableWidgetMessageDisplay handles when a null is used for WidgetMessageDisplay. +type NullableWidgetMessageDisplay struct { + value *WidgetMessageDisplay + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetMessageDisplay) Get() *WidgetMessageDisplay { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetMessageDisplay) Set(val *WidgetMessageDisplay) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetMessageDisplay) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetMessageDisplay) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetMessageDisplay initializes the struct as if Set has been called. +func NewNullableWidgetMessageDisplay(val *WidgetMessageDisplay) *NullableWidgetMessageDisplay { + return &NullableWidgetMessageDisplay{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetMessageDisplay) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetMessageDisplay) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_monitor_summary_display_format.go b/api/v1/datadog/model_widget_monitor_summary_display_format.go new file mode 100644 index 00000000000..83c8b0df82d --- /dev/null +++ b/api/v1/datadog/model_widget_monitor_summary_display_format.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetMonitorSummaryDisplayFormat What to display on the widget. +type WidgetMonitorSummaryDisplayFormat string + +// List of WidgetMonitorSummaryDisplayFormat. +const ( + WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS WidgetMonitorSummaryDisplayFormat = "counts" + WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS_AND_LIST WidgetMonitorSummaryDisplayFormat = "countsAndList" + WIDGETMONITORSUMMARYDISPLAYFORMAT_LIST WidgetMonitorSummaryDisplayFormat = "list" +) + +var allowedWidgetMonitorSummaryDisplayFormatEnumValues = []WidgetMonitorSummaryDisplayFormat{ + WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS, + WIDGETMONITORSUMMARYDISPLAYFORMAT_COUNTS_AND_LIST, + WIDGETMONITORSUMMARYDISPLAYFORMAT_LIST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetMonitorSummaryDisplayFormat) GetAllowedValues() []WidgetMonitorSummaryDisplayFormat { + return allowedWidgetMonitorSummaryDisplayFormatEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetMonitorSummaryDisplayFormat) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetMonitorSummaryDisplayFormat(value) + return nil +} + +// NewWidgetMonitorSummaryDisplayFormatFromValue returns a pointer to a valid WidgetMonitorSummaryDisplayFormat +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetMonitorSummaryDisplayFormatFromValue(v string) (*WidgetMonitorSummaryDisplayFormat, error) { + ev := WidgetMonitorSummaryDisplayFormat(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetMonitorSummaryDisplayFormat: valid values are %v", v, allowedWidgetMonitorSummaryDisplayFormatEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetMonitorSummaryDisplayFormat) IsValid() bool { + for _, existing := range allowedWidgetMonitorSummaryDisplayFormatEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetMonitorSummaryDisplayFormat value. +func (v WidgetMonitorSummaryDisplayFormat) Ptr() *WidgetMonitorSummaryDisplayFormat { + return &v +} + +// NullableWidgetMonitorSummaryDisplayFormat handles when a null is used for WidgetMonitorSummaryDisplayFormat. +type NullableWidgetMonitorSummaryDisplayFormat struct { + value *WidgetMonitorSummaryDisplayFormat + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetMonitorSummaryDisplayFormat) Get() *WidgetMonitorSummaryDisplayFormat { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetMonitorSummaryDisplayFormat) Set(val *WidgetMonitorSummaryDisplayFormat) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetMonitorSummaryDisplayFormat) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetMonitorSummaryDisplayFormat) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetMonitorSummaryDisplayFormat initializes the struct as if Set has been called. +func NewNullableWidgetMonitorSummaryDisplayFormat(val *WidgetMonitorSummaryDisplayFormat) *NullableWidgetMonitorSummaryDisplayFormat { + return &NullableWidgetMonitorSummaryDisplayFormat{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetMonitorSummaryDisplayFormat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetMonitorSummaryDisplayFormat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_monitor_summary_sort.go b/api/v1/datadog/model_widget_monitor_summary_sort.go new file mode 100644 index 00000000000..391c55983cb --- /dev/null +++ b/api/v1/datadog/model_widget_monitor_summary_sort.go @@ -0,0 +1,135 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetMonitorSummarySort Widget sorting methods. +type WidgetMonitorSummarySort string + +// List of WidgetMonitorSummarySort. +const ( + WIDGETMONITORSUMMARYSORT_NAME WidgetMonitorSummarySort = "name" + WIDGETMONITORSUMMARYSORT_GROUP WidgetMonitorSummarySort = "group" + WIDGETMONITORSUMMARYSORT_STATUS WidgetMonitorSummarySort = "status" + WIDGETMONITORSUMMARYSORT_TAGS WidgetMonitorSummarySort = "tags" + WIDGETMONITORSUMMARYSORT_TRIGGERED WidgetMonitorSummarySort = "triggered" + WIDGETMONITORSUMMARYSORT_GROUP_ASCENDING WidgetMonitorSummarySort = "group,asc" + WIDGETMONITORSUMMARYSORT_GROUP_DESCENDING WidgetMonitorSummarySort = "group,desc" + WIDGETMONITORSUMMARYSORT_NAME_ASCENDING WidgetMonitorSummarySort = "name,asc" + WIDGETMONITORSUMMARYSORT_NAME_DESCENDING WidgetMonitorSummarySort = "name,desc" + WIDGETMONITORSUMMARYSORT_STATUS_ASCENDING WidgetMonitorSummarySort = "status,asc" + WIDGETMONITORSUMMARYSORT_STATUS_DESCENDING WidgetMonitorSummarySort = "status,desc" + WIDGETMONITORSUMMARYSORT_TAGS_ASCENDING WidgetMonitorSummarySort = "tags,asc" + WIDGETMONITORSUMMARYSORT_TAGS_DESCENDING WidgetMonitorSummarySort = "tags,desc" + WIDGETMONITORSUMMARYSORT_TRIGGERED_ASCENDING WidgetMonitorSummarySort = "triggered,asc" + WIDGETMONITORSUMMARYSORT_TRIGGERED_DESCENDING WidgetMonitorSummarySort = "triggered,desc" +) + +var allowedWidgetMonitorSummarySortEnumValues = []WidgetMonitorSummarySort{ + WIDGETMONITORSUMMARYSORT_NAME, + WIDGETMONITORSUMMARYSORT_GROUP, + WIDGETMONITORSUMMARYSORT_STATUS, + WIDGETMONITORSUMMARYSORT_TAGS, + WIDGETMONITORSUMMARYSORT_TRIGGERED, + WIDGETMONITORSUMMARYSORT_GROUP_ASCENDING, + WIDGETMONITORSUMMARYSORT_GROUP_DESCENDING, + WIDGETMONITORSUMMARYSORT_NAME_ASCENDING, + WIDGETMONITORSUMMARYSORT_NAME_DESCENDING, + WIDGETMONITORSUMMARYSORT_STATUS_ASCENDING, + WIDGETMONITORSUMMARYSORT_STATUS_DESCENDING, + WIDGETMONITORSUMMARYSORT_TAGS_ASCENDING, + WIDGETMONITORSUMMARYSORT_TAGS_DESCENDING, + WIDGETMONITORSUMMARYSORT_TRIGGERED_ASCENDING, + WIDGETMONITORSUMMARYSORT_TRIGGERED_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetMonitorSummarySort) GetAllowedValues() []WidgetMonitorSummarySort { + return allowedWidgetMonitorSummarySortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetMonitorSummarySort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetMonitorSummarySort(value) + return nil +} + +// NewWidgetMonitorSummarySortFromValue returns a pointer to a valid WidgetMonitorSummarySort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetMonitorSummarySortFromValue(v string) (*WidgetMonitorSummarySort, error) { + ev := WidgetMonitorSummarySort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetMonitorSummarySort: valid values are %v", v, allowedWidgetMonitorSummarySortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetMonitorSummarySort) IsValid() bool { + for _, existing := range allowedWidgetMonitorSummarySortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetMonitorSummarySort value. +func (v WidgetMonitorSummarySort) Ptr() *WidgetMonitorSummarySort { + return &v +} + +// NullableWidgetMonitorSummarySort handles when a null is used for WidgetMonitorSummarySort. +type NullableWidgetMonitorSummarySort struct { + value *WidgetMonitorSummarySort + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetMonitorSummarySort) Get() *WidgetMonitorSummarySort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetMonitorSummarySort) Set(val *WidgetMonitorSummarySort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetMonitorSummarySort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetMonitorSummarySort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetMonitorSummarySort initializes the struct as if Set has been called. +func NewNullableWidgetMonitorSummarySort(val *WidgetMonitorSummarySort) *NullableWidgetMonitorSummarySort { + return &NullableWidgetMonitorSummarySort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetMonitorSummarySort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetMonitorSummarySort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_node_type.go b/api/v1/datadog/model_widget_node_type.go new file mode 100644 index 00000000000..2612ff674e9 --- /dev/null +++ b/api/v1/datadog/model_widget_node_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetNodeType Which type of node to use in the map. +type WidgetNodeType string + +// List of WidgetNodeType. +const ( + WIDGETNODETYPE_HOST WidgetNodeType = "host" + WIDGETNODETYPE_CONTAINER WidgetNodeType = "container" +) + +var allowedWidgetNodeTypeEnumValues = []WidgetNodeType{ + WIDGETNODETYPE_HOST, + WIDGETNODETYPE_CONTAINER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetNodeType) GetAllowedValues() []WidgetNodeType { + return allowedWidgetNodeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetNodeType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetNodeType(value) + return nil +} + +// NewWidgetNodeTypeFromValue returns a pointer to a valid WidgetNodeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetNodeTypeFromValue(v string) (*WidgetNodeType, error) { + ev := WidgetNodeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetNodeType: valid values are %v", v, allowedWidgetNodeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetNodeType) IsValid() bool { + for _, existing := range allowedWidgetNodeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetNodeType value. +func (v WidgetNodeType) Ptr() *WidgetNodeType { + return &v +} + +// NullableWidgetNodeType handles when a null is used for WidgetNodeType. +type NullableWidgetNodeType struct { + value *WidgetNodeType + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetNodeType) Get() *WidgetNodeType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetNodeType) Set(val *WidgetNodeType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetNodeType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetNodeType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetNodeType initializes the struct as if Set has been called. +func NewNullableWidgetNodeType(val *WidgetNodeType) *NullableWidgetNodeType { + return &NullableWidgetNodeType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetNodeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetNodeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_order_by.go b/api/v1/datadog/model_widget_order_by.go new file mode 100644 index 00000000000..05001c1c5ef --- /dev/null +++ b/api/v1/datadog/model_widget_order_by.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetOrderBy What to order by. +type WidgetOrderBy string + +// List of WidgetOrderBy. +const ( + WIDGETORDERBY_CHANGE WidgetOrderBy = "change" + WIDGETORDERBY_NAME WidgetOrderBy = "name" + WIDGETORDERBY_PRESENT WidgetOrderBy = "present" + WIDGETORDERBY_PAST WidgetOrderBy = "past" +) + +var allowedWidgetOrderByEnumValues = []WidgetOrderBy{ + WIDGETORDERBY_CHANGE, + WIDGETORDERBY_NAME, + WIDGETORDERBY_PRESENT, + WIDGETORDERBY_PAST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetOrderBy) GetAllowedValues() []WidgetOrderBy { + return allowedWidgetOrderByEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetOrderBy) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetOrderBy(value) + return nil +} + +// NewWidgetOrderByFromValue returns a pointer to a valid WidgetOrderBy +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetOrderByFromValue(v string) (*WidgetOrderBy, error) { + ev := WidgetOrderBy(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetOrderBy: valid values are %v", v, allowedWidgetOrderByEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetOrderBy) IsValid() bool { + for _, existing := range allowedWidgetOrderByEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetOrderBy value. +func (v WidgetOrderBy) Ptr() *WidgetOrderBy { + return &v +} + +// NullableWidgetOrderBy handles when a null is used for WidgetOrderBy. +type NullableWidgetOrderBy struct { + value *WidgetOrderBy + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetOrderBy) Get() *WidgetOrderBy { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetOrderBy) Set(val *WidgetOrderBy) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetOrderBy) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetOrderBy) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetOrderBy initializes the struct as if Set has been called. +func NewNullableWidgetOrderBy(val *WidgetOrderBy) *NullableWidgetOrderBy { + return &NullableWidgetOrderBy{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetOrderBy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetOrderBy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_palette.go b/api/v1/datadog/model_widget_palette.go new file mode 100644 index 00000000000..447aa5da0d3 --- /dev/null +++ b/api/v1/datadog/model_widget_palette.go @@ -0,0 +1,143 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetPalette Color palette to apply. +type WidgetPalette string + +// List of WidgetPalette. +const ( + WIDGETPALETTE_BLUE WidgetPalette = "blue" + WIDGETPALETTE_CUSTOM_BACKGROUND WidgetPalette = "custom_bg" + WIDGETPALETTE_CUSTOM_IMAGE WidgetPalette = "custom_image" + WIDGETPALETTE_CUSTOM_TEXT WidgetPalette = "custom_text" + WIDGETPALETTE_GRAY_ON_WHITE WidgetPalette = "gray_on_white" + WIDGETPALETTE_GREY WidgetPalette = "grey" + WIDGETPALETTE_GREEN WidgetPalette = "green" + WIDGETPALETTE_ORANGE WidgetPalette = "orange" + WIDGETPALETTE_RED WidgetPalette = "red" + WIDGETPALETTE_RED_ON_WHITE WidgetPalette = "red_on_white" + WIDGETPALETTE_WHITE_ON_GRAY WidgetPalette = "white_on_gray" + WIDGETPALETTE_WHITE_ON_GREEN WidgetPalette = "white_on_green" + WIDGETPALETTE_GREEN_ON_WHITE WidgetPalette = "green_on_white" + WIDGETPALETTE_WHITE_ON_RED WidgetPalette = "white_on_red" + WIDGETPALETTE_WHITE_ON_YELLOW WidgetPalette = "white_on_yellow" + WIDGETPALETTE_YELLOW_ON_WHITE WidgetPalette = "yellow_on_white" + WIDGETPALETTE_BLACK_ON_LIGHT_YELLOW WidgetPalette = "black_on_light_yellow" + WIDGETPALETTE_BLACK_ON_LIGHT_GREEN WidgetPalette = "black_on_light_green" + WIDGETPALETTE_BLACK_ON_LIGHT_RED WidgetPalette = "black_on_light_red" +) + +var allowedWidgetPaletteEnumValues = []WidgetPalette{ + WIDGETPALETTE_BLUE, + WIDGETPALETTE_CUSTOM_BACKGROUND, + WIDGETPALETTE_CUSTOM_IMAGE, + WIDGETPALETTE_CUSTOM_TEXT, + WIDGETPALETTE_GRAY_ON_WHITE, + WIDGETPALETTE_GREY, + WIDGETPALETTE_GREEN, + WIDGETPALETTE_ORANGE, + WIDGETPALETTE_RED, + WIDGETPALETTE_RED_ON_WHITE, + WIDGETPALETTE_WHITE_ON_GRAY, + WIDGETPALETTE_WHITE_ON_GREEN, + WIDGETPALETTE_GREEN_ON_WHITE, + WIDGETPALETTE_WHITE_ON_RED, + WIDGETPALETTE_WHITE_ON_YELLOW, + WIDGETPALETTE_YELLOW_ON_WHITE, + WIDGETPALETTE_BLACK_ON_LIGHT_YELLOW, + WIDGETPALETTE_BLACK_ON_LIGHT_GREEN, + WIDGETPALETTE_BLACK_ON_LIGHT_RED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetPalette) GetAllowedValues() []WidgetPalette { + return allowedWidgetPaletteEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetPalette) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetPalette(value) + return nil +} + +// NewWidgetPaletteFromValue returns a pointer to a valid WidgetPalette +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetPaletteFromValue(v string) (*WidgetPalette, error) { + ev := WidgetPalette(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetPalette: valid values are %v", v, allowedWidgetPaletteEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetPalette) IsValid() bool { + for _, existing := range allowedWidgetPaletteEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetPalette value. +func (v WidgetPalette) Ptr() *WidgetPalette { + return &v +} + +// NullableWidgetPalette handles when a null is used for WidgetPalette. +type NullableWidgetPalette struct { + value *WidgetPalette + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetPalette) Get() *WidgetPalette { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetPalette) Set(val *WidgetPalette) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetPalette) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetPalette) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetPalette initializes the struct as if Set has been called. +func NewNullableWidgetPalette(val *WidgetPalette) *NullableWidgetPalette { + return &NullableWidgetPalette{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetPalette) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetPalette) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_request_style.go b/api/v1/datadog/model_widget_request_style.go new file mode 100644 index 00000000000..94ff606c14f --- /dev/null +++ b/api/v1/datadog/model_widget_request_style.go @@ -0,0 +1,196 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// WidgetRequestStyle Define request widget style. +type WidgetRequestStyle struct { + // Type of lines displayed. + LineType *WidgetLineType `json:"line_type,omitempty"` + // Width of line displayed. + LineWidth *WidgetLineWidth `json:"line_width,omitempty"` + // Color palette to apply to the widget. + Palette *string `json:"palette,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{} +} + +// NewWidgetRequestStyle instantiates a new WidgetRequestStyle 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 NewWidgetRequestStyle() *WidgetRequestStyle { + this := WidgetRequestStyle{} + return &this +} + +// NewWidgetRequestStyleWithDefaults instantiates a new WidgetRequestStyle 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 NewWidgetRequestStyleWithDefaults() *WidgetRequestStyle { + this := WidgetRequestStyle{} + return &this +} + +// GetLineType returns the LineType field value if set, zero value otherwise. +func (o *WidgetRequestStyle) GetLineType() WidgetLineType { + if o == nil || o.LineType == nil { + var ret WidgetLineType + return ret + } + return *o.LineType +} + +// GetLineTypeOk returns a tuple with the LineType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetRequestStyle) GetLineTypeOk() (*WidgetLineType, bool) { + if o == nil || o.LineType == nil { + return nil, false + } + return o.LineType, true +} + +// HasLineType returns a boolean if a field has been set. +func (o *WidgetRequestStyle) HasLineType() bool { + if o != nil && o.LineType != nil { + return true + } + + return false +} + +// SetLineType gets a reference to the given WidgetLineType and assigns it to the LineType field. +func (o *WidgetRequestStyle) SetLineType(v WidgetLineType) { + o.LineType = &v +} + +// GetLineWidth returns the LineWidth field value if set, zero value otherwise. +func (o *WidgetRequestStyle) GetLineWidth() WidgetLineWidth { + if o == nil || o.LineWidth == nil { + var ret WidgetLineWidth + return ret + } + return *o.LineWidth +} + +// GetLineWidthOk returns a tuple with the LineWidth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetRequestStyle) GetLineWidthOk() (*WidgetLineWidth, bool) { + if o == nil || o.LineWidth == nil { + return nil, false + } + return o.LineWidth, true +} + +// HasLineWidth returns a boolean if a field has been set. +func (o *WidgetRequestStyle) HasLineWidth() bool { + if o != nil && o.LineWidth != nil { + return true + } + + return false +} + +// SetLineWidth gets a reference to the given WidgetLineWidth and assigns it to the LineWidth field. +func (o *WidgetRequestStyle) SetLineWidth(v WidgetLineWidth) { + o.LineWidth = &v +} + +// GetPalette returns the Palette field value if set, zero value otherwise. +func (o *WidgetRequestStyle) GetPalette() string { + if o == nil || o.Palette == nil { + var ret string + return ret + } + return *o.Palette +} + +// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetRequestStyle) GetPaletteOk() (*string, bool) { + if o == nil || o.Palette == nil { + return nil, false + } + return o.Palette, true +} + +// HasPalette returns a boolean if a field has been set. +func (o *WidgetRequestStyle) HasPalette() bool { + if o != nil && o.Palette != nil { + return true + } + + return false +} + +// SetPalette gets a reference to the given string and assigns it to the Palette field. +func (o *WidgetRequestStyle) SetPalette(v string) { + o.Palette = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetRequestStyle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LineType != nil { + toSerialize["line_type"] = o.LineType + } + if o.LineWidth != nil { + toSerialize["line_width"] = o.LineWidth + } + if o.Palette != nil { + toSerialize["palette"] = o.Palette + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetRequestStyle) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + LineType *WidgetLineType `json:"line_type,omitempty"` + LineWidth *WidgetLineWidth `json:"line_width,omitempty"` + Palette *string `json:"palette,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LineType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LineWidth; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LineType = all.LineType + o.LineWidth = all.LineWidth + o.Palette = all.Palette + return nil +} diff --git a/api/v1/datadog/model_widget_service_summary_display_format.go b/api/v1/datadog/model_widget_service_summary_display_format.go new file mode 100644 index 00000000000..8e5bd7c3510 --- /dev/null +++ b/api/v1/datadog/model_widget_service_summary_display_format.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetServiceSummaryDisplayFormat Number of columns to display. +type WidgetServiceSummaryDisplayFormat string + +// List of WidgetServiceSummaryDisplayFormat. +const ( + WIDGETSERVICESUMMARYDISPLAYFORMAT_ONE_COLUMN WidgetServiceSummaryDisplayFormat = "one_column" + WIDGETSERVICESUMMARYDISPLAYFORMAT_TWO_COLUMN WidgetServiceSummaryDisplayFormat = "two_column" + WIDGETSERVICESUMMARYDISPLAYFORMAT_THREE_COLUMN WidgetServiceSummaryDisplayFormat = "three_column" +) + +var allowedWidgetServiceSummaryDisplayFormatEnumValues = []WidgetServiceSummaryDisplayFormat{ + WIDGETSERVICESUMMARYDISPLAYFORMAT_ONE_COLUMN, + WIDGETSERVICESUMMARYDISPLAYFORMAT_TWO_COLUMN, + WIDGETSERVICESUMMARYDISPLAYFORMAT_THREE_COLUMN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetServiceSummaryDisplayFormat) GetAllowedValues() []WidgetServiceSummaryDisplayFormat { + return allowedWidgetServiceSummaryDisplayFormatEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetServiceSummaryDisplayFormat) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetServiceSummaryDisplayFormat(value) + return nil +} + +// NewWidgetServiceSummaryDisplayFormatFromValue returns a pointer to a valid WidgetServiceSummaryDisplayFormat +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetServiceSummaryDisplayFormatFromValue(v string) (*WidgetServiceSummaryDisplayFormat, error) { + ev := WidgetServiceSummaryDisplayFormat(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetServiceSummaryDisplayFormat: valid values are %v", v, allowedWidgetServiceSummaryDisplayFormatEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetServiceSummaryDisplayFormat) IsValid() bool { + for _, existing := range allowedWidgetServiceSummaryDisplayFormatEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetServiceSummaryDisplayFormat value. +func (v WidgetServiceSummaryDisplayFormat) Ptr() *WidgetServiceSummaryDisplayFormat { + return &v +} + +// NullableWidgetServiceSummaryDisplayFormat handles when a null is used for WidgetServiceSummaryDisplayFormat. +type NullableWidgetServiceSummaryDisplayFormat struct { + value *WidgetServiceSummaryDisplayFormat + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetServiceSummaryDisplayFormat) Get() *WidgetServiceSummaryDisplayFormat { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetServiceSummaryDisplayFormat) Set(val *WidgetServiceSummaryDisplayFormat) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetServiceSummaryDisplayFormat) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetServiceSummaryDisplayFormat) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetServiceSummaryDisplayFormat initializes the struct as if Set has been called. +func NewNullableWidgetServiceSummaryDisplayFormat(val *WidgetServiceSummaryDisplayFormat) *NullableWidgetServiceSummaryDisplayFormat { + return &NullableWidgetServiceSummaryDisplayFormat{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetServiceSummaryDisplayFormat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetServiceSummaryDisplayFormat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_size_format.go b/api/v1/datadog/model_widget_size_format.go new file mode 100644 index 00000000000..3dd50566745 --- /dev/null +++ b/api/v1/datadog/model_widget_size_format.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetSizeFormat Size of the widget. +type WidgetSizeFormat string + +// List of WidgetSizeFormat. +const ( + WIDGETSIZEFORMAT_SMALL WidgetSizeFormat = "small" + WIDGETSIZEFORMAT_MEDIUM WidgetSizeFormat = "medium" + WIDGETSIZEFORMAT_LARGE WidgetSizeFormat = "large" +) + +var allowedWidgetSizeFormatEnumValues = []WidgetSizeFormat{ + WIDGETSIZEFORMAT_SMALL, + WIDGETSIZEFORMAT_MEDIUM, + WIDGETSIZEFORMAT_LARGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetSizeFormat) GetAllowedValues() []WidgetSizeFormat { + return allowedWidgetSizeFormatEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetSizeFormat) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetSizeFormat(value) + return nil +} + +// NewWidgetSizeFormatFromValue returns a pointer to a valid WidgetSizeFormat +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetSizeFormatFromValue(v string) (*WidgetSizeFormat, error) { + ev := WidgetSizeFormat(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetSizeFormat: valid values are %v", v, allowedWidgetSizeFormatEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetSizeFormat) IsValid() bool { + for _, existing := range allowedWidgetSizeFormatEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetSizeFormat value. +func (v WidgetSizeFormat) Ptr() *WidgetSizeFormat { + return &v +} + +// NullableWidgetSizeFormat handles when a null is used for WidgetSizeFormat. +type NullableWidgetSizeFormat struct { + value *WidgetSizeFormat + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetSizeFormat) Get() *WidgetSizeFormat { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetSizeFormat) Set(val *WidgetSizeFormat) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetSizeFormat) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetSizeFormat) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetSizeFormat initializes the struct as if Set has been called. +func NewNullableWidgetSizeFormat(val *WidgetSizeFormat) *NullableWidgetSizeFormat { + return &NullableWidgetSizeFormat{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetSizeFormat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetSizeFormat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_sort.go b/api/v1/datadog/model_widget_sort.go new file mode 100644 index 00000000000..90f941b2960 --- /dev/null +++ b/api/v1/datadog/model_widget_sort.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetSort Widget sorting methods. +type WidgetSort string + +// List of WidgetSort. +const ( + WIDGETSORT_ASCENDING WidgetSort = "asc" + WIDGETSORT_DESCENDING WidgetSort = "desc" +) + +var allowedWidgetSortEnumValues = []WidgetSort{ + WIDGETSORT_ASCENDING, + WIDGETSORT_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetSort) GetAllowedValues() []WidgetSort { + return allowedWidgetSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetSort(value) + return nil +} + +// NewWidgetSortFromValue returns a pointer to a valid WidgetSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetSortFromValue(v string) (*WidgetSort, error) { + ev := WidgetSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetSort: valid values are %v", v, allowedWidgetSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetSort) IsValid() bool { + for _, existing := range allowedWidgetSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetSort value. +func (v WidgetSort) Ptr() *WidgetSort { + return &v +} + +// NullableWidgetSort handles when a null is used for WidgetSort. +type NullableWidgetSort struct { + value *WidgetSort + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetSort) Get() *WidgetSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetSort) Set(val *WidgetSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetSort initializes the struct as if Set has been called. +func NewNullableWidgetSort(val *WidgetSort) *NullableWidgetSort { + return &NullableWidgetSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_style.go b/api/v1/datadog/model_widget_style.go new file mode 100644 index 00000000000..bd21312eda4 --- /dev/null +++ b/api/v1/datadog/model_widget_style.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 datadog + +import ( + "encoding/json" +) + +// WidgetStyle Widget style definition. +type WidgetStyle struct { + // Color palette to apply to the widget. + Palette *string `json:"palette,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{} +} + +// NewWidgetStyle instantiates a new WidgetStyle 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 NewWidgetStyle() *WidgetStyle { + this := WidgetStyle{} + return &this +} + +// NewWidgetStyleWithDefaults instantiates a new WidgetStyle 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 NewWidgetStyleWithDefaults() *WidgetStyle { + this := WidgetStyle{} + return &this +} + +// GetPalette returns the Palette field value if set, zero value otherwise. +func (o *WidgetStyle) GetPalette() string { + if o == nil || o.Palette == nil { + var ret string + return ret + } + return *o.Palette +} + +// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetStyle) GetPaletteOk() (*string, bool) { + if o == nil || o.Palette == nil { + return nil, false + } + return o.Palette, true +} + +// HasPalette returns a boolean if a field has been set. +func (o *WidgetStyle) HasPalette() bool { + if o != nil && o.Palette != nil { + return true + } + + return false +} + +// SetPalette gets a reference to the given string and assigns it to the Palette field. +func (o *WidgetStyle) SetPalette(v string) { + o.Palette = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetStyle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Palette != nil { + toSerialize["palette"] = o.Palette + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetStyle) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Palette *string `json:"palette,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Palette = all.Palette + return nil +} diff --git a/api/v1/datadog/model_widget_summary_type.go b/api/v1/datadog/model_widget_summary_type.go new file mode 100644 index 00000000000..7c98eec88ae --- /dev/null +++ b/api/v1/datadog/model_widget_summary_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetSummaryType Which summary type should be used. +type WidgetSummaryType string + +// List of WidgetSummaryType. +const ( + WIDGETSUMMARYTYPE_MONITORS WidgetSummaryType = "monitors" + WIDGETSUMMARYTYPE_GROUPS WidgetSummaryType = "groups" + WIDGETSUMMARYTYPE_COMBINED WidgetSummaryType = "combined" +) + +var allowedWidgetSummaryTypeEnumValues = []WidgetSummaryType{ + WIDGETSUMMARYTYPE_MONITORS, + WIDGETSUMMARYTYPE_GROUPS, + WIDGETSUMMARYTYPE_COMBINED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetSummaryType) GetAllowedValues() []WidgetSummaryType { + return allowedWidgetSummaryTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetSummaryType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetSummaryType(value) + return nil +} + +// NewWidgetSummaryTypeFromValue returns a pointer to a valid WidgetSummaryType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetSummaryTypeFromValue(v string) (*WidgetSummaryType, error) { + ev := WidgetSummaryType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetSummaryType: valid values are %v", v, allowedWidgetSummaryTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetSummaryType) IsValid() bool { + for _, existing := range allowedWidgetSummaryTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetSummaryType value. +func (v WidgetSummaryType) Ptr() *WidgetSummaryType { + return &v +} + +// NullableWidgetSummaryType handles when a null is used for WidgetSummaryType. +type NullableWidgetSummaryType struct { + value *WidgetSummaryType + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetSummaryType) Get() *WidgetSummaryType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetSummaryType) Set(val *WidgetSummaryType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetSummaryType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetSummaryType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetSummaryType initializes the struct as if Set has been called. +func NewNullableWidgetSummaryType(val *WidgetSummaryType) *NullableWidgetSummaryType { + return &NullableWidgetSummaryType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetSummaryType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetSummaryType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_text_align.go b/api/v1/datadog/model_widget_text_align.go new file mode 100644 index 00000000000..69ea8a68b7e --- /dev/null +++ b/api/v1/datadog/model_widget_text_align.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetTextAlign How to align the text on the widget. +type WidgetTextAlign string + +// List of WidgetTextAlign. +const ( + WIDGETTEXTALIGN_CENTER WidgetTextAlign = "center" + WIDGETTEXTALIGN_LEFT WidgetTextAlign = "left" + WIDGETTEXTALIGN_RIGHT WidgetTextAlign = "right" +) + +var allowedWidgetTextAlignEnumValues = []WidgetTextAlign{ + WIDGETTEXTALIGN_CENTER, + WIDGETTEXTALIGN_LEFT, + WIDGETTEXTALIGN_RIGHT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetTextAlign) GetAllowedValues() []WidgetTextAlign { + return allowedWidgetTextAlignEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetTextAlign) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetTextAlign(value) + return nil +} + +// NewWidgetTextAlignFromValue returns a pointer to a valid WidgetTextAlign +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetTextAlignFromValue(v string) (*WidgetTextAlign, error) { + ev := WidgetTextAlign(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetTextAlign: valid values are %v", v, allowedWidgetTextAlignEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetTextAlign) IsValid() bool { + for _, existing := range allowedWidgetTextAlignEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetTextAlign value. +func (v WidgetTextAlign) Ptr() *WidgetTextAlign { + return &v +} + +// NullableWidgetTextAlign handles when a null is used for WidgetTextAlign. +type NullableWidgetTextAlign struct { + value *WidgetTextAlign + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetTextAlign) Get() *WidgetTextAlign { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetTextAlign) Set(val *WidgetTextAlign) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetTextAlign) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetTextAlign) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetTextAlign initializes the struct as if Set has been called. +func NewNullableWidgetTextAlign(val *WidgetTextAlign) *NullableWidgetTextAlign { + return &NullableWidgetTextAlign{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetTextAlign) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetTextAlign) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_tick_edge.go b/api/v1/datadog/model_widget_tick_edge.go new file mode 100644 index 00000000000..ce513f41353 --- /dev/null +++ b/api/v1/datadog/model_widget_tick_edge.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetTickEdge Define how you want to align the text on the widget. +type WidgetTickEdge string + +// List of WidgetTickEdge. +const ( + WIDGETTICKEDGE_BOTTOM WidgetTickEdge = "bottom" + WIDGETTICKEDGE_LEFT WidgetTickEdge = "left" + WIDGETTICKEDGE_RIGHT WidgetTickEdge = "right" + WIDGETTICKEDGE_TOP WidgetTickEdge = "top" +) + +var allowedWidgetTickEdgeEnumValues = []WidgetTickEdge{ + WIDGETTICKEDGE_BOTTOM, + WIDGETTICKEDGE_LEFT, + WIDGETTICKEDGE_RIGHT, + WIDGETTICKEDGE_TOP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetTickEdge) GetAllowedValues() []WidgetTickEdge { + return allowedWidgetTickEdgeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetTickEdge) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetTickEdge(value) + return nil +} + +// NewWidgetTickEdgeFromValue returns a pointer to a valid WidgetTickEdge +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetTickEdgeFromValue(v string) (*WidgetTickEdge, error) { + ev := WidgetTickEdge(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetTickEdge: valid values are %v", v, allowedWidgetTickEdgeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetTickEdge) IsValid() bool { + for _, existing := range allowedWidgetTickEdgeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetTickEdge value. +func (v WidgetTickEdge) Ptr() *WidgetTickEdge { + return &v +} + +// NullableWidgetTickEdge handles when a null is used for WidgetTickEdge. +type NullableWidgetTickEdge struct { + value *WidgetTickEdge + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetTickEdge) Get() *WidgetTickEdge { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetTickEdge) Set(val *WidgetTickEdge) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetTickEdge) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetTickEdge) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetTickEdge initializes the struct as if Set has been called. +func NewNullableWidgetTickEdge(val *WidgetTickEdge) *NullableWidgetTickEdge { + return &NullableWidgetTickEdge{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetTickEdge) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetTickEdge) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_time.go b/api/v1/datadog/model_widget_time.go new file mode 100644 index 00000000000..f06443f0bd4 --- /dev/null +++ b/api/v1/datadog/model_widget_time.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 datadog + +import ( + "encoding/json" +) + +// WidgetTime Time setting for the widget. +type WidgetTime struct { + // The available timeframes depend on the widget you are using. + LiveSpan *WidgetLiveSpan `json:"live_span,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{} +} + +// NewWidgetTime instantiates a new WidgetTime 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 NewWidgetTime() *WidgetTime { + this := WidgetTime{} + return &this +} + +// NewWidgetTimeWithDefaults instantiates a new WidgetTime 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 NewWidgetTimeWithDefaults() *WidgetTime { + this := WidgetTime{} + return &this +} + +// GetLiveSpan returns the LiveSpan field value if set, zero value otherwise. +func (o *WidgetTime) GetLiveSpan() WidgetLiveSpan { + if o == nil || o.LiveSpan == nil { + var ret WidgetLiveSpan + return ret + } + return *o.LiveSpan +} + +// GetLiveSpanOk returns a tuple with the LiveSpan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetTime) GetLiveSpanOk() (*WidgetLiveSpan, bool) { + if o == nil || o.LiveSpan == nil { + return nil, false + } + return o.LiveSpan, true +} + +// HasLiveSpan returns a boolean if a field has been set. +func (o *WidgetTime) HasLiveSpan() bool { + if o != nil && o.LiveSpan != nil { + return true + } + + return false +} + +// SetLiveSpan gets a reference to the given WidgetLiveSpan and assigns it to the LiveSpan field. +func (o *WidgetTime) SetLiveSpan(v WidgetLiveSpan) { + o.LiveSpan = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WidgetTime) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.LiveSpan != nil { + toSerialize["live_span"] = o.LiveSpan + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WidgetTime) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + LiveSpan *WidgetLiveSpan `json:"live_span,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LiveSpan; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.LiveSpan = all.LiveSpan + return nil +} diff --git a/api/v1/datadog/model_widget_time_windows_.go b/api/v1/datadog/model_widget_time_windows_.go new file mode 100644 index 00000000000..296b5f41853 --- /dev/null +++ b/api/v1/datadog/model_widget_time_windows_.go @@ -0,0 +1,121 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetTimeWindows Define a time window. +type WidgetTimeWindows string + +// List of WidgetTimeWindows. +const ( + WIDGETTIMEWINDOWS_SEVEN_DAYS WidgetTimeWindows = "7d" + WIDGETTIMEWINDOWS_THIRTY_DAYS WidgetTimeWindows = "30d" + WIDGETTIMEWINDOWS_NINETY_DAYS WidgetTimeWindows = "90d" + WIDGETTIMEWINDOWS_WEEK_TO_DATE WidgetTimeWindows = "week_to_date" + WIDGETTIMEWINDOWS_PREVIOUS_WEEK WidgetTimeWindows = "previous_week" + WIDGETTIMEWINDOWS_MONTH_TO_DATE WidgetTimeWindows = "month_to_date" + WIDGETTIMEWINDOWS_PREVIOUS_MONTH WidgetTimeWindows = "previous_month" + WIDGETTIMEWINDOWS_GLOBAL_TIME WidgetTimeWindows = "global_time" +) + +var allowedWidgetTimeWindowsEnumValues = []WidgetTimeWindows{ + WIDGETTIMEWINDOWS_SEVEN_DAYS, + WIDGETTIMEWINDOWS_THIRTY_DAYS, + WIDGETTIMEWINDOWS_NINETY_DAYS, + WIDGETTIMEWINDOWS_WEEK_TO_DATE, + WIDGETTIMEWINDOWS_PREVIOUS_WEEK, + WIDGETTIMEWINDOWS_MONTH_TO_DATE, + WIDGETTIMEWINDOWS_PREVIOUS_MONTH, + WIDGETTIMEWINDOWS_GLOBAL_TIME, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetTimeWindows) GetAllowedValues() []WidgetTimeWindows { + return allowedWidgetTimeWindowsEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetTimeWindows) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetTimeWindows(value) + return nil +} + +// NewWidgetTimeWindowsFromValue returns a pointer to a valid WidgetTimeWindows +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetTimeWindowsFromValue(v string) (*WidgetTimeWindows, error) { + ev := WidgetTimeWindows(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetTimeWindows: valid values are %v", v, allowedWidgetTimeWindowsEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetTimeWindows) IsValid() bool { + for _, existing := range allowedWidgetTimeWindowsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetTimeWindows value. +func (v WidgetTimeWindows) Ptr() *WidgetTimeWindows { + return &v +} + +// NullableWidgetTimeWindows handles when a null is used for WidgetTimeWindows. +type NullableWidgetTimeWindows struct { + value *WidgetTimeWindows + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetTimeWindows) Get() *WidgetTimeWindows { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetTimeWindows) Set(val *WidgetTimeWindows) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetTimeWindows) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetTimeWindows) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetTimeWindows initializes the struct as if Set has been called. +func NewNullableWidgetTimeWindows(val *WidgetTimeWindows) *NullableWidgetTimeWindows { + return &NullableWidgetTimeWindows{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetTimeWindows) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetTimeWindows) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_vertical_align.go b/api/v1/datadog/model_widget_vertical_align.go new file mode 100644 index 00000000000..98b2cd1366e --- /dev/null +++ b/api/v1/datadog/model_widget_vertical_align.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetVerticalAlign Vertical alignment. +type WidgetVerticalAlign string + +// List of WidgetVerticalAlign. +const ( + WIDGETVERTICALALIGN_CENTER WidgetVerticalAlign = "center" + WIDGETVERTICALALIGN_TOP WidgetVerticalAlign = "top" + WIDGETVERTICALALIGN_BOTTOM WidgetVerticalAlign = "bottom" +) + +var allowedWidgetVerticalAlignEnumValues = []WidgetVerticalAlign{ + WIDGETVERTICALALIGN_CENTER, + WIDGETVERTICALALIGN_TOP, + WIDGETVERTICALALIGN_BOTTOM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetVerticalAlign) GetAllowedValues() []WidgetVerticalAlign { + return allowedWidgetVerticalAlignEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetVerticalAlign) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetVerticalAlign(value) + return nil +} + +// NewWidgetVerticalAlignFromValue returns a pointer to a valid WidgetVerticalAlign +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetVerticalAlignFromValue(v string) (*WidgetVerticalAlign, error) { + ev := WidgetVerticalAlign(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetVerticalAlign: valid values are %v", v, allowedWidgetVerticalAlignEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetVerticalAlign) IsValid() bool { + for _, existing := range allowedWidgetVerticalAlignEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetVerticalAlign value. +func (v WidgetVerticalAlign) Ptr() *WidgetVerticalAlign { + return &v +} + +// NullableWidgetVerticalAlign handles when a null is used for WidgetVerticalAlign. +type NullableWidgetVerticalAlign struct { + value *WidgetVerticalAlign + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetVerticalAlign) Get() *WidgetVerticalAlign { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetVerticalAlign) Set(val *WidgetVerticalAlign) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetVerticalAlign) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetVerticalAlign) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetVerticalAlign initializes the struct as if Set has been called. +func NewNullableWidgetVerticalAlign(val *WidgetVerticalAlign) *NullableWidgetVerticalAlign { + return &NullableWidgetVerticalAlign{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetVerticalAlign) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetVerticalAlign) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_view_mode.go b/api/v1/datadog/model_widget_view_mode.go new file mode 100644 index 00000000000..ed2ea7d55f0 --- /dev/null +++ b/api/v1/datadog/model_widget_view_mode.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetViewMode Define how you want the SLO to be displayed. +type WidgetViewMode string + +// List of WidgetViewMode. +const ( + WIDGETVIEWMODE_OVERALL WidgetViewMode = "overall" + WIDGETVIEWMODE_COMPONENT WidgetViewMode = "component" + WIDGETVIEWMODE_BOTH WidgetViewMode = "both" +) + +var allowedWidgetViewModeEnumValues = []WidgetViewMode{ + WIDGETVIEWMODE_OVERALL, + WIDGETVIEWMODE_COMPONENT, + WIDGETVIEWMODE_BOTH, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetViewMode) GetAllowedValues() []WidgetViewMode { + return allowedWidgetViewModeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetViewMode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetViewMode(value) + return nil +} + +// NewWidgetViewModeFromValue returns a pointer to a valid WidgetViewMode +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetViewModeFromValue(v string) (*WidgetViewMode, error) { + ev := WidgetViewMode(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetViewMode: valid values are %v", v, allowedWidgetViewModeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetViewMode) IsValid() bool { + for _, existing := range allowedWidgetViewModeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetViewMode value. +func (v WidgetViewMode) Ptr() *WidgetViewMode { + return &v +} + +// NullableWidgetViewMode handles when a null is used for WidgetViewMode. +type NullableWidgetViewMode struct { + value *WidgetViewMode + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetViewMode) Get() *WidgetViewMode { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetViewMode) Set(val *WidgetViewMode) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetViewMode) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetViewMode) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetViewMode initializes the struct as if Set has been called. +func NewNullableWidgetViewMode(val *WidgetViewMode) *NullableWidgetViewMode { + return &NullableWidgetViewMode{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetViewMode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetViewMode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_widget_viz_type.go b/api/v1/datadog/model_widget_viz_type.go new file mode 100644 index 00000000000..59790dbb107 --- /dev/null +++ b/api/v1/datadog/model_widget_viz_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// WidgetVizType Whether to display the Alert Graph as a timeseries or a top list. +type WidgetVizType string + +// List of WidgetVizType. +const ( + WIDGETVIZTYPE_TIMESERIES WidgetVizType = "timeseries" + WIDGETVIZTYPE_TOPLIST WidgetVizType = "toplist" +) + +var allowedWidgetVizTypeEnumValues = []WidgetVizType{ + WIDGETVIZTYPE_TIMESERIES, + WIDGETVIZTYPE_TOPLIST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *WidgetVizType) GetAllowedValues() []WidgetVizType { + return allowedWidgetVizTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *WidgetVizType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = WidgetVizType(value) + return nil +} + +// NewWidgetVizTypeFromValue returns a pointer to a valid WidgetVizType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewWidgetVizTypeFromValue(v string) (*WidgetVizType, error) { + ev := WidgetVizType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for WidgetVizType: valid values are %v", v, allowedWidgetVizTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v WidgetVizType) IsValid() bool { + for _, existing := range allowedWidgetVizTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WidgetVizType value. +func (v WidgetVizType) Ptr() *WidgetVizType { + return &v +} + +// NullableWidgetVizType handles when a null is used for WidgetVizType. +type NullableWidgetVizType struct { + value *WidgetVizType + isSet bool +} + +// Get returns the associated value. +func (v NullableWidgetVizType) Get() *WidgetVizType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableWidgetVizType) Set(val *WidgetVizType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableWidgetVizType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableWidgetVizType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableWidgetVizType initializes the struct as if Set has been called. +func NewNullableWidgetVizType(val *WidgetVizType) *NullableWidgetVizType { + return &NullableWidgetVizType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableWidgetVizType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableWidgetVizType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/api_audit.go b/api/v2/datadog/api_audit.go new file mode 100644 index 00000000000..a230a370515 --- /dev/null +++ b/api/v2/datadog/api_audit.go @@ -0,0 +1,550 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// AuditApi service type +type AuditApi common.Service + +type apiListAuditLogsRequest struct { + ctx _context.Context + filterQuery *string + filterFrom *time.Time + filterTo *time.Time + sort *AuditLogsSort + pageCursor *string + pageLimit *int32 +} + +// ListAuditLogsOptionalParameters holds optional parameters for ListAuditLogs. +type ListAuditLogsOptionalParameters struct { + FilterQuery *string + FilterFrom *time.Time + FilterTo *time.Time + Sort *AuditLogsSort + PageCursor *string + PageLimit *int32 +} + +// NewListAuditLogsOptionalParameters creates an empty struct for parameters. +func NewListAuditLogsOptionalParameters() *ListAuditLogsOptionalParameters { + this := ListAuditLogsOptionalParameters{} + return &this +} + +// WithFilterQuery sets the corresponding parameter name and returns the struct. +func (r *ListAuditLogsOptionalParameters) WithFilterQuery(filterQuery string) *ListAuditLogsOptionalParameters { + r.FilterQuery = &filterQuery + return r +} + +// WithFilterFrom sets the corresponding parameter name and returns the struct. +func (r *ListAuditLogsOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListAuditLogsOptionalParameters { + r.FilterFrom = &filterFrom + return r +} + +// WithFilterTo sets the corresponding parameter name and returns the struct. +func (r *ListAuditLogsOptionalParameters) WithFilterTo(filterTo time.Time) *ListAuditLogsOptionalParameters { + r.FilterTo = &filterTo + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListAuditLogsOptionalParameters) WithSort(sort AuditLogsSort) *ListAuditLogsOptionalParameters { + r.Sort = &sort + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListAuditLogsOptionalParameters) WithPageCursor(pageCursor string) *ListAuditLogsOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListAuditLogsOptionalParameters) WithPageLimit(pageLimit int32) *ListAuditLogsOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +func (a *AuditApi) buildListAuditLogsRequest(ctx _context.Context, o ...ListAuditLogsOptionalParameters) (apiListAuditLogsRequest, error) { + req := apiListAuditLogsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListAuditLogsOptionalParameters is allowed") + } + + if o != nil { + req.filterQuery = o[0].FilterQuery + req.filterFrom = o[0].FilterFrom + req.filterTo = o[0].FilterTo + req.sort = o[0].Sort + req.pageCursor = o[0].PageCursor + req.pageLimit = o[0].PageLimit + } + return req, nil +} + +// ListAuditLogs Get a list of Audit Logs events. +// List endpoint returns events that match a Audit Logs search query. +// [Results are paginated][1]. +// +// Use this endpoint to see your latest Audit Logs events. +// +// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination +func (a *AuditApi) ListAuditLogs(ctx _context.Context, o ...ListAuditLogsOptionalParameters) (AuditLogsEventsResponse, *_nethttp.Response, error) { + req, err := a.buildListAuditLogsRequest(ctx, o...) + if err != nil { + var localVarReturnValue AuditLogsEventsResponse + return localVarReturnValue, nil, err + } + + return a.listAuditLogsExecute(req) +} + +// ListAuditLogsWithPagination provides a paginated version of ListAuditLogs returning a channel with all items. +func (a *AuditApi) ListAuditLogsWithPagination(ctx _context.Context, o ...ListAuditLogsOptionalParameters) (<-chan AuditLogsEvent, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, ListAuditLogsOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan AuditLogsEvent, pageSize_) + go func() { + for { + req, err := a.buildListAuditLogsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listAuditLogsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// listAuditLogsExecute executes the request. +func (a *AuditApi) listAuditLogsExecute(r apiListAuditLogsRequest) (AuditLogsEventsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AuditLogsEventsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuditApi.ListAuditLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/audit/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterQuery != nil { + localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) + } + if r.filterFrom != nil { + localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) + } + if r.filterTo != nil { + localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.pageCursor != nil { + localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) + } + if r.pageLimit != nil { + localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSearchAuditLogsRequest struct { + ctx _context.Context + body *AuditLogsSearchEventsRequest +} + +// SearchAuditLogsOptionalParameters holds optional parameters for SearchAuditLogs. +type SearchAuditLogsOptionalParameters struct { + Body *AuditLogsSearchEventsRequest +} + +// NewSearchAuditLogsOptionalParameters creates an empty struct for parameters. +func NewSearchAuditLogsOptionalParameters() *SearchAuditLogsOptionalParameters { + this := SearchAuditLogsOptionalParameters{} + return &this +} + +// WithBody sets the corresponding parameter name and returns the struct. +func (r *SearchAuditLogsOptionalParameters) WithBody(body AuditLogsSearchEventsRequest) *SearchAuditLogsOptionalParameters { + r.Body = &body + return r +} + +func (a *AuditApi) buildSearchAuditLogsRequest(ctx _context.Context, o ...SearchAuditLogsOptionalParameters) (apiSearchAuditLogsRequest, error) { + req := apiSearchAuditLogsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SearchAuditLogsOptionalParameters is allowed") + } + + if o != nil { + req.body = o[0].Body + } + return req, nil +} + +// SearchAuditLogs Search Audit Logs events. +// List endpoint returns Audit Logs events that match an Audit search query. +// [Results are paginated][1]. +// +// Use this endpoint to build complex Audit Logs events filtering and search. +// +// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination +func (a *AuditApi) SearchAuditLogs(ctx _context.Context, o ...SearchAuditLogsOptionalParameters) (AuditLogsEventsResponse, *_nethttp.Response, error) { + req, err := a.buildSearchAuditLogsRequest(ctx, o...) + if err != nil { + var localVarReturnValue AuditLogsEventsResponse + return localVarReturnValue, nil, err + } + + return a.searchAuditLogsExecute(req) +} + +// SearchAuditLogsWithPagination provides a paginated version of SearchAuditLogs returning a channel with all items. +func (a *AuditApi) SearchAuditLogsWithPagination(ctx _context.Context, o ...SearchAuditLogsOptionalParameters) (<-chan AuditLogsEvent, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, SearchAuditLogsOptionalParameters{}) + } + if o[0].Body == nil { + o[0].Body = NewAuditLogsSearchEventsRequest() + } + if o[0].Body.Page == nil { + o[0].Body.Page = NewAuditLogsQueryPageOptions() + } + if o[0].Body.Page.Limit != nil { + pageSize_ = *o[0].Body.Page.Limit + } + o[0].Body.Page.Limit = &pageSize_ + + items := make(chan AuditLogsEvent, pageSize_) + go func() { + for { + req, err := a.buildSearchAuditLogsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.searchAuditLogsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].Body.Page.Cursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// searchAuditLogsExecute executes the request. +func (a *AuditApi) searchAuditLogsExecute(r apiSearchAuditLogsRequest) (AuditLogsEventsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AuditLogsEventsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuditApi.SearchAuditLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/audit/events/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAuditApi Returns NewAuditApi. +func NewAuditApi(client *common.APIClient) *AuditApi { + return &AuditApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_auth_n_mappings.go b/api/v2/datadog/api_auth_n_mappings.go new file mode 100644 index 00000000000..6b804dd4967 --- /dev/null +++ b/api/v2/datadog/api_auth_n_mappings.go @@ -0,0 +1,802 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// AuthNMappingsApi service type +type AuthNMappingsApi common.Service + +type apiCreateAuthNMappingRequest struct { + ctx _context.Context + body *AuthNMappingCreateRequest +} + +func (a *AuthNMappingsApi) buildCreateAuthNMappingRequest(ctx _context.Context, body AuthNMappingCreateRequest) (apiCreateAuthNMappingRequest, error) { + req := apiCreateAuthNMappingRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateAuthNMapping Create an AuthN Mapping. +// Create an AuthN Mapping. +func (a *AuthNMappingsApi) CreateAuthNMapping(ctx _context.Context, body AuthNMappingCreateRequest) (AuthNMappingResponse, *_nethttp.Response, error) { + req, err := a.buildCreateAuthNMappingRequest(ctx, body) + if err != nil { + var localVarReturnValue AuthNMappingResponse + return localVarReturnValue, nil, err + } + + return a.createAuthNMappingExecute(req) +} + +// createAuthNMappingExecute executes the request. +func (a *AuthNMappingsApi) createAuthNMappingExecute(r apiCreateAuthNMappingRequest) (AuthNMappingResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AuthNMappingResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.CreateAuthNMapping") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/authn_mappings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteAuthNMappingRequest struct { + ctx _context.Context + authnMappingId string +} + +func (a *AuthNMappingsApi) buildDeleteAuthNMappingRequest(ctx _context.Context, authnMappingId string) (apiDeleteAuthNMappingRequest, error) { + req := apiDeleteAuthNMappingRequest{ + ctx: ctx, + authnMappingId: authnMappingId, + } + return req, nil +} + +// DeleteAuthNMapping Delete an AuthN Mapping. +// Delete an AuthN Mapping specified by AuthN Mapping UUID. +func (a *AuthNMappingsApi) DeleteAuthNMapping(ctx _context.Context, authnMappingId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteAuthNMappingRequest(ctx, authnMappingId) + if err != nil { + return nil, err + } + + return a.deleteAuthNMappingExecute(req) +} + +// deleteAuthNMappingExecute executes the request. +func (a *AuthNMappingsApi) deleteAuthNMappingExecute(r apiDeleteAuthNMappingRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.DeleteAuthNMapping") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/authn_mappings/{authn_mapping_id}" + localVarPath = strings.Replace(localVarPath, "{"+"authn_mapping_id"+"}", _neturl.PathEscape(common.ParameterToString(r.authnMappingId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetAuthNMappingRequest struct { + ctx _context.Context + authnMappingId string +} + +func (a *AuthNMappingsApi) buildGetAuthNMappingRequest(ctx _context.Context, authnMappingId string) (apiGetAuthNMappingRequest, error) { + req := apiGetAuthNMappingRequest{ + ctx: ctx, + authnMappingId: authnMappingId, + } + return req, nil +} + +// GetAuthNMapping Get an AuthN Mapping by UUID. +// Get an AuthN Mapping specified by the AuthN Mapping UUID. +func (a *AuthNMappingsApi) GetAuthNMapping(ctx _context.Context, authnMappingId string) (AuthNMappingResponse, *_nethttp.Response, error) { + req, err := a.buildGetAuthNMappingRequest(ctx, authnMappingId) + if err != nil { + var localVarReturnValue AuthNMappingResponse + return localVarReturnValue, nil, err + } + + return a.getAuthNMappingExecute(req) +} + +// getAuthNMappingExecute executes the request. +func (a *AuthNMappingsApi) getAuthNMappingExecute(r apiGetAuthNMappingRequest) (AuthNMappingResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AuthNMappingResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.GetAuthNMapping") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/authn_mappings/{authn_mapping_id}" + localVarPath = strings.Replace(localVarPath, "{"+"authn_mapping_id"+"}", _neturl.PathEscape(common.ParameterToString(r.authnMappingId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAuthNMappingsRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sort *AuthNMappingsSort + filter *string +} + +// ListAuthNMappingsOptionalParameters holds optional parameters for ListAuthNMappings. +type ListAuthNMappingsOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *AuthNMappingsSort + Filter *string +} + +// NewListAuthNMappingsOptionalParameters creates an empty struct for parameters. +func NewListAuthNMappingsOptionalParameters() *ListAuthNMappingsOptionalParameters { + this := ListAuthNMappingsOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListAuthNMappingsOptionalParameters) WithPageSize(pageSize int64) *ListAuthNMappingsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListAuthNMappingsOptionalParameters) WithPageNumber(pageNumber int64) *ListAuthNMappingsOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListAuthNMappingsOptionalParameters) WithSort(sort AuthNMappingsSort) *ListAuthNMappingsOptionalParameters { + r.Sort = &sort + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListAuthNMappingsOptionalParameters) WithFilter(filter string) *ListAuthNMappingsOptionalParameters { + r.Filter = &filter + return r +} + +func (a *AuthNMappingsApi) buildListAuthNMappingsRequest(ctx _context.Context, o ...ListAuthNMappingsOptionalParameters) (apiListAuthNMappingsRequest, error) { + req := apiListAuthNMappingsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListAuthNMappingsOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.filter = o[0].Filter + } + return req, nil +} + +// ListAuthNMappings List all AuthN Mappings. +// List all AuthN Mappings in the org. +func (a *AuthNMappingsApi) ListAuthNMappings(ctx _context.Context, o ...ListAuthNMappingsOptionalParameters) (AuthNMappingsResponse, *_nethttp.Response, error) { + req, err := a.buildListAuthNMappingsRequest(ctx, o...) + if err != nil { + var localVarReturnValue AuthNMappingsResponse + return localVarReturnValue, nil, err + } + + return a.listAuthNMappingsExecute(req) +} + +// listAuthNMappingsExecute executes the request. +func (a *AuthNMappingsApi) listAuthNMappingsExecute(r apiListAuthNMappingsRequest) (AuthNMappingsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AuthNMappingsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.ListAuthNMappings") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/authn_mappings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateAuthNMappingRequest struct { + ctx _context.Context + authnMappingId string + body *AuthNMappingUpdateRequest +} + +func (a *AuthNMappingsApi) buildUpdateAuthNMappingRequest(ctx _context.Context, authnMappingId string, body AuthNMappingUpdateRequest) (apiUpdateAuthNMappingRequest, error) { + req := apiUpdateAuthNMappingRequest{ + ctx: ctx, + authnMappingId: authnMappingId, + body: &body, + } + return req, nil +} + +// UpdateAuthNMapping Edit an AuthN Mapping. +// Edit an AuthN Mapping. +func (a *AuthNMappingsApi) UpdateAuthNMapping(ctx _context.Context, authnMappingId string, body AuthNMappingUpdateRequest) (AuthNMappingResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateAuthNMappingRequest(ctx, authnMappingId, body) + if err != nil { + var localVarReturnValue AuthNMappingResponse + return localVarReturnValue, nil, err + } + + return a.updateAuthNMappingExecute(req) +} + +// updateAuthNMappingExecute executes the request. +func (a *AuthNMappingsApi) updateAuthNMappingExecute(r apiUpdateAuthNMappingRequest) (AuthNMappingResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue AuthNMappingResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.AuthNMappingsApi.UpdateAuthNMapping") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/authn_mappings/{authn_mapping_id}" + localVarPath = strings.Replace(localVarPath, "{"+"authn_mapping_id"+"}", _neturl.PathEscape(common.ParameterToString(r.authnMappingId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if localVarHTTPResponse.StatusCode == 422 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAuthNMappingsApi Returns NewAuthNMappingsApi. +func NewAuthNMappingsApi(client *common.APIClient) *AuthNMappingsApi { + return &AuthNMappingsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_cloud_workload_security.go b/api/v2/datadog/api_cloud_workload_security.go new file mode 100644 index 00000000000..e863df85d6f --- /dev/null +++ b/api/v2/datadog/api_cloud_workload_security.go @@ -0,0 +1,857 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "os" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// CloudWorkloadSecurityApi service type +type CloudWorkloadSecurityApi common.Service + +type apiCreateCloudWorkloadSecurityAgentRuleRequest struct { + ctx _context.Context + body *CloudWorkloadSecurityAgentRuleCreateRequest +} + +func (a *CloudWorkloadSecurityApi) buildCreateCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, body CloudWorkloadSecurityAgentRuleCreateRequest) (apiCreateCloudWorkloadSecurityAgentRuleRequest, error) { + req := apiCreateCloudWorkloadSecurityAgentRuleRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateCloudWorkloadSecurityAgentRule Create a Cloud Workload Security Agent rule. +// Create a new Agent rule with the given parameters. +func (a *CloudWorkloadSecurityApi) CreateCloudWorkloadSecurityAgentRule(ctx _context.Context, body CloudWorkloadSecurityAgentRuleCreateRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { + req, err := a.buildCreateCloudWorkloadSecurityAgentRuleRequest(ctx, body) + if err != nil { + var localVarReturnValue CloudWorkloadSecurityAgentRuleResponse + return localVarReturnValue, nil, err + } + + return a.createCloudWorkloadSecurityAgentRuleExecute(req) +} + +// createCloudWorkloadSecurityAgentRuleExecute executes the request. +func (a *CloudWorkloadSecurityApi) createCloudWorkloadSecurityAgentRuleExecute(r apiCreateCloudWorkloadSecurityAgentRuleRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue CloudWorkloadSecurityAgentRuleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.CreateCloudWorkloadSecurityAgentRule") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteCloudWorkloadSecurityAgentRuleRequest struct { + ctx _context.Context + agentRuleId string +} + +func (a *CloudWorkloadSecurityApi) buildDeleteCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, agentRuleId string) (apiDeleteCloudWorkloadSecurityAgentRuleRequest, error) { + req := apiDeleteCloudWorkloadSecurityAgentRuleRequest{ + ctx: ctx, + agentRuleId: agentRuleId, + } + return req, nil +} + +// DeleteCloudWorkloadSecurityAgentRule Delete a Cloud Workload Security Agent rule. +// Delete a specific Agent rule. +func (a *CloudWorkloadSecurityApi) DeleteCloudWorkloadSecurityAgentRule(ctx _context.Context, agentRuleId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteCloudWorkloadSecurityAgentRuleRequest(ctx, agentRuleId) + if err != nil { + return nil, err + } + + return a.deleteCloudWorkloadSecurityAgentRuleExecute(req) +} + +// deleteCloudWorkloadSecurityAgentRuleExecute executes the request. +func (a *CloudWorkloadSecurityApi) deleteCloudWorkloadSecurityAgentRuleExecute(r apiDeleteCloudWorkloadSecurityAgentRuleRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.DeleteCloudWorkloadSecurityAgentRule") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}" + localVarPath = strings.Replace(localVarPath, "{"+"agent_rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.agentRuleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiDownloadCloudWorkloadPolicyFileRequest struct { + ctx _context.Context +} + +func (a *CloudWorkloadSecurityApi) buildDownloadCloudWorkloadPolicyFileRequest(ctx _context.Context) (apiDownloadCloudWorkloadPolicyFileRequest, error) { + req := apiDownloadCloudWorkloadPolicyFileRequest{ + ctx: ctx, + } + return req, nil +} + +// DownloadCloudWorkloadPolicyFile Get the latest Cloud Workload Security policy. +// The download endpoint generates a Cloud Workload Security policy file from your currently active +// Cloud Workload Security rules, and downloads them as a .policy file. This file can then be deployed to +// your agents to update the policy running in your environment. +func (a *CloudWorkloadSecurityApi) DownloadCloudWorkloadPolicyFile(ctx _context.Context) (*os.File, *_nethttp.Response, error) { + req, err := a.buildDownloadCloudWorkloadPolicyFileRequest(ctx) + if err != nil { + var localVarReturnValue *os.File + return localVarReturnValue, nil, err + } + + return a.downloadCloudWorkloadPolicyFileExecute(req) +} + +// downloadCloudWorkloadPolicyFileExecute executes the request. +func (a *CloudWorkloadSecurityApi) downloadCloudWorkloadPolicyFileExecute(r apiDownloadCloudWorkloadPolicyFileRequest) (*os.File, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue *os.File + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.DownloadCloudWorkloadPolicyFile") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security/cloud_workload/policy/download" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetCloudWorkloadSecurityAgentRuleRequest struct { + ctx _context.Context + agentRuleId string +} + +func (a *CloudWorkloadSecurityApi) buildGetCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, agentRuleId string) (apiGetCloudWorkloadSecurityAgentRuleRequest, error) { + req := apiGetCloudWorkloadSecurityAgentRuleRequest{ + ctx: ctx, + agentRuleId: agentRuleId, + } + return req, nil +} + +// GetCloudWorkloadSecurityAgentRule Get a Cloud Workload Security Agent rule. +// Get the details of a specific Agent rule. +func (a *CloudWorkloadSecurityApi) GetCloudWorkloadSecurityAgentRule(ctx _context.Context, agentRuleId string) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { + req, err := a.buildGetCloudWorkloadSecurityAgentRuleRequest(ctx, agentRuleId) + if err != nil { + var localVarReturnValue CloudWorkloadSecurityAgentRuleResponse + return localVarReturnValue, nil, err + } + + return a.getCloudWorkloadSecurityAgentRuleExecute(req) +} + +// getCloudWorkloadSecurityAgentRuleExecute executes the request. +func (a *CloudWorkloadSecurityApi) getCloudWorkloadSecurityAgentRuleExecute(r apiGetCloudWorkloadSecurityAgentRuleRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CloudWorkloadSecurityAgentRuleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.GetCloudWorkloadSecurityAgentRule") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}" + localVarPath = strings.Replace(localVarPath, "{"+"agent_rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.agentRuleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListCloudWorkloadSecurityAgentRulesRequest struct { + ctx _context.Context +} + +func (a *CloudWorkloadSecurityApi) buildListCloudWorkloadSecurityAgentRulesRequest(ctx _context.Context) (apiListCloudWorkloadSecurityAgentRulesRequest, error) { + req := apiListCloudWorkloadSecurityAgentRulesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListCloudWorkloadSecurityAgentRules Get all Cloud Workload Security Agent rules. +// Get the list of Agent rules. +func (a *CloudWorkloadSecurityApi) ListCloudWorkloadSecurityAgentRules(ctx _context.Context) (CloudWorkloadSecurityAgentRulesListResponse, *_nethttp.Response, error) { + req, err := a.buildListCloudWorkloadSecurityAgentRulesRequest(ctx) + if err != nil { + var localVarReturnValue CloudWorkloadSecurityAgentRulesListResponse + return localVarReturnValue, nil, err + } + + return a.listCloudWorkloadSecurityAgentRulesExecute(req) +} + +// listCloudWorkloadSecurityAgentRulesExecute executes the request. +func (a *CloudWorkloadSecurityApi) listCloudWorkloadSecurityAgentRulesExecute(r apiListCloudWorkloadSecurityAgentRulesRequest) (CloudWorkloadSecurityAgentRulesListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CloudWorkloadSecurityAgentRulesListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.ListCloudWorkloadSecurityAgentRules") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateCloudWorkloadSecurityAgentRuleRequest struct { + ctx _context.Context + agentRuleId string + body *CloudWorkloadSecurityAgentRuleUpdateRequest +} + +func (a *CloudWorkloadSecurityApi) buildUpdateCloudWorkloadSecurityAgentRuleRequest(ctx _context.Context, agentRuleId string, body CloudWorkloadSecurityAgentRuleUpdateRequest) (apiUpdateCloudWorkloadSecurityAgentRuleRequest, error) { + req := apiUpdateCloudWorkloadSecurityAgentRuleRequest{ + ctx: ctx, + agentRuleId: agentRuleId, + body: &body, + } + return req, nil +} + +// UpdateCloudWorkloadSecurityAgentRule Update a Cloud Workload Security Agent rule. +// Update a specific Agent rule. +// Returns the Agent rule object when the request is successful. +func (a *CloudWorkloadSecurityApi) UpdateCloudWorkloadSecurityAgentRule(ctx _context.Context, agentRuleId string, body CloudWorkloadSecurityAgentRuleUpdateRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateCloudWorkloadSecurityAgentRuleRequest(ctx, agentRuleId, body) + if err != nil { + var localVarReturnValue CloudWorkloadSecurityAgentRuleResponse + return localVarReturnValue, nil, err + } + + return a.updateCloudWorkloadSecurityAgentRuleExecute(req) +} + +// updateCloudWorkloadSecurityAgentRuleExecute executes the request. +func (a *CloudWorkloadSecurityApi) updateCloudWorkloadSecurityAgentRuleExecute(r apiUpdateCloudWorkloadSecurityAgentRuleRequest) (CloudWorkloadSecurityAgentRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue CloudWorkloadSecurityAgentRuleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.CloudWorkloadSecurityApi.UpdateCloudWorkloadSecurityAgentRule") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}" + localVarPath = strings.Replace(localVarPath, "{"+"agent_rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.agentRuleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewCloudWorkloadSecurityApi Returns NewCloudWorkloadSecurityApi. +func NewCloudWorkloadSecurityApi(client *common.APIClient) *CloudWorkloadSecurityApi { + return &CloudWorkloadSecurityApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_dashboard_lists.go b/api/v2/datadog/api_dashboard_lists.go new file mode 100644 index 00000000000..aadb66368f7 --- /dev/null +++ b/api/v2/datadog/api_dashboard_lists.go @@ -0,0 +1,625 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// DashboardListsApi service type +type DashboardListsApi common.Service + +type apiCreateDashboardListItemsRequest struct { + ctx _context.Context + dashboardListId int64 + body *DashboardListAddItemsRequest +} + +func (a *DashboardListsApi) buildCreateDashboardListItemsRequest(ctx _context.Context, dashboardListId int64, body DashboardListAddItemsRequest) (apiCreateDashboardListItemsRequest, error) { + req := apiCreateDashboardListItemsRequest{ + ctx: ctx, + dashboardListId: dashboardListId, + body: &body, + } + return req, nil +} + +// CreateDashboardListItems Add Items to a Dashboard List. +// Add dashboards to an existing dashboard list. +func (a *DashboardListsApi) CreateDashboardListItems(ctx _context.Context, dashboardListId int64, body DashboardListAddItemsRequest) (DashboardListAddItemsResponse, *_nethttp.Response, error) { + req, err := a.buildCreateDashboardListItemsRequest(ctx, dashboardListId, body) + if err != nil { + var localVarReturnValue DashboardListAddItemsResponse + return localVarReturnValue, nil, err + } + + return a.createDashboardListItemsExecute(req) +} + +// createDashboardListItemsExecute executes the request. +func (a *DashboardListsApi) createDashboardListItemsExecute(r apiCreateDashboardListItemsRequest) (DashboardListAddItemsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue DashboardListAddItemsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.CreateDashboardListItems") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" + localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteDashboardListItemsRequest struct { + ctx _context.Context + dashboardListId int64 + body *DashboardListDeleteItemsRequest +} + +func (a *DashboardListsApi) buildDeleteDashboardListItemsRequest(ctx _context.Context, dashboardListId int64, body DashboardListDeleteItemsRequest) (apiDeleteDashboardListItemsRequest, error) { + req := apiDeleteDashboardListItemsRequest{ + ctx: ctx, + dashboardListId: dashboardListId, + body: &body, + } + return req, nil +} + +// DeleteDashboardListItems Delete items from a dashboard list. +// Delete dashboards from an existing dashboard list. +func (a *DashboardListsApi) DeleteDashboardListItems(ctx _context.Context, dashboardListId int64, body DashboardListDeleteItemsRequest) (DashboardListDeleteItemsResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteDashboardListItemsRequest(ctx, dashboardListId, body) + if err != nil { + var localVarReturnValue DashboardListDeleteItemsResponse + return localVarReturnValue, nil, err + } + + return a.deleteDashboardListItemsExecute(req) +} + +// deleteDashboardListItemsExecute executes the request. +func (a *DashboardListsApi) deleteDashboardListItemsExecute(r apiDeleteDashboardListItemsRequest) (DashboardListDeleteItemsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue DashboardListDeleteItemsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.DeleteDashboardListItems") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" + localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetDashboardListItemsRequest struct { + ctx _context.Context + dashboardListId int64 +} + +func (a *DashboardListsApi) buildGetDashboardListItemsRequest(ctx _context.Context, dashboardListId int64) (apiGetDashboardListItemsRequest, error) { + req := apiGetDashboardListItemsRequest{ + ctx: ctx, + dashboardListId: dashboardListId, + } + return req, nil +} + +// GetDashboardListItems Get items of a Dashboard List. +// Fetch the dashboard list’s dashboard definitions. +func (a *DashboardListsApi) GetDashboardListItems(ctx _context.Context, dashboardListId int64) (DashboardListItems, *_nethttp.Response, error) { + req, err := a.buildGetDashboardListItemsRequest(ctx, dashboardListId) + if err != nil { + var localVarReturnValue DashboardListItems + return localVarReturnValue, nil, err + } + + return a.getDashboardListItemsExecute(req) +} + +// getDashboardListItemsExecute executes the request. +func (a *DashboardListsApi) getDashboardListItemsExecute(r apiGetDashboardListItemsRequest) (DashboardListItems, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DashboardListItems + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.GetDashboardListItems") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" + localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateDashboardListItemsRequest struct { + ctx _context.Context + dashboardListId int64 + body *DashboardListUpdateItemsRequest +} + +func (a *DashboardListsApi) buildUpdateDashboardListItemsRequest(ctx _context.Context, dashboardListId int64, body DashboardListUpdateItemsRequest) (apiUpdateDashboardListItemsRequest, error) { + req := apiUpdateDashboardListItemsRequest{ + ctx: ctx, + dashboardListId: dashboardListId, + body: &body, + } + return req, nil +} + +// UpdateDashboardListItems Update items of a dashboard list. +// Update dashboards of an existing dashboard list. +func (a *DashboardListsApi) UpdateDashboardListItems(ctx _context.Context, dashboardListId int64, body DashboardListUpdateItemsRequest) (DashboardListUpdateItemsResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateDashboardListItemsRequest(ctx, dashboardListId, body) + if err != nil { + var localVarReturnValue DashboardListUpdateItemsResponse + return localVarReturnValue, nil, err + } + + return a.updateDashboardListItemsExecute(req) +} + +// updateDashboardListItemsExecute executes the request. +func (a *DashboardListsApi) updateDashboardListItemsExecute(r apiUpdateDashboardListItemsRequest) (DashboardListUpdateItemsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue DashboardListUpdateItemsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.DashboardListsApi.UpdateDashboardListItems") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/dashboard/lists/manual/{dashboard_list_id}/dashboards" + localVarPath = strings.Replace(localVarPath, "{"+"dashboard_list_id"+"}", _neturl.PathEscape(common.ParameterToString(r.dashboardListId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewDashboardListsApi Returns NewDashboardListsApi. +func NewDashboardListsApi(client *common.APIClient) *DashboardListsApi { + return &DashboardListsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_events.go b/api/v2/datadog/api_events.go new file mode 100644 index 00000000000..52a7abf241e --- /dev/null +++ b/api/v2/datadog/api_events.go @@ -0,0 +1,561 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _fmt "fmt" + _ioutil "io/ioutil" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// EventsApi service type +type EventsApi common.Service + +type apiListEventsRequest struct { + ctx _context.Context + filterQuery *string + filterFrom *string + filterTo *string + sort *EventsSort + pageCursor *string + pageLimit *int32 +} + +// ListEventsOptionalParameters holds optional parameters for ListEvents. +type ListEventsOptionalParameters struct { + FilterQuery *string + FilterFrom *string + FilterTo *string + Sort *EventsSort + PageCursor *string + PageLimit *int32 +} + +// NewListEventsOptionalParameters creates an empty struct for parameters. +func NewListEventsOptionalParameters() *ListEventsOptionalParameters { + this := ListEventsOptionalParameters{} + return &this +} + +// WithFilterQuery sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithFilterQuery(filterQuery string) *ListEventsOptionalParameters { + r.FilterQuery = &filterQuery + return r +} + +// WithFilterFrom sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithFilterFrom(filterFrom string) *ListEventsOptionalParameters { + r.FilterFrom = &filterFrom + return r +} + +// WithFilterTo sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithFilterTo(filterTo string) *ListEventsOptionalParameters { + r.FilterTo = &filterTo + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithSort(sort EventsSort) *ListEventsOptionalParameters { + r.Sort = &sort + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithPageCursor(pageCursor string) *ListEventsOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListEventsOptionalParameters) WithPageLimit(pageLimit int32) *ListEventsOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +func (a *EventsApi) buildListEventsRequest(ctx _context.Context, o ...ListEventsOptionalParameters) (apiListEventsRequest, error) { + req := apiListEventsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListEventsOptionalParameters is allowed") + } + + if o != nil { + req.filterQuery = o[0].FilterQuery + req.filterFrom = o[0].FilterFrom + req.filterTo = o[0].FilterTo + req.sort = o[0].Sort + req.pageCursor = o[0].PageCursor + req.pageLimit = o[0].PageLimit + } + return req, nil +} + +// ListEvents Get a list of events. +// List endpoint returns events that match an events search query. +// [Results are paginated similarly to logs](https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination). +// +// Use this endpoint to see your latest events. +func (a *EventsApi) ListEvents(ctx _context.Context, o ...ListEventsOptionalParameters) (EventsListResponse, *_nethttp.Response, error) { + req, err := a.buildListEventsRequest(ctx, o...) + if err != nil { + var localVarReturnValue EventsListResponse + return localVarReturnValue, nil, err + } + + return a.listEventsExecute(req) +} + +// ListEventsWithPagination provides a paginated version of ListEvents returning a channel with all items. +func (a *EventsApi) ListEventsWithPagination(ctx _context.Context, o ...ListEventsOptionalParameters) (<-chan EventResponse, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, ListEventsOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan EventResponse, pageSize_) + go func() { + for { + req, err := a.buildListEventsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listEventsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// listEventsExecute executes the request. +func (a *EventsApi) listEventsExecute(r apiListEventsRequest) (EventsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue EventsListResponse + ) + + operationId := "v2.ListEvents" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.EventsApi.ListEvents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterQuery != nil { + localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) + } + if r.filterFrom != nil { + localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) + } + if r.filterTo != nil { + localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.pageCursor != nil { + localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) + } + if r.pageLimit != nil { + localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSearchEventsRequest struct { + ctx _context.Context + body *EventsListRequest +} + +// SearchEventsOptionalParameters holds optional parameters for SearchEvents. +type SearchEventsOptionalParameters struct { + Body *EventsListRequest +} + +// NewSearchEventsOptionalParameters creates an empty struct for parameters. +func NewSearchEventsOptionalParameters() *SearchEventsOptionalParameters { + this := SearchEventsOptionalParameters{} + return &this +} + +// WithBody sets the corresponding parameter name and returns the struct. +func (r *SearchEventsOptionalParameters) WithBody(body EventsListRequest) *SearchEventsOptionalParameters { + r.Body = &body + return r +} + +func (a *EventsApi) buildSearchEventsRequest(ctx _context.Context, o ...SearchEventsOptionalParameters) (apiSearchEventsRequest, error) { + req := apiSearchEventsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SearchEventsOptionalParameters is allowed") + } + + if o != nil { + req.body = o[0].Body + } + return req, nil +} + +// SearchEvents Search events. +// List endpoint returns events that match an events search query. +// [Results are paginated similarly to logs](https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination). +// +// Use this endpoint to build complex events filtering and search. +func (a *EventsApi) SearchEvents(ctx _context.Context, o ...SearchEventsOptionalParameters) (EventsListResponse, *_nethttp.Response, error) { + req, err := a.buildSearchEventsRequest(ctx, o...) + if err != nil { + var localVarReturnValue EventsListResponse + return localVarReturnValue, nil, err + } + + return a.searchEventsExecute(req) +} + +// SearchEventsWithPagination provides a paginated version of SearchEvents returning a channel with all items. +func (a *EventsApi) SearchEventsWithPagination(ctx _context.Context, o ...SearchEventsOptionalParameters) (<-chan EventResponse, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, SearchEventsOptionalParameters{}) + } + if o[0].Body == nil { + o[0].Body = NewEventsListRequest() + } + if o[0].Body.Page == nil { + o[0].Body.Page = NewEventsRequestPage() + } + if o[0].Body.Page.Limit != nil { + pageSize_ = *o[0].Body.Page.Limit + } + o[0].Body.Page.Limit = &pageSize_ + + items := make(chan EventResponse, pageSize_) + go func() { + for { + req, err := a.buildSearchEventsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.searchEventsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].Body.Page.Cursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// searchEventsExecute executes the request. +func (a *EventsApi) searchEventsExecute(r apiSearchEventsRequest) (EventsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue EventsListResponse + ) + + operationId := "v2.SearchEvents" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.EventsApi.SearchEvents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/events/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewEventsApi Returns NewEventsApi. +func NewEventsApi(client *common.APIClient) *EventsApi { + return &EventsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_incident_services.go b/api/v2/datadog/api_incident_services.go new file mode 100644 index 00000000000..90425b9d520 --- /dev/null +++ b/api/v2/datadog/api_incident_services.go @@ -0,0 +1,932 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _fmt "fmt" + _ioutil "io/ioutil" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// IncidentServicesApi service type +type IncidentServicesApi common.Service + +type apiCreateIncidentServiceRequest struct { + ctx _context.Context + body *IncidentServiceCreateRequest +} + +func (a *IncidentServicesApi) buildCreateIncidentServiceRequest(ctx _context.Context, body IncidentServiceCreateRequest) (apiCreateIncidentServiceRequest, error) { + req := apiCreateIncidentServiceRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateIncidentService Create a new incident service. +// Creates a new incident service. +func (a *IncidentServicesApi) CreateIncidentService(ctx _context.Context, body IncidentServiceCreateRequest) (IncidentServiceResponse, *_nethttp.Response, error) { + req, err := a.buildCreateIncidentServiceRequest(ctx, body) + if err != nil { + var localVarReturnValue IncidentServiceResponse + return localVarReturnValue, nil, err + } + + return a.createIncidentServiceExecute(req) +} + +// createIncidentServiceExecute executes the request. +func (a *IncidentServicesApi) createIncidentServiceExecute(r apiCreateIncidentServiceRequest) (IncidentServiceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentServiceResponse + ) + + operationId := "v2.CreateIncidentService" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.CreateIncidentService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteIncidentServiceRequest struct { + ctx _context.Context + serviceId string +} + +func (a *IncidentServicesApi) buildDeleteIncidentServiceRequest(ctx _context.Context, serviceId string) (apiDeleteIncidentServiceRequest, error) { + req := apiDeleteIncidentServiceRequest{ + ctx: ctx, + serviceId: serviceId, + } + return req, nil +} + +// DeleteIncidentService Delete an existing incident service. +// Deletes an existing incident service. +func (a *IncidentServicesApi) DeleteIncidentService(ctx _context.Context, serviceId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteIncidentServiceRequest(ctx, serviceId) + if err != nil { + return nil, err + } + + return a.deleteIncidentServiceExecute(req) +} + +// deleteIncidentServiceExecute executes the request. +func (a *IncidentServicesApi) deleteIncidentServiceExecute(r apiDeleteIncidentServiceRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentService" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.DeleteIncidentService") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services/{service_id}" + localVarPath = strings.Replace(localVarPath, "{"+"service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetIncidentServiceRequest struct { + ctx _context.Context + serviceId string + include *IncidentRelatedObject +} + +// GetIncidentServiceOptionalParameters holds optional parameters for GetIncidentService. +type GetIncidentServiceOptionalParameters struct { + Include *IncidentRelatedObject +} + +// NewGetIncidentServiceOptionalParameters creates an empty struct for parameters. +func NewGetIncidentServiceOptionalParameters() *GetIncidentServiceOptionalParameters { + this := GetIncidentServiceOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetIncidentServiceOptionalParameters) WithInclude(include IncidentRelatedObject) *GetIncidentServiceOptionalParameters { + r.Include = &include + return r +} + +func (a *IncidentServicesApi) buildGetIncidentServiceRequest(ctx _context.Context, serviceId string, o ...GetIncidentServiceOptionalParameters) (apiGetIncidentServiceRequest, error) { + req := apiGetIncidentServiceRequest{ + ctx: ctx, + serviceId: serviceId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetIncidentServiceOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + } + return req, nil +} + +// GetIncidentService Get details of an incident service. +// Get details of an incident service. If the `include[users]` query parameter is provided, +// the included attribute will contain the users related to these incident services. +func (a *IncidentServicesApi) GetIncidentService(ctx _context.Context, serviceId string, o ...GetIncidentServiceOptionalParameters) (IncidentServiceResponse, *_nethttp.Response, error) { + req, err := a.buildGetIncidentServiceRequest(ctx, serviceId, o...) + if err != nil { + var localVarReturnValue IncidentServiceResponse + return localVarReturnValue, nil, err + } + + return a.getIncidentServiceExecute(req) +} + +// getIncidentServiceExecute executes the request. +func (a *IncidentServicesApi) getIncidentServiceExecute(r apiGetIncidentServiceRequest) (IncidentServiceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentServiceResponse + ) + + operationId := "v2.GetIncidentService" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.GetIncidentService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services/{service_id}" + localVarPath = strings.Replace(localVarPath, "{"+"service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListIncidentServicesRequest struct { + ctx _context.Context + include *IncidentRelatedObject + pageSize *int64 + pageOffset *int64 + filter *string +} + +// ListIncidentServicesOptionalParameters holds optional parameters for ListIncidentServices. +type ListIncidentServicesOptionalParameters struct { + Include *IncidentRelatedObject + PageSize *int64 + PageOffset *int64 + Filter *string +} + +// NewListIncidentServicesOptionalParameters creates an empty struct for parameters. +func NewListIncidentServicesOptionalParameters() *ListIncidentServicesOptionalParameters { + this := ListIncidentServicesOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentServicesOptionalParameters) WithInclude(include IncidentRelatedObject) *ListIncidentServicesOptionalParameters { + r.Include = &include + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListIncidentServicesOptionalParameters) WithPageSize(pageSize int64) *ListIncidentServicesOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageOffset sets the corresponding parameter name and returns the struct. +func (r *ListIncidentServicesOptionalParameters) WithPageOffset(pageOffset int64) *ListIncidentServicesOptionalParameters { + r.PageOffset = &pageOffset + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListIncidentServicesOptionalParameters) WithFilter(filter string) *ListIncidentServicesOptionalParameters { + r.Filter = &filter + return r +} + +func (a *IncidentServicesApi) buildListIncidentServicesRequest(ctx _context.Context, o ...ListIncidentServicesOptionalParameters) (apiListIncidentServicesRequest, error) { + req := apiListIncidentServicesRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListIncidentServicesOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + req.pageSize = o[0].PageSize + req.pageOffset = o[0].PageOffset + req.filter = o[0].Filter + } + return req, nil +} + +// ListIncidentServices Get a list of all incident services. +// Get all incident services uploaded for the requesting user's organization. If the `include[users]` query parameter is provided, the included attribute will contain the users related to these incident services. +func (a *IncidentServicesApi) ListIncidentServices(ctx _context.Context, o ...ListIncidentServicesOptionalParameters) (IncidentServicesResponse, *_nethttp.Response, error) { + req, err := a.buildListIncidentServicesRequest(ctx, o...) + if err != nil { + var localVarReturnValue IncidentServicesResponse + return localVarReturnValue, nil, err + } + + return a.listIncidentServicesExecute(req) +} + +// listIncidentServicesExecute executes the request. +func (a *IncidentServicesApi) listIncidentServicesExecute(r apiListIncidentServicesRequest) (IncidentServicesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentServicesResponse + ) + + operationId := "v2.ListIncidentServices" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.ListIncidentServices") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) + } + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageOffset != nil { + localVarQueryParams.Add("page[offset]", common.ParameterToString(*r.pageOffset, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateIncidentServiceRequest struct { + ctx _context.Context + serviceId string + body *IncidentServiceUpdateRequest +} + +func (a *IncidentServicesApi) buildUpdateIncidentServiceRequest(ctx _context.Context, serviceId string, body IncidentServiceUpdateRequest) (apiUpdateIncidentServiceRequest, error) { + req := apiUpdateIncidentServiceRequest{ + ctx: ctx, + serviceId: serviceId, + body: &body, + } + return req, nil +} + +// UpdateIncidentService Update an existing incident service. +// Updates an existing incident service. Only provide the attributes which should be updated as this request is a partial update. +func (a *IncidentServicesApi) UpdateIncidentService(ctx _context.Context, serviceId string, body IncidentServiceUpdateRequest) (IncidentServiceResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateIncidentServiceRequest(ctx, serviceId, body) + if err != nil { + var localVarReturnValue IncidentServiceResponse + return localVarReturnValue, nil, err + } + + return a.updateIncidentServiceExecute(req) +} + +// updateIncidentServiceExecute executes the request. +func (a *IncidentServicesApi) updateIncidentServiceExecute(r apiUpdateIncidentServiceRequest) (IncidentServiceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue IncidentServiceResponse + ) + + operationId := "v2.UpdateIncidentService" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentServicesApi.UpdateIncidentService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/services/{service_id}" + localVarPath = strings.Replace(localVarPath, "{"+"service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewIncidentServicesApi Returns NewIncidentServicesApi. +func NewIncidentServicesApi(client *common.APIClient) *IncidentServicesApi { + return &IncidentServicesApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_incident_teams.go b/api/v2/datadog/api_incident_teams.go new file mode 100644 index 00000000000..e8f13df5b36 --- /dev/null +++ b/api/v2/datadog/api_incident_teams.go @@ -0,0 +1,932 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _fmt "fmt" + _ioutil "io/ioutil" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// IncidentTeamsApi service type +type IncidentTeamsApi common.Service + +type apiCreateIncidentTeamRequest struct { + ctx _context.Context + body *IncidentTeamCreateRequest +} + +func (a *IncidentTeamsApi) buildCreateIncidentTeamRequest(ctx _context.Context, body IncidentTeamCreateRequest) (apiCreateIncidentTeamRequest, error) { + req := apiCreateIncidentTeamRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateIncidentTeam Create a new incident team. +// Creates a new incident team. +func (a *IncidentTeamsApi) CreateIncidentTeam(ctx _context.Context, body IncidentTeamCreateRequest) (IncidentTeamResponse, *_nethttp.Response, error) { + req, err := a.buildCreateIncidentTeamRequest(ctx, body) + if err != nil { + var localVarReturnValue IncidentTeamResponse + return localVarReturnValue, nil, err + } + + return a.createIncidentTeamExecute(req) +} + +// createIncidentTeamExecute executes the request. +func (a *IncidentTeamsApi) createIncidentTeamExecute(r apiCreateIncidentTeamRequest) (IncidentTeamResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentTeamResponse + ) + + operationId := "v2.CreateIncidentTeam" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.CreateIncidentTeam") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/teams" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteIncidentTeamRequest struct { + ctx _context.Context + teamId string +} + +func (a *IncidentTeamsApi) buildDeleteIncidentTeamRequest(ctx _context.Context, teamId string) (apiDeleteIncidentTeamRequest, error) { + req := apiDeleteIncidentTeamRequest{ + ctx: ctx, + teamId: teamId, + } + return req, nil +} + +// DeleteIncidentTeam Delete an existing incident team. +// Deletes an existing incident team. +func (a *IncidentTeamsApi) DeleteIncidentTeam(ctx _context.Context, teamId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteIncidentTeamRequest(ctx, teamId) + if err != nil { + return nil, err + } + + return a.deleteIncidentTeamExecute(req) +} + +// deleteIncidentTeamExecute executes the request. +func (a *IncidentTeamsApi) deleteIncidentTeamExecute(r apiDeleteIncidentTeamRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentTeam" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.DeleteIncidentTeam") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/teams/{team_id}" + localVarPath = strings.Replace(localVarPath, "{"+"team_id"+"}", _neturl.PathEscape(common.ParameterToString(r.teamId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetIncidentTeamRequest struct { + ctx _context.Context + teamId string + include *IncidentRelatedObject +} + +// GetIncidentTeamOptionalParameters holds optional parameters for GetIncidentTeam. +type GetIncidentTeamOptionalParameters struct { + Include *IncidentRelatedObject +} + +// NewGetIncidentTeamOptionalParameters creates an empty struct for parameters. +func NewGetIncidentTeamOptionalParameters() *GetIncidentTeamOptionalParameters { + this := GetIncidentTeamOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetIncidentTeamOptionalParameters) WithInclude(include IncidentRelatedObject) *GetIncidentTeamOptionalParameters { + r.Include = &include + return r +} + +func (a *IncidentTeamsApi) buildGetIncidentTeamRequest(ctx _context.Context, teamId string, o ...GetIncidentTeamOptionalParameters) (apiGetIncidentTeamRequest, error) { + req := apiGetIncidentTeamRequest{ + ctx: ctx, + teamId: teamId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetIncidentTeamOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + } + return req, nil +} + +// GetIncidentTeam Get details of an incident team. +// Get details of an incident team. If the `include[users]` query parameter is provided, +// the included attribute will contain the users related to these incident teams. +func (a *IncidentTeamsApi) GetIncidentTeam(ctx _context.Context, teamId string, o ...GetIncidentTeamOptionalParameters) (IncidentTeamResponse, *_nethttp.Response, error) { + req, err := a.buildGetIncidentTeamRequest(ctx, teamId, o...) + if err != nil { + var localVarReturnValue IncidentTeamResponse + return localVarReturnValue, nil, err + } + + return a.getIncidentTeamExecute(req) +} + +// getIncidentTeamExecute executes the request. +func (a *IncidentTeamsApi) getIncidentTeamExecute(r apiGetIncidentTeamRequest) (IncidentTeamResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentTeamResponse + ) + + operationId := "v2.GetIncidentTeam" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.GetIncidentTeam") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/teams/{team_id}" + localVarPath = strings.Replace(localVarPath, "{"+"team_id"+"}", _neturl.PathEscape(common.ParameterToString(r.teamId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListIncidentTeamsRequest struct { + ctx _context.Context + include *IncidentRelatedObject + pageSize *int64 + pageOffset *int64 + filter *string +} + +// ListIncidentTeamsOptionalParameters holds optional parameters for ListIncidentTeams. +type ListIncidentTeamsOptionalParameters struct { + Include *IncidentRelatedObject + PageSize *int64 + PageOffset *int64 + Filter *string +} + +// NewListIncidentTeamsOptionalParameters creates an empty struct for parameters. +func NewListIncidentTeamsOptionalParameters() *ListIncidentTeamsOptionalParameters { + this := ListIncidentTeamsOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentTeamsOptionalParameters) WithInclude(include IncidentRelatedObject) *ListIncidentTeamsOptionalParameters { + r.Include = &include + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListIncidentTeamsOptionalParameters) WithPageSize(pageSize int64) *ListIncidentTeamsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageOffset sets the corresponding parameter name and returns the struct. +func (r *ListIncidentTeamsOptionalParameters) WithPageOffset(pageOffset int64) *ListIncidentTeamsOptionalParameters { + r.PageOffset = &pageOffset + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListIncidentTeamsOptionalParameters) WithFilter(filter string) *ListIncidentTeamsOptionalParameters { + r.Filter = &filter + return r +} + +func (a *IncidentTeamsApi) buildListIncidentTeamsRequest(ctx _context.Context, o ...ListIncidentTeamsOptionalParameters) (apiListIncidentTeamsRequest, error) { + req := apiListIncidentTeamsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListIncidentTeamsOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + req.pageSize = o[0].PageSize + req.pageOffset = o[0].PageOffset + req.filter = o[0].Filter + } + return req, nil +} + +// ListIncidentTeams Get a list of all incident teams. +// Get all incident teams for the requesting user's organization. If the `include[users]` query parameter is provided, the included attribute will contain the users related to these incident teams. +func (a *IncidentTeamsApi) ListIncidentTeams(ctx _context.Context, o ...ListIncidentTeamsOptionalParameters) (IncidentTeamsResponse, *_nethttp.Response, error) { + req, err := a.buildListIncidentTeamsRequest(ctx, o...) + if err != nil { + var localVarReturnValue IncidentTeamsResponse + return localVarReturnValue, nil, err + } + + return a.listIncidentTeamsExecute(req) +} + +// listIncidentTeamsExecute executes the request. +func (a *IncidentTeamsApi) listIncidentTeamsExecute(r apiListIncidentTeamsRequest) (IncidentTeamsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentTeamsResponse + ) + + operationId := "v2.ListIncidentTeams" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.ListIncidentTeams") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/teams" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) + } + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageOffset != nil { + localVarQueryParams.Add("page[offset]", common.ParameterToString(*r.pageOffset, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateIncidentTeamRequest struct { + ctx _context.Context + teamId string + body *IncidentTeamUpdateRequest +} + +func (a *IncidentTeamsApi) buildUpdateIncidentTeamRequest(ctx _context.Context, teamId string, body IncidentTeamUpdateRequest) (apiUpdateIncidentTeamRequest, error) { + req := apiUpdateIncidentTeamRequest{ + ctx: ctx, + teamId: teamId, + body: &body, + } + return req, nil +} + +// UpdateIncidentTeam Update an existing incident team. +// Updates an existing incident team. Only provide the attributes which should be updated as this request is a partial update. +func (a *IncidentTeamsApi) UpdateIncidentTeam(ctx _context.Context, teamId string, body IncidentTeamUpdateRequest) (IncidentTeamResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateIncidentTeamRequest(ctx, teamId, body) + if err != nil { + var localVarReturnValue IncidentTeamResponse + return localVarReturnValue, nil, err + } + + return a.updateIncidentTeamExecute(req) +} + +// updateIncidentTeamExecute executes the request. +func (a *IncidentTeamsApi) updateIncidentTeamExecute(r apiUpdateIncidentTeamRequest) (IncidentTeamResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue IncidentTeamResponse + ) + + operationId := "v2.UpdateIncidentTeam" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentTeamsApi.UpdateIncidentTeam") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/teams/{team_id}" + localVarPath = strings.Replace(localVarPath, "{"+"team_id"+"}", _neturl.PathEscape(common.ParameterToString(r.teamId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewIncidentTeamsApi Returns NewIncidentTeamsApi. +func NewIncidentTeamsApi(client *common.APIClient) *IncidentTeamsApi { + return &IncidentTeamsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_incidents.go b/api/v2/datadog/api_incidents.go new file mode 100644 index 00000000000..bda99379898 --- /dev/null +++ b/api/v2/datadog/api_incidents.go @@ -0,0 +1,1001 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _fmt "fmt" + _ioutil "io/ioutil" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// IncidentsApi service type +type IncidentsApi common.Service + +type apiCreateIncidentRequest struct { + ctx _context.Context + body *IncidentCreateRequest +} + +func (a *IncidentsApi) buildCreateIncidentRequest(ctx _context.Context, body IncidentCreateRequest) (apiCreateIncidentRequest, error) { + req := apiCreateIncidentRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateIncident Create an incident. +// Create an incident. +func (a *IncidentsApi) CreateIncident(ctx _context.Context, body IncidentCreateRequest) (IncidentResponse, *_nethttp.Response, error) { + req, err := a.buildCreateIncidentRequest(ctx, body) + if err != nil { + var localVarReturnValue IncidentResponse + return localVarReturnValue, nil, err + } + + return a.createIncidentExecute(req) +} + +// createIncidentExecute executes the request. +func (a *IncidentsApi) createIncidentExecute(r apiCreateIncidentRequest) (IncidentResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentResponse + ) + + operationId := "v2.CreateIncident" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.CreateIncident") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteIncidentRequest struct { + ctx _context.Context + incidentId string +} + +func (a *IncidentsApi) buildDeleteIncidentRequest(ctx _context.Context, incidentId string) (apiDeleteIncidentRequest, error) { + req := apiDeleteIncidentRequest{ + ctx: ctx, + incidentId: incidentId, + } + return req, nil +} + +// DeleteIncident Delete an existing incident. +// Deletes an existing incident from the users organization. +func (a *IncidentsApi) DeleteIncident(ctx _context.Context, incidentId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteIncidentRequest(ctx, incidentId) + if err != nil { + return nil, err + } + + return a.deleteIncidentExecute(req) +} + +// deleteIncidentExecute executes the request. +func (a *IncidentsApi) deleteIncidentExecute(r apiDeleteIncidentRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncident" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.DeleteIncident") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" + localVarPath = strings.Replace(localVarPath, "{"+"incident_id"+"}", _neturl.PathEscape(common.ParameterToString(r.incidentId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetIncidentRequest struct { + ctx _context.Context + incidentId string + include *[]IncidentRelatedObject +} + +// GetIncidentOptionalParameters holds optional parameters for GetIncident. +type GetIncidentOptionalParameters struct { + Include *[]IncidentRelatedObject +} + +// NewGetIncidentOptionalParameters creates an empty struct for parameters. +func NewGetIncidentOptionalParameters() *GetIncidentOptionalParameters { + this := GetIncidentOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetIncidentOptionalParameters) WithInclude(include []IncidentRelatedObject) *GetIncidentOptionalParameters { + r.Include = &include + return r +} + +func (a *IncidentsApi) buildGetIncidentRequest(ctx _context.Context, incidentId string, o ...GetIncidentOptionalParameters) (apiGetIncidentRequest, error) { + req := apiGetIncidentRequest{ + ctx: ctx, + incidentId: incidentId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetIncidentOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + } + return req, nil +} + +// GetIncident Get the details of an incident. +// Get the details of an incident by `incident_id`. +func (a *IncidentsApi) GetIncident(ctx _context.Context, incidentId string, o ...GetIncidentOptionalParameters) (IncidentResponse, *_nethttp.Response, error) { + req, err := a.buildGetIncidentRequest(ctx, incidentId, o...) + if err != nil { + var localVarReturnValue IncidentResponse + return localVarReturnValue, nil, err + } + + return a.getIncidentExecute(req) +} + +// getIncidentExecute executes the request. +func (a *IncidentsApi) getIncidentExecute(r apiGetIncidentRequest) (IncidentResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentResponse + ) + + operationId := "v2.GetIncident" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.GetIncident") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" + localVarPath = strings.Replace(localVarPath, "{"+"incident_id"+"}", _neturl.PathEscape(common.ParameterToString(r.incidentId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "csv")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListIncidentsRequest struct { + ctx _context.Context + include *[]IncidentRelatedObject + pageSize *int64 + pageOffset *int64 +} + +// ListIncidentsOptionalParameters holds optional parameters for ListIncidents. +type ListIncidentsOptionalParameters struct { + Include *[]IncidentRelatedObject + PageSize *int64 + PageOffset *int64 +} + +// NewListIncidentsOptionalParameters creates an empty struct for parameters. +func NewListIncidentsOptionalParameters() *ListIncidentsOptionalParameters { + this := ListIncidentsOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentsOptionalParameters) WithInclude(include []IncidentRelatedObject) *ListIncidentsOptionalParameters { + r.Include = &include + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListIncidentsOptionalParameters) WithPageSize(pageSize int64) *ListIncidentsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageOffset sets the corresponding parameter name and returns the struct. +func (r *ListIncidentsOptionalParameters) WithPageOffset(pageOffset int64) *ListIncidentsOptionalParameters { + r.PageOffset = &pageOffset + return r +} + +func (a *IncidentsApi) buildListIncidentsRequest(ctx _context.Context, o ...ListIncidentsOptionalParameters) (apiListIncidentsRequest, error) { + req := apiListIncidentsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListIncidentsOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + req.pageSize = o[0].PageSize + req.pageOffset = o[0].PageOffset + } + return req, nil +} + +// ListIncidents Get a list of incidents. +// Get all incidents for the user's organization. +func (a *IncidentsApi) ListIncidents(ctx _context.Context, o ...ListIncidentsOptionalParameters) (IncidentsResponse, *_nethttp.Response, error) { + req, err := a.buildListIncidentsRequest(ctx, o...) + if err != nil { + var localVarReturnValue IncidentsResponse + return localVarReturnValue, nil, err + } + + return a.listIncidentsExecute(req) +} + +// ListIncidentsWithPagination provides a paginated version of ListIncidents returning a channel with all items. +func (a *IncidentsApi) ListIncidentsWithPagination(ctx _context.Context, o ...ListIncidentsOptionalParameters) (<-chan IncidentResponseData, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int64(10) + if len(o) == 0 { + o = append(o, ListIncidentsOptionalParameters{}) + } + if o[0].PageSize != nil { + pageSize_ = *o[0].PageSize + } + o[0].PageSize = &pageSize_ + + items := make(chan IncidentResponseData, pageSize_) + go func() { + for { + req, err := a.buildListIncidentsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listIncidentsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + if o[0].PageOffset == nil { + o[0].PageOffset = &pageSize_ + } else { + pageOffset_ := *o[0].PageOffset + pageSize_ + o[0].PageOffset = &pageOffset_ + } + } + close(items) + }() + return items, cancel, nil +} + +// listIncidentsExecute executes the request. +func (a *IncidentsApi) listIncidentsExecute(r apiListIncidentsRequest) (IncidentsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentsResponse + ) + + operationId := "v2.ListIncidents" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.ListIncidents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "csv")) + } + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageOffset != nil { + localVarQueryParams.Add("page[offset]", common.ParameterToString(*r.pageOffset, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateIncidentRequest struct { + ctx _context.Context + incidentId string + body *IncidentUpdateRequest + include *[]IncidentRelatedObject +} + +// UpdateIncidentOptionalParameters holds optional parameters for UpdateIncident. +type UpdateIncidentOptionalParameters struct { + Include *[]IncidentRelatedObject +} + +// NewUpdateIncidentOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentOptionalParameters() *UpdateIncidentOptionalParameters { + this := UpdateIncidentOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *UpdateIncidentOptionalParameters) WithInclude(include []IncidentRelatedObject) *UpdateIncidentOptionalParameters { + r.Include = &include + return r +} + +func (a *IncidentsApi) buildUpdateIncidentRequest(ctx _context.Context, incidentId string, body IncidentUpdateRequest, o ...UpdateIncidentOptionalParameters) (apiUpdateIncidentRequest, error) { + req := apiUpdateIncidentRequest{ + ctx: ctx, + incidentId: incidentId, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type UpdateIncidentOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + } + return req, nil +} + +// UpdateIncident Update an existing incident. +// Updates an incident. Provide only the attributes that should be updated as this request is a partial update. +func (a *IncidentsApi) UpdateIncident(ctx _context.Context, incidentId string, body IncidentUpdateRequest, o ...UpdateIncidentOptionalParameters) (IncidentResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateIncidentRequest(ctx, incidentId, body, o...) + if err != nil { + var localVarReturnValue IncidentResponse + return localVarReturnValue, nil, err + } + + return a.updateIncidentExecute(req) +} + +// updateIncidentExecute executes the request. +func (a *IncidentsApi) updateIncidentExecute(r apiUpdateIncidentRequest) (IncidentResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue IncidentResponse + ) + + operationId := "v2.UpdateIncident" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.IncidentsApi.UpdateIncident") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" + localVarPath = strings.Replace(localVarPath, "{"+"incident_id"+"}", _neturl.PathEscape(common.ParameterToString(r.incidentId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "csv")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewIncidentsApi Returns NewIncidentsApi. +func NewIncidentsApi(client *common.APIClient) *IncidentsApi { + return &IncidentsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_key_management.go b/api/v2/datadog/api_key_management.go new file mode 100644 index 00000000000..ea1ca5fce55 --- /dev/null +++ b/api/v2/datadog/api_key_management.go @@ -0,0 +1,2351 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// KeyManagementApi service type +type KeyManagementApi common.Service + +type apiCreateAPIKeyRequest struct { + ctx _context.Context + body *APIKeyCreateRequest +} + +func (a *KeyManagementApi) buildCreateAPIKeyRequest(ctx _context.Context, body APIKeyCreateRequest) (apiCreateAPIKeyRequest, error) { + req := apiCreateAPIKeyRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateAPIKey Create an API key. +// Create an API key. +func (a *KeyManagementApi) CreateAPIKey(ctx _context.Context, body APIKeyCreateRequest) (APIKeyResponse, *_nethttp.Response, error) { + req, err := a.buildCreateAPIKeyRequest(ctx, body) + if err != nil { + var localVarReturnValue APIKeyResponse + return localVarReturnValue, nil, err + } + + return a.createAPIKeyExecute(req) +} + +// createAPIKeyExecute executes the request. +func (a *KeyManagementApi) createAPIKeyExecute(r apiCreateAPIKeyRequest) (APIKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue APIKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.CreateAPIKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/api_keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateCurrentUserApplicationKeyRequest struct { + ctx _context.Context + body *ApplicationKeyCreateRequest +} + +func (a *KeyManagementApi) buildCreateCurrentUserApplicationKeyRequest(ctx _context.Context, body ApplicationKeyCreateRequest) (apiCreateCurrentUserApplicationKeyRequest, error) { + req := apiCreateCurrentUserApplicationKeyRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateCurrentUserApplicationKey Create an application key for current user. +// Create an application key for current user +func (a *KeyManagementApi) CreateCurrentUserApplicationKey(ctx _context.Context, body ApplicationKeyCreateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildCreateCurrentUserApplicationKeyRequest(ctx, body) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.createCurrentUserApplicationKeyExecute(req) +} + +// createCurrentUserApplicationKeyExecute executes the request. +func (a *KeyManagementApi) createCurrentUserApplicationKeyExecute(r apiCreateCurrentUserApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.CreateCurrentUserApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/current_user/application_keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteAPIKeyRequest struct { + ctx _context.Context + apiKeyId string +} + +func (a *KeyManagementApi) buildDeleteAPIKeyRequest(ctx _context.Context, apiKeyId string) (apiDeleteAPIKeyRequest, error) { + req := apiDeleteAPIKeyRequest{ + ctx: ctx, + apiKeyId: apiKeyId, + } + return req, nil +} + +// DeleteAPIKey Delete an API key. +// Delete an API key. +func (a *KeyManagementApi) DeleteAPIKey(ctx _context.Context, apiKeyId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteAPIKeyRequest(ctx, apiKeyId) + if err != nil { + return nil, err + } + + return a.deleteAPIKeyExecute(req) +} + +// deleteAPIKeyExecute executes the request. +func (a *KeyManagementApi) deleteAPIKeyExecute(r apiDeleteAPIKeyRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.DeleteAPIKey") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/api_keys/{api_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"api_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.apiKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiDeleteApplicationKeyRequest struct { + ctx _context.Context + appKeyId string +} + +func (a *KeyManagementApi) buildDeleteApplicationKeyRequest(ctx _context.Context, appKeyId string) (apiDeleteApplicationKeyRequest, error) { + req := apiDeleteApplicationKeyRequest{ + ctx: ctx, + appKeyId: appKeyId, + } + return req, nil +} + +// DeleteApplicationKey Delete an application key. +// Delete an application key +func (a *KeyManagementApi) DeleteApplicationKey(ctx _context.Context, appKeyId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteApplicationKeyRequest(ctx, appKeyId) + if err != nil { + return nil, err + } + + return a.deleteApplicationKeyExecute(req) +} + +// deleteApplicationKeyExecute executes the request. +func (a *KeyManagementApi) deleteApplicationKeyExecute(r apiDeleteApplicationKeyRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.DeleteApplicationKey") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiDeleteCurrentUserApplicationKeyRequest struct { + ctx _context.Context + appKeyId string +} + +func (a *KeyManagementApi) buildDeleteCurrentUserApplicationKeyRequest(ctx _context.Context, appKeyId string) (apiDeleteCurrentUserApplicationKeyRequest, error) { + req := apiDeleteCurrentUserApplicationKeyRequest{ + ctx: ctx, + appKeyId: appKeyId, + } + return req, nil +} + +// DeleteCurrentUserApplicationKey Delete an application key owned by current user. +// Delete an application key owned by current user +func (a *KeyManagementApi) DeleteCurrentUserApplicationKey(ctx _context.Context, appKeyId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteCurrentUserApplicationKeyRequest(ctx, appKeyId) + if err != nil { + return nil, err + } + + return a.deleteCurrentUserApplicationKeyExecute(req) +} + +// deleteCurrentUserApplicationKeyExecute executes the request. +func (a *KeyManagementApi) deleteCurrentUserApplicationKeyExecute(r apiDeleteCurrentUserApplicationKeyRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.DeleteCurrentUserApplicationKey") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/current_user/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetAPIKeyRequest struct { + ctx _context.Context + apiKeyId string + include *string +} + +// GetAPIKeyOptionalParameters holds optional parameters for GetAPIKey. +type GetAPIKeyOptionalParameters struct { + Include *string +} + +// NewGetAPIKeyOptionalParameters creates an empty struct for parameters. +func NewGetAPIKeyOptionalParameters() *GetAPIKeyOptionalParameters { + this := GetAPIKeyOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetAPIKeyOptionalParameters) WithInclude(include string) *GetAPIKeyOptionalParameters { + r.Include = &include + return r +} + +func (a *KeyManagementApi) buildGetAPIKeyRequest(ctx _context.Context, apiKeyId string, o ...GetAPIKeyOptionalParameters) (apiGetAPIKeyRequest, error) { + req := apiGetAPIKeyRequest{ + ctx: ctx, + apiKeyId: apiKeyId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetAPIKeyOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + } + return req, nil +} + +// GetAPIKey Get API key. +// Get an API key. +func (a *KeyManagementApi) GetAPIKey(ctx _context.Context, apiKeyId string, o ...GetAPIKeyOptionalParameters) (APIKeyResponse, *_nethttp.Response, error) { + req, err := a.buildGetAPIKeyRequest(ctx, apiKeyId, o...) + if err != nil { + var localVarReturnValue APIKeyResponse + return localVarReturnValue, nil, err + } + + return a.getAPIKeyExecute(req) +} + +// getAPIKeyExecute executes the request. +func (a *KeyManagementApi) getAPIKeyExecute(r apiGetAPIKeyRequest) (APIKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue APIKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.GetAPIKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/api_keys/{api_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"api_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.apiKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetApplicationKeyRequest struct { + ctx _context.Context + appKeyId string + include *string +} + +// GetApplicationKeyOptionalParameters holds optional parameters for GetApplicationKey. +type GetApplicationKeyOptionalParameters struct { + Include *string +} + +// NewGetApplicationKeyOptionalParameters creates an empty struct for parameters. +func NewGetApplicationKeyOptionalParameters() *GetApplicationKeyOptionalParameters { + this := GetApplicationKeyOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetApplicationKeyOptionalParameters) WithInclude(include string) *GetApplicationKeyOptionalParameters { + r.Include = &include + return r +} + +func (a *KeyManagementApi) buildGetApplicationKeyRequest(ctx _context.Context, appKeyId string, o ...GetApplicationKeyOptionalParameters) (apiGetApplicationKeyRequest, error) { + req := apiGetApplicationKeyRequest{ + ctx: ctx, + appKeyId: appKeyId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetApplicationKeyOptionalParameters is allowed") + } + + if o != nil { + req.include = o[0].Include + } + return req, nil +} + +// GetApplicationKey Get an application key. +// Get an application key for your org. +func (a *KeyManagementApi) GetApplicationKey(ctx _context.Context, appKeyId string, o ...GetApplicationKeyOptionalParameters) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildGetApplicationKeyRequest(ctx, appKeyId, o...) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.getApplicationKeyExecute(req) +} + +// getApplicationKeyExecute executes the request. +func (a *KeyManagementApi) getApplicationKeyExecute(r apiGetApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.GetApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetCurrentUserApplicationKeyRequest struct { + ctx _context.Context + appKeyId string +} + +func (a *KeyManagementApi) buildGetCurrentUserApplicationKeyRequest(ctx _context.Context, appKeyId string) (apiGetCurrentUserApplicationKeyRequest, error) { + req := apiGetCurrentUserApplicationKeyRequest{ + ctx: ctx, + appKeyId: appKeyId, + } + return req, nil +} + +// GetCurrentUserApplicationKey Get one application key owned by current user. +// Get an application key owned by current user +func (a *KeyManagementApi) GetCurrentUserApplicationKey(ctx _context.Context, appKeyId string) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildGetCurrentUserApplicationKeyRequest(ctx, appKeyId) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.getCurrentUserApplicationKeyExecute(req) +} + +// getCurrentUserApplicationKeyExecute executes the request. +func (a *KeyManagementApi) getCurrentUserApplicationKeyExecute(r apiGetCurrentUserApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.GetCurrentUserApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/current_user/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListAPIKeysRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sort *APIKeysSort + filter *string + filterCreatedAtStart *string + filterCreatedAtEnd *string + filterModifiedAtStart *string + filterModifiedAtEnd *string + include *string +} + +// ListAPIKeysOptionalParameters holds optional parameters for ListAPIKeys. +type ListAPIKeysOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *APIKeysSort + Filter *string + FilterCreatedAtStart *string + FilterCreatedAtEnd *string + FilterModifiedAtStart *string + FilterModifiedAtEnd *string + Include *string +} + +// NewListAPIKeysOptionalParameters creates an empty struct for parameters. +func NewListAPIKeysOptionalParameters() *ListAPIKeysOptionalParameters { + this := ListAPIKeysOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithPageSize(pageSize int64) *ListAPIKeysOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListAPIKeysOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithSort(sort APIKeysSort) *ListAPIKeysOptionalParameters { + r.Sort = &sort + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithFilter(filter string) *ListAPIKeysOptionalParameters { + r.Filter = &filter + return r +} + +// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListAPIKeysOptionalParameters { + r.FilterCreatedAtStart = &filterCreatedAtStart + return r +} + +// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListAPIKeysOptionalParameters { + r.FilterCreatedAtEnd = &filterCreatedAtEnd + return r +} + +// WithFilterModifiedAtStart sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithFilterModifiedAtStart(filterModifiedAtStart string) *ListAPIKeysOptionalParameters { + r.FilterModifiedAtStart = &filterModifiedAtStart + return r +} + +// WithFilterModifiedAtEnd sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithFilterModifiedAtEnd(filterModifiedAtEnd string) *ListAPIKeysOptionalParameters { + r.FilterModifiedAtEnd = &filterModifiedAtEnd + return r +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListAPIKeysOptionalParameters) WithInclude(include string) *ListAPIKeysOptionalParameters { + r.Include = &include + return r +} + +func (a *KeyManagementApi) buildListAPIKeysRequest(ctx _context.Context, o ...ListAPIKeysOptionalParameters) (apiListAPIKeysRequest, error) { + req := apiListAPIKeysRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListAPIKeysOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.filter = o[0].Filter + req.filterCreatedAtStart = o[0].FilterCreatedAtStart + req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd + req.filterModifiedAtStart = o[0].FilterModifiedAtStart + req.filterModifiedAtEnd = o[0].FilterModifiedAtEnd + req.include = o[0].Include + } + return req, nil +} + +// ListAPIKeys Get all API keys. +// List all API keys available for your account. +func (a *KeyManagementApi) ListAPIKeys(ctx _context.Context, o ...ListAPIKeysOptionalParameters) (APIKeysResponse, *_nethttp.Response, error) { + req, err := a.buildListAPIKeysRequest(ctx, o...) + if err != nil { + var localVarReturnValue APIKeysResponse + return localVarReturnValue, nil, err + } + + return a.listAPIKeysExecute(req) +} + +// listAPIKeysExecute executes the request. +func (a *KeyManagementApi) listAPIKeysExecute(r apiListAPIKeysRequest) (APIKeysResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue APIKeysResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.ListAPIKeys") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/api_keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + if r.filterCreatedAtStart != nil { + localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) + } + if r.filterCreatedAtEnd != nil { + localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) + } + if r.filterModifiedAtStart != nil { + localVarQueryParams.Add("filter[modified_at][start]", common.ParameterToString(*r.filterModifiedAtStart, "")) + } + if r.filterModifiedAtEnd != nil { + localVarQueryParams.Add("filter[modified_at][end]", common.ParameterToString(*r.filterModifiedAtEnd, "")) + } + if r.include != nil { + localVarQueryParams.Add("include", common.ParameterToString(*r.include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListApplicationKeysRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sort *ApplicationKeysSort + filter *string + filterCreatedAtStart *string + filterCreatedAtEnd *string +} + +// ListApplicationKeysOptionalParameters holds optional parameters for ListApplicationKeys. +type ListApplicationKeysOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *ApplicationKeysSort + Filter *string + FilterCreatedAtStart *string + FilterCreatedAtEnd *string +} + +// NewListApplicationKeysOptionalParameters creates an empty struct for parameters. +func NewListApplicationKeysOptionalParameters() *ListApplicationKeysOptionalParameters { + this := ListApplicationKeysOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListApplicationKeysOptionalParameters) WithPageSize(pageSize int64) *ListApplicationKeysOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListApplicationKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListApplicationKeysOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListApplicationKeysOptionalParameters) WithSort(sort ApplicationKeysSort) *ListApplicationKeysOptionalParameters { + r.Sort = &sort + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListApplicationKeysOptionalParameters) WithFilter(filter string) *ListApplicationKeysOptionalParameters { + r.Filter = &filter + return r +} + +// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. +func (r *ListApplicationKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListApplicationKeysOptionalParameters { + r.FilterCreatedAtStart = &filterCreatedAtStart + return r +} + +// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. +func (r *ListApplicationKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListApplicationKeysOptionalParameters { + r.FilterCreatedAtEnd = &filterCreatedAtEnd + return r +} + +func (a *KeyManagementApi) buildListApplicationKeysRequest(ctx _context.Context, o ...ListApplicationKeysOptionalParameters) (apiListApplicationKeysRequest, error) { + req := apiListApplicationKeysRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListApplicationKeysOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.filter = o[0].Filter + req.filterCreatedAtStart = o[0].FilterCreatedAtStart + req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd + } + return req, nil +} + +// ListApplicationKeys Get all application keys. +// List all application keys available for your org +func (a *KeyManagementApi) ListApplicationKeys(ctx _context.Context, o ...ListApplicationKeysOptionalParameters) (ListApplicationKeysResponse, *_nethttp.Response, error) { + req, err := a.buildListApplicationKeysRequest(ctx, o...) + if err != nil { + var localVarReturnValue ListApplicationKeysResponse + return localVarReturnValue, nil, err + } + + return a.listApplicationKeysExecute(req) +} + +// listApplicationKeysExecute executes the request. +func (a *KeyManagementApi) listApplicationKeysExecute(r apiListApplicationKeysRequest) (ListApplicationKeysResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ListApplicationKeysResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.ListApplicationKeys") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/application_keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + if r.filterCreatedAtStart != nil { + localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) + } + if r.filterCreatedAtEnd != nil { + localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListCurrentUserApplicationKeysRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sort *ApplicationKeysSort + filter *string + filterCreatedAtStart *string + filterCreatedAtEnd *string +} + +// ListCurrentUserApplicationKeysOptionalParameters holds optional parameters for ListCurrentUserApplicationKeys. +type ListCurrentUserApplicationKeysOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *ApplicationKeysSort + Filter *string + FilterCreatedAtStart *string + FilterCreatedAtEnd *string +} + +// NewListCurrentUserApplicationKeysOptionalParameters creates an empty struct for parameters. +func NewListCurrentUserApplicationKeysOptionalParameters() *ListCurrentUserApplicationKeysOptionalParameters { + this := ListCurrentUserApplicationKeysOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListCurrentUserApplicationKeysOptionalParameters) WithPageSize(pageSize int64) *ListCurrentUserApplicationKeysOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListCurrentUserApplicationKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListCurrentUserApplicationKeysOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListCurrentUserApplicationKeysOptionalParameters) WithSort(sort ApplicationKeysSort) *ListCurrentUserApplicationKeysOptionalParameters { + r.Sort = &sort + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListCurrentUserApplicationKeysOptionalParameters) WithFilter(filter string) *ListCurrentUserApplicationKeysOptionalParameters { + r.Filter = &filter + return r +} + +// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. +func (r *ListCurrentUserApplicationKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListCurrentUserApplicationKeysOptionalParameters { + r.FilterCreatedAtStart = &filterCreatedAtStart + return r +} + +// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. +func (r *ListCurrentUserApplicationKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListCurrentUserApplicationKeysOptionalParameters { + r.FilterCreatedAtEnd = &filterCreatedAtEnd + return r +} + +func (a *KeyManagementApi) buildListCurrentUserApplicationKeysRequest(ctx _context.Context, o ...ListCurrentUserApplicationKeysOptionalParameters) (apiListCurrentUserApplicationKeysRequest, error) { + req := apiListCurrentUserApplicationKeysRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListCurrentUserApplicationKeysOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.filter = o[0].Filter + req.filterCreatedAtStart = o[0].FilterCreatedAtStart + req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd + } + return req, nil +} + +// ListCurrentUserApplicationKeys Get all application keys owned by current user. +// List all application keys available for current user +func (a *KeyManagementApi) ListCurrentUserApplicationKeys(ctx _context.Context, o ...ListCurrentUserApplicationKeysOptionalParameters) (ListApplicationKeysResponse, *_nethttp.Response, error) { + req, err := a.buildListCurrentUserApplicationKeysRequest(ctx, o...) + if err != nil { + var localVarReturnValue ListApplicationKeysResponse + return localVarReturnValue, nil, err + } + + return a.listCurrentUserApplicationKeysExecute(req) +} + +// listCurrentUserApplicationKeysExecute executes the request. +func (a *KeyManagementApi) listCurrentUserApplicationKeysExecute(r apiListCurrentUserApplicationKeysRequest) (ListApplicationKeysResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ListApplicationKeysResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.ListCurrentUserApplicationKeys") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/current_user/application_keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + if r.filterCreatedAtStart != nil { + localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) + } + if r.filterCreatedAtEnd != nil { + localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateAPIKeyRequest struct { + ctx _context.Context + apiKeyId string + body *APIKeyUpdateRequest +} + +func (a *KeyManagementApi) buildUpdateAPIKeyRequest(ctx _context.Context, apiKeyId string, body APIKeyUpdateRequest) (apiUpdateAPIKeyRequest, error) { + req := apiUpdateAPIKeyRequest{ + ctx: ctx, + apiKeyId: apiKeyId, + body: &body, + } + return req, nil +} + +// UpdateAPIKey Edit an API key. +// Update an API key. +func (a *KeyManagementApi) UpdateAPIKey(ctx _context.Context, apiKeyId string, body APIKeyUpdateRequest) (APIKeyResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateAPIKeyRequest(ctx, apiKeyId, body) + if err != nil { + var localVarReturnValue APIKeyResponse + return localVarReturnValue, nil, err + } + + return a.updateAPIKeyExecute(req) +} + +// updateAPIKeyExecute executes the request. +func (a *KeyManagementApi) updateAPIKeyExecute(r apiUpdateAPIKeyRequest) (APIKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue APIKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.UpdateAPIKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/api_keys/{api_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"api_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.apiKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateApplicationKeyRequest struct { + ctx _context.Context + appKeyId string + body *ApplicationKeyUpdateRequest +} + +func (a *KeyManagementApi) buildUpdateApplicationKeyRequest(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (apiUpdateApplicationKeyRequest, error) { + req := apiUpdateApplicationKeyRequest{ + ctx: ctx, + appKeyId: appKeyId, + body: &body, + } + return req, nil +} + +// UpdateApplicationKey Edit an application key. +// Edit an application key +func (a *KeyManagementApi) UpdateApplicationKey(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateApplicationKeyRequest(ctx, appKeyId, body) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.updateApplicationKeyExecute(req) +} + +// updateApplicationKeyExecute executes the request. +func (a *KeyManagementApi) updateApplicationKeyExecute(r apiUpdateApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.UpdateApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateCurrentUserApplicationKeyRequest struct { + ctx _context.Context + appKeyId string + body *ApplicationKeyUpdateRequest +} + +func (a *KeyManagementApi) buildUpdateCurrentUserApplicationKeyRequest(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (apiUpdateCurrentUserApplicationKeyRequest, error) { + req := apiUpdateCurrentUserApplicationKeyRequest{ + ctx: ctx, + appKeyId: appKeyId, + body: &body, + } + return req, nil +} + +// UpdateCurrentUserApplicationKey Edit an application key owned by current user. +// Edit an application key owned by current user +func (a *KeyManagementApi) UpdateCurrentUserApplicationKey(ctx _context.Context, appKeyId string, body ApplicationKeyUpdateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateCurrentUserApplicationKeyRequest(ctx, appKeyId, body) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.updateCurrentUserApplicationKeyExecute(req) +} + +// updateCurrentUserApplicationKeyExecute executes the request. +func (a *KeyManagementApi) updateCurrentUserApplicationKeyExecute(r apiUpdateCurrentUserApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.KeyManagementApi.UpdateCurrentUserApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/current_user/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewKeyManagementApi Returns NewKeyManagementApi. +func NewKeyManagementApi(client *common.APIClient) *KeyManagementApi { + return &KeyManagementApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_logs.go b/api/v2/datadog/api_logs.go new file mode 100644 index 00000000000..879098673e9 --- /dev/null +++ b/api/v2/datadog/api_logs.go @@ -0,0 +1,951 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsApi service type +type LogsApi common.Service + +type apiAggregateLogsRequest struct { + ctx _context.Context + body *LogsAggregateRequest +} + +func (a *LogsApi) buildAggregateLogsRequest(ctx _context.Context, body LogsAggregateRequest) (apiAggregateLogsRequest, error) { + req := apiAggregateLogsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// AggregateLogs Aggregate events. +// The API endpoint to aggregate events into buckets and compute metrics and timeseries. +func (a *LogsApi) AggregateLogs(ctx _context.Context, body LogsAggregateRequest) (LogsAggregateResponse, *_nethttp.Response, error) { + req, err := a.buildAggregateLogsRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsAggregateResponse + return localVarReturnValue, nil, err + } + + return a.aggregateLogsExecute(req) +} + +// aggregateLogsExecute executes the request. +func (a *LogsApi) aggregateLogsExecute(r apiAggregateLogsRequest) (LogsAggregateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue LogsAggregateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.AggregateLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/analytics/aggregate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListLogsRequest struct { + ctx _context.Context + body *LogsListRequest +} + +// ListLogsOptionalParameters holds optional parameters for ListLogs. +type ListLogsOptionalParameters struct { + Body *LogsListRequest +} + +// NewListLogsOptionalParameters creates an empty struct for parameters. +func NewListLogsOptionalParameters() *ListLogsOptionalParameters { + this := ListLogsOptionalParameters{} + return &this +} + +// WithBody sets the corresponding parameter name and returns the struct. +func (r *ListLogsOptionalParameters) WithBody(body LogsListRequest) *ListLogsOptionalParameters { + r.Body = &body + return r +} + +func (a *LogsApi) buildListLogsRequest(ctx _context.Context, o ...ListLogsOptionalParameters) (apiListLogsRequest, error) { + req := apiListLogsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListLogsOptionalParameters is allowed") + } + + if o != nil { + req.body = o[0].Body + } + return req, nil +} + +// ListLogs Search logs. +// List endpoint returns logs that match a log search query. +// [Results are paginated][1]. +// +// Use this endpoint to build complex logs filtering and search. +// +// **If you are considering archiving logs for your organization, +// consider use of the Datadog archive capabilities instead of the log list API. +// See [Datadog Logs Archive documentation][2].** +// +// [1]: /logs/guide/collect-multiple-logs-with-pagination +// [2]: https://docs.datadoghq.com/logs/archives +func (a *LogsApi) ListLogs(ctx _context.Context, o ...ListLogsOptionalParameters) (LogsListResponse, *_nethttp.Response, error) { + req, err := a.buildListLogsRequest(ctx, o...) + if err != nil { + var localVarReturnValue LogsListResponse + return localVarReturnValue, nil, err + } + + return a.listLogsExecute(req) +} + +// ListLogsWithPagination provides a paginated version of ListLogs returning a channel with all items. +func (a *LogsApi) ListLogsWithPagination(ctx _context.Context, o ...ListLogsOptionalParameters) (<-chan Log, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, ListLogsOptionalParameters{}) + } + if o[0].Body == nil { + o[0].Body = NewLogsListRequest() + } + if o[0].Body.Page == nil { + o[0].Body.Page = NewLogsListRequestPage() + } + if o[0].Body.Page.Limit != nil { + pageSize_ = *o[0].Body.Page.Limit + } + o[0].Body.Page.Limit = &pageSize_ + + items := make(chan Log, pageSize_) + go func() { + for { + req, err := a.buildListLogsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listLogsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].Body.Page.Cursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// listLogsExecute executes the request. +func (a *LogsApi) listLogsExecute(r apiListLogsRequest) (LogsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue LogsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.ListLogs") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/events/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListLogsGetRequest struct { + ctx _context.Context + filterQuery *string + filterIndex *string + filterFrom *time.Time + filterTo *time.Time + sort *LogsSort + pageCursor *string + pageLimit *int32 +} + +// ListLogsGetOptionalParameters holds optional parameters for ListLogsGet. +type ListLogsGetOptionalParameters struct { + FilterQuery *string + FilterIndex *string + FilterFrom *time.Time + FilterTo *time.Time + Sort *LogsSort + PageCursor *string + PageLimit *int32 +} + +// NewListLogsGetOptionalParameters creates an empty struct for parameters. +func NewListLogsGetOptionalParameters() *ListLogsGetOptionalParameters { + this := ListLogsGetOptionalParameters{} + return &this +} + +// WithFilterQuery sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithFilterQuery(filterQuery string) *ListLogsGetOptionalParameters { + r.FilterQuery = &filterQuery + return r +} + +// WithFilterIndex sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithFilterIndex(filterIndex string) *ListLogsGetOptionalParameters { + r.FilterIndex = &filterIndex + return r +} + +// WithFilterFrom sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListLogsGetOptionalParameters { + r.FilterFrom = &filterFrom + return r +} + +// WithFilterTo sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithFilterTo(filterTo time.Time) *ListLogsGetOptionalParameters { + r.FilterTo = &filterTo + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithSort(sort LogsSort) *ListLogsGetOptionalParameters { + r.Sort = &sort + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithPageCursor(pageCursor string) *ListLogsGetOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListLogsGetOptionalParameters) WithPageLimit(pageLimit int32) *ListLogsGetOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +func (a *LogsApi) buildListLogsGetRequest(ctx _context.Context, o ...ListLogsGetOptionalParameters) (apiListLogsGetRequest, error) { + req := apiListLogsGetRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListLogsGetOptionalParameters is allowed") + } + + if o != nil { + req.filterQuery = o[0].FilterQuery + req.filterIndex = o[0].FilterIndex + req.filterFrom = o[0].FilterFrom + req.filterTo = o[0].FilterTo + req.sort = o[0].Sort + req.pageCursor = o[0].PageCursor + req.pageLimit = o[0].PageLimit + } + return req, nil +} + +// ListLogsGet Get a list of logs. +// List endpoint returns logs that match a log search query. +// [Results are paginated][1]. +// +// Use this endpoint to see your latest logs. +// +// **If you are considering archiving logs for your organization, +// consider use of the Datadog archive capabilities instead of the log list API. +// See [Datadog Logs Archive documentation][2].** +// +// [1]: /logs/guide/collect-multiple-logs-with-pagination +// [2]: https://docs.datadoghq.com/logs/archives +func (a *LogsApi) ListLogsGet(ctx _context.Context, o ...ListLogsGetOptionalParameters) (LogsListResponse, *_nethttp.Response, error) { + req, err := a.buildListLogsGetRequest(ctx, o...) + if err != nil { + var localVarReturnValue LogsListResponse + return localVarReturnValue, nil, err + } + + return a.listLogsGetExecute(req) +} + +// ListLogsGetWithPagination provides a paginated version of ListLogsGet returning a channel with all items. +func (a *LogsApi) ListLogsGetWithPagination(ctx _context.Context, o ...ListLogsGetOptionalParameters) (<-chan Log, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, ListLogsGetOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan Log, pageSize_) + go func() { + for { + req, err := a.buildListLogsGetRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listLogsGetExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// listLogsGetExecute executes the request. +func (a *LogsApi) listLogsGetExecute(r apiListLogsGetRequest) (LogsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.ListLogsGet") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterQuery != nil { + localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) + } + if r.filterIndex != nil { + localVarQueryParams.Add("filter[index]", common.ParameterToString(*r.filterIndex, "")) + } + if r.filterFrom != nil { + localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) + } + if r.filterTo != nil { + localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.pageCursor != nil { + localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) + } + if r.pageLimit != nil { + localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSubmitLogRequest struct { + ctx _context.Context + body *[]HTTPLogItem + contentEncoding *ContentEncoding + ddtags *string +} + +// SubmitLogOptionalParameters holds optional parameters for SubmitLog. +type SubmitLogOptionalParameters struct { + ContentEncoding *ContentEncoding + Ddtags *string +} + +// NewSubmitLogOptionalParameters creates an empty struct for parameters. +func NewSubmitLogOptionalParameters() *SubmitLogOptionalParameters { + this := SubmitLogOptionalParameters{} + return &this +} + +// WithContentEncoding sets the corresponding parameter name and returns the struct. +func (r *SubmitLogOptionalParameters) WithContentEncoding(contentEncoding ContentEncoding) *SubmitLogOptionalParameters { + r.ContentEncoding = &contentEncoding + return r +} + +// WithDdtags sets the corresponding parameter name and returns the struct. +func (r *SubmitLogOptionalParameters) WithDdtags(ddtags string) *SubmitLogOptionalParameters { + r.Ddtags = &ddtags + return r +} + +func (a *LogsApi) buildSubmitLogRequest(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (apiSubmitLogRequest, error) { + req := apiSubmitLogRequest{ + ctx: ctx, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SubmitLogOptionalParameters is allowed") + } + + if o != nil { + req.contentEncoding = o[0].ContentEncoding + req.ddtags = o[0].Ddtags + } + return req, nil +} + +// SubmitLog Send logs. +// Send your logs to your Datadog platform over HTTP. Limits per HTTP request are: +// +// - Maximum content size per payload (uncompressed): 5MB +// - Maximum size for a single log: 1MB +// - Maximum array size if sending multiple logs in an array: 1000 entries +// +// Any log exceeding 1MB is accepted and truncated by Datadog: +// - For a single log request, the API truncates the log at 1MB and returns a 2xx. +// - For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx. +// +// Datadog recommends sending your logs compressed. +// Add the `Content-Encoding: gzip` header to the request when sending compressed logs. +// +// The status codes answered by the HTTP API are: +// - 202: Accepted: the request has been accepted for processing +// - 400: Bad request (likely an issue in the payload formatting) +// - 401: Unauthorized (likely a missing API Key) +// - 403: Permission issue (likely using an invalid API Key) +// - 408: Request Timeout, request should be retried after some time +// - 413: Payload too large (batch is above 5MB uncompressed) +// - 429: Too Many Requests, request should be retried after some time +// - 500: Internal Server Error, the server encountered an unexpected condition that prevented it from fulfilling the request, request should be retried after some time +// - 503: Service Unavailable, the server is not ready to handle the request probably because it is overloaded, request should be retried after some time +func (a *LogsApi) SubmitLog(ctx _context.Context, body []HTTPLogItem, o ...SubmitLogOptionalParameters) (interface{}, *_nethttp.Response, error) { + req, err := a.buildSubmitLogRequest(ctx, body, o...) + if err != nil { + var localVarReturnValue interface{} + return localVarReturnValue, nil, err + } + + return a.submitLogExecute(req) +} + +// submitLogExecute executes the request. +func (a *LogsApi) submitLogExecute(r apiSubmitLogRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsApi.SubmitLog") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + if r.ddtags != nil { + localVarQueryParams.Add("ddtags", common.ParameterToString(*r.ddtags, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + if r.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") + } + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HTTPLogErrors + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v HTTPLogErrors + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v HTTPLogErrors + 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 + } + if localVarHTTPResponse.StatusCode == 408 { + var v HTTPLogErrors + 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 + } + if localVarHTTPResponse.StatusCode == 413 { + var v HTTPLogErrors + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + var v HTTPLogErrors + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPLogErrors + 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 + } + if localVarHTTPResponse.StatusCode == 503 { + var v HTTPLogErrors + 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewLogsApi Returns NewLogsApi. +func NewLogsApi(client *common.APIClient) *LogsApi { + return &LogsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_logs_archives.go b/api/v2/datadog/api_logs_archives.go new file mode 100644 index 00000000000..e909533b3f8 --- /dev/null +++ b/api/v2/datadog/api_logs_archives.go @@ -0,0 +1,1444 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsArchivesApi service type +type LogsArchivesApi common.Service + +type apiAddReadRoleToArchiveRequest struct { + ctx _context.Context + archiveId string + body *RelationshipToRole +} + +func (a *LogsArchivesApi) buildAddReadRoleToArchiveRequest(ctx _context.Context, archiveId string, body RelationshipToRole) (apiAddReadRoleToArchiveRequest, error) { + req := apiAddReadRoleToArchiveRequest{ + ctx: ctx, + archiveId: archiveId, + body: &body, + } + return req, nil +} + +// AddReadRoleToArchive Grant role to an archive. +// Adds a read role to an archive. ([Roles API](https://docs.datadoghq.com/api/v2/roles/)) +func (a *LogsArchivesApi) AddReadRoleToArchive(ctx _context.Context, archiveId string, body RelationshipToRole) (*_nethttp.Response, error) { + req, err := a.buildAddReadRoleToArchiveRequest(ctx, archiveId, body) + if err != nil { + return nil, err + } + + return a.addReadRoleToArchiveExecute(req) +} + +// addReadRoleToArchiveExecute executes the request. +func (a *LogsArchivesApi) addReadRoleToArchiveExecute(r apiAddReadRoleToArchiveRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.AddReadRoleToArchive") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}/readers" + localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiCreateLogsArchiveRequest struct { + ctx _context.Context + body *LogsArchiveCreateRequest +} + +func (a *LogsArchivesApi) buildCreateLogsArchiveRequest(ctx _context.Context, body LogsArchiveCreateRequest) (apiCreateLogsArchiveRequest, error) { + req := apiCreateLogsArchiveRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateLogsArchive Create an archive. +// Create an archive in your organization. +func (a *LogsArchivesApi) CreateLogsArchive(ctx _context.Context, body LogsArchiveCreateRequest) (LogsArchive, *_nethttp.Response, error) { + req, err := a.buildCreateLogsArchiveRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsArchive + return localVarReturnValue, nil, err + } + + return a.createLogsArchiveExecute(req) +} + +// createLogsArchiveExecute executes the request. +func (a *LogsArchivesApi) createLogsArchiveExecute(r apiCreateLogsArchiveRequest) (LogsArchive, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue LogsArchive + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.CreateLogsArchive") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteLogsArchiveRequest struct { + ctx _context.Context + archiveId string +} + +func (a *LogsArchivesApi) buildDeleteLogsArchiveRequest(ctx _context.Context, archiveId string) (apiDeleteLogsArchiveRequest, error) { + req := apiDeleteLogsArchiveRequest{ + ctx: ctx, + archiveId: archiveId, + } + return req, nil +} + +// DeleteLogsArchive Delete an archive. +// Delete a given archive from your organization. +func (a *LogsArchivesApi) DeleteLogsArchive(ctx _context.Context, archiveId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteLogsArchiveRequest(ctx, archiveId) + if err != nil { + return nil, err + } + + return a.deleteLogsArchiveExecute(req) +} + +// deleteLogsArchiveExecute executes the request. +func (a *LogsArchivesApi) deleteLogsArchiveExecute(r apiDeleteLogsArchiveRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.DeleteLogsArchive") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}" + localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetLogsArchiveRequest struct { + ctx _context.Context + archiveId string +} + +func (a *LogsArchivesApi) buildGetLogsArchiveRequest(ctx _context.Context, archiveId string) (apiGetLogsArchiveRequest, error) { + req := apiGetLogsArchiveRequest{ + ctx: ctx, + archiveId: archiveId, + } + return req, nil +} + +// GetLogsArchive Get an archive. +// Get a specific archive from your organization. +func (a *LogsArchivesApi) GetLogsArchive(ctx _context.Context, archiveId string) (LogsArchive, *_nethttp.Response, error) { + req, err := a.buildGetLogsArchiveRequest(ctx, archiveId) + if err != nil { + var localVarReturnValue LogsArchive + return localVarReturnValue, nil, err + } + + return a.getLogsArchiveExecute(req) +} + +// getLogsArchiveExecute executes the request. +func (a *LogsArchivesApi) getLogsArchiveExecute(r apiGetLogsArchiveRequest) (LogsArchive, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsArchive + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.GetLogsArchive") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}" + localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetLogsArchiveOrderRequest struct { + ctx _context.Context +} + +func (a *LogsArchivesApi) buildGetLogsArchiveOrderRequest(ctx _context.Context) (apiGetLogsArchiveOrderRequest, error) { + req := apiGetLogsArchiveOrderRequest{ + ctx: ctx, + } + return req, nil +} + +// GetLogsArchiveOrder Get archive order. +// Get the current order of your archives. +// This endpoint takes no JSON arguments. +func (a *LogsArchivesApi) GetLogsArchiveOrder(ctx _context.Context) (LogsArchiveOrder, *_nethttp.Response, error) { + req, err := a.buildGetLogsArchiveOrderRequest(ctx) + if err != nil { + var localVarReturnValue LogsArchiveOrder + return localVarReturnValue, nil, err + } + + return a.getLogsArchiveOrderExecute(req) +} + +// getLogsArchiveOrderExecute executes the request. +func (a *LogsArchivesApi) getLogsArchiveOrderExecute(r apiGetLogsArchiveOrderRequest) (LogsArchiveOrder, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsArchiveOrder + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.GetLogsArchiveOrder") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archive-order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListArchiveReadRolesRequest struct { + ctx _context.Context + archiveId string +} + +func (a *LogsArchivesApi) buildListArchiveReadRolesRequest(ctx _context.Context, archiveId string) (apiListArchiveReadRolesRequest, error) { + req := apiListArchiveReadRolesRequest{ + ctx: ctx, + archiveId: archiveId, + } + return req, nil +} + +// ListArchiveReadRoles List read roles for an archive. +// Returns all read roles a given archive is restricted to. +func (a *LogsArchivesApi) ListArchiveReadRoles(ctx _context.Context, archiveId string) (RolesResponse, *_nethttp.Response, error) { + req, err := a.buildListArchiveReadRolesRequest(ctx, archiveId) + if err != nil { + var localVarReturnValue RolesResponse + return localVarReturnValue, nil, err + } + + return a.listArchiveReadRolesExecute(req) +} + +// listArchiveReadRolesExecute executes the request. +func (a *LogsArchivesApi) listArchiveReadRolesExecute(r apiListArchiveReadRolesRequest) (RolesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RolesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.ListArchiveReadRoles") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}/readers" + localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListLogsArchivesRequest struct { + ctx _context.Context +} + +func (a *LogsArchivesApi) buildListLogsArchivesRequest(ctx _context.Context) (apiListLogsArchivesRequest, error) { + req := apiListLogsArchivesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListLogsArchives Get all archives. +// Get the list of configured logs archives with their definitions. +func (a *LogsArchivesApi) ListLogsArchives(ctx _context.Context) (LogsArchives, *_nethttp.Response, error) { + req, err := a.buildListLogsArchivesRequest(ctx) + if err != nil { + var localVarReturnValue LogsArchives + return localVarReturnValue, nil, err + } + + return a.listLogsArchivesExecute(req) +} + +// listLogsArchivesExecute executes the request. +func (a *LogsArchivesApi) listLogsArchivesExecute(r apiListLogsArchivesRequest) (LogsArchives, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsArchives + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.ListLogsArchives") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiRemoveRoleFromArchiveRequest struct { + ctx _context.Context + archiveId string + body *RelationshipToRole +} + +func (a *LogsArchivesApi) buildRemoveRoleFromArchiveRequest(ctx _context.Context, archiveId string, body RelationshipToRole) (apiRemoveRoleFromArchiveRequest, error) { + req := apiRemoveRoleFromArchiveRequest{ + ctx: ctx, + archiveId: archiveId, + body: &body, + } + return req, nil +} + +// RemoveRoleFromArchive Revoke role from an archive. +// Removes a role from an archive. ([Roles API](https://docs.datadoghq.com/api/v2/roles/)) +func (a *LogsArchivesApi) RemoveRoleFromArchive(ctx _context.Context, archiveId string, body RelationshipToRole) (*_nethttp.Response, error) { + req, err := a.buildRemoveRoleFromArchiveRequest(ctx, archiveId, body) + if err != nil { + return nil, err + } + + return a.removeRoleFromArchiveExecute(req) +} + +// removeRoleFromArchiveExecute executes the request. +func (a *LogsArchivesApi) removeRoleFromArchiveExecute(r apiRemoveRoleFromArchiveRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.RemoveRoleFromArchive") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}/readers" + localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiUpdateLogsArchiveRequest struct { + ctx _context.Context + archiveId string + body *LogsArchiveCreateRequest +} + +func (a *LogsArchivesApi) buildUpdateLogsArchiveRequest(ctx _context.Context, archiveId string, body LogsArchiveCreateRequest) (apiUpdateLogsArchiveRequest, error) { + req := apiUpdateLogsArchiveRequest{ + ctx: ctx, + archiveId: archiveId, + body: &body, + } + return req, nil +} + +// UpdateLogsArchive Update an archive. +// Update a given archive configuration. +// +// **Note**: Using this method updates your archive configuration by **replacing** +// your current configuration with the new one sent to your Datadog organization. +func (a *LogsArchivesApi) UpdateLogsArchive(ctx _context.Context, archiveId string, body LogsArchiveCreateRequest) (LogsArchive, *_nethttp.Response, error) { + req, err := a.buildUpdateLogsArchiveRequest(ctx, archiveId, body) + if err != nil { + var localVarReturnValue LogsArchive + return localVarReturnValue, nil, err + } + + return a.updateLogsArchiveExecute(req) +} + +// updateLogsArchiveExecute executes the request. +func (a *LogsArchivesApi) updateLogsArchiveExecute(r apiUpdateLogsArchiveRequest) (LogsArchive, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue LogsArchive + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.UpdateLogsArchive") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archives/{archive_id}" + localVarPath = strings.Replace(localVarPath, "{"+"archive_id"+"}", _neturl.PathEscape(common.ParameterToString(r.archiveId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateLogsArchiveOrderRequest struct { + ctx _context.Context + body *LogsArchiveOrder +} + +func (a *LogsArchivesApi) buildUpdateLogsArchiveOrderRequest(ctx _context.Context, body LogsArchiveOrder) (apiUpdateLogsArchiveOrderRequest, error) { + req := apiUpdateLogsArchiveOrderRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// UpdateLogsArchiveOrder Update archive order. +// Update the order of your archives. Since logs are processed sequentially, reordering an archive may change +// the structure and content of the data processed by other archives. +// +// **Note**: Using the `PUT` method updates your archive's order by replacing the current order +// with the new one. +func (a *LogsArchivesApi) UpdateLogsArchiveOrder(ctx _context.Context, body LogsArchiveOrder) (LogsArchiveOrder, *_nethttp.Response, error) { + req, err := a.buildUpdateLogsArchiveOrderRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsArchiveOrder + return localVarReturnValue, nil, err + } + + return a.updateLogsArchiveOrderExecute(req) +} + +// updateLogsArchiveOrderExecute executes the request. +func (a *LogsArchivesApi) updateLogsArchiveOrderExecute(r apiUpdateLogsArchiveOrderRequest) (LogsArchiveOrder, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue LogsArchiveOrder + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsArchivesApi.UpdateLogsArchiveOrder") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/archive-order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 422 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewLogsArchivesApi Returns NewLogsArchivesApi. +func NewLogsArchivesApi(client *common.APIClient) *LogsArchivesApi { + return &LogsArchivesApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_logs_metrics.go b/api/v2/datadog/api_logs_metrics.go new file mode 100644 index 00000000000..63544c60766 --- /dev/null +++ b/api/v2/datadog/api_logs_metrics.go @@ -0,0 +1,721 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsMetricsApi service type +type LogsMetricsApi common.Service + +type apiCreateLogsMetricRequest struct { + ctx _context.Context + body *LogsMetricCreateRequest +} + +func (a *LogsMetricsApi) buildCreateLogsMetricRequest(ctx _context.Context, body LogsMetricCreateRequest) (apiCreateLogsMetricRequest, error) { + req := apiCreateLogsMetricRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateLogsMetric Create a log-based metric. +// Create a metric based on your ingested logs in your organization. +// Returns the log-based metric object from the request body when the request is successful. +func (a *LogsMetricsApi) CreateLogsMetric(ctx _context.Context, body LogsMetricCreateRequest) (LogsMetricResponse, *_nethttp.Response, error) { + req, err := a.buildCreateLogsMetricRequest(ctx, body) + if err != nil { + var localVarReturnValue LogsMetricResponse + return localVarReturnValue, nil, err + } + + return a.createLogsMetricExecute(req) +} + +// createLogsMetricExecute executes the request. +func (a *LogsMetricsApi) createLogsMetricExecute(r apiCreateLogsMetricRequest) (LogsMetricResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue LogsMetricResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.CreateLogsMetric") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/metrics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteLogsMetricRequest struct { + ctx _context.Context + metricId string +} + +func (a *LogsMetricsApi) buildDeleteLogsMetricRequest(ctx _context.Context, metricId string) (apiDeleteLogsMetricRequest, error) { + req := apiDeleteLogsMetricRequest{ + ctx: ctx, + metricId: metricId, + } + return req, nil +} + +// DeleteLogsMetric Delete a log-based metric. +// Delete a specific log-based metric from your organization. +func (a *LogsMetricsApi) DeleteLogsMetric(ctx _context.Context, metricId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteLogsMetricRequest(ctx, metricId) + if err != nil { + return nil, err + } + + return a.deleteLogsMetricExecute(req) +} + +// deleteLogsMetricExecute executes the request. +func (a *LogsMetricsApi) deleteLogsMetricExecute(r apiDeleteLogsMetricRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.DeleteLogsMetric") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/metrics/{metric_id}" + localVarPath = strings.Replace(localVarPath, "{"+"metric_id"+"}", _neturl.PathEscape(common.ParameterToString(r.metricId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetLogsMetricRequest struct { + ctx _context.Context + metricId string +} + +func (a *LogsMetricsApi) buildGetLogsMetricRequest(ctx _context.Context, metricId string) (apiGetLogsMetricRequest, error) { + req := apiGetLogsMetricRequest{ + ctx: ctx, + metricId: metricId, + } + return req, nil +} + +// GetLogsMetric Get a log-based metric. +// Get a specific log-based metric from your organization. +func (a *LogsMetricsApi) GetLogsMetric(ctx _context.Context, metricId string) (LogsMetricResponse, *_nethttp.Response, error) { + req, err := a.buildGetLogsMetricRequest(ctx, metricId) + if err != nil { + var localVarReturnValue LogsMetricResponse + return localVarReturnValue, nil, err + } + + return a.getLogsMetricExecute(req) +} + +// getLogsMetricExecute executes the request. +func (a *LogsMetricsApi) getLogsMetricExecute(r apiGetLogsMetricRequest) (LogsMetricResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsMetricResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.GetLogsMetric") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/metrics/{metric_id}" + localVarPath = strings.Replace(localVarPath, "{"+"metric_id"+"}", _neturl.PathEscape(common.ParameterToString(r.metricId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListLogsMetricsRequest struct { + ctx _context.Context +} + +func (a *LogsMetricsApi) buildListLogsMetricsRequest(ctx _context.Context) (apiListLogsMetricsRequest, error) { + req := apiListLogsMetricsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListLogsMetrics Get all log-based metrics. +// Get the list of configured log-based metrics with their definitions. +func (a *LogsMetricsApi) ListLogsMetrics(ctx _context.Context) (LogsMetricsResponse, *_nethttp.Response, error) { + req, err := a.buildListLogsMetricsRequest(ctx) + if err != nil { + var localVarReturnValue LogsMetricsResponse + return localVarReturnValue, nil, err + } + + return a.listLogsMetricsExecute(req) +} + +// listLogsMetricsExecute executes the request. +func (a *LogsMetricsApi) listLogsMetricsExecute(r apiListLogsMetricsRequest) (LogsMetricsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LogsMetricsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.ListLogsMetrics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/metrics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateLogsMetricRequest struct { + ctx _context.Context + metricId string + body *LogsMetricUpdateRequest +} + +func (a *LogsMetricsApi) buildUpdateLogsMetricRequest(ctx _context.Context, metricId string, body LogsMetricUpdateRequest) (apiUpdateLogsMetricRequest, error) { + req := apiUpdateLogsMetricRequest{ + ctx: ctx, + metricId: metricId, + body: &body, + } + return req, nil +} + +// UpdateLogsMetric Update a log-based metric. +// Update a specific log-based metric from your organization. +// Returns the log-based metric object from the request body when the request is successful. +func (a *LogsMetricsApi) UpdateLogsMetric(ctx _context.Context, metricId string, body LogsMetricUpdateRequest) (LogsMetricResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateLogsMetricRequest(ctx, metricId, body) + if err != nil { + var localVarReturnValue LogsMetricResponse + return localVarReturnValue, nil, err + } + + return a.updateLogsMetricExecute(req) +} + +// updateLogsMetricExecute executes the request. +func (a *LogsMetricsApi) updateLogsMetricExecute(r apiUpdateLogsMetricRequest) (LogsMetricResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue LogsMetricResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.LogsMetricsApi.UpdateLogsMetric") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/metrics/{metric_id}" + localVarPath = strings.Replace(localVarPath, "{"+"metric_id"+"}", _neturl.PathEscape(common.ParameterToString(r.metricId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewLogsMetricsApi Returns NewLogsMetricsApi. +func NewLogsMetricsApi(client *common.APIClient) *LogsMetricsApi { + return &LogsMetricsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_metrics.go b/api/v2/datadog/api_metrics.go new file mode 100644 index 00000000000..804b7b90b66 --- /dev/null +++ b/api/v2/datadog/api_metrics.go @@ -0,0 +1,1841 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// MetricsApi service type +type MetricsApi common.Service + +type apiCreateBulkTagsMetricsConfigurationRequest struct { + ctx _context.Context + body *MetricBulkTagConfigCreateRequest +} + +func (a *MetricsApi) buildCreateBulkTagsMetricsConfigurationRequest(ctx _context.Context, body MetricBulkTagConfigCreateRequest) (apiCreateBulkTagsMetricsConfigurationRequest, error) { + req := apiCreateBulkTagsMetricsConfigurationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateBulkTagsMetricsConfiguration Configure tags for multiple metrics. +// Create and define a list of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. +// Metrics are selected by passing a metric name prefix. Use the Delete method of this API path to remove tag configurations. +// Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. +// If multiple calls include the same metric, the last configuration applied (not by submit order) is used, do not +// expect deterministic ordering of concurrent calls. +// Can only be used with application keys of users with the `Manage Tags for Metrics` permission. +func (a *MetricsApi) CreateBulkTagsMetricsConfiguration(ctx _context.Context, body MetricBulkTagConfigCreateRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { + req, err := a.buildCreateBulkTagsMetricsConfigurationRequest(ctx, body) + if err != nil { + var localVarReturnValue MetricBulkTagConfigResponse + return localVarReturnValue, nil, err + } + + return a.createBulkTagsMetricsConfigurationExecute(req) +} + +// createBulkTagsMetricsConfigurationExecute executes the request. +func (a *MetricsApi) createBulkTagsMetricsConfigurationExecute(r apiCreateBulkTagsMetricsConfigurationRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue MetricBulkTagConfigResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.CreateBulkTagsMetricsConfiguration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/config/bulk-tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateTagConfigurationRequest struct { + ctx _context.Context + metricName string + body *MetricTagConfigurationCreateRequest +} + +func (a *MetricsApi) buildCreateTagConfigurationRequest(ctx _context.Context, metricName string, body MetricTagConfigurationCreateRequest) (apiCreateTagConfigurationRequest, error) { + req := apiCreateTagConfigurationRequest{ + ctx: ctx, + metricName: metricName, + body: &body, + } + return req, nil +} + +// CreateTagConfiguration Create a tag configuration. +// Create and define a list of queryable tag keys for an existing count/gauge/rate/distribution metric. +// Optionally, include percentile aggregations on any distribution metric or configure custom aggregations +// on any count, rate, or gauge metric. +// Can only be used with application keys of users with the `Manage Tags for Metrics` permission. +func (a *MetricsApi) CreateTagConfiguration(ctx _context.Context, metricName string, body MetricTagConfigurationCreateRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { + req, err := a.buildCreateTagConfigurationRequest(ctx, metricName, body) + if err != nil { + var localVarReturnValue MetricTagConfigurationResponse + return localVarReturnValue, nil, err + } + + return a.createTagConfigurationExecute(req) +} + +// createTagConfigurationExecute executes the request. +func (a *MetricsApi) createTagConfigurationExecute(r apiCreateTagConfigurationRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue MetricTagConfigurationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.CreateTagConfiguration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteBulkTagsMetricsConfigurationRequest struct { + ctx _context.Context + body *MetricBulkTagConfigDeleteRequest +} + +func (a *MetricsApi) buildDeleteBulkTagsMetricsConfigurationRequest(ctx _context.Context, body MetricBulkTagConfigDeleteRequest) (apiDeleteBulkTagsMetricsConfigurationRequest, error) { + req := apiDeleteBulkTagsMetricsConfigurationRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// DeleteBulkTagsMetricsConfiguration Configure tags for multiple metrics. +// Delete all custom lists of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. +// Metrics are selected by passing a metric name prefix. +// Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. +// Can only be used with application keys of users with the `Manage Tags for Metrics` permission. +func (a *MetricsApi) DeleteBulkTagsMetricsConfiguration(ctx _context.Context, body MetricBulkTagConfigDeleteRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { + req, err := a.buildDeleteBulkTagsMetricsConfigurationRequest(ctx, body) + if err != nil { + var localVarReturnValue MetricBulkTagConfigResponse + return localVarReturnValue, nil, err + } + + return a.deleteBulkTagsMetricsConfigurationExecute(req) +} + +// deleteBulkTagsMetricsConfigurationExecute executes the request. +func (a *MetricsApi) deleteBulkTagsMetricsConfigurationExecute(r apiDeleteBulkTagsMetricsConfigurationRequest) (MetricBulkTagConfigResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue MetricBulkTagConfigResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.DeleteBulkTagsMetricsConfiguration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/config/bulk-tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteTagConfigurationRequest struct { + ctx _context.Context + metricName string +} + +func (a *MetricsApi) buildDeleteTagConfigurationRequest(ctx _context.Context, metricName string) (apiDeleteTagConfigurationRequest, error) { + req := apiDeleteTagConfigurationRequest{ + ctx: ctx, + metricName: metricName, + } + return req, nil +} + +// DeleteTagConfiguration Delete a tag configuration. +// Deletes a metric's tag configuration. Can only be used with application +// keys from users with the `Manage Tags for Metrics` permission. +func (a *MetricsApi) DeleteTagConfiguration(ctx _context.Context, metricName string) (*_nethttp.Response, error) { + req, err := a.buildDeleteTagConfigurationRequest(ctx, metricName) + if err != nil { + return nil, err + } + + return a.deleteTagConfigurationExecute(req) +} + +// deleteTagConfigurationExecute executes the request. +func (a *MetricsApi) deleteTagConfigurationExecute(r apiDeleteTagConfigurationRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.DeleteTagConfiguration") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiEstimateMetricsOutputSeriesRequest struct { + ctx _context.Context + metricName string + filterGroups *string + filterHoursAgo *int32 + filterNumAggregations *int32 + filterPct *bool + filterTimespanH *int32 +} + +// EstimateMetricsOutputSeriesOptionalParameters holds optional parameters for EstimateMetricsOutputSeries. +type EstimateMetricsOutputSeriesOptionalParameters struct { + FilterGroups *string + FilterHoursAgo *int32 + FilterNumAggregations *int32 + FilterPct *bool + FilterTimespanH *int32 +} + +// NewEstimateMetricsOutputSeriesOptionalParameters creates an empty struct for parameters. +func NewEstimateMetricsOutputSeriesOptionalParameters() *EstimateMetricsOutputSeriesOptionalParameters { + this := EstimateMetricsOutputSeriesOptionalParameters{} + return &this +} + +// WithFilterGroups sets the corresponding parameter name and returns the struct. +func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterGroups(filterGroups string) *EstimateMetricsOutputSeriesOptionalParameters { + r.FilterGroups = &filterGroups + return r +} + +// WithFilterHoursAgo sets the corresponding parameter name and returns the struct. +func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterHoursAgo(filterHoursAgo int32) *EstimateMetricsOutputSeriesOptionalParameters { + r.FilterHoursAgo = &filterHoursAgo + return r +} + +// WithFilterNumAggregations sets the corresponding parameter name and returns the struct. +func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterNumAggregations(filterNumAggregations int32) *EstimateMetricsOutputSeriesOptionalParameters { + r.FilterNumAggregations = &filterNumAggregations + return r +} + +// WithFilterPct sets the corresponding parameter name and returns the struct. +func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterPct(filterPct bool) *EstimateMetricsOutputSeriesOptionalParameters { + r.FilterPct = &filterPct + return r +} + +// WithFilterTimespanH sets the corresponding parameter name and returns the struct. +func (r *EstimateMetricsOutputSeriesOptionalParameters) WithFilterTimespanH(filterTimespanH int32) *EstimateMetricsOutputSeriesOptionalParameters { + r.FilterTimespanH = &filterTimespanH + return r +} + +func (a *MetricsApi) buildEstimateMetricsOutputSeriesRequest(ctx _context.Context, metricName string, o ...EstimateMetricsOutputSeriesOptionalParameters) (apiEstimateMetricsOutputSeriesRequest, error) { + req := apiEstimateMetricsOutputSeriesRequest{ + ctx: ctx, + metricName: metricName, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type EstimateMetricsOutputSeriesOptionalParameters is allowed") + } + + if o != nil { + req.filterGroups = o[0].FilterGroups + req.filterHoursAgo = o[0].FilterHoursAgo + req.filterNumAggregations = o[0].FilterNumAggregations + req.filterPct = o[0].FilterPct + req.filterTimespanH = o[0].FilterTimespanH + } + return req, nil +} + +// EstimateMetricsOutputSeries Tag Configuration Cardinality Estimator. +// Returns the estimated cardinality for a metric with a given tag, percentile and number of aggregations configuration using Metrics without Limits™. +func (a *MetricsApi) EstimateMetricsOutputSeries(ctx _context.Context, metricName string, o ...EstimateMetricsOutputSeriesOptionalParameters) (MetricEstimateResponse, *_nethttp.Response, error) { + req, err := a.buildEstimateMetricsOutputSeriesRequest(ctx, metricName, o...) + if err != nil { + var localVarReturnValue MetricEstimateResponse + return localVarReturnValue, nil, err + } + + return a.estimateMetricsOutputSeriesExecute(req) +} + +// estimateMetricsOutputSeriesExecute executes the request. +func (a *MetricsApi) estimateMetricsOutputSeriesExecute(r apiEstimateMetricsOutputSeriesRequest) (MetricEstimateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricEstimateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.EstimateMetricsOutputSeries") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/estimate" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterGroups != nil { + localVarQueryParams.Add("filter[groups]", common.ParameterToString(*r.filterGroups, "")) + } + if r.filterHoursAgo != nil { + localVarQueryParams.Add("filter[hours_ago]", common.ParameterToString(*r.filterHoursAgo, "")) + } + if r.filterNumAggregations != nil { + localVarQueryParams.Add("filter[num_aggregations]", common.ParameterToString(*r.filterNumAggregations, "")) + } + if r.filterPct != nil { + localVarQueryParams.Add("filter[pct]", common.ParameterToString(*r.filterPct, "")) + } + if r.filterTimespanH != nil { + localVarQueryParams.Add("filter[timespan_h]", common.ParameterToString(*r.filterTimespanH, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListTagConfigurationByNameRequest struct { + ctx _context.Context + metricName string +} + +func (a *MetricsApi) buildListTagConfigurationByNameRequest(ctx _context.Context, metricName string) (apiListTagConfigurationByNameRequest, error) { + req := apiListTagConfigurationByNameRequest{ + ctx: ctx, + metricName: metricName, + } + return req, nil +} + +// ListTagConfigurationByName List tag configuration by name. +// Returns the tag configuration for the given metric name. +func (a *MetricsApi) ListTagConfigurationByName(ctx _context.Context, metricName string) (MetricTagConfigurationResponse, *_nethttp.Response, error) { + req, err := a.buildListTagConfigurationByNameRequest(ctx, metricName) + if err != nil { + var localVarReturnValue MetricTagConfigurationResponse + return localVarReturnValue, nil, err + } + + return a.listTagConfigurationByNameExecute(req) +} + +// listTagConfigurationByNameExecute executes the request. +func (a *MetricsApi) listTagConfigurationByNameExecute(r apiListTagConfigurationByNameRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricTagConfigurationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListTagConfigurationByName") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListTagConfigurationsRequest struct { + ctx _context.Context + filterConfigured *bool + filterTagsConfigured *string + filterMetricType *MetricTagConfigurationMetricTypes + filterIncludePercentiles *bool + filterTags *string + windowSeconds *int64 +} + +// ListTagConfigurationsOptionalParameters holds optional parameters for ListTagConfigurations. +type ListTagConfigurationsOptionalParameters struct { + FilterConfigured *bool + FilterTagsConfigured *string + FilterMetricType *MetricTagConfigurationMetricTypes + FilterIncludePercentiles *bool + FilterTags *string + WindowSeconds *int64 +} + +// NewListTagConfigurationsOptionalParameters creates an empty struct for parameters. +func NewListTagConfigurationsOptionalParameters() *ListTagConfigurationsOptionalParameters { + this := ListTagConfigurationsOptionalParameters{} + return &this +} + +// WithFilterConfigured sets the corresponding parameter name and returns the struct. +func (r *ListTagConfigurationsOptionalParameters) WithFilterConfigured(filterConfigured bool) *ListTagConfigurationsOptionalParameters { + r.FilterConfigured = &filterConfigured + return r +} + +// WithFilterTagsConfigured sets the corresponding parameter name and returns the struct. +func (r *ListTagConfigurationsOptionalParameters) WithFilterTagsConfigured(filterTagsConfigured string) *ListTagConfigurationsOptionalParameters { + r.FilterTagsConfigured = &filterTagsConfigured + return r +} + +// WithFilterMetricType sets the corresponding parameter name and returns the struct. +func (r *ListTagConfigurationsOptionalParameters) WithFilterMetricType(filterMetricType MetricTagConfigurationMetricTypes) *ListTagConfigurationsOptionalParameters { + r.FilterMetricType = &filterMetricType + return r +} + +// WithFilterIncludePercentiles sets the corresponding parameter name and returns the struct. +func (r *ListTagConfigurationsOptionalParameters) WithFilterIncludePercentiles(filterIncludePercentiles bool) *ListTagConfigurationsOptionalParameters { + r.FilterIncludePercentiles = &filterIncludePercentiles + return r +} + +// WithFilterTags sets the corresponding parameter name and returns the struct. +func (r *ListTagConfigurationsOptionalParameters) WithFilterTags(filterTags string) *ListTagConfigurationsOptionalParameters { + r.FilterTags = &filterTags + return r +} + +// WithWindowSeconds sets the corresponding parameter name and returns the struct. +func (r *ListTagConfigurationsOptionalParameters) WithWindowSeconds(windowSeconds int64) *ListTagConfigurationsOptionalParameters { + r.WindowSeconds = &windowSeconds + return r +} + +func (a *MetricsApi) buildListTagConfigurationsRequest(ctx _context.Context, o ...ListTagConfigurationsOptionalParameters) (apiListTagConfigurationsRequest, error) { + req := apiListTagConfigurationsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListTagConfigurationsOptionalParameters is allowed") + } + + if o != nil { + req.filterConfigured = o[0].FilterConfigured + req.filterTagsConfigured = o[0].FilterTagsConfigured + req.filterMetricType = o[0].FilterMetricType + req.filterIncludePercentiles = o[0].FilterIncludePercentiles + req.filterTags = o[0].FilterTags + req.windowSeconds = o[0].WindowSeconds + } + return req, nil +} + +// ListTagConfigurations List tag configurations. +// Returns all configured count/gauge/rate/distribution metric names +// (with additional filters if specified). +func (a *MetricsApi) ListTagConfigurations(ctx _context.Context, o ...ListTagConfigurationsOptionalParameters) (MetricsAndMetricTagConfigurationsResponse, *_nethttp.Response, error) { + req, err := a.buildListTagConfigurationsRequest(ctx, o...) + if err != nil { + var localVarReturnValue MetricsAndMetricTagConfigurationsResponse + return localVarReturnValue, nil, err + } + + return a.listTagConfigurationsExecute(req) +} + +// listTagConfigurationsExecute executes the request. +func (a *MetricsApi) listTagConfigurationsExecute(r apiListTagConfigurationsRequest) (MetricsAndMetricTagConfigurationsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricsAndMetricTagConfigurationsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListTagConfigurations") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterConfigured != nil { + localVarQueryParams.Add("filter[configured]", common.ParameterToString(*r.filterConfigured, "")) + } + if r.filterTagsConfigured != nil { + localVarQueryParams.Add("filter[tags_configured]", common.ParameterToString(*r.filterTagsConfigured, "")) + } + if r.filterMetricType != nil { + localVarQueryParams.Add("filter[metric_type]", common.ParameterToString(*r.filterMetricType, "")) + } + if r.filterIncludePercentiles != nil { + localVarQueryParams.Add("filter[include_percentiles]", common.ParameterToString(*r.filterIncludePercentiles, "")) + } + if r.filterTags != nil { + localVarQueryParams.Add("filter[tags]", common.ParameterToString(*r.filterTags, "")) + } + if r.windowSeconds != nil { + localVarQueryParams.Add("window[seconds]", common.ParameterToString(*r.windowSeconds, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListTagsByMetricNameRequest struct { + ctx _context.Context + metricName string +} + +func (a *MetricsApi) buildListTagsByMetricNameRequest(ctx _context.Context, metricName string) (apiListTagsByMetricNameRequest, error) { + req := apiListTagsByMetricNameRequest{ + ctx: ctx, + metricName: metricName, + } + return req, nil +} + +// ListTagsByMetricName List tags by metric name. +// View indexed tag key-value pairs for a given metric name. +func (a *MetricsApi) ListTagsByMetricName(ctx _context.Context, metricName string) (MetricAllTagsResponse, *_nethttp.Response, error) { + req, err := a.buildListTagsByMetricNameRequest(ctx, metricName) + if err != nil { + var localVarReturnValue MetricAllTagsResponse + return localVarReturnValue, nil, err + } + + return a.listTagsByMetricNameExecute(req) +} + +// listTagsByMetricNameExecute executes the request. +func (a *MetricsApi) listTagsByMetricNameExecute(r apiListTagsByMetricNameRequest) (MetricAllTagsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricAllTagsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListTagsByMetricName") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/all-tags" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListVolumesByMetricNameRequest struct { + ctx _context.Context + metricName string +} + +func (a *MetricsApi) buildListVolumesByMetricNameRequest(ctx _context.Context, metricName string) (apiListVolumesByMetricNameRequest, error) { + req := apiListVolumesByMetricNameRequest{ + ctx: ctx, + metricName: metricName, + } + return req, nil +} + +// ListVolumesByMetricName List distinct metric volumes by metric name. +// View distinct metrics volumes for the given metric name. +// +// Custom metrics generated in-app from other products will return `null` for ingested volumes. +func (a *MetricsApi) ListVolumesByMetricName(ctx _context.Context, metricName string) (MetricVolumesResponse, *_nethttp.Response, error) { + req, err := a.buildListVolumesByMetricNameRequest(ctx, metricName) + if err != nil { + var localVarReturnValue MetricVolumesResponse + return localVarReturnValue, nil, err + } + + return a.listVolumesByMetricNameExecute(req) +} + +// listVolumesByMetricNameExecute executes the request. +func (a *MetricsApi) listVolumesByMetricNameExecute(r apiListVolumesByMetricNameRequest) (MetricVolumesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MetricVolumesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.ListVolumesByMetricName") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSubmitMetricsRequest struct { + ctx _context.Context + body *MetricPayload + contentEncoding *MetricContentEncoding +} + +// SubmitMetricsOptionalParameters holds optional parameters for SubmitMetrics. +type SubmitMetricsOptionalParameters struct { + ContentEncoding *MetricContentEncoding +} + +// NewSubmitMetricsOptionalParameters creates an empty struct for parameters. +func NewSubmitMetricsOptionalParameters() *SubmitMetricsOptionalParameters { + this := SubmitMetricsOptionalParameters{} + return &this +} + +// WithContentEncoding sets the corresponding parameter name and returns the struct. +func (r *SubmitMetricsOptionalParameters) WithContentEncoding(contentEncoding MetricContentEncoding) *SubmitMetricsOptionalParameters { + r.ContentEncoding = &contentEncoding + return r +} + +func (a *MetricsApi) buildSubmitMetricsRequest(ctx _context.Context, body MetricPayload, o ...SubmitMetricsOptionalParameters) (apiSubmitMetricsRequest, error) { + req := apiSubmitMetricsRequest{ + ctx: ctx, + body: &body, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SubmitMetricsOptionalParameters is allowed") + } + + if o != nil { + req.contentEncoding = o[0].ContentEncoding + } + return req, nil +} + +// SubmitMetrics Submit metrics. +// The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. +// The maximum payload size is 500 kilobytes (512000 bytes). Compressed payloads must have a decompressed size of less than 5 megabytes (5242880 bytes). +// +// If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect: +// +// - 64 bits for the timestamp +// - 64 bits for the value +// - 20 bytes for the metric names +// - 50 bytes for the timeseries +// - The full payload is approximately 100 bytes. +// +// Host name is one of the resources in the Resources field. +func (a *MetricsApi) SubmitMetrics(ctx _context.Context, body MetricPayload, o ...SubmitMetricsOptionalParameters) (IntakePayloadAccepted, *_nethttp.Response, error) { + req, err := a.buildSubmitMetricsRequest(ctx, body, o...) + if err != nil { + var localVarReturnValue IntakePayloadAccepted + return localVarReturnValue, nil, err + } + + return a.submitMetricsExecute(req) +} + +// submitMetricsExecute executes the request. +func (a *MetricsApi) submitMetricsExecute(r apiSubmitMetricsRequest) (IntakePayloadAccepted, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IntakePayloadAccepted + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.SubmitMetrics") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/series" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + if r.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = common.ParameterToString(*r.contentEncoding, "") + } + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 408 { + 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 + } + if localVarHTTPResponse.StatusCode == 413 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateTagConfigurationRequest struct { + ctx _context.Context + metricName string + body *MetricTagConfigurationUpdateRequest +} + +func (a *MetricsApi) buildUpdateTagConfigurationRequest(ctx _context.Context, metricName string, body MetricTagConfigurationUpdateRequest) (apiUpdateTagConfigurationRequest, error) { + req := apiUpdateTagConfigurationRequest{ + ctx: ctx, + metricName: metricName, + body: &body, + } + return req, nil +} + +// UpdateTagConfiguration Update a tag configuration. +// Update the tag configuration of a metric or percentile aggregations of a distribution metric or custom aggregations +// of a count, rate, or gauge metric. +// Can only be used with application keys from users with the `Manage Tags for Metrics` permission. +func (a *MetricsApi) UpdateTagConfiguration(ctx _context.Context, metricName string, body MetricTagConfigurationUpdateRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateTagConfigurationRequest(ctx, metricName, body) + if err != nil { + var localVarReturnValue MetricTagConfigurationResponse + return localVarReturnValue, nil, err + } + + return a.updateTagConfigurationExecute(req) +} + +// updateTagConfigurationExecute executes the request. +func (a *MetricsApi) updateTagConfigurationExecute(r apiUpdateTagConfigurationRequest) (MetricTagConfigurationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue MetricTagConfigurationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.MetricsApi.UpdateTagConfiguration") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/metrics/{metric_name}/tags" + localVarPath = strings.Replace(localVarPath, "{"+"metric_name"+"}", _neturl.PathEscape(common.ParameterToString(r.metricName, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 422 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewMetricsApi Returns NewMetricsApi. +func NewMetricsApi(client *common.APIClient) *MetricsApi { + return &MetricsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_opsgenie_integration.go b/api/v2/datadog/api_opsgenie_integration.go new file mode 100644 index 00000000000..307940b7638 --- /dev/null +++ b/api/v2/datadog/api_opsgenie_integration.go @@ -0,0 +1,755 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// OpsgenieIntegrationApi service type +type OpsgenieIntegrationApi common.Service + +type apiCreateOpsgenieServiceRequest struct { + ctx _context.Context + body *OpsgenieServiceCreateRequest +} + +func (a *OpsgenieIntegrationApi) buildCreateOpsgenieServiceRequest(ctx _context.Context, body OpsgenieServiceCreateRequest) (apiCreateOpsgenieServiceRequest, error) { + req := apiCreateOpsgenieServiceRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateOpsgenieService Create a new service object. +// Create a new service object in the Opsgenie integration. +func (a *OpsgenieIntegrationApi) CreateOpsgenieService(ctx _context.Context, body OpsgenieServiceCreateRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { + req, err := a.buildCreateOpsgenieServiceRequest(ctx, body) + if err != nil { + var localVarReturnValue OpsgenieServiceResponse + return localVarReturnValue, nil, err + } + + return a.createOpsgenieServiceExecute(req) +} + +// createOpsgenieServiceExecute executes the request. +func (a *OpsgenieIntegrationApi) createOpsgenieServiceExecute(r apiCreateOpsgenieServiceRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue OpsgenieServiceResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.CreateOpsgenieService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/opsgenie/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteOpsgenieServiceRequest struct { + ctx _context.Context + integrationServiceId string +} + +func (a *OpsgenieIntegrationApi) buildDeleteOpsgenieServiceRequest(ctx _context.Context, integrationServiceId string) (apiDeleteOpsgenieServiceRequest, error) { + req := apiDeleteOpsgenieServiceRequest{ + ctx: ctx, + integrationServiceId: integrationServiceId, + } + return req, nil +} + +// DeleteOpsgenieService Delete a single service object. +// Delete a single service object in the Datadog Opsgenie integration. +func (a *OpsgenieIntegrationApi) DeleteOpsgenieService(ctx _context.Context, integrationServiceId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteOpsgenieServiceRequest(ctx, integrationServiceId) + if err != nil { + return nil, err + } + + return a.deleteOpsgenieServiceExecute(req) +} + +// deleteOpsgenieServiceExecute executes the request. +func (a *OpsgenieIntegrationApi) deleteOpsgenieServiceExecute(r apiDeleteOpsgenieServiceRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.DeleteOpsgenieService") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/opsgenie/services/{integration_service_id}" + localVarPath = strings.Replace(localVarPath, "{"+"integration_service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.integrationServiceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetOpsgenieServiceRequest struct { + ctx _context.Context + integrationServiceId string +} + +func (a *OpsgenieIntegrationApi) buildGetOpsgenieServiceRequest(ctx _context.Context, integrationServiceId string) (apiGetOpsgenieServiceRequest, error) { + req := apiGetOpsgenieServiceRequest{ + ctx: ctx, + integrationServiceId: integrationServiceId, + } + return req, nil +} + +// GetOpsgenieService Get a single service object. +// Get a single service from the Datadog Opsgenie integration. +func (a *OpsgenieIntegrationApi) GetOpsgenieService(ctx _context.Context, integrationServiceId string) (OpsgenieServiceResponse, *_nethttp.Response, error) { + req, err := a.buildGetOpsgenieServiceRequest(ctx, integrationServiceId) + if err != nil { + var localVarReturnValue OpsgenieServiceResponse + return localVarReturnValue, nil, err + } + + return a.getOpsgenieServiceExecute(req) +} + +// getOpsgenieServiceExecute executes the request. +func (a *OpsgenieIntegrationApi) getOpsgenieServiceExecute(r apiGetOpsgenieServiceRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OpsgenieServiceResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.GetOpsgenieService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/opsgenie/services/{integration_service_id}" + localVarPath = strings.Replace(localVarPath, "{"+"integration_service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.integrationServiceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListOpsgenieServicesRequest struct { + ctx _context.Context +} + +func (a *OpsgenieIntegrationApi) buildListOpsgenieServicesRequest(ctx _context.Context) (apiListOpsgenieServicesRequest, error) { + req := apiListOpsgenieServicesRequest{ + ctx: ctx, + } + return req, nil +} + +// ListOpsgenieServices Get all service objects. +// Get a list of all services from the Datadog Opsgenie integration. +func (a *OpsgenieIntegrationApi) ListOpsgenieServices(ctx _context.Context) (OpsgenieServicesResponse, *_nethttp.Response, error) { + req, err := a.buildListOpsgenieServicesRequest(ctx) + if err != nil { + var localVarReturnValue OpsgenieServicesResponse + return localVarReturnValue, nil, err + } + + return a.listOpsgenieServicesExecute(req) +} + +// listOpsgenieServicesExecute executes the request. +func (a *OpsgenieIntegrationApi) listOpsgenieServicesExecute(r apiListOpsgenieServicesRequest) (OpsgenieServicesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OpsgenieServicesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.ListOpsgenieServices") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/opsgenie/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateOpsgenieServiceRequest struct { + ctx _context.Context + integrationServiceId string + body *OpsgenieServiceUpdateRequest +} + +func (a *OpsgenieIntegrationApi) buildUpdateOpsgenieServiceRequest(ctx _context.Context, integrationServiceId string, body OpsgenieServiceUpdateRequest) (apiUpdateOpsgenieServiceRequest, error) { + req := apiUpdateOpsgenieServiceRequest{ + ctx: ctx, + integrationServiceId: integrationServiceId, + body: &body, + } + return req, nil +} + +// UpdateOpsgenieService Update a single service object. +// Update a single service object in the Datadog Opsgenie integration. +func (a *OpsgenieIntegrationApi) UpdateOpsgenieService(ctx _context.Context, integrationServiceId string, body OpsgenieServiceUpdateRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateOpsgenieServiceRequest(ctx, integrationServiceId, body) + if err != nil { + var localVarReturnValue OpsgenieServiceResponse + return localVarReturnValue, nil, err + } + + return a.updateOpsgenieServiceExecute(req) +} + +// updateOpsgenieServiceExecute executes the request. +func (a *OpsgenieIntegrationApi) updateOpsgenieServiceExecute(r apiUpdateOpsgenieServiceRequest) (OpsgenieServiceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue OpsgenieServiceResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OpsgenieIntegrationApi.UpdateOpsgenieService") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/opsgenie/services/{integration_service_id}" + localVarPath = strings.Replace(localVarPath, "{"+"integration_service_id"+"}", _neturl.PathEscape(common.ParameterToString(r.integrationServiceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewOpsgenieIntegrationApi Returns NewOpsgenieIntegrationApi. +func NewOpsgenieIntegrationApi(client *common.APIClient) *OpsgenieIntegrationApi { + return &OpsgenieIntegrationApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_organizations.go b/api/v2/datadog/api_organizations.go new file mode 100644 index 00000000000..e9ff7708fe4 --- /dev/null +++ b/api/v2/datadog/api_organizations.go @@ -0,0 +1,190 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// OrganizationsApi service type +type OrganizationsApi common.Service + +type apiUploadIdPMetadataRequest struct { + ctx _context.Context + idpFile **os.File +} + +// UploadIdPMetadataOptionalParameters holds optional parameters for UploadIdPMetadata. +type UploadIdPMetadataOptionalParameters struct { + IdpFile **os.File +} + +// NewUploadIdPMetadataOptionalParameters creates an empty struct for parameters. +func NewUploadIdPMetadataOptionalParameters() *UploadIdPMetadataOptionalParameters { + this := UploadIdPMetadataOptionalParameters{} + return &this +} + +// WithIdpFile sets the corresponding parameter name and returns the struct. +func (r *UploadIdPMetadataOptionalParameters) WithIdpFile(idpFile *os.File) *UploadIdPMetadataOptionalParameters { + r.IdpFile = &idpFile + return r +} + +func (a *OrganizationsApi) buildUploadIdPMetadataRequest(ctx _context.Context, o ...UploadIdPMetadataOptionalParameters) (apiUploadIdPMetadataRequest, error) { + req := apiUploadIdPMetadataRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type UploadIdPMetadataOptionalParameters is allowed") + } + + if o != nil { + req.idpFile = o[0].IdpFile + } + return req, nil +} + +// UploadIdPMetadata Upload IdP metadata. +// Endpoint for uploading IdP metadata for SAML setup. +// +// Use this endpoint to upload or replace IdP metadata for SAML login configuration. +func (a *OrganizationsApi) UploadIdPMetadata(ctx _context.Context, o ...UploadIdPMetadataOptionalParameters) (*_nethttp.Response, error) { + req, err := a.buildUploadIdPMetadataRequest(ctx, o...) + if err != nil { + return nil, err + } + + return a.uploadIdPMetadataExecute(req) +} + +// uploadIdPMetadataExecute executes the request. +func (a *OrganizationsApi) uploadIdPMetadataExecute(r apiUploadIdPMetadataRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.OrganizationsApi.UploadIdPMetadata") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/saml_configurations/idp_metadata" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "multipart/form-data" + localVarHeaderParams["Accept"] = "*/*" + + formFile := common.FormFile{} + formFile.FormFileName = "idp_file" + var localVarFile *os.File + if r.idpFile != nil { + localVarFile = *r.idpFile + } + if localVarFile != nil { + fbs, _ := _ioutil.ReadAll(localVarFile) + formFile.FileBytes = fbs + formFile.FileName = localVarFile.Name() + localVarFile.Close() + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, &formFile) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// NewOrganizationsApi Returns NewOrganizationsApi. +func NewOrganizationsApi(client *common.APIClient) *OrganizationsApi { + return &OrganizationsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_processes.go b/api/v2/datadog/api_processes.go new file mode 100644 index 00000000000..99c0a9f21c4 --- /dev/null +++ b/api/v2/datadog/api_processes.go @@ -0,0 +1,309 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// ProcessesApi service type +type ProcessesApi common.Service + +type apiListProcessesRequest struct { + ctx _context.Context + search *string + tags *string + from *int64 + to *int64 + pageLimit *int32 + pageCursor *string +} + +// ListProcessesOptionalParameters holds optional parameters for ListProcesses. +type ListProcessesOptionalParameters struct { + Search *string + Tags *string + From *int64 + To *int64 + PageLimit *int32 + PageCursor *string +} + +// NewListProcessesOptionalParameters creates an empty struct for parameters. +func NewListProcessesOptionalParameters() *ListProcessesOptionalParameters { + this := ListProcessesOptionalParameters{} + return &this +} + +// WithSearch sets the corresponding parameter name and returns the struct. +func (r *ListProcessesOptionalParameters) WithSearch(search string) *ListProcessesOptionalParameters { + r.Search = &search + return r +} + +// WithTags sets the corresponding parameter name and returns the struct. +func (r *ListProcessesOptionalParameters) WithTags(tags string) *ListProcessesOptionalParameters { + r.Tags = &tags + return r +} + +// WithFrom sets the corresponding parameter name and returns the struct. +func (r *ListProcessesOptionalParameters) WithFrom(from int64) *ListProcessesOptionalParameters { + r.From = &from + return r +} + +// WithTo sets the corresponding parameter name and returns the struct. +func (r *ListProcessesOptionalParameters) WithTo(to int64) *ListProcessesOptionalParameters { + r.To = &to + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListProcessesOptionalParameters) WithPageLimit(pageLimit int32) *ListProcessesOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListProcessesOptionalParameters) WithPageCursor(pageCursor string) *ListProcessesOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +func (a *ProcessesApi) buildListProcessesRequest(ctx _context.Context, o ...ListProcessesOptionalParameters) (apiListProcessesRequest, error) { + req := apiListProcessesRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListProcessesOptionalParameters is allowed") + } + + if o != nil { + req.search = o[0].Search + req.tags = o[0].Tags + req.from = o[0].From + req.to = o[0].To + req.pageLimit = o[0].PageLimit + req.pageCursor = o[0].PageCursor + } + return req, nil +} + +// ListProcesses Get all processes. +// Get all processes for your organization. +func (a *ProcessesApi) ListProcesses(ctx _context.Context, o ...ListProcessesOptionalParameters) (ProcessSummariesResponse, *_nethttp.Response, error) { + req, err := a.buildListProcessesRequest(ctx, o...) + if err != nil { + var localVarReturnValue ProcessSummariesResponse + return localVarReturnValue, nil, err + } + + return a.listProcessesExecute(req) +} + +// ListProcessesWithPagination provides a paginated version of ListProcesses returning a channel with all items. +func (a *ProcessesApi) ListProcessesWithPagination(ctx _context.Context, o ...ListProcessesOptionalParameters) (<-chan ProcessSummary, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(1000) + if len(o) == 0 { + o = append(o, ListProcessesOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan ProcessSummary, pageSize_) + go func() { + for { + req, err := a.buildListProcessesRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listProcessesExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// listProcessesExecute executes the request. +func (a *ProcessesApi) listProcessesExecute(r apiListProcessesRequest) (ProcessSummariesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ProcessSummariesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ProcessesApi.ListProcesses") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/processes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.search != nil { + localVarQueryParams.Add("search", common.ParameterToString(*r.search, "")) + } + if r.tags != nil { + localVarQueryParams.Add("tags", common.ParameterToString(*r.tags, "")) + } + if r.from != nil { + localVarQueryParams.Add("from", common.ParameterToString(*r.from, "")) + } + if r.to != nil { + localVarQueryParams.Add("to", common.ParameterToString(*r.to, "")) + } + if r.pageLimit != nil { + localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) + } + if r.pageCursor != nil { + localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewProcessesApi Returns NewProcessesApi. +func NewProcessesApi(client *common.APIClient) *ProcessesApi { + return &ProcessesApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_roles.go b/api/v2/datadog/api_roles.go new file mode 100644 index 00000000000..f907327db28 --- /dev/null +++ b/api/v2/datadog/api_roles.go @@ -0,0 +1,2036 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// RolesApi service type +type RolesApi common.Service + +type apiAddPermissionToRoleRequest struct { + ctx _context.Context + roleId string + body *RelationshipToPermission +} + +func (a *RolesApi) buildAddPermissionToRoleRequest(ctx _context.Context, roleId string, body RelationshipToPermission) (apiAddPermissionToRoleRequest, error) { + req := apiAddPermissionToRoleRequest{ + ctx: ctx, + roleId: roleId, + body: &body, + } + return req, nil +} + +// AddPermissionToRole Grant permission to a role. +// Adds a permission to a role. +func (a *RolesApi) AddPermissionToRole(ctx _context.Context, roleId string, body RelationshipToPermission) (PermissionsResponse, *_nethttp.Response, error) { + req, err := a.buildAddPermissionToRoleRequest(ctx, roleId, body) + if err != nil { + var localVarReturnValue PermissionsResponse + return localVarReturnValue, nil, err + } + + return a.addPermissionToRoleExecute(req) +} + +// addPermissionToRoleExecute executes the request. +func (a *RolesApi) addPermissionToRoleExecute(r apiAddPermissionToRoleRequest) (PermissionsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue PermissionsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.AddPermissionToRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiAddUserToRoleRequest struct { + ctx _context.Context + roleId string + body *RelationshipToUser +} + +func (a *RolesApi) buildAddUserToRoleRequest(ctx _context.Context, roleId string, body RelationshipToUser) (apiAddUserToRoleRequest, error) { + req := apiAddUserToRoleRequest{ + ctx: ctx, + roleId: roleId, + body: &body, + } + return req, nil +} + +// AddUserToRole Add a user to a role. +// Adds a user to a role. +func (a *RolesApi) AddUserToRole(ctx _context.Context, roleId string, body RelationshipToUser) (UsersResponse, *_nethttp.Response, error) { + req, err := a.buildAddUserToRoleRequest(ctx, roleId, body) + if err != nil { + var localVarReturnValue UsersResponse + return localVarReturnValue, nil, err + } + + return a.addUserToRoleExecute(req) +} + +// addUserToRoleExecute executes the request. +func (a *RolesApi) addUserToRoleExecute(r apiAddUserToRoleRequest) (UsersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue UsersResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.AddUserToRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}/users" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCloneRoleRequest struct { + ctx _context.Context + roleId string + body *RoleCloneRequest +} + +func (a *RolesApi) buildCloneRoleRequest(ctx _context.Context, roleId string, body RoleCloneRequest) (apiCloneRoleRequest, error) { + req := apiCloneRoleRequest{ + ctx: ctx, + roleId: roleId, + body: &body, + } + return req, nil +} + +// CloneRole Create a new role by cloning an existing role. +// Clone an existing role +func (a *RolesApi) CloneRole(ctx _context.Context, roleId string, body RoleCloneRequest) (RoleResponse, *_nethttp.Response, error) { + req, err := a.buildCloneRoleRequest(ctx, roleId, body) + if err != nil { + var localVarReturnValue RoleResponse + return localVarReturnValue, nil, err + } + + return a.cloneRoleExecute(req) +} + +// cloneRoleExecute executes the request. +func (a *RolesApi) cloneRoleExecute(r apiCloneRoleRequest) (RoleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RoleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.CloneRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}/clone" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateRoleRequest struct { + ctx _context.Context + body *RoleCreateRequest +} + +func (a *RolesApi) buildCreateRoleRequest(ctx _context.Context, body RoleCreateRequest) (apiCreateRoleRequest, error) { + req := apiCreateRoleRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateRole Create role. +// Create a new role for your organization. +func (a *RolesApi) CreateRole(ctx _context.Context, body RoleCreateRequest) (RoleCreateResponse, *_nethttp.Response, error) { + req, err := a.buildCreateRoleRequest(ctx, body) + if err != nil { + var localVarReturnValue RoleCreateResponse + return localVarReturnValue, nil, err + } + + return a.createRoleExecute(req) +} + +// createRoleExecute executes the request. +func (a *RolesApi) createRoleExecute(r apiCreateRoleRequest) (RoleCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RoleCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.CreateRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteRoleRequest struct { + ctx _context.Context + roleId string +} + +func (a *RolesApi) buildDeleteRoleRequest(ctx _context.Context, roleId string) (apiDeleteRoleRequest, error) { + req := apiDeleteRoleRequest{ + ctx: ctx, + roleId: roleId, + } + return req, nil +} + +// DeleteRole Delete role. +// Disables a role. +func (a *RolesApi) DeleteRole(ctx _context.Context, roleId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteRoleRequest(ctx, roleId) + if err != nil { + return nil, err + } + + return a.deleteRoleExecute(req) +} + +// deleteRoleExecute executes the request. +func (a *RolesApi) deleteRoleExecute(r apiDeleteRoleRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.DeleteRole") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetRoleRequest struct { + ctx _context.Context + roleId string +} + +func (a *RolesApi) buildGetRoleRequest(ctx _context.Context, roleId string) (apiGetRoleRequest, error) { + req := apiGetRoleRequest{ + ctx: ctx, + roleId: roleId, + } + return req, nil +} + +// GetRole Get a role. +// Get a role in the organization specified by the role’s `role_id`. +func (a *RolesApi) GetRole(ctx _context.Context, roleId string) (RoleResponse, *_nethttp.Response, error) { + req, err := a.buildGetRoleRequest(ctx, roleId) + if err != nil { + var localVarReturnValue RoleResponse + return localVarReturnValue, nil, err + } + + return a.getRoleExecute(req) +} + +// getRoleExecute executes the request. +func (a *RolesApi) getRoleExecute(r apiGetRoleRequest) (RoleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RoleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.GetRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListPermissionsRequest struct { + ctx _context.Context +} + +func (a *RolesApi) buildListPermissionsRequest(ctx _context.Context) (apiListPermissionsRequest, error) { + req := apiListPermissionsRequest{ + ctx: ctx, + } + return req, nil +} + +// ListPermissions List permissions. +// Returns a list of all permissions, including name, description, and ID. +func (a *RolesApi) ListPermissions(ctx _context.Context) (PermissionsResponse, *_nethttp.Response, error) { + req, err := a.buildListPermissionsRequest(ctx) + if err != nil { + var localVarReturnValue PermissionsResponse + return localVarReturnValue, nil, err + } + + return a.listPermissionsExecute(req) +} + +// listPermissionsExecute executes the request. +func (a *RolesApi) listPermissionsExecute(r apiListPermissionsRequest) (PermissionsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue PermissionsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListPermissions") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/permissions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListRolePermissionsRequest struct { + ctx _context.Context + roleId string +} + +func (a *RolesApi) buildListRolePermissionsRequest(ctx _context.Context, roleId string) (apiListRolePermissionsRequest, error) { + req := apiListRolePermissionsRequest{ + ctx: ctx, + roleId: roleId, + } + return req, nil +} + +// ListRolePermissions List permissions for a role. +// Returns a list of all permissions for a single role. +func (a *RolesApi) ListRolePermissions(ctx _context.Context, roleId string) (PermissionsResponse, *_nethttp.Response, error) { + req, err := a.buildListRolePermissionsRequest(ctx, roleId) + if err != nil { + var localVarReturnValue PermissionsResponse + return localVarReturnValue, nil, err + } + + return a.listRolePermissionsExecute(req) +} + +// listRolePermissionsExecute executes the request. +func (a *RolesApi) listRolePermissionsExecute(r apiListRolePermissionsRequest) (PermissionsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue PermissionsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListRolePermissions") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListRoleUsersRequest struct { + ctx _context.Context + roleId string + pageSize *int64 + pageNumber *int64 + sort *string + filter *string +} + +// ListRoleUsersOptionalParameters holds optional parameters for ListRoleUsers. +type ListRoleUsersOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *string + Filter *string +} + +// NewListRoleUsersOptionalParameters creates an empty struct for parameters. +func NewListRoleUsersOptionalParameters() *ListRoleUsersOptionalParameters { + this := ListRoleUsersOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListRoleUsersOptionalParameters) WithPageSize(pageSize int64) *ListRoleUsersOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListRoleUsersOptionalParameters) WithPageNumber(pageNumber int64) *ListRoleUsersOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListRoleUsersOptionalParameters) WithSort(sort string) *ListRoleUsersOptionalParameters { + r.Sort = &sort + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListRoleUsersOptionalParameters) WithFilter(filter string) *ListRoleUsersOptionalParameters { + r.Filter = &filter + return r +} + +func (a *RolesApi) buildListRoleUsersRequest(ctx _context.Context, roleId string, o ...ListRoleUsersOptionalParameters) (apiListRoleUsersRequest, error) { + req := apiListRoleUsersRequest{ + ctx: ctx, + roleId: roleId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListRoleUsersOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.filter = o[0].Filter + } + return req, nil +} + +// ListRoleUsers Get all users of a role. +// Gets all users of a role. +func (a *RolesApi) ListRoleUsers(ctx _context.Context, roleId string, o ...ListRoleUsersOptionalParameters) (UsersResponse, *_nethttp.Response, error) { + req, err := a.buildListRoleUsersRequest(ctx, roleId, o...) + if err != nil { + var localVarReturnValue UsersResponse + return localVarReturnValue, nil, err + } + + return a.listRoleUsersExecute(req) +} + +// listRoleUsersExecute executes the request. +func (a *RolesApi) listRoleUsersExecute(r apiListRoleUsersRequest) (UsersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsersResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListRoleUsers") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}/users" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListRolesRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sort *RolesSort + filter *string +} + +// ListRolesOptionalParameters holds optional parameters for ListRoles. +type ListRolesOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *RolesSort + Filter *string +} + +// NewListRolesOptionalParameters creates an empty struct for parameters. +func NewListRolesOptionalParameters() *ListRolesOptionalParameters { + this := ListRolesOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListRolesOptionalParameters) WithPageSize(pageSize int64) *ListRolesOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListRolesOptionalParameters) WithPageNumber(pageNumber int64) *ListRolesOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListRolesOptionalParameters) WithSort(sort RolesSort) *ListRolesOptionalParameters { + r.Sort = &sort + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListRolesOptionalParameters) WithFilter(filter string) *ListRolesOptionalParameters { + r.Filter = &filter + return r +} + +func (a *RolesApi) buildListRolesRequest(ctx _context.Context, o ...ListRolesOptionalParameters) (apiListRolesRequest, error) { + req := apiListRolesRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListRolesOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.filter = o[0].Filter + } + return req, nil +} + +// ListRoles List roles. +// Returns all roles, including their names and their unique identifiers. +func (a *RolesApi) ListRoles(ctx _context.Context, o ...ListRolesOptionalParameters) (RolesResponse, *_nethttp.Response, error) { + req, err := a.buildListRolesRequest(ctx, o...) + if err != nil { + var localVarReturnValue RolesResponse + return localVarReturnValue, nil, err + } + + return a.listRolesExecute(req) +} + +// listRolesExecute executes the request. +func (a *RolesApi) listRolesExecute(r apiListRolesRequest) (RolesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RolesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.ListRoles") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiRemovePermissionFromRoleRequest struct { + ctx _context.Context + roleId string + body *RelationshipToPermission +} + +func (a *RolesApi) buildRemovePermissionFromRoleRequest(ctx _context.Context, roleId string, body RelationshipToPermission) (apiRemovePermissionFromRoleRequest, error) { + req := apiRemovePermissionFromRoleRequest{ + ctx: ctx, + roleId: roleId, + body: &body, + } + return req, nil +} + +// RemovePermissionFromRole Revoke permission. +// Removes a permission from a role. +func (a *RolesApi) RemovePermissionFromRole(ctx _context.Context, roleId string, body RelationshipToPermission) (PermissionsResponse, *_nethttp.Response, error) { + req, err := a.buildRemovePermissionFromRoleRequest(ctx, roleId, body) + if err != nil { + var localVarReturnValue PermissionsResponse + return localVarReturnValue, nil, err + } + + return a.removePermissionFromRoleExecute(req) +} + +// removePermissionFromRoleExecute executes the request. +func (a *RolesApi) removePermissionFromRoleExecute(r apiRemovePermissionFromRoleRequest) (PermissionsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue PermissionsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.RemovePermissionFromRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiRemoveUserFromRoleRequest struct { + ctx _context.Context + roleId string + body *RelationshipToUser +} + +func (a *RolesApi) buildRemoveUserFromRoleRequest(ctx _context.Context, roleId string, body RelationshipToUser) (apiRemoveUserFromRoleRequest, error) { + req := apiRemoveUserFromRoleRequest{ + ctx: ctx, + roleId: roleId, + body: &body, + } + return req, nil +} + +// RemoveUserFromRole Remove a user from a role. +// Removes a user from a role. +func (a *RolesApi) RemoveUserFromRole(ctx _context.Context, roleId string, body RelationshipToUser) (UsersResponse, *_nethttp.Response, error) { + req, err := a.buildRemoveUserFromRoleRequest(ctx, roleId, body) + if err != nil { + var localVarReturnValue UsersResponse + return localVarReturnValue, nil, err + } + + return a.removeUserFromRoleExecute(req) +} + +// removeUserFromRoleExecute executes the request. +func (a *RolesApi) removeUserFromRoleExecute(r apiRemoveUserFromRoleRequest) (UsersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue UsersResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.RemoveUserFromRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}/users" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateRoleRequest struct { + ctx _context.Context + roleId string + body *RoleUpdateRequest +} + +func (a *RolesApi) buildUpdateRoleRequest(ctx _context.Context, roleId string, body RoleUpdateRequest) (apiUpdateRoleRequest, error) { + req := apiUpdateRoleRequest{ + ctx: ctx, + roleId: roleId, + body: &body, + } + return req, nil +} + +// UpdateRole Update a role. +// Edit a role. Can only be used with application keys belonging to administrators. +func (a *RolesApi) UpdateRole(ctx _context.Context, roleId string, body RoleUpdateRequest) (RoleUpdateResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateRoleRequest(ctx, roleId, body) + if err != nil { + var localVarReturnValue RoleUpdateResponse + return localVarReturnValue, nil, err + } + + return a.updateRoleExecute(req) +} + +// updateRoleExecute executes the request. +func (a *RolesApi) updateRoleExecute(r apiUpdateRoleRequest) (RoleUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue RoleUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RolesApi.UpdateRole") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/roles/{role_id}" + localVarPath = strings.Replace(localVarPath, "{"+"role_id"+"}", _neturl.PathEscape(common.ParameterToString(r.roleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 422 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewRolesApi Returns NewRolesApi. +func NewRolesApi(client *common.APIClient) *RolesApi { + return &RolesApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_rum.go b/api/v2/datadog/api_rum.go new file mode 100644 index 00000000000..0748f63cd19 --- /dev/null +++ b/api/v2/datadog/api_rum.go @@ -0,0 +1,667 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// RUMApi service type +type RUMApi common.Service + +type apiAggregateRUMEventsRequest struct { + ctx _context.Context + body *RUMAggregateRequest +} + +func (a *RUMApi) buildAggregateRUMEventsRequest(ctx _context.Context, body RUMAggregateRequest) (apiAggregateRUMEventsRequest, error) { + req := apiAggregateRUMEventsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// AggregateRUMEvents Aggregate RUM events. +// The API endpoint to aggregate RUM events into buckets of computed metrics and timeseries. +func (a *RUMApi) AggregateRUMEvents(ctx _context.Context, body RUMAggregateRequest) (RUMAnalyticsAggregateResponse, *_nethttp.Response, error) { + req, err := a.buildAggregateRUMEventsRequest(ctx, body) + if err != nil { + var localVarReturnValue RUMAnalyticsAggregateResponse + return localVarReturnValue, nil, err + } + + return a.aggregateRUMEventsExecute(req) +} + +// aggregateRUMEventsExecute executes the request. +func (a *RUMApi) aggregateRUMEventsExecute(r apiAggregateRUMEventsRequest) (RUMAnalyticsAggregateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RUMAnalyticsAggregateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RUMApi.AggregateRUMEvents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/analytics/aggregate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListRUMEventsRequest struct { + ctx _context.Context + filterQuery *string + filterFrom *time.Time + filterTo *time.Time + sort *RUMSort + pageCursor *string + pageLimit *int32 +} + +// ListRUMEventsOptionalParameters holds optional parameters for ListRUMEvents. +type ListRUMEventsOptionalParameters struct { + FilterQuery *string + FilterFrom *time.Time + FilterTo *time.Time + Sort *RUMSort + PageCursor *string + PageLimit *int32 +} + +// NewListRUMEventsOptionalParameters creates an empty struct for parameters. +func NewListRUMEventsOptionalParameters() *ListRUMEventsOptionalParameters { + this := ListRUMEventsOptionalParameters{} + return &this +} + +// WithFilterQuery sets the corresponding parameter name and returns the struct. +func (r *ListRUMEventsOptionalParameters) WithFilterQuery(filterQuery string) *ListRUMEventsOptionalParameters { + r.FilterQuery = &filterQuery + return r +} + +// WithFilterFrom sets the corresponding parameter name and returns the struct. +func (r *ListRUMEventsOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListRUMEventsOptionalParameters { + r.FilterFrom = &filterFrom + return r +} + +// WithFilterTo sets the corresponding parameter name and returns the struct. +func (r *ListRUMEventsOptionalParameters) WithFilterTo(filterTo time.Time) *ListRUMEventsOptionalParameters { + r.FilterTo = &filterTo + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListRUMEventsOptionalParameters) WithSort(sort RUMSort) *ListRUMEventsOptionalParameters { + r.Sort = &sort + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListRUMEventsOptionalParameters) WithPageCursor(pageCursor string) *ListRUMEventsOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListRUMEventsOptionalParameters) WithPageLimit(pageLimit int32) *ListRUMEventsOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +func (a *RUMApi) buildListRUMEventsRequest(ctx _context.Context, o ...ListRUMEventsOptionalParameters) (apiListRUMEventsRequest, error) { + req := apiListRUMEventsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListRUMEventsOptionalParameters is allowed") + } + + if o != nil { + req.filterQuery = o[0].FilterQuery + req.filterFrom = o[0].FilterFrom + req.filterTo = o[0].FilterTo + req.sort = o[0].Sort + req.pageCursor = o[0].PageCursor + req.pageLimit = o[0].PageLimit + } + return req, nil +} + +// ListRUMEvents Get a list of RUM events. +// List endpoint returns events that match a RUM search query. +// [Results are paginated][1]. +// +// Use this endpoint to see your latest RUM events. +// +// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination +func (a *RUMApi) ListRUMEvents(ctx _context.Context, o ...ListRUMEventsOptionalParameters) (RUMEventsResponse, *_nethttp.Response, error) { + req, err := a.buildListRUMEventsRequest(ctx, o...) + if err != nil { + var localVarReturnValue RUMEventsResponse + return localVarReturnValue, nil, err + } + + return a.listRUMEventsExecute(req) +} + +// ListRUMEventsWithPagination provides a paginated version of ListRUMEvents returning a channel with all items. +func (a *RUMApi) ListRUMEventsWithPagination(ctx _context.Context, o ...ListRUMEventsOptionalParameters) (<-chan RUMEvent, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, ListRUMEventsOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan RUMEvent, pageSize_) + go func() { + for { + req, err := a.buildListRUMEventsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listRUMEventsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// listRUMEventsExecute executes the request. +func (a *RUMApi) listRUMEventsExecute(r apiListRUMEventsRequest) (RUMEventsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RUMEventsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RUMApi.ListRUMEvents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterQuery != nil { + localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) + } + if r.filterFrom != nil { + localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) + } + if r.filterTo != nil { + localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.pageCursor != nil { + localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) + } + if r.pageLimit != nil { + localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSearchRUMEventsRequest struct { + ctx _context.Context + body *RUMSearchEventsRequest +} + +func (a *RUMApi) buildSearchRUMEventsRequest(ctx _context.Context, body RUMSearchEventsRequest) (apiSearchRUMEventsRequest, error) { + req := apiSearchRUMEventsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// SearchRUMEvents Search RUM events. +// List endpoint returns RUM events that match a RUM search query. +// [Results are paginated][1]. +// +// Use this endpoint to build complex RUM events filtering and search. +// +// [1]: https://docs.datadoghq.com/logs/guide/collect-multiple-logs-with-pagination +func (a *RUMApi) SearchRUMEvents(ctx _context.Context, body RUMSearchEventsRequest) (RUMEventsResponse, *_nethttp.Response, error) { + req, err := a.buildSearchRUMEventsRequest(ctx, body) + if err != nil { + var localVarReturnValue RUMEventsResponse + return localVarReturnValue, nil, err + } + + return a.searchRUMEventsExecute(req) +} + +// SearchRUMEventsWithPagination provides a paginated version of SearchRUMEvents returning a channel with all items. +func (a *RUMApi) SearchRUMEventsWithPagination(ctx _context.Context, body RUMSearchEventsRequest) (<-chan RUMEvent, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if body.Page == nil { + body.Page = NewRUMQueryPageOptions() + } + if body.Page.Limit == nil { + // int32 + body.Page.Limit = &pageSize_ + } else { + pageSize_ = *body.Page.Limit + } + + items := make(chan RUMEvent, pageSize_) + go func() { + for { + req, err := a.buildSearchRUMEventsRequest(ctx, body) + if err != nil { + break + } + + resp, _, err := a.searchRUMEventsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + body.Page.Cursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// searchRUMEventsExecute executes the request. +func (a *RUMApi) searchRUMEventsExecute(r apiSearchRUMEventsRequest) (RUMEventsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RUMEventsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.RUMApi.SearchRUMEvents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/rum/events/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewRUMApi Returns NewRUMApi. +func NewRUMApi(client *common.APIClient) *RUMApi { + return &RUMApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_security_monitoring.go b/api/v2/datadog/api_security_monitoring.go new file mode 100644 index 00000000000..af58e6d4196 --- /dev/null +++ b/api/v2/datadog/api_security_monitoring.go @@ -0,0 +1,2443 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// SecurityMonitoringApi service type +type SecurityMonitoringApi common.Service + +type apiCreateSecurityFilterRequest struct { + ctx _context.Context + body *SecurityFilterCreateRequest +} + +func (a *SecurityMonitoringApi) buildCreateSecurityFilterRequest(ctx _context.Context, body SecurityFilterCreateRequest) (apiCreateSecurityFilterRequest, error) { + req := apiCreateSecurityFilterRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateSecurityFilter Create a security filter. +// Create a security filter. +// +// See the [security filter guide](https://docs.datadoghq.com/security_platform/guide/how-to-setup-security-filters-using-security-monitoring-api/) +// for more examples. +func (a *SecurityMonitoringApi) CreateSecurityFilter(ctx _context.Context, body SecurityFilterCreateRequest) (SecurityFilterResponse, *_nethttp.Response, error) { + req, err := a.buildCreateSecurityFilterRequest(ctx, body) + if err != nil { + var localVarReturnValue SecurityFilterResponse + return localVarReturnValue, nil, err + } + + return a.createSecurityFilterExecute(req) +} + +// createSecurityFilterExecute executes the request. +func (a *SecurityMonitoringApi) createSecurityFilterExecute(r apiCreateSecurityFilterRequest) (SecurityFilterResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SecurityFilterResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.CreateSecurityFilter") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateSecurityMonitoringRuleRequest struct { + ctx _context.Context + body *SecurityMonitoringRuleCreatePayload +} + +func (a *SecurityMonitoringApi) buildCreateSecurityMonitoringRuleRequest(ctx _context.Context, body SecurityMonitoringRuleCreatePayload) (apiCreateSecurityMonitoringRuleRequest, error) { + req := apiCreateSecurityMonitoringRuleRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateSecurityMonitoringRule Create a detection rule. +// Create a detection rule. +func (a *SecurityMonitoringApi) CreateSecurityMonitoringRule(ctx _context.Context, body SecurityMonitoringRuleCreatePayload) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { + req, err := a.buildCreateSecurityMonitoringRuleRequest(ctx, body) + if err != nil { + var localVarReturnValue SecurityMonitoringRuleResponse + return localVarReturnValue, nil, err + } + + return a.createSecurityMonitoringRuleExecute(req) +} + +// createSecurityMonitoringRuleExecute executes the request. +func (a *SecurityMonitoringApi) createSecurityMonitoringRuleExecute(r apiCreateSecurityMonitoringRuleRequest) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringRuleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.CreateSecurityMonitoringRule") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteSecurityFilterRequest struct { + ctx _context.Context + securityFilterId string +} + +func (a *SecurityMonitoringApi) buildDeleteSecurityFilterRequest(ctx _context.Context, securityFilterId string) (apiDeleteSecurityFilterRequest, error) { + req := apiDeleteSecurityFilterRequest{ + ctx: ctx, + securityFilterId: securityFilterId, + } + return req, nil +} + +// DeleteSecurityFilter Delete a security filter. +// Delete a specific security filter. +func (a *SecurityMonitoringApi) DeleteSecurityFilter(ctx _context.Context, securityFilterId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteSecurityFilterRequest(ctx, securityFilterId) + if err != nil { + return nil, err + } + + return a.deleteSecurityFilterExecute(req) +} + +// deleteSecurityFilterExecute executes the request. +func (a *SecurityMonitoringApi) deleteSecurityFilterExecute(r apiDeleteSecurityFilterRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.DeleteSecurityFilter") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}" + localVarPath = strings.Replace(localVarPath, "{"+"security_filter_id"+"}", _neturl.PathEscape(common.ParameterToString(r.securityFilterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiDeleteSecurityMonitoringRuleRequest struct { + ctx _context.Context + ruleId string +} + +func (a *SecurityMonitoringApi) buildDeleteSecurityMonitoringRuleRequest(ctx _context.Context, ruleId string) (apiDeleteSecurityMonitoringRuleRequest, error) { + req := apiDeleteSecurityMonitoringRuleRequest{ + ctx: ctx, + ruleId: ruleId, + } + return req, nil +} + +// DeleteSecurityMonitoringRule Delete an existing rule. +// Delete an existing rule. Default rules cannot be deleted. +func (a *SecurityMonitoringApi) DeleteSecurityMonitoringRule(ctx _context.Context, ruleId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteSecurityMonitoringRuleRequest(ctx, ruleId) + if err != nil { + return nil, err + } + + return a.deleteSecurityMonitoringRuleExecute(req) +} + +// deleteSecurityMonitoringRuleExecute executes the request. +func (a *SecurityMonitoringApi) deleteSecurityMonitoringRuleExecute(r apiDeleteSecurityMonitoringRuleRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.DeleteSecurityMonitoringRule") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/rules/{rule_id}" + localVarPath = strings.Replace(localVarPath, "{"+"rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.ruleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiEditSecurityMonitoringSignalAssigneeRequest struct { + ctx _context.Context + signalId string + body *SecurityMonitoringSignalAssigneeUpdateRequest +} + +func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalAssigneeRequest(ctx _context.Context, signalId string, body SecurityMonitoringSignalAssigneeUpdateRequest) (apiEditSecurityMonitoringSignalAssigneeRequest, error) { + req := apiEditSecurityMonitoringSignalAssigneeRequest{ + ctx: ctx, + signalId: signalId, + body: &body, + } + return req, nil +} + +// EditSecurityMonitoringSignalAssignee Modify the triage assignee of a security signal. +// Modify the triage assignee of a security signal. +func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalAssignee(ctx _context.Context, signalId string, body SecurityMonitoringSignalAssigneeUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { + req, err := a.buildEditSecurityMonitoringSignalAssigneeRequest(ctx, signalId, body) + if err != nil { + var localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse + return localVarReturnValue, nil, err + } + + return a.editSecurityMonitoringSignalAssigneeExecute(req) +} + +// editSecurityMonitoringSignalAssigneeExecute executes the request. +func (a *SecurityMonitoringApi) editSecurityMonitoringSignalAssigneeExecute(r apiEditSecurityMonitoringSignalAssigneeRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/signals/{signal_id}/assignee" + localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiEditSecurityMonitoringSignalIncidentsRequest struct { + ctx _context.Context + signalId string + body *SecurityMonitoringSignalIncidentsUpdateRequest +} + +func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalIncidentsRequest(ctx _context.Context, signalId string, body SecurityMonitoringSignalIncidentsUpdateRequest) (apiEditSecurityMonitoringSignalIncidentsRequest, error) { + req := apiEditSecurityMonitoringSignalIncidentsRequest{ + ctx: ctx, + signalId: signalId, + body: &body, + } + return req, nil +} + +// EditSecurityMonitoringSignalIncidents Change the related incidents of a security signal. +// Change the related incidents for a security signal. +func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalIncidents(ctx _context.Context, signalId string, body SecurityMonitoringSignalIncidentsUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { + req, err := a.buildEditSecurityMonitoringSignalIncidentsRequest(ctx, signalId, body) + if err != nil { + var localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse + return localVarReturnValue, nil, err + } + + return a.editSecurityMonitoringSignalIncidentsExecute(req) +} + +// editSecurityMonitoringSignalIncidentsExecute executes the request. +func (a *SecurityMonitoringApi) editSecurityMonitoringSignalIncidentsExecute(r apiEditSecurityMonitoringSignalIncidentsRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/signals/{signal_id}/incidents" + localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiEditSecurityMonitoringSignalStateRequest struct { + ctx _context.Context + signalId string + body *SecurityMonitoringSignalStateUpdateRequest +} + +func (a *SecurityMonitoringApi) buildEditSecurityMonitoringSignalStateRequest(ctx _context.Context, signalId string, body SecurityMonitoringSignalStateUpdateRequest) (apiEditSecurityMonitoringSignalStateRequest, error) { + req := apiEditSecurityMonitoringSignalStateRequest{ + ctx: ctx, + signalId: signalId, + body: &body, + } + return req, nil +} + +// EditSecurityMonitoringSignalState Change the triage state of a security signal. +// Change the triage state of a security signal. +func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalState(ctx _context.Context, signalId string, body SecurityMonitoringSignalStateUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { + req, err := a.buildEditSecurityMonitoringSignalStateRequest(ctx, signalId, body) + if err != nil { + var localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse + return localVarReturnValue, nil, err + } + + return a.editSecurityMonitoringSignalStateExecute(req) +} + +// editSecurityMonitoringSignalStateExecute executes the request. +func (a *SecurityMonitoringApi) editSecurityMonitoringSignalStateExecute(r apiEditSecurityMonitoringSignalStateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.EditSecurityMonitoringSignalState") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/signals/{signal_id}/state" + localVarPath = strings.Replace(localVarPath, "{"+"signal_id"+"}", _neturl.PathEscape(common.ParameterToString(r.signalId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSecurityFilterRequest struct { + ctx _context.Context + securityFilterId string +} + +func (a *SecurityMonitoringApi) buildGetSecurityFilterRequest(ctx _context.Context, securityFilterId string) (apiGetSecurityFilterRequest, error) { + req := apiGetSecurityFilterRequest{ + ctx: ctx, + securityFilterId: securityFilterId, + } + return req, nil +} + +// GetSecurityFilter Get a security filter. +// Get the details of a specific security filter. +// +// See the [security filter guide](https://docs.datadoghq.com/security_platform/guide/how-to-setup-security-filters-using-security-monitoring-api/) +// for more examples. +func (a *SecurityMonitoringApi) GetSecurityFilter(ctx _context.Context, securityFilterId string) (SecurityFilterResponse, *_nethttp.Response, error) { + req, err := a.buildGetSecurityFilterRequest(ctx, securityFilterId) + if err != nil { + var localVarReturnValue SecurityFilterResponse + return localVarReturnValue, nil, err + } + + return a.getSecurityFilterExecute(req) +} + +// getSecurityFilterExecute executes the request. +func (a *SecurityMonitoringApi) getSecurityFilterExecute(r apiGetSecurityFilterRequest) (SecurityFilterResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SecurityFilterResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.GetSecurityFilter") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}" + localVarPath = strings.Replace(localVarPath, "{"+"security_filter_id"+"}", _neturl.PathEscape(common.ParameterToString(r.securityFilterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetSecurityMonitoringRuleRequest struct { + ctx _context.Context + ruleId string +} + +func (a *SecurityMonitoringApi) buildGetSecurityMonitoringRuleRequest(ctx _context.Context, ruleId string) (apiGetSecurityMonitoringRuleRequest, error) { + req := apiGetSecurityMonitoringRuleRequest{ + ctx: ctx, + ruleId: ruleId, + } + return req, nil +} + +// GetSecurityMonitoringRule Get a rule's details. +// Get a rule's details. +func (a *SecurityMonitoringApi) GetSecurityMonitoringRule(ctx _context.Context, ruleId string) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { + req, err := a.buildGetSecurityMonitoringRuleRequest(ctx, ruleId) + if err != nil { + var localVarReturnValue SecurityMonitoringRuleResponse + return localVarReturnValue, nil, err + } + + return a.getSecurityMonitoringRuleExecute(req) +} + +// getSecurityMonitoringRuleExecute executes the request. +func (a *SecurityMonitoringApi) getSecurityMonitoringRuleExecute(r apiGetSecurityMonitoringRuleRequest) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringRuleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.GetSecurityMonitoringRule") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/rules/{rule_id}" + localVarPath = strings.Replace(localVarPath, "{"+"rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.ruleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListSecurityFiltersRequest struct { + ctx _context.Context +} + +func (a *SecurityMonitoringApi) buildListSecurityFiltersRequest(ctx _context.Context) (apiListSecurityFiltersRequest, error) { + req := apiListSecurityFiltersRequest{ + ctx: ctx, + } + return req, nil +} + +// ListSecurityFilters Get all security filters. +// Get the list of configured security filters with their definitions. +func (a *SecurityMonitoringApi) ListSecurityFilters(ctx _context.Context) (SecurityFiltersResponse, *_nethttp.Response, error) { + req, err := a.buildListSecurityFiltersRequest(ctx) + if err != nil { + var localVarReturnValue SecurityFiltersResponse + return localVarReturnValue, nil, err + } + + return a.listSecurityFiltersExecute(req) +} + +// listSecurityFiltersExecute executes the request. +func (a *SecurityMonitoringApi) listSecurityFiltersExecute(r apiListSecurityFiltersRequest) (SecurityFiltersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SecurityFiltersResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.ListSecurityFilters") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListSecurityMonitoringRulesRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 +} + +// ListSecurityMonitoringRulesOptionalParameters holds optional parameters for ListSecurityMonitoringRules. +type ListSecurityMonitoringRulesOptionalParameters struct { + PageSize *int64 + PageNumber *int64 +} + +// NewListSecurityMonitoringRulesOptionalParameters creates an empty struct for parameters. +func NewListSecurityMonitoringRulesOptionalParameters() *ListSecurityMonitoringRulesOptionalParameters { + this := ListSecurityMonitoringRulesOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringRulesOptionalParameters) WithPageSize(pageSize int64) *ListSecurityMonitoringRulesOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringRulesOptionalParameters) WithPageNumber(pageNumber int64) *ListSecurityMonitoringRulesOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +func (a *SecurityMonitoringApi) buildListSecurityMonitoringRulesRequest(ctx _context.Context, o ...ListSecurityMonitoringRulesOptionalParameters) (apiListSecurityMonitoringRulesRequest, error) { + req := apiListSecurityMonitoringRulesRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListSecurityMonitoringRulesOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + } + return req, nil +} + +// ListSecurityMonitoringRules List rules. +// List rules. +func (a *SecurityMonitoringApi) ListSecurityMonitoringRules(ctx _context.Context, o ...ListSecurityMonitoringRulesOptionalParameters) (SecurityMonitoringListRulesResponse, *_nethttp.Response, error) { + req, err := a.buildListSecurityMonitoringRulesRequest(ctx, o...) + if err != nil { + var localVarReturnValue SecurityMonitoringListRulesResponse + return localVarReturnValue, nil, err + } + + return a.listSecurityMonitoringRulesExecute(req) +} + +// listSecurityMonitoringRulesExecute executes the request. +func (a *SecurityMonitoringApi) listSecurityMonitoringRulesExecute(r apiListSecurityMonitoringRulesRequest) (SecurityMonitoringListRulesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringListRulesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.ListSecurityMonitoringRules") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListSecurityMonitoringSignalsRequest struct { + ctx _context.Context + filterQuery *string + filterFrom *time.Time + filterTo *time.Time + sort *SecurityMonitoringSignalsSort + pageCursor *string + pageLimit *int32 +} + +// ListSecurityMonitoringSignalsOptionalParameters holds optional parameters for ListSecurityMonitoringSignals. +type ListSecurityMonitoringSignalsOptionalParameters struct { + FilterQuery *string + FilterFrom *time.Time + FilterTo *time.Time + Sort *SecurityMonitoringSignalsSort + PageCursor *string + PageLimit *int32 +} + +// NewListSecurityMonitoringSignalsOptionalParameters creates an empty struct for parameters. +func NewListSecurityMonitoringSignalsOptionalParameters() *ListSecurityMonitoringSignalsOptionalParameters { + this := ListSecurityMonitoringSignalsOptionalParameters{} + return &this +} + +// WithFilterQuery sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringSignalsOptionalParameters) WithFilterQuery(filterQuery string) *ListSecurityMonitoringSignalsOptionalParameters { + r.FilterQuery = &filterQuery + return r +} + +// WithFilterFrom sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringSignalsOptionalParameters) WithFilterFrom(filterFrom time.Time) *ListSecurityMonitoringSignalsOptionalParameters { + r.FilterFrom = &filterFrom + return r +} + +// WithFilterTo sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringSignalsOptionalParameters) WithFilterTo(filterTo time.Time) *ListSecurityMonitoringSignalsOptionalParameters { + r.FilterTo = &filterTo + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringSignalsOptionalParameters) WithSort(sort SecurityMonitoringSignalsSort) *ListSecurityMonitoringSignalsOptionalParameters { + r.Sort = &sort + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringSignalsOptionalParameters) WithPageCursor(pageCursor string) *ListSecurityMonitoringSignalsOptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListSecurityMonitoringSignalsOptionalParameters) WithPageLimit(pageLimit int32) *ListSecurityMonitoringSignalsOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +func (a *SecurityMonitoringApi) buildListSecurityMonitoringSignalsRequest(ctx _context.Context, o ...ListSecurityMonitoringSignalsOptionalParameters) (apiListSecurityMonitoringSignalsRequest, error) { + req := apiListSecurityMonitoringSignalsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListSecurityMonitoringSignalsOptionalParameters is allowed") + } + + if o != nil { + req.filterQuery = o[0].FilterQuery + req.filterFrom = o[0].FilterFrom + req.filterTo = o[0].FilterTo + req.sort = o[0].Sort + req.pageCursor = o[0].PageCursor + req.pageLimit = o[0].PageLimit + } + return req, nil +} + +// ListSecurityMonitoringSignals Get a quick list of security signals. +// The list endpoint returns security signals that match a search query. +// Both this endpoint and the POST endpoint can be used interchangeably when listing +// security signals. +func (a *SecurityMonitoringApi) ListSecurityMonitoringSignals(ctx _context.Context, o ...ListSecurityMonitoringSignalsOptionalParameters) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { + req, err := a.buildListSecurityMonitoringSignalsRequest(ctx, o...) + if err != nil { + var localVarReturnValue SecurityMonitoringSignalsListResponse + return localVarReturnValue, nil, err + } + + return a.listSecurityMonitoringSignalsExecute(req) +} + +// ListSecurityMonitoringSignalsWithPagination provides a paginated version of ListSecurityMonitoringSignals returning a channel with all items. +func (a *SecurityMonitoringApi) ListSecurityMonitoringSignalsWithPagination(ctx _context.Context, o ...ListSecurityMonitoringSignalsOptionalParameters) (<-chan SecurityMonitoringSignal, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, ListSecurityMonitoringSignalsOptionalParameters{}) + } + if o[0].PageLimit != nil { + pageSize_ = *o[0].PageLimit + } + o[0].PageLimit = &pageSize_ + + items := make(chan SecurityMonitoringSignal, pageSize_) + go func() { + for { + req, err := a.buildListSecurityMonitoringSignalsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.listSecurityMonitoringSignalsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].PageCursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// listSecurityMonitoringSignalsExecute executes the request. +func (a *SecurityMonitoringApi) listSecurityMonitoringSignalsExecute(r apiListSecurityMonitoringSignalsRequest) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringSignalsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.ListSecurityMonitoringSignals") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/signals" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterQuery != nil { + localVarQueryParams.Add("filter[query]", common.ParameterToString(*r.filterQuery, "")) + } + if r.filterFrom != nil { + localVarQueryParams.Add("filter[from]", common.ParameterToString(*r.filterFrom, "")) + } + if r.filterTo != nil { + localVarQueryParams.Add("filter[to]", common.ParameterToString(*r.filterTo, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.pageCursor != nil { + localVarQueryParams.Add("page[cursor]", common.ParameterToString(*r.pageCursor, "")) + } + if r.pageLimit != nil { + localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSearchSecurityMonitoringSignalsRequest struct { + ctx _context.Context + body *SecurityMonitoringSignalListRequest +} + +// SearchSecurityMonitoringSignalsOptionalParameters holds optional parameters for SearchSecurityMonitoringSignals. +type SearchSecurityMonitoringSignalsOptionalParameters struct { + Body *SecurityMonitoringSignalListRequest +} + +// NewSearchSecurityMonitoringSignalsOptionalParameters creates an empty struct for parameters. +func NewSearchSecurityMonitoringSignalsOptionalParameters() *SearchSecurityMonitoringSignalsOptionalParameters { + this := SearchSecurityMonitoringSignalsOptionalParameters{} + return &this +} + +// WithBody sets the corresponding parameter name and returns the struct. +func (r *SearchSecurityMonitoringSignalsOptionalParameters) WithBody(body SecurityMonitoringSignalListRequest) *SearchSecurityMonitoringSignalsOptionalParameters { + r.Body = &body + return r +} + +func (a *SecurityMonitoringApi) buildSearchSecurityMonitoringSignalsRequest(ctx _context.Context, o ...SearchSecurityMonitoringSignalsOptionalParameters) (apiSearchSecurityMonitoringSignalsRequest, error) { + req := apiSearchSecurityMonitoringSignalsRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type SearchSecurityMonitoringSignalsOptionalParameters is allowed") + } + + if o != nil { + req.body = o[0].Body + } + return req, nil +} + +// SearchSecurityMonitoringSignals Get a list of security signals. +// Returns security signals that match a search query. +// Both this endpoint and the GET endpoint can be used interchangeably for listing +// security signals. +func (a *SecurityMonitoringApi) SearchSecurityMonitoringSignals(ctx _context.Context, o ...SearchSecurityMonitoringSignalsOptionalParameters) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { + req, err := a.buildSearchSecurityMonitoringSignalsRequest(ctx, o...) + if err != nil { + var localVarReturnValue SecurityMonitoringSignalsListResponse + return localVarReturnValue, nil, err + } + + return a.searchSecurityMonitoringSignalsExecute(req) +} + +// SearchSecurityMonitoringSignalsWithPagination provides a paginated version of SearchSecurityMonitoringSignals returning a channel with all items. +func (a *SecurityMonitoringApi) SearchSecurityMonitoringSignalsWithPagination(ctx _context.Context, o ...SearchSecurityMonitoringSignalsOptionalParameters) (<-chan SecurityMonitoringSignal, func(), error) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int32(10) + if len(o) == 0 { + o = append(o, SearchSecurityMonitoringSignalsOptionalParameters{}) + } + if o[0].Body == nil { + o[0].Body = NewSecurityMonitoringSignalListRequest() + } + if o[0].Body.Page == nil { + o[0].Body.Page = NewSecurityMonitoringSignalListRequestPage() + } + if o[0].Body.Page.Limit != nil { + pageSize_ = *o[0].Body.Page.Limit + } + o[0].Body.Page.Limit = &pageSize_ + + items := make(chan SecurityMonitoringSignal, pageSize_) + go func() { + for { + req, err := a.buildSearchSecurityMonitoringSignalsRequest(ctx, o...) + if err != nil { + break + } + + resp, _, err := a.searchSecurityMonitoringSignalsExecute(req) + if err != nil { + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- item: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + cursorMeta, ok := resp.GetMetaOk() + if !ok { + break + } + cursorMetaPage, ok := cursorMeta.GetPageOk() + if !ok { + break + } + cursorMetaPageAfter, ok := cursorMetaPage.GetAfterOk() + if !ok { + break + } + + o[0].Body.Page.Cursor = cursorMetaPageAfter + } + close(items) + }() + return items, cancel, nil +} + +// searchSecurityMonitoringSignalsExecute executes the request. +func (a *SecurityMonitoringApi) searchSecurityMonitoringSignalsExecute(r apiSearchSecurityMonitoringSignalsRequest) (SecurityMonitoringSignalsListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringSignalsListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.SearchSecurityMonitoringSignals") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/signals/search" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateSecurityFilterRequest struct { + ctx _context.Context + securityFilterId string + body *SecurityFilterUpdateRequest +} + +func (a *SecurityMonitoringApi) buildUpdateSecurityFilterRequest(ctx _context.Context, securityFilterId string, body SecurityFilterUpdateRequest) (apiUpdateSecurityFilterRequest, error) { + req := apiUpdateSecurityFilterRequest{ + ctx: ctx, + securityFilterId: securityFilterId, + body: &body, + } + return req, nil +} + +// UpdateSecurityFilter Update a security filter. +// Update a specific security filter. +// Returns the security filter object when the request is successful. +func (a *SecurityMonitoringApi) UpdateSecurityFilter(ctx _context.Context, securityFilterId string, body SecurityFilterUpdateRequest) (SecurityFilterResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateSecurityFilterRequest(ctx, securityFilterId, body) + if err != nil { + var localVarReturnValue SecurityFilterResponse + return localVarReturnValue, nil, err + } + + return a.updateSecurityFilterExecute(req) +} + +// updateSecurityFilterExecute executes the request. +func (a *SecurityMonitoringApi) updateSecurityFilterExecute(r apiUpdateSecurityFilterRequest) (SecurityFilterResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SecurityFilterResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.UpdateSecurityFilter") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/security_filters/{security_filter_id}" + localVarPath = strings.Replace(localVarPath, "{"+"security_filter_id"+"}", _neturl.PathEscape(common.ParameterToString(r.securityFilterId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateSecurityMonitoringRuleRequest struct { + ctx _context.Context + ruleId string + body *SecurityMonitoringRuleUpdatePayload +} + +func (a *SecurityMonitoringApi) buildUpdateSecurityMonitoringRuleRequest(ctx _context.Context, ruleId string, body SecurityMonitoringRuleUpdatePayload) (apiUpdateSecurityMonitoringRuleRequest, error) { + req := apiUpdateSecurityMonitoringRuleRequest{ + ctx: ctx, + ruleId: ruleId, + body: &body, + } + return req, nil +} + +// UpdateSecurityMonitoringRule Update an existing rule. +// Update an existing rule. When updating `cases`, `queries` or `options`, the whole field +// must be included. For example, when modifying a query all queries must be included. +// Default rules can only be updated to be enabled and to change notifications. +func (a *SecurityMonitoringApi) UpdateSecurityMonitoringRule(ctx _context.Context, ruleId string, body SecurityMonitoringRuleUpdatePayload) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateSecurityMonitoringRuleRequest(ctx, ruleId, body) + if err != nil { + var localVarReturnValue SecurityMonitoringRuleResponse + return localVarReturnValue, nil, err + } + + return a.updateSecurityMonitoringRuleExecute(req) +} + +// updateSecurityMonitoringRuleExecute executes the request. +func (a *SecurityMonitoringApi) updateSecurityMonitoringRuleExecute(r apiUpdateSecurityMonitoringRuleRequest) (SecurityMonitoringRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringRuleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.SecurityMonitoringApi.UpdateSecurityMonitoringRule") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/rules/{rule_id}" + localVarPath = strings.Replace(localVarPath, "{"+"rule_id"+"}", _neturl.PathEscape(common.ParameterToString(r.ruleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewSecurityMonitoringApi Returns NewSecurityMonitoringApi. +func NewSecurityMonitoringApi(client *common.APIClient) *SecurityMonitoringApi { + return &SecurityMonitoringApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_service_accounts.go b/api/v2/datadog/api_service_accounts.go new file mode 100644 index 00000000000..3ba741a5041 --- /dev/null +++ b/api/v2/datadog/api_service_accounts.go @@ -0,0 +1,832 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// ServiceAccountsApi service type +type ServiceAccountsApi common.Service + +type apiCreateServiceAccountApplicationKeyRequest struct { + ctx _context.Context + serviceAccountId string + body *ApplicationKeyCreateRequest +} + +func (a *ServiceAccountsApi) buildCreateServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, body ApplicationKeyCreateRequest) (apiCreateServiceAccountApplicationKeyRequest, error) { + req := apiCreateServiceAccountApplicationKeyRequest{ + ctx: ctx, + serviceAccountId: serviceAccountId, + body: &body, + } + return req, nil +} + +// CreateServiceAccountApplicationKey Create an application key for this service account. +// Create an application key for this service account. +func (a *ServiceAccountsApi) CreateServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, body ApplicationKeyCreateRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildCreateServiceAccountApplicationKeyRequest(ctx, serviceAccountId, body) + if err != nil { + var localVarReturnValue ApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.createServiceAccountApplicationKeyExecute(req) +} + +// createServiceAccountApplicationKeyExecute executes the request. +func (a *ServiceAccountsApi) createServiceAccountApplicationKeyExecute(r apiCreateServiceAccountApplicationKeyRequest) (ApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue ApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.CreateServiceAccountApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys" + localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDeleteServiceAccountApplicationKeyRequest struct { + ctx _context.Context + serviceAccountId string + appKeyId string +} + +func (a *ServiceAccountsApi) buildDeleteServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, appKeyId string) (apiDeleteServiceAccountApplicationKeyRequest, error) { + req := apiDeleteServiceAccountApplicationKeyRequest{ + ctx: ctx, + serviceAccountId: serviceAccountId, + appKeyId: appKeyId, + } + return req, nil +} + +// DeleteServiceAccountApplicationKey Delete an application key for this service account. +// Delete an application key owned by this service account. +func (a *ServiceAccountsApi) DeleteServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, appKeyId string) (*_nethttp.Response, error) { + req, err := a.buildDeleteServiceAccountApplicationKeyRequest(ctx, serviceAccountId, appKeyId) + if err != nil { + return nil, err + } + + return a.deleteServiceAccountApplicationKeyExecute(req) +} + +// deleteServiceAccountApplicationKeyExecute executes the request. +func (a *ServiceAccountsApi) deleteServiceAccountApplicationKeyExecute(r apiDeleteServiceAccountApplicationKeyRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.DeleteServiceAccountApplicationKey") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetServiceAccountApplicationKeyRequest struct { + ctx _context.Context + serviceAccountId string + appKeyId string +} + +func (a *ServiceAccountsApi) buildGetServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, appKeyId string) (apiGetServiceAccountApplicationKeyRequest, error) { + req := apiGetServiceAccountApplicationKeyRequest{ + ctx: ctx, + serviceAccountId: serviceAccountId, + appKeyId: appKeyId, + } + return req, nil +} + +// GetServiceAccountApplicationKey Get one application key for this service account. +// Get an application key owned by this service account. +func (a *ServiceAccountsApi) GetServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, appKeyId string) (PartialApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildGetServiceAccountApplicationKeyRequest(ctx, serviceAccountId, appKeyId) + if err != nil { + var localVarReturnValue PartialApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.getServiceAccountApplicationKeyExecute(req) +} + +// getServiceAccountApplicationKeyExecute executes the request. +func (a *ServiceAccountsApi) getServiceAccountApplicationKeyExecute(r apiGetServiceAccountApplicationKeyRequest) (PartialApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue PartialApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.GetServiceAccountApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListServiceAccountApplicationKeysRequest struct { + ctx _context.Context + serviceAccountId string + pageSize *int64 + pageNumber *int64 + sort *ApplicationKeysSort + filter *string + filterCreatedAtStart *string + filterCreatedAtEnd *string +} + +// ListServiceAccountApplicationKeysOptionalParameters holds optional parameters for ListServiceAccountApplicationKeys. +type ListServiceAccountApplicationKeysOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *ApplicationKeysSort + Filter *string + FilterCreatedAtStart *string + FilterCreatedAtEnd *string +} + +// NewListServiceAccountApplicationKeysOptionalParameters creates an empty struct for parameters. +func NewListServiceAccountApplicationKeysOptionalParameters() *ListServiceAccountApplicationKeysOptionalParameters { + this := ListServiceAccountApplicationKeysOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListServiceAccountApplicationKeysOptionalParameters) WithPageSize(pageSize int64) *ListServiceAccountApplicationKeysOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListServiceAccountApplicationKeysOptionalParameters) WithPageNumber(pageNumber int64) *ListServiceAccountApplicationKeysOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListServiceAccountApplicationKeysOptionalParameters) WithSort(sort ApplicationKeysSort) *ListServiceAccountApplicationKeysOptionalParameters { + r.Sort = &sort + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListServiceAccountApplicationKeysOptionalParameters) WithFilter(filter string) *ListServiceAccountApplicationKeysOptionalParameters { + r.Filter = &filter + return r +} + +// WithFilterCreatedAtStart sets the corresponding parameter name and returns the struct. +func (r *ListServiceAccountApplicationKeysOptionalParameters) WithFilterCreatedAtStart(filterCreatedAtStart string) *ListServiceAccountApplicationKeysOptionalParameters { + r.FilterCreatedAtStart = &filterCreatedAtStart + return r +} + +// WithFilterCreatedAtEnd sets the corresponding parameter name and returns the struct. +func (r *ListServiceAccountApplicationKeysOptionalParameters) WithFilterCreatedAtEnd(filterCreatedAtEnd string) *ListServiceAccountApplicationKeysOptionalParameters { + r.FilterCreatedAtEnd = &filterCreatedAtEnd + return r +} + +func (a *ServiceAccountsApi) buildListServiceAccountApplicationKeysRequest(ctx _context.Context, serviceAccountId string, o ...ListServiceAccountApplicationKeysOptionalParameters) (apiListServiceAccountApplicationKeysRequest, error) { + req := apiListServiceAccountApplicationKeysRequest{ + ctx: ctx, + serviceAccountId: serviceAccountId, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListServiceAccountApplicationKeysOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.filter = o[0].Filter + req.filterCreatedAtStart = o[0].FilterCreatedAtStart + req.filterCreatedAtEnd = o[0].FilterCreatedAtEnd + } + return req, nil +} + +// ListServiceAccountApplicationKeys List application keys for this service account. +// List all application keys available for this service account. +func (a *ServiceAccountsApi) ListServiceAccountApplicationKeys(ctx _context.Context, serviceAccountId string, o ...ListServiceAccountApplicationKeysOptionalParameters) (ListApplicationKeysResponse, *_nethttp.Response, error) { + req, err := a.buildListServiceAccountApplicationKeysRequest(ctx, serviceAccountId, o...) + if err != nil { + var localVarReturnValue ListApplicationKeysResponse + return localVarReturnValue, nil, err + } + + return a.listServiceAccountApplicationKeysExecute(req) +} + +// listServiceAccountApplicationKeysExecute executes the request. +func (a *ServiceAccountsApi) listServiceAccountApplicationKeysExecute(r apiListServiceAccountApplicationKeysRequest) (ListApplicationKeysResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ListApplicationKeysResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.ListServiceAccountApplicationKeys") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys" + localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + if r.filterCreatedAtStart != nil { + localVarQueryParams.Add("filter[created_at][start]", common.ParameterToString(*r.filterCreatedAtStart, "")) + } + if r.filterCreatedAtEnd != nil { + localVarQueryParams.Add("filter[created_at][end]", common.ParameterToString(*r.filterCreatedAtEnd, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateServiceAccountApplicationKeyRequest struct { + ctx _context.Context + serviceAccountId string + appKeyId string + body *ApplicationKeyUpdateRequest +} + +func (a *ServiceAccountsApi) buildUpdateServiceAccountApplicationKeyRequest(ctx _context.Context, serviceAccountId string, appKeyId string, body ApplicationKeyUpdateRequest) (apiUpdateServiceAccountApplicationKeyRequest, error) { + req := apiUpdateServiceAccountApplicationKeyRequest{ + ctx: ctx, + serviceAccountId: serviceAccountId, + appKeyId: appKeyId, + body: &body, + } + return req, nil +} + +// UpdateServiceAccountApplicationKey Edit an application key for this service account. +// Edit an application key owned by this service account. +func (a *ServiceAccountsApi) UpdateServiceAccountApplicationKey(ctx _context.Context, serviceAccountId string, appKeyId string, body ApplicationKeyUpdateRequest) (PartialApplicationKeyResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateServiceAccountApplicationKeyRequest(ctx, serviceAccountId, appKeyId, body) + if err != nil { + var localVarReturnValue PartialApplicationKeyResponse + return localVarReturnValue, nil, err + } + + return a.updateServiceAccountApplicationKeyExecute(req) +} + +// updateServiceAccountApplicationKeyExecute executes the request. +func (a *ServiceAccountsApi) updateServiceAccountApplicationKeyExecute(r apiUpdateServiceAccountApplicationKeyRequest) (PartialApplicationKeyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue PartialApplicationKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.ServiceAccountsApi.UpdateServiceAccountApplicationKey") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/service_accounts/{service_account_id}/application_keys/{app_key_id}" + localVarPath = strings.Replace(localVarPath, "{"+"service_account_id"+"}", _neturl.PathEscape(common.ParameterToString(r.serviceAccountId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"app_key_id"+"}", _neturl.PathEscape(common.ParameterToString(r.appKeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewServiceAccountsApi Returns NewServiceAccountsApi. +func NewServiceAccountsApi(client *common.APIClient) *ServiceAccountsApi { + return &ServiceAccountsApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_usage_metering.go b/api/v2/datadog/api_usage_metering.go new file mode 100644 index 00000000000..84be8da2560 --- /dev/null +++ b/api/v2/datadog/api_usage_metering.go @@ -0,0 +1,1143 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _fmt "fmt" + _ioutil "io/ioutil" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsageMeteringApi service type +type UsageMeteringApi common.Service + +type apiGetCostByOrgRequest struct { + ctx _context.Context + startMonth *time.Time + endMonth *time.Time +} + +// GetCostByOrgOptionalParameters holds optional parameters for GetCostByOrg. +type GetCostByOrgOptionalParameters struct { + EndMonth *time.Time +} + +// NewGetCostByOrgOptionalParameters creates an empty struct for parameters. +func NewGetCostByOrgOptionalParameters() *GetCostByOrgOptionalParameters { + this := GetCostByOrgOptionalParameters{} + return &this +} + +// WithEndMonth sets the corresponding parameter name and returns the struct. +func (r *GetCostByOrgOptionalParameters) WithEndMonth(endMonth time.Time) *GetCostByOrgOptionalParameters { + r.EndMonth = &endMonth + return r +} + +func (a *UsageMeteringApi) buildGetCostByOrgRequest(ctx _context.Context, startMonth time.Time, o ...GetCostByOrgOptionalParameters) (apiGetCostByOrgRequest, error) { + req := apiGetCostByOrgRequest{ + ctx: ctx, + startMonth: &startMonth, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetCostByOrgOptionalParameters is allowed") + } + + if o != nil { + req.endMonth = o[0].EndMonth + } + return req, nil +} + +// GetCostByOrg Get cost across multi-org account. +// Get cost across multi-org account. Cost by org data for a given month becomes available no later than the 16th of the following month. +func (a *UsageMeteringApi) GetCostByOrg(ctx _context.Context, startMonth time.Time, o ...GetCostByOrgOptionalParameters) (CostByOrgResponse, *_nethttp.Response, error) { + req, err := a.buildGetCostByOrgRequest(ctx, startMonth, o...) + if err != nil { + var localVarReturnValue CostByOrgResponse + return localVarReturnValue, nil, err + } + + return a.getCostByOrgExecute(req) +} + +// getCostByOrgExecute executes the request. +func (a *UsageMeteringApi) getCostByOrgExecute(r apiGetCostByOrgRequest) (CostByOrgResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CostByOrgResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetCostByOrg") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/usage/cost_by_org" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startMonth == nil { + return localVarReturnValue, nil, common.ReportError("startMonth is required and must be specified") + } + localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) + if r.endMonth != nil { + localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetEstimatedCostByOrgRequest struct { + ctx _context.Context + view *string + startMonth *time.Time + endMonth *time.Time + startDate *time.Time + endDate *time.Time +} + +// GetEstimatedCostByOrgOptionalParameters holds optional parameters for GetEstimatedCostByOrg. +type GetEstimatedCostByOrgOptionalParameters struct { + StartMonth *time.Time + EndMonth *time.Time + StartDate *time.Time + EndDate *time.Time +} + +// NewGetEstimatedCostByOrgOptionalParameters creates an empty struct for parameters. +func NewGetEstimatedCostByOrgOptionalParameters() *GetEstimatedCostByOrgOptionalParameters { + this := GetEstimatedCostByOrgOptionalParameters{} + return &this +} + +// WithStartMonth sets the corresponding parameter name and returns the struct. +func (r *GetEstimatedCostByOrgOptionalParameters) WithStartMonth(startMonth time.Time) *GetEstimatedCostByOrgOptionalParameters { + r.StartMonth = &startMonth + return r +} + +// WithEndMonth sets the corresponding parameter name and returns the struct. +func (r *GetEstimatedCostByOrgOptionalParameters) WithEndMonth(endMonth time.Time) *GetEstimatedCostByOrgOptionalParameters { + r.EndMonth = &endMonth + return r +} + +// WithStartDate sets the corresponding parameter name and returns the struct. +func (r *GetEstimatedCostByOrgOptionalParameters) WithStartDate(startDate time.Time) *GetEstimatedCostByOrgOptionalParameters { + r.StartDate = &startDate + return r +} + +// WithEndDate sets the corresponding parameter name and returns the struct. +func (r *GetEstimatedCostByOrgOptionalParameters) WithEndDate(endDate time.Time) *GetEstimatedCostByOrgOptionalParameters { + r.EndDate = &endDate + return r +} + +func (a *UsageMeteringApi) buildGetEstimatedCostByOrgRequest(ctx _context.Context, view string, o ...GetEstimatedCostByOrgOptionalParameters) (apiGetEstimatedCostByOrgRequest, error) { + req := apiGetEstimatedCostByOrgRequest{ + ctx: ctx, + view: &view, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetEstimatedCostByOrgOptionalParameters is allowed") + } + + if o != nil { + req.startMonth = o[0].StartMonth + req.endMonth = o[0].EndMonth + req.startDate = o[0].StartDate + req.endDate = o[0].EndDate + } + return req, nil +} + +// GetEstimatedCostByOrg Get estimated cost across your account. +// Get estimated cost across multi-org and single root-org accounts. +// Estimated cost data is only available for the current month and previous month. To access historical costs prior to this, use the /cost_by_org endpoint. +func (a *UsageMeteringApi) GetEstimatedCostByOrg(ctx _context.Context, view string, o ...GetEstimatedCostByOrgOptionalParameters) (CostByOrgResponse, *_nethttp.Response, error) { + req, err := a.buildGetEstimatedCostByOrgRequest(ctx, view, o...) + if err != nil { + var localVarReturnValue CostByOrgResponse + return localVarReturnValue, nil, err + } + + return a.getEstimatedCostByOrgExecute(req) +} + +// getEstimatedCostByOrgExecute executes the request. +func (a *UsageMeteringApi) getEstimatedCostByOrgExecute(r apiGetEstimatedCostByOrgRequest) (CostByOrgResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CostByOrgResponse + ) + + operationId := "v2.GetEstimatedCostByOrg" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetEstimatedCostByOrg") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/usage/estimated_cost" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.view == nil { + return localVarReturnValue, nil, common.ReportError("view is required and must be specified") + } + localVarQueryParams.Add("view", common.ParameterToString(*r.view, "")) + if r.startMonth != nil { + localVarQueryParams.Add("start_month", common.ParameterToString(*r.startMonth, "")) + } + if r.endMonth != nil { + localVarQueryParams.Add("end_month", common.ParameterToString(*r.endMonth, "")) + } + if r.startDate != nil { + localVarQueryParams.Add("start_date", common.ParameterToString(*r.startDate, "")) + } + if r.endDate != nil { + localVarQueryParams.Add("end_date", common.ParameterToString(*r.endDate, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetHourlyUsageRequest struct { + ctx _context.Context + filterTimestampStart *time.Time + filterProductFamilies *string + filterTimestampEnd *time.Time + filterIncludeDescendants *bool + filterVersions *string + pageLimit *int32 + pageNextRecordId *string +} + +// GetHourlyUsageOptionalParameters holds optional parameters for GetHourlyUsage. +type GetHourlyUsageOptionalParameters struct { + FilterTimestampEnd *time.Time + FilterIncludeDescendants *bool + FilterVersions *string + PageLimit *int32 + PageNextRecordId *string +} + +// NewGetHourlyUsageOptionalParameters creates an empty struct for parameters. +func NewGetHourlyUsageOptionalParameters() *GetHourlyUsageOptionalParameters { + this := GetHourlyUsageOptionalParameters{} + return &this +} + +// WithFilterTimestampEnd sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageOptionalParameters) WithFilterTimestampEnd(filterTimestampEnd time.Time) *GetHourlyUsageOptionalParameters { + r.FilterTimestampEnd = &filterTimestampEnd + return r +} + +// WithFilterIncludeDescendants sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageOptionalParameters) WithFilterIncludeDescendants(filterIncludeDescendants bool) *GetHourlyUsageOptionalParameters { + r.FilterIncludeDescendants = &filterIncludeDescendants + return r +} + +// WithFilterVersions sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageOptionalParameters) WithFilterVersions(filterVersions string) *GetHourlyUsageOptionalParameters { + r.FilterVersions = &filterVersions + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageOptionalParameters) WithPageLimit(pageLimit int32) *GetHourlyUsageOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +// WithPageNextRecordId sets the corresponding parameter name and returns the struct. +func (r *GetHourlyUsageOptionalParameters) WithPageNextRecordId(pageNextRecordId string) *GetHourlyUsageOptionalParameters { + r.PageNextRecordId = &pageNextRecordId + return r +} + +func (a *UsageMeteringApi) buildGetHourlyUsageRequest(ctx _context.Context, filterTimestampStart time.Time, filterProductFamilies string, o ...GetHourlyUsageOptionalParameters) (apiGetHourlyUsageRequest, error) { + req := apiGetHourlyUsageRequest{ + ctx: ctx, + filterTimestampStart: &filterTimestampStart, + filterProductFamilies: &filterProductFamilies, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetHourlyUsageOptionalParameters is allowed") + } + + if o != nil { + req.filterTimestampEnd = o[0].FilterTimestampEnd + req.filterIncludeDescendants = o[0].FilterIncludeDescendants + req.filterVersions = o[0].FilterVersions + req.pageLimit = o[0].PageLimit + req.pageNextRecordId = o[0].PageNextRecordId + } + return req, nil +} + +// GetHourlyUsage Get hourly usage by product family. +// Get hourly usage by product family +func (a *UsageMeteringApi) GetHourlyUsage(ctx _context.Context, filterTimestampStart time.Time, filterProductFamilies string, o ...GetHourlyUsageOptionalParameters) (HourlyUsageResponse, *_nethttp.Response, error) { + req, err := a.buildGetHourlyUsageRequest(ctx, filterTimestampStart, filterProductFamilies, o...) + if err != nil { + var localVarReturnValue HourlyUsageResponse + return localVarReturnValue, nil, err + } + + return a.getHourlyUsageExecute(req) +} + +// getHourlyUsageExecute executes the request. +func (a *UsageMeteringApi) getHourlyUsageExecute(r apiGetHourlyUsageRequest) (HourlyUsageResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue HourlyUsageResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetHourlyUsage") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/usage/hourly_usage" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.filterTimestampStart == nil { + return localVarReturnValue, nil, common.ReportError("filterTimestampStart is required and must be specified") + } + if r.filterProductFamilies == nil { + return localVarReturnValue, nil, common.ReportError("filterProductFamilies is required and must be specified") + } + localVarQueryParams.Add("filter[timestamp][start]", common.ParameterToString(*r.filterTimestampStart, "")) + localVarQueryParams.Add("filter[product_families]", common.ParameterToString(*r.filterProductFamilies, "")) + if r.filterTimestampEnd != nil { + localVarQueryParams.Add("filter[timestamp][end]", common.ParameterToString(*r.filterTimestampEnd, "")) + } + if r.filterIncludeDescendants != nil { + localVarQueryParams.Add("filter[include_descendants]", common.ParameterToString(*r.filterIncludeDescendants, "")) + } + if r.filterVersions != nil { + localVarQueryParams.Add("filter[versions]", common.ParameterToString(*r.filterVersions, "")) + } + if r.pageLimit != nil { + localVarQueryParams.Add("page[limit]", common.ParameterToString(*r.pageLimit, "")) + } + if r.pageNextRecordId != nil { + localVarQueryParams.Add("page[next_record_id]", common.ParameterToString(*r.pageNextRecordId, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageApplicationSecurityMonitoringRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageApplicationSecurityMonitoringOptionalParameters holds optional parameters for GetUsageApplicationSecurityMonitoring. +type GetUsageApplicationSecurityMonitoringOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageApplicationSecurityMonitoringOptionalParameters creates an empty struct for parameters. +func NewGetUsageApplicationSecurityMonitoringOptionalParameters() *GetUsageApplicationSecurityMonitoringOptionalParameters { + this := GetUsageApplicationSecurityMonitoringOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageApplicationSecurityMonitoringOptionalParameters) WithEndHr(endHr time.Time) *GetUsageApplicationSecurityMonitoringOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageApplicationSecurityMonitoringRequest(ctx _context.Context, startHr time.Time, o ...GetUsageApplicationSecurityMonitoringOptionalParameters) (apiGetUsageApplicationSecurityMonitoringRequest, error) { + req := apiGetUsageApplicationSecurityMonitoringRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageApplicationSecurityMonitoringOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageApplicationSecurityMonitoring Get hourly usage for application security. +// Get hourly usage for application security . +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family) +func (a *UsageMeteringApi) GetUsageApplicationSecurityMonitoring(ctx _context.Context, startHr time.Time, o ...GetUsageApplicationSecurityMonitoringOptionalParameters) (UsageApplicationSecurityMonitoringResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageApplicationSecurityMonitoringRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageApplicationSecurityMonitoringResponse + return localVarReturnValue, nil, err + } + + return a.getUsageApplicationSecurityMonitoringExecute(req) +} + +// getUsageApplicationSecurityMonitoringExecute executes the request. +func (a *UsageMeteringApi) getUsageApplicationSecurityMonitoringExecute(r apiGetUsageApplicationSecurityMonitoringRequest) (UsageApplicationSecurityMonitoringResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageApplicationSecurityMonitoringResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetUsageApplicationSecurityMonitoring") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/usage/application_security" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageLambdaTracedInvocationsRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageLambdaTracedInvocationsOptionalParameters holds optional parameters for GetUsageLambdaTracedInvocations. +type GetUsageLambdaTracedInvocationsOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageLambdaTracedInvocationsOptionalParameters creates an empty struct for parameters. +func NewGetUsageLambdaTracedInvocationsOptionalParameters() *GetUsageLambdaTracedInvocationsOptionalParameters { + this := GetUsageLambdaTracedInvocationsOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageLambdaTracedInvocationsOptionalParameters) WithEndHr(endHr time.Time) *GetUsageLambdaTracedInvocationsOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageLambdaTracedInvocationsRequest(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaTracedInvocationsOptionalParameters) (apiGetUsageLambdaTracedInvocationsRequest, error) { + req := apiGetUsageLambdaTracedInvocationsRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageLambdaTracedInvocationsOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageLambdaTracedInvocations Get hourly usage for lambda traced invocations. +// Get hourly usage for lambda traced invocations. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family) +func (a *UsageMeteringApi) GetUsageLambdaTracedInvocations(ctx _context.Context, startHr time.Time, o ...GetUsageLambdaTracedInvocationsOptionalParameters) (UsageLambdaTracedInvocationsResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageLambdaTracedInvocationsRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageLambdaTracedInvocationsResponse + return localVarReturnValue, nil, err + } + + return a.getUsageLambdaTracedInvocationsExecute(req) +} + +// getUsageLambdaTracedInvocationsExecute executes the request. +func (a *UsageMeteringApi) getUsageLambdaTracedInvocationsExecute(r apiGetUsageLambdaTracedInvocationsRequest) (UsageLambdaTracedInvocationsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageLambdaTracedInvocationsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetUsageLambdaTracedInvocations") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/usage/lambda_traced_invocations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUsageObservabilityPipelinesRequest struct { + ctx _context.Context + startHr *time.Time + endHr *time.Time +} + +// GetUsageObservabilityPipelinesOptionalParameters holds optional parameters for GetUsageObservabilityPipelines. +type GetUsageObservabilityPipelinesOptionalParameters struct { + EndHr *time.Time +} + +// NewGetUsageObservabilityPipelinesOptionalParameters creates an empty struct for parameters. +func NewGetUsageObservabilityPipelinesOptionalParameters() *GetUsageObservabilityPipelinesOptionalParameters { + this := GetUsageObservabilityPipelinesOptionalParameters{} + return &this +} + +// WithEndHr sets the corresponding parameter name and returns the struct. +func (r *GetUsageObservabilityPipelinesOptionalParameters) WithEndHr(endHr time.Time) *GetUsageObservabilityPipelinesOptionalParameters { + r.EndHr = &endHr + return r +} + +func (a *UsageMeteringApi) buildGetUsageObservabilityPipelinesRequest(ctx _context.Context, startHr time.Time, o ...GetUsageObservabilityPipelinesOptionalParameters) (apiGetUsageObservabilityPipelinesRequest, error) { + req := apiGetUsageObservabilityPipelinesRequest{ + ctx: ctx, + startHr: &startHr, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type GetUsageObservabilityPipelinesOptionalParameters is allowed") + } + + if o != nil { + req.endHr = o[0].EndHr + } + return req, nil +} + +// GetUsageObservabilityPipelines Get hourly usage for observability pipelines. +// Get hourly usage for observability pipelines. +// **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family) +func (a *UsageMeteringApi) GetUsageObservabilityPipelines(ctx _context.Context, startHr time.Time, o ...GetUsageObservabilityPipelinesOptionalParameters) (UsageObservabilityPipelinesResponse, *_nethttp.Response, error) { + req, err := a.buildGetUsageObservabilityPipelinesRequest(ctx, startHr, o...) + if err != nil { + var localVarReturnValue UsageObservabilityPipelinesResponse + return localVarReturnValue, nil, err + } + + return a.getUsageObservabilityPipelinesExecute(req) +} + +// getUsageObservabilityPipelinesExecute executes the request. +func (a *UsageMeteringApi) getUsageObservabilityPipelinesExecute(r apiGetUsageObservabilityPipelinesRequest) (UsageObservabilityPipelinesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsageObservabilityPipelinesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsageMeteringApi.GetUsageObservabilityPipelines") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/usage/observability_pipelines" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.startHr == nil { + return localVarReturnValue, nil, common.ReportError("startHr is required and must be specified") + } + localVarQueryParams.Add("start_hr", common.ParameterToString(*r.startHr, "")) + if r.endHr != nil { + localVarQueryParams.Add("end_hr", common.ParameterToString(*r.endHr, "")) + } + localVarHeaderParams["Accept"] = "application/json;datetime-format=rfc3339" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewUsageMeteringApi Returns NewUsageMeteringApi. +func NewUsageMeteringApi(client *common.APIClient) *UsageMeteringApi { + return &UsageMeteringApi{ + Client: client, + } +} diff --git a/api/v2/datadog/api_users.go b/api/v2/datadog/api_users.go new file mode 100644 index 00000000000..15fd1c4f7ee --- /dev/null +++ b/api/v2/datadog/api_users.go @@ -0,0 +1,1517 @@ +// 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 datadog + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsersApi service type +type UsersApi common.Service + +type apiCreateServiceAccountRequest struct { + ctx _context.Context + body *ServiceAccountCreateRequest +} + +func (a *UsersApi) buildCreateServiceAccountRequest(ctx _context.Context, body ServiceAccountCreateRequest) (apiCreateServiceAccountRequest, error) { + req := apiCreateServiceAccountRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateServiceAccount Create a service account. +// Create a service account for your organization. +func (a *UsersApi) CreateServiceAccount(ctx _context.Context, body ServiceAccountCreateRequest) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildCreateServiceAccountRequest(ctx, body) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.createServiceAccountExecute(req) +} + +// createServiceAccountExecute executes the request. +func (a *UsersApi) createServiceAccountExecute(r apiCreateServiceAccountRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.CreateServiceAccount") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/service_accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiCreateUserRequest struct { + ctx _context.Context + body *UserCreateRequest +} + +func (a *UsersApi) buildCreateUserRequest(ctx _context.Context, body UserCreateRequest) (apiCreateUserRequest, error) { + req := apiCreateUserRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// CreateUser Create a user. +// Create a user for your organization. +func (a *UsersApi) CreateUser(ctx _context.Context, body UserCreateRequest) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildCreateUserRequest(ctx, body) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.createUserExecute(req) +} + +// createUserExecute executes the request. +func (a *UsersApi) createUserExecute(r apiCreateUserRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.CreateUser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiDisableUserRequest struct { + ctx _context.Context + userId string +} + +func (a *UsersApi) buildDisableUserRequest(ctx _context.Context, userId string) (apiDisableUserRequest, error) { + req := apiDisableUserRequest{ + ctx: ctx, + userId: userId, + } + return req, nil +} + +// DisableUser Disable a user. +// Disable a user. Can only be used with an application key belonging +// to an administrator user. +func (a *UsersApi) DisableUser(ctx _context.Context, userId string) (*_nethttp.Response, error) { + req, err := a.buildDisableUserRequest(ctx, userId) + if err != nil { + return nil, err + } + + return a.disableUserExecute(req) +} + +// disableUserExecute executes the request. +func (a *UsersApi) disableUserExecute(r apiDisableUserRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.DisableUser") + if err != nil { + return nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users/{user_id}" + localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type apiGetInvitationRequest struct { + ctx _context.Context + userInvitationUuid string +} + +func (a *UsersApi) buildGetInvitationRequest(ctx _context.Context, userInvitationUuid string) (apiGetInvitationRequest, error) { + req := apiGetInvitationRequest{ + ctx: ctx, + userInvitationUuid: userInvitationUuid, + } + return req, nil +} + +// GetInvitation Get a user invitation. +// Returns a single user invitation by its UUID. +func (a *UsersApi) GetInvitation(ctx _context.Context, userInvitationUuid string) (UserInvitationResponse, *_nethttp.Response, error) { + req, err := a.buildGetInvitationRequest(ctx, userInvitationUuid) + if err != nil { + var localVarReturnValue UserInvitationResponse + return localVarReturnValue, nil, err + } + + return a.getInvitationExecute(req) +} + +// getInvitationExecute executes the request. +func (a *UsersApi) getInvitationExecute(r apiGetInvitationRequest) (UserInvitationResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UserInvitationResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.GetInvitation") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/user_invitations/{user_invitation_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"user_invitation_uuid"+"}", _neturl.PathEscape(common.ParameterToString(r.userInvitationUuid, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiGetUserRequest struct { + ctx _context.Context + userId string +} + +func (a *UsersApi) buildGetUserRequest(ctx _context.Context, userId string) (apiGetUserRequest, error) { + req := apiGetUserRequest{ + ctx: ctx, + userId: userId, + } + return req, nil +} + +// GetUser Get user details. +// Get a user in the organization specified by the user’s `user_id`. +func (a *UsersApi) GetUser(ctx _context.Context, userId string) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildGetUserRequest(ctx, userId) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.getUserExecute(req) +} + +// getUserExecute executes the request. +func (a *UsersApi) getUserExecute(r apiGetUserRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.GetUser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users/{user_id}" + localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListUserOrganizationsRequest struct { + ctx _context.Context + userId string +} + +func (a *UsersApi) buildListUserOrganizationsRequest(ctx _context.Context, userId string) (apiListUserOrganizationsRequest, error) { + req := apiListUserOrganizationsRequest{ + ctx: ctx, + userId: userId, + } + return req, nil +} + +// ListUserOrganizations Get a user organization. +// Get a user organization. Returns the user information and all organizations +// joined by this user. +func (a *UsersApi) ListUserOrganizations(ctx _context.Context, userId string) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildListUserOrganizationsRequest(ctx, userId) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.listUserOrganizationsExecute(req) +} + +// listUserOrganizationsExecute executes the request. +func (a *UsersApi) listUserOrganizationsExecute(r apiListUserOrganizationsRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.ListUserOrganizations") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users/{user_id}/orgs" + localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListUserPermissionsRequest struct { + ctx _context.Context + userId string +} + +func (a *UsersApi) buildListUserPermissionsRequest(ctx _context.Context, userId string) (apiListUserPermissionsRequest, error) { + req := apiListUserPermissionsRequest{ + ctx: ctx, + userId: userId, + } + return req, nil +} + +// ListUserPermissions Get a user permissions. +// Get a user permission set. Returns a list of the user’s permissions +// granted by the associated user's roles. +func (a *UsersApi) ListUserPermissions(ctx _context.Context, userId string) (PermissionsResponse, *_nethttp.Response, error) { + req, err := a.buildListUserPermissionsRequest(ctx, userId) + if err != nil { + var localVarReturnValue PermissionsResponse + return localVarReturnValue, nil, err + } + + return a.listUserPermissionsExecute(req) +} + +// listUserPermissionsExecute executes the request. +func (a *UsersApi) listUserPermissionsExecute(r apiListUserPermissionsRequest) (PermissionsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue PermissionsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.ListUserPermissions") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users/{user_id}/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiListUsersRequest struct { + ctx _context.Context + pageSize *int64 + pageNumber *int64 + sort *string + sortDir *QuerySortOrder + filter *string + filterStatus *string +} + +// ListUsersOptionalParameters holds optional parameters for ListUsers. +type ListUsersOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + Sort *string + SortDir *QuerySortOrder + Filter *string + FilterStatus *string +} + +// NewListUsersOptionalParameters creates an empty struct for parameters. +func NewListUsersOptionalParameters() *ListUsersOptionalParameters { + this := ListUsersOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListUsersOptionalParameters) WithPageSize(pageSize int64) *ListUsersOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListUsersOptionalParameters) WithPageNumber(pageNumber int64) *ListUsersOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListUsersOptionalParameters) WithSort(sort string) *ListUsersOptionalParameters { + r.Sort = &sort + return r +} + +// WithSortDir sets the corresponding parameter name and returns the struct. +func (r *ListUsersOptionalParameters) WithSortDir(sortDir QuerySortOrder) *ListUsersOptionalParameters { + r.SortDir = &sortDir + return r +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListUsersOptionalParameters) WithFilter(filter string) *ListUsersOptionalParameters { + r.Filter = &filter + return r +} + +// WithFilterStatus sets the corresponding parameter name and returns the struct. +func (r *ListUsersOptionalParameters) WithFilterStatus(filterStatus string) *ListUsersOptionalParameters { + r.FilterStatus = &filterStatus + return r +} + +func (a *UsersApi) buildListUsersRequest(ctx _context.Context, o ...ListUsersOptionalParameters) (apiListUsersRequest, error) { + req := apiListUsersRequest{ + ctx: ctx, + } + + if len(o) > 1 { + return req, common.ReportError("only one argument of type ListUsersOptionalParameters is allowed") + } + + if o != nil { + req.pageSize = o[0].PageSize + req.pageNumber = o[0].PageNumber + req.sort = o[0].Sort + req.sortDir = o[0].SortDir + req.filter = o[0].Filter + req.filterStatus = o[0].FilterStatus + } + return req, nil +} + +// ListUsers List all users. +// Get the list of all users in the organization. This list includes +// all users even if they are deactivated or unverified. +func (a *UsersApi) ListUsers(ctx _context.Context, o ...ListUsersOptionalParameters) (UsersResponse, *_nethttp.Response, error) { + req, err := a.buildListUsersRequest(ctx, o...) + if err != nil { + var localVarReturnValue UsersResponse + return localVarReturnValue, nil, err + } + + return a.listUsersExecute(req) +} + +// listUsersExecute executes the request. +func (a *UsersApi) listUsersExecute(r apiListUsersRequest) (UsersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UsersResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.ListUsers") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.pageSize != nil { + localVarQueryParams.Add("page[size]", common.ParameterToString(*r.pageSize, "")) + } + if r.pageNumber != nil { + localVarQueryParams.Add("page[number]", common.ParameterToString(*r.pageNumber, "")) + } + if r.sort != nil { + localVarQueryParams.Add("sort", common.ParameterToString(*r.sort, "")) + } + if r.sortDir != nil { + localVarQueryParams.Add("sort_dir", common.ParameterToString(*r.sortDir, "")) + } + if r.filter != nil { + localVarQueryParams.Add("filter", common.ParameterToString(*r.filter, "")) + } + if r.filterStatus != nil { + localVarQueryParams.Add("filter[status]", common.ParameterToString(*r.filterStatus, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiSendInvitationsRequest struct { + ctx _context.Context + body *UserInvitationsRequest +} + +func (a *UsersApi) buildSendInvitationsRequest(ctx _context.Context, body UserInvitationsRequest) (apiSendInvitationsRequest, error) { + req := apiSendInvitationsRequest{ + ctx: ctx, + body: &body, + } + return req, nil +} + +// SendInvitations Send invitation emails. +// Sends emails to one or more users inviting them to join the organization. +func (a *UsersApi) SendInvitations(ctx _context.Context, body UserInvitationsRequest) (UserInvitationsResponse, *_nethttp.Response, error) { + req, err := a.buildSendInvitationsRequest(ctx, body) + if err != nil { + var localVarReturnValue UserInvitationsResponse + return localVarReturnValue, nil, err + } + + return a.sendInvitationsExecute(req) +} + +// sendInvitationsExecute executes the request. +func (a *UsersApi) sendInvitationsExecute(r apiSendInvitationsRequest) (UserInvitationsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue UserInvitationsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.SendInvitations") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/user_invitations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type apiUpdateUserRequest struct { + ctx _context.Context + userId string + body *UserUpdateRequest +} + +func (a *UsersApi) buildUpdateUserRequest(ctx _context.Context, userId string, body UserUpdateRequest) (apiUpdateUserRequest, error) { + req := apiUpdateUserRequest{ + ctx: ctx, + userId: userId, + body: &body, + } + return req, nil +} + +// UpdateUser Update a user. +// Edit a user. Can only be used with an application key belonging +// to an administrator user. +func (a *UsersApi) UpdateUser(ctx _context.Context, userId string, body UserUpdateRequest) (UserResponse, *_nethttp.Response, error) { + req, err := a.buildUpdateUserRequest(ctx, userId, body) + if err != nil { + var localVarReturnValue UserResponse + return localVarReturnValue, nil, err + } + + return a.updateUserExecute(req) +} + +// updateUserExecute executes the request. +func (a *UsersApi) updateUserExecute(r apiUpdateUserRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "v2.UsersApi.UpdateUser") + if err != nil { + return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users/{user_id}" + localVarPath = strings.Replace(localVarPath, "{"+"user_id"+"}", _neturl.PathEscape(common.ParameterToString(r.userId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, common.ReportError("body is required and must be specified") + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(common.ContextAPIKeys).(map[string]common.APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + 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 + } + if localVarHTTPResponse.StatusCode == 422 { + 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 + } + if 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 := common.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewUsersApi Returns NewUsersApi. +func NewUsersApi(client *common.APIClient) *UsersApi { + return &UsersApi{ + Client: client, + } +} diff --git a/api/v2/datadog/model_api_error_response.go b/api/v2/datadog/model_api_error_response.go new file mode 100644 index 00000000000..54bd4181d1c --- /dev/null +++ b/api/v2/datadog/model_api_error_response.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIErrorResponse API error response. +type APIErrorResponse struct { + // A list of errors. + Errors []string `json:"errors"` + // 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{} +} + +// NewAPIErrorResponse instantiates a new APIErrorResponse 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 NewAPIErrorResponse(errors []string) *APIErrorResponse { + this := APIErrorResponse{} + this.Errors = errors + return &this +} + +// NewAPIErrorResponseWithDefaults instantiates a new APIErrorResponse 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 NewAPIErrorResponseWithDefaults() *APIErrorResponse { + this := APIErrorResponse{} + return &this +} + +// GetErrors returns the Errors field value. +func (o *APIErrorResponse) GetErrors() []string { + if o == nil { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value +// and a boolean to check if the value has been set. +func (o *APIErrorResponse) GetErrorsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Errors, true +} + +// SetErrors sets field value. +func (o *APIErrorResponse) SetErrors(v []string) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["errors"] = o.Errors + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Errors *[]string `json:"errors"` + }{} + all := struct { + Errors []string `json:"errors"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Errors == nil { + return fmt.Errorf("Required field errors missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Errors = all.Errors + return nil +} diff --git a/api/v2/datadog/model_api_key_create_attributes.go b/api/v2/datadog/model_api_key_create_attributes.go new file mode 100644 index 00000000000..620395cd5e5 --- /dev/null +++ b/api/v2/datadog/model_api_key_create_attributes.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeyCreateAttributes Attributes used to create an API Key. +type APIKeyCreateAttributes struct { + // Name of the API key. + Name string `json:"name"` + // 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{} +} + +// NewAPIKeyCreateAttributes instantiates a new APIKeyCreateAttributes 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 NewAPIKeyCreateAttributes(name string) *APIKeyCreateAttributes { + this := APIKeyCreateAttributes{} + this.Name = name + return &this +} + +// NewAPIKeyCreateAttributesWithDefaults instantiates a new APIKeyCreateAttributes 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 NewAPIKeyCreateAttributesWithDefaults() *APIKeyCreateAttributes { + this := APIKeyCreateAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *APIKeyCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *APIKeyCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *APIKeyCreateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_api_key_create_data.go b/api/v2/datadog/model_api_key_create_data.go new file mode 100644 index 00000000000..f7adba36b05 --- /dev/null +++ b/api/v2/datadog/model_api_key_create_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeyCreateData Object used to create an API key. +type APIKeyCreateData struct { + // Attributes used to create an API Key. + Attributes APIKeyCreateAttributes `json:"attributes"` + // API Keys resource type. + Type APIKeysType `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{} +} + +// NewAPIKeyCreateData instantiates a new APIKeyCreateData 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 NewAPIKeyCreateData(attributes APIKeyCreateAttributes, typeVar APIKeysType) *APIKeyCreateData { + this := APIKeyCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAPIKeyCreateDataWithDefaults instantiates a new APIKeyCreateData 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 NewAPIKeyCreateDataWithDefaults() *APIKeyCreateData { + this := APIKeyCreateData{} + var typeVar APIKeysType = APIKEYSTYPE_API_KEYS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *APIKeyCreateData) GetAttributes() APIKeyCreateAttributes { + if o == nil { + var ret APIKeyCreateAttributes + 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 *APIKeyCreateData) GetAttributesOk() (*APIKeyCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *APIKeyCreateData) SetAttributes(v APIKeyCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *APIKeyCreateData) GetType() APIKeysType { + if o == nil { + var ret APIKeysType + 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 *APIKeyCreateData) GetTypeOk() (*APIKeysType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *APIKeyCreateData) SetType(v APIKeysType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *APIKeyCreateAttributes `json:"attributes"` + Type *APIKeysType `json:"type"` + }{} + all := struct { + Attributes APIKeyCreateAttributes `json:"attributes"` + Type APIKeysType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_api_key_create_request.go b/api/v2/datadog/model_api_key_create_request.go new file mode 100644 index 00000000000..f9f014f9dfa --- /dev/null +++ b/api/v2/datadog/model_api_key_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeyCreateRequest Request used to create an API key. +type APIKeyCreateRequest struct { + // Object used to create an API key. + Data APIKeyCreateData `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{} +} + +// NewAPIKeyCreateRequest instantiates a new APIKeyCreateRequest 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 NewAPIKeyCreateRequest(data APIKeyCreateData) *APIKeyCreateRequest { + this := APIKeyCreateRequest{} + this.Data = data + return &this +} + +// NewAPIKeyCreateRequestWithDefaults instantiates a new APIKeyCreateRequest 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 NewAPIKeyCreateRequestWithDefaults() *APIKeyCreateRequest { + this := APIKeyCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *APIKeyCreateRequest) GetData() APIKeyCreateData { + if o == nil { + var ret APIKeyCreateData + 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 *APIKeyCreateRequest) GetDataOk() (*APIKeyCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *APIKeyCreateRequest) SetData(v APIKeyCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *APIKeyCreateData `json:"data"` + }{} + all := struct { + Data APIKeyCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_api_key_relationships.go b/api/v2/datadog/model_api_key_relationships.go new file mode 100644 index 00000000000..ba243d0295e --- /dev/null +++ b/api/v2/datadog/model_api_key_relationships.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// APIKeyRelationships Resources related to the API key. +type APIKeyRelationships struct { + // Relationship to user. + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + // Relationship to user. + ModifiedBy *RelationshipToUser `json:"modified_by,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{} +} + +// NewAPIKeyRelationships instantiates a new APIKeyRelationships 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 NewAPIKeyRelationships() *APIKeyRelationships { + this := APIKeyRelationships{} + return &this +} + +// NewAPIKeyRelationshipsWithDefaults instantiates a new APIKeyRelationships 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 NewAPIKeyRelationshipsWithDefaults() *APIKeyRelationships { + this := APIKeyRelationships{} + return &this +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *APIKeyRelationships) GetCreatedBy() RelationshipToUser { + if o == nil || o.CreatedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIKeyRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *APIKeyRelationships) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. +func (o *APIKeyRelationships) SetCreatedBy(v RelationshipToUser) { + o.CreatedBy = &v +} + +// GetModifiedBy returns the ModifiedBy field value if set, zero value otherwise. +func (o *APIKeyRelationships) GetModifiedBy() RelationshipToUser { + if o == nil || o.ModifiedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.ModifiedBy +} + +// GetModifiedByOk returns a tuple with the ModifiedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIKeyRelationships) GetModifiedByOk() (*RelationshipToUser, bool) { + if o == nil || o.ModifiedBy == nil { + return nil, false + } + return o.ModifiedBy, true +} + +// HasModifiedBy returns a boolean if a field has been set. +func (o *APIKeyRelationships) HasModifiedBy() bool { + if o != nil && o.ModifiedBy != nil { + return true + } + + return false +} + +// SetModifiedBy gets a reference to the given RelationshipToUser and assigns it to the ModifiedBy field. +func (o *APIKeyRelationships) SetModifiedBy(v RelationshipToUser) { + o.ModifiedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.ModifiedBy != nil { + toSerialize["modified_by"] = o.ModifiedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + ModifiedBy *RelationshipToUser `json:"modified_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CreatedBy = all.CreatedBy + if all.ModifiedBy != nil && all.ModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ModifiedBy = all.ModifiedBy + return nil +} diff --git a/api/v2/datadog/model_api_key_response.go b/api/v2/datadog/model_api_key_response.go new file mode 100644 index 00000000000..4c960c53103 --- /dev/null +++ b/api/v2/datadog/model_api_key_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 datadog + +import ( + "encoding/json" +) + +// APIKeyResponse Response for retrieving an API key. +type APIKeyResponse struct { + // Datadog API key. + Data *FullAPIKey `json:"data,omitempty"` + // Array of objects related to the API key. + Included []APIKeyResponseIncludedItem `json:"included,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{} +} + +// NewAPIKeyResponse instantiates a new APIKeyResponse 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 NewAPIKeyResponse() *APIKeyResponse { + this := APIKeyResponse{} + return &this +} + +// NewAPIKeyResponseWithDefaults instantiates a new APIKeyResponse 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 NewAPIKeyResponseWithDefaults() *APIKeyResponse { + this := APIKeyResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *APIKeyResponse) GetData() FullAPIKey { + if o == nil || o.Data == nil { + var ret FullAPIKey + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIKeyResponse) GetDataOk() (*FullAPIKey, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *APIKeyResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given FullAPIKey and assigns it to the Data field. +func (o *APIKeyResponse) SetData(v FullAPIKey) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *APIKeyResponse) GetIncluded() []APIKeyResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []APIKeyResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIKeyResponse) GetIncludedOk() (*[]APIKeyResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *APIKeyResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []APIKeyResponseIncludedItem and assigns it to the Included field. +func (o *APIKeyResponse) SetIncluded(v []APIKeyResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *FullAPIKey `json:"data,omitempty"` + Included []APIKeyResponseIncludedItem `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_api_key_response_included_item.go b/api/v2/datadog/model_api_key_response_included_item.go new file mode 100644 index 00000000000..9b46f8ec954 --- /dev/null +++ b/api/v2/datadog/model_api_key_response_included_item.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// APIKeyResponseIncludedItem - An object related to an API key. +type APIKeyResponseIncludedItem struct { + User *User + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// UserAsAPIKeyResponseIncludedItem is a convenience function that returns User wrapped in APIKeyResponseIncludedItem. +func UserAsAPIKeyResponseIncludedItem(v *User) APIKeyResponseIncludedItem { + return APIKeyResponseIncludedItem{User: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *APIKeyResponseIncludedItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into User + err = json.Unmarshal(data, &obj.User) + if err == nil { + if obj.User != nil && obj.User.UnparsedObject == nil { + jsonUser, _ := json.Marshal(obj.User) + if string(jsonUser) == "{}" { // empty struct + obj.User = nil + } else { + match++ + } + } else { + obj.User = nil + } + } else { + obj.User = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.User = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj APIKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { + if obj.User != nil { + return json.Marshal(&obj.User) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *APIKeyResponseIncludedItem) GetActualInstance() interface{} { + if obj.User != nil { + return obj.User + } + + // all schemas are nil + return nil +} + +// NullableAPIKeyResponseIncludedItem handles when a null is used for APIKeyResponseIncludedItem. +type NullableAPIKeyResponseIncludedItem struct { + value *APIKeyResponseIncludedItem + isSet bool +} + +// Get returns the associated value. +func (v NullableAPIKeyResponseIncludedItem) Get() *APIKeyResponseIncludedItem { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAPIKeyResponseIncludedItem) Set(val *APIKeyResponseIncludedItem) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAPIKeyResponseIncludedItem) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableAPIKeyResponseIncludedItem) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAPIKeyResponseIncludedItem initializes the struct as if Set has been called. +func NewNullableAPIKeyResponseIncludedItem(val *APIKeyResponseIncludedItem) *NullableAPIKeyResponseIncludedItem { + return &NullableAPIKeyResponseIncludedItem{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAPIKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAPIKeyResponseIncludedItem) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_api_key_update_attributes.go b/api/v2/datadog/model_api_key_update_attributes.go new file mode 100644 index 00000000000..60cda5bbce6 --- /dev/null +++ b/api/v2/datadog/model_api_key_update_attributes.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeyUpdateAttributes Attributes used to update an API Key. +type APIKeyUpdateAttributes struct { + // Name of the API key. + Name string `json:"name"` + // 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{} +} + +// NewAPIKeyUpdateAttributes instantiates a new APIKeyUpdateAttributes 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 NewAPIKeyUpdateAttributes(name string) *APIKeyUpdateAttributes { + this := APIKeyUpdateAttributes{} + this.Name = name + return &this +} + +// NewAPIKeyUpdateAttributesWithDefaults instantiates a new APIKeyUpdateAttributes 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 NewAPIKeyUpdateAttributesWithDefaults() *APIKeyUpdateAttributes { + this := APIKeyUpdateAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *APIKeyUpdateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *APIKeyUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *APIKeyUpdateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_api_key_update_data.go b/api/v2/datadog/model_api_key_update_data.go new file mode 100644 index 00000000000..beb2ef122de --- /dev/null +++ b/api/v2/datadog/model_api_key_update_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeyUpdateData Object used to update an API key. +type APIKeyUpdateData struct { + // Attributes used to update an API Key. + Attributes APIKeyUpdateAttributes `json:"attributes"` + // ID of the API key. + Id string `json:"id"` + // API Keys resource type. + Type APIKeysType `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{} +} + +// NewAPIKeyUpdateData instantiates a new APIKeyUpdateData 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 NewAPIKeyUpdateData(attributes APIKeyUpdateAttributes, id string, typeVar APIKeysType) *APIKeyUpdateData { + this := APIKeyUpdateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewAPIKeyUpdateDataWithDefaults instantiates a new APIKeyUpdateData 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 NewAPIKeyUpdateDataWithDefaults() *APIKeyUpdateData { + this := APIKeyUpdateData{} + var typeVar APIKeysType = APIKEYSTYPE_API_KEYS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *APIKeyUpdateData) GetAttributes() APIKeyUpdateAttributes { + if o == nil { + var ret APIKeyUpdateAttributes + 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 *APIKeyUpdateData) GetAttributesOk() (*APIKeyUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *APIKeyUpdateData) SetAttributes(v APIKeyUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *APIKeyUpdateData) 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 *APIKeyUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *APIKeyUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *APIKeyUpdateData) GetType() APIKeysType { + if o == nil { + var ret APIKeysType + 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 *APIKeyUpdateData) GetTypeOk() (*APIKeysType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *APIKeyUpdateData) SetType(v APIKeysType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *APIKeyUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *APIKeysType `json:"type"` + }{} + all := struct { + Attributes APIKeyUpdateAttributes `json:"attributes"` + Id string `json:"id"` + Type APIKeysType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_api_key_update_request.go b/api/v2/datadog/model_api_key_update_request.go new file mode 100644 index 00000000000..11267375397 --- /dev/null +++ b/api/v2/datadog/model_api_key_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeyUpdateRequest Request used to update an API key. +type APIKeyUpdateRequest struct { + // Object used to update an API key. + Data APIKeyUpdateData `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{} +} + +// NewAPIKeyUpdateRequest instantiates a new APIKeyUpdateRequest 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 NewAPIKeyUpdateRequest(data APIKeyUpdateData) *APIKeyUpdateRequest { + this := APIKeyUpdateRequest{} + this.Data = data + return &this +} + +// NewAPIKeyUpdateRequestWithDefaults instantiates a new APIKeyUpdateRequest 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 NewAPIKeyUpdateRequestWithDefaults() *APIKeyUpdateRequest { + this := APIKeyUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *APIKeyUpdateRequest) GetData() APIKeyUpdateData { + if o == nil { + var ret APIKeyUpdateData + 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 *APIKeyUpdateRequest) GetDataOk() (*APIKeyUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *APIKeyUpdateRequest) SetData(v APIKeyUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeyUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *APIKeyUpdateData `json:"data"` + }{} + all := struct { + Data APIKeyUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_api_keys_response.go b/api/v2/datadog/model_api_keys_response.go new file mode 100644 index 00000000000..e73de489cd8 --- /dev/null +++ b/api/v2/datadog/model_api_keys_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// APIKeysResponse Response for a list of API keys. +type APIKeysResponse struct { + // Array of API keys. + Data []PartialAPIKey `json:"data,omitempty"` + // Array of objects related to the API key. + Included []APIKeyResponseIncludedItem `json:"included,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{} +} + +// NewAPIKeysResponse instantiates a new APIKeysResponse 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 NewAPIKeysResponse() *APIKeysResponse { + this := APIKeysResponse{} + return &this +} + +// NewAPIKeysResponseWithDefaults instantiates a new APIKeysResponse 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 NewAPIKeysResponseWithDefaults() *APIKeysResponse { + this := APIKeysResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *APIKeysResponse) GetData() []PartialAPIKey { + if o == nil || o.Data == nil { + var ret []PartialAPIKey + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIKeysResponse) GetDataOk() (*[]PartialAPIKey, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *APIKeysResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []PartialAPIKey and assigns it to the Data field. +func (o *APIKeysResponse) SetData(v []PartialAPIKey) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *APIKeysResponse) GetIncluded() []APIKeyResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []APIKeyResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIKeysResponse) GetIncludedOk() (*[]APIKeyResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *APIKeysResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []APIKeyResponseIncludedItem and assigns it to the Included field. +func (o *APIKeysResponse) SetIncluded(v []APIKeyResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o APIKeysResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *APIKeysResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []PartialAPIKey `json:"data,omitempty"` + Included []APIKeyResponseIncludedItem `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_api_keys_sort.go b/api/v2/datadog/model_api_keys_sort.go new file mode 100644 index 00000000000..c63a04fc70e --- /dev/null +++ b/api/v2/datadog/model_api_keys_sort.go @@ -0,0 +1,121 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeysSort Sorting options +type APIKeysSort string + +// List of APIKeysSort. +const ( + APIKEYSSORT_CREATED_AT_ASCENDING APIKeysSort = "created_at" + APIKEYSSORT_CREATED_AT_DESCENDING APIKeysSort = "-created_at" + APIKEYSSORT_LAST4_ASCENDING APIKeysSort = "last4" + APIKEYSSORT_LAST4_DESCENDING APIKeysSort = "-last4" + APIKEYSSORT_MODIFIED_AT_ASCENDING APIKeysSort = "modified_at" + APIKEYSSORT_MODIFIED_AT_DESCENDING APIKeysSort = "-modified_at" + APIKEYSSORT_NAME_ASCENDING APIKeysSort = "name" + APIKEYSSORT_NAME_DESCENDING APIKeysSort = "-name" +) + +var allowedAPIKeysSortEnumValues = []APIKeysSort{ + APIKEYSSORT_CREATED_AT_ASCENDING, + APIKEYSSORT_CREATED_AT_DESCENDING, + APIKEYSSORT_LAST4_ASCENDING, + APIKEYSSORT_LAST4_DESCENDING, + APIKEYSSORT_MODIFIED_AT_ASCENDING, + APIKEYSSORT_MODIFIED_AT_DESCENDING, + APIKEYSSORT_NAME_ASCENDING, + APIKEYSSORT_NAME_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *APIKeysSort) GetAllowedValues() []APIKeysSort { + return allowedAPIKeysSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *APIKeysSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = APIKeysSort(value) + return nil +} + +// NewAPIKeysSortFromValue returns a pointer to a valid APIKeysSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAPIKeysSortFromValue(v string) (*APIKeysSort, error) { + ev := APIKeysSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for APIKeysSort: valid values are %v", v, allowedAPIKeysSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v APIKeysSort) IsValid() bool { + for _, existing := range allowedAPIKeysSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to APIKeysSort value. +func (v APIKeysSort) Ptr() *APIKeysSort { + return &v +} + +// NullableAPIKeysSort handles when a null is used for APIKeysSort. +type NullableAPIKeysSort struct { + value *APIKeysSort + isSet bool +} + +// Get returns the associated value. +func (v NullableAPIKeysSort) Get() *APIKeysSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAPIKeysSort) Set(val *APIKeysSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAPIKeysSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAPIKeysSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAPIKeysSort initializes the struct as if Set has been called. +func NewNullableAPIKeysSort(val *APIKeysSort) *NullableAPIKeysSort { + return &NullableAPIKeysSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAPIKeysSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAPIKeysSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_api_keys_type.go b/api/v2/datadog/model_api_keys_type.go new file mode 100644 index 00000000000..7a48448c7f3 --- /dev/null +++ b/api/v2/datadog/model_api_keys_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// APIKeysType API Keys resource type. +type APIKeysType string + +// List of APIKeysType. +const ( + APIKEYSTYPE_API_KEYS APIKeysType = "api_keys" +) + +var allowedAPIKeysTypeEnumValues = []APIKeysType{ + APIKEYSTYPE_API_KEYS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *APIKeysType) GetAllowedValues() []APIKeysType { + return allowedAPIKeysTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *APIKeysType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = APIKeysType(value) + return nil +} + +// NewAPIKeysTypeFromValue returns a pointer to a valid APIKeysType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAPIKeysTypeFromValue(v string) (*APIKeysType, error) { + ev := APIKeysType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for APIKeysType: valid values are %v", v, allowedAPIKeysTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v APIKeysType) IsValid() bool { + for _, existing := range allowedAPIKeysTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to APIKeysType value. +func (v APIKeysType) Ptr() *APIKeysType { + return &v +} + +// NullableAPIKeysType handles when a null is used for APIKeysType. +type NullableAPIKeysType struct { + value *APIKeysType + isSet bool +} + +// Get returns the associated value. +func (v NullableAPIKeysType) Get() *APIKeysType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAPIKeysType) Set(val *APIKeysType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAPIKeysType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAPIKeysType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAPIKeysType initializes the struct as if Set has been called. +func NewNullableAPIKeysType(val *APIKeysType) *NullableAPIKeysType { + return &NullableAPIKeysType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAPIKeysType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAPIKeysType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_application_key_create_attributes.go b/api/v2/datadog/model_application_key_create_attributes.go new file mode 100644 index 00000000000..d5b3cc4f80d --- /dev/null +++ b/api/v2/datadog/model_application_key_create_attributes.go @@ -0,0 +1,143 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApplicationKeyCreateAttributes Attributes used to create an application Key. +type ApplicationKeyCreateAttributes struct { + // Name of the application key. + Name string `json:"name"` + // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + Scopes []string `json:"scopes,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{} +} + +// NewApplicationKeyCreateAttributes instantiates a new ApplicationKeyCreateAttributes 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 NewApplicationKeyCreateAttributes(name string) *ApplicationKeyCreateAttributes { + this := ApplicationKeyCreateAttributes{} + this.Name = name + return &this +} + +// NewApplicationKeyCreateAttributesWithDefaults instantiates a new ApplicationKeyCreateAttributes 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 NewApplicationKeyCreateAttributesWithDefaults() *ApplicationKeyCreateAttributes { + this := ApplicationKeyCreateAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *ApplicationKeyCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ApplicationKeyCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ApplicationKeyCreateAttributes) SetName(v string) { + o.Name = v +} + +// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ApplicationKeyCreateAttributes) GetScopes() []string { + if o == nil { + var ret []string + return ret + } + return o.Scopes +} + +// GetScopesOk returns a tuple with the Scopes 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 *ApplicationKeyCreateAttributes) GetScopesOk() (*[]string, bool) { + if o == nil || o.Scopes == nil { + return nil, false + } + return &o.Scopes, true +} + +// HasScopes returns a boolean if a field has been set. +func (o *ApplicationKeyCreateAttributes) HasScopes() bool { + if o != nil && o.Scopes != nil { + return true + } + + return false +} + +// SetScopes gets a reference to the given []string and assigns it to the Scopes field. +func (o *ApplicationKeyCreateAttributes) SetScopes(v []string) { + o.Scopes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + if o.Scopes != nil { + toSerialize["scopes"] = o.Scopes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + Scopes []string `json:"scopes,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Scopes = all.Scopes + return nil +} diff --git a/api/v2/datadog/model_application_key_create_data.go b/api/v2/datadog/model_application_key_create_data.go new file mode 100644 index 00000000000..d5d3f0341d7 --- /dev/null +++ b/api/v2/datadog/model_application_key_create_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApplicationKeyCreateData Object used to create an application key. +type ApplicationKeyCreateData struct { + // Attributes used to create an application Key. + Attributes ApplicationKeyCreateAttributes `json:"attributes"` + // Application Keys resource type. + Type ApplicationKeysType `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{} +} + +// NewApplicationKeyCreateData instantiates a new ApplicationKeyCreateData 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 NewApplicationKeyCreateData(attributes ApplicationKeyCreateAttributes, typeVar ApplicationKeysType) *ApplicationKeyCreateData { + this := ApplicationKeyCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewApplicationKeyCreateDataWithDefaults instantiates a new ApplicationKeyCreateData 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 NewApplicationKeyCreateDataWithDefaults() *ApplicationKeyCreateData { + this := ApplicationKeyCreateData{} + var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *ApplicationKeyCreateData) GetAttributes() ApplicationKeyCreateAttributes { + if o == nil { + var ret ApplicationKeyCreateAttributes + 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 *ApplicationKeyCreateData) GetAttributesOk() (*ApplicationKeyCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *ApplicationKeyCreateData) SetAttributes(v ApplicationKeyCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *ApplicationKeyCreateData) GetType() ApplicationKeysType { + if o == nil { + var ret ApplicationKeysType + 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 *ApplicationKeyCreateData) GetTypeOk() (*ApplicationKeysType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ApplicationKeyCreateData) SetType(v ApplicationKeysType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *ApplicationKeyCreateAttributes `json:"attributes"` + Type *ApplicationKeysType `json:"type"` + }{} + all := struct { + Attributes ApplicationKeyCreateAttributes `json:"attributes"` + Type ApplicationKeysType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_application_key_create_request.go b/api/v2/datadog/model_application_key_create_request.go new file mode 100644 index 00000000000..c0c7f5638c4 --- /dev/null +++ b/api/v2/datadog/model_application_key_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApplicationKeyCreateRequest Request used to create an application key. +type ApplicationKeyCreateRequest struct { + // Object used to create an application key. + Data ApplicationKeyCreateData `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{} +} + +// NewApplicationKeyCreateRequest instantiates a new ApplicationKeyCreateRequest 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 NewApplicationKeyCreateRequest(data ApplicationKeyCreateData) *ApplicationKeyCreateRequest { + this := ApplicationKeyCreateRequest{} + this.Data = data + return &this +} + +// NewApplicationKeyCreateRequestWithDefaults instantiates a new ApplicationKeyCreateRequest 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 NewApplicationKeyCreateRequestWithDefaults() *ApplicationKeyCreateRequest { + this := ApplicationKeyCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *ApplicationKeyCreateRequest) GetData() ApplicationKeyCreateData { + if o == nil { + var ret ApplicationKeyCreateData + 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 *ApplicationKeyCreateRequest) GetDataOk() (*ApplicationKeyCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *ApplicationKeyCreateRequest) SetData(v ApplicationKeyCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *ApplicationKeyCreateData `json:"data"` + }{} + all := struct { + Data ApplicationKeyCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_application_key_relationships.go b/api/v2/datadog/model_application_key_relationships.go new file mode 100644 index 00000000000..9132ac6cee5 --- /dev/null +++ b/api/v2/datadog/model_application_key_relationships.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ApplicationKeyRelationships Resources related to the application key. +type ApplicationKeyRelationships struct { + // Relationship to user. + OwnedBy *RelationshipToUser `json:"owned_by,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{} +} + +// NewApplicationKeyRelationships instantiates a new ApplicationKeyRelationships 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 NewApplicationKeyRelationships() *ApplicationKeyRelationships { + this := ApplicationKeyRelationships{} + return &this +} + +// NewApplicationKeyRelationshipsWithDefaults instantiates a new ApplicationKeyRelationships 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 NewApplicationKeyRelationshipsWithDefaults() *ApplicationKeyRelationships { + this := ApplicationKeyRelationships{} + return &this +} + +// GetOwnedBy returns the OwnedBy field value if set, zero value otherwise. +func (o *ApplicationKeyRelationships) GetOwnedBy() RelationshipToUser { + if o == nil || o.OwnedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.OwnedBy +} + +// GetOwnedByOk returns a tuple with the OwnedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKeyRelationships) GetOwnedByOk() (*RelationshipToUser, bool) { + if o == nil || o.OwnedBy == nil { + return nil, false + } + return o.OwnedBy, true +} + +// HasOwnedBy returns a boolean if a field has been set. +func (o *ApplicationKeyRelationships) HasOwnedBy() bool { + if o != nil && o.OwnedBy != nil { + return true + } + + return false +} + +// SetOwnedBy gets a reference to the given RelationshipToUser and assigns it to the OwnedBy field. +func (o *ApplicationKeyRelationships) SetOwnedBy(v RelationshipToUser) { + o.OwnedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.OwnedBy != nil { + toSerialize["owned_by"] = o.OwnedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + OwnedBy *RelationshipToUser `json:"owned_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.OwnedBy != nil && all.OwnedBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.OwnedBy = all.OwnedBy + return nil +} diff --git a/api/v2/datadog/model_application_key_response.go b/api/v2/datadog/model_application_key_response.go new file mode 100644 index 00000000000..33da8526116 --- /dev/null +++ b/api/v2/datadog/model_application_key_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 datadog + +import ( + "encoding/json" +) + +// ApplicationKeyResponse Response for retrieving an application key. +type ApplicationKeyResponse struct { + // Datadog application key. + Data *FullApplicationKey `json:"data,omitempty"` + // Array of objects related to the application key. + Included []ApplicationKeyResponseIncludedItem `json:"included,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{} +} + +// NewApplicationKeyResponse instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponse() *ApplicationKeyResponse { + this := ApplicationKeyResponse{} + return &this +} + +// NewApplicationKeyResponseWithDefaults instantiates a new ApplicationKeyResponse 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 NewApplicationKeyResponseWithDefaults() *ApplicationKeyResponse { + this := ApplicationKeyResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ApplicationKeyResponse) GetData() FullApplicationKey { + if o == nil || o.Data == nil { + var ret FullApplicationKey + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKeyResponse) GetDataOk() (*FullApplicationKey, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ApplicationKeyResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given FullApplicationKey and assigns it to the Data field. +func (o *ApplicationKeyResponse) SetData(v FullApplicationKey) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *ApplicationKeyResponse) GetIncluded() []ApplicationKeyResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []ApplicationKeyResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKeyResponse) GetIncludedOk() (*[]ApplicationKeyResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *ApplicationKeyResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []ApplicationKeyResponseIncludedItem and assigns it to the Included field. +func (o *ApplicationKeyResponse) SetIncluded(v []ApplicationKeyResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *FullApplicationKey `json:"data,omitempty"` + Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_application_key_response_included_item.go b/api/v2/datadog/model_application_key_response_included_item.go new file mode 100644 index 00000000000..f5bc1c84af0 --- /dev/null +++ b/api/v2/datadog/model_application_key_response_included_item.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ApplicationKeyResponseIncludedItem - An object related to an application key. +type ApplicationKeyResponseIncludedItem struct { + User *User + Role *Role + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// UserAsApplicationKeyResponseIncludedItem is a convenience function that returns User wrapped in ApplicationKeyResponseIncludedItem. +func UserAsApplicationKeyResponseIncludedItem(v *User) ApplicationKeyResponseIncludedItem { + return ApplicationKeyResponseIncludedItem{User: v} +} + +// RoleAsApplicationKeyResponseIncludedItem is a convenience function that returns Role wrapped in ApplicationKeyResponseIncludedItem. +func RoleAsApplicationKeyResponseIncludedItem(v *Role) ApplicationKeyResponseIncludedItem { + return ApplicationKeyResponseIncludedItem{Role: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *ApplicationKeyResponseIncludedItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into User + err = json.Unmarshal(data, &obj.User) + if err == nil { + if obj.User != nil && obj.User.UnparsedObject == nil { + jsonUser, _ := json.Marshal(obj.User) + if string(jsonUser) == "{}" { // empty struct + obj.User = nil + } else { + match++ + } + } else { + obj.User = nil + } + } else { + obj.User = nil + } + + // try to unmarshal data into Role + err = json.Unmarshal(data, &obj.Role) + if err == nil { + if obj.Role != nil && obj.Role.UnparsedObject == nil { + jsonRole, _ := json.Marshal(obj.Role) + if string(jsonRole) == "{}" { // empty struct + obj.Role = nil + } else { + match++ + } + } else { + obj.Role = nil + } + } else { + obj.Role = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.User = nil + obj.Role = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj ApplicationKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { + if obj.User != nil { + return json.Marshal(&obj.User) + } + + if obj.Role != nil { + return json.Marshal(&obj.Role) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *ApplicationKeyResponseIncludedItem) GetActualInstance() interface{} { + if obj.User != nil { + return obj.User + } + + if obj.Role != nil { + return obj.Role + } + + // all schemas are nil + return nil +} + +// NullableApplicationKeyResponseIncludedItem handles when a null is used for ApplicationKeyResponseIncludedItem. +type NullableApplicationKeyResponseIncludedItem struct { + value *ApplicationKeyResponseIncludedItem + isSet bool +} + +// Get returns the associated value. +func (v NullableApplicationKeyResponseIncludedItem) Get() *ApplicationKeyResponseIncludedItem { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableApplicationKeyResponseIncludedItem) Set(val *ApplicationKeyResponseIncludedItem) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableApplicationKeyResponseIncludedItem) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableApplicationKeyResponseIncludedItem) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableApplicationKeyResponseIncludedItem initializes the struct as if Set has been called. +func NewNullableApplicationKeyResponseIncludedItem(val *ApplicationKeyResponseIncludedItem) *NullableApplicationKeyResponseIncludedItem { + return &NullableApplicationKeyResponseIncludedItem{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableApplicationKeyResponseIncludedItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableApplicationKeyResponseIncludedItem) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_application_key_update_attributes.go b/api/v2/datadog/model_application_key_update_attributes.go new file mode 100644 index 00000000000..fdbb286c135 --- /dev/null +++ b/api/v2/datadog/model_application_key_update_attributes.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ApplicationKeyUpdateAttributes Attributes used to update an application Key. +type ApplicationKeyUpdateAttributes struct { + // Name of the application key. + Name *string `json:"name,omitempty"` + // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + Scopes []string `json:"scopes,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{} +} + +// NewApplicationKeyUpdateAttributes instantiates a new ApplicationKeyUpdateAttributes 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 NewApplicationKeyUpdateAttributes() *ApplicationKeyUpdateAttributes { + this := ApplicationKeyUpdateAttributes{} + return &this +} + +// NewApplicationKeyUpdateAttributesWithDefaults instantiates a new ApplicationKeyUpdateAttributes 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 NewApplicationKeyUpdateAttributesWithDefaults() *ApplicationKeyUpdateAttributes { + this := ApplicationKeyUpdateAttributes{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ApplicationKeyUpdateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationKeyUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ApplicationKeyUpdateAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ApplicationKeyUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ApplicationKeyUpdateAttributes) GetScopes() []string { + if o == nil { + var ret []string + return ret + } + return o.Scopes +} + +// GetScopesOk returns a tuple with the Scopes 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 *ApplicationKeyUpdateAttributes) GetScopesOk() (*[]string, bool) { + if o == nil || o.Scopes == nil { + return nil, false + } + return &o.Scopes, true +} + +// HasScopes returns a boolean if a field has been set. +func (o *ApplicationKeyUpdateAttributes) HasScopes() bool { + if o != nil && o.Scopes != nil { + return true + } + + return false +} + +// SetScopes gets a reference to the given []string and assigns it to the Scopes field. +func (o *ApplicationKeyUpdateAttributes) SetScopes(v []string) { + o.Scopes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Scopes != nil { + toSerialize["scopes"] = o.Scopes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Name *string `json:"name,omitempty"` + Scopes []string `json:"scopes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Scopes = all.Scopes + return nil +} diff --git a/api/v2/datadog/model_application_key_update_data.go b/api/v2/datadog/model_application_key_update_data.go new file mode 100644 index 00000000000..7c5f2ef66ea --- /dev/null +++ b/api/v2/datadog/model_application_key_update_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApplicationKeyUpdateData Object used to update an application key. +type ApplicationKeyUpdateData struct { + // Attributes used to update an application Key. + Attributes ApplicationKeyUpdateAttributes `json:"attributes"` + // ID of the application key. + Id string `json:"id"` + // Application Keys resource type. + Type ApplicationKeysType `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{} +} + +// NewApplicationKeyUpdateData instantiates a new ApplicationKeyUpdateData 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 NewApplicationKeyUpdateData(attributes ApplicationKeyUpdateAttributes, id string, typeVar ApplicationKeysType) *ApplicationKeyUpdateData { + this := ApplicationKeyUpdateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewApplicationKeyUpdateDataWithDefaults instantiates a new ApplicationKeyUpdateData 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 NewApplicationKeyUpdateDataWithDefaults() *ApplicationKeyUpdateData { + this := ApplicationKeyUpdateData{} + var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *ApplicationKeyUpdateData) GetAttributes() ApplicationKeyUpdateAttributes { + if o == nil { + var ret ApplicationKeyUpdateAttributes + 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 *ApplicationKeyUpdateData) GetAttributesOk() (*ApplicationKeyUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *ApplicationKeyUpdateData) SetAttributes(v ApplicationKeyUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *ApplicationKeyUpdateData) 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 *ApplicationKeyUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *ApplicationKeyUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *ApplicationKeyUpdateData) GetType() ApplicationKeysType { + if o == nil { + var ret ApplicationKeysType + 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 *ApplicationKeyUpdateData) GetTypeOk() (*ApplicationKeysType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ApplicationKeyUpdateData) SetType(v ApplicationKeysType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *ApplicationKeyUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *ApplicationKeysType `json:"type"` + }{} + all := struct { + Attributes ApplicationKeyUpdateAttributes `json:"attributes"` + Id string `json:"id"` + Type ApplicationKeysType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_application_key_update_request.go b/api/v2/datadog/model_application_key_update_request.go new file mode 100644 index 00000000000..e323417f7a4 --- /dev/null +++ b/api/v2/datadog/model_application_key_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApplicationKeyUpdateRequest Request used to update an application key. +type ApplicationKeyUpdateRequest struct { + // Object used to update an application key. + Data ApplicationKeyUpdateData `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{} +} + +// NewApplicationKeyUpdateRequest instantiates a new ApplicationKeyUpdateRequest 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 NewApplicationKeyUpdateRequest(data ApplicationKeyUpdateData) *ApplicationKeyUpdateRequest { + this := ApplicationKeyUpdateRequest{} + this.Data = data + return &this +} + +// NewApplicationKeyUpdateRequestWithDefaults instantiates a new ApplicationKeyUpdateRequest 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 NewApplicationKeyUpdateRequestWithDefaults() *ApplicationKeyUpdateRequest { + this := ApplicationKeyUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *ApplicationKeyUpdateRequest) GetData() ApplicationKeyUpdateData { + if o == nil { + var ret ApplicationKeyUpdateData + 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 *ApplicationKeyUpdateRequest) GetDataOk() (*ApplicationKeyUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *ApplicationKeyUpdateRequest) SetData(v ApplicationKeyUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ApplicationKeyUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ApplicationKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *ApplicationKeyUpdateData `json:"data"` + }{} + all := struct { + Data ApplicationKeyUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_application_keys_sort.go b/api/v2/datadog/model_application_keys_sort.go new file mode 100644 index 00000000000..1a711a1df49 --- /dev/null +++ b/api/v2/datadog/model_application_keys_sort.go @@ -0,0 +1,117 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApplicationKeysSort Sorting options +type ApplicationKeysSort string + +// List of ApplicationKeysSort. +const ( + APPLICATIONKEYSSORT_CREATED_AT_ASCENDING ApplicationKeysSort = "created_at" + APPLICATIONKEYSSORT_CREATED_AT_DESCENDING ApplicationKeysSort = "-created_at" + APPLICATIONKEYSSORT_LAST4_ASCENDING ApplicationKeysSort = "last4" + APPLICATIONKEYSSORT_LAST4_DESCENDING ApplicationKeysSort = "-last4" + APPLICATIONKEYSSORT_NAME_ASCENDING ApplicationKeysSort = "name" + APPLICATIONKEYSSORT_NAME_DESCENDING ApplicationKeysSort = "-name" +) + +var allowedApplicationKeysSortEnumValues = []ApplicationKeysSort{ + APPLICATIONKEYSSORT_CREATED_AT_ASCENDING, + APPLICATIONKEYSSORT_CREATED_AT_DESCENDING, + APPLICATIONKEYSSORT_LAST4_ASCENDING, + APPLICATIONKEYSSORT_LAST4_DESCENDING, + APPLICATIONKEYSSORT_NAME_ASCENDING, + APPLICATIONKEYSSORT_NAME_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ApplicationKeysSort) GetAllowedValues() []ApplicationKeysSort { + return allowedApplicationKeysSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ApplicationKeysSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ApplicationKeysSort(value) + return nil +} + +// NewApplicationKeysSortFromValue returns a pointer to a valid ApplicationKeysSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewApplicationKeysSortFromValue(v string) (*ApplicationKeysSort, error) { + ev := ApplicationKeysSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ApplicationKeysSort: valid values are %v", v, allowedApplicationKeysSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ApplicationKeysSort) IsValid() bool { + for _, existing := range allowedApplicationKeysSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ApplicationKeysSort value. +func (v ApplicationKeysSort) Ptr() *ApplicationKeysSort { + return &v +} + +// NullableApplicationKeysSort handles when a null is used for ApplicationKeysSort. +type NullableApplicationKeysSort struct { + value *ApplicationKeysSort + isSet bool +} + +// Get returns the associated value. +func (v NullableApplicationKeysSort) Get() *ApplicationKeysSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableApplicationKeysSort) Set(val *ApplicationKeysSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableApplicationKeysSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableApplicationKeysSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableApplicationKeysSort initializes the struct as if Set has been called. +func NewNullableApplicationKeysSort(val *ApplicationKeysSort) *NullableApplicationKeysSort { + return &NullableApplicationKeysSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableApplicationKeysSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableApplicationKeysSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_application_keys_type.go b/api/v2/datadog/model_application_keys_type.go new file mode 100644 index 00000000000..bffcc6be8fb --- /dev/null +++ b/api/v2/datadog/model_application_keys_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ApplicationKeysType Application Keys resource type. +type ApplicationKeysType string + +// List of ApplicationKeysType. +const ( + APPLICATIONKEYSTYPE_APPLICATION_KEYS ApplicationKeysType = "application_keys" +) + +var allowedApplicationKeysTypeEnumValues = []ApplicationKeysType{ + APPLICATIONKEYSTYPE_APPLICATION_KEYS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ApplicationKeysType) GetAllowedValues() []ApplicationKeysType { + return allowedApplicationKeysTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ApplicationKeysType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ApplicationKeysType(value) + return nil +} + +// NewApplicationKeysTypeFromValue returns a pointer to a valid ApplicationKeysType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewApplicationKeysTypeFromValue(v string) (*ApplicationKeysType, error) { + ev := ApplicationKeysType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ApplicationKeysType: valid values are %v", v, allowedApplicationKeysTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ApplicationKeysType) IsValid() bool { + for _, existing := range allowedApplicationKeysTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ApplicationKeysType value. +func (v ApplicationKeysType) Ptr() *ApplicationKeysType { + return &v +} + +// NullableApplicationKeysType handles when a null is used for ApplicationKeysType. +type NullableApplicationKeysType struct { + value *ApplicationKeysType + isSet bool +} + +// Get returns the associated value. +func (v NullableApplicationKeysType) Get() *ApplicationKeysType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableApplicationKeysType) Set(val *ApplicationKeysType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableApplicationKeysType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableApplicationKeysType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableApplicationKeysType initializes the struct as if Set has been called. +func NewNullableApplicationKeysType(val *ApplicationKeysType) *NullableApplicationKeysType { + return &NullableApplicationKeysType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableApplicationKeysType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableApplicationKeysType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_audit_logs_event.go b/api/v2/datadog/model_audit_logs_event.go new file mode 100644 index 00000000000..ce0509b695d --- /dev/null +++ b/api/v2/datadog/model_audit_logs_event.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsEvent Object description of an Audit Logs event after it is processed and stored by Datadog. +type AuditLogsEvent struct { + // JSON object containing all event attributes and their associated values. + Attributes *AuditLogsEventAttributes `json:"attributes,omitempty"` + // Unique ID of the event. + Id *string `json:"id,omitempty"` + // Type of the event. + Type *AuditLogsEventType `json:"type,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{} +} + +// NewAuditLogsEvent instantiates a new AuditLogsEvent 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 NewAuditLogsEvent() *AuditLogsEvent { + this := AuditLogsEvent{} + var typeVar AuditLogsEventType = AUDITLOGSEVENTTYPE_Audit + this.Type = &typeVar + return &this +} + +// NewAuditLogsEventWithDefaults instantiates a new AuditLogsEvent 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 NewAuditLogsEventWithDefaults() *AuditLogsEvent { + this := AuditLogsEvent{} + var typeVar AuditLogsEventType = AUDITLOGSEVENTTYPE_Audit + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AuditLogsEvent) GetAttributes() AuditLogsEventAttributes { + if o == nil || o.Attributes == nil { + var ret AuditLogsEventAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEvent) GetAttributesOk() (*AuditLogsEventAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AuditLogsEvent) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given AuditLogsEventAttributes and assigns it to the Attributes field. +func (o *AuditLogsEvent) SetAttributes(v AuditLogsEventAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AuditLogsEvent) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEvent) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AuditLogsEvent) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AuditLogsEvent) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AuditLogsEvent) GetType() AuditLogsEventType { + if o == nil || o.Type == nil { + var ret AuditLogsEventType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEvent) GetTypeOk() (*AuditLogsEventType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AuditLogsEvent) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given AuditLogsEventType and assigns it to the Type field. +func (o *AuditLogsEvent) SetType(v AuditLogsEventType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsEvent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsEvent) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *AuditLogsEventAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *AuditLogsEventType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_audit_logs_event_attributes.go b/api/v2/datadog/model_audit_logs_event_attributes.go new file mode 100644 index 00000000000..83e11f22f1c --- /dev/null +++ b/api/v2/datadog/model_audit_logs_event_attributes.go @@ -0,0 +1,226 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// AuditLogsEventAttributes JSON object containing all event attributes and their associated values. +type AuditLogsEventAttributes struct { + // JSON object of attributes from Audit Logs events. + Attributes map[string]interface{} `json:"attributes,omitempty"` + // Name of the application or service generating Audit Logs events. + // This name is used to correlate Audit Logs to APM, so make sure you specify the same + // value when you use both products. + Service *string `json:"service,omitempty"` + // Array of tags associated with your event. + Tags []string `json:"tags,omitempty"` + // Timestamp of your event. + Timestamp *time.Time `json:"timestamp,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{} +} + +// NewAuditLogsEventAttributes instantiates a new AuditLogsEventAttributes 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 NewAuditLogsEventAttributes() *AuditLogsEventAttributes { + this := AuditLogsEventAttributes{} + return &this +} + +// NewAuditLogsEventAttributesWithDefaults instantiates a new AuditLogsEventAttributes 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 NewAuditLogsEventAttributesWithDefaults() *AuditLogsEventAttributes { + this := AuditLogsEventAttributes{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AuditLogsEventAttributes) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEventAttributes) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AuditLogsEventAttributes) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *AuditLogsEventAttributes) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *AuditLogsEventAttributes) 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 *AuditLogsEventAttributes) 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 *AuditLogsEventAttributes) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *AuditLogsEventAttributes) SetService(v string) { + o.Service = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *AuditLogsEventAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *AuditLogsEventAttributes) GetTagsOk() (*[]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 *AuditLogsEventAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *AuditLogsEventAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *AuditLogsEventAttributes) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEventAttributes) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *AuditLogsEventAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *AuditLogsEventAttributes) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsEventAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsEventAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` + Service *string `json:"service,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Service = all.Service + o.Tags = all.Tags + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v2/datadog/model_audit_logs_event_type.go b/api/v2/datadog/model_audit_logs_event_type.go new file mode 100644 index 00000000000..3f033a6973a --- /dev/null +++ b/api/v2/datadog/model_audit_logs_event_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuditLogsEventType Type of the event. +type AuditLogsEventType string + +// List of AuditLogsEventType. +const ( + AUDITLOGSEVENTTYPE_Audit AuditLogsEventType = "audit" +) + +var allowedAuditLogsEventTypeEnumValues = []AuditLogsEventType{ + AUDITLOGSEVENTTYPE_Audit, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AuditLogsEventType) GetAllowedValues() []AuditLogsEventType { + return allowedAuditLogsEventTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AuditLogsEventType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AuditLogsEventType(value) + return nil +} + +// NewAuditLogsEventTypeFromValue returns a pointer to a valid AuditLogsEventType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAuditLogsEventTypeFromValue(v string) (*AuditLogsEventType, error) { + ev := AuditLogsEventType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AuditLogsEventType: valid values are %v", v, allowedAuditLogsEventTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AuditLogsEventType) IsValid() bool { + for _, existing := range allowedAuditLogsEventTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AuditLogsEventType value. +func (v AuditLogsEventType) Ptr() *AuditLogsEventType { + return &v +} + +// NullableAuditLogsEventType handles when a null is used for AuditLogsEventType. +type NullableAuditLogsEventType struct { + value *AuditLogsEventType + isSet bool +} + +// Get returns the associated value. +func (v NullableAuditLogsEventType) Get() *AuditLogsEventType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAuditLogsEventType) Set(val *AuditLogsEventType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAuditLogsEventType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAuditLogsEventType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAuditLogsEventType initializes the struct as if Set has been called. +func NewNullableAuditLogsEventType(val *AuditLogsEventType) *NullableAuditLogsEventType { + return &NullableAuditLogsEventType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAuditLogsEventType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAuditLogsEventType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_audit_logs_events_response.go b/api/v2/datadog/model_audit_logs_events_response.go new file mode 100644 index 00000000000..21827458c9c --- /dev/null +++ b/api/v2/datadog/model_audit_logs_events_response.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsEventsResponse Response object with all events matching the request and pagination information. +type AuditLogsEventsResponse struct { + // Array of events matching the request. + Data []AuditLogsEvent `json:"data,omitempty"` + // Links attributes. + Links *AuditLogsResponseLinks `json:"links,omitempty"` + // The metadata associated with a request. + Meta *AuditLogsResponseMetadata `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{} +} + +// NewAuditLogsEventsResponse instantiates a new AuditLogsEventsResponse 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 NewAuditLogsEventsResponse() *AuditLogsEventsResponse { + this := AuditLogsEventsResponse{} + return &this +} + +// NewAuditLogsEventsResponseWithDefaults instantiates a new AuditLogsEventsResponse 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 NewAuditLogsEventsResponseWithDefaults() *AuditLogsEventsResponse { + this := AuditLogsEventsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AuditLogsEventsResponse) GetData() []AuditLogsEvent { + if o == nil || o.Data == nil { + var ret []AuditLogsEvent + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEventsResponse) GetDataOk() (*[]AuditLogsEvent, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AuditLogsEventsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []AuditLogsEvent and assigns it to the Data field. +func (o *AuditLogsEventsResponse) SetData(v []AuditLogsEvent) { + o.Data = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *AuditLogsEventsResponse) GetLinks() AuditLogsResponseLinks { + if o == nil || o.Links == nil { + var ret AuditLogsResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsEventsResponse) GetLinksOk() (*AuditLogsResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *AuditLogsEventsResponse) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +// SetLinks gets a reference to the given AuditLogsResponseLinks and assigns it to the Links field. +func (o *AuditLogsEventsResponse) SetLinks(v AuditLogsResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *AuditLogsEventsResponse) GetMeta() AuditLogsResponseMetadata { + if o == nil || o.Meta == nil { + var ret AuditLogsResponseMetadata + 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 *AuditLogsEventsResponse) GetMetaOk() (*AuditLogsResponseMetadata, 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 *AuditLogsEventsResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given AuditLogsResponseMetadata and assigns it to the Meta field. +func (o *AuditLogsEventsResponse) SetMeta(v AuditLogsResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsEventsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsEventsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []AuditLogsEvent `json:"data,omitempty"` + Links *AuditLogsResponseLinks `json:"links,omitempty"` + Meta *AuditLogsResponseMetadata `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_audit_logs_query_filter.go b/api/v2/datadog/model_audit_logs_query_filter.go new file mode 100644 index 00000000000..4a41a641de8 --- /dev/null +++ b/api/v2/datadog/model_audit_logs_query_filter.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsQueryFilter Search and filter query settings. +type AuditLogsQueryFilter struct { + // Minimum time for the requested events. Supports date, math, and regular timestamps (in milliseconds). + From *string `json:"from,omitempty"` + // Search query following the Audit Logs search syntax. + Query *string `json:"query,omitempty"` + // Maximum time for the requested events. Supports date, math, and regular timestamps (in milliseconds). + To *string `json:"to,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{} +} + +// NewAuditLogsQueryFilter instantiates a new AuditLogsQueryFilter 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 NewAuditLogsQueryFilter() *AuditLogsQueryFilter { + this := AuditLogsQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// NewAuditLogsQueryFilterWithDefaults instantiates a new AuditLogsQueryFilter 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 NewAuditLogsQueryFilterWithDefaults() *AuditLogsQueryFilter { + this := AuditLogsQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *AuditLogsQueryFilter) GetFrom() string { + if o == nil || o.From == nil { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsQueryFilter) GetFromOk() (*string, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *AuditLogsQueryFilter) HasFrom() bool { + if o != nil && o.From != nil { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *AuditLogsQueryFilter) SetFrom(v string) { + o.From = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *AuditLogsQueryFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsQueryFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *AuditLogsQueryFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *AuditLogsQueryFilter) SetQuery(v string) { + o.Query = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *AuditLogsQueryFilter) GetTo() string { + if o == nil || o.To == nil { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsQueryFilter) GetToOk() (*string, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *AuditLogsQueryFilter) HasTo() bool { + if o != nil && o.To != nil { + return true + } + + return false +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *AuditLogsQueryFilter) SetTo(v string) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsQueryFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + From *string `json:"from,omitempty"` + Query *string `json:"query,omitempty"` + To *string `json:"to,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.From = all.From + o.Query = all.Query + o.To = all.To + return nil +} diff --git a/api/v2/datadog/model_audit_logs_query_options.go b/api/v2/datadog/model_audit_logs_query_options.go new file mode 100644 index 00000000000..254040d859c --- /dev/null +++ b/api/v2/datadog/model_audit_logs_query_options.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsQueryOptions Global query options that are used during the query. +// Note: Specify either timezone or time offset, not both. Otherwise, the query fails. +type AuditLogsQueryOptions struct { + // Time offset (in seconds) to apply to the query. + TimeOffset *int64 `json:"time_offset,omitempty"` + // Timezone code. Can be specified as an offset, for example: "UTC+03:00". + Timezone *string `json:"timezone,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{} +} + +// NewAuditLogsQueryOptions instantiates a new AuditLogsQueryOptions 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 NewAuditLogsQueryOptions() *AuditLogsQueryOptions { + this := AuditLogsQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewAuditLogsQueryOptionsWithDefaults instantiates a new AuditLogsQueryOptions 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 NewAuditLogsQueryOptionsWithDefaults() *AuditLogsQueryOptions { + this := AuditLogsQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. +func (o *AuditLogsQueryOptions) GetTimeOffset() int64 { + if o == nil || o.TimeOffset == nil { + var ret int64 + return ret + } + return *o.TimeOffset +} + +// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsQueryOptions) GetTimeOffsetOk() (*int64, bool) { + if o == nil || o.TimeOffset == nil { + return nil, false + } + return o.TimeOffset, true +} + +// HasTimeOffset returns a boolean if a field has been set. +func (o *AuditLogsQueryOptions) HasTimeOffset() bool { + if o != nil && o.TimeOffset != nil { + return true + } + + return false +} + +// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. +func (o *AuditLogsQueryOptions) SetTimeOffset(v int64) { + o.TimeOffset = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *AuditLogsQueryOptions) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsQueryOptions) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *AuditLogsQueryOptions) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *AuditLogsQueryOptions) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsQueryOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TimeOffset != nil { + toSerialize["time_offset"] = o.TimeOffset + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TimeOffset *int64 `json:"time_offset,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TimeOffset = all.TimeOffset + o.Timezone = all.Timezone + return nil +} diff --git a/api/v2/datadog/model_audit_logs_query_page_options.go b/api/v2/datadog/model_audit_logs_query_page_options.go new file mode 100644 index 00000000000..6737782e72d --- /dev/null +++ b/api/v2/datadog/model_audit_logs_query_page_options.go @@ -0,0 +1,145 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsQueryPageOptions Paging attributes for listing events. +type AuditLogsQueryPageOptions struct { + // List following results with a cursor provided in the previous query. + Cursor *string `json:"cursor,omitempty"` + // Maximum number of events in the response. + Limit *int32 `json:"limit,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{} +} + +// NewAuditLogsQueryPageOptions instantiates a new AuditLogsQueryPageOptions 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 NewAuditLogsQueryPageOptions() *AuditLogsQueryPageOptions { + this := AuditLogsQueryPageOptions{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// NewAuditLogsQueryPageOptionsWithDefaults instantiates a new AuditLogsQueryPageOptions 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 NewAuditLogsQueryPageOptionsWithDefaults() *AuditLogsQueryPageOptions { + this := AuditLogsQueryPageOptions{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *AuditLogsQueryPageOptions) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsQueryPageOptions) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *AuditLogsQueryPageOptions) HasCursor() bool { + if o != nil && o.Cursor != nil { + return true + } + + return false +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *AuditLogsQueryPageOptions) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *AuditLogsQueryPageOptions) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsQueryPageOptions) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *AuditLogsQueryPageOptions) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *AuditLogsQueryPageOptions) SetLimit(v int32) { + o.Limit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsQueryPageOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int32 `json:"limit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cursor = all.Cursor + o.Limit = all.Limit + return nil +} diff --git a/api/v2/datadog/model_audit_logs_response_links.go b/api/v2/datadog/model_audit_logs_response_links.go new file mode 100644 index 00000000000..fcff6df9300 --- /dev/null +++ b/api/v2/datadog/model_audit_logs_response_links.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsResponseLinks Links attributes. +type AuditLogsResponseLinks struct { + // Link for the next set of results. Note that the request can also be made using the + // POST endpoint. + Next *string `json:"next,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{} +} + +// NewAuditLogsResponseLinks instantiates a new AuditLogsResponseLinks 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 NewAuditLogsResponseLinks() *AuditLogsResponseLinks { + this := AuditLogsResponseLinks{} + return &this +} + +// NewAuditLogsResponseLinksWithDefaults instantiates a new AuditLogsResponseLinks 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 NewAuditLogsResponseLinksWithDefaults() *AuditLogsResponseLinks { + this := AuditLogsResponseLinks{} + return &this +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *AuditLogsResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *AuditLogsResponseLinks) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *AuditLogsResponseLinks) SetNext(v string) { + o.Next = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Next *string `json:"next,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Next = all.Next + return nil +} diff --git a/api/v2/datadog/model_audit_logs_response_metadata.go b/api/v2/datadog/model_audit_logs_response_metadata.go new file mode 100644 index 00000000000..c6efbd6bae5 --- /dev/null +++ b/api/v2/datadog/model_audit_logs_response_metadata.go @@ -0,0 +1,274 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsResponseMetadata The metadata associated with a request. +type AuditLogsResponseMetadata struct { + // Time elapsed in milliseconds. + Elapsed *int64 `json:"elapsed,omitempty"` + // Paging attributes. + Page *AuditLogsResponsePage `json:"page,omitempty"` + // The identifier of the request. + RequestId *string `json:"request_id,omitempty"` + // The status of the response. + Status *AuditLogsResponseStatus `json:"status,omitempty"` + // A list of warnings (non-fatal errors) encountered. Partial results may return if + // warnings are present in the response. + Warnings []AuditLogsWarning `json:"warnings,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{} +} + +// NewAuditLogsResponseMetadata instantiates a new AuditLogsResponseMetadata 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 NewAuditLogsResponseMetadata() *AuditLogsResponseMetadata { + this := AuditLogsResponseMetadata{} + return &this +} + +// NewAuditLogsResponseMetadataWithDefaults instantiates a new AuditLogsResponseMetadata 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 NewAuditLogsResponseMetadataWithDefaults() *AuditLogsResponseMetadata { + this := AuditLogsResponseMetadata{} + return &this +} + +// GetElapsed returns the Elapsed field value if set, zero value otherwise. +func (o *AuditLogsResponseMetadata) GetElapsed() int64 { + if o == nil || o.Elapsed == nil { + var ret int64 + return ret + } + return *o.Elapsed +} + +// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsResponseMetadata) GetElapsedOk() (*int64, bool) { + if o == nil || o.Elapsed == nil { + return nil, false + } + return o.Elapsed, true +} + +// HasElapsed returns a boolean if a field has been set. +func (o *AuditLogsResponseMetadata) HasElapsed() bool { + if o != nil && o.Elapsed != nil { + return true + } + + return false +} + +// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. +func (o *AuditLogsResponseMetadata) SetElapsed(v int64) { + o.Elapsed = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *AuditLogsResponseMetadata) GetPage() AuditLogsResponsePage { + if o == nil || o.Page == nil { + var ret AuditLogsResponsePage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsResponseMetadata) GetPageOk() (*AuditLogsResponsePage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *AuditLogsResponseMetadata) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given AuditLogsResponsePage and assigns it to the Page field. +func (o *AuditLogsResponseMetadata) SetPage(v AuditLogsResponsePage) { + o.Page = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *AuditLogsResponseMetadata) GetRequestId() string { + if o == nil || o.RequestId == nil { + var ret string + return ret + } + return *o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsResponseMetadata) GetRequestIdOk() (*string, bool) { + if o == nil || o.RequestId == nil { + return nil, false + } + return o.RequestId, true +} + +// HasRequestId returns a boolean if a field has been set. +func (o *AuditLogsResponseMetadata) HasRequestId() bool { + if o != nil && o.RequestId != nil { + return true + } + + return false +} + +// SetRequestId gets a reference to the given string and assigns it to the RequestId field. +func (o *AuditLogsResponseMetadata) SetRequestId(v string) { + o.RequestId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *AuditLogsResponseMetadata) GetStatus() AuditLogsResponseStatus { + if o == nil || o.Status == nil { + var ret AuditLogsResponseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsResponseMetadata) GetStatusOk() (*AuditLogsResponseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *AuditLogsResponseMetadata) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given AuditLogsResponseStatus and assigns it to the Status field. +func (o *AuditLogsResponseMetadata) SetStatus(v AuditLogsResponseStatus) { + o.Status = &v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *AuditLogsResponseMetadata) GetWarnings() []AuditLogsWarning { + if o == nil || o.Warnings == nil { + var ret []AuditLogsWarning + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsResponseMetadata) GetWarningsOk() (*[]AuditLogsWarning, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *AuditLogsResponseMetadata) HasWarnings() bool { + if o != nil && o.Warnings != nil { + return true + } + + return false +} + +// SetWarnings gets a reference to the given []AuditLogsWarning and assigns it to the Warnings field. +func (o *AuditLogsResponseMetadata) SetWarnings(v []AuditLogsWarning) { + o.Warnings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Elapsed != nil { + toSerialize["elapsed"] = o.Elapsed + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Elapsed *int64 `json:"elapsed,omitempty"` + Page *AuditLogsResponsePage `json:"page,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Status *AuditLogsResponseStatus `json:"status,omitempty"` + Warnings []AuditLogsWarning `json:"warnings,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Elapsed = all.Elapsed + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.RequestId = all.RequestId + o.Status = all.Status + o.Warnings = all.Warnings + return nil +} diff --git a/api/v2/datadog/model_audit_logs_response_page.go b/api/v2/datadog/model_audit_logs_response_page.go new file mode 100644 index 00000000000..0297e70856f --- /dev/null +++ b/api/v2/datadog/model_audit_logs_response_page.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 datadog + +import ( + "encoding/json" +) + +// AuditLogsResponsePage Paging attributes. +type AuditLogsResponsePage struct { + // The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of `page[cursor]`. + After *string `json:"after,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{} +} + +// NewAuditLogsResponsePage instantiates a new AuditLogsResponsePage 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 NewAuditLogsResponsePage() *AuditLogsResponsePage { + this := AuditLogsResponsePage{} + return &this +} + +// NewAuditLogsResponsePageWithDefaults instantiates a new AuditLogsResponsePage 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 NewAuditLogsResponsePageWithDefaults() *AuditLogsResponsePage { + this := AuditLogsResponsePage{} + return &this +} + +// GetAfter returns the After field value if set, zero value otherwise. +func (o *AuditLogsResponsePage) GetAfter() string { + if o == nil || o.After == nil { + var ret string + return ret + } + return *o.After +} + +// GetAfterOk returns a tuple with the After field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsResponsePage) GetAfterOk() (*string, bool) { + if o == nil || o.After == nil { + return nil, false + } + return o.After, true +} + +// HasAfter returns a boolean if a field has been set. +func (o *AuditLogsResponsePage) HasAfter() bool { + if o != nil && o.After != nil { + return true + } + + return false +} + +// SetAfter gets a reference to the given string and assigns it to the After field. +func (o *AuditLogsResponsePage) SetAfter(v string) { + o.After = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsResponsePage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.After != nil { + toSerialize["after"] = o.After + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsResponsePage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + After *string `json:"after,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.After = all.After + return nil +} diff --git a/api/v2/datadog/model_audit_logs_response_status.go b/api/v2/datadog/model_audit_logs_response_status.go new file mode 100644 index 00000000000..acdfce587e6 --- /dev/null +++ b/api/v2/datadog/model_audit_logs_response_status.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuditLogsResponseStatus The status of the response. +type AuditLogsResponseStatus string + +// List of AuditLogsResponseStatus. +const ( + AUDITLOGSRESPONSESTATUS_DONE AuditLogsResponseStatus = "done" + AUDITLOGSRESPONSESTATUS_TIMEOUT AuditLogsResponseStatus = "timeout" +) + +var allowedAuditLogsResponseStatusEnumValues = []AuditLogsResponseStatus{ + AUDITLOGSRESPONSESTATUS_DONE, + AUDITLOGSRESPONSESTATUS_TIMEOUT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AuditLogsResponseStatus) GetAllowedValues() []AuditLogsResponseStatus { + return allowedAuditLogsResponseStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AuditLogsResponseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AuditLogsResponseStatus(value) + return nil +} + +// NewAuditLogsResponseStatusFromValue returns a pointer to a valid AuditLogsResponseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAuditLogsResponseStatusFromValue(v string) (*AuditLogsResponseStatus, error) { + ev := AuditLogsResponseStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AuditLogsResponseStatus: valid values are %v", v, allowedAuditLogsResponseStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AuditLogsResponseStatus) IsValid() bool { + for _, existing := range allowedAuditLogsResponseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AuditLogsResponseStatus value. +func (v AuditLogsResponseStatus) Ptr() *AuditLogsResponseStatus { + return &v +} + +// NullableAuditLogsResponseStatus handles when a null is used for AuditLogsResponseStatus. +type NullableAuditLogsResponseStatus struct { + value *AuditLogsResponseStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableAuditLogsResponseStatus) Get() *AuditLogsResponseStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAuditLogsResponseStatus) Set(val *AuditLogsResponseStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAuditLogsResponseStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAuditLogsResponseStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAuditLogsResponseStatus initializes the struct as if Set has been called. +func NewNullableAuditLogsResponseStatus(val *AuditLogsResponseStatus) *NullableAuditLogsResponseStatus { + return &NullableAuditLogsResponseStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAuditLogsResponseStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAuditLogsResponseStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_audit_logs_search_events_request.go b/api/v2/datadog/model_audit_logs_search_events_request.go new file mode 100644 index 00000000000..6fede6ae845 --- /dev/null +++ b/api/v2/datadog/model_audit_logs_search_events_request.go @@ -0,0 +1,249 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsSearchEventsRequest The request for a Audit Logs events list. +type AuditLogsSearchEventsRequest struct { + // Search and filter query settings. + Filter *AuditLogsQueryFilter `json:"filter,omitempty"` + // Global query options that are used during the query. + // Note: Specify either timezone or time offset, not both. Otherwise, the query fails. + Options *AuditLogsQueryOptions `json:"options,omitempty"` + // Paging attributes for listing events. + Page *AuditLogsQueryPageOptions `json:"page,omitempty"` + // Sort parameters when querying events. + Sort *AuditLogsSort `json:"sort,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{} +} + +// NewAuditLogsSearchEventsRequest instantiates a new AuditLogsSearchEventsRequest 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 NewAuditLogsSearchEventsRequest() *AuditLogsSearchEventsRequest { + this := AuditLogsSearchEventsRequest{} + return &this +} + +// NewAuditLogsSearchEventsRequestWithDefaults instantiates a new AuditLogsSearchEventsRequest 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 NewAuditLogsSearchEventsRequestWithDefaults() *AuditLogsSearchEventsRequest { + this := AuditLogsSearchEventsRequest{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *AuditLogsSearchEventsRequest) GetFilter() AuditLogsQueryFilter { + if o == nil || o.Filter == nil { + var ret AuditLogsQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsSearchEventsRequest) GetFilterOk() (*AuditLogsQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *AuditLogsSearchEventsRequest) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given AuditLogsQueryFilter and assigns it to the Filter field. +func (o *AuditLogsSearchEventsRequest) SetFilter(v AuditLogsQueryFilter) { + o.Filter = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *AuditLogsSearchEventsRequest) GetOptions() AuditLogsQueryOptions { + if o == nil || o.Options == nil { + var ret AuditLogsQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsSearchEventsRequest) GetOptionsOk() (*AuditLogsQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *AuditLogsSearchEventsRequest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given AuditLogsQueryOptions and assigns it to the Options field. +func (o *AuditLogsSearchEventsRequest) SetOptions(v AuditLogsQueryOptions) { + o.Options = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *AuditLogsSearchEventsRequest) GetPage() AuditLogsQueryPageOptions { + if o == nil || o.Page == nil { + var ret AuditLogsQueryPageOptions + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsSearchEventsRequest) GetPageOk() (*AuditLogsQueryPageOptions, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *AuditLogsSearchEventsRequest) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given AuditLogsQueryPageOptions and assigns it to the Page field. +func (o *AuditLogsSearchEventsRequest) SetPage(v AuditLogsQueryPageOptions) { + o.Page = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *AuditLogsSearchEventsRequest) GetSort() AuditLogsSort { + if o == nil || o.Sort == nil { + var ret AuditLogsSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsSearchEventsRequest) GetSortOk() (*AuditLogsSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *AuditLogsSearchEventsRequest) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given AuditLogsSort and assigns it to the Sort field. +func (o *AuditLogsSearchEventsRequest) SetSort(v AuditLogsSort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsSearchEventsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filter *AuditLogsQueryFilter `json:"filter,omitempty"` + Options *AuditLogsQueryOptions `json:"options,omitempty"` + Page *AuditLogsQueryPageOptions `json:"page,omitempty"` + Sort *AuditLogsSort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.Sort = all.Sort + return nil +} diff --git a/api/v2/datadog/model_audit_logs_sort.go b/api/v2/datadog/model_audit_logs_sort.go new file mode 100644 index 00000000000..e3c6b5544f3 --- /dev/null +++ b/api/v2/datadog/model_audit_logs_sort.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuditLogsSort Sort parameters when querying events. +type AuditLogsSort string + +// List of AuditLogsSort. +const ( + AUDITLOGSSORT_TIMESTAMP_ASCENDING AuditLogsSort = "timestamp" + AUDITLOGSSORT_TIMESTAMP_DESCENDING AuditLogsSort = "-timestamp" +) + +var allowedAuditLogsSortEnumValues = []AuditLogsSort{ + AUDITLOGSSORT_TIMESTAMP_ASCENDING, + AUDITLOGSSORT_TIMESTAMP_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AuditLogsSort) GetAllowedValues() []AuditLogsSort { + return allowedAuditLogsSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AuditLogsSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AuditLogsSort(value) + return nil +} + +// NewAuditLogsSortFromValue returns a pointer to a valid AuditLogsSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAuditLogsSortFromValue(v string) (*AuditLogsSort, error) { + ev := AuditLogsSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AuditLogsSort: valid values are %v", v, allowedAuditLogsSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AuditLogsSort) IsValid() bool { + for _, existing := range allowedAuditLogsSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AuditLogsSort value. +func (v AuditLogsSort) Ptr() *AuditLogsSort { + return &v +} + +// NullableAuditLogsSort handles when a null is used for AuditLogsSort. +type NullableAuditLogsSort struct { + value *AuditLogsSort + isSet bool +} + +// Get returns the associated value. +func (v NullableAuditLogsSort) Get() *AuditLogsSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAuditLogsSort) Set(val *AuditLogsSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAuditLogsSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAuditLogsSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAuditLogsSort initializes the struct as if Set has been called. +func NewNullableAuditLogsSort(val *AuditLogsSort) *NullableAuditLogsSort { + return &NullableAuditLogsSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAuditLogsSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAuditLogsSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_audit_logs_warning.go b/api/v2/datadog/model_audit_logs_warning.go new file mode 100644 index 00000000000..4c13b686989 --- /dev/null +++ b/api/v2/datadog/model_audit_logs_warning.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuditLogsWarning Warning message indicating something that went wrong with the query. +type AuditLogsWarning struct { + // Unique code for this type of warning. + Code *string `json:"code,omitempty"` + // Detailed explanation of this specific warning. + Detail *string `json:"detail,omitempty"` + // Short human-readable summary of the warning. + Title *string `json:"title,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{} +} + +// NewAuditLogsWarning instantiates a new AuditLogsWarning 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 NewAuditLogsWarning() *AuditLogsWarning { + this := AuditLogsWarning{} + return &this +} + +// NewAuditLogsWarningWithDefaults instantiates a new AuditLogsWarning 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 NewAuditLogsWarningWithDefaults() *AuditLogsWarning { + this := AuditLogsWarning{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *AuditLogsWarning) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsWarning) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *AuditLogsWarning) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *AuditLogsWarning) SetCode(v string) { + o.Code = &v +} + +// GetDetail returns the Detail field value if set, zero value otherwise. +func (o *AuditLogsWarning) GetDetail() string { + if o == nil || o.Detail == nil { + var ret string + return ret + } + return *o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsWarning) GetDetailOk() (*string, bool) { + if o == nil || o.Detail == nil { + return nil, false + } + return o.Detail, true +} + +// HasDetail returns a boolean if a field has been set. +func (o *AuditLogsWarning) HasDetail() bool { + if o != nil && o.Detail != nil { + return true + } + + return false +} + +// SetDetail gets a reference to the given string and assigns it to the Detail field. +func (o *AuditLogsWarning) SetDetail(v string) { + o.Detail = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *AuditLogsWarning) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogsWarning) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *AuditLogsWarning) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *AuditLogsWarning) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuditLogsWarning) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Detail != nil { + toSerialize["detail"] = o.Detail + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuditLogsWarning) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *string `json:"code,omitempty"` + Detail *string `json:"detail,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Detail = all.Detail + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping.go b/api/v2/datadog/model_auth_n_mapping.go new file mode 100644 index 00000000000..6d9ba35d857 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping.go @@ -0,0 +1,238 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuthNMapping The AuthN Mapping object returned by API. +type AuthNMapping struct { + // Attributes of AuthN Mapping. + Attributes *AuthNMappingAttributes `json:"attributes,omitempty"` + // ID of the AuthN Mapping. + Id string `json:"id"` + // All relationships associated with AuthN Mapping. + Relationships *AuthNMappingRelationships `json:"relationships,omitempty"` + // AuthN Mappings resource type. + Type AuthNMappingsType `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{} +} + +// NewAuthNMapping instantiates a new AuthNMapping 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 NewAuthNMapping(id string, typeVar AuthNMappingsType) *AuthNMapping { + this := AuthNMapping{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewAuthNMappingWithDefaults instantiates a new AuthNMapping 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 NewAuthNMappingWithDefaults() *AuthNMapping { + this := AuthNMapping{} + var typeVar AuthNMappingsType = AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AuthNMapping) GetAttributes() AuthNMappingAttributes { + if o == nil || o.Attributes == nil { + var ret AuthNMappingAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMapping) GetAttributesOk() (*AuthNMappingAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AuthNMapping) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given AuthNMappingAttributes and assigns it to the Attributes field. +func (o *AuthNMapping) SetAttributes(v AuthNMappingAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *AuthNMapping) 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 *AuthNMapping) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AuthNMapping) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *AuthNMapping) GetRelationships() AuthNMappingRelationships { + if o == nil || o.Relationships == nil { + var ret AuthNMappingRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMapping) GetRelationshipsOk() (*AuthNMappingRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *AuthNMapping) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given AuthNMappingRelationships and assigns it to the Relationships field. +func (o *AuthNMapping) SetRelationships(v AuthNMappingRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *AuthNMapping) GetType() AuthNMappingsType { + if o == nil { + var ret AuthNMappingsType + 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 *AuthNMapping) GetTypeOk() (*AuthNMappingsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AuthNMapping) SetType(v AuthNMappingsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMapping) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *AuthNMappingsType `json:"type"` + }{} + all := struct { + Attributes *AuthNMappingAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Relationships *AuthNMappingRelationships `json:"relationships,omitempty"` + Type AuthNMappingsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_attributes.go b/api/v2/datadog/model_auth_n_mapping_attributes.go new file mode 100644 index 00000000000..35c9283c982 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_attributes.go @@ -0,0 +1,267 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// AuthNMappingAttributes Attributes of AuthN Mapping. +type AuthNMappingAttributes struct { + // Key portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeKey *string `json:"attribute_key,omitempty"` + // Value portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeValue *string `json:"attribute_value,omitempty"` + // Creation time of the AuthN Mapping. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Time of last AuthN Mapping modification. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // The ID of the SAML assertion attribute. + SamlAssertionAttributeId *string `json:"saml_assertion_attribute_id,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{} +} + +// NewAuthNMappingAttributes instantiates a new AuthNMappingAttributes 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 NewAuthNMappingAttributes() *AuthNMappingAttributes { + this := AuthNMappingAttributes{} + return &this +} + +// NewAuthNMappingAttributesWithDefaults instantiates a new AuthNMappingAttributes 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 NewAuthNMappingAttributesWithDefaults() *AuthNMappingAttributes { + this := AuthNMappingAttributes{} + return &this +} + +// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. +func (o *AuthNMappingAttributes) GetAttributeKey() string { + if o == nil || o.AttributeKey == nil { + var ret string + return ret + } + return *o.AttributeKey +} + +// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingAttributes) GetAttributeKeyOk() (*string, bool) { + if o == nil || o.AttributeKey == nil { + return nil, false + } + return o.AttributeKey, true +} + +// HasAttributeKey returns a boolean if a field has been set. +func (o *AuthNMappingAttributes) HasAttributeKey() bool { + if o != nil && o.AttributeKey != nil { + return true + } + + return false +} + +// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. +func (o *AuthNMappingAttributes) SetAttributeKey(v string) { + o.AttributeKey = &v +} + +// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. +func (o *AuthNMappingAttributes) GetAttributeValue() string { + if o == nil || o.AttributeValue == nil { + var ret string + return ret + } + return *o.AttributeValue +} + +// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingAttributes) GetAttributeValueOk() (*string, bool) { + if o == nil || o.AttributeValue == nil { + return nil, false + } + return o.AttributeValue, true +} + +// HasAttributeValue returns a boolean if a field has been set. +func (o *AuthNMappingAttributes) HasAttributeValue() bool { + if o != nil && o.AttributeValue != nil { + return true + } + + return false +} + +// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. +func (o *AuthNMappingAttributes) SetAttributeValue(v string) { + o.AttributeValue = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AuthNMappingAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AuthNMappingAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AuthNMappingAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *AuthNMappingAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *AuthNMappingAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *AuthNMappingAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetSamlAssertionAttributeId returns the SamlAssertionAttributeId field value if set, zero value otherwise. +func (o *AuthNMappingAttributes) GetSamlAssertionAttributeId() string { + if o == nil || o.SamlAssertionAttributeId == nil { + var ret string + return ret + } + return *o.SamlAssertionAttributeId +} + +// GetSamlAssertionAttributeIdOk returns a tuple with the SamlAssertionAttributeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingAttributes) GetSamlAssertionAttributeIdOk() (*string, bool) { + if o == nil || o.SamlAssertionAttributeId == nil { + return nil, false + } + return o.SamlAssertionAttributeId, true +} + +// HasSamlAssertionAttributeId returns a boolean if a field has been set. +func (o *AuthNMappingAttributes) HasSamlAssertionAttributeId() bool { + if o != nil && o.SamlAssertionAttributeId != nil { + return true + } + + return false +} + +// SetSamlAssertionAttributeId gets a reference to the given string and assigns it to the SamlAssertionAttributeId field. +func (o *AuthNMappingAttributes) SetSamlAssertionAttributeId(v string) { + o.SamlAssertionAttributeId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AttributeKey != nil { + toSerialize["attribute_key"] = o.AttributeKey + } + if o.AttributeValue != nil { + toSerialize["attribute_value"] = o.AttributeValue + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.SamlAssertionAttributeId != nil { + toSerialize["saml_assertion_attribute_id"] = o.SamlAssertionAttributeId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AttributeKey *string `json:"attribute_key,omitempty"` + AttributeValue *string `json:"attribute_value,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + SamlAssertionAttributeId *string `json:"saml_assertion_attribute_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AttributeKey = all.AttributeKey + o.AttributeValue = all.AttributeValue + o.CreatedAt = all.CreatedAt + o.ModifiedAt = all.ModifiedAt + o.SamlAssertionAttributeId = all.SamlAssertionAttributeId + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_create_attributes.go b/api/v2/datadog/model_auth_n_mapping_create_attributes.go new file mode 100644 index 00000000000..59dfd1beb1c --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_create_attributes.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingCreateAttributes Key/Value pair of attributes used for create request. +type AuthNMappingCreateAttributes struct { + // Key portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeKey *string `json:"attribute_key,omitempty"` + // Value portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeValue *string `json:"attribute_value,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{} +} + +// NewAuthNMappingCreateAttributes instantiates a new AuthNMappingCreateAttributes 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 NewAuthNMappingCreateAttributes() *AuthNMappingCreateAttributes { + this := AuthNMappingCreateAttributes{} + return &this +} + +// NewAuthNMappingCreateAttributesWithDefaults instantiates a new AuthNMappingCreateAttributes 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 NewAuthNMappingCreateAttributesWithDefaults() *AuthNMappingCreateAttributes { + this := AuthNMappingCreateAttributes{} + return &this +} + +// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. +func (o *AuthNMappingCreateAttributes) GetAttributeKey() string { + if o == nil || o.AttributeKey == nil { + var ret string + return ret + } + return *o.AttributeKey +} + +// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingCreateAttributes) GetAttributeKeyOk() (*string, bool) { + if o == nil || o.AttributeKey == nil { + return nil, false + } + return o.AttributeKey, true +} + +// HasAttributeKey returns a boolean if a field has been set. +func (o *AuthNMappingCreateAttributes) HasAttributeKey() bool { + if o != nil && o.AttributeKey != nil { + return true + } + + return false +} + +// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. +func (o *AuthNMappingCreateAttributes) SetAttributeKey(v string) { + o.AttributeKey = &v +} + +// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. +func (o *AuthNMappingCreateAttributes) GetAttributeValue() string { + if o == nil || o.AttributeValue == nil { + var ret string + return ret + } + return *o.AttributeValue +} + +// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingCreateAttributes) GetAttributeValueOk() (*string, bool) { + if o == nil || o.AttributeValue == nil { + return nil, false + } + return o.AttributeValue, true +} + +// HasAttributeValue returns a boolean if a field has been set. +func (o *AuthNMappingCreateAttributes) HasAttributeValue() bool { + if o != nil && o.AttributeValue != nil { + return true + } + + return false +} + +// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. +func (o *AuthNMappingCreateAttributes) SetAttributeValue(v string) { + o.AttributeValue = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AttributeKey != nil { + toSerialize["attribute_key"] = o.AttributeKey + } + if o.AttributeValue != nil { + toSerialize["attribute_value"] = o.AttributeValue + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AttributeKey *string `json:"attribute_key,omitempty"` + AttributeValue *string `json:"attribute_value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AttributeKey = all.AttributeKey + o.AttributeValue = all.AttributeValue + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_create_data.go b/api/v2/datadog/model_auth_n_mapping_create_data.go new file mode 100644 index 00000000000..51b145169b2 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_create_data.go @@ -0,0 +1,205 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuthNMappingCreateData Data for creating an AuthN Mapping. +type AuthNMappingCreateData struct { + // Key/Value pair of attributes used for create request. + Attributes *AuthNMappingCreateAttributes `json:"attributes,omitempty"` + // Relationship of AuthN Mapping create object to Role. + Relationships *AuthNMappingCreateRelationships `json:"relationships,omitempty"` + // AuthN Mappings resource type. + Type AuthNMappingsType `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{} +} + +// NewAuthNMappingCreateData instantiates a new AuthNMappingCreateData 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 NewAuthNMappingCreateData(typeVar AuthNMappingsType) *AuthNMappingCreateData { + this := AuthNMappingCreateData{} + this.Type = typeVar + return &this +} + +// NewAuthNMappingCreateDataWithDefaults instantiates a new AuthNMappingCreateData 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 NewAuthNMappingCreateDataWithDefaults() *AuthNMappingCreateData { + this := AuthNMappingCreateData{} + var typeVar AuthNMappingsType = AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AuthNMappingCreateData) GetAttributes() AuthNMappingCreateAttributes { + if o == nil || o.Attributes == nil { + var ret AuthNMappingCreateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingCreateData) GetAttributesOk() (*AuthNMappingCreateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AuthNMappingCreateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given AuthNMappingCreateAttributes and assigns it to the Attributes field. +func (o *AuthNMappingCreateData) SetAttributes(v AuthNMappingCreateAttributes) { + o.Attributes = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *AuthNMappingCreateData) GetRelationships() AuthNMappingCreateRelationships { + if o == nil || o.Relationships == nil { + var ret AuthNMappingCreateRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingCreateData) GetRelationshipsOk() (*AuthNMappingCreateRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *AuthNMappingCreateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given AuthNMappingCreateRelationships and assigns it to the Relationships field. +func (o *AuthNMappingCreateData) SetRelationships(v AuthNMappingCreateRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *AuthNMappingCreateData) GetType() AuthNMappingsType { + if o == nil { + var ret AuthNMappingsType + 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 *AuthNMappingCreateData) GetTypeOk() (*AuthNMappingsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AuthNMappingCreateData) SetType(v AuthNMappingsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *AuthNMappingsType `json:"type"` + }{} + all := struct { + Attributes *AuthNMappingCreateAttributes `json:"attributes,omitempty"` + Relationships *AuthNMappingCreateRelationships `json:"relationships,omitempty"` + Type AuthNMappingsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_create_relationships.go b/api/v2/datadog/model_auth_n_mapping_create_relationships.go new file mode 100644 index 00000000000..9def57522d8 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_create_relationships.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingCreateRelationships Relationship of AuthN Mapping create object to Role. +type AuthNMappingCreateRelationships struct { + // Relationship to role. + Role *RelationshipToRole `json:"role,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{} +} + +// NewAuthNMappingCreateRelationships instantiates a new AuthNMappingCreateRelationships 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 NewAuthNMappingCreateRelationships() *AuthNMappingCreateRelationships { + this := AuthNMappingCreateRelationships{} + return &this +} + +// NewAuthNMappingCreateRelationshipsWithDefaults instantiates a new AuthNMappingCreateRelationships 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 NewAuthNMappingCreateRelationshipsWithDefaults() *AuthNMappingCreateRelationships { + this := AuthNMappingCreateRelationships{} + return &this +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *AuthNMappingCreateRelationships) GetRole() RelationshipToRole { + if o == nil || o.Role == nil { + var ret RelationshipToRole + return ret + } + return *o.Role +} + +// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingCreateRelationships) GetRoleOk() (*RelationshipToRole, bool) { + if o == nil || o.Role == nil { + return nil, false + } + return o.Role, true +} + +// HasRole returns a boolean if a field has been set. +func (o *AuthNMappingCreateRelationships) HasRole() bool { + if o != nil && o.Role != nil { + return true + } + + return false +} + +// SetRole gets a reference to the given RelationshipToRole and assigns it to the Role field. +func (o *AuthNMappingCreateRelationships) SetRole(v RelationshipToRole) { + o.Role = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingCreateRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Role != nil { + toSerialize["role"] = o.Role + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Role *RelationshipToRole `json:"role,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Role = all.Role + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_create_request.go b/api/v2/datadog/model_auth_n_mapping_create_request.go new file mode 100644 index 00000000000..f8ccb2f178e --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuthNMappingCreateRequest Request for creating an AuthN Mapping. +type AuthNMappingCreateRequest struct { + // Data for creating an AuthN Mapping. + Data AuthNMappingCreateData `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{} +} + +// NewAuthNMappingCreateRequest instantiates a new AuthNMappingCreateRequest 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 NewAuthNMappingCreateRequest(data AuthNMappingCreateData) *AuthNMappingCreateRequest { + this := AuthNMappingCreateRequest{} + this.Data = data + return &this +} + +// NewAuthNMappingCreateRequestWithDefaults instantiates a new AuthNMappingCreateRequest 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 NewAuthNMappingCreateRequestWithDefaults() *AuthNMappingCreateRequest { + this := AuthNMappingCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AuthNMappingCreateRequest) GetData() AuthNMappingCreateData { + if o == nil { + var ret AuthNMappingCreateData + 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 *AuthNMappingCreateRequest) GetDataOk() (*AuthNMappingCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AuthNMappingCreateRequest) SetData(v AuthNMappingCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *AuthNMappingCreateData `json:"data"` + }{} + all := struct { + Data AuthNMappingCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_included.go b/api/v2/datadog/model_auth_n_mapping_included.go new file mode 100644 index 00000000000..0558fa1629e --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_included.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingIncluded - Included data in the AuthN Mapping response. +type AuthNMappingIncluded struct { + SAMLAssertionAttribute *SAMLAssertionAttribute + Role *Role + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// SAMLAssertionAttributeAsAuthNMappingIncluded is a convenience function that returns SAMLAssertionAttribute wrapped in AuthNMappingIncluded. +func SAMLAssertionAttributeAsAuthNMappingIncluded(v *SAMLAssertionAttribute) AuthNMappingIncluded { + return AuthNMappingIncluded{SAMLAssertionAttribute: v} +} + +// RoleAsAuthNMappingIncluded is a convenience function that returns Role wrapped in AuthNMappingIncluded. +func RoleAsAuthNMappingIncluded(v *Role) AuthNMappingIncluded { + return AuthNMappingIncluded{Role: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AuthNMappingIncluded) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into SAMLAssertionAttribute + err = json.Unmarshal(data, &obj.SAMLAssertionAttribute) + if err == nil { + if obj.SAMLAssertionAttribute != nil && obj.SAMLAssertionAttribute.UnparsedObject == nil { + jsonSAMLAssertionAttribute, _ := json.Marshal(obj.SAMLAssertionAttribute) + if string(jsonSAMLAssertionAttribute) == "{}" { // empty struct + obj.SAMLAssertionAttribute = nil + } else { + match++ + } + } else { + obj.SAMLAssertionAttribute = nil + } + } else { + obj.SAMLAssertionAttribute = nil + } + + // try to unmarshal data into Role + err = json.Unmarshal(data, &obj.Role) + if err == nil { + if obj.Role != nil && obj.Role.UnparsedObject == nil { + jsonRole, _ := json.Marshal(obj.Role) + if string(jsonRole) == "{}" { // empty struct + obj.Role = nil + } else { + match++ + } + } else { + obj.Role = nil + } + } else { + obj.Role = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.SAMLAssertionAttribute = nil + obj.Role = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AuthNMappingIncluded) MarshalJSON() ([]byte, error) { + if obj.SAMLAssertionAttribute != nil { + return json.Marshal(&obj.SAMLAssertionAttribute) + } + + if obj.Role != nil { + return json.Marshal(&obj.Role) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AuthNMappingIncluded) GetActualInstance() interface{} { + if obj.SAMLAssertionAttribute != nil { + return obj.SAMLAssertionAttribute + } + + if obj.Role != nil { + return obj.Role + } + + // all schemas are nil + return nil +} + +// NullableAuthNMappingIncluded handles when a null is used for AuthNMappingIncluded. +type NullableAuthNMappingIncluded struct { + value *AuthNMappingIncluded + isSet bool +} + +// Get returns the associated value. +func (v NullableAuthNMappingIncluded) Get() *AuthNMappingIncluded { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAuthNMappingIncluded) Set(val *AuthNMappingIncluded) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAuthNMappingIncluded) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableAuthNMappingIncluded) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAuthNMappingIncluded initializes the struct as if Set has been called. +func NewNullableAuthNMappingIncluded(val *AuthNMappingIncluded) *NullableAuthNMappingIncluded { + return &NullableAuthNMappingIncluded{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAuthNMappingIncluded) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAuthNMappingIncluded) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_auth_n_mapping_relationships.go b/api/v2/datadog/model_auth_n_mapping_relationships.go new file mode 100644 index 00000000000..e7ca71a40c2 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_relationships.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingRelationships All relationships associated with AuthN Mapping. +type AuthNMappingRelationships struct { + // Relationship to role. + Role *RelationshipToRole `json:"role,omitempty"` + // AuthN Mapping relationship to SAML Assertion Attribute. + SamlAssertionAttribute *RelationshipToSAMLAssertionAttribute `json:"saml_assertion_attribute,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{} +} + +// NewAuthNMappingRelationships instantiates a new AuthNMappingRelationships 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 NewAuthNMappingRelationships() *AuthNMappingRelationships { + this := AuthNMappingRelationships{} + return &this +} + +// NewAuthNMappingRelationshipsWithDefaults instantiates a new AuthNMappingRelationships 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 NewAuthNMappingRelationshipsWithDefaults() *AuthNMappingRelationships { + this := AuthNMappingRelationships{} + return &this +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *AuthNMappingRelationships) GetRole() RelationshipToRole { + if o == nil || o.Role == nil { + var ret RelationshipToRole + return ret + } + return *o.Role +} + +// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingRelationships) GetRoleOk() (*RelationshipToRole, bool) { + if o == nil || o.Role == nil { + return nil, false + } + return o.Role, true +} + +// HasRole returns a boolean if a field has been set. +func (o *AuthNMappingRelationships) HasRole() bool { + if o != nil && o.Role != nil { + return true + } + + return false +} + +// SetRole gets a reference to the given RelationshipToRole and assigns it to the Role field. +func (o *AuthNMappingRelationships) SetRole(v RelationshipToRole) { + o.Role = &v +} + +// GetSamlAssertionAttribute returns the SamlAssertionAttribute field value if set, zero value otherwise. +func (o *AuthNMappingRelationships) GetSamlAssertionAttribute() RelationshipToSAMLAssertionAttribute { + if o == nil || o.SamlAssertionAttribute == nil { + var ret RelationshipToSAMLAssertionAttribute + return ret + } + return *o.SamlAssertionAttribute +} + +// GetSamlAssertionAttributeOk returns a tuple with the SamlAssertionAttribute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingRelationships) GetSamlAssertionAttributeOk() (*RelationshipToSAMLAssertionAttribute, bool) { + if o == nil || o.SamlAssertionAttribute == nil { + return nil, false + } + return o.SamlAssertionAttribute, true +} + +// HasSamlAssertionAttribute returns a boolean if a field has been set. +func (o *AuthNMappingRelationships) HasSamlAssertionAttribute() bool { + if o != nil && o.SamlAssertionAttribute != nil { + return true + } + + return false +} + +// SetSamlAssertionAttribute gets a reference to the given RelationshipToSAMLAssertionAttribute and assigns it to the SamlAssertionAttribute field. +func (o *AuthNMappingRelationships) SetSamlAssertionAttribute(v RelationshipToSAMLAssertionAttribute) { + o.SamlAssertionAttribute = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Role != nil { + toSerialize["role"] = o.Role + } + if o.SamlAssertionAttribute != nil { + toSerialize["saml_assertion_attribute"] = o.SamlAssertionAttribute + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Role *RelationshipToRole `json:"role,omitempty"` + SamlAssertionAttribute *RelationshipToSAMLAssertionAttribute `json:"saml_assertion_attribute,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Role = all.Role + if all.SamlAssertionAttribute != nil && all.SamlAssertionAttribute.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SamlAssertionAttribute = all.SamlAssertionAttribute + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_response.go b/api/v2/datadog/model_auth_n_mapping_response.go new file mode 100644 index 00000000000..0f7bff080cd --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingResponse AuthN Mapping response from the API. +type AuthNMappingResponse struct { + // The AuthN Mapping object returned by API. + Data *AuthNMapping `json:"data,omitempty"` + // Included data in the AuthN Mapping response. + Included []AuthNMappingIncluded `json:"included,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{} +} + +// NewAuthNMappingResponse instantiates a new AuthNMappingResponse 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 NewAuthNMappingResponse() *AuthNMappingResponse { + this := AuthNMappingResponse{} + return &this +} + +// NewAuthNMappingResponseWithDefaults instantiates a new AuthNMappingResponse 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 NewAuthNMappingResponseWithDefaults() *AuthNMappingResponse { + this := AuthNMappingResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AuthNMappingResponse) GetData() AuthNMapping { + if o == nil || o.Data == nil { + var ret AuthNMapping + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingResponse) GetDataOk() (*AuthNMapping, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AuthNMappingResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given AuthNMapping and assigns it to the Data field. +func (o *AuthNMappingResponse) SetData(v AuthNMapping) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *AuthNMappingResponse) GetIncluded() []AuthNMappingIncluded { + if o == nil || o.Included == nil { + var ret []AuthNMappingIncluded + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingResponse) GetIncludedOk() (*[]AuthNMappingIncluded, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *AuthNMappingResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []AuthNMappingIncluded and assigns it to the Included field. +func (o *AuthNMappingResponse) SetIncluded(v []AuthNMappingIncluded) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *AuthNMapping `json:"data,omitempty"` + Included []AuthNMappingIncluded `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_update_attributes.go b/api/v2/datadog/model_auth_n_mapping_update_attributes.go new file mode 100644 index 00000000000..a9ef3a59740 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_update_attributes.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingUpdateAttributes Key/Value pair of attributes used for update request. +type AuthNMappingUpdateAttributes struct { + // Key portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeKey *string `json:"attribute_key,omitempty"` + // Value portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeValue *string `json:"attribute_value,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{} +} + +// NewAuthNMappingUpdateAttributes instantiates a new AuthNMappingUpdateAttributes 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 NewAuthNMappingUpdateAttributes() *AuthNMappingUpdateAttributes { + this := AuthNMappingUpdateAttributes{} + return &this +} + +// NewAuthNMappingUpdateAttributesWithDefaults instantiates a new AuthNMappingUpdateAttributes 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 NewAuthNMappingUpdateAttributesWithDefaults() *AuthNMappingUpdateAttributes { + this := AuthNMappingUpdateAttributes{} + return &this +} + +// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. +func (o *AuthNMappingUpdateAttributes) GetAttributeKey() string { + if o == nil || o.AttributeKey == nil { + var ret string + return ret + } + return *o.AttributeKey +} + +// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingUpdateAttributes) GetAttributeKeyOk() (*string, bool) { + if o == nil || o.AttributeKey == nil { + return nil, false + } + return o.AttributeKey, true +} + +// HasAttributeKey returns a boolean if a field has been set. +func (o *AuthNMappingUpdateAttributes) HasAttributeKey() bool { + if o != nil && o.AttributeKey != nil { + return true + } + + return false +} + +// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. +func (o *AuthNMappingUpdateAttributes) SetAttributeKey(v string) { + o.AttributeKey = &v +} + +// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. +func (o *AuthNMappingUpdateAttributes) GetAttributeValue() string { + if o == nil || o.AttributeValue == nil { + var ret string + return ret + } + return *o.AttributeValue +} + +// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingUpdateAttributes) GetAttributeValueOk() (*string, bool) { + if o == nil || o.AttributeValue == nil { + return nil, false + } + return o.AttributeValue, true +} + +// HasAttributeValue returns a boolean if a field has been set. +func (o *AuthNMappingUpdateAttributes) HasAttributeValue() bool { + if o != nil && o.AttributeValue != nil { + return true + } + + return false +} + +// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. +func (o *AuthNMappingUpdateAttributes) SetAttributeValue(v string) { + o.AttributeValue = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AttributeKey != nil { + toSerialize["attribute_key"] = o.AttributeKey + } + if o.AttributeValue != nil { + toSerialize["attribute_value"] = o.AttributeValue + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AttributeKey *string `json:"attribute_key,omitempty"` + AttributeValue *string `json:"attribute_value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AttributeKey = all.AttributeKey + o.AttributeValue = all.AttributeValue + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_update_data.go b/api/v2/datadog/model_auth_n_mapping_update_data.go new file mode 100644 index 00000000000..16b8ec41e47 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_update_data.go @@ -0,0 +1,238 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuthNMappingUpdateData Data for updating an AuthN Mapping. +type AuthNMappingUpdateData struct { + // Key/Value pair of attributes used for update request. + Attributes *AuthNMappingUpdateAttributes `json:"attributes,omitempty"` + // ID of the AuthN Mapping. + Id string `json:"id"` + // Relationship of AuthN Mapping update object to Role. + Relationships *AuthNMappingUpdateRelationships `json:"relationships,omitempty"` + // AuthN Mappings resource type. + Type AuthNMappingsType `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{} +} + +// NewAuthNMappingUpdateData instantiates a new AuthNMappingUpdateData 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 NewAuthNMappingUpdateData(id string, typeVar AuthNMappingsType) *AuthNMappingUpdateData { + this := AuthNMappingUpdateData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewAuthNMappingUpdateDataWithDefaults instantiates a new AuthNMappingUpdateData 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 NewAuthNMappingUpdateDataWithDefaults() *AuthNMappingUpdateData { + this := AuthNMappingUpdateData{} + var typeVar AuthNMappingsType = AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AuthNMappingUpdateData) GetAttributes() AuthNMappingUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret AuthNMappingUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingUpdateData) GetAttributesOk() (*AuthNMappingUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AuthNMappingUpdateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given AuthNMappingUpdateAttributes and assigns it to the Attributes field. +func (o *AuthNMappingUpdateData) SetAttributes(v AuthNMappingUpdateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *AuthNMappingUpdateData) 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 *AuthNMappingUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AuthNMappingUpdateData) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *AuthNMappingUpdateData) GetRelationships() AuthNMappingUpdateRelationships { + if o == nil || o.Relationships == nil { + var ret AuthNMappingUpdateRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingUpdateData) GetRelationshipsOk() (*AuthNMappingUpdateRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *AuthNMappingUpdateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given AuthNMappingUpdateRelationships and assigns it to the Relationships field. +func (o *AuthNMappingUpdateData) SetRelationships(v AuthNMappingUpdateRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *AuthNMappingUpdateData) GetType() AuthNMappingsType { + if o == nil { + var ret AuthNMappingsType + 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 *AuthNMappingUpdateData) GetTypeOk() (*AuthNMappingsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AuthNMappingUpdateData) SetType(v AuthNMappingsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *AuthNMappingsType `json:"type"` + }{} + all := struct { + Attributes *AuthNMappingUpdateAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Relationships *AuthNMappingUpdateRelationships `json:"relationships,omitempty"` + Type AuthNMappingsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_update_relationships.go b/api/v2/datadog/model_auth_n_mapping_update_relationships.go new file mode 100644 index 00000000000..33849d11018 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_update_relationships.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingUpdateRelationships Relationship of AuthN Mapping update object to Role. +type AuthNMappingUpdateRelationships struct { + // Relationship to role. + Role *RelationshipToRole `json:"role,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{} +} + +// NewAuthNMappingUpdateRelationships instantiates a new AuthNMappingUpdateRelationships 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 NewAuthNMappingUpdateRelationships() *AuthNMappingUpdateRelationships { + this := AuthNMappingUpdateRelationships{} + return &this +} + +// NewAuthNMappingUpdateRelationshipsWithDefaults instantiates a new AuthNMappingUpdateRelationships 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 NewAuthNMappingUpdateRelationshipsWithDefaults() *AuthNMappingUpdateRelationships { + this := AuthNMappingUpdateRelationships{} + return &this +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *AuthNMappingUpdateRelationships) GetRole() RelationshipToRole { + if o == nil || o.Role == nil { + var ret RelationshipToRole + return ret + } + return *o.Role +} + +// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingUpdateRelationships) GetRoleOk() (*RelationshipToRole, bool) { + if o == nil || o.Role == nil { + return nil, false + } + return o.Role, true +} + +// HasRole returns a boolean if a field has been set. +func (o *AuthNMappingUpdateRelationships) HasRole() bool { + if o != nil && o.Role != nil { + return true + } + + return false +} + +// SetRole gets a reference to the given RelationshipToRole and assigns it to the Role field. +func (o *AuthNMappingUpdateRelationships) SetRole(v RelationshipToRole) { + o.Role = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingUpdateRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Role != nil { + toSerialize["role"] = o.Role + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Role *RelationshipToRole `json:"role,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Role = all.Role + return nil +} diff --git a/api/v2/datadog/model_auth_n_mapping_update_request.go b/api/v2/datadog/model_auth_n_mapping_update_request.go new file mode 100644 index 00000000000..7dbf5215d3d --- /dev/null +++ b/api/v2/datadog/model_auth_n_mapping_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuthNMappingUpdateRequest Request to update an AuthN Mapping. +type AuthNMappingUpdateRequest struct { + // Data for updating an AuthN Mapping. + Data AuthNMappingUpdateData `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{} +} + +// NewAuthNMappingUpdateRequest instantiates a new AuthNMappingUpdateRequest 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 NewAuthNMappingUpdateRequest(data AuthNMappingUpdateData) *AuthNMappingUpdateRequest { + this := AuthNMappingUpdateRequest{} + this.Data = data + return &this +} + +// NewAuthNMappingUpdateRequestWithDefaults instantiates a new AuthNMappingUpdateRequest 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 NewAuthNMappingUpdateRequestWithDefaults() *AuthNMappingUpdateRequest { + this := AuthNMappingUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AuthNMappingUpdateRequest) GetData() AuthNMappingUpdateData { + if o == nil { + var ret AuthNMappingUpdateData + 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 *AuthNMappingUpdateRequest) GetDataOk() (*AuthNMappingUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AuthNMappingUpdateRequest) SetData(v AuthNMappingUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *AuthNMappingUpdateData `json:"data"` + }{} + all := struct { + Data AuthNMappingUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_auth_n_mappings_response.go b/api/v2/datadog/model_auth_n_mappings_response.go new file mode 100644 index 00000000000..07c93c5650d --- /dev/null +++ b/api/v2/datadog/model_auth_n_mappings_response.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// AuthNMappingsResponse Array of AuthN Mappings response. +type AuthNMappingsResponse struct { + // Array of returned AuthN Mappings. + Data []AuthNMapping `json:"data,omitempty"` + // Included data in the AuthN Mapping response. + Included []AuthNMappingIncluded `json:"included,omitempty"` + // Object describing meta attributes of response. + Meta *ResponseMetaAttributes `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{} +} + +// NewAuthNMappingsResponse instantiates a new AuthNMappingsResponse 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 NewAuthNMappingsResponse() *AuthNMappingsResponse { + this := AuthNMappingsResponse{} + return &this +} + +// NewAuthNMappingsResponseWithDefaults instantiates a new AuthNMappingsResponse 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 NewAuthNMappingsResponseWithDefaults() *AuthNMappingsResponse { + this := AuthNMappingsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AuthNMappingsResponse) GetData() []AuthNMapping { + if o == nil || o.Data == nil { + var ret []AuthNMapping + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingsResponse) GetDataOk() (*[]AuthNMapping, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AuthNMappingsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []AuthNMapping and assigns it to the Data field. +func (o *AuthNMappingsResponse) SetData(v []AuthNMapping) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *AuthNMappingsResponse) GetIncluded() []AuthNMappingIncluded { + if o == nil || o.Included == nil { + var ret []AuthNMappingIncluded + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthNMappingsResponse) GetIncludedOk() (*[]AuthNMappingIncluded, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *AuthNMappingsResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []AuthNMappingIncluded and assigns it to the Included field. +func (o *AuthNMappingsResponse) SetIncluded(v []AuthNMappingIncluded) { + o.Included = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *AuthNMappingsResponse) GetMeta() ResponseMetaAttributes { + if o == nil || o.Meta == nil { + var ret ResponseMetaAttributes + 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 *AuthNMappingsResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *AuthNMappingsResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. +func (o *AuthNMappingsResponse) SetMeta(v ResponseMetaAttributes) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AuthNMappingsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AuthNMappingsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []AuthNMapping `json:"data,omitempty"` + Included []AuthNMappingIncluded `json:"included,omitempty"` + Meta *ResponseMetaAttributes `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Included = all.Included + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_auth_n_mappings_sort.go b/api/v2/datadog/model_auth_n_mappings_sort.go new file mode 100644 index 00000000000..1bcffc89b2f --- /dev/null +++ b/api/v2/datadog/model_auth_n_mappings_sort.go @@ -0,0 +1,129 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuthNMappingsSort Sorting options for AuthN Mappings. +type AuthNMappingsSort string + +// List of AuthNMappingsSort. +const ( + AUTHNMAPPINGSSORT_CREATED_AT_ASCENDING AuthNMappingsSort = "created_at" + AUTHNMAPPINGSSORT_CREATED_AT_DESCENDING AuthNMappingsSort = "-created_at" + AUTHNMAPPINGSSORT_ROLE_ID_ASCENDING AuthNMappingsSort = "role_id" + AUTHNMAPPINGSSORT_ROLE_ID_DESCENDING AuthNMappingsSort = "-role_id" + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_ASCENDING AuthNMappingsSort = "saml_assertion_attribute_id" + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_DESCENDING AuthNMappingsSort = "-saml_assertion_attribute_id" + AUTHNMAPPINGSSORT_ROLE_NAME_ASCENDING AuthNMappingsSort = "role.name" + AUTHNMAPPINGSSORT_ROLE_NAME_DESCENDING AuthNMappingsSort = "-role.name" + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_ASCENDING AuthNMappingsSort = "saml_assertion_attribute.attribute_key" + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_DESCENDING AuthNMappingsSort = "-saml_assertion_attribute.attribute_key" + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_ASCENDING AuthNMappingsSort = "saml_assertion_attribute.attribute_value" + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_DESCENDING AuthNMappingsSort = "-saml_assertion_attribute.attribute_value" +) + +var allowedAuthNMappingsSortEnumValues = []AuthNMappingsSort{ + AUTHNMAPPINGSSORT_CREATED_AT_ASCENDING, + AUTHNMAPPINGSSORT_CREATED_AT_DESCENDING, + AUTHNMAPPINGSSORT_ROLE_ID_ASCENDING, + AUTHNMAPPINGSSORT_ROLE_ID_DESCENDING, + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_ASCENDING, + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_ID_DESCENDING, + AUTHNMAPPINGSSORT_ROLE_NAME_ASCENDING, + AUTHNMAPPINGSSORT_ROLE_NAME_DESCENDING, + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_ASCENDING, + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_KEY_DESCENDING, + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_ASCENDING, + AUTHNMAPPINGSSORT_SAML_ASSERTION_ATTRIBUTE_VALUE_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AuthNMappingsSort) GetAllowedValues() []AuthNMappingsSort { + return allowedAuthNMappingsSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AuthNMappingsSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AuthNMappingsSort(value) + return nil +} + +// NewAuthNMappingsSortFromValue returns a pointer to a valid AuthNMappingsSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAuthNMappingsSortFromValue(v string) (*AuthNMappingsSort, error) { + ev := AuthNMappingsSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AuthNMappingsSort: valid values are %v", v, allowedAuthNMappingsSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AuthNMappingsSort) IsValid() bool { + for _, existing := range allowedAuthNMappingsSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AuthNMappingsSort value. +func (v AuthNMappingsSort) Ptr() *AuthNMappingsSort { + return &v +} + +// NullableAuthNMappingsSort handles when a null is used for AuthNMappingsSort. +type NullableAuthNMappingsSort struct { + value *AuthNMappingsSort + isSet bool +} + +// Get returns the associated value. +func (v NullableAuthNMappingsSort) Get() *AuthNMappingsSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAuthNMappingsSort) Set(val *AuthNMappingsSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAuthNMappingsSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAuthNMappingsSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAuthNMappingsSort initializes the struct as if Set has been called. +func NewNullableAuthNMappingsSort(val *AuthNMappingsSort) *NullableAuthNMappingsSort { + return &NullableAuthNMappingsSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAuthNMappingsSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAuthNMappingsSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_auth_n_mappings_type.go b/api/v2/datadog/model_auth_n_mappings_type.go new file mode 100644 index 00000000000..2b1d39786e4 --- /dev/null +++ b/api/v2/datadog/model_auth_n_mappings_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// AuthNMappingsType AuthN Mappings resource type. +type AuthNMappingsType string + +// List of AuthNMappingsType. +const ( + AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS AuthNMappingsType = "authn_mappings" +) + +var allowedAuthNMappingsTypeEnumValues = []AuthNMappingsType{ + AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AuthNMappingsType) GetAllowedValues() []AuthNMappingsType { + return allowedAuthNMappingsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AuthNMappingsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AuthNMappingsType(value) + return nil +} + +// NewAuthNMappingsTypeFromValue returns a pointer to a valid AuthNMappingsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAuthNMappingsTypeFromValue(v string) (*AuthNMappingsType, error) { + ev := AuthNMappingsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AuthNMappingsType: valid values are %v", v, allowedAuthNMappingsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AuthNMappingsType) IsValid() bool { + for _, existing := range allowedAuthNMappingsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AuthNMappingsType value. +func (v AuthNMappingsType) Ptr() *AuthNMappingsType { + return &v +} + +// NullableAuthNMappingsType handles when a null is used for AuthNMappingsType. +type NullableAuthNMappingsType struct { + value *AuthNMappingsType + isSet bool +} + +// Get returns the associated value. +func (v NullableAuthNMappingsType) Get() *AuthNMappingsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAuthNMappingsType) Set(val *AuthNMappingsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAuthNMappingsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableAuthNMappingsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAuthNMappingsType initializes the struct as if Set has been called. +func NewNullableAuthNMappingsType(val *AuthNMappingsType) *NullableAuthNMappingsType { + return &NullableAuthNMappingsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAuthNMappingsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAuthNMappingsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_chargeback_breakdown.go b/api/v2/datadog/model_chargeback_breakdown.go new file mode 100644 index 00000000000..bc88fd17acb --- /dev/null +++ b/api/v2/datadog/model_chargeback_breakdown.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ChargebackBreakdown Charges breakdown. +type ChargebackBreakdown struct { + // The type of charge for a particular product. + ChargeType *string `json:"charge_type,omitempty"` + // The cost for a particular product and charge type during a given month. + Cost *float64 `json:"cost,omitempty"` + // The product for which cost is being reported. + ProductName *string `json:"product_name,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{} +} + +// NewChargebackBreakdown instantiates a new ChargebackBreakdown 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 NewChargebackBreakdown() *ChargebackBreakdown { + this := ChargebackBreakdown{} + return &this +} + +// NewChargebackBreakdownWithDefaults instantiates a new ChargebackBreakdown 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 NewChargebackBreakdownWithDefaults() *ChargebackBreakdown { + this := ChargebackBreakdown{} + return &this +} + +// GetChargeType returns the ChargeType field value if set, zero value otherwise. +func (o *ChargebackBreakdown) GetChargeType() string { + if o == nil || o.ChargeType == nil { + var ret string + return ret + } + return *o.ChargeType +} + +// GetChargeTypeOk returns a tuple with the ChargeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChargebackBreakdown) GetChargeTypeOk() (*string, bool) { + if o == nil || o.ChargeType == nil { + return nil, false + } + return o.ChargeType, true +} + +// HasChargeType returns a boolean if a field has been set. +func (o *ChargebackBreakdown) HasChargeType() bool { + if o != nil && o.ChargeType != nil { + return true + } + + return false +} + +// SetChargeType gets a reference to the given string and assigns it to the ChargeType field. +func (o *ChargebackBreakdown) SetChargeType(v string) { + o.ChargeType = &v +} + +// GetCost returns the Cost field value if set, zero value otherwise. +func (o *ChargebackBreakdown) GetCost() float64 { + if o == nil || o.Cost == nil { + var ret float64 + return ret + } + return *o.Cost +} + +// GetCostOk returns a tuple with the Cost field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChargebackBreakdown) GetCostOk() (*float64, bool) { + if o == nil || o.Cost == nil { + return nil, false + } + return o.Cost, true +} + +// HasCost returns a boolean if a field has been set. +func (o *ChargebackBreakdown) HasCost() bool { + if o != nil && o.Cost != nil { + return true + } + + return false +} + +// SetCost gets a reference to the given float64 and assigns it to the Cost field. +func (o *ChargebackBreakdown) SetCost(v float64) { + o.Cost = &v +} + +// GetProductName returns the ProductName field value if set, zero value otherwise. +func (o *ChargebackBreakdown) GetProductName() string { + if o == nil || o.ProductName == nil { + var ret string + return ret + } + return *o.ProductName +} + +// GetProductNameOk returns a tuple with the ProductName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChargebackBreakdown) GetProductNameOk() (*string, bool) { + if o == nil || o.ProductName == nil { + return nil, false + } + return o.ProductName, true +} + +// HasProductName returns a boolean if a field has been set. +func (o *ChargebackBreakdown) HasProductName() bool { + if o != nil && o.ProductName != nil { + return true + } + + return false +} + +// SetProductName gets a reference to the given string and assigns it to the ProductName field. +func (o *ChargebackBreakdown) SetProductName(v string) { + o.ProductName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ChargebackBreakdown) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ChargeType != nil { + toSerialize["charge_type"] = o.ChargeType + } + if o.Cost != nil { + toSerialize["cost"] = o.Cost + } + if o.ProductName != nil { + toSerialize["product_name"] = o.ProductName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ChargebackBreakdown) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ChargeType *string `json:"charge_type,omitempty"` + Cost *float64 `json:"cost,omitempty"` + ProductName *string `json:"product_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ChargeType = all.ChargeType + o.Cost = all.Cost + o.ProductName = all.ProductName + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go new file mode 100644 index 00000000000..3331dc2f5dd --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_attributes.go @@ -0,0 +1,506 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// CloudWorkloadSecurityAgentRuleAttributes A Cloud Workload Security Agent rule returned by the API. +type CloudWorkloadSecurityAgentRuleAttributes struct { + // The category of the Agent rule. + Category *string `json:"category,omitempty"` + // When the Agent rule was created, timestamp in milliseconds. + CreationDate *int64 `json:"creationDate,omitempty"` + // The attributes of the user who created the Agent rule. + Creator *CloudWorkloadSecurityAgentRuleCreatorAttributes `json:"creator,omitempty"` + // Whether the rule is included by default. + DefaultRule *bool `json:"defaultRule,omitempty"` + // The description of the Agent rule. + Description *string `json:"description,omitempty"` + // Whether the Agent rule is enabled. + Enabled *bool `json:"enabled,omitempty"` + // The SECL expression of the Agent rule. + Expression *string `json:"expression,omitempty"` + // The name of the Agent rule. + Name *string `json:"name,omitempty"` + // When the Agent rule was last updated, timestamp in milliseconds. + UpdatedAt *int64 `json:"updatedAt,omitempty"` + // The attributes of the user who last updated the Agent rule. + Updater *CloudWorkloadSecurityAgentRuleUpdaterAttributes `json:"updater,omitempty"` + // The version of the Agent rule. + Version *int64 `json:"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{} +} + +// NewCloudWorkloadSecurityAgentRuleAttributes instantiates a new CloudWorkloadSecurityAgentRuleAttributes 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 NewCloudWorkloadSecurityAgentRuleAttributes() *CloudWorkloadSecurityAgentRuleAttributes { + this := CloudWorkloadSecurityAgentRuleAttributes{} + return &this +} + +// NewCloudWorkloadSecurityAgentRuleAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleAttributes 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 NewCloudWorkloadSecurityAgentRuleAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleAttributes { + this := CloudWorkloadSecurityAgentRuleAttributes{} + return &this +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCategory() string { + if o == nil || o.Category == nil { + var ret string + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCategoryOk() (*string, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCategory() bool { + if o != nil && o.Category != nil { + return true + } + + return false +} + +// SetCategory gets a reference to the given string and assigns it to the Category field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCategory(v string) { + o.Category = &v +} + +// GetCreationDate returns the CreationDate field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreationDate() int64 { + if o == nil || o.CreationDate == nil { + var ret int64 + return ret + } + return *o.CreationDate +} + +// GetCreationDateOk returns a tuple with the CreationDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreationDateOk() (*int64, bool) { + if o == nil || o.CreationDate == nil { + return nil, false + } + return o.CreationDate, true +} + +// HasCreationDate returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCreationDate() bool { + if o != nil && o.CreationDate != nil { + return true + } + + return false +} + +// SetCreationDate gets a reference to the given int64 and assigns it to the CreationDate field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCreationDate(v int64) { + o.CreationDate = &v +} + +// GetCreator returns the Creator field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreator() CloudWorkloadSecurityAgentRuleCreatorAttributes { + if o == nil || o.Creator == nil { + var ret CloudWorkloadSecurityAgentRuleCreatorAttributes + return ret + } + return *o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetCreatorOk() (*CloudWorkloadSecurityAgentRuleCreatorAttributes, bool) { + if o == nil || o.Creator == nil { + return nil, false + } + return o.Creator, true +} + +// HasCreator returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasCreator() bool { + if o != nil && o.Creator != nil { + return true + } + + return false +} + +// SetCreator gets a reference to the given CloudWorkloadSecurityAgentRuleCreatorAttributes and assigns it to the Creator field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetCreator(v CloudWorkloadSecurityAgentRuleCreatorAttributes) { + o.Creator = &v +} + +// GetDefaultRule returns the DefaultRule field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDefaultRule() bool { + if o == nil || o.DefaultRule == nil { + var ret bool + return ret + } + return *o.DefaultRule +} + +// GetDefaultRuleOk returns a tuple with the DefaultRule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDefaultRuleOk() (*bool, bool) { + if o == nil || o.DefaultRule == nil { + return nil, false + } + return o.DefaultRule, true +} + +// HasDefaultRule returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasDefaultRule() bool { + if o != nil && o.DefaultRule != nil { + return true + } + + return false +} + +// SetDefaultRule gets a reference to the given bool and assigns it to the DefaultRule field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetDefaultRule(v bool) { + o.DefaultRule = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetExpression returns the Expression field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetExpression() string { + if o == nil || o.Expression == nil { + var ret string + return ret + } + return *o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetExpressionOk() (*string, bool) { + if o == nil || o.Expression == nil { + return nil, false + } + return o.Expression, true +} + +// HasExpression returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasExpression() bool { + if o != nil && o.Expression != nil { + return true + } + + return false +} + +// SetExpression gets a reference to the given string and assigns it to the Expression field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetExpression(v string) { + o.Expression = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetName(v string) { + o.Name = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdatedAt() int64 { + if o == nil || o.UpdatedAt == nil { + var ret int64 + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdatedAtOk() (*int64, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasUpdatedAt() bool { + if o != nil && o.UpdatedAt != nil { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given int64 and assigns it to the UpdatedAt field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetUpdatedAt(v int64) { + o.UpdatedAt = &v +} + +// GetUpdater returns the Updater field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdater() CloudWorkloadSecurityAgentRuleUpdaterAttributes { + if o == nil || o.Updater == nil { + var ret CloudWorkloadSecurityAgentRuleUpdaterAttributes + return ret + } + return *o.Updater +} + +// GetUpdaterOk returns a tuple with the Updater field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetUpdaterOk() (*CloudWorkloadSecurityAgentRuleUpdaterAttributes, bool) { + if o == nil || o.Updater == nil { + return nil, false + } + return o.Updater, true +} + +// HasUpdater returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasUpdater() bool { + if o != nil && o.Updater != nil { + return true + } + + return false +} + +// SetUpdater gets a reference to the given CloudWorkloadSecurityAgentRuleUpdaterAttributes and assigns it to the Updater field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetUpdater(v CloudWorkloadSecurityAgentRuleUpdaterAttributes) { + o.Updater = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleAttributes) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *CloudWorkloadSecurityAgentRuleAttributes) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if o.CreationDate != nil { + toSerialize["creationDate"] = o.CreationDate + } + if o.Creator != nil { + toSerialize["creator"] = o.Creator + } + if o.DefaultRule != nil { + toSerialize["defaultRule"] = o.DefaultRule + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.Expression != nil { + toSerialize["expression"] = o.Expression + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.UpdatedAt != nil { + toSerialize["updatedAt"] = o.UpdatedAt + } + if o.Updater != nil { + toSerialize["updater"] = o.Updater + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Category *string `json:"category,omitempty"` + CreationDate *int64 `json:"creationDate,omitempty"` + Creator *CloudWorkloadSecurityAgentRuleCreatorAttributes `json:"creator,omitempty"` + DefaultRule *bool `json:"defaultRule,omitempty"` + Description *string `json:"description,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Expression *string `json:"expression,omitempty"` + Name *string `json:"name,omitempty"` + UpdatedAt *int64 `json:"updatedAt,omitempty"` + Updater *CloudWorkloadSecurityAgentRuleUpdaterAttributes `json:"updater,omitempty"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Category = all.Category + o.CreationDate = all.CreationDate + if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Creator = all.Creator + o.DefaultRule = all.DefaultRule + o.Description = all.Description + o.Enabled = all.Enabled + o.Expression = all.Expression + o.Name = all.Name + o.UpdatedAt = all.UpdatedAt + if all.Updater != nil && all.Updater.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Updater = all.Updater + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go new file mode 100644 index 00000000000..81d7c741703 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_attributes.go @@ -0,0 +1,214 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CloudWorkloadSecurityAgentRuleCreateAttributes Create a new Cloud Workload Security Agent rule. +type CloudWorkloadSecurityAgentRuleCreateAttributes struct { + // The description of the Agent rule. + Description *string `json:"description,omitempty"` + // Whether the Agent rule is enabled. + Enabled *bool `json:"enabled,omitempty"` + // The SECL expression of the Agent rule. + Expression string `json:"expression"` + // The name of the Agent rule. + Name string `json:"name"` + // 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{} +} + +// NewCloudWorkloadSecurityAgentRuleCreateAttributes instantiates a new CloudWorkloadSecurityAgentRuleCreateAttributes 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 NewCloudWorkloadSecurityAgentRuleCreateAttributes(expression string, name string) *CloudWorkloadSecurityAgentRuleCreateAttributes { + this := CloudWorkloadSecurityAgentRuleCreateAttributes{} + this.Expression = expression + this.Name = name + return &this +} + +// NewCloudWorkloadSecurityAgentRuleCreateAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreateAttributes 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 NewCloudWorkloadSecurityAgentRuleCreateAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleCreateAttributes { + this := CloudWorkloadSecurityAgentRuleCreateAttributes{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetExpression returns the Expression field value. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetExpression() string { + if o == nil { + var ret string + return ret + } + return o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetExpressionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Expression, true +} + +// SetExpression sets field value. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetExpression(v string) { + o.Expression = v +} + +// GetName returns the Name field value. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + toSerialize["expression"] = o.Expression + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Expression *string `json:"expression"` + Name *string `json:"name"` + }{} + all := struct { + Description *string `json:"description,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Expression string `json:"expression"` + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Expression == nil { + return fmt.Errorf("Required field expression missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Description = all.Description + o.Enabled = all.Enabled + o.Expression = all.Expression + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go new file mode 100644 index 00000000000..42752ccdc25 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CloudWorkloadSecurityAgentRuleCreateData Object for a single Agent rule. +type CloudWorkloadSecurityAgentRuleCreateData struct { + // Create a new Cloud Workload Security Agent rule. + Attributes CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` + // The type of the resource. The value should always be `agent_rule`. + Type CloudWorkloadSecurityAgentRuleType `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{} +} + +// NewCloudWorkloadSecurityAgentRuleCreateData instantiates a new CloudWorkloadSecurityAgentRuleCreateData 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 NewCloudWorkloadSecurityAgentRuleCreateData(attributes CloudWorkloadSecurityAgentRuleCreateAttributes, typeVar CloudWorkloadSecurityAgentRuleType) *CloudWorkloadSecurityAgentRuleCreateData { + this := CloudWorkloadSecurityAgentRuleCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewCloudWorkloadSecurityAgentRuleCreateDataWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreateData 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 NewCloudWorkloadSecurityAgentRuleCreateDataWithDefaults() *CloudWorkloadSecurityAgentRuleCreateData { + this := CloudWorkloadSecurityAgentRuleCreateData{} + var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CloudWorkloadSecurityAgentRuleCreateData) GetAttributes() CloudWorkloadSecurityAgentRuleCreateAttributes { + if o == nil { + var ret CloudWorkloadSecurityAgentRuleCreateAttributes + 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 *CloudWorkloadSecurityAgentRuleCreateData) GetAttributesOk() (*CloudWorkloadSecurityAgentRuleCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CloudWorkloadSecurityAgentRuleCreateData) SetAttributes(v CloudWorkloadSecurityAgentRuleCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *CloudWorkloadSecurityAgentRuleCreateData) GetType() CloudWorkloadSecurityAgentRuleType { + if o == nil { + var ret CloudWorkloadSecurityAgentRuleType + 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 *CloudWorkloadSecurityAgentRuleCreateData) GetTypeOk() (*CloudWorkloadSecurityAgentRuleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CloudWorkloadSecurityAgentRuleCreateData) SetType(v CloudWorkloadSecurityAgentRuleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` + Type *CloudWorkloadSecurityAgentRuleType `json:"type"` + }{} + all := struct { + Attributes CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` + Type CloudWorkloadSecurityAgentRuleType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.go new file mode 100644 index 00000000000..b6183945ff0 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CloudWorkloadSecurityAgentRuleCreateRequest Request object that includes the Agent rule to create. +type CloudWorkloadSecurityAgentRuleCreateRequest struct { + // Object for a single Agent rule. + Data CloudWorkloadSecurityAgentRuleCreateData `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{} +} + +// NewCloudWorkloadSecurityAgentRuleCreateRequest instantiates a new CloudWorkloadSecurityAgentRuleCreateRequest 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 NewCloudWorkloadSecurityAgentRuleCreateRequest(data CloudWorkloadSecurityAgentRuleCreateData) *CloudWorkloadSecurityAgentRuleCreateRequest { + this := CloudWorkloadSecurityAgentRuleCreateRequest{} + this.Data = data + return &this +} + +// NewCloudWorkloadSecurityAgentRuleCreateRequestWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreateRequest 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 NewCloudWorkloadSecurityAgentRuleCreateRequestWithDefaults() *CloudWorkloadSecurityAgentRuleCreateRequest { + this := CloudWorkloadSecurityAgentRuleCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *CloudWorkloadSecurityAgentRuleCreateRequest) GetData() CloudWorkloadSecurityAgentRuleCreateData { + if o == nil { + var ret CloudWorkloadSecurityAgentRuleCreateData + 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 *CloudWorkloadSecurityAgentRuleCreateRequest) GetDataOk() (*CloudWorkloadSecurityAgentRuleCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CloudWorkloadSecurityAgentRuleCreateRequest) SetData(v CloudWorkloadSecurityAgentRuleCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *CloudWorkloadSecurityAgentRuleCreateData `json:"data"` + }{} + all := struct { + Data CloudWorkloadSecurityAgentRuleCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go new file mode 100644 index 00000000000..7791537dd63 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_creator_attributes.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// CloudWorkloadSecurityAgentRuleCreatorAttributes The attributes of the user who created the Agent rule. +type CloudWorkloadSecurityAgentRuleCreatorAttributes struct { + // The handle of the user. + Handle *string `json:"handle,omitempty"` + // The name of the user. + Name *string `json:"name,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{} +} + +// NewCloudWorkloadSecurityAgentRuleCreatorAttributes instantiates a new CloudWorkloadSecurityAgentRuleCreatorAttributes 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 NewCloudWorkloadSecurityAgentRuleCreatorAttributes() *CloudWorkloadSecurityAgentRuleCreatorAttributes { + this := CloudWorkloadSecurityAgentRuleCreatorAttributes{} + return &this +} + +// NewCloudWorkloadSecurityAgentRuleCreatorAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleCreatorAttributes 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 NewCloudWorkloadSecurityAgentRuleCreatorAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleCreatorAttributes { + this := CloudWorkloadSecurityAgentRuleCreatorAttributes{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) SetHandle(v string) { + o.Handle = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleCreatorAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Handle *string `json:"handle,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Handle = all.Handle + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_data.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_data.go new file mode 100644 index 00000000000..e90834fff00 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// CloudWorkloadSecurityAgentRuleData Object for a single Agent rule. +type CloudWorkloadSecurityAgentRuleData struct { + // A Cloud Workload Security Agent rule returned by the API. + Attributes *CloudWorkloadSecurityAgentRuleAttributes `json:"attributes,omitempty"` + // The ID of the Agent rule. + Id *string `json:"id,omitempty"` + // The type of the resource. The value should always be `agent_rule`. + Type *CloudWorkloadSecurityAgentRuleType `json:"type,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{} +} + +// NewCloudWorkloadSecurityAgentRuleData instantiates a new CloudWorkloadSecurityAgentRuleData 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 NewCloudWorkloadSecurityAgentRuleData() *CloudWorkloadSecurityAgentRuleData { + this := CloudWorkloadSecurityAgentRuleData{} + var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE + this.Type = &typeVar + return &this +} + +// NewCloudWorkloadSecurityAgentRuleDataWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleData 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 NewCloudWorkloadSecurityAgentRuleDataWithDefaults() *CloudWorkloadSecurityAgentRuleData { + this := CloudWorkloadSecurityAgentRuleData{} + var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleData) GetAttributes() CloudWorkloadSecurityAgentRuleAttributes { + if o == nil || o.Attributes == nil { + var ret CloudWorkloadSecurityAgentRuleAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleData) GetAttributesOk() (*CloudWorkloadSecurityAgentRuleAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given CloudWorkloadSecurityAgentRuleAttributes and assigns it to the Attributes field. +func (o *CloudWorkloadSecurityAgentRuleData) SetAttributes(v CloudWorkloadSecurityAgentRuleAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CloudWorkloadSecurityAgentRuleData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleData) GetType() CloudWorkloadSecurityAgentRuleType { + if o == nil || o.Type == nil { + var ret CloudWorkloadSecurityAgentRuleType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleData) GetTypeOk() (*CloudWorkloadSecurityAgentRuleType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given CloudWorkloadSecurityAgentRuleType and assigns it to the Type field. +func (o *CloudWorkloadSecurityAgentRuleData) SetType(v CloudWorkloadSecurityAgentRuleType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *CloudWorkloadSecurityAgentRuleAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *CloudWorkloadSecurityAgentRuleType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_response.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_response.go new file mode 100644 index 00000000000..2c3f43448b8 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// CloudWorkloadSecurityAgentRuleResponse Response object that includes an Agent rule. +type CloudWorkloadSecurityAgentRuleResponse struct { + // Object for a single Agent rule. + Data *CloudWorkloadSecurityAgentRuleData `json:"data,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{} +} + +// NewCloudWorkloadSecurityAgentRuleResponse instantiates a new CloudWorkloadSecurityAgentRuleResponse 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 NewCloudWorkloadSecurityAgentRuleResponse() *CloudWorkloadSecurityAgentRuleResponse { + this := CloudWorkloadSecurityAgentRuleResponse{} + return &this +} + +// NewCloudWorkloadSecurityAgentRuleResponseWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleResponse 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 NewCloudWorkloadSecurityAgentRuleResponseWithDefaults() *CloudWorkloadSecurityAgentRuleResponse { + this := CloudWorkloadSecurityAgentRuleResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleResponse) GetData() CloudWorkloadSecurityAgentRuleData { + if o == nil || o.Data == nil { + var ret CloudWorkloadSecurityAgentRuleData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleResponse) GetDataOk() (*CloudWorkloadSecurityAgentRuleData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given CloudWorkloadSecurityAgentRuleData and assigns it to the Data field. +func (o *CloudWorkloadSecurityAgentRuleResponse) SetData(v CloudWorkloadSecurityAgentRuleData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_type.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_type.go new file mode 100644 index 00000000000..6315c24c77d --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CloudWorkloadSecurityAgentRuleType The type of the resource. The value should always be `agent_rule`. +type CloudWorkloadSecurityAgentRuleType string + +// List of CloudWorkloadSecurityAgentRuleType. +const ( + CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE CloudWorkloadSecurityAgentRuleType = "agent_rule" +) + +var allowedCloudWorkloadSecurityAgentRuleTypeEnumValues = []CloudWorkloadSecurityAgentRuleType{ + CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CloudWorkloadSecurityAgentRuleType) GetAllowedValues() []CloudWorkloadSecurityAgentRuleType { + return allowedCloudWorkloadSecurityAgentRuleTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CloudWorkloadSecurityAgentRuleType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CloudWorkloadSecurityAgentRuleType(value) + return nil +} + +// NewCloudWorkloadSecurityAgentRuleTypeFromValue returns a pointer to a valid CloudWorkloadSecurityAgentRuleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCloudWorkloadSecurityAgentRuleTypeFromValue(v string) (*CloudWorkloadSecurityAgentRuleType, error) { + ev := CloudWorkloadSecurityAgentRuleType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CloudWorkloadSecurityAgentRuleType: valid values are %v", v, allowedCloudWorkloadSecurityAgentRuleTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CloudWorkloadSecurityAgentRuleType) IsValid() bool { + for _, existing := range allowedCloudWorkloadSecurityAgentRuleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CloudWorkloadSecurityAgentRuleType value. +func (v CloudWorkloadSecurityAgentRuleType) Ptr() *CloudWorkloadSecurityAgentRuleType { + return &v +} + +// NullableCloudWorkloadSecurityAgentRuleType handles when a null is used for CloudWorkloadSecurityAgentRuleType. +type NullableCloudWorkloadSecurityAgentRuleType struct { + value *CloudWorkloadSecurityAgentRuleType + isSet bool +} + +// Get returns the associated value. +func (v NullableCloudWorkloadSecurityAgentRuleType) Get() *CloudWorkloadSecurityAgentRuleType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableCloudWorkloadSecurityAgentRuleType) Set(val *CloudWorkloadSecurityAgentRuleType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableCloudWorkloadSecurityAgentRuleType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableCloudWorkloadSecurityAgentRuleType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableCloudWorkloadSecurityAgentRuleType initializes the struct as if Set has been called. +func NewNullableCloudWorkloadSecurityAgentRuleType(val *CloudWorkloadSecurityAgentRuleType) *NullableCloudWorkloadSecurityAgentRuleType { + return &NullableCloudWorkloadSecurityAgentRuleType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableCloudWorkloadSecurityAgentRuleType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableCloudWorkloadSecurityAgentRuleType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go new file mode 100644 index 00000000000..e7e2f0a7104 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_attributes.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// CloudWorkloadSecurityAgentRuleUpdateAttributes Update an existing Cloud Workload Security Agent rule. +type CloudWorkloadSecurityAgentRuleUpdateAttributes struct { + // The description of the Agent rule. + Description *string `json:"description,omitempty"` + // Whether the Agent rule is enabled. + Enabled *bool `json:"enabled,omitempty"` + // The SECL expression of the Agent rule. + Expression *string `json:"expression,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{} +} + +// NewCloudWorkloadSecurityAgentRuleUpdateAttributes instantiates a new CloudWorkloadSecurityAgentRuleUpdateAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdateAttributes() *CloudWorkloadSecurityAgentRuleUpdateAttributes { + this := CloudWorkloadSecurityAgentRuleUpdateAttributes{} + return &this +} + +// NewCloudWorkloadSecurityAgentRuleUpdateAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdateAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdateAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleUpdateAttributes { + this := CloudWorkloadSecurityAgentRuleUpdateAttributes{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) HasEnabled() bool { + if o != nil && o.Enabled != nil { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetExpression returns the Expression field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetExpression() string { + if o == nil || o.Expression == nil { + var ret string + return ret + } + return *o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) GetExpressionOk() (*string, bool) { + if o == nil || o.Expression == nil { + return nil, false + } + return o.Expression, true +} + +// HasExpression returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) HasExpression() bool { + if o != nil && o.Expression != nil { + return true + } + + return false +} + +// SetExpression gets a reference to the given string and assigns it to the Expression field. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) SetExpression(v string) { + o.Expression = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.Expression != nil { + toSerialize["expression"] = o.Expression + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Description *string `json:"description,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Expression *string `json:"expression,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Description = all.Description + o.Enabled = all.Enabled + o.Expression = all.Expression + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go new file mode 100644 index 00000000000..ef1bb5b7b2f --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CloudWorkloadSecurityAgentRuleUpdateData Object for a single Agent rule. +type CloudWorkloadSecurityAgentRuleUpdateData struct { + // Update an existing Cloud Workload Security Agent rule. + Attributes CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` + // The type of the resource. The value should always be `agent_rule`. + Type CloudWorkloadSecurityAgentRuleType `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{} +} + +// NewCloudWorkloadSecurityAgentRuleUpdateData instantiates a new CloudWorkloadSecurityAgentRuleUpdateData 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 NewCloudWorkloadSecurityAgentRuleUpdateData(attributes CloudWorkloadSecurityAgentRuleUpdateAttributes, typeVar CloudWorkloadSecurityAgentRuleType) *CloudWorkloadSecurityAgentRuleUpdateData { + this := CloudWorkloadSecurityAgentRuleUpdateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewCloudWorkloadSecurityAgentRuleUpdateDataWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdateData 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 NewCloudWorkloadSecurityAgentRuleUpdateDataWithDefaults() *CloudWorkloadSecurityAgentRuleUpdateData { + this := CloudWorkloadSecurityAgentRuleUpdateData{} + var typeVar CloudWorkloadSecurityAgentRuleType = CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CloudWorkloadSecurityAgentRuleUpdateData) GetAttributes() CloudWorkloadSecurityAgentRuleUpdateAttributes { + if o == nil { + var ret CloudWorkloadSecurityAgentRuleUpdateAttributes + 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 *CloudWorkloadSecurityAgentRuleUpdateData) GetAttributesOk() (*CloudWorkloadSecurityAgentRuleUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CloudWorkloadSecurityAgentRuleUpdateData) SetAttributes(v CloudWorkloadSecurityAgentRuleUpdateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *CloudWorkloadSecurityAgentRuleUpdateData) GetType() CloudWorkloadSecurityAgentRuleType { + if o == nil { + var ret CloudWorkloadSecurityAgentRuleType + 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 *CloudWorkloadSecurityAgentRuleUpdateData) GetTypeOk() (*CloudWorkloadSecurityAgentRuleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CloudWorkloadSecurityAgentRuleUpdateData) SetType(v CloudWorkloadSecurityAgentRuleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` + Type *CloudWorkloadSecurityAgentRuleType `json:"type"` + }{} + all := struct { + Attributes CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` + Type CloudWorkloadSecurityAgentRuleType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.go new file mode 100644 index 00000000000..4a0205b65f1 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CloudWorkloadSecurityAgentRuleUpdateRequest Request object that includes the Agent rule with the attributes to update. +type CloudWorkloadSecurityAgentRuleUpdateRequest struct { + // Object for a single Agent rule. + Data CloudWorkloadSecurityAgentRuleUpdateData `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{} +} + +// NewCloudWorkloadSecurityAgentRuleUpdateRequest instantiates a new CloudWorkloadSecurityAgentRuleUpdateRequest 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 NewCloudWorkloadSecurityAgentRuleUpdateRequest(data CloudWorkloadSecurityAgentRuleUpdateData) *CloudWorkloadSecurityAgentRuleUpdateRequest { + this := CloudWorkloadSecurityAgentRuleUpdateRequest{} + this.Data = data + return &this +} + +// NewCloudWorkloadSecurityAgentRuleUpdateRequestWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdateRequest 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 NewCloudWorkloadSecurityAgentRuleUpdateRequestWithDefaults() *CloudWorkloadSecurityAgentRuleUpdateRequest { + this := CloudWorkloadSecurityAgentRuleUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) GetData() CloudWorkloadSecurityAgentRuleUpdateData { + if o == nil { + var ret CloudWorkloadSecurityAgentRuleUpdateData + 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 *CloudWorkloadSecurityAgentRuleUpdateRequest) GetDataOk() (*CloudWorkloadSecurityAgentRuleUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) SetData(v CloudWorkloadSecurityAgentRuleUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` + }{} + all := struct { + Data CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go b/api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go new file mode 100644 index 00000000000..61ee3f6c626 --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rule_updater_attributes.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// CloudWorkloadSecurityAgentRuleUpdaterAttributes The attributes of the user who last updated the Agent rule. +type CloudWorkloadSecurityAgentRuleUpdaterAttributes struct { + // The handle of the user. + Handle *string `json:"handle,omitempty"` + // The name of the user. + Name *string `json:"name,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{} +} + +// NewCloudWorkloadSecurityAgentRuleUpdaterAttributes instantiates a new CloudWorkloadSecurityAgentRuleUpdaterAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdaterAttributes() *CloudWorkloadSecurityAgentRuleUpdaterAttributes { + this := CloudWorkloadSecurityAgentRuleUpdaterAttributes{} + return &this +} + +// NewCloudWorkloadSecurityAgentRuleUpdaterAttributesWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleUpdaterAttributes 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 NewCloudWorkloadSecurityAgentRuleUpdaterAttributesWithDefaults() *CloudWorkloadSecurityAgentRuleUpdaterAttributes { + this := CloudWorkloadSecurityAgentRuleUpdaterAttributes{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) SetHandle(v string) { + o.Handle = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRuleUpdaterAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Handle *string `json:"handle,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Handle = all.Handle + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.go b/api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.go new file mode 100644 index 00000000000..5460689af3a --- /dev/null +++ b/api/v2/datadog/model_cloud_workload_security_agent_rules_list_response.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 datadog + +import ( + "encoding/json" +) + +// CloudWorkloadSecurityAgentRulesListResponse Response object that includes a list of Agent rule. +type CloudWorkloadSecurityAgentRulesListResponse struct { + // A list of Agent rules objects. + Data []CloudWorkloadSecurityAgentRuleData `json:"data,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{} +} + +// NewCloudWorkloadSecurityAgentRulesListResponse instantiates a new CloudWorkloadSecurityAgentRulesListResponse 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 NewCloudWorkloadSecurityAgentRulesListResponse() *CloudWorkloadSecurityAgentRulesListResponse { + this := CloudWorkloadSecurityAgentRulesListResponse{} + return &this +} + +// NewCloudWorkloadSecurityAgentRulesListResponseWithDefaults instantiates a new CloudWorkloadSecurityAgentRulesListResponse 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 NewCloudWorkloadSecurityAgentRulesListResponseWithDefaults() *CloudWorkloadSecurityAgentRulesListResponse { + this := CloudWorkloadSecurityAgentRulesListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CloudWorkloadSecurityAgentRulesListResponse) GetData() []CloudWorkloadSecurityAgentRuleData { + if o == nil || o.Data == nil { + var ret []CloudWorkloadSecurityAgentRuleData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloudWorkloadSecurityAgentRulesListResponse) GetDataOk() (*[]CloudWorkloadSecurityAgentRuleData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CloudWorkloadSecurityAgentRulesListResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []CloudWorkloadSecurityAgentRuleData and assigns it to the Data field. +func (o *CloudWorkloadSecurityAgentRulesListResponse) SetData(v []CloudWorkloadSecurityAgentRuleData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CloudWorkloadSecurityAgentRulesListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CloudWorkloadSecurityAgentRulesListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_content_encoding.go b/api/v2/datadog/model_content_encoding.go new file mode 100644 index 00000000000..96c002db1df --- /dev/null +++ b/api/v2/datadog/model_content_encoding.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ContentEncoding HTTP header used to compress the media-type. +type ContentEncoding string + +// List of ContentEncoding. +const ( + CONTENTENCODING_GZIP ContentEncoding = "gzip" + CONTENTENCODING_DEFLATE ContentEncoding = "deflate" +) + +var allowedContentEncodingEnumValues = []ContentEncoding{ + CONTENTENCODING_GZIP, + CONTENTENCODING_DEFLATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ContentEncoding) GetAllowedValues() []ContentEncoding { + return allowedContentEncodingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ContentEncoding) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ContentEncoding(value) + return nil +} + +// NewContentEncodingFromValue returns a pointer to a valid ContentEncoding +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewContentEncodingFromValue(v string) (*ContentEncoding, error) { + ev := ContentEncoding(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ContentEncoding: valid values are %v", v, allowedContentEncodingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ContentEncoding) IsValid() bool { + for _, existing := range allowedContentEncodingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ContentEncoding value. +func (v ContentEncoding) Ptr() *ContentEncoding { + return &v +} + +// NullableContentEncoding handles when a null is used for ContentEncoding. +type NullableContentEncoding struct { + value *ContentEncoding + isSet bool +} + +// Get returns the associated value. +func (v NullableContentEncoding) Get() *ContentEncoding { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableContentEncoding) Set(val *ContentEncoding) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableContentEncoding) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableContentEncoding) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableContentEncoding initializes the struct as if Set has been called. +func NewNullableContentEncoding(val *ContentEncoding) *NullableContentEncoding { + return &NullableContentEncoding{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableContentEncoding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableContentEncoding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_cost_by_org.go b/api/v2/datadog/model_cost_by_org.go new file mode 100644 index 00000000000..5ef547548fb --- /dev/null +++ b/api/v2/datadog/model_cost_by_org.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// CostByOrg Cost data. +type CostByOrg struct { + // Cost attributes data. + Attributes *CostByOrgAttributes `json:"attributes,omitempty"` + // Unique ID of the response. + Id *string `json:"id,omitempty"` + // Type of cost data. + Type *CostByOrgType `json:"type,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{} +} + +// NewCostByOrg instantiates a new CostByOrg 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 NewCostByOrg() *CostByOrg { + this := CostByOrg{} + var typeVar CostByOrgType = COSTBYORGTYPE_COST_BY_ORG + this.Type = &typeVar + return &this +} + +// NewCostByOrgWithDefaults instantiates a new CostByOrg 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 NewCostByOrgWithDefaults() *CostByOrg { + this := CostByOrg{} + var typeVar CostByOrgType = COSTBYORGTYPE_COST_BY_ORG + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CostByOrg) GetAttributes() CostByOrgAttributes { + if o == nil || o.Attributes == nil { + var ret CostByOrgAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrg) GetAttributesOk() (*CostByOrgAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CostByOrg) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given CostByOrgAttributes and assigns it to the Attributes field. +func (o *CostByOrg) SetAttributes(v CostByOrgAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CostByOrg) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrg) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CostByOrg) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CostByOrg) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CostByOrg) GetType() CostByOrgType { + if o == nil || o.Type == nil { + var ret CostByOrgType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrg) GetTypeOk() (*CostByOrgType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CostByOrg) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given CostByOrgType and assigns it to the Type field. +func (o *CostByOrg) SetType(v CostByOrgType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CostByOrg) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CostByOrg) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *CostByOrgAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *CostByOrgType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_cost_by_org_attributes.go b/api/v2/datadog/model_cost_by_org_attributes.go new file mode 100644 index 00000000000..cea0b0d1166 --- /dev/null +++ b/api/v2/datadog/model_cost_by_org_attributes.go @@ -0,0 +1,263 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// CostByOrgAttributes Cost attributes data. +type CostByOrgAttributes struct { + // List of charges data reported for the requested month. + Charges []ChargebackBreakdown `json:"charges,omitempty"` + // The month requested. + Date *time.Time `json:"date,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The total cost of products for the month. + TotalCost *float64 `json:"total_cost,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{} +} + +// NewCostByOrgAttributes instantiates a new CostByOrgAttributes 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 NewCostByOrgAttributes() *CostByOrgAttributes { + this := CostByOrgAttributes{} + return &this +} + +// NewCostByOrgAttributesWithDefaults instantiates a new CostByOrgAttributes 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 NewCostByOrgAttributesWithDefaults() *CostByOrgAttributes { + this := CostByOrgAttributes{} + return &this +} + +// GetCharges returns the Charges field value if set, zero value otherwise. +func (o *CostByOrgAttributes) GetCharges() []ChargebackBreakdown { + if o == nil || o.Charges == nil { + var ret []ChargebackBreakdown + return ret + } + return o.Charges +} + +// GetChargesOk returns a tuple with the Charges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrgAttributes) GetChargesOk() (*[]ChargebackBreakdown, bool) { + if o == nil || o.Charges == nil { + return nil, false + } + return &o.Charges, true +} + +// HasCharges returns a boolean if a field has been set. +func (o *CostByOrgAttributes) HasCharges() bool { + if o != nil && o.Charges != nil { + return true + } + + return false +} + +// SetCharges gets a reference to the given []ChargebackBreakdown and assigns it to the Charges field. +func (o *CostByOrgAttributes) SetCharges(v []ChargebackBreakdown) { + o.Charges = v +} + +// GetDate returns the Date field value if set, zero value otherwise. +func (o *CostByOrgAttributes) GetDate() time.Time { + if o == nil || o.Date == nil { + var ret time.Time + return ret + } + return *o.Date +} + +// GetDateOk returns a tuple with the Date field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrgAttributes) GetDateOk() (*time.Time, bool) { + if o == nil || o.Date == nil { + return nil, false + } + return o.Date, true +} + +// HasDate returns a boolean if a field has been set. +func (o *CostByOrgAttributes) HasDate() bool { + if o != nil && o.Date != nil { + return true + } + + return false +} + +// SetDate gets a reference to the given time.Time and assigns it to the Date field. +func (o *CostByOrgAttributes) SetDate(v time.Time) { + o.Date = &v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *CostByOrgAttributes) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrgAttributes) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *CostByOrgAttributes) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *CostByOrgAttributes) SetOrgName(v string) { + o.OrgName = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *CostByOrgAttributes) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrgAttributes) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *CostByOrgAttributes) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *CostByOrgAttributes) SetPublicId(v string) { + o.PublicId = &v +} + +// GetTotalCost returns the TotalCost field value if set, zero value otherwise. +func (o *CostByOrgAttributes) GetTotalCost() float64 { + if o == nil || o.TotalCost == nil { + var ret float64 + return ret + } + return *o.TotalCost +} + +// GetTotalCostOk returns a tuple with the TotalCost field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrgAttributes) GetTotalCostOk() (*float64, bool) { + if o == nil || o.TotalCost == nil { + return nil, false + } + return o.TotalCost, true +} + +// HasTotalCost returns a boolean if a field has been set. +func (o *CostByOrgAttributes) HasTotalCost() bool { + if o != nil && o.TotalCost != nil { + return true + } + + return false +} + +// SetTotalCost gets a reference to the given float64 and assigns it to the TotalCost field. +func (o *CostByOrgAttributes) SetTotalCost(v float64) { + o.TotalCost = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CostByOrgAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Charges != nil { + toSerialize["charges"] = o.Charges + } + if o.Date != nil { + if o.Date.Nanosecond() == 0 { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.TotalCost != nil { + toSerialize["total_cost"] = o.TotalCost + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CostByOrgAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Charges []ChargebackBreakdown `json:"charges,omitempty"` + Date *time.Time `json:"date,omitempty"` + OrgName *string `json:"org_name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + TotalCost *float64 `json:"total_cost,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Charges = all.Charges + o.Date = all.Date + o.OrgName = all.OrgName + o.PublicId = all.PublicId + o.TotalCost = all.TotalCost + return nil +} diff --git a/api/v2/datadog/model_cost_by_org_response.go b/api/v2/datadog/model_cost_by_org_response.go new file mode 100644 index 00000000000..19cc6d64a0e --- /dev/null +++ b/api/v2/datadog/model_cost_by_org_response.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 datadog + +import ( + "encoding/json" +) + +// CostByOrgResponse Chargeback Summary response. +type CostByOrgResponse struct { + // Response containing Chargeback Summary. + Data []CostByOrg `json:"data,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{} +} + +// NewCostByOrgResponse instantiates a new CostByOrgResponse 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 NewCostByOrgResponse() *CostByOrgResponse { + this := CostByOrgResponse{} + return &this +} + +// NewCostByOrgResponseWithDefaults instantiates a new CostByOrgResponse 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 NewCostByOrgResponseWithDefaults() *CostByOrgResponse { + this := CostByOrgResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CostByOrgResponse) GetData() []CostByOrg { + if o == nil || o.Data == nil { + var ret []CostByOrg + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CostByOrgResponse) GetDataOk() (*[]CostByOrg, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CostByOrgResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []CostByOrg and assigns it to the Data field. +func (o *CostByOrgResponse) SetData(v []CostByOrg) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CostByOrgResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CostByOrgResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []CostByOrg `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_cost_by_org_type.go b/api/v2/datadog/model_cost_by_org_type.go new file mode 100644 index 00000000000..2d0ba68ffb6 --- /dev/null +++ b/api/v2/datadog/model_cost_by_org_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// CostByOrgType Type of cost data. +type CostByOrgType string + +// List of CostByOrgType. +const ( + COSTBYORGTYPE_COST_BY_ORG CostByOrgType = "cost_by_org" +) + +var allowedCostByOrgTypeEnumValues = []CostByOrgType{ + COSTBYORGTYPE_COST_BY_ORG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CostByOrgType) GetAllowedValues() []CostByOrgType { + return allowedCostByOrgTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CostByOrgType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CostByOrgType(value) + return nil +} + +// NewCostByOrgTypeFromValue returns a pointer to a valid CostByOrgType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCostByOrgTypeFromValue(v string) (*CostByOrgType, error) { + ev := CostByOrgType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CostByOrgType: valid values are %v", v, allowedCostByOrgTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CostByOrgType) IsValid() bool { + for _, existing := range allowedCostByOrgTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CostByOrgType value. +func (v CostByOrgType) Ptr() *CostByOrgType { + return &v +} + +// NullableCostByOrgType handles when a null is used for CostByOrgType. +type NullableCostByOrgType struct { + value *CostByOrgType + isSet bool +} + +// Get returns the associated value. +func (v NullableCostByOrgType) Get() *CostByOrgType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableCostByOrgType) Set(val *CostByOrgType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableCostByOrgType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableCostByOrgType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableCostByOrgType initializes the struct as if Set has been called. +func NewNullableCostByOrgType(val *CostByOrgType) *NullableCostByOrgType { + return &NullableCostByOrgType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableCostByOrgType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableCostByOrgType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_creator.go b/api/v2/datadog/model_creator.go new file mode 100644 index 00000000000..315313e5ec5 --- /dev/null +++ b/api/v2/datadog/model_creator.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Creator Creator of the object. +type Creator struct { + // Email of the creator. + Email *string `json:"email,omitempty"` + // Handle of the creator. + Handle *string `json:"handle,omitempty"` + // Name of the creator. + Name *string `json:"name,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{} +} + +// NewCreator instantiates a new Creator 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 NewCreator() *Creator { + this := Creator{} + return &this +} + +// NewCreatorWithDefaults instantiates a new Creator 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 NewCreatorWithDefaults() *Creator { + this := Creator{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *Creator) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Creator) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *Creator) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *Creator) SetEmail(v string) { + o.Email = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *Creator) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Creator) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *Creator) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *Creator) SetHandle(v string) { + o.Handle = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Creator) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Creator) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Creator) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Creator) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Creator) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Email = all.Email + o.Handle = all.Handle + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_add_items_request.go b/api/v2/datadog/model_dashboard_list_add_items_request.go new file mode 100644 index 00000000000..d43fdc9c2e5 --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_add_items_request.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 datadog + +import ( + "encoding/json" +) + +// DashboardListAddItemsRequest Request containing a list of dashboards to add. +type DashboardListAddItemsRequest struct { + // List of dashboards to add the dashboard list. + Dashboards []DashboardListItemRequest `json:"dashboards,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{} +} + +// NewDashboardListAddItemsRequest instantiates a new DashboardListAddItemsRequest 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 NewDashboardListAddItemsRequest() *DashboardListAddItemsRequest { + this := DashboardListAddItemsRequest{} + return &this +} + +// NewDashboardListAddItemsRequestWithDefaults instantiates a new DashboardListAddItemsRequest 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 NewDashboardListAddItemsRequestWithDefaults() *DashboardListAddItemsRequest { + this := DashboardListAddItemsRequest{} + return &this +} + +// GetDashboards returns the Dashboards field value if set, zero value otherwise. +func (o *DashboardListAddItemsRequest) GetDashboards() []DashboardListItemRequest { + if o == nil || o.Dashboards == nil { + var ret []DashboardListItemRequest + return ret + } + return o.Dashboards +} + +// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListAddItemsRequest) GetDashboardsOk() (*[]DashboardListItemRequest, bool) { + if o == nil || o.Dashboards == nil { + return nil, false + } + return &o.Dashboards, true +} + +// HasDashboards returns a boolean if a field has been set. +func (o *DashboardListAddItemsRequest) HasDashboards() bool { + if o != nil && o.Dashboards != nil { + return true + } + + return false +} + +// SetDashboards gets a reference to the given []DashboardListItemRequest and assigns it to the Dashboards field. +func (o *DashboardListAddItemsRequest) SetDashboards(v []DashboardListItemRequest) { + o.Dashboards = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListAddItemsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Dashboards != nil { + toSerialize["dashboards"] = o.Dashboards + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListAddItemsRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Dashboards = all.Dashboards + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_add_items_response.go b/api/v2/datadog/model_dashboard_list_add_items_response.go new file mode 100644 index 00000000000..841a062d1b9 --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_add_items_response.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 datadog + +import ( + "encoding/json" +) + +// DashboardListAddItemsResponse Response containing a list of added dashboards. +type DashboardListAddItemsResponse struct { + // List of dashboards added to the dashboard list. + AddedDashboardsToList []DashboardListItemResponse `json:"added_dashboards_to_list,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{} +} + +// NewDashboardListAddItemsResponse instantiates a new DashboardListAddItemsResponse 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 NewDashboardListAddItemsResponse() *DashboardListAddItemsResponse { + this := DashboardListAddItemsResponse{} + return &this +} + +// NewDashboardListAddItemsResponseWithDefaults instantiates a new DashboardListAddItemsResponse 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 NewDashboardListAddItemsResponseWithDefaults() *DashboardListAddItemsResponse { + this := DashboardListAddItemsResponse{} + return &this +} + +// GetAddedDashboardsToList returns the AddedDashboardsToList field value if set, zero value otherwise. +func (o *DashboardListAddItemsResponse) GetAddedDashboardsToList() []DashboardListItemResponse { + if o == nil || o.AddedDashboardsToList == nil { + var ret []DashboardListItemResponse + return ret + } + return o.AddedDashboardsToList +} + +// GetAddedDashboardsToListOk returns a tuple with the AddedDashboardsToList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListAddItemsResponse) GetAddedDashboardsToListOk() (*[]DashboardListItemResponse, bool) { + if o == nil || o.AddedDashboardsToList == nil { + return nil, false + } + return &o.AddedDashboardsToList, true +} + +// HasAddedDashboardsToList returns a boolean if a field has been set. +func (o *DashboardListAddItemsResponse) HasAddedDashboardsToList() bool { + if o != nil && o.AddedDashboardsToList != nil { + return true + } + + return false +} + +// SetAddedDashboardsToList gets a reference to the given []DashboardListItemResponse and assigns it to the AddedDashboardsToList field. +func (o *DashboardListAddItemsResponse) SetAddedDashboardsToList(v []DashboardListItemResponse) { + o.AddedDashboardsToList = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListAddItemsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AddedDashboardsToList != nil { + toSerialize["added_dashboards_to_list"] = o.AddedDashboardsToList + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListAddItemsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AddedDashboardsToList []DashboardListItemResponse `json:"added_dashboards_to_list,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AddedDashboardsToList = all.AddedDashboardsToList + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_delete_items_request.go b/api/v2/datadog/model_dashboard_list_delete_items_request.go new file mode 100644 index 00000000000..0993ac16a2e --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_delete_items_request.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 datadog + +import ( + "encoding/json" +) + +// DashboardListDeleteItemsRequest Request containing a list of dashboards to delete. +type DashboardListDeleteItemsRequest struct { + // List of dashboards to delete from the dashboard list. + Dashboards []DashboardListItemRequest `json:"dashboards,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{} +} + +// NewDashboardListDeleteItemsRequest instantiates a new DashboardListDeleteItemsRequest 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 NewDashboardListDeleteItemsRequest() *DashboardListDeleteItemsRequest { + this := DashboardListDeleteItemsRequest{} + return &this +} + +// NewDashboardListDeleteItemsRequestWithDefaults instantiates a new DashboardListDeleteItemsRequest 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 NewDashboardListDeleteItemsRequestWithDefaults() *DashboardListDeleteItemsRequest { + this := DashboardListDeleteItemsRequest{} + return &this +} + +// GetDashboards returns the Dashboards field value if set, zero value otherwise. +func (o *DashboardListDeleteItemsRequest) GetDashboards() []DashboardListItemRequest { + if o == nil || o.Dashboards == nil { + var ret []DashboardListItemRequest + return ret + } + return o.Dashboards +} + +// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListDeleteItemsRequest) GetDashboardsOk() (*[]DashboardListItemRequest, bool) { + if o == nil || o.Dashboards == nil { + return nil, false + } + return &o.Dashboards, true +} + +// HasDashboards returns a boolean if a field has been set. +func (o *DashboardListDeleteItemsRequest) HasDashboards() bool { + if o != nil && o.Dashboards != nil { + return true + } + + return false +} + +// SetDashboards gets a reference to the given []DashboardListItemRequest and assigns it to the Dashboards field. +func (o *DashboardListDeleteItemsRequest) SetDashboards(v []DashboardListItemRequest) { + o.Dashboards = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListDeleteItemsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Dashboards != nil { + toSerialize["dashboards"] = o.Dashboards + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListDeleteItemsRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Dashboards = all.Dashboards + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_delete_items_response.go b/api/v2/datadog/model_dashboard_list_delete_items_response.go new file mode 100644 index 00000000000..c30570d3896 --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_delete_items_response.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 datadog + +import ( + "encoding/json" +) + +// DashboardListDeleteItemsResponse Response containing a list of deleted dashboards. +type DashboardListDeleteItemsResponse struct { + // List of dashboards deleted from the dashboard list. + DeletedDashboardsFromList []DashboardListItemResponse `json:"deleted_dashboards_from_list,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{} +} + +// NewDashboardListDeleteItemsResponse instantiates a new DashboardListDeleteItemsResponse 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 NewDashboardListDeleteItemsResponse() *DashboardListDeleteItemsResponse { + this := DashboardListDeleteItemsResponse{} + return &this +} + +// NewDashboardListDeleteItemsResponseWithDefaults instantiates a new DashboardListDeleteItemsResponse 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 NewDashboardListDeleteItemsResponseWithDefaults() *DashboardListDeleteItemsResponse { + this := DashboardListDeleteItemsResponse{} + return &this +} + +// GetDeletedDashboardsFromList returns the DeletedDashboardsFromList field value if set, zero value otherwise. +func (o *DashboardListDeleteItemsResponse) GetDeletedDashboardsFromList() []DashboardListItemResponse { + if o == nil || o.DeletedDashboardsFromList == nil { + var ret []DashboardListItemResponse + return ret + } + return o.DeletedDashboardsFromList +} + +// GetDeletedDashboardsFromListOk returns a tuple with the DeletedDashboardsFromList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListDeleteItemsResponse) GetDeletedDashboardsFromListOk() (*[]DashboardListItemResponse, bool) { + if o == nil || o.DeletedDashboardsFromList == nil { + return nil, false + } + return &o.DeletedDashboardsFromList, true +} + +// HasDeletedDashboardsFromList returns a boolean if a field has been set. +func (o *DashboardListDeleteItemsResponse) HasDeletedDashboardsFromList() bool { + if o != nil && o.DeletedDashboardsFromList != nil { + return true + } + + return false +} + +// SetDeletedDashboardsFromList gets a reference to the given []DashboardListItemResponse and assigns it to the DeletedDashboardsFromList field. +func (o *DashboardListDeleteItemsResponse) SetDeletedDashboardsFromList(v []DashboardListItemResponse) { + o.DeletedDashboardsFromList = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListDeleteItemsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DeletedDashboardsFromList != nil { + toSerialize["deleted_dashboards_from_list"] = o.DeletedDashboardsFromList + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListDeleteItemsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DeletedDashboardsFromList []DashboardListItemResponse `json:"deleted_dashboards_from_list,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DeletedDashboardsFromList = all.DeletedDashboardsFromList + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_item.go b/api/v2/datadog/model_dashboard_list_item.go new file mode 100644 index 00000000000..4e4b6eb8874 --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_item.go @@ -0,0 +1,550 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" +) + +// DashboardListItem A dashboard within a list. +type DashboardListItem struct { + // Creator of the object. + Author *Creator `json:"author,omitempty"` + // Date of creation of the dashboard. + Created *time.Time `json:"created,omitempty"` + // URL to the icon of the dashboard. + Icon *string `json:"icon,omitempty"` + // ID of the dashboard. + Id string `json:"id"` + // Whether or not the dashboard is in the favorites. + IsFavorite *bool `json:"is_favorite,omitempty"` + // Whether or not the dashboard is read only. + IsReadOnly *bool `json:"is_read_only,omitempty"` + // Whether the dashboard is publicly shared or not. + IsShared *bool `json:"is_shared,omitempty"` + // Date of last edition of the dashboard. + Modified *time.Time `json:"modified,omitempty"` + // Popularity of the dashboard. + Popularity *int32 `json:"popularity,omitempty"` + // Title of the dashboard. + Title *string `json:"title,omitempty"` + // The type of the dashboard. + Type DashboardType `json:"type"` + // URL path to the dashboard. + Url *string `json:"url,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{} +} + +// NewDashboardListItem instantiates a new DashboardListItem 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 NewDashboardListItem(id string, typeVar DashboardType) *DashboardListItem { + this := DashboardListItem{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewDashboardListItemWithDefaults instantiates a new DashboardListItem 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 NewDashboardListItemWithDefaults() *DashboardListItem { + this := DashboardListItem{} + return &this +} + +// GetAuthor returns the Author field value if set, zero value otherwise. +func (o *DashboardListItem) GetAuthor() Creator { + if o == nil || o.Author == nil { + var ret Creator + return ret + } + return *o.Author +} + +// GetAuthorOk returns a tuple with the Author field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetAuthorOk() (*Creator, bool) { + if o == nil || o.Author == nil { + return nil, false + } + return o.Author, true +} + +// HasAuthor returns a boolean if a field has been set. +func (o *DashboardListItem) HasAuthor() bool { + if o != nil && o.Author != nil { + return true + } + + return false +} + +// SetAuthor gets a reference to the given Creator and assigns it to the Author field. +func (o *DashboardListItem) SetAuthor(v Creator) { + o.Author = &v +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *DashboardListItem) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *DashboardListItem) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *DashboardListItem) SetCreated(v time.Time) { + o.Created = &v +} + +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *DashboardListItem) GetIcon() string { + if o == nil || o.Icon == nil { + var ret string + return ret + } + return *o.Icon +} + +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { + return nil, false + } + return o.Icon, true +} + +// HasIcon returns a boolean if a field has been set. +func (o *DashboardListItem) HasIcon() bool { + if o != nil && o.Icon != nil { + return true + } + + return false +} + +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *DashboardListItem) SetIcon(v string) { + o.Icon = &v +} + +// GetId returns the Id field value. +func (o *DashboardListItem) 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 *DashboardListItem) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DashboardListItem) SetId(v string) { + o.Id = v +} + +// GetIsFavorite returns the IsFavorite field value if set, zero value otherwise. +func (o *DashboardListItem) GetIsFavorite() bool { + if o == nil || o.IsFavorite == nil { + var ret bool + return ret + } + return *o.IsFavorite +} + +// GetIsFavoriteOk returns a tuple with the IsFavorite field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetIsFavoriteOk() (*bool, bool) { + if o == nil || o.IsFavorite == nil { + return nil, false + } + return o.IsFavorite, true +} + +// HasIsFavorite returns a boolean if a field has been set. +func (o *DashboardListItem) HasIsFavorite() bool { + if o != nil && o.IsFavorite != nil { + return true + } + + return false +} + +// SetIsFavorite gets a reference to the given bool and assigns it to the IsFavorite field. +func (o *DashboardListItem) SetIsFavorite(v bool) { + o.IsFavorite = &v +} + +// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise. +func (o *DashboardListItem) GetIsReadOnly() bool { + if o == nil || o.IsReadOnly == nil { + var ret bool + return ret + } + return *o.IsReadOnly +} + +// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetIsReadOnlyOk() (*bool, bool) { + if o == nil || o.IsReadOnly == nil { + return nil, false + } + return o.IsReadOnly, true +} + +// HasIsReadOnly returns a boolean if a field has been set. +func (o *DashboardListItem) HasIsReadOnly() bool { + if o != nil && o.IsReadOnly != nil { + return true + } + + return false +} + +// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field. +func (o *DashboardListItem) SetIsReadOnly(v bool) { + o.IsReadOnly = &v +} + +// GetIsShared returns the IsShared field value if set, zero value otherwise. +func (o *DashboardListItem) GetIsShared() bool { + if o == nil || o.IsShared == nil { + var ret bool + return ret + } + return *o.IsShared +} + +// GetIsSharedOk returns a tuple with the IsShared field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetIsSharedOk() (*bool, bool) { + if o == nil || o.IsShared == nil { + return nil, false + } + return o.IsShared, true +} + +// HasIsShared returns a boolean if a field has been set. +func (o *DashboardListItem) HasIsShared() bool { + if o != nil && o.IsShared != nil { + return true + } + + return false +} + +// SetIsShared gets a reference to the given bool and assigns it to the IsShared field. +func (o *DashboardListItem) SetIsShared(v bool) { + o.IsShared = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *DashboardListItem) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *DashboardListItem) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *DashboardListItem) SetModified(v time.Time) { + o.Modified = &v +} + +// GetPopularity returns the Popularity field value if set, zero value otherwise. +func (o *DashboardListItem) GetPopularity() int32 { + if o == nil || o.Popularity == nil { + var ret int32 + return ret + } + return *o.Popularity +} + +// GetPopularityOk returns a tuple with the Popularity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetPopularityOk() (*int32, bool) { + if o == nil || o.Popularity == nil { + return nil, false + } + return o.Popularity, true +} + +// HasPopularity returns a boolean if a field has been set. +func (o *DashboardListItem) HasPopularity() bool { + if o != nil && o.Popularity != nil { + return true + } + + return false +} + +// SetPopularity gets a reference to the given int32 and assigns it to the Popularity field. +func (o *DashboardListItem) SetPopularity(v int32) { + o.Popularity = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *DashboardListItem) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *DashboardListItem) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *DashboardListItem) SetTitle(v string) { + o.Title = &v +} + +// GetType returns the Type field value. +func (o *DashboardListItem) GetType() DashboardType { + if o == nil { + var ret DashboardType + 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 *DashboardListItem) GetTypeOk() (*DashboardType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DashboardListItem) SetType(v DashboardType) { + o.Type = v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *DashboardListItem) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItem) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *DashboardListItem) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *DashboardListItem) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Author != nil { + toSerialize["author"] = o.Author + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } + toSerialize["id"] = o.Id + if o.IsFavorite != nil { + toSerialize["is_favorite"] = o.IsFavorite + } + if o.IsReadOnly != nil { + toSerialize["is_read_only"] = o.IsReadOnly + } + if o.IsShared != nil { + toSerialize["is_shared"] = o.IsShared + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Popularity != nil { + toSerialize["popularity"] = o.Popularity + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + toSerialize["type"] = o.Type + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListItem) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *DashboardType `json:"type"` + }{} + all := struct { + Author *Creator `json:"author,omitempty"` + Created *time.Time `json:"created,omitempty"` + Icon *string `json:"icon,omitempty"` + Id string `json:"id"` + IsFavorite *bool `json:"is_favorite,omitempty"` + IsReadOnly *bool `json:"is_read_only,omitempty"` + IsShared *bool `json:"is_shared,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Popularity *int32 `json:"popularity,omitempty"` + Title *string `json:"title,omitempty"` + Type DashboardType `json:"type"` + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Author = all.Author + o.Created = all.Created + o.Icon = all.Icon + o.Id = all.Id + o.IsFavorite = all.IsFavorite + o.IsReadOnly = all.IsReadOnly + o.IsShared = all.IsShared + o.Modified = all.Modified + o.Popularity = all.Popularity + o.Title = all.Title + o.Type = all.Type + o.Url = all.Url + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_item_request.go b/api/v2/datadog/model_dashboard_list_item_request.go new file mode 100644 index 00000000000..2c801c68c62 --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_item_request.go @@ -0,0 +1,144 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardListItemRequest A dashboard within a list. +type DashboardListItemRequest struct { + // ID of the dashboard. + Id string `json:"id"` + // The type of the dashboard. + Type DashboardType `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{} +} + +// NewDashboardListItemRequest instantiates a new DashboardListItemRequest 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 NewDashboardListItemRequest(id string, typeVar DashboardType) *DashboardListItemRequest { + this := DashboardListItemRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewDashboardListItemRequestWithDefaults instantiates a new DashboardListItemRequest 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 NewDashboardListItemRequestWithDefaults() *DashboardListItemRequest { + this := DashboardListItemRequest{} + return &this +} + +// GetId returns the Id field value. +func (o *DashboardListItemRequest) 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 *DashboardListItemRequest) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DashboardListItemRequest) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *DashboardListItemRequest) GetType() DashboardType { + if o == nil { + var ret DashboardType + 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 *DashboardListItemRequest) GetTypeOk() (*DashboardType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DashboardListItemRequest) SetType(v DashboardType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListItemRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListItemRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *DashboardType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type DashboardType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_item_response.go b/api/v2/datadog/model_dashboard_list_item_response.go new file mode 100644 index 00000000000..f6f0b5afe18 --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_item_response.go @@ -0,0 +1,144 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardListItemResponse A dashboard within a list. +type DashboardListItemResponse struct { + // ID of the dashboard. + Id string `json:"id"` + // The type of the dashboard. + Type DashboardType `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{} +} + +// NewDashboardListItemResponse instantiates a new DashboardListItemResponse 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 NewDashboardListItemResponse(id string, typeVar DashboardType) *DashboardListItemResponse { + this := DashboardListItemResponse{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewDashboardListItemResponseWithDefaults instantiates a new DashboardListItemResponse 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 NewDashboardListItemResponseWithDefaults() *DashboardListItemResponse { + this := DashboardListItemResponse{} + return &this +} + +// GetId returns the Id field value. +func (o *DashboardListItemResponse) 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 *DashboardListItemResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DashboardListItemResponse) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *DashboardListItemResponse) GetType() DashboardType { + if o == nil { + var ret DashboardType + 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 *DashboardListItemResponse) GetTypeOk() (*DashboardType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DashboardListItemResponse) SetType(v DashboardType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListItemResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListItemResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *DashboardType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type DashboardType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_items.go b/api/v2/datadog/model_dashboard_list_items.go new file mode 100644 index 00000000000..23ff5215d29 --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_items.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardListItems Dashboards within a list. +type DashboardListItems struct { + // List of dashboards in the dashboard list. + Dashboards []DashboardListItem `json:"dashboards"` + // Number of dashboards in the dashboard list. + Total *int64 `json:"total,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{} +} + +// NewDashboardListItems instantiates a new DashboardListItems 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 NewDashboardListItems(dashboards []DashboardListItem) *DashboardListItems { + this := DashboardListItems{} + this.Dashboards = dashboards + return &this +} + +// NewDashboardListItemsWithDefaults instantiates a new DashboardListItems 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 NewDashboardListItemsWithDefaults() *DashboardListItems { + this := DashboardListItems{} + return &this +} + +// GetDashboards returns the Dashboards field value. +func (o *DashboardListItems) GetDashboards() []DashboardListItem { + if o == nil { + var ret []DashboardListItem + return ret + } + return o.Dashboards +} + +// GetDashboardsOk returns a tuple with the Dashboards field value +// and a boolean to check if the value has been set. +func (o *DashboardListItems) GetDashboardsOk() (*[]DashboardListItem, bool) { + if o == nil { + return nil, false + } + return &o.Dashboards, true +} + +// SetDashboards sets field value. +func (o *DashboardListItems) SetDashboards(v []DashboardListItem) { + o.Dashboards = v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *DashboardListItems) GetTotal() int64 { + if o == nil || o.Total == nil { + var ret int64 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListItems) GetTotalOk() (*int64, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *DashboardListItems) HasTotal() bool { + if o != nil && o.Total != nil { + return true + } + + return false +} + +// SetTotal gets a reference to the given int64 and assigns it to the Total field. +func (o *DashboardListItems) SetTotal(v int64) { + o.Total = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["dashboards"] = o.Dashboards + if o.Total != nil { + toSerialize["total"] = o.Total + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListItems) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Dashboards *[]DashboardListItem `json:"dashboards"` + }{} + all := struct { + Dashboards []DashboardListItem `json:"dashboards"` + Total *int64 `json:"total,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Dashboards == nil { + return fmt.Errorf("Required field dashboards missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Dashboards = all.Dashboards + o.Total = all.Total + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_update_items_request.go b/api/v2/datadog/model_dashboard_list_update_items_request.go new file mode 100644 index 00000000000..6e719d903cd --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_update_items_request.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 datadog + +import ( + "encoding/json" +) + +// DashboardListUpdateItemsRequest Request containing the list of dashboards to update to. +type DashboardListUpdateItemsRequest struct { + // List of dashboards to update the dashboard list to. + Dashboards []DashboardListItemRequest `json:"dashboards,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{} +} + +// NewDashboardListUpdateItemsRequest instantiates a new DashboardListUpdateItemsRequest 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 NewDashboardListUpdateItemsRequest() *DashboardListUpdateItemsRequest { + this := DashboardListUpdateItemsRequest{} + return &this +} + +// NewDashboardListUpdateItemsRequestWithDefaults instantiates a new DashboardListUpdateItemsRequest 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 NewDashboardListUpdateItemsRequestWithDefaults() *DashboardListUpdateItemsRequest { + this := DashboardListUpdateItemsRequest{} + return &this +} + +// GetDashboards returns the Dashboards field value if set, zero value otherwise. +func (o *DashboardListUpdateItemsRequest) GetDashboards() []DashboardListItemRequest { + if o == nil || o.Dashboards == nil { + var ret []DashboardListItemRequest + return ret + } + return o.Dashboards +} + +// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListUpdateItemsRequest) GetDashboardsOk() (*[]DashboardListItemRequest, bool) { + if o == nil || o.Dashboards == nil { + return nil, false + } + return &o.Dashboards, true +} + +// HasDashboards returns a boolean if a field has been set. +func (o *DashboardListUpdateItemsRequest) HasDashboards() bool { + if o != nil && o.Dashboards != nil { + return true + } + + return false +} + +// SetDashboards gets a reference to the given []DashboardListItemRequest and assigns it to the Dashboards field. +func (o *DashboardListUpdateItemsRequest) SetDashboards(v []DashboardListItemRequest) { + o.Dashboards = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListUpdateItemsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Dashboards != nil { + toSerialize["dashboards"] = o.Dashboards + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListUpdateItemsRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Dashboards = all.Dashboards + return nil +} diff --git a/api/v2/datadog/model_dashboard_list_update_items_response.go b/api/v2/datadog/model_dashboard_list_update_items_response.go new file mode 100644 index 00000000000..69346e7deaa --- /dev/null +++ b/api/v2/datadog/model_dashboard_list_update_items_response.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 datadog + +import ( + "encoding/json" +) + +// DashboardListUpdateItemsResponse Response containing a list of updated dashboards. +type DashboardListUpdateItemsResponse struct { + // List of dashboards in the dashboard list. + Dashboards []DashboardListItemResponse `json:"dashboards,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{} +} + +// NewDashboardListUpdateItemsResponse instantiates a new DashboardListUpdateItemsResponse 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 NewDashboardListUpdateItemsResponse() *DashboardListUpdateItemsResponse { + this := DashboardListUpdateItemsResponse{} + return &this +} + +// NewDashboardListUpdateItemsResponseWithDefaults instantiates a new DashboardListUpdateItemsResponse 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 NewDashboardListUpdateItemsResponseWithDefaults() *DashboardListUpdateItemsResponse { + this := DashboardListUpdateItemsResponse{} + return &this +} + +// GetDashboards returns the Dashboards field value if set, zero value otherwise. +func (o *DashboardListUpdateItemsResponse) GetDashboards() []DashboardListItemResponse { + if o == nil || o.Dashboards == nil { + var ret []DashboardListItemResponse + return ret + } + return o.Dashboards +} + +// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DashboardListUpdateItemsResponse) GetDashboardsOk() (*[]DashboardListItemResponse, bool) { + if o == nil || o.Dashboards == nil { + return nil, false + } + return &o.Dashboards, true +} + +// HasDashboards returns a boolean if a field has been set. +func (o *DashboardListUpdateItemsResponse) HasDashboards() bool { + if o != nil && o.Dashboards != nil { + return true + } + + return false +} + +// SetDashboards gets a reference to the given []DashboardListItemResponse and assigns it to the Dashboards field. +func (o *DashboardListUpdateItemsResponse) SetDashboards(v []DashboardListItemResponse) { + o.Dashboards = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DashboardListUpdateItemsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Dashboards != nil { + toSerialize["dashboards"] = o.Dashboards + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DashboardListUpdateItemsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Dashboards []DashboardListItemResponse `json:"dashboards,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Dashboards = all.Dashboards + return nil +} diff --git a/api/v2/datadog/model_dashboard_type.go b/api/v2/datadog/model_dashboard_type.go new file mode 100644 index 00000000000..2d74daf3660 --- /dev/null +++ b/api/v2/datadog/model_dashboard_type.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// DashboardType The type of the dashboard. +type DashboardType string + +// List of DashboardType. +const ( + DASHBOARDTYPE_CUSTOM_TIMEBOARD DashboardType = "custom_timeboard" + DASHBOARDTYPE_CUSTOM_SCREENBOARD DashboardType = "custom_screenboard" + DASHBOARDTYPE_INTEGRATION_SCREENBOARD DashboardType = "integration_screenboard" + DASHBOARDTYPE_INTEGRATION_TIMEBOARD DashboardType = "integration_timeboard" + DASHBOARDTYPE_HOST_TIMEBOARD DashboardType = "host_timeboard" +) + +var allowedDashboardTypeEnumValues = []DashboardType{ + DASHBOARDTYPE_CUSTOM_TIMEBOARD, + DASHBOARDTYPE_CUSTOM_SCREENBOARD, + DASHBOARDTYPE_INTEGRATION_SCREENBOARD, + DASHBOARDTYPE_INTEGRATION_TIMEBOARD, + DASHBOARDTYPE_HOST_TIMEBOARD, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DashboardType) GetAllowedValues() []DashboardType { + return allowedDashboardTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DashboardType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DashboardType(value) + return nil +} + +// NewDashboardTypeFromValue returns a pointer to a valid DashboardType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDashboardTypeFromValue(v string) (*DashboardType, error) { + ev := DashboardType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DashboardType: valid values are %v", v, allowedDashboardTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DashboardType) IsValid() bool { + for _, existing := range allowedDashboardTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DashboardType value. +func (v DashboardType) Ptr() *DashboardType { + return &v +} + +// NullableDashboardType handles when a null is used for DashboardType. +type NullableDashboardType struct { + value *DashboardType + isSet bool +} + +// Get returns the associated value. +func (v NullableDashboardType) Get() *DashboardType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableDashboardType) Set(val *DashboardType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableDashboardType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableDashboardType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableDashboardType initializes the struct as if Set has been called. +func NewNullableDashboardType(val *DashboardType) *NullableDashboardType { + return &NullableDashboardType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableDashboardType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableDashboardType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_event.go b/api/v2/datadog/model_event.go new file mode 100644 index 00000000000..cffc4f19fc1 --- /dev/null +++ b/api/v2/datadog/model_event.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Event The metadata associated with a request. +type Event struct { + // Event ID. + Id *string `json:"id,omitempty"` + // The event name. + Name *string `json:"name,omitempty"` + // Event source ID. + SourceId *int32 `json:"source_id,omitempty"` + // Event type. + Type *string `json:"type,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{} +} + +// NewEvent instantiates a new Event 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 NewEvent() *Event { + this := Event{} + return &this +} + +// NewEventWithDefaults instantiates a new Event 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 NewEventWithDefaults() *Event { + this := Event{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Event) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Event) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Event) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Event) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Event) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Event) SetName(v string) { + o.Name = &v +} + +// GetSourceId returns the SourceId field value if set, zero value otherwise. +func (o *Event) GetSourceId() int32 { + if o == nil || o.SourceId == nil { + var ret int32 + return ret + } + return *o.SourceId +} + +// GetSourceIdOk returns a tuple with the SourceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetSourceIdOk() (*int32, bool) { + if o == nil || o.SourceId == nil { + return nil, false + } + return o.SourceId, true +} + +// HasSourceId returns a boolean if a field has been set. +func (o *Event) HasSourceId() bool { + if o != nil && o.SourceId != nil { + return true + } + + return false +} + +// SetSourceId gets a reference to the given int32 and assigns it to the SourceId field. +func (o *Event) SetSourceId(v int32) { + o.SourceId = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Event) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Event) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Event) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Event) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.SourceId != nil { + toSerialize["source_id"] = o.SourceId + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Event) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + SourceId *int32 `json:"source_id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Name = all.Name + o.SourceId = all.SourceId + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_event_attributes.go b/api/v2/datadog/model_event_attributes.go new file mode 100644 index 00000000000..49768ea1ff2 --- /dev/null +++ b/api/v2/datadog/model_event_attributes.go @@ -0,0 +1,869 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// EventAttributes Object description of attributes from your event. +type EventAttributes struct { + // Aggregation key of the event. + AggregationKey *string `json:"aggregation_key,omitempty"` + // POSIX timestamp of the event. Must be sent as an integer (no quotation marks). + // Limited to events no older than 18 hours. + DateHappened *int64 `json:"date_happened,omitempty"` + // A device name. + DeviceName *string `json:"device_name,omitempty"` + // The duration between the triggering of the event and its recovery in nanoseconds. + Duration *int64 `json:"duration,omitempty"` + // The event title. + EventObject *string `json:"event_object,omitempty"` + // The metadata associated with a request. + Evt *Event `json:"evt,omitempty"` + // Host name to associate with the event. + // Any tags associated with the host are also applied to this event. + Hostname *string `json:"hostname,omitempty"` + // Attributes from the monitor that triggered the event. + Monitor NullableMonitorType `json:"monitor,omitempty"` + // List of groups referred to in the event. + MonitorGroups []string `json:"monitor_groups,omitempty"` + // ID of the monitor that triggered the event. When an event isn't related to a monitor, this field is empty. + MonitorId common.NullableInt32 `json:"monitor_id,omitempty"` + // The priority of the event's monitor. For example, `normal` or `low`. + Priority NullableEventPriority `json:"priority,omitempty"` + // Related event ID. + RelatedEventId *int32 `json:"related_event_id,omitempty"` + // Service that triggered the event. + Service *string `json:"service,omitempty"` + // The type of event being posted. + // For example, `nagios`, `hudson`, `jenkins`, `my_apps`, `chef`, `puppet`, `git` or `bitbucket`. + // The list of standard source attribute values is [available here](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value). + SourceTypeName *string `json:"source_type_name,omitempty"` + // Identifier for the source of the event, such as a monitor alert, an externally-submitted event, or an integration. + Sourcecategory *string `json:"sourcecategory,omitempty"` + // If an alert event is enabled, its status is one of the following: + // `failure`, `error`, `warning`, `info`, `success`, `user_update`, + // `recommendation`, or `snapshot`. + Status *EventStatusType `json:"status,omitempty"` + // A list of tags to apply to the event. + Tags []string `json:"tags,omitempty"` + // POSIX timestamp of your event in milliseconds. + Timestamp *int64 `json:"timestamp,omitempty"` + // The event title. + Title *string `json:"title,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{} +} + +// NewEventAttributes instantiates a new EventAttributes 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 NewEventAttributes() *EventAttributes { + this := EventAttributes{} + return &this +} + +// NewEventAttributesWithDefaults instantiates a new EventAttributes 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 NewEventAttributesWithDefaults() *EventAttributes { + this := EventAttributes{} + return &this +} + +// GetAggregationKey returns the AggregationKey field value if set, zero value otherwise. +func (o *EventAttributes) GetAggregationKey() string { + if o == nil || o.AggregationKey == nil { + var ret string + return ret + } + return *o.AggregationKey +} + +// GetAggregationKeyOk returns a tuple with the AggregationKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetAggregationKeyOk() (*string, bool) { + if o == nil || o.AggregationKey == nil { + return nil, false + } + return o.AggregationKey, true +} + +// HasAggregationKey returns a boolean if a field has been set. +func (o *EventAttributes) HasAggregationKey() bool { + if o != nil && o.AggregationKey != nil { + return true + } + + return false +} + +// SetAggregationKey gets a reference to the given string and assigns it to the AggregationKey field. +func (o *EventAttributes) SetAggregationKey(v string) { + o.AggregationKey = &v +} + +// GetDateHappened returns the DateHappened field value if set, zero value otherwise. +func (o *EventAttributes) GetDateHappened() int64 { + if o == nil || o.DateHappened == nil { + var ret int64 + return ret + } + return *o.DateHappened +} + +// GetDateHappenedOk returns a tuple with the DateHappened field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetDateHappenedOk() (*int64, bool) { + if o == nil || o.DateHappened == nil { + return nil, false + } + return o.DateHappened, true +} + +// HasDateHappened returns a boolean if a field has been set. +func (o *EventAttributes) HasDateHappened() bool { + if o != nil && o.DateHappened != nil { + return true + } + + return false +} + +// SetDateHappened gets a reference to the given int64 and assigns it to the DateHappened field. +func (o *EventAttributes) SetDateHappened(v int64) { + o.DateHappened = &v +} + +// GetDeviceName returns the DeviceName field value if set, zero value otherwise. +func (o *EventAttributes) GetDeviceName() string { + if o == nil || o.DeviceName == nil { + var ret string + return ret + } + return *o.DeviceName +} + +// GetDeviceNameOk returns a tuple with the DeviceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetDeviceNameOk() (*string, bool) { + if o == nil || o.DeviceName == nil { + return nil, false + } + return o.DeviceName, true +} + +// HasDeviceName returns a boolean if a field has been set. +func (o *EventAttributes) HasDeviceName() bool { + if o != nil && o.DeviceName != nil { + return true + } + + return false +} + +// SetDeviceName gets a reference to the given string and assigns it to the DeviceName field. +func (o *EventAttributes) SetDeviceName(v string) { + o.DeviceName = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *EventAttributes) GetDuration() int64 { + if o == nil || o.Duration == nil { + var ret int64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetDurationOk() (*int64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *EventAttributes) HasDuration() bool { + if o != nil && o.Duration != nil { + return true + } + + return false +} + +// SetDuration gets a reference to the given int64 and assigns it to the Duration field. +func (o *EventAttributes) SetDuration(v int64) { + o.Duration = &v +} + +// GetEventObject returns the EventObject field value if set, zero value otherwise. +func (o *EventAttributes) GetEventObject() string { + if o == nil || o.EventObject == nil { + var ret string + return ret + } + return *o.EventObject +} + +// GetEventObjectOk returns a tuple with the EventObject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetEventObjectOk() (*string, bool) { + if o == nil || o.EventObject == nil { + return nil, false + } + return o.EventObject, true +} + +// HasEventObject returns a boolean if a field has been set. +func (o *EventAttributes) HasEventObject() bool { + if o != nil && o.EventObject != nil { + return true + } + + return false +} + +// SetEventObject gets a reference to the given string and assigns it to the EventObject field. +func (o *EventAttributes) SetEventObject(v string) { + o.EventObject = &v +} + +// GetEvt returns the Evt field value if set, zero value otherwise. +func (o *EventAttributes) GetEvt() Event { + if o == nil || o.Evt == nil { + var ret Event + return ret + } + return *o.Evt +} + +// GetEvtOk returns a tuple with the Evt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetEvtOk() (*Event, bool) { + if o == nil || o.Evt == nil { + return nil, false + } + return o.Evt, true +} + +// HasEvt returns a boolean if a field has been set. +func (o *EventAttributes) HasEvt() bool { + if o != nil && o.Evt != nil { + return true + } + + return false +} + +// SetEvt gets a reference to the given Event and assigns it to the Evt field. +func (o *EventAttributes) SetEvt(v Event) { + o.Evt = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *EventAttributes) 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 *EventAttributes) 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 *EventAttributes) HasHostname() bool { + if o != nil && o.Hostname != nil { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *EventAttributes) SetHostname(v string) { + o.Hostname = &v +} + +// GetMonitor returns the Monitor field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EventAttributes) GetMonitor() MonitorType { + if o == nil || o.Monitor.Get() == nil { + var ret MonitorType + return ret + } + return *o.Monitor.Get() +} + +// GetMonitorOk returns a tuple with the Monitor 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 *EventAttributes) GetMonitorOk() (*MonitorType, bool) { + if o == nil { + return nil, false + } + return o.Monitor.Get(), o.Monitor.IsSet() +} + +// HasMonitor returns a boolean if a field has been set. +func (o *EventAttributes) HasMonitor() bool { + if o != nil && o.Monitor.IsSet() { + return true + } + + return false +} + +// SetMonitor gets a reference to the given NullableMonitorType and assigns it to the Monitor field. +func (o *EventAttributes) SetMonitor(v MonitorType) { + o.Monitor.Set(&v) +} + +// SetMonitorNil sets the value for Monitor to be an explicit nil. +func (o *EventAttributes) SetMonitorNil() { + o.Monitor.Set(nil) +} + +// UnsetMonitor ensures that no value is present for Monitor, not even an explicit nil. +func (o *EventAttributes) UnsetMonitor() { + o.Monitor.Unset() +} + +// GetMonitorGroups returns the MonitorGroups field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EventAttributes) GetMonitorGroups() []string { + if o == nil { + var ret []string + return ret + } + return o.MonitorGroups +} + +// GetMonitorGroupsOk returns a tuple with the MonitorGroups 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 *EventAttributes) GetMonitorGroupsOk() (*[]string, bool) { + if o == nil || o.MonitorGroups == nil { + return nil, false + } + return &o.MonitorGroups, true +} + +// HasMonitorGroups returns a boolean if a field has been set. +func (o *EventAttributes) HasMonitorGroups() bool { + if o != nil && o.MonitorGroups != nil { + return true + } + + return false +} + +// SetMonitorGroups gets a reference to the given []string and assigns it to the MonitorGroups field. +func (o *EventAttributes) SetMonitorGroups(v []string) { + o.MonitorGroups = v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EventAttributes) GetMonitorId() int32 { + if o == nil || o.MonitorId.Get() == nil { + var ret int32 + return ret + } + return *o.MonitorId.Get() +} + +// GetMonitorIdOk returns a tuple with the MonitorId 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 *EventAttributes) GetMonitorIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.MonitorId.Get(), o.MonitorId.IsSet() +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *EventAttributes) HasMonitorId() bool { + if o != nil && o.MonitorId.IsSet() { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given common.NullableInt32 and assigns it to the MonitorId field. +func (o *EventAttributes) SetMonitorId(v int32) { + o.MonitorId.Set(&v) +} + +// SetMonitorIdNil sets the value for MonitorId to be an explicit nil. +func (o *EventAttributes) SetMonitorIdNil() { + o.MonitorId.Set(nil) +} + +// UnsetMonitorId ensures that no value is present for MonitorId, not even an explicit nil. +func (o *EventAttributes) UnsetMonitorId() { + o.MonitorId.Unset() +} + +// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EventAttributes) GetPriority() EventPriority { + if o == nil || o.Priority.Get() == nil { + var ret EventPriority + return ret + } + return *o.Priority.Get() +} + +// GetPriorityOk returns a tuple with the Priority 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 *EventAttributes) GetPriorityOk() (*EventPriority, bool) { + if o == nil { + return nil, false + } + return o.Priority.Get(), o.Priority.IsSet() +} + +// HasPriority returns a boolean if a field has been set. +func (o *EventAttributes) HasPriority() bool { + if o != nil && o.Priority.IsSet() { + return true + } + + return false +} + +// SetPriority gets a reference to the given NullableEventPriority and assigns it to the Priority field. +func (o *EventAttributes) SetPriority(v EventPriority) { + o.Priority.Set(&v) +} + +// SetPriorityNil sets the value for Priority to be an explicit nil. +func (o *EventAttributes) SetPriorityNil() { + o.Priority.Set(nil) +} + +// UnsetPriority ensures that no value is present for Priority, not even an explicit nil. +func (o *EventAttributes) UnsetPriority() { + o.Priority.Unset() +} + +// GetRelatedEventId returns the RelatedEventId field value if set, zero value otherwise. +func (o *EventAttributes) GetRelatedEventId() int32 { + if o == nil || o.RelatedEventId == nil { + var ret int32 + return ret + } + return *o.RelatedEventId +} + +// GetRelatedEventIdOk returns a tuple with the RelatedEventId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetRelatedEventIdOk() (*int32, bool) { + if o == nil || o.RelatedEventId == nil { + return nil, false + } + return o.RelatedEventId, true +} + +// HasRelatedEventId returns a boolean if a field has been set. +func (o *EventAttributes) HasRelatedEventId() bool { + if o != nil && o.RelatedEventId != nil { + return true + } + + return false +} + +// SetRelatedEventId gets a reference to the given int32 and assigns it to the RelatedEventId field. +func (o *EventAttributes) SetRelatedEventId(v int32) { + o.RelatedEventId = &v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *EventAttributes) 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 *EventAttributes) 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 *EventAttributes) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *EventAttributes) SetService(v string) { + o.Service = &v +} + +// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. +func (o *EventAttributes) GetSourceTypeName() string { + if o == nil || o.SourceTypeName == nil { + var ret string + return ret + } + return *o.SourceTypeName +} + +// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetSourceTypeNameOk() (*string, bool) { + if o == nil || o.SourceTypeName == nil { + return nil, false + } + return o.SourceTypeName, true +} + +// HasSourceTypeName returns a boolean if a field has been set. +func (o *EventAttributes) HasSourceTypeName() bool { + if o != nil && o.SourceTypeName != nil { + return true + } + + return false +} + +// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. +func (o *EventAttributes) SetSourceTypeName(v string) { + o.SourceTypeName = &v +} + +// GetSourcecategory returns the Sourcecategory field value if set, zero value otherwise. +func (o *EventAttributes) GetSourcecategory() string { + if o == nil || o.Sourcecategory == nil { + var ret string + return ret + } + return *o.Sourcecategory +} + +// GetSourcecategoryOk returns a tuple with the Sourcecategory field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetSourcecategoryOk() (*string, bool) { + if o == nil || o.Sourcecategory == nil { + return nil, false + } + return o.Sourcecategory, true +} + +// HasSourcecategory returns a boolean if a field has been set. +func (o *EventAttributes) HasSourcecategory() bool { + if o != nil && o.Sourcecategory != nil { + return true + } + + return false +} + +// SetSourcecategory gets a reference to the given string and assigns it to the Sourcecategory field. +func (o *EventAttributes) SetSourcecategory(v string) { + o.Sourcecategory = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *EventAttributes) GetStatus() EventStatusType { + if o == nil || o.Status == nil { + var ret EventStatusType + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetStatusOk() (*EventStatusType, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *EventAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given EventStatusType and assigns it to the Status field. +func (o *EventAttributes) SetStatus(v EventStatusType) { + o.Status = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *EventAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *EventAttributes) GetTagsOk() (*[]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 *EventAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *EventAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *EventAttributes) GetTimestamp() int64 { + if o == nil || o.Timestamp == nil { + var ret int64 + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetTimestampOk() (*int64, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *EventAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. +func (o *EventAttributes) SetTimestamp(v int64) { + o.Timestamp = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *EventAttributes) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventAttributes) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *EventAttributes) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *EventAttributes) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AggregationKey != nil { + toSerialize["aggregation_key"] = o.AggregationKey + } + if o.DateHappened != nil { + toSerialize["date_happened"] = o.DateHappened + } + if o.DeviceName != nil { + toSerialize["device_name"] = o.DeviceName + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.EventObject != nil { + toSerialize["event_object"] = o.EventObject + } + if o.Evt != nil { + toSerialize["evt"] = o.Evt + } + if o.Hostname != nil { + toSerialize["hostname"] = o.Hostname + } + if o.Monitor.IsSet() { + toSerialize["monitor"] = o.Monitor.Get() + } + if o.MonitorGroups != nil { + toSerialize["monitor_groups"] = o.MonitorGroups + } + if o.MonitorId.IsSet() { + toSerialize["monitor_id"] = o.MonitorId.Get() + } + if o.Priority.IsSet() { + toSerialize["priority"] = o.Priority.Get() + } + if o.RelatedEventId != nil { + toSerialize["related_event_id"] = o.RelatedEventId + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.SourceTypeName != nil { + toSerialize["source_type_name"] = o.SourceTypeName + } + if o.Sourcecategory != nil { + toSerialize["sourcecategory"] = o.Sourcecategory + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + toSerialize["timestamp"] = o.Timestamp + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AggregationKey *string `json:"aggregation_key,omitempty"` + DateHappened *int64 `json:"date_happened,omitempty"` + DeviceName *string `json:"device_name,omitempty"` + Duration *int64 `json:"duration,omitempty"` + EventObject *string `json:"event_object,omitempty"` + Evt *Event `json:"evt,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Monitor NullableMonitorType `json:"monitor,omitempty"` + MonitorGroups []string `json:"monitor_groups,omitempty"` + MonitorId common.NullableInt32 `json:"monitor_id,omitempty"` + Priority NullableEventPriority `json:"priority,omitempty"` + RelatedEventId *int32 `json:"related_event_id,omitempty"` + Service *string `json:"service,omitempty"` + SourceTypeName *string `json:"source_type_name,omitempty"` + Sourcecategory *string `json:"sourcecategory,omitempty"` + Status *EventStatusType `json:"status,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *int64 `json:"timestamp,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Priority; v.Get() != nil && !v.Get().IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AggregationKey = all.AggregationKey + o.DateHappened = all.DateHappened + o.DeviceName = all.DeviceName + o.Duration = all.Duration + o.EventObject = all.EventObject + if all.Evt != nil && all.Evt.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Evt = all.Evt + o.Hostname = all.Hostname + o.Monitor = all.Monitor + o.MonitorGroups = all.MonitorGroups + o.MonitorId = all.MonitorId + o.Priority = all.Priority + o.RelatedEventId = all.RelatedEventId + o.Service = all.Service + o.SourceTypeName = all.SourceTypeName + o.Sourcecategory = all.Sourcecategory + o.Status = all.Status + o.Tags = all.Tags + o.Timestamp = all.Timestamp + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_event_priority.go b/api/v2/datadog/model_event_priority.go new file mode 100644 index 00000000000..d9ee443b662 --- /dev/null +++ b/api/v2/datadog/model_event_priority.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventPriority The priority of the event's monitor. For example, `normal` or `low`. +type EventPriority string + +// List of EventPriority. +const ( + EVENTPRIORITY_NORMAL EventPriority = "normal" + EVENTPRIORITY_LOW EventPriority = "low" +) + +var allowedEventPriorityEnumValues = []EventPriority{ + EVENTPRIORITY_NORMAL, + EVENTPRIORITY_LOW, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventPriority) GetAllowedValues() []EventPriority { + return allowedEventPriorityEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventPriority) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventPriority(value) + return nil +} + +// NewEventPriorityFromValue returns a pointer to a valid EventPriority +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventPriorityFromValue(v string) (*EventPriority, error) { + ev := EventPriority(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventPriority: valid values are %v", v, allowedEventPriorityEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventPriority) IsValid() bool { + for _, existing := range allowedEventPriorityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventPriority value. +func (v EventPriority) Ptr() *EventPriority { + return &v +} + +// NullableEventPriority handles when a null is used for EventPriority. +type NullableEventPriority struct { + value *EventPriority + isSet bool +} + +// Get returns the associated value. +func (v NullableEventPriority) Get() *EventPriority { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventPriority) Set(val *EventPriority) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventPriority) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventPriority) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventPriority initializes the struct as if Set has been called. +func NewNullableEventPriority(val *EventPriority) *NullableEventPriority { + return &NullableEventPriority{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventPriority) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventPriority) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_event_response.go b/api/v2/datadog/model_event_response.go new file mode 100644 index 00000000000..97d7a0ee4d0 --- /dev/null +++ b/api/v2/datadog/model_event_response.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventResponse The object description of an event after being processed and stored by Datadog. +type EventResponse struct { + // The object description of an event response attribute. + Attributes *EventResponseAttributes `json:"attributes,omitempty"` + // the unique ID of the event. + Id *string `json:"id,omitempty"` + // Type of the event. + Type *EventType `json:"type,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{} +} + +// NewEventResponse instantiates a new EventResponse 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 NewEventResponse() *EventResponse { + this := EventResponse{} + var typeVar EventType = EVENTTYPE_EVENT + this.Type = &typeVar + return &this +} + +// NewEventResponseWithDefaults instantiates a new EventResponse 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 NewEventResponseWithDefaults() *EventResponse { + this := EventResponse{} + var typeVar EventType = EVENTTYPE_EVENT + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *EventResponse) GetAttributes() EventResponseAttributes { + if o == nil || o.Attributes == nil { + var ret EventResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponse) GetAttributesOk() (*EventResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *EventResponse) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given EventResponseAttributes and assigns it to the Attributes field. +func (o *EventResponse) SetAttributes(v EventResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *EventResponse) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponse) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *EventResponse) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *EventResponse) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *EventResponse) GetType() EventType { + if o == nil || o.Type == nil { + var ret EventType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponse) GetTypeOk() (*EventType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *EventResponse) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given EventType and assigns it to the Type field. +func (o *EventResponse) SetType(v EventType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *EventResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *EventType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_event_response_attributes.go b/api/v2/datadog/model_event_response_attributes.go new file mode 100644 index 00000000000..a23e896d8b4 --- /dev/null +++ b/api/v2/datadog/model_event_response_attributes.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// EventResponseAttributes The object description of an event response attribute. +type EventResponseAttributes struct { + // Object description of attributes from your event. + Attributes *EventAttributes `json:"attributes,omitempty"` + // An array of tags associated with the event. + Tags []string `json:"tags,omitempty"` + // The timestamp of the event. + Timestamp *time.Time `json:"timestamp,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{} +} + +// NewEventResponseAttributes instantiates a new EventResponseAttributes 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 NewEventResponseAttributes() *EventResponseAttributes { + this := EventResponseAttributes{} + return &this +} + +// NewEventResponseAttributesWithDefaults instantiates a new EventResponseAttributes 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 NewEventResponseAttributesWithDefaults() *EventResponseAttributes { + this := EventResponseAttributes{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *EventResponseAttributes) GetAttributes() EventAttributes { + if o == nil || o.Attributes == nil { + var ret EventAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponseAttributes) GetAttributesOk() (*EventAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *EventResponseAttributes) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given EventAttributes and assigns it to the Attributes field. +func (o *EventResponseAttributes) SetAttributes(v EventAttributes) { + o.Attributes = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *EventResponseAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *EventResponseAttributes) GetTagsOk() (*[]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 *EventResponseAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *EventResponseAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *EventResponseAttributes) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventResponseAttributes) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *EventResponseAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *EventResponseAttributes) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *EventAttributes `json:"attributes,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Tags = all.Tags + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v2/datadog/model_event_status_type.go b/api/v2/datadog/model_event_status_type.go new file mode 100644 index 00000000000..4006b253b59 --- /dev/null +++ b/api/v2/datadog/model_event_status_type.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventStatusType If an alert event is enabled, its status is one of the following: +// `failure`, `error`, `warning`, `info`, `success`, `user_update`, +// `recommendation`, or `snapshot`. +type EventStatusType string + +// List of EventStatusType. +const ( + EVENTSTATUSTYPE_FAILURE EventStatusType = "failure" + EVENTSTATUSTYPE_ERROR EventStatusType = "error" + EVENTSTATUSTYPE_WARNING EventStatusType = "warning" + EVENTSTATUSTYPE_INFO EventStatusType = "info" + EVENTSTATUSTYPE_SUCCESS EventStatusType = "success" + EVENTSTATUSTYPE_USER_UPDATE EventStatusType = "user_update" + EVENTSTATUSTYPE_RECOMMENDATION EventStatusType = "recommendation" + EVENTSTATUSTYPE_SNAPSHOT EventStatusType = "snapshot" +) + +var allowedEventStatusTypeEnumValues = []EventStatusType{ + EVENTSTATUSTYPE_FAILURE, + EVENTSTATUSTYPE_ERROR, + EVENTSTATUSTYPE_WARNING, + EVENTSTATUSTYPE_INFO, + EVENTSTATUSTYPE_SUCCESS, + EVENTSTATUSTYPE_USER_UPDATE, + EVENTSTATUSTYPE_RECOMMENDATION, + EVENTSTATUSTYPE_SNAPSHOT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventStatusType) GetAllowedValues() []EventStatusType { + return allowedEventStatusTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventStatusType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventStatusType(value) + return nil +} + +// NewEventStatusTypeFromValue returns a pointer to a valid EventStatusType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventStatusTypeFromValue(v string) (*EventStatusType, error) { + ev := EventStatusType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventStatusType: valid values are %v", v, allowedEventStatusTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventStatusType) IsValid() bool { + for _, existing := range allowedEventStatusTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventStatusType value. +func (v EventStatusType) Ptr() *EventStatusType { + return &v +} + +// NullableEventStatusType handles when a null is used for EventStatusType. +type NullableEventStatusType struct { + value *EventStatusType + isSet bool +} + +// Get returns the associated value. +func (v NullableEventStatusType) Get() *EventStatusType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventStatusType) Set(val *EventStatusType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventStatusType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventStatusType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventStatusType initializes the struct as if Set has been called. +func NewNullableEventStatusType(val *EventStatusType) *NullableEventStatusType { + return &NullableEventStatusType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventStatusType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventStatusType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_event_type.go b/api/v2/datadog/model_event_type.go new file mode 100644 index 00000000000..817a3e4df64 --- /dev/null +++ b/api/v2/datadog/model_event_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventType Type of the event. +type EventType string + +// List of EventType. +const ( + EVENTTYPE_EVENT EventType = "event" +) + +var allowedEventTypeEnumValues = []EventType{ + EVENTTYPE_EVENT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventType) GetAllowedValues() []EventType { + return allowedEventTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventType(value) + return nil +} + +// NewEventTypeFromValue returns a pointer to a valid EventType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventTypeFromValue(v string) (*EventType, error) { + ev := EventType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventType: valid values are %v", v, allowedEventTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventType) IsValid() bool { + for _, existing := range allowedEventTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventType value. +func (v EventType) Ptr() *EventType { + return &v +} + +// NullableEventType handles when a null is used for EventType. +type NullableEventType struct { + value *EventType + isSet bool +} + +// Get returns the associated value. +func (v NullableEventType) Get() *EventType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventType) Set(val *EventType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventType initializes the struct as if Set has been called. +func NewNullableEventType(val *EventType) *NullableEventType { + return &NullableEventType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_events_list_request.go b/api/v2/datadog/model_events_list_request.go new file mode 100644 index 00000000000..8e5dc84a4ff --- /dev/null +++ b/api/v2/datadog/model_events_list_request.go @@ -0,0 +1,249 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsListRequest The object sent with the request to retrieve a list of events from your organization. +type EventsListRequest struct { + // The search and filter query settings. + Filter *EventsQueryFilter `json:"filter,omitempty"` + // The global query options that are used. Either provide a timezone or a time offset but not both, + // otherwise the query fails. + Options *EventsQueryOptions `json:"options,omitempty"` + // Pagination settings. + Page *EventsRequestPage `json:"page,omitempty"` + // The sort parameters when querying events. + Sort *EventsSort `json:"sort,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{} +} + +// NewEventsListRequest instantiates a new EventsListRequest 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 NewEventsListRequest() *EventsListRequest { + this := EventsListRequest{} + return &this +} + +// NewEventsListRequestWithDefaults instantiates a new EventsListRequest 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 NewEventsListRequestWithDefaults() *EventsListRequest { + this := EventsListRequest{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *EventsListRequest) GetFilter() EventsQueryFilter { + if o == nil || o.Filter == nil { + var ret EventsQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsListRequest) GetFilterOk() (*EventsQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *EventsListRequest) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given EventsQueryFilter and assigns it to the Filter field. +func (o *EventsListRequest) SetFilter(v EventsQueryFilter) { + o.Filter = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *EventsListRequest) GetOptions() EventsQueryOptions { + if o == nil || o.Options == nil { + var ret EventsQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsListRequest) GetOptionsOk() (*EventsQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *EventsListRequest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given EventsQueryOptions and assigns it to the Options field. +func (o *EventsListRequest) SetOptions(v EventsQueryOptions) { + o.Options = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *EventsListRequest) GetPage() EventsRequestPage { + if o == nil || o.Page == nil { + var ret EventsRequestPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsListRequest) GetPageOk() (*EventsRequestPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *EventsListRequest) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given EventsRequestPage and assigns it to the Page field. +func (o *EventsListRequest) SetPage(v EventsRequestPage) { + o.Page = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *EventsListRequest) GetSort() EventsSort { + if o == nil || o.Sort == nil { + var ret EventsSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsListRequest) GetSortOk() (*EventsSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *EventsListRequest) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given EventsSort and assigns it to the Sort field. +func (o *EventsListRequest) SetSort(v EventsSort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsListRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsListRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filter *EventsQueryFilter `json:"filter,omitempty"` + Options *EventsQueryOptions `json:"options,omitempty"` + Page *EventsRequestPage `json:"page,omitempty"` + Sort *EventsSort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.Sort = all.Sort + return nil +} diff --git a/api/v2/datadog/model_events_list_response.go b/api/v2/datadog/model_events_list_response.go new file mode 100644 index 00000000000..2475e161efe --- /dev/null +++ b/api/v2/datadog/model_events_list_response.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsListResponse The response object with all events matching the request and pagination information. +type EventsListResponse struct { + // An array of events matching the request. + Data []EventResponse `json:"data,omitempty"` + // Links attributes. + Links *EventsListResponseLinks `json:"links,omitempty"` + // The metadata associated with a request. + Meta *EventsResponseMetadata `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{} +} + +// NewEventsListResponse instantiates a new EventsListResponse 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 NewEventsListResponse() *EventsListResponse { + this := EventsListResponse{} + return &this +} + +// NewEventsListResponseWithDefaults instantiates a new EventsListResponse 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 NewEventsListResponseWithDefaults() *EventsListResponse { + this := EventsListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *EventsListResponse) GetData() []EventResponse { + if o == nil || o.Data == nil { + var ret []EventResponse + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsListResponse) GetDataOk() (*[]EventResponse, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *EventsListResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []EventResponse and assigns it to the Data field. +func (o *EventsListResponse) SetData(v []EventResponse) { + o.Data = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *EventsListResponse) GetLinks() EventsListResponseLinks { + if o == nil || o.Links == nil { + var ret EventsListResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsListResponse) GetLinksOk() (*EventsListResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *EventsListResponse) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +// SetLinks gets a reference to the given EventsListResponseLinks and assigns it to the Links field. +func (o *EventsListResponse) SetLinks(v EventsListResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *EventsListResponse) GetMeta() EventsResponseMetadata { + if o == nil || o.Meta == nil { + var ret EventsResponseMetadata + 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 *EventsListResponse) GetMetaOk() (*EventsResponseMetadata, 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 *EventsListResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given EventsResponseMetadata and assigns it to the Meta field. +func (o *EventsListResponse) SetMeta(v EventsResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []EventResponse `json:"data,omitempty"` + Links *EventsListResponseLinks `json:"links,omitempty"` + Meta *EventsResponseMetadata `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_events_list_response_links.go b/api/v2/datadog/model_events_list_response_links.go new file mode 100644 index 00000000000..ca0ba4ce6c1 --- /dev/null +++ b/api/v2/datadog/model_events_list_response_links.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsListResponseLinks Links attributes. +type EventsListResponseLinks struct { + // Link for the next set of results. Note that the request can also be made using the + // POST endpoint. + Next *string `json:"next,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{} +} + +// NewEventsListResponseLinks instantiates a new EventsListResponseLinks 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 NewEventsListResponseLinks() *EventsListResponseLinks { + this := EventsListResponseLinks{} + return &this +} + +// NewEventsListResponseLinksWithDefaults instantiates a new EventsListResponseLinks 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 NewEventsListResponseLinksWithDefaults() *EventsListResponseLinks { + this := EventsListResponseLinks{} + return &this +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *EventsListResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsListResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *EventsListResponseLinks) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *EventsListResponseLinks) SetNext(v string) { + o.Next = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsListResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Next *string `json:"next,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Next = all.Next + return nil +} diff --git a/api/v2/datadog/model_events_query_filter.go b/api/v2/datadog/model_events_query_filter.go new file mode 100644 index 00000000000..10b30802a48 --- /dev/null +++ b/api/v2/datadog/model_events_query_filter.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsQueryFilter The search and filter query settings. +type EventsQueryFilter struct { + // The minimum time for the requested events. Supports date math and regular timestamps in milliseconds. + From *string `json:"from,omitempty"` + // The search query following the event search syntax. + Query *string `json:"query,omitempty"` + // The maximum time for the requested events. Supports date math and regular timestamps in milliseconds. + To *string `json:"to,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{} +} + +// NewEventsQueryFilter instantiates a new EventsQueryFilter 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 NewEventsQueryFilter() *EventsQueryFilter { + this := EventsQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// NewEventsQueryFilterWithDefaults instantiates a new EventsQueryFilter 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 NewEventsQueryFilterWithDefaults() *EventsQueryFilter { + this := EventsQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *EventsQueryFilter) GetFrom() string { + if o == nil || o.From == nil { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsQueryFilter) GetFromOk() (*string, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *EventsQueryFilter) HasFrom() bool { + if o != nil && o.From != nil { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *EventsQueryFilter) SetFrom(v string) { + o.From = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *EventsQueryFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsQueryFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *EventsQueryFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *EventsQueryFilter) SetQuery(v string) { + o.Query = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *EventsQueryFilter) GetTo() string { + if o == nil || o.To == nil { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsQueryFilter) GetToOk() (*string, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *EventsQueryFilter) HasTo() bool { + if o != nil && o.To != nil { + return true + } + + return false +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *EventsQueryFilter) SetTo(v string) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsQueryFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + From *string `json:"from,omitempty"` + Query *string `json:"query,omitempty"` + To *string `json:"to,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.From = all.From + o.Query = all.Query + o.To = all.To + return nil +} diff --git a/api/v2/datadog/model_events_query_options.go b/api/v2/datadog/model_events_query_options.go new file mode 100644 index 00000000000..609877e74d0 --- /dev/null +++ b/api/v2/datadog/model_events_query_options.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsQueryOptions The global query options that are used. Either provide a timezone or a time offset but not both, +// otherwise the query fails. +type EventsQueryOptions struct { + // The time offset to apply to the query in seconds. + TimeOffset *int64 `json:"timeOffset,omitempty"` + // The timezone can be specified as an offset, for example: `UTC+03:00`. + Timezone *string `json:"timezone,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{} +} + +// NewEventsQueryOptions instantiates a new EventsQueryOptions 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 NewEventsQueryOptions() *EventsQueryOptions { + this := EventsQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewEventsQueryOptionsWithDefaults instantiates a new EventsQueryOptions 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 NewEventsQueryOptionsWithDefaults() *EventsQueryOptions { + this := EventsQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. +func (o *EventsQueryOptions) GetTimeOffset() int64 { + if o == nil || o.TimeOffset == nil { + var ret int64 + return ret + } + return *o.TimeOffset +} + +// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsQueryOptions) GetTimeOffsetOk() (*int64, bool) { + if o == nil || o.TimeOffset == nil { + return nil, false + } + return o.TimeOffset, true +} + +// HasTimeOffset returns a boolean if a field has been set. +func (o *EventsQueryOptions) HasTimeOffset() bool { + if o != nil && o.TimeOffset != nil { + return true + } + + return false +} + +// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. +func (o *EventsQueryOptions) SetTimeOffset(v int64) { + o.TimeOffset = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *EventsQueryOptions) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsQueryOptions) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *EventsQueryOptions) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *EventsQueryOptions) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsQueryOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TimeOffset != nil { + toSerialize["timeOffset"] = o.TimeOffset + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TimeOffset *int64 `json:"timeOffset,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TimeOffset = all.TimeOffset + o.Timezone = all.Timezone + return nil +} diff --git a/api/v2/datadog/model_events_request_page.go b/api/v2/datadog/model_events_request_page.go new file mode 100644 index 00000000000..7e077a6edce --- /dev/null +++ b/api/v2/datadog/model_events_request_page.go @@ -0,0 +1,145 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsRequestPage Pagination settings. +type EventsRequestPage struct { + // The returned paging point to use to get the next results. + Cursor *string `json:"cursor,omitempty"` + // The maximum number of logs in the response. + Limit *int32 `json:"limit,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{} +} + +// NewEventsRequestPage instantiates a new EventsRequestPage 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 NewEventsRequestPage() *EventsRequestPage { + this := EventsRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// NewEventsRequestPageWithDefaults instantiates a new EventsRequestPage 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 NewEventsRequestPageWithDefaults() *EventsRequestPage { + this := EventsRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *EventsRequestPage) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsRequestPage) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *EventsRequestPage) HasCursor() bool { + if o != nil && o.Cursor != nil { + return true + } + + return false +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *EventsRequestPage) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *EventsRequestPage) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsRequestPage) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *EventsRequestPage) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *EventsRequestPage) SetLimit(v int32) { + o.Limit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsRequestPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsRequestPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int32 `json:"limit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cursor = all.Cursor + o.Limit = all.Limit + return nil +} diff --git a/api/v2/datadog/model_events_response_metadata.go b/api/v2/datadog/model_events_response_metadata.go new file mode 100644 index 00000000000..955fff31dd0 --- /dev/null +++ b/api/v2/datadog/model_events_response_metadata.go @@ -0,0 +1,227 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsResponseMetadata The metadata associated with a request. +type EventsResponseMetadata struct { + // The time elapsed in milliseconds. + Elapsed *int64 `json:"elapsed,omitempty"` + // Pagination attributes. + Page *EventsResponseMetadataPage `json:"page,omitempty"` + // The identifier of the request. + RequestId *string `json:"request_id,omitempty"` + // A list of warnings (non-fatal errors) encountered. Partial results might be returned if + // warnings are present in the response. + Warnings []EventsWarning `json:"warnings,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{} +} + +// NewEventsResponseMetadata instantiates a new EventsResponseMetadata 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 NewEventsResponseMetadata() *EventsResponseMetadata { + this := EventsResponseMetadata{} + return &this +} + +// NewEventsResponseMetadataWithDefaults instantiates a new EventsResponseMetadata 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 NewEventsResponseMetadataWithDefaults() *EventsResponseMetadata { + this := EventsResponseMetadata{} + return &this +} + +// GetElapsed returns the Elapsed field value if set, zero value otherwise. +func (o *EventsResponseMetadata) GetElapsed() int64 { + if o == nil || o.Elapsed == nil { + var ret int64 + return ret + } + return *o.Elapsed +} + +// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsResponseMetadata) GetElapsedOk() (*int64, bool) { + if o == nil || o.Elapsed == nil { + return nil, false + } + return o.Elapsed, true +} + +// HasElapsed returns a boolean if a field has been set. +func (o *EventsResponseMetadata) HasElapsed() bool { + if o != nil && o.Elapsed != nil { + return true + } + + return false +} + +// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. +func (o *EventsResponseMetadata) SetElapsed(v int64) { + o.Elapsed = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *EventsResponseMetadata) GetPage() EventsResponseMetadataPage { + if o == nil || o.Page == nil { + var ret EventsResponseMetadataPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsResponseMetadata) GetPageOk() (*EventsResponseMetadataPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *EventsResponseMetadata) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given EventsResponseMetadataPage and assigns it to the Page field. +func (o *EventsResponseMetadata) SetPage(v EventsResponseMetadataPage) { + o.Page = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *EventsResponseMetadata) GetRequestId() string { + if o == nil || o.RequestId == nil { + var ret string + return ret + } + return *o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsResponseMetadata) GetRequestIdOk() (*string, bool) { + if o == nil || o.RequestId == nil { + return nil, false + } + return o.RequestId, true +} + +// HasRequestId returns a boolean if a field has been set. +func (o *EventsResponseMetadata) HasRequestId() bool { + if o != nil && o.RequestId != nil { + return true + } + + return false +} + +// SetRequestId gets a reference to the given string and assigns it to the RequestId field. +func (o *EventsResponseMetadata) SetRequestId(v string) { + o.RequestId = &v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *EventsResponseMetadata) GetWarnings() []EventsWarning { + if o == nil || o.Warnings == nil { + var ret []EventsWarning + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsResponseMetadata) GetWarningsOk() (*[]EventsWarning, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *EventsResponseMetadata) HasWarnings() bool { + if o != nil && o.Warnings != nil { + return true + } + + return false +} + +// SetWarnings gets a reference to the given []EventsWarning and assigns it to the Warnings field. +func (o *EventsResponseMetadata) SetWarnings(v []EventsWarning) { + o.Warnings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Elapsed != nil { + toSerialize["elapsed"] = o.Elapsed + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Elapsed *int64 `json:"elapsed,omitempty"` + Page *EventsResponseMetadataPage `json:"page,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Warnings []EventsWarning `json:"warnings,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Elapsed = all.Elapsed + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.RequestId = all.RequestId + o.Warnings = all.Warnings + return nil +} diff --git a/api/v2/datadog/model_events_response_metadata_page.go b/api/v2/datadog/model_events_response_metadata_page.go new file mode 100644 index 00000000000..a9ffce6f39b --- /dev/null +++ b/api/v2/datadog/model_events_response_metadata_page.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsResponseMetadataPage Pagination attributes. +type EventsResponseMetadataPage struct { + // The cursor to use to get the next results, if any. To make the next request, use the same + // parameters with the addition of the `page[cursor]`. + After *string `json:"after,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{} +} + +// NewEventsResponseMetadataPage instantiates a new EventsResponseMetadataPage 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 NewEventsResponseMetadataPage() *EventsResponseMetadataPage { + this := EventsResponseMetadataPage{} + return &this +} + +// NewEventsResponseMetadataPageWithDefaults instantiates a new EventsResponseMetadataPage 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 NewEventsResponseMetadataPageWithDefaults() *EventsResponseMetadataPage { + this := EventsResponseMetadataPage{} + return &this +} + +// GetAfter returns the After field value if set, zero value otherwise. +func (o *EventsResponseMetadataPage) GetAfter() string { + if o == nil || o.After == nil { + var ret string + return ret + } + return *o.After +} + +// GetAfterOk returns a tuple with the After field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsResponseMetadataPage) GetAfterOk() (*string, bool) { + if o == nil || o.After == nil { + return nil, false + } + return o.After, true +} + +// HasAfter returns a boolean if a field has been set. +func (o *EventsResponseMetadataPage) HasAfter() bool { + if o != nil && o.After != nil { + return true + } + + return false +} + +// SetAfter gets a reference to the given string and assigns it to the After field. +func (o *EventsResponseMetadataPage) SetAfter(v string) { + o.After = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsResponseMetadataPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.After != nil { + toSerialize["after"] = o.After + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + After *string `json:"after,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.After = all.After + return nil +} diff --git a/api/v2/datadog/model_events_sort.go b/api/v2/datadog/model_events_sort.go new file mode 100644 index 00000000000..434bbb1b06c --- /dev/null +++ b/api/v2/datadog/model_events_sort.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// EventsSort The sort parameters when querying events. +type EventsSort string + +// List of EventsSort. +const ( + EVENTSSORT_TIMESTAMP_ASCENDING EventsSort = "timestamp" + EVENTSSORT_TIMESTAMP_DESCENDING EventsSort = "-timestamp" +) + +var allowedEventsSortEnumValues = []EventsSort{ + EVENTSSORT_TIMESTAMP_ASCENDING, + EVENTSSORT_TIMESTAMP_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *EventsSort) GetAllowedValues() []EventsSort { + return allowedEventsSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *EventsSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = EventsSort(value) + return nil +} + +// NewEventsSortFromValue returns a pointer to a valid EventsSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewEventsSortFromValue(v string) (*EventsSort, error) { + ev := EventsSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for EventsSort: valid values are %v", v, allowedEventsSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v EventsSort) IsValid() bool { + for _, existing := range allowedEventsSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventsSort value. +func (v EventsSort) Ptr() *EventsSort { + return &v +} + +// NullableEventsSort handles when a null is used for EventsSort. +type NullableEventsSort struct { + value *EventsSort + isSet bool +} + +// Get returns the associated value. +func (v NullableEventsSort) Get() *EventsSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableEventsSort) Set(val *EventsSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableEventsSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableEventsSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableEventsSort initializes the struct as if Set has been called. +func NewNullableEventsSort(val *EventsSort) *NullableEventsSort { + return &NullableEventsSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableEventsSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableEventsSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_events_warning.go b/api/v2/datadog/model_events_warning.go new file mode 100644 index 00000000000..213be6c724b --- /dev/null +++ b/api/v2/datadog/model_events_warning.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// EventsWarning A warning message indicating something is wrong with the query. +type EventsWarning struct { + // A unique code for this type of warning. + Code *string `json:"code,omitempty"` + // A detailed explanation of this specific warning. + Detail *string `json:"detail,omitempty"` + // A short human-readable summary of the warning. + Title *string `json:"title,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{} +} + +// NewEventsWarning instantiates a new EventsWarning 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 NewEventsWarning() *EventsWarning { + this := EventsWarning{} + return &this +} + +// NewEventsWarningWithDefaults instantiates a new EventsWarning 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 NewEventsWarningWithDefaults() *EventsWarning { + this := EventsWarning{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *EventsWarning) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsWarning) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *EventsWarning) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *EventsWarning) SetCode(v string) { + o.Code = &v +} + +// GetDetail returns the Detail field value if set, zero value otherwise. +func (o *EventsWarning) GetDetail() string { + if o == nil || o.Detail == nil { + var ret string + return ret + } + return *o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsWarning) GetDetailOk() (*string, bool) { + if o == nil || o.Detail == nil { + return nil, false + } + return o.Detail, true +} + +// HasDetail returns a boolean if a field has been set. +func (o *EventsWarning) HasDetail() bool { + if o != nil && o.Detail != nil { + return true + } + + return false +} + +// SetDetail gets a reference to the given string and assigns it to the Detail field. +func (o *EventsWarning) SetDetail(v string) { + o.Detail = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *EventsWarning) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventsWarning) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *EventsWarning) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *EventsWarning) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o EventsWarning) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Detail != nil { + toSerialize["detail"] = o.Detail + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *EventsWarning) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *string `json:"code,omitempty"` + Detail *string `json:"detail,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Detail = all.Detail + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_full_api_key.go b/api/v2/datadog/model_full_api_key.go new file mode 100644 index 00000000000..8c07ff3449b --- /dev/null +++ b/api/v2/datadog/model_full_api_key.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// FullAPIKey Datadog API key. +type FullAPIKey struct { + // Attributes of a full API key. + Attributes *FullAPIKeyAttributes `json:"attributes,omitempty"` + // ID of the API key. + Id *string `json:"id,omitempty"` + // Resources related to the API key. + Relationships *APIKeyRelationships `json:"relationships,omitempty"` + // API Keys resource type. + Type *APIKeysType `json:"type,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{} +} + +// NewFullAPIKey instantiates a new FullAPIKey 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 NewFullAPIKey() *FullAPIKey { + this := FullAPIKey{} + var typeVar APIKeysType = APIKEYSTYPE_API_KEYS + this.Type = &typeVar + return &this +} + +// NewFullAPIKeyWithDefaults instantiates a new FullAPIKey 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 NewFullAPIKeyWithDefaults() *FullAPIKey { + this := FullAPIKey{} + var typeVar APIKeysType = APIKEYSTYPE_API_KEYS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FullAPIKey) GetAttributes() FullAPIKeyAttributes { + if o == nil || o.Attributes == nil { + var ret FullAPIKeyAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKey) GetAttributesOk() (*FullAPIKeyAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *FullAPIKey) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given FullAPIKeyAttributes and assigns it to the Attributes field. +func (o *FullAPIKey) SetAttributes(v FullAPIKeyAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FullAPIKey) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKey) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *FullAPIKey) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FullAPIKey) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *FullAPIKey) GetRelationships() APIKeyRelationships { + if o == nil || o.Relationships == nil { + var ret APIKeyRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKey) GetRelationshipsOk() (*APIKeyRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *FullAPIKey) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given APIKeyRelationships and assigns it to the Relationships field. +func (o *FullAPIKey) SetRelationships(v APIKeyRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FullAPIKey) GetType() APIKeysType { + if o == nil || o.Type == nil { + var ret APIKeysType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKey) GetTypeOk() (*APIKeysType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FullAPIKey) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given APIKeysType and assigns it to the Type field. +func (o *FullAPIKey) SetType(v APIKeysType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FullAPIKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FullAPIKey) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *FullAPIKeyAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *APIKeyRelationships `json:"relationships,omitempty"` + Type *APIKeysType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_full_api_key_attributes.go b/api/v2/datadog/model_full_api_key_attributes.go new file mode 100644 index 00000000000..070e339875f --- /dev/null +++ b/api/v2/datadog/model_full_api_key_attributes.go @@ -0,0 +1,258 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// FullAPIKeyAttributes Attributes of a full API key. +type FullAPIKeyAttributes struct { + // Creation date of the API key. + CreatedAt *string `json:"created_at,omitempty"` + // The API key. + Key *string `json:"key,omitempty"` + // The last four characters of the API key. + Last4 *string `json:"last4,omitempty"` + // Date the API key was last modified. + ModifiedAt *string `json:"modified_at,omitempty"` + // Name of the API key. + Name *string `json:"name,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{} +} + +// NewFullAPIKeyAttributes instantiates a new FullAPIKeyAttributes 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 NewFullAPIKeyAttributes() *FullAPIKeyAttributes { + this := FullAPIKeyAttributes{} + return &this +} + +// NewFullAPIKeyAttributesWithDefaults instantiates a new FullAPIKeyAttributes 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 NewFullAPIKeyAttributesWithDefaults() *FullAPIKeyAttributes { + this := FullAPIKeyAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *FullAPIKeyAttributes) GetCreatedAt() string { + if o == nil || o.CreatedAt == nil { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKeyAttributes) GetCreatedAtOk() (*string, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *FullAPIKeyAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *FullAPIKeyAttributes) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *FullAPIKeyAttributes) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKeyAttributes) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *FullAPIKeyAttributes) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *FullAPIKeyAttributes) SetKey(v string) { + o.Key = &v +} + +// GetLast4 returns the Last4 field value if set, zero value otherwise. +func (o *FullAPIKeyAttributes) GetLast4() string { + if o == nil || o.Last4 == nil { + var ret string + return ret + } + return *o.Last4 +} + +// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKeyAttributes) GetLast4Ok() (*string, bool) { + if o == nil || o.Last4 == nil { + return nil, false + } + return o.Last4, true +} + +// HasLast4 returns a boolean if a field has been set. +func (o *FullAPIKeyAttributes) HasLast4() bool { + if o != nil && o.Last4 != nil { + return true + } + + return false +} + +// SetLast4 gets a reference to the given string and assigns it to the Last4 field. +func (o *FullAPIKeyAttributes) SetLast4(v string) { + o.Last4 = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *FullAPIKeyAttributes) GetModifiedAt() string { + if o == nil || o.ModifiedAt == nil { + var ret string + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKeyAttributes) GetModifiedAtOk() (*string, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *FullAPIKeyAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given string and assigns it to the ModifiedAt field. +func (o *FullAPIKeyAttributes) SetModifiedAt(v string) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *FullAPIKeyAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullAPIKeyAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *FullAPIKeyAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *FullAPIKeyAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FullAPIKeyAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.Last4 != nil { + toSerialize["last4"] = o.Last4 + } + if o.ModifiedAt != nil { + toSerialize["modified_at"] = o.ModifiedAt + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FullAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *string `json:"created_at,omitempty"` + Key *string `json:"key,omitempty"` + Last4 *string `json:"last4,omitempty"` + ModifiedAt *string `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.Key = all.Key + o.Last4 = all.Last4 + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_full_application_key.go b/api/v2/datadog/model_full_application_key.go new file mode 100644 index 00000000000..e7e5c50123a --- /dev/null +++ b/api/v2/datadog/model_full_application_key.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// FullApplicationKey Datadog application key. +type FullApplicationKey struct { + // Attributes of a full application key. + Attributes *FullApplicationKeyAttributes `json:"attributes,omitempty"` + // ID of the application key. + Id *string `json:"id,omitempty"` + // Resources related to the application key. + Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` + // Application Keys resource type. + Type *ApplicationKeysType `json:"type,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{} +} + +// NewFullApplicationKey instantiates a new FullApplicationKey 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 NewFullApplicationKey() *FullApplicationKey { + this := FullApplicationKey{} + var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS + this.Type = &typeVar + return &this +} + +// NewFullApplicationKeyWithDefaults instantiates a new FullApplicationKey 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 NewFullApplicationKeyWithDefaults() *FullApplicationKey { + this := FullApplicationKey{} + var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FullApplicationKey) GetAttributes() FullApplicationKeyAttributes { + if o == nil || o.Attributes == nil { + var ret FullApplicationKeyAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKey) GetAttributesOk() (*FullApplicationKeyAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *FullApplicationKey) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given FullApplicationKeyAttributes and assigns it to the Attributes field. +func (o *FullApplicationKey) SetAttributes(v FullApplicationKeyAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FullApplicationKey) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKey) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *FullApplicationKey) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FullApplicationKey) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *FullApplicationKey) GetRelationships() ApplicationKeyRelationships { + if o == nil || o.Relationships == nil { + var ret ApplicationKeyRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKey) GetRelationshipsOk() (*ApplicationKeyRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *FullApplicationKey) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given ApplicationKeyRelationships and assigns it to the Relationships field. +func (o *FullApplicationKey) SetRelationships(v ApplicationKeyRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FullApplicationKey) GetType() ApplicationKeysType { + if o == nil || o.Type == nil { + var ret ApplicationKeysType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKey) GetTypeOk() (*ApplicationKeysType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FullApplicationKey) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given ApplicationKeysType and assigns it to the Type field. +func (o *FullApplicationKey) SetType(v ApplicationKeysType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FullApplicationKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FullApplicationKey) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *FullApplicationKeyAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` + Type *ApplicationKeysType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_full_application_key_attributes.go b/api/v2/datadog/model_full_application_key_attributes.go new file mode 100644 index 00000000000..742a45e0dcd --- /dev/null +++ b/api/v2/datadog/model_full_application_key_attributes.go @@ -0,0 +1,259 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// FullApplicationKeyAttributes Attributes of a full application key. +type FullApplicationKeyAttributes struct { + // Creation date of the application key. + CreatedAt *string `json:"created_at,omitempty"` + // The application key. + Key *string `json:"key,omitempty"` + // The last four characters of the application key. + Last4 *string `json:"last4,omitempty"` + // Name of the application key. + Name *string `json:"name,omitempty"` + // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + Scopes []string `json:"scopes,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{} +} + +// NewFullApplicationKeyAttributes instantiates a new FullApplicationKeyAttributes 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 NewFullApplicationKeyAttributes() *FullApplicationKeyAttributes { + this := FullApplicationKeyAttributes{} + return &this +} + +// NewFullApplicationKeyAttributesWithDefaults instantiates a new FullApplicationKeyAttributes 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 NewFullApplicationKeyAttributesWithDefaults() *FullApplicationKeyAttributes { + this := FullApplicationKeyAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *FullApplicationKeyAttributes) GetCreatedAt() string { + if o == nil || o.CreatedAt == nil { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKeyAttributes) GetCreatedAtOk() (*string, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *FullApplicationKeyAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *FullApplicationKeyAttributes) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *FullApplicationKeyAttributes) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKeyAttributes) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *FullApplicationKeyAttributes) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *FullApplicationKeyAttributes) SetKey(v string) { + o.Key = &v +} + +// GetLast4 returns the Last4 field value if set, zero value otherwise. +func (o *FullApplicationKeyAttributes) GetLast4() string { + if o == nil || o.Last4 == nil { + var ret string + return ret + } + return *o.Last4 +} + +// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKeyAttributes) GetLast4Ok() (*string, bool) { + if o == nil || o.Last4 == nil { + return nil, false + } + return o.Last4, true +} + +// HasLast4 returns a boolean if a field has been set. +func (o *FullApplicationKeyAttributes) HasLast4() bool { + if o != nil && o.Last4 != nil { + return true + } + + return false +} + +// SetLast4 gets a reference to the given string and assigns it to the Last4 field. +func (o *FullApplicationKeyAttributes) SetLast4(v string) { + o.Last4 = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *FullApplicationKeyAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FullApplicationKeyAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *FullApplicationKeyAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *FullApplicationKeyAttributes) SetName(v string) { + o.Name = &v +} + +// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FullApplicationKeyAttributes) GetScopes() []string { + if o == nil { + var ret []string + return ret + } + return o.Scopes +} + +// GetScopesOk returns a tuple with the Scopes 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 *FullApplicationKeyAttributes) GetScopesOk() (*[]string, bool) { + if o == nil || o.Scopes == nil { + return nil, false + } + return &o.Scopes, true +} + +// HasScopes returns a boolean if a field has been set. +func (o *FullApplicationKeyAttributes) HasScopes() bool { + if o != nil && o.Scopes != nil { + return true + } + + return false +} + +// SetScopes gets a reference to the given []string and assigns it to the Scopes field. +func (o *FullApplicationKeyAttributes) SetScopes(v []string) { + o.Scopes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FullApplicationKeyAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.Last4 != nil { + toSerialize["last4"] = o.Last4 + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Scopes != nil { + toSerialize["scopes"] = o.Scopes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *string `json:"created_at,omitempty"` + Key *string `json:"key,omitempty"` + Last4 *string `json:"last4,omitempty"` + Name *string `json:"name,omitempty"` + Scopes []string `json:"scopes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.Key = all.Key + o.Last4 = all.Last4 + o.Name = all.Name + o.Scopes = all.Scopes + return nil +} diff --git a/api/v2/datadog/model_hourly_usage.go b/api/v2/datadog/model_hourly_usage.go new file mode 100644 index 00000000000..95e09a671ae --- /dev/null +++ b/api/v2/datadog/model_hourly_usage.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HourlyUsage Hourly usage for a product family for an org. +type HourlyUsage struct { + // Attributes of hourly usage for a product family for an org for a time period. + Attributes *HourlyUsageAttributes `json:"attributes,omitempty"` + // Unique ID of the response. + Id *string `json:"id,omitempty"` + // Type of usage data. + Type *UsageTimeSeriesType `json:"type,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{} +} + +// NewHourlyUsage instantiates a new HourlyUsage 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 NewHourlyUsage() *HourlyUsage { + this := HourlyUsage{} + var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES + this.Type = &typeVar + return &this +} + +// NewHourlyUsageWithDefaults instantiates a new HourlyUsage 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 NewHourlyUsageWithDefaults() *HourlyUsage { + this := HourlyUsage{} + var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *HourlyUsage) GetAttributes() HourlyUsageAttributes { + if o == nil || o.Attributes == nil { + var ret HourlyUsageAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsage) GetAttributesOk() (*HourlyUsageAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *HourlyUsage) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given HourlyUsageAttributes and assigns it to the Attributes field. +func (o *HourlyUsage) SetAttributes(v HourlyUsageAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *HourlyUsage) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsage) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *HourlyUsage) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *HourlyUsage) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *HourlyUsage) GetType() UsageTimeSeriesType { + if o == nil || o.Type == nil { + var ret UsageTimeSeriesType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsage) GetTypeOk() (*UsageTimeSeriesType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *HourlyUsage) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given UsageTimeSeriesType and assigns it to the Type field. +func (o *HourlyUsage) SetType(v UsageTimeSeriesType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *HourlyUsageAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UsageTimeSeriesType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_hourly_usage_attributes.go b/api/v2/datadog/model_hourly_usage_attributes.go new file mode 100644 index 00000000000..ed9fc11c52c --- /dev/null +++ b/api/v2/datadog/model_hourly_usage_attributes.go @@ -0,0 +1,302 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// HourlyUsageAttributes Attributes of hourly usage for a product family for an org for a time period. +type HourlyUsageAttributes struct { + // List of the measured usage values for the product family for the org for the time period. + Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"` + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The product for which usage is being reported. + ProductFamily *string `json:"product_family,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // The region of the Datadog instance that the organization belongs to. + Region *string `json:"region,omitempty"` + // Datetime in ISO-8601 format, UTC. The hour for the usage. + Timestamp *time.Time `json:"timestamp,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{} +} + +// NewHourlyUsageAttributes instantiates a new HourlyUsageAttributes 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 NewHourlyUsageAttributes() *HourlyUsageAttributes { + this := HourlyUsageAttributes{} + return &this +} + +// NewHourlyUsageAttributesWithDefaults instantiates a new HourlyUsageAttributes 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 NewHourlyUsageAttributesWithDefaults() *HourlyUsageAttributes { + this := HourlyUsageAttributes{} + return &this +} + +// GetMeasurements returns the Measurements field value if set, zero value otherwise. +func (o *HourlyUsageAttributes) GetMeasurements() []HourlyUsageMeasurement { + if o == nil || o.Measurements == nil { + var ret []HourlyUsageMeasurement + return ret + } + return o.Measurements +} + +// GetMeasurementsOk returns a tuple with the Measurements field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributes) GetMeasurementsOk() (*[]HourlyUsageMeasurement, bool) { + if o == nil || o.Measurements == nil { + return nil, false + } + return &o.Measurements, true +} + +// HasMeasurements returns a boolean if a field has been set. +func (o *HourlyUsageAttributes) HasMeasurements() bool { + if o != nil && o.Measurements != nil { + return true + } + + return false +} + +// SetMeasurements gets a reference to the given []HourlyUsageMeasurement and assigns it to the Measurements field. +func (o *HourlyUsageAttributes) SetMeasurements(v []HourlyUsageMeasurement) { + o.Measurements = v +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *HourlyUsageAttributes) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributes) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *HourlyUsageAttributes) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *HourlyUsageAttributes) SetOrgName(v string) { + o.OrgName = &v +} + +// GetProductFamily returns the ProductFamily field value if set, zero value otherwise. +func (o *HourlyUsageAttributes) GetProductFamily() string { + if o == nil || o.ProductFamily == nil { + var ret string + return ret + } + return *o.ProductFamily +} + +// GetProductFamilyOk returns a tuple with the ProductFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributes) GetProductFamilyOk() (*string, bool) { + if o == nil || o.ProductFamily == nil { + return nil, false + } + return o.ProductFamily, true +} + +// HasProductFamily returns a boolean if a field has been set. +func (o *HourlyUsageAttributes) HasProductFamily() bool { + if o != nil && o.ProductFamily != nil { + return true + } + + return false +} + +// SetProductFamily gets a reference to the given string and assigns it to the ProductFamily field. +func (o *HourlyUsageAttributes) SetProductFamily(v string) { + o.ProductFamily = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *HourlyUsageAttributes) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributes) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *HourlyUsageAttributes) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *HourlyUsageAttributes) SetPublicId(v string) { + o.PublicId = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *HourlyUsageAttributes) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributes) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *HourlyUsageAttributes) HasRegion() bool { + if o != nil && o.Region != nil { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *HourlyUsageAttributes) SetRegion(v string) { + o.Region = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *HourlyUsageAttributes) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageAttributes) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *HourlyUsageAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *HourlyUsageAttributes) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Measurements != nil { + toSerialize["measurements"] = o.Measurements + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.ProductFamily != nil { + toSerialize["product_family"] = o.ProductFamily + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Measurements []HourlyUsageMeasurement `json:"measurements,omitempty"` + OrgName *string `json:"org_name,omitempty"` + ProductFamily *string `json:"product_family,omitempty"` + PublicId *string `json:"public_id,omitempty"` + Region *string `json:"region,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Measurements = all.Measurements + o.OrgName = all.OrgName + o.ProductFamily = all.ProductFamily + o.PublicId = all.PublicId + o.Region = all.Region + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v2/datadog/model_hourly_usage_measurement.go b/api/v2/datadog/model_hourly_usage_measurement.go new file mode 100644 index 00000000000..c0ba872b114 --- /dev/null +++ b/api/v2/datadog/model_hourly_usage_measurement.go @@ -0,0 +1,154 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// HourlyUsageMeasurement Usage amount for a given usage type. +type HourlyUsageMeasurement struct { + // Type of usage. + UsageType *string `json:"usage_type,omitempty"` + // Contains the number measured for the given usage_type during the hour. + Value common.NullableInt64 `json:"value,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{} +} + +// NewHourlyUsageMeasurement instantiates a new HourlyUsageMeasurement 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 NewHourlyUsageMeasurement() *HourlyUsageMeasurement { + this := HourlyUsageMeasurement{} + return &this +} + +// NewHourlyUsageMeasurementWithDefaults instantiates a new HourlyUsageMeasurement 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 NewHourlyUsageMeasurementWithDefaults() *HourlyUsageMeasurement { + this := HourlyUsageMeasurement{} + return &this +} + +// GetUsageType returns the UsageType field value if set, zero value otherwise. +func (o *HourlyUsageMeasurement) GetUsageType() string { + if o == nil || o.UsageType == nil { + var ret string + return ret + } + return *o.UsageType +} + +// GetUsageTypeOk returns a tuple with the UsageType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageMeasurement) GetUsageTypeOk() (*string, bool) { + if o == nil || o.UsageType == nil { + return nil, false + } + return o.UsageType, true +} + +// HasUsageType returns a boolean if a field has been set. +func (o *HourlyUsageMeasurement) HasUsageType() bool { + if o != nil && o.UsageType != nil { + return true + } + + return false +} + +// SetUsageType gets a reference to the given string and assigns it to the UsageType field. +func (o *HourlyUsageMeasurement) SetUsageType(v string) { + o.UsageType = &v +} + +// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *HourlyUsageMeasurement) GetValue() int64 { + if o == nil || o.Value.Get() == nil { + var ret int64 + return ret + } + return *o.Value.Get() +} + +// GetValueOk returns a tuple with the Value 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 *HourlyUsageMeasurement) GetValueOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Value.Get(), o.Value.IsSet() +} + +// HasValue returns a boolean if a field has been set. +func (o *HourlyUsageMeasurement) HasValue() bool { + if o != nil && o.Value.IsSet() { + return true + } + + return false +} + +// SetValue gets a reference to the given common.NullableInt64 and assigns it to the Value field. +func (o *HourlyUsageMeasurement) SetValue(v int64) { + o.Value.Set(&v) +} + +// SetValueNil sets the value for Value to be an explicit nil. +func (o *HourlyUsageMeasurement) SetValueNil() { + o.Value.Set(nil) +} + +// UnsetValue ensures that no value is present for Value, not even an explicit nil. +func (o *HourlyUsageMeasurement) UnsetValue() { + o.Value.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageMeasurement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.UsageType != nil { + toSerialize["usage_type"] = o.UsageType + } + if o.Value.IsSet() { + toSerialize["value"] = o.Value.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageMeasurement) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + UsageType *string `json:"usage_type,omitempty"` + Value common.NullableInt64 `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.UsageType = all.UsageType + o.Value = all.Value + return nil +} diff --git a/api/v2/datadog/model_hourly_usage_metadata.go b/api/v2/datadog/model_hourly_usage_metadata.go new file mode 100644 index 00000000000..e6b987bd2cd --- /dev/null +++ b/api/v2/datadog/model_hourly_usage_metadata.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HourlyUsageMetadata The object containing document metadata. +type HourlyUsageMetadata struct { + // The metadata for the current pagination. + Pagination *HourlyUsagePagination `json:"pagination,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{} +} + +// NewHourlyUsageMetadata instantiates a new HourlyUsageMetadata 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 NewHourlyUsageMetadata() *HourlyUsageMetadata { + this := HourlyUsageMetadata{} + return &this +} + +// NewHourlyUsageMetadataWithDefaults instantiates a new HourlyUsageMetadata 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 NewHourlyUsageMetadataWithDefaults() *HourlyUsageMetadata { + this := HourlyUsageMetadata{} + return &this +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *HourlyUsageMetadata) GetPagination() HourlyUsagePagination { + if o == nil || o.Pagination == nil { + var ret HourlyUsagePagination + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageMetadata) GetPaginationOk() (*HourlyUsagePagination, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *HourlyUsageMetadata) HasPagination() bool { + if o != nil && o.Pagination != nil { + return true + } + + return false +} + +// SetPagination gets a reference to the given HourlyUsagePagination and assigns it to the Pagination field. +func (o *HourlyUsageMetadata) SetPagination(v HourlyUsagePagination) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Pagination *HourlyUsagePagination `json:"pagination,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pagination = all.Pagination + return nil +} diff --git a/api/v2/datadog/model_hourly_usage_pagination.go b/api/v2/datadog/model_hourly_usage_pagination.go new file mode 100644 index 00000000000..837bafe6340 --- /dev/null +++ b/api/v2/datadog/model_hourly_usage_pagination.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// HourlyUsagePagination The metadata for the current pagination. +type HourlyUsagePagination struct { + // The cursor to get the next results (if any). To make the next request, use the same parameters and add `next_record_id`. + NextRecordId common.NullableString `json:"next_record_id,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{} +} + +// NewHourlyUsagePagination instantiates a new HourlyUsagePagination 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 NewHourlyUsagePagination() *HourlyUsagePagination { + this := HourlyUsagePagination{} + return &this +} + +// NewHourlyUsagePaginationWithDefaults instantiates a new HourlyUsagePagination 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 NewHourlyUsagePaginationWithDefaults() *HourlyUsagePagination { + this := HourlyUsagePagination{} + return &this +} + +// GetNextRecordId returns the NextRecordId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *HourlyUsagePagination) GetNextRecordId() string { + if o == nil || o.NextRecordId.Get() == nil { + var ret string + return ret + } + return *o.NextRecordId.Get() +} + +// GetNextRecordIdOk returns a tuple with the NextRecordId 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 *HourlyUsagePagination) GetNextRecordIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NextRecordId.Get(), o.NextRecordId.IsSet() +} + +// HasNextRecordId returns a boolean if a field has been set. +func (o *HourlyUsagePagination) HasNextRecordId() bool { + if o != nil && o.NextRecordId.IsSet() { + return true + } + + return false +} + +// SetNextRecordId gets a reference to the given common.NullableString and assigns it to the NextRecordId field. +func (o *HourlyUsagePagination) SetNextRecordId(v string) { + o.NextRecordId.Set(&v) +} + +// SetNextRecordIdNil sets the value for NextRecordId to be an explicit nil. +func (o *HourlyUsagePagination) SetNextRecordIdNil() { + o.NextRecordId.Set(nil) +} + +// UnsetNextRecordId ensures that no value is present for NextRecordId, not even an explicit nil. +func (o *HourlyUsagePagination) UnsetNextRecordId() { + o.NextRecordId.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsagePagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.NextRecordId.IsSet() { + toSerialize["next_record_id"] = o.NextRecordId.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsagePagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + NextRecordId common.NullableString `json:"next_record_id,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.NextRecordId = all.NextRecordId + return nil +} diff --git a/api/v2/datadog/model_hourly_usage_response.go b/api/v2/datadog/model_hourly_usage_response.go new file mode 100644 index 00000000000..25f62e077a2 --- /dev/null +++ b/api/v2/datadog/model_hourly_usage_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 datadog + +import ( + "encoding/json" +) + +// HourlyUsageResponse Hourly usage response. +type HourlyUsageResponse struct { + // Response containing hourly usage. + Data []HourlyUsage `json:"data,omitempty"` + // The object containing document metadata. + Meta *HourlyUsageMetadata `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{} +} + +// NewHourlyUsageResponse instantiates a new HourlyUsageResponse 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 NewHourlyUsageResponse() *HourlyUsageResponse { + this := HourlyUsageResponse{} + return &this +} + +// NewHourlyUsageResponseWithDefaults instantiates a new HourlyUsageResponse 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 NewHourlyUsageResponseWithDefaults() *HourlyUsageResponse { + this := HourlyUsageResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *HourlyUsageResponse) GetData() []HourlyUsage { + if o == nil || o.Data == nil { + var ret []HourlyUsage + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HourlyUsageResponse) GetDataOk() (*[]HourlyUsage, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *HourlyUsageResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []HourlyUsage and assigns it to the Data field. +func (o *HourlyUsageResponse) SetData(v []HourlyUsage) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *HourlyUsageResponse) GetMeta() HourlyUsageMetadata { + if o == nil || o.Meta == nil { + var ret HourlyUsageMetadata + 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 *HourlyUsageResponse) GetMetaOk() (*HourlyUsageMetadata, 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 *HourlyUsageResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given HourlyUsageMetadata and assigns it to the Meta field. +func (o *HourlyUsageResponse) SetMeta(v HourlyUsageMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HourlyUsageResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HourlyUsageResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []HourlyUsage `json:"data,omitempty"` + Meta *HourlyUsageMetadata `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_hourly_usage_type.go b/api/v2/datadog/model_hourly_usage_type.go new file mode 100644 index 00000000000..0602f384e42 --- /dev/null +++ b/api/v2/datadog/model_hourly_usage_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HourlyUsageType Usage type that is being measured. +type HourlyUsageType string + +// List of HourlyUsageType. +const ( + HOURLYUSAGETYPE_APP_SEC_HOST_COUNT HourlyUsageType = "app_sec_host_count" + HOURLYUSAGETYPE_OBSERVABILITY_PIPELINES_BYTES_PROCESSSED HourlyUsageType = "observability_pipelines_bytes_processed" + HOURLYUSAGETYPE_LAMBDA_TRACED_INVOCATIONS_COUNT HourlyUsageType = "lambda_traced_invocations_count" +) + +var allowedHourlyUsageTypeEnumValues = []HourlyUsageType{ + HOURLYUSAGETYPE_APP_SEC_HOST_COUNT, + HOURLYUSAGETYPE_OBSERVABILITY_PIPELINES_BYTES_PROCESSSED, + HOURLYUSAGETYPE_LAMBDA_TRACED_INVOCATIONS_COUNT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *HourlyUsageType) GetAllowedValues() []HourlyUsageType { + return allowedHourlyUsageTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *HourlyUsageType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = HourlyUsageType(value) + return nil +} + +// NewHourlyUsageTypeFromValue returns a pointer to a valid HourlyUsageType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewHourlyUsageTypeFromValue(v string) (*HourlyUsageType, error) { + ev := HourlyUsageType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for HourlyUsageType: valid values are %v", v, allowedHourlyUsageTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v HourlyUsageType) IsValid() bool { + for _, existing := range allowedHourlyUsageTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to HourlyUsageType value. +func (v HourlyUsageType) Ptr() *HourlyUsageType { + return &v +} + +// NullableHourlyUsageType handles when a null is used for HourlyUsageType. +type NullableHourlyUsageType struct { + value *HourlyUsageType + isSet bool +} + +// Get returns the associated value. +func (v NullableHourlyUsageType) Get() *HourlyUsageType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableHourlyUsageType) Set(val *HourlyUsageType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableHourlyUsageType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableHourlyUsageType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableHourlyUsageType initializes the struct as if Set has been called. +func NewNullableHourlyUsageType(val *HourlyUsageType) *NullableHourlyUsageType { + return &NullableHourlyUsageType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableHourlyUsageType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableHourlyUsageType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_http_log_error.go b/api/v2/datadog/model_http_log_error.go new file mode 100644 index 00000000000..6c5ba1e1c9b --- /dev/null +++ b/api/v2/datadog/model_http_log_error.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// HTTPLogError List of errors. +type HTTPLogError struct { + // Error message. + Detail *string `json:"detail,omitempty"` + // Error code. + Status *string `json:"status,omitempty"` + // Error title. + Title *string `json:"title,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{} +} + +// NewHTTPLogError instantiates a new HTTPLogError 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 NewHTTPLogError() *HTTPLogError { + this := HTTPLogError{} + return &this +} + +// NewHTTPLogErrorWithDefaults instantiates a new HTTPLogError 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 NewHTTPLogErrorWithDefaults() *HTTPLogError { + this := HTTPLogError{} + return &this +} + +// GetDetail returns the Detail field value if set, zero value otherwise. +func (o *HTTPLogError) GetDetail() string { + if o == nil || o.Detail == nil { + var ret string + return ret + } + return *o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogError) GetDetailOk() (*string, bool) { + if o == nil || o.Detail == nil { + return nil, false + } + return o.Detail, true +} + +// HasDetail returns a boolean if a field has been set. +func (o *HTTPLogError) HasDetail() bool { + if o != nil && o.Detail != nil { + return true + } + + return false +} + +// SetDetail gets a reference to the given string and assigns it to the Detail field. +func (o *HTTPLogError) SetDetail(v string) { + o.Detail = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *HTTPLogError) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogError) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *HTTPLogError) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *HTTPLogError) SetStatus(v string) { + o.Status = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *HTTPLogError) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogError) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *HTTPLogError) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *HTTPLogError) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPLogError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Detail != nil { + toSerialize["detail"] = o.Detail + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Detail *string `json:"detail,omitempty"` + Status *string `json:"status,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Detail = all.Detail + o.Status = all.Status + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_http_log_errors.go b/api/v2/datadog/model_http_log_errors.go new file mode 100644 index 00000000000..93e9553fab4 --- /dev/null +++ b/api/v2/datadog/model_http_log_errors.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 datadog + +import ( + "encoding/json" +) + +// HTTPLogErrors Invalid query performed. +type HTTPLogErrors struct { + // Structured errors. + Errors []HTTPLogError `json:"errors,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{} +} + +// NewHTTPLogErrors instantiates a new HTTPLogErrors 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 NewHTTPLogErrors() *HTTPLogErrors { + this := HTTPLogErrors{} + return &this +} + +// NewHTTPLogErrorsWithDefaults instantiates a new HTTPLogErrors 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 NewHTTPLogErrorsWithDefaults() *HTTPLogErrors { + this := HTTPLogErrors{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *HTTPLogErrors) GetErrors() []HTTPLogError { + if o == nil || o.Errors == nil { + var ret []HTTPLogError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogErrors) GetErrorsOk() (*[]HTTPLogError, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *HTTPLogErrors) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []HTTPLogError and assigns it to the Errors field. +func (o *HTTPLogErrors) SetErrors(v []HTTPLogError) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPLogErrors) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPLogErrors) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Errors []HTTPLogError `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Errors = all.Errors + return nil +} diff --git a/api/v2/datadog/model_http_log_item.go b/api/v2/datadog/model_http_log_item.go new file mode 100644 index 00000000000..e0a9b9d7679 --- /dev/null +++ b/api/v2/datadog/model_http_log_item.go @@ -0,0 +1,265 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// HTTPLogItem Logs that are sent over HTTP. +type HTTPLogItem struct { + // The integration name associated with your log: the technology from which the log originated. + // When it matches an integration name, Datadog automatically installs the corresponding parsers and facets. + // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). + Ddsource *string `json:"ddsource,omitempty"` + // Tags associated with your logs. + Ddtags *string `json:"ddtags,omitempty"` + // The name of the originating host of the log. + Hostname *string `json:"hostname,omitempty"` + // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) + // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. + // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. + Message string `json:"message"` + // The name of the application or service generating the log events. + // It is used to switch from Logs to APM, so make sure you define the same value when you use both products. + // See [reserved attributes](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes). + Service *string `json:"service,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]string +} + +// NewHTTPLogItem instantiates a new HTTPLogItem 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 NewHTTPLogItem(message string) *HTTPLogItem { + this := HTTPLogItem{} + this.Message = message + return &this +} + +// NewHTTPLogItemWithDefaults instantiates a new HTTPLogItem 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 NewHTTPLogItemWithDefaults() *HTTPLogItem { + this := HTTPLogItem{} + return &this +} + +// GetDdsource returns the Ddsource field value if set, zero value otherwise. +func (o *HTTPLogItem) GetDdsource() string { + if o == nil || o.Ddsource == nil { + var ret string + return ret + } + return *o.Ddsource +} + +// GetDdsourceOk returns a tuple with the Ddsource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogItem) GetDdsourceOk() (*string, bool) { + if o == nil || o.Ddsource == nil { + return nil, false + } + return o.Ddsource, true +} + +// HasDdsource returns a boolean if a field has been set. +func (o *HTTPLogItem) HasDdsource() bool { + if o != nil && o.Ddsource != nil { + return true + } + + return false +} + +// SetDdsource gets a reference to the given string and assigns it to the Ddsource field. +func (o *HTTPLogItem) SetDdsource(v string) { + o.Ddsource = &v +} + +// GetDdtags returns the Ddtags field value if set, zero value otherwise. +func (o *HTTPLogItem) GetDdtags() string { + if o == nil || o.Ddtags == nil { + var ret string + return ret + } + return *o.Ddtags +} + +// GetDdtagsOk returns a tuple with the Ddtags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPLogItem) GetDdtagsOk() (*string, bool) { + if o == nil || o.Ddtags == nil { + return nil, false + } + return o.Ddtags, true +} + +// HasDdtags returns a boolean if a field has been set. +func (o *HTTPLogItem) HasDdtags() bool { + if o != nil && o.Ddtags != nil { + return true + } + + return false +} + +// SetDdtags gets a reference to the given string and assigns it to the Ddtags field. +func (o *HTTPLogItem) SetDdtags(v string) { + o.Ddtags = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasHostname() bool { + if o != nil && o.Hostname != nil { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *HTTPLogItem) SetHostname(v string) { + o.Hostname = &v +} + +// GetMessage returns the Message field value. +func (o *HTTPLogItem) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *HTTPLogItem) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *HTTPLogItem) SetMessage(v string) { + o.Message = v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *HTTPLogItem) 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 *HTTPLogItem) 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 *HTTPLogItem) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *HTTPLogItem) SetService(v string) { + o.Service = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPLogItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Ddsource != nil { + toSerialize["ddsource"] = o.Ddsource + } + if o.Ddtags != nil { + toSerialize["ddtags"] = o.Ddtags + } + if o.Hostname != nil { + toSerialize["hostname"] = o.Hostname + } + toSerialize["message"] = o.Message + if o.Service != nil { + toSerialize["service"] = o.Service + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Message *string `json:"message"` + }{} + all := struct { + Ddsource *string `json:"ddsource,omitempty"` + Ddtags *string `json:"ddtags,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Message string `json:"message"` + Service *string `json:"service,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Ddsource = all.Ddsource + o.Ddtags = all.Ddtags + o.Hostname = all.Hostname + o.Message = all.Message + o.Service = all.Service + return nil +} diff --git a/api/v2/datadog/model_id_p_metadata_form_data.go b/api/v2/datadog/model_id_p_metadata_form_data.go new file mode 100644 index 00000000000..934a6c17489 --- /dev/null +++ b/api/v2/datadog/model_id_p_metadata_form_data.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "os" +) + +// IdPMetadataFormData The form data submitted to upload IdP metadata +type IdPMetadataFormData struct { + // The IdP metadata XML file + IdpFile **os.File `json:"idp_file,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{} +} + +// NewIdPMetadataFormData instantiates a new IdPMetadataFormData 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 NewIdPMetadataFormData() *IdPMetadataFormData { + this := IdPMetadataFormData{} + return &this +} + +// NewIdPMetadataFormDataWithDefaults instantiates a new IdPMetadataFormData 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 NewIdPMetadataFormDataWithDefaults() *IdPMetadataFormData { + this := IdPMetadataFormData{} + return &this +} + +// GetIdpFile returns the IdpFile field value if set, zero value otherwise. +func (o *IdPMetadataFormData) GetIdpFile() *os.File { + if o == nil || o.IdpFile == nil { + var ret *os.File + return ret + } + return *o.IdpFile +} + +// GetIdpFileOk returns a tuple with the IdpFile field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IdPMetadataFormData) GetIdpFileOk() (**os.File, bool) { + if o == nil || o.IdpFile == nil { + return nil, false + } + return o.IdpFile, true +} + +// HasIdpFile returns a boolean if a field has been set. +func (o *IdPMetadataFormData) HasIdpFile() bool { + if o != nil && o.IdpFile != nil { + return true + } + + return false +} + +// SetIdpFile gets a reference to the given *os.File and assigns it to the IdpFile field. +func (o *IdPMetadataFormData) SetIdpFile(v *os.File) { + o.IdpFile = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IdPMetadataFormData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IdpFile != nil { + toSerialize["idp_file"] = o.IdpFile + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IdPMetadataFormData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IdpFile **os.File `json:"idp_file,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IdpFile = all.IdpFile + return nil +} diff --git a/api/v2/datadog/model_incident_create_attributes.go b/api/v2/datadog/model_incident_create_attributes.go new file mode 100644 index 00000000000..f58692919c3 --- /dev/null +++ b/api/v2/datadog/model_incident_create_attributes.go @@ -0,0 +1,253 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentCreateAttributes The incident's attributes for a create request. +type IncidentCreateAttributes struct { + // A flag indicating whether the incident caused customer impact. + CustomerImpacted bool `json:"customer_impacted"` + // A condensed view of the user-defined fields for which to create initial selections. + Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` + // An array of initial timeline cells to be placed at the beginning of the incident timeline. + InitialCells []IncidentTimelineCellCreateAttributes `json:"initial_cells,omitempty"` + // Notification handles that will be notified of the incident at creation. + NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` + // The title of the incident, which summarizes what happened. + Title string `json:"title"` + // 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{} +} + +// NewIncidentCreateAttributes instantiates a new IncidentCreateAttributes 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 NewIncidentCreateAttributes(customerImpacted bool, title string) *IncidentCreateAttributes { + this := IncidentCreateAttributes{} + this.CustomerImpacted = customerImpacted + this.Title = title + return &this +} + +// NewIncidentCreateAttributesWithDefaults instantiates a new IncidentCreateAttributes 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 NewIncidentCreateAttributesWithDefaults() *IncidentCreateAttributes { + this := IncidentCreateAttributes{} + return &this +} + +// GetCustomerImpacted returns the CustomerImpacted field value. +func (o *IncidentCreateAttributes) GetCustomerImpacted() bool { + if o == nil { + var ret bool + return ret + } + return o.CustomerImpacted +} + +// GetCustomerImpactedOk returns a tuple with the CustomerImpacted field value +// and a boolean to check if the value has been set. +func (o *IncidentCreateAttributes) GetCustomerImpactedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.CustomerImpacted, true +} + +// SetCustomerImpacted sets field value. +func (o *IncidentCreateAttributes) SetCustomerImpacted(v bool) { + o.CustomerImpacted = v +} + +// GetFields returns the Fields field value if set, zero value otherwise. +func (o *IncidentCreateAttributes) GetFields() map[string]IncidentFieldAttributes { + if o == nil || o.Fields == nil { + var ret map[string]IncidentFieldAttributes + return ret + } + return o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentCreateAttributes) GetFieldsOk() (*map[string]IncidentFieldAttributes, bool) { + if o == nil || o.Fields == nil { + return nil, false + } + return &o.Fields, true +} + +// HasFields returns a boolean if a field has been set. +func (o *IncidentCreateAttributes) HasFields() bool { + if o != nil && o.Fields != nil { + return true + } + + return false +} + +// SetFields gets a reference to the given map[string]IncidentFieldAttributes and assigns it to the Fields field. +func (o *IncidentCreateAttributes) SetFields(v map[string]IncidentFieldAttributes) { + o.Fields = v +} + +// GetInitialCells returns the InitialCells field value if set, zero value otherwise. +func (o *IncidentCreateAttributes) GetInitialCells() []IncidentTimelineCellCreateAttributes { + if o == nil || o.InitialCells == nil { + var ret []IncidentTimelineCellCreateAttributes + return ret + } + return o.InitialCells +} + +// GetInitialCellsOk returns a tuple with the InitialCells field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentCreateAttributes) GetInitialCellsOk() (*[]IncidentTimelineCellCreateAttributes, bool) { + if o == nil || o.InitialCells == nil { + return nil, false + } + return &o.InitialCells, true +} + +// HasInitialCells returns a boolean if a field has been set. +func (o *IncidentCreateAttributes) HasInitialCells() bool { + if o != nil && o.InitialCells != nil { + return true + } + + return false +} + +// SetInitialCells gets a reference to the given []IncidentTimelineCellCreateAttributes and assigns it to the InitialCells field. +func (o *IncidentCreateAttributes) SetInitialCells(v []IncidentTimelineCellCreateAttributes) { + o.InitialCells = v +} + +// GetNotificationHandles returns the NotificationHandles field value if set, zero value otherwise. +func (o *IncidentCreateAttributes) GetNotificationHandles() []IncidentNotificationHandle { + if o == nil || o.NotificationHandles == nil { + var ret []IncidentNotificationHandle + return ret + } + return o.NotificationHandles +} + +// GetNotificationHandlesOk returns a tuple with the NotificationHandles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentCreateAttributes) GetNotificationHandlesOk() (*[]IncidentNotificationHandle, bool) { + if o == nil || o.NotificationHandles == nil { + return nil, false + } + return &o.NotificationHandles, true +} + +// HasNotificationHandles returns a boolean if a field has been set. +func (o *IncidentCreateAttributes) HasNotificationHandles() bool { + if o != nil && o.NotificationHandles != nil { + return true + } + + return false +} + +// SetNotificationHandles gets a reference to the given []IncidentNotificationHandle and assigns it to the NotificationHandles field. +func (o *IncidentCreateAttributes) SetNotificationHandles(v []IncidentNotificationHandle) { + o.NotificationHandles = v +} + +// GetTitle returns the Title field value. +func (o *IncidentCreateAttributes) GetTitle() string { + if o == nil { + var ret string + return ret + } + return o.Title +} + +// GetTitleOk returns a tuple with the Title field value +// and a boolean to check if the value has been set. +func (o *IncidentCreateAttributes) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Title, true +} + +// SetTitle sets field value. +func (o *IncidentCreateAttributes) SetTitle(v string) { + o.Title = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["customer_impacted"] = o.CustomerImpacted + if o.Fields != nil { + toSerialize["fields"] = o.Fields + } + if o.InitialCells != nil { + toSerialize["initial_cells"] = o.InitialCells + } + if o.NotificationHandles != nil { + toSerialize["notification_handles"] = o.NotificationHandles + } + toSerialize["title"] = o.Title + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + CustomerImpacted *bool `json:"customer_impacted"` + Title *string `json:"title"` + }{} + all := struct { + CustomerImpacted bool `json:"customer_impacted"` + Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` + InitialCells []IncidentTimelineCellCreateAttributes `json:"initial_cells,omitempty"` + NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` + Title string `json:"title"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.CustomerImpacted == nil { + return fmt.Errorf("Required field customer_impacted missing") + } + if required.Title == nil { + return fmt.Errorf("Required field title missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomerImpacted = all.CustomerImpacted + o.Fields = all.Fields + o.InitialCells = all.InitialCells + o.NotificationHandles = all.NotificationHandles + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_incident_create_data.go b/api/v2/datadog/model_incident_create_data.go new file mode 100644 index 00000000000..a16d791a375 --- /dev/null +++ b/api/v2/datadog/model_incident_create_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentCreateData Incident data for a create request. +type IncidentCreateData struct { + // The incident's attributes for a create request. + Attributes IncidentCreateAttributes `json:"attributes"` + // The relationships the incident will have with other resources once created. + Relationships *IncidentCreateRelationships `json:"relationships,omitempty"` + // Incident resource type. + Type IncidentType `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{} +} + +// NewIncidentCreateData instantiates a new IncidentCreateData 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 NewIncidentCreateData(attributes IncidentCreateAttributes, typeVar IncidentType) *IncidentCreateData { + this := IncidentCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentCreateDataWithDefaults instantiates a new IncidentCreateData 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 NewIncidentCreateDataWithDefaults() *IncidentCreateData { + this := IncidentCreateData{} + var typeVar IncidentType = INCIDENTTYPE_INCIDENTS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentCreateData) GetAttributes() IncidentCreateAttributes { + if o == nil { + var ret IncidentCreateAttributes + 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 *IncidentCreateData) GetAttributesOk() (*IncidentCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentCreateData) SetAttributes(v IncidentCreateAttributes) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentCreateData) GetRelationships() IncidentCreateRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentCreateRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentCreateData) GetRelationshipsOk() (*IncidentCreateRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentCreateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentCreateRelationships and assigns it to the Relationships field. +func (o *IncidentCreateData) SetRelationships(v IncidentCreateRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentCreateData) GetType() IncidentType { + if o == nil { + var ret IncidentType + 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 *IncidentCreateData) GetTypeOk() (*IncidentType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentCreateData) SetType(v IncidentType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *IncidentCreateAttributes `json:"attributes"` + Type *IncidentType `json:"type"` + }{} + all := struct { + Attributes IncidentCreateAttributes `json:"attributes"` + Relationships *IncidentCreateRelationships `json:"relationships,omitempty"` + Type IncidentType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_create_relationships.go b/api/v2/datadog/model_incident_create_relationships.go new file mode 100644 index 00000000000..bf0d8cbd047 --- /dev/null +++ b/api/v2/datadog/model_incident_create_relationships.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentCreateRelationships The relationships the incident will have with other resources once created. +type IncidentCreateRelationships struct { + // Relationship to user. + CommanderUser NullableRelationshipToUser `json:"commander_user"` + // 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{} +} + +// NewIncidentCreateRelationships instantiates a new IncidentCreateRelationships 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 NewIncidentCreateRelationships(commanderUser NullableRelationshipToUser) *IncidentCreateRelationships { + this := IncidentCreateRelationships{} + this.CommanderUser = commanderUser + return &this +} + +// NewIncidentCreateRelationshipsWithDefaults instantiates a new IncidentCreateRelationships 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 NewIncidentCreateRelationshipsWithDefaults() *IncidentCreateRelationships { + this := IncidentCreateRelationships{} + return &this +} + +// GetCommanderUser returns the CommanderUser field value. +func (o *IncidentCreateRelationships) GetCommanderUser() NullableRelationshipToUser { + if o == nil { + var ret NullableRelationshipToUser + return ret + } + return o.CommanderUser +} + +// GetCommanderUserOk returns a tuple with the CommanderUser field value +// and a boolean to check if the value has been set. +func (o *IncidentCreateRelationships) GetCommanderUserOk() (*NullableRelationshipToUser, bool) { + if o == nil { + return nil, false + } + return &o.CommanderUser, true +} + +// SetCommanderUser sets field value. +func (o *IncidentCreateRelationships) SetCommanderUser(v NullableRelationshipToUser) { + o.CommanderUser = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreateRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["commander_user"] = o.CommanderUser + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + CommanderUser *NullableRelationshipToUser `json:"commander_user"` + }{} + all := struct { + CommanderUser NullableRelationshipToUser `json:"commander_user"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.CommanderUser == nil { + return fmt.Errorf("Required field commander_user missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CommanderUser = all.CommanderUser + return nil +} diff --git a/api/v2/datadog/model_incident_create_request.go b/api/v2/datadog/model_incident_create_request.go new file mode 100644 index 00000000000..16d188a692e --- /dev/null +++ b/api/v2/datadog/model_incident_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentCreateRequest Create request for an incident. +type IncidentCreateRequest struct { + // Incident data for a create request. + Data IncidentCreateData `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{} +} + +// NewIncidentCreateRequest instantiates a new IncidentCreateRequest 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 NewIncidentCreateRequest(data IncidentCreateData) *IncidentCreateRequest { + this := IncidentCreateRequest{} + this.Data = data + return &this +} + +// NewIncidentCreateRequestWithDefaults instantiates a new IncidentCreateRequest 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 NewIncidentCreateRequestWithDefaults() *IncidentCreateRequest { + this := IncidentCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentCreateRequest) GetData() IncidentCreateData { + if o == nil { + var ret IncidentCreateData + 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 *IncidentCreateRequest) GetDataOk() (*IncidentCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentCreateRequest) SetData(v IncidentCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentCreateData `json:"data"` + }{} + all := struct { + Data IncidentCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_incident_field_attributes.go b/api/v2/datadog/model_incident_field_attributes.go new file mode 100644 index 00000000000..21d106c2717 --- /dev/null +++ b/api/v2/datadog/model_incident_field_attributes.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentFieldAttributes - Dynamic fields for which selections can be made, with field names as keys. +type IncidentFieldAttributes struct { + IncidentFieldAttributesSingleValue *IncidentFieldAttributesSingleValue + IncidentFieldAttributesMultipleValue *IncidentFieldAttributesMultipleValue + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// IncidentFieldAttributesSingleValueAsIncidentFieldAttributes is a convenience function that returns IncidentFieldAttributesSingleValue wrapped in IncidentFieldAttributes. +func IncidentFieldAttributesSingleValueAsIncidentFieldAttributes(v *IncidentFieldAttributesSingleValue) IncidentFieldAttributes { + return IncidentFieldAttributes{IncidentFieldAttributesSingleValue: v} +} + +// IncidentFieldAttributesMultipleValueAsIncidentFieldAttributes is a convenience function that returns IncidentFieldAttributesMultipleValue wrapped in IncidentFieldAttributes. +func IncidentFieldAttributesMultipleValueAsIncidentFieldAttributes(v *IncidentFieldAttributesMultipleValue) IncidentFieldAttributes { + return IncidentFieldAttributes{IncidentFieldAttributesMultipleValue: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *IncidentFieldAttributes) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IncidentFieldAttributesSingleValue + err = json.Unmarshal(data, &obj.IncidentFieldAttributesSingleValue) + if err == nil { + if obj.IncidentFieldAttributesSingleValue != nil && obj.IncidentFieldAttributesSingleValue.UnparsedObject == nil { + jsonIncidentFieldAttributesSingleValue, _ := json.Marshal(obj.IncidentFieldAttributesSingleValue) + if string(jsonIncidentFieldAttributesSingleValue) == "{}" { // empty struct + obj.IncidentFieldAttributesSingleValue = nil + } else { + match++ + } + } else { + obj.IncidentFieldAttributesSingleValue = nil + } + } else { + obj.IncidentFieldAttributesSingleValue = nil + } + + // try to unmarshal data into IncidentFieldAttributesMultipleValue + err = json.Unmarshal(data, &obj.IncidentFieldAttributesMultipleValue) + if err == nil { + if obj.IncidentFieldAttributesMultipleValue != nil && obj.IncidentFieldAttributesMultipleValue.UnparsedObject == nil { + jsonIncidentFieldAttributesMultipleValue, _ := json.Marshal(obj.IncidentFieldAttributesMultipleValue) + if string(jsonIncidentFieldAttributesMultipleValue) == "{}" { // empty struct + obj.IncidentFieldAttributesMultipleValue = nil + } else { + match++ + } + } else { + obj.IncidentFieldAttributesMultipleValue = nil + } + } else { + obj.IncidentFieldAttributesMultipleValue = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.IncidentFieldAttributesSingleValue = nil + obj.IncidentFieldAttributesMultipleValue = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj IncidentFieldAttributes) MarshalJSON() ([]byte, error) { + if obj.IncidentFieldAttributesSingleValue != nil { + return json.Marshal(&obj.IncidentFieldAttributesSingleValue) + } + + if obj.IncidentFieldAttributesMultipleValue != nil { + return json.Marshal(&obj.IncidentFieldAttributesMultipleValue) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *IncidentFieldAttributes) GetActualInstance() interface{} { + if obj.IncidentFieldAttributesSingleValue != nil { + return obj.IncidentFieldAttributesSingleValue + } + + if obj.IncidentFieldAttributesMultipleValue != nil { + return obj.IncidentFieldAttributesMultipleValue + } + + // all schemas are nil + return nil +} + +// NullableIncidentFieldAttributes handles when a null is used for IncidentFieldAttributes. +type NullableIncidentFieldAttributes struct { + value *IncidentFieldAttributes + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentFieldAttributes) Get() *IncidentFieldAttributes { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentFieldAttributes) Set(val *IncidentFieldAttributes) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentFieldAttributes) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableIncidentFieldAttributes) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentFieldAttributes initializes the struct as if Set has been called. +func NewNullableIncidentFieldAttributes(val *IncidentFieldAttributes) *NullableIncidentFieldAttributes { + return &NullableIncidentFieldAttributes{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentFieldAttributes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentFieldAttributes) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_field_attributes_multiple_value.go b/api/v2/datadog/model_incident_field_attributes_multiple_value.go new file mode 100644 index 00000000000..086cc6e3bcd --- /dev/null +++ b/api/v2/datadog/model_incident_field_attributes_multiple_value.go @@ -0,0 +1,154 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentFieldAttributesMultipleValue A field with potentially multiple values selected. +type IncidentFieldAttributesMultipleValue struct { + // Type of the multiple value field definitions. + Type *IncidentFieldAttributesValueType `json:"type,omitempty"` + // The multiple values selected for this field. + Value []string `json:"value,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{} +} + +// NewIncidentFieldAttributesMultipleValue instantiates a new IncidentFieldAttributesMultipleValue 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 NewIncidentFieldAttributesMultipleValue() *IncidentFieldAttributesMultipleValue { + this := IncidentFieldAttributesMultipleValue{} + var typeVar IncidentFieldAttributesValueType = INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT + this.Type = &typeVar + return &this +} + +// NewIncidentFieldAttributesMultipleValueWithDefaults instantiates a new IncidentFieldAttributesMultipleValue 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 NewIncidentFieldAttributesMultipleValueWithDefaults() *IncidentFieldAttributesMultipleValue { + this := IncidentFieldAttributesMultipleValue{} + var typeVar IncidentFieldAttributesValueType = INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT + this.Type = &typeVar + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *IncidentFieldAttributesMultipleValue) GetType() IncidentFieldAttributesValueType { + if o == nil || o.Type == nil { + var ret IncidentFieldAttributesValueType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentFieldAttributesMultipleValue) GetTypeOk() (*IncidentFieldAttributesValueType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *IncidentFieldAttributesMultipleValue) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given IncidentFieldAttributesValueType and assigns it to the Type field. +func (o *IncidentFieldAttributesMultipleValue) SetType(v IncidentFieldAttributesValueType) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentFieldAttributesMultipleValue) GetValue() []string { + if o == nil { + var ret []string + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value 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 *IncidentFieldAttributesMultipleValue) GetValueOk() (*[]string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return &o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *IncidentFieldAttributesMultipleValue) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given []string and assigns it to the Value field. +func (o *IncidentFieldAttributesMultipleValue) SetValue(v []string) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentFieldAttributesMultipleValue) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentFieldAttributesMultipleValue) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Type *IncidentFieldAttributesValueType `json:"type,omitempty"` + Value []string `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + o.Value = all.Value + return nil +} diff --git a/api/v2/datadog/model_incident_field_attributes_single_value.go b/api/v2/datadog/model_incident_field_attributes_single_value.go new file mode 100644 index 00000000000..74a8b8f5290 --- /dev/null +++ b/api/v2/datadog/model_incident_field_attributes_single_value.go @@ -0,0 +1,166 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// IncidentFieldAttributesSingleValue A field with a single value selected. +type IncidentFieldAttributesSingleValue struct { + // Type of the single value field definitions. + Type *IncidentFieldAttributesSingleValueType `json:"type,omitempty"` + // The single value selected for this field. + Value common.NullableString `json:"value,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{} +} + +// NewIncidentFieldAttributesSingleValue instantiates a new IncidentFieldAttributesSingleValue 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 NewIncidentFieldAttributesSingleValue() *IncidentFieldAttributesSingleValue { + this := IncidentFieldAttributesSingleValue{} + var typeVar IncidentFieldAttributesSingleValueType = INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN + this.Type = &typeVar + return &this +} + +// NewIncidentFieldAttributesSingleValueWithDefaults instantiates a new IncidentFieldAttributesSingleValue 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 NewIncidentFieldAttributesSingleValueWithDefaults() *IncidentFieldAttributesSingleValue { + this := IncidentFieldAttributesSingleValue{} + var typeVar IncidentFieldAttributesSingleValueType = INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN + this.Type = &typeVar + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *IncidentFieldAttributesSingleValue) GetType() IncidentFieldAttributesSingleValueType { + if o == nil || o.Type == nil { + var ret IncidentFieldAttributesSingleValueType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentFieldAttributesSingleValue) GetTypeOk() (*IncidentFieldAttributesSingleValueType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *IncidentFieldAttributesSingleValue) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given IncidentFieldAttributesSingleValueType and assigns it to the Type field. +func (o *IncidentFieldAttributesSingleValue) SetType(v IncidentFieldAttributesSingleValueType) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentFieldAttributesSingleValue) GetValue() string { + if o == nil || o.Value.Get() == nil { + var ret string + return ret + } + return *o.Value.Get() +} + +// GetValueOk returns a tuple with the Value 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 *IncidentFieldAttributesSingleValue) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Value.Get(), o.Value.IsSet() +} + +// HasValue returns a boolean if a field has been set. +func (o *IncidentFieldAttributesSingleValue) HasValue() bool { + if o != nil && o.Value.IsSet() { + return true + } + + return false +} + +// SetValue gets a reference to the given common.NullableString and assigns it to the Value field. +func (o *IncidentFieldAttributesSingleValue) SetValue(v string) { + o.Value.Set(&v) +} + +// SetValueNil sets the value for Value to be an explicit nil. +func (o *IncidentFieldAttributesSingleValue) SetValueNil() { + o.Value.Set(nil) +} + +// UnsetValue ensures that no value is present for Value, not even an explicit nil. +func (o *IncidentFieldAttributesSingleValue) UnsetValue() { + o.Value.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentFieldAttributesSingleValue) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value.IsSet() { + toSerialize["value"] = o.Value.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentFieldAttributesSingleValue) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Type *IncidentFieldAttributesSingleValueType `json:"type,omitempty"` + Value common.NullableString `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Type = all.Type + o.Value = all.Value + return nil +} diff --git a/api/v2/datadog/model_incident_field_attributes_single_value_type.go b/api/v2/datadog/model_incident_field_attributes_single_value_type.go new file mode 100644 index 00000000000..d0b9aed4a60 --- /dev/null +++ b/api/v2/datadog/model_incident_field_attributes_single_value_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentFieldAttributesSingleValueType Type of the single value field definitions. +type IncidentFieldAttributesSingleValueType string + +// List of IncidentFieldAttributesSingleValueType. +const ( + INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN IncidentFieldAttributesSingleValueType = "dropdown" + INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_TEXTBOX IncidentFieldAttributesSingleValueType = "textbox" +) + +var allowedIncidentFieldAttributesSingleValueTypeEnumValues = []IncidentFieldAttributesSingleValueType{ + INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN, + INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_TEXTBOX, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentFieldAttributesSingleValueType) GetAllowedValues() []IncidentFieldAttributesSingleValueType { + return allowedIncidentFieldAttributesSingleValueTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentFieldAttributesSingleValueType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentFieldAttributesSingleValueType(value) + return nil +} + +// NewIncidentFieldAttributesSingleValueTypeFromValue returns a pointer to a valid IncidentFieldAttributesSingleValueType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentFieldAttributesSingleValueTypeFromValue(v string) (*IncidentFieldAttributesSingleValueType, error) { + ev := IncidentFieldAttributesSingleValueType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentFieldAttributesSingleValueType: valid values are %v", v, allowedIncidentFieldAttributesSingleValueTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentFieldAttributesSingleValueType) IsValid() bool { + for _, existing := range allowedIncidentFieldAttributesSingleValueTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentFieldAttributesSingleValueType value. +func (v IncidentFieldAttributesSingleValueType) Ptr() *IncidentFieldAttributesSingleValueType { + return &v +} + +// NullableIncidentFieldAttributesSingleValueType handles when a null is used for IncidentFieldAttributesSingleValueType. +type NullableIncidentFieldAttributesSingleValueType struct { + value *IncidentFieldAttributesSingleValueType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentFieldAttributesSingleValueType) Get() *IncidentFieldAttributesSingleValueType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentFieldAttributesSingleValueType) Set(val *IncidentFieldAttributesSingleValueType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentFieldAttributesSingleValueType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentFieldAttributesSingleValueType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentFieldAttributesSingleValueType initializes the struct as if Set has been called. +func NewNullableIncidentFieldAttributesSingleValueType(val *IncidentFieldAttributesSingleValueType) *NullableIncidentFieldAttributesSingleValueType { + return &NullableIncidentFieldAttributesSingleValueType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentFieldAttributesSingleValueType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentFieldAttributesSingleValueType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_field_attributes_value_type.go b/api/v2/datadog/model_incident_field_attributes_value_type.go new file mode 100644 index 00000000000..ccc09b52ae4 --- /dev/null +++ b/api/v2/datadog/model_incident_field_attributes_value_type.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentFieldAttributesValueType Type of the multiple value field definitions. +type IncidentFieldAttributesValueType string + +// List of IncidentFieldAttributesValueType. +const ( + INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT IncidentFieldAttributesValueType = "multiselect" + INCIDENTFIELDATTRIBUTESVALUETYPE_TEXTARRAY IncidentFieldAttributesValueType = "textarray" + INCIDENTFIELDATTRIBUTESVALUETYPE_METRICTAG IncidentFieldAttributesValueType = "metrictag" + INCIDENTFIELDATTRIBUTESVALUETYPE_AUTOCOMPLETE IncidentFieldAttributesValueType = "autocomplete" +) + +var allowedIncidentFieldAttributesValueTypeEnumValues = []IncidentFieldAttributesValueType{ + INCIDENTFIELDATTRIBUTESVALUETYPE_MULTISELECT, + INCIDENTFIELDATTRIBUTESVALUETYPE_TEXTARRAY, + INCIDENTFIELDATTRIBUTESVALUETYPE_METRICTAG, + INCIDENTFIELDATTRIBUTESVALUETYPE_AUTOCOMPLETE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentFieldAttributesValueType) GetAllowedValues() []IncidentFieldAttributesValueType { + return allowedIncidentFieldAttributesValueTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentFieldAttributesValueType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentFieldAttributesValueType(value) + return nil +} + +// NewIncidentFieldAttributesValueTypeFromValue returns a pointer to a valid IncidentFieldAttributesValueType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentFieldAttributesValueTypeFromValue(v string) (*IncidentFieldAttributesValueType, error) { + ev := IncidentFieldAttributesValueType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentFieldAttributesValueType: valid values are %v", v, allowedIncidentFieldAttributesValueTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentFieldAttributesValueType) IsValid() bool { + for _, existing := range allowedIncidentFieldAttributesValueTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentFieldAttributesValueType value. +func (v IncidentFieldAttributesValueType) Ptr() *IncidentFieldAttributesValueType { + return &v +} + +// NullableIncidentFieldAttributesValueType handles when a null is used for IncidentFieldAttributesValueType. +type NullableIncidentFieldAttributesValueType struct { + value *IncidentFieldAttributesValueType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentFieldAttributesValueType) Get() *IncidentFieldAttributesValueType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentFieldAttributesValueType) Set(val *IncidentFieldAttributesValueType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentFieldAttributesValueType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentFieldAttributesValueType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentFieldAttributesValueType initializes the struct as if Set has been called. +func NewNullableIncidentFieldAttributesValueType(val *IncidentFieldAttributesValueType) *NullableIncidentFieldAttributesValueType { + return &NullableIncidentFieldAttributesValueType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentFieldAttributesValueType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentFieldAttributesValueType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_integration_metadata_type.go b/api/v2/datadog/model_incident_integration_metadata_type.go new file mode 100644 index 00000000000..49a06cd3fef --- /dev/null +++ b/api/v2/datadog/model_incident_integration_metadata_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentIntegrationMetadataType Integration metadata resource type. +type IncidentIntegrationMetadataType string + +// List of IncidentIntegrationMetadataType. +const ( + INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS IncidentIntegrationMetadataType = "incident_integrations" +) + +var allowedIncidentIntegrationMetadataTypeEnumValues = []IncidentIntegrationMetadataType{ + INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentIntegrationMetadataType) GetAllowedValues() []IncidentIntegrationMetadataType { + return allowedIncidentIntegrationMetadataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentIntegrationMetadataType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentIntegrationMetadataType(value) + return nil +} + +// NewIncidentIntegrationMetadataTypeFromValue returns a pointer to a valid IncidentIntegrationMetadataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentIntegrationMetadataTypeFromValue(v string) (*IncidentIntegrationMetadataType, error) { + ev := IncidentIntegrationMetadataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentIntegrationMetadataType: valid values are %v", v, allowedIncidentIntegrationMetadataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentIntegrationMetadataType) IsValid() bool { + for _, existing := range allowedIncidentIntegrationMetadataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentIntegrationMetadataType value. +func (v IncidentIntegrationMetadataType) Ptr() *IncidentIntegrationMetadataType { + return &v +} + +// NullableIncidentIntegrationMetadataType handles when a null is used for IncidentIntegrationMetadataType. +type NullableIncidentIntegrationMetadataType struct { + value *IncidentIntegrationMetadataType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentIntegrationMetadataType) Get() *IncidentIntegrationMetadataType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentIntegrationMetadataType) Set(val *IncidentIntegrationMetadataType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentIntegrationMetadataType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentIntegrationMetadataType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentIntegrationMetadataType initializes the struct as if Set has been called. +func NewNullableIncidentIntegrationMetadataType(val *IncidentIntegrationMetadataType) *NullableIncidentIntegrationMetadataType { + return &NullableIncidentIntegrationMetadataType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentIntegrationMetadataType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentIntegrationMetadataType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_notification_handle.go b/api/v2/datadog/model_incident_notification_handle.go new file mode 100644 index 00000000000..a943b0a64b1 --- /dev/null +++ b/api/v2/datadog/model_incident_notification_handle.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentNotificationHandle A notification handle that will be notified at incident creation. +type IncidentNotificationHandle struct { + // The name of the notified handle. + DisplayName *string `json:"display_name,omitempty"` + // The email address used for the notification. + Handle *string `json:"handle,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{} +} + +// NewIncidentNotificationHandle instantiates a new IncidentNotificationHandle 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 NewIncidentNotificationHandle() *IncidentNotificationHandle { + this := IncidentNotificationHandle{} + return &this +} + +// NewIncidentNotificationHandleWithDefaults instantiates a new IncidentNotificationHandle 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 NewIncidentNotificationHandleWithDefaults() *IncidentNotificationHandle { + this := IncidentNotificationHandle{} + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *IncidentNotificationHandle) GetDisplayName() string { + if o == nil || o.DisplayName == nil { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentNotificationHandle) GetDisplayNameOk() (*string, bool) { + if o == nil || o.DisplayName == nil { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *IncidentNotificationHandle) HasDisplayName() bool { + if o != nil && o.DisplayName != nil { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *IncidentNotificationHandle) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *IncidentNotificationHandle) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentNotificationHandle) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *IncidentNotificationHandle) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *IncidentNotificationHandle) SetHandle(v string) { + o.Handle = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentNotificationHandle) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DisplayName != nil { + toSerialize["display_name"] = o.DisplayName + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentNotificationHandle) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DisplayName *string `json:"display_name,omitempty"` + Handle *string `json:"handle,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DisplayName = all.DisplayName + o.Handle = all.Handle + return nil +} diff --git a/api/v2/datadog/model_incident_postmortem_type.go b/api/v2/datadog/model_incident_postmortem_type.go new file mode 100644 index 00000000000..45cf229bced --- /dev/null +++ b/api/v2/datadog/model_incident_postmortem_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentPostmortemType Incident postmortem resource type. +type IncidentPostmortemType string + +// List of IncidentPostmortemType. +const ( + INCIDENTPOSTMORTEMTYPE_INCIDENT_POSTMORTEMS IncidentPostmortemType = "incident_postmortems" +) + +var allowedIncidentPostmortemTypeEnumValues = []IncidentPostmortemType{ + INCIDENTPOSTMORTEMTYPE_INCIDENT_POSTMORTEMS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentPostmortemType) GetAllowedValues() []IncidentPostmortemType { + return allowedIncidentPostmortemTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentPostmortemType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentPostmortemType(value) + return nil +} + +// NewIncidentPostmortemTypeFromValue returns a pointer to a valid IncidentPostmortemType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentPostmortemTypeFromValue(v string) (*IncidentPostmortemType, error) { + ev := IncidentPostmortemType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentPostmortemType: valid values are %v", v, allowedIncidentPostmortemTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentPostmortemType) IsValid() bool { + for _, existing := range allowedIncidentPostmortemTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentPostmortemType value. +func (v IncidentPostmortemType) Ptr() *IncidentPostmortemType { + return &v +} + +// NullableIncidentPostmortemType handles when a null is used for IncidentPostmortemType. +type NullableIncidentPostmortemType struct { + value *IncidentPostmortemType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentPostmortemType) Get() *IncidentPostmortemType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentPostmortemType) Set(val *IncidentPostmortemType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentPostmortemType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentPostmortemType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentPostmortemType initializes the struct as if Set has been called. +func NewNullableIncidentPostmortemType(val *IncidentPostmortemType) *NullableIncidentPostmortemType { + return &NullableIncidentPostmortemType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentPostmortemType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentPostmortemType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_related_object.go b/api/v2/datadog/model_incident_related_object.go new file mode 100644 index 00000000000..485c3072de6 --- /dev/null +++ b/api/v2/datadog/model_incident_related_object.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentRelatedObject Object related to an incident. +type IncidentRelatedObject string + +// List of IncidentRelatedObject. +const ( + INCIDENTRELATEDOBJECT_USERS IncidentRelatedObject = "users" +) + +var allowedIncidentRelatedObjectEnumValues = []IncidentRelatedObject{ + INCIDENTRELATEDOBJECT_USERS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentRelatedObject) GetAllowedValues() []IncidentRelatedObject { + return allowedIncidentRelatedObjectEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentRelatedObject) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentRelatedObject(value) + return nil +} + +// NewIncidentRelatedObjectFromValue returns a pointer to a valid IncidentRelatedObject +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentRelatedObjectFromValue(v string) (*IncidentRelatedObject, error) { + ev := IncidentRelatedObject(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentRelatedObject: valid values are %v", v, allowedIncidentRelatedObjectEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentRelatedObject) IsValid() bool { + for _, existing := range allowedIncidentRelatedObjectEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentRelatedObject value. +func (v IncidentRelatedObject) Ptr() *IncidentRelatedObject { + return &v +} + +// NullableIncidentRelatedObject handles when a null is used for IncidentRelatedObject. +type NullableIncidentRelatedObject struct { + value *IncidentRelatedObject + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentRelatedObject) Get() *IncidentRelatedObject { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentRelatedObject) Set(val *IncidentRelatedObject) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentRelatedObject) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentRelatedObject) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentRelatedObject initializes the struct as if Set has been called. +func NewNullableIncidentRelatedObject(val *IncidentRelatedObject) *NullableIncidentRelatedObject { + return &NullableIncidentRelatedObject{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentRelatedObject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentRelatedObject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_response.go b/api/v2/datadog/model_incident_response.go new file mode 100644 index 00000000000..7ce94f64a5f --- /dev/null +++ b/api/v2/datadog/model_incident_response.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentResponse Response with an incident. +type IncidentResponse struct { + // Incident data from a response. + Data IncidentResponseData `json:"data"` + // Included related resources that the user requested. + Included []IncidentResponseIncludedItem `json:"included,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{} +} + +// NewIncidentResponse instantiates a new IncidentResponse 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 NewIncidentResponse(data IncidentResponseData) *IncidentResponse { + this := IncidentResponse{} + this.Data = data + return &this +} + +// NewIncidentResponseWithDefaults instantiates a new IncidentResponse 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 NewIncidentResponseWithDefaults() *IncidentResponse { + this := IncidentResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentResponse) GetData() IncidentResponseData { + if o == nil { + var ret IncidentResponseData + 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 *IncidentResponse) GetDataOk() (*IncidentResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentResponse) SetData(v IncidentResponseData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentResponse) GetIncluded() []IncidentResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []IncidentResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponse) GetIncludedOk() (*[]IncidentResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []IncidentResponseIncludedItem and assigns it to the Included field. +func (o *IncidentResponse) SetIncluded(v []IncidentResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentResponseData `json:"data"` + }{} + all := struct { + Data IncidentResponseData `json:"data"` + Included []IncidentResponseIncludedItem `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_incident_response_attributes.go b/api/v2/datadog/model_incident_response_attributes.go new file mode 100644 index 00000000000..5f4641c1168 --- /dev/null +++ b/api/v2/datadog/model_incident_response_attributes.go @@ -0,0 +1,835 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// IncidentResponseAttributes The incident's attributes from a response. +type IncidentResponseAttributes struct { + // Timestamp when the incident was created. + Created *time.Time `json:"created,omitempty"` + // Length of the incident's customer impact in seconds. + // Equals the difference between `customer_impact_start` and `customer_impact_end`. + CustomerImpactDuration *int64 `json:"customer_impact_duration,omitempty"` + // Timestamp when customers were no longer impacted by the incident. + CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` + // A summary of the impact customers experienced during the incident. + CustomerImpactScope common.NullableString `json:"customer_impact_scope,omitempty"` + // Timestamp when customers began being impacted by the incident. + CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` + // A flag indicating whether the incident caused customer impact. + CustomerImpacted *bool `json:"customer_impacted,omitempty"` + // Timestamp when the incident was detected. + Detected common.NullableTime `json:"detected,omitempty"` + // A condensed view of the user-defined fields attached to incidents. + Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` + // Timestamp when the incident was last modified. + Modified *time.Time `json:"modified,omitempty"` + // Notification handles that will be notified of the incident during update. + NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` + // The UUID of the postmortem object attached to the incident. + PostmortemId *string `json:"postmortem_id,omitempty"` + // The monotonically increasing integer ID for the incident. + PublicId *int64 `json:"public_id,omitempty"` + // Timestamp when the incident's state was set to resolved. + Resolved common.NullableTime `json:"resolved,omitempty"` + // The amount of time in seconds to detect the incident. + // Equals the difference between `customer_impact_start` and `detected`. + TimeToDetect *int64 `json:"time_to_detect,omitempty"` + // The amount of time in seconds to call incident after detection. Equals the difference of `detected` and `created`. + TimeToInternalResponse *int64 `json:"time_to_internal_response,omitempty"` + // The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between `customer_impact_end` and `detected`. + TimeToRepair *int64 `json:"time_to_repair,omitempty"` + // The amount of time in seconds to resolve the incident after it was created. Equals the difference between `created` and `resolved`. + TimeToResolve *int64 `json:"time_to_resolve,omitempty"` + // The title of the incident, which summarizes what happened. + Title string `json:"title"` + // 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{} +} + +// NewIncidentResponseAttributes instantiates a new IncidentResponseAttributes 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 NewIncidentResponseAttributes(title string) *IncidentResponseAttributes { + this := IncidentResponseAttributes{} + this.Title = title + return &this +} + +// NewIncidentResponseAttributesWithDefaults instantiates a new IncidentResponseAttributes 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 NewIncidentResponseAttributesWithDefaults() *IncidentResponseAttributes { + this := IncidentResponseAttributes{} + return &this +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *IncidentResponseAttributes) SetCreated(v time.Time) { + o.Created = &v +} + +// GetCustomerImpactDuration returns the CustomerImpactDuration field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetCustomerImpactDuration() int64 { + if o == nil || o.CustomerImpactDuration == nil { + var ret int64 + return ret + } + return *o.CustomerImpactDuration +} + +// GetCustomerImpactDurationOk returns a tuple with the CustomerImpactDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetCustomerImpactDurationOk() (*int64, bool) { + if o == nil || o.CustomerImpactDuration == nil { + return nil, false + } + return o.CustomerImpactDuration, true +} + +// HasCustomerImpactDuration returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasCustomerImpactDuration() bool { + if o != nil && o.CustomerImpactDuration != nil { + return true + } + + return false +} + +// SetCustomerImpactDuration gets a reference to the given int64 and assigns it to the CustomerImpactDuration field. +func (o *IncidentResponseAttributes) SetCustomerImpactDuration(v int64) { + o.CustomerImpactDuration = &v +} + +// GetCustomerImpactEnd returns the CustomerImpactEnd field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponseAttributes) GetCustomerImpactEnd() time.Time { + if o == nil || o.CustomerImpactEnd.Get() == nil { + var ret time.Time + return ret + } + return *o.CustomerImpactEnd.Get() +} + +// GetCustomerImpactEndOk returns a tuple with the CustomerImpactEnd 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 *IncidentResponseAttributes) GetCustomerImpactEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CustomerImpactEnd.Get(), o.CustomerImpactEnd.IsSet() +} + +// HasCustomerImpactEnd returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasCustomerImpactEnd() bool { + if o != nil && o.CustomerImpactEnd.IsSet() { + return true + } + + return false +} + +// SetCustomerImpactEnd gets a reference to the given common.NullableTime and assigns it to the CustomerImpactEnd field. +func (o *IncidentResponseAttributes) SetCustomerImpactEnd(v time.Time) { + o.CustomerImpactEnd.Set(&v) +} + +// SetCustomerImpactEndNil sets the value for CustomerImpactEnd to be an explicit nil. +func (o *IncidentResponseAttributes) SetCustomerImpactEndNil() { + o.CustomerImpactEnd.Set(nil) +} + +// UnsetCustomerImpactEnd ensures that no value is present for CustomerImpactEnd, not even an explicit nil. +func (o *IncidentResponseAttributes) UnsetCustomerImpactEnd() { + o.CustomerImpactEnd.Unset() +} + +// GetCustomerImpactScope returns the CustomerImpactScope field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponseAttributes) GetCustomerImpactScope() string { + if o == nil || o.CustomerImpactScope.Get() == nil { + var ret string + return ret + } + return *o.CustomerImpactScope.Get() +} + +// GetCustomerImpactScopeOk returns a tuple with the CustomerImpactScope 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 *IncidentResponseAttributes) GetCustomerImpactScopeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CustomerImpactScope.Get(), o.CustomerImpactScope.IsSet() +} + +// HasCustomerImpactScope returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasCustomerImpactScope() bool { + if o != nil && o.CustomerImpactScope.IsSet() { + return true + } + + return false +} + +// SetCustomerImpactScope gets a reference to the given common.NullableString and assigns it to the CustomerImpactScope field. +func (o *IncidentResponseAttributes) SetCustomerImpactScope(v string) { + o.CustomerImpactScope.Set(&v) +} + +// SetCustomerImpactScopeNil sets the value for CustomerImpactScope to be an explicit nil. +func (o *IncidentResponseAttributes) SetCustomerImpactScopeNil() { + o.CustomerImpactScope.Set(nil) +} + +// UnsetCustomerImpactScope ensures that no value is present for CustomerImpactScope, not even an explicit nil. +func (o *IncidentResponseAttributes) UnsetCustomerImpactScope() { + o.CustomerImpactScope.Unset() +} + +// GetCustomerImpactStart returns the CustomerImpactStart field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponseAttributes) GetCustomerImpactStart() time.Time { + if o == nil || o.CustomerImpactStart.Get() == nil { + var ret time.Time + return ret + } + return *o.CustomerImpactStart.Get() +} + +// GetCustomerImpactStartOk returns a tuple with the CustomerImpactStart 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 *IncidentResponseAttributes) GetCustomerImpactStartOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CustomerImpactStart.Get(), o.CustomerImpactStart.IsSet() +} + +// HasCustomerImpactStart returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasCustomerImpactStart() bool { + if o != nil && o.CustomerImpactStart.IsSet() { + return true + } + + return false +} + +// SetCustomerImpactStart gets a reference to the given common.NullableTime and assigns it to the CustomerImpactStart field. +func (o *IncidentResponseAttributes) SetCustomerImpactStart(v time.Time) { + o.CustomerImpactStart.Set(&v) +} + +// SetCustomerImpactStartNil sets the value for CustomerImpactStart to be an explicit nil. +func (o *IncidentResponseAttributes) SetCustomerImpactStartNil() { + o.CustomerImpactStart.Set(nil) +} + +// UnsetCustomerImpactStart ensures that no value is present for CustomerImpactStart, not even an explicit nil. +func (o *IncidentResponseAttributes) UnsetCustomerImpactStart() { + o.CustomerImpactStart.Unset() +} + +// GetCustomerImpacted returns the CustomerImpacted field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetCustomerImpacted() bool { + if o == nil || o.CustomerImpacted == nil { + var ret bool + return ret + } + return *o.CustomerImpacted +} + +// GetCustomerImpactedOk returns a tuple with the CustomerImpacted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetCustomerImpactedOk() (*bool, bool) { + if o == nil || o.CustomerImpacted == nil { + return nil, false + } + return o.CustomerImpacted, true +} + +// HasCustomerImpacted returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasCustomerImpacted() bool { + if o != nil && o.CustomerImpacted != nil { + return true + } + + return false +} + +// SetCustomerImpacted gets a reference to the given bool and assigns it to the CustomerImpacted field. +func (o *IncidentResponseAttributes) SetCustomerImpacted(v bool) { + o.CustomerImpacted = &v +} + +// GetDetected returns the Detected field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponseAttributes) GetDetected() time.Time { + if o == nil || o.Detected.Get() == nil { + var ret time.Time + return ret + } + return *o.Detected.Get() +} + +// GetDetectedOk returns a tuple with the Detected 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 *IncidentResponseAttributes) GetDetectedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Detected.Get(), o.Detected.IsSet() +} + +// HasDetected returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasDetected() bool { + if o != nil && o.Detected.IsSet() { + return true + } + + return false +} + +// SetDetected gets a reference to the given common.NullableTime and assigns it to the Detected field. +func (o *IncidentResponseAttributes) SetDetected(v time.Time) { + o.Detected.Set(&v) +} + +// SetDetectedNil sets the value for Detected to be an explicit nil. +func (o *IncidentResponseAttributes) SetDetectedNil() { + o.Detected.Set(nil) +} + +// UnsetDetected ensures that no value is present for Detected, not even an explicit nil. +func (o *IncidentResponseAttributes) UnsetDetected() { + o.Detected.Unset() +} + +// GetFields returns the Fields field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetFields() map[string]IncidentFieldAttributes { + if o == nil || o.Fields == nil { + var ret map[string]IncidentFieldAttributes + return ret + } + return o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetFieldsOk() (*map[string]IncidentFieldAttributes, bool) { + if o == nil || o.Fields == nil { + return nil, false + } + return &o.Fields, true +} + +// HasFields returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasFields() bool { + if o != nil && o.Fields != nil { + return true + } + + return false +} + +// SetFields gets a reference to the given map[string]IncidentFieldAttributes and assigns it to the Fields field. +func (o *IncidentResponseAttributes) SetFields(v map[string]IncidentFieldAttributes) { + o.Fields = v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *IncidentResponseAttributes) SetModified(v time.Time) { + o.Modified = &v +} + +// GetNotificationHandles returns the NotificationHandles field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponseAttributes) GetNotificationHandles() []IncidentNotificationHandle { + if o == nil { + var ret []IncidentNotificationHandle + return ret + } + return o.NotificationHandles +} + +// GetNotificationHandlesOk returns a tuple with the NotificationHandles 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 *IncidentResponseAttributes) GetNotificationHandlesOk() (*[]IncidentNotificationHandle, bool) { + if o == nil || o.NotificationHandles == nil { + return nil, false + } + return &o.NotificationHandles, true +} + +// HasNotificationHandles returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasNotificationHandles() bool { + if o != nil && o.NotificationHandles != nil { + return true + } + + return false +} + +// SetNotificationHandles gets a reference to the given []IncidentNotificationHandle and assigns it to the NotificationHandles field. +func (o *IncidentResponseAttributes) SetNotificationHandles(v []IncidentNotificationHandle) { + o.NotificationHandles = v +} + +// GetPostmortemId returns the PostmortemId field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetPostmortemId() string { + if o == nil || o.PostmortemId == nil { + var ret string + return ret + } + return *o.PostmortemId +} + +// GetPostmortemIdOk returns a tuple with the PostmortemId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetPostmortemIdOk() (*string, bool) { + if o == nil || o.PostmortemId == nil { + return nil, false + } + return o.PostmortemId, true +} + +// HasPostmortemId returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasPostmortemId() bool { + if o != nil && o.PostmortemId != nil { + return true + } + + return false +} + +// SetPostmortemId gets a reference to the given string and assigns it to the PostmortemId field. +func (o *IncidentResponseAttributes) SetPostmortemId(v string) { + o.PostmortemId = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetPublicId() int64 { + if o == nil || o.PublicId == nil { + var ret int64 + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetPublicIdOk() (*int64, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given int64 and assigns it to the PublicId field. +func (o *IncidentResponseAttributes) SetPublicId(v int64) { + o.PublicId = &v +} + +// GetResolved returns the Resolved field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponseAttributes) GetResolved() time.Time { + if o == nil || o.Resolved.Get() == nil { + var ret time.Time + return ret + } + return *o.Resolved.Get() +} + +// GetResolvedOk returns a tuple with the Resolved 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 *IncidentResponseAttributes) GetResolvedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Resolved.Get(), o.Resolved.IsSet() +} + +// HasResolved returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasResolved() bool { + if o != nil && o.Resolved.IsSet() { + return true + } + + return false +} + +// SetResolved gets a reference to the given common.NullableTime and assigns it to the Resolved field. +func (o *IncidentResponseAttributes) SetResolved(v time.Time) { + o.Resolved.Set(&v) +} + +// SetResolvedNil sets the value for Resolved to be an explicit nil. +func (o *IncidentResponseAttributes) SetResolvedNil() { + o.Resolved.Set(nil) +} + +// UnsetResolved ensures that no value is present for Resolved, not even an explicit nil. +func (o *IncidentResponseAttributes) UnsetResolved() { + o.Resolved.Unset() +} + +// GetTimeToDetect returns the TimeToDetect field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetTimeToDetect() int64 { + if o == nil || o.TimeToDetect == nil { + var ret int64 + return ret + } + return *o.TimeToDetect +} + +// GetTimeToDetectOk returns a tuple with the TimeToDetect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetTimeToDetectOk() (*int64, bool) { + if o == nil || o.TimeToDetect == nil { + return nil, false + } + return o.TimeToDetect, true +} + +// HasTimeToDetect returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasTimeToDetect() bool { + if o != nil && o.TimeToDetect != nil { + return true + } + + return false +} + +// SetTimeToDetect gets a reference to the given int64 and assigns it to the TimeToDetect field. +func (o *IncidentResponseAttributes) SetTimeToDetect(v int64) { + o.TimeToDetect = &v +} + +// GetTimeToInternalResponse returns the TimeToInternalResponse field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetTimeToInternalResponse() int64 { + if o == nil || o.TimeToInternalResponse == nil { + var ret int64 + return ret + } + return *o.TimeToInternalResponse +} + +// GetTimeToInternalResponseOk returns a tuple with the TimeToInternalResponse field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetTimeToInternalResponseOk() (*int64, bool) { + if o == nil || o.TimeToInternalResponse == nil { + return nil, false + } + return o.TimeToInternalResponse, true +} + +// HasTimeToInternalResponse returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasTimeToInternalResponse() bool { + if o != nil && o.TimeToInternalResponse != nil { + return true + } + + return false +} + +// SetTimeToInternalResponse gets a reference to the given int64 and assigns it to the TimeToInternalResponse field. +func (o *IncidentResponseAttributes) SetTimeToInternalResponse(v int64) { + o.TimeToInternalResponse = &v +} + +// GetTimeToRepair returns the TimeToRepair field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetTimeToRepair() int64 { + if o == nil || o.TimeToRepair == nil { + var ret int64 + return ret + } + return *o.TimeToRepair +} + +// GetTimeToRepairOk returns a tuple with the TimeToRepair field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetTimeToRepairOk() (*int64, bool) { + if o == nil || o.TimeToRepair == nil { + return nil, false + } + return o.TimeToRepair, true +} + +// HasTimeToRepair returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasTimeToRepair() bool { + if o != nil && o.TimeToRepair != nil { + return true + } + + return false +} + +// SetTimeToRepair gets a reference to the given int64 and assigns it to the TimeToRepair field. +func (o *IncidentResponseAttributes) SetTimeToRepair(v int64) { + o.TimeToRepair = &v +} + +// GetTimeToResolve returns the TimeToResolve field value if set, zero value otherwise. +func (o *IncidentResponseAttributes) GetTimeToResolve() int64 { + if o == nil || o.TimeToResolve == nil { + var ret int64 + return ret + } + return *o.TimeToResolve +} + +// GetTimeToResolveOk returns a tuple with the TimeToResolve field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetTimeToResolveOk() (*int64, bool) { + if o == nil || o.TimeToResolve == nil { + return nil, false + } + return o.TimeToResolve, true +} + +// HasTimeToResolve returns a boolean if a field has been set. +func (o *IncidentResponseAttributes) HasTimeToResolve() bool { + if o != nil && o.TimeToResolve != nil { + return true + } + + return false +} + +// SetTimeToResolve gets a reference to the given int64 and assigns it to the TimeToResolve field. +func (o *IncidentResponseAttributes) SetTimeToResolve(v int64) { + o.TimeToResolve = &v +} + +// GetTitle returns the Title field value. +func (o *IncidentResponseAttributes) GetTitle() string { + if o == nil { + var ret string + return ret + } + return o.Title +} + +// GetTitleOk returns a tuple with the Title field value +// and a boolean to check if the value has been set. +func (o *IncidentResponseAttributes) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Title, true +} + +// SetTitle sets field value. +func (o *IncidentResponseAttributes) SetTitle(v string) { + o.Title = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.CustomerImpactDuration != nil { + toSerialize["customer_impact_duration"] = o.CustomerImpactDuration + } + if o.CustomerImpactEnd.IsSet() { + toSerialize["customer_impact_end"] = o.CustomerImpactEnd.Get() + } + if o.CustomerImpactScope.IsSet() { + toSerialize["customer_impact_scope"] = o.CustomerImpactScope.Get() + } + if o.CustomerImpactStart.IsSet() { + toSerialize["customer_impact_start"] = o.CustomerImpactStart.Get() + } + if o.CustomerImpacted != nil { + toSerialize["customer_impacted"] = o.CustomerImpacted + } + if o.Detected.IsSet() { + toSerialize["detected"] = o.Detected.Get() + } + if o.Fields != nil { + toSerialize["fields"] = o.Fields + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.NotificationHandles != nil { + toSerialize["notification_handles"] = o.NotificationHandles + } + if o.PostmortemId != nil { + toSerialize["postmortem_id"] = o.PostmortemId + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Resolved.IsSet() { + toSerialize["resolved"] = o.Resolved.Get() + } + if o.TimeToDetect != nil { + toSerialize["time_to_detect"] = o.TimeToDetect + } + if o.TimeToInternalResponse != nil { + toSerialize["time_to_internal_response"] = o.TimeToInternalResponse + } + if o.TimeToRepair != nil { + toSerialize["time_to_repair"] = o.TimeToRepair + } + if o.TimeToResolve != nil { + toSerialize["time_to_resolve"] = o.TimeToResolve + } + toSerialize["title"] = o.Title + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Title *string `json:"title"` + }{} + all := struct { + Created *time.Time `json:"created,omitempty"` + CustomerImpactDuration *int64 `json:"customer_impact_duration,omitempty"` + CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` + CustomerImpactScope common.NullableString `json:"customer_impact_scope,omitempty"` + CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` + CustomerImpacted *bool `json:"customer_impacted,omitempty"` + Detected common.NullableTime `json:"detected,omitempty"` + Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` + PostmortemId *string `json:"postmortem_id,omitempty"` + PublicId *int64 `json:"public_id,omitempty"` + Resolved common.NullableTime `json:"resolved,omitempty"` + TimeToDetect *int64 `json:"time_to_detect,omitempty"` + TimeToInternalResponse *int64 `json:"time_to_internal_response,omitempty"` + TimeToRepair *int64 `json:"time_to_repair,omitempty"` + TimeToResolve *int64 `json:"time_to_resolve,omitempty"` + Title string `json:"title"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Title == nil { + return fmt.Errorf("Required field title missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Created = all.Created + o.CustomerImpactDuration = all.CustomerImpactDuration + o.CustomerImpactEnd = all.CustomerImpactEnd + o.CustomerImpactScope = all.CustomerImpactScope + o.CustomerImpactStart = all.CustomerImpactStart + o.CustomerImpacted = all.CustomerImpacted + o.Detected = all.Detected + o.Fields = all.Fields + o.Modified = all.Modified + o.NotificationHandles = all.NotificationHandles + o.PostmortemId = all.PostmortemId + o.PublicId = all.PublicId + o.Resolved = all.Resolved + o.TimeToDetect = all.TimeToDetect + o.TimeToInternalResponse = all.TimeToInternalResponse + o.TimeToRepair = all.TimeToRepair + o.TimeToResolve = all.TimeToResolve + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_incident_response_data.go b/api/v2/datadog/model_incident_response_data.go new file mode 100644 index 00000000000..bb75a52531c --- /dev/null +++ b/api/v2/datadog/model_incident_response_data.go @@ -0,0 +1,238 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentResponseData Incident data from a response. +type IncidentResponseData struct { + // The incident's attributes from a response. + Attributes *IncidentResponseAttributes `json:"attributes,omitempty"` + // The incident's ID. + Id string `json:"id"` + // The incident's relationships from a response. + Relationships *IncidentResponseRelationships `json:"relationships,omitempty"` + // Incident resource type. + Type IncidentType `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{} +} + +// NewIncidentResponseData instantiates a new IncidentResponseData 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 NewIncidentResponseData(id string, typeVar IncidentType) *IncidentResponseData { + this := IncidentResponseData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentResponseDataWithDefaults instantiates a new IncidentResponseData 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 NewIncidentResponseDataWithDefaults() *IncidentResponseData { + this := IncidentResponseData{} + var typeVar IncidentType = INCIDENTTYPE_INCIDENTS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentResponseData) GetAttributes() IncidentResponseAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseData) GetAttributesOk() (*IncidentResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentResponseAttributes and assigns it to the Attributes field. +func (o *IncidentResponseData) SetAttributes(v IncidentResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentResponseData) 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 *IncidentResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentResponseData) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentResponseData) GetRelationships() IncidentResponseRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentResponseRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseData) GetRelationshipsOk() (*IncidentResponseRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentResponseData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentResponseRelationships and assigns it to the Relationships field. +func (o *IncidentResponseData) SetRelationships(v IncidentResponseRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentResponseData) GetType() IncidentType { + if o == nil { + var ret IncidentType + 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 *IncidentResponseData) GetTypeOk() (*IncidentType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentResponseData) SetType(v IncidentType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *IncidentType `json:"type"` + }{} + all := struct { + Attributes *IncidentResponseAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Relationships *IncidentResponseRelationships `json:"relationships,omitempty"` + Type IncidentType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_response_included_item.go b/api/v2/datadog/model_incident_response_included_item.go new file mode 100644 index 00000000000..269f454bd07 --- /dev/null +++ b/api/v2/datadog/model_incident_response_included_item.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentResponseIncludedItem - An object related to an incident that is included in the response. +type IncidentResponseIncludedItem struct { + User *User + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// UserAsIncidentResponseIncludedItem is a convenience function that returns User wrapped in IncidentResponseIncludedItem. +func UserAsIncidentResponseIncludedItem(v *User) IncidentResponseIncludedItem { + return IncidentResponseIncludedItem{User: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *IncidentResponseIncludedItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into User + err = json.Unmarshal(data, &obj.User) + if err == nil { + if obj.User != nil && obj.User.UnparsedObject == nil { + jsonUser, _ := json.Marshal(obj.User) + if string(jsonUser) == "{}" { // empty struct + obj.User = nil + } else { + match++ + } + } else { + obj.User = nil + } + } else { + obj.User = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.User = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj IncidentResponseIncludedItem) MarshalJSON() ([]byte, error) { + if obj.User != nil { + return json.Marshal(&obj.User) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *IncidentResponseIncludedItem) GetActualInstance() interface{} { + if obj.User != nil { + return obj.User + } + + // all schemas are nil + return nil +} + +// NullableIncidentResponseIncludedItem handles when a null is used for IncidentResponseIncludedItem. +type NullableIncidentResponseIncludedItem struct { + value *IncidentResponseIncludedItem + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentResponseIncludedItem) Get() *IncidentResponseIncludedItem { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentResponseIncludedItem) Set(val *IncidentResponseIncludedItem) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentResponseIncludedItem) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableIncidentResponseIncludedItem) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentResponseIncludedItem initializes the struct as if Set has been called. +func NewNullableIncidentResponseIncludedItem(val *IncidentResponseIncludedItem) *NullableIncidentResponseIncludedItem { + return &NullableIncidentResponseIncludedItem{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentResponseIncludedItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentResponseIncludedItem) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_response_meta.go b/api/v2/datadog/model_incident_response_meta.go new file mode 100644 index 00000000000..bd394d1060e --- /dev/null +++ b/api/v2/datadog/model_incident_response_meta.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentResponseMeta The metadata object containing pagination metadata. +type IncidentResponseMeta struct { + // Pagination properties. + Pagination *IncidentResponseMetaPagination `json:"pagination,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{} +} + +// NewIncidentResponseMeta instantiates a new IncidentResponseMeta 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 NewIncidentResponseMeta() *IncidentResponseMeta { + this := IncidentResponseMeta{} + return &this +} + +// NewIncidentResponseMetaWithDefaults instantiates a new IncidentResponseMeta 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 NewIncidentResponseMetaWithDefaults() *IncidentResponseMeta { + this := IncidentResponseMeta{} + return &this +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *IncidentResponseMeta) GetPagination() IncidentResponseMetaPagination { + if o == nil || o.Pagination == nil { + var ret IncidentResponseMetaPagination + return ret + } + return *o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseMeta) GetPaginationOk() (*IncidentResponseMetaPagination, bool) { + if o == nil || o.Pagination == nil { + return nil, false + } + return o.Pagination, true +} + +// HasPagination returns a boolean if a field has been set. +func (o *IncidentResponseMeta) HasPagination() bool { + if o != nil && o.Pagination != nil { + return true + } + + return false +} + +// SetPagination gets a reference to the given IncidentResponseMetaPagination and assigns it to the Pagination field. +func (o *IncidentResponseMeta) SetPagination(v IncidentResponseMetaPagination) { + o.Pagination = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Pagination != nil { + toSerialize["pagination"] = o.Pagination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Pagination *IncidentResponseMetaPagination `json:"pagination,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Pagination != nil && all.Pagination.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Pagination = all.Pagination + return nil +} diff --git a/api/v2/datadog/model_incident_response_meta_pagination.go b/api/v2/datadog/model_incident_response_meta_pagination.go new file mode 100644 index 00000000000..065cd99d92a --- /dev/null +++ b/api/v2/datadog/model_incident_response_meta_pagination.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentResponseMetaPagination Pagination properties. +type IncidentResponseMetaPagination struct { + // The index of the first element in the next page of results. Equal to page size added to the current offset. + NextOffset *int64 `json:"next_offset,omitempty"` + // The index of the first element in the results. + Offset *int64 `json:"offset,omitempty"` + // Maximum size of pages to return. + Size *int64 `json:"size,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{} +} + +// NewIncidentResponseMetaPagination instantiates a new IncidentResponseMetaPagination 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 NewIncidentResponseMetaPagination() *IncidentResponseMetaPagination { + this := IncidentResponseMetaPagination{} + return &this +} + +// NewIncidentResponseMetaPaginationWithDefaults instantiates a new IncidentResponseMetaPagination 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 NewIncidentResponseMetaPaginationWithDefaults() *IncidentResponseMetaPagination { + this := IncidentResponseMetaPagination{} + return &this +} + +// GetNextOffset returns the NextOffset field value if set, zero value otherwise. +func (o *IncidentResponseMetaPagination) GetNextOffset() int64 { + if o == nil || o.NextOffset == nil { + var ret int64 + return ret + } + return *o.NextOffset +} + +// GetNextOffsetOk returns a tuple with the NextOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseMetaPagination) GetNextOffsetOk() (*int64, bool) { + if o == nil || o.NextOffset == nil { + return nil, false + } + return o.NextOffset, true +} + +// HasNextOffset returns a boolean if a field has been set. +func (o *IncidentResponseMetaPagination) HasNextOffset() bool { + if o != nil && o.NextOffset != nil { + return true + } + + return false +} + +// SetNextOffset gets a reference to the given int64 and assigns it to the NextOffset field. +func (o *IncidentResponseMetaPagination) SetNextOffset(v int64) { + o.NextOffset = &v +} + +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *IncidentResponseMetaPagination) GetOffset() int64 { + if o == nil || o.Offset == nil { + var ret int64 + return ret + } + return *o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseMetaPagination) GetOffsetOk() (*int64, bool) { + if o == nil || o.Offset == nil { + return nil, false + } + return o.Offset, true +} + +// HasOffset returns a boolean if a field has been set. +func (o *IncidentResponseMetaPagination) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// SetOffset gets a reference to the given int64 and assigns it to the Offset field. +func (o *IncidentResponseMetaPagination) SetOffset(v int64) { + o.Offset = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *IncidentResponseMetaPagination) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseMetaPagination) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *IncidentResponseMetaPagination) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *IncidentResponseMetaPagination) SetSize(v int64) { + o.Size = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponseMetaPagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.NextOffset != nil { + toSerialize["next_offset"] = o.NextOffset + } + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponseMetaPagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + NextOffset *int64 `json:"next_offset,omitempty"` + Offset *int64 `json:"offset,omitempty"` + Size *int64 `json:"size,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.NextOffset = all.NextOffset + o.Offset = all.Offset + o.Size = all.Size + return nil +} diff --git a/api/v2/datadog/model_incident_response_relationships.go b/api/v2/datadog/model_incident_response_relationships.go new file mode 100644 index 00000000000..67274f7ad0e --- /dev/null +++ b/api/v2/datadog/model_incident_response_relationships.go @@ -0,0 +1,293 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentResponseRelationships The incident's relationships from a response. +type IncidentResponseRelationships struct { + // Relationship to user. + CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` + // Relationship to user. + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + // A relationship reference for multiple integration metadata objects. + Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` + // Relationship to user. + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + // A relationship reference for postmortems. + Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,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{} +} + +// NewIncidentResponseRelationships instantiates a new IncidentResponseRelationships 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 NewIncidentResponseRelationships() *IncidentResponseRelationships { + this := IncidentResponseRelationships{} + return &this +} + +// NewIncidentResponseRelationshipsWithDefaults instantiates a new IncidentResponseRelationships 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 NewIncidentResponseRelationshipsWithDefaults() *IncidentResponseRelationships { + this := IncidentResponseRelationships{} + return &this +} + +// GetCommanderUser returns the CommanderUser field value if set, zero value otherwise. +func (o *IncidentResponseRelationships) GetCommanderUser() NullableRelationshipToUser { + if o == nil || o.CommanderUser == nil { + var ret NullableRelationshipToUser + return ret + } + return *o.CommanderUser +} + +// GetCommanderUserOk returns a tuple with the CommanderUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseRelationships) GetCommanderUserOk() (*NullableRelationshipToUser, bool) { + if o == nil || o.CommanderUser == nil { + return nil, false + } + return o.CommanderUser, true +} + +// HasCommanderUser returns a boolean if a field has been set. +func (o *IncidentResponseRelationships) HasCommanderUser() bool { + if o != nil && o.CommanderUser != nil { + return true + } + + return false +} + +// SetCommanderUser gets a reference to the given NullableRelationshipToUser and assigns it to the CommanderUser field. +func (o *IncidentResponseRelationships) SetCommanderUser(v NullableRelationshipToUser) { + o.CommanderUser = &v +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *IncidentResponseRelationships) GetCreatedByUser() RelationshipToUser { + if o == nil || o.CreatedByUser == nil { + var ret RelationshipToUser + return ret + } + return *o.CreatedByUser +} + +// GetCreatedByUserOk returns a tuple with the CreatedByUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseRelationships) GetCreatedByUserOk() (*RelationshipToUser, bool) { + if o == nil || o.CreatedByUser == nil { + return nil, false + } + return o.CreatedByUser, true +} + +// HasCreatedByUser returns a boolean if a field has been set. +func (o *IncidentResponseRelationships) HasCreatedByUser() bool { + if o != nil && o.CreatedByUser != nil { + return true + } + + return false +} + +// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. +func (o *IncidentResponseRelationships) SetCreatedByUser(v RelationshipToUser) { + o.CreatedByUser = &v +} + +// GetIntegrations returns the Integrations field value if set, zero value otherwise. +func (o *IncidentResponseRelationships) GetIntegrations() RelationshipToIncidentIntegrationMetadatas { + if o == nil || o.Integrations == nil { + var ret RelationshipToIncidentIntegrationMetadatas + return ret + } + return *o.Integrations +} + +// GetIntegrationsOk returns a tuple with the Integrations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseRelationships) GetIntegrationsOk() (*RelationshipToIncidentIntegrationMetadatas, bool) { + if o == nil || o.Integrations == nil { + return nil, false + } + return o.Integrations, true +} + +// HasIntegrations returns a boolean if a field has been set. +func (o *IncidentResponseRelationships) HasIntegrations() bool { + if o != nil && o.Integrations != nil { + return true + } + + return false +} + +// SetIntegrations gets a reference to the given RelationshipToIncidentIntegrationMetadatas and assigns it to the Integrations field. +func (o *IncidentResponseRelationships) SetIntegrations(v RelationshipToIncidentIntegrationMetadatas) { + o.Integrations = &v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. +func (o *IncidentResponseRelationships) GetLastModifiedByUser() RelationshipToUser { + if o == nil || o.LastModifiedByUser == nil { + var ret RelationshipToUser + return ret + } + return *o.LastModifiedByUser +} + +// GetLastModifiedByUserOk returns a tuple with the LastModifiedByUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseRelationships) GetLastModifiedByUserOk() (*RelationshipToUser, bool) { + if o == nil || o.LastModifiedByUser == nil { + return nil, false + } + return o.LastModifiedByUser, true +} + +// HasLastModifiedByUser returns a boolean if a field has been set. +func (o *IncidentResponseRelationships) HasLastModifiedByUser() bool { + if o != nil && o.LastModifiedByUser != nil { + return true + } + + return false +} + +// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. +func (o *IncidentResponseRelationships) SetLastModifiedByUser(v RelationshipToUser) { + o.LastModifiedByUser = &v +} + +// GetPostmortem returns the Postmortem field value if set, zero value otherwise. +func (o *IncidentResponseRelationships) GetPostmortem() RelationshipToIncidentPostmortem { + if o == nil || o.Postmortem == nil { + var ret RelationshipToIncidentPostmortem + return ret + } + return *o.Postmortem +} + +// GetPostmortemOk returns a tuple with the Postmortem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponseRelationships) GetPostmortemOk() (*RelationshipToIncidentPostmortem, bool) { + if o == nil || o.Postmortem == nil { + return nil, false + } + return o.Postmortem, true +} + +// HasPostmortem returns a boolean if a field has been set. +func (o *IncidentResponseRelationships) HasPostmortem() bool { + if o != nil && o.Postmortem != nil { + return true + } + + return false +} + +// SetPostmortem gets a reference to the given RelationshipToIncidentPostmortem and assigns it to the Postmortem field. +func (o *IncidentResponseRelationships) SetPostmortem(v RelationshipToIncidentPostmortem) { + o.Postmortem = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponseRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CommanderUser != nil { + toSerialize["commander_user"] = o.CommanderUser + } + if o.CreatedByUser != nil { + toSerialize["created_by_user"] = o.CreatedByUser + } + if o.Integrations != nil { + toSerialize["integrations"] = o.Integrations + } + if o.LastModifiedByUser != nil { + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + } + if o.Postmortem != nil { + toSerialize["postmortem"] = o.Postmortem + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.CommanderUser != nil && all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CommanderUser = all.CommanderUser + if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CreatedByUser = all.CreatedByUser + if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Integrations = all.Integrations + if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LastModifiedByUser = all.LastModifiedByUser + if all.Postmortem != nil && all.Postmortem.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Postmortem = all.Postmortem + return nil +} diff --git a/api/v2/datadog/model_incident_service_create_attributes.go b/api/v2/datadog/model_incident_service_create_attributes.go new file mode 100644 index 00000000000..fd0b23f748e --- /dev/null +++ b/api/v2/datadog/model_incident_service_create_attributes.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceCreateAttributes The incident service's attributes for a create request. +type IncidentServiceCreateAttributes struct { + // Name of the incident service. + Name string `json:"name"` + // 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{} +} + +// NewIncidentServiceCreateAttributes instantiates a new IncidentServiceCreateAttributes 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 NewIncidentServiceCreateAttributes(name string) *IncidentServiceCreateAttributes { + this := IncidentServiceCreateAttributes{} + this.Name = name + return &this +} + +// NewIncidentServiceCreateAttributesWithDefaults instantiates a new IncidentServiceCreateAttributes 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 NewIncidentServiceCreateAttributesWithDefaults() *IncidentServiceCreateAttributes { + this := IncidentServiceCreateAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *IncidentServiceCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *IncidentServiceCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentServiceCreateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_incident_service_create_data.go b/api/v2/datadog/model_incident_service_create_data.go new file mode 100644 index 00000000000..54b9d33ca45 --- /dev/null +++ b/api/v2/datadog/model_incident_service_create_data.go @@ -0,0 +1,205 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceCreateData Incident Service payload for create requests. +type IncidentServiceCreateData struct { + // The incident service's attributes for a create request. + Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` + // The incident service's relationships. + Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` + // Incident service resource type. + Type IncidentServiceType `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{} +} + +// NewIncidentServiceCreateData instantiates a new IncidentServiceCreateData 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 NewIncidentServiceCreateData(typeVar IncidentServiceType) *IncidentServiceCreateData { + this := IncidentServiceCreateData{} + this.Type = typeVar + return &this +} + +// NewIncidentServiceCreateDataWithDefaults instantiates a new IncidentServiceCreateData 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 NewIncidentServiceCreateDataWithDefaults() *IncidentServiceCreateData { + this := IncidentServiceCreateData{} + var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentServiceCreateData) GetAttributes() IncidentServiceCreateAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentServiceCreateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceCreateData) GetAttributesOk() (*IncidentServiceCreateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentServiceCreateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentServiceCreateAttributes and assigns it to the Attributes field. +func (o *IncidentServiceCreateData) SetAttributes(v IncidentServiceCreateAttributes) { + o.Attributes = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentServiceCreateData) GetRelationships() IncidentServiceRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentServiceRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceCreateData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentServiceCreateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. +func (o *IncidentServiceCreateData) SetRelationships(v IncidentServiceRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentServiceCreateData) GetType() IncidentServiceType { + if o == nil { + var ret IncidentServiceType + 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 *IncidentServiceCreateData) GetTypeOk() (*IncidentServiceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentServiceCreateData) SetType(v IncidentServiceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *IncidentServiceType `json:"type"` + }{} + all := struct { + Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` + Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` + Type IncidentServiceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_service_create_request.go b/api/v2/datadog/model_incident_service_create_request.go new file mode 100644 index 00000000000..210c35064d7 --- /dev/null +++ b/api/v2/datadog/model_incident_service_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceCreateRequest Create request with an incident service payload. +type IncidentServiceCreateRequest struct { + // Incident Service payload for create requests. + Data IncidentServiceCreateData `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{} +} + +// NewIncidentServiceCreateRequest instantiates a new IncidentServiceCreateRequest 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 NewIncidentServiceCreateRequest(data IncidentServiceCreateData) *IncidentServiceCreateRequest { + this := IncidentServiceCreateRequest{} + this.Data = data + return &this +} + +// NewIncidentServiceCreateRequestWithDefaults instantiates a new IncidentServiceCreateRequest 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 NewIncidentServiceCreateRequestWithDefaults() *IncidentServiceCreateRequest { + this := IncidentServiceCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentServiceCreateRequest) GetData() IncidentServiceCreateData { + if o == nil { + var ret IncidentServiceCreateData + 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 *IncidentServiceCreateRequest) GetDataOk() (*IncidentServiceCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentServiceCreateRequest) SetData(v IncidentServiceCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentServiceCreateData `json:"data"` + }{} + all := struct { + Data IncidentServiceCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_incident_service_included_items.go b/api/v2/datadog/model_incident_service_included_items.go new file mode 100644 index 00000000000..06bd44c5d8a --- /dev/null +++ b/api/v2/datadog/model_incident_service_included_items.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentServiceIncludedItems - An object related to an incident service which is present in the included payload. +type IncidentServiceIncludedItems struct { + User *User + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// UserAsIncidentServiceIncludedItems is a convenience function that returns User wrapped in IncidentServiceIncludedItems. +func UserAsIncidentServiceIncludedItems(v *User) IncidentServiceIncludedItems { + return IncidentServiceIncludedItems{User: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *IncidentServiceIncludedItems) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into User + err = json.Unmarshal(data, &obj.User) + if err == nil { + if obj.User != nil && obj.User.UnparsedObject == nil { + jsonUser, _ := json.Marshal(obj.User) + if string(jsonUser) == "{}" { // empty struct + obj.User = nil + } else { + match++ + } + } else { + obj.User = nil + } + } else { + obj.User = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.User = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj IncidentServiceIncludedItems) MarshalJSON() ([]byte, error) { + if obj.User != nil { + return json.Marshal(&obj.User) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *IncidentServiceIncludedItems) GetActualInstance() interface{} { + if obj.User != nil { + return obj.User + } + + // all schemas are nil + return nil +} + +// NullableIncidentServiceIncludedItems handles when a null is used for IncidentServiceIncludedItems. +type NullableIncidentServiceIncludedItems struct { + value *IncidentServiceIncludedItems + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentServiceIncludedItems) Get() *IncidentServiceIncludedItems { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentServiceIncludedItems) Set(val *IncidentServiceIncludedItems) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentServiceIncludedItems) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableIncidentServiceIncludedItems) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentServiceIncludedItems initializes the struct as if Set has been called. +func NewNullableIncidentServiceIncludedItems(val *IncidentServiceIncludedItems) *NullableIncidentServiceIncludedItems { + return &NullableIncidentServiceIncludedItems{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentServiceIncludedItems) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentServiceIncludedItems) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_service_relationships.go b/api/v2/datadog/model_incident_service_relationships.go new file mode 100644 index 00000000000..09e7e3c2bc9 --- /dev/null +++ b/api/v2/datadog/model_incident_service_relationships.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentServiceRelationships The incident service's relationships. +type IncidentServiceRelationships struct { + // Relationship to user. + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + // Relationship to user. + LastModifiedBy *RelationshipToUser `json:"last_modified_by,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{} +} + +// NewIncidentServiceRelationships instantiates a new IncidentServiceRelationships 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 NewIncidentServiceRelationships() *IncidentServiceRelationships { + this := IncidentServiceRelationships{} + return &this +} + +// NewIncidentServiceRelationshipsWithDefaults instantiates a new IncidentServiceRelationships 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 NewIncidentServiceRelationshipsWithDefaults() *IncidentServiceRelationships { + this := IncidentServiceRelationships{} + return &this +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *IncidentServiceRelationships) GetCreatedBy() RelationshipToUser { + if o == nil || o.CreatedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *IncidentServiceRelationships) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. +func (o *IncidentServiceRelationships) SetCreatedBy(v RelationshipToUser) { + o.CreatedBy = &v +} + +// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. +func (o *IncidentServiceRelationships) GetLastModifiedBy() RelationshipToUser { + if o == nil || o.LastModifiedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.LastModifiedBy +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceRelationships) GetLastModifiedByOk() (*RelationshipToUser, bool) { + if o == nil || o.LastModifiedBy == nil { + return nil, false + } + return o.LastModifiedBy, true +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *IncidentServiceRelationships) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// SetLastModifiedBy gets a reference to the given RelationshipToUser and assigns it to the LastModifiedBy field. +func (o *IncidentServiceRelationships) SetLastModifiedBy(v RelationshipToUser) { + o.LastModifiedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.LastModifiedBy != nil { + toSerialize["last_modified_by"] = o.LastModifiedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CreatedBy = all.CreatedBy + if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LastModifiedBy = all.LastModifiedBy + return nil +} diff --git a/api/v2/datadog/model_incident_service_response.go b/api/v2/datadog/model_incident_service_response.go new file mode 100644 index 00000000000..af6ea8b5780 --- /dev/null +++ b/api/v2/datadog/model_incident_service_response.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceResponse Response with an incident service payload. +type IncidentServiceResponse struct { + // Incident Service data from responses. + Data IncidentServiceResponseData `json:"data"` + // Included objects from relationships. + Included []IncidentServiceIncludedItems `json:"included,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{} +} + +// NewIncidentServiceResponse instantiates a new IncidentServiceResponse 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 NewIncidentServiceResponse(data IncidentServiceResponseData) *IncidentServiceResponse { + this := IncidentServiceResponse{} + this.Data = data + return &this +} + +// NewIncidentServiceResponseWithDefaults instantiates a new IncidentServiceResponse 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 NewIncidentServiceResponseWithDefaults() *IncidentServiceResponse { + this := IncidentServiceResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentServiceResponse) GetData() IncidentServiceResponseData { + if o == nil { + var ret IncidentServiceResponseData + 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 *IncidentServiceResponse) GetDataOk() (*IncidentServiceResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentServiceResponse) SetData(v IncidentServiceResponseData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentServiceResponse) GetIncluded() []IncidentServiceIncludedItems { + if o == nil || o.Included == nil { + var ret []IncidentServiceIncludedItems + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceResponse) GetIncludedOk() (*[]IncidentServiceIncludedItems, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentServiceResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []IncidentServiceIncludedItems and assigns it to the Included field. +func (o *IncidentServiceResponse) SetIncluded(v []IncidentServiceIncludedItems) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentServiceResponseData `json:"data"` + }{} + all := struct { + Data IncidentServiceResponseData `json:"data"` + Included []IncidentServiceIncludedItems `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_incident_service_response_attributes.go b/api/v2/datadog/model_incident_service_response_attributes.go new file mode 100644 index 00000000000..f5a0a0ece44 --- /dev/null +++ b/api/v2/datadog/model_incident_service_response_attributes.go @@ -0,0 +1,189 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// IncidentServiceResponseAttributes The incident service's attributes from a response. +type IncidentServiceResponseAttributes struct { + // Timestamp of when the incident service was created. + Created *time.Time `json:"created,omitempty"` + // Timestamp of when the incident service was modified. + Modified *time.Time `json:"modified,omitempty"` + // Name of the incident service. + Name *string `json:"name,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{} +} + +// NewIncidentServiceResponseAttributes instantiates a new IncidentServiceResponseAttributes 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 NewIncidentServiceResponseAttributes() *IncidentServiceResponseAttributes { + this := IncidentServiceResponseAttributes{} + return &this +} + +// NewIncidentServiceResponseAttributesWithDefaults instantiates a new IncidentServiceResponseAttributes 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 NewIncidentServiceResponseAttributesWithDefaults() *IncidentServiceResponseAttributes { + this := IncidentServiceResponseAttributes{} + return &this +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *IncidentServiceResponseAttributes) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceResponseAttributes) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *IncidentServiceResponseAttributes) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *IncidentServiceResponseAttributes) SetCreated(v time.Time) { + o.Created = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *IncidentServiceResponseAttributes) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceResponseAttributes) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *IncidentServiceResponseAttributes) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *IncidentServiceResponseAttributes) SetModified(v time.Time) { + o.Modified = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *IncidentServiceResponseAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceResponseAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *IncidentServiceResponseAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *IncidentServiceResponseAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Created *time.Time `json:"created,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Created = all.Created + o.Modified = all.Modified + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_incident_service_response_data.go b/api/v2/datadog/model_incident_service_response_data.go new file mode 100644 index 00000000000..24ba11ef559 --- /dev/null +++ b/api/v2/datadog/model_incident_service_response_data.go @@ -0,0 +1,238 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceResponseData Incident Service data from responses. +type IncidentServiceResponseData struct { + // The incident service's attributes from a response. + Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` + // The incident service's ID. + Id string `json:"id"` + // The incident service's relationships. + Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` + // Incident service resource type. + Type IncidentServiceType `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{} +} + +// NewIncidentServiceResponseData instantiates a new IncidentServiceResponseData 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 NewIncidentServiceResponseData(id string, typeVar IncidentServiceType) *IncidentServiceResponseData { + this := IncidentServiceResponseData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentServiceResponseDataWithDefaults instantiates a new IncidentServiceResponseData 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 NewIncidentServiceResponseDataWithDefaults() *IncidentServiceResponseData { + this := IncidentServiceResponseData{} + var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentServiceResponseData) GetAttributes() IncidentServiceResponseAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentServiceResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceResponseData) GetAttributesOk() (*IncidentServiceResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentServiceResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentServiceResponseAttributes and assigns it to the Attributes field. +func (o *IncidentServiceResponseData) SetAttributes(v IncidentServiceResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentServiceResponseData) 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 *IncidentServiceResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentServiceResponseData) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentServiceResponseData) GetRelationships() IncidentServiceRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentServiceRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceResponseData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentServiceResponseData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. +func (o *IncidentServiceResponseData) SetRelationships(v IncidentServiceRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentServiceResponseData) GetType() IncidentServiceType { + if o == nil { + var ret IncidentServiceType + 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 *IncidentServiceResponseData) GetTypeOk() (*IncidentServiceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentServiceResponseData) SetType(v IncidentServiceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *IncidentServiceType `json:"type"` + }{} + all := struct { + Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` + Type IncidentServiceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_service_type.go b/api/v2/datadog/model_incident_service_type.go new file mode 100644 index 00000000000..d68f45d0ca7 --- /dev/null +++ b/api/v2/datadog/model_incident_service_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceType Incident service resource type. +type IncidentServiceType string + +// List of IncidentServiceType. +const ( + INCIDENTSERVICETYPE_SERVICES IncidentServiceType = "services" +) + +var allowedIncidentServiceTypeEnumValues = []IncidentServiceType{ + INCIDENTSERVICETYPE_SERVICES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentServiceType) GetAllowedValues() []IncidentServiceType { + return allowedIncidentServiceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentServiceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentServiceType(value) + return nil +} + +// NewIncidentServiceTypeFromValue returns a pointer to a valid IncidentServiceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentServiceTypeFromValue(v string) (*IncidentServiceType, error) { + ev := IncidentServiceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentServiceType: valid values are %v", v, allowedIncidentServiceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentServiceType) IsValid() bool { + for _, existing := range allowedIncidentServiceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentServiceType value. +func (v IncidentServiceType) Ptr() *IncidentServiceType { + return &v +} + +// NullableIncidentServiceType handles when a null is used for IncidentServiceType. +type NullableIncidentServiceType struct { + value *IncidentServiceType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentServiceType) Get() *IncidentServiceType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentServiceType) Set(val *IncidentServiceType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentServiceType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentServiceType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentServiceType initializes the struct as if Set has been called. +func NewNullableIncidentServiceType(val *IncidentServiceType) *NullableIncidentServiceType { + return &NullableIncidentServiceType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentServiceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentServiceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_service_update_attributes.go b/api/v2/datadog/model_incident_service_update_attributes.go new file mode 100644 index 00000000000..d58f996c20e --- /dev/null +++ b/api/v2/datadog/model_incident_service_update_attributes.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceUpdateAttributes The incident service's attributes for an update request. +type IncidentServiceUpdateAttributes struct { + // Name of the incident service. + Name string `json:"name"` + // 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{} +} + +// NewIncidentServiceUpdateAttributes instantiates a new IncidentServiceUpdateAttributes 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 NewIncidentServiceUpdateAttributes(name string) *IncidentServiceUpdateAttributes { + this := IncidentServiceUpdateAttributes{} + this.Name = name + return &this +} + +// NewIncidentServiceUpdateAttributesWithDefaults instantiates a new IncidentServiceUpdateAttributes 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 NewIncidentServiceUpdateAttributesWithDefaults() *IncidentServiceUpdateAttributes { + this := IncidentServiceUpdateAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *IncidentServiceUpdateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *IncidentServiceUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentServiceUpdateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_incident_service_update_data.go b/api/v2/datadog/model_incident_service_update_data.go new file mode 100644 index 00000000000..d22a48d1347 --- /dev/null +++ b/api/v2/datadog/model_incident_service_update_data.go @@ -0,0 +1,244 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceUpdateData Incident Service payload for update requests. +type IncidentServiceUpdateData struct { + // The incident service's attributes for an update request. + Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` + // The incident service's ID. + Id *string `json:"id,omitempty"` + // The incident service's relationships. + Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` + // Incident service resource type. + Type IncidentServiceType `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{} +} + +// NewIncidentServiceUpdateData instantiates a new IncidentServiceUpdateData 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 NewIncidentServiceUpdateData(typeVar IncidentServiceType) *IncidentServiceUpdateData { + this := IncidentServiceUpdateData{} + this.Type = typeVar + return &this +} + +// NewIncidentServiceUpdateDataWithDefaults instantiates a new IncidentServiceUpdateData 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 NewIncidentServiceUpdateDataWithDefaults() *IncidentServiceUpdateData { + this := IncidentServiceUpdateData{} + var typeVar IncidentServiceType = INCIDENTSERVICETYPE_SERVICES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentServiceUpdateData) GetAttributes() IncidentServiceUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentServiceUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceUpdateData) GetAttributesOk() (*IncidentServiceUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentServiceUpdateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentServiceUpdateAttributes and assigns it to the Attributes field. +func (o *IncidentServiceUpdateData) SetAttributes(v IncidentServiceUpdateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IncidentServiceUpdateData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceUpdateData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IncidentServiceUpdateData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IncidentServiceUpdateData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentServiceUpdateData) GetRelationships() IncidentServiceRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentServiceRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceUpdateData) GetRelationshipsOk() (*IncidentServiceRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentServiceUpdateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentServiceRelationships and assigns it to the Relationships field. +func (o *IncidentServiceUpdateData) SetRelationships(v IncidentServiceRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentServiceUpdateData) GetType() IncidentServiceType { + if o == nil { + var ret IncidentServiceType + 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 *IncidentServiceUpdateData) GetTypeOk() (*IncidentServiceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentServiceUpdateData) SetType(v IncidentServiceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *IncidentServiceType `json:"type"` + }{} + all := struct { + Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` + Type IncidentServiceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_service_update_request.go b/api/v2/datadog/model_incident_service_update_request.go new file mode 100644 index 00000000000..0300f16b4ba --- /dev/null +++ b/api/v2/datadog/model_incident_service_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServiceUpdateRequest Update request with an incident service payload. +type IncidentServiceUpdateRequest struct { + // Incident Service payload for update requests. + Data IncidentServiceUpdateData `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{} +} + +// NewIncidentServiceUpdateRequest instantiates a new IncidentServiceUpdateRequest 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 NewIncidentServiceUpdateRequest(data IncidentServiceUpdateData) *IncidentServiceUpdateRequest { + this := IncidentServiceUpdateRequest{} + this.Data = data + return &this +} + +// NewIncidentServiceUpdateRequestWithDefaults instantiates a new IncidentServiceUpdateRequest 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 NewIncidentServiceUpdateRequestWithDefaults() *IncidentServiceUpdateRequest { + this := IncidentServiceUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentServiceUpdateRequest) GetData() IncidentServiceUpdateData { + if o == nil { + var ret IncidentServiceUpdateData + 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 *IncidentServiceUpdateRequest) GetDataOk() (*IncidentServiceUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentServiceUpdateRequest) SetData(v IncidentServiceUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentServiceUpdateData `json:"data"` + }{} + all := struct { + Data IncidentServiceUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_incident_services_response.go b/api/v2/datadog/model_incident_services_response.go new file mode 100644 index 00000000000..10766419975 --- /dev/null +++ b/api/v2/datadog/model_incident_services_response.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentServicesResponse Response with a list of incident service payloads. +type IncidentServicesResponse struct { + // An array of incident services. + Data []IncidentServiceResponseData `json:"data"` + // Included related resources which the user requested. + Included []IncidentServiceIncludedItems `json:"included,omitempty"` + // The metadata object containing pagination metadata. + Meta *IncidentResponseMeta `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{} +} + +// NewIncidentServicesResponse instantiates a new IncidentServicesResponse 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 NewIncidentServicesResponse(data []IncidentServiceResponseData) *IncidentServicesResponse { + this := IncidentServicesResponse{} + this.Data = data + return &this +} + +// NewIncidentServicesResponseWithDefaults instantiates a new IncidentServicesResponse 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 NewIncidentServicesResponseWithDefaults() *IncidentServicesResponse { + this := IncidentServicesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentServicesResponse) GetData() []IncidentServiceResponseData { + if o == nil { + var ret []IncidentServiceResponseData + 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 *IncidentServicesResponse) GetDataOk() (*[]IncidentServiceResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentServicesResponse) SetData(v []IncidentServiceResponseData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentServicesResponse) GetIncluded() []IncidentServiceIncludedItems { + if o == nil || o.Included == nil { + var ret []IncidentServiceIncludedItems + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServicesResponse) GetIncludedOk() (*[]IncidentServiceIncludedItems, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentServicesResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []IncidentServiceIncludedItems and assigns it to the Included field. +func (o *IncidentServicesResponse) SetIncluded(v []IncidentServiceIncludedItems) { + o.Included = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *IncidentServicesResponse) GetMeta() IncidentResponseMeta { + if o == nil || o.Meta == nil { + var ret IncidentResponseMeta + 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 *IncidentServicesResponse) GetMetaOk() (*IncidentResponseMeta, 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 *IncidentServicesResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given IncidentResponseMeta and assigns it to the Meta field. +func (o *IncidentServicesResponse) SetMeta(v IncidentResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServicesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServicesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]IncidentServiceResponseData `json:"data"` + }{} + all := struct { + Data []IncidentServiceResponseData `json:"data"` + Included []IncidentServiceIncludedItems `json:"included,omitempty"` + Meta *IncidentResponseMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Included = all.Included + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_incident_team_create_attributes.go b/api/v2/datadog/model_incident_team_create_attributes.go new file mode 100644 index 00000000000..caa27103081 --- /dev/null +++ b/api/v2/datadog/model_incident_team_create_attributes.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamCreateAttributes The incident team's attributes for a create request. +type IncidentTeamCreateAttributes struct { + // Name of the incident team. + Name string `json:"name"` + // 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{} +} + +// NewIncidentTeamCreateAttributes instantiates a new IncidentTeamCreateAttributes 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 NewIncidentTeamCreateAttributes(name string) *IncidentTeamCreateAttributes { + this := IncidentTeamCreateAttributes{} + this.Name = name + return &this +} + +// NewIncidentTeamCreateAttributesWithDefaults instantiates a new IncidentTeamCreateAttributes 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 NewIncidentTeamCreateAttributesWithDefaults() *IncidentTeamCreateAttributes { + this := IncidentTeamCreateAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *IncidentTeamCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *IncidentTeamCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentTeamCreateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_incident_team_create_data.go b/api/v2/datadog/model_incident_team_create_data.go new file mode 100644 index 00000000000..e8e5e2cda50 --- /dev/null +++ b/api/v2/datadog/model_incident_team_create_data.go @@ -0,0 +1,205 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamCreateData Incident Team data for a create request. +type IncidentTeamCreateData struct { + // The incident team's attributes for a create request. + Attributes *IncidentTeamCreateAttributes `json:"attributes,omitempty"` + // The incident team's relationships. + Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` + // Incident Team resource type. + Type IncidentTeamType `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{} +} + +// NewIncidentTeamCreateData instantiates a new IncidentTeamCreateData 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 NewIncidentTeamCreateData(typeVar IncidentTeamType) *IncidentTeamCreateData { + this := IncidentTeamCreateData{} + this.Type = typeVar + return &this +} + +// NewIncidentTeamCreateDataWithDefaults instantiates a new IncidentTeamCreateData 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 NewIncidentTeamCreateDataWithDefaults() *IncidentTeamCreateData { + this := IncidentTeamCreateData{} + var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentTeamCreateData) GetAttributes() IncidentTeamCreateAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentTeamCreateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamCreateData) GetAttributesOk() (*IncidentTeamCreateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentTeamCreateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentTeamCreateAttributes and assigns it to the Attributes field. +func (o *IncidentTeamCreateData) SetAttributes(v IncidentTeamCreateAttributes) { + o.Attributes = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentTeamCreateData) GetRelationships() IncidentTeamRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentTeamRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamCreateData) GetRelationshipsOk() (*IncidentTeamRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentTeamCreateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentTeamRelationships and assigns it to the Relationships field. +func (o *IncidentTeamCreateData) SetRelationships(v IncidentTeamRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentTeamCreateData) GetType() IncidentTeamType { + if o == nil { + var ret IncidentTeamType + 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 *IncidentTeamCreateData) GetTypeOk() (*IncidentTeamType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTeamCreateData) SetType(v IncidentTeamType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *IncidentTeamType `json:"type"` + }{} + all := struct { + Attributes *IncidentTeamCreateAttributes `json:"attributes,omitempty"` + Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` + Type IncidentTeamType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_team_create_request.go b/api/v2/datadog/model_incident_team_create_request.go new file mode 100644 index 00000000000..0362d2cdf85 --- /dev/null +++ b/api/v2/datadog/model_incident_team_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamCreateRequest Create request with an incident team payload. +type IncidentTeamCreateRequest struct { + // Incident Team data for a create request. + Data IncidentTeamCreateData `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{} +} + +// NewIncidentTeamCreateRequest instantiates a new IncidentTeamCreateRequest 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 NewIncidentTeamCreateRequest(data IncidentTeamCreateData) *IncidentTeamCreateRequest { + this := IncidentTeamCreateRequest{} + this.Data = data + return &this +} + +// NewIncidentTeamCreateRequestWithDefaults instantiates a new IncidentTeamCreateRequest 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 NewIncidentTeamCreateRequestWithDefaults() *IncidentTeamCreateRequest { + this := IncidentTeamCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTeamCreateRequest) GetData() IncidentTeamCreateData { + if o == nil { + var ret IncidentTeamCreateData + 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 *IncidentTeamCreateRequest) GetDataOk() (*IncidentTeamCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTeamCreateRequest) SetData(v IncidentTeamCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentTeamCreateData `json:"data"` + }{} + all := struct { + Data IncidentTeamCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_incident_team_included_items.go b/api/v2/datadog/model_incident_team_included_items.go new file mode 100644 index 00000000000..33f5de81b35 --- /dev/null +++ b/api/v2/datadog/model_incident_team_included_items.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentTeamIncludedItems - An object related to an incident team which is present in the included payload. +type IncidentTeamIncludedItems struct { + User *User + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// UserAsIncidentTeamIncludedItems is a convenience function that returns User wrapped in IncidentTeamIncludedItems. +func UserAsIncidentTeamIncludedItems(v *User) IncidentTeamIncludedItems { + return IncidentTeamIncludedItems{User: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *IncidentTeamIncludedItems) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into User + err = json.Unmarshal(data, &obj.User) + if err == nil { + if obj.User != nil && obj.User.UnparsedObject == nil { + jsonUser, _ := json.Marshal(obj.User) + if string(jsonUser) == "{}" { // empty struct + obj.User = nil + } else { + match++ + } + } else { + obj.User = nil + } + } else { + obj.User = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.User = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj IncidentTeamIncludedItems) MarshalJSON() ([]byte, error) { + if obj.User != nil { + return json.Marshal(&obj.User) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *IncidentTeamIncludedItems) GetActualInstance() interface{} { + if obj.User != nil { + return obj.User + } + + // all schemas are nil + return nil +} + +// NullableIncidentTeamIncludedItems handles when a null is used for IncidentTeamIncludedItems. +type NullableIncidentTeamIncludedItems struct { + value *IncidentTeamIncludedItems + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentTeamIncludedItems) Get() *IncidentTeamIncludedItems { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentTeamIncludedItems) Set(val *IncidentTeamIncludedItems) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentTeamIncludedItems) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableIncidentTeamIncludedItems) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentTeamIncludedItems initializes the struct as if Set has been called. +func NewNullableIncidentTeamIncludedItems(val *IncidentTeamIncludedItems) *NullableIncidentTeamIncludedItems { + return &NullableIncidentTeamIncludedItems{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentTeamIncludedItems) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentTeamIncludedItems) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_team_relationships.go b/api/v2/datadog/model_incident_team_relationships.go new file mode 100644 index 00000000000..c4235c9e7d3 --- /dev/null +++ b/api/v2/datadog/model_incident_team_relationships.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentTeamRelationships The incident team's relationships. +type IncidentTeamRelationships struct { + // Relationship to user. + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + // Relationship to user. + LastModifiedBy *RelationshipToUser `json:"last_modified_by,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{} +} + +// NewIncidentTeamRelationships instantiates a new IncidentTeamRelationships 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 NewIncidentTeamRelationships() *IncidentTeamRelationships { + this := IncidentTeamRelationships{} + return &this +} + +// NewIncidentTeamRelationshipsWithDefaults instantiates a new IncidentTeamRelationships 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 NewIncidentTeamRelationshipsWithDefaults() *IncidentTeamRelationships { + this := IncidentTeamRelationships{} + return &this +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *IncidentTeamRelationships) GetCreatedBy() RelationshipToUser { + if o == nil || o.CreatedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *IncidentTeamRelationships) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. +func (o *IncidentTeamRelationships) SetCreatedBy(v RelationshipToUser) { + o.CreatedBy = &v +} + +// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. +func (o *IncidentTeamRelationships) GetLastModifiedBy() RelationshipToUser { + if o == nil || o.LastModifiedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.LastModifiedBy +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamRelationships) GetLastModifiedByOk() (*RelationshipToUser, bool) { + if o == nil || o.LastModifiedBy == nil { + return nil, false + } + return o.LastModifiedBy, true +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *IncidentTeamRelationships) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// SetLastModifiedBy gets a reference to the given RelationshipToUser and assigns it to the LastModifiedBy field. +func (o *IncidentTeamRelationships) SetLastModifiedBy(v RelationshipToUser) { + o.LastModifiedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.LastModifiedBy != nil { + toSerialize["last_modified_by"] = o.LastModifiedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CreatedBy = all.CreatedBy + if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.LastModifiedBy = all.LastModifiedBy + return nil +} diff --git a/api/v2/datadog/model_incident_team_response.go b/api/v2/datadog/model_incident_team_response.go new file mode 100644 index 00000000000..2584786ac4a --- /dev/null +++ b/api/v2/datadog/model_incident_team_response.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamResponse Response with an incident team payload. +type IncidentTeamResponse struct { + // Incident Team data from a response. + Data IncidentTeamResponseData `json:"data"` + // Included objects from relationships. + Included []IncidentTeamIncludedItems `json:"included,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{} +} + +// NewIncidentTeamResponse instantiates a new IncidentTeamResponse 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 NewIncidentTeamResponse(data IncidentTeamResponseData) *IncidentTeamResponse { + this := IncidentTeamResponse{} + this.Data = data + return &this +} + +// NewIncidentTeamResponseWithDefaults instantiates a new IncidentTeamResponse 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 NewIncidentTeamResponseWithDefaults() *IncidentTeamResponse { + this := IncidentTeamResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTeamResponse) GetData() IncidentTeamResponseData { + if o == nil { + var ret IncidentTeamResponseData + 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 *IncidentTeamResponse) GetDataOk() (*IncidentTeamResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTeamResponse) SetData(v IncidentTeamResponseData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentTeamResponse) GetIncluded() []IncidentTeamIncludedItems { + if o == nil || o.Included == nil { + var ret []IncidentTeamIncludedItems + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponse) GetIncludedOk() (*[]IncidentTeamIncludedItems, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentTeamResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []IncidentTeamIncludedItems and assigns it to the Included field. +func (o *IncidentTeamResponse) SetIncluded(v []IncidentTeamIncludedItems) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentTeamResponseData `json:"data"` + }{} + all := struct { + Data IncidentTeamResponseData `json:"data"` + Included []IncidentTeamIncludedItems `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_incident_team_response_attributes.go b/api/v2/datadog/model_incident_team_response_attributes.go new file mode 100644 index 00000000000..e09e197af5a --- /dev/null +++ b/api/v2/datadog/model_incident_team_response_attributes.go @@ -0,0 +1,189 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// IncidentTeamResponseAttributes The incident team's attributes from a response. +type IncidentTeamResponseAttributes struct { + // Timestamp of when the incident team was created. + Created *time.Time `json:"created,omitempty"` + // Timestamp of when the incident team was modified. + Modified *time.Time `json:"modified,omitempty"` + // Name of the incident team. + Name *string `json:"name,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{} +} + +// NewIncidentTeamResponseAttributes instantiates a new IncidentTeamResponseAttributes 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 NewIncidentTeamResponseAttributes() *IncidentTeamResponseAttributes { + this := IncidentTeamResponseAttributes{} + return &this +} + +// NewIncidentTeamResponseAttributesWithDefaults instantiates a new IncidentTeamResponseAttributes 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 NewIncidentTeamResponseAttributesWithDefaults() *IncidentTeamResponseAttributes { + this := IncidentTeamResponseAttributes{} + return &this +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *IncidentTeamResponseAttributes) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponseAttributes) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *IncidentTeamResponseAttributes) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *IncidentTeamResponseAttributes) SetCreated(v time.Time) { + o.Created = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *IncidentTeamResponseAttributes) GetModified() time.Time { + if o == nil || o.Modified == nil { + var ret time.Time + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponseAttributes) GetModifiedOk() (*time.Time, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *IncidentTeamResponseAttributes) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *IncidentTeamResponseAttributes) SetModified(v time.Time) { + o.Modified = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *IncidentTeamResponseAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponseAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *IncidentTeamResponseAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *IncidentTeamResponseAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Modified != nil { + if o.Modified.Nanosecond() == 0 { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Created *time.Time `json:"created,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Created = all.Created + o.Modified = all.Modified + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_incident_team_response_data.go b/api/v2/datadog/model_incident_team_response_data.go new file mode 100644 index 00000000000..4c15a3ea4d2 --- /dev/null +++ b/api/v2/datadog/model_incident_team_response_data.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentTeamResponseData Incident Team data from a response. +type IncidentTeamResponseData struct { + // The incident team's attributes from a response. + Attributes *IncidentTeamResponseAttributes `json:"attributes,omitempty"` + // The incident team's ID. + Id *string `json:"id,omitempty"` + // The incident team's relationships. + Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` + // Incident Team resource type. + Type *IncidentTeamType `json:"type,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{} +} + +// NewIncidentTeamResponseData instantiates a new IncidentTeamResponseData 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 NewIncidentTeamResponseData() *IncidentTeamResponseData { + this := IncidentTeamResponseData{} + var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS + this.Type = &typeVar + return &this +} + +// NewIncidentTeamResponseDataWithDefaults instantiates a new IncidentTeamResponseData 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 NewIncidentTeamResponseDataWithDefaults() *IncidentTeamResponseData { + this := IncidentTeamResponseData{} + var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentTeamResponseData) GetAttributes() IncidentTeamResponseAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentTeamResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponseData) GetAttributesOk() (*IncidentTeamResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentTeamResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentTeamResponseAttributes and assigns it to the Attributes field. +func (o *IncidentTeamResponseData) SetAttributes(v IncidentTeamResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IncidentTeamResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IncidentTeamResponseData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IncidentTeamResponseData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentTeamResponseData) GetRelationships() IncidentTeamRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentTeamRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponseData) GetRelationshipsOk() (*IncidentTeamRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentTeamResponseData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentTeamRelationships and assigns it to the Relationships field. +func (o *IncidentTeamResponseData) SetRelationships(v IncidentTeamRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *IncidentTeamResponseData) GetType() IncidentTeamType { + if o == nil || o.Type == nil { + var ret IncidentTeamType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamResponseData) GetTypeOk() (*IncidentTeamType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *IncidentTeamResponseData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given IncidentTeamType and assigns it to the Type field. +func (o *IncidentTeamResponseData) SetType(v IncidentTeamType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *IncidentTeamResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` + Type *IncidentTeamType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_team_type.go b/api/v2/datadog/model_incident_team_type.go new file mode 100644 index 00000000000..ea35b94dbd6 --- /dev/null +++ b/api/v2/datadog/model_incident_team_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamType Incident Team resource type. +type IncidentTeamType string + +// List of IncidentTeamType. +const ( + INCIDENTTEAMTYPE_TEAMS IncidentTeamType = "teams" +) + +var allowedIncidentTeamTypeEnumValues = []IncidentTeamType{ + INCIDENTTEAMTYPE_TEAMS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentTeamType) GetAllowedValues() []IncidentTeamType { + return allowedIncidentTeamTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentTeamType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentTeamType(value) + return nil +} + +// NewIncidentTeamTypeFromValue returns a pointer to a valid IncidentTeamType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentTeamTypeFromValue(v string) (*IncidentTeamType, error) { + ev := IncidentTeamType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentTeamType: valid values are %v", v, allowedIncidentTeamTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentTeamType) IsValid() bool { + for _, existing := range allowedIncidentTeamTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentTeamType value. +func (v IncidentTeamType) Ptr() *IncidentTeamType { + return &v +} + +// NullableIncidentTeamType handles when a null is used for IncidentTeamType. +type NullableIncidentTeamType struct { + value *IncidentTeamType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentTeamType) Get() *IncidentTeamType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentTeamType) Set(val *IncidentTeamType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentTeamType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentTeamType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentTeamType initializes the struct as if Set has been called. +func NewNullableIncidentTeamType(val *IncidentTeamType) *NullableIncidentTeamType { + return &NullableIncidentTeamType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentTeamType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentTeamType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_team_update_attributes.go b/api/v2/datadog/model_incident_team_update_attributes.go new file mode 100644 index 00000000000..46b5951e22b --- /dev/null +++ b/api/v2/datadog/model_incident_team_update_attributes.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamUpdateAttributes The incident team's attributes for an update request. +type IncidentTeamUpdateAttributes struct { + // Name of the incident team. + Name string `json:"name"` + // 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{} +} + +// NewIncidentTeamUpdateAttributes instantiates a new IncidentTeamUpdateAttributes 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 NewIncidentTeamUpdateAttributes(name string) *IncidentTeamUpdateAttributes { + this := IncidentTeamUpdateAttributes{} + this.Name = name + return &this +} + +// NewIncidentTeamUpdateAttributesWithDefaults instantiates a new IncidentTeamUpdateAttributes 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 NewIncidentTeamUpdateAttributesWithDefaults() *IncidentTeamUpdateAttributes { + this := IncidentTeamUpdateAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *IncidentTeamUpdateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *IncidentTeamUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentTeamUpdateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_incident_team_update_data.go b/api/v2/datadog/model_incident_team_update_data.go new file mode 100644 index 00000000000..15541d76c59 --- /dev/null +++ b/api/v2/datadog/model_incident_team_update_data.go @@ -0,0 +1,244 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamUpdateData Incident Team data for an update request. +type IncidentTeamUpdateData struct { + // The incident team's attributes for an update request. + Attributes *IncidentTeamUpdateAttributes `json:"attributes,omitempty"` + // The incident team's ID. + Id *string `json:"id,omitempty"` + // The incident team's relationships. + Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` + // Incident Team resource type. + Type IncidentTeamType `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{} +} + +// NewIncidentTeamUpdateData instantiates a new IncidentTeamUpdateData 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 NewIncidentTeamUpdateData(typeVar IncidentTeamType) *IncidentTeamUpdateData { + this := IncidentTeamUpdateData{} + this.Type = typeVar + return &this +} + +// NewIncidentTeamUpdateDataWithDefaults instantiates a new IncidentTeamUpdateData 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 NewIncidentTeamUpdateDataWithDefaults() *IncidentTeamUpdateData { + this := IncidentTeamUpdateData{} + var typeVar IncidentTeamType = INCIDENTTEAMTYPE_TEAMS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentTeamUpdateData) GetAttributes() IncidentTeamUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentTeamUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamUpdateData) GetAttributesOk() (*IncidentTeamUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentTeamUpdateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentTeamUpdateAttributes and assigns it to the Attributes field. +func (o *IncidentTeamUpdateData) SetAttributes(v IncidentTeamUpdateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IncidentTeamUpdateData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamUpdateData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IncidentTeamUpdateData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IncidentTeamUpdateData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentTeamUpdateData) GetRelationships() IncidentTeamRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentTeamRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamUpdateData) GetRelationshipsOk() (*IncidentTeamRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentTeamUpdateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentTeamRelationships and assigns it to the Relationships field. +func (o *IncidentTeamUpdateData) SetRelationships(v IncidentTeamRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentTeamUpdateData) GetType() IncidentTeamType { + if o == nil { + var ret IncidentTeamType + 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 *IncidentTeamUpdateData) GetTypeOk() (*IncidentTeamType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTeamUpdateData) SetType(v IncidentTeamType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *IncidentTeamType `json:"type"` + }{} + all := struct { + Attributes *IncidentTeamUpdateAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` + Type IncidentTeamType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_team_update_request.go b/api/v2/datadog/model_incident_team_update_request.go new file mode 100644 index 00000000000..176158ac4bb --- /dev/null +++ b/api/v2/datadog/model_incident_team_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamUpdateRequest Update request with an incident team payload. +type IncidentTeamUpdateRequest struct { + // Incident Team data for an update request. + Data IncidentTeamUpdateData `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{} +} + +// NewIncidentTeamUpdateRequest instantiates a new IncidentTeamUpdateRequest 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 NewIncidentTeamUpdateRequest(data IncidentTeamUpdateData) *IncidentTeamUpdateRequest { + this := IncidentTeamUpdateRequest{} + this.Data = data + return &this +} + +// NewIncidentTeamUpdateRequestWithDefaults instantiates a new IncidentTeamUpdateRequest 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 NewIncidentTeamUpdateRequestWithDefaults() *IncidentTeamUpdateRequest { + this := IncidentTeamUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTeamUpdateRequest) GetData() IncidentTeamUpdateData { + if o == nil { + var ret IncidentTeamUpdateData + 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 *IncidentTeamUpdateRequest) GetDataOk() (*IncidentTeamUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTeamUpdateRequest) SetData(v IncidentTeamUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentTeamUpdateData `json:"data"` + }{} + all := struct { + Data IncidentTeamUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_incident_teams_response.go b/api/v2/datadog/model_incident_teams_response.go new file mode 100644 index 00000000000..1e6e2917009 --- /dev/null +++ b/api/v2/datadog/model_incident_teams_response.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTeamsResponse Response with a list of incident team payloads. +type IncidentTeamsResponse struct { + // An array of incident teams. + Data []IncidentTeamResponseData `json:"data"` + // Included related resources which the user requested. + Included []IncidentTeamIncludedItems `json:"included,omitempty"` + // The metadata object containing pagination metadata. + Meta *IncidentResponseMeta `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{} +} + +// NewIncidentTeamsResponse instantiates a new IncidentTeamsResponse 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 NewIncidentTeamsResponse(data []IncidentTeamResponseData) *IncidentTeamsResponse { + this := IncidentTeamsResponse{} + this.Data = data + return &this +} + +// NewIncidentTeamsResponseWithDefaults instantiates a new IncidentTeamsResponse 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 NewIncidentTeamsResponseWithDefaults() *IncidentTeamsResponse { + this := IncidentTeamsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTeamsResponse) GetData() []IncidentTeamResponseData { + if o == nil { + var ret []IncidentTeamResponseData + 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 *IncidentTeamsResponse) GetDataOk() (*[]IncidentTeamResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTeamsResponse) SetData(v []IncidentTeamResponseData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentTeamsResponse) GetIncluded() []IncidentTeamIncludedItems { + if o == nil || o.Included == nil { + var ret []IncidentTeamIncludedItems + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTeamsResponse) GetIncludedOk() (*[]IncidentTeamIncludedItems, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentTeamsResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []IncidentTeamIncludedItems and assigns it to the Included field. +func (o *IncidentTeamsResponse) SetIncluded(v []IncidentTeamIncludedItems) { + o.Included = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *IncidentTeamsResponse) GetMeta() IncidentResponseMeta { + if o == nil || o.Meta == nil { + var ret IncidentResponseMeta + 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 *IncidentTeamsResponse) GetMetaOk() (*IncidentResponseMeta, 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 *IncidentTeamsResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given IncidentResponseMeta and assigns it to the Meta field. +func (o *IncidentTeamsResponse) SetMeta(v IncidentResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTeamsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]IncidentTeamResponseData `json:"data"` + }{} + all := struct { + Data []IncidentTeamResponseData `json:"data"` + Included []IncidentTeamIncludedItems `json:"included,omitempty"` + Meta *IncidentResponseMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Included = all.Included + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_incident_timeline_cell_create_attributes.go b/api/v2/datadog/model_incident_timeline_cell_create_attributes.go new file mode 100644 index 00000000000..07de51d99be --- /dev/null +++ b/api/v2/datadog/model_incident_timeline_cell_create_attributes.go @@ -0,0 +1,123 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentTimelineCellCreateAttributes - The timeline cell's attributes for a create request. +type IncidentTimelineCellCreateAttributes struct { + IncidentTimelineCellMarkdownCreateAttributes *IncidentTimelineCellMarkdownCreateAttributes + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// IncidentTimelineCellMarkdownCreateAttributesAsIncidentTimelineCellCreateAttributes is a convenience function that returns IncidentTimelineCellMarkdownCreateAttributes wrapped in IncidentTimelineCellCreateAttributes. +func IncidentTimelineCellMarkdownCreateAttributesAsIncidentTimelineCellCreateAttributes(v *IncidentTimelineCellMarkdownCreateAttributes) IncidentTimelineCellCreateAttributes { + return IncidentTimelineCellCreateAttributes{IncidentTimelineCellMarkdownCreateAttributes: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *IncidentTimelineCellCreateAttributes) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IncidentTimelineCellMarkdownCreateAttributes + err = json.Unmarshal(data, &obj.IncidentTimelineCellMarkdownCreateAttributes) + if err == nil { + if obj.IncidentTimelineCellMarkdownCreateAttributes != nil && obj.IncidentTimelineCellMarkdownCreateAttributes.UnparsedObject == nil { + jsonIncidentTimelineCellMarkdownCreateAttributes, _ := json.Marshal(obj.IncidentTimelineCellMarkdownCreateAttributes) + if string(jsonIncidentTimelineCellMarkdownCreateAttributes) == "{}" { // empty struct + obj.IncidentTimelineCellMarkdownCreateAttributes = nil + } else { + match++ + } + } else { + obj.IncidentTimelineCellMarkdownCreateAttributes = nil + } + } else { + obj.IncidentTimelineCellMarkdownCreateAttributes = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.IncidentTimelineCellMarkdownCreateAttributes = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj IncidentTimelineCellCreateAttributes) MarshalJSON() ([]byte, error) { + if obj.IncidentTimelineCellMarkdownCreateAttributes != nil { + return json.Marshal(&obj.IncidentTimelineCellMarkdownCreateAttributes) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *IncidentTimelineCellCreateAttributes) GetActualInstance() interface{} { + if obj.IncidentTimelineCellMarkdownCreateAttributes != nil { + return obj.IncidentTimelineCellMarkdownCreateAttributes + } + + // all schemas are nil + return nil +} + +// NullableIncidentTimelineCellCreateAttributes handles when a null is used for IncidentTimelineCellCreateAttributes. +type NullableIncidentTimelineCellCreateAttributes struct { + value *IncidentTimelineCellCreateAttributes + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentTimelineCellCreateAttributes) Get() *IncidentTimelineCellCreateAttributes { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentTimelineCellCreateAttributes) Set(val *IncidentTimelineCellCreateAttributes) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentTimelineCellCreateAttributes) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableIncidentTimelineCellCreateAttributes) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentTimelineCellCreateAttributes initializes the struct as if Set has been called. +func NewNullableIncidentTimelineCellCreateAttributes(val *IncidentTimelineCellCreateAttributes) *NullableIncidentTimelineCellCreateAttributes { + return &NullableIncidentTimelineCellCreateAttributes{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentTimelineCellCreateAttributes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentTimelineCellCreateAttributes) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go b/api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go new file mode 100644 index 00000000000..edf66394ab0 --- /dev/null +++ b/api/v2/datadog/model_incident_timeline_cell_markdown_content_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTimelineCellMarkdownContentType Type of the Markdown timeline cell. +type IncidentTimelineCellMarkdownContentType string + +// List of IncidentTimelineCellMarkdownContentType. +const ( + INCIDENTTIMELINECELLMARKDOWNCONTENTTYPE_MARKDOWN IncidentTimelineCellMarkdownContentType = "markdown" +) + +var allowedIncidentTimelineCellMarkdownContentTypeEnumValues = []IncidentTimelineCellMarkdownContentType{ + INCIDENTTIMELINECELLMARKDOWNCONTENTTYPE_MARKDOWN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentTimelineCellMarkdownContentType) GetAllowedValues() []IncidentTimelineCellMarkdownContentType { + return allowedIncidentTimelineCellMarkdownContentTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentTimelineCellMarkdownContentType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentTimelineCellMarkdownContentType(value) + return nil +} + +// NewIncidentTimelineCellMarkdownContentTypeFromValue returns a pointer to a valid IncidentTimelineCellMarkdownContentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentTimelineCellMarkdownContentTypeFromValue(v string) (*IncidentTimelineCellMarkdownContentType, error) { + ev := IncidentTimelineCellMarkdownContentType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentTimelineCellMarkdownContentType: valid values are %v", v, allowedIncidentTimelineCellMarkdownContentTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentTimelineCellMarkdownContentType) IsValid() bool { + for _, existing := range allowedIncidentTimelineCellMarkdownContentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentTimelineCellMarkdownContentType value. +func (v IncidentTimelineCellMarkdownContentType) Ptr() *IncidentTimelineCellMarkdownContentType { + return &v +} + +// NullableIncidentTimelineCellMarkdownContentType handles when a null is used for IncidentTimelineCellMarkdownContentType. +type NullableIncidentTimelineCellMarkdownContentType struct { + value *IncidentTimelineCellMarkdownContentType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentTimelineCellMarkdownContentType) Get() *IncidentTimelineCellMarkdownContentType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentTimelineCellMarkdownContentType) Set(val *IncidentTimelineCellMarkdownContentType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentTimelineCellMarkdownContentType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentTimelineCellMarkdownContentType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentTimelineCellMarkdownContentType initializes the struct as if Set has been called. +func NewNullableIncidentTimelineCellMarkdownContentType(val *IncidentTimelineCellMarkdownContentType) *NullableIncidentTimelineCellMarkdownContentType { + return &NullableIncidentTimelineCellMarkdownContentType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentTimelineCellMarkdownContentType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentTimelineCellMarkdownContentType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go b/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go new file mode 100644 index 00000000000..374572c3016 --- /dev/null +++ b/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes.go @@ -0,0 +1,196 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentTimelineCellMarkdownCreateAttributes Timeline cell data for Markdown timeline cells for a create request. +type IncidentTimelineCellMarkdownCreateAttributes struct { + // Type of the Markdown timeline cell. + CellType IncidentTimelineCellMarkdownContentType `json:"cell_type"` + // The Markdown timeline cell contents. + Content IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` + // A flag indicating whether the timeline cell is important and should be highlighted. + Important *bool `json:"important,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{} +} + +// NewIncidentTimelineCellMarkdownCreateAttributes instantiates a new IncidentTimelineCellMarkdownCreateAttributes 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 NewIncidentTimelineCellMarkdownCreateAttributes(cellType IncidentTimelineCellMarkdownContentType, content IncidentTimelineCellMarkdownCreateAttributesContent) *IncidentTimelineCellMarkdownCreateAttributes { + this := IncidentTimelineCellMarkdownCreateAttributes{} + this.CellType = cellType + this.Content = content + var important bool = false + this.Important = &important + return &this +} + +// NewIncidentTimelineCellMarkdownCreateAttributesWithDefaults instantiates a new IncidentTimelineCellMarkdownCreateAttributes 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 NewIncidentTimelineCellMarkdownCreateAttributesWithDefaults() *IncidentTimelineCellMarkdownCreateAttributes { + this := IncidentTimelineCellMarkdownCreateAttributes{} + var cellType IncidentTimelineCellMarkdownContentType = INCIDENTTIMELINECELLMARKDOWNCONTENTTYPE_MARKDOWN + this.CellType = cellType + var important bool = false + this.Important = &important + return &this +} + +// GetCellType returns the CellType field value. +func (o *IncidentTimelineCellMarkdownCreateAttributes) GetCellType() IncidentTimelineCellMarkdownContentType { + if o == nil { + var ret IncidentTimelineCellMarkdownContentType + return ret + } + return o.CellType +} + +// GetCellTypeOk returns a tuple with the CellType field value +// and a boolean to check if the value has been set. +func (o *IncidentTimelineCellMarkdownCreateAttributes) GetCellTypeOk() (*IncidentTimelineCellMarkdownContentType, bool) { + if o == nil { + return nil, false + } + return &o.CellType, true +} + +// SetCellType sets field value. +func (o *IncidentTimelineCellMarkdownCreateAttributes) SetCellType(v IncidentTimelineCellMarkdownContentType) { + o.CellType = v +} + +// GetContent returns the Content field value. +func (o *IncidentTimelineCellMarkdownCreateAttributes) GetContent() IncidentTimelineCellMarkdownCreateAttributesContent { + if o == nil { + var ret IncidentTimelineCellMarkdownCreateAttributesContent + return ret + } + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *IncidentTimelineCellMarkdownCreateAttributes) GetContentOk() (*IncidentTimelineCellMarkdownCreateAttributesContent, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value. +func (o *IncidentTimelineCellMarkdownCreateAttributes) SetContent(v IncidentTimelineCellMarkdownCreateAttributesContent) { + o.Content = v +} + +// GetImportant returns the Important field value if set, zero value otherwise. +func (o *IncidentTimelineCellMarkdownCreateAttributes) GetImportant() bool { + if o == nil || o.Important == nil { + var ret bool + return ret + } + return *o.Important +} + +// GetImportantOk returns a tuple with the Important field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTimelineCellMarkdownCreateAttributes) GetImportantOk() (*bool, bool) { + if o == nil || o.Important == nil { + return nil, false + } + return o.Important, true +} + +// HasImportant returns a boolean if a field has been set. +func (o *IncidentTimelineCellMarkdownCreateAttributes) HasImportant() bool { + if o != nil && o.Important != nil { + return true + } + + return false +} + +// SetImportant gets a reference to the given bool and assigns it to the Important field. +func (o *IncidentTimelineCellMarkdownCreateAttributes) SetImportant(v bool) { + o.Important = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimelineCellMarkdownCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["cell_type"] = o.CellType + toSerialize["content"] = o.Content + if o.Important != nil { + toSerialize["important"] = o.Important + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + CellType *IncidentTimelineCellMarkdownContentType `json:"cell_type"` + Content *IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` + }{} + all := struct { + CellType IncidentTimelineCellMarkdownContentType `json:"cell_type"` + Content IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` + Important *bool `json:"important,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.CellType == nil { + return fmt.Errorf("Required field cell_type missing") + } + if required.Content == nil { + return fmt.Errorf("Required field content missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.CellType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CellType = all.CellType + if all.Content.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Content = all.Content + o.Important = all.Important + return nil +} diff --git a/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.go b/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.go new file mode 100644 index 00000000000..ffd958b3095 --- /dev/null +++ b/api/v2/datadog/model_incident_timeline_cell_markdown_create_attributes_content.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 datadog + +import ( + "encoding/json" +) + +// IncidentTimelineCellMarkdownCreateAttributesContent The Markdown timeline cell contents. +type IncidentTimelineCellMarkdownCreateAttributesContent struct { + // The Markdown content of the cell. + Content *string `json:"content,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{} +} + +// NewIncidentTimelineCellMarkdownCreateAttributesContent instantiates a new IncidentTimelineCellMarkdownCreateAttributesContent 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 NewIncidentTimelineCellMarkdownCreateAttributesContent() *IncidentTimelineCellMarkdownCreateAttributesContent { + this := IncidentTimelineCellMarkdownCreateAttributesContent{} + return &this +} + +// NewIncidentTimelineCellMarkdownCreateAttributesContentWithDefaults instantiates a new IncidentTimelineCellMarkdownCreateAttributesContent 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 NewIncidentTimelineCellMarkdownCreateAttributesContentWithDefaults() *IncidentTimelineCellMarkdownCreateAttributesContent { + this := IncidentTimelineCellMarkdownCreateAttributesContent{} + return &this +} + +// GetContent returns the Content field value if set, zero value otherwise. +func (o *IncidentTimelineCellMarkdownCreateAttributesContent) GetContent() string { + if o == nil || o.Content == nil { + var ret string + return ret + } + return *o.Content +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTimelineCellMarkdownCreateAttributesContent) GetContentOk() (*string, bool) { + if o == nil || o.Content == nil { + return nil, false + } + return o.Content, true +} + +// HasContent returns a boolean if a field has been set. +func (o *IncidentTimelineCellMarkdownCreateAttributesContent) HasContent() bool { + if o != nil && o.Content != nil { + return true + } + + return false +} + +// SetContent gets a reference to the given string and assigns it to the Content field. +func (o *IncidentTimelineCellMarkdownCreateAttributesContent) SetContent(v string) { + o.Content = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimelineCellMarkdownCreateAttributesContent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Content != nil { + toSerialize["content"] = o.Content + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimelineCellMarkdownCreateAttributesContent) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Content *string `json:"content,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Content = all.Content + return nil +} diff --git a/api/v2/datadog/model_incident_type.go b/api/v2/datadog/model_incident_type.go new file mode 100644 index 00000000000..bda6eeb3e40 --- /dev/null +++ b/api/v2/datadog/model_incident_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentType Incident resource type. +type IncidentType string + +// List of IncidentType. +const ( + INCIDENTTYPE_INCIDENTS IncidentType = "incidents" +) + +var allowedIncidentTypeEnumValues = []IncidentType{ + INCIDENTTYPE_INCIDENTS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentType) GetAllowedValues() []IncidentType { + return allowedIncidentTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentType(value) + return nil +} + +// NewIncidentTypeFromValue returns a pointer to a valid IncidentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentTypeFromValue(v string) (*IncidentType, error) { + ev := IncidentType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentType: valid values are %v", v, allowedIncidentTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentType) IsValid() bool { + for _, existing := range allowedIncidentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentType value. +func (v IncidentType) Ptr() *IncidentType { + return &v +} + +// NullableIncidentType handles when a null is used for IncidentType. +type NullableIncidentType struct { + value *IncidentType + isSet bool +} + +// Get returns the associated value. +func (v NullableIncidentType) Get() *IncidentType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableIncidentType) Set(val *IncidentType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableIncidentType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableIncidentType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableIncidentType initializes the struct as if Set has been called. +func NewNullableIncidentType(val *IncidentType) *NullableIncidentType { + return &NullableIncidentType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableIncidentType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableIncidentType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_incident_update_attributes.go b/api/v2/datadog/model_incident_update_attributes.go new file mode 100644 index 00000000000..93ae02f4503 --- /dev/null +++ b/api/v2/datadog/model_incident_update_attributes.go @@ -0,0 +1,461 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// IncidentUpdateAttributes The incident's attributes for an update request. +type IncidentUpdateAttributes struct { + // Timestamp when customers were no longer impacted by the incident. + CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` + // A summary of the impact customers experienced during the incident. + CustomerImpactScope *string `json:"customer_impact_scope,omitempty"` + // Timestamp when customers began being impacted by the incident. + CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` + // A flag indicating whether the incident caused customer impact. + CustomerImpacted *bool `json:"customer_impacted,omitempty"` + // Timestamp when the incident was detected. + Detected common.NullableTime `json:"detected,omitempty"` + // A condensed view of the user-defined fields for which to update selections. + Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` + // Notification handles that will be notified of the incident during update. + NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` + // Timestamp when the incident's state was set to resolved. + Resolved common.NullableTime `json:"resolved,omitempty"` + // The title of the incident, which summarizes what happened. + Title *string `json:"title,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{} +} + +// NewIncidentUpdateAttributes instantiates a new IncidentUpdateAttributes 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 NewIncidentUpdateAttributes() *IncidentUpdateAttributes { + this := IncidentUpdateAttributes{} + return &this +} + +// NewIncidentUpdateAttributesWithDefaults instantiates a new IncidentUpdateAttributes 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 NewIncidentUpdateAttributesWithDefaults() *IncidentUpdateAttributes { + this := IncidentUpdateAttributes{} + return &this +} + +// GetCustomerImpactEnd returns the CustomerImpactEnd field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentUpdateAttributes) GetCustomerImpactEnd() time.Time { + if o == nil || o.CustomerImpactEnd.Get() == nil { + var ret time.Time + return ret + } + return *o.CustomerImpactEnd.Get() +} + +// GetCustomerImpactEndOk returns a tuple with the CustomerImpactEnd 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 *IncidentUpdateAttributes) GetCustomerImpactEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CustomerImpactEnd.Get(), o.CustomerImpactEnd.IsSet() +} + +// HasCustomerImpactEnd returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasCustomerImpactEnd() bool { + if o != nil && o.CustomerImpactEnd.IsSet() { + return true + } + + return false +} + +// SetCustomerImpactEnd gets a reference to the given common.NullableTime and assigns it to the CustomerImpactEnd field. +func (o *IncidentUpdateAttributes) SetCustomerImpactEnd(v time.Time) { + o.CustomerImpactEnd.Set(&v) +} + +// SetCustomerImpactEndNil sets the value for CustomerImpactEnd to be an explicit nil. +func (o *IncidentUpdateAttributes) SetCustomerImpactEndNil() { + o.CustomerImpactEnd.Set(nil) +} + +// UnsetCustomerImpactEnd ensures that no value is present for CustomerImpactEnd, not even an explicit nil. +func (o *IncidentUpdateAttributes) UnsetCustomerImpactEnd() { + o.CustomerImpactEnd.Unset() +} + +// GetCustomerImpactScope returns the CustomerImpactScope field value if set, zero value otherwise. +func (o *IncidentUpdateAttributes) GetCustomerImpactScope() string { + if o == nil || o.CustomerImpactScope == nil { + var ret string + return ret + } + return *o.CustomerImpactScope +} + +// GetCustomerImpactScopeOk returns a tuple with the CustomerImpactScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateAttributes) GetCustomerImpactScopeOk() (*string, bool) { + if o == nil || o.CustomerImpactScope == nil { + return nil, false + } + return o.CustomerImpactScope, true +} + +// HasCustomerImpactScope returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasCustomerImpactScope() bool { + if o != nil && o.CustomerImpactScope != nil { + return true + } + + return false +} + +// SetCustomerImpactScope gets a reference to the given string and assigns it to the CustomerImpactScope field. +func (o *IncidentUpdateAttributes) SetCustomerImpactScope(v string) { + o.CustomerImpactScope = &v +} + +// GetCustomerImpactStart returns the CustomerImpactStart field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentUpdateAttributes) GetCustomerImpactStart() time.Time { + if o == nil || o.CustomerImpactStart.Get() == nil { + var ret time.Time + return ret + } + return *o.CustomerImpactStart.Get() +} + +// GetCustomerImpactStartOk returns a tuple with the CustomerImpactStart 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 *IncidentUpdateAttributes) GetCustomerImpactStartOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CustomerImpactStart.Get(), o.CustomerImpactStart.IsSet() +} + +// HasCustomerImpactStart returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasCustomerImpactStart() bool { + if o != nil && o.CustomerImpactStart.IsSet() { + return true + } + + return false +} + +// SetCustomerImpactStart gets a reference to the given common.NullableTime and assigns it to the CustomerImpactStart field. +func (o *IncidentUpdateAttributes) SetCustomerImpactStart(v time.Time) { + o.CustomerImpactStart.Set(&v) +} + +// SetCustomerImpactStartNil sets the value for CustomerImpactStart to be an explicit nil. +func (o *IncidentUpdateAttributes) SetCustomerImpactStartNil() { + o.CustomerImpactStart.Set(nil) +} + +// UnsetCustomerImpactStart ensures that no value is present for CustomerImpactStart, not even an explicit nil. +func (o *IncidentUpdateAttributes) UnsetCustomerImpactStart() { + o.CustomerImpactStart.Unset() +} + +// GetCustomerImpacted returns the CustomerImpacted field value if set, zero value otherwise. +func (o *IncidentUpdateAttributes) GetCustomerImpacted() bool { + if o == nil || o.CustomerImpacted == nil { + var ret bool + return ret + } + return *o.CustomerImpacted +} + +// GetCustomerImpactedOk returns a tuple with the CustomerImpacted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateAttributes) GetCustomerImpactedOk() (*bool, bool) { + if o == nil || o.CustomerImpacted == nil { + return nil, false + } + return o.CustomerImpacted, true +} + +// HasCustomerImpacted returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasCustomerImpacted() bool { + if o != nil && o.CustomerImpacted != nil { + return true + } + + return false +} + +// SetCustomerImpacted gets a reference to the given bool and assigns it to the CustomerImpacted field. +func (o *IncidentUpdateAttributes) SetCustomerImpacted(v bool) { + o.CustomerImpacted = &v +} + +// GetDetected returns the Detected field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentUpdateAttributes) GetDetected() time.Time { + if o == nil || o.Detected.Get() == nil { + var ret time.Time + return ret + } + return *o.Detected.Get() +} + +// GetDetectedOk returns a tuple with the Detected 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 *IncidentUpdateAttributes) GetDetectedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Detected.Get(), o.Detected.IsSet() +} + +// HasDetected returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasDetected() bool { + if o != nil && o.Detected.IsSet() { + return true + } + + return false +} + +// SetDetected gets a reference to the given common.NullableTime and assigns it to the Detected field. +func (o *IncidentUpdateAttributes) SetDetected(v time.Time) { + o.Detected.Set(&v) +} + +// SetDetectedNil sets the value for Detected to be an explicit nil. +func (o *IncidentUpdateAttributes) SetDetectedNil() { + o.Detected.Set(nil) +} + +// UnsetDetected ensures that no value is present for Detected, not even an explicit nil. +func (o *IncidentUpdateAttributes) UnsetDetected() { + o.Detected.Unset() +} + +// GetFields returns the Fields field value if set, zero value otherwise. +func (o *IncidentUpdateAttributes) GetFields() map[string]IncidentFieldAttributes { + if o == nil || o.Fields == nil { + var ret map[string]IncidentFieldAttributes + return ret + } + return o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateAttributes) GetFieldsOk() (*map[string]IncidentFieldAttributes, bool) { + if o == nil || o.Fields == nil { + return nil, false + } + return &o.Fields, true +} + +// HasFields returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasFields() bool { + if o != nil && o.Fields != nil { + return true + } + + return false +} + +// SetFields gets a reference to the given map[string]IncidentFieldAttributes and assigns it to the Fields field. +func (o *IncidentUpdateAttributes) SetFields(v map[string]IncidentFieldAttributes) { + o.Fields = v +} + +// GetNotificationHandles returns the NotificationHandles field value if set, zero value otherwise. +func (o *IncidentUpdateAttributes) GetNotificationHandles() []IncidentNotificationHandle { + if o == nil || o.NotificationHandles == nil { + var ret []IncidentNotificationHandle + return ret + } + return o.NotificationHandles +} + +// GetNotificationHandlesOk returns a tuple with the NotificationHandles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateAttributes) GetNotificationHandlesOk() (*[]IncidentNotificationHandle, bool) { + if o == nil || o.NotificationHandles == nil { + return nil, false + } + return &o.NotificationHandles, true +} + +// HasNotificationHandles returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasNotificationHandles() bool { + if o != nil && o.NotificationHandles != nil { + return true + } + + return false +} + +// SetNotificationHandles gets a reference to the given []IncidentNotificationHandle and assigns it to the NotificationHandles field. +func (o *IncidentUpdateAttributes) SetNotificationHandles(v []IncidentNotificationHandle) { + o.NotificationHandles = v +} + +// GetResolved returns the Resolved field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentUpdateAttributes) GetResolved() time.Time { + if o == nil || o.Resolved.Get() == nil { + var ret time.Time + return ret + } + return *o.Resolved.Get() +} + +// GetResolvedOk returns a tuple with the Resolved 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 *IncidentUpdateAttributes) GetResolvedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Resolved.Get(), o.Resolved.IsSet() +} + +// HasResolved returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasResolved() bool { + if o != nil && o.Resolved.IsSet() { + return true + } + + return false +} + +// SetResolved gets a reference to the given common.NullableTime and assigns it to the Resolved field. +func (o *IncidentUpdateAttributes) SetResolved(v time.Time) { + o.Resolved.Set(&v) +} + +// SetResolvedNil sets the value for Resolved to be an explicit nil. +func (o *IncidentUpdateAttributes) SetResolvedNil() { + o.Resolved.Set(nil) +} + +// UnsetResolved ensures that no value is present for Resolved, not even an explicit nil. +func (o *IncidentUpdateAttributes) UnsetResolved() { + o.Resolved.Unset() +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *IncidentUpdateAttributes) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateAttributes) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *IncidentUpdateAttributes) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *IncidentUpdateAttributes) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomerImpactEnd.IsSet() { + toSerialize["customer_impact_end"] = o.CustomerImpactEnd.Get() + } + if o.CustomerImpactScope != nil { + toSerialize["customer_impact_scope"] = o.CustomerImpactScope + } + if o.CustomerImpactStart.IsSet() { + toSerialize["customer_impact_start"] = o.CustomerImpactStart.Get() + } + if o.CustomerImpacted != nil { + toSerialize["customer_impacted"] = o.CustomerImpacted + } + if o.Detected.IsSet() { + toSerialize["detected"] = o.Detected.Get() + } + if o.Fields != nil { + toSerialize["fields"] = o.Fields + } + if o.NotificationHandles != nil { + toSerialize["notification_handles"] = o.NotificationHandles + } + if o.Resolved.IsSet() { + toSerialize["resolved"] = o.Resolved.Get() + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CustomerImpactEnd common.NullableTime `json:"customer_impact_end,omitempty"` + CustomerImpactScope *string `json:"customer_impact_scope,omitempty"` + CustomerImpactStart common.NullableTime `json:"customer_impact_start,omitempty"` + CustomerImpacted *bool `json:"customer_impacted,omitempty"` + Detected common.NullableTime `json:"detected,omitempty"` + Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` + NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` + Resolved common.NullableTime `json:"resolved,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomerImpactEnd = all.CustomerImpactEnd + o.CustomerImpactScope = all.CustomerImpactScope + o.CustomerImpactStart = all.CustomerImpactStart + o.CustomerImpacted = all.CustomerImpacted + o.Detected = all.Detected + o.Fields = all.Fields + o.NotificationHandles = all.NotificationHandles + o.Resolved = all.Resolved + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_incident_update_data.go b/api/v2/datadog/model_incident_update_data.go new file mode 100644 index 00000000000..7f75861989f --- /dev/null +++ b/api/v2/datadog/model_incident_update_data.go @@ -0,0 +1,238 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentUpdateData Incident data for an update request. +type IncidentUpdateData struct { + // The incident's attributes for an update request. + Attributes *IncidentUpdateAttributes `json:"attributes,omitempty"` + // The team's ID. + Id string `json:"id"` + // The incident's relationships for an update request. + Relationships *IncidentUpdateRelationships `json:"relationships,omitempty"` + // Incident resource type. + Type IncidentType `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{} +} + +// NewIncidentUpdateData instantiates a new IncidentUpdateData 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 NewIncidentUpdateData(id string, typeVar IncidentType) *IncidentUpdateData { + this := IncidentUpdateData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentUpdateDataWithDefaults instantiates a new IncidentUpdateData 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 NewIncidentUpdateDataWithDefaults() *IncidentUpdateData { + this := IncidentUpdateData{} + var typeVar IncidentType = INCIDENTTYPE_INCIDENTS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentUpdateData) GetAttributes() IncidentUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret IncidentUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateData) GetAttributesOk() (*IncidentUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *IncidentUpdateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given IncidentUpdateAttributes and assigns it to the Attributes field. +func (o *IncidentUpdateData) SetAttributes(v IncidentUpdateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentUpdateData) 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 *IncidentUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentUpdateData) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentUpdateData) GetRelationships() IncidentUpdateRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentUpdateRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateData) GetRelationshipsOk() (*IncidentUpdateRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *IncidentUpdateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given IncidentUpdateRelationships and assigns it to the Relationships field. +func (o *IncidentUpdateData) SetRelationships(v IncidentUpdateRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentUpdateData) GetType() IncidentType { + if o == nil { + var ret IncidentType + 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 *IncidentUpdateData) GetTypeOk() (*IncidentType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentUpdateData) SetType(v IncidentType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *IncidentType `json:"type"` + }{} + all := struct { + Attributes *IncidentUpdateAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Relationships *IncidentUpdateRelationships `json:"relationships,omitempty"` + Type IncidentType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_incident_update_relationships.go b/api/v2/datadog/model_incident_update_relationships.go new file mode 100644 index 00000000000..e4a350f21b4 --- /dev/null +++ b/api/v2/datadog/model_incident_update_relationships.go @@ -0,0 +1,201 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// IncidentUpdateRelationships The incident's relationships for an update request. +type IncidentUpdateRelationships struct { + // Relationship to user. + CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` + // A relationship reference for multiple integration metadata objects. + Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` + // A relationship reference for postmortems. + Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,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{} +} + +// NewIncidentUpdateRelationships instantiates a new IncidentUpdateRelationships 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 NewIncidentUpdateRelationships() *IncidentUpdateRelationships { + this := IncidentUpdateRelationships{} + return &this +} + +// NewIncidentUpdateRelationshipsWithDefaults instantiates a new IncidentUpdateRelationships 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 NewIncidentUpdateRelationshipsWithDefaults() *IncidentUpdateRelationships { + this := IncidentUpdateRelationships{} + return &this +} + +// GetCommanderUser returns the CommanderUser field value if set, zero value otherwise. +func (o *IncidentUpdateRelationships) GetCommanderUser() NullableRelationshipToUser { + if o == nil || o.CommanderUser == nil { + var ret NullableRelationshipToUser + return ret + } + return *o.CommanderUser +} + +// GetCommanderUserOk returns a tuple with the CommanderUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateRelationships) GetCommanderUserOk() (*NullableRelationshipToUser, bool) { + if o == nil || o.CommanderUser == nil { + return nil, false + } + return o.CommanderUser, true +} + +// HasCommanderUser returns a boolean if a field has been set. +func (o *IncidentUpdateRelationships) HasCommanderUser() bool { + if o != nil && o.CommanderUser != nil { + return true + } + + return false +} + +// SetCommanderUser gets a reference to the given NullableRelationshipToUser and assigns it to the CommanderUser field. +func (o *IncidentUpdateRelationships) SetCommanderUser(v NullableRelationshipToUser) { + o.CommanderUser = &v +} + +// GetIntegrations returns the Integrations field value if set, zero value otherwise. +func (o *IncidentUpdateRelationships) GetIntegrations() RelationshipToIncidentIntegrationMetadatas { + if o == nil || o.Integrations == nil { + var ret RelationshipToIncidentIntegrationMetadatas + return ret + } + return *o.Integrations +} + +// GetIntegrationsOk returns a tuple with the Integrations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateRelationships) GetIntegrationsOk() (*RelationshipToIncidentIntegrationMetadatas, bool) { + if o == nil || o.Integrations == nil { + return nil, false + } + return o.Integrations, true +} + +// HasIntegrations returns a boolean if a field has been set. +func (o *IncidentUpdateRelationships) HasIntegrations() bool { + if o != nil && o.Integrations != nil { + return true + } + + return false +} + +// SetIntegrations gets a reference to the given RelationshipToIncidentIntegrationMetadatas and assigns it to the Integrations field. +func (o *IncidentUpdateRelationships) SetIntegrations(v RelationshipToIncidentIntegrationMetadatas) { + o.Integrations = &v +} + +// GetPostmortem returns the Postmortem field value if set, zero value otherwise. +func (o *IncidentUpdateRelationships) GetPostmortem() RelationshipToIncidentPostmortem { + if o == nil || o.Postmortem == nil { + var ret RelationshipToIncidentPostmortem + return ret + } + return *o.Postmortem +} + +// GetPostmortemOk returns a tuple with the Postmortem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUpdateRelationships) GetPostmortemOk() (*RelationshipToIncidentPostmortem, bool) { + if o == nil || o.Postmortem == nil { + return nil, false + } + return o.Postmortem, true +} + +// HasPostmortem returns a boolean if a field has been set. +func (o *IncidentUpdateRelationships) HasPostmortem() bool { + if o != nil && o.Postmortem != nil { + return true + } + + return false +} + +// SetPostmortem gets a reference to the given RelationshipToIncidentPostmortem and assigns it to the Postmortem field. +func (o *IncidentUpdateRelationships) SetPostmortem(v RelationshipToIncidentPostmortem) { + o.Postmortem = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUpdateRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CommanderUser != nil { + toSerialize["commander_user"] = o.CommanderUser + } + if o.Integrations != nil { + toSerialize["integrations"] = o.Integrations + } + if o.Postmortem != nil { + toSerialize["postmortem"] = o.Postmortem + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CommanderUser *NullableRelationshipToUser `json:"commander_user,omitempty"` + Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` + Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.CommanderUser != nil && all.CommanderUser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.CommanderUser = all.CommanderUser + if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Integrations = all.Integrations + if all.Postmortem != nil && all.Postmortem.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Postmortem = all.Postmortem + return nil +} diff --git a/api/v2/datadog/model_incident_update_request.go b/api/v2/datadog/model_incident_update_request.go new file mode 100644 index 00000000000..a6153c222fc --- /dev/null +++ b/api/v2/datadog/model_incident_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentUpdateRequest Update request for an incident. +type IncidentUpdateRequest struct { + // Incident data for an update request. + Data IncidentUpdateData `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{} +} + +// NewIncidentUpdateRequest instantiates a new IncidentUpdateRequest 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 NewIncidentUpdateRequest(data IncidentUpdateData) *IncidentUpdateRequest { + this := IncidentUpdateRequest{} + this.Data = data + return &this +} + +// NewIncidentUpdateRequestWithDefaults instantiates a new IncidentUpdateRequest 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 NewIncidentUpdateRequestWithDefaults() *IncidentUpdateRequest { + this := IncidentUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentUpdateRequest) GetData() IncidentUpdateData { + if o == nil { + var ret IncidentUpdateData + 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 *IncidentUpdateRequest) GetDataOk() (*IncidentUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentUpdateRequest) SetData(v IncidentUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *IncidentUpdateData `json:"data"` + }{} + all := struct { + Data IncidentUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_incidents_response.go b/api/v2/datadog/model_incidents_response.go new file mode 100644 index 00000000000..46beae8a4fb --- /dev/null +++ b/api/v2/datadog/model_incidents_response.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// IncidentsResponse Response with a list of incidents. +type IncidentsResponse struct { + // An array of incidents. + Data []IncidentResponseData `json:"data"` + // Included related resources that the user requested. + Included []IncidentResponseIncludedItem `json:"included,omitempty"` + // The metadata object containing pagination metadata. + Meta *IncidentResponseMeta `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{} +} + +// NewIncidentsResponse instantiates a new IncidentsResponse 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 NewIncidentsResponse(data []IncidentResponseData) *IncidentsResponse { + this := IncidentsResponse{} + this.Data = data + return &this +} + +// NewIncidentsResponseWithDefaults instantiates a new IncidentsResponse 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 NewIncidentsResponseWithDefaults() *IncidentsResponse { + this := IncidentsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentsResponse) GetData() []IncidentResponseData { + if o == nil { + var ret []IncidentResponseData + 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 *IncidentsResponse) GetDataOk() (*[]IncidentResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentsResponse) SetData(v []IncidentResponseData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentsResponse) GetIncluded() []IncidentResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []IncidentResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentsResponse) GetIncludedOk() (*[]IncidentResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentsResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []IncidentResponseIncludedItem and assigns it to the Included field. +func (o *IncidentsResponse) SetIncluded(v []IncidentResponseIncludedItem) { + o.Included = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *IncidentsResponse) GetMeta() IncidentResponseMeta { + if o == nil || o.Meta == nil { + var ret IncidentResponseMeta + 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 *IncidentsResponse) GetMetaOk() (*IncidentResponseMeta, 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 *IncidentsResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given IncidentResponseMeta and assigns it to the Meta field. +func (o *IncidentsResponse) SetMeta(v IncidentResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]IncidentResponseData `json:"data"` + }{} + all := struct { + Data []IncidentResponseData `json:"data"` + Included []IncidentResponseIncludedItem `json:"included,omitempty"` + Meta *IncidentResponseMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Included = all.Included + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_intake_payload_accepted.go b/api/v2/datadog/model_intake_payload_accepted.go new file mode 100644 index 00000000000..38ac06e6d75 --- /dev/null +++ b/api/v2/datadog/model_intake_payload_accepted.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 datadog + +import ( + "encoding/json" +) + +// IntakePayloadAccepted The payload accepted for intake. +type IntakePayloadAccepted struct { + // A list of errors. + Errors []string `json:"errors,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{} +} + +// NewIntakePayloadAccepted instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAccepted() *IntakePayloadAccepted { + this := IntakePayloadAccepted{} + return &this +} + +// NewIntakePayloadAcceptedWithDefaults instantiates a new IntakePayloadAccepted 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 NewIntakePayloadAcceptedWithDefaults() *IntakePayloadAccepted { + this := IntakePayloadAccepted{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *IntakePayloadAccepted) GetErrors() []string { + if o == nil || o.Errors == nil { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakePayloadAccepted) GetErrorsOk() (*[]string, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *IntakePayloadAccepted) HasErrors() bool { + if o != nil && o.Errors != nil { + return true + } + + return false +} + +// SetErrors gets a reference to the given []string and assigns it to the Errors field. +func (o *IntakePayloadAccepted) SetErrors(v []string) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntakePayloadAccepted) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Errors []string `json:"errors,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Errors = all.Errors + return nil +} diff --git a/api/v2/datadog/model_list_application_keys_response.go b/api/v2/datadog/model_list_application_keys_response.go new file mode 100644 index 00000000000..e2fb294e705 --- /dev/null +++ b/api/v2/datadog/model_list_application_keys_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ListApplicationKeysResponse Response for a list of application keys. +type ListApplicationKeysResponse struct { + // Array of application keys. + Data []PartialApplicationKey `json:"data,omitempty"` + // Array of objects related to the application key. + Included []ApplicationKeyResponseIncludedItem `json:"included,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{} +} + +// NewListApplicationKeysResponse instantiates a new ListApplicationKeysResponse 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 NewListApplicationKeysResponse() *ListApplicationKeysResponse { + this := ListApplicationKeysResponse{} + return &this +} + +// NewListApplicationKeysResponseWithDefaults instantiates a new ListApplicationKeysResponse 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 NewListApplicationKeysResponseWithDefaults() *ListApplicationKeysResponse { + this := ListApplicationKeysResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ListApplicationKeysResponse) GetData() []PartialApplicationKey { + if o == nil || o.Data == nil { + var ret []PartialApplicationKey + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListApplicationKeysResponse) GetDataOk() (*[]PartialApplicationKey, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ListApplicationKeysResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []PartialApplicationKey and assigns it to the Data field. +func (o *ListApplicationKeysResponse) SetData(v []PartialApplicationKey) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *ListApplicationKeysResponse) GetIncluded() []ApplicationKeyResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []ApplicationKeyResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListApplicationKeysResponse) GetIncludedOk() (*[]ApplicationKeyResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *ListApplicationKeysResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []ApplicationKeyResponseIncludedItem and assigns it to the Included field. +func (o *ListApplicationKeysResponse) SetIncluded(v []ApplicationKeyResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ListApplicationKeysResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ListApplicationKeysResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []PartialApplicationKey `json:"data,omitempty"` + Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_log.go b/api/v2/datadog/model_log.go new file mode 100644 index 00000000000..26aa94093cf --- /dev/null +++ b/api/v2/datadog/model_log.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Log Object description of a log after being processed and stored by Datadog. +type Log struct { + // JSON object containing all log attributes and their associated values. + Attributes *LogAttributes `json:"attributes,omitempty"` + // Unique ID of the Log. + Id *string `json:"id,omitempty"` + // Type of the event. + Type *LogType `json:"type,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{} +} + +// NewLog instantiates a new Log 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 NewLog() *Log { + this := Log{} + var typeVar LogType = LOGTYPE_LOG + this.Type = &typeVar + return &this +} + +// NewLogWithDefaults instantiates a new Log 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 NewLogWithDefaults() *Log { + this := Log{} + var typeVar LogType = LOGTYPE_LOG + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *Log) GetAttributes() LogAttributes { + if o == nil || o.Attributes == nil { + var ret LogAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Log) GetAttributesOk() (*LogAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *Log) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given LogAttributes and assigns it to the Attributes field. +func (o *Log) SetAttributes(v LogAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Log) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Log) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Log) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Log) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Log) GetType() LogType { + if o == nil || o.Type == nil { + var ret LogType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Log) GetTypeOk() (*LogType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Log) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given LogType and assigns it to the Type field. +func (o *Log) SetType(v LogType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Log) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Log) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *LogAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *LogType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_log_attributes.go b/api/v2/datadog/model_log_attributes.go new file mode 100644 index 00000000000..edda111d5b3 --- /dev/null +++ b/api/v2/datadog/model_log_attributes.go @@ -0,0 +1,345 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// LogAttributes JSON object containing all log attributes and their associated values. +type LogAttributes struct { + // JSON object of attributes from your log. + Attributes map[string]interface{} `json:"attributes,omitempty"` + // Name of the machine from where the logs are being sent. + Host *string `json:"host,omitempty"` + // The message [reserved attribute](https://docs.datadoghq.com/logs/log_collection/#reserved-attributes) + // of your log. By default, Datadog ingests the value of the message attribute as the body of the log entry. + // That value is then highlighted and displayed in the Logstream, where it is indexed for full text search. + Message *string `json:"message,omitempty"` + // The name of the application or service generating the log events. + // It is used to switch from Logs to APM, so make sure you define the same + // value when you use both products. + Service *string `json:"service,omitempty"` + // Status of the message associated with your log. + Status *string `json:"status,omitempty"` + // Array of tags associated with your log. + Tags []string `json:"tags,omitempty"` + // Timestamp of your log. + Timestamp *time.Time `json:"timestamp,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{} +} + +// NewLogAttributes instantiates a new LogAttributes 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 NewLogAttributes() *LogAttributes { + this := LogAttributes{} + return &this +} + +// NewLogAttributesWithDefaults instantiates a new LogAttributes 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 NewLogAttributesWithDefaults() *LogAttributes { + this := LogAttributes{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *LogAttributes) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogAttributes) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *LogAttributes) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *LogAttributes) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *LogAttributes) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogAttributes) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *LogAttributes) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *LogAttributes) SetHost(v string) { + o.Host = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *LogAttributes) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogAttributes) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *LogAttributes) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *LogAttributes) SetMessage(v string) { + o.Message = &v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *LogAttributes) 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 *LogAttributes) 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 *LogAttributes) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *LogAttributes) SetService(v string) { + o.Service = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *LogAttributes) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogAttributes) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *LogAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *LogAttributes) SetStatus(v string) { + o.Status = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *LogAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *LogAttributes) GetTagsOk() (*[]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 *LogAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *LogAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *LogAttributes) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogAttributes) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *LogAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *LogAttributes) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` + Host *string `json:"host,omitempty"` + Message *string `json:"message,omitempty"` + Service *string `json:"service,omitempty"` + Status *string `json:"status,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Host = all.Host + o.Message = all.Message + o.Service = all.Service + o.Status = all.Status + o.Tags = all.Tags + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v2/datadog/model_log_type.go b/api/v2/datadog/model_log_type.go new file mode 100644 index 00000000000..c5033ed890f --- /dev/null +++ b/api/v2/datadog/model_log_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogType Type of the event. +type LogType string + +// List of LogType. +const ( + LOGTYPE_LOG LogType = "log" +) + +var allowedLogTypeEnumValues = []LogType{ + LOGTYPE_LOG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogType) GetAllowedValues() []LogType { + return allowedLogTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogType(value) + return nil +} + +// NewLogTypeFromValue returns a pointer to a valid LogType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogTypeFromValue(v string) (*LogType, error) { + ev := LogType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogType: valid values are %v", v, allowedLogTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogType) IsValid() bool { + for _, existing := range allowedLogTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogType value. +func (v LogType) Ptr() *LogType { + return &v +} + +// NullableLogType handles when a null is used for LogType. +type NullableLogType struct { + value *LogType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogType) Get() *LogType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogType) Set(val *LogType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogType initializes the struct as if Set has been called. +func NewNullableLogType(val *LogType) *NullableLogType { + return &NullableLogType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_aggregate_bucket.go b/api/v2/datadog/model_logs_aggregate_bucket.go new file mode 100644 index 00000000000..0f5706aaa35 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_bucket.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateBucket A bucket values +type LogsAggregateBucket struct { + // The key, value pairs for each group by + By map[string]string `json:"by,omitempty"` + // A map of the metric name -> value for regular compute or list of values for a timeseries + Computes map[string]LogsAggregateBucketValue `json:"computes,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{} +} + +// NewLogsAggregateBucket instantiates a new LogsAggregateBucket 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 NewLogsAggregateBucket() *LogsAggregateBucket { + this := LogsAggregateBucket{} + return &this +} + +// NewLogsAggregateBucketWithDefaults instantiates a new LogsAggregateBucket 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 NewLogsAggregateBucketWithDefaults() *LogsAggregateBucket { + this := LogsAggregateBucket{} + return &this +} + +// GetBy returns the By field value if set, zero value otherwise. +func (o *LogsAggregateBucket) GetBy() map[string]string { + if o == nil || o.By == nil { + var ret map[string]string + return ret + } + return o.By +} + +// GetByOk returns a tuple with the By field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateBucket) GetByOk() (*map[string]string, bool) { + if o == nil || o.By == nil { + return nil, false + } + return &o.By, true +} + +// HasBy returns a boolean if a field has been set. +func (o *LogsAggregateBucket) HasBy() bool { + if o != nil && o.By != nil { + return true + } + + return false +} + +// SetBy gets a reference to the given map[string]string and assigns it to the By field. +func (o *LogsAggregateBucket) SetBy(v map[string]string) { + o.By = v +} + +// GetComputes returns the Computes field value if set, zero value otherwise. +func (o *LogsAggregateBucket) GetComputes() map[string]LogsAggregateBucketValue { + if o == nil || o.Computes == nil { + var ret map[string]LogsAggregateBucketValue + return ret + } + return o.Computes +} + +// GetComputesOk returns a tuple with the Computes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateBucket) GetComputesOk() (*map[string]LogsAggregateBucketValue, bool) { + if o == nil || o.Computes == nil { + return nil, false + } + return &o.Computes, true +} + +// HasComputes returns a boolean if a field has been set. +func (o *LogsAggregateBucket) HasComputes() bool { + if o != nil && o.Computes != nil { + return true + } + + return false +} + +// SetComputes gets a reference to the given map[string]LogsAggregateBucketValue and assigns it to the Computes field. +func (o *LogsAggregateBucket) SetComputes(v map[string]LogsAggregateBucketValue) { + o.Computes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateBucket) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.By != nil { + toSerialize["by"] = o.By + } + if o.Computes != nil { + toSerialize["computes"] = o.Computes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateBucket) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + By map[string]string `json:"by,omitempty"` + Computes map[string]LogsAggregateBucketValue `json:"computes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.By = all.By + o.Computes = all.Computes + return nil +} diff --git a/api/v2/datadog/model_logs_aggregate_bucket_value.go b/api/v2/datadog/model_logs_aggregate_bucket_value.go new file mode 100644 index 00000000000..e25bd57f126 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_bucket_value.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateBucketValue - A bucket value, can be either a timeseries or a single value +type LogsAggregateBucketValue struct { + LogsAggregateBucketValueSingleString *string + LogsAggregateBucketValueSingleNumber *float64 + LogsAggregateBucketValueTimeseries *LogsAggregateBucketValueTimeseries + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// LogsAggregateBucketValueSingleStringAsLogsAggregateBucketValue is a convenience function that returns string wrapped in LogsAggregateBucketValue. +func LogsAggregateBucketValueSingleStringAsLogsAggregateBucketValue(v *string) LogsAggregateBucketValue { + return LogsAggregateBucketValue{LogsAggregateBucketValueSingleString: v} +} + +// LogsAggregateBucketValueSingleNumberAsLogsAggregateBucketValue is a convenience function that returns float64 wrapped in LogsAggregateBucketValue. +func LogsAggregateBucketValueSingleNumberAsLogsAggregateBucketValue(v *float64) LogsAggregateBucketValue { + return LogsAggregateBucketValue{LogsAggregateBucketValueSingleNumber: v} +} + +// LogsAggregateBucketValueTimeseriesAsLogsAggregateBucketValue is a convenience function that returns LogsAggregateBucketValueTimeseries wrapped in LogsAggregateBucketValue. +func LogsAggregateBucketValueTimeseriesAsLogsAggregateBucketValue(v *LogsAggregateBucketValueTimeseries) LogsAggregateBucketValue { + return LogsAggregateBucketValue{LogsAggregateBucketValueTimeseries: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *LogsAggregateBucketValue) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into LogsAggregateBucketValueSingleString + err = json.Unmarshal(data, &obj.LogsAggregateBucketValueSingleString) + if err == nil { + if obj.LogsAggregateBucketValueSingleString != nil { + jsonLogsAggregateBucketValueSingleString, _ := json.Marshal(obj.LogsAggregateBucketValueSingleString) + if string(jsonLogsAggregateBucketValueSingleString) == "{}" { // empty struct + obj.LogsAggregateBucketValueSingleString = nil + } else { + match++ + } + } else { + obj.LogsAggregateBucketValueSingleString = nil + } + } else { + obj.LogsAggregateBucketValueSingleString = nil + } + + // try to unmarshal data into LogsAggregateBucketValueSingleNumber + err = json.Unmarshal(data, &obj.LogsAggregateBucketValueSingleNumber) + if err == nil { + if obj.LogsAggregateBucketValueSingleNumber != nil { + jsonLogsAggregateBucketValueSingleNumber, _ := json.Marshal(obj.LogsAggregateBucketValueSingleNumber) + if string(jsonLogsAggregateBucketValueSingleNumber) == "{}" { // empty struct + obj.LogsAggregateBucketValueSingleNumber = nil + } else { + match++ + } + } else { + obj.LogsAggregateBucketValueSingleNumber = nil + } + } else { + obj.LogsAggregateBucketValueSingleNumber = nil + } + + // try to unmarshal data into LogsAggregateBucketValueTimeseries + err = json.Unmarshal(data, &obj.LogsAggregateBucketValueTimeseries) + if err == nil { + if obj.LogsAggregateBucketValueTimeseries != nil { + jsonLogsAggregateBucketValueTimeseries, _ := json.Marshal(obj.LogsAggregateBucketValueTimeseries) + if string(jsonLogsAggregateBucketValueTimeseries) == "{}" { // empty struct + obj.LogsAggregateBucketValueTimeseries = nil + } else { + match++ + } + } else { + obj.LogsAggregateBucketValueTimeseries = nil + } + } else { + obj.LogsAggregateBucketValueTimeseries = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.LogsAggregateBucketValueSingleString = nil + obj.LogsAggregateBucketValueSingleNumber = nil + obj.LogsAggregateBucketValueTimeseries = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj LogsAggregateBucketValue) MarshalJSON() ([]byte, error) { + if obj.LogsAggregateBucketValueSingleString != nil { + return json.Marshal(&obj.LogsAggregateBucketValueSingleString) + } + + if obj.LogsAggregateBucketValueSingleNumber != nil { + return json.Marshal(&obj.LogsAggregateBucketValueSingleNumber) + } + + if obj.LogsAggregateBucketValueTimeseries != nil { + return json.Marshal(&obj.LogsAggregateBucketValueTimeseries) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *LogsAggregateBucketValue) GetActualInstance() interface{} { + if obj.LogsAggregateBucketValueSingleString != nil { + return obj.LogsAggregateBucketValueSingleString + } + + if obj.LogsAggregateBucketValueSingleNumber != nil { + return obj.LogsAggregateBucketValueSingleNumber + } + + if obj.LogsAggregateBucketValueTimeseries != nil { + return obj.LogsAggregateBucketValueTimeseries + } + + // all schemas are nil + return nil +} + +// NullableLogsAggregateBucketValue handles when a null is used for LogsAggregateBucketValue. +type NullableLogsAggregateBucketValue struct { + value *LogsAggregateBucketValue + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsAggregateBucketValue) Get() *LogsAggregateBucketValue { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsAggregateBucketValue) Set(val *LogsAggregateBucketValue) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsAggregateBucketValue) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableLogsAggregateBucketValue) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsAggregateBucketValue initializes the struct as if Set has been called. +func NewNullableLogsAggregateBucketValue(val *LogsAggregateBucketValue) *NullableLogsAggregateBucketValue { + return &NullableLogsAggregateBucketValue{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsAggregateBucketValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsAggregateBucketValue) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go b/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go new file mode 100644 index 00000000000..a81b67f1d16 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries.go @@ -0,0 +1,51 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateBucketValueTimeseries A timeseries array +type LogsAggregateBucketValueTimeseries struct { + Items []LogsAggregateBucketValueTimeseriesPoint + + // UnparsedObject contains the raw value of the array if there was an error when deserializing into the struct + UnparsedObject []interface{} `json:-` +} + +// NewLogsAggregateBucketValueTimeseries instantiates a new LogsAggregateBucketValueTimeseries 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 NewLogsAggregateBucketValueTimeseries() *LogsAggregateBucketValueTimeseries { + this := LogsAggregateBucketValueTimeseries{} + return &this +} + +// NewLogsAggregateBucketValueTimeseriesWithDefaults instantiates a new LogsAggregateBucketValueTimeseries 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 NewLogsAggregateBucketValueTimeseriesWithDefaults() *LogsAggregateBucketValueTimeseries { + this := LogsAggregateBucketValueTimeseries{} + return &this +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { + toSerialize := make([]interface{}, len(o.Items)) + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + for i, item := range o.Items { + toSerialize[i] = item + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { + return json.Unmarshal(bytes, &o.Items) +} diff --git a/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go b/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go new file mode 100644 index 00000000000..4fa5450c2de --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_bucket_value_timeseries_point.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateBucketValueTimeseriesPoint A timeseries point +type LogsAggregateBucketValueTimeseriesPoint struct { + // The time value for this point + Time *string `json:"time,omitempty"` + // The value for this point + Value *float64 `json:"value,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{} +} + +// NewLogsAggregateBucketValueTimeseriesPoint instantiates a new LogsAggregateBucketValueTimeseriesPoint 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 NewLogsAggregateBucketValueTimeseriesPoint() *LogsAggregateBucketValueTimeseriesPoint { + this := LogsAggregateBucketValueTimeseriesPoint{} + return &this +} + +// NewLogsAggregateBucketValueTimeseriesPointWithDefaults instantiates a new LogsAggregateBucketValueTimeseriesPoint 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 NewLogsAggregateBucketValueTimeseriesPointWithDefaults() *LogsAggregateBucketValueTimeseriesPoint { + this := LogsAggregateBucketValueTimeseriesPoint{} + return &this +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *LogsAggregateBucketValueTimeseriesPoint) GetTime() string { + if o == nil || o.Time == nil { + var ret string + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateBucketValueTimeseriesPoint) GetTimeOk() (*string, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *LogsAggregateBucketValueTimeseriesPoint) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given string and assigns it to the Time field. +func (o *LogsAggregateBucketValueTimeseriesPoint) SetTime(v string) { + o.Time = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *LogsAggregateBucketValueTimeseriesPoint) GetValue() float64 { + if o == nil || o.Value == nil { + var ret float64 + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateBucketValueTimeseriesPoint) GetValueOk() (*float64, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *LogsAggregateBucketValueTimeseriesPoint) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given float64 and assigns it to the Value field. +func (o *LogsAggregateBucketValueTimeseriesPoint) SetValue(v float64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Time != nil { + toSerialize["time"] = o.Time + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Time *string `json:"time,omitempty"` + Value *float64 `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Time = all.Time + o.Value = all.Value + return nil +} diff --git a/api/v2/datadog/model_logs_aggregate_request.go b/api/v2/datadog/model_logs_aggregate_request.go new file mode 100644 index 00000000000..88fb087efc2 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_request.go @@ -0,0 +1,280 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateRequest The object sent with the request to retrieve a list of logs from your organization. +type LogsAggregateRequest struct { + // The list of metrics or timeseries to compute for the retrieved buckets. + Compute []LogsCompute `json:"compute,omitempty"` + // The search and filter query settings + Filter *LogsQueryFilter `json:"filter,omitempty"` + // The rules for the group by + GroupBy []LogsGroupBy `json:"group_by,omitempty"` + // Global query options that are used during the query. + // Note: You should only supply timezone or time offset but not both otherwise the query will fail. + Options *LogsQueryOptions `json:"options,omitempty"` + // Paging settings + Page *LogsAggregateRequestPage `json:"page,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{} +} + +// NewLogsAggregateRequest instantiates a new LogsAggregateRequest 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 NewLogsAggregateRequest() *LogsAggregateRequest { + this := LogsAggregateRequest{} + return &this +} + +// NewLogsAggregateRequestWithDefaults instantiates a new LogsAggregateRequest 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 NewLogsAggregateRequestWithDefaults() *LogsAggregateRequest { + this := LogsAggregateRequest{} + return &this +} + +// GetCompute returns the Compute field value if set, zero value otherwise. +func (o *LogsAggregateRequest) GetCompute() []LogsCompute { + if o == nil || o.Compute == nil { + var ret []LogsCompute + return ret + } + return o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateRequest) GetComputeOk() (*[]LogsCompute, bool) { + if o == nil || o.Compute == nil { + return nil, false + } + return &o.Compute, true +} + +// HasCompute returns a boolean if a field has been set. +func (o *LogsAggregateRequest) HasCompute() bool { + if o != nil && o.Compute != nil { + return true + } + + return false +} + +// SetCompute gets a reference to the given []LogsCompute and assigns it to the Compute field. +func (o *LogsAggregateRequest) SetCompute(v []LogsCompute) { + o.Compute = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsAggregateRequest) GetFilter() LogsQueryFilter { + if o == nil || o.Filter == nil { + var ret LogsQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateRequest) GetFilterOk() (*LogsQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsAggregateRequest) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsQueryFilter and assigns it to the Filter field. +func (o *LogsAggregateRequest) SetFilter(v LogsQueryFilter) { + o.Filter = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *LogsAggregateRequest) GetGroupBy() []LogsGroupBy { + if o == nil || o.GroupBy == nil { + var ret []LogsGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateRequest) GetGroupByOk() (*[]LogsGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *LogsAggregateRequest) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []LogsGroupBy and assigns it to the GroupBy field. +func (o *LogsAggregateRequest) SetGroupBy(v []LogsGroupBy) { + o.GroupBy = v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *LogsAggregateRequest) GetOptions() LogsQueryOptions { + if o == nil || o.Options == nil { + var ret LogsQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateRequest) GetOptionsOk() (*LogsQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *LogsAggregateRequest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given LogsQueryOptions and assigns it to the Options field. +func (o *LogsAggregateRequest) SetOptions(v LogsQueryOptions) { + o.Options = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *LogsAggregateRequest) GetPage() LogsAggregateRequestPage { + if o == nil || o.Page == nil { + var ret LogsAggregateRequestPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateRequest) GetPageOk() (*LogsAggregateRequestPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *LogsAggregateRequest) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given LogsAggregateRequestPage and assigns it to the Page field. +func (o *LogsAggregateRequest) SetPage(v LogsAggregateRequestPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Compute != nil { + toSerialize["compute"] = o.Compute + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Compute []LogsCompute `json:"compute,omitempty"` + Filter *LogsQueryFilter `json:"filter,omitempty"` + GroupBy []LogsGroupBy `json:"group_by,omitempty"` + Options *LogsQueryOptions `json:"options,omitempty"` + Page *LogsAggregateRequestPage `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Compute = all.Compute + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.GroupBy = all.GroupBy + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v2/datadog/model_logs_aggregate_request_page.go b/api/v2/datadog/model_logs_aggregate_request_page.go new file mode 100644 index 00000000000..babf5dc3535 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_request_page.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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateRequestPage Paging settings +type LogsAggregateRequestPage struct { + // The returned paging point to use to get the next results + Cursor *string `json:"cursor,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{} +} + +// NewLogsAggregateRequestPage instantiates a new LogsAggregateRequestPage 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 NewLogsAggregateRequestPage() *LogsAggregateRequestPage { + this := LogsAggregateRequestPage{} + return &this +} + +// NewLogsAggregateRequestPageWithDefaults instantiates a new LogsAggregateRequestPage 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 NewLogsAggregateRequestPageWithDefaults() *LogsAggregateRequestPage { + this := LogsAggregateRequestPage{} + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *LogsAggregateRequestPage) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateRequestPage) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *LogsAggregateRequestPage) HasCursor() bool { + if o != nil && o.Cursor != nil { + return true + } + + return false +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *LogsAggregateRequestPage) SetCursor(v string) { + o.Cursor = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateRequestPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateRequestPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cursor *string `json:"cursor,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cursor = all.Cursor + return nil +} diff --git a/api/v2/datadog/model_logs_aggregate_response.go b/api/v2/datadog/model_logs_aggregate_response.go new file mode 100644 index 00000000000..53b005d7b4a --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_response.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateResponse The response object for the logs aggregate API endpoint +type LogsAggregateResponse struct { + // The query results + Data *LogsAggregateResponseData `json:"data,omitempty"` + // The metadata associated with a request + Meta *LogsResponseMetadata `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{} +} + +// NewLogsAggregateResponse instantiates a new LogsAggregateResponse 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 NewLogsAggregateResponse() *LogsAggregateResponse { + this := LogsAggregateResponse{} + return &this +} + +// NewLogsAggregateResponseWithDefaults instantiates a new LogsAggregateResponse 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 NewLogsAggregateResponseWithDefaults() *LogsAggregateResponse { + this := LogsAggregateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsAggregateResponse) GetData() LogsAggregateResponseData { + if o == nil || o.Data == nil { + var ret LogsAggregateResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateResponse) GetDataOk() (*LogsAggregateResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsAggregateResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given LogsAggregateResponseData and assigns it to the Data field. +func (o *LogsAggregateResponse) SetData(v LogsAggregateResponseData) { + o.Data = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *LogsAggregateResponse) GetMeta() LogsResponseMetadata { + if o == nil || o.Meta == nil { + var ret LogsResponseMetadata + 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 *LogsAggregateResponse) GetMetaOk() (*LogsResponseMetadata, 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 *LogsAggregateResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given LogsResponseMetadata and assigns it to the Meta field. +func (o *LogsAggregateResponse) SetMeta(v LogsResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *LogsAggregateResponseData `json:"data,omitempty"` + Meta *LogsResponseMetadata `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_logs_aggregate_response_data.go b/api/v2/datadog/model_logs_aggregate_response_data.go new file mode 100644 index 00000000000..2faf0815cd1 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_response_data.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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateResponseData The query results +type LogsAggregateResponseData struct { + // The list of matching buckets, one item per bucket + Buckets []LogsAggregateBucket `json:"buckets,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{} +} + +// NewLogsAggregateResponseData instantiates a new LogsAggregateResponseData 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 NewLogsAggregateResponseData() *LogsAggregateResponseData { + this := LogsAggregateResponseData{} + return &this +} + +// NewLogsAggregateResponseDataWithDefaults instantiates a new LogsAggregateResponseData 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 NewLogsAggregateResponseDataWithDefaults() *LogsAggregateResponseData { + this := LogsAggregateResponseData{} + return &this +} + +// GetBuckets returns the Buckets field value if set, zero value otherwise. +func (o *LogsAggregateResponseData) GetBuckets() []LogsAggregateBucket { + if o == nil || o.Buckets == nil { + var ret []LogsAggregateBucket + return ret + } + return o.Buckets +} + +// GetBucketsOk returns a tuple with the Buckets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateResponseData) GetBucketsOk() (*[]LogsAggregateBucket, bool) { + if o == nil || o.Buckets == nil { + return nil, false + } + return &o.Buckets, true +} + +// HasBuckets returns a boolean if a field has been set. +func (o *LogsAggregateResponseData) HasBuckets() bool { + if o != nil && o.Buckets != nil { + return true + } + + return false +} + +// SetBuckets gets a reference to the given []LogsAggregateBucket and assigns it to the Buckets field. +func (o *LogsAggregateResponseData) SetBuckets(v []LogsAggregateBucket) { + o.Buckets = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Buckets != nil { + toSerialize["buckets"] = o.Buckets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Buckets []LogsAggregateBucket `json:"buckets,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Buckets = all.Buckets + return nil +} diff --git a/api/v2/datadog/model_logs_aggregate_response_status.go b/api/v2/datadog/model_logs_aggregate_response_status.go new file mode 100644 index 00000000000..8f3e86e7100 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_response_status.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsAggregateResponseStatus The status of the response +type LogsAggregateResponseStatus string + +// List of LogsAggregateResponseStatus. +const ( + LOGSAGGREGATERESPONSESTATUS_DONE LogsAggregateResponseStatus = "done" + LOGSAGGREGATERESPONSESTATUS_TIMEOUT LogsAggregateResponseStatus = "timeout" +) + +var allowedLogsAggregateResponseStatusEnumValues = []LogsAggregateResponseStatus{ + LOGSAGGREGATERESPONSESTATUS_DONE, + LOGSAGGREGATERESPONSESTATUS_TIMEOUT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsAggregateResponseStatus) GetAllowedValues() []LogsAggregateResponseStatus { + return allowedLogsAggregateResponseStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsAggregateResponseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsAggregateResponseStatus(value) + return nil +} + +// NewLogsAggregateResponseStatusFromValue returns a pointer to a valid LogsAggregateResponseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsAggregateResponseStatusFromValue(v string) (*LogsAggregateResponseStatus, error) { + ev := LogsAggregateResponseStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsAggregateResponseStatus: valid values are %v", v, allowedLogsAggregateResponseStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsAggregateResponseStatus) IsValid() bool { + for _, existing := range allowedLogsAggregateResponseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsAggregateResponseStatus value. +func (v LogsAggregateResponseStatus) Ptr() *LogsAggregateResponseStatus { + return &v +} + +// NullableLogsAggregateResponseStatus handles when a null is used for LogsAggregateResponseStatus. +type NullableLogsAggregateResponseStatus struct { + value *LogsAggregateResponseStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsAggregateResponseStatus) Get() *LogsAggregateResponseStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsAggregateResponseStatus) Set(val *LogsAggregateResponseStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsAggregateResponseStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsAggregateResponseStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsAggregateResponseStatus initializes the struct as if Set has been called. +func NewNullableLogsAggregateResponseStatus(val *LogsAggregateResponseStatus) *NullableLogsAggregateResponseStatus { + return &NullableLogsAggregateResponseStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsAggregateResponseStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsAggregateResponseStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_aggregate_sort.go b/api/v2/datadog/model_logs_aggregate_sort.go new file mode 100644 index 00000000000..a01e8ce63a6 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_sort.go @@ -0,0 +1,247 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsAggregateSort A sort rule +type LogsAggregateSort struct { + // An aggregation function + Aggregation *LogsAggregationFunction `json:"aggregation,omitempty"` + // The metric to sort by (only used for `type=measure`) + Metric *string `json:"metric,omitempty"` + // The order to use, ascending or descending + Order *LogsSortOrder `json:"order,omitempty"` + // The type of sorting algorithm + Type *LogsAggregateSortType `json:"type,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{} +} + +// NewLogsAggregateSort instantiates a new LogsAggregateSort 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 NewLogsAggregateSort() *LogsAggregateSort { + this := LogsAggregateSort{} + var typeVar LogsAggregateSortType = LOGSAGGREGATESORTTYPE_ALPHABETICAL + this.Type = &typeVar + return &this +} + +// NewLogsAggregateSortWithDefaults instantiates a new LogsAggregateSort 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 NewLogsAggregateSortWithDefaults() *LogsAggregateSort { + this := LogsAggregateSort{} + var typeVar LogsAggregateSortType = LOGSAGGREGATESORTTYPE_ALPHABETICAL + this.Type = &typeVar + return &this +} + +// GetAggregation returns the Aggregation field value if set, zero value otherwise. +func (o *LogsAggregateSort) GetAggregation() LogsAggregationFunction { + if o == nil || o.Aggregation == nil { + var ret LogsAggregationFunction + return ret + } + return *o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateSort) GetAggregationOk() (*LogsAggregationFunction, bool) { + if o == nil || o.Aggregation == nil { + return nil, false + } + return o.Aggregation, true +} + +// HasAggregation returns a boolean if a field has been set. +func (o *LogsAggregateSort) HasAggregation() bool { + if o != nil && o.Aggregation != nil { + return true + } + + return false +} + +// SetAggregation gets a reference to the given LogsAggregationFunction and assigns it to the Aggregation field. +func (o *LogsAggregateSort) SetAggregation(v LogsAggregationFunction) { + o.Aggregation = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *LogsAggregateSort) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateSort) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *LogsAggregateSort) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *LogsAggregateSort) SetMetric(v string) { + o.Metric = &v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *LogsAggregateSort) GetOrder() LogsSortOrder { + if o == nil || o.Order == nil { + var ret LogsSortOrder + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateSort) GetOrderOk() (*LogsSortOrder, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *LogsAggregateSort) HasOrder() bool { + if o != nil && o.Order != nil { + return true + } + + return false +} + +// SetOrder gets a reference to the given LogsSortOrder and assigns it to the Order field. +func (o *LogsAggregateSort) SetOrder(v LogsSortOrder) { + o.Order = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LogsAggregateSort) GetType() LogsAggregateSortType { + if o == nil || o.Type == nil { + var ret LogsAggregateSortType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsAggregateSort) GetTypeOk() (*LogsAggregateSortType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LogsAggregateSort) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given LogsAggregateSortType and assigns it to the Type field. +func (o *LogsAggregateSort) SetType(v LogsAggregateSortType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsAggregateSort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregation != nil { + toSerialize["aggregation"] = o.Aggregation + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Order != nil { + toSerialize["order"] = o.Order + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsAggregateSort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregation *LogsAggregationFunction `json:"aggregation,omitempty"` + Metric *string `json:"metric,omitempty"` + Order *LogsSortOrder `json:"order,omitempty"` + Type *LogsAggregateSortType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Metric = all.Metric + o.Order = all.Order + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_aggregate_sort_type.go b/api/v2/datadog/model_logs_aggregate_sort_type.go new file mode 100644 index 00000000000..769a96d0602 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregate_sort_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsAggregateSortType The type of sorting algorithm +type LogsAggregateSortType string + +// List of LogsAggregateSortType. +const ( + LOGSAGGREGATESORTTYPE_ALPHABETICAL LogsAggregateSortType = "alphabetical" + LOGSAGGREGATESORTTYPE_MEASURE LogsAggregateSortType = "measure" +) + +var allowedLogsAggregateSortTypeEnumValues = []LogsAggregateSortType{ + LOGSAGGREGATESORTTYPE_ALPHABETICAL, + LOGSAGGREGATESORTTYPE_MEASURE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsAggregateSortType) GetAllowedValues() []LogsAggregateSortType { + return allowedLogsAggregateSortTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsAggregateSortType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsAggregateSortType(value) + return nil +} + +// NewLogsAggregateSortTypeFromValue returns a pointer to a valid LogsAggregateSortType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsAggregateSortTypeFromValue(v string) (*LogsAggregateSortType, error) { + ev := LogsAggregateSortType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsAggregateSortType: valid values are %v", v, allowedLogsAggregateSortTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsAggregateSortType) IsValid() bool { + for _, existing := range allowedLogsAggregateSortTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsAggregateSortType value. +func (v LogsAggregateSortType) Ptr() *LogsAggregateSortType { + return &v +} + +// NullableLogsAggregateSortType handles when a null is used for LogsAggregateSortType. +type NullableLogsAggregateSortType struct { + value *LogsAggregateSortType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsAggregateSortType) Get() *LogsAggregateSortType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsAggregateSortType) Set(val *LogsAggregateSortType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsAggregateSortType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsAggregateSortType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsAggregateSortType initializes the struct as if Set has been called. +func NewNullableLogsAggregateSortType(val *LogsAggregateSortType) *NullableLogsAggregateSortType { + return &NullableLogsAggregateSortType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsAggregateSortType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsAggregateSortType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_aggregation_function.go b/api/v2/datadog/model_logs_aggregation_function.go new file mode 100644 index 00000000000..f602242f4b7 --- /dev/null +++ b/api/v2/datadog/model_logs_aggregation_function.go @@ -0,0 +1,129 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsAggregationFunction An aggregation function +type LogsAggregationFunction string + +// List of LogsAggregationFunction. +const ( + LOGSAGGREGATIONFUNCTION_COUNT LogsAggregationFunction = "count" + LOGSAGGREGATIONFUNCTION_CARDINALITY LogsAggregationFunction = "cardinality" + LOGSAGGREGATIONFUNCTION_PERCENTILE_75 LogsAggregationFunction = "pc75" + LOGSAGGREGATIONFUNCTION_PERCENTILE_90 LogsAggregationFunction = "pc90" + LOGSAGGREGATIONFUNCTION_PERCENTILE_95 LogsAggregationFunction = "pc95" + LOGSAGGREGATIONFUNCTION_PERCENTILE_98 LogsAggregationFunction = "pc98" + LOGSAGGREGATIONFUNCTION_PERCENTILE_99 LogsAggregationFunction = "pc99" + LOGSAGGREGATIONFUNCTION_SUM LogsAggregationFunction = "sum" + LOGSAGGREGATIONFUNCTION_MIN LogsAggregationFunction = "min" + LOGSAGGREGATIONFUNCTION_MAX LogsAggregationFunction = "max" + LOGSAGGREGATIONFUNCTION_AVG LogsAggregationFunction = "avg" + LOGSAGGREGATIONFUNCTION_MEDIAN LogsAggregationFunction = "median" +) + +var allowedLogsAggregationFunctionEnumValues = []LogsAggregationFunction{ + LOGSAGGREGATIONFUNCTION_COUNT, + LOGSAGGREGATIONFUNCTION_CARDINALITY, + LOGSAGGREGATIONFUNCTION_PERCENTILE_75, + LOGSAGGREGATIONFUNCTION_PERCENTILE_90, + LOGSAGGREGATIONFUNCTION_PERCENTILE_95, + LOGSAGGREGATIONFUNCTION_PERCENTILE_98, + LOGSAGGREGATIONFUNCTION_PERCENTILE_99, + LOGSAGGREGATIONFUNCTION_SUM, + LOGSAGGREGATIONFUNCTION_MIN, + LOGSAGGREGATIONFUNCTION_MAX, + LOGSAGGREGATIONFUNCTION_AVG, + LOGSAGGREGATIONFUNCTION_MEDIAN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsAggregationFunction) GetAllowedValues() []LogsAggregationFunction { + return allowedLogsAggregationFunctionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsAggregationFunction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsAggregationFunction(value) + return nil +} + +// NewLogsAggregationFunctionFromValue returns a pointer to a valid LogsAggregationFunction +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsAggregationFunctionFromValue(v string) (*LogsAggregationFunction, error) { + ev := LogsAggregationFunction(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsAggregationFunction: valid values are %v", v, allowedLogsAggregationFunctionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsAggregationFunction) IsValid() bool { + for _, existing := range allowedLogsAggregationFunctionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsAggregationFunction value. +func (v LogsAggregationFunction) Ptr() *LogsAggregationFunction { + return &v +} + +// NullableLogsAggregationFunction handles when a null is used for LogsAggregationFunction. +type NullableLogsAggregationFunction struct { + value *LogsAggregationFunction + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsAggregationFunction) Get() *LogsAggregationFunction { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsAggregationFunction) Set(val *LogsAggregationFunction) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsAggregationFunction) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsAggregationFunction) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsAggregationFunction initializes the struct as if Set has been called. +func NewNullableLogsAggregationFunction(val *LogsAggregationFunction) *NullableLogsAggregationFunction { + return &NullableLogsAggregationFunction{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsAggregationFunction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsAggregationFunction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archive.go b/api/v2/datadog/model_logs_archive.go new file mode 100644 index 00000000000..53aafcd7cd5 --- /dev/null +++ b/api/v2/datadog/model_logs_archive.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsArchive The logs archive. +type LogsArchive struct { + // The definition of an archive. + Data *LogsArchiveDefinition `json:"data,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{} +} + +// NewLogsArchive instantiates a new LogsArchive 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 NewLogsArchive() *LogsArchive { + this := LogsArchive{} + return &this +} + +// NewLogsArchiveWithDefaults instantiates a new LogsArchive 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 NewLogsArchiveWithDefaults() *LogsArchive { + this := LogsArchive{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsArchive) GetData() LogsArchiveDefinition { + if o == nil || o.Data == nil { + var ret LogsArchiveDefinition + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchive) GetDataOk() (*LogsArchiveDefinition, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsArchive) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given LogsArchiveDefinition and assigns it to the Data field. +func (o *LogsArchive) SetData(v LogsArchiveDefinition) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchive) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchive) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *LogsArchiveDefinition `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_archive_attributes.go b/api/v2/datadog/model_logs_archive_attributes.go new file mode 100644 index 00000000000..03ec96fc7c9 --- /dev/null +++ b/api/v2/datadog/model_logs_archive_attributes.go @@ -0,0 +1,353 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsArchiveAttributes The attributes associated with the archive. +type LogsArchiveAttributes struct { + // An archive's destination. + Destination NullableLogsArchiveDestination `json:"destination"` + // To store the tags in the archive, set the value "true". + // If it is set to "false", the tags will be deleted when the logs are sent to the archive. + IncludeTags *bool `json:"include_tags,omitempty"` + // The archive name. + Name string `json:"name"` + // The archive query/filter. Logs matching this query are included in the archive. + Query string `json:"query"` + // Maximum scan size for rehydration from this archive. + RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` + // An array of tags to add to rehydrated logs from an archive. + RehydrationTags []string `json:"rehydration_tags,omitempty"` + // The state of the archive. + State *LogsArchiveState `json:"state,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{} +} + +// NewLogsArchiveAttributes instantiates a new LogsArchiveAttributes 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 NewLogsArchiveAttributes(destination NullableLogsArchiveDestination, name string, query string) *LogsArchiveAttributes { + this := LogsArchiveAttributes{} + this.Destination = destination + var includeTags bool = false + this.IncludeTags = &includeTags + this.Name = name + this.Query = query + return &this +} + +// NewLogsArchiveAttributesWithDefaults instantiates a new LogsArchiveAttributes 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 NewLogsArchiveAttributesWithDefaults() *LogsArchiveAttributes { + this := LogsArchiveAttributes{} + var includeTags bool = false + this.IncludeTags = &includeTags + return &this +} + +// GetDestination returns the Destination field value. +// If the value is explicit nil, the zero value for LogsArchiveDestination will be returned. +func (o *LogsArchiveAttributes) GetDestination() LogsArchiveDestination { + if o == nil || o.Destination.Get() == nil { + var ret LogsArchiveDestination + return ret + } + return *o.Destination.Get() +} + +// GetDestinationOk returns a tuple with the Destination field value +// 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 *LogsArchiveAttributes) GetDestinationOk() (*LogsArchiveDestination, bool) { + if o == nil { + return nil, false + } + return o.Destination.Get(), o.Destination.IsSet() +} + +// SetDestination sets field value. +func (o *LogsArchiveAttributes) SetDestination(v LogsArchiveDestination) { + o.Destination.Set(&v) +} + +// GetIncludeTags returns the IncludeTags field value if set, zero value otherwise. +func (o *LogsArchiveAttributes) GetIncludeTags() bool { + if o == nil || o.IncludeTags == nil { + var ret bool + return ret + } + return *o.IncludeTags +} + +// GetIncludeTagsOk returns a tuple with the IncludeTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveAttributes) GetIncludeTagsOk() (*bool, bool) { + if o == nil || o.IncludeTags == nil { + return nil, false + } + return o.IncludeTags, true +} + +// HasIncludeTags returns a boolean if a field has been set. +func (o *LogsArchiveAttributes) HasIncludeTags() bool { + if o != nil && o.IncludeTags != nil { + return true + } + + return false +} + +// SetIncludeTags gets a reference to the given bool and assigns it to the IncludeTags field. +func (o *LogsArchiveAttributes) SetIncludeTags(v bool) { + o.IncludeTags = &v +} + +// GetName returns the Name field value. +func (o *LogsArchiveAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *LogsArchiveAttributes) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value. +func (o *LogsArchiveAttributes) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveAttributes) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *LogsArchiveAttributes) SetQuery(v string) { + o.Query = v +} + +// GetRehydrationMaxScanSizeInGb returns the RehydrationMaxScanSizeInGb field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LogsArchiveAttributes) GetRehydrationMaxScanSizeInGb() int64 { + if o == nil || o.RehydrationMaxScanSizeInGb.Get() == nil { + var ret int64 + return ret + } + return *o.RehydrationMaxScanSizeInGb.Get() +} + +// GetRehydrationMaxScanSizeInGbOk returns a tuple with the RehydrationMaxScanSizeInGb 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 *LogsArchiveAttributes) GetRehydrationMaxScanSizeInGbOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.RehydrationMaxScanSizeInGb.Get(), o.RehydrationMaxScanSizeInGb.IsSet() +} + +// HasRehydrationMaxScanSizeInGb returns a boolean if a field has been set. +func (o *LogsArchiveAttributes) HasRehydrationMaxScanSizeInGb() bool { + if o != nil && o.RehydrationMaxScanSizeInGb.IsSet() { + return true + } + + return false +} + +// SetRehydrationMaxScanSizeInGb gets a reference to the given common.NullableInt64 and assigns it to the RehydrationMaxScanSizeInGb field. +func (o *LogsArchiveAttributes) SetRehydrationMaxScanSizeInGb(v int64) { + o.RehydrationMaxScanSizeInGb.Set(&v) +} + +// SetRehydrationMaxScanSizeInGbNil sets the value for RehydrationMaxScanSizeInGb to be an explicit nil. +func (o *LogsArchiveAttributes) SetRehydrationMaxScanSizeInGbNil() { + o.RehydrationMaxScanSizeInGb.Set(nil) +} + +// UnsetRehydrationMaxScanSizeInGb ensures that no value is present for RehydrationMaxScanSizeInGb, not even an explicit nil. +func (o *LogsArchiveAttributes) UnsetRehydrationMaxScanSizeInGb() { + o.RehydrationMaxScanSizeInGb.Unset() +} + +// GetRehydrationTags returns the RehydrationTags field value if set, zero value otherwise. +func (o *LogsArchiveAttributes) GetRehydrationTags() []string { + if o == nil || o.RehydrationTags == nil { + var ret []string + return ret + } + return o.RehydrationTags +} + +// GetRehydrationTagsOk returns a tuple with the RehydrationTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveAttributes) GetRehydrationTagsOk() (*[]string, bool) { + if o == nil || o.RehydrationTags == nil { + return nil, false + } + return &o.RehydrationTags, true +} + +// HasRehydrationTags returns a boolean if a field has been set. +func (o *LogsArchiveAttributes) HasRehydrationTags() bool { + if o != nil && o.RehydrationTags != nil { + return true + } + + return false +} + +// SetRehydrationTags gets a reference to the given []string and assigns it to the RehydrationTags field. +func (o *LogsArchiveAttributes) SetRehydrationTags(v []string) { + o.RehydrationTags = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *LogsArchiveAttributes) GetState() LogsArchiveState { + if o == nil || o.State == nil { + var ret LogsArchiveState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveAttributes) GetStateOk() (*LogsArchiveState, bool) { + if o == nil || o.State == nil { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *LogsArchiveAttributes) HasState() bool { + if o != nil && o.State != nil { + return true + } + + return false +} + +// SetState gets a reference to the given LogsArchiveState and assigns it to the State field. +func (o *LogsArchiveAttributes) SetState(v LogsArchiveState) { + o.State = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["destination"] = o.Destination.Get() + if o.IncludeTags != nil { + toSerialize["include_tags"] = o.IncludeTags + } + toSerialize["name"] = o.Name + toSerialize["query"] = o.Query + if o.RehydrationMaxScanSizeInGb.IsSet() { + toSerialize["rehydration_max_scan_size_in_gb"] = o.RehydrationMaxScanSizeInGb.Get() + } + if o.RehydrationTags != nil { + toSerialize["rehydration_tags"] = o.RehydrationTags + } + if o.State != nil { + toSerialize["state"] = o.State + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Destination NullableLogsArchiveDestination `json:"destination"` + Name *string `json:"name"` + Query *string `json:"query"` + }{} + all := struct { + Destination NullableLogsArchiveDestination `json:"destination"` + IncludeTags *bool `json:"include_tags,omitempty"` + Name string `json:"name"` + Query string `json:"query"` + RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` + RehydrationTags []string `json:"rehydration_tags,omitempty"` + State *LogsArchiveState `json:"state,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if !required.Destination.IsSet() { + return fmt.Errorf("Required field destination missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.State; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Destination = all.Destination + o.IncludeTags = all.IncludeTags + o.Name = all.Name + o.Query = all.Query + o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb + o.RehydrationTags = all.RehydrationTags + o.State = all.State + return nil +} diff --git a/api/v2/datadog/model_logs_archive_create_request.go b/api/v2/datadog/model_logs_archive_create_request.go new file mode 100644 index 00000000000..66a7a8b4437 --- /dev/null +++ b/api/v2/datadog/model_logs_archive_create_request.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsArchiveCreateRequest The logs archive. +type LogsArchiveCreateRequest struct { + // The definition of an archive. + Data *LogsArchiveCreateRequestDefinition `json:"data,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{} +} + +// NewLogsArchiveCreateRequest instantiates a new LogsArchiveCreateRequest 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 NewLogsArchiveCreateRequest() *LogsArchiveCreateRequest { + this := LogsArchiveCreateRequest{} + return &this +} + +// NewLogsArchiveCreateRequestWithDefaults instantiates a new LogsArchiveCreateRequest 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 NewLogsArchiveCreateRequestWithDefaults() *LogsArchiveCreateRequest { + this := LogsArchiveCreateRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsArchiveCreateRequest) GetData() LogsArchiveCreateRequestDefinition { + if o == nil || o.Data == nil { + var ret LogsArchiveCreateRequestDefinition + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveCreateRequest) GetDataOk() (*LogsArchiveCreateRequestDefinition, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsArchiveCreateRequest) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given LogsArchiveCreateRequestDefinition and assigns it to the Data field. +func (o *LogsArchiveCreateRequest) SetData(v LogsArchiveCreateRequestDefinition) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *LogsArchiveCreateRequestDefinition `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_archive_create_request_attributes.go b/api/v2/datadog/model_logs_archive_create_request_attributes.go new file mode 100644 index 00000000000..38fb344104d --- /dev/null +++ b/api/v2/datadog/model_logs_archive_create_request_attributes.go @@ -0,0 +1,304 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// LogsArchiveCreateRequestAttributes The attributes associated with the archive. +type LogsArchiveCreateRequestAttributes struct { + // An archive's destination. + Destination LogsArchiveCreateRequestDestination `json:"destination"` + // To store the tags in the archive, set the value "true". + // If it is set to "false", the tags will be deleted when the logs are sent to the archive. + IncludeTags *bool `json:"include_tags,omitempty"` + // The archive name. + Name string `json:"name"` + // The archive query/filter. Logs matching this query are included in the archive. + Query string `json:"query"` + // Maximum scan size for rehydration from this archive. + RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` + // An array of tags to add to rehydrated logs from an archive. + RehydrationTags []string `json:"rehydration_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{} +} + +// NewLogsArchiveCreateRequestAttributes instantiates a new LogsArchiveCreateRequestAttributes 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 NewLogsArchiveCreateRequestAttributes(destination LogsArchiveCreateRequestDestination, name string, query string) *LogsArchiveCreateRequestAttributes { + this := LogsArchiveCreateRequestAttributes{} + this.Destination = destination + var includeTags bool = false + this.IncludeTags = &includeTags + this.Name = name + this.Query = query + return &this +} + +// NewLogsArchiveCreateRequestAttributesWithDefaults instantiates a new LogsArchiveCreateRequestAttributes 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 NewLogsArchiveCreateRequestAttributesWithDefaults() *LogsArchiveCreateRequestAttributes { + this := LogsArchiveCreateRequestAttributes{} + var includeTags bool = false + this.IncludeTags = &includeTags + return &this +} + +// GetDestination returns the Destination field value. +func (o *LogsArchiveCreateRequestAttributes) GetDestination() LogsArchiveCreateRequestDestination { + if o == nil { + var ret LogsArchiveCreateRequestDestination + return ret + } + return o.Destination +} + +// GetDestinationOk returns a tuple with the Destination field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveCreateRequestAttributes) GetDestinationOk() (*LogsArchiveCreateRequestDestination, bool) { + if o == nil { + return nil, false + } + return &o.Destination, true +} + +// SetDestination sets field value. +func (o *LogsArchiveCreateRequestAttributes) SetDestination(v LogsArchiveCreateRequestDestination) { + o.Destination = v +} + +// GetIncludeTags returns the IncludeTags field value if set, zero value otherwise. +func (o *LogsArchiveCreateRequestAttributes) GetIncludeTags() bool { + if o == nil || o.IncludeTags == nil { + var ret bool + return ret + } + return *o.IncludeTags +} + +// GetIncludeTagsOk returns a tuple with the IncludeTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveCreateRequestAttributes) GetIncludeTagsOk() (*bool, bool) { + if o == nil || o.IncludeTags == nil { + return nil, false + } + return o.IncludeTags, true +} + +// HasIncludeTags returns a boolean if a field has been set. +func (o *LogsArchiveCreateRequestAttributes) HasIncludeTags() bool { + if o != nil && o.IncludeTags != nil { + return true + } + + return false +} + +// SetIncludeTags gets a reference to the given bool and assigns it to the IncludeTags field. +func (o *LogsArchiveCreateRequestAttributes) SetIncludeTags(v bool) { + o.IncludeTags = &v +} + +// GetName returns the Name field value. +func (o *LogsArchiveCreateRequestAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveCreateRequestAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *LogsArchiveCreateRequestAttributes) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value. +func (o *LogsArchiveCreateRequestAttributes) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveCreateRequestAttributes) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *LogsArchiveCreateRequestAttributes) SetQuery(v string) { + o.Query = v +} + +// GetRehydrationMaxScanSizeInGb returns the RehydrationMaxScanSizeInGb field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LogsArchiveCreateRequestAttributes) GetRehydrationMaxScanSizeInGb() int64 { + if o == nil || o.RehydrationMaxScanSizeInGb.Get() == nil { + var ret int64 + return ret + } + return *o.RehydrationMaxScanSizeInGb.Get() +} + +// GetRehydrationMaxScanSizeInGbOk returns a tuple with the RehydrationMaxScanSizeInGb 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 *LogsArchiveCreateRequestAttributes) GetRehydrationMaxScanSizeInGbOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.RehydrationMaxScanSizeInGb.Get(), o.RehydrationMaxScanSizeInGb.IsSet() +} + +// HasRehydrationMaxScanSizeInGb returns a boolean if a field has been set. +func (o *LogsArchiveCreateRequestAttributes) HasRehydrationMaxScanSizeInGb() bool { + if o != nil && o.RehydrationMaxScanSizeInGb.IsSet() { + return true + } + + return false +} + +// SetRehydrationMaxScanSizeInGb gets a reference to the given common.NullableInt64 and assigns it to the RehydrationMaxScanSizeInGb field. +func (o *LogsArchiveCreateRequestAttributes) SetRehydrationMaxScanSizeInGb(v int64) { + o.RehydrationMaxScanSizeInGb.Set(&v) +} + +// SetRehydrationMaxScanSizeInGbNil sets the value for RehydrationMaxScanSizeInGb to be an explicit nil. +func (o *LogsArchiveCreateRequestAttributes) SetRehydrationMaxScanSizeInGbNil() { + o.RehydrationMaxScanSizeInGb.Set(nil) +} + +// UnsetRehydrationMaxScanSizeInGb ensures that no value is present for RehydrationMaxScanSizeInGb, not even an explicit nil. +func (o *LogsArchiveCreateRequestAttributes) UnsetRehydrationMaxScanSizeInGb() { + o.RehydrationMaxScanSizeInGb.Unset() +} + +// GetRehydrationTags returns the RehydrationTags field value if set, zero value otherwise. +func (o *LogsArchiveCreateRequestAttributes) GetRehydrationTags() []string { + if o == nil || o.RehydrationTags == nil { + var ret []string + return ret + } + return o.RehydrationTags +} + +// GetRehydrationTagsOk returns a tuple with the RehydrationTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveCreateRequestAttributes) GetRehydrationTagsOk() (*[]string, bool) { + if o == nil || o.RehydrationTags == nil { + return nil, false + } + return &o.RehydrationTags, true +} + +// HasRehydrationTags returns a boolean if a field has been set. +func (o *LogsArchiveCreateRequestAttributes) HasRehydrationTags() bool { + if o != nil && o.RehydrationTags != nil { + return true + } + + return false +} + +// SetRehydrationTags gets a reference to the given []string and assigns it to the RehydrationTags field. +func (o *LogsArchiveCreateRequestAttributes) SetRehydrationTags(v []string) { + o.RehydrationTags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["destination"] = o.Destination + if o.IncludeTags != nil { + toSerialize["include_tags"] = o.IncludeTags + } + toSerialize["name"] = o.Name + toSerialize["query"] = o.Query + if o.RehydrationMaxScanSizeInGb.IsSet() { + toSerialize["rehydration_max_scan_size_in_gb"] = o.RehydrationMaxScanSizeInGb.Get() + } + if o.RehydrationTags != nil { + toSerialize["rehydration_tags"] = o.RehydrationTags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Destination *LogsArchiveCreateRequestDestination `json:"destination"` + Name *string `json:"name"` + Query *string `json:"query"` + }{} + all := struct { + Destination LogsArchiveCreateRequestDestination `json:"destination"` + IncludeTags *bool `json:"include_tags,omitempty"` + Name string `json:"name"` + Query string `json:"query"` + RehydrationMaxScanSizeInGb common.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` + RehydrationTags []string `json:"rehydration_tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Destination == nil { + return fmt.Errorf("Required field destination missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Destination = all.Destination + o.IncludeTags = all.IncludeTags + o.Name = all.Name + o.Query = all.Query + o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb + o.RehydrationTags = all.RehydrationTags + return nil +} diff --git a/api/v2/datadog/model_logs_archive_create_request_definition.go b/api/v2/datadog/model_logs_archive_create_request_definition.go new file mode 100644 index 00000000000..be92fa5c16b --- /dev/null +++ b/api/v2/datadog/model_logs_archive_create_request_definition.go @@ -0,0 +1,151 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveCreateRequestDefinition The definition of an archive. +type LogsArchiveCreateRequestDefinition struct { + // The attributes associated with the archive. + Attributes *LogsArchiveCreateRequestAttributes `json:"attributes,omitempty"` + // The type of the resource. The value should always be archives. + 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{} +} + +// NewLogsArchiveCreateRequestDefinition instantiates a new LogsArchiveCreateRequestDefinition 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 NewLogsArchiveCreateRequestDefinition(typeVar string) *LogsArchiveCreateRequestDefinition { + this := LogsArchiveCreateRequestDefinition{} + this.Type = typeVar + return &this +} + +// NewLogsArchiveCreateRequestDefinitionWithDefaults instantiates a new LogsArchiveCreateRequestDefinition 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 NewLogsArchiveCreateRequestDefinitionWithDefaults() *LogsArchiveCreateRequestDefinition { + this := LogsArchiveCreateRequestDefinition{} + var typeVar string = "archives" + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *LogsArchiveCreateRequestDefinition) GetAttributes() LogsArchiveCreateRequestAttributes { + if o == nil || o.Attributes == nil { + var ret LogsArchiveCreateRequestAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveCreateRequestDefinition) GetAttributesOk() (*LogsArchiveCreateRequestAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *LogsArchiveCreateRequestDefinition) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given LogsArchiveCreateRequestAttributes and assigns it to the Attributes field. +func (o *LogsArchiveCreateRequestDefinition) SetAttributes(v LogsArchiveCreateRequestAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *LogsArchiveCreateRequestDefinition) 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 *LogsArchiveCreateRequestDefinition) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsArchiveCreateRequestDefinition) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveCreateRequestDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveCreateRequestDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *string `json:"type"` + }{} + all := struct { + Attributes *LogsArchiveCreateRequestAttributes `json:"attributes,omitempty"` + Type string `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_archive_create_request_destination.go b/api/v2/datadog/model_logs_archive_create_request_destination.go new file mode 100644 index 00000000000..e46e1ff9f2a --- /dev/null +++ b/api/v2/datadog/model_logs_archive_create_request_destination.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsArchiveCreateRequestDestination - An archive's destination. +type LogsArchiveCreateRequestDestination struct { + LogsArchiveDestinationAzure *LogsArchiveDestinationAzure + LogsArchiveDestinationGCS *LogsArchiveDestinationGCS + LogsArchiveDestinationS3 *LogsArchiveDestinationS3 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// LogsArchiveDestinationAzureAsLogsArchiveCreateRequestDestination is a convenience function that returns LogsArchiveDestinationAzure wrapped in LogsArchiveCreateRequestDestination. +func LogsArchiveDestinationAzureAsLogsArchiveCreateRequestDestination(v *LogsArchiveDestinationAzure) LogsArchiveCreateRequestDestination { + return LogsArchiveCreateRequestDestination{LogsArchiveDestinationAzure: v} +} + +// LogsArchiveDestinationGCSAsLogsArchiveCreateRequestDestination is a convenience function that returns LogsArchiveDestinationGCS wrapped in LogsArchiveCreateRequestDestination. +func LogsArchiveDestinationGCSAsLogsArchiveCreateRequestDestination(v *LogsArchiveDestinationGCS) LogsArchiveCreateRequestDestination { + return LogsArchiveCreateRequestDestination{LogsArchiveDestinationGCS: v} +} + +// LogsArchiveDestinationS3AsLogsArchiveCreateRequestDestination is a convenience function that returns LogsArchiveDestinationS3 wrapped in LogsArchiveCreateRequestDestination. +func LogsArchiveDestinationS3AsLogsArchiveCreateRequestDestination(v *LogsArchiveDestinationS3) LogsArchiveCreateRequestDestination { + return LogsArchiveCreateRequestDestination{LogsArchiveDestinationS3: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *LogsArchiveCreateRequestDestination) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into LogsArchiveDestinationAzure + err = json.Unmarshal(data, &obj.LogsArchiveDestinationAzure) + if err == nil { + if obj.LogsArchiveDestinationAzure != nil && obj.LogsArchiveDestinationAzure.UnparsedObject == nil { + jsonLogsArchiveDestinationAzure, _ := json.Marshal(obj.LogsArchiveDestinationAzure) + if string(jsonLogsArchiveDestinationAzure) == "{}" { // empty struct + obj.LogsArchiveDestinationAzure = nil + } else { + match++ + } + } else { + obj.LogsArchiveDestinationAzure = nil + } + } else { + obj.LogsArchiveDestinationAzure = nil + } + + // try to unmarshal data into LogsArchiveDestinationGCS + err = json.Unmarshal(data, &obj.LogsArchiveDestinationGCS) + if err == nil { + if obj.LogsArchiveDestinationGCS != nil && obj.LogsArchiveDestinationGCS.UnparsedObject == nil { + jsonLogsArchiveDestinationGCS, _ := json.Marshal(obj.LogsArchiveDestinationGCS) + if string(jsonLogsArchiveDestinationGCS) == "{}" { // empty struct + obj.LogsArchiveDestinationGCS = nil + } else { + match++ + } + } else { + obj.LogsArchiveDestinationGCS = nil + } + } else { + obj.LogsArchiveDestinationGCS = nil + } + + // try to unmarshal data into LogsArchiveDestinationS3 + err = json.Unmarshal(data, &obj.LogsArchiveDestinationS3) + if err == nil { + if obj.LogsArchiveDestinationS3 != nil && obj.LogsArchiveDestinationS3.UnparsedObject == nil { + jsonLogsArchiveDestinationS3, _ := json.Marshal(obj.LogsArchiveDestinationS3) + if string(jsonLogsArchiveDestinationS3) == "{}" { // empty struct + obj.LogsArchiveDestinationS3 = nil + } else { + match++ + } + } else { + obj.LogsArchiveDestinationS3 = nil + } + } else { + obj.LogsArchiveDestinationS3 = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.LogsArchiveDestinationAzure = nil + obj.LogsArchiveDestinationGCS = nil + obj.LogsArchiveDestinationS3 = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj LogsArchiveCreateRequestDestination) MarshalJSON() ([]byte, error) { + if obj.LogsArchiveDestinationAzure != nil { + return json.Marshal(&obj.LogsArchiveDestinationAzure) + } + + if obj.LogsArchiveDestinationGCS != nil { + return json.Marshal(&obj.LogsArchiveDestinationGCS) + } + + if obj.LogsArchiveDestinationS3 != nil { + return json.Marshal(&obj.LogsArchiveDestinationS3) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *LogsArchiveCreateRequestDestination) GetActualInstance() interface{} { + if obj.LogsArchiveDestinationAzure != nil { + return obj.LogsArchiveDestinationAzure + } + + if obj.LogsArchiveDestinationGCS != nil { + return obj.LogsArchiveDestinationGCS + } + + if obj.LogsArchiveDestinationS3 != nil { + return obj.LogsArchiveDestinationS3 + } + + // all schemas are nil + return nil +} + +// NullableLogsArchiveCreateRequestDestination handles when a null is used for LogsArchiveCreateRequestDestination. +type NullableLogsArchiveCreateRequestDestination struct { + value *LogsArchiveCreateRequestDestination + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArchiveCreateRequestDestination) Get() *LogsArchiveCreateRequestDestination { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArchiveCreateRequestDestination) Set(val *LogsArchiveCreateRequestDestination) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArchiveCreateRequestDestination) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableLogsArchiveCreateRequestDestination) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArchiveCreateRequestDestination initializes the struct as if Set has been called. +func NewNullableLogsArchiveCreateRequestDestination(val *LogsArchiveCreateRequestDestination) *NullableLogsArchiveCreateRequestDestination { + return &NullableLogsArchiveCreateRequestDestination{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArchiveCreateRequestDestination) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArchiveCreateRequestDestination) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archive_definition.go b/api/v2/datadog/model_logs_archive_definition.go new file mode 100644 index 00000000000..65680c1f08e --- /dev/null +++ b/api/v2/datadog/model_logs_archive_definition.go @@ -0,0 +1,188 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveDefinition The definition of an archive. +type LogsArchiveDefinition struct { + // The attributes associated with the archive. + Attributes *LogsArchiveAttributes `json:"attributes,omitempty"` + // The archive ID. + Id *string `json:"id,omitempty"` + // The type of the resource. The value should always be archives. + 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{} +} + +// NewLogsArchiveDefinition instantiates a new LogsArchiveDefinition 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 NewLogsArchiveDefinition(typeVar string) *LogsArchiveDefinition { + this := LogsArchiveDefinition{} + this.Type = typeVar + return &this +} + +// NewLogsArchiveDefinitionWithDefaults instantiates a new LogsArchiveDefinition 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 NewLogsArchiveDefinitionWithDefaults() *LogsArchiveDefinition { + this := LogsArchiveDefinition{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *LogsArchiveDefinition) GetAttributes() LogsArchiveAttributes { + if o == nil || o.Attributes == nil { + var ret LogsArchiveAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveDefinition) GetAttributesOk() (*LogsArchiveAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *LogsArchiveDefinition) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given LogsArchiveAttributes and assigns it to the Attributes field. +func (o *LogsArchiveDefinition) SetAttributes(v LogsArchiveAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *LogsArchiveDefinition) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveDefinition) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *LogsArchiveDefinition) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LogsArchiveDefinition) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *LogsArchiveDefinition) 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 *LogsArchiveDefinition) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsArchiveDefinition) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *string `json:"type"` + }{} + all := struct { + Attributes *LogsArchiveAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type string `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_archive_destination.go b/api/v2/datadog/model_logs_archive_destination.go new file mode 100644 index 00000000000..e4cbdfe521d --- /dev/null +++ b/api/v2/datadog/model_logs_archive_destination.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsArchiveDestination - An archive's destination. +type LogsArchiveDestination struct { + LogsArchiveDestinationAzure *LogsArchiveDestinationAzure + LogsArchiveDestinationGCS *LogsArchiveDestinationGCS + LogsArchiveDestinationS3 *LogsArchiveDestinationS3 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// LogsArchiveDestinationAzureAsLogsArchiveDestination is a convenience function that returns LogsArchiveDestinationAzure wrapped in LogsArchiveDestination. +func LogsArchiveDestinationAzureAsLogsArchiveDestination(v *LogsArchiveDestinationAzure) LogsArchiveDestination { + return LogsArchiveDestination{LogsArchiveDestinationAzure: v} +} + +// LogsArchiveDestinationGCSAsLogsArchiveDestination is a convenience function that returns LogsArchiveDestinationGCS wrapped in LogsArchiveDestination. +func LogsArchiveDestinationGCSAsLogsArchiveDestination(v *LogsArchiveDestinationGCS) LogsArchiveDestination { + return LogsArchiveDestination{LogsArchiveDestinationGCS: v} +} + +// LogsArchiveDestinationS3AsLogsArchiveDestination is a convenience function that returns LogsArchiveDestinationS3 wrapped in LogsArchiveDestination. +func LogsArchiveDestinationS3AsLogsArchiveDestination(v *LogsArchiveDestinationS3) LogsArchiveDestination { + return LogsArchiveDestination{LogsArchiveDestinationS3: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *LogsArchiveDestination) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into LogsArchiveDestinationAzure + err = json.Unmarshal(data, &obj.LogsArchiveDestinationAzure) + if err == nil { + if obj.LogsArchiveDestinationAzure != nil && obj.LogsArchiveDestinationAzure.UnparsedObject == nil { + jsonLogsArchiveDestinationAzure, _ := json.Marshal(obj.LogsArchiveDestinationAzure) + if string(jsonLogsArchiveDestinationAzure) == "{}" { // empty struct + obj.LogsArchiveDestinationAzure = nil + } else { + match++ + } + } else { + obj.LogsArchiveDestinationAzure = nil + } + } else { + obj.LogsArchiveDestinationAzure = nil + } + + // try to unmarshal data into LogsArchiveDestinationGCS + err = json.Unmarshal(data, &obj.LogsArchiveDestinationGCS) + if err == nil { + if obj.LogsArchiveDestinationGCS != nil && obj.LogsArchiveDestinationGCS.UnparsedObject == nil { + jsonLogsArchiveDestinationGCS, _ := json.Marshal(obj.LogsArchiveDestinationGCS) + if string(jsonLogsArchiveDestinationGCS) == "{}" { // empty struct + obj.LogsArchiveDestinationGCS = nil + } else { + match++ + } + } else { + obj.LogsArchiveDestinationGCS = nil + } + } else { + obj.LogsArchiveDestinationGCS = nil + } + + // try to unmarshal data into LogsArchiveDestinationS3 + err = json.Unmarshal(data, &obj.LogsArchiveDestinationS3) + if err == nil { + if obj.LogsArchiveDestinationS3 != nil && obj.LogsArchiveDestinationS3.UnparsedObject == nil { + jsonLogsArchiveDestinationS3, _ := json.Marshal(obj.LogsArchiveDestinationS3) + if string(jsonLogsArchiveDestinationS3) == "{}" { // empty struct + obj.LogsArchiveDestinationS3 = nil + } else { + match++ + } + } else { + obj.LogsArchiveDestinationS3 = nil + } + } else { + obj.LogsArchiveDestinationS3 = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.LogsArchiveDestinationAzure = nil + obj.LogsArchiveDestinationGCS = nil + obj.LogsArchiveDestinationS3 = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj LogsArchiveDestination) MarshalJSON() ([]byte, error) { + if obj.LogsArchiveDestinationAzure != nil { + return json.Marshal(&obj.LogsArchiveDestinationAzure) + } + + if obj.LogsArchiveDestinationGCS != nil { + return json.Marshal(&obj.LogsArchiveDestinationGCS) + } + + if obj.LogsArchiveDestinationS3 != nil { + return json.Marshal(&obj.LogsArchiveDestinationS3) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *LogsArchiveDestination) GetActualInstance() interface{} { + if obj.LogsArchiveDestinationAzure != nil { + return obj.LogsArchiveDestinationAzure + } + + if obj.LogsArchiveDestinationGCS != nil { + return obj.LogsArchiveDestinationGCS + } + + if obj.LogsArchiveDestinationS3 != nil { + return obj.LogsArchiveDestinationS3 + } + + // all schemas are nil + return nil +} + +// NullableLogsArchiveDestination handles when a null is used for LogsArchiveDestination. +type NullableLogsArchiveDestination struct { + value *LogsArchiveDestination + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArchiveDestination) Get() *LogsArchiveDestination { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArchiveDestination) Set(val *LogsArchiveDestination) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArchiveDestination) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableLogsArchiveDestination) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArchiveDestination initializes the struct as if Set has been called. +func NewNullableLogsArchiveDestination(val *LogsArchiveDestination) *NullableLogsArchiveDestination { + return &NullableLogsArchiveDestination{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArchiveDestination) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArchiveDestination) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archive_destination_azure.go b/api/v2/datadog/model_logs_archive_destination_azure.go new file mode 100644 index 00000000000..4d4be9c203d --- /dev/null +++ b/api/v2/datadog/model_logs_archive_destination_azure.go @@ -0,0 +1,297 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveDestinationAzure The Azure archive destination. +type LogsArchiveDestinationAzure struct { + // The container where the archive will be stored. + Container string `json:"container"` + // The Azure archive's integration destination. + Integration LogsArchiveIntegrationAzure `json:"integration"` + // The archive path. + Path *string `json:"path,omitempty"` + // The region where the archive will be stored. + Region *string `json:"region,omitempty"` + // The associated storage account. + StorageAccount string `json:"storage_account"` + // Type of the Azure archive destination. + Type LogsArchiveDestinationAzureType `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{} +} + +// NewLogsArchiveDestinationAzure instantiates a new LogsArchiveDestinationAzure 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 NewLogsArchiveDestinationAzure(container string, integration LogsArchiveIntegrationAzure, storageAccount string, typeVar LogsArchiveDestinationAzureType) *LogsArchiveDestinationAzure { + this := LogsArchiveDestinationAzure{} + this.Container = container + this.Integration = integration + this.StorageAccount = storageAccount + this.Type = typeVar + return &this +} + +// NewLogsArchiveDestinationAzureWithDefaults instantiates a new LogsArchiveDestinationAzure 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 NewLogsArchiveDestinationAzureWithDefaults() *LogsArchiveDestinationAzure { + this := LogsArchiveDestinationAzure{} + var typeVar LogsArchiveDestinationAzureType = LOGSARCHIVEDESTINATIONAZURETYPE_AZURE + this.Type = typeVar + return &this +} + +// GetContainer returns the Container field value. +func (o *LogsArchiveDestinationAzure) GetContainer() string { + if o == nil { + var ret string + return ret + } + return o.Container +} + +// GetContainerOk returns a tuple with the Container field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationAzure) GetContainerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Container, true +} + +// SetContainer sets field value. +func (o *LogsArchiveDestinationAzure) SetContainer(v string) { + o.Container = v +} + +// GetIntegration returns the Integration field value. +func (o *LogsArchiveDestinationAzure) GetIntegration() LogsArchiveIntegrationAzure { + if o == nil { + var ret LogsArchiveIntegrationAzure + return ret + } + return o.Integration +} + +// GetIntegrationOk returns a tuple with the Integration field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationAzure) GetIntegrationOk() (*LogsArchiveIntegrationAzure, bool) { + if o == nil { + return nil, false + } + return &o.Integration, true +} + +// SetIntegration sets field value. +func (o *LogsArchiveDestinationAzure) SetIntegration(v LogsArchiveIntegrationAzure) { + o.Integration = v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *LogsArchiveDestinationAzure) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationAzure) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *LogsArchiveDestinationAzure) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *LogsArchiveDestinationAzure) SetPath(v string) { + o.Path = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *LogsArchiveDestinationAzure) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationAzure) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *LogsArchiveDestinationAzure) HasRegion() bool { + if o != nil && o.Region != nil { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *LogsArchiveDestinationAzure) SetRegion(v string) { + o.Region = &v +} + +// GetStorageAccount returns the StorageAccount field value. +func (o *LogsArchiveDestinationAzure) GetStorageAccount() string { + if o == nil { + var ret string + return ret + } + return o.StorageAccount +} + +// GetStorageAccountOk returns a tuple with the StorageAccount field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationAzure) GetStorageAccountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.StorageAccount, true +} + +// SetStorageAccount sets field value. +func (o *LogsArchiveDestinationAzure) SetStorageAccount(v string) { + o.StorageAccount = v +} + +// GetType returns the Type field value. +func (o *LogsArchiveDestinationAzure) GetType() LogsArchiveDestinationAzureType { + if o == nil { + var ret LogsArchiveDestinationAzureType + 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 *LogsArchiveDestinationAzure) GetTypeOk() (*LogsArchiveDestinationAzureType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsArchiveDestinationAzure) SetType(v LogsArchiveDestinationAzureType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveDestinationAzure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["container"] = o.Container + toSerialize["integration"] = o.Integration + if o.Path != nil { + toSerialize["path"] = o.Path + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + toSerialize["storage_account"] = o.StorageAccount + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Container *string `json:"container"` + Integration *LogsArchiveIntegrationAzure `json:"integration"` + StorageAccount *string `json:"storage_account"` + Type *LogsArchiveDestinationAzureType `json:"type"` + }{} + all := struct { + Container string `json:"container"` + Integration LogsArchiveIntegrationAzure `json:"integration"` + Path *string `json:"path,omitempty"` + Region *string `json:"region,omitempty"` + StorageAccount string `json:"storage_account"` + Type LogsArchiveDestinationAzureType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Container == nil { + return fmt.Errorf("Required field container missing") + } + if required.Integration == nil { + return fmt.Errorf("Required field integration missing") + } + if required.StorageAccount == nil { + return fmt.Errorf("Required field storage_account missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Container = all.Container + if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Integration = all.Integration + o.Path = all.Path + o.Region = all.Region + o.StorageAccount = all.StorageAccount + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_archive_destination_azure_type.go b/api/v2/datadog/model_logs_archive_destination_azure_type.go new file mode 100644 index 00000000000..a9a80cd2677 --- /dev/null +++ b/api/v2/datadog/model_logs_archive_destination_azure_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveDestinationAzureType Type of the Azure archive destination. +type LogsArchiveDestinationAzureType string + +// List of LogsArchiveDestinationAzureType. +const ( + LOGSARCHIVEDESTINATIONAZURETYPE_AZURE LogsArchiveDestinationAzureType = "azure" +) + +var allowedLogsArchiveDestinationAzureTypeEnumValues = []LogsArchiveDestinationAzureType{ + LOGSARCHIVEDESTINATIONAZURETYPE_AZURE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsArchiveDestinationAzureType) GetAllowedValues() []LogsArchiveDestinationAzureType { + return allowedLogsArchiveDestinationAzureTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsArchiveDestinationAzureType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsArchiveDestinationAzureType(value) + return nil +} + +// NewLogsArchiveDestinationAzureTypeFromValue returns a pointer to a valid LogsArchiveDestinationAzureType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsArchiveDestinationAzureTypeFromValue(v string) (*LogsArchiveDestinationAzureType, error) { + ev := LogsArchiveDestinationAzureType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsArchiveDestinationAzureType: valid values are %v", v, allowedLogsArchiveDestinationAzureTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsArchiveDestinationAzureType) IsValid() bool { + for _, existing := range allowedLogsArchiveDestinationAzureTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsArchiveDestinationAzureType value. +func (v LogsArchiveDestinationAzureType) Ptr() *LogsArchiveDestinationAzureType { + return &v +} + +// NullableLogsArchiveDestinationAzureType handles when a null is used for LogsArchiveDestinationAzureType. +type NullableLogsArchiveDestinationAzureType struct { + value *LogsArchiveDestinationAzureType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArchiveDestinationAzureType) Get() *LogsArchiveDestinationAzureType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArchiveDestinationAzureType) Set(val *LogsArchiveDestinationAzureType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArchiveDestinationAzureType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsArchiveDestinationAzureType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArchiveDestinationAzureType initializes the struct as if Set has been called. +func NewNullableLogsArchiveDestinationAzureType(val *LogsArchiveDestinationAzureType) *NullableLogsArchiveDestinationAzureType { + return &NullableLogsArchiveDestinationAzureType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArchiveDestinationAzureType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArchiveDestinationAzureType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archive_destination_gcs.go b/api/v2/datadog/model_logs_archive_destination_gcs.go new file mode 100644 index 00000000000..2422a5334d3 --- /dev/null +++ b/api/v2/datadog/model_logs_archive_destination_gcs.go @@ -0,0 +1,225 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveDestinationGCS The GCS archive destination. +type LogsArchiveDestinationGCS struct { + // The bucket where the archive will be stored. + Bucket string `json:"bucket"` + // The GCS archive's integration destination. + Integration LogsArchiveIntegrationGCS `json:"integration"` + // The archive path. + Path *string `json:"path,omitempty"` + // Type of the GCS archive destination. + Type LogsArchiveDestinationGCSType `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{} +} + +// NewLogsArchiveDestinationGCS instantiates a new LogsArchiveDestinationGCS 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 NewLogsArchiveDestinationGCS(bucket string, integration LogsArchiveIntegrationGCS, typeVar LogsArchiveDestinationGCSType) *LogsArchiveDestinationGCS { + this := LogsArchiveDestinationGCS{} + this.Bucket = bucket + this.Integration = integration + this.Type = typeVar + return &this +} + +// NewLogsArchiveDestinationGCSWithDefaults instantiates a new LogsArchiveDestinationGCS 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 NewLogsArchiveDestinationGCSWithDefaults() *LogsArchiveDestinationGCS { + this := LogsArchiveDestinationGCS{} + var typeVar LogsArchiveDestinationGCSType = LOGSARCHIVEDESTINATIONGCSTYPE_GCS + this.Type = typeVar + return &this +} + +// GetBucket returns the Bucket field value. +func (o *LogsArchiveDestinationGCS) GetBucket() string { + if o == nil { + var ret string + return ret + } + return o.Bucket +} + +// GetBucketOk returns a tuple with the Bucket field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationGCS) GetBucketOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Bucket, true +} + +// SetBucket sets field value. +func (o *LogsArchiveDestinationGCS) SetBucket(v string) { + o.Bucket = v +} + +// GetIntegration returns the Integration field value. +func (o *LogsArchiveDestinationGCS) GetIntegration() LogsArchiveIntegrationGCS { + if o == nil { + var ret LogsArchiveIntegrationGCS + return ret + } + return o.Integration +} + +// GetIntegrationOk returns a tuple with the Integration field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationGCS) GetIntegrationOk() (*LogsArchiveIntegrationGCS, bool) { + if o == nil { + return nil, false + } + return &o.Integration, true +} + +// SetIntegration sets field value. +func (o *LogsArchiveDestinationGCS) SetIntegration(v LogsArchiveIntegrationGCS) { + o.Integration = v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *LogsArchiveDestinationGCS) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationGCS) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *LogsArchiveDestinationGCS) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *LogsArchiveDestinationGCS) SetPath(v string) { + o.Path = &v +} + +// GetType returns the Type field value. +func (o *LogsArchiveDestinationGCS) GetType() LogsArchiveDestinationGCSType { + if o == nil { + var ret LogsArchiveDestinationGCSType + 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 *LogsArchiveDestinationGCS) GetTypeOk() (*LogsArchiveDestinationGCSType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsArchiveDestinationGCS) SetType(v LogsArchiveDestinationGCSType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveDestinationGCS) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["bucket"] = o.Bucket + toSerialize["integration"] = o.Integration + if o.Path != nil { + toSerialize["path"] = o.Path + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Bucket *string `json:"bucket"` + Integration *LogsArchiveIntegrationGCS `json:"integration"` + Type *LogsArchiveDestinationGCSType `json:"type"` + }{} + all := struct { + Bucket string `json:"bucket"` + Integration LogsArchiveIntegrationGCS `json:"integration"` + Path *string `json:"path,omitempty"` + Type LogsArchiveDestinationGCSType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Bucket == nil { + return fmt.Errorf("Required field bucket missing") + } + if required.Integration == nil { + return fmt.Errorf("Required field integration missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Bucket = all.Bucket + if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Integration = all.Integration + o.Path = all.Path + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_archive_destination_gcs_type.go b/api/v2/datadog/model_logs_archive_destination_gcs_type.go new file mode 100644 index 00000000000..fda9da3717e --- /dev/null +++ b/api/v2/datadog/model_logs_archive_destination_gcs_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveDestinationGCSType Type of the GCS archive destination. +type LogsArchiveDestinationGCSType string + +// List of LogsArchiveDestinationGCSType. +const ( + LOGSARCHIVEDESTINATIONGCSTYPE_GCS LogsArchiveDestinationGCSType = "gcs" +) + +var allowedLogsArchiveDestinationGCSTypeEnumValues = []LogsArchiveDestinationGCSType{ + LOGSARCHIVEDESTINATIONGCSTYPE_GCS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsArchiveDestinationGCSType) GetAllowedValues() []LogsArchiveDestinationGCSType { + return allowedLogsArchiveDestinationGCSTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsArchiveDestinationGCSType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsArchiveDestinationGCSType(value) + return nil +} + +// NewLogsArchiveDestinationGCSTypeFromValue returns a pointer to a valid LogsArchiveDestinationGCSType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsArchiveDestinationGCSTypeFromValue(v string) (*LogsArchiveDestinationGCSType, error) { + ev := LogsArchiveDestinationGCSType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsArchiveDestinationGCSType: valid values are %v", v, allowedLogsArchiveDestinationGCSTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsArchiveDestinationGCSType) IsValid() bool { + for _, existing := range allowedLogsArchiveDestinationGCSTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsArchiveDestinationGCSType value. +func (v LogsArchiveDestinationGCSType) Ptr() *LogsArchiveDestinationGCSType { + return &v +} + +// NullableLogsArchiveDestinationGCSType handles when a null is used for LogsArchiveDestinationGCSType. +type NullableLogsArchiveDestinationGCSType struct { + value *LogsArchiveDestinationGCSType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArchiveDestinationGCSType) Get() *LogsArchiveDestinationGCSType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArchiveDestinationGCSType) Set(val *LogsArchiveDestinationGCSType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArchiveDestinationGCSType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsArchiveDestinationGCSType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArchiveDestinationGCSType initializes the struct as if Set has been called. +func NewNullableLogsArchiveDestinationGCSType(val *LogsArchiveDestinationGCSType) *NullableLogsArchiveDestinationGCSType { + return &NullableLogsArchiveDestinationGCSType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArchiveDestinationGCSType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArchiveDestinationGCSType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archive_destination_s3.go b/api/v2/datadog/model_logs_archive_destination_s3.go new file mode 100644 index 00000000000..60cce5475ff --- /dev/null +++ b/api/v2/datadog/model_logs_archive_destination_s3.go @@ -0,0 +1,225 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveDestinationS3 The S3 archive destination. +type LogsArchiveDestinationS3 struct { + // The bucket where the archive will be stored. + Bucket string `json:"bucket"` + // The S3 Archive's integration destination. + Integration LogsArchiveIntegrationS3 `json:"integration"` + // The archive path. + Path *string `json:"path,omitempty"` + // Type of the S3 archive destination. + Type LogsArchiveDestinationS3Type `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{} +} + +// NewLogsArchiveDestinationS3 instantiates a new LogsArchiveDestinationS3 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 NewLogsArchiveDestinationS3(bucket string, integration LogsArchiveIntegrationS3, typeVar LogsArchiveDestinationS3Type) *LogsArchiveDestinationS3 { + this := LogsArchiveDestinationS3{} + this.Bucket = bucket + this.Integration = integration + this.Type = typeVar + return &this +} + +// NewLogsArchiveDestinationS3WithDefaults instantiates a new LogsArchiveDestinationS3 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 NewLogsArchiveDestinationS3WithDefaults() *LogsArchiveDestinationS3 { + this := LogsArchiveDestinationS3{} + var typeVar LogsArchiveDestinationS3Type = LOGSARCHIVEDESTINATIONS3TYPE_S3 + this.Type = typeVar + return &this +} + +// GetBucket returns the Bucket field value. +func (o *LogsArchiveDestinationS3) GetBucket() string { + if o == nil { + var ret string + return ret + } + return o.Bucket +} + +// GetBucketOk returns a tuple with the Bucket field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationS3) GetBucketOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Bucket, true +} + +// SetBucket sets field value. +func (o *LogsArchiveDestinationS3) SetBucket(v string) { + o.Bucket = v +} + +// GetIntegration returns the Integration field value. +func (o *LogsArchiveDestinationS3) GetIntegration() LogsArchiveIntegrationS3 { + if o == nil { + var ret LogsArchiveIntegrationS3 + return ret + } + return o.Integration +} + +// GetIntegrationOk returns a tuple with the Integration field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationS3) GetIntegrationOk() (*LogsArchiveIntegrationS3, bool) { + if o == nil { + return nil, false + } + return &o.Integration, true +} + +// SetIntegration sets field value. +func (o *LogsArchiveDestinationS3) SetIntegration(v LogsArchiveIntegrationS3) { + o.Integration = v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *LogsArchiveDestinationS3) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveDestinationS3) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *LogsArchiveDestinationS3) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *LogsArchiveDestinationS3) SetPath(v string) { + o.Path = &v +} + +// GetType returns the Type field value. +func (o *LogsArchiveDestinationS3) GetType() LogsArchiveDestinationS3Type { + if o == nil { + var ret LogsArchiveDestinationS3Type + 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 *LogsArchiveDestinationS3) GetTypeOk() (*LogsArchiveDestinationS3Type, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsArchiveDestinationS3) SetType(v LogsArchiveDestinationS3Type) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveDestinationS3) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["bucket"] = o.Bucket + toSerialize["integration"] = o.Integration + if o.Path != nil { + toSerialize["path"] = o.Path + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Bucket *string `json:"bucket"` + Integration *LogsArchiveIntegrationS3 `json:"integration"` + Type *LogsArchiveDestinationS3Type `json:"type"` + }{} + all := struct { + Bucket string `json:"bucket"` + Integration LogsArchiveIntegrationS3 `json:"integration"` + Path *string `json:"path,omitempty"` + Type LogsArchiveDestinationS3Type `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Bucket == nil { + return fmt.Errorf("Required field bucket missing") + } + if required.Integration == nil { + return fmt.Errorf("Required field integration missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Bucket = all.Bucket + if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Integration = all.Integration + o.Path = all.Path + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_archive_destination_s3_type.go b/api/v2/datadog/model_logs_archive_destination_s3_type.go new file mode 100644 index 00000000000..140b65c646c --- /dev/null +++ b/api/v2/datadog/model_logs_archive_destination_s3_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveDestinationS3Type Type of the S3 archive destination. +type LogsArchiveDestinationS3Type string + +// List of LogsArchiveDestinationS3Type. +const ( + LOGSARCHIVEDESTINATIONS3TYPE_S3 LogsArchiveDestinationS3Type = "s3" +) + +var allowedLogsArchiveDestinationS3TypeEnumValues = []LogsArchiveDestinationS3Type{ + LOGSARCHIVEDESTINATIONS3TYPE_S3, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsArchiveDestinationS3Type) GetAllowedValues() []LogsArchiveDestinationS3Type { + return allowedLogsArchiveDestinationS3TypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsArchiveDestinationS3Type) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsArchiveDestinationS3Type(value) + return nil +} + +// NewLogsArchiveDestinationS3TypeFromValue returns a pointer to a valid LogsArchiveDestinationS3Type +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsArchiveDestinationS3TypeFromValue(v string) (*LogsArchiveDestinationS3Type, error) { + ev := LogsArchiveDestinationS3Type(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsArchiveDestinationS3Type: valid values are %v", v, allowedLogsArchiveDestinationS3TypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsArchiveDestinationS3Type) IsValid() bool { + for _, existing := range allowedLogsArchiveDestinationS3TypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsArchiveDestinationS3Type value. +func (v LogsArchiveDestinationS3Type) Ptr() *LogsArchiveDestinationS3Type { + return &v +} + +// NullableLogsArchiveDestinationS3Type handles when a null is used for LogsArchiveDestinationS3Type. +type NullableLogsArchiveDestinationS3Type struct { + value *LogsArchiveDestinationS3Type + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArchiveDestinationS3Type) Get() *LogsArchiveDestinationS3Type { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArchiveDestinationS3Type) Set(val *LogsArchiveDestinationS3Type) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArchiveDestinationS3Type) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsArchiveDestinationS3Type) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArchiveDestinationS3Type initializes the struct as if Set has been called. +func NewNullableLogsArchiveDestinationS3Type(val *LogsArchiveDestinationS3Type) *NullableLogsArchiveDestinationS3Type { + return &NullableLogsArchiveDestinationS3Type{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArchiveDestinationS3Type) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArchiveDestinationS3Type) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archive_integration_azure.go b/api/v2/datadog/model_logs_archive_integration_azure.go new file mode 100644 index 00000000000..989efc42a01 --- /dev/null +++ b/api/v2/datadog/model_logs_archive_integration_azure.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveIntegrationAzure The Azure archive's integration destination. +type LogsArchiveIntegrationAzure struct { + // A client ID. + ClientId string `json:"client_id"` + // A tenant ID. + TenantId string `json:"tenant_id"` + // 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{} +} + +// NewLogsArchiveIntegrationAzure instantiates a new LogsArchiveIntegrationAzure 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 NewLogsArchiveIntegrationAzure(clientId string, tenantId string) *LogsArchiveIntegrationAzure { + this := LogsArchiveIntegrationAzure{} + this.ClientId = clientId + this.TenantId = tenantId + return &this +} + +// NewLogsArchiveIntegrationAzureWithDefaults instantiates a new LogsArchiveIntegrationAzure 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 NewLogsArchiveIntegrationAzureWithDefaults() *LogsArchiveIntegrationAzure { + this := LogsArchiveIntegrationAzure{} + return &this +} + +// GetClientId returns the ClientId field value. +func (o *LogsArchiveIntegrationAzure) GetClientId() string { + if o == nil { + var ret string + return ret + } + return o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveIntegrationAzure) GetClientIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientId, true +} + +// SetClientId sets field value. +func (o *LogsArchiveIntegrationAzure) SetClientId(v string) { + o.ClientId = v +} + +// GetTenantId returns the TenantId field value. +func (o *LogsArchiveIntegrationAzure) GetTenantId() string { + if o == nil { + var ret string + return ret + } + return o.TenantId +} + +// GetTenantIdOk returns a tuple with the TenantId field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveIntegrationAzure) GetTenantIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TenantId, true +} + +// SetTenantId sets field value. +func (o *LogsArchiveIntegrationAzure) SetTenantId(v string) { + o.TenantId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveIntegrationAzure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["client_id"] = o.ClientId + toSerialize["tenant_id"] = o.TenantId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveIntegrationAzure) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ClientId *string `json:"client_id"` + TenantId *string `json:"tenant_id"` + }{} + all := struct { + ClientId string `json:"client_id"` + TenantId string `json:"tenant_id"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ClientId == nil { + return fmt.Errorf("Required field client_id missing") + } + if required.TenantId == nil { + return fmt.Errorf("Required field tenant_id missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ClientId = all.ClientId + o.TenantId = all.TenantId + return nil +} diff --git a/api/v2/datadog/model_logs_archive_integration_gcs.go b/api/v2/datadog/model_logs_archive_integration_gcs.go new file mode 100644 index 00000000000..a738b9fa97e --- /dev/null +++ b/api/v2/datadog/model_logs_archive_integration_gcs.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveIntegrationGCS The GCS archive's integration destination. +type LogsArchiveIntegrationGCS struct { + // A client email. + ClientEmail string `json:"client_email"` + // A project ID. + ProjectId string `json:"project_id"` + // 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{} +} + +// NewLogsArchiveIntegrationGCS instantiates a new LogsArchiveIntegrationGCS 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 NewLogsArchiveIntegrationGCS(clientEmail string, projectId string) *LogsArchiveIntegrationGCS { + this := LogsArchiveIntegrationGCS{} + this.ClientEmail = clientEmail + this.ProjectId = projectId + return &this +} + +// NewLogsArchiveIntegrationGCSWithDefaults instantiates a new LogsArchiveIntegrationGCS 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 NewLogsArchiveIntegrationGCSWithDefaults() *LogsArchiveIntegrationGCS { + this := LogsArchiveIntegrationGCS{} + return &this +} + +// GetClientEmail returns the ClientEmail field value. +func (o *LogsArchiveIntegrationGCS) GetClientEmail() string { + if o == nil { + var ret string + return ret + } + return o.ClientEmail +} + +// GetClientEmailOk returns a tuple with the ClientEmail field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveIntegrationGCS) GetClientEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientEmail, true +} + +// SetClientEmail sets field value. +func (o *LogsArchiveIntegrationGCS) SetClientEmail(v string) { + o.ClientEmail = v +} + +// GetProjectId returns the ProjectId field value. +func (o *LogsArchiveIntegrationGCS) GetProjectId() string { + if o == nil { + var ret string + return ret + } + return o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveIntegrationGCS) GetProjectIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProjectId, true +} + +// SetProjectId sets field value. +func (o *LogsArchiveIntegrationGCS) SetProjectId(v string) { + o.ProjectId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveIntegrationGCS) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["client_email"] = o.ClientEmail + toSerialize["project_id"] = o.ProjectId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveIntegrationGCS) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ClientEmail *string `json:"client_email"` + ProjectId *string `json:"project_id"` + }{} + all := struct { + ClientEmail string `json:"client_email"` + ProjectId string `json:"project_id"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ClientEmail == nil { + return fmt.Errorf("Required field client_email missing") + } + if required.ProjectId == nil { + return fmt.Errorf("Required field project_id missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ClientEmail = all.ClientEmail + o.ProjectId = all.ProjectId + return nil +} diff --git a/api/v2/datadog/model_logs_archive_integration_s3.go b/api/v2/datadog/model_logs_archive_integration_s3.go new file mode 100644 index 00000000000..2dc1b59dbaa --- /dev/null +++ b/api/v2/datadog/model_logs_archive_integration_s3.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveIntegrationS3 The S3 Archive's integration destination. +type LogsArchiveIntegrationS3 struct { + // The account ID for the integration. + AccountId string `json:"account_id"` + // The path of the integration. + RoleName string `json:"role_name"` + // 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{} +} + +// NewLogsArchiveIntegrationS3 instantiates a new LogsArchiveIntegrationS3 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 NewLogsArchiveIntegrationS3(accountId string, roleName string) *LogsArchiveIntegrationS3 { + this := LogsArchiveIntegrationS3{} + this.AccountId = accountId + this.RoleName = roleName + return &this +} + +// NewLogsArchiveIntegrationS3WithDefaults instantiates a new LogsArchiveIntegrationS3 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 NewLogsArchiveIntegrationS3WithDefaults() *LogsArchiveIntegrationS3 { + this := LogsArchiveIntegrationS3{} + return &this +} + +// GetAccountId returns the AccountId field value. +func (o *LogsArchiveIntegrationS3) GetAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveIntegrationS3) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccountId, true +} + +// SetAccountId sets field value. +func (o *LogsArchiveIntegrationS3) SetAccountId(v string) { + o.AccountId = v +} + +// GetRoleName returns the RoleName field value. +func (o *LogsArchiveIntegrationS3) GetRoleName() string { + if o == nil { + var ret string + return ret + } + return o.RoleName +} + +// GetRoleNameOk returns a tuple with the RoleName field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveIntegrationS3) GetRoleNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RoleName, true +} + +// SetRoleName sets field value. +func (o *LogsArchiveIntegrationS3) SetRoleName(v string) { + o.RoleName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveIntegrationS3) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["account_id"] = o.AccountId + toSerialize["role_name"] = o.RoleName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveIntegrationS3) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + AccountId *string `json:"account_id"` + RoleName *string `json:"role_name"` + }{} + all := struct { + AccountId string `json:"account_id"` + RoleName string `json:"role_name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.AccountId == nil { + return fmt.Errorf("Required field account_id missing") + } + if required.RoleName == nil { + return fmt.Errorf("Required field role_name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AccountId = all.AccountId + o.RoleName = all.RoleName + return nil +} diff --git a/api/v2/datadog/model_logs_archive_order.go b/api/v2/datadog/model_logs_archive_order.go new file mode 100644 index 00000000000..9555760dbae --- /dev/null +++ b/api/v2/datadog/model_logs_archive_order.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsArchiveOrder A ordered list of archive IDs. +type LogsArchiveOrder struct { + // The definition of an archive order. + Data *LogsArchiveOrderDefinition `json:"data,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{} +} + +// NewLogsArchiveOrder instantiates a new LogsArchiveOrder 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 NewLogsArchiveOrder() *LogsArchiveOrder { + this := LogsArchiveOrder{} + return &this +} + +// NewLogsArchiveOrderWithDefaults instantiates a new LogsArchiveOrder 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 NewLogsArchiveOrderWithDefaults() *LogsArchiveOrder { + this := LogsArchiveOrder{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsArchiveOrder) GetData() LogsArchiveOrderDefinition { + if o == nil || o.Data == nil { + var ret LogsArchiveOrderDefinition + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchiveOrder) GetDataOk() (*LogsArchiveOrderDefinition, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsArchiveOrder) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given LogsArchiveOrderDefinition and assigns it to the Data field. +func (o *LogsArchiveOrder) SetData(v LogsArchiveOrderDefinition) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveOrder) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveOrder) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *LogsArchiveOrderDefinition `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_archive_order_attributes.go b/api/v2/datadog/model_logs_archive_order_attributes.go new file mode 100644 index 00000000000..9d5dca49f72 --- /dev/null +++ b/api/v2/datadog/model_logs_archive_order_attributes.go @@ -0,0 +1,104 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveOrderAttributes The attributes associated with the archive order. +type LogsArchiveOrderAttributes struct { + // An ordered array of `` strings, the order of archive IDs in the array + // define the overall archives order for Datadog. + ArchiveIds []string `json:"archive_ids"` + // 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{} +} + +// NewLogsArchiveOrderAttributes instantiates a new LogsArchiveOrderAttributes 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 NewLogsArchiveOrderAttributes(archiveIds []string) *LogsArchiveOrderAttributes { + this := LogsArchiveOrderAttributes{} + this.ArchiveIds = archiveIds + return &this +} + +// NewLogsArchiveOrderAttributesWithDefaults instantiates a new LogsArchiveOrderAttributes 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 NewLogsArchiveOrderAttributesWithDefaults() *LogsArchiveOrderAttributes { + this := LogsArchiveOrderAttributes{} + return &this +} + +// GetArchiveIds returns the ArchiveIds field value. +func (o *LogsArchiveOrderAttributes) GetArchiveIds() []string { + if o == nil { + var ret []string + return ret + } + return o.ArchiveIds +} + +// GetArchiveIdsOk returns a tuple with the ArchiveIds field value +// and a boolean to check if the value has been set. +func (o *LogsArchiveOrderAttributes) GetArchiveIdsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.ArchiveIds, true +} + +// SetArchiveIds sets field value. +func (o *LogsArchiveOrderAttributes) SetArchiveIds(v []string) { + o.ArchiveIds = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveOrderAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["archive_ids"] = o.ArchiveIds + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveOrderAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ArchiveIds *[]string `json:"archive_ids"` + }{} + all := struct { + ArchiveIds []string `json:"archive_ids"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ArchiveIds == nil { + return fmt.Errorf("Required field archive_ids missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ArchiveIds = all.ArchiveIds + return nil +} diff --git a/api/v2/datadog/model_logs_archive_order_definition.go b/api/v2/datadog/model_logs_archive_order_definition.go new file mode 100644 index 00000000000..20fdbb6a6e3 --- /dev/null +++ b/api/v2/datadog/model_logs_archive_order_definition.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveOrderDefinition The definition of an archive order. +type LogsArchiveOrderDefinition struct { + // The attributes associated with the archive order. + Attributes LogsArchiveOrderAttributes `json:"attributes"` + // Type of the archive order definition. + Type LogsArchiveOrderDefinitionType `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{} +} + +// NewLogsArchiveOrderDefinition instantiates a new LogsArchiveOrderDefinition 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 NewLogsArchiveOrderDefinition(attributes LogsArchiveOrderAttributes, typeVar LogsArchiveOrderDefinitionType) *LogsArchiveOrderDefinition { + this := LogsArchiveOrderDefinition{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewLogsArchiveOrderDefinitionWithDefaults instantiates a new LogsArchiveOrderDefinition 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 NewLogsArchiveOrderDefinitionWithDefaults() *LogsArchiveOrderDefinition { + this := LogsArchiveOrderDefinition{} + var typeVar LogsArchiveOrderDefinitionType = LOGSARCHIVEORDERDEFINITIONTYPE_ARCHIVE_ORDER + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *LogsArchiveOrderDefinition) GetAttributes() LogsArchiveOrderAttributes { + if o == nil { + var ret LogsArchiveOrderAttributes + 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 *LogsArchiveOrderDefinition) GetAttributesOk() (*LogsArchiveOrderAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *LogsArchiveOrderDefinition) SetAttributes(v LogsArchiveOrderAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *LogsArchiveOrderDefinition) GetType() LogsArchiveOrderDefinitionType { + if o == nil { + var ret LogsArchiveOrderDefinitionType + 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 *LogsArchiveOrderDefinition) GetTypeOk() (*LogsArchiveOrderDefinitionType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsArchiveOrderDefinition) SetType(v LogsArchiveOrderDefinitionType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchiveOrderDefinition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchiveOrderDefinition) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *LogsArchiveOrderAttributes `json:"attributes"` + Type *LogsArchiveOrderDefinitionType `json:"type"` + }{} + all := struct { + Attributes LogsArchiveOrderAttributes `json:"attributes"` + Type LogsArchiveOrderDefinitionType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_archive_order_definition_type.go b/api/v2/datadog/model_logs_archive_order_definition_type.go new file mode 100644 index 00000000000..30d1d8f555a --- /dev/null +++ b/api/v2/datadog/model_logs_archive_order_definition_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveOrderDefinitionType Type of the archive order definition. +type LogsArchiveOrderDefinitionType string + +// List of LogsArchiveOrderDefinitionType. +const ( + LOGSARCHIVEORDERDEFINITIONTYPE_ARCHIVE_ORDER LogsArchiveOrderDefinitionType = "archive_order" +) + +var allowedLogsArchiveOrderDefinitionTypeEnumValues = []LogsArchiveOrderDefinitionType{ + LOGSARCHIVEORDERDEFINITIONTYPE_ARCHIVE_ORDER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsArchiveOrderDefinitionType) GetAllowedValues() []LogsArchiveOrderDefinitionType { + return allowedLogsArchiveOrderDefinitionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsArchiveOrderDefinitionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsArchiveOrderDefinitionType(value) + return nil +} + +// NewLogsArchiveOrderDefinitionTypeFromValue returns a pointer to a valid LogsArchiveOrderDefinitionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsArchiveOrderDefinitionTypeFromValue(v string) (*LogsArchiveOrderDefinitionType, error) { + ev := LogsArchiveOrderDefinitionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsArchiveOrderDefinitionType: valid values are %v", v, allowedLogsArchiveOrderDefinitionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsArchiveOrderDefinitionType) IsValid() bool { + for _, existing := range allowedLogsArchiveOrderDefinitionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsArchiveOrderDefinitionType value. +func (v LogsArchiveOrderDefinitionType) Ptr() *LogsArchiveOrderDefinitionType { + return &v +} + +// NullableLogsArchiveOrderDefinitionType handles when a null is used for LogsArchiveOrderDefinitionType. +type NullableLogsArchiveOrderDefinitionType struct { + value *LogsArchiveOrderDefinitionType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArchiveOrderDefinitionType) Get() *LogsArchiveOrderDefinitionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArchiveOrderDefinitionType) Set(val *LogsArchiveOrderDefinitionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArchiveOrderDefinitionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsArchiveOrderDefinitionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArchiveOrderDefinitionType initializes the struct as if Set has been called. +func NewNullableLogsArchiveOrderDefinitionType(val *LogsArchiveOrderDefinitionType) *NullableLogsArchiveOrderDefinitionType { + return &NullableLogsArchiveOrderDefinitionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArchiveOrderDefinitionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArchiveOrderDefinitionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archive_state.go b/api/v2/datadog/model_logs_archive_state.go new file mode 100644 index 00000000000..28cac94a1fe --- /dev/null +++ b/api/v2/datadog/model_logs_archive_state.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsArchiveState The state of the archive. +type LogsArchiveState string + +// List of LogsArchiveState. +const ( + LOGSARCHIVESTATE_UNKNOWN LogsArchiveState = "UNKNOWN" + LOGSARCHIVESTATE_WORKING LogsArchiveState = "WORKING" + LOGSARCHIVESTATE_FAILING LogsArchiveState = "FAILING" + LOGSARCHIVESTATE_WORKING_AUTH_LEGACY LogsArchiveState = "WORKING_AUTH_LEGACY" +) + +var allowedLogsArchiveStateEnumValues = []LogsArchiveState{ + LOGSARCHIVESTATE_UNKNOWN, + LOGSARCHIVESTATE_WORKING, + LOGSARCHIVESTATE_FAILING, + LOGSARCHIVESTATE_WORKING_AUTH_LEGACY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsArchiveState) GetAllowedValues() []LogsArchiveState { + return allowedLogsArchiveStateEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsArchiveState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsArchiveState(value) + return nil +} + +// NewLogsArchiveStateFromValue returns a pointer to a valid LogsArchiveState +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsArchiveStateFromValue(v string) (*LogsArchiveState, error) { + ev := LogsArchiveState(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsArchiveState: valid values are %v", v, allowedLogsArchiveStateEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsArchiveState) IsValid() bool { + for _, existing := range allowedLogsArchiveStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsArchiveState value. +func (v LogsArchiveState) Ptr() *LogsArchiveState { + return &v +} + +// NullableLogsArchiveState handles when a null is used for LogsArchiveState. +type NullableLogsArchiveState struct { + value *LogsArchiveState + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsArchiveState) Get() *LogsArchiveState { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsArchiveState) Set(val *LogsArchiveState) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsArchiveState) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsArchiveState) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsArchiveState initializes the struct as if Set has been called. +func NewNullableLogsArchiveState(val *LogsArchiveState) *NullableLogsArchiveState { + return &NullableLogsArchiveState{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsArchiveState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsArchiveState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_archives.go b/api/v2/datadog/model_logs_archives.go new file mode 100644 index 00000000000..9878317c3f9 --- /dev/null +++ b/api/v2/datadog/model_logs_archives.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 datadog + +import ( + "encoding/json" +) + +// LogsArchives The available archives. +type LogsArchives struct { + // A list of archives. + Data []LogsArchiveDefinition `json:"data,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{} +} + +// NewLogsArchives instantiates a new LogsArchives 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 NewLogsArchives() *LogsArchives { + this := LogsArchives{} + return &this +} + +// NewLogsArchivesWithDefaults instantiates a new LogsArchives 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 NewLogsArchivesWithDefaults() *LogsArchives { + this := LogsArchives{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsArchives) GetData() []LogsArchiveDefinition { + if o == nil || o.Data == nil { + var ret []LogsArchiveDefinition + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsArchives) GetDataOk() (*[]LogsArchiveDefinition, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsArchives) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []LogsArchiveDefinition and assigns it to the Data field. +func (o *LogsArchives) SetData(v []LogsArchiveDefinition) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsArchives) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsArchives) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []LogsArchiveDefinition `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_compute.go b/api/v2/datadog/model_logs_compute.go new file mode 100644 index 00000000000..2dcada64fc2 --- /dev/null +++ b/api/v2/datadog/model_logs_compute.go @@ -0,0 +1,241 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsCompute A compute rule to compute metrics or timeseries +type LogsCompute struct { + // An aggregation function + Aggregation LogsAggregationFunction `json:"aggregation"` + // The time buckets' size (only used for type=timeseries) + // Defaults to a resolution of 150 points + Interval *string `json:"interval,omitempty"` + // The metric to use + Metric *string `json:"metric,omitempty"` + // The type of compute + Type *LogsComputeType `json:"type,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{} +} + +// NewLogsCompute instantiates a new LogsCompute 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 NewLogsCompute(aggregation LogsAggregationFunction) *LogsCompute { + this := LogsCompute{} + this.Aggregation = aggregation + var typeVar LogsComputeType = LOGSCOMPUTETYPE_TOTAL + this.Type = &typeVar + return &this +} + +// NewLogsComputeWithDefaults instantiates a new LogsCompute 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 NewLogsComputeWithDefaults() *LogsCompute { + this := LogsCompute{} + var typeVar LogsComputeType = LOGSCOMPUTETYPE_TOTAL + this.Type = &typeVar + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *LogsCompute) GetAggregation() LogsAggregationFunction { + if o == nil { + var ret LogsAggregationFunction + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *LogsCompute) GetAggregationOk() (*LogsAggregationFunction, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *LogsCompute) SetAggregation(v LogsAggregationFunction) { + o.Aggregation = v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *LogsCompute) GetInterval() string { + if o == nil || o.Interval == nil { + var ret string + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsCompute) GetIntervalOk() (*string, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *LogsCompute) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *LogsCompute) SetInterval(v string) { + o.Interval = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *LogsCompute) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsCompute) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *LogsCompute) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *LogsCompute) SetMetric(v string) { + o.Metric = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LogsCompute) GetType() LogsComputeType { + if o == nil || o.Type == nil { + var ret LogsComputeType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsCompute) GetTypeOk() (*LogsComputeType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LogsCompute) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given LogsComputeType and assigns it to the Type field. +func (o *LogsCompute) SetType(v LogsComputeType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *LogsAggregationFunction `json:"aggregation"` + }{} + all := struct { + Aggregation LogsAggregationFunction `json:"aggregation"` + Interval *string `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + Type *LogsComputeType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Interval = all.Interval + o.Metric = all.Metric + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_compute_type.go b/api/v2/datadog/model_logs_compute_type.go new file mode 100644 index 00000000000..5628de4f0a3 --- /dev/null +++ b/api/v2/datadog/model_logs_compute_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsComputeType The type of compute +type LogsComputeType string + +// List of LogsComputeType. +const ( + LOGSCOMPUTETYPE_TIMESERIES LogsComputeType = "timeseries" + LOGSCOMPUTETYPE_TOTAL LogsComputeType = "total" +) + +var allowedLogsComputeTypeEnumValues = []LogsComputeType{ + LOGSCOMPUTETYPE_TIMESERIES, + LOGSCOMPUTETYPE_TOTAL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsComputeType) GetAllowedValues() []LogsComputeType { + return allowedLogsComputeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsComputeType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsComputeType(value) + return nil +} + +// NewLogsComputeTypeFromValue returns a pointer to a valid LogsComputeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsComputeTypeFromValue(v string) (*LogsComputeType, error) { + ev := LogsComputeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsComputeType: valid values are %v", v, allowedLogsComputeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsComputeType) IsValid() bool { + for _, existing := range allowedLogsComputeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsComputeType value. +func (v LogsComputeType) Ptr() *LogsComputeType { + return &v +} + +// NullableLogsComputeType handles when a null is used for LogsComputeType. +type NullableLogsComputeType struct { + value *LogsComputeType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsComputeType) Get() *LogsComputeType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsComputeType) Set(val *LogsComputeType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsComputeType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsComputeType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsComputeType initializes the struct as if Set has been called. +func NewNullableLogsComputeType(val *LogsComputeType) *NullableLogsComputeType { + return &NullableLogsComputeType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsComputeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsComputeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_group_by.go b/api/v2/datadog/model_logs_group_by.go new file mode 100644 index 00000000000..3b7e8ec0251 --- /dev/null +++ b/api/v2/datadog/model_logs_group_by.go @@ -0,0 +1,317 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsGroupBy A group by rule +type LogsGroupBy struct { + // The name of the facet to use (required) + Facet string `json:"facet"` + // Used to perform a histogram computation (only for measure facets). + // Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. + Histogram *LogsGroupByHistogram `json:"histogram,omitempty"` + // The maximum buckets to return for this group by + Limit *int64 `json:"limit,omitempty"` + // The value to use for logs that don't have the facet used to group by + Missing *LogsGroupByMissing `json:"missing,omitempty"` + // A sort rule + Sort *LogsAggregateSort `json:"sort,omitempty"` + // A resulting object to put the given computes in over all the matching records. + Total *LogsGroupByTotal `json:"total,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{} +} + +// NewLogsGroupBy instantiates a new LogsGroupBy 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 NewLogsGroupBy(facet string) *LogsGroupBy { + this := LogsGroupBy{} + this.Facet = facet + var limit int64 = 10 + this.Limit = &limit + return &this +} + +// NewLogsGroupByWithDefaults instantiates a new LogsGroupBy 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 NewLogsGroupByWithDefaults() *LogsGroupBy { + this := LogsGroupBy{} + var limit int64 = 10 + this.Limit = &limit + return &this +} + +// GetFacet returns the Facet field value. +func (o *LogsGroupBy) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *LogsGroupBy) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *LogsGroupBy) SetFacet(v string) { + o.Facet = v +} + +// GetHistogram returns the Histogram field value if set, zero value otherwise. +func (o *LogsGroupBy) GetHistogram() LogsGroupByHistogram { + if o == nil || o.Histogram == nil { + var ret LogsGroupByHistogram + return ret + } + return *o.Histogram +} + +// GetHistogramOk returns a tuple with the Histogram field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGroupBy) GetHistogramOk() (*LogsGroupByHistogram, bool) { + if o == nil || o.Histogram == nil { + return nil, false + } + return o.Histogram, true +} + +// HasHistogram returns a boolean if a field has been set. +func (o *LogsGroupBy) HasHistogram() bool { + if o != nil && o.Histogram != nil { + return true + } + + return false +} + +// SetHistogram gets a reference to the given LogsGroupByHistogram and assigns it to the Histogram field. +func (o *LogsGroupBy) SetHistogram(v LogsGroupByHistogram) { + o.Histogram = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *LogsGroupBy) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGroupBy) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *LogsGroupBy) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *LogsGroupBy) SetLimit(v int64) { + o.Limit = &v +} + +// GetMissing returns the Missing field value if set, zero value otherwise. +func (o *LogsGroupBy) GetMissing() LogsGroupByMissing { + if o == nil || o.Missing == nil { + var ret LogsGroupByMissing + return ret + } + return *o.Missing +} + +// GetMissingOk returns a tuple with the Missing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGroupBy) GetMissingOk() (*LogsGroupByMissing, bool) { + if o == nil || o.Missing == nil { + return nil, false + } + return o.Missing, true +} + +// HasMissing returns a boolean if a field has been set. +func (o *LogsGroupBy) HasMissing() bool { + if o != nil && o.Missing != nil { + return true + } + + return false +} + +// SetMissing gets a reference to the given LogsGroupByMissing and assigns it to the Missing field. +func (o *LogsGroupBy) SetMissing(v LogsGroupByMissing) { + o.Missing = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *LogsGroupBy) GetSort() LogsAggregateSort { + if o == nil || o.Sort == nil { + var ret LogsAggregateSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGroupBy) GetSortOk() (*LogsAggregateSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *LogsGroupBy) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given LogsAggregateSort and assigns it to the Sort field. +func (o *LogsGroupBy) SetSort(v LogsAggregateSort) { + o.Sort = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *LogsGroupBy) GetTotal() LogsGroupByTotal { + if o == nil || o.Total == nil { + var ret LogsGroupByTotal + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsGroupBy) GetTotalOk() (*LogsGroupByTotal, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *LogsGroupBy) HasTotal() bool { + if o != nil && o.Total != nil { + return true + } + + return false +} + +// SetTotal gets a reference to the given LogsGroupByTotal and assigns it to the Total field. +func (o *LogsGroupBy) SetTotal(v LogsGroupByTotal) { + o.Total = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.Histogram != nil { + toSerialize["histogram"] = o.Histogram + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Missing != nil { + toSerialize["missing"] = o.Missing + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsGroupBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Facet *string `json:"facet"` + }{} + all := struct { + Facet string `json:"facet"` + Histogram *LogsGroupByHistogram `json:"histogram,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Missing *LogsGroupByMissing `json:"missing,omitempty"` + Sort *LogsAggregateSort `json:"sort,omitempty"` + Total *LogsGroupByTotal `json:"total,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Facet == nil { + return fmt.Errorf("Required field facet missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Facet = all.Facet + if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Histogram = all.Histogram + o.Limit = all.Limit + o.Missing = all.Missing + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Sort = all.Sort + o.Total = all.Total + return nil +} diff --git a/api/v2/datadog/model_logs_group_by_histogram.go b/api/v2/datadog/model_logs_group_by_histogram.go new file mode 100644 index 00000000000..f777cce9702 --- /dev/null +++ b/api/v2/datadog/model_logs_group_by_histogram.go @@ -0,0 +1,172 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsGroupByHistogram Used to perform a histogram computation (only for measure facets). +// Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. +type LogsGroupByHistogram struct { + // The bin size of the histogram buckets + Interval float64 `json:"interval"` + // The maximum value for the measure used in the histogram + // (values greater than this one are filtered out) + Max float64 `json:"max"` + // The minimum value for the measure used in the histogram + // (values smaller than this one are filtered out) + Min float64 `json:"min"` + // 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{} +} + +// NewLogsGroupByHistogram instantiates a new LogsGroupByHistogram 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 NewLogsGroupByHistogram(interval float64, max float64, min float64) *LogsGroupByHistogram { + this := LogsGroupByHistogram{} + this.Interval = interval + this.Max = max + this.Min = min + return &this +} + +// NewLogsGroupByHistogramWithDefaults instantiates a new LogsGroupByHistogram 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 NewLogsGroupByHistogramWithDefaults() *LogsGroupByHistogram { + this := LogsGroupByHistogram{} + return &this +} + +// GetInterval returns the Interval field value. +func (o *LogsGroupByHistogram) GetInterval() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value +// and a boolean to check if the value has been set. +func (o *LogsGroupByHistogram) GetIntervalOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Interval, true +} + +// SetInterval sets field value. +func (o *LogsGroupByHistogram) SetInterval(v float64) { + o.Interval = v +} + +// GetMax returns the Max field value. +func (o *LogsGroupByHistogram) GetMax() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Max +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *LogsGroupByHistogram) GetMaxOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Max, true +} + +// SetMax sets field value. +func (o *LogsGroupByHistogram) SetMax(v float64) { + o.Max = v +} + +// GetMin returns the Min field value. +func (o *LogsGroupByHistogram) GetMin() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Min +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *LogsGroupByHistogram) GetMinOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Min, true +} + +// SetMin sets field value. +func (o *LogsGroupByHistogram) SetMin(v float64) { + o.Min = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsGroupByHistogram) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["interval"] = o.Interval + toSerialize["max"] = o.Max + toSerialize["min"] = o.Min + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Interval *float64 `json:"interval"` + Max *float64 `json:"max"` + Min *float64 `json:"min"` + }{} + all := struct { + Interval float64 `json:"interval"` + Max float64 `json:"max"` + Min float64 `json:"min"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Interval == nil { + return fmt.Errorf("Required field interval missing") + } + if required.Max == nil { + return fmt.Errorf("Required field max missing") + } + if required.Min == nil { + return fmt.Errorf("Required field min missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Interval = all.Interval + o.Max = all.Max + o.Min = all.Min + return nil +} diff --git a/api/v2/datadog/model_logs_group_by_missing.go b/api/v2/datadog/model_logs_group_by_missing.go new file mode 100644 index 00000000000..1d4f3356348 --- /dev/null +++ b/api/v2/datadog/model_logs_group_by_missing.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsGroupByMissing - The value to use for logs that don't have the facet used to group by +type LogsGroupByMissing struct { + LogsGroupByMissingString *string + LogsGroupByMissingNumber *float64 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// LogsGroupByMissingStringAsLogsGroupByMissing is a convenience function that returns string wrapped in LogsGroupByMissing. +func LogsGroupByMissingStringAsLogsGroupByMissing(v *string) LogsGroupByMissing { + return LogsGroupByMissing{LogsGroupByMissingString: v} +} + +// LogsGroupByMissingNumberAsLogsGroupByMissing is a convenience function that returns float64 wrapped in LogsGroupByMissing. +func LogsGroupByMissingNumberAsLogsGroupByMissing(v *float64) LogsGroupByMissing { + return LogsGroupByMissing{LogsGroupByMissingNumber: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *LogsGroupByMissing) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into LogsGroupByMissingString + err = json.Unmarshal(data, &obj.LogsGroupByMissingString) + if err == nil { + if obj.LogsGroupByMissingString != nil { + jsonLogsGroupByMissingString, _ := json.Marshal(obj.LogsGroupByMissingString) + if string(jsonLogsGroupByMissingString) == "{}" { // empty struct + obj.LogsGroupByMissingString = nil + } else { + match++ + } + } else { + obj.LogsGroupByMissingString = nil + } + } else { + obj.LogsGroupByMissingString = nil + } + + // try to unmarshal data into LogsGroupByMissingNumber + err = json.Unmarshal(data, &obj.LogsGroupByMissingNumber) + if err == nil { + if obj.LogsGroupByMissingNumber != nil { + jsonLogsGroupByMissingNumber, _ := json.Marshal(obj.LogsGroupByMissingNumber) + if string(jsonLogsGroupByMissingNumber) == "{}" { // empty struct + obj.LogsGroupByMissingNumber = nil + } else { + match++ + } + } else { + obj.LogsGroupByMissingNumber = nil + } + } else { + obj.LogsGroupByMissingNumber = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.LogsGroupByMissingString = nil + obj.LogsGroupByMissingNumber = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj LogsGroupByMissing) MarshalJSON() ([]byte, error) { + if obj.LogsGroupByMissingString != nil { + return json.Marshal(&obj.LogsGroupByMissingString) + } + + if obj.LogsGroupByMissingNumber != nil { + return json.Marshal(&obj.LogsGroupByMissingNumber) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *LogsGroupByMissing) GetActualInstance() interface{} { + if obj.LogsGroupByMissingString != nil { + return obj.LogsGroupByMissingString + } + + if obj.LogsGroupByMissingNumber != nil { + return obj.LogsGroupByMissingNumber + } + + // all schemas are nil + return nil +} + +// NullableLogsGroupByMissing handles when a null is used for LogsGroupByMissing. +type NullableLogsGroupByMissing struct { + value *LogsGroupByMissing + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsGroupByMissing) Get() *LogsGroupByMissing { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsGroupByMissing) Set(val *LogsGroupByMissing) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsGroupByMissing) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableLogsGroupByMissing) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsGroupByMissing initializes the struct as if Set has been called. +func NewNullableLogsGroupByMissing(val *LogsGroupByMissing) *NullableLogsGroupByMissing { + return &NullableLogsGroupByMissing{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsGroupByMissing) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsGroupByMissing) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_group_by_total.go b/api/v2/datadog/model_logs_group_by_total.go new file mode 100644 index 00000000000..1da8dd34af8 --- /dev/null +++ b/api/v2/datadog/model_logs_group_by_total.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsGroupByTotal - A resulting object to put the given computes in over all the matching records. +type LogsGroupByTotal struct { + LogsGroupByTotalBoolean *bool + LogsGroupByTotalString *string + LogsGroupByTotalNumber *float64 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// LogsGroupByTotalBooleanAsLogsGroupByTotal is a convenience function that returns bool wrapped in LogsGroupByTotal. +func LogsGroupByTotalBooleanAsLogsGroupByTotal(v *bool) LogsGroupByTotal { + return LogsGroupByTotal{LogsGroupByTotalBoolean: v} +} + +// LogsGroupByTotalStringAsLogsGroupByTotal is a convenience function that returns string wrapped in LogsGroupByTotal. +func LogsGroupByTotalStringAsLogsGroupByTotal(v *string) LogsGroupByTotal { + return LogsGroupByTotal{LogsGroupByTotalString: v} +} + +// LogsGroupByTotalNumberAsLogsGroupByTotal is a convenience function that returns float64 wrapped in LogsGroupByTotal. +func LogsGroupByTotalNumberAsLogsGroupByTotal(v *float64) LogsGroupByTotal { + return LogsGroupByTotal{LogsGroupByTotalNumber: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *LogsGroupByTotal) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into LogsGroupByTotalBoolean + err = json.Unmarshal(data, &obj.LogsGroupByTotalBoolean) + if err == nil { + if obj.LogsGroupByTotalBoolean != nil { + jsonLogsGroupByTotalBoolean, _ := json.Marshal(obj.LogsGroupByTotalBoolean) + if string(jsonLogsGroupByTotalBoolean) == "{}" { // empty struct + obj.LogsGroupByTotalBoolean = nil + } else { + match++ + } + } else { + obj.LogsGroupByTotalBoolean = nil + } + } else { + obj.LogsGroupByTotalBoolean = nil + } + + // try to unmarshal data into LogsGroupByTotalString + err = json.Unmarshal(data, &obj.LogsGroupByTotalString) + if err == nil { + if obj.LogsGroupByTotalString != nil { + jsonLogsGroupByTotalString, _ := json.Marshal(obj.LogsGroupByTotalString) + if string(jsonLogsGroupByTotalString) == "{}" { // empty struct + obj.LogsGroupByTotalString = nil + } else { + match++ + } + } else { + obj.LogsGroupByTotalString = nil + } + } else { + obj.LogsGroupByTotalString = nil + } + + // try to unmarshal data into LogsGroupByTotalNumber + err = json.Unmarshal(data, &obj.LogsGroupByTotalNumber) + if err == nil { + if obj.LogsGroupByTotalNumber != nil { + jsonLogsGroupByTotalNumber, _ := json.Marshal(obj.LogsGroupByTotalNumber) + if string(jsonLogsGroupByTotalNumber) == "{}" { // empty struct + obj.LogsGroupByTotalNumber = nil + } else { + match++ + } + } else { + obj.LogsGroupByTotalNumber = nil + } + } else { + obj.LogsGroupByTotalNumber = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.LogsGroupByTotalBoolean = nil + obj.LogsGroupByTotalString = nil + obj.LogsGroupByTotalNumber = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj LogsGroupByTotal) MarshalJSON() ([]byte, error) { + if obj.LogsGroupByTotalBoolean != nil { + return json.Marshal(&obj.LogsGroupByTotalBoolean) + } + + if obj.LogsGroupByTotalString != nil { + return json.Marshal(&obj.LogsGroupByTotalString) + } + + if obj.LogsGroupByTotalNumber != nil { + return json.Marshal(&obj.LogsGroupByTotalNumber) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *LogsGroupByTotal) GetActualInstance() interface{} { + if obj.LogsGroupByTotalBoolean != nil { + return obj.LogsGroupByTotalBoolean + } + + if obj.LogsGroupByTotalString != nil { + return obj.LogsGroupByTotalString + } + + if obj.LogsGroupByTotalNumber != nil { + return obj.LogsGroupByTotalNumber + } + + // all schemas are nil + return nil +} + +// NullableLogsGroupByTotal handles when a null is used for LogsGroupByTotal. +type NullableLogsGroupByTotal struct { + value *LogsGroupByTotal + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsGroupByTotal) Get() *LogsGroupByTotal { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsGroupByTotal) Set(val *LogsGroupByTotal) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsGroupByTotal) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableLogsGroupByTotal) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsGroupByTotal initializes the struct as if Set has been called. +func NewNullableLogsGroupByTotal(val *LogsGroupByTotal) *NullableLogsGroupByTotal { + return &NullableLogsGroupByTotal{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsGroupByTotal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsGroupByTotal) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_list_request.go b/api/v2/datadog/model_logs_list_request.go new file mode 100644 index 00000000000..adbb6711e09 --- /dev/null +++ b/api/v2/datadog/model_logs_list_request.go @@ -0,0 +1,249 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsListRequest The request for a logs list. +type LogsListRequest struct { + // The search and filter query settings + Filter *LogsQueryFilter `json:"filter,omitempty"` + // Global query options that are used during the query. + // Note: You should only supply timezone or time offset but not both otherwise the query will fail. + Options *LogsQueryOptions `json:"options,omitempty"` + // Paging attributes for listing logs. + Page *LogsListRequestPage `json:"page,omitempty"` + // Sort parameters when querying logs. + Sort *LogsSort `json:"sort,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{} +} + +// NewLogsListRequest instantiates a new LogsListRequest 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 NewLogsListRequest() *LogsListRequest { + this := LogsListRequest{} + return &this +} + +// NewLogsListRequestWithDefaults instantiates a new LogsListRequest 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 NewLogsListRequestWithDefaults() *LogsListRequest { + this := LogsListRequest{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsListRequest) GetFilter() LogsQueryFilter { + if o == nil || o.Filter == nil { + var ret LogsQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetFilterOk() (*LogsQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsListRequest) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsQueryFilter and assigns it to the Filter field. +func (o *LogsListRequest) SetFilter(v LogsQueryFilter) { + o.Filter = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *LogsListRequest) GetOptions() LogsQueryOptions { + if o == nil || o.Options == nil { + var ret LogsQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetOptionsOk() (*LogsQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *LogsListRequest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given LogsQueryOptions and assigns it to the Options field. +func (o *LogsListRequest) SetOptions(v LogsQueryOptions) { + o.Options = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *LogsListRequest) GetPage() LogsListRequestPage { + if o == nil || o.Page == nil { + var ret LogsListRequestPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetPageOk() (*LogsListRequestPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *LogsListRequest) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given LogsListRequestPage and assigns it to the Page field. +func (o *LogsListRequest) SetPage(v LogsListRequestPage) { + o.Page = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *LogsListRequest) GetSort() LogsSort { + if o == nil || o.Sort == nil { + var ret LogsSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequest) GetSortOk() (*LogsSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *LogsListRequest) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given LogsSort and assigns it to the Sort field. +func (o *LogsListRequest) SetSort(v LogsSort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsListRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filter *LogsQueryFilter `json:"filter,omitempty"` + Options *LogsQueryOptions `json:"options,omitempty"` + Page *LogsListRequestPage `json:"page,omitempty"` + Sort *LogsSort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.Sort = all.Sort + return nil +} diff --git a/api/v2/datadog/model_logs_list_request_page.go b/api/v2/datadog/model_logs_list_request_page.go new file mode 100644 index 00000000000..862c8281ea6 --- /dev/null +++ b/api/v2/datadog/model_logs_list_request_page.go @@ -0,0 +1,145 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsListRequestPage Paging attributes for listing logs. +type LogsListRequestPage struct { + // List following results with a cursor provided in the previous query. + Cursor *string `json:"cursor,omitempty"` + // Maximum number of logs in the response. + Limit *int32 `json:"limit,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{} +} + +// NewLogsListRequestPage instantiates a new LogsListRequestPage 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 NewLogsListRequestPage() *LogsListRequestPage { + this := LogsListRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// NewLogsListRequestPageWithDefaults instantiates a new LogsListRequestPage 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 NewLogsListRequestPageWithDefaults() *LogsListRequestPage { + this := LogsListRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *LogsListRequestPage) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequestPage) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *LogsListRequestPage) HasCursor() bool { + if o != nil && o.Cursor != nil { + return true + } + + return false +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *LogsListRequestPage) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *LogsListRequestPage) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListRequestPage) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *LogsListRequestPage) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *LogsListRequestPage) SetLimit(v int32) { + o.Limit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsListRequestPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsListRequestPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int32 `json:"limit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cursor = all.Cursor + o.Limit = all.Limit + return nil +} diff --git a/api/v2/datadog/model_logs_list_response.go b/api/v2/datadog/model_logs_list_response.go new file mode 100644 index 00000000000..b7f80e060b5 --- /dev/null +++ b/api/v2/datadog/model_logs_list_response.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsListResponse Response object with all logs matching the request and pagination information. +type LogsListResponse struct { + // Array of logs matching the request. + Data []Log `json:"data,omitempty"` + // Links attributes. + Links *LogsListResponseLinks `json:"links,omitempty"` + // The metadata associated with a request + Meta *LogsResponseMetadata `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{} +} + +// NewLogsListResponse instantiates a new LogsListResponse 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 NewLogsListResponse() *LogsListResponse { + this := LogsListResponse{} + return &this +} + +// NewLogsListResponseWithDefaults instantiates a new LogsListResponse 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 NewLogsListResponseWithDefaults() *LogsListResponse { + this := LogsListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsListResponse) GetData() []Log { + if o == nil || o.Data == nil { + var ret []Log + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListResponse) GetDataOk() (*[]Log, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsListResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []Log and assigns it to the Data field. +func (o *LogsListResponse) SetData(v []Log) { + o.Data = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *LogsListResponse) GetLinks() LogsListResponseLinks { + if o == nil || o.Links == nil { + var ret LogsListResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListResponse) GetLinksOk() (*LogsListResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *LogsListResponse) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +// SetLinks gets a reference to the given LogsListResponseLinks and assigns it to the Links field. +func (o *LogsListResponse) SetLinks(v LogsListResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *LogsListResponse) GetMeta() LogsResponseMetadata { + if o == nil || o.Meta == nil { + var ret LogsResponseMetadata + 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 *LogsListResponse) GetMetaOk() (*LogsResponseMetadata, 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 *LogsListResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given LogsResponseMetadata and assigns it to the Meta field. +func (o *LogsListResponse) SetMeta(v LogsResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []Log `json:"data,omitempty"` + Links *LogsListResponseLinks `json:"links,omitempty"` + Meta *LogsResponseMetadata `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_logs_list_response_links.go b/api/v2/datadog/model_logs_list_response_links.go new file mode 100644 index 00000000000..636248a8d19 --- /dev/null +++ b/api/v2/datadog/model_logs_list_response_links.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsListResponseLinks Links attributes. +type LogsListResponseLinks struct { + // Link for the next set of results. Note that the request can also be made using the + // POST endpoint. + Next *string `json:"next,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{} +} + +// NewLogsListResponseLinks instantiates a new LogsListResponseLinks 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 NewLogsListResponseLinks() *LogsListResponseLinks { + this := LogsListResponseLinks{} + return &this +} + +// NewLogsListResponseLinksWithDefaults instantiates a new LogsListResponseLinks 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 NewLogsListResponseLinksWithDefaults() *LogsListResponseLinks { + this := LogsListResponseLinks{} + return &this +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *LogsListResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsListResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *LogsListResponseLinks) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *LogsListResponseLinks) SetNext(v string) { + o.Next = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsListResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Next *string `json:"next,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Next = all.Next + return nil +} diff --git a/api/v2/datadog/model_logs_metric_compute.go b/api/v2/datadog/model_logs_metric_compute.go new file mode 100644 index 00000000000..1b48d9092e9 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_compute.go @@ -0,0 +1,150 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricCompute The compute rule to compute the log-based metric. +type LogsMetricCompute struct { + // The type of aggregation to use. + AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"` + // The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution"). + Path *string `json:"path,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{} +} + +// NewLogsMetricCompute instantiates a new LogsMetricCompute 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 NewLogsMetricCompute(aggregationType LogsMetricComputeAggregationType) *LogsMetricCompute { + this := LogsMetricCompute{} + this.AggregationType = aggregationType + return &this +} + +// NewLogsMetricComputeWithDefaults instantiates a new LogsMetricCompute 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 NewLogsMetricComputeWithDefaults() *LogsMetricCompute { + this := LogsMetricCompute{} + return &this +} + +// GetAggregationType returns the AggregationType field value. +func (o *LogsMetricCompute) GetAggregationType() LogsMetricComputeAggregationType { + if o == nil { + var ret LogsMetricComputeAggregationType + return ret + } + return o.AggregationType +} + +// GetAggregationTypeOk returns a tuple with the AggregationType field value +// and a boolean to check if the value has been set. +func (o *LogsMetricCompute) GetAggregationTypeOk() (*LogsMetricComputeAggregationType, bool) { + if o == nil { + return nil, false + } + return &o.AggregationType, true +} + +// SetAggregationType sets field value. +func (o *LogsMetricCompute) SetAggregationType(v LogsMetricComputeAggregationType) { + o.AggregationType = v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *LogsMetricCompute) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricCompute) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *LogsMetricCompute) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *LogsMetricCompute) SetPath(v string) { + o.Path = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation_type"] = o.AggregationType + if o.Path != nil { + toSerialize["path"] = o.Path + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + AggregationType *LogsMetricComputeAggregationType `json:"aggregation_type"` + }{} + all := struct { + AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"` + Path *string `json:"path,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.AggregationType == nil { + return fmt.Errorf("Required field aggregation_type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.AggregationType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AggregationType = all.AggregationType + o.Path = all.Path + return nil +} diff --git a/api/v2/datadog/model_logs_metric_compute_aggregation_type.go b/api/v2/datadog/model_logs_metric_compute_aggregation_type.go new file mode 100644 index 00000000000..fa374be51fa --- /dev/null +++ b/api/v2/datadog/model_logs_metric_compute_aggregation_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricComputeAggregationType The type of aggregation to use. +type LogsMetricComputeAggregationType string + +// List of LogsMetricComputeAggregationType. +const ( + LOGSMETRICCOMPUTEAGGREGATIONTYPE_COUNT LogsMetricComputeAggregationType = "count" + LOGSMETRICCOMPUTEAGGREGATIONTYPE_DISTRIBUTION LogsMetricComputeAggregationType = "distribution" +) + +var allowedLogsMetricComputeAggregationTypeEnumValues = []LogsMetricComputeAggregationType{ + LOGSMETRICCOMPUTEAGGREGATIONTYPE_COUNT, + LOGSMETRICCOMPUTEAGGREGATIONTYPE_DISTRIBUTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsMetricComputeAggregationType) GetAllowedValues() []LogsMetricComputeAggregationType { + return allowedLogsMetricComputeAggregationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsMetricComputeAggregationType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsMetricComputeAggregationType(value) + return nil +} + +// NewLogsMetricComputeAggregationTypeFromValue returns a pointer to a valid LogsMetricComputeAggregationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsMetricComputeAggregationTypeFromValue(v string) (*LogsMetricComputeAggregationType, error) { + ev := LogsMetricComputeAggregationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsMetricComputeAggregationType: valid values are %v", v, allowedLogsMetricComputeAggregationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsMetricComputeAggregationType) IsValid() bool { + for _, existing := range allowedLogsMetricComputeAggregationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsMetricComputeAggregationType value. +func (v LogsMetricComputeAggregationType) Ptr() *LogsMetricComputeAggregationType { + return &v +} + +// NullableLogsMetricComputeAggregationType handles when a null is used for LogsMetricComputeAggregationType. +type NullableLogsMetricComputeAggregationType struct { + value *LogsMetricComputeAggregationType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsMetricComputeAggregationType) Get() *LogsMetricComputeAggregationType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsMetricComputeAggregationType) Set(val *LogsMetricComputeAggregationType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsMetricComputeAggregationType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsMetricComputeAggregationType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsMetricComputeAggregationType initializes the struct as if Set has been called. +func NewNullableLogsMetricComputeAggregationType(val *LogsMetricComputeAggregationType) *NullableLogsMetricComputeAggregationType { + return &NullableLogsMetricComputeAggregationType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsMetricComputeAggregationType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsMetricComputeAggregationType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_metric_create_attributes.go b/api/v2/datadog/model_logs_metric_create_attributes.go new file mode 100644 index 00000000000..20e02a65ec6 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_create_attributes.go @@ -0,0 +1,195 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricCreateAttributes The object describing the Datadog log-based metric to create. +type LogsMetricCreateAttributes struct { + // The compute rule to compute the log-based metric. + Compute LogsMetricCompute `json:"compute"` + // The log-based metric filter. Logs matching this filter will be aggregated in this metric. + Filter *LogsMetricFilter `json:"filter,omitempty"` + // The rules for the group by. + GroupBy []LogsMetricGroupBy `json:"group_by,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{} +} + +// NewLogsMetricCreateAttributes instantiates a new LogsMetricCreateAttributes 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 NewLogsMetricCreateAttributes(compute LogsMetricCompute) *LogsMetricCreateAttributes { + this := LogsMetricCreateAttributes{} + this.Compute = compute + return &this +} + +// NewLogsMetricCreateAttributesWithDefaults instantiates a new LogsMetricCreateAttributes 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 NewLogsMetricCreateAttributesWithDefaults() *LogsMetricCreateAttributes { + this := LogsMetricCreateAttributes{} + return &this +} + +// GetCompute returns the Compute field value. +func (o *LogsMetricCreateAttributes) GetCompute() LogsMetricCompute { + if o == nil { + var ret LogsMetricCompute + return ret + } + return o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value +// and a boolean to check if the value has been set. +func (o *LogsMetricCreateAttributes) GetComputeOk() (*LogsMetricCompute, bool) { + if o == nil { + return nil, false + } + return &o.Compute, true +} + +// SetCompute sets field value. +func (o *LogsMetricCreateAttributes) SetCompute(v LogsMetricCompute) { + o.Compute = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsMetricCreateAttributes) GetFilter() LogsMetricFilter { + if o == nil || o.Filter == nil { + var ret LogsMetricFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricCreateAttributes) GetFilterOk() (*LogsMetricFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsMetricCreateAttributes) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsMetricFilter and assigns it to the Filter field. +func (o *LogsMetricCreateAttributes) SetFilter(v LogsMetricFilter) { + o.Filter = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *LogsMetricCreateAttributes) GetGroupBy() []LogsMetricGroupBy { + if o == nil || o.GroupBy == nil { + var ret []LogsMetricGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricCreateAttributes) GetGroupByOk() (*[]LogsMetricGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *LogsMetricCreateAttributes) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []LogsMetricGroupBy and assigns it to the GroupBy field. +func (o *LogsMetricCreateAttributes) SetGroupBy(v []LogsMetricGroupBy) { + o.GroupBy = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["compute"] = o.Compute + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Compute *LogsMetricCompute `json:"compute"` + }{} + all := struct { + Compute LogsMetricCompute `json:"compute"` + Filter *LogsMetricFilter `json:"filter,omitempty"` + GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Compute == nil { + return fmt.Errorf("Required field compute missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Compute = all.Compute + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.GroupBy = all.GroupBy + return nil +} diff --git a/api/v2/datadog/model_logs_metric_create_data.go b/api/v2/datadog/model_logs_metric_create_data.go new file mode 100644 index 00000000000..959b39a597d --- /dev/null +++ b/api/v2/datadog/model_logs_metric_create_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricCreateData The new log-based metric properties. +type LogsMetricCreateData struct { + // The object describing the Datadog log-based metric to create. + Attributes LogsMetricCreateAttributes `json:"attributes"` + // The name of the log-based metric. + Id string `json:"id"` + // The type of the resource. The value should always be logs_metrics. + Type LogsMetricType `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{} +} + +// NewLogsMetricCreateData instantiates a new LogsMetricCreateData 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 NewLogsMetricCreateData(attributes LogsMetricCreateAttributes, id string, typeVar LogsMetricType) *LogsMetricCreateData { + this := LogsMetricCreateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewLogsMetricCreateDataWithDefaults instantiates a new LogsMetricCreateData 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 NewLogsMetricCreateDataWithDefaults() *LogsMetricCreateData { + this := LogsMetricCreateData{} + var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *LogsMetricCreateData) GetAttributes() LogsMetricCreateAttributes { + if o == nil { + var ret LogsMetricCreateAttributes + 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 *LogsMetricCreateData) GetAttributesOk() (*LogsMetricCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *LogsMetricCreateData) SetAttributes(v LogsMetricCreateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *LogsMetricCreateData) 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 *LogsMetricCreateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *LogsMetricCreateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *LogsMetricCreateData) GetType() LogsMetricType { + if o == nil { + var ret LogsMetricType + 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 *LogsMetricCreateData) GetTypeOk() (*LogsMetricType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsMetricCreateData) SetType(v LogsMetricType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *LogsMetricCreateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *LogsMetricType `json:"type"` + }{} + all := struct { + Attributes LogsMetricCreateAttributes `json:"attributes"` + Id string `json:"id"` + Type LogsMetricType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_metric_create_request.go b/api/v2/datadog/model_logs_metric_create_request.go new file mode 100644 index 00000000000..66c774553a4 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricCreateRequest The new log-based metric body. +type LogsMetricCreateRequest struct { + // The new log-based metric properties. + Data LogsMetricCreateData `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{} +} + +// NewLogsMetricCreateRequest instantiates a new LogsMetricCreateRequest 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 NewLogsMetricCreateRequest(data LogsMetricCreateData) *LogsMetricCreateRequest { + this := LogsMetricCreateRequest{} + this.Data = data + return &this +} + +// NewLogsMetricCreateRequestWithDefaults instantiates a new LogsMetricCreateRequest 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 NewLogsMetricCreateRequestWithDefaults() *LogsMetricCreateRequest { + this := LogsMetricCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *LogsMetricCreateRequest) GetData() LogsMetricCreateData { + if o == nil { + var ret LogsMetricCreateData + 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 *LogsMetricCreateRequest) GetDataOk() (*LogsMetricCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *LogsMetricCreateRequest) SetData(v LogsMetricCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *LogsMetricCreateData `json:"data"` + }{} + all := struct { + Data LogsMetricCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_metric_filter.go b/api/v2/datadog/model_logs_metric_filter.go new file mode 100644 index 00000000000..4d02bf62e0e --- /dev/null +++ b/api/v2/datadog/model_logs_metric_filter.go @@ -0,0 +1,106 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsMetricFilter The log-based metric filter. Logs matching this filter will be aggregated in this metric. +type LogsMetricFilter struct { + // The search query - following the log search syntax. + Query *string `json:"query,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{} +} + +// NewLogsMetricFilter instantiates a new LogsMetricFilter 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 NewLogsMetricFilter() *LogsMetricFilter { + this := LogsMetricFilter{} + var query string = "*" + this.Query = &query + return &this +} + +// NewLogsMetricFilterWithDefaults instantiates a new LogsMetricFilter 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 NewLogsMetricFilterWithDefaults() *LogsMetricFilter { + this := LogsMetricFilter{} + var query string = "*" + this.Query = &query + return &this +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *LogsMetricFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *LogsMetricFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *LogsMetricFilter) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Query *string `json:"query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_logs_metric_group_by.go b/api/v2/datadog/model_logs_metric_group_by.go new file mode 100644 index 00000000000..075f3fda147 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_group_by.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricGroupBy A group by rule. +type LogsMetricGroupBy struct { + // The path to the value the log-based metric will be aggregated over. + Path string `json:"path"` + // Eventual name of the tag that gets created. By default, the path attribute is used as the tag name. + TagName *string `json:"tag_name,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{} +} + +// NewLogsMetricGroupBy instantiates a new LogsMetricGroupBy 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 NewLogsMetricGroupBy(path string) *LogsMetricGroupBy { + this := LogsMetricGroupBy{} + this.Path = path + return &this +} + +// NewLogsMetricGroupByWithDefaults instantiates a new LogsMetricGroupBy 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 NewLogsMetricGroupByWithDefaults() *LogsMetricGroupBy { + this := LogsMetricGroupBy{} + return &this +} + +// GetPath returns the Path field value. +func (o *LogsMetricGroupBy) GetPath() string { + if o == nil { + var ret string + return ret + } + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *LogsMetricGroupBy) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Path, true +} + +// SetPath sets field value. +func (o *LogsMetricGroupBy) SetPath(v string) { + o.Path = v +} + +// GetTagName returns the TagName field value if set, zero value otherwise. +func (o *LogsMetricGroupBy) GetTagName() string { + if o == nil || o.TagName == nil { + var ret string + return ret + } + return *o.TagName +} + +// GetTagNameOk returns a tuple with the TagName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricGroupBy) GetTagNameOk() (*string, bool) { + if o == nil || o.TagName == nil { + return nil, false + } + return o.TagName, true +} + +// HasTagName returns a boolean if a field has been set. +func (o *LogsMetricGroupBy) HasTagName() bool { + if o != nil && o.TagName != nil { + return true + } + + return false +} + +// SetTagName gets a reference to the given string and assigns it to the TagName field. +func (o *LogsMetricGroupBy) SetTagName(v string) { + o.TagName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["path"] = o.Path + if o.TagName != nil { + toSerialize["tag_name"] = o.TagName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Path *string `json:"path"` + }{} + all := struct { + Path string `json:"path"` + TagName *string `json:"tag_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Path == nil { + return fmt.Errorf("Required field path missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Path = all.Path + o.TagName = all.TagName + return nil +} diff --git a/api/v2/datadog/model_logs_metric_response.go b/api/v2/datadog/model_logs_metric_response.go new file mode 100644 index 00000000000..dec5b21c202 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsMetricResponse The log-based metric object. +type LogsMetricResponse struct { + // The log-based metric properties. + Data *LogsMetricResponseData `json:"data,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{} +} + +// NewLogsMetricResponse instantiates a new LogsMetricResponse 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 NewLogsMetricResponse() *LogsMetricResponse { + this := LogsMetricResponse{} + return &this +} + +// NewLogsMetricResponseWithDefaults instantiates a new LogsMetricResponse 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 NewLogsMetricResponseWithDefaults() *LogsMetricResponse { + this := LogsMetricResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsMetricResponse) GetData() LogsMetricResponseData { + if o == nil || o.Data == nil { + var ret LogsMetricResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponse) GetDataOk() (*LogsMetricResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsMetricResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given LogsMetricResponseData and assigns it to the Data field. +func (o *LogsMetricResponse) SetData(v LogsMetricResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *LogsMetricResponseData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_metric_response_attributes.go b/api/v2/datadog/model_logs_metric_response_attributes.go new file mode 100644 index 00000000000..55ffb3857a5 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_response_attributes.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsMetricResponseAttributes The object describing a Datadog log-based metric. +type LogsMetricResponseAttributes struct { + // The compute rule to compute the log-based metric. + Compute *LogsMetricResponseCompute `json:"compute,omitempty"` + // The log-based metric filter. Logs matching this filter will be aggregated in this metric. + Filter *LogsMetricResponseFilter `json:"filter,omitempty"` + // The rules for the group by. + GroupBy []LogsMetricResponseGroupBy `json:"group_by,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{} +} + +// NewLogsMetricResponseAttributes instantiates a new LogsMetricResponseAttributes 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 NewLogsMetricResponseAttributes() *LogsMetricResponseAttributes { + this := LogsMetricResponseAttributes{} + return &this +} + +// NewLogsMetricResponseAttributesWithDefaults instantiates a new LogsMetricResponseAttributes 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 NewLogsMetricResponseAttributesWithDefaults() *LogsMetricResponseAttributes { + this := LogsMetricResponseAttributes{} + return &this +} + +// GetCompute returns the Compute field value if set, zero value otherwise. +func (o *LogsMetricResponseAttributes) GetCompute() LogsMetricResponseCompute { + if o == nil || o.Compute == nil { + var ret LogsMetricResponseCompute + return ret + } + return *o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseAttributes) GetComputeOk() (*LogsMetricResponseCompute, bool) { + if o == nil || o.Compute == nil { + return nil, false + } + return o.Compute, true +} + +// HasCompute returns a boolean if a field has been set. +func (o *LogsMetricResponseAttributes) HasCompute() bool { + if o != nil && o.Compute != nil { + return true + } + + return false +} + +// SetCompute gets a reference to the given LogsMetricResponseCompute and assigns it to the Compute field. +func (o *LogsMetricResponseAttributes) SetCompute(v LogsMetricResponseCompute) { + o.Compute = &v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsMetricResponseAttributes) GetFilter() LogsMetricResponseFilter { + if o == nil || o.Filter == nil { + var ret LogsMetricResponseFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseAttributes) GetFilterOk() (*LogsMetricResponseFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsMetricResponseAttributes) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsMetricResponseFilter and assigns it to the Filter field. +func (o *LogsMetricResponseAttributes) SetFilter(v LogsMetricResponseFilter) { + o.Filter = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *LogsMetricResponseAttributes) GetGroupBy() []LogsMetricResponseGroupBy { + if o == nil || o.GroupBy == nil { + var ret []LogsMetricResponseGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseAttributes) GetGroupByOk() (*[]LogsMetricResponseGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *LogsMetricResponseAttributes) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []LogsMetricResponseGroupBy and assigns it to the GroupBy field. +func (o *LogsMetricResponseAttributes) SetGroupBy(v []LogsMetricResponseGroupBy) { + o.GroupBy = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Compute != nil { + toSerialize["compute"] = o.Compute + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Compute *LogsMetricResponseCompute `json:"compute,omitempty"` + Filter *LogsMetricResponseFilter `json:"filter,omitempty"` + GroupBy []LogsMetricResponseGroupBy `json:"group_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Compute = all.Compute + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.GroupBy = all.GroupBy + return nil +} diff --git a/api/v2/datadog/model_logs_metric_response_compute.go b/api/v2/datadog/model_logs_metric_response_compute.go new file mode 100644 index 00000000000..7cb0674d1f9 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_response_compute.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsMetricResponseCompute The compute rule to compute the log-based metric. +type LogsMetricResponseCompute struct { + // The type of aggregation to use. + AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"` + // The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution"). + Path *string `json:"path,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{} +} + +// NewLogsMetricResponseCompute instantiates a new LogsMetricResponseCompute 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 NewLogsMetricResponseCompute() *LogsMetricResponseCompute { + this := LogsMetricResponseCompute{} + return &this +} + +// NewLogsMetricResponseComputeWithDefaults instantiates a new LogsMetricResponseCompute 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 NewLogsMetricResponseComputeWithDefaults() *LogsMetricResponseCompute { + this := LogsMetricResponseCompute{} + return &this +} + +// GetAggregationType returns the AggregationType field value if set, zero value otherwise. +func (o *LogsMetricResponseCompute) GetAggregationType() LogsMetricResponseComputeAggregationType { + if o == nil || o.AggregationType == nil { + var ret LogsMetricResponseComputeAggregationType + return ret + } + return *o.AggregationType +} + +// GetAggregationTypeOk returns a tuple with the AggregationType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseCompute) GetAggregationTypeOk() (*LogsMetricResponseComputeAggregationType, bool) { + if o == nil || o.AggregationType == nil { + return nil, false + } + return o.AggregationType, true +} + +// HasAggregationType returns a boolean if a field has been set. +func (o *LogsMetricResponseCompute) HasAggregationType() bool { + if o != nil && o.AggregationType != nil { + return true + } + + return false +} + +// SetAggregationType gets a reference to the given LogsMetricResponseComputeAggregationType and assigns it to the AggregationType field. +func (o *LogsMetricResponseCompute) SetAggregationType(v LogsMetricResponseComputeAggregationType) { + o.AggregationType = &v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *LogsMetricResponseCompute) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseCompute) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *LogsMetricResponseCompute) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *LogsMetricResponseCompute) SetPath(v string) { + o.Path = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricResponseCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AggregationType != nil { + toSerialize["aggregation_type"] = o.AggregationType + } + if o.Path != nil { + toSerialize["path"] = o.Path + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"` + Path *string `json:"path,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.AggregationType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AggregationType = all.AggregationType + o.Path = all.Path + return nil +} diff --git a/api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go b/api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go new file mode 100644 index 00000000000..8686dfebd83 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_response_compute_aggregation_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricResponseComputeAggregationType The type of aggregation to use. +type LogsMetricResponseComputeAggregationType string + +// List of LogsMetricResponseComputeAggregationType. +const ( + LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_COUNT LogsMetricResponseComputeAggregationType = "count" + LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_DISTRIBUTION LogsMetricResponseComputeAggregationType = "distribution" +) + +var allowedLogsMetricResponseComputeAggregationTypeEnumValues = []LogsMetricResponseComputeAggregationType{ + LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_COUNT, + LOGSMETRICRESPONSECOMPUTEAGGREGATIONTYPE_DISTRIBUTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsMetricResponseComputeAggregationType) GetAllowedValues() []LogsMetricResponseComputeAggregationType { + return allowedLogsMetricResponseComputeAggregationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsMetricResponseComputeAggregationType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsMetricResponseComputeAggregationType(value) + return nil +} + +// NewLogsMetricResponseComputeAggregationTypeFromValue returns a pointer to a valid LogsMetricResponseComputeAggregationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsMetricResponseComputeAggregationTypeFromValue(v string) (*LogsMetricResponseComputeAggregationType, error) { + ev := LogsMetricResponseComputeAggregationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsMetricResponseComputeAggregationType: valid values are %v", v, allowedLogsMetricResponseComputeAggregationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsMetricResponseComputeAggregationType) IsValid() bool { + for _, existing := range allowedLogsMetricResponseComputeAggregationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsMetricResponseComputeAggregationType value. +func (v LogsMetricResponseComputeAggregationType) Ptr() *LogsMetricResponseComputeAggregationType { + return &v +} + +// NullableLogsMetricResponseComputeAggregationType handles when a null is used for LogsMetricResponseComputeAggregationType. +type NullableLogsMetricResponseComputeAggregationType struct { + value *LogsMetricResponseComputeAggregationType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsMetricResponseComputeAggregationType) Get() *LogsMetricResponseComputeAggregationType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsMetricResponseComputeAggregationType) Set(val *LogsMetricResponseComputeAggregationType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsMetricResponseComputeAggregationType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsMetricResponseComputeAggregationType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsMetricResponseComputeAggregationType initializes the struct as if Set has been called. +func NewNullableLogsMetricResponseComputeAggregationType(val *LogsMetricResponseComputeAggregationType) *NullableLogsMetricResponseComputeAggregationType { + return &NullableLogsMetricResponseComputeAggregationType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsMetricResponseComputeAggregationType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsMetricResponseComputeAggregationType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_metric_response_data.go b/api/v2/datadog/model_logs_metric_response_data.go new file mode 100644 index 00000000000..647b45c7ab6 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_response_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsMetricResponseData The log-based metric properties. +type LogsMetricResponseData struct { + // The object describing a Datadog log-based metric. + Attributes *LogsMetricResponseAttributes `json:"attributes,omitempty"` + // The name of the log-based metric. + Id *string `json:"id,omitempty"` + // The type of the resource. The value should always be logs_metrics. + Type *LogsMetricType `json:"type,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{} +} + +// NewLogsMetricResponseData instantiates a new LogsMetricResponseData 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 NewLogsMetricResponseData() *LogsMetricResponseData { + this := LogsMetricResponseData{} + var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS + this.Type = &typeVar + return &this +} + +// NewLogsMetricResponseDataWithDefaults instantiates a new LogsMetricResponseData 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 NewLogsMetricResponseDataWithDefaults() *LogsMetricResponseData { + this := LogsMetricResponseData{} + var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *LogsMetricResponseData) GetAttributes() LogsMetricResponseAttributes { + if o == nil || o.Attributes == nil { + var ret LogsMetricResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseData) GetAttributesOk() (*LogsMetricResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *LogsMetricResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given LogsMetricResponseAttributes and assigns it to the Attributes field. +func (o *LogsMetricResponseData) SetAttributes(v LogsMetricResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *LogsMetricResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *LogsMetricResponseData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LogsMetricResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LogsMetricResponseData) GetType() LogsMetricType { + if o == nil || o.Type == nil { + var ret LogsMetricType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseData) GetTypeOk() (*LogsMetricType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LogsMetricResponseData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given LogsMetricType and assigns it to the Type field. +func (o *LogsMetricResponseData) SetType(v LogsMetricType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *LogsMetricResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *LogsMetricType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_metric_response_filter.go b/api/v2/datadog/model_logs_metric_response_filter.go new file mode 100644 index 00000000000..8a7b783cc77 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_response_filter.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 datadog + +import ( + "encoding/json" +) + +// LogsMetricResponseFilter The log-based metric filter. Logs matching this filter will be aggregated in this metric. +type LogsMetricResponseFilter struct { + // The search query - following the log search syntax. + Query *string `json:"query,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{} +} + +// NewLogsMetricResponseFilter instantiates a new LogsMetricResponseFilter 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 NewLogsMetricResponseFilter() *LogsMetricResponseFilter { + this := LogsMetricResponseFilter{} + return &this +} + +// NewLogsMetricResponseFilterWithDefaults instantiates a new LogsMetricResponseFilter 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 NewLogsMetricResponseFilterWithDefaults() *LogsMetricResponseFilter { + this := LogsMetricResponseFilter{} + return &this +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *LogsMetricResponseFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *LogsMetricResponseFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *LogsMetricResponseFilter) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricResponseFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Query *string `json:"query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_logs_metric_response_group_by.go b/api/v2/datadog/model_logs_metric_response_group_by.go new file mode 100644 index 00000000000..d861b819bbb --- /dev/null +++ b/api/v2/datadog/model_logs_metric_response_group_by.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsMetricResponseGroupBy A group by rule. +type LogsMetricResponseGroupBy struct { + // The path to the value the log-based metric will be aggregated over. + Path *string `json:"path,omitempty"` + // Eventual name of the tag that gets created. By default, the path attribute is used as the tag name. + TagName *string `json:"tag_name,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{} +} + +// NewLogsMetricResponseGroupBy instantiates a new LogsMetricResponseGroupBy 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 NewLogsMetricResponseGroupBy() *LogsMetricResponseGroupBy { + this := LogsMetricResponseGroupBy{} + return &this +} + +// NewLogsMetricResponseGroupByWithDefaults instantiates a new LogsMetricResponseGroupBy 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 NewLogsMetricResponseGroupByWithDefaults() *LogsMetricResponseGroupBy { + this := LogsMetricResponseGroupBy{} + return &this +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *LogsMetricResponseGroupBy) GetPath() string { + if o == nil || o.Path == nil { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseGroupBy) GetPathOk() (*string, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *LogsMetricResponseGroupBy) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *LogsMetricResponseGroupBy) SetPath(v string) { + o.Path = &v +} + +// GetTagName returns the TagName field value if set, zero value otherwise. +func (o *LogsMetricResponseGroupBy) GetTagName() string { + if o == nil || o.TagName == nil { + var ret string + return ret + } + return *o.TagName +} + +// GetTagNameOk returns a tuple with the TagName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricResponseGroupBy) GetTagNameOk() (*string, bool) { + if o == nil || o.TagName == nil { + return nil, false + } + return o.TagName, true +} + +// HasTagName returns a boolean if a field has been set. +func (o *LogsMetricResponseGroupBy) HasTagName() bool { + if o != nil && o.TagName != nil { + return true + } + + return false +} + +// SetTagName gets a reference to the given string and assigns it to the TagName field. +func (o *LogsMetricResponseGroupBy) SetTagName(v string) { + o.TagName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricResponseGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Path != nil { + toSerialize["path"] = o.Path + } + if o.TagName != nil { + toSerialize["tag_name"] = o.TagName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Path *string `json:"path,omitempty"` + TagName *string `json:"tag_name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Path = all.Path + o.TagName = all.TagName + return nil +} diff --git a/api/v2/datadog/model_logs_metric_type.go b/api/v2/datadog/model_logs_metric_type.go new file mode 100644 index 00000000000..f8f41c600b7 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricType The type of the resource. The value should always be logs_metrics. +type LogsMetricType string + +// List of LogsMetricType. +const ( + LOGSMETRICTYPE_LOGS_METRICS LogsMetricType = "logs_metrics" +) + +var allowedLogsMetricTypeEnumValues = []LogsMetricType{ + LOGSMETRICTYPE_LOGS_METRICS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsMetricType) GetAllowedValues() []LogsMetricType { + return allowedLogsMetricTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsMetricType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsMetricType(value) + return nil +} + +// NewLogsMetricTypeFromValue returns a pointer to a valid LogsMetricType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsMetricTypeFromValue(v string) (*LogsMetricType, error) { + ev := LogsMetricType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsMetricType: valid values are %v", v, allowedLogsMetricTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsMetricType) IsValid() bool { + for _, existing := range allowedLogsMetricTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsMetricType value. +func (v LogsMetricType) Ptr() *LogsMetricType { + return &v +} + +// NullableLogsMetricType handles when a null is used for LogsMetricType. +type NullableLogsMetricType struct { + value *LogsMetricType + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsMetricType) Get() *LogsMetricType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsMetricType) Set(val *LogsMetricType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsMetricType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsMetricType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsMetricType initializes the struct as if Set has been called. +func NewNullableLogsMetricType(val *LogsMetricType) *NullableLogsMetricType { + return &NullableLogsMetricType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsMetricType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsMetricType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_metric_update_attributes.go b/api/v2/datadog/model_logs_metric_update_attributes.go new file mode 100644 index 00000000000..4b7629a2f0a --- /dev/null +++ b/api/v2/datadog/model_logs_metric_update_attributes.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 datadog + +import ( + "encoding/json" +) + +// LogsMetricUpdateAttributes The log-based metric properties that will be updated. +type LogsMetricUpdateAttributes struct { + // The log-based metric filter. Logs matching this filter will be aggregated in this metric. + Filter *LogsMetricFilter `json:"filter,omitempty"` + // The rules for the group by. + GroupBy []LogsMetricGroupBy `json:"group_by,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{} +} + +// NewLogsMetricUpdateAttributes instantiates a new LogsMetricUpdateAttributes 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 NewLogsMetricUpdateAttributes() *LogsMetricUpdateAttributes { + this := LogsMetricUpdateAttributes{} + return &this +} + +// NewLogsMetricUpdateAttributesWithDefaults instantiates a new LogsMetricUpdateAttributes 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 NewLogsMetricUpdateAttributesWithDefaults() *LogsMetricUpdateAttributes { + this := LogsMetricUpdateAttributes{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *LogsMetricUpdateAttributes) GetFilter() LogsMetricFilter { + if o == nil || o.Filter == nil { + var ret LogsMetricFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricUpdateAttributes) GetFilterOk() (*LogsMetricFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *LogsMetricUpdateAttributes) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given LogsMetricFilter and assigns it to the Filter field. +func (o *LogsMetricUpdateAttributes) SetFilter(v LogsMetricFilter) { + o.Filter = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *LogsMetricUpdateAttributes) GetGroupBy() []LogsMetricGroupBy { + if o == nil || o.GroupBy == nil { + var ret []LogsMetricGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricUpdateAttributes) GetGroupByOk() (*[]LogsMetricGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *LogsMetricUpdateAttributes) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []LogsMetricGroupBy and assigns it to the GroupBy field. +func (o *LogsMetricUpdateAttributes) SetGroupBy(v []LogsMetricGroupBy) { + o.GroupBy = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filter *LogsMetricFilter `json:"filter,omitempty"` + GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.GroupBy = all.GroupBy + return nil +} diff --git a/api/v2/datadog/model_logs_metric_update_data.go b/api/v2/datadog/model_logs_metric_update_data.go new file mode 100644 index 00000000000..4079afab378 --- /dev/null +++ b/api/v2/datadog/model_logs_metric_update_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricUpdateData The new log-based metric properties. +type LogsMetricUpdateData struct { + // The log-based metric properties that will be updated. + Attributes LogsMetricUpdateAttributes `json:"attributes"` + // The type of the resource. The value should always be logs_metrics. + Type LogsMetricType `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{} +} + +// NewLogsMetricUpdateData instantiates a new LogsMetricUpdateData 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 NewLogsMetricUpdateData(attributes LogsMetricUpdateAttributes, typeVar LogsMetricType) *LogsMetricUpdateData { + this := LogsMetricUpdateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewLogsMetricUpdateDataWithDefaults instantiates a new LogsMetricUpdateData 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 NewLogsMetricUpdateDataWithDefaults() *LogsMetricUpdateData { + this := LogsMetricUpdateData{} + var typeVar LogsMetricType = LOGSMETRICTYPE_LOGS_METRICS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *LogsMetricUpdateData) GetAttributes() LogsMetricUpdateAttributes { + if o == nil { + var ret LogsMetricUpdateAttributes + 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 *LogsMetricUpdateData) GetAttributesOk() (*LogsMetricUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *LogsMetricUpdateData) SetAttributes(v LogsMetricUpdateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *LogsMetricUpdateData) GetType() LogsMetricType { + if o == nil { + var ret LogsMetricType + 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 *LogsMetricUpdateData) GetTypeOk() (*LogsMetricType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LogsMetricUpdateData) SetType(v LogsMetricType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *LogsMetricUpdateAttributes `json:"attributes"` + Type *LogsMetricType `json:"type"` + }{} + all := struct { + Attributes LogsMetricUpdateAttributes `json:"attributes"` + Type LogsMetricType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_logs_metric_update_request.go b/api/v2/datadog/model_logs_metric_update_request.go new file mode 100644 index 00000000000..fd790af1b7b --- /dev/null +++ b/api/v2/datadog/model_logs_metric_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsMetricUpdateRequest The new log-based metric body. +type LogsMetricUpdateRequest struct { + // The new log-based metric properties. + Data LogsMetricUpdateData `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{} +} + +// NewLogsMetricUpdateRequest instantiates a new LogsMetricUpdateRequest 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 NewLogsMetricUpdateRequest(data LogsMetricUpdateData) *LogsMetricUpdateRequest { + this := LogsMetricUpdateRequest{} + this.Data = data + return &this +} + +// NewLogsMetricUpdateRequestWithDefaults instantiates a new LogsMetricUpdateRequest 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 NewLogsMetricUpdateRequestWithDefaults() *LogsMetricUpdateRequest { + this := LogsMetricUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *LogsMetricUpdateRequest) GetData() LogsMetricUpdateData { + if o == nil { + var ret LogsMetricUpdateData + 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 *LogsMetricUpdateRequest) GetDataOk() (*LogsMetricUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *LogsMetricUpdateRequest) SetData(v LogsMetricUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *LogsMetricUpdateData `json:"data"` + }{} + all := struct { + Data LogsMetricUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_metrics_response.go b/api/v2/datadog/model_logs_metrics_response.go new file mode 100644 index 00000000000..1a2e168d656 --- /dev/null +++ b/api/v2/datadog/model_logs_metrics_response.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 datadog + +import ( + "encoding/json" +) + +// LogsMetricsResponse All the available log-based metric objects. +type LogsMetricsResponse struct { + // A list of log-based metric objects. + Data []LogsMetricResponseData `json:"data,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{} +} + +// NewLogsMetricsResponse instantiates a new LogsMetricsResponse 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 NewLogsMetricsResponse() *LogsMetricsResponse { + this := LogsMetricsResponse{} + return &this +} + +// NewLogsMetricsResponseWithDefaults instantiates a new LogsMetricsResponse 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 NewLogsMetricsResponseWithDefaults() *LogsMetricsResponse { + this := LogsMetricsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *LogsMetricsResponse) GetData() []LogsMetricResponseData { + if o == nil || o.Data == nil { + var ret []LogsMetricResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsMetricsResponse) GetDataOk() (*[]LogsMetricResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *LogsMetricsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []LogsMetricResponseData and assigns it to the Data field. +func (o *LogsMetricsResponse) SetData(v []LogsMetricResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsMetricsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []LogsMetricResponseData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_logs_query_filter.go b/api/v2/datadog/model_logs_query_filter.go new file mode 100644 index 00000000000..32b8a26d39f --- /dev/null +++ b/api/v2/datadog/model_logs_query_filter.go @@ -0,0 +1,231 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsQueryFilter The search and filter query settings +type LogsQueryFilter struct { + // The minimum time for the requested logs, supports date math and regular timestamps (milliseconds). + From *string `json:"from,omitempty"` + // For customers with multiple indexes, the indexes to search. Defaults to ['*'] which means all indexes. + Indexes []string `json:"indexes,omitempty"` + // The search query - following the log search syntax. + Query *string `json:"query,omitempty"` + // The maximum time for the requested logs, supports date math and regular timestamps (milliseconds). + To *string `json:"to,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{} +} + +// NewLogsQueryFilter instantiates a new LogsQueryFilter 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 NewLogsQueryFilter() *LogsQueryFilter { + this := LogsQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// NewLogsQueryFilterWithDefaults instantiates a new LogsQueryFilter 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 NewLogsQueryFilterWithDefaults() *LogsQueryFilter { + this := LogsQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *LogsQueryFilter) GetFrom() string { + if o == nil || o.From == nil { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryFilter) GetFromOk() (*string, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *LogsQueryFilter) HasFrom() bool { + if o != nil && o.From != nil { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *LogsQueryFilter) SetFrom(v string) { + o.From = &v +} + +// GetIndexes returns the Indexes field value if set, zero value otherwise. +func (o *LogsQueryFilter) GetIndexes() []string { + if o == nil || o.Indexes == nil { + var ret []string + return ret + } + return o.Indexes +} + +// GetIndexesOk returns a tuple with the Indexes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryFilter) GetIndexesOk() (*[]string, bool) { + if o == nil || o.Indexes == nil { + return nil, false + } + return &o.Indexes, true +} + +// HasIndexes returns a boolean if a field has been set. +func (o *LogsQueryFilter) HasIndexes() bool { + if o != nil && o.Indexes != nil { + return true + } + + return false +} + +// SetIndexes gets a reference to the given []string and assigns it to the Indexes field. +func (o *LogsQueryFilter) SetIndexes(v []string) { + o.Indexes = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *LogsQueryFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *LogsQueryFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *LogsQueryFilter) SetQuery(v string) { + o.Query = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *LogsQueryFilter) GetTo() string { + if o == nil || o.To == nil { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryFilter) GetToOk() (*string, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *LogsQueryFilter) HasTo() bool { + if o != nil && o.To != nil { + return true + } + + return false +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *LogsQueryFilter) SetTo(v string) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsQueryFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Indexes != nil { + toSerialize["indexes"] = o.Indexes + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + From *string `json:"from,omitempty"` + Indexes []string `json:"indexes,omitempty"` + Query *string `json:"query,omitempty"` + To *string `json:"to,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.From = all.From + o.Indexes = all.Indexes + o.Query = all.Query + o.To = all.To + return nil +} diff --git a/api/v2/datadog/model_logs_query_options.go b/api/v2/datadog/model_logs_query_options.go new file mode 100644 index 00000000000..8df56d2a05f --- /dev/null +++ b/api/v2/datadog/model_logs_query_options.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsQueryOptions Global query options that are used during the query. +// Note: You should only supply timezone or time offset but not both otherwise the query will fail. +type LogsQueryOptions struct { + // The time offset (in seconds) to apply to the query. + TimeOffset *int64 `json:"timeOffset,omitempty"` + // The timezone can be specified both as an offset, for example: "UTC+03:00". + Timezone *string `json:"timezone,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{} +} + +// NewLogsQueryOptions instantiates a new LogsQueryOptions 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 NewLogsQueryOptions() *LogsQueryOptions { + this := LogsQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewLogsQueryOptionsWithDefaults instantiates a new LogsQueryOptions 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 NewLogsQueryOptionsWithDefaults() *LogsQueryOptions { + this := LogsQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. +func (o *LogsQueryOptions) GetTimeOffset() int64 { + if o == nil || o.TimeOffset == nil { + var ret int64 + return ret + } + return *o.TimeOffset +} + +// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryOptions) GetTimeOffsetOk() (*int64, bool) { + if o == nil || o.TimeOffset == nil { + return nil, false + } + return o.TimeOffset, true +} + +// HasTimeOffset returns a boolean if a field has been set. +func (o *LogsQueryOptions) HasTimeOffset() bool { + if o != nil && o.TimeOffset != nil { + return true + } + + return false +} + +// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. +func (o *LogsQueryOptions) SetTimeOffset(v int64) { + o.TimeOffset = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *LogsQueryOptions) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsQueryOptions) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *LogsQueryOptions) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *LogsQueryOptions) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsQueryOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TimeOffset != nil { + toSerialize["timeOffset"] = o.TimeOffset + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TimeOffset *int64 `json:"timeOffset,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TimeOffset = all.TimeOffset + o.Timezone = all.Timezone + return nil +} diff --git a/api/v2/datadog/model_logs_response_metadata.go b/api/v2/datadog/model_logs_response_metadata.go new file mode 100644 index 00000000000..16a023a82b4 --- /dev/null +++ b/api/v2/datadog/model_logs_response_metadata.go @@ -0,0 +1,274 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsResponseMetadata The metadata associated with a request +type LogsResponseMetadata struct { + // The time elapsed in milliseconds + Elapsed *int64 `json:"elapsed,omitempty"` + // Paging attributes. + Page *LogsResponseMetadataPage `json:"page,omitempty"` + // The identifier of the request + RequestId *string `json:"request_id,omitempty"` + // The status of the response + Status *LogsAggregateResponseStatus `json:"status,omitempty"` + // A list of warnings (non fatal errors) encountered, partial results might be returned if + // warnings are present in the response. + Warnings []LogsWarning `json:"warnings,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{} +} + +// NewLogsResponseMetadata instantiates a new LogsResponseMetadata 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 NewLogsResponseMetadata() *LogsResponseMetadata { + this := LogsResponseMetadata{} + return &this +} + +// NewLogsResponseMetadataWithDefaults instantiates a new LogsResponseMetadata 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 NewLogsResponseMetadataWithDefaults() *LogsResponseMetadata { + this := LogsResponseMetadata{} + return &this +} + +// GetElapsed returns the Elapsed field value if set, zero value otherwise. +func (o *LogsResponseMetadata) GetElapsed() int64 { + if o == nil || o.Elapsed == nil { + var ret int64 + return ret + } + return *o.Elapsed +} + +// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsResponseMetadata) GetElapsedOk() (*int64, bool) { + if o == nil || o.Elapsed == nil { + return nil, false + } + return o.Elapsed, true +} + +// HasElapsed returns a boolean if a field has been set. +func (o *LogsResponseMetadata) HasElapsed() bool { + if o != nil && o.Elapsed != nil { + return true + } + + return false +} + +// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. +func (o *LogsResponseMetadata) SetElapsed(v int64) { + o.Elapsed = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *LogsResponseMetadata) GetPage() LogsResponseMetadataPage { + if o == nil || o.Page == nil { + var ret LogsResponseMetadataPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsResponseMetadata) GetPageOk() (*LogsResponseMetadataPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *LogsResponseMetadata) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given LogsResponseMetadataPage and assigns it to the Page field. +func (o *LogsResponseMetadata) SetPage(v LogsResponseMetadataPage) { + o.Page = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *LogsResponseMetadata) GetRequestId() string { + if o == nil || o.RequestId == nil { + var ret string + return ret + } + return *o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsResponseMetadata) GetRequestIdOk() (*string, bool) { + if o == nil || o.RequestId == nil { + return nil, false + } + return o.RequestId, true +} + +// HasRequestId returns a boolean if a field has been set. +func (o *LogsResponseMetadata) HasRequestId() bool { + if o != nil && o.RequestId != nil { + return true + } + + return false +} + +// SetRequestId gets a reference to the given string and assigns it to the RequestId field. +func (o *LogsResponseMetadata) SetRequestId(v string) { + o.RequestId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *LogsResponseMetadata) GetStatus() LogsAggregateResponseStatus { + if o == nil || o.Status == nil { + var ret LogsAggregateResponseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsResponseMetadata) GetStatusOk() (*LogsAggregateResponseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *LogsResponseMetadata) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given LogsAggregateResponseStatus and assigns it to the Status field. +func (o *LogsResponseMetadata) SetStatus(v LogsAggregateResponseStatus) { + o.Status = &v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *LogsResponseMetadata) GetWarnings() []LogsWarning { + if o == nil || o.Warnings == nil { + var ret []LogsWarning + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsResponseMetadata) GetWarningsOk() (*[]LogsWarning, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *LogsResponseMetadata) HasWarnings() bool { + if o != nil && o.Warnings != nil { + return true + } + + return false +} + +// SetWarnings gets a reference to the given []LogsWarning and assigns it to the Warnings field. +func (o *LogsResponseMetadata) SetWarnings(v []LogsWarning) { + o.Warnings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Elapsed != nil { + toSerialize["elapsed"] = o.Elapsed + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Elapsed *int64 `json:"elapsed,omitempty"` + Page *LogsResponseMetadataPage `json:"page,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Status *LogsAggregateResponseStatus `json:"status,omitempty"` + Warnings []LogsWarning `json:"warnings,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Elapsed = all.Elapsed + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.RequestId = all.RequestId + o.Status = all.Status + o.Warnings = all.Warnings + return nil +} diff --git a/api/v2/datadog/model_logs_response_metadata_page.go b/api/v2/datadog/model_logs_response_metadata_page.go new file mode 100644 index 00000000000..ffcdf388e76 --- /dev/null +++ b/api/v2/datadog/model_logs_response_metadata_page.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsResponseMetadataPage Paging attributes. +type LogsResponseMetadataPage struct { + // The cursor to use to get the next results, if any. To make the next request, use the same. + // parameters with the addition of the `page[cursor]`. + After *string `json:"after,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{} +} + +// NewLogsResponseMetadataPage instantiates a new LogsResponseMetadataPage 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 NewLogsResponseMetadataPage() *LogsResponseMetadataPage { + this := LogsResponseMetadataPage{} + return &this +} + +// NewLogsResponseMetadataPageWithDefaults instantiates a new LogsResponseMetadataPage 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 NewLogsResponseMetadataPageWithDefaults() *LogsResponseMetadataPage { + this := LogsResponseMetadataPage{} + return &this +} + +// GetAfter returns the After field value if set, zero value otherwise. +func (o *LogsResponseMetadataPage) GetAfter() string { + if o == nil || o.After == nil { + var ret string + return ret + } + return *o.After +} + +// GetAfterOk returns a tuple with the After field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsResponseMetadataPage) GetAfterOk() (*string, bool) { + if o == nil || o.After == nil { + return nil, false + } + return o.After, true +} + +// HasAfter returns a boolean if a field has been set. +func (o *LogsResponseMetadataPage) HasAfter() bool { + if o != nil && o.After != nil { + return true + } + + return false +} + +// SetAfter gets a reference to the given string and assigns it to the After field. +func (o *LogsResponseMetadataPage) SetAfter(v string) { + o.After = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsResponseMetadataPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.After != nil { + toSerialize["after"] = o.After + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + After *string `json:"after,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.After = all.After + return nil +} diff --git a/api/v2/datadog/model_logs_sort.go b/api/v2/datadog/model_logs_sort.go new file mode 100644 index 00000000000..27dd5bd2c7d --- /dev/null +++ b/api/v2/datadog/model_logs_sort.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsSort Sort parameters when querying logs. +type LogsSort string + +// List of LogsSort. +const ( + LOGSSORT_TIMESTAMP_ASCENDING LogsSort = "timestamp" + LOGSSORT_TIMESTAMP_DESCENDING LogsSort = "-timestamp" +) + +var allowedLogsSortEnumValues = []LogsSort{ + LOGSSORT_TIMESTAMP_ASCENDING, + LOGSSORT_TIMESTAMP_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsSort) GetAllowedValues() []LogsSort { + return allowedLogsSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsSort(value) + return nil +} + +// NewLogsSortFromValue returns a pointer to a valid LogsSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsSortFromValue(v string) (*LogsSort, error) { + ev := LogsSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsSort: valid values are %v", v, allowedLogsSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsSort) IsValid() bool { + for _, existing := range allowedLogsSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsSort value. +func (v LogsSort) Ptr() *LogsSort { + return &v +} + +// NullableLogsSort handles when a null is used for LogsSort. +type NullableLogsSort struct { + value *LogsSort + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsSort) Get() *LogsSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsSort) Set(val *LogsSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsSort initializes the struct as if Set has been called. +func NewNullableLogsSort(val *LogsSort) *NullableLogsSort { + return &NullableLogsSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_sort_order.go b/api/v2/datadog/model_logs_sort_order.go new file mode 100644 index 00000000000..c574550dfc9 --- /dev/null +++ b/api/v2/datadog/model_logs_sort_order.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// LogsSortOrder The order to use, ascending or descending +type LogsSortOrder string + +// List of LogsSortOrder. +const ( + LOGSSORTORDER_ASCENDING LogsSortOrder = "asc" + LOGSSORTORDER_DESCENDING LogsSortOrder = "desc" +) + +var allowedLogsSortOrderEnumValues = []LogsSortOrder{ + LOGSSORTORDER_ASCENDING, + LOGSSORTORDER_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsSortOrder) GetAllowedValues() []LogsSortOrder { + return allowedLogsSortOrderEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsSortOrder) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsSortOrder(value) + return nil +} + +// NewLogsSortOrderFromValue returns a pointer to a valid LogsSortOrder +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsSortOrderFromValue(v string) (*LogsSortOrder, error) { + ev := LogsSortOrder(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsSortOrder: valid values are %v", v, allowedLogsSortOrderEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsSortOrder) IsValid() bool { + for _, existing := range allowedLogsSortOrderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsSortOrder value. +func (v LogsSortOrder) Ptr() *LogsSortOrder { + return &v +} + +// NullableLogsSortOrder handles when a null is used for LogsSortOrder. +type NullableLogsSortOrder struct { + value *LogsSortOrder + isSet bool +} + +// Get returns the associated value. +func (v NullableLogsSortOrder) Get() *LogsSortOrder { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableLogsSortOrder) Set(val *LogsSortOrder) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableLogsSortOrder) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableLogsSortOrder) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableLogsSortOrder initializes the struct as if Set has been called. +func NewNullableLogsSortOrder(val *LogsSortOrder) *NullableLogsSortOrder { + return &NullableLogsSortOrder{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableLogsSortOrder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableLogsSortOrder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_logs_warning.go b/api/v2/datadog/model_logs_warning.go new file mode 100644 index 00000000000..41750f78eac --- /dev/null +++ b/api/v2/datadog/model_logs_warning.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// LogsWarning A warning message indicating something that went wrong with the query +type LogsWarning struct { + // A unique code for this type of warning + Code *string `json:"code,omitempty"` + // A detailed explanation of this specific warning + Detail *string `json:"detail,omitempty"` + // A short human-readable summary of the warning + Title *string `json:"title,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{} +} + +// NewLogsWarning instantiates a new LogsWarning 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 NewLogsWarning() *LogsWarning { + this := LogsWarning{} + return &this +} + +// NewLogsWarningWithDefaults instantiates a new LogsWarning 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 NewLogsWarningWithDefaults() *LogsWarning { + this := LogsWarning{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *LogsWarning) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsWarning) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *LogsWarning) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *LogsWarning) SetCode(v string) { + o.Code = &v +} + +// GetDetail returns the Detail field value if set, zero value otherwise. +func (o *LogsWarning) GetDetail() string { + if o == nil || o.Detail == nil { + var ret string + return ret + } + return *o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsWarning) GetDetailOk() (*string, bool) { + if o == nil || o.Detail == nil { + return nil, false + } + return o.Detail, true +} + +// HasDetail returns a boolean if a field has been set. +func (o *LogsWarning) HasDetail() bool { + if o != nil && o.Detail != nil { + return true + } + + return false +} + +// SetDetail gets a reference to the given string and assigns it to the Detail field. +func (o *LogsWarning) SetDetail(v string) { + o.Detail = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *LogsWarning) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsWarning) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *LogsWarning) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *LogsWarning) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LogsWarning) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Detail != nil { + toSerialize["detail"] = o.Detail + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LogsWarning) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *string `json:"code,omitempty"` + Detail *string `json:"detail,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Detail = all.Detail + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_metric.go b/api/v2/datadog/model_metric.go new file mode 100644 index 00000000000..9013231343e --- /dev/null +++ b/api/v2/datadog/model_metric.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Metric Object for a single metric tag configuration. +type Metric struct { + // The metric name for this resource. + Id *string `json:"id,omitempty"` + // The metric resource type. + Type *MetricType `json:"type,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{} +} + +// NewMetric instantiates a new Metric 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 NewMetric() *Metric { + this := Metric{} + var typeVar MetricType = METRICTYPE_METRICS + this.Type = &typeVar + return &this +} + +// NewMetricWithDefaults instantiates a new Metric 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 NewMetricWithDefaults() *Metric { + this := Metric{} + var typeVar MetricType = METRICTYPE_METRICS + this.Type = &typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Metric) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metric) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Metric) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Metric) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Metric) GetType() MetricType { + if o == nil || o.Type == nil { + var ret MetricType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metric) GetTypeOk() (*MetricType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Metric) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MetricType and assigns it to the Type field. +func (o *Metric) SetType(v MetricType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Metric) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Metric) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Type *MetricType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_all_tags.go b/api/v2/datadog/model_metric_all_tags.go new file mode 100644 index 00000000000..94a9cafd94f --- /dev/null +++ b/api/v2/datadog/model_metric_all_tags.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricAllTags Object for a single metric's indexed tags. +type MetricAllTags struct { + // Object containing the definition of a metric's tags. + Attributes *MetricAllTagsAttributes `json:"attributes,omitempty"` + // The metric name for this resource. + Id *string `json:"id,omitempty"` + // The metric resource type. + Type *MetricType `json:"type,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{} +} + +// NewMetricAllTags instantiates a new MetricAllTags 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 NewMetricAllTags() *MetricAllTags { + this := MetricAllTags{} + var typeVar MetricType = METRICTYPE_METRICS + this.Type = &typeVar + return &this +} + +// NewMetricAllTagsWithDefaults instantiates a new MetricAllTags 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 NewMetricAllTagsWithDefaults() *MetricAllTags { + this := MetricAllTags{} + var typeVar MetricType = METRICTYPE_METRICS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricAllTags) GetAttributes() MetricAllTagsAttributes { + if o == nil || o.Attributes == nil { + var ret MetricAllTagsAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricAllTags) GetAttributesOk() (*MetricAllTagsAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricAllTags) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricAllTagsAttributes and assigns it to the Attributes field. +func (o *MetricAllTags) SetAttributes(v MetricAllTagsAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MetricAllTags) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricAllTags) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MetricAllTags) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MetricAllTags) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricAllTags) GetType() MetricType { + if o == nil || o.Type == nil { + var ret MetricType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricAllTags) GetTypeOk() (*MetricType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricAllTags) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MetricType and assigns it to the Type field. +func (o *MetricAllTags) SetType(v MetricType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricAllTags) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricAllTags) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *MetricAllTagsAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MetricType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_all_tags_attributes.go b/api/v2/datadog/model_metric_all_tags_attributes.go new file mode 100644 index 00000000000..e2a7da9c3df --- /dev/null +++ b/api/v2/datadog/model_metric_all_tags_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 datadog + +import ( + "encoding/json" +) + +// MetricAllTagsAttributes Object containing the definition of a metric's tags. +type MetricAllTagsAttributes struct { + // List of indexed tag value pairs. + Tags []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{} +} + +// NewMetricAllTagsAttributes instantiates a new MetricAllTagsAttributes 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 NewMetricAllTagsAttributes() *MetricAllTagsAttributes { + this := MetricAllTagsAttributes{} + return &this +} + +// NewMetricAllTagsAttributesWithDefaults instantiates a new MetricAllTagsAttributes 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 NewMetricAllTagsAttributesWithDefaults() *MetricAllTagsAttributes { + this := MetricAllTagsAttributes{} + return &this +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MetricAllTagsAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MetricAllTagsAttributes) GetTagsOk() (*[]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 *MetricAllTagsAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MetricAllTagsAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricAllTagsAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricAllTagsAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Tags = all.Tags + return nil +} diff --git a/api/v2/datadog/model_metric_all_tags_response.go b/api/v2/datadog/model_metric_all_tags_response.go new file mode 100644 index 00000000000..0523dfaf244 --- /dev/null +++ b/api/v2/datadog/model_metric_all_tags_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricAllTagsResponse Response object that includes a single metric's indexed tags. +type MetricAllTagsResponse struct { + // Object for a single metric's indexed tags. + Data *MetricAllTags `json:"data,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{} +} + +// NewMetricAllTagsResponse instantiates a new MetricAllTagsResponse 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 NewMetricAllTagsResponse() *MetricAllTagsResponse { + this := MetricAllTagsResponse{} + return &this +} + +// NewMetricAllTagsResponseWithDefaults instantiates a new MetricAllTagsResponse 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 NewMetricAllTagsResponseWithDefaults() *MetricAllTagsResponse { + this := MetricAllTagsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MetricAllTagsResponse) GetData() MetricAllTags { + if o == nil || o.Data == nil { + var ret MetricAllTags + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricAllTagsResponse) GetDataOk() (*MetricAllTags, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *MetricAllTagsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given MetricAllTags and assigns it to the Data field. +func (o *MetricAllTagsResponse) SetData(v MetricAllTags) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricAllTagsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricAllTagsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *MetricAllTags `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_configure_tags_type.go b/api/v2/datadog/model_metric_bulk_configure_tags_type.go new file mode 100644 index 00000000000..01ea3bb6eb7 --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_configure_tags_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricBulkConfigureTagsType The metric bulk configure tags resource. +type MetricBulkConfigureTagsType string + +// List of MetricBulkConfigureTagsType. +const ( + METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS MetricBulkConfigureTagsType = "metric_bulk_configure_tags" +) + +var allowedMetricBulkConfigureTagsTypeEnumValues = []MetricBulkConfigureTagsType{ + METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricBulkConfigureTagsType) GetAllowedValues() []MetricBulkConfigureTagsType { + return allowedMetricBulkConfigureTagsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricBulkConfigureTagsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricBulkConfigureTagsType(value) + return nil +} + +// NewMetricBulkConfigureTagsTypeFromValue returns a pointer to a valid MetricBulkConfigureTagsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricBulkConfigureTagsTypeFromValue(v string) (*MetricBulkConfigureTagsType, error) { + ev := MetricBulkConfigureTagsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricBulkConfigureTagsType: valid values are %v", v, allowedMetricBulkConfigureTagsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricBulkConfigureTagsType) IsValid() bool { + for _, existing := range allowedMetricBulkConfigureTagsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricBulkConfigureTagsType value. +func (v MetricBulkConfigureTagsType) Ptr() *MetricBulkConfigureTagsType { + return &v +} + +// NullableMetricBulkConfigureTagsType handles when a null is used for MetricBulkConfigureTagsType. +type NullableMetricBulkConfigureTagsType struct { + value *MetricBulkConfigureTagsType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricBulkConfigureTagsType) Get() *MetricBulkConfigureTagsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricBulkConfigureTagsType) Set(val *MetricBulkConfigureTagsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricBulkConfigureTagsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricBulkConfigureTagsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricBulkConfigureTagsType initializes the struct as if Set has been called. +func NewNullableMetricBulkConfigureTagsType(val *MetricBulkConfigureTagsType) *NullableMetricBulkConfigureTagsType { + return &NullableMetricBulkConfigureTagsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricBulkConfigureTagsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricBulkConfigureTagsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_create.go b/api/v2/datadog/model_metric_bulk_tag_config_create.go new file mode 100644 index 00000000000..2b9c2120ecb --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_create.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricBulkTagConfigCreate Request object to bulk configure tags for metrics matching the given prefix. +type MetricBulkTagConfigCreate struct { + // Optional parameters for bulk creating metric tag configurations. + Attributes *MetricBulkTagConfigCreateAttributes `json:"attributes,omitempty"` + // A text prefix to match against metric names. + Id string `json:"id"` + // The metric bulk configure tags resource. + Type MetricBulkConfigureTagsType `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{} +} + +// NewMetricBulkTagConfigCreate instantiates a new MetricBulkTagConfigCreate 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 NewMetricBulkTagConfigCreate(id string, typeVar MetricBulkConfigureTagsType) *MetricBulkTagConfigCreate { + this := MetricBulkTagConfigCreate{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewMetricBulkTagConfigCreateWithDefaults instantiates a new MetricBulkTagConfigCreate 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 NewMetricBulkTagConfigCreateWithDefaults() *MetricBulkTagConfigCreate { + this := MetricBulkTagConfigCreate{} + var typeVar MetricBulkConfigureTagsType = METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricBulkTagConfigCreate) GetAttributes() MetricBulkTagConfigCreateAttributes { + if o == nil || o.Attributes == nil { + var ret MetricBulkTagConfigCreateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigCreate) GetAttributesOk() (*MetricBulkTagConfigCreateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricBulkTagConfigCreate) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricBulkTagConfigCreateAttributes and assigns it to the Attributes field. +func (o *MetricBulkTagConfigCreate) SetAttributes(v MetricBulkTagConfigCreateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *MetricBulkTagConfigCreate) 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 *MetricBulkTagConfigCreate) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *MetricBulkTagConfigCreate) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *MetricBulkTagConfigCreate) GetType() MetricBulkConfigureTagsType { + if o == nil { + var ret MetricBulkConfigureTagsType + 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 *MetricBulkTagConfigCreate) GetTypeOk() (*MetricBulkConfigureTagsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MetricBulkTagConfigCreate) SetType(v MetricBulkConfigureTagsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigCreate) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *MetricBulkConfigureTagsType `json:"type"` + }{} + all := struct { + Attributes *MetricBulkTagConfigCreateAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Type MetricBulkConfigureTagsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go b/api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go new file mode 100644 index 00000000000..89641e9ca28 --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_create_attributes.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricBulkTagConfigCreateAttributes Optional parameters for bulk creating metric tag configurations. +type MetricBulkTagConfigCreateAttributes struct { + // A list of account emails to notify when the configuration is applied. + Emails []string `json:"emails,omitempty"` + // A list of tag names to apply to the configuration. + Tags []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{} +} + +// NewMetricBulkTagConfigCreateAttributes instantiates a new MetricBulkTagConfigCreateAttributes 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 NewMetricBulkTagConfigCreateAttributes() *MetricBulkTagConfigCreateAttributes { + this := MetricBulkTagConfigCreateAttributes{} + return &this +} + +// NewMetricBulkTagConfigCreateAttributesWithDefaults instantiates a new MetricBulkTagConfigCreateAttributes 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 NewMetricBulkTagConfigCreateAttributesWithDefaults() *MetricBulkTagConfigCreateAttributes { + this := MetricBulkTagConfigCreateAttributes{} + return &this +} + +// GetEmails returns the Emails field value if set, zero value otherwise. +func (o *MetricBulkTagConfigCreateAttributes) GetEmails() []string { + if o == nil || o.Emails == nil { + var ret []string + return ret + } + return o.Emails +} + +// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigCreateAttributes) GetEmailsOk() (*[]string, bool) { + if o == nil || o.Emails == nil { + return nil, false + } + return &o.Emails, true +} + +// HasEmails returns a boolean if a field has been set. +func (o *MetricBulkTagConfigCreateAttributes) HasEmails() bool { + if o != nil && o.Emails != nil { + return true + } + + return false +} + +// SetEmails gets a reference to the given []string and assigns it to the Emails field. +func (o *MetricBulkTagConfigCreateAttributes) SetEmails(v []string) { + o.Emails = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MetricBulkTagConfigCreateAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MetricBulkTagConfigCreateAttributes) GetTagsOk() (*[]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 *MetricBulkTagConfigCreateAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MetricBulkTagConfigCreateAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Emails != nil { + toSerialize["emails"] = o.Emails + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Emails []string `json:"emails,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Emails = all.Emails + o.Tags = all.Tags + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_create_request.go b/api/v2/datadog/model_metric_bulk_tag_config_create_request.go new file mode 100644 index 00000000000..c5d21b0242f --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricBulkTagConfigCreateRequest Wrapper object for a single bulk tag configuration request. +type MetricBulkTagConfigCreateRequest struct { + // Request object to bulk configure tags for metrics matching the given prefix. + Data MetricBulkTagConfigCreate `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{} +} + +// NewMetricBulkTagConfigCreateRequest instantiates a new MetricBulkTagConfigCreateRequest 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 NewMetricBulkTagConfigCreateRequest(data MetricBulkTagConfigCreate) *MetricBulkTagConfigCreateRequest { + this := MetricBulkTagConfigCreateRequest{} + this.Data = data + return &this +} + +// NewMetricBulkTagConfigCreateRequestWithDefaults instantiates a new MetricBulkTagConfigCreateRequest 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 NewMetricBulkTagConfigCreateRequestWithDefaults() *MetricBulkTagConfigCreateRequest { + this := MetricBulkTagConfigCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *MetricBulkTagConfigCreateRequest) GetData() MetricBulkTagConfigCreate { + if o == nil { + var ret MetricBulkTagConfigCreate + 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 *MetricBulkTagConfigCreateRequest) GetDataOk() (*MetricBulkTagConfigCreate, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MetricBulkTagConfigCreateRequest) SetData(v MetricBulkTagConfigCreate) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *MetricBulkTagConfigCreate `json:"data"` + }{} + all := struct { + Data MetricBulkTagConfigCreate `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_delete.go b/api/v2/datadog/model_metric_bulk_tag_config_delete.go new file mode 100644 index 00000000000..54223440cc8 --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_delete.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricBulkTagConfigDelete Request object to bulk delete all tag configurations for metrics matching the given prefix. +type MetricBulkTagConfigDelete struct { + // Optional parameters for bulk deleting metric tag configurations. + Attributes *MetricBulkTagConfigDeleteAttributes `json:"attributes,omitempty"` + // A text prefix to match against metric names. + Id string `json:"id"` + // The metric bulk configure tags resource. + Type MetricBulkConfigureTagsType `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{} +} + +// NewMetricBulkTagConfigDelete instantiates a new MetricBulkTagConfigDelete 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 NewMetricBulkTagConfigDelete(id string, typeVar MetricBulkConfigureTagsType) *MetricBulkTagConfigDelete { + this := MetricBulkTagConfigDelete{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewMetricBulkTagConfigDeleteWithDefaults instantiates a new MetricBulkTagConfigDelete 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 NewMetricBulkTagConfigDeleteWithDefaults() *MetricBulkTagConfigDelete { + this := MetricBulkTagConfigDelete{} + var typeVar MetricBulkConfigureTagsType = METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricBulkTagConfigDelete) GetAttributes() MetricBulkTagConfigDeleteAttributes { + if o == nil || o.Attributes == nil { + var ret MetricBulkTagConfigDeleteAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigDelete) GetAttributesOk() (*MetricBulkTagConfigDeleteAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricBulkTagConfigDelete) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricBulkTagConfigDeleteAttributes and assigns it to the Attributes field. +func (o *MetricBulkTagConfigDelete) SetAttributes(v MetricBulkTagConfigDeleteAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *MetricBulkTagConfigDelete) 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 *MetricBulkTagConfigDelete) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *MetricBulkTagConfigDelete) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *MetricBulkTagConfigDelete) GetType() MetricBulkConfigureTagsType { + if o == nil { + var ret MetricBulkConfigureTagsType + 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 *MetricBulkTagConfigDelete) GetTypeOk() (*MetricBulkConfigureTagsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MetricBulkTagConfigDelete) SetType(v MetricBulkConfigureTagsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigDelete) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigDelete) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *MetricBulkConfigureTagsType `json:"type"` + }{} + all := struct { + Attributes *MetricBulkTagConfigDeleteAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Type MetricBulkConfigureTagsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_delete_attributes.go b/api/v2/datadog/model_metric_bulk_tag_config_delete_attributes.go new file mode 100644 index 00000000000..c0ff7576f56 --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_delete_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 datadog + +import ( + "encoding/json" +) + +// MetricBulkTagConfigDeleteAttributes Optional parameters for bulk deleting metric tag configurations. +type MetricBulkTagConfigDeleteAttributes struct { + // A list of account emails to notify when the configuration is applied. + Emails []string `json:"emails,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{} +} + +// NewMetricBulkTagConfigDeleteAttributes instantiates a new MetricBulkTagConfigDeleteAttributes 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 NewMetricBulkTagConfigDeleteAttributes() *MetricBulkTagConfigDeleteAttributes { + this := MetricBulkTagConfigDeleteAttributes{} + return &this +} + +// NewMetricBulkTagConfigDeleteAttributesWithDefaults instantiates a new MetricBulkTagConfigDeleteAttributes 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 NewMetricBulkTagConfigDeleteAttributesWithDefaults() *MetricBulkTagConfigDeleteAttributes { + this := MetricBulkTagConfigDeleteAttributes{} + return &this +} + +// GetEmails returns the Emails field value if set, zero value otherwise. +func (o *MetricBulkTagConfigDeleteAttributes) GetEmails() []string { + if o == nil || o.Emails == nil { + var ret []string + return ret + } + return o.Emails +} + +// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigDeleteAttributes) GetEmailsOk() (*[]string, bool) { + if o == nil || o.Emails == nil { + return nil, false + } + return &o.Emails, true +} + +// HasEmails returns a boolean if a field has been set. +func (o *MetricBulkTagConfigDeleteAttributes) HasEmails() bool { + if o != nil && o.Emails != nil { + return true + } + + return false +} + +// SetEmails gets a reference to the given []string and assigns it to the Emails field. +func (o *MetricBulkTagConfigDeleteAttributes) SetEmails(v []string) { + o.Emails = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigDeleteAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Emails != nil { + toSerialize["emails"] = o.Emails + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigDeleteAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Emails []string `json:"emails,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Emails = all.Emails + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_delete_request.go b/api/v2/datadog/model_metric_bulk_tag_config_delete_request.go new file mode 100644 index 00000000000..6d3b70c1c9e --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_delete_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricBulkTagConfigDeleteRequest Wrapper object for a single bulk tag deletion request. +type MetricBulkTagConfigDeleteRequest struct { + // Request object to bulk delete all tag configurations for metrics matching the given prefix. + Data MetricBulkTagConfigDelete `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{} +} + +// NewMetricBulkTagConfigDeleteRequest instantiates a new MetricBulkTagConfigDeleteRequest 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 NewMetricBulkTagConfigDeleteRequest(data MetricBulkTagConfigDelete) *MetricBulkTagConfigDeleteRequest { + this := MetricBulkTagConfigDeleteRequest{} + this.Data = data + return &this +} + +// NewMetricBulkTagConfigDeleteRequestWithDefaults instantiates a new MetricBulkTagConfigDeleteRequest 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 NewMetricBulkTagConfigDeleteRequestWithDefaults() *MetricBulkTagConfigDeleteRequest { + this := MetricBulkTagConfigDeleteRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *MetricBulkTagConfigDeleteRequest) GetData() MetricBulkTagConfigDelete { + if o == nil { + var ret MetricBulkTagConfigDelete + 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 *MetricBulkTagConfigDeleteRequest) GetDataOk() (*MetricBulkTagConfigDelete, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MetricBulkTagConfigDeleteRequest) SetData(v MetricBulkTagConfigDelete) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigDeleteRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *MetricBulkTagConfigDelete `json:"data"` + }{} + all := struct { + Data MetricBulkTagConfigDelete `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_response.go b/api/v2/datadog/model_metric_bulk_tag_config_response.go new file mode 100644 index 00000000000..5b42b64f72f --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_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 datadog + +import ( + "encoding/json" +) + +// MetricBulkTagConfigResponse Wrapper for a single bulk tag configuration status response. +type MetricBulkTagConfigResponse struct { + // The status of a request to bulk configure metric tags. + // It contains the fields from the original request for reference. + Data *MetricBulkTagConfigStatus `json:"data,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{} +} + +// NewMetricBulkTagConfigResponse instantiates a new MetricBulkTagConfigResponse 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 NewMetricBulkTagConfigResponse() *MetricBulkTagConfigResponse { + this := MetricBulkTagConfigResponse{} + return &this +} + +// NewMetricBulkTagConfigResponseWithDefaults instantiates a new MetricBulkTagConfigResponse 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 NewMetricBulkTagConfigResponseWithDefaults() *MetricBulkTagConfigResponse { + this := MetricBulkTagConfigResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MetricBulkTagConfigResponse) GetData() MetricBulkTagConfigStatus { + if o == nil || o.Data == nil { + var ret MetricBulkTagConfigStatus + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigResponse) GetDataOk() (*MetricBulkTagConfigStatus, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *MetricBulkTagConfigResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given MetricBulkTagConfigStatus and assigns it to the Data field. +func (o *MetricBulkTagConfigResponse) SetData(v MetricBulkTagConfigStatus) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *MetricBulkTagConfigStatus `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_status.go b/api/v2/datadog/model_metric_bulk_tag_config_status.go new file mode 100644 index 00000000000..c8d37845d50 --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_status.go @@ -0,0 +1,193 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricBulkTagConfigStatus The status of a request to bulk configure metric tags. +// It contains the fields from the original request for reference. +type MetricBulkTagConfigStatus struct { + // Optional attributes for the status of a bulk tag configuration request. + Attributes *MetricBulkTagConfigStatusAttributes `json:"attributes,omitempty"` + // A text prefix to match against metric names. + Id string `json:"id"` + // The metric bulk configure tags resource. + Type MetricBulkConfigureTagsType `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{} +} + +// NewMetricBulkTagConfigStatus instantiates a new MetricBulkTagConfigStatus 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 NewMetricBulkTagConfigStatus(id string, typeVar MetricBulkConfigureTagsType) *MetricBulkTagConfigStatus { + this := MetricBulkTagConfigStatus{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewMetricBulkTagConfigStatusWithDefaults instantiates a new MetricBulkTagConfigStatus 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 NewMetricBulkTagConfigStatusWithDefaults() *MetricBulkTagConfigStatus { + this := MetricBulkTagConfigStatus{} + var typeVar MetricBulkConfigureTagsType = METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricBulkTagConfigStatus) GetAttributes() MetricBulkTagConfigStatusAttributes { + if o == nil || o.Attributes == nil { + var ret MetricBulkTagConfigStatusAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigStatus) GetAttributesOk() (*MetricBulkTagConfigStatusAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricBulkTagConfigStatus) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricBulkTagConfigStatusAttributes and assigns it to the Attributes field. +func (o *MetricBulkTagConfigStatus) SetAttributes(v MetricBulkTagConfigStatusAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *MetricBulkTagConfigStatus) 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 *MetricBulkTagConfigStatus) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *MetricBulkTagConfigStatus) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *MetricBulkTagConfigStatus) GetType() MetricBulkConfigureTagsType { + if o == nil { + var ret MetricBulkConfigureTagsType + 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 *MetricBulkTagConfigStatus) GetTypeOk() (*MetricBulkConfigureTagsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MetricBulkTagConfigStatus) SetType(v MetricBulkConfigureTagsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigStatus) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *MetricBulkConfigureTagsType `json:"type"` + }{} + all := struct { + Attributes *MetricBulkTagConfigStatusAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Type MetricBulkConfigureTagsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go b/api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go new file mode 100644 index 00000000000..a34bc189aa5 --- /dev/null +++ b/api/v2/datadog/model_metric_bulk_tag_config_status_attributes.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricBulkTagConfigStatusAttributes Optional attributes for the status of a bulk tag configuration request. +type MetricBulkTagConfigStatusAttributes struct { + // A list of account emails to notify when the configuration is applied. + Emails []string `json:"emails,omitempty"` + // The status of the request. + Status *string `json:"status,omitempty"` + // A list of tag names to apply to the configuration. + Tags []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{} +} + +// NewMetricBulkTagConfigStatusAttributes instantiates a new MetricBulkTagConfigStatusAttributes 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 NewMetricBulkTagConfigStatusAttributes() *MetricBulkTagConfigStatusAttributes { + this := MetricBulkTagConfigStatusAttributes{} + return &this +} + +// NewMetricBulkTagConfigStatusAttributesWithDefaults instantiates a new MetricBulkTagConfigStatusAttributes 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 NewMetricBulkTagConfigStatusAttributesWithDefaults() *MetricBulkTagConfigStatusAttributes { + this := MetricBulkTagConfigStatusAttributes{} + return &this +} + +// GetEmails returns the Emails field value if set, zero value otherwise. +func (o *MetricBulkTagConfigStatusAttributes) GetEmails() []string { + if o == nil || o.Emails == nil { + var ret []string + return ret + } + return o.Emails +} + +// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigStatusAttributes) GetEmailsOk() (*[]string, bool) { + if o == nil || o.Emails == nil { + return nil, false + } + return &o.Emails, true +} + +// HasEmails returns a boolean if a field has been set. +func (o *MetricBulkTagConfigStatusAttributes) HasEmails() bool { + if o != nil && o.Emails != nil { + return true + } + + return false +} + +// SetEmails gets a reference to the given []string and assigns it to the Emails field. +func (o *MetricBulkTagConfigStatusAttributes) SetEmails(v []string) { + o.Emails = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *MetricBulkTagConfigStatusAttributes) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricBulkTagConfigStatusAttributes) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *MetricBulkTagConfigStatusAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *MetricBulkTagConfigStatusAttributes) SetStatus(v string) { + o.Status = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MetricBulkTagConfigStatusAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MetricBulkTagConfigStatusAttributes) GetTagsOk() (*[]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 *MetricBulkTagConfigStatusAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MetricBulkTagConfigStatusAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricBulkTagConfigStatusAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Emails != nil { + toSerialize["emails"] = o.Emails + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricBulkTagConfigStatusAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Emails []string `json:"emails,omitempty"` + Status *string `json:"status,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Emails = all.Emails + o.Status = all.Status + o.Tags = all.Tags + return nil +} diff --git a/api/v2/datadog/model_metric_content_encoding.go b/api/v2/datadog/model_metric_content_encoding.go new file mode 100644 index 00000000000..05dc8ba28e3 --- /dev/null +++ b/api/v2/datadog/model_metric_content_encoding.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricContentEncoding HTTP header used to compress the media-type. +type MetricContentEncoding string + +// List of MetricContentEncoding. +const ( + METRICCONTENTENCODING_DEFLATE MetricContentEncoding = "deflate" +) + +var allowedMetricContentEncodingEnumValues = []MetricContentEncoding{ + METRICCONTENTENCODING_DEFLATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricContentEncoding) GetAllowedValues() []MetricContentEncoding { + return allowedMetricContentEncodingEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricContentEncoding) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricContentEncoding(value) + return nil +} + +// NewMetricContentEncodingFromValue returns a pointer to a valid MetricContentEncoding +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricContentEncodingFromValue(v string) (*MetricContentEncoding, error) { + ev := MetricContentEncoding(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricContentEncoding: valid values are %v", v, allowedMetricContentEncodingEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricContentEncoding) IsValid() bool { + for _, existing := range allowedMetricContentEncodingEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricContentEncoding value. +func (v MetricContentEncoding) Ptr() *MetricContentEncoding { + return &v +} + +// NullableMetricContentEncoding handles when a null is used for MetricContentEncoding. +type NullableMetricContentEncoding struct { + value *MetricContentEncoding + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricContentEncoding) Get() *MetricContentEncoding { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricContentEncoding) Set(val *MetricContentEncoding) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricContentEncoding) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricContentEncoding) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricContentEncoding initializes the struct as if Set has been called. +func NewNullableMetricContentEncoding(val *MetricContentEncoding) *NullableMetricContentEncoding { + return &NullableMetricContentEncoding{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricContentEncoding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricContentEncoding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_custom_aggregation.go b/api/v2/datadog/model_metric_custom_aggregation.go new file mode 100644 index 00000000000..3455cf7f25c --- /dev/null +++ b/api/v2/datadog/model_metric_custom_aggregation.go @@ -0,0 +1,152 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricCustomAggregation A time and space aggregation combination for use in query. +type MetricCustomAggregation struct { + // A space aggregation for use in query. + Space MetricCustomSpaceAggregation `json:"space"` + // A time aggregation for use in query. + Time MetricCustomTimeAggregation `json:"time"` + // 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{} +} + +// NewMetricCustomAggregation instantiates a new MetricCustomAggregation 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 NewMetricCustomAggregation(space MetricCustomSpaceAggregation, time MetricCustomTimeAggregation) *MetricCustomAggregation { + this := MetricCustomAggregation{} + this.Space = space + this.Time = time + return &this +} + +// NewMetricCustomAggregationWithDefaults instantiates a new MetricCustomAggregation 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 NewMetricCustomAggregationWithDefaults() *MetricCustomAggregation { + this := MetricCustomAggregation{} + return &this +} + +// GetSpace returns the Space field value. +func (o *MetricCustomAggregation) GetSpace() MetricCustomSpaceAggregation { + if o == nil { + var ret MetricCustomSpaceAggregation + return ret + } + return o.Space +} + +// GetSpaceOk returns a tuple with the Space field value +// and a boolean to check if the value has been set. +func (o *MetricCustomAggregation) GetSpaceOk() (*MetricCustomSpaceAggregation, bool) { + if o == nil { + return nil, false + } + return &o.Space, true +} + +// SetSpace sets field value. +func (o *MetricCustomAggregation) SetSpace(v MetricCustomSpaceAggregation) { + o.Space = v +} + +// GetTime returns the Time field value. +func (o *MetricCustomAggregation) GetTime() MetricCustomTimeAggregation { + if o == nil { + var ret MetricCustomTimeAggregation + return ret + } + return o.Time +} + +// GetTimeOk returns a tuple with the Time field value +// and a boolean to check if the value has been set. +func (o *MetricCustomAggregation) GetTimeOk() (*MetricCustomTimeAggregation, bool) { + if o == nil { + return nil, false + } + return &o.Time, true +} + +// SetTime sets field value. +func (o *MetricCustomAggregation) SetTime(v MetricCustomTimeAggregation) { + o.Time = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricCustomAggregation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["space"] = o.Space + toSerialize["time"] = o.Time + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricCustomAggregation) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Space *MetricCustomSpaceAggregation `json:"space"` + Time *MetricCustomTimeAggregation `json:"time"` + }{} + all := struct { + Space MetricCustomSpaceAggregation `json:"space"` + Time MetricCustomTimeAggregation `json:"time"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Space == nil { + return fmt.Errorf("Required field space missing") + } + if required.Time == nil { + return fmt.Errorf("Required field time missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Space; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Time; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Space = all.Space + o.Time = all.Time + return nil +} diff --git a/api/v2/datadog/model_metric_custom_space_aggregation.go b/api/v2/datadog/model_metric_custom_space_aggregation.go new file mode 100644 index 00000000000..c7e0d478bc4 --- /dev/null +++ b/api/v2/datadog/model_metric_custom_space_aggregation.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricCustomSpaceAggregation A space aggregation for use in query. +type MetricCustomSpaceAggregation string + +// List of MetricCustomSpaceAggregation. +const ( + METRICCUSTOMSPACEAGGREGATION_AVG MetricCustomSpaceAggregation = "avg" + METRICCUSTOMSPACEAGGREGATION_MAX MetricCustomSpaceAggregation = "max" + METRICCUSTOMSPACEAGGREGATION_MIN MetricCustomSpaceAggregation = "min" + METRICCUSTOMSPACEAGGREGATION_SUM MetricCustomSpaceAggregation = "sum" +) + +var allowedMetricCustomSpaceAggregationEnumValues = []MetricCustomSpaceAggregation{ + METRICCUSTOMSPACEAGGREGATION_AVG, + METRICCUSTOMSPACEAGGREGATION_MAX, + METRICCUSTOMSPACEAGGREGATION_MIN, + METRICCUSTOMSPACEAGGREGATION_SUM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricCustomSpaceAggregation) GetAllowedValues() []MetricCustomSpaceAggregation { + return allowedMetricCustomSpaceAggregationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricCustomSpaceAggregation) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricCustomSpaceAggregation(value) + return nil +} + +// NewMetricCustomSpaceAggregationFromValue returns a pointer to a valid MetricCustomSpaceAggregation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricCustomSpaceAggregationFromValue(v string) (*MetricCustomSpaceAggregation, error) { + ev := MetricCustomSpaceAggregation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricCustomSpaceAggregation: valid values are %v", v, allowedMetricCustomSpaceAggregationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricCustomSpaceAggregation) IsValid() bool { + for _, existing := range allowedMetricCustomSpaceAggregationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricCustomSpaceAggregation value. +func (v MetricCustomSpaceAggregation) Ptr() *MetricCustomSpaceAggregation { + return &v +} + +// NullableMetricCustomSpaceAggregation handles when a null is used for MetricCustomSpaceAggregation. +type NullableMetricCustomSpaceAggregation struct { + value *MetricCustomSpaceAggregation + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricCustomSpaceAggregation) Get() *MetricCustomSpaceAggregation { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricCustomSpaceAggregation) Set(val *MetricCustomSpaceAggregation) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricCustomSpaceAggregation) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricCustomSpaceAggregation) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricCustomSpaceAggregation initializes the struct as if Set has been called. +func NewNullableMetricCustomSpaceAggregation(val *MetricCustomSpaceAggregation) *NullableMetricCustomSpaceAggregation { + return &NullableMetricCustomSpaceAggregation{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricCustomSpaceAggregation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricCustomSpaceAggregation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_custom_time_aggregation.go b/api/v2/datadog/model_metric_custom_time_aggregation.go new file mode 100644 index 00000000000..da824c7b649 --- /dev/null +++ b/api/v2/datadog/model_metric_custom_time_aggregation.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricCustomTimeAggregation A time aggregation for use in query. +type MetricCustomTimeAggregation string + +// List of MetricCustomTimeAggregation. +const ( + METRICCUSTOMTIMEAGGREGATION_AVG MetricCustomTimeAggregation = "avg" + METRICCUSTOMTIMEAGGREGATION_COUNT MetricCustomTimeAggregation = "count" + METRICCUSTOMTIMEAGGREGATION_MAX MetricCustomTimeAggregation = "max" + METRICCUSTOMTIMEAGGREGATION_MIN MetricCustomTimeAggregation = "min" + METRICCUSTOMTIMEAGGREGATION_SUM MetricCustomTimeAggregation = "sum" +) + +var allowedMetricCustomTimeAggregationEnumValues = []MetricCustomTimeAggregation{ + METRICCUSTOMTIMEAGGREGATION_AVG, + METRICCUSTOMTIMEAGGREGATION_COUNT, + METRICCUSTOMTIMEAGGREGATION_MAX, + METRICCUSTOMTIMEAGGREGATION_MIN, + METRICCUSTOMTIMEAGGREGATION_SUM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricCustomTimeAggregation) GetAllowedValues() []MetricCustomTimeAggregation { + return allowedMetricCustomTimeAggregationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricCustomTimeAggregation) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricCustomTimeAggregation(value) + return nil +} + +// NewMetricCustomTimeAggregationFromValue returns a pointer to a valid MetricCustomTimeAggregation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricCustomTimeAggregationFromValue(v string) (*MetricCustomTimeAggregation, error) { + ev := MetricCustomTimeAggregation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricCustomTimeAggregation: valid values are %v", v, allowedMetricCustomTimeAggregationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricCustomTimeAggregation) IsValid() bool { + for _, existing := range allowedMetricCustomTimeAggregationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricCustomTimeAggregation value. +func (v MetricCustomTimeAggregation) Ptr() *MetricCustomTimeAggregation { + return &v +} + +// NullableMetricCustomTimeAggregation handles when a null is used for MetricCustomTimeAggregation. +type NullableMetricCustomTimeAggregation struct { + value *MetricCustomTimeAggregation + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricCustomTimeAggregation) Get() *MetricCustomTimeAggregation { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricCustomTimeAggregation) Set(val *MetricCustomTimeAggregation) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricCustomTimeAggregation) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricCustomTimeAggregation) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricCustomTimeAggregation initializes the struct as if Set has been called. +func NewNullableMetricCustomTimeAggregation(val *MetricCustomTimeAggregation) *NullableMetricCustomTimeAggregation { + return &NullableMetricCustomTimeAggregation{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricCustomTimeAggregation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricCustomTimeAggregation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_distinct_volume.go b/api/v2/datadog/model_metric_distinct_volume.go new file mode 100644 index 00000000000..264bf7d4337 --- /dev/null +++ b/api/v2/datadog/model_metric_distinct_volume.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricDistinctVolume Object for a single metric's distinct volume. +type MetricDistinctVolume struct { + // Object containing the definition of a metric's distinct volume. + Attributes *MetricDistinctVolumeAttributes `json:"attributes,omitempty"` + // The metric name for this resource. + Id *string `json:"id,omitempty"` + // The metric distinct volume type. + Type *MetricDistinctVolumeType `json:"type,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{} +} + +// NewMetricDistinctVolume instantiates a new MetricDistinctVolume 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 NewMetricDistinctVolume() *MetricDistinctVolume { + this := MetricDistinctVolume{} + var typeVar MetricDistinctVolumeType = METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES + this.Type = &typeVar + return &this +} + +// NewMetricDistinctVolumeWithDefaults instantiates a new MetricDistinctVolume 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 NewMetricDistinctVolumeWithDefaults() *MetricDistinctVolume { + this := MetricDistinctVolume{} + var typeVar MetricDistinctVolumeType = METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricDistinctVolume) GetAttributes() MetricDistinctVolumeAttributes { + if o == nil || o.Attributes == nil { + var ret MetricDistinctVolumeAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricDistinctVolume) GetAttributesOk() (*MetricDistinctVolumeAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricDistinctVolume) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricDistinctVolumeAttributes and assigns it to the Attributes field. +func (o *MetricDistinctVolume) SetAttributes(v MetricDistinctVolumeAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MetricDistinctVolume) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricDistinctVolume) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MetricDistinctVolume) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MetricDistinctVolume) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricDistinctVolume) GetType() MetricDistinctVolumeType { + if o == nil || o.Type == nil { + var ret MetricDistinctVolumeType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricDistinctVolume) GetTypeOk() (*MetricDistinctVolumeType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricDistinctVolume) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MetricDistinctVolumeType and assigns it to the Type field. +func (o *MetricDistinctVolume) SetType(v MetricDistinctVolumeType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricDistinctVolume) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricDistinctVolume) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *MetricDistinctVolumeAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MetricDistinctVolumeType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_distinct_volume_attributes.go b/api/v2/datadog/model_metric_distinct_volume_attributes.go new file mode 100644 index 00000000000..74b27b9b5ff --- /dev/null +++ b/api/v2/datadog/model_metric_distinct_volume_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 datadog + +import ( + "encoding/json" +) + +// MetricDistinctVolumeAttributes Object containing the definition of a metric's distinct volume. +type MetricDistinctVolumeAttributes struct { + // Distinct volume for the given metric. + DistinctVolume *int64 `json:"distinct_volume,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{} +} + +// NewMetricDistinctVolumeAttributes instantiates a new MetricDistinctVolumeAttributes 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 NewMetricDistinctVolumeAttributes() *MetricDistinctVolumeAttributes { + this := MetricDistinctVolumeAttributes{} + return &this +} + +// NewMetricDistinctVolumeAttributesWithDefaults instantiates a new MetricDistinctVolumeAttributes 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 NewMetricDistinctVolumeAttributesWithDefaults() *MetricDistinctVolumeAttributes { + this := MetricDistinctVolumeAttributes{} + return &this +} + +// GetDistinctVolume returns the DistinctVolume field value if set, zero value otherwise. +func (o *MetricDistinctVolumeAttributes) GetDistinctVolume() int64 { + if o == nil || o.DistinctVolume == nil { + var ret int64 + return ret + } + return *o.DistinctVolume +} + +// GetDistinctVolumeOk returns a tuple with the DistinctVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricDistinctVolumeAttributes) GetDistinctVolumeOk() (*int64, bool) { + if o == nil || o.DistinctVolume == nil { + return nil, false + } + return o.DistinctVolume, true +} + +// HasDistinctVolume returns a boolean if a field has been set. +func (o *MetricDistinctVolumeAttributes) HasDistinctVolume() bool { + if o != nil && o.DistinctVolume != nil { + return true + } + + return false +} + +// SetDistinctVolume gets a reference to the given int64 and assigns it to the DistinctVolume field. +func (o *MetricDistinctVolumeAttributes) SetDistinctVolume(v int64) { + o.DistinctVolume = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricDistinctVolumeAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DistinctVolume != nil { + toSerialize["distinct_volume"] = o.DistinctVolume + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricDistinctVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DistinctVolume *int64 `json:"distinct_volume,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DistinctVolume = all.DistinctVolume + return nil +} diff --git a/api/v2/datadog/model_metric_distinct_volume_type.go b/api/v2/datadog/model_metric_distinct_volume_type.go new file mode 100644 index 00000000000..e419329e99b --- /dev/null +++ b/api/v2/datadog/model_metric_distinct_volume_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricDistinctVolumeType The metric distinct volume type. +type MetricDistinctVolumeType string + +// List of MetricDistinctVolumeType. +const ( + METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES MetricDistinctVolumeType = "distinct_metric_volumes" +) + +var allowedMetricDistinctVolumeTypeEnumValues = []MetricDistinctVolumeType{ + METRICDISTINCTVOLUMETYPE_DISTINCT_METRIC_VOLUMES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricDistinctVolumeType) GetAllowedValues() []MetricDistinctVolumeType { + return allowedMetricDistinctVolumeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricDistinctVolumeType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricDistinctVolumeType(value) + return nil +} + +// NewMetricDistinctVolumeTypeFromValue returns a pointer to a valid MetricDistinctVolumeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricDistinctVolumeTypeFromValue(v string) (*MetricDistinctVolumeType, error) { + ev := MetricDistinctVolumeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricDistinctVolumeType: valid values are %v", v, allowedMetricDistinctVolumeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricDistinctVolumeType) IsValid() bool { + for _, existing := range allowedMetricDistinctVolumeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricDistinctVolumeType value. +func (v MetricDistinctVolumeType) Ptr() *MetricDistinctVolumeType { + return &v +} + +// NullableMetricDistinctVolumeType handles when a null is used for MetricDistinctVolumeType. +type NullableMetricDistinctVolumeType struct { + value *MetricDistinctVolumeType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricDistinctVolumeType) Get() *MetricDistinctVolumeType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricDistinctVolumeType) Set(val *MetricDistinctVolumeType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricDistinctVolumeType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricDistinctVolumeType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricDistinctVolumeType initializes the struct as if Set has been called. +func NewNullableMetricDistinctVolumeType(val *MetricDistinctVolumeType) *NullableMetricDistinctVolumeType { + return &NullableMetricDistinctVolumeType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricDistinctVolumeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricDistinctVolumeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_estimate.go b/api/v2/datadog/model_metric_estimate.go new file mode 100644 index 00000000000..fecb153c660 --- /dev/null +++ b/api/v2/datadog/model_metric_estimate.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricEstimate Object for a metric cardinality estimate. +type MetricEstimate struct { + // Object containing the definition of a metric estimate attribute. + Attributes *MetricEstimateAttributes `json:"attributes,omitempty"` + // The metric name for this resource. + Id *string `json:"id,omitempty"` + // The metric estimate resource type. + Type *MetricEstimateResourceType `json:"type,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{} +} + +// NewMetricEstimate instantiates a new MetricEstimate 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 NewMetricEstimate() *MetricEstimate { + this := MetricEstimate{} + var typeVar MetricEstimateResourceType = METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE + this.Type = &typeVar + return &this +} + +// NewMetricEstimateWithDefaults instantiates a new MetricEstimate 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 NewMetricEstimateWithDefaults() *MetricEstimate { + this := MetricEstimate{} + var typeVar MetricEstimateResourceType = METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricEstimate) GetAttributes() MetricEstimateAttributes { + if o == nil || o.Attributes == nil { + var ret MetricEstimateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricEstimate) GetAttributesOk() (*MetricEstimateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricEstimate) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricEstimateAttributes and assigns it to the Attributes field. +func (o *MetricEstimate) SetAttributes(v MetricEstimateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MetricEstimate) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricEstimate) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MetricEstimate) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MetricEstimate) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricEstimate) GetType() MetricEstimateResourceType { + if o == nil || o.Type == nil { + var ret MetricEstimateResourceType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricEstimate) GetTypeOk() (*MetricEstimateResourceType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricEstimate) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MetricEstimateResourceType and assigns it to the Type field. +func (o *MetricEstimate) SetType(v MetricEstimateResourceType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricEstimate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricEstimate) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *MetricEstimateAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MetricEstimateResourceType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_estimate_attributes.go b/api/v2/datadog/model_metric_estimate_attributes.go new file mode 100644 index 00000000000..27b8f6e1a74 --- /dev/null +++ b/api/v2/datadog/model_metric_estimate_attributes.go @@ -0,0 +1,197 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// MetricEstimateAttributes Object containing the definition of a metric estimate attribute. +type MetricEstimateAttributes struct { + // Estimate type based on the queried configuration. By default, `count_or_gauge` is returned. `distribution` is returned for distribution metrics without percentiles enabled. Lastly, `percentile` is returned if `filter[pct]=true` is queried with a distribution metric. + EstimateType *MetricEstimateType `json:"estimate_type,omitempty"` + // Timestamp when the cardinality estimate was requested. + EstimatedAt *time.Time `json:"estimated_at,omitempty"` + // Estimated cardinality of the metric based on the queried configuration. + EstimatedOutputSeries *int64 `json:"estimated_output_series,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{} +} + +// NewMetricEstimateAttributes instantiates a new MetricEstimateAttributes 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 NewMetricEstimateAttributes() *MetricEstimateAttributes { + this := MetricEstimateAttributes{} + var estimateType MetricEstimateType = METRICESTIMATETYPE_COUNT_OR_GAUGE + this.EstimateType = &estimateType + return &this +} + +// NewMetricEstimateAttributesWithDefaults instantiates a new MetricEstimateAttributes 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 NewMetricEstimateAttributesWithDefaults() *MetricEstimateAttributes { + this := MetricEstimateAttributes{} + var estimateType MetricEstimateType = METRICESTIMATETYPE_COUNT_OR_GAUGE + this.EstimateType = &estimateType + return &this +} + +// GetEstimateType returns the EstimateType field value if set, zero value otherwise. +func (o *MetricEstimateAttributes) GetEstimateType() MetricEstimateType { + if o == nil || o.EstimateType == nil { + var ret MetricEstimateType + return ret + } + return *o.EstimateType +} + +// GetEstimateTypeOk returns a tuple with the EstimateType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricEstimateAttributes) GetEstimateTypeOk() (*MetricEstimateType, bool) { + if o == nil || o.EstimateType == nil { + return nil, false + } + return o.EstimateType, true +} + +// HasEstimateType returns a boolean if a field has been set. +func (o *MetricEstimateAttributes) HasEstimateType() bool { + if o != nil && o.EstimateType != nil { + return true + } + + return false +} + +// SetEstimateType gets a reference to the given MetricEstimateType and assigns it to the EstimateType field. +func (o *MetricEstimateAttributes) SetEstimateType(v MetricEstimateType) { + o.EstimateType = &v +} + +// GetEstimatedAt returns the EstimatedAt field value if set, zero value otherwise. +func (o *MetricEstimateAttributes) GetEstimatedAt() time.Time { + if o == nil || o.EstimatedAt == nil { + var ret time.Time + return ret + } + return *o.EstimatedAt +} + +// GetEstimatedAtOk returns a tuple with the EstimatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricEstimateAttributes) GetEstimatedAtOk() (*time.Time, bool) { + if o == nil || o.EstimatedAt == nil { + return nil, false + } + return o.EstimatedAt, true +} + +// HasEstimatedAt returns a boolean if a field has been set. +func (o *MetricEstimateAttributes) HasEstimatedAt() bool { + if o != nil && o.EstimatedAt != nil { + return true + } + + return false +} + +// SetEstimatedAt gets a reference to the given time.Time and assigns it to the EstimatedAt field. +func (o *MetricEstimateAttributes) SetEstimatedAt(v time.Time) { + o.EstimatedAt = &v +} + +// GetEstimatedOutputSeries returns the EstimatedOutputSeries field value if set, zero value otherwise. +func (o *MetricEstimateAttributes) GetEstimatedOutputSeries() int64 { + if o == nil || o.EstimatedOutputSeries == nil { + var ret int64 + return ret + } + return *o.EstimatedOutputSeries +} + +// GetEstimatedOutputSeriesOk returns a tuple with the EstimatedOutputSeries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricEstimateAttributes) GetEstimatedOutputSeriesOk() (*int64, bool) { + if o == nil || o.EstimatedOutputSeries == nil { + return nil, false + } + return o.EstimatedOutputSeries, true +} + +// HasEstimatedOutputSeries returns a boolean if a field has been set. +func (o *MetricEstimateAttributes) HasEstimatedOutputSeries() bool { + if o != nil && o.EstimatedOutputSeries != nil { + return true + } + + return false +} + +// SetEstimatedOutputSeries gets a reference to the given int64 and assigns it to the EstimatedOutputSeries field. +func (o *MetricEstimateAttributes) SetEstimatedOutputSeries(v int64) { + o.EstimatedOutputSeries = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricEstimateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.EstimateType != nil { + toSerialize["estimate_type"] = o.EstimateType + } + if o.EstimatedAt != nil { + if o.EstimatedAt.Nanosecond() == 0 { + toSerialize["estimated_at"] = o.EstimatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["estimated_at"] = o.EstimatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.EstimatedOutputSeries != nil { + toSerialize["estimated_output_series"] = o.EstimatedOutputSeries + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricEstimateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + EstimateType *MetricEstimateType `json:"estimate_type,omitempty"` + EstimatedAt *time.Time `json:"estimated_at,omitempty"` + EstimatedOutputSeries *int64 `json:"estimated_output_series,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.EstimateType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.EstimateType = all.EstimateType + o.EstimatedAt = all.EstimatedAt + o.EstimatedOutputSeries = all.EstimatedOutputSeries + return nil +} diff --git a/api/v2/datadog/model_metric_estimate_resource_type.go b/api/v2/datadog/model_metric_estimate_resource_type.go new file mode 100644 index 00000000000..e03b9cc1306 --- /dev/null +++ b/api/v2/datadog/model_metric_estimate_resource_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricEstimateResourceType The metric estimate resource type. +type MetricEstimateResourceType string + +// List of MetricEstimateResourceType. +const ( + METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE MetricEstimateResourceType = "metric_cardinality_estimate" +) + +var allowedMetricEstimateResourceTypeEnumValues = []MetricEstimateResourceType{ + METRICESTIMATERESOURCETYPE_METRIC_CARDINALITY_ESTIMATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricEstimateResourceType) GetAllowedValues() []MetricEstimateResourceType { + return allowedMetricEstimateResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricEstimateResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricEstimateResourceType(value) + return nil +} + +// NewMetricEstimateResourceTypeFromValue returns a pointer to a valid MetricEstimateResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricEstimateResourceTypeFromValue(v string) (*MetricEstimateResourceType, error) { + ev := MetricEstimateResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricEstimateResourceType: valid values are %v", v, allowedMetricEstimateResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricEstimateResourceType) IsValid() bool { + for _, existing := range allowedMetricEstimateResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricEstimateResourceType value. +func (v MetricEstimateResourceType) Ptr() *MetricEstimateResourceType { + return &v +} + +// NullableMetricEstimateResourceType handles when a null is used for MetricEstimateResourceType. +type NullableMetricEstimateResourceType struct { + value *MetricEstimateResourceType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricEstimateResourceType) Get() *MetricEstimateResourceType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricEstimateResourceType) Set(val *MetricEstimateResourceType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricEstimateResourceType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricEstimateResourceType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricEstimateResourceType initializes the struct as if Set has been called. +func NewNullableMetricEstimateResourceType(val *MetricEstimateResourceType) *NullableMetricEstimateResourceType { + return &NullableMetricEstimateResourceType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricEstimateResourceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricEstimateResourceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_estimate_response.go b/api/v2/datadog/model_metric_estimate_response.go new file mode 100644 index 00000000000..3a85492c638 --- /dev/null +++ b/api/v2/datadog/model_metric_estimate_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricEstimateResponse Response object that includes metric cardinality estimates. +type MetricEstimateResponse struct { + // Object for a metric cardinality estimate. + Data *MetricEstimate `json:"data,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{} +} + +// NewMetricEstimateResponse instantiates a new MetricEstimateResponse 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 NewMetricEstimateResponse() *MetricEstimateResponse { + this := MetricEstimateResponse{} + return &this +} + +// NewMetricEstimateResponseWithDefaults instantiates a new MetricEstimateResponse 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 NewMetricEstimateResponseWithDefaults() *MetricEstimateResponse { + this := MetricEstimateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MetricEstimateResponse) GetData() MetricEstimate { + if o == nil || o.Data == nil { + var ret MetricEstimate + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricEstimateResponse) GetDataOk() (*MetricEstimate, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *MetricEstimateResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given MetricEstimate and assigns it to the Data field. +func (o *MetricEstimateResponse) SetData(v MetricEstimate) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricEstimateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricEstimateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *MetricEstimate `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_estimate_type.go b/api/v2/datadog/model_metric_estimate_type.go new file mode 100644 index 00000000000..09a870cbc9b --- /dev/null +++ b/api/v2/datadog/model_metric_estimate_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricEstimateType Estimate type based on the queried configuration. By default, `count_or_gauge` is returned. `distribution` is returned for distribution metrics without percentiles enabled. Lastly, `percentile` is returned if `filter[pct]=true` is queried with a distribution metric. +type MetricEstimateType string + +// List of MetricEstimateType. +const ( + METRICESTIMATETYPE_COUNT_OR_GAUGE MetricEstimateType = "count_or_gauge" + METRICESTIMATETYPE_DISTRIBUTION MetricEstimateType = "distribution" + METRICESTIMATETYPE_PERCENTILE MetricEstimateType = "percentile" +) + +var allowedMetricEstimateTypeEnumValues = []MetricEstimateType{ + METRICESTIMATETYPE_COUNT_OR_GAUGE, + METRICESTIMATETYPE_DISTRIBUTION, + METRICESTIMATETYPE_PERCENTILE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricEstimateType) GetAllowedValues() []MetricEstimateType { + return allowedMetricEstimateTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricEstimateType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricEstimateType(value) + return nil +} + +// NewMetricEstimateTypeFromValue returns a pointer to a valid MetricEstimateType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricEstimateTypeFromValue(v string) (*MetricEstimateType, error) { + ev := MetricEstimateType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricEstimateType: valid values are %v", v, allowedMetricEstimateTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricEstimateType) IsValid() bool { + for _, existing := range allowedMetricEstimateTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricEstimateType value. +func (v MetricEstimateType) Ptr() *MetricEstimateType { + return &v +} + +// NullableMetricEstimateType handles when a null is used for MetricEstimateType. +type NullableMetricEstimateType struct { + value *MetricEstimateType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricEstimateType) Get() *MetricEstimateType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricEstimateType) Set(val *MetricEstimateType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricEstimateType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricEstimateType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricEstimateType initializes the struct as if Set has been called. +func NewNullableMetricEstimateType(val *MetricEstimateType) *NullableMetricEstimateType { + return &NullableMetricEstimateType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricEstimateType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricEstimateType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_ingested_indexed_volume.go b/api/v2/datadog/model_metric_ingested_indexed_volume.go new file mode 100644 index 00000000000..1c6fd646696 --- /dev/null +++ b/api/v2/datadog/model_metric_ingested_indexed_volume.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricIngestedIndexedVolume Object for a single metric's ingested and indexed volume. +type MetricIngestedIndexedVolume struct { + // Object containing the definition of a metric's ingested and indexed volume. + Attributes *MetricIngestedIndexedVolumeAttributes `json:"attributes,omitempty"` + // The metric name for this resource. + Id *string `json:"id,omitempty"` + // The metric ingested and indexed volume type. + Type *MetricIngestedIndexedVolumeType `json:"type,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{} +} + +// NewMetricIngestedIndexedVolume instantiates a new MetricIngestedIndexedVolume 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 NewMetricIngestedIndexedVolume() *MetricIngestedIndexedVolume { + this := MetricIngestedIndexedVolume{} + var typeVar MetricIngestedIndexedVolumeType = METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES + this.Type = &typeVar + return &this +} + +// NewMetricIngestedIndexedVolumeWithDefaults instantiates a new MetricIngestedIndexedVolume 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 NewMetricIngestedIndexedVolumeWithDefaults() *MetricIngestedIndexedVolume { + this := MetricIngestedIndexedVolume{} + var typeVar MetricIngestedIndexedVolumeType = METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricIngestedIndexedVolume) GetAttributes() MetricIngestedIndexedVolumeAttributes { + if o == nil || o.Attributes == nil { + var ret MetricIngestedIndexedVolumeAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricIngestedIndexedVolume) GetAttributesOk() (*MetricIngestedIndexedVolumeAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricIngestedIndexedVolume) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricIngestedIndexedVolumeAttributes and assigns it to the Attributes field. +func (o *MetricIngestedIndexedVolume) SetAttributes(v MetricIngestedIndexedVolumeAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MetricIngestedIndexedVolume) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricIngestedIndexedVolume) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MetricIngestedIndexedVolume) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MetricIngestedIndexedVolume) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricIngestedIndexedVolume) GetType() MetricIngestedIndexedVolumeType { + if o == nil || o.Type == nil { + var ret MetricIngestedIndexedVolumeType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricIngestedIndexedVolume) GetTypeOk() (*MetricIngestedIndexedVolumeType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricIngestedIndexedVolume) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MetricIngestedIndexedVolumeType and assigns it to the Type field. +func (o *MetricIngestedIndexedVolume) SetType(v MetricIngestedIndexedVolumeType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricIngestedIndexedVolume) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricIngestedIndexedVolume) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *MetricIngestedIndexedVolumeAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MetricIngestedIndexedVolumeType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go b/api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go new file mode 100644 index 00000000000..52173182280 --- /dev/null +++ b/api/v2/datadog/model_metric_ingested_indexed_volume_attributes.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricIngestedIndexedVolumeAttributes Object containing the definition of a metric's ingested and indexed volume. +type MetricIngestedIndexedVolumeAttributes struct { + // Indexed volume for the given metric. + IndexedVolume *int64 `json:"indexed_volume,omitempty"` + // Ingested volume for the given metric. + IngestedVolume *int64 `json:"ingested_volume,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{} +} + +// NewMetricIngestedIndexedVolumeAttributes instantiates a new MetricIngestedIndexedVolumeAttributes 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 NewMetricIngestedIndexedVolumeAttributes() *MetricIngestedIndexedVolumeAttributes { + this := MetricIngestedIndexedVolumeAttributes{} + return &this +} + +// NewMetricIngestedIndexedVolumeAttributesWithDefaults instantiates a new MetricIngestedIndexedVolumeAttributes 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 NewMetricIngestedIndexedVolumeAttributesWithDefaults() *MetricIngestedIndexedVolumeAttributes { + this := MetricIngestedIndexedVolumeAttributes{} + return &this +} + +// GetIndexedVolume returns the IndexedVolume field value if set, zero value otherwise. +func (o *MetricIngestedIndexedVolumeAttributes) GetIndexedVolume() int64 { + if o == nil || o.IndexedVolume == nil { + var ret int64 + return ret + } + return *o.IndexedVolume +} + +// GetIndexedVolumeOk returns a tuple with the IndexedVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricIngestedIndexedVolumeAttributes) GetIndexedVolumeOk() (*int64, bool) { + if o == nil || o.IndexedVolume == nil { + return nil, false + } + return o.IndexedVolume, true +} + +// HasIndexedVolume returns a boolean if a field has been set. +func (o *MetricIngestedIndexedVolumeAttributes) HasIndexedVolume() bool { + if o != nil && o.IndexedVolume != nil { + return true + } + + return false +} + +// SetIndexedVolume gets a reference to the given int64 and assigns it to the IndexedVolume field. +func (o *MetricIngestedIndexedVolumeAttributes) SetIndexedVolume(v int64) { + o.IndexedVolume = &v +} + +// GetIngestedVolume returns the IngestedVolume field value if set, zero value otherwise. +func (o *MetricIngestedIndexedVolumeAttributes) GetIngestedVolume() int64 { + if o == nil || o.IngestedVolume == nil { + var ret int64 + return ret + } + return *o.IngestedVolume +} + +// GetIngestedVolumeOk returns a tuple with the IngestedVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricIngestedIndexedVolumeAttributes) GetIngestedVolumeOk() (*int64, bool) { + if o == nil || o.IngestedVolume == nil { + return nil, false + } + return o.IngestedVolume, true +} + +// HasIngestedVolume returns a boolean if a field has been set. +func (o *MetricIngestedIndexedVolumeAttributes) HasIngestedVolume() bool { + if o != nil && o.IngestedVolume != nil { + return true + } + + return false +} + +// SetIngestedVolume gets a reference to the given int64 and assigns it to the IngestedVolume field. +func (o *MetricIngestedIndexedVolumeAttributes) SetIngestedVolume(v int64) { + o.IngestedVolume = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricIngestedIndexedVolumeAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.IndexedVolume != nil { + toSerialize["indexed_volume"] = o.IndexedVolume + } + if o.IngestedVolume != nil { + toSerialize["ingested_volume"] = o.IngestedVolume + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricIngestedIndexedVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + IndexedVolume *int64 `json:"indexed_volume,omitempty"` + IngestedVolume *int64 `json:"ingested_volume,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IndexedVolume = all.IndexedVolume + o.IngestedVolume = all.IngestedVolume + return nil +} diff --git a/api/v2/datadog/model_metric_ingested_indexed_volume_type.go b/api/v2/datadog/model_metric_ingested_indexed_volume_type.go new file mode 100644 index 00000000000..6d401a94765 --- /dev/null +++ b/api/v2/datadog/model_metric_ingested_indexed_volume_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricIngestedIndexedVolumeType The metric ingested and indexed volume type. +type MetricIngestedIndexedVolumeType string + +// List of MetricIngestedIndexedVolumeType. +const ( + METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES MetricIngestedIndexedVolumeType = "metric_volumes" +) + +var allowedMetricIngestedIndexedVolumeTypeEnumValues = []MetricIngestedIndexedVolumeType{ + METRICINGESTEDINDEXEDVOLUMETYPE_METRIC_VOLUMES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricIngestedIndexedVolumeType) GetAllowedValues() []MetricIngestedIndexedVolumeType { + return allowedMetricIngestedIndexedVolumeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricIngestedIndexedVolumeType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricIngestedIndexedVolumeType(value) + return nil +} + +// NewMetricIngestedIndexedVolumeTypeFromValue returns a pointer to a valid MetricIngestedIndexedVolumeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricIngestedIndexedVolumeTypeFromValue(v string) (*MetricIngestedIndexedVolumeType, error) { + ev := MetricIngestedIndexedVolumeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricIngestedIndexedVolumeType: valid values are %v", v, allowedMetricIngestedIndexedVolumeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricIngestedIndexedVolumeType) IsValid() bool { + for _, existing := range allowedMetricIngestedIndexedVolumeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricIngestedIndexedVolumeType value. +func (v MetricIngestedIndexedVolumeType) Ptr() *MetricIngestedIndexedVolumeType { + return &v +} + +// NullableMetricIngestedIndexedVolumeType handles when a null is used for MetricIngestedIndexedVolumeType. +type NullableMetricIngestedIndexedVolumeType struct { + value *MetricIngestedIndexedVolumeType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricIngestedIndexedVolumeType) Get() *MetricIngestedIndexedVolumeType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricIngestedIndexedVolumeType) Set(val *MetricIngestedIndexedVolumeType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricIngestedIndexedVolumeType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricIngestedIndexedVolumeType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricIngestedIndexedVolumeType initializes the struct as if Set has been called. +func NewNullableMetricIngestedIndexedVolumeType(val *MetricIngestedIndexedVolumeType) *NullableMetricIngestedIndexedVolumeType { + return &NullableMetricIngestedIndexedVolumeType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricIngestedIndexedVolumeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricIngestedIndexedVolumeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_intake_type.go b/api/v2/datadog/model_metric_intake_type.go new file mode 100644 index 00000000000..1393e03f252 --- /dev/null +++ b/api/v2/datadog/model_metric_intake_type.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricIntakeType The type of metric. The available types are `0` (unspecified), `1` (count), `2` (rate), and `3` (gauge). +type MetricIntakeType int32 + +// List of MetricIntakeType. +const ( + METRICINTAKETYPE_UNSPECIFIED MetricIntakeType = 0 + METRICINTAKETYPE_COUNT MetricIntakeType = 1 + METRICINTAKETYPE_RATE MetricIntakeType = 2 + METRICINTAKETYPE_GAUGE MetricIntakeType = 3 +) + +var allowedMetricIntakeTypeEnumValues = []MetricIntakeType{ + METRICINTAKETYPE_UNSPECIFIED, + METRICINTAKETYPE_COUNT, + METRICINTAKETYPE_RATE, + METRICINTAKETYPE_GAUGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricIntakeType) GetAllowedValues() []MetricIntakeType { + return allowedMetricIntakeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricIntakeType) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricIntakeType(value) + return nil +} + +// NewMetricIntakeTypeFromValue returns a pointer to a valid MetricIntakeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricIntakeTypeFromValue(v int32) (*MetricIntakeType, error) { + ev := MetricIntakeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricIntakeType: valid values are %v", v, allowedMetricIntakeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricIntakeType) IsValid() bool { + for _, existing := range allowedMetricIntakeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricIntakeType value. +func (v MetricIntakeType) Ptr() *MetricIntakeType { + return &v +} + +// NullableMetricIntakeType handles when a null is used for MetricIntakeType. +type NullableMetricIntakeType struct { + value *MetricIntakeType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricIntakeType) Get() *MetricIntakeType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricIntakeType) Set(val *MetricIntakeType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricIntakeType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricIntakeType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricIntakeType initializes the struct as if Set has been called. +func NewNullableMetricIntakeType(val *MetricIntakeType) *NullableMetricIntakeType { + return &NullableMetricIntakeType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricIntakeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricIntakeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_metadata.go b/api/v2/datadog/model_metric_metadata.go new file mode 100644 index 00000000000..6f89aec372a --- /dev/null +++ b/api/v2/datadog/model_metric_metadata.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricMetadata Metadata for the metric. +type MetricMetadata struct { + // Metric origin information. + Origin *MetricOrigin `json:"origin,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{} +} + +// NewMetricMetadata instantiates a new MetricMetadata 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 NewMetricMetadata() *MetricMetadata { + this := MetricMetadata{} + return &this +} + +// NewMetricMetadataWithDefaults instantiates a new MetricMetadata 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 NewMetricMetadataWithDefaults() *MetricMetadata { + this := MetricMetadata{} + return &this +} + +// GetOrigin returns the Origin field value if set, zero value otherwise. +func (o *MetricMetadata) GetOrigin() MetricOrigin { + if o == nil || o.Origin == nil { + var ret MetricOrigin + return ret + } + return *o.Origin +} + +// GetOriginOk returns a tuple with the Origin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricMetadata) GetOriginOk() (*MetricOrigin, bool) { + if o == nil || o.Origin == nil { + return nil, false + } + return o.Origin, true +} + +// HasOrigin returns a boolean if a field has been set. +func (o *MetricMetadata) HasOrigin() bool { + if o != nil && o.Origin != nil { + return true + } + + return false +} + +// SetOrigin gets a reference to the given MetricOrigin and assigns it to the Origin field. +func (o *MetricMetadata) SetOrigin(v MetricOrigin) { + o.Origin = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Origin != nil { + toSerialize["origin"] = o.Origin + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Origin *MetricOrigin `json:"origin,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Origin != nil && all.Origin.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Origin = all.Origin + return nil +} diff --git a/api/v2/datadog/model_metric_origin.go b/api/v2/datadog/model_metric_origin.go new file mode 100644 index 00000000000..00e21b3c45e --- /dev/null +++ b/api/v2/datadog/model_metric_origin.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricOrigin Metric origin information. +type MetricOrigin struct { + // The origin metric type code + MetricType *int32 `json:"metric_type,omitempty"` + // The origin product code + Product *int32 `json:"product,omitempty"` + // The origin service code + Service *int32 `json:"service,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{} +} + +// NewMetricOrigin instantiates a new MetricOrigin 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 NewMetricOrigin() *MetricOrigin { + this := MetricOrigin{} + var metricType int32 = 0 + this.MetricType = &metricType + var product int32 = 0 + this.Product = &product + var service int32 = 0 + this.Service = &service + return &this +} + +// NewMetricOriginWithDefaults instantiates a new MetricOrigin 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 NewMetricOriginWithDefaults() *MetricOrigin { + this := MetricOrigin{} + var metricType int32 = 0 + this.MetricType = &metricType + var product int32 = 0 + this.Product = &product + var service int32 = 0 + this.Service = &service + return &this +} + +// GetMetricType returns the MetricType field value if set, zero value otherwise. +func (o *MetricOrigin) GetMetricType() int32 { + if o == nil || o.MetricType == nil { + var ret int32 + return ret + } + return *o.MetricType +} + +// GetMetricTypeOk returns a tuple with the MetricType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricOrigin) GetMetricTypeOk() (*int32, bool) { + if o == nil || o.MetricType == nil { + return nil, false + } + return o.MetricType, true +} + +// HasMetricType returns a boolean if a field has been set. +func (o *MetricOrigin) HasMetricType() bool { + if o != nil && o.MetricType != nil { + return true + } + + return false +} + +// SetMetricType gets a reference to the given int32 and assigns it to the MetricType field. +func (o *MetricOrigin) SetMetricType(v int32) { + o.MetricType = &v +} + +// GetProduct returns the Product field value if set, zero value otherwise. +func (o *MetricOrigin) GetProduct() int32 { + if o == nil || o.Product == nil { + var ret int32 + return ret + } + return *o.Product +} + +// GetProductOk returns a tuple with the Product field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricOrigin) GetProductOk() (*int32, bool) { + if o == nil || o.Product == nil { + return nil, false + } + return o.Product, true +} + +// HasProduct returns a boolean if a field has been set. +func (o *MetricOrigin) HasProduct() bool { + if o != nil && o.Product != nil { + return true + } + + return false +} + +// SetProduct gets a reference to the given int32 and assigns it to the Product field. +func (o *MetricOrigin) SetProduct(v int32) { + o.Product = &v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *MetricOrigin) GetService() int32 { + if o == nil || o.Service == nil { + var ret int32 + 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 *MetricOrigin) GetServiceOk() (*int32, 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 *MetricOrigin) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given int32 and assigns it to the Service field. +func (o *MetricOrigin) SetService(v int32) { + o.Service = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricOrigin) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.MetricType != nil { + toSerialize["metric_type"] = o.MetricType + } + if o.Product != nil { + toSerialize["product"] = o.Product + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricOrigin) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + MetricType *int32 `json:"metric_type,omitempty"` + Product *int32 `json:"product,omitempty"` + Service *int32 `json:"service,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.MetricType = all.MetricType + o.Product = all.Product + o.Service = all.Service + return nil +} diff --git a/api/v2/datadog/model_metric_payload.go b/api/v2/datadog/model_metric_payload.go new file mode 100644 index 00000000000..f4dac520a01 --- /dev/null +++ b/api/v2/datadog/model_metric_payload.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricPayload The metrics' payload. +type MetricPayload struct { + // A list of time series to submit to Datadog. + Series []MetricSeries `json:"series"` + // 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{} +} + +// NewMetricPayload instantiates a new MetricPayload 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 NewMetricPayload(series []MetricSeries) *MetricPayload { + this := MetricPayload{} + this.Series = series + return &this +} + +// NewMetricPayloadWithDefaults instantiates a new MetricPayload 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 NewMetricPayloadWithDefaults() *MetricPayload { + this := MetricPayload{} + return &this +} + +// GetSeries returns the Series field value. +func (o *MetricPayload) GetSeries() []MetricSeries { + if o == nil { + var ret []MetricSeries + return ret + } + return o.Series +} + +// GetSeriesOk returns a tuple with the Series field value +// and a boolean to check if the value has been set. +func (o *MetricPayload) GetSeriesOk() (*[]MetricSeries, bool) { + if o == nil { + return nil, false + } + return &o.Series, true +} + +// SetSeries sets field value. +func (o *MetricPayload) SetSeries(v []MetricSeries) { + o.Series = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricPayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["series"] = o.Series + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricPayload) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Series *[]MetricSeries `json:"series"` + }{} + all := struct { + Series []MetricSeries `json:"series"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Series == nil { + return fmt.Errorf("Required field series missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Series = all.Series + return nil +} diff --git a/api/v2/datadog/model_metric_point.go b/api/v2/datadog/model_metric_point.go new file mode 100644 index 00000000000..8fd1893799e --- /dev/null +++ b/api/v2/datadog/model_metric_point.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricPoint A point object is of the form `{POSIX_timestamp, numeric_value}`. +type MetricPoint struct { + // The timestamp should be in seconds and current. + // Current is defined as not more than 10 minutes in the future or more than 1 hour in the past. + Timestamp *int64 `json:"timestamp,omitempty"` + // The numeric value format should be a 64bit float gauge-type value. + Value *float64 `json:"value,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{} +} + +// NewMetricPoint instantiates a new MetricPoint 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 NewMetricPoint() *MetricPoint { + this := MetricPoint{} + return &this +} + +// NewMetricPointWithDefaults instantiates a new MetricPoint 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 NewMetricPointWithDefaults() *MetricPoint { + this := MetricPoint{} + return &this +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *MetricPoint) GetTimestamp() int64 { + if o == nil || o.Timestamp == nil { + var ret int64 + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricPoint) GetTimestampOk() (*int64, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *MetricPoint) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given int64 and assigns it to the Timestamp field. +func (o *MetricPoint) SetTimestamp(v int64) { + o.Timestamp = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *MetricPoint) GetValue() float64 { + if o == nil || o.Value == nil { + var ret float64 + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricPoint) GetValueOk() (*float64, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *MetricPoint) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given float64 and assigns it to the Value field. +func (o *MetricPoint) SetValue(v float64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricPoint) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Timestamp != nil { + toSerialize["timestamp"] = o.Timestamp + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricPoint) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Timestamp *int64 `json:"timestamp,omitempty"` + Value *float64 `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Timestamp = all.Timestamp + o.Value = all.Value + return nil +} diff --git a/api/v2/datadog/model_metric_resource.go b/api/v2/datadog/model_metric_resource.go new file mode 100644 index 00000000000..e6155a78f64 --- /dev/null +++ b/api/v2/datadog/model_metric_resource.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricResource Metric resource. +type MetricResource struct { + // The name of the resource. + Name *string `json:"name,omitempty"` + // The type of the resource. + Type *string `json:"type,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{} +} + +// NewMetricResource instantiates a new MetricResource 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 NewMetricResource() *MetricResource { + this := MetricResource{} + return &this +} + +// NewMetricResourceWithDefaults instantiates a new MetricResource 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 NewMetricResourceWithDefaults() *MetricResource { + this := MetricResource{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MetricResource) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricResource) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MetricResource) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MetricResource) SetName(v string) { + o.Name = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricResource) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricResource) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricResource) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *MetricResource) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricResource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricResource) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_series.go b/api/v2/datadog/model_metric_series.go new file mode 100644 index 00000000000..cdf13fc9866 --- /dev/null +++ b/api/v2/datadog/model_metric_series.go @@ -0,0 +1,425 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricSeries A metric to submit to Datadog. +// See [Datadog metrics](https://docs.datadoghq.com/developers/metrics/#custom-metrics-properties). +type MetricSeries struct { + // If the type of the metric is rate or count, define the corresponding interval. + Interval *int64 `json:"interval,omitempty"` + // Metadata for the metric. + Metadata *MetricMetadata `json:"metadata,omitempty"` + // The name of the timeseries. + Metric string `json:"metric"` + // Points relating to a metric. All points must be objects with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past. + Points []MetricPoint `json:"points"` + // A list of resources to associate with this metric. + Resources []MetricResource `json:"resources,omitempty"` + // The source type name. + SourceTypeName *string `json:"source_type_name,omitempty"` + // A list of tags associated with the metric. + Tags []string `json:"tags,omitempty"` + // The type of metric. The available types are `0` (unspecified), `1` (count), `2` (rate), and `3` (gauge). + Type *MetricIntakeType `json:"type,omitempty"` + // The unit of point value. + Unit *string `json:"unit,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{} +} + +// NewMetricSeries instantiates a new MetricSeries 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 NewMetricSeries(metric string, points []MetricPoint) *MetricSeries { + this := MetricSeries{} + this.Metric = metric + this.Points = points + return &this +} + +// NewMetricSeriesWithDefaults instantiates a new MetricSeries 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 NewMetricSeriesWithDefaults() *MetricSeries { + this := MetricSeries{} + return &this +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *MetricSeries) GetInterval() int64 { + if o == nil || o.Interval == nil { + var ret int64 + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetIntervalOk() (*int64, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *MetricSeries) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given int64 and assigns it to the Interval field. +func (o *MetricSeries) SetInterval(v int64) { + o.Interval = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *MetricSeries) GetMetadata() MetricMetadata { + if o == nil || o.Metadata == nil { + var ret MetricMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetMetadataOk() (*MetricMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *MetricSeries) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// SetMetadata gets a reference to the given MetricMetadata and assigns it to the Metadata field. +func (o *MetricSeries) SetMetadata(v MetricMetadata) { + o.Metadata = &v +} + +// GetMetric returns the Metric field value. +func (o *MetricSeries) GetMetric() string { + if o == nil { + var ret string + return ret + } + return o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetMetricOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metric, true +} + +// SetMetric sets field value. +func (o *MetricSeries) SetMetric(v string) { + o.Metric = v +} + +// GetPoints returns the Points field value. +func (o *MetricSeries) GetPoints() []MetricPoint { + if o == nil { + var ret []MetricPoint + return ret + } + return o.Points +} + +// GetPointsOk returns a tuple with the Points field value +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetPointsOk() (*[]MetricPoint, bool) { + if o == nil { + return nil, false + } + return &o.Points, true +} + +// SetPoints sets field value. +func (o *MetricSeries) SetPoints(v []MetricPoint) { + o.Points = v +} + +// GetResources returns the Resources field value if set, zero value otherwise. +func (o *MetricSeries) GetResources() []MetricResource { + if o == nil || o.Resources == nil { + var ret []MetricResource + return ret + } + return o.Resources +} + +// GetResourcesOk returns a tuple with the Resources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetResourcesOk() (*[]MetricResource, bool) { + if o == nil || o.Resources == nil { + return nil, false + } + return &o.Resources, true +} + +// HasResources returns a boolean if a field has been set. +func (o *MetricSeries) HasResources() bool { + if o != nil && o.Resources != nil { + return true + } + + return false +} + +// SetResources gets a reference to the given []MetricResource and assigns it to the Resources field. +func (o *MetricSeries) SetResources(v []MetricResource) { + o.Resources = v +} + +// GetSourceTypeName returns the SourceTypeName field value if set, zero value otherwise. +func (o *MetricSeries) GetSourceTypeName() string { + if o == nil || o.SourceTypeName == nil { + var ret string + return ret + } + return *o.SourceTypeName +} + +// GetSourceTypeNameOk returns a tuple with the SourceTypeName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetSourceTypeNameOk() (*string, bool) { + if o == nil || o.SourceTypeName == nil { + return nil, false + } + return o.SourceTypeName, true +} + +// HasSourceTypeName returns a boolean if a field has been set. +func (o *MetricSeries) HasSourceTypeName() bool { + if o != nil && o.SourceTypeName != nil { + return true + } + + return false +} + +// SetSourceTypeName gets a reference to the given string and assigns it to the SourceTypeName field. +func (o *MetricSeries) SetSourceTypeName(v string) { + o.SourceTypeName = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MetricSeries) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MetricSeries) GetTagsOk() (*[]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 *MetricSeries) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MetricSeries) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricSeries) GetType() MetricIntakeType { + if o == nil || o.Type == nil { + var ret MetricIntakeType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetTypeOk() (*MetricIntakeType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricSeries) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MetricIntakeType and assigns it to the Type field. +func (o *MetricSeries) SetType(v MetricIntakeType) { + o.Type = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *MetricSeries) GetUnit() string { + if o == nil || o.Unit == nil { + var ret string + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricSeries) GetUnitOk() (*string, bool) { + if o == nil || o.Unit == nil { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *MetricSeries) HasUnit() bool { + if o != nil && o.Unit != nil { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *MetricSeries) SetUnit(v string) { + o.Unit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricSeries) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["metric"] = o.Metric + toSerialize["points"] = o.Points + if o.Resources != nil { + toSerialize["resources"] = o.Resources + } + if o.SourceTypeName != nil { + toSerialize["source_type_name"] = o.SourceTypeName + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Unit != nil { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Metric *string `json:"metric"` + Points *[]MetricPoint `json:"points"` + }{} + all := struct { + Interval *int64 `json:"interval,omitempty"` + Metadata *MetricMetadata `json:"metadata,omitempty"` + Metric string `json:"metric"` + Points []MetricPoint `json:"points"` + Resources []MetricResource `json:"resources,omitempty"` + SourceTypeName *string `json:"source_type_name,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *MetricIntakeType `json:"type,omitempty"` + Unit *string `json:"unit,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Metric == nil { + return fmt.Errorf("Required field metric missing") + } + if required.Points == nil { + return fmt.Errorf("Required field points missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Interval = all.Interval + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Metadata = all.Metadata + o.Metric = all.Metric + o.Points = all.Points + o.Resources = all.Resources + o.SourceTypeName = all.SourceTypeName + o.Tags = all.Tags + o.Type = all.Type + o.Unit = all.Unit + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration.go b/api/v2/datadog/model_metric_tag_configuration.go new file mode 100644 index 00000000000..0f08e9a4290 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricTagConfiguration Object for a single metric tag configuration. +type MetricTagConfiguration struct { + // Object containing the definition of a metric tag configuration attributes. + Attributes *MetricTagConfigurationAttributes `json:"attributes,omitempty"` + // The metric name for this resource. + Id *string `json:"id,omitempty"` + // The metric tag configuration resource type. + Type *MetricTagConfigurationType `json:"type,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{} +} + +// NewMetricTagConfiguration instantiates a new MetricTagConfiguration 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 NewMetricTagConfiguration() *MetricTagConfiguration { + this := MetricTagConfiguration{} + var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS + this.Type = &typeVar + return &this +} + +// NewMetricTagConfigurationWithDefaults instantiates a new MetricTagConfiguration 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 NewMetricTagConfigurationWithDefaults() *MetricTagConfiguration { + this := MetricTagConfiguration{} + var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricTagConfiguration) GetAttributes() MetricTagConfigurationAttributes { + if o == nil || o.Attributes == nil { + var ret MetricTagConfigurationAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfiguration) GetAttributesOk() (*MetricTagConfigurationAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricTagConfiguration) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricTagConfigurationAttributes and assigns it to the Attributes field. +func (o *MetricTagConfiguration) SetAttributes(v MetricTagConfigurationAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MetricTagConfiguration) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfiguration) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MetricTagConfiguration) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MetricTagConfiguration) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetricTagConfiguration) GetType() MetricTagConfigurationType { + if o == nil || o.Type == nil { + var ret MetricTagConfigurationType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfiguration) GetTypeOk() (*MetricTagConfigurationType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetricTagConfiguration) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given MetricTagConfigurationType and assigns it to the Type field. +func (o *MetricTagConfiguration) SetType(v MetricTagConfigurationType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfiguration) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfiguration) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *MetricTagConfigurationAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MetricTagConfigurationType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_attributes.go b/api/v2/datadog/model_metric_tag_configuration_attributes.go new file mode 100644 index 00000000000..44166e74a36 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_attributes.go @@ -0,0 +1,334 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// MetricTagConfigurationAttributes Object containing the definition of a metric tag configuration attributes. +type MetricTagConfigurationAttributes struct { + // A list of queryable aggregation combinations for a count, rate, or gauge metric. + // By default, count and rate metrics require the (time: sum, space: sum) aggregation and + // Gauge metrics require the (time: avg, space: avg) aggregation. + // Additional time & space combinations are also available: + // + // - time: avg, space: avg + // - time: avg, space: max + // - time: avg, space: min + // - time: avg, space: sum + // - time: count, space: sum + // - time: max, space: max + // - time: min, space: min + // - time: sum, space: avg + // - time: sum, space: sum + // + // Can only be applied to metrics that have a `metric_type` of `count`, `rate`, or `gauge`. + Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` + // Timestamp when the tag configuration was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Toggle to turn on/off percentile aggregations for distribution metrics. + // Only present when the `metric_type` is `distribution`. + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + // The metric's type. + MetricType *MetricTagConfigurationMetricTypes `json:"metric_type,omitempty"` + // Timestamp when the tag configuration was last modified. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // List of tag keys on which to group. + Tags []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{} +} + +// NewMetricTagConfigurationAttributes instantiates a new MetricTagConfigurationAttributes 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 NewMetricTagConfigurationAttributes() *MetricTagConfigurationAttributes { + this := MetricTagConfigurationAttributes{} + var metricType MetricTagConfigurationMetricTypes = METRICTAGCONFIGURATIONMETRICTYPES_GAUGE + this.MetricType = &metricType + return &this +} + +// NewMetricTagConfigurationAttributesWithDefaults instantiates a new MetricTagConfigurationAttributes 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 NewMetricTagConfigurationAttributesWithDefaults() *MetricTagConfigurationAttributes { + this := MetricTagConfigurationAttributes{} + var metricType MetricTagConfigurationMetricTypes = METRICTAGCONFIGURATIONMETRICTYPES_GAUGE + this.MetricType = &metricType + return &this +} + +// GetAggregations returns the Aggregations field value if set, zero value otherwise. +func (o *MetricTagConfigurationAttributes) GetAggregations() []MetricCustomAggregation { + if o == nil || o.Aggregations == nil { + var ret []MetricCustomAggregation + return ret + } + return o.Aggregations +} + +// GetAggregationsOk returns a tuple with the Aggregations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationAttributes) GetAggregationsOk() (*[]MetricCustomAggregation, bool) { + if o == nil || o.Aggregations == nil { + return nil, false + } + return &o.Aggregations, true +} + +// HasAggregations returns a boolean if a field has been set. +func (o *MetricTagConfigurationAttributes) HasAggregations() bool { + if o != nil && o.Aggregations != nil { + return true + } + + return false +} + +// SetAggregations gets a reference to the given []MetricCustomAggregation and assigns it to the Aggregations field. +func (o *MetricTagConfigurationAttributes) SetAggregations(v []MetricCustomAggregation) { + o.Aggregations = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *MetricTagConfigurationAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *MetricTagConfigurationAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *MetricTagConfigurationAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise. +func (o *MetricTagConfigurationAttributes) GetIncludePercentiles() bool { + if o == nil || o.IncludePercentiles == nil { + var ret bool + return ret + } + return *o.IncludePercentiles +} + +// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationAttributes) GetIncludePercentilesOk() (*bool, bool) { + if o == nil || o.IncludePercentiles == nil { + return nil, false + } + return o.IncludePercentiles, true +} + +// HasIncludePercentiles returns a boolean if a field has been set. +func (o *MetricTagConfigurationAttributes) HasIncludePercentiles() bool { + if o != nil && o.IncludePercentiles != nil { + return true + } + + return false +} + +// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field. +func (o *MetricTagConfigurationAttributes) SetIncludePercentiles(v bool) { + o.IncludePercentiles = &v +} + +// GetMetricType returns the MetricType field value if set, zero value otherwise. +func (o *MetricTagConfigurationAttributes) GetMetricType() MetricTagConfigurationMetricTypes { + if o == nil || o.MetricType == nil { + var ret MetricTagConfigurationMetricTypes + return ret + } + return *o.MetricType +} + +// GetMetricTypeOk returns a tuple with the MetricType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationAttributes) GetMetricTypeOk() (*MetricTagConfigurationMetricTypes, bool) { + if o == nil || o.MetricType == nil { + return nil, false + } + return o.MetricType, true +} + +// HasMetricType returns a boolean if a field has been set. +func (o *MetricTagConfigurationAttributes) HasMetricType() bool { + if o != nil && o.MetricType != nil { + return true + } + + return false +} + +// SetMetricType gets a reference to the given MetricTagConfigurationMetricTypes and assigns it to the MetricType field. +func (o *MetricTagConfigurationAttributes) SetMetricType(v MetricTagConfigurationMetricTypes) { + o.MetricType = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *MetricTagConfigurationAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *MetricTagConfigurationAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *MetricTagConfigurationAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MetricTagConfigurationAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MetricTagConfigurationAttributes) GetTagsOk() (*[]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 *MetricTagConfigurationAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MetricTagConfigurationAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregations != nil { + toSerialize["aggregations"] = o.Aggregations + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.IncludePercentiles != nil { + toSerialize["include_percentiles"] = o.IncludePercentiles + } + if o.MetricType != nil { + toSerialize["metric_type"] = o.MetricType + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + MetricType *MetricTagConfigurationMetricTypes `json:"metric_type,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.MetricType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregations = all.Aggregations + o.CreatedAt = all.CreatedAt + o.IncludePercentiles = all.IncludePercentiles + o.MetricType = all.MetricType + o.ModifiedAt = all.ModifiedAt + o.Tags = all.Tags + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_create_attributes.go b/api/v2/datadog/model_metric_tag_configuration_create_attributes.go new file mode 100644 index 00000000000..2707fece35b --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_create_attributes.go @@ -0,0 +1,240 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricTagConfigurationCreateAttributes Object containing the definition of a metric tag configuration to be created. +type MetricTagConfigurationCreateAttributes struct { + // A list of queryable aggregation combinations for a count, rate, or gauge metric. + // By default, count and rate metrics require the (time: sum, space: sum) aggregation and + // Gauge metrics require the (time: avg, space: avg) aggregation. + // Additional time & space combinations are also available: + // + // - time: avg, space: avg + // - time: avg, space: max + // - time: avg, space: min + // - time: avg, space: sum + // - time: count, space: sum + // - time: max, space: max + // - time: min, space: min + // - time: sum, space: avg + // - time: sum, space: sum + // + // Can only be applied to metrics that have a `metric_type` of `count`, `rate`, or `gauge`. + Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` + // Toggle to include/exclude percentiles for a distribution metric. + // Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + // The metric's type. + MetricType MetricTagConfigurationMetricTypes `json:"metric_type"` + // A list of tag keys that will be queryable for your metric. + Tags []string `json:"tags"` + // 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{} +} + +// NewMetricTagConfigurationCreateAttributes instantiates a new MetricTagConfigurationCreateAttributes 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 NewMetricTagConfigurationCreateAttributes(metricType MetricTagConfigurationMetricTypes, tags []string) *MetricTagConfigurationCreateAttributes { + this := MetricTagConfigurationCreateAttributes{} + this.MetricType = metricType + this.Tags = tags + return &this +} + +// NewMetricTagConfigurationCreateAttributesWithDefaults instantiates a new MetricTagConfigurationCreateAttributes 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 NewMetricTagConfigurationCreateAttributesWithDefaults() *MetricTagConfigurationCreateAttributes { + this := MetricTagConfigurationCreateAttributes{} + var metricType MetricTagConfigurationMetricTypes = METRICTAGCONFIGURATIONMETRICTYPES_GAUGE + this.MetricType = metricType + return &this +} + +// GetAggregations returns the Aggregations field value if set, zero value otherwise. +func (o *MetricTagConfigurationCreateAttributes) GetAggregations() []MetricCustomAggregation { + if o == nil || o.Aggregations == nil { + var ret []MetricCustomAggregation + return ret + } + return o.Aggregations +} + +// GetAggregationsOk returns a tuple with the Aggregations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationCreateAttributes) GetAggregationsOk() (*[]MetricCustomAggregation, bool) { + if o == nil || o.Aggregations == nil { + return nil, false + } + return &o.Aggregations, true +} + +// HasAggregations returns a boolean if a field has been set. +func (o *MetricTagConfigurationCreateAttributes) HasAggregations() bool { + if o != nil && o.Aggregations != nil { + return true + } + + return false +} + +// SetAggregations gets a reference to the given []MetricCustomAggregation and assigns it to the Aggregations field. +func (o *MetricTagConfigurationCreateAttributes) SetAggregations(v []MetricCustomAggregation) { + o.Aggregations = v +} + +// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise. +func (o *MetricTagConfigurationCreateAttributes) GetIncludePercentiles() bool { + if o == nil || o.IncludePercentiles == nil { + var ret bool + return ret + } + return *o.IncludePercentiles +} + +// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationCreateAttributes) GetIncludePercentilesOk() (*bool, bool) { + if o == nil || o.IncludePercentiles == nil { + return nil, false + } + return o.IncludePercentiles, true +} + +// HasIncludePercentiles returns a boolean if a field has been set. +func (o *MetricTagConfigurationCreateAttributes) HasIncludePercentiles() bool { + if o != nil && o.IncludePercentiles != nil { + return true + } + + return false +} + +// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field. +func (o *MetricTagConfigurationCreateAttributes) SetIncludePercentiles(v bool) { + o.IncludePercentiles = &v +} + +// GetMetricType returns the MetricType field value. +func (o *MetricTagConfigurationCreateAttributes) GetMetricType() MetricTagConfigurationMetricTypes { + if o == nil { + var ret MetricTagConfigurationMetricTypes + return ret + } + return o.MetricType +} + +// GetMetricTypeOk returns a tuple with the MetricType field value +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationCreateAttributes) GetMetricTypeOk() (*MetricTagConfigurationMetricTypes, bool) { + if o == nil { + return nil, false + } + return &o.MetricType, true +} + +// SetMetricType sets field value. +func (o *MetricTagConfigurationCreateAttributes) SetMetricType(v MetricTagConfigurationMetricTypes) { + o.MetricType = v +} + +// GetTags returns the Tags field value. +func (o *MetricTagConfigurationCreateAttributes) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationCreateAttributes) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *MetricTagConfigurationCreateAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregations != nil { + toSerialize["aggregations"] = o.Aggregations + } + if o.IncludePercentiles != nil { + toSerialize["include_percentiles"] = o.IncludePercentiles + } + toSerialize["metric_type"] = o.MetricType + toSerialize["tags"] = o.Tags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + MetricType *MetricTagConfigurationMetricTypes `json:"metric_type"` + Tags *[]string `json:"tags"` + }{} + all := struct { + Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + MetricType MetricTagConfigurationMetricTypes `json:"metric_type"` + Tags []string `json:"tags"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.MetricType == nil { + return fmt.Errorf("Required field metric_type missing") + } + if required.Tags == nil { + return fmt.Errorf("Required field tags missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.MetricType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregations = all.Aggregations + o.IncludePercentiles = all.IncludePercentiles + o.MetricType = all.MetricType + o.Tags = all.Tags + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_create_data.go b/api/v2/datadog/model_metric_tag_configuration_create_data.go new file mode 100644 index 00000000000..a616a39fb58 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_create_data.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricTagConfigurationCreateData Object for a single metric to be configure tags on. +type MetricTagConfigurationCreateData struct { + // Object containing the definition of a metric tag configuration to be created. + Attributes *MetricTagConfigurationCreateAttributes `json:"attributes,omitempty"` + // The metric name for this resource. + Id string `json:"id"` + // The metric tag configuration resource type. + Type MetricTagConfigurationType `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{} +} + +// NewMetricTagConfigurationCreateData instantiates a new MetricTagConfigurationCreateData 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 NewMetricTagConfigurationCreateData(id string, typeVar MetricTagConfigurationType) *MetricTagConfigurationCreateData { + this := MetricTagConfigurationCreateData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewMetricTagConfigurationCreateDataWithDefaults instantiates a new MetricTagConfigurationCreateData 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 NewMetricTagConfigurationCreateDataWithDefaults() *MetricTagConfigurationCreateData { + this := MetricTagConfigurationCreateData{} + var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricTagConfigurationCreateData) GetAttributes() MetricTagConfigurationCreateAttributes { + if o == nil || o.Attributes == nil { + var ret MetricTagConfigurationCreateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationCreateData) GetAttributesOk() (*MetricTagConfigurationCreateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricTagConfigurationCreateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricTagConfigurationCreateAttributes and assigns it to the Attributes field. +func (o *MetricTagConfigurationCreateData) SetAttributes(v MetricTagConfigurationCreateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *MetricTagConfigurationCreateData) 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 *MetricTagConfigurationCreateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *MetricTagConfigurationCreateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *MetricTagConfigurationCreateData) GetType() MetricTagConfigurationType { + if o == nil { + var ret MetricTagConfigurationType + 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 *MetricTagConfigurationCreateData) GetTypeOk() (*MetricTagConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MetricTagConfigurationCreateData) SetType(v MetricTagConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *MetricTagConfigurationType `json:"type"` + }{} + all := struct { + Attributes *MetricTagConfigurationCreateAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Type MetricTagConfigurationType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_create_request.go b/api/v2/datadog/model_metric_tag_configuration_create_request.go new file mode 100644 index 00000000000..35c19f979d6 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricTagConfigurationCreateRequest Request object that includes the metric that you would like to configure tags for. +type MetricTagConfigurationCreateRequest struct { + // Object for a single metric to be configure tags on. + Data MetricTagConfigurationCreateData `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{} +} + +// NewMetricTagConfigurationCreateRequest instantiates a new MetricTagConfigurationCreateRequest 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 NewMetricTagConfigurationCreateRequest(data MetricTagConfigurationCreateData) *MetricTagConfigurationCreateRequest { + this := MetricTagConfigurationCreateRequest{} + this.Data = data + return &this +} + +// NewMetricTagConfigurationCreateRequestWithDefaults instantiates a new MetricTagConfigurationCreateRequest 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 NewMetricTagConfigurationCreateRequestWithDefaults() *MetricTagConfigurationCreateRequest { + this := MetricTagConfigurationCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *MetricTagConfigurationCreateRequest) GetData() MetricTagConfigurationCreateData { + if o == nil { + var ret MetricTagConfigurationCreateData + 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 *MetricTagConfigurationCreateRequest) GetDataOk() (*MetricTagConfigurationCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MetricTagConfigurationCreateRequest) SetData(v MetricTagConfigurationCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *MetricTagConfigurationCreateData `json:"data"` + }{} + all := struct { + Data MetricTagConfigurationCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_metric_types.go b/api/v2/datadog/model_metric_tag_configuration_metric_types.go new file mode 100644 index 00000000000..e0d956a4a3f --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_metric_types.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricTagConfigurationMetricTypes The metric's type. +type MetricTagConfigurationMetricTypes string + +// List of MetricTagConfigurationMetricTypes. +const ( + METRICTAGCONFIGURATIONMETRICTYPES_GAUGE MetricTagConfigurationMetricTypes = "gauge" + METRICTAGCONFIGURATIONMETRICTYPES_COUNT MetricTagConfigurationMetricTypes = "count" + METRICTAGCONFIGURATIONMETRICTYPES_RATE MetricTagConfigurationMetricTypes = "rate" + METRICTAGCONFIGURATIONMETRICTYPES_DISTRIBUTION MetricTagConfigurationMetricTypes = "distribution" +) + +var allowedMetricTagConfigurationMetricTypesEnumValues = []MetricTagConfigurationMetricTypes{ + METRICTAGCONFIGURATIONMETRICTYPES_GAUGE, + METRICTAGCONFIGURATIONMETRICTYPES_COUNT, + METRICTAGCONFIGURATIONMETRICTYPES_RATE, + METRICTAGCONFIGURATIONMETRICTYPES_DISTRIBUTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricTagConfigurationMetricTypes) GetAllowedValues() []MetricTagConfigurationMetricTypes { + return allowedMetricTagConfigurationMetricTypesEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricTagConfigurationMetricTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricTagConfigurationMetricTypes(value) + return nil +} + +// NewMetricTagConfigurationMetricTypesFromValue returns a pointer to a valid MetricTagConfigurationMetricTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricTagConfigurationMetricTypesFromValue(v string) (*MetricTagConfigurationMetricTypes, error) { + ev := MetricTagConfigurationMetricTypes(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricTagConfigurationMetricTypes: valid values are %v", v, allowedMetricTagConfigurationMetricTypesEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricTagConfigurationMetricTypes) IsValid() bool { + for _, existing := range allowedMetricTagConfigurationMetricTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricTagConfigurationMetricTypes value. +func (v MetricTagConfigurationMetricTypes) Ptr() *MetricTagConfigurationMetricTypes { + return &v +} + +// NullableMetricTagConfigurationMetricTypes handles when a null is used for MetricTagConfigurationMetricTypes. +type NullableMetricTagConfigurationMetricTypes struct { + value *MetricTagConfigurationMetricTypes + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricTagConfigurationMetricTypes) Get() *MetricTagConfigurationMetricTypes { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricTagConfigurationMetricTypes) Set(val *MetricTagConfigurationMetricTypes) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricTagConfigurationMetricTypes) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricTagConfigurationMetricTypes) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricTagConfigurationMetricTypes initializes the struct as if Set has been called. +func NewNullableMetricTagConfigurationMetricTypes(val *MetricTagConfigurationMetricTypes) *NullableMetricTagConfigurationMetricTypes { + return &NullableMetricTagConfigurationMetricTypes{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricTagConfigurationMetricTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricTagConfigurationMetricTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_tag_configuration_response.go b/api/v2/datadog/model_metric_tag_configuration_response.go new file mode 100644 index 00000000000..2c11cd98b58 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricTagConfigurationResponse Response object which includes a single metric's tag configuration. +type MetricTagConfigurationResponse struct { + // Object for a single metric tag configuration. + Data *MetricTagConfiguration `json:"data,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{} +} + +// NewMetricTagConfigurationResponse instantiates a new MetricTagConfigurationResponse 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 NewMetricTagConfigurationResponse() *MetricTagConfigurationResponse { + this := MetricTagConfigurationResponse{} + return &this +} + +// NewMetricTagConfigurationResponseWithDefaults instantiates a new MetricTagConfigurationResponse 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 NewMetricTagConfigurationResponseWithDefaults() *MetricTagConfigurationResponse { + this := MetricTagConfigurationResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MetricTagConfigurationResponse) GetData() MetricTagConfiguration { + if o == nil || o.Data == nil { + var ret MetricTagConfiguration + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationResponse) GetDataOk() (*MetricTagConfiguration, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *MetricTagConfigurationResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given MetricTagConfiguration and assigns it to the Data field. +func (o *MetricTagConfigurationResponse) SetData(v MetricTagConfiguration) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *MetricTagConfiguration `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_type.go b/api/v2/datadog/model_metric_tag_configuration_type.go new file mode 100644 index 00000000000..2d9ccf6f1ce --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricTagConfigurationType The metric tag configuration resource type. +type MetricTagConfigurationType string + +// List of MetricTagConfigurationType. +const ( + METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS MetricTagConfigurationType = "manage_tags" +) + +var allowedMetricTagConfigurationTypeEnumValues = []MetricTagConfigurationType{ + METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricTagConfigurationType) GetAllowedValues() []MetricTagConfigurationType { + return allowedMetricTagConfigurationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricTagConfigurationType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricTagConfigurationType(value) + return nil +} + +// NewMetricTagConfigurationTypeFromValue returns a pointer to a valid MetricTagConfigurationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricTagConfigurationTypeFromValue(v string) (*MetricTagConfigurationType, error) { + ev := MetricTagConfigurationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricTagConfigurationType: valid values are %v", v, allowedMetricTagConfigurationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricTagConfigurationType) IsValid() bool { + for _, existing := range allowedMetricTagConfigurationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricTagConfigurationType value. +func (v MetricTagConfigurationType) Ptr() *MetricTagConfigurationType { + return &v +} + +// NullableMetricTagConfigurationType handles when a null is used for MetricTagConfigurationType. +type NullableMetricTagConfigurationType struct { + value *MetricTagConfigurationType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricTagConfigurationType) Get() *MetricTagConfigurationType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricTagConfigurationType) Set(val *MetricTagConfigurationType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricTagConfigurationType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricTagConfigurationType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricTagConfigurationType initializes the struct as if Set has been called. +func NewNullableMetricTagConfigurationType(val *MetricTagConfigurationType) *NullableMetricTagConfigurationType { + return &NullableMetricTagConfigurationType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricTagConfigurationType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricTagConfigurationType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_tag_configuration_update_attributes.go b/api/v2/datadog/model_metric_tag_configuration_update_attributes.go new file mode 100644 index 00000000000..b3c19db3197 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_update_attributes.go @@ -0,0 +1,196 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricTagConfigurationUpdateAttributes Object containing the definition of a metric tag configuration to be updated. +type MetricTagConfigurationUpdateAttributes struct { + // A list of queryable aggregation combinations for a count, rate, or gauge metric. + // By default, count and rate metrics require the (time: sum, space: sum) aggregation and + // Gauge metrics require the (time: avg, space: avg) aggregation. + // Additional time & space combinations are also available: + // + // - time: avg, space: avg + // - time: avg, space: max + // - time: avg, space: min + // - time: avg, space: sum + // - time: count, space: sum + // - time: max, space: max + // - time: min, space: min + // - time: sum, space: avg + // - time: sum, space: sum + // + // Can only be applied to metrics that have a `metric_type` of `count`, `rate`, or `gauge`. + Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` + // Toggle to include/exclude percentiles for a distribution metric. + // Defaults to false. Can only be applied to metrics that have a `metric_type` of `distribution`. + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + // A list of tag keys that will be queryable for your metric. + Tags []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{} +} + +// NewMetricTagConfigurationUpdateAttributes instantiates a new MetricTagConfigurationUpdateAttributes 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 NewMetricTagConfigurationUpdateAttributes() *MetricTagConfigurationUpdateAttributes { + this := MetricTagConfigurationUpdateAttributes{} + return &this +} + +// NewMetricTagConfigurationUpdateAttributesWithDefaults instantiates a new MetricTagConfigurationUpdateAttributes 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 NewMetricTagConfigurationUpdateAttributesWithDefaults() *MetricTagConfigurationUpdateAttributes { + this := MetricTagConfigurationUpdateAttributes{} + return &this +} + +// GetAggregations returns the Aggregations field value if set, zero value otherwise. +func (o *MetricTagConfigurationUpdateAttributes) GetAggregations() []MetricCustomAggregation { + if o == nil || o.Aggregations == nil { + var ret []MetricCustomAggregation + return ret + } + return o.Aggregations +} + +// GetAggregationsOk returns a tuple with the Aggregations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationUpdateAttributes) GetAggregationsOk() (*[]MetricCustomAggregation, bool) { + if o == nil || o.Aggregations == nil { + return nil, false + } + return &o.Aggregations, true +} + +// HasAggregations returns a boolean if a field has been set. +func (o *MetricTagConfigurationUpdateAttributes) HasAggregations() bool { + if o != nil && o.Aggregations != nil { + return true + } + + return false +} + +// SetAggregations gets a reference to the given []MetricCustomAggregation and assigns it to the Aggregations field. +func (o *MetricTagConfigurationUpdateAttributes) SetAggregations(v []MetricCustomAggregation) { + o.Aggregations = v +} + +// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise. +func (o *MetricTagConfigurationUpdateAttributes) GetIncludePercentiles() bool { + if o == nil || o.IncludePercentiles == nil { + var ret bool + return ret + } + return *o.IncludePercentiles +} + +// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationUpdateAttributes) GetIncludePercentilesOk() (*bool, bool) { + if o == nil || o.IncludePercentiles == nil { + return nil, false + } + return o.IncludePercentiles, true +} + +// HasIncludePercentiles returns a boolean if a field has been set. +func (o *MetricTagConfigurationUpdateAttributes) HasIncludePercentiles() bool { + if o != nil && o.IncludePercentiles != nil { + return true + } + + return false +} + +// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field. +func (o *MetricTagConfigurationUpdateAttributes) SetIncludePercentiles(v bool) { + o.IncludePercentiles = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MetricTagConfigurationUpdateAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MetricTagConfigurationUpdateAttributes) GetTagsOk() (*[]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 *MetricTagConfigurationUpdateAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MetricTagConfigurationUpdateAttributes) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregations != nil { + toSerialize["aggregations"] = o.Aggregations + } + if o.IncludePercentiles != nil { + toSerialize["include_percentiles"] = o.IncludePercentiles + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + Tags []string `json:"tags,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregations = all.Aggregations + o.IncludePercentiles = all.IncludePercentiles + o.Tags = all.Tags + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_update_data.go b/api/v2/datadog/model_metric_tag_configuration_update_data.go new file mode 100644 index 00000000000..82afe902735 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_update_data.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricTagConfigurationUpdateData Object for a single tag configuration to be edited. +type MetricTagConfigurationUpdateData struct { + // Object containing the definition of a metric tag configuration to be updated. + Attributes *MetricTagConfigurationUpdateAttributes `json:"attributes,omitempty"` + // The metric name for this resource. + Id string `json:"id"` + // The metric tag configuration resource type. + Type MetricTagConfigurationType `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{} +} + +// NewMetricTagConfigurationUpdateData instantiates a new MetricTagConfigurationUpdateData 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 NewMetricTagConfigurationUpdateData(id string, typeVar MetricTagConfigurationType) *MetricTagConfigurationUpdateData { + this := MetricTagConfigurationUpdateData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewMetricTagConfigurationUpdateDataWithDefaults instantiates a new MetricTagConfigurationUpdateData 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 NewMetricTagConfigurationUpdateDataWithDefaults() *MetricTagConfigurationUpdateData { + this := MetricTagConfigurationUpdateData{} + var typeVar MetricTagConfigurationType = METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MetricTagConfigurationUpdateData) GetAttributes() MetricTagConfigurationUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret MetricTagConfigurationUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricTagConfigurationUpdateData) GetAttributesOk() (*MetricTagConfigurationUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MetricTagConfigurationUpdateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given MetricTagConfigurationUpdateAttributes and assigns it to the Attributes field. +func (o *MetricTagConfigurationUpdateData) SetAttributes(v MetricTagConfigurationUpdateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *MetricTagConfigurationUpdateData) 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 *MetricTagConfigurationUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *MetricTagConfigurationUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *MetricTagConfigurationUpdateData) GetType() MetricTagConfigurationType { + if o == nil { + var ret MetricTagConfigurationType + 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 *MetricTagConfigurationUpdateData) GetTypeOk() (*MetricTagConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MetricTagConfigurationUpdateData) SetType(v MetricTagConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *MetricTagConfigurationType `json:"type"` + }{} + all := struct { + Attributes *MetricTagConfigurationUpdateAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Type MetricTagConfigurationType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_metric_tag_configuration_update_request.go b/api/v2/datadog/model_metric_tag_configuration_update_request.go new file mode 100644 index 00000000000..e344ea1e4c5 --- /dev/null +++ b/api/v2/datadog/model_metric_tag_configuration_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricTagConfigurationUpdateRequest Request object that includes the metric that you would like to edit the tag configuration on. +type MetricTagConfigurationUpdateRequest struct { + // Object for a single tag configuration to be edited. + Data MetricTagConfigurationUpdateData `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{} +} + +// NewMetricTagConfigurationUpdateRequest instantiates a new MetricTagConfigurationUpdateRequest 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 NewMetricTagConfigurationUpdateRequest(data MetricTagConfigurationUpdateData) *MetricTagConfigurationUpdateRequest { + this := MetricTagConfigurationUpdateRequest{} + this.Data = data + return &this +} + +// NewMetricTagConfigurationUpdateRequestWithDefaults instantiates a new MetricTagConfigurationUpdateRequest 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 NewMetricTagConfigurationUpdateRequestWithDefaults() *MetricTagConfigurationUpdateRequest { + this := MetricTagConfigurationUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *MetricTagConfigurationUpdateRequest) GetData() MetricTagConfigurationUpdateData { + if o == nil { + var ret MetricTagConfigurationUpdateData + 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 *MetricTagConfigurationUpdateRequest) GetDataOk() (*MetricTagConfigurationUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MetricTagConfigurationUpdateRequest) SetData(v MetricTagConfigurationUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricTagConfigurationUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricTagConfigurationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *MetricTagConfigurationUpdateData `json:"data"` + }{} + all := struct { + Data MetricTagConfigurationUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metric_type.go b/api/v2/datadog/model_metric_type.go new file mode 100644 index 00000000000..e9b410d123c --- /dev/null +++ b/api/v2/datadog/model_metric_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// MetricType The metric resource type. +type MetricType string + +// List of MetricType. +const ( + METRICTYPE_METRICS MetricType = "metrics" +) + +var allowedMetricTypeEnumValues = []MetricType{ + METRICTYPE_METRICS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MetricType) GetAllowedValues() []MetricType { + return allowedMetricTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MetricType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MetricType(value) + return nil +} + +// NewMetricTypeFromValue returns a pointer to a valid MetricType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMetricTypeFromValue(v string) (*MetricType, error) { + ev := MetricType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MetricType: valid values are %v", v, allowedMetricTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MetricType) IsValid() bool { + for _, existing := range allowedMetricTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetricType value. +func (v MetricType) Ptr() *MetricType { + return &v +} + +// NullableMetricType handles when a null is used for MetricType. +type NullableMetricType struct { + value *MetricType + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricType) Get() *MetricType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricType) Set(val *MetricType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableMetricType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricType initializes the struct as if Set has been called. +func NewNullableMetricType(val *MetricType) *NullableMetricType { + return &NullableMetricType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_volumes.go b/api/v2/datadog/model_metric_volumes.go new file mode 100644 index 00000000000..67ea5dada31 --- /dev/null +++ b/api/v2/datadog/model_metric_volumes.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricVolumes - Possible response objects for a metric's volume. +type MetricVolumes struct { + MetricDistinctVolume *MetricDistinctVolume + MetricIngestedIndexedVolume *MetricIngestedIndexedVolume + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// MetricDistinctVolumeAsMetricVolumes is a convenience function that returns MetricDistinctVolume wrapped in MetricVolumes. +func MetricDistinctVolumeAsMetricVolumes(v *MetricDistinctVolume) MetricVolumes { + return MetricVolumes{MetricDistinctVolume: v} +} + +// MetricIngestedIndexedVolumeAsMetricVolumes is a convenience function that returns MetricIngestedIndexedVolume wrapped in MetricVolumes. +func MetricIngestedIndexedVolumeAsMetricVolumes(v *MetricIngestedIndexedVolume) MetricVolumes { + return MetricVolumes{MetricIngestedIndexedVolume: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *MetricVolumes) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into MetricDistinctVolume + err = json.Unmarshal(data, &obj.MetricDistinctVolume) + if err == nil { + if obj.MetricDistinctVolume != nil && obj.MetricDistinctVolume.UnparsedObject == nil { + jsonMetricDistinctVolume, _ := json.Marshal(obj.MetricDistinctVolume) + if string(jsonMetricDistinctVolume) == "{}" { // empty struct + obj.MetricDistinctVolume = nil + } else { + match++ + } + } else { + obj.MetricDistinctVolume = nil + } + } else { + obj.MetricDistinctVolume = nil + } + + // try to unmarshal data into MetricIngestedIndexedVolume + err = json.Unmarshal(data, &obj.MetricIngestedIndexedVolume) + if err == nil { + if obj.MetricIngestedIndexedVolume != nil && obj.MetricIngestedIndexedVolume.UnparsedObject == nil { + jsonMetricIngestedIndexedVolume, _ := json.Marshal(obj.MetricIngestedIndexedVolume) + if string(jsonMetricIngestedIndexedVolume) == "{}" { // empty struct + obj.MetricIngestedIndexedVolume = nil + } else { + match++ + } + } else { + obj.MetricIngestedIndexedVolume = nil + } + } else { + obj.MetricIngestedIndexedVolume = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.MetricDistinctVolume = nil + obj.MetricIngestedIndexedVolume = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj MetricVolumes) MarshalJSON() ([]byte, error) { + if obj.MetricDistinctVolume != nil { + return json.Marshal(&obj.MetricDistinctVolume) + } + + if obj.MetricIngestedIndexedVolume != nil { + return json.Marshal(&obj.MetricIngestedIndexedVolume) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *MetricVolumes) GetActualInstance() interface{} { + if obj.MetricDistinctVolume != nil { + return obj.MetricDistinctVolume + } + + if obj.MetricIngestedIndexedVolume != nil { + return obj.MetricIngestedIndexedVolume + } + + // all schemas are nil + return nil +} + +// NullableMetricVolumes handles when a null is used for MetricVolumes. +type NullableMetricVolumes struct { + value *MetricVolumes + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricVolumes) Get() *MetricVolumes { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricVolumes) Set(val *MetricVolumes) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricVolumes) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableMetricVolumes) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricVolumes initializes the struct as if Set has been called. +func NewNullableMetricVolumes(val *MetricVolumes) *NullableMetricVolumes { + return &NullableMetricVolumes{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricVolumes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricVolumes) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metric_volumes_response.go b/api/v2/datadog/model_metric_volumes_response.go new file mode 100644 index 00000000000..fe5f51192d9 --- /dev/null +++ b/api/v2/datadog/model_metric_volumes_response.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 datadog + +import ( + "encoding/json" +) + +// MetricVolumesResponse Response object which includes a single metric's volume. +type MetricVolumesResponse struct { + // Possible response objects for a metric's volume. + Data *MetricVolumes `json:"data,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{} +} + +// NewMetricVolumesResponse instantiates a new MetricVolumesResponse 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 NewMetricVolumesResponse() *MetricVolumesResponse { + this := MetricVolumesResponse{} + return &this +} + +// NewMetricVolumesResponseWithDefaults instantiates a new MetricVolumesResponse 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 NewMetricVolumesResponseWithDefaults() *MetricVolumesResponse { + this := MetricVolumesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MetricVolumesResponse) GetData() MetricVolumes { + if o == nil || o.Data == nil { + var ret MetricVolumes + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricVolumesResponse) GetDataOk() (*MetricVolumes, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *MetricVolumesResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given MetricVolumes and assigns it to the Data field. +func (o *MetricVolumesResponse) SetData(v MetricVolumes) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricVolumesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricVolumesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *MetricVolumes `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_metrics_and_metric_tag_configurations.go b/api/v2/datadog/model_metrics_and_metric_tag_configurations.go new file mode 100644 index 00000000000..7d370f944fd --- /dev/null +++ b/api/v2/datadog/model_metrics_and_metric_tag_configurations.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MetricsAndMetricTagConfigurations - Object for a metrics and metric tag configurations. +type MetricsAndMetricTagConfigurations struct { + Metric *Metric + MetricTagConfiguration *MetricTagConfiguration + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// MetricAsMetricsAndMetricTagConfigurations is a convenience function that returns Metric wrapped in MetricsAndMetricTagConfigurations. +func MetricAsMetricsAndMetricTagConfigurations(v *Metric) MetricsAndMetricTagConfigurations { + return MetricsAndMetricTagConfigurations{Metric: v} +} + +// MetricTagConfigurationAsMetricsAndMetricTagConfigurations is a convenience function that returns MetricTagConfiguration wrapped in MetricsAndMetricTagConfigurations. +func MetricTagConfigurationAsMetricsAndMetricTagConfigurations(v *MetricTagConfiguration) MetricsAndMetricTagConfigurations { + return MetricsAndMetricTagConfigurations{MetricTagConfiguration: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *MetricsAndMetricTagConfigurations) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Metric + err = json.Unmarshal(data, &obj.Metric) + if err == nil { + if obj.Metric != nil && obj.Metric.UnparsedObject == nil { + jsonMetric, _ := json.Marshal(obj.Metric) + if string(jsonMetric) == "{}" { // empty struct + obj.Metric = nil + } else { + match++ + } + } else { + obj.Metric = nil + } + } else { + obj.Metric = nil + } + + // try to unmarshal data into MetricTagConfiguration + err = json.Unmarshal(data, &obj.MetricTagConfiguration) + if err == nil { + if obj.MetricTagConfiguration != nil && obj.MetricTagConfiguration.UnparsedObject == nil { + jsonMetricTagConfiguration, _ := json.Marshal(obj.MetricTagConfiguration) + if string(jsonMetricTagConfiguration) == "{}" { // empty struct + obj.MetricTagConfiguration = nil + } else { + match++ + } + } else { + obj.MetricTagConfiguration = nil + } + } else { + obj.MetricTagConfiguration = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.Metric = nil + obj.MetricTagConfiguration = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj MetricsAndMetricTagConfigurations) MarshalJSON() ([]byte, error) { + if obj.Metric != nil { + return json.Marshal(&obj.Metric) + } + + if obj.MetricTagConfiguration != nil { + return json.Marshal(&obj.MetricTagConfiguration) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *MetricsAndMetricTagConfigurations) GetActualInstance() interface{} { + if obj.Metric != nil { + return obj.Metric + } + + if obj.MetricTagConfiguration != nil { + return obj.MetricTagConfiguration + } + + // all schemas are nil + return nil +} + +// NullableMetricsAndMetricTagConfigurations handles when a null is used for MetricsAndMetricTagConfigurations. +type NullableMetricsAndMetricTagConfigurations struct { + value *MetricsAndMetricTagConfigurations + isSet bool +} + +// Get returns the associated value. +func (v NullableMetricsAndMetricTagConfigurations) Get() *MetricsAndMetricTagConfigurations { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMetricsAndMetricTagConfigurations) Set(val *MetricsAndMetricTagConfigurations) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMetricsAndMetricTagConfigurations) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableMetricsAndMetricTagConfigurations) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMetricsAndMetricTagConfigurations initializes the struct as if Set has been called. +func NewNullableMetricsAndMetricTagConfigurations(val *MetricsAndMetricTagConfigurations) *NullableMetricsAndMetricTagConfigurations { + return &NullableMetricsAndMetricTagConfigurations{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMetricsAndMetricTagConfigurations) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMetricsAndMetricTagConfigurations) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_metrics_and_metric_tag_configurations_response.go b/api/v2/datadog/model_metrics_and_metric_tag_configurations_response.go new file mode 100644 index 00000000000..db8204f5a4f --- /dev/null +++ b/api/v2/datadog/model_metrics_and_metric_tag_configurations_response.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 datadog + +import ( + "encoding/json" +) + +// MetricsAndMetricTagConfigurationsResponse Response object that includes metrics and metric tag configurations. +type MetricsAndMetricTagConfigurationsResponse struct { + // Array of metrics and metric tag configurations. + Data []MetricsAndMetricTagConfigurations `json:"data,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{} +} + +// NewMetricsAndMetricTagConfigurationsResponse instantiates a new MetricsAndMetricTagConfigurationsResponse 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 NewMetricsAndMetricTagConfigurationsResponse() *MetricsAndMetricTagConfigurationsResponse { + this := MetricsAndMetricTagConfigurationsResponse{} + return &this +} + +// NewMetricsAndMetricTagConfigurationsResponseWithDefaults instantiates a new MetricsAndMetricTagConfigurationsResponse 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 NewMetricsAndMetricTagConfigurationsResponseWithDefaults() *MetricsAndMetricTagConfigurationsResponse { + this := MetricsAndMetricTagConfigurationsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MetricsAndMetricTagConfigurationsResponse) GetData() []MetricsAndMetricTagConfigurations { + if o == nil || o.Data == nil { + var ret []MetricsAndMetricTagConfigurations + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetricsAndMetricTagConfigurationsResponse) GetDataOk() (*[]MetricsAndMetricTagConfigurations, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *MetricsAndMetricTagConfigurationsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []MetricsAndMetricTagConfigurations and assigns it to the Data field. +func (o *MetricsAndMetricTagConfigurationsResponse) SetData(v []MetricsAndMetricTagConfigurations) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MetricsAndMetricTagConfigurationsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MetricsAndMetricTagConfigurationsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []MetricsAndMetricTagConfigurations `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_monitor_type.go b/api/v2/datadog/model_monitor_type.go new file mode 100644 index 00000000000..76b407af12a --- /dev/null +++ b/api/v2/datadog/model_monitor_type.go @@ -0,0 +1,542 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// MonitorType Attributes from the monitor that triggered the event. +type MonitorType struct { + // The POSIX timestamp of the monitor's creation in nanoseconds. + CreatedAt *int32 `json:"created_at,omitempty"` + // Monitor group status used when there is no `result_groups`. + GroupStatus *int32 `json:"group_status,omitempty"` + // Groups to which the monitor belongs. + Groups []string `json:"groups,omitempty"` + // The monitor ID. + Id *int32 `json:"id,omitempty"` + // The monitor message. + Message *string `json:"message,omitempty"` + // The monitor's last-modified timestamp. + Modified *int32 `json:"modified,omitempty"` + // The monitor name. + Name *string `json:"name,omitempty"` + // The query that triggers the alert. + Query *string `json:"query,omitempty"` + // A list of tags attached to the monitor. + Tags []string `json:"tags,omitempty"` + // The templated name of the monitor before resolving any template variables. + TemplatedName *string `json:"templated_name,omitempty"` + // The monitor type. + Type *string `json:"type,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{} +} + +// NewMonitorType instantiates a new MonitorType 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 NewMonitorType() *MonitorType { + this := MonitorType{} + return &this +} + +// NewMonitorTypeWithDefaults instantiates a new MonitorType 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 NewMonitorTypeWithDefaults() *MonitorType { + this := MonitorType{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *MonitorType) GetCreatedAt() int32 { + if o == nil || o.CreatedAt == nil { + var ret int32 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetCreatedAtOk() (*int32, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *MonitorType) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int32 and assigns it to the CreatedAt field. +func (o *MonitorType) SetCreatedAt(v int32) { + o.CreatedAt = &v +} + +// GetGroupStatus returns the GroupStatus field value if set, zero value otherwise. +func (o *MonitorType) GetGroupStatus() int32 { + if o == nil || o.GroupStatus == nil { + var ret int32 + return ret + } + return *o.GroupStatus +} + +// GetGroupStatusOk returns a tuple with the GroupStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetGroupStatusOk() (*int32, bool) { + if o == nil || o.GroupStatus == nil { + return nil, false + } + return o.GroupStatus, true +} + +// HasGroupStatus returns a boolean if a field has been set. +func (o *MonitorType) HasGroupStatus() bool { + if o != nil && o.GroupStatus != nil { + return true + } + + return false +} + +// SetGroupStatus gets a reference to the given int32 and assigns it to the GroupStatus field. +func (o *MonitorType) SetGroupStatus(v int32) { + o.GroupStatus = &v +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *MonitorType) GetGroups() []string { + if o == nil || o.Groups == nil { + var ret []string + 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 *MonitorType) GetGroupsOk() (*[]string, 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 *MonitorType) HasGroups() bool { + if o != nil && o.Groups != nil { + return true + } + + return false +} + +// SetGroups gets a reference to the given []string and assigns it to the Groups field. +func (o *MonitorType) SetGroups(v []string) { + o.Groups = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MonitorType) GetId() int32 { + if o == nil || o.Id == nil { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetIdOk() (*int32, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MonitorType) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *MonitorType) SetId(v int32) { + o.Id = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *MonitorType) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *MonitorType) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *MonitorType) SetMessage(v string) { + o.Message = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *MonitorType) GetModified() int32 { + if o == nil || o.Modified == nil { + var ret int32 + return ret + } + return *o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetModifiedOk() (*int32, bool) { + if o == nil || o.Modified == nil { + return nil, false + } + return o.Modified, true +} + +// HasModified returns a boolean if a field has been set. +func (o *MonitorType) HasModified() bool { + if o != nil && o.Modified != nil { + return true + } + + return false +} + +// SetModified gets a reference to the given int32 and assigns it to the Modified field. +func (o *MonitorType) SetModified(v int32) { + o.Modified = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MonitorType) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MonitorType) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MonitorType) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *MonitorType) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *MonitorType) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *MonitorType) SetQuery(v string) { + o.Query = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MonitorType) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *MonitorType) GetTagsOk() (*[]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 *MonitorType) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MonitorType) SetTags(v []string) { + o.Tags = v +} + +// GetTemplatedName returns the TemplatedName field value if set, zero value otherwise. +func (o *MonitorType) GetTemplatedName() string { + if o == nil || o.TemplatedName == nil { + var ret string + return ret + } + return *o.TemplatedName +} + +// GetTemplatedNameOk returns a tuple with the TemplatedName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetTemplatedNameOk() (*string, bool) { + if o == nil || o.TemplatedName == nil { + return nil, false + } + return o.TemplatedName, true +} + +// HasTemplatedName returns a boolean if a field has been set. +func (o *MonitorType) HasTemplatedName() bool { + if o != nil && o.TemplatedName != nil { + return true + } + + return false +} + +// SetTemplatedName gets a reference to the given string and assigns it to the TemplatedName field. +func (o *MonitorType) SetTemplatedName(v string) { + o.TemplatedName = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MonitorType) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorType) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MonitorType) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *MonitorType) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorType) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.GroupStatus != nil { + toSerialize["group_status"] = o.GroupStatus + } + if o.Groups != nil { + toSerialize["groups"] = o.Groups + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Modified != nil { + toSerialize["modified"] = o.Modified + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.TemplatedName != nil { + toSerialize["templated_name"] = o.TemplatedName + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorType) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *int32 `json:"created_at,omitempty"` + GroupStatus *int32 `json:"group_status,omitempty"` + Groups []string `json:"groups,omitempty"` + Id *int32 `json:"id,omitempty"` + Message *string `json:"message,omitempty"` + Modified *int32 `json:"modified,omitempty"` + Name *string `json:"name,omitempty"` + Query *string `json:"query,omitempty"` + Tags []string `json:"tags,omitempty"` + TemplatedName *string `json:"templated_name,omitempty"` + Type *string `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.GroupStatus = all.GroupStatus + o.Groups = all.Groups + o.Id = all.Id + o.Message = all.Message + o.Modified = all.Modified + o.Name = all.Name + o.Query = all.Query + o.Tags = all.Tags + o.TemplatedName = all.TemplatedName + o.Type = all.Type + return nil +} + +// NullableMonitorType handles when a null is used for MonitorType. +type NullableMonitorType struct { + value *MonitorType + isSet bool +} + +// Get returns the associated value. +func (v NullableMonitorType) Get() *MonitorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableMonitorType) Set(val *MonitorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableMonitorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableMonitorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableMonitorType initializes the struct as if Set has been called. +func NewNullableMonitorType(val *MonitorType) *NullableMonitorType { + return &NullableMonitorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableMonitorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableMonitorType) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_nullable_relationship_to_user.go b/api/v2/datadog/model_nullable_relationship_to_user.go new file mode 100644 index 00000000000..16359626482 --- /dev/null +++ b/api/v2/datadog/model_nullable_relationship_to_user.go @@ -0,0 +1,105 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NullableRelationshipToUser Relationship to user. +type NullableRelationshipToUser struct { + // Relationship to user object. + Data NullableNullableRelationshipToUserData `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{} +} + +// NewNullableRelationshipToUser instantiates a new NullableRelationshipToUser 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 NewNullableRelationshipToUser(data NullableNullableRelationshipToUserData) *NullableRelationshipToUser { + this := NullableRelationshipToUser{} + this.Data = data + return &this +} + +// NewNullableRelationshipToUserWithDefaults instantiates a new NullableRelationshipToUser 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 NewNullableRelationshipToUserWithDefaults() *NullableRelationshipToUser { + this := NullableRelationshipToUser{} + return &this +} + +// GetData returns the Data field value. +// If the value is explicit nil, the zero value for NullableRelationshipToUserData will be returned. +func (o *NullableRelationshipToUser) GetData() NullableRelationshipToUserData { + if o == nil || o.Data.Get() == nil { + var ret NullableRelationshipToUserData + return ret + } + return *o.Data.Get() +} + +// GetDataOk returns a tuple with the Data field value +// 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 *NullableRelationshipToUser) GetDataOk() (*NullableRelationshipToUserData, bool) { + if o == nil { + return nil, false + } + return o.Data.Get(), o.Data.IsSet() +} + +// SetData sets field value. +func (o *NullableRelationshipToUser) SetData(v NullableRelationshipToUserData) { + o.Data.Set(&v) +} + +// MarshalJSON serializes the struct using spec logic. +func (o NullableRelationshipToUser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data.Get() + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NullableRelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data NullableNullableRelationshipToUserData `json:"data"` + }{} + all := struct { + Data NullableNullableRelationshipToUserData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if !required.Data.IsSet() { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_nullable_relationship_to_user_data.go b/api/v2/datadog/model_nullable_relationship_to_user_data.go new file mode 100644 index 00000000000..e5cbd09d960 --- /dev/null +++ b/api/v2/datadog/model_nullable_relationship_to_user_data.go @@ -0,0 +1,196 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// NullableRelationshipToUserData Relationship to user object. +type NullableRelationshipToUserData struct { + // A unique identifier that represents the user. + Id string `json:"id"` + // Users resource type. + Type UsersType `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{} +} + +// NewNullableRelationshipToUserData instantiates a new NullableRelationshipToUserData 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 NewNullableRelationshipToUserData(id string, typeVar UsersType) *NullableRelationshipToUserData { + this := NullableRelationshipToUserData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewNullableRelationshipToUserDataWithDefaults instantiates a new NullableRelationshipToUserData 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 NewNullableRelationshipToUserDataWithDefaults() *NullableRelationshipToUserData { + this := NullableRelationshipToUserData{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *NullableRelationshipToUserData) 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 *NullableRelationshipToUserData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *NullableRelationshipToUserData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *NullableRelationshipToUserData) GetType() UsersType { + if o == nil { + var ret UsersType + 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 *NullableRelationshipToUserData) GetTypeOk() (*UsersType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *NullableRelationshipToUserData) SetType(v UsersType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o NullableRelationshipToUserData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *NullableRelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *UsersType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type UsersType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} + +// NullableNullableRelationshipToUserData handles when a null is used for NullableRelationshipToUserData. +type NullableNullableRelationshipToUserData struct { + value *NullableRelationshipToUserData + isSet bool +} + +// Get returns the associated value. +func (v NullableNullableRelationshipToUserData) Get() *NullableRelationshipToUserData { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableNullableRelationshipToUserData) Set(val *NullableRelationshipToUserData) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableNullableRelationshipToUserData) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableNullableRelationshipToUserData) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableNullableRelationshipToUserData initializes the struct as if Set has been called. +func NewNullableNullableRelationshipToUserData(val *NullableRelationshipToUserData) *NullableNullableRelationshipToUserData { + return &NullableNullableRelationshipToUserData{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableNullableRelationshipToUserData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableNullableRelationshipToUserData) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_opsgenie_service_create_attributes.go b/api/v2/datadog/model_opsgenie_service_create_attributes.go new file mode 100644 index 00000000000..f6048d7d478 --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_create_attributes.go @@ -0,0 +1,216 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceCreateAttributes The Opsgenie service attributes for a create request. +type OpsgenieServiceCreateAttributes struct { + // The custom URL for a custom region. + CustomUrl *string `json:"custom_url,omitempty"` + // The name for the Opsgenie service. + Name string `json:"name"` + // The Opsgenie API key for your Opsgenie service. + OpsgenieApiKey string `json:"opsgenie_api_key"` + // The region for the Opsgenie service. + Region OpsgenieServiceRegionType `json:"region"` + // 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{} +} + +// NewOpsgenieServiceCreateAttributes instantiates a new OpsgenieServiceCreateAttributes 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 NewOpsgenieServiceCreateAttributes(name string, opsgenieApiKey string, region OpsgenieServiceRegionType) *OpsgenieServiceCreateAttributes { + this := OpsgenieServiceCreateAttributes{} + this.Name = name + this.OpsgenieApiKey = opsgenieApiKey + this.Region = region + return &this +} + +// NewOpsgenieServiceCreateAttributesWithDefaults instantiates a new OpsgenieServiceCreateAttributes 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 NewOpsgenieServiceCreateAttributesWithDefaults() *OpsgenieServiceCreateAttributes { + this := OpsgenieServiceCreateAttributes{} + return &this +} + +// GetCustomUrl returns the CustomUrl field value if set, zero value otherwise. +func (o *OpsgenieServiceCreateAttributes) GetCustomUrl() string { + if o == nil || o.CustomUrl == nil { + var ret string + return ret + } + return *o.CustomUrl +} + +// GetCustomUrlOk returns a tuple with the CustomUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceCreateAttributes) GetCustomUrlOk() (*string, bool) { + if o == nil || o.CustomUrl == nil { + return nil, false + } + return o.CustomUrl, true +} + +// HasCustomUrl returns a boolean if a field has been set. +func (o *OpsgenieServiceCreateAttributes) HasCustomUrl() bool { + if o != nil && o.CustomUrl != nil { + return true + } + + return false +} + +// SetCustomUrl gets a reference to the given string and assigns it to the CustomUrl field. +func (o *OpsgenieServiceCreateAttributes) SetCustomUrl(v string) { + o.CustomUrl = &v +} + +// GetName returns the Name field value. +func (o *OpsgenieServiceCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *OpsgenieServiceCreateAttributes) SetName(v string) { + o.Name = v +} + +// GetOpsgenieApiKey returns the OpsgenieApiKey field value. +func (o *OpsgenieServiceCreateAttributes) GetOpsgenieApiKey() string { + if o == nil { + var ret string + return ret + } + return o.OpsgenieApiKey +} + +// GetOpsgenieApiKeyOk returns a tuple with the OpsgenieApiKey field value +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceCreateAttributes) GetOpsgenieApiKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OpsgenieApiKey, true +} + +// SetOpsgenieApiKey sets field value. +func (o *OpsgenieServiceCreateAttributes) SetOpsgenieApiKey(v string) { + o.OpsgenieApiKey = v +} + +// GetRegion returns the Region field value. +func (o *OpsgenieServiceCreateAttributes) GetRegion() OpsgenieServiceRegionType { + if o == nil { + var ret OpsgenieServiceRegionType + return ret + } + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceCreateAttributes) GetRegionOk() (*OpsgenieServiceRegionType, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value. +func (o *OpsgenieServiceCreateAttributes) SetRegion(v OpsgenieServiceRegionType) { + o.Region = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomUrl != nil { + toSerialize["custom_url"] = o.CustomUrl + } + toSerialize["name"] = o.Name + toSerialize["opsgenie_api_key"] = o.OpsgenieApiKey + toSerialize["region"] = o.Region + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + OpsgenieApiKey *string `json:"opsgenie_api_key"` + Region *OpsgenieServiceRegionType `json:"region"` + }{} + all := struct { + CustomUrl *string `json:"custom_url,omitempty"` + Name string `json:"name"` + OpsgenieApiKey string `json:"opsgenie_api_key"` + Region OpsgenieServiceRegionType `json:"region"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.OpsgenieApiKey == nil { + return fmt.Errorf("Required field opsgenie_api_key missing") + } + if required.Region == nil { + return fmt.Errorf("Required field region missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Region; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomUrl = all.CustomUrl + o.Name = all.Name + o.OpsgenieApiKey = all.OpsgenieApiKey + o.Region = all.Region + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_create_data.go b/api/v2/datadog/model_opsgenie_service_create_data.go new file mode 100644 index 00000000000..19908a950ff --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_create_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceCreateData Opsgenie service data for a create request. +type OpsgenieServiceCreateData struct { + // The Opsgenie service attributes for a create request. + Attributes OpsgenieServiceCreateAttributes `json:"attributes"` + // Opsgenie service resource type. + Type OpsgenieServiceType `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{} +} + +// NewOpsgenieServiceCreateData instantiates a new OpsgenieServiceCreateData 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 NewOpsgenieServiceCreateData(attributes OpsgenieServiceCreateAttributes, typeVar OpsgenieServiceType) *OpsgenieServiceCreateData { + this := OpsgenieServiceCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewOpsgenieServiceCreateDataWithDefaults instantiates a new OpsgenieServiceCreateData 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 NewOpsgenieServiceCreateDataWithDefaults() *OpsgenieServiceCreateData { + this := OpsgenieServiceCreateData{} + var typeVar OpsgenieServiceType = OPSGENIESERVICETYPE_OPSGENIE_SERVICE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *OpsgenieServiceCreateData) GetAttributes() OpsgenieServiceCreateAttributes { + if o == nil { + var ret OpsgenieServiceCreateAttributes + 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 *OpsgenieServiceCreateData) GetAttributesOk() (*OpsgenieServiceCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *OpsgenieServiceCreateData) SetAttributes(v OpsgenieServiceCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *OpsgenieServiceCreateData) GetType() OpsgenieServiceType { + if o == nil { + var ret OpsgenieServiceType + 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 *OpsgenieServiceCreateData) GetTypeOk() (*OpsgenieServiceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *OpsgenieServiceCreateData) SetType(v OpsgenieServiceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *OpsgenieServiceCreateAttributes `json:"attributes"` + Type *OpsgenieServiceType `json:"type"` + }{} + all := struct { + Attributes OpsgenieServiceCreateAttributes `json:"attributes"` + Type OpsgenieServiceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_create_request.go b/api/v2/datadog/model_opsgenie_service_create_request.go new file mode 100644 index 00000000000..208ee0bb388 --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceCreateRequest Create request for an Opsgenie service. +type OpsgenieServiceCreateRequest struct { + // Opsgenie service data for a create request. + Data OpsgenieServiceCreateData `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{} +} + +// NewOpsgenieServiceCreateRequest instantiates a new OpsgenieServiceCreateRequest 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 NewOpsgenieServiceCreateRequest(data OpsgenieServiceCreateData) *OpsgenieServiceCreateRequest { + this := OpsgenieServiceCreateRequest{} + this.Data = data + return &this +} + +// NewOpsgenieServiceCreateRequestWithDefaults instantiates a new OpsgenieServiceCreateRequest 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 NewOpsgenieServiceCreateRequestWithDefaults() *OpsgenieServiceCreateRequest { + this := OpsgenieServiceCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *OpsgenieServiceCreateRequest) GetData() OpsgenieServiceCreateData { + if o == nil { + var ret OpsgenieServiceCreateData + 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 *OpsgenieServiceCreateRequest) GetDataOk() (*OpsgenieServiceCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *OpsgenieServiceCreateRequest) SetData(v OpsgenieServiceCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *OpsgenieServiceCreateData `json:"data"` + }{} + all := struct { + Data OpsgenieServiceCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_region_type.go b/api/v2/datadog/model_opsgenie_service_region_type.go new file mode 100644 index 00000000000..dfd7db57d9c --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_region_type.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceRegionType The region for the Opsgenie service. +type OpsgenieServiceRegionType string + +// List of OpsgenieServiceRegionType. +const ( + OPSGENIESERVICEREGIONTYPE_US OpsgenieServiceRegionType = "us" + OPSGENIESERVICEREGIONTYPE_EU OpsgenieServiceRegionType = "eu" + OPSGENIESERVICEREGIONTYPE_CUSTOM OpsgenieServiceRegionType = "custom" +) + +var allowedOpsgenieServiceRegionTypeEnumValues = []OpsgenieServiceRegionType{ + OPSGENIESERVICEREGIONTYPE_US, + OPSGENIESERVICEREGIONTYPE_EU, + OPSGENIESERVICEREGIONTYPE_CUSTOM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OpsgenieServiceRegionType) GetAllowedValues() []OpsgenieServiceRegionType { + return allowedOpsgenieServiceRegionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OpsgenieServiceRegionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OpsgenieServiceRegionType(value) + return nil +} + +// NewOpsgenieServiceRegionTypeFromValue returns a pointer to a valid OpsgenieServiceRegionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOpsgenieServiceRegionTypeFromValue(v string) (*OpsgenieServiceRegionType, error) { + ev := OpsgenieServiceRegionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OpsgenieServiceRegionType: valid values are %v", v, allowedOpsgenieServiceRegionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OpsgenieServiceRegionType) IsValid() bool { + for _, existing := range allowedOpsgenieServiceRegionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OpsgenieServiceRegionType value. +func (v OpsgenieServiceRegionType) Ptr() *OpsgenieServiceRegionType { + return &v +} + +// NullableOpsgenieServiceRegionType handles when a null is used for OpsgenieServiceRegionType. +type NullableOpsgenieServiceRegionType struct { + value *OpsgenieServiceRegionType + isSet bool +} + +// Get returns the associated value. +func (v NullableOpsgenieServiceRegionType) Get() *OpsgenieServiceRegionType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableOpsgenieServiceRegionType) Set(val *OpsgenieServiceRegionType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableOpsgenieServiceRegionType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableOpsgenieServiceRegionType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableOpsgenieServiceRegionType initializes the struct as if Set has been called. +func NewNullableOpsgenieServiceRegionType(val *OpsgenieServiceRegionType) *NullableOpsgenieServiceRegionType { + return &NullableOpsgenieServiceRegionType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableOpsgenieServiceRegionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableOpsgenieServiceRegionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_opsgenie_service_response.go b/api/v2/datadog/model_opsgenie_service_response.go new file mode 100644 index 00000000000..3d94b5a6421 --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceResponse Response of an Opsgenie service. +type OpsgenieServiceResponse struct { + // Opsgenie service data from a response. + Data OpsgenieServiceResponseData `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{} +} + +// NewOpsgenieServiceResponse instantiates a new OpsgenieServiceResponse 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 NewOpsgenieServiceResponse(data OpsgenieServiceResponseData) *OpsgenieServiceResponse { + this := OpsgenieServiceResponse{} + this.Data = data + return &this +} + +// NewOpsgenieServiceResponseWithDefaults instantiates a new OpsgenieServiceResponse 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 NewOpsgenieServiceResponseWithDefaults() *OpsgenieServiceResponse { + this := OpsgenieServiceResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *OpsgenieServiceResponse) GetData() OpsgenieServiceResponseData { + if o == nil { + var ret OpsgenieServiceResponseData + 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 *OpsgenieServiceResponse) GetDataOk() (*OpsgenieServiceResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *OpsgenieServiceResponse) SetData(v OpsgenieServiceResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *OpsgenieServiceResponseData `json:"data"` + }{} + all := struct { + Data OpsgenieServiceResponseData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_response_attributes.go b/api/v2/datadog/model_opsgenie_service_response_attributes.go new file mode 100644 index 00000000000..8675085df7d --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_response_attributes.go @@ -0,0 +1,201 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// OpsgenieServiceResponseAttributes The attributes from an Opsgenie service response. +type OpsgenieServiceResponseAttributes struct { + // The custom URL for a custom region. + CustomUrl common.NullableString `json:"custom_url,omitempty"` + // The name for the Opsgenie service. + Name *string `json:"name,omitempty"` + // The region for the Opsgenie service. + Region *OpsgenieServiceRegionType `json:"region,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{} +} + +// NewOpsgenieServiceResponseAttributes instantiates a new OpsgenieServiceResponseAttributes 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 NewOpsgenieServiceResponseAttributes() *OpsgenieServiceResponseAttributes { + this := OpsgenieServiceResponseAttributes{} + return &this +} + +// NewOpsgenieServiceResponseAttributesWithDefaults instantiates a new OpsgenieServiceResponseAttributes 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 NewOpsgenieServiceResponseAttributesWithDefaults() *OpsgenieServiceResponseAttributes { + this := OpsgenieServiceResponseAttributes{} + return &this +} + +// GetCustomUrl returns the CustomUrl field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *OpsgenieServiceResponseAttributes) GetCustomUrl() string { + if o == nil || o.CustomUrl.Get() == nil { + var ret string + return ret + } + return *o.CustomUrl.Get() +} + +// GetCustomUrlOk returns a tuple with the CustomUrl 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 *OpsgenieServiceResponseAttributes) GetCustomUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CustomUrl.Get(), o.CustomUrl.IsSet() +} + +// HasCustomUrl returns a boolean if a field has been set. +func (o *OpsgenieServiceResponseAttributes) HasCustomUrl() bool { + if o != nil && o.CustomUrl.IsSet() { + return true + } + + return false +} + +// SetCustomUrl gets a reference to the given common.NullableString and assigns it to the CustomUrl field. +func (o *OpsgenieServiceResponseAttributes) SetCustomUrl(v string) { + o.CustomUrl.Set(&v) +} + +// SetCustomUrlNil sets the value for CustomUrl to be an explicit nil. +func (o *OpsgenieServiceResponseAttributes) SetCustomUrlNil() { + o.CustomUrl.Set(nil) +} + +// UnsetCustomUrl ensures that no value is present for CustomUrl, not even an explicit nil. +func (o *OpsgenieServiceResponseAttributes) UnsetCustomUrl() { + o.CustomUrl.Unset() +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *OpsgenieServiceResponseAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceResponseAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *OpsgenieServiceResponseAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *OpsgenieServiceResponseAttributes) SetName(v string) { + o.Name = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *OpsgenieServiceResponseAttributes) GetRegion() OpsgenieServiceRegionType { + if o == nil || o.Region == nil { + var ret OpsgenieServiceRegionType + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceResponseAttributes) GetRegionOk() (*OpsgenieServiceRegionType, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *OpsgenieServiceResponseAttributes) HasRegion() bool { + if o != nil && o.Region != nil { + return true + } + + return false +} + +// SetRegion gets a reference to the given OpsgenieServiceRegionType and assigns it to the Region field. +func (o *OpsgenieServiceResponseAttributes) SetRegion(v OpsgenieServiceRegionType) { + o.Region = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomUrl.IsSet() { + toSerialize["custom_url"] = o.CustomUrl.Get() + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CustomUrl common.NullableString `json:"custom_url,omitempty"` + Name *string `json:"name,omitempty"` + Region *OpsgenieServiceRegionType `json:"region,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Region; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomUrl = all.CustomUrl + o.Name = all.Name + o.Region = all.Region + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_response_data.go b/api/v2/datadog/model_opsgenie_service_response_data.go new file mode 100644 index 00000000000..f44165d2b7d --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_response_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceResponseData Opsgenie service data from a response. +type OpsgenieServiceResponseData struct { + // The attributes from an Opsgenie service response. + Attributes OpsgenieServiceResponseAttributes `json:"attributes"` + // The ID of the Opsgenie service. + Id string `json:"id"` + // Opsgenie service resource type. + Type OpsgenieServiceType `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{} +} + +// NewOpsgenieServiceResponseData instantiates a new OpsgenieServiceResponseData 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 NewOpsgenieServiceResponseData(attributes OpsgenieServiceResponseAttributes, id string, typeVar OpsgenieServiceType) *OpsgenieServiceResponseData { + this := OpsgenieServiceResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewOpsgenieServiceResponseDataWithDefaults instantiates a new OpsgenieServiceResponseData 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 NewOpsgenieServiceResponseDataWithDefaults() *OpsgenieServiceResponseData { + this := OpsgenieServiceResponseData{} + var typeVar OpsgenieServiceType = OPSGENIESERVICETYPE_OPSGENIE_SERVICE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *OpsgenieServiceResponseData) GetAttributes() OpsgenieServiceResponseAttributes { + if o == nil { + var ret OpsgenieServiceResponseAttributes + 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 *OpsgenieServiceResponseData) GetAttributesOk() (*OpsgenieServiceResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *OpsgenieServiceResponseData) SetAttributes(v OpsgenieServiceResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *OpsgenieServiceResponseData) 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 *OpsgenieServiceResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *OpsgenieServiceResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *OpsgenieServiceResponseData) GetType() OpsgenieServiceType { + if o == nil { + var ret OpsgenieServiceType + 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 *OpsgenieServiceResponseData) GetTypeOk() (*OpsgenieServiceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *OpsgenieServiceResponseData) SetType(v OpsgenieServiceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *OpsgenieServiceResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *OpsgenieServiceType `json:"type"` + }{} + all := struct { + Attributes OpsgenieServiceResponseAttributes `json:"attributes"` + Id string `json:"id"` + Type OpsgenieServiceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_type.go b/api/v2/datadog/model_opsgenie_service_type.go new file mode 100644 index 00000000000..457177cc582 --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceType Opsgenie service resource type. +type OpsgenieServiceType string + +// List of OpsgenieServiceType. +const ( + OPSGENIESERVICETYPE_OPSGENIE_SERVICE OpsgenieServiceType = "opsgenie-service" +) + +var allowedOpsgenieServiceTypeEnumValues = []OpsgenieServiceType{ + OPSGENIESERVICETYPE_OPSGENIE_SERVICE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OpsgenieServiceType) GetAllowedValues() []OpsgenieServiceType { + return allowedOpsgenieServiceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OpsgenieServiceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OpsgenieServiceType(value) + return nil +} + +// NewOpsgenieServiceTypeFromValue returns a pointer to a valid OpsgenieServiceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOpsgenieServiceTypeFromValue(v string) (*OpsgenieServiceType, error) { + ev := OpsgenieServiceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OpsgenieServiceType: valid values are %v", v, allowedOpsgenieServiceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OpsgenieServiceType) IsValid() bool { + for _, existing := range allowedOpsgenieServiceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OpsgenieServiceType value. +func (v OpsgenieServiceType) Ptr() *OpsgenieServiceType { + return &v +} + +// NullableOpsgenieServiceType handles when a null is used for OpsgenieServiceType. +type NullableOpsgenieServiceType struct { + value *OpsgenieServiceType + isSet bool +} + +// Get returns the associated value. +func (v NullableOpsgenieServiceType) Get() *OpsgenieServiceType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableOpsgenieServiceType) Set(val *OpsgenieServiceType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableOpsgenieServiceType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableOpsgenieServiceType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableOpsgenieServiceType initializes the struct as if Set has been called. +func NewNullableOpsgenieServiceType(val *OpsgenieServiceType) *NullableOpsgenieServiceType { + return &NullableOpsgenieServiceType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableOpsgenieServiceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableOpsgenieServiceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_opsgenie_service_update_attributes.go b/api/v2/datadog/model_opsgenie_service_update_attributes.go new file mode 100644 index 00000000000..54476609e4e --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_update_attributes.go @@ -0,0 +1,240 @@ +// 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 datadog + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// OpsgenieServiceUpdateAttributes The Opsgenie service attributes for an update request. +type OpsgenieServiceUpdateAttributes struct { + // The custom URL for a custom region. + CustomUrl common.NullableString `json:"custom_url,omitempty"` + // The name for the Opsgenie service. + Name *string `json:"name,omitempty"` + // The Opsgenie API key for your Opsgenie service. + OpsgenieApiKey *string `json:"opsgenie_api_key,omitempty"` + // The region for the Opsgenie service. + Region *OpsgenieServiceRegionType `json:"region,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{} +} + +// NewOpsgenieServiceUpdateAttributes instantiates a new OpsgenieServiceUpdateAttributes 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 NewOpsgenieServiceUpdateAttributes() *OpsgenieServiceUpdateAttributes { + this := OpsgenieServiceUpdateAttributes{} + return &this +} + +// NewOpsgenieServiceUpdateAttributesWithDefaults instantiates a new OpsgenieServiceUpdateAttributes 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 NewOpsgenieServiceUpdateAttributesWithDefaults() *OpsgenieServiceUpdateAttributes { + this := OpsgenieServiceUpdateAttributes{} + return &this +} + +// GetCustomUrl returns the CustomUrl field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *OpsgenieServiceUpdateAttributes) GetCustomUrl() string { + if o == nil || o.CustomUrl.Get() == nil { + var ret string + return ret + } + return *o.CustomUrl.Get() +} + +// GetCustomUrlOk returns a tuple with the CustomUrl 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 *OpsgenieServiceUpdateAttributes) GetCustomUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CustomUrl.Get(), o.CustomUrl.IsSet() +} + +// HasCustomUrl returns a boolean if a field has been set. +func (o *OpsgenieServiceUpdateAttributes) HasCustomUrl() bool { + if o != nil && o.CustomUrl.IsSet() { + return true + } + + return false +} + +// SetCustomUrl gets a reference to the given common.NullableString and assigns it to the CustomUrl field. +func (o *OpsgenieServiceUpdateAttributes) SetCustomUrl(v string) { + o.CustomUrl.Set(&v) +} + +// SetCustomUrlNil sets the value for CustomUrl to be an explicit nil. +func (o *OpsgenieServiceUpdateAttributes) SetCustomUrlNil() { + o.CustomUrl.Set(nil) +} + +// UnsetCustomUrl ensures that no value is present for CustomUrl, not even an explicit nil. +func (o *OpsgenieServiceUpdateAttributes) UnsetCustomUrl() { + o.CustomUrl.Unset() +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *OpsgenieServiceUpdateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *OpsgenieServiceUpdateAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *OpsgenieServiceUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// GetOpsgenieApiKey returns the OpsgenieApiKey field value if set, zero value otherwise. +func (o *OpsgenieServiceUpdateAttributes) GetOpsgenieApiKey() string { + if o == nil || o.OpsgenieApiKey == nil { + var ret string + return ret + } + return *o.OpsgenieApiKey +} + +// GetOpsgenieApiKeyOk returns a tuple with the OpsgenieApiKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceUpdateAttributes) GetOpsgenieApiKeyOk() (*string, bool) { + if o == nil || o.OpsgenieApiKey == nil { + return nil, false + } + return o.OpsgenieApiKey, true +} + +// HasOpsgenieApiKey returns a boolean if a field has been set. +func (o *OpsgenieServiceUpdateAttributes) HasOpsgenieApiKey() bool { + if o != nil && o.OpsgenieApiKey != nil { + return true + } + + return false +} + +// SetOpsgenieApiKey gets a reference to the given string and assigns it to the OpsgenieApiKey field. +func (o *OpsgenieServiceUpdateAttributes) SetOpsgenieApiKey(v string) { + o.OpsgenieApiKey = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *OpsgenieServiceUpdateAttributes) GetRegion() OpsgenieServiceRegionType { + if o == nil || o.Region == nil { + var ret OpsgenieServiceRegionType + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OpsgenieServiceUpdateAttributes) GetRegionOk() (*OpsgenieServiceRegionType, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *OpsgenieServiceUpdateAttributes) HasRegion() bool { + if o != nil && o.Region != nil { + return true + } + + return false +} + +// SetRegion gets a reference to the given OpsgenieServiceRegionType and assigns it to the Region field. +func (o *OpsgenieServiceUpdateAttributes) SetRegion(v OpsgenieServiceRegionType) { + o.Region = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CustomUrl.IsSet() { + toSerialize["custom_url"] = o.CustomUrl.Get() + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OpsgenieApiKey != nil { + toSerialize["opsgenie_api_key"] = o.OpsgenieApiKey + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CustomUrl common.NullableString `json:"custom_url,omitempty"` + Name *string `json:"name,omitempty"` + OpsgenieApiKey *string `json:"opsgenie_api_key,omitempty"` + Region *OpsgenieServiceRegionType `json:"region,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Region; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CustomUrl = all.CustomUrl + o.Name = all.Name + o.OpsgenieApiKey = all.OpsgenieApiKey + o.Region = all.Region + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_update_data.go b/api/v2/datadog/model_opsgenie_service_update_data.go new file mode 100644 index 00000000000..455e81d528a --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_update_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceUpdateData Opsgenie service for an update request. +type OpsgenieServiceUpdateData struct { + // The Opsgenie service attributes for an update request. + Attributes OpsgenieServiceUpdateAttributes `json:"attributes"` + // The ID of the Opsgenie service. + Id string `json:"id"` + // Opsgenie service resource type. + Type OpsgenieServiceType `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{} +} + +// NewOpsgenieServiceUpdateData instantiates a new OpsgenieServiceUpdateData 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 NewOpsgenieServiceUpdateData(attributes OpsgenieServiceUpdateAttributes, id string, typeVar OpsgenieServiceType) *OpsgenieServiceUpdateData { + this := OpsgenieServiceUpdateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewOpsgenieServiceUpdateDataWithDefaults instantiates a new OpsgenieServiceUpdateData 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 NewOpsgenieServiceUpdateDataWithDefaults() *OpsgenieServiceUpdateData { + this := OpsgenieServiceUpdateData{} + var typeVar OpsgenieServiceType = OPSGENIESERVICETYPE_OPSGENIE_SERVICE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *OpsgenieServiceUpdateData) GetAttributes() OpsgenieServiceUpdateAttributes { + if o == nil { + var ret OpsgenieServiceUpdateAttributes + 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 *OpsgenieServiceUpdateData) GetAttributesOk() (*OpsgenieServiceUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *OpsgenieServiceUpdateData) SetAttributes(v OpsgenieServiceUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *OpsgenieServiceUpdateData) 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 *OpsgenieServiceUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *OpsgenieServiceUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *OpsgenieServiceUpdateData) GetType() OpsgenieServiceType { + if o == nil { + var ret OpsgenieServiceType + 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 *OpsgenieServiceUpdateData) GetTypeOk() (*OpsgenieServiceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *OpsgenieServiceUpdateData) SetType(v OpsgenieServiceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *OpsgenieServiceUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *OpsgenieServiceType `json:"type"` + }{} + all := struct { + Attributes OpsgenieServiceUpdateAttributes `json:"attributes"` + Id string `json:"id"` + Type OpsgenieServiceType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_opsgenie_service_update_request.go b/api/v2/datadog/model_opsgenie_service_update_request.go new file mode 100644 index 00000000000..9690b551813 --- /dev/null +++ b/api/v2/datadog/model_opsgenie_service_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServiceUpdateRequest Update request for an Opsgenie service. +type OpsgenieServiceUpdateRequest struct { + // Opsgenie service for an update request. + Data OpsgenieServiceUpdateData `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{} +} + +// NewOpsgenieServiceUpdateRequest instantiates a new OpsgenieServiceUpdateRequest 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 NewOpsgenieServiceUpdateRequest(data OpsgenieServiceUpdateData) *OpsgenieServiceUpdateRequest { + this := OpsgenieServiceUpdateRequest{} + this.Data = data + return &this +} + +// NewOpsgenieServiceUpdateRequestWithDefaults instantiates a new OpsgenieServiceUpdateRequest 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 NewOpsgenieServiceUpdateRequestWithDefaults() *OpsgenieServiceUpdateRequest { + this := OpsgenieServiceUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *OpsgenieServiceUpdateRequest) GetData() OpsgenieServiceUpdateData { + if o == nil { + var ret OpsgenieServiceUpdateData + 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 *OpsgenieServiceUpdateRequest) GetDataOk() (*OpsgenieServiceUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *OpsgenieServiceUpdateRequest) SetData(v OpsgenieServiceUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServiceUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *OpsgenieServiceUpdateData `json:"data"` + }{} + all := struct { + Data OpsgenieServiceUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_opsgenie_services_response.go b/api/v2/datadog/model_opsgenie_services_response.go new file mode 100644 index 00000000000..6de00e4b122 --- /dev/null +++ b/api/v2/datadog/model_opsgenie_services_response.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OpsgenieServicesResponse Response with a list of Opsgenie services. +type OpsgenieServicesResponse struct { + // An array of Opsgenie services. + Data []OpsgenieServiceResponseData `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{} +} + +// NewOpsgenieServicesResponse instantiates a new OpsgenieServicesResponse 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 NewOpsgenieServicesResponse(data []OpsgenieServiceResponseData) *OpsgenieServicesResponse { + this := OpsgenieServicesResponse{} + this.Data = data + return &this +} + +// NewOpsgenieServicesResponseWithDefaults instantiates a new OpsgenieServicesResponse 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 NewOpsgenieServicesResponseWithDefaults() *OpsgenieServicesResponse { + this := OpsgenieServicesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *OpsgenieServicesResponse) GetData() []OpsgenieServiceResponseData { + if o == nil { + var ret []OpsgenieServiceResponseData + 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 *OpsgenieServicesResponse) GetDataOk() (*[]OpsgenieServiceResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *OpsgenieServicesResponse) SetData(v []OpsgenieServiceResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OpsgenieServicesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OpsgenieServicesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]OpsgenieServiceResponseData `json:"data"` + }{} + all := struct { + Data []OpsgenieServiceResponseData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_organization.go b/api/v2/datadog/model_organization.go new file mode 100644 index 00000000000..335ccea0f97 --- /dev/null +++ b/api/v2/datadog/model_organization.go @@ -0,0 +1,198 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// Organization Organization object. +type Organization struct { + // Attributes of the organization. + Attributes *OrganizationAttributes `json:"attributes,omitempty"` + // ID of the organization. + Id *string `json:"id,omitempty"` + // Organizations resource type. + Type OrganizationsType `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{} +} + +// NewOrganization instantiates a new Organization 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 NewOrganization(typeVar OrganizationsType) *Organization { + this := Organization{} + this.Type = typeVar + return &this +} + +// NewOrganizationWithDefaults instantiates a new Organization 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 NewOrganizationWithDefaults() *Organization { + this := Organization{} + var typeVar OrganizationsType = ORGANIZATIONSTYPE_ORGS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *Organization) GetAttributes() OrganizationAttributes { + if o == nil || o.Attributes == nil { + var ret OrganizationAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetAttributesOk() (*OrganizationAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *Organization) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given OrganizationAttributes and assigns it to the Attributes field. +func (o *Organization) SetAttributes(v OrganizationAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Organization) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Organization) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Organization) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *Organization) GetType() OrganizationsType { + if o == nil { + var ret OrganizationsType + 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 *Organization) GetTypeOk() (*OrganizationsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *Organization) SetType(v OrganizationsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Organization) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *OrganizationsType `json:"type"` + }{} + all := struct { + Attributes *OrganizationAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type OrganizationsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_organization_attributes.go b/api/v2/datadog/model_organization_attributes.go new file mode 100644 index 00000000000..586514d147b --- /dev/null +++ b/api/v2/datadog/model_organization_attributes.go @@ -0,0 +1,384 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// OrganizationAttributes Attributes of the organization. +type OrganizationAttributes struct { + // Creation time of the organization. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Description of the organization. + Description *string `json:"description,omitempty"` + // Whether or not the organization is disabled. + Disabled *bool `json:"disabled,omitempty"` + // Time of last organization modification. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // Name of the organization. + Name *string `json:"name,omitempty"` + // Public ID of the organization. + PublicId *string `json:"public_id,omitempty"` + // Sharing type of the organization. + Sharing *string `json:"sharing,omitempty"` + // URL of the site that this organization exists at. + Url *string `json:"url,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{} +} + +// NewOrganizationAttributes instantiates a new OrganizationAttributes 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 NewOrganizationAttributes() *OrganizationAttributes { + this := OrganizationAttributes{} + return &this +} + +// NewOrganizationAttributesWithDefaults instantiates a new OrganizationAttributes 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 NewOrganizationAttributesWithDefaults() *OrganizationAttributes { + this := OrganizationAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *OrganizationAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *OrganizationAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasDisabled() bool { + if o != nil && o.Disabled != nil { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *OrganizationAttributes) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *OrganizationAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *OrganizationAttributes) SetName(v string) { + o.Name = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *OrganizationAttributes) SetPublicId(v string) { + o.PublicId = &v +} + +// GetSharing returns the Sharing field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetSharing() string { + if o == nil || o.Sharing == nil { + var ret string + return ret + } + return *o.Sharing +} + +// GetSharingOk returns a tuple with the Sharing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetSharingOk() (*string, bool) { + if o == nil || o.Sharing == nil { + return nil, false + } + return o.Sharing, true +} + +// HasSharing returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasSharing() bool { + if o != nil && o.Sharing != nil { + return true + } + + return false +} + +// SetSharing gets a reference to the given string and assigns it to the Sharing field. +func (o *OrganizationAttributes) SetSharing(v string) { + o.Sharing = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *OrganizationAttributes) GetUrl() string { + if o == nil || o.Url == nil { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationAttributes) GetUrlOk() (*string, bool) { + if o == nil || o.Url == nil { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *OrganizationAttributes) HasUrl() bool { + if o != nil && o.Url != nil { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *OrganizationAttributes) SetUrl(v string) { + o.Url = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o OrganizationAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Sharing != nil { + toSerialize["sharing"] = o.Sharing + } + if o.Url != nil { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *OrganizationAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Description *string `json:"description,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + PublicId *string `json:"public_id,omitempty"` + Sharing *string `json:"sharing,omitempty"` + Url *string `json:"url,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.Description = all.Description + o.Disabled = all.Disabled + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + o.PublicId = all.PublicId + o.Sharing = all.Sharing + o.Url = all.Url + return nil +} diff --git a/api/v2/datadog/model_organizations_type.go b/api/v2/datadog/model_organizations_type.go new file mode 100644 index 00000000000..fbe74f68a70 --- /dev/null +++ b/api/v2/datadog/model_organizations_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// OrganizationsType Organizations resource type. +type OrganizationsType string + +// List of OrganizationsType. +const ( + ORGANIZATIONSTYPE_ORGS OrganizationsType = "orgs" +) + +var allowedOrganizationsTypeEnumValues = []OrganizationsType{ + ORGANIZATIONSTYPE_ORGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OrganizationsType) GetAllowedValues() []OrganizationsType { + return allowedOrganizationsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OrganizationsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OrganizationsType(value) + return nil +} + +// NewOrganizationsTypeFromValue returns a pointer to a valid OrganizationsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOrganizationsTypeFromValue(v string) (*OrganizationsType, error) { + ev := OrganizationsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OrganizationsType: valid values are %v", v, allowedOrganizationsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OrganizationsType) IsValid() bool { + for _, existing := range allowedOrganizationsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OrganizationsType value. +func (v OrganizationsType) Ptr() *OrganizationsType { + return &v +} + +// NullableOrganizationsType handles when a null is used for OrganizationsType. +type NullableOrganizationsType struct { + value *OrganizationsType + isSet bool +} + +// Get returns the associated value. +func (v NullableOrganizationsType) Get() *OrganizationsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableOrganizationsType) Set(val *OrganizationsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableOrganizationsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableOrganizationsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableOrganizationsType initializes the struct as if Set has been called. +func NewNullableOrganizationsType(val *OrganizationsType) *NullableOrganizationsType { + return &NullableOrganizationsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableOrganizationsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableOrganizationsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_pagination.go b/api/v2/datadog/model_pagination.go new file mode 100644 index 00000000000..8993857c687 --- /dev/null +++ b/api/v2/datadog/model_pagination.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// Pagination Pagination object. +type Pagination struct { + // Total count. + TotalCount *int64 `json:"total_count,omitempty"` + // Total count of elements matched by the filter. + 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{} +} + +// NewPagination instantiates a new Pagination 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 NewPagination() *Pagination { + this := Pagination{} + return &this +} + +// NewPaginationWithDefaults instantiates a new Pagination 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 NewPaginationWithDefaults() *Pagination { + this := Pagination{} + return &this +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *Pagination) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pagination) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *Pagination) HasTotalCount() bool { + if o != nil && o.TotalCount != nil { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *Pagination) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *Pagination) 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 *Pagination) 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 *Pagination) HasTotalFilteredCount() bool { + if o != nil && o.TotalFilteredCount != nil { + return true + } + + return false +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *Pagination) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Pagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + if o.TotalFilteredCount != nil { + toSerialize["total_filtered_count"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TotalCount *int64 `json:"total_count,omitempty"` + TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TotalCount = all.TotalCount + o.TotalFilteredCount = all.TotalFilteredCount + return nil +} diff --git a/api/v2/datadog/model_partial_api_key.go b/api/v2/datadog/model_partial_api_key.go new file mode 100644 index 00000000000..f7c1adf8694 --- /dev/null +++ b/api/v2/datadog/model_partial_api_key.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// PartialAPIKey Partial Datadog API key. +type PartialAPIKey struct { + // Attributes of a partial API key. + Attributes *PartialAPIKeyAttributes `json:"attributes,omitempty"` + // ID of the API key. + Id *string `json:"id,omitempty"` + // Resources related to the API key. + Relationships *APIKeyRelationships `json:"relationships,omitempty"` + // API Keys resource type. + Type *APIKeysType `json:"type,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{} +} + +// NewPartialAPIKey instantiates a new PartialAPIKey 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 NewPartialAPIKey() *PartialAPIKey { + this := PartialAPIKey{} + var typeVar APIKeysType = APIKEYSTYPE_API_KEYS + this.Type = &typeVar + return &this +} + +// NewPartialAPIKeyWithDefaults instantiates a new PartialAPIKey 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 NewPartialAPIKeyWithDefaults() *PartialAPIKey { + this := PartialAPIKey{} + var typeVar APIKeysType = APIKEYSTYPE_API_KEYS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *PartialAPIKey) GetAttributes() PartialAPIKeyAttributes { + if o == nil || o.Attributes == nil { + var ret PartialAPIKeyAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKey) GetAttributesOk() (*PartialAPIKeyAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *PartialAPIKey) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given PartialAPIKeyAttributes and assigns it to the Attributes field. +func (o *PartialAPIKey) SetAttributes(v PartialAPIKeyAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PartialAPIKey) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKey) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *PartialAPIKey) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PartialAPIKey) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *PartialAPIKey) GetRelationships() APIKeyRelationships { + if o == nil || o.Relationships == nil { + var ret APIKeyRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKey) GetRelationshipsOk() (*APIKeyRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *PartialAPIKey) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given APIKeyRelationships and assigns it to the Relationships field. +func (o *PartialAPIKey) SetRelationships(v APIKeyRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PartialAPIKey) GetType() APIKeysType { + if o == nil || o.Type == nil { + var ret APIKeysType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKey) GetTypeOk() (*APIKeysType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PartialAPIKey) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given APIKeysType and assigns it to the Type field. +func (o *PartialAPIKey) SetType(v APIKeysType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PartialAPIKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PartialAPIKey) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *PartialAPIKeyAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *APIKeyRelationships `json:"relationships,omitempty"` + Type *APIKeysType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_partial_api_key_attributes.go b/api/v2/datadog/model_partial_api_key_attributes.go new file mode 100644 index 00000000000..aede8b85ab0 --- /dev/null +++ b/api/v2/datadog/model_partial_api_key_attributes.go @@ -0,0 +1,219 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// PartialAPIKeyAttributes Attributes of a partial API key. +type PartialAPIKeyAttributes struct { + // Creation date of the API key. + CreatedAt *string `json:"created_at,omitempty"` + // The last four characters of the API key. + Last4 *string `json:"last4,omitempty"` + // Date the API key was last modified. + ModifiedAt *string `json:"modified_at,omitempty"` + // Name of the API key. + Name *string `json:"name,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{} +} + +// NewPartialAPIKeyAttributes instantiates a new PartialAPIKeyAttributes 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 NewPartialAPIKeyAttributes() *PartialAPIKeyAttributes { + this := PartialAPIKeyAttributes{} + return &this +} + +// NewPartialAPIKeyAttributesWithDefaults instantiates a new PartialAPIKeyAttributes 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 NewPartialAPIKeyAttributesWithDefaults() *PartialAPIKeyAttributes { + this := PartialAPIKeyAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *PartialAPIKeyAttributes) GetCreatedAt() string { + if o == nil || o.CreatedAt == nil { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKeyAttributes) GetCreatedAtOk() (*string, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *PartialAPIKeyAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *PartialAPIKeyAttributes) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetLast4 returns the Last4 field value if set, zero value otherwise. +func (o *PartialAPIKeyAttributes) GetLast4() string { + if o == nil || o.Last4 == nil { + var ret string + return ret + } + return *o.Last4 +} + +// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKeyAttributes) GetLast4Ok() (*string, bool) { + if o == nil || o.Last4 == nil { + return nil, false + } + return o.Last4, true +} + +// HasLast4 returns a boolean if a field has been set. +func (o *PartialAPIKeyAttributes) HasLast4() bool { + if o != nil && o.Last4 != nil { + return true + } + + return false +} + +// SetLast4 gets a reference to the given string and assigns it to the Last4 field. +func (o *PartialAPIKeyAttributes) SetLast4(v string) { + o.Last4 = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *PartialAPIKeyAttributes) GetModifiedAt() string { + if o == nil || o.ModifiedAt == nil { + var ret string + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKeyAttributes) GetModifiedAtOk() (*string, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *PartialAPIKeyAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given string and assigns it to the ModifiedAt field. +func (o *PartialAPIKeyAttributes) SetModifiedAt(v string) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialAPIKeyAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialAPIKeyAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PartialAPIKeyAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PartialAPIKeyAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PartialAPIKeyAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.Last4 != nil { + toSerialize["last4"] = o.Last4 + } + if o.ModifiedAt != nil { + toSerialize["modified_at"] = o.ModifiedAt + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PartialAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *string `json:"created_at,omitempty"` + Last4 *string `json:"last4,omitempty"` + ModifiedAt *string `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.Last4 = all.Last4 + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_partial_application_key.go b/api/v2/datadog/model_partial_application_key.go new file mode 100644 index 00000000000..308f05296f4 --- /dev/null +++ b/api/v2/datadog/model_partial_application_key.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// PartialApplicationKey Partial Datadog application key. +type PartialApplicationKey struct { + // Attributes of a partial application key. + Attributes *PartialApplicationKeyAttributes `json:"attributes,omitempty"` + // ID of the application key. + Id *string `json:"id,omitempty"` + // Resources related to the application key. + Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` + // Application Keys resource type. + Type *ApplicationKeysType `json:"type,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{} +} + +// NewPartialApplicationKey instantiates a new PartialApplicationKey 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 NewPartialApplicationKey() *PartialApplicationKey { + this := PartialApplicationKey{} + var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS + this.Type = &typeVar + return &this +} + +// NewPartialApplicationKeyWithDefaults instantiates a new PartialApplicationKey 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 NewPartialApplicationKeyWithDefaults() *PartialApplicationKey { + this := PartialApplicationKey{} + var typeVar ApplicationKeysType = APPLICATIONKEYSTYPE_APPLICATION_KEYS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *PartialApplicationKey) GetAttributes() PartialApplicationKeyAttributes { + if o == nil || o.Attributes == nil { + var ret PartialApplicationKeyAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKey) GetAttributesOk() (*PartialApplicationKeyAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *PartialApplicationKey) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given PartialApplicationKeyAttributes and assigns it to the Attributes field. +func (o *PartialApplicationKey) SetAttributes(v PartialApplicationKeyAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PartialApplicationKey) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKey) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *PartialApplicationKey) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PartialApplicationKey) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *PartialApplicationKey) GetRelationships() ApplicationKeyRelationships { + if o == nil || o.Relationships == nil { + var ret ApplicationKeyRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKey) GetRelationshipsOk() (*ApplicationKeyRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *PartialApplicationKey) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given ApplicationKeyRelationships and assigns it to the Relationships field. +func (o *PartialApplicationKey) SetRelationships(v ApplicationKeyRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PartialApplicationKey) GetType() ApplicationKeysType { + if o == nil || o.Type == nil { + var ret ApplicationKeysType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKey) GetTypeOk() (*ApplicationKeysType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PartialApplicationKey) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given ApplicationKeysType and assigns it to the Type field. +func (o *PartialApplicationKey) SetType(v ApplicationKeysType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PartialApplicationKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PartialApplicationKey) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *PartialApplicationKeyAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` + Type *ApplicationKeysType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_partial_application_key_attributes.go b/api/v2/datadog/model_partial_application_key_attributes.go new file mode 100644 index 00000000000..d7210f69f64 --- /dev/null +++ b/api/v2/datadog/model_partial_application_key_attributes.go @@ -0,0 +1,220 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// PartialApplicationKeyAttributes Attributes of a partial application key. +type PartialApplicationKeyAttributes struct { + // Creation date of the application key. + CreatedAt *string `json:"created_at,omitempty"` + // The last four characters of the application key. + Last4 *string `json:"last4,omitempty"` + // Name of the application key. + Name *string `json:"name,omitempty"` + // Array of scopes to grant the application key. This feature is in private beta, please contact Datadog support to enable scopes for your application keys. + Scopes []string `json:"scopes,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{} +} + +// NewPartialApplicationKeyAttributes instantiates a new PartialApplicationKeyAttributes 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 NewPartialApplicationKeyAttributes() *PartialApplicationKeyAttributes { + this := PartialApplicationKeyAttributes{} + return &this +} + +// NewPartialApplicationKeyAttributesWithDefaults instantiates a new PartialApplicationKeyAttributes 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 NewPartialApplicationKeyAttributesWithDefaults() *PartialApplicationKeyAttributes { + this := PartialApplicationKeyAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *PartialApplicationKeyAttributes) GetCreatedAt() string { + if o == nil || o.CreatedAt == nil { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKeyAttributes) GetCreatedAtOk() (*string, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *PartialApplicationKeyAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *PartialApplicationKeyAttributes) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetLast4 returns the Last4 field value if set, zero value otherwise. +func (o *PartialApplicationKeyAttributes) GetLast4() string { + if o == nil || o.Last4 == nil { + var ret string + return ret + } + return *o.Last4 +} + +// GetLast4Ok returns a tuple with the Last4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKeyAttributes) GetLast4Ok() (*string, bool) { + if o == nil || o.Last4 == nil { + return nil, false + } + return o.Last4, true +} + +// HasLast4 returns a boolean if a field has been set. +func (o *PartialApplicationKeyAttributes) HasLast4() bool { + if o != nil && o.Last4 != nil { + return true + } + + return false +} + +// SetLast4 gets a reference to the given string and assigns it to the Last4 field. +func (o *PartialApplicationKeyAttributes) SetLast4(v string) { + o.Last4 = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialApplicationKeyAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKeyAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PartialApplicationKeyAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PartialApplicationKeyAttributes) SetName(v string) { + o.Name = &v +} + +// GetScopes returns the Scopes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *PartialApplicationKeyAttributes) GetScopes() []string { + if o == nil { + var ret []string + return ret + } + return o.Scopes +} + +// GetScopesOk returns a tuple with the Scopes 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 *PartialApplicationKeyAttributes) GetScopesOk() (*[]string, bool) { + if o == nil || o.Scopes == nil { + return nil, false + } + return &o.Scopes, true +} + +// HasScopes returns a boolean if a field has been set. +func (o *PartialApplicationKeyAttributes) HasScopes() bool { + if o != nil && o.Scopes != nil { + return true + } + + return false +} + +// SetScopes gets a reference to the given []string and assigns it to the Scopes field. +func (o *PartialApplicationKeyAttributes) SetScopes(v []string) { + o.Scopes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PartialApplicationKeyAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + toSerialize["created_at"] = o.CreatedAt + } + if o.Last4 != nil { + toSerialize["last4"] = o.Last4 + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Scopes != nil { + toSerialize["scopes"] = o.Scopes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PartialApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *string `json:"created_at,omitempty"` + Last4 *string `json:"last4,omitempty"` + Name *string `json:"name,omitempty"` + Scopes []string `json:"scopes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.Last4 = all.Last4 + o.Name = all.Name + o.Scopes = all.Scopes + return nil +} diff --git a/api/v2/datadog/model_partial_application_key_response.go b/api/v2/datadog/model_partial_application_key_response.go new file mode 100644 index 00000000000..3690c2698eb --- /dev/null +++ b/api/v2/datadog/model_partial_application_key_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 datadog + +import ( + "encoding/json" +) + +// PartialApplicationKeyResponse Response for retrieving a partial application key. +type PartialApplicationKeyResponse struct { + // Partial Datadog application key. + Data *PartialApplicationKey `json:"data,omitempty"` + // Array of objects related to the application key. + Included []ApplicationKeyResponseIncludedItem `json:"included,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{} +} + +// NewPartialApplicationKeyResponse instantiates a new PartialApplicationKeyResponse 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 NewPartialApplicationKeyResponse() *PartialApplicationKeyResponse { + this := PartialApplicationKeyResponse{} + return &this +} + +// NewPartialApplicationKeyResponseWithDefaults instantiates a new PartialApplicationKeyResponse 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 NewPartialApplicationKeyResponseWithDefaults() *PartialApplicationKeyResponse { + this := PartialApplicationKeyResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *PartialApplicationKeyResponse) GetData() PartialApplicationKey { + if o == nil || o.Data == nil { + var ret PartialApplicationKey + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKeyResponse) GetDataOk() (*PartialApplicationKey, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *PartialApplicationKeyResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given PartialApplicationKey and assigns it to the Data field. +func (o *PartialApplicationKeyResponse) SetData(v PartialApplicationKey) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *PartialApplicationKeyResponse) GetIncluded() []ApplicationKeyResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []ApplicationKeyResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialApplicationKeyResponse) GetIncludedOk() (*[]ApplicationKeyResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *PartialApplicationKeyResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []ApplicationKeyResponseIncludedItem and assigns it to the Included field. +func (o *PartialApplicationKeyResponse) SetIncluded(v []ApplicationKeyResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PartialApplicationKeyResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PartialApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *PartialApplicationKey `json:"data,omitempty"` + Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_permission.go b/api/v2/datadog/model_permission.go new file mode 100644 index 00000000000..d86328add47 --- /dev/null +++ b/api/v2/datadog/model_permission.go @@ -0,0 +1,198 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// Permission Permission object. +type Permission struct { + // Attributes of a permission. + Attributes *PermissionAttributes `json:"attributes,omitempty"` + // ID of the permission. + Id *string `json:"id,omitempty"` + // Permissions resource type. + Type PermissionsType `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{} +} + +// NewPermission instantiates a new Permission 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 NewPermission(typeVar PermissionsType) *Permission { + this := Permission{} + this.Type = typeVar + return &this +} + +// NewPermissionWithDefaults instantiates a new Permission 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 NewPermissionWithDefaults() *Permission { + this := Permission{} + var typeVar PermissionsType = PERMISSIONSTYPE_PERMISSIONS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *Permission) GetAttributes() PermissionAttributes { + if o == nil || o.Attributes == nil { + var ret PermissionAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Permission) GetAttributesOk() (*PermissionAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *Permission) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given PermissionAttributes and assigns it to the Attributes field. +func (o *Permission) SetAttributes(v PermissionAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Permission) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Permission) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Permission) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Permission) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *Permission) GetType() PermissionsType { + if o == nil { + var ret PermissionsType + 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 *Permission) GetTypeOk() (*PermissionsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *Permission) SetType(v PermissionsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Permission) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Permission) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *PermissionsType `json:"type"` + }{} + all := struct { + Attributes *PermissionAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type PermissionsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_permission_attributes.go b/api/v2/datadog/model_permission_attributes.go new file mode 100644 index 00000000000..d28f2c0d501 --- /dev/null +++ b/api/v2/datadog/model_permission_attributes.go @@ -0,0 +1,341 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// PermissionAttributes Attributes of a permission. +type PermissionAttributes struct { + // Creation time of the permission. + Created *time.Time `json:"created,omitempty"` + // Description of the permission. + Description *string `json:"description,omitempty"` + // Displayed name for the permission. + DisplayName *string `json:"display_name,omitempty"` + // Display type. + DisplayType *string `json:"display_type,omitempty"` + // Name of the permission group. + GroupName *string `json:"group_name,omitempty"` + // Name of the permission. + Name *string `json:"name,omitempty"` + // Whether or not the permission is restricted. + Restricted *bool `json:"restricted,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{} +} + +// NewPermissionAttributes instantiates a new PermissionAttributes 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 NewPermissionAttributes() *PermissionAttributes { + this := PermissionAttributes{} + return &this +} + +// NewPermissionAttributesWithDefaults instantiates a new PermissionAttributes 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 NewPermissionAttributesWithDefaults() *PermissionAttributes { + this := PermissionAttributes{} + return &this +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *PermissionAttributes) GetCreated() time.Time { + if o == nil || o.Created == nil { + var ret time.Time + return ret + } + return *o.Created +} + +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionAttributes) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { + return nil, false + } + return o.Created, true +} + +// HasCreated returns a boolean if a field has been set. +func (o *PermissionAttributes) HasCreated() bool { + if o != nil && o.Created != nil { + return true + } + + return false +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *PermissionAttributes) SetCreated(v time.Time) { + o.Created = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *PermissionAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *PermissionAttributes) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *PermissionAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *PermissionAttributes) GetDisplayName() string { + if o == nil || o.DisplayName == nil { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionAttributes) GetDisplayNameOk() (*string, bool) { + if o == nil || o.DisplayName == nil { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *PermissionAttributes) HasDisplayName() bool { + if o != nil && o.DisplayName != nil { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *PermissionAttributes) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetDisplayType returns the DisplayType field value if set, zero value otherwise. +func (o *PermissionAttributes) GetDisplayType() string { + if o == nil || o.DisplayType == nil { + var ret string + return ret + } + return *o.DisplayType +} + +// GetDisplayTypeOk returns a tuple with the DisplayType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionAttributes) GetDisplayTypeOk() (*string, bool) { + if o == nil || o.DisplayType == nil { + return nil, false + } + return o.DisplayType, true +} + +// HasDisplayType returns a boolean if a field has been set. +func (o *PermissionAttributes) HasDisplayType() bool { + if o != nil && o.DisplayType != nil { + return true + } + + return false +} + +// SetDisplayType gets a reference to the given string and assigns it to the DisplayType field. +func (o *PermissionAttributes) SetDisplayType(v string) { + o.DisplayType = &v +} + +// GetGroupName returns the GroupName field value if set, zero value otherwise. +func (o *PermissionAttributes) GetGroupName() string { + if o == nil || o.GroupName == nil { + var ret string + return ret + } + return *o.GroupName +} + +// GetGroupNameOk returns a tuple with the GroupName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionAttributes) GetGroupNameOk() (*string, bool) { + if o == nil || o.GroupName == nil { + return nil, false + } + return o.GroupName, true +} + +// HasGroupName returns a boolean if a field has been set. +func (o *PermissionAttributes) HasGroupName() bool { + if o != nil && o.GroupName != nil { + return true + } + + return false +} + +// SetGroupName gets a reference to the given string and assigns it to the GroupName field. +func (o *PermissionAttributes) SetGroupName(v string) { + o.GroupName = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PermissionAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PermissionAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PermissionAttributes) SetName(v string) { + o.Name = &v +} + +// GetRestricted returns the Restricted field value if set, zero value otherwise. +func (o *PermissionAttributes) GetRestricted() bool { + if o == nil || o.Restricted == nil { + var ret bool + return ret + } + return *o.Restricted +} + +// GetRestrictedOk returns a tuple with the Restricted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionAttributes) GetRestrictedOk() (*bool, bool) { + if o == nil || o.Restricted == nil { + return nil, false + } + return o.Restricted, true +} + +// HasRestricted returns a boolean if a field has been set. +func (o *PermissionAttributes) HasRestricted() bool { + if o != nil && o.Restricted != nil { + return true + } + + return false +} + +// SetRestricted gets a reference to the given bool and assigns it to the Restricted field. +func (o *PermissionAttributes) SetRestricted(v bool) { + o.Restricted = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PermissionAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.DisplayName != nil { + toSerialize["display_name"] = o.DisplayName + } + if o.DisplayType != nil { + toSerialize["display_type"] = o.DisplayType + } + if o.GroupName != nil { + toSerialize["group_name"] = o.GroupName + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Restricted != nil { + toSerialize["restricted"] = o.Restricted + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Created *time.Time `json:"created,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + DisplayType *string `json:"display_type,omitempty"` + GroupName *string `json:"group_name,omitempty"` + Name *string `json:"name,omitempty"` + Restricted *bool `json:"restricted,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Created = all.Created + o.Description = all.Description + o.DisplayName = all.DisplayName + o.DisplayType = all.DisplayType + o.GroupName = all.GroupName + o.Name = all.Name + o.Restricted = all.Restricted + return nil +} diff --git a/api/v2/datadog/model_permissions_response.go b/api/v2/datadog/model_permissions_response.go new file mode 100644 index 00000000000..aa397f00e2b --- /dev/null +++ b/api/v2/datadog/model_permissions_response.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 datadog + +import ( + "encoding/json" +) + +// PermissionsResponse Payload with API-returned permissions. +type PermissionsResponse struct { + // Array of permissions. + Data []Permission `json:"data,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{} +} + +// NewPermissionsResponse instantiates a new PermissionsResponse 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 NewPermissionsResponse() *PermissionsResponse { + this := PermissionsResponse{} + return &this +} + +// NewPermissionsResponseWithDefaults instantiates a new PermissionsResponse 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 NewPermissionsResponseWithDefaults() *PermissionsResponse { + this := PermissionsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *PermissionsResponse) GetData() []Permission { + if o == nil || o.Data == nil { + var ret []Permission + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PermissionsResponse) GetDataOk() (*[]Permission, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *PermissionsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []Permission and assigns it to the Data field. +func (o *PermissionsResponse) SetData(v []Permission) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PermissionsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *PermissionsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []Permission `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_permissions_type.go b/api/v2/datadog/model_permissions_type.go new file mode 100644 index 00000000000..d8597ce8384 --- /dev/null +++ b/api/v2/datadog/model_permissions_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// PermissionsType Permissions resource type. +type PermissionsType string + +// List of PermissionsType. +const ( + PERMISSIONSTYPE_PERMISSIONS PermissionsType = "permissions" +) + +var allowedPermissionsTypeEnumValues = []PermissionsType{ + PERMISSIONSTYPE_PERMISSIONS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *PermissionsType) GetAllowedValues() []PermissionsType { + return allowedPermissionsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *PermissionsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = PermissionsType(value) + return nil +} + +// NewPermissionsTypeFromValue returns a pointer to a valid PermissionsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewPermissionsTypeFromValue(v string) (*PermissionsType, error) { + ev := PermissionsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for PermissionsType: valid values are %v", v, allowedPermissionsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v PermissionsType) IsValid() bool { + for _, existing := range allowedPermissionsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PermissionsType value. +func (v PermissionsType) Ptr() *PermissionsType { + return &v +} + +// NullablePermissionsType handles when a null is used for PermissionsType. +type NullablePermissionsType struct { + value *PermissionsType + isSet bool +} + +// Get returns the associated value. +func (v NullablePermissionsType) Get() *PermissionsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullablePermissionsType) Set(val *PermissionsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullablePermissionsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullablePermissionsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullablePermissionsType initializes the struct as if Set has been called. +func NewNullablePermissionsType(val *PermissionsType) *NullablePermissionsType { + return &NullablePermissionsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullablePermissionsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullablePermissionsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_process_summaries_meta.go b/api/v2/datadog/model_process_summaries_meta.go new file mode 100644 index 00000000000..07880b46b11 --- /dev/null +++ b/api/v2/datadog/model_process_summaries_meta.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ProcessSummariesMeta Response metadata object. +type ProcessSummariesMeta struct { + // Paging attributes. + Page *ProcessSummariesMetaPage `json:"page,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{} +} + +// NewProcessSummariesMeta instantiates a new ProcessSummariesMeta 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 NewProcessSummariesMeta() *ProcessSummariesMeta { + this := ProcessSummariesMeta{} + return &this +} + +// NewProcessSummariesMetaWithDefaults instantiates a new ProcessSummariesMeta 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 NewProcessSummariesMetaWithDefaults() *ProcessSummariesMeta { + this := ProcessSummariesMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *ProcessSummariesMeta) GetPage() ProcessSummariesMetaPage { + if o == nil || o.Page == nil { + var ret ProcessSummariesMetaPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummariesMeta) GetPageOk() (*ProcessSummariesMetaPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *ProcessSummariesMeta) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given ProcessSummariesMetaPage and assigns it to the Page field. +func (o *ProcessSummariesMeta) SetPage(v ProcessSummariesMetaPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProcessSummariesMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProcessSummariesMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *ProcessSummariesMetaPage `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v2/datadog/model_process_summaries_meta_page.go b/api/v2/datadog/model_process_summaries_meta_page.go new file mode 100644 index 00000000000..5c578bd9118 --- /dev/null +++ b/api/v2/datadog/model_process_summaries_meta_page.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ProcessSummariesMetaPage Paging attributes. +type ProcessSummariesMetaPage struct { + // The cursor used to get the next results, if any. To make the next request, use the same + // parameters with the addition of the `page[cursor]`. + After *string `json:"after,omitempty"` + // Number of results returned. + Size *int32 `json:"size,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{} +} + +// NewProcessSummariesMetaPage instantiates a new ProcessSummariesMetaPage 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 NewProcessSummariesMetaPage() *ProcessSummariesMetaPage { + this := ProcessSummariesMetaPage{} + return &this +} + +// NewProcessSummariesMetaPageWithDefaults instantiates a new ProcessSummariesMetaPage 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 NewProcessSummariesMetaPageWithDefaults() *ProcessSummariesMetaPage { + this := ProcessSummariesMetaPage{} + return &this +} + +// GetAfter returns the After field value if set, zero value otherwise. +func (o *ProcessSummariesMetaPage) GetAfter() string { + if o == nil || o.After == nil { + var ret string + return ret + } + return *o.After +} + +// GetAfterOk returns a tuple with the After field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummariesMetaPage) GetAfterOk() (*string, bool) { + if o == nil || o.After == nil { + return nil, false + } + return o.After, true +} + +// HasAfter returns a boolean if a field has been set. +func (o *ProcessSummariesMetaPage) HasAfter() bool { + if o != nil && o.After != nil { + return true + } + + return false +} + +// SetAfter gets a reference to the given string and assigns it to the After field. +func (o *ProcessSummariesMetaPage) SetAfter(v string) { + o.After = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *ProcessSummariesMetaPage) GetSize() int32 { + if o == nil || o.Size == nil { + var ret int32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummariesMetaPage) GetSizeOk() (*int32, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *ProcessSummariesMetaPage) HasSize() bool { + if o != nil && o.Size != nil { + return true + } + + return false +} + +// SetSize gets a reference to the given int32 and assigns it to the Size field. +func (o *ProcessSummariesMetaPage) SetSize(v int32) { + o.Size = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProcessSummariesMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.After != nil { + toSerialize["after"] = o.After + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProcessSummariesMetaPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + After *string `json:"after,omitempty"` + Size *int32 `json:"size,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.After = all.After + o.Size = all.Size + return nil +} diff --git a/api/v2/datadog/model_process_summaries_response.go b/api/v2/datadog/model_process_summaries_response.go new file mode 100644 index 00000000000..29e8543c316 --- /dev/null +++ b/api/v2/datadog/model_process_summaries_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 datadog + +import ( + "encoding/json" +) + +// ProcessSummariesResponse List of process summaries. +type ProcessSummariesResponse struct { + // Array of process summary objects. + Data []ProcessSummary `json:"data,omitempty"` + // Response metadata object. + Meta *ProcessSummariesMeta `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{} +} + +// NewProcessSummariesResponse instantiates a new ProcessSummariesResponse 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 NewProcessSummariesResponse() *ProcessSummariesResponse { + this := ProcessSummariesResponse{} + return &this +} + +// NewProcessSummariesResponseWithDefaults instantiates a new ProcessSummariesResponse 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 NewProcessSummariesResponseWithDefaults() *ProcessSummariesResponse { + this := ProcessSummariesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ProcessSummariesResponse) GetData() []ProcessSummary { + if o == nil || o.Data == nil { + var ret []ProcessSummary + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummariesResponse) GetDataOk() (*[]ProcessSummary, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *ProcessSummariesResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []ProcessSummary and assigns it to the Data field. +func (o *ProcessSummariesResponse) SetData(v []ProcessSummary) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *ProcessSummariesResponse) GetMeta() ProcessSummariesMeta { + if o == nil || o.Meta == nil { + var ret ProcessSummariesMeta + 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 *ProcessSummariesResponse) GetMetaOk() (*ProcessSummariesMeta, 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 *ProcessSummariesResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given ProcessSummariesMeta and assigns it to the Meta field. +func (o *ProcessSummariesResponse) SetMeta(v ProcessSummariesMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProcessSummariesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProcessSummariesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []ProcessSummary `json:"data,omitempty"` + Meta *ProcessSummariesMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_process_summary.go b/api/v2/datadog/model_process_summary.go new file mode 100644 index 00000000000..d7ff4c56b25 --- /dev/null +++ b/api/v2/datadog/model_process_summary.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ProcessSummary Process summary object. +type ProcessSummary struct { + // Attributes for a process summary. + Attributes *ProcessSummaryAttributes `json:"attributes,omitempty"` + // Process ID. + Id *string `json:"id,omitempty"` + // Type of process summary. + Type *ProcessSummaryType `json:"type,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{} +} + +// NewProcessSummary instantiates a new ProcessSummary 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 NewProcessSummary() *ProcessSummary { + this := ProcessSummary{} + var typeVar ProcessSummaryType = PROCESSSUMMARYTYPE_PROCESS + this.Type = &typeVar + return &this +} + +// NewProcessSummaryWithDefaults instantiates a new ProcessSummary 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 NewProcessSummaryWithDefaults() *ProcessSummary { + this := ProcessSummary{} + var typeVar ProcessSummaryType = PROCESSSUMMARYTYPE_PROCESS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *ProcessSummary) GetAttributes() ProcessSummaryAttributes { + if o == nil || o.Attributes == nil { + var ret ProcessSummaryAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummary) GetAttributesOk() (*ProcessSummaryAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *ProcessSummary) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given ProcessSummaryAttributes and assigns it to the Attributes field. +func (o *ProcessSummary) SetAttributes(v ProcessSummaryAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ProcessSummary) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummary) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ProcessSummary) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ProcessSummary) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ProcessSummary) GetType() ProcessSummaryType { + if o == nil || o.Type == nil { + var ret ProcessSummaryType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummary) GetTypeOk() (*ProcessSummaryType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ProcessSummary) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given ProcessSummaryType and assigns it to the Type field. +func (o *ProcessSummary) SetType(v ProcessSummaryType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProcessSummary) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProcessSummary) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *ProcessSummaryAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *ProcessSummaryType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_process_summary_attributes.go b/api/v2/datadog/model_process_summary_attributes.go new file mode 100644 index 00000000000..de2819cb1c7 --- /dev/null +++ b/api/v2/datadog/model_process_summary_attributes.go @@ -0,0 +1,375 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ProcessSummaryAttributes Attributes for a process summary. +type ProcessSummaryAttributes struct { + // Process command line. + Cmdline *string `json:"cmdline,omitempty"` + // Host running the process. + Host *string `json:"host,omitempty"` + // Process ID. + Pid *int64 `json:"pid,omitempty"` + // Parent process ID. + Ppid *int64 `json:"ppid,omitempty"` + // Time the process was started. + Start *string `json:"start,omitempty"` + // List of tags associated with the process. + Tags []string `json:"tags,omitempty"` + // Time the process was seen. + Timestamp *string `json:"timestamp,omitempty"` + // Process owner. + User *string `json:"user,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{} +} + +// NewProcessSummaryAttributes instantiates a new ProcessSummaryAttributes 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 NewProcessSummaryAttributes() *ProcessSummaryAttributes { + this := ProcessSummaryAttributes{} + return &this +} + +// NewProcessSummaryAttributesWithDefaults instantiates a new ProcessSummaryAttributes 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 NewProcessSummaryAttributesWithDefaults() *ProcessSummaryAttributes { + this := ProcessSummaryAttributes{} + return &this +} + +// GetCmdline returns the Cmdline field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetCmdline() string { + if o == nil || o.Cmdline == nil { + var ret string + return ret + } + return *o.Cmdline +} + +// GetCmdlineOk returns a tuple with the Cmdline field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummaryAttributes) GetCmdlineOk() (*string, bool) { + if o == nil || o.Cmdline == nil { + return nil, false + } + return o.Cmdline, true +} + +// HasCmdline returns a boolean if a field has been set. +func (o *ProcessSummaryAttributes) HasCmdline() bool { + if o != nil && o.Cmdline != nil { + return true + } + + return false +} + +// SetCmdline gets a reference to the given string and assigns it to the Cmdline field. +func (o *ProcessSummaryAttributes) SetCmdline(v string) { + o.Cmdline = &v +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetHost() string { + if o == nil || o.Host == nil { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummaryAttributes) GetHostOk() (*string, bool) { + if o == nil || o.Host == nil { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *ProcessSummaryAttributes) HasHost() bool { + if o != nil && o.Host != nil { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *ProcessSummaryAttributes) SetHost(v string) { + o.Host = &v +} + +// GetPid returns the Pid field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetPid() int64 { + if o == nil || o.Pid == nil { + var ret int64 + return ret + } + return *o.Pid +} + +// GetPidOk returns a tuple with the Pid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummaryAttributes) GetPidOk() (*int64, bool) { + if o == nil || o.Pid == nil { + return nil, false + } + return o.Pid, true +} + +// HasPid returns a boolean if a field has been set. +func (o *ProcessSummaryAttributes) HasPid() bool { + if o != nil && o.Pid != nil { + return true + } + + return false +} + +// SetPid gets a reference to the given int64 and assigns it to the Pid field. +func (o *ProcessSummaryAttributes) SetPid(v int64) { + o.Pid = &v +} + +// GetPpid returns the Ppid field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetPpid() int64 { + if o == nil || o.Ppid == nil { + var ret int64 + return ret + } + return *o.Ppid +} + +// GetPpidOk returns a tuple with the Ppid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummaryAttributes) GetPpidOk() (*int64, bool) { + if o == nil || o.Ppid == nil { + return nil, false + } + return o.Ppid, true +} + +// HasPpid returns a boolean if a field has been set. +func (o *ProcessSummaryAttributes) HasPpid() bool { + if o != nil && o.Ppid != nil { + return true + } + + return false +} + +// SetPpid gets a reference to the given int64 and assigns it to the Ppid field. +func (o *ProcessSummaryAttributes) SetPpid(v int64) { + o.Ppid = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetStart() string { + if o == nil || o.Start == nil { + var ret string + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummaryAttributes) GetStartOk() (*string, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *ProcessSummaryAttributes) HasStart() bool { + if o != nil && o.Start != nil { + return true + } + + return false +} + +// SetStart gets a reference to the given string and assigns it to the Start field. +func (o *ProcessSummaryAttributes) SetStart(v string) { + o.Start = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *ProcessSummaryAttributes) GetTagsOk() (*[]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 *ProcessSummaryAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ProcessSummaryAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetTimestamp() string { + if o == nil || o.Timestamp == nil { + var ret string + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummaryAttributes) GetTimestampOk() (*string, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *ProcessSummaryAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given string and assigns it to the Timestamp field. +func (o *ProcessSummaryAttributes) SetTimestamp(v string) { + o.Timestamp = &v +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *ProcessSummaryAttributes) GetUser() string { + if o == nil || o.User == nil { + var ret string + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProcessSummaryAttributes) GetUserOk() (*string, bool) { + if o == nil || o.User == nil { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *ProcessSummaryAttributes) HasUser() bool { + if o != nil && o.User != nil { + return true + } + + return false +} + +// SetUser gets a reference to the given string and assigns it to the User field. +func (o *ProcessSummaryAttributes) SetUser(v string) { + o.User = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProcessSummaryAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cmdline != nil { + toSerialize["cmdline"] = o.Cmdline + } + if o.Host != nil { + toSerialize["host"] = o.Host + } + if o.Pid != nil { + toSerialize["pid"] = o.Pid + } + if o.Ppid != nil { + toSerialize["ppid"] = o.Ppid + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + toSerialize["timestamp"] = o.Timestamp + } + if o.User != nil { + toSerialize["user"] = o.User + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProcessSummaryAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cmdline *string `json:"cmdline,omitempty"` + Host *string `json:"host,omitempty"` + Pid *int64 `json:"pid,omitempty"` + Ppid *int64 `json:"ppid,omitempty"` + Start *string `json:"start,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *string `json:"timestamp,omitempty"` + User *string `json:"user,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cmdline = all.Cmdline + o.Host = all.Host + o.Pid = all.Pid + o.Ppid = all.Ppid + o.Start = all.Start + o.Tags = all.Tags + o.Timestamp = all.Timestamp + o.User = all.User + return nil +} diff --git a/api/v2/datadog/model_process_summary_type.go b/api/v2/datadog/model_process_summary_type.go new file mode 100644 index 00000000000..e85741a2a65 --- /dev/null +++ b/api/v2/datadog/model_process_summary_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ProcessSummaryType Type of process summary. +type ProcessSummaryType string + +// List of ProcessSummaryType. +const ( + PROCESSSUMMARYTYPE_PROCESS ProcessSummaryType = "process" +) + +var allowedProcessSummaryTypeEnumValues = []ProcessSummaryType{ + PROCESSSUMMARYTYPE_PROCESS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ProcessSummaryType) GetAllowedValues() []ProcessSummaryType { + return allowedProcessSummaryTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ProcessSummaryType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ProcessSummaryType(value) + return nil +} + +// NewProcessSummaryTypeFromValue returns a pointer to a valid ProcessSummaryType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewProcessSummaryTypeFromValue(v string) (*ProcessSummaryType, error) { + ev := ProcessSummaryType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ProcessSummaryType: valid values are %v", v, allowedProcessSummaryTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ProcessSummaryType) IsValid() bool { + for _, existing := range allowedProcessSummaryTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProcessSummaryType value. +func (v ProcessSummaryType) Ptr() *ProcessSummaryType { + return &v +} + +// NullableProcessSummaryType handles when a null is used for ProcessSummaryType. +type NullableProcessSummaryType struct { + value *ProcessSummaryType + isSet bool +} + +// Get returns the associated value. +func (v NullableProcessSummaryType) Get() *ProcessSummaryType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableProcessSummaryType) Set(val *ProcessSummaryType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableProcessSummaryType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableProcessSummaryType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableProcessSummaryType initializes the struct as if Set has been called. +func NewNullableProcessSummaryType(val *ProcessSummaryType) *NullableProcessSummaryType { + return &NullableProcessSummaryType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableProcessSummaryType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableProcessSummaryType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_query_sort_order.go b/api/v2/datadog/model_query_sort_order.go new file mode 100644 index 00000000000..8074bfd22e3 --- /dev/null +++ b/api/v2/datadog/model_query_sort_order.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// QuerySortOrder Direction of sort. +type QuerySortOrder string + +// List of QuerySortOrder. +const ( + QUERYSORTORDER_ASC QuerySortOrder = "asc" + QUERYSORTORDER_DESC QuerySortOrder = "desc" +) + +var allowedQuerySortOrderEnumValues = []QuerySortOrder{ + QUERYSORTORDER_ASC, + QUERYSORTORDER_DESC, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *QuerySortOrder) GetAllowedValues() []QuerySortOrder { + return allowedQuerySortOrderEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *QuerySortOrder) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = QuerySortOrder(value) + return nil +} + +// NewQuerySortOrderFromValue returns a pointer to a valid QuerySortOrder +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewQuerySortOrderFromValue(v string) (*QuerySortOrder, error) { + ev := QuerySortOrder(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for QuerySortOrder: valid values are %v", v, allowedQuerySortOrderEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v QuerySortOrder) IsValid() bool { + for _, existing := range allowedQuerySortOrderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to QuerySortOrder value. +func (v QuerySortOrder) Ptr() *QuerySortOrder { + return &v +} + +// NullableQuerySortOrder handles when a null is used for QuerySortOrder. +type NullableQuerySortOrder struct { + value *QuerySortOrder + isSet bool +} + +// Get returns the associated value. +func (v NullableQuerySortOrder) Get() *QuerySortOrder { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableQuerySortOrder) Set(val *QuerySortOrder) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableQuerySortOrder) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableQuerySortOrder) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableQuerySortOrder initializes the struct as if Set has been called. +func NewNullableQuerySortOrder(val *QuerySortOrder) *NullableQuerySortOrder { + return &NullableQuerySortOrder{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableQuerySortOrder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableQuerySortOrder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go b/api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go new file mode 100644 index 00000000000..09c833d030e --- /dev/null +++ b/api/v2/datadog/model_relationship_to_incident_integration_metadata_data.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToIncidentIntegrationMetadataData A relationship reference for an integration metadata object. +type RelationshipToIncidentIntegrationMetadataData struct { + // A unique identifier that represents the integration metadata. + Id string `json:"id"` + // Integration metadata resource type. + Type IncidentIntegrationMetadataType `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{} +} + +// NewRelationshipToIncidentIntegrationMetadataData instantiates a new RelationshipToIncidentIntegrationMetadataData 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 NewRelationshipToIncidentIntegrationMetadataData(id string, typeVar IncidentIntegrationMetadataType) *RelationshipToIncidentIntegrationMetadataData { + this := RelationshipToIncidentIntegrationMetadataData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewRelationshipToIncidentIntegrationMetadataDataWithDefaults instantiates a new RelationshipToIncidentIntegrationMetadataData 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 NewRelationshipToIncidentIntegrationMetadataDataWithDefaults() *RelationshipToIncidentIntegrationMetadataData { + this := RelationshipToIncidentIntegrationMetadataData{} + var typeVar IncidentIntegrationMetadataType = INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *RelationshipToIncidentIntegrationMetadataData) 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 *RelationshipToIncidentIntegrationMetadataData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RelationshipToIncidentIntegrationMetadataData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RelationshipToIncidentIntegrationMetadataData) GetType() IncidentIntegrationMetadataType { + if o == nil { + var ret IncidentIntegrationMetadataType + 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 *RelationshipToIncidentIntegrationMetadataData) GetTypeOk() (*IncidentIntegrationMetadataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RelationshipToIncidentIntegrationMetadataData) SetType(v IncidentIntegrationMetadataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToIncidentIntegrationMetadataData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToIncidentIntegrationMetadataData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *IncidentIntegrationMetadataType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type IncidentIntegrationMetadataType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_relationship_to_incident_integration_metadatas.go b/api/v2/datadog/model_relationship_to_incident_integration_metadatas.go new file mode 100644 index 00000000000..f75fc89bd6b --- /dev/null +++ b/api/v2/datadog/model_relationship_to_incident_integration_metadatas.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToIncidentIntegrationMetadatas A relationship reference for multiple integration metadata objects. +type RelationshipToIncidentIntegrationMetadatas struct { + // The integration metadata relationship array + Data []RelationshipToIncidentIntegrationMetadataData `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{} +} + +// NewRelationshipToIncidentIntegrationMetadatas instantiates a new RelationshipToIncidentIntegrationMetadatas 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 NewRelationshipToIncidentIntegrationMetadatas(data []RelationshipToIncidentIntegrationMetadataData) *RelationshipToIncidentIntegrationMetadatas { + this := RelationshipToIncidentIntegrationMetadatas{} + this.Data = data + return &this +} + +// NewRelationshipToIncidentIntegrationMetadatasWithDefaults instantiates a new RelationshipToIncidentIntegrationMetadatas 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 NewRelationshipToIncidentIntegrationMetadatasWithDefaults() *RelationshipToIncidentIntegrationMetadatas { + this := RelationshipToIncidentIntegrationMetadatas{} + return &this +} + +// GetData returns the Data field value. +func (o *RelationshipToIncidentIntegrationMetadatas) GetData() []RelationshipToIncidentIntegrationMetadataData { + if o == nil { + var ret []RelationshipToIncidentIntegrationMetadataData + 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 *RelationshipToIncidentIntegrationMetadatas) GetDataOk() (*[]RelationshipToIncidentIntegrationMetadataData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RelationshipToIncidentIntegrationMetadatas) SetData(v []RelationshipToIncidentIntegrationMetadataData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToIncidentIntegrationMetadatas) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToIncidentIntegrationMetadatas) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]RelationshipToIncidentIntegrationMetadataData `json:"data"` + }{} + all := struct { + Data []RelationshipToIncidentIntegrationMetadataData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_incident_postmortem.go b/api/v2/datadog/model_relationship_to_incident_postmortem.go new file mode 100644 index 00000000000..350cb80249d --- /dev/null +++ b/api/v2/datadog/model_relationship_to_incident_postmortem.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToIncidentPostmortem A relationship reference for postmortems. +type RelationshipToIncidentPostmortem struct { + // The postmortem relationship data. + Data RelationshipToIncidentPostmortemData `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{} +} + +// NewRelationshipToIncidentPostmortem instantiates a new RelationshipToIncidentPostmortem 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 NewRelationshipToIncidentPostmortem(data RelationshipToIncidentPostmortemData) *RelationshipToIncidentPostmortem { + this := RelationshipToIncidentPostmortem{} + this.Data = data + return &this +} + +// NewRelationshipToIncidentPostmortemWithDefaults instantiates a new RelationshipToIncidentPostmortem 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 NewRelationshipToIncidentPostmortemWithDefaults() *RelationshipToIncidentPostmortem { + this := RelationshipToIncidentPostmortem{} + return &this +} + +// GetData returns the Data field value. +func (o *RelationshipToIncidentPostmortem) GetData() RelationshipToIncidentPostmortemData { + if o == nil { + var ret RelationshipToIncidentPostmortemData + 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 *RelationshipToIncidentPostmortem) GetDataOk() (*RelationshipToIncidentPostmortemData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RelationshipToIncidentPostmortem) SetData(v RelationshipToIncidentPostmortemData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToIncidentPostmortem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToIncidentPostmortem) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *RelationshipToIncidentPostmortemData `json:"data"` + }{} + all := struct { + Data RelationshipToIncidentPostmortemData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_incident_postmortem_data.go b/api/v2/datadog/model_relationship_to_incident_postmortem_data.go new file mode 100644 index 00000000000..c02d86f7dc3 --- /dev/null +++ b/api/v2/datadog/model_relationship_to_incident_postmortem_data.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToIncidentPostmortemData The postmortem relationship data. +type RelationshipToIncidentPostmortemData struct { + // A unique identifier that represents the postmortem. + Id string `json:"id"` + // Incident postmortem resource type. + Type IncidentPostmortemType `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{} +} + +// NewRelationshipToIncidentPostmortemData instantiates a new RelationshipToIncidentPostmortemData 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 NewRelationshipToIncidentPostmortemData(id string, typeVar IncidentPostmortemType) *RelationshipToIncidentPostmortemData { + this := RelationshipToIncidentPostmortemData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewRelationshipToIncidentPostmortemDataWithDefaults instantiates a new RelationshipToIncidentPostmortemData 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 NewRelationshipToIncidentPostmortemDataWithDefaults() *RelationshipToIncidentPostmortemData { + this := RelationshipToIncidentPostmortemData{} + var typeVar IncidentPostmortemType = INCIDENTPOSTMORTEMTYPE_INCIDENT_POSTMORTEMS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *RelationshipToIncidentPostmortemData) 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 *RelationshipToIncidentPostmortemData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RelationshipToIncidentPostmortemData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RelationshipToIncidentPostmortemData) GetType() IncidentPostmortemType { + if o == nil { + var ret IncidentPostmortemType + 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 *RelationshipToIncidentPostmortemData) GetTypeOk() (*IncidentPostmortemType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RelationshipToIncidentPostmortemData) SetType(v IncidentPostmortemType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToIncidentPostmortemData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToIncidentPostmortemData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *IncidentPostmortemType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type IncidentPostmortemType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_relationship_to_organization.go b/api/v2/datadog/model_relationship_to_organization.go new file mode 100644 index 00000000000..ffa10d2f39f --- /dev/null +++ b/api/v2/datadog/model_relationship_to_organization.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToOrganization Relationship to an organization. +type RelationshipToOrganization struct { + // Relationship to organization object. + Data RelationshipToOrganizationData `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{} +} + +// NewRelationshipToOrganization instantiates a new RelationshipToOrganization 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 NewRelationshipToOrganization(data RelationshipToOrganizationData) *RelationshipToOrganization { + this := RelationshipToOrganization{} + this.Data = data + return &this +} + +// NewRelationshipToOrganizationWithDefaults instantiates a new RelationshipToOrganization 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 NewRelationshipToOrganizationWithDefaults() *RelationshipToOrganization { + this := RelationshipToOrganization{} + return &this +} + +// GetData returns the Data field value. +func (o *RelationshipToOrganization) GetData() RelationshipToOrganizationData { + if o == nil { + var ret RelationshipToOrganizationData + 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 *RelationshipToOrganization) GetDataOk() (*RelationshipToOrganizationData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RelationshipToOrganization) SetData(v RelationshipToOrganizationData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToOrganization) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToOrganization) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *RelationshipToOrganizationData `json:"data"` + }{} + all := struct { + Data RelationshipToOrganizationData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_organization_data.go b/api/v2/datadog/model_relationship_to_organization_data.go new file mode 100644 index 00000000000..c29160e4a9c --- /dev/null +++ b/api/v2/datadog/model_relationship_to_organization_data.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToOrganizationData Relationship to organization object. +type RelationshipToOrganizationData struct { + // ID of the organization. + Id string `json:"id"` + // Organizations resource type. + Type OrganizationsType `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{} +} + +// NewRelationshipToOrganizationData instantiates a new RelationshipToOrganizationData 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 NewRelationshipToOrganizationData(id string, typeVar OrganizationsType) *RelationshipToOrganizationData { + this := RelationshipToOrganizationData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewRelationshipToOrganizationDataWithDefaults instantiates a new RelationshipToOrganizationData 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 NewRelationshipToOrganizationDataWithDefaults() *RelationshipToOrganizationData { + this := RelationshipToOrganizationData{} + var typeVar OrganizationsType = ORGANIZATIONSTYPE_ORGS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *RelationshipToOrganizationData) 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 *RelationshipToOrganizationData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RelationshipToOrganizationData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RelationshipToOrganizationData) GetType() OrganizationsType { + if o == nil { + var ret OrganizationsType + 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 *RelationshipToOrganizationData) GetTypeOk() (*OrganizationsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RelationshipToOrganizationData) SetType(v OrganizationsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToOrganizationData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToOrganizationData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *OrganizationsType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type OrganizationsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_relationship_to_organizations.go b/api/v2/datadog/model_relationship_to_organizations.go new file mode 100644 index 00000000000..c40cda6bb70 --- /dev/null +++ b/api/v2/datadog/model_relationship_to_organizations.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToOrganizations Relationship to organizations. +type RelationshipToOrganizations struct { + // Relationships to organization objects. + Data []RelationshipToOrganizationData `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{} +} + +// NewRelationshipToOrganizations instantiates a new RelationshipToOrganizations 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 NewRelationshipToOrganizations(data []RelationshipToOrganizationData) *RelationshipToOrganizations { + this := RelationshipToOrganizations{} + this.Data = data + return &this +} + +// NewRelationshipToOrganizationsWithDefaults instantiates a new RelationshipToOrganizations 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 NewRelationshipToOrganizationsWithDefaults() *RelationshipToOrganizations { + this := RelationshipToOrganizations{} + return &this +} + +// GetData returns the Data field value. +func (o *RelationshipToOrganizations) GetData() []RelationshipToOrganizationData { + if o == nil { + var ret []RelationshipToOrganizationData + 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 *RelationshipToOrganizations) GetDataOk() (*[]RelationshipToOrganizationData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RelationshipToOrganizations) SetData(v []RelationshipToOrganizationData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToOrganizations) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToOrganizations) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]RelationshipToOrganizationData `json:"data"` + }{} + all := struct { + Data []RelationshipToOrganizationData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_permission.go b/api/v2/datadog/model_relationship_to_permission.go new file mode 100644 index 00000000000..e0b02e62342 --- /dev/null +++ b/api/v2/datadog/model_relationship_to_permission.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RelationshipToPermission Relationship to a permissions object. +type RelationshipToPermission struct { + // Relationship to permission object. + Data *RelationshipToPermissionData `json:"data,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{} +} + +// NewRelationshipToPermission instantiates a new RelationshipToPermission 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 NewRelationshipToPermission() *RelationshipToPermission { + this := RelationshipToPermission{} + return &this +} + +// NewRelationshipToPermissionWithDefaults instantiates a new RelationshipToPermission 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 NewRelationshipToPermissionWithDefaults() *RelationshipToPermission { + this := RelationshipToPermission{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RelationshipToPermission) GetData() RelationshipToPermissionData { + if o == nil || o.Data == nil { + var ret RelationshipToPermissionData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToPermission) GetDataOk() (*RelationshipToPermissionData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RelationshipToPermission) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given RelationshipToPermissionData and assigns it to the Data field. +func (o *RelationshipToPermission) SetData(v RelationshipToPermissionData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToPermission) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToPermission) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *RelationshipToPermissionData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_permission_data.go b/api/v2/datadog/model_relationship_to_permission_data.go new file mode 100644 index 00000000000..274efea31fc --- /dev/null +++ b/api/v2/datadog/model_relationship_to_permission_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RelationshipToPermissionData Relationship to permission object. +type RelationshipToPermissionData struct { + // ID of the permission. + Id *string `json:"id,omitempty"` + // Permissions resource type. + Type *PermissionsType `json:"type,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{} +} + +// NewRelationshipToPermissionData instantiates a new RelationshipToPermissionData 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 NewRelationshipToPermissionData() *RelationshipToPermissionData { + this := RelationshipToPermissionData{} + var typeVar PermissionsType = PERMISSIONSTYPE_PERMISSIONS + this.Type = &typeVar + return &this +} + +// NewRelationshipToPermissionDataWithDefaults instantiates a new RelationshipToPermissionData 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 NewRelationshipToPermissionDataWithDefaults() *RelationshipToPermissionData { + this := RelationshipToPermissionData{} + var typeVar PermissionsType = PERMISSIONSTYPE_PERMISSIONS + this.Type = &typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RelationshipToPermissionData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToPermissionData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RelationshipToPermissionData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RelationshipToPermissionData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RelationshipToPermissionData) GetType() PermissionsType { + if o == nil || o.Type == nil { + var ret PermissionsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToPermissionData) GetTypeOk() (*PermissionsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RelationshipToPermissionData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given PermissionsType and assigns it to the Type field. +func (o *RelationshipToPermissionData) SetType(v PermissionsType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToPermissionData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToPermissionData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Type *PermissionsType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_relationship_to_permissions.go b/api/v2/datadog/model_relationship_to_permissions.go new file mode 100644 index 00000000000..cd37f41cf32 --- /dev/null +++ b/api/v2/datadog/model_relationship_to_permissions.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 datadog + +import ( + "encoding/json" +) + +// RelationshipToPermissions Relationship to multiple permissions objects. +type RelationshipToPermissions struct { + // Relationships to permission objects. + Data []RelationshipToPermissionData `json:"data,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{} +} + +// NewRelationshipToPermissions instantiates a new RelationshipToPermissions 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 NewRelationshipToPermissions() *RelationshipToPermissions { + this := RelationshipToPermissions{} + return &this +} + +// NewRelationshipToPermissionsWithDefaults instantiates a new RelationshipToPermissions 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 NewRelationshipToPermissionsWithDefaults() *RelationshipToPermissions { + this := RelationshipToPermissions{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RelationshipToPermissions) GetData() []RelationshipToPermissionData { + if o == nil || o.Data == nil { + var ret []RelationshipToPermissionData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToPermissions) GetDataOk() (*[]RelationshipToPermissionData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RelationshipToPermissions) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []RelationshipToPermissionData and assigns it to the Data field. +func (o *RelationshipToPermissions) SetData(v []RelationshipToPermissionData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToPermissions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToPermissions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []RelationshipToPermissionData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_role.go b/api/v2/datadog/model_relationship_to_role.go new file mode 100644 index 00000000000..edf52227898 --- /dev/null +++ b/api/v2/datadog/model_relationship_to_role.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RelationshipToRole Relationship to role. +type RelationshipToRole struct { + // Relationship to role object. + Data *RelationshipToRoleData `json:"data,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{} +} + +// NewRelationshipToRole instantiates a new RelationshipToRole 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 NewRelationshipToRole() *RelationshipToRole { + this := RelationshipToRole{} + return &this +} + +// NewRelationshipToRoleWithDefaults instantiates a new RelationshipToRole 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 NewRelationshipToRoleWithDefaults() *RelationshipToRole { + this := RelationshipToRole{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RelationshipToRole) GetData() RelationshipToRoleData { + if o == nil || o.Data == nil { + var ret RelationshipToRoleData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToRole) GetDataOk() (*RelationshipToRoleData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RelationshipToRole) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given RelationshipToRoleData and assigns it to the Data field. +func (o *RelationshipToRole) SetData(v RelationshipToRoleData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToRole) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToRole) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *RelationshipToRoleData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_role_data.go b/api/v2/datadog/model_relationship_to_role_data.go new file mode 100644 index 00000000000..5b1843f352a --- /dev/null +++ b/api/v2/datadog/model_relationship_to_role_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RelationshipToRoleData Relationship to role object. +type RelationshipToRoleData struct { + // The unique identifier of the role. + Id *string `json:"id,omitempty"` + // Roles type. + Type *RolesType `json:"type,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{} +} + +// NewRelationshipToRoleData instantiates a new RelationshipToRoleData 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 NewRelationshipToRoleData() *RelationshipToRoleData { + this := RelationshipToRoleData{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = &typeVar + return &this +} + +// NewRelationshipToRoleDataWithDefaults instantiates a new RelationshipToRoleData 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 NewRelationshipToRoleDataWithDefaults() *RelationshipToRoleData { + this := RelationshipToRoleData{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = &typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RelationshipToRoleData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToRoleData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RelationshipToRoleData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RelationshipToRoleData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RelationshipToRoleData) GetType() RolesType { + if o == nil || o.Type == nil { + var ret RolesType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToRoleData) GetTypeOk() (*RolesType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RelationshipToRoleData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given RolesType and assigns it to the Type field. +func (o *RelationshipToRoleData) SetType(v RolesType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToRoleData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToRoleData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Id *string `json:"id,omitempty"` + Type *RolesType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_relationship_to_roles.go b/api/v2/datadog/model_relationship_to_roles.go new file mode 100644 index 00000000000..5b8ee2470bf --- /dev/null +++ b/api/v2/datadog/model_relationship_to_roles.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 datadog + +import ( + "encoding/json" +) + +// RelationshipToRoles Relationship to roles. +type RelationshipToRoles struct { + // An array containing type and the unique identifier of a role. + Data []RelationshipToRoleData `json:"data,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{} +} + +// NewRelationshipToRoles instantiates a new RelationshipToRoles 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 NewRelationshipToRoles() *RelationshipToRoles { + this := RelationshipToRoles{} + return &this +} + +// NewRelationshipToRolesWithDefaults instantiates a new RelationshipToRoles 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 NewRelationshipToRolesWithDefaults() *RelationshipToRoles { + this := RelationshipToRoles{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RelationshipToRoles) GetData() []RelationshipToRoleData { + if o == nil || o.Data == nil { + var ret []RelationshipToRoleData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipToRoles) GetDataOk() (*[]RelationshipToRoleData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RelationshipToRoles) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []RelationshipToRoleData and assigns it to the Data field. +func (o *RelationshipToRoles) SetData(v []RelationshipToRoleData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToRoles) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToRoles) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []RelationshipToRoleData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_saml_assertion_attribute.go b/api/v2/datadog/model_relationship_to_saml_assertion_attribute.go new file mode 100644 index 00000000000..3d57665bf6f --- /dev/null +++ b/api/v2/datadog/model_relationship_to_saml_assertion_attribute.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToSAMLAssertionAttribute AuthN Mapping relationship to SAML Assertion Attribute. +type RelationshipToSAMLAssertionAttribute struct { + // Data of AuthN Mapping relationship to SAML Assertion Attribute. + Data RelationshipToSAMLAssertionAttributeData `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{} +} + +// NewRelationshipToSAMLAssertionAttribute instantiates a new RelationshipToSAMLAssertionAttribute 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 NewRelationshipToSAMLAssertionAttribute(data RelationshipToSAMLAssertionAttributeData) *RelationshipToSAMLAssertionAttribute { + this := RelationshipToSAMLAssertionAttribute{} + this.Data = data + return &this +} + +// NewRelationshipToSAMLAssertionAttributeWithDefaults instantiates a new RelationshipToSAMLAssertionAttribute 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 NewRelationshipToSAMLAssertionAttributeWithDefaults() *RelationshipToSAMLAssertionAttribute { + this := RelationshipToSAMLAssertionAttribute{} + return &this +} + +// GetData returns the Data field value. +func (o *RelationshipToSAMLAssertionAttribute) GetData() RelationshipToSAMLAssertionAttributeData { + if o == nil { + var ret RelationshipToSAMLAssertionAttributeData + 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 *RelationshipToSAMLAssertionAttribute) GetDataOk() (*RelationshipToSAMLAssertionAttributeData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RelationshipToSAMLAssertionAttribute) SetData(v RelationshipToSAMLAssertionAttributeData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToSAMLAssertionAttribute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToSAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *RelationshipToSAMLAssertionAttributeData `json:"data"` + }{} + all := struct { + Data RelationshipToSAMLAssertionAttributeData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go b/api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go new file mode 100644 index 00000000000..534cac4d83e --- /dev/null +++ b/api/v2/datadog/model_relationship_to_saml_assertion_attribute_data.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToSAMLAssertionAttributeData Data of AuthN Mapping relationship to SAML Assertion Attribute. +type RelationshipToSAMLAssertionAttributeData struct { + // The ID of the SAML assertion attribute. + Id string `json:"id"` + // SAML assertion attributes resource type. + Type SAMLAssertionAttributesType `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{} +} + +// NewRelationshipToSAMLAssertionAttributeData instantiates a new RelationshipToSAMLAssertionAttributeData 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 NewRelationshipToSAMLAssertionAttributeData(id string, typeVar SAMLAssertionAttributesType) *RelationshipToSAMLAssertionAttributeData { + this := RelationshipToSAMLAssertionAttributeData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewRelationshipToSAMLAssertionAttributeDataWithDefaults instantiates a new RelationshipToSAMLAssertionAttributeData 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 NewRelationshipToSAMLAssertionAttributeDataWithDefaults() *RelationshipToSAMLAssertionAttributeData { + this := RelationshipToSAMLAssertionAttributeData{} + var typeVar SAMLAssertionAttributesType = SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *RelationshipToSAMLAssertionAttributeData) 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 *RelationshipToSAMLAssertionAttributeData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RelationshipToSAMLAssertionAttributeData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RelationshipToSAMLAssertionAttributeData) GetType() SAMLAssertionAttributesType { + if o == nil { + var ret SAMLAssertionAttributesType + 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 *RelationshipToSAMLAssertionAttributeData) GetTypeOk() (*SAMLAssertionAttributesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RelationshipToSAMLAssertionAttributeData) SetType(v SAMLAssertionAttributesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToSAMLAssertionAttributeData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToSAMLAssertionAttributeData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *SAMLAssertionAttributesType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type SAMLAssertionAttributesType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_relationship_to_user.go b/api/v2/datadog/model_relationship_to_user.go new file mode 100644 index 00000000000..8273b47787d --- /dev/null +++ b/api/v2/datadog/model_relationship_to_user.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToUser Relationship to user. +type RelationshipToUser struct { + // Relationship to user object. + Data RelationshipToUserData `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{} +} + +// NewRelationshipToUser instantiates a new RelationshipToUser 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 NewRelationshipToUser(data RelationshipToUserData) *RelationshipToUser { + this := RelationshipToUser{} + this.Data = data + return &this +} + +// NewRelationshipToUserWithDefaults instantiates a new RelationshipToUser 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 NewRelationshipToUserWithDefaults() *RelationshipToUser { + this := RelationshipToUser{} + return &this +} + +// GetData returns the Data field value. +func (o *RelationshipToUser) GetData() RelationshipToUserData { + if o == nil { + var ret RelationshipToUserData + 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 *RelationshipToUser) GetDataOk() (*RelationshipToUserData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RelationshipToUser) SetData(v RelationshipToUserData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToUser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *RelationshipToUserData `json:"data"` + }{} + all := struct { + Data RelationshipToUserData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_relationship_to_user_data.go b/api/v2/datadog/model_relationship_to_user_data.go new file mode 100644 index 00000000000..c3b9bc5e091 --- /dev/null +++ b/api/v2/datadog/model_relationship_to_user_data.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToUserData Relationship to user object. +type RelationshipToUserData struct { + // A unique identifier that represents the user. + Id string `json:"id"` + // Users resource type. + Type UsersType `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{} +} + +// NewRelationshipToUserData instantiates a new RelationshipToUserData 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 NewRelationshipToUserData(id string, typeVar UsersType) *RelationshipToUserData { + this := RelationshipToUserData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewRelationshipToUserDataWithDefaults instantiates a new RelationshipToUserData 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 NewRelationshipToUserDataWithDefaults() *RelationshipToUserData { + this := RelationshipToUserData{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *RelationshipToUserData) 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 *RelationshipToUserData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RelationshipToUserData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RelationshipToUserData) GetType() UsersType { + if o == nil { + var ret UsersType + 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 *RelationshipToUserData) GetTypeOk() (*UsersType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RelationshipToUserData) SetType(v UsersType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToUserData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *UsersType `json:"type"` + }{} + all := struct { + Id string `json:"id"` + Type UsersType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_relationship_to_users.go b/api/v2/datadog/model_relationship_to_users.go new file mode 100644 index 00000000000..e7ba1610fdc --- /dev/null +++ b/api/v2/datadog/model_relationship_to_users.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RelationshipToUsers Relationship to users. +type RelationshipToUsers struct { + // Relationships to user objects. + Data []RelationshipToUserData `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{} +} + +// NewRelationshipToUsers instantiates a new RelationshipToUsers 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 NewRelationshipToUsers(data []RelationshipToUserData) *RelationshipToUsers { + this := RelationshipToUsers{} + this.Data = data + return &this +} + +// NewRelationshipToUsersWithDefaults instantiates a new RelationshipToUsers 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 NewRelationshipToUsersWithDefaults() *RelationshipToUsers { + this := RelationshipToUsers{} + return &this +} + +// GetData returns the Data field value. +func (o *RelationshipToUsers) GetData() []RelationshipToUserData { + if o == nil { + var ret []RelationshipToUserData + 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 *RelationshipToUsers) GetDataOk() (*[]RelationshipToUserData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RelationshipToUsers) SetData(v []RelationshipToUserData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RelationshipToUsers) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RelationshipToUsers) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]RelationshipToUserData `json:"data"` + }{} + all := struct { + Data []RelationshipToUserData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_response_meta_attributes.go b/api/v2/datadog/model_response_meta_attributes.go new file mode 100644 index 00000000000..40cc83c63a6 --- /dev/null +++ b/api/v2/datadog/model_response_meta_attributes.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// ResponseMetaAttributes Object describing meta attributes of response. +type ResponseMetaAttributes struct { + // Pagination object. + Page *Pagination `json:"page,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{} +} + +// NewResponseMetaAttributes instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributes() *ResponseMetaAttributes { + this := ResponseMetaAttributes{} + return &this +} + +// NewResponseMetaAttributesWithDefaults instantiates a new ResponseMetaAttributes 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 NewResponseMetaAttributesWithDefaults() *ResponseMetaAttributes { + this := ResponseMetaAttributes{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *ResponseMetaAttributes) GetPage() Pagination { + if o == nil || o.Page == nil { + var ret Pagination + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResponseMetaAttributes) GetPageOk() (*Pagination, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *ResponseMetaAttributes) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given Pagination and assigns it to the Page field. +func (o *ResponseMetaAttributes) SetPage(v Pagination) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ResponseMetaAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *Pagination `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v2/datadog/model_role.go b/api/v2/datadog/model_role.go new file mode 100644 index 00000000000..2e79b1ea0a6 --- /dev/null +++ b/api/v2/datadog/model_role.go @@ -0,0 +1,244 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// Role Role object returned by the API. +type Role struct { + // Attributes of the role. + Attributes *RoleAttributes `json:"attributes,omitempty"` + // The unique identifier of the role. + Id *string `json:"id,omitempty"` + // Relationships of the role object returned by the API. + Relationships *RoleResponseRelationships `json:"relationships,omitempty"` + // Roles type. + Type RolesType `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{} +} + +// NewRole instantiates a new Role 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 NewRole(typeVar RolesType) *Role { + this := Role{} + this.Type = typeVar + return &this +} + +// NewRoleWithDefaults instantiates a new Role 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 NewRoleWithDefaults() *Role { + this := Role{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *Role) GetAttributes() RoleAttributes { + if o == nil || o.Attributes == nil { + var ret RoleAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Role) GetAttributesOk() (*RoleAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *Role) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given RoleAttributes and assigns it to the Attributes field. +func (o *Role) SetAttributes(v RoleAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Role) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Role) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Role) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Role) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *Role) GetRelationships() RoleResponseRelationships { + if o == nil || o.Relationships == nil { + var ret RoleResponseRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Role) GetRelationshipsOk() (*RoleResponseRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *Role) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given RoleResponseRelationships and assigns it to the Relationships field. +func (o *Role) SetRelationships(v RoleResponseRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *Role) GetType() RolesType { + if o == nil { + var ret RolesType + 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 *Role) GetTypeOk() (*RolesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *Role) SetType(v RolesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Role) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Role) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *RolesType `json:"type"` + }{} + all := struct { + Attributes *RoleAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *RoleResponseRelationships `json:"relationships,omitempty"` + Type RolesType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_role_attributes.go b/api/v2/datadog/model_role_attributes.go new file mode 100644 index 00000000000..687df251a3a --- /dev/null +++ b/api/v2/datadog/model_role_attributes.go @@ -0,0 +1,228 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// RoleAttributes Attributes of the role. +type RoleAttributes struct { + // Creation time of the role. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Time of last role modification. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // The name of the role. The name is neither unique nor a stable identifier of the role. + Name *string `json:"name,omitempty"` + // Number of users with that role. + UserCount *int64 `json:"user_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{} +} + +// NewRoleAttributes instantiates a new RoleAttributes 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 NewRoleAttributes() *RoleAttributes { + this := RoleAttributes{} + return &this +} + +// NewRoleAttributesWithDefaults instantiates a new RoleAttributes 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 NewRoleAttributesWithDefaults() *RoleAttributes { + this := RoleAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *RoleAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *RoleAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *RoleAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *RoleAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *RoleAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *RoleAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RoleAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RoleAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RoleAttributes) SetName(v string) { + o.Name = &v +} + +// GetUserCount returns the UserCount field value if set, zero value otherwise. +func (o *RoleAttributes) GetUserCount() int64 { + if o == nil || o.UserCount == nil { + var ret int64 + return ret + } + return *o.UserCount +} + +// GetUserCountOk returns a tuple with the UserCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleAttributes) GetUserCountOk() (*int64, bool) { + if o == nil || o.UserCount == nil { + return nil, false + } + return o.UserCount, true +} + +// HasUserCount returns a boolean if a field has been set. +func (o *RoleAttributes) HasUserCount() bool { + if o != nil && o.UserCount != nil { + return true + } + + return false +} + +// SetUserCount gets a reference to the given int64 and assigns it to the UserCount field. +func (o *RoleAttributes) SetUserCount(v int64) { + o.UserCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.UserCount != nil { + toSerialize["user_count"] = o.UserCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + UserCount *int64 `json:"user_count,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + o.UserCount = all.UserCount + return nil +} diff --git a/api/v2/datadog/model_role_clone.go b/api/v2/datadog/model_role_clone.go new file mode 100644 index 00000000000..b5a55b1a753 --- /dev/null +++ b/api/v2/datadog/model_role_clone.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleClone Data for the clone role request. +type RoleClone struct { + // Attributes required to create a new role by cloning an existing one. + Attributes RoleCloneAttributes `json:"attributes"` + // Roles type. + Type RolesType `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{} +} + +// NewRoleClone instantiates a new RoleClone 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 NewRoleClone(attributes RoleCloneAttributes, typeVar RolesType) *RoleClone { + this := RoleClone{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewRoleCloneWithDefaults instantiates a new RoleClone 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 NewRoleCloneWithDefaults() *RoleClone { + this := RoleClone{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RoleClone) GetAttributes() RoleCloneAttributes { + if o == nil { + var ret RoleCloneAttributes + 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 *RoleClone) GetAttributesOk() (*RoleCloneAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RoleClone) SetAttributes(v RoleCloneAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *RoleClone) GetType() RolesType { + if o == nil { + var ret RolesType + 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 *RoleClone) GetTypeOk() (*RolesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RoleClone) SetType(v RolesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleClone) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleClone) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *RoleCloneAttributes `json:"attributes"` + Type *RolesType `json:"type"` + }{} + all := struct { + Attributes RoleCloneAttributes `json:"attributes"` + Type RolesType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_role_clone_attributes.go b/api/v2/datadog/model_role_clone_attributes.go new file mode 100644 index 00000000000..285ed01606b --- /dev/null +++ b/api/v2/datadog/model_role_clone_attributes.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleCloneAttributes Attributes required to create a new role by cloning an existing one. +type RoleCloneAttributes struct { + // Name of the new role that is cloned. + Name string `json:"name"` + // 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{} +} + +// NewRoleCloneAttributes instantiates a new RoleCloneAttributes 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 NewRoleCloneAttributes(name string) *RoleCloneAttributes { + this := RoleCloneAttributes{} + this.Name = name + return &this +} + +// NewRoleCloneAttributesWithDefaults instantiates a new RoleCloneAttributes 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 NewRoleCloneAttributesWithDefaults() *RoleCloneAttributes { + this := RoleCloneAttributes{} + return &this +} + +// GetName returns the Name field value. +func (o *RoleCloneAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RoleCloneAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RoleCloneAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleCloneAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_role_clone_request.go b/api/v2/datadog/model_role_clone_request.go new file mode 100644 index 00000000000..386472a120b --- /dev/null +++ b/api/v2/datadog/model_role_clone_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleCloneRequest Request to create a role by cloning an existing role. +type RoleCloneRequest struct { + // Data for the clone role request. + Data RoleClone `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{} +} + +// NewRoleCloneRequest instantiates a new RoleCloneRequest 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 NewRoleCloneRequest(data RoleClone) *RoleCloneRequest { + this := RoleCloneRequest{} + this.Data = data + return &this +} + +// NewRoleCloneRequestWithDefaults instantiates a new RoleCloneRequest 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 NewRoleCloneRequestWithDefaults() *RoleCloneRequest { + this := RoleCloneRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RoleCloneRequest) GetData() RoleClone { + if o == nil { + var ret RoleClone + 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 *RoleCloneRequest) GetDataOk() (*RoleClone, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RoleCloneRequest) SetData(v RoleClone) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleCloneRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleCloneRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *RoleClone `json:"data"` + }{} + all := struct { + Data RoleClone `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_role_create_attributes.go b/api/v2/datadog/model_role_create_attributes.go new file mode 100644 index 00000000000..37e5911269c --- /dev/null +++ b/api/v2/datadog/model_role_create_attributes.go @@ -0,0 +1,190 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" + "time" +) + +// RoleCreateAttributes Attributes of the created role. +type RoleCreateAttributes struct { + // Creation time of the role. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Time of last role modification. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // Name of the role. + Name string `json:"name"` + // 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{} +} + +// NewRoleCreateAttributes instantiates a new RoleCreateAttributes 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 NewRoleCreateAttributes(name string) *RoleCreateAttributes { + this := RoleCreateAttributes{} + this.Name = name + return &this +} + +// NewRoleCreateAttributesWithDefaults instantiates a new RoleCreateAttributes 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 NewRoleCreateAttributesWithDefaults() *RoleCreateAttributes { + this := RoleCreateAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *RoleCreateAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *RoleCreateAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *RoleCreateAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *RoleCreateAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *RoleCreateAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *RoleCreateAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value. +func (o *RoleCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RoleCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *RoleCreateAttributes) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + }{} + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name string `json:"name"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_role_create_data.go b/api/v2/datadog/model_role_create_data.go new file mode 100644 index 00000000000..ab7b20381bc --- /dev/null +++ b/api/v2/datadog/model_role_create_data.go @@ -0,0 +1,207 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleCreateData Data related to the creation of a role. +type RoleCreateData struct { + // Attributes of the created role. + Attributes RoleCreateAttributes `json:"attributes"` + // Relationships of the role object. + Relationships *RoleRelationships `json:"relationships,omitempty"` + // Roles type. + Type *RolesType `json:"type,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{} +} + +// NewRoleCreateData instantiates a new RoleCreateData 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 NewRoleCreateData(attributes RoleCreateAttributes) *RoleCreateData { + this := RoleCreateData{} + this.Attributes = attributes + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = &typeVar + return &this +} + +// NewRoleCreateDataWithDefaults instantiates a new RoleCreateData 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 NewRoleCreateDataWithDefaults() *RoleCreateData { + this := RoleCreateData{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RoleCreateData) GetAttributes() RoleCreateAttributes { + if o == nil { + var ret RoleCreateAttributes + 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 *RoleCreateData) GetAttributesOk() (*RoleCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RoleCreateData) SetAttributes(v RoleCreateAttributes) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *RoleCreateData) GetRelationships() RoleRelationships { + if o == nil || o.Relationships == nil { + var ret RoleRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateData) GetRelationshipsOk() (*RoleRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *RoleCreateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given RoleRelationships and assigns it to the Relationships field. +func (o *RoleCreateData) SetRelationships(v RoleRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RoleCreateData) GetType() RolesType { + if o == nil || o.Type == nil { + var ret RolesType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateData) GetTypeOk() (*RolesType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RoleCreateData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given RolesType and assigns it to the Type field. +func (o *RoleCreateData) SetType(v RolesType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *RoleCreateAttributes `json:"attributes"` + }{} + all := struct { + Attributes RoleCreateAttributes `json:"attributes"` + Relationships *RoleRelationships `json:"relationships,omitempty"` + Type *RolesType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_role_create_request.go b/api/v2/datadog/model_role_create_request.go new file mode 100644 index 00000000000..270049d619b --- /dev/null +++ b/api/v2/datadog/model_role_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleCreateRequest Create a role. +type RoleCreateRequest struct { + // Data related to the creation of a role. + Data RoleCreateData `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{} +} + +// NewRoleCreateRequest instantiates a new RoleCreateRequest 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 NewRoleCreateRequest(data RoleCreateData) *RoleCreateRequest { + this := RoleCreateRequest{} + this.Data = data + return &this +} + +// NewRoleCreateRequestWithDefaults instantiates a new RoleCreateRequest 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 NewRoleCreateRequestWithDefaults() *RoleCreateRequest { + this := RoleCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RoleCreateRequest) GetData() RoleCreateData { + if o == nil { + var ret RoleCreateData + 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 *RoleCreateRequest) GetDataOk() (*RoleCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RoleCreateRequest) SetData(v RoleCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *RoleCreateData `json:"data"` + }{} + all := struct { + Data RoleCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_role_create_response.go b/api/v2/datadog/model_role_create_response.go new file mode 100644 index 00000000000..dec56e76344 --- /dev/null +++ b/api/v2/datadog/model_role_create_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RoleCreateResponse Response containing information about a created role. +type RoleCreateResponse struct { + // Role object returned by the API. + Data *RoleCreateResponseData `json:"data,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{} +} + +// NewRoleCreateResponse instantiates a new RoleCreateResponse 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 NewRoleCreateResponse() *RoleCreateResponse { + this := RoleCreateResponse{} + return &this +} + +// NewRoleCreateResponseWithDefaults instantiates a new RoleCreateResponse 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 NewRoleCreateResponseWithDefaults() *RoleCreateResponse { + this := RoleCreateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RoleCreateResponse) GetData() RoleCreateResponseData { + if o == nil || o.Data == nil { + var ret RoleCreateResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateResponse) GetDataOk() (*RoleCreateResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RoleCreateResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given RoleCreateResponseData and assigns it to the Data field. +func (o *RoleCreateResponse) SetData(v RoleCreateResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleCreateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *RoleCreateResponseData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_role_create_response_data.go b/api/v2/datadog/model_role_create_response_data.go new file mode 100644 index 00000000000..a35d302351a --- /dev/null +++ b/api/v2/datadog/model_role_create_response_data.go @@ -0,0 +1,244 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleCreateResponseData Role object returned by the API. +type RoleCreateResponseData struct { + // Attributes of the created role. + Attributes *RoleCreateAttributes `json:"attributes,omitempty"` + // The unique identifier of the role. + Id *string `json:"id,omitempty"` + // Relationships of the role object returned by the API. + Relationships *RoleResponseRelationships `json:"relationships,omitempty"` + // Roles type. + Type RolesType `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{} +} + +// NewRoleCreateResponseData instantiates a new RoleCreateResponseData 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 NewRoleCreateResponseData(typeVar RolesType) *RoleCreateResponseData { + this := RoleCreateResponseData{} + this.Type = typeVar + return &this +} + +// NewRoleCreateResponseDataWithDefaults instantiates a new RoleCreateResponseData 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 NewRoleCreateResponseDataWithDefaults() *RoleCreateResponseData { + this := RoleCreateResponseData{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RoleCreateResponseData) GetAttributes() RoleCreateAttributes { + if o == nil || o.Attributes == nil { + var ret RoleCreateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateResponseData) GetAttributesOk() (*RoleCreateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RoleCreateResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given RoleCreateAttributes and assigns it to the Attributes field. +func (o *RoleCreateResponseData) SetAttributes(v RoleCreateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RoleCreateResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RoleCreateResponseData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RoleCreateResponseData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *RoleCreateResponseData) GetRelationships() RoleResponseRelationships { + if o == nil || o.Relationships == nil { + var ret RoleResponseRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleCreateResponseData) GetRelationshipsOk() (*RoleResponseRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *RoleCreateResponseData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given RoleResponseRelationships and assigns it to the Relationships field. +func (o *RoleCreateResponseData) SetRelationships(v RoleResponseRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *RoleCreateResponseData) GetType() RolesType { + if o == nil { + var ret RolesType + 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 *RoleCreateResponseData) GetTypeOk() (*RolesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RoleCreateResponseData) SetType(v RolesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleCreateResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *RolesType `json:"type"` + }{} + all := struct { + Attributes *RoleCreateAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *RoleResponseRelationships `json:"relationships,omitempty"` + Type RolesType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_role_relationships.go b/api/v2/datadog/model_role_relationships.go new file mode 100644 index 00000000000..e406f726930 --- /dev/null +++ b/api/v2/datadog/model_role_relationships.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RoleRelationships Relationships of the role object. +type RoleRelationships struct { + // Relationship to multiple permissions objects. + Permissions *RelationshipToPermissions `json:"permissions,omitempty"` + // Relationship to users. + Users *RelationshipToUsers `json:"users,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{} +} + +// NewRoleRelationships instantiates a new RoleRelationships 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 NewRoleRelationships() *RoleRelationships { + this := RoleRelationships{} + return &this +} + +// NewRoleRelationshipsWithDefaults instantiates a new RoleRelationships 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 NewRoleRelationshipsWithDefaults() *RoleRelationships { + this := RoleRelationships{} + return &this +} + +// GetPermissions returns the Permissions field value if set, zero value otherwise. +func (o *RoleRelationships) GetPermissions() RelationshipToPermissions { + if o == nil || o.Permissions == nil { + var ret RelationshipToPermissions + return ret + } + return *o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleRelationships) GetPermissionsOk() (*RelationshipToPermissions, bool) { + if o == nil || o.Permissions == nil { + return nil, false + } + return o.Permissions, true +} + +// HasPermissions returns a boolean if a field has been set. +func (o *RoleRelationships) HasPermissions() bool { + if o != nil && o.Permissions != nil { + return true + } + + return false +} + +// SetPermissions gets a reference to the given RelationshipToPermissions and assigns it to the Permissions field. +func (o *RoleRelationships) SetPermissions(v RelationshipToPermissions) { + o.Permissions = &v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *RoleRelationships) GetUsers() RelationshipToUsers { + if o == nil || o.Users == nil { + var ret RelationshipToUsers + return ret + } + return *o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleRelationships) GetUsersOk() (*RelationshipToUsers, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *RoleRelationships) HasUsers() bool { + if o != nil && o.Users != nil { + return true + } + + return false +} + +// SetUsers gets a reference to the given RelationshipToUsers and assigns it to the Users field. +func (o *RoleRelationships) SetUsers(v RelationshipToUsers) { + o.Users = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Permissions != nil { + toSerialize["permissions"] = o.Permissions + } + if o.Users != nil { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Permissions *RelationshipToPermissions `json:"permissions,omitempty"` + Users *RelationshipToUsers `json:"users,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Permissions != nil && all.Permissions.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Permissions = all.Permissions + if all.Users != nil && all.Users.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Users = all.Users + return nil +} diff --git a/api/v2/datadog/model_role_response.go b/api/v2/datadog/model_role_response.go new file mode 100644 index 00000000000..0e54a41968b --- /dev/null +++ b/api/v2/datadog/model_role_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RoleResponse Response containing information about a single role. +type RoleResponse struct { + // Role object returned by the API. + Data *Role `json:"data,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{} +} + +// NewRoleResponse instantiates a new RoleResponse 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 NewRoleResponse() *RoleResponse { + this := RoleResponse{} + return &this +} + +// NewRoleResponseWithDefaults instantiates a new RoleResponse 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 NewRoleResponseWithDefaults() *RoleResponse { + this := RoleResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RoleResponse) GetData() Role { + if o == nil || o.Data == nil { + var ret Role + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleResponse) GetDataOk() (*Role, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RoleResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given Role and assigns it to the Data field. +func (o *RoleResponse) SetData(v Role) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *Role `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_role_response_relationships.go b/api/v2/datadog/model_role_response_relationships.go new file mode 100644 index 00000000000..9a78b0bfa4a --- /dev/null +++ b/api/v2/datadog/model_role_response_relationships.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RoleResponseRelationships Relationships of the role object returned by the API. +type RoleResponseRelationships struct { + // Relationship to multiple permissions objects. + Permissions *RelationshipToPermissions `json:"permissions,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{} +} + +// NewRoleResponseRelationships instantiates a new RoleResponseRelationships 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 NewRoleResponseRelationships() *RoleResponseRelationships { + this := RoleResponseRelationships{} + return &this +} + +// NewRoleResponseRelationshipsWithDefaults instantiates a new RoleResponseRelationships 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 NewRoleResponseRelationshipsWithDefaults() *RoleResponseRelationships { + this := RoleResponseRelationships{} + return &this +} + +// GetPermissions returns the Permissions field value if set, zero value otherwise. +func (o *RoleResponseRelationships) GetPermissions() RelationshipToPermissions { + if o == nil || o.Permissions == nil { + var ret RelationshipToPermissions + return ret + } + return *o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleResponseRelationships) GetPermissionsOk() (*RelationshipToPermissions, bool) { + if o == nil || o.Permissions == nil { + return nil, false + } + return o.Permissions, true +} + +// HasPermissions returns a boolean if a field has been set. +func (o *RoleResponseRelationships) HasPermissions() bool { + if o != nil && o.Permissions != nil { + return true + } + + return false +} + +// SetPermissions gets a reference to the given RelationshipToPermissions and assigns it to the Permissions field. +func (o *RoleResponseRelationships) SetPermissions(v RelationshipToPermissions) { + o.Permissions = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleResponseRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Permissions != nil { + toSerialize["permissions"] = o.Permissions + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Permissions *RelationshipToPermissions `json:"permissions,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Permissions != nil && all.Permissions.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Permissions = all.Permissions + return nil +} diff --git a/api/v2/datadog/model_role_update_attributes.go b/api/v2/datadog/model_role_update_attributes.go new file mode 100644 index 00000000000..bde7c9959b0 --- /dev/null +++ b/api/v2/datadog/model_role_update_attributes.go @@ -0,0 +1,189 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// RoleUpdateAttributes Attributes of the role. +type RoleUpdateAttributes struct { + // Creation time of the role. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Time of last role modification. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // Name of the role. + Name *string `json:"name,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{} +} + +// NewRoleUpdateAttributes instantiates a new RoleUpdateAttributes 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 NewRoleUpdateAttributes() *RoleUpdateAttributes { + this := RoleUpdateAttributes{} + return &this +} + +// NewRoleUpdateAttributesWithDefaults instantiates a new RoleUpdateAttributes 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 NewRoleUpdateAttributesWithDefaults() *RoleUpdateAttributes { + this := RoleUpdateAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *RoleUpdateAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *RoleUpdateAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *RoleUpdateAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *RoleUpdateAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *RoleUpdateAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *RoleUpdateAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RoleUpdateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RoleUpdateAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RoleUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_role_update_data.go b/api/v2/datadog/model_role_update_data.go new file mode 100644 index 00000000000..9af2d0808cb --- /dev/null +++ b/api/v2/datadog/model_role_update_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleUpdateData Data related to the update of a role. +type RoleUpdateData struct { + // Attributes of the role. + Attributes RoleUpdateAttributes `json:"attributes"` + // The unique identifier of the role. + Id string `json:"id"` + // Roles type. + Type RolesType `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{} +} + +// NewRoleUpdateData instantiates a new RoleUpdateData 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 NewRoleUpdateData(attributes RoleUpdateAttributes, id string, typeVar RolesType) *RoleUpdateData { + this := RoleUpdateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewRoleUpdateDataWithDefaults instantiates a new RoleUpdateData 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 NewRoleUpdateDataWithDefaults() *RoleUpdateData { + this := RoleUpdateData{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RoleUpdateData) GetAttributes() RoleUpdateAttributes { + if o == nil { + var ret RoleUpdateAttributes + 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 *RoleUpdateData) GetAttributesOk() (*RoleUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RoleUpdateData) SetAttributes(v RoleUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *RoleUpdateData) 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 *RoleUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RoleUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RoleUpdateData) GetType() RolesType { + if o == nil { + var ret RolesType + 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 *RoleUpdateData) GetTypeOk() (*RolesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RoleUpdateData) SetType(v RolesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *RoleUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *RolesType `json:"type"` + }{} + all := struct { + Attributes RoleUpdateAttributes `json:"attributes"` + Id string `json:"id"` + Type RolesType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_role_update_request.go b/api/v2/datadog/model_role_update_request.go new file mode 100644 index 00000000000..efd22b877f1 --- /dev/null +++ b/api/v2/datadog/model_role_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleUpdateRequest Update a role. +type RoleUpdateRequest struct { + // Data related to the update of a role. + Data RoleUpdateData `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{} +} + +// NewRoleUpdateRequest instantiates a new RoleUpdateRequest 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 NewRoleUpdateRequest(data RoleUpdateData) *RoleUpdateRequest { + this := RoleUpdateRequest{} + this.Data = data + return &this +} + +// NewRoleUpdateRequestWithDefaults instantiates a new RoleUpdateRequest 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 NewRoleUpdateRequestWithDefaults() *RoleUpdateRequest { + this := RoleUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *RoleUpdateRequest) GetData() RoleUpdateData { + if o == nil { + var ret RoleUpdateData + 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 *RoleUpdateRequest) GetDataOk() (*RoleUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *RoleUpdateRequest) SetData(v RoleUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *RoleUpdateData `json:"data"` + }{} + all := struct { + Data RoleUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_role_update_response.go b/api/v2/datadog/model_role_update_response.go new file mode 100644 index 00000000000..5e06041aac8 --- /dev/null +++ b/api/v2/datadog/model_role_update_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RoleUpdateResponse Response containing information about an updated role. +type RoleUpdateResponse struct { + // Role object returned by the API. + Data *RoleUpdateResponseData `json:"data,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{} +} + +// NewRoleUpdateResponse instantiates a new RoleUpdateResponse 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 NewRoleUpdateResponse() *RoleUpdateResponse { + this := RoleUpdateResponse{} + return &this +} + +// NewRoleUpdateResponseWithDefaults instantiates a new RoleUpdateResponse 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 NewRoleUpdateResponseWithDefaults() *RoleUpdateResponse { + this := RoleUpdateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RoleUpdateResponse) GetData() RoleUpdateResponseData { + if o == nil || o.Data == nil { + var ret RoleUpdateResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateResponse) GetDataOk() (*RoleUpdateResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RoleUpdateResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given RoleUpdateResponseData and assigns it to the Data field. +func (o *RoleUpdateResponse) SetData(v RoleUpdateResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleUpdateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *RoleUpdateResponseData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_role_update_response_data.go b/api/v2/datadog/model_role_update_response_data.go new file mode 100644 index 00000000000..666fc605569 --- /dev/null +++ b/api/v2/datadog/model_role_update_response_data.go @@ -0,0 +1,244 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RoleUpdateResponseData Role object returned by the API. +type RoleUpdateResponseData struct { + // Attributes of the role. + Attributes *RoleUpdateAttributes `json:"attributes,omitempty"` + // The unique identifier of the role. + Id *string `json:"id,omitempty"` + // Relationships of the role object returned by the API. + Relationships *RoleResponseRelationships `json:"relationships,omitempty"` + // Roles type. + Type RolesType `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{} +} + +// NewRoleUpdateResponseData instantiates a new RoleUpdateResponseData 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 NewRoleUpdateResponseData(typeVar RolesType) *RoleUpdateResponseData { + this := RoleUpdateResponseData{} + this.Type = typeVar + return &this +} + +// NewRoleUpdateResponseDataWithDefaults instantiates a new RoleUpdateResponseData 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 NewRoleUpdateResponseDataWithDefaults() *RoleUpdateResponseData { + this := RoleUpdateResponseData{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RoleUpdateResponseData) GetAttributes() RoleUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret RoleUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateResponseData) GetAttributesOk() (*RoleUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RoleUpdateResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given RoleUpdateAttributes and assigns it to the Attributes field. +func (o *RoleUpdateResponseData) SetAttributes(v RoleUpdateAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RoleUpdateResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RoleUpdateResponseData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RoleUpdateResponseData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *RoleUpdateResponseData) GetRelationships() RoleResponseRelationships { + if o == nil || o.Relationships == nil { + var ret RoleResponseRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateResponseData) GetRelationshipsOk() (*RoleResponseRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *RoleUpdateResponseData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given RoleResponseRelationships and assigns it to the Relationships field. +func (o *RoleUpdateResponseData) SetRelationships(v RoleResponseRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *RoleUpdateResponseData) GetType() RolesType { + if o == nil { + var ret RolesType + 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 *RoleUpdateResponseData) GetTypeOk() (*RolesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RoleUpdateResponseData) SetType(v RolesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RoleUpdateResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Type *RolesType `json:"type"` + }{} + all := struct { + Attributes *RoleUpdateAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *RoleResponseRelationships `json:"relationships,omitempty"` + Type RolesType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_roles_response.go b/api/v2/datadog/model_roles_response.go new file mode 100644 index 00000000000..bb901f98c5c --- /dev/null +++ b/api/v2/datadog/model_roles_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 datadog + +import ( + "encoding/json" +) + +// RolesResponse Response containing information about multiple roles. +type RolesResponse struct { + // Array of returned roles. + Data []Role `json:"data,omitempty"` + // Object describing meta attributes of response. + Meta *ResponseMetaAttributes `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{} +} + +// NewRolesResponse instantiates a new RolesResponse 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 NewRolesResponse() *RolesResponse { + this := RolesResponse{} + return &this +} + +// NewRolesResponseWithDefaults instantiates a new RolesResponse 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 NewRolesResponseWithDefaults() *RolesResponse { + this := RolesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RolesResponse) GetData() []Role { + if o == nil || o.Data == nil { + var ret []Role + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RolesResponse) GetDataOk() (*[]Role, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RolesResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []Role and assigns it to the Data field. +func (o *RolesResponse) SetData(v []Role) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *RolesResponse) GetMeta() ResponseMetaAttributes { + if o == nil || o.Meta == nil { + var ret ResponseMetaAttributes + 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 *RolesResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *RolesResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. +func (o *RolesResponse) SetMeta(v ResponseMetaAttributes) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RolesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RolesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []Role `json:"data,omitempty"` + Meta *ResponseMetaAttributes `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_roles_sort.go b/api/v2/datadog/model_roles_sort.go new file mode 100644 index 00000000000..44c78b29014 --- /dev/null +++ b/api/v2/datadog/model_roles_sort.go @@ -0,0 +1,117 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RolesSort Sorting options for roles. +type RolesSort string + +// List of RolesSort. +const ( + ROLESSORT_NAME_ASCENDING RolesSort = "name" + ROLESSORT_NAME_DESCENDING RolesSort = "-name" + ROLESSORT_MODIFIED_AT_ASCENDING RolesSort = "modified_at" + ROLESSORT_MODIFIED_AT_DESCENDING RolesSort = "-modified_at" + ROLESSORT_USER_COUNT_ASCENDING RolesSort = "user_count" + ROLESSORT_USER_COUNT_DESCENDING RolesSort = "-user_count" +) + +var allowedRolesSortEnumValues = []RolesSort{ + ROLESSORT_NAME_ASCENDING, + ROLESSORT_NAME_DESCENDING, + ROLESSORT_MODIFIED_AT_ASCENDING, + ROLESSORT_MODIFIED_AT_DESCENDING, + ROLESSORT_USER_COUNT_ASCENDING, + ROLESSORT_USER_COUNT_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RolesSort) GetAllowedValues() []RolesSort { + return allowedRolesSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RolesSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RolesSort(value) + return nil +} + +// NewRolesSortFromValue returns a pointer to a valid RolesSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRolesSortFromValue(v string) (*RolesSort, error) { + ev := RolesSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RolesSort: valid values are %v", v, allowedRolesSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RolesSort) IsValid() bool { + for _, existing := range allowedRolesSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RolesSort value. +func (v RolesSort) Ptr() *RolesSort { + return &v +} + +// NullableRolesSort handles when a null is used for RolesSort. +type NullableRolesSort struct { + value *RolesSort + isSet bool +} + +// Get returns the associated value. +func (v NullableRolesSort) Get() *RolesSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRolesSort) Set(val *RolesSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRolesSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRolesSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRolesSort initializes the struct as if Set has been called. +func NewNullableRolesSort(val *RolesSort) *NullableRolesSort { + return &NullableRolesSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRolesSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRolesSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_roles_type.go b/api/v2/datadog/model_roles_type.go new file mode 100644 index 00000000000..9733b5927f7 --- /dev/null +++ b/api/v2/datadog/model_roles_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RolesType Roles type. +type RolesType string + +// List of RolesType. +const ( + ROLESTYPE_ROLES RolesType = "roles" +) + +var allowedRolesTypeEnumValues = []RolesType{ + ROLESTYPE_ROLES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RolesType) GetAllowedValues() []RolesType { + return allowedRolesTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RolesType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RolesType(value) + return nil +} + +// NewRolesTypeFromValue returns a pointer to a valid RolesType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRolesTypeFromValue(v string) (*RolesType, error) { + ev := RolesType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RolesType: valid values are %v", v, allowedRolesTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RolesType) IsValid() bool { + for _, existing := range allowedRolesTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RolesType value. +func (v RolesType) Ptr() *RolesType { + return &v +} + +// NullableRolesType handles when a null is used for RolesType. +type NullableRolesType struct { + value *RolesType + isSet bool +} + +// Get returns the associated value. +func (v NullableRolesType) Get() *RolesType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRolesType) Set(val *RolesType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRolesType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRolesType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRolesType initializes the struct as if Set has been called. +func NewNullableRolesType(val *RolesType) *NullableRolesType { + return &NullableRolesType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRolesType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRolesType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_aggregate_bucket_value.go b/api/v2/datadog/model_rum_aggregate_bucket_value.go new file mode 100644 index 00000000000..73c13fee9fe --- /dev/null +++ b/api/v2/datadog/model_rum_aggregate_bucket_value.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMAggregateBucketValue - A bucket value, can be either a timeseries or a single value. +type RUMAggregateBucketValue struct { + RUMAggregateBucketValueSingleString *string + RUMAggregateBucketValueSingleNumber *float64 + RUMAggregateBucketValueTimeseries *RUMAggregateBucketValueTimeseries + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// RUMAggregateBucketValueSingleStringAsRUMAggregateBucketValue is a convenience function that returns string wrapped in RUMAggregateBucketValue. +func RUMAggregateBucketValueSingleStringAsRUMAggregateBucketValue(v *string) RUMAggregateBucketValue { + return RUMAggregateBucketValue{RUMAggregateBucketValueSingleString: v} +} + +// RUMAggregateBucketValueSingleNumberAsRUMAggregateBucketValue is a convenience function that returns float64 wrapped in RUMAggregateBucketValue. +func RUMAggregateBucketValueSingleNumberAsRUMAggregateBucketValue(v *float64) RUMAggregateBucketValue { + return RUMAggregateBucketValue{RUMAggregateBucketValueSingleNumber: v} +} + +// RUMAggregateBucketValueTimeseriesAsRUMAggregateBucketValue is a convenience function that returns RUMAggregateBucketValueTimeseries wrapped in RUMAggregateBucketValue. +func RUMAggregateBucketValueTimeseriesAsRUMAggregateBucketValue(v *RUMAggregateBucketValueTimeseries) RUMAggregateBucketValue { + return RUMAggregateBucketValue{RUMAggregateBucketValueTimeseries: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *RUMAggregateBucketValue) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into RUMAggregateBucketValueSingleString + err = json.Unmarshal(data, &obj.RUMAggregateBucketValueSingleString) + if err == nil { + if obj.RUMAggregateBucketValueSingleString != nil { + jsonRUMAggregateBucketValueSingleString, _ := json.Marshal(obj.RUMAggregateBucketValueSingleString) + if string(jsonRUMAggregateBucketValueSingleString) == "{}" { // empty struct + obj.RUMAggregateBucketValueSingleString = nil + } else { + match++ + } + } else { + obj.RUMAggregateBucketValueSingleString = nil + } + } else { + obj.RUMAggregateBucketValueSingleString = nil + } + + // try to unmarshal data into RUMAggregateBucketValueSingleNumber + err = json.Unmarshal(data, &obj.RUMAggregateBucketValueSingleNumber) + if err == nil { + if obj.RUMAggregateBucketValueSingleNumber != nil { + jsonRUMAggregateBucketValueSingleNumber, _ := json.Marshal(obj.RUMAggregateBucketValueSingleNumber) + if string(jsonRUMAggregateBucketValueSingleNumber) == "{}" { // empty struct + obj.RUMAggregateBucketValueSingleNumber = nil + } else { + match++ + } + } else { + obj.RUMAggregateBucketValueSingleNumber = nil + } + } else { + obj.RUMAggregateBucketValueSingleNumber = nil + } + + // try to unmarshal data into RUMAggregateBucketValueTimeseries + err = json.Unmarshal(data, &obj.RUMAggregateBucketValueTimeseries) + if err == nil { + if obj.RUMAggregateBucketValueTimeseries != nil { + jsonRUMAggregateBucketValueTimeseries, _ := json.Marshal(obj.RUMAggregateBucketValueTimeseries) + if string(jsonRUMAggregateBucketValueTimeseries) == "{}" { // empty struct + obj.RUMAggregateBucketValueTimeseries = nil + } else { + match++ + } + } else { + obj.RUMAggregateBucketValueTimeseries = nil + } + } else { + obj.RUMAggregateBucketValueTimeseries = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.RUMAggregateBucketValueSingleString = nil + obj.RUMAggregateBucketValueSingleNumber = nil + obj.RUMAggregateBucketValueTimeseries = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj RUMAggregateBucketValue) MarshalJSON() ([]byte, error) { + if obj.RUMAggregateBucketValueSingleString != nil { + return json.Marshal(&obj.RUMAggregateBucketValueSingleString) + } + + if obj.RUMAggregateBucketValueSingleNumber != nil { + return json.Marshal(&obj.RUMAggregateBucketValueSingleNumber) + } + + if obj.RUMAggregateBucketValueTimeseries != nil { + return json.Marshal(&obj.RUMAggregateBucketValueTimeseries) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *RUMAggregateBucketValue) GetActualInstance() interface{} { + if obj.RUMAggregateBucketValueSingleString != nil { + return obj.RUMAggregateBucketValueSingleString + } + + if obj.RUMAggregateBucketValueSingleNumber != nil { + return obj.RUMAggregateBucketValueSingleNumber + } + + if obj.RUMAggregateBucketValueTimeseries != nil { + return obj.RUMAggregateBucketValueTimeseries + } + + // all schemas are nil + return nil +} + +// NullableRUMAggregateBucketValue handles when a null is used for RUMAggregateBucketValue. +type NullableRUMAggregateBucketValue struct { + value *RUMAggregateBucketValue + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMAggregateBucketValue) Get() *RUMAggregateBucketValue { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMAggregateBucketValue) Set(val *RUMAggregateBucketValue) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMAggregateBucketValue) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableRUMAggregateBucketValue) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMAggregateBucketValue initializes the struct as if Set has been called. +func NewNullableRUMAggregateBucketValue(val *RUMAggregateBucketValue) *NullableRUMAggregateBucketValue { + return &NullableRUMAggregateBucketValue{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMAggregateBucketValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMAggregateBucketValue) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go b/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go new file mode 100644 index 00000000000..fa8bee3d0a3 --- /dev/null +++ b/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries.go @@ -0,0 +1,51 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMAggregateBucketValueTimeseries A timeseries array. +type RUMAggregateBucketValueTimeseries struct { + Items []RUMAggregateBucketValueTimeseriesPoint + + // UnparsedObject contains the raw value of the array if there was an error when deserializing into the struct + UnparsedObject []interface{} `json:-` +} + +// NewRUMAggregateBucketValueTimeseries instantiates a new RUMAggregateBucketValueTimeseries 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 NewRUMAggregateBucketValueTimeseries() *RUMAggregateBucketValueTimeseries { + this := RUMAggregateBucketValueTimeseries{} + return &this +} + +// NewRUMAggregateBucketValueTimeseriesWithDefaults instantiates a new RUMAggregateBucketValueTimeseries 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 NewRUMAggregateBucketValueTimeseriesWithDefaults() *RUMAggregateBucketValueTimeseries { + this := RUMAggregateBucketValueTimeseries{} + return &this +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMAggregateBucketValueTimeseries) MarshalJSON() ([]byte, error) { + toSerialize := make([]interface{}, len(o.Items)) + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + for i, item := range o.Items { + toSerialize[i] = item + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMAggregateBucketValueTimeseries) UnmarshalJSON(bytes []byte) (err error) { + return json.Unmarshal(bytes, &o.Items) +} diff --git a/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go b/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go new file mode 100644 index 00000000000..c19f9a1970f --- /dev/null +++ b/api/v2/datadog/model_rum_aggregate_bucket_value_timeseries_point.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// RUMAggregateBucketValueTimeseriesPoint A timeseries point. +type RUMAggregateBucketValueTimeseriesPoint struct { + // The time value for this point. + Time *time.Time `json:"time,omitempty"` + // The value for this point. + Value *float64 `json:"value,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{} +} + +// NewRUMAggregateBucketValueTimeseriesPoint instantiates a new RUMAggregateBucketValueTimeseriesPoint 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 NewRUMAggregateBucketValueTimeseriesPoint() *RUMAggregateBucketValueTimeseriesPoint { + this := RUMAggregateBucketValueTimeseriesPoint{} + return &this +} + +// NewRUMAggregateBucketValueTimeseriesPointWithDefaults instantiates a new RUMAggregateBucketValueTimeseriesPoint 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 NewRUMAggregateBucketValueTimeseriesPointWithDefaults() *RUMAggregateBucketValueTimeseriesPoint { + this := RUMAggregateBucketValueTimeseriesPoint{} + return &this +} + +// GetTime returns the Time field value if set, zero value otherwise. +func (o *RUMAggregateBucketValueTimeseriesPoint) GetTime() time.Time { + if o == nil || o.Time == nil { + var ret time.Time + return ret + } + return *o.Time +} + +// GetTimeOk returns a tuple with the Time field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateBucketValueTimeseriesPoint) GetTimeOk() (*time.Time, bool) { + if o == nil || o.Time == nil { + return nil, false + } + return o.Time, true +} + +// HasTime returns a boolean if a field has been set. +func (o *RUMAggregateBucketValueTimeseriesPoint) HasTime() bool { + if o != nil && o.Time != nil { + return true + } + + return false +} + +// SetTime gets a reference to the given time.Time and assigns it to the Time field. +func (o *RUMAggregateBucketValueTimeseriesPoint) SetTime(v time.Time) { + o.Time = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *RUMAggregateBucketValueTimeseriesPoint) GetValue() float64 { + if o == nil || o.Value == nil { + var ret float64 + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateBucketValueTimeseriesPoint) GetValueOk() (*float64, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *RUMAggregateBucketValueTimeseriesPoint) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given float64 and assigns it to the Value field. +func (o *RUMAggregateBucketValueTimeseriesPoint) SetValue(v float64) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMAggregateBucketValueTimeseriesPoint) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Time != nil { + if o.Time.Nanosecond() == 0 { + toSerialize["time"] = o.Time.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["time"] = o.Time.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Time *time.Time `json:"time,omitempty"` + Value *float64 `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Time = all.Time + o.Value = all.Value + return nil +} diff --git a/api/v2/datadog/model_rum_aggregate_request.go b/api/v2/datadog/model_rum_aggregate_request.go new file mode 100644 index 00000000000..ff3580a7cc5 --- /dev/null +++ b/api/v2/datadog/model_rum_aggregate_request.go @@ -0,0 +1,280 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMAggregateRequest The object sent with the request to retrieve aggregation buckets of RUM events from your organization. +type RUMAggregateRequest struct { + // The list of metrics or timeseries to compute for the retrieved buckets. + Compute []RUMCompute `json:"compute,omitempty"` + // The search and filter query settings. + Filter *RUMQueryFilter `json:"filter,omitempty"` + // The rules for the group by. + GroupBy []RUMGroupBy `json:"group_by,omitempty"` + // Global query options that are used during the query. + // Note: Only supply timezone or time offset, not both. Otherwise, the query fails. + Options *RUMQueryOptions `json:"options,omitempty"` + // Paging attributes for listing events. + Page *RUMQueryPageOptions `json:"page,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{} +} + +// NewRUMAggregateRequest instantiates a new RUMAggregateRequest 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 NewRUMAggregateRequest() *RUMAggregateRequest { + this := RUMAggregateRequest{} + return &this +} + +// NewRUMAggregateRequestWithDefaults instantiates a new RUMAggregateRequest 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 NewRUMAggregateRequestWithDefaults() *RUMAggregateRequest { + this := RUMAggregateRequest{} + return &this +} + +// GetCompute returns the Compute field value if set, zero value otherwise. +func (o *RUMAggregateRequest) GetCompute() []RUMCompute { + if o == nil || o.Compute == nil { + var ret []RUMCompute + return ret + } + return o.Compute +} + +// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateRequest) GetComputeOk() (*[]RUMCompute, bool) { + if o == nil || o.Compute == nil { + return nil, false + } + return &o.Compute, true +} + +// HasCompute returns a boolean if a field has been set. +func (o *RUMAggregateRequest) HasCompute() bool { + if o != nil && o.Compute != nil { + return true + } + + return false +} + +// SetCompute gets a reference to the given []RUMCompute and assigns it to the Compute field. +func (o *RUMAggregateRequest) SetCompute(v []RUMCompute) { + o.Compute = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *RUMAggregateRequest) GetFilter() RUMQueryFilter { + if o == nil || o.Filter == nil { + var ret RUMQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateRequest) GetFilterOk() (*RUMQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *RUMAggregateRequest) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given RUMQueryFilter and assigns it to the Filter field. +func (o *RUMAggregateRequest) SetFilter(v RUMQueryFilter) { + o.Filter = &v +} + +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *RUMAggregateRequest) GetGroupBy() []RUMGroupBy { + if o == nil || o.GroupBy == nil { + var ret []RUMGroupBy + return ret + } + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateRequest) GetGroupByOk() (*[]RUMGroupBy, bool) { + if o == nil || o.GroupBy == nil { + return nil, false + } + return &o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *RUMAggregateRequest) HasGroupBy() bool { + if o != nil && o.GroupBy != nil { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given []RUMGroupBy and assigns it to the GroupBy field. +func (o *RUMAggregateRequest) SetGroupBy(v []RUMGroupBy) { + o.GroupBy = v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *RUMAggregateRequest) GetOptions() RUMQueryOptions { + if o == nil || o.Options == nil { + var ret RUMQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateRequest) GetOptionsOk() (*RUMQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *RUMAggregateRequest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given RUMQueryOptions and assigns it to the Options field. +func (o *RUMAggregateRequest) SetOptions(v RUMQueryOptions) { + o.Options = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *RUMAggregateRequest) GetPage() RUMQueryPageOptions { + if o == nil || o.Page == nil { + var ret RUMQueryPageOptions + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateRequest) GetPageOk() (*RUMQueryPageOptions, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *RUMAggregateRequest) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given RUMQueryPageOptions and assigns it to the Page field. +func (o *RUMAggregateRequest) SetPage(v RUMQueryPageOptions) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMAggregateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Compute != nil { + toSerialize["compute"] = o.Compute + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.GroupBy != nil { + toSerialize["group_by"] = o.GroupBy + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Compute []RUMCompute `json:"compute,omitempty"` + Filter *RUMQueryFilter `json:"filter,omitempty"` + GroupBy []RUMGroupBy `json:"group_by,omitempty"` + Options *RUMQueryOptions `json:"options,omitempty"` + Page *RUMQueryPageOptions `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Compute = all.Compute + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + o.GroupBy = all.GroupBy + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v2/datadog/model_rum_aggregate_sort.go b/api/v2/datadog/model_rum_aggregate_sort.go new file mode 100644 index 00000000000..2b3bb88883b --- /dev/null +++ b/api/v2/datadog/model_rum_aggregate_sort.go @@ -0,0 +1,247 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMAggregateSort A sort rule. +type RUMAggregateSort struct { + // An aggregation function. + Aggregation *RUMAggregationFunction `json:"aggregation,omitempty"` + // The metric to sort by (only used for `type=measure`). + Metric *string `json:"metric,omitempty"` + // The order to use, ascending or descending. + Order *RUMSortOrder `json:"order,omitempty"` + // The type of sorting algorithm. + Type *RUMAggregateSortType `json:"type,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{} +} + +// NewRUMAggregateSort instantiates a new RUMAggregateSort 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 NewRUMAggregateSort() *RUMAggregateSort { + this := RUMAggregateSort{} + var typeVar RUMAggregateSortType = RUMAGGREGATESORTTYPE_ALPHABETICAL + this.Type = &typeVar + return &this +} + +// NewRUMAggregateSortWithDefaults instantiates a new RUMAggregateSort 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 NewRUMAggregateSortWithDefaults() *RUMAggregateSort { + this := RUMAggregateSort{} + var typeVar RUMAggregateSortType = RUMAGGREGATESORTTYPE_ALPHABETICAL + this.Type = &typeVar + return &this +} + +// GetAggregation returns the Aggregation field value if set, zero value otherwise. +func (o *RUMAggregateSort) GetAggregation() RUMAggregationFunction { + if o == nil || o.Aggregation == nil { + var ret RUMAggregationFunction + return ret + } + return *o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateSort) GetAggregationOk() (*RUMAggregationFunction, bool) { + if o == nil || o.Aggregation == nil { + return nil, false + } + return o.Aggregation, true +} + +// HasAggregation returns a boolean if a field has been set. +func (o *RUMAggregateSort) HasAggregation() bool { + if o != nil && o.Aggregation != nil { + return true + } + + return false +} + +// SetAggregation gets a reference to the given RUMAggregationFunction and assigns it to the Aggregation field. +func (o *RUMAggregateSort) SetAggregation(v RUMAggregationFunction) { + o.Aggregation = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *RUMAggregateSort) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateSort) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *RUMAggregateSort) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *RUMAggregateSort) SetMetric(v string) { + o.Metric = &v +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *RUMAggregateSort) GetOrder() RUMSortOrder { + if o == nil || o.Order == nil { + var ret RUMSortOrder + return ret + } + return *o.Order +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateSort) GetOrderOk() (*RUMSortOrder, bool) { + if o == nil || o.Order == nil { + return nil, false + } + return o.Order, true +} + +// HasOrder returns a boolean if a field has been set. +func (o *RUMAggregateSort) HasOrder() bool { + if o != nil && o.Order != nil { + return true + } + + return false +} + +// SetOrder gets a reference to the given RUMSortOrder and assigns it to the Order field. +func (o *RUMAggregateSort) SetOrder(v RUMSortOrder) { + o.Order = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RUMAggregateSort) GetType() RUMAggregateSortType { + if o == nil || o.Type == nil { + var ret RUMAggregateSortType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregateSort) GetTypeOk() (*RUMAggregateSortType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RUMAggregateSort) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given RUMAggregateSortType and assigns it to the Type field. +func (o *RUMAggregateSort) SetType(v RUMAggregateSortType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMAggregateSort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregation != nil { + toSerialize["aggregation"] = o.Aggregation + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Order != nil { + toSerialize["order"] = o.Order + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMAggregateSort) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregation *RUMAggregationFunction `json:"aggregation,omitempty"` + Metric *string `json:"metric,omitempty"` + Order *RUMSortOrder `json:"order,omitempty"` + Type *RUMAggregateSortType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Order; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Metric = all.Metric + o.Order = all.Order + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_rum_aggregate_sort_type.go b/api/v2/datadog/model_rum_aggregate_sort_type.go new file mode 100644 index 00000000000..dda387f2fc9 --- /dev/null +++ b/api/v2/datadog/model_rum_aggregate_sort_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMAggregateSortType The type of sorting algorithm. +type RUMAggregateSortType string + +// List of RUMAggregateSortType. +const ( + RUMAGGREGATESORTTYPE_ALPHABETICAL RUMAggregateSortType = "alphabetical" + RUMAGGREGATESORTTYPE_MEASURE RUMAggregateSortType = "measure" +) + +var allowedRUMAggregateSortTypeEnumValues = []RUMAggregateSortType{ + RUMAGGREGATESORTTYPE_ALPHABETICAL, + RUMAGGREGATESORTTYPE_MEASURE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RUMAggregateSortType) GetAllowedValues() []RUMAggregateSortType { + return allowedRUMAggregateSortTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RUMAggregateSortType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RUMAggregateSortType(value) + return nil +} + +// NewRUMAggregateSortTypeFromValue returns a pointer to a valid RUMAggregateSortType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRUMAggregateSortTypeFromValue(v string) (*RUMAggregateSortType, error) { + ev := RUMAggregateSortType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RUMAggregateSortType: valid values are %v", v, allowedRUMAggregateSortTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RUMAggregateSortType) IsValid() bool { + for _, existing := range allowedRUMAggregateSortTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RUMAggregateSortType value. +func (v RUMAggregateSortType) Ptr() *RUMAggregateSortType { + return &v +} + +// NullableRUMAggregateSortType handles when a null is used for RUMAggregateSortType. +type NullableRUMAggregateSortType struct { + value *RUMAggregateSortType + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMAggregateSortType) Get() *RUMAggregateSortType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMAggregateSortType) Set(val *RUMAggregateSortType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMAggregateSortType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRUMAggregateSortType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMAggregateSortType initializes the struct as if Set has been called. +func NewNullableRUMAggregateSortType(val *RUMAggregateSortType) *NullableRUMAggregateSortType { + return &NullableRUMAggregateSortType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMAggregateSortType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMAggregateSortType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_aggregation_buckets_response.go b/api/v2/datadog/model_rum_aggregation_buckets_response.go new file mode 100644 index 00000000000..36a1699f5bf --- /dev/null +++ b/api/v2/datadog/model_rum_aggregation_buckets_response.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 datadog + +import ( + "encoding/json" +) + +// RUMAggregationBucketsResponse The query results. +type RUMAggregationBucketsResponse struct { + // The list of matching buckets, one item per bucket. + Buckets []RUMBucketResponse `json:"buckets,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{} +} + +// NewRUMAggregationBucketsResponse instantiates a new RUMAggregationBucketsResponse 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 NewRUMAggregationBucketsResponse() *RUMAggregationBucketsResponse { + this := RUMAggregationBucketsResponse{} + return &this +} + +// NewRUMAggregationBucketsResponseWithDefaults instantiates a new RUMAggregationBucketsResponse 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 NewRUMAggregationBucketsResponseWithDefaults() *RUMAggregationBucketsResponse { + this := RUMAggregationBucketsResponse{} + return &this +} + +// GetBuckets returns the Buckets field value if set, zero value otherwise. +func (o *RUMAggregationBucketsResponse) GetBuckets() []RUMBucketResponse { + if o == nil || o.Buckets == nil { + var ret []RUMBucketResponse + return ret + } + return o.Buckets +} + +// GetBucketsOk returns a tuple with the Buckets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAggregationBucketsResponse) GetBucketsOk() (*[]RUMBucketResponse, bool) { + if o == nil || o.Buckets == nil { + return nil, false + } + return &o.Buckets, true +} + +// HasBuckets returns a boolean if a field has been set. +func (o *RUMAggregationBucketsResponse) HasBuckets() bool { + if o != nil && o.Buckets != nil { + return true + } + + return false +} + +// SetBuckets gets a reference to the given []RUMBucketResponse and assigns it to the Buckets field. +func (o *RUMAggregationBucketsResponse) SetBuckets(v []RUMBucketResponse) { + o.Buckets = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMAggregationBucketsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Buckets != nil { + toSerialize["buckets"] = o.Buckets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Buckets []RUMBucketResponse `json:"buckets,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Buckets = all.Buckets + return nil +} diff --git a/api/v2/datadog/model_rum_aggregation_function.go b/api/v2/datadog/model_rum_aggregation_function.go new file mode 100644 index 00000000000..6b1eb75bcf8 --- /dev/null +++ b/api/v2/datadog/model_rum_aggregation_function.go @@ -0,0 +1,129 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMAggregationFunction An aggregation function. +type RUMAggregationFunction string + +// List of RUMAggregationFunction. +const ( + RUMAGGREGATIONFUNCTION_COUNT RUMAggregationFunction = "count" + RUMAGGREGATIONFUNCTION_CARDINALITY RUMAggregationFunction = "cardinality" + RUMAGGREGATIONFUNCTION_PERCENTILE_75 RUMAggregationFunction = "pc75" + RUMAGGREGATIONFUNCTION_PERCENTILE_90 RUMAggregationFunction = "pc90" + RUMAGGREGATIONFUNCTION_PERCENTILE_95 RUMAggregationFunction = "pc95" + RUMAGGREGATIONFUNCTION_PERCENTILE_98 RUMAggregationFunction = "pc98" + RUMAGGREGATIONFUNCTION_PERCENTILE_99 RUMAggregationFunction = "pc99" + RUMAGGREGATIONFUNCTION_SUM RUMAggregationFunction = "sum" + RUMAGGREGATIONFUNCTION_MIN RUMAggregationFunction = "min" + RUMAGGREGATIONFUNCTION_MAX RUMAggregationFunction = "max" + RUMAGGREGATIONFUNCTION_AVG RUMAggregationFunction = "avg" + RUMAGGREGATIONFUNCTION_MEDIAN RUMAggregationFunction = "median" +) + +var allowedRUMAggregationFunctionEnumValues = []RUMAggregationFunction{ + RUMAGGREGATIONFUNCTION_COUNT, + RUMAGGREGATIONFUNCTION_CARDINALITY, + RUMAGGREGATIONFUNCTION_PERCENTILE_75, + RUMAGGREGATIONFUNCTION_PERCENTILE_90, + RUMAGGREGATIONFUNCTION_PERCENTILE_95, + RUMAGGREGATIONFUNCTION_PERCENTILE_98, + RUMAGGREGATIONFUNCTION_PERCENTILE_99, + RUMAGGREGATIONFUNCTION_SUM, + RUMAGGREGATIONFUNCTION_MIN, + RUMAGGREGATIONFUNCTION_MAX, + RUMAGGREGATIONFUNCTION_AVG, + RUMAGGREGATIONFUNCTION_MEDIAN, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RUMAggregationFunction) GetAllowedValues() []RUMAggregationFunction { + return allowedRUMAggregationFunctionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RUMAggregationFunction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RUMAggregationFunction(value) + return nil +} + +// NewRUMAggregationFunctionFromValue returns a pointer to a valid RUMAggregationFunction +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRUMAggregationFunctionFromValue(v string) (*RUMAggregationFunction, error) { + ev := RUMAggregationFunction(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RUMAggregationFunction: valid values are %v", v, allowedRUMAggregationFunctionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RUMAggregationFunction) IsValid() bool { + for _, existing := range allowedRUMAggregationFunctionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RUMAggregationFunction value. +func (v RUMAggregationFunction) Ptr() *RUMAggregationFunction { + return &v +} + +// NullableRUMAggregationFunction handles when a null is used for RUMAggregationFunction. +type NullableRUMAggregationFunction struct { + value *RUMAggregationFunction + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMAggregationFunction) Get() *RUMAggregationFunction { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMAggregationFunction) Set(val *RUMAggregationFunction) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMAggregationFunction) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRUMAggregationFunction) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMAggregationFunction initializes the struct as if Set has been called. +func NewNullableRUMAggregationFunction(val *RUMAggregationFunction) *NullableRUMAggregationFunction { + return &NullableRUMAggregationFunction{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMAggregationFunction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMAggregationFunction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_analytics_aggregate_response.go b/api/v2/datadog/model_rum_analytics_aggregate_response.go new file mode 100644 index 00000000000..e1f1beb02dc --- /dev/null +++ b/api/v2/datadog/model_rum_analytics_aggregate_response.go @@ -0,0 +1,201 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMAnalyticsAggregateResponse The response object for the RUM events aggregate API endpoint. +type RUMAnalyticsAggregateResponse struct { + // The query results. + Data *RUMAggregationBucketsResponse `json:"data,omitempty"` + // Links attributes. + Links *RUMResponseLinks `json:"links,omitempty"` + // The metadata associated with a request. + Meta *RUMResponseMetadata `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{} +} + +// NewRUMAnalyticsAggregateResponse instantiates a new RUMAnalyticsAggregateResponse 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 NewRUMAnalyticsAggregateResponse() *RUMAnalyticsAggregateResponse { + this := RUMAnalyticsAggregateResponse{} + return &this +} + +// NewRUMAnalyticsAggregateResponseWithDefaults instantiates a new RUMAnalyticsAggregateResponse 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 NewRUMAnalyticsAggregateResponseWithDefaults() *RUMAnalyticsAggregateResponse { + this := RUMAnalyticsAggregateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RUMAnalyticsAggregateResponse) GetData() RUMAggregationBucketsResponse { + if o == nil || o.Data == nil { + var ret RUMAggregationBucketsResponse + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAnalyticsAggregateResponse) GetDataOk() (*RUMAggregationBucketsResponse, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RUMAnalyticsAggregateResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given RUMAggregationBucketsResponse and assigns it to the Data field. +func (o *RUMAnalyticsAggregateResponse) SetData(v RUMAggregationBucketsResponse) { + o.Data = &v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *RUMAnalyticsAggregateResponse) GetLinks() RUMResponseLinks { + if o == nil || o.Links == nil { + var ret RUMResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMAnalyticsAggregateResponse) GetLinksOk() (*RUMResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *RUMAnalyticsAggregateResponse) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +// SetLinks gets a reference to the given RUMResponseLinks and assigns it to the Links field. +func (o *RUMAnalyticsAggregateResponse) SetLinks(v RUMResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *RUMAnalyticsAggregateResponse) GetMeta() RUMResponseMetadata { + if o == nil || o.Meta == nil { + var ret RUMResponseMetadata + 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 *RUMAnalyticsAggregateResponse) GetMetaOk() (*RUMResponseMetadata, 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 *RUMAnalyticsAggregateResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given RUMResponseMetadata and assigns it to the Meta field. +func (o *RUMAnalyticsAggregateResponse) SetMeta(v RUMResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMAnalyticsAggregateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *RUMAggregationBucketsResponse `json:"data,omitempty"` + Links *RUMResponseLinks `json:"links,omitempty"` + Meta *RUMResponseMetadata `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_rum_bucket_response.go b/api/v2/datadog/model_rum_bucket_response.go new file mode 100644 index 00000000000..8147efbc7de --- /dev/null +++ b/api/v2/datadog/model_rum_bucket_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMBucketResponse Bucket values. +type RUMBucketResponse struct { + // The key-value pairs for each group-by. + By map[string]string `json:"by,omitempty"` + // A map of the metric name to value for regular compute, or a list of values for a timeseries. + Computes map[string]RUMAggregateBucketValue `json:"computes,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{} +} + +// NewRUMBucketResponse instantiates a new RUMBucketResponse 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 NewRUMBucketResponse() *RUMBucketResponse { + this := RUMBucketResponse{} + return &this +} + +// NewRUMBucketResponseWithDefaults instantiates a new RUMBucketResponse 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 NewRUMBucketResponseWithDefaults() *RUMBucketResponse { + this := RUMBucketResponse{} + return &this +} + +// GetBy returns the By field value if set, zero value otherwise. +func (o *RUMBucketResponse) GetBy() map[string]string { + if o == nil || o.By == nil { + var ret map[string]string + return ret + } + return o.By +} + +// GetByOk returns a tuple with the By field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMBucketResponse) GetByOk() (*map[string]string, bool) { + if o == nil || o.By == nil { + return nil, false + } + return &o.By, true +} + +// HasBy returns a boolean if a field has been set. +func (o *RUMBucketResponse) HasBy() bool { + if o != nil && o.By != nil { + return true + } + + return false +} + +// SetBy gets a reference to the given map[string]string and assigns it to the By field. +func (o *RUMBucketResponse) SetBy(v map[string]string) { + o.By = v +} + +// GetComputes returns the Computes field value if set, zero value otherwise. +func (o *RUMBucketResponse) GetComputes() map[string]RUMAggregateBucketValue { + if o == nil || o.Computes == nil { + var ret map[string]RUMAggregateBucketValue + return ret + } + return o.Computes +} + +// GetComputesOk returns a tuple with the Computes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMBucketResponse) GetComputesOk() (*map[string]RUMAggregateBucketValue, bool) { + if o == nil || o.Computes == nil { + return nil, false + } + return &o.Computes, true +} + +// HasComputes returns a boolean if a field has been set. +func (o *RUMBucketResponse) HasComputes() bool { + if o != nil && o.Computes != nil { + return true + } + + return false +} + +// SetComputes gets a reference to the given map[string]RUMAggregateBucketValue and assigns it to the Computes field. +func (o *RUMBucketResponse) SetComputes(v map[string]RUMAggregateBucketValue) { + o.Computes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMBucketResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.By != nil { + toSerialize["by"] = o.By + } + if o.Computes != nil { + toSerialize["computes"] = o.Computes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMBucketResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + By map[string]string `json:"by,omitempty"` + Computes map[string]RUMAggregateBucketValue `json:"computes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.By = all.By + o.Computes = all.Computes + return nil +} diff --git a/api/v2/datadog/model_rum_compute.go b/api/v2/datadog/model_rum_compute.go new file mode 100644 index 00000000000..8be6a04551b --- /dev/null +++ b/api/v2/datadog/model_rum_compute.go @@ -0,0 +1,241 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMCompute A compute rule to compute metrics or timeseries. +type RUMCompute struct { + // An aggregation function. + Aggregation RUMAggregationFunction `json:"aggregation"` + // The time buckets' size (only used for type=timeseries) + // Defaults to a resolution of 150 points. + Interval *string `json:"interval,omitempty"` + // The metric to use. + Metric *string `json:"metric,omitempty"` + // The type of compute. + Type *RUMComputeType `json:"type,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{} +} + +// NewRUMCompute instantiates a new RUMCompute 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 NewRUMCompute(aggregation RUMAggregationFunction) *RUMCompute { + this := RUMCompute{} + this.Aggregation = aggregation + var typeVar RUMComputeType = RUMCOMPUTETYPE_TOTAL + this.Type = &typeVar + return &this +} + +// NewRUMComputeWithDefaults instantiates a new RUMCompute 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 NewRUMComputeWithDefaults() *RUMCompute { + this := RUMCompute{} + var typeVar RUMComputeType = RUMCOMPUTETYPE_TOTAL + this.Type = &typeVar + return &this +} + +// GetAggregation returns the Aggregation field value. +func (o *RUMCompute) GetAggregation() RUMAggregationFunction { + if o == nil { + var ret RUMAggregationFunction + return ret + } + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *RUMCompute) GetAggregationOk() (*RUMAggregationFunction, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value. +func (o *RUMCompute) SetAggregation(v RUMAggregationFunction) { + o.Aggregation = v +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *RUMCompute) GetInterval() string { + if o == nil || o.Interval == nil { + var ret string + return ret + } + return *o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMCompute) GetIntervalOk() (*string, bool) { + if o == nil || o.Interval == nil { + return nil, false + } + return o.Interval, true +} + +// HasInterval returns a boolean if a field has been set. +func (o *RUMCompute) HasInterval() bool { + if o != nil && o.Interval != nil { + return true + } + + return false +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *RUMCompute) SetInterval(v string) { + o.Interval = &v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *RUMCompute) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMCompute) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *RUMCompute) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *RUMCompute) SetMetric(v string) { + o.Metric = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RUMCompute) GetType() RUMComputeType { + if o == nil || o.Type == nil { + var ret RUMComputeType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMCompute) GetTypeOk() (*RUMComputeType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RUMCompute) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given RUMComputeType and assigns it to the Type field. +func (o *RUMCompute) SetType(v RUMComputeType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMCompute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["aggregation"] = o.Aggregation + if o.Interval != nil { + toSerialize["interval"] = o.Interval + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Aggregation *RUMAggregationFunction `json:"aggregation"` + }{} + all := struct { + Aggregation RUMAggregationFunction `json:"aggregation"` + Interval *string `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + Type *RUMComputeType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Aggregation == nil { + return fmt.Errorf("Required field aggregation missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.Interval = all.Interval + o.Metric = all.Metric + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_rum_compute_type.go b/api/v2/datadog/model_rum_compute_type.go new file mode 100644 index 00000000000..54457b96467 --- /dev/null +++ b/api/v2/datadog/model_rum_compute_type.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMComputeType The type of compute. +type RUMComputeType string + +// List of RUMComputeType. +const ( + RUMCOMPUTETYPE_TIMESERIES RUMComputeType = "timeseries" + RUMCOMPUTETYPE_TOTAL RUMComputeType = "total" +) + +var allowedRUMComputeTypeEnumValues = []RUMComputeType{ + RUMCOMPUTETYPE_TIMESERIES, + RUMCOMPUTETYPE_TOTAL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RUMComputeType) GetAllowedValues() []RUMComputeType { + return allowedRUMComputeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RUMComputeType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RUMComputeType(value) + return nil +} + +// NewRUMComputeTypeFromValue returns a pointer to a valid RUMComputeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRUMComputeTypeFromValue(v string) (*RUMComputeType, error) { + ev := RUMComputeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RUMComputeType: valid values are %v", v, allowedRUMComputeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RUMComputeType) IsValid() bool { + for _, existing := range allowedRUMComputeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RUMComputeType value. +func (v RUMComputeType) Ptr() *RUMComputeType { + return &v +} + +// NullableRUMComputeType handles when a null is used for RUMComputeType. +type NullableRUMComputeType struct { + value *RUMComputeType + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMComputeType) Get() *RUMComputeType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMComputeType) Set(val *RUMComputeType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMComputeType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRUMComputeType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMComputeType initializes the struct as if Set has been called. +func NewNullableRUMComputeType(val *RUMComputeType) *NullableRUMComputeType { + return &NullableRUMComputeType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMComputeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMComputeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_event.go b/api/v2/datadog/model_rum_event.go new file mode 100644 index 00000000000..f2191e0ced9 --- /dev/null +++ b/api/v2/datadog/model_rum_event.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMEvent Object description of a RUM event after being processed and stored by Datadog. +type RUMEvent struct { + // JSON object containing all event attributes and their associated values. + Attributes *RUMEventAttributes `json:"attributes,omitempty"` + // Unique ID of the event. + Id *string `json:"id,omitempty"` + // Type of the event. + Type *RUMEventType `json:"type,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{} +} + +// NewRUMEvent instantiates a new RUMEvent 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 NewRUMEvent() *RUMEvent { + this := RUMEvent{} + var typeVar RUMEventType = RUMEVENTTYPE_RUM + this.Type = &typeVar + return &this +} + +// NewRUMEventWithDefaults instantiates a new RUMEvent 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 NewRUMEventWithDefaults() *RUMEvent { + this := RUMEvent{} + var typeVar RUMEventType = RUMEVENTTYPE_RUM + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RUMEvent) GetAttributes() RUMEventAttributes { + if o == nil || o.Attributes == nil { + var ret RUMEventAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMEvent) GetAttributesOk() (*RUMEventAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RUMEvent) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given RUMEventAttributes and assigns it to the Attributes field. +func (o *RUMEvent) SetAttributes(v RUMEventAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RUMEvent) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMEvent) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RUMEvent) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RUMEvent) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RUMEvent) GetType() RUMEventType { + if o == nil || o.Type == nil { + var ret RUMEventType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMEvent) GetTypeOk() (*RUMEventType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RUMEvent) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given RUMEventType and assigns it to the Type field. +func (o *RUMEvent) SetType(v RUMEventType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMEvent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMEvent) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *RUMEventAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *RUMEventType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_rum_event_attributes.go b/api/v2/datadog/model_rum_event_attributes.go new file mode 100644 index 00000000000..b2fa6f049e7 --- /dev/null +++ b/api/v2/datadog/model_rum_event_attributes.go @@ -0,0 +1,226 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// RUMEventAttributes JSON object containing all event attributes and their associated values. +type RUMEventAttributes struct { + // JSON object of attributes from RUM events. + Attributes map[string]interface{} `json:"attributes,omitempty"` + // The name of the application or service generating RUM events. + // It is used to switch from RUM to APM, so make sure you define the same + // value when you use both products. + Service *string `json:"service,omitempty"` + // Array of tags associated with your event. + Tags []string `json:"tags,omitempty"` + // Timestamp of your event. + Timestamp *time.Time `json:"timestamp,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{} +} + +// NewRUMEventAttributes instantiates a new RUMEventAttributes 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 NewRUMEventAttributes() *RUMEventAttributes { + this := RUMEventAttributes{} + return &this +} + +// NewRUMEventAttributesWithDefaults instantiates a new RUMEventAttributes 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 NewRUMEventAttributesWithDefaults() *RUMEventAttributes { + this := RUMEventAttributes{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RUMEventAttributes) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMEventAttributes) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RUMEventAttributes) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *RUMEventAttributes) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + +// GetService returns the Service field value if set, zero value otherwise. +func (o *RUMEventAttributes) 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 *RUMEventAttributes) 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 *RUMEventAttributes) HasService() bool { + if o != nil && o.Service != nil { + return true + } + + return false +} + +// SetService gets a reference to the given string and assigns it to the Service field. +func (o *RUMEventAttributes) SetService(v string) { + o.Service = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *RUMEventAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *RUMEventAttributes) GetTagsOk() (*[]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 *RUMEventAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *RUMEventAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *RUMEventAttributes) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMEventAttributes) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *RUMEventAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *RUMEventAttributes) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMEventAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Service != nil { + toSerialize["service"] = o.Service + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMEventAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` + Service *string `json:"service,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Service = all.Service + o.Tags = all.Tags + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v2/datadog/model_rum_event_type.go b/api/v2/datadog/model_rum_event_type.go new file mode 100644 index 00000000000..e609632b3ca --- /dev/null +++ b/api/v2/datadog/model_rum_event_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMEventType Type of the event. +type RUMEventType string + +// List of RUMEventType. +const ( + RUMEVENTTYPE_RUM RUMEventType = "rum" +) + +var allowedRUMEventTypeEnumValues = []RUMEventType{ + RUMEVENTTYPE_RUM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RUMEventType) GetAllowedValues() []RUMEventType { + return allowedRUMEventTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RUMEventType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RUMEventType(value) + return nil +} + +// NewRUMEventTypeFromValue returns a pointer to a valid RUMEventType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRUMEventTypeFromValue(v string) (*RUMEventType, error) { + ev := RUMEventType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RUMEventType: valid values are %v", v, allowedRUMEventTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RUMEventType) IsValid() bool { + for _, existing := range allowedRUMEventTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RUMEventType value. +func (v RUMEventType) Ptr() *RUMEventType { + return &v +} + +// NullableRUMEventType handles when a null is used for RUMEventType. +type NullableRUMEventType struct { + value *RUMEventType + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMEventType) Get() *RUMEventType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMEventType) Set(val *RUMEventType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMEventType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRUMEventType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMEventType initializes the struct as if Set has been called. +func NewNullableRUMEventType(val *RUMEventType) *NullableRUMEventType { + return &NullableRUMEventType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMEventType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMEventType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_events_response.go b/api/v2/datadog/model_rum_events_response.go new file mode 100644 index 00000000000..2816c543e8f --- /dev/null +++ b/api/v2/datadog/model_rum_events_response.go @@ -0,0 +1,194 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMEventsResponse Response object with all events matching the request and pagination information. +type RUMEventsResponse struct { + // Array of events matching the request. + Data []RUMEvent `json:"data,omitempty"` + // Links attributes. + Links *RUMResponseLinks `json:"links,omitempty"` + // The metadata associated with a request. + Meta *RUMResponseMetadata `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{} +} + +// NewRUMEventsResponse instantiates a new RUMEventsResponse 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 NewRUMEventsResponse() *RUMEventsResponse { + this := RUMEventsResponse{} + return &this +} + +// NewRUMEventsResponseWithDefaults instantiates a new RUMEventsResponse 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 NewRUMEventsResponseWithDefaults() *RUMEventsResponse { + this := RUMEventsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RUMEventsResponse) GetData() []RUMEvent { + if o == nil || o.Data == nil { + var ret []RUMEvent + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMEventsResponse) GetDataOk() (*[]RUMEvent, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RUMEventsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []RUMEvent and assigns it to the Data field. +func (o *RUMEventsResponse) SetData(v []RUMEvent) { + o.Data = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *RUMEventsResponse) GetLinks() RUMResponseLinks { + if o == nil || o.Links == nil { + var ret RUMResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMEventsResponse) GetLinksOk() (*RUMResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *RUMEventsResponse) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +// SetLinks gets a reference to the given RUMResponseLinks and assigns it to the Links field. +func (o *RUMEventsResponse) SetLinks(v RUMResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *RUMEventsResponse) GetMeta() RUMResponseMetadata { + if o == nil || o.Meta == nil { + var ret RUMResponseMetadata + 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 *RUMEventsResponse) GetMetaOk() (*RUMResponseMetadata, 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 *RUMEventsResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given RUMResponseMetadata and assigns it to the Meta field. +func (o *RUMEventsResponse) SetMeta(v RUMResponseMetadata) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMEventsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMEventsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []RUMEvent `json:"data,omitempty"` + Links *RUMResponseLinks `json:"links,omitempty"` + Meta *RUMResponseMetadata `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_rum_group_by.go b/api/v2/datadog/model_rum_group_by.go new file mode 100644 index 00000000000..b59c93f2409 --- /dev/null +++ b/api/v2/datadog/model_rum_group_by.go @@ -0,0 +1,317 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMGroupBy A group-by rule. +type RUMGroupBy struct { + // The name of the facet to use (required). + Facet string `json:"facet"` + // Used to perform a histogram computation (only for measure facets). + // Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. + Histogram *RUMGroupByHistogram `json:"histogram,omitempty"` + // The maximum buckets to return for this group-by. + Limit *int64 `json:"limit,omitempty"` + // The value to use for logs that don't have the facet used to group by. + Missing *RUMGroupByMissing `json:"missing,omitempty"` + // A sort rule. + Sort *RUMAggregateSort `json:"sort,omitempty"` + // A resulting object to put the given computes in over all the matching records. + Total *RUMGroupByTotal `json:"total,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{} +} + +// NewRUMGroupBy instantiates a new RUMGroupBy 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 NewRUMGroupBy(facet string) *RUMGroupBy { + this := RUMGroupBy{} + this.Facet = facet + var limit int64 = 10 + this.Limit = &limit + return &this +} + +// NewRUMGroupByWithDefaults instantiates a new RUMGroupBy 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 NewRUMGroupByWithDefaults() *RUMGroupBy { + this := RUMGroupBy{} + var limit int64 = 10 + this.Limit = &limit + return &this +} + +// GetFacet returns the Facet field value. +func (o *RUMGroupBy) GetFacet() string { + if o == nil { + var ret string + return ret + } + return o.Facet +} + +// GetFacetOk returns a tuple with the Facet field value +// and a boolean to check if the value has been set. +func (o *RUMGroupBy) GetFacetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Facet, true +} + +// SetFacet sets field value. +func (o *RUMGroupBy) SetFacet(v string) { + o.Facet = v +} + +// GetHistogram returns the Histogram field value if set, zero value otherwise. +func (o *RUMGroupBy) GetHistogram() RUMGroupByHistogram { + if o == nil || o.Histogram == nil { + var ret RUMGroupByHistogram + return ret + } + return *o.Histogram +} + +// GetHistogramOk returns a tuple with the Histogram field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMGroupBy) GetHistogramOk() (*RUMGroupByHistogram, bool) { + if o == nil || o.Histogram == nil { + return nil, false + } + return o.Histogram, true +} + +// HasHistogram returns a boolean if a field has been set. +func (o *RUMGroupBy) HasHistogram() bool { + if o != nil && o.Histogram != nil { + return true + } + + return false +} + +// SetHistogram gets a reference to the given RUMGroupByHistogram and assigns it to the Histogram field. +func (o *RUMGroupBy) SetHistogram(v RUMGroupByHistogram) { + o.Histogram = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *RUMGroupBy) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMGroupBy) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *RUMGroupBy) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *RUMGroupBy) SetLimit(v int64) { + o.Limit = &v +} + +// GetMissing returns the Missing field value if set, zero value otherwise. +func (o *RUMGroupBy) GetMissing() RUMGroupByMissing { + if o == nil || o.Missing == nil { + var ret RUMGroupByMissing + return ret + } + return *o.Missing +} + +// GetMissingOk returns a tuple with the Missing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMGroupBy) GetMissingOk() (*RUMGroupByMissing, bool) { + if o == nil || o.Missing == nil { + return nil, false + } + return o.Missing, true +} + +// HasMissing returns a boolean if a field has been set. +func (o *RUMGroupBy) HasMissing() bool { + if o != nil && o.Missing != nil { + return true + } + + return false +} + +// SetMissing gets a reference to the given RUMGroupByMissing and assigns it to the Missing field. +func (o *RUMGroupBy) SetMissing(v RUMGroupByMissing) { + o.Missing = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *RUMGroupBy) GetSort() RUMAggregateSort { + if o == nil || o.Sort == nil { + var ret RUMAggregateSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMGroupBy) GetSortOk() (*RUMAggregateSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *RUMGroupBy) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given RUMAggregateSort and assigns it to the Sort field. +func (o *RUMGroupBy) SetSort(v RUMAggregateSort) { + o.Sort = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *RUMGroupBy) GetTotal() RUMGroupByTotal { + if o == nil || o.Total == nil { + var ret RUMGroupByTotal + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMGroupBy) GetTotalOk() (*RUMGroupByTotal, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *RUMGroupBy) HasTotal() bool { + if o != nil && o.Total != nil { + return true + } + + return false +} + +// SetTotal gets a reference to the given RUMGroupByTotal and assigns it to the Total field. +func (o *RUMGroupBy) SetTotal(v RUMGroupByTotal) { + o.Total = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMGroupBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["facet"] = o.Facet + if o.Histogram != nil { + toSerialize["histogram"] = o.Histogram + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.Missing != nil { + toSerialize["missing"] = o.Missing + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMGroupBy) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Facet *string `json:"facet"` + }{} + all := struct { + Facet string `json:"facet"` + Histogram *RUMGroupByHistogram `json:"histogram,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Missing *RUMGroupByMissing `json:"missing,omitempty"` + Sort *RUMAggregateSort `json:"sort,omitempty"` + Total *RUMGroupByTotal `json:"total,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Facet == nil { + return fmt.Errorf("Required field facet missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Facet = all.Facet + if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Histogram = all.Histogram + o.Limit = all.Limit + o.Missing = all.Missing + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Sort = all.Sort + o.Total = all.Total + return nil +} diff --git a/api/v2/datadog/model_rum_group_by_histogram.go b/api/v2/datadog/model_rum_group_by_histogram.go new file mode 100644 index 00000000000..c08217f550b --- /dev/null +++ b/api/v2/datadog/model_rum_group_by_histogram.go @@ -0,0 +1,172 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMGroupByHistogram Used to perform a histogram computation (only for measure facets). +// Note: At most 100 buckets are allowed, the number of buckets is (max - min)/interval. +type RUMGroupByHistogram struct { + // The bin size of the histogram buckets. + Interval float64 `json:"interval"` + // The maximum value for the measure used in the histogram + // (values greater than this one are filtered out). + Max float64 `json:"max"` + // The minimum value for the measure used in the histogram + // (values smaller than this one are filtered out). + Min float64 `json:"min"` + // 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{} +} + +// NewRUMGroupByHistogram instantiates a new RUMGroupByHistogram 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 NewRUMGroupByHistogram(interval float64, max float64, min float64) *RUMGroupByHistogram { + this := RUMGroupByHistogram{} + this.Interval = interval + this.Max = max + this.Min = min + return &this +} + +// NewRUMGroupByHistogramWithDefaults instantiates a new RUMGroupByHistogram 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 NewRUMGroupByHistogramWithDefaults() *RUMGroupByHistogram { + this := RUMGroupByHistogram{} + return &this +} + +// GetInterval returns the Interval field value. +func (o *RUMGroupByHistogram) GetInterval() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Interval +} + +// GetIntervalOk returns a tuple with the Interval field value +// and a boolean to check if the value has been set. +func (o *RUMGroupByHistogram) GetIntervalOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Interval, true +} + +// SetInterval sets field value. +func (o *RUMGroupByHistogram) SetInterval(v float64) { + o.Interval = v +} + +// GetMax returns the Max field value. +func (o *RUMGroupByHistogram) GetMax() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Max +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *RUMGroupByHistogram) GetMaxOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Max, true +} + +// SetMax sets field value. +func (o *RUMGroupByHistogram) SetMax(v float64) { + o.Max = v +} + +// GetMin returns the Min field value. +func (o *RUMGroupByHistogram) GetMin() float64 { + if o == nil { + var ret float64 + return ret + } + return o.Min +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *RUMGroupByHistogram) GetMinOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Min, true +} + +// SetMin sets field value. +func (o *RUMGroupByHistogram) SetMin(v float64) { + o.Min = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMGroupByHistogram) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["interval"] = o.Interval + toSerialize["max"] = o.Max + toSerialize["min"] = o.Min + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Interval *float64 `json:"interval"` + Max *float64 `json:"max"` + Min *float64 `json:"min"` + }{} + all := struct { + Interval float64 `json:"interval"` + Max float64 `json:"max"` + Min float64 `json:"min"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Interval == nil { + return fmt.Errorf("Required field interval missing") + } + if required.Max == nil { + return fmt.Errorf("Required field max missing") + } + if required.Min == nil { + return fmt.Errorf("Required field min missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Interval = all.Interval + o.Max = all.Max + o.Min = all.Min + return nil +} diff --git a/api/v2/datadog/model_rum_group_by_missing.go b/api/v2/datadog/model_rum_group_by_missing.go new file mode 100644 index 00000000000..9f6b2b26503 --- /dev/null +++ b/api/v2/datadog/model_rum_group_by_missing.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMGroupByMissing - The value to use for logs that don't have the facet used to group by. +type RUMGroupByMissing struct { + RUMGroupByMissingString *string + RUMGroupByMissingNumber *float64 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// RUMGroupByMissingStringAsRUMGroupByMissing is a convenience function that returns string wrapped in RUMGroupByMissing. +func RUMGroupByMissingStringAsRUMGroupByMissing(v *string) RUMGroupByMissing { + return RUMGroupByMissing{RUMGroupByMissingString: v} +} + +// RUMGroupByMissingNumberAsRUMGroupByMissing is a convenience function that returns float64 wrapped in RUMGroupByMissing. +func RUMGroupByMissingNumberAsRUMGroupByMissing(v *float64) RUMGroupByMissing { + return RUMGroupByMissing{RUMGroupByMissingNumber: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *RUMGroupByMissing) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into RUMGroupByMissingString + err = json.Unmarshal(data, &obj.RUMGroupByMissingString) + if err == nil { + if obj.RUMGroupByMissingString != nil { + jsonRUMGroupByMissingString, _ := json.Marshal(obj.RUMGroupByMissingString) + if string(jsonRUMGroupByMissingString) == "{}" { // empty struct + obj.RUMGroupByMissingString = nil + } else { + match++ + } + } else { + obj.RUMGroupByMissingString = nil + } + } else { + obj.RUMGroupByMissingString = nil + } + + // try to unmarshal data into RUMGroupByMissingNumber + err = json.Unmarshal(data, &obj.RUMGroupByMissingNumber) + if err == nil { + if obj.RUMGroupByMissingNumber != nil { + jsonRUMGroupByMissingNumber, _ := json.Marshal(obj.RUMGroupByMissingNumber) + if string(jsonRUMGroupByMissingNumber) == "{}" { // empty struct + obj.RUMGroupByMissingNumber = nil + } else { + match++ + } + } else { + obj.RUMGroupByMissingNumber = nil + } + } else { + obj.RUMGroupByMissingNumber = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.RUMGroupByMissingString = nil + obj.RUMGroupByMissingNumber = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj RUMGroupByMissing) MarshalJSON() ([]byte, error) { + if obj.RUMGroupByMissingString != nil { + return json.Marshal(&obj.RUMGroupByMissingString) + } + + if obj.RUMGroupByMissingNumber != nil { + return json.Marshal(&obj.RUMGroupByMissingNumber) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *RUMGroupByMissing) GetActualInstance() interface{} { + if obj.RUMGroupByMissingString != nil { + return obj.RUMGroupByMissingString + } + + if obj.RUMGroupByMissingNumber != nil { + return obj.RUMGroupByMissingNumber + } + + // all schemas are nil + return nil +} + +// NullableRUMGroupByMissing handles when a null is used for RUMGroupByMissing. +type NullableRUMGroupByMissing struct { + value *RUMGroupByMissing + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMGroupByMissing) Get() *RUMGroupByMissing { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMGroupByMissing) Set(val *RUMGroupByMissing) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMGroupByMissing) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableRUMGroupByMissing) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMGroupByMissing initializes the struct as if Set has been called. +func NewNullableRUMGroupByMissing(val *RUMGroupByMissing) *NullableRUMGroupByMissing { + return &NullableRUMGroupByMissing{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMGroupByMissing) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMGroupByMissing) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_group_by_total.go b/api/v2/datadog/model_rum_group_by_total.go new file mode 100644 index 00000000000..4cab76bd47e --- /dev/null +++ b/api/v2/datadog/model_rum_group_by_total.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMGroupByTotal - A resulting object to put the given computes in over all the matching records. +type RUMGroupByTotal struct { + RUMGroupByTotalBoolean *bool + RUMGroupByTotalString *string + RUMGroupByTotalNumber *float64 + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// RUMGroupByTotalBooleanAsRUMGroupByTotal is a convenience function that returns bool wrapped in RUMGroupByTotal. +func RUMGroupByTotalBooleanAsRUMGroupByTotal(v *bool) RUMGroupByTotal { + return RUMGroupByTotal{RUMGroupByTotalBoolean: v} +} + +// RUMGroupByTotalStringAsRUMGroupByTotal is a convenience function that returns string wrapped in RUMGroupByTotal. +func RUMGroupByTotalStringAsRUMGroupByTotal(v *string) RUMGroupByTotal { + return RUMGroupByTotal{RUMGroupByTotalString: v} +} + +// RUMGroupByTotalNumberAsRUMGroupByTotal is a convenience function that returns float64 wrapped in RUMGroupByTotal. +func RUMGroupByTotalNumberAsRUMGroupByTotal(v *float64) RUMGroupByTotal { + return RUMGroupByTotal{RUMGroupByTotalNumber: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *RUMGroupByTotal) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into RUMGroupByTotalBoolean + err = json.Unmarshal(data, &obj.RUMGroupByTotalBoolean) + if err == nil { + if obj.RUMGroupByTotalBoolean != nil { + jsonRUMGroupByTotalBoolean, _ := json.Marshal(obj.RUMGroupByTotalBoolean) + if string(jsonRUMGroupByTotalBoolean) == "{}" { // empty struct + obj.RUMGroupByTotalBoolean = nil + } else { + match++ + } + } else { + obj.RUMGroupByTotalBoolean = nil + } + } else { + obj.RUMGroupByTotalBoolean = nil + } + + // try to unmarshal data into RUMGroupByTotalString + err = json.Unmarshal(data, &obj.RUMGroupByTotalString) + if err == nil { + if obj.RUMGroupByTotalString != nil { + jsonRUMGroupByTotalString, _ := json.Marshal(obj.RUMGroupByTotalString) + if string(jsonRUMGroupByTotalString) == "{}" { // empty struct + obj.RUMGroupByTotalString = nil + } else { + match++ + } + } else { + obj.RUMGroupByTotalString = nil + } + } else { + obj.RUMGroupByTotalString = nil + } + + // try to unmarshal data into RUMGroupByTotalNumber + err = json.Unmarshal(data, &obj.RUMGroupByTotalNumber) + if err == nil { + if obj.RUMGroupByTotalNumber != nil { + jsonRUMGroupByTotalNumber, _ := json.Marshal(obj.RUMGroupByTotalNumber) + if string(jsonRUMGroupByTotalNumber) == "{}" { // empty struct + obj.RUMGroupByTotalNumber = nil + } else { + match++ + } + } else { + obj.RUMGroupByTotalNumber = nil + } + } else { + obj.RUMGroupByTotalNumber = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.RUMGroupByTotalBoolean = nil + obj.RUMGroupByTotalString = nil + obj.RUMGroupByTotalNumber = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj RUMGroupByTotal) MarshalJSON() ([]byte, error) { + if obj.RUMGroupByTotalBoolean != nil { + return json.Marshal(&obj.RUMGroupByTotalBoolean) + } + + if obj.RUMGroupByTotalString != nil { + return json.Marshal(&obj.RUMGroupByTotalString) + } + + if obj.RUMGroupByTotalNumber != nil { + return json.Marshal(&obj.RUMGroupByTotalNumber) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *RUMGroupByTotal) GetActualInstance() interface{} { + if obj.RUMGroupByTotalBoolean != nil { + return obj.RUMGroupByTotalBoolean + } + + if obj.RUMGroupByTotalString != nil { + return obj.RUMGroupByTotalString + } + + if obj.RUMGroupByTotalNumber != nil { + return obj.RUMGroupByTotalNumber + } + + // all schemas are nil + return nil +} + +// NullableRUMGroupByTotal handles when a null is used for RUMGroupByTotal. +type NullableRUMGroupByTotal struct { + value *RUMGroupByTotal + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMGroupByTotal) Get() *RUMGroupByTotal { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMGroupByTotal) Set(val *RUMGroupByTotal) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMGroupByTotal) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableRUMGroupByTotal) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMGroupByTotal initializes the struct as if Set has been called. +func NewNullableRUMGroupByTotal(val *RUMGroupByTotal) *NullableRUMGroupByTotal { + return &NullableRUMGroupByTotal{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMGroupByTotal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMGroupByTotal) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_query_filter.go b/api/v2/datadog/model_rum_query_filter.go new file mode 100644 index 00000000000..e9849361ee2 --- /dev/null +++ b/api/v2/datadog/model_rum_query_filter.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMQueryFilter The search and filter query settings. +type RUMQueryFilter struct { + // The minimum time for the requested events; supports date, math, and regular timestamps (in milliseconds). + From *string `json:"from,omitempty"` + // The search query following the RUM search syntax. + Query *string `json:"query,omitempty"` + // The maximum time for the requested events; supports date, math, and regular timestamps (in milliseconds). + To *string `json:"to,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{} +} + +// NewRUMQueryFilter instantiates a new RUMQueryFilter 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 NewRUMQueryFilter() *RUMQueryFilter { + this := RUMQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// NewRUMQueryFilterWithDefaults instantiates a new RUMQueryFilter 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 NewRUMQueryFilterWithDefaults() *RUMQueryFilter { + this := RUMQueryFilter{} + var from string = "now-15m" + this.From = &from + var query string = "*" + this.Query = &query + var to string = "now" + this.To = &to + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *RUMQueryFilter) GetFrom() string { + if o == nil || o.From == nil { + var ret string + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMQueryFilter) GetFromOk() (*string, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *RUMQueryFilter) HasFrom() bool { + if o != nil && o.From != nil { + return true + } + + return false +} + +// SetFrom gets a reference to the given string and assigns it to the From field. +func (o *RUMQueryFilter) SetFrom(v string) { + o.From = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *RUMQueryFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMQueryFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *RUMQueryFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *RUMQueryFilter) SetQuery(v string) { + o.Query = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *RUMQueryFilter) GetTo() string { + if o == nil || o.To == nil { + var ret string + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMQueryFilter) GetToOk() (*string, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *RUMQueryFilter) HasTo() bool { + if o != nil && o.To != nil { + return true + } + + return false +} + +// SetTo gets a reference to the given string and assigns it to the To field. +func (o *RUMQueryFilter) SetTo(v string) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMQueryFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From != nil { + toSerialize["from"] = o.From + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.To != nil { + toSerialize["to"] = o.To + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMQueryFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + From *string `json:"from,omitempty"` + Query *string `json:"query,omitempty"` + To *string `json:"to,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.From = all.From + o.Query = all.Query + o.To = all.To + return nil +} diff --git a/api/v2/datadog/model_rum_query_options.go b/api/v2/datadog/model_rum_query_options.go new file mode 100644 index 00000000000..4bab79e2194 --- /dev/null +++ b/api/v2/datadog/model_rum_query_options.go @@ -0,0 +1,146 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMQueryOptions Global query options that are used during the query. +// Note: Only supply timezone or time offset, not both. Otherwise, the query fails. +type RUMQueryOptions struct { + // The time offset (in seconds) to apply to the query. + TimeOffset *int64 `json:"time_offset,omitempty"` + // The timezone can be specified both as an offset, for example: "UTC+03:00". + Timezone *string `json:"timezone,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{} +} + +// NewRUMQueryOptions instantiates a new RUMQueryOptions 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 NewRUMQueryOptions() *RUMQueryOptions { + this := RUMQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// NewRUMQueryOptionsWithDefaults instantiates a new RUMQueryOptions 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 NewRUMQueryOptionsWithDefaults() *RUMQueryOptions { + this := RUMQueryOptions{} + var timezone string = "UTC" + this.Timezone = &timezone + return &this +} + +// GetTimeOffset returns the TimeOffset field value if set, zero value otherwise. +func (o *RUMQueryOptions) GetTimeOffset() int64 { + if o == nil || o.TimeOffset == nil { + var ret int64 + return ret + } + return *o.TimeOffset +} + +// GetTimeOffsetOk returns a tuple with the TimeOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMQueryOptions) GetTimeOffsetOk() (*int64, bool) { + if o == nil || o.TimeOffset == nil { + return nil, false + } + return o.TimeOffset, true +} + +// HasTimeOffset returns a boolean if a field has been set. +func (o *RUMQueryOptions) HasTimeOffset() bool { + if o != nil && o.TimeOffset != nil { + return true + } + + return false +} + +// SetTimeOffset gets a reference to the given int64 and assigns it to the TimeOffset field. +func (o *RUMQueryOptions) SetTimeOffset(v int64) { + o.TimeOffset = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *RUMQueryOptions) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMQueryOptions) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *RUMQueryOptions) HasTimezone() bool { + if o != nil && o.Timezone != nil { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *RUMQueryOptions) SetTimezone(v string) { + o.Timezone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMQueryOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.TimeOffset != nil { + toSerialize["time_offset"] = o.TimeOffset + } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMQueryOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + TimeOffset *int64 `json:"time_offset,omitempty"` + Timezone *string `json:"timezone,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.TimeOffset = all.TimeOffset + o.Timezone = all.Timezone + return nil +} diff --git a/api/v2/datadog/model_rum_query_page_options.go b/api/v2/datadog/model_rum_query_page_options.go new file mode 100644 index 00000000000..18fb5bbb377 --- /dev/null +++ b/api/v2/datadog/model_rum_query_page_options.go @@ -0,0 +1,145 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMQueryPageOptions Paging attributes for listing events. +type RUMQueryPageOptions struct { + // List following results with a cursor provided in the previous query. + Cursor *string `json:"cursor,omitempty"` + // Maximum number of events in the response. + Limit *int32 `json:"limit,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{} +} + +// NewRUMQueryPageOptions instantiates a new RUMQueryPageOptions 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 NewRUMQueryPageOptions() *RUMQueryPageOptions { + this := RUMQueryPageOptions{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// NewRUMQueryPageOptionsWithDefaults instantiates a new RUMQueryPageOptions 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 NewRUMQueryPageOptionsWithDefaults() *RUMQueryPageOptions { + this := RUMQueryPageOptions{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *RUMQueryPageOptions) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMQueryPageOptions) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *RUMQueryPageOptions) HasCursor() bool { + if o != nil && o.Cursor != nil { + return true + } + + return false +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *RUMQueryPageOptions) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *RUMQueryPageOptions) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMQueryPageOptions) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *RUMQueryPageOptions) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *RUMQueryPageOptions) SetLimit(v int32) { + o.Limit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMQueryPageOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int32 `json:"limit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cursor = all.Cursor + o.Limit = all.Limit + return nil +} diff --git a/api/v2/datadog/model_rum_response_links.go b/api/v2/datadog/model_rum_response_links.go new file mode 100644 index 00000000000..bbc3396033e --- /dev/null +++ b/api/v2/datadog/model_rum_response_links.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMResponseLinks Links attributes. +type RUMResponseLinks struct { + // Link for the next set of results. Note that the request can also be made using the + // POST endpoint. + Next *string `json:"next,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{} +} + +// NewRUMResponseLinks instantiates a new RUMResponseLinks 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 NewRUMResponseLinks() *RUMResponseLinks { + this := RUMResponseLinks{} + return &this +} + +// NewRUMResponseLinksWithDefaults instantiates a new RUMResponseLinks 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 NewRUMResponseLinksWithDefaults() *RUMResponseLinks { + this := RUMResponseLinks{} + return &this +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *RUMResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *RUMResponseLinks) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *RUMResponseLinks) SetNext(v string) { + o.Next = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Next *string `json:"next,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Next = all.Next + return nil +} diff --git a/api/v2/datadog/model_rum_response_metadata.go b/api/v2/datadog/model_rum_response_metadata.go new file mode 100644 index 00000000000..c470b9587bd --- /dev/null +++ b/api/v2/datadog/model_rum_response_metadata.go @@ -0,0 +1,274 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMResponseMetadata The metadata associated with a request. +type RUMResponseMetadata struct { + // The time elapsed in milliseconds. + Elapsed *int64 `json:"elapsed,omitempty"` + // Paging attributes. + Page *RUMResponsePage `json:"page,omitempty"` + // The identifier of the request. + RequestId *string `json:"request_id,omitempty"` + // The status of the response. + Status *RUMResponseStatus `json:"status,omitempty"` + // A list of warnings (non-fatal errors) encountered. Partial results may return if + // warnings are present in the response. + Warnings []RUMWarning `json:"warnings,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{} +} + +// NewRUMResponseMetadata instantiates a new RUMResponseMetadata 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 NewRUMResponseMetadata() *RUMResponseMetadata { + this := RUMResponseMetadata{} + return &this +} + +// NewRUMResponseMetadataWithDefaults instantiates a new RUMResponseMetadata 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 NewRUMResponseMetadataWithDefaults() *RUMResponseMetadata { + this := RUMResponseMetadata{} + return &this +} + +// GetElapsed returns the Elapsed field value if set, zero value otherwise. +func (o *RUMResponseMetadata) GetElapsed() int64 { + if o == nil || o.Elapsed == nil { + var ret int64 + return ret + } + return *o.Elapsed +} + +// GetElapsedOk returns a tuple with the Elapsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMResponseMetadata) GetElapsedOk() (*int64, bool) { + if o == nil || o.Elapsed == nil { + return nil, false + } + return o.Elapsed, true +} + +// HasElapsed returns a boolean if a field has been set. +func (o *RUMResponseMetadata) HasElapsed() bool { + if o != nil && o.Elapsed != nil { + return true + } + + return false +} + +// SetElapsed gets a reference to the given int64 and assigns it to the Elapsed field. +func (o *RUMResponseMetadata) SetElapsed(v int64) { + o.Elapsed = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *RUMResponseMetadata) GetPage() RUMResponsePage { + if o == nil || o.Page == nil { + var ret RUMResponsePage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMResponseMetadata) GetPageOk() (*RUMResponsePage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *RUMResponseMetadata) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given RUMResponsePage and assigns it to the Page field. +func (o *RUMResponseMetadata) SetPage(v RUMResponsePage) { + o.Page = &v +} + +// GetRequestId returns the RequestId field value if set, zero value otherwise. +func (o *RUMResponseMetadata) GetRequestId() string { + if o == nil || o.RequestId == nil { + var ret string + return ret + } + return *o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMResponseMetadata) GetRequestIdOk() (*string, bool) { + if o == nil || o.RequestId == nil { + return nil, false + } + return o.RequestId, true +} + +// HasRequestId returns a boolean if a field has been set. +func (o *RUMResponseMetadata) HasRequestId() bool { + if o != nil && o.RequestId != nil { + return true + } + + return false +} + +// SetRequestId gets a reference to the given string and assigns it to the RequestId field. +func (o *RUMResponseMetadata) SetRequestId(v string) { + o.RequestId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *RUMResponseMetadata) GetStatus() RUMResponseStatus { + if o == nil || o.Status == nil { + var ret RUMResponseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMResponseMetadata) GetStatusOk() (*RUMResponseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *RUMResponseMetadata) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given RUMResponseStatus and assigns it to the Status field. +func (o *RUMResponseMetadata) SetStatus(v RUMResponseStatus) { + o.Status = &v +} + +// GetWarnings returns the Warnings field value if set, zero value otherwise. +func (o *RUMResponseMetadata) GetWarnings() []RUMWarning { + if o == nil || o.Warnings == nil { + var ret []RUMWarning + return ret + } + return o.Warnings +} + +// GetWarningsOk returns a tuple with the Warnings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMResponseMetadata) GetWarningsOk() (*[]RUMWarning, bool) { + if o == nil || o.Warnings == nil { + return nil, false + } + return &o.Warnings, true +} + +// HasWarnings returns a boolean if a field has been set. +func (o *RUMResponseMetadata) HasWarnings() bool { + if o != nil && o.Warnings != nil { + return true + } + + return false +} + +// SetWarnings gets a reference to the given []RUMWarning and assigns it to the Warnings field. +func (o *RUMResponseMetadata) SetWarnings(v []RUMWarning) { + o.Warnings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMResponseMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Elapsed != nil { + toSerialize["elapsed"] = o.Elapsed + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.RequestId != nil { + toSerialize["request_id"] = o.RequestId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Warnings != nil { + toSerialize["warnings"] = o.Warnings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Elapsed *int64 `json:"elapsed,omitempty"` + Page *RUMResponsePage `json:"page,omitempty"` + RequestId *string `json:"request_id,omitempty"` + Status *RUMResponseStatus `json:"status,omitempty"` + Warnings []RUMWarning `json:"warnings,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Elapsed = all.Elapsed + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.RequestId = all.RequestId + o.Status = all.Status + o.Warnings = all.Warnings + return nil +} diff --git a/api/v2/datadog/model_rum_response_page.go b/api/v2/datadog/model_rum_response_page.go new file mode 100644 index 00000000000..def1148eaa7 --- /dev/null +++ b/api/v2/datadog/model_rum_response_page.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 datadog + +import ( + "encoding/json" +) + +// RUMResponsePage Paging attributes. +type RUMResponsePage struct { + // The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of `page[cursor]`. + After *string `json:"after,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{} +} + +// NewRUMResponsePage instantiates a new RUMResponsePage 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 NewRUMResponsePage() *RUMResponsePage { + this := RUMResponsePage{} + return &this +} + +// NewRUMResponsePageWithDefaults instantiates a new RUMResponsePage 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 NewRUMResponsePageWithDefaults() *RUMResponsePage { + this := RUMResponsePage{} + return &this +} + +// GetAfter returns the After field value if set, zero value otherwise. +func (o *RUMResponsePage) GetAfter() string { + if o == nil || o.After == nil { + var ret string + return ret + } + return *o.After +} + +// GetAfterOk returns a tuple with the After field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMResponsePage) GetAfterOk() (*string, bool) { + if o == nil || o.After == nil { + return nil, false + } + return o.After, true +} + +// HasAfter returns a boolean if a field has been set. +func (o *RUMResponsePage) HasAfter() bool { + if o != nil && o.After != nil { + return true + } + + return false +} + +// SetAfter gets a reference to the given string and assigns it to the After field. +func (o *RUMResponsePage) SetAfter(v string) { + o.After = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMResponsePage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.After != nil { + toSerialize["after"] = o.After + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMResponsePage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + After *string `json:"after,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.After = all.After + return nil +} diff --git a/api/v2/datadog/model_rum_response_status.go b/api/v2/datadog/model_rum_response_status.go new file mode 100644 index 00000000000..512b30bcfb5 --- /dev/null +++ b/api/v2/datadog/model_rum_response_status.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMResponseStatus The status of the response. +type RUMResponseStatus string + +// List of RUMResponseStatus. +const ( + RUMRESPONSESTATUS_DONE RUMResponseStatus = "done" + RUMRESPONSESTATUS_TIMEOUT RUMResponseStatus = "timeout" +) + +var allowedRUMResponseStatusEnumValues = []RUMResponseStatus{ + RUMRESPONSESTATUS_DONE, + RUMRESPONSESTATUS_TIMEOUT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RUMResponseStatus) GetAllowedValues() []RUMResponseStatus { + return allowedRUMResponseStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RUMResponseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RUMResponseStatus(value) + return nil +} + +// NewRUMResponseStatusFromValue returns a pointer to a valid RUMResponseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRUMResponseStatusFromValue(v string) (*RUMResponseStatus, error) { + ev := RUMResponseStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RUMResponseStatus: valid values are %v", v, allowedRUMResponseStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RUMResponseStatus) IsValid() bool { + for _, existing := range allowedRUMResponseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RUMResponseStatus value. +func (v RUMResponseStatus) Ptr() *RUMResponseStatus { + return &v +} + +// NullableRUMResponseStatus handles when a null is used for RUMResponseStatus. +type NullableRUMResponseStatus struct { + value *RUMResponseStatus + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMResponseStatus) Get() *RUMResponseStatus { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMResponseStatus) Set(val *RUMResponseStatus) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMResponseStatus) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRUMResponseStatus) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMResponseStatus initializes the struct as if Set has been called. +func NewNullableRUMResponseStatus(val *RUMResponseStatus) *NullableRUMResponseStatus { + return &NullableRUMResponseStatus{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMResponseStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMResponseStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_search_events_request.go b/api/v2/datadog/model_rum_search_events_request.go new file mode 100644 index 00000000000..f025e6da5bc --- /dev/null +++ b/api/v2/datadog/model_rum_search_events_request.go @@ -0,0 +1,249 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMSearchEventsRequest The request for a RUM events list. +type RUMSearchEventsRequest struct { + // The search and filter query settings. + Filter *RUMQueryFilter `json:"filter,omitempty"` + // Global query options that are used during the query. + // Note: Only supply timezone or time offset, not both. Otherwise, the query fails. + Options *RUMQueryOptions `json:"options,omitempty"` + // Paging attributes for listing events. + Page *RUMQueryPageOptions `json:"page,omitempty"` + // Sort parameters when querying events. + Sort *RUMSort `json:"sort,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{} +} + +// NewRUMSearchEventsRequest instantiates a new RUMSearchEventsRequest 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 NewRUMSearchEventsRequest() *RUMSearchEventsRequest { + this := RUMSearchEventsRequest{} + return &this +} + +// NewRUMSearchEventsRequestWithDefaults instantiates a new RUMSearchEventsRequest 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 NewRUMSearchEventsRequestWithDefaults() *RUMSearchEventsRequest { + this := RUMSearchEventsRequest{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *RUMSearchEventsRequest) GetFilter() RUMQueryFilter { + if o == nil || o.Filter == nil { + var ret RUMQueryFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMSearchEventsRequest) GetFilterOk() (*RUMQueryFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *RUMSearchEventsRequest) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given RUMQueryFilter and assigns it to the Filter field. +func (o *RUMSearchEventsRequest) SetFilter(v RUMQueryFilter) { + o.Filter = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *RUMSearchEventsRequest) GetOptions() RUMQueryOptions { + if o == nil || o.Options == nil { + var ret RUMQueryOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMSearchEventsRequest) GetOptionsOk() (*RUMQueryOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *RUMSearchEventsRequest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given RUMQueryOptions and assigns it to the Options field. +func (o *RUMSearchEventsRequest) SetOptions(v RUMQueryOptions) { + o.Options = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *RUMSearchEventsRequest) GetPage() RUMQueryPageOptions { + if o == nil || o.Page == nil { + var ret RUMQueryPageOptions + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMSearchEventsRequest) GetPageOk() (*RUMQueryPageOptions, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *RUMSearchEventsRequest) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given RUMQueryPageOptions and assigns it to the Page field. +func (o *RUMSearchEventsRequest) SetPage(v RUMQueryPageOptions) { + o.Page = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *RUMSearchEventsRequest) GetSort() RUMSort { + if o == nil || o.Sort == nil { + var ret RUMSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMSearchEventsRequest) GetSortOk() (*RUMSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *RUMSearchEventsRequest) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given RUMSort and assigns it to the Sort field. +func (o *RUMSearchEventsRequest) SetSort(v RUMSort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMSearchEventsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filter *RUMQueryFilter `json:"filter,omitempty"` + Options *RUMQueryOptions `json:"options,omitempty"` + Page *RUMQueryPageOptions `json:"page,omitempty"` + Sort *RUMSort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.Sort = all.Sort + return nil +} diff --git a/api/v2/datadog/model_rum_sort.go b/api/v2/datadog/model_rum_sort.go new file mode 100644 index 00000000000..33a3fa8537f --- /dev/null +++ b/api/v2/datadog/model_rum_sort.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMSort Sort parameters when querying events. +type RUMSort string + +// List of RUMSort. +const ( + RUMSORT_TIMESTAMP_ASCENDING RUMSort = "timestamp" + RUMSORT_TIMESTAMP_DESCENDING RUMSort = "-timestamp" +) + +var allowedRUMSortEnumValues = []RUMSort{ + RUMSORT_TIMESTAMP_ASCENDING, + RUMSORT_TIMESTAMP_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RUMSort) GetAllowedValues() []RUMSort { + return allowedRUMSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RUMSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RUMSort(value) + return nil +} + +// NewRUMSortFromValue returns a pointer to a valid RUMSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRUMSortFromValue(v string) (*RUMSort, error) { + ev := RUMSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RUMSort: valid values are %v", v, allowedRUMSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RUMSort) IsValid() bool { + for _, existing := range allowedRUMSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RUMSort value. +func (v RUMSort) Ptr() *RUMSort { + return &v +} + +// NullableRUMSort handles when a null is used for RUMSort. +type NullableRUMSort struct { + value *RUMSort + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMSort) Get() *RUMSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMSort) Set(val *RUMSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRUMSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMSort initializes the struct as if Set has been called. +func NewNullableRUMSort(val *RUMSort) *NullableRUMSort { + return &NullableRUMSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_sort_order.go b/api/v2/datadog/model_rum_sort_order.go new file mode 100644 index 00000000000..a3ef4b8196b --- /dev/null +++ b/api/v2/datadog/model_rum_sort_order.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// RUMSortOrder The order to use, ascending or descending. +type RUMSortOrder string + +// List of RUMSortOrder. +const ( + RUMSORTORDER_ASCENDING RUMSortOrder = "asc" + RUMSORTORDER_DESCENDING RUMSortOrder = "desc" +) + +var allowedRUMSortOrderEnumValues = []RUMSortOrder{ + RUMSORTORDER_ASCENDING, + RUMSORTORDER_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *RUMSortOrder) GetAllowedValues() []RUMSortOrder { + return allowedRUMSortOrderEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *RUMSortOrder) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = RUMSortOrder(value) + return nil +} + +// NewRUMSortOrderFromValue returns a pointer to a valid RUMSortOrder +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewRUMSortOrderFromValue(v string) (*RUMSortOrder, error) { + ev := RUMSortOrder(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for RUMSortOrder: valid values are %v", v, allowedRUMSortOrderEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v RUMSortOrder) IsValid() bool { + for _, existing := range allowedRUMSortOrderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RUMSortOrder value. +func (v RUMSortOrder) Ptr() *RUMSortOrder { + return &v +} + +// NullableRUMSortOrder handles when a null is used for RUMSortOrder. +type NullableRUMSortOrder struct { + value *RUMSortOrder + isSet bool +} + +// Get returns the associated value. +func (v NullableRUMSortOrder) Get() *RUMSortOrder { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRUMSortOrder) Set(val *RUMSortOrder) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRUMSortOrder) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableRUMSortOrder) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRUMSortOrder initializes the struct as if Set has been called. +func NewNullableRUMSortOrder(val *RUMSortOrder) *NullableRUMSortOrder { + return &NullableRUMSortOrder{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRUMSortOrder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRUMSortOrder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_rum_warning.go b/api/v2/datadog/model_rum_warning.go new file mode 100644 index 00000000000..5278e807d12 --- /dev/null +++ b/api/v2/datadog/model_rum_warning.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// RUMWarning A warning message indicating something that went wrong with the query. +type RUMWarning struct { + // A unique code for this type of warning. + Code *string `json:"code,omitempty"` + // A detailed explanation of this specific warning. + Detail *string `json:"detail,omitempty"` + // A short human-readable summary of the warning. + Title *string `json:"title,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{} +} + +// NewRUMWarning instantiates a new RUMWarning 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 NewRUMWarning() *RUMWarning { + this := RUMWarning{} + return &this +} + +// NewRUMWarningWithDefaults instantiates a new RUMWarning 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 NewRUMWarningWithDefaults() *RUMWarning { + this := RUMWarning{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *RUMWarning) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMWarning) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *RUMWarning) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *RUMWarning) SetCode(v string) { + o.Code = &v +} + +// GetDetail returns the Detail field value if set, zero value otherwise. +func (o *RUMWarning) GetDetail() string { + if o == nil || o.Detail == nil { + var ret string + return ret + } + return *o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMWarning) GetDetailOk() (*string, bool) { + if o == nil || o.Detail == nil { + return nil, false + } + return o.Detail, true +} + +// HasDetail returns a boolean if a field has been set. +func (o *RUMWarning) HasDetail() bool { + if o != nil && o.Detail != nil { + return true + } + + return false +} + +// SetDetail gets a reference to the given string and assigns it to the Detail field. +func (o *RUMWarning) SetDetail(v string) { + o.Detail = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *RUMWarning) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RUMWarning) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *RUMWarning) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *RUMWarning) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RUMWarning) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Detail != nil { + toSerialize["detail"] = o.Detail + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RUMWarning) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Code *string `json:"code,omitempty"` + Detail *string `json:"detail,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Code = all.Code + o.Detail = all.Detail + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_saml_assertion_attribute.go b/api/v2/datadog/model_saml_assertion_attribute.go new file mode 100644 index 00000000000..562be272c5d --- /dev/null +++ b/api/v2/datadog/model_saml_assertion_attribute.go @@ -0,0 +1,192 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SAMLAssertionAttribute SAML assertion attribute. +type SAMLAssertionAttribute struct { + // Key/Value pair of attributes used in SAML assertion attributes. + Attributes *SAMLAssertionAttributeAttributes `json:"attributes,omitempty"` + // The ID of the SAML assertion attribute. + Id string `json:"id"` + // SAML assertion attributes resource type. + Type SAMLAssertionAttributesType `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{} +} + +// NewSAMLAssertionAttribute instantiates a new SAMLAssertionAttribute 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 NewSAMLAssertionAttribute(id string, typeVar SAMLAssertionAttributesType) *SAMLAssertionAttribute { + this := SAMLAssertionAttribute{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewSAMLAssertionAttributeWithDefaults instantiates a new SAMLAssertionAttribute 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 NewSAMLAssertionAttributeWithDefaults() *SAMLAssertionAttribute { + this := SAMLAssertionAttribute{} + var typeVar SAMLAssertionAttributesType = SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SAMLAssertionAttribute) GetAttributes() SAMLAssertionAttributeAttributes { + if o == nil || o.Attributes == nil { + var ret SAMLAssertionAttributeAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SAMLAssertionAttribute) GetAttributesOk() (*SAMLAssertionAttributeAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SAMLAssertionAttribute) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SAMLAssertionAttributeAttributes and assigns it to the Attributes field. +func (o *SAMLAssertionAttribute) SetAttributes(v SAMLAssertionAttributeAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *SAMLAssertionAttribute) 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 *SAMLAssertionAttribute) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SAMLAssertionAttribute) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *SAMLAssertionAttribute) GetType() SAMLAssertionAttributesType { + if o == nil { + var ret SAMLAssertionAttributesType + 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 *SAMLAssertionAttribute) GetTypeOk() (*SAMLAssertionAttributesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SAMLAssertionAttribute) SetType(v SAMLAssertionAttributesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SAMLAssertionAttribute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Id *string `json:"id"` + Type *SAMLAssertionAttributesType `json:"type"` + }{} + all := struct { + Attributes *SAMLAssertionAttributeAttributes `json:"attributes,omitempty"` + Id string `json:"id"` + Type SAMLAssertionAttributesType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_saml_assertion_attribute_attributes.go b/api/v2/datadog/model_saml_assertion_attribute_attributes.go new file mode 100644 index 00000000000..9120822aa77 --- /dev/null +++ b/api/v2/datadog/model_saml_assertion_attribute_attributes.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SAMLAssertionAttributeAttributes Key/Value pair of attributes used in SAML assertion attributes. +type SAMLAssertionAttributeAttributes struct { + // Key portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeKey *string `json:"attribute_key,omitempty"` + // Value portion of a key/value pair of the attribute sent from the Identity Provider. + AttributeValue *string `json:"attribute_value,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{} +} + +// NewSAMLAssertionAttributeAttributes instantiates a new SAMLAssertionAttributeAttributes 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 NewSAMLAssertionAttributeAttributes() *SAMLAssertionAttributeAttributes { + this := SAMLAssertionAttributeAttributes{} + return &this +} + +// NewSAMLAssertionAttributeAttributesWithDefaults instantiates a new SAMLAssertionAttributeAttributes 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 NewSAMLAssertionAttributeAttributesWithDefaults() *SAMLAssertionAttributeAttributes { + this := SAMLAssertionAttributeAttributes{} + return &this +} + +// GetAttributeKey returns the AttributeKey field value if set, zero value otherwise. +func (o *SAMLAssertionAttributeAttributes) GetAttributeKey() string { + if o == nil || o.AttributeKey == nil { + var ret string + return ret + } + return *o.AttributeKey +} + +// GetAttributeKeyOk returns a tuple with the AttributeKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SAMLAssertionAttributeAttributes) GetAttributeKeyOk() (*string, bool) { + if o == nil || o.AttributeKey == nil { + return nil, false + } + return o.AttributeKey, true +} + +// HasAttributeKey returns a boolean if a field has been set. +func (o *SAMLAssertionAttributeAttributes) HasAttributeKey() bool { + if o != nil && o.AttributeKey != nil { + return true + } + + return false +} + +// SetAttributeKey gets a reference to the given string and assigns it to the AttributeKey field. +func (o *SAMLAssertionAttributeAttributes) SetAttributeKey(v string) { + o.AttributeKey = &v +} + +// GetAttributeValue returns the AttributeValue field value if set, zero value otherwise. +func (o *SAMLAssertionAttributeAttributes) GetAttributeValue() string { + if o == nil || o.AttributeValue == nil { + var ret string + return ret + } + return *o.AttributeValue +} + +// GetAttributeValueOk returns a tuple with the AttributeValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SAMLAssertionAttributeAttributes) GetAttributeValueOk() (*string, bool) { + if o == nil || o.AttributeValue == nil { + return nil, false + } + return o.AttributeValue, true +} + +// HasAttributeValue returns a boolean if a field has been set. +func (o *SAMLAssertionAttributeAttributes) HasAttributeValue() bool { + if o != nil && o.AttributeValue != nil { + return true + } + + return false +} + +// SetAttributeValue gets a reference to the given string and assigns it to the AttributeValue field. +func (o *SAMLAssertionAttributeAttributes) SetAttributeValue(v string) { + o.AttributeValue = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SAMLAssertionAttributeAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.AttributeKey != nil { + toSerialize["attribute_key"] = o.AttributeKey + } + if o.AttributeValue != nil { + toSerialize["attribute_value"] = o.AttributeValue + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SAMLAssertionAttributeAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + AttributeKey *string `json:"attribute_key,omitempty"` + AttributeValue *string `json:"attribute_value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.AttributeKey = all.AttributeKey + o.AttributeValue = all.AttributeValue + return nil +} diff --git a/api/v2/datadog/model_saml_assertion_attributes_type.go b/api/v2/datadog/model_saml_assertion_attributes_type.go new file mode 100644 index 00000000000..4dfc7c99553 --- /dev/null +++ b/api/v2/datadog/model_saml_assertion_attributes_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SAMLAssertionAttributesType SAML assertion attributes resource type. +type SAMLAssertionAttributesType string + +// List of SAMLAssertionAttributesType. +const ( + SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES SAMLAssertionAttributesType = "saml_assertion_attributes" +) + +var allowedSAMLAssertionAttributesTypeEnumValues = []SAMLAssertionAttributesType{ + SAMLASSERTIONATTRIBUTESTYPE_SAML_ASSERTION_ATTRIBUTES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SAMLAssertionAttributesType) GetAllowedValues() []SAMLAssertionAttributesType { + return allowedSAMLAssertionAttributesTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SAMLAssertionAttributesType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SAMLAssertionAttributesType(value) + return nil +} + +// NewSAMLAssertionAttributesTypeFromValue returns a pointer to a valid SAMLAssertionAttributesType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSAMLAssertionAttributesTypeFromValue(v string) (*SAMLAssertionAttributesType, error) { + ev := SAMLAssertionAttributesType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SAMLAssertionAttributesType: valid values are %v", v, allowedSAMLAssertionAttributesTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SAMLAssertionAttributesType) IsValid() bool { + for _, existing := range allowedSAMLAssertionAttributesTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SAMLAssertionAttributesType value. +func (v SAMLAssertionAttributesType) Ptr() *SAMLAssertionAttributesType { + return &v +} + +// NullableSAMLAssertionAttributesType handles when a null is used for SAMLAssertionAttributesType. +type NullableSAMLAssertionAttributesType struct { + value *SAMLAssertionAttributesType + isSet bool +} + +// Get returns the associated value. +func (v NullableSAMLAssertionAttributesType) Get() *SAMLAssertionAttributesType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSAMLAssertionAttributesType) Set(val *SAMLAssertionAttributesType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSAMLAssertionAttributesType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSAMLAssertionAttributesType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSAMLAssertionAttributesType initializes the struct as if Set has been called. +func NewNullableSAMLAssertionAttributesType(val *SAMLAssertionAttributesType) *NullableSAMLAssertionAttributesType { + return &NullableSAMLAssertionAttributesType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSAMLAssertionAttributesType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSAMLAssertionAttributesType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_filter.go b/api/v2/datadog/model_security_filter.go new file mode 100644 index 00000000000..d1dd515c9ce --- /dev/null +++ b/api/v2/datadog/model_security_filter.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityFilter The security filter's properties. +type SecurityFilter struct { + // The object describing a security filter. + Attributes *SecurityFilterAttributes `json:"attributes,omitempty"` + // The ID of the security filter. + Id *string `json:"id,omitempty"` + // The type of the resource. The value should always be `security_filters`. + Type *SecurityFilterType `json:"type,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{} +} + +// NewSecurityFilter instantiates a new SecurityFilter 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 NewSecurityFilter() *SecurityFilter { + this := SecurityFilter{} + var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS + this.Type = &typeVar + return &this +} + +// NewSecurityFilterWithDefaults instantiates a new SecurityFilter 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 NewSecurityFilterWithDefaults() *SecurityFilter { + this := SecurityFilter{} + var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SecurityFilter) GetAttributes() SecurityFilterAttributes { + if o == nil || o.Attributes == nil { + var ret SecurityFilterAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilter) GetAttributesOk() (*SecurityFilterAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SecurityFilter) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SecurityFilterAttributes and assigns it to the Attributes field. +func (o *SecurityFilter) SetAttributes(v SecurityFilterAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityFilter) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilter) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityFilter) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityFilter) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityFilter) GetType() SecurityFilterType { + if o == nil || o.Type == nil { + var ret SecurityFilterType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilter) GetTypeOk() (*SecurityFilterType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityFilter) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SecurityFilterType and assigns it to the Type field. +func (o *SecurityFilter) SetType(v SecurityFilterType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *SecurityFilterAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SecurityFilterType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_security_filter_attributes.go b/api/v2/datadog/model_security_filter_attributes.go new file mode 100644 index 00000000000..60f7a857a3e --- /dev/null +++ b/api/v2/datadog/model_security_filter_attributes.go @@ -0,0 +1,344 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityFilterAttributes The object describing a security filter. +type SecurityFilterAttributes struct { + // The list of exclusion filters applied in this security filter. + ExclusionFilters []SecurityFilterExclusionFilterResponse `json:"exclusion_filters,omitempty"` + // The filtered data type. + FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` + // Whether the security filter is the built-in filter. + IsBuiltin *bool `json:"is_builtin,omitempty"` + // Whether the security filter is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // The security filter name. + Name *string `json:"name,omitempty"` + // The security filter query. Logs accepted by this query will be accepted by this filter. + Query *string `json:"query,omitempty"` + // The version of the security filter. + Version *int32 `json:"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{} +} + +// NewSecurityFilterAttributes instantiates a new SecurityFilterAttributes 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 NewSecurityFilterAttributes() *SecurityFilterAttributes { + this := SecurityFilterAttributes{} + return &this +} + +// NewSecurityFilterAttributesWithDefaults instantiates a new SecurityFilterAttributes 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 NewSecurityFilterAttributesWithDefaults() *SecurityFilterAttributes { + this := SecurityFilterAttributes{} + return &this +} + +// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. +func (o *SecurityFilterAttributes) GetExclusionFilters() []SecurityFilterExclusionFilterResponse { + if o == nil || o.ExclusionFilters == nil { + var ret []SecurityFilterExclusionFilterResponse + return ret + } + return o.ExclusionFilters +} + +// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterAttributes) GetExclusionFiltersOk() (*[]SecurityFilterExclusionFilterResponse, bool) { + if o == nil || o.ExclusionFilters == nil { + return nil, false + } + return &o.ExclusionFilters, true +} + +// HasExclusionFilters returns a boolean if a field has been set. +func (o *SecurityFilterAttributes) HasExclusionFilters() bool { + if o != nil && o.ExclusionFilters != nil { + return true + } + + return false +} + +// SetExclusionFilters gets a reference to the given []SecurityFilterExclusionFilterResponse and assigns it to the ExclusionFilters field. +func (o *SecurityFilterAttributes) SetExclusionFilters(v []SecurityFilterExclusionFilterResponse) { + o.ExclusionFilters = v +} + +// GetFilteredDataType returns the FilteredDataType field value if set, zero value otherwise. +func (o *SecurityFilterAttributes) GetFilteredDataType() SecurityFilterFilteredDataType { + if o == nil || o.FilteredDataType == nil { + var ret SecurityFilterFilteredDataType + return ret + } + return *o.FilteredDataType +} + +// GetFilteredDataTypeOk returns a tuple with the FilteredDataType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterAttributes) GetFilteredDataTypeOk() (*SecurityFilterFilteredDataType, bool) { + if o == nil || o.FilteredDataType == nil { + return nil, false + } + return o.FilteredDataType, true +} + +// HasFilteredDataType returns a boolean if a field has been set. +func (o *SecurityFilterAttributes) HasFilteredDataType() bool { + if o != nil && o.FilteredDataType != nil { + return true + } + + return false +} + +// SetFilteredDataType gets a reference to the given SecurityFilterFilteredDataType and assigns it to the FilteredDataType field. +func (o *SecurityFilterAttributes) SetFilteredDataType(v SecurityFilterFilteredDataType) { + o.FilteredDataType = &v +} + +// GetIsBuiltin returns the IsBuiltin field value if set, zero value otherwise. +func (o *SecurityFilterAttributes) GetIsBuiltin() bool { + if o == nil || o.IsBuiltin == nil { + var ret bool + return ret + } + return *o.IsBuiltin +} + +// GetIsBuiltinOk returns a tuple with the IsBuiltin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterAttributes) GetIsBuiltinOk() (*bool, bool) { + if o == nil || o.IsBuiltin == nil { + return nil, false + } + return o.IsBuiltin, true +} + +// HasIsBuiltin returns a boolean if a field has been set. +func (o *SecurityFilterAttributes) HasIsBuiltin() bool { + if o != nil && o.IsBuiltin != nil { + return true + } + + return false +} + +// SetIsBuiltin gets a reference to the given bool and assigns it to the IsBuiltin field. +func (o *SecurityFilterAttributes) SetIsBuiltin(v bool) { + o.IsBuiltin = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *SecurityFilterAttributes) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterAttributes) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *SecurityFilterAttributes) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *SecurityFilterAttributes) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityFilterAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityFilterAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityFilterAttributes) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SecurityFilterAttributes) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterAttributes) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SecurityFilterAttributes) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *SecurityFilterAttributes) SetQuery(v string) { + o.Query = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityFilterAttributes) GetVersion() int32 { + if o == nil || o.Version == nil { + var ret int32 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterAttributes) GetVersionOk() (*int32, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityFilterAttributes) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int32 and assigns it to the Version field. +func (o *SecurityFilterAttributes) SetVersion(v int32) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ExclusionFilters != nil { + toSerialize["exclusion_filters"] = o.ExclusionFilters + } + if o.FilteredDataType != nil { + toSerialize["filtered_data_type"] = o.FilteredDataType + } + if o.IsBuiltin != nil { + toSerialize["is_builtin"] = o.IsBuiltin + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ExclusionFilters []SecurityFilterExclusionFilterResponse `json:"exclusion_filters,omitempty"` + FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` + IsBuiltin *bool `json:"is_builtin,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Query *string `json:"query,omitempty"` + Version *int32 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.FilteredDataType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ExclusionFilters = all.ExclusionFilters + o.FilteredDataType = all.FilteredDataType + o.IsBuiltin = all.IsBuiltin + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Query = all.Query + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_security_filter_create_attributes.go b/api/v2/datadog/model_security_filter_create_attributes.go new file mode 100644 index 00000000000..068ae891c83 --- /dev/null +++ b/api/v2/datadog/model_security_filter_create_attributes.go @@ -0,0 +1,243 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterCreateAttributes Object containing the attributes of the security filter to be created. +type SecurityFilterCreateAttributes struct { + // Exclusion filters to exclude some logs from the security filter. + ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters"` + // The filtered data type. + FilteredDataType SecurityFilterFilteredDataType `json:"filtered_data_type"` + // Whether the security filter is enabled. + IsEnabled bool `json:"is_enabled"` + // The name of the security filter. + Name string `json:"name"` + // The query of the security filter. + Query string `json:"query"` + // 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{} +} + +// NewSecurityFilterCreateAttributes instantiates a new SecurityFilterCreateAttributes 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 NewSecurityFilterCreateAttributes(exclusionFilters []SecurityFilterExclusionFilter, filteredDataType SecurityFilterFilteredDataType, isEnabled bool, name string, query string) *SecurityFilterCreateAttributes { + this := SecurityFilterCreateAttributes{} + this.ExclusionFilters = exclusionFilters + this.FilteredDataType = filteredDataType + this.IsEnabled = isEnabled + this.Name = name + this.Query = query + return &this +} + +// NewSecurityFilterCreateAttributesWithDefaults instantiates a new SecurityFilterCreateAttributes 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 NewSecurityFilterCreateAttributesWithDefaults() *SecurityFilterCreateAttributes { + this := SecurityFilterCreateAttributes{} + return &this +} + +// GetExclusionFilters returns the ExclusionFilters field value. +func (o *SecurityFilterCreateAttributes) GetExclusionFilters() []SecurityFilterExclusionFilter { + if o == nil { + var ret []SecurityFilterExclusionFilter + return ret + } + return o.ExclusionFilters +} + +// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value +// and a boolean to check if the value has been set. +func (o *SecurityFilterCreateAttributes) GetExclusionFiltersOk() (*[]SecurityFilterExclusionFilter, bool) { + if o == nil { + return nil, false + } + return &o.ExclusionFilters, true +} + +// SetExclusionFilters sets field value. +func (o *SecurityFilterCreateAttributes) SetExclusionFilters(v []SecurityFilterExclusionFilter) { + o.ExclusionFilters = v +} + +// GetFilteredDataType returns the FilteredDataType field value. +func (o *SecurityFilterCreateAttributes) GetFilteredDataType() SecurityFilterFilteredDataType { + if o == nil { + var ret SecurityFilterFilteredDataType + return ret + } + return o.FilteredDataType +} + +// GetFilteredDataTypeOk returns a tuple with the FilteredDataType field value +// and a boolean to check if the value has been set. +func (o *SecurityFilterCreateAttributes) GetFilteredDataTypeOk() (*SecurityFilterFilteredDataType, bool) { + if o == nil { + return nil, false + } + return &o.FilteredDataType, true +} + +// SetFilteredDataType sets field value. +func (o *SecurityFilterCreateAttributes) SetFilteredDataType(v SecurityFilterFilteredDataType) { + o.FilteredDataType = v +} + +// GetIsEnabled returns the IsEnabled field value. +func (o *SecurityFilterCreateAttributes) GetIsEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value +// and a boolean to check if the value has been set. +func (o *SecurityFilterCreateAttributes) GetIsEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsEnabled, true +} + +// SetIsEnabled sets field value. +func (o *SecurityFilterCreateAttributes) SetIsEnabled(v bool) { + o.IsEnabled = v +} + +// GetName returns the Name field value. +func (o *SecurityFilterCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SecurityFilterCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SecurityFilterCreateAttributes) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value. +func (o *SecurityFilterCreateAttributes) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *SecurityFilterCreateAttributes) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *SecurityFilterCreateAttributes) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["exclusion_filters"] = o.ExclusionFilters + toSerialize["filtered_data_type"] = o.FilteredDataType + toSerialize["is_enabled"] = o.IsEnabled + toSerialize["name"] = o.Name + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + ExclusionFilters *[]SecurityFilterExclusionFilter `json:"exclusion_filters"` + FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type"` + IsEnabled *bool `json:"is_enabled"` + Name *string `json:"name"` + Query *string `json:"query"` + }{} + all := struct { + ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters"` + FilteredDataType SecurityFilterFilteredDataType `json:"filtered_data_type"` + IsEnabled bool `json:"is_enabled"` + Name string `json:"name"` + Query string `json:"query"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.ExclusionFilters == nil { + return fmt.Errorf("Required field exclusion_filters missing") + } + if required.FilteredDataType == nil { + return fmt.Errorf("Required field filtered_data_type missing") + } + if required.IsEnabled == nil { + return fmt.Errorf("Required field is_enabled missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.FilteredDataType; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ExclusionFilters = all.ExclusionFilters + o.FilteredDataType = all.FilteredDataType + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_security_filter_create_data.go b/api/v2/datadog/model_security_filter_create_data.go new file mode 100644 index 00000000000..59aa8ce333e --- /dev/null +++ b/api/v2/datadog/model_security_filter_create_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterCreateData Object for a single security filter. +type SecurityFilterCreateData struct { + // Object containing the attributes of the security filter to be created. + Attributes SecurityFilterCreateAttributes `json:"attributes"` + // The type of the resource. The value should always be `security_filters`. + Type SecurityFilterType `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{} +} + +// NewSecurityFilterCreateData instantiates a new SecurityFilterCreateData 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 NewSecurityFilterCreateData(attributes SecurityFilterCreateAttributes, typeVar SecurityFilterType) *SecurityFilterCreateData { + this := SecurityFilterCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewSecurityFilterCreateDataWithDefaults instantiates a new SecurityFilterCreateData 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 NewSecurityFilterCreateDataWithDefaults() *SecurityFilterCreateData { + this := SecurityFilterCreateData{} + var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityFilterCreateData) GetAttributes() SecurityFilterCreateAttributes { + if o == nil { + var ret SecurityFilterCreateAttributes + 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 *SecurityFilterCreateData) GetAttributesOk() (*SecurityFilterCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityFilterCreateData) SetAttributes(v SecurityFilterCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *SecurityFilterCreateData) GetType() SecurityFilterType { + if o == nil { + var ret SecurityFilterType + 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 *SecurityFilterCreateData) GetTypeOk() (*SecurityFilterType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityFilterCreateData) SetType(v SecurityFilterType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *SecurityFilterCreateAttributes `json:"attributes"` + Type *SecurityFilterType `json:"type"` + }{} + all := struct { + Attributes SecurityFilterCreateAttributes `json:"attributes"` + Type SecurityFilterType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_security_filter_create_request.go b/api/v2/datadog/model_security_filter_create_request.go new file mode 100644 index 00000000000..794a023503a --- /dev/null +++ b/api/v2/datadog/model_security_filter_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterCreateRequest Request object that includes the security filter that you would like to create. +type SecurityFilterCreateRequest struct { + // Object for a single security filter. + Data SecurityFilterCreateData `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{} +} + +// NewSecurityFilterCreateRequest instantiates a new SecurityFilterCreateRequest 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 NewSecurityFilterCreateRequest(data SecurityFilterCreateData) *SecurityFilterCreateRequest { + this := SecurityFilterCreateRequest{} + this.Data = data + return &this +} + +// NewSecurityFilterCreateRequestWithDefaults instantiates a new SecurityFilterCreateRequest 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 NewSecurityFilterCreateRequestWithDefaults() *SecurityFilterCreateRequest { + this := SecurityFilterCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityFilterCreateRequest) GetData() SecurityFilterCreateData { + if o == nil { + var ret SecurityFilterCreateData + 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 *SecurityFilterCreateRequest) GetDataOk() (*SecurityFilterCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityFilterCreateRequest) SetData(v SecurityFilterCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *SecurityFilterCreateData `json:"data"` + }{} + all := struct { + Data SecurityFilterCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_security_filter_exclusion_filter.go b/api/v2/datadog/model_security_filter_exclusion_filter.go new file mode 100644 index 00000000000..992fdf2db53 --- /dev/null +++ b/api/v2/datadog/model_security_filter_exclusion_filter.go @@ -0,0 +1,136 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterExclusionFilter Exclusion filter for the security filter. +type SecurityFilterExclusionFilter struct { + // Exclusion filter name. + Name string `json:"name"` + // Exclusion filter query. Logs that match this query are excluded from the security filter. + Query string `json:"query"` + // 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{} +} + +// NewSecurityFilterExclusionFilter instantiates a new SecurityFilterExclusionFilter 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 NewSecurityFilterExclusionFilter(name string, query string) *SecurityFilterExclusionFilter { + this := SecurityFilterExclusionFilter{} + this.Name = name + this.Query = query + return &this +} + +// NewSecurityFilterExclusionFilterWithDefaults instantiates a new SecurityFilterExclusionFilter 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 NewSecurityFilterExclusionFilterWithDefaults() *SecurityFilterExclusionFilter { + this := SecurityFilterExclusionFilter{} + return &this +} + +// GetName returns the Name field value. +func (o *SecurityFilterExclusionFilter) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SecurityFilterExclusionFilter) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SecurityFilterExclusionFilter) SetName(v string) { + o.Name = v +} + +// GetQuery returns the Query field value. +func (o *SecurityFilterExclusionFilter) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *SecurityFilterExclusionFilter) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *SecurityFilterExclusionFilter) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterExclusionFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Name *string `json:"name"` + Query *string `json:"query"` + }{} + all := struct { + Name string `json:"name"` + Query string `json:"query"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_security_filter_exclusion_filter_response.go b/api/v2/datadog/model_security_filter_exclusion_filter_response.go new file mode 100644 index 00000000000..408a275bff5 --- /dev/null +++ b/api/v2/datadog/model_security_filter_exclusion_filter_response.go @@ -0,0 +1,141 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityFilterExclusionFilterResponse A single exclusion filter. +type SecurityFilterExclusionFilterResponse struct { + // The exclusion filter name. + Name *string `json:"name,omitempty"` + // The exclusion filter query. + Query *string `json:"query,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{} +} + +// NewSecurityFilterExclusionFilterResponse instantiates a new SecurityFilterExclusionFilterResponse 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 NewSecurityFilterExclusionFilterResponse() *SecurityFilterExclusionFilterResponse { + this := SecurityFilterExclusionFilterResponse{} + return &this +} + +// NewSecurityFilterExclusionFilterResponseWithDefaults instantiates a new SecurityFilterExclusionFilterResponse 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 NewSecurityFilterExclusionFilterResponseWithDefaults() *SecurityFilterExclusionFilterResponse { + this := SecurityFilterExclusionFilterResponse{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityFilterExclusionFilterResponse) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterExclusionFilterResponse) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityFilterExclusionFilterResponse) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityFilterExclusionFilterResponse) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SecurityFilterExclusionFilterResponse) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterExclusionFilterResponse) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SecurityFilterExclusionFilterResponse) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *SecurityFilterExclusionFilterResponse) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterExclusionFilterResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterExclusionFilterResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Name *string `json:"name,omitempty"` + Query *string `json:"query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Name = all.Name + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_security_filter_filtered_data_type.go b/api/v2/datadog/model_security_filter_filtered_data_type.go new file mode 100644 index 00000000000..8a746eab8ea --- /dev/null +++ b/api/v2/datadog/model_security_filter_filtered_data_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterFilteredDataType The filtered data type. +type SecurityFilterFilteredDataType string + +// List of SecurityFilterFilteredDataType. +const ( + SECURITYFILTERFILTEREDDATATYPE_LOGS SecurityFilterFilteredDataType = "logs" +) + +var allowedSecurityFilterFilteredDataTypeEnumValues = []SecurityFilterFilteredDataType{ + SECURITYFILTERFILTEREDDATATYPE_LOGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityFilterFilteredDataType) GetAllowedValues() []SecurityFilterFilteredDataType { + return allowedSecurityFilterFilteredDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityFilterFilteredDataType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityFilterFilteredDataType(value) + return nil +} + +// NewSecurityFilterFilteredDataTypeFromValue returns a pointer to a valid SecurityFilterFilteredDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityFilterFilteredDataTypeFromValue(v string) (*SecurityFilterFilteredDataType, error) { + ev := SecurityFilterFilteredDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityFilterFilteredDataType: valid values are %v", v, allowedSecurityFilterFilteredDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityFilterFilteredDataType) IsValid() bool { + for _, existing := range allowedSecurityFilterFilteredDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityFilterFilteredDataType value. +func (v SecurityFilterFilteredDataType) Ptr() *SecurityFilterFilteredDataType { + return &v +} + +// NullableSecurityFilterFilteredDataType handles when a null is used for SecurityFilterFilteredDataType. +type NullableSecurityFilterFilteredDataType struct { + value *SecurityFilterFilteredDataType + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityFilterFilteredDataType) Get() *SecurityFilterFilteredDataType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityFilterFilteredDataType) Set(val *SecurityFilterFilteredDataType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityFilterFilteredDataType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityFilterFilteredDataType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityFilterFilteredDataType initializes the struct as if Set has been called. +func NewNullableSecurityFilterFilteredDataType(val *SecurityFilterFilteredDataType) *NullableSecurityFilterFilteredDataType { + return &NullableSecurityFilterFilteredDataType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityFilterFilteredDataType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityFilterFilteredDataType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_filter_meta.go b/api/v2/datadog/model_security_filter_meta.go new file mode 100644 index 00000000000..1234910e0f4 --- /dev/null +++ b/api/v2/datadog/model_security_filter_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 datadog + +import ( + "encoding/json" +) + +// SecurityFilterMeta Optional metadata associated to the response. +type SecurityFilterMeta struct { + // A warning message. + Warning *string `json:"warning,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{} +} + +// NewSecurityFilterMeta instantiates a new SecurityFilterMeta 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 NewSecurityFilterMeta() *SecurityFilterMeta { + this := SecurityFilterMeta{} + return &this +} + +// NewSecurityFilterMetaWithDefaults instantiates a new SecurityFilterMeta 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 NewSecurityFilterMetaWithDefaults() *SecurityFilterMeta { + this := SecurityFilterMeta{} + return &this +} + +// GetWarning returns the Warning field value if set, zero value otherwise. +func (o *SecurityFilterMeta) GetWarning() string { + if o == nil || o.Warning == nil { + var ret string + return ret + } + return *o.Warning +} + +// GetWarningOk returns a tuple with the Warning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterMeta) GetWarningOk() (*string, bool) { + if o == nil || o.Warning == nil { + return nil, false + } + return o.Warning, true +} + +// HasWarning returns a boolean if a field has been set. +func (o *SecurityFilterMeta) HasWarning() bool { + if o != nil && o.Warning != nil { + return true + } + + return false +} + +// SetWarning gets a reference to the given string and assigns it to the Warning field. +func (o *SecurityFilterMeta) SetWarning(v string) { + o.Warning = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Warning != nil { + toSerialize["warning"] = o.Warning + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Warning *string `json:"warning,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Warning = all.Warning + return nil +} diff --git a/api/v2/datadog/model_security_filter_response.go b/api/v2/datadog/model_security_filter_response.go new file mode 100644 index 00000000000..a7ac08c0d42 --- /dev/null +++ b/api/v2/datadog/model_security_filter_response.go @@ -0,0 +1,155 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityFilterResponse Response object which includes a single security filter. +type SecurityFilterResponse struct { + // The security filter's properties. + Data *SecurityFilter `json:"data,omitempty"` + // Optional metadata associated to the response. + Meta *SecurityFilterMeta `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{} +} + +// NewSecurityFilterResponse instantiates a new SecurityFilterResponse 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 NewSecurityFilterResponse() *SecurityFilterResponse { + this := SecurityFilterResponse{} + return &this +} + +// NewSecurityFilterResponseWithDefaults instantiates a new SecurityFilterResponse 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 NewSecurityFilterResponseWithDefaults() *SecurityFilterResponse { + this := SecurityFilterResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SecurityFilterResponse) GetData() SecurityFilter { + if o == nil || o.Data == nil { + var ret SecurityFilter + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterResponse) GetDataOk() (*SecurityFilter, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SecurityFilterResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given SecurityFilter and assigns it to the Data field. +func (o *SecurityFilterResponse) SetData(v SecurityFilter) { + o.Data = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SecurityFilterResponse) GetMeta() SecurityFilterMeta { + if o == nil || o.Meta == nil { + var ret SecurityFilterMeta + 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 *SecurityFilterResponse) GetMetaOk() (*SecurityFilterMeta, 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 *SecurityFilterResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given SecurityFilterMeta and assigns it to the Meta field. +func (o *SecurityFilterResponse) SetMeta(v SecurityFilterMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *SecurityFilter `json:"data,omitempty"` + Meta *SecurityFilterMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_security_filter_type.go b/api/v2/datadog/model_security_filter_type.go new file mode 100644 index 00000000000..05d0d22d727 --- /dev/null +++ b/api/v2/datadog/model_security_filter_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterType The type of the resource. The value should always be `security_filters`. +type SecurityFilterType string + +// List of SecurityFilterType. +const ( + SECURITYFILTERTYPE_SECURITY_FILTERS SecurityFilterType = "security_filters" +) + +var allowedSecurityFilterTypeEnumValues = []SecurityFilterType{ + SECURITYFILTERTYPE_SECURITY_FILTERS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityFilterType) GetAllowedValues() []SecurityFilterType { + return allowedSecurityFilterTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityFilterType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityFilterType(value) + return nil +} + +// NewSecurityFilterTypeFromValue returns a pointer to a valid SecurityFilterType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityFilterTypeFromValue(v string) (*SecurityFilterType, error) { + ev := SecurityFilterType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityFilterType: valid values are %v", v, allowedSecurityFilterTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityFilterType) IsValid() bool { + for _, existing := range allowedSecurityFilterTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityFilterType value. +func (v SecurityFilterType) Ptr() *SecurityFilterType { + return &v +} + +// NullableSecurityFilterType handles when a null is used for SecurityFilterType. +type NullableSecurityFilterType struct { + value *SecurityFilterType + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityFilterType) Get() *SecurityFilterType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityFilterType) Set(val *SecurityFilterType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityFilterType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityFilterType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityFilterType initializes the struct as if Set has been called. +func NewNullableSecurityFilterType(val *SecurityFilterType) *NullableSecurityFilterType { + return &NullableSecurityFilterType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityFilterType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityFilterType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_filter_update_attributes.go b/api/v2/datadog/model_security_filter_update_attributes.go new file mode 100644 index 00000000000..8642b9c872c --- /dev/null +++ b/api/v2/datadog/model_security_filter_update_attributes.go @@ -0,0 +1,305 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityFilterUpdateAttributes The security filters properties to be updated. +type SecurityFilterUpdateAttributes struct { + // Exclusion filters to exclude some logs from the security filter. + ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters,omitempty"` + // The filtered data type. + FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` + // Whether the security filter is enabled. + IsEnabled *bool `json:"is_enabled,omitempty"` + // The name of the security filter. + Name *string `json:"name,omitempty"` + // The query of the security filter. + Query *string `json:"query,omitempty"` + // The version of the security filter to update. + Version *int32 `json:"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{} +} + +// NewSecurityFilterUpdateAttributes instantiates a new SecurityFilterUpdateAttributes 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 NewSecurityFilterUpdateAttributes() *SecurityFilterUpdateAttributes { + this := SecurityFilterUpdateAttributes{} + return &this +} + +// NewSecurityFilterUpdateAttributesWithDefaults instantiates a new SecurityFilterUpdateAttributes 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 NewSecurityFilterUpdateAttributesWithDefaults() *SecurityFilterUpdateAttributes { + this := SecurityFilterUpdateAttributes{} + return &this +} + +// GetExclusionFilters returns the ExclusionFilters field value if set, zero value otherwise. +func (o *SecurityFilterUpdateAttributes) GetExclusionFilters() []SecurityFilterExclusionFilter { + if o == nil || o.ExclusionFilters == nil { + var ret []SecurityFilterExclusionFilter + return ret + } + return o.ExclusionFilters +} + +// GetExclusionFiltersOk returns a tuple with the ExclusionFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterUpdateAttributes) GetExclusionFiltersOk() (*[]SecurityFilterExclusionFilter, bool) { + if o == nil || o.ExclusionFilters == nil { + return nil, false + } + return &o.ExclusionFilters, true +} + +// HasExclusionFilters returns a boolean if a field has been set. +func (o *SecurityFilterUpdateAttributes) HasExclusionFilters() bool { + if o != nil && o.ExclusionFilters != nil { + return true + } + + return false +} + +// SetExclusionFilters gets a reference to the given []SecurityFilterExclusionFilter and assigns it to the ExclusionFilters field. +func (o *SecurityFilterUpdateAttributes) SetExclusionFilters(v []SecurityFilterExclusionFilter) { + o.ExclusionFilters = v +} + +// GetFilteredDataType returns the FilteredDataType field value if set, zero value otherwise. +func (o *SecurityFilterUpdateAttributes) GetFilteredDataType() SecurityFilterFilteredDataType { + if o == nil || o.FilteredDataType == nil { + var ret SecurityFilterFilteredDataType + return ret + } + return *o.FilteredDataType +} + +// GetFilteredDataTypeOk returns a tuple with the FilteredDataType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterUpdateAttributes) GetFilteredDataTypeOk() (*SecurityFilterFilteredDataType, bool) { + if o == nil || o.FilteredDataType == nil { + return nil, false + } + return o.FilteredDataType, true +} + +// HasFilteredDataType returns a boolean if a field has been set. +func (o *SecurityFilterUpdateAttributes) HasFilteredDataType() bool { + if o != nil && o.FilteredDataType != nil { + return true + } + + return false +} + +// SetFilteredDataType gets a reference to the given SecurityFilterFilteredDataType and assigns it to the FilteredDataType field. +func (o *SecurityFilterUpdateAttributes) SetFilteredDataType(v SecurityFilterFilteredDataType) { + o.FilteredDataType = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *SecurityFilterUpdateAttributes) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterUpdateAttributes) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *SecurityFilterUpdateAttributes) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *SecurityFilterUpdateAttributes) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityFilterUpdateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityFilterUpdateAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityFilterUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SecurityFilterUpdateAttributes) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterUpdateAttributes) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SecurityFilterUpdateAttributes) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *SecurityFilterUpdateAttributes) SetQuery(v string) { + o.Query = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityFilterUpdateAttributes) GetVersion() int32 { + if o == nil || o.Version == nil { + var ret int32 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFilterUpdateAttributes) GetVersionOk() (*int32, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityFilterUpdateAttributes) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int32 and assigns it to the Version field. +func (o *SecurityFilterUpdateAttributes) SetVersion(v int32) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ExclusionFilters != nil { + toSerialize["exclusion_filters"] = o.ExclusionFilters + } + if o.FilteredDataType != nil { + toSerialize["filtered_data_type"] = o.FilteredDataType + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters,omitempty"` + FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Query *string `json:"query,omitempty"` + Version *int32 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.FilteredDataType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ExclusionFilters = all.ExclusionFilters + o.FilteredDataType = all.FilteredDataType + o.IsEnabled = all.IsEnabled + o.Name = all.Name + o.Query = all.Query + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_security_filter_update_data.go b/api/v2/datadog/model_security_filter_update_data.go new file mode 100644 index 00000000000..8cf4f7c842b --- /dev/null +++ b/api/v2/datadog/model_security_filter_update_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterUpdateData The new security filter properties. +type SecurityFilterUpdateData struct { + // The security filters properties to be updated. + Attributes SecurityFilterUpdateAttributes `json:"attributes"` + // The type of the resource. The value should always be `security_filters`. + Type SecurityFilterType `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{} +} + +// NewSecurityFilterUpdateData instantiates a new SecurityFilterUpdateData 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 NewSecurityFilterUpdateData(attributes SecurityFilterUpdateAttributes, typeVar SecurityFilterType) *SecurityFilterUpdateData { + this := SecurityFilterUpdateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewSecurityFilterUpdateDataWithDefaults instantiates a new SecurityFilterUpdateData 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 NewSecurityFilterUpdateDataWithDefaults() *SecurityFilterUpdateData { + this := SecurityFilterUpdateData{} + var typeVar SecurityFilterType = SECURITYFILTERTYPE_SECURITY_FILTERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityFilterUpdateData) GetAttributes() SecurityFilterUpdateAttributes { + if o == nil { + var ret SecurityFilterUpdateAttributes + 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 *SecurityFilterUpdateData) GetAttributesOk() (*SecurityFilterUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityFilterUpdateData) SetAttributes(v SecurityFilterUpdateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *SecurityFilterUpdateData) GetType() SecurityFilterType { + if o == nil { + var ret SecurityFilterType + 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 *SecurityFilterUpdateData) GetTypeOk() (*SecurityFilterType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecurityFilterUpdateData) SetType(v SecurityFilterType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *SecurityFilterUpdateAttributes `json:"attributes"` + Type *SecurityFilterType `json:"type"` + }{} + all := struct { + Attributes SecurityFilterUpdateAttributes `json:"attributes"` + Type SecurityFilterType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_security_filter_update_request.go b/api/v2/datadog/model_security_filter_update_request.go new file mode 100644 index 00000000000..2a9c306f39b --- /dev/null +++ b/api/v2/datadog/model_security_filter_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityFilterUpdateRequest The new security filter body. +type SecurityFilterUpdateRequest struct { + // The new security filter properties. + Data SecurityFilterUpdateData `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{} +} + +// NewSecurityFilterUpdateRequest instantiates a new SecurityFilterUpdateRequest 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 NewSecurityFilterUpdateRequest(data SecurityFilterUpdateData) *SecurityFilterUpdateRequest { + this := SecurityFilterUpdateRequest{} + this.Data = data + return &this +} + +// NewSecurityFilterUpdateRequestWithDefaults instantiates a new SecurityFilterUpdateRequest 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 NewSecurityFilterUpdateRequestWithDefaults() *SecurityFilterUpdateRequest { + this := SecurityFilterUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityFilterUpdateRequest) GetData() SecurityFilterUpdateData { + if o == nil { + var ret SecurityFilterUpdateData + 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 *SecurityFilterUpdateRequest) GetDataOk() (*SecurityFilterUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityFilterUpdateRequest) SetData(v SecurityFilterUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFilterUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFilterUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *SecurityFilterUpdateData `json:"data"` + }{} + all := struct { + Data SecurityFilterUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_security_filters_response.go b/api/v2/datadog/model_security_filters_response.go new file mode 100644 index 00000000000..921268c99f1 --- /dev/null +++ b/api/v2/datadog/model_security_filters_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 datadog + +import ( + "encoding/json" +) + +// SecurityFiltersResponse All the available security filters objects. +type SecurityFiltersResponse struct { + // A list of security filters objects. + Data []SecurityFilter `json:"data,omitempty"` + // Optional metadata associated to the response. + Meta *SecurityFilterMeta `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{} +} + +// NewSecurityFiltersResponse instantiates a new SecurityFiltersResponse 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 NewSecurityFiltersResponse() *SecurityFiltersResponse { + this := SecurityFiltersResponse{} + return &this +} + +// NewSecurityFiltersResponseWithDefaults instantiates a new SecurityFiltersResponse 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 NewSecurityFiltersResponseWithDefaults() *SecurityFiltersResponse { + this := SecurityFiltersResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SecurityFiltersResponse) GetData() []SecurityFilter { + if o == nil || o.Data == nil { + var ret []SecurityFilter + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityFiltersResponse) GetDataOk() (*[]SecurityFilter, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SecurityFiltersResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []SecurityFilter and assigns it to the Data field. +func (o *SecurityFiltersResponse) SetData(v []SecurityFilter) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SecurityFiltersResponse) GetMeta() SecurityFilterMeta { + if o == nil || o.Meta == nil { + var ret SecurityFilterMeta + 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 *SecurityFiltersResponse) GetMetaOk() (*SecurityFilterMeta, 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 *SecurityFiltersResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given SecurityFilterMeta and assigns it to the Meta field. +func (o *SecurityFiltersResponse) SetMeta(v SecurityFilterMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityFiltersResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityFiltersResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []SecurityFilter `json:"data,omitempty"` + Meta *SecurityFilterMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_filter.go b/api/v2/datadog/model_security_monitoring_filter.go new file mode 100644 index 00000000000..5df344fbbd4 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_filter.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringFilter The rule's suppression filter. +type SecurityMonitoringFilter struct { + // The type of filtering action. + Action *SecurityMonitoringFilterAction `json:"action,omitempty"` + // Query for selecting logs to apply the filtering action. + Query *string `json:"query,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{} +} + +// NewSecurityMonitoringFilter instantiates a new SecurityMonitoringFilter 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 NewSecurityMonitoringFilter() *SecurityMonitoringFilter { + this := SecurityMonitoringFilter{} + return &this +} + +// NewSecurityMonitoringFilterWithDefaults instantiates a new SecurityMonitoringFilter 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 NewSecurityMonitoringFilterWithDefaults() *SecurityMonitoringFilter { + this := SecurityMonitoringFilter{} + return &this +} + +// GetAction returns the Action field value if set, zero value otherwise. +func (o *SecurityMonitoringFilter) GetAction() SecurityMonitoringFilterAction { + if o == nil || o.Action == nil { + var ret SecurityMonitoringFilterAction + return ret + } + return *o.Action +} + +// GetActionOk returns a tuple with the Action field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringFilter) GetActionOk() (*SecurityMonitoringFilterAction, bool) { + if o == nil || o.Action == nil { + return nil, false + } + return o.Action, true +} + +// HasAction returns a boolean if a field has been set. +func (o *SecurityMonitoringFilter) HasAction() bool { + if o != nil && o.Action != nil { + return true + } + + return false +} + +// SetAction gets a reference to the given SecurityMonitoringFilterAction and assigns it to the Action field. +func (o *SecurityMonitoringFilter) SetAction(v SecurityMonitoringFilterAction) { + o.Action = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SecurityMonitoringFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SecurityMonitoringFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *SecurityMonitoringFilter) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Action != nil { + toSerialize["action"] = o.Action + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Action *SecurityMonitoringFilterAction `json:"action,omitempty"` + Query *string `json:"query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Action; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Action = all.Action + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_filter_action.go b/api/v2/datadog/model_security_monitoring_filter_action.go new file mode 100644 index 00000000000..353173b97ff --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_filter_action.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringFilterAction The type of filtering action. +type SecurityMonitoringFilterAction string + +// List of SecurityMonitoringFilterAction. +const ( + SECURITYMONITORINGFILTERACTION_REQUIRE SecurityMonitoringFilterAction = "require" + SECURITYMONITORINGFILTERACTION_SUPPRESS SecurityMonitoringFilterAction = "suppress" +) + +var allowedSecurityMonitoringFilterActionEnumValues = []SecurityMonitoringFilterAction{ + SECURITYMONITORINGFILTERACTION_REQUIRE, + SECURITYMONITORINGFILTERACTION_SUPPRESS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringFilterAction) GetAllowedValues() []SecurityMonitoringFilterAction { + return allowedSecurityMonitoringFilterActionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringFilterAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringFilterAction(value) + return nil +} + +// NewSecurityMonitoringFilterActionFromValue returns a pointer to a valid SecurityMonitoringFilterAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringFilterActionFromValue(v string) (*SecurityMonitoringFilterAction, error) { + ev := SecurityMonitoringFilterAction(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringFilterAction: valid values are %v", v, allowedSecurityMonitoringFilterActionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringFilterAction) IsValid() bool { + for _, existing := range allowedSecurityMonitoringFilterActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringFilterAction value. +func (v SecurityMonitoringFilterAction) Ptr() *SecurityMonitoringFilterAction { + return &v +} + +// NullableSecurityMonitoringFilterAction handles when a null is used for SecurityMonitoringFilterAction. +type NullableSecurityMonitoringFilterAction struct { + value *SecurityMonitoringFilterAction + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringFilterAction) Get() *SecurityMonitoringFilterAction { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringFilterAction) Set(val *SecurityMonitoringFilterAction) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringFilterAction) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringFilterAction) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringFilterAction initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringFilterAction(val *SecurityMonitoringFilterAction) *NullableSecurityMonitoringFilterAction { + return &NullableSecurityMonitoringFilterAction{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringFilterAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringFilterAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_list_rules_response.go b/api/v2/datadog/model_security_monitoring_list_rules_response.go new file mode 100644 index 00000000000..4802bb80dd1 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_list_rules_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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringListRulesResponse List of rules. +type SecurityMonitoringListRulesResponse struct { + // Array containing the list of rules. + Data []SecurityMonitoringRuleResponse `json:"data,omitempty"` + // Object describing meta attributes of response. + Meta *ResponseMetaAttributes `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{} +} + +// NewSecurityMonitoringListRulesResponse instantiates a new SecurityMonitoringListRulesResponse 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 NewSecurityMonitoringListRulesResponse() *SecurityMonitoringListRulesResponse { + this := SecurityMonitoringListRulesResponse{} + return &this +} + +// NewSecurityMonitoringListRulesResponseWithDefaults instantiates a new SecurityMonitoringListRulesResponse 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 NewSecurityMonitoringListRulesResponseWithDefaults() *SecurityMonitoringListRulesResponse { + this := SecurityMonitoringListRulesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SecurityMonitoringListRulesResponse) GetData() []SecurityMonitoringRuleResponse { + if o == nil || o.Data == nil { + var ret []SecurityMonitoringRuleResponse + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringListRulesResponse) GetDataOk() (*[]SecurityMonitoringRuleResponse, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SecurityMonitoringListRulesResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []SecurityMonitoringRuleResponse and assigns it to the Data field. +func (o *SecurityMonitoringListRulesResponse) SetData(v []SecurityMonitoringRuleResponse) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SecurityMonitoringListRulesResponse) GetMeta() ResponseMetaAttributes { + if o == nil || o.Meta == nil { + var ret ResponseMetaAttributes + 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 *SecurityMonitoringListRulesResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *SecurityMonitoringListRulesResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. +func (o *SecurityMonitoringListRulesResponse) SetMeta(v ResponseMetaAttributes) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringListRulesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringListRulesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []SecurityMonitoringRuleResponse `json:"data,omitempty"` + Meta *ResponseMetaAttributes `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_case.go b/api/v2/datadog/model_security_monitoring_rule_case.go new file mode 100644 index 00000000000..7961d664de4 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_case.go @@ -0,0 +1,228 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringRuleCase Case when signal is generated. +type SecurityMonitoringRuleCase struct { + // A rule case contains logical operations (`>`,`>=`, `&&`, `||`) to determine if a signal should be generated + // based on the event counts in the previously defined queries. + Condition *string `json:"condition,omitempty"` + // Name of the case. + Name *string `json:"name,omitempty"` + // Notification targets for each rule case. + Notifications []string `json:"notifications,omitempty"` + // Severity of the Security Signal. + Status *SecurityMonitoringRuleSeverity `json:"status,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{} +} + +// NewSecurityMonitoringRuleCase instantiates a new SecurityMonitoringRuleCase 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 NewSecurityMonitoringRuleCase() *SecurityMonitoringRuleCase { + this := SecurityMonitoringRuleCase{} + return &this +} + +// NewSecurityMonitoringRuleCaseWithDefaults instantiates a new SecurityMonitoringRuleCase 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 NewSecurityMonitoringRuleCaseWithDefaults() *SecurityMonitoringRuleCase { + this := SecurityMonitoringRuleCase{} + return &this +} + +// GetCondition returns the Condition field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCase) GetCondition() string { + if o == nil || o.Condition == nil { + var ret string + return ret + } + return *o.Condition +} + +// GetConditionOk returns a tuple with the Condition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCase) GetConditionOk() (*string, bool) { + if o == nil || o.Condition == nil { + return nil, false + } + return o.Condition, true +} + +// HasCondition returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCase) HasCondition() bool { + if o != nil && o.Condition != nil { + return true + } + + return false +} + +// SetCondition gets a reference to the given string and assigns it to the Condition field. +func (o *SecurityMonitoringRuleCase) SetCondition(v string) { + o.Condition = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCase) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCase) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCase) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityMonitoringRuleCase) SetName(v string) { + o.Name = &v +} + +// GetNotifications returns the Notifications field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCase) GetNotifications() []string { + if o == nil || o.Notifications == nil { + var ret []string + return ret + } + return o.Notifications +} + +// GetNotificationsOk returns a tuple with the Notifications field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCase) GetNotificationsOk() (*[]string, bool) { + if o == nil || o.Notifications == nil { + return nil, false + } + return &o.Notifications, true +} + +// HasNotifications returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCase) HasNotifications() bool { + if o != nil && o.Notifications != nil { + return true + } + + return false +} + +// SetNotifications gets a reference to the given []string and assigns it to the Notifications field. +func (o *SecurityMonitoringRuleCase) SetNotifications(v []string) { + o.Notifications = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCase) GetStatus() SecurityMonitoringRuleSeverity { + if o == nil || o.Status == nil { + var ret SecurityMonitoringRuleSeverity + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCase) GetStatusOk() (*SecurityMonitoringRuleSeverity, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCase) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SecurityMonitoringRuleSeverity and assigns it to the Status field. +func (o *SecurityMonitoringRuleCase) SetStatus(v SecurityMonitoringRuleSeverity) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleCase) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Condition != nil { + toSerialize["condition"] = o.Condition + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Notifications != nil { + toSerialize["notifications"] = o.Notifications + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleCase) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Condition *string `json:"condition,omitempty"` + Name *string `json:"name,omitempty"` + Notifications []string `json:"notifications,omitempty"` + Status *SecurityMonitoringRuleSeverity `json:"status,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Condition = all.Condition + o.Name = all.Name + o.Notifications = all.Notifications + o.Status = all.Status + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_case_create.go b/api/v2/datadog/model_security_monitoring_rule_case_create.go new file mode 100644 index 00000000000..5776b6affc9 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_case_create.go @@ -0,0 +1,229 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleCaseCreate Case when signal is generated. +type SecurityMonitoringRuleCaseCreate struct { + // A rule case contains logical operations (`>`,`>=`, `&&`, `||`) to determine if a signal should be generated + // based on the event counts in the previously defined queries. + Condition *string `json:"condition,omitempty"` + // Name of the case. + Name *string `json:"name,omitempty"` + // Notification targets for each rule case. + Notifications []string `json:"notifications,omitempty"` + // Severity of the Security Signal. + Status SecurityMonitoringRuleSeverity `json:"status"` + // 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{} +} + +// NewSecurityMonitoringRuleCaseCreate instantiates a new SecurityMonitoringRuleCaseCreate 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 NewSecurityMonitoringRuleCaseCreate(status SecurityMonitoringRuleSeverity) *SecurityMonitoringRuleCaseCreate { + this := SecurityMonitoringRuleCaseCreate{} + this.Status = status + return &this +} + +// NewSecurityMonitoringRuleCaseCreateWithDefaults instantiates a new SecurityMonitoringRuleCaseCreate 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 NewSecurityMonitoringRuleCaseCreateWithDefaults() *SecurityMonitoringRuleCaseCreate { + this := SecurityMonitoringRuleCaseCreate{} + return &this +} + +// GetCondition returns the Condition field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCaseCreate) GetCondition() string { + if o == nil || o.Condition == nil { + var ret string + return ret + } + return *o.Condition +} + +// GetConditionOk returns a tuple with the Condition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCaseCreate) GetConditionOk() (*string, bool) { + if o == nil || o.Condition == nil { + return nil, false + } + return o.Condition, true +} + +// HasCondition returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCaseCreate) HasCondition() bool { + if o != nil && o.Condition != nil { + return true + } + + return false +} + +// SetCondition gets a reference to the given string and assigns it to the Condition field. +func (o *SecurityMonitoringRuleCaseCreate) SetCondition(v string) { + o.Condition = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCaseCreate) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCaseCreate) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCaseCreate) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityMonitoringRuleCaseCreate) SetName(v string) { + o.Name = &v +} + +// GetNotifications returns the Notifications field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCaseCreate) GetNotifications() []string { + if o == nil || o.Notifications == nil { + var ret []string + return ret + } + return o.Notifications +} + +// GetNotificationsOk returns a tuple with the Notifications field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCaseCreate) GetNotificationsOk() (*[]string, bool) { + if o == nil || o.Notifications == nil { + return nil, false + } + return &o.Notifications, true +} + +// HasNotifications returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCaseCreate) HasNotifications() bool { + if o != nil && o.Notifications != nil { + return true + } + + return false +} + +// SetNotifications gets a reference to the given []string and assigns it to the Notifications field. +func (o *SecurityMonitoringRuleCaseCreate) SetNotifications(v []string) { + o.Notifications = v +} + +// GetStatus returns the Status field value. +func (o *SecurityMonitoringRuleCaseCreate) GetStatus() SecurityMonitoringRuleSeverity { + if o == nil { + var ret SecurityMonitoringRuleSeverity + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCaseCreate) GetStatusOk() (*SecurityMonitoringRuleSeverity, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value. +func (o *SecurityMonitoringRuleCaseCreate) SetStatus(v SecurityMonitoringRuleSeverity) { + o.Status = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleCaseCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Condition != nil { + toSerialize["condition"] = o.Condition + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Notifications != nil { + toSerialize["notifications"] = o.Notifications + } + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Status *SecurityMonitoringRuleSeverity `json:"status"` + }{} + all := struct { + Condition *string `json:"condition,omitempty"` + Name *string `json:"name,omitempty"` + Notifications []string `json:"notifications,omitempty"` + Status SecurityMonitoringRuleSeverity `json:"status"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Status == nil { + return fmt.Errorf("Required field status missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Status; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Condition = all.Condition + o.Name = all.Name + o.Notifications = all.Notifications + o.Status = all.Status + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_create_payload.go b/api/v2/datadog/model_security_monitoring_rule_create_payload.go new file mode 100644 index 00000000000..818391d42d3 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_create_payload.go @@ -0,0 +1,439 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleCreatePayload Create a new rule. +type SecurityMonitoringRuleCreatePayload struct { + // Cases for generating signals. + Cases []SecurityMonitoringRuleCaseCreate `json:"cases"` + // Additional queries to filter matched events before they are processed. + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + // Whether the notifications include the triggering group-by values in their title. + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + // Whether the rule is enabled. + IsEnabled bool `json:"isEnabled"` + // Message for generated signals. + Message string `json:"message"` + // The name of the rule. + Name string `json:"name"` + // Options on rules. + Options SecurityMonitoringRuleOptions `json:"options"` + // Queries for selecting logs which are part of the rule. + Queries []SecurityMonitoringRuleQueryCreate `json:"queries"` + // Tags for generated signals. + Tags []string `json:"tags,omitempty"` + // The rule type. + Type *SecurityMonitoringRuleTypeCreate `json:"type,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{} +} + +// NewSecurityMonitoringRuleCreatePayload instantiates a new SecurityMonitoringRuleCreatePayload 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 NewSecurityMonitoringRuleCreatePayload(cases []SecurityMonitoringRuleCaseCreate, isEnabled bool, message string, name string, options SecurityMonitoringRuleOptions, queries []SecurityMonitoringRuleQueryCreate) *SecurityMonitoringRuleCreatePayload { + this := SecurityMonitoringRuleCreatePayload{} + this.Cases = cases + this.IsEnabled = isEnabled + this.Message = message + this.Name = name + this.Options = options + this.Queries = queries + return &this +} + +// NewSecurityMonitoringRuleCreatePayloadWithDefaults instantiates a new SecurityMonitoringRuleCreatePayload 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 NewSecurityMonitoringRuleCreatePayloadWithDefaults() *SecurityMonitoringRuleCreatePayload { + this := SecurityMonitoringRuleCreatePayload{} + return &this +} + +// GetCases returns the Cases field value. +func (o *SecurityMonitoringRuleCreatePayload) GetCases() []SecurityMonitoringRuleCaseCreate { + if o == nil { + var ret []SecurityMonitoringRuleCaseCreate + return ret + } + return o.Cases +} + +// GetCasesOk returns a tuple with the Cases field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetCasesOk() (*[]SecurityMonitoringRuleCaseCreate, bool) { + if o == nil { + return nil, false + } + return &o.Cases, true +} + +// SetCases sets field value. +func (o *SecurityMonitoringRuleCreatePayload) SetCases(v []SecurityMonitoringRuleCaseCreate) { + o.Cases = v +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCreatePayload) GetFilters() []SecurityMonitoringFilter { + if o == nil || o.Filters == nil { + var ret []SecurityMonitoringFilter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetFiltersOk() (*[]SecurityMonitoringFilter, bool) { + if o == nil || o.Filters == nil { + return nil, false + } + return &o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCreatePayload) HasFilters() bool { + if o != nil && o.Filters != nil { + return true + } + + return false +} + +// SetFilters gets a reference to the given []SecurityMonitoringFilter and assigns it to the Filters field. +func (o *SecurityMonitoringRuleCreatePayload) SetFilters(v []SecurityMonitoringFilter) { + o.Filters = v +} + +// GetHasExtendedTitle returns the HasExtendedTitle field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCreatePayload) GetHasExtendedTitle() bool { + if o == nil || o.HasExtendedTitle == nil { + var ret bool + return ret + } + return *o.HasExtendedTitle +} + +// GetHasExtendedTitleOk returns a tuple with the HasExtendedTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetHasExtendedTitleOk() (*bool, bool) { + if o == nil || o.HasExtendedTitle == nil { + return nil, false + } + return o.HasExtendedTitle, true +} + +// HasHasExtendedTitle returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCreatePayload) HasHasExtendedTitle() bool { + if o != nil && o.HasExtendedTitle != nil { + return true + } + + return false +} + +// SetHasExtendedTitle gets a reference to the given bool and assigns it to the HasExtendedTitle field. +func (o *SecurityMonitoringRuleCreatePayload) SetHasExtendedTitle(v bool) { + o.HasExtendedTitle = &v +} + +// GetIsEnabled returns the IsEnabled field value. +func (o *SecurityMonitoringRuleCreatePayload) GetIsEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetIsEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsEnabled, true +} + +// SetIsEnabled sets field value. +func (o *SecurityMonitoringRuleCreatePayload) SetIsEnabled(v bool) { + o.IsEnabled = v +} + +// GetMessage returns the Message field value. +func (o *SecurityMonitoringRuleCreatePayload) GetMessage() string { + if o == nil { + var ret string + return ret + } + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value. +func (o *SecurityMonitoringRuleCreatePayload) SetMessage(v string) { + o.Message = v +} + +// GetName returns the Name field value. +func (o *SecurityMonitoringRuleCreatePayload) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SecurityMonitoringRuleCreatePayload) SetName(v string) { + o.Name = v +} + +// GetOptions returns the Options field value. +func (o *SecurityMonitoringRuleCreatePayload) GetOptions() SecurityMonitoringRuleOptions { + if o == nil { + var ret SecurityMonitoringRuleOptions + return ret + } + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetOptionsOk() (*SecurityMonitoringRuleOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value. +func (o *SecurityMonitoringRuleCreatePayload) SetOptions(v SecurityMonitoringRuleOptions) { + o.Options = v +} + +// GetQueries returns the Queries field value. +func (o *SecurityMonitoringRuleCreatePayload) GetQueries() []SecurityMonitoringRuleQueryCreate { + if o == nil { + var ret []SecurityMonitoringRuleQueryCreate + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetQueriesOk() (*[]SecurityMonitoringRuleQueryCreate, bool) { + if o == nil { + return nil, false + } + return &o.Queries, true +} + +// SetQueries sets field value. +func (o *SecurityMonitoringRuleCreatePayload) SetQueries(v []SecurityMonitoringRuleQueryCreate) { + o.Queries = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCreatePayload) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SecurityMonitoringRuleCreatePayload) GetTagsOk() (*[]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 *SecurityMonitoringRuleCreatePayload) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SecurityMonitoringRuleCreatePayload) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleCreatePayload) GetType() SecurityMonitoringRuleTypeCreate { + if o == nil || o.Type == nil { + var ret SecurityMonitoringRuleTypeCreate + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleCreatePayload) GetTypeOk() (*SecurityMonitoringRuleTypeCreate, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleCreatePayload) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SecurityMonitoringRuleTypeCreate and assigns it to the Type field. +func (o *SecurityMonitoringRuleCreatePayload) SetType(v SecurityMonitoringRuleTypeCreate) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleCreatePayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["cases"] = o.Cases + if o.Filters != nil { + toSerialize["filters"] = o.Filters + } + if o.HasExtendedTitle != nil { + toSerialize["hasExtendedTitle"] = o.HasExtendedTitle + } + toSerialize["isEnabled"] = o.IsEnabled + toSerialize["message"] = o.Message + toSerialize["name"] = o.Name + toSerialize["options"] = o.Options + toSerialize["queries"] = o.Queries + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` + IsEnabled *bool `json:"isEnabled"` + Message *string `json:"message"` + Name *string `json:"name"` + Options *SecurityMonitoringRuleOptions `json:"options"` + Queries *[]SecurityMonitoringRuleQueryCreate `json:"queries"` + }{} + all := struct { + Cases []SecurityMonitoringRuleCaseCreate `json:"cases"` + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + IsEnabled bool `json:"isEnabled"` + Message string `json:"message"` + Name string `json:"name"` + Options SecurityMonitoringRuleOptions `json:"options"` + Queries []SecurityMonitoringRuleQueryCreate `json:"queries"` + Tags []string `json:"tags,omitempty"` + Type *SecurityMonitoringRuleTypeCreate `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Cases == nil { + return fmt.Errorf("Required field cases missing") + } + if required.IsEnabled == nil { + return fmt.Errorf("Required field isEnabled missing") + } + if required.Message == nil { + return fmt.Errorf("Required field message missing") + } + if required.Name == nil { + return fmt.Errorf("Required field name missing") + } + if required.Options == nil { + return fmt.Errorf("Required field options missing") + } + if required.Queries == nil { + return fmt.Errorf("Required field queries missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cases = all.Cases + o.Filters = all.Filters + o.HasExtendedTitle = all.HasExtendedTitle + o.IsEnabled = all.IsEnabled + o.Message = all.Message + o.Name = all.Name + if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.Queries = all.Queries + o.Tags = all.Tags + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_detection_method.go b/api/v2/datadog/model_security_monitoring_rule_detection_method.go new file mode 100644 index 00000000000..e9a6727647d --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_detection_method.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleDetectionMethod The detection method. +type SecurityMonitoringRuleDetectionMethod string + +// List of SecurityMonitoringRuleDetectionMethod. +const ( + SECURITYMONITORINGRULEDETECTIONMETHOD_THRESHOLD SecurityMonitoringRuleDetectionMethod = "threshold" + SECURITYMONITORINGRULEDETECTIONMETHOD_NEW_VALUE SecurityMonitoringRuleDetectionMethod = "new_value" + SECURITYMONITORINGRULEDETECTIONMETHOD_ANOMALY_DETECTION SecurityMonitoringRuleDetectionMethod = "anomaly_detection" + SECURITYMONITORINGRULEDETECTIONMETHOD_IMPOSSIBLE_TRAVEL SecurityMonitoringRuleDetectionMethod = "impossible_travel" + SECURITYMONITORINGRULEDETECTIONMETHOD_HARDCODED SecurityMonitoringRuleDetectionMethod = "hardcoded" +) + +var allowedSecurityMonitoringRuleDetectionMethodEnumValues = []SecurityMonitoringRuleDetectionMethod{ + SECURITYMONITORINGRULEDETECTIONMETHOD_THRESHOLD, + SECURITYMONITORINGRULEDETECTIONMETHOD_NEW_VALUE, + SECURITYMONITORINGRULEDETECTIONMETHOD_ANOMALY_DETECTION, + SECURITYMONITORINGRULEDETECTIONMETHOD_IMPOSSIBLE_TRAVEL, + SECURITYMONITORINGRULEDETECTIONMETHOD_HARDCODED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleDetectionMethod) GetAllowedValues() []SecurityMonitoringRuleDetectionMethod { + return allowedSecurityMonitoringRuleDetectionMethodEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleDetectionMethod) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleDetectionMethod(value) + return nil +} + +// NewSecurityMonitoringRuleDetectionMethodFromValue returns a pointer to a valid SecurityMonitoringRuleDetectionMethod +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleDetectionMethodFromValue(v string) (*SecurityMonitoringRuleDetectionMethod, error) { + ev := SecurityMonitoringRuleDetectionMethod(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleDetectionMethod: valid values are %v", v, allowedSecurityMonitoringRuleDetectionMethodEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleDetectionMethod) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleDetectionMethodEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleDetectionMethod value. +func (v SecurityMonitoringRuleDetectionMethod) Ptr() *SecurityMonitoringRuleDetectionMethod { + return &v +} + +// NullableSecurityMonitoringRuleDetectionMethod handles when a null is used for SecurityMonitoringRuleDetectionMethod. +type NullableSecurityMonitoringRuleDetectionMethod struct { + value *SecurityMonitoringRuleDetectionMethod + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleDetectionMethod) Get() *SecurityMonitoringRuleDetectionMethod { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleDetectionMethod) Set(val *SecurityMonitoringRuleDetectionMethod) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleDetectionMethod) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleDetectionMethod) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleDetectionMethod initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleDetectionMethod(val *SecurityMonitoringRuleDetectionMethod) *NullableSecurityMonitoringRuleDetectionMethod { + return &NullableSecurityMonitoringRuleDetectionMethod{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleDetectionMethod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleDetectionMethod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_evaluation_window.go b/api/v2/datadog/model_security_monitoring_rule_evaluation_window.go new file mode 100644 index 00000000000..39bd6c70fe6 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_evaluation_window.go @@ -0,0 +1,122 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleEvaluationWindow A time window is specified to match when at least one of the cases matches true. This is a sliding window +// and evaluates in real time. +type SecurityMonitoringRuleEvaluationWindow int32 + +// List of SecurityMonitoringRuleEvaluationWindow. +const ( + SECURITYMONITORINGRULEEVALUATIONWINDOW_ZERO_MINUTES SecurityMonitoringRuleEvaluationWindow = 0 + SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_MINUTE SecurityMonitoringRuleEvaluationWindow = 60 + SECURITYMONITORINGRULEEVALUATIONWINDOW_FIVE_MINUTES SecurityMonitoringRuleEvaluationWindow = 300 + SECURITYMONITORINGRULEEVALUATIONWINDOW_TEN_MINUTES SecurityMonitoringRuleEvaluationWindow = 600 + SECURITYMONITORINGRULEEVALUATIONWINDOW_FIFTEEN_MINUTES SecurityMonitoringRuleEvaluationWindow = 900 + SECURITYMONITORINGRULEEVALUATIONWINDOW_THIRTY_MINUTES SecurityMonitoringRuleEvaluationWindow = 1800 + SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_HOUR SecurityMonitoringRuleEvaluationWindow = 3600 + SECURITYMONITORINGRULEEVALUATIONWINDOW_TWO_HOURS SecurityMonitoringRuleEvaluationWindow = 7200 +) + +var allowedSecurityMonitoringRuleEvaluationWindowEnumValues = []SecurityMonitoringRuleEvaluationWindow{ + SECURITYMONITORINGRULEEVALUATIONWINDOW_ZERO_MINUTES, + SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_MINUTE, + SECURITYMONITORINGRULEEVALUATIONWINDOW_FIVE_MINUTES, + SECURITYMONITORINGRULEEVALUATIONWINDOW_TEN_MINUTES, + SECURITYMONITORINGRULEEVALUATIONWINDOW_FIFTEEN_MINUTES, + SECURITYMONITORINGRULEEVALUATIONWINDOW_THIRTY_MINUTES, + SECURITYMONITORINGRULEEVALUATIONWINDOW_ONE_HOUR, + SECURITYMONITORINGRULEEVALUATIONWINDOW_TWO_HOURS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleEvaluationWindow) GetAllowedValues() []SecurityMonitoringRuleEvaluationWindow { + return allowedSecurityMonitoringRuleEvaluationWindowEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleEvaluationWindow) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleEvaluationWindow(value) + return nil +} + +// NewSecurityMonitoringRuleEvaluationWindowFromValue returns a pointer to a valid SecurityMonitoringRuleEvaluationWindow +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleEvaluationWindowFromValue(v int32) (*SecurityMonitoringRuleEvaluationWindow, error) { + ev := SecurityMonitoringRuleEvaluationWindow(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleEvaluationWindow: valid values are %v", v, allowedSecurityMonitoringRuleEvaluationWindowEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleEvaluationWindow) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleEvaluationWindowEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleEvaluationWindow value. +func (v SecurityMonitoringRuleEvaluationWindow) Ptr() *SecurityMonitoringRuleEvaluationWindow { + return &v +} + +// NullableSecurityMonitoringRuleEvaluationWindow handles when a null is used for SecurityMonitoringRuleEvaluationWindow. +type NullableSecurityMonitoringRuleEvaluationWindow struct { + value *SecurityMonitoringRuleEvaluationWindow + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleEvaluationWindow) Get() *SecurityMonitoringRuleEvaluationWindow { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleEvaluationWindow) Set(val *SecurityMonitoringRuleEvaluationWindow) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleEvaluationWindow) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleEvaluationWindow) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleEvaluationWindow initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleEvaluationWindow(val *SecurityMonitoringRuleEvaluationWindow) *NullableSecurityMonitoringRuleEvaluationWindow { + return &NullableSecurityMonitoringRuleEvaluationWindow{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleEvaluationWindow) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleEvaluationWindow) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go b/api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go new file mode 100644 index 00000000000..8d85c415cb5 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_hardcoded_evaluator_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleHardcodedEvaluatorType Hardcoded evaluator type. +type SecurityMonitoringRuleHardcodedEvaluatorType string + +// List of SecurityMonitoringRuleHardcodedEvaluatorType. +const ( + SECURITYMONITORINGRULEHARDCODEDEVALUATORTYPE_LOG4SHELL SecurityMonitoringRuleHardcodedEvaluatorType = "log4shell" +) + +var allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues = []SecurityMonitoringRuleHardcodedEvaluatorType{ + SECURITYMONITORINGRULEHARDCODEDEVALUATORTYPE_LOG4SHELL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleHardcodedEvaluatorType) GetAllowedValues() []SecurityMonitoringRuleHardcodedEvaluatorType { + return allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleHardcodedEvaluatorType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleHardcodedEvaluatorType(value) + return nil +} + +// NewSecurityMonitoringRuleHardcodedEvaluatorTypeFromValue returns a pointer to a valid SecurityMonitoringRuleHardcodedEvaluatorType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleHardcodedEvaluatorTypeFromValue(v string) (*SecurityMonitoringRuleHardcodedEvaluatorType, error) { + ev := SecurityMonitoringRuleHardcodedEvaluatorType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleHardcodedEvaluatorType: valid values are %v", v, allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleHardcodedEvaluatorType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleHardcodedEvaluatorTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleHardcodedEvaluatorType value. +func (v SecurityMonitoringRuleHardcodedEvaluatorType) Ptr() *SecurityMonitoringRuleHardcodedEvaluatorType { + return &v +} + +// NullableSecurityMonitoringRuleHardcodedEvaluatorType handles when a null is used for SecurityMonitoringRuleHardcodedEvaluatorType. +type NullableSecurityMonitoringRuleHardcodedEvaluatorType struct { + value *SecurityMonitoringRuleHardcodedEvaluatorType + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) Get() *SecurityMonitoringRuleHardcodedEvaluatorType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) Set(val *SecurityMonitoringRuleHardcodedEvaluatorType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleHardcodedEvaluatorType initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleHardcodedEvaluatorType(val *SecurityMonitoringRuleHardcodedEvaluatorType) *NullableSecurityMonitoringRuleHardcodedEvaluatorType { + return &NullableSecurityMonitoringRuleHardcodedEvaluatorType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleHardcodedEvaluatorType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleHardcodedEvaluatorType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go b/api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go new file mode 100644 index 00000000000..bff4987bf79 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_impossible_travel_options.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringRuleImpossibleTravelOptions Options on impossible travel rules. +type SecurityMonitoringRuleImpossibleTravelOptions struct { + // If true, signals are suppressed for the first 24 hours. In that time, Datadog learns the user's regular + // access locations. This can be helpful to reduce noise and infer VPN usage or credentialed API access. + BaselineUserLocations *bool `json:"baselineUserLocations,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{} +} + +// NewSecurityMonitoringRuleImpossibleTravelOptions instantiates a new SecurityMonitoringRuleImpossibleTravelOptions 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 NewSecurityMonitoringRuleImpossibleTravelOptions() *SecurityMonitoringRuleImpossibleTravelOptions { + this := SecurityMonitoringRuleImpossibleTravelOptions{} + return &this +} + +// NewSecurityMonitoringRuleImpossibleTravelOptionsWithDefaults instantiates a new SecurityMonitoringRuleImpossibleTravelOptions 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 NewSecurityMonitoringRuleImpossibleTravelOptionsWithDefaults() *SecurityMonitoringRuleImpossibleTravelOptions { + this := SecurityMonitoringRuleImpossibleTravelOptions{} + return &this +} + +// GetBaselineUserLocations returns the BaselineUserLocations field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleImpossibleTravelOptions) GetBaselineUserLocations() bool { + if o == nil || o.BaselineUserLocations == nil { + var ret bool + return ret + } + return *o.BaselineUserLocations +} + +// GetBaselineUserLocationsOk returns a tuple with the BaselineUserLocations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleImpossibleTravelOptions) GetBaselineUserLocationsOk() (*bool, bool) { + if o == nil || o.BaselineUserLocations == nil { + return nil, false + } + return o.BaselineUserLocations, true +} + +// HasBaselineUserLocations returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleImpossibleTravelOptions) HasBaselineUserLocations() bool { + if o != nil && o.BaselineUserLocations != nil { + return true + } + + return false +} + +// SetBaselineUserLocations gets a reference to the given bool and assigns it to the BaselineUserLocations field. +func (o *SecurityMonitoringRuleImpossibleTravelOptions) SetBaselineUserLocations(v bool) { + o.BaselineUserLocations = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleImpossibleTravelOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.BaselineUserLocations != nil { + toSerialize["baselineUserLocations"] = o.BaselineUserLocations + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleImpossibleTravelOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + BaselineUserLocations *bool `json:"baselineUserLocations,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.BaselineUserLocations = all.BaselineUserLocations + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_keep_alive.go b/api/v2/datadog/model_security_monitoring_rule_keep_alive.go new file mode 100644 index 00000000000..1d5425ca631 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_keep_alive.go @@ -0,0 +1,126 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleKeepAlive Once a signal is generated, the signal will remain “open” if a case is matched at least once within +// this keep alive window. +type SecurityMonitoringRuleKeepAlive int32 + +// List of SecurityMonitoringRuleKeepAlive. +const ( + SECURITYMONITORINGRULEKEEPALIVE_ZERO_MINUTES SecurityMonitoringRuleKeepAlive = 0 + SECURITYMONITORINGRULEKEEPALIVE_ONE_MINUTE SecurityMonitoringRuleKeepAlive = 60 + SECURITYMONITORINGRULEKEEPALIVE_FIVE_MINUTES SecurityMonitoringRuleKeepAlive = 300 + SECURITYMONITORINGRULEKEEPALIVE_TEN_MINUTES SecurityMonitoringRuleKeepAlive = 600 + SECURITYMONITORINGRULEKEEPALIVE_FIFTEEN_MINUTES SecurityMonitoringRuleKeepAlive = 900 + SECURITYMONITORINGRULEKEEPALIVE_THIRTY_MINUTES SecurityMonitoringRuleKeepAlive = 1800 + SECURITYMONITORINGRULEKEEPALIVE_ONE_HOUR SecurityMonitoringRuleKeepAlive = 3600 + SECURITYMONITORINGRULEKEEPALIVE_TWO_HOURS SecurityMonitoringRuleKeepAlive = 7200 + SECURITYMONITORINGRULEKEEPALIVE_THREE_HOURS SecurityMonitoringRuleKeepAlive = 10800 + SECURITYMONITORINGRULEKEEPALIVE_SIX_HOURS SecurityMonitoringRuleKeepAlive = 21600 +) + +var allowedSecurityMonitoringRuleKeepAliveEnumValues = []SecurityMonitoringRuleKeepAlive{ + SECURITYMONITORINGRULEKEEPALIVE_ZERO_MINUTES, + SECURITYMONITORINGRULEKEEPALIVE_ONE_MINUTE, + SECURITYMONITORINGRULEKEEPALIVE_FIVE_MINUTES, + SECURITYMONITORINGRULEKEEPALIVE_TEN_MINUTES, + SECURITYMONITORINGRULEKEEPALIVE_FIFTEEN_MINUTES, + SECURITYMONITORINGRULEKEEPALIVE_THIRTY_MINUTES, + SECURITYMONITORINGRULEKEEPALIVE_ONE_HOUR, + SECURITYMONITORINGRULEKEEPALIVE_TWO_HOURS, + SECURITYMONITORINGRULEKEEPALIVE_THREE_HOURS, + SECURITYMONITORINGRULEKEEPALIVE_SIX_HOURS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleKeepAlive) GetAllowedValues() []SecurityMonitoringRuleKeepAlive { + return allowedSecurityMonitoringRuleKeepAliveEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleKeepAlive) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleKeepAlive(value) + return nil +} + +// NewSecurityMonitoringRuleKeepAliveFromValue returns a pointer to a valid SecurityMonitoringRuleKeepAlive +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleKeepAliveFromValue(v int32) (*SecurityMonitoringRuleKeepAlive, error) { + ev := SecurityMonitoringRuleKeepAlive(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleKeepAlive: valid values are %v", v, allowedSecurityMonitoringRuleKeepAliveEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleKeepAlive) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleKeepAliveEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleKeepAlive value. +func (v SecurityMonitoringRuleKeepAlive) Ptr() *SecurityMonitoringRuleKeepAlive { + return &v +} + +// NullableSecurityMonitoringRuleKeepAlive handles when a null is used for SecurityMonitoringRuleKeepAlive. +type NullableSecurityMonitoringRuleKeepAlive struct { + value *SecurityMonitoringRuleKeepAlive + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleKeepAlive) Get() *SecurityMonitoringRuleKeepAlive { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleKeepAlive) Set(val *SecurityMonitoringRuleKeepAlive) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleKeepAlive) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleKeepAlive) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleKeepAlive initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleKeepAlive(val *SecurityMonitoringRuleKeepAlive) *NullableSecurityMonitoringRuleKeepAlive { + return &NullableSecurityMonitoringRuleKeepAlive{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleKeepAlive) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleKeepAlive) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go b/api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go new file mode 100644 index 00000000000..a4a0869f7e8 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_max_signal_duration.go @@ -0,0 +1,130 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleMaxSignalDuration A signal will “close” regardless of the query being matched once the time exceeds the maximum duration. +// This time is calculated from the first seen timestamp. +type SecurityMonitoringRuleMaxSignalDuration int32 + +// List of SecurityMonitoringRuleMaxSignalDuration. +const ( + SECURITYMONITORINGRULEMAXSIGNALDURATION_ZERO_MINUTES SecurityMonitoringRuleMaxSignalDuration = 0 + SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_MINUTE SecurityMonitoringRuleMaxSignalDuration = 60 + SECURITYMONITORINGRULEMAXSIGNALDURATION_FIVE_MINUTES SecurityMonitoringRuleMaxSignalDuration = 300 + SECURITYMONITORINGRULEMAXSIGNALDURATION_TEN_MINUTES SecurityMonitoringRuleMaxSignalDuration = 600 + SECURITYMONITORINGRULEMAXSIGNALDURATION_FIFTEEN_MINUTES SecurityMonitoringRuleMaxSignalDuration = 900 + SECURITYMONITORINGRULEMAXSIGNALDURATION_THIRTY_MINUTES SecurityMonitoringRuleMaxSignalDuration = 1800 + SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_HOUR SecurityMonitoringRuleMaxSignalDuration = 3600 + SECURITYMONITORINGRULEMAXSIGNALDURATION_TWO_HOURS SecurityMonitoringRuleMaxSignalDuration = 7200 + SECURITYMONITORINGRULEMAXSIGNALDURATION_THREE_HOURS SecurityMonitoringRuleMaxSignalDuration = 10800 + SECURITYMONITORINGRULEMAXSIGNALDURATION_SIX_HOURS SecurityMonitoringRuleMaxSignalDuration = 21600 + SECURITYMONITORINGRULEMAXSIGNALDURATION_TWELVE_HOURS SecurityMonitoringRuleMaxSignalDuration = 43200 + SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_DAY SecurityMonitoringRuleMaxSignalDuration = 86400 +) + +var allowedSecurityMonitoringRuleMaxSignalDurationEnumValues = []SecurityMonitoringRuleMaxSignalDuration{ + SECURITYMONITORINGRULEMAXSIGNALDURATION_ZERO_MINUTES, + SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_MINUTE, + SECURITYMONITORINGRULEMAXSIGNALDURATION_FIVE_MINUTES, + SECURITYMONITORINGRULEMAXSIGNALDURATION_TEN_MINUTES, + SECURITYMONITORINGRULEMAXSIGNALDURATION_FIFTEEN_MINUTES, + SECURITYMONITORINGRULEMAXSIGNALDURATION_THIRTY_MINUTES, + SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_HOUR, + SECURITYMONITORINGRULEMAXSIGNALDURATION_TWO_HOURS, + SECURITYMONITORINGRULEMAXSIGNALDURATION_THREE_HOURS, + SECURITYMONITORINGRULEMAXSIGNALDURATION_SIX_HOURS, + SECURITYMONITORINGRULEMAXSIGNALDURATION_TWELVE_HOURS, + SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_DAY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleMaxSignalDuration) GetAllowedValues() []SecurityMonitoringRuleMaxSignalDuration { + return allowedSecurityMonitoringRuleMaxSignalDurationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleMaxSignalDuration) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleMaxSignalDuration(value) + return nil +} + +// NewSecurityMonitoringRuleMaxSignalDurationFromValue returns a pointer to a valid SecurityMonitoringRuleMaxSignalDuration +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleMaxSignalDurationFromValue(v int32) (*SecurityMonitoringRuleMaxSignalDuration, error) { + ev := SecurityMonitoringRuleMaxSignalDuration(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleMaxSignalDuration: valid values are %v", v, allowedSecurityMonitoringRuleMaxSignalDurationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleMaxSignalDuration) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleMaxSignalDurationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleMaxSignalDuration value. +func (v SecurityMonitoringRuleMaxSignalDuration) Ptr() *SecurityMonitoringRuleMaxSignalDuration { + return &v +} + +// NullableSecurityMonitoringRuleMaxSignalDuration handles when a null is used for SecurityMonitoringRuleMaxSignalDuration. +type NullableSecurityMonitoringRuleMaxSignalDuration struct { + value *SecurityMonitoringRuleMaxSignalDuration + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleMaxSignalDuration) Get() *SecurityMonitoringRuleMaxSignalDuration { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleMaxSignalDuration) Set(val *SecurityMonitoringRuleMaxSignalDuration) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleMaxSignalDuration) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleMaxSignalDuration) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleMaxSignalDuration initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleMaxSignalDuration(val *SecurityMonitoringRuleMaxSignalDuration) *NullableSecurityMonitoringRuleMaxSignalDuration { + return &NullableSecurityMonitoringRuleMaxSignalDuration{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleMaxSignalDuration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleMaxSignalDuration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options.go new file mode 100644 index 00000000000..57a0bd55702 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options.go @@ -0,0 +1,264 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringRuleNewValueOptions Options on new value rules. +type SecurityMonitoringRuleNewValueOptions struct { + // The duration in days after which a learned value is forgotten. + ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"` + // The duration in days during which values are learned, and after which signals will be generated for values that + // weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned. + LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` + // The learning method used to determine when signals should be generated for values that weren't learned. + LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"` + // A number of occurrences after which signals will be generated for values that weren't learned. + LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,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{} +} + +// NewSecurityMonitoringRuleNewValueOptions instantiates a new SecurityMonitoringRuleNewValueOptions 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 NewSecurityMonitoringRuleNewValueOptions() *SecurityMonitoringRuleNewValueOptions { + this := SecurityMonitoringRuleNewValueOptions{} + var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS + this.LearningDuration = &learningDuration + var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION + this.LearningMethod = &learningMethod + var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES + this.LearningThreshold = &learningThreshold + return &this +} + +// NewSecurityMonitoringRuleNewValueOptionsWithDefaults instantiates a new SecurityMonitoringRuleNewValueOptions 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 NewSecurityMonitoringRuleNewValueOptionsWithDefaults() *SecurityMonitoringRuleNewValueOptions { + this := SecurityMonitoringRuleNewValueOptions{} + var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS + this.LearningDuration = &learningDuration + var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION + this.LearningMethod = &learningMethod + var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES + this.LearningThreshold = &learningThreshold + return &this +} + +// GetForgetAfter returns the ForgetAfter field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleNewValueOptions) GetForgetAfter() SecurityMonitoringRuleNewValueOptionsForgetAfter { + if o == nil || o.ForgetAfter == nil { + var ret SecurityMonitoringRuleNewValueOptionsForgetAfter + return ret + } + return *o.ForgetAfter +} + +// GetForgetAfterOk returns a tuple with the ForgetAfter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleNewValueOptions) GetForgetAfterOk() (*SecurityMonitoringRuleNewValueOptionsForgetAfter, bool) { + if o == nil || o.ForgetAfter == nil { + return nil, false + } + return o.ForgetAfter, true +} + +// HasForgetAfter returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleNewValueOptions) HasForgetAfter() bool { + if o != nil && o.ForgetAfter != nil { + return true + } + + return false +} + +// SetForgetAfter gets a reference to the given SecurityMonitoringRuleNewValueOptionsForgetAfter and assigns it to the ForgetAfter field. +func (o *SecurityMonitoringRuleNewValueOptions) SetForgetAfter(v SecurityMonitoringRuleNewValueOptionsForgetAfter) { + o.ForgetAfter = &v +} + +// GetLearningDuration returns the LearningDuration field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningDuration() SecurityMonitoringRuleNewValueOptionsLearningDuration { + if o == nil || o.LearningDuration == nil { + var ret SecurityMonitoringRuleNewValueOptionsLearningDuration + return ret + } + return *o.LearningDuration +} + +// GetLearningDurationOk returns a tuple with the LearningDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningDurationOk() (*SecurityMonitoringRuleNewValueOptionsLearningDuration, bool) { + if o == nil || o.LearningDuration == nil { + return nil, false + } + return o.LearningDuration, true +} + +// HasLearningDuration returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleNewValueOptions) HasLearningDuration() bool { + if o != nil && o.LearningDuration != nil { + return true + } + + return false +} + +// SetLearningDuration gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningDuration and assigns it to the LearningDuration field. +func (o *SecurityMonitoringRuleNewValueOptions) SetLearningDuration(v SecurityMonitoringRuleNewValueOptionsLearningDuration) { + o.LearningDuration = &v +} + +// GetLearningMethod returns the LearningMethod field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethod() SecurityMonitoringRuleNewValueOptionsLearningMethod { + if o == nil || o.LearningMethod == nil { + var ret SecurityMonitoringRuleNewValueOptionsLearningMethod + return ret + } + return *o.LearningMethod +} + +// GetLearningMethodOk returns a tuple with the LearningMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethodOk() (*SecurityMonitoringRuleNewValueOptionsLearningMethod, bool) { + if o == nil || o.LearningMethod == nil { + return nil, false + } + return o.LearningMethod, true +} + +// HasLearningMethod returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleNewValueOptions) HasLearningMethod() bool { + if o != nil && o.LearningMethod != nil { + return true + } + + return false +} + +// SetLearningMethod gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningMethod and assigns it to the LearningMethod field. +func (o *SecurityMonitoringRuleNewValueOptions) SetLearningMethod(v SecurityMonitoringRuleNewValueOptionsLearningMethod) { + o.LearningMethod = &v +} + +// GetLearningThreshold returns the LearningThreshold field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThreshold() SecurityMonitoringRuleNewValueOptionsLearningThreshold { + if o == nil || o.LearningThreshold == nil { + var ret SecurityMonitoringRuleNewValueOptionsLearningThreshold + return ret + } + return *o.LearningThreshold +} + +// GetLearningThresholdOk returns a tuple with the LearningThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThresholdOk() (*SecurityMonitoringRuleNewValueOptionsLearningThreshold, bool) { + if o == nil || o.LearningThreshold == nil { + return nil, false + } + return o.LearningThreshold, true +} + +// HasLearningThreshold returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleNewValueOptions) HasLearningThreshold() bool { + if o != nil && o.LearningThreshold != nil { + return true + } + + return false +} + +// SetLearningThreshold gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningThreshold and assigns it to the LearningThreshold field. +func (o *SecurityMonitoringRuleNewValueOptions) SetLearningThreshold(v SecurityMonitoringRuleNewValueOptionsLearningThreshold) { + o.LearningThreshold = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ForgetAfter != nil { + toSerialize["forgetAfter"] = o.ForgetAfter + } + if o.LearningDuration != nil { + toSerialize["learningDuration"] = o.LearningDuration + } + if o.LearningMethod != nil { + toSerialize["learningMethod"] = o.LearningMethod + } + if o.LearningThreshold != nil { + toSerialize["learningThreshold"] = o.LearningThreshold + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"` + LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` + LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"` + LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ForgetAfter; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LearningDuration; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LearningMethod; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LearningThreshold; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ForgetAfter = all.ForgetAfter + o.LearningDuration = all.LearningDuration + o.LearningMethod = all.LearningMethod + o.LearningThreshold = all.LearningThreshold + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go new file mode 100644 index 00000000000..71c2e84585b --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options_forget_after.go @@ -0,0 +1,117 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleNewValueOptionsForgetAfter The duration in days after which a learned value is forgotten. +type SecurityMonitoringRuleNewValueOptionsForgetAfter int32 + +// List of SecurityMonitoringRuleNewValueOptionsForgetAfter. +const ( + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_DAY SecurityMonitoringRuleNewValueOptionsForgetAfter = 1 + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_DAYS SecurityMonitoringRuleNewValueOptionsForgetAfter = 2 + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_WEEK SecurityMonitoringRuleNewValueOptionsForgetAfter = 7 + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_WEEKS SecurityMonitoringRuleNewValueOptionsForgetAfter = 14 + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_THREE_WEEKS SecurityMonitoringRuleNewValueOptionsForgetAfter = 21 + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_FOUR_WEEKS SecurityMonitoringRuleNewValueOptionsForgetAfter = 28 +) + +var allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues = []SecurityMonitoringRuleNewValueOptionsForgetAfter{ + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_DAY, + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_DAYS, + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_WEEK, + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_TWO_WEEKS, + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_THREE_WEEKS, + SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_FOUR_WEEKS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleNewValueOptionsForgetAfter) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsForgetAfter { + return allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleNewValueOptionsForgetAfter) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleNewValueOptionsForgetAfter(value) + return nil +} + +// NewSecurityMonitoringRuleNewValueOptionsForgetAfterFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsForgetAfter +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleNewValueOptionsForgetAfterFromValue(v int32) (*SecurityMonitoringRuleNewValueOptionsForgetAfter, error) { + ev := SecurityMonitoringRuleNewValueOptionsForgetAfter(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsForgetAfter: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleNewValueOptionsForgetAfter) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsForgetAfterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsForgetAfter value. +func (v SecurityMonitoringRuleNewValueOptionsForgetAfter) Ptr() *SecurityMonitoringRuleNewValueOptionsForgetAfter { + return &v +} + +// NullableSecurityMonitoringRuleNewValueOptionsForgetAfter handles when a null is used for SecurityMonitoringRuleNewValueOptionsForgetAfter. +type NullableSecurityMonitoringRuleNewValueOptionsForgetAfter struct { + value *SecurityMonitoringRuleNewValueOptionsForgetAfter + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Get() *SecurityMonitoringRuleNewValueOptionsForgetAfter { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Set(val *SecurityMonitoringRuleNewValueOptionsForgetAfter) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleNewValueOptionsForgetAfter initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleNewValueOptionsForgetAfter(val *SecurityMonitoringRuleNewValueOptionsForgetAfter) *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter { + return &NullableSecurityMonitoringRuleNewValueOptionsForgetAfter{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsForgetAfter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go new file mode 100644 index 00000000000..a58876ad4e6 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_duration.go @@ -0,0 +1,112 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleNewValueOptionsLearningDuration The duration in days during which values are learned, and after which signals will be generated for values that +// weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned. +type SecurityMonitoringRuleNewValueOptionsLearningDuration int32 + +// List of SecurityMonitoringRuleNewValueOptionsLearningDuration. +const ( + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS SecurityMonitoringRuleNewValueOptionsLearningDuration = 0 + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ONE_DAY SecurityMonitoringRuleNewValueOptionsLearningDuration = 1 + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_SEVEN_DAYS SecurityMonitoringRuleNewValueOptionsLearningDuration = 7 +) + +var allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningDuration{ + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS, + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ONE_DAY, + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_SEVEN_DAYS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleNewValueOptionsLearningDuration) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningDuration { + return allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleNewValueOptionsLearningDuration) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleNewValueOptionsLearningDuration(value) + return nil +} + +// NewSecurityMonitoringRuleNewValueOptionsLearningDurationFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningDuration +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleNewValueOptionsLearningDurationFromValue(v int32) (*SecurityMonitoringRuleNewValueOptionsLearningDuration, error) { + ev := SecurityMonitoringRuleNewValueOptionsLearningDuration(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningDuration: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleNewValueOptionsLearningDuration) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningDurationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningDuration value. +func (v SecurityMonitoringRuleNewValueOptionsLearningDuration) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningDuration { + return &v +} + +// NullableSecurityMonitoringRuleNewValueOptionsLearningDuration handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningDuration. +type NullableSecurityMonitoringRuleNewValueOptionsLearningDuration struct { + value *SecurityMonitoringRuleNewValueOptionsLearningDuration + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Get() *SecurityMonitoringRuleNewValueOptionsLearningDuration { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Set(val *SecurityMonitoringRuleNewValueOptionsLearningDuration) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleNewValueOptionsLearningDuration initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleNewValueOptionsLearningDuration(val *SecurityMonitoringRuleNewValueOptionsLearningDuration) *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration { + return &NullableSecurityMonitoringRuleNewValueOptionsLearningDuration{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningDuration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go new file mode 100644 index 00000000000..74a73006307 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleNewValueOptionsLearningMethod The learning method used to determine when signals should be generated for values that weren't learned. +type SecurityMonitoringRuleNewValueOptionsLearningMethod string + +// List of SecurityMonitoringRuleNewValueOptionsLearningMethod. +const ( + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION SecurityMonitoringRuleNewValueOptionsLearningMethod = "duration" + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD SecurityMonitoringRuleNewValueOptionsLearningMethod = "threshold" +) + +var allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningMethod{ + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION, + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningMethod { + return allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleNewValueOptionsLearningMethod(value) + return nil +} + +// NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningMethod +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue(v string) (*SecurityMonitoringRuleNewValueOptionsLearningMethod, error) { + ev := SecurityMonitoringRuleNewValueOptionsLearningMethod(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningMethod: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningMethod value. +func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningMethod { + return &v +} + +// NullableSecurityMonitoringRuleNewValueOptionsLearningMethod handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningMethod. +type NullableSecurityMonitoringRuleNewValueOptionsLearningMethod struct { + value *SecurityMonitoringRuleNewValueOptionsLearningMethod + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Get() *SecurityMonitoringRuleNewValueOptionsLearningMethod { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Set(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod { + return &NullableSecurityMonitoringRuleNewValueOptionsLearningMethod{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go new file mode 100644 index 00000000000..9eac735356d --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleNewValueOptionsLearningThreshold A number of occurrences after which signals will be generated for values that weren't learned. +type SecurityMonitoringRuleNewValueOptionsLearningThreshold int32 + +// List of SecurityMonitoringRuleNewValueOptionsLearningThreshold. +const ( + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES SecurityMonitoringRuleNewValueOptionsLearningThreshold = 0 + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ONE_OCCURRENCE SecurityMonitoringRuleNewValueOptionsLearningThreshold = 1 +) + +var allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningThreshold{ + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES, + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ONE_OCCURRENCE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleNewValueOptionsLearningThreshold) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningThreshold { + return allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleNewValueOptionsLearningThreshold) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleNewValueOptionsLearningThreshold(value) + return nil +} + +// NewSecurityMonitoringRuleNewValueOptionsLearningThresholdFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningThreshold +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleNewValueOptionsLearningThresholdFromValue(v int32) (*SecurityMonitoringRuleNewValueOptionsLearningThreshold, error) { + ev := SecurityMonitoringRuleNewValueOptionsLearningThreshold(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningThreshold: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningThreshold value. +func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { + return &v +} + +// NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningThreshold. +type NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold struct { + value *SecurityMonitoringRuleNewValueOptionsLearningThreshold + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Get() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Set(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold { + return &NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_options.go b/api/v2/datadog/model_security_monitoring_rule_options.go new file mode 100644 index 00000000000..28a0f0a5514 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_options.go @@ -0,0 +1,434 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringRuleOptions Options on rules. +type SecurityMonitoringRuleOptions struct { + // If true, signals in non-production environments have a lower severity than what is defined by the rule case, which can reduce signal noise. + // The severity is decreased by one level: `CRITICAL` in production becomes `HIGH` in non-production, `HIGH` becomes `MEDIUM` and so on. `INFO` remains `INFO`. + // The decrement is applied when the environment tag of the signal starts with `staging`, `test` or `dev`. + DecreaseCriticalityBasedOnEnv *bool `json:"decreaseCriticalityBasedOnEnv,omitempty"` + // The detection method. + DetectionMethod *SecurityMonitoringRuleDetectionMethod `json:"detectionMethod,omitempty"` + // A time window is specified to match when at least one of the cases matches true. This is a sliding window + // and evaluates in real time. + EvaluationWindow *SecurityMonitoringRuleEvaluationWindow `json:"evaluationWindow,omitempty"` + // Hardcoded evaluator type. + HardcodedEvaluatorType *SecurityMonitoringRuleHardcodedEvaluatorType `json:"hardcodedEvaluatorType,omitempty"` + // Options on impossible travel rules. + ImpossibleTravelOptions *SecurityMonitoringRuleImpossibleTravelOptions `json:"impossibleTravelOptions,omitempty"` + // Once a signal is generated, the signal will remain “open” if a case is matched at least once within + // this keep alive window. + KeepAlive *SecurityMonitoringRuleKeepAlive `json:"keepAlive,omitempty"` + // A signal will “close” regardless of the query being matched once the time exceeds the maximum duration. + // This time is calculated from the first seen timestamp. + MaxSignalDuration *SecurityMonitoringRuleMaxSignalDuration `json:"maxSignalDuration,omitempty"` + // Options on new value rules. + NewValueOptions *SecurityMonitoringRuleNewValueOptions `json:"newValueOptions,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{} +} + +// NewSecurityMonitoringRuleOptions instantiates a new SecurityMonitoringRuleOptions 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 NewSecurityMonitoringRuleOptions() *SecurityMonitoringRuleOptions { + this := SecurityMonitoringRuleOptions{} + return &this +} + +// NewSecurityMonitoringRuleOptionsWithDefaults instantiates a new SecurityMonitoringRuleOptions 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 NewSecurityMonitoringRuleOptionsWithDefaults() *SecurityMonitoringRuleOptions { + this := SecurityMonitoringRuleOptions{} + return &this +} + +// GetDecreaseCriticalityBasedOnEnv returns the DecreaseCriticalityBasedOnEnv field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetDecreaseCriticalityBasedOnEnv() bool { + if o == nil || o.DecreaseCriticalityBasedOnEnv == nil { + var ret bool + return ret + } + return *o.DecreaseCriticalityBasedOnEnv +} + +// GetDecreaseCriticalityBasedOnEnvOk returns a tuple with the DecreaseCriticalityBasedOnEnv field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetDecreaseCriticalityBasedOnEnvOk() (*bool, bool) { + if o == nil || o.DecreaseCriticalityBasedOnEnv == nil { + return nil, false + } + return o.DecreaseCriticalityBasedOnEnv, true +} + +// HasDecreaseCriticalityBasedOnEnv returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasDecreaseCriticalityBasedOnEnv() bool { + if o != nil && o.DecreaseCriticalityBasedOnEnv != nil { + return true + } + + return false +} + +// SetDecreaseCriticalityBasedOnEnv gets a reference to the given bool and assigns it to the DecreaseCriticalityBasedOnEnv field. +func (o *SecurityMonitoringRuleOptions) SetDecreaseCriticalityBasedOnEnv(v bool) { + o.DecreaseCriticalityBasedOnEnv = &v +} + +// GetDetectionMethod returns the DetectionMethod field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetDetectionMethod() SecurityMonitoringRuleDetectionMethod { + if o == nil || o.DetectionMethod == nil { + var ret SecurityMonitoringRuleDetectionMethod + return ret + } + return *o.DetectionMethod +} + +// GetDetectionMethodOk returns a tuple with the DetectionMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetDetectionMethodOk() (*SecurityMonitoringRuleDetectionMethod, bool) { + if o == nil || o.DetectionMethod == nil { + return nil, false + } + return o.DetectionMethod, true +} + +// HasDetectionMethod returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasDetectionMethod() bool { + if o != nil && o.DetectionMethod != nil { + return true + } + + return false +} + +// SetDetectionMethod gets a reference to the given SecurityMonitoringRuleDetectionMethod and assigns it to the DetectionMethod field. +func (o *SecurityMonitoringRuleOptions) SetDetectionMethod(v SecurityMonitoringRuleDetectionMethod) { + o.DetectionMethod = &v +} + +// GetEvaluationWindow returns the EvaluationWindow field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetEvaluationWindow() SecurityMonitoringRuleEvaluationWindow { + if o == nil || o.EvaluationWindow == nil { + var ret SecurityMonitoringRuleEvaluationWindow + return ret + } + return *o.EvaluationWindow +} + +// GetEvaluationWindowOk returns a tuple with the EvaluationWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetEvaluationWindowOk() (*SecurityMonitoringRuleEvaluationWindow, bool) { + if o == nil || o.EvaluationWindow == nil { + return nil, false + } + return o.EvaluationWindow, true +} + +// HasEvaluationWindow returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasEvaluationWindow() bool { + if o != nil && o.EvaluationWindow != nil { + return true + } + + return false +} + +// SetEvaluationWindow gets a reference to the given SecurityMonitoringRuleEvaluationWindow and assigns it to the EvaluationWindow field. +func (o *SecurityMonitoringRuleOptions) SetEvaluationWindow(v SecurityMonitoringRuleEvaluationWindow) { + o.EvaluationWindow = &v +} + +// GetHardcodedEvaluatorType returns the HardcodedEvaluatorType field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetHardcodedEvaluatorType() SecurityMonitoringRuleHardcodedEvaluatorType { + if o == nil || o.HardcodedEvaluatorType == nil { + var ret SecurityMonitoringRuleHardcodedEvaluatorType + return ret + } + return *o.HardcodedEvaluatorType +} + +// GetHardcodedEvaluatorTypeOk returns a tuple with the HardcodedEvaluatorType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetHardcodedEvaluatorTypeOk() (*SecurityMonitoringRuleHardcodedEvaluatorType, bool) { + if o == nil || o.HardcodedEvaluatorType == nil { + return nil, false + } + return o.HardcodedEvaluatorType, true +} + +// HasHardcodedEvaluatorType returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasHardcodedEvaluatorType() bool { + if o != nil && o.HardcodedEvaluatorType != nil { + return true + } + + return false +} + +// SetHardcodedEvaluatorType gets a reference to the given SecurityMonitoringRuleHardcodedEvaluatorType and assigns it to the HardcodedEvaluatorType field. +func (o *SecurityMonitoringRuleOptions) SetHardcodedEvaluatorType(v SecurityMonitoringRuleHardcodedEvaluatorType) { + o.HardcodedEvaluatorType = &v +} + +// GetImpossibleTravelOptions returns the ImpossibleTravelOptions field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetImpossibleTravelOptions() SecurityMonitoringRuleImpossibleTravelOptions { + if o == nil || o.ImpossibleTravelOptions == nil { + var ret SecurityMonitoringRuleImpossibleTravelOptions + return ret + } + return *o.ImpossibleTravelOptions +} + +// GetImpossibleTravelOptionsOk returns a tuple with the ImpossibleTravelOptions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetImpossibleTravelOptionsOk() (*SecurityMonitoringRuleImpossibleTravelOptions, bool) { + if o == nil || o.ImpossibleTravelOptions == nil { + return nil, false + } + return o.ImpossibleTravelOptions, true +} + +// HasImpossibleTravelOptions returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasImpossibleTravelOptions() bool { + if o != nil && o.ImpossibleTravelOptions != nil { + return true + } + + return false +} + +// SetImpossibleTravelOptions gets a reference to the given SecurityMonitoringRuleImpossibleTravelOptions and assigns it to the ImpossibleTravelOptions field. +func (o *SecurityMonitoringRuleOptions) SetImpossibleTravelOptions(v SecurityMonitoringRuleImpossibleTravelOptions) { + o.ImpossibleTravelOptions = &v +} + +// GetKeepAlive returns the KeepAlive field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetKeepAlive() SecurityMonitoringRuleKeepAlive { + if o == nil || o.KeepAlive == nil { + var ret SecurityMonitoringRuleKeepAlive + return ret + } + return *o.KeepAlive +} + +// GetKeepAliveOk returns a tuple with the KeepAlive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetKeepAliveOk() (*SecurityMonitoringRuleKeepAlive, bool) { + if o == nil || o.KeepAlive == nil { + return nil, false + } + return o.KeepAlive, true +} + +// HasKeepAlive returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasKeepAlive() bool { + if o != nil && o.KeepAlive != nil { + return true + } + + return false +} + +// SetKeepAlive gets a reference to the given SecurityMonitoringRuleKeepAlive and assigns it to the KeepAlive field. +func (o *SecurityMonitoringRuleOptions) SetKeepAlive(v SecurityMonitoringRuleKeepAlive) { + o.KeepAlive = &v +} + +// GetMaxSignalDuration returns the MaxSignalDuration field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetMaxSignalDuration() SecurityMonitoringRuleMaxSignalDuration { + if o == nil || o.MaxSignalDuration == nil { + var ret SecurityMonitoringRuleMaxSignalDuration + return ret + } + return *o.MaxSignalDuration +} + +// GetMaxSignalDurationOk returns a tuple with the MaxSignalDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetMaxSignalDurationOk() (*SecurityMonitoringRuleMaxSignalDuration, bool) { + if o == nil || o.MaxSignalDuration == nil { + return nil, false + } + return o.MaxSignalDuration, true +} + +// HasMaxSignalDuration returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasMaxSignalDuration() bool { + if o != nil && o.MaxSignalDuration != nil { + return true + } + + return false +} + +// SetMaxSignalDuration gets a reference to the given SecurityMonitoringRuleMaxSignalDuration and assigns it to the MaxSignalDuration field. +func (o *SecurityMonitoringRuleOptions) SetMaxSignalDuration(v SecurityMonitoringRuleMaxSignalDuration) { + o.MaxSignalDuration = &v +} + +// GetNewValueOptions returns the NewValueOptions field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleOptions) GetNewValueOptions() SecurityMonitoringRuleNewValueOptions { + if o == nil || o.NewValueOptions == nil { + var ret SecurityMonitoringRuleNewValueOptions + return ret + } + return *o.NewValueOptions +} + +// GetNewValueOptionsOk returns a tuple with the NewValueOptions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleOptions) GetNewValueOptionsOk() (*SecurityMonitoringRuleNewValueOptions, bool) { + if o == nil || o.NewValueOptions == nil { + return nil, false + } + return o.NewValueOptions, true +} + +// HasNewValueOptions returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleOptions) HasNewValueOptions() bool { + if o != nil && o.NewValueOptions != nil { + return true + } + + return false +} + +// SetNewValueOptions gets a reference to the given SecurityMonitoringRuleNewValueOptions and assigns it to the NewValueOptions field. +func (o *SecurityMonitoringRuleOptions) SetNewValueOptions(v SecurityMonitoringRuleNewValueOptions) { + o.NewValueOptions = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DecreaseCriticalityBasedOnEnv != nil { + toSerialize["decreaseCriticalityBasedOnEnv"] = o.DecreaseCriticalityBasedOnEnv + } + if o.DetectionMethod != nil { + toSerialize["detectionMethod"] = o.DetectionMethod + } + if o.EvaluationWindow != nil { + toSerialize["evaluationWindow"] = o.EvaluationWindow + } + if o.HardcodedEvaluatorType != nil { + toSerialize["hardcodedEvaluatorType"] = o.HardcodedEvaluatorType + } + if o.ImpossibleTravelOptions != nil { + toSerialize["impossibleTravelOptions"] = o.ImpossibleTravelOptions + } + if o.KeepAlive != nil { + toSerialize["keepAlive"] = o.KeepAlive + } + if o.MaxSignalDuration != nil { + toSerialize["maxSignalDuration"] = o.MaxSignalDuration + } + if o.NewValueOptions != nil { + toSerialize["newValueOptions"] = o.NewValueOptions + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DecreaseCriticalityBasedOnEnv *bool `json:"decreaseCriticalityBasedOnEnv,omitempty"` + DetectionMethod *SecurityMonitoringRuleDetectionMethod `json:"detectionMethod,omitempty"` + EvaluationWindow *SecurityMonitoringRuleEvaluationWindow `json:"evaluationWindow,omitempty"` + HardcodedEvaluatorType *SecurityMonitoringRuleHardcodedEvaluatorType `json:"hardcodedEvaluatorType,omitempty"` + ImpossibleTravelOptions *SecurityMonitoringRuleImpossibleTravelOptions `json:"impossibleTravelOptions,omitempty"` + KeepAlive *SecurityMonitoringRuleKeepAlive `json:"keepAlive,omitempty"` + MaxSignalDuration *SecurityMonitoringRuleMaxSignalDuration `json:"maxSignalDuration,omitempty"` + NewValueOptions *SecurityMonitoringRuleNewValueOptions `json:"newValueOptions,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.DetectionMethod; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.EvaluationWindow; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.HardcodedEvaluatorType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.KeepAlive; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.MaxSignalDuration; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DecreaseCriticalityBasedOnEnv = all.DecreaseCriticalityBasedOnEnv + o.DetectionMethod = all.DetectionMethod + o.EvaluationWindow = all.EvaluationWindow + o.HardcodedEvaluatorType = all.HardcodedEvaluatorType + if all.ImpossibleTravelOptions != nil && all.ImpossibleTravelOptions.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ImpossibleTravelOptions = all.ImpossibleTravelOptions + o.KeepAlive = all.KeepAlive + o.MaxSignalDuration = all.MaxSignalDuration + if all.NewValueOptions != nil && all.NewValueOptions.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.NewValueOptions = all.NewValueOptions + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_query.go b/api/v2/datadog/model_security_monitoring_rule_query.go new file mode 100644 index 00000000000..218d8a28f47 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_query.go @@ -0,0 +1,345 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringRuleQuery Query for matching rule. +type SecurityMonitoringRuleQuery struct { + // The aggregation type. + Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` + // Field for which the cardinality is measured. Sent as an array. + DistinctFields []string `json:"distinctFields,omitempty"` + // Fields to group by. + GroupByFields []string `json:"groupByFields,omitempty"` + // The target field to aggregate over when using the sum or max + // aggregations. + Metric *string `json:"metric,omitempty"` + // Group of target fields to aggregate over when using the new value aggregations. + Metrics []string `json:"metrics,omitempty"` + // Name of the query. + Name *string `json:"name,omitempty"` + // Query to run on logs. + Query *string `json:"query,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{} +} + +// NewSecurityMonitoringRuleQuery instantiates a new SecurityMonitoringRuleQuery 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 NewSecurityMonitoringRuleQuery() *SecurityMonitoringRuleQuery { + this := SecurityMonitoringRuleQuery{} + return &this +} + +// NewSecurityMonitoringRuleQueryWithDefaults instantiates a new SecurityMonitoringRuleQuery 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 NewSecurityMonitoringRuleQueryWithDefaults() *SecurityMonitoringRuleQuery { + this := SecurityMonitoringRuleQuery{} + return &this +} + +// GetAggregation returns the Aggregation field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQuery) GetAggregation() SecurityMonitoringRuleQueryAggregation { + if o == nil || o.Aggregation == nil { + var ret SecurityMonitoringRuleQueryAggregation + return ret + } + return *o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQuery) GetAggregationOk() (*SecurityMonitoringRuleQueryAggregation, bool) { + if o == nil || o.Aggregation == nil { + return nil, false + } + return o.Aggregation, true +} + +// HasAggregation returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQuery) HasAggregation() bool { + if o != nil && o.Aggregation != nil { + return true + } + + return false +} + +// SetAggregation gets a reference to the given SecurityMonitoringRuleQueryAggregation and assigns it to the Aggregation field. +func (o *SecurityMonitoringRuleQuery) SetAggregation(v SecurityMonitoringRuleQueryAggregation) { + o.Aggregation = &v +} + +// GetDistinctFields returns the DistinctFields field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQuery) GetDistinctFields() []string { + if o == nil || o.DistinctFields == nil { + var ret []string + return ret + } + return o.DistinctFields +} + +// GetDistinctFieldsOk returns a tuple with the DistinctFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQuery) GetDistinctFieldsOk() (*[]string, bool) { + if o == nil || o.DistinctFields == nil { + return nil, false + } + return &o.DistinctFields, true +} + +// HasDistinctFields returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQuery) HasDistinctFields() bool { + if o != nil && o.DistinctFields != nil { + return true + } + + return false +} + +// SetDistinctFields gets a reference to the given []string and assigns it to the DistinctFields field. +func (o *SecurityMonitoringRuleQuery) SetDistinctFields(v []string) { + o.DistinctFields = v +} + +// GetGroupByFields returns the GroupByFields field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQuery) GetGroupByFields() []string { + if o == nil || o.GroupByFields == nil { + var ret []string + return ret + } + return o.GroupByFields +} + +// GetGroupByFieldsOk returns a tuple with the GroupByFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQuery) GetGroupByFieldsOk() (*[]string, bool) { + if o == nil || o.GroupByFields == nil { + return nil, false + } + return &o.GroupByFields, true +} + +// HasGroupByFields returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQuery) HasGroupByFields() bool { + if o != nil && o.GroupByFields != nil { + return true + } + + return false +} + +// SetGroupByFields gets a reference to the given []string and assigns it to the GroupByFields field. +func (o *SecurityMonitoringRuleQuery) SetGroupByFields(v []string) { + o.GroupByFields = v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQuery) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQuery) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQuery) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *SecurityMonitoringRuleQuery) SetMetric(v string) { + o.Metric = &v +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQuery) GetMetrics() []string { + if o == nil || o.Metrics == nil { + var ret []string + return ret + } + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQuery) GetMetricsOk() (*[]string, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return &o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQuery) HasMetrics() bool { + if o != nil && o.Metrics != nil { + return true + } + + return false +} + +// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. +func (o *SecurityMonitoringRuleQuery) SetMetrics(v []string) { + o.Metrics = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQuery) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQuery) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQuery) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityMonitoringRuleQuery) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQuery) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQuery) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQuery) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *SecurityMonitoringRuleQuery) SetQuery(v string) { + o.Query = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleQuery) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregation != nil { + toSerialize["aggregation"] = o.Aggregation + } + if o.DistinctFields != nil { + toSerialize["distinctFields"] = o.DistinctFields + } + if o.GroupByFields != nil { + toSerialize["groupByFields"] = o.GroupByFields + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleQuery) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` + DistinctFields []string `json:"distinctFields,omitempty"` + GroupByFields []string `json:"groupByFields,omitempty"` + Metric *string `json:"metric,omitempty"` + Metrics []string `json:"metrics,omitempty"` + Name *string `json:"name,omitempty"` + Query *string `json:"query,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.DistinctFields = all.DistinctFields + o.GroupByFields = all.GroupByFields + o.Metric = all.Metric + o.Metrics = all.Metrics + o.Name = all.Name + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_query_aggregation.go b/api/v2/datadog/model_security_monitoring_rule_query_aggregation.go new file mode 100644 index 00000000000..d6323cf9bb1 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_query_aggregation.go @@ -0,0 +1,117 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleQueryAggregation The aggregation type. +type SecurityMonitoringRuleQueryAggregation string + +// List of SecurityMonitoringRuleQueryAggregation. +const ( + SECURITYMONITORINGRULEQUERYAGGREGATION_COUNT SecurityMonitoringRuleQueryAggregation = "count" + SECURITYMONITORINGRULEQUERYAGGREGATION_CARDINALITY SecurityMonitoringRuleQueryAggregation = "cardinality" + SECURITYMONITORINGRULEQUERYAGGREGATION_SUM SecurityMonitoringRuleQueryAggregation = "sum" + SECURITYMONITORINGRULEQUERYAGGREGATION_MAX SecurityMonitoringRuleQueryAggregation = "max" + SECURITYMONITORINGRULEQUERYAGGREGATION_NEW_VALUE SecurityMonitoringRuleQueryAggregation = "new_value" + SECURITYMONITORINGRULEQUERYAGGREGATION_GEO_DATA SecurityMonitoringRuleQueryAggregation = "geo_data" +) + +var allowedSecurityMonitoringRuleQueryAggregationEnumValues = []SecurityMonitoringRuleQueryAggregation{ + SECURITYMONITORINGRULEQUERYAGGREGATION_COUNT, + SECURITYMONITORINGRULEQUERYAGGREGATION_CARDINALITY, + SECURITYMONITORINGRULEQUERYAGGREGATION_SUM, + SECURITYMONITORINGRULEQUERYAGGREGATION_MAX, + SECURITYMONITORINGRULEQUERYAGGREGATION_NEW_VALUE, + SECURITYMONITORINGRULEQUERYAGGREGATION_GEO_DATA, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleQueryAggregation) GetAllowedValues() []SecurityMonitoringRuleQueryAggregation { + return allowedSecurityMonitoringRuleQueryAggregationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleQueryAggregation) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleQueryAggregation(value) + return nil +} + +// NewSecurityMonitoringRuleQueryAggregationFromValue returns a pointer to a valid SecurityMonitoringRuleQueryAggregation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleQueryAggregationFromValue(v string) (*SecurityMonitoringRuleQueryAggregation, error) { + ev := SecurityMonitoringRuleQueryAggregation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleQueryAggregation: valid values are %v", v, allowedSecurityMonitoringRuleQueryAggregationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleQueryAggregation) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleQueryAggregationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleQueryAggregation value. +func (v SecurityMonitoringRuleQueryAggregation) Ptr() *SecurityMonitoringRuleQueryAggregation { + return &v +} + +// NullableSecurityMonitoringRuleQueryAggregation handles when a null is used for SecurityMonitoringRuleQueryAggregation. +type NullableSecurityMonitoringRuleQueryAggregation struct { + value *SecurityMonitoringRuleQueryAggregation + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleQueryAggregation) Get() *SecurityMonitoringRuleQueryAggregation { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleQueryAggregation) Set(val *SecurityMonitoringRuleQueryAggregation) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleQueryAggregation) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleQueryAggregation) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleQueryAggregation initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleQueryAggregation(val *SecurityMonitoringRuleQueryAggregation) *NullableSecurityMonitoringRuleQueryAggregation { + return &NullableSecurityMonitoringRuleQueryAggregation{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleQueryAggregation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleQueryAggregation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_query_create.go b/api/v2/datadog/model_security_monitoring_rule_query_create.go new file mode 100644 index 00000000000..2a89c57cbd9 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_query_create.go @@ -0,0 +1,346 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleQueryCreate Query for matching rule. +type SecurityMonitoringRuleQueryCreate struct { + // The aggregation type. + Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` + // Field for which the cardinality is measured. Sent as an array. + DistinctFields []string `json:"distinctFields,omitempty"` + // Fields to group by. + GroupByFields []string `json:"groupByFields,omitempty"` + // The target field to aggregate over when using the sum or max + // aggregations. + Metric *string `json:"metric,omitempty"` + // Group of target fields to aggregate over when using the new value aggregations. + Metrics []string `json:"metrics,omitempty"` + // Name of the query. + Name *string `json:"name,omitempty"` + // Query to run on logs. + Query string `json:"query"` + // 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{} +} + +// NewSecurityMonitoringRuleQueryCreate instantiates a new SecurityMonitoringRuleQueryCreate 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 NewSecurityMonitoringRuleQueryCreate(query string) *SecurityMonitoringRuleQueryCreate { + this := SecurityMonitoringRuleQueryCreate{} + this.Query = query + return &this +} + +// NewSecurityMonitoringRuleQueryCreateWithDefaults instantiates a new SecurityMonitoringRuleQueryCreate 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 NewSecurityMonitoringRuleQueryCreateWithDefaults() *SecurityMonitoringRuleQueryCreate { + this := SecurityMonitoringRuleQueryCreate{} + return &this +} + +// GetAggregation returns the Aggregation field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQueryCreate) GetAggregation() SecurityMonitoringRuleQueryAggregation { + if o == nil || o.Aggregation == nil { + var ret SecurityMonitoringRuleQueryAggregation + return ret + } + return *o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQueryCreate) GetAggregationOk() (*SecurityMonitoringRuleQueryAggregation, bool) { + if o == nil || o.Aggregation == nil { + return nil, false + } + return o.Aggregation, true +} + +// HasAggregation returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQueryCreate) HasAggregation() bool { + if o != nil && o.Aggregation != nil { + return true + } + + return false +} + +// SetAggregation gets a reference to the given SecurityMonitoringRuleQueryAggregation and assigns it to the Aggregation field. +func (o *SecurityMonitoringRuleQueryCreate) SetAggregation(v SecurityMonitoringRuleQueryAggregation) { + o.Aggregation = &v +} + +// GetDistinctFields returns the DistinctFields field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQueryCreate) GetDistinctFields() []string { + if o == nil || o.DistinctFields == nil { + var ret []string + return ret + } + return o.DistinctFields +} + +// GetDistinctFieldsOk returns a tuple with the DistinctFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQueryCreate) GetDistinctFieldsOk() (*[]string, bool) { + if o == nil || o.DistinctFields == nil { + return nil, false + } + return &o.DistinctFields, true +} + +// HasDistinctFields returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQueryCreate) HasDistinctFields() bool { + if o != nil && o.DistinctFields != nil { + return true + } + + return false +} + +// SetDistinctFields gets a reference to the given []string and assigns it to the DistinctFields field. +func (o *SecurityMonitoringRuleQueryCreate) SetDistinctFields(v []string) { + o.DistinctFields = v +} + +// GetGroupByFields returns the GroupByFields field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQueryCreate) GetGroupByFields() []string { + if o == nil || o.GroupByFields == nil { + var ret []string + return ret + } + return o.GroupByFields +} + +// GetGroupByFieldsOk returns a tuple with the GroupByFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQueryCreate) GetGroupByFieldsOk() (*[]string, bool) { + if o == nil || o.GroupByFields == nil { + return nil, false + } + return &o.GroupByFields, true +} + +// HasGroupByFields returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQueryCreate) HasGroupByFields() bool { + if o != nil && o.GroupByFields != nil { + return true + } + + return false +} + +// SetGroupByFields gets a reference to the given []string and assigns it to the GroupByFields field. +func (o *SecurityMonitoringRuleQueryCreate) SetGroupByFields(v []string) { + o.GroupByFields = v +} + +// GetMetric returns the Metric field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQueryCreate) GetMetric() string { + if o == nil || o.Metric == nil { + var ret string + return ret + } + return *o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQueryCreate) GetMetricOk() (*string, bool) { + if o == nil || o.Metric == nil { + return nil, false + } + return o.Metric, true +} + +// HasMetric returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQueryCreate) HasMetric() bool { + if o != nil && o.Metric != nil { + return true + } + + return false +} + +// SetMetric gets a reference to the given string and assigns it to the Metric field. +func (o *SecurityMonitoringRuleQueryCreate) SetMetric(v string) { + o.Metric = &v +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQueryCreate) GetMetrics() []string { + if o == nil || o.Metrics == nil { + var ret []string + return ret + } + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQueryCreate) GetMetricsOk() (*[]string, bool) { + if o == nil || o.Metrics == nil { + return nil, false + } + return &o.Metrics, true +} + +// HasMetrics returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQueryCreate) HasMetrics() bool { + if o != nil && o.Metrics != nil { + return true + } + + return false +} + +// SetMetrics gets a reference to the given []string and assigns it to the Metrics field. +func (o *SecurityMonitoringRuleQueryCreate) SetMetrics(v []string) { + o.Metrics = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleQueryCreate) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQueryCreate) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleQueryCreate) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityMonitoringRuleQueryCreate) SetName(v string) { + o.Name = &v +} + +// GetQuery returns the Query field value. +func (o *SecurityMonitoringRuleQueryCreate) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleQueryCreate) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *SecurityMonitoringRuleQueryCreate) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleQueryCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Aggregation != nil { + toSerialize["aggregation"] = o.Aggregation + } + if o.DistinctFields != nil { + toSerialize["distinctFields"] = o.DistinctFields + } + if o.GroupByFields != nil { + toSerialize["groupByFields"] = o.GroupByFields + } + if o.Metric != nil { + toSerialize["metric"] = o.Metric + } + if o.Metrics != nil { + toSerialize["metrics"] = o.Metrics + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["query"] = o.Query + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleQueryCreate) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Query *string `json:"query"` + }{} + all := struct { + Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` + DistinctFields []string `json:"distinctFields,omitempty"` + GroupByFields []string `json:"groupByFields,omitempty"` + Metric *string `json:"metric,omitempty"` + Metrics []string `json:"metrics,omitempty"` + Name *string `json:"name,omitempty"` + Query string `json:"query"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Query == nil { + return fmt.Errorf("Required field query missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Aggregation; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Aggregation = all.Aggregation + o.DistinctFields = all.DistinctFields + o.GroupByFields = all.GroupByFields + o.Metric = all.Metric + o.Metrics = all.Metrics + o.Name = all.Name + o.Query = all.Query + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_response.go b/api/v2/datadog/model_security_monitoring_rule_response.go new file mode 100644 index 00000000000..f18b4a67ac2 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_response.go @@ -0,0 +1,741 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringRuleResponse Rule. +type SecurityMonitoringRuleResponse struct { + // Cases for generating signals. + Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` + // When the rule was created, timestamp in milliseconds. + CreatedAt *int64 `json:"createdAt,omitempty"` + // User ID of the user who created the rule. + CreationAuthorId *int64 `json:"creationAuthorId,omitempty"` + // Additional queries to filter matched events before they are processed. + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + // Whether the notifications include the triggering group-by values in their title. + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + // The ID of the rule. + Id *string `json:"id,omitempty"` + // Whether the rule is included by default. + IsDefault *bool `json:"isDefault,omitempty"` + // Whether the rule has been deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // Whether the rule is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Message for generated signals. + Message *string `json:"message,omitempty"` + // The name of the rule. + Name *string `json:"name,omitempty"` + // Options on rules. + Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` + // Queries for selecting logs which are part of the rule. + Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` + // Tags for generated signals. + Tags []string `json:"tags,omitempty"` + // The rule type. + Type *SecurityMonitoringRuleTypeRead `json:"type,omitempty"` + // User ID of the user who updated the rule. + UpdateAuthorId *int64 `json:"updateAuthorId,omitempty"` + // The version of the rule. + Version *int64 `json:"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{} +} + +// NewSecurityMonitoringRuleResponse instantiates a new SecurityMonitoringRuleResponse 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 NewSecurityMonitoringRuleResponse() *SecurityMonitoringRuleResponse { + this := SecurityMonitoringRuleResponse{} + return &this +} + +// NewSecurityMonitoringRuleResponseWithDefaults instantiates a new SecurityMonitoringRuleResponse 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 NewSecurityMonitoringRuleResponseWithDefaults() *SecurityMonitoringRuleResponse { + this := SecurityMonitoringRuleResponse{} + return &this +} + +// GetCases returns the Cases field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetCases() []SecurityMonitoringRuleCase { + if o == nil || o.Cases == nil { + var ret []SecurityMonitoringRuleCase + return ret + } + return o.Cases +} + +// GetCasesOk returns a tuple with the Cases field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetCasesOk() (*[]SecurityMonitoringRuleCase, bool) { + if o == nil || o.Cases == nil { + return nil, false + } + return &o.Cases, true +} + +// HasCases returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasCases() bool { + if o != nil && o.Cases != nil { + return true + } + + return false +} + +// SetCases gets a reference to the given []SecurityMonitoringRuleCase and assigns it to the Cases field. +func (o *SecurityMonitoringRuleResponse) SetCases(v []SecurityMonitoringRuleCase) { + o.Cases = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetCreatedAt() int64 { + if o == nil || o.CreatedAt == nil { + var ret int64 + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetCreatedAtOk() (*int64, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given int64 and assigns it to the CreatedAt field. +func (o *SecurityMonitoringRuleResponse) SetCreatedAt(v int64) { + o.CreatedAt = &v +} + +// GetCreationAuthorId returns the CreationAuthorId field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetCreationAuthorId() int64 { + if o == nil || o.CreationAuthorId == nil { + var ret int64 + return ret + } + return *o.CreationAuthorId +} + +// GetCreationAuthorIdOk returns a tuple with the CreationAuthorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetCreationAuthorIdOk() (*int64, bool) { + if o == nil || o.CreationAuthorId == nil { + return nil, false + } + return o.CreationAuthorId, true +} + +// HasCreationAuthorId returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasCreationAuthorId() bool { + if o != nil && o.CreationAuthorId != nil { + return true + } + + return false +} + +// SetCreationAuthorId gets a reference to the given int64 and assigns it to the CreationAuthorId field. +func (o *SecurityMonitoringRuleResponse) SetCreationAuthorId(v int64) { + o.CreationAuthorId = &v +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetFilters() []SecurityMonitoringFilter { + if o == nil || o.Filters == nil { + var ret []SecurityMonitoringFilter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetFiltersOk() (*[]SecurityMonitoringFilter, bool) { + if o == nil || o.Filters == nil { + return nil, false + } + return &o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasFilters() bool { + if o != nil && o.Filters != nil { + return true + } + + return false +} + +// SetFilters gets a reference to the given []SecurityMonitoringFilter and assigns it to the Filters field. +func (o *SecurityMonitoringRuleResponse) SetFilters(v []SecurityMonitoringFilter) { + o.Filters = v +} + +// GetHasExtendedTitle returns the HasExtendedTitle field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetHasExtendedTitle() bool { + if o == nil || o.HasExtendedTitle == nil { + var ret bool + return ret + } + return *o.HasExtendedTitle +} + +// GetHasExtendedTitleOk returns a tuple with the HasExtendedTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetHasExtendedTitleOk() (*bool, bool) { + if o == nil || o.HasExtendedTitle == nil { + return nil, false + } + return o.HasExtendedTitle, true +} + +// HasHasExtendedTitle returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasHasExtendedTitle() bool { + if o != nil && o.HasExtendedTitle != nil { + return true + } + + return false +} + +// SetHasExtendedTitle gets a reference to the given bool and assigns it to the HasExtendedTitle field. +func (o *SecurityMonitoringRuleResponse) SetHasExtendedTitle(v bool) { + o.HasExtendedTitle = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityMonitoringRuleResponse) SetId(v string) { + o.Id = &v +} + +// GetIsDefault returns the IsDefault field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetIsDefault() bool { + if o == nil || o.IsDefault == nil { + var ret bool + return ret + } + return *o.IsDefault +} + +// GetIsDefaultOk returns a tuple with the IsDefault field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetIsDefaultOk() (*bool, bool) { + if o == nil || o.IsDefault == nil { + return nil, false + } + return o.IsDefault, true +} + +// HasIsDefault returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasIsDefault() bool { + if o != nil && o.IsDefault != nil { + return true + } + + return false +} + +// SetIsDefault gets a reference to the given bool and assigns it to the IsDefault field. +func (o *SecurityMonitoringRuleResponse) SetIsDefault(v bool) { + o.IsDefault = &v +} + +// GetIsDeleted returns the IsDeleted field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetIsDeleted() bool { + if o == nil || o.IsDeleted == nil { + var ret bool + return ret + } + return *o.IsDeleted +} + +// GetIsDeletedOk returns a tuple with the IsDeleted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetIsDeletedOk() (*bool, bool) { + if o == nil || o.IsDeleted == nil { + return nil, false + } + return o.IsDeleted, true +} + +// HasIsDeleted returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasIsDeleted() bool { + if o != nil && o.IsDeleted != nil { + return true + } + + return false +} + +// SetIsDeleted gets a reference to the given bool and assigns it to the IsDeleted field. +func (o *SecurityMonitoringRuleResponse) SetIsDeleted(v bool) { + o.IsDeleted = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *SecurityMonitoringRuleResponse) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SecurityMonitoringRuleResponse) SetMessage(v string) { + o.Message = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityMonitoringRuleResponse) SetName(v string) { + o.Name = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetOptions() SecurityMonitoringRuleOptions { + if o == nil || o.Options == nil { + var ret SecurityMonitoringRuleOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetOptionsOk() (*SecurityMonitoringRuleOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given SecurityMonitoringRuleOptions and assigns it to the Options field. +func (o *SecurityMonitoringRuleResponse) SetOptions(v SecurityMonitoringRuleOptions) { + o.Options = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetQueries() []SecurityMonitoringRuleQuery { + if o == nil || o.Queries == nil { + var ret []SecurityMonitoringRuleQuery + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetQueriesOk() (*[]SecurityMonitoringRuleQuery, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []SecurityMonitoringRuleQuery and assigns it to the Queries field. +func (o *SecurityMonitoringRuleResponse) SetQueries(v []SecurityMonitoringRuleQuery) { + o.Queries = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SecurityMonitoringRuleResponse) GetTagsOk() (*[]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 *SecurityMonitoringRuleResponse) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SecurityMonitoringRuleResponse) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetType() SecurityMonitoringRuleTypeRead { + if o == nil || o.Type == nil { + var ret SecurityMonitoringRuleTypeRead + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetTypeOk() (*SecurityMonitoringRuleTypeRead, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SecurityMonitoringRuleTypeRead and assigns it to the Type field. +func (o *SecurityMonitoringRuleResponse) SetType(v SecurityMonitoringRuleTypeRead) { + o.Type = &v +} + +// GetUpdateAuthorId returns the UpdateAuthorId field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetUpdateAuthorId() int64 { + if o == nil || o.UpdateAuthorId == nil { + var ret int64 + return ret + } + return *o.UpdateAuthorId +} + +// GetUpdateAuthorIdOk returns a tuple with the UpdateAuthorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetUpdateAuthorIdOk() (*int64, bool) { + if o == nil || o.UpdateAuthorId == nil { + return nil, false + } + return o.UpdateAuthorId, true +} + +// HasUpdateAuthorId returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasUpdateAuthorId() bool { + if o != nil && o.UpdateAuthorId != nil { + return true + } + + return false +} + +// SetUpdateAuthorId gets a reference to the given int64 and assigns it to the UpdateAuthorId field. +func (o *SecurityMonitoringRuleResponse) SetUpdateAuthorId(v int64) { + o.UpdateAuthorId = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleResponse) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleResponse) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleResponse) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SecurityMonitoringRuleResponse) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cases != nil { + toSerialize["cases"] = o.Cases + } + if o.CreatedAt != nil { + toSerialize["createdAt"] = o.CreatedAt + } + if o.CreationAuthorId != nil { + toSerialize["creationAuthorId"] = o.CreationAuthorId + } + if o.Filters != nil { + toSerialize["filters"] = o.Filters + } + if o.HasExtendedTitle != nil { + toSerialize["hasExtendedTitle"] = o.HasExtendedTitle + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.IsDefault != nil { + toSerialize["isDefault"] = o.IsDefault + } + if o.IsDeleted != nil { + toSerialize["isDeleted"] = o.IsDeleted + } + if o.IsEnabled != nil { + toSerialize["isEnabled"] = o.IsEnabled + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.UpdateAuthorId != nil { + toSerialize["updateAuthorId"] = o.UpdateAuthorId + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` + CreatedAt *int64 `json:"createdAt,omitempty"` + CreationAuthorId *int64 `json:"creationAuthorId,omitempty"` + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + Id *string `json:"id,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + IsDeleted *bool `json:"isDeleted,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` + Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *SecurityMonitoringRuleTypeRead `json:"type,omitempty"` + UpdateAuthorId *int64 `json:"updateAuthorId,omitempty"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cases = all.Cases + o.CreatedAt = all.CreatedAt + o.CreationAuthorId = all.CreationAuthorId + o.Filters = all.Filters + o.HasExtendedTitle = all.HasExtendedTitle + o.Id = all.Id + o.IsDefault = all.IsDefault + o.IsDeleted = all.IsDeleted + o.IsEnabled = all.IsEnabled + o.Message = all.Message + o.Name = all.Name + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.Queries = all.Queries + o.Tags = all.Tags + o.Type = all.Type + o.UpdateAuthorId = all.UpdateAuthorId + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_rule_severity.go b/api/v2/datadog/model_security_monitoring_rule_severity.go new file mode 100644 index 00000000000..202af6616d9 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_severity.go @@ -0,0 +1,115 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleSeverity Severity of the Security Signal. +type SecurityMonitoringRuleSeverity string + +// List of SecurityMonitoringRuleSeverity. +const ( + SECURITYMONITORINGRULESEVERITY_INFO SecurityMonitoringRuleSeverity = "info" + SECURITYMONITORINGRULESEVERITY_LOW SecurityMonitoringRuleSeverity = "low" + SECURITYMONITORINGRULESEVERITY_MEDIUM SecurityMonitoringRuleSeverity = "medium" + SECURITYMONITORINGRULESEVERITY_HIGH SecurityMonitoringRuleSeverity = "high" + SECURITYMONITORINGRULESEVERITY_CRITICAL SecurityMonitoringRuleSeverity = "critical" +) + +var allowedSecurityMonitoringRuleSeverityEnumValues = []SecurityMonitoringRuleSeverity{ + SECURITYMONITORINGRULESEVERITY_INFO, + SECURITYMONITORINGRULESEVERITY_LOW, + SECURITYMONITORINGRULESEVERITY_MEDIUM, + SECURITYMONITORINGRULESEVERITY_HIGH, + SECURITYMONITORINGRULESEVERITY_CRITICAL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleSeverity) GetAllowedValues() []SecurityMonitoringRuleSeverity { + return allowedSecurityMonitoringRuleSeverityEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleSeverity) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleSeverity(value) + return nil +} + +// NewSecurityMonitoringRuleSeverityFromValue returns a pointer to a valid SecurityMonitoringRuleSeverity +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleSeverityFromValue(v string) (*SecurityMonitoringRuleSeverity, error) { + ev := SecurityMonitoringRuleSeverity(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleSeverity: valid values are %v", v, allowedSecurityMonitoringRuleSeverityEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleSeverity) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleSeverityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleSeverity value. +func (v SecurityMonitoringRuleSeverity) Ptr() *SecurityMonitoringRuleSeverity { + return &v +} + +// NullableSecurityMonitoringRuleSeverity handles when a null is used for SecurityMonitoringRuleSeverity. +type NullableSecurityMonitoringRuleSeverity struct { + value *SecurityMonitoringRuleSeverity + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleSeverity) Get() *SecurityMonitoringRuleSeverity { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleSeverity) Set(val *SecurityMonitoringRuleSeverity) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleSeverity) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleSeverity) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleSeverity initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleSeverity(val *SecurityMonitoringRuleSeverity) *NullableSecurityMonitoringRuleSeverity { + return &NullableSecurityMonitoringRuleSeverity{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleSeverity) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleSeverity) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_type_create.go b/api/v2/datadog/model_security_monitoring_rule_type_create.go new file mode 100644 index 00000000000..2519439913b --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_type_create.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleTypeCreate The rule type. +type SecurityMonitoringRuleTypeCreate string + +// List of SecurityMonitoringRuleTypeCreate. +const ( + SECURITYMONITORINGRULETYPECREATE_LOG_DETECTION SecurityMonitoringRuleTypeCreate = "log_detection" + SECURITYMONITORINGRULETYPECREATE_WORKLOAD_SECURITY SecurityMonitoringRuleTypeCreate = "workload_security" +) + +var allowedSecurityMonitoringRuleTypeCreateEnumValues = []SecurityMonitoringRuleTypeCreate{ + SECURITYMONITORINGRULETYPECREATE_LOG_DETECTION, + SECURITYMONITORINGRULETYPECREATE_WORKLOAD_SECURITY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleTypeCreate) GetAllowedValues() []SecurityMonitoringRuleTypeCreate { + return allowedSecurityMonitoringRuleTypeCreateEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleTypeCreate) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleTypeCreate(value) + return nil +} + +// NewSecurityMonitoringRuleTypeCreateFromValue returns a pointer to a valid SecurityMonitoringRuleTypeCreate +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleTypeCreateFromValue(v string) (*SecurityMonitoringRuleTypeCreate, error) { + ev := SecurityMonitoringRuleTypeCreate(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleTypeCreate: valid values are %v", v, allowedSecurityMonitoringRuleTypeCreateEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleTypeCreate) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleTypeCreateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleTypeCreate value. +func (v SecurityMonitoringRuleTypeCreate) Ptr() *SecurityMonitoringRuleTypeCreate { + return &v +} + +// NullableSecurityMonitoringRuleTypeCreate handles when a null is used for SecurityMonitoringRuleTypeCreate. +type NullableSecurityMonitoringRuleTypeCreate struct { + value *SecurityMonitoringRuleTypeCreate + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleTypeCreate) Get() *SecurityMonitoringRuleTypeCreate { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleTypeCreate) Set(val *SecurityMonitoringRuleTypeCreate) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleTypeCreate) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleTypeCreate) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleTypeCreate initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleTypeCreate(val *SecurityMonitoringRuleTypeCreate) *NullableSecurityMonitoringRuleTypeCreate { + return &NullableSecurityMonitoringRuleTypeCreate{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleTypeCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleTypeCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_type_read.go b/api/v2/datadog/model_security_monitoring_rule_type_read.go new file mode 100644 index 00000000000..19bc0bd7700 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_type_read.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleTypeRead The rule type. +type SecurityMonitoringRuleTypeRead string + +// List of SecurityMonitoringRuleTypeRead. +const ( + SECURITYMONITORINGRULETYPEREAD_LOG_DETECTION SecurityMonitoringRuleTypeRead = "log_detection" + SECURITYMONITORINGRULETYPEREAD_INFRASTRUCTURE_CONFIGURATION SecurityMonitoringRuleTypeRead = "infrastructure_configuration" + SECURITYMONITORINGRULETYPEREAD_WORKLOAD_SECURITY SecurityMonitoringRuleTypeRead = "workload_security" + SECURITYMONITORINGRULETYPEREAD_CLOUD_CONFIGURATION SecurityMonitoringRuleTypeRead = "cloud_configuration" +) + +var allowedSecurityMonitoringRuleTypeReadEnumValues = []SecurityMonitoringRuleTypeRead{ + SECURITYMONITORINGRULETYPEREAD_LOG_DETECTION, + SECURITYMONITORINGRULETYPEREAD_INFRASTRUCTURE_CONFIGURATION, + SECURITYMONITORINGRULETYPEREAD_WORKLOAD_SECURITY, + SECURITYMONITORINGRULETYPEREAD_CLOUD_CONFIGURATION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleTypeRead) GetAllowedValues() []SecurityMonitoringRuleTypeRead { + return allowedSecurityMonitoringRuleTypeReadEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleTypeRead) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleTypeRead(value) + return nil +} + +// NewSecurityMonitoringRuleTypeReadFromValue returns a pointer to a valid SecurityMonitoringRuleTypeRead +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleTypeReadFromValue(v string) (*SecurityMonitoringRuleTypeRead, error) { + ev := SecurityMonitoringRuleTypeRead(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleTypeRead: valid values are %v", v, allowedSecurityMonitoringRuleTypeReadEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleTypeRead) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleTypeReadEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleTypeRead value. +func (v SecurityMonitoringRuleTypeRead) Ptr() *SecurityMonitoringRuleTypeRead { + return &v +} + +// NullableSecurityMonitoringRuleTypeRead handles when a null is used for SecurityMonitoringRuleTypeRead. +type NullableSecurityMonitoringRuleTypeRead struct { + value *SecurityMonitoringRuleTypeRead + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleTypeRead) Get() *SecurityMonitoringRuleTypeRead { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleTypeRead) Set(val *SecurityMonitoringRuleTypeRead) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleTypeRead) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleTypeRead) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleTypeRead initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleTypeRead(val *SecurityMonitoringRuleTypeRead) *NullableSecurityMonitoringRuleTypeRead { + return &NullableSecurityMonitoringRuleTypeRead{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleTypeRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleTypeRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_update_payload.go b/api/v2/datadog/model_security_monitoring_rule_update_payload.go new file mode 100644 index 00000000000..526443af3e3 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_update_payload.go @@ -0,0 +1,460 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringRuleUpdatePayload Update an existing rule. +type SecurityMonitoringRuleUpdatePayload struct { + // Cases for generating signals. + Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` + // Additional queries to filter matched events before they are processed. + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + // Whether the notifications include the triggering group-by values in their title. + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + // Whether the rule is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Message for generated signals. + Message *string `json:"message,omitempty"` + // Name of the rule. + Name *string `json:"name,omitempty"` + // Options on rules. + Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` + // Queries for selecting logs which are part of the rule. + Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` + // Tags for generated signals. + Tags []string `json:"tags,omitempty"` + // The version of the rule being updated. + Version *int32 `json:"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{} +} + +// NewSecurityMonitoringRuleUpdatePayload instantiates a new SecurityMonitoringRuleUpdatePayload 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 NewSecurityMonitoringRuleUpdatePayload() *SecurityMonitoringRuleUpdatePayload { + this := SecurityMonitoringRuleUpdatePayload{} + return &this +} + +// NewSecurityMonitoringRuleUpdatePayloadWithDefaults instantiates a new SecurityMonitoringRuleUpdatePayload 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 NewSecurityMonitoringRuleUpdatePayloadWithDefaults() *SecurityMonitoringRuleUpdatePayload { + this := SecurityMonitoringRuleUpdatePayload{} + return &this +} + +// GetCases returns the Cases field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetCases() []SecurityMonitoringRuleCase { + if o == nil || o.Cases == nil { + var ret []SecurityMonitoringRuleCase + return ret + } + return o.Cases +} + +// GetCasesOk returns a tuple with the Cases field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetCasesOk() (*[]SecurityMonitoringRuleCase, bool) { + if o == nil || o.Cases == nil { + return nil, false + } + return &o.Cases, true +} + +// HasCases returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasCases() bool { + if o != nil && o.Cases != nil { + return true + } + + return false +} + +// SetCases gets a reference to the given []SecurityMonitoringRuleCase and assigns it to the Cases field. +func (o *SecurityMonitoringRuleUpdatePayload) SetCases(v []SecurityMonitoringRuleCase) { + o.Cases = v +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetFilters() []SecurityMonitoringFilter { + if o == nil || o.Filters == nil { + var ret []SecurityMonitoringFilter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetFiltersOk() (*[]SecurityMonitoringFilter, bool) { + if o == nil || o.Filters == nil { + return nil, false + } + return &o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasFilters() bool { + if o != nil && o.Filters != nil { + return true + } + + return false +} + +// SetFilters gets a reference to the given []SecurityMonitoringFilter and assigns it to the Filters field. +func (o *SecurityMonitoringRuleUpdatePayload) SetFilters(v []SecurityMonitoringFilter) { + o.Filters = v +} + +// GetHasExtendedTitle returns the HasExtendedTitle field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetHasExtendedTitle() bool { + if o == nil || o.HasExtendedTitle == nil { + var ret bool + return ret + } + return *o.HasExtendedTitle +} + +// GetHasExtendedTitleOk returns a tuple with the HasExtendedTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetHasExtendedTitleOk() (*bool, bool) { + if o == nil || o.HasExtendedTitle == nil { + return nil, false + } + return o.HasExtendedTitle, true +} + +// HasHasExtendedTitle returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasHasExtendedTitle() bool { + if o != nil && o.HasExtendedTitle != nil { + return true + } + + return false +} + +// SetHasExtendedTitle gets a reference to the given bool and assigns it to the HasExtendedTitle field. +func (o *SecurityMonitoringRuleUpdatePayload) SetHasExtendedTitle(v bool) { + o.HasExtendedTitle = &v +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasIsEnabled() bool { + if o != nil && o.IsEnabled != nil { + return true + } + + return false +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *SecurityMonitoringRuleUpdatePayload) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SecurityMonitoringRuleUpdatePayload) SetMessage(v string) { + o.Message = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityMonitoringRuleUpdatePayload) SetName(v string) { + o.Name = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetOptions() SecurityMonitoringRuleOptions { + if o == nil || o.Options == nil { + var ret SecurityMonitoringRuleOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetOptionsOk() (*SecurityMonitoringRuleOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given SecurityMonitoringRuleOptions and assigns it to the Options field. +func (o *SecurityMonitoringRuleUpdatePayload) SetOptions(v SecurityMonitoringRuleOptions) { + o.Options = &v +} + +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetQueries() []SecurityMonitoringRuleQuery { + if o == nil || o.Queries == nil { + var ret []SecurityMonitoringRuleQuery + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetQueriesOk() (*[]SecurityMonitoringRuleQuery, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasQueries() bool { + if o != nil && o.Queries != nil { + return true + } + + return false +} + +// SetQueries gets a reference to the given []SecurityMonitoringRuleQuery and assigns it to the Queries field. +func (o *SecurityMonitoringRuleUpdatePayload) SetQueries(v []SecurityMonitoringRuleQuery) { + o.Queries = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SecurityMonitoringRuleUpdatePayload) GetTagsOk() (*[]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 *SecurityMonitoringRuleUpdatePayload) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SecurityMonitoringRuleUpdatePayload) SetTags(v []string) { + o.Tags = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleUpdatePayload) GetVersion() int32 { + if o == nil || o.Version == nil { + var ret int32 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleUpdatePayload) GetVersionOk() (*int32, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleUpdatePayload) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int32 and assigns it to the Version field. +func (o *SecurityMonitoringRuleUpdatePayload) SetVersion(v int32) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringRuleUpdatePayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cases != nil { + toSerialize["cases"] = o.Cases + } + if o.Filters != nil { + toSerialize["filters"] = o.Filters + } + if o.HasExtendedTitle != nil { + toSerialize["hasExtendedTitle"] = o.HasExtendedTitle + } + if o.IsEnabled != nil { + toSerialize["isEnabled"] = o.IsEnabled + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cases []SecurityMonitoringRuleCase `json:"cases,omitempty"` + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + Options *SecurityMonitoringRuleOptions `json:"options,omitempty"` + Queries []SecurityMonitoringRuleQuery `json:"queries,omitempty"` + Tags []string `json:"tags,omitempty"` + Version *int32 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cases = all.Cases + o.Filters = all.Filters + o.HasExtendedTitle = all.HasExtendedTitle + o.IsEnabled = all.IsEnabled + o.Message = all.Message + o.Name = all.Name + if all.Options != nil && all.Options.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Options = all.Options + o.Queries = all.Queries + o.Tags = all.Tags + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal.go b/api/v2/datadog/model_security_monitoring_signal.go new file mode 100644 index 00000000000..dc8da312af0 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal.go @@ -0,0 +1,200 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignal Object description of a security signal. +type SecurityMonitoringSignal struct { + // The object containing all signal attributes and their + // associated values. + Attributes *SecurityMonitoringSignalAttributes `json:"attributes,omitempty"` + // The unique ID of the security signal. + Id *string `json:"id,omitempty"` + // The type of event. + Type *SecurityMonitoringSignalType `json:"type,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{} +} + +// NewSecurityMonitoringSignal instantiates a new SecurityMonitoringSignal 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 NewSecurityMonitoringSignal() *SecurityMonitoringSignal { + this := SecurityMonitoringSignal{} + var typeVar SecurityMonitoringSignalType = SECURITYMONITORINGSIGNALTYPE_SIGNAL + this.Type = &typeVar + return &this +} + +// NewSecurityMonitoringSignalWithDefaults instantiates a new SecurityMonitoringSignal 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 NewSecurityMonitoringSignalWithDefaults() *SecurityMonitoringSignal { + this := SecurityMonitoringSignal{} + var typeVar SecurityMonitoringSignalType = SECURITYMONITORINGSIGNALTYPE_SIGNAL + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SecurityMonitoringSignal) GetAttributes() SecurityMonitoringSignalAttributes { + if o == nil || o.Attributes == nil { + var ret SecurityMonitoringSignalAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignal) GetAttributesOk() (*SecurityMonitoringSignalAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SecurityMonitoringSignal) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SecurityMonitoringSignalAttributes and assigns it to the Attributes field. +func (o *SecurityMonitoringSignal) SetAttributes(v SecurityMonitoringSignalAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityMonitoringSignal) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignal) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityMonitoringSignal) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityMonitoringSignal) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityMonitoringSignal) GetType() SecurityMonitoringSignalType { + if o == nil || o.Type == nil { + var ret SecurityMonitoringSignalType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignal) GetTypeOk() (*SecurityMonitoringSignalType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityMonitoringSignal) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SecurityMonitoringSignalType and assigns it to the Type field. +func (o *SecurityMonitoringSignal) SetType(v SecurityMonitoringSignalType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignal) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignal) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *SecurityMonitoringSignalAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SecurityMonitoringSignalType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_archive_reason.go b/api/v2/datadog/model_security_monitoring_signal_archive_reason.go new file mode 100644 index 00000000000..085f7b7d3c3 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_archive_reason.go @@ -0,0 +1,113 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalArchiveReason Reason a signal is archived. +type SecurityMonitoringSignalArchiveReason string + +// List of SecurityMonitoringSignalArchiveReason. +const ( + SECURITYMONITORINGSIGNALARCHIVEREASON_NONE SecurityMonitoringSignalArchiveReason = "none" + SECURITYMONITORINGSIGNALARCHIVEREASON_FALSE_POSITIVE SecurityMonitoringSignalArchiveReason = "false_positive" + SECURITYMONITORINGSIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE SecurityMonitoringSignalArchiveReason = "testing_or_maintenance" + SECURITYMONITORINGSIGNALARCHIVEREASON_OTHER SecurityMonitoringSignalArchiveReason = "other" +) + +var allowedSecurityMonitoringSignalArchiveReasonEnumValues = []SecurityMonitoringSignalArchiveReason{ + SECURITYMONITORINGSIGNALARCHIVEREASON_NONE, + SECURITYMONITORINGSIGNALARCHIVEREASON_FALSE_POSITIVE, + SECURITYMONITORINGSIGNALARCHIVEREASON_TESTING_OR_MAINTENANCE, + SECURITYMONITORINGSIGNALARCHIVEREASON_OTHER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringSignalArchiveReason) GetAllowedValues() []SecurityMonitoringSignalArchiveReason { + return allowedSecurityMonitoringSignalArchiveReasonEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringSignalArchiveReason) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringSignalArchiveReason(value) + return nil +} + +// NewSecurityMonitoringSignalArchiveReasonFromValue returns a pointer to a valid SecurityMonitoringSignalArchiveReason +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringSignalArchiveReasonFromValue(v string) (*SecurityMonitoringSignalArchiveReason, error) { + ev := SecurityMonitoringSignalArchiveReason(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalArchiveReason: valid values are %v", v, allowedSecurityMonitoringSignalArchiveReasonEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringSignalArchiveReason) IsValid() bool { + for _, existing := range allowedSecurityMonitoringSignalArchiveReasonEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringSignalArchiveReason value. +func (v SecurityMonitoringSignalArchiveReason) Ptr() *SecurityMonitoringSignalArchiveReason { + return &v +} + +// NullableSecurityMonitoringSignalArchiveReason handles when a null is used for SecurityMonitoringSignalArchiveReason. +type NullableSecurityMonitoringSignalArchiveReason struct { + value *SecurityMonitoringSignalArchiveReason + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringSignalArchiveReason) Get() *SecurityMonitoringSignalArchiveReason { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringSignalArchiveReason) Set(val *SecurityMonitoringSignalArchiveReason) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringSignalArchiveReason) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringSignalArchiveReason) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringSignalArchiveReason initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringSignalArchiveReason(val *SecurityMonitoringSignalArchiveReason) *NullableSecurityMonitoringSignalArchiveReason { + return &NullableSecurityMonitoringSignalArchiveReason{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringSignalArchiveReason) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringSignalArchiveReason) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go b/api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go new file mode 100644 index 00000000000..eaba84d7dbf --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_assignee_update_attributes.go @@ -0,0 +1,149 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalAssigneeUpdateAttributes Attributes describing the new assignee of a security signal. +type SecurityMonitoringSignalAssigneeUpdateAttributes struct { + // Object representing a given user entity. + Assignee SecurityMonitoringTriageUser `json:"assignee"` + // Version of the updated signal. If server side version is higher, update will be rejected. + Version *int64 `json:"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{} +} + +// NewSecurityMonitoringSignalAssigneeUpdateAttributes instantiates a new SecurityMonitoringSignalAssigneeUpdateAttributes 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 NewSecurityMonitoringSignalAssigneeUpdateAttributes(assignee SecurityMonitoringTriageUser) *SecurityMonitoringSignalAssigneeUpdateAttributes { + this := SecurityMonitoringSignalAssigneeUpdateAttributes{} + this.Assignee = assignee + return &this +} + +// NewSecurityMonitoringSignalAssigneeUpdateAttributesWithDefaults instantiates a new SecurityMonitoringSignalAssigneeUpdateAttributes 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 NewSecurityMonitoringSignalAssigneeUpdateAttributesWithDefaults() *SecurityMonitoringSignalAssigneeUpdateAttributes { + this := SecurityMonitoringSignalAssigneeUpdateAttributes{} + return &this +} + +// GetAssignee returns the Assignee field value. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetAssignee() SecurityMonitoringTriageUser { + if o == nil { + var ret SecurityMonitoringTriageUser + return ret + } + return o.Assignee +} + +// GetAssigneeOk returns a tuple with the Assignee field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetAssigneeOk() (*SecurityMonitoringTriageUser, bool) { + if o == nil { + return nil, false + } + return &o.Assignee, true +} + +// SetAssignee sets field value. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) SetAssignee(v SecurityMonitoringTriageUser) { + o.Assignee = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalAssigneeUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["assignee"] = o.Assignee + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Assignee *SecurityMonitoringTriageUser `json:"assignee"` + }{} + all := struct { + Assignee SecurityMonitoringTriageUser `json:"assignee"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Assignee == nil { + return fmt.Errorf("Required field assignee missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Assignee = all.Assignee + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_assignee_update_data.go b/api/v2/datadog/model_security_monitoring_signal_assignee_update_data.go new file mode 100644 index 00000000000..ffa4bfb38f6 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_assignee_update_data.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalAssigneeUpdateData Data containing the patch for changing the assignee of a signal. +type SecurityMonitoringSignalAssigneeUpdateData struct { + // Attributes describing the new assignee of a security signal. + Attributes SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` + // 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{} +} + +// NewSecurityMonitoringSignalAssigneeUpdateData instantiates a new SecurityMonitoringSignalAssigneeUpdateData 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 NewSecurityMonitoringSignalAssigneeUpdateData(attributes SecurityMonitoringSignalAssigneeUpdateAttributes) *SecurityMonitoringSignalAssigneeUpdateData { + this := SecurityMonitoringSignalAssigneeUpdateData{} + this.Attributes = attributes + return &this +} + +// NewSecurityMonitoringSignalAssigneeUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalAssigneeUpdateData 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 NewSecurityMonitoringSignalAssigneeUpdateDataWithDefaults() *SecurityMonitoringSignalAssigneeUpdateData { + this := SecurityMonitoringSignalAssigneeUpdateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityMonitoringSignalAssigneeUpdateData) GetAttributes() SecurityMonitoringSignalAssigneeUpdateAttributes { + if o == nil { + var ret SecurityMonitoringSignalAssigneeUpdateAttributes + 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 *SecurityMonitoringSignalAssigneeUpdateData) GetAttributesOk() (*SecurityMonitoringSignalAssigneeUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityMonitoringSignalAssigneeUpdateData) SetAttributes(v SecurityMonitoringSignalAssigneeUpdateAttributes) { + o.Attributes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalAssigneeUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalAssigneeUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` + }{} + all := struct { + Attributes SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_assignee_update_request.go b/api/v2/datadog/model_security_monitoring_signal_assignee_update_request.go new file mode 100644 index 00000000000..3e57cd71347 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_assignee_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalAssigneeUpdateRequest Request body for changing the assignee of a given security monitoring signal. +type SecurityMonitoringSignalAssigneeUpdateRequest struct { + // Data containing the patch for changing the assignee of a signal. + Data SecurityMonitoringSignalAssigneeUpdateData `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{} +} + +// NewSecurityMonitoringSignalAssigneeUpdateRequest instantiates a new SecurityMonitoringSignalAssigneeUpdateRequest 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 NewSecurityMonitoringSignalAssigneeUpdateRequest(data SecurityMonitoringSignalAssigneeUpdateData) *SecurityMonitoringSignalAssigneeUpdateRequest { + this := SecurityMonitoringSignalAssigneeUpdateRequest{} + this.Data = data + return &this +} + +// NewSecurityMonitoringSignalAssigneeUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalAssigneeUpdateRequest 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 NewSecurityMonitoringSignalAssigneeUpdateRequestWithDefaults() *SecurityMonitoringSignalAssigneeUpdateRequest { + this := SecurityMonitoringSignalAssigneeUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityMonitoringSignalAssigneeUpdateRequest) GetData() SecurityMonitoringSignalAssigneeUpdateData { + if o == nil { + var ret SecurityMonitoringSignalAssigneeUpdateData + 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 *SecurityMonitoringSignalAssigneeUpdateRequest) GetDataOk() (*SecurityMonitoringSignalAssigneeUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityMonitoringSignalAssigneeUpdateRequest) SetData(v SecurityMonitoringSignalAssigneeUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalAssigneeUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *SecurityMonitoringSignalAssigneeUpdateData `json:"data"` + }{} + all := struct { + Data SecurityMonitoringSignalAssigneeUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_attributes.go b/api/v2/datadog/model_security_monitoring_signal_attributes.go new file mode 100644 index 00000000000..042368fd30f --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_attributes.go @@ -0,0 +1,225 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// SecurityMonitoringSignalAttributes The object containing all signal attributes and their +// associated values. +type SecurityMonitoringSignalAttributes struct { + // A JSON object of attributes in the security signal. + Attributes map[string]interface{} `json:"attributes,omitempty"` + // The message in the security signal defined by the rule that generated the signal. + Message *string `json:"message,omitempty"` + // An array of tags associated with the security signal. + Tags []string `json:"tags,omitempty"` + // The timestamp of the security signal. + Timestamp *time.Time `json:"timestamp,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{} +} + +// NewSecurityMonitoringSignalAttributes instantiates a new SecurityMonitoringSignalAttributes 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 NewSecurityMonitoringSignalAttributes() *SecurityMonitoringSignalAttributes { + this := SecurityMonitoringSignalAttributes{} + return &this +} + +// NewSecurityMonitoringSignalAttributesWithDefaults instantiates a new SecurityMonitoringSignalAttributes 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 NewSecurityMonitoringSignalAttributesWithDefaults() *SecurityMonitoringSignalAttributes { + this := SecurityMonitoringSignalAttributes{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalAttributes) GetAttributes() map[string]interface{} { + if o == nil || o.Attributes == nil { + var ret map[string]interface{} + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalAttributes) GetAttributesOk() (*map[string]interface{}, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalAttributes) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. +func (o *SecurityMonitoringSignalAttributes) SetAttributes(v map[string]interface{}) { + o.Attributes = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalAttributes) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalAttributes) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalAttributes) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SecurityMonitoringSignalAttributes) SetMessage(v string) { + o.Message = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalAttributes) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []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 *SecurityMonitoringSignalAttributes) GetTagsOk() (*[]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 *SecurityMonitoringSignalAttributes) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SecurityMonitoringSignalAttributes) SetTags(v []string) { + o.Tags = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalAttributes) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalAttributes) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalAttributes) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *SecurityMonitoringSignalAttributes) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes map[string]interface{} `json:"attributes,omitempty"` + Message *string `json:"message,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Attributes = all.Attributes + o.Message = all.Message + o.Tags = all.Tags + o.Timestamp = all.Timestamp + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go b/api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go new file mode 100644 index 00000000000..fa04ae23fb3 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_incidents_update_attributes.go @@ -0,0 +1,142 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalIncidentsUpdateAttributes Attributes describing the new list of related signals for a security signal. +type SecurityMonitoringSignalIncidentsUpdateAttributes struct { + // Array of incidents that are associated with this signal. + IncidentIds []int64 `json:"incident_ids"` + // Version of the updated signal. If server side version is higher, update will be rejected. + Version *int64 `json:"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{} +} + +// NewSecurityMonitoringSignalIncidentsUpdateAttributes instantiates a new SecurityMonitoringSignalIncidentsUpdateAttributes 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 NewSecurityMonitoringSignalIncidentsUpdateAttributes(incidentIds []int64) *SecurityMonitoringSignalIncidentsUpdateAttributes { + this := SecurityMonitoringSignalIncidentsUpdateAttributes{} + this.IncidentIds = incidentIds + return &this +} + +// NewSecurityMonitoringSignalIncidentsUpdateAttributesWithDefaults instantiates a new SecurityMonitoringSignalIncidentsUpdateAttributes 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 NewSecurityMonitoringSignalIncidentsUpdateAttributesWithDefaults() *SecurityMonitoringSignalIncidentsUpdateAttributes { + this := SecurityMonitoringSignalIncidentsUpdateAttributes{} + return &this +} + +// GetIncidentIds returns the IncidentIds field value. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetIncidentIds() []int64 { + if o == nil { + var ret []int64 + return ret + } + return o.IncidentIds +} + +// GetIncidentIdsOk returns a tuple with the IncidentIds field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetIncidentIdsOk() (*[]int64, bool) { + if o == nil { + return nil, false + } + return &o.IncidentIds, true +} + +// SetIncidentIds sets field value. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) SetIncidentIds(v []int64) { + o.IncidentIds = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalIncidentsUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["incident_ids"] = o.IncidentIds + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + IncidentIds *[]int64 `json:"incident_ids"` + }{} + all := struct { + IncidentIds []int64 `json:"incident_ids"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.IncidentIds == nil { + return fmt.Errorf("Required field incident_ids missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.IncidentIds = all.IncidentIds + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_incidents_update_data.go b/api/v2/datadog/model_security_monitoring_signal_incidents_update_data.go new file mode 100644 index 00000000000..e6c8fb855a0 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_incidents_update_data.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalIncidentsUpdateData Data containing the patch for changing the related incidents of a signal. +type SecurityMonitoringSignalIncidentsUpdateData struct { + // Attributes describing the new list of related signals for a security signal. + Attributes SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` + // 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{} +} + +// NewSecurityMonitoringSignalIncidentsUpdateData instantiates a new SecurityMonitoringSignalIncidentsUpdateData 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 NewSecurityMonitoringSignalIncidentsUpdateData(attributes SecurityMonitoringSignalIncidentsUpdateAttributes) *SecurityMonitoringSignalIncidentsUpdateData { + this := SecurityMonitoringSignalIncidentsUpdateData{} + this.Attributes = attributes + return &this +} + +// NewSecurityMonitoringSignalIncidentsUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalIncidentsUpdateData 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 NewSecurityMonitoringSignalIncidentsUpdateDataWithDefaults() *SecurityMonitoringSignalIncidentsUpdateData { + this := SecurityMonitoringSignalIncidentsUpdateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityMonitoringSignalIncidentsUpdateData) GetAttributes() SecurityMonitoringSignalIncidentsUpdateAttributes { + if o == nil { + var ret SecurityMonitoringSignalIncidentsUpdateAttributes + 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 *SecurityMonitoringSignalIncidentsUpdateData) GetAttributesOk() (*SecurityMonitoringSignalIncidentsUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityMonitoringSignalIncidentsUpdateData) SetAttributes(v SecurityMonitoringSignalIncidentsUpdateAttributes) { + o.Attributes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalIncidentsUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalIncidentsUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` + }{} + all := struct { + Attributes SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_incidents_update_request.go b/api/v2/datadog/model_security_monitoring_signal_incidents_update_request.go new file mode 100644 index 00000000000..e21b9b62971 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_incidents_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalIncidentsUpdateRequest Request body for changing the related incidents of a given security monitoring signal. +type SecurityMonitoringSignalIncidentsUpdateRequest struct { + // Data containing the patch for changing the related incidents of a signal. + Data SecurityMonitoringSignalIncidentsUpdateData `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{} +} + +// NewSecurityMonitoringSignalIncidentsUpdateRequest instantiates a new SecurityMonitoringSignalIncidentsUpdateRequest 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 NewSecurityMonitoringSignalIncidentsUpdateRequest(data SecurityMonitoringSignalIncidentsUpdateData) *SecurityMonitoringSignalIncidentsUpdateRequest { + this := SecurityMonitoringSignalIncidentsUpdateRequest{} + this.Data = data + return &this +} + +// NewSecurityMonitoringSignalIncidentsUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalIncidentsUpdateRequest 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 NewSecurityMonitoringSignalIncidentsUpdateRequestWithDefaults() *SecurityMonitoringSignalIncidentsUpdateRequest { + this := SecurityMonitoringSignalIncidentsUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityMonitoringSignalIncidentsUpdateRequest) GetData() SecurityMonitoringSignalIncidentsUpdateData { + if o == nil { + var ret SecurityMonitoringSignalIncidentsUpdateData + 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 *SecurityMonitoringSignalIncidentsUpdateRequest) GetDataOk() (*SecurityMonitoringSignalIncidentsUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityMonitoringSignalIncidentsUpdateRequest) SetData(v SecurityMonitoringSignalIncidentsUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalIncidentsUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalIncidentsUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *SecurityMonitoringSignalIncidentsUpdateData `json:"data"` + }{} + all := struct { + Data SecurityMonitoringSignalIncidentsUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_list_request.go b/api/v2/datadog/model_security_monitoring_signal_list_request.go new file mode 100644 index 00000000000..544b7c68701 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_list_request.go @@ -0,0 +1,202 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignalListRequest The request for a security signal list. +type SecurityMonitoringSignalListRequest struct { + // Search filters for listing security signals. + Filter *SecurityMonitoringSignalListRequestFilter `json:"filter,omitempty"` + // The paging attributes for listing security signals. + Page *SecurityMonitoringSignalListRequestPage `json:"page,omitempty"` + // The sort parameters used for querying security signals. + Sort *SecurityMonitoringSignalsSort `json:"sort,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{} +} + +// NewSecurityMonitoringSignalListRequest instantiates a new SecurityMonitoringSignalListRequest 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 NewSecurityMonitoringSignalListRequest() *SecurityMonitoringSignalListRequest { + this := SecurityMonitoringSignalListRequest{} + return &this +} + +// NewSecurityMonitoringSignalListRequestWithDefaults instantiates a new SecurityMonitoringSignalListRequest 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 NewSecurityMonitoringSignalListRequestWithDefaults() *SecurityMonitoringSignalListRequest { + this := SecurityMonitoringSignalListRequest{} + return &this +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequest) GetFilter() SecurityMonitoringSignalListRequestFilter { + if o == nil || o.Filter == nil { + var ret SecurityMonitoringSignalListRequestFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequest) GetFilterOk() (*SecurityMonitoringSignalListRequestFilter, bool) { + if o == nil || o.Filter == nil { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequest) HasFilter() bool { + if o != nil && o.Filter != nil { + return true + } + + return false +} + +// SetFilter gets a reference to the given SecurityMonitoringSignalListRequestFilter and assigns it to the Filter field. +func (o *SecurityMonitoringSignalListRequest) SetFilter(v SecurityMonitoringSignalListRequestFilter) { + o.Filter = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequest) GetPage() SecurityMonitoringSignalListRequestPage { + if o == nil || o.Page == nil { + var ret SecurityMonitoringSignalListRequestPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequest) GetPageOk() (*SecurityMonitoringSignalListRequestPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequest) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given SecurityMonitoringSignalListRequestPage and assigns it to the Page field. +func (o *SecurityMonitoringSignalListRequest) SetPage(v SecurityMonitoringSignalListRequestPage) { + o.Page = &v +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequest) GetSort() SecurityMonitoringSignalsSort { + if o == nil || o.Sort == nil { + var ret SecurityMonitoringSignalsSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequest) GetSortOk() (*SecurityMonitoringSignalsSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequest) HasSort() bool { + if o != nil && o.Sort != nil { + return true + } + + return false +} + +// SetSort gets a reference to the given SecurityMonitoringSignalsSort and assigns it to the Sort field. +func (o *SecurityMonitoringSignalListRequest) SetSort(v SecurityMonitoringSignalsSort) { + o.Sort = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalListRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Filter != nil { + toSerialize["filter"] = o.Filter + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalListRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Filter *SecurityMonitoringSignalListRequestFilter `json:"filter,omitempty"` + Page *SecurityMonitoringSignalListRequestPage `json:"page,omitempty"` + Sort *SecurityMonitoringSignalsSort `json:"sort,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Sort; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Filter = all.Filter + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + o.Sort = all.Sort + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_list_request_filter.go b/api/v2/datadog/model_security_monitoring_signal_list_request_filter.go new file mode 100644 index 00000000000..766e3928b52 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_list_request_filter.go @@ -0,0 +1,189 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// SecurityMonitoringSignalListRequestFilter Search filters for listing security signals. +type SecurityMonitoringSignalListRequestFilter struct { + // The minimum timestamp for requested security signals. + From *time.Time `json:"from,omitempty"` + // Search query for listing security signals. + Query *string `json:"query,omitempty"` + // The maximum timestamp for requested security signals. + To *time.Time `json:"to,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{} +} + +// NewSecurityMonitoringSignalListRequestFilter instantiates a new SecurityMonitoringSignalListRequestFilter 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 NewSecurityMonitoringSignalListRequestFilter() *SecurityMonitoringSignalListRequestFilter { + this := SecurityMonitoringSignalListRequestFilter{} + return &this +} + +// NewSecurityMonitoringSignalListRequestFilterWithDefaults instantiates a new SecurityMonitoringSignalListRequestFilter 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 NewSecurityMonitoringSignalListRequestFilterWithDefaults() *SecurityMonitoringSignalListRequestFilter { + this := SecurityMonitoringSignalListRequestFilter{} + return &this +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequestFilter) GetFrom() time.Time { + if o == nil || o.From == nil { + var ret time.Time + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequestFilter) GetFromOk() (*time.Time, bool) { + if o == nil || o.From == nil { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequestFilter) HasFrom() bool { + if o != nil && o.From != nil { + return true + } + + return false +} + +// SetFrom gets a reference to the given time.Time and assigns it to the From field. +func (o *SecurityMonitoringSignalListRequestFilter) SetFrom(v time.Time) { + o.From = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequestFilter) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequestFilter) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequestFilter) HasQuery() bool { + if o != nil && o.Query != nil { + return true + } + + return false +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *SecurityMonitoringSignalListRequestFilter) SetQuery(v string) { + o.Query = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequestFilter) GetTo() time.Time { + if o == nil || o.To == nil { + var ret time.Time + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequestFilter) GetToOk() (*time.Time, bool) { + if o == nil || o.To == nil { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequestFilter) HasTo() bool { + if o != nil && o.To != nil { + return true + } + + return false +} + +// SetTo gets a reference to the given time.Time and assigns it to the To field. +func (o *SecurityMonitoringSignalListRequestFilter) SetTo(v time.Time) { + o.To = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalListRequestFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.From != nil { + if o.From.Nanosecond() == 0 { + toSerialize["from"] = o.From.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["from"] = o.From.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.To != nil { + if o.To.Nanosecond() == 0 { + toSerialize["to"] = o.To.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["to"] = o.To.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalListRequestFilter) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + From *time.Time `json:"from,omitempty"` + Query *string `json:"query,omitempty"` + To *time.Time `json:"to,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.From = all.From + o.Query = all.Query + o.To = all.To + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_list_request_page.go b/api/v2/datadog/model_security_monitoring_signal_list_request_page.go new file mode 100644 index 00000000000..befb257bdb3 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_list_request_page.go @@ -0,0 +1,145 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignalListRequestPage The paging attributes for listing security signals. +type SecurityMonitoringSignalListRequestPage struct { + // A list of results using the cursor provided in the previous query. + Cursor *string `json:"cursor,omitempty"` + // The maximum number of security signals in the response. + Limit *int32 `json:"limit,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{} +} + +// NewSecurityMonitoringSignalListRequestPage instantiates a new SecurityMonitoringSignalListRequestPage 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 NewSecurityMonitoringSignalListRequestPage() *SecurityMonitoringSignalListRequestPage { + this := SecurityMonitoringSignalListRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// NewSecurityMonitoringSignalListRequestPageWithDefaults instantiates a new SecurityMonitoringSignalListRequestPage 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 NewSecurityMonitoringSignalListRequestPageWithDefaults() *SecurityMonitoringSignalListRequestPage { + this := SecurityMonitoringSignalListRequestPage{} + var limit int32 = 10 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequestPage) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequestPage) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequestPage) HasCursor() bool { + if o != nil && o.Cursor != nil { + return true + } + + return false +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *SecurityMonitoringSignalListRequestPage) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalListRequestPage) GetLimit() int32 { + if o == nil || o.Limit == nil { + var ret int32 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalListRequestPage) GetLimitOk() (*int32, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalListRequestPage) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// SetLimit gets a reference to the given int32 and assigns it to the Limit field. +func (o *SecurityMonitoringSignalListRequestPage) SetLimit(v int32) { + o.Limit = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalListRequestPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalListRequestPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int32 `json:"limit,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Cursor = all.Cursor + o.Limit = all.Limit + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_state.go b/api/v2/datadog/model_security_monitoring_signal_state.go new file mode 100644 index 00000000000..223f4d7ec9f --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_state.go @@ -0,0 +1,111 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalState The new triage state of the signal. +type SecurityMonitoringSignalState string + +// List of SecurityMonitoringSignalState. +const ( + SECURITYMONITORINGSIGNALSTATE_OPEN SecurityMonitoringSignalState = "open" + SECURITYMONITORINGSIGNALSTATE_ARCHIVED SecurityMonitoringSignalState = "archived" + SECURITYMONITORINGSIGNALSTATE_UNDER_REVIEW SecurityMonitoringSignalState = "under_review" +) + +var allowedSecurityMonitoringSignalStateEnumValues = []SecurityMonitoringSignalState{ + SECURITYMONITORINGSIGNALSTATE_OPEN, + SECURITYMONITORINGSIGNALSTATE_ARCHIVED, + SECURITYMONITORINGSIGNALSTATE_UNDER_REVIEW, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringSignalState) GetAllowedValues() []SecurityMonitoringSignalState { + return allowedSecurityMonitoringSignalStateEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringSignalState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringSignalState(value) + return nil +} + +// NewSecurityMonitoringSignalStateFromValue returns a pointer to a valid SecurityMonitoringSignalState +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringSignalStateFromValue(v string) (*SecurityMonitoringSignalState, error) { + ev := SecurityMonitoringSignalState(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalState: valid values are %v", v, allowedSecurityMonitoringSignalStateEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringSignalState) IsValid() bool { + for _, existing := range allowedSecurityMonitoringSignalStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringSignalState value. +func (v SecurityMonitoringSignalState) Ptr() *SecurityMonitoringSignalState { + return &v +} + +// NullableSecurityMonitoringSignalState handles when a null is used for SecurityMonitoringSignalState. +type NullableSecurityMonitoringSignalState struct { + value *SecurityMonitoringSignalState + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringSignalState) Get() *SecurityMonitoringSignalState { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringSignalState) Set(val *SecurityMonitoringSignalState) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringSignalState) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringSignalState) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringSignalState initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringSignalState(val *SecurityMonitoringSignalState) *NullableSecurityMonitoringSignalState { + return &NullableSecurityMonitoringSignalState{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringSignalState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringSignalState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go b/api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go new file mode 100644 index 00000000000..94a332aa3fb --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_state_update_attributes.go @@ -0,0 +1,236 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalStateUpdateAttributes Attributes describing the change of state of a security signal. +type SecurityMonitoringSignalStateUpdateAttributes struct { + // Optional comment to display on archived signals. + ArchiveComment *string `json:"archive_comment,omitempty"` + // Reason a signal is archived. + ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` + // The new triage state of the signal. + State SecurityMonitoringSignalState `json:"state"` + // Version of the updated signal. If server side version is higher, update will be rejected. + Version *int64 `json:"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{} +} + +// NewSecurityMonitoringSignalStateUpdateAttributes instantiates a new SecurityMonitoringSignalStateUpdateAttributes 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 NewSecurityMonitoringSignalStateUpdateAttributes(state SecurityMonitoringSignalState) *SecurityMonitoringSignalStateUpdateAttributes { + this := SecurityMonitoringSignalStateUpdateAttributes{} + this.State = state + return &this +} + +// NewSecurityMonitoringSignalStateUpdateAttributesWithDefaults instantiates a new SecurityMonitoringSignalStateUpdateAttributes 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 NewSecurityMonitoringSignalStateUpdateAttributesWithDefaults() *SecurityMonitoringSignalStateUpdateAttributes { + this := SecurityMonitoringSignalStateUpdateAttributes{} + return &this +} + +// GetArchiveComment returns the ArchiveComment field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveComment() string { + if o == nil || o.ArchiveComment == nil { + var ret string + return ret + } + return *o.ArchiveComment +} + +// GetArchiveCommentOk returns a tuple with the ArchiveComment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveCommentOk() (*string, bool) { + if o == nil || o.ArchiveComment == nil { + return nil, false + } + return o.ArchiveComment, true +} + +// HasArchiveComment returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalStateUpdateAttributes) HasArchiveComment() bool { + if o != nil && o.ArchiveComment != nil { + return true + } + + return false +} + +// SetArchiveComment gets a reference to the given string and assigns it to the ArchiveComment field. +func (o *SecurityMonitoringSignalStateUpdateAttributes) SetArchiveComment(v string) { + o.ArchiveComment = &v +} + +// GetArchiveReason returns the ArchiveReason field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveReason() SecurityMonitoringSignalArchiveReason { + if o == nil || o.ArchiveReason == nil { + var ret SecurityMonitoringSignalArchiveReason + return ret + } + return *o.ArchiveReason +} + +// GetArchiveReasonOk returns a tuple with the ArchiveReason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetArchiveReasonOk() (*SecurityMonitoringSignalArchiveReason, bool) { + if o == nil || o.ArchiveReason == nil { + return nil, false + } + return o.ArchiveReason, true +} + +// HasArchiveReason returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalStateUpdateAttributes) HasArchiveReason() bool { + if o != nil && o.ArchiveReason != nil { + return true + } + + return false +} + +// SetArchiveReason gets a reference to the given SecurityMonitoringSignalArchiveReason and assigns it to the ArchiveReason field. +func (o *SecurityMonitoringSignalStateUpdateAttributes) SetArchiveReason(v SecurityMonitoringSignalArchiveReason) { + o.ArchiveReason = &v +} + +// GetState returns the State field value. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetState() SecurityMonitoringSignalState { + if o == nil { + var ret SecurityMonitoringSignalState + return ret + } + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetStateOk() (*SecurityMonitoringSignalState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value. +func (o *SecurityMonitoringSignalStateUpdateAttributes) SetState(v SecurityMonitoringSignalState) { + o.State = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalStateUpdateAttributes) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalStateUpdateAttributes) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SecurityMonitoringSignalStateUpdateAttributes) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalStateUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ArchiveComment != nil { + toSerialize["archive_comment"] = o.ArchiveComment + } + if o.ArchiveReason != nil { + toSerialize["archive_reason"] = o.ArchiveReason + } + toSerialize["state"] = o.State + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + State *SecurityMonitoringSignalState `json:"state"` + }{} + all := struct { + ArchiveComment *string `json:"archive_comment,omitempty"` + ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` + State SecurityMonitoringSignalState `json:"state"` + Version *int64 `json:"version,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.State == nil { + return fmt.Errorf("Required field state missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ArchiveReason; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.State; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ArchiveComment = all.ArchiveComment + o.ArchiveReason = all.ArchiveReason + o.State = all.State + o.Version = all.Version + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_state_update_data.go b/api/v2/datadog/model_security_monitoring_signal_state_update_data.go new file mode 100644 index 00000000000..c947aefcbf2 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_state_update_data.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalStateUpdateData Data containing the patch for changing the state of a signal. +type SecurityMonitoringSignalStateUpdateData struct { + // Attributes describing the change of state of a security signal. + Attributes SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` + // 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{} +} + +// NewSecurityMonitoringSignalStateUpdateData instantiates a new SecurityMonitoringSignalStateUpdateData 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 NewSecurityMonitoringSignalStateUpdateData(attributes SecurityMonitoringSignalStateUpdateAttributes) *SecurityMonitoringSignalStateUpdateData { + this := SecurityMonitoringSignalStateUpdateData{} + this.Attributes = attributes + return &this +} + +// NewSecurityMonitoringSignalStateUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalStateUpdateData 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 NewSecurityMonitoringSignalStateUpdateDataWithDefaults() *SecurityMonitoringSignalStateUpdateData { + this := SecurityMonitoringSignalStateUpdateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityMonitoringSignalStateUpdateData) GetAttributes() SecurityMonitoringSignalStateUpdateAttributes { + if o == nil { + var ret SecurityMonitoringSignalStateUpdateAttributes + 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 *SecurityMonitoringSignalStateUpdateData) GetAttributesOk() (*SecurityMonitoringSignalStateUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityMonitoringSignalStateUpdateData) SetAttributes(v SecurityMonitoringSignalStateUpdateAttributes) { + o.Attributes = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalStateUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalStateUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` + }{} + all := struct { + Attributes SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_state_update_request.go b/api/v2/datadog/model_security_monitoring_signal_state_update_request.go new file mode 100644 index 00000000000..21f52323600 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_state_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalStateUpdateRequest Request body for changing the state of a given security monitoring signal. +type SecurityMonitoringSignalStateUpdateRequest struct { + // Data containing the patch for changing the state of a signal. + Data SecurityMonitoringSignalStateUpdateData `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{} +} + +// NewSecurityMonitoringSignalStateUpdateRequest instantiates a new SecurityMonitoringSignalStateUpdateRequest 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 NewSecurityMonitoringSignalStateUpdateRequest(data SecurityMonitoringSignalStateUpdateData) *SecurityMonitoringSignalStateUpdateRequest { + this := SecurityMonitoringSignalStateUpdateRequest{} + this.Data = data + return &this +} + +// NewSecurityMonitoringSignalStateUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalStateUpdateRequest 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 NewSecurityMonitoringSignalStateUpdateRequestWithDefaults() *SecurityMonitoringSignalStateUpdateRequest { + this := SecurityMonitoringSignalStateUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityMonitoringSignalStateUpdateRequest) GetData() SecurityMonitoringSignalStateUpdateData { + if o == nil { + var ret SecurityMonitoringSignalStateUpdateData + 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 *SecurityMonitoringSignalStateUpdateRequest) GetDataOk() (*SecurityMonitoringSignalStateUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityMonitoringSignalStateUpdateRequest) SetData(v SecurityMonitoringSignalStateUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalStateUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *SecurityMonitoringSignalStateUpdateData `json:"data"` + }{} + all := struct { + Data SecurityMonitoringSignalStateUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_triage_attributes.go b/api/v2/datadog/model_security_monitoring_signal_triage_attributes.go new file mode 100644 index 00000000000..8bc311e0e8a --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_triage_attributes.go @@ -0,0 +1,440 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalTriageAttributes Attributes describing a triage state update operation over a security signal. +type SecurityMonitoringSignalTriageAttributes struct { + // Optional comment to display on archived signals. + ArchiveComment *string `json:"archive_comment,omitempty"` + // Timestamp of the last edit to the comment. + ArchiveCommentTimestamp *int64 `json:"archive_comment_timestamp,omitempty"` + // Object representing a given user entity. + ArchiveCommentUser *SecurityMonitoringTriageUser `json:"archive_comment_user,omitempty"` + // Reason a signal is archived. + ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` + // Object representing a given user entity. + Assignee SecurityMonitoringTriageUser `json:"assignee"` + // Array of incidents that are associated with this signal. + IncidentIds []int64 `json:"incident_ids"` + // The new triage state of the signal. + State SecurityMonitoringSignalState `json:"state"` + // Timestamp of the last update to the signal state. + StateUpdateTimestamp *int64 `json:"state_update_timestamp,omitempty"` + // Object representing a given user entity. + StateUpdateUser *SecurityMonitoringTriageUser `json:"state_update_user,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{} +} + +// NewSecurityMonitoringSignalTriageAttributes instantiates a new SecurityMonitoringSignalTriageAttributes 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 NewSecurityMonitoringSignalTriageAttributes(assignee SecurityMonitoringTriageUser, incidentIds []int64, state SecurityMonitoringSignalState) *SecurityMonitoringSignalTriageAttributes { + this := SecurityMonitoringSignalTriageAttributes{} + this.Assignee = assignee + this.IncidentIds = incidentIds + this.State = state + return &this +} + +// NewSecurityMonitoringSignalTriageAttributesWithDefaults instantiates a new SecurityMonitoringSignalTriageAttributes 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 NewSecurityMonitoringSignalTriageAttributesWithDefaults() *SecurityMonitoringSignalTriageAttributes { + this := SecurityMonitoringSignalTriageAttributes{} + return &this +} + +// GetArchiveComment returns the ArchiveComment field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveComment() string { + if o == nil || o.ArchiveComment == nil { + var ret string + return ret + } + return *o.ArchiveComment +} + +// GetArchiveCommentOk returns a tuple with the ArchiveComment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentOk() (*string, bool) { + if o == nil || o.ArchiveComment == nil { + return nil, false + } + return o.ArchiveComment, true +} + +// HasArchiveComment returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveComment() bool { + if o != nil && o.ArchiveComment != nil { + return true + } + + return false +} + +// SetArchiveComment gets a reference to the given string and assigns it to the ArchiveComment field. +func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveComment(v string) { + o.ArchiveComment = &v +} + +// GetArchiveCommentTimestamp returns the ArchiveCommentTimestamp field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentTimestamp() int64 { + if o == nil || o.ArchiveCommentTimestamp == nil { + var ret int64 + return ret + } + return *o.ArchiveCommentTimestamp +} + +// GetArchiveCommentTimestampOk returns a tuple with the ArchiveCommentTimestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentTimestampOk() (*int64, bool) { + if o == nil || o.ArchiveCommentTimestamp == nil { + return nil, false + } + return o.ArchiveCommentTimestamp, true +} + +// HasArchiveCommentTimestamp returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveCommentTimestamp() bool { + if o != nil && o.ArchiveCommentTimestamp != nil { + return true + } + + return false +} + +// SetArchiveCommentTimestamp gets a reference to the given int64 and assigns it to the ArchiveCommentTimestamp field. +func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveCommentTimestamp(v int64) { + o.ArchiveCommentTimestamp = &v +} + +// GetArchiveCommentUser returns the ArchiveCommentUser field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentUser() SecurityMonitoringTriageUser { + if o == nil || o.ArchiveCommentUser == nil { + var ret SecurityMonitoringTriageUser + return ret + } + return *o.ArchiveCommentUser +} + +// GetArchiveCommentUserOk returns a tuple with the ArchiveCommentUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveCommentUserOk() (*SecurityMonitoringTriageUser, bool) { + if o == nil || o.ArchiveCommentUser == nil { + return nil, false + } + return o.ArchiveCommentUser, true +} + +// HasArchiveCommentUser returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveCommentUser() bool { + if o != nil && o.ArchiveCommentUser != nil { + return true + } + + return false +} + +// SetArchiveCommentUser gets a reference to the given SecurityMonitoringTriageUser and assigns it to the ArchiveCommentUser field. +func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveCommentUser(v SecurityMonitoringTriageUser) { + o.ArchiveCommentUser = &v +} + +// GetArchiveReason returns the ArchiveReason field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveReason() SecurityMonitoringSignalArchiveReason { + if o == nil || o.ArchiveReason == nil { + var ret SecurityMonitoringSignalArchiveReason + return ret + } + return *o.ArchiveReason +} + +// GetArchiveReasonOk returns a tuple with the ArchiveReason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetArchiveReasonOk() (*SecurityMonitoringSignalArchiveReason, bool) { + if o == nil || o.ArchiveReason == nil { + return nil, false + } + return o.ArchiveReason, true +} + +// HasArchiveReason returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageAttributes) HasArchiveReason() bool { + if o != nil && o.ArchiveReason != nil { + return true + } + + return false +} + +// SetArchiveReason gets a reference to the given SecurityMonitoringSignalArchiveReason and assigns it to the ArchiveReason field. +func (o *SecurityMonitoringSignalTriageAttributes) SetArchiveReason(v SecurityMonitoringSignalArchiveReason) { + o.ArchiveReason = &v +} + +// GetAssignee returns the Assignee field value. +func (o *SecurityMonitoringSignalTriageAttributes) GetAssignee() SecurityMonitoringTriageUser { + if o == nil { + var ret SecurityMonitoringTriageUser + return ret + } + return o.Assignee +} + +// GetAssigneeOk returns a tuple with the Assignee field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetAssigneeOk() (*SecurityMonitoringTriageUser, bool) { + if o == nil { + return nil, false + } + return &o.Assignee, true +} + +// SetAssignee sets field value. +func (o *SecurityMonitoringSignalTriageAttributes) SetAssignee(v SecurityMonitoringTriageUser) { + o.Assignee = v +} + +// GetIncidentIds returns the IncidentIds field value. +func (o *SecurityMonitoringSignalTriageAttributes) GetIncidentIds() []int64 { + if o == nil { + var ret []int64 + return ret + } + return o.IncidentIds +} + +// GetIncidentIdsOk returns a tuple with the IncidentIds field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetIncidentIdsOk() (*[]int64, bool) { + if o == nil { + return nil, false + } + return &o.IncidentIds, true +} + +// SetIncidentIds sets field value. +func (o *SecurityMonitoringSignalTriageAttributes) SetIncidentIds(v []int64) { + o.IncidentIds = v +} + +// GetState returns the State field value. +func (o *SecurityMonitoringSignalTriageAttributes) GetState() SecurityMonitoringSignalState { + if o == nil { + var ret SecurityMonitoringSignalState + return ret + } + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetStateOk() (*SecurityMonitoringSignalState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value. +func (o *SecurityMonitoringSignalTriageAttributes) SetState(v SecurityMonitoringSignalState) { + o.State = v +} + +// GetStateUpdateTimestamp returns the StateUpdateTimestamp field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateTimestamp() int64 { + if o == nil || o.StateUpdateTimestamp == nil { + var ret int64 + return ret + } + return *o.StateUpdateTimestamp +} + +// GetStateUpdateTimestampOk returns a tuple with the StateUpdateTimestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateTimestampOk() (*int64, bool) { + if o == nil || o.StateUpdateTimestamp == nil { + return nil, false + } + return o.StateUpdateTimestamp, true +} + +// HasStateUpdateTimestamp returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageAttributes) HasStateUpdateTimestamp() bool { + if o != nil && o.StateUpdateTimestamp != nil { + return true + } + + return false +} + +// SetStateUpdateTimestamp gets a reference to the given int64 and assigns it to the StateUpdateTimestamp field. +func (o *SecurityMonitoringSignalTriageAttributes) SetStateUpdateTimestamp(v int64) { + o.StateUpdateTimestamp = &v +} + +// GetStateUpdateUser returns the StateUpdateUser field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateUser() SecurityMonitoringTriageUser { + if o == nil || o.StateUpdateUser == nil { + var ret SecurityMonitoringTriageUser + return ret + } + return *o.StateUpdateUser +} + +// GetStateUpdateUserOk returns a tuple with the StateUpdateUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageAttributes) GetStateUpdateUserOk() (*SecurityMonitoringTriageUser, bool) { + if o == nil || o.StateUpdateUser == nil { + return nil, false + } + return o.StateUpdateUser, true +} + +// HasStateUpdateUser returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageAttributes) HasStateUpdateUser() bool { + if o != nil && o.StateUpdateUser != nil { + return true + } + + return false +} + +// SetStateUpdateUser gets a reference to the given SecurityMonitoringTriageUser and assigns it to the StateUpdateUser field. +func (o *SecurityMonitoringSignalTriageAttributes) SetStateUpdateUser(v SecurityMonitoringTriageUser) { + o.StateUpdateUser = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalTriageAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.ArchiveComment != nil { + toSerialize["archive_comment"] = o.ArchiveComment + } + if o.ArchiveCommentTimestamp != nil { + toSerialize["archive_comment_timestamp"] = o.ArchiveCommentTimestamp + } + if o.ArchiveCommentUser != nil { + toSerialize["archive_comment_user"] = o.ArchiveCommentUser + } + if o.ArchiveReason != nil { + toSerialize["archive_reason"] = o.ArchiveReason + } + toSerialize["assignee"] = o.Assignee + toSerialize["incident_ids"] = o.IncidentIds + toSerialize["state"] = o.State + if o.StateUpdateTimestamp != nil { + toSerialize["state_update_timestamp"] = o.StateUpdateTimestamp + } + if o.StateUpdateUser != nil { + toSerialize["state_update_user"] = o.StateUpdateUser + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Assignee *SecurityMonitoringTriageUser `json:"assignee"` + IncidentIds *[]int64 `json:"incident_ids"` + State *SecurityMonitoringSignalState `json:"state"` + }{} + all := struct { + ArchiveComment *string `json:"archive_comment,omitempty"` + ArchiveCommentTimestamp *int64 `json:"archive_comment_timestamp,omitempty"` + ArchiveCommentUser *SecurityMonitoringTriageUser `json:"archive_comment_user,omitempty"` + ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` + Assignee SecurityMonitoringTriageUser `json:"assignee"` + IncidentIds []int64 `json:"incident_ids"` + State SecurityMonitoringSignalState `json:"state"` + StateUpdateTimestamp *int64 `json:"state_update_timestamp,omitempty"` + StateUpdateUser *SecurityMonitoringTriageUser `json:"state_update_user,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Assignee == nil { + return fmt.Errorf("Required field assignee missing") + } + if required.IncidentIds == nil { + return fmt.Errorf("Required field incident_ids missing") + } + if required.State == nil { + return fmt.Errorf("Required field state missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.ArchiveReason; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.State; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.ArchiveComment = all.ArchiveComment + o.ArchiveCommentTimestamp = all.ArchiveCommentTimestamp + if all.ArchiveCommentUser != nil && all.ArchiveCommentUser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.ArchiveCommentUser = all.ArchiveCommentUser + o.ArchiveReason = all.ArchiveReason + if all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Assignee = all.Assignee + o.IncidentIds = all.IncidentIds + o.State = all.State + o.StateUpdateTimestamp = all.StateUpdateTimestamp + if all.StateUpdateUser != nil && all.StateUpdateUser.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.StateUpdateUser = all.StateUpdateUser + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_triage_update_data.go b/api/v2/datadog/model_security_monitoring_signal_triage_update_data.go new file mode 100644 index 00000000000..fd14dac57b1 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_triage_update_data.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignalTriageUpdateData Data containing the updated triage attributes of the signal. +type SecurityMonitoringSignalTriageUpdateData struct { + // Attributes describing a triage state update operation over a security signal. + Attributes *SecurityMonitoringSignalTriageAttributes `json:"attributes,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{} +} + +// NewSecurityMonitoringSignalTriageUpdateData instantiates a new SecurityMonitoringSignalTriageUpdateData 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 NewSecurityMonitoringSignalTriageUpdateData() *SecurityMonitoringSignalTriageUpdateData { + this := SecurityMonitoringSignalTriageUpdateData{} + return &this +} + +// NewSecurityMonitoringSignalTriageUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalTriageUpdateData 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 NewSecurityMonitoringSignalTriageUpdateDataWithDefaults() *SecurityMonitoringSignalTriageUpdateData { + this := SecurityMonitoringSignalTriageUpdateData{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalTriageUpdateData) GetAttributes() SecurityMonitoringSignalTriageAttributes { + if o == nil || o.Attributes == nil { + var ret SecurityMonitoringSignalTriageAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalTriageUpdateData) GetAttributesOk() (*SecurityMonitoringSignalTriageAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalTriageUpdateData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given SecurityMonitoringSignalTriageAttributes and assigns it to the Attributes field. +func (o *SecurityMonitoringSignalTriageUpdateData) SetAttributes(v SecurityMonitoringSignalTriageAttributes) { + o.Attributes = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalTriageUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalTriageUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *SecurityMonitoringSignalTriageAttributes `json:"attributes,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_triage_update_response.go b/api/v2/datadog/model_security_monitoring_signal_triage_update_response.go new file mode 100644 index 00000000000..457c4fe54da --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_triage_update_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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalTriageUpdateResponse The response returned after all triage operations, containing the updated signal triage data. +type SecurityMonitoringSignalTriageUpdateResponse struct { + // Data containing the updated triage attributes of the signal. + Data SecurityMonitoringSignalTriageUpdateData `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{} +} + +// NewSecurityMonitoringSignalTriageUpdateResponse instantiates a new SecurityMonitoringSignalTriageUpdateResponse 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 NewSecurityMonitoringSignalTriageUpdateResponse(data SecurityMonitoringSignalTriageUpdateData) *SecurityMonitoringSignalTriageUpdateResponse { + this := SecurityMonitoringSignalTriageUpdateResponse{} + this.Data = data + return &this +} + +// NewSecurityMonitoringSignalTriageUpdateResponseWithDefaults instantiates a new SecurityMonitoringSignalTriageUpdateResponse 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 NewSecurityMonitoringSignalTriageUpdateResponseWithDefaults() *SecurityMonitoringSignalTriageUpdateResponse { + this := SecurityMonitoringSignalTriageUpdateResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityMonitoringSignalTriageUpdateResponse) GetData() SecurityMonitoringSignalTriageUpdateData { + if o == nil { + var ret SecurityMonitoringSignalTriageUpdateData + 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 *SecurityMonitoringSignalTriageUpdateResponse) GetDataOk() (*SecurityMonitoringSignalTriageUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityMonitoringSignalTriageUpdateResponse) SetData(v SecurityMonitoringSignalTriageUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalTriageUpdateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalTriageUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *SecurityMonitoringSignalTriageUpdateData `json:"data"` + }{} + all := struct { + Data SecurityMonitoringSignalTriageUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signal_type.go b/api/v2/datadog/model_security_monitoring_signal_type.go new file mode 100644 index 00000000000..7ccd9440f8b --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signal_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalType The type of event. +type SecurityMonitoringSignalType string + +// List of SecurityMonitoringSignalType. +const ( + SECURITYMONITORINGSIGNALTYPE_SIGNAL SecurityMonitoringSignalType = "signal" +) + +var allowedSecurityMonitoringSignalTypeEnumValues = []SecurityMonitoringSignalType{ + SECURITYMONITORINGSIGNALTYPE_SIGNAL, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringSignalType) GetAllowedValues() []SecurityMonitoringSignalType { + return allowedSecurityMonitoringSignalTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringSignalType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringSignalType(value) + return nil +} + +// NewSecurityMonitoringSignalTypeFromValue returns a pointer to a valid SecurityMonitoringSignalType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringSignalTypeFromValue(v string) (*SecurityMonitoringSignalType, error) { + ev := SecurityMonitoringSignalType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalType: valid values are %v", v, allowedSecurityMonitoringSignalTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringSignalType) IsValid() bool { + for _, existing := range allowedSecurityMonitoringSignalTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringSignalType value. +func (v SecurityMonitoringSignalType) Ptr() *SecurityMonitoringSignalType { + return &v +} + +// NullableSecurityMonitoringSignalType handles when a null is used for SecurityMonitoringSignalType. +type NullableSecurityMonitoringSignalType struct { + value *SecurityMonitoringSignalType + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringSignalType) Get() *SecurityMonitoringSignalType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringSignalType) Set(val *SecurityMonitoringSignalType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringSignalType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringSignalType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringSignalType initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringSignalType(val *SecurityMonitoringSignalType) *NullableSecurityMonitoringSignalType { + return &NullableSecurityMonitoringSignalType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringSignalType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringSignalType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response.go b/api/v2/datadog/model_security_monitoring_signals_list_response.go new file mode 100644 index 00000000000..7416d52615a --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signals_list_response.go @@ -0,0 +1,195 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignalsListResponse The response object with all security signals matching the request +// and pagination information. +type SecurityMonitoringSignalsListResponse struct { + // An array of security signals matching the request. + Data []SecurityMonitoringSignal `json:"data,omitempty"` + // Links attributes. + Links *SecurityMonitoringSignalsListResponseLinks `json:"links,omitempty"` + // Meta attributes. + Meta *SecurityMonitoringSignalsListResponseMeta `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{} +} + +// NewSecurityMonitoringSignalsListResponse instantiates a new SecurityMonitoringSignalsListResponse 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 NewSecurityMonitoringSignalsListResponse() *SecurityMonitoringSignalsListResponse { + this := SecurityMonitoringSignalsListResponse{} + return &this +} + +// NewSecurityMonitoringSignalsListResponseWithDefaults instantiates a new SecurityMonitoringSignalsListResponse 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 NewSecurityMonitoringSignalsListResponseWithDefaults() *SecurityMonitoringSignalsListResponse { + this := SecurityMonitoringSignalsListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalsListResponse) GetData() []SecurityMonitoringSignal { + if o == nil || o.Data == nil { + var ret []SecurityMonitoringSignal + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsListResponse) GetDataOk() (*[]SecurityMonitoringSignal, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalsListResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []SecurityMonitoringSignal and assigns it to the Data field. +func (o *SecurityMonitoringSignalsListResponse) SetData(v []SecurityMonitoringSignal) { + o.Data = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalsListResponse) GetLinks() SecurityMonitoringSignalsListResponseLinks { + if o == nil || o.Links == nil { + var ret SecurityMonitoringSignalsListResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsListResponse) GetLinksOk() (*SecurityMonitoringSignalsListResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalsListResponse) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +// SetLinks gets a reference to the given SecurityMonitoringSignalsListResponseLinks and assigns it to the Links field. +func (o *SecurityMonitoringSignalsListResponse) SetLinks(v SecurityMonitoringSignalsListResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalsListResponse) GetMeta() SecurityMonitoringSignalsListResponseMeta { + if o == nil || o.Meta == nil { + var ret SecurityMonitoringSignalsListResponseMeta + 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 *SecurityMonitoringSignalsListResponse) GetMetaOk() (*SecurityMonitoringSignalsListResponseMeta, 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 *SecurityMonitoringSignalsListResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given SecurityMonitoringSignalsListResponseMeta and assigns it to the Meta field. +func (o *SecurityMonitoringSignalsListResponse) SetMeta(v SecurityMonitoringSignalsListResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalsListResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []SecurityMonitoringSignal `json:"data,omitempty"` + Links *SecurityMonitoringSignalsListResponseLinks `json:"links,omitempty"` + Meta *SecurityMonitoringSignalsListResponseMeta `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response_links.go b/api/v2/datadog/model_security_monitoring_signals_list_response_links.go new file mode 100644 index 00000000000..cb75ce25a64 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signals_list_response_links.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignalsListResponseLinks Links attributes. +type SecurityMonitoringSignalsListResponseLinks struct { + // The link for the next set of results. **Note**: The request can also be made using the + // POST endpoint. + Next *string `json:"next,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{} +} + +// NewSecurityMonitoringSignalsListResponseLinks instantiates a new SecurityMonitoringSignalsListResponseLinks 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 NewSecurityMonitoringSignalsListResponseLinks() *SecurityMonitoringSignalsListResponseLinks { + this := SecurityMonitoringSignalsListResponseLinks{} + return &this +} + +// NewSecurityMonitoringSignalsListResponseLinksWithDefaults instantiates a new SecurityMonitoringSignalsListResponseLinks 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 NewSecurityMonitoringSignalsListResponseLinksWithDefaults() *SecurityMonitoringSignalsListResponseLinks { + this := SecurityMonitoringSignalsListResponseLinks{} + return &this +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalsListResponseLinks) GetNext() string { + if o == nil || o.Next == nil { + var ret string + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsListResponseLinks) GetNextOk() (*string, bool) { + if o == nil || o.Next == nil { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalsListResponseLinks) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *SecurityMonitoringSignalsListResponseLinks) SetNext(v string) { + o.Next = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalsListResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Next != nil { + toSerialize["next"] = o.Next + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Next *string `json:"next,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Next = all.Next + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response_meta.go b/api/v2/datadog/model_security_monitoring_signals_list_response_meta.go new file mode 100644 index 00000000000..cda9da82b9d --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signals_list_response_meta.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignalsListResponseMeta Meta attributes. +type SecurityMonitoringSignalsListResponseMeta struct { + // Paging attributes. + Page *SecurityMonitoringSignalsListResponseMetaPage `json:"page,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{} +} + +// NewSecurityMonitoringSignalsListResponseMeta instantiates a new SecurityMonitoringSignalsListResponseMeta 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 NewSecurityMonitoringSignalsListResponseMeta() *SecurityMonitoringSignalsListResponseMeta { + this := SecurityMonitoringSignalsListResponseMeta{} + return &this +} + +// NewSecurityMonitoringSignalsListResponseMetaWithDefaults instantiates a new SecurityMonitoringSignalsListResponseMeta 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 NewSecurityMonitoringSignalsListResponseMetaWithDefaults() *SecurityMonitoringSignalsListResponseMeta { + this := SecurityMonitoringSignalsListResponseMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalsListResponseMeta) GetPage() SecurityMonitoringSignalsListResponseMetaPage { + if o == nil || o.Page == nil { + var ret SecurityMonitoringSignalsListResponseMetaPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsListResponseMeta) GetPageOk() (*SecurityMonitoringSignalsListResponseMetaPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalsListResponseMeta) HasPage() bool { + if o != nil && o.Page != nil { + return true + } + + return false +} + +// SetPage gets a reference to the given SecurityMonitoringSignalsListResponseMetaPage and assigns it to the Page field. +func (o *SecurityMonitoringSignalsListResponseMeta) SetPage(v SecurityMonitoringSignalsListResponseMetaPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalsListResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalsListResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Page *SecurityMonitoringSignalsListResponseMetaPage `json:"page,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Page = all.Page + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go b/api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go new file mode 100644 index 00000000000..5fafbee499b --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signals_list_response_meta_page.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// SecurityMonitoringSignalsListResponseMetaPage Paging attributes. +type SecurityMonitoringSignalsListResponseMetaPage struct { + // The cursor used to get the next results, if any. To make the next request, use the same + // parameters with the addition of the `page[cursor]`. + After *string `json:"after,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{} +} + +// NewSecurityMonitoringSignalsListResponseMetaPage instantiates a new SecurityMonitoringSignalsListResponseMetaPage 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 NewSecurityMonitoringSignalsListResponseMetaPage() *SecurityMonitoringSignalsListResponseMetaPage { + this := SecurityMonitoringSignalsListResponseMetaPage{} + return &this +} + +// NewSecurityMonitoringSignalsListResponseMetaPageWithDefaults instantiates a new SecurityMonitoringSignalsListResponseMetaPage 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 NewSecurityMonitoringSignalsListResponseMetaPageWithDefaults() *SecurityMonitoringSignalsListResponseMetaPage { + this := SecurityMonitoringSignalsListResponseMetaPage{} + return &this +} + +// GetAfter returns the After field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalsListResponseMetaPage) GetAfter() string { + if o == nil || o.After == nil { + var ret string + return ret + } + return *o.After +} + +// GetAfterOk returns a tuple with the After field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsListResponseMetaPage) GetAfterOk() (*string, bool) { + if o == nil || o.After == nil { + return nil, false + } + return o.After, true +} + +// HasAfter returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalsListResponseMetaPage) HasAfter() bool { + if o != nil && o.After != nil { + return true + } + + return false +} + +// SetAfter gets a reference to the given string and assigns it to the After field. +func (o *SecurityMonitoringSignalsListResponseMetaPage) SetAfter(v string) { + o.After = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalsListResponseMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.After != nil { + toSerialize["after"] = o.After + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalsListResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + After *string `json:"after,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.After = all.After + return nil +} diff --git a/api/v2/datadog/model_security_monitoring_signals_sort.go b/api/v2/datadog/model_security_monitoring_signals_sort.go new file mode 100644 index 00000000000..cea5097ae32 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_signals_sort.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringSignalsSort The sort parameters used for querying security signals. +type SecurityMonitoringSignalsSort string + +// List of SecurityMonitoringSignalsSort. +const ( + SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_ASCENDING SecurityMonitoringSignalsSort = "timestamp" + SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_DESCENDING SecurityMonitoringSignalsSort = "-timestamp" +) + +var allowedSecurityMonitoringSignalsSortEnumValues = []SecurityMonitoringSignalsSort{ + SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_ASCENDING, + SECURITYMONITORINGSIGNALSSORT_TIMESTAMP_DESCENDING, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringSignalsSort) GetAllowedValues() []SecurityMonitoringSignalsSort { + return allowedSecurityMonitoringSignalsSortEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringSignalsSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringSignalsSort(value) + return nil +} + +// NewSecurityMonitoringSignalsSortFromValue returns a pointer to a valid SecurityMonitoringSignalsSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringSignalsSortFromValue(v string) (*SecurityMonitoringSignalsSort, error) { + ev := SecurityMonitoringSignalsSort(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringSignalsSort: valid values are %v", v, allowedSecurityMonitoringSignalsSortEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringSignalsSort) IsValid() bool { + for _, existing := range allowedSecurityMonitoringSignalsSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringSignalsSort value. +func (v SecurityMonitoringSignalsSort) Ptr() *SecurityMonitoringSignalsSort { + return &v +} + +// NullableSecurityMonitoringSignalsSort handles when a null is used for SecurityMonitoringSignalsSort. +type NullableSecurityMonitoringSignalsSort struct { + value *SecurityMonitoringSignalsSort + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringSignalsSort) Get() *SecurityMonitoringSignalsSort { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringSignalsSort) Set(val *SecurityMonitoringSignalsSort) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringSignalsSort) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringSignalsSort) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringSignalsSort initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringSignalsSort(val *SecurityMonitoringSignalsSort) *NullableSecurityMonitoringSignalsSort { + return &NullableSecurityMonitoringSignalsSort{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringSignalsSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringSignalsSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_triage_user.go b/api/v2/datadog/model_security_monitoring_triage_user.go new file mode 100644 index 00000000000..bca84ef197a --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_triage_user.go @@ -0,0 +1,220 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringTriageUser Object representing a given user entity. +type SecurityMonitoringTriageUser struct { + // The handle for this user account. + Handle *string `json:"handle,omitempty"` + // Numerical ID assigned by Datadog to this user account. + Id *int64 `json:"id,omitempty"` + // The name for this user account. + Name *string `json:"name,omitempty"` + // UUID assigned by Datadog to this user account. + Uuid string `json:"uuid"` + // 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{} +} + +// NewSecurityMonitoringTriageUser instantiates a new SecurityMonitoringTriageUser 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 NewSecurityMonitoringTriageUser(uuid string) *SecurityMonitoringTriageUser { + this := SecurityMonitoringTriageUser{} + this.Uuid = uuid + return &this +} + +// NewSecurityMonitoringTriageUserWithDefaults instantiates a new SecurityMonitoringTriageUser 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 NewSecurityMonitoringTriageUserWithDefaults() *SecurityMonitoringTriageUser { + this := SecurityMonitoringTriageUser{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *SecurityMonitoringTriageUser) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringTriageUser) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *SecurityMonitoringTriageUser) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *SecurityMonitoringTriageUser) SetHandle(v string) { + o.Handle = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityMonitoringTriageUser) GetId() int64 { + if o == nil || o.Id == nil { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringTriageUser) GetIdOk() (*int64, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityMonitoringTriageUser) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *SecurityMonitoringTriageUser) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityMonitoringTriageUser) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringTriageUser) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityMonitoringTriageUser) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityMonitoringTriageUser) SetName(v string) { + o.Name = &v +} + +// GetUuid returns the Uuid field value. +func (o *SecurityMonitoringTriageUser) GetUuid() string { + if o == nil { + var ret string + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringTriageUser) GetUuidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *SecurityMonitoringTriageUser) SetUuid(v string) { + o.Uuid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringTriageUser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["uuid"] = o.Uuid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringTriageUser) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Uuid *string `json:"uuid"` + }{} + all := struct { + Handle *string `json:"handle,omitempty"` + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Uuid string `json:"uuid"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Uuid == nil { + return fmt.Errorf("Required field uuid missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Handle = all.Handle + o.Id = all.Id + o.Name = all.Name + o.Uuid = all.Uuid + return nil +} diff --git a/api/v2/datadog/model_service_account_create_attributes.go b/api/v2/datadog/model_service_account_create_attributes.go new file mode 100644 index 00000000000..793547816ba --- /dev/null +++ b/api/v2/datadog/model_service_account_create_attributes.go @@ -0,0 +1,214 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceAccountCreateAttributes Attributes of the created user. +type ServiceAccountCreateAttributes struct { + // The email of the user. + Email string `json:"email"` + // The name of the user. + Name *string `json:"name,omitempty"` + // Whether the user is a service account. Must be true. + ServiceAccount bool `json:"service_account"` + // The title of the user. + Title *string `json:"title,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{} +} + +// NewServiceAccountCreateAttributes instantiates a new ServiceAccountCreateAttributes 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 NewServiceAccountCreateAttributes(email string, serviceAccount bool) *ServiceAccountCreateAttributes { + this := ServiceAccountCreateAttributes{} + this.Email = email + this.ServiceAccount = serviceAccount + return &this +} + +// NewServiceAccountCreateAttributesWithDefaults instantiates a new ServiceAccountCreateAttributes 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 NewServiceAccountCreateAttributesWithDefaults() *ServiceAccountCreateAttributes { + this := ServiceAccountCreateAttributes{} + return &this +} + +// GetEmail returns the Email field value. +func (o *ServiceAccountCreateAttributes) GetEmail() string { + if o == nil { + var ret string + return ret + } + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *ServiceAccountCreateAttributes) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value. +func (o *ServiceAccountCreateAttributes) SetEmail(v string) { + o.Email = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServiceAccountCreateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceAccountCreateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ServiceAccountCreateAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServiceAccountCreateAttributes) SetName(v string) { + o.Name = &v +} + +// GetServiceAccount returns the ServiceAccount field value. +func (o *ServiceAccountCreateAttributes) GetServiceAccount() bool { + if o == nil { + var ret bool + return ret + } + return o.ServiceAccount +} + +// GetServiceAccountOk returns a tuple with the ServiceAccount field value +// and a boolean to check if the value has been set. +func (o *ServiceAccountCreateAttributes) GetServiceAccountOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.ServiceAccount, true +} + +// SetServiceAccount sets field value. +func (o *ServiceAccountCreateAttributes) SetServiceAccount(v bool) { + o.ServiceAccount = v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *ServiceAccountCreateAttributes) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceAccountCreateAttributes) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *ServiceAccountCreateAttributes) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *ServiceAccountCreateAttributes) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceAccountCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["email"] = o.Email + if o.Name != nil { + toSerialize["name"] = o.Name + } + toSerialize["service_account"] = o.ServiceAccount + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceAccountCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Email *string `json:"email"` + ServiceAccount *bool `json:"service_account"` + }{} + all := struct { + Email string `json:"email"` + Name *string `json:"name,omitempty"` + ServiceAccount bool `json:"service_account"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Email == nil { + return fmt.Errorf("Required field email missing") + } + if required.ServiceAccount == nil { + return fmt.Errorf("Required field service_account missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Email = all.Email + o.Name = all.Name + o.ServiceAccount = all.ServiceAccount + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_service_account_create_data.go b/api/v2/datadog/model_service_account_create_data.go new file mode 100644 index 00000000000..9f966329de4 --- /dev/null +++ b/api/v2/datadog/model_service_account_create_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceAccountCreateData Object to create a service account User. +type ServiceAccountCreateData struct { + // Attributes of the created user. + Attributes ServiceAccountCreateAttributes `json:"attributes"` + // Relationships of the user object. + Relationships *UserRelationships `json:"relationships,omitempty"` + // Users resource type. + Type UsersType `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{} +} + +// NewServiceAccountCreateData instantiates a new ServiceAccountCreateData 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 NewServiceAccountCreateData(attributes ServiceAccountCreateAttributes, typeVar UsersType) *ServiceAccountCreateData { + this := ServiceAccountCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewServiceAccountCreateDataWithDefaults instantiates a new ServiceAccountCreateData 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 NewServiceAccountCreateDataWithDefaults() *ServiceAccountCreateData { + this := ServiceAccountCreateData{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *ServiceAccountCreateData) GetAttributes() ServiceAccountCreateAttributes { + if o == nil { + var ret ServiceAccountCreateAttributes + 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 *ServiceAccountCreateData) GetAttributesOk() (*ServiceAccountCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *ServiceAccountCreateData) SetAttributes(v ServiceAccountCreateAttributes) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *ServiceAccountCreateData) GetRelationships() UserRelationships { + if o == nil || o.Relationships == nil { + var ret UserRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceAccountCreateData) GetRelationshipsOk() (*UserRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *ServiceAccountCreateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given UserRelationships and assigns it to the Relationships field. +func (o *ServiceAccountCreateData) SetRelationships(v UserRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *ServiceAccountCreateData) GetType() UsersType { + if o == nil { + var ret UsersType + 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 *ServiceAccountCreateData) GetTypeOk() (*UsersType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ServiceAccountCreateData) SetType(v UsersType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceAccountCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *ServiceAccountCreateAttributes `json:"attributes"` + Type *UsersType `json:"type"` + }{} + all := struct { + Attributes ServiceAccountCreateAttributes `json:"attributes"` + Relationships *UserRelationships `json:"relationships,omitempty"` + Type UsersType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_service_account_create_request.go b/api/v2/datadog/model_service_account_create_request.go new file mode 100644 index 00000000000..d113f08eca5 --- /dev/null +++ b/api/v2/datadog/model_service_account_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// ServiceAccountCreateRequest Create a service account. +type ServiceAccountCreateRequest struct { + // Object to create a service account User. + Data ServiceAccountCreateData `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{} +} + +// NewServiceAccountCreateRequest instantiates a new ServiceAccountCreateRequest 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 NewServiceAccountCreateRequest(data ServiceAccountCreateData) *ServiceAccountCreateRequest { + this := ServiceAccountCreateRequest{} + this.Data = data + return &this +} + +// NewServiceAccountCreateRequestWithDefaults instantiates a new ServiceAccountCreateRequest 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 NewServiceAccountCreateRequestWithDefaults() *ServiceAccountCreateRequest { + this := ServiceAccountCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *ServiceAccountCreateRequest) GetData() ServiceAccountCreateData { + if o == nil { + var ret ServiceAccountCreateData + 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 *ServiceAccountCreateRequest) GetDataOk() (*ServiceAccountCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *ServiceAccountCreateRequest) SetData(v ServiceAccountCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ServiceAccountCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *ServiceAccountCreateData `json:"data"` + }{} + all := struct { + Data ServiceAccountCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_usage_application_security_monitoring_response.go b/api/v2/datadog/model_usage_application_security_monitoring_response.go new file mode 100644 index 00000000000..cf96900fef1 --- /dev/null +++ b/api/v2/datadog/model_usage_application_security_monitoring_response.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 datadog + +import ( + "encoding/json" +) + +// UsageApplicationSecurityMonitoringResponse Application Security Monitoring usage response. +type UsageApplicationSecurityMonitoringResponse struct { + // Response containing Application Security Monitoring usage. + Data []UsageDataObject `json:"data,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{} +} + +// NewUsageApplicationSecurityMonitoringResponse instantiates a new UsageApplicationSecurityMonitoringResponse 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 NewUsageApplicationSecurityMonitoringResponse() *UsageApplicationSecurityMonitoringResponse { + this := UsageApplicationSecurityMonitoringResponse{} + return &this +} + +// NewUsageApplicationSecurityMonitoringResponseWithDefaults instantiates a new UsageApplicationSecurityMonitoringResponse 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 NewUsageApplicationSecurityMonitoringResponseWithDefaults() *UsageApplicationSecurityMonitoringResponse { + this := UsageApplicationSecurityMonitoringResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UsageApplicationSecurityMonitoringResponse) GetData() []UsageDataObject { + if o == nil || o.Data == nil { + var ret []UsageDataObject + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageApplicationSecurityMonitoringResponse) GetDataOk() (*[]UsageDataObject, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UsageApplicationSecurityMonitoringResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []UsageDataObject and assigns it to the Data field. +func (o *UsageApplicationSecurityMonitoringResponse) SetData(v []UsageDataObject) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageApplicationSecurityMonitoringResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageApplicationSecurityMonitoringResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []UsageDataObject `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_usage_attributes_object.go b/api/v2/datadog/model_usage_attributes_object.go new file mode 100644 index 00000000000..8c5c86aba91 --- /dev/null +++ b/api/v2/datadog/model_usage_attributes_object.go @@ -0,0 +1,266 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageAttributesObject Usage attributes data. +type UsageAttributesObject struct { + // The organization name. + OrgName *string `json:"org_name,omitempty"` + // The product for which usage is being reported. + ProductFamily *string `json:"product_family,omitempty"` + // The organization public ID. + PublicId *string `json:"public_id,omitempty"` + // List of usage data reported for each requested hour. + Timeseries []UsageTimeSeriesObject `json:"timeseries,omitempty"` + // Usage type that is being measured. + UsageType *HourlyUsageType `json:"usage_type,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{} +} + +// NewUsageAttributesObject instantiates a new UsageAttributesObject 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 NewUsageAttributesObject() *UsageAttributesObject { + this := UsageAttributesObject{} + return &this +} + +// NewUsageAttributesObjectWithDefaults instantiates a new UsageAttributesObject 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 NewUsageAttributesObjectWithDefaults() *UsageAttributesObject { + this := UsageAttributesObject{} + return &this +} + +// GetOrgName returns the OrgName field value if set, zero value otherwise. +func (o *UsageAttributesObject) GetOrgName() string { + if o == nil || o.OrgName == nil { + var ret string + return ret + } + return *o.OrgName +} + +// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributesObject) GetOrgNameOk() (*string, bool) { + if o == nil || o.OrgName == nil { + return nil, false + } + return o.OrgName, true +} + +// HasOrgName returns a boolean if a field has been set. +func (o *UsageAttributesObject) HasOrgName() bool { + if o != nil && o.OrgName != nil { + return true + } + + return false +} + +// SetOrgName gets a reference to the given string and assigns it to the OrgName field. +func (o *UsageAttributesObject) SetOrgName(v string) { + o.OrgName = &v +} + +// GetProductFamily returns the ProductFamily field value if set, zero value otherwise. +func (o *UsageAttributesObject) GetProductFamily() string { + if o == nil || o.ProductFamily == nil { + var ret string + return ret + } + return *o.ProductFamily +} + +// GetProductFamilyOk returns a tuple with the ProductFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributesObject) GetProductFamilyOk() (*string, bool) { + if o == nil || o.ProductFamily == nil { + return nil, false + } + return o.ProductFamily, true +} + +// HasProductFamily returns a boolean if a field has been set. +func (o *UsageAttributesObject) HasProductFamily() bool { + if o != nil && o.ProductFamily != nil { + return true + } + + return false +} + +// SetProductFamily gets a reference to the given string and assigns it to the ProductFamily field. +func (o *UsageAttributesObject) SetProductFamily(v string) { + o.ProductFamily = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *UsageAttributesObject) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributesObject) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *UsageAttributesObject) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *UsageAttributesObject) SetPublicId(v string) { + o.PublicId = &v +} + +// GetTimeseries returns the Timeseries field value if set, zero value otherwise. +func (o *UsageAttributesObject) GetTimeseries() []UsageTimeSeriesObject { + if o == nil || o.Timeseries == nil { + var ret []UsageTimeSeriesObject + return ret + } + return o.Timeseries +} + +// GetTimeseriesOk returns a tuple with the Timeseries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributesObject) GetTimeseriesOk() (*[]UsageTimeSeriesObject, bool) { + if o == nil || o.Timeseries == nil { + return nil, false + } + return &o.Timeseries, true +} + +// HasTimeseries returns a boolean if a field has been set. +func (o *UsageAttributesObject) HasTimeseries() bool { + if o != nil && o.Timeseries != nil { + return true + } + + return false +} + +// SetTimeseries gets a reference to the given []UsageTimeSeriesObject and assigns it to the Timeseries field. +func (o *UsageAttributesObject) SetTimeseries(v []UsageTimeSeriesObject) { + o.Timeseries = v +} + +// GetUsageType returns the UsageType field value if set, zero value otherwise. +func (o *UsageAttributesObject) GetUsageType() HourlyUsageType { + if o == nil || o.UsageType == nil { + var ret HourlyUsageType + return ret + } + return *o.UsageType +} + +// GetUsageTypeOk returns a tuple with the UsageType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageAttributesObject) GetUsageTypeOk() (*HourlyUsageType, bool) { + if o == nil || o.UsageType == nil { + return nil, false + } + return o.UsageType, true +} + +// HasUsageType returns a boolean if a field has been set. +func (o *UsageAttributesObject) HasUsageType() bool { + if o != nil && o.UsageType != nil { + return true + } + + return false +} + +// SetUsageType gets a reference to the given HourlyUsageType and assigns it to the UsageType field. +func (o *UsageAttributesObject) SetUsageType(v HourlyUsageType) { + o.UsageType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageAttributesObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.OrgName != nil { + toSerialize["org_name"] = o.OrgName + } + if o.ProductFamily != nil { + toSerialize["product_family"] = o.ProductFamily + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Timeseries != nil { + toSerialize["timeseries"] = o.Timeseries + } + if o.UsageType != nil { + toSerialize["usage_type"] = o.UsageType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageAttributesObject) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + OrgName *string `json:"org_name,omitempty"` + ProductFamily *string `json:"product_family,omitempty"` + PublicId *string `json:"public_id,omitempty"` + Timeseries []UsageTimeSeriesObject `json:"timeseries,omitempty"` + UsageType *HourlyUsageType `json:"usage_type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.UsageType; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.OrgName = all.OrgName + o.ProductFamily = all.ProductFamily + o.PublicId = all.PublicId + o.Timeseries = all.Timeseries + o.UsageType = all.UsageType + return nil +} diff --git a/api/v2/datadog/model_usage_data_object.go b/api/v2/datadog/model_usage_data_object.go new file mode 100644 index 00000000000..631eb949d6d --- /dev/null +++ b/api/v2/datadog/model_usage_data_object.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsageDataObject Usage data. +type UsageDataObject struct { + // Usage attributes data. + Attributes *UsageAttributesObject `json:"attributes,omitempty"` + // Unique ID of the response. + Id *string `json:"id,omitempty"` + // Type of usage data. + Type *UsageTimeSeriesType `json:"type,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{} +} + +// NewUsageDataObject instantiates a new UsageDataObject 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 NewUsageDataObject() *UsageDataObject { + this := UsageDataObject{} + var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES + this.Type = &typeVar + return &this +} + +// NewUsageDataObjectWithDefaults instantiates a new UsageDataObject 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 NewUsageDataObjectWithDefaults() *UsageDataObject { + this := UsageDataObject{} + var typeVar UsageTimeSeriesType = USAGETIMESERIESTYPE_USAGE_TIMESERIES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UsageDataObject) GetAttributes() UsageAttributesObject { + if o == nil || o.Attributes == nil { + var ret UsageAttributesObject + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDataObject) GetAttributesOk() (*UsageAttributesObject, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *UsageDataObject) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given UsageAttributesObject and assigns it to the Attributes field. +func (o *UsageDataObject) SetAttributes(v UsageAttributesObject) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UsageDataObject) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDataObject) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UsageDataObject) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UsageDataObject) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *UsageDataObject) GetType() UsageTimeSeriesType { + if o == nil || o.Type == nil { + var ret UsageTimeSeriesType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageDataObject) GetTypeOk() (*UsageTimeSeriesType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *UsageDataObject) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given UsageTimeSeriesType and assigns it to the Type field. +func (o *UsageDataObject) SetType(v UsageTimeSeriesType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageDataObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageDataObject) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *UsageAttributesObject `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UsageTimeSeriesType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_usage_lambda_traced_invocations_response.go b/api/v2/datadog/model_usage_lambda_traced_invocations_response.go new file mode 100644 index 00000000000..9bfb7eea4c3 --- /dev/null +++ b/api/v2/datadog/model_usage_lambda_traced_invocations_response.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 datadog + +import ( + "encoding/json" +) + +// UsageLambdaTracedInvocationsResponse Lambda Traced Invocations usage response. +type UsageLambdaTracedInvocationsResponse struct { + // Response containing Lambda Traced Invocations usage. + Data []UsageDataObject `json:"data,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{} +} + +// NewUsageLambdaTracedInvocationsResponse instantiates a new UsageLambdaTracedInvocationsResponse 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 NewUsageLambdaTracedInvocationsResponse() *UsageLambdaTracedInvocationsResponse { + this := UsageLambdaTracedInvocationsResponse{} + return &this +} + +// NewUsageLambdaTracedInvocationsResponseWithDefaults instantiates a new UsageLambdaTracedInvocationsResponse 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 NewUsageLambdaTracedInvocationsResponseWithDefaults() *UsageLambdaTracedInvocationsResponse { + this := UsageLambdaTracedInvocationsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UsageLambdaTracedInvocationsResponse) GetData() []UsageDataObject { + if o == nil || o.Data == nil { + var ret []UsageDataObject + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageLambdaTracedInvocationsResponse) GetDataOk() (*[]UsageDataObject, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UsageLambdaTracedInvocationsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []UsageDataObject and assigns it to the Data field. +func (o *UsageLambdaTracedInvocationsResponse) SetData(v []UsageDataObject) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageLambdaTracedInvocationsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageLambdaTracedInvocationsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []UsageDataObject `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_usage_observability_pipelines_response.go b/api/v2/datadog/model_usage_observability_pipelines_response.go new file mode 100644 index 00000000000..268c64a172c --- /dev/null +++ b/api/v2/datadog/model_usage_observability_pipelines_response.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 datadog + +import ( + "encoding/json" +) + +// UsageObservabilityPipelinesResponse Observability Pipelines usage response. +type UsageObservabilityPipelinesResponse struct { + // Response containing Observability Pipelines usage. + Data []UsageDataObject `json:"data,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{} +} + +// NewUsageObservabilityPipelinesResponse instantiates a new UsageObservabilityPipelinesResponse 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 NewUsageObservabilityPipelinesResponse() *UsageObservabilityPipelinesResponse { + this := UsageObservabilityPipelinesResponse{} + return &this +} + +// NewUsageObservabilityPipelinesResponseWithDefaults instantiates a new UsageObservabilityPipelinesResponse 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 NewUsageObservabilityPipelinesResponseWithDefaults() *UsageObservabilityPipelinesResponse { + this := UsageObservabilityPipelinesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UsageObservabilityPipelinesResponse) GetData() []UsageDataObject { + if o == nil || o.Data == nil { + var ret []UsageDataObject + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageObservabilityPipelinesResponse) GetDataOk() (*[]UsageDataObject, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UsageObservabilityPipelinesResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []UsageDataObject and assigns it to the Data field. +func (o *UsageObservabilityPipelinesResponse) SetData(v []UsageDataObject) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageObservabilityPipelinesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageObservabilityPipelinesResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []UsageDataObject `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_usage_time_series_object.go b/api/v2/datadog/model_usage_time_series_object.go new file mode 100644 index 00000000000..97c3d25ea57 --- /dev/null +++ b/api/v2/datadog/model_usage_time_series_object.go @@ -0,0 +1,159 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UsageTimeSeriesObject Usage timeseries data. +type UsageTimeSeriesObject struct { + // Datetime in ISO-8601 format, UTC. The hour for the usage. + Timestamp *time.Time `json:"timestamp,omitempty"` + // Contains the number measured for the given usage_type during the hour. + Value common.NullableInt64 `json:"value,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{} +} + +// NewUsageTimeSeriesObject instantiates a new UsageTimeSeriesObject 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 NewUsageTimeSeriesObject() *UsageTimeSeriesObject { + this := UsageTimeSeriesObject{} + return &this +} + +// NewUsageTimeSeriesObjectWithDefaults instantiates a new UsageTimeSeriesObject 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 NewUsageTimeSeriesObjectWithDefaults() *UsageTimeSeriesObject { + this := UsageTimeSeriesObject{} + return &this +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *UsageTimeSeriesObject) GetTimestamp() time.Time { + if o == nil || o.Timestamp == nil { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsageTimeSeriesObject) GetTimestampOk() (*time.Time, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *UsageTimeSeriesObject) HasTimestamp() bool { + if o != nil && o.Timestamp != nil { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *UsageTimeSeriesObject) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UsageTimeSeriesObject) GetValue() int64 { + if o == nil || o.Value.Get() == nil { + var ret int64 + return ret + } + return *o.Value.Get() +} + +// GetValueOk returns a tuple with the Value 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 *UsageTimeSeriesObject) GetValueOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Value.Get(), o.Value.IsSet() +} + +// HasValue returns a boolean if a field has been set. +func (o *UsageTimeSeriesObject) HasValue() bool { + if o != nil && o.Value.IsSet() { + return true + } + + return false +} + +// SetValue gets a reference to the given common.NullableInt64 and assigns it to the Value field. +func (o *UsageTimeSeriesObject) SetValue(v int64) { + o.Value.Set(&v) +} + +// SetValueNil sets the value for Value to be an explicit nil. +func (o *UsageTimeSeriesObject) SetValueNil() { + o.Value.Set(nil) +} + +// UnsetValue ensures that no value is present for Value, not even an explicit nil. +func (o *UsageTimeSeriesObject) UnsetValue() { + o.Value.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsageTimeSeriesObject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Timestamp != nil { + if o.Timestamp.Nanosecond() == 0 { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp"] = o.Timestamp.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Value.IsSet() { + toSerialize["value"] = o.Value.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsageTimeSeriesObject) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Timestamp *time.Time `json:"timestamp,omitempty"` + Value common.NullableInt64 `json:"value,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Timestamp = all.Timestamp + o.Value = all.Value + return nil +} diff --git a/api/v2/datadog/model_usage_time_series_type.go b/api/v2/datadog/model_usage_time_series_type.go new file mode 100644 index 00000000000..92f08bf663c --- /dev/null +++ b/api/v2/datadog/model_usage_time_series_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsageTimeSeriesType Type of usage data. +type UsageTimeSeriesType string + +// List of UsageTimeSeriesType. +const ( + USAGETIMESERIESTYPE_USAGE_TIMESERIES UsageTimeSeriesType = "usage_timeseries" +) + +var allowedUsageTimeSeriesTypeEnumValues = []UsageTimeSeriesType{ + USAGETIMESERIESTYPE_USAGE_TIMESERIES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsageTimeSeriesType) GetAllowedValues() []UsageTimeSeriesType { + return allowedUsageTimeSeriesTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsageTimeSeriesType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsageTimeSeriesType(value) + return nil +} + +// NewUsageTimeSeriesTypeFromValue returns a pointer to a valid UsageTimeSeriesType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsageTimeSeriesTypeFromValue(v string) (*UsageTimeSeriesType, error) { + ev := UsageTimeSeriesType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsageTimeSeriesType: valid values are %v", v, allowedUsageTimeSeriesTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsageTimeSeriesType) IsValid() bool { + for _, existing := range allowedUsageTimeSeriesTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsageTimeSeriesType value. +func (v UsageTimeSeriesType) Ptr() *UsageTimeSeriesType { + return &v +} + +// NullableUsageTimeSeriesType handles when a null is used for UsageTimeSeriesType. +type NullableUsageTimeSeriesType struct { + value *UsageTimeSeriesType + isSet bool +} + +// Get returns the associated value. +func (v NullableUsageTimeSeriesType) Get() *UsageTimeSeriesType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsageTimeSeriesType) Set(val *UsageTimeSeriesType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsageTimeSeriesType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsageTimeSeriesType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsageTimeSeriesType initializes the struct as if Set has been called. +func NewNullableUsageTimeSeriesType(val *UsageTimeSeriesType) *NullableUsageTimeSeriesType { + return &NullableUsageTimeSeriesType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsageTimeSeriesType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsageTimeSeriesType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_user.go b/api/v2/datadog/model_user.go new file mode 100644 index 00000000000..5fb9287a00b --- /dev/null +++ b/api/v2/datadog/model_user.go @@ -0,0 +1,245 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// User User object returned by the API. +type User struct { + // Attributes of user object returned by the API. + Attributes *UserAttributes `json:"attributes,omitempty"` + // ID of the user. + Id *string `json:"id,omitempty"` + // Relationships of the user object returned by the API. + Relationships *UserResponseRelationships `json:"relationships,omitempty"` + // Users resource type. + Type *UsersType `json:"type,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{} +} + +// NewUser instantiates a new User 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 NewUser() *User { + this := User{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = &typeVar + return &this +} + +// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User { + this := User{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *User) GetAttributes() UserAttributes { + if o == nil || o.Attributes == nil { + var ret UserAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetAttributesOk() (*UserAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *User) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given UserAttributes and assigns it to the Attributes field. +func (o *User) SetAttributes(v UserAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *User) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *User) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *User) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *User) GetRelationships() UserResponseRelationships { + if o == nil || o.Relationships == nil { + var ret UserResponseRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetRelationshipsOk() (*UserResponseRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *User) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given UserResponseRelationships and assigns it to the Relationships field. +func (o *User) SetRelationships(v UserResponseRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *User) GetType() UsersType { + if o == nil || o.Type == nil { + var ret UsersType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetTypeOk() (*UsersType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *User) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given UsersType and assigns it to the Type field. +func (o *User) SetType(v UsersType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o User) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *User) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *UserAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *UserResponseRelationships `json:"relationships,omitempty"` + Type *UsersType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_user_attributes.go b/api/v2/datadog/model_user_attributes.go new file mode 100644 index 00000000000..899e3db6cd6 --- /dev/null +++ b/api/v2/datadog/model_user_attributes.go @@ -0,0 +1,525 @@ +// 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 datadog + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/common" +) + +// UserAttributes Attributes of user object returned by the API. +type UserAttributes struct { + // Creation time of the user. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Whether the user is disabled. + Disabled *bool `json:"disabled,omitempty"` + // Email of the user. + Email *string `json:"email,omitempty"` + // Handle of the user. + Handle *string `json:"handle,omitempty"` + // URL of the user's icon. + Icon *string `json:"icon,omitempty"` + // Time that the user was last modified. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // Name of the user. + Name common.NullableString `json:"name,omitempty"` + // Whether the user is a service account. + ServiceAccount *bool `json:"service_account,omitempty"` + // Status of the user. + Status *string `json:"status,omitempty"` + // Title of the user. + Title common.NullableString `json:"title,omitempty"` + // Whether the user is verified. + Verified *bool `json:"verified,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{} +} + +// NewUserAttributes instantiates a new UserAttributes 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 NewUserAttributes() *UserAttributes { + this := UserAttributes{} + return &this +} + +// NewUserAttributesWithDefaults instantiates a new UserAttributes 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 NewUserAttributesWithDefaults() *UserAttributes { + this := UserAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UserAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UserAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UserAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *UserAttributes) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *UserAttributes) HasDisabled() bool { + if o != nil && o.Disabled != nil { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *UserAttributes) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserAttributes) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *UserAttributes) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserAttributes) SetEmail(v string) { + o.Email = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *UserAttributes) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *UserAttributes) HasHandle() bool { + if o != nil && o.Handle != nil { + return true + } + + return false +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *UserAttributes) SetHandle(v string) { + o.Handle = &v +} + +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *UserAttributes) GetIcon() string { + if o == nil || o.Icon == nil { + var ret string + return ret + } + return *o.Icon +} + +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { + return nil, false + } + return o.Icon, true +} + +// HasIcon returns a boolean if a field has been set. +func (o *UserAttributes) HasIcon() bool { + if o != nil && o.Icon != nil { + return true + } + + return false +} + +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *UserAttributes) SetIcon(v string) { + o.Icon = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *UserAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *UserAttributes) HasModifiedAt() bool { + if o != nil && o.ModifiedAt != nil { + return true + } + + return false +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *UserAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UserAttributes) GetName() string { + if o == nil || o.Name.Get() == nil { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *UserAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *UserAttributes) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given common.NullableString and assigns it to the Name field. +func (o *UserAttributes) SetName(v string) { + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil. +func (o *UserAttributes) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil. +func (o *UserAttributes) UnsetName() { + o.Name.Unset() +} + +// GetServiceAccount returns the ServiceAccount field value if set, zero value otherwise. +func (o *UserAttributes) GetServiceAccount() bool { + if o == nil || o.ServiceAccount == nil { + var ret bool + return ret + } + return *o.ServiceAccount +} + +// GetServiceAccountOk returns a tuple with the ServiceAccount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetServiceAccountOk() (*bool, bool) { + if o == nil || o.ServiceAccount == nil { + return nil, false + } + return o.ServiceAccount, true +} + +// HasServiceAccount returns a boolean if a field has been set. +func (o *UserAttributes) HasServiceAccount() bool { + if o != nil && o.ServiceAccount != nil { + return true + } + + return false +} + +// SetServiceAccount gets a reference to the given bool and assigns it to the ServiceAccount field. +func (o *UserAttributes) SetServiceAccount(v bool) { + o.ServiceAccount = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *UserAttributes) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *UserAttributes) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *UserAttributes) SetStatus(v string) { + o.Status = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UserAttributes) GetTitle() string { + if o == nil || o.Title.Get() == nil { + var ret string + return ret + } + return *o.Title.Get() +} + +// GetTitleOk returns a tuple with the Title 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 *UserAttributes) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Title.Get(), o.Title.IsSet() +} + +// HasTitle returns a boolean if a field has been set. +func (o *UserAttributes) HasTitle() bool { + if o != nil && o.Title.IsSet() { + return true + } + + return false +} + +// SetTitle gets a reference to the given common.NullableString and assigns it to the Title field. +func (o *UserAttributes) SetTitle(v string) { + o.Title.Set(&v) +} + +// SetTitleNil sets the value for Title to be an explicit nil. +func (o *UserAttributes) SetTitleNil() { + o.Title.Set(nil) +} + +// UnsetTitle ensures that no value is present for Title, not even an explicit nil. +func (o *UserAttributes) UnsetTitle() { + o.Title.Unset() +} + +// GetVerified returns the Verified field value if set, zero value otherwise. +func (o *UserAttributes) GetVerified() bool { + if o == nil || o.Verified == nil { + var ret bool + return ret + } + return *o.Verified +} + +// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetVerifiedOk() (*bool, bool) { + if o == nil || o.Verified == nil { + return nil, false + } + return o.Verified, true +} + +// HasVerified returns a boolean if a field has been set. +func (o *UserAttributes) HasVerified() bool { + if o != nil && o.Verified != nil { + return true + } + + return false +} + +// SetVerified gets a reference to the given bool and assigns it to the Verified field. +func (o *UserAttributes) SetVerified(v bool) { + o.Verified = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if o.ServiceAccount != nil { + toSerialize["service_account"] = o.ServiceAccount + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Title.IsSet() { + toSerialize["title"] = o.Title.Get() + } + if o.Verified != nil { + toSerialize["verified"] = o.Verified + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Icon *string `json:"icon,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name common.NullableString `json:"name,omitempty"` + ServiceAccount *bool `json:"service_account,omitempty"` + Status *string `json:"status,omitempty"` + Title common.NullableString `json:"title,omitempty"` + Verified *bool `json:"verified,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.Disabled = all.Disabled + o.Email = all.Email + o.Handle = all.Handle + o.Icon = all.Icon + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + o.ServiceAccount = all.ServiceAccount + o.Status = all.Status + o.Title = all.Title + o.Verified = all.Verified + return nil +} diff --git a/api/v2/datadog/model_user_create_attributes.go b/api/v2/datadog/model_user_create_attributes.go new file mode 100644 index 00000000000..f0a225065eb --- /dev/null +++ b/api/v2/datadog/model_user_create_attributes.go @@ -0,0 +1,181 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserCreateAttributes Attributes of the created user. +type UserCreateAttributes struct { + // The email of the user. + Email string `json:"email"` + // The name of the user. + Name *string `json:"name,omitempty"` + // The title of the user. + Title *string `json:"title,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{} +} + +// NewUserCreateAttributes instantiates a new UserCreateAttributes 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 NewUserCreateAttributes(email string) *UserCreateAttributes { + this := UserCreateAttributes{} + this.Email = email + return &this +} + +// NewUserCreateAttributesWithDefaults instantiates a new UserCreateAttributes 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 NewUserCreateAttributesWithDefaults() *UserCreateAttributes { + this := UserCreateAttributes{} + return &this +} + +// GetEmail returns the Email field value. +func (o *UserCreateAttributes) GetEmail() string { + if o == nil { + var ret string + return ret + } + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value. +func (o *UserCreateAttributes) SetEmail(v string) { + o.Email = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UserCreateAttributes) SetName(v string) { + o.Name = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasTitle() bool { + if o != nil && o.Title != nil { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *UserCreateAttributes) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["email"] = o.Email + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Email *string `json:"email"` + }{} + all := struct { + Email string `json:"email"` + Name *string `json:"name,omitempty"` + Title *string `json:"title,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Email == nil { + return fmt.Errorf("Required field email missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Email = all.Email + o.Name = all.Name + o.Title = all.Title + return nil +} diff --git a/api/v2/datadog/model_user_create_data.go b/api/v2/datadog/model_user_create_data.go new file mode 100644 index 00000000000..cf9299d8998 --- /dev/null +++ b/api/v2/datadog/model_user_create_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserCreateData Object to create a user. +type UserCreateData struct { + // Attributes of the created user. + Attributes UserCreateAttributes `json:"attributes"` + // Relationships of the user object. + Relationships *UserRelationships `json:"relationships,omitempty"` + // Users resource type. + Type UsersType `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{} +} + +// NewUserCreateData instantiates a new UserCreateData 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 NewUserCreateData(attributes UserCreateAttributes, typeVar UsersType) *UserCreateData { + this := UserCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewUserCreateDataWithDefaults instantiates a new UserCreateData 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 NewUserCreateDataWithDefaults() *UserCreateData { + this := UserCreateData{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *UserCreateData) GetAttributes() UserCreateAttributes { + if o == nil { + var ret UserCreateAttributes + 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 *UserCreateData) GetAttributesOk() (*UserCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *UserCreateData) SetAttributes(v UserCreateAttributes) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *UserCreateData) GetRelationships() UserRelationships { + if o == nil || o.Relationships == nil { + var ret UserRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateData) GetRelationshipsOk() (*UserRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *UserCreateData) HasRelationships() bool { + if o != nil && o.Relationships != nil { + return true + } + + return false +} + +// SetRelationships gets a reference to the given UserRelationships and assigns it to the Relationships field. +func (o *UserCreateData) SetRelationships(v UserRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *UserCreateData) GetType() UsersType { + if o == nil { + var ret UsersType + 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 *UserCreateData) GetTypeOk() (*UsersType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UserCreateData) SetType(v UsersType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *UserCreateAttributes `json:"attributes"` + Type *UsersType `json:"type"` + }{} + all := struct { + Attributes UserCreateAttributes `json:"attributes"` + Relationships *UserRelationships `json:"relationships,omitempty"` + Type UsersType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_user_create_request.go b/api/v2/datadog/model_user_create_request.go new file mode 100644 index 00000000000..449b8a737e4 --- /dev/null +++ b/api/v2/datadog/model_user_create_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserCreateRequest Create a user. +type UserCreateRequest struct { + // Object to create a user. + Data UserCreateData `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{} +} + +// NewUserCreateRequest instantiates a new UserCreateRequest 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 NewUserCreateRequest(data UserCreateData) *UserCreateRequest { + this := UserCreateRequest{} + this.Data = data + return &this +} + +// NewUserCreateRequestWithDefaults instantiates a new UserCreateRequest 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 NewUserCreateRequestWithDefaults() *UserCreateRequest { + this := UserCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *UserCreateRequest) GetData() UserCreateData { + if o == nil { + var ret UserCreateData + 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 *UserCreateRequest) GetDataOk() (*UserCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *UserCreateRequest) SetData(v UserCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *UserCreateData `json:"data"` + }{} + all := struct { + Data UserCreateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_user_invitation_data.go b/api/v2/datadog/model_user_invitation_data.go new file mode 100644 index 00000000000..6c11b28ed1e --- /dev/null +++ b/api/v2/datadog/model_user_invitation_data.go @@ -0,0 +1,153 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserInvitationData Object to create a user invitation. +type UserInvitationData struct { + // Relationships data for user invitation. + Relationships UserInvitationRelationships `json:"relationships"` + // User invitations type. + Type UserInvitationsType `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{} +} + +// NewUserInvitationData instantiates a new UserInvitationData 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 NewUserInvitationData(relationships UserInvitationRelationships, typeVar UserInvitationsType) *UserInvitationData { + this := UserInvitationData{} + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewUserInvitationDataWithDefaults instantiates a new UserInvitationData 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 NewUserInvitationDataWithDefaults() *UserInvitationData { + this := UserInvitationData{} + var typeVar UserInvitationsType = USERINVITATIONSTYPE_USER_INVITATIONS + this.Type = typeVar + return &this +} + +// GetRelationships returns the Relationships field value. +func (o *UserInvitationData) GetRelationships() UserInvitationRelationships { + if o == nil { + var ret UserInvitationRelationships + return ret + } + return o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value +// and a boolean to check if the value has been set. +func (o *UserInvitationData) GetRelationshipsOk() (*UserInvitationRelationships, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *UserInvitationData) SetRelationships(v UserInvitationRelationships) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *UserInvitationData) GetType() UserInvitationsType { + if o == nil { + var ret UserInvitationsType + 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 *UserInvitationData) GetTypeOk() (*UserInvitationsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UserInvitationData) SetType(v UserInvitationsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserInvitationData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserInvitationData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Relationships *UserInvitationRelationships `json:"relationships"` + Type *UserInvitationsType `json:"type"` + }{} + all := struct { + Relationships UserInvitationRelationships `json:"relationships"` + Type UserInvitationsType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Relationships == nil { + return fmt.Errorf("Required field relationships missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Relationships = all.Relationships + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_user_invitation_data_attributes.go b/api/v2/datadog/model_user_invitation_data_attributes.go new file mode 100644 index 00000000000..dffc281f3ff --- /dev/null +++ b/api/v2/datadog/model_user_invitation_data_attributes.go @@ -0,0 +1,228 @@ +// 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 datadog + +import ( + "encoding/json" + "time" +) + +// UserInvitationDataAttributes Attributes of a user invitation. +type UserInvitationDataAttributes struct { + // Creation time of the user invitation. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Time of invitation expiration. + ExpiresAt *time.Time `json:"expires_at,omitempty"` + // Type of invitation. + InviteType *string `json:"invite_type,omitempty"` + // UUID of the user invitation. + Uuid *string `json:"uuid,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{} +} + +// NewUserInvitationDataAttributes instantiates a new UserInvitationDataAttributes 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 NewUserInvitationDataAttributes() *UserInvitationDataAttributes { + this := UserInvitationDataAttributes{} + return &this +} + +// NewUserInvitationDataAttributesWithDefaults instantiates a new UserInvitationDataAttributes 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 NewUserInvitationDataAttributesWithDefaults() *UserInvitationDataAttributes { + this := UserInvitationDataAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UserInvitationDataAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationDataAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UserInvitationDataAttributes) HasCreatedAt() bool { + if o != nil && o.CreatedAt != nil { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UserInvitationDataAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. +func (o *UserInvitationDataAttributes) GetExpiresAt() time.Time { + if o == nil || o.ExpiresAt == nil { + var ret time.Time + return ret + } + return *o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationDataAttributes) GetExpiresAtOk() (*time.Time, bool) { + if o == nil || o.ExpiresAt == nil { + return nil, false + } + return o.ExpiresAt, true +} + +// HasExpiresAt returns a boolean if a field has been set. +func (o *UserInvitationDataAttributes) HasExpiresAt() bool { + if o != nil && o.ExpiresAt != nil { + return true + } + + return false +} + +// SetExpiresAt gets a reference to the given time.Time and assigns it to the ExpiresAt field. +func (o *UserInvitationDataAttributes) SetExpiresAt(v time.Time) { + o.ExpiresAt = &v +} + +// GetInviteType returns the InviteType field value if set, zero value otherwise. +func (o *UserInvitationDataAttributes) GetInviteType() string { + if o == nil || o.InviteType == nil { + var ret string + return ret + } + return *o.InviteType +} + +// GetInviteTypeOk returns a tuple with the InviteType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationDataAttributes) GetInviteTypeOk() (*string, bool) { + if o == nil || o.InviteType == nil { + return nil, false + } + return o.InviteType, true +} + +// HasInviteType returns a boolean if a field has been set. +func (o *UserInvitationDataAttributes) HasInviteType() bool { + if o != nil && o.InviteType != nil { + return true + } + + return false +} + +// SetInviteType gets a reference to the given string and assigns it to the InviteType field. +func (o *UserInvitationDataAttributes) SetInviteType(v string) { + o.InviteType = &v +} + +// GetUuid returns the Uuid field value if set, zero value otherwise. +func (o *UserInvitationDataAttributes) GetUuid() string { + if o == nil || o.Uuid == nil { + var ret string + return ret + } + return *o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationDataAttributes) GetUuidOk() (*string, bool) { + if o == nil || o.Uuid == nil { + return nil, false + } + return o.Uuid, true +} + +// HasUuid returns a boolean if a field has been set. +func (o *UserInvitationDataAttributes) HasUuid() bool { + if o != nil && o.Uuid != nil { + return true + } + + return false +} + +// SetUuid gets a reference to the given string and assigns it to the Uuid field. +func (o *UserInvitationDataAttributes) SetUuid(v string) { + o.Uuid = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserInvitationDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ExpiresAt != nil { + if o.ExpiresAt.Nanosecond() == 0 { + toSerialize["expires_at"] = o.ExpiresAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["expires_at"] = o.ExpiresAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.InviteType != nil { + toSerialize["invite_type"] = o.InviteType + } + if o.Uuid != nil { + toSerialize["uuid"] = o.Uuid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserInvitationDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + ExpiresAt *time.Time `json:"expires_at,omitempty"` + InviteType *string `json:"invite_type,omitempty"` + Uuid *string `json:"uuid,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.CreatedAt = all.CreatedAt + o.ExpiresAt = all.ExpiresAt + o.InviteType = all.InviteType + o.Uuid = all.Uuid + return nil +} diff --git a/api/v2/datadog/model_user_invitation_relationships.go b/api/v2/datadog/model_user_invitation_relationships.go new file mode 100644 index 00000000000..4efc868e724 --- /dev/null +++ b/api/v2/datadog/model_user_invitation_relationships.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserInvitationRelationships Relationships data for user invitation. +type UserInvitationRelationships struct { + // Relationship to user. + User RelationshipToUser `json:"user"` + // 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{} +} + +// NewUserInvitationRelationships instantiates a new UserInvitationRelationships 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 NewUserInvitationRelationships(user RelationshipToUser) *UserInvitationRelationships { + this := UserInvitationRelationships{} + this.User = user + return &this +} + +// NewUserInvitationRelationshipsWithDefaults instantiates a new UserInvitationRelationships 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 NewUserInvitationRelationshipsWithDefaults() *UserInvitationRelationships { + this := UserInvitationRelationships{} + return &this +} + +// GetUser returns the User field value. +func (o *UserInvitationRelationships) GetUser() RelationshipToUser { + if o == nil { + var ret RelationshipToUser + return ret + } + return o.User +} + +// GetUserOk returns a tuple with the User field value +// and a boolean to check if the value has been set. +func (o *UserInvitationRelationships) GetUserOk() (*RelationshipToUser, bool) { + if o == nil { + return nil, false + } + return &o.User, true +} + +// SetUser sets field value. +func (o *UserInvitationRelationships) SetUser(v RelationshipToUser) { + o.User = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserInvitationRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["user"] = o.User + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserInvitationRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + User *RelationshipToUser `json:"user"` + }{} + all := struct { + User RelationshipToUser `json:"user"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.User == nil { + return fmt.Errorf("Required field user missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.User.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.User = all.User + return nil +} diff --git a/api/v2/datadog/model_user_invitation_response.go b/api/v2/datadog/model_user_invitation_response.go new file mode 100644 index 00000000000..d20922b1591 --- /dev/null +++ b/api/v2/datadog/model_user_invitation_response.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UserInvitationResponse User invitation as returned by the API. +type UserInvitationResponse struct { + // Object of a user invitation returned by the API. + Data *UserInvitationResponseData `json:"data,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{} +} + +// NewUserInvitationResponse instantiates a new UserInvitationResponse 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 NewUserInvitationResponse() *UserInvitationResponse { + this := UserInvitationResponse{} + return &this +} + +// NewUserInvitationResponseWithDefaults instantiates a new UserInvitationResponse 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 NewUserInvitationResponseWithDefaults() *UserInvitationResponse { + this := UserInvitationResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UserInvitationResponse) GetData() UserInvitationResponseData { + if o == nil || o.Data == nil { + var ret UserInvitationResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationResponse) GetDataOk() (*UserInvitationResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UserInvitationResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given UserInvitationResponseData and assigns it to the Data field. +func (o *UserInvitationResponse) SetData(v UserInvitationResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserInvitationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserInvitationResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *UserInvitationResponseData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_user_invitation_response_data.go b/api/v2/datadog/model_user_invitation_response_data.go new file mode 100644 index 00000000000..ef52b24ea55 --- /dev/null +++ b/api/v2/datadog/model_user_invitation_response_data.go @@ -0,0 +1,199 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UserInvitationResponseData Object of a user invitation returned by the API. +type UserInvitationResponseData struct { + // Attributes of a user invitation. + Attributes *UserInvitationDataAttributes `json:"attributes,omitempty"` + // ID of the user invitation. + Id *string `json:"id,omitempty"` + // User invitations type. + Type *UserInvitationsType `json:"type,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{} +} + +// NewUserInvitationResponseData instantiates a new UserInvitationResponseData 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 NewUserInvitationResponseData() *UserInvitationResponseData { + this := UserInvitationResponseData{} + var typeVar UserInvitationsType = USERINVITATIONSTYPE_USER_INVITATIONS + this.Type = &typeVar + return &this +} + +// NewUserInvitationResponseDataWithDefaults instantiates a new UserInvitationResponseData 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 NewUserInvitationResponseDataWithDefaults() *UserInvitationResponseData { + this := UserInvitationResponseData{} + var typeVar UserInvitationsType = USERINVITATIONSTYPE_USER_INVITATIONS + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UserInvitationResponseData) GetAttributes() UserInvitationDataAttributes { + if o == nil || o.Attributes == nil { + var ret UserInvitationDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationResponseData) GetAttributesOk() (*UserInvitationDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *UserInvitationResponseData) HasAttributes() bool { + if o != nil && o.Attributes != nil { + return true + } + + return false +} + +// SetAttributes gets a reference to the given UserInvitationDataAttributes and assigns it to the Attributes field. +func (o *UserInvitationResponseData) SetAttributes(v UserInvitationDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UserInvitationResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UserInvitationResponseData) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UserInvitationResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *UserInvitationResponseData) GetType() UserInvitationsType { + if o == nil || o.Type == nil { + var ret UserInvitationsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationResponseData) GetTypeOk() (*UserInvitationsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *UserInvitationResponseData) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given UserInvitationsType and assigns it to the Type field. +func (o *UserInvitationResponseData) SetType(v UserInvitationsType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserInvitationResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserInvitationResponseData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Attributes *UserInvitationDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UserInvitationsType `json:"type,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_user_invitations_request.go b/api/v2/datadog/model_user_invitations_request.go new file mode 100644 index 00000000000..40f738a52fe --- /dev/null +++ b/api/v2/datadog/model_user_invitations_request.go @@ -0,0 +1,103 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserInvitationsRequest Object to invite users to join the organization. +type UserInvitationsRequest struct { + // List of user invitations. + Data []UserInvitationData `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{} +} + +// NewUserInvitationsRequest instantiates a new UserInvitationsRequest 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 NewUserInvitationsRequest(data []UserInvitationData) *UserInvitationsRequest { + this := UserInvitationsRequest{} + this.Data = data + return &this +} + +// NewUserInvitationsRequestWithDefaults instantiates a new UserInvitationsRequest 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 NewUserInvitationsRequestWithDefaults() *UserInvitationsRequest { + this := UserInvitationsRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *UserInvitationsRequest) GetData() []UserInvitationData { + if o == nil { + var ret []UserInvitationData + 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 *UserInvitationsRequest) GetDataOk() (*[]UserInvitationData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *UserInvitationsRequest) SetData(v []UserInvitationData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserInvitationsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserInvitationsRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *[]UserInvitationData `json:"data"` + }{} + all := struct { + Data []UserInvitationData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_user_invitations_response.go b/api/v2/datadog/model_user_invitations_response.go new file mode 100644 index 00000000000..837aaf90aa7 --- /dev/null +++ b/api/v2/datadog/model_user_invitations_response.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 datadog + +import ( + "encoding/json" +) + +// UserInvitationsResponse User invitations as returned by the API. +type UserInvitationsResponse struct { + // Array of user invitations. + Data []UserInvitationResponseData `json:"data,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{} +} + +// NewUserInvitationsResponse instantiates a new UserInvitationsResponse 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 NewUserInvitationsResponse() *UserInvitationsResponse { + this := UserInvitationsResponse{} + return &this +} + +// NewUserInvitationsResponseWithDefaults instantiates a new UserInvitationsResponse 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 NewUserInvitationsResponseWithDefaults() *UserInvitationsResponse { + this := UserInvitationsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UserInvitationsResponse) GetData() []UserInvitationResponseData { + if o == nil || o.Data == nil { + var ret []UserInvitationResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserInvitationsResponse) GetDataOk() (*[]UserInvitationResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UserInvitationsResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []UserInvitationResponseData and assigns it to the Data field. +func (o *UserInvitationsResponse) SetData(v []UserInvitationResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserInvitationsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserInvitationsResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []UserInvitationResponseData `json:"data,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_user_invitations_type.go b/api/v2/datadog/model_user_invitations_type.go new file mode 100644 index 00000000000..db3360f59e1 --- /dev/null +++ b/api/v2/datadog/model_user_invitations_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserInvitationsType User invitations type. +type UserInvitationsType string + +// List of UserInvitationsType. +const ( + USERINVITATIONSTYPE_USER_INVITATIONS UserInvitationsType = "user_invitations" +) + +var allowedUserInvitationsTypeEnumValues = []UserInvitationsType{ + USERINVITATIONSTYPE_USER_INVITATIONS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UserInvitationsType) GetAllowedValues() []UserInvitationsType { + return allowedUserInvitationsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UserInvitationsType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UserInvitationsType(value) + return nil +} + +// NewUserInvitationsTypeFromValue returns a pointer to a valid UserInvitationsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUserInvitationsTypeFromValue(v string) (*UserInvitationsType, error) { + ev := UserInvitationsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UserInvitationsType: valid values are %v", v, allowedUserInvitationsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UserInvitationsType) IsValid() bool { + for _, existing := range allowedUserInvitationsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UserInvitationsType value. +func (v UserInvitationsType) Ptr() *UserInvitationsType { + return &v +} + +// NullableUserInvitationsType handles when a null is used for UserInvitationsType. +type NullableUserInvitationsType struct { + value *UserInvitationsType + isSet bool +} + +// Get returns the associated value. +func (v NullableUserInvitationsType) Get() *UserInvitationsType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUserInvitationsType) Set(val *UserInvitationsType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUserInvitationsType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUserInvitationsType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUserInvitationsType initializes the struct as if Set has been called. +func NewNullableUserInvitationsType(val *UserInvitationsType) *NullableUserInvitationsType { + return &NullableUserInvitationsType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUserInvitationsType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUserInvitationsType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_user_relationships.go b/api/v2/datadog/model_user_relationships.go new file mode 100644 index 00000000000..cc3d04a6f52 --- /dev/null +++ b/api/v2/datadog/model_user_relationships.go @@ -0,0 +1,109 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UserRelationships Relationships of the user object. +type UserRelationships struct { + // Relationship to roles. + Roles *RelationshipToRoles `json:"roles,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{} +} + +// NewUserRelationships instantiates a new UserRelationships 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 NewUserRelationships() *UserRelationships { + this := UserRelationships{} + return &this +} + +// NewUserRelationshipsWithDefaults instantiates a new UserRelationships 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 NewUserRelationshipsWithDefaults() *UserRelationships { + this := UserRelationships{} + return &this +} + +// GetRoles returns the Roles field value if set, zero value otherwise. +func (o *UserRelationships) GetRoles() RelationshipToRoles { + if o == nil || o.Roles == nil { + var ret RelationshipToRoles + return ret + } + return *o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserRelationships) GetRolesOk() (*RelationshipToRoles, bool) { + if o == nil || o.Roles == nil { + return nil, false + } + return o.Roles, true +} + +// HasRoles returns a boolean if a field has been set. +func (o *UserRelationships) HasRoles() bool { + if o != nil && o.Roles != nil { + return true + } + + return false +} + +// SetRoles gets a reference to the given RelationshipToRoles and assigns it to the Roles field. +func (o *UserRelationships) SetRoles(v RelationshipToRoles) { + o.Roles = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Roles != nil { + toSerialize["roles"] = o.Roles + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Roles *RelationshipToRoles `json:"roles,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Roles != nil && all.Roles.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Roles = all.Roles + return nil +} diff --git a/api/v2/datadog/model_user_response.go b/api/v2/datadog/model_user_response.go new file mode 100644 index 00000000000..2189a4245f5 --- /dev/null +++ b/api/v2/datadog/model_user_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 datadog + +import ( + "encoding/json" +) + +// UserResponse Response containing information about a single user. +type UserResponse struct { + // User object returned by the API. + Data *User `json:"data,omitempty"` + // Array of objects related to the user. + Included []UserResponseIncludedItem `json:"included,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{} +} + +// NewUserResponse instantiates a new UserResponse 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 NewUserResponse() *UserResponse { + this := UserResponse{} + return &this +} + +// NewUserResponseWithDefaults instantiates a new UserResponse 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 NewUserResponseWithDefaults() *UserResponse { + this := UserResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UserResponse) GetData() User { + if o == nil || o.Data == nil { + var ret User + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserResponse) GetDataOk() (*User, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UserResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given User and assigns it to the Data field. +func (o *UserResponse) SetData(v User) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *UserResponse) GetIncluded() []UserResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []UserResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserResponse) GetIncludedOk() (*[]UserResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *UserResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []UserResponseIncludedItem and assigns it to the Included field. +func (o *UserResponse) SetIncluded(v []UserResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data *User `json:"data,omitempty"` + Included []UserResponseIncludedItem `json:"included,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + o.Included = all.Included + return nil +} diff --git a/api/v2/datadog/model_user_response_included_item.go b/api/v2/datadog/model_user_response_included_item.go new file mode 100644 index 00000000000..db4ed2e379b --- /dev/null +++ b/api/v2/datadog/model_user_response_included_item.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UserResponseIncludedItem - An object related to a user. +type UserResponseIncludedItem struct { + Organization *Organization + Permission *Permission + Role *Role + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// OrganizationAsUserResponseIncludedItem is a convenience function that returns Organization wrapped in UserResponseIncludedItem. +func OrganizationAsUserResponseIncludedItem(v *Organization) UserResponseIncludedItem { + return UserResponseIncludedItem{Organization: v} +} + +// PermissionAsUserResponseIncludedItem is a convenience function that returns Permission wrapped in UserResponseIncludedItem. +func PermissionAsUserResponseIncludedItem(v *Permission) UserResponseIncludedItem { + return UserResponseIncludedItem{Permission: v} +} + +// RoleAsUserResponseIncludedItem is a convenience function that returns Role wrapped in UserResponseIncludedItem. +func RoleAsUserResponseIncludedItem(v *Role) UserResponseIncludedItem { + return UserResponseIncludedItem{Role: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *UserResponseIncludedItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Organization + err = json.Unmarshal(data, &obj.Organization) + if err == nil { + if obj.Organization != nil && obj.Organization.UnparsedObject == nil { + jsonOrganization, _ := json.Marshal(obj.Organization) + if string(jsonOrganization) == "{}" { // empty struct + obj.Organization = nil + } else { + match++ + } + } else { + obj.Organization = nil + } + } else { + obj.Organization = nil + } + + // try to unmarshal data into Permission + err = json.Unmarshal(data, &obj.Permission) + if err == nil { + if obj.Permission != nil && obj.Permission.UnparsedObject == nil { + jsonPermission, _ := json.Marshal(obj.Permission) + if string(jsonPermission) == "{}" { // empty struct + obj.Permission = nil + } else { + match++ + } + } else { + obj.Permission = nil + } + } else { + obj.Permission = nil + } + + // try to unmarshal data into Role + err = json.Unmarshal(data, &obj.Role) + if err == nil { + if obj.Role != nil && obj.Role.UnparsedObject == nil { + jsonRole, _ := json.Marshal(obj.Role) + if string(jsonRole) == "{}" { // empty struct + obj.Role = nil + } else { + match++ + } + } else { + obj.Role = nil + } + } else { + obj.Role = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.Organization = nil + obj.Permission = nil + obj.Role = nil + return json.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj UserResponseIncludedItem) MarshalJSON() ([]byte, error) { + if obj.Organization != nil { + return json.Marshal(&obj.Organization) + } + + if obj.Permission != nil { + return json.Marshal(&obj.Permission) + } + + if obj.Role != nil { + return json.Marshal(&obj.Role) + } + + if obj.UnparsedObject != nil { + return json.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *UserResponseIncludedItem) GetActualInstance() interface{} { + if obj.Organization != nil { + return obj.Organization + } + + if obj.Permission != nil { + return obj.Permission + } + + if obj.Role != nil { + return obj.Role + } + + // all schemas are nil + return nil +} + +// NullableUserResponseIncludedItem handles when a null is used for UserResponseIncludedItem. +type NullableUserResponseIncludedItem struct { + value *UserResponseIncludedItem + isSet bool +} + +// Get returns the associated value. +func (v NullableUserResponseIncludedItem) Get() *UserResponseIncludedItem { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUserResponseIncludedItem) Set(val *UserResponseIncludedItem) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUserResponseIncludedItem) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableUserResponseIncludedItem) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUserResponseIncludedItem initializes the struct as if Set has been called. +func NewNullableUserResponseIncludedItem(val *UserResponseIncludedItem) *NullableUserResponseIncludedItem { + return &NullableUserResponseIncludedItem{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUserResponseIncludedItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUserResponseIncludedItem) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_user_response_relationships.go b/api/v2/datadog/model_user_response_relationships.go new file mode 100644 index 00000000000..307355dfce1 --- /dev/null +++ b/api/v2/datadog/model_user_response_relationships.go @@ -0,0 +1,247 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UserResponseRelationships Relationships of the user object returned by the API. +type UserResponseRelationships struct { + // Relationship to an organization. + Org *RelationshipToOrganization `json:"org,omitempty"` + // Relationship to organizations. + OtherOrgs *RelationshipToOrganizations `json:"other_orgs,omitempty"` + // Relationship to users. + OtherUsers *RelationshipToUsers `json:"other_users,omitempty"` + // Relationship to roles. + Roles *RelationshipToRoles `json:"roles,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{} +} + +// NewUserResponseRelationships instantiates a new UserResponseRelationships 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 NewUserResponseRelationships() *UserResponseRelationships { + this := UserResponseRelationships{} + return &this +} + +// NewUserResponseRelationshipsWithDefaults instantiates a new UserResponseRelationships 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 NewUserResponseRelationshipsWithDefaults() *UserResponseRelationships { + this := UserResponseRelationships{} + return &this +} + +// GetOrg returns the Org field value if set, zero value otherwise. +func (o *UserResponseRelationships) GetOrg() RelationshipToOrganization { + if o == nil || o.Org == nil { + var ret RelationshipToOrganization + return ret + } + return *o.Org +} + +// GetOrgOk returns a tuple with the Org field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserResponseRelationships) GetOrgOk() (*RelationshipToOrganization, bool) { + if o == nil || o.Org == nil { + return nil, false + } + return o.Org, true +} + +// HasOrg returns a boolean if a field has been set. +func (o *UserResponseRelationships) HasOrg() bool { + if o != nil && o.Org != nil { + return true + } + + return false +} + +// SetOrg gets a reference to the given RelationshipToOrganization and assigns it to the Org field. +func (o *UserResponseRelationships) SetOrg(v RelationshipToOrganization) { + o.Org = &v +} + +// GetOtherOrgs returns the OtherOrgs field value if set, zero value otherwise. +func (o *UserResponseRelationships) GetOtherOrgs() RelationshipToOrganizations { + if o == nil || o.OtherOrgs == nil { + var ret RelationshipToOrganizations + return ret + } + return *o.OtherOrgs +} + +// GetOtherOrgsOk returns a tuple with the OtherOrgs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserResponseRelationships) GetOtherOrgsOk() (*RelationshipToOrganizations, bool) { + if o == nil || o.OtherOrgs == nil { + return nil, false + } + return o.OtherOrgs, true +} + +// HasOtherOrgs returns a boolean if a field has been set. +func (o *UserResponseRelationships) HasOtherOrgs() bool { + if o != nil && o.OtherOrgs != nil { + return true + } + + return false +} + +// SetOtherOrgs gets a reference to the given RelationshipToOrganizations and assigns it to the OtherOrgs field. +func (o *UserResponseRelationships) SetOtherOrgs(v RelationshipToOrganizations) { + o.OtherOrgs = &v +} + +// GetOtherUsers returns the OtherUsers field value if set, zero value otherwise. +func (o *UserResponseRelationships) GetOtherUsers() RelationshipToUsers { + if o == nil || o.OtherUsers == nil { + var ret RelationshipToUsers + return ret + } + return *o.OtherUsers +} + +// GetOtherUsersOk returns a tuple with the OtherUsers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserResponseRelationships) GetOtherUsersOk() (*RelationshipToUsers, bool) { + if o == nil || o.OtherUsers == nil { + return nil, false + } + return o.OtherUsers, true +} + +// HasOtherUsers returns a boolean if a field has been set. +func (o *UserResponseRelationships) HasOtherUsers() bool { + if o != nil && o.OtherUsers != nil { + return true + } + + return false +} + +// SetOtherUsers gets a reference to the given RelationshipToUsers and assigns it to the OtherUsers field. +func (o *UserResponseRelationships) SetOtherUsers(v RelationshipToUsers) { + o.OtherUsers = &v +} + +// GetRoles returns the Roles field value if set, zero value otherwise. +func (o *UserResponseRelationships) GetRoles() RelationshipToRoles { + if o == nil || o.Roles == nil { + var ret RelationshipToRoles + return ret + } + return *o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserResponseRelationships) GetRolesOk() (*RelationshipToRoles, bool) { + if o == nil || o.Roles == nil { + return nil, false + } + return o.Roles, true +} + +// HasRoles returns a boolean if a field has been set. +func (o *UserResponseRelationships) HasRoles() bool { + if o != nil && o.Roles != nil { + return true + } + + return false +} + +// SetRoles gets a reference to the given RelationshipToRoles and assigns it to the Roles field. +func (o *UserResponseRelationships) SetRoles(v RelationshipToRoles) { + o.Roles = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserResponseRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Org != nil { + toSerialize["org"] = o.Org + } + if o.OtherOrgs != nil { + toSerialize["other_orgs"] = o.OtherOrgs + } + if o.OtherUsers != nil { + toSerialize["other_users"] = o.OtherUsers + } + if o.Roles != nil { + toSerialize["roles"] = o.Roles + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Org *RelationshipToOrganization `json:"org,omitempty"` + OtherOrgs *RelationshipToOrganizations `json:"other_orgs,omitempty"` + OtherUsers *RelationshipToUsers `json:"other_users,omitempty"` + Roles *RelationshipToRoles `json:"roles,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Org != nil && all.Org.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Org = all.Org + if all.OtherOrgs != nil && all.OtherOrgs.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.OtherOrgs = all.OtherOrgs + if all.OtherUsers != nil && all.OtherUsers.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.OtherUsers = all.OtherUsers + if all.Roles != nil && all.Roles.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Roles = all.Roles + return nil +} diff --git a/api/v2/datadog/model_user_update_attributes.go b/api/v2/datadog/model_user_update_attributes.go new file mode 100644 index 00000000000..f3b6588d0a4 --- /dev/null +++ b/api/v2/datadog/model_user_update_attributes.go @@ -0,0 +1,180 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UserUpdateAttributes Attributes of the edited user. +type UserUpdateAttributes struct { + // If the user is enabled or disabled. + Disabled *bool `json:"disabled,omitempty"` + // The email of the user. + Email *string `json:"email,omitempty"` + // The name of the user. + Name *string `json:"name,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{} +} + +// NewUserUpdateAttributes instantiates a new UserUpdateAttributes 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 NewUserUpdateAttributes() *UserUpdateAttributes { + this := UserUpdateAttributes{} + return &this +} + +// NewUserUpdateAttributesWithDefaults instantiates a new UserUpdateAttributes 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 NewUserUpdateAttributesWithDefaults() *UserUpdateAttributes { + this := UserUpdateAttributes{} + return &this +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateAttributes) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasDisabled() bool { + if o != nil && o.Disabled != nil { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *UserUpdateAttributes) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateAttributes) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasEmail() bool { + if o != nil && o.Email != nil { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserUpdateAttributes) SetEmail(v string) { + o.Email = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UserUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Disabled = all.Disabled + o.Email = all.Email + o.Name = all.Name + return nil +} diff --git a/api/v2/datadog/model_user_update_data.go b/api/v2/datadog/model_user_update_data.go new file mode 100644 index 00000000000..c9660e41860 --- /dev/null +++ b/api/v2/datadog/model_user_update_data.go @@ -0,0 +1,186 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserUpdateData Object to update a user. +type UserUpdateData struct { + // Attributes of the edited user. + Attributes UserUpdateAttributes `json:"attributes"` + // ID of the user. + Id string `json:"id"` + // Users resource type. + Type UsersType `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{} +} + +// NewUserUpdateData instantiates a new UserUpdateData 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 NewUserUpdateData(attributes UserUpdateAttributes, id string, typeVar UsersType) *UserUpdateData { + this := UserUpdateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewUserUpdateDataWithDefaults instantiates a new UserUpdateData 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 NewUserUpdateDataWithDefaults() *UserUpdateData { + this := UserUpdateData{} + var typeVar UsersType = USERSTYPE_USERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *UserUpdateData) GetAttributes() UserUpdateAttributes { + if o == nil { + var ret UserUpdateAttributes + 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 *UserUpdateData) GetAttributesOk() (*UserUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *UserUpdateData) SetAttributes(v UserUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *UserUpdateData) 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 *UserUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *UserUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *UserUpdateData) GetType() UsersType { + if o == nil { + var ret UsersType + 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 *UserUpdateData) GetTypeOk() (*UsersType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UserUpdateData) SetType(v UsersType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.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 json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserUpdateData) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Attributes *UserUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *UsersType `json:"type"` + }{} + all := struct { + Attributes UserUpdateAttributes `json:"attributes"` + Id string `json:"id"` + Type UsersType `json:"type"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Attributes == nil { + return fmt.Errorf("Required field attributes missing") + } + if required.Id == nil { + return fmt.Errorf("Required field id missing") + } + if required.Type == nil { + return fmt.Errorf("Required field type missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + return nil +} diff --git a/api/v2/datadog/model_user_update_request.go b/api/v2/datadog/model_user_update_request.go new file mode 100644 index 00000000000..b5a14d5d483 --- /dev/null +++ b/api/v2/datadog/model_user_update_request.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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UserUpdateRequest Update a user. +type UserUpdateRequest struct { + // Object to update a user. + Data UserUpdateData `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{} +} + +// NewUserUpdateRequest instantiates a new UserUpdateRequest 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 NewUserUpdateRequest(data UserUpdateData) *UserUpdateRequest { + this := UserUpdateRequest{} + this.Data = data + return &this +} + +// NewUserUpdateRequestWithDefaults instantiates a new UserUpdateRequest 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 NewUserUpdateRequestWithDefaults() *UserUpdateRequest { + this := UserUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *UserUpdateRequest) GetData() UserUpdateData { + if o == nil { + var ret UserUpdateData + 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 *UserUpdateRequest) GetDataOk() (*UserUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *UserUpdateRequest) SetData(v UserUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Data *UserUpdateData `json:"data"` + }{} + all := struct { + Data UserUpdateData `json:"data"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Data == nil { + return fmt.Errorf("Required field data missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Data = all.Data + return nil +} diff --git a/api/v2/datadog/model_users_response.go b/api/v2/datadog/model_users_response.go new file mode 100644 index 00000000000..0acc716b14b --- /dev/null +++ b/api/v2/datadog/model_users_response.go @@ -0,0 +1,187 @@ +// 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 datadog + +import ( + "encoding/json" +) + +// UsersResponse Response containing information about multiple users. +type UsersResponse struct { + // Array of returned users. + Data []User `json:"data,omitempty"` + // Array of objects related to the users. + Included []UserResponseIncludedItem `json:"included,omitempty"` + // Object describing meta attributes of response. + Meta *ResponseMetaAttributes `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{} +} + +// NewUsersResponse instantiates a new UsersResponse 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 NewUsersResponse() *UsersResponse { + this := UsersResponse{} + return &this +} + +// NewUsersResponseWithDefaults instantiates a new UsersResponse 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 NewUsersResponseWithDefaults() *UsersResponse { + this := UsersResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UsersResponse) GetData() []User { + if o == nil || o.Data == nil { + var ret []User + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsersResponse) GetDataOk() (*[]User, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UsersResponse) HasData() bool { + if o != nil && o.Data != nil { + return true + } + + return false +} + +// SetData gets a reference to the given []User and assigns it to the Data field. +func (o *UsersResponse) SetData(v []User) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *UsersResponse) GetIncluded() []UserResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []UserResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UsersResponse) GetIncludedOk() (*[]UserResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *UsersResponse) HasIncluded() bool { + if o != nil && o.Included != nil { + return true + } + + return false +} + +// SetIncluded gets a reference to the given []UserResponseIncludedItem and assigns it to the Included field. +func (o *UsersResponse) SetIncluded(v []UserResponseIncludedItem) { + o.Included = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *UsersResponse) GetMeta() ResponseMetaAttributes { + if o == nil || o.Meta == nil { + var ret ResponseMetaAttributes + 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 *UsersResponse) GetMetaOk() (*ResponseMetaAttributes, 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 *UsersResponse) HasMeta() bool { + if o != nil && o.Meta != nil { + return true + } + + return false +} + +// SetMeta gets a reference to the given ResponseMetaAttributes and assigns it to the Meta field. +func (o *UsersResponse) SetMeta(v ResponseMetaAttributes) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UsersResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UsersResponse) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Data []User `json:"data,omitempty"` + Included []UserResponseIncludedItem `json:"included,omitempty"` + Meta *ResponseMetaAttributes `json:"meta,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Data = all.Data + o.Included = all.Included + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.Meta = all.Meta + return nil +} diff --git a/api/v2/datadog/model_users_type.go b/api/v2/datadog/model_users_type.go new file mode 100644 index 00000000000..16187ee4798 --- /dev/null +++ b/api/v2/datadog/model_users_type.go @@ -0,0 +1,107 @@ +// 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 datadog + +import ( + "encoding/json" + "fmt" +) + +// UsersType Users resource type. +type UsersType string + +// List of UsersType. +const ( + USERSTYPE_USERS UsersType = "users" +) + +var allowedUsersTypeEnumValues = []UsersType{ + USERSTYPE_USERS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UsersType) GetAllowedValues() []UsersType { + return allowedUsersTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UsersType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UsersType(value) + return nil +} + +// NewUsersTypeFromValue returns a pointer to a valid UsersType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUsersTypeFromValue(v string) (*UsersType, error) { + ev := UsersType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UsersType: valid values are %v", v, allowedUsersTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UsersType) IsValid() bool { + for _, existing := range allowedUsersTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UsersType value. +func (v UsersType) Ptr() *UsersType { + return &v +} + +// NullableUsersType handles when a null is used for UsersType. +type NullableUsersType struct { + value *UsersType + isSet bool +} + +// Get returns the associated value. +func (v NullableUsersType) Get() *UsersType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableUsersType) Set(val *UsersType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableUsersType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableUsersType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableUsersType initializes the struct as if Set has been called. +func NewNullableUsersType(val *UsersType) *NullableUsersType { + return &NullableUsersType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableUsersType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableUsersType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}